diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 21339a75a4f0..91af631d3c14 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -174,7 +174,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 9511da3739da..19d7afa9e4a6 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20230905.4" + "@azure-tools/typespec-csharp": "0.2.0-alpha.20230906.8" } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ArmAdvisorModelFactory.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ArmAdvisorModelFactory.cs index e10e304acf65..8404660a6941 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ArmAdvisorModelFactory.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ArmAdvisorModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Advisor.Models /// Model factory for models. public static partial class ArmAdvisorModelFactory { - /// Initializes a new instance of MetadataEntityData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,19 +33,19 @@ public static MetadataEntityData MetadataEntityData(ResourceIdentifier id = null applicableScenarios ??= new List(); supportedValues ??= new List(); - return new MetadataEntityData(id, name, resourceType, systemData, displayName, dependsOn?.ToList(), applicableScenarios?.ToList(), supportedValues?.ToList()); + return new MetadataEntityData(id, name, resourceType, systemData, displayName, dependsOn?.ToList(), applicableScenarios?.ToList(), supportedValues?.ToList(), default); } - /// Initializes a new instance of MetadataSupportedValueDetail. + /// Initializes a new instance of . /// The id. /// The display name. /// A new instance for mocking. public static MetadataSupportedValueDetail MetadataSupportedValueDetail(string id = null, string displayName = null) { - return new MetadataSupportedValueDetail(id, displayName); + return new MetadataSupportedValueDetail(id, displayName, default); } - /// Initializes a new instance of ConfigData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -58,10 +58,10 @@ public static ConfigData ConfigData(ResourceIdentifier id = null, string name = { digests ??= new List(); - return new ConfigData(id, name, resourceType, systemData, exclude, lowCpuThreshold, digests?.ToList()); + return new ConfigData(id, name, resourceType, systemData, exclude, lowCpuThreshold, digests?.ToList(), default); } - /// Initializes a new instance of ResourceRecommendationBaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -95,10 +95,10 @@ public static ResourceRecommendationBaseData ResourceRecommendationBaseData(Reso remediation ??= new Dictionary(); exposedMetadataProperties ??= new Dictionary(); - return new ResourceRecommendationBaseData(id, name, resourceType, systemData, category, impact, impactedField, impactedValue, lastUpdated, metadata, recommendationTypeId, risk, shortDescription, suppressionIds?.ToList(), extendedProperties, resourceMetadata, description, label, learnMoreLink, potentialBenefits, actions?.ToList(), remediation, exposedMetadataProperties); + return new ResourceRecommendationBaseData(id, name, resourceType, systemData, category, impact, impactedField, impactedValue, lastUpdated, metadata, recommendationTypeId, risk, shortDescription, suppressionIds?.ToList(), extendedProperties, resourceMetadata, description, label, learnMoreLink, potentialBenefits, actions?.ToList(), remediation, exposedMetadataProperties, default); } - /// Initializes a new instance of SuppressionContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -109,7 +109,7 @@ public static ResourceRecommendationBaseData ResourceRecommendationBaseData(Reso /// A new instance for mocking. public static SuppressionContractData SuppressionContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string suppressionId = null, string ttl = null, DateTimeOffset? expirationTimeStamp = null) { - return new SuppressionContractData(id, name, resourceType, systemData, suppressionId, ttl, expirationTimeStamp); + return new SuppressionContractData(id, name, resourceType, systemData, suppressionId, ttl, expirationTimeStamp, default); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 8522f25ddb5e..b0916eecdeea 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -303,7 +303,7 @@ public virtual AsyncPageable GetSuppressionContract { HttpMessage FirstPageRequest(int? pageSizeHint) => SuppressionContractSuppressionsRestClient.CreateListRequest(Id.SubscriptionId, top, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SuppressionContractSuppressionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSuppressionContracts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSuppressionContracts", "value", "nextLink", cancellationToken); } /// @@ -327,7 +327,7 @@ public virtual Pageable GetSuppressionContracts(int { HttpMessage FirstPageRequest(int? pageSizeHint) => SuppressionContractSuppressionsRestClient.CreateListRequest(Id.SubscriptionId, top, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SuppressionContractSuppressionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSuppressionContracts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSuppressionContracts", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs index dbda0f9dc4b2..a2314eeac8b1 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _metadataEntityRecommendationMetadataRestClient.CreateListRequest(); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _metadataEntityRecommendationMetadataRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MetadataEntityResource(Client, MetadataEntityData.DeserializeMetadataEntityData(e)), _metadataEntityRecommendationMetadataClientDiagnostics, Pipeline, "MetadataEntityCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MetadataEntityResource(Client, MetadataEntityData.DeserializeMetadataEntityData(e)), _metadataEntityRecommendationMetadataClientDiagnostics, Pipeline, "MetadataEntityCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -169,7 +169,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _metadataEntityRecommendationMetadataRestClient.CreateListRequest(); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _metadataEntityRecommendationMetadataRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MetadataEntityResource(Client, MetadataEntityData.DeserializeMetadataEntityData(e)), _metadataEntityRecommendationMetadataClientDiagnostics, Pipeline, "MetadataEntityCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MetadataEntityResource(Client, MetadataEntityData.DeserializeMetadataEntityData(e)), _metadataEntityRecommendationMetadataClientDiagnostics, Pipeline, "MetadataEntityCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityData.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityData.cs index 9226e451c2ff..962b94620f26 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityData.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Advisor.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.Advisor /// public partial class MetadataEntityData : ResourceData { - /// Initializes a new instance of MetadataEntityData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MetadataEntityData() { DependsOn = new ChangeTrackingList(); @@ -26,7 +30,7 @@ internal MetadataEntityData() SupportedValues = new ChangeTrackingList(); } - /// Initializes a new instance of MetadataEntityData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +39,14 @@ internal MetadataEntityData() /// The list of keys on which this entity depends on. /// The list of scenarios applicable to this metadata entity. /// The list of supported values. - internal MetadataEntityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IReadOnlyList dependsOn, IReadOnlyList applicableScenarios, IReadOnlyList supportedValues) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal MetadataEntityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IReadOnlyList dependsOn, IReadOnlyList applicableScenarios, IReadOnlyList supportedValues, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; DependsOn = dependsOn; ApplicableScenarios = applicableScenarios; SupportedValues = supportedValues; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The display name. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.Serialization.cs index ef78338a050d..5af53e3c75b0 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Advisor.Models { - public partial class ConfigData : IUtf8JsonSerializable + public partial class ConfigData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,16 +42,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Digests) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfigData DeserializeConfigData(JsonElement element) + internal static ConfigData DeserializeConfigData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +84,7 @@ internal static ConfigData DeserializeConfigData(JsonElement element) Optional exclude = default; Optional lowCpuThreshold = default; Optional> digests = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -126,8 +155,61 @@ internal static ConfigData DeserializeConfigData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfigData(id, name, type, systemData.Value, Optional.ToNullable(exclude), Optional.ToNullable(lowCpuThreshold), Optional.ToList(digests), serializedAdditionalRawData); + } + + ConfigData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigData(Response response) + { + if (response is null) + { + return null; } - return new ConfigData(id, name, type, systemData.Value, Optional.ToNullable(exclude), Optional.ToNullable(lowCpuThreshold), Optional.ToList(digests)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.cs index 498bdaa63bcd..2001d33da96a 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.Advisor.Models /// The Advisor configuration data structure. public partial class ConfigData : ResourceData { - /// Initializes a new instance of ConfigData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfigData() { Digests = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -28,11 +32,13 @@ public ConfigData() /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. /// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. /// Advisor digest configuration. Valid only for subscriptions. - internal ConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? exclude, CpuThreshold? lowCpuThreshold, IList digests) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? exclude, CpuThreshold? lowCpuThreshold, IList digests, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Exclude = exclude; LowCpuThreshold = lowCpuThreshold; Digests = digests; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Exclude the resource from Advisor evaluations. Valid values: False (default) or True. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.Serialization.cs index 00af8a3a81f9..f416eefe0edf 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Advisor.Models { - internal partial class ConfigurationListResult + internal partial class ConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigurationListResult DeserializeConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationListResult DeserializeConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static ConfigurationListResult DeserializeConfigurationListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigurationListResult(Optional.ToList(value), nextLink.Value); + return new ConfigurationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.cs index 1fe9d33dbb16..f3578cc5b474 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Advisor.Models /// The list of Advisor configurations. internal partial class ConfigurationListResult { - /// Initializes a new instance of ConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigurationListResult. + /// Initializes a new instance of . /// The list of configurations. /// The link used to get the next page of configurations. - internal ConfigurationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConfigurationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of configurations. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.Serialization.cs index c5bd7c04e742..515ea5ed2221 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Advisor.Models { - public partial class DigestConfig : IUtf8JsonSerializable + public partial class DigestConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("state"u8); writer.WriteStringValue(State.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DigestConfig DeserializeDigestConfig(JsonElement element) + internal static DigestConfig DeserializeDigestConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +87,7 @@ internal static DigestConfig DeserializeDigestConfig(JsonElement element) Optional> categories = default; Optional language = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -115,8 +137,61 @@ internal static DigestConfig DeserializeDigestConfig(JsonElement element) state = new DigestConfigState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DigestConfig(name.Value, actionGroupResourceId.Value, Optional.ToNullable(frequency), Optional.ToList(categories), language.Value, Optional.ToNullable(state), serializedAdditionalRawData); + } + + DigestConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDigestConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DigestConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDigestConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DigestConfig model) + { + if (model is null) + { + return null; } - return new DigestConfig(name.Value, actionGroupResourceId.Value, Optional.ToNullable(frequency), Optional.ToList(categories), language.Value, Optional.ToNullable(state)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DigestConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDigestConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.cs index 3f827839f84e..2378815ae20c 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/DigestConfig.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.Advisor.Models /// Advisor Digest configuration entity. public partial class DigestConfig { - /// Initializes a new instance of DigestConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DigestConfig() { Categories = new ChangeTrackingList(); } - /// Initializes a new instance of DigestConfig. + /// Initializes a new instance of . /// Name of digest configuration. Value is case-insensitive and must be unique within a subscription. /// Action group resource id used by digest. /// Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive. /// Categories to send digest for. If categories are not provided, then digest will be sent for all categories. /// Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise, it will be converted into one. Default value is English (en). /// State of digest configuration. - internal DigestConfig(string name, string actionGroupResourceId, int? frequency, IList categories, string language, DigestConfigState? state) + /// Keeps track of any properties unknown to the library. + internal DigestConfig(string name, string actionGroupResourceId, int? frequency, IList categories, string language, DigestConfigState? state, Dictionary serializedAdditionalRawData) { Name = name; ActionGroupResourceId = actionGroupResourceId; @@ -34,6 +39,7 @@ internal DigestConfig(string name, string actionGroupResourceId, int? frequency, Categories = categories; Language = language; State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of digest configuration. Value is case-insensitive and must be unique within a subscription. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityData.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityData.Serialization.cs index df94e734782e..7388e7de5593 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityData.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityData.Serialization.cs @@ -5,18 +5,90 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Advisor.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Advisor { - public partial class MetadataEntityData + public partial class MetadataEntityData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MetadataEntityData DeserializeMetadataEntityData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(DependsOn)) + { + writer.WritePropertyName("dependsOn"u8); + writer.WriteStartArray(); + foreach (var item in DependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ApplicableScenarios)) + { + writer.WritePropertyName("applicableScenarios"u8); + writer.WriteStartArray(); + foreach (var item in ApplicableScenarios) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SupportedValues)) + { + writer.WritePropertyName("supportedValues"u8); + writer.WriteStartArray(); + foreach (var item in SupportedValues) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MetadataEntityData DeserializeMetadataEntityData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +101,7 @@ internal static MetadataEntityData DeserializeMetadataEntityData(JsonElement ele Optional> dependsOn = default; Optional> applicableScenarios = default; Optional> supportedValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -114,8 +187,61 @@ internal static MetadataEntityData DeserializeMetadataEntityData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MetadataEntityData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(dependsOn), Optional.ToList(applicableScenarios), Optional.ToList(supportedValues), serializedAdditionalRawData); + } + + MetadataEntityData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataEntityData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetadataEntityData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetadataEntityData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetadataEntityData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetadataEntityData(Response response) + { + if (response is null) + { + return null; } - return new MetadataEntityData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(dependsOn), Optional.ToList(applicableScenarios), Optional.ToList(supportedValues)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetadataEntityData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.Serialization.cs index a0efd6f5fbc7..81d993ad7d86 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Advisor; namespace Azure.ResourceManager.Advisor.Models { - internal partial class MetadataEntityListResult + internal partial class MetadataEntityListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MetadataEntityListResult DeserializeMetadataEntityListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MetadataEntityListResult DeserializeMetadataEntityListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static MetadataEntityListResult DeserializeMetadataEntityListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MetadataEntityListResult(Optional.ToList(value), nextLink.Value); + return new MetadataEntityListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MetadataEntityListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataEntityListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetadataEntityListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetadataEntityListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetadataEntityListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetadataEntityListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetadataEntityListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.cs index 388ab615c904..50649cdf054f 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataEntityListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Advisor; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Advisor.Models /// The list of metadata entities. internal partial class MetadataEntityListResult { - /// Initializes a new instance of MetadataEntityListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MetadataEntityListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MetadataEntityListResult. + /// Initializes a new instance of . /// The list of metadata entities. /// The link used to get the next page of metadata. - internal MetadataEntityListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MetadataEntityListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of metadata entities. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs index 01af87a23a99..ad95f22c8907 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Advisor.Models { - public partial class MetadataSupportedValueDetail + public partial class MetadataSupportedValueDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MetadataSupportedValueDetail DeserializeMetadataSupportedValueDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MetadataSupportedValueDetail DeserializeMetadataSupportedValueDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -32,8 +71,61 @@ internal static MetadataSupportedValueDetail DeserializeMetadataSupportedValueDe displayName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MetadataSupportedValueDetail(id.Value, displayName.Value); + return new MetadataSupportedValueDetail(id.Value, displayName.Value, serializedAdditionalRawData); + } + + MetadataSupportedValueDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataSupportedValueDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetadataSupportedValueDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetadataSupportedValueDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetadataSupportedValueDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetadataSupportedValueDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetadataSupportedValueDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.cs index 3bff8ec69774..e7e369df7de1 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/MetadataSupportedValueDetail.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Advisor.Models { /// The metadata supported value detail. public partial class MetadataSupportedValueDetail { - /// Initializes a new instance of MetadataSupportedValueDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MetadataSupportedValueDetail() { } - /// Initializes a new instance of MetadataSupportedValueDetail. + /// Initializes a new instance of . /// The id. /// The display name. - internal MetadataSupportedValueDetail(string id, string displayName) + /// Keeps track of any properties unknown to the library. + internal MetadataSupportedValueDetail(string id, string displayName, Dictionary serializedAdditionalRawData) { Id = id; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.Serialization.cs index ca5188939bd7..188936df25f5 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Advisor.Models { - public partial class ResourceMetadata : IUtf8JsonSerializable + public partial class ResourceMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -57,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("plural"u8); writer.WriteStringValue(Plural); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element) + internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +91,7 @@ internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element Optional> action = default; Optional singular = default; Optional plural = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -114,8 +135,61 @@ internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element plural = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceMetadata(resourceId.Value, source.Value, Optional.ToDictionary(action), singular.Value, plural.Value); + return new ResourceMetadata(resourceId.Value, source.Value, Optional.ToDictionary(action), singular.Value, plural.Value, serializedAdditionalRawData); + } + + ResourceMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.cs index c2bb7b372573..d4e0b442b624 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceMetadata.cs @@ -14,25 +14,30 @@ namespace Azure.ResourceManager.Advisor.Models /// Recommendation resource metadata. public partial class ResourceMetadata { - /// Initializes a new instance of ResourceMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourceMetadata() { Action = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ResourceMetadata. + /// Initializes a new instance of . /// Azure resource Id of the assessed resource. /// Source from which recommendation is generated. /// The action to view resource. /// The singular user friendly name of resource type. eg: virtual machine. /// The plural user friendly name of resource type. eg: virtual machines. - internal ResourceMetadata(string resourceId, string source, IDictionary action, string singular, string plural) + /// Keeps track of any properties unknown to the library. + internal ResourceMetadata(string resourceId, string source, IDictionary action, string singular, string plural, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; Source = source; Action = action; Singular = singular; Plural = plural; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Azure resource Id of the assessed resource. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseData.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseData.Serialization.cs index b8a0f40fab4b..8e0e31419a58 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseData.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Advisor.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Advisor { - public partial class ResourceRecommendationBaseData : IUtf8JsonSerializable + public partial class ResourceRecommendationBaseData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -79,7 +85,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ShortDescription)) { writer.WritePropertyName("shortDescription"u8); - writer.WriteObjectValue(ShortDescription); + if (ShortDescription is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShortDescription).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(SuppressionIds)) { @@ -105,7 +118,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ResourceMetadata)) { writer.WritePropertyName("resourceMetadata"u8); - writer.WriteObjectValue(ResourceMetadata); + if (ResourceMetadata is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResourceMetadata).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -198,11 +218,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceRecommendationBaseData DeserializeResourceRecommendationBaseData(JsonElement element) + internal static ResourceRecommendationBaseData DeserializeResourceRecommendationBaseData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -230,6 +264,7 @@ internal static ResourceRecommendationBaseData DeserializeResourceRecommendation Optional>> actions = default; Optional> remediation = default; Optional> exposedMetadataProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -481,8 +516,61 @@ internal static ResourceRecommendationBaseData DeserializeResourceRecommendation } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceRecommendationBaseData(id, name, type, systemData.Value, Optional.ToNullable(category), Optional.ToNullable(impact), impactedField.Value, impactedValue.Value, Optional.ToNullable(lastUpdated), Optional.ToDictionary(metadata), recommendationTypeId.Value, Optional.ToNullable(risk), shortDescription.Value, Optional.ToList(suppressionIds), Optional.ToDictionary(extendedProperties), resourceMetadata.Value, description.Value, label.Value, learnMoreLink.Value, potentialBenefits.Value, Optional.ToList(actions), Optional.ToDictionary(remediation), Optional.ToDictionary(exposedMetadataProperties)); + return new ResourceRecommendationBaseData(id, name, type, systemData.Value, Optional.ToNullable(category), Optional.ToNullable(impact), impactedField.Value, impactedValue.Value, Optional.ToNullable(lastUpdated), Optional.ToDictionary(metadata), recommendationTypeId.Value, Optional.ToNullable(risk), shortDescription.Value, Optional.ToList(suppressionIds), Optional.ToDictionary(extendedProperties), resourceMetadata.Value, description.Value, label.Value, learnMoreLink.Value, potentialBenefits.Value, Optional.ToList(actions), Optional.ToDictionary(remediation), Optional.ToDictionary(exposedMetadataProperties), serializedAdditionalRawData); + } + + ResourceRecommendationBaseData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceRecommendationBaseData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceRecommendationBaseData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceRecommendationBaseData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceRecommendationBaseData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceRecommendationBaseData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceRecommendationBaseData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.Serialization.cs index 592392e2250b..6cc99fbaaf2a 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Advisor; namespace Azure.ResourceManager.Advisor.Models { - internal partial class ResourceRecommendationBaseListResult + internal partial class ResourceRecommendationBaseListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceRecommendationBaseListResult DeserializeResourceRecommendationBaseListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceRecommendationBaseListResult DeserializeResourceRecommendationBaseListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +93,61 @@ internal static ResourceRecommendationBaseListResult DeserializeResourceRecommen value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceRecommendationBaseListResult(nextLink.Value, Optional.ToList(value)); + return new ResourceRecommendationBaseListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ResourceRecommendationBaseListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceRecommendationBaseListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceRecommendationBaseListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceRecommendationBaseListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceRecommendationBaseListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceRecommendationBaseListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceRecommendationBaseListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.cs index 9c49d547d689..57e3449a3e5e 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ResourceRecommendationBaseListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Advisor; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Advisor.Models /// The list of Advisor recommendations. internal partial class ResourceRecommendationBaseListResult { - /// Initializes a new instance of ResourceRecommendationBaseListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceRecommendationBaseListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ResourceRecommendationBaseListResult. + /// Initializes a new instance of . /// The link used to get the next page of recommendations. /// The list of recommendations. - internal ResourceRecommendationBaseListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ResourceRecommendationBaseListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of recommendations. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.Serialization.cs index 48c0f69ec7cd..0c579609a761 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Advisor.Models { - public partial class ShortDescription : IUtf8JsonSerializable + public partial class ShortDescription : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Problem)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("solution"u8); writer.WriteStringValue(Solution); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ShortDescription DeserializeShortDescription(JsonElement element) + internal static ShortDescription DeserializeShortDescription(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional problem = default; Optional solution = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("problem"u8)) @@ -48,8 +71,61 @@ internal static ShortDescription DeserializeShortDescription(JsonElement element solution = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ShortDescription(problem.Value, solution.Value, serializedAdditionalRawData); + } + + ShortDescription IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShortDescription(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShortDescription IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShortDescription(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShortDescription model) + { + if (model is null) + { + return null; } - return new ShortDescription(problem.Value, solution.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShortDescription(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShortDescription(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.cs index 10fbf39af33d..dcd6e68164e6 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/ShortDescription.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Advisor.Models { /// A summary of the recommendation. public partial class ShortDescription { - /// Initializes a new instance of ShortDescription. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ShortDescription() { } - /// Initializes a new instance of ShortDescription. + /// Initializes a new instance of . /// The issue or opportunity identified by the recommendation. /// The remediation action suggested by the recommendation. - internal ShortDescription(string problem, string solution) + /// Keeps track of any properties unknown to the library. + internal ShortDescription(string problem, string solution, Dictionary serializedAdditionalRawData) { Problem = problem; Solution = solution; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The issue or opportunity identified by the recommendation. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractData.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractData.Serialization.cs index 8cb681c23896..4138cbc1760e 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractData.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Advisor { - public partial class SuppressionContractData : IUtf8JsonSerializable + public partial class SuppressionContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Ttl); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SuppressionContractData DeserializeSuppressionContractData(JsonElement element) + internal static SuppressionContractData DeserializeSuppressionContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static SuppressionContractData DeserializeSuppressionContractData(JsonE Optional suppressionId = default; Optional ttl = default; Optional expirationTimeStamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -103,8 +125,61 @@ internal static SuppressionContractData DeserializeSuppressionContractData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SuppressionContractData(id, name, type, systemData.Value, suppressionId.Value, ttl.Value, Optional.ToNullable(expirationTimeStamp), serializedAdditionalRawData); + } + + SuppressionContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSuppressionContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SuppressionContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSuppressionContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SuppressionContractData model) + { + if (model is null) + { + return null; } - return new SuppressionContractData(id, name, type, systemData.Value, suppressionId.Value, ttl.Value, Optional.ToNullable(expirationTimeStamp)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SuppressionContractData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSuppressionContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.Serialization.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.Serialization.cs index a1c332cf1e9a..4ac422a408e0 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.Serialization.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Advisor; namespace Azure.ResourceManager.Advisor.Models { - internal partial class SuppressionContractListResult + internal partial class SuppressionContractListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SuppressionContractListResult DeserializeSuppressionContractListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SuppressionContractListResult DeserializeSuppressionContractListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +93,61 @@ internal static SuppressionContractListResult DeserializeSuppressionContractList value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SuppressionContractListResult(nextLink.Value, Optional.ToList(value)); + return new SuppressionContractListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + SuppressionContractListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSuppressionContractListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SuppressionContractListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSuppressionContractListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SuppressionContractListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SuppressionContractListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSuppressionContractListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.cs index d5de8d14ba0d..c586d6c0abe9 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Models/SuppressionContractListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Advisor; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Advisor.Models /// The list of Advisor suppressions. internal partial class SuppressionContractListResult { - /// Initializes a new instance of SuppressionContractListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SuppressionContractListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SuppressionContractListResult. + /// Initializes a new instance of . /// The link used to get the next page of suppressions. /// The list of suppressions. - internal SuppressionContractListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal SuppressionContractListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of suppressions. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs index 5844a7f0f61e..996412d41859 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseCollection.cs @@ -139,7 +139,7 @@ public virtual AsyncPageable GetAllAsync(str { HttpMessage FirstPageRequest(int? pageSizeHint) => _resourceRecommendationBaseRecommendationsRestClient.CreateListRequest(Id.SubscriptionId, filter, top, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resourceRecommendationBaseRecommendationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, top, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourceRecommendationBaseResource(Client, ResourceRecommendationBaseData.DeserializeResourceRecommendationBaseData(e)), _resourceRecommendationBaseRecommendationsClientDiagnostics, Pipeline, "ResourceRecommendationBaseCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ResourceRecommendationBaseResource(Client, ResourceRecommendationBaseData.DeserializeResourceRecommendationBaseData(e)), _resourceRecommendationBaseRecommendationsClientDiagnostics, Pipeline, "ResourceRecommendationBaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -164,7 +164,7 @@ public virtual Pageable GetAll(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _resourceRecommendationBaseRecommendationsRestClient.CreateListRequest(Id.SubscriptionId, filter, top, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resourceRecommendationBaseRecommendationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, top, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourceRecommendationBaseResource(Client, ResourceRecommendationBaseData.DeserializeResourceRecommendationBaseData(e)), _resourceRecommendationBaseRecommendationsClientDiagnostics, Pipeline, "ResourceRecommendationBaseCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ResourceRecommendationBaseResource(Client, ResourceRecommendationBaseData.DeserializeResourceRecommendationBaseData(e)), _resourceRecommendationBaseRecommendationsClientDiagnostics, Pipeline, "ResourceRecommendationBaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseData.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseData.cs index 3aed04df7984..155829cb21fd 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseData.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Advisor /// public partial class ResourceRecommendationBaseData : ResourceData { - /// Initializes a new instance of ResourceRecommendationBaseData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourceRecommendationBaseData() { Metadata = new ChangeTrackingDictionary(); @@ -30,7 +33,7 @@ public ResourceRecommendationBaseData() ExposedMetadataProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ResourceRecommendationBaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -54,7 +57,8 @@ public ResourceRecommendationBaseData() /// The list of recommended actions to implement recommendation. /// The automated way to apply recommendation. /// The recommendation metadata properties exposed to customer to provide additional information. - internal ResourceRecommendationBaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Category? category, Impact? impact, string impactedField, string impactedValue, DateTimeOffset? lastUpdated, IDictionary metadata, string recommendationTypeId, Risk? risk, ShortDescription shortDescription, IList suppressionIds, IDictionary extendedProperties, ResourceMetadata resourceMetadata, string description, string label, string learnMoreLink, string potentialBenefits, IList> actions, IDictionary remediation, IDictionary exposedMetadataProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ResourceRecommendationBaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Category? category, Impact? impact, string impactedField, string impactedValue, DateTimeOffset? lastUpdated, IDictionary metadata, string recommendationTypeId, Risk? risk, ShortDescription shortDescription, IList suppressionIds, IDictionary extendedProperties, ResourceMetadata resourceMetadata, string description, string label, string learnMoreLink, string potentialBenefits, IList> actions, IDictionary remediation, IDictionary exposedMetadataProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Category = category; Impact = impact; @@ -75,6 +79,7 @@ internal ResourceRecommendationBaseData(ResourceIdentifier id, string name, Reso Actions = actions; Remediation = remediation; ExposedMetadataProperties = exposedMetadataProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The category of the recommendation. diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/ConfigurationsRestOperations.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/ConfigurationsRestOperations.cs index 0efb25feae20..201225219745 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/ConfigurationsRestOperations.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/ConfigurationsRestOperations.cs @@ -119,9 +119,7 @@ internal HttpMessage CreateCreateInSubscriptionRequest(string subscriptionId, Co request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -272,9 +270,7 @@ internal HttpMessage CreateCreateInResourceGroupRequest(string subscriptionId, s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/SuppressionsRestOperations.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/SuppressionsRestOperations.cs index c41441432e97..911f0ca7a0d0 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/SuppressionsRestOperations.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/RestOperations/SuppressionsRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateRequest(string resourceUri, string recommendati request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractData.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractData.cs index da09553b668f..3c3d48737c71 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractData.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.Advisor /// public partial class SuppressionContractData : ResourceData { - /// Initializes a new instance of SuppressionContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SuppressionContractData() { } - /// Initializes a new instance of SuppressionContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +34,13 @@ public SuppressionContractData() /// The GUID of the suppression. /// The duration for which the suppression is valid. /// Gets or sets the expiration time stamp. - internal SuppressionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string suppressionId, string ttl, DateTimeOffset? expirationTimeStamp) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SuppressionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string suppressionId, string ttl, DateTimeOffset? expirationTimeStamp, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { SuppressionId = suppressionId; Ttl = ttl; ExpirationTimeStamp = expirationTimeStamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The GUID of the suppression. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs index 7f2b19c8b238..dbca1f9aecaf 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(str public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AgFoodPlatformPrivateEndpointConnectionResource(Client, AgFoodPlatformPrivateEndpointConnectionData.DeserializeAgFoodPlatformPrivateEndpointConnectionData(e)), _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AgFoodPlatformPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AgFoodPlatformPrivateEndpointConnectionResource(Client, AgFoodPlatformPrivateEndpointConnectionData.DeserializeAgFoodPlatformPrivateEndpointConnectionData(e)), _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AgFoodPlatformPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable Ge public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AgFoodPlatformPrivateEndpointConnectionResource(Client, AgFoodPlatformPrivateEndpointConnectionData.DeserializeAgFoodPlatformPrivateEndpointConnectionData(e)), _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AgFoodPlatformPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AgFoodPlatformPrivateEndpointConnectionResource(Client, AgFoodPlatformPrivateEndpointConnectionData.DeserializeAgFoodPlatformPrivateEndpointConnectionData(e)), _agFoodPlatformPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AgFoodPlatformPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionData.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionData.cs index 8d89797d1fcd..af223507b4c6 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionData.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.AgFoodPlatform /// public partial class AgFoodPlatformPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of AgFoodPlatformPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgFoodPlatformPrivateEndpointConnectionData() { } - /// Initializes a new instance of AgFoodPlatformPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public AgFoodPlatformPrivateEndpointConnectionData() /// The resource of private end point. /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. - internal AgFoodPlatformPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, AgFoodPlatformPrivateLinkServiceConnectionState connectionState, AgFoodPlatformPrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AgFoodPlatformPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, AgFoodPlatformPrivateLinkServiceConnectionState connectionState, AgFoodPlatformPrivateEndpointConnectionProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of private end point. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs index e3430086196c..125303ee90ff 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string subResourc public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AgFoodPlatformPrivateLinkResource(Client, AgFoodPlatformPrivateLinkResourceData.DeserializeAgFoodPlatformPrivateLinkResourceData(e)), _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AgFoodPlatformPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AgFoodPlatformPrivateLinkResource(Client, AgFoodPlatformPrivateLinkResourceData.DeserializeAgFoodPlatformPrivateLinkResourceData(e)), _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AgFoodPlatformPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync(Canc public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AgFoodPlatformPrivateLinkResource(Client, AgFoodPlatformPrivateLinkResourceData.DeserializeAgFoodPlatformPrivateLinkResourceData(e)), _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AgFoodPlatformPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AgFoodPlatformPrivateLinkResource(Client, AgFoodPlatformPrivateLinkResourceData.DeserializeAgFoodPlatformPrivateLinkResourceData(e)), _agFoodPlatformPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AgFoodPlatformPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceData.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceData.cs index 21141e7ed93a..1f991d970ae4 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceData.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,14 +18,17 @@ namespace Azure.ResourceManager.AgFoodPlatform /// public partial class AgFoodPlatformPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of AgFoodPlatformPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgFoodPlatformPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of AgFoodPlatformPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,11 +36,13 @@ public AgFoodPlatformPrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. - internal AgFoodPlatformPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AgFoodPlatformPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ArmAgFoodPlatformModelFactory.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ArmAgFoodPlatformModelFactory.cs index 41c9a86782cc..7c7d69ef30bc 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ArmAgFoodPlatformModelFactory.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ArmAgFoodPlatformModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Model factory for models. public static partial class ArmAgFoodPlatformModelFactory { - /// Initializes a new instance of ExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,10 +32,10 @@ public static partial class ArmAgFoodPlatformModelFactory /// A new instance for mocking. public static ExtensionData ExtensionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, string extensionId = null, string extensionCategory = null, string installedExtensionVersion = null, string extensionAuthLink = null, string extensionApiDocsLink = null) { - return new ExtensionData(id, name, resourceType, systemData, eTag, extensionId, extensionCategory, installedExtensionVersion, extensionAuthLink, extensionApiDocsLink); + return new ExtensionData(id, name, resourceType, systemData, eTag, extensionId, extensionCategory, installedExtensionVersion, extensionAuthLink, extensionApiDocsLink, default); } - /// Initializes a new instance of FarmBeatsExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -60,10 +60,10 @@ public static FarmBeatsExtensionData FarmBeatsExtensionData(ResourceIdentifier i { detailedInformation ??= new List(); - return new FarmBeatsExtensionData(id, name, resourceType, systemData, targetResourceType, farmBeatsExtensionId, farmBeatsExtensionName, farmBeatsExtensionVersion, publisherId, description, extensionCategory, extensionAuthLink, extensionApiDocsLink, detailedInformation?.ToList()); + return new FarmBeatsExtensionData(id, name, resourceType, systemData, targetResourceType, farmBeatsExtensionId, farmBeatsExtensionName, farmBeatsExtensionVersion, publisherId, description, extensionCategory, extensionAuthLink, extensionApiDocsLink, detailedInformation?.ToList(), default); } - /// Initializes a new instance of DetailedInformation. + /// Initializes a new instance of . /// ApiName available for the farmBeatsExtension. /// List of customParameters. /// List of platformParameters. @@ -76,10 +76,10 @@ public static DetailedInformation DetailedInformation(string apiName = null, IEn platformParameters ??= new List(); apiInputParameters ??= new List(); - return new DetailedInformation(apiName, customParameters?.ToList(), platformParameters?.ToList(), unitsSupported, apiInputParameters?.ToList()); + return new DetailedInformation(apiName, customParameters?.ToList(), platformParameters?.ToList(), unitsSupported, apiInputParameters?.ToList(), default); } - /// Initializes a new instance of UnitSystemsInfo. + /// Initializes a new instance of . /// UnitSystem key sent as part of ProviderInput. /// List of unit systems supported by this data provider. /// A new instance for mocking. @@ -87,10 +87,10 @@ public static UnitSystemsInfo UnitSystemsInfo(string key = null, IEnumerable(); - return new UnitSystemsInfo(key, values?.ToList()); + return new UnitSystemsInfo(key, values?.ToList(), default); } - /// Initializes a new instance of FarmBeatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -108,20 +108,20 @@ public static FarmBeatData FarmBeatData(ResourceIdentifier id = null, string nam { tags ??= new Dictionary(); - return new FarmBeatData(id, name, resourceType, systemData, tags, location, identity, instanceUri, provisioningState, sensorIntegration, publicNetworkAccess, privateEndpointConnections); + return new FarmBeatData(id, name, resourceType, systemData, tags, location, identity, instanceUri, provisioningState, sensorIntegration, publicNetworkAccess, privateEndpointConnections, default); } - /// Initializes a new instance of SensorIntegration. + /// Initializes a new instance of . /// Sensor integration enable state. Allowed values are True, None. /// Sensor integration instance provisioning state. /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). /// A new instance for mocking. public static SensorIntegration SensorIntegration(string enabled = null, ProvisioningState? provisioningState = null, ResponseError provisioningInfoError = null) { - return new SensorIntegration(enabled, provisioningState, provisioningInfoError != null ? new ErrorResponse(provisioningInfoError) : null); + return new SensorIntegration(enabled, provisioningState, provisioningInfoError != null ? new ErrorResponse(provisioningInfoError, new Dictionary()) : null, default); } - /// Initializes a new instance of AgFoodPlatformPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -132,28 +132,28 @@ public static SensorIntegration SensorIntegration(string enabled = null, Provisi /// A new instance for mocking. public static AgFoodPlatformPrivateEndpointConnectionData AgFoodPlatformPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, AgFoodPlatformPrivateLinkServiceConnectionState connectionState = null, AgFoodPlatformPrivateEndpointConnectionProvisioningState? provisioningState = null) { - return new AgFoodPlatformPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState); + return new AgFoodPlatformPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, default); } - /// Initializes a new instance of ArmAsyncOperation. + /// Initializes a new instance of . /// Status of the async operation. /// A new instance for mocking. public static ArmAsyncOperation ArmAsyncOperation(string status = null) { - return new ArmAsyncOperation(status); + return new ArmAsyncOperation(status, default); } - /// Initializes a new instance of CheckNameAvailabilityResponse. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. /// A new instance for mocking. public static CheckNameAvailabilityResponse CheckNameAvailabilityResponse(bool? nameAvailable = null, CheckNameAvailabilityReason? reason = null, string message = null) { - return new CheckNameAvailabilityResponse(nameAvailable, reason, message); + return new CheckNameAvailabilityResponse(nameAvailable, reason, message, default); } - /// Initializes a new instance of AgFoodPlatformPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -167,7 +167,7 @@ public static AgFoodPlatformPrivateLinkResourceData AgFoodPlatformPrivateLinkRes requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new AgFoodPlatformPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new AgFoodPlatformPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs index 56f605399233..ce49a8df1bf7 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(IEnumerable { HttpMessage FirstPageRequest(int? pageSizeHint) => _extensionRestClient.CreateListByFarmBeatsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionIds, extensionCategories, pageSizeHint, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _extensionRestClient.CreateListByFarmBeatsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionIds, extensionCategories, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExtensionResource(Client, ExtensionData.DeserializeExtensionData(e)), _extensionClientDiagnostics, Pipeline, "ExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ExtensionResource(Client, ExtensionData.DeserializeExtensionData(e)), _extensionClientDiagnostics, Pipeline, "ExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -260,7 +260,7 @@ public virtual Pageable GetAll(IEnumerable extensionI { HttpMessage FirstPageRequest(int? pageSizeHint) => _extensionRestClient.CreateListByFarmBeatsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionIds, extensionCategories, pageSizeHint, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _extensionRestClient.CreateListByFarmBeatsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionIds, extensionCategories, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExtensionResource(Client, ExtensionData.DeserializeExtensionData(e)), _extensionClientDiagnostics, Pipeline, "ExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ExtensionResource(Client, ExtensionData.DeserializeExtensionData(e)), _extensionClientDiagnostics, Pipeline, "ExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionData.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionData.cs index a3594ada990d..c326c515ed86 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionData.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.AgFoodPlatform /// public partial class ExtensionData : ResourceData { - /// Initializes a new instance of ExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExtensionData() { } - /// Initializes a new instance of ExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +38,8 @@ public ExtensionData() /// Installed extension version. /// Extension auth link. /// Extension api docs link. - internal ExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, string extensionId, string extensionCategory, string installedExtensionVersion, string extensionAuthLink, string extensionApiDocsLink) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, string extensionId, string extensionCategory, string installedExtensionVersion, string extensionAuthLink, string extensionApiDocsLink, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ETag = eTag; ExtensionId = extensionId; @@ -41,6 +47,7 @@ internal ExtensionData(ResourceIdentifier id, string name, ResourceType resource InstalledExtensionVersion = installedExtensionVersion; ExtensionAuthLink = extensionAuthLink; ExtensionApiDocsLink = extensionApiDocsLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ETag value to implement optimistic concurrency. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 515f535a6c99..7c27e1aad5cc 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -72,7 +72,7 @@ public virtual AsyncPageable GetFarmBeatsAsync(int? maxPageSiz { HttpMessage FirstPageRequest(int? pageSizeHint) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFarmBeats", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFarmBeats", "value", "nextLink", cancellationToken); } /// @@ -99,7 +99,7 @@ public virtual Pageable GetFarmBeats(int? maxPageSize = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFarmBeats", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFarmBeats", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs index a9c4d2ae1df2..42e4e2720da5 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(int? maxPageSize = nu { HttpMessage FirstPageRequest(int? pageSizeHint) => _farmBeatFarmBeatsModelsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, pageSizeHint, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _farmBeatFarmBeatsModelsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), _farmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "FarmBeatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), _farmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "FarmBeatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -261,7 +261,7 @@ public virtual Pageable GetAll(int? maxPageSize = null, string { HttpMessage FirstPageRequest(int? pageSizeHint) => _farmBeatFarmBeatsModelsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, pageSizeHint, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _farmBeatFarmBeatsModelsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), _farmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "FarmBeatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), _farmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "FarmBeatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatData.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatData.cs index aced5f23d0cb..140b5d9a83d8 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatData.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.AgFoodPlatform /// public partial class FarmBeatData : TrackedResourceData { - /// Initializes a new instance of FarmBeatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public FarmBeatData(AzureLocation location) : base(location) { } - /// Initializes a new instance of FarmBeatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +41,8 @@ public FarmBeatData(AzureLocation location) : base(location) /// Sensor integration request model. /// Property to allow or block public traffic for an Azure FarmBeats resource. /// The Private Endpoint Connection resource. - internal FarmBeatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, Uri instanceUri, ProvisioningState? provisioningState, SensorIntegration sensorIntegration, PublicNetworkAccess? publicNetworkAccess, AgFoodPlatformPrivateEndpointConnectionData privateEndpointConnections) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal FarmBeatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, Uri instanceUri, ProvisioningState? provisioningState, SensorIntegration sensorIntegration, PublicNetworkAccess? publicNetworkAccess, AgFoodPlatformPrivateEndpointConnectionData privateEndpointConnections, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; InstanceUri = instanceUri; @@ -46,6 +50,12 @@ internal FarmBeatData(ResourceIdentifier id, string name, ResourceType resourceT SensorIntegration = sensorIntegration; PublicNetworkAccess = publicNetworkAccess; PrivateEndpointConnections = privateEndpointConnections; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FarmBeatData() + { } /// Identity for the resource. Current supported identity types: SystemAssigned. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs index 4b2ac358be3d..e3a499c874be 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionCollection.cs @@ -155,7 +155,7 @@ public virtual AsyncPageable GetAllAsync(IEnumerable { HttpMessage FirstPageRequest(int? pageSizeHint) => _farmBeatsExtensionRestClient.CreateListRequest(farmBeatsExtensionIds, farmBeatsExtensionNames, extensionCategories, publisherIds, pageSizeHint); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _farmBeatsExtensionRestClient.CreateListNextPageRequest(nextLink, farmBeatsExtensionIds, farmBeatsExtensionNames, extensionCategories, publisherIds, pageSizeHint); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FarmBeatsExtensionResource(Client, FarmBeatsExtensionData.DeserializeFarmBeatsExtensionData(e)), _farmBeatsExtensionClientDiagnostics, Pipeline, "FarmBeatsExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FarmBeatsExtensionResource(Client, FarmBeatsExtensionData.DeserializeFarmBeatsExtensionData(e)), _farmBeatsExtensionClientDiagnostics, Pipeline, "FarmBeatsExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -185,7 +185,7 @@ public virtual Pageable GetAll(IEnumerable f { HttpMessage FirstPageRequest(int? pageSizeHint) => _farmBeatsExtensionRestClient.CreateListRequest(farmBeatsExtensionIds, farmBeatsExtensionNames, extensionCategories, publisherIds, pageSizeHint); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _farmBeatsExtensionRestClient.CreateListNextPageRequest(nextLink, farmBeatsExtensionIds, farmBeatsExtensionNames, extensionCategories, publisherIds, pageSizeHint); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FarmBeatsExtensionResource(Client, FarmBeatsExtensionData.DeserializeFarmBeatsExtensionData(e)), _farmBeatsExtensionClientDiagnostics, Pipeline, "FarmBeatsExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FarmBeatsExtensionResource(Client, FarmBeatsExtensionData.DeserializeFarmBeatsExtensionData(e)), _farmBeatsExtensionClientDiagnostics, Pipeline, "FarmBeatsExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionData.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionData.cs index 831c30227178..65143c1f0ad8 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionData.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.AgFoodPlatform /// public partial class FarmBeatsExtensionData : ResourceData { - /// Initializes a new instance of FarmBeatsExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FarmBeatsExtensionData() { DetailedInformation = new ChangeTrackingList(); } - /// Initializes a new instance of FarmBeatsExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +48,8 @@ public FarmBeatsExtensionData() /// Information for weather category per api included are apisSupported, /// customParameters, PlatformParameters and Units supported. /// - internal FarmBeatsExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string targetResourceType, string farmBeatsExtensionId, string farmBeatsExtensionName, string farmBeatsExtensionVersion, string publisherId, string description, string extensionCategory, string extensionAuthLink, string extensionApiDocsLink, IReadOnlyList detailedInformation) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FarmBeatsExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string targetResourceType, string farmBeatsExtensionId, string farmBeatsExtensionName, string farmBeatsExtensionVersion, string publisherId, string description, string extensionCategory, string extensionAuthLink, string extensionApiDocsLink, IReadOnlyList detailedInformation, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TargetResourceType = targetResourceType; FarmBeatsExtensionId = farmBeatsExtensionId; @@ -56,6 +61,7 @@ internal FarmBeatsExtensionData(ResourceIdentifier id, string name, ResourceType ExtensionAuthLink = extensionAuthLink; ExtensionApiDocsLink = extensionApiDocsLink; DetailedInformation = detailedInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Target ResourceType of the farmBeatsExtension. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionData.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionData.Serialization.cs index 2602b94843ba..aaa14b5cac70 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.AgFoodPlatform { - public partial class AgFoodPlatformPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class AgFoodPlatformPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgFoodPlatformPrivateEndpointConnectionData DeserializeAgFoodPlatformPrivateEndpointConnectionData(JsonElement element) + internal static AgFoodPlatformPrivateEndpointConnectionData DeserializeAgFoodPlatformPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +76,7 @@ internal static AgFoodPlatformPrivateEndpointConnectionData DeserializeAgFoodPla Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static AgFoodPlatformPrivateEndpointConnectionData DeserializeAgFoodPla } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgFoodPlatformPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AgFoodPlatformPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgFoodPlatformPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgFoodPlatformPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgFoodPlatformPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgFoodPlatformPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgFoodPlatformPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new AgFoodPlatformPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgFoodPlatformPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.Serialization.cs index 3d061d5859b0..93dcb8a637a9 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform; namespace Azure.ResourceManager.AgFoodPlatform.Models { - internal partial class AgFoodPlatformPrivateEndpointConnectionListResult + internal partial class AgFoodPlatformPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgFoodPlatformPrivateEndpointConnectionListResult DeserializeAgFoodPlatformPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgFoodPlatformPrivateEndpointConnectionListResult DeserializeAgFoodPlatformPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static AgFoodPlatformPrivateEndpointConnectionListResult DeserializeAgF value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgFoodPlatformPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new AgFoodPlatformPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AgFoodPlatformPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgFoodPlatformPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgFoodPlatformPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgFoodPlatformPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgFoodPlatformPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgFoodPlatformPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgFoodPlatformPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.cs index d72f1c1e98ca..985f0c7cd9a1 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// List of private endpoint connection associated with the specified storage account. internal partial class AgFoodPlatformPrivateEndpointConnectionListResult { - /// Initializes a new instance of AgFoodPlatformPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgFoodPlatformPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AgFoodPlatformPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal AgFoodPlatformPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AgFoodPlatformPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceData.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceData.Serialization.cs index dc646564eee3..c47bf39d9094 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceData.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AgFoodPlatform { - public partial class AgFoodPlatformPrivateLinkResourceData : IUtf8JsonSerializable + public partial class AgFoodPlatformPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgFoodPlatformPrivateLinkResourceData DeserializeAgFoodPlatformPrivateLinkResourceData(JsonElement element) + internal static AgFoodPlatformPrivateLinkResourceData DeserializeAgFoodPlatformPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static AgFoodPlatformPrivateLinkResourceData DeserializeAgFoodPlatformP Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -117,8 +139,61 @@ internal static AgFoodPlatformPrivateLinkResourceData DeserializeAgFoodPlatformP } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgFoodPlatformPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + AgFoodPlatformPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgFoodPlatformPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgFoodPlatformPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgFoodPlatformPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgFoodPlatformPrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new AgFoodPlatformPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgFoodPlatformPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgFoodPlatformPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.Serialization.cs index 3fef7ee79c7b..711670ca38dd 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform; namespace Azure.ResourceManager.AgFoodPlatform.Models { - internal partial class AgFoodPlatformPrivateLinkResourceListResult + internal partial class AgFoodPlatformPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgFoodPlatformPrivateLinkResourceListResult DeserializeAgFoodPlatformPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgFoodPlatformPrivateLinkResourceListResult DeserializeAgFoodPlatformPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static AgFoodPlatformPrivateLinkResourceListResult DeserializeAgFoodPla value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgFoodPlatformPrivateLinkResourceListResult(Optional.ToList(value)); + return new AgFoodPlatformPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AgFoodPlatformPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgFoodPlatformPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgFoodPlatformPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgFoodPlatformPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgFoodPlatformPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgFoodPlatformPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgFoodPlatformPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.cs index d2727222caa1..b763fc4babc5 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// A list of private link resources. internal partial class AgFoodPlatformPrivateLinkResourceListResult { - /// Initializes a new instance of AgFoodPlatformPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgFoodPlatformPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AgFoodPlatformPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal AgFoodPlatformPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AgFoodPlatformPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.Serialization.cs index 47f6ef973ff3..7f03a9d7d1c2 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class AgFoodPlatformPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class AgFoodPlatformPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgFoodPlatformPrivateLinkServiceConnectionState DeserializeAgFoodPlatformPrivateLinkServiceConnectionState(JsonElement element) + internal static AgFoodPlatformPrivateLinkServiceConnectionState DeserializeAgFoodPlatformPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AgFoodPlatformPrivateLinkServiceConnectionState DeserializeAgFoo Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static AgFoodPlatformPrivateLinkServiceConnectionState DeserializeAgFoo actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgFoodPlatformPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + AgFoodPlatformPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgFoodPlatformPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgFoodPlatformPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgFoodPlatformPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgFoodPlatformPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new AgFoodPlatformPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgFoodPlatformPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgFoodPlatformPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.cs index 13be07d8617b..bb6175a079da 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/AgFoodPlatformPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AgFoodPlatform.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class AgFoodPlatformPrivateLinkServiceConnectionState { - /// Initializes a new instance of AgFoodPlatformPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgFoodPlatformPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of AgFoodPlatformPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal AgFoodPlatformPrivateLinkServiceConnectionState(AgFoodPlatformPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal AgFoodPlatformPrivateLinkServiceConnectionState(AgFoodPlatformPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.Serialization.cs index f8fd0c73e8d7..bba178835649 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class ArmAsyncOperation + public partial class ArmAsyncOperation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArmAsyncOperation DeserializeArmAsyncOperation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArmAsyncOperation DeserializeArmAsyncOperation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -26,8 +60,61 @@ internal static ArmAsyncOperation DeserializeArmAsyncOperation(JsonElement eleme status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArmAsyncOperation(status.Value); + return new ArmAsyncOperation(status.Value, serializedAdditionalRawData); + } + + ArmAsyncOperation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArmAsyncOperation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArmAsyncOperation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArmAsyncOperation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArmAsyncOperation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArmAsyncOperation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArmAsyncOperation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.cs index 28a7878be90d..54fafaedfde8 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ArmAsyncOperation.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AgFoodPlatform.Models { /// @@ -13,16 +16,21 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// public partial class ArmAsyncOperation { - /// Initializes a new instance of ArmAsyncOperation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ArmAsyncOperation() { } - /// Initializes a new instance of ArmAsyncOperation. + /// Initializes a new instance of . /// Status of the async operation. - internal ArmAsyncOperation(string status) + /// Keeps track of any properties unknown to the library. + internal ArmAsyncOperation(string status, Dictionary serializedAdditionalRawData) { Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of the async operation. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs index fc74177bfa25..f36e391a036b 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class CheckNameAvailabilityContent : IUtf8JsonSerializable + public partial class CheckNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CheckNameAvailabilityContent DeserializeCheckNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CheckNameAvailabilityContent(name.Value, type.Value, serializedAdditionalRawData); + } + + CheckNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCheckNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CheckNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCheckNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CheckNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CheckNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCheckNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.cs index 71c39969771c..60beba9d8e1d 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AgFoodPlatform.Models { /// The check availability request body. public partial class CheckNameAvailabilityContent { - /// Initializes a new instance of CheckNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CheckNameAvailabilityContent() { } + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal CheckNameAvailabilityContent(string name, string resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the resource for which availability needs to be checked. public string Name { get; set; } /// The resource type. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.Serialization.cs index b26843cde743..a956008ab202 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class CheckNameAvailabilityResponse + public partial class CheckNameAvailabilityResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CheckNameAvailabilityResponse DeserializeCheckNameAvailabilityResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(NameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CheckNameAvailabilityResponse DeserializeCheckNameAvailabilityResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static CheckNameAvailabilityResponse DeserializeCheckNameAvailabilityRe Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +90,61 @@ internal static CheckNameAvailabilityResponse DeserializeCheckNameAvailabilityRe message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CheckNameAvailabilityResponse(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new CheckNameAvailabilityResponse(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + CheckNameAvailabilityResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCheckNameAvailabilityResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CheckNameAvailabilityResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCheckNameAvailabilityResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CheckNameAvailabilityResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CheckNameAvailabilityResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCheckNameAvailabilityResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.cs index 906a48130bf4..9f1cc3a945e2 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/CheckNameAvailabilityResponse.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AgFoodPlatform.Models { /// The check availability result. public partial class CheckNameAvailabilityResponse { - /// Initializes a new instance of CheckNameAvailabilityResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CheckNameAvailabilityResponse() { } - /// Initializes a new instance of CheckNameAvailabilityResponse. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. - internal CheckNameAvailabilityResponse(bool? nameAvailable, CheckNameAvailabilityReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal CheckNameAvailabilityResponse(bool? nameAvailable, CheckNameAvailabilityReason? reason, string message, Dictionary serializedAdditionalRawData) { NameAvailable = nameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the resource name is available. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.Serialization.cs index 5a248cc49a62..0b6f11a725c9 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.Serialization.cs @@ -5,16 +5,90 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class DetailedInformation + public partial class DetailedInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DetailedInformation DeserializeDetailedInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ApiName)) + { + writer.WritePropertyName("apiName"u8); + writer.WriteStringValue(ApiName); + } + if (Optional.IsCollectionDefined(CustomParameters)) + { + writer.WritePropertyName("customParameters"u8); + writer.WriteStartArray(); + foreach (var item in CustomParameters) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(PlatformParameters)) + { + writer.WritePropertyName("platformParameters"u8); + writer.WriteStartArray(); + foreach (var item in PlatformParameters) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UnitsSupported)) + { + writer.WritePropertyName("unitsSupported"u8); + if (UnitsSupported is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UnitsSupported).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(ApiInputParameters)) + { + writer.WritePropertyName("apiInputParameters"u8); + writer.WriteStartArray(); + foreach (var item in ApiInputParameters) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DetailedInformation DeserializeDetailedInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +98,7 @@ internal static DetailedInformation DeserializeDetailedInformation(JsonElement e Optional> platformParameters = default; Optional unitsSupported = default; Optional> apiInputParameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("apiName"u8)) @@ -82,8 +157,61 @@ internal static DetailedInformation DeserializeDetailedInformation(JsonElement e apiInputParameters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DetailedInformation(apiName.Value, Optional.ToList(customParameters), Optional.ToList(platformParameters), unitsSupported.Value, Optional.ToList(apiInputParameters)); + return new DetailedInformation(apiName.Value, Optional.ToList(customParameters), Optional.ToList(platformParameters), unitsSupported.Value, Optional.ToList(apiInputParameters), serializedAdditionalRawData); + } + + DetailedInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDetailedInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DetailedInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDetailedInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DetailedInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DetailedInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDetailedInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.cs index b0dc8d8077ce..fce8abf8c8b3 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/DetailedInformation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Model to capture detailed information for farmBeatsExtensions. public partial class DetailedInformation { - /// Initializes a new instance of DetailedInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DetailedInformation() { CustomParameters = new ChangeTrackingList(); @@ -21,19 +25,21 @@ internal DetailedInformation() ApiInputParameters = new ChangeTrackingList(); } - /// Initializes a new instance of DetailedInformation. + /// Initializes a new instance of . /// ApiName available for the farmBeatsExtension. /// List of customParameters. /// List of platformParameters. /// Unit systems info for the data provider. /// List of apiInputParameters. - internal DetailedInformation(string apiName, IReadOnlyList customParameters, IReadOnlyList platformParameters, UnitSystemsInfo unitsSupported, IReadOnlyList apiInputParameters) + /// Keeps track of any properties unknown to the library. + internal DetailedInformation(string apiName, IReadOnlyList customParameters, IReadOnlyList platformParameters, UnitSystemsInfo unitsSupported, IReadOnlyList apiInputParameters, Dictionary serializedAdditionalRawData) { ApiName = apiName; CustomParameters = customParameters; PlatformParameters = platformParameters; UnitsSupported = unitsSupported; ApiInputParameters = apiInputParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// ApiName available for the farmBeatsExtension. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.Serialization.cs index 0ce842ff3dae..31c3afc8a56f 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.Serialization.cs @@ -5,32 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - internal partial class ErrorResponse : IUtf8JsonSerializable + internal partial class ErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); writer.WriteObjectValue(Error); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -42,8 +64,61 @@ internal static ErrorResponse DeserializeErrorResponse(JsonElement element) error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ErrorResponse(error.Value, serializedAdditionalRawData); + } + + ErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorResponse model) + { + if (model is null) + { + return null; } - return new ErrorResponse(error.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.cs index 46f34b51be6d..f5378ec4d751 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ErrorResponse.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.AgFoodPlatform.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). internal partial class ErrorResponse { - /// Initializes a new instance of ErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ErrorResponse() { } - /// Initializes a new instance of ErrorResponse. + /// Initializes a new instance of . /// The error object. - internal ErrorResponse(ResponseError error) + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(ResponseError error, Dictionary serializedAdditionalRawData) { Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error object. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionData.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionData.Serialization.cs index 5becd7dd900c..e7f8b74a1d57 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionData.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionData.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AgFoodPlatform { - public partial class ExtensionData : IUtf8JsonSerializable + public partial class ExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtensionData DeserializeExtensionData(JsonElement element) + internal static ExtensionData DeserializeExtensionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static ExtensionData DeserializeExtensionData(JsonElement element) Optional installedExtensionVersion = default; Optional extensionAuthLink = default; Optional extensionApiDocsLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -111,8 +133,61 @@ internal static ExtensionData DeserializeExtensionData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtensionData(id, name, type, systemData.Value, Optional.ToNullable(eTag), extensionId.Value, extensionCategory.Value, installedExtensionVersion.Value, extensionAuthLink.Value, extensionApiDocsLink.Value, serializedAdditionalRawData); + } + + ExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtensionData model) + { + if (model is null) + { + return null; } - return new ExtensionData(id, name, type, systemData.Value, Optional.ToNullable(eTag), extensionId.Value, extensionCategory.Value, installedExtensionVersion.Value, extensionAuthLink.Value, extensionApiDocsLink.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.Serialization.cs index 8639ddf9b695..58acc5e8efaf 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform; namespace Azure.ResourceManager.AgFoodPlatform.Models { - internal partial class ExtensionListResponse + internal partial class ExtensionListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtensionListResponse DeserializeExtensionListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtensionListResponse DeserializeExtensionListResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ExtensionListResponse DeserializeExtensionListResponse(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtensionListResponse(Optional.ToList(value), nextLink.Value); + return new ExtensionListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ExtensionListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtensionListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtensionListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtensionListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtensionListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtensionListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtensionListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.cs index c164305a0544..70f909e3ead9 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/ExtensionListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Paged response contains list of requested objects and a URL link to get the next set of results. internal partial class ExtensionListResponse { - /// Initializes a new instance of ExtensionListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtensionListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExtensionListResponse. + /// Initializes a new instance of . /// List of requested objects. /// Continuation link (absolute URI) to the next page of results in the list. - internal ExtensionListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ExtensionListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of requested objects. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatData.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatData.Serialization.cs index 40d228193d69..ffc14671ea72 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatData.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AgFoodPlatform { - public partial class FarmBeatData : IUtf8JsonSerializable + public partial class FarmBeatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SensorIntegration)) { writer.WritePropertyName("sensorIntegration"u8); - writer.WriteObjectValue(SensorIntegration); + if (SensorIntegration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SensorIntegration).Serialize(writer, options); + } } if (Optional.IsDefined(PublicNetworkAccess)) { @@ -50,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FarmBeatData DeserializeFarmBeatData(JsonElement element) + internal static FarmBeatData DeserializeFarmBeatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +98,7 @@ internal static FarmBeatData DeserializeFarmBeatData(JsonElement element) Optional sensorIntegration = default; Optional publicNetworkAccess = default; Optional privateEndpointConnections = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -182,8 +210,61 @@ internal static FarmBeatData DeserializeFarmBeatData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FarmBeatData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, instanceUri.Value, Optional.ToNullable(provisioningState), sensorIntegration.Value, Optional.ToNullable(publicNetworkAccess), privateEndpointConnections.Value, serializedAdditionalRawData); + } + + FarmBeatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFarmBeatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FarmBeatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFarmBeatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FarmBeatData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FarmBeatData(Response response) + { + if (response is null) + { + return null; } - return new FarmBeatData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, instanceUri.Value, Optional.ToNullable(provisioningState), sensorIntegration.Value, Optional.ToNullable(publicNetworkAccess), privateEndpointConnections.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFarmBeatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.Serialization.cs index e02000bf194e..9a0debfbba26 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class FarmBeatPatch : IUtf8JsonSerializable + public partial class FarmBeatPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -28,7 +37,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -41,7 +57,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FarmBeatPatch DeserializeFarmBeatPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional identity = default; + Optional properties = default; + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = FarmBeatsUpdateProperties.DeserializeFarmBeatsUpdateProperties(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FarmBeatPatch(Optional.ToNullable(location), identity, properties.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + FarmBeatPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFarmBeatPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FarmBeatPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFarmBeatPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FarmBeatPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FarmBeatPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFarmBeatPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.cs index 370aaf5f8604..8ed5633eb8fe 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,30 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// FarmBeats update request. public partial class FarmBeatPatch { - /// Initializes a new instance of FarmBeatPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FarmBeatPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Geo-location where the resource lives. + /// Identity for the resource. Current supported identity types: SystemAssigned. + /// FarmBeats ARM Resource properties. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal FarmBeatPatch(AzureLocation? location, ManagedServiceIdentity identity, FarmBeatsUpdateProperties properties, IDictionary tags, Dictionary serializedAdditionalRawData) + { + Location = location; + Identity = identity; + Properties = properties; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Geo-location where the resource lives. public AzureLocation? Location { get; set; } /// Identity for the resource. Current supported identity types: SystemAssigned. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionData.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionData.Serialization.cs index a621439e60c6..c5afeb650c95 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionData.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionData.Serialization.cs @@ -5,27 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AgFoodPlatform { - public partial class FarmBeatsExtensionData : IUtf8JsonSerializable + public partial class FarmBeatsExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FarmBeatsExtensionData DeserializeFarmBeatsExtensionData(JsonElement element) + internal static FarmBeatsExtensionData DeserializeFarmBeatsExtensionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +65,7 @@ internal static FarmBeatsExtensionData DeserializeFarmBeatsExtensionData(JsonEle Optional extensionAuthLink = default; Optional extensionApiDocsLink = default; Optional> detailedInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -141,8 +163,61 @@ internal static FarmBeatsExtensionData DeserializeFarmBeatsExtensionData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FarmBeatsExtensionData(id, name, type, systemData.Value, targetResourceType.Value, farmBeatsExtensionId.Value, farmBeatsExtensionName.Value, farmBeatsExtensionVersion.Value, publisherId.Value, description.Value, extensionCategory.Value, extensionAuthLink.Value, extensionApiDocsLink.Value, Optional.ToList(detailedInformation), serializedAdditionalRawData); + } + + FarmBeatsExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFarmBeatsExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FarmBeatsExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFarmBeatsExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FarmBeatsExtensionData model) + { + if (model is null) + { + return null; } - return new FarmBeatsExtensionData(id, name, type, systemData.Value, targetResourceType.Value, farmBeatsExtensionId.Value, farmBeatsExtensionName.Value, farmBeatsExtensionVersion.Value, publisherId.Value, description.Value, extensionCategory.Value, extensionAuthLink.Value, extensionApiDocsLink.Value, Optional.ToList(detailedInformation)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FarmBeatsExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFarmBeatsExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.Serialization.cs index 68d71350b14f..7e9fc006904c 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform; namespace Azure.ResourceManager.AgFoodPlatform.Models { - internal partial class FarmBeatsExtensionListResponse + internal partial class FarmBeatsExtensionListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FarmBeatsExtensionListResponse DeserializeFarmBeatsExtensionListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FarmBeatsExtensionListResponse DeserializeFarmBeatsExtensionListResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static FarmBeatsExtensionListResponse DeserializeFarmBeatsExtensionList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FarmBeatsExtensionListResponse(Optional.ToList(value), nextLink.Value); + return new FarmBeatsExtensionListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FarmBeatsExtensionListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFarmBeatsExtensionListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FarmBeatsExtensionListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFarmBeatsExtensionListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FarmBeatsExtensionListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FarmBeatsExtensionListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFarmBeatsExtensionListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.cs index e408167021bf..e0c58114023c 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsExtensionListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Paged response contains list of requested objects and a URL link to get the next set of results. internal partial class FarmBeatsExtensionListResponse { - /// Initializes a new instance of FarmBeatsExtensionListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FarmBeatsExtensionListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FarmBeatsExtensionListResponse. + /// Initializes a new instance of . /// List of requested objects. /// Continuation link (absolute URI) to the next page of results in the list. - internal FarmBeatsExtensionListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FarmBeatsExtensionListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of requested objects. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.Serialization.cs index 850807a6c84f..60c09ade1d84 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AgFoodPlatform; namespace Azure.ResourceManager.AgFoodPlatform.Models { - internal partial class FarmBeatsListResponse + internal partial class FarmBeatsListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FarmBeatsListResponse DeserializeFarmBeatsListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FarmBeatsListResponse DeserializeFarmBeatsListResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static FarmBeatsListResponse DeserializeFarmBeatsListResponse(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FarmBeatsListResponse(Optional.ToList(value), nextLink.Value); + return new FarmBeatsListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FarmBeatsListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFarmBeatsListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FarmBeatsListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFarmBeatsListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FarmBeatsListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FarmBeatsListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFarmBeatsListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.cs index 57756a877c7f..7ea968940483 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AgFoodPlatform; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Paged response contains list of requested objects and a URL link to get the next set of results. internal partial class FarmBeatsListResponse { - /// Initializes a new instance of FarmBeatsListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FarmBeatsListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FarmBeatsListResponse. + /// Initializes a new instance of . /// List of requested objects. /// Continuation link (absolute URI) to the next page of results in the list. - internal FarmBeatsListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FarmBeatsListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of requested objects. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.Serialization.cs index 1faeb357d403..0f84e759eecd 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.Serialization.cs @@ -5,27 +5,142 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class FarmBeatsUpdateProperties : IUtf8JsonSerializable + public partial class FarmBeatsUpdateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SensorIntegration)) { writer.WritePropertyName("sensorIntegration"u8); - writer.WriteObjectValue(SensorIntegration); + if (SensorIntegration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SensorIntegration).Serialize(writer, options); + } } if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FarmBeatsUpdateProperties DeserializeFarmBeatsUpdateProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sensorIntegration = default; + Optional publicNetworkAccess = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sensorIntegration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sensorIntegration = SensorIntegration.DeserializeSensorIntegration(property.Value); + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccess(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FarmBeatsUpdateProperties(sensorIntegration.Value, Optional.ToNullable(publicNetworkAccess), serializedAdditionalRawData); + } + + FarmBeatsUpdateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFarmBeatsUpdateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FarmBeatsUpdateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFarmBeatsUpdateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FarmBeatsUpdateProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FarmBeatsUpdateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFarmBeatsUpdateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.cs index 70162a3386bc..3c0b4f564059 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/FarmBeatsUpdateProperties.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AgFoodPlatform.Models { /// FarmBeats ARM Resource properties. public partial class FarmBeatsUpdateProperties { - /// Initializes a new instance of FarmBeatsUpdateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FarmBeatsUpdateProperties() { } + /// Initializes a new instance of . + /// Sensor integration request model. + /// Property to allow or block public traffic for an Azure FarmBeats resource. + /// Keeps track of any properties unknown to the library. + internal FarmBeatsUpdateProperties(SensorIntegration sensorIntegration, PublicNetworkAccess? publicNetworkAccess, Dictionary serializedAdditionalRawData) + { + SensorIntegration = sensorIntegration; + PublicNetworkAccess = publicNetworkAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Sensor integration request model. public SensorIntegration SensorIntegration { get; set; } /// Property to allow or block public traffic for an Azure FarmBeats resource. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.Serialization.cs index c5e3a00fef9e..f6e2b9c14bc1 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class SensorIntegration : IUtf8JsonSerializable + public partial class SensorIntegration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Enabled)) { @@ -23,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProvisioningInfo)) { writer.WritePropertyName("provisioningInfo"u8); - writer.WriteObjectValue(ProvisioningInfo); + if (ProvisioningInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProvisioningInfo).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static SensorIntegration DeserializeSensorIntegration(JsonElement element) + internal static SensorIntegration DeserializeSensorIntegration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +66,7 @@ internal static SensorIntegration DeserializeSensorIntegration(JsonElement eleme Optional enabled = default; Optional provisioningState = default; Optional provisioningInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -62,8 +92,61 @@ internal static SensorIntegration DeserializeSensorIntegration(JsonElement eleme provisioningInfo = ErrorResponse.DeserializeErrorResponse(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SensorIntegration(enabled.Value, Optional.ToNullable(provisioningState), provisioningInfo.Value, serializedAdditionalRawData); + } + + SensorIntegration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSensorIntegration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SensorIntegration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSensorIntegration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SensorIntegration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SensorIntegration(Response response) + { + if (response is null) + { + return null; } - return new SensorIntegration(enabled.Value, Optional.ToNullable(provisioningState), provisioningInfo.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSensorIntegration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.cs index 33e15f7dba0e..97a6c7879029 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/SensorIntegration.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.AgFoodPlatform.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Sensor integration request model. public partial class SensorIntegration { - /// Initializes a new instance of SensorIntegration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SensorIntegration() { } - /// Initializes a new instance of SensorIntegration. + /// Initializes a new instance of . /// Sensor integration enable state. Allowed values are True, None. /// Sensor integration instance provisioning state. /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - internal SensorIntegration(string enabled, ProvisioningState? provisioningState, ErrorResponse provisioningInfo) + /// Keeps track of any properties unknown to the library. + internal SensorIntegration(string enabled, ProvisioningState? provisioningState, ErrorResponse provisioningInfo, Dictionary serializedAdditionalRawData) { Enabled = enabled; ProvisioningState = provisioningState; ProvisioningInfo = provisioningInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sensor integration enable state. Allowed values are True, None. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.Serialization.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.Serialization.cs index dfb92979d53f..54df4d6791f0 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.Serialization.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.Serialization.cs @@ -5,22 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AgFoodPlatform.Models { - public partial class UnitSystemsInfo + public partial class UnitSystemsInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnitSystemsInfo DeserializeUnitSystemsInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnitSystemsInfo DeserializeUnitSystemsInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string key = default; IReadOnlyList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -38,8 +75,61 @@ internal static UnitSystemsInfo DeserializeUnitSystemsInfo(JsonElement element) values = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UnitSystemsInfo(key, values); + return new UnitSystemsInfo(key, values, serializedAdditionalRawData); + } + + UnitSystemsInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnitSystemsInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnitSystemsInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnitSystemsInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnitSystemsInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnitSystemsInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnitSystemsInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.cs index 93ebb33f178e..8be052fb580d 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Models/UnitSystemsInfo.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AgFoodPlatform.Models /// Unit systems info for the data provider. public partial class UnitSystemsInfo { - /// Initializes a new instance of UnitSystemsInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// UnitSystem key sent as part of ProviderInput. /// List of unit systems supported by this data provider. /// or is null. @@ -28,13 +31,20 @@ internal UnitSystemsInfo(string key, IEnumerable values) Values = values.ToList(); } - /// Initializes a new instance of UnitSystemsInfo. + /// Initializes a new instance of . /// UnitSystem key sent as part of ProviderInput. /// List of unit systems supported by this data provider. - internal UnitSystemsInfo(string key, IReadOnlyList values) + /// Keeps track of any properties unknown to the library. + internal UnitSystemsInfo(string key, IReadOnlyList values, Dictionary serializedAdditionalRawData) { Key = key; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UnitSystemsInfo() + { } /// UnitSystem key sent as part of ProviderInput. diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/FarmBeatsModelsRestOperations.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/FarmBeatsModelsRestOperations.cs index 18e6d3871436..bce2158e41fc 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/FarmBeatsModelsRestOperations.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/FarmBeatsModelsRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -224,9 +222,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/LocationsRestOperations.cs index b22a6a1c7e72..8e32ccc7d2d0 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/LocationsRestOperations.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/LocationsRestOperations.cs @@ -51,9 +51,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index cd33ff068b22..5a70e98f5990 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationData.cs index d6bbb5719311..5687e3add370 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationData.cs @@ -395,7 +395,7 @@ public virtual AsyncPageable GetAllApplicationDataAsync(double? minA { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllApplicationDataRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, applicationIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllApplicationDataNextPageRequest(nextLink, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, applicationIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationData", "value", "nextLink", context); } /// @@ -446,7 +446,7 @@ public virtual Pageable GetAllApplicationData(double? minAvgMaterial { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllApplicationDataRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, applicationIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllApplicationDataNextPageRequest(nextLink, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, applicationIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationData", "value", "nextLink", context); } /// @@ -502,7 +502,7 @@ public virtual AsyncPageable GetAllApplicationDataByPartyIdAsync(str HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllApplicationDataByPartyIdRequest(partyId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllApplicationDataByPartyIdNextPageRequest(nextLink, partyId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationDataByPartyId", "value", "nextLink", context); } /// @@ -558,7 +558,7 @@ public virtual Pageable GetAllApplicationDataByPartyId(string partyI HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllApplicationDataByPartyIdRequest(partyId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllApplicationDataByPartyIdNextPageRequest(nextLink, partyId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ApplicationData.GetAllApplicationDataByPartyId", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Attachments.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Attachments.cs index a4291ab93dce..705076704105 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Attachments.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Attachments.cs @@ -393,7 +393,7 @@ public virtual AsyncPageable GetAttachmentsByPartyIdAsync(string par HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAttachmentsByPartyIdRequest(partyId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAttachmentsByPartyIdNextPageRequest(nextLink, partyId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Attachments.GetAttachmentsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Attachments.GetAttachmentsByPartyId", "value", "nextLink", context); } /// @@ -440,7 +440,7 @@ public virtual Pageable GetAttachmentsByPartyId(string partyId, IEnu HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAttachmentsByPartyIdRequest(partyId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAttachmentsByPartyIdNextPageRequest(nextLink, partyId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Attachments.GetAttachmentsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Attachments.GetAttachmentsByPartyId", "value", "nextLink", context); } internal HttpMessage CreateGetAttachmentsByPartyIdRequest(string partyId, IEnumerable resourceIds, IEnumerable resourceTypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Boundaries.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Boundaries.cs index 57d5b09d1169..49717f22f645 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Boundaries.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Boundaries.cs @@ -468,7 +468,7 @@ public virtual AsyncPageable GetBoundariesAsync(string parentType, s { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetBoundariesRequest(parentType, type, parentIds, minArea, maxArea, boundaryIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetBoundariesNextPageRequest(nextLink, parentType, type, parentIds, minArea, maxArea, boundaryIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundaries", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundaries", "value", "nextLink", context); } /// @@ -510,7 +510,7 @@ public virtual Pageable GetBoundaries(string parentType, string type { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetBoundariesRequest(parentType, type, parentIds, minArea, maxArea, boundaryIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetBoundariesNextPageRequest(nextLink, parentType, type, parentIds, minArea, maxArea, boundaryIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundaries", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundaries", "value", "nextLink", context); } /// @@ -535,7 +535,7 @@ public virtual AsyncPageable SearchAsync(RequestContent content, Req HttpMessage FirstPageRequest(int? pageSizeHint) => CreateSearchRequest(content, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateSearchNextPageRequest(nextLink, content, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.Search", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.Search", "value", "nextLink", context); } /// @@ -560,7 +560,7 @@ public virtual Pageable Search(RequestContent content, RequestContex HttpMessage FirstPageRequest(int? pageSizeHint) => CreateSearchRequest(content, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateSearchNextPageRequest(nextLink, content, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.Search", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.Search", "value", "nextLink", context); } /// @@ -607,7 +607,7 @@ public virtual AsyncPageable GetBoundariesByPartyIdAsync(string part HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetBoundariesByPartyIdRequest(partyId, parentType, type, parentIds, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetBoundariesByPartyIdNextPageRequest(nextLink, partyId, parentType, type, parentIds, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundariesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundariesByPartyId", "value", "nextLink", context); } /// @@ -654,7 +654,7 @@ public virtual Pageable GetBoundariesByPartyId(string partyId, strin HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetBoundariesByPartyIdRequest(partyId, parentType, type, parentIds, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetBoundariesByPartyIdNextPageRequest(nextLink, partyId, parentType, type, parentIds, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundariesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.GetBoundariesByPartyId", "value", "nextLink", context); } /// @@ -682,7 +682,7 @@ public virtual AsyncPageable SearchByPartyIdAsync(string partyId, Re HttpMessage FirstPageRequest(int? pageSizeHint) => CreateSearchByPartyIdRequest(partyId, content, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateSearchByPartyIdNextPageRequest(nextLink, partyId, content, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.SearchByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.SearchByPartyId", "value", "nextLink", context); } /// @@ -710,7 +710,7 @@ public virtual Pageable SearchByPartyId(string partyId, RequestConte HttpMessage FirstPageRequest(int? pageSizeHint) => CreateSearchByPartyIdRequest(partyId, content, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateSearchByPartyIdNextPageRequest(nextLink, partyId, content, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.SearchByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Boundaries.SearchByPartyId", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropProducts.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropProducts.cs index 6e8cce553bc6..237216b88075 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropProducts.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropProducts.cs @@ -303,7 +303,7 @@ public virtual AsyncPageable GetCropProductsAsync(IEnumerable CreateGetCropProductsRequest(cropIds, brands, products, traits, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCropProductsNextPageRequest(nextLink, cropIds, brands, products, traits, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "CropProducts.GetCropProducts", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "CropProducts.GetCropProducts", "value", "nextLink", context); } /// @@ -344,7 +344,7 @@ public virtual Pageable GetCropProducts(IEnumerable cropIds, { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCropProductsRequest(cropIds, brands, products, traits, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCropProductsNextPageRequest(nextLink, cropIds, brands, products, traits, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "CropProducts.GetCropProducts", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "CropProducts.GetCropProducts", "value", "nextLink", context); } internal HttpMessage CreateGetCropProductsRequest(IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable traits, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Crops.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Crops.cs index ffac4b7825de..ffd10a3c68f7 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Crops.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Crops.cs @@ -301,7 +301,7 @@ public virtual AsyncPageable GetCropsAsync(IEnumerable pheno { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCropsRequest(phenotypes, breedingMethods, cropIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCropsNextPageRequest(nextLink, phenotypes, breedingMethods, cropIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Crops.GetCrops", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Crops.GetCrops", "value", "nextLink", context); } /// @@ -340,7 +340,7 @@ public virtual Pageable GetCrops(IEnumerable phenotypes, IEn { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCropsRequest(phenotypes, breedingMethods, cropIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCropsNextPageRequest(nextLink, phenotypes, breedingMethods, cropIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Crops.GetCrops", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Crops.GetCrops", "value", "nextLink", context); } internal HttpMessage CreateGetCropsRequest(IEnumerable phenotypes, IEnumerable breedingMethods, IEnumerable cropIds, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/DeviceDataModels.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/DeviceDataModels.cs index 9d7da6f83ea0..228d63aefb6f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/DeviceDataModels.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/DeviceDataModels.cs @@ -316,7 +316,7 @@ public virtual AsyncPageable GetDeviceDataModelsAsync(string sensorP HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeviceDataModelsRequest(sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeviceDataModelsNextPageRequest(nextLink, sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeviceDataModels.GetDeviceDataModels", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeviceDataModels.GetDeviceDataModels", "value", "nextLink", context); } /// @@ -358,7 +358,7 @@ public virtual Pageable GetDeviceDataModels(string sensorPartnerId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeviceDataModelsRequest(sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeviceDataModelsNextPageRequest(nextLink, sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeviceDataModels.GetDeviceDataModels", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeviceDataModels.GetDeviceDataModels", "value", "nextLink", context); } internal HttpMessage CreateGetDeviceDataModelsRequest(string sensorPartnerId, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Devices.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Devices.cs index c2bc3b6cab0e..3150277559ed 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Devices.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Devices.cs @@ -318,7 +318,7 @@ public virtual AsyncPageable GetDevicesAsync(string sensorPartnerId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevicesRequest(sensorPartnerId, parentDeviceIds, deviceDataModelIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevicesNextPageRequest(nextLink, sensorPartnerId, parentDeviceIds, deviceDataModelIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Devices.GetDevices", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Devices.GetDevices", "value", "nextLink", context); } /// @@ -362,7 +362,7 @@ public virtual Pageable GetDevices(string sensorPartnerId, IEnumerab HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevicesRequest(sensorPartnerId, parentDeviceIds, deviceDataModelIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevicesNextPageRequest(nextLink, sensorPartnerId, parentDeviceIds, deviceDataModelIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Devices.GetDevices", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Devices.GetDevices", "value", "nextLink", context); } internal HttpMessage CreateGetDevicesRequest(string sensorPartnerId, IEnumerable parentDeviceIds, IEnumerable deviceDataModelIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmerOAuthTokens.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmerOAuthTokens.cs index cac7ad001878..16a685c7aaad 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmerOAuthTokens.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmerOAuthTokens.cs @@ -219,7 +219,7 @@ public virtual AsyncPageable GetAuthenticatedFarmersDetailsAsync(IEn { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAuthenticatedFarmersDetailsRequest(authProviderIds, partyIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAuthenticatedFarmersDetailsNextPageRequest(nextLink, authProviderIds, partyIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "FarmerOAuthTokens.GetAuthenticatedFarmersDetails", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "FarmerOAuthTokens.GetAuthenticatedFarmersDetails", "value", "nextLink", context); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAuthenticatedFarmersDetails(IEnumerable CreateGetAuthenticatedFarmersDetailsRequest(authProviderIds, partyIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAuthenticatedFarmersDetailsNextPageRequest(nextLink, authProviderIds, partyIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "FarmerOAuthTokens.GetAuthenticatedFarmersDetails", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "FarmerOAuthTokens.GetAuthenticatedFarmersDetails", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Farms.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Farms.cs index 4570b208501c..fd71cda8bd22 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Farms.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Farms.cs @@ -381,7 +381,7 @@ public virtual AsyncPageable GetFarmsAsync(IEnumerable farmI { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFarmsRequest(farmIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFarmsNextPageRequest(nextLink, farmIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarms", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarms", "value", "nextLink", context); } /// @@ -418,7 +418,7 @@ public virtual Pageable GetFarms(IEnumerable farmIds, IEnume { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFarmsRequest(farmIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFarmsNextPageRequest(nextLink, farmIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarms", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarms", "value", "nextLink", context); } /// @@ -460,7 +460,7 @@ public virtual AsyncPageable GetFarmsByPartyIdAsync(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFarmsByPartyIdRequest(partyId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFarmsByPartyIdNextPageRequest(nextLink, partyId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarmsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarmsByPartyId", "value", "nextLink", context); } /// @@ -502,7 +502,7 @@ public virtual Pageable GetFarmsByPartyId(string partyId, IEnumerabl HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFarmsByPartyIdRequest(partyId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFarmsByPartyIdNextPageRequest(nextLink, partyId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarmsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Farms.GetFarmsByPartyId", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Fields.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Fields.cs index eed6e6c49374..5bceaf91dca2 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Fields.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Fields.cs @@ -382,7 +382,7 @@ public virtual AsyncPageable GetFieldsAsync(IEnumerable farm { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFieldsRequest(farmIds, fieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFieldsNextPageRequest(nextLink, farmIds, fieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFields", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFields", "value", "nextLink", context); } /// @@ -420,7 +420,7 @@ public virtual Pageable GetFields(IEnumerable farmIds, IEnum { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFieldsRequest(farmIds, fieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFieldsNextPageRequest(nextLink, farmIds, fieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFields", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFields", "value", "nextLink", context); } /// @@ -463,7 +463,7 @@ public virtual AsyncPageable GetFieldsByPartyIdAsync(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFieldsByPartyIdRequest(partyId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFieldsByPartyIdNextPageRequest(nextLink, partyId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFieldsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFieldsByPartyId", "value", "nextLink", context); } /// @@ -506,7 +506,7 @@ public virtual Pageable GetFieldsByPartyId(string partyId, IEnumerab HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetFieldsByPartyIdRequest(partyId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetFieldsByPartyIdNextPageRequest(nextLink, partyId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFieldsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Fields.GetFieldsByPartyId", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestData.cs index 543b6e5c8409..46c46c00478a 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestData.cs @@ -403,7 +403,7 @@ public virtual AsyncPageable GetAllHarvestDataAsync(double? minTotal { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllHarvestDataRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, harvestDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllHarvestDataNextPageRequest(nextLink, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, harvestDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestData", "value", "nextLink", context); } /// @@ -462,7 +462,7 @@ public virtual Pageable GetAllHarvestData(double? minTotalYield, dou { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllHarvestDataRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, harvestDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllHarvestDataNextPageRequest(nextLink, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, harvestDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestData", "value", "nextLink", context); } /// @@ -526,7 +526,7 @@ public virtual AsyncPageable GetAllHarvestDataByPartyIdAsync(string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllHarvestDataByPartyIdRequest(partyId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllHarvestDataByPartyIdNextPageRequest(nextLink, partyId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestDataByPartyId", "value", "nextLink", context); } /// @@ -590,7 +590,7 @@ public virtual Pageable GetAllHarvestDataByPartyId(string partyId, d HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllHarvestDataByPartyIdRequest(partyId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllHarvestDataByPartyIdNextPageRequest(nextLink, partyId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "HarvestData.GetAllHarvestDataByPartyId", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/InsightAttachments.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/InsightAttachments.cs index c7c72f1252a5..5667bc111121 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/InsightAttachments.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/InsightAttachments.cs @@ -467,7 +467,7 @@ public virtual AsyncPageable GetInsightAttachmentsByPartyIdModelIdAn HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetInsightAttachmentsByPartyIdModelIdAndResourceRequest(partyId, modelId, resourceType, resourceId, insightIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetInsightAttachmentsByPartyIdModelIdAndResourceNextPageRequest(nextLink, partyId, modelId, resourceType, resourceId, insightIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "InsightAttachments.GetInsightAttachmentsByPartyIdModelIdAndResource", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "InsightAttachments.GetInsightAttachmentsByPartyIdModelIdAndResource", "value", "nextLink", context); } /// @@ -516,7 +516,7 @@ public virtual Pageable GetInsightAttachmentsByPartyIdModelIdAndReso HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetInsightAttachmentsByPartyIdModelIdAndResourceRequest(partyId, modelId, resourceType, resourceId, insightIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetInsightAttachmentsByPartyIdModelIdAndResourceNextPageRequest(nextLink, partyId, modelId, resourceType, resourceId, insightIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "InsightAttachments.GetInsightAttachmentsByPartyIdModelIdAndResource", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "InsightAttachments.GetInsightAttachmentsByPartyIdModelIdAndResource", "value", "nextLink", context); } internal HttpMessage CreateGetInsightAttachmentsByPartyIdModelIdAndResourceRequest(string partyId, string modelId, string resourceType, string resourceId, IEnumerable insightIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Insights.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Insights.cs index 20604c3c719d..8d9fc5fa37ed 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Insights.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Insights.cs @@ -455,7 +455,7 @@ public virtual AsyncPageable GetInsightsByPartyIdModelIdAndResourceA HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetInsightsByPartyIdModelIdAndResourceRequest(partyId, modelId, resourceType, resourceId, minInsightStartDateTime, maxInsightStartDateTime, minInsightEndDateTime, maxInsightEndDateTime, measurementFilters, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetInsightsByPartyIdModelIdAndResourceNextPageRequest(nextLink, partyId, modelId, resourceType, resourceId, minInsightStartDateTime, maxInsightStartDateTime, minInsightEndDateTime, maxInsightEndDateTime, measurementFilters, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Insights.GetInsightsByPartyIdModelIdAndResource", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Insights.GetInsightsByPartyIdModelIdAndResource", "value", "nextLink", context); } /// @@ -512,7 +512,7 @@ public virtual Pageable GetInsightsByPartyIdModelIdAndResource(strin HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetInsightsByPartyIdModelIdAndResourceRequest(partyId, modelId, resourceType, resourceId, minInsightStartDateTime, maxInsightStartDateTime, minInsightEndDateTime, maxInsightEndDateTime, measurementFilters, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetInsightsByPartyIdModelIdAndResourceNextPageRequest(nextLink, partyId, modelId, resourceType, resourceId, minInsightStartDateTime, maxInsightStartDateTime, minInsightEndDateTime, maxInsightEndDateTime, measurementFilters, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Insights.GetInsightsByPartyIdModelIdAndResource", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Insights.GetInsightsByPartyIdModelIdAndResource", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ManagementZones.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ManagementZones.cs index 7faadc615c7e..63bbbccb2984 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ManagementZones.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ManagementZones.cs @@ -386,7 +386,7 @@ public virtual AsyncPageable GetManagementZonesAsync(IEnumerable CreateGetManagementZonesRequest(types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetManagementZonesNextPageRequest(nextLink, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZones", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZones", "value", "nextLink", context); } /// @@ -428,7 +428,7 @@ public virtual Pageable GetManagementZones(IEnumerable types { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetManagementZonesRequest(types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetManagementZonesNextPageRequest(nextLink, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZones", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZones", "value", "nextLink", context); } /// @@ -475,7 +475,7 @@ public virtual AsyncPageable GetManagementZonesByPartyIdAsync(string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetManagementZonesByPartyIdRequest(partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetManagementZonesByPartyIdNextPageRequest(nextLink, partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZonesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZonesByPartyId", "value", "nextLink", context); } /// @@ -522,7 +522,7 @@ public virtual Pageable GetManagementZonesByPartyId(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetManagementZonesByPartyIdRequest(partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetManagementZonesByPartyIdNextPageRequest(nextLink, partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZonesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ManagementZones.GetManagementZonesByPartyId", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/NutrientAnalyses.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/NutrientAnalyses.cs index 4b7a31091e76..c460ada72964 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/NutrientAnalyses.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/NutrientAnalyses.cs @@ -317,7 +317,7 @@ public virtual AsyncPageable GetNutrientAnalysesAsync(string parentT { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetNutrientAnalysesRequest(parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetNutrientAnalysesNextPageRequest(nextLink, parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalyses", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalyses", "value", "nextLink", context); } /// @@ -360,7 +360,7 @@ public virtual Pageable GetNutrientAnalyses(string parentType, IEnum { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetNutrientAnalysesRequest(parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetNutrientAnalysesNextPageRequest(nextLink, parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalyses", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalyses", "value", "nextLink", context); } /// @@ -408,7 +408,7 @@ public virtual AsyncPageable GetNutrientAnalysesByPartyIdAsync(strin HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetNutrientAnalysesByPartyIdRequest(partyId, parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetNutrientAnalysesByPartyIdNextPageRequest(nextLink, partyId, parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalysesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalysesByPartyId", "value", "nextLink", context); } /// @@ -456,7 +456,7 @@ public virtual Pageable GetNutrientAnalysesByPartyId(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetNutrientAnalysesByPartyIdRequest(partyId, parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetNutrientAnalysesByPartyIdNextPageRequest(nextLink, partyId, parentType, parentIds, classifications, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalysesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "NutrientAnalyses.GetNutrientAnalysesByPartyId", "value", "nextLink", context); } internal HttpMessage CreateGetNutrientAnalysesRequest(string parentType, IEnumerable parentIds, IEnumerable classifications, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProviders.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProviders.cs index a0162211a25e..093e8dfcaeb8 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProviders.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProviders.cs @@ -369,7 +369,7 @@ public virtual AsyncPageable GetOAuthProvidersAsync(IEnumerable CreateGetOAuthProvidersRequest(providerIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetOAuthProvidersNextPageRequest(nextLink, providerIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "OAuthProviders.GetOAuthProviders", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "OAuthProviders.GetOAuthProviders", "value", "nextLink", context); } /// @@ -406,7 +406,7 @@ public virtual Pageable GetOAuthProviders(IEnumerable provid { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetOAuthProvidersRequest(providerIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetOAuthProvidersNextPageRequest(nextLink, providerIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "OAuthProviders.GetOAuthProviders", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "OAuthProviders.GetOAuthProviders", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Parties.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Parties.cs index 3dfde15b5cf5..aba78c8687fe 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Parties.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Parties.cs @@ -369,7 +369,7 @@ public virtual AsyncPageable GetPartiesAsync(IEnumerable ids { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPartiesRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPartiesNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Parties.GetParties", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Parties.GetParties", "value", "nextLink", context); } /// @@ -406,7 +406,7 @@ public virtual Pageable GetParties(IEnumerable ids, IEnumera { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPartiesRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPartiesNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Parties.GetParties", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Parties.GetParties", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantTissueAnalyses.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantTissueAnalyses.cs index 2bfbcf6793aa..63de7856c93b 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantTissueAnalyses.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantTissueAnalyses.cs @@ -390,7 +390,7 @@ public virtual AsyncPageable GetPlantTissueAnalysesByPartyIdAsync(st HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPlantTissueAnalysesByPartyIdRequest(partyId, seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPlantTissueAnalysesByPartyIdNextPageRequest(nextLink, partyId, seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalysesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalysesByPartyId", "value", "nextLink", context); } /// @@ -436,7 +436,7 @@ public virtual Pageable GetPlantTissueAnalysesByPartyId(string party HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPlantTissueAnalysesByPartyIdRequest(partyId, seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPlantTissueAnalysesByPartyIdNextPageRequest(nextLink, partyId, seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalysesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalysesByPartyId", "value", "nextLink", context); } /// @@ -477,7 +477,7 @@ public virtual AsyncPageable GetPlantTissueAnalysesAsync(IEnumerable { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPlantTissueAnalysesRequest(seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPlantTissueAnalysesNextPageRequest(nextLink, seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalyses", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalyses", "value", "nextLink", context); } /// @@ -518,7 +518,7 @@ public virtual Pageable GetPlantTissueAnalyses(IEnumerable s { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPlantTissueAnalysesRequest(seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPlantTissueAnalysesNextPageRequest(nextLink, seasonIds, cropIds, cropProductsIds, fieldIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalyses", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantTissueAnalyses.GetPlantTissueAnalyses", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingData.cs index a993c8711e1e..eac5673348fe 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingData.cs @@ -402,7 +402,7 @@ public virtual AsyncPageable GetAllPlantingDataByPartyIdAsync(string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllPlantingDataByPartyIdRequest(partyId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllPlantingDataByPartyIdNextPageRequest(nextLink, partyId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingDataByPartyId", "value", "nextLink", context); } /// @@ -460,7 +460,7 @@ public virtual Pageable GetAllPlantingDataByPartyId(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllPlantingDataByPartyIdRequest(partyId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllPlantingDataByPartyIdNextPageRequest(nextLink, partyId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingDataByPartyId", "value", "nextLink", context); } /// @@ -513,7 +513,7 @@ public virtual AsyncPageable GetAllPlantingDataAsync(double? minAvgP { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllPlantingDataRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, plantingDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllPlantingDataNextPageRequest(nextLink, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, plantingDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingData", "value", "nextLink", context); } /// @@ -566,7 +566,7 @@ public virtual Pageable GetAllPlantingData(double? minAvgPlantingRat { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllPlantingDataRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, plantingDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllPlantingDataNextPageRequest(nextLink, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, plantingDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PlantingData.GetAllPlantingData", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PrescriptionMaps.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PrescriptionMaps.cs index ac974aa099f8..a0bd97bd2ecb 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PrescriptionMaps.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PrescriptionMaps.cs @@ -391,7 +391,7 @@ public virtual AsyncPageable GetPrescriptionMapsByPartyIdAsync(strin HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPrescriptionMapsByPartyIdRequest(partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionMapsByPartyIdNextPageRequest(nextLink, partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMapsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMapsByPartyId", "value", "nextLink", context); } /// @@ -438,7 +438,7 @@ public virtual Pageable GetPrescriptionMapsByPartyId(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPrescriptionMapsByPartyIdRequest(partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionMapsByPartyIdNextPageRequest(nextLink, partyId, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMapsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMapsByPartyId", "value", "nextLink", context); } /// @@ -480,7 +480,7 @@ public virtual AsyncPageable GetPrescriptionMapsAsync(IEnumerable CreateGetPrescriptionMapsRequest(types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionMapsNextPageRequest(nextLink, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMaps", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMaps", "value", "nextLink", context); } /// @@ -522,7 +522,7 @@ public virtual Pageable GetPrescriptionMaps(IEnumerable type { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPrescriptionMapsRequest(types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionMapsNextPageRequest(nextLink, types, cropIds, seasonIds, fieldIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMaps", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PrescriptionMaps.GetPrescriptionMaps", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Prescriptions.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Prescriptions.cs index c88bf7be131d..a2375c80c7a6 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Prescriptions.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Prescriptions.cs @@ -391,7 +391,7 @@ public virtual AsyncPageable GetPrescriptionsByPartyIdAsync(string p HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPrescriptionsByPartyIdRequest(partyId, prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionsByPartyIdNextPageRequest(nextLink, partyId, prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptionsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptionsByPartyId", "value", "nextLink", context); } /// @@ -438,7 +438,7 @@ public virtual Pageable GetPrescriptionsByPartyId(string partyId, IE HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPrescriptionsByPartyIdRequest(partyId, prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionsByPartyIdNextPageRequest(nextLink, partyId, prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptionsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptionsByPartyId", "value", "nextLink", context); } /// @@ -480,7 +480,7 @@ public virtual AsyncPageable GetPrescriptionsAsync(IEnumerable CreateGetPrescriptionsRequest(prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionsNextPageRequest(nextLink, prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptions", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptions", "value", "nextLink", context); } /// @@ -522,7 +522,7 @@ public virtual Pageable GetPrescriptions(IEnumerable prescri { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPrescriptionsRequest(prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPrescriptionsNextPageRequest(nextLink, prescriptionMapIds, types, productCodes, productNames, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptions", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Prescriptions.GetPrescriptions", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Scenes.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Scenes.cs index 510fae3f42d0..d2dde19be070 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Scenes.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Scenes.cs @@ -381,7 +381,7 @@ public virtual AsyncPageable GetScenesAsync(string provider, string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetScenesRequest(provider, partyId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetScenesNextPageRequest(nextLink, provider, partyId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Scenes.GetScenes", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Scenes.GetScenes", "value", "nextLink", context); } /// @@ -424,7 +424,7 @@ public virtual Pageable GetScenes(string provider, string partyId, s HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetScenesRequest(provider, partyId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetScenesNextPageRequest(nextLink, provider, partyId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Scenes.GetScenes", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Scenes.GetScenes", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFields.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFields.cs index 707b90b89420..a39b04560023 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFields.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFields.cs @@ -391,7 +391,7 @@ public virtual AsyncPageable GetSeasonalFieldsByPartyIdAsync(string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSeasonalFieldsByPartyIdRequest(partyId, farmIds, fieldIds, seasonIds, cropProductIds, cropIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSeasonalFieldsByPartyIdNextPageRequest(nextLink, partyId, farmIds, fieldIds, seasonIds, cropProductIds, cropIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFieldsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFieldsByPartyId", "value", "nextLink", context); } /// @@ -438,7 +438,7 @@ public virtual Pageable GetSeasonalFieldsByPartyId(string partyId, I HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSeasonalFieldsByPartyIdRequest(partyId, farmIds, fieldIds, seasonIds, cropProductIds, cropIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSeasonalFieldsByPartyIdNextPageRequest(nextLink, partyId, farmIds, fieldIds, seasonIds, cropProductIds, cropIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFieldsByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFieldsByPartyId", "value", "nextLink", context); } /// @@ -480,7 +480,7 @@ public virtual AsyncPageable GetSeasonalFieldsAsync(IEnumerable CreateGetSeasonalFieldsRequest(farmIds, fieldIds, seasonIds, cropProductIds, cropIds, seasonalFieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSeasonalFieldsNextPageRequest(nextLink, farmIds, fieldIds, seasonIds, cropProductIds, cropIds, seasonalFieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFields", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFields", "value", "nextLink", context); } /// @@ -522,7 +522,7 @@ public virtual Pageable GetSeasonalFields(IEnumerable farmId { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSeasonalFieldsRequest(farmIds, fieldIds, seasonIds, cropProductIds, cropIds, seasonalFieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSeasonalFieldsNextPageRequest(nextLink, farmIds, fieldIds, seasonIds, cropProductIds, cropIds, seasonalFieldIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFields", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SeasonalFields.GetSeasonalFields", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Seasons.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Seasons.cs index 4b29b8c47b48..52d080b6705d 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Seasons.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Seasons.cs @@ -304,7 +304,7 @@ public virtual AsyncPageable GetSeasonsAsync(DateTimeOffset? minStar { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSeasonsRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, seasonIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSeasonsNextPageRequest(nextLink, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, seasonIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Seasons.GetSeasons", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Seasons.GetSeasons", "value", "nextLink", context); } /// @@ -346,7 +346,7 @@ public virtual Pageable GetSeasons(DateTimeOffset? minStartDateTime, { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSeasonsRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, seasonIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSeasonsNextPageRequest(nextLink, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, seasonIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Seasons.GetSeasons", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Seasons.GetSeasons", "value", "nextLink", context); } internal HttpMessage CreateGetSeasonsRequest(DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, IEnumerable years, IEnumerable seasonIds, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorDataModels.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorDataModels.cs index 7ff688c9e6e5..4ed450359115 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorDataModels.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorDataModels.cs @@ -316,7 +316,7 @@ public virtual AsyncPageable GetSensorDataModelsAsync(string sensorP HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorDataModelsRequest(sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorDataModelsNextPageRequest(nextLink, sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorDataModels.GetSensorDataModels", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorDataModels.GetSensorDataModels", "value", "nextLink", context); } /// @@ -358,7 +358,7 @@ public virtual Pageable GetSensorDataModels(string sensorPartnerId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorDataModelsRequest(sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorDataModelsNextPageRequest(nextLink, sensorPartnerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorDataModels.GetSensorDataModels", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorDataModels.GetSensorDataModels", "value", "nextLink", context); } internal HttpMessage CreateGetSensorDataModelsRequest(string sensorPartnerId, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorMappings.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorMappings.cs index 2ca881d699bc..4d4bb5b3cf7f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorMappings.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorMappings.cs @@ -303,7 +303,7 @@ public virtual AsyncPageable GetSensorMappingsAsync(IEnumerable CreateGetSensorMappingsRequest(sensorIds, sensorPartnerIds, partyIds, boundaryIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorMappingsNextPageRequest(nextLink, sensorIds, sensorPartnerIds, partyIds, boundaryIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorMappings.GetSensorMappings", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorMappings.GetSensorMappings", "value", "nextLink", context); } /// @@ -344,7 +344,7 @@ public virtual Pageable GetSensorMappings(IEnumerable sensor { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorMappingsRequest(sensorIds, sensorPartnerIds, partyIds, boundaryIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorMappingsNextPageRequest(nextLink, sensorIds, sensorPartnerIds, partyIds, boundaryIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorMappings.GetSensorMappings", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorMappings.GetSensorMappings", "value", "nextLink", context); } internal HttpMessage CreateGetSensorMappingsRequest(IEnumerable sensorIds, IEnumerable sensorPartnerIds, IEnumerable partyIds, IEnumerable boundaryIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorPartnerIntegrations.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorPartnerIntegrations.cs index ccb6949cef08..755904e7f492 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorPartnerIntegrations.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SensorPartnerIntegrations.cs @@ -470,7 +470,7 @@ public virtual AsyncPageable GetSensorPartnerIntegrationsAsync(strin HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorPartnerIntegrationsRequest(sensorPartnerId, integrationIds, partyIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorPartnerIntegrationsNextPageRequest(nextLink, sensorPartnerId, integrationIds, partyIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorPartnerIntegrations.GetSensorPartnerIntegrations", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorPartnerIntegrations.GetSensorPartnerIntegrations", "value", "nextLink", context); } /// @@ -514,7 +514,7 @@ public virtual Pageable GetSensorPartnerIntegrations(string sensorPa HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorPartnerIntegrationsRequest(sensorPartnerId, integrationIds, partyIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorPartnerIntegrationsNextPageRequest(nextLink, sensorPartnerId, integrationIds, partyIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorPartnerIntegrations.GetSensorPartnerIntegrations", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "SensorPartnerIntegrations.GetSensorPartnerIntegrations", "value", "nextLink", context); } internal HttpMessage CreateGetSensorPartnerIntegrationsRequest(string sensorPartnerId, IEnumerable integrationIds, IEnumerable partyIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Sensors.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Sensors.cs index e0a819e16571..6683fd4c67da 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Sensors.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Sensors.cs @@ -471,7 +471,7 @@ public virtual AsyncPageable GetSensorsAsync(string sensorPartnerId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorsRequest(sensorPartnerId, sensorDataModelIds, sensorMappingIds, deviceIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorsNextPageRequest(nextLink, sensorPartnerId, sensorDataModelIds, sensorMappingIds, deviceIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Sensors.GetSensors", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Sensors.GetSensors", "value", "nextLink", context); } /// @@ -516,7 +516,7 @@ public virtual Pageable GetSensors(string sensorPartnerId, IEnumerab HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSensorsRequest(sensorPartnerId, sensorDataModelIds, sensorMappingIds, deviceIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSensorsNextPageRequest(nextLink, sensorPartnerId, sensorDataModelIds, sensorMappingIds, deviceIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Sensors.GetSensors", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Sensors.GetSensors", "value", "nextLink", context); } internal HttpMessage CreateGetSensorsRequest(string sensorPartnerId, IEnumerable sensorDataModelIds, IEnumerable sensorMappingIds, IEnumerable deviceIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context) diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageData.cs index a158acf45585..65157d236fca 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageData.cs @@ -400,7 +400,7 @@ public virtual AsyncPageable GetAllTillageDataByPartyIdAsync(string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllTillageDataByPartyIdRequest(partyId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllTillageDataByPartyIdNextPageRequest(nextLink, partyId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageDataByPartyId", "value", "nextLink", context); } /// @@ -456,7 +456,7 @@ public virtual Pageable GetAllTillageDataByPartyId(string partyId, d HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllTillageDataByPartyIdRequest(partyId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllTillageDataByPartyIdNextPageRequest(nextLink, partyId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageDataByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageDataByPartyId", "value", "nextLink", context); } /// @@ -507,7 +507,7 @@ public virtual AsyncPageable GetAllTillageDataAsync(double? minTilla { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllTillageDataRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, tillageDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllTillageDataNextPageRequest(nextLink, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, tillageDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageData", "value", "nextLink", context); } /// @@ -558,7 +558,7 @@ public virtual Pageable GetAllTillageData(double? minTillageDepth, d { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllTillageDataRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, tillageDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllTillageDataNextPageRequest(nextLink, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, tillageDataIds, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageData", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "TillageData.GetAllTillageData", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Weather.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Weather.cs index be539c98a68b..cc255465be44 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Weather.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Weather.cs @@ -227,7 +227,7 @@ public virtual AsyncPageable GetWeathersAsync(string partyId, string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWeathersRequest(partyId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWeathersNextPageRequest(nextLink, partyId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Weather.GetWeathers", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Weather.GetWeathers", "value", "nextLink", context); } /// @@ -267,7 +267,7 @@ public virtual Pageable GetWeathers(string partyId, string boundaryI HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWeathersRequest(partyId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWeathersNextPageRequest(nextLink, partyId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Weather.GetWeathers", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Weather.GetWeathers", "value", "nextLink", context); } /// diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Zones.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Zones.cs index 0f00f0dcbb1e..ef621f75ba4d 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Zones.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/Zones.cs @@ -389,7 +389,7 @@ public virtual AsyncPageable GetZonesByPartyIdAsync(string partyId, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetZonesByPartyIdRequest(partyId, types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetZonesByPartyIdNextPageRequest(nextLink, partyId, types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZonesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZonesByPartyId", "value", "nextLink", context); } /// @@ -434,7 +434,7 @@ public virtual Pageable GetZonesByPartyId(string partyId, IEnumerabl HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetZonesByPartyIdRequest(partyId, types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetZonesByPartyIdNextPageRequest(nextLink, partyId, types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZonesByPartyId", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZonesByPartyId", "value", "nextLink", context); } /// @@ -474,7 +474,7 @@ public virtual AsyncPageable GetZonesAsync(IEnumerable types { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetZonesRequest(types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetZonesNextPageRequest(nextLink, types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZones", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZones", "value", "nextLink", context); } /// @@ -514,7 +514,7 @@ public virtual Pageable GetZones(IEnumerable types, IEnumera { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetZonesRequest(types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetZonesNextPageRequest(nextLink, types, managementZoneIds, sources, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZones", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Zones.GetZones", "value", "nextLink", context); } /// diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs index 02b3a54561ad..3250916a4566 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _alertProcessingRuleRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _alertProcessingRuleRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), _alertProcessingRuleClientDiagnostics, Pipeline, "AlertProcessingRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), _alertProcessingRuleClientDiagnostics, Pipeline, "AlertProcessingRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _alertProcessingRuleRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _alertProcessingRuleRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), _alertProcessingRuleClientDiagnostics, Pipeline, "AlertProcessingRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), _alertProcessingRuleClientDiagnostics, Pipeline, "AlertProcessingRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleData.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleData.cs index db23742ac7cd..d1d82c20e8f8 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleData.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AlertsManagement.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.AlertsManagement /// public partial class AlertProcessingRuleData : TrackedResourceData { - /// Initializes a new instance of AlertProcessingRuleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AlertProcessingRuleData(AzureLocation location) : base(location) { } - /// Initializes a new instance of AlertProcessingRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +36,16 @@ public AlertProcessingRuleData(AzureLocation location) : base(location) /// The tags. /// The location. /// Alert processing rule properties. - internal AlertProcessingRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AlertProcessingRuleProperties properties) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AlertProcessingRuleProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AlertProcessingRuleData() + { } /// Alert processing rule properties. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ArmAlertsManagementModelFactory.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ArmAlertsManagementModelFactory.cs index 81d7332a7db4..0dbd7193fc55 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ArmAlertsManagementModelFactory.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ArmAlertsManagementModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Model factory for models. public static partial class ArmAlertsManagementModelFactory { - /// Initializes a new instance of AlertProcessingRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,10 +30,10 @@ public static AlertProcessingRuleData AlertProcessingRuleData(ResourceIdentifier { tags ??= new Dictionary(); - return new AlertProcessingRuleData(id, name, resourceType, systemData, tags, location, properties); + return new AlertProcessingRuleData(id, name, resourceType, systemData, tags, location, properties, default); } - /// Initializes a new instance of ServiceAlertMetadata. + /// Initializes a new instance of . /// /// alert meta data property bag /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -42,10 +42,10 @@ public static AlertProcessingRuleData AlertProcessingRuleData(ResourceIdentifier /// A new instance for mocking. public static ServiceAlertMetadata ServiceAlertMetadata(ServiceAlertMetadataProperties properties = null) { - return new ServiceAlertMetadata(properties); + return new ServiceAlertMetadata(properties, default); } - /// Initializes a new instance of ServiceAlertData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -54,20 +54,20 @@ public static ServiceAlertMetadata ServiceAlertMetadata(ServiceAlertMetadataProp /// A new instance for mocking. public static ServiceAlertData ServiceAlertData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ServiceAlertProperties properties = null) { - return new ServiceAlertData(id, name, resourceType, systemData, properties); + return new ServiceAlertData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of ServiceAlertProperties. + /// Initializes a new instance of . /// This object contains consistent fields across different monitor services. /// Information specific to the monitor service that gives more contextual details about the alert. /// Config which would be used for displaying the data in portal. /// A new instance for mocking. public static ServiceAlertProperties ServiceAlertProperties(ServiceAlertEssentials essentials = null, BinaryData context = null, BinaryData egressConfig = null) { - return new ServiceAlertProperties(essentials, context, egressConfig); + return new ServiceAlertProperties(essentials, context, egressConfig, default); } - /// Initializes a new instance of ServiceAlertEssentials. + /// Initializes a new instance of . /// Severity of alert Sev0 being highest and Sev4 being lowest. /// The type of signal the alert is based on, which could be metrics, logs or activity logs. /// Alert object state, which can be modified by the user. @@ -90,10 +90,10 @@ public static ServiceAlertProperties ServiceAlertProperties(ServiceAlertEssentia /// A new instance for mocking. public static ServiceAlertEssentials ServiceAlertEssentials(ServiceAlertSeverity? severity = null, ServiceAlertSignalType? signalType = null, ServiceAlertState? alertState = null, MonitorCondition? monitorCondition = null, string targetResource = null, string targetResourceName = null, string targetResourceGroup = null, string targetResourceType = null, MonitorServiceSourceForAlert? monitorService = null, string alertRule = null, string sourceCreatedId = null, Guid? smartGroupId = null, string smartGroupingReason = null, DateTimeOffset? startOn = null, DateTimeOffset? lastModifiedOn = null, DateTimeOffset? monitorConditionResolvedOn = null, string lastModifiedBy = null, bool? isSuppressed = null, string description = null) { - return new ServiceAlertEssentials(severity, signalType, alertState, monitorCondition, targetResource, targetResourceName, targetResourceGroup, targetResourceType, monitorService, alertRule, sourceCreatedId, smartGroupId, smartGroupingReason, startOn, lastModifiedOn, monitorConditionResolvedOn, lastModifiedBy, isSuppressed != null ? new ServiceAlertActionStatus(isSuppressed) : null, description); + return new ServiceAlertEssentials(severity, signalType, alertState, monitorCondition, targetResource, targetResourceName, targetResourceGroup, targetResourceType, monitorService, alertRule, sourceCreatedId, smartGroupId, smartGroupingReason, startOn, lastModifiedOn, monitorConditionResolvedOn, lastModifiedBy, isSuppressed != null ? new ServiceAlertActionStatus(isSuppressed, new Dictionary()) : null, description, default); } - /// Initializes a new instance of ServiceAlertModification. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -102,10 +102,10 @@ public static ServiceAlertEssentials ServiceAlertEssentials(ServiceAlertSeverity /// A new instance for mocking. public static ServiceAlertModification ServiceAlertModification(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ServiceAlertModificationProperties properties = null) { - return new ServiceAlertModification(id, name, resourceType, systemData, properties); + return new ServiceAlertModification(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of ServiceAlertModificationProperties. + /// Initializes a new instance of . /// Unique Id of the alert for which the history is being retrieved. /// Modification details. /// A new instance for mocking. @@ -113,10 +113,10 @@ public static ServiceAlertModificationProperties ServiceAlertModificationPropert { modifications ??= new List(); - return new ServiceAlertModificationProperties(alertId, modifications?.ToList()); + return new ServiceAlertModificationProperties(alertId, modifications?.ToList(), default); } - /// Initializes a new instance of ServiceAlertSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -125,10 +125,10 @@ public static ServiceAlertModificationProperties ServiceAlertModificationPropert /// A new instance for mocking. public static ServiceAlertSummary ServiceAlertSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ServiceAlertSummaryGroup properties = null) { - return new ServiceAlertSummary(id, name, resourceType, systemData, properties); + return new ServiceAlertSummary(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of SmartGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -158,10 +158,10 @@ public static SmartGroupData SmartGroupData(ResourceIdentifier id = null, string alertStates ??= new List(); alertSeverities ??= new List(); - return new SmartGroupData(id, name, resourceType, systemData, alertsCount, smartGroupState, severity, startOn, lastModifiedOn, lastModifiedBy, resources?.ToList(), resourceTypes?.ToList(), resourceGroups?.ToList(), monitorServices?.ToList(), monitorConditions?.ToList(), alertStates?.ToList(), alertSeverities?.ToList(), nextLink); + return new SmartGroupData(id, name, resourceType, systemData, alertsCount, smartGroupState, severity, startOn, lastModifiedOn, lastModifiedBy, resources?.ToList(), resourceTypes?.ToList(), resourceGroups?.ToList(), monitorServices?.ToList(), monitorConditions?.ToList(), alertStates?.ToList(), alertSeverities?.ToList(), nextLink, default); } - /// Initializes a new instance of SmartGroupModification. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -170,10 +170,10 @@ public static SmartGroupData SmartGroupData(ResourceIdentifier id = null, string /// A new instance for mocking. public static SmartGroupModification SmartGroupModification(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SmartGroupModificationProperties properties = null) { - return new SmartGroupModification(id, name, resourceType, systemData, properties); + return new SmartGroupModification(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of SmartGroupModificationProperties. + /// Initializes a new instance of . /// Unique Id of the smartGroup for which the history is being retrieved. /// Modification details. /// URL to fetch the next set of results. @@ -182,26 +182,26 @@ public static SmartGroupModificationProperties SmartGroupModificationProperties( { modifications ??= new List(); - return new SmartGroupModificationProperties(smartGroupId, modifications?.ToList(), nextLink); + return new SmartGroupModificationProperties(smartGroupId, modifications?.ToList(), nextLink, default); } - /// Initializes a new instance of MonitorServiceList. + /// Initializes a new instance of . /// Array of operations. /// A new instance for mocking. public static MonitorServiceList MonitorServiceList(IEnumerable data = null) { data ??= new List(); - return new MonitorServiceList(ServiceAlertMetadataIdentifier.MonitorServiceList, data?.ToList()); + return new MonitorServiceList(ServiceAlertMetadataIdentifier.MonitorServiceList, data?.ToList(), default); } - /// Initializes a new instance of MonitorServiceDetails. + /// Initializes a new instance of . /// Monitor service name. /// Monitor service display name. /// A new instance for mocking. public static MonitorServiceDetails MonitorServiceDetails(string name = null, string displayName = null) { - return new MonitorServiceDetails(name, displayName); + return new MonitorServiceDetails(name, displayName, default); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index a877d5bacda0..cd596b01c061 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -81,7 +81,7 @@ public virtual AsyncPageable GetAlertProcessingRule { HttpMessage FirstPageRequest(int? pageSizeHint) => AlertProcessingRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertProcessingRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertProcessingRules", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertProcessingRules", "value", "nextLink", cancellationToken); } /// @@ -103,7 +103,7 @@ public virtual Pageable GetAlertProcessingRules(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => AlertProcessingRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertProcessingRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertProcessingRules", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertProcessingRules", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.Serialization.cs index aace51b804d8..efe7260d66f4 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleAction : IUtf8JsonSerializable + public partial class AlertProcessingRuleAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("actionType"u8); writer.WriteStringValue(ActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleAction DeserializeAlertProcessingRuleAction(JsonElement element) + internal static AlertProcessingRuleAction DeserializeAlertProcessingRuleAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,7 +56,72 @@ internal static AlertProcessingRuleAction DeserializeAlertProcessingRuleAction(J case "RemoveAllActionGroups": return AlertProcessingRuleRemoveAllGroupsAction.DeserializeAlertProcessingRuleRemoveAllGroupsAction(element); } } - return UnknownAction.DeserializeUnknownAction(element); + + // Unknown type found so we will deserialize the base properties only + AlertProcessingRuleActionType actionType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionType"u8)) + { + actionType = new AlertProcessingRuleActionType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownAction(actionType, serializedAdditionalRawData); + } + + AlertProcessingRuleAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.cs index bef94914c688..da9abc55ff14 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAction.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.AlertsManagement.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownAction))] public abstract partial class AlertProcessingRuleAction { - /// Initializes a new instance of AlertProcessingRuleAction. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AlertProcessingRuleAction() { } - /// Initializes a new instance of AlertProcessingRuleAction. + /// Initializes a new instance of . /// Action that should be applied. - internal AlertProcessingRuleAction(AlertProcessingRuleActionType actionType) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleAction(AlertProcessingRuleActionType actionType, Dictionary serializedAdditionalRawData) { ActionType = actionType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Action that should be applied. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.Serialization.cs index c7e7f9793093..77f8b4200d8c 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleAddGroupsAction : IUtf8JsonSerializable + public partial class AlertProcessingRuleAddGroupsAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("actionGroupIds"u8); writer.WriteStartArray(); @@ -30,17 +37,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); writer.WritePropertyName("actionType"u8); writer.WriteStringValue(ActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleAddGroupsAction DeserializeAlertProcessingRuleAddGroupsAction(JsonElement element) + internal static AlertProcessingRuleAddGroupsAction DeserializeAlertProcessingRuleAddGroupsAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList actionGroupIds = default; AlertProcessingRuleActionType actionType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actionGroupIds"u8)) @@ -65,8 +87,61 @@ internal static AlertProcessingRuleAddGroupsAction DeserializeAlertProcessingRul actionType = new AlertProcessingRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleAddGroupsAction(actionType, actionGroupIds, serializedAdditionalRawData); + } + + AlertProcessingRuleAddGroupsAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleAddGroupsAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleAddGroupsAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleAddGroupsAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleAddGroupsAction model) + { + if (model is null) + { + return null; } - return new AlertProcessingRuleAddGroupsAction(actionType, actionGroupIds); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleAddGroupsAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleAddGroupsAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.cs index 9ebb239949b8..4f87cd2b7be2 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleAddGroupsAction.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Add action groups to alert processing rule. public partial class AlertProcessingRuleAddGroupsAction : AlertProcessingRuleAction { - /// Initializes a new instance of AlertProcessingRuleAddGroupsAction. + /// Initializes a new instance of . /// List of action group Ids to add to alert processing rule. /// is null. public AlertProcessingRuleAddGroupsAction(IEnumerable actionGroupIds) @@ -26,15 +26,21 @@ public AlertProcessingRuleAddGroupsAction(IEnumerable action ActionType = AlertProcessingRuleActionType.AddActionGroups; } - /// Initializes a new instance of AlertProcessingRuleAddGroupsAction. + /// Initializes a new instance of . /// Action that should be applied. /// List of action group Ids to add to alert processing rule. - internal AlertProcessingRuleAddGroupsAction(AlertProcessingRuleActionType actionType, IList actionGroupIds) : base(actionType) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleAddGroupsAction(AlertProcessingRuleActionType actionType, IList actionGroupIds, Dictionary serializedAdditionalRawData) : base(actionType, serializedAdditionalRawData) { ActionGroupIds = actionGroupIds; ActionType = actionType; } + /// Initializes a new instance of for deserialization. + internal AlertProcessingRuleAddGroupsAction() + { + } + /// List of action group Ids to add to alert processing rule. public IList ActionGroupIds { get; } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.Serialization.cs index e3a5e2d6c2c3..eb2bad77182f 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleCondition : IUtf8JsonSerializable + public partial class AlertProcessingRuleCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Field)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleCondition DeserializeAlertProcessingRuleCondition(JsonElement element) + internal static AlertProcessingRuleCondition DeserializeAlertProcessingRuleCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static AlertProcessingRuleCondition DeserializeAlertProcessingRuleCondi Optional field = default; Optional @operator = default; Optional> values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("field"u8)) @@ -82,8 +104,61 @@ internal static AlertProcessingRuleCondition DeserializeAlertProcessingRuleCondi values = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleCondition(Optional.ToNullable(field), Optional.ToNullable(@operator), Optional.ToList(values), serializedAdditionalRawData); + } + + AlertProcessingRuleCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleCondition model) + { + if (model is null) + { + return null; } - return new AlertProcessingRuleCondition(Optional.ToNullable(field), Optional.ToNullable(@operator), Optional.ToList(values)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.cs index 129430e7a045..a75546161c06 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Condition to trigger an alert processing rule. public partial class AlertProcessingRuleCondition { - /// Initializes a new instance of AlertProcessingRuleCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AlertProcessingRuleCondition() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of AlertProcessingRuleCondition. + /// Initializes a new instance of . /// Field for a given condition. /// Operator for a given condition. /// List of values to match for a given condition. - internal AlertProcessingRuleCondition(AlertProcessingRuleField? field, AlertProcessingRuleOperator? @operator, IList values) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleCondition(AlertProcessingRuleField? field, AlertProcessingRuleOperator? @operator, IList values, Dictionary serializedAdditionalRawData) { Field = field; Operator = @operator; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Field for a given condition. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleData.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleData.Serialization.cs index eb73a25dff6d..d77a00042e2d 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleData.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AlertsManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AlertsManagement { - public partial class AlertProcessingRuleData : IUtf8JsonSerializable + public partial class AlertProcessingRuleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleData DeserializeAlertProcessingRuleData(JsonElement element) + internal static AlertProcessingRuleData DeserializeAlertProcessingRuleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static AlertProcessingRuleData DeserializeAlertProcessingRuleData(JsonE string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -106,8 +135,61 @@ internal static AlertProcessingRuleData DeserializeAlertProcessingRuleData(JsonE systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, serializedAdditionalRawData); + } + + AlertProcessingRuleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleData(Response response) + { + if (response is null) + { + return null; } - return new AlertProcessingRuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.Serialization.cs index 603bc3a71e51..2d124b16484c 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleMonthlyRecurrence : IUtf8JsonSerializable + public partial class AlertProcessingRuleMonthlyRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("daysOfMonth"u8); writer.WriteStartArray(); @@ -36,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endTime"u8); writer.WriteStringValue(EndOn.Value, "T"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleMonthlyRecurrence DeserializeAlertProcessingRuleMonthlyRecurrence(JsonElement element) + internal static AlertProcessingRuleMonthlyRecurrence DeserializeAlertProcessingRuleMonthlyRecurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +69,7 @@ internal static AlertProcessingRuleMonthlyRecurrence DeserializeAlertProcessingR RecurrenceType recurrenceType = default; Optional startTime = default; Optional endTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("daysOfMonth"u8)) @@ -84,8 +105,61 @@ internal static AlertProcessingRuleMonthlyRecurrence DeserializeAlertProcessingR endTime = property.Value.GetTimeSpan("T"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleMonthlyRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime), daysOfMonth, serializedAdditionalRawData); + } + + AlertProcessingRuleMonthlyRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleMonthlyRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleMonthlyRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleMonthlyRecurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleMonthlyRecurrence model) + { + if (model is null) + { + return null; } - return new AlertProcessingRuleMonthlyRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime), daysOfMonth); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleMonthlyRecurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleMonthlyRecurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.cs index ef8fc8f74595..6be273d5d632 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleMonthlyRecurrence.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Monthly recurrence object. public partial class AlertProcessingRuleMonthlyRecurrence : AlertProcessingRuleRecurrence { - /// Initializes a new instance of AlertProcessingRuleMonthlyRecurrence. + /// Initializes a new instance of . /// Specifies the values for monthly recurrence pattern. /// is null. public AlertProcessingRuleMonthlyRecurrence(IEnumerable daysOfMonth) @@ -26,17 +26,23 @@ public AlertProcessingRuleMonthlyRecurrence(IEnumerable daysOfMonth) RecurrenceType = RecurrenceType.Monthly; } - /// Initializes a new instance of AlertProcessingRuleMonthlyRecurrence. + /// Initializes a new instance of . /// Specifies when the recurrence should be applied. /// Start time for recurrence. /// End time for recurrence. /// Specifies the values for monthly recurrence pattern. - internal AlertProcessingRuleMonthlyRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, IList daysOfMonth) : base(recurrenceType, startOn, endOn) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleMonthlyRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, IList daysOfMonth, Dictionary serializedAdditionalRawData) : base(recurrenceType, startOn, endOn, serializedAdditionalRawData) { DaysOfMonth = daysOfMonth; RecurrenceType = recurrenceType; } + /// Initializes a new instance of for deserialization. + internal AlertProcessingRuleMonthlyRecurrence() + { + } + /// Specifies the values for monthly recurrence pattern. public IList DaysOfMonth { get; } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.Serialization.cs index b41eda1b5537..bbb54df0e138 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRulePatch : IUtf8JsonSerializable + public partial class AlertProcessingRulePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AlertProcessingRulePatch DeserializeAlertProcessingRulePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("enabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRulePatch(Optional.ToDictionary(tags), Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + AlertProcessingRulePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRulePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRulePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRulePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRulePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRulePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRulePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.cs index e9ac4d7c7591..106b043d2fdd 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Data contract for patch. public partial class AlertProcessingRulePatch { - /// Initializes a new instance of AlertProcessingRulePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AlertProcessingRulePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Tags to be updated. + /// Indicates if the given alert processing rule is enabled or disabled. + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRulePatch(IDictionary tags, bool? isEnabled, Dictionary serializedAdditionalRawData) + { + Tags = tags; + IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Tags to be updated. public IDictionary Tags { get; } /// Indicates if the given alert processing rule is enabled or disabled. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.Serialization.cs index 0d66f4ab9b2a..f9fef4322775 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleProperties : IUtf8JsonSerializable + public partial class AlertProcessingRuleProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("scopes"u8); writer.WriteStartArray(); @@ -29,20 +36,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Conditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Schedule)) { writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } } writer.WritePropertyName("actions"u8); writer.WriteStartArray(); foreach (var item in Actions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(Description)) @@ -55,11 +83,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleProperties DeserializeAlertProcessingRuleProperties(JsonElement element) + internal static AlertProcessingRuleProperties DeserializeAlertProcessingRuleProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +112,7 @@ internal static AlertProcessingRuleProperties DeserializeAlertProcessingRuleProp IList actions = default; Optional description = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scopes"u8)) @@ -129,8 +172,61 @@ internal static AlertProcessingRuleProperties DeserializeAlertProcessingRuleProp enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleProperties(scopes, Optional.ToList(conditions), schedule.Value, actions, description.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + AlertProcessingRuleProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleProperties(Response response) + { + if (response is null) + { + return null; } - return new AlertProcessingRuleProperties(scopes, Optional.ToList(conditions), schedule.Value, actions, description.Value, Optional.ToNullable(enabled)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.cs index f1660171e447..cd1c07d24248 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Alert processing rule properties defining scopes, conditions and scheduling logic for alert processing rule. public partial class AlertProcessingRuleProperties { - /// Initializes a new instance of AlertProcessingRuleProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Scopes on which alert processing rule will apply. /// /// Actions to be applied. @@ -33,7 +36,7 @@ public AlertProcessingRuleProperties(IEnumerable scopes, IEnumerable Initializes a new instance of AlertProcessingRuleProperties. + /// Initializes a new instance of . /// Scopes on which alert processing rule will apply. /// Conditions on which alerts will be filtered. /// Scheduling for alert processing rule. @@ -44,7 +47,8 @@ public AlertProcessingRuleProperties(IEnumerable scopes, IEnumerable /// Description of alert processing rule. /// Indicates if the given alert processing rule is enabled or disabled. - internal AlertProcessingRuleProperties(IList scopes, IList conditions, AlertProcessingRuleSchedule schedule, IList actions, string description, bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleProperties(IList scopes, IList conditions, AlertProcessingRuleSchedule schedule, IList actions, string description, bool? isEnabled, Dictionary serializedAdditionalRawData) { Scopes = scopes; Conditions = conditions; @@ -52,6 +56,12 @@ internal AlertProcessingRuleProperties(IList scopes, IList Initializes a new instance of for deserialization. + internal AlertProcessingRuleProperties() + { } /// Scopes on which alert processing rule will apply. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.Serialization.cs index 9a82a8707ad6..bdb7239cd02a 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleRecurrence : IUtf8JsonSerializable + public partial class AlertProcessingRuleRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("recurrenceType"u8); writer.WriteStringValue(RecurrenceType.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endTime"u8); writer.WriteStringValue(EndOn.Value, "T"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleRecurrence DeserializeAlertProcessingRuleRecurrence(JsonElement element) + internal static AlertProcessingRuleRecurrence DeserializeAlertProcessingRuleRecurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,7 +67,92 @@ internal static AlertProcessingRuleRecurrence DeserializeAlertProcessingRuleRecu case "Weekly": return AlertProcessingRuleWeeklyRecurrence.DeserializeAlertProcessingRuleWeeklyRecurrence(element); } } - return UnknownRecurrence.DeserializeUnknownRecurrence(element); + + // Unknown type found so we will deserialize the base properties only + RecurrenceType recurrenceType = default; + Optional startTime = default; + Optional endTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("recurrenceType"u8)) + { + recurrenceType = new RecurrenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetTimeSpan("T"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetTimeSpan("T"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime), serializedAdditionalRawData); + } + + AlertProcessingRuleRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleRecurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleRecurrence model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleRecurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleRecurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.cs index 0028fb36dde7..701f11cbb0dc 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRecurrence.cs @@ -6,6 +6,8 @@ #nullable disable using System; +using System.Collections.Generic; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { @@ -14,22 +16,28 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownRecurrence))] public abstract partial class AlertProcessingRuleRecurrence { - /// Initializes a new instance of AlertProcessingRuleRecurrence. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AlertProcessingRuleRecurrence() { } - /// Initializes a new instance of AlertProcessingRuleRecurrence. + /// Initializes a new instance of . /// Specifies when the recurrence should be applied. /// Start time for recurrence. /// End time for recurrence. - internal AlertProcessingRuleRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, Dictionary serializedAdditionalRawData) { RecurrenceType = recurrenceType; StartOn = startOn; EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies when the recurrence should be applied. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.Serialization.cs index 75b4fd27566a..148832d51419 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleRemoveAllGroupsAction : IUtf8JsonSerializable + public partial class AlertProcessingRuleRemoveAllGroupsAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("actionType"u8); writer.WriteStringValue(ActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleRemoveAllGroupsAction DeserializeAlertProcessingRuleRemoveAllGroupsAction(JsonElement element) + internal static AlertProcessingRuleRemoveAllGroupsAction DeserializeAlertProcessingRuleRemoveAllGroupsAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } AlertProcessingRuleActionType actionType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actionType"u8)) @@ -34,8 +57,61 @@ internal static AlertProcessingRuleRemoveAllGroupsAction DeserializeAlertProcess actionType = new AlertProcessingRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleRemoveAllGroupsAction(actionType, serializedAdditionalRawData); + } + + AlertProcessingRuleRemoveAllGroupsAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleRemoveAllGroupsAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleRemoveAllGroupsAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleRemoveAllGroupsAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleRemoveAllGroupsAction model) + { + if (model is null) + { + return null; } - return new AlertProcessingRuleRemoveAllGroupsAction(actionType); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleRemoveAllGroupsAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleRemoveAllGroupsAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.cs index 922f45e3d2a4..43609dc144dd 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleRemoveAllGroupsAction.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// Indicates if all action groups should be removed. public partial class AlertProcessingRuleRemoveAllGroupsAction : AlertProcessingRuleAction { - /// Initializes a new instance of AlertProcessingRuleRemoveAllGroupsAction. + /// Initializes a new instance of . public AlertProcessingRuleRemoveAllGroupsAction() { ActionType = AlertProcessingRuleActionType.RemoveAllActionGroups; } - /// Initializes a new instance of AlertProcessingRuleRemoveAllGroupsAction. + /// Initializes a new instance of . /// Action that should be applied. - internal AlertProcessingRuleRemoveAllGroupsAction(AlertProcessingRuleActionType actionType) : base(actionType) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleRemoveAllGroupsAction(AlertProcessingRuleActionType actionType, Dictionary serializedAdditionalRawData) : base(actionType, serializedAdditionalRawData) { ActionType = actionType; } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.Serialization.cs index 8fedb986f0f1..b338e3ce1bb7 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleSchedule : IUtf8JsonSerializable + public partial class AlertProcessingRuleSchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EffectiveFrom)) { @@ -38,15 +44,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Recurrences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleSchedule DeserializeAlertProcessingRuleSchedule(JsonElement element) + internal static AlertProcessingRuleSchedule DeserializeAlertProcessingRuleSchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +82,7 @@ internal static AlertProcessingRuleSchedule DeserializeAlertProcessingRuleSchedu Optional effectiveUntil = default; Optional timeZone = default; Optional> recurrences = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("effectiveFrom"u8)) @@ -94,8 +122,61 @@ internal static AlertProcessingRuleSchedule DeserializeAlertProcessingRuleSchedu recurrences = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleSchedule(Optional.ToNullable(effectiveFrom), Optional.ToNullable(effectiveUntil), timeZone.Value, Optional.ToList(recurrences), serializedAdditionalRawData); + } + + AlertProcessingRuleSchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleSchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleSchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleSchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleSchedule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleSchedule(Response response) + { + if (response is null) + { + return null; } - return new AlertProcessingRuleSchedule(Optional.ToNullable(effectiveFrom), Optional.ToNullable(effectiveUntil), timeZone.Value, Optional.ToList(recurrences)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleSchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.cs index d52690e336b3..8788b6d324c1 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleSchedule.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Scheduling configuration for a given alert processing rule. public partial class AlertProcessingRuleSchedule { - /// Initializes a new instance of AlertProcessingRuleSchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AlertProcessingRuleSchedule() { Recurrences = new ChangeTrackingList(); } - /// Initializes a new instance of AlertProcessingRuleSchedule. + /// Initializes a new instance of . /// Scheduling effective from time. Date-Time in ISO-8601 format without timezone suffix. /// Scheduling effective until time. Date-Time in ISO-8601 format without timezone suffix. /// Scheduling time zone. @@ -29,12 +32,14 @@ public AlertProcessingRuleSchedule() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// - internal AlertProcessingRuleSchedule(DateTimeOffset? effectiveFrom, DateTimeOffset? effectiveUntil, string timeZone, IList recurrences) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleSchedule(DateTimeOffset? effectiveFrom, DateTimeOffset? effectiveUntil, string timeZone, IList recurrences, Dictionary serializedAdditionalRawData) { EffectiveFrom = effectiveFrom; EffectiveUntil = effectiveUntil; TimeZone = timeZone; Recurrences = recurrences; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scheduling effective from time. Date-Time in ISO-8601 format without timezone suffix. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.Serialization.cs index 742092f36920..f5820477f85c 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class AlertProcessingRuleWeeklyRecurrence : IUtf8JsonSerializable + public partial class AlertProcessingRuleWeeklyRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("daysOfWeek"u8); writer.WriteStartArray(); @@ -36,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endTime"u8); writer.WriteStringValue(EndOn.Value, "T"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertProcessingRuleWeeklyRecurrence DeserializeAlertProcessingRuleWeeklyRecurrence(JsonElement element) + internal static AlertProcessingRuleWeeklyRecurrence DeserializeAlertProcessingRuleWeeklyRecurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +69,7 @@ internal static AlertProcessingRuleWeeklyRecurrence DeserializeAlertProcessingRu RecurrenceType recurrenceType = default; Optional startTime = default; Optional endTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("daysOfWeek"u8)) @@ -84,8 +105,61 @@ internal static AlertProcessingRuleWeeklyRecurrence DeserializeAlertProcessingRu endTime = property.Value.GetTimeSpan("T"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertProcessingRuleWeeklyRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime), daysOfWeek, serializedAdditionalRawData); + } + + AlertProcessingRuleWeeklyRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRuleWeeklyRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleWeeklyRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleWeeklyRecurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRuleWeeklyRecurrence model) + { + if (model is null) + { + return null; } - return new AlertProcessingRuleWeeklyRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime), daysOfWeek); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRuleWeeklyRecurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRuleWeeklyRecurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.cs index 3f70ff9478e9..8b3c17e88a40 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRuleWeeklyRecurrence.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Weekly recurrence object. public partial class AlertProcessingRuleWeeklyRecurrence : AlertProcessingRuleRecurrence { - /// Initializes a new instance of AlertProcessingRuleWeeklyRecurrence. + /// Initializes a new instance of . /// Specifies the values for weekly recurrence pattern. /// is null. public AlertProcessingRuleWeeklyRecurrence(IEnumerable daysOfWeek) @@ -26,17 +26,23 @@ public AlertProcessingRuleWeeklyRecurrence(IEnumerable Initializes a new instance of AlertProcessingRuleWeeklyRecurrence. + /// Initializes a new instance of . /// Specifies when the recurrence should be applied. /// Start time for recurrence. /// End time for recurrence. /// Specifies the values for weekly recurrence pattern. - internal AlertProcessingRuleWeeklyRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, IList daysOfWeek) : base(recurrenceType, startOn, endOn) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRuleWeeklyRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, IList daysOfWeek, Dictionary serializedAdditionalRawData) : base(recurrenceType, startOn, endOn, serializedAdditionalRawData) { DaysOfWeek = daysOfWeek; RecurrenceType = recurrenceType; } + /// Initializes a new instance of for deserialization. + internal AlertProcessingRuleWeeklyRecurrence() + { + } + /// Specifies the values for weekly recurrence pattern. public IList DaysOfWeek { get; } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.Serialization.cs index 9ba09ff793e3..952835c2ee34 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AlertsManagement; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class AlertProcessingRulesList + internal partial class AlertProcessingRulesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AlertProcessingRulesList DeserializeAlertProcessingRulesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AlertProcessingRulesList DeserializeAlertProcessingRulesList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +93,61 @@ internal static AlertProcessingRulesList DeserializeAlertProcessingRulesList(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AlertProcessingRulesList(nextLink.Value, Optional.ToList(value)); + return new AlertProcessingRulesList(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + AlertProcessingRulesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertProcessingRulesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRulesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRulesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertProcessingRulesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertProcessingRulesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertProcessingRulesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.cs index e2a533bada42..e2d17a2aa306 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/AlertProcessingRulesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AlertsManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// List of alert processing rules. internal partial class AlertProcessingRulesList { - /// Initializes a new instance of AlertProcessingRulesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AlertProcessingRulesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AlertProcessingRulesList. + /// Initializes a new instance of . /// URL to fetch the next set of alert processing rules. /// List of alert processing rules. - internal AlertProcessingRulesList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AlertProcessingRulesList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// URL to fetch the next set of alert processing rules. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.Serialization.cs index 293025387b24..d79ad49726ba 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class DailyRecurrence : IUtf8JsonSerializable + public partial class DailyRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("recurrenceType"u8); writer.WriteStringValue(RecurrenceType.ToString()); @@ -28,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endTime"u8); writer.WriteStringValue(EndOn.Value, "T"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DailyRecurrence DeserializeDailyRecurrence(JsonElement element) + internal static DailyRecurrence DeserializeDailyRecurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static DailyRecurrence DeserializeDailyRecurrence(JsonElement element) RecurrenceType recurrenceType = default; Optional startTime = default; Optional endTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("recurrenceType"u8)) @@ -65,8 +87,61 @@ internal static DailyRecurrence DeserializeDailyRecurrence(JsonElement element) endTime = property.Value.GetTimeSpan("T"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DailyRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime), serializedAdditionalRawData); + } + + DailyRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDailyRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DailyRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDailyRecurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DailyRecurrence model) + { + if (model is null) + { + return null; } - return new DailyRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DailyRecurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDailyRecurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.cs index 75ac4f34b905..f775f0c38788 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/DailyRecurrence.cs @@ -6,23 +6,25 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AlertsManagement.Models { /// Daily recurrence object. public partial class DailyRecurrence : AlertProcessingRuleRecurrence { - /// Initializes a new instance of DailyRecurrence. + /// Initializes a new instance of . public DailyRecurrence() { RecurrenceType = RecurrenceType.Daily; } - /// Initializes a new instance of DailyRecurrence. + /// Initializes a new instance of . /// Specifies when the recurrence should be applied. /// Start time for recurrence. /// End time for recurrence. - internal DailyRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn) : base(recurrenceType, startOn, endOn) + /// Keeps track of any properties unknown to the library. + internal DailyRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, Dictionary serializedAdditionalRawData) : base(recurrenceType, startOn, endOn, serializedAdditionalRawData) { RecurrenceType = recurrenceType; } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.Serialization.cs index f544630ff9b0..c2268e08e966 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class MonitorServiceDetails + public partial class MonitorServiceDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MonitorServiceDetails DeserializeMonitorServiceDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MonitorServiceDetails DeserializeMonitorServiceDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static MonitorServiceDetails DeserializeMonitorServiceDetails(JsonEleme displayName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MonitorServiceDetails(name.Value, displayName.Value); + return new MonitorServiceDetails(name.Value, displayName.Value, serializedAdditionalRawData); + } + + MonitorServiceDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitorServiceDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitorServiceDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitorServiceDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitorServiceDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitorServiceDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitorServiceDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.cs index 01e65fcf8f0d..53fde9448d30 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceDetails.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// Details of a monitor service. public partial class MonitorServiceDetails { - /// Initializes a new instance of MonitorServiceDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MonitorServiceDetails() { } - /// Initializes a new instance of MonitorServiceDetails. + /// Initializes a new instance of . /// Monitor service name. /// Monitor service display name. - internal MonitorServiceDetails(string name, string displayName) + /// Keeps track of any properties unknown to the library. + internal MonitorServiceDetails(string name, string displayName, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Monitor service name. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.Serialization.cs index a10d440358c5..49625464d54c 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.Serialization.cs @@ -5,22 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class MonitorServiceList + public partial class MonitorServiceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MonitorServiceList DeserializeMonitorServiceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + writer.WritePropertyName("metadataIdentifier"u8); + writer.WriteStringValue(MetadataIdentifier.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MonitorServiceList DeserializeMonitorServiceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList data = default; ServiceAlertMetadataIdentifier metadataIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("data"u8)) @@ -38,8 +82,61 @@ internal static MonitorServiceList DeserializeMonitorServiceList(JsonElement ele metadataIdentifier = new ServiceAlertMetadataIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MonitorServiceList(metadataIdentifier, data); + return new MonitorServiceList(metadataIdentifier, data, serializedAdditionalRawData); + } + + MonitorServiceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitorServiceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitorServiceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitorServiceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitorServiceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitorServiceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitorServiceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.cs index e0126b25dda3..cad3a7ece468 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/MonitorServiceList.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Monitor service details. public partial class MonitorServiceList : ServiceAlertMetadataProperties { - /// Initializes a new instance of MonitorServiceList. + /// Initializes a new instance of . /// Array of operations. /// is null. internal MonitorServiceList(IEnumerable data) @@ -26,15 +26,21 @@ internal MonitorServiceList(IEnumerable data) MetadataIdentifier = ServiceAlertMetadataIdentifier.MonitorServiceList; } - /// Initializes a new instance of MonitorServiceList. + /// Initializes a new instance of . /// Identification of the information to be retrieved by API call. /// Array of operations. - internal MonitorServiceList(ServiceAlertMetadataIdentifier metadataIdentifier, IReadOnlyList data) : base(metadataIdentifier) + /// Keeps track of any properties unknown to the library. + internal MonitorServiceList(ServiceAlertMetadataIdentifier metadataIdentifier, IReadOnlyList data, Dictionary serializedAdditionalRawData) : base(metadataIdentifier, serializedAdditionalRawData) { Data = data; MetadataIdentifier = metadataIdentifier; } + /// Initializes a new instance of for deserialization. + internal MonitorServiceList() + { + } + /// Array of operations. public IReadOnlyList Data { get; } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.Serialization.cs index 0942fa7548cf..b210b8984925 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class ServiceAlertActionStatus : IUtf8JsonSerializable + internal partial class ServiceAlertActionStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSuppressed)) { writer.WritePropertyName("isSuppressed"u8); writer.WriteBooleanValue(IsSuppressed.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAlertActionStatus DeserializeServiceAlertActionStatus(JsonElement element) + internal static ServiceAlertActionStatus DeserializeServiceAlertActionStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isSuppressed = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isSuppressed"u8)) @@ -41,8 +64,61 @@ internal static ServiceAlertActionStatus DeserializeServiceAlertActionStatus(Jso isSuppressed = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertActionStatus(Optional.ToNullable(isSuppressed), serializedAdditionalRawData); + } + + ServiceAlertActionStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertActionStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertActionStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertActionStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertActionStatus model) + { + if (model is null) + { + return null; } - return new ServiceAlertActionStatus(Optional.ToNullable(isSuppressed)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertActionStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertActionStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.cs index 02e25d75f0a8..4f9b710bb620 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertActionStatus.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// Action status. internal partial class ServiceAlertActionStatus { - /// Initializes a new instance of ServiceAlertActionStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertActionStatus() { } - /// Initializes a new instance of ServiceAlertActionStatus. + /// Initializes a new instance of . /// Value indicating whether alert is suppressed. - internal ServiceAlertActionStatus(bool? isSuppressed) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertActionStatus(bool? isSuppressed, Dictionary serializedAdditionalRawData) { IsSuppressed = isSuppressed; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value indicating whether alert is suppressed. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertData.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertData.Serialization.cs index e83e68c16566..a87d0a4b32a2 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertData.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AlertsManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AlertsManagement { - public partial class ServiceAlertData : IUtf8JsonSerializable + public partial class ServiceAlertData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ServiceAlertData DeserializeServiceAlertData(JsonElement element) + internal static ServiceAlertData DeserializeServiceAlertData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static ServiceAlertData DeserializeServiceAlertData(JsonElement element string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static ServiceAlertData DeserializeServiceAlertData(JsonElement element systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ServiceAlertData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertData(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.Serialization.cs index 92947c42b252..0f6b6f72ee99 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertEssentials : IUtf8JsonSerializable + public partial class ServiceAlertEssentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TargetResource)) { @@ -39,18 +46,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ActionStatus)) { writer.WritePropertyName("actionStatus"u8); - writer.WriteObjectValue(ActionStatus); + if (ActionStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ActionStatus).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAlertEssentials DeserializeServiceAlertEssentials(JsonElement element) + internal static ServiceAlertEssentials DeserializeServiceAlertEssentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +102,7 @@ internal static ServiceAlertEssentials DeserializeServiceAlertEssentials(JsonEle Optional lastModifiedUserName = default; Optional actionStatus = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("severity"u8)) @@ -211,8 +240,61 @@ internal static ServiceAlertEssentials DeserializeServiceAlertEssentials(JsonEle description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertEssentials(Optional.ToNullable(severity), Optional.ToNullable(signalType), Optional.ToNullable(alertState), Optional.ToNullable(monitorCondition), targetResource.Value, targetResourceName.Value, targetResourceGroup.Value, targetResourceType.Value, Optional.ToNullable(monitorService), alertRule.Value, sourceCreatedId.Value, Optional.ToNullable(smartGroupId), smartGroupingReason.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(lastModifiedDateTime), Optional.ToNullable(monitorConditionResolvedDateTime), lastModifiedUserName.Value, actionStatus.Value, description.Value, serializedAdditionalRawData); + } + + ServiceAlertEssentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertEssentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertEssentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertEssentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertEssentials model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertEssentials(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertEssentials(Optional.ToNullable(severity), Optional.ToNullable(signalType), Optional.ToNullable(alertState), Optional.ToNullable(monitorCondition), targetResource.Value, targetResourceName.Value, targetResourceGroup.Value, targetResourceType.Value, Optional.ToNullable(monitorService), alertRule.Value, sourceCreatedId.Value, Optional.ToNullable(smartGroupId), smartGroupingReason.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(lastModifiedDateTime), Optional.ToNullable(monitorConditionResolvedDateTime), lastModifiedUserName.Value, actionStatus.Value, description.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertEssentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.cs index 35f2b13719c1..db62639e915c 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertEssentials.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AlertsManagement.Models { /// This object contains consistent fields across different monitor services. public partial class ServiceAlertEssentials { - /// Initializes a new instance of ServiceAlertEssentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertEssentials() { } - /// Initializes a new instance of ServiceAlertEssentials. + /// Initializes a new instance of . /// Severity of alert Sev0 being highest and Sev4 being lowest. /// The type of signal the alert is based on, which could be metrics, logs or activity logs. /// Alert object state, which can be modified by the user. @@ -37,7 +41,8 @@ public ServiceAlertEssentials() /// User who last modified the alert, in case of monitor service updates user would be 'system', otherwise name of the user. /// Action status. /// Alert description. - internal ServiceAlertEssentials(ServiceAlertSeverity? severity, ServiceAlertSignalType? signalType, ServiceAlertState? alertState, MonitorCondition? monitorCondition, string targetResource, string targetResourceName, string targetResourceGroup, string targetResourceType, MonitorServiceSourceForAlert? monitorService, string alertRule, string sourceCreatedId, Guid? smartGroupId, string smartGroupingReason, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, DateTimeOffset? monitorConditionResolvedOn, string lastModifiedBy, ServiceAlertActionStatus actionStatus, string description) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertEssentials(ServiceAlertSeverity? severity, ServiceAlertSignalType? signalType, ServiceAlertState? alertState, MonitorCondition? monitorCondition, string targetResource, string targetResourceName, string targetResourceGroup, string targetResourceType, MonitorServiceSourceForAlert? monitorService, string alertRule, string sourceCreatedId, Guid? smartGroupId, string smartGroupingReason, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, DateTimeOffset? monitorConditionResolvedOn, string lastModifiedBy, ServiceAlertActionStatus actionStatus, string description, Dictionary serializedAdditionalRawData) { Severity = severity; SignalType = signalType; @@ -58,6 +63,7 @@ internal ServiceAlertEssentials(ServiceAlertSeverity? severity, ServiceAlertSign LastModifiedBy = lastModifiedBy; ActionStatus = actionStatus; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Severity of alert Sev0 being highest and Sev4 being lowest. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.Serialization.cs index e8a37f0c9bad..fae78388ac43 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AlertsManagement; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class ServiceAlertListResult + internal partial class ServiceAlertListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAlertListResult DeserializeServiceAlertListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAlertListResult DeserializeServiceAlertListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +93,61 @@ internal static ServiceAlertListResult DeserializeServiceAlertListResult(JsonEle value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAlertListResult(nextLink.Value, Optional.ToList(value)); + return new ServiceAlertListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ServiceAlertListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.cs index adc90df77acd..0fb6a9206775 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AlertsManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// List the alerts. internal partial class ServiceAlertListResult { - /// Initializes a new instance of ServiceAlertListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAlertListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAlertListResult. + /// Initializes a new instance of . /// URL to fetch the next set of alerts. /// List of alerts. - internal ServiceAlertListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// URL to fetch the next set of alerts. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.Serialization.cs index 10fbb4959382..76ee8563921b 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertMetadata + public partial class ServiceAlertMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAlertMetadata DeserializeServiceAlertMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAlertMetadata DeserializeServiceAlertMetadata(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -30,8 +71,61 @@ internal static ServiceAlertMetadata DeserializeServiceAlertMetadata(JsonElement properties = ServiceAlertMetadataProperties.DeserializeServiceAlertMetadataProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAlertMetadata(properties.Value); + return new ServiceAlertMetadata(properties.Value, serializedAdditionalRawData); + } + + ServiceAlertMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.cs index 589a76fad05d..146f9557b9aa 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadata.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// alert meta data information. public partial class ServiceAlertMetadata { - /// Initializes a new instance of ServiceAlertMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAlertMetadata() { } - /// Initializes a new instance of ServiceAlertMetadata. + /// Initializes a new instance of . /// /// alert meta data property bag /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// - internal ServiceAlertMetadata(ServiceAlertMetadataProperties properties) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertMetadata(ServiceAlertMetadataProperties properties, Dictionary serializedAdditionalRawData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.Serialization.cs index 1a291d3a3ec4..543a439a6f9b 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.Serialization.cs @@ -5,14 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertMetadataProperties + public partial class ServiceAlertMetadataProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAlertMetadataProperties DeserializeServiceAlertMetadataProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("metadataIdentifier"u8); + writer.WriteStringValue(MetadataIdentifier.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAlertMetadataProperties DeserializeServiceAlertMetadataProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,7 +55,72 @@ internal static ServiceAlertMetadataProperties DeserializeServiceAlertMetadataPr case "MonitorServiceList": return MonitorServiceList.DeserializeMonitorServiceList(element); } } - return UnknownAlertsMetaDataProperties.DeserializeUnknownAlertsMetaDataProperties(element); + + // Unknown type found so we will deserialize the base properties only + ServiceAlertMetadataIdentifier metadataIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadataIdentifier"u8)) + { + metadataIdentifier = new ServiceAlertMetadataIdentifier(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownAlertsMetaDataProperties(metadataIdentifier, serializedAdditionalRawData); + } + + ServiceAlertMetadataProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertMetadataProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertMetadataProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertMetadataProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertMetadataProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertMetadataProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertMetadataProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.cs index d5af1a7ff5e8..9a3819c64b81 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertMetadataProperties.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.AlertsManagement.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// + [DeserializationProxy(typeof(UnknownAlertsMetaDataProperties))] public abstract partial class ServiceAlertMetadataProperties { - /// Initializes a new instance of ServiceAlertMetadataProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected ServiceAlertMetadataProperties() { } - /// Initializes a new instance of ServiceAlertMetadataProperties. + /// Initializes a new instance of . /// Identification of the information to be retrieved by API call. - internal ServiceAlertMetadataProperties(ServiceAlertMetadataIdentifier metadataIdentifier) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertMetadataProperties(ServiceAlertMetadataIdentifier metadataIdentifier, Dictionary serializedAdditionalRawData) { MetadataIdentifier = metadataIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identification of the information to be retrieved by API call. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.Serialization.cs index cebd6e13b36e..b7ad0c4057c0 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertModification : IUtf8JsonSerializable + public partial class ServiceAlertModification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ServiceAlertModification DeserializeServiceAlertModification(JsonElement element) + internal static ServiceAlertModification DeserializeServiceAlertModification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static ServiceAlertModification DeserializeServiceAlertModification(Jso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -70,8 +100,61 @@ internal static ServiceAlertModification DeserializeServiceAlertModification(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertModification(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ServiceAlertModification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertModification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertModification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertModification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertModification model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertModification(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertModification(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertModification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.cs index 5dd017e13e23..9fd07a4c844e 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModification.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Alert Modification details. public partial class ServiceAlertModification : ResourceData { - /// Initializes a new instance of ServiceAlertModification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertModification() { } - /// Initializes a new instance of ServiceAlertModification. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the alert modification item. - internal ServiceAlertModification(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceAlertModificationProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertModification(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceAlertModificationProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the alert modification item. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.Serialization.cs index 52f71e351f9c..bbd13165a2f1 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertModificationItemInfo : IUtf8JsonSerializable + public partial class ServiceAlertModificationItemInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ModificationEvent)) { @@ -50,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAlertModificationItemInfo DeserializeServiceAlertModificationItemInfo(JsonElement element) + internal static ServiceAlertModificationItemInfo DeserializeServiceAlertModificationItemInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +88,7 @@ internal static ServiceAlertModificationItemInfo DeserializeServiceAlertModifica Optional modifiedBy = default; Optional comments = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("modificationEvent"u8)) @@ -107,8 +130,61 @@ internal static ServiceAlertModificationItemInfo DeserializeServiceAlertModifica description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertModificationItemInfo(Optional.ToNullable(modificationEvent), oldValue.Value, newValue.Value, modifiedAt.Value, modifiedBy.Value, comments.Value, description.Value, serializedAdditionalRawData); + } + + ServiceAlertModificationItemInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertModificationItemInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertModificationItemInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertModificationItemInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertModificationItemInfo model) + { + if (model is null) + { + return null; } - return new ServiceAlertModificationItemInfo(Optional.ToNullable(modificationEvent), oldValue.Value, newValue.Value, modifiedAt.Value, modifiedBy.Value, comments.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertModificationItemInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertModificationItemInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.cs index 845a71fd7d9f..d2ada04b3a0d 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationItemInfo.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// Alert modification item. public partial class ServiceAlertModificationItemInfo { - /// Initializes a new instance of ServiceAlertModificationItemInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertModificationItemInfo() { } - /// Initializes a new instance of ServiceAlertModificationItemInfo. + /// Initializes a new instance of . /// Reason for the modification. /// Old value. /// New value. @@ -23,7 +29,8 @@ public ServiceAlertModificationItemInfo() /// Modified user details (Principal client name). /// Modification comments. /// Description of the modification. - internal ServiceAlertModificationItemInfo(ServiceAlertModificationEvent? modificationEvent, string oldValue, string newValue, string modifiedAt, string modifiedBy, string comments, string description) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertModificationItemInfo(ServiceAlertModificationEvent? modificationEvent, string oldValue, string newValue, string modifiedAt, string modifiedBy, string comments, string description, Dictionary serializedAdditionalRawData) { ModificationEvent = modificationEvent; OldValue = oldValue; @@ -32,6 +39,7 @@ internal ServiceAlertModificationItemInfo(ServiceAlertModificationEvent? modific ModifiedBy = modifiedBy; Comments = comments; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Reason for the modification. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.Serialization.cs index 7b62c94f361d..f521d236df02 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertModificationProperties : IUtf8JsonSerializable + public partial class ServiceAlertModificationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Modifications)) { @@ -23,21 +29,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Modifications) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAlertModificationProperties DeserializeServiceAlertModificationProperties(JsonElement element) + internal static ServiceAlertModificationProperties DeserializeServiceAlertModificationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional alertId = default; Optional> modifications = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("alertId"u8)) @@ -63,8 +91,61 @@ internal static ServiceAlertModificationProperties DeserializeServiceAlertModifi modifications = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertModificationProperties(Optional.ToNullable(alertId), Optional.ToList(modifications), serializedAdditionalRawData); + } + + ServiceAlertModificationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertModificationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertModificationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertModificationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertModificationProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertModificationProperties(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertModificationProperties(Optional.ToNullable(alertId), Optional.ToList(modifications)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertModificationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.cs index 6b5a79b8d72b..c36013901d3b 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertModificationProperties.cs @@ -14,19 +14,24 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Properties of the alert modification item. public partial class ServiceAlertModificationProperties { - /// Initializes a new instance of ServiceAlertModificationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertModificationProperties() { Modifications = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAlertModificationProperties. + /// Initializes a new instance of . /// Unique Id of the alert for which the history is being retrieved. /// Modification details. - internal ServiceAlertModificationProperties(Guid? alertId, IList modifications) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertModificationProperties(Guid? alertId, IList modifications, Dictionary serializedAdditionalRawData) { AlertId = alertId; Modifications = modifications; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique Id of the alert for which the history is being retrieved. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.Serialization.cs index bf9b5dbfa3d9..e6d6ca4415e5 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.Serialization.cs @@ -6,26 +6,54 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertProperties : IUtf8JsonSerializable + public partial class ServiceAlertProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Essentials)) { writer.WritePropertyName("essentials"u8); - writer.WriteObjectValue(Essentials); + if (Essentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Essentials).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ServiceAlertProperties DeserializeServiceAlertProperties(JsonElement element) + internal static ServiceAlertProperties DeserializeServiceAlertProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +61,7 @@ internal static ServiceAlertProperties DeserializeServiceAlertProperties(JsonEle Optional essentials = default; Optional context = default; Optional egressConfig = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("essentials"u8)) @@ -62,8 +91,61 @@ internal static ServiceAlertProperties DeserializeServiceAlertProperties(JsonEle egressConfig = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertProperties(essentials.Value, context.Value, egressConfig.Value, serializedAdditionalRawData); + } + + ServiceAlertProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertProperties(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertProperties(essentials.Value, context.Value, egressConfig.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.cs index 61bbd77749bb..101a48d49688 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertProperties.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AlertsManagement.Models { /// Alert property bag. public partial class ServiceAlertProperties { - /// Initializes a new instance of ServiceAlertProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertProperties() { } - /// Initializes a new instance of ServiceAlertProperties. + /// Initializes a new instance of . /// This object contains consistent fields across different monitor services. /// Information specific to the monitor service that gives more contextual details about the alert. /// Config which would be used for displaying the data in portal. - internal ServiceAlertProperties(ServiceAlertEssentials essentials, BinaryData context, BinaryData egressConfig) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertProperties(ServiceAlertEssentials essentials, BinaryData context, BinaryData egressConfig, Dictionary serializedAdditionalRawData) { Essentials = essentials; Context = context; EgressConfig = egressConfig; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This object contains consistent fields across different monitor services. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.Serialization.cs index f488761fc306..bd00b4bd65ba 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertSummary : IUtf8JsonSerializable + public partial class ServiceAlertSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ServiceAlertSummary DeserializeServiceAlertSummary(JsonElement element) + internal static ServiceAlertSummary DeserializeServiceAlertSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static ServiceAlertSummary DeserializeServiceAlertSummary(JsonElement e string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -70,8 +100,61 @@ internal static ServiceAlertSummary DeserializeServiceAlertSummary(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertSummary(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ServiceAlertSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertSummary(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertSummary(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.cs index 8f56e278ad37..da68c60a28a5 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummary.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Summary of alerts based on the input filters and 'groupby' parameters. public partial class ServiceAlertSummary : ResourceData { - /// Initializes a new instance of ServiceAlertSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertSummary() { } - /// Initializes a new instance of ServiceAlertSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Group the result set. - internal ServiceAlertSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceAlertSummaryGroup properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceAlertSummaryGroup properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Group the result set. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.Serialization.cs index ff2c842ce331..f767e5fee0f5 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertSummaryGroup : IUtf8JsonSerializable + public partial class ServiceAlertSummaryGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Total)) { @@ -37,15 +44,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAlertSummaryGroup DeserializeServiceAlertSummaryGroup(JsonElement element) + internal static ServiceAlertSummaryGroup DeserializeServiceAlertSummaryGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static ServiceAlertSummaryGroup DeserializeServiceAlertSummaryGroup(Jso Optional smartGroupsCount = default; Optional groupedby = default; Optional> values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("total"u8)) @@ -93,8 +122,61 @@ internal static ServiceAlertSummaryGroup DeserializeServiceAlertSummaryGroup(Jso values = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertSummaryGroup(Optional.ToNullable(total), Optional.ToNullable(smartGroupsCount), groupedby.Value, Optional.ToList(values), serializedAdditionalRawData); + } + + ServiceAlertSummaryGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertSummaryGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertSummaryGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertSummaryGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertSummaryGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertSummaryGroup(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertSummaryGroup(Optional.ToNullable(total), Optional.ToNullable(smartGroupsCount), groupedby.Value, Optional.ToList(values)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertSummaryGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.cs index eb77aad2f186..9c664842d77f 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Group the result set. public partial class ServiceAlertSummaryGroup { - /// Initializes a new instance of ServiceAlertSummaryGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertSummaryGroup() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAlertSummaryGroup. + /// Initializes a new instance of . /// Total count of the result set. /// Total count of the smart groups. /// Name of the field aggregated. /// List of the items. - internal ServiceAlertSummaryGroup(long? total, long? smartGroupsCount, string groupedBy, IList values) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertSummaryGroup(long? total, long? smartGroupsCount, string groupedBy, IList values, Dictionary serializedAdditionalRawData) { Total = total; SmartGroupsCount = smartGroupsCount; GroupedBy = groupedBy; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Total count of the result set. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.Serialization.cs index e5297a30bf7f..96b5c81615f6 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class ServiceAlertSummaryGroupItemInfo : IUtf8JsonSerializable + public partial class ServiceAlertSummaryGroupItemInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -37,15 +44,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAlertSummaryGroupItemInfo DeserializeServiceAlertSummaryGroupItemInfo(JsonElement element) + internal static ServiceAlertSummaryGroupItemInfo DeserializeServiceAlertSummaryGroupItemInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static ServiceAlertSummaryGroupItemInfo DeserializeServiceAlertSummaryG Optional count = default; Optional groupedby = default; Optional> values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -89,8 +118,61 @@ internal static ServiceAlertSummaryGroupItemInfo DeserializeServiceAlertSummaryG values = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAlertSummaryGroupItemInfo(name.Value, Optional.ToNullable(count), groupedby.Value, Optional.ToList(values), serializedAdditionalRawData); + } + + ServiceAlertSummaryGroupItemInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAlertSummaryGroupItemInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertSummaryGroupItemInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertSummaryGroupItemInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAlertSummaryGroupItemInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAlertSummaryGroupItemInfo(Response response) + { + if (response is null) + { + return null; } - return new ServiceAlertSummaryGroupItemInfo(name.Value, Optional.ToNullable(count), groupedby.Value, Optional.ToList(values)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAlertSummaryGroupItemInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.cs index 1d7fe40ea94e..fd33178e5c73 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/ServiceAlertSummaryGroupItemInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Alerts summary group item. public partial class ServiceAlertSummaryGroupItemInfo { - /// Initializes a new instance of ServiceAlertSummaryGroupItemInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertSummaryGroupItemInfo() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAlertSummaryGroupItemInfo. + /// Initializes a new instance of . /// Value of the aggregated field. /// Count of the aggregated field. /// Name of the field aggregated. /// List of the items. - internal ServiceAlertSummaryGroupItemInfo(string name, long? count, string groupedBy, IList values) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertSummaryGroupItemInfo(string name, long? count, string groupedBy, IList values, Dictionary serializedAdditionalRawData) { Name = name; Count = count; GroupedBy = groupedBy; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value of the aggregated field. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.Serialization.cs index 42ede4cc3992..538f4f5479d9 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class SmartGroupAggregatedProperty : IUtf8JsonSerializable + public partial class SmartGroupAggregatedProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("count"u8); writer.WriteNumberValue(Count.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SmartGroupAggregatedProperty DeserializeSmartGroupAggregatedProperty(JsonElement element) + internal static SmartGroupAggregatedProperty DeserializeSmartGroupAggregatedProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +75,61 @@ internal static SmartGroupAggregatedProperty DeserializeSmartGroupAggregatedProp count = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmartGroupAggregatedProperty(name.Value, Optional.ToNullable(count), serializedAdditionalRawData); + } + + SmartGroupAggregatedProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmartGroupAggregatedProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmartGroupAggregatedProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmartGroupAggregatedProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmartGroupAggregatedProperty model) + { + if (model is null) + { + return null; } - return new SmartGroupAggregatedProperty(name.Value, Optional.ToNullable(count)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmartGroupAggregatedProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmartGroupAggregatedProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.cs index 5b085c6ad717..7aa490bb039e 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupAggregatedProperty.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// Aggregated property of each type. public partial class SmartGroupAggregatedProperty { - /// Initializes a new instance of SmartGroupAggregatedProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SmartGroupAggregatedProperty() { } - /// Initializes a new instance of SmartGroupAggregatedProperty. + /// Initializes a new instance of . /// Name of the type. /// Total number of items of type. - internal SmartGroupAggregatedProperty(string name, long? count) + /// Keeps track of any properties unknown to the library. + internal SmartGroupAggregatedProperty(string name, long? count, Dictionary serializedAdditionalRawData) { Name = name; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the type. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupData.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupData.Serialization.cs index eca23760c563..c3e66123bd23 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupData.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AlertsManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AlertsManagement { - public partial class SmartGroupData : IUtf8JsonSerializable + public partial class SmartGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -32,7 +38,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Resources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ResourceTypes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,7 +72,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ResourceGroups) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -62,7 +89,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MonitorServices) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -72,7 +106,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MonitorConditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -82,7 +123,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AlertStates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -92,7 +140,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AlertSeverities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -102,11 +157,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(NextLink); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SmartGroupData DeserializeSmartGroupData(JsonElement element) + internal static SmartGroupData DeserializeSmartGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -129,6 +198,7 @@ internal static SmartGroupData DeserializeSmartGroupData(JsonElement element) Optional> alertStates = default; Optional> alertSeverities = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -320,8 +390,61 @@ internal static SmartGroupData DeserializeSmartGroupData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmartGroupData(id, name, type, systemData.Value, Optional.ToNullable(alertsCount), Optional.ToNullable(smartGroupState), Optional.ToNullable(severity), Optional.ToNullable(startDateTime), Optional.ToNullable(lastModifiedDateTime), lastModifiedUserName.Value, Optional.ToList(resources), Optional.ToList(resourceTypes), Optional.ToList(resourceGroups), Optional.ToList(monitorServices), Optional.ToList(monitorConditions), Optional.ToList(alertStates), Optional.ToList(alertSeverities), nextLink.Value, serializedAdditionalRawData); + } + + SmartGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmartGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmartGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmartGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmartGroupData model) + { + if (model is null) + { + return null; } - return new SmartGroupData(id, name, type, systemData.Value, Optional.ToNullable(alertsCount), Optional.ToNullable(smartGroupState), Optional.ToNullable(severity), Optional.ToNullable(startDateTime), Optional.ToNullable(lastModifiedDateTime), lastModifiedUserName.Value, Optional.ToList(resources), Optional.ToList(resourceTypes), Optional.ToList(resourceGroups), Optional.ToList(monitorServices), Optional.ToList(monitorConditions), Optional.ToList(alertStates), Optional.ToList(alertSeverities), nextLink.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmartGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmartGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.Serialization.cs index 6ade657715ac..19daf92a48c2 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class SmartGroupModification : IUtf8JsonSerializable + public partial class SmartGroupModification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static SmartGroupModification DeserializeSmartGroupModification(JsonElement element) + internal static SmartGroupModification DeserializeSmartGroupModification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static SmartGroupModification DeserializeSmartGroupModification(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -70,8 +100,61 @@ internal static SmartGroupModification DeserializeSmartGroupModification(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmartGroupModification(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + SmartGroupModification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmartGroupModification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmartGroupModification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmartGroupModification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmartGroupModification model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmartGroupModification(Response response) + { + if (response is null) + { + return null; } - return new SmartGroupModification(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmartGroupModification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.cs index 198ed2af3eed..7109d4084304 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModification.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Alert Modification details. public partial class SmartGroupModification : ResourceData { - /// Initializes a new instance of SmartGroupModification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SmartGroupModification() { } - /// Initializes a new instance of SmartGroupModification. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the smartGroup modification item. - internal SmartGroupModification(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SmartGroupModificationProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SmartGroupModification(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SmartGroupModificationProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the smartGroup modification item. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.Serialization.cs index 092559479e5e..b05f538ae570 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class SmartGroupModificationItemInfo : IUtf8JsonSerializable + public partial class SmartGroupModificationItemInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ModificationEvent)) { @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SmartGroupModificationItemInfo DeserializeSmartGroupModificationItemInfo(JsonElement element) + internal static SmartGroupModificationItemInfo DeserializeSmartGroupModificationItemInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +88,7 @@ internal static SmartGroupModificationItemInfo DeserializeSmartGroupModification Optional modifiedBy = default; Optional comments = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("modificationEvent"u8)) @@ -112,8 +134,61 @@ internal static SmartGroupModificationItemInfo DeserializeSmartGroupModification description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmartGroupModificationItemInfo(Optional.ToNullable(modificationEvent), oldValue.Value, newValue.Value, Optional.ToNullable(modifiedAt), modifiedBy.Value, comments.Value, description.Value, serializedAdditionalRawData); + } + + SmartGroupModificationItemInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmartGroupModificationItemInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmartGroupModificationItemInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmartGroupModificationItemInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmartGroupModificationItemInfo model) + { + if (model is null) + { + return null; } - return new SmartGroupModificationItemInfo(Optional.ToNullable(modificationEvent), oldValue.Value, newValue.Value, Optional.ToNullable(modifiedAt), modifiedBy.Value, comments.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmartGroupModificationItemInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmartGroupModificationItemInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.cs index 73ac2fb7b21e..6261399fb6fa 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationItemInfo.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AlertsManagement.Models { /// smartGroup modification item. public partial class SmartGroupModificationItemInfo { - /// Initializes a new instance of SmartGroupModificationItemInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SmartGroupModificationItemInfo() { } - /// Initializes a new instance of SmartGroupModificationItemInfo. + /// Initializes a new instance of . /// Reason for the modification. /// Old value. /// New value. @@ -25,7 +29,8 @@ public SmartGroupModificationItemInfo() /// Modified user details (Principal client name). /// Modification comments. /// Description of the modification. - internal SmartGroupModificationItemInfo(SmartGroupModificationEvent? modificationEvent, string oldValue, string newValue, DateTimeOffset? modifiedOn, string modifiedBy, string comments, string description) + /// Keeps track of any properties unknown to the library. + internal SmartGroupModificationItemInfo(SmartGroupModificationEvent? modificationEvent, string oldValue, string newValue, DateTimeOffset? modifiedOn, string modifiedBy, string comments, string description, Dictionary serializedAdditionalRawData) { ModificationEvent = modificationEvent; OldValue = oldValue; @@ -34,6 +39,7 @@ internal SmartGroupModificationItemInfo(SmartGroupModificationEvent? modificatio ModifiedBy = modifiedBy; Comments = comments; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Reason for the modification. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.Serialization.cs index 1a1c654af08f..517ee2f63888 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - public partial class SmartGroupModificationProperties : IUtf8JsonSerializable + public partial class SmartGroupModificationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Modifications)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Modifications) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SmartGroupModificationProperties DeserializeSmartGroupModificationProperties(JsonElement element) + internal static SmartGroupModificationProperties DeserializeSmartGroupModificationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +71,7 @@ internal static SmartGroupModificationProperties DeserializeSmartGroupModificati Optional smartGroupId = default; Optional> modifications = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("smartGroupId"u8)) @@ -74,8 +102,61 @@ internal static SmartGroupModificationProperties DeserializeSmartGroupModificati nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmartGroupModificationProperties(Optional.ToNullable(smartGroupId), Optional.ToList(modifications), nextLink.Value, serializedAdditionalRawData); + } + + SmartGroupModificationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmartGroupModificationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmartGroupModificationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmartGroupModificationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmartGroupModificationProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmartGroupModificationProperties(Response response) + { + if (response is null) + { + return null; } - return new SmartGroupModificationProperties(Optional.ToNullable(smartGroupId), Optional.ToList(modifications), nextLink.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmartGroupModificationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.cs index 3b80618bf1dd..185fe6eb85a3 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupModificationProperties.cs @@ -14,21 +14,26 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// Properties of the smartGroup modification item. public partial class SmartGroupModificationProperties { - /// Initializes a new instance of SmartGroupModificationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SmartGroupModificationProperties() { Modifications = new ChangeTrackingList(); } - /// Initializes a new instance of SmartGroupModificationProperties. + /// Initializes a new instance of . /// Unique Id of the smartGroup for which the history is being retrieved. /// Modification details. /// URL to fetch the next set of results. - internal SmartGroupModificationProperties(Guid? smartGroupId, IList modifications, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SmartGroupModificationProperties(Guid? smartGroupId, IList modifications, string nextLink, Dictionary serializedAdditionalRawData) { SmartGroupId = smartGroupId; Modifications = modifications; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique Id of the smartGroup for which the history is being retrieved. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.Serialization.cs index ad86dea33928..471509505de7 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AlertsManagement; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class SmartGroupsList + internal partial class SmartGroupsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SmartGroupsList DeserializeSmartGroupsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SmartGroupsList DeserializeSmartGroupsList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +93,61 @@ internal static SmartGroupsList DeserializeSmartGroupsList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SmartGroupsList(nextLink.Value, Optional.ToList(value)); + return new SmartGroupsList(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + SmartGroupsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmartGroupsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmartGroupsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmartGroupsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmartGroupsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmartGroupsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmartGroupsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.cs index d0f8a17e1fa5..3e35b05b9340 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SmartGroupsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AlertsManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AlertsManagement.Models /// List the alerts. internal partial class SmartGroupsList { - /// Initializes a new instance of SmartGroupsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SmartGroupsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SmartGroupsList. + /// Initializes a new instance of . /// URL to fetch the next set of alerts. /// List of alerts. - internal SmartGroupsList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal SmartGroupsList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// URL to fetch the next set of alerts. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SubscriptionResourceGetServiceAlertSummaryOptions.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SubscriptionResourceGetServiceAlertSummaryOptions.cs index a59489757282..d92d64c4d351 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SubscriptionResourceGetServiceAlertSummaryOptions.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/SubscriptionResourceGetServiceAlertSummaryOptions.cs @@ -17,6 +17,11 @@ public SubscriptionResourceGetServiceAlertSummaryOptions(AlertsSummaryGroupByFie Groupby = groupby; } + /// Initializes a new instance of for deserialization. + internal SubscriptionResourceGetServiceAlertSummaryOptions() + { + } + /// This parameter allows the result set to be grouped by input fields (Maximum 2 comma separated fields supported). For example, groupby=severity or groupby=severity,alertstate. public AlertsSummaryGroupByField Groupby { get; } /// Include count of the SmartGroups as part of the summary. Default value is 'false'. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.Serialization.cs index ccb74bf7def5..c73272b68ea1 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class UnknownAction : IUtf8JsonSerializable + internal partial class UnknownAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("actionType"u8); writer.WriteStringValue(ActionType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownAction DeserializeUnknownAction(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - AlertProcessingRuleActionType actionType = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("actionType"u8)) + foreach (var property in _serializedAdditionalRawData) { - actionType = new AlertProcessingRuleActionType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownAction(actionType); + writer.WriteEndObject(); + } + + internal static AlertProcessingRuleAction DeserializeUnknownAction(JsonElement element, ModelSerializerOptions options = default) => DeserializeAlertProcessingRuleAction(element, options); + + AlertProcessingRuleAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleAction(doc.RootElement, options); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.cs index 0161424d597d..5bc5115d3143 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAction.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// The UnknownAction. internal partial class UnknownAction : AlertProcessingRuleAction { - /// Initializes a new instance of UnknownAction. + /// Initializes a new instance of . /// Action that should be applied. - internal UnknownAction(AlertProcessingRuleActionType actionType) : base(actionType) + /// Keeps track of any properties unknown to the library. + internal UnknownAction(AlertProcessingRuleActionType actionType, Dictionary serializedAdditionalRawData) : base(actionType, serializedAdditionalRawData) { ActionType = actionType; } + + /// Initializes a new instance of for deserialization. + internal UnknownAction() + { + } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.Serialization.cs index c3c16a0011fe..8c7df642339e 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.Serialization.cs @@ -5,29 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class UnknownAlertsMetaDataProperties + internal partial class UnknownAlertsMetaDataProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnknownAlertsMetaDataProperties DeserializeUnknownAlertsMetaDataProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ServiceAlertMetadataIdentifier metadataIdentifier = "Unknown"; - foreach (var property in element.EnumerateObject()) + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("metadataIdentifier"u8); + writer.WriteStringValue(MetadataIdentifier.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("metadataIdentifier"u8)) + foreach (var property in _serializedAdditionalRawData) { - metadataIdentifier = new ServiceAlertMetadataIdentifier(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownAlertsMetaDataProperties(metadataIdentifier); + writer.WriteEndObject(); + } + + internal static ServiceAlertMetadataProperties DeserializeUnknownAlertsMetaDataProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeServiceAlertMetadataProperties(element, options); + + ServiceAlertMetadataProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownAlertsMetaDataProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAlertMetadataProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAlertMetadataProperties(doc.RootElement, options); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.cs index 58edcb933511..3f222949c82f 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownAlertsMetaDataProperties.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AlertsManagement.Models { /// The UnknownAlertsMetaDataProperties. internal partial class UnknownAlertsMetaDataProperties : ServiceAlertMetadataProperties { - /// Initializes a new instance of UnknownAlertsMetaDataProperties. + /// Initializes a new instance of . /// Identification of the information to be retrieved by API call. - internal UnknownAlertsMetaDataProperties(ServiceAlertMetadataIdentifier metadataIdentifier) : base(metadataIdentifier) + /// Keeps track of any properties unknown to the library. + internal UnknownAlertsMetaDataProperties(ServiceAlertMetadataIdentifier metadataIdentifier, Dictionary serializedAdditionalRawData) : base(metadataIdentifier, serializedAdditionalRawData) { MetadataIdentifier = metadataIdentifier; } + + /// Initializes a new instance of for deserialization. + internal UnknownAlertsMetaDataProperties() + { + } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.Serialization.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.Serialization.cs index 2621a5ad362d..cc135be063cd 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.Serialization.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.Serialization.cs @@ -8,13 +8,18 @@ using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AlertsManagement.Models { - internal partial class UnknownRecurrence : IUtf8JsonSerializable + internal partial class UnknownRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("recurrenceType"u8); writer.WriteStringValue(RecurrenceType.ToString()); @@ -28,45 +33,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endTime"u8); writer.WriteStringValue(EndOn.Value, "T"); } - writer.WriteEndObject(); - } - - internal static UnknownRecurrence DeserializeUnknownRecurrence(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - RecurrenceType recurrenceType = "Unknown"; - Optional startTime = default; - Optional endTime = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("recurrenceType"u8)) - { - recurrenceType = new RecurrenceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("startTime"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - startTime = property.Value.GetTimeSpan("T"); - continue; - } - if (property.NameEquals("endTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endTime = property.Value.GetTimeSpan("T"); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownRecurrence(recurrenceType, Optional.ToNullable(startTime), Optional.ToNullable(endTime)); + writer.WriteEndObject(); + } + + internal static AlertProcessingRuleRecurrence DeserializeUnknownRecurrence(JsonElement element, ModelSerializerOptions options = default) => DeserializeAlertProcessingRuleRecurrence(element, options); + + AlertProcessingRuleRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertProcessingRuleRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertProcessingRuleRecurrence(doc.RootElement, options); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.cs index dcb69f14b038..fc9a16b8c592 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Models/UnknownRecurrence.cs @@ -6,19 +6,26 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AlertsManagement.Models { /// The UnknownRecurrence. internal partial class UnknownRecurrence : AlertProcessingRuleRecurrence { - /// Initializes a new instance of UnknownRecurrence. + /// Initializes a new instance of . /// Specifies when the recurrence should be applied. /// Start time for recurrence. /// End time for recurrence. - internal UnknownRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn) : base(recurrenceType, startOn, endOn) + /// Keeps track of any properties unknown to the library. + internal UnknownRecurrence(RecurrenceType recurrenceType, TimeSpan? startOn, TimeSpan? endOn, Dictionary serializedAdditionalRawData) : base(recurrenceType, startOn, endOn, serializedAdditionalRawData) { RecurrenceType = recurrenceType; } + + /// Initializes a new instance of for deserialization. + internal UnknownRecurrence() + { + } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/RestOperations/AlertProcessingRulesRestOperations.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/RestOperations/AlertProcessingRulesRestOperations.cs index 8e44bed127a6..1680ad11b688 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/RestOperations/AlertProcessingRulesRestOperations.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/RestOperations/AlertProcessingRulesRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -434,9 +432,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs index 0e88f85e3802..7f1c06857c56 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertCollection.cs @@ -143,7 +143,7 @@ public virtual AsyncPageable GetAllAsync(ServiceAlertColle HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceAlertAlertsRestClient.CreateGetAllRequest(Id.SubscriptionId, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.SmartGroupId, options.IncludeContext, options.IncludeEgressConfig, options.PageCount, options.SortBy, options.SortOrder, options.Select, options.TimeRange, options.CustomTimeRange); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceAlertAlertsRestClient.CreateGetAllNextPageRequest(nextLink, Id.SubscriptionId, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.SmartGroupId, options.IncludeContext, options.IncludeEgressConfig, options.PageCount, options.SortBy, options.SortOrder, options.Select, options.TimeRange, options.CustomTimeRange); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceAlertResource(Client, ServiceAlertData.DeserializeServiceAlertData(e)), _serviceAlertAlertsClientDiagnostics, Pipeline, "ServiceAlertCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ServiceAlertResource(Client, ServiceAlertData.DeserializeServiceAlertData(e)), _serviceAlertAlertsClientDiagnostics, Pipeline, "ServiceAlertCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(ServiceAlertCollectionGetAl HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceAlertAlertsRestClient.CreateGetAllRequest(Id.SubscriptionId, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.SmartGroupId, options.IncludeContext, options.IncludeEgressConfig, options.PageCount, options.SortBy, options.SortOrder, options.Select, options.TimeRange, options.CustomTimeRange); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceAlertAlertsRestClient.CreateGetAllNextPageRequest(nextLink, Id.SubscriptionId, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.SmartGroupId, options.IncludeContext, options.IncludeEgressConfig, options.PageCount, options.SortBy, options.SortOrder, options.Select, options.TimeRange, options.CustomTimeRange); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceAlertResource(Client, ServiceAlertData.DeserializeServiceAlertData(e)), _serviceAlertAlertsClientDiagnostics, Pipeline, "ServiceAlertCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ServiceAlertResource(Client, ServiceAlertData.DeserializeServiceAlertData(e)), _serviceAlertAlertsClientDiagnostics, Pipeline, "ServiceAlertCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertData.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertData.cs index 98b86949e985..cd19a26fc43d 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertData.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AlertsManagement.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AlertsManagement /// public partial class ServiceAlertData : ResourceData { - /// Initializes a new instance of ServiceAlertData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAlertData() { } - /// Initializes a new instance of ServiceAlertData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Alert property bag. - internal ServiceAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceAlertProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ServiceAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceAlertProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Alert property bag. diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs index 7ee42b61672e..b922ac0457fe 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupCollection.cs @@ -143,7 +143,7 @@ public virtual AsyncPageable GetAllAsync(SmartGroupCollectio HttpMessage FirstPageRequest(int? pageSizeHint) => _smartGroupRestClient.CreateGetAllRequest(Id.SubscriptionId, options.TargetResource, options.TargetResourceGroup, options.TargetResourceType, options.MonitorService, options.MonitorCondition, options.Severity, options.SmartGroupState, options.TimeRange, options.PageCount, options.SortBy, options.SortOrder); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _smartGroupRestClient.CreateGetAllNextPageRequest(nextLink, Id.SubscriptionId, options.TargetResource, options.TargetResourceGroup, options.TargetResourceType, options.MonitorService, options.MonitorCondition, options.Severity, options.SmartGroupState, options.TimeRange, options.PageCount, options.SortBy, options.SortOrder); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SmartGroupResource(Client, SmartGroupData.DeserializeSmartGroupData(e)), _smartGroupClientDiagnostics, Pipeline, "SmartGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SmartGroupResource(Client, SmartGroupData.DeserializeSmartGroupData(e)), _smartGroupClientDiagnostics, Pipeline, "SmartGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(SmartGroupCollectionGetAllOpt HttpMessage FirstPageRequest(int? pageSizeHint) => _smartGroupRestClient.CreateGetAllRequest(Id.SubscriptionId, options.TargetResource, options.TargetResourceGroup, options.TargetResourceType, options.MonitorService, options.MonitorCondition, options.Severity, options.SmartGroupState, options.TimeRange, options.PageCount, options.SortBy, options.SortOrder); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _smartGroupRestClient.CreateGetAllNextPageRequest(nextLink, Id.SubscriptionId, options.TargetResource, options.TargetResourceGroup, options.TargetResourceType, options.MonitorService, options.MonitorCondition, options.Severity, options.SmartGroupState, options.TimeRange, options.PageCount, options.SortBy, options.SortOrder); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SmartGroupResource(Client, SmartGroupData.DeserializeSmartGroupData(e)), _smartGroupClientDiagnostics, Pipeline, "SmartGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SmartGroupResource(Client, SmartGroupData.DeserializeSmartGroupData(e)), _smartGroupClientDiagnostics, Pipeline, "SmartGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupData.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupData.cs index 98ad58452aae..525421007ea3 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupData.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.AlertsManagement /// public partial class SmartGroupData : ResourceData { - /// Initializes a new instance of SmartGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SmartGroupData() { Resources = new ChangeTrackingList(); @@ -31,7 +34,7 @@ public SmartGroupData() AlertSeverities = new ChangeTrackingList(); } - /// Initializes a new instance of SmartGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,7 +53,8 @@ public SmartGroupData() /// Summary of alertStates in the smart group. /// Summary of alertSeverities in the smart group. /// The URI to fetch the next page of alerts. Call ListNext() with this URI to fetch the next page alerts. - internal SmartGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, long? alertsCount, SmartGroupState? smartGroupState, ServiceAlertSeverity? severity, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, string lastModifiedBy, IList resources, IList resourceTypes, IList resourceGroups, IList monitorServices, IList monitorConditions, IList alertStates, IList alertSeverities, string nextLink) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SmartGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, long? alertsCount, SmartGroupState? smartGroupState, ServiceAlertSeverity? severity, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, string lastModifiedBy, IList resources, IList resourceTypes, IList resourceGroups, IList monitorServices, IList monitorConditions, IList alertStates, IList alertSeverities, string nextLink, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { AlertsCount = alertsCount; SmartGroupState = smartGroupState; @@ -66,6 +70,7 @@ internal SmartGroupData(ResourceIdentifier id, string name, ResourceType resourc AlertStates = alertStates; AlertSeverities = alertSeverities; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Total number of alerts in smart group. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs index cbd4bca2c2c8..ad5ab4516fc7 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string serverName, Cancellat public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _analysisServerServersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), _analysisServerServersClientDiagnostics, Pipeline, "AnalysisServerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), _analysisServerServersClientDiagnostics, Pipeline, "AnalysisServerCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _analysisServerServersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), _analysisServerServersClientDiagnostics, Pipeline, "AnalysisServerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), _analysisServerServersClientDiagnostics, Pipeline, "AnalysisServerCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerData.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerData.cs index 45d0bc75cd7c..dc8fe8111149 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerData.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Analysis /// public partial class AnalysisServerData : TrackedResourceData { - /// Initializes a new instance of AnalysisServerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The SKU of the Analysis Services resource. /// is null. @@ -30,7 +33,7 @@ public AnalysisServerData(AzureLocation location, AnalysisResourceSku analysisSk AnalysisSku = analysisSku; } - /// Initializes a new instance of AnalysisServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public AnalysisServerData(AzureLocation location, AnalysisResourceSku analysisSk /// The full name of the Analysis Services resource. /// The SKU of the Analysis Services resource. /// The SKU of the Analysis Services resource. - internal AnalysisServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ServerAdministrators asAdministrators, Uri backupBlobContainerUri, AnalysisGatewayDetails gatewayDetails, AnalysisIPv4FirewallSettings iPv4FirewallSettings, AnalysisConnectionMode? queryPoolConnectionMode, AnalysisManagedMode? managedMode, ServerMonitorMode? serverMonitorMode, AnalysisState? state, AnalysisProvisioningState? provisioningState, string serverFullName, AnalysisResourceSku analysisServerSku, AnalysisResourceSku analysisSku) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AnalysisServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ServerAdministrators asAdministrators, Uri backupBlobContainerUri, AnalysisGatewayDetails gatewayDetails, AnalysisIPv4FirewallSettings iPv4FirewallSettings, AnalysisConnectionMode? queryPoolConnectionMode, AnalysisManagedMode? managedMode, ServerMonitorMode? serverMonitorMode, AnalysisState? state, AnalysisProvisioningState? provisioningState, string serverFullName, AnalysisResourceSku analysisServerSku, AnalysisResourceSku analysisSku, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { AsAdministrators = asAdministrators; BackupBlobContainerUri = backupBlobContainerUri; @@ -63,6 +67,12 @@ internal AnalysisServerData(ResourceIdentifier id, string name, ResourceType res ServerFullName = serverFullName; AnalysisServerSku = analysisServerSku; AnalysisSku = analysisSku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalysisServerData() + { } /// A collection of AS server administrators. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/ArmAnalysisModelFactory.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/ArmAnalysisModelFactory.cs index cc07d9c9e3ee..f77da23fd747 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/ArmAnalysisModelFactory.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/ArmAnalysisModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Analysis.Models /// Model factory for models. public static partial class ArmAnalysisModelFactory { - /// Initializes a new instance of AnalysisServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,44 +42,44 @@ public static AnalysisServerData AnalysisServerData(ResourceIdentifier id = null tags ??= new Dictionary(); asAdministratorIdentities ??= new List(); - return new AnalysisServerData(id, name, resourceType, systemData, tags, location, asAdministratorIdentities != null ? new ServerAdministrators(asAdministratorIdentities?.ToList()) : null, backupBlobContainerUri, gatewayDetails, iPv4FirewallSettings, queryPoolConnectionMode, managedMode, serverMonitorMode, state, provisioningState, serverFullName, analysisServerSku, analysisSku); + return new AnalysisServerData(id, name, resourceType, systemData, tags, location, asAdministratorIdentities != null ? new ServerAdministrators(asAdministratorIdentities?.ToList(), new Dictionary()) : null, backupBlobContainerUri, gatewayDetails, iPv4FirewallSettings, queryPoolConnectionMode, managedMode, serverMonitorMode, state, provisioningState, serverFullName, analysisServerSku, analysisSku, default); } - /// Initializes a new instance of AnalysisGatewayDetails. + /// Initializes a new instance of . /// Gateway resource to be associated with the server. /// Gateway object id from in the DMTS cluster for the gateway resource. /// Uri of the DMTS cluster. /// A new instance for mocking. public static AnalysisGatewayDetails AnalysisGatewayDetails(string gatewayResourceId = null, string gatewayObjectId = null, Uri dmtsClusterUri = null) { - return new AnalysisGatewayDetails(gatewayResourceId, gatewayObjectId, dmtsClusterUri); + return new AnalysisGatewayDetails(gatewayResourceId, gatewayObjectId, dmtsClusterUri, default); } - /// Initializes a new instance of AnalysisExistingSku. + /// Initializes a new instance of . /// The SKU in SKU details for existing resources. /// The resource type. /// A new instance for mocking. public static AnalysisExistingSku AnalysisExistingSku(AnalysisResourceSku sku = null, ResourceType? resourceType = null) { - return new AnalysisExistingSku(sku, resourceType); + return new AnalysisExistingSku(sku, resourceType, default); } - /// Initializes a new instance of AnalysisGatewayStatus. + /// Initializes a new instance of . /// Live message of list gateway. Status: 0 - Live. /// A new instance for mocking. public static AnalysisGatewayStatus AnalysisGatewayStatus(AnalysisStatus? status = null) { - return new AnalysisGatewayStatus(status); + return new AnalysisGatewayStatus(status, default); } - /// Initializes a new instance of AnalysisServerNameAvailabilityResult. + /// Initializes a new instance of . /// Indicator of available of the server name. /// The reason of unavailability. /// The detailed message of the request unavailability. /// A new instance for mocking. public static AnalysisServerNameAvailabilityResult AnalysisServerNameAvailabilityResult(bool? isNameAvailable = null, string reason = null, string message = null) { - return new AnalysisServerNameAvailabilityResult(isNameAvailable, reason, message); + return new AnalysisServerNameAvailabilityResult(isNameAvailable, reason, message, default); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 26ad12d2073c..c806e619b735 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -62,7 +62,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) public virtual AsyncPageable GetAnalysisServersAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAnalysisServers", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAnalysisServers", "value", null, cancellationToken); } /// @@ -83,7 +83,7 @@ public virtual AsyncPageable GetAnalysisServersAsync(Can public virtual Pageable GetAnalysisServers(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAnalysisServers", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAnalysisServers", "value", null, cancellationToken); } /// diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.Serialization.cs index 1ff61f4cb4e5..ba821f8d9d7c 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisExistingSku + public partial class AnalysisExistingSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnalysisExistingSku DeserializeAnalysisExistingSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnalysisExistingSku DeserializeAnalysisExistingSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sku = default; Optional resourceType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -40,8 +86,61 @@ internal static AnalysisExistingSku DeserializeAnalysisExistingSku(JsonElement e resourceType = new ResourceType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnalysisExistingSku(sku.Value, Optional.ToNullable(resourceType)); + return new AnalysisExistingSku(sku.Value, Optional.ToNullable(resourceType), serializedAdditionalRawData); + } + + AnalysisExistingSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisExistingSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisExistingSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisExistingSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisExistingSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisExistingSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisExistingSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.cs index 6a64089eab7b..70380fdaa4f9 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisExistingSku.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Analysis.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Analysis.Models /// An object that represents SKU details for existing resources. public partial class AnalysisExistingSku { - /// Initializes a new instance of AnalysisExistingSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnalysisExistingSku() { } - /// Initializes a new instance of AnalysisExistingSku. + /// Initializes a new instance of . /// The SKU in SKU details for existing resources. /// The resource type. - internal AnalysisExistingSku(AnalysisResourceSku sku, ResourceType? resourceType) + /// Keeps track of any properties unknown to the library. + internal AnalysisExistingSku(AnalysisResourceSku sku, ResourceType? resourceType, Dictionary serializedAdditionalRawData) { Sku = sku; ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The SKU in SKU details for existing resources. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.Serialization.cs index e14bc90a9723..d1b21f6b1bf5 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.Serialization.cs @@ -6,26 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisGatewayDetails : IUtf8JsonSerializable + public partial class AnalysisGatewayDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GatewayResourceId)) { writer.WritePropertyName("gatewayResourceId"u8); writer.WriteStringValue(GatewayResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AnalysisGatewayDetails DeserializeAnalysisGatewayDetails(JsonElement element) + internal static AnalysisGatewayDetails DeserializeAnalysisGatewayDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +54,7 @@ internal static AnalysisGatewayDetails DeserializeAnalysisGatewayDetails(JsonEle Optional gatewayResourceId = default; Optional gatewayObjectId = default; Optional dmtsClusterUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gatewayResourceId"u8)) @@ -54,8 +76,61 @@ internal static AnalysisGatewayDetails DeserializeAnalysisGatewayDetails(JsonEle dmtsClusterUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisGatewayDetails(gatewayResourceId.Value, gatewayObjectId.Value, dmtsClusterUri.Value, serializedAdditionalRawData); + } + + AnalysisGatewayDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisGatewayDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisGatewayDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisGatewayDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisGatewayDetails model) + { + if (model is null) + { + return null; } - return new AnalysisGatewayDetails(gatewayResourceId.Value, gatewayObjectId.Value, dmtsClusterUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisGatewayDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisGatewayDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.cs index df9e43453ce1..b7d4dcc02fda 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayDetails.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Analysis.Models { /// The gateway details. public partial class AnalysisGatewayDetails { - /// Initializes a new instance of AnalysisGatewayDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnalysisGatewayDetails() { } - /// Initializes a new instance of AnalysisGatewayDetails. + /// Initializes a new instance of . /// Gateway resource to be associated with the server. /// Gateway object id from in the DMTS cluster for the gateway resource. /// Uri of the DMTS cluster. - internal AnalysisGatewayDetails(string gatewayResourceId, string gatewayObjectId, Uri dmtsClusterUri) + /// Keeps track of any properties unknown to the library. + internal AnalysisGatewayDetails(string gatewayResourceId, string gatewayObjectId, Uri dmtsClusterUri, Dictionary serializedAdditionalRawData) { GatewayResourceId = gatewayResourceId; GatewayObjectId = gatewayObjectId; DmtsClusterUri = dmtsClusterUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gateway resource to be associated with the server. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.Serialization.cs index 980bfc32410e..992c21c18322 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisGatewayStatus + public partial class AnalysisGatewayStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnalysisGatewayStatus DeserializeAnalysisGatewayStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteNumberValue(Status.Value.ToSerialInt32()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnalysisGatewayStatus DeserializeAnalysisGatewayStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -30,8 +64,61 @@ internal static AnalysisGatewayStatus DeserializeAnalysisGatewayStatus(JsonEleme status = new AnalysisStatus(property.Value.GetInt32()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnalysisGatewayStatus(Optional.ToNullable(status)); + return new AnalysisGatewayStatus(Optional.ToNullable(status), serializedAdditionalRawData); + } + + AnalysisGatewayStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisGatewayStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisGatewayStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisGatewayStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisGatewayStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisGatewayStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisGatewayStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.cs index ffbaa206863c..638ef6392712 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisGatewayStatus.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Analysis.Models { /// Status of gateway is live. public partial class AnalysisGatewayStatus { - /// Initializes a new instance of AnalysisGatewayStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnalysisGatewayStatus() { } - /// Initializes a new instance of AnalysisGatewayStatus. + /// Initializes a new instance of . /// Live message of list gateway. Status: 0 - Live. - internal AnalysisGatewayStatus(AnalysisStatus? status) + /// Keeps track of any properties unknown to the library. + internal AnalysisGatewayStatus(AnalysisStatus? status, Dictionary serializedAdditionalRawData) { Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Live message of list gateway. Status: 0 - Live. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.Serialization.cs index ce1c4e054304..29d566701279 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisIPv4FirewallRule : IUtf8JsonSerializable + public partial class AnalysisIPv4FirewallRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FirewallRuleName)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("rangeEnd"u8); writer.WriteStringValue(RangeEnd); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AnalysisIPv4FirewallRule DeserializeAnalysisIPv4FirewallRule(JsonElement element) + internal static AnalysisIPv4FirewallRule DeserializeAnalysisIPv4FirewallRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AnalysisIPv4FirewallRule DeserializeAnalysisIPv4FirewallRule(Jso Optional firewallRuleName = default; Optional rangeStart = default; Optional rangeEnd = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("firewallRuleName"u8)) @@ -59,8 +82,61 @@ internal static AnalysisIPv4FirewallRule DeserializeAnalysisIPv4FirewallRule(Jso rangeEnd = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisIPv4FirewallRule(firewallRuleName.Value, rangeStart.Value, rangeEnd.Value, serializedAdditionalRawData); + } + + AnalysisIPv4FirewallRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisIPv4FirewallRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisIPv4FirewallRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisIPv4FirewallRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisIPv4FirewallRule model) + { + if (model is null) + { + return null; } - return new AnalysisIPv4FirewallRule(firewallRuleName.Value, rangeStart.Value, rangeEnd.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisIPv4FirewallRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisIPv4FirewallRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.cs index 970d02cf42a6..ff8dc27521db 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallRule.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Analysis.Models { /// The detail of firewall rule. public partial class AnalysisIPv4FirewallRule { - /// Initializes a new instance of AnalysisIPv4FirewallRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnalysisIPv4FirewallRule() { } - /// Initializes a new instance of AnalysisIPv4FirewallRule. + /// Initializes a new instance of . /// The rule name. /// The start range of IPv4. /// The end range of IPv4. - internal AnalysisIPv4FirewallRule(string firewallRuleName, string rangeStart, string rangeEnd) + /// Keeps track of any properties unknown to the library. + internal AnalysisIPv4FirewallRule(string firewallRuleName, string rangeStart, string rangeEnd, Dictionary serializedAdditionalRawData) { FirewallRuleName = firewallRuleName; RangeStart = rangeStart; RangeEnd = rangeEnd; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The rule name. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.Serialization.cs index 8dc23cbf5d7b..57d97153235d 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisIPv4FirewallSettings : IUtf8JsonSerializable + public partial class AnalysisIPv4FirewallSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(FirewallRules)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FirewallRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -31,17 +45,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enablePowerBIService"u8); writer.WriteBooleanValue(IsPowerBIServiceEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AnalysisIPv4FirewallSettings DeserializeAnalysisIPv4FirewallSettings(JsonElement element) + internal static AnalysisIPv4FirewallSettings DeserializeAnalysisIPv4FirewallSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> firewallRules = default; Optional enablePowerBIService = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("firewallRules"u8)) @@ -67,8 +96,61 @@ internal static AnalysisIPv4FirewallSettings DeserializeAnalysisIPv4FirewallSett enablePowerBIService = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisIPv4FirewallSettings(Optional.ToList(firewallRules), Optional.ToNullable(enablePowerBIService), serializedAdditionalRawData); + } + + AnalysisIPv4FirewallSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisIPv4FirewallSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisIPv4FirewallSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisIPv4FirewallSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisIPv4FirewallSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisIPv4FirewallSettings(Response response) + { + if (response is null) + { + return null; } - return new AnalysisIPv4FirewallSettings(Optional.ToList(firewallRules), Optional.ToNullable(enablePowerBIService)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisIPv4FirewallSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.cs index cff78ef65d78..6ed8177bf17a 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisIPv4FirewallSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Analysis.Models /// An array of firewall rules. public partial class AnalysisIPv4FirewallSettings { - /// Initializes a new instance of AnalysisIPv4FirewallSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnalysisIPv4FirewallSettings() { FirewallRules = new ChangeTrackingList(); } - /// Initializes a new instance of AnalysisIPv4FirewallSettings. + /// Initializes a new instance of . /// An array of firewall rules. /// The indicator of enabling PBI service. - internal AnalysisIPv4FirewallSettings(IList firewallRules, bool? isPowerBIServiceEnabled) + /// Keeps track of any properties unknown to the library. + internal AnalysisIPv4FirewallSettings(IList firewallRules, bool? isPowerBIServiceEnabled, Dictionary serializedAdditionalRawData) { FirewallRules = firewallRules; IsPowerBIServiceEnabled = isPowerBIServiceEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of firewall rules. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.Serialization.cs index 14e8980a55e9..72bf4838b690 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisResourceSku : IUtf8JsonSerializable + public partial class AnalysisResourceSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AnalysisResourceSku DeserializeAnalysisResourceSku(JsonElement element) + internal static AnalysisResourceSku DeserializeAnalysisResourceSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static AnalysisResourceSku DeserializeAnalysisResourceSku(JsonElement e string name = default; Optional tier = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -64,8 +87,61 @@ internal static AnalysisResourceSku DeserializeAnalysisResourceSku(JsonElement e capacity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisResourceSku(name, Optional.ToNullable(tier), Optional.ToNullable(capacity), serializedAdditionalRawData); + } + + AnalysisResourceSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisResourceSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisResourceSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisResourceSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisResourceSku model) + { + if (model is null) + { + return null; } - return new AnalysisResourceSku(name, Optional.ToNullable(tier), Optional.ToNullable(capacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisResourceSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisResourceSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.cs index a64f93bbbde9..1bb5076050bd 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisResourceSku.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Analysis.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Analysis.Models /// Represents the SKU name and Azure pricing tier for Analysis Services resource. public partial class AnalysisResourceSku { - /// Initializes a new instance of AnalysisResourceSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the SKU level. /// is null. public AnalysisResourceSku(string name) @@ -23,15 +27,22 @@ public AnalysisResourceSku(string name) Name = name; } - /// Initializes a new instance of AnalysisResourceSku. + /// Initializes a new instance of . /// Name of the SKU level. /// The name of the Azure pricing tier to which the SKU applies. /// The number of instances in the read only query pool. - internal AnalysisResourceSku(string name, AnalysisSkuTier? tier, int? capacity) + /// Keeps track of any properties unknown to the library. + internal AnalysisResourceSku(string name, AnalysisSkuTier? tier, int? capacity, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalysisResourceSku() + { } /// Name of the SKU level. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerData.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerData.Serialization.cs index 93482762ac8c..0ef55d0d31ae 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerData.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerData.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Analysis.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Analysis { - public partial class AnalysisServerData : IUtf8JsonSerializable + public partial class AnalysisServerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(AnalysisSku); + if (AnalysisSku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnalysisSku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -39,7 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AsAdministrators)) { writer.WritePropertyName("asAdministrators"u8); - writer.WriteObjectValue(AsAdministrators); + if (AsAdministrators is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AsAdministrators).Serialize(writer, options); + } } if (Optional.IsDefined(BackupBlobContainerUri)) { @@ -49,12 +69,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GatewayDetails)) { writer.WritePropertyName("gatewayDetails"u8); - writer.WriteObjectValue(GatewayDetails); + if (GatewayDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GatewayDetails).Serialize(writer, options); + } } if (Optional.IsDefined(IPv4FirewallSettings)) { writer.WritePropertyName("ipV4FirewallSettings"u8); - writer.WriteObjectValue(IPv4FirewallSettings); + if (IPv4FirewallSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IPv4FirewallSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryPoolConnectionMode)) { @@ -74,14 +108,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AnalysisServerSku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(AnalysisServerSku); + if (AnalysisServerSku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnalysisServerSku).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AnalysisServerData DeserializeAnalysisServerData(JsonElement element) + internal static AnalysisServerData DeserializeAnalysisServerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -104,6 +159,7 @@ internal static AnalysisServerData DeserializeAnalysisServerData(JsonElement ele Optional provisioningState = default; Optional serverFullName = default; Optional sku0 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -261,8 +317,61 @@ internal static AnalysisServerData DeserializeAnalysisServerData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisServerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, asAdministrators.Value, backupBlobContainerUri.Value, gatewayDetails.Value, ipV4FirewallSettings.Value, Optional.ToNullable(querypoolConnectionMode), Optional.ToNullable(managedMode), Optional.ToNullable(serverMonitorMode), Optional.ToNullable(state), Optional.ToNullable(provisioningState), serverFullName.Value, sku0.Value, sku, serializedAdditionalRawData); + } + + AnalysisServerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisServerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisServerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisServerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisServerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisServerData(Response response) + { + if (response is null) + { + return null; } - return new AnalysisServerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, asAdministrators.Value, backupBlobContainerUri.Value, gatewayDetails.Value, ipV4FirewallSettings.Value, Optional.ToNullable(querypoolConnectionMode), Optional.ToNullable(managedMode), Optional.ToNullable(serverMonitorMode), Optional.ToNullable(state), Optional.ToNullable(provisioningState), serverFullName.Value, sku0.Value, sku); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisServerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.Serialization.cs index 95abedebde55..808a7de07720 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisServerNameAvailabilityContent : IUtf8JsonSerializable + public partial class AnalysisServerNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AnalysisServerNameAvailabilityContent DeserializeAnalysisServerNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisServerNameAvailabilityContent(name.Value, type.Value, serializedAdditionalRawData); + } + + AnalysisServerNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisServerNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisServerNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisServerNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisServerNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisServerNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisServerNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.cs index 62a4205530c6..ce5b81cccd63 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Analysis.Models { /// Details of server name request body. public partial class AnalysisServerNameAvailabilityContent { - /// Initializes a new instance of AnalysisServerNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnalysisServerNameAvailabilityContent() { } + /// Initializes a new instance of . + /// Name for checking availability. + /// The resource type of azure analysis services. + /// Keeps track of any properties unknown to the library. + internal AnalysisServerNameAvailabilityContent(string name, string resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Name for checking availability. public string Name { get; set; } /// The resource type of azure analysis services. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.Serialization.cs index 378bade2795a..3eee0956b989 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisServerNameAvailabilityResult + public partial class AnalysisServerNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnalysisServerNameAvailabilityResult DeserializeAnalysisServerNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnalysisServerNameAvailabilityResult DeserializeAnalysisServerNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static AnalysisServerNameAvailabilityResult DeserializeAnalysisServerNa Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -42,8 +86,61 @@ internal static AnalysisServerNameAvailabilityResult DeserializeAnalysisServerNa message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnalysisServerNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value); + return new AnalysisServerNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value, serializedAdditionalRawData); + } + + AnalysisServerNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisServerNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisServerNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisServerNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisServerNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisServerNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisServerNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.cs index bf7564837a28..d4b1fc475b8c 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Analysis.Models { /// The checking result of server name availability. public partial class AnalysisServerNameAvailabilityResult { - /// Initializes a new instance of AnalysisServerNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnalysisServerNameAvailabilityResult() { } - /// Initializes a new instance of AnalysisServerNameAvailabilityResult. + /// Initializes a new instance of . /// Indicator of available of the server name. /// The reason of unavailability. /// The detailed message of the request unavailability. - internal AnalysisServerNameAvailabilityResult(bool? isNameAvailable, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal AnalysisServerNameAvailabilityResult(bool? isNameAvailable, string reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicator of available of the server name. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.Serialization.cs index 872e263749f8..4864cbf0a94f 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - public partial class AnalysisServerPatch : IUtf8JsonSerializable + public partial class AnalysisServerPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AsAdministrators)) { writer.WritePropertyName("asAdministrators"u8); - writer.WriteObjectValue(AsAdministrators); + if (AsAdministrators is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AsAdministrators).Serialize(writer, options); + } } if (Optional.IsDefined(BackupBlobContainerUri)) { @@ -46,12 +68,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GatewayDetails)) { writer.WritePropertyName("gatewayDetails"u8); - writer.WriteObjectValue(GatewayDetails); + if (GatewayDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GatewayDetails).Serialize(writer, options); + } } if (Optional.IsDefined(IPV4FirewallSettings)) { writer.WritePropertyName("ipV4FirewallSettings"u8); - writer.WriteObjectValue(IPV4FirewallSettings); + if (IPV4FirewallSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IPV4FirewallSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QuerypoolConnectionMode)) { @@ -69,7 +105,194 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(ServerMonitorMode.Value.ToSerialInt32()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AnalysisServerPatch DeserializeAnalysisServerPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional> tags = default; + Optional asAdministrators = default; + Optional backupBlobContainerUri = default; + Optional gatewayDetails = default; + Optional ipV4FirewallSettings = default; + Optional querypoolConnectionMode = default; + Optional managedMode = default; + Optional serverMonitorMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AnalysisResourceSku.DeserializeAnalysisResourceSku(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("asAdministrators"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + asAdministrators = ServerAdministrators.DeserializeServerAdministrators(property0.Value); + continue; + } + if (property0.NameEquals("backupBlobContainerUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupBlobContainerUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("gatewayDetails"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gatewayDetails = AnalysisGatewayDetails.DeserializeAnalysisGatewayDetails(property0.Value); + continue; + } + if (property0.NameEquals("ipV4FirewallSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipV4FirewallSettings = AnalysisIPv4FirewallSettings.DeserializeAnalysisIPv4FirewallSettings(property0.Value); + continue; + } + if (property0.NameEquals("querypoolConnectionMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + querypoolConnectionMode = property0.Value.GetString().ToAnalysisConnectionMode(); + continue; + } + if (property0.NameEquals("managedMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedMode = new AnalysisManagedMode(property0.Value.GetInt32()); + continue; + } + if (property0.NameEquals("serverMonitorMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serverMonitorMode = new ServerMonitorMode(property0.Value.GetInt32()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalysisServerPatch(sku.Value, Optional.ToDictionary(tags), asAdministrators.Value, backupBlobContainerUri.Value, gatewayDetails.Value, ipV4FirewallSettings.Value, Optional.ToNullable(querypoolConnectionMode), Optional.ToNullable(managedMode), Optional.ToNullable(serverMonitorMode), serializedAdditionalRawData); + } + + AnalysisServerPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisServerPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisServerPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisServerPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisServerPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisServerPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisServerPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.cs index ccf214961ab7..d6110e222810 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServerPatch.cs @@ -14,12 +14,40 @@ namespace Azure.ResourceManager.Analysis.Models /// Provision request specification. public partial class AnalysisServerPatch { - /// Initializes a new instance of AnalysisServerPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnalysisServerPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The SKU of the Analysis Services resource. + /// Key-value pairs of additional provisioning properties. + /// A collection of AS server administrators. + /// The SAS container URI to the backup container. + /// The gateway details configured for the AS server. + /// The firewall settings for the AS server. + /// How the read-write server's participation in the query pool is controlled.<br/>It can have the following values: <ul><li>readOnly - indicates that the read-write server is intended not to participate in query operations</li><li>all - indicates that the read-write server can participate in query operations</li></ul>Specifying readOnly when capacity is 1 results in error. + /// The managed mode of the server (0 = not managed, 1 = managed). + /// The server monitor mode for AS server. + /// Keeps track of any properties unknown to the library. + internal AnalysisServerPatch(AnalysisResourceSku sku, IDictionary tags, ServerAdministrators asAdministrators, Uri backupBlobContainerUri, AnalysisGatewayDetails gatewayDetails, AnalysisIPv4FirewallSettings ipV4FirewallSettings, AnalysisConnectionMode? querypoolConnectionMode, AnalysisManagedMode? managedMode, ServerMonitorMode? serverMonitorMode, Dictionary serializedAdditionalRawData) + { + Sku = sku; + Tags = tags; + AsAdministrators = asAdministrators; + BackupBlobContainerUri = backupBlobContainerUri; + GatewayDetails = gatewayDetails; + IPV4FirewallSettings = ipV4FirewallSettings; + QuerypoolConnectionMode = querypoolConnectionMode; + ManagedMode = managedMode; + ServerMonitorMode = serverMonitorMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The SKU of the Analysis Services resource. public AnalysisResourceSku Sku { get; set; } /// Key-value pairs of additional provisioning properties. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.Serialization.cs index 02fafbb5ab23..033f907a42c4 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Analysis; namespace Azure.ResourceManager.Analysis.Models { - internal partial class AnalysisServers + internal partial class AnalysisServers : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnalysisServers DeserializeAnalysisServers(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in AnalysisResources) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnalysisServers DeserializeAnalysisServers(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -33,8 +75,61 @@ internal static AnalysisServers DeserializeAnalysisServers(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnalysisServers(value); + return new AnalysisServers(value, serializedAdditionalRawData); + } + + AnalysisServers IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisServers(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalysisServers IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalysisServers(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalysisServers model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalysisServers(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalysisServers(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.cs index b17c2b5432e5..a75247779c15 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/AnalysisServers.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Analysis.Models /// An array of Analysis Services resources. internal partial class AnalysisServers { - /// Initializes a new instance of AnalysisServers. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// An array of Analysis Services resources. /// is null. internal AnalysisServers(IEnumerable analysisResources) @@ -26,11 +29,18 @@ internal AnalysisServers(IEnumerable analysisResources) AnalysisResources = analysisResources.ToList(); } - /// Initializes a new instance of AnalysisServers. + /// Initializes a new instance of . /// An array of Analysis Services resources. - internal AnalysisServers(IReadOnlyList analysisResources) + /// Keeps track of any properties unknown to the library. + internal AnalysisServers(IReadOnlyList analysisResources, Dictionary serializedAdditionalRawData) { AnalysisResources = analysisResources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalysisServers() + { } /// An array of Analysis Services resources. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.Serialization.cs index 9c9f8e2353ec..749a88c47af5 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - internal partial class ExistingResourceResultSkuEnumeration + internal partial class ExistingResourceResultSkuEnumeration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExistingResourceResultSkuEnumeration DeserializeExistingResourceResultSkuEnumeration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExistingResourceResultSkuEnumeration DeserializeExistingResourceResultSkuEnumeration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static ExistingResourceResultSkuEnumeration DeserializeExistingResource value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExistingResourceResultSkuEnumeration(Optional.ToList(value)); + return new ExistingResourceResultSkuEnumeration(Optional.ToList(value), serializedAdditionalRawData); + } + + ExistingResourceResultSkuEnumeration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExistingResourceResultSkuEnumeration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExistingResourceResultSkuEnumeration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExistingResourceResultSkuEnumeration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExistingResourceResultSkuEnumeration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExistingResourceResultSkuEnumeration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExistingResourceResultSkuEnumeration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.cs index 74469a3a957b..ccd526c80f15 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ExistingResourceResultSkuEnumeration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Analysis.Models /// An object that represents enumerating SKUs for existing resources. internal partial class ExistingResourceResultSkuEnumeration { - /// Initializes a new instance of ExistingResourceResultSkuEnumeration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExistingResourceResultSkuEnumeration() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExistingResourceResultSkuEnumeration. + /// Initializes a new instance of . /// The collection of available SKUs for existing resources. - internal ExistingResourceResultSkuEnumeration(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ExistingResourceResultSkuEnumeration(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of available SKUs for existing resources. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.Serialization.cs index e0f1c9f48dd8..1f1ab7916301 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - internal partial class NewResourceResultSkuEnumeration + internal partial class NewResourceResultSkuEnumeration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NewResourceResultSkuEnumeration DeserializeNewResourceResultSkuEnumeration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NewResourceResultSkuEnumeration DeserializeNewResourceResultSkuEnumeration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static NewResourceResultSkuEnumeration DeserializeNewResourceResultSkuE value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NewResourceResultSkuEnumeration(Optional.ToList(value)); + return new NewResourceResultSkuEnumeration(Optional.ToList(value), serializedAdditionalRawData); + } + + NewResourceResultSkuEnumeration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNewResourceResultSkuEnumeration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NewResourceResultSkuEnumeration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNewResourceResultSkuEnumeration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NewResourceResultSkuEnumeration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NewResourceResultSkuEnumeration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNewResourceResultSkuEnumeration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.cs index a4d9b4147d77..cfe69cc0420a 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/NewResourceResultSkuEnumeration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Analysis.Models /// An object that represents enumerating SKUs for new resources. internal partial class NewResourceResultSkuEnumeration { - /// Initializes a new instance of NewResourceResultSkuEnumeration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NewResourceResultSkuEnumeration() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of NewResourceResultSkuEnumeration. + /// Initializes a new instance of . /// The collection of available SKUs for new resources. - internal NewResourceResultSkuEnumeration(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal NewResourceResultSkuEnumeration(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of available SKUs for new resources. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.Serialization.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.Serialization.cs index ebe391ee6132..837fbbb91543 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.Serialization.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Analysis.Models { - internal partial class ServerAdministrators : IUtf8JsonSerializable + internal partial class ServerAdministrators : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AsAdministratorIdentities)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServerAdministrators DeserializeServerAdministrators(JsonElement element) + internal static ServerAdministrators DeserializeServerAdministrators(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> members = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("members"u8)) @@ -52,8 +74,61 @@ internal static ServerAdministrators DeserializeServerAdministrators(JsonElement members = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServerAdministrators(Optional.ToList(members), serializedAdditionalRawData); + } + + ServerAdministrators IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServerAdministrators(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServerAdministrators IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServerAdministrators(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServerAdministrators model) + { + if (model is null) + { + return null; } - return new ServerAdministrators(Optional.ToList(members)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServerAdministrators(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServerAdministrators(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.cs index 2d1a963f4a67..95ae9f98e889 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Models/ServerAdministrators.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Analysis.Models /// An array of administrator user identities. internal partial class ServerAdministrators { - /// Initializes a new instance of ServerAdministrators. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServerAdministrators() { AsAdministratorIdentities = new ChangeTrackingList(); } - /// Initializes a new instance of ServerAdministrators. + /// Initializes a new instance of . /// An array of administrator user identities. - internal ServerAdministrators(IList asAdministratorIdentities) + /// Keeps track of any properties unknown to the library. + internal ServerAdministrators(IList asAdministratorIdentities, Dictionary serializedAdditionalRawData) { AsAdministratorIdentities = asAdministratorIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of administrator user identities. diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/RestOperations/ServersRestOperations.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/RestOperations/ServersRestOperations.cs index b5ad115f9b4a..dd0577c2cd79 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/RestOperations/ServersRestOperations.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/RestOperations/ServersRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -288,9 +286,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -941,9 +937,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs index 06d75ba48a6b..dade23791f4f 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs @@ -14,6 +14,15 @@ namespace Azure.AI.AnomalyDetector /// Model factory for models. public static partial class AIAnomalyDetectorModelFactory { + /// Initializes a new instance of TimeSeriesPoint. + /// Argument that indicates the time stamp of a data point (ISO8601 format). + /// Measurement of that point. + /// A new instance for mocking. + public static TimeSeriesPoint TimeSeriesPoint(DateTimeOffset? timestamp = null, float value = default) + { + return new TimeSeriesPoint(timestamp, value, default); + } + /// Initializes a new instance of UnivariateLastDetectionResult. /// /// Frequency extracted from the series. Zero means no recurrent pattern has been @@ -51,7 +60,39 @@ public static partial class AIAnomalyDetectorModelFactory /// A new instance for mocking. public static UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = default, int suggestedWindow = default, float expectedValue = default, float upperMargin = default, float lowerMargin = default, bool isAnomaly = default, bool isNegativeAnomaly = default, bool isPositiveAnomaly = default, float? severity = null) { - return new UnivariateLastDetectionResult(period, suggestedWindow, expectedValue, upperMargin, lowerMargin, isAnomaly, isNegativeAnomaly, isPositiveAnomaly, severity); + return new UnivariateLastDetectionResult(period, suggestedWindow, expectedValue, upperMargin, lowerMargin, isAnomaly, isNegativeAnomaly, isPositiveAnomaly, severity, default); + } + + /// Initializes a new instance of UnivariateChangePointDetectionOptions. + /// + /// Time series data points. Points should be sorted by time stamp in ascending + /// order to match the change point detection result. + /// + /// Granularity is used to verify whether the input series is valid. + /// + /// A custom interval is used to set a nonstandard time interval. For example, if the + /// series is 5 minutes, the request can be set as {"granularity":"minutely", + /// "customInterval":5}. + /// + /// + /// Argument that indicates the periodic value of a time series. If the value is null or + /// not present, the API will determine the period automatically. + /// + /// + /// Argument that indicates an advanced model parameter. A default stableTrendWindow value will + /// be used in detection. + /// + /// + /// Argument that indicates an advanced model parameter between 0.0 and 1.0. The lower the + /// value is, the larger the trend error is, which means less change point will + /// be accepted. + /// + /// A new instance for mocking. + public static UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(IEnumerable series = null, TimeGranularity granularity = default, int? customInterval = null, int? period = null, int? stableTrendWindow = null, float? threshold = null) + { + series ??= new List(); + + return new UnivariateChangePointDetectionOptions(series?.ToList(), granularity, customInterval, period, stableTrendWindow, threshold, default); } /// Initializes a new instance of UnivariateChangePointDetectionResult. @@ -71,7 +112,7 @@ public static UnivariateChangePointDetectionResult UnivariateChangePointDetectio isChangePoint ??= new List(); confidenceScores ??= new List(); - return new UnivariateChangePointDetectionResult(period, isChangePoint?.ToList(), confidenceScores?.ToList()); + return new UnivariateChangePointDetectionResult(period, isChangePoint?.ToList(), confidenceScores?.ToList(), default); } /// Initializes a new instance of MultivariateDetectionResult. @@ -83,7 +124,7 @@ public static MultivariateDetectionResult MultivariateDetectionResult(Guid resul { results ??= new List(); - return new MultivariateDetectionResult(resultId, summary, results?.ToList()); + return new MultivariateDetectionResult(resultId, summary, results?.ToList(), default); } /// Initializes a new instance of MultivariateBatchDetectionResultSummary. @@ -100,7 +141,7 @@ public static MultivariateBatchDetectionResultSummary MultivariateBatchDetection errors ??= new List(); variableStates ??= new List(); - return new MultivariateBatchDetectionResultSummary(status, errors?.ToList(), variableStates?.ToList(), setupInfo); + return new MultivariateBatchDetectionResultSummary(status, errors?.ToList(), variableStates?.ToList(), setupInfo, default); } /// Initializes a new instance of AnomalyState. @@ -112,7 +153,7 @@ public static AnomalyState AnomalyState(DateTimeOffset timestamp = default, Anom { errors ??= new List(); - return new AnomalyState(timestamp, value, errors?.ToList()); + return new AnomalyState(timestamp, value, errors?.ToList(), default); } /// Initializes a new instance of AnomalyValue. @@ -128,7 +169,7 @@ public static AnomalyValue AnomalyValue(bool isAnomaly = default, float severity { interpretation ??= new List(); - return new AnomalyValue(isAnomaly, severity, score, interpretation?.ToList()); + return new AnomalyValue(isAnomaly, severity, score, interpretation?.ToList(), default); } /// Initializes a new instance of AnomalyInterpretation. @@ -141,7 +182,7 @@ public static AnomalyValue AnomalyValue(bool isAnomaly = default, float severity /// A new instance for mocking. public static AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = null, CorrelationChanges correlationChanges = null) { - return new AnomalyInterpretation(variable, contributionScore, correlationChanges); + return new AnomalyInterpretation(variable, contributionScore, correlationChanges, default); } /// Initializes a new instance of CorrelationChanges. @@ -151,7 +192,7 @@ public static CorrelationChanges CorrelationChanges(IEnumerable changedV { changedVariables ??= new List(); - return new CorrelationChanges(changedVariables?.ToList()); + return new CorrelationChanges(changedVariables?.ToList(), default); } /// Initializes a new instance of ModelInfo. @@ -189,7 +230,7 @@ public static ModelInfo ModelInfo(Uri dataSource = null, DataSchema? dataSchema { errors ??= new List(); - return new ModelInfo(dataSource, dataSchema, startTime, endTime, displayName, slidingWindow, alignPolicy, status, errors?.ToList(), diagnosticsInfo); + return new ModelInfo(dataSource, dataSchema, startTime, endTime, displayName, slidingWindow, alignPolicy, status, errors?.ToList(), diagnosticsInfo, default); } /// Initializes a new instance of AnomalyDetectionModel. @@ -203,7 +244,7 @@ public static ModelInfo ModelInfo(Uri dataSource = null, DataSchema? dataSchema /// A new instance for mocking. public static AnomalyDetectionModel AnomalyDetectionModel(Guid modelId = default, DateTimeOffset createdTime = default, DateTimeOffset lastUpdatedTime = default, ModelInfo modelInfo = null) { - return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo); + return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo, default); } /// Initializes a new instance of MultivariateLastDetectionResult. @@ -215,7 +256,7 @@ public static MultivariateLastDetectionResult MultivariateLastDetectionResult(IE variableStates ??= new List(); results ??= new List(); - return new MultivariateLastDetectionResult(variableStates?.ToList(), results?.ToList()); + return new MultivariateLastDetectionResult(variableStates?.ToList(), results?.ToList(), default); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs index 423f993d447f..dd5545c73db4 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class AlignPolicy : IUtf8JsonSerializable + public partial class AlignPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AlignMode)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("paddingValue"u8); writer.WriteNumberValue(PaddingValue.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlignPolicy DeserializeAlignPolicy(JsonElement element) + internal static AlignPolicy DeserializeAlignPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static AlignPolicy DeserializeAlignPolicy(JsonElement element) Optional alignMode = default; Optional fillNAMethod = default; Optional paddingValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("alignMode"u8)) @@ -72,24 +94,61 @@ internal static AlignPolicy DeserializeAlignPolicy(JsonElement element) paddingValue = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AlignPolicy(Optional.ToNullable(alignMode), Optional.ToNullable(fillNAMethod), Optional.ToNullable(paddingValue)); + return new AlignPolicy(Optional.ToNullable(alignMode), Optional.ToNullable(fillNAMethod), Optional.ToNullable(paddingValue), serializedAdditionalRawData); + } + + AlignPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlignPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AlignPolicy FromResponse(Response response) + AlignPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAlignPolicy(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlignPolicy(doc.RootElement, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlignPolicy model) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlignPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlignPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs index 1d4b1d33d9e0..c5681e6ba34a 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs @@ -5,11 +5,17 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.AnomalyDetector { /// Manner of aligning multiple variables. public partial class AlignPolicy { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AlignPolicy. public AlignPolicy() { @@ -22,11 +28,13 @@ public AlignPolicy() /// /// Field that indicates how missing values will be filled. /// Field that's required when fillNAMethod is Fixed. - internal AlignPolicy(AlignMode? alignMode, FillNAMethod? fillNAMethod, float? paddingValue) + /// Keeps track of any properties unknown to the library. + internal AlignPolicy(AlignMode? alignMode, FillNAMethod? fillNAMethod, float? paddingValue, Dictionary serializedAdditionalRawData) { AlignMode = alignMode; FillNAMethod = fillNAMethod; PaddingValue = paddingValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs index 5603fa0cbd55..1803290b7bbb 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs @@ -6,16 +6,60 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyDetectionModel + public partial class AnomalyDetectionModel : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("modelId"u8); + writer.WriteStringValue(ModelId); + writer.WritePropertyName("createdTime"u8); + writer.WriteStringValue(CreatedTime, "O"); + writer.WritePropertyName("lastUpdatedTime"u8); + writer.WriteStringValue(LastUpdatedTime, "O"); + if (Optional.IsDefined(ModelInfo)) + { + writer.WritePropertyName("modelInfo"u8); + if (ModelInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ModelInfo).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +68,7 @@ internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonEleme DateTimeOffset createdTime = default; DateTimeOffset lastUpdatedTime = default; Optional modelInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("modelId"u8)) @@ -50,16 +95,61 @@ internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonEleme modelInfo = ModelInfo.DeserializeModelInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo.Value, serializedAdditionalRawData); + } + + AnomalyDetectionModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnomalyDetectionModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnomalyDetectionModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnomalyDetectionModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnomalyDetectionModel model) + { + if (model is null) + { + return null; } - return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyDetectionModel FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator AnomalyDetectionModel(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnomalyDetectionModel(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnomalyDetectionModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs index bdcf1413301a..dc137c256341 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs @@ -6,12 +6,16 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.AI.AnomalyDetector { /// Response of getting a model. public partial class AnomalyDetectionModel { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnomalyDetectionModel. /// Model identifier. /// Date and time (UTC) when the model was created. @@ -31,12 +35,19 @@ internal AnomalyDetectionModel(Guid modelId, DateTimeOffset createdTime, DateTim /// Training result of a model, including its status, errors, and diagnostics /// information. /// - internal AnomalyDetectionModel(Guid modelId, DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime, ModelInfo modelInfo) + /// Keeps track of any properties unknown to the library. + internal AnomalyDetectionModel(Guid modelId, DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime, ModelInfo modelInfo, Dictionary serializedAdditionalRawData) { ModelId = modelId; CreatedTime = createdTime; LastUpdatedTime = lastUpdatedTime; ModelInfo = modelInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnomalyDetectionModel() + { } /// Model identifier. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs index 0b8e5f6a61bb..cf2e7cda2aaa 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs @@ -150,8 +150,8 @@ public virtual async Task> DetectUnivari Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectUnivariateLastPointAsync(options.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(UnivariateLastDetectionResult.FromResponse(response), response); + Response response = await DetectUnivariateLastPointAsync(options, context).ConfigureAwait(false); + return Response.FromValue((UnivariateLastDetectionResult)response, response); } /// Detect anomaly status of the latest point in time series. @@ -168,8 +168,8 @@ public virtual Response DetectUnivariateLastPoint Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectUnivariateLastPoint(options.ToRequestContent(), context); - return Response.FromValue(UnivariateLastDetectionResult.FromResponse(response), response); + Response response = DetectUnivariateLastPoint(options, context); + return Response.FromValue((UnivariateLastDetectionResult)response, response); } /// @@ -261,8 +261,8 @@ public virtual async Task> Detect Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectUnivariateChangePointAsync(options.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(UnivariateChangePointDetectionResult.FromResponse(response), response); + Response response = await DetectUnivariateChangePointAsync(options, context).ConfigureAwait(false); + return Response.FromValue((UnivariateChangePointDetectionResult)response, response); } /// Detect change point for the entire series. @@ -276,8 +276,8 @@ public virtual Response DetectUnivariateCh Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectUnivariateChangePoint(options.ToRequestContent(), context); - return Response.FromValue(UnivariateChangePointDetectionResult.FromResponse(response), response); + Response response = DetectUnivariateChangePoint(options, context); + return Response.FromValue((UnivariateChangePointDetectionResult)response, response); } /// @@ -370,7 +370,7 @@ public virtual async Task> GetMultivariate { RequestContext context = FromCancellationToken(cancellationToken); Response response = await GetMultivariateBatchDetectionResultAsync(resultId, context).ConfigureAwait(false); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); + return Response.FromValue((MultivariateDetectionResult)response, response); } /// Get Multivariate Anomaly Detection Result. @@ -385,7 +385,7 @@ public virtual Response GetMultivariateBatchDetecti { RequestContext context = FromCancellationToken(cancellationToken); Response response = GetMultivariateBatchDetectionResult(resultId, context); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); + return Response.FromValue((MultivariateDetectionResult)response, response); } /// @@ -482,8 +482,8 @@ public virtual async Task> TrainMultivariateMode Argument.AssertNotNull(modelInfo, nameof(modelInfo)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await TrainMultivariateModelAsync(modelInfo.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + Response response = await TrainMultivariateModelAsync(modelInfo, context).ConfigureAwait(false); + return Response.FromValue((AnomalyDetectionModel)response, response); } /// Train a Multivariate Anomaly Detection Model. @@ -508,8 +508,8 @@ public virtual Response TrainMultivariateModel(ModelInfo Argument.AssertNotNull(modelInfo, nameof(modelInfo)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = TrainMultivariateModel(modelInfo.ToRequestContent(), context); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + Response response = TrainMultivariateModel(modelInfo, context); + return Response.FromValue((AnomalyDetectionModel)response, response); } /// @@ -678,7 +678,7 @@ public virtual async Task> GetMultivariateModelA RequestContext context = FromCancellationToken(cancellationToken); Response response = await GetMultivariateModelAsync(modelId, context).ConfigureAwait(false); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + return Response.FromValue((AnomalyDetectionModel)response, response); } /// Get Multivariate Model. @@ -697,7 +697,7 @@ public virtual Response GetMultivariateModel(string model RequestContext context = FromCancellationToken(cancellationToken); Response response = GetMultivariateModel(modelId, context); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + return Response.FromValue((AnomalyDetectionModel)response, response); } /// @@ -801,8 +801,8 @@ public virtual async Task> DetectMultivari Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectMultivariateBatchAnomalyAsync(modelId, options.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); + Response response = await DetectMultivariateBatchAnomalyAsync(modelId, options, context).ConfigureAwait(false); + return Response.FromValue((MultivariateDetectionResult)response, response); } /// Detect Multivariate Anomaly. @@ -826,8 +826,8 @@ public virtual Response DetectMultivariateBatchAnom Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectMultivariateBatchAnomaly(modelId, options.ToRequestContent(), context); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); + Response response = DetectMultivariateBatchAnomaly(modelId, options, context); + return Response.FromValue((MultivariateDetectionResult)response, response); } /// @@ -933,8 +933,8 @@ public virtual async Task> DetectMulti Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectMultivariateLastAnomalyAsync(modelId, options.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(MultivariateLastDetectionResult.FromResponse(response), response); + Response response = await DetectMultivariateLastAnomalyAsync(modelId, options, context).ConfigureAwait(false); + return Response.FromValue((MultivariateLastDetectionResult)response, response); } /// Detect anomalies in the last point of the request body. @@ -956,8 +956,8 @@ public virtual Response DetectMultivariateLastA Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectMultivariateLastAnomaly(modelId, options.ToRequestContent(), context); - return Response.FromValue(MultivariateLastDetectionResult.FromResponse(response), response); + Response response = DetectMultivariateLastAnomaly(modelId, options, context); + return Response.FromValue((MultivariateLastDetectionResult)response, response); } /// @@ -1097,7 +1097,7 @@ public virtual AsyncPageable GetMultivariateModelsAsync(int? skip, i { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMultivariateModelsRequest(skip, maxCount, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMultivariateModelsNextPageRequest(nextLink, skip, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AnomalyDetectorClient.GetMultivariateModels", "models", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AnomalyDetectorClient.GetMultivariateModels", "models", "nextLink", context); } /// @@ -1125,7 +1125,7 @@ public virtual Pageable GetMultivariateModels(int? skip, int? maxCou { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMultivariateModelsRequest(skip, maxCount, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMultivariateModelsNextPageRequest(nextLink, skip, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AnomalyDetectorClient.GetMultivariateModels", "models", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AnomalyDetectorClient.GetMultivariateModels", "models", "nextLink", context); } internal HttpMessage CreateDetectUnivariateEntireSeriesRequest(RequestContent content, RequestContext context) diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs index 19f611b998a3..980202ad91df 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs @@ -5,16 +5,65 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyInterpretation + public partial class AnomalyInterpretation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Variable)) + { + writer.WritePropertyName("variable"u8); + writer.WriteStringValue(Variable); + } + if (Optional.IsDefined(ContributionScore)) + { + writer.WritePropertyName("contributionScore"u8); + writer.WriteNumberValue(ContributionScore.Value); + } + if (Optional.IsDefined(CorrelationChanges)) + { + writer.WritePropertyName("correlationChanges"u8); + if (CorrelationChanges is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CorrelationChanges).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +71,7 @@ internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonEleme Optional variable = default; Optional contributionScore = default; Optional correlationChanges = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("variable"u8)) @@ -47,16 +97,61 @@ internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonEleme correlationChanges = CorrelationChanges.DeserializeCorrelationChanges(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnomalyInterpretation(variable.Value, Optional.ToNullable(contributionScore), correlationChanges.Value); + return new AnomalyInterpretation(variable.Value, Optional.ToNullable(contributionScore), correlationChanges.Value, serializedAdditionalRawData); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyInterpretation FromResponse(Response response) + AnomalyInterpretation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnomalyInterpretation(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnomalyInterpretation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnomalyInterpretation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnomalyInterpretation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnomalyInterpretation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnomalyInterpretation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnomalyInterpretation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs index e24de192a5e1..49428cc397ef 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs @@ -5,11 +5,17 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.AnomalyDetector { /// Interpretation of the anomalous time stamp. public partial class AnomalyInterpretation { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnomalyInterpretation. internal AnomalyInterpretation() { @@ -22,11 +28,13 @@ internal AnomalyInterpretation() /// number between 0 and 1. /// /// Correlation changes among the anomalous variables. - internal AnomalyInterpretation(string variable, float? contributionScore, CorrelationChanges correlationChanges) + /// Keeps track of any properties unknown to the library. + internal AnomalyInterpretation(string variable, float? contributionScore, CorrelationChanges correlationChanges, Dictionary serializedAdditionalRawData) { Variable = variable; ContributionScore = contributionScore; CorrelationChanges = correlationChanges; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Variable. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs index d71e9d5d3f49..07a06d678ff5 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs @@ -10,13 +10,69 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyState + public partial class AnomalyState : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnomalyState DeserializeAnomalyState(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp, "O"); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + if (Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Value).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnomalyState DeserializeAnomalyState(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +80,7 @@ internal static AnomalyState DeserializeAnomalyState(JsonElement element) DateTimeOffset timestamp = default; Optional value = default; Optional> errors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timestamp"u8)) @@ -54,16 +111,61 @@ internal static AnomalyState DeserializeAnomalyState(JsonElement element) errors = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnomalyState(timestamp, value.Value, Optional.ToList(errors)); + return new AnomalyState(timestamp, value.Value, Optional.ToList(errors), serializedAdditionalRawData); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyState FromResponse(Response response) + AnomalyState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnomalyState(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnomalyState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnomalyState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnomalyState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnomalyState model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnomalyState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnomalyState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs index a402ee93e47d..24adceca2e67 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs @@ -14,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Anomaly status and information. public partial class AnomalyState { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnomalyState. /// Time stamp for this anomaly. internal AnomalyState(DateTimeOffset timestamp) @@ -26,11 +29,18 @@ internal AnomalyState(DateTimeOffset timestamp) /// Time stamp for this anomaly. /// Detailed value of this anomalous time stamp. /// Error message for the current time stamp. - internal AnomalyState(DateTimeOffset timestamp, AnomalyValue value, IReadOnlyList errors) + /// Keeps track of any properties unknown to the library. + internal AnomalyState(DateTimeOffset timestamp, AnomalyValue value, IReadOnlyList errors, Dictionary serializedAdditionalRawData) { Timestamp = timestamp; Value = value; Errors = errors; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnomalyState() + { } /// Time stamp for this anomaly. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs index e3523b03361c..7743f09d7a53 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs @@ -5,17 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyValue + public partial class AnomalyValue : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnomalyValue DeserializeAnomalyValue(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("isAnomaly"u8); + writer.WriteBooleanValue(IsAnomaly); + writer.WritePropertyName("severity"u8); + writer.WriteNumberValue(Severity); + writer.WritePropertyName("score"u8); + writer.WriteNumberValue(Score); + if (Optional.IsCollectionDefined(Interpretation)) + { + writer.WritePropertyName("interpretation"u8); + writer.WriteStartArray(); + foreach (var item in Interpretation) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnomalyValue DeserializeAnomalyValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +73,7 @@ internal static AnomalyValue DeserializeAnomalyValue(JsonElement element) float severity = default; float score = default; Optional> interpretation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isAnomaly"u8)) @@ -55,16 +105,61 @@ internal static AnomalyValue DeserializeAnomalyValue(JsonElement element) interpretation = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnomalyValue(isAnomaly, severity, score, Optional.ToList(interpretation), serializedAdditionalRawData); + } + + AnomalyValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnomalyValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnomalyValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnomalyValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnomalyValue model) + { + if (model is null) + { + return null; } - return new AnomalyValue(isAnomaly, severity, score, Optional.ToList(interpretation)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyValue FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator AnomalyValue(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnomalyValue(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnomalyValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs index eff30b930516..81e1abc231ed 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Detailed information of the anomalous time stamp. public partial class AnomalyValue { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnomalyValue. /// True if an anomaly is detected at the current time stamp. /// @@ -36,12 +40,19 @@ internal AnomalyValue(bool isAnomaly, float severity, float score) /// /// Raw anomaly score of severity, to help indicate the degree of abnormality. /// Interpretation of this anomalous time stamp. - internal AnomalyValue(bool isAnomaly, float severity, float score, IReadOnlyList interpretation) + /// Keeps track of any properties unknown to the library. + internal AnomalyValue(bool isAnomaly, float severity, float score, IReadOnlyList interpretation, Dictionary serializedAdditionalRawData) { IsAnomaly = isAnomaly; Severity = severity; Score = score; Interpretation = interpretation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnomalyValue() + { } /// True if an anomaly is detected at the current time stamp. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs index 31974c2338bb..953476223f70 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs @@ -5,22 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class CorrelationChanges + public partial class CorrelationChanges : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CorrelationChanges DeserializeCorrelationChanges(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ChangedVariables)) + { + writer.WritePropertyName("changedVariables"u8); + writer.WriteStartArray(); + foreach (var item in ChangedVariables) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CorrelationChanges DeserializeCorrelationChanges(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> changedVariables = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("changedVariables"u8)) @@ -37,16 +74,61 @@ internal static CorrelationChanges DeserializeCorrelationChanges(JsonElement ele changedVariables = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CorrelationChanges(Optional.ToList(changedVariables), serializedAdditionalRawData); + } + + CorrelationChanges IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCorrelationChanges(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CorrelationChanges IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCorrelationChanges(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CorrelationChanges model) + { + if (model is null) + { + return null; } - return new CorrelationChanges(Optional.ToList(changedVariables)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CorrelationChanges FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator CorrelationChanges(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCorrelationChanges(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCorrelationChanges(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs index f400d702fe19..893537aea112 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Correlation changes among the anomalous variables. public partial class CorrelationChanges { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of CorrelationChanges. internal CorrelationChanges() { @@ -21,9 +25,11 @@ internal CorrelationChanges() /// Initializes a new instance of CorrelationChanges. /// Correlated variables that have correlation changes under an anomaly. - internal CorrelationChanges(IReadOnlyList changedVariables) + /// Keeps track of any properties unknown to the library. + internal CorrelationChanges(IReadOnlyList changedVariables, Dictionary serializedAdditionalRawData) { ChangedVariables = changedVariables; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Correlated variables that have correlation changes under an anomaly. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs index 91d090cb769e..df43ec7e2516 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs @@ -5,22 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class DiagnosticsInfo : IUtf8JsonSerializable + public partial class DiagnosticsInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ModelState)) { writer.WritePropertyName("modelState"u8); - writer.WriteObjectValue(ModelState); + if (ModelState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ModelState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(VariableStates)) { @@ -28,21 +41,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VariableStates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiagnosticsInfo DeserializeDiagnosticsInfo(JsonElement element) + internal static DiagnosticsInfo DeserializeDiagnosticsInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional modelState = default; Optional> variableStates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("modelState"u8)) @@ -68,24 +103,61 @@ internal static DiagnosticsInfo DeserializeDiagnosticsInfo(JsonElement element) variableStates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiagnosticsInfo(modelState.Value, Optional.ToList(variableStates)); + return new DiagnosticsInfo(modelState.Value, Optional.ToList(variableStates), serializedAdditionalRawData); + } + + DiagnosticsInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticsInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DiagnosticsInfo FromResponse(Response response) + DiagnosticsInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDiagnosticsInfo(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticsInfo(doc.RootElement, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticsInfo model) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticsInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticsInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs index df35f00e1dc5..fd9b830f05b5 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Diagnostics information to help inspect the states of a model or variable. public partial class DiagnosticsInfo { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of DiagnosticsInfo. public DiagnosticsInfo() { @@ -22,10 +26,12 @@ public DiagnosticsInfo() /// Initializes a new instance of DiagnosticsInfo. /// Model status. /// Variable status. - internal DiagnosticsInfo(ModelState modelState, IList variableStates) + /// Keeps track of any properties unknown to the library. + internal DiagnosticsInfo(ModelState modelState, IList variableStates, Dictionary serializedAdditionalRawData) { ModelState = modelState; VariableStates = variableStates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Model status. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs index d49c2aec5cfd..ceab1ec885c3 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs @@ -5,32 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class ErrorResponse : IUtf8JsonSerializable + public partial class ErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("code"u8); writer.WriteStringValue(Code); writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string code = default; string message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -43,24 +65,61 @@ internal static ErrorResponse DeserializeErrorResponse(JsonElement element) message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ErrorResponse(code, message); + return new ErrorResponse(code, message, serializedAdditionalRawData); + } + + ErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ErrorResponse FromResponse(Response response) + ErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeErrorResponse(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorResponse(doc.RootElement, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorResponse model) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs index fc584571535a..fb19aa4079ed 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.AnomalyDetector @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Error information that the API returned. public partial class ErrorResponse { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of ErrorResponse. /// Error code. /// Message that explains the error that the service reported. @@ -26,6 +30,22 @@ public ErrorResponse(string code, string message) Message = message; } + /// Initializes a new instance of ErrorResponse. + /// Error code. + /// Message that explains the error that the service reported. + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(string code, string message, Dictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ErrorResponse() + { + } + /// Error code. public string Code { get; set; } /// Message that explains the error that the service reported. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs index 0777c2bf12cd..de94ff6fca54 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs @@ -10,13 +10,18 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class ModelInfo : IUtf8JsonSerializable + public partial class ModelInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dataSource"u8); writer.WriteStringValue(DataSource.AbsoluteUri); @@ -42,13 +47,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AlignPolicy)) { writer.WritePropertyName("alignPolicy"u8); - writer.WriteObjectValue(AlignPolicy); + if (AlignPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AlignPolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ModelInfo DeserializeModelInfo(JsonElement element) + internal static ModelInfo DeserializeModelInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +89,7 @@ internal static ModelInfo DeserializeModelInfo(JsonElement element) Optional status = default; Optional> errors = default; Optional diagnosticsInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataSource"u8)) @@ -144,24 +171,61 @@ internal static ModelInfo DeserializeModelInfo(JsonElement element) diagnosticsInfo = DiagnosticsInfo.DeserializeDiagnosticsInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ModelInfo(dataSource, Optional.ToNullable(dataSchema), startTime, endTime, displayName.Value, Optional.ToNullable(slidingWindow), alignPolicy.Value, Optional.ToNullable(status), Optional.ToList(errors), diagnosticsInfo.Value); + return new ModelInfo(dataSource, Optional.ToNullable(dataSchema), startTime, endTime, displayName.Value, Optional.ToNullable(slidingWindow), alignPolicy.Value, Optional.ToNullable(status), Optional.ToList(errors), diagnosticsInfo.Value, serializedAdditionalRawData); + } + + ModelInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeModelInfo(doc.RootElement, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ModelInfo FromResponse(Response response) + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeModelInfo(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + ModelInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeModelInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ModelInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ModelInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeModelInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs index 27a9bbef18f2..8abcf7d5541f 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs @@ -17,6 +17,9 @@ namespace Azure.AI.AnomalyDetector /// public partial class ModelInfo { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of ModelInfo. /// /// Source link to the input data to indicate an accessible Azure Storage URI. @@ -72,7 +75,8 @@ public ModelInfo(Uri dataSource, DateTimeOffset startTime, DateTimeOffset endTim /// Model status. /// Error messages after failure to create a model. /// Diagnostics information to help inspect the states of a model or variable. - internal ModelInfo(Uri dataSource, DataSchema? dataSchema, DateTimeOffset startTime, DateTimeOffset endTime, string displayName, int? slidingWindow, AlignPolicy alignPolicy, ModelStatus? status, IReadOnlyList errors, DiagnosticsInfo diagnosticsInfo) + /// Keeps track of any properties unknown to the library. + internal ModelInfo(Uri dataSource, DataSchema? dataSchema, DateTimeOffset startTime, DateTimeOffset endTime, string displayName, int? slidingWindow, AlignPolicy alignPolicy, ModelStatus? status, IReadOnlyList errors, DiagnosticsInfo diagnosticsInfo, Dictionary serializedAdditionalRawData) { DataSource = dataSource; DataSchema = dataSchema; @@ -84,6 +88,12 @@ internal ModelInfo(Uri dataSource, DataSchema? dataSchema, DateTimeOffset startT Status = status; Errors = errors; DiagnosticsInfo = diagnosticsInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ModelInfo() + { } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs index c853fecd1edb..14bd2e8b4d58 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs @@ -5,17 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class ModelState : IUtf8JsonSerializable + public partial class ModelState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(EpochIds)) { @@ -57,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ModelState DeserializeModelState(JsonElement element) + internal static ModelState DeserializeModelState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +90,7 @@ internal static ModelState DeserializeModelState(JsonElement element) Optional> trainLosses = default; Optional> validationLosses = default; Optional> latenciesInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("epochIds"u8)) @@ -128,24 +149,61 @@ internal static ModelState DeserializeModelState(JsonElement element) latenciesInSeconds = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ModelState(Optional.ToList(epochIds), Optional.ToList(trainLosses), Optional.ToList(validationLosses), Optional.ToList(latenciesInSeconds)); + return new ModelState(Optional.ToList(epochIds), Optional.ToList(trainLosses), Optional.ToList(validationLosses), Optional.ToList(latenciesInSeconds), serializedAdditionalRawData); + } + + ModelState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeModelState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ModelState FromResponse(Response response) + ModelState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeModelState(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeModelState(doc.RootElement, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ModelState model) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ModelState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeModelState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs index f5bd58fe3429..c338feaf336f 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Model status. public partial class ModelState { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of ModelState. public ModelState() { @@ -36,12 +40,14 @@ public ModelState() /// epoch. /// /// Latency for each epoch. - internal ModelState(IList epochIds, IList trainLosses, IList validationLosses, IList latenciesInSeconds) + /// Keeps track of any properties unknown to the library. + internal ModelState(IList epochIds, IList trainLosses, IList validationLosses, IList latenciesInSeconds, Dictionary serializedAdditionalRawData) { EpochIds = epochIds; TrainLosses = trainLosses; ValidationLosses = validationLosses; LatenciesInSeconds = latenciesInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs index 3e5afcf1b11a..815869d83152 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs @@ -6,16 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateBatchDetectionOptions : IUtf8JsonSerializable + public partial class MultivariateBatchDetectionOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dataSource"u8); writer.WriteStringValue(DataSource.AbsoluteUri); @@ -28,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StartTime, "O"); writer.WritePropertyName("endTime"u8); writer.WriteStringValue(EndTime, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MultivariateBatchDetectionOptions DeserializeMultivariateBatchDetectionOptions(JsonElement element) + internal static MultivariateBatchDetectionOptions DeserializeMultivariateBatchDetectionOptions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +61,7 @@ internal static MultivariateBatchDetectionOptions DeserializeMultivariateBatchDe Optional topContributorCount = default; DateTimeOffset startTime = default; DateTimeOffset endTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataSource"u8)) @@ -67,24 +88,61 @@ internal static MultivariateBatchDetectionOptions DeserializeMultivariateBatchDe endTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MultivariateBatchDetectionOptions(dataSource, Optional.ToNullable(topContributorCount), startTime, endTime); + return new MultivariateBatchDetectionOptions(dataSource, Optional.ToNullable(topContributorCount), startTime, endTime, serializedAdditionalRawData); + } + + MultivariateBatchDetectionOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMultivariateBatchDetectionOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateBatchDetectionOptions FromResponse(Response response) + MultivariateBatchDetectionOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMultivariateBatchDetectionOptions(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMultivariateBatchDetectionOptions(doc.RootElement, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MultivariateBatchDetectionOptions model) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MultivariateBatchDetectionOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMultivariateBatchDetectionOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs index 948bb05ea2b8..9ddd85f9e321 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.AnomalyDetector @@ -16,6 +17,9 @@ namespace Azure.AI.AnomalyDetector /// public partial class MultivariateBatchDetectionOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of MultivariateBatchDetectionOptions. /// /// Source link to the input data to indicate an accessible Azure Storage URI. @@ -61,12 +65,19 @@ public MultivariateBatchDetectionOptions(Uri dataSource, DateTimeOffset startTim /// End date/time of data for detection, which should /// be in ISO 8601 format. /// - internal MultivariateBatchDetectionOptions(Uri dataSource, int? topContributorCount, DateTimeOffset startTime, DateTimeOffset endTime) + /// Keeps track of any properties unknown to the library. + internal MultivariateBatchDetectionOptions(Uri dataSource, int? topContributorCount, DateTimeOffset startTime, DateTimeOffset endTime, Dictionary serializedAdditionalRawData) { DataSource = dataSource; TopContributorCount = topContributorCount; StartTime = startTime; EndTime = endTime; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultivariateBatchDetectionOptions() + { } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs index 548a82119b8d..6e0fd94da658 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs @@ -5,17 +5,88 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateBatchDetectionResultSummary + public partial class MultivariateBatchDetectionResultSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MultivariateBatchDetectionResultSummary DeserializeMultivariateBatchDetectionResultSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(VariableStates)) + { + writer.WritePropertyName("variableStates"u8); + writer.WriteStartArray(); + foreach (var item in VariableStates) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WritePropertyName("setupInfo"u8); + if (SetupInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SetupInfo).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MultivariateBatchDetectionResultSummary DeserializeMultivariateBatchDetectionResultSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +95,7 @@ internal static MultivariateBatchDetectionResultSummary DeserializeMultivariateB Optional> errors = default; Optional> variableStates = default; MultivariateBatchDetectionOptions setupInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -64,16 +136,61 @@ internal static MultivariateBatchDetectionResultSummary DeserializeMultivariateB setupInfo = MultivariateBatchDetectionOptions.DeserializeMultivariateBatchDetectionOptions(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MultivariateBatchDetectionResultSummary(status, Optional.ToList(errors), Optional.ToList(variableStates), setupInfo, serializedAdditionalRawData); + } + + MultivariateBatchDetectionResultSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMultivariateBatchDetectionResultSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MultivariateBatchDetectionResultSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMultivariateBatchDetectionResultSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MultivariateBatchDetectionResultSummary model) + { + if (model is null) + { + return null; } - return new MultivariateBatchDetectionResultSummary(status, Optional.ToList(errors), Optional.ToList(variableStates), setupInfo); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateBatchDetectionResultSummary FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator MultivariateBatchDetectionResultSummary(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMultivariateBatchDetectionResultSummary(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMultivariateBatchDetectionResultSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs index 324e6abd6fc0..e957e184c7b9 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs @@ -14,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Multivariate anomaly detection status. public partial class MultivariateBatchDetectionResultSummary { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of MultivariateBatchDetectionResultSummary. /// Status of detection results. /// @@ -39,12 +42,19 @@ internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatu /// Detection request for batch inference. This is an asynchronous inference that /// will need another API to get detection results. /// - internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status, IReadOnlyList errors, IReadOnlyList variableStates, MultivariateBatchDetectionOptions setupInfo) + /// Keeps track of any properties unknown to the library. + internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status, IReadOnlyList errors, IReadOnlyList variableStates, MultivariateBatchDetectionOptions setupInfo, Dictionary serializedAdditionalRawData) { Status = status; Errors = errors; VariableStates = variableStates; SetupInfo = setupInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultivariateBatchDetectionResultSummary() + { } /// Status of detection results. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs index adf825bd035e..0e53dd370e14 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs @@ -10,13 +10,63 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateDetectionResult + public partial class MultivariateDetectionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MultivariateDetectionResult DeserializeMultivariateDetectionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("resultId"u8); + writer.WriteStringValue(ResultId); + writer.WritePropertyName("summary"u8); + if (Summary is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Summary).Serialize(writer, options); + } + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (var item in Results) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MultivariateDetectionResult DeserializeMultivariateDetectionResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +74,7 @@ internal static MultivariateDetectionResult DeserializeMultivariateDetectionResu Guid resultId = default; MultivariateBatchDetectionResultSummary summary = default; IReadOnlyList results = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resultId"u8)) @@ -46,16 +97,61 @@ internal static MultivariateDetectionResult DeserializeMultivariateDetectionResu results = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MultivariateDetectionResult(resultId, summary, results); + return new MultivariateDetectionResult(resultId, summary, results, serializedAdditionalRawData); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateDetectionResult FromResponse(Response response) + MultivariateDetectionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMultivariateDetectionResult(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMultivariateDetectionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MultivariateDetectionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMultivariateDetectionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MultivariateDetectionResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MultivariateDetectionResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMultivariateDetectionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs index 674c955ab893..4c4f84295a1a 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs @@ -15,6 +15,9 @@ namespace Azure.AI.AnomalyDetector /// Detection results for the resultId value. public partial class MultivariateDetectionResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of MultivariateDetectionResult. /// Result identifier that's used to fetch the results of an inference call. /// Multivariate anomaly detection status. @@ -34,11 +37,18 @@ internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionRe /// Result identifier that's used to fetch the results of an inference call. /// Multivariate anomaly detection status. /// Detection result for each time stamp. - internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionResultSummary summary, IReadOnlyList results) + /// Keeps track of any properties unknown to the library. + internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionResultSummary summary, IReadOnlyList results, Dictionary serializedAdditionalRawData) { ResultId = resultId; Summary = summary; Results = results; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultivariateDetectionResult() + { } /// Result identifier that's used to fetch the results of an inference call. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs index a0f6be94400c..08c5c46811ac 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateLastDetectionOptions : IUtf8JsonSerializable + public partial class MultivariateLastDetectionOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("variables"u8); writer.WriteStartArray(); foreach (var item in Variables) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(TopContributorCount)) @@ -27,15 +42,108 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("topContributorCount"u8); writer.WriteNumberValue(TopContributorCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static MultivariateLastDetectionOptions DeserializeMultivariateLastDetectionOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList variables = default; + Optional topContributorCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("variables"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VariableValues.DeserializeVariableValues(item)); + } + variables = array; + continue; + } + if (property.NameEquals("topContributorCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topContributorCount = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MultivariateLastDetectionOptions(variables, Optional.ToNullable(topContributorCount), serializedAdditionalRawData); + } + + MultivariateLastDetectionOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMultivariateLastDetectionOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MultivariateLastDetectionOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMultivariateLastDetectionOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MultivariateLastDetectionOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MultivariateLastDetectionOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMultivariateLastDetectionOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs index 76e3c5ad9122..5be0649a3e0f 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs @@ -15,6 +15,9 @@ namespace Azure.AI.AnomalyDetector /// Request of the last detection. public partial class MultivariateLastDetectionOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of MultivariateLastDetectionOptions. /// /// Contains the inference data, including the name, time stamps (ISO 8601), and @@ -38,10 +41,17 @@ public MultivariateLastDetectionOptions(IEnumerable variables) /// variables for one anomalous time stamp in the response. The default is /// 10. /// - internal MultivariateLastDetectionOptions(IList variables, int? topContributorCount) + /// Keeps track of any properties unknown to the library. + internal MultivariateLastDetectionOptions(IList variables, int? topContributorCount, Dictionary serializedAdditionalRawData) { Variables = variables; TopContributorCount = topContributorCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultivariateLastDetectionOptions() + { } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs index 809fa5b1a3af..ff7ac5023b7b 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs @@ -5,23 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateLastDetectionResult + public partial class MultivariateLastDetectionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MultivariateLastDetectionResult DeserializeMultivariateLastDetectionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(VariableStates)) + { + writer.WritePropertyName("variableStates"u8); + writer.WriteStartArray(); + foreach (var item in VariableStates) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (var item in Results) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MultivariateLastDetectionResult DeserializeMultivariateLastDetectionResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> variableStates = default; Optional> results = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("variableStates"u8)) @@ -52,16 +113,61 @@ internal static MultivariateLastDetectionResult DeserializeMultivariateLastDetec results = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MultivariateLastDetectionResult(Optional.ToList(variableStates), Optional.ToList(results), serializedAdditionalRawData); + } + + MultivariateLastDetectionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMultivariateLastDetectionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MultivariateLastDetectionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMultivariateLastDetectionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MultivariateLastDetectionResult model) + { + if (model is null) + { + return null; } - return new MultivariateLastDetectionResult(Optional.ToList(variableStates), Optional.ToList(results)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateLastDetectionResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator MultivariateLastDetectionResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeMultivariateLastDetectionResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMultivariateLastDetectionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs index a6296e90e011..f3e96532a065 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Results of the last detection. public partial class MultivariateLastDetectionResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of MultivariateLastDetectionResult. internal MultivariateLastDetectionResult() { @@ -23,10 +27,12 @@ internal MultivariateLastDetectionResult() /// Initializes a new instance of MultivariateLastDetectionResult. /// Variable status. /// Anomaly status and information. - internal MultivariateLastDetectionResult(IReadOnlyList variableStates, IReadOnlyList results) + /// Keeps track of any properties unknown to the library. + internal MultivariateLastDetectionResult(IReadOnlyList variableStates, IReadOnlyList results, Dictionary serializedAdditionalRawData) { VariableStates = variableStates; Results = results; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Variable status. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs index 7a098f3278a5..cf75d9371a2a 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class TimeSeriesPoint : IUtf8JsonSerializable + public partial class TimeSeriesPoint : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Timestamp)) { @@ -22,15 +30,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("value"u8); writer.WriteNumberValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static TimeSeriesPoint DeserializeTimeSeriesPoint(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional timestamp = default; + float value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetSingle(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TimeSeriesPoint(Optional.ToNullable(timestamp), value, serializedAdditionalRawData); + } + + TimeSeriesPoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTimeSeriesPoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TimeSeriesPoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTimeSeriesPoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TimeSeriesPoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TimeSeriesPoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTimeSeriesPoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs index 632afb7458e9..c98b7fbdce24 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs @@ -6,12 +6,16 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.AI.AnomalyDetector { /// Definition of input time series points. public partial class TimeSeriesPoint { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of TimeSeriesPoint. /// Measurement of that point. public TimeSeriesPoint(float value) @@ -22,10 +26,17 @@ public TimeSeriesPoint(float value) /// Initializes a new instance of TimeSeriesPoint. /// Argument that indicates the time stamp of a data point (ISO8601 format). /// Measurement of that point. - internal TimeSeriesPoint(DateTimeOffset? timestamp, float value) + /// Keeps track of any properties unknown to the library. + internal TimeSeriesPoint(DateTimeOffset? timestamp, float value, Dictionary serializedAdditionalRawData) { Timestamp = timestamp; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TimeSeriesPoint() + { } /// Argument that indicates the time stamp of a data point (ISO8601 format). diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs index 8d3af9932c96..9e9c52b28463 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class UnivariateChangePointDetectionOptions : IUtf8JsonSerializable + public partial class UnivariateChangePointDetectionOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("series"u8); writer.WriteStartArray(); foreach (var item in Series) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("granularity"u8); @@ -44,15 +59,144 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("threshold"u8); writer.WriteNumberValue(Threshold.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static UnivariateChangePointDetectionOptions DeserializeUnivariateChangePointDetectionOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList series = default; + TimeGranularity granularity = default; + Optional customInterval = default; + Optional period = default; + Optional stableTrendWindow = default; + Optional threshold = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("series"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TimeSeriesPoint.DeserializeTimeSeriesPoint(item)); + } + series = array; + continue; + } + if (property.NameEquals("granularity"u8)) + { + granularity = new TimeGranularity(property.Value.GetString()); + continue; + } + if (property.NameEquals("customInterval"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customInterval = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("period"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + period = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stableTrendWindow"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stableTrendWindow = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("threshold"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + threshold = property.Value.GetSingle(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnivariateChangePointDetectionOptions(series, granularity, Optional.ToNullable(customInterval), Optional.ToNullable(period), Optional.ToNullable(stableTrendWindow), Optional.ToNullable(threshold), serializedAdditionalRawData); + } + + UnivariateChangePointDetectionOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnivariateChangePointDetectionOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnivariateChangePointDetectionOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnivariateChangePointDetectionOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnivariateChangePointDetectionOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnivariateChangePointDetectionOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnivariateChangePointDetectionOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs index d9d3c13b234e..0b3e77d036d2 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs @@ -15,6 +15,9 @@ namespace Azure.AI.AnomalyDetector /// Request of change point detection. public partial class UnivariateChangePointDetectionOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of UnivariateChangePointDetectionOptions. /// /// Time series data points. Points should be sorted by time stamp in ascending @@ -54,7 +57,8 @@ public UnivariateChangePointDetectionOptions(IEnumerable series /// value is, the larger the trend error is, which means less change point will /// be accepted. /// - internal UnivariateChangePointDetectionOptions(IList series, TimeGranularity granularity, int? customInterval, int? period, int? stableTrendWindow, float? threshold) + /// Keeps track of any properties unknown to the library. + internal UnivariateChangePointDetectionOptions(IList series, TimeGranularity granularity, int? customInterval, int? period, int? stableTrendWindow, float? threshold, Dictionary serializedAdditionalRawData) { Series = series; Granularity = granularity; @@ -62,6 +66,12 @@ internal UnivariateChangePointDetectionOptions(IList series, Ti Period = period; StableTrendWindow = stableTrendWindow; Threshold = threshold; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UnivariateChangePointDetectionOptions() + { } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs index 9565302b6cb2..9782bb6ba190 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs @@ -5,17 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class UnivariateChangePointDetectionResult + public partial class UnivariateChangePointDetectionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnivariateChangePointDetectionResult DeserializeUnivariateChangePointDetectionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(IsChangePoint)) + { + writer.WritePropertyName("isChangePoint"u8); + writer.WriteStartArray(); + foreach (var item in IsChangePoint) + { + writer.WriteBooleanValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ConfidenceScores)) + { + writer.WritePropertyName("confidenceScores"u8); + writer.WriteStartArray(); + foreach (var item in ConfidenceScores) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnivariateChangePointDetectionResult DeserializeUnivariateChangePointDetectionResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +69,7 @@ internal static UnivariateChangePointDetectionResult DeserializeUnivariateChange Optional period = default; Optional> isChangePoint = default; Optional> confidenceScores = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("period"u8)) @@ -62,16 +109,61 @@ internal static UnivariateChangePointDetectionResult DeserializeUnivariateChange confidenceScores = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnivariateChangePointDetectionResult(Optional.ToNullable(period), Optional.ToList(isChangePoint), Optional.ToList(confidenceScores), serializedAdditionalRawData); + } + + UnivariateChangePointDetectionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnivariateChangePointDetectionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnivariateChangePointDetectionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnivariateChangePointDetectionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnivariateChangePointDetectionResult model) + { + if (model is null) + { + return null; } - return new UnivariateChangePointDetectionResult(Optional.ToNullable(period), Optional.ToList(isChangePoint), Optional.ToList(confidenceScores)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UnivariateChangePointDetectionResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator UnivariateChangePointDetectionResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnivariateChangePointDetectionResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnivariateChangePointDetectionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs index 880e24d2e680..a721fb81b408 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.AnomalyDetector /// Response of change point detection. public partial class UnivariateChangePointDetectionResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of UnivariateChangePointDetectionResult. internal UnivariateChangePointDetectionResult() { @@ -31,11 +35,13 @@ internal UnivariateChangePointDetectionResult() /// array is consistent with the input series. /// /// Change point confidence of each point. - internal UnivariateChangePointDetectionResult(int? period, IReadOnlyList isChangePoint, IReadOnlyList confidenceScores) + /// Keeps track of any properties unknown to the library. + internal UnivariateChangePointDetectionResult(int? period, IReadOnlyList isChangePoint, IReadOnlyList confidenceScores, Dictionary serializedAdditionalRawData) { Period = period; IsChangePoint = isChangePoint; ConfidenceScores = confidenceScores; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs index e311655707ce..0a18c008769e 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class UnivariateDetectionOptions : IUtf8JsonSerializable + public partial class UnivariateDetectionOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("series"u8); writer.WriteStartArray(); foreach (var item in Series) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(Granularity)) @@ -57,15 +72,168 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("imputeFixedValue"u8); writer.WriteNumberValue(ImputeFixedValue.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static UnivariateDetectionOptions DeserializeUnivariateDetectionOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList series = default; + Optional granularity = default; + Optional customInterval = default; + Optional period = default; + Optional maxAnomalyRatio = default; + Optional sensitivity = default; + Optional imputeMode = default; + Optional imputeFixedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("series"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TimeSeriesPoint.DeserializeTimeSeriesPoint(item)); + } + series = array; + continue; + } + if (property.NameEquals("granularity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + granularity = new TimeGranularity(property.Value.GetString()); + continue; + } + if (property.NameEquals("customInterval"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customInterval = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("period"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + period = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxAnomalyRatio"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxAnomalyRatio = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("sensitivity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sensitivity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("imputeMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imputeMode = new ImputeMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("imputeFixedValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imputeFixedValue = property.Value.GetSingle(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnivariateDetectionOptions(series, Optional.ToNullable(granularity), Optional.ToNullable(customInterval), Optional.ToNullable(period), Optional.ToNullable(maxAnomalyRatio), Optional.ToNullable(sensitivity), Optional.ToNullable(imputeMode), Optional.ToNullable(imputeFixedValue), serializedAdditionalRawData); + } + + UnivariateDetectionOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnivariateDetectionOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnivariateDetectionOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnivariateDetectionOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnivariateDetectionOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnivariateDetectionOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnivariateDetectionOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs index a7ae76757e1a..074989c001de 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs @@ -15,6 +15,9 @@ namespace Azure.AI.AnomalyDetector /// Request of the entire or last anomaly detection. public partial class UnivariateDetectionOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of UnivariateDetectionOptions. /// /// Time series data points. Points should be sorted by time stamp in ascending @@ -65,7 +68,8 @@ public UnivariateDetectionOptions(IEnumerable series) /// Specifies the value to fill. It's used when granularity is not "none" /// and imputeMode is "fixed". /// - internal UnivariateDetectionOptions(IList series, TimeGranularity? granularity, int? customInterval, int? period, float? maxAnomalyRatio, int? sensitivity, ImputeMode? imputeMode, float? imputeFixedValue) + /// Keeps track of any properties unknown to the library. + internal UnivariateDetectionOptions(IList series, TimeGranularity? granularity, int? customInterval, int? period, float? maxAnomalyRatio, int? sensitivity, ImputeMode? imputeMode, float? imputeFixedValue, Dictionary serializedAdditionalRawData) { Series = series; Granularity = granularity; @@ -75,6 +79,12 @@ internal UnivariateDetectionOptions(IList series, TimeGranulari Sensitivity = sensitivity; ImputeMode = imputeMode; ImputeFixedValue = imputeFixedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UnivariateDetectionOptions() + { } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs index 45b55c08c081..30073fd541c5 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs @@ -5,16 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class UnivariateLastDetectionResult + public partial class UnivariateLastDetectionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetectionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("period"u8); + writer.WriteNumberValue(Period); + writer.WritePropertyName("suggestedWindow"u8); + writer.WriteNumberValue(SuggestedWindow); + writer.WritePropertyName("expectedValue"u8); + writer.WriteNumberValue(ExpectedValue); + writer.WritePropertyName("upperMargin"u8); + writer.WriteNumberValue(UpperMargin); + writer.WritePropertyName("lowerMargin"u8); + writer.WriteNumberValue(LowerMargin); + writer.WritePropertyName("isAnomaly"u8); + writer.WriteBooleanValue(IsAnomaly); + writer.WritePropertyName("isNegativeAnomaly"u8); + writer.WriteBooleanValue(IsNegativeAnomaly); + writer.WritePropertyName("isPositiveAnomaly"u8); + writer.WriteBooleanValue(IsPositiveAnomaly); + if (Optional.IsDefined(Severity)) + { + writer.WritePropertyName("severity"u8); + writer.WriteNumberValue(Severity.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetectionResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +76,7 @@ internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetection bool isNegativeAnomaly = default; bool isPositiveAnomaly = default; Optional severity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("period"u8)) @@ -79,16 +128,61 @@ internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetection severity = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnivariateLastDetectionResult(period, suggestedWindow, expectedValue, upperMargin, lowerMargin, isAnomaly, isNegativeAnomaly, isPositiveAnomaly, Optional.ToNullable(severity), serializedAdditionalRawData); + } + + UnivariateLastDetectionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnivariateLastDetectionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnivariateLastDetectionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnivariateLastDetectionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnivariateLastDetectionResult model) + { + if (model is null) + { + return null; } - return new UnivariateLastDetectionResult(period, suggestedWindow, expectedValue, upperMargin, lowerMargin, isAnomaly, isNegativeAnomaly, isPositiveAnomaly, Optional.ToNullable(severity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UnivariateLastDetectionResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator UnivariateLastDetectionResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnivariateLastDetectionResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnivariateLastDetectionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs index 6c48c794e7eb..3f979079ed2d 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs @@ -5,11 +5,17 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.AnomalyDetector { /// Response of the last anomaly detection. public partial class UnivariateLastDetectionResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of UnivariateLastDetectionResult. /// /// Frequency extracted from the series. Zero means no recurrent pattern has been @@ -86,7 +92,8 @@ internal UnivariateLastDetectionResult(int period, int suggestedWindow, float ex /// Severity score for the last input point. The larger the value is, the more /// severe the anomaly is. For normal points, the severity is always 0. /// - internal UnivariateLastDetectionResult(int period, int suggestedWindow, float expectedValue, float upperMargin, float lowerMargin, bool isAnomaly, bool isNegativeAnomaly, bool isPositiveAnomaly, float? severity) + /// Keeps track of any properties unknown to the library. + internal UnivariateLastDetectionResult(int period, int suggestedWindow, float expectedValue, float upperMargin, float lowerMargin, bool isAnomaly, bool isNegativeAnomaly, bool isPositiveAnomaly, float? severity, Dictionary serializedAdditionalRawData) { Period = period; SuggestedWindow = suggestedWindow; @@ -97,6 +104,12 @@ internal UnivariateLastDetectionResult(int period, int suggestedWindow, float ex IsNegativeAnomaly = isNegativeAnomaly; IsPositiveAnomaly = isPositiveAnomaly; Severity = severity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UnivariateLastDetectionResult() + { } /// diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs index 1b05674d0b05..9e0a0cffdbc5 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs @@ -6,16 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class VariableState : IUtf8JsonSerializable + public partial class VariableState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Variable)) { @@ -42,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("lastTimestamp"u8); writer.WriteStringValue(LastTimestamp.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VariableState DeserializeVariableState(JsonElement element) + internal static VariableState DeserializeVariableState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +76,7 @@ internal static VariableState DeserializeVariableState(JsonElement element) Optional effectiveCount = default; Optional firstTimestamp = default; Optional lastTimestamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("variable"u8)) @@ -99,24 +120,61 @@ internal static VariableState DeserializeVariableState(JsonElement element) lastTimestamp = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VariableState(variable.Value, Optional.ToNullable(filledNARatio), Optional.ToNullable(effectiveCount), Optional.ToNullable(firstTimestamp), Optional.ToNullable(lastTimestamp)); + return new VariableState(variable.Value, Optional.ToNullable(filledNARatio), Optional.ToNullable(effectiveCount), Optional.ToNullable(firstTimestamp), Optional.ToNullable(lastTimestamp), serializedAdditionalRawData); + } + + VariableState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVariableState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static VariableState FromResponse(Response response) + VariableState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeVariableState(document.RootElement); + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVariableState(doc.RootElement, options); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VariableState model) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VariableState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVariableState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs index 8d83fda8ae1b..bd5fa7586783 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs @@ -6,12 +6,16 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.AI.AnomalyDetector { /// Variable status. public partial class VariableState { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of VariableState. public VariableState() { @@ -23,13 +27,15 @@ public VariableState() /// Number of effective data points before fillNAMethod is applied. /// First valid time stamp with a value of input data. /// Last valid time stamp with a value of input data. - internal VariableState(string variable, float? filledNARatio, int? effectiveCount, DateTimeOffset? firstTimestamp, DateTimeOffset? lastTimestamp) + /// Keeps track of any properties unknown to the library. + internal VariableState(string variable, float? filledNARatio, int? effectiveCount, DateTimeOffset? firstTimestamp, DateTimeOffset? lastTimestamp, Dictionary serializedAdditionalRawData) { Variable = variable; FilledNARatio = filledNARatio; EffectiveCount = effectiveCount; FirstTimestamp = firstTimestamp; LastTimestamp = lastTimestamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Variable name in variable states. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs index 404834639dda..3ea0738f9bb7 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.AnomalyDetector { - public partial class VariableValues : IUtf8JsonSerializable + public partial class VariableValues : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("variable"u8); writer.WriteStringValue(Variable); @@ -31,15 +39,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static VariableValues DeserializeVariableValues(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string variable = default; + IList timestamps = default; + IList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("variable"u8)) + { + variable = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamps"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + timestamps = array; + continue; + } + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetSingle()); + } + values = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VariableValues(variable, timestamps, values, serializedAdditionalRawData); + } + + VariableValues IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVariableValues(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VariableValues IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVariableValues(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VariableValues model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VariableValues(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVariableValues(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs index 74e3e3a4ee9a..4c575577800f 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs @@ -15,6 +15,9 @@ namespace Azure.AI.AnomalyDetector /// Variable values. public partial class VariableValues { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of VariableValues. /// Variable name of the last detection request. /// Time stamps of the last detection request. @@ -35,11 +38,18 @@ public VariableValues(string variable, IEnumerable timestamps, IEnumerab /// Variable name of the last detection request. /// Time stamps of the last detection request. /// Values of variables. - internal VariableValues(string variable, IList timestamps, IList values) + /// Keeps track of any properties unknown to the library. + internal VariableValues(string variable, IList timestamps, IList values, Dictionary serializedAdditionalRawData) { Variable = variable; Timestamps = timestamps; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VariableValues() + { } /// Variable name of the last detection request. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs index 8a8d15ccc338..caa523044e0b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs @@ -236,7 +236,7 @@ public virtual AsyncPageable GetAllAsync(string filter = null, int? { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -263,7 +263,7 @@ public virtual Pageable GetAll(string filter = null, int? top = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs index 69fecc9b75ad..bee275064430 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiData : ResourceData { - /// Initializes a new instance of ApiData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiData() { Protocols = new ChangeTrackingList(); } - /// Initializes a new instance of ApiData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -51,7 +54,8 @@ public ApiData() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. - internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -74,6 +78,7 @@ internal ApiData(ResourceIdentifier id, string name, ResourceType resourceType, Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the API. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs index fff6ad568c0e..887772b33cb7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiDiagnosticRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiDiagnosticRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiDiagnosticClientDiagnostics, Pipeline, "ApiDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiDiagnosticClientDiagnostics, Pipeline, "ApiDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, int? { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiDiagnosticRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiDiagnosticRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiDiagnosticClientDiagnostics, Pipeline, "ApiDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiDiagnosticClientDiagnostics, Pipeline, "ApiDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs index b2d2865dd4b4..87da29b5f5bd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiIssueAttachmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiIssueAttachmentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiIssueAttachmentResource(Client, ApiIssueAttachmentData.DeserializeApiIssueAttachmentData(e)), _apiIssueAttachmentClientDiagnostics, Pipeline, "ApiIssueAttachmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiIssueAttachmentResource(Client, ApiIssueAttachmentData.DeserializeApiIssueAttachmentData(e)), _apiIssueAttachmentClientDiagnostics, Pipeline, "ApiIssueAttachmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiIssueAttachmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiIssueAttachmentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiIssueAttachmentResource(Client, ApiIssueAttachmentData.DeserializeApiIssueAttachmentData(e)), _apiIssueAttachmentClientDiagnostics, Pipeline, "ApiIssueAttachmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiIssueAttachmentResource(Client, ApiIssueAttachmentData.DeserializeApiIssueAttachmentData(e)), _apiIssueAttachmentClientDiagnostics, Pipeline, "ApiIssueAttachmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentData.cs index ac0b456fa377..26ed72dbab7e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiIssueAttachmentData : ResourceData { - /// Initializes a new instance of ApiIssueAttachmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiIssueAttachmentData() { } - /// Initializes a new instance of ApiIssueAttachmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,11 +34,13 @@ public ApiIssueAttachmentData() /// Filename by which the binary data will be saved. /// Either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property. /// An HTTP link or Base64-encoded binary data. - internal ApiIssueAttachmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string contentFormat, string content) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiIssueAttachmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string contentFormat, string content, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Title = title; ContentFormat = contentFormat; Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Filename by which the binary data will be saved. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs index 30f702bdb86d..0951620938c7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs @@ -236,7 +236,7 @@ public virtual AsyncPageable GetAllAsync(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiIssueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, expandCommentsAttachments, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiIssueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, expandCommentsAttachments, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiIssueClientDiagnostics, Pipeline, "ApiIssueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiIssueClientDiagnostics, Pipeline, "ApiIssueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -262,7 +262,7 @@ public virtual Pageable GetAll(string filter = null, bool? exp { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiIssueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, expandCommentsAttachments, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiIssueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, expandCommentsAttachments, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiIssueClientDiagnostics, Pipeline, "ApiIssueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiIssueClientDiagnostics, Pipeline, "ApiIssueCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs index 9a477239b530..8f53429c12c7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiIssueCommentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiIssueCommentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiIssueCommentResource(Client, ApiIssueCommentData.DeserializeApiIssueCommentData(e)), _apiIssueCommentClientDiagnostics, Pipeline, "ApiIssueCommentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiIssueCommentResource(Client, ApiIssueCommentData.DeserializeApiIssueCommentData(e)), _apiIssueCommentClientDiagnostics, Pipeline, "ApiIssueCommentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, in { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiIssueCommentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiIssueCommentRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiIssueCommentResource(Client, ApiIssueCommentData.DeserializeApiIssueCommentData(e)), _apiIssueCommentClientDiagnostics, Pipeline, "ApiIssueCommentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiIssueCommentResource(Client, ApiIssueCommentData.DeserializeApiIssueCommentData(e)), _apiIssueCommentClientDiagnostics, Pipeline, "ApiIssueCommentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentData.cs index af0dec57d8e6..162b773dafde 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiIssueCommentData : ResourceData { - /// Initializes a new instance of ApiIssueCommentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiIssueCommentData() { } - /// Initializes a new instance of ApiIssueCommentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +34,13 @@ public ApiIssueCommentData() /// Comment text. /// Date and time when the comment was created. /// A resource identifier for the user who left the comment. - internal ApiIssueCommentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string text, DateTimeOffset? createdOn, ResourceIdentifier userId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiIssueCommentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string text, DateTimeOffset? createdOn, ResourceIdentifier userId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Text = text; CreatedOn = createdOn; UserId = userId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Comment text. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs index 6648a87e8b36..eb140b9c6a62 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementAuthorizationServerAuthorizationServerRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementAuthorizationServerAuthorizationServerRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementAuthorizationServerResource(Client, ApiManagementAuthorizationServerData.DeserializeApiManagementAuthorizationServerData(e)), _apiManagementAuthorizationServerAuthorizationServerClientDiagnostics, Pipeline, "ApiManagementAuthorizationServerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementAuthorizationServerResource(Client, ApiManagementAuthorizationServerData.DeserializeApiManagementAuthorizationServerData(e)), _apiManagementAuthorizationServerAuthorizationServerClientDiagnostics, Pipeline, "ApiManagementAuthorizationServerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementAuthorizationServerAuthorizationServerRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementAuthorizationServerAuthorizationServerRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementAuthorizationServerResource(Client, ApiManagementAuthorizationServerData.DeserializeApiManagementAuthorizationServerData(e)), _apiManagementAuthorizationServerAuthorizationServerClientDiagnostics, Pipeline, "ApiManagementAuthorizationServerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementAuthorizationServerResource(Client, ApiManagementAuthorizationServerData.DeserializeApiManagementAuthorizationServerData(e)), _apiManagementAuthorizationServerAuthorizationServerClientDiagnostics, Pipeline, "ApiManagementAuthorizationServerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs index 30506094dbd9..2145e5f2dc69 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementAuthorizationServerData : ResourceData { - /// Initializes a new instance of ApiManagementAuthorizationServerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementAuthorizationServerData() { AuthorizationMethods = new ChangeTrackingList(); @@ -28,7 +32,7 @@ public ApiManagementAuthorizationServerData() GrantTypes = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementAuthorizationServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +53,8 @@ public ApiManagementAuthorizationServerData() /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; AuthorizationMethods = authorizationMethods; @@ -67,6 +72,7 @@ internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name GrantTypes = grantTypes; ClientId = clientId; ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the authorization server. Can contain HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs index f105537ba369..fa2312924a74 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementBackendBackendRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementBackendBackendRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementBackendResource(Client, ApiManagementBackendData.DeserializeApiManagementBackendData(e)), _apiManagementBackendBackendClientDiagnostics, Pipeline, "ApiManagementBackendCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementBackendResource(Client, ApiManagementBackendData.DeserializeApiManagementBackendData(e)), _apiManagementBackendBackendClientDiagnostics, Pipeline, "ApiManagementBackendCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementBackendBackendRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementBackendBackendRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementBackendResource(Client, ApiManagementBackendData.DeserializeApiManagementBackendData(e)), _apiManagementBackendBackendClientDiagnostics, Pipeline, "ApiManagementBackendCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementBackendResource(Client, ApiManagementBackendData.DeserializeApiManagementBackendData(e)), _apiManagementBackendBackendClientDiagnostics, Pipeline, "ApiManagementBackendCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs index 077d2b7296d9..1f8e23605af9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementBackendData : ResourceData { - /// Initializes a new instance of ApiManagementBackendData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementBackendData() { } - /// Initializes a new instance of ApiManagementBackendData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public ApiManagementBackendData() /// Backend TLS Properties. /// Runtime Url of the Backend. /// Backend communication protocol. - internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, Uri uri, BackendProtocol? protocol) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, Uri uri, BackendProtocol? protocol, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Title = title; Description = description; @@ -48,6 +53,7 @@ internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceTy Tls = tls; Uri = uri; Protocol = protocol; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Backend Title. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs index dae6eb5d9080..f6e656245cd4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(int? top = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementCacheCacheRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementCacheCacheRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementCacheResource(Client, ApiManagementCacheData.DeserializeApiManagementCacheData(e)), _apiManagementCacheCacheClientDiagnostics, Pipeline, "ApiManagementCacheCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementCacheResource(Client, ApiManagementCacheData.DeserializeApiManagementCacheData(e)), _apiManagementCacheCacheClientDiagnostics, Pipeline, "ApiManagementCacheCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,7 +256,7 @@ public virtual Pageable GetAll(int? top = null, int? { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementCacheCacheRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementCacheCacheRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementCacheResource(Client, ApiManagementCacheData.DeserializeApiManagementCacheData(e)), _apiManagementCacheCacheClientDiagnostics, Pipeline, "ApiManagementCacheCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementCacheResource(Client, ApiManagementCacheData.DeserializeApiManagementCacheData(e)), _apiManagementCacheCacheClientDiagnostics, Pipeline, "ApiManagementCacheCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheData.cs index ffb182e5148f..d573bece511b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementCacheData : ResourceData { - /// Initializes a new instance of ApiManagementCacheData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementCacheData() { } - /// Initializes a new instance of ApiManagementCacheData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +35,14 @@ public ApiManagementCacheData() /// Runtime connection string to cache. /// Location identifier to use cache from (should be either 'default' or valid Azure region identifier). /// Original uri of entity in external system cache points to. - internal ApiManagementCacheData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string connectionString, string useFromLocation, Uri resourceUri) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementCacheData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string connectionString, string useFromLocation, Uri resourceUri, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; ConnectionString = connectionString; UseFromLocation = useFromLocation; ResourceUri = resourceUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cache description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs index db44f6c664bb..a8c447da12d9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateCollection.cs @@ -235,7 +235,7 @@ public virtual AsyncPageable GetAllAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementCertificateCertificateRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementCertificateCertificateRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementCertificateResource(Client, ApiManagementCertificateData.DeserializeApiManagementCertificateData(e)), _apiManagementCertificateCertificateClientDiagnostics, Pipeline, "ApiManagementCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementCertificateResource(Client, ApiManagementCertificateData.DeserializeApiManagementCertificateData(e)), _apiManagementCertificateCertificateClientDiagnostics, Pipeline, "ApiManagementCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -261,7 +261,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementCertificateCertificateRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementCertificateCertificateRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementCertificateResource(Client, ApiManagementCertificateData.DeserializeApiManagementCertificateData(e)), _apiManagementCertificateCertificateClientDiagnostics, Pipeline, "ApiManagementCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementCertificateResource(Client, ApiManagementCertificateData.DeserializeApiManagementCertificateData(e)), _apiManagementCertificateCertificateClientDiagnostics, Pipeline, "ApiManagementCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateData.cs index a7f5c3fb53c0..abae824b1087 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementCertificateData : ResourceData { - /// Initializes a new instance of ApiManagementCertificateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementCertificateData() { } - /// Initializes a new instance of ApiManagementCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +39,14 @@ public ApiManagementCertificateData() /// /// /// KeyVault location details of the certificate. - internal ApiManagementCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string subject, string thumbprint, DateTimeOffset? expireOn, KeyVaultContractProperties keyVaultDetails) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string subject, string thumbprint, DateTimeOffset? expireOn, KeyVaultContractProperties keyVaultDetails, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Subject = subject; Thumbprint = thumbprint; ExpireOn = expireOn; KeyVaultDetails = keyVaultDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Subject attribute of the certificate. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceData.cs index 78bdf9c3e5f5..56518d036549 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementDeletedServiceData : ResourceData { - /// Initializes a new instance of ApiManagementDeletedServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementDeletedServiceData() { } - /// Initializes a new instance of ApiManagementDeletedServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +35,14 @@ public ApiManagementDeletedServiceData() /// Fully-qualified API Management Service Resource ID. /// UTC Date and Time when the service will be automatically purged. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. /// UTC Timestamp when the service was soft-deleted. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - internal ApiManagementDeletedServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ResourceIdentifier serviceId, DateTimeOffset? scheduledPurgeOn, DateTimeOffset? deletedOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementDeletedServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ResourceIdentifier serviceId, DateTimeOffset? scheduledPurgeOn, DateTimeOffset? deletedOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; ServiceId = serviceId; ScheduledPurgeOn = scheduledPurgeOn; DeletedOn = deletedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// API Management Service Master Location. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs index 6d017a1d7646..2da39aa67f10 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementDiagnosticDiagnosticRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementDiagnosticDiagnosticRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiManagementDiagnosticDiagnosticClientDiagnostics, Pipeline, "ApiManagementDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiManagementDiagnosticDiagnosticClientDiagnostics, Pipeline, "ApiManagementDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementDiagnosticDiagnosticRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementDiagnosticDiagnosticRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiManagementDiagnosticDiagnosticClientDiagnostics, Pipeline, "ApiManagementDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementDiagnosticResource(Client, DiagnosticContractData.DeserializeDiagnosticContractData(e)), _apiManagementDiagnosticDiagnosticClientDiagnostics, Pipeline, "ApiManagementDiagnosticCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs index 9e92578e0535..de6fe5bc0157 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateCollection.cs @@ -222,7 +222,7 @@ public virtual AsyncPageable GetAllAsync(str { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementEmailTemplateEmailTemplateRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementEmailTemplateEmailTemplateRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementEmailTemplateResource(Client, ApiManagementEmailTemplateData.DeserializeApiManagementEmailTemplateData(e)), _apiManagementEmailTemplateEmailTemplateClientDiagnostics, Pipeline, "ApiManagementEmailTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementEmailTemplateResource(Client, ApiManagementEmailTemplateData.DeserializeApiManagementEmailTemplateData(e)), _apiManagementEmailTemplateEmailTemplateClientDiagnostics, Pipeline, "ApiManagementEmailTemplateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -247,7 +247,7 @@ public virtual Pageable GetAll(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementEmailTemplateEmailTemplateRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementEmailTemplateEmailTemplateRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementEmailTemplateResource(Client, ApiManagementEmailTemplateData.DeserializeApiManagementEmailTemplateData(e)), _apiManagementEmailTemplateEmailTemplateClientDiagnostics, Pipeline, "ApiManagementEmailTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementEmailTemplateResource(Client, ApiManagementEmailTemplateData.DeserializeApiManagementEmailTemplateData(e)), _apiManagementEmailTemplateEmailTemplateClientDiagnostics, Pipeline, "ApiManagementEmailTemplateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateData.cs index 9b3830af871b..7a0db45db2b7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementEmailTemplateData : ResourceData { - /// Initializes a new instance of ApiManagementEmailTemplateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementEmailTemplateData() { Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementEmailTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public ApiManagementEmailTemplateData() /// Description of the Email Template. /// Whether the template is the default template provided by API Management or has been edited. /// Email Template Parameter values. - internal ApiManagementEmailTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string subject, string body, string title, string description, bool? isDefault, IList parameters) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementEmailTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string subject, string body, string title, string description, bool? isDefault, IList parameters, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Subject = subject; Body = body; @@ -43,6 +48,7 @@ internal ApiManagementEmailTemplateData(ResourceIdentifier id, string name, Reso Description = description; IsDefault = isDefault; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Subject of the Template. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs index 926aa62ea5cf..aa3e6ad3a82c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable G { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGatewayCertificateAuthorityResource(Client, ApiManagementGatewayCertificateAuthorityData.DeserializeApiManagementGatewayCertificateAuthorityData(e)), _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityClientDiagnostics, Pipeline, "ApiManagementGatewayCertificateAuthorityCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGatewayCertificateAuthorityResource(Client, ApiManagementGatewayCertificateAuthorityData.DeserializeApiManagementGatewayCertificateAuthorityData(e)), _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityClientDiagnostics, Pipeline, "ApiManagementGatewayCertificateAuthorityCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGatewayCertificateAuthorityResource(Client, ApiManagementGatewayCertificateAuthorityData.DeserializeApiManagementGatewayCertificateAuthorityData(e)), _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityClientDiagnostics, Pipeline, "ApiManagementGatewayCertificateAuthorityCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGatewayCertificateAuthorityResource(Client, ApiManagementGatewayCertificateAuthorityData.DeserializeApiManagementGatewayCertificateAuthorityData(e)), _apiManagementGatewayCertificateAuthorityGatewayCertificateAuthorityClientDiagnostics, Pipeline, "ApiManagementGatewayCertificateAuthorityCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityData.cs index 94abc16e67f3..63d2f820515a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,20 +18,25 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementGatewayCertificateAuthorityData : ResourceData { - /// Initializes a new instance of ApiManagementGatewayCertificateAuthorityData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGatewayCertificateAuthorityData() { } - /// Initializes a new instance of ApiManagementGatewayCertificateAuthorityData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Determines whether certificate authority is trusted. - internal ApiManagementGatewayCertificateAuthorityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isTrusted) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGatewayCertificateAuthorityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isTrusted, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IsTrusted = isTrusted; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Determines whether certificate authority is trusted. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs index c73117527cfa..232431834ee1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGatewayGatewayRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGatewayGatewayRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGatewayResource(Client, ApiManagementGatewayData.DeserializeApiManagementGatewayData(e)), _apiManagementGatewayGatewayClientDiagnostics, Pipeline, "ApiManagementGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGatewayResource(Client, ApiManagementGatewayData.DeserializeApiManagementGatewayData(e)), _apiManagementGatewayGatewayClientDiagnostics, Pipeline, "ApiManagementGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGatewayGatewayRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGatewayGatewayRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGatewayResource(Client, ApiManagementGatewayData.DeserializeApiManagementGatewayData(e)), _apiManagementGatewayGatewayClientDiagnostics, Pipeline, "ApiManagementGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGatewayResource(Client, ApiManagementGatewayData.DeserializeApiManagementGatewayData(e)), _apiManagementGatewayGatewayClientDiagnostics, Pipeline, "ApiManagementGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayData.cs index 7bbd09a6a526..ef5b4dc4cc45 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementGatewayData : ResourceData { - /// Initializes a new instance of ApiManagementGatewayData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGatewayData() { } - /// Initializes a new instance of ApiManagementGatewayData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Gateway location. /// Gateway description. - internal ApiManagementGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceLocationDataContract locationData, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceLocationDataContract locationData, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { LocationData = locationData; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gateway location. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs index 479629df7564..e9aee2f29d20 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGatewayHostnameConfigurationResource(Client, ApiManagementGatewayHostnameConfigurationData.DeserializeApiManagementGatewayHostnameConfigurationData(e)), _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationClientDiagnostics, Pipeline, "ApiManagementGatewayHostnameConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGatewayHostnameConfigurationResource(Client, ApiManagementGatewayHostnameConfigurationData.DeserializeApiManagementGatewayHostnameConfigurationData(e)), _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationClientDiagnostics, Pipeline, "ApiManagementGatewayHostnameConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGatewayHostnameConfigurationResource(Client, ApiManagementGatewayHostnameConfigurationData.DeserializeApiManagementGatewayHostnameConfigurationData(e)), _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationClientDiagnostics, Pipeline, "ApiManagementGatewayHostnameConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGatewayHostnameConfigurationResource(Client, ApiManagementGatewayHostnameConfigurationData.DeserializeApiManagementGatewayHostnameConfigurationData(e)), _apiManagementGatewayHostnameConfigurationGatewayHostnameConfigurationClientDiagnostics, Pipeline, "ApiManagementGatewayHostnameConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationData.cs index 696c3e1114a5..b5c2ccb89cb4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementGatewayHostnameConfigurationData : ResourceData { - /// Initializes a new instance of ApiManagementGatewayHostnameConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGatewayHostnameConfigurationData() { } - /// Initializes a new instance of ApiManagementGatewayHostnameConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,7 +37,8 @@ public ApiManagementGatewayHostnameConfigurationData() /// Specifies if TLS 1.0 is supported. /// Specifies if TLS 1.1 is supported. /// Specifies if HTTP/2.0 is supported. - internal ApiManagementGatewayHostnameConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string hostname, string certificateId, bool? isClientCertificateRequired, bool? isTls10Enabled, bool? isTls11Enabled, bool? isHttp20Enabled) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGatewayHostnameConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string hostname, string certificateId, bool? isClientCertificateRequired, bool? isTls10Enabled, bool? isTls11Enabled, bool? isHttp20Enabled, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Hostname = hostname; CertificateId = certificateId; @@ -40,6 +46,7 @@ internal ApiManagementGatewayHostnameConfigurationData(ResourceIdentifier id, st IsTls1_0Enabled = isTls10Enabled; IsTls1_1Enabled = isTls11Enabled; IsHttp2_0Enabled = isHttp20Enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Hostname value. Supports valid domain name, partial or full wildcard. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs index ffa78bddaf9c..6b196defcd51 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(stri { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs index fba0bbafdd84..9c3748e1f2b8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementGlobalSchemaData : ResourceData { - /// Initializes a new instance of ApiManagementGlobalSchemaData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGlobalSchemaData() { } - /// Initializes a new instance of ApiManagementGlobalSchemaData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,12 +36,14 @@ public ApiManagementGlobalSchemaData() /// Free-form schema entity description. /// Json-encoded string for non json-based schema. /// Global Schema document object for json-based schema formats(e.g. json schema). - internal ApiManagementGlobalSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiSchemaType? schemaType, string description, BinaryData value, BinaryData document) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGlobalSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiSchemaType? schemaType, string description, BinaryData value, BinaryData document, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { SchemaType = schemaType; Description = description; Value = value; Document = document; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Schema Type. Immutable. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs index 101288203fc2..15f19c840b92 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +259,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupData.cs index 48c6e2d3e7cf..2ca47f0fdf8b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementGroupData : ResourceData { - /// Initializes a new instance of ApiManagementGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGroupData() { } - /// Initializes a new instance of ApiManagementGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,13 +37,15 @@ public ApiManagementGroupData() /// true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. /// Group type. /// For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. - internal ApiManagementGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, bool? isBuiltIn, ApiManagementGroupType? groupType, string externalId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, bool? isBuiltIn, ApiManagementGroupType? groupType, string externalId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; IsBuiltIn = isBuiltIn; GroupType = groupType; ExternalId = externalId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Group name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs index 8144d34a6b24..a1bc86f3f49c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderCollection.cs @@ -219,7 +219,7 @@ public virtual AsyncPageable GetAllAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementIdentityProviderIdentityProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementIdentityProviderIdentityProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementIdentityProviderResource(Client, ApiManagementIdentityProviderData.DeserializeApiManagementIdentityProviderData(e)), _apiManagementIdentityProviderIdentityProviderClientDiagnostics, Pipeline, "ApiManagementIdentityProviderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementIdentityProviderResource(Client, ApiManagementIdentityProviderData.DeserializeApiManagementIdentityProviderData(e)), _apiManagementIdentityProviderIdentityProviderClientDiagnostics, Pipeline, "ApiManagementIdentityProviderCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual Pageable GetAll(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementIdentityProviderIdentityProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementIdentityProviderIdentityProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementIdentityProviderResource(Client, ApiManagementIdentityProviderData.DeserializeApiManagementIdentityProviderData(e)), _apiManagementIdentityProviderIdentityProviderClientDiagnostics, Pipeline, "ApiManagementIdentityProviderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementIdentityProviderResource(Client, ApiManagementIdentityProviderData.DeserializeApiManagementIdentityProviderData(e)), _apiManagementIdentityProviderIdentityProviderClientDiagnostics, Pipeline, "ApiManagementIdentityProviderCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs index dc655f288b3a..fc854686b58c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementIdentityProviderData : ResourceData { - /// Initializes a new instance of ApiManagementIdentityProviderData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementIdentityProviderData() { AllowedTenants = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementIdentityProviderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public ApiManagementIdentityProviderData() /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -51,6 +56,7 @@ internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, R PasswordResetPolicyName = passwordResetPolicyName; ClientId = clientId; ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identity Provider Type identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs index e157c1d3b495..bda8a27ab18b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueCollection.cs @@ -149,7 +149,7 @@ public virtual AsyncPageable GetAllAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementIssueIssueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementIssueIssueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiManagementIssueIssueClientDiagnostics, Pipeline, "ApiManagementIssueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiManagementIssueIssueClientDiagnostics, Pipeline, "ApiManagementIssueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -174,7 +174,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementIssueIssueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementIssueIssueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiManagementIssueIssueClientDiagnostics, Pipeline, "ApiManagementIssueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementIssueResource(Client, IssueContractData.DeserializeIssueContractData(e)), _apiManagementIssueIssueClientDiagnostics, Pipeline, "ApiManagementIssueCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs index 12a748fdb3fd..5bb42a91db51 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string fil { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementLoggerLoggerRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementLoggerLoggerRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementLoggerResource(Client, ApiManagementLoggerData.DeserializeApiManagementLoggerData(e)), _apiManagementLoggerLoggerClientDiagnostics, Pipeline, "ApiManagementLoggerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementLoggerResource(Client, ApiManagementLoggerData.DeserializeApiManagementLoggerData(e)), _apiManagementLoggerLoggerClientDiagnostics, Pipeline, "ApiManagementLoggerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementLoggerLoggerRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementLoggerLoggerRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementLoggerResource(Client, ApiManagementLoggerData.DeserializeApiManagementLoggerData(e)), _apiManagementLoggerLoggerClientDiagnostics, Pipeline, "ApiManagementLoggerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementLoggerResource(Client, ApiManagementLoggerData.DeserializeApiManagementLoggerData(e)), _apiManagementLoggerLoggerClientDiagnostics, Pipeline, "ApiManagementLoggerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerData.cs index b9b6fa0e915f..916c4fa0cd87 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementLoggerData : ResourceData { - /// Initializes a new instance of ApiManagementLoggerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementLoggerData() { Credentials = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ApiManagementLoggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,13 +41,15 @@ public ApiManagementLoggerData() /// /// Whether records are buffered in the logger before publishing. Default is assumed to be true. /// Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). - internal ApiManagementLoggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, LoggerType? loggerType, string description, IDictionary credentials, bool? isBuffered, ResourceIdentifier resourceId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementLoggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, LoggerType? loggerType, string description, IDictionary credentials, bool? isBuffered, ResourceIdentifier resourceId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { LoggerType = loggerType; Description = description; Credentials = credentials; IsBuffered = isBuffered; ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Logger type. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs index a9de3624d6d4..02c3d725d52c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs @@ -235,7 +235,7 @@ public virtual AsyncPageable GetAllAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -261,7 +261,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs index a36b37512c11..140002bc028f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementNamedValueData : ResourceData { - /// Initializes a new instance of ApiManagementNamedValueData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementNamedValueData() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementNamedValueData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,13 +38,15 @@ public ApiManagementNamedValueData() /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. - internal ApiManagementNamedValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractProperties keyVaultDetails) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementNamedValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractProperties keyVaultDetails, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Tags = tags; IsSecret = isSecret; DisplayName = displayName; Value = value; KeyVaultDetails = keyVaultDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Optional tags that when provided can be used to filter the NamedValue list. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs index 8752f983ab25..65226f04d9d5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs @@ -213,7 +213,7 @@ public virtual AsyncPageable GetAllAsync(int? { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -237,7 +237,7 @@ public virtual Pageable GetAll(int? top = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationData.cs index 03fa84c32b8b..7aa76ddcdb3b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementNotificationData : ResourceData { - /// Initializes a new instance of ApiManagementNotificationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementNotificationData() { } - /// Initializes a new instance of ApiManagementNotificationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +35,13 @@ public ApiManagementNotificationData() /// Title of the Notification. /// Description of the Notification. /// Recipient Parameter values. - internal ApiManagementNotificationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, RecipientsContractProperties recipients) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementNotificationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, RecipientsContractProperties recipients, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Title = title; Description = description; Recipients = recipients; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Title of the Notification. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs index 5fab5fd523c8..64ffe28e5009 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllA { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementOpenIdConnectProviderOpenIdConnectProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementOpenIdConnectProviderOpenIdConnectProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementOpenIdConnectProviderResource(Client, ApiManagementOpenIdConnectProviderData.DeserializeApiManagementOpenIdConnectProviderData(e)), _apiManagementOpenIdConnectProviderOpenIdConnectProviderClientDiagnostics, Pipeline, "ApiManagementOpenIdConnectProviderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementOpenIdConnectProviderResource(Client, ApiManagementOpenIdConnectProviderData.DeserializeApiManagementOpenIdConnectProviderData(e)), _apiManagementOpenIdConnectProviderOpenIdConnectProviderClientDiagnostics, Pipeline, "ApiManagementOpenIdConnectProviderCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementOpenIdConnectProviderOpenIdConnectProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementOpenIdConnectProviderOpenIdConnectProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementOpenIdConnectProviderResource(Client, ApiManagementOpenIdConnectProviderData.DeserializeApiManagementOpenIdConnectProviderData(e)), _apiManagementOpenIdConnectProviderOpenIdConnectProviderClientDiagnostics, Pipeline, "ApiManagementOpenIdConnectProviderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementOpenIdConnectProviderResource(Client, ApiManagementOpenIdConnectProviderData.DeserializeApiManagementOpenIdConnectProviderData(e)), _apiManagementOpenIdConnectProviderOpenIdConnectProviderClientDiagnostics, Pipeline, "ApiManagementOpenIdConnectProviderCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs index 27c2aa10da60..eeda87b3b39c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementOpenIdConnectProviderData : ResourceData { - /// Initializes a new instance of ApiManagementOpenIdConnectProviderData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementOpenIdConnectProviderData() { } - /// Initializes a new instance of ApiManagementOpenIdConnectProviderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,13 +36,15 @@ public ApiManagementOpenIdConnectProviderData() /// Metadata endpoint URI. /// Client ID of developer console which is the client application. /// Client Secret of developer console which is the client application. - internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, string metadataEndpoint, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, string metadataEndpoint, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; MetadataEndpoint = metadataEndpoint; ClientId = clientId; ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// User-friendly OpenID Connect Provider name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs index 5a4cc477f785..3b085f29b824 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyCollection.cs @@ -220,7 +220,7 @@ public virtual Response Get(PolicyName policyId, Po public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPolicyPolicyRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", null, cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPolicyPolicyRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ApiManagementPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementPolicyPolicyClientDiagnostics, Pipeline, "ApiManagementPolicyCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingData.cs index 0d56092add6e..5a3e8d8c563c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementPortalDelegationSettingData : ResourceData { - /// Initializes a new instance of ApiManagementPortalDelegationSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPortalDelegationSettingData() { } - /// Initializes a new instance of ApiManagementPortalDelegationSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,12 +36,14 @@ public ApiManagementPortalDelegationSettingData() /// A base64-encoded validation key to validate, that a request is coming from Azure API Management. /// Subscriptions delegation settings. /// User registration delegation settings. - internal ApiManagementPortalDelegationSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Uri uri, string validationKey, SubscriptionDelegationSettingProperties subscriptions, RegistrationDelegationSettingProperties userRegistration) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPortalDelegationSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Uri uri, string validationKey, SubscriptionDelegationSettingProperties subscriptions, RegistrationDelegationSettingProperties userRegistration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Uri = uri; ValidationKey = validationKey; Subscriptions = subscriptions; UserRegistration = userRegistration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A delegation Url. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs index edc1165364e2..8dcad68400dd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionCollection.cs @@ -239,7 +239,7 @@ public virtual AsyncPageable GetAllAsync(st { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPortalRevisionPortalRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementPortalRevisionPortalRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementPortalRevisionResource(Client, ApiManagementPortalRevisionData.DeserializeApiManagementPortalRevisionData(e)), _apiManagementPortalRevisionPortalRevisionClientDiagnostics, Pipeline, "ApiManagementPortalRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementPortalRevisionResource(Client, ApiManagementPortalRevisionData.DeserializeApiManagementPortalRevisionData(e)), _apiManagementPortalRevisionPortalRevisionClientDiagnostics, Pipeline, "ApiManagementPortalRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -272,7 +272,7 @@ public virtual Pageable GetAll(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPortalRevisionPortalRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementPortalRevisionPortalRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementPortalRevisionResource(Client, ApiManagementPortalRevisionData.DeserializeApiManagementPortalRevisionData(e)), _apiManagementPortalRevisionPortalRevisionClientDiagnostics, Pipeline, "ApiManagementPortalRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementPortalRevisionResource(Client, ApiManagementPortalRevisionData.DeserializeApiManagementPortalRevisionData(e)), _apiManagementPortalRevisionPortalRevisionClientDiagnostics, Pipeline, "ApiManagementPortalRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs index d6a877f830f3..908845954bb5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementPortalRevisionData : ResourceData { - /// Initializes a new instance of ApiManagementPortalRevisionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPortalRevisionData() { } - /// Initializes a new instance of ApiManagementPortalRevisionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +38,8 @@ public ApiManagementPortalRevisionData() /// Indicates if the portal's revision is public. /// Portal's revision creation date and time. /// Last updated date and time. - internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string statusDetails, PortalRevisionStatus? status, bool? isCurrent, DateTimeOffset? createdOn, DateTimeOffset? updatedOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string statusDetails, PortalRevisionStatus? status, bool? isCurrent, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; StatusDetails = statusDetails; @@ -42,6 +47,7 @@ internal ApiManagementPortalRevisionData(ResourceIdentifier id, string name, Res IsCurrent = isCurrent; CreatedOn = createdOn; UpdatedOn = updatedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Portal revision description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingData.cs index d3b363f351a1..cd29d6aceb46 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,20 +18,25 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementPortalSignInSettingData : ResourceData { - /// Initializes a new instance of ApiManagementPortalSignInSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPortalSignInSettingData() { } - /// Initializes a new instance of ApiManagementPortalSignInSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Redirect Anonymous users to the Sign-In page. - internal ApiManagementPortalSignInSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isRedirectEnabled) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPortalSignInSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isRedirectEnabled, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IsRedirectEnabled = isRedirectEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Redirect Anonymous users to the Sign-In page. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingData.cs index f3a51bcfd02d..48be714fd18f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementPortalSignUpSettingData : ResourceData { - /// Initializes a new instance of ApiManagementPortalSignUpSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPortalSignUpSettingData() { } - /// Initializes a new instance of ApiManagementPortalSignUpSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Allow users to sign up on a developer portal. /// Terms of service contract properties. - internal ApiManagementPortalSignUpSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isSignUpDeveloperPortalEnabled, TermsOfServiceProperties termsOfService) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPortalSignUpSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isSignUpDeveloperPortalEnabled, TermsOfServiceProperties termsOfService, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IsSignUpDeveloperPortalEnabled = isSignUpDeveloperPortalEnabled; TermsOfService = termsOfService; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Allow users to sign up on a developer portal. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs index 84b5504946d8..fbb53ce7b1d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(stri public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiManagementPrivateEndpointConnectionResource(Client, ApiManagementPrivateEndpointConnectionData.DeserializeApiManagementPrivateEndpointConnectionData(e)), _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ApiManagementPrivateEndpointConnectionResource(Client, ApiManagementPrivateEndpointConnectionData.DeserializeApiManagementPrivateEndpointConnectionData(e)), _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable Get public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiManagementPrivateEndpointConnectionResource(Client, ApiManagementPrivateEndpointConnectionData.DeserializeApiManagementPrivateEndpointConnectionData(e)), _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ApiManagementPrivateEndpointConnectionResource(Client, ApiManagementPrivateEndpointConnectionData.DeserializeApiManagementPrivateEndpointConnectionData(e)), _apiManagementPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionData.cs index 515b84d58509..03e4936183b9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of ApiManagementPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPrivateEndpointConnectionData() { } - /// Initializes a new instance of ApiManagementPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public ApiManagementPrivateEndpointConnectionData() /// The resource of private end point. /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. - internal ApiManagementPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, ApiManagementPrivateLinkServiceConnectionState connectionState, ApiManagementPrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, ApiManagementPrivateLinkServiceConnectionState connectionState, ApiManagementPrivateEndpointConnectionProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of private end point. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs index fc890585133e..2de75788516c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string privateLink public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPrivateLinkResourcePrivateEndpointConnectionRestClient.CreateListPrivateLinkResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiManagementPrivateLinkResource(Client, ApiManagementPrivateLinkResourceData.DeserializeApiManagementPrivateLinkResourceData(e)), _apiManagementPrivateLinkResourcePrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ApiManagementPrivateLinkResource(Client, ApiManagementPrivateLinkResourceData.DeserializeApiManagementPrivateLinkResourceData(e)), _apiManagementPrivateLinkResourcePrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync(Cance public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementPrivateLinkResourcePrivateEndpointConnectionRestClient.CreateListPrivateLinkResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiManagementPrivateLinkResource(Client, ApiManagementPrivateLinkResourceData.DeserializeApiManagementPrivateLinkResourceData(e)), _apiManagementPrivateLinkResourcePrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ApiManagementPrivateLinkResource(Client, ApiManagementPrivateLinkResourceData.DeserializeApiManagementPrivateLinkResourceData(e)), _apiManagementPrivateLinkResourcePrivateEndpointConnectionClientDiagnostics, Pipeline, "ApiManagementPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceData.cs index e974c43e27ce..53ea318559fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,14 +18,17 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of ApiManagementPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,11 +36,13 @@ public ApiManagementPrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. - internal ApiManagementPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs index f6d86d96921c..2d04a7a11038 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs @@ -235,7 +235,7 @@ public virtual AsyncPageable GetAllAsync(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -262,7 +262,7 @@ public virtual Pageable GetAll(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductData.cs index afd240e8e631..46744298312c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementProductData : ResourceData { - /// Initializes a new instance of ApiManagementProductData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementProductData() { } - /// Initializes a new instance of ApiManagementProductData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +39,8 @@ public ApiManagementProductData() /// Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. /// whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. /// Product name. - internal ApiManagementProductData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string displayName) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementProductData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string displayName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; Terms = terms; @@ -43,6 +49,7 @@ internal ApiManagementProductData(ResourceIdentifier id, string name, ResourceTy SubscriptionsLimit = subscriptionsLimit; State = state; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Product description. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs index 649391062225..bcdd2b573bda 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs @@ -220,7 +220,7 @@ public virtual Response Get(PolicyName polic public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductPolicyProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", null, cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual AsyncPageable GetAllAsync(Can public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductPolicyProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ApiManagementProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiManagementProductPolicyProductPolicyClientDiagnostics, Pipeline, "ApiManagementProductPolicyCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs index d9f3c488e3d2..d48117d125f9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs @@ -227,7 +227,7 @@ public virtual AsyncPageable GetAllAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductTagTagRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductTagTagRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementProductTagTagClientDiagnostics, Pipeline, "ApiManagementProductTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementProductTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementProductTagTagClientDiagnostics, Pipeline, "ApiManagementProductTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductTagTagRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductTagTagRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementProductTagTagClientDiagnostics, Pipeline, "ApiManagementProductTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementProductTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementProductTagTagClientDiagnostics, Pipeline, "ApiManagementProductTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs index f2d2703eda12..f214264ad5d7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), _apiManagementServiceClientDiagnostics, Pipeline, "ApiManagementServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), _apiManagementServiceClientDiagnostics, Pipeline, "ApiManagementServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), _apiManagementServiceClientDiagnostics, Pipeline, "ApiManagementServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), _apiManagementServiceClientDiagnostics, Pipeline, "ApiManagementServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs index f6e46dc68174..c034d08ae800 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs @@ -21,7 +21,10 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementServiceData : TrackedResourceData { - /// Initializes a new instance of ApiManagementServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// SKU properties of the API Management service. /// Publisher email. @@ -46,7 +49,7 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP PublisherName = publisherName; } - /// Initializes a new instance of ApiManagementServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -85,7 +88,8 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP /// Compute Platform Version running the service in this location. /// Publisher email. /// Publisher name. - internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -119,6 +123,12 @@ internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceTy PlatformVersion = platformVersion; PublisherEmail = publisherEmail; PublisherName = publisherName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApiManagementServiceData() + { } /// SKU properties of the API Management service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs index 25365e617e2e..ce3fe032209f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs @@ -246,7 +246,7 @@ public virtual AsyncPageable GetAllAsync(stri { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementSubscriptionSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementSubscriptionSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementSubscriptionSubscriptionClientDiagnostics, Pipeline, "ApiManagementSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementSubscriptionSubscriptionClientDiagnostics, Pipeline, "ApiManagementSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -271,7 +271,7 @@ public virtual Pageable GetAll(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementSubscriptionSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementSubscriptionSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementSubscriptionSubscriptionClientDiagnostics, Pipeline, "ApiManagementSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementSubscriptionSubscriptionClientDiagnostics, Pipeline, "ApiManagementSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs index 0fd6e35057f2..561a9365e769 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagCollection.cs @@ -235,7 +235,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementTagTagRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, scope); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementTagTagRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, scope); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementTagTagClientDiagnostics, Pipeline, "ApiManagementTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementTagTagClientDiagnostics, Pipeline, "ApiManagementTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -261,7 +261,7 @@ public virtual Pageable GetAll(string filter = null, i { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementTagTagRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, scope); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementTagTagRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, scope); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementTagTagClientDiagnostics, Pipeline, "ApiManagementTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiManagementTagTagClientDiagnostics, Pipeline, "ApiManagementTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs index 68a5a0bf9360..2f909d123599 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingCollection.cs @@ -140,7 +140,7 @@ public virtual AsyncPageable GetAllAsync(str { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementTenantSettingTenantSettingsRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementTenantSettingTenantSettingsRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementTenantSettingResource(Client, ApiManagementTenantSettingData.DeserializeApiManagementTenantSettingData(e)), _apiManagementTenantSettingTenantSettingsClientDiagnostics, Pipeline, "ApiManagementTenantSettingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementTenantSettingResource(Client, ApiManagementTenantSettingData.DeserializeApiManagementTenantSettingData(e)), _apiManagementTenantSettingTenantSettingsClientDiagnostics, Pipeline, "ApiManagementTenantSettingCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -163,7 +163,7 @@ public virtual Pageable GetAll(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementTenantSettingTenantSettingsRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementTenantSettingTenantSettingsRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementTenantSettingResource(Client, ApiManagementTenantSettingData.DeserializeApiManagementTenantSettingData(e)), _apiManagementTenantSettingTenantSettingsClientDiagnostics, Pipeline, "ApiManagementTenantSettingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementTenantSettingResource(Client, ApiManagementTenantSettingData.DeserializeApiManagementTenantSettingData(e)), _apiManagementTenantSettingTenantSettingsClientDiagnostics, Pipeline, "ApiManagementTenantSettingCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingData.cs index e84d9d3564eb..eac7c0c903af 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,21 +18,26 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiManagementTenantSettingData : ResourceData { - /// Initializes a new instance of ApiManagementTenantSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementTenantSettingData() { Settings = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ApiManagementTenantSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Tenant settings. - internal ApiManagementTenantSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary settings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementTenantSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary settings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Settings = settings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Tenant settings. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs index 9e5aaeffa60a..5daed71b4aed 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserCollection.cs @@ -237,7 +237,7 @@ public virtual AsyncPageable GetAllAsync(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementUserUserRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementUserUserRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _apiManagementUserUserClientDiagnostics, Pipeline, "ApiManagementUserCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _apiManagementUserUserClientDiagnostics, Pipeline, "ApiManagementUserCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -263,7 +263,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementUserUserRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementUserUserRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _apiManagementUserUserClientDiagnostics, Pipeline, "ApiManagementUserCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _apiManagementUserUserClientDiagnostics, Pipeline, "ApiManagementUserCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs index 287453f9eafd..573ce09acc3f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs @@ -513,7 +513,7 @@ public virtual AsyncPageable GetUserGroupsAsync(stri { HttpMessage FirstPageRequest(int? pageSizeHint) => _userGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); } /// @@ -538,7 +538,7 @@ public virtual Pageable GetUserGroups(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _userGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs index 8b263e7f70eb..dad6fb1ab55d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionCollection.cs @@ -149,7 +149,7 @@ public virtual AsyncPageable GetAllAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementUserSubscriptionUserSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementUserSubscriptionUserSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementUserSubscriptionUserSubscriptionClientDiagnostics, Pipeline, "ApiManagementUserSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementUserSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementUserSubscriptionUserSubscriptionClientDiagnostics, Pipeline, "ApiManagementUserSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -174,7 +174,7 @@ public virtual Pageable GetAll(string fil { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementUserSubscriptionUserSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementUserSubscriptionUserSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementUserSubscriptionUserSubscriptionClientDiagnostics, Pipeline, "ApiManagementUserSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementUserSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _apiManagementUserSubscriptionUserSubscriptionClientDiagnostics, Pipeline, "ApiManagementUserSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs index dd4ceba88bfe..2ed0bcdc28cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(string filter = n { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -260,7 +260,7 @@ public virtual Pageable GetAll(string filter = null, int? { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationData.cs index 1d4f26378bba..a757c80fa292 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiOperationData : ResourceData { - /// Initializes a new instance of ApiOperationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiOperationData() { TemplateParameters = new ChangeTrackingList(); Responses = new ChangeTrackingList(); } - /// Initializes a new instance of ApiOperationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +42,8 @@ public ApiOperationData() /// Operation Name. /// A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. /// Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - internal ApiOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList templateParameters, string description, RequestContract request, IList responses, string policies, string displayName, string method, string uriTemplate) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList templateParameters, string description, RequestContract request, IList responses, string policies, string displayName, string method, string uriTemplate, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TemplateParameters = templateParameters; Description = description; @@ -48,6 +53,7 @@ internal ApiOperationData(ResourceIdentifier id, string name, ResourceType resou DisplayName = displayName; Method = method; UriTemplate = uriTemplate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of URL template parameters. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs index b8ce7ad654a6..19622e58648e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs @@ -220,7 +220,7 @@ public virtual Response Get(PolicyName policyId, Pol public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationPolicyRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiOperationPolicyClientDiagnostics, Pipeline, "ApiOperationPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiOperationPolicyClientDiagnostics, Pipeline, "ApiOperationPolicyCollection.GetAll", "value", null, cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationPolicyRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiOperationPolicyClientDiagnostics, Pipeline, "ApiOperationPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiOperationPolicyClientDiagnostics, Pipeline, "ApiOperationPolicyCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs index 83e11eaedbd2..7b69a8c37e5f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs @@ -227,7 +227,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationTagTagRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationTagTagRestClient.CreateListByOperationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiOperationTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiOperationTagTagClientDiagnostics, Pipeline, "ApiOperationTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiOperationTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiOperationTagTagClientDiagnostics, Pipeline, "ApiOperationTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string filter = null, in { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationTagTagRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationTagTagRestClient.CreateListByOperationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiOperationTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiOperationTagTagClientDiagnostics, Pipeline, "ApiOperationTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiOperationTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiOperationTagTagClientDiagnostics, Pipeline, "ApiOperationTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs index d272fad3e862..d1451e53766e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs @@ -220,7 +220,7 @@ public virtual Response Get(PolicyName policyId, PolicyExport public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiPolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiPolicyClientDiagnostics, Pipeline, "ApiPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiPolicyClientDiagnostics, Pipeline, "ApiPolicyCollection.GetAll", "value", null, cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken ca public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiPolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiPolicyClientDiagnostics, Pipeline, "ApiPolicyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _apiPolicyClientDiagnostics, Pipeline, "ApiPolicyCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs index 06b41605e221..946cdf3de55f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, int? to { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseData.cs index 8761bc3c4b59..9ea4732836eb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiReleaseData : ResourceData { - /// Initializes a new instance of ApiReleaseData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiReleaseData() { } - /// Initializes a new instance of ApiReleaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +35,14 @@ public ApiReleaseData() /// The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. /// The time the API release was updated. /// Release Notes. - internal ApiReleaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier apiId, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string notes) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiReleaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier apiId, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string notes, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ApiId = apiId; CreatedOn = createdOn; UpdatedOn = updatedOn; Notes = notes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifier of the API the release belongs to. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs index 4cf65f833cf0..a78274d3f304 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs @@ -802,7 +802,7 @@ public virtual AsyncPageable GetApiProductsAsync(s { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiProductRestClient.CreateListByApisRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiProductRestClient.CreateListByApisNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); } /// @@ -827,7 +827,7 @@ public virtual Pageable GetApiProducts(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiProductRestClient.CreateListByApisRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiProductRestClient.CreateListByApisNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs index e1bb445eeee8..e5453d753a1e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filter = null { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, int? top { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs index 337974bf0081..fd5fca87ba45 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiSchemaData : ResourceData { - /// Initializes a new instance of ApiSchemaData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiSchemaData() { } - /// Initializes a new instance of ApiSchemaData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +35,14 @@ public ApiSchemaData() /// Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. /// Types definitions. Used for Swagger/OpenAPI v1 schemas only, null otherwise. /// Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null otherwise. - internal ApiSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string contentType, string value, BinaryData definitions, BinaryData components) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string contentType, string value, BinaryData definitions, BinaryData components, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ContentType = contentType; Value = value; Definitions = definitions; Components = components; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs index badcea2e2ae1..743e7de97548 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs @@ -227,7 +227,7 @@ public virtual AsyncPageable GetAllAsync(string filter = null, i { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiTagTagRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiTagTagRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiTagTagClientDiagnostics, Pipeline, "ApiTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiTagTagClientDiagnostics, Pipeline, "ApiTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string filter = null, int? top = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiTagTagRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiTagTagRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiTagTagClientDiagnostics, Pipeline, "ApiTagCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiTagResource(Client, TagContractData.DeserializeTagContractData(e)), _apiTagTagClientDiagnostics, Pipeline, "ApiTagCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs index 62ce459b364c..4f50000b80b9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiTagDescriptionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiTagDescriptionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiTagDescriptionResource(Client, ApiTagDescriptionData.DeserializeApiTagDescriptionData(e)), _apiTagDescriptionClientDiagnostics, Pipeline, "ApiTagDescriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiTagDescriptionResource(Client, ApiTagDescriptionData.DeserializeApiTagDescriptionData(e)), _apiTagDescriptionClientDiagnostics, Pipeline, "ApiTagDescriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +259,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiTagDescriptionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiTagDescriptionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiTagDescriptionResource(Client, ApiTagDescriptionData.DeserializeApiTagDescriptionData(e)), _apiTagDescriptionClientDiagnostics, Pipeline, "ApiTagDescriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiTagDescriptionResource(Client, ApiTagDescriptionData.DeserializeApiTagDescriptionData(e)), _apiTagDescriptionClientDiagnostics, Pipeline, "ApiTagDescriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionData.cs index ab48ed15449c..e8b235375964 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiTagDescriptionData : ResourceData { - /// Initializes a new instance of ApiTagDescriptionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiTagDescriptionData() { } - /// Initializes a new instance of ApiTagDescriptionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,13 +36,15 @@ public ApiTagDescriptionData() /// Description of the external resources describing the tag. /// Identifier of the tag in the form of /tags/{tagId}. /// Tag name. - internal ApiTagDescriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, Uri externalDocsUri, string externalDocsDescription, string tagId, string displayName) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiTagDescriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, Uri externalDocsUri, string externalDocsDescription, string tagId, string displayName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; ExternalDocsUri = externalDocsUri; ExternalDocsDescription = externalDocsDescription; TagId = tagId; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the Tag. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs index 6f8222ef8dc6..c5c2083a2f7c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, int? { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetData.cs index f848715348fc..ad6439631178 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class ApiVersionSetData : ResourceData { - /// Initializes a new instance of ApiVersionSetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiVersionSetData() { } - /// Initializes a new instance of ApiVersionSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,13 +37,15 @@ public ApiVersionSetData() /// Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. /// Name of API Version Set. /// An value that determines where the API Version identifier will be located in a HTTP request. - internal ApiVersionSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string versionQueryName, string versionHeaderName, string displayName, VersioningScheme? versioningScheme) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiVersionSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string versionQueryName, string versionHeaderName, string displayName, VersioningScheme? versioningScheme, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; VersionQueryName = versionQueryName; VersionHeaderName = versionHeaderName; DisplayName = displayName; VersioningScheme = versioningScheme; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of API Version Set. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs index 71feec144279..b5feb8d150ff 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ArmApiManagementModelFactory.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Model factory for models. public static partial class ArmApiManagementModelFactory { - /// Initializes a new instance of ApiData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,10 +50,10 @@ public static ApiData ApiData(ResourceIdentifier id = null, string name = null, { protocols ??= new List(); - return new ApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet); + return new ApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, default); } - /// Initializes a new instance of ApiEntityBaseContract. + /// Initializes a new instance of . /// Description of the API. May include HTML formatting tags. /// Collection of authentication settings included into this API. /// Protocols over which API is made available. @@ -72,10 +72,78 @@ public static ApiData ApiData(ResourceIdentifier id = null, string name = null, /// A new instance for mocking. public static ApiEntityBaseContract ApiEntityBaseContract(string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null) { - return new ApiEntityBaseContract(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license); + return new ApiEntityBaseContract(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, default); } - /// Initializes a new instance of ApiRevisionContract. + /// Initializes a new instance of . + /// Description of the API. May include HTML formatting tags. + /// Collection of authentication settings included into this API. + /// Protocols over which API is made available. + /// Type of API. + /// Describes the revision of the API. If no value is provided, default revision 1 is created. + /// Indicates the version identifier of the API if the API is versioned. + /// Indicates if API revision is current api revision. + /// Indicates if API revision is accessible via the gateway. + /// Description of the API Revision. + /// Description of the API Version. + /// A resource identifier for the related ApiVersionSet. + /// Specifies whether an API or Product subscription is required for accessing the API. + /// A URL to the Terms of Service for the API. MUST be in the format of a URL. + /// Contact information for the API. + /// License information for the API. + /// API identifier of the source API. + /// API name. Must be 1 to 300 characters long. + /// Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + /// Describes on which protocols the operations in this API can be invoked. + /// Version set details. + /// Content value when Importing an API. + /// Format of the Content in which the API is getting imported. + /// Criteria to limit import of WSDL to a subset of the document. + /// + /// Type of API to create. + /// * `http` creates a REST API + /// * `soap` creates a SOAP pass-through API + /// * `websocket` creates websocket API + /// * `graphql` creates GraphQL API. + /// + /// A new instance for mocking. + public static ApiCreateOrUpdateContent ApiCreateOrUpdateContent(string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, ResourceIdentifier sourceApiId = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null, ApiVersionSetContractDetails apiVersionSet = null, string value = null, ContentFormat? format = null, ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector = null, SoapApiType? soapApiType = null) + { + protocols ??= new List(); + + return new ApiCreateOrUpdateContent(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, value, format, wsdlSelector, soapApiType, default); + } + + /// Initializes a new instance of . + /// Description of the API. May include HTML formatting tags. + /// Collection of authentication settings included into this API. + /// Protocols over which API is made available. + /// Type of API. + /// Describes the revision of the API. If no value is provided, default revision 1 is created. + /// Indicates the version identifier of the API if the API is versioned. + /// Indicates if API revision is current api revision. + /// Indicates if API revision is accessible via the gateway. + /// Description of the API Revision. + /// Description of the API Version. + /// A resource identifier for the related ApiVersionSet. + /// Specifies whether an API or Product subscription is required for accessing the API. + /// A URL to the Terms of Service for the API. MUST be in the format of a URL. + /// Contact information for the API. + /// License information for the API. + /// API name. + /// Absolute URL of the backend service implementing this API. + /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + /// Describes on which protocols the operations in this API can be invoked. + /// A new instance for mocking. + public static ApiPatch ApiPatch(string description = null, AuthenticationSettingsContract authenticationSettings = null, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames = null, ApiType? apiType = null, string apiRevision = null, string apiVersion = null, bool? isCurrent = null, bool? isOnline = null, string apiRevisionDescription = null, string apiVersionDescription = null, ResourceIdentifier apiVersionSetId = null, bool? isSubscriptionRequired = null, Uri termsOfServiceUri = null, ApiContactInformation contact = null, ApiLicenseInformation license = null, string displayName = null, Uri serviceUri = null, string path = null, IEnumerable protocols = null) + { + protocols ??= new List(); + + return new ApiPatch(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, displayName, serviceUri, path, protocols?.ToList(), default); + } + + /// Initializes a new instance of . /// Identifier of the API Revision. /// Revision number of API. /// The time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. @@ -87,10 +155,10 @@ public static ApiEntityBaseContract ApiEntityBaseContract(string description = n /// A new instance for mocking. public static ApiRevisionContract ApiRevisionContract(string apiId = null, string apiRevision = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, string description = null, string privateUriString = null, bool? isOnline = null, bool? isCurrent = null) { - return new ApiRevisionContract(apiId, apiRevision, createdOn, updatedOn, description, privateUriString, isOnline, isCurrent); + return new ApiRevisionContract(apiId, apiRevision, createdOn, updatedOn, description, privateUriString, isOnline, isCurrent, default); } - /// Initializes a new instance of ApiReleaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -102,10 +170,10 @@ public static ApiRevisionContract ApiRevisionContract(string apiId = null, strin /// A new instance for mocking. public static ApiReleaseData ApiReleaseData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier apiId = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, string notes = null) { - return new ApiReleaseData(id, name, resourceType, systemData, apiId, createdOn, updatedOn, notes); + return new ApiReleaseData(id, name, resourceType, systemData, apiId, createdOn, updatedOn, notes, default); } - /// Initializes a new instance of ApiOperationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -124,10 +192,10 @@ public static ApiOperationData ApiOperationData(ResourceIdentifier id = null, st templateParameters ??= new List(); responses ??= new List(); - return new ApiOperationData(id, name, resourceType, systemData, templateParameters?.ToList(), description, request, responses?.ToList(), policies, displayName, method, uriTemplate); + return new ApiOperationData(id, name, resourceType, systemData, templateParameters?.ToList(), description, request, responses?.ToList(), policies, displayName, method, uriTemplate, default); } - /// Initializes a new instance of PolicyContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -137,10 +205,10 @@ public static ApiOperationData ApiOperationData(ResourceIdentifier id = null, st /// A new instance for mocking. public static PolicyContractData PolicyContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, PolicyContentFormat? format = null) { - return new PolicyContractData(id, name, resourceType, systemData, value, format); + return new PolicyContractData(id, name, resourceType, systemData, value, format, default); } - /// Initializes a new instance of TagContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -149,10 +217,10 @@ public static PolicyContractData PolicyContractData(ResourceIdentifier id = null /// A new instance for mocking. public static TagContractData TagContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null) { - return new TagContractData(id, name, resourceType, systemData, displayName); + return new TagContractData(id, name, resourceType, systemData, displayName, default); } - /// Initializes a new instance of ApiManagementProductData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -167,10 +235,10 @@ public static TagContractData TagContractData(ResourceIdentifier id = null, stri /// A new instance for mocking. public static ApiManagementProductData ApiManagementProductData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string terms = null, bool? isSubscriptionRequired = null, bool? isApprovalRequired = null, int? subscriptionsLimit = null, ApiManagementProductState? state = null, string displayName = null) { - return new ApiManagementProductData(id, name, resourceType, systemData, description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, displayName); + return new ApiManagementProductData(id, name, resourceType, systemData, description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, displayName, default); } - /// Initializes a new instance of ProductEntityBaseProperties. + /// Initializes a new instance of . /// Product description. May include HTML formatting tags. /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. /// Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. @@ -180,10 +248,10 @@ public static ApiManagementProductData ApiManagementProductData(ResourceIdentifi /// A new instance for mocking. public static ProductEntityBaseProperties ProductEntityBaseProperties(string description = null, string terms = null, bool? isSubscriptionRequired = null, bool? isApprovalRequired = null, int? subscriptionsLimit = null, ApiManagementProductState? state = null) { - return new ProductEntityBaseProperties(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state); + return new ProductEntityBaseProperties(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, default); } - /// Initializes a new instance of ApiSchemaData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -195,10 +263,10 @@ public static ProductEntityBaseProperties ProductEntityBaseProperties(string des /// A new instance for mocking. public static ApiSchemaData ApiSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string contentType = null, string value = null, BinaryData definitions = null, BinaryData components = null) { - return new ApiSchemaData(id, name, resourceType, systemData, contentType, value, definitions, components); + return new ApiSchemaData(id, name, resourceType, systemData, contentType, value, definitions, components, default); } - /// Initializes a new instance of DiagnosticContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -216,10 +284,10 @@ public static ApiSchemaData ApiSchemaData(ResourceIdentifier id = null, string n /// A new instance for mocking. public static DiagnosticContractData DiagnosticContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AlwaysLog? alwaysLog = null, string loggerId = null, SamplingSettings sampling = null, PipelineDiagnosticSettings frontend = null, PipelineDiagnosticSettings backend = null, bool? isLogClientIPEnabled = null, HttpCorrelationProtocol? httpCorrelationProtocol = null, TraceVerbosityLevel? verbosity = null, OperationNameFormat? operationNameFormat = null, bool? metrics = null) { - return new DiagnosticContractData(id, name, resourceType, systemData, alwaysLog, loggerId, sampling, frontend, backend, isLogClientIPEnabled, httpCorrelationProtocol, verbosity, operationNameFormat, metrics); + return new DiagnosticContractData(id, name, resourceType, systemData, alwaysLog, loggerId, sampling, frontend, backend, isLogClientIPEnabled, httpCorrelationProtocol, verbosity, operationNameFormat, metrics, default); } - /// Initializes a new instance of IssueContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -233,10 +301,10 @@ public static DiagnosticContractData DiagnosticContractData(ResourceIdentifier i /// A new instance for mocking. public static IssueContractData IssueContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? createdOn = null, IssueState? state = null, ResourceIdentifier apiId = null, string title = null, string description = null, ResourceIdentifier userId = null) { - return new IssueContractData(id, name, resourceType, systemData, createdOn, state, apiId, title, description, userId); + return new IssueContractData(id, name, resourceType, systemData, createdOn, state, apiId, title, description, userId, default); } - /// Initializes a new instance of ApiIssueCommentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -247,10 +315,10 @@ public static IssueContractData IssueContractData(ResourceIdentifier id = null, /// A new instance for mocking. public static ApiIssueCommentData ApiIssueCommentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string text = null, DateTimeOffset? createdOn = null, ResourceIdentifier userId = null) { - return new ApiIssueCommentData(id, name, resourceType, systemData, text, createdOn, userId); + return new ApiIssueCommentData(id, name, resourceType, systemData, text, createdOn, userId, default); } - /// Initializes a new instance of ApiIssueAttachmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -261,10 +329,10 @@ public static ApiIssueCommentData ApiIssueCommentData(ResourceIdentifier id = nu /// A new instance for mocking. public static ApiIssueAttachmentData ApiIssueAttachmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string title = null, string contentFormat = null, string content = null) { - return new ApiIssueAttachmentData(id, name, resourceType, systemData, title, contentFormat, content); + return new ApiIssueAttachmentData(id, name, resourceType, systemData, title, contentFormat, content, default); } - /// Initializes a new instance of ApiTagDescriptionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -277,10 +345,10 @@ public static ApiIssueAttachmentData ApiIssueAttachmentData(ResourceIdentifier i /// A new instance for mocking. public static ApiTagDescriptionData ApiTagDescriptionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, Uri externalDocsUri = null, string externalDocsDescription = null, string tagId = null, string displayName = null) { - return new ApiTagDescriptionData(id, name, resourceType, systemData, description, externalDocsUri, externalDocsDescription, tagId, displayName); + return new ApiTagDescriptionData(id, name, resourceType, systemData, description, externalDocsUri, externalDocsDescription, tagId, displayName, default); } - /// Initializes a new instance of TagResourceContractDetails. + /// Initializes a new instance of . /// Tag associated with the resource. /// API associated with the tag. /// Operation associated with the tag. @@ -288,19 +356,19 @@ public static ApiTagDescriptionData ApiTagDescriptionData(ResourceIdentifier id /// A new instance for mocking. public static TagResourceContractDetails TagResourceContractDetails(AssociatedTagProperties tag = null, AssociatedApiProperties api = null, AssociatedOperationProperties operation = null, AssociatedProductProperties product = null) { - return new TagResourceContractDetails(tag, api, operation, product); + return new TagResourceContractDetails(tag, api, operation, product, default); } - /// Initializes a new instance of AssociatedTagProperties. + /// Initializes a new instance of . /// Tag identifier. /// Tag Name. /// A new instance for mocking. public static AssociatedTagProperties AssociatedTagProperties(string id = null, string name = null) { - return new AssociatedTagProperties(id, name); + return new AssociatedTagProperties(id, name, default); } - /// Initializes a new instance of AssociatedApiProperties. + /// Initializes a new instance of . /// Description of the API. May include HTML formatting tags. /// Collection of authentication settings included into this API. /// Protocols over which API is made available. @@ -326,10 +394,10 @@ public static AssociatedApiProperties AssociatedApiProperties(string description { protocols ??= new List(); - return new AssociatedApiProperties(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, id, name, serviceUri, path, protocols?.ToList()); + return new AssociatedApiProperties(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, id, name, serviceUri, path, protocols?.ToList(), default); } - /// Initializes a new instance of AssociatedOperationProperties. + /// Initializes a new instance of . /// Identifier of the operation in form /operations/{operationId}. /// Operation name. /// API Name. @@ -341,10 +409,10 @@ public static AssociatedApiProperties AssociatedApiProperties(string description /// A new instance for mocking. public static AssociatedOperationProperties AssociatedOperationProperties(string id = null, string name = null, string apiName = null, string apiRevision = null, string apiVersion = null, string description = null, string method = null, string uriTemplate = null) { - return new AssociatedOperationProperties(id, name, apiName, apiRevision, apiVersion, description, method, uriTemplate); + return new AssociatedOperationProperties(id, name, apiName, apiRevision, apiVersion, description, method, uriTemplate, default); } - /// Initializes a new instance of AssociatedProductProperties. + /// Initializes a new instance of . /// Product description. May include HTML formatting tags. /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. /// Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. @@ -356,10 +424,10 @@ public static AssociatedOperationProperties AssociatedOperationProperties(string /// A new instance for mocking. public static AssociatedProductProperties AssociatedProductProperties(string description = null, string terms = null, bool? isSubscriptionRequired = null, bool? isApprovalRequired = null, int? subscriptionsLimit = null, ApiManagementProductState? state = null, string id = null, string name = null) { - return new AssociatedProductProperties(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, id, name); + return new AssociatedProductProperties(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, id, name, default); } - /// Initializes a new instance of ApiVersionSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -372,10 +440,10 @@ public static AssociatedProductProperties AssociatedProductProperties(string des /// A new instance for mocking. public static ApiVersionSetData ApiVersionSetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string versionQueryName = null, string versionHeaderName = null, string displayName = null, VersioningScheme? versioningScheme = null) { - return new ApiVersionSetData(id, name, resourceType, systemData, description, versionQueryName, versionHeaderName, displayName, versioningScheme); + return new ApiVersionSetData(id, name, resourceType, systemData, description, versionQueryName, versionHeaderName, displayName, versioningScheme, default); } - /// Initializes a new instance of ApiManagementAuthorizationServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -405,10 +473,10 @@ public static ApiManagementAuthorizationServerData ApiManagementAuthorizationSer bearerTokenSendingMethods ??= new List(); grantTypes ??= new List(); - return new ApiManagementAuthorizationServerData(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret); + return new ApiManagementAuthorizationServerData(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret, default); } - /// Initializes a new instance of ApiManagementAuthorizationServerPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -438,20 +506,20 @@ public static ApiManagementAuthorizationServerPatch ApiManagementAuthorizationSe bearerTokenSendingMethods ??= new List(); grantTypes ??= new List(); - return new ApiManagementAuthorizationServerPatch(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret); + return new ApiManagementAuthorizationServerPatch(id, name, resourceType, systemData, description, authorizationMethods?.ToList(), clientAuthenticationMethods?.ToList(), tokenBodyParameters?.ToList(), tokenEndpoint, doesSupportState, defaultScope, bearerTokenSendingMethods?.ToList(), resourceOwnerUsername, resourceOwnerPassword, displayName, clientRegistrationEndpoint, authorizationEndpoint, grantTypes?.ToList(), clientId, clientSecret, default); } - /// Initializes a new instance of AuthorizationServerSecretsContract. + /// Initializes a new instance of . /// oAuth Authorization Server Secrets. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// A new instance for mocking. public static AuthorizationServerSecretsContract AuthorizationServerSecretsContract(string clientSecret = null, string resourceOwnerUsername = null, string resourceOwnerPassword = null) { - return new AuthorizationServerSecretsContract(clientSecret, resourceOwnerUsername, resourceOwnerPassword); + return new AuthorizationServerSecretsContract(clientSecret, resourceOwnerUsername, resourceOwnerPassword, default); } - /// Initializes a new instance of ApiManagementBackendData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -468,10 +536,10 @@ public static AuthorizationServerSecretsContract AuthorizationServerSecretsContr /// A new instance for mocking. public static ApiManagementBackendData ApiManagementBackendData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string title = null, string description = null, Uri resourceUri = null, BackendServiceFabricClusterProperties backendServiceFabricCluster = null, BackendCredentialsContract credentials = null, BackendProxyContract proxy = null, BackendTlsProperties tls = null, Uri uri = null, BackendProtocol? protocol = null) { - return new ApiManagementBackendData(id, name, resourceType, systemData, title, description, resourceUri, backendServiceFabricCluster != null ? new BackendProperties(backendServiceFabricCluster) : null, credentials, proxy, tls, uri, protocol); + return new ApiManagementBackendData(id, name, resourceType, systemData, title, description, resourceUri, backendServiceFabricCluster != null ? new BackendProperties(backendServiceFabricCluster, new Dictionary()) : null, credentials, proxy, tls, uri, protocol, default); } - /// Initializes a new instance of BackendReconnectContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -480,10 +548,10 @@ public static ApiManagementBackendData ApiManagementBackendData(ResourceIdentifi /// A new instance for mocking. public static BackendReconnectContract BackendReconnectContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TimeSpan? after = null) { - return new BackendReconnectContract(id, name, resourceType, systemData, after); + return new BackendReconnectContract(id, name, resourceType, systemData, after, default); } - /// Initializes a new instance of ApiManagementCacheData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -495,10 +563,10 @@ public static BackendReconnectContract BackendReconnectContract(ResourceIdentifi /// A new instance for mocking. public static ApiManagementCacheData ApiManagementCacheData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string connectionString = null, string useFromLocation = null, Uri resourceUri = null) { - return new ApiManagementCacheData(id, name, resourceType, systemData, description, connectionString, useFromLocation, resourceUri); + return new ApiManagementCacheData(id, name, resourceType, systemData, description, connectionString, useFromLocation, resourceUri, default); } - /// Initializes a new instance of ApiManagementCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -513,10 +581,31 @@ public static ApiManagementCacheData ApiManagementCacheData(ResourceIdentifier i /// A new instance for mocking. public static ApiManagementCertificateData ApiManagementCertificateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string subject = null, string thumbprint = null, DateTimeOffset? expireOn = null, KeyVaultContractProperties keyVaultDetails = null) { - return new ApiManagementCertificateData(id, name, resourceType, systemData, subject, thumbprint, expireOn, keyVaultDetails); + return new ApiManagementCertificateData(id, name, resourceType, systemData, subject, thumbprint, expireOn, keyVaultDetails, default); + } + + /// Initializes a new instance of . + /// Definitions about the connectivity check origin. + /// The connectivity check operation destination. + /// The IP version to be used. Only IPv4 is supported for now. + /// The request's protocol. Specific protocol configuration can be available based on this selection. The specified destination address must be coherent with this value. + /// Protocol-specific configuration. + /// A new instance for mocking. + public static ConnectivityCheckContent ConnectivityCheckContent(ConnectivityCheckRequestSource source = null, ConnectivityCheckRequestDestination destination = null, PreferredIPVersion? preferredIPVersion = null, ConnectivityCheckProtocol? protocol = null, ConnectivityCheckRequestHttpConfiguration protocolHttpConfiguration = null) + { + return new ConnectivityCheckContent(source, destination, preferredIPVersion, protocol, protocolHttpConfiguration != null ? new ConnectivityCheckRequestProtocolConfiguration(protocolHttpConfiguration, new Dictionary()) : null, default); + } + + /// Initializes a new instance of . + /// The API Management service region from where to start the connectivity check operation. + /// The particular VMSS instance from which to fire the request. + /// A new instance for mocking. + public static ConnectivityCheckRequestSource ConnectivityCheckRequestSource(string region = null, long? instance = null) + { + return new ConnectivityCheckRequestSource(region, instance, default); } - /// Initializes a new instance of ConnectivityCheckResult. + /// Initializes a new instance of . /// List of hops between the source and the destination. /// The connection status. /// Average latency in milliseconds. @@ -529,10 +618,10 @@ public static ConnectivityCheckResult ConnectivityCheckResult(IEnumerable(); - return new ConnectivityCheckResult(hops?.ToList(), connectionStatus, avgLatencyInMs, minLatencyInMs, maxLatencyInMs, probesSent, probesFailed); + return new ConnectivityCheckResult(hops?.ToList(), connectionStatus, avgLatencyInMs, minLatencyInMs, maxLatencyInMs, probesSent, probesFailed, default); } - /// Initializes a new instance of ConnectivityHop. + /// Initializes a new instance of . /// The type of the hop. /// The ID of the hop. /// The IP address of the hop. @@ -545,10 +634,10 @@ public static ConnectivityHop ConnectivityHop(string connectivityHopType = null, nextHopIds ??= new List(); issues ??= new List(); - return new ConnectivityHop(connectivityHopType, id, address, resourceId, nextHopIds?.ToList(), issues?.ToList()); + return new ConnectivityHop(connectivityHopType, id, address, resourceId, nextHopIds?.ToList(), issues?.ToList(), default); } - /// Initializes a new instance of ConnectivityIssue. + /// Initializes a new instance of . /// The origin of the issue. /// The severity of the issue. /// The type of issue. @@ -558,10 +647,10 @@ public static ConnectivityIssue ConnectivityIssue(IssueOrigin? origin = null, Is { context ??= new List>(); - return new ConnectivityIssue(origin, severity, issueType, context?.ToList()); + return new ConnectivityIssue(origin, severity, issueType, context?.ToList(), default); } - /// Initializes a new instance of ApiManagementDeletedServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -573,20 +662,20 @@ public static ConnectivityIssue ConnectivityIssue(IssueOrigin? origin = null, Is /// A new instance for mocking. public static ApiManagementDeletedServiceData ApiManagementDeletedServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ResourceIdentifier serviceId = null, DateTimeOffset? scheduledPurgeOn = null, DateTimeOffset? deletedOn = null) { - return new ApiManagementDeletedServiceData(id, name, resourceType, systemData, location, serviceId, scheduledPurgeOn, deletedOn); + return new ApiManagementDeletedServiceData(id, name, resourceType, systemData, location, serviceId, scheduledPurgeOn, deletedOn, default); } - /// Initializes a new instance of AvailableApiManagementServiceSkuResult. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// Specifies API Management SKU. /// Specifies the number of API Management units. /// A new instance for mocking. public static AvailableApiManagementServiceSkuResult AvailableApiManagementServiceSkuResult(ResourceType? resourceType = null, ApiManagementServiceSkuType? skuName = null, ApiManagementResourceSkuCapacity capacity = null) { - return new AvailableApiManagementServiceSkuResult(resourceType, skuName != null ? new ResourceSku(skuName) : null, capacity); + return new AvailableApiManagementServiceSkuResult(resourceType, skuName != null ? new ResourceSku(skuName, new Dictionary()) : null, capacity, default); } - /// Initializes a new instance of ApiManagementResourceSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. @@ -594,10 +683,23 @@ public static AvailableApiManagementServiceSkuResult AvailableApiManagementServi /// A new instance for mocking. public static ApiManagementResourceSkuCapacity ApiManagementResourceSkuCapacity(int? minimum = null, int? maximum = null, int? @default = null, ApiManagementResourceSkuCapacityScaleType? scaleType = null) { - return new ApiManagementResourceSkuCapacity(minimum, maximum, @default, scaleType); + return new ApiManagementResourceSkuCapacity(minimum, maximum, @default, scaleType, default); + } + + /// Initializes a new instance of . + /// The name of the Azure storage account (used to place/retrieve the backup). + /// The name of the blob container (used to place/retrieve the backup). + /// The name of the backup file to create/retrieve. + /// The type of access to be used for the storage account. + /// Storage account access key. Required only if `accessType` is set to `AccessKey`. + /// The Client ID of user assigned managed identity. Required only if `accessType` is set to `UserAssignedManagedIdentity`. + /// A new instance for mocking. + public static ApiManagementServiceBackupRestoreContent ApiManagementServiceBackupRestoreContent(string storageAccount = null, string containerName = null, string backupName = null, StorageAccountAccessType? accessType = null, string accessKey = null, string clientId = null) + { + return new ApiManagementServiceBackupRestoreContent(storageAccount, containerName, backupName, accessType, accessKey, clientId, default); } - /// Initializes a new instance of ApiManagementServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -649,20 +751,20 @@ public static ApiManagementServiceData ApiManagementServiceData(ResourceIdentifi certificates ??= new List(); privateEndpointConnections ??= new List(); - return new ApiManagementServiceData(id, name, resourceType, systemData, tags, location, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion) : null, restore, privateEndpointConnections?.ToList(), platformVersion, publisherEmail, publisherName); + return new ApiManagementServiceData(id, name, resourceType, systemData, tags, location, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion, new Dictionary()) : null, restore, privateEndpointConnections?.ToList(), platformVersion, publisherEmail, publisherName, default); } - /// Initializes a new instance of VirtualNetworkConfiguration. + /// Initializes a new instance of . /// The virtual network ID. This is typically a GUID. Expect a null GUID by default. /// The name of the subnet. /// The full resource ID of a subnet in a virtual network to deploy the API Management service in. /// A new instance for mocking. public static VirtualNetworkConfiguration VirtualNetworkConfiguration(Guid? vnetId = null, string subnetname = null, ResourceIdentifier subnetResourceId = null) { - return new VirtualNetworkConfiguration(vnetId, subnetname, subnetResourceId); + return new VirtualNetworkConfiguration(vnetId, subnetname, subnetResourceId, default); } - /// Initializes a new instance of AdditionalLocation. + /// Initializes a new instance of . /// The location name of the additional region among Azure Data center regions. /// SKU properties of the API Management service. /// A list of availability zones denoting where the resource needs to come from. @@ -680,10 +782,10 @@ public static AdditionalLocation AdditionalLocation(AzureLocation location = def publicIPAddresses ??= new List(); privateIPAddresses ??= new List(); - return new AdditionalLocation(location, sku, zones?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, virtualNetworkConfiguration, gatewayRegionalUri, disableGateway, platformVersion); + return new AdditionalLocation(location, sku, zones?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, virtualNetworkConfiguration, gatewayRegionalUri, disableGateway, platformVersion, default); } - /// Initializes a new instance of RemotePrivateEndpointConnectionWrapper. + /// Initializes a new instance of . /// Private Endpoint connection resource id. /// Private Endpoint Connection Name. /// Private Endpoint Connection Resource Type. @@ -696,10 +798,10 @@ public static RemotePrivateEndpointConnectionWrapper RemotePrivateEndpointConnec { groupIds ??= new List(); - return new RemotePrivateEndpointConnectionWrapper(id, name, resourceType, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, privateLinkServiceConnectionState, provisioningState, groupIds?.ToList()); + return new RemotePrivateEndpointConnectionWrapper(id, name, resourceType, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, privateLinkServiceConnectionState, provisioningState, groupIds?.ToList(), default); } - /// Initializes a new instance of ApiManagementServicePatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -750,36 +852,36 @@ public static ApiManagementServicePatch ApiManagementServicePatch(ResourceIdenti privateEndpointConnections ??= new List(); tags ??= new Dictionary(); - return new ApiManagementServicePatch(id, name, resourceType, systemData, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion) : null, restore, privateEndpointConnections?.ToList(), platformVersion, publisherEmail, publisherName, tags); + return new ApiManagementServicePatch(id, name, resourceType, systemData, sku, identity, etag, zones?.ToList(), notificationSenderEmail, provisioningState, targetProvisioningState, createdAtUtc, gatewayUri, gatewayRegionalUri, portalUri, managementApiUri, scmUri, developerPortalUri, hostnameConfigurations?.ToList(), publicIPAddresses?.ToList(), privateIPAddresses?.ToList(), publicIPAddressId, publicNetworkAccess, virtualNetworkConfiguration, additionalLocations?.ToList(), customProperties, certificates?.ToList(), enableClientCertificate, disableGateway, virtualNetworkType, minApiVersion != null ? new ApiVersionConstraint(minApiVersion, new Dictionary()) : null, restore, privateEndpointConnections?.ToList(), platformVersion, publisherEmail, publisherName, tags, default); } - /// Initializes a new instance of ApiManagementServiceGetSsoTokenResult. + /// Initializes a new instance of . /// Redirect URL to the Publisher Portal containing the SSO token. /// A new instance for mocking. public static ApiManagementServiceGetSsoTokenResult ApiManagementServiceGetSsoTokenResult(Uri redirectUri = null) { - return new ApiManagementServiceGetSsoTokenResult(redirectUri); + return new ApiManagementServiceGetSsoTokenResult(redirectUri, default); } - /// Initializes a new instance of ApiManagementServiceNameAvailabilityResult. + /// Initializes a new instance of . /// True if the name is available and can be used to create a new API Management service; otherwise false. /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that <resourceName> is already in use, and direct them to select a different name. /// Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. /// A new instance for mocking. public static ApiManagementServiceNameAvailabilityResult ApiManagementServiceNameAvailabilityResult(bool? isNameAvailable = null, string message = null, ApiManagementServiceNameUnavailableReason? reason = null) { - return new ApiManagementServiceNameAvailabilityResult(isNameAvailable, message, reason); + return new ApiManagementServiceNameAvailabilityResult(isNameAvailable, message, reason, default); } - /// Initializes a new instance of ApiManagementServiceGetDomainOwnershipIdentifierResult. + /// Initializes a new instance of . /// The domain ownership identifier value. /// A new instance for mocking. public static ApiManagementServiceGetDomainOwnershipIdentifierResult ApiManagementServiceGetDomainOwnershipIdentifierResult(string domainOwnershipIdentifier = null) { - return new ApiManagementServiceGetDomainOwnershipIdentifierResult(domainOwnershipIdentifier); + return new ApiManagementServiceGetDomainOwnershipIdentifierResult(domainOwnershipIdentifier, default); } - /// Initializes a new instance of ApiManagementEmailTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -795,10 +897,10 @@ public static ApiManagementEmailTemplateData ApiManagementEmailTemplateData(Reso { parameters ??= new List(); - return new ApiManagementEmailTemplateData(id, name, resourceType, systemData, subject, body, title, description, isDefault, parameters?.ToList()); + return new ApiManagementEmailTemplateData(id, name, resourceType, systemData, subject, body, title, description, isDefault, parameters?.ToList(), default); } - /// Initializes a new instance of ApiManagementGatewayData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -808,27 +910,27 @@ public static ApiManagementEmailTemplateData ApiManagementEmailTemplateData(Reso /// A new instance for mocking. public static ApiManagementGatewayData ApiManagementGatewayData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceLocationDataContract locationData = null, string description = null) { - return new ApiManagementGatewayData(id, name, resourceType, systemData, locationData, description); + return new ApiManagementGatewayData(id, name, resourceType, systemData, locationData, description, default); } - /// Initializes a new instance of GatewayKeysContract. + /// Initializes a new instance of . /// Primary gateway key. /// Secondary gateway key. /// A new instance for mocking. public static GatewayKeysContract GatewayKeysContract(string primary = null, string secondary = null) { - return new GatewayKeysContract(primary, secondary); + return new GatewayKeysContract(primary, secondary, default); } - /// Initializes a new instance of GatewayTokenContract. + /// Initializes a new instance of . /// Shared Access Authentication token value for the Gateway. /// A new instance for mocking. public static GatewayTokenContract GatewayTokenContract(string value = null) { - return new GatewayTokenContract(value); + return new GatewayTokenContract(value, default); } - /// Initializes a new instance of ApiManagementGatewayHostnameConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -842,10 +944,10 @@ public static GatewayTokenContract GatewayTokenContract(string value = null) /// A new instance for mocking. public static ApiManagementGatewayHostnameConfigurationData ApiManagementGatewayHostnameConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string hostname = null, string certificateId = null, bool? isClientCertificateRequired = null, bool? isTls10Enabled = null, bool? isTls11Enabled = null, bool? isHttp20Enabled = null) { - return new ApiManagementGatewayHostnameConfigurationData(id, name, resourceType, systemData, hostname, certificateId, isClientCertificateRequired, isTls10Enabled, isTls11Enabled, isHttp20Enabled); + return new ApiManagementGatewayHostnameConfigurationData(id, name, resourceType, systemData, hostname, certificateId, isClientCertificateRequired, isTls10Enabled, isTls11Enabled, isHttp20Enabled, default); } - /// Initializes a new instance of GatewayApiData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -876,10 +978,10 @@ public static GatewayApiData GatewayApiData(ResourceIdentifier id = null, string { protocols ??= new List(); - return new GatewayApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet); + return new GatewayApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, default); } - /// Initializes a new instance of AssociationContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -888,10 +990,10 @@ public static GatewayApiData GatewayApiData(ResourceIdentifier id = null, string /// A new instance for mocking. public static AssociationContract AssociationContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AssociationEntityProvisioningState? provisioningState = null) { - return new AssociationContract(id, name, resourceType, systemData, provisioningState); + return new AssociationContract(id, name, resourceType, systemData, provisioningState, default); } - /// Initializes a new instance of ApiManagementGatewayCertificateAuthorityData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -900,10 +1002,10 @@ public static AssociationContract AssociationContract(ResourceIdentifier id = nu /// A new instance for mocking. public static ApiManagementGatewayCertificateAuthorityData ApiManagementGatewayCertificateAuthorityData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isTrusted = null) { - return new ApiManagementGatewayCertificateAuthorityData(id, name, resourceType, systemData, isTrusted); + return new ApiManagementGatewayCertificateAuthorityData(id, name, resourceType, systemData, isTrusted, default); } - /// Initializes a new instance of ApiManagementGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -916,10 +1018,10 @@ public static ApiManagementGatewayCertificateAuthorityData ApiManagementGatewayC /// A new instance for mocking. public static ApiManagementGroupData ApiManagementGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string description = null, bool? isBuiltIn = null, ApiManagementGroupType? groupType = null, string externalId = null) { - return new ApiManagementGroupData(id, name, resourceType, systemData, displayName, description, isBuiltIn, groupType, externalId); + return new ApiManagementGroupData(id, name, resourceType, systemData, displayName, description, isBuiltIn, groupType, externalId, default); } - /// Initializes a new instance of GroupContractProperties. + /// Initializes a new instance of . /// Group name. /// Group description. Can contain HTML formatting tags. /// true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. @@ -928,10 +1030,10 @@ public static ApiManagementGroupData ApiManagementGroupData(ResourceIdentifier i /// A new instance for mocking. public static GroupContractProperties GroupContractProperties(string displayName = null, string description = null, bool? isBuiltIn = null, ApiManagementGroupType? apiManagementGroupType = null, string externalId = null) { - return new GroupContractProperties(displayName, description, isBuiltIn, apiManagementGroupType, externalId); + return new GroupContractProperties(displayName, description, isBuiltIn, apiManagementGroupType, externalId, default); } - /// Initializes a new instance of ApiManagementGroupUserData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -953,10 +1055,10 @@ public static ApiManagementGroupUserData ApiManagementGroupUserData(ResourceIden identities ??= new List(); groups ??= new List(); - return new ApiManagementGroupUserData(id, name, resourceType, systemData, state, note, identities?.ToList(), firstName, lastName, email, registriesOn, groups?.ToList()); + return new ApiManagementGroupUserData(id, name, resourceType, systemData, state, note, identities?.ToList(), firstName, lastName, email, registriesOn, groups?.ToList(), default); } - /// Initializes a new instance of UserContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -978,10 +1080,10 @@ public static UserContractData UserContractData(ResourceIdentifier id = null, st identities ??= new List(); groups ??= new List(); - return new UserContractData(id, name, resourceType, systemData, state, note, identities?.ToList(), firstName, lastName, email, registriesOn, groups?.ToList()); + return new UserContractData(id, name, resourceType, systemData, state, note, identities?.ToList(), firstName, lastName, email, registriesOn, groups?.ToList(), default); } - /// Initializes a new instance of ApiManagementIdentityProviderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1001,10 +1103,10 @@ public static ApiManagementIdentityProviderData ApiManagementIdentityProviderDat { allowedTenants ??= new List(); - return new ApiManagementIdentityProviderData(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientId, clientSecret); + return new ApiManagementIdentityProviderData(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientId, clientSecret, default); } - /// Initializes a new instance of ApiManagementIdentityProviderCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1024,18 +1126,18 @@ public static ApiManagementIdentityProviderCreateOrUpdateContent ApiManagementId { allowedTenants ??= new List(); - return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientId, clientSecret); + return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, resourceType, systemData, identityProviderType, signInTenant, allowedTenants?.ToList(), authority, signUpPolicyName, signInPolicyName, profileEditingPolicyName, passwordResetPolicyName, clientId, clientSecret, default); } - /// Initializes a new instance of ClientSecretContract. + /// Initializes a new instance of . /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. /// A new instance for mocking. public static ClientSecretContract ClientSecretContract(string clientSecret = null) { - return new ClientSecretContract(clientSecret); + return new ClientSecretContract(clientSecret, default); } - /// Initializes a new instance of ApiManagementLoggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1053,10 +1155,10 @@ public static ApiManagementLoggerData ApiManagementLoggerData(ResourceIdentifier { credentials ??= new Dictionary(); - return new ApiManagementLoggerData(id, name, resourceType, systemData, loggerType, description, credentials, isBuffered, resourceId); + return new ApiManagementLoggerData(id, name, resourceType, systemData, loggerType, description, credentials, isBuffered, resourceId, default); } - /// Initializes a new instance of ApiManagementNamedValueData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1071,10 +1173,10 @@ public static ApiManagementNamedValueData ApiManagementNamedValueData(ResourceId { tags ??= new List(); - return new ApiManagementNamedValueData(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVaultDetails); + return new ApiManagementNamedValueData(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVaultDetails, default); } - /// Initializes a new instance of ApiManagementNamedValueCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1089,27 +1191,27 @@ public static ApiManagementNamedValueCreateOrUpdateContent ApiManagementNamedVal { tags ??= new List(); - return new ApiManagementNamedValueCreateOrUpdateContent(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVault); + return new ApiManagementNamedValueCreateOrUpdateContent(id, name, resourceType, systemData, tags?.ToList(), isSecret, displayName, value, keyVault, default); } - /// Initializes a new instance of NamedValueSecretContract. + /// Initializes a new instance of . /// This is secret value of the NamedValue entity. /// A new instance for mocking. public static NamedValueSecretContract NamedValueSecretContract(string value = null) { - return new NamedValueSecretContract(value); + return new NamedValueSecretContract(value, default); } - /// Initializes a new instance of NetworkStatusContractWithLocation. + /// Initializes a new instance of . /// Location of service. /// Network status in Location. /// A new instance for mocking. public static NetworkStatusContractWithLocation NetworkStatusContractWithLocation(AzureLocation? location = null, NetworkStatusContract networkStatus = null) { - return new NetworkStatusContractWithLocation(location, networkStatus); + return new NetworkStatusContractWithLocation(location, networkStatus, default); } - /// Initializes a new instance of NetworkStatusContract. + /// Initializes a new instance of . /// Gets the list of DNS servers IPV4 addresses. /// Gets the list of Connectivity Status to the Resources on which the service depends upon. /// A new instance for mocking. @@ -1118,10 +1220,10 @@ public static NetworkStatusContract NetworkStatusContract(IEnumerable dn dnsServers ??= new List(); connectivityStatus ??= new List(); - return new NetworkStatusContract(dnsServers?.ToList(), connectivityStatus?.ToList()); + return new NetworkStatusContract(dnsServers?.ToList(), connectivityStatus?.ToList(), default); } - /// Initializes a new instance of ConnectivityStatusContract. + /// Initializes a new instance of . /// The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. /// Resource Connectivity Status Type identifier. /// Error details of the connectivity to the resource. @@ -1138,10 +1240,10 @@ public static NetworkStatusContract NetworkStatusContract(IEnumerable dn /// A new instance for mocking. public static ConnectivityStatusContract ConnectivityStatusContract(string name = null, ConnectivityStatusType status = default, string error = null, DateTimeOffset lastUpdatedOn = default, DateTimeOffset lastStatusChangedOn = default, string resourceType = null, bool isOptional = default) { - return new ConnectivityStatusContract(name, status, error, lastUpdatedOn, lastStatusChangedOn, resourceType, isOptional); + return new ConnectivityStatusContract(name, status, error, lastUpdatedOn, lastStatusChangedOn, resourceType, isOptional, default); } - /// Initializes a new instance of ApiManagementNotificationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1152,10 +1254,10 @@ public static ConnectivityStatusContract ConnectivityStatusContract(string name /// A new instance for mocking. public static ApiManagementNotificationData ApiManagementNotificationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string title = null, string description = null, RecipientsContractProperties recipients = null) { - return new ApiManagementNotificationData(id, name, resourceType, systemData, title, description, recipients); + return new ApiManagementNotificationData(id, name, resourceType, systemData, title, description, recipients, default); } - /// Initializes a new instance of RecipientUserContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1164,10 +1266,10 @@ public static ApiManagementNotificationData ApiManagementNotificationData(Resour /// A new instance for mocking. public static RecipientUserContract RecipientUserContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string userId = null) { - return new RecipientUserContract(id, name, resourceType, systemData, userId); + return new RecipientUserContract(id, name, resourceType, systemData, userId, default); } - /// Initializes a new instance of RecipientEmailContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1176,10 +1278,10 @@ public static RecipientUserContract RecipientUserContract(ResourceIdentifier id /// A new instance for mocking. public static RecipientEmailContract RecipientEmailContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string email = null) { - return new RecipientEmailContract(id, name, resourceType, systemData, email); + return new RecipientEmailContract(id, name, resourceType, systemData, email, default); } - /// Initializes a new instance of ApiManagementOpenIdConnectProviderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1192,10 +1294,10 @@ public static RecipientEmailContract RecipientEmailContract(ResourceIdentifier i /// A new instance for mocking. public static ApiManagementOpenIdConnectProviderData ApiManagementOpenIdConnectProviderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string description = null, string metadataEndpoint = null, string clientId = null, string clientSecret = null) { - return new ApiManagementOpenIdConnectProviderData(id, name, resourceType, systemData, displayName, description, metadataEndpoint, clientId, clientSecret); + return new ApiManagementOpenIdConnectProviderData(id, name, resourceType, systemData, displayName, description, metadataEndpoint, clientId, clientSecret, default); } - /// Initializes a new instance of OutboundEnvironmentEndpoint. + /// Initializes a new instance of . /// The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. /// The endpoints that the Api Management Service reaches the service at. /// A new instance for mocking. @@ -1203,10 +1305,10 @@ public static OutboundEnvironmentEndpoint OutboundEnvironmentEndpoint(string cat { endpoints ??= new List(); - return new OutboundEnvironmentEndpoint(category, endpoints?.ToList()); + return new OutboundEnvironmentEndpoint(category, endpoints?.ToList(), default); } - /// Initializes a new instance of EndpointDependency. + /// Initializes a new instance of . /// The domain name of the dependency. /// The Ports used when connecting to DomainName. /// A new instance for mocking. @@ -1214,19 +1316,19 @@ public static EndpointDependency EndpointDependency(string domainName = null, IE { endpointDetails ??= new List(); - return new EndpointDependency(domainName, endpointDetails?.ToList()); + return new EndpointDependency(domainName, endpointDetails?.ToList(), default); } - /// Initializes a new instance of EndpointDetail. + /// Initializes a new instance of . /// The port an endpoint is connected to. /// The region of the dependency. /// A new instance for mocking. public static EndpointDetail EndpointDetail(int? port = null, string region = null) { - return new EndpointDetail(port, region); + return new EndpointDetail(port, region, default); } - /// Initializes a new instance of PolicyDescriptionContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1236,10 +1338,10 @@ public static EndpointDetail EndpointDetail(int? port = null, string region = nu /// A new instance for mocking. public static PolicyDescriptionContractData PolicyDescriptionContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, long? scope = null) { - return new PolicyDescriptionContractData(id, name, resourceType, systemData, description, scope); + return new PolicyDescriptionContractData(id, name, resourceType, systemData, description, scope, default); } - /// Initializes a new instance of ApiManagementPortalRevisionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1253,10 +1355,10 @@ public static PolicyDescriptionContractData PolicyDescriptionContractData(Resour /// A new instance for mocking. public static ApiManagementPortalRevisionData ApiManagementPortalRevisionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string statusDetails = null, PortalRevisionStatus? status = null, bool? isCurrent = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null) { - return new ApiManagementPortalRevisionData(id, name, resourceType, systemData, description, statusDetails, status, isCurrent, createdOn, updatedOn); + return new ApiManagementPortalRevisionData(id, name, resourceType, systemData, description, statusDetails, status, isCurrent, createdOn, updatedOn, default); } - /// Initializes a new instance of PortalSettingsContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1270,10 +1372,10 @@ public static ApiManagementPortalRevisionData ApiManagementPortalRevisionData(Re /// A new instance for mocking. public static PortalSettingsContractData PortalSettingsContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Uri uri = null, string validationKey = null, bool? isSubscriptionDelegationEnabled = null, bool? isUserRegistrationDelegationEnabled = null, bool? isRedirectEnabled = null, TermsOfServiceProperties termsOfService = null) { - return new PortalSettingsContractData(id, name, resourceType, systemData, uri, validationKey, isSubscriptionDelegationEnabled != null ? new SubscriptionDelegationSettingProperties(isSubscriptionDelegationEnabled) : null, isUserRegistrationDelegationEnabled != null ? new RegistrationDelegationSettingProperties(isUserRegistrationDelegationEnabled) : null, isRedirectEnabled, termsOfService); + return new PortalSettingsContractData(id, name, resourceType, systemData, uri, validationKey, isSubscriptionDelegationEnabled != null ? new SubscriptionDelegationSettingProperties(isSubscriptionDelegationEnabled, new Dictionary()) : null, isUserRegistrationDelegationEnabled != null ? new RegistrationDelegationSettingProperties(isUserRegistrationDelegationEnabled, new Dictionary()) : null, isRedirectEnabled, termsOfService, default); } - /// Initializes a new instance of ApiManagementPortalSignInSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1282,10 +1384,10 @@ public static PortalSettingsContractData PortalSettingsContractData(ResourceIden /// A new instance for mocking. public static ApiManagementPortalSignInSettingData ApiManagementPortalSignInSettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isRedirectEnabled = null) { - return new ApiManagementPortalSignInSettingData(id, name, resourceType, systemData, isRedirectEnabled); + return new ApiManagementPortalSignInSettingData(id, name, resourceType, systemData, isRedirectEnabled, default); } - /// Initializes a new instance of ApiManagementPortalSignUpSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1295,10 +1397,10 @@ public static ApiManagementPortalSignInSettingData ApiManagementPortalSignInSett /// A new instance for mocking. public static ApiManagementPortalSignUpSettingData ApiManagementPortalSignUpSettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isSignUpDeveloperPortalEnabled = null, TermsOfServiceProperties termsOfService = null) { - return new ApiManagementPortalSignUpSettingData(id, name, resourceType, systemData, isSignUpDeveloperPortalEnabled, termsOfService); + return new ApiManagementPortalSignUpSettingData(id, name, resourceType, systemData, isSignUpDeveloperPortalEnabled, termsOfService, default); } - /// Initializes a new instance of ApiManagementPortalDelegationSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1310,18 +1412,18 @@ public static ApiManagementPortalSignUpSettingData ApiManagementPortalSignUpSett /// A new instance for mocking. public static ApiManagementPortalDelegationSettingData ApiManagementPortalDelegationSettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Uri uri = null, string validationKey = null, bool? isSubscriptionDelegationEnabled = null, bool? isUserRegistrationDelegationEnabled = null) { - return new ApiManagementPortalDelegationSettingData(id, name, resourceType, systemData, uri, validationKey, isSubscriptionDelegationEnabled != null ? new SubscriptionDelegationSettingProperties(isSubscriptionDelegationEnabled) : null, isUserRegistrationDelegationEnabled != null ? new RegistrationDelegationSettingProperties(isUserRegistrationDelegationEnabled) : null); + return new ApiManagementPortalDelegationSettingData(id, name, resourceType, systemData, uri, validationKey, isSubscriptionDelegationEnabled != null ? new SubscriptionDelegationSettingProperties(isSubscriptionDelegationEnabled, new Dictionary()) : null, isUserRegistrationDelegationEnabled != null ? new RegistrationDelegationSettingProperties(isUserRegistrationDelegationEnabled, new Dictionary()) : null, default); } - /// Initializes a new instance of PortalSettingValidationKeyContract. + /// Initializes a new instance of . /// This is secret value of the validation key in portal settings. /// A new instance for mocking. public static PortalSettingValidationKeyContract PortalSettingValidationKeyContract(string validationKey = null) { - return new PortalSettingValidationKeyContract(validationKey); + return new PortalSettingValidationKeyContract(validationKey, default); } - /// Initializes a new instance of ApiManagementPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1332,10 +1434,10 @@ public static PortalSettingValidationKeyContract PortalSettingValidationKeyContr /// A new instance for mocking. public static ApiManagementPrivateEndpointConnectionData ApiManagementPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, ApiManagementPrivateLinkServiceConnectionState connectionState = null, ApiManagementPrivateEndpointConnectionProvisioningState? provisioningState = null) { - return new ApiManagementPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState); + return new ApiManagementPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, default); } - /// Initializes a new instance of ApiManagementPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1349,10 +1451,10 @@ public static ApiManagementPrivateLinkResourceData ApiManagementPrivateLinkResou requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new ApiManagementPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new ApiManagementPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } - /// Initializes a new instance of ProductApiData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1383,10 +1485,10 @@ public static ProductApiData ProductApiData(ResourceIdentifier id = null, string { protocols ??= new List(); - return new ProductApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet); + return new ProductApiData(id, name, resourceType, systemData, description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, sourceApiId, displayName, serviceUri, path, protocols?.ToList(), apiVersionSet, default); } - /// Initializes a new instance of ProductGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1399,10 +1501,10 @@ public static ProductApiData ProductApiData(ResourceIdentifier id = null, string /// A new instance for mocking. public static ProductGroupData ProductGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string description = null, bool? isBuiltIn = null, ApiManagementGroupType? groupType = null, string externalId = null) { - return new ProductGroupData(id, name, resourceType, systemData, displayName, description, isBuiltIn, groupType, externalId); + return new ProductGroupData(id, name, resourceType, systemData, displayName, description, isBuiltIn, groupType, externalId, default); } - /// Initializes a new instance of SubscriptionContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1438,10 +1540,10 @@ public static ProductGroupData ProductGroupData(ResourceIdentifier id = null, st /// A new instance for mocking. public static SubscriptionContractData SubscriptionContractData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string ownerId = null, string scope = null, string displayName = null, SubscriptionState? state = null, DateTimeOffset? createdOn = null, DateTimeOffset? startOn = null, DateTimeOffset? expireOn = null, DateTimeOffset? endOn = null, DateTimeOffset? notifiesOn = null, string primaryKey = null, string secondaryKey = null, string stateComment = null, bool? allowTracing = null) { - return new SubscriptionContractData(id, name, resourceType, systemData, ownerId, scope, displayName, state, createdOn, startOn, expireOn, endOn, notifiesOn, primaryKey, secondaryKey, stateComment, allowTracing); + return new SubscriptionContractData(id, name, resourceType, systemData, ownerId, scope, displayName, state, createdOn, startOn, expireOn, endOn, notifiesOn, primaryKey, secondaryKey, stateComment, allowTracing, default); } - /// Initializes a new instance of QuotaCounterContract. + /// Initializes a new instance of . /// The Key value of the Counter. Must not be empty. /// Identifier of the Period for which the counter was collected. Must not be empty. /// @@ -1456,29 +1558,29 @@ public static SubscriptionContractData SubscriptionContractData(ResourceIdentifi /// A new instance for mocking. public static QuotaCounterContract QuotaCounterContract(string counterKey = null, string periodKey = null, DateTimeOffset periodStartOn = default, DateTimeOffset periodEndOn = default, QuotaCounterValueContractProperties value = null) { - return new QuotaCounterContract(counterKey, periodKey, periodStartOn, periodEndOn, value); + return new QuotaCounterContract(counterKey, periodKey, periodStartOn, periodEndOn, value, default); } - /// Initializes a new instance of QuotaCounterValueContractProperties. + /// Initializes a new instance of . /// Number of times Counter was called. /// Data Transferred in KiloBytes. /// A new instance for mocking. public static QuotaCounterValueContractProperties QuotaCounterValueContractProperties(int? callsCount = null, double? kbTransferred = null) { - return new QuotaCounterValueContractProperties(callsCount, kbTransferred); + return new QuotaCounterValueContractProperties(callsCount, kbTransferred, default); } - /// Initializes a new instance of RegionContract. + /// Initializes a new instance of . /// Region name. /// whether Region is the master region. /// whether Region is deleted. /// A new instance for mocking. public static RegionContract RegionContract(string name = null, bool? isMasterRegion = null, bool? isDeleted = null) { - return new RegionContract(name, isMasterRegion, isDeleted); + return new RegionContract(name, isMasterRegion, isDeleted, default); } - /// Initializes a new instance of ReportRecordContract. + /// Initializes a new instance of . /// Name depending on report endpoint specifies product, API, operation or developer name. /// /// Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. @@ -1511,10 +1613,10 @@ public static RegionContract RegionContract(string name = null, bool? isMasterRe /// A new instance for mocking. public static ReportRecordContract ReportRecordContract(string name = null, DateTimeOffset? timestamp = null, string interval = null, string country = null, string region = null, string zip = null, string userId = null, string productId = null, string apiId = null, string operationId = null, string apiRegion = null, ResourceIdentifier subscriptionResourceId = null, int? callCountSuccess = null, int? callCountBlocked = null, int? callCountFailed = null, int? callCountOther = null, int? callCountTotal = null, long? bandwidth = null, int? cacheHitCount = null, int? cacheMissCount = null, double? apiTimeAvg = null, double? apiTimeMin = null, double? apiTimeMax = null, double? serviceTimeAvg = null, double? serviceTimeMin = null, double? serviceTimeMax = null) { - return new ReportRecordContract(name, timestamp, interval, country, region, zip, userId, productId, apiId, operationId, apiRegion, subscriptionResourceId, callCountSuccess, callCountBlocked, callCountFailed, callCountOther, callCountTotal, bandwidth, cacheHitCount, cacheMissCount, apiTimeAvg, apiTimeMin, apiTimeMax, serviceTimeAvg, serviceTimeMin, serviceTimeMax); + return new ReportRecordContract(name, timestamp, interval, country, region, zip, userId, productId, apiId, operationId, apiRegion, subscriptionResourceId, callCountSuccess, callCountBlocked, callCountFailed, callCountOther, callCountTotal, bandwidth, cacheHitCount, cacheMissCount, apiTimeAvg, apiTimeMin, apiTimeMax, serviceTimeAvg, serviceTimeMin, serviceTimeMax, default); } - /// Initializes a new instance of RequestReportRecordContract. + /// Initializes a new instance of . /// API identifier path. /apis/{apiId}. /// Operation identifier path. /apis/{apiId}/operations/{operationId}. /// Product identifier path. /products/{productId}. @@ -1536,10 +1638,10 @@ public static ReportRecordContract ReportRecordContract(string name = null, Date /// A new instance for mocking. public static RequestReportRecordContract RequestReportRecordContract(string apiId = null, string operationId = null, string productId = null, string userId = null, RequestMethod? method = null, Uri uri = null, IPAddress ipAddress = null, string backendResponseCode = null, int? responseCode = null, int? responseSize = null, DateTimeOffset? timestamp = null, string cache = null, double? apiTime = null, double? serviceTime = null, string apiRegion = null, ResourceIdentifier subscriptionResourceId = null, string requestId = null, int? requestSize = null) { - return new RequestReportRecordContract(apiId, operationId, productId, userId, method, uri, ipAddress, backendResponseCode, responseCode, responseSize, timestamp, cache, apiTime, serviceTime, apiRegion, subscriptionResourceId, requestId, requestSize); + return new RequestReportRecordContract(apiId, operationId, productId, userId, method, uri, ipAddress, backendResponseCode, responseCode, responseSize, timestamp, cache, apiTime, serviceTime, apiRegion, subscriptionResourceId, requestId, requestSize, default); } - /// Initializes a new instance of ApiManagementGlobalSchemaData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1551,10 +1653,10 @@ public static RequestReportRecordContract RequestReportRecordContract(string api /// A new instance for mocking. public static ApiManagementGlobalSchemaData ApiManagementGlobalSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ApiSchemaType? schemaType = null, string description = null, BinaryData value = null, BinaryData document = null) { - return new ApiManagementGlobalSchemaData(id, name, resourceType, systemData, schemaType, description, value, document); + return new ApiManagementGlobalSchemaData(id, name, resourceType, systemData, schemaType, description, value, document, default); } - /// Initializes a new instance of ApiManagementTenantSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1565,10 +1667,10 @@ public static ApiManagementTenantSettingData ApiManagementTenantSettingData(Reso { settings ??= new Dictionary(); - return new ApiManagementTenantSettingData(id, name, resourceType, systemData, settings); + return new ApiManagementTenantSettingData(id, name, resourceType, systemData, settings, default); } - /// Initializes a new instance of ApiManagementSku. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// The name of SKU. /// Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. @@ -1592,10 +1694,10 @@ public static ApiManagementSku ApiManagementSku(string resourceType = null, stri capabilities ??= new List(); restrictions ??= new List(); - return new ApiManagementSku(resourceType, name, tier, size, family, kind, capacity, locations?.ToList(), locationInfo?.ToList(), apiVersions?.ToList(), costs?.ToList(), capabilities?.ToList(), restrictions?.ToList()); + return new ApiManagementSku(resourceType, name, tier, size, family, kind, capacity, locations?.ToList(), locationInfo?.ToList(), apiVersions?.ToList(), costs?.ToList(), capabilities?.ToList(), restrictions?.ToList(), default); } - /// Initializes a new instance of ApiManagementSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. @@ -1603,10 +1705,10 @@ public static ApiManagementSku ApiManagementSku(string resourceType = null, stri /// A new instance for mocking. public static ApiManagementSkuCapacity ApiManagementSkuCapacity(int? minimum = null, int? maximum = null, int? @default = null, ApiManagementSkuCapacityScaleType? scaleType = null) { - return new ApiManagementSkuCapacity(minimum, maximum, @default, scaleType); + return new ApiManagementSkuCapacity(minimum, maximum, @default, scaleType, default); } - /// Initializes a new instance of ApiManagementSkuLocationInfo. + /// Initializes a new instance of . /// Location of the SKU. /// List of availability zones where the SKU is supported. /// Details of capabilities available to a SKU in specific zones. @@ -1616,10 +1718,10 @@ public static ApiManagementSkuLocationInfo ApiManagementSkuLocationInfo(AzureLoc zones ??= new List(); zoneDetails ??= new List(); - return new ApiManagementSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList()); + return new ApiManagementSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList(), default); } - /// Initializes a new instance of ApiManagementSkuZoneDetails. + /// Initializes a new instance of . /// The set of zones that the SKU is available in with the specified capabilities. /// A list of capabilities that are available for the SKU in the specified list of zones. /// A new instance for mocking. @@ -1628,29 +1730,29 @@ public static ApiManagementSkuZoneDetails ApiManagementSkuZoneDetails(IEnumerabl name ??= new List(); capabilities ??= new List(); - return new ApiManagementSkuZoneDetails(name?.ToList(), capabilities?.ToList()); + return new ApiManagementSkuZoneDetails(name?.ToList(), capabilities?.ToList(), default); } - /// Initializes a new instance of ApiManagementSkuCapabilities. + /// Initializes a new instance of . /// An invariant to describe the feature. /// An invariant if the feature is measured by quantity. /// A new instance for mocking. public static ApiManagementSkuCapabilities ApiManagementSkuCapabilities(string name = null, string value = null) { - return new ApiManagementSkuCapabilities(name, value); + return new ApiManagementSkuCapabilities(name, value, default); } - /// Initializes a new instance of ApiManagementSkuCosts. + /// Initializes a new instance of . /// Used for querying price from commerce. /// The multiplier is needed to extend the base metered cost. /// An invariant to show the extended unit. /// A new instance for mocking. public static ApiManagementSkuCosts ApiManagementSkuCosts(string meterId = null, long? quantity = null, string extendedUnit = null) { - return new ApiManagementSkuCosts(meterId, quantity, extendedUnit); + return new ApiManagementSkuCosts(meterId, quantity, extendedUnit, default); } - /// Initializes a new instance of ApiManagementSkuRestrictions. + /// Initializes a new instance of . /// The type of restrictions. /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. /// The information about the restriction where the SKU cannot be used. @@ -1660,10 +1762,10 @@ public static ApiManagementSkuRestrictions ApiManagementSkuRestrictions(ApiManag { values ??= new List(); - return new ApiManagementSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode); + return new ApiManagementSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode, default); } - /// Initializes a new instance of ApiManagementSkuRestrictionInfo. + /// Initializes a new instance of . /// Locations where the SKU is restricted. /// List of availability zones where the SKU is restricted. /// A new instance for mocking. @@ -1672,19 +1774,19 @@ public static ApiManagementSkuRestrictionInfo ApiManagementSkuRestrictionInfo(IE locations ??= new List(); zones ??= new List(); - return new ApiManagementSkuRestrictionInfo(locations?.ToList(), zones?.ToList()); + return new ApiManagementSkuRestrictionInfo(locations?.ToList(), zones?.ToList(), default); } - /// Initializes a new instance of SubscriptionKeysContract. + /// Initializes a new instance of . /// Subscription primary key. /// Subscription secondary key. /// A new instance for mocking. public static SubscriptionKeysContract SubscriptionKeysContract(string primaryKey = null, string secondaryKey = null) { - return new SubscriptionKeysContract(primaryKey, secondaryKey); + return new SubscriptionKeysContract(primaryKey, secondaryKey, default); } - /// Initializes a new instance of TenantAccessInfoData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1695,10 +1797,10 @@ public static SubscriptionKeysContract SubscriptionKeysContract(string primaryKe /// A new instance for mocking. public static TenantAccessInfoData TenantAccessInfoData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string accessInfoType = null, string principalId = null, bool? isDirectAccessEnabled = null) { - return new TenantAccessInfoData(id, name, resourceType, systemData, accessInfoType, principalId, isDirectAccessEnabled); + return new TenantAccessInfoData(id, name, resourceType, systemData, accessInfoType, principalId, isDirectAccessEnabled, default); } - /// Initializes a new instance of TenantAccessInfoSecretsDetails. + /// Initializes a new instance of . /// Access Information type ('access' or 'gitAccess'). /// Principal (User) Identifier. /// Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. @@ -1707,10 +1809,10 @@ public static TenantAccessInfoData TenantAccessInfoData(ResourceIdentifier id = /// A new instance for mocking. public static TenantAccessInfoSecretsDetails TenantAccessInfoSecretsDetails(string accessInfoType = null, string principalId = null, string primaryKey = null, string secondaryKey = null, bool? isDirectAccessEnabled = null) { - return new TenantAccessInfoSecretsDetails(accessInfoType, principalId, primaryKey, secondaryKey, isDirectAccessEnabled); + return new TenantAccessInfoSecretsDetails(accessInfoType, principalId, primaryKey, secondaryKey, isDirectAccessEnabled, default); } - /// Initializes a new instance of GitOperationResultContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1733,20 +1835,20 @@ public static GitOperationResultContractData GitOperationResultContractData(Reso { actionLog ??= new List(); - return new GitOperationResultContractData(id, name, resourceType, systemData, operationResultIdentifier, status, startedOn, updatedOn, resultInfo, error, actionLog?.ToList()); + return new GitOperationResultContractData(id, name, resourceType, systemData, operationResultIdentifier, status, startedOn, updatedOn, resultInfo, error, actionLog?.ToList(), default); } - /// Initializes a new instance of OperationResultLogItemContract. + /// Initializes a new instance of . /// The type of entity contract. /// Action like create/update/delete. /// Identifier of the entity being created/updated/deleted. /// A new instance for mocking. public static OperationResultLogItemContract OperationResultLogItemContract(string objectType = null, string action = null, string objectKey = null) { - return new OperationResultLogItemContract(objectType, action, objectKey); + return new OperationResultLogItemContract(objectType, action, objectKey, default); } - /// Initializes a new instance of TenantConfigurationSyncStateContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1768,23 +1870,23 @@ public static OperationResultLogItemContract OperationResultLogItemContract(stri /// A new instance for mocking. public static TenantConfigurationSyncStateContract TenantConfigurationSyncStateContract(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string branch = null, string commitId = null, bool? isExported = null, bool? isSynced = null, bool? isGitEnabled = null, DateTimeOffset? syncOn = null, DateTimeOffset? configurationChangeOn = null, string lastOperationId = null) { - return new TenantConfigurationSyncStateContract(id, name, resourceType, systemData, branch, commitId, isExported, isSynced, isGitEnabled, syncOn, configurationChangeOn, lastOperationId); + return new TenantConfigurationSyncStateContract(id, name, resourceType, systemData, branch, commitId, isExported, isSynced, isGitEnabled, syncOn, configurationChangeOn, lastOperationId, default); } - /// Initializes a new instance of GenerateSsoUriResult. + /// Initializes a new instance of . /// Redirect Url containing the SSO URL value. /// A new instance for mocking. public static GenerateSsoUriResult GenerateSsoUriResult(string value = null) { - return new GenerateSsoUriResult(value); + return new GenerateSsoUriResult(value, default); } - /// Initializes a new instance of UserTokenResult. + /// Initializes a new instance of . /// Shared Access Authorization token for the User. /// A new instance for mocking. public static UserTokenResult UserTokenResult(string value = null) { - return new UserTokenResult(value); + return new UserTokenResult(value, default); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DiagnosticContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DiagnosticContractData.cs index 6e9938d1b6d5..bc776b1c25c3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DiagnosticContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DiagnosticContractData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class DiagnosticContractData : ResourceData { - /// Initializes a new instance of DiagnosticContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiagnosticContractData() { } - /// Initializes a new instance of DiagnosticContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +42,8 @@ public DiagnosticContractData() /// The verbosity level applied to traces emitted by trace policies. /// The format of the Operation Name for Application Insights telemetries. Default is Name. /// Emit custom metrics via emit-metric policy. Applicable only to Application Insights diagnostic settings. - internal DiagnosticContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AlwaysLog? alwaysLog, string loggerId, SamplingSettings sampling, PipelineDiagnosticSettings frontend, PipelineDiagnosticSettings backend, bool? isLogClientIPEnabled, HttpCorrelationProtocol? httpCorrelationProtocol, TraceVerbosityLevel? verbosity, OperationNameFormat? operationNameFormat, bool? metrics) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DiagnosticContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AlwaysLog? alwaysLog, string loggerId, SamplingSettings sampling, PipelineDiagnosticSettings frontend, PipelineDiagnosticSettings backend, bool? isLogClientIPEnabled, HttpCorrelationProtocol? httpCorrelationProtocol, TraceVerbosityLevel? verbosity, OperationNameFormat? operationNameFormat, bool? metrics, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { AlwaysLog = alwaysLog; LoggerId = loggerId; @@ -49,6 +55,7 @@ internal DiagnosticContractData(ResourceIdentifier id, string name, ResourceType Verbosity = verbosity; OperationNameFormat = operationNameFormat; Metrics = metrics; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies for what type of messages sampling settings should not apply. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index b0e7d9db183e..c0fa51298c60 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -78,7 +78,7 @@ public virtual AsyncPageable GetApiManageme { HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); } /// @@ -100,7 +100,7 @@ public virtual Pageable GetApiManagementDel { HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); } /// @@ -122,7 +122,7 @@ public virtual AsyncPageable GetApiManagementServi { HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementServiceRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementServices", "value", "nextLink", cancellationToken); } /// @@ -144,7 +144,7 @@ public virtual Pageable GetApiManagementServices(C { HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementServiceRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementServices", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/IssueContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/IssueContractData.cs index 4120bb380159..bd8f6d2dfe56 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/IssueContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/IssueContractData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class IssueContractData : ResourceData { - /// Initializes a new instance of IssueContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IssueContractData() { } - /// Initializes a new instance of IssueContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +38,8 @@ public IssueContractData() /// The issue title. /// Text describing the issue. /// A resource identifier for the user created the issue. - internal IssueContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, IssueState? state, ResourceIdentifier apiId, string title, string description, ResourceIdentifier userId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal IssueContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, IssueState? state, ResourceIdentifier apiId, string title, string description, ResourceIdentifier userId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { CreatedOn = createdOn; State = state; @@ -42,6 +47,7 @@ internal IssueContractData(ResourceIdentifier id, string name, ResourceType reso Title = title; Description = description; UserId = userId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Date and time when the issue was created. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.Serialization.cs index ad066833bd51..20ab5272887c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class AccessInformationListResult + internal partial class AccessInformationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AccessInformationListResult DeserializeAccessInformationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AccessInformationListResult DeserializeAccessInformationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static AccessInformationListResult DeserializeAccessInformationListResu Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static AccessInformationListResult DeserializeAccessInformationListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AccessInformationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new AccessInformationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + AccessInformationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAccessInformationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AccessInformationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAccessInformationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AccessInformationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AccessInformationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAccessInformationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.cs index a8b8c169a317..f0e96b56d197 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AccessInformationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged AccessInformation list representation. internal partial class AccessInformationListResult { - /// Initializes a new instance of AccessInformationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AccessInformationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AccessInformationListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal AccessInformationListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AccessInformationListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs index d03e24dd283f..c6ab7fb03a51 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs @@ -9,19 +9,32 @@ using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AdditionalLocation : IUtf8JsonSerializable + public partial class AdditionalLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Zones)) { writer.WritePropertyName("zones"u8); @@ -40,18 +53,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualNetworkConfiguration)) { writer.WritePropertyName("virtualNetworkConfiguration"u8); - writer.WriteObjectValue(VirtualNetworkConfiguration); + if (VirtualNetworkConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VirtualNetworkConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); writer.WriteBooleanValue(DisableGateway.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement element) + internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +100,7 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele Optional gatewayRegionalUri = default; Optional disableGateway = default; Optional platformVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -179,8 +214,61 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele platformVersion = new PlatformVersion(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AdditionalLocation(location, sku, Optional.ToList(zones), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, virtualNetworkConfiguration.Value, gatewayRegionalUri.Value, Optional.ToNullable(disableGateway), Optional.ToNullable(platformVersion), serializedAdditionalRawData); + } + + AdditionalLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAdditionalLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AdditionalLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAdditionalLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AdditionalLocation model) + { + if (model is null) + { + return null; } - return new AdditionalLocation(location, sku, Optional.ToList(zones), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, virtualNetworkConfiguration.Value, gatewayRegionalUri.Value, Optional.ToNullable(disableGateway), Optional.ToNullable(platformVersion)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AdditionalLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAdditionalLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs index 377f7a3cf48f..b99c0c803f40 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Description of an additional API Management resource location. public partial class AdditionalLocation { - /// Initializes a new instance of AdditionalLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location name of the additional region among Azure Data center regions. /// SKU properties of the API Management service. /// is null. @@ -30,7 +33,7 @@ public AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPropert PrivateIPAddresses = new ChangeTrackingList(); } - /// Initializes a new instance of AdditionalLocation. + /// Initializes a new instance of . /// The location name of the additional region among Azure Data center regions. /// SKU properties of the API Management service. /// A list of availability zones denoting where the resource needs to come from. @@ -41,7 +44,8 @@ public AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPropert /// Gateway URL of the API Management service in the Region. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. /// Compute Platform Version running the service. - internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuProperties sku, IList zones, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, VirtualNetworkConfiguration virtualNetworkConfiguration, Uri gatewayRegionalUri, bool? disableGateway, PlatformVersion? platformVersion) + /// Keeps track of any properties unknown to the library. + internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuProperties sku, IList zones, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, VirtualNetworkConfiguration virtualNetworkConfiguration, Uri gatewayRegionalUri, bool? disableGateway, PlatformVersion? platformVersion, Dictionary serializedAdditionalRawData) { Location = location; Sku = sku; @@ -53,6 +57,12 @@ internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPrope GatewayRegionalUri = gatewayRegionalUri; DisableGateway = disableGateway; PlatformVersion = platformVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AdditionalLocation() + { } /// The location name of the additional region among Azure Data center regions. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.Serialization.cs index 694f2f235ea1..ab5056324a63 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiContactInformation : IUtf8JsonSerializable + public partial class ApiContactInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("email"u8); writer.WriteStringValue(Email); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiContactInformation DeserializeApiContactInformation(JsonElement element) + internal static ApiContactInformation DeserializeApiContactInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static ApiContactInformation DeserializeApiContactInformation(JsonEleme Optional name = default; Optional uri = default; Optional email = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -64,8 +86,61 @@ internal static ApiContactInformation DeserializeApiContactInformation(JsonEleme email = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiContactInformation(name.Value, uri.Value, email.Value, serializedAdditionalRawData); + } + + ApiContactInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiContactInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiContactInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiContactInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiContactInformation model) + { + if (model is null) + { + return null; } - return new ApiContactInformation(name.Value, uri.Value, email.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiContactInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiContactInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.cs index c5778ec9e5ad..59db8e87f628 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiContactInformation.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// API contact information. public partial class ApiContactInformation { - /// Initializes a new instance of ApiContactInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiContactInformation() { } - /// Initializes a new instance of ApiContactInformation. + /// Initializes a new instance of . /// The identifying name of the contact person/organization. /// The URL pointing to the contact information. MUST be in the format of a URL. /// The email address of the contact person/organization. MUST be in the format of an email address. - internal ApiContactInformation(string name, Uri uri, string email) + /// Keeps track of any properties unknown to the library. + internal ApiContactInformation(string name, Uri uri, string email, Dictionary serializedAdditionalRawData) { Name = name; Uri = uri; Email = email; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The identifying name of the contact person/organization. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs index 9bf70c043dd9..abc912a3333e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,12 +33,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationSettings)) { writer.WritePropertyName("authenticationSettings"u8); - writer.WriteObjectValue(AuthenticationSettings); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } } if (Optional.IsDefined(SubscriptionKeyParameterNames)) { writer.WritePropertyName("subscriptionKeyParameterNames"u8); - writer.WriteObjectValue(SubscriptionKeyParameterNames); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } } if (Optional.IsDefined(ApiType)) { @@ -80,12 +102,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Contact)) { writer.WritePropertyName("contact"u8); - writer.WriteObjectValue(Contact); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } } if (Optional.IsDefined(License)) { writer.WritePropertyName("license"u8); - writer.WriteObjectValue(License); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } } if (Optional.IsDefined(SourceApiId)) { @@ -120,7 +156,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiVersionSet)) { writer.WritePropertyName("apiVersionSet"u8); - writer.WriteObjectValue(ApiVersionSet); + if (ApiVersionSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiVersionSet).Serialize(writer, options); + } } if (Optional.IsDefined(Value)) { @@ -135,7 +178,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WsdlSelector)) { writer.WritePropertyName("wsdlSelector"u8); - writer.WriteObjectValue(WsdlSelector); + if (WsdlSelector is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WsdlSelector).Serialize(writer, options); + } } if (Optional.IsDefined(SoapApiType)) { @@ -143,7 +193,322 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SoapApiType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiCreateOrUpdateContent DeserializeApiCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional authenticationSettings = default; + Optional subscriptionKeyParameterNames = default; + Optional type = default; + Optional apiRevision = default; + Optional apiVersion = default; + Optional isCurrent = default; + Optional isOnline = default; + Optional apiRevisionDescription = default; + Optional apiVersionDescription = default; + Optional apiVersionSetId = default; + Optional subscriptionRequired = default; + Optional termsOfServiceUri = default; + Optional contact = default; + Optional license = default; + Optional sourceApiId = default; + Optional displayName = default; + Optional serviceUri = default; + Optional path = default; + Optional> protocols = default; + Optional apiVersionSet = default; + Optional value = default; + Optional format = default; + Optional wsdlSelector = default; + Optional apiType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authenticationSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authenticationSettings = AuthenticationSettingsContract.DeserializeAuthenticationSettingsContract(property0.Value); + continue; + } + if (property0.NameEquals("subscriptionKeyParameterNames"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionKeyParameterNames = SubscriptionKeyParameterNamesContract.DeserializeSubscriptionKeyParameterNamesContract(property0.Value); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ApiType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("apiRevision"u8)) + { + apiRevision = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("apiVersion"u8)) + { + apiVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isCurrent"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isCurrent = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isOnline"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOnline = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("apiRevisionDescription"u8)) + { + apiRevisionDescription = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("apiVersionDescription"u8)) + { + apiVersionDescription = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("apiVersionSetId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiVersionSetId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("subscriptionRequired"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionRequired = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("termsOfServiceUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termsOfServiceUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("contact"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contact = ApiContactInformation.DeserializeApiContactInformation(property0.Value); + continue; + } + if (property0.NameEquals("license"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + license = ApiLicenseInformation.DeserializeApiLicenseInformation(property0.Value); + continue; + } + if (property0.NameEquals("sourceApiId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceApiId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("serviceUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("path"u8)) + { + path = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("protocols"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new ApiOperationInvokableProtocol(item.GetString())); + } + protocols = array; + continue; + } + if (property0.NameEquals("apiVersionSet"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiVersionSet = ApiVersionSetContractDetails.DeserializeApiVersionSetContractDetails(property0.Value); + continue; + } + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("format"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + format = new ContentFormat(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("wsdlSelector"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wsdlSelector = ApiCreateOrUpdatePropertiesWsdlSelector.DeserializeApiCreateOrUpdatePropertiesWsdlSelector(property0.Value); + continue; + } + if (property0.NameEquals("apiType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiType = new SoapApiType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiCreateOrUpdateContent(description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, value.Value, Optional.ToNullable(format), wsdlSelector.Value, Optional.ToNullable(apiType), serializedAdditionalRawData); + } + + ApiCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs index 8bd504875333..af0d849249f7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs @@ -14,12 +14,78 @@ namespace Azure.ResourceManager.ApiManagement.Models /// API Create or Update Parameters. public partial class ApiCreateOrUpdateContent { - /// Initializes a new instance of ApiCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiCreateOrUpdateContent() { Protocols = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Description of the API. May include HTML formatting tags. + /// Collection of authentication settings included into this API. + /// Protocols over which API is made available. + /// Type of API. + /// Describes the revision of the API. If no value is provided, default revision 1 is created. + /// Indicates the version identifier of the API if the API is versioned. + /// Indicates if API revision is current api revision. + /// Indicates if API revision is accessible via the gateway. + /// Description of the API Revision. + /// Description of the API Version. + /// A resource identifier for the related ApiVersionSet. + /// Specifies whether an API or Product subscription is required for accessing the API. + /// A URL to the Terms of Service for the API. MUST be in the format of a URL. + /// Contact information for the API. + /// License information for the API. + /// API identifier of the source API. + /// API name. Must be 1 to 300 characters long. + /// Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + /// Describes on which protocols the operations in this API can be invoked. + /// Version set details. + /// Content value when Importing an API. + /// Format of the Content in which the API is getting imported. + /// Criteria to limit import of WSDL to a subset of the document. + /// + /// Type of API to create. + /// * `http` creates a REST API + /// * `soap` creates a SOAP pass-through API + /// * `websocket` creates websocket API + /// * `graphql` creates GraphQL API. + /// + /// Keeps track of any properties unknown to the library. + internal ApiCreateOrUpdateContent(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, string value, ContentFormat? format, ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector, SoapApiType? soapApiType, Dictionary serializedAdditionalRawData) + { + Description = description; + AuthenticationSettings = authenticationSettings; + SubscriptionKeyParameterNames = subscriptionKeyParameterNames; + ApiType = apiType; + ApiRevision = apiRevision; + ApiVersion = apiVersion; + IsCurrent = isCurrent; + IsOnline = isOnline; + ApiRevisionDescription = apiRevisionDescription; + ApiVersionDescription = apiVersionDescription; + ApiVersionSetId = apiVersionSetId; + IsSubscriptionRequired = isSubscriptionRequired; + TermsOfServiceUri = termsOfServiceUri; + Contact = contact; + License = license; + SourceApiId = sourceApiId; + DisplayName = displayName; + ServiceUri = serviceUri; + Path = path; + Protocols = protocols; + ApiVersionSet = apiVersionSet; + Value = value; + Format = format; + WsdlSelector = wsdlSelector; + SoapApiType = soapApiType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Description of the API. May include HTML formatting tags. public string Description { get; set; } /// Collection of authentication settings included into this API. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.Serialization.cs index 6c569293b338..b2d09a378a0c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiCreateOrUpdatePropertiesWsdlSelector : IUtf8JsonSerializable + public partial class ApiCreateOrUpdatePropertiesWsdlSelector : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WsdlServiceName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("wsdlEndpointName"u8); writer.WriteStringValue(WsdlEndpointName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiCreateOrUpdatePropertiesWsdlSelector DeserializeApiCreateOrUpdatePropertiesWsdlSelector(JsonElement element) + internal static ApiCreateOrUpdatePropertiesWsdlSelector DeserializeApiCreateOrUpdatePropertiesWsdlSelector(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional wsdlServiceName = default; Optional wsdlEndpointName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("wsdlServiceName"u8)) @@ -48,8 +71,61 @@ internal static ApiCreateOrUpdatePropertiesWsdlSelector DeserializeApiCreateOrUp wsdlEndpointName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiCreateOrUpdatePropertiesWsdlSelector(wsdlServiceName.Value, wsdlEndpointName.Value, serializedAdditionalRawData); + } + + ApiCreateOrUpdatePropertiesWsdlSelector IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiCreateOrUpdatePropertiesWsdlSelector(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiCreateOrUpdatePropertiesWsdlSelector IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiCreateOrUpdatePropertiesWsdlSelector(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiCreateOrUpdatePropertiesWsdlSelector model) + { + if (model is null) + { + return null; } - return new ApiCreateOrUpdatePropertiesWsdlSelector(wsdlServiceName.Value, wsdlEndpointName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiCreateOrUpdatePropertiesWsdlSelector(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiCreateOrUpdatePropertiesWsdlSelector(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.cs index a6911710532f..6c94c3773f86 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdatePropertiesWsdlSelector.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Criteria to limit import of WSDL to a subset of the document. public partial class ApiCreateOrUpdatePropertiesWsdlSelector { - /// Initializes a new instance of ApiCreateOrUpdatePropertiesWsdlSelector. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiCreateOrUpdatePropertiesWsdlSelector() { } - /// Initializes a new instance of ApiCreateOrUpdatePropertiesWsdlSelector. + /// Initializes a new instance of . /// Name of service to import from WSDL. /// Name of endpoint(port) to import from WSDL. - internal ApiCreateOrUpdatePropertiesWsdlSelector(string wsdlServiceName, string wsdlEndpointName) + /// Keeps track of any properties unknown to the library. + internal ApiCreateOrUpdatePropertiesWsdlSelector(string wsdlServiceName, string wsdlEndpointName, Dictionary serializedAdditionalRawData) { WsdlServiceName = wsdlServiceName; WsdlEndpointName = wsdlEndpointName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of service to import from WSDL. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs index 93926ff1915e..1e0c3ae9cbf6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiData : IUtf8JsonSerializable + public partial class ApiData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,12 +35,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationSettings)) { writer.WritePropertyName("authenticationSettings"u8); - writer.WriteObjectValue(AuthenticationSettings); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } } if (Optional.IsDefined(SubscriptionKeyParameterNames)) { writer.WritePropertyName("subscriptionKeyParameterNames"u8); - writer.WriteObjectValue(SubscriptionKeyParameterNames); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } } if (Optional.IsDefined(ApiType)) { @@ -84,12 +104,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Contact)) { writer.WritePropertyName("contact"u8); - writer.WriteObjectValue(Contact); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } } if (Optional.IsDefined(License)) { writer.WritePropertyName("license"u8); - writer.WriteObjectValue(License); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } } if (Optional.IsDefined(SourceApiId)) { @@ -124,14 +158,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiVersionSet)) { writer.WritePropertyName("apiVersionSet"u8); - writer.WriteObjectValue(ApiVersionSet); + if (ApiVersionSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiVersionSet).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiData DeserializeApiData(JsonElement element) + internal static ApiData DeserializeApiData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -161,6 +216,7 @@ internal static ApiData DeserializeApiData(JsonElement element) Optional path = default; Optional> protocols = default; Optional apiVersionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -365,8 +421,61 @@ internal static ApiData DeserializeApiData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, serializedAdditionalRawData); + } + + ApiData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiData(Response response) + { + if (response is null) + { + return null; } - return new ApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.Serialization.cs index ce01b7719c9b..0eae59d7071d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.Serialization.cs @@ -6,15 +6,140 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiEntityBaseContract + public partial class ApiEntityBaseContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiEntityBaseContract DeserializeApiEntityBaseContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(AuthenticationSettings)) + { + writer.WritePropertyName("authenticationSettings"u8); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } + } + if (Optional.IsDefined(SubscriptionKeyParameterNames)) + { + writer.WritePropertyName("subscriptionKeyParameterNames"u8); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } + } + if (Optional.IsDefined(ApiType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ApiType.Value.ToString()); + } + if (Optional.IsDefined(ApiRevision)) + { + writer.WritePropertyName("apiRevision"u8); + writer.WriteStringValue(ApiRevision); + } + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + if (Optional.IsDefined(IsCurrent)) + { + writer.WritePropertyName("isCurrent"u8); + writer.WriteBooleanValue(IsCurrent.Value); + } + if (Optional.IsDefined(ApiRevisionDescription)) + { + writer.WritePropertyName("apiRevisionDescription"u8); + writer.WriteStringValue(ApiRevisionDescription); + } + if (Optional.IsDefined(ApiVersionDescription)) + { + writer.WritePropertyName("apiVersionDescription"u8); + writer.WriteStringValue(ApiVersionDescription); + } + if (Optional.IsDefined(ApiVersionSetId)) + { + writer.WritePropertyName("apiVersionSetId"u8); + writer.WriteStringValue(ApiVersionSetId); + } + if (Optional.IsDefined(IsSubscriptionRequired)) + { + writer.WritePropertyName("subscriptionRequired"u8); + writer.WriteBooleanValue(IsSubscriptionRequired.Value); + } + if (Optional.IsDefined(TermsOfServiceUri)) + { + writer.WritePropertyName("termsOfServiceUrl"u8); + writer.WriteStringValue(TermsOfServiceUri.AbsoluteUri); + } + if (Optional.IsDefined(Contact)) + { + writer.WritePropertyName("contact"u8); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } + } + if (Optional.IsDefined(License)) + { + writer.WritePropertyName("license"u8); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiEntityBaseContract DeserializeApiEntityBaseContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +159,7 @@ internal static ApiEntityBaseContract DeserializeApiEntityBaseContract(JsonEleme Optional termsOfServiceUri = default; Optional contact = default; Optional license = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description"u8)) @@ -151,8 +277,61 @@ internal static ApiEntityBaseContract DeserializeApiEntityBaseContract(JsonEleme license = ApiLicenseInformation.DeserializeApiLicenseInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiEntityBaseContract(description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value); + return new ApiEntityBaseContract(description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, serializedAdditionalRawData); + } + + ApiEntityBaseContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiEntityBaseContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiEntityBaseContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiEntityBaseContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiEntityBaseContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiEntityBaseContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiEntityBaseContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs index eb4b9097f7e8..1e6fbdf17c8d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.ApiManagement.Models /// API base contract details. public partial class ApiEntityBaseContract { - /// Initializes a new instance of ApiEntityBaseContract. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiEntityBaseContract() { } - /// Initializes a new instance of ApiEntityBaseContract. + /// Initializes a new instance of . /// Description of the API. May include HTML formatting tags. /// Collection of authentication settings included into this API. /// Protocols over which API is made available. @@ -34,7 +38,8 @@ internal ApiEntityBaseContract() /// A URL to the Terms of Service for the API. MUST be in the format of a URL. /// Contact information for the API. /// License information for the API. - internal ApiEntityBaseContract(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license) + /// Keeps track of any properties unknown to the library. + internal ApiEntityBaseContract(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, Dictionary serializedAdditionalRawData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -51,6 +56,7 @@ internal ApiEntityBaseContract(string description, AuthenticationSettingsContrac TermsOfServiceUri = termsOfServiceUri; Contact = contact; License = license; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the API. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueAttachmentData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueAttachmentData.Serialization.cs index 4f0101eb0a93..b90c3b05ce46 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueAttachmentData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueAttachmentData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiIssueAttachmentData : IUtf8JsonSerializable + public partial class ApiIssueAttachmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Content); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiIssueAttachmentData DeserializeApiIssueAttachmentData(JsonElement element) + internal static ApiIssueAttachmentData DeserializeApiIssueAttachmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +72,7 @@ internal static ApiIssueAttachmentData DeserializeApiIssueAttachmentData(JsonEle Optional title = default; Optional contentFormat = default; Optional content = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -103,8 +126,61 @@ internal static ApiIssueAttachmentData DeserializeApiIssueAttachmentData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiIssueAttachmentData(id, name, type, systemData.Value, title.Value, contentFormat.Value, content.Value, serializedAdditionalRawData); + } + + ApiIssueAttachmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiIssueAttachmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiIssueAttachmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiIssueAttachmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiIssueAttachmentData model) + { + if (model is null) + { + return null; } - return new ApiIssueAttachmentData(id, name, type, systemData.Value, title.Value, contentFormat.Value, content.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiIssueAttachmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiIssueAttachmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueCommentData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueCommentData.Serialization.cs index 3d44586c05ea..32da51c633c1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueCommentData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssueCommentData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiIssueCommentData : IUtf8JsonSerializable + public partial class ApiIssueCommentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiIssueCommentData DeserializeApiIssueCommentData(JsonElement element) + internal static ApiIssueCommentData DeserializeApiIssueCommentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +72,7 @@ internal static ApiIssueCommentData DeserializeApiIssueCommentData(JsonElement e Optional text = default; Optional createdDate = default; Optional userId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +134,61 @@ internal static ApiIssueCommentData DeserializeApiIssueCommentData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiIssueCommentData(id, name, type, systemData.Value, text.Value, Optional.ToNullable(createdDate), userId.Value, serializedAdditionalRawData); + } + + ApiIssueCommentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiIssueCommentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiIssueCommentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiIssueCommentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiIssueCommentData model) + { + if (model is null) + { + return null; } - return new ApiIssueCommentData(id, name, type, systemData.Value, text.Value, Optional.ToNullable(createdDate), userId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiIssueCommentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiIssueCommentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.Serialization.cs index 4bba035253c5..a9bf9b2012d3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiIssuePatch : IUtf8JsonSerializable + public partial class ApiIssuePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -48,7 +56,147 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiIssuePatch DeserializeApiIssuePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional createdDate = default; + Optional state = default; + Optional apiId = default; + Optional title = default; + Optional description = default; + Optional userId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("createdDate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new IssueState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("apiId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("title"u8)) + { + title = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("userId"u8)) + { + userId = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiIssuePatch(Optional.ToNullable(createdDate), Optional.ToNullable(state), apiId.Value, title.Value, description.Value, userId.Value, serializedAdditionalRawData); + } + + ApiIssuePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiIssuePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiIssuePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiIssuePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiIssuePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiIssuePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiIssuePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.cs index c07167b6a189..9ff43d30f612 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiIssuePatch.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,11 +14,33 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Issue update Parameters. public partial class ApiIssuePatch { - /// Initializes a new instance of ApiIssuePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiIssuePatch() { } + /// Initializes a new instance of . + /// Date and time when the issue was created. + /// Status of the issue. + /// A resource identifier for the API the issue was created for. + /// The issue title. + /// Text describing the issue. + /// A resource identifier for the user created the issue. + /// Keeps track of any properties unknown to the library. + internal ApiIssuePatch(DateTimeOffset? createdOn, IssueState? state, ResourceIdentifier apiId, string title, string description, string userId, Dictionary serializedAdditionalRawData) + { + CreatedOn = createdOn; + State = state; + ApiId = apiId; + Title = title; + Description = description; + UserId = userId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Date and time when the issue was created. public DateTimeOffset? CreatedOn { get; set; } /// Status of the issue. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.Serialization.cs index 065bd7893aca..4032afea5eb4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiLicenseInformation : IUtf8JsonSerializable + public partial class ApiLicenseInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("url"u8); writer.WriteStringValue(Uri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiLicenseInformation DeserializeApiLicenseInformation(JsonElement element) + internal static ApiLicenseInformation DeserializeApiLicenseInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -53,8 +75,61 @@ internal static ApiLicenseInformation DeserializeApiLicenseInformation(JsonEleme uri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiLicenseInformation(name.Value, uri.Value, serializedAdditionalRawData); + } + + ApiLicenseInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiLicenseInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiLicenseInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiLicenseInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiLicenseInformation model) + { + if (model is null) + { + return null; } - return new ApiLicenseInformation(name.Value, uri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiLicenseInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiLicenseInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.cs index fde17612d142..99925471fb08 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiLicenseInformation.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// API license information. public partial class ApiLicenseInformation { - /// Initializes a new instance of ApiLicenseInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiLicenseInformation() { } - /// Initializes a new instance of ApiLicenseInformation. + /// Initializes a new instance of . /// The license name used for the API. /// A URL to the license used for the API. MUST be in the format of a URL. - internal ApiLicenseInformation(string name, Uri uri) + /// Keeps track of any properties unknown to the library. + internal ApiLicenseInformation(string name, Uri uri, Dictionary serializedAdditionalRawData) { Name = name; Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The license name used for the API. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.Serialization.cs index f9d36e1d8eab..d9a48217cf24 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiListResult + internal partial class ApiListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiListResult DeserializeApiListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiListResult DeserializeApiListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static ApiListResult DeserializeApiListResult(JsonElement element) Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static ApiListResult DeserializeApiListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.cs index 104d3045c0c4..a3acabc03892 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged API list representation. internal partial class ApiListResult { - /// Initializes a new instance of ApiListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs index 188b67e03386..962c98bb5278 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementAuthorizationServerData : IUtf8JsonSerializable + public partial class ApiManagementAuthorizationServerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TokenBodyParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -126,11 +140,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementAuthorizationServerData DeserializeApiManagementAuthorizationServerData(JsonElement element) + internal static ApiManagementAuthorizationServerData DeserializeApiManagementAuthorizationServerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -155,6 +183,7 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut Optional> grantTypes = default; Optional clientId = default; Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -322,8 +351,61 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementAuthorizationServerData(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementAuthorizationServerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementAuthorizationServerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementAuthorizationServerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementAuthorizationServerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementAuthorizationServerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementAuthorizationServerData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementAuthorizationServerData(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementAuthorizationServerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs index f6078406a6b8..7bc06072db52 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementAuthorizationServerPatch : IUtf8JsonSerializable + public partial class ApiManagementAuthorizationServerPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -50,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TokenBodyParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -125,11 +139,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAuthorizationServerPatch(JsonElement element) + internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAuthorizationServerPatch(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -154,6 +182,7 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu Optional> grantTypes = default; Optional clientId = default; Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -321,8 +350,61 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementAuthorizationServerPatch(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementAuthorizationServerPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementAuthorizationServerPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementAuthorizationServerPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementAuthorizationServerPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementAuthorizationServerPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementAuthorizationServerPatch(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementAuthorizationServerPatch(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementAuthorizationServerPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs index 999b13e476bf..fe72eb3c0d3d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// External OAuth authorization server settings. public partial class ApiManagementAuthorizationServerPatch : ResourceData { - /// Initializes a new instance of ApiManagementAuthorizationServerPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementAuthorizationServerPatch() { AuthorizationMethods = new ChangeTrackingList(); @@ -24,7 +28,7 @@ public ApiManagementAuthorizationServerPatch() GrantTypes = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementAuthorizationServerPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ public ApiManagementAuthorizationServerPatch() /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; AuthorizationMethods = authorizationMethods; @@ -63,6 +68,7 @@ internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string nam GrantTypes = grantTypes; ClientId = clientId; ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the authorization server. Can contain HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs index 05bb1bd6341a..75526bdccd24 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementBackendData : IUtf8JsonSerializable + public partial class ApiManagementBackendData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,22 +45,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } if (Optional.IsDefined(Proxy)) { writer.WritePropertyName("proxy"u8); - writer.WriteObjectValue(Proxy); + if (Proxy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Proxy).Serialize(writer, options); + } } if (Optional.IsDefined(Tls)) { writer.WritePropertyName("tls"u8); - writer.WriteObjectValue(Tls); + if (Tls is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tls).Serialize(writer, options); + } } if (Optional.IsDefined(Uri)) { @@ -66,11 +101,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Protocol.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementBackendData DeserializeApiManagementBackendData(JsonElement element) + internal static ApiManagementBackendData DeserializeApiManagementBackendData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -88,6 +137,7 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso Optional tls = default; Optional uri = default; Optional protocol = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -199,8 +249,61 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementBackendData(id, name, type, systemData.Value, title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, uri.Value, Optional.ToNullable(protocol)); + return new ApiManagementBackendData(id, name, type, systemData.Value, title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, uri.Value, Optional.ToNullable(protocol), serializedAdditionalRawData); + } + + ApiManagementBackendData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementBackendData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementBackendData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementBackendData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementBackendData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementBackendData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementBackendData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs index 02cf45f10df6..6d6d03a314d5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementBackendPatch : IUtf8JsonSerializable + public partial class ApiManagementBackendPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,22 +43,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } if (Optional.IsDefined(Proxy)) { writer.WritePropertyName("proxy"u8); - writer.WriteObjectValue(Proxy); + if (Proxy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Proxy).Serialize(writer, options); + } } if (Optional.IsDefined(Tls)) { writer.WritePropertyName("tls"u8); - writer.WriteObjectValue(Tls); + if (Tls is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tls).Serialize(writer, options); + } } if (Optional.IsDefined(Uri)) { @@ -63,7 +99,181 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Protocol.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementBackendPatch DeserializeApiManagementBackendPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional title = default; + Optional description = default; + Optional resourceId = default; + Optional properties = default; + Optional credentials = default; + Optional proxy = default; + Optional tls = default; + Optional uri = default; + Optional protocol = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("title"u8)) + { + title = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("resourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("properties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BackendProperties.DeserializeBackendProperties(property0.Value); + continue; + } + if (property0.NameEquals("credentials"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + credentials = BackendCredentialsContract.DeserializeBackendCredentialsContract(property0.Value); + continue; + } + if (property0.NameEquals("proxy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + proxy = BackendProxyContract.DeserializeBackendProxyContract(property0.Value); + continue; + } + if (property0.NameEquals("tls"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tls = BackendTlsProperties.DeserializeBackendTlsProperties(property0.Value); + continue; + } + if (property0.NameEquals("url"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("protocol"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new BackendProtocol(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementBackendPatch(title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, uri.Value, Optional.ToNullable(protocol), serializedAdditionalRawData); + } + + ApiManagementBackendPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementBackendPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementBackendPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementBackendPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementBackendPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementBackendPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementBackendPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs index 2ba20ee50e13..8d8b62cac202 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs @@ -6,17 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Backend update parameters. public partial class ApiManagementBackendPatch { - /// Initializes a new instance of ApiManagementBackendPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementBackendPatch() { } + /// Initializes a new instance of . + /// Backend Title. + /// Backend Description. + /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Backend Properties contract. + /// Backend Credentials Contract Properties. + /// Backend Proxy Contract Properties. + /// Backend TLS Properties. + /// Runtime Url of the Backend. + /// Backend communication protocol. + /// Keeps track of any properties unknown to the library. + internal ApiManagementBackendPatch(string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, Uri uri, BackendProtocol? protocol, Dictionary serializedAdditionalRawData) + { + Title = title; + Description = description; + ResourceUri = resourceUri; + Properties = properties; + Credentials = credentials; + Proxy = proxy; + Tls = tls; + Uri = uri; + Protocol = protocol; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Backend Title. public string Title { get; set; } /// Backend Description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCacheData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCacheData.Serialization.cs index 93a03c340f97..3a2fa5131a7c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCacheData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCacheData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementCacheData : IUtf8JsonSerializable + public partial class ApiManagementCacheData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -40,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ResourceUri.AbsoluteUri); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementCacheData DeserializeApiManagementCacheData(JsonElement element) + internal static ApiManagementCacheData DeserializeApiManagementCacheData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +78,7 @@ internal static ApiManagementCacheData DeserializeApiManagementCacheData(JsonEle Optional connectionString = default; Optional useFromLocation = default; Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -119,8 +141,61 @@ internal static ApiManagementCacheData DeserializeApiManagementCacheData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementCacheData(id, name, type, systemData.Value, description.Value, connectionString.Value, useFromLocation.Value, resourceId.Value, serializedAdditionalRawData); + } + + ApiManagementCacheData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementCacheData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementCacheData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementCacheData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementCacheData model) + { + if (model is null) + { + return null; } - return new ApiManagementCacheData(id, name, type, systemData.Value, description.Value, connectionString.Value, useFromLocation.Value, resourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementCacheData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementCacheData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.Serialization.cs index 849f37720771..ebe885ec3e26 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementCachePatch : IUtf8JsonSerializable + public partial class ApiManagementCachePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,7 +46,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ResourceUri.AbsoluteUri); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementCachePatch DeserializeApiManagementCachePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional connectionString = default; + Optional useFromLocation = default; + Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionString"u8)) + { + connectionString = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("useFromLocation"u8)) + { + useFromLocation = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("resourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new Uri(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementCachePatch(description.Value, connectionString.Value, useFromLocation.Value, resourceId.Value, serializedAdditionalRawData); + } + + ApiManagementCachePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementCachePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementCachePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementCachePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementCachePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementCachePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementCachePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.cs index ed3f268459d0..7d6d8f6bdf36 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCachePatch.cs @@ -6,17 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Cache update details. public partial class ApiManagementCachePatch { - /// Initializes a new instance of ApiManagementCachePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementCachePatch() { } + /// Initializes a new instance of . + /// Cache description. + /// Runtime connection string to cache. + /// Location identifier to use cache from (should be either 'default' or valid Azure region identifier). + /// Original uri of entity in external system cache points to. + /// Keeps track of any properties unknown to the library. + internal ApiManagementCachePatch(string description, string connectionString, string useFromLocation, Uri resourceUri, Dictionary serializedAdditionalRawData) + { + Description = description; + ConnectionString = connectionString; + UseFromLocation = useFromLocation; + ResourceUri = resourceUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Cache description. public string Description { get; set; } /// Runtime connection string to cache. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.Serialization.cs index bd4c250c14bf..a3f97aed913b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementCertificateCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementCertificateCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,10 +38,131 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultDetails)) { writer.WritePropertyName("keyVault"u8); - writer.WriteObjectValue(KeyVaultDetails); + if (KeyVaultDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultDetails).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementCertificateCreateOrUpdateContent DeserializeApiManagementCertificateCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional data = default; + Optional password = default; + Optional keyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("data"u8)) + { + data = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("password"u8)) + { + password = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("keyVault"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVault = KeyVaultContractCreateProperties.DeserializeKeyVaultContractCreateProperties(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementCertificateCreateOrUpdateContent(data.Value, password.Value, keyVault.Value, serializedAdditionalRawData); + } + + ApiManagementCertificateCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementCertificateCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementCertificateCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementCertificateCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementCertificateCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementCertificateCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementCertificateCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.cs index 3428c1cb4de9..4179812bb4f9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateCreateOrUpdateContent.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Certificate create or update details. public partial class ApiManagementCertificateCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementCertificateCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementCertificateCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Base 64 encoded certificate using the application/x-pkcs12 representation. + /// Password for the Certificate. + /// KeyVault location details of the certificate. + /// Keeps track of any properties unknown to the library. + internal ApiManagementCertificateCreateOrUpdateContent(string data, string password, KeyVaultContractCreateProperties keyVaultDetails, Dictionary serializedAdditionalRawData) + { + Data = data; + Password = password; + KeyVaultDetails = keyVaultDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Base 64 encoded certificate using the application/x-pkcs12 representation. public string Data { get; set; } /// Password for the Certificate. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateData.Serialization.cs index 87a7c9dbd630..3b7d6f59e458 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementCertificateData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementCertificateData : IUtf8JsonSerializable + public partial class ApiManagementCertificateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,14 +45,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultDetails)) { writer.WritePropertyName("keyVault"u8); - writer.WriteObjectValue(KeyVaultDetails); + if (KeyVaultDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultDetails).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementCertificateData DeserializeApiManagementCertificateData(JsonElement element) + internal static ApiManagementCertificateData DeserializeApiManagementCertificateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static ApiManagementCertificateData DeserializeApiManagementCertificate Optional thumbprint = default; Optional expirationDate = default; Optional keyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -124,8 +153,61 @@ internal static ApiManagementCertificateData DeserializeApiManagementCertificate } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementCertificateData(id, name, type, systemData.Value, subject.Value, thumbprint.Value, Optional.ToNullable(expirationDate), keyVault.Value, serializedAdditionalRawData); + } + + ApiManagementCertificateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementCertificateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementCertificateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementCertificateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementCertificateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementCertificateData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementCertificateData(id, name, type, systemData.Value, subject.Value, thumbprint.Value, Optional.ToNullable(expirationDate), keyVault.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementCertificateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementDeletedServiceData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementDeletedServiceData.Serialization.cs index 5e4b583a1d97..371d0a973bd9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementDeletedServiceData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementDeletedServiceData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementDeletedServiceData : IUtf8JsonSerializable + public partial class ApiManagementDeletedServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DeletedOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementDeletedServiceData DeserializeApiManagementDeletedServiceData(JsonElement element) + internal static ApiManagementDeletedServiceData DeserializeApiManagementDeletedServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +73,7 @@ internal static ApiManagementDeletedServiceData DeserializeApiManagementDeletedS Optional serviceId = default; Optional scheduledPurgeDate = default; Optional deletionDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -126,8 +148,61 @@ internal static ApiManagementDeletedServiceData DeserializeApiManagementDeletedS } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementDeletedServiceData(id, name, type, systemData.Value, Optional.ToNullable(location), serviceId.Value, Optional.ToNullable(scheduledPurgeDate), Optional.ToNullable(deletionDate), serializedAdditionalRawData); + } + + ApiManagementDeletedServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementDeletedServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementDeletedServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementDeletedServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementDeletedServiceData model) + { + if (model is null) + { + return null; } - return new ApiManagementDeletedServiceData(id, name, type, systemData.Value, Optional.ToNullable(location), serviceId.Value, Optional.ToNullable(scheduledPurgeDate), Optional.ToNullable(deletionDate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementDeletedServiceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementDeletedServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.Serialization.cs index fa807f381cbf..b9890eda2777 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementEmailTemplateCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementEmailTemplateCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,12 +51,150 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementEmailTemplateCreateOrUpdateContent DeserializeApiManagementEmailTemplateCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional subject = default; + Optional title = default; + Optional description = default; + Optional body = default; + Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("subject"u8)) + { + subject = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("title"u8)) + { + title = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("body"u8)) + { + body = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(EmailTemplateParametersContractProperties.DeserializeEmailTemplateParametersContractProperties(item)); + } + parameters = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementEmailTemplateCreateOrUpdateContent(subject.Value, title.Value, description.Value, body.Value, Optional.ToList(parameters), serializedAdditionalRawData); + } + + ApiManagementEmailTemplateCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementEmailTemplateCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementEmailTemplateCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementEmailTemplateCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementEmailTemplateCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementEmailTemplateCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementEmailTemplateCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.cs index 3b286f51fb09..8cce7112b851 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,32 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Email Template update Parameters. public partial class ApiManagementEmailTemplateCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementEmailTemplateCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementEmailTemplateCreateOrUpdateContent() { Parameters = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Subject of the Template. + /// Title of the Template. + /// Description of the Email Template. + /// Email Template Body. This should be a valid XDocument. + /// Email Template Parameter values. + /// Keeps track of any properties unknown to the library. + internal ApiManagementEmailTemplateCreateOrUpdateContent(string subject, string title, string description, string body, IList parameters, Dictionary serializedAdditionalRawData) + { + Subject = subject; + Title = title; + Description = description; + Body = body; + Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Subject of the Template. public string Subject { get; set; } /// Title of the Template. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateData.Serialization.cs index 0542f756f6a8..0f230702cb7f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementEmailTemplateData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementEmailTemplateData : IUtf8JsonSerializable + public partial class ApiManagementEmailTemplateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,16 +53,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementEmailTemplateData DeserializeApiManagementEmailTemplateData(JsonElement element) + internal static ApiManagementEmailTemplateData DeserializeApiManagementEmailTemplateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +98,7 @@ internal static ApiManagementEmailTemplateData DeserializeApiManagementEmailTemp Optional description = default; Optional isDefault = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -151,8 +180,61 @@ internal static ApiManagementEmailTemplateData DeserializeApiManagementEmailTemp } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementEmailTemplateData(id, name, type, systemData.Value, subject.Value, body.Value, title.Value, description.Value, Optional.ToNullable(isDefault), Optional.ToList(parameters), serializedAdditionalRawData); + } + + ApiManagementEmailTemplateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementEmailTemplateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementEmailTemplateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementEmailTemplateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementEmailTemplateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementEmailTemplateData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementEmailTemplateData(id, name, type, systemData.Value, subject.Value, body.Value, title.Value, description.Value, Optional.ToNullable(isDefault), Optional.ToList(parameters)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementEmailTemplateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.Serialization.cs index b67c424a74da..37a857ba2df0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.Serialization.cs @@ -5,16 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementGatewayApiListResult + internal partial class ApiManagementGatewayApiListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementGatewayApiListResult DeserializeApiManagementGatewayApiListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementGatewayApiListResult DeserializeApiManagementGatewayApiListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +54,7 @@ internal static ApiManagementGatewayApiListResult DeserializeApiManagementGatewa Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +85,61 @@ internal static ApiManagementGatewayApiListResult DeserializeApiManagementGatewa nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementGatewayApiListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiManagementGatewayApiListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiManagementGatewayApiListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGatewayApiListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGatewayApiListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGatewayApiListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGatewayApiListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGatewayApiListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGatewayApiListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.cs index df27a72c9fa0..f54b85619f94 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayApiListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged API list representation. internal partial class ApiManagementGatewayApiListResult { - /// Initializes a new instance of ApiManagementGatewayApiListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementGatewayApiListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementGatewayApiListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiManagementGatewayApiListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGatewayApiListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayCertificateAuthorityData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayCertificateAuthorityData.Serialization.cs index c4b2948136a6..fd3e82aef868 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayCertificateAuthorityData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayCertificateAuthorityData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementGatewayCertificateAuthorityData : IUtf8JsonSerializable + public partial class ApiManagementGatewayCertificateAuthorityData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsTrusted.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementGatewayCertificateAuthorityData DeserializeApiManagementGatewayCertificateAuthorityData(JsonElement element) + internal static ApiManagementGatewayCertificateAuthorityData DeserializeApiManagementGatewayCertificateAuthorityData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static ApiManagementGatewayCertificateAuthorityData DeserializeApiManag ResourceType type = default; Optional systemData = default; Optional isTrusted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -85,8 +108,61 @@ internal static ApiManagementGatewayCertificateAuthorityData DeserializeApiManag } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGatewayCertificateAuthorityData(id, name, type, systemData.Value, Optional.ToNullable(isTrusted), serializedAdditionalRawData); + } + + ApiManagementGatewayCertificateAuthorityData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGatewayCertificateAuthorityData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGatewayCertificateAuthorityData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGatewayCertificateAuthorityData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGatewayCertificateAuthorityData model) + { + if (model is null) + { + return null; } - return new ApiManagementGatewayCertificateAuthorityData(id, name, type, systemData.Value, Optional.ToNullable(isTrusted)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGatewayCertificateAuthorityData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGatewayCertificateAuthorityData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayData.Serialization.cs index cf3d8581fb5f..12497541a358 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayData.Serialization.cs @@ -5,24 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementGatewayData : IUtf8JsonSerializable + public partial class ApiManagementGatewayData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(LocationData)) { writer.WritePropertyName("locationData"u8); - writer.WriteObjectValue(LocationData); + if (LocationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LocationData).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -30,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementGatewayData DeserializeApiManagementGatewayData(JsonElement element) + internal static ApiManagementGatewayData DeserializeApiManagementGatewayData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +74,7 @@ internal static ApiManagementGatewayData DeserializeApiManagementGatewayData(Jso Optional systemData = default; Optional locationData = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +127,61 @@ internal static ApiManagementGatewayData DeserializeApiManagementGatewayData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGatewayData(id, name, type, systemData.Value, locationData.Value, description.Value, serializedAdditionalRawData); + } + + ApiManagementGatewayData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGatewayData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGatewayData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGatewayData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGatewayData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGatewayData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementGatewayData(id, name, type, systemData.Value, locationData.Value, description.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGatewayData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayHostnameConfigurationData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayHostnameConfigurationData.Serialization.cs index 71ed64f523d6..e664e07c9a94 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayHostnameConfigurationData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGatewayHostnameConfigurationData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementGatewayHostnameConfigurationData : IUtf8JsonSerializable + public partial class ApiManagementGatewayHostnameConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -49,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsHttp2_0Enabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementGatewayHostnameConfigurationData DeserializeApiManagementGatewayHostnameConfigurationData(JsonElement element) + internal static ApiManagementGatewayHostnameConfigurationData DeserializeApiManagementGatewayHostnameConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +90,7 @@ internal static ApiManagementGatewayHostnameConfigurationData DeserializeApiMana Optional tls10Enabled = default; Optional tls11Enabled = default; Optional http2Enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -152,8 +175,61 @@ internal static ApiManagementGatewayHostnameConfigurationData DeserializeApiMana } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGatewayHostnameConfigurationData(id, name, type, systemData.Value, hostname.Value, certificateId.Value, Optional.ToNullable(negotiateClientCertificate), Optional.ToNullable(tls10Enabled), Optional.ToNullable(tls11Enabled), Optional.ToNullable(http2Enabled), serializedAdditionalRawData); + } + + ApiManagementGatewayHostnameConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGatewayHostnameConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGatewayHostnameConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGatewayHostnameConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGatewayHostnameConfigurationData model) + { + if (model is null) + { + return null; } - return new ApiManagementGatewayHostnameConfigurationData(id, name, type, systemData.Value, hostname.Value, certificateId.Value, Optional.ToNullable(negotiateClientCertificate), Optional.ToNullable(tls10Enabled), Optional.ToNullable(tls11Enabled), Optional.ToNullable(http2Enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGatewayHostnameConfigurationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGatewayHostnameConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs index 96a578743f60..2d9183763bd5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGlobalSchemaData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementGlobalSchemaData : IUtf8JsonSerializable + public partial class ApiManagementGlobalSchemaData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -49,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementGlobalSchemaData DeserializeApiManagementGlobalSchemaData(JsonElement element) + internal static ApiManagementGlobalSchemaData DeserializeApiManagementGlobalSchemaData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +87,7 @@ internal static ApiManagementGlobalSchemaData DeserializeApiManagementGlobalSche Optional description = default; Optional value = default; Optional document = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -136,8 +158,61 @@ internal static ApiManagementGlobalSchemaData DeserializeApiManagementGlobalSche } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementGlobalSchemaData(id, name, type, systemData.Value, Optional.ToNullable(schemaType), description.Value, value.Value, document.Value); + return new ApiManagementGlobalSchemaData(id, name, type, systemData.Value, Optional.ToNullable(schemaType), description.Value, value.Value, document.Value, serializedAdditionalRawData); + } + + ApiManagementGlobalSchemaData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGlobalSchemaData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGlobalSchemaData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGlobalSchemaData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGlobalSchemaData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGlobalSchemaData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGlobalSchemaData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs index 72bfd9337aff..b5b1141464e6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementGroupCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,7 +46,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExternalId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementGroupCreateOrUpdateContent DeserializeApiManagementGroupCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional description = default; + Optional type = default; + Optional externalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property0.Value.GetString().ToApiManagementGroupType(); + continue; + } + if (property0.NameEquals("externalId"u8)) + { + externalId = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGroupCreateOrUpdateContent(displayName.Value, description.Value, Optional.ToNullable(type), externalId.Value, serializedAdditionalRawData); + } + + ApiManagementGroupCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGroupCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGroupCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGroupCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGroupCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGroupCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGroupCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs index 94fc8970c977..e928c4ec7e8c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Create Group operation. public partial class ApiManagementGroupCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementGroupCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGroupCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Group name. + /// Group description. + /// Group type. + /// Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + /// Keeps track of any properties unknown to the library. + internal ApiManagementGroupCreateOrUpdateContent(string displayName, string description, ApiManagementGroupType? apiManagementGroupType, string externalId, Dictionary serializedAdditionalRawData) + { + DisplayName = displayName; + Description = description; + ApiManagementGroupType = apiManagementGroupType; + ExternalId = externalId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Group name. public string DisplayName { get; set; } /// Group description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupData.Serialization.cs index 23441b0cbff5..d9015e00d79b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementGroupData : IUtf8JsonSerializable + public partial class ApiManagementGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExternalId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementGroupData DeserializeApiManagementGroupData(JsonElement element) + internal static ApiManagementGroupData DeserializeApiManagementGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +80,7 @@ internal static ApiManagementGroupData DeserializeApiManagementGroupData(JsonEle Optional builtIn = default; Optional type0 = default; Optional externalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -129,8 +152,61 @@ internal static ApiManagementGroupData DeserializeApiManagementGroupData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGroupData(id, name, type, systemData.Value, displayName.Value, description.Value, Optional.ToNullable(builtIn), Optional.ToNullable(type0), externalId.Value, serializedAdditionalRawData); + } + + ApiManagementGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGroupData model) + { + if (model is null) + { + return null; } - return new ApiManagementGroupData(id, name, type, systemData.Value, displayName.Value, description.Value, Optional.ToNullable(builtIn), Optional.ToNullable(type0), externalId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs index 69851709ceac..85f17bb0338c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupPatch : IUtf8JsonSerializable + public partial class ApiManagementGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,7 +46,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExternalId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementGroupPatch DeserializeApiManagementGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional description = default; + Optional type = default; + Optional externalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property0.Value.GetString().ToApiManagementGroupType(); + continue; + } + if (property0.NameEquals("externalId"u8)) + { + externalId = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGroupPatch(displayName.Value, description.Value, Optional.ToNullable(type), externalId.Value, serializedAdditionalRawData); + } + + ApiManagementGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs index c2a6aeb36c87..b25b066dd7af 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Update Group operation. public partial class ApiManagementGroupPatch { - /// Initializes a new instance of ApiManagementGroupPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGroupPatch() { } + /// Initializes a new instance of . + /// Group name. + /// Group description. + /// Group type. + /// Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + /// Keeps track of any properties unknown to the library. + internal ApiManagementGroupPatch(string displayName, string description, ApiManagementGroupType? apiManagementGroupType, string externalId, Dictionary serializedAdditionalRawData) + { + DisplayName = displayName; + Description = description; + ApiManagementGroupType = apiManagementGroupType; + ExternalId = externalId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Group name. public string DisplayName { get; set; } /// Group description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.Serialization.cs index cd4a7690fb3e..91ad8f3fdc94 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupUserData : IUtf8JsonSerializable + public partial class ApiManagementGroupUserData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -36,7 +42,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Identities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -61,11 +74,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RegistriesOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementGroupUserData DeserializeApiManagementGroupUserData(JsonElement element) + internal static ApiManagementGroupUserData DeserializeApiManagementGroupUserData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -82,6 +109,7 @@ internal static ApiManagementGroupUserData DeserializeApiManagementGroupUserData Optional email = default; Optional registrationDate = default; Optional> groups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -186,8 +214,61 @@ internal static ApiManagementGroupUserData DeserializeApiManagementGroupUserData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementGroupUserData(id, name, type, systemData.Value, Optional.ToNullable(state), note.Value, Optional.ToList(identities), firstName.Value, lastName.Value, email.Value, Optional.ToNullable(registrationDate), Optional.ToList(groups), serializedAdditionalRawData); + } + + ApiManagementGroupUserData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGroupUserData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGroupUserData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGroupUserData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGroupUserData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGroupUserData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementGroupUserData(id, name, type, systemData.Value, Optional.ToNullable(state), note.Value, Optional.ToList(identities), firstName.Value, lastName.Value, email.Value, Optional.ToNullable(registrationDate), Optional.ToList(groups)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGroupUserData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.cs index 9d473699beac..a67f822e1b44 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserData.cs @@ -15,14 +15,17 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The ApiManagementGroupUserData. public partial class ApiManagementGroupUserData : ResourceData { - /// Initializes a new instance of ApiManagementGroupUserData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementGroupUserData() { Identities = new ChangeTrackingList(); Groups = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementGroupUserData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +41,8 @@ public ApiManagementGroupUserData() /// /// /// Collection of groups user is part of. - internal ApiManagementGroupUserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementUserState? state, string note, IList identities, string firstName, string lastName, string email, DateTimeOffset? registriesOn, IReadOnlyList groups) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGroupUserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementUserState? state, string note, IList identities, string firstName, string lastName, string email, DateTimeOffset? registriesOn, IReadOnlyList groups, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { State = state; Note = note; @@ -48,6 +52,7 @@ internal ApiManagementGroupUserData(ResourceIdentifier id, string name, Resource Email = email; RegistriesOn = registriesOn; Groups = groups; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.Serialization.cs index 28f5bdadebd8..21066cf5a211 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementGroupUserListResult + internal partial class ApiManagementGroupUserListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementGroupUserListResult DeserializeApiManagementGroupUserListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementGroupUserListResult DeserializeApiManagementGroupUserListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static ApiManagementGroupUserListResult DeserializeApiManagementGroupUs Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static ApiManagementGroupUserListResult DeserializeApiManagementGroupUs nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementGroupUserListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiManagementGroupUserListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiManagementGroupUserListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementGroupUserListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementGroupUserListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementGroupUserListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementGroupUserListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementGroupUserListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementGroupUserListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.cs index 3200c9dca8f4..eefde460113c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupUserListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Group Users list representation. internal partial class ApiManagementGroupUserListResult { - /// Initializes a new instance of ApiManagementGroupUserListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementGroupUserListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementGroupUserListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiManagementGroupUserListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiManagementGroupUserListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs index 65b43698e7b1..5609b6405fe8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementIdentityProviderCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementIdentityProviderCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -75,11 +82,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeApiManagementIdentityProviderCreateOrUpdateContent(JsonElement element) + internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeApiManagementIdentityProviderCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,6 +119,7 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp Optional passwordResetPolicyName = default; Optional clientId = default; Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -199,8 +221,61 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementIdentityProviderCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementIdentityProviderCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementIdentityProviderCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementIdentityProviderCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementIdentityProviderCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementIdentityProviderCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementIdentityProviderCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs index f5414bdbf9f7..4ece0e15f343 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Identity Provider details. public partial class ApiManagementIdentityProviderCreateOrUpdateContent : ResourceData { - /// Initializes a new instance of ApiManagementIdentityProviderCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementIdentityProviderCreateOrUpdateContent() { AllowedTenants = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementIdentityProviderCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public ApiManagementIdentityProviderCreateOrUpdateContent() /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -47,6 +52,7 @@ internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier i PasswordResetPolicyName = passwordResetPolicyName; ClientId = clientId; ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identity Provider Type identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs index 77624f0e7b02..65eb56962508 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementIdentityProviderData : IUtf8JsonSerializable + public partial class ApiManagementIdentityProviderData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -76,11 +83,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementIdentityProviderData DeserializeApiManagementIdentityProviderData(JsonElement element) + internal static ApiManagementIdentityProviderData DeserializeApiManagementIdentityProviderData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -99,6 +120,7 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti Optional passwordResetPolicyName = default; Optional clientId = default; Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -200,8 +222,61 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementIdentityProviderData(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementIdentityProviderData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementIdentityProviderData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementIdentityProviderData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementIdentityProviderData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementIdentityProviderData model) + { + if (model is null) + { + return null; } - return new ApiManagementIdentityProviderData(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementIdentityProviderData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementIdentityProviderData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs index 0fd832756a99..4285f231fd40 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementIdentityProviderPatch : IUtf8JsonSerializable + public partial class ApiManagementIdentityProviderPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -73,7 +81,172 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementIdentityProviderPatch DeserializeApiManagementIdentityProviderPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional type = default; + Optional signinTenant = default; + Optional> allowedTenants = default; + Optional authority = default; + Optional signupPolicyName = default; + Optional signinPolicyName = default; + Optional profileEditingPolicyName = default; + Optional passwordResetPolicyName = default; + Optional clientId = default; + Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new IdentityProviderType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("signinTenant"u8)) + { + signinTenant = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("allowedTenants"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedTenants = array; + continue; + } + if (property0.NameEquals("authority"u8)) + { + authority = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("signupPolicyName"u8)) + { + signupPolicyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("signinPolicyName"u8)) + { + signinPolicyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("profileEditingPolicyName"u8)) + { + profileEditingPolicyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("passwordResetPolicyName"u8)) + { + passwordResetPolicyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientId"u8)) + { + clientId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientSecret"u8)) + { + clientSecret = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementIdentityProviderPatch(Optional.ToNullable(type), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementIdentityProviderPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementIdentityProviderPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementIdentityProviderPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementIdentityProviderPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementIdentityProviderPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementIdentityProviderPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementIdentityProviderPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs index 74d338d8322e..42dfbaecf16e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,42 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Parameters supplied to update Identity Provider. public partial class ApiManagementIdentityProviderPatch { - /// Initializes a new instance of ApiManagementIdentityProviderPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementIdentityProviderPatch() { AllowedTenants = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Identity Provider Type identifier. + /// The TenantId to use instead of Common when logging into Active Directory. + /// List of Allowed Tenants when configuring Azure Active Directory login. + /// OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + /// Signup Policy Name. Only applies to AAD B2C Identity Provider. + /// Signin Policy Name. Only applies to AAD B2C Identity Provider. + /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + /// Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. + /// Keeps track of any properties unknown to the library. + internal ApiManagementIdentityProviderPatch(IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) + { + IdentityProviderType = identityProviderType; + SignInTenant = signInTenant; + AllowedTenants = allowedTenants; + Authority = authority; + SignUpPolicyName = signUpPolicyName; + SignInPolicyName = signInPolicyName; + ProfileEditingPolicyName = profileEditingPolicyName; + PasswordResetPolicyName = passwordResetPolicyName; + ClientId = clientId; + ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Identity Provider Type identifier. public IdentityProviderType? IdentityProviderType { get; set; } /// The TenantId to use instead of Common when logging into Active Directory. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerData.Serialization.cs index fd0f088949a9..94b16869061c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementLoggerData : IUtf8JsonSerializable + public partial class ApiManagementLoggerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -52,11 +59,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ResourceId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementLoggerData DeserializeApiManagementLoggerData(JsonElement element) + internal static ApiManagementLoggerData DeserializeApiManagementLoggerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +91,7 @@ internal static ApiManagementLoggerData DeserializeApiManagementLoggerData(JsonE Optional> credentials = default; Optional isBuffered = default; Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -154,8 +176,61 @@ internal static ApiManagementLoggerData DeserializeApiManagementLoggerData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementLoggerData(id, name, type, systemData.Value, Optional.ToNullable(loggerType), description.Value, Optional.ToDictionary(credentials), Optional.ToNullable(isBuffered), resourceId.Value, serializedAdditionalRawData); + } + + ApiManagementLoggerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementLoggerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementLoggerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementLoggerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementLoggerData model) + { + if (model is null) + { + return null; } - return new ApiManagementLoggerData(id, name, type, systemData.Value, Optional.ToNullable(loggerType), description.Value, Optional.ToDictionary(credentials), Optional.ToNullable(isBuffered), resourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementLoggerData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementLoggerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.Serialization.cs index 85c12cb511d8..240e69c5ad31 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementLoggerPatch : IUtf8JsonSerializable + public partial class ApiManagementLoggerPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -44,7 +52,140 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsBuffered.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementLoggerPatch DeserializeApiManagementLoggerPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional loggerType = default; + Optional description = default; + Optional> credentials = default; + Optional isBuffered = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("loggerType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggerType = new LoggerType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("credentials"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + credentials = dictionary; + continue; + } + if (property0.NameEquals("isBuffered"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isBuffered = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementLoggerPatch(Optional.ToNullable(loggerType), description.Value, Optional.ToDictionary(credentials), Optional.ToNullable(isBuffered), serializedAdditionalRawData); + } + + ApiManagementLoggerPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementLoggerPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementLoggerPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementLoggerPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementLoggerPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementLoggerPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementLoggerPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.cs index 864902b018cf..ff3bc11ddff4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementLoggerPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Logger update contract. public partial class ApiManagementLoggerPatch { - /// Initializes a new instance of ApiManagementLoggerPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementLoggerPatch() { Credentials = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Logger type. + /// Logger description. + /// Logger credentials. + /// Whether records are buffered in the logger before publishing. Default is assumed to be true. + /// Keeps track of any properties unknown to the library. + internal ApiManagementLoggerPatch(LoggerType? loggerType, string description, IDictionary credentials, bool? isBuffered, Dictionary serializedAdditionalRawData) + { + LoggerType = loggerType; + Description = description; + Credentials = credentials; + IsBuffered = isBuffered; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Logger type. public LoggerType? LoggerType { get; set; } /// Logger description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs index 98b6ad01e175..9be481048c4b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementNamedValueCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementNamedValueCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -47,14 +54,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVault)) { writer.WritePropertyName("keyVault"u8); - writer.WriteObjectValue(KeyVault); + if (KeyVault is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVault).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManagementNamedValueCreateOrUpdateContent(JsonElement element) + internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManagementNamedValueCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +96,7 @@ internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManag Optional displayName = default; Optional value = default; Optional keyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -148,8 +177,61 @@ internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManag } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementNamedValueCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value, serializedAdditionalRawData); + } + + ApiManagementNamedValueCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementNamedValueCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementNamedValueCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementNamedValueCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementNamedValueCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementNamedValueCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementNamedValueCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementNamedValueCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs index fdc362808a81..c2ec7bfc8224 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// NamedValue details. public partial class ApiManagementNamedValueCreateOrUpdateContent : ResourceData { - /// Initializes a new instance of ApiManagementNamedValueCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementNamedValueCreateOrUpdateContent() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementNamedValueCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,13 +34,15 @@ public ApiManagementNamedValueCreateOrUpdateContent() /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. - internal ApiManagementNamedValueCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementNamedValueCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Tags = tags; IsSecret = isSecret; DisplayName = displayName; Value = value; KeyVault = keyVault; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Optional tags that when provided can be used to filter the NamedValue list. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs index 9fd7092f881b..e131ff8d9f34 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementNamedValueData : IUtf8JsonSerializable + public partial class ApiManagementNamedValueData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -48,14 +55,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultDetails)) { writer.WritePropertyName("keyVault"u8); - writer.WriteObjectValue(KeyVaultDetails); + if (KeyVaultDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultDetails).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementNamedValueData DeserializeApiManagementNamedValueData(JsonElement element) + internal static ApiManagementNamedValueData DeserializeApiManagementNamedValueData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +97,7 @@ internal static ApiManagementNamedValueData DeserializeApiManagementNamedValueDa Optional displayName = default; Optional value = default; Optional keyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -149,8 +178,61 @@ internal static ApiManagementNamedValueData DeserializeApiManagementNamedValueDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementNamedValueData(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value, serializedAdditionalRawData); + } + + ApiManagementNamedValueData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementNamedValueData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementNamedValueData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementNamedValueData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementNamedValueData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementNamedValueData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementNamedValueData(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementNamedValueData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs index 7482ee164940..d28197e6b020 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementNamedValuePatch : IUtf8JsonSerializable + public partial class ApiManagementNamedValuePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -45,10 +53,156 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVault)) { writer.WritePropertyName("keyVault"u8); - writer.WriteObjectValue(KeyVault); + if (KeyVault is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVault).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementNamedValuePatch DeserializeApiManagementNamedValuePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional secret = default; + Optional displayName = default; + Optional value = default; + Optional keyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("tags"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + tags = array; + continue; + } + if (property0.NameEquals("secret"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secret = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("keyVault"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVault = KeyVaultContractCreateProperties.DeserializeKeyVaultContractCreateProperties(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementNamedValuePatch(Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value, serializedAdditionalRawData); + } + + ApiManagementNamedValuePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementNamedValuePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementNamedValuePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementNamedValuePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementNamedValuePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementNamedValuePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementNamedValuePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs index c4a8d7a37e6c..69a7e676448f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,32 @@ namespace Azure.ResourceManager.ApiManagement.Models /// NamedValue update Parameters. public partial class ApiManagementNamedValuePatch { - /// Initializes a new instance of ApiManagementNamedValuePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementNamedValuePatch() { Tags = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Optional tags that when provided can be used to filter the NamedValue list. + /// Determines whether the value is a secret and should be encrypted or not. Default value is false. + /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. + /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. + /// KeyVault location details of the namedValue. + /// Keeps track of any properties unknown to the library. + internal ApiManagementNamedValuePatch(IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault, Dictionary serializedAdditionalRawData) + { + Tags = tags; + IsSecret = isSecret; + DisplayName = displayName; + Value = value; + KeyVault = keyVault; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Optional tags that when provided can be used to filter the NamedValue list. public IList Tags { get; } /// Determines whether the value is a secret and should be encrypted or not. Default value is false. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNotificationData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNotificationData.Serialization.cs index 5acfdf5e09f9..df76a682acf8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNotificationData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNotificationData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementNotificationData : IUtf8JsonSerializable + public partial class ApiManagementNotificationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -32,14 +40,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Recipients)) { writer.WritePropertyName("recipients"u8); - writer.WriteObjectValue(Recipients); + if (Recipients is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recipients).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementNotificationData DeserializeApiManagementNotificationData(JsonElement element) + internal static ApiManagementNotificationData DeserializeApiManagementNotificationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +80,7 @@ internal static ApiManagementNotificationData DeserializeApiManagementNotificati Optional title = default; Optional description = default; Optional recipients = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -108,8 +138,61 @@ internal static ApiManagementNotificationData DeserializeApiManagementNotificati } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementNotificationData(id, name, type, systemData.Value, title.Value, description.Value, recipients.Value, serializedAdditionalRawData); + } + + ApiManagementNotificationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementNotificationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementNotificationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementNotificationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementNotificationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementNotificationData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementNotificationData(id, name, type, systemData.Value, title.Value, description.Value, recipients.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementNotificationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs index 734443ef809d..2aa9b00f06f6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementOpenIdConnectProviderData : IUtf8JsonSerializable + public partial class ApiManagementOpenIdConnectProviderData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -44,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementOpenIdConnectProviderData(JsonElement element) + internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementOpenIdConnectProviderData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +84,7 @@ internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementO Optional metadataEndpoint = default; Optional clientId = default; Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -125,8 +148,61 @@ internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementO } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementOpenIdConnectProviderData(id, name, type, systemData.Value, displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementOpenIdConnectProviderData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementOpenIdConnectProviderData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementOpenIdConnectProviderData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementOpenIdConnectProviderData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementOpenIdConnectProviderData model) + { + if (model is null) + { + return null; } - return new ApiManagementOpenIdConnectProviderData(id, name, type, systemData.Value, displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementOpenIdConnectProviderData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementOpenIdConnectProviderData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs index e8f0b52e9273..5f6b5bf4f3e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementOpenIdConnectProviderPatch : IUtf8JsonSerializable + public partial class ApiManagementOpenIdConnectProviderPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,7 +51,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClientSecret); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementOpenIdConnectProviderPatch DeserializeApiManagementOpenIdConnectProviderPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional description = default; + Optional metadataEndpoint = default; + Optional clientId = default; + Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("metadataEndpoint"u8)) + { + metadataEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientId"u8)) + { + clientId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientSecret"u8)) + { + clientSecret = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementOpenIdConnectProviderPatch(displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + ApiManagementOpenIdConnectProviderPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementOpenIdConnectProviderPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementOpenIdConnectProviderPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementOpenIdConnectProviderPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementOpenIdConnectProviderPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementOpenIdConnectProviderPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementOpenIdConnectProviderPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs index 789866c59544..e010323c18d6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Update OpenID Connect Provider operation. public partial class ApiManagementOpenIdConnectProviderPatch { - /// Initializes a new instance of ApiManagementOpenIdConnectProviderPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementOpenIdConnectProviderPatch() { } + /// Initializes a new instance of . + /// User-friendly OpenID Connect Provider name. + /// User-friendly description of OpenID Connect Provider. + /// Metadata endpoint URI. + /// Client ID of developer console which is the client application. + /// Client Secret of developer console which is the client application. + /// Keeps track of any properties unknown to the library. + internal ApiManagementOpenIdConnectProviderPatch(string displayName, string description, string metadataEndpoint, string clientId, string clientSecret, Dictionary serializedAdditionalRawData) + { + DisplayName = displayName; + Description = description; + MetadataEndpoint = metadataEndpoint; + ClientId = clientId; + ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// User-friendly OpenID Connect Provider name. public string DisplayName { get; set; } /// User-friendly description of OpenID Connect Provider. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalDelegationSettingData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalDelegationSettingData.Serialization.cs index d7b800b07508..1da738169d28 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalDelegationSettingData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalDelegationSettingData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementPortalDelegationSettingData : IUtf8JsonSerializable + public partial class ApiManagementPortalDelegationSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,19 +40,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Subscriptions)) { writer.WritePropertyName("subscriptions"u8); - writer.WriteObjectValue(Subscriptions); + if (Subscriptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Subscriptions).Serialize(writer, options); + } } if (Optional.IsDefined(UserRegistration)) { writer.WritePropertyName("userRegistration"u8); - writer.WriteObjectValue(UserRegistration); + if (UserRegistration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserRegistration).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPortalDelegationSettingData DeserializeApiManagementPortalDelegationSettingData(JsonElement element) + internal static ApiManagementPortalDelegationSettingData DeserializeApiManagementPortalDelegationSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +93,7 @@ internal static ApiManagementPortalDelegationSettingData DeserializeApiManagemen Optional validationKey = default; Optional subscriptions = default; Optional userRegistration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -128,8 +164,61 @@ internal static ApiManagementPortalDelegationSettingData DeserializeApiManagemen } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPortalDelegationSettingData(id, name, type, systemData.Value, uri.Value, validationKey.Value, subscriptions.Value, userRegistration.Value, serializedAdditionalRawData); + } + + ApiManagementPortalDelegationSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPortalDelegationSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPortalDelegationSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPortalDelegationSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPortalDelegationSettingData model) + { + if (model is null) + { + return null; } - return new ApiManagementPortalDelegationSettingData(id, name, type, systemData.Value, uri.Value, validationKey.Value, subscriptions.Value, userRegistration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPortalDelegationSettingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPortalDelegationSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs index 408eae306bfd..7d64e2055e00 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalRevisionData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementPortalRevisionData : IUtf8JsonSerializable + public partial class ApiManagementPortalRevisionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsCurrent.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPortalRevisionData DeserializeApiManagementPortalRevisionData(JsonElement element) + internal static ApiManagementPortalRevisionData DeserializeApiManagementPortalRevisionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +71,7 @@ internal static ApiManagementPortalRevisionData DeserializeApiManagementPortalRe Optional isCurrent = default; Optional createdDateTime = default; Optional updatedDateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -134,8 +156,61 @@ internal static ApiManagementPortalRevisionData DeserializeApiManagementPortalRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPortalRevisionData(id, name, type, systemData.Value, description.Value, statusDetails.Value, Optional.ToNullable(status), Optional.ToNullable(isCurrent), Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime), serializedAdditionalRawData); + } + + ApiManagementPortalRevisionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPortalRevisionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPortalRevisionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPortalRevisionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPortalRevisionData model) + { + if (model is null) + { + return null; } - return new ApiManagementPortalRevisionData(id, name, type, systemData.Value, description.Value, statusDetails.Value, Optional.ToNullable(status), Optional.ToNullable(isCurrent), Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPortalRevisionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPortalRevisionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignInSettingData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignInSettingData.Serialization.cs index 29ff925b5a87..8f8086f5536d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignInSettingData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignInSettingData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementPortalSignInSettingData : IUtf8JsonSerializable + public partial class ApiManagementPortalSignInSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsRedirectEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPortalSignInSettingData DeserializeApiManagementPortalSignInSettingData(JsonElement element) + internal static ApiManagementPortalSignInSettingData DeserializeApiManagementPortalSignInSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static ApiManagementPortalSignInSettingData DeserializeApiManagementPor ResourceType type = default; Optional systemData = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -85,8 +108,61 @@ internal static ApiManagementPortalSignInSettingData DeserializeApiManagementPor } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPortalSignInSettingData(id, name, type, systemData.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ApiManagementPortalSignInSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPortalSignInSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPortalSignInSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPortalSignInSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPortalSignInSettingData model) + { + if (model is null) + { + return null; } - return new ApiManagementPortalSignInSettingData(id, name, type, systemData.Value, Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPortalSignInSettingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPortalSignInSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignUpSettingData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignUpSettingData.Serialization.cs index d86d53f71890..58543f62fb55 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignUpSettingData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPortalSignUpSettingData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementPortalSignUpSettingData : IUtf8JsonSerializable + public partial class ApiManagementPortalSignUpSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -27,14 +35,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TermsOfService)) { writer.WritePropertyName("termsOfService"u8); - writer.WriteObjectValue(TermsOfService); + if (TermsOfService is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TermsOfService).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPortalSignUpSettingData DeserializeApiManagementPortalSignUpSettingData(JsonElement element) + internal static ApiManagementPortalSignUpSettingData DeserializeApiManagementPortalSignUpSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +74,7 @@ internal static ApiManagementPortalSignUpSettingData DeserializeApiManagementPor Optional systemData = default; Optional enabled = default; Optional termsOfService = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -101,8 +131,61 @@ internal static ApiManagementPortalSignUpSettingData DeserializeApiManagementPor } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPortalSignUpSettingData(id, name, type, systemData.Value, Optional.ToNullable(enabled), termsOfService.Value, serializedAdditionalRawData); + } + + ApiManagementPortalSignUpSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPortalSignUpSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPortalSignUpSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPortalSignUpSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPortalSignUpSettingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPortalSignUpSettingData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementPortalSignUpSettingData(id, name, type, systemData.Value, Optional.ToNullable(enabled), termsOfService.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPortalSignUpSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs index a41435412845..0fce75dc1c03 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementPrivateEndpointConnectionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementPrivateEndpointConnectionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -23,9 +31,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ApiManagementPrivateEndpointConnectionCreateOrUpdateContent DeserializeApiManagementPrivateEndpointConnectionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PrivateEndpointConnectionRequestProperties.DeserializePrivateEndpointConnectionRequestProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPrivateEndpointConnectionCreateOrUpdateContent(id.Value, properties.Value, serializedAdditionalRawData); + } + + ApiManagementPrivateEndpointConnectionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPrivateEndpointConnectionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPrivateEndpointConnectionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPrivateEndpointConnectionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPrivateEndpointConnectionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPrivateEndpointConnectionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPrivateEndpointConnectionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.cs index f01878b5a1da..b9fe26e91954 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionCreateOrUpdateContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// A request to approve or reject a private endpoint connection. public partial class ApiManagementPrivateEndpointConnectionCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementPrivateEndpointConnectionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPrivateEndpointConnectionCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Private Endpoint Connection Resource Id. + /// The connection state of the private endpoint connection. + /// Keeps track of any properties unknown to the library. + internal ApiManagementPrivateEndpointConnectionCreateOrUpdateContent(ResourceIdentifier id, PrivateEndpointConnectionRequestProperties properties, Dictionary serializedAdditionalRawData) + { + Id = id; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Private Endpoint Connection Resource Id. public ResourceIdentifier Id { get; set; } /// The connection state of the private endpoint connection. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionData.Serialization.cs index 458c7ab5679b..955545ed73c3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class ApiManagementPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPrivateEndpointConnectionData DeserializeApiManagementPrivateEndpointConnectionData(JsonElement element) + internal static ApiManagementPrivateEndpointConnectionData DeserializeApiManagementPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +76,7 @@ internal static ApiManagementPrivateEndpointConnectionData DeserializeApiManagem Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static ApiManagementPrivateEndpointConnectionData DeserializeApiManagem } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ApiManagementPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new ApiManagementPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.Serialization.cs index 5610836afc6c..2d4787c75aa0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementPrivateEndpointConnectionListResult + internal partial class ApiManagementPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementPrivateEndpointConnectionListResult DeserializeApiManagementPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementPrivateEndpointConnectionListResult DeserializeApiManagementPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static ApiManagementPrivateEndpointConnectionListResult DeserializeApiM value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new ApiManagementPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ApiManagementPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.cs index ff5bcdd489eb..6e4be880a6ab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.ApiManagement.Models /// List of private endpoint connection associated with the specified storage account. internal partial class ApiManagementPrivateEndpointConnectionListResult { - /// Initializes a new instance of ApiManagementPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal ApiManagementPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceData.Serialization.cs index e2d65a573989..ef5ae82097a4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementPrivateLinkResourceData : IUtf8JsonSerializable + public partial class ApiManagementPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPrivateLinkResourceData DeserializeApiManagementPrivateLinkResourceData(JsonElement element) + internal static ApiManagementPrivateLinkResourceData DeserializeApiManagementPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static ApiManagementPrivateLinkResourceData DeserializeApiManagementPri Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -117,8 +139,61 @@ internal static ApiManagementPrivateLinkResourceData DeserializeApiManagementPri } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + ApiManagementPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new ApiManagementPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.Serialization.cs index e128908f881d..242a420332c2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementPrivateLinkResourceListResult + internal partial class ApiManagementPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementPrivateLinkResourceListResult DeserializeApiManagementPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementPrivateLinkResourceListResult DeserializeApiManagementPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static ApiManagementPrivateLinkResourceListResult DeserializeApiManagem value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementPrivateLinkResourceListResult(Optional.ToList(value)); + return new ApiManagementPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ApiManagementPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.cs index ee634e2a4c44..dc3f61bdd43d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.ApiManagement.Models /// A list of private link resources. internal partial class ApiManagementPrivateLinkResourceListResult { - /// Initializes a new instance of ApiManagementPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal ApiManagementPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.Serialization.cs index 020e418c6045..4ba0120f0f41 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class ApiManagementPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementPrivateLinkServiceConnectionState DeserializeApiManagementPrivateLinkServiceConnectionState(JsonElement element) + internal static ApiManagementPrivateLinkServiceConnectionState DeserializeApiManagementPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ApiManagementPrivateLinkServiceConnectionState DeserializeApiMan Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static ApiManagementPrivateLinkServiceConnectionState DeserializeApiMan actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + ApiManagementPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new ApiManagementPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.cs index c5f0068efe75..d73ce0f0d720 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class ApiManagementPrivateLinkServiceConnectionState { - /// Initializes a new instance of ApiManagementPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of ApiManagementPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal ApiManagementPrivateLinkServiceConnectionState(ApiManagementPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal ApiManagementPrivateLinkServiceConnectionState(ApiManagementPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.Serialization.cs index 99823e39514c..5fcaccc09431 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.Serialization.cs @@ -5,16 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementProductApiListResult + internal partial class ApiManagementProductApiListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementProductApiListResult DeserializeApiManagementProductApiListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementProductApiListResult DeserializeApiManagementProductApiListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +54,7 @@ internal static ApiManagementProductApiListResult DeserializeApiManagementProduc Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +85,61 @@ internal static ApiManagementProductApiListResult DeserializeApiManagementProduc nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementProductApiListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiManagementProductApiListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiManagementProductApiListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementProductApiListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementProductApiListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementProductApiListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementProductApiListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementProductApiListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementProductApiListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.cs index dcfde80b8995..de7d18c42805 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductApiListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged API list representation. internal partial class ApiManagementProductApiListResult { - /// Initializes a new instance of ApiManagementProductApiListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementProductApiListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementProductApiListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiManagementProductApiListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiManagementProductApiListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductData.Serialization.cs index a3fcfb3a5160..b0cee05ca922 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementProductData : IUtf8JsonSerializable + public partial class ApiManagementProductData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -55,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementProductData DeserializeApiManagementProductData(JsonElement element) + internal static ApiManagementProductData DeserializeApiManagementProductData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +97,7 @@ internal static ApiManagementProductData DeserializeApiManagementProductData(Jso Optional subscriptionsLimit = default; Optional state = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -164,8 +187,61 @@ internal static ApiManagementProductData DeserializeApiManagementProductData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementProductData(id, name, type, systemData.Value, description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state), displayName.Value, serializedAdditionalRawData); + } + + ApiManagementProductData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementProductData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementProductData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementProductData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementProductData model) + { + if (model is null) + { + return null; } - return new ApiManagementProductData(id, name, type, systemData.Value, description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state), displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementProductData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementProductData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.Serialization.cs index 0123ffa256f5..82757b8934ac 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.Serialization.cs @@ -5,16 +5,53 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementProductGroupListResult + internal partial class ApiManagementProductGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementProductGroupListResult DeserializeApiManagementProductGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementProductGroupListResult DeserializeApiManagementProductGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +59,7 @@ internal static ApiManagementProductGroupListResult DeserializeApiManagementProd Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +90,61 @@ internal static ApiManagementProductGroupListResult DeserializeApiManagementProd nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementProductGroupListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiManagementProductGroupListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiManagementProductGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementProductGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementProductGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementProductGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementProductGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementProductGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementProductGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.cs index 17fb857a1c47..b0ccfbaeda00 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductGroupListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Group list representation. internal partial class ApiManagementProductGroupListResult { - /// Initializes a new instance of ApiManagementProductGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementProductGroupListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementProductGroupListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiManagementProductGroupListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiManagementProductGroupListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs index 8e2983618917..69d0e71cc732 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementProductPatch : IUtf8JsonSerializable + public partial class ApiManagementProductPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -53,7 +61,157 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementProductPatch DeserializeApiManagementProductPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional terms = default; + Optional subscriptionRequired = default; + Optional approvalRequired = default; + Optional subscriptionsLimit = default; + Optional state = default; + Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("terms"u8)) + { + terms = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("subscriptionRequired"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionRequired = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("approvalRequired"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + approvalRequired = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("subscriptionsLimit"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionsLimit = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = property0.Value.GetString().ToApiManagementProductState(); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementProductPatch(description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state), displayName.Value, serializedAdditionalRawData); + } + + ApiManagementProductPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementProductPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementProductPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementProductPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementProductPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementProductPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementProductPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs index 637530796660..594fd76b9b65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs @@ -5,16 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Product Update parameters. public partial class ApiManagementProductPatch { - /// Initializes a new instance of ApiManagementProductPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementProductPatch() { } + /// Initializes a new instance of . + /// Product description. May include HTML formatting tags. + /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + /// Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + /// whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + /// Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + /// whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. + /// Product name. + /// Keeps track of any properties unknown to the library. + internal ApiManagementProductPatch(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string displayName, Dictionary serializedAdditionalRawData) + { + Description = description; + Terms = terms; + IsSubscriptionRequired = isSubscriptionRequired; + IsApprovalRequired = isApprovalRequired; + SubscriptionsLimit = subscriptionsLimit; + State = state; + DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Product description. May include HTML formatting tags. public string Description { get; set; } /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.Serialization.cs index c91dd4584cf7..12006fca2dee 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementResourceSkuCapacity + public partial class ApiManagementResourceSkuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementResourceSkuCapacity DeserializeApiManagementResourceSkuCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementResourceSkuCapacity DeserializeApiManagementResourceSkuCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static ApiManagementResourceSkuCapacity DeserializeApiManagementResourc Optional maximum = default; Optional @default = default; Optional scaleType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -60,8 +89,61 @@ internal static ApiManagementResourceSkuCapacity DeserializeApiManagementResourc scaleType = new ApiManagementResourceSkuCapacityScaleType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementResourceSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType)); + return new ApiManagementResourceSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType), serializedAdditionalRawData); + } + + ApiManagementResourceSkuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementResourceSkuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementResourceSkuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementResourceSkuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementResourceSkuCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementResourceSkuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementResourceSkuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.cs index 3c87f6722fd6..3ec7b344582e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementResourceSkuCapacity.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Describes scaling information of a SKU. public partial class ApiManagementResourceSkuCapacity { - /// Initializes a new instance of ApiManagementResourceSkuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementResourceSkuCapacity() { } - /// Initializes a new instance of ApiManagementResourceSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. /// The scale type applicable to the sku. - internal ApiManagementResourceSkuCapacity(int? minimum, int? maximum, int? @default, ApiManagementResourceSkuCapacityScaleType? scaleType) + /// Keeps track of any properties unknown to the library. + internal ApiManagementResourceSkuCapacity(int? minimum, int? maximum, int? @default, ApiManagementResourceSkuCapacityScaleType? scaleType, Dictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; Default = @default; ScaleType = scaleType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum capacity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.Serialization.cs index 44a0d032ad9b..972c26b774d1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceApplyNetworkConfigurationContent : IUtf8JsonSerializable + public partial class ApiManagementServiceApplyNetworkConfigurationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementServiceApplyNetworkConfigurationContent DeserializeApiManagementServiceApplyNetworkConfigurationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementServiceApplyNetworkConfigurationContent(Optional.ToNullable(location), serializedAdditionalRawData); + } + + ApiManagementServiceApplyNetworkConfigurationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceApplyNetworkConfigurationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceApplyNetworkConfigurationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceApplyNetworkConfigurationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceApplyNetworkConfigurationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceApplyNetworkConfigurationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceApplyNetworkConfigurationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.cs index f412d60fc137..891e087a0e4b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceApplyNetworkConfigurationContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -12,11 +14,23 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Parameter supplied to the Apply Network configuration operation. public partial class ApiManagementServiceApplyNetworkConfigurationContent { - /// Initializes a new instance of ApiManagementServiceApplyNetworkConfigurationContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementServiceApplyNetworkConfigurationContent() { } + /// Initializes a new instance of . + /// Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceApplyNetworkConfigurationContent(AzureLocation? location, Dictionary serializedAdditionalRawData) + { + Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. public AzureLocation? Location { get; set; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.Serialization.cs index 126e863f8fc5..6d47fdc5c53a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceBackupRestoreContent : IUtf8JsonSerializable + public partial class ApiManagementServiceBackupRestoreContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageAccount"u8); writer.WriteStringValue(StorageAccount); @@ -36,7 +44,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientId"u8); writer.WriteStringValue(ClientId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementServiceBackupRestoreContent DeserializeApiManagementServiceBackupRestoreContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string storageAccount = default; + string containerName = default; + string backupName = default; + Optional accessType = default; + Optional accessKey = default; + Optional clientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageAccount"u8)) + { + storageAccount = property.Value.GetString(); + continue; + } + if (property.NameEquals("containerName"u8)) + { + containerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("backupName"u8)) + { + backupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + accessType = new StorageAccountAccessType(property.Value.GetString()); + continue; + } + if (property.NameEquals("accessKey"u8)) + { + accessKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementServiceBackupRestoreContent(storageAccount, containerName, backupName, Optional.ToNullable(accessType), accessKey.Value, clientId.Value, serializedAdditionalRawData); + } + + ApiManagementServiceBackupRestoreContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceBackupRestoreContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceBackupRestoreContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceBackupRestoreContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceBackupRestoreContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceBackupRestoreContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceBackupRestoreContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.cs index 36ea254547a9..9ed514ac1d41 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceBackupRestoreContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Parameters supplied to the Backup/Restore of an API Management service operation. public partial class ApiManagementServiceBackupRestoreContent { - /// Initializes a new instance of ApiManagementServiceBackupRestoreContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the Azure storage account (used to place/retrieve the backup). /// The name of the blob container (used to place/retrieve the backup). /// The name of the backup file to create/retrieve. @@ -29,6 +33,30 @@ public ApiManagementServiceBackupRestoreContent(string storageAccount, string co BackupName = backupName; } + /// Initializes a new instance of . + /// The name of the Azure storage account (used to place/retrieve the backup). + /// The name of the blob container (used to place/retrieve the backup). + /// The name of the backup file to create/retrieve. + /// The type of access to be used for the storage account. + /// Storage account access key. Required only if `accessType` is set to `AccessKey`. + /// The Client ID of user assigned managed identity. Required only if `accessType` is set to `UserAssignedManagedIdentity`. + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceBackupRestoreContent(string storageAccount, string containerName, string backupName, StorageAccountAccessType? accessType, string accessKey, string clientId, Dictionary serializedAdditionalRawData) + { + StorageAccount = storageAccount; + ContainerName = containerName; + BackupName = backupName; + AccessType = accessType; + AccessKey = accessKey; + ClientId = clientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApiManagementServiceBackupRestoreContent() + { + } + /// The name of the Azure storage account (used to place/retrieve the backup). public string StorageAccount { get; } /// The name of the blob container (used to place/retrieve the backup). diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs index 1f3032901570..b3803128b1e6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs @@ -11,18 +11,30 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementServiceData : IUtf8JsonSerializable + public partial class ApiManagementServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -64,7 +76,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HostnameConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -81,7 +100,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualNetworkConfiguration)) { writer.WritePropertyName("virtualNetworkConfiguration"u8); - writer.WriteObjectValue(VirtualNetworkConfiguration); + if (VirtualNetworkConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VirtualNetworkConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AdditionalLocations)) { @@ -89,7 +115,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AdditionalLocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -110,7 +143,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Certificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -132,7 +172,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiVersionConstraint)) { writer.WritePropertyName("apiVersionConstraint"u8); - writer.WriteObjectValue(ApiVersionConstraint); + if (ApiVersionConstraint is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiVersionConstraint).Serialize(writer, options); + } } if (Optional.IsDefined(Restore)) { @@ -145,7 +192,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PrivateEndpointConnections) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -154,11 +208,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publisherName"u8); writer.WriteStringValue(PublisherName); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementServiceData DeserializeApiManagementServiceData(JsonElement element) + internal static ApiManagementServiceData DeserializeApiManagementServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -201,6 +269,7 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso Optional platformVersion = default; string publisherEmail = default; string publisherName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -576,8 +645,61 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail, publisherName, serializedAdditionalRawData); + } + + ApiManagementServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceData model) + { + if (model is null) + { + return null; } - return new ApiManagementServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail, publisherName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.Serialization.cs index ca1de00581b7..7c2dc62d1d2a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceGetDomainOwnershipIdentifierResult + public partial class ApiManagementServiceGetDomainOwnershipIdentifierResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementServiceGetDomainOwnershipIdentifierResult DeserializeApiManagementServiceGetDomainOwnershipIdentifierResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementServiceGetDomainOwnershipIdentifierResult DeserializeApiManagementServiceGetDomainOwnershipIdentifierResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional domainOwnershipIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainOwnershipIdentifier"u8)) @@ -26,8 +55,61 @@ internal static ApiManagementServiceGetDomainOwnershipIdentifierResult Deseriali domainOwnershipIdentifier = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementServiceGetDomainOwnershipIdentifierResult(domainOwnershipIdentifier.Value); + return new ApiManagementServiceGetDomainOwnershipIdentifierResult(domainOwnershipIdentifier.Value, serializedAdditionalRawData); + } + + ApiManagementServiceGetDomainOwnershipIdentifierResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceGetDomainOwnershipIdentifierResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceGetDomainOwnershipIdentifierResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceGetDomainOwnershipIdentifierResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceGetDomainOwnershipIdentifierResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceGetDomainOwnershipIdentifierResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceGetDomainOwnershipIdentifierResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.cs index cd02ce5b3cae..7f98407ce66b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetDomainOwnershipIdentifierResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Response of the GetDomainOwnershipIdentifier operation. public partial class ApiManagementServiceGetDomainOwnershipIdentifierResult { - /// Initializes a new instance of ApiManagementServiceGetDomainOwnershipIdentifierResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementServiceGetDomainOwnershipIdentifierResult() { } - /// Initializes a new instance of ApiManagementServiceGetDomainOwnershipIdentifierResult. + /// Initializes a new instance of . /// The domain ownership identifier value. - internal ApiManagementServiceGetDomainOwnershipIdentifierResult(string domainOwnershipIdentifier) + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceGetDomainOwnershipIdentifierResult(string domainOwnershipIdentifier, Dictionary serializedAdditionalRawData) { DomainOwnershipIdentifier = domainOwnershipIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The domain ownership identifier value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.Serialization.cs index f43eeb42de99..c3c65ea99735 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.Serialization.cs @@ -6,20 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceGetSsoTokenResult + public partial class ApiManagementServiceGetSsoTokenResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementServiceGetSsoTokenResult DeserializeApiManagementServiceGetSsoTokenResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RedirectUri)) + { + writer.WritePropertyName("redirectUri"u8); + writer.WriteStringValue(RedirectUri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementServiceGetSsoTokenResult DeserializeApiManagementServiceGetSsoTokenResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional redirectUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("redirectUri"u8)) @@ -31,8 +64,61 @@ internal static ApiManagementServiceGetSsoTokenResult DeserializeApiManagementSe redirectUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementServiceGetSsoTokenResult(redirectUri.Value); + return new ApiManagementServiceGetSsoTokenResult(redirectUri.Value, serializedAdditionalRawData); + } + + ApiManagementServiceGetSsoTokenResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceGetSsoTokenResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceGetSsoTokenResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceGetSsoTokenResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceGetSsoTokenResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceGetSsoTokenResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceGetSsoTokenResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.cs index 3b626d984198..06faff23969b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceGetSsoTokenResult.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// The response of the GetSsoToken operation. public partial class ApiManagementServiceGetSsoTokenResult { - /// Initializes a new instance of ApiManagementServiceGetSsoTokenResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementServiceGetSsoTokenResult() { } - /// Initializes a new instance of ApiManagementServiceGetSsoTokenResult. + /// Initializes a new instance of . /// Redirect URL to the Publisher Portal containing the SSO token. - internal ApiManagementServiceGetSsoTokenResult(Uri redirectUri) + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceGetSsoTokenResult(Uri redirectUri, Dictionary serializedAdditionalRawData) { RedirectUri = redirectUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Redirect URL to the Publisher Portal containing the SSO token. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.Serialization.cs index 5b34c5ad1be6..e1d5363c413c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementServiceListResult + internal partial class ApiManagementServiceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementServiceListResult DeserializeApiManagementServiceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementServiceListResult DeserializeApiManagementServiceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static ApiManagementServiceListResult DeserializeApiManagementServiceLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementServiceListResult(value, nextLink.Value); + return new ApiManagementServiceListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ApiManagementServiceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.cs index f9ec45feebf6..780fcd53527b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The response of the List API Management services operation. internal partial class ApiManagementServiceListResult { - /// Initializes a new instance of ApiManagementServiceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Result of the List API Management services operation. /// is null. internal ApiManagementServiceListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal ApiManagementServiceListResult(IEnumerable va Value = value.ToList(); } - /// Initializes a new instance of ApiManagementServiceListResult. + /// Initializes a new instance of . /// Result of the List API Management services operation. /// Link to the next set of results. Not empty if Value contains incomplete list of API Management services. - internal ApiManagementServiceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApiManagementServiceListResult() + { } /// Result of the List API Management services operation. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.Serialization.cs index 7f4cae7eb784..7ddf5fdde4da 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceNameAvailabilityContent : IUtf8JsonSerializable + public partial class ApiManagementServiceNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementServiceNameAvailabilityContent DeserializeApiManagementServiceNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementServiceNameAvailabilityContent(name, serializedAdditionalRawData); + } + + ApiManagementServiceNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.cs index 74696ab77b59..fd7fa4c3cc22 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Parameters supplied to the CheckNameAvailability operation. public partial class ApiManagementServiceNameAvailabilityContent { - /// Initializes a new instance of ApiManagementServiceNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name to check for availability. /// is null. public ApiManagementServiceNameAvailabilityContent(string name) @@ -23,6 +27,20 @@ public ApiManagementServiceNameAvailabilityContent(string name) Name = name; } + /// Initializes a new instance of . + /// The name to check for availability. + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceNameAvailabilityContent(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApiManagementServiceNameAvailabilityContent() + { + } + /// The name to check for availability. public string Name { get; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.Serialization.cs index 3fb6ea334578..ae304815b22e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.Serialization.cs @@ -5,15 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceNameAvailabilityResult + public partial class ApiManagementServiceNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementServiceNameAvailabilityResult DeserializeApiManagementServiceNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToSerialString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementServiceNameAvailabilityResult DeserializeApiManagementServiceNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +54,7 @@ internal static ApiManagementServiceNameAvailabilityResult DeserializeApiManagem Optional nameAvailable = default; Optional message = default; Optional reason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +80,61 @@ internal static ApiManagementServiceNameAvailabilityResult DeserializeApiManagem reason = property.Value.GetString().ToApiManagementServiceNameUnavailableReason(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementServiceNameAvailabilityResult(Optional.ToNullable(nameAvailable), message.Value, Optional.ToNullable(reason)); + return new ApiManagementServiceNameAvailabilityResult(Optional.ToNullable(nameAvailable), message.Value, Optional.ToNullable(reason), serializedAdditionalRawData); + } + + ApiManagementServiceNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.cs index 39c7f820ef00..38921b1ea139 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Response of the CheckNameAvailability operation. public partial class ApiManagementServiceNameAvailabilityResult { - /// Initializes a new instance of ApiManagementServiceNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementServiceNameAvailabilityResult() { } - /// Initializes a new instance of ApiManagementServiceNameAvailabilityResult. + /// Initializes a new instance of . /// True if the name is available and can be used to create a new API Management service; otherwise false. /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that <resourceName> is already in use, and direct them to select a different name. /// Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. - internal ApiManagementServiceNameAvailabilityResult(bool? isNameAvailable, string message, ApiManagementServiceNameUnavailableReason? reason) + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceNameAvailabilityResult(bool? isNameAvailable, string message, ApiManagementServiceNameUnavailableReason? reason, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Message = message; Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// True if the name is available and can be used to create a new API Management service; otherwise false. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs index 077243d42922..61831f6b3258 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs @@ -11,19 +11,31 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServicePatch : IUtf8JsonSerializable + public partial class ApiManagementServicePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -64,7 +76,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HostnameConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -81,7 +100,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualNetworkConfiguration)) { writer.WritePropertyName("virtualNetworkConfiguration"u8); - writer.WriteObjectValue(VirtualNetworkConfiguration); + if (VirtualNetworkConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VirtualNetworkConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AdditionalLocations)) { @@ -89,7 +115,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AdditionalLocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -110,7 +143,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Certificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -132,7 +172,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiVersionConstraint)) { writer.WritePropertyName("apiVersionConstraint"u8); - writer.WriteObjectValue(ApiVersionConstraint); + if (ApiVersionConstraint is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiVersionConstraint).Serialize(writer, options); + } } if (Optional.IsDefined(Restore)) { @@ -145,7 +192,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PrivateEndpointConnections) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -160,11 +214,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublisherName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(JsonElement element) + internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,6 +274,7 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J Optional platformVersion = default; Optional publisherEmail = default; Optional publisherName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -580,8 +649,61 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementServicePatch(id, name, type, systemData.Value, sku.Value, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail.Value, publisherName.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ApiManagementServicePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServicePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServicePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServicePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServicePatch model) + { + if (model is null) + { + return null; } - return new ApiManagementServicePatch(id, name, type, systemData.Value, sku.Value, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail.Value, publisherName.Value, Optional.ToDictionary(tags)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServicePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServicePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs index 5f3413af8cdb..53a26276edee 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs @@ -17,7 +17,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Parameter supplied to Update Api Management Service. public partial class ApiManagementServicePatch : ResourceData { - /// Initializes a new instance of ApiManagementServicePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementServicePatch() { Zones = new ChangeTrackingList(); @@ -31,7 +34,7 @@ public ApiManagementServicePatch() Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ApiManagementServicePatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -69,7 +72,8 @@ public ApiManagementServicePatch() /// Publisher email. /// Publisher name. /// Resource tags. - internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName, IDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; Identity = identity; @@ -104,6 +108,7 @@ internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceT PublisherEmail = publisherEmail; PublisherName = publisherName; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// SKU properties of the API Management service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.Serialization.cs index efd771858a7f..502f74886465 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementServiceSkuProperties : IUtf8JsonSerializable + public partial class ApiManagementServiceSkuProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementServiceSkuProperties DeserializeApiManagementServiceSkuProperties(JsonElement element) + internal static ApiManagementServiceSkuProperties DeserializeApiManagementServiceSkuProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ApiManagementServiceSkuType name = default; int capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +65,61 @@ internal static ApiManagementServiceSkuProperties DeserializeApiManagementServic capacity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementServiceSkuProperties(name, capacity, serializedAdditionalRawData); + } + + ApiManagementServiceSkuProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementServiceSkuProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementServiceSkuProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementServiceSkuProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementServiceSkuProperties model) + { + if (model is null) + { + return null; } - return new ApiManagementServiceSkuProperties(name, capacity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementServiceSkuProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementServiceSkuProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs index db5e3f3a587f..f8f883d9262e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// API Management service resource SKU properties. public partial class ApiManagementServiceSkuProperties { - /// Initializes a new instance of ApiManagementServiceSkuProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Sku. /// Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. public ApiManagementServiceSkuProperties(ApiManagementServiceSkuType name, int capacity) @@ -19,6 +25,22 @@ public ApiManagementServiceSkuProperties(ApiManagementServiceSkuType name, int c Capacity = capacity; } + /// Initializes a new instance of . + /// Name of the Sku. + /// Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. + /// Keeps track of any properties unknown to the library. + internal ApiManagementServiceSkuProperties(ApiManagementServiceSkuType name, int capacity, Dictionary serializedAdditionalRawData) + { + Name = name; + Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApiManagementServiceSkuProperties() + { + } + /// Name of the Sku. public ApiManagementServiceSkuType Name { get; set; } /// Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.Serialization.cs index 746766eb8c8f..ac636db48916 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSku + public partial class ApiManagementSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSku DeserializeApiManagementSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSku DeserializeApiManagementSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +59,7 @@ internal static ApiManagementSku DeserializeApiManagementSku(JsonElement element Optional> costs = default; Optional> capabilities = default; Optional> restrictions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -157,8 +185,61 @@ internal static ApiManagementSku DeserializeApiManagementSku(JsonElement element restrictions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSku(resourceType.Value, name.Value, tier.Value, size.Value, family.Value, kind.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(apiVersions), Optional.ToList(costs), Optional.ToList(capabilities), Optional.ToList(restrictions)); + return new ApiManagementSku(resourceType.Value, name.Value, tier.Value, size.Value, family.Value, kind.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(apiVersions), Optional.ToList(costs), Optional.ToList(capabilities), Optional.ToList(restrictions), serializedAdditionalRawData); + } + + ApiManagementSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.cs index 1751418a7b2b..a130f008f11f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSku.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Describes an available ApiManagement SKU. public partial class ApiManagementSku { - /// Initializes a new instance of ApiManagementSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSku() { Locations = new ChangeTrackingList(); @@ -24,7 +28,7 @@ internal ApiManagementSku() Restrictions = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementSku. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// The name of SKU. /// Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. @@ -38,7 +42,8 @@ internal ApiManagementSku() /// Metadata for retrieving price info. /// A name value pair to describe the capability. /// The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - internal ApiManagementSku(string resourceType, string name, string tier, string size, string family, string kind, ApiManagementSkuCapacity capacity, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList apiVersions, IReadOnlyList costs, IReadOnlyList capabilities, IReadOnlyList restrictions) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSku(string resourceType, string name, string tier, string size, string family, string kind, ApiManagementSkuCapacity capacity, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList apiVersions, IReadOnlyList costs, IReadOnlyList capabilities, IReadOnlyList restrictions, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Name = name; @@ -53,6 +58,7 @@ internal ApiManagementSku(string resourceType, string name, string tier, string Costs = costs; Capabilities = capabilities; Restrictions = restrictions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of resource the SKU applies to. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.Serialization.cs index df82b1df7fe8..82d0c4e9e82e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuCapabilities + public partial class ApiManagementSkuCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuCapabilities DeserializeApiManagementSkuCapabilities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuCapabilities DeserializeApiManagementSkuCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ApiManagementSkuCapabilities DeserializeApiManagementSkuCapabili value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuCapabilities(name.Value, value.Value); + return new ApiManagementSkuCapabilities(name.Value, value.Value, serializedAdditionalRawData); + } + + ApiManagementSkuCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuCapabilities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs index e2a29d0df569..95de2974fa9b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Describes The SKU capabilities object. public partial class ApiManagementSkuCapabilities { - /// Initializes a new instance of ApiManagementSkuCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuCapabilities() { } - /// Initializes a new instance of ApiManagementSkuCapabilities. + /// Initializes a new instance of . /// An invariant to describe the feature. /// An invariant if the feature is measured by quantity. - internal ApiManagementSkuCapabilities(string name, string value) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuCapabilities(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An invariant to describe the feature. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.Serialization.cs index e4fd10bac209..bff6f120bfb7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuCapacity + public partial class ApiManagementSkuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuCapacity DeserializeApiManagementSkuCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuCapacity DeserializeApiManagementSkuCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static ApiManagementSkuCapacity DeserializeApiManagementSkuCapacity(Jso Optional maximum = default; Optional @default = default; Optional scaleType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -60,8 +89,61 @@ internal static ApiManagementSkuCapacity DeserializeApiManagementSkuCapacity(Jso scaleType = property.Value.GetString().ToApiManagementSkuCapacityScaleType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType)); + return new ApiManagementSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType), serializedAdditionalRawData); + } + + ApiManagementSkuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.cs index a2c1f5cd2014..970b3640f781 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Describes scaling information of a SKU. public partial class ApiManagementSkuCapacity { - /// Initializes a new instance of ApiManagementSkuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuCapacity() { } - /// Initializes a new instance of ApiManagementSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. /// The scale type applicable to the sku. - internal ApiManagementSkuCapacity(int? minimum, int? maximum, int? @default, ApiManagementSkuCapacityScaleType? scaleType) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuCapacity(int? minimum, int? maximum, int? @default, ApiManagementSkuCapacityScaleType? scaleType, Dictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; Default = @default; ScaleType = scaleType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum capacity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.Serialization.cs index cfdc9479acab..4cad51c5c8ad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuCosts + public partial class ApiManagementSkuCosts : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuCosts DeserializeApiManagementSkuCosts(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuCosts DeserializeApiManagementSkuCosts(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ApiManagementSkuCosts DeserializeApiManagementSkuCosts(JsonEleme Optional meterId = default; Optional quantity = default; Optional extendedUnit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterID"u8)) @@ -42,8 +71,61 @@ internal static ApiManagementSkuCosts DeserializeApiManagementSkuCosts(JsonEleme extendedUnit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuCosts(meterId.Value, Optional.ToNullable(quantity), extendedUnit.Value); + return new ApiManagementSkuCosts(meterId.Value, Optional.ToNullable(quantity), extendedUnit.Value, serializedAdditionalRawData); + } + + ApiManagementSkuCosts IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuCosts(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuCosts IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuCosts(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuCosts model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuCosts(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuCosts(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.cs index e2b3ee34cfb7..44daed8f08f2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Describes metadata for retrieving price info. public partial class ApiManagementSkuCosts { - /// Initializes a new instance of ApiManagementSkuCosts. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuCosts() { } - /// Initializes a new instance of ApiManagementSkuCosts. + /// Initializes a new instance of . /// Used for querying price from commerce. /// The multiplier is needed to extend the base metered cost. /// An invariant to show the extended unit. - internal ApiManagementSkuCosts(string meterId, long? quantity, string extendedUnit) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuCosts(string meterId, long? quantity, string extendedUnit, Dictionary serializedAdditionalRawData) { MeterId = meterId; Quantity = quantity; ExtendedUnit = extendedUnit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Used for querying price from commerce. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.Serialization.cs index d687a1c7de67..1ef253f60f9f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuLocationInfo + public partial class ApiManagementSkuLocationInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuLocationInfo DeserializeApiManagementSkuLocationInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuLocationInfo DeserializeApiManagementSkuLocationInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static ApiManagementSkuLocationInfo DeserializeApiManagementSkuLocation Optional location = default; Optional> zones = default; Optional> zoneDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -61,8 +89,61 @@ internal static ApiManagementSkuLocationInfo DeserializeApiManagementSkuLocation zoneDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(zoneDetails)); + return new ApiManagementSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(zoneDetails), serializedAdditionalRawData); + } + + ApiManagementSkuLocationInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuLocationInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuLocationInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuLocationInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuLocationInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuLocationInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuLocationInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.cs index 582e6da55f67..d381c566c739 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The ApiManagementSkuLocationInfo. public partial class ApiManagementSkuLocationInfo { - /// Initializes a new instance of ApiManagementSkuLocationInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuLocationInfo() { Zones = new ChangeTrackingList(); ZoneDetails = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementSkuLocationInfo. + /// Initializes a new instance of . /// Location of the SKU. /// List of availability zones where the SKU is supported. /// Details of capabilities available to a SKU in specific zones. - internal ApiManagementSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList zoneDetails) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList zoneDetails, Dictionary serializedAdditionalRawData) { Location = location; Zones = zones; ZoneDetails = zoneDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of the SKU. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.Serialization.cs index 05b338a24713..7bc5623d0d63 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuRestrictionInfo + public partial class ApiManagementSkuRestrictionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuRestrictionInfo DeserializeApiManagementSkuRestrictionInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuRestrictionInfo DeserializeApiManagementSkuRestrictionInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> locations = default; Optional> zones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("locations"u8)) @@ -51,8 +79,61 @@ internal static ApiManagementSkuRestrictionInfo DeserializeApiManagementSkuRestr zones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones)); + return new ApiManagementSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones), serializedAdditionalRawData); + } + + ApiManagementSkuRestrictionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuRestrictionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuRestrictionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuRestrictionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuRestrictionInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuRestrictionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuRestrictionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs index 94e82c9ea427..81438d3b0446 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The ApiManagementSkuRestrictionInfo. public partial class ApiManagementSkuRestrictionInfo { - /// Initializes a new instance of ApiManagementSkuRestrictionInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuRestrictionInfo() { Locations = new ChangeTrackingList(); Zones = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementSkuRestrictionInfo. + /// Initializes a new instance of . /// Locations where the SKU is restricted. /// List of availability zones where the SKU is restricted. - internal ApiManagementSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones, Dictionary serializedAdditionalRawData) { Locations = locations; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Locations where the SKU is restricted. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.Serialization.cs index a057aa67c1ce..97d811023c06 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuRestrictions + public partial class ApiManagementSkuRestrictions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuRestrictions DeserializeApiManagementSkuRestrictions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuRestrictions DeserializeApiManagementSkuRestrictions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static ApiManagementSkuRestrictions DeserializeApiManagementSkuRestrict Optional> values = default; Optional restrictionInfo = default; Optional reasonCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -66,8 +94,61 @@ internal static ApiManagementSkuRestrictions DeserializeApiManagementSkuRestrict reasonCode = property.Value.GetString().ToApiManagementSkuRestrictionsReasonCode(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode)); + return new ApiManagementSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode), serializedAdditionalRawData); + } + + ApiManagementSkuRestrictions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuRestrictions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuRestrictions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuRestrictions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuRestrictions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuRestrictions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuRestrictions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs index ddc67b9483dd..6a6f0ed95be8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Describes scaling information of a SKU. public partial class ApiManagementSkuRestrictions { - /// Initializes a new instance of ApiManagementSkuRestrictions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuRestrictions() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementSkuRestrictions. + /// Initializes a new instance of . /// The type of restrictions. /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. /// The information about the restriction where the SKU cannot be used. /// The reason for restriction. - internal ApiManagementSkuRestrictions(ApiManagementSkuRestrictionsType? restrictionsType, IReadOnlyList values, ApiManagementSkuRestrictionInfo restrictionInfo, ApiManagementSkuRestrictionsReasonCode? reasonCode) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuRestrictions(ApiManagementSkuRestrictionsType? restrictionsType, IReadOnlyList values, ApiManagementSkuRestrictionInfo restrictionInfo, ApiManagementSkuRestrictionsReasonCode? reasonCode, Dictionary serializedAdditionalRawData) { RestrictionsType = restrictionsType; Values = values; RestrictionInfo = restrictionInfo; ReasonCode = reasonCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of restrictions. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.Serialization.cs index 88b33ece4973..581ea78be9ac 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSkuZoneDetails + public partial class ApiManagementSkuZoneDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkuZoneDetails DeserializeApiManagementSkuZoneDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkuZoneDetails DeserializeApiManagementSkuZoneDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> name = default; Optional> capabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -51,8 +79,61 @@ internal static ApiManagementSkuZoneDetails DeserializeApiManagementSkuZoneDetai capabilities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkuZoneDetails(Optional.ToList(name), Optional.ToList(capabilities)); + return new ApiManagementSkuZoneDetails(Optional.ToList(name), Optional.ToList(capabilities), serializedAdditionalRawData); + } + + ApiManagementSkuZoneDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkuZoneDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkuZoneDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkuZoneDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkuZoneDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkuZoneDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkuZoneDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs index 4bfbe38c890e..1f1cb36a9b9a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Describes The zonal capabilities of a SKU. public partial class ApiManagementSkuZoneDetails { - /// Initializes a new instance of ApiManagementSkuZoneDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiManagementSkuZoneDetails() { Name = new ChangeTrackingList(); Capabilities = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementSkuZoneDetails. + /// Initializes a new instance of . /// The set of zones that the SKU is available in with the specified capabilities. /// A list of capabilities that are available for the SKU in the specified list of zones. - internal ApiManagementSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities, Dictionary serializedAdditionalRawData) { Name = name; Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The set of zones that the SKU is available in with the specified capabilities. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.Serialization.cs index e6de264649b3..af17cce1ee3a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiManagementSkusResult + internal partial class ApiManagementSkusResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiManagementSkusResult DeserializeApiManagementSkusResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiManagementSkusResult DeserializeApiManagementSkusResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ApiManagementSkusResult DeserializeApiManagementSkusResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiManagementSkusResult(value, nextLink.Value); + return new ApiManagementSkusResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ApiManagementSkusResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSkusResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSkusResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSkusResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSkusResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSkusResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSkusResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.cs index 21a8aad88399..210029d021b4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSkusResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The List Resource Skus operation response. internal partial class ApiManagementSkusResult { - /// Initializes a new instance of ApiManagementSkusResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of skus available for the subscription. /// is null. internal ApiManagementSkusResult(IEnumerable value) @@ -25,13 +28,20 @@ internal ApiManagementSkusResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ApiManagementSkusResult. + /// Initializes a new instance of . /// The list of skus available for the subscription. /// The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus. - internal ApiManagementSkusResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiManagementSkusResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApiManagementSkusResult() + { } /// The list of skus available for the subscription. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs index ef510d594bc3..bee07c884035 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSubscriptionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementSubscriptionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -53,7 +61,149 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(AllowTracing.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementSubscriptionCreateOrUpdateContent DeserializeApiManagementSubscriptionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional ownerId = default; + Optional scope = default; + Optional displayName = default; + Optional primaryKey = default; + Optional secondaryKey = default; + Optional state = default; + Optional allowTracing = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("ownerId"u8)) + { + ownerId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("primaryKey"u8)) + { + primaryKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("secondaryKey"u8)) + { + secondaryKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = property0.Value.GetString().ToSubscriptionState(); + continue; + } + if (property0.NameEquals("allowTracing"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowTracing = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementSubscriptionCreateOrUpdateContent(ownerId.Value, scope.Value, displayName.Value, primaryKey.Value, secondaryKey.Value, Optional.ToNullable(state), Optional.ToNullable(allowTracing), serializedAdditionalRawData); + } + + ApiManagementSubscriptionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSubscriptionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSubscriptionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSubscriptionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSubscriptionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSubscriptionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSubscriptionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs index 0cb7cae73974..3a2331825f7c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs @@ -5,16 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription create details. public partial class ApiManagementSubscriptionCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementSubscriptionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementSubscriptionCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// User (user id path) for whom subscription is being created in form /users/{userId}. + /// Scope like /products/{productId} or /apis or /apis/{apiId}. + /// Subscription name. + /// Primary subscription key. If not specified during request key will be generated automatically. + /// Secondary subscription key. If not specified during request key will be generated automatically. + /// Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. + /// Determines whether tracing can be enabled. + /// Keeps track of any properties unknown to the library. + internal ApiManagementSubscriptionCreateOrUpdateContent(string ownerId, string scope, string displayName, string primaryKey, string secondaryKey, SubscriptionState? state, bool? allowTracing, Dictionary serializedAdditionalRawData) + { + OwnerId = ownerId; + Scope = scope; + DisplayName = displayName; + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + State = state; + AllowTracing = allowTracing; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// User (user id path) for whom subscription is being created in form /users/{userId}. public string OwnerId { get; set; } /// Scope like /products/{productId} or /apis or /apis/{apiId}. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs index 6836cff6f88c..77e38b8b3873 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSubscriptionPatch : IUtf8JsonSerializable + public partial class ApiManagementSubscriptionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -63,7 +71,165 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(AllowTracing.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementSubscriptionPatch DeserializeApiManagementSubscriptionPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional ownerId = default; + Optional scope = default; + Optional expirationDate = default; + Optional displayName = default; + Optional primaryKey = default; + Optional secondaryKey = default; + Optional state = default; + Optional stateComment = default; + Optional allowTracing = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("ownerId"u8)) + { + ownerId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("expirationDate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDate = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("primaryKey"u8)) + { + primaryKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("secondaryKey"u8)) + { + secondaryKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = property0.Value.GetString().ToSubscriptionState(); + continue; + } + if (property0.NameEquals("stateComment"u8)) + { + stateComment = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("allowTracing"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowTracing = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementSubscriptionPatch(ownerId.Value, scope.Value, Optional.ToNullable(expirationDate), displayName.Value, primaryKey.Value, secondaryKey.Value, Optional.ToNullable(state), stateComment.Value, Optional.ToNullable(allowTracing), serializedAdditionalRawData); + } + + ApiManagementSubscriptionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementSubscriptionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementSubscriptionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementSubscriptionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementSubscriptionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementSubscriptionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementSubscriptionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs index 989bf75487f2..02ac26d8fe47 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs @@ -6,17 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription update details. public partial class ApiManagementSubscriptionPatch { - /// Initializes a new instance of ApiManagementSubscriptionPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementSubscriptionPatch() { } + /// Initializes a new instance of . + /// User identifier path: /users/{userId}. + /// Scope like /products/{productId} or /apis or /apis/{apiId}. + /// Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + /// Subscription name. + /// Primary subscription key. + /// Secondary subscription key. + /// Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. + /// Comments describing subscription state change by the administrator when the state is changed to the 'rejected'. + /// Determines whether tracing can be enabled. + /// Keeps track of any properties unknown to the library. + internal ApiManagementSubscriptionPatch(string ownerId, string scope, DateTimeOffset? expireOn, string displayName, string primaryKey, string secondaryKey, SubscriptionState? state, string stateComment, bool? allowTracing, Dictionary serializedAdditionalRawData) + { + OwnerId = ownerId; + Scope = scope; + ExpireOn = expireOn; + DisplayName = displayName; + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + State = state; + StateComment = stateComment; + AllowTracing = allowTracing; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// User identifier path: /users/{userId}. public string OwnerId { get; set; } /// Scope like /products/{productId} or /apis or /apis/{apiId}. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.Serialization.cs index 71c0622c1209..2bdc9ca168cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementTagCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementTagCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -23,7 +31,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementTagCreateOrUpdateContent DeserializeApiManagementTagCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementTagCreateOrUpdateContent(displayName.Value, serializedAdditionalRawData); + } + + ApiManagementTagCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementTagCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementTagCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementTagCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementTagCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementTagCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementTagCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.cs index ddee4b41fc1d..1bb893a6fb02 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTagCreateOrUpdateContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to Create/Update Tag operations. public partial class ApiManagementTagCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementTagCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementTagCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Tag name. + /// Keeps track of any properties unknown to the library. + internal ApiManagementTagCreateOrUpdateContent(string displayName, Dictionary serializedAdditionalRawData) + { + DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Tag name. public string DisplayName { get; set; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTenantSettingData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTenantSettingData.Serialization.cs index 4a91c6c201df..4dbe4cfc2f77 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTenantSettingData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementTenantSettingData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiManagementTenantSettingData : IUtf8JsonSerializable + public partial class ApiManagementTenantSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiManagementTenantSettingData DeserializeApiManagementTenantSettingData(JsonElement element) + internal static ApiManagementTenantSettingData DeserializeApiManagementTenantSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +66,7 @@ internal static ApiManagementTenantSettingData DeserializeApiManagementTenantSet ResourceType type = default; Optional systemData = default; Optional> settings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +119,61 @@ internal static ApiManagementTenantSettingData DeserializeApiManagementTenantSet } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementTenantSettingData(id, name, type, systemData.Value, Optional.ToDictionary(settings), serializedAdditionalRawData); + } + + ApiManagementTenantSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementTenantSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementTenantSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementTenantSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementTenantSettingData model) + { + if (model is null) + { + return null; } - return new ApiManagementTenantSettingData(id, name, type, systemData.Value, Optional.ToDictionary(settings)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementTenantSettingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementTenantSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.Serialization.cs index a6f6c22ba13e..b041d823d59d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementUserCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiManagementUserCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Identities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -68,7 +83,174 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Confirmation.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementUserCreateOrUpdateContent DeserializeApiManagementUserCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional state = default; + Optional note = default; + Optional> identities = default; + Optional email = default; + Optional firstName = default; + Optional lastName = default; + Optional password = default; + Optional appType = default; + Optional confirmation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new ApiManagementUserState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("note"u8)) + { + note = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(UserIdentityContract.DeserializeUserIdentityContract(item)); + } + identities = array; + continue; + } + if (property0.NameEquals("email"u8)) + { + email = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("firstName"u8)) + { + firstName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastName"u8)) + { + lastName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("password"u8)) + { + password = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("appType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appType = new AppType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("confirmation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confirmation = new ConfirmationEmailType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementUserCreateOrUpdateContent(Optional.ToNullable(state), note.Value, Optional.ToList(identities), email.Value, firstName.Value, lastName.Value, password.Value, Optional.ToNullable(appType), Optional.ToNullable(confirmation), serializedAdditionalRawData); + } + + ApiManagementUserCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementUserCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementUserCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementUserCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementUserCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementUserCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementUserCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.cs index 0699b480d5df..ca665665ff09 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,40 @@ namespace Azure.ResourceManager.ApiManagement.Models /// User create details. public partial class ApiManagementUserCreateOrUpdateContent { - /// Initializes a new instance of ApiManagementUserCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementUserCreateOrUpdateContent() { Identities = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. + /// Optional note about a user set by the administrator. + /// Collection of user identities. + /// Email address. Must not be empty and must be unique within the service instance. + /// First name. + /// Last name. + /// User Password. If no value is provided, a default password is generated. + /// Determines the type of application which send the create user request. Default is legacy portal. + /// Determines the type of confirmation e-mail that will be sent to the newly created user. + /// Keeps track of any properties unknown to the library. + internal ApiManagementUserCreateOrUpdateContent(ApiManagementUserState? state, string note, IList identities, string email, string firstName, string lastName, string password, AppType? appType, ConfirmationEmailType? confirmation, Dictionary serializedAdditionalRawData) + { + State = state; + Note = note; + Identities = identities; + Email = email; + FirstName = firstName; + LastName = lastName; + Password = password; + AppType = appType; + Confirmation = confirmation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. public ApiManagementUserState? State { get; set; } /// Optional note about a user set by the administrator. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.Serialization.cs index 380770f02bcd..0d837132f3c2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementUserPatch : IUtf8JsonSerializable + public partial class ApiManagementUserPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Identities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -58,7 +73,154 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LastName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiManagementUserPatch DeserializeApiManagementUserPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional state = default; + Optional note = default; + Optional> identities = default; + Optional email = default; + Optional password = default; + Optional firstName = default; + Optional lastName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new ApiManagementUserState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("note"u8)) + { + note = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(UserIdentityContract.DeserializeUserIdentityContract(item)); + } + identities = array; + continue; + } + if (property0.NameEquals("email"u8)) + { + email = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("password"u8)) + { + password = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("firstName"u8)) + { + firstName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastName"u8)) + { + lastName = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiManagementUserPatch(Optional.ToNullable(state), note.Value, Optional.ToList(identities), email.Value, password.Value, firstName.Value, lastName.Value, serializedAdditionalRawData); + } + + ApiManagementUserPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiManagementUserPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiManagementUserPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiManagementUserPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiManagementUserPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiManagementUserPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiManagementUserPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.cs index 609d86ea0ffa..ce15bd19a27c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementUserPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,36 @@ namespace Azure.ResourceManager.ApiManagement.Models /// User update parameters. public partial class ApiManagementUserPatch { - /// Initializes a new instance of ApiManagementUserPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiManagementUserPatch() { Identities = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. + /// Optional note about a user set by the administrator. + /// Collection of user identities. + /// Email address. Must not be empty and must be unique within the service instance. + /// User Password. + /// First name. + /// Last name. + /// Keeps track of any properties unknown to the library. + internal ApiManagementUserPatch(ApiManagementUserState? state, string note, IList identities, string email, string password, string firstName, string lastName, Dictionary serializedAdditionalRawData) + { + State = state; + Note = note; + Identities = identities; + Email = email; + Password = password; + FirstName = firstName; + LastName = lastName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. public ApiManagementUserState? State { get; set; } /// Optional note about a user set by the administrator. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationData.Serialization.cs index 7ce67e7b552c..923e4535ff37 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiOperationData : IUtf8JsonSerializable + public partial class ApiOperationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -26,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TemplateParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -38,7 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Request)) { writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request); + if (Request is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Request).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Responses)) { @@ -46,7 +67,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Responses) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -71,11 +99,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UriTemplate); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiOperationData DeserializeApiOperationData(JsonElement element) + internal static ApiOperationData DeserializeApiOperationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -92,6 +134,7 @@ internal static ApiOperationData DeserializeApiOperationData(JsonElement element Optional displayName = default; Optional method = default; Optional uriTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -192,8 +235,61 @@ internal static ApiOperationData DeserializeApiOperationData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiOperationData(id, name, type, systemData.Value, Optional.ToList(templateParameters), description.Value, request.Value, Optional.ToList(responses), policies.Value, displayName.Value, method.Value, uriTemplate.Value, serializedAdditionalRawData); + } + + ApiOperationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiOperationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiOperationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiOperationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiOperationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiOperationData(Response response) + { + if (response is null) + { + return null; } - return new ApiOperationData(id, name, type, systemData.Value, Optional.ToList(templateParameters), description.Value, request.Value, Optional.ToList(responses), policies.Value, displayName.Value, method.Value, uriTemplate.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiOperationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs index 1520341d83a8..d5278fd9c2e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiOperationPatch : IUtf8JsonSerializable + public partial class ApiOperationPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TemplateParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -35,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Request)) { writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request); + if (Request is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Request).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Responses)) { @@ -43,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Responses) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -68,7 +97,169 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UriTemplate); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiOperationPatch DeserializeApiOperationPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> templateParameters = default; + Optional description = default; + Optional request = default; + Optional> responses = default; + Optional policies = default; + Optional displayName = default; + Optional method = default; + Optional uriTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("templateParameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ParameterContract.DeserializeParameterContract(item)); + } + templateParameters = array; + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("request"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + request = RequestContract.DeserializeRequestContract(property0.Value); + continue; + } + if (property0.NameEquals("responses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ResponseContract.DeserializeResponseContract(item)); + } + responses = array; + continue; + } + if (property0.NameEquals("policies"u8)) + { + policies = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("method"u8)) + { + method = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("urlTemplate"u8)) + { + uriTemplate = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiOperationPatch(Optional.ToList(templateParameters), description.Value, request.Value, Optional.ToList(responses), policies.Value, displayName.Value, method.Value, uriTemplate.Value, serializedAdditionalRawData); + } + + ApiOperationPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiOperationPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiOperationPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiOperationPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiOperationPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiOperationPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiOperationPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs index 1b38170f4b87..1b06bc4bccda 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,39 @@ namespace Azure.ResourceManager.ApiManagement.Models /// API Operation Update Contract details. public partial class ApiOperationPatch { - /// Initializes a new instance of ApiOperationPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiOperationPatch() { TemplateParameters = new ChangeTrackingList(); Responses = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Collection of URL template parameters. + /// Description of the operation. May include HTML formatting tags. + /// An entity containing request details. + /// Array of Operation responses. + /// Operation Policies. + /// Operation Name. + /// A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. + /// Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + /// Keeps track of any properties unknown to the library. + internal ApiOperationPatch(IList templateParameters, string description, RequestContract request, IList responses, string policies, string displayName, string method, string uriTemplate, Dictionary serializedAdditionalRawData) + { + TemplateParameters = templateParameters; + Description = description; + Request = request; + Responses = responses; + Policies = policies; + DisplayName = displayName; + Method = method; + UriTemplate = uriTemplate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Collection of URL template parameters. public IList TemplateParameters { get; } /// Description of the operation. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs index 9657935cef5c..40f0478b35fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiPatch : IUtf8JsonSerializable + public partial class ApiPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,12 +33,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationSettings)) { writer.WritePropertyName("authenticationSettings"u8); - writer.WriteObjectValue(AuthenticationSettings); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } } if (Optional.IsDefined(SubscriptionKeyParameterNames)) { writer.WritePropertyName("subscriptionKeyParameterNames"u8); - writer.WriteObjectValue(SubscriptionKeyParameterNames); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } } if (Optional.IsDefined(ApiType)) { @@ -80,12 +102,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Contact)) { writer.WritePropertyName("contact"u8); - writer.WriteObjectValue(Contact); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } } if (Optional.IsDefined(License)) { writer.WritePropertyName("license"u8); - writer.WriteObjectValue(License); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } } if (Optional.IsDefined(DisplayName)) { @@ -113,7 +149,266 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiPatch DeserializeApiPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional authenticationSettings = default; + Optional subscriptionKeyParameterNames = default; + Optional type = default; + Optional apiRevision = default; + Optional apiVersion = default; + Optional isCurrent = default; + Optional isOnline = default; + Optional apiRevisionDescription = default; + Optional apiVersionDescription = default; + Optional apiVersionSetId = default; + Optional subscriptionRequired = default; + Optional termsOfServiceUri = default; + Optional contact = default; + Optional license = default; + Optional displayName = default; + Optional serviceUri = default; + Optional path = default; + Optional> protocols = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authenticationSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authenticationSettings = AuthenticationSettingsContract.DeserializeAuthenticationSettingsContract(property0.Value); + continue; + } + if (property0.NameEquals("subscriptionKeyParameterNames"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionKeyParameterNames = SubscriptionKeyParameterNamesContract.DeserializeSubscriptionKeyParameterNamesContract(property0.Value); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ApiType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("apiRevision"u8)) + { + apiRevision = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("apiVersion"u8)) + { + apiVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isCurrent"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isCurrent = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isOnline"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOnline = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("apiRevisionDescription"u8)) + { + apiRevisionDescription = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("apiVersionDescription"u8)) + { + apiVersionDescription = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("apiVersionSetId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiVersionSetId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("subscriptionRequired"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionRequired = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("termsOfServiceUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termsOfServiceUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("contact"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contact = ApiContactInformation.DeserializeApiContactInformation(property0.Value); + continue; + } + if (property0.NameEquals("license"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + license = ApiLicenseInformation.DeserializeApiLicenseInformation(property0.Value); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("serviceUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("path"u8)) + { + path = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("protocols"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new ApiOperationInvokableProtocol(item.GetString())); + } + protocols = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiPatch(description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), serializedAdditionalRawData); + } + + ApiPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs index 5fdc1e6796e9..0a83ce99fd13 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs @@ -14,12 +14,60 @@ namespace Azure.ResourceManager.ApiManagement.Models /// API update contract details. public partial class ApiPatch { - /// Initializes a new instance of ApiPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiPatch() { Protocols = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Description of the API. May include HTML formatting tags. + /// Collection of authentication settings included into this API. + /// Protocols over which API is made available. + /// Type of API. + /// Describes the revision of the API. If no value is provided, default revision 1 is created. + /// Indicates the version identifier of the API if the API is versioned. + /// Indicates if API revision is current api revision. + /// Indicates if API revision is accessible via the gateway. + /// Description of the API Revision. + /// Description of the API Version. + /// A resource identifier for the related ApiVersionSet. + /// Specifies whether an API or Product subscription is required for accessing the API. + /// A URL to the Terms of Service for the API. MUST be in the format of a URL. + /// Contact information for the API. + /// License information for the API. + /// API name. + /// Absolute URL of the backend service implementing this API. + /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + /// Describes on which protocols the operations in this API can be invoked. + /// Keeps track of any properties unknown to the library. + internal ApiPatch(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, string displayName, Uri serviceUri, string path, IList protocols, Dictionary serializedAdditionalRawData) + { + Description = description; + AuthenticationSettings = authenticationSettings; + SubscriptionKeyParameterNames = subscriptionKeyParameterNames; + ApiType = apiType; + ApiRevision = apiRevision; + ApiVersion = apiVersion; + IsCurrent = isCurrent; + IsOnline = isOnline; + ApiRevisionDescription = apiRevisionDescription; + ApiVersionDescription = apiVersionDescription; + ApiVersionSetId = apiVersionSetId; + IsSubscriptionRequired = isSubscriptionRequired; + TermsOfServiceUri = termsOfServiceUri; + Contact = contact; + License = license; + DisplayName = displayName; + ServiceUri = serviceUri; + Path = path; + Protocols = protocols; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Description of the API. May include HTML formatting tags. public string Description { get; set; } /// Collection of authentication settings included into this API. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseData.Serialization.cs index c1cfc5df39d6..89d17df0ddbd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiReleaseData : IUtf8JsonSerializable + public partial class ApiReleaseData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Notes); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiReleaseData DeserializeApiReleaseData(JsonElement element) + internal static ApiReleaseData DeserializeApiReleaseData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +68,7 @@ internal static ApiReleaseData DeserializeApiReleaseData(JsonElement element) Optional createdDateTime = default; Optional updatedDateTime = default; Optional notes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -117,8 +139,61 @@ internal static ApiReleaseData DeserializeApiReleaseData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiReleaseData(id, name, type, systemData.Value, apiId.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime), notes.Value, serializedAdditionalRawData); + } + + ApiReleaseData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiReleaseData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiReleaseData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiReleaseData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiReleaseData model) + { + if (model is null) + { + return null; } - return new ApiReleaseData(id, name, type, systemData.Value, apiId.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime), notes.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiReleaseData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiReleaseData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.Serialization.cs index d3d93ceb3baa..173129baa955 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiReleaseListResult + internal partial class ApiReleaseListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiReleaseListResult DeserializeApiReleaseListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiReleaseListResult DeserializeApiReleaseListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static ApiReleaseListResult DeserializeApiReleaseListResult(JsonElement Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static ApiReleaseListResult DeserializeApiReleaseListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiReleaseListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiReleaseListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiReleaseListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiReleaseListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiReleaseListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiReleaseListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiReleaseListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiReleaseListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiReleaseListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.cs index 975d104d3162..9d75a125d062 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiReleaseListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged ApiRelease list representation. internal partial class ApiReleaseListResult { - /// Initializes a new instance of ApiReleaseListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiReleaseListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiReleaseListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiReleaseListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiReleaseListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.Serialization.cs index 0d021a1e1043..959fec4e4c5a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiRevisionContract + public partial class ApiRevisionContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiRevisionContract DeserializeApiRevisionContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiRevisionContract DeserializeApiRevisionContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +54,7 @@ internal static ApiRevisionContract DeserializeApiRevisionContract(JsonElement e Optional privateUri = default; Optional isOnline = default; Optional isCurrent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("apiId"u8)) @@ -85,8 +113,61 @@ internal static ApiRevisionContract DeserializeApiRevisionContract(JsonElement e isCurrent = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiRevisionContract(apiId.Value, apiRevision.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime), description.Value, privateUri.Value, Optional.ToNullable(isOnline), Optional.ToNullable(isCurrent)); + return new ApiRevisionContract(apiId.Value, apiRevision.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(updatedDateTime), description.Value, privateUri.Value, Optional.ToNullable(isOnline), Optional.ToNullable(isCurrent), serializedAdditionalRawData); + } + + ApiRevisionContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiRevisionContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiRevisionContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiRevisionContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiRevisionContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiRevisionContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiRevisionContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.cs index cc8e379019ac..e0c9a5d2b5b8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionContract.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Summary of revision metadata. public partial class ApiRevisionContract { - /// Initializes a new instance of ApiRevisionContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiRevisionContract() { } - /// Initializes a new instance of ApiRevisionContract. + /// Initializes a new instance of . /// Identifier of the API Revision. /// Revision number of API. /// The time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. @@ -26,7 +30,8 @@ internal ApiRevisionContract() /// Gateway URL for accessing the non-current API Revision. /// Indicates if API revision is the current api revision. /// Indicates if API revision is accessible via the gateway. - internal ApiRevisionContract(string apiId, string apiRevision, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string description, string privateUriString, bool? isOnline, bool? isCurrent) + /// Keeps track of any properties unknown to the library. + internal ApiRevisionContract(string apiId, string apiRevision, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string description, string privateUriString, bool? isOnline, bool? isCurrent, Dictionary serializedAdditionalRawData) { ApiId = apiId; ApiRevision = apiRevision; @@ -36,6 +41,7 @@ internal ApiRevisionContract(string apiId, string apiRevision, DateTimeOffset? c PrivateUriString = privateUriString; IsOnline = isOnline; IsCurrent = isCurrent; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifier of the API Revision. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.Serialization.cs index b3b95f4d75d0..fd7f5409a424 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.Serialization.cs @@ -5,16 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiRevisionListResult + internal partial class ApiRevisionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiRevisionListResult DeserializeApiRevisionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiRevisionListResult DeserializeApiRevisionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +54,7 @@ internal static ApiRevisionListResult DeserializeApiRevisionListResult(JsonEleme Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +85,61 @@ internal static ApiRevisionListResult DeserializeApiRevisionListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiRevisionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiRevisionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiRevisionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiRevisionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiRevisionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiRevisionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiRevisionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiRevisionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiRevisionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.cs index d1941cb70577..883de904e72f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiRevisionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged API Revision list representation. internal partial class ApiRevisionListResult { - /// Initializes a new instance of ApiRevisionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiRevisionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiRevisionListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiRevisionListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiRevisionListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs index ab3130146e59..8041b6e520da 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiSchemaData : IUtf8JsonSerializable + public partial class ApiSchemaData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element) + internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +89,7 @@ internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element) Optional value = default; Optional definitions = default; Optional components = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -146,8 +168,61 @@ internal static ApiSchemaData DeserializeApiSchemaData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiSchemaData(id, name, type, systemData.Value, contentType.Value, value.Value, definitions.Value, components.Value); + return new ApiSchemaData(id, name, type, systemData.Value, contentType.Value, value.Value, definitions.Value, components.Value, serializedAdditionalRawData); + } + + ApiSchemaData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiSchemaData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiSchemaData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiSchemaData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiSchemaData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiSchemaData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiSchemaData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.Serialization.cs index ff499dee4cba..e15c95c6bad2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiTagDescriptionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiTagDescriptionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,121 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExternalDocsDescription); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiTagDescriptionCreateOrUpdateContent DeserializeApiTagDescriptionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional externalDocsUri = default; + Optional externalDocsDescription = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("externalDocsUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + externalDocsUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("externalDocsDescription"u8)) + { + externalDocsDescription = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiTagDescriptionCreateOrUpdateContent(description.Value, externalDocsUri.Value, externalDocsDescription.Value, serializedAdditionalRawData); + } + + ApiTagDescriptionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiTagDescriptionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiTagDescriptionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiTagDescriptionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiTagDescriptionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiTagDescriptionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiTagDescriptionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.cs index 5a2aa7f82d0d..1a0d208caf3e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionCreateOrUpdateContent.cs @@ -6,17 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Create TagDescription operation. public partial class ApiTagDescriptionCreateOrUpdateContent { - /// Initializes a new instance of ApiTagDescriptionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiTagDescriptionCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Description of the Tag. + /// Absolute URL of external resources describing the tag. + /// Description of the external resources describing the tag. + /// Keeps track of any properties unknown to the library. + internal ApiTagDescriptionCreateOrUpdateContent(string description, Uri externalDocsUri, string externalDocsDescription, Dictionary serializedAdditionalRawData) + { + Description = description; + ExternalDocsUri = externalDocsUri; + ExternalDocsDescription = externalDocsDescription; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Description of the Tag. public string Description { get; set; } /// Absolute URL of external resources describing the tag. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionData.Serialization.cs index d251c388dd86..a2e2b6c76274 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiTagDescriptionData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiTagDescriptionData : IUtf8JsonSerializable + public partial class ApiTagDescriptionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiTagDescriptionData DeserializeApiTagDescriptionData(JsonElement element) + internal static ApiTagDescriptionData DeserializeApiTagDescriptionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +84,7 @@ internal static ApiTagDescriptionData DeserializeApiTagDescriptionData(JsonEleme Optional externalDocsDescription = default; Optional tagId = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -130,8 +152,61 @@ internal static ApiTagDescriptionData DeserializeApiTagDescriptionData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiTagDescriptionData(id, name, type, systemData.Value, description.Value, externalDocsUri.Value, externalDocsDescription.Value, tagId.Value, displayName.Value, serializedAdditionalRawData); + } + + ApiTagDescriptionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiTagDescriptionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiTagDescriptionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiTagDescriptionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiTagDescriptionData model) + { + if (model is null) + { + return null; } - return new ApiTagDescriptionData(id, name, type, systemData.Value, description.Value, externalDocsUri.Value, externalDocsDescription.Value, tagId.Value, displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiTagDescriptionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiTagDescriptionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.Serialization.cs index d66342279e7c..c05f13e2fdab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiVersionConstraint : IUtf8JsonSerializable + internal partial class ApiVersionConstraint : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MinApiVersion)) { writer.WritePropertyName("minApiVersion"u8); writer.WriteStringValue(MinApiVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiVersionConstraint DeserializeApiVersionConstraint(JsonElement element) + internal static ApiVersionConstraint DeserializeApiVersionConstraint(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional minApiVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minApiVersion"u8)) @@ -37,8 +60,61 @@ internal static ApiVersionConstraint DeserializeApiVersionConstraint(JsonElement minApiVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiVersionConstraint(minApiVersion.Value, serializedAdditionalRawData); + } + + ApiVersionConstraint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiVersionConstraint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiVersionConstraint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiVersionConstraint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiVersionConstraint model) + { + if (model is null) + { + return null; } - return new ApiVersionConstraint(minApiVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiVersionConstraint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiVersionConstraint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.cs index 0eef33b33c40..7ad232c0a6a3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionConstraint.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Control Plane Apis version constraint for the API Management service. internal partial class ApiVersionConstraint { - /// Initializes a new instance of ApiVersionConstraint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiVersionConstraint() { } - /// Initializes a new instance of ApiVersionConstraint. + /// Initializes a new instance of . /// Limit control plane API calls to API Management service with version equal to or newer than this value. - internal ApiVersionConstraint(string minApiVersion) + /// Keeps track of any properties unknown to the library. + internal ApiVersionConstraint(string minApiVersion, Dictionary serializedAdditionalRawData) { MinApiVersion = minApiVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Limit control plane API calls to API Management service with version equal to or newer than this value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.Serialization.cs index 23df6aed4310..b89c49d3ae50 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiVersionSetContractDetails : IUtf8JsonSerializable + public partial class ApiVersionSetContractDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -45,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("versionHeaderName"u8); writer.WriteStringValue(VersionHeaderName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiVersionSetContractDetails DeserializeApiVersionSetContractDetails(JsonElement element) + internal static ApiVersionSetContractDetails DeserializeApiVersionSetContractDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +82,7 @@ internal static ApiVersionSetContractDetails DeserializeApiVersionSetContractDet Optional versioningScheme = default; Optional versionQueryName = default; Optional versionHeaderName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -96,8 +119,61 @@ internal static ApiVersionSetContractDetails DeserializeApiVersionSetContractDet versionHeaderName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiVersionSetContractDetails(id.Value, name.Value, description.Value, Optional.ToNullable(versioningScheme), versionQueryName.Value, versionHeaderName.Value, serializedAdditionalRawData); + } + + ApiVersionSetContractDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiVersionSetContractDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiVersionSetContractDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiVersionSetContractDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiVersionSetContractDetails model) + { + if (model is null) + { + return null; } - return new ApiVersionSetContractDetails(id.Value, name.Value, description.Value, Optional.ToNullable(versioningScheme), versionQueryName.Value, versionHeaderName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiVersionSetContractDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiVersionSetContractDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.cs index da565773bc57..0bdb9d5978a6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetContractDetails.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// An API Version Set contains the common configuration for a set of API Versions relating. public partial class ApiVersionSetContractDetails { - /// Initializes a new instance of ApiVersionSetContractDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiVersionSetContractDetails() { } - /// Initializes a new instance of ApiVersionSetContractDetails. + /// Initializes a new instance of . /// Identifier for existing API Version Set. Omit this value to create a new Version Set. /// The display Name of the API Version Set. /// Description of API Version Set. /// An value that determines where the API Version identifier will be located in a HTTP request. /// Name of query parameter that indicates the API Version if versioningScheme is set to `query`. /// Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. - internal ApiVersionSetContractDetails(string id, string name, string description, VersioningScheme? versioningScheme, string versionQueryName, string versionHeaderName) + /// Keeps track of any properties unknown to the library. + internal ApiVersionSetContractDetails(string id, string name, string description, VersioningScheme? versioningScheme, string versionQueryName, string versionHeaderName, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -30,6 +37,7 @@ internal ApiVersionSetContractDetails(string id, string name, string description VersioningScheme = versioningScheme; VersionQueryName = versionQueryName; VersionHeaderName = versionHeaderName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifier for existing API Version Set. Omit this value to create a new Version Set. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetData.Serialization.cs index 4e6f398843ea..6bf41934f844 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class ApiVersionSetData : IUtf8JsonSerializable + public partial class ApiVersionSetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -45,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VersioningScheme.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiVersionSetData DeserializeApiVersionSetData(JsonElement element) + internal static ApiVersionSetData DeserializeApiVersionSetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +85,7 @@ internal static ApiVersionSetData DeserializeApiVersionSetData(JsonElement eleme Optional versionHeaderName = default; Optional displayName = default; Optional versioningScheme = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -130,8 +153,61 @@ internal static ApiVersionSetData DeserializeApiVersionSetData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiVersionSetData(id, name, type, systemData.Value, description.Value, versionQueryName.Value, versionHeaderName.Value, displayName.Value, Optional.ToNullable(versioningScheme), serializedAdditionalRawData); + } + + ApiVersionSetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiVersionSetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiVersionSetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiVersionSetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiVersionSetData model) + { + if (model is null) + { + return null; } - return new ApiVersionSetData(id, name, type, systemData.Value, description.Value, versionQueryName.Value, versionHeaderName.Value, displayName.Value, Optional.ToNullable(versioningScheme)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiVersionSetData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiVersionSetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.Serialization.cs index 3b6005cd7bf4..2dbf061b3d98 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ApiVersionSetListResult + internal partial class ApiVersionSetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiVersionSetListResult DeserializeApiVersionSetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiVersionSetListResult DeserializeApiVersionSetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static ApiVersionSetListResult DeserializeApiVersionSetListResult(JsonE Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static ApiVersionSetListResult DeserializeApiVersionSetListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiVersionSetListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ApiVersionSetListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ApiVersionSetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiVersionSetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiVersionSetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiVersionSetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiVersionSetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiVersionSetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiVersionSetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.cs index 4d13ea2de180..130c7e09ea7b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged API Version Set list representation. internal partial class ApiVersionSetListResult { - /// Initializes a new instance of ApiVersionSetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiVersionSetListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiVersionSetListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ApiVersionSetListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiVersionSetListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs index b2d763268872..6e5252c1c029 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiVersionSetPatch : IUtf8JsonSerializable + public partial class ApiVersionSetPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,7 +51,133 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VersioningScheme.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApiVersionSetPatch DeserializeApiVersionSetPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional versionQueryName = default; + Optional versionHeaderName = default; + Optional displayName = default; + Optional versioningScheme = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("versionQueryName"u8)) + { + versionQueryName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("versionHeaderName"u8)) + { + versionHeaderName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("versioningScheme"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versioningScheme = new VersioningScheme(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiVersionSetPatch(description.Value, versionQueryName.Value, versionHeaderName.Value, displayName.Value, Optional.ToNullable(versioningScheme), serializedAdditionalRawData); + } + + ApiVersionSetPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiVersionSetPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiVersionSetPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiVersionSetPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiVersionSetPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiVersionSetPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiVersionSetPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs index 9e304cbf8b68..8554c9ac2e6d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters to update or create an API Version Set Contract. public partial class ApiVersionSetPatch { - /// Initializes a new instance of ApiVersionSetPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiVersionSetPatch() { } + /// Initializes a new instance of . + /// Description of API Version Set. + /// Name of query parameter that indicates the API Version if versioningScheme is set to `query`. + /// Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + /// Name of API Version Set. + /// An value that determines where the API Version identifier will be located in a HTTP request. + /// Keeps track of any properties unknown to the library. + internal ApiVersionSetPatch(string description, string versionQueryName, string versionHeaderName, string displayName, VersioningScheme? versioningScheme, Dictionary serializedAdditionalRawData) + { + Description = description; + VersionQueryName = versionQueryName; + VersionHeaderName = versionHeaderName; + DisplayName = displayName; + VersioningScheme = versioningScheme; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Description of API Version Set. public string Description { get; set; } /// Name of query parameter that indicates the API Version if versioningScheme is set to `query`. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.Serialization.cs index d50cce74862b..46757e01f86a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.Serialization.cs @@ -8,14 +8,168 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AssociatedApiProperties + public partial class AssociatedApiProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssociatedApiProperties DeserializeAssociatedApiProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ServiceUri)) + { + writer.WritePropertyName("serviceUrl"u8); + writer.WriteStringValue(ServiceUri.AbsoluteUri); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsCollectionDefined(Protocols)) + { + writer.WritePropertyName("protocols"u8); + writer.WriteStartArray(); + foreach (var item in Protocols) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(AuthenticationSettings)) + { + writer.WritePropertyName("authenticationSettings"u8); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } + } + if (Optional.IsDefined(SubscriptionKeyParameterNames)) + { + writer.WritePropertyName("subscriptionKeyParameterNames"u8); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } + } + if (Optional.IsDefined(ApiType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ApiType.Value.ToString()); + } + if (Optional.IsDefined(ApiRevision)) + { + writer.WritePropertyName("apiRevision"u8); + writer.WriteStringValue(ApiRevision); + } + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + if (Optional.IsDefined(IsCurrent)) + { + writer.WritePropertyName("isCurrent"u8); + writer.WriteBooleanValue(IsCurrent.Value); + } + if (Optional.IsDefined(ApiRevisionDescription)) + { + writer.WritePropertyName("apiRevisionDescription"u8); + writer.WriteStringValue(ApiRevisionDescription); + } + if (Optional.IsDefined(ApiVersionDescription)) + { + writer.WritePropertyName("apiVersionDescription"u8); + writer.WriteStringValue(ApiVersionDescription); + } + if (Optional.IsDefined(ApiVersionSetId)) + { + writer.WritePropertyName("apiVersionSetId"u8); + writer.WriteStringValue(ApiVersionSetId); + } + if (Optional.IsDefined(IsSubscriptionRequired)) + { + writer.WritePropertyName("subscriptionRequired"u8); + writer.WriteBooleanValue(IsSubscriptionRequired.Value); + } + if (Optional.IsDefined(TermsOfServiceUri)) + { + writer.WritePropertyName("termsOfServiceUrl"u8); + writer.WriteStringValue(TermsOfServiceUri.AbsoluteUri); + } + if (Optional.IsDefined(Contact)) + { + writer.WritePropertyName("contact"u8); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } + } + if (Optional.IsDefined(License)) + { + writer.WritePropertyName("license"u8); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssociatedApiProperties DeserializeAssociatedApiProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +194,7 @@ internal static AssociatedApiProperties DeserializeAssociatedApiProperties(JsonE Optional termsOfServiceUri = default; Optional contact = default; Optional license = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -195,8 +350,61 @@ internal static AssociatedApiProperties DeserializeAssociatedApiProperties(JsonE license = ApiLicenseInformation.DeserializeApiLicenseInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssociatedApiProperties(description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, id.Value, name.Value, serviceUri.Value, path.Value, Optional.ToList(protocols)); + return new AssociatedApiProperties(description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, id.Value, name.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), serializedAdditionalRawData); + } + + AssociatedApiProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssociatedApiProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssociatedApiProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssociatedApiProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssociatedApiProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssociatedApiProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssociatedApiProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.cs index ba7ce23514d2..cde340a98b1c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedApiProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.ApiManagement.Models /// API contract properties for the Tag Resources. public partial class AssociatedApiProperties : ApiEntityBaseContract { - /// Initializes a new instance of AssociatedApiProperties. + /// Initializes a new instance of . internal AssociatedApiProperties() { Protocols = new ChangeTrackingList(); } - /// Initializes a new instance of AssociatedApiProperties. + /// Initializes a new instance of . /// Description of the API. May include HTML formatting tags. /// Collection of authentication settings included into this API. /// Protocols over which API is made available. @@ -41,7 +41,8 @@ internal AssociatedApiProperties() /// Absolute URL of the backend service implementing this API. /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. - internal AssociatedApiProperties(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, string id, string name, Uri serviceUri, string path, IReadOnlyList protocols) : base(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license) + /// Keeps track of any properties unknown to the library. + internal AssociatedApiProperties(string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, string id, string name, Uri serviceUri, string path, IReadOnlyList protocols, Dictionary serializedAdditionalRawData) : base(description, authenticationSettings, subscriptionKeyParameterNames, apiType, apiRevision, apiVersion, isCurrent, isOnline, apiRevisionDescription, apiVersionDescription, apiVersionSetId, isSubscriptionRequired, termsOfServiceUri, contact, license, serializedAdditionalRawData) { Id = id; Name = name; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.Serialization.cs index b9d9d9387761..cb2528f7699f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.Serialization.cs @@ -5,15 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AssociatedOperationProperties + public partial class AssociatedOperationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssociatedOperationProperties DeserializeAssociatedOperationProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssociatedOperationProperties DeserializeAssociatedOperationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +59,7 @@ internal static AssociatedOperationProperties DeserializeAssociatedOperationProp Optional description = default; Optional method = default; Optional uriTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -68,8 +102,61 @@ internal static AssociatedOperationProperties DeserializeAssociatedOperationProp uriTemplate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssociatedOperationProperties(id.Value, name.Value, apiName.Value, apiRevision.Value, apiVersion.Value, description.Value, method.Value, uriTemplate.Value); + return new AssociatedOperationProperties(id.Value, name.Value, apiName.Value, apiRevision.Value, apiVersion.Value, description.Value, method.Value, uriTemplate.Value, serializedAdditionalRawData); + } + + AssociatedOperationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssociatedOperationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssociatedOperationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssociatedOperationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssociatedOperationProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssociatedOperationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssociatedOperationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.cs index f86cf0311a70..cd7b97794018 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedOperationProperties.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Operation Entity contract Properties. public partial class AssociatedOperationProperties { - /// Initializes a new instance of AssociatedOperationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AssociatedOperationProperties() { } - /// Initializes a new instance of AssociatedOperationProperties. + /// Initializes a new instance of . /// Identifier of the operation in form /operations/{operationId}. /// Operation name. /// API Name. @@ -24,7 +30,8 @@ internal AssociatedOperationProperties() /// Operation Description. /// A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. /// Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - internal AssociatedOperationProperties(string id, string name, string apiName, string apiRevision, string apiVersion, string description, string method, string uriTemplate) + /// Keeps track of any properties unknown to the library. + internal AssociatedOperationProperties(string id, string name, string apiName, string apiRevision, string apiVersion, string description, string method, string uriTemplate, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -34,6 +41,7 @@ internal AssociatedOperationProperties(string id, string name, string apiName, s Description = description; Method = method; UriTemplate = uriTemplate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifier of the operation in form /operations/{operationId}. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.Serialization.cs index 24e930baf76e..c7e550c1e40a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.Serialization.cs @@ -5,15 +5,80 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AssociatedProductProperties + public partial class AssociatedProductProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssociatedProductProperties DeserializeAssociatedProductProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Terms)) + { + writer.WritePropertyName("terms"u8); + writer.WriteStringValue(Terms); + } + if (Optional.IsDefined(IsSubscriptionRequired)) + { + writer.WritePropertyName("subscriptionRequired"u8); + writer.WriteBooleanValue(IsSubscriptionRequired.Value); + } + if (Optional.IsDefined(IsApprovalRequired)) + { + writer.WritePropertyName("approvalRequired"u8); + writer.WriteBooleanValue(IsApprovalRequired.Value); + } + if (Optional.IsDefined(SubscriptionsLimit)) + { + writer.WritePropertyName("subscriptionsLimit"u8); + writer.WriteNumberValue(SubscriptionsLimit.Value); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssociatedProductProperties DeserializeAssociatedProductProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +91,7 @@ internal static AssociatedProductProperties DeserializeAssociatedProductProperti Optional approvalRequired = default; Optional subscriptionsLimit = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -84,8 +150,61 @@ internal static AssociatedProductProperties DeserializeAssociatedProductProperti state = property.Value.GetString().ToApiManagementProductState(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssociatedProductProperties(description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state), id.Value, name); + return new AssociatedProductProperties(description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state), id.Value, name, serializedAdditionalRawData); + } + + AssociatedProductProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssociatedProductProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssociatedProductProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssociatedProductProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssociatedProductProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssociatedProductProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssociatedProductProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.cs index af30177c1005..9a5bb79ee286 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedProductProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Product profile. public partial class AssociatedProductProperties : ProductEntityBaseProperties { - /// Initializes a new instance of AssociatedProductProperties. + /// Initializes a new instance of . /// Product name. /// is null. internal AssociatedProductProperties(string name) @@ -23,7 +24,7 @@ internal AssociatedProductProperties(string name) Name = name; } - /// Initializes a new instance of AssociatedProductProperties. + /// Initializes a new instance of . /// Product description. May include HTML formatting tags. /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. /// Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. @@ -32,12 +33,18 @@ internal AssociatedProductProperties(string name) /// whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. /// Identifier of the product in the form of /products/{productId}. /// Product name. - internal AssociatedProductProperties(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string id, string name) : base(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state) + /// Keeps track of any properties unknown to the library. + internal AssociatedProductProperties(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, string id, string name, Dictionary serializedAdditionalRawData) : base(description, terms, isSubscriptionRequired, isApprovalRequired, subscriptionsLimit, state, serializedAdditionalRawData) { Id = id; Name = name; } + /// Initializes a new instance of for deserialization. + internal AssociatedProductProperties() + { + } + /// Identifier of the product in the form of /products/{productId}. public string Id { get; } /// Product name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.Serialization.cs index 0c3927e318d7..a93cb7dcad65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AssociatedTagProperties + public partial class AssociatedTagProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssociatedTagProperties DeserializeAssociatedTagProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssociatedTagProperties DeserializeAssociatedTagProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -32,8 +71,61 @@ internal static AssociatedTagProperties DeserializeAssociatedTagProperties(JsonE name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssociatedTagProperties(id.Value, name.Value); + return new AssociatedTagProperties(id.Value, name.Value, serializedAdditionalRawData); + } + + AssociatedTagProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssociatedTagProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssociatedTagProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssociatedTagProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssociatedTagProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssociatedTagProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssociatedTagProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.cs index 7337fb56ff74..d950b5ebcced 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociatedTagProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Contract defining the Tag property in the Tag Resource Contract. public partial class AssociatedTagProperties { - /// Initializes a new instance of AssociatedTagProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AssociatedTagProperties() { } - /// Initializes a new instance of AssociatedTagProperties. + /// Initializes a new instance of . /// Tag identifier. /// Tag Name. - internal AssociatedTagProperties(string id, string name) + /// Keeps track of any properties unknown to the library. + internal AssociatedTagProperties(string id, string name, Dictionary serializedAdditionalRawData) { Id = id; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Tag identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.Serialization.cs index e4a7c26a5ce3..8667d05f4f8d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AssociationContract : IUtf8JsonSerializable + public partial class AssociationContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssociationContract DeserializeAssociationContract(JsonElement element) + internal static AssociationContract DeserializeAssociationContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static AssociationContract DeserializeAssociationContract(JsonElement e ResourceType type = default; Optional systemData = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -85,8 +108,61 @@ internal static AssociationContract DeserializeAssociationContract(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssociationContract(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AssociationContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssociationContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssociationContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssociationContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssociationContract model) + { + if (model is null) + { + return null; } - return new AssociationContract(id, name, type, systemData.Value, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssociationContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssociationContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.cs index bba988b939ec..bc3460c734ab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AssociationContract.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Association entity details. public partial class AssociationContract : ResourceData { - /// Initializes a new instance of AssociationContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AssociationContract() { } - /// Initializes a new instance of AssociationContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Provisioning state. - internal AssociationContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AssociationEntityProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AssociationContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AssociationEntityProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs index 983e32045d96..e88414f2cea3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AuthenticationSettingsContract : IUtf8JsonSerializable + public partial class AuthenticationSettingsContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OAuth2)) { writer.WritePropertyName("oAuth2"u8); - writer.WriteObjectValue(OAuth2); + if (OAuth2 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OAuth2).Serialize(writer, options); + } } if (Optional.IsDefined(OpenId)) { writer.WritePropertyName("openid"u8); - writer.WriteObjectValue(OpenId); + if (OpenId is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OpenId).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AuthenticationSettingsContract DeserializeAuthenticationSettingsContract(JsonElement element) + internal static AuthenticationSettingsContract DeserializeAuthenticationSettingsContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional oAuth2 = default; Optional openid = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("oAuth2"u8)) @@ -56,8 +93,61 @@ internal static AuthenticationSettingsContract DeserializeAuthenticationSettings openid = OpenIdAuthenticationSettingsContract.DeserializeOpenIdAuthenticationSettingsContract(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AuthenticationSettingsContract(oAuth2.Value, openid.Value, serializedAdditionalRawData); + } + + AuthenticationSettingsContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthenticationSettingsContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthenticationSettingsContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthenticationSettingsContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthenticationSettingsContract model) + { + if (model is null) + { + return null; } - return new AuthenticationSettingsContract(oAuth2.Value, openid.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthenticationSettingsContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthenticationSettingsContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs index bb0ae8079f74..14bf9e741074 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// API Authentication Settings. public partial class AuthenticationSettingsContract { - /// Initializes a new instance of AuthenticationSettingsContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AuthenticationSettingsContract() { } - /// Initializes a new instance of AuthenticationSettingsContract. + /// Initializes a new instance of . /// OAuth2 Authentication settings. /// OpenID Connect Authentication Settings. - internal AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2, OpenIdAuthenticationSettingsContract openId) + /// Keeps track of any properties unknown to the library. + internal AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2, OpenIdAuthenticationSettingsContract openId, Dictionary serializedAdditionalRawData) { OAuth2 = oAuth2; OpenId = openId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// OAuth2 Authentication settings. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.Serialization.cs index f43fd98ca636..d6b2de5ee712 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class AuthorizationServerListResult + internal partial class AuthorizationServerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationServerListResult DeserializeAuthorizationServerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationServerListResult DeserializeAuthorizationServerListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static AuthorizationServerListResult DeserializeAuthorizationServerList Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static AuthorizationServerListResult DeserializeAuthorizationServerList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationServerListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new AuthorizationServerListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + AuthorizationServerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationServerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationServerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationServerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationServerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationServerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationServerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.cs index 52cb86cd8343..8c1e6eaa62a2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged OAuth2 Authorization Servers list representation. internal partial class AuthorizationServerListResult { - /// Initializes a new instance of AuthorizationServerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationServerListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationServerListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal AuthorizationServerListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AuthorizationServerListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.Serialization.cs index 7ff1f173af34..0805273c4840 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AuthorizationServerSecretsContract + public partial class AuthorizationServerSecretsContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationServerSecretsContract DeserializeAuthorizationServerSecretsContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ClientSecret)) + { + writer.WritePropertyName("clientSecret"u8); + writer.WriteStringValue(ClientSecret); + } + if (Optional.IsDefined(ResourceOwnerUsername)) + { + writer.WritePropertyName("resourceOwnerUsername"u8); + writer.WriteStringValue(ResourceOwnerUsername); + } + if (Optional.IsDefined(ResourceOwnerPassword)) + { + writer.WritePropertyName("resourceOwnerPassword"u8); + writer.WriteStringValue(ResourceOwnerPassword); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationServerSecretsContract DeserializeAuthorizationServerSecretsContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static AuthorizationServerSecretsContract DeserializeAuthorizationServe Optional clientSecret = default; Optional resourceOwnerUsername = default; Optional resourceOwnerPassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientSecret"u8)) @@ -38,8 +82,61 @@ internal static AuthorizationServerSecretsContract DeserializeAuthorizationServe resourceOwnerPassword = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationServerSecretsContract(clientSecret.Value, resourceOwnerUsername.Value, resourceOwnerPassword.Value); + return new AuthorizationServerSecretsContract(clientSecret.Value, resourceOwnerUsername.Value, resourceOwnerPassword.Value, serializedAdditionalRawData); + } + + AuthorizationServerSecretsContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationServerSecretsContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationServerSecretsContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationServerSecretsContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationServerSecretsContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationServerSecretsContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationServerSecretsContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs index 763c7272279b..a7532c4fd200 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// OAuth Server Secrets Contract. public partial class AuthorizationServerSecretsContract { - /// Initializes a new instance of AuthorizationServerSecretsContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationServerSecretsContract() { } - /// Initializes a new instance of AuthorizationServerSecretsContract. + /// Initializes a new instance of . /// oAuth Authorization Server Secrets. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - internal AuthorizationServerSecretsContract(string clientSecret, string resourceOwnerUsername, string resourceOwnerPassword) + /// Keeps track of any properties unknown to the library. + internal AuthorizationServerSecretsContract(string clientSecret, string resourceOwnerUsername, string resourceOwnerPassword, Dictionary serializedAdditionalRawData) { ClientSecret = clientSecret; ResourceOwnerUsername = resourceOwnerUsername; ResourceOwnerPassword = resourceOwnerPassword; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// oAuth Authorization Server Secrets. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.Serialization.cs index 44cce4975e6f..6e1bc950c171 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class AvailableApiManagementServiceSkuResult + public partial class AvailableApiManagementServiceSkuResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableApiManagementServiceSkuResult DeserializeAvailableApiManagementServiceSkuResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableApiManagementServiceSkuResult DeserializeAvailableApiManagementServiceSkuResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AvailableApiManagementServiceSkuResult DeserializeAvailableApiMa Optional resourceType = default; Optional sku = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -50,8 +79,61 @@ internal static AvailableApiManagementServiceSkuResult DeserializeAvailableApiMa capacity = ApiManagementResourceSkuCapacity.DeserializeApiManagementResourceSkuCapacity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableApiManagementServiceSkuResult(Optional.ToNullable(resourceType), sku.Value, capacity.Value); + return new AvailableApiManagementServiceSkuResult(Optional.ToNullable(resourceType), sku.Value, capacity.Value, serializedAdditionalRawData); + } + + AvailableApiManagementServiceSkuResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableApiManagementServiceSkuResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableApiManagementServiceSkuResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableApiManagementServiceSkuResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableApiManagementServiceSkuResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableApiManagementServiceSkuResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableApiManagementServiceSkuResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.cs index 0dd6d12c87e7..448501555ae9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AvailableApiManagementServiceSkuResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Describes an available API Management service SKU. public partial class AvailableApiManagementServiceSkuResult { - /// Initializes a new instance of AvailableApiManagementServiceSkuResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableApiManagementServiceSkuResult() { } - /// Initializes a new instance of AvailableApiManagementServiceSkuResult. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// Specifies API Management SKU. /// Specifies the number of API Management units. - internal AvailableApiManagementServiceSkuResult(ResourceType? resourceType, ResourceSku sku, ApiManagementResourceSkuCapacity capacity) + /// Keeps track of any properties unknown to the library. + internal AvailableApiManagementServiceSkuResult(ResourceType? resourceType, ResourceSku sku, ApiManagementResourceSkuCapacity capacity, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Sku = sku; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of resource the SKU applies to. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.Serialization.cs index 72a16cf86c04..804de5e7a4c7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class BackendAuthorizationHeaderCredentials : IUtf8JsonSerializable + public partial class BackendAuthorizationHeaderCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("scheme"u8); writer.WriteStringValue(Scheme); writer.WritePropertyName("parameter"u8); writer.WriteStringValue(Parameter); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackendAuthorizationHeaderCredentials DeserializeBackendAuthorizationHeaderCredentials(JsonElement element) + internal static BackendAuthorizationHeaderCredentials DeserializeBackendAuthorizationHeaderCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string scheme = default; string parameter = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scheme"u8)) @@ -42,8 +65,61 @@ internal static BackendAuthorizationHeaderCredentials DeserializeBackendAuthoriz parameter = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendAuthorizationHeaderCredentials(scheme, parameter, serializedAdditionalRawData); + } + + BackendAuthorizationHeaderCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendAuthorizationHeaderCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendAuthorizationHeaderCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendAuthorizationHeaderCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendAuthorizationHeaderCredentials model) + { + if (model is null) + { + return null; } - return new BackendAuthorizationHeaderCredentials(scheme, parameter); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendAuthorizationHeaderCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendAuthorizationHeaderCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs index 9644adf64841..aa764db00ae3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Authorization header information. public partial class BackendAuthorizationHeaderCredentials { - /// Initializes a new instance of BackendAuthorizationHeaderCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Authentication Scheme name. /// Authentication Parameter value. /// or is null. @@ -26,6 +30,22 @@ public BackendAuthorizationHeaderCredentials(string scheme, string parameter) Parameter = parameter; } + /// Initializes a new instance of . + /// Authentication Scheme name. + /// Authentication Parameter value. + /// Keeps track of any properties unknown to the library. + internal BackendAuthorizationHeaderCredentials(string scheme, string parameter, Dictionary serializedAdditionalRawData) + { + Scheme = scheme; + Parameter = parameter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BackendAuthorizationHeaderCredentials() + { + } + /// Authentication Scheme name. public string Scheme { get; set; } /// Authentication Parameter value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.Serialization.cs index 75bd4042334a..1d5921546170 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class BackendCredentialsContract : IUtf8JsonSerializable + public partial class BackendCredentialsContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(CertificateIds)) { @@ -81,13 +88,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Authorization)) { writer.WritePropertyName("authorization"u8); - writer.WriteObjectValue(Authorization); + if (Authorization is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Authorization).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BackendCredentialsContract DeserializeBackendCredentialsContract(JsonElement element) + internal static BackendCredentialsContract DeserializeBackendCredentialsContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -97,6 +125,7 @@ internal static BackendCredentialsContract DeserializeBackendCredentialsContract Optional>> query = default; Optional>> header = default; Optional authorization = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificateIds"u8)) @@ -188,8 +217,61 @@ internal static BackendCredentialsContract DeserializeBackendCredentialsContract authorization = BackendAuthorizationHeaderCredentials.DeserializeBackendAuthorizationHeaderCredentials(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendCredentialsContract(Optional.ToList(certificateIds), Optional.ToList(certificate), Optional.ToDictionary(query), Optional.ToDictionary(header), authorization.Value, serializedAdditionalRawData); + } + + BackendCredentialsContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendCredentialsContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendCredentialsContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendCredentialsContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendCredentialsContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendCredentialsContract(Response response) + { + if (response is null) + { + return null; } - return new BackendCredentialsContract(Optional.ToList(certificateIds), Optional.ToList(certificate), Optional.ToDictionary(query), Optional.ToDictionary(header), authorization.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendCredentialsContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs index e34043021947..011a60422a82 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Details of the Credentials used to connect to Backend. public partial class BackendCredentialsContract { - /// Initializes a new instance of BackendCredentialsContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BackendCredentialsContract() { CertificateIds = new ChangeTrackingList(); @@ -22,19 +26,21 @@ public BackendCredentialsContract() Header = new ChangeTrackingDictionary>(); } - /// Initializes a new instance of BackendCredentialsContract. + /// Initializes a new instance of . /// List of Client Certificate Ids. /// List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided. /// Query Parameter description. /// Header Parameter description. /// Authorization header authentication. - internal BackendCredentialsContract(IList certificateIds, IList certificate, IDictionary> query, IDictionary> header, BackendAuthorizationHeaderCredentials authorization) + /// Keeps track of any properties unknown to the library. + internal BackendCredentialsContract(IList certificateIds, IList certificate, IDictionary> query, IDictionary> header, BackendAuthorizationHeaderCredentials authorization, Dictionary serializedAdditionalRawData) { CertificateIds = certificateIds; Certificate = certificate; Query = query; Header = header; Authorization = authorization; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Client Certificate Ids. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.Serialization.cs index 658f14a8aaa8..eae6816398ab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class BackendListResult + internal partial class BackendListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BackendListResult DeserializeBackendListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BackendListResult DeserializeBackendListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static BackendListResult DeserializeBackendListResult(JsonElement eleme Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static BackendListResult DeserializeBackendListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BackendListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new BackendListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + BackendListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.cs index e1b6a91f46a5..41ff2eb241fa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Backend list representation. internal partial class BackendListResult { - /// Initializes a new instance of BackendListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BackendListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BackendListResult. + /// Initializes a new instance of . /// Backend values. /// Total record count number across all pages. /// Next page link if any. - internal BackendListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BackendListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Backend values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.Serialization.cs index 55f5268794ec..648019ce6bd0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class BackendProperties : IUtf8JsonSerializable + internal partial class BackendProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ServiceFabricCluster)) { writer.WritePropertyName("serviceFabricCluster"u8); - writer.WriteObjectValue(ServiceFabricCluster); + if (ServiceFabricCluster is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ServiceFabricCluster).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BackendProperties DeserializeBackendProperties(JsonElement element) + internal static BackendProperties DeserializeBackendProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional serviceFabricCluster = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serviceFabricCluster"u8)) @@ -41,8 +71,61 @@ internal static BackendProperties DeserializeBackendProperties(JsonElement eleme serviceFabricCluster = BackendServiceFabricClusterProperties.DeserializeBackendServiceFabricClusterProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendProperties(serviceFabricCluster.Value, serializedAdditionalRawData); + } + + BackendProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendProperties(Response response) + { + if (response is null) + { + return null; } - return new BackendProperties(serviceFabricCluster.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.cs index 0dbed49c8bf5..517e31b15cb0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Properties specific to the Backend Type. internal partial class BackendProperties { - /// Initializes a new instance of BackendProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BackendProperties() { } - /// Initializes a new instance of BackendProperties. + /// Initializes a new instance of . /// Backend Service Fabric Cluster Properties. - internal BackendProperties(BackendServiceFabricClusterProperties serviceFabricCluster) + /// Keeps track of any properties unknown to the library. + internal BackendProperties(BackendServiceFabricClusterProperties serviceFabricCluster, Dictionary serializedAdditionalRawData) { ServiceFabricCluster = serviceFabricCluster; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Backend Service Fabric Cluster Properties. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.Serialization.cs index 4de6a6593498..b55a8e043fcd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class BackendProxyContract : IUtf8JsonSerializable + public partial class BackendProxyContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("url"u8); writer.WriteStringValue(Uri.AbsoluteUri); @@ -28,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackendProxyContract DeserializeBackendProxyContract(JsonElement element) + internal static BackendProxyContract DeserializeBackendProxyContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static BackendProxyContract DeserializeBackendProxyContract(JsonElement Uri uri = default; Optional username = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("url"u8)) @@ -57,8 +79,61 @@ internal static BackendProxyContract DeserializeBackendProxyContract(JsonElement password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendProxyContract(uri, username.Value, password.Value, serializedAdditionalRawData); + } + + BackendProxyContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendProxyContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendProxyContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendProxyContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendProxyContract model) + { + if (model is null) + { + return null; } - return new BackendProxyContract(uri, username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendProxyContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendProxyContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.cs index ec61efc88688..e159b0d485ca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendProxyContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Details of the Backend WebProxy Server to use in the Request to Backend. public partial class BackendProxyContract { - /// Initializes a new instance of BackendProxyContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. /// is null. public BackendProxyContract(Uri uri) @@ -23,15 +27,22 @@ public BackendProxyContract(Uri uri) Uri = uri; } - /// Initializes a new instance of BackendProxyContract. + /// Initializes a new instance of . /// WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. /// Username to connect to the WebProxy server. /// Password to connect to the WebProxy Server. - internal BackendProxyContract(Uri uri, string username, string password) + /// Keeps track of any properties unknown to the library. + internal BackendProxyContract(Uri uri, string username, string password, Dictionary serializedAdditionalRawData) { Uri = uri; Username = username; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BackendProxyContract() + { } /// WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.Serialization.cs index d5643b107783..408e0de6614c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class BackendReconnectContract : IUtf8JsonSerializable + public partial class BackendReconnectContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(After.Value, "P"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackendReconnectContract DeserializeBackendReconnectContract(JsonElement element) + internal static BackendReconnectContract DeserializeBackendReconnectContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static BackendReconnectContract DeserializeBackendReconnectContract(Jso ResourceType type = default; Optional systemData = default; Optional after = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +108,61 @@ internal static BackendReconnectContract DeserializeBackendReconnectContract(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendReconnectContract(id, name, type, systemData.Value, Optional.ToNullable(after), serializedAdditionalRawData); + } + + BackendReconnectContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendReconnectContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendReconnectContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendReconnectContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendReconnectContract model) + { + if (model is null) + { + return null; } - return new BackendReconnectContract(id, name, type, systemData.Value, Optional.ToNullable(after)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendReconnectContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendReconnectContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.cs index 16687ae7783e..88bff2c594d6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendReconnectContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,20 +15,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Reconnect request parameters. public partial class BackendReconnectContract : ResourceData { - /// Initializes a new instance of BackendReconnectContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BackendReconnectContract() { } - /// Initializes a new instance of BackendReconnectContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. - internal BackendReconnectContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TimeSpan? after) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BackendReconnectContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TimeSpan? after, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { After = after; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.Serialization.cs index c657ba1ccf89..1b3569accea6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class BackendServiceFabricClusterProperties : IUtf8JsonSerializable + public partial class BackendServiceFabricClusterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientCertificateId)) { @@ -54,15 +61,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ServerX509Names) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackendServiceFabricClusterProperties DeserializeBackendServiceFabricClusterProperties(JsonElement element) + internal static BackendServiceFabricClusterProperties DeserializeBackendServiceFabricClusterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +101,7 @@ internal static BackendServiceFabricClusterProperties DeserializeBackendServiceF IList managementEndpoints = default; Optional> serverCertificateThumbprints = default; Optional> serverX509Names = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientCertificateId"u8)) @@ -132,8 +161,61 @@ internal static BackendServiceFabricClusterProperties DeserializeBackendServiceF serverX509Names = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendServiceFabricClusterProperties(clientCertificateId.Value, clientCertificatethumbprint.Value, Optional.ToNullable(maxPartitionResolutionRetries), managementEndpoints, Optional.ToList(serverCertificateThumbprints), Optional.ToList(serverX509Names), serializedAdditionalRawData); + } + + BackendServiceFabricClusterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendServiceFabricClusterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendServiceFabricClusterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendServiceFabricClusterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendServiceFabricClusterProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendServiceFabricClusterProperties(Response response) + { + if (response is null) + { + return null; } - return new BackendServiceFabricClusterProperties(clientCertificateId.Value, clientCertificatethumbprint.Value, Optional.ToNullable(maxPartitionResolutionRetries), managementEndpoints, Optional.ToList(serverCertificateThumbprints), Optional.ToList(serverX509Names)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendServiceFabricClusterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs index 5114ce85b7d7..69e7e3f6468e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Properties of the Service Fabric Type Backend. public partial class BackendServiceFabricClusterProperties { - /// Initializes a new instance of BackendServiceFabricClusterProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The cluster management endpoint. /// is null. public BackendServiceFabricClusterProperties(IEnumerable managementEndpoints) @@ -27,14 +30,15 @@ public BackendServiceFabricClusterProperties(IEnumerable managementEndpo ServerX509Names = new ChangeTrackingList(); } - /// Initializes a new instance of BackendServiceFabricClusterProperties. + /// Initializes a new instance of . /// The client certificate id for the management endpoint. /// The client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided. /// Maximum number of retries while attempting resolve the partition. /// The cluster management endpoint. /// Thumbprints of certificates cluster management service uses for tls communication. /// Server X509 Certificate Names Collection. - internal BackendServiceFabricClusterProperties(string clientCertificateId, string clientCertificatethumbprint, int? maxPartitionResolutionRetries, IList managementEndpoints, IList serverCertificateThumbprints, IList serverX509Names) + /// Keeps track of any properties unknown to the library. + internal BackendServiceFabricClusterProperties(string clientCertificateId, string clientCertificatethumbprint, int? maxPartitionResolutionRetries, IList managementEndpoints, IList serverCertificateThumbprints, IList serverX509Names, Dictionary serializedAdditionalRawData) { ClientCertificateId = clientCertificateId; ClientCertificatethumbprint = clientCertificatethumbprint; @@ -42,6 +46,12 @@ internal BackendServiceFabricClusterProperties(string clientCertificateId, strin ManagementEndpoints = managementEndpoints; ServerCertificateThumbprints = serverCertificateThumbprints; ServerX509Names = serverX509Names; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BackendServiceFabricClusterProperties() + { } /// The client certificate id for the management endpoint. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.Serialization.cs index 1d193bcf31f4..c6c566fd7a0c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class BackendTlsProperties : IUtf8JsonSerializable + public partial class BackendTlsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ShouldValidateCertificateChain)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("validateCertificateName"u8); writer.WriteBooleanValue(ShouldValidateCertificateName.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackendTlsProperties DeserializeBackendTlsProperties(JsonElement element) + internal static BackendTlsProperties DeserializeBackendTlsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional validateCertificateChain = default; Optional validateCertificateName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("validateCertificateChain"u8)) @@ -56,8 +79,61 @@ internal static BackendTlsProperties DeserializeBackendTlsProperties(JsonElement validateCertificateName = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackendTlsProperties(Optional.ToNullable(validateCertificateChain), Optional.ToNullable(validateCertificateName), serializedAdditionalRawData); + } + + BackendTlsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackendTlsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackendTlsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackendTlsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackendTlsProperties model) + { + if (model is null) + { + return null; } - return new BackendTlsProperties(Optional.ToNullable(validateCertificateChain), Optional.ToNullable(validateCertificateName)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackendTlsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackendTlsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.cs index 2ae0b5e44525..289cc258df27 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendTlsProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Properties controlling TLS Certificate Validation. public partial class BackendTlsProperties { - /// Initializes a new instance of BackendTlsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BackendTlsProperties() { } - /// Initializes a new instance of BackendTlsProperties. + /// Initializes a new instance of . /// Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. /// Flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host. - internal BackendTlsProperties(bool? shouldValidateCertificateChain, bool? shouldValidateCertificateName) + /// Keeps track of any properties unknown to the library. + internal BackendTlsProperties(bool? shouldValidateCertificateChain, bool? shouldValidateCertificateName, Dictionary serializedAdditionalRawData) { ShouldValidateCertificateChain = shouldValidateCertificateChain; ShouldValidateCertificateName = shouldValidateCertificateName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.Serialization.cs index 38c94b5cdbaa..e158c67251b0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class BodyDiagnosticSettings : IUtf8JsonSerializable + internal partial class BodyDiagnosticSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Bytes)) { writer.WritePropertyName("bytes"u8); writer.WriteNumberValue(Bytes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BodyDiagnosticSettings DeserializeBodyDiagnosticSettings(JsonElement element) + internal static BodyDiagnosticSettings DeserializeBodyDiagnosticSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional bytes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("bytes"u8)) @@ -41,8 +64,61 @@ internal static BodyDiagnosticSettings DeserializeBodyDiagnosticSettings(JsonEle bytes = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BodyDiagnosticSettings(Optional.ToNullable(bytes), serializedAdditionalRawData); + } + + BodyDiagnosticSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBodyDiagnosticSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BodyDiagnosticSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBodyDiagnosticSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BodyDiagnosticSettings model) + { + if (model is null) + { + return null; } - return new BodyDiagnosticSettings(Optional.ToNullable(bytes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BodyDiagnosticSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBodyDiagnosticSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.cs index 5559871619b2..6910e1fd899d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BodyDiagnosticSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Body logging settings. internal partial class BodyDiagnosticSettings { - /// Initializes a new instance of BodyDiagnosticSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BodyDiagnosticSettings() { } - /// Initializes a new instance of BodyDiagnosticSettings. + /// Initializes a new instance of . /// Number of request body bytes to log. - internal BodyDiagnosticSettings(int? bytes) + /// Keeps track of any properties unknown to the library. + internal BodyDiagnosticSettings(int? bytes, Dictionary serializedAdditionalRawData) { Bytes = bytes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Number of request body bytes to log. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.Serialization.cs index 7ce98fb86e8e..0cf98bc93d1d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class CacheListResult + internal partial class CacheListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CacheListResult DeserializeCacheListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CacheListResult DeserializeCacheListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static CacheListResult DeserializeCacheListResult(JsonElement element) Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static CacheListResult DeserializeCacheListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CacheListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new CacheListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + CacheListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCacheListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CacheListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCacheListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CacheListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CacheListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCacheListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.cs index 826ae331491b..a49e6e514a92 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CacheListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Caches list representation. internal partial class CacheListResult { - /// Initializes a new instance of CacheListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CacheListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CacheListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal CacheListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CacheListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.Serialization.cs index 3220a9a93592..b8326d938782 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class CertificateConfiguration : IUtf8JsonSerializable + public partial class CertificateConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EncodedCertificate)) { @@ -30,13 +38,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Certificate)) { writer.WritePropertyName("certificate"u8); - writer.WriteObjectValue(Certificate); + if (Certificate is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Certificate).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CertificateConfiguration DeserializeCertificateConfiguration(JsonElement element) + internal static CertificateConfiguration DeserializeCertificateConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +74,7 @@ internal static CertificateConfiguration DeserializeCertificateConfiguration(Jso Optional certificatePassword = default; CertificateConfigurationStoreName storeName = default; Optional certificate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("encodedCertificate"u8)) @@ -71,8 +101,61 @@ internal static CertificateConfiguration DeserializeCertificateConfiguration(Jso certificate = CertificateInformation.DeserializeCertificateInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CertificateConfiguration(encodedCertificate.Value, certificatePassword.Value, storeName, certificate.Value, serializedAdditionalRawData); + } + + CertificateConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCertificateConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CertificateConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCertificateConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CertificateConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CertificateConfiguration(Response response) + { + if (response is null) + { + return null; } - return new CertificateConfiguration(encodedCertificate.Value, certificatePassword.Value, storeName, certificate.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCertificateConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.cs index 30ea8a953144..774411e980a5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateConfiguration.cs @@ -5,29 +5,42 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Certificate configuration which consist of non-trusted intermediates and root certificates. public partial class CertificateConfiguration { - /// Initializes a new instance of CertificateConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. public CertificateConfiguration(CertificateConfigurationStoreName storeName) { StoreName = storeName; } - /// Initializes a new instance of CertificateConfiguration. + /// Initializes a new instance of . /// Base64 Encoded certificate. /// Certificate Password. /// The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. /// Certificate information. - internal CertificateConfiguration(string encodedCertificate, string certificatePassword, CertificateConfigurationStoreName storeName, CertificateInformation certificate) + /// Keeps track of any properties unknown to the library. + internal CertificateConfiguration(string encodedCertificate, string certificatePassword, CertificateConfigurationStoreName storeName, CertificateInformation certificate, Dictionary serializedAdditionalRawData) { EncodedCertificate = encodedCertificate; CertificatePassword = certificatePassword; StoreName = storeName; Certificate = certificate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertificateConfiguration() + { } /// Base64 Encoded certificate. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.Serialization.cs index 7b56e3d046f7..b32fbd18cc2d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class CertificateInformation : IUtf8JsonSerializable + public partial class CertificateInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("expiry"u8); writer.WriteStringValue(ExpireOn, "O"); @@ -22,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Thumbprint); writer.WritePropertyName("subject"u8); writer.WriteStringValue(Subject); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CertificateInformation DeserializeCertificateInformation(JsonElement element) + internal static CertificateInformation DeserializeCertificateInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +55,7 @@ internal static CertificateInformation DeserializeCertificateInformation(JsonEle DateTimeOffset expiry = default; string thumbprint = default; string subject = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("expiry"u8)) @@ -51,8 +73,61 @@ internal static CertificateInformation DeserializeCertificateInformation(JsonEle subject = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CertificateInformation(expiry, thumbprint, subject, serializedAdditionalRawData); + } + + CertificateInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCertificateInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CertificateInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCertificateInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CertificateInformation model) + { + if (model is null) + { + return null; } - return new CertificateInformation(expiry, thumbprint, subject); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CertificateInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCertificateInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.cs index 5ccecec9178e..741e4b504b7d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateInformation.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// SSL certificate information. public partial class CertificateInformation { - /// Initializes a new instance of CertificateInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. /// Thumbprint of the certificate. /// Subject of the certificate. @@ -28,6 +32,24 @@ public CertificateInformation(DateTimeOffset expireOn, string thumbprint, string Subject = subject; } + /// Initializes a new instance of . + /// Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + /// Thumbprint of the certificate. + /// Subject of the certificate. + /// Keeps track of any properties unknown to the library. + internal CertificateInformation(DateTimeOffset expireOn, string thumbprint, string subject, Dictionary serializedAdditionalRawData) + { + ExpireOn = expireOn; + Thumbprint = thumbprint; + Subject = subject; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertificateInformation() + { + } + /// Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. public DateTimeOffset ExpireOn { get; set; } /// Thumbprint of the certificate. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.Serialization.cs index 80ce0fa83959..70bae3e410e9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class CertificateListResult + internal partial class CertificateListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CertificateListResult DeserializeCertificateListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CertificateListResult DeserializeCertificateListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static CertificateListResult DeserializeCertificateListResult(JsonEleme Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static CertificateListResult DeserializeCertificateListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CertificateListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new CertificateListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + CertificateListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCertificateListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CertificateListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCertificateListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CertificateListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CertificateListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCertificateListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.cs index 9313038a6cd2..3033ea44f94f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CertificateListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Certificates list representation. internal partial class CertificateListResult { - /// Initializes a new instance of CertificateListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CertificateListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CertificateListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal CertificateListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CertificateListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.Serialization.cs index 85813a28048a..6315a98c6bb9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ClientSecretContract + public partial class ClientSecretContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClientSecretContract DeserializeClientSecretContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ClientSecret)) + { + writer.WritePropertyName("clientSecret"u8); + writer.WriteStringValue(ClientSecret); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClientSecretContract DeserializeClientSecretContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientSecret"u8)) @@ -26,8 +60,61 @@ internal static ClientSecretContract DeserializeClientSecretContract(JsonElement clientSecret = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClientSecretContract(clientSecret.Value); + return new ClientSecretContract(clientSecret.Value, serializedAdditionalRawData); + } + + ClientSecretContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClientSecretContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClientSecretContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClientSecretContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClientSecretContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClientSecretContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClientSecretContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.cs index 325168962b20..b766498f7e52 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ClientSecretContract.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. public partial class ClientSecretContract { - /// Initializes a new instance of ClientSecretContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ClientSecretContract() { } - /// Initializes a new instance of ClientSecretContract. + /// Initializes a new instance of . /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - internal ClientSecretContract(string clientSecret) + /// Keeps track of any properties unknown to the library. + internal ClientSecretContract(string clientSecret, Dictionary serializedAdditionalRawData) { ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.Serialization.cs index 6eef1e25c5bf..e249db498c44 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConfigurationDeployContent : IUtf8JsonSerializable + public partial class ConfigurationDeployContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,7 +36,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(ForceDelete.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConfigurationDeployContent DeserializeConfigurationDeployContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional branch = default; + Optional force = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("branch"u8)) + { + branch = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("force"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + force = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfigurationDeployContent(branch.Value, Optional.ToNullable(force), serializedAdditionalRawData); + } + + ConfigurationDeployContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationDeployContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationDeployContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationDeployContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationDeployContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationDeployContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationDeployContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.cs index 0c049c58f49a..b2dc1cb8a9ae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationDeployContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Deploy Tenant Configuration Contract. public partial class ConfigurationDeployContent { - /// Initializes a new instance of ConfigurationDeployContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfigurationDeployContent() { } + /// Initializes a new instance of . + /// The name of the Git branch from which the configuration is to be deployed to the configuration database. + /// The value enforcing deleting subscriptions to products that are deleted in this update. + /// Keeps track of any properties unknown to the library. + internal ConfigurationDeployContent(string branch, bool? forceDelete, Dictionary serializedAdditionalRawData) + { + Branch = branch; + ForceDelete = forceDelete; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the Git branch from which the configuration is to be deployed to the configuration database. public string Branch { get; set; } /// The value enforcing deleting subscriptions to products that are deleted in this update. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.Serialization.cs index 99b3ceb06c62..a0d388da0f04 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConfigurationSaveContent : IUtf8JsonSerializable + public partial class ConfigurationSaveContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,7 +36,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(ForceUpdate.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConfigurationSaveContent DeserializeConfigurationSaveContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional branch = default; + Optional force = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("branch"u8)) + { + branch = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("force"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + force = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfigurationSaveContent(branch.Value, Optional.ToNullable(force), serializedAdditionalRawData); + } + + ConfigurationSaveContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationSaveContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationSaveContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationSaveContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationSaveContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationSaveContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationSaveContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.cs index 6d49d8195ca3..29ba086334b1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConfigurationSaveContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Save Tenant Configuration Contract details. public partial class ConfigurationSaveContent { - /// Initializes a new instance of ConfigurationSaveContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfigurationSaveContent() { } + /// Initializes a new instance of . + /// The name of the Git branch in which to commit the current configuration snapshot. + /// The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. + /// Keeps track of any properties unknown to the library. + internal ConfigurationSaveContent(string branch, bool? forceUpdate, Dictionary serializedAdditionalRawData) + { + Branch = branch; + ForceUpdate = forceUpdate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the Git branch in which to commit the current configuration snapshot. public string Branch { get; set; } /// The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.Serialization.cs index 94751dd65e6e..73988cbb685b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.Serialization.cs @@ -5,20 +5,42 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityCheckContent : IUtf8JsonSerializable + public partial class ConnectivityCheckContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } writer.WritePropertyName("destination"u8); - writer.WriteObjectValue(Destination); + if (Destination is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Destination).Serialize(writer, options); + } if (Optional.IsDefined(PreferredIPVersion)) { writer.WritePropertyName("preferredIPVersion"u8); @@ -32,9 +54,138 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProtocolConfiguration)) { writer.WritePropertyName("protocolConfiguration"u8); - writer.WriteObjectValue(ProtocolConfiguration); + if (ProtocolConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProtocolConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ConnectivityCheckContent DeserializeConnectivityCheckContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConnectivityCheckRequestSource source = default; + ConnectivityCheckRequestDestination destination = default; + Optional preferredIPVersion = default; + Optional protocol = default; + Optional protocolConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("source"u8)) + { + source = ConnectivityCheckRequestSource.DeserializeConnectivityCheckRequestSource(property.Value); + continue; + } + if (property.NameEquals("destination"u8)) + { + destination = ConnectivityCheckRequestDestination.DeserializeConnectivityCheckRequestDestination(property.Value); + continue; + } + if (property.NameEquals("preferredIPVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preferredIPVersion = new PreferredIPVersion(property.Value.GetString()); + continue; + } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new ConnectivityCheckProtocol(property.Value.GetString()); + continue; + } + if (property.NameEquals("protocolConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocolConfiguration = ConnectivityCheckRequestProtocolConfiguration.DeserializeConnectivityCheckRequestProtocolConfiguration(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectivityCheckContent(source, destination, Optional.ToNullable(preferredIPVersion), Optional.ToNullable(protocol), protocolConfiguration.Value, serializedAdditionalRawData); + } + + ConnectivityCheckContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityCheckContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityCheckContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityCheckContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityCheckContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityCheckContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityCheckContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.cs index 838ed4cb2641..123003271ab2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// A request to perform the connectivity check operation on a API Management service. public partial class ConnectivityCheckContent { - /// Initializes a new instance of ConnectivityCheckContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Definitions about the connectivity check origin. /// The connectivity check operation destination. /// or is null. @@ -26,6 +30,28 @@ public ConnectivityCheckContent(ConnectivityCheckRequestSource source, Connectiv Destination = destination; } + /// Initializes a new instance of . + /// Definitions about the connectivity check origin. + /// The connectivity check operation destination. + /// The IP version to be used. Only IPv4 is supported for now. + /// The request's protocol. Specific protocol configuration can be available based on this selection. The specified destination address must be coherent with this value. + /// Protocol-specific configuration. + /// Keeps track of any properties unknown to the library. + internal ConnectivityCheckContent(ConnectivityCheckRequestSource source, ConnectivityCheckRequestDestination destination, PreferredIPVersion? preferredIPVersion, ConnectivityCheckProtocol? protocol, ConnectivityCheckRequestProtocolConfiguration protocolConfiguration, Dictionary serializedAdditionalRawData) + { + Source = source; + Destination = destination; + PreferredIPVersion = preferredIPVersion; + Protocol = protocol; + ProtocolConfiguration = protocolConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectivityCheckContent() + { + } + /// Definitions about the connectivity check origin. public ConnectivityCheckRequestSource Source { get; } /// The connectivity check operation destination. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.Serialization.cs index fbcf1a05c445..223dc9ab5596 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityCheckRequestDestination : IUtf8JsonSerializable + public partial class ConnectivityCheckRequestDestination : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("address"u8); writer.WriteStringValue(Address); writer.WritePropertyName("port"u8); writer.WriteNumberValue(Port); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConnectivityCheckRequestDestination DeserializeConnectivityCheckRequestDestination(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string address = default; + long port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("address"u8)) + { + address = property.Value.GetString(); + continue; + } + if (property.NameEquals("port"u8)) + { + port = property.Value.GetInt64(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectivityCheckRequestDestination(address, port, serializedAdditionalRawData); + } + + ConnectivityCheckRequestDestination IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityCheckRequestDestination(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityCheckRequestDestination IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityCheckRequestDestination(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityCheckRequestDestination model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityCheckRequestDestination(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityCheckRequestDestination(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.cs index 7b7874b20682..cbfd9bad664c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestDestination.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The connectivity check operation destination. public partial class ConnectivityCheckRequestDestination { - /// Initializes a new instance of ConnectivityCheckRequestDestination. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Destination address. Can either be an IP address or a FQDN. /// Destination port. /// is null. @@ -25,6 +29,22 @@ public ConnectivityCheckRequestDestination(string address, long port) Port = port; } + /// Initializes a new instance of . + /// Destination address. Can either be an IP address or a FQDN. + /// Destination port. + /// Keeps track of any properties unknown to the library. + internal ConnectivityCheckRequestDestination(string address, long port, Dictionary serializedAdditionalRawData) + { + Address = address; + Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectivityCheckRequestDestination() + { + } + /// Destination address. Can either be an IP address or a FQDN. public string Address { get; } /// Destination port. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.Serialization.cs index 95f14d836439..213481718eb1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityCheckRequestHttpConfiguration : IUtf8JsonSerializable + public partial class ConnectivityCheckRequestHttpConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Method)) { @@ -36,11 +44,138 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Headers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConnectivityCheckRequestHttpConfiguration DeserializeConnectivityCheckRequestHttpConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional method = default; + Optional> validStatusCodes = default; + Optional> headers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + method = new HttpMethodConfiguration(property.Value.GetString()); + continue; + } + if (property.NameEquals("validStatusCodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt64()); + } + validStatusCodes = array; + continue; + } + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HttpHeaderConfiguration.DeserializeHttpHeaderConfiguration(item)); + } + headers = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectivityCheckRequestHttpConfiguration(Optional.ToNullable(method), Optional.ToList(validStatusCodes), Optional.ToList(headers), serializedAdditionalRawData); + } + + ConnectivityCheckRequestHttpConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityCheckRequestHttpConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityCheckRequestHttpConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityCheckRequestHttpConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityCheckRequestHttpConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityCheckRequestHttpConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityCheckRequestHttpConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.cs index d0aa29225d34..06d3800efdb3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestHttpConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,29 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Configuration for HTTP or HTTPS requests. public partial class ConnectivityCheckRequestHttpConfiguration { - /// Initializes a new instance of ConnectivityCheckRequestHttpConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectivityCheckRequestHttpConfiguration() { ValidStatusCodes = new ChangeTrackingList(); Headers = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The HTTP method to be used. + /// List of HTTP status codes considered valid for the request response. + /// List of headers to be included in the request. + /// Keeps track of any properties unknown to the library. + internal ConnectivityCheckRequestHttpConfiguration(HttpMethodConfiguration? method, IList validStatusCodes, IList headers, Dictionary serializedAdditionalRawData) + { + Method = method; + ValidStatusCodes = validStatusCodes; + Headers = headers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The HTTP method to be used. public HttpMethodConfiguration? Method { get; set; } /// List of HTTP status codes considered valid for the request response. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.Serialization.cs index c1a6ba43945e..696f6e9ba683 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ConnectivityCheckRequestProtocolConfiguration : IUtf8JsonSerializable + internal partial class ConnectivityCheckRequestProtocolConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HttpConfiguration)) { writer.WritePropertyName("HTTPConfiguration"u8); - writer.WriteObjectValue(HttpConfiguration); + if (HttpConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HttpConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ConnectivityCheckRequestProtocolConfiguration DeserializeConnectivityCheckRequestProtocolConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional httpConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("HTTPConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpConfiguration = ConnectivityCheckRequestHttpConfiguration.DeserializeConnectivityCheckRequestHttpConfiguration(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectivityCheckRequestProtocolConfiguration(httpConfiguration.Value, serializedAdditionalRawData); + } + + ConnectivityCheckRequestProtocolConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityCheckRequestProtocolConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityCheckRequestProtocolConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityCheckRequestProtocolConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityCheckRequestProtocolConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityCheckRequestProtocolConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityCheckRequestProtocolConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.cs index 18ec7c9adbf0..feafd4d9ec0f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestProtocolConfiguration.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Protocol-specific configuration. internal partial class ConnectivityCheckRequestProtocolConfiguration { - /// Initializes a new instance of ConnectivityCheckRequestProtocolConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectivityCheckRequestProtocolConfiguration() { } + /// Initializes a new instance of . + /// Configuration for HTTP or HTTPS requests. + /// Keeps track of any properties unknown to the library. + internal ConnectivityCheckRequestProtocolConfiguration(ConnectivityCheckRequestHttpConfiguration httpConfiguration, Dictionary serializedAdditionalRawData) + { + HttpConfiguration = httpConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Configuration for HTTP or HTTPS requests. public ConnectivityCheckRequestHttpConfiguration HttpConfiguration { get; set; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.Serialization.cs index 84e906315a6c..8d60c6013206 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityCheckRequestSource : IUtf8JsonSerializable + public partial class ConnectivityCheckRequestSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("region"u8); writer.WriteStringValue(Region); @@ -22,7 +30,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("instance"u8); writer.WriteNumberValue(Instance.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConnectivityCheckRequestSource DeserializeConnectivityCheckRequestSource(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string region = default; + Optional instance = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("instance"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instance = property.Value.GetInt64(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectivityCheckRequestSource(region, Optional.ToNullable(instance), serializedAdditionalRawData); + } + + ConnectivityCheckRequestSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityCheckRequestSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityCheckRequestSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityCheckRequestSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityCheckRequestSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityCheckRequestSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityCheckRequestSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.cs index 518db41aa3d4..6f2861d424e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckRequestSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Definitions about the connectivity check origin. public partial class ConnectivityCheckRequestSource { - /// Initializes a new instance of ConnectivityCheckRequestSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The API Management service region from where to start the connectivity check operation. /// is null. public ConnectivityCheckRequestSource(string region) @@ -23,6 +27,22 @@ public ConnectivityCheckRequestSource(string region) Region = region; } + /// Initializes a new instance of . + /// The API Management service region from where to start the connectivity check operation. + /// The particular VMSS instance from which to fire the request. + /// Keeps track of any properties unknown to the library. + internal ConnectivityCheckRequestSource(string region, long? instance, Dictionary serializedAdditionalRawData) + { + Region = region; + Instance = instance; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectivityCheckRequestSource() + { + } + /// The API Management service region from where to start the connectivity check operation. public string Region { get; } /// The particular VMSS instance from which to fire the request. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.Serialization.cs index b764cb68ccd5..aada9eb8d7d9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityCheckResult + public partial class ConnectivityCheckResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectivityCheckResult DeserializeConnectivityCheckResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectivityCheckResult DeserializeConnectivityCheckResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +53,7 @@ internal static ConnectivityCheckResult DeserializeConnectivityCheckResult(JsonE Optional maxLatencyInMs = default; Optional probesSent = default; Optional probesFailed = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hops"u8)) @@ -96,8 +124,61 @@ internal static ConnectivityCheckResult DeserializeConnectivityCheckResult(JsonE probesFailed = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectivityCheckResult(Optional.ToList(hops), Optional.ToNullable(connectionStatus), Optional.ToNullable(avgLatencyInMs), Optional.ToNullable(minLatencyInMs), Optional.ToNullable(maxLatencyInMs), Optional.ToNullable(probesSent), Optional.ToNullable(probesFailed)); + return new ConnectivityCheckResult(Optional.ToList(hops), Optional.ToNullable(connectionStatus), Optional.ToNullable(avgLatencyInMs), Optional.ToNullable(minLatencyInMs), Optional.ToNullable(maxLatencyInMs), Optional.ToNullable(probesSent), Optional.ToNullable(probesFailed), serializedAdditionalRawData); + } + + ConnectivityCheckResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityCheckResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityCheckResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityCheckResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityCheckResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityCheckResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityCheckResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.cs index 146d601f5fa7..1e089f2d27b6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityCheckResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Information on the connectivity status. public partial class ConnectivityCheckResult { - /// Initializes a new instance of ConnectivityCheckResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectivityCheckResult() { Hops = new ChangeTrackingList(); } - /// Initializes a new instance of ConnectivityCheckResult. + /// Initializes a new instance of . /// List of hops between the source and the destination. /// The connection status. /// Average latency in milliseconds. @@ -27,7 +31,8 @@ internal ConnectivityCheckResult() /// Maximum latency in milliseconds. /// Total number of probes sent. /// Number of failed probes. - internal ConnectivityCheckResult(IReadOnlyList hops, ConnectionStatus? connectionStatus, long? avgLatencyInMs, long? minLatencyInMs, long? maxLatencyInMs, long? probesSent, long? probesFailed) + /// Keeps track of any properties unknown to the library. + internal ConnectivityCheckResult(IReadOnlyList hops, ConnectionStatus? connectionStatus, long? avgLatencyInMs, long? minLatencyInMs, long? maxLatencyInMs, long? probesSent, long? probesFailed, Dictionary serializedAdditionalRawData) { Hops = hops; ConnectionStatus = connectionStatus; @@ -36,6 +41,7 @@ internal ConnectivityCheckResult(IReadOnlyList hops, Connection MaxLatencyInMs = maxLatencyInMs; ProbesSent = probesSent; ProbesFailed = probesFailed; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of hops between the source and the destination. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.Serialization.cs index 6cde20f3a69f..2b72d01c9ba1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityHop + public partial class ConnectivityHop : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +53,7 @@ internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) Optional resourceId = default; Optional> nextHopIds = default; Optional> issues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -84,8 +112,61 @@ internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) issues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectivityHop(type.Value, id.Value, address.Value, resourceId.Value, Optional.ToList(nextHopIds), Optional.ToList(issues)); + return new ConnectivityHop(type.Value, id.Value, address.Value, resourceId.Value, Optional.ToList(nextHopIds), Optional.ToList(issues), serializedAdditionalRawData); + } + + ConnectivityHop IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityHop(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityHop IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityHop(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityHop model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityHop(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityHop(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.cs index 8617ce2bedcd..5a35eba80f73 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityHop.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -14,21 +15,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Information about a hop between the source and the destination. public partial class ConnectivityHop { - /// Initializes a new instance of ConnectivityHop. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectivityHop() { NextHopIds = new ChangeTrackingList(); Issues = new ChangeTrackingList(); } - /// Initializes a new instance of ConnectivityHop. + /// Initializes a new instance of . /// The type of the hop. /// The ID of the hop. /// The IP address of the hop. /// The ID of the resource corresponding to this hop. /// List of next hop identifiers. /// List of issues. - internal ConnectivityHop(string connectivityHopType, string id, IPAddress address, ResourceIdentifier resourceId, IReadOnlyList nextHopIds, IReadOnlyList issues) + /// Keeps track of any properties unknown to the library. + internal ConnectivityHop(string connectivityHopType, string id, IPAddress address, ResourceIdentifier resourceId, IReadOnlyList nextHopIds, IReadOnlyList issues, Dictionary serializedAdditionalRawData) { ConnectivityHopType = connectivityHopType; Id = id; @@ -36,6 +41,7 @@ internal ConnectivityHop(string connectivityHopType, string id, IPAddress addres ResourceId = resourceId; NextHopIds = nextHopIds; Issues = issues; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the hop. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.Serialization.cs index 5bb3eb56fce6..97469429d851 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityIssue + public partial class ConnectivityIssue : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectivityIssue DeserializeConnectivityIssue(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectivityIssue DeserializeConnectivityIssue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static ConnectivityIssue DeserializeConnectivityIssue(JsonElement eleme Optional severity = default; Optional type = default; Optional>> context = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("origin"u8)) @@ -78,8 +106,61 @@ internal static ConnectivityIssue DeserializeConnectivityIssue(JsonElement eleme context = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectivityIssue(Optional.ToNullable(origin), Optional.ToNullable(severity), Optional.ToNullable(type), Optional.ToList(context)); + return new ConnectivityIssue(Optional.ToNullable(origin), Optional.ToNullable(severity), Optional.ToNullable(type), Optional.ToList(context), serializedAdditionalRawData); + } + + ConnectivityIssue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityIssue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityIssue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityIssue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityIssue model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityIssue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityIssue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.cs index c654dbd896fc..d3adfd5fdcc1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityIssue.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Information about an issue encountered in the process of checking for connectivity. public partial class ConnectivityIssue { - /// Initializes a new instance of ConnectivityIssue. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectivityIssue() { Context = new ChangeTrackingList>(); } - /// Initializes a new instance of ConnectivityIssue. + /// Initializes a new instance of . /// The origin of the issue. /// The severity of the issue. /// The type of issue. /// Provides additional context on the issue. - internal ConnectivityIssue(IssueOrigin? origin, IssueSeverity? severity, IssueType? issueType, IReadOnlyList> context) + /// Keeps track of any properties unknown to the library. + internal ConnectivityIssue(IssueOrigin? origin, IssueSeverity? severity, IssueType? issueType, IReadOnlyList> context, Dictionary serializedAdditionalRawData) { Origin = origin; Severity = severity; IssueType = issueType; Context = context; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The origin of the issue. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.Serialization.cs index 7adac08eef37..b04937cfe6ca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.Serialization.cs @@ -6,15 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ConnectivityStatusContract + public partial class ConnectivityStatusContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectivityStatusContract DeserializeConnectivityStatusContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteStringValue(Error); + } + writer.WritePropertyName("lastUpdated"u8); + writer.WriteStringValue(LastUpdatedOn, "O"); + writer.WritePropertyName("lastStatusChange"u8); + writer.WriteStringValue(LastStatusChangedOn, "O"); + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + writer.WritePropertyName("isOptional"u8); + writer.WriteBooleanValue(IsOptional); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectivityStatusContract DeserializeConnectivityStatusContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +70,7 @@ internal static ConnectivityStatusContract DeserializeConnectivityStatusContract DateTimeOffset lastStatusChange = default; string resourceType = default; bool isOptional = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +108,61 @@ internal static ConnectivityStatusContract DeserializeConnectivityStatusContract isOptional = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectivityStatusContract(name, status, error.Value, lastUpdated, lastStatusChange, resourceType, isOptional); + return new ConnectivityStatusContract(name, status, error.Value, lastUpdated, lastStatusChange, resourceType, isOptional, serializedAdditionalRawData); + } + + ConnectivityStatusContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivityStatusContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectivityStatusContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectivityStatusContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectivityStatusContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectivityStatusContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectivityStatusContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs index 98c6e668c483..4b84bc5af585 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Details about connectivity to a resource. public partial class ConnectivityStatusContract { - /// Initializes a new instance of ConnectivityStatusContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. /// Resource Connectivity Status Type identifier. /// @@ -40,7 +44,7 @@ internal ConnectivityStatusContract(string name, ConnectivityStatusType status, IsOptional = isOptional; } - /// Initializes a new instance of ConnectivityStatusContract. + /// Initializes a new instance of . /// The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. /// Resource Connectivity Status Type identifier. /// Error details of the connectivity to the resource. @@ -54,7 +58,8 @@ internal ConnectivityStatusContract(string name, ConnectivityStatusType status, /// /// Resource Type. /// Whether this is optional. - internal ConnectivityStatusContract(string name, ConnectivityStatusType status, string error, DateTimeOffset lastUpdatedOn, DateTimeOffset lastStatusChangedOn, string resourceType, bool isOptional) + /// Keeps track of any properties unknown to the library. + internal ConnectivityStatusContract(string name, ConnectivityStatusType status, string error, DateTimeOffset lastUpdatedOn, DateTimeOffset lastStatusChangedOn, string resourceType, bool isOptional, Dictionary serializedAdditionalRawData) { Name = name; Status = status; @@ -63,6 +68,12 @@ internal ConnectivityStatusContract(string name, ConnectivityStatusType status, LastStatusChangedOn = lastStatusChangedOn; ResourceType = resourceType; IsOptional = isOptional; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectivityStatusContract() + { } /// The hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.Serialization.cs index 3c044204e6e5..8f6a6f7966a3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ContentItemListResult + internal partial class ContentItemListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContentItemListResult DeserializeContentItemListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContentItemListResult DeserializeContentItemListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static ContentItemListResult DeserializeContentItemListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContentItemListResult(Optional.ToList(value), nextLink.Value); + return new ContentItemListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContentItemListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContentItemListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContentItemListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContentItemListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContentItemListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContentItemListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContentItemListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.cs index 3a018660d312..63e39a967a2b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentItemListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged list of content items. internal partial class ContentItemListResult { - /// Initializes a new instance of ContentItemListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContentItemListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContentItemListResult. + /// Initializes a new instance of . /// Collection of content items. /// Next page link, if any. - internal ContentItemListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContentItemListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of content items. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.Serialization.cs index 32cd8159cef6..38a0cae1597f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ContentTypeListResult + internal partial class ContentTypeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContentTypeListResult DeserializeContentTypeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContentTypeListResult DeserializeContentTypeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static ContentTypeListResult DeserializeContentTypeListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContentTypeListResult(Optional.ToList(value), nextLink.Value); + return new ContentTypeListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContentTypeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContentTypeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContentTypeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContentTypeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContentTypeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContentTypeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContentTypeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.cs index b68ff15941b2..d0fbf99bc85e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ContentTypeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged list of content types. internal partial class ContentTypeListResult { - /// Initializes a new instance of ContentTypeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContentTypeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContentTypeListResult. + /// Initializes a new instance of . /// Collection of content types. /// Next page link, if any. - internal ContentTypeListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContentTypeListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of content types. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.Serialization.cs index 0e7aef63c876..1ae13b70f010 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class DataMasking : IUtf8JsonSerializable + public partial class DataMasking : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(QueryParams)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in QueryParams) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,21 +46,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Headers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataMasking DeserializeDataMasking(JsonElement element) + internal static DataMasking DeserializeDataMasking(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> queryParams = default; Optional> headers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queryParams"u8)) @@ -77,8 +113,61 @@ internal static DataMasking DeserializeDataMasking(JsonElement element) headers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataMasking(Optional.ToList(queryParams), Optional.ToList(headers), serializedAdditionalRawData); + } + + DataMasking IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataMasking(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataMasking IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataMasking(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataMasking model) + { + if (model is null) + { + return null; } - return new DataMasking(Optional.ToList(queryParams), Optional.ToList(headers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataMasking(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataMasking(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.cs index a27479865577..a6a7d78d0f26 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMasking.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The DataMasking. public partial class DataMasking { - /// Initializes a new instance of DataMasking. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataMasking() { QueryParams = new ChangeTrackingList(); Headers = new ChangeTrackingList(); } - /// Initializes a new instance of DataMasking. + /// Initializes a new instance of . /// Masking settings for Url query parameters. /// Masking settings for headers. - internal DataMasking(IList queryParams, IList headers) + /// Keeps track of any properties unknown to the library. + internal DataMasking(IList queryParams, IList headers, Dictionary serializedAdditionalRawData) { QueryParams = queryParams; Headers = headers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Masking settings for Url query parameters. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.Serialization.cs index 811cdcf09b21..5312eb1eae52 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class DataMaskingEntity : IUtf8JsonSerializable + public partial class DataMaskingEntity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Value)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mode"u8); writer.WriteStringValue(Mode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataMaskingEntity DeserializeDataMaskingEntity(JsonElement element) + internal static DataMaskingEntity DeserializeDataMaskingEntity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional mode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +75,61 @@ internal static DataMaskingEntity DeserializeDataMaskingEntity(JsonElement eleme mode = new DataMaskingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataMaskingEntity(value.Value, Optional.ToNullable(mode), serializedAdditionalRawData); + } + + DataMaskingEntity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataMaskingEntity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataMaskingEntity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataMaskingEntity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataMaskingEntity model) + { + if (model is null) + { + return null; } - return new DataMaskingEntity(value.Value, Optional.ToNullable(mode)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataMaskingEntity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataMaskingEntity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.cs index a9f4634e08c5..c45e3054036d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DataMaskingEntity.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// The DataMaskingEntity. public partial class DataMaskingEntity { - /// Initializes a new instance of DataMaskingEntity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataMaskingEntity() { } - /// Initializes a new instance of DataMaskingEntity. + /// Initializes a new instance of . /// The name of an entity to mask (e.g. a name of a header or a query parameter). /// Data masking mode. - internal DataMaskingEntity(string value, DataMaskingMode? mode) + /// Keeps track of any properties unknown to the library. + internal DataMaskingEntity(string value, DataMaskingMode? mode, Dictionary serializedAdditionalRawData) { Value = value; Mode = mode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of an entity to mask (e.g. a name of a header or a query parameter). diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.Serialization.cs index c8b7a33fcc27..a95483ba21c9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class DeletedServicesListResult + internal partial class DeletedServicesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeletedServicesListResult DeserializeDeletedServicesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeletedServicesListResult DeserializeDeletedServicesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static DeletedServicesListResult DeserializeDeletedServicesListResult(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeletedServicesListResult(Optional.ToList(value), nextLink.Value); + return new DeletedServicesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DeletedServicesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeletedServicesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeletedServicesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeletedServicesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeletedServicesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeletedServicesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeletedServicesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.cs index 035d7cd91cc5..c5ecec61747b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DeletedServicesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged deleted API Management Services List Representation. internal partial class DeletedServicesListResult { - /// Initializes a new instance of DeletedServicesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeletedServicesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DeletedServicesListResult. + /// Initializes a new instance of . /// Page values. /// Next page link if any. - internal DeletedServicesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DeletedServicesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticContractData.Serialization.cs index 4df955b0373a..abc0914ed2d2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticContractData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class DiagnosticContractData : IUtf8JsonSerializable + public partial class DiagnosticContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -32,17 +40,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sampling)) { writer.WritePropertyName("sampling"u8); - writer.WriteObjectValue(Sampling); + if (Sampling is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sampling).Serialize(writer, options); + } } if (Optional.IsDefined(Frontend)) { writer.WritePropertyName("frontend"u8); - writer.WriteObjectValue(Frontend); + if (Frontend is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Frontend).Serialize(writer, options); + } } if (Optional.IsDefined(Backend)) { writer.WritePropertyName("backend"u8); - writer.WriteObjectValue(Backend); + if (Backend is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Backend).Serialize(writer, options); + } } if (Optional.IsDefined(IsLogClientIPEnabled)) { @@ -70,11 +99,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(Metrics.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiagnosticContractData DeserializeDiagnosticContractData(JsonElement element) + internal static DiagnosticContractData DeserializeDiagnosticContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,6 +136,7 @@ internal static DiagnosticContractData DeserializeDiagnosticContractData(JsonEle Optional verbosity = default; Optional operationNameFormat = default; Optional metrics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -217,8 +261,61 @@ internal static DiagnosticContractData DeserializeDiagnosticContractData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiagnosticContractData(id, name, type, systemData.Value, Optional.ToNullable(alwaysLog), loggerId.Value, sampling.Value, frontend.Value, backend.Value, Optional.ToNullable(logClientIP), Optional.ToNullable(httpCorrelationProtocol), Optional.ToNullable(verbosity), Optional.ToNullable(operationNameFormat), Optional.ToNullable(metrics), serializedAdditionalRawData); + } + + DiagnosticContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticContractData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticContractData(Response response) + { + if (response is null) + { + return null; } - return new DiagnosticContractData(id, name, type, systemData.Value, Optional.ToNullable(alwaysLog), loggerId.Value, sampling.Value, frontend.Value, backend.Value, Optional.ToNullable(logClientIP), Optional.ToNullable(httpCorrelationProtocol), Optional.ToNullable(verbosity), Optional.ToNullable(operationNameFormat), Optional.ToNullable(metrics)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.Serialization.cs index ad064b82e30e..42e6dfe3c619 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class DiagnosticListResult + internal partial class DiagnosticListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiagnosticListResult DeserializeDiagnosticListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiagnosticListResult DeserializeDiagnosticListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static DiagnosticListResult DeserializeDiagnosticListResult(JsonElement Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static DiagnosticListResult DeserializeDiagnosticListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiagnosticListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new DiagnosticListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + DiagnosticListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.cs index 1de5e91d9bd4..be5bcfe4de15 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DiagnosticListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Diagnostic list representation. internal partial class DiagnosticListResult { - /// Initializes a new instance of DiagnosticListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DiagnosticListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DiagnosticListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal DiagnosticListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DiagnosticListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.Serialization.cs index ba2de9377633..966d2e9a210a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class EmailTemplateListResult + internal partial class EmailTemplateListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EmailTemplateListResult DeserializeEmailTemplateListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EmailTemplateListResult DeserializeEmailTemplateListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static EmailTemplateListResult DeserializeEmailTemplateListResult(JsonE Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static EmailTemplateListResult DeserializeEmailTemplateListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EmailTemplateListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new EmailTemplateListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + EmailTemplateListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailTemplateListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailTemplateListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailTemplateListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailTemplateListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailTemplateListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailTemplateListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.cs index df66b08d34e9..2c125c9bb7f2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged email template list representation. internal partial class EmailTemplateListResult { - /// Initializes a new instance of EmailTemplateListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EmailTemplateListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of EmailTemplateListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal EmailTemplateListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal EmailTemplateListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.Serialization.cs index 4d3e93eeacda..69b007efc317 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class EmailTemplateParametersContractProperties : IUtf8JsonSerializable + public partial class EmailTemplateParametersContractProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EmailTemplateParametersContractProperties DeserializeEmailTemplateParametersContractProperties(JsonElement element) + internal static EmailTemplateParametersContractProperties DeserializeEmailTemplateParametersContractProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static EmailTemplateParametersContractProperties DeserializeEmailTempla Optional name = default; Optional title = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +82,61 @@ internal static EmailTemplateParametersContractProperties DeserializeEmailTempla description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailTemplateParametersContractProperties(name.Value, title.Value, description.Value, serializedAdditionalRawData); + } + + EmailTemplateParametersContractProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailTemplateParametersContractProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailTemplateParametersContractProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailTemplateParametersContractProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailTemplateParametersContractProperties model) + { + if (model is null) + { + return null; } - return new EmailTemplateParametersContractProperties(name.Value, title.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailTemplateParametersContractProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailTemplateParametersContractProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs index 1607a14167b0..8898e506b7bd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Email Template Parameter contract. public partial class EmailTemplateParametersContractProperties { - /// Initializes a new instance of EmailTemplateParametersContractProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EmailTemplateParametersContractProperties() { } - /// Initializes a new instance of EmailTemplateParametersContractProperties. + /// Initializes a new instance of . /// Template parameter name. /// Template parameter title. /// Template parameter description. - internal EmailTemplateParametersContractProperties(string name, string title, string description) + /// Keeps track of any properties unknown to the library. + internal EmailTemplateParametersContractProperties(string name, string title, string description, Dictionary serializedAdditionalRawData) { Name = name; Title = title; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Template parameter name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.Serialization.cs index 99e2df71f287..4f3bed5a28b3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class EndpointDependency + public partial class EndpointDependency : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EndpointDependency DeserializeEndpointDependency(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DomainName)) + { + writer.WritePropertyName("domainName"u8); + writer.WriteStringValue(DomainName); + } + if (Optional.IsCollectionDefined(EndpointDetails)) + { + writer.WritePropertyName("endpointDetails"u8); + writer.WriteStartArray(); + foreach (var item in EndpointDetails) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EndpointDependency DeserializeEndpointDependency(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional domainName = default; Optional> endpointDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainName"u8)) @@ -42,8 +92,61 @@ internal static EndpointDependency DeserializeEndpointDependency(JsonElement ele endpointDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EndpointDependency(domainName.Value, Optional.ToList(endpointDetails)); + return new EndpointDependency(domainName.Value, Optional.ToList(endpointDetails), serializedAdditionalRawData); + } + + EndpointDependency IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointDependency(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointDependency IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointDependency(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointDependency model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointDependency(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointDependency(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.cs index 01c9092e4cb9..71f4adb8b1a2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDependency.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// A domain name that a service is reached at. public partial class EndpointDependency { - /// Initializes a new instance of EndpointDependency. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EndpointDependency() { EndpointDetails = new ChangeTrackingList(); } - /// Initializes a new instance of EndpointDependency. + /// Initializes a new instance of . /// The domain name of the dependency. /// The Ports used when connecting to DomainName. - internal EndpointDependency(string domainName, IReadOnlyList endpointDetails) + /// Keeps track of any properties unknown to the library. + internal EndpointDependency(string domainName, IReadOnlyList endpointDetails, Dictionary serializedAdditionalRawData) { DomainName = domainName; EndpointDetails = endpointDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The domain name of the dependency. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.Serialization.cs index 08d4255f52bf..ac3f8dbfd667 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class EndpointDetail + public partial class EndpointDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EndpointDetail DeserializeEndpointDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EndpointDetail DeserializeEndpointDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional port = default; Optional region = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("port"u8)) @@ -36,8 +75,61 @@ internal static EndpointDetail DeserializeEndpointDetail(JsonElement element) region = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EndpointDetail(Optional.ToNullable(port), region.Value); + return new EndpointDetail(Optional.ToNullable(port), region.Value, serializedAdditionalRawData); + } + + EndpointDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.cs index 4eeaa8f8c271..884eb3598f73 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/EndpointDetail.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Current TCP connectivity information from the Api Management Service to a single endpoint. public partial class EndpointDetail { - /// Initializes a new instance of EndpointDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EndpointDetail() { } - /// Initializes a new instance of EndpointDetail. + /// Initializes a new instance of . /// The port an endpoint is connected to. /// The region of the dependency. - internal EndpointDetail(int? port, string region) + /// Keeps track of any properties unknown to the library. + internal EndpointDetail(int? port, string region, Dictionary serializedAdditionalRawData) { Port = port; Region = region; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The port an endpoint is connected to. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.Serialization.cs index 6e2b4e93de13..f6003d8842fd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ErrorFieldContract : IUtf8JsonSerializable + public partial class ErrorFieldContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("target"u8); writer.WriteStringValue(Target); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ErrorFieldContract DeserializeErrorFieldContract(JsonElement element) + internal static ErrorFieldContract DeserializeErrorFieldContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ErrorFieldContract DeserializeErrorFieldContract(JsonElement ele Optional code = default; Optional message = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -59,8 +82,61 @@ internal static ErrorFieldContract DeserializeErrorFieldContract(JsonElement ele target = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ErrorFieldContract(code.Value, message.Value, target.Value, serializedAdditionalRawData); + } + + ErrorFieldContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorFieldContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorFieldContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorFieldContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorFieldContract model) + { + if (model is null) + { + return null; } - return new ErrorFieldContract(code.Value, message.Value, target.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorFieldContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorFieldContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.cs index 0a836ac854be..ed378b3f88a3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorFieldContract.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Error Field contract. public partial class ErrorFieldContract { - /// Initializes a new instance of ErrorFieldContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ErrorFieldContract() { } - /// Initializes a new instance of ErrorFieldContract. + /// Initializes a new instance of . /// Property level error code. /// Human-readable representation of property-level error. /// Property name. - internal ErrorFieldContract(string code, string message, string target) + /// Keeps track of any properties unknown to the library. + internal ErrorFieldContract(string code, string message, string target, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Property level error code. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.Serialization.cs index 908309cd70a3..b78c11f999d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ErrorResponseBody : IUtf8JsonSerializable + public partial class ErrorResponseBody : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -32,15 +39,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Details) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ErrorResponseBody DeserializeErrorResponseBody(JsonElement element) + internal static ErrorResponseBody DeserializeErrorResponseBody(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static ErrorResponseBody DeserializeErrorResponseBody(JsonElement eleme Optional code = default; Optional message = default; Optional> details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -74,8 +103,61 @@ internal static ErrorResponseBody DeserializeErrorResponseBody(JsonElement eleme details = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ErrorResponseBody(code.Value, message.Value, Optional.ToList(details), serializedAdditionalRawData); + } + + ErrorResponseBody IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponseBody(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorResponseBody IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorResponseBody(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorResponseBody model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorResponseBody(Response response) + { + if (response is null) + { + return null; } - return new ErrorResponseBody(code.Value, message.Value, Optional.ToList(details)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorResponseBody(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.cs index f9d82ba5713e..62c968dd0816 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ErrorResponseBody.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Error Body contract. public partial class ErrorResponseBody { - /// Initializes a new instance of ErrorResponseBody. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ErrorResponseBody() { Details = new ChangeTrackingList(); } - /// Initializes a new instance of ErrorResponseBody. + /// Initializes a new instance of . /// Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. /// Human-readable representation of the error. /// The list of invalid fields send in request, in case of validation error. - internal ErrorResponseBody(string code, string message, IList details) + /// Keeps track of any properties unknown to the library. + internal ErrorResponseBody(string code, string message, IList details, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs index 75ec88798375..9b530f2c1483 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GatewayApiData : IUtf8JsonSerializable + public partial class GatewayApiData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,12 +34,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationSettings)) { writer.WritePropertyName("authenticationSettings"u8); - writer.WriteObjectValue(AuthenticationSettings); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } } if (Optional.IsDefined(SubscriptionKeyParameterNames)) { writer.WritePropertyName("subscriptionKeyParameterNames"u8); - writer.WriteObjectValue(SubscriptionKeyParameterNames); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } } if (Optional.IsDefined(ApiType)) { @@ -83,12 +103,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Contact)) { writer.WritePropertyName("contact"u8); - writer.WriteObjectValue(Contact); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } } if (Optional.IsDefined(License)) { writer.WritePropertyName("license"u8); - writer.WriteObjectValue(License); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } } if (Optional.IsDefined(SourceApiId)) { @@ -123,14 +157,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiVersionSet)) { writer.WritePropertyName("apiVersionSet"u8); - writer.WriteObjectValue(ApiVersionSet); + if (ApiVersionSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiVersionSet).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GatewayApiData DeserializeGatewayApiData(JsonElement element) + internal static GatewayApiData DeserializeGatewayApiData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -160,6 +215,7 @@ internal static GatewayApiData DeserializeGatewayApiData(JsonElement element) Optional path = default; Optional> protocols = default; Optional apiVersionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -364,8 +420,61 @@ internal static GatewayApiData DeserializeGatewayApiData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GatewayApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, serializedAdditionalRawData); + } + + GatewayApiData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayApiData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayApiData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayApiData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayApiData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayApiData(Response response) + { + if (response is null) + { + return null; } - return new GatewayApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayApiData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs index f4f4db3b76c6..427562b1c882 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayApiData.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The GatewayApiData. public partial class GatewayApiData : ResourceData { - /// Initializes a new instance of GatewayApiData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GatewayApiData() { Protocols = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayApiData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +50,8 @@ public GatewayApiData() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. - internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -70,6 +74,7 @@ internal GatewayApiData(ResourceIdentifier id, string name, ResourceType resourc Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the API. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.Serialization.cs index 00af0e8ecc77..0aa226bc55e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class GatewayCertificateAuthorityListResult + internal partial class GatewayCertificateAuthorityListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayCertificateAuthorityListResult DeserializeGatewayCertificateAuthorityListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayCertificateAuthorityListResult DeserializeGatewayCertificateAuthorityListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static GatewayCertificateAuthorityListResult DeserializeGatewayCertific nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayCertificateAuthorityListResult(Optional.ToList(value), nextLink.Value); + return new GatewayCertificateAuthorityListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + GatewayCertificateAuthorityListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayCertificateAuthorityListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayCertificateAuthorityListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayCertificateAuthorityListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayCertificateAuthorityListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayCertificateAuthorityListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayCertificateAuthorityListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.cs index e0a0c932f2e0..d92a5e33235e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayCertificateAuthorityListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Gateway certificate authority list representation. internal partial class GatewayCertificateAuthorityListResult { - /// Initializes a new instance of GatewayCertificateAuthorityListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayCertificateAuthorityListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayCertificateAuthorityListResult. + /// Initializes a new instance of . /// Page values. /// Next page link if any. - internal GatewayCertificateAuthorityListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GatewayCertificateAuthorityListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.Serialization.cs index e8b21c54db47..b88de4baba24 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class GatewayHostnameConfigurationListResult + internal partial class GatewayHostnameConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayHostnameConfigurationListResult DeserializeGatewayHostnameConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayHostnameConfigurationListResult DeserializeGatewayHostnameConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static GatewayHostnameConfigurationListResult DeserializeGatewayHostnam nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayHostnameConfigurationListResult(Optional.ToList(value), nextLink.Value); + return new GatewayHostnameConfigurationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + GatewayHostnameConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayHostnameConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayHostnameConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayHostnameConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayHostnameConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayHostnameConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayHostnameConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.cs index ad3c73d72886..390de984e1d4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Gateway hostname configuration list representation. internal partial class GatewayHostnameConfigurationListResult { - /// Initializes a new instance of GatewayHostnameConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayHostnameConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayHostnameConfigurationListResult. + /// Initializes a new instance of . /// Page values. /// Next page link if any. - internal GatewayHostnameConfigurationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GatewayHostnameConfigurationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.Serialization.cs index fec9f4e07ca3..fc3d494075da 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GatewayKeyRegenerateContent : IUtf8JsonSerializable + public partial class GatewayKeyRegenerateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyType"u8); writer.WriteStringValue(KeyType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GatewayKeyRegenerateContent DeserializeGatewayKeyRegenerateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GatewayRegenerateKeyType keyType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyType"u8)) + { + keyType = property.Value.GetString().ToGatewayRegenerateKeyType(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GatewayKeyRegenerateContent(keyType, serializedAdditionalRawData); + } + + GatewayKeyRegenerateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayKeyRegenerateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayKeyRegenerateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayKeyRegenerateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayKeyRegenerateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayKeyRegenerateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayKeyRegenerateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.cs index 354c2c0b6436..af751a53d847 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeyRegenerateContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Gateway key regeneration request contract properties. public partial class GatewayKeyRegenerateContent { - /// Initializes a new instance of GatewayKeyRegenerateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Key being regenerated. public GatewayKeyRegenerateContent(GatewayRegenerateKeyType keyType) { KeyType = keyType; } + /// Initializes a new instance of . + /// The Key being regenerated. + /// Keeps track of any properties unknown to the library. + internal GatewayKeyRegenerateContent(GatewayRegenerateKeyType keyType, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GatewayKeyRegenerateContent() + { + } + /// The Key being regenerated. public GatewayRegenerateKeyType KeyType { get; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.Serialization.cs index 06cf668decfd..16c8a3f31a6e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GatewayKeysContract + public partial class GatewayKeysContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayKeysContract DeserializeGatewayKeysContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Primary)) + { + writer.WritePropertyName("primary"u8); + writer.WriteStringValue(Primary); + } + if (Optional.IsDefined(Secondary)) + { + writer.WritePropertyName("secondary"u8); + writer.WriteStringValue(Secondary); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayKeysContract DeserializeGatewayKeysContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional primary = default; Optional secondary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primary"u8)) @@ -32,8 +71,61 @@ internal static GatewayKeysContract DeserializeGatewayKeysContract(JsonElement e secondary = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayKeysContract(primary.Value, secondary.Value); + return new GatewayKeysContract(primary.Value, secondary.Value, serializedAdditionalRawData); + } + + GatewayKeysContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayKeysContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayKeysContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayKeysContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayKeysContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayKeysContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayKeysContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.cs index b0d06d664829..ed2a7916635e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayKeysContract.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Gateway authentication keys. public partial class GatewayKeysContract { - /// Initializes a new instance of GatewayKeysContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayKeysContract() { } - /// Initializes a new instance of GatewayKeysContract. + /// Initializes a new instance of . /// Primary gateway key. /// Secondary gateway key. - internal GatewayKeysContract(string primary, string secondary) + /// Keeps track of any properties unknown to the library. + internal GatewayKeysContract(string primary, string secondary, Dictionary serializedAdditionalRawData) { Primary = primary; Secondary = secondary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Primary gateway key. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.Serialization.cs index 89ce03eae2c4..74695f9d9b16 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class GatewayListResult + internal partial class GatewayListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayListResult DeserializeGatewayListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayListResult DeserializeGatewayListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static GatewayListResult DeserializeGatewayListResult(JsonElement eleme Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static GatewayListResult DeserializeGatewayListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new GatewayListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + GatewayListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.cs index 380a36ce3ca5..868fd35dfc47 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Gateway list representation. internal partial class GatewayListResult { - /// Initializes a new instance of GatewayListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal GatewayListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GatewayListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.Serialization.cs index f461da816bcd..cf5591034d3b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GatewayTokenContract + public partial class GatewayTokenContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayTokenContract DeserializeGatewayTokenContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayTokenContract DeserializeGatewayTokenContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -26,8 +60,61 @@ internal static GatewayTokenContract DeserializeGatewayTokenContract(JsonElement value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayTokenContract(value.Value); + return new GatewayTokenContract(value.Value, serializedAdditionalRawData); + } + + GatewayTokenContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayTokenContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayTokenContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayTokenContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayTokenContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayTokenContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayTokenContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.cs index 2818784e0880..d3c5c6dd84fa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenContract.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Gateway access token. public partial class GatewayTokenContract { - /// Initializes a new instance of GatewayTokenContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayTokenContract() { } - /// Initializes a new instance of GatewayTokenContract. + /// Initializes a new instance of . /// Shared Access Authentication token value for the Gateway. - internal GatewayTokenContract(string value) + /// Keeps track of any properties unknown to the library. + internal GatewayTokenContract(string value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Shared Access Authentication token value for the Gateway. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.Serialization.cs index c675bd291f69..61b8b067dde6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GatewayTokenRequestContract : IUtf8JsonSerializable + public partial class GatewayTokenRequestContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyType"u8); writer.WriteStringValue(KeyType.ToSerialString()); writer.WritePropertyName("expiry"u8); writer.WriteStringValue(Expiry, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GatewayTokenRequestContract DeserializeGatewayTokenRequestContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TokenGenerationUsedKeyType keyType = default; + DateTimeOffset expiry = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyType"u8)) + { + keyType = property.Value.GetString().ToTokenGenerationUsedKeyType(); + continue; + } + if (property.NameEquals("expiry"u8)) + { + expiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GatewayTokenRequestContract(keyType, expiry, serializedAdditionalRawData); + } + + GatewayTokenRequestContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayTokenRequestContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayTokenRequestContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayTokenRequestContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayTokenRequestContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayTokenRequestContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayTokenRequestContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.cs index f8d22d591045..94d8d27039f2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GatewayTokenRequestContract.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Gateway token request contract properties. public partial class GatewayTokenRequestContract { - /// Initializes a new instance of GatewayTokenRequestContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Key to be used to generate gateway token. /// /// The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. @@ -24,6 +28,25 @@ public GatewayTokenRequestContract(TokenGenerationUsedKeyType keyType, DateTimeO Expiry = expiry; } + /// Initializes a new instance of . + /// The Key to be used to generate gateway token. + /// + /// The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + /// + /// + /// Keeps track of any properties unknown to the library. + internal GatewayTokenRequestContract(TokenGenerationUsedKeyType keyType, DateTimeOffset expiry, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + Expiry = expiry; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GatewayTokenRequestContract() + { + } + /// The Key to be used to generate gateway token. public TokenGenerationUsedKeyType KeyType { get; } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.Serialization.cs index b84fdb35b8e2..6289cb8ca824 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GenerateSsoUriResult + public partial class GenerateSsoUriResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GenerateSsoUriResult DeserializeGenerateSsoUriResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GenerateSsoUriResult DeserializeGenerateSsoUriResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -26,8 +60,61 @@ internal static GenerateSsoUriResult DeserializeGenerateSsoUriResult(JsonElement value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GenerateSsoUriResult(value.Value); + return new GenerateSsoUriResult(value.Value, serializedAdditionalRawData); + } + + GenerateSsoUriResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGenerateSsoUriResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GenerateSsoUriResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGenerateSsoUriResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GenerateSsoUriResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GenerateSsoUriResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGenerateSsoUriResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.cs index 1a2ac4b1f525..884156883c7a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GenerateSsoUriResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Generate SSO Url operations response details. public partial class GenerateSsoUriResult { - /// Initializes a new instance of GenerateSsoUriResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GenerateSsoUriResult() { } - /// Initializes a new instance of GenerateSsoUriResult. + /// Initializes a new instance of . /// Redirect Url containing the SSO URL value. - internal GenerateSsoUriResult(string value) + /// Keeps track of any properties unknown to the library. + internal GenerateSsoUriResult(string value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Redirect Url containing the SSO URL value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.Serialization.cs index 2e74fbc9ba04..e1b657b80489 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GitOperationResultContractData : IUtf8JsonSerializable + public partial class GitOperationResultContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -48,14 +54,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GitOperationResultContractData DeserializeGitOperationResultContractData(JsonElement element) + internal static GitOperationResultContractData DeserializeGitOperationResultContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +98,7 @@ internal static GitOperationResultContractData DeserializeGitOperationResultCont Optional resultInfo = default; Optional error = default; Optional> actionLog = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -169,8 +197,61 @@ internal static GitOperationResultContractData DeserializeGitOperationResultCont } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GitOperationResultContractData(id, name, type, systemData.Value, id0.Value, Optional.ToNullable(status), Optional.ToNullable(started), Optional.ToNullable(updated), resultInfo.Value, error.Value, Optional.ToList(actionLog), serializedAdditionalRawData); + } + + GitOperationResultContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGitOperationResultContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GitOperationResultContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGitOperationResultContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GitOperationResultContractData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GitOperationResultContractData(Response response) + { + if (response is null) + { + return null; } - return new GitOperationResultContractData(id, name, type, systemData.Value, id0.Value, Optional.ToNullable(status), Optional.ToNullable(started), Optional.ToNullable(updated), resultInfo.Value, error.Value, Optional.ToList(actionLog)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGitOperationResultContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.cs index 8a222e5e85c6..ca1965f8333f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GitOperationResultContractData.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Long Running Git Operation Results. public partial class GitOperationResultContractData : ResourceData { - /// Initializes a new instance of GitOperationResultContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GitOperationResultContractData() { ActionLog = new ChangeTrackingList(); } - /// Initializes a new instance of GitOperationResultContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +42,8 @@ public GitOperationResultContractData() /// Optional result info. /// Error Body Contract. /// This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. - internal GitOperationResultContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string operationResultIdentifier, AsyncOperationStatus? status, DateTimeOffset? startedOn, DateTimeOffset? updatedOn, string resultInfo, ErrorResponseBody error, IReadOnlyList actionLog) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal GitOperationResultContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string operationResultIdentifier, AsyncOperationStatus? status, DateTimeOffset? startedOn, DateTimeOffset? updatedOn, string resultInfo, ErrorResponseBody error, IReadOnlyList actionLog, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OperationResultIdentifier = operationResultIdentifier; Status = status; @@ -48,6 +52,7 @@ internal GitOperationResultContractData(ResourceIdentifier id, string name, Reso ResultInfo = resultInfo; Error = error; ActionLog = actionLog; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Operation result identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.Serialization.cs index 12b761970001..ea4e7e08b377 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class GlobalSchemaListResult + internal partial class GlobalSchemaListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GlobalSchemaListResult DeserializeGlobalSchemaListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GlobalSchemaListResult DeserializeGlobalSchemaListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static GlobalSchemaListResult DeserializeGlobalSchemaListResult(JsonEle Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static GlobalSchemaListResult DeserializeGlobalSchemaListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GlobalSchemaListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new GlobalSchemaListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + GlobalSchemaListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGlobalSchemaListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GlobalSchemaListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGlobalSchemaListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GlobalSchemaListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GlobalSchemaListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGlobalSchemaListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.cs index fc34417aa6bb..16ea3f8ced4f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GlobalSchemaListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The response of the list schema operation. internal partial class GlobalSchemaListResult { - /// Initializes a new instance of GlobalSchemaListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GlobalSchemaListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GlobalSchemaListResult. + /// Initializes a new instance of . /// Global Schema Contract value. /// Total record count number. /// Next page link if any. - internal GlobalSchemaListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GlobalSchemaListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Global Schema Contract value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.Serialization.cs index 047a2a6af2eb..13672e49c4ee 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.Serialization.cs @@ -5,15 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class GroupContractProperties + public partial class GroupContractProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GroupContractProperties DeserializeGroupContractProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(ApiManagementGroupType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ApiManagementGroupType.Value.ToSerialString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GroupContractProperties DeserializeGroupContractProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +68,7 @@ internal static GroupContractProperties DeserializeGroupContractProperties(JsonE Optional builtIn = default; Optional type = default; Optional externalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayName"u8)) @@ -58,8 +104,61 @@ internal static GroupContractProperties DeserializeGroupContractProperties(JsonE externalId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GroupContractProperties(displayName, description.Value, Optional.ToNullable(builtIn), Optional.ToNullable(type), externalId.Value); + return new GroupContractProperties(displayName, description.Value, Optional.ToNullable(builtIn), Optional.ToNullable(type), externalId.Value, serializedAdditionalRawData); + } + + GroupContractProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGroupContractProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GroupContractProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGroupContractProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GroupContractProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GroupContractProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGroupContractProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.cs index e123256e36d8..3b7684c9b36c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupContractProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Group contract Properties. public partial class GroupContractProperties { - /// Initializes a new instance of GroupContractProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Group name. /// is null. internal GroupContractProperties(string displayName) @@ -23,19 +27,26 @@ internal GroupContractProperties(string displayName) DisplayName = displayName; } - /// Initializes a new instance of GroupContractProperties. + /// Initializes a new instance of . /// Group name. /// Group description. Can contain HTML formatting tags. /// true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. /// Group type. /// For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. - internal GroupContractProperties(string displayName, string description, bool? isBuiltIn, ApiManagementGroupType? apiManagementGroupType, string externalId) + /// Keeps track of any properties unknown to the library. + internal GroupContractProperties(string displayName, string description, bool? isBuiltIn, ApiManagementGroupType? apiManagementGroupType, string externalId, Dictionary serializedAdditionalRawData) { DisplayName = displayName; Description = description; IsBuiltIn = isBuiltIn; ApiManagementGroupType = apiManagementGroupType; ExternalId = externalId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GroupContractProperties() + { } /// Group name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.Serialization.cs index 9364d837dd87..13e6a6af3d89 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class GroupListResult + internal partial class GroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GroupListResult DeserializeGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GroupListResult DeserializeGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static GroupListResult DeserializeGroupListResult(JsonElement element) Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static GroupListResult DeserializeGroupListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GroupListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new GroupListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + GroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.cs index 02afe0cb16df..5238fac5d782 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Group list representation. internal partial class GroupListResult { - /// Initializes a new instance of GroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GroupListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GroupListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal GroupListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GroupListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.Serialization.cs index ea8f132a0fc8..ebfb90ddcb85 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class HostnameConfiguration : IUtf8JsonSerializable + public partial class HostnameConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(HostnameType.ToString()); @@ -53,7 +60,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Certificate)) { writer.WritePropertyName("certificate"u8); - writer.WriteObjectValue(Certificate); + if (Certificate is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Certificate).Serialize(writer, options); + } } if (Optional.IsDefined(CertificateSource)) { @@ -65,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certificateStatus"u8); writer.WriteStringValue(CertificateStatus.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HostnameConfiguration DeserializeHostnameConfiguration(JsonElement element) + internal static HostnameConfiguration DeserializeHostnameConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +113,7 @@ internal static HostnameConfiguration DeserializeHostnameConfiguration(JsonEleme Optional certificate = default; Optional certificateSource = default; Optional certificateStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -166,8 +195,61 @@ internal static HostnameConfiguration DeserializeHostnameConfiguration(JsonEleme certificateStatus = new CertificateStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HostnameConfiguration(type, hostName, keyVaultId.Value, identityClientId.Value, encodedCertificate.Value, certificatePassword.Value, Optional.ToNullable(defaultSslBinding), Optional.ToNullable(negotiateClientCertificate), certificate.Value, Optional.ToNullable(certificateSource), Optional.ToNullable(certificateStatus), serializedAdditionalRawData); + } + + HostnameConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHostnameConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HostnameConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHostnameConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HostnameConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HostnameConfiguration(Response response) + { + if (response is null) + { + return null; } - return new HostnameConfiguration(type, hostName, keyVaultId.Value, identityClientId.Value, encodedCertificate.Value, certificatePassword.Value, Optional.ToNullable(defaultSslBinding), Optional.ToNullable(negotiateClientCertificate), certificate.Value, Optional.ToNullable(certificateSource), Optional.ToNullable(certificateStatus)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHostnameConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs index 1c271a26f333..892e39693b4b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Custom hostname configuration. public partial class HostnameConfiguration { - /// Initializes a new instance of HostnameConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Hostname type. /// Hostname to configure on the Api Management service. /// is null. @@ -25,7 +29,7 @@ public HostnameConfiguration(HostnameType hostnameType, string hostName) HostName = hostName; } - /// Initializes a new instance of HostnameConfiguration. + /// Initializes a new instance of . /// Hostname type. /// Hostname to configure on the Api Management service. /// Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with aka.ms/apimmsi. The secret should be of type *application/x-pkcs12*. @@ -37,7 +41,8 @@ public HostnameConfiguration(HostnameType hostnameType, string hostName) /// Certificate information. /// Certificate Source. /// Certificate Status. - internal HostnameConfiguration(HostnameType hostnameType, string hostName, Uri keyVaultSecretUri, string identityClientId, string encodedCertificate, string certificatePassword, bool? isDefaultSslBindingEnabled, bool? isClientCertificateNegotiationEnabled, CertificateInformation certificate, CertificateSource? certificateSource, CertificateStatus? certificateStatus) + /// Keeps track of any properties unknown to the library. + internal HostnameConfiguration(HostnameType hostnameType, string hostName, Uri keyVaultSecretUri, string identityClientId, string encodedCertificate, string certificatePassword, bool? isDefaultSslBindingEnabled, bool? isClientCertificateNegotiationEnabled, CertificateInformation certificate, CertificateSource? certificateSource, CertificateStatus? certificateStatus, Dictionary serializedAdditionalRawData) { HostnameType = hostnameType; HostName = hostName; @@ -50,6 +55,12 @@ internal HostnameConfiguration(HostnameType hostnameType, string hostName, Uri k Certificate = certificate; CertificateSource = certificateSource; CertificateStatus = certificateStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostnameConfiguration() + { } /// Hostname type. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.Serialization.cs index 32919dbd2800..8dc491e3e0f8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class HttpHeaderConfiguration : IUtf8JsonSerializable + public partial class HttpHeaderConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HttpHeaderConfiguration DeserializeHttpHeaderConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HttpHeaderConfiguration(name, value, serializedAdditionalRawData); + } + + HttpHeaderConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpHeaderConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpHeaderConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpHeaderConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpHeaderConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpHeaderConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpHeaderConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.cs index f8baab974b6b..89de8ece22b4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpHeaderConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// HTTP header and it's value. public partial class HttpHeaderConfiguration { - /// Initializes a new instance of HttpHeaderConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Header name. /// Header value. /// or is null. @@ -26,6 +30,22 @@ public HttpHeaderConfiguration(string name, string value) Value = value; } + /// Initializes a new instance of . + /// Header name. + /// Header value. + /// Keeps track of any properties unknown to the library. + internal HttpHeaderConfiguration(string name, string value, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HttpHeaderConfiguration() + { + } + /// Header name. public string Name { get; } /// Header value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.Serialization.cs index cd47707c36f2..8f01dbebdf34 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class HttpMessageDiagnostic : IUtf8JsonSerializable + public partial class HttpMessageDiagnostic : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Headers)) { @@ -29,18 +36,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Body)) { writer.WritePropertyName("body"u8); - writer.WriteObjectValue(Body); + if (Body is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Body).Serialize(writer, options); + } } if (Optional.IsDefined(DataMasking)) { writer.WritePropertyName("dataMasking"u8); - writer.WriteObjectValue(DataMasking); + if (DataMasking is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataMasking).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static HttpMessageDiagnostic DeserializeHttpMessageDiagnostic(JsonElement element) + internal static HttpMessageDiagnostic DeserializeHttpMessageDiagnostic(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +83,7 @@ internal static HttpMessageDiagnostic DeserializeHttpMessageDiagnostic(JsonEleme Optional> headers = default; Optional body = default; Optional dataMasking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("headers"u8)) @@ -82,8 +118,61 @@ internal static HttpMessageDiagnostic DeserializeHttpMessageDiagnostic(JsonEleme dataMasking = DataMasking.DeserializeDataMasking(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HttpMessageDiagnostic(Optional.ToList(headers), body.Value, dataMasking.Value, serializedAdditionalRawData); + } + + HttpMessageDiagnostic IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpMessageDiagnostic(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpMessageDiagnostic IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpMessageDiagnostic(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpMessageDiagnostic model) + { + if (model is null) + { + return null; } - return new HttpMessageDiagnostic(Optional.ToList(headers), body.Value, dataMasking.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpMessageDiagnostic(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpMessageDiagnostic(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs index 771b09817671..d3f1c648f803 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Http message diagnostic settings. public partial class HttpMessageDiagnostic { - /// Initializes a new instance of HttpMessageDiagnostic. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HttpMessageDiagnostic() { Headers = new ChangeTrackingList(); } - /// Initializes a new instance of HttpMessageDiagnostic. + /// Initializes a new instance of . /// Array of HTTP Headers to log. /// Body logging settings. /// Data masking settings. - internal HttpMessageDiagnostic(IList headers, BodyDiagnosticSettings body, DataMasking dataMasking) + /// Keeps track of any properties unknown to the library. + internal HttpMessageDiagnostic(IList headers, BodyDiagnosticSettings body, DataMasking dataMasking, Dictionary serializedAdditionalRawData) { Headers = headers; Body = body; DataMasking = dataMasking; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of HTTP Headers to log. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.Serialization.cs index 3abdb8e08434..89ac0e23880d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class IdentityProviderList + internal partial class IdentityProviderList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IdentityProviderList DeserializeIdentityProviderList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IdentityProviderList DeserializeIdentityProviderList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static IdentityProviderList DeserializeIdentityProviderList(JsonElement Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static IdentityProviderList DeserializeIdentityProviderList(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IdentityProviderList(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new IdentityProviderList(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + IdentityProviderList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIdentityProviderList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IdentityProviderList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIdentityProviderList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IdentityProviderList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IdentityProviderList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIdentityProviderList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.cs index 990f6252c5c2..98f770496dac 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IdentityProviderList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// List of all the Identity Providers configured on the service instance. internal partial class IdentityProviderList { - /// Initializes a new instance of IdentityProviderList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IdentityProviderList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of IdentityProviderList. + /// Initializes a new instance of . /// Identity Provider configuration values. /// Total record count number across all pages. /// Next page link if any. - internal IdentityProviderList(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal IdentityProviderList(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identity Provider configuration values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.Serialization.cs index b5675b66368c..dfdbb428429b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class IssueAttachmentListResult + internal partial class IssueAttachmentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IssueAttachmentListResult DeserializeIssueAttachmentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IssueAttachmentListResult DeserializeIssueAttachmentListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static IssueAttachmentListResult DeserializeIssueAttachmentListResult(J Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static IssueAttachmentListResult DeserializeIssueAttachmentListResult(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IssueAttachmentListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new IssueAttachmentListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + IssueAttachmentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIssueAttachmentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IssueAttachmentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIssueAttachmentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IssueAttachmentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IssueAttachmentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIssueAttachmentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.cs index def8cbae8eeb..4f98c187f7c8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueAttachmentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Issue Attachment list representation. internal partial class IssueAttachmentListResult { - /// Initializes a new instance of IssueAttachmentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IssueAttachmentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of IssueAttachmentListResult. + /// Initializes a new instance of . /// Issue Attachment values. /// Total record count number across all pages. /// Next page link if any. - internal IssueAttachmentListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal IssueAttachmentListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Issue Attachment values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.Serialization.cs index 031719b42458..c4e7fb43b99f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class IssueCommentListResult + internal partial class IssueCommentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IssueCommentListResult DeserializeIssueCommentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IssueCommentListResult DeserializeIssueCommentListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static IssueCommentListResult DeserializeIssueCommentListResult(JsonEle Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static IssueCommentListResult DeserializeIssueCommentListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IssueCommentListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new IssueCommentListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + IssueCommentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIssueCommentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IssueCommentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIssueCommentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IssueCommentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IssueCommentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIssueCommentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.cs index 3857d98f0e51..4962be427ec2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueCommentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Issue Comment list representation. internal partial class IssueCommentListResult { - /// Initializes a new instance of IssueCommentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IssueCommentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of IssueCommentListResult. + /// Initializes a new instance of . /// Issue Comment values. /// Total record count number across all pages. /// Next page link if any. - internal IssueCommentListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal IssueCommentListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Issue Comment values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueContractData.Serialization.cs index 118290268b61..fa208699b290 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueContractData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class IssueContractData : IUtf8JsonSerializable + public partial class IssueContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IssueContractData DeserializeIssueContractData(JsonElement element) + internal static IssueContractData DeserializeIssueContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +91,7 @@ internal static IssueContractData DeserializeIssueContractData(JsonElement eleme Optional title = default; Optional description = default; Optional userId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -154,8 +176,61 @@ internal static IssueContractData DeserializeIssueContractData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IssueContractData(id, name, type, systemData.Value, Optional.ToNullable(createdDate), Optional.ToNullable(state), apiId.Value, title.Value, description.Value, userId.Value, serializedAdditionalRawData); + } + + IssueContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIssueContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IssueContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIssueContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IssueContractData model) + { + if (model is null) + { + return null; } - return new IssueContractData(id, name, type, systemData.Value, Optional.ToNullable(createdDate), Optional.ToNullable(state), apiId.Value, title.Value, description.Value, userId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IssueContractData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIssueContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.Serialization.cs index 85b6db61da32..53b5cb348dd5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class IssueListResult + internal partial class IssueListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IssueListResult DeserializeIssueListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IssueListResult DeserializeIssueListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static IssueListResult DeserializeIssueListResult(JsonElement element) Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static IssueListResult DeserializeIssueListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IssueListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new IssueListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + IssueListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIssueListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IssueListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIssueListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IssueListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IssueListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIssueListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.cs index 62429396ba17..211bbbe8570b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/IssueListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Issue list representation. internal partial class IssueListResult { - /// Initializes a new instance of IssueListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IssueListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of IssueListResult. + /// Initializes a new instance of . /// Issue values. /// Total record count number across all pages. /// Next page link if any. - internal IssueListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal IssueListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Issue values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.Serialization.cs index 92a69d638b16..961d9e1191bd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class KeyVaultContractCreateProperties : IUtf8JsonSerializable + public partial class KeyVaultContractCreateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecretIdentifier)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identityClientId"u8); writer.WriteStringValue(IdentityClientId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultContractCreateProperties DeserializeKeyVaultContractCreateProperties(JsonElement element) + internal static KeyVaultContractCreateProperties DeserializeKeyVaultContractCreateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional secretIdentifier = default; Optional identityClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretIdentifier"u8)) @@ -48,8 +71,61 @@ internal static KeyVaultContractCreateProperties DeserializeKeyVaultContractCrea identityClientId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultContractCreateProperties(secretIdentifier.Value, identityClientId.Value, serializedAdditionalRawData); + } + + KeyVaultContractCreateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultContractCreateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultContractCreateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultContractCreateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultContractCreateProperties model) + { + if (model is null) + { + return null; } - return new KeyVaultContractCreateProperties(secretIdentifier.Value, identityClientId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultContractCreateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultContractCreateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs index c77d5d286657..882bcedf1476 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Create keyVault contract details. public partial class KeyVaultContractCreateProperties { - /// Initializes a new instance of KeyVaultContractCreateProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public KeyVaultContractCreateProperties() { } - /// Initializes a new instance of KeyVaultContractCreateProperties. + /// Initializes a new instance of . /// Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi. /// Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret. - internal KeyVaultContractCreateProperties(string secretIdentifier, string identityClientId) + /// Keeps track of any properties unknown to the library. + internal KeyVaultContractCreateProperties(string secretIdentifier, string identityClientId, Dictionary serializedAdditionalRawData) { SecretIdentifier = secretIdentifier; IdentityClientId = identityClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.Serialization.cs index 6d50c2f9781e..dd8999b75292 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class KeyVaultContractProperties : IUtf8JsonSerializable + public partial class KeyVaultContractProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LastStatus)) { writer.WritePropertyName("lastStatus"u8); - writer.WriteObjectValue(LastStatus); + if (LastStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LastStatus).Serialize(writer, options); + } } if (Optional.IsDefined(SecretIdentifier)) { @@ -30,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identityClientId"u8); writer.WriteStringValue(IdentityClientId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultContractProperties DeserializeKeyVaultContractProperties(JsonElement element) + internal static KeyVaultContractProperties DeserializeKeyVaultContractProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static KeyVaultContractProperties DeserializeKeyVaultContractProperties Optional lastStatus = default; Optional secretIdentifier = default; Optional identityClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lastStatus"u8)) @@ -63,8 +93,61 @@ internal static KeyVaultContractProperties DeserializeKeyVaultContractProperties identityClientId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultContractProperties(secretIdentifier.Value, identityClientId.Value, lastStatus.Value, serializedAdditionalRawData); + } + + KeyVaultContractProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultContractProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultContractProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultContractProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultContractProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultContractProperties(Response response) + { + if (response is null) + { + return null; } - return new KeyVaultContractProperties(secretIdentifier.Value, identityClientId.Value, lastStatus.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultContractProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs index 3827b70516ea..9f63c6f05d55 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs @@ -5,21 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// KeyVault contract details. public partial class KeyVaultContractProperties : KeyVaultContractCreateProperties { - /// Initializes a new instance of KeyVaultContractProperties. + /// Initializes a new instance of . public KeyVaultContractProperties() { } - /// Initializes a new instance of KeyVaultContractProperties. + /// Initializes a new instance of . /// Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi. /// Null for SystemAssignedIdentity or Client Id for UserAssignedIdentity , which will be used to access key vault secret. /// Last time sync and refresh status of secret from key vault. - internal KeyVaultContractProperties(string secretIdentifier, string identityClientId, KeyVaultLastAccessStatusContractProperties lastStatus) : base(secretIdentifier, identityClientId) + /// Keeps track of any properties unknown to the library. + internal KeyVaultContractProperties(string secretIdentifier, string identityClientId, KeyVaultLastAccessStatusContractProperties lastStatus, Dictionary serializedAdditionalRawData) : base(secretIdentifier, identityClientId, serializedAdditionalRawData) { LastStatus = lastStatus; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.Serialization.cs index 73f1ef841bd5..48fb669d071d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class KeyVaultLastAccessStatusContractProperties : IUtf8JsonSerializable + public partial class KeyVaultLastAccessStatusContractProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("timeStampUtc"u8); writer.WriteStringValue(TimeStampUtc.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultLastAccessStatusContractProperties DeserializeKeyVaultLastAccessStatusContractProperties(JsonElement element) + internal static KeyVaultLastAccessStatusContractProperties DeserializeKeyVaultLastAccessStatusContractProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static KeyVaultLastAccessStatusContractProperties DeserializeKeyVaultLa Optional code = default; Optional message = default; Optional timeStampUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +86,61 @@ internal static KeyVaultLastAccessStatusContractProperties DeserializeKeyVaultLa timeStampUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultLastAccessStatusContractProperties(code.Value, message.Value, Optional.ToNullable(timeStampUtc), serializedAdditionalRawData); + } + + KeyVaultLastAccessStatusContractProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultLastAccessStatusContractProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultLastAccessStatusContractProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultLastAccessStatusContractProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultLastAccessStatusContractProperties model) + { + if (model is null) + { + return null; } - return new KeyVaultLastAccessStatusContractProperties(code.Value, message.Value, Optional.ToNullable(timeStampUtc)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultLastAccessStatusContractProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultLastAccessStatusContractProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs index 65d6a1ed341b..323496345e40 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs @@ -6,29 +6,35 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Issue contract Update Properties. public partial class KeyVaultLastAccessStatusContractProperties { - /// Initializes a new instance of KeyVaultLastAccessStatusContractProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public KeyVaultLastAccessStatusContractProperties() { } - /// Initializes a new instance of KeyVaultLastAccessStatusContractProperties. + /// Initializes a new instance of . /// Last status code for sync and refresh of secret from key vault. /// Details of the error else empty. /// /// Last time secret was accessed. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. /// /// - internal KeyVaultLastAccessStatusContractProperties(string code, string message, DateTimeOffset? timeStampUtc) + /// Keeps track of any properties unknown to the library. + internal KeyVaultLastAccessStatusContractProperties(string code, string message, DateTimeOffset? timeStampUtc, Dictionary serializedAdditionalRawData) { Code = code; Message = message; TimeStampUtc = timeStampUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Last status code for sync and refresh of secret from key vault. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.Serialization.cs index 8ca9bbfe10ed..ffd6f617a9e3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class LoggerListResult + internal partial class LoggerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LoggerListResult DeserializeLoggerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LoggerListResult DeserializeLoggerListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static LoggerListResult DeserializeLoggerListResult(JsonElement element Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static LoggerListResult DeserializeLoggerListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LoggerListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new LoggerListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + LoggerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLoggerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LoggerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLoggerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LoggerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LoggerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLoggerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.cs index e208013351c2..accce934d6f7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/LoggerListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Logger list representation. internal partial class LoggerListResult { - /// Initializes a new instance of LoggerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LoggerListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of LoggerListResult. + /// Initializes a new instance of . /// Logger values. /// Total record count number across all pages. /// Next page link if any. - internal LoggerListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal LoggerListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Logger values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.Serialization.cs index 2a77ad227fac..215d8744baad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class NamedValueListResult + internal partial class NamedValueListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NamedValueListResult DeserializeNamedValueListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NamedValueListResult DeserializeNamedValueListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static NamedValueListResult DeserializeNamedValueListResult(JsonElement Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static NamedValueListResult DeserializeNamedValueListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NamedValueListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new NamedValueListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + NamedValueListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNamedValueListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NamedValueListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNamedValueListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NamedValueListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NamedValueListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNamedValueListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.cs index 93c05f84a04f..ceef9e7d1c95 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged NamedValue list representation. internal partial class NamedValueListResult { - /// Initializes a new instance of NamedValueListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NamedValueListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of NamedValueListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal NamedValueListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal NamedValueListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.Serialization.cs index de096bd973ec..f59e4566db9d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class NamedValueSecretContract + public partial class NamedValueSecretContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NamedValueSecretContract DeserializeNamedValueSecretContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NamedValueSecretContract DeserializeNamedValueSecretContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -26,8 +60,61 @@ internal static NamedValueSecretContract DeserializeNamedValueSecretContract(Jso value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NamedValueSecretContract(value.Value); + return new NamedValueSecretContract(value.Value, serializedAdditionalRawData); + } + + NamedValueSecretContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNamedValueSecretContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NamedValueSecretContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNamedValueSecretContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NamedValueSecretContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NamedValueSecretContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNamedValueSecretContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs index 8fa2f3795e51..c7968966efc3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. public partial class NamedValueSecretContract { - /// Initializes a new instance of NamedValueSecretContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NamedValueSecretContract() { } - /// Initializes a new instance of NamedValueSecretContract. + /// Initializes a new instance of . /// This is secret value of the NamedValue entity. - internal NamedValueSecretContract(string value) + /// Keeps track of any properties unknown to the library. + internal NamedValueSecretContract(string value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is secret value of the NamedValue entity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.Serialization.cs index 66e6eebad87f..02cf33eacac0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.Serialization.cs @@ -5,22 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class NetworkStatusContract + public partial class NetworkStatusContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NetworkStatusContract DeserializeNetworkStatusContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("dnsServers"u8); + writer.WriteStartArray(); + foreach (var item in DnsServers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("connectivityStatus"u8); + writer.WriteStartArray(); + foreach (var item in ConnectivityStatus) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NetworkStatusContract DeserializeNetworkStatusContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList dnsServers = default; IReadOnlyList connectivityStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dnsServers"u8)) @@ -43,8 +92,61 @@ internal static NetworkStatusContract DeserializeNetworkStatusContract(JsonEleme connectivityStatus = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NetworkStatusContract(dnsServers, connectivityStatus); + return new NetworkStatusContract(dnsServers, connectivityStatus, serializedAdditionalRawData); + } + + NetworkStatusContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkStatusContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkStatusContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkStatusContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkStatusContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkStatusContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkStatusContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.cs index 05c65029004c..90501bcfe9e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContract.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Network Status details. public partial class NetworkStatusContract { - /// Initializes a new instance of NetworkStatusContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets the list of DNS servers IPV4 addresses. /// Gets the list of Connectivity Status to the Resources on which the service depends upon. /// or is null. @@ -28,13 +31,20 @@ internal NetworkStatusContract(IEnumerable dnsServers, IEnumerable Initializes a new instance of NetworkStatusContract. + /// Initializes a new instance of . /// Gets the list of DNS servers IPV4 addresses. /// Gets the list of Connectivity Status to the Resources on which the service depends upon. - internal NetworkStatusContract(IReadOnlyList dnsServers, IReadOnlyList connectivityStatus) + /// Keeps track of any properties unknown to the library. + internal NetworkStatusContract(IReadOnlyList dnsServers, IReadOnlyList connectivityStatus, Dictionary serializedAdditionalRawData) { DnsServers = dnsServers; ConnectivityStatus = connectivityStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NetworkStatusContract() + { } /// Gets the list of DNS servers IPV4 addresses. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.Serialization.cs index 6b8a3ed30cf6..83f8d5d891b1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class NetworkStatusContractWithLocation + public partial class NetworkStatusContractWithLocation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NetworkStatusContractWithLocation DeserializeNetworkStatusContractWithLocation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(NetworkStatus)) + { + writer.WritePropertyName("networkStatus"u8); + if (NetworkStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkStatus).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NetworkStatusContractWithLocation DeserializeNetworkStatusContractWithLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional location = default; Optional networkStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -40,8 +86,61 @@ internal static NetworkStatusContractWithLocation DeserializeNetworkStatusContra networkStatus = NetworkStatusContract.DeserializeNetworkStatusContract(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NetworkStatusContractWithLocation(Optional.ToNullable(location), networkStatus.Value); + return new NetworkStatusContractWithLocation(Optional.ToNullable(location), networkStatus.Value, serializedAdditionalRawData); + } + + NetworkStatusContractWithLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkStatusContractWithLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkStatusContractWithLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkStatusContractWithLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkStatusContractWithLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkStatusContractWithLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkStatusContractWithLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.cs index a7ab3f3be158..ef8c54b3736f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NetworkStatusContractWithLocation.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Network Status in the Location. public partial class NetworkStatusContractWithLocation { - /// Initializes a new instance of NetworkStatusContractWithLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NetworkStatusContractWithLocation() { } - /// Initializes a new instance of NetworkStatusContractWithLocation. + /// Initializes a new instance of . /// Location of service. /// Network status in Location. - internal NetworkStatusContractWithLocation(AzureLocation? location, NetworkStatusContract networkStatus) + /// Keeps track of any properties unknown to the library. + internal NetworkStatusContractWithLocation(AzureLocation? location, NetworkStatusContract networkStatus, Dictionary serializedAdditionalRawData) { Location = location; NetworkStatus = networkStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.Serialization.cs index da55b596b1b0..7e767f6e3166 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class NotificationListResult + internal partial class NotificationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NotificationListResult DeserializeNotificationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NotificationListResult DeserializeNotificationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static NotificationListResult DeserializeNotificationListResult(JsonEle Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static NotificationListResult DeserializeNotificationListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NotificationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new NotificationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + NotificationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NotificationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNotificationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NotificationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NotificationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNotificationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.cs index e371e05f6320..e1da430d236b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NotificationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Notification list representation. internal partial class NotificationListResult { - /// Initializes a new instance of NotificationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NotificationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of NotificationListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal NotificationListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal NotificationListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.Serialization.cs index c50efd11c726..78dd4bd6bcbd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class OAuth2AuthenticationSettingsContract : IUtf8JsonSerializable + public partial class OAuth2AuthenticationSettingsContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AuthorizationServerId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scope"u8); writer.WriteStringValue(Scope); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OAuth2AuthenticationSettingsContract DeserializeOAuth2AuthenticationSettingsContract(JsonElement element) + internal static OAuth2AuthenticationSettingsContract DeserializeOAuth2AuthenticationSettingsContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional authorizationServerId = default; Optional scope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authorizationServerId"u8)) @@ -48,8 +71,61 @@ internal static OAuth2AuthenticationSettingsContract DeserializeOAuth2Authentica scope = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OAuth2AuthenticationSettingsContract(authorizationServerId.Value, scope.Value, serializedAdditionalRawData); + } + + OAuth2AuthenticationSettingsContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOAuth2AuthenticationSettingsContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OAuth2AuthenticationSettingsContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOAuth2AuthenticationSettingsContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OAuth2AuthenticationSettingsContract model) + { + if (model is null) + { + return null; } - return new OAuth2AuthenticationSettingsContract(authorizationServerId.Value, scope.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OAuth2AuthenticationSettingsContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOAuth2AuthenticationSettingsContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.cs index 1df60effd873..6ad00dd5c950 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2AuthenticationSettingsContract.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// API OAuth2 Authentication settings details. public partial class OAuth2AuthenticationSettingsContract { - /// Initializes a new instance of OAuth2AuthenticationSettingsContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OAuth2AuthenticationSettingsContract() { } - /// Initializes a new instance of OAuth2AuthenticationSettingsContract. + /// Initializes a new instance of . /// OAuth authorization server identifier. /// operations scope. - internal OAuth2AuthenticationSettingsContract(string authorizationServerId, string scope) + /// Keeps track of any properties unknown to the library. + internal OAuth2AuthenticationSettingsContract(string authorizationServerId, string scope, Dictionary serializedAdditionalRawData) { AuthorizationServerId = authorizationServerId; Scope = scope; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// OAuth authorization server identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.Serialization.cs index 07bd7792b103..120ec4a05de2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class OpenIdAuthenticationSettingsContract : IUtf8JsonSerializable + public partial class OpenIdAuthenticationSettingsContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OpenIdProviderId)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OpenIdAuthenticationSettingsContract DeserializeOpenIdAuthenticationSettingsContract(JsonElement element) + internal static OpenIdAuthenticationSettingsContract DeserializeOpenIdAuthenticationSettingsContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional openidProviderId = default; Optional> bearerTokenSendingMethods = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("openidProviderId"u8)) @@ -63,8 +85,61 @@ internal static OpenIdAuthenticationSettingsContract DeserializeOpenIdAuthentica bearerTokenSendingMethods = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OpenIdAuthenticationSettingsContract(openidProviderId.Value, Optional.ToList(bearerTokenSendingMethods), serializedAdditionalRawData); + } + + OpenIdAuthenticationSettingsContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOpenIdAuthenticationSettingsContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OpenIdAuthenticationSettingsContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOpenIdAuthenticationSettingsContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OpenIdAuthenticationSettingsContract model) + { + if (model is null) + { + return null; } - return new OpenIdAuthenticationSettingsContract(openidProviderId.Value, Optional.ToList(bearerTokenSendingMethods)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OpenIdAuthenticationSettingsContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOpenIdAuthenticationSettingsContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.cs index cc230a6ae5c7..be0836a73874 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdAuthenticationSettingsContract.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// API OAuth2 Authentication settings details. public partial class OpenIdAuthenticationSettingsContract { - /// Initializes a new instance of OpenIdAuthenticationSettingsContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OpenIdAuthenticationSettingsContract() { BearerTokenSendingMethods = new ChangeTrackingList(); } - /// Initializes a new instance of OpenIdAuthenticationSettingsContract. + /// Initializes a new instance of . /// OAuth authorization server identifier. /// How to send token to the server. - internal OpenIdAuthenticationSettingsContract(string openIdProviderId, IList bearerTokenSendingMethods) + /// Keeps track of any properties unknown to the library. + internal OpenIdAuthenticationSettingsContract(string openIdProviderId, IList bearerTokenSendingMethods, Dictionary serializedAdditionalRawData) { OpenIdProviderId = openIdProviderId; BearerTokenSendingMethods = bearerTokenSendingMethods; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// OAuth authorization server identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.Serialization.cs index edc19f2dc516..2cbd7bd8a3bf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class OpenIdConnectProviderListResult + internal partial class OpenIdConnectProviderListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OpenIdConnectProviderListResult DeserializeOpenIdConnectProviderListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OpenIdConnectProviderListResult DeserializeOpenIdConnectProviderListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static OpenIdConnectProviderListResult DeserializeOpenIdConnectProvider Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static OpenIdConnectProviderListResult DeserializeOpenIdConnectProvider nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OpenIdConnectProviderListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new OpenIdConnectProviderListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + OpenIdConnectProviderListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOpenIdConnectProviderListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OpenIdConnectProviderListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOpenIdConnectProviderListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OpenIdConnectProviderListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OpenIdConnectProviderListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOpenIdConnectProviderListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.cs index 4b168f2c867a..a0b028031bc5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OpenIdConnectProviderListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged OpenIdProviders list representation. internal partial class OpenIdConnectProviderListResult { - /// Initializes a new instance of OpenIdConnectProviderListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OpenIdConnectProviderListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of OpenIdConnectProviderListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal OpenIdConnectProviderListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OpenIdConnectProviderListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.Serialization.cs index 9659e76aafb8..f99268daa4c3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class OperationListResult + internal partial class OperationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OperationListResult DeserializeOperationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OperationListResult DeserializeOperationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static OperationListResult DeserializeOperationListResult(JsonElement e Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static OperationListResult DeserializeOperationListResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OperationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new OperationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + OperationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOperationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OperationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOperationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OperationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OperationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOperationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.cs index cc92946d4512..aadb4fb24617 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Operation list representation. internal partial class OperationListResult { - /// Initializes a new instance of OperationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OperationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of OperationListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal OperationListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OperationListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.Serialization.cs index adee0841216f..ab5326fab0f1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class OperationResultLogItemContract + public partial class OperationResultLogItemContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OperationResultLogItemContract DeserializeOperationResultLogItemContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ObjectType)) + { + writer.WritePropertyName("objectType"u8); + writer.WriteStringValue(ObjectType); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action); + } + if (Optional.IsDefined(ObjectKey)) + { + writer.WritePropertyName("objectKey"u8); + writer.WriteStringValue(ObjectKey); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OperationResultLogItemContract DeserializeOperationResultLogItemContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static OperationResultLogItemContract DeserializeOperationResultLogItem Optional objectType = default; Optional action = default; Optional objectKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("objectType"u8)) @@ -38,8 +82,61 @@ internal static OperationResultLogItemContract DeserializeOperationResultLogItem objectKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OperationResultLogItemContract(objectType.Value, action.Value, objectKey.Value); + return new OperationResultLogItemContract(objectType.Value, action.Value, objectKey.Value, serializedAdditionalRawData); + } + + OperationResultLogItemContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOperationResultLogItemContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OperationResultLogItemContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOperationResultLogItemContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OperationResultLogItemContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OperationResultLogItemContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOperationResultLogItemContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.cs index ab0e88964993..a1b1d9c225d9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationResultLogItemContract.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Log of the entity being created, updated or deleted. public partial class OperationResultLogItemContract { - /// Initializes a new instance of OperationResultLogItemContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OperationResultLogItemContract() { } - /// Initializes a new instance of OperationResultLogItemContract. + /// Initializes a new instance of . /// The type of entity contract. /// Action like create/update/delete. /// Identifier of the entity being created/updated/deleted. - internal OperationResultLogItemContract(string objectType, string action, string objectKey) + /// Keeps track of any properties unknown to the library. + internal OperationResultLogItemContract(string objectType, string action, string objectKey, Dictionary serializedAdditionalRawData) { ObjectType = objectType; Action = action; ObjectKey = objectKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of entity contract. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.Serialization.cs index 8cb71ff7dbd3..1ddf2b9dc9c2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class OutboundEnvironmentEndpoint + public partial class OutboundEnvironmentEndpoint : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OutboundEnvironmentEndpoint DeserializeOutboundEnvironmentEndpoint(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + } + if (Optional.IsCollectionDefined(Endpoints)) + { + writer.WritePropertyName("endpoints"u8); + writer.WriteStartArray(); + foreach (var item in Endpoints) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OutboundEnvironmentEndpoint DeserializeOutboundEnvironmentEndpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional category = default; Optional> endpoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -42,8 +92,61 @@ internal static OutboundEnvironmentEndpoint DeserializeOutboundEnvironmentEndpoi endpoints = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OutboundEnvironmentEndpoint(category.Value, Optional.ToList(endpoints)); + return new OutboundEnvironmentEndpoint(category.Value, Optional.ToList(endpoints), serializedAdditionalRawData); + } + + OutboundEnvironmentEndpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOutboundEnvironmentEndpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OutboundEnvironmentEndpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOutboundEnvironmentEndpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OutboundEnvironmentEndpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OutboundEnvironmentEndpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOutboundEnvironmentEndpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.cs index f8fbf6037124..a4730182ba0f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpoint.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Endpoints accessed for a common purpose that the Api Management Service requires outbound network access to. public partial class OutboundEnvironmentEndpoint { - /// Initializes a new instance of OutboundEnvironmentEndpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OutboundEnvironmentEndpoint() { Endpoints = new ChangeTrackingList(); } - /// Initializes a new instance of OutboundEnvironmentEndpoint. + /// Initializes a new instance of . /// The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. /// The endpoints that the Api Management Service reaches the service at. - internal OutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints) + /// Keeps track of any properties unknown to the library. + internal OutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints, Dictionary serializedAdditionalRawData) { Category = category; Endpoints = endpoints; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.Serialization.cs index 6a0727561410..ee912df4a1c3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class OutboundEnvironmentEndpointList + internal partial class OutboundEnvironmentEndpointList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OutboundEnvironmentEndpointList DeserializeOutboundEnvironmentEndpointList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OutboundEnvironmentEndpointList DeserializeOutboundEnvironmentEndpointList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static OutboundEnvironmentEndpointList DeserializeOutboundEnvironmentEn nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OutboundEnvironmentEndpointList(value, nextLink.Value); + return new OutboundEnvironmentEndpointList(value, nextLink.Value, serializedAdditionalRawData); + } + + OutboundEnvironmentEndpointList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOutboundEnvironmentEndpointList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OutboundEnvironmentEndpointList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOutboundEnvironmentEndpointList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OutboundEnvironmentEndpointList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OutboundEnvironmentEndpointList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOutboundEnvironmentEndpointList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.cs index 533bc207ff7f..553bfcc2204d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OutboundEnvironmentEndpointList.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Collection of Outbound Environment Endpoints. internal partial class OutboundEnvironmentEndpointList { - /// Initializes a new instance of OutboundEnvironmentEndpointList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal OutboundEnvironmentEndpointList(IEnumerable value) @@ -25,13 +28,20 @@ internal OutboundEnvironmentEndpointList(IEnumerable Initializes a new instance of OutboundEnvironmentEndpointList. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal OutboundEnvironmentEndpointList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OutboundEnvironmentEndpointList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OutboundEnvironmentEndpointList() + { } /// Collection of resources. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.Serialization.cs index 0411b42b7c50..0b464a35f0cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ParameterContract : IUtf8JsonSerializable + public partial class ParameterContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -62,15 +69,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Examples) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ParameterContract DeserializeParameterContract(JsonElement element) + internal static ParameterContract DeserializeParameterContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +112,7 @@ internal static ParameterContract DeserializeParameterContract(JsonElement eleme Optional schemaId = default; Optional typeName = default; Optional> examples = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -153,8 +182,61 @@ internal static ParameterContract DeserializeParameterContract(JsonElement eleme examples = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ParameterContract(name, description.Value, type, defaultValue.Value, Optional.ToNullable(required), Optional.ToList(values), schemaId.Value, typeName.Value, Optional.ToDictionary(examples), serializedAdditionalRawData); + } + + ParameterContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParameterContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParameterContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParameterContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParameterContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParameterContract(Response response) + { + if (response is null) + { + return null; } - return new ParameterContract(name, description.Value, type, defaultValue.Value, Optional.ToNullable(required), Optional.ToList(values), schemaId.Value, typeName.Value, Optional.ToDictionary(examples)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParameterContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.cs index 19e35aa9242b..d98051ca29d7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterContract.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Operation parameters details. public partial class ParameterContract { - /// Initializes a new instance of ParameterContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Parameter name. /// Parameter type. /// or is null. @@ -29,7 +32,7 @@ public ParameterContract(string name, string parameterContractType) Examples = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ParameterContract. + /// Initializes a new instance of . /// Parameter name. /// Parameter description. /// Parameter type. @@ -39,7 +42,8 @@ public ParameterContract(string name, string parameterContractType) /// Schema identifier. /// Type name defined by the schema. /// Exampled defined for the parameter. - internal ParameterContract(string name, string description, string parameterContractType, string defaultValue, bool? isRequired, IList values, string schemaId, string typeName, IDictionary examples) + /// Keeps track of any properties unknown to the library. + internal ParameterContract(string name, string description, string parameterContractType, string defaultValue, bool? isRequired, IList values, string schemaId, string typeName, IDictionary examples, Dictionary serializedAdditionalRawData) { Name = name; Description = description; @@ -50,6 +54,12 @@ internal ParameterContract(string name, string description, string parameterCont SchemaId = schemaId; TypeName = typeName; Examples = examples; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ParameterContract() + { } /// Parameter name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.Serialization.cs index 51e0eb6edc6d..58b8281d92e6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ParameterExampleContract : IUtf8JsonSerializable + public partial class ParameterExampleContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Summary)) { @@ -40,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("externalValue"u8); writer.WriteStringValue(ExternalValue); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ParameterExampleContract DeserializeParameterExampleContract(JsonElement element) + internal static ParameterExampleContract DeserializeParameterExampleContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +74,7 @@ internal static ParameterExampleContract DeserializeParameterExampleContract(Jso Optional description = default; Optional value = default; Optional externalValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("summary"u8)) @@ -79,8 +101,61 @@ internal static ParameterExampleContract DeserializeParameterExampleContract(Jso externalValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ParameterExampleContract(summary.Value, description.Value, value.Value, externalValue.Value); + return new ParameterExampleContract(summary.Value, description.Value, value.Value, externalValue.Value, serializedAdditionalRawData); + } + + ParameterExampleContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParameterExampleContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParameterExampleContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParameterExampleContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParameterExampleContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParameterExampleContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParameterExampleContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.cs index 054d6a997c99..95d851051317 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ParameterExampleContract.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Parameter example. public partial class ParameterExampleContract { - /// Initializes a new instance of ParameterExampleContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ParameterExampleContract() { } - /// Initializes a new instance of ParameterExampleContract. + /// Initializes a new instance of . /// Short description for the example. /// Long description for the example. /// Example value. May be a primitive value, or an object. /// A URL that points to the literal example. - internal ParameterExampleContract(string summary, string description, BinaryData value, string externalValue) + /// Keeps track of any properties unknown to the library. + internal ParameterExampleContract(string summary, string description, BinaryData value, string externalValue, Dictionary serializedAdditionalRawData) { Summary = summary; Description = description; Value = value; ExternalValue = externalValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Short description for the example. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.Serialization.cs index 35ff8b750481..00cb8caca0dc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class PipelineDiagnosticSettings : IUtf8JsonSerializable + public partial class PipelineDiagnosticSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Request)) { writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request); + if (Request is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Request).Serialize(writer, options); + } } if (Optional.IsDefined(Response)) { writer.WritePropertyName("response"u8); - writer.WriteObjectValue(Response); + if (Response is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Response).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PipelineDiagnosticSettings DeserializePipelineDiagnosticSettings(JsonElement element) + internal static PipelineDiagnosticSettings DeserializePipelineDiagnosticSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional request = default; Optional response = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("request"u8)) @@ -56,8 +93,61 @@ internal static PipelineDiagnosticSettings DeserializePipelineDiagnosticSettings response = HttpMessageDiagnostic.DeserializeHttpMessageDiagnostic(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PipelineDiagnosticSettings(request.Value, response.Value, serializedAdditionalRawData); + } + + PipelineDiagnosticSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineDiagnosticSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineDiagnosticSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineDiagnosticSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineDiagnosticSettings model) + { + if (model is null) + { + return null; } - return new PipelineDiagnosticSettings(request.Value, response.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineDiagnosticSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineDiagnosticSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.cs index 53721bf1d107..fb671999498d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PipelineDiagnosticSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. public partial class PipelineDiagnosticSettings { - /// Initializes a new instance of PipelineDiagnosticSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PipelineDiagnosticSettings() { } - /// Initializes a new instance of PipelineDiagnosticSettings. + /// Initializes a new instance of . /// Diagnostic settings for request. /// Diagnostic settings for response. - internal PipelineDiagnosticSettings(HttpMessageDiagnostic request, HttpMessageDiagnostic response) + /// Keeps track of any properties unknown to the library. + internal PipelineDiagnosticSettings(HttpMessageDiagnostic request, HttpMessageDiagnostic response, Dictionary serializedAdditionalRawData) { Request = request; Response = response; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Diagnostic settings for request. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContractData.Serialization.cs index 18aa81416e1a..ab6dc9cfe078 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContractData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class PolicyContractData : IUtf8JsonSerializable + public partial class PolicyContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Format.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PolicyContractData DeserializePolicyContractData(JsonElement element) + internal static PolicyContractData DeserializePolicyContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static PolicyContractData DeserializePolicyContractData(JsonElement ele Optional systemData = default; Optional value = default; Optional format = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +120,61 @@ internal static PolicyContractData DeserializePolicyContractData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PolicyContractData(id, name, type, systemData.Value, value.Value, Optional.ToNullable(format), serializedAdditionalRawData); + } + + PolicyContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyContractData model) + { + if (model is null) + { + return null; } - return new PolicyContractData(id, name, type, systemData.Value, value.Value, Optional.ToNullable(format)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyContractData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.Serialization.cs index c8c39171cf48..789d328a292e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class PolicyDescriptionContractData : IUtf8JsonSerializable + public partial class PolicyDescriptionContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PolicyDescriptionContractData DeserializePolicyDescriptionContractData(JsonElement element) + internal static PolicyDescriptionContractData DeserializePolicyDescriptionContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +56,7 @@ internal static PolicyDescriptionContractData DeserializePolicyDescriptionContra Optional systemData = default; Optional description = default; Optional scope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +109,61 @@ internal static PolicyDescriptionContractData DeserializePolicyDescriptionContra } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PolicyDescriptionContractData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(scope), serializedAdditionalRawData); + } + + PolicyDescriptionContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyDescriptionContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyDescriptionContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyDescriptionContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyDescriptionContractData model) + { + if (model is null) + { + return null; } - return new PolicyDescriptionContractData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(scope)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyDescriptionContractData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyDescriptionContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.cs index ea0ad65af17b..4baec7af83dc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionContractData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,22 +15,27 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Policy description details. public partial class PolicyDescriptionContractData : ResourceData { - /// Initializes a new instance of PolicyDescriptionContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PolicyDescriptionContractData() { } - /// Initializes a new instance of PolicyDescriptionContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Policy description. /// Binary OR value of the Snippet scope. - internal PolicyDescriptionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, long? scope) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PolicyDescriptionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, long? scope, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; Scope = scope; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Policy description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.Serialization.cs index 8b0afba3e666..6d44c6a45a5c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class PolicyDescriptionListResult + internal partial class PolicyDescriptionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyDescriptionListResult DeserializePolicyDescriptionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyDescriptionListResult DeserializePolicyDescriptionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -46,8 +96,61 @@ internal static PolicyDescriptionListResult DeserializePolicyDescriptionListResu count = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyDescriptionListResult(Optional.ToList(value), Optional.ToNullable(count)); + return new PolicyDescriptionListResult(Optional.ToList(value), Optional.ToNullable(count), serializedAdditionalRawData); + } + + PolicyDescriptionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyDescriptionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyDescriptionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyDescriptionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyDescriptionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyDescriptionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyDescriptionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs index 63ae26c58e45..e750ce774089 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Descriptions of APIM policies. internal partial class PolicyDescriptionListResult { - /// Initializes a new instance of PolicyDescriptionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PolicyDescriptionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PolicyDescriptionListResult. + /// Initializes a new instance of . /// Descriptions of APIM policies. /// Total record count number. - internal PolicyDescriptionListResult(IReadOnlyList value, long? count) + /// Keeps track of any properties unknown to the library. + internal PolicyDescriptionListResult(IReadOnlyList value, long? count, Dictionary serializedAdditionalRawData) { Value = value; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Descriptions of APIM policies. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.Serialization.cs index a9d3fbcf7a3d..6e5cb34e2460 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class PolicyListResult + internal partial class PolicyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyListResult DeserializePolicyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyListResult DeserializePolicyListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static PolicyListResult DeserializePolicyListResult(JsonElement element Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static PolicyListResult DeserializePolicyListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new PolicyListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + PolicyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.cs index 13af005f7d9f..7e05de2758c8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The response of the list policy operation. internal partial class PolicyListResult { - /// Initializes a new instance of PolicyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PolicyListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PolicyListResult. + /// Initializes a new instance of . /// Policy Contract value. /// Total record count number. /// Next page link if any. - internal PolicyListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PolicyListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Policy Contract value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.Serialization.cs index a94d10567087..d6969412f734 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class PortalRevisionListResult + internal partial class PortalRevisionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PortalRevisionListResult DeserializePortalRevisionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PortalRevisionListResult DeserializePortalRevisionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static PortalRevisionListResult DeserializePortalRevisionListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PortalRevisionListResult(Optional.ToList(value), nextLink.Value); + return new PortalRevisionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PortalRevisionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePortalRevisionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PortalRevisionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePortalRevisionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PortalRevisionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PortalRevisionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePortalRevisionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.cs index 583590acc894..9eaddc5a9eab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalRevisionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged list of portal revisions. internal partial class PortalRevisionListResult { - /// Initializes a new instance of PortalRevisionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PortalRevisionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PortalRevisionListResult. + /// Initializes a new instance of . /// Collection of portal revisions. /// Next page link, if any. - internal PortalRevisionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PortalRevisionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of portal revisions. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.Serialization.cs index fd3b72bdff82..20c51e9c7399 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class PortalSettingValidationKeyContract + public partial class PortalSettingValidationKeyContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PortalSettingValidationKeyContract DeserializePortalSettingValidationKeyContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ValidationKey)) + { + writer.WritePropertyName("validationKey"u8); + writer.WriteStringValue(ValidationKey); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PortalSettingValidationKeyContract DeserializePortalSettingValidationKeyContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional validationKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("validationKey"u8)) @@ -26,8 +60,61 @@ internal static PortalSettingValidationKeyContract DeserializePortalSettingValid validationKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PortalSettingValidationKeyContract(validationKey.Value); + return new PortalSettingValidationKeyContract(validationKey.Value, serializedAdditionalRawData); + } + + PortalSettingValidationKeyContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePortalSettingValidationKeyContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PortalSettingValidationKeyContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePortalSettingValidationKeyContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PortalSettingValidationKeyContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PortalSettingValidationKeyContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePortalSettingValidationKeyContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.cs index 9e206258a0f3..03a121ea7c68 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingValidationKeyContract.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. public partial class PortalSettingValidationKeyContract { - /// Initializes a new instance of PortalSettingValidationKeyContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PortalSettingValidationKeyContract() { } - /// Initializes a new instance of PortalSettingValidationKeyContract. + /// Initializes a new instance of . /// This is secret value of the validation key in portal settings. - internal PortalSettingValidationKeyContract(string validationKey) + /// Keeps track of any properties unknown to the library. + internal PortalSettingValidationKeyContract(string validationKey, Dictionary serializedAdditionalRawData) { ValidationKey = validationKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is secret value of the validation key in portal settings. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.Serialization.cs index 7fa327521beb..49a358f6bb15 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class PortalSettingsContractData : IUtf8JsonSerializable + public partial class PortalSettingsContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -32,12 +39,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IsSubscriptions)) { writer.WritePropertyName("subscriptions"u8); - writer.WriteObjectValue(IsSubscriptions); + if (IsSubscriptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IsSubscriptions).Serialize(writer, options); + } } if (Optional.IsDefined(IsUserRegistration)) { writer.WritePropertyName("userRegistration"u8); - writer.WriteObjectValue(IsUserRegistration); + if (IsUserRegistration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IsUserRegistration).Serialize(writer, options); + } } if (Optional.IsDefined(IsRedirectEnabled)) { @@ -47,14 +68,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TermsOfService)) { writer.WritePropertyName("termsOfService"u8); - writer.WriteObjectValue(TermsOfService); + if (TermsOfService is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TermsOfService).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PortalSettingsContractData DeserializePortalSettingsContractData(JsonElement element) + internal static PortalSettingsContractData DeserializePortalSettingsContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +111,7 @@ internal static PortalSettingsContractData DeserializePortalSettingsContractData Optional userRegistration = default; Optional enabled = default; Optional termsOfService = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -157,8 +200,61 @@ internal static PortalSettingsContractData DeserializePortalSettingsContractData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PortalSettingsContractData(id, name, type, systemData.Value, uri.Value, validationKey.Value, subscriptions.Value, userRegistration.Value, Optional.ToNullable(enabled), termsOfService.Value, serializedAdditionalRawData); + } + + PortalSettingsContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePortalSettingsContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PortalSettingsContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePortalSettingsContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PortalSettingsContractData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PortalSettingsContractData(Response response) + { + if (response is null) + { + return null; } - return new PortalSettingsContractData(id, name, type, systemData.Value, uri.Value, validationKey.Value, subscriptions.Value, userRegistration.Value, Optional.ToNullable(enabled), termsOfService.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePortalSettingsContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.cs index 0e4ec80a30ba..ef452d6016e6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsContractData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Portal Settings for the Developer Portal. public partial class PortalSettingsContractData : ResourceData { - /// Initializes a new instance of PortalSettingsContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PortalSettingsContractData() { } - /// Initializes a new instance of PortalSettingsContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,7 +34,8 @@ public PortalSettingsContractData() /// User registration delegation settings. /// Redirect Anonymous users to the Sign-In page. /// Terms of service contract properties. - internal PortalSettingsContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Uri uri, string validationKey, SubscriptionDelegationSettingProperties isSubscriptions, RegistrationDelegationSettingProperties isUserRegistration, bool? isRedirectEnabled, TermsOfServiceProperties termsOfService) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PortalSettingsContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Uri uri, string validationKey, SubscriptionDelegationSettingProperties isSubscriptions, RegistrationDelegationSettingProperties isUserRegistration, bool? isRedirectEnabled, TermsOfServiceProperties termsOfService, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Uri = uri; ValidationKey = validationKey; @@ -38,6 +43,7 @@ internal PortalSettingsContractData(ResourceIdentifier id, string name, Resource IsUserRegistration = isUserRegistration; IsRedirectEnabled = isRedirectEnabled; TermsOfService = termsOfService; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A delegation Url. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.Serialization.cs index a6c4243339d4..2d7f991bce13 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class PortalSettingsListResult + internal partial class PortalSettingsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PortalSettingsListResult DeserializePortalSettingsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PortalSettingsListResult DeserializePortalSettingsListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -46,8 +96,61 @@ internal static PortalSettingsListResult DeserializePortalSettingsListResult(Jso count = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PortalSettingsListResult(Optional.ToList(value), Optional.ToNullable(count)); + return new PortalSettingsListResult(Optional.ToList(value), Optional.ToNullable(count), serializedAdditionalRawData); + } + + PortalSettingsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePortalSettingsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PortalSettingsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePortalSettingsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PortalSettingsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PortalSettingsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePortalSettingsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs index e7d87aa1f974..405cebd4bc7d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Descriptions of APIM policies. internal partial class PortalSettingsListResult { - /// Initializes a new instance of PortalSettingsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PortalSettingsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PortalSettingsListResult. + /// Initializes a new instance of . /// Descriptions of APIM policies. /// Total record count number. - internal PortalSettingsListResult(IReadOnlyList value, long? count) + /// Keeps track of any properties unknown to the library. + internal PortalSettingsListResult(IReadOnlyList value, long? count, Dictionary serializedAdditionalRawData) { Value = value; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Descriptions of APIM policies. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.Serialization.cs index a560fa3a0369..39385077f92e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class PrivateEndpointConnectionRequestProperties : IUtf8JsonSerializable + internal partial class PrivateEndpointConnectionRequestProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState); + if (PrivateLinkServiceConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrivateLinkServiceConnectionState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static PrivateEndpointConnectionRequestProperties DeserializePrivateEndpointConnectionRequestProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("privateLinkServiceConnectionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkServiceConnectionState = ApiManagementPrivateLinkServiceConnectionState.DeserializeApiManagementPrivateLinkServiceConnectionState(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PrivateEndpointConnectionRequestProperties(privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + PrivateEndpointConnectionRequestProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionRequestProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateEndpointConnectionRequestProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateEndpointConnectionRequestProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateEndpointConnectionRequestProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateEndpointConnectionRequestProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateEndpointConnectionRequestProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.cs index 3d65c940983c..df51afb0189c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PrivateEndpointConnectionRequestProperties.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// The connection state of the private endpoint connection. internal partial class PrivateEndpointConnectionRequestProperties { - /// Initializes a new instance of PrivateEndpointConnectionRequestProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PrivateEndpointConnectionRequestProperties() { } + /// Initializes a new instance of . + /// A collection of information about the state of the connection between service consumer and provider. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionRequestProperties(ApiManagementPrivateLinkServiceConnectionState privateLinkServiceConnectionState, Dictionary serializedAdditionalRawData) + { + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// A collection of information about the state of the connection between service consumer and provider. public ApiManagementPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs index ae71c4545777..eb0509c0789f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ProductApiData : IUtf8JsonSerializable + public partial class ProductApiData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,12 +34,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationSettings)) { writer.WritePropertyName("authenticationSettings"u8); - writer.WriteObjectValue(AuthenticationSettings); + if (AuthenticationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationSettings).Serialize(writer, options); + } } if (Optional.IsDefined(SubscriptionKeyParameterNames)) { writer.WritePropertyName("subscriptionKeyParameterNames"u8); - writer.WriteObjectValue(SubscriptionKeyParameterNames); + if (SubscriptionKeyParameterNames is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SubscriptionKeyParameterNames).Serialize(writer, options); + } } if (Optional.IsDefined(ApiType)) { @@ -83,12 +103,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Contact)) { writer.WritePropertyName("contact"u8); - writer.WriteObjectValue(Contact); + if (Contact is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Contact).Serialize(writer, options); + } } if (Optional.IsDefined(License)) { writer.WritePropertyName("license"u8); - writer.WriteObjectValue(License); + if (License is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)License).Serialize(writer, options); + } } if (Optional.IsDefined(SourceApiId)) { @@ -123,14 +157,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiVersionSet)) { writer.WritePropertyName("apiVersionSet"u8); - writer.WriteObjectValue(ApiVersionSet); + if (ApiVersionSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiVersionSet).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProductApiData DeserializeProductApiData(JsonElement element) + internal static ProductApiData DeserializeProductApiData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -160,6 +215,7 @@ internal static ProductApiData DeserializeProductApiData(JsonElement element) Optional path = default; Optional> protocols = default; Optional apiVersionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -364,8 +420,61 @@ internal static ProductApiData DeserializeProductApiData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProductApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value, serializedAdditionalRawData); + } + + ProductApiData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProductApiData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProductApiData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProductApiData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProductApiData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProductApiData(Response response) + { + if (response is null) + { + return null; } - return new ProductApiData(id, name, type, systemData.Value, description.Value, authenticationSettings.Value, subscriptionKeyParameterNames.Value, Optional.ToNullable(type0), apiRevision.Value, apiVersion.Value, Optional.ToNullable(isCurrent), Optional.ToNullable(isOnline), apiRevisionDescription.Value, apiVersionDescription.Value, apiVersionSetId.Value, Optional.ToNullable(subscriptionRequired), termsOfServiceUri.Value, contact.Value, license.Value, sourceApiId.Value, displayName.Value, serviceUri.Value, path.Value, Optional.ToList(protocols), apiVersionSet.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProductApiData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs index 03bffc47bf15..a707a3d94749 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiData.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The ProductApiData. public partial class ProductApiData : ResourceData { - /// Initializes a new instance of ProductApiData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProductApiData() { Protocols = new ChangeTrackingList(); } - /// Initializes a new instance of ProductApiData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +50,8 @@ public ProductApiData() /// Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. /// Describes on which protocols the operations in this API can be invoked. /// Version set details. - internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, AuthenticationSettingsContract authenticationSettings, SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames, ApiType? apiType, string apiRevision, string apiVersion, bool? isCurrent, bool? isOnline, string apiRevisionDescription, string apiVersionDescription, ResourceIdentifier apiVersionSetId, bool? isSubscriptionRequired, Uri termsOfServiceUri, ApiContactInformation contact, ApiLicenseInformation license, ResourceIdentifier sourceApiId, string displayName, Uri serviceUri, string path, IList protocols, ApiVersionSetContractDetails apiVersionSet, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; AuthenticationSettings = authenticationSettings; @@ -70,6 +74,7 @@ internal ProductApiData(ResourceIdentifier id, string name, ResourceType resourc Path = path; Protocols = protocols; ApiVersionSet = apiVersionSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the API. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.Serialization.cs index 9b68952a8be8..5f8fb4bef779 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.Serialization.cs @@ -5,15 +5,73 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ProductEntityBaseProperties + public partial class ProductEntityBaseProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ProductEntityBaseProperties DeserializeProductEntityBaseProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Terms)) + { + writer.WritePropertyName("terms"u8); + writer.WriteStringValue(Terms); + } + if (Optional.IsDefined(IsSubscriptionRequired)) + { + writer.WritePropertyName("subscriptionRequired"u8); + writer.WriteBooleanValue(IsSubscriptionRequired.Value); + } + if (Optional.IsDefined(IsApprovalRequired)) + { + writer.WritePropertyName("approvalRequired"u8); + writer.WriteBooleanValue(IsApprovalRequired.Value); + } + if (Optional.IsDefined(SubscriptionsLimit)) + { + writer.WritePropertyName("subscriptionsLimit"u8); + writer.WriteNumberValue(SubscriptionsLimit.Value); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ProductEntityBaseProperties DeserializeProductEntityBaseProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static ProductEntityBaseProperties DeserializeProductEntityBaseProperti Optional approvalRequired = default; Optional subscriptionsLimit = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description"u8)) @@ -72,8 +131,61 @@ internal static ProductEntityBaseProperties DeserializeProductEntityBaseProperti state = property.Value.GetString().ToApiManagementProductState(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ProductEntityBaseProperties(description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state)); + return new ProductEntityBaseProperties(description.Value, terms.Value, Optional.ToNullable(subscriptionRequired), Optional.ToNullable(approvalRequired), Optional.ToNullable(subscriptionsLimit), Optional.ToNullable(state), serializedAdditionalRawData); + } + + ProductEntityBaseProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProductEntityBaseProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProductEntityBaseProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProductEntityBaseProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProductEntityBaseProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProductEntityBaseProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProductEntityBaseProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.cs index 2b8d4d6e7b60..e4c0ec24a4dd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductEntityBaseProperties.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Product Entity Base Parameters. public partial class ProductEntityBaseProperties { - /// Initializes a new instance of ProductEntityBaseProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ProductEntityBaseProperties() { } - /// Initializes a new instance of ProductEntityBaseProperties. + /// Initializes a new instance of . /// Product description. May include HTML formatting tags. /// Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. /// Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. /// whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. /// Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. /// whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. - internal ProductEntityBaseProperties(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state) + /// Keeps track of any properties unknown to the library. + internal ProductEntityBaseProperties(string description, string terms, bool? isSubscriptionRequired, bool? isApprovalRequired, int? subscriptionsLimit, ApiManagementProductState? state, Dictionary serializedAdditionalRawData) { Description = description; Terms = terms; @@ -30,6 +37,7 @@ internal ProductEntityBaseProperties(string description, string terms, bool? isS IsApprovalRequired = isApprovalRequired; SubscriptionsLimit = subscriptionsLimit; State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Product description. May include HTML formatting tags. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.Serialization.cs index a439f277da46..a7dde6a2ef13 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ProductGroupData : IUtf8JsonSerializable + public partial class ProductGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -39,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExternalId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProductGroupData DeserializeProductGroupData(JsonElement element) + internal static ProductGroupData DeserializeProductGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +79,7 @@ internal static ProductGroupData DeserializeProductGroupData(JsonElement element Optional builtIn = default; Optional type0 = default; Optional externalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -128,8 +151,61 @@ internal static ProductGroupData DeserializeProductGroupData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProductGroupData(id, name, type, systemData.Value, displayName.Value, description.Value, Optional.ToNullable(builtIn), Optional.ToNullable(type0), externalId.Value, serializedAdditionalRawData); + } + + ProductGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProductGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProductGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProductGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProductGroupData model) + { + if (model is null) + { + return null; } - return new ProductGroupData(id, name, type, systemData.Value, displayName.Value, description.Value, Optional.ToNullable(builtIn), Optional.ToNullable(type0), externalId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProductGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProductGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.cs index 323fc495dd5c..49c76a8b1368 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,12 +15,15 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The ProductGroupData. public partial class ProductGroupData : ResourceData { - /// Initializes a new instance of ProductGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProductGroupData() { } - /// Initializes a new instance of ProductGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -28,13 +33,15 @@ public ProductGroupData() /// true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. /// Group type. /// For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. - internal ProductGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, bool? isBuiltIn, ApiManagementGroupType? groupType, string externalId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ProductGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, bool? isBuiltIn, ApiManagementGroupType? groupType, string externalId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; IsBuiltIn = isBuiltIn; GroupType = groupType; ExternalId = externalId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Group name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.Serialization.cs index 38d959e1c07d..c98dc7d0a879 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ProductListResult + internal partial class ProductListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ProductListResult DeserializeProductListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ProductListResult DeserializeProductListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static ProductListResult DeserializeProductListResult(JsonElement eleme Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static ProductListResult DeserializeProductListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ProductListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ProductListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ProductListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProductListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProductListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProductListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProductListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProductListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProductListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.cs index 016f6d9ef7a2..a5a2cb0784de 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Products list representation. internal partial class ProductListResult { - /// Initializes a new instance of ProductListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ProductListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ProductListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ProductListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ProductListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.Serialization.cs index 441394a3cdd6..9682b8f0e99f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.Serialization.cs @@ -6,15 +6,62 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class QuotaCounterContract + public partial class QuotaCounterContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static QuotaCounterContract DeserializeQuotaCounterContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("counterKey"u8); + writer.WriteStringValue(CounterKey); + writer.WritePropertyName("periodKey"u8); + writer.WriteStringValue(PeriodKey); + writer.WritePropertyName("periodStartTime"u8); + writer.WriteStringValue(PeriodStartOn, "O"); + writer.WritePropertyName("periodEndTime"u8); + writer.WriteStringValue(PeriodEndOn, "O"); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + if (Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Value).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static QuotaCounterContract DeserializeQuotaCounterContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +71,7 @@ internal static QuotaCounterContract DeserializeQuotaCounterContract(JsonElement DateTimeOffset periodStartTime = default; DateTimeOffset periodEndTime = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("counterKey"u8)) @@ -55,8 +103,61 @@ internal static QuotaCounterContract DeserializeQuotaCounterContract(JsonElement value = QuotaCounterValueContractProperties.DeserializeQuotaCounterValueContractProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new QuotaCounterContract(counterKey, periodKey, periodStartTime, periodEndTime, value.Value); + return new QuotaCounterContract(counterKey, periodKey, periodStartTime, periodEndTime, value.Value, serializedAdditionalRawData); + } + + QuotaCounterContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaCounterContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuotaCounterContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuotaCounterContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuotaCounterContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuotaCounterContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuotaCounterContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.cs index 27d32142c04f..fdaa5d29b723 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Quota counter details. public partial class QuotaCounterContract { - /// Initializes a new instance of QuotaCounterContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Key value of the Counter. Must not be empty. /// Identifier of the Period for which the counter was collected. Must not be empty. /// @@ -36,7 +40,7 @@ internal QuotaCounterContract(string counterKey, string periodKey, DateTimeOffse PeriodEndOn = periodEndOn; } - /// Initializes a new instance of QuotaCounterContract. + /// Initializes a new instance of . /// The Key value of the Counter. Must not be empty. /// Identifier of the Period for which the counter was collected. Must not be empty. /// @@ -48,13 +52,20 @@ internal QuotaCounterContract(string counterKey, string periodKey, DateTimeOffse /// /// /// Quota Value Properties. - internal QuotaCounterContract(string counterKey, string periodKey, DateTimeOffset periodStartOn, DateTimeOffset periodEndOn, QuotaCounterValueContractProperties value) + /// Keeps track of any properties unknown to the library. + internal QuotaCounterContract(string counterKey, string periodKey, DateTimeOffset periodStartOn, DateTimeOffset periodEndOn, QuotaCounterValueContractProperties value, Dictionary serializedAdditionalRawData) { CounterKey = counterKey; PeriodKey = periodKey; PeriodStartOn = periodStartOn; PeriodEndOn = periodEndOn; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QuotaCounterContract() + { } /// The Key value of the Counter. Must not be empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.Serialization.cs index 772ed39f8523..5d08def8c75e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class QuotaCounterListResult + internal partial class QuotaCounterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static QuotaCounterListResult DeserializeQuotaCounterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static QuotaCounterListResult DeserializeQuotaCounterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static QuotaCounterListResult DeserializeQuotaCounterListResult(JsonEle Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static QuotaCounterListResult DeserializeQuotaCounterListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new QuotaCounterListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new QuotaCounterListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + QuotaCounterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaCounterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuotaCounterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuotaCounterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuotaCounterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuotaCounterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuotaCounterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.cs index 0a4de8c90b21..5b7f4254fd3d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Quota Counter list representation. internal partial class QuotaCounterListResult { - /// Initializes a new instance of QuotaCounterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal QuotaCounterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of QuotaCounterListResult. + /// Initializes a new instance of . /// Quota counter values. /// Total record count number across all pages. /// Next page link if any. - internal QuotaCounterListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal QuotaCounterListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Quota counter values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.Serialization.cs index d56125394dee..fd073ad597c8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class QuotaCounterValueContractProperties + public partial class QuotaCounterValueContractProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static QuotaCounterValueContractProperties DeserializeQuotaCounterValueContractProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallsCount)) + { + writer.WritePropertyName("callsCount"u8); + writer.WriteNumberValue(CallsCount.Value); + } + if (Optional.IsDefined(KbTransferred)) + { + writer.WritePropertyName("kbTransferred"u8); + writer.WriteNumberValue(KbTransferred.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static QuotaCounterValueContractProperties DeserializeQuotaCounterValueContractProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional callsCount = default; Optional kbTransferred = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callsCount"u8)) @@ -40,8 +79,61 @@ internal static QuotaCounterValueContractProperties DeserializeQuotaCounterValue kbTransferred = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new QuotaCounterValueContractProperties(Optional.ToNullable(callsCount), Optional.ToNullable(kbTransferred)); + return new QuotaCounterValueContractProperties(Optional.ToNullable(callsCount), Optional.ToNullable(kbTransferred), serializedAdditionalRawData); + } + + QuotaCounterValueContractProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaCounterValueContractProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuotaCounterValueContractProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuotaCounterValueContractProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuotaCounterValueContractProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuotaCounterValueContractProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuotaCounterValueContractProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.cs index 64d27507d5c4..69ce3c70939b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueContractProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Quota counter value details. public partial class QuotaCounterValueContractProperties { - /// Initializes a new instance of QuotaCounterValueContractProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal QuotaCounterValueContractProperties() { } - /// Initializes a new instance of QuotaCounterValueContractProperties. + /// Initializes a new instance of . /// Number of times Counter was called. /// Data Transferred in KiloBytes. - internal QuotaCounterValueContractProperties(int? callsCount, double? kbTransferred) + /// Keeps track of any properties unknown to the library. + internal QuotaCounterValueContractProperties(int? callsCount, double? kbTransferred, Dictionary serializedAdditionalRawData) { CallsCount = callsCount; KbTransferred = kbTransferred; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Number of times Counter was called. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.Serialization.cs index 5faf62c9f4f5..39a1ced466ee 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class QuotaCounterValueUpdateContent : IUtf8JsonSerializable + public partial class QuotaCounterValueUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,7 +36,119 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(KbTransferred.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QuotaCounterValueUpdateContent DeserializeQuotaCounterValueUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional callsCount = default; + Optional kbTransferred = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("callsCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callsCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("kbTransferred"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kbTransferred = property0.Value.GetDouble(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QuotaCounterValueUpdateContent(Optional.ToNullable(callsCount), Optional.ToNullable(kbTransferred), serializedAdditionalRawData); + } + + QuotaCounterValueUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaCounterValueUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuotaCounterValueUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuotaCounterValueUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuotaCounterValueUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuotaCounterValueUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuotaCounterValueUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.cs index 030e95e39c82..a3383f4530a0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/QuotaCounterValueUpdateContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Quota counter value details. public partial class QuotaCounterValueUpdateContent { - /// Initializes a new instance of QuotaCounterValueUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public QuotaCounterValueUpdateContent() { } + /// Initializes a new instance of . + /// Number of times Counter was called. + /// Data Transferred in KiloBytes. + /// Keeps track of any properties unknown to the library. + internal QuotaCounterValueUpdateContent(int? callsCount, double? kbTransferred, Dictionary serializedAdditionalRawData) + { + CallsCount = callsCount; + KbTransferred = kbTransferred; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Number of times Counter was called. public int? CallsCount { get; set; } /// Data Transferred in KiloBytes. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.Serialization.cs index 0b5a002fed86..984f17f1206f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RecipientEmailContract : IUtf8JsonSerializable + public partial class RecipientEmailContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Email); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RecipientEmailContract DeserializeRecipientEmailContract(JsonElement element) + internal static RecipientEmailContract DeserializeRecipientEmailContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static RecipientEmailContract DeserializeRecipientEmailContract(JsonEle ResourceType type = default; Optional systemData = default; Optional email = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -81,8 +104,61 @@ internal static RecipientEmailContract DeserializeRecipientEmailContract(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecipientEmailContract(id, name, type, systemData.Value, email.Value, serializedAdditionalRawData); + } + + RecipientEmailContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecipientEmailContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecipientEmailContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecipientEmailContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecipientEmailContract model) + { + if (model is null) + { + return null; } - return new RecipientEmailContract(id, name, type, systemData.Value, email.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecipientEmailContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecipientEmailContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.cs index fc64ad0eb966..d2deafcd5d92 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailContract.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Recipient Email details. public partial class RecipientEmailContract : ResourceData { - /// Initializes a new instance of RecipientEmailContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RecipientEmailContract() { } - /// Initializes a new instance of RecipientEmailContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// User Email subscribed to notification. - internal RecipientEmailContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string email) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RecipientEmailContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string email, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Email = email; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// User Email subscribed to notification. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.Serialization.cs index 24e3f12ac7fd..2e5d247d9f9e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class RecipientEmailListResult + internal partial class RecipientEmailListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecipientEmailListResult DeserializeRecipientEmailListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecipientEmailListResult DeserializeRecipientEmailListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static RecipientEmailListResult DeserializeRecipientEmailListResult(Jso Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static RecipientEmailListResult DeserializeRecipientEmailListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecipientEmailListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new RecipientEmailListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + RecipientEmailListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecipientEmailListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecipientEmailListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecipientEmailListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecipientEmailListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecipientEmailListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecipientEmailListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.cs index 1da58a1342ac..4b1fba9c5d65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientEmailListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Recipient User list representation. internal partial class RecipientEmailListResult { - /// Initializes a new instance of RecipientEmailListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecipientEmailListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RecipientEmailListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal RecipientEmailListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RecipientEmailListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.Serialization.cs index 4489d810e04a..033d75b1404e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RecipientUserContract : IUtf8JsonSerializable + public partial class RecipientUserContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RecipientUserContract DeserializeRecipientUserContract(JsonElement element) + internal static RecipientUserContract DeserializeRecipientUserContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static RecipientUserContract DeserializeRecipientUserContract(JsonEleme ResourceType type = default; Optional systemData = default; Optional userId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -81,8 +104,61 @@ internal static RecipientUserContract DeserializeRecipientUserContract(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecipientUserContract(id, name, type, systemData.Value, userId.Value, serializedAdditionalRawData); + } + + RecipientUserContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecipientUserContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecipientUserContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecipientUserContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecipientUserContract model) + { + if (model is null) + { + return null; } - return new RecipientUserContract(id, name, type, systemData.Value, userId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecipientUserContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecipientUserContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.cs index a6eb44df0247..6a911545b283 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserContract.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Recipient User details. public partial class RecipientUserContract : ResourceData { - /// Initializes a new instance of RecipientUserContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RecipientUserContract() { } - /// Initializes a new instance of RecipientUserContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// API Management UserId subscribed to notification. - internal RecipientUserContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string userId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RecipientUserContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string userId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { UserId = userId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// API Management UserId subscribed to notification. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.Serialization.cs index a537b64a577e..5e7602a92b20 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class RecipientUserListResult + internal partial class RecipientUserListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecipientUserListResult DeserializeRecipientUserListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecipientUserListResult DeserializeRecipientUserListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static RecipientUserListResult DeserializeRecipientUserListResult(JsonE Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static RecipientUserListResult DeserializeRecipientUserListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecipientUserListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new RecipientUserListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + RecipientUserListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecipientUserListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecipientUserListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecipientUserListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecipientUserListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecipientUserListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecipientUserListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.cs index 728459e1ee88..d0defb1c8d6c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientUserListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Recipient User list representation. internal partial class RecipientUserListResult { - /// Initializes a new instance of RecipientUserListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecipientUserListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RecipientUserListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal RecipientUserListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RecipientUserListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.Serialization.cs index 2ba7890a9504..fcff2579d9c3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RecipientsContractProperties : IUtf8JsonSerializable + public partial class RecipientsContractProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Emails)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RecipientsContractProperties DeserializeRecipientsContractProperties(JsonElement element) + internal static RecipientsContractProperties DeserializeRecipientsContractProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> emails = default; Optional> users = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("emails"u8)) @@ -77,8 +99,61 @@ internal static RecipientsContractProperties DeserializeRecipientsContractProper users = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecipientsContractProperties(Optional.ToList(emails), Optional.ToList(users), serializedAdditionalRawData); + } + + RecipientsContractProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecipientsContractProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecipientsContractProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecipientsContractProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecipientsContractProperties model) + { + if (model is null) + { + return null; } - return new RecipientsContractProperties(Optional.ToList(emails), Optional.ToList(users)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecipientsContractProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecipientsContractProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.cs index 235f083832e9..efcab71bbbfa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RecipientsContractProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Notification Parameter contract. public partial class RecipientsContractProperties { - /// Initializes a new instance of RecipientsContractProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RecipientsContractProperties() { Emails = new ChangeTrackingList(); Users = new ChangeTrackingList(); } - /// Initializes a new instance of RecipientsContractProperties. + /// Initializes a new instance of . /// List of Emails subscribed for the notification. /// List of Users subscribed for the notification. - internal RecipientsContractProperties(IList emails, IList users) + /// Keeps track of any properties unknown to the library. + internal RecipientsContractProperties(IList emails, IList users, Dictionary serializedAdditionalRawData) { Emails = emails; Users = users; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Emails subscribed for the notification. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.Serialization.cs index c3924492f718..eee3b2c727d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.Serialization.cs @@ -5,15 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RegionContract + public partial class RegionContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RegionContract DeserializeRegionContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsMasterRegion)) + { + writer.WritePropertyName("isMasterRegion"u8); + writer.WriteBooleanValue(IsMasterRegion.Value); + } + if (Optional.IsDefined(IsDeleted)) + { + writer.WritePropertyName("isDeleted"u8); + writer.WriteBooleanValue(IsDeleted.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RegionContract DeserializeRegionContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +59,7 @@ internal static RegionContract DeserializeRegionContract(JsonElement element) Optional name = default; Optional isMasterRegion = default; Optional isDeleted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -46,8 +85,61 @@ internal static RegionContract DeserializeRegionContract(JsonElement element) isDeleted = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RegionContract(name.Value, Optional.ToNullable(isMasterRegion), Optional.ToNullable(isDeleted)); + return new RegionContract(name.Value, Optional.ToNullable(isMasterRegion), Optional.ToNullable(isDeleted), serializedAdditionalRawData); + } + + RegionContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.cs index 2ee627b44169..c94874069e3e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionContract.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Region profile. public partial class RegionContract { - /// Initializes a new instance of RegionContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RegionContract() { } - /// Initializes a new instance of RegionContract. + /// Initializes a new instance of . /// Region name. /// whether Region is the master region. /// whether Region is deleted. - internal RegionContract(string name, bool? isMasterRegion, bool? isDeleted) + /// Keeps track of any properties unknown to the library. + internal RegionContract(string name, bool? isMasterRegion, bool? isDeleted, Dictionary serializedAdditionalRawData) { Name = name; IsMasterRegion = isMasterRegion; IsDeleted = isDeleted; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Region name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.Serialization.cs index 1146e45043aa..ffca314582de 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class RegionListResult + internal partial class RegionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RegionListResult DeserializeRegionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RegionListResult DeserializeRegionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static RegionListResult DeserializeRegionListResult(JsonElement element Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static RegionListResult DeserializeRegionListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RegionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new RegionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + RegionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.cs index 1ac679787c4c..4892997ea1f3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Lists Regions operation response details. internal partial class RegionListResult { - /// Initializes a new instance of RegionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RegionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RegionListResult. + /// Initializes a new instance of . /// Lists of Regions. /// Total record count number across all pages. /// Next page link if any. - internal RegionListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RegionListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Lists of Regions. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.Serialization.cs index 65b6e0f13a6c..6c17211cf716 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class RegistrationDelegationSettingProperties : IUtf8JsonSerializable + internal partial class RegistrationDelegationSettingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsUserRegistrationDelegationEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsUserRegistrationDelegationEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RegistrationDelegationSettingProperties DeserializeRegistrationDelegationSettingProperties(JsonElement element) + internal static RegistrationDelegationSettingProperties DeserializeRegistrationDelegationSettingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static RegistrationDelegationSettingProperties DeserializeRegistrationD enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RegistrationDelegationSettingProperties(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + RegistrationDelegationSettingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegistrationDelegationSettingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegistrationDelegationSettingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegistrationDelegationSettingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegistrationDelegationSettingProperties model) + { + if (model is null) + { + return null; } - return new RegistrationDelegationSettingProperties(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegistrationDelegationSettingProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegistrationDelegationSettingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.cs index 1665809ff841..a862e88e7642 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RegistrationDelegationSettingProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// User registration delegation settings properties. internal partial class RegistrationDelegationSettingProperties { - /// Initializes a new instance of RegistrationDelegationSettingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RegistrationDelegationSettingProperties() { } - /// Initializes a new instance of RegistrationDelegationSettingProperties. + /// Initializes a new instance of . /// Enable or disable delegation for user registration. - internal RegistrationDelegationSettingProperties(bool? isUserRegistrationDelegationEnabled) + /// Keeps track of any properties unknown to the library. + internal RegistrationDelegationSettingProperties(bool? isUserRegistrationDelegationEnabled, Dictionary serializedAdditionalRawData) { IsUserRegistrationDelegationEnabled = isUserRegistrationDelegationEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Enable or disable delegation for user registration. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.Serialization.cs index 33f290cd2907..341272e21633 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RemotePrivateEndpointConnectionWrapper : IUtf8JsonSerializable + public partial class RemotePrivateEndpointConnectionWrapper : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -42,14 +49,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState); + if (PrivateLinkServiceConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrivateLinkServiceConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RemotePrivateEndpointConnectionWrapper DeserializeRemotePrivateEndpointConnectionWrapper(JsonElement element) + internal static RemotePrivateEndpointConnectionWrapper DeserializeRemotePrivateEndpointConnectionWrapper(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +89,7 @@ internal static RemotePrivateEndpointConnectionWrapper DeserializeRemotePrivateE Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; Optional> groupIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -135,8 +164,61 @@ internal static RemotePrivateEndpointConnectionWrapper DeserializeRemotePrivateE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RemotePrivateEndpointConnectionWrapper(id.Value, name.Value, Optional.ToNullable(type), privateEndpoint, privateLinkServiceConnectionState.Value, provisioningState.Value, Optional.ToList(groupIds), serializedAdditionalRawData); + } + + RemotePrivateEndpointConnectionWrapper IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemotePrivateEndpointConnectionWrapper(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemotePrivateEndpointConnectionWrapper IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemotePrivateEndpointConnectionWrapper(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemotePrivateEndpointConnectionWrapper model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemotePrivateEndpointConnectionWrapper(Response response) + { + if (response is null) + { + return null; } - return new RemotePrivateEndpointConnectionWrapper(id.Value, name.Value, Optional.ToNullable(type), privateEndpoint, privateLinkServiceConnectionState.Value, provisioningState.Value, Optional.ToList(groupIds)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemotePrivateEndpointConnectionWrapper(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.cs index eaa01f2c22ee..3b97ce385387 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RemotePrivateEndpointConnectionWrapper.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Remote Private Endpoint Connection resource. public partial class RemotePrivateEndpointConnectionWrapper { - /// Initializes a new instance of RemotePrivateEndpointConnectionWrapper. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RemotePrivateEndpointConnectionWrapper() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of RemotePrivateEndpointConnectionWrapper. + /// Initializes a new instance of . /// Private Endpoint connection resource id. /// Private Endpoint Connection Name. /// Private Endpoint Connection Resource Type. @@ -28,7 +32,8 @@ public RemotePrivateEndpointConnectionWrapper() /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. /// All the Group ids. - internal RemotePrivateEndpointConnectionWrapper(ResourceIdentifier id, string name, ResourceType? resourceType, SubResource privateEndpoint, ApiManagementPrivateLinkServiceConnectionState privateLinkServiceConnectionState, string provisioningState, IReadOnlyList groupIds) + /// Keeps track of any properties unknown to the library. + internal RemotePrivateEndpointConnectionWrapper(ResourceIdentifier id, string name, ResourceType? resourceType, SubResource privateEndpoint, ApiManagementPrivateLinkServiceConnectionState privateLinkServiceConnectionState, string provisioningState, IReadOnlyList groupIds, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -37,6 +42,7 @@ internal RemotePrivateEndpointConnectionWrapper(ResourceIdentifier id, string na PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; ProvisioningState = provisioningState; GroupIds = groupIds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Private Endpoint connection resource id. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.Serialization.cs index 7dc844726e8a..d16eec529c33 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ReportListResult + internal partial class ReportListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReportListResult DeserializeReportListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReportListResult DeserializeReportListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static ReportListResult DeserializeReportListResult(JsonElement element Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static ReportListResult DeserializeReportListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReportListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new ReportListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + ReportListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.cs index f69e424f18d7..96d384980e39 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Report records list representation. internal partial class ReportListResult { - /// Initializes a new instance of ReportListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReportListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReportListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal ReportListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ReportListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.Serialization.cs index 1e26efc28734..c697c7809a13 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.Serialization.cs @@ -6,15 +6,162 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ReportRecordContract + public partial class ReportRecordContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReportRecordContract DeserializeReportRecordContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (Optional.IsDefined(Interval)) + { + writer.WritePropertyName("interval"u8); + writer.WriteStringValue(Interval); + } + if (Optional.IsDefined(Country)) + { + writer.WritePropertyName("country"u8); + writer.WriteStringValue(Country); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(Zip)) + { + writer.WritePropertyName("zip"u8); + writer.WriteStringValue(Zip); + } + if (Optional.IsDefined(ApiId)) + { + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + } + if (Optional.IsDefined(OperationId)) + { + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + } + if (Optional.IsDefined(ApiRegion)) + { + writer.WritePropertyName("apiRegion"u8); + writer.WriteStringValue(ApiRegion); + } + if (Optional.IsDefined(SubscriptionResourceId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionResourceId); + } + if (Optional.IsDefined(CallCountSuccess)) + { + writer.WritePropertyName("callCountSuccess"u8); + writer.WriteNumberValue(CallCountSuccess.Value); + } + if (Optional.IsDefined(CallCountBlocked)) + { + writer.WritePropertyName("callCountBlocked"u8); + writer.WriteNumberValue(CallCountBlocked.Value); + } + if (Optional.IsDefined(CallCountFailed)) + { + writer.WritePropertyName("callCountFailed"u8); + writer.WriteNumberValue(CallCountFailed.Value); + } + if (Optional.IsDefined(CallCountOther)) + { + writer.WritePropertyName("callCountOther"u8); + writer.WriteNumberValue(CallCountOther.Value); + } + if (Optional.IsDefined(CallCountTotal)) + { + writer.WritePropertyName("callCountTotal"u8); + writer.WriteNumberValue(CallCountTotal.Value); + } + if (Optional.IsDefined(Bandwidth)) + { + writer.WritePropertyName("bandwidth"u8); + writer.WriteNumberValue(Bandwidth.Value); + } + if (Optional.IsDefined(CacheHitCount)) + { + writer.WritePropertyName("cacheHitCount"u8); + writer.WriteNumberValue(CacheHitCount.Value); + } + if (Optional.IsDefined(CacheMissCount)) + { + writer.WritePropertyName("cacheMissCount"u8); + writer.WriteNumberValue(CacheMissCount.Value); + } + if (Optional.IsDefined(ApiTimeAvg)) + { + writer.WritePropertyName("apiTimeAvg"u8); + writer.WriteNumberValue(ApiTimeAvg.Value); + } + if (Optional.IsDefined(ApiTimeMin)) + { + writer.WritePropertyName("apiTimeMin"u8); + writer.WriteNumberValue(ApiTimeMin.Value); + } + if (Optional.IsDefined(ApiTimeMax)) + { + writer.WritePropertyName("apiTimeMax"u8); + writer.WriteNumberValue(ApiTimeMax.Value); + } + if (Optional.IsDefined(ServiceTimeAvg)) + { + writer.WritePropertyName("serviceTimeAvg"u8); + writer.WriteNumberValue(ServiceTimeAvg.Value); + } + if (Optional.IsDefined(ServiceTimeMin)) + { + writer.WritePropertyName("serviceTimeMin"u8); + writer.WriteNumberValue(ServiceTimeMin.Value); + } + if (Optional.IsDefined(ServiceTimeMax)) + { + writer.WritePropertyName("serviceTimeMax"u8); + writer.WriteNumberValue(ServiceTimeMax.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReportRecordContract DeserializeReportRecordContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +192,7 @@ internal static ReportRecordContract DeserializeReportRecordContract(JsonElement Optional serviceTimeAvg = default; Optional serviceTimeMin = default; Optional serviceTimeMax = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -241,8 +389,61 @@ internal static ReportRecordContract DeserializeReportRecordContract(JsonElement serviceTimeMax = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReportRecordContract(name.Value, Optional.ToNullable(timestamp), interval.Value, country.Value, region.Value, zip.Value, userId.Value, productId.Value, apiId.Value, operationId.Value, apiRegion.Value, subscriptionId.Value, Optional.ToNullable(callCountSuccess), Optional.ToNullable(callCountBlocked), Optional.ToNullable(callCountFailed), Optional.ToNullable(callCountOther), Optional.ToNullable(callCountTotal), Optional.ToNullable(bandwidth), Optional.ToNullable(cacheHitCount), Optional.ToNullable(cacheMissCount), Optional.ToNullable(apiTimeAvg), Optional.ToNullable(apiTimeMin), Optional.ToNullable(apiTimeMax), Optional.ToNullable(serviceTimeAvg), Optional.ToNullable(serviceTimeMin), Optional.ToNullable(serviceTimeMax)); + return new ReportRecordContract(name.Value, Optional.ToNullable(timestamp), interval.Value, country.Value, region.Value, zip.Value, userId.Value, productId.Value, apiId.Value, operationId.Value, apiRegion.Value, subscriptionId.Value, Optional.ToNullable(callCountSuccess), Optional.ToNullable(callCountBlocked), Optional.ToNullable(callCountFailed), Optional.ToNullable(callCountOther), Optional.ToNullable(callCountTotal), Optional.ToNullable(bandwidth), Optional.ToNullable(cacheHitCount), Optional.ToNullable(cacheMissCount), Optional.ToNullable(apiTimeAvg), Optional.ToNullable(apiTimeMin), Optional.ToNullable(apiTimeMax), Optional.ToNullable(serviceTimeAvg), Optional.ToNullable(serviceTimeMin), Optional.ToNullable(serviceTimeMax), serializedAdditionalRawData); + } + + ReportRecordContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportRecordContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportRecordContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportRecordContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportRecordContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportRecordContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportRecordContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs index ffc63831c539..784aed6866a0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Report data. public partial class ReportRecordContract { - /// Initializes a new instance of ReportRecordContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReportRecordContract() { } - /// Initializes a new instance of ReportRecordContract. + /// Initializes a new instance of . /// Name depending on report endpoint specifies product, API, operation or developer name. /// /// Start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. @@ -48,7 +52,8 @@ internal ReportRecordContract() /// Average time it took to process request on backend. /// Minimum time it took to process request on backend. /// Maximum time it took to process request on backend. - internal ReportRecordContract(string name, DateTimeOffset? timestamp, string interval, string country, string region, string zip, string userId, string productId, string apiId, string operationId, string apiRegion, ResourceIdentifier subscriptionResourceId, int? callCountSuccess, int? callCountBlocked, int? callCountFailed, int? callCountOther, int? callCountTotal, long? bandwidth, int? cacheHitCount, int? cacheMissCount, double? apiTimeAvg, double? apiTimeMin, double? apiTimeMax, double? serviceTimeAvg, double? serviceTimeMin, double? serviceTimeMax) + /// Keeps track of any properties unknown to the library. + internal ReportRecordContract(string name, DateTimeOffset? timestamp, string interval, string country, string region, string zip, string userId, string productId, string apiId, string operationId, string apiRegion, ResourceIdentifier subscriptionResourceId, int? callCountSuccess, int? callCountBlocked, int? callCountFailed, int? callCountOther, int? callCountTotal, long? bandwidth, int? cacheHitCount, int? cacheMissCount, double? apiTimeAvg, double? apiTimeMin, double? apiTimeMax, double? serviceTimeAvg, double? serviceTimeMin, double? serviceTimeMax, Dictionary serializedAdditionalRawData) { Name = name; Timestamp = timestamp; @@ -76,6 +81,7 @@ internal ReportRecordContract(string name, DateTimeOffset? timestamp, string int ServiceTimeAvg = serviceTimeAvg; ServiceTimeMin = serviceTimeMin; ServiceTimeMax = serviceTimeMax; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name depending on report endpoint specifies product, API, operation or developer name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.Serialization.cs index f6b528a2a97e..5136f699fd59 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RepresentationContract : IUtf8JsonSerializable + public partial class RepresentationContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contentType"u8); writer.WriteStringValue(ContentType); @@ -34,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FormParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -45,15 +59,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Examples) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RepresentationContract DeserializeRepresentationContract(JsonElement element) + internal static RepresentationContract DeserializeRepresentationContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +98,7 @@ internal static RepresentationContract DeserializeRepresentationContract(JsonEle Optional typeName = default; Optional> formParameters = default; Optional> examples = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contentType"u8)) @@ -108,8 +144,61 @@ internal static RepresentationContract DeserializeRepresentationContract(JsonEle examples = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RepresentationContract(contentType, schemaId.Value, typeName.Value, Optional.ToList(formParameters), Optional.ToDictionary(examples), serializedAdditionalRawData); + } + + RepresentationContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRepresentationContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RepresentationContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRepresentationContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RepresentationContract model) + { + if (model is null) + { + return null; } - return new RepresentationContract(contentType, schemaId.Value, typeName.Value, Optional.ToList(formParameters), Optional.ToDictionary(examples)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RepresentationContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRepresentationContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.cs index 3cdfaa4527be..63bcfa3e6585 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RepresentationContract.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Operation request/response representation details. public partial class RepresentationContract { - /// Initializes a new instance of RepresentationContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies a registered or custom content type for this representation, e.g. application/xml. /// is null. public RepresentationContract(string contentType) @@ -26,19 +29,26 @@ public RepresentationContract(string contentType) Examples = new ChangeTrackingDictionary(); } - /// Initializes a new instance of RepresentationContract. + /// Initializes a new instance of . /// Specifies a registered or custom content type for this representation, e.g. application/xml. /// Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. /// Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. /// Collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. /// Exampled defined for the representation. - internal RepresentationContract(string contentType, string schemaId, string typeName, IList formParameters, IDictionary examples) + /// Keeps track of any properties unknown to the library. + internal RepresentationContract(string contentType, string schemaId, string typeName, IList formParameters, IDictionary examples, Dictionary serializedAdditionalRawData) { ContentType = contentType; SchemaId = schemaId; TypeName = typeName; FormParameters = formParameters; Examples = examples; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RepresentationContract() + { } /// Specifies a registered or custom content type for this representation, e.g. application/xml. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.Serialization.cs index 559b58a6cd8c..f432b7f50413 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RequestContract : IUtf8JsonSerializable + public partial class RequestContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Description)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in QueryParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Headers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,15 +68,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Representations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RequestContract DeserializeRequestContract(JsonElement element) + internal static RequestContract DeserializeRequestContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +106,7 @@ internal static RequestContract DeserializeRequestContract(JsonElement element) Optional> queryParameters = default; Optional> headers = default; Optional> representations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description"u8)) @@ -113,8 +156,61 @@ internal static RequestContract DeserializeRequestContract(JsonElement element) representations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestContract(description.Value, Optional.ToList(queryParameters), Optional.ToList(headers), Optional.ToList(representations), serializedAdditionalRawData); + } + + RequestContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestContract(Response response) + { + if (response is null) + { + return null; } - return new RequestContract(description.Value, Optional.ToList(queryParameters), Optional.ToList(headers), Optional.ToList(representations)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.cs index f9c2fe2dfafc..7377695233fb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestContract.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Operation request details. public partial class RequestContract { - /// Initializes a new instance of RequestContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RequestContract() { QueryParameters = new ChangeTrackingList(); @@ -21,17 +25,19 @@ public RequestContract() Representations = new ChangeTrackingList(); } - /// Initializes a new instance of RequestContract. + /// Initializes a new instance of . /// Operation request description. /// Collection of operation request query parameters. /// Collection of operation request headers. /// Collection of operation request representations. - internal RequestContract(string description, IList queryParameters, IList headers, IList representations) + /// Keeps track of any properties unknown to the library. + internal RequestContract(string description, IList queryParameters, IList headers, IList representations, Dictionary serializedAdditionalRawData) { Description = description; QueryParameters = queryParameters; Headers = headers; Representations = representations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Operation request description. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.Serialization.cs index 41de0cc34dd5..900ab444e426 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class RequestReportListResult + internal partial class RequestReportListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RequestReportListResult DeserializeRequestReportListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RequestReportListResult DeserializeRequestReportListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -46,8 +96,61 @@ internal static RequestReportListResult DeserializeRequestReportListResult(JsonE count = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RequestReportListResult(Optional.ToList(value), Optional.ToNullable(count)); + return new RequestReportListResult(Optional.ToList(value), Optional.ToNullable(count), serializedAdditionalRawData); + } + + RequestReportListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestReportListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestReportListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestReportListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestReportListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestReportListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestReportListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.cs index a957c54e887b..393f89c7445a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Report records list representation. internal partial class RequestReportListResult { - /// Initializes a new instance of RequestReportListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RequestReportListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RequestReportListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. - internal RequestReportListResult(IReadOnlyList value, long? count) + /// Keeps track of any properties unknown to the library. + internal RequestReportListResult(IReadOnlyList value, long? count, Dictionary serializedAdditionalRawData) { Value = value; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.Serialization.cs index 3be885eb3d19..155cd2d091f9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.Serialization.cs @@ -6,16 +6,123 @@ #nullable disable using System; +using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class RequestReportRecordContract + public partial class RequestReportRecordContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RequestReportRecordContract DeserializeRequestReportRecordContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ApiId)) + { + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + } + if (Optional.IsDefined(OperationId)) + { + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + } + if (Optional.IsDefined(Method)) + { + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.Value.ToString()); + } + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsDefined(IPAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IPAddress.ToString()); + } + if (Optional.IsDefined(BackendResponseCode)) + { + writer.WritePropertyName("backendResponseCode"u8); + writer.WriteStringValue(BackendResponseCode); + } + if (Optional.IsDefined(ResponseCode)) + { + writer.WritePropertyName("responseCode"u8); + writer.WriteNumberValue(ResponseCode.Value); + } + if (Optional.IsDefined(ResponseSize)) + { + writer.WritePropertyName("responseSize"u8); + writer.WriteNumberValue(ResponseSize.Value); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (Optional.IsDefined(Cache)) + { + writer.WritePropertyName("cache"u8); + writer.WriteStringValue(Cache); + } + if (Optional.IsDefined(ApiTime)) + { + writer.WritePropertyName("apiTime"u8); + writer.WriteNumberValue(ApiTime.Value); + } + if (Optional.IsDefined(ServiceTime)) + { + writer.WritePropertyName("serviceTime"u8); + writer.WriteNumberValue(ServiceTime.Value); + } + if (Optional.IsDefined(ApiRegion)) + { + writer.WritePropertyName("apiRegion"u8); + writer.WriteStringValue(ApiRegion); + } + if (Optional.IsDefined(SubscriptionResourceId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionResourceId); + } + if (Optional.IsDefined(RequestId)) + { + writer.WritePropertyName("requestId"u8); + writer.WriteStringValue(RequestId); + } + if (Optional.IsDefined(RequestSize)) + { + writer.WritePropertyName("requestSize"u8); + writer.WriteNumberValue(RequestSize.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RequestReportRecordContract DeserializeRequestReportRecordContract(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +145,7 @@ internal static RequestReportRecordContract DeserializeRequestReportRecordContra Optional subscriptionId = default; Optional requestId = default; Optional requestSize = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("apiId"u8)) @@ -170,8 +278,61 @@ internal static RequestReportRecordContract DeserializeRequestReportRecordContra requestSize = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RequestReportRecordContract(apiId.Value, operationId.Value, productId.Value, userId.Value, Optional.ToNullable(method), uri.Value, ipAddress.Value, backendResponseCode.Value, Optional.ToNullable(responseCode), Optional.ToNullable(responseSize), Optional.ToNullable(timestamp), cache.Value, Optional.ToNullable(apiTime), Optional.ToNullable(serviceTime), apiRegion.Value, subscriptionId.Value, requestId.Value, Optional.ToNullable(requestSize)); + return new RequestReportRecordContract(apiId.Value, operationId.Value, productId.Value, userId.Value, Optional.ToNullable(method), uri.Value, ipAddress.Value, backendResponseCode.Value, Optional.ToNullable(responseCode), Optional.ToNullable(responseSize), Optional.ToNullable(timestamp), cache.Value, Optional.ToNullable(apiTime), Optional.ToNullable(serviceTime), apiRegion.Value, subscriptionId.Value, requestId.Value, Optional.ToNullable(requestSize), serializedAdditionalRawData); + } + + RequestReportRecordContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestReportRecordContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestReportRecordContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestReportRecordContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestReportRecordContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestReportRecordContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestReportRecordContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.cs index f11f127af5c9..e7e9353fd243 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/RequestReportRecordContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Net; using Azure.Core; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Request Report data. public partial class RequestReportRecordContract { - /// Initializes a new instance of RequestReportRecordContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RequestReportRecordContract() { } - /// Initializes a new instance of RequestReportRecordContract. + /// Initializes a new instance of . /// API identifier path. /apis/{apiId}. /// Operation identifier path. /apis/{apiId}/operations/{operationId}. /// Product identifier path. /products/{productId}. @@ -38,7 +42,8 @@ internal RequestReportRecordContract() /// Subscription identifier path. /subscriptions/{subscriptionId}. /// Request Identifier. /// The size of this request.. - internal RequestReportRecordContract(string apiId, string operationId, string productId, string userId, RequestMethod? method, Uri uri, IPAddress ipAddress, string backendResponseCode, int? responseCode, int? responseSize, DateTimeOffset? timestamp, string cache, double? apiTime, double? serviceTime, string apiRegion, ResourceIdentifier subscriptionResourceId, string requestId, int? requestSize) + /// Keeps track of any properties unknown to the library. + internal RequestReportRecordContract(string apiId, string operationId, string productId, string userId, RequestMethod? method, Uri uri, IPAddress ipAddress, string backendResponseCode, int? responseCode, int? responseSize, DateTimeOffset? timestamp, string cache, double? apiTime, double? serviceTime, string apiRegion, ResourceIdentifier subscriptionResourceId, string requestId, int? requestSize, Dictionary serializedAdditionalRawData) { ApiId = apiId; OperationId = operationId; @@ -58,6 +63,7 @@ internal RequestReportRecordContract(string apiId, string operationId, string pr SubscriptionResourceId = subscriptionResourceId; RequestId = requestId; RequestSize = requestSize; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// API identifier path. /apis/{apiId}. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.Serialization.cs index f5452acb7789..22757ae36ba8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ResourceLocationDataContract : IUtf8JsonSerializable + public partial class ResourceLocationDataContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("countryOrRegion"u8); writer.WriteStringValue(CountryOrRegion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceLocationDataContract DeserializeResourceLocationDataContract(JsonElement element) + internal static ResourceLocationDataContract DeserializeResourceLocationDataContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static ResourceLocationDataContract DeserializeResourceLocationDataCont Optional city = default; Optional district = default; Optional countryOrRegion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -67,8 +90,61 @@ internal static ResourceLocationDataContract DeserializeResourceLocationDataCont countryOrRegion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceLocationDataContract(name, city.Value, district.Value, countryOrRegion.Value, serializedAdditionalRawData); + } + + ResourceLocationDataContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceLocationDataContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceLocationDataContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceLocationDataContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceLocationDataContract model) + { + if (model is null) + { + return null; } - return new ResourceLocationDataContract(name, city.Value, district.Value, countryOrRegion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceLocationDataContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceLocationDataContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs index bf559c04ed22..8e11c26b2c72 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Resource location data properties. public partial class ResourceLocationDataContract { - /// Initializes a new instance of ResourceLocationDataContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A canonical name for the geographic or physical location. /// is null. public ResourceLocationDataContract(string name) @@ -23,17 +27,24 @@ public ResourceLocationDataContract(string name) Name = name; } - /// Initializes a new instance of ResourceLocationDataContract. + /// Initializes a new instance of . /// A canonical name for the geographic or physical location. /// The city or locality where the resource is located. /// The district, state, or province where the resource is located. /// The country or region where the resource is located. - internal ResourceLocationDataContract(string name, string city, string district, string countryOrRegion) + /// Keeps track of any properties unknown to the library. + internal ResourceLocationDataContract(string name, string city, string district, string countryOrRegion, Dictionary serializedAdditionalRawData) { Name = name; City = city; District = district; CountryOrRegion = countryOrRegion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceLocationDataContract() + { } /// A canonical name for the geographic or physical location. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.Serialization.cs index b7a09a3a859f..1357d814513a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ResourceSku + internal partial class ResourceSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceSku DeserializeResourceSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceSku DeserializeResourceSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -30,8 +64,61 @@ internal static ResourceSku DeserializeResourceSku(JsonElement element) name = new ApiManagementServiceSkuType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceSku(Optional.ToNullable(name)); + return new ResourceSku(Optional.ToNullable(name), serializedAdditionalRawData); + } + + ResourceSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.cs index bea25489b1d9..9d31c14e0519 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSku.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Describes an available API Management SKU. internal partial class ResourceSku { - /// Initializes a new instance of ResourceSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceSku() { } - /// Initializes a new instance of ResourceSku. + /// Initializes a new instance of . /// Name of the Sku. - internal ResourceSku(ApiManagementServiceSkuType? name) + /// Keeps track of any properties unknown to the library. + internal ResourceSku(ApiManagementServiceSkuType? name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Sku. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.Serialization.cs index 39f8dfc256e7..9c8e880742e4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class ResourceSkuResults + internal partial class ResourceSkuResults : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceSkuResults DeserializeResourceSkuResults(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceSkuResults DeserializeResourceSkuResults(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static ResourceSkuResults DeserializeResourceSkuResults(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceSkuResults(value, nextLink.Value); + return new ResourceSkuResults(value, nextLink.Value, serializedAdditionalRawData); + } + + ResourceSkuResults IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuResults(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSkuResults IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSkuResults(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSkuResults model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSkuResults(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSkuResults(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.cs index 3c11d4f18e16..7bd498821cbe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceSkuResults.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The API Management service SKUs operation response. internal partial class ResourceSkuResults { - /// Initializes a new instance of ResourceSkuResults. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of skus available for the service. /// is null. internal ResourceSkuResults(IEnumerable value) @@ -25,13 +28,20 @@ internal ResourceSkuResults(IEnumerable Value = value.ToList(); } - /// Initializes a new instance of ResourceSkuResults. + /// Initializes a new instance of . /// The list of skus available for the service. /// The uri to fetch the next page of API Management service Skus. - internal ResourceSkuResults(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ResourceSkuResults(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSkuResults() + { } /// The list of skus available for the service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.Serialization.cs index dfc452b002d0..cb054f2c7979 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ResponseContract : IUtf8JsonSerializable + public partial class ResponseContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("statusCode"u8); writer.WriteNumberValue(StatusCode); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Representations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,15 +53,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Headers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResponseContract DeserializeResponseContract(JsonElement element) + internal static ResponseContract DeserializeResponseContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +91,7 @@ internal static ResponseContract DeserializeResponseContract(JsonElement element Optional description = default; Optional> representations = default; Optional> headers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("statusCode"u8)) @@ -96,8 +132,61 @@ internal static ResponseContract DeserializeResponseContract(JsonElement element headers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResponseContract(statusCode, description.Value, Optional.ToList(representations), Optional.ToList(headers), serializedAdditionalRawData); + } + + ResponseContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResponseContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResponseContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResponseContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResponseContract model) + { + if (model is null) + { + return null; } - return new ResponseContract(statusCode, description.Value, Optional.ToList(representations), Optional.ToList(headers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResponseContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResponseContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.cs index ed3aa4b680a5..d598e18a2e5b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResponseContract.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Operation response details. public partial class ResponseContract { - /// Initializes a new instance of ResponseContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Operation response HTTP status code. public ResponseContract(int statusCode) { @@ -22,17 +26,24 @@ public ResponseContract(int statusCode) Headers = new ChangeTrackingList(); } - /// Initializes a new instance of ResponseContract. + /// Initializes a new instance of . /// Operation response HTTP status code. /// Operation response description. /// Collection of operation response representations. /// Collection of operation response headers. - internal ResponseContract(int statusCode, string description, IList representations, IList headers) + /// Keeps track of any properties unknown to the library. + internal ResponseContract(int statusCode, string description, IList representations, IList headers, Dictionary serializedAdditionalRawData) { StatusCode = statusCode; Description = description; Representations = representations; Headers = headers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResponseContract() + { } /// Operation response HTTP status code. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.Serialization.cs index 66a3c38b9819..9c236dd0cc58 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class SamplingSettings : IUtf8JsonSerializable + public partial class SamplingSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SamplingType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("percentage"u8); writer.WriteNumberValue(Percentage.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SamplingSettings DeserializeSamplingSettings(JsonElement element) + internal static SamplingSettings DeserializeSamplingSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional samplingType = default; Optional percentage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("samplingType"u8)) @@ -56,8 +79,61 @@ internal static SamplingSettings DeserializeSamplingSettings(JsonElement element percentage = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SamplingSettings(Optional.ToNullable(samplingType), Optional.ToNullable(percentage), serializedAdditionalRawData); + } + + SamplingSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSamplingSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SamplingSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSamplingSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SamplingSettings model) + { + if (model is null) + { + return null; } - return new SamplingSettings(Optional.ToNullable(samplingType), Optional.ToNullable(percentage)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SamplingSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSamplingSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.cs index 9e69f8b15fad..6e8c645beba6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SamplingSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Sampling settings for Diagnostic. public partial class SamplingSettings { - /// Initializes a new instance of SamplingSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SamplingSettings() { } - /// Initializes a new instance of SamplingSettings. + /// Initializes a new instance of . /// Sampling type. /// Rate of sampling for fixed-rate sampling. - internal SamplingSettings(SamplingType? samplingType, double? percentage) + /// Keeps track of any properties unknown to the library. + internal SamplingSettings(SamplingType? samplingType, double? percentage, Dictionary serializedAdditionalRawData) { SamplingType = samplingType; Percentage = percentage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sampling type. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.Serialization.cs index 8457819ccb36..ae45ba14f0cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.Serialization.cs @@ -5,17 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class SchemaListResult + internal partial class SchemaListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SchemaListResult DeserializeSchemaListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SchemaListResult DeserializeSchemaListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +55,7 @@ internal static SchemaListResult DeserializeSchemaListResult(JsonElement element Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +86,61 @@ internal static SchemaListResult DeserializeSchemaListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SchemaListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new SchemaListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + SchemaListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSchemaListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SchemaListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSchemaListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SchemaListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SchemaListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSchemaListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.cs index 98bbb4f5c2a9..9689c01b2a1b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SchemaListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// The response of the list schema operation. internal partial class SchemaListResult { - /// Initializes a new instance of SchemaListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SchemaListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SchemaListResult. + /// Initializes a new instance of . /// API Schema Contract value. /// Total record count number. /// Next page link if any. - internal SchemaListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SchemaListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// API Schema Contract value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionContractData.Serialization.cs index 365c89565537..9fa39f83c3e4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionContractData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class SubscriptionContractData : IUtf8JsonSerializable + public partial class SubscriptionContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -81,11 +88,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(AllowTracing.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SubscriptionContractData DeserializeSubscriptionContractData(JsonElement element) + internal static SubscriptionContractData DeserializeSubscriptionContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,6 +128,7 @@ internal static SubscriptionContractData DeserializeSubscriptionContractData(Jso Optional secondaryKey = default; Optional stateComment = default; Optional allowTracing = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -238,8 +260,61 @@ internal static SubscriptionContractData DeserializeSubscriptionContractData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SubscriptionContractData(id, name, type, systemData.Value, ownerId.Value, scope.Value, displayName.Value, Optional.ToNullable(state), Optional.ToNullable(createdDate), Optional.ToNullable(startDate), Optional.ToNullable(expirationDate), Optional.ToNullable(endDate), Optional.ToNullable(notificationDate), primaryKey.Value, secondaryKey.Value, stateComment.Value, Optional.ToNullable(allowTracing), serializedAdditionalRawData); + } + + SubscriptionContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionContractData model) + { + if (model is null) + { + return null; } - return new SubscriptionContractData(id, name, type, systemData.Value, ownerId.Value, scope.Value, displayName.Value, Optional.ToNullable(state), Optional.ToNullable(createdDate), Optional.ToNullable(startDate), Optional.ToNullable(expirationDate), Optional.ToNullable(endDate), Optional.ToNullable(notificationDate), primaryKey.Value, secondaryKey.Value, stateComment.Value, Optional.ToNullable(allowTracing)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionContractData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.Serialization.cs index b89697fb34ce..c9b579290dea 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class SubscriptionDelegationSettingProperties : IUtf8JsonSerializable + internal partial class SubscriptionDelegationSettingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSubscriptionDelegationEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsSubscriptionDelegationEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SubscriptionDelegationSettingProperties DeserializeSubscriptionDelegationSettingProperties(JsonElement element) + internal static SubscriptionDelegationSettingProperties DeserializeSubscriptionDelegationSettingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static SubscriptionDelegationSettingProperties DeserializeSubscriptionD enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SubscriptionDelegationSettingProperties(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + SubscriptionDelegationSettingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionDelegationSettingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionDelegationSettingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionDelegationSettingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionDelegationSettingProperties model) + { + if (model is null) + { + return null; } - return new SubscriptionDelegationSettingProperties(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionDelegationSettingProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionDelegationSettingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.cs index 466b929a8a4c..76ead74371b5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionDelegationSettingProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Subscriptions delegation settings properties. internal partial class SubscriptionDelegationSettingProperties { - /// Initializes a new instance of SubscriptionDelegationSettingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SubscriptionDelegationSettingProperties() { } - /// Initializes a new instance of SubscriptionDelegationSettingProperties. + /// Initializes a new instance of . /// Enable or disable delegation for subscriptions. - internal SubscriptionDelegationSettingProperties(bool? isSubscriptionDelegationEnabled) + /// Keeps track of any properties unknown to the library. + internal SubscriptionDelegationSettingProperties(bool? isSubscriptionDelegationEnabled, Dictionary serializedAdditionalRawData) { IsSubscriptionDelegationEnabled = isSubscriptionDelegationEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Enable or disable delegation for subscriptions. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.Serialization.cs index 3a95288f1500..9d9327bfe4fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class SubscriptionKeyParameterNamesContract : IUtf8JsonSerializable + public partial class SubscriptionKeyParameterNamesContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Header)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("query"u8); writer.WriteStringValue(Query); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SubscriptionKeyParameterNamesContract DeserializeSubscriptionKeyParameterNamesContract(JsonElement element) + internal static SubscriptionKeyParameterNamesContract DeserializeSubscriptionKeyParameterNamesContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional header = default; Optional query = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("header"u8)) @@ -48,8 +71,61 @@ internal static SubscriptionKeyParameterNamesContract DeserializeSubscriptionKey query = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SubscriptionKeyParameterNamesContract(header.Value, query.Value, serializedAdditionalRawData); + } + + SubscriptionKeyParameterNamesContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionKeyParameterNamesContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionKeyParameterNamesContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionKeyParameterNamesContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionKeyParameterNamesContract model) + { + if (model is null) + { + return null; } - return new SubscriptionKeyParameterNamesContract(header.Value, query.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionKeyParameterNamesContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionKeyParameterNamesContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.cs index ed465bd66781..e2573d9779ad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeyParameterNamesContract.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription key parameter names details. public partial class SubscriptionKeyParameterNamesContract { - /// Initializes a new instance of SubscriptionKeyParameterNamesContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SubscriptionKeyParameterNamesContract() { } - /// Initializes a new instance of SubscriptionKeyParameterNamesContract. + /// Initializes a new instance of . /// Subscription key header name. /// Subscription key query string parameter name. - internal SubscriptionKeyParameterNamesContract(string header, string query) + /// Keeps track of any properties unknown to the library. + internal SubscriptionKeyParameterNamesContract(string header, string query, Dictionary serializedAdditionalRawData) { Header = header; Query = query; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Subscription key header name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.Serialization.cs index acec682faed6..80aa1081a753 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class SubscriptionKeysContract + public partial class SubscriptionKeysContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SubscriptionKeysContract DeserializeSubscriptionKeysContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PrimaryKey)) + { + writer.WritePropertyName("primaryKey"u8); + writer.WriteStringValue(PrimaryKey); + } + if (Optional.IsDefined(SecondaryKey)) + { + writer.WritePropertyName("secondaryKey"u8); + writer.WriteStringValue(SecondaryKey); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SubscriptionKeysContract DeserializeSubscriptionKeysContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional primaryKey = default; Optional secondaryKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryKey"u8)) @@ -32,8 +71,61 @@ internal static SubscriptionKeysContract DeserializeSubscriptionKeysContract(Jso secondaryKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SubscriptionKeysContract(primaryKey.Value, secondaryKey.Value); + return new SubscriptionKeysContract(primaryKey.Value, secondaryKey.Value, serializedAdditionalRawData); + } + + SubscriptionKeysContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionKeysContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionKeysContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionKeysContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionKeysContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionKeysContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionKeysContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs index b4fdd8a785a4..9ddc72bea3dc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription keys. public partial class SubscriptionKeysContract { - /// Initializes a new instance of SubscriptionKeysContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SubscriptionKeysContract() { } - /// Initializes a new instance of SubscriptionKeysContract. + /// Initializes a new instance of . /// Subscription primary key. /// Subscription secondary key. - internal SubscriptionKeysContract(string primaryKey, string secondaryKey) + /// Keeps track of any properties unknown to the library. + internal SubscriptionKeysContract(string primaryKey, string secondaryKey, Dictionary serializedAdditionalRawData) { PrimaryKey = primaryKey; SecondaryKey = secondaryKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Subscription primary key. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.Serialization.cs index 1df0e057b835..2bc8fbe64e8b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class SubscriptionListResult + internal partial class SubscriptionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SubscriptionListResult DeserializeSubscriptionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SubscriptionListResult DeserializeSubscriptionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static SubscriptionListResult DeserializeSubscriptionListResult(JsonEle Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static SubscriptionListResult DeserializeSubscriptionListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SubscriptionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new SubscriptionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + SubscriptionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.cs index 7eaa8f8e5523..2013bc2ebafa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Subscriptions list representation. internal partial class SubscriptionListResult { - /// Initializes a new instance of SubscriptionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SubscriptionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SubscriptionListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal SubscriptionListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SubscriptionListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagContractData.Serialization.cs index bae9b467b153..610696c0c919 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagContractData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class TagContractData : IUtf8JsonSerializable + public partial class TagContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TagContractData DeserializeTagContractData(JsonElement element) + internal static TagContractData DeserializeTagContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static TagContractData DeserializeTagContractData(JsonElement element) ResourceType type = default; Optional systemData = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -81,8 +104,61 @@ internal static TagContractData DeserializeTagContractData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TagContractData(id, name, type, systemData.Value, displayName.Value, serializedAdditionalRawData); + } + + TagContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagContractData model) + { + if (model is null) + { + return null; } - return new TagContractData(id, name, type, systemData.Value, displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagContractData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.Serialization.cs index ecf263a4db89..dee4984d8d29 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class TagDescriptionListResult + internal partial class TagDescriptionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TagDescriptionListResult DeserializeTagDescriptionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TagDescriptionListResult DeserializeTagDescriptionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static TagDescriptionListResult DeserializeTagDescriptionListResult(Jso Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static TagDescriptionListResult DeserializeTagDescriptionListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TagDescriptionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new TagDescriptionListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + TagDescriptionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagDescriptionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagDescriptionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagDescriptionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagDescriptionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagDescriptionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagDescriptionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.cs index 5ac0dfc4d8ce..0d8668f5f467 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagDescriptionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged TagDescription list representation. internal partial class TagDescriptionListResult { - /// Initializes a new instance of TagDescriptionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TagDescriptionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TagDescriptionListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal TagDescriptionListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TagDescriptionListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.Serialization.cs index 08da5c4fd666..a71351be8dad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class TagListResult + internal partial class TagListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TagListResult DeserializeTagListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TagListResult DeserializeTagListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static TagListResult DeserializeTagListResult(JsonElement element) Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static TagListResult DeserializeTagListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TagListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new TagListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + TagListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.cs index c36f20b005bc..a14a1d46c477 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Tag list representation. internal partial class TagListResult { - /// Initializes a new instance of TagListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TagListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TagListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal TagListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TagListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.Serialization.cs index ecb37cf7da1a..a6628cafdebc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.Serialization.cs @@ -5,15 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TagResourceContractDetails + public partial class TagResourceContractDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TagResourceContractDetails DeserializeTagResourceContractDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("tag"u8); + if (Tag is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tag).Serialize(writer, options); + } + if (Optional.IsDefined(Api)) + { + writer.WritePropertyName("api"u8); + if (Api is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Api).Serialize(writer, options); + } + } + if (Optional.IsDefined(Operation)) + { + writer.WritePropertyName("operation"u8); + if (Operation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Operation).Serialize(writer, options); + } + } + if (Optional.IsDefined(Product)) + { + writer.WritePropertyName("product"u8); + if (Product is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Product).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TagResourceContractDetails DeserializeTagResourceContractDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +95,7 @@ internal static TagResourceContractDetails DeserializeTagResourceContractDetails Optional api = default; Optional operation = default; Optional product = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tag"u8)) @@ -56,8 +130,61 @@ internal static TagResourceContractDetails DeserializeTagResourceContractDetails product = AssociatedProductProperties.DeserializeAssociatedProductProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TagResourceContractDetails(tag, api.Value, operation.Value, product.Value, serializedAdditionalRawData); + } + + TagResourceContractDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagResourceContractDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagResourceContractDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagResourceContractDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagResourceContractDetails model) + { + if (model is null) + { + return null; } - return new TagResourceContractDetails(tag, api.Value, operation.Value, product.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagResourceContractDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagResourceContractDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.cs index ef134706c7f2..fa15d957434f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceContractDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// TagResource contract properties. public partial class TagResourceContractDetails { - /// Initializes a new instance of TagResourceContractDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Tag associated with the resource. /// is null. internal TagResourceContractDetails(AssociatedTagProperties tag) @@ -23,17 +27,24 @@ internal TagResourceContractDetails(AssociatedTagProperties tag) Tag = tag; } - /// Initializes a new instance of TagResourceContractDetails. + /// Initializes a new instance of . /// Tag associated with the resource. /// API associated with the tag. /// Operation associated with the tag. /// Product associated with the tag. - internal TagResourceContractDetails(AssociatedTagProperties tag, AssociatedApiProperties api, AssociatedOperationProperties operation, AssociatedProductProperties product) + /// Keeps track of any properties unknown to the library. + internal TagResourceContractDetails(AssociatedTagProperties tag, AssociatedApiProperties api, AssociatedOperationProperties operation, AssociatedProductProperties product, Dictionary serializedAdditionalRawData) { Tag = tag; Api = api; Operation = operation; Product = product; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TagResourceContractDetails() + { } /// Tag associated with the resource. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.Serialization.cs index 6657c3115d5c..c10659c5538f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class TagResourceListResult + internal partial class TagResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TagResourceListResult DeserializeTagResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TagResourceListResult DeserializeTagResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static TagResourceListResult DeserializeTagResourceListResult(JsonEleme Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static TagResourceListResult DeserializeTagResourceListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TagResourceListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new TagResourceListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + TagResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.cs index 147bc90d2e9f..7472aa1ec0a9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Tag list representation. internal partial class TagResourceListResult { - /// Initializes a new instance of TagResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TagResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TagResourceListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal TagResourceListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TagResourceListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.Serialization.cs index 577a5cf4811c..434875340ecf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TenantAccessInfoCreateOrUpdateContent : IUtf8JsonSerializable + public partial class TenantAccessInfoCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,7 +46,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsDirectAccessEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TenantAccessInfoCreateOrUpdateContent DeserializeTenantAccessInfoCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional principalId = default; + Optional primaryKey = default; + Optional secondaryKey = default; + Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("principalId"u8)) + { + principalId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("primaryKey"u8)) + { + primaryKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("secondaryKey"u8)) + { + secondaryKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("enabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TenantAccessInfoCreateOrUpdateContent(principalId.Value, primaryKey.Value, secondaryKey.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + TenantAccessInfoCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTenantAccessInfoCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TenantAccessInfoCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTenantAccessInfoCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TenantAccessInfoCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TenantAccessInfoCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTenantAccessInfoCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.cs index 8af4c5f19943..3adcf8190ccc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoCreateOrUpdateContent.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Tenant access information update parameters. public partial class TenantAccessInfoCreateOrUpdateContent { - /// Initializes a new instance of TenantAccessInfoCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TenantAccessInfoCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Principal (User) Identifier. + /// Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. + /// Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. + /// Determines whether direct access is enabled. + /// Keeps track of any properties unknown to the library. + internal TenantAccessInfoCreateOrUpdateContent(string principalId, string primaryKey, string secondaryKey, bool? isDirectAccessEnabled, Dictionary serializedAdditionalRawData) + { + PrincipalId = principalId; + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + IsDirectAccessEnabled = isDirectAccessEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Principal (User) Identifier. public string PrincipalId { get; set; } /// Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoData.Serialization.cs index abb4ec262a9c..0c893a4d5e9a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class TenantAccessInfoData : IUtf8JsonSerializable + public partial class TenantAccessInfoData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsDirectAccessEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TenantAccessInfoData DeserializeTenantAccessInfoData(JsonElement element) + internal static TenantAccessInfoData DeserializeTenantAccessInfoData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +72,7 @@ internal static TenantAccessInfoData DeserializeTenantAccessInfoData(JsonElement Optional id0 = default; Optional principalId = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -107,8 +130,61 @@ internal static TenantAccessInfoData DeserializeTenantAccessInfoData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TenantAccessInfoData(id, name, type, systemData.Value, id0.Value, principalId.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + TenantAccessInfoData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTenantAccessInfoData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TenantAccessInfoData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTenantAccessInfoData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TenantAccessInfoData model) + { + if (model is null) + { + return null; } - return new TenantAccessInfoData(id, name, type, systemData.Value, id0.Value, principalId.Value, Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TenantAccessInfoData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTenantAccessInfoData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.Serialization.cs index c22e857099a0..e7614875369a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TenantAccessInfoPatch : IUtf8JsonSerializable + public partial class TenantAccessInfoPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -23,7 +31,109 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsDirectAccessEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TenantAccessInfoPatch DeserializeTenantAccessInfoPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("enabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TenantAccessInfoPatch(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + TenantAccessInfoPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTenantAccessInfoPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TenantAccessInfoPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTenantAccessInfoPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TenantAccessInfoPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TenantAccessInfoPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTenantAccessInfoPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.cs index 3046fbbf6dda..2ee8988bc1e9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoPatch.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Tenant access information update parameters. public partial class TenantAccessInfoPatch { - /// Initializes a new instance of TenantAccessInfoPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TenantAccessInfoPatch() { } + /// Initializes a new instance of . + /// Determines whether direct access is enabled. + /// Keeps track of any properties unknown to the library. + internal TenantAccessInfoPatch(bool? isDirectAccessEnabled, Dictionary serializedAdditionalRawData) + { + IsDirectAccessEnabled = isDirectAccessEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Determines whether direct access is enabled. public bool? IsDirectAccessEnabled { get; set; } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.Serialization.cs index daeda6370281..ed798954e448 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TenantAccessInfoSecretsDetails + public partial class TenantAccessInfoSecretsDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TenantAccessInfoSecretsDetails DeserializeTenantAccessInfoSecretsDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AccessInfoType)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(AccessInfoType); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId); + } + if (Optional.IsDefined(PrimaryKey)) + { + writer.WritePropertyName("primaryKey"u8); + writer.WriteStringValue(PrimaryKey); + } + if (Optional.IsDefined(SecondaryKey)) + { + writer.WritePropertyName("secondaryKey"u8); + writer.WriteStringValue(SecondaryKey); + } + if (Optional.IsDefined(IsDirectAccessEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsDirectAccessEnabled.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TenantAccessInfoSecretsDetails DeserializeTenantAccessInfoSecretsDetails(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static TenantAccessInfoSecretsDetails DeserializeTenantAccessInfoSecret Optional primaryKey = default; Optional secondaryKey = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -54,8 +108,61 @@ internal static TenantAccessInfoSecretsDetails DeserializeTenantAccessInfoSecret enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TenantAccessInfoSecretsDetails(id.Value, principalId.Value, primaryKey.Value, secondaryKey.Value, Optional.ToNullable(enabled)); + return new TenantAccessInfoSecretsDetails(id.Value, principalId.Value, primaryKey.Value, secondaryKey.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + TenantAccessInfoSecretsDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTenantAccessInfoSecretsDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TenantAccessInfoSecretsDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTenantAccessInfoSecretsDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TenantAccessInfoSecretsDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TenantAccessInfoSecretsDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTenantAccessInfoSecretsDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.cs index 826599cc264b..7c203f8d23e2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantAccessInfoSecretsDetails.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Tenant access information contract of the API Management service. public partial class TenantAccessInfoSecretsDetails { - /// Initializes a new instance of TenantAccessInfoSecretsDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TenantAccessInfoSecretsDetails() { } - /// Initializes a new instance of TenantAccessInfoSecretsDetails. + /// Initializes a new instance of . /// Access Information type ('access' or 'gitAccess'). /// Principal (User) Identifier. /// Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// Determines whether direct access is enabled. - internal TenantAccessInfoSecretsDetails(string accessInfoType, string principalId, string primaryKey, string secondaryKey, bool? isDirectAccessEnabled) + /// Keeps track of any properties unknown to the library. + internal TenantAccessInfoSecretsDetails(string accessInfoType, string principalId, string primaryKey, string secondaryKey, bool? isDirectAccessEnabled, Dictionary serializedAdditionalRawData) { AccessInfoType = accessInfoType; PrincipalId = principalId; PrimaryKey = primaryKey; SecondaryKey = secondaryKey; IsDirectAccessEnabled = isDirectAccessEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Access Information type ('access' or 'gitAccess'). diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.Serialization.cs index 465cc5bbd313..71d43132260e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TenantConfigurationSyncStateContract : IUtf8JsonSerializable + public partial class TenantConfigurationSyncStateContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LastOperationId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TenantConfigurationSyncStateContract DeserializeTenantConfigurationSyncStateContract(JsonElement element) + internal static TenantConfigurationSyncStateContract DeserializeTenantConfigurationSyncStateContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +102,7 @@ internal static TenantConfigurationSyncStateContract DeserializeTenantConfigurat Optional syncDate = default; Optional configurationChangeDate = default; Optional lastOperationId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -179,8 +201,61 @@ internal static TenantConfigurationSyncStateContract DeserializeTenantConfigurat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TenantConfigurationSyncStateContract(id, name, type, systemData.Value, branch.Value, commitId.Value, Optional.ToNullable(isExport), Optional.ToNullable(isSynced), Optional.ToNullable(isGitEnabled), Optional.ToNullable(syncDate), Optional.ToNullable(configurationChangeDate), lastOperationId.Value, serializedAdditionalRawData); + } + + TenantConfigurationSyncStateContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTenantConfigurationSyncStateContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TenantConfigurationSyncStateContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTenantConfigurationSyncStateContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TenantConfigurationSyncStateContract model) + { + if (model is null) + { + return null; } - return new TenantConfigurationSyncStateContract(id, name, type, systemData.Value, branch.Value, commitId.Value, Optional.ToNullable(isExport), Optional.ToNullable(isSynced), Optional.ToNullable(isGitEnabled), Optional.ToNullable(syncDate), Optional.ToNullable(configurationChangeDate), lastOperationId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TenantConfigurationSyncStateContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTenantConfigurationSyncStateContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.cs index 25489c06a3e3..23d1cde9f678 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantConfigurationSyncStateContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Result of Tenant Configuration Sync State. public partial class TenantConfigurationSyncStateContract : ResourceData { - /// Initializes a new instance of TenantConfigurationSyncStateContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TenantConfigurationSyncStateContract() { } - /// Initializes a new instance of TenantConfigurationSyncStateContract. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +42,8 @@ public TenantConfigurationSyncStateContract() /// /// /// Most recent tenant configuration operation identifier. - internal TenantConfigurationSyncStateContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string branch, string commitId, bool? isExported, bool? isSynced, bool? isGitEnabled, DateTimeOffset? syncOn, DateTimeOffset? configurationChangeOn, string lastOperationId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal TenantConfigurationSyncStateContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string branch, string commitId, bool? isExported, bool? isSynced, bool? isGitEnabled, DateTimeOffset? syncOn, DateTimeOffset? configurationChangeOn, string lastOperationId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Branch = branch; CommitId = commitId; @@ -48,6 +53,7 @@ internal TenantConfigurationSyncStateContract(ResourceIdentifier id, string name SyncOn = syncOn; ConfigurationChangeOn = configurationChangeOn; LastOperationId = lastOperationId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of Git branch. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.Serialization.cs index b9af4887bedf..81c58622a683 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class TenantSettingsListResult + internal partial class TenantSettingsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TenantSettingsListResult DeserializeTenantSettingsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TenantSettingsListResult DeserializeTenantSettingsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static TenantSettingsListResult DeserializeTenantSettingsListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TenantSettingsListResult(Optional.ToList(value), nextLink.Value); + return new TenantSettingsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + TenantSettingsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTenantSettingsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TenantSettingsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTenantSettingsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TenantSettingsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TenantSettingsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTenantSettingsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.cs index 98462d91188e..d09672dd3c60 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TenantSettingsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged AccessInformation list representation. internal partial class TenantSettingsListResult { - /// Initializes a new instance of TenantSettingsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TenantSettingsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TenantSettingsListResult. + /// Initializes a new instance of . /// Page values. /// Next page link if any. - internal TenantSettingsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TenantSettingsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.Serialization.cs index f71ecafd1e08..4b22569d797a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TermsOfServiceProperties : IUtf8JsonSerializable + public partial class TermsOfServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Text)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("consentRequired"u8); writer.WriteBooleanValue(IsConsentRequired.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TermsOfServiceProperties DeserializeTermsOfServiceProperties(JsonElement element) + internal static TermsOfServiceProperties DeserializeTermsOfServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static TermsOfServiceProperties DeserializeTermsOfServiceProperties(Jso Optional text = default; Optional enabled = default; Optional consentRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("text"u8)) @@ -67,8 +90,61 @@ internal static TermsOfServiceProperties DeserializeTermsOfServiceProperties(Jso consentRequired = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TermsOfServiceProperties(text.Value, Optional.ToNullable(enabled), Optional.ToNullable(consentRequired), serializedAdditionalRawData); + } + + TermsOfServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTermsOfServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TermsOfServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTermsOfServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TermsOfServiceProperties model) + { + if (model is null) + { + return null; } - return new TermsOfServiceProperties(text.Value, Optional.ToNullable(enabled), Optional.ToNullable(consentRequired)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TermsOfServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTermsOfServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.cs index b52c379051a1..4ab550f9e7a4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TermsOfServiceProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Terms of service contract properties. public partial class TermsOfServiceProperties { - /// Initializes a new instance of TermsOfServiceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TermsOfServiceProperties() { } - /// Initializes a new instance of TermsOfServiceProperties. + /// Initializes a new instance of . /// A terms of service text. /// Display terms of service during a sign-up process. /// Ask user for consent to the terms of service. - internal TermsOfServiceProperties(string text, bool? isDisplayEnabled, bool? isConsentRequired) + /// Keeps track of any properties unknown to the library. + internal TermsOfServiceProperties(string text, bool? isDisplayEnabled, bool? isConsentRequired, Dictionary serializedAdditionalRawData) { Text = text; IsDisplayEnabled = isDisplayEnabled; IsConsentRequired = isConsentRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A terms of service text. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.Serialization.cs index ab7d42aeb78d..caedcaa08fd7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class TokenBodyParameterContract : IUtf8JsonSerializable + public partial class TokenBodyParameterContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TokenBodyParameterContract DeserializeTokenBodyParameterContract(JsonElement element) + internal static TokenBodyParameterContract DeserializeTokenBodyParameterContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +65,61 @@ internal static TokenBodyParameterContract DeserializeTokenBodyParameterContract value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TokenBodyParameterContract(name, value, serializedAdditionalRawData); + } + + TokenBodyParameterContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTokenBodyParameterContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TokenBodyParameterContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTokenBodyParameterContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TokenBodyParameterContract model) + { + if (model is null) + { + return null; } - return new TokenBodyParameterContract(name, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TokenBodyParameterContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTokenBodyParameterContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.cs index 0d0be9641d48..4e09af99f17e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TokenBodyParameterContract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApiManagement.Models /// OAuth acquire token request body parameter (www-url-form-encoded). public partial class TokenBodyParameterContract { - /// Initializes a new instance of TokenBodyParameterContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// body parameter name. /// body parameter value. /// or is null. @@ -26,6 +30,22 @@ public TokenBodyParameterContract(string name, string value) Value = value; } + /// Initializes a new instance of . + /// body parameter name. + /// body parameter value. + /// Keeps track of any properties unknown to the library. + internal TokenBodyParameterContract(string name, string value, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TokenBodyParameterContract() + { + } + /// body parameter name. public string Name { get; set; } /// body parameter value. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserContractData.Serialization.cs index d36f44d25aa1..6a7f4a439910 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserContractData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserContractData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApiManagement { - public partial class UserContractData : IUtf8JsonSerializable + public partial class UserContractData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -37,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Identities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -62,11 +75,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RegistriesOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserContractData DeserializeUserContractData(JsonElement element) + internal static UserContractData DeserializeUserContractData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,6 +110,7 @@ internal static UserContractData DeserializeUserContractData(JsonElement element Optional email = default; Optional registrationDate = default; Optional> groups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -187,8 +215,61 @@ internal static UserContractData DeserializeUserContractData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserContractData(id, name, type, systemData.Value, Optional.ToNullable(state), note.Value, Optional.ToList(identities), firstName.Value, lastName.Value, email.Value, Optional.ToNullable(registrationDate), Optional.ToList(groups), serializedAdditionalRawData); + } + + UserContractData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserContractData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserContractData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserContractData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserContractData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserContractData(Response response) + { + if (response is null) + { + return null; } - return new UserContractData(id, name, type, systemData.Value, Optional.ToNullable(state), note.Value, Optional.ToList(identities), firstName.Value, lastName.Value, email.Value, Optional.ToNullable(registrationDate), Optional.ToList(groups)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserContractData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.Serialization.cs index 589feb71e1b4..1d6fe377575b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class UserIdentityContract : IUtf8JsonSerializable + public partial class UserIdentityContract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Provider)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserIdentityContract DeserializeUserIdentityContract(JsonElement element) + internal static UserIdentityContract DeserializeUserIdentityContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional provider = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provider"u8)) @@ -48,8 +71,61 @@ internal static UserIdentityContract DeserializeUserIdentityContract(JsonElement id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserIdentityContract(provider.Value, id.Value, serializedAdditionalRawData); + } + + UserIdentityContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserIdentityContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserIdentityContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserIdentityContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserIdentityContract model) + { + if (model is null) + { + return null; } - return new UserIdentityContract(provider.Value, id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserIdentityContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserIdentityContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.cs index eb6f5691b4fc..c877ece015a4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityContract.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// User identity details. public partial class UserIdentityContract { - /// Initializes a new instance of UserIdentityContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UserIdentityContract() { } - /// Initializes a new instance of UserIdentityContract. + /// Initializes a new instance of . /// Identity provider name. /// Identifier value within provider. - internal UserIdentityContract(string provider, string id) + /// Keeps track of any properties unknown to the library. + internal UserIdentityContract(string provider, string id, Dictionary serializedAdditionalRawData) { Provider = provider; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identity provider name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.Serialization.cs index ed2ab323af11..531f2a2935a7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class UserIdentityListResult + internal partial class UserIdentityListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UserIdentityListResult DeserializeUserIdentityListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UserIdentityListResult DeserializeUserIdentityListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static UserIdentityListResult DeserializeUserIdentityListResult(JsonEle Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +107,61 @@ internal static UserIdentityListResult DeserializeUserIdentityListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UserIdentityListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new UserIdentityListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + UserIdentityListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserIdentityListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserIdentityListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserIdentityListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserIdentityListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserIdentityListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserIdentityListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.cs index 7df6fc1d432b..09e20102fc3d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserIdentityListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// List of Users Identity list representation. internal partial class UserIdentityListResult { - /// Initializes a new instance of UserIdentityListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UserIdentityListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UserIdentityListResult. + /// Initializes a new instance of . /// User Identity values. /// Total record count number across all pages. /// Next page link if any. - internal UserIdentityListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UserIdentityListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// User Identity values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.Serialization.cs index a1eeac8daa59..6afe2c71fc6c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApiManagement; namespace Azure.ResourceManager.ApiManagement.Models { - internal partial class UserListResult + internal partial class UserListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UserListResult DeserializeUserListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UserListResult DeserializeUserListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static UserListResult DeserializeUserListResult(JsonElement element) Optional> value = default; Optional count = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static UserListResult DeserializeUserListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UserListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + return new UserListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value, serializedAdditionalRawData); + } + + UserListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.cs index 007a0753ace6..7dd4f24a0a76 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Paged Users list representation. internal partial class UserListResult { - /// Initializes a new instance of UserListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UserListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UserListResult. + /// Initializes a new instance of . /// Page values. /// Total record count number across all pages. /// Next page link if any. - internal UserListResult(IReadOnlyList value, long? count, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UserListResult(IReadOnlyList value, long? count, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; Count = count; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Page values. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.Serialization.cs index 561d4ea961b9..ffc0faa0891f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class UserTokenContent : IUtf8JsonSerializable + public partial class UserTokenContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,7 +36,119 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExpireOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UserTokenContent DeserializeUserTokenContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional keyType = default; + Optional expiry = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("keyType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyType = property0.Value.GetString().ToTokenGenerationUsedKeyType(); + continue; + } + if (property0.NameEquals("expiry"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiry = property0.Value.GetDateTimeOffset("O"); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserTokenContent(Optional.ToNullable(keyType), Optional.ToNullable(expiry), serializedAdditionalRawData); + } + + UserTokenContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserTokenContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserTokenContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserTokenContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserTokenContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserTokenContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserTokenContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.cs index 347ba5bf6a6f..32e5a29a1401 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenContent.cs @@ -6,17 +6,35 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { /// Get User Token parameters. public partial class UserTokenContent { - /// Initializes a new instance of UserTokenContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UserTokenContent() { } + /// Initializes a new instance of . + /// The Key to be used to generate token for user. + /// + /// The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + /// + /// + /// Keeps track of any properties unknown to the library. + internal UserTokenContent(TokenGenerationUsedKeyType? keyType, DateTimeOffset? expireOn, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + ExpireOn = expireOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The Key to be used to generate token for user. public TokenGenerationUsedKeyType? KeyType { get; set; } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.Serialization.cs index 4a5646f5053a..80896e1ed106 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class UserTokenResult + public partial class UserTokenResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UserTokenResult DeserializeUserTokenResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UserTokenResult DeserializeUserTokenResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -26,8 +60,61 @@ internal static UserTokenResult DeserializeUserTokenResult(JsonElement element) value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UserTokenResult(value.Value); + return new UserTokenResult(value.Value, serializedAdditionalRawData); + } + + UserTokenResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserTokenResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserTokenResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserTokenResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserTokenResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserTokenResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserTokenResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.cs index efbfaf4681c9..b845caa14c5b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/UserTokenResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Get User Token response details. public partial class UserTokenResult { - /// Initializes a new instance of UserTokenResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UserTokenResult() { } - /// Initializes a new instance of UserTokenResult. + /// Initializes a new instance of . /// Shared Access Authorization token for the User. - internal UserTokenResult(string value) + /// Keeps track of any properties unknown to the library. + internal UserTokenResult(string value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Shared Access Authorization token for the User. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.Serialization.cs index 21e00bc08d79..c65ce4c6aa46 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.Serialization.cs @@ -6,26 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class VirtualNetworkConfiguration : IUtf8JsonSerializable + public partial class VirtualNetworkConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SubnetResourceId)) { writer.WritePropertyName("subnetResourceId"u8); writer.WriteStringValue(SubnetResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualNetworkConfiguration DeserializeVirtualNetworkConfiguration(JsonElement element) + internal static VirtualNetworkConfiguration DeserializeVirtualNetworkConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +54,7 @@ internal static VirtualNetworkConfiguration DeserializeVirtualNetworkConfigurati Optional vnetid = default; Optional subnetname = default; Optional subnetResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vnetid"u8)) @@ -58,8 +80,61 @@ internal static VirtualNetworkConfiguration DeserializeVirtualNetworkConfigurati subnetResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualNetworkConfiguration(Optional.ToNullable(vnetid), subnetname.Value, subnetResourceId.Value, serializedAdditionalRawData); + } + + VirtualNetworkConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualNetworkConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualNetworkConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualNetworkConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualNetworkConfiguration model) + { + if (model is null) + { + return null; } - return new VirtualNetworkConfiguration(Optional.ToNullable(vnetid), subnetname.Value, subnetResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualNetworkConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualNetworkConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs index f713fe3385fb..36a0f28cff5f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApiManagement.Models @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ApiManagement.Models /// Configuration of a virtual network to which API Management service is deployed. public partial class VirtualNetworkConfiguration { - /// Initializes a new instance of VirtualNetworkConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualNetworkConfiguration() { } - /// Initializes a new instance of VirtualNetworkConfiguration. + /// Initializes a new instance of . /// The virtual network ID. This is typically a GUID. Expect a null GUID by default. /// The name of the subnet. /// The full resource ID of a subnet in a virtual network to deploy the API Management service in. - internal VirtualNetworkConfiguration(Guid? vnetId, string subnetname, ResourceIdentifier subnetResourceId) + /// Keeps track of any properties unknown to the library. + internal VirtualNetworkConfiguration(Guid? vnetId, string subnetname, ResourceIdentifier subnetResourceId, Dictionary serializedAdditionalRawData) { VnetId = vnetId; Subnetname = subnetname; SubnetResourceId = subnetResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The virtual network ID. This is typically a GUID. Expect a null GUID by default. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.Serialization.cs index eadd9170b4a1..14cd6dd3a692 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApiManagement.Models { - public partial class X509CertificateName : IUtf8JsonSerializable + public partial class X509CertificateName : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("issuerCertificateThumbprint"u8); writer.WriteStringValue(IssuerCertificateThumbprint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static X509CertificateName DeserializeX509CertificateName(JsonElement element) + internal static X509CertificateName DeserializeX509CertificateName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional issuerCertificateThumbprint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static X509CertificateName DeserializeX509CertificateName(JsonElement e issuerCertificateThumbprint = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new X509CertificateName(name.Value, issuerCertificateThumbprint.Value, serializedAdditionalRawData); + } + + X509CertificateName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeX509CertificateName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + X509CertificateName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeX509CertificateName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(X509CertificateName model) + { + if (model is null) + { + return null; } - return new X509CertificateName(name.Value, issuerCertificateThumbprint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator X509CertificateName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeX509CertificateName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.cs index 3a26495ac7e1..58efe84b9d85 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/X509CertificateName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApiManagement.Models { /// Properties of server X509Names. public partial class X509CertificateName { - /// Initializes a new instance of X509CertificateName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public X509CertificateName() { } - /// Initializes a new instance of X509CertificateName. + /// Initializes a new instance of . /// Common Name of the Certificate. /// Thumbprint for the Issuer of the Certificate. - internal X509CertificateName(string name, string issuerCertificateThumbprint) + /// Keeps track of any properties unknown to the library. + internal X509CertificateName(string name, string issuerCertificateThumbprint, Dictionary serializedAdditionalRawData) { Name = name; IssuerCertificateThumbprint = issuerCertificateThumbprint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Common Name of the Certificate. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyContractData.cs index 0477fc7d9b00..4423762c9cdb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyContractData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class PolicyContractData : ResourceData { - /// Initializes a new instance of PolicyContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PolicyContractData() { } - /// Initializes a new instance of PolicyContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Contents of the Policy as defined by the format. /// Format of the policyContent. - internal PolicyContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, PolicyContentFormat? format) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PolicyContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, PolicyContentFormat? format, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Value = value; Format = format; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Contents of the Policy as defined by the format. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs index db864985bfcc..e6a1751b75b8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs @@ -355,9 +355,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -458,9 +456,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs index 64f94382dd4e..11ae15f0f829 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs @@ -375,9 +375,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs index f03fe5ed7a03..37334256dd1b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs @@ -375,9 +375,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs index f6ead96eb010..5572c40544b2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs @@ -367,9 +367,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -470,9 +468,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs index 2a96fc8ab6a7..8cb1413adf1b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreatePerformConnectivityCheckAsyncRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs index c54b5fe7924d..28d372c1cdd1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateRestoreRequest(string subscriptionId, string resource request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -134,9 +132,7 @@ internal HttpMessage CreateBackupRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -212,9 +208,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -292,9 +286,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -740,9 +732,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -888,9 +878,7 @@ internal HttpMessage CreateApplyNetworkConfigurationUpdatesRequest(string subscr if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs index b536472bf818..b61927169d97 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs @@ -359,9 +359,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs index c4d7dea2c4ec..ac699d915ae7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs @@ -361,9 +361,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -464,9 +462,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs index 586fcd8f031d..fd6ba28965a4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs @@ -339,9 +339,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs index 744d7fe91a3b..f4a29e141864 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs @@ -355,9 +355,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -458,9 +456,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs index 3acb6eb34be0..0517081de1df 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs @@ -347,9 +347,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -436,9 +434,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs index 6146360a2007..af9f6b9ad646 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs @@ -355,9 +355,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs index 204b74a12868..88fe782234d2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs @@ -355,9 +355,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs index e78081ceb08e..a54e0d50f2bc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs index f4beb4291e8c..6f31bc975179 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs index d237bf27a89d..ffba24b49215 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -608,9 +604,7 @@ internal HttpMessage CreateReconnectRequest(string subscriptionId, string resour if (backendReconnectContract != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(backendReconnectContract); - request.Content = content; + request.Content = backendReconnectContract; } _userAgent.Apply(message); return message; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs index dca89992c924..ef8db96888a5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs @@ -329,9 +329,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -426,9 +424,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs index 53723e58eb02..b265db77ab62 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs @@ -341,9 +341,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs index 3f057b998be4..40b3e3cea673 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs @@ -224,9 +224,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -307,9 +305,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs index 89bd396dc6ee..918eed7f6d5a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs index 949227840259..1dc948668962 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs @@ -331,9 +331,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -426,9 +424,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs index 9892695c0c2f..05dbddb7cca4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs @@ -259,9 +259,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r if (associationContract != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(associationContract); - request.Content = content; + request.Content = associationContract; } _userAgent.Apply(message); return message; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs index afaa4c9048e3..70726de74f57 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs @@ -355,9 +355,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs index 2260f81d4d88..d3ee2c894165 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs @@ -355,9 +355,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs index 3b1b01e2632b..d9b990bcb178 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -691,9 +687,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -774,9 +768,7 @@ internal HttpMessage CreateGenerateTokenRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(gatewayTokenRequestContract); - request.Content = content; + request.Content = gatewayTokenRequestContract; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs index fd541b91c8c4..76912ba571c7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs index d2b9d5b8f780..ea369f12c719 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs index 378aa6d7cccd..71b5563857c9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs @@ -313,9 +313,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -408,9 +406,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs index 31ff806591be..b3862ebf413b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs index 77ffcce7803f..6f7bdbc96d29 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs @@ -341,9 +341,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -430,9 +428,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs index 9440dca4fcfb..46966bae0de6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs @@ -335,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs index bfcb2325068f..2f068ab1186c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs @@ -319,9 +319,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs index a389f86a9db9..5d174d9d4a3d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs @@ -347,9 +347,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs index 334c6d04d202..332cfba6fdd0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs index e678181bea6d..e0975635a70f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs @@ -339,9 +339,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs index 984cc09406b0..85c63b1b9826 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs @@ -347,9 +347,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -444,9 +442,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs index 40b84a3b0a5d..12b6b3cd606f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs @@ -140,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs index a10b185faa43..46a965be1372 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs @@ -148,9 +148,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs index deb05abf569f..38247955aca7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -306,9 +304,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs index 31a99a99d471..507f60b511df 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -306,9 +304,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs index 74c8efda0bb8..72dcdf8b945f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs @@ -343,9 +343,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -460,9 +458,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs index 44f31bfd504a..e079380e3460 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs @@ -1772,9 +1772,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1869,9 +1867,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs index 2975ded82549..6dab7ddc1edd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs @@ -316,9 +316,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -409,9 +407,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs index c6efc569762b..22e578b3117a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs @@ -57,9 +57,7 @@ internal HttpMessage CreateDeployRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateSaveRequest(string subscriptionId, string resourceGro request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -223,9 +219,7 @@ internal HttpMessage CreateValidateRequest(string subscriptionId, string resourc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs index 21bad12034a8..4eb23fd731bd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs @@ -345,9 +345,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -444,9 +442,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("If-Match", ifMatch); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -721,9 +717,7 @@ internal HttpMessage CreateGetSharedAccessTokenRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/SubscriptionContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/SubscriptionContractData.cs index 6a3439bc5066..3c08771f1cae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/SubscriptionContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/SubscriptionContractData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class SubscriptionContractData : ResourceData { - /// Initializes a new instance of SubscriptionContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SubscriptionContractData() { } - /// Initializes a new instance of SubscriptionContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -56,7 +60,8 @@ public SubscriptionContractData() /// Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// Optional subscription comment added by an administrator when the state is changed to the 'rejected'. /// Determines whether tracing is enabled. - internal SubscriptionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string ownerId, string scope, string displayName, SubscriptionState? state, DateTimeOffset? createdOn, DateTimeOffset? startOn, DateTimeOffset? expireOn, DateTimeOffset? endOn, DateTimeOffset? notifiesOn, string primaryKey, string secondaryKey, string stateComment, bool? allowTracing) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SubscriptionContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string ownerId, string scope, string displayName, SubscriptionState? state, DateTimeOffset? createdOn, DateTimeOffset? startOn, DateTimeOffset? expireOn, DateTimeOffset? endOn, DateTimeOffset? notifiesOn, string primaryKey, string secondaryKey, string stateComment, bool? allowTracing, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OwnerId = ownerId; Scope = scope; @@ -71,6 +76,7 @@ internal SubscriptionContractData(ResourceIdentifier id, string name, ResourceTy SecondaryKey = secondaryKey; StateComment = stateComment; AllowTracing = allowTracing; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagContractData.cs index b40d84e48c94..3f20b4db1f3c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagContractData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,20 +18,25 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class TagContractData : ResourceData { - /// Initializes a new instance of TagContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TagContractData() { } - /// Initializes a new instance of TagContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Tag name. - internal TagContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal TagContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Tag name. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs index ce3193d82d29..2141137967db 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoCollection.cs @@ -220,7 +220,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _tenantAccessInfoTenantAccessRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _tenantAccessInfoTenantAccessRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TenantAccessInfoResource(Client, TenantAccessInfoData.DeserializeTenantAccessInfoData(e)), _tenantAccessInfoTenantAccessClientDiagnostics, Pipeline, "TenantAccessInfoCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new TenantAccessInfoResource(Client, TenantAccessInfoData.DeserializeTenantAccessInfoData(e)), _tenantAccessInfoTenantAccessClientDiagnostics, Pipeline, "TenantAccessInfoCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -243,7 +243,7 @@ public virtual Pageable GetAll(string filter = null, C { HttpMessage FirstPageRequest(int? pageSizeHint) => _tenantAccessInfoTenantAccessRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _tenantAccessInfoTenantAccessRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TenantAccessInfoResource(Client, TenantAccessInfoData.DeserializeTenantAccessInfoData(e)), _tenantAccessInfoTenantAccessClientDiagnostics, Pipeline, "TenantAccessInfoCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new TenantAccessInfoResource(Client, TenantAccessInfoData.DeserializeTenantAccessInfoData(e)), _tenantAccessInfoTenantAccessClientDiagnostics, Pipeline, "TenantAccessInfoCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoData.cs index 851da24089f0..4b7f97461aa7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class TenantAccessInfoData : ResourceData { - /// Initializes a new instance of TenantAccessInfoData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TenantAccessInfoData() { } - /// Initializes a new instance of TenantAccessInfoData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,11 +34,13 @@ public TenantAccessInfoData() /// Access Information type ('access' or 'gitAccess'). /// Principal (User) Identifier. /// Determines whether direct access is enabled. - internal TenantAccessInfoData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string accessInfoType, string principalId, bool? isDirectAccessEnabled) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal TenantAccessInfoData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string accessInfoType, string principalId, bool? isDirectAccessEnabled, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { AccessInfoType = accessInfoType; PrincipalId = principalId; IsDirectAccessEnabled = isDirectAccessEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Access Information type ('access' or 'gitAccess'). diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/UserContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/UserContractData.cs index 5cb1dd2869f5..d42b73c82988 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/UserContractData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/UserContractData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.ApiManagement /// public partial class UserContractData : ResourceData { - /// Initializes a new instance of UserContractData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UserContractData() { Identities = new ChangeTrackingList(); Groups = new ChangeTrackingList(); } - /// Initializes a new instance of UserContractData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +45,8 @@ public UserContractData() /// /// /// Collection of groups user is part of. - internal UserContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementUserState? state, string note, IList identities, string firstName, string lastName, string email, DateTimeOffset? registriesOn, IReadOnlyList groups) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal UserContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementUserState? state, string note, IList identities, string firstName, string lastName, string email, DateTimeOffset? registriesOn, IReadOnlyList groups, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { State = state; Note = note; @@ -52,6 +56,7 @@ internal UserContractData(ResourceIdentifier id, string name, ResourceType resou Email = email; RegistriesOn = registriesOn; Groups = groups; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ArmAppComplianceAutomationModelFactory.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ArmAppComplianceAutomationModelFactory.cs index cc6e3ade7ea5..681824d9cddb 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ArmAppComplianceAutomationModelFactory.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ArmAppComplianceAutomationModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Model factory for models. public static partial class ArmAppComplianceAutomationModelFactory { - /// Initializes a new instance of ReportResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -26,10 +26,10 @@ public static partial class ArmAppComplianceAutomationModelFactory /// A new instance for mocking. public static ReportResourceData ReportResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ReportProperties properties = null) { - return new ReportResourceData(id, name, resourceType, systemData, properties); + return new ReportResourceData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of ReportProperties. + /// Initializes a new instance of . /// Report id in database. /// Report status. /// Report's tenant id. @@ -52,20 +52,20 @@ public static ReportProperties ReportProperties(string id = null, ReportStatus? subscriptions ??= new List(); resources ??= new List(); - return new ReportProperties(id, status, tenantId, reportName, offerGuid, timeZone, triggerOn, nextTriggerOn, lastTriggerOn, subscriptions?.ToList(), resources?.ToList(), complianceStatusM365 != null ? new ReportComplianceStatus(complianceStatusM365) : null, provisioningState); + return new ReportProperties(id, status, tenantId, reportName, offerGuid, timeZone, triggerOn, nextTriggerOn, lastTriggerOn, subscriptions?.ToList(), resources?.ToList(), complianceStatusM365 != null ? new ReportComplianceStatus(complianceStatusM365, new Dictionary()) : null, provisioningState, default); } - /// Initializes a new instance of OverviewStatus. + /// Initializes a new instance of . /// The count of all passed full automation control. /// The count of all failed full automation control. /// The count of all manual control. /// A new instance for mocking. public static OverviewStatus OverviewStatus(int? passedCount = null, int? failedCount = null, int? manualCount = null) { - return new OverviewStatus(passedCount, failedCount, manualCount); + return new OverviewStatus(passedCount, failedCount, manualCount, default); } - /// Initializes a new instance of SnapshotResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -74,10 +74,10 @@ public static OverviewStatus OverviewStatus(int? passedCount = null, int? failed /// A new instance for mocking. public static SnapshotResourceData SnapshotResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SnapshotProperties properties = null) { - return new SnapshotResourceData(id, name, resourceType, systemData, properties); + return new SnapshotResourceData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of SnapshotProperties. + /// Initializes a new instance of . /// Snapshot id in the database. /// Snapshot name. /// The timestamp of resource creation (UTC). @@ -90,10 +90,10 @@ public static SnapshotProperties SnapshotProperties(string id = null, string sna { complianceResults ??= new List(); - return new SnapshotProperties(id, snapshotName, createdOn, provisioningState, reportProperties, reportSystemData, complianceResults?.ToList()); + return new SnapshotProperties(id, snapshotName, createdOn, provisioningState, reportProperties, reportSystemData, complianceResults?.ToList(), default); } - /// Initializes a new instance of ComplianceResult. + /// Initializes a new instance of . /// The name of the compliance. e.g. "M365". /// List of categories. /// A new instance for mocking. @@ -101,10 +101,10 @@ public static ComplianceResult ComplianceResult(string complianceName = null, IE { categories ??= new List(); - return new ComplianceResult(complianceName, categories?.ToList()); + return new ComplianceResult(complianceName, categories?.ToList(), default); } - /// Initializes a new instance of Category. + /// Initializes a new instance of . /// The name of the compliance category. e.g. "Operational Security". /// The category type. /// Category status. @@ -114,10 +114,10 @@ public static Category Category(string categoryName = null, CategoryType? catego { controlFamilies ??= new List(); - return new Category(categoryName, categoryType, categoryStatus, controlFamilies?.ToList()); + return new Category(categoryName, categoryType, categoryStatus, controlFamilies?.ToList(), default); } - /// Initializes a new instance of ControlFamily. + /// Initializes a new instance of . /// The name of the control family. e.g. "Malware Protection - Anti-Virus". /// The control family type. /// Control family status. @@ -127,10 +127,10 @@ public static ControlFamily ControlFamily(string familyName = null, ControlFamil { controls ??= new List(); - return new ControlFamily(familyName, familyType, familyStatus, controls?.ToList()); + return new ControlFamily(familyName, familyType, familyStatus, controls?.ToList(), default); } - /// Initializes a new instance of Control. + /// Initializes a new instance of . /// The Id of the control. e.g. "Operational Security#10". /// The short name of the control. e.g. "Unsupported OS and Software.". /// The full name of the control. e.g. "Validate that unsupported operating systems and software components are not in use.". @@ -144,10 +144,10 @@ public static Control Control(string controlId = null, string controlShortName = { assessments ??= new List(); - return new Control(controlId, controlShortName, controlFullName, controlType, controlDescription, controlDescriptionHyperLink, controlStatus, assessments?.ToList()); + return new Control(controlId, controlShortName, controlFullName, controlType, controlDescription, controlDescriptionHyperLink, controlStatus, assessments?.ToList(), default); } - /// Initializes a new instance of Assessment. + /// Initializes a new instance of . /// The name of the assessment. /// The severity level of this assessment. /// The description of the assessment. @@ -160,10 +160,10 @@ public static Assessment Assessment(string name = null, AssessmentSeverity? seve { resourceList ??= new List(); - return new Assessment(name, severity, description, remediation, isPass, policyId, resourceList?.ToList()); + return new Assessment(name, severity, description, remediation, isPass, policyId, resourceList?.ToList(), default); } - /// Initializes a new instance of AssessmentResource. + /// Initializes a new instance of . /// The Id of the resource. /// Resource status. /// The reason for the N/A resource. @@ -171,10 +171,20 @@ public static Assessment Assessment(string name = null, AssessmentSeverity? seve /// A new instance for mocking. public static AssessmentResource AssessmentResource(string resourceId = null, ResourceStatus? resourceStatus = null, string reason = null, string statusChangeDate = null) { - return new AssessmentResource(resourceId, resourceStatus, reason, statusChangeDate); + return new AssessmentResource(resourceId, resourceStatus, reason, statusChangeDate, default); } - /// Initializes a new instance of DownloadResponse. + /// Initializes a new instance of . + /// Tenant id. + /// Indicates the download type. + /// The offerGuid which mapping to the reports. + /// A new instance for mocking. + public static SnapshotDownloadContent SnapshotDownloadContent(string reportCreatorTenantId = null, DownloadType downloadType = default, string offerGuid = null) + { + return new SnapshotDownloadContent(reportCreatorTenantId, downloadType, offerGuid, default); + } + + /// Initializes a new instance of . /// List of the reports. /// List of the compliance result. /// compliance pdf report. @@ -185,10 +195,10 @@ public static DownloadResponse DownloadResponse(IEnumerable resour resourceList ??= new List(); complianceReport ??= new List(); - return new DownloadResponse(resourceList?.ToList(), complianceReport?.ToList(), compliancePdfReportSasUri != null ? new DownloadResponseCompliancePdfReport(compliancePdfReportSasUri) : null, complianceDetailedPdfReportSasUri != null ? new DownloadResponseComplianceDetailedPdfReport(complianceDetailedPdfReportSasUri) : null); + return new DownloadResponse(resourceList?.ToList(), complianceReport?.ToList(), compliancePdfReportSasUri != null ? new DownloadResponseCompliancePdfReport(compliancePdfReportSasUri, new Dictionary()) : null, complianceDetailedPdfReportSasUri != null ? new DownloadResponseComplianceDetailedPdfReport(complianceDetailedPdfReportSasUri, new Dictionary()) : null, default); } - /// Initializes a new instance of ResourceItem. + /// Initializes a new instance of . /// The subscription Id of this resource. /// The resource group name of this resource. /// The resource type of this resource. @@ -196,10 +206,10 @@ public static DownloadResponse DownloadResponse(IEnumerable resour /// A new instance for mocking. public static ResourceItem ResourceItem(string subscriptionId = null, string resourceGroup = null, string resourceType = null, string resourceId = null) { - return new ResourceItem(subscriptionId, resourceGroup, resourceType, resourceId); + return new ResourceItem(subscriptionId, resourceGroup, resourceType, resourceId, default); } - /// Initializes a new instance of ComplianceReportItem. + /// Initializes a new instance of . /// The category name. /// The control Id - e.g. "1". /// The control name. @@ -216,7 +226,7 @@ public static ResourceItem ResourceItem(string subscriptionId = null, string res /// A new instance for mocking. public static ComplianceReportItem ComplianceReportItem(string categoryName = null, string controlId = null, string controlName = null, ControlType? controlType = null, ComplianceState? complianceState = null, string policyId = null, string policyDisplayName = null, string policyDescription = null, string subscriptionId = null, string resourceGroup = null, string resourceType = null, string resourceId = null, string statusChangeDate = null) { - return new ComplianceReportItem(categoryName, controlId, controlName, controlType, complianceState, policyId, policyDisplayName, policyDescription, subscriptionId, resourceGroup, resourceType, resourceId, statusChangeDate); + return new ComplianceReportItem(categoryName, controlId, controlName, controlType, complianceState, policyId, policyDisplayName, policyDescription, subscriptionId, resourceGroup, resourceType, resourceId, statusChangeDate, default); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.Serialization.cs index 3360feaf1a7c..8358982c9d5e 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class Assessment + public partial class Assessment : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Assessment DeserializeAssessment(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Assessment DeserializeAssessment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +53,7 @@ internal static Assessment DeserializeAssessment(JsonElement element) Optional isPass = default; Optional policyId = default; Optional> resourceList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -80,8 +108,61 @@ internal static Assessment DeserializeAssessment(JsonElement element) resourceList = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Assessment(name.Value, Optional.ToNullable(severity), description.Value, remediation.Value, Optional.ToNullable(isPass), policyId.Value, Optional.ToList(resourceList)); + return new Assessment(name.Value, Optional.ToNullable(severity), description.Value, remediation.Value, Optional.ToNullable(isPass), policyId.Value, Optional.ToList(resourceList), serializedAdditionalRawData); + } + + Assessment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssessment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Assessment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssessment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Assessment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Assessment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssessment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.cs index b28c19288cf2..8f14041d7fcd 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Assessment.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// A class represent the assessment. public partial class Assessment { - /// Initializes a new instance of Assessment. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Assessment() { ResourceList = new ChangeTrackingList(); } - /// Initializes a new instance of Assessment. + /// Initializes a new instance of . /// The name of the assessment. /// The severity level of this assessment. /// The description of the assessment. @@ -27,7 +31,8 @@ internal Assessment() /// Indicates whether all the resource(s) are compliant. /// The policy id mapping to this assessment. /// List of resource assessments. - internal Assessment(string name, AssessmentSeverity? severity, string description, string remediation, IsPass? isPass, string policyId, IReadOnlyList resourceList) + /// Keeps track of any properties unknown to the library. + internal Assessment(string name, AssessmentSeverity? severity, string description, string remediation, IsPass? isPass, string policyId, IReadOnlyList resourceList, Dictionary serializedAdditionalRawData) { Name = name; Severity = severity; @@ -36,6 +41,7 @@ internal Assessment(string name, AssessmentSeverity? severity, string descriptio IsPass = isPass; PolicyId = policyId; ResourceList = resourceList; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the assessment. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.Serialization.cs index d21434802cff..577692e9d50a 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class AssessmentResource + public partial class AssessmentResource : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssessmentResource DeserializeAssessmentResource(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssessmentResource DeserializeAssessmentResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static AssessmentResource DeserializeAssessmentResource(JsonElement ele Optional resourceStatus = default; Optional reason = default; Optional statusChangeDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -48,8 +77,61 @@ internal static AssessmentResource DeserializeAssessmentResource(JsonElement ele statusChangeDate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssessmentResource(resourceId.Value, Optional.ToNullable(resourceStatus), reason.Value, statusChangeDate.Value); + return new AssessmentResource(resourceId.Value, Optional.ToNullable(resourceStatus), reason.Value, statusChangeDate.Value, serializedAdditionalRawData); + } + + AssessmentResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssessmentResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssessmentResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssessmentResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssessmentResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssessmentResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssessmentResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.cs index da11bc837551..608cb7679a44 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/AssessmentResource.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// A class represent the assessment resource. public partial class AssessmentResource { - /// Initializes a new instance of AssessmentResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AssessmentResource() { } - /// Initializes a new instance of AssessmentResource. + /// Initializes a new instance of . /// The Id of the resource. /// Resource status. /// The reason for the N/A resource. /// The status change date for the resource. For unavailable date, set it as N/A. - internal AssessmentResource(string resourceId, ResourceStatus? resourceStatus, string reason, string statusChangeDate) + /// Keeps track of any properties unknown to the library. + internal AssessmentResource(string resourceId, ResourceStatus? resourceStatus, string reason, string statusChangeDate, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; ResourceStatus = resourceStatus; Reason = reason; StatusChangeDate = statusChangeDate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Id of the resource. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.Serialization.cs index 08d0a0bcfae6..da3c3632bfb5 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class Category + public partial class Category : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Category DeserializeCategory(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Category DeserializeCategory(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static Category DeserializeCategory(JsonElement element) Optional categoryType = default; Optional categoryStatus = default; Optional> controlFamilies = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("categoryName"u8)) @@ -62,8 +90,61 @@ internal static Category DeserializeCategory(JsonElement element) controlFamilies = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Category(categoryName.Value, Optional.ToNullable(categoryType), Optional.ToNullable(categoryStatus), Optional.ToList(controlFamilies)); + return new Category(categoryName.Value, Optional.ToNullable(categoryType), Optional.ToNullable(categoryStatus), Optional.ToList(controlFamilies), serializedAdditionalRawData); + } + + Category IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCategory(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Category IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCategory(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Category model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Category(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCategory(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.cs index 9d2d6e529050..b97f13730601 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Category.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// A class represent the compliance category. public partial class Category { - /// Initializes a new instance of Category. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Category() { ControlFamilies = new ChangeTrackingList(); } - /// Initializes a new instance of Category. + /// Initializes a new instance of . /// The name of the compliance category. e.g. "Operational Security". /// The category type. /// Category status. /// List of control families. - internal Category(string categoryName, CategoryType? categoryType, CategoryStatus? categoryStatus, IReadOnlyList controlFamilies) + /// Keeps track of any properties unknown to the library. + internal Category(string categoryName, CategoryType? categoryType, CategoryStatus? categoryStatus, IReadOnlyList controlFamilies, Dictionary serializedAdditionalRawData) { CategoryName = categoryName; CategoryType = categoryType; CategoryStatus = categoryStatus; ControlFamilies = controlFamilies; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the compliance category. e.g. "Operational Security". diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.Serialization.cs index 64d7595e0dac..203d9ff80e7f 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ComplianceReportItem + public partial class ComplianceReportItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComplianceReportItem DeserializeComplianceReportItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComplianceReportItem DeserializeComplianceReportItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +59,7 @@ internal static ComplianceReportItem DeserializeComplianceReportItem(JsonElement Optional resourceType = default; Optional resourceId = default; Optional statusChangeDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("categoryName"u8)) @@ -106,8 +135,61 @@ internal static ComplianceReportItem DeserializeComplianceReportItem(JsonElement statusChangeDate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComplianceReportItem(categoryName.Value, controlId.Value, controlName.Value, Optional.ToNullable(controlType), Optional.ToNullable(complianceState), policyId.Value, policyDisplayName.Value, policyDescription.Value, subscriptionId.Value, resourceGroup.Value, resourceType.Value, resourceId.Value, statusChangeDate.Value); + return new ComplianceReportItem(categoryName.Value, controlId.Value, controlName.Value, Optional.ToNullable(controlType), Optional.ToNullable(complianceState), policyId.Value, policyDisplayName.Value, policyDescription.Value, subscriptionId.Value, resourceGroup.Value, resourceType.Value, resourceId.Value, statusChangeDate.Value, serializedAdditionalRawData); + } + + ComplianceReportItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComplianceReportItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComplianceReportItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComplianceReportItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComplianceReportItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComplianceReportItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComplianceReportItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.cs index c883fca930e7..f56ec5d8dae9 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceReportItem.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// Object that includes all the content for single compliance result. public partial class ComplianceReportItem { - /// Initializes a new instance of ComplianceReportItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComplianceReportItem() { } - /// Initializes a new instance of ComplianceReportItem. + /// Initializes a new instance of . /// The category name. /// The control Id - e.g. "1". /// The control name. @@ -29,7 +35,8 @@ internal ComplianceReportItem() /// The compliance result mapped resource type. /// The compliance result mapped resource Id - e.g. "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1". /// The compliance result last changed date - e.g. "2022-10-24T02:55:16.3274379Z". For unavailable date, set it as "N/A". - internal ComplianceReportItem(string categoryName, string controlId, string controlName, ControlType? controlType, ComplianceState? complianceState, string policyId, string policyDisplayName, string policyDescription, string subscriptionId, string resourceGroup, string resourceType, string resourceId, string statusChangeDate) + /// Keeps track of any properties unknown to the library. + internal ComplianceReportItem(string categoryName, string controlId, string controlName, ControlType? controlType, ComplianceState? complianceState, string policyId, string policyDisplayName, string policyDescription, string subscriptionId, string resourceGroup, string resourceType, string resourceId, string statusChangeDate, Dictionary serializedAdditionalRawData) { CategoryName = categoryName; ControlId = controlId; @@ -44,6 +51,7 @@ internal ComplianceReportItem(string categoryName, string controlId, string cont ResourceType = resourceType; ResourceId = resourceId; StatusChangeDate = statusChangeDate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The category name. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.Serialization.cs index dab073b102c5..ae23a234287a 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ComplianceResult + public partial class ComplianceResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComplianceResult DeserializeComplianceResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComplianceResult DeserializeComplianceResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional complianceName = default; Optional> categories = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("complianceName"u8)) @@ -42,8 +70,61 @@ internal static ComplianceResult DeserializeComplianceResult(JsonElement element categories = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComplianceResult(complianceName.Value, Optional.ToList(categories)); + return new ComplianceResult(complianceName.Value, Optional.ToList(categories), serializedAdditionalRawData); + } + + ComplianceResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComplianceResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComplianceResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComplianceResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComplianceResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComplianceResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComplianceResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.cs index bf0e2bd985f1..2be0a549175c 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ComplianceResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// A class represent the compliance result. public partial class ComplianceResult { - /// Initializes a new instance of ComplianceResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComplianceResult() { Categories = new ChangeTrackingList(); } - /// Initializes a new instance of ComplianceResult. + /// Initializes a new instance of . /// The name of the compliance. e.g. "M365". /// List of categories. - internal ComplianceResult(string complianceName, IReadOnlyList categories) + /// Keeps track of any properties unknown to the library. + internal ComplianceResult(string complianceName, IReadOnlyList categories, Dictionary serializedAdditionalRawData) { ComplianceName = complianceName; Categories = categories; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the compliance. e.g. "M365". diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.Serialization.cs index 089f3d440950..f5f822569d02 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class Control + public partial class Control : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Control DeserializeControl(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Control DeserializeControl(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +54,7 @@ internal static Control DeserializeControl(JsonElement element) Optional controlDescriptionHyperLink = default; Optional controlStatus = default; Optional> assessments = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("controlId"u8)) @@ -86,8 +114,61 @@ internal static Control DeserializeControl(JsonElement element) assessments = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Control(controlId.Value, controlShortName.Value, controlFullName.Value, Optional.ToNullable(controlType), controlDescription.Value, controlDescriptionHyperLink.Value, Optional.ToNullable(controlStatus), Optional.ToList(assessments)); + return new Control(controlId.Value, controlShortName.Value, controlFullName.Value, Optional.ToNullable(controlType), controlDescription.Value, controlDescriptionHyperLink.Value, Optional.ToNullable(controlStatus), Optional.ToList(assessments), serializedAdditionalRawData); + } + + Control IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeControl(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Control IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeControl(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Control model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Control(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeControl(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.cs index 898450184058..4486a371f873 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/Control.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// A class represent the control. public partial class Control { - /// Initializes a new instance of Control. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Control() { Assessments = new ChangeTrackingList(); } - /// Initializes a new instance of Control. + /// Initializes a new instance of . /// The Id of the control. e.g. "Operational Security#10". /// The short name of the control. e.g. "Unsupported OS and Software.". /// The full name of the control. e.g. "Validate that unsupported operating systems and software components are not in use.". @@ -28,7 +32,8 @@ internal Control() /// The hyper link to the control's description'. /// Control status. /// List of assessments. - internal Control(string controlId, string controlShortName, string controlFullName, ControlType? controlType, string controlDescription, string controlDescriptionHyperLink, ControlStatus? controlStatus, IReadOnlyList assessments) + /// Keeps track of any properties unknown to the library. + internal Control(string controlId, string controlShortName, string controlFullName, ControlType? controlType, string controlDescription, string controlDescriptionHyperLink, ControlStatus? controlStatus, IReadOnlyList assessments, Dictionary serializedAdditionalRawData) { ControlId = controlId; ControlShortName = controlShortName; @@ -38,6 +43,7 @@ internal Control(string controlId, string controlShortName, string controlFullNa ControlDescriptionHyperLink = controlDescriptionHyperLink; ControlStatus = controlStatus; Assessments = assessments; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Id of the control. e.g. "Operational Security#10". diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.Serialization.cs index 3ffd9af6a65d..567f8ae28868 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ControlFamily + public partial class ControlFamily : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ControlFamily DeserializeControlFamily(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ControlFamily DeserializeControlFamily(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static ControlFamily DeserializeControlFamily(JsonElement element) Optional familyType = default; Optional familyStatus = default; Optional> controls = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("familyName"u8)) @@ -62,8 +90,61 @@ internal static ControlFamily DeserializeControlFamily(JsonElement element) controls = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ControlFamily(familyName.Value, Optional.ToNullable(familyType), Optional.ToNullable(familyStatus), Optional.ToList(controls)); + return new ControlFamily(familyName.Value, Optional.ToNullable(familyType), Optional.ToNullable(familyStatus), Optional.ToList(controls), serializedAdditionalRawData); + } + + ControlFamily IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeControlFamily(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ControlFamily IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeControlFamily(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ControlFamily model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ControlFamily(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeControlFamily(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.cs index 811617482d7a..d8e1d6959bb7 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ControlFamily.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// A class represent the control family. public partial class ControlFamily { - /// Initializes a new instance of ControlFamily. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ControlFamily() { Controls = new ChangeTrackingList(); } - /// Initializes a new instance of ControlFamily. + /// Initializes a new instance of . /// The name of the control family. e.g. "Malware Protection - Anti-Virus". /// The control family type. /// Control family status. /// List of controls. - internal ControlFamily(string familyName, ControlFamilyType? familyType, ControlFamilyStatus? familyStatus, IReadOnlyList controls) + /// Keeps track of any properties unknown to the library. + internal ControlFamily(string familyName, ControlFamilyType? familyType, ControlFamilyStatus? familyStatus, IReadOnlyList controls, Dictionary serializedAdditionalRawData) { FamilyName = familyName; FamilyType = familyType; FamilyStatus = familyStatus; Controls = controls; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the control family. e.g. "Malware Protection - Anti-Virus". diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.Serialization.cs index b0f54664b1d9..5102003d5ef3 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class DownloadResponse + public partial class DownloadResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DownloadResponse DeserializeDownloadResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DownloadResponse DeserializeDownloadResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static DownloadResponse DeserializeDownloadResponse(JsonElement element Optional> complianceReport = default; Optional compliancePdfReport = default; Optional complianceDetailedPdfReport = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceList"u8)) @@ -71,8 +99,61 @@ internal static DownloadResponse DeserializeDownloadResponse(JsonElement element complianceDetailedPdfReport = DownloadResponseComplianceDetailedPdfReport.DeserializeDownloadResponseComplianceDetailedPdfReport(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DownloadResponse(Optional.ToList(resourceList), Optional.ToList(complianceReport), compliancePdfReport.Value, complianceDetailedPdfReport.Value); + return new DownloadResponse(Optional.ToList(resourceList), Optional.ToList(complianceReport), compliancePdfReport.Value, complianceDetailedPdfReport.Value, serializedAdditionalRawData); + } + + DownloadResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDownloadResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DownloadResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDownloadResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DownloadResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DownloadResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDownloadResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.cs index cb6a44877bfb..9613dd35f130 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponse.cs @@ -14,24 +14,29 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Object that includes all the possible response for the download operation. public partial class DownloadResponse { - /// Initializes a new instance of DownloadResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DownloadResponse() { ResourceList = new ChangeTrackingList(); ComplianceReport = new ChangeTrackingList(); } - /// Initializes a new instance of DownloadResponse. + /// Initializes a new instance of . /// List of the reports. /// List of the compliance result. /// compliance pdf report. /// compliance detailed pdf report. - internal DownloadResponse(IReadOnlyList resourceList, IReadOnlyList complianceReport, DownloadResponseCompliancePdfReport compliancePdfReport, DownloadResponseComplianceDetailedPdfReport complianceDetailedPdfReport) + /// Keeps track of any properties unknown to the library. + internal DownloadResponse(IReadOnlyList resourceList, IReadOnlyList complianceReport, DownloadResponseCompliancePdfReport compliancePdfReport, DownloadResponseComplianceDetailedPdfReport complianceDetailedPdfReport, Dictionary serializedAdditionalRawData) { ResourceList = resourceList; ComplianceReport = complianceReport; CompliancePdfReport = compliancePdfReport; ComplianceDetailedPdfReport = complianceDetailedPdfReport; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of the reports. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.Serialization.cs index 714de58a0e19..1dd52c85b618 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.Serialization.cs @@ -6,20 +6,48 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - internal partial class DownloadResponseComplianceDetailedPdfReport + internal partial class DownloadResponseComplianceDetailedPdfReport : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DownloadResponseComplianceDetailedPdfReport DeserializeDownloadResponseComplianceDetailedPdfReport(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DownloadResponseComplianceDetailedPdfReport DeserializeDownloadResponseComplianceDetailedPdfReport(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sasUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sasUri"u8)) @@ -31,8 +59,61 @@ internal static DownloadResponseComplianceDetailedPdfReport DeserializeDownloadR sasUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DownloadResponseComplianceDetailedPdfReport(sasUri.Value); + return new DownloadResponseComplianceDetailedPdfReport(sasUri.Value, serializedAdditionalRawData); + } + + DownloadResponseComplianceDetailedPdfReport IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDownloadResponseComplianceDetailedPdfReport(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DownloadResponseComplianceDetailedPdfReport IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDownloadResponseComplianceDetailedPdfReport(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DownloadResponseComplianceDetailedPdfReport model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DownloadResponseComplianceDetailedPdfReport(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDownloadResponseComplianceDetailedPdfReport(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.cs index 2650484ea25e..a6a1ce2f7dd5 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseComplianceDetailedPdfReport.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// compliance detailed pdf report. internal partial class DownloadResponseComplianceDetailedPdfReport { - /// Initializes a new instance of DownloadResponseComplianceDetailedPdfReport. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DownloadResponseComplianceDetailedPdfReport() { } - /// Initializes a new instance of DownloadResponseComplianceDetailedPdfReport. + /// Initializes a new instance of . /// uri of compliance detailed pdf report. - internal DownloadResponseComplianceDetailedPdfReport(Uri sasUri) + /// Keeps track of any properties unknown to the library. + internal DownloadResponseComplianceDetailedPdfReport(Uri sasUri, Dictionary serializedAdditionalRawData) { SasUri = sasUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// uri of compliance detailed pdf report. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.Serialization.cs index b684a480f929..e3b76dab1333 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.Serialization.cs @@ -6,20 +6,48 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - internal partial class DownloadResponseCompliancePdfReport + internal partial class DownloadResponseCompliancePdfReport : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DownloadResponseCompliancePdfReport DeserializeDownloadResponseCompliancePdfReport(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DownloadResponseCompliancePdfReport DeserializeDownloadResponseCompliancePdfReport(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sasUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sasUri"u8)) @@ -31,8 +59,61 @@ internal static DownloadResponseCompliancePdfReport DeserializeDownloadResponseC sasUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DownloadResponseCompliancePdfReport(sasUri.Value); + return new DownloadResponseCompliancePdfReport(sasUri.Value, serializedAdditionalRawData); + } + + DownloadResponseCompliancePdfReport IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDownloadResponseCompliancePdfReport(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DownloadResponseCompliancePdfReport IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDownloadResponseCompliancePdfReport(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DownloadResponseCompliancePdfReport model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DownloadResponseCompliancePdfReport(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDownloadResponseCompliancePdfReport(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.cs index 372a69912155..1643f759a36a 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/DownloadResponseCompliancePdfReport.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// compliance pdf report. internal partial class DownloadResponseCompliancePdfReport { - /// Initializes a new instance of DownloadResponseCompliancePdfReport. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DownloadResponseCompliancePdfReport() { } - /// Initializes a new instance of DownloadResponseCompliancePdfReport. + /// Initializes a new instance of . /// uri of compliance pdf report. - internal DownloadResponseCompliancePdfReport(Uri sasUri) + /// Keeps track of any properties unknown to the library. + internal DownloadResponseCompliancePdfReport(Uri sasUri, Dictionary serializedAdditionalRawData) { SasUri = sasUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// uri of compliance pdf report. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.Serialization.cs index 11ff26e4eb9f..9bcec6067fa4 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class OverviewStatus + public partial class OverviewStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OverviewStatus DeserializeOverviewStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PassedCount)) + { + writer.WritePropertyName("passedCount"u8); + writer.WriteNumberValue(PassedCount.Value); + } + if (Optional.IsDefined(FailedCount)) + { + writer.WritePropertyName("failedCount"u8); + writer.WriteNumberValue(FailedCount.Value); + } + if (Optional.IsDefined(ManualCount)) + { + writer.WritePropertyName("manualCount"u8); + writer.WriteNumberValue(ManualCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OverviewStatus DeserializeOverviewStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static OverviewStatus DeserializeOverviewStatus(JsonElement element) Optional passedCount = default; Optional failedCount = default; Optional manualCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("passedCount"u8)) @@ -50,8 +94,61 @@ internal static OverviewStatus DeserializeOverviewStatus(JsonElement element) manualCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OverviewStatus(Optional.ToNullable(passedCount), Optional.ToNullable(failedCount), Optional.ToNullable(manualCount)); + return new OverviewStatus(Optional.ToNullable(passedCount), Optional.ToNullable(failedCount), Optional.ToNullable(manualCount), serializedAdditionalRawData); + } + + OverviewStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOverviewStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OverviewStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOverviewStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OverviewStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OverviewStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOverviewStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.cs index 5e2a023f5a0e..aeb4f5a6811a 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/OverviewStatus.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// The overview of the compliance result for one report. public partial class OverviewStatus { - /// Initializes a new instance of OverviewStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OverviewStatus() { } - /// Initializes a new instance of OverviewStatus. + /// Initializes a new instance of . /// The count of all passed full automation control. /// The count of all failed full automation control. /// The count of all manual control. - internal OverviewStatus(int? passedCount, int? failedCount, int? manualCount) + /// Keeps track of any properties unknown to the library. + internal OverviewStatus(int? passedCount, int? failedCount, int? manualCount, Dictionary serializedAdditionalRawData) { PassedCount = passedCount; FailedCount = failedCount; ManualCount = manualCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The count of all passed full automation control. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.Serialization.cs index 3a088bc929c6..d9e9d257a789 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - internal partial class ReportComplianceStatus + internal partial class ReportComplianceStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReportComplianceStatus DeserializeReportComplianceStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(M365)) + { + writer.WritePropertyName("m365"u8); + if (M365 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)M365).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReportComplianceStatus DeserializeReportComplianceStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional m365 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("m365"u8)) @@ -30,8 +71,61 @@ internal static ReportComplianceStatus DeserializeReportComplianceStatus(JsonEle m365 = OverviewStatus.DeserializeOverviewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReportComplianceStatus(m365.Value); + return new ReportComplianceStatus(m365.Value, serializedAdditionalRawData); + } + + ReportComplianceStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportComplianceStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportComplianceStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportComplianceStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportComplianceStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportComplianceStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportComplianceStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.cs index 1762d7fdd500..28a974ea4ee1 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportComplianceStatus.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// A list which includes all the compliance result for one report. internal partial class ReportComplianceStatus { - /// Initializes a new instance of ReportComplianceStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReportComplianceStatus() { } - /// Initializes a new instance of ReportComplianceStatus. + /// Initializes a new instance of . /// The Microsoft 365 certification name. - internal ReportComplianceStatus(OverviewStatus m365) + /// Keeps track of any properties unknown to the library. + internal ReportComplianceStatus(OverviewStatus m365, Dictionary serializedAdditionalRawData) { M365 = m365; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Microsoft 365 certification name. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.Serialization.cs index 03d257104805..dbc337278a5d 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ReportProperties : IUtf8JsonSerializable + public partial class ReportProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OfferGuid)) { @@ -30,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Resources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportProperties DeserializeReportProperties(JsonElement element) + internal static ReportProperties DeserializeReportProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +82,7 @@ internal static ReportProperties DeserializeReportProperties(JsonElement element IList resources = default; Optional complianceStatus = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -160,8 +188,61 @@ internal static ReportProperties DeserializeReportProperties(JsonElement element provisioningState = new ProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportProperties(id.Value, Optional.ToNullable(status), Optional.ToNullable(tenantId), reportName.Value, offerGuid.Value, timeZone, triggerTime, Optional.ToNullable(nextTriggerTime), Optional.ToNullable(lastTriggerTime), Optional.ToList(subscriptions), resources, complianceStatus.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ReportProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportProperties(Response response) + { + if (response is null) + { + return null; } - return new ReportProperties(id.Value, Optional.ToNullable(status), Optional.ToNullable(tenantId), reportName.Value, offerGuid.Value, timeZone, triggerTime, Optional.ToNullable(nextTriggerTime), Optional.ToNullable(lastTriggerTime), Optional.ToList(subscriptions), resources, complianceStatus.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.cs index eca4861af128..21cd1be25ec9 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Report's properties. public partial class ReportProperties { - /// Initializes a new instance of ReportProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Report collection trigger time's time zone, the available list can be obtained by executing "Get-TimeZone -ListAvailable" in PowerShell. /// An example of valid timezone id is "Pacific Standard Time". @@ -34,7 +37,7 @@ public ReportProperties(string timeZone, DateTimeOffset triggerOn, IEnumerable Initializes a new instance of ReportProperties. + /// Initializes a new instance of . /// Report id in database. /// Report status. /// Report's tenant id. @@ -51,7 +54,8 @@ public ReportProperties(string timeZone, DateTimeOffset triggerOn, IEnumerable List of resource data. /// Report compliance status. /// Azure lifecycle management. - internal ReportProperties(string id, ReportStatus? status, Guid? tenantId, string reportName, string offerGuid, string timeZone, DateTimeOffset triggerOn, DateTimeOffset? nextTriggerOn, DateTimeOffset? lastTriggerOn, IReadOnlyList subscriptions, IList resources, ReportComplianceStatus complianceStatus, ProvisioningState? provisioningState) + /// Keeps track of any properties unknown to the library. + internal ReportProperties(string id, ReportStatus? status, Guid? tenantId, string reportName, string offerGuid, string timeZone, DateTimeOffset triggerOn, DateTimeOffset? nextTriggerOn, DateTimeOffset? lastTriggerOn, IReadOnlyList subscriptions, IList resources, ReportComplianceStatus complianceStatus, ProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) { Id = id; Status = status; @@ -66,6 +70,12 @@ internal ReportProperties(string id, ReportStatus? status, Guid? tenantId, strin Resources = resources; ComplianceStatus = complianceStatus; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportProperties() + { } /// Report id in database. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceData.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceData.Serialization.cs index 5a9094a3140a..1f17924cea1a 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceData.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceData.Serialization.cs @@ -5,25 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppComplianceAutomation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppComplianceAutomation { - public partial class ReportResourceData : IUtf8JsonSerializable + public partial class ReportResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportResourceData DeserializeReportResourceData(JsonElement element) + internal static ReportResourceData DeserializeReportResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +62,7 @@ internal static ReportResourceData DeserializeReportResourceData(JsonElement ele string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -64,8 +94,61 @@ internal static ReportResourceData DeserializeReportResourceData(JsonElement ele systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportResourceData(id, name, type, systemData.Value, properties, serializedAdditionalRawData); + } + + ReportResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportResourceData(Response response) + { + if (response is null) + { + return null; } - return new ReportResourceData(id, name, type, systemData.Value, properties); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.Serialization.cs index bc6f80817c44..79cee587bb69 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppComplianceAutomation; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - internal partial class ReportResourceList + internal partial class ReportResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReportResourceList DeserializeReportResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReportResourceList DeserializeReportResourceList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static ReportResourceList DeserializeReportResourceList(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReportResourceList(Optional.ToList(value), nextLink.Value); + return new ReportResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ReportResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.cs index 05c3fa41c4e6..a81ef4704da6 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppComplianceAutomation; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Object that includes an array of resources and a possible link for next set. internal partial class ReportResourceList { - /// Initializes a new instance of ReportResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReportResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReportResourceList. + /// Initializes a new instance of . /// List of the reports. /// /// The URL the client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ReportResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ReportResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of the reports. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.Serialization.cs index 1748e08865fd..6505e242bde6 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ReportResourcePatch : IUtf8JsonSerializable + public partial class ReportResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ReportResourcePatch DeserializeReportResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ReportProperties.DeserializeReportProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportResourcePatch(properties.Value, serializedAdditionalRawData); + } + + ReportResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.cs index 86e8d1261561..fae4feeacbd5 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ReportResourcePatch.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// A class represent a AppComplianceAutomation report resource update properties. public partial class ReportResourcePatch { - /// Initializes a new instance of ReportResourcePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReportResourcePatch() { } + /// Initializes a new instance of . + /// Report property. + /// Keeps track of any properties unknown to the library. + internal ReportResourcePatch(ReportProperties properties, Dictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Report property. public ReportProperties Properties { get; set; } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.Serialization.cs index f531d6cfe4b9..5b4a7c856356 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ResourceItem + public partial class ResourceItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceItem DeserializeResourceItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceItem DeserializeResourceItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static ResourceItem DeserializeResourceItem(JsonElement element) Optional resourceGroup = default; Optional resourceType = default; Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subscriptionId"u8)) @@ -44,8 +73,61 @@ internal static ResourceItem DeserializeResourceItem(JsonElement element) resourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceItem(subscriptionId.Value, resourceGroup.Value, resourceType.Value, resourceId.Value); + return new ResourceItem(subscriptionId.Value, resourceGroup.Value, resourceType.Value, resourceId.Value, serializedAdditionalRawData); + } + + ResourceItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.cs index ac8a1910bcf7..97b5e3f1753e 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceItem.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// Resource Id. public partial class ResourceItem { - /// Initializes a new instance of ResourceItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceItem() { } - /// Initializes a new instance of ResourceItem. + /// Initializes a new instance of . /// The subscription Id of this resource. /// The resource group name of this resource. /// The resource type of this resource. /// The resource Id - e.g. "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1". - internal ResourceItem(string subscriptionId, string resourceGroup, string resourceType, string resourceId) + /// Keeps track of any properties unknown to the library. + internal ResourceItem(string subscriptionId, string resourceGroup, string resourceType, string resourceId, Dictionary serializedAdditionalRawData) { SubscriptionId = subscriptionId; ResourceGroup = resourceGroup; ResourceType = resourceType; ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The subscription Id of this resource. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.Serialization.cs index 27dbe72a67b0..96bf880d5f5e 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class ResourceMetadata : IUtf8JsonSerializable + public partial class ResourceMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); @@ -44,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element) + internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +79,7 @@ internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element Optional resourceKind = default; Optional resourceName = default; Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -94,8 +116,61 @@ internal static ResourceMetadata DeserializeResourceMetadata(JsonElement element tags = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceMetadata(resourceId, resourceType.Value, resourceKind.Value, resourceName.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ResourceMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceMetadata model) + { + if (model is null) + { + return null; } - return new ResourceMetadata(resourceId, resourceType.Value, resourceKind.Value, resourceName.Value, Optional.ToDictionary(tags)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.cs index dd99e2e17808..534d9d219e70 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/ResourceMetadata.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Single resource Id's metadata. public partial class ResourceMetadata { - /// Initializes a new instance of ResourceMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Resource Id - e.g. "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1". /// is null. public ResourceMetadata(string resourceId) @@ -25,19 +28,26 @@ public ResourceMetadata(string resourceId) Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ResourceMetadata. + /// Initializes a new instance of . /// Resource Id - e.g. "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1". /// Resource type. /// Resource kind. /// Resource name. /// Resource's tag type. - internal ResourceMetadata(string resourceId, string resourceType, string resourceKind, string resourceName, IDictionary tags) + /// Keeps track of any properties unknown to the library. + internal ResourceMetadata(string resourceId, string resourceType, string resourceKind, string resourceName, IDictionary tags, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; ResourceType = resourceType; ResourceKind = resourceKind; ResourceName = resourceName; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceMetadata() + { } /// Resource Id - e.g. "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1". diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.Serialization.cs index 25cba92f46c5..280ec8983471 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class SnapshotDownloadContent : IUtf8JsonSerializable + public partial class SnapshotDownloadContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ReportCreatorTenantId)) { @@ -27,7 +35,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("offerGuid"u8); writer.WriteStringValue(OfferGuid); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SnapshotDownloadContent DeserializeSnapshotDownloadContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional reportCreatorTenantId = default; + DownloadType downloadType = default; + Optional offerGuid = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reportCreatorTenantId"u8)) + { + reportCreatorTenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("downloadType"u8)) + { + downloadType = new DownloadType(property.Value.GetString()); + continue; + } + if (property.NameEquals("offerGuid"u8)) + { + offerGuid = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SnapshotDownloadContent(reportCreatorTenantId.Value, downloadType, offerGuid.Value, serializedAdditionalRawData); + } + + SnapshotDownloadContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotDownloadContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotDownloadContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotDownloadContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotDownloadContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotDownloadContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotDownloadContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.cs index b9b035ce83df..f53cc0e5c7b1 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotDownloadContent.cs @@ -5,18 +5,42 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppComplianceAutomation.Models { /// Snapshot's download request. public partial class SnapshotDownloadContent { - /// Initializes a new instance of SnapshotDownloadContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicates the download type. public SnapshotDownloadContent(DownloadType downloadType) { DownloadType = downloadType; } + /// Initializes a new instance of . + /// Tenant id. + /// Indicates the download type. + /// The offerGuid which mapping to the reports. + /// Keeps track of any properties unknown to the library. + internal SnapshotDownloadContent(string reportCreatorTenantId, DownloadType downloadType, string offerGuid, Dictionary serializedAdditionalRawData) + { + ReportCreatorTenantId = reportCreatorTenantId; + DownloadType = downloadType; + OfferGuid = offerGuid; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SnapshotDownloadContent() + { + } + /// Tenant id. public string ReportCreatorTenantId { get; set; } /// Indicates the download type. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.Serialization.cs index 032108f49230..f4edc48d0da6 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.Serialization.cs @@ -8,15 +8,41 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - public partial class SnapshotProperties + public partial class SnapshotProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SnapshotProperties DeserializeSnapshotProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SnapshotProperties DeserializeSnapshotProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +54,7 @@ internal static SnapshotProperties DeserializeSnapshotProperties(JsonElement ele Optional reportProperties = default; Optional reportSystemData = default; Optional> complianceResults = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -90,8 +117,61 @@ internal static SnapshotProperties DeserializeSnapshotProperties(JsonElement ele complianceResults = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SnapshotProperties(id.Value, snapshotName.Value, Optional.ToNullable(createdAt), Optional.ToNullable(provisioningState), reportProperties.Value, reportSystemData, Optional.ToList(complianceResults)); + return new SnapshotProperties(id.Value, snapshotName.Value, Optional.ToNullable(createdAt), Optional.ToNullable(provisioningState), reportProperties.Value, reportSystemData, Optional.ToList(complianceResults), serializedAdditionalRawData); + } + + SnapshotProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.cs index 150464bcb7ea..d4f6d563d0c9 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotProperties.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Snapshot's properties. public partial class SnapshotProperties { - /// Initializes a new instance of SnapshotProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SnapshotProperties() { ComplianceResults = new ChangeTrackingList(); } - /// Initializes a new instance of SnapshotProperties. + /// Initializes a new instance of . /// Snapshot id in the database. /// Snapshot name. /// The timestamp of resource creation (UTC). @@ -29,7 +32,8 @@ internal SnapshotProperties() /// The report essential info. /// Metadata pertaining to creation and last modification of the resource. /// List of compliance results. - internal SnapshotProperties(string id, string snapshotName, DateTimeOffset? createdOn, ProvisioningState? provisioningState, ReportProperties reportProperties, SystemData reportSystemData, IReadOnlyList complianceResults) + /// Keeps track of any properties unknown to the library. + internal SnapshotProperties(string id, string snapshotName, DateTimeOffset? createdOn, ProvisioningState? provisioningState, ReportProperties reportProperties, SystemData reportSystemData, IReadOnlyList complianceResults, Dictionary serializedAdditionalRawData) { Id = id; SnapshotName = snapshotName; @@ -38,6 +42,7 @@ internal SnapshotProperties(string id, string snapshotName, DateTimeOffset? crea ReportProperties = reportProperties; ReportSystemData = reportSystemData; ComplianceResults = complianceResults; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Snapshot id in the database. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceData.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceData.Serialization.cs index a428aa415e00..82610e10d8a5 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceData.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceData.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppComplianceAutomation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppComplianceAutomation { - public partial class SnapshotResourceData : IUtf8JsonSerializable + public partial class SnapshotResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SnapshotResourceData DeserializeSnapshotResourceData(JsonElement element) + internal static SnapshotResourceData DeserializeSnapshotResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +53,7 @@ internal static SnapshotResourceData DeserializeSnapshotResourceData(JsonElement string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -66,8 +89,61 @@ internal static SnapshotResourceData DeserializeSnapshotResourceData(JsonElement systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SnapshotResourceData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + SnapshotResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotResourceData model) + { + if (model is null) + { + return null; } - return new SnapshotResourceData(id, name, type, systemData.Value, properties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.Serialization.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.Serialization.cs index 2196e78dcc77..49c2bab5dcb2 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.Serialization.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppComplianceAutomation; namespace Azure.ResourceManager.AppComplianceAutomation.Models { - internal partial class SnapshotResourceList + internal partial class SnapshotResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SnapshotResourceList DeserializeSnapshotResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SnapshotResourceList DeserializeSnapshotResourceList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static SnapshotResourceList DeserializeSnapshotResourceList(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SnapshotResourceList(Optional.ToList(value), nextLink.Value); + return new SnapshotResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SnapshotResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.cs index b3ccd360e2f0..9ffd1bb9b3dc 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Models/SnapshotResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppComplianceAutomation; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppComplianceAutomation.Models /// Object that includes an array of resources and a possible link for next set. internal partial class SnapshotResourceList { - /// Initializes a new instance of SnapshotResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SnapshotResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SnapshotResourceList. + /// Initializes a new instance of . /// List of the snapshots. /// /// The URL the client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal SnapshotResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SnapshotResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of the snapshots. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs index b188c8652646..3af48860db32 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceCollection.cs @@ -239,7 +239,7 @@ public virtual AsyncPageable GetAllAsync(string skipToken = null { HttpMessage FirstPageRequest(int? pageSizeHint) => _reportResourceReportsRestClient.CreateListRequest(skipToken, top, select, offerGuid, reportCreatorTenantId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _reportResourceReportsRestClient.CreateListNextPageRequest(nextLink, skipToken, top, select, offerGuid, reportCreatorTenantId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ReportResource(Client, ReportResourceData.DeserializeReportResourceData(e)), _reportResourceReportsClientDiagnostics, Pipeline, "ReportResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ReportResource(Client, ReportResourceData.DeserializeReportResourceData(e)), _reportResourceReportsClientDiagnostics, Pipeline, "ReportResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -266,7 +266,7 @@ public virtual Pageable GetAll(string skipToken = null, int? top { HttpMessage FirstPageRequest(int? pageSizeHint) => _reportResourceReportsRestClient.CreateListRequest(skipToken, top, select, offerGuid, reportCreatorTenantId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _reportResourceReportsRestClient.CreateListNextPageRequest(nextLink, skipToken, top, select, offerGuid, reportCreatorTenantId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ReportResource(Client, ReportResourceData.DeserializeReportResourceData(e)), _reportResourceReportsClientDiagnostics, Pipeline, "ReportResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ReportResource(Client, ReportResourceData.DeserializeReportResourceData(e)), _reportResourceReportsClientDiagnostics, Pipeline, "ReportResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceData.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceData.cs index 65a009c4d478..8826f0257989 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceData.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResourceData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppComplianceAutomation.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.AppComplianceAutomation /// public partial class ReportResourceData : ResourceData { - /// Initializes a new instance of ReportResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Report property. /// is null. public ReportResourceData(ReportProperties properties) @@ -28,15 +32,22 @@ public ReportResourceData(ReportProperties properties) Properties = properties; } - /// Initializes a new instance of ReportResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Report property. - internal ReportResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReportProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ReportResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReportProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportResourceData() + { } /// Report property. diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/ReportRestOperations.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/ReportRestOperations.cs index 55ae26ba8b26..131ea3cc94dc 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/ReportRestOperations.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/ReportRestOperations.cs @@ -120,9 +120,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string reportName, ReportResour request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -186,9 +184,7 @@ internal HttpMessage CreateUpdateRequest(string reportName, ReportResourcePatch request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/SnapshotRestOperations.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/SnapshotRestOperations.cs index d2a99afb7b39..5da803044ab9 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/SnapshotRestOperations.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/RestOperations/SnapshotRestOperations.cs @@ -129,9 +129,7 @@ internal HttpMessage CreateDownloadRequest(string reportName, string snapshotNam request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs index fee2a1fc3bb2..01fa0fc213c0 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceCollection.cs @@ -156,7 +156,7 @@ public virtual AsyncPageable GetAllAsync(string skipToken = nu { HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotResourceSnapshotsRestClient.CreateListRequest(Id.Name, skipToken, top, select, reportCreatorTenantId, offerGuid); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotResourceSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.Name, skipToken, top, select, reportCreatorTenantId, offerGuid); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotResourceData.DeserializeSnapshotResourceData(e)), _snapshotResourceSnapshotsClientDiagnostics, Pipeline, "SnapshotResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SnapshotResource(Client, SnapshotResourceData.DeserializeSnapshotResourceData(e)), _snapshotResourceSnapshotsClientDiagnostics, Pipeline, "SnapshotResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -183,7 +183,7 @@ public virtual Pageable GetAll(string skipToken = null, int? t { HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotResourceSnapshotsRestClient.CreateListRequest(Id.Name, skipToken, top, select, reportCreatorTenantId, offerGuid); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotResourceSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.Name, skipToken, top, select, reportCreatorTenantId, offerGuid); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotResourceData.DeserializeSnapshotResourceData(e)), _snapshotResourceSnapshotsClientDiagnostics, Pipeline, "SnapshotResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SnapshotResource(Client, SnapshotResourceData.DeserializeSnapshotResourceData(e)), _snapshotResourceSnapshotsClientDiagnostics, Pipeline, "SnapshotResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceData.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceData.cs index ba4f2fbec495..40ba68550fd2 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceData.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppComplianceAutomation.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppComplianceAutomation /// public partial class SnapshotResourceData : ResourceData { - /// Initializes a new instance of SnapshotResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SnapshotResourceData() { } - /// Initializes a new instance of SnapshotResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Snapshot's property'. - internal SnapshotResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SnapshotProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SnapshotResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SnapshotProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Snapshot's property'. diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Generated/ConfigurationClient.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Generated/ConfigurationClient.cs index b35949bbb8b0..d21d6dfcab49 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Generated/ConfigurationClient.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Generated/ConfigurationClient.cs @@ -1135,7 +1135,7 @@ internal virtual AsyncPageable GetKeysAsync(string name, string afte { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetKeysRequest(name, after, acceptDatetime, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetKeysNextPageRequest(nextLink, name, after, acceptDatetime, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetKeys", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetKeys", "items", "@nextLink", context); } /// @@ -1159,7 +1159,7 @@ internal virtual Pageable GetKeys(string name, string after, string { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetKeysRequest(name, after, acceptDatetime, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetKeysNextPageRequest(nextLink, name, after, acceptDatetime, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetKeys", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetKeys", "items", "@nextLink", context); } /// @@ -1186,7 +1186,7 @@ internal virtual AsyncPageable GetConfigurationSettingsAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConfigurationSettingsRequest(key, label, after, acceptDatetime, select, snapshot, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConfigurationSettingsNextPageRequest(nextLink, key, label, after, acceptDatetime, select, snapshot, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetConfigurationSettings", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetConfigurationSettings", "items", "@nextLink", context); } /// @@ -1213,7 +1213,7 @@ internal virtual Pageable GetConfigurationSettings(string key, strin { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConfigurationSettingsRequest(key, label, after, acceptDatetime, select, snapshot, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConfigurationSettingsNextPageRequest(nextLink, key, label, after, acceptDatetime, select, snapshot, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetConfigurationSettings", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetConfigurationSettings", "items", "@nextLink", context); } /// @@ -1238,7 +1238,7 @@ internal virtual AsyncPageable GetSnapshotsAsync(string name, string { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSnapshotsRequest(name, after, select, status, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSnapshotsNextPageRequest(nextLink, name, after, select, status, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", context); } /// @@ -1263,7 +1263,7 @@ internal virtual Pageable GetSnapshots(string name, string after, IE { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSnapshotsRequest(name, after, select, status, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSnapshotsNextPageRequest(nextLink, name, after, select, status, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", context); } /// @@ -1288,7 +1288,7 @@ internal virtual AsyncPageable GetLabelsAsync(string name, string af { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLabelsRequest(name, after, acceptDatetime, select, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLabelsNextPageRequest(nextLink, name, after, acceptDatetime, select, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetLabels", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetLabels", "items", "@nextLink", context); } /// @@ -1313,7 +1313,7 @@ internal virtual Pageable GetLabels(string name, string after, strin { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLabelsRequest(name, after, acceptDatetime, select, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLabelsNextPageRequest(nextLink, name, after, acceptDatetime, select, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetLabels", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetLabels", "items", "@nextLink", context); } /// @@ -1339,7 +1339,7 @@ internal virtual AsyncPageable GetRevisionsAsync(string key, string { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetRevisionsRequest(key, label, after, acceptDatetime, select, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetRevisionsNextPageRequest(nextLink, key, label, after, acceptDatetime, select, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetRevisions", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetRevisions", "items", "@nextLink", context); } /// @@ -1365,7 +1365,7 @@ internal virtual Pageable GetRevisions(string key, string label, str { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetRevisionsRequest(key, label, after, acceptDatetime, select, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetRevisionsNextPageRequest(nextLink, key, label, after, acceptDatetime, select, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetRevisions", "items", "@nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfigurationClient.GetRevisions", "items", "@nextLink", context); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs index 44641b7705f4..709b5b8c4ad2 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationKeyValueKeyValuesRestClient.CreateListByConfigurationStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationKeyValueKeyValuesRestClient.CreateListByConfigurationStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationKeyValueResource(Client, AppConfigurationKeyValueData.DeserializeAppConfigurationKeyValueData(e)), _appConfigurationKeyValueKeyValuesClientDiagnostics, Pipeline, "AppConfigurationKeyValueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationKeyValueResource(Client, AppConfigurationKeyValueData.DeserializeAppConfigurationKeyValueData(e)), _appConfigurationKeyValueKeyValuesClientDiagnostics, Pipeline, "AppConfigurationKeyValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string skipToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationKeyValueKeyValuesRestClient.CreateListByConfigurationStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationKeyValueKeyValuesRestClient.CreateListByConfigurationStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationKeyValueResource(Client, AppConfigurationKeyValueData.DeserializeAppConfigurationKeyValueData(e)), _appConfigurationKeyValueKeyValuesClientDiagnostics, Pipeline, "AppConfigurationKeyValueCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationKeyValueResource(Client, AppConfigurationKeyValueData.DeserializeAppConfigurationKeyValueData(e)), _appConfigurationKeyValueKeyValuesClientDiagnostics, Pipeline, "AppConfigurationKeyValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueData.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueData.cs index 8f5aa3f2a70b..940bb0aebee6 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueData.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.AppConfiguration /// public partial class AppConfigurationKeyValueData : ResourceData { - /// Initializes a new instance of AppConfigurationKeyValueData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationKeyValueData() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AppConfigurationKeyValueData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,7 +53,8 @@ public AppConfigurationKeyValueData() /// A locked key-value may not be modified until it is unlocked. /// /// A dictionary of tags that can help identify what a key-value may be applicable for. - internal AppConfigurationKeyValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string key, string label, string value, string contentType, ETag? eTag, DateTimeOffset? lastModifiedOn, bool? isLocked, IDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationKeyValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string key, string label, string value, string contentType, ETag? eTag, DateTimeOffset? lastModifiedOn, bool? isLocked, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Key = key; Label = label; @@ -60,6 +64,7 @@ internal AppConfigurationKeyValueData(ResourceIdentifier id, string name, Resour LastModifiedOn = lastModifiedOn; IsLocked = isLocked; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs index fc525bccf599..81cb827be6ab 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByConfigurationStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByConfigurationStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationPrivateEndpointConnectionResource(Client, AppConfigurationPrivateEndpointConnectionData.DeserializeAppConfigurationPrivateEndpointConnectionData(e)), _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AppConfigurationPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationPrivateEndpointConnectionResource(Client, AppConfigurationPrivateEndpointConnectionData.DeserializeAppConfigurationPrivateEndpointConnectionData(e)), _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AppConfigurationPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByConfigurationStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByConfigurationStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationPrivateEndpointConnectionResource(Client, AppConfigurationPrivateEndpointConnectionData.DeserializeAppConfigurationPrivateEndpointConnectionData(e)), _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AppConfigurationPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationPrivateEndpointConnectionResource(Client, AppConfigurationPrivateEndpointConnectionData.DeserializeAppConfigurationPrivateEndpointConnectionData(e)), _appConfigurationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AppConfigurationPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionData.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionData.cs index c7f93ef78887..03f36d6a1ea7 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionData.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppConfiguration.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.AppConfiguration /// public partial class AppConfigurationPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationPrivateEndpointConnectionData() { } - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public AppConfigurationPrivateEndpointConnectionData() /// The provisioning status of the private endpoint connection. /// The resource of private endpoint. /// A collection of information about the state of the connection between service consumer and provider. - internal AppConfigurationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppConfigurationProvisioningState? provisioningState, WritableSubResource privateEndpoint, AppConfigurationPrivateLinkServiceConnectionState connectionState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppConfigurationProvisioningState? provisioningState, WritableSubResource privateEndpoint, AppConfigurationPrivateLinkServiceConnectionState connectionState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The provisioning status of the private endpoint connection. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs index 8b2814e3909d..dabd6cb0cbf6 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByConfigurationStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByConfigurationStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationPrivateLinkResource(Client, AppConfigurationPrivateLinkResourceData.DeserializeAppConfigurationPrivateLinkResourceData(e)), _appConfigurationPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AppConfigurationPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationPrivateLinkResource(Client, AppConfigurationPrivateLinkResourceData.DeserializeAppConfigurationPrivateLinkResourceData(e)), _appConfigurationPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AppConfigurationPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByConfigurationStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByConfigurationStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationPrivateLinkResource(Client, AppConfigurationPrivateLinkResourceData.DeserializeAppConfigurationPrivateLinkResourceData(e)), _appConfigurationPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AppConfigurationPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationPrivateLinkResource(Client, AppConfigurationPrivateLinkResourceData.DeserializeAppConfigurationPrivateLinkResourceData(e)), _appConfigurationPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "AppConfigurationPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceData.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceData.cs index 7608d2ee491a..cd0c39cb0250 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceData.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,14 +18,17 @@ namespace Azure.ResourceManager.AppConfiguration /// public partial class AppConfigurationPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of AppConfigurationPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,11 +36,13 @@ internal AppConfigurationPrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The list of required DNS zone names of the private link resource. - internal AppConfigurationPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs index a775a42aeb1a..1cc74e14d9a1 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string s { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationStoreConfigurationStoresRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationStoreConfigurationStoresRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), _appConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "AppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), _appConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "AppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string skipToken = { HttpMessage FirstPageRequest(int? pageSizeHint) => _appConfigurationStoreConfigurationStoresRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appConfigurationStoreConfigurationStoresRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), _appConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "AppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), _appConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "AppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreData.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreData.cs index 5e3cad28e96f..3ea5aa802d86 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreData.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.AppConfiguration /// public partial class AppConfigurationStoreData : TrackedResourceData { - /// Initializes a new instance of AppConfigurationStoreData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The sku of the configuration store. /// is null. @@ -31,7 +34,7 @@ public AppConfigurationStoreData(AzureLocation location, AppConfigurationSku sku PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationStoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,7 +53,8 @@ public AppConfigurationStoreData(AzureLocation location, AppConfigurationSku sku /// The amount of time in days that the configuration store will be retained when it is soft deleted. /// Property specifying whether protection against purge is enabled for this configuration store. /// Indicates whether the configuration store need to be recovered. - internal AppConfigurationStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, AppConfigurationSku sku, AppConfigurationProvisioningState? provisioningState, DateTimeOffset? createdOn, string endpoint, AppConfigurationStoreEncryptionProperties encryption, IReadOnlyList privateEndpointConnections, AppConfigurationPublicNetworkAccess? publicNetworkAccess, bool? disableLocalAuth, int? softDeleteRetentionInDays, bool? enablePurgeProtection, AppConfigurationCreateMode? createMode) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, AppConfigurationSku sku, AppConfigurationProvisioningState? provisioningState, DateTimeOffset? createdOn, string endpoint, AppConfigurationStoreEncryptionProperties encryption, IReadOnlyList privateEndpointConnections, AppConfigurationPublicNetworkAccess? publicNetworkAccess, bool? disableLocalAuth, int? softDeleteRetentionInDays, bool? enablePurgeProtection, AppConfigurationCreateMode? createMode, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; Sku = sku; @@ -64,6 +68,12 @@ internal AppConfigurationStoreData(ResourceIdentifier id, string name, ResourceT SoftDeleteRetentionInDays = softDeleteRetentionInDays; EnablePurgeProtection = enablePurgeProtection; CreateMode = createMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppConfigurationStoreData() + { } /// The managed identity information, if configured. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ArmAppConfigurationModelFactory.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ArmAppConfigurationModelFactory.cs index f8bfc6a0e0fd..4e481b6a1a3d 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ArmAppConfigurationModelFactory.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/ArmAppConfigurationModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// Model factory for models. public static partial class ArmAppConfigurationModelFactory { - /// Initializes a new instance of AppConfigurationStoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,10 +43,10 @@ public static AppConfigurationStoreData AppConfigurationStoreData(ResourceIdenti tags ??= new Dictionary(); privateEndpointConnections ??= new List(); - return new AppConfigurationStoreData(id, name, resourceType, systemData, tags, location, identity, skuName != null ? new AppConfigurationSku(skuName) : null, provisioningState, createdOn, endpoint, encryptionKeyVaultProperties != null ? new AppConfigurationStoreEncryptionProperties(encryptionKeyVaultProperties) : null, privateEndpointConnections?.ToList(), publicNetworkAccess, disableLocalAuth, softDeleteRetentionInDays, enablePurgeProtection, createMode); + return new AppConfigurationStoreData(id, name, resourceType, systemData, tags, location, identity, skuName != null ? new AppConfigurationSku(skuName, new Dictionary()) : null, provisioningState, createdOn, endpoint, encryptionKeyVaultProperties != null ? new AppConfigurationStoreEncryptionProperties(encryptionKeyVaultProperties, new Dictionary()) : null, privateEndpointConnections?.ToList(), publicNetworkAccess, disableLocalAuth, softDeleteRetentionInDays, enablePurgeProtection, createMode, default); } - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionReference. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -57,30 +57,30 @@ public static AppConfigurationStoreData AppConfigurationStoreData(ResourceIdenti /// A new instance for mocking. public static AppConfigurationPrivateEndpointConnectionReference AppConfigurationPrivateEndpointConnectionReference(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppConfigurationProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, AppConfigurationPrivateLinkServiceConnectionState connectionState = null) { - return new AppConfigurationPrivateEndpointConnectionReference(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState); + return new AppConfigurationPrivateEndpointConnectionReference(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState, default); } - /// Initializes a new instance of AppConfigurationPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). /// A new instance for mocking. public static AppConfigurationPrivateLinkServiceConnectionState AppConfigurationPrivateLinkServiceConnectionState(AppConfigurationPrivateLinkServiceConnectionStatus? status = null, string description = null, AppConfigurationActionsRequired? actionsRequired = null) { - return new AppConfigurationPrivateLinkServiceConnectionState(status, description, actionsRequired); + return new AppConfigurationPrivateLinkServiceConnectionState(status, description, actionsRequired, default); } - /// Initializes a new instance of AppConfigurationNameAvailabilityResult. + /// Initializes a new instance of . /// The value indicating whether the resource name is available. /// If any, the error message that provides more detail for the reason that the name is not available. /// If any, the reason that the name is not available. /// A new instance for mocking. public static AppConfigurationNameAvailabilityResult AppConfigurationNameAvailabilityResult(bool? isNameAvailable = null, string message = null, string reason = null) { - return new AppConfigurationNameAvailabilityResult(isNameAvailable, message, reason); + return new AppConfigurationNameAvailabilityResult(isNameAvailable, message, reason, default); } - /// Initializes a new instance of AppConfigurationStoreApiKey. + /// Initializes a new instance of . /// The key ID. /// A name for the key describing its usage. /// The value of the key that is used for authentication purposes. @@ -90,10 +90,10 @@ public static AppConfigurationNameAvailabilityResult AppConfigurationNameAvailab /// A new instance for mocking. public static AppConfigurationStoreApiKey AppConfigurationStoreApiKey(string id = null, string name = null, string value = null, string connectionString = null, DateTimeOffset? lastModifiedOn = null, bool? isReadOnly = null) { - return new AppConfigurationStoreApiKey(id, name, value, connectionString, lastModifiedOn, isReadOnly); + return new AppConfigurationStoreApiKey(id, name, value, connectionString, lastModifiedOn, isReadOnly, default); } - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -104,10 +104,10 @@ public static AppConfigurationStoreApiKey AppConfigurationStoreApiKey(string id /// A new instance for mocking. public static AppConfigurationPrivateEndpointConnectionData AppConfigurationPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppConfigurationProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, AppConfigurationPrivateLinkServiceConnectionState connectionState = null) { - return new AppConfigurationPrivateEndpointConnectionData(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState); + return new AppConfigurationPrivateEndpointConnectionData(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState, default); } - /// Initializes a new instance of AppConfigurationPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -121,10 +121,10 @@ public static AppConfigurationPrivateLinkResourceData AppConfigurationPrivateLin requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new AppConfigurationPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new AppConfigurationPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } - /// Initializes a new instance of AppConfigurationKeyValueData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -154,10 +154,10 @@ public static AppConfigurationKeyValueData AppConfigurationKeyValueData(Resource { tags ??= new Dictionary(); - return new AppConfigurationKeyValueData(id, name, resourceType, systemData, key, label, value, contentType, eTag, lastModifiedOn, isLocked, tags); + return new AppConfigurationKeyValueData(id, name, resourceType, systemData, key, label, value, contentType, eTag, lastModifiedOn, isLocked, tags, default); } - /// Initializes a new instance of DeletedAppConfigurationStoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -173,7 +173,7 @@ public static DeletedAppConfigurationStoreData DeletedAppConfigurationStoreData( { tags ??= new Dictionary(); - return new DeletedAppConfigurationStoreData(id, name, resourceType, systemData, configurationStoreId, location, deletedOn, scheduledPurgeOn, tags, isPurgeProtectionEnabled); + return new DeletedAppConfigurationStoreData(id, name, resourceType, systemData, configurationStoreId, location, deletedOn, scheduledPurgeOn, tags, isPurgeProtectionEnabled, default); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs index 537c63a21803..89a7204cc16d 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreCollection.cs @@ -153,7 +153,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _configurationStoresRestClient.CreateListDeletedRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationStoresRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedAppConfigurationStoreResource(Client, DeletedAppConfigurationStoreData.DeserializeDeletedAppConfigurationStoreData(e)), _configurationStoresClientDiagnostics, Pipeline, "DeletedAppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DeletedAppConfigurationStoreResource(Client, DeletedAppConfigurationStoreData.DeserializeDeletedAppConfigurationStoreData(e)), _configurationStoresClientDiagnostics, Pipeline, "DeletedAppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -175,7 +175,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _configurationStoresRestClient.CreateListDeletedRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationStoresRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedAppConfigurationStoreResource(Client, DeletedAppConfigurationStoreData.DeserializeDeletedAppConfigurationStoreData(e)), _configurationStoresClientDiagnostics, Pipeline, "DeletedAppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DeletedAppConfigurationStoreResource(Client, DeletedAppConfigurationStoreData.DeserializeDeletedAppConfigurationStoreData(e)), _configurationStoresClientDiagnostics, Pipeline, "DeletedAppConfigurationStoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreData.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreData.cs index dfbe345db2d1..7134b12863d6 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreData.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreData.cs @@ -18,13 +18,16 @@ namespace Azure.ResourceManager.AppConfiguration /// public partial class DeletedAppConfigurationStoreData : ResourceData { - /// Initializes a new instance of DeletedAppConfigurationStoreData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeletedAppConfigurationStoreData() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DeletedAppConfigurationStoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +38,8 @@ internal DeletedAppConfigurationStoreData() /// The scheduled purged date. /// Tags of the original configuration store. /// Purge protection status of the original configuration store. - internal DeletedAppConfigurationStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier configurationStoreId, AzureLocation? location, DateTimeOffset? deletedOn, DateTimeOffset? scheduledPurgeOn, IReadOnlyDictionary tags, bool? isPurgeProtectionEnabled) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DeletedAppConfigurationStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier configurationStoreId, AzureLocation? location, DateTimeOffset? deletedOn, DateTimeOffset? scheduledPurgeOn, IReadOnlyDictionary tags, bool? isPurgeProtectionEnabled, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ConfigurationStoreId = configurationStoreId; Location = location; @@ -43,6 +47,7 @@ internal DeletedAppConfigurationStoreData(ResourceIdentifier id, string name, Re ScheduledPurgeOn = scheduledPurgeOn; Tags = tags; IsPurgeProtectionEnabled = isPurgeProtectionEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource id of the original configuration store. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 38b913e098b6..76de18ce85a6 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -75,7 +75,7 @@ public virtual AsyncPageable GetAppConfigurationS { HttpMessage FirstPageRequest(int? pageSizeHint) => AppConfigurationStoreConfigurationStoresRestClient.CreateListRequest(Id.SubscriptionId, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppConfigurationStoreConfigurationStoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppConfigurationStores", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppConfigurationStores", "value", "nextLink", cancellationToken); } /// @@ -98,7 +98,7 @@ public virtual Pageable GetAppConfigurationStores { HttpMessage FirstPageRequest(int? pageSizeHint) => AppConfigurationStoreConfigurationStoresRestClient.CreateListRequest(Id.SubscriptionId, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppConfigurationStoreConfigurationStoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppConfigurationStores", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppConfigurationStores", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueData.Serialization.cs index 62ca7f3dbc6a..7668f736ce2c 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueData.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueData.Serialization.cs @@ -10,14 +10,19 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppConfiguration { - public partial class AppConfigurationKeyValueData : IUtf8JsonSerializable + public partial class AppConfigurationKeyValueData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationKeyValueData DeserializeAppConfigurationKeyValueData(JsonElement element) + internal static AppConfigurationKeyValueData DeserializeAppConfigurationKeyValueData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +83,7 @@ internal static AppConfigurationKeyValueData DeserializeAppConfigurationKeyValue Optional lastModified = default; Optional locked = default; Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -163,8 +183,61 @@ internal static AppConfigurationKeyValueData DeserializeAppConfigurationKeyValue } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationKeyValueData(id, name, type, systemData.Value, key.Value, label.Value, value.Value, contentType.Value, Optional.ToNullable(eTag), Optional.ToNullable(lastModified), Optional.ToNullable(locked), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + AppConfigurationKeyValueData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationKeyValueData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationKeyValueData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationKeyValueData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationKeyValueData model) + { + if (model is null) + { + return null; } - return new AppConfigurationKeyValueData(id, name, type, systemData.Value, key.Value, label.Value, value.Value, contentType.Value, Optional.ToNullable(eTag), Optional.ToNullable(lastModified), Optional.ToNullable(locked), Optional.ToDictionary(tags)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationKeyValueData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationKeyValueData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.Serialization.cs index f93d2cf40e0b..acb7af9cd281 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class AppConfigurationKeyValueListResult + internal partial class AppConfigurationKeyValueListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationKeyValueListResult DeserializeAppConfigurationKeyValueListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationKeyValueListResult DeserializeAppConfigurationKeyValueListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppConfigurationKeyValueListResult DeserializeAppConfigurationKe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationKeyValueListResult(Optional.ToList(value), nextLink.Value); + return new AppConfigurationKeyValueListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppConfigurationKeyValueListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationKeyValueListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationKeyValueListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationKeyValueListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationKeyValueListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationKeyValueListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationKeyValueListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.cs index 99bc12e86798..a2b91174bb77 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyValueListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppConfiguration; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// The result of a request to list key-values. internal partial class AppConfigurationKeyValueListResult { - /// Initializes a new instance of AppConfigurationKeyValueListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationKeyValueListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationKeyValueListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal AppConfigurationKeyValueListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationKeyValueListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.Serialization.cs index 6749bb45f551..c407d43da9f1 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationKeyVaultProperties : IUtf8JsonSerializable + public partial class AppConfigurationKeyVaultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyIdentifier)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identityClientId"u8); writer.WriteStringValue(IdentityClientId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationKeyVaultProperties DeserializeAppConfigurationKeyVaultProperties(JsonElement element) + internal static AppConfigurationKeyVaultProperties DeserializeAppConfigurationKeyVaultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional keyIdentifier = default; Optional identityClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyIdentifier"u8)) @@ -48,8 +71,61 @@ internal static AppConfigurationKeyVaultProperties DeserializeAppConfigurationKe identityClientId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationKeyVaultProperties(keyIdentifier.Value, identityClientId.Value, serializedAdditionalRawData); + } + + AppConfigurationKeyVaultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationKeyVaultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationKeyVaultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationKeyVaultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationKeyVaultProperties model) + { + if (model is null) + { + return null; } - return new AppConfigurationKeyVaultProperties(keyIdentifier.Value, identityClientId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationKeyVaultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationKeyVaultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.cs index a1703e17fdb9..7181c166b5b1 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationKeyVaultProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppConfiguration.Models { /// Settings concerning key vault encryption for a configuration store. public partial class AppConfigurationKeyVaultProperties { - /// Initializes a new instance of AppConfigurationKeyVaultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationKeyVaultProperties() { } - /// Initializes a new instance of AppConfigurationKeyVaultProperties. + /// Initializes a new instance of . /// The URI of the key vault key used to encrypt data. /// The client id of the identity which will be used to access key vault. - internal AppConfigurationKeyVaultProperties(string keyIdentifier, string identityClientId) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationKeyVaultProperties(string keyIdentifier, string identityClientId, Dictionary serializedAdditionalRawData) { KeyIdentifier = keyIdentifier; IdentityClientId = identityClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The URI of the key vault key used to encrypt data. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.Serialization.cs index 89be31e57995..06edc81f9ebb 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationNameAvailabilityContent : IUtf8JsonSerializable + public partial class AppConfigurationNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AppConfigurationNameAvailabilityContent DeserializeAppConfigurationNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + AppConfigurationResourceType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new AppConfigurationResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + AppConfigurationNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.cs index 9ba6fa82f04b..cd8c83e81f85 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppConfiguration.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// Parameters used for checking whether a resource name is available. public partial class AppConfigurationNameAvailabilityContent { - /// Initializes a new instance of AppConfigurationNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name to check for availability. /// The resource type to check for name availability. /// is null. @@ -25,6 +29,22 @@ public AppConfigurationNameAvailabilityContent(string name, AppConfigurationReso ResourceType = resourceType; } + /// Initializes a new instance of . + /// The name to check for availability. + /// The resource type to check for name availability. + /// Keeps track of any properties unknown to the library. + internal AppConfigurationNameAvailabilityContent(string name, AppConfigurationResourceType resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppConfigurationNameAvailabilityContent() + { + } + /// The name to check for availability. public string Name { get; } /// The resource type to check for name availability. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.Serialization.cs index 7ca5f8d84273..c01039c70614 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationNameAvailabilityResult + public partial class AppConfigurationNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationNameAvailabilityResult DeserializeAppConfigurationNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationNameAvailabilityResult DeserializeAppConfigurationNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AppConfigurationNameAvailabilityResult DeserializeAppConfigurati Optional nameAvailable = default; Optional message = default; Optional reason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -42,8 +71,61 @@ internal static AppConfigurationNameAvailabilityResult DeserializeAppConfigurati reason = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationNameAvailabilityResult(Optional.ToNullable(nameAvailable), message.Value, reason.Value); + return new AppConfigurationNameAvailabilityResult(Optional.ToNullable(nameAvailable), message.Value, reason.Value, serializedAdditionalRawData); + } + + AppConfigurationNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.cs index 32b3ead81061..ad80d34ba9ad 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppConfiguration.Models { /// The result of a request to check the availability of a resource name. public partial class AppConfigurationNameAvailabilityResult { - /// Initializes a new instance of AppConfigurationNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationNameAvailabilityResult() { } - /// Initializes a new instance of AppConfigurationNameAvailabilityResult. + /// Initializes a new instance of . /// The value indicating whether the resource name is available. /// If any, the error message that provides more detail for the reason that the name is not available. /// If any, the reason that the name is not available. - internal AppConfigurationNameAvailabilityResult(bool? isNameAvailable, string message, string reason) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationNameAvailabilityResult(bool? isNameAvailable, string message, string reason, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Message = message; Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value indicating whether the resource name is available. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionData.Serialization.cs index e3ef6b263ca3..677592024cd0 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.AppConfiguration { - public partial class AppConfigurationPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class AppConfigurationPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationPrivateEndpointConnectionData DeserializeAppConfigurationPrivateEndpointConnectionData(JsonElement element) + internal static AppConfigurationPrivateEndpointConnectionData DeserializeAppConfigurationPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +76,7 @@ internal static AppConfigurationPrivateEndpointConnectionData DeserializeAppConf Optional provisioningState = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static AppConfigurationPrivateEndpointConnectionData DeserializeAppConf } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + AppConfigurationPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new AppConfigurationPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, privateLinkServiceConnectionState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.Serialization.cs index eb608710b99f..5a08befd3c78 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class AppConfigurationPrivateEndpointConnectionListResult + internal partial class AppConfigurationPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationPrivateEndpointConnectionListResult DeserializeAppConfigurationPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationPrivateEndpointConnectionListResult DeserializeAppConfigurationPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppConfigurationPrivateEndpointConnectionListResult DeserializeA nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationPrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value); + return new AppConfigurationPrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppConfigurationPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.cs index 33ace9882724..a9dbfc41d643 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppConfiguration; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// A list of private endpoint connections. internal partial class AppConfigurationPrivateEndpointConnectionListResult { - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal AppConfigurationPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.Serialization.cs index 39c45e5ba3cb..75016d6200a2 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.Serialization.cs @@ -5,17 +5,65 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationPrivateEndpointConnectionReference + public partial class AppConfigurationPrivateEndpointConnectionReference : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationPrivateEndpointConnectionReference DeserializeAppConfigurationPrivateEndpointConnectionReference(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + JsonSerializer.Serialize(writer, PrivateEndpoint); + } + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationPrivateEndpointConnectionReference DeserializeAppConfigurationPrivateEndpointConnectionReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +75,7 @@ internal static AppConfigurationPrivateEndpointConnectionReference DeserializeAp Optional provisioningState = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -92,8 +141,61 @@ internal static AppConfigurationPrivateEndpointConnectionReference DeserializeAp } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationPrivateEndpointConnectionReference(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, privateLinkServiceConnectionState.Value); + return new AppConfigurationPrivateEndpointConnectionReference(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + AppConfigurationPrivateEndpointConnectionReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationPrivateEndpointConnectionReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationPrivateEndpointConnectionReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationPrivateEndpointConnectionReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationPrivateEndpointConnectionReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationPrivateEndpointConnectionReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationPrivateEndpointConnectionReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.cs index 36faabfb4482..33ae3fabd6b7 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateEndpointConnectionReference.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; @@ -14,12 +16,15 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// A reference to a related private endpoint connection. public partial class AppConfigurationPrivateEndpointConnectionReference : ResourceData { - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationPrivateEndpointConnectionReference() { } - /// Initializes a new instance of AppConfigurationPrivateEndpointConnectionReference. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -27,11 +32,13 @@ internal AppConfigurationPrivateEndpointConnectionReference() /// The provisioning status of the private endpoint connection. /// The resource of private endpoint. /// A collection of information about the state of the connection between service consumer and provider. - internal AppConfigurationPrivateEndpointConnectionReference(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppConfigurationProvisioningState? provisioningState, WritableSubResource privateEndpoint, AppConfigurationPrivateLinkServiceConnectionState connectionState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationPrivateEndpointConnectionReference(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppConfigurationProvisioningState? provisioningState, WritableSubResource privateEndpoint, AppConfigurationPrivateLinkServiceConnectionState connectionState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The provisioning status of the private endpoint connection. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceData.Serialization.cs index c73d04b32ef3..02576e550d19 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceData.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceData.Serialization.cs @@ -5,17 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppConfiguration { - public partial class AppConfigurationPrivateLinkResourceData + public partial class AppConfigurationPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationPrivateLinkResourceData DeserializeAppConfigurationPrivateLinkResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationPrivateLinkResourceData DeserializeAppConfigurationPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +57,7 @@ internal static AppConfigurationPrivateLinkResourceData DeserializeAppConfigurat Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -98,8 +129,61 @@ internal static AppConfigurationPrivateLinkResourceData DeserializeAppConfigurat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + return new AppConfigurationPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + AppConfigurationPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationPrivateLinkResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.Serialization.cs index 4b3b1217e920..741c2f7443ff 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class AppConfigurationPrivateLinkResourceListResult + internal partial class AppConfigurationPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationPrivateLinkResourceListResult DeserializeAppConfigurationPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationPrivateLinkResourceListResult DeserializeAppConfigurationPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppConfigurationPrivateLinkResourceListResult DeserializeAppConf nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationPrivateLinkResourceListResult(Optional.ToList(value), nextLink.Value); + return new AppConfigurationPrivateLinkResourceListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppConfigurationPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.cs index 0eb5c3b993f2..f41676f8aa77 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppConfiguration; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// A list of private link resources. internal partial class AppConfigurationPrivateLinkResourceListResult { - /// Initializes a new instance of AppConfigurationPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationPrivateLinkResourceListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal AppConfigurationPrivateLinkResourceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationPrivateLinkResourceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.Serialization.cs index 9412470aee18..2cf4c9948d6a 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class AppConfigurationPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationPrivateLinkServiceConnectionState DeserializeAppConfigurationPrivateLinkServiceConnectionState(JsonElement element) + internal static AppConfigurationPrivateLinkServiceConnectionState DeserializeAppConfigurationPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static AppConfigurationPrivateLinkServiceConnectionState DeserializeApp Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -62,8 +85,61 @@ internal static AppConfigurationPrivateLinkServiceConnectionState DeserializeApp actionsRequired = new AppConfigurationActionsRequired(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, Optional.ToNullable(actionsRequired), serializedAdditionalRawData); + } + + AppConfigurationPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new AppConfigurationPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, Optional.ToNullable(actionsRequired)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.cs index 6c8a0dba9cee..ffdd971b4ee3 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppConfiguration.Models { /// The state of a private link service connection. public partial class AppConfigurationPrivateLinkServiceConnectionState { - /// Initializes a new instance of AppConfigurationPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of AppConfigurationPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). - internal AppConfigurationPrivateLinkServiceConnectionState(AppConfigurationPrivateLinkServiceConnectionStatus? status, string description, AppConfigurationActionsRequired? actionsRequired) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationPrivateLinkServiceConnectionState(AppConfigurationPrivateLinkServiceConnectionStatus? status, string description, AppConfigurationActionsRequired? actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link service connection status. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.Serialization.cs index d3da66fe2237..0ef389064dff 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationRegenerateKeyContent : IUtf8JsonSerializable + public partial class AppConfigurationRegenerateKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AppConfigurationRegenerateKeyContent DeserializeAppConfigurationRegenerateKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationRegenerateKeyContent(id.Value, serializedAdditionalRawData); + } + + AppConfigurationRegenerateKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationRegenerateKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationRegenerateKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationRegenerateKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationRegenerateKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationRegenerateKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationRegenerateKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.cs index f608c7e7cefe..cecf9f010e6c 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationRegenerateKeyContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppConfiguration.Models { /// The parameters used to regenerate an API key. public partial class AppConfigurationRegenerateKeyContent { - /// Initializes a new instance of AppConfigurationRegenerateKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationRegenerateKeyContent() { } + /// Initializes a new instance of . + /// The id of the key to regenerate. + /// Keeps track of any properties unknown to the library. + internal AppConfigurationRegenerateKeyContent(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The id of the key to regenerate. public string Id { get; set; } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.Serialization.cs index af0741b212a1..1220c0bd9b90 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationSku : IUtf8JsonSerializable + public partial class AppConfigurationSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationSku DeserializeAppConfigurationSku(JsonElement element) + internal static AppConfigurationSku DeserializeAppConfigurationSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -34,8 +57,61 @@ internal static AppConfigurationSku DeserializeAppConfigurationSku(JsonElement e name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationSku(name, serializedAdditionalRawData); + } + + AppConfigurationSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationSku model) + { + if (model is null) + { + return null; } - return new AppConfigurationSku(name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.cs index b2f507f07ada..0ca3dc51882a 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationSku.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppConfiguration.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// Describes a configuration store SKU. public partial class AppConfigurationSku { - /// Initializes a new instance of AppConfigurationSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The SKU name of the configuration store. /// is null. public AppConfigurationSku(string name) @@ -23,6 +27,20 @@ public AppConfigurationSku(string name) Name = name; } + /// Initializes a new instance of . + /// The SKU name of the configuration store. + /// Keeps track of any properties unknown to the library. + internal AppConfigurationSku(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppConfigurationSku() + { + } + /// The SKU name of the configuration store. public string Name { get; set; } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.Serialization.cs index 18c25c082f72..2812a194fe7c 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationStoreApiKey + public partial class AppConfigurationStoreApiKey : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationStoreApiKey DeserializeAppConfigurationStoreApiKey(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationStoreApiKey DeserializeAppConfigurationStoreApiKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static AppConfigurationStoreApiKey DeserializeAppConfigurationStoreApiK Optional connectionString = default; Optional lastModified = default; Optional readOnly = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -65,8 +93,61 @@ internal static AppConfigurationStoreApiKey DeserializeAppConfigurationStoreApiK readOnly = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationStoreApiKey(id.Value, name.Value, value.Value, connectionString.Value, Optional.ToNullable(lastModified), Optional.ToNullable(readOnly)); + return new AppConfigurationStoreApiKey(id.Value, name.Value, value.Value, connectionString.Value, Optional.ToNullable(lastModified), Optional.ToNullable(readOnly), serializedAdditionalRawData); + } + + AppConfigurationStoreApiKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationStoreApiKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationStoreApiKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationStoreApiKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationStoreApiKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationStoreApiKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationStoreApiKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.cs index b27d7be0a425..338b1b457b2e 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKey.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppConfiguration.Models { /// An API key used for authenticating with a configuration store endpoint. public partial class AppConfigurationStoreApiKey { - /// Initializes a new instance of AppConfigurationStoreApiKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationStoreApiKey() { } - /// Initializes a new instance of AppConfigurationStoreApiKey. + /// Initializes a new instance of . /// The key ID. /// A name for the key describing its usage. /// The value of the key that is used for authentication purposes. /// A connection string that can be used by supporting clients for authentication. /// The last time any of the key's properties were modified. /// Whether this key can only be used for read operations. - internal AppConfigurationStoreApiKey(string id, string name, string value, string connectionString, DateTimeOffset? lastModifiedOn, bool? isReadOnly) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationStoreApiKey(string id, string name, string value, string connectionString, DateTimeOffset? lastModifiedOn, bool? isReadOnly, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -32,6 +37,7 @@ internal AppConfigurationStoreApiKey(string id, string name, string value, strin ConnectionString = connectionString; LastModifiedOn = lastModifiedOn; IsReadOnly = isReadOnly; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The key ID. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.Serialization.cs index c91a42b8f66b..3141e982b327 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class AppConfigurationStoreApiKeyListResult + internal partial class AppConfigurationStoreApiKeyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationStoreApiKeyListResult DeserializeAppConfigurationStoreApiKeyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationStoreApiKeyListResult DeserializeAppConfigurationStoreApiKeyListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static AppConfigurationStoreApiKeyListResult DeserializeAppConfiguratio nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationStoreApiKeyListResult(Optional.ToList(value), nextLink.Value); + return new AppConfigurationStoreApiKeyListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppConfigurationStoreApiKeyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationStoreApiKeyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationStoreApiKeyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationStoreApiKeyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationStoreApiKeyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationStoreApiKeyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationStoreApiKeyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.cs index af9d221afdbd..64de3568db87 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreApiKeyListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// The result of a request to list API keys. internal partial class AppConfigurationStoreApiKeyListResult { - /// Initializes a new instance of AppConfigurationStoreApiKeyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationStoreApiKeyListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationStoreApiKeyListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal AppConfigurationStoreApiKeyListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationStoreApiKeyListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreData.Serialization.cs index 255f72b4f685..c6b39e212fcb 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreData.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppConfiguration { - public partial class AppConfigurationStoreData : IUtf8JsonSerializable + public partial class AppConfigurationStoreData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -25,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, Identity); } writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -44,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(PublicNetworkAccess)) { @@ -72,11 +92,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(CreateMode.Value.ToSerialString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationStoreData DeserializeAppConfigurationStoreData(JsonElement element) + internal static AppConfigurationStoreData DeserializeAppConfigurationStoreData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -99,6 +133,7 @@ internal static AppConfigurationStoreData DeserializeAppConfigurationStoreData(J Optional softDeleteRetentionInDays = default; Optional enablePurgeProtection = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -262,8 +297,61 @@ internal static AppConfigurationStoreData DeserializeAppConfigurationStoreData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationStoreData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, sku, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), endpoint.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(softDeleteRetentionInDays), Optional.ToNullable(enablePurgeProtection), Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + AppConfigurationStoreData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationStoreData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationStoreData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationStoreData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationStoreData model) + { + if (model is null) + { + return null; } - return new AppConfigurationStoreData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, sku, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), endpoint.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(softDeleteRetentionInDays), Optional.ToNullable(enablePurgeProtection), Optional.ToNullable(createMode)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationStoreData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationStoreData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.Serialization.cs index 1dc31fa52a6f..78cb253de32b 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.Serialization.cs @@ -5,38 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class AppConfigurationStoreEncryptionProperties : IUtf8JsonSerializable + internal partial class AppConfigurationStoreEncryptionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyVaultProperties)) { if (KeyVaultProperties != null) { writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties); + if (KeyVaultProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProperties).Serialize(writer, options); + } } else { writer.WriteNull("keyVaultProperties"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppConfigurationStoreEncryptionProperties DeserializeAppConfigurationStoreEncryptionProperties(JsonElement element) + internal static AppConfigurationStoreEncryptionProperties DeserializeAppConfigurationStoreEncryptionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional keyVaultProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyVaultProperties"u8)) @@ -49,8 +79,61 @@ internal static AppConfigurationStoreEncryptionProperties DeserializeAppConfigur keyVaultProperties = AppConfigurationKeyVaultProperties.DeserializeAppConfigurationKeyVaultProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationStoreEncryptionProperties(keyVaultProperties.Value, serializedAdditionalRawData); + } + + AppConfigurationStoreEncryptionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationStoreEncryptionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationStoreEncryptionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationStoreEncryptionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationStoreEncryptionProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationStoreEncryptionProperties(Response response) + { + if (response is null) + { + return null; } - return new AppConfigurationStoreEncryptionProperties(keyVaultProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationStoreEncryptionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.cs index 3a7841a6d381..6bbcda8fdde5 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreEncryptionProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppConfiguration.Models { /// The encryption settings for a configuration store. internal partial class AppConfigurationStoreEncryptionProperties { - /// Initializes a new instance of AppConfigurationStoreEncryptionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationStoreEncryptionProperties() { } - /// Initializes a new instance of AppConfigurationStoreEncryptionProperties. + /// Initializes a new instance of . /// Key vault properties. - internal AppConfigurationStoreEncryptionProperties(AppConfigurationKeyVaultProperties keyVaultProperties) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationStoreEncryptionProperties(AppConfigurationKeyVaultProperties keyVaultProperties, Dictionary serializedAdditionalRawData) { KeyVaultProperties = keyVaultProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key vault properties. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.Serialization.cs index 0cc76fe5c492..beb86abf7229 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class AppConfigurationStoreListResult + internal partial class AppConfigurationStoreListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppConfigurationStoreListResult DeserializeAppConfigurationStoreListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppConfigurationStoreListResult DeserializeAppConfigurationStoreListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppConfigurationStoreListResult DeserializeAppConfigurationStore nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppConfigurationStoreListResult(Optional.ToList(value), nextLink.Value); + return new AppConfigurationStoreListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppConfigurationStoreListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationStoreListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationStoreListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationStoreListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationStoreListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationStoreListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationStoreListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.cs index 5a877107e506..bd6c5a205749 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStoreListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppConfiguration; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// The result of a request to list configuration stores. internal partial class AppConfigurationStoreListResult { - /// Initializes a new instance of AppConfigurationStoreListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppConfigurationStoreListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppConfigurationStoreListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal AppConfigurationStoreListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppConfigurationStoreListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.Serialization.cs index 52dbf5f9e236..36b19c7e7ce3 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppConfiguration.Models { - public partial class AppConfigurationStorePatch : IUtf8JsonSerializable + public partial class AppConfigurationStorePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -23,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -41,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(DisableLocalAuth)) { @@ -59,7 +82,174 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(EnablePurgeProtection.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AppConfigurationStorePatch DeserializeAppConfigurationStorePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional identity = default; + Optional sku = default; + Optional> tags = default; + Optional encryption = default; + Optional disableLocalAuth = default; + Optional publicNetworkAccess = default; + Optional enablePurgeProtection = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AppConfigurationSku.DeserializeAppConfigurationSku(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = AppConfigurationStoreEncryptionProperties.DeserializeAppConfigurationStoreEncryptionProperties(property0.Value); + continue; + } + if (property0.NameEquals("disableLocalAuth"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new AppConfigurationPublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enablePurgeProtection"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePurgeProtection = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppConfigurationStorePatch(identity, sku.Value, Optional.ToDictionary(tags), encryption.Value, Optional.ToNullable(disableLocalAuth), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enablePurgeProtection), serializedAdditionalRawData); + } + + AppConfigurationStorePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppConfigurationStorePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppConfigurationStorePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppConfigurationStorePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppConfigurationStorePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppConfigurationStorePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppConfigurationStorePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.cs index 04fe562bdc91..53e4d1551e76 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/AppConfigurationStorePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,36 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// The parameters for updating a configuration store. public partial class AppConfigurationStorePatch { - /// Initializes a new instance of AppConfigurationStorePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppConfigurationStorePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The managed identity information for the configuration store. + /// The SKU of the configuration store. + /// The ARM resource tags. + /// The encryption settings of the configuration store. + /// Disables all authentication methods other than AAD authentication. + /// Control permission for data plane traffic coming from public networks while private endpoint is enabled. + /// Property specifying whether protection against purge is enabled for this configuration store. + /// Keeps track of any properties unknown to the library. + internal AppConfigurationStorePatch(ManagedServiceIdentity identity, AppConfigurationSku sku, IDictionary tags, AppConfigurationStoreEncryptionProperties encryption, bool? disableLocalAuth, AppConfigurationPublicNetworkAccess? publicNetworkAccess, bool? enablePurgeProtection, Dictionary serializedAdditionalRawData) + { + Identity = identity; + Sku = sku; + Tags = tags; + Encryption = encryption; + DisableLocalAuth = disableLocalAuth; + PublicNetworkAccess = publicNetworkAccess; + EnablePurgeProtection = enablePurgeProtection; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The managed identity information for the configuration store. public ManagedServiceIdentity Identity { get; set; } /// The SKU of the configuration store. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedAppConfigurationStoreData.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedAppConfigurationStoreData.Serialization.cs index 11fad38356b0..75790cc07ec7 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedAppConfigurationStoreData.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedAppConfigurationStoreData.Serialization.cs @@ -8,15 +8,44 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppConfiguration { - public partial class DeletedAppConfigurationStoreData + public partial class DeletedAppConfigurationStoreData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeletedAppConfigurationStoreData DeserializeDeletedAppConfigurationStoreData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeletedAppConfigurationStoreData DeserializeDeletedAppConfigurationStoreData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +60,7 @@ internal static DeletedAppConfigurationStoreData DeserializeDeletedAppConfigurat Optional scheduledPurgeDate = default; Optional> tags = default; Optional purgeProtectionEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -128,8 +158,61 @@ internal static DeletedAppConfigurationStoreData DeserializeDeletedAppConfigurat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeletedAppConfigurationStoreData(id, name, type, systemData.Value, configurationStoreId.Value, Optional.ToNullable(location), Optional.ToNullable(deletionDate), Optional.ToNullable(scheduledPurgeDate), Optional.ToDictionary(tags), Optional.ToNullable(purgeProtectionEnabled)); + return new DeletedAppConfigurationStoreData(id, name, type, systemData.Value, configurationStoreId.Value, Optional.ToNullable(location), Optional.ToNullable(deletionDate), Optional.ToNullable(scheduledPurgeDate), Optional.ToDictionary(tags), Optional.ToNullable(purgeProtectionEnabled), serializedAdditionalRawData); + } + + DeletedAppConfigurationStoreData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeletedAppConfigurationStoreData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeletedAppConfigurationStoreData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeletedAppConfigurationStoreData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeletedAppConfigurationStoreData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeletedAppConfigurationStoreData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeletedAppConfigurationStoreData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.Serialization.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.Serialization.cs index cce31a76941e..a570c90330f9 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.Serialization.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppConfiguration; namespace Azure.ResourceManager.AppConfiguration.Models { - internal partial class DeletedConfigurationStoreListResult + internal partial class DeletedConfigurationStoreListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeletedConfigurationStoreListResult DeserializeDeletedConfigurationStoreListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeletedConfigurationStoreListResult DeserializeDeletedConfigurationStoreListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DeletedConfigurationStoreListResult DeserializeDeletedConfigurat nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeletedConfigurationStoreListResult(Optional.ToList(value), nextLink.Value); + return new DeletedConfigurationStoreListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DeletedConfigurationStoreListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeletedConfigurationStoreListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeletedConfigurationStoreListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeletedConfigurationStoreListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeletedConfigurationStoreListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeletedConfigurationStoreListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeletedConfigurationStoreListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.cs index 3fbf47ebeb3c..caa3f3233d12 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Models/DeletedConfigurationStoreListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppConfiguration; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppConfiguration.Models /// List of deleted configuration stores. internal partial class DeletedConfigurationStoreListResult { - /// Initializes a new instance of DeletedConfigurationStoreListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeletedConfigurationStoreListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DeletedConfigurationStoreListResult. + /// Initializes a new instance of . /// The list of deleted configuration store. /// The URL to get the next set of deleted configuration stores. - internal DeletedConfigurationStoreListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DeletedConfigurationStoreListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of deleted configuration store. diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs index ef4dae87e41a..402b56c7423e 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/AppConfigurationManagementRestOperations.cs @@ -51,9 +51,7 @@ internal HttpMessage CreateCheckAppConfigurationNameAvailabilityRequest(string s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs index 6ef0f2fd9cc2..011153cbf136 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/ConfigurationStoresRestOperations.cs @@ -288,9 +288,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -438,9 +436,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -602,9 +598,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs index 5233fc5b92a2..7e0cacb04bd6 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/KeyValuesRestOperations.cs @@ -229,9 +229,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 41e5b528a903..bddc591de956 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs index 9b203903cd5e..62f2893a33dd 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _applicationInsightsComponentComponentsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _applicationInsightsComponentComponentsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), _applicationInsightsComponentComponentsClientDiagnostics, Pipeline, "ApplicationInsightsComponentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), _applicationInsightsComponentComponentsClientDiagnostics, Pipeline, "ApplicationInsightsComponentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _applicationInsightsComponentComponentsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _applicationInsightsComponentComponentsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), _applicationInsightsComponentComponentsClientDiagnostics, Pipeline, "ApplicationInsightsComponentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), _applicationInsightsComponentComponentsClientDiagnostics, Pipeline, "ApplicationInsightsComponentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentData.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentData.cs index 7b631065ef25..1ff47ed16b7b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentData.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ApplicationInsights /// public partial class ApplicationInsightsComponentData : TrackedResourceData { - /// Initializes a new instance of ApplicationInsightsComponentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. /// is null. @@ -32,7 +35,7 @@ public ApplicationInsightsComponentData(AzureLocation location, string kind) : b PrivateLinkScopedResources = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -66,7 +69,8 @@ public ApplicationInsightsComponentData(AzureLocation location, string kind) : b /// Indicates the flow of the ingestion. /// Disable Non-AAD based Auth. /// Force users to create their own storage account for profiler and debugger. - internal ApplicationInsightsComponentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string kind, ETag? etag, string applicationId, string appId, string namePropertiesName, ApplicationType? applicationType, FlowType? flowType, RequestSource? requestSource, string instrumentationKey, DateTimeOffset? createdOn, Guid? tenantId, string hockeyAppId, string hockeyAppToken, string provisioningState, double? samplingPercentage, string connectionString, int? retentionInDays, bool? isDisableIPMasking, bool? isImmediatePurgeDataOn30Days, string workspaceResourceId, DateTimeOffset? laMigrationOn, IReadOnlyList privateLinkScopedResources, PublicNetworkAccessType? publicNetworkAccessForIngestion, PublicNetworkAccessType? publicNetworkAccessForQuery, IngestionMode? ingestionMode, bool? isDisableLocalAuth, bool? isForceCustomerStorageForProfiler) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string kind, ETag? etag, string applicationId, string appId, string namePropertiesName, ApplicationType? applicationType, FlowType? flowType, RequestSource? requestSource, string instrumentationKey, DateTimeOffset? createdOn, Guid? tenantId, string hockeyAppId, string hockeyAppToken, string provisioningState, double? samplingPercentage, string connectionString, int? retentionInDays, bool? isDisableIPMasking, bool? isImmediatePurgeDataOn30Days, string workspaceResourceId, DateTimeOffset? laMigrationOn, IReadOnlyList privateLinkScopedResources, PublicNetworkAccessType? publicNetworkAccessForIngestion, PublicNetworkAccessType? publicNetworkAccessForQuery, IngestionMode? ingestionMode, bool? isDisableLocalAuth, bool? isForceCustomerStorageForProfiler, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ETag = etag; @@ -95,6 +99,12 @@ internal ApplicationInsightsComponentData(ResourceIdentifier id, string name, Re IngestionMode = ingestionMode; IsDisableLocalAuth = isDisableLocalAuth; IsForceCustomerStorageForProfiler = isForceCustomerStorageForProfiler; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApplicationInsightsComponentData() + { } /// The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs index 57c0026c6cf2..5d492a3ec0c4 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs @@ -2595,7 +2595,7 @@ public virtual AsyncPageable GetWebTestsAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _webTestRestClient.CreateListByComponentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _webTestRestClient.CreateListByComponentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "ApplicationInsightsComponentResource.GetWebTests", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "ApplicationInsightsComponentResource.GetWebTests", "value", "nextLink", cancellationToken); } /// @@ -2617,7 +2617,7 @@ public virtual Pageable GetWebTests(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _webTestRestClient.CreateListByComponentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _webTestRestClient.CreateListByComponentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "ApplicationInsightsComponentResource.GetWebTests", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "ApplicationInsightsComponentResource.GetWebTests", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ArmApplicationInsightsModelFactory.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ArmApplicationInsightsModelFactory.cs index 69fb8b528b39..fac48c5a76c8 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ArmApplicationInsightsModelFactory.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ArmApplicationInsightsModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Model factory for models. public static partial class ArmApplicationInsightsModelFactory { - /// Initializes a new instance of ApplicationInsightsComponentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -58,41 +58,35 @@ public static ApplicationInsightsComponentData ApplicationInsightsComponentData( tags ??= new Dictionary(); privateLinkScopedResources ??= new List(); - return new ApplicationInsightsComponentData(id, name, resourceType, systemData, tags, location, kind, etag, applicationId, appId, namePropertiesName, applicationType, flowType, requestSource, instrumentationKey, createdOn, tenantId, hockeyAppId, hockeyAppToken, provisioningState, samplingPercentage, connectionString, retentionInDays, isDisableIPMasking, isImmediatePurgeDataOn30Days, workspaceResourceId, laMigrationOn, privateLinkScopedResources?.ToList(), publicNetworkAccessForIngestion, publicNetworkAccessForQuery, ingestionMode, isDisableLocalAuth, isForceCustomerStorageForProfiler); + return new ApplicationInsightsComponentData(id, name, resourceType, systemData, tags, location, kind, etag, applicationId, appId, namePropertiesName, applicationType, flowType, requestSource, instrumentationKey, createdOn, tenantId, hockeyAppId, hockeyAppToken, provisioningState, samplingPercentage, connectionString, retentionInDays, isDisableIPMasking, isImmediatePurgeDataOn30Days, workspaceResourceId, laMigrationOn, privateLinkScopedResources?.ToList(), publicNetworkAccessForIngestion, publicNetworkAccessForQuery, ingestionMode, isDisableLocalAuth, isForceCustomerStorageForProfiler, default); } - /// Initializes a new instance of PrivateLinkScopedResource. + /// Initializes a new instance of . /// The full resource Id of the private link scope resource. /// The private link scope unique Identifier. /// A new instance for mocking. public static PrivateLinkScopedResource PrivateLinkScopedResource(string resourceId = null, string scopeId = null) { - return new PrivateLinkScopedResource(resourceId, scopeId); + return new PrivateLinkScopedResource(resourceId, scopeId, default); } - /// Initializes a new instance of ComponentPurgeResponse. + /// Initializes a new instance of . /// Id to use when querying for status for a particular purge operation. - /// is null. /// A new instance for mocking. public static ComponentPurgeResponse ComponentPurgeResponse(string operationId = null) { - if (operationId == null) - { - throw new ArgumentNullException(nameof(operationId)); - } - - return new ComponentPurgeResponse(operationId); + return new ComponentPurgeResponse(operationId, default); } - /// Initializes a new instance of ComponentPurgeStatusResponse. + /// Initializes a new instance of . /// Status of the operation represented by the requested Id. /// A new instance for mocking. public static ComponentPurgeStatusResponse ComponentPurgeStatusResponse(PurgeState status = default) { - return new ComponentPurgeStatusResponse(status); + return new ComponentPurgeStatusResponse(status, default); } - /// Initializes a new instance of ApplicationInsightsComponentAPIKey. + /// Initializes a new instance of . /// The unique ID of the API key inside an Application Insights component. It is auto generated when the API key is created. /// The API key value. It will be only return once when the API Key was created. /// The create date of this API key. @@ -105,10 +99,10 @@ public static ApplicationInsightsComponentAPIKey ApplicationInsightsComponentAPI linkedReadProperties ??= new List(); linkedWriteProperties ??= new List(); - return new ApplicationInsightsComponentAPIKey(id, apiKey, createdDate, name, linkedReadProperties?.ToList(), linkedWriteProperties?.ToList()); + return new ApplicationInsightsComponentAPIKey(id, apiKey, createdDate, name, linkedReadProperties?.ToList(), linkedWriteProperties?.ToList(), default); } - /// Initializes a new instance of ApplicationInsightsComponentExportConfiguration. + /// Initializes a new instance of . /// The unique ID of the export configuration inside an Application Insights component. It is auto generated when the Continuous Export configuration is created. /// The instrumentation key of the Application Insights component. /// This comma separated list of document types that will be exported. The possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. @@ -131,10 +125,10 @@ public static ApplicationInsightsComponentAPIKey ApplicationInsightsComponentAPI /// A new instance for mocking. public static ApplicationInsightsComponentExportConfiguration ApplicationInsightsComponentExportConfiguration(string exportId = null, string instrumentationKey = null, string recordTypes = null, string applicationName = null, string subscriptionId = null, string resourceGroup = null, string destinationStorageSubscriptionId = null, string destinationStorageLocationId = null, string destinationAccountId = null, string destinationType = null, string isUserEnabled = null, string lastUserUpdate = null, string notificationQueueEnabled = null, string exportStatus = null, string lastSuccessTime = null, string lastGapTime = null, string permanentErrorReason = null, string storageName = null, string containerName = null) { - return new ApplicationInsightsComponentExportConfiguration(exportId, instrumentationKey, recordTypes, applicationName, subscriptionId, resourceGroup, destinationStorageSubscriptionId, destinationStorageLocationId, destinationAccountId, destinationType, isUserEnabled, lastUserUpdate, notificationQueueEnabled, exportStatus, lastSuccessTime, lastGapTime, permanentErrorReason, storageName, containerName); + return new ApplicationInsightsComponentExportConfiguration(exportId, instrumentationKey, recordTypes, applicationName, subscriptionId, resourceGroup, destinationStorageSubscriptionId, destinationStorageLocationId, destinationAccountId, destinationType, isUserEnabled, lastUserUpdate, notificationQueueEnabled, exportStatus, lastSuccessTime, lastGapTime, permanentErrorReason, storageName, containerName, default); } - /// Initializes a new instance of ApplicationInsightsComponentDataVolumeCap. + /// Initializes a new instance of . /// Daily data volume cap in GB. /// Daily data volume cap UTC reset hour. /// Reserved, not used for now. @@ -144,20 +138,20 @@ public static ApplicationInsightsComponentExportConfiguration ApplicationInsight /// A new instance for mocking. public static ApplicationInsightsComponentDataVolumeCap ApplicationInsightsComponentDataVolumeCap(float? cap = null, int? resetTime = null, int? warningThreshold = null, bool? isStopSendNotificationWhenHitThreshold = null, bool? isStopSendNotificationWhenHitCap = null, float? maxHistoryCap = null) { - return new ApplicationInsightsComponentDataVolumeCap(cap, resetTime, warningThreshold, isStopSendNotificationWhenHitThreshold, isStopSendNotificationWhenHitCap, maxHistoryCap); + return new ApplicationInsightsComponentDataVolumeCap(cap, resetTime, warningThreshold, isStopSendNotificationWhenHitThreshold, isStopSendNotificationWhenHitCap, maxHistoryCap, default); } - /// Initializes a new instance of ApplicationInsightsComponentQuotaStatus. + /// Initializes a new instance of . /// The Application ID for the Application Insights component. /// The daily data volume cap is met, and data ingestion will be stopped. /// Date and time when the daily data volume cap will be reset, and data ingestion will resume. /// A new instance for mocking. public static ApplicationInsightsComponentQuotaStatus ApplicationInsightsComponentQuotaStatus(string appId = null, bool? shouldBeThrottled = null, string expirationTime = null) { - return new ApplicationInsightsComponentQuotaStatus(appId, shouldBeThrottled, expirationTime); + return new ApplicationInsightsComponentQuotaStatus(appId, shouldBeThrottled, expirationTime, default); } - /// Initializes a new instance of ApplicationInsightsComponentFeatureCapabilities. + /// Initializes a new instance of . /// Whether allow to use continuous export feature. /// Reserved, not used now. /// Reserved, not used now. @@ -177,20 +171,20 @@ public static ApplicationInsightsComponentQuotaStatus ApplicationInsightsCompone /// A new instance for mocking. public static ApplicationInsightsComponentFeatureCapabilities ApplicationInsightsComponentFeatureCapabilities(bool? supportExportData = null, string burstThrottlePolicy = null, string metadataClass = null, bool? liveStreamMetrics = null, bool? applicationMap = null, bool? workItemIntegration = null, bool? powerBIIntegration = null, bool? openSchema = null, bool? proactiveDetection = null, bool? analyticsIntegration = null, bool? multipleStepWebTest = null, string apiAccessLevel = null, string trackingType = null, float? dailyCap = null, float? dailyCapResetTime = null, float? throttleRate = null) { - return new ApplicationInsightsComponentFeatureCapabilities(supportExportData, burstThrottlePolicy, metadataClass, liveStreamMetrics, applicationMap, workItemIntegration, powerBIIntegration, openSchema, proactiveDetection, analyticsIntegration, multipleStepWebTest, apiAccessLevel, trackingType, dailyCap, dailyCapResetTime, throttleRate); + return new ApplicationInsightsComponentFeatureCapabilities(supportExportData, burstThrottlePolicy, metadataClass, liveStreamMetrics, applicationMap, workItemIntegration, powerBIIntegration, openSchema, proactiveDetection, analyticsIntegration, multipleStepWebTest, apiAccessLevel, trackingType, dailyCap, dailyCapResetTime, throttleRate, default); } - /// Initializes a new instance of ApplicationInsightsComponentAvailableFeatures. + /// Initializes a new instance of . /// A list of Application Insights component feature. /// A new instance for mocking. public static ApplicationInsightsComponentAvailableFeatures ApplicationInsightsComponentAvailableFeatures(IEnumerable result = null) { result ??= new List(); - return new ApplicationInsightsComponentAvailableFeatures(result?.ToList()); + return new ApplicationInsightsComponentAvailableFeatures(result?.ToList(), default); } - /// Initializes a new instance of ApplicationInsightsComponentFeature. + /// Initializes a new instance of . /// The pricing feature name. /// The meter id used for the feature. /// The meter rate for the feature's meter. @@ -205,10 +199,10 @@ public static ApplicationInsightsComponentFeature ApplicationInsightsComponentFe { capabilities ??= new List(); - return new ApplicationInsightsComponentFeature(featureName, meterId, meterRateFrequency, resourceId, isHidden, capabilities?.ToList(), title, isMainFeature, supportedAddonFeatures); + return new ApplicationInsightsComponentFeature(featureName, meterId, meterRateFrequency, resourceId, isHidden, capabilities?.ToList(), title, isMainFeature, supportedAddonFeatures, default); } - /// Initializes a new instance of ApplicationInsightsComponentFeatureCapability. + /// Initializes a new instance of . /// The name of the capability. /// The description of the capability. /// The value of the capability. @@ -218,10 +212,10 @@ public static ApplicationInsightsComponentFeature ApplicationInsightsComponentFe /// A new instance for mocking. public static ApplicationInsightsComponentFeatureCapability ApplicationInsightsComponentFeatureCapability(string name = null, string description = null, string value = null, string unit = null, string meterId = null, string meterRateFrequency = null) { - return new ApplicationInsightsComponentFeatureCapability(name, description, value, unit, meterId, meterRateFrequency); + return new ApplicationInsightsComponentFeatureCapability(name, description, value, unit, meterId, meterRateFrequency, default); } - /// Initializes a new instance of WorkItemConfiguration. + /// Initializes a new instance of . /// Connector identifier where work item is created. /// Configuration friendly name. /// Boolean value indicating whether configuration is default. @@ -230,10 +224,10 @@ public static ApplicationInsightsComponentFeatureCapability ApplicationInsightsC /// A new instance for mocking. public static WorkItemConfiguration WorkItemConfiguration(string connectorId = null, string configDisplayName = null, bool? isDefault = null, string id = null, string configProperties = null) { - return new WorkItemConfiguration(connectorId, configDisplayName, isDefault, id, configProperties); + return new WorkItemConfiguration(connectorId, configDisplayName, isDefault, id, configProperties, default); } - /// Initializes a new instance of ApplicationInsightsComponentFavorite. + /// Initializes a new instance of . /// The user-defined name of the favorite. /// Configuration of this particular favorite, which are driven by the Azure portal UX. Configuration data is a string containing valid JSON. /// This instance's version of the data model. This can change as new features are added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. @@ -250,19 +244,19 @@ public static ApplicationInsightsComponentFavorite ApplicationInsightsComponentF { tags ??= new List(); - return new ApplicationInsightsComponentFavorite(name, config, version, favoriteId, favoriteType, sourceType, timeModified, tags?.ToList(), category, isGeneratedFromTemplate, userId); + return new ApplicationInsightsComponentFavorite(name, config, version, favoriteId, favoriteType, sourceType, timeModified, tags?.ToList(), category, isGeneratedFromTemplate, userId, default); } - /// Initializes a new instance of ApplicationInsightsComponentWebTestLocation. + /// Initializes a new instance of . /// The display name of the web test location. /// Internally defined geographic location tag. /// A new instance for mocking. public static ApplicationInsightsComponentWebTestLocation ApplicationInsightsComponentWebTestLocation(string displayName = null, string tag = null) { - return new ApplicationInsightsComponentWebTestLocation(displayName, tag); + return new ApplicationInsightsComponentWebTestLocation(displayName, tag, default); } - /// Initializes a new instance of WebTestData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -289,10 +283,10 @@ public static WebTestData WebTestData(ResourceIdentifier id = null, string name tags ??= new Dictionary(); locations ??= new List(); - return new WebTestData(id, name, resourceType, systemData, tags, location, kind, syntheticMonitorId, webTestName, description, isEnabled, frequencyInSeconds, timeoutInSeconds, webTestKind, isRetryEnabled, locations?.ToList(), webTest != null ? new WebTestPropertiesConfiguration(webTest) : null, provisioningState, request, validationRules); + return new WebTestData(id, name, resourceType, systemData, tags, location, kind, syntheticMonitorId, webTestName, description, isEnabled, frequencyInSeconds, timeoutInSeconds, webTestKind, isRetryEnabled, locations?.ToList(), webTest != null ? new WebTestPropertiesConfiguration(webTest, new Dictionary()) : null, provisioningState, request, validationRules, default); } - /// Initializes a new instance of ApplicationInsightsComponentAnalyticsItem. + /// Initializes a new instance of . /// Internally assigned unique id of the item definition. /// The user-defined name of the item. /// The content of this item. @@ -305,10 +299,10 @@ public static WebTestData WebTestData(ResourceIdentifier id = null, string name /// A new instance for mocking. public static ApplicationInsightsComponentAnalyticsItem ApplicationInsightsComponentAnalyticsItem(string id = null, string name = null, string content = null, string version = null, ItemScope? scope = null, ItemType? itemType = null, string timeCreated = null, string timeModified = null, string applicationInsightsComponentAnalyticsItemFunctionAlias = null) { - return new ApplicationInsightsComponentAnalyticsItem(id, name, content, version, scope, itemType, timeCreated, timeModified, applicationInsightsComponentAnalyticsItemFunctionAlias != null ? new ApplicationInsightsComponentAnalyticsItemProperties(applicationInsightsComponentAnalyticsItemFunctionAlias) : null); + return new ApplicationInsightsComponentAnalyticsItem(id, name, content, version, scope, itemType, timeCreated, timeModified, applicationInsightsComponentAnalyticsItemFunctionAlias != null ? new ApplicationInsightsComponentAnalyticsItemProperties(applicationInsightsComponentAnalyticsItemFunctionAlias, new Dictionary()) : null, default); } - /// Initializes a new instance of WorkbookTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -327,10 +321,10 @@ public static WorkbookTemplateData WorkbookTemplateData(ResourceIdentifier id = galleries ??= new List(); localizedGalleries ??= new Dictionary>(); - return new WorkbookTemplateData(id, name, resourceType, systemData, tags, location, priority, author, templateData, galleries?.ToList(), localizedGalleries); + return new WorkbookTemplateData(id, name, resourceType, systemData, tags, location, priority, author, templateData, galleries?.ToList(), localizedGalleries, default); } - /// Initializes a new instance of MyWorkbookData. + /// Initializes a new instance of . /// Identity used for BYOS. /// Azure resource Id. /// Azure resource name. @@ -354,19 +348,19 @@ public static MyWorkbookData MyWorkbookData(MyWorkbookManagedIdentity identity = tags ??= new Dictionary(); etag ??= new Dictionary(); - return new MyWorkbookData(identity, id, name, resourceType, location, tags, etag, kind, systemData, displayName, serializedData, version, timeModified, category, userId, sourceId, storageUri); + return new MyWorkbookData(identity, id, name, resourceType, location, tags, etag, kind, systemData, displayName, serializedData, version, timeModified, category, userId, sourceId, storageUri, default); } - /// Initializes a new instance of MyWorkbookUserAssignedIdentities. + /// Initializes a new instance of . /// The principal ID of resource identity. /// The tenant ID of resource. /// A new instance for mocking. public static MyWorkbookUserAssignedIdentities MyWorkbookUserAssignedIdentities(string principalId = null, Guid? tenantId = null) { - return new MyWorkbookUserAssignedIdentities(principalId, tenantId); + return new MyWorkbookUserAssignedIdentities(principalId, tenantId, default); } - /// Initializes a new instance of WorkbookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -391,18 +385,18 @@ public static WorkbookData WorkbookData(ResourceIdentifier id = null, string nam { tags ??= new Dictionary(); - return new WorkbookData(id, name, resourceType, systemData, tags, location, displayName, serializedData, version, modifiedOn, category, userId, sourceId, storageUri, description, revision, identity, kind, etag); + return new WorkbookData(id, name, resourceType, systemData, tags, location, displayName, serializedData, version, modifiedOn, category, userId, sourceId, storageUri, description, revision, identity, kind, etag, default); } - /// Initializes a new instance of LiveTokenResponse. + /// Initializes a new instance of . /// JWT token for accessing live metrics stream data. /// A new instance for mocking. public static LiveTokenResponse LiveTokenResponse(string liveToken = null) { - return new LiveTokenResponse(liveToken); + return new LiveTokenResponse(liveToken, default); } - /// Initializes a new instance of ComponentLinkedStorageAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -411,7 +405,7 @@ public static LiveTokenResponse LiveTokenResponse(string liveToken = null) /// A new instance for mocking. public static ComponentLinkedStorageAccountData ComponentLinkedStorageAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string linkedStorageAccount = null) { - return new ComponentLinkedStorageAccountData(id, name, resourceType, systemData, linkedStorageAccount); + return new ComponentLinkedStorageAccountData(id, name, resourceType, systemData, linkedStorageAccount, default); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountData.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountData.cs index 498fe2a1cee2..a8000d24f001 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountData.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,20 +18,25 @@ namespace Azure.ResourceManager.ApplicationInsights /// public partial class ComponentLinkedStorageAccountData : ResourceData { - /// Initializes a new instance of ComponentLinkedStorageAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComponentLinkedStorageAccountData() { } - /// Initializes a new instance of ComponentLinkedStorageAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Linked storage account resource ID. - internal ComponentLinkedStorageAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string linkedStorageAccount) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ComponentLinkedStorageAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string linkedStorageAccount, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { LinkedStorageAccount = linkedStorageAccount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Linked storage account resource ID. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index ba6c2fd5c912..77b044737af9 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -74,7 +74,7 @@ public virtual AsyncPageable GetApplicatio { HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationInsightsComponentComponentsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationInsightsComponentComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); } /// @@ -96,7 +96,7 @@ public virtual Pageable GetApplicationInsi { HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationInsightsComponentComponentsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationInsightsComponentComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); } /// @@ -118,7 +118,7 @@ public virtual AsyncPageable GetWebTestsAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => WebTestRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebTestRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebTests", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebTests", "value", "nextLink", cancellationToken); } /// @@ -140,7 +140,7 @@ public virtual Pageable GetWebTests(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => WebTestRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebTestRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebTests", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebTests", "value", "nextLink", cancellationToken); } /// @@ -165,7 +165,7 @@ public virtual AsyncPageable GetMyWorkbooksAsync(CategoryTyp { HttpMessage FirstPageRequest(int? pageSizeHint) => MyWorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MyWorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMyWorkbooks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMyWorkbooks", "value", "nextLink", cancellationToken); } /// @@ -190,7 +190,7 @@ public virtual Pageable GetMyWorkbooks(CategoryType category { HttpMessage FirstPageRequest(int? pageSizeHint) => MyWorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MyWorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMyWorkbooks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMyWorkbooks", "value", "nextLink", cancellationToken); } /// @@ -215,7 +215,7 @@ public virtual AsyncPageable GetWorkbooksAsync(CategoryType ca { HttpMessage FirstPageRequest(int? pageSizeHint) => WorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWorkbooks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWorkbooks", "value", "nextLink", cancellationToken); } /// @@ -240,7 +240,7 @@ public virtual Pageable GetWorkbooks(CategoryType category, IE { HttpMessage FirstPageRequest(int? pageSizeHint) => WorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWorkbooks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWorkbooks", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.Serialization.cs index 86d2f861e370..3de1640aa863 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class APIKeyContent : IUtf8JsonSerializable + public partial class APIKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -40,7 +48,123 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static APIKeyContent DeserializeAPIKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional> linkedReadProperties = default; + Optional> linkedWriteProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("linkedReadProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + linkedReadProperties = array; + continue; + } + if (property.NameEquals("linkedWriteProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + linkedWriteProperties = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new APIKeyContent(name.Value, Optional.ToList(linkedReadProperties), Optional.ToList(linkedWriteProperties), serializedAdditionalRawData); + } + + APIKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAPIKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + APIKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAPIKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(APIKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator APIKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAPIKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.cs index 683b99301f97..31113011ce94 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/APIKeyContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,29 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// An Application Insights component API Key creation request definition. public partial class APIKeyContent { - /// Initializes a new instance of APIKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public APIKeyContent() { LinkedReadProperties = new ChangeTrackingList(); LinkedWriteProperties = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The name of the API Key. + /// The read access rights of this API Key. + /// The write access rights of this API Key. + /// Keeps track of any properties unknown to the library. + internal APIKeyContent(string name, IList linkedReadProperties, IList linkedWriteProperties, Dictionary serializedAdditionalRawData) + { + Name = name; + LinkedReadProperties = linkedReadProperties; + LinkedWriteProperties = linkedWriteProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the API Key. public string Name { get; set; } /// The read access rights of this API Key. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.Serialization.cs index 9a121a819c0d..943c2c73d1e0 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class Annotation : IUtf8JsonSerializable + public partial class Annotation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AnnotationName)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("RelatedAnnotation"u8); writer.WriteStringValue(RelatedAnnotation); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Annotation DeserializeAnnotation(JsonElement element) + internal static Annotation DeserializeAnnotation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +82,7 @@ internal static Annotation DeserializeAnnotation(JsonElement element) Optional id = default; Optional properties = default; Optional relatedAnnotation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("AnnotationName"u8)) @@ -97,8 +119,61 @@ internal static Annotation DeserializeAnnotation(JsonElement element) relatedAnnotation = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Annotation(annotationName.Value, category.Value, Optional.ToNullable(eventTime), id.Value, properties.Value, relatedAnnotation.Value, serializedAdditionalRawData); + } + + Annotation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnnotation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Annotation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnnotation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Annotation model) + { + if (model is null) + { + return null; } - return new Annotation(annotationName.Value, category.Value, Optional.ToNullable(eventTime), id.Value, properties.Value, relatedAnnotation.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Annotation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnnotation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.cs index 8a1d109be330..6ef0a60a2de1 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/Annotation.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApplicationInsights.Models { /// Annotation associated with an application insights resource. public partial class Annotation { - /// Initializes a new instance of Annotation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Annotation() { } - /// Initializes a new instance of Annotation. + /// Initializes a new instance of . /// Name of annotation. /// Category of annotation, free form. /// Time when event occurred. /// Unique Id for annotation. /// Serialized JSON object for detailed properties. /// Related parent annotation if any. - internal Annotation(string annotationName, string category, DateTimeOffset? eventOn, string id, string properties, string relatedAnnotation) + /// Keeps track of any properties unknown to the library. + internal Annotation(string annotationName, string category, DateTimeOffset? eventOn, string id, string properties, string relatedAnnotation, Dictionary serializedAdditionalRawData) { AnnotationName = annotationName; Category = category; @@ -32,6 +37,7 @@ internal Annotation(string annotationName, string category, DateTimeOffset? even Id = id; Properties = properties; RelatedAnnotation = relatedAnnotation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of annotation. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.Serialization.cs index 0fb771541230..a573d70e4841 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class AnnotationsListResult + internal partial class AnnotationsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnnotationsListResult DeserializeAnnotationsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnnotationsListResult DeserializeAnnotationsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static AnnotationsListResult DeserializeAnnotationsListResult(JsonEleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnnotationsListResult(Optional.ToList(value)); + return new AnnotationsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AnnotationsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnnotationsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnnotationsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnnotationsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnnotationsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnnotationsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnnotationsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.cs index 762d2576a34c..9a3454876042 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/AnnotationsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Annotations list result. internal partial class AnnotationsListResult { - /// Initializes a new instance of AnnotationsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnnotationsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AnnotationsListResult. + /// Initializes a new instance of . /// An array of annotations. - internal AnnotationsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AnnotationsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of annotations. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.Serialization.cs index 806c5a9a04cc..ef0106ddfbe7 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.Serialization.cs @@ -5,16 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentAPIKey + public partial class ApplicationInsightsComponentAPIKey : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentAPIKey DeserializeApplicationInsightsComponentAPIKey(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(LinkedReadProperties)) + { + writer.WritePropertyName("linkedReadProperties"u8); + writer.WriteStartArray(); + foreach (var item in LinkedReadProperties) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(LinkedWriteProperties)) + { + writer.WritePropertyName("linkedWriteProperties"u8); + writer.WriteStartArray(); + foreach (var item in LinkedWriteProperties) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentAPIKey DeserializeApplicationInsightsComponentAPIKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +82,7 @@ internal static ApplicationInsightsComponentAPIKey DeserializeApplicationInsight Optional name = default; Optional> linkedReadProperties = default; Optional> linkedWriteProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -75,8 +133,61 @@ internal static ApplicationInsightsComponentAPIKey DeserializeApplicationInsight linkedWriteProperties = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentAPIKey(id.Value, apiKey.Value, createdDate.Value, name.Value, Optional.ToList(linkedReadProperties), Optional.ToList(linkedWriteProperties)); + return new ApplicationInsightsComponentAPIKey(id.Value, apiKey.Value, createdDate.Value, name.Value, Optional.ToList(linkedReadProperties), Optional.ToList(linkedWriteProperties), serializedAdditionalRawData); + } + + ApplicationInsightsComponentAPIKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentAPIKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentAPIKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentAPIKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentAPIKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentAPIKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentAPIKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs index 085f1a3987f2..21cea7c8b858 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,25 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Properties that define an API key of an Application Insights Component. public partial class ApplicationInsightsComponentAPIKey { - /// Initializes a new instance of ApplicationInsightsComponentAPIKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentAPIKey() { LinkedReadProperties = new ChangeTrackingList(); LinkedWriteProperties = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentAPIKey. + /// Initializes a new instance of . /// The unique ID of the API key inside an Application Insights component. It is auto generated when the API key is created. /// The API key value. It will be only return once when the API Key was created. /// The create date of this API key. /// The name of the API key. /// The read access rights of this API Key. /// The write access rights of this API Key. - internal ApplicationInsightsComponentAPIKey(string id, string apiKey, string createdDate, string name, IReadOnlyList linkedReadProperties, IReadOnlyList linkedWriteProperties) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentAPIKey(string id, string apiKey, string createdDate, string name, IReadOnlyList linkedReadProperties, IReadOnlyList linkedWriteProperties, Dictionary serializedAdditionalRawData) { Id = id; ApiKey = apiKey; @@ -35,6 +40,7 @@ internal ApplicationInsightsComponentAPIKey(string id, string apiKey, string cre Name = name; LinkedReadProperties = linkedReadProperties; LinkedWriteProperties = linkedWriteProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique ID of the API key inside an Application Insights component. It is auto generated when the API key is created. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.Serialization.cs index 2531618f6aeb..4cb1caab1248 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class ApplicationInsightsComponentAPIKeyListResult + internal partial class ApplicationInsightsComponentAPIKeyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentAPIKeyListResult DeserializeApplicationInsightsComponentAPIKeyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentAPIKeyListResult DeserializeApplicationInsightsComponentAPIKeyListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +74,61 @@ internal static ApplicationInsightsComponentAPIKeyListResult DeserializeApplicat value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentAPIKeyListResult(value); + return new ApplicationInsightsComponentAPIKeyListResult(value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentAPIKeyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentAPIKeyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentAPIKeyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentAPIKeyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentAPIKeyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentAPIKeyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentAPIKeyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.cs index c08b0f0b6202..e080f1689088 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKeyListResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Describes the list of API Keys of an Application Insights Component. internal partial class ApplicationInsightsComponentAPIKeyListResult { - /// Initializes a new instance of ApplicationInsightsComponentAPIKeyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of API Key definitions. /// is null. internal ApplicationInsightsComponentAPIKeyListResult(IEnumerable value) @@ -25,11 +28,18 @@ internal ApplicationInsightsComponentAPIKeyListResult(IEnumerable Initializes a new instance of ApplicationInsightsComponentAPIKeyListResult. + /// Initializes a new instance of . /// List of API Key definitions. - internal ApplicationInsightsComponentAPIKeyListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentAPIKeyListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApplicationInsightsComponentAPIKeyListResult() + { } /// List of API Key definitions. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.Serialization.cs index 8caf759d3eb2..8c445fa9b874 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentAnalyticsItem : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentAnalyticsItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -43,13 +51,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("Properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentAnalyticsItem DeserializeApplicationInsightsComponentAnalyticsItem(JsonElement element) + internal static ApplicationInsightsComponentAnalyticsItem DeserializeApplicationInsightsComponentAnalyticsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +92,7 @@ internal static ApplicationInsightsComponentAnalyticsItem DeserializeApplication Optional timeCreated = default; Optional timeModified = default; Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Id"u8)) @@ -122,8 +152,61 @@ internal static ApplicationInsightsComponentAnalyticsItem DeserializeApplication properties = ApplicationInsightsComponentAnalyticsItemProperties.DeserializeApplicationInsightsComponentAnalyticsItemProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentAnalyticsItem(id.Value, name.Value, content.Value, version.Value, Optional.ToNullable(scope), Optional.ToNullable(type), timeCreated.Value, timeModified.Value, properties.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentAnalyticsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentAnalyticsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentAnalyticsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentAnalyticsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentAnalyticsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentAnalyticsItem(Response response) + { + if (response is null) + { + return null; } - return new ApplicationInsightsComponentAnalyticsItem(id.Value, name.Value, content.Value, version.Value, Optional.ToNullable(scope), Optional.ToNullable(type), timeCreated.Value, timeModified.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentAnalyticsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs index 29341b9b26fc..0c455f073727 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Properties that define an Analytics item that is associated to an Application Insights component. public partial class ApplicationInsightsComponentAnalyticsItem { - /// Initializes a new instance of ApplicationInsightsComponentAnalyticsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentAnalyticsItem() { } - /// Initializes a new instance of ApplicationInsightsComponentAnalyticsItem. + /// Initializes a new instance of . /// Internally assigned unique id of the item definition. /// The user-defined name of the item. /// The content of this item. @@ -25,7 +31,8 @@ public ApplicationInsightsComponentAnalyticsItem() /// Date and time in UTC when this item was created. /// Date and time in UTC of the last modification that was made to this item. /// A set of properties that can be defined in the context of a specific item type. Each type may have its own properties. - internal ApplicationInsightsComponentAnalyticsItem(string id, string name, string content, string version, ItemScope? scope, ItemType? itemType, string timeCreated, string timeModified, ApplicationInsightsComponentAnalyticsItemProperties properties) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentAnalyticsItem(string id, string name, string content, string version, ItemScope? scope, ItemType? itemType, string timeCreated, string timeModified, ApplicationInsightsComponentAnalyticsItemProperties properties, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -36,6 +43,7 @@ internal ApplicationInsightsComponentAnalyticsItem(string id, string name, strin TimeCreated = timeCreated; TimeModified = timeModified; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Internally assigned unique id of the item definition. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.Serialization.cs index 7a3c6a5a51b3..b31252441e2e 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class ApplicationInsightsComponentAnalyticsItemProperties : IUtf8JsonSerializable + internal partial class ApplicationInsightsComponentAnalyticsItemProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FunctionAlias)) { writer.WritePropertyName("functionAlias"u8); writer.WriteStringValue(FunctionAlias); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentAnalyticsItemProperties DeserializeApplicationInsightsComponentAnalyticsItemProperties(JsonElement element) + internal static ApplicationInsightsComponentAnalyticsItemProperties DeserializeApplicationInsightsComponentAnalyticsItemProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional functionAlias = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("functionAlias"u8)) @@ -37,8 +60,61 @@ internal static ApplicationInsightsComponentAnalyticsItemProperties DeserializeA functionAlias = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentAnalyticsItemProperties(functionAlias.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentAnalyticsItemProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentAnalyticsItemProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentAnalyticsItemProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentAnalyticsItemProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentAnalyticsItemProperties model) + { + if (model is null) + { + return null; } - return new ApplicationInsightsComponentAnalyticsItemProperties(functionAlias.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentAnalyticsItemProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentAnalyticsItemProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs index b96133d94b6f..661cf9b47e8f 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// A set of properties that can be defined in the context of a specific item type. Each type may have its own properties. internal partial class ApplicationInsightsComponentAnalyticsItemProperties { - /// Initializes a new instance of ApplicationInsightsComponentAnalyticsItemProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentAnalyticsItemProperties() { } - /// Initializes a new instance of ApplicationInsightsComponentAnalyticsItemProperties. + /// Initializes a new instance of . /// A function alias, used when the type of the item is Function. - internal ApplicationInsightsComponentAnalyticsItemProperties(string functionAlias) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentAnalyticsItemProperties(string functionAlias, Dictionary serializedAdditionalRawData) { FunctionAlias = functionAlias; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A function alias, used when the type of the item is Function. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.Serialization.cs index 4d0a5edb75aa..779cfdc3d33b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentAvailableFeatures + public partial class ApplicationInsightsComponentAvailableFeatures : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentAvailableFeatures DeserializeApplicationInsightsComponentAvailableFeatures(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentAvailableFeatures DeserializeApplicationInsightsComponentAvailableFeatures(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> result = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Result"u8)) @@ -36,8 +64,61 @@ internal static ApplicationInsightsComponentAvailableFeatures DeserializeApplica result = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentAvailableFeatures(Optional.ToList(result)); + return new ApplicationInsightsComponentAvailableFeatures(Optional.ToList(result), serializedAdditionalRawData); + } + + ApplicationInsightsComponentAvailableFeatures IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentAvailableFeatures(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentAvailableFeatures IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentAvailableFeatures(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentAvailableFeatures model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentAvailableFeatures(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentAvailableFeatures(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs index 212062cd6dfe..ff6b8b40cbd1 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// An Application Insights component available features. public partial class ApplicationInsightsComponentAvailableFeatures { - /// Initializes a new instance of ApplicationInsightsComponentAvailableFeatures. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentAvailableFeatures() { Result = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentAvailableFeatures. + /// Initializes a new instance of . /// A list of Application Insights component feature. - internal ApplicationInsightsComponentAvailableFeatures(IReadOnlyList result) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentAvailableFeatures(IReadOnlyList result, Dictionary serializedAdditionalRawData) { Result = result; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of Application Insights component feature. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.Serialization.cs index b217d0844bf4..646317bf8f90 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentBillingFeatures : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentBillingFeatures : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DataVolumeCap)) { writer.WritePropertyName("DataVolumeCap"u8); - writer.WriteObjectValue(DataVolumeCap); + if (DataVolumeCap is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataVolumeCap).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(CurrentBillingFeatures)) { @@ -31,17 +45,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentBillingFeatures DeserializeApplicationInsightsComponentBillingFeatures(JsonElement element) + internal static ApplicationInsightsComponentBillingFeatures DeserializeApplicationInsightsComponentBillingFeatures(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional dataVolumeCap = default; Optional> currentBillingFeatures = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("DataVolumeCap"u8)) @@ -67,8 +96,61 @@ internal static ApplicationInsightsComponentBillingFeatures DeserializeApplicati currentBillingFeatures = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentBillingFeatures(dataVolumeCap.Value, Optional.ToList(currentBillingFeatures), serializedAdditionalRawData); + } + + ApplicationInsightsComponentBillingFeatures IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentBillingFeatures(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentBillingFeatures IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentBillingFeatures(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentBillingFeatures model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentBillingFeatures(Response response) + { + if (response is null) + { + return null; } - return new ApplicationInsightsComponentBillingFeatures(dataVolumeCap.Value, Optional.ToList(currentBillingFeatures)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentBillingFeatures(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs index 9cb32f3362e6..4d29ad345d3d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// An Application Insights component billing features. public partial class ApplicationInsightsComponentBillingFeatures { - /// Initializes a new instance of ApplicationInsightsComponentBillingFeatures. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentBillingFeatures() { CurrentBillingFeatures = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentBillingFeatures. + /// Initializes a new instance of . /// An Application Insights component daily data volume cap. /// Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. - internal ApplicationInsightsComponentBillingFeatures(ApplicationInsightsComponentDataVolumeCap dataVolumeCap, IList currentBillingFeatures) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentBillingFeatures(ApplicationInsightsComponentDataVolumeCap dataVolumeCap, IList currentBillingFeatures, Dictionary serializedAdditionalRawData) { DataVolumeCap = dataVolumeCap; CurrentBillingFeatures = currentBillingFeatures; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An Application Insights component daily data volume cap. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentData.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentData.Serialization.cs index 3f43ff6ea259..3d92f727aa66 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentData.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApplicationInsights { - public partial class ApplicationInsightsComponentData : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); @@ -113,11 +118,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsForceCustomerStorageForProfiler.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentData DeserializeApplicationInsightsComponentData(JsonElement element) + internal static ApplicationInsightsComponentData DeserializeApplicationInsightsComponentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -155,6 +174,7 @@ internal static ApplicationInsightsComponentData DeserializeApplicationInsightsC Optional ingestionMode = default; Optional disableLocalAuth = default; Optional forceCustomerStorageForProfiler = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -420,8 +440,61 @@ internal static ApplicationInsightsComponentData DeserializeApplicationInsightsC } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kind, Optional.ToNullable(etag), applicationId.Value, appId.Value, name0.Value, Optional.ToNullable(applicationType), Optional.ToNullable(flowType), Optional.ToNullable(requestSource), instrumentationKey.Value, Optional.ToNullable(creationDate), Optional.ToNullable(tenantId), hockeyAppId.Value, hockeyAppToken.Value, provisioningState.Value, Optional.ToNullable(samplingPercentage), connectionString.Value, Optional.ToNullable(retentionInDays), Optional.ToNullable(disableIPMasking), Optional.ToNullable(immediatePurgeDataOn30Days), workspaceResourceId.Value, Optional.ToNullable(laMigrationDate), Optional.ToList(privateLinkScopedResources), Optional.ToNullable(publicNetworkAccessForIngestion), Optional.ToNullable(publicNetworkAccessForQuery), Optional.ToNullable(ingestionMode), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(forceCustomerStorageForProfiler), serializedAdditionalRawData); + } + + ApplicationInsightsComponentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentData model) + { + if (model is null) + { + return null; } - return new ApplicationInsightsComponentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kind, Optional.ToNullable(etag), applicationId.Value, appId.Value, name0.Value, Optional.ToNullable(applicationType), Optional.ToNullable(flowType), Optional.ToNullable(requestSource), instrumentationKey.Value, Optional.ToNullable(creationDate), Optional.ToNullable(tenantId), hockeyAppId.Value, hockeyAppToken.Value, provisioningState.Value, Optional.ToNullable(samplingPercentage), connectionString.Value, Optional.ToNullable(retentionInDays), Optional.ToNullable(disableIPMasking), Optional.ToNullable(immediatePurgeDataOn30Days), workspaceResourceId.Value, Optional.ToNullable(laMigrationDate), Optional.ToList(privateLinkScopedResources), Optional.ToNullable(publicNetworkAccessForIngestion), Optional.ToNullable(publicNetworkAccessForQuery), Optional.ToNullable(ingestionMode), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(forceCustomerStorageForProfiler)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.Serialization.cs index ce69730a336f..ba9c4287810d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentDataVolumeCap : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentDataVolumeCap : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cap)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("StopSendNotificationWhenHitCap"u8); writer.WriteBooleanValue(IsStopSendNotificationWhenHitCap.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentDataVolumeCap DeserializeApplicationInsightsComponentDataVolumeCap(JsonElement element) + internal static ApplicationInsightsComponentDataVolumeCap DeserializeApplicationInsightsComponentDataVolumeCap(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +72,7 @@ internal static ApplicationInsightsComponentDataVolumeCap DeserializeApplication Optional stopSendNotificationWhenHitThreshold = default; Optional stopSendNotificationWhenHitCap = default; Optional maxHistoryCap = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Cap"u8)) @@ -106,8 +129,61 @@ internal static ApplicationInsightsComponentDataVolumeCap DeserializeApplication maxHistoryCap = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentDataVolumeCap(Optional.ToNullable(cap), Optional.ToNullable(resetTime), Optional.ToNullable(warningThreshold), Optional.ToNullable(stopSendNotificationWhenHitThreshold), Optional.ToNullable(stopSendNotificationWhenHitCap), Optional.ToNullable(maxHistoryCap), serializedAdditionalRawData); + } + + ApplicationInsightsComponentDataVolumeCap IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentDataVolumeCap(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentDataVolumeCap IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentDataVolumeCap(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentDataVolumeCap model) + { + if (model is null) + { + return null; } - return new ApplicationInsightsComponentDataVolumeCap(Optional.ToNullable(cap), Optional.ToNullable(resetTime), Optional.ToNullable(warningThreshold), Optional.ToNullable(stopSendNotificationWhenHitThreshold), Optional.ToNullable(stopSendNotificationWhenHitCap), Optional.ToNullable(maxHistoryCap)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentDataVolumeCap(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentDataVolumeCap(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs index 812d4724e21d..af680655ded1 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// An Application Insights component daily data volume cap. public partial class ApplicationInsightsComponentDataVolumeCap { - /// Initializes a new instance of ApplicationInsightsComponentDataVolumeCap. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentDataVolumeCap() { } - /// Initializes a new instance of ApplicationInsightsComponentDataVolumeCap. + /// Initializes a new instance of . /// Daily data volume cap in GB. /// Daily data volume cap UTC reset hour. /// Reserved, not used for now. /// Reserved, not used for now. /// Do not send a notification email when the daily data volume cap is met. /// Maximum daily data volume cap that the user can set for this component. - internal ApplicationInsightsComponentDataVolumeCap(float? cap, int? resetTime, int? warningThreshold, bool? isStopSendNotificationWhenHitThreshold, bool? isStopSendNotificationWhenHitCap, float? maxHistoryCap) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentDataVolumeCap(float? cap, int? resetTime, int? warningThreshold, bool? isStopSendNotificationWhenHitThreshold, bool? isStopSendNotificationWhenHitCap, float? maxHistoryCap, Dictionary serializedAdditionalRawData) { Cap = cap; ResetTime = resetTime; @@ -30,6 +37,7 @@ internal ApplicationInsightsComponentDataVolumeCap(float? cap, int? resetTime, i IsStopSendNotificationWhenHitThreshold = isStopSendNotificationWhenHitThreshold; IsStopSendNotificationWhenHitCap = isStopSendNotificationWhenHitCap; MaxHistoryCap = maxHistoryCap; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Daily data volume cap in GB. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.Serialization.cs index 253552ab6156..aeab7e434661 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.Serialization.cs @@ -5,15 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentExportConfiguration + public partial class ApplicationInsightsComponentExportConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentExportConfiguration DeserializeApplicationInsightsComponentExportConfiguration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RecordTypes)) + { + writer.WritePropertyName("RecordTypes"u8); + writer.WriteStringValue(RecordTypes); + } + if (Optional.IsDefined(NotificationQueueEnabled)) + { + writer.WritePropertyName("NotificationQueueEnabled"u8); + writer.WriteStringValue(NotificationQueueEnabled); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentExportConfiguration DeserializeApplicationInsightsComponentExportConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +75,7 @@ internal static ApplicationInsightsComponentExportConfiguration DeserializeAppli Optional permanentErrorReason = default; Optional storageName = default; Optional containerName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ExportId"u8)) @@ -134,8 +173,61 @@ internal static ApplicationInsightsComponentExportConfiguration DeserializeAppli containerName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentExportConfiguration(exportId.Value, instrumentationKey.Value, recordTypes.Value, applicationName.Value, subscriptionId.Value, resourceGroup.Value, destinationStorageSubscriptionId.Value, destinationStorageLocationId.Value, destinationAccountId.Value, destinationType.Value, isUserEnabled.Value, lastUserUpdate.Value, notificationQueueEnabled.Value, exportStatus.Value, lastSuccessTime.Value, lastGapTime.Value, permanentErrorReason.Value, storageName.Value, containerName.Value); + return new ApplicationInsightsComponentExportConfiguration(exportId.Value, instrumentationKey.Value, recordTypes.Value, applicationName.Value, subscriptionId.Value, resourceGroup.Value, destinationStorageSubscriptionId.Value, destinationStorageLocationId.Value, destinationAccountId.Value, destinationType.Value, isUserEnabled.Value, lastUserUpdate.Value, notificationQueueEnabled.Value, exportStatus.Value, lastSuccessTime.Value, lastGapTime.Value, permanentErrorReason.Value, storageName.Value, containerName.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentExportConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentExportConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentExportConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentExportConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentExportConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentExportConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentExportConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs index 842ea14b4acd..cb394e79e97c 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Properties that define a Continuous Export configuration. public partial class ApplicationInsightsComponentExportConfiguration { - /// Initializes a new instance of ApplicationInsightsComponentExportConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentExportConfiguration() { } - /// Initializes a new instance of ApplicationInsightsComponentExportConfiguration. + /// Initializes a new instance of . /// The unique ID of the export configuration inside an Application Insights component. It is auto generated when the Continuous Export configuration is created. /// The instrumentation key of the Application Insights component. /// This comma separated list of document types that will be exported. The possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. @@ -35,7 +41,8 @@ internal ApplicationInsightsComponentExportConfiguration() /// This is the reason the Continuous Export configuration started failing. It can be 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. /// The name of the destination storage account. /// The name of the destination storage container. - internal ApplicationInsightsComponentExportConfiguration(string exportId, string instrumentationKey, string recordTypes, string applicationName, string subscriptionId, string resourceGroup, string destinationStorageSubscriptionId, string destinationStorageLocationId, string destinationAccountId, string destinationType, string isUserEnabled, string lastUserUpdate, string notificationQueueEnabled, string exportStatus, string lastSuccessTime, string lastGapTime, string permanentErrorReason, string storageName, string containerName) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentExportConfiguration(string exportId, string instrumentationKey, string recordTypes, string applicationName, string subscriptionId, string resourceGroup, string destinationStorageSubscriptionId, string destinationStorageLocationId, string destinationAccountId, string destinationType, string isUserEnabled, string lastUserUpdate, string notificationQueueEnabled, string exportStatus, string lastSuccessTime, string lastGapTime, string permanentErrorReason, string storageName, string containerName, Dictionary serializedAdditionalRawData) { ExportId = exportId; InstrumentationKey = instrumentationKey; @@ -56,6 +63,7 @@ internal ApplicationInsightsComponentExportConfiguration(string exportId, string PermanentErrorReason = permanentErrorReason; StorageName = storageName; ContainerName = containerName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique ID of the export configuration inside an Application Insights component. It is auto generated when the Continuous Export configuration is created. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.Serialization.cs index a8cbe0bb927e..381ac24a9384 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentExportRequest : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentExportRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RecordTypes)) { @@ -60,7 +68,145 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("DestinationAccountId"u8); writer.WriteStringValue(DestinationAccountId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApplicationInsightsComponentExportRequest DeserializeApplicationInsightsComponentExportRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional recordTypes = default; + Optional destinationType = default; + Optional destinationAddress = default; + Optional isEnabled = default; + Optional notificationQueueEnabled = default; + Optional notificationQueueUri = default; + Optional destinationStorageSubscriptionId = default; + Optional destinationStorageLocationId = default; + Optional destinationAccountId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("RecordTypes"u8)) + { + recordTypes = property.Value.GetString(); + continue; + } + if (property.NameEquals("DestinationType"u8)) + { + destinationType = property.Value.GetString(); + continue; + } + if (property.NameEquals("DestinationAddress"u8)) + { + destinationAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("IsEnabled"u8)) + { + isEnabled = property.Value.GetString(); + continue; + } + if (property.NameEquals("NotificationQueueEnabled"u8)) + { + notificationQueueEnabled = property.Value.GetString(); + continue; + } + if (property.NameEquals("NotificationQueueUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + notificationQueueUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("DestinationStorageSubscriptionId"u8)) + { + destinationStorageSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("DestinationStorageLocationId"u8)) + { + destinationStorageLocationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("DestinationAccountId"u8)) + { + destinationAccountId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentExportRequest(recordTypes.Value, destinationType.Value, destinationAddress.Value, isEnabled.Value, notificationQueueEnabled.Value, notificationQueueUri.Value, destinationStorageSubscriptionId.Value, destinationStorageLocationId.Value, destinationAccountId.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentExportRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentExportRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentExportRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentExportRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentExportRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentExportRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentExportRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs index 42151a2e059a..eb2ae6668159 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs @@ -6,17 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApplicationInsights.Models { /// An Application Insights component Continuous Export configuration request definition. public partial class ApplicationInsightsComponentExportRequest { - /// Initializes a new instance of ApplicationInsightsComponentExportRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentExportRequest() { } + /// Initializes a new instance of . + /// The document types to be exported, as comma separated values. Allowed values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + /// The Continuous Export destination type. This has to be 'Blob'. + /// The SAS URL for the destination storage container. It must grant write permission. + /// Set to 'true' to create a Continuous Export configuration as enabled, otherwise set it to 'false'. + /// Deprecated. + /// Deprecated. + /// The subscription ID of the destination storage container. + /// The location ID of the destination storage container. + /// The name of destination storage account. + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentExportRequest(string recordTypes, string destinationType, string destinationAddress, string isEnabled, string notificationQueueEnabled, Uri notificationQueueUri, string destinationStorageSubscriptionId, string destinationStorageLocationId, string destinationAccountId, Dictionary serializedAdditionalRawData) + { + RecordTypes = recordTypes; + DestinationType = destinationType; + DestinationAddress = destinationAddress; + IsEnabled = isEnabled; + NotificationQueueEnabled = notificationQueueEnabled; + NotificationQueueUri = notificationQueueUri; + DestinationStorageSubscriptionId = destinationStorageSubscriptionId; + DestinationStorageLocationId = destinationStorageLocationId; + DestinationAccountId = destinationAccountId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The document types to be exported, as comma separated values. Allowed values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. public string RecordTypes { get; set; } /// The Continuous Export destination type. This has to be 'Blob'. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.Serialization.cs index 51d398562717..795ffc57e7ac 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentFavorite : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentFavorite : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -61,11 +68,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("IsGeneratedFromTemplate"u8); writer.WriteBooleanValue(IsGeneratedFromTemplate.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentFavorite DeserializeApplicationInsightsComponentFavorite(JsonElement element) + internal static ApplicationInsightsComponentFavorite DeserializeApplicationInsightsComponentFavorite(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +102,7 @@ internal static ApplicationInsightsComponentFavorite DeserializeApplicationInsig Optional category = default; Optional isGeneratedFromTemplate = default; Optional userId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Name"u8)) @@ -155,8 +177,61 @@ internal static ApplicationInsightsComponentFavorite DeserializeApplicationInsig userId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentFavorite(name.Value, config.Value, version.Value, favoriteId.Value, Optional.ToNullable(favoriteType), sourceType.Value, timeModified.Value, Optional.ToList(tags), category.Value, Optional.ToNullable(isGeneratedFromTemplate), userId.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentFavorite IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentFavorite(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentFavorite IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentFavorite(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentFavorite model) + { + if (model is null) + { + return null; } - return new ApplicationInsightsComponentFavorite(name.Value, config.Value, version.Value, favoriteId.Value, Optional.ToNullable(favoriteType), sourceType.Value, timeModified.Value, Optional.ToList(tags), category.Value, Optional.ToNullable(isGeneratedFromTemplate), userId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentFavorite(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentFavorite(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs index 535643078944..74a3e612dec9 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Properties that define a favorite that is associated to an Application Insights component. public partial class ApplicationInsightsComponentFavorite { - /// Initializes a new instance of ApplicationInsightsComponentFavorite. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentFavorite() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentFavorite. + /// Initializes a new instance of . /// The user-defined name of the favorite. /// Configuration of this particular favorite, which are driven by the Azure portal UX. Configuration data is a string containing valid JSON. /// This instance's version of the data model. This can change as new features are added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. @@ -31,7 +35,8 @@ public ApplicationInsightsComponentFavorite() /// Favorite category, as defined by the user at creation time. /// Flag denoting wether or not this favorite was generated from a template. /// Unique user id of the specific user that owns this favorite. - internal ApplicationInsightsComponentFavorite(string name, string config, string version, string favoriteId, FavoriteType? favoriteType, string sourceType, string timeModified, IList tags, string category, bool? isGeneratedFromTemplate, string userId) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentFavorite(string name, string config, string version, string favoriteId, FavoriteType? favoriteType, string sourceType, string timeModified, IList tags, string category, bool? isGeneratedFromTemplate, string userId, Dictionary serializedAdditionalRawData) { Name = name; Config = config; @@ -44,6 +49,7 @@ internal ApplicationInsightsComponentFavorite(string name, string config, string Category = category; IsGeneratedFromTemplate = isGeneratedFromTemplate; UserId = userId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The user-defined name of the favorite. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.Serialization.cs index f0767796d911..f16c147f08e8 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentFeature + public partial class ApplicationInsightsComponentFeature : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentFeature DeserializeApplicationInsightsComponentFeature(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentFeature DeserializeApplicationInsightsComponentFeature(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +55,7 @@ internal static ApplicationInsightsComponentFeature DeserializeApplicationInsigh Optional title = default; Optional isMainFeature = default; Optional supportedAddonFeatures = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("FeatureName"u8)) @@ -92,8 +120,61 @@ internal static ApplicationInsightsComponentFeature DeserializeApplicationInsigh supportedAddonFeatures = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentFeature(featureName.Value, meterId.Value, meterRateFrequency.Value, resouceId.Value, Optional.ToNullable(isHidden), Optional.ToList(capabilities), title.Value, Optional.ToNullable(isMainFeature), supportedAddonFeatures.Value); + return new ApplicationInsightsComponentFeature(featureName.Value, meterId.Value, meterRateFrequency.Value, resouceId.Value, Optional.ToNullable(isHidden), Optional.ToList(capabilities), title.Value, Optional.ToNullable(isMainFeature), supportedAddonFeatures.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentFeature IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentFeature(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentFeature IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentFeature(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentFeature model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentFeature(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentFeature(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs index ff8421633ab0..306f6c373e05 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// An Application Insights component daily data volume cap status. public partial class ApplicationInsightsComponentFeature { - /// Initializes a new instance of ApplicationInsightsComponentFeature. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentFeature() { Capabilities = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentFeature. + /// Initializes a new instance of . /// The pricing feature name. /// The meter id used for the feature. /// The meter rate for the feature's meter. @@ -29,7 +33,8 @@ internal ApplicationInsightsComponentFeature() /// Display name of the feature. /// Whether can apply addon feature on to it. /// The add on features on main feature. - internal ApplicationInsightsComponentFeature(string featureName, string meterId, string meterRateFrequency, string resourceId, bool? isHidden, IReadOnlyList capabilities, string title, bool? isMainFeature, string supportedAddonFeatures) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentFeature(string featureName, string meterId, string meterRateFrequency, string resourceId, bool? isHidden, IReadOnlyList capabilities, string title, bool? isMainFeature, string supportedAddonFeatures, Dictionary serializedAdditionalRawData) { FeatureName = featureName; MeterId = meterId; @@ -40,6 +45,7 @@ internal ApplicationInsightsComponentFeature(string featureName, string meterId, Title = title; IsMainFeature = isMainFeature; SupportedAddonFeatures = supportedAddonFeatures; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The pricing feature name. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.Serialization.cs index eb03f830718d..de89d1d3a349 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentFeatureCapabilities + public partial class ApplicationInsightsComponentFeatureCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentFeatureCapabilities DeserializeApplicationInsightsComponentFeatureCapabilities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentFeatureCapabilities DeserializeApplicationInsightsComponentFeatureCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +62,7 @@ internal static ApplicationInsightsComponentFeatureCapabilities DeserializeAppli Optional dailyCap = default; Optional dailyCapResetTime = default; Optional throttleRate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("SupportExportData"u8)) @@ -164,8 +193,61 @@ internal static ApplicationInsightsComponentFeatureCapabilities DeserializeAppli throttleRate = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentFeatureCapabilities(Optional.ToNullable(supportExportData), burstThrottlePolicy.Value, metadataClass.Value, Optional.ToNullable(liveStreamMetrics), Optional.ToNullable(applicationMap), Optional.ToNullable(workItemIntegration), Optional.ToNullable(powerBIIntegration), Optional.ToNullable(openSchema), Optional.ToNullable(proactiveDetection), Optional.ToNullable(analyticsIntegration), Optional.ToNullable(multipleStepWebTest), apiAccessLevel.Value, trackingType.Value, Optional.ToNullable(dailyCap), Optional.ToNullable(dailyCapResetTime), Optional.ToNullable(throttleRate)); + return new ApplicationInsightsComponentFeatureCapabilities(Optional.ToNullable(supportExportData), burstThrottlePolicy.Value, metadataClass.Value, Optional.ToNullable(liveStreamMetrics), Optional.ToNullable(applicationMap), Optional.ToNullable(workItemIntegration), Optional.ToNullable(powerBIIntegration), Optional.ToNullable(openSchema), Optional.ToNullable(proactiveDetection), Optional.ToNullable(analyticsIntegration), Optional.ToNullable(multipleStepWebTest), apiAccessLevel.Value, trackingType.Value, Optional.ToNullable(dailyCap), Optional.ToNullable(dailyCapResetTime), Optional.ToNullable(throttleRate), serializedAdditionalRawData); + } + + ApplicationInsightsComponentFeatureCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentFeatureCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentFeatureCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentFeatureCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentFeatureCapabilities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentFeatureCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentFeatureCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs index 31d9155316a2..621c66ebf8f8 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// An Application Insights component feature capabilities. public partial class ApplicationInsightsComponentFeatureCapabilities { - /// Initializes a new instance of ApplicationInsightsComponentFeatureCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentFeatureCapabilities() { } - /// Initializes a new instance of ApplicationInsightsComponentFeatureCapabilities. + /// Initializes a new instance of . /// Whether allow to use continuous export feature. /// Reserved, not used now. /// Reserved, not used now. @@ -32,7 +38,8 @@ internal ApplicationInsightsComponentFeatureCapabilities() /// Daily data volume cap in GB. /// Daily data volume cap UTC reset hour. /// Reserved, not used now. - internal ApplicationInsightsComponentFeatureCapabilities(bool? supportExportData, string burstThrottlePolicy, string metadataClass, bool? liveStreamMetrics, bool? applicationMap, bool? workItemIntegration, bool? powerBIIntegration, bool? openSchema, bool? proactiveDetection, bool? analyticsIntegration, bool? multipleStepWebTest, string apiAccessLevel, string trackingType, float? dailyCap, float? dailyCapResetTime, float? throttleRate) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentFeatureCapabilities(bool? supportExportData, string burstThrottlePolicy, string metadataClass, bool? liveStreamMetrics, bool? applicationMap, bool? workItemIntegration, bool? powerBIIntegration, bool? openSchema, bool? proactiveDetection, bool? analyticsIntegration, bool? multipleStepWebTest, string apiAccessLevel, string trackingType, float? dailyCap, float? dailyCapResetTime, float? throttleRate, Dictionary serializedAdditionalRawData) { SupportExportData = supportExportData; BurstThrottlePolicy = burstThrottlePolicy; @@ -50,6 +57,7 @@ internal ApplicationInsightsComponentFeatureCapabilities(bool? supportExportData DailyCap = dailyCap; DailyCapResetTime = dailyCapResetTime; ThrottleRate = throttleRate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether allow to use continuous export feature. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.Serialization.cs index 0617640dad88..3954d80d0930 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentFeatureCapability + public partial class ApplicationInsightsComponentFeatureCapability : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentFeatureCapability DeserializeApplicationInsightsComponentFeatureCapability(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentFeatureCapability DeserializeApplicationInsightsComponentFeatureCapability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +52,7 @@ internal static ApplicationInsightsComponentFeatureCapability DeserializeApplica Optional unit = default; Optional meterId = default; Optional meterRateFrequency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Name"u8)) @@ -56,8 +85,61 @@ internal static ApplicationInsightsComponentFeatureCapability DeserializeApplica meterRateFrequency = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentFeatureCapability(name.Value, description.Value, value.Value, unit.Value, meterId.Value, meterRateFrequency.Value); + return new ApplicationInsightsComponentFeatureCapability(name.Value, description.Value, value.Value, unit.Value, meterId.Value, meterRateFrequency.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentFeatureCapability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentFeatureCapability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentFeatureCapability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentFeatureCapability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentFeatureCapability model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentFeatureCapability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentFeatureCapability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs index 2c0d8b6fbf1b..1fcaa6145349 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// An Application Insights component feature capability. public partial class ApplicationInsightsComponentFeatureCapability { - /// Initializes a new instance of ApplicationInsightsComponentFeatureCapability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentFeatureCapability() { } - /// Initializes a new instance of ApplicationInsightsComponentFeatureCapability. + /// Initializes a new instance of . /// The name of the capability. /// The description of the capability. /// The value of the capability. /// The unit of the capability. /// The meter used for the capability. /// The meter rate of the meter. - internal ApplicationInsightsComponentFeatureCapability(string name, string description, string value, string unit, string meterId, string meterRateFrequency) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentFeatureCapability(string name, string description, string value, string unit, string meterId, string meterRateFrequency, Dictionary serializedAdditionalRawData) { Name = name; Description = description; @@ -30,6 +37,7 @@ internal ApplicationInsightsComponentFeatureCapability(string name, string descr Unit = unit; MeterId = meterId; MeterRateFrequency = meterRateFrequency; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the capability. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.Serialization.cs index ea7a62853de7..c249b8a1455d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class ApplicationInsightsComponentListResult + internal partial class ApplicationInsightsComponentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentListResult DeserializeApplicationInsightsComponentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentListResult DeserializeApplicationInsightsComponentListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static ApplicationInsightsComponentListResult DeserializeApplicationIns nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentListResult(value, nextLink.Value); + return new ApplicationInsightsComponentListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.cs index 720e4303bde9..d8c9da0e81e6 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Describes the list of Application Insights Resources. internal partial class ApplicationInsightsComponentListResult { - /// Initializes a new instance of ApplicationInsightsComponentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of Application Insights component definitions. /// is null. internal ApplicationInsightsComponentListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal ApplicationInsightsComponentListResult(IEnumerable Initializes a new instance of ApplicationInsightsComponentListResult. + /// Initializes a new instance of . /// List of Application Insights component definitions. /// The URI to get the next set of Application Insights component definitions if too many components where returned in the result set. - internal ApplicationInsightsComponentListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ApplicationInsightsComponentListResult() + { } /// List of Application Insights component definitions. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.Serialization.cs index 70bf8170e733..264af5d0f2c0 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentProactiveDetectionConfiguration : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentProactiveDetectionConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -49,13 +56,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RuleDefinitions)) { writer.WritePropertyName("RuleDefinitions"u8); - writer.WriteObjectValue(RuleDefinitions); + if (RuleDefinitions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RuleDefinitions).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentProactiveDetectionConfiguration DeserializeApplicationInsightsComponentProactiveDetectionConfiguration(JsonElement element) + internal static ApplicationInsightsComponentProactiveDetectionConfiguration DeserializeApplicationInsightsComponentProactiveDetectionConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +94,7 @@ internal static ApplicationInsightsComponentProactiveDetectionConfiguration Dese Optional> customEmails = default; Optional lastUpdatedTime = default; Optional ruleDefinitions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Name"u8)) @@ -119,8 +148,61 @@ internal static ApplicationInsightsComponentProactiveDetectionConfiguration Dese ruleDefinitions = ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.DeserializeApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentProactiveDetectionConfiguration(name.Value, Optional.ToNullable(enabled), Optional.ToNullable(sendEmailsToSubscriptionOwners), Optional.ToList(customEmails), lastUpdatedTime.Value, ruleDefinitions.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentProactiveDetectionConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentProactiveDetectionConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentProactiveDetectionConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentProactiveDetectionConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentProactiveDetectionConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentProactiveDetectionConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ApplicationInsightsComponentProactiveDetectionConfiguration(name.Value, Optional.ToNullable(enabled), Optional.ToNullable(sendEmailsToSubscriptionOwners), Optional.ToList(customEmails), lastUpdatedTime.Value, ruleDefinitions.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentProactiveDetectionConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs index 5ffe96c628ca..0ec2c4b94a1d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Properties that define a ProactiveDetection configuration. public partial class ApplicationInsightsComponentProactiveDetectionConfiguration { - /// Initializes a new instance of ApplicationInsightsComponentProactiveDetectionConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentProactiveDetectionConfiguration() { CustomEmails = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationInsightsComponentProactiveDetectionConfiguration. + /// Initializes a new instance of . /// The rule name. /// A flag that indicates whether this rule is enabled by the user. /// A flag that indicated whether notifications on this rule should be sent to subscription owners. /// Custom email addresses for this rule notifications. /// The last time this rule was updated. /// Static definitions of the ProactiveDetection configuration rule (same values for all components). - internal ApplicationInsightsComponentProactiveDetectionConfiguration(string name, bool? isEnabled, bool? sendEmailsToSubscriptionOwners, IList customEmails, string lastUpdatedTime, ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions ruleDefinitions) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentProactiveDetectionConfiguration(string name, bool? isEnabled, bool? sendEmailsToSubscriptionOwners, IList customEmails, string lastUpdatedTime, ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions ruleDefinitions, Dictionary serializedAdditionalRawData) { Name = name; IsEnabled = isEnabled; @@ -34,6 +39,7 @@ internal ApplicationInsightsComponentProactiveDetectionConfiguration(string name CustomEmails = customEmails; LastUpdatedTime = lastUpdatedTime; RuleDefinitions = ruleDefinitions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The rule name. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.Serialization.cs index 5e0820e3deaa..ad02ce62cf91 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions : IUtf8JsonSerializable + public partial class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -56,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("SupportsEmailNotifications"u8); writer.WriteBooleanValue(SupportsEmailNotifications.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions DeserializeApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(JsonElement element) + internal static ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions DeserializeApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +94,7 @@ internal static ApplicationInsightsComponentProactiveDetectionConfigurationRuleD Optional isEnabledByDefault = default; Optional isInPreview = default; Optional supportsEmailNotifications = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Name"u8)) @@ -135,8 +157,61 @@ internal static ApplicationInsightsComponentProactiveDetectionConfigurationRuleD supportsEmailNotifications = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(name.Value, displayName.Value, description.Value, helpUrl.Value, Optional.ToNullable(isHidden), Optional.ToNullable(isEnabledByDefault), Optional.ToNullable(isInPreview), Optional.ToNullable(supportsEmailNotifications), serializedAdditionalRawData); + } + + ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions model) + { + if (model is null) + { + return null; } - return new ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(name.Value, displayName.Value, description.Value, helpUrl.Value, Optional.ToNullable(isHidden), Optional.ToNullable(isEnabledByDefault), Optional.ToNullable(isInPreview), Optional.ToNullable(supportsEmailNotifications)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs index bce284ad0206..b207601b8e78 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApplicationInsights.Models { /// Static definitions of the ProactiveDetection configuration rule (same values for all components). public partial class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions { - /// Initializes a new instance of ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions() { } - /// Initializes a new instance of ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions. + /// Initializes a new instance of . /// The rule name. /// The rule name as it is displayed in UI. /// The rule description. @@ -26,7 +30,8 @@ public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinition /// A flag indicating whether the rule is enabled by default. /// A flag indicating whether the rule is in preview. /// A flag indicating whether email notifications are supported for detections for this rule. - internal ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(string name, string displayName, string description, Uri helpUri, bool? isHidden, bool? isEnabledByDefault, bool? isInPreview, bool? supportsEmailNotifications) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(string name, string displayName, string description, Uri helpUri, bool? isHidden, bool? isEnabledByDefault, bool? isInPreview, bool? supportsEmailNotifications, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; @@ -36,6 +41,7 @@ internal ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefiniti IsEnabledByDefault = isEnabledByDefault; IsInPreview = isInPreview; SupportsEmailNotifications = supportsEmailNotifications; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The rule name. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.Serialization.cs index 85dd445f8600..2590b061a5a8 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentQuotaStatus + public partial class ApplicationInsightsComponentQuotaStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentQuotaStatus DeserializeApplicationInsightsComponentQuotaStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentQuotaStatus DeserializeApplicationInsightsComponentQuotaStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ApplicationInsightsComponentQuotaStatus DeserializeApplicationIn Optional appId = default; Optional shouldBeThrottled = default; Optional expirationTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("AppId"u8)) @@ -42,8 +71,61 @@ internal static ApplicationInsightsComponentQuotaStatus DeserializeApplicationIn expirationTime = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentQuotaStatus(appId.Value, Optional.ToNullable(shouldBeThrottled), expirationTime.Value); + return new ApplicationInsightsComponentQuotaStatus(appId.Value, Optional.ToNullable(shouldBeThrottled), expirationTime.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentQuotaStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentQuotaStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentQuotaStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentQuotaStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentQuotaStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentQuotaStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentQuotaStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs index 289bb0df429f..443e544f735b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// An Application Insights component daily data volume cap status. public partial class ApplicationInsightsComponentQuotaStatus { - /// Initializes a new instance of ApplicationInsightsComponentQuotaStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentQuotaStatus() { } - /// Initializes a new instance of ApplicationInsightsComponentQuotaStatus. + /// Initializes a new instance of . /// The Application ID for the Application Insights component. /// The daily data volume cap is met, and data ingestion will be stopped. /// Date and time when the daily data volume cap will be reset, and data ingestion will resume. - internal ApplicationInsightsComponentQuotaStatus(string appId, bool? shouldBeThrottled, string expirationTime) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentQuotaStatus(string appId, bool? shouldBeThrottled, string expirationTime, Dictionary serializedAdditionalRawData) { AppId = appId; ShouldBeThrottled = shouldBeThrottled; ExpirationTime = expirationTime; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Application ID for the Application Insights component. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.Serialization.cs index d2f8aeb84896..323083ddae80 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ApplicationInsightsComponentWebTestLocation + public partial class ApplicationInsightsComponentWebTestLocation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationInsightsComponentWebTestLocation DeserializeApplicationInsightsComponentWebTestLocation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationInsightsComponentWebTestLocation DeserializeApplicationInsightsComponentWebTestLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional displayName = default; Optional tag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("DisplayName"u8)) @@ -32,8 +61,61 @@ internal static ApplicationInsightsComponentWebTestLocation DeserializeApplicati tag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationInsightsComponentWebTestLocation(displayName.Value, tag.Value); + return new ApplicationInsightsComponentWebTestLocation(displayName.Value, tag.Value, serializedAdditionalRawData); + } + + ApplicationInsightsComponentWebTestLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsComponentWebTestLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsComponentWebTestLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsComponentWebTestLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsComponentWebTestLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsComponentWebTestLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsComponentWebTestLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs index c00a5f385330..60fafc6f49f5 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Properties that define a web test location available to an Application Insights Component. public partial class ApplicationInsightsComponentWebTestLocation { - /// Initializes a new instance of ApplicationInsightsComponentWebTestLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationInsightsComponentWebTestLocation() { } - /// Initializes a new instance of ApplicationInsightsComponentWebTestLocation. + /// Initializes a new instance of . /// The display name of the web test location. /// Internally defined geographic location tag. - internal ApplicationInsightsComponentWebTestLocation(string displayName, string tag) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsComponentWebTestLocation(string displayName, string tag, Dictionary serializedAdditionalRawData) { DisplayName = displayName; Tag = tag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The display name of the web test location. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountData.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountData.Serialization.cs index 1f31a4b7ba74..9a85d4b2d327 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountData.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApplicationInsights { - public partial class ComponentLinkedStorageAccountData : IUtf8JsonSerializable + public partial class ComponentLinkedStorageAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LinkedStorageAccount); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComponentLinkedStorageAccountData DeserializeComponentLinkedStorageAccountData(JsonElement element) + internal static ComponentLinkedStorageAccountData DeserializeComponentLinkedStorageAccountData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static ComponentLinkedStorageAccountData DeserializeComponentLinkedStor ResourceType type = default; Optional systemData = default; Optional linkedStorageAccount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -81,8 +104,61 @@ internal static ComponentLinkedStorageAccountData DeserializeComponentLinkedStor } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComponentLinkedStorageAccountData(id, name, type, systemData.Value, linkedStorageAccount.Value, serializedAdditionalRawData); + } + + ComponentLinkedStorageAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentLinkedStorageAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentLinkedStorageAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentLinkedStorageAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentLinkedStorageAccountData model) + { + if (model is null) + { + return null; } - return new ComponentLinkedStorageAccountData(id, name, type, systemData.Value, linkedStorageAccount.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentLinkedStorageAccountData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentLinkedStorageAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.Serialization.cs index 67c3a4fe9e9d..83a6adf0af29 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ComponentLinkedStorageAccountPatch : IUtf8JsonSerializable + public partial class ComponentLinkedStorageAccountPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -23,7 +31,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LinkedStorageAccount); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ComponentLinkedStorageAccountPatch DeserializeComponentLinkedStorageAccountPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional linkedStorageAccount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("linkedStorageAccount"u8)) + { + linkedStorageAccount = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComponentLinkedStorageAccountPatch(linkedStorageAccount.Value, serializedAdditionalRawData); + } + + ComponentLinkedStorageAccountPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentLinkedStorageAccountPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentLinkedStorageAccountPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentLinkedStorageAccountPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentLinkedStorageAccountPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentLinkedStorageAccountPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentLinkedStorageAccountPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.cs index 60b9ff7af2d3..f7313b8577e1 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentLinkedStorageAccountPatch.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// An Application Insights component linked storage accounts patch. public partial class ComponentLinkedStorageAccountPatch { - /// Initializes a new instance of ComponentLinkedStorageAccountPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComponentLinkedStorageAccountPatch() { } + /// Initializes a new instance of . + /// Linked storage account resource ID. + /// Keeps track of any properties unknown to the library. + internal ComponentLinkedStorageAccountPatch(string linkedStorageAccount, Dictionary serializedAdditionalRawData) + { + LinkedStorageAccount = linkedStorageAccount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Linked storage account resource ID. public string LinkedStorageAccount { get; set; } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.Serialization.cs index d26c8758cb7b..cab6a63967e4 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ComponentPurgeBody : IUtf8JsonSerializable + public partial class ComponentPurgeBody : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("table"u8); writer.WriteStringValue(Table); @@ -21,10 +29,114 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Filters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ComponentPurgeBody DeserializeComponentPurgeBody(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string table = default; + IList filters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("table"u8)) + { + table = property.Value.GetString(); + continue; + } + if (property.NameEquals("filters"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComponentPurgeBodyFilters.DeserializeComponentPurgeBodyFilters(item)); + } + filters = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComponentPurgeBody(table, filters, serializedAdditionalRawData); + } + + ComponentPurgeBody IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentPurgeBody(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentPurgeBody IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentPurgeBody(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentPurgeBody model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentPurgeBody(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentPurgeBody(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs index 88fe425d658e..08ec1e20ac0c 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Describes the body of a purge request for an App Insights component. public partial class ComponentPurgeBody { - /// Initializes a new instance of ComponentPurgeBody. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Table from which to purge data. /// The set of columns and filters (queries) to run over them to purge the resulting data. /// or is null. @@ -28,6 +31,22 @@ public ComponentPurgeBody(string table, IEnumerable f Filters = filters.ToList(); } + /// Initializes a new instance of . + /// Table from which to purge data. + /// The set of columns and filters (queries) to run over them to purge the resulting data. + /// Keeps track of any properties unknown to the library. + internal ComponentPurgeBody(string table, IList filters, Dictionary serializedAdditionalRawData) + { + Table = table; + Filters = filters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ComponentPurgeBody() + { + } + /// Table from which to purge data. public string Table { get; } /// The set of columns and filters (queries) to run over them to purge the resulting data. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.Serialization.cs index 9fa39f6bbcdb..52fad6def9d3 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ComponentPurgeBodyFilters : IUtf8JsonSerializable + public partial class ComponentPurgeBodyFilters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Column)) { @@ -39,7 +47,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ComponentPurgeBodyFilters DeserializeComponentPurgeBodyFilters(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional column = default; + Optional @operator = default; + Optional value = default; + Optional key = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("column"u8)) + { + column = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComponentPurgeBodyFilters(column.Value, @operator.Value, value.Value, key.Value, serializedAdditionalRawData); + } + + ComponentPurgeBodyFilters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentPurgeBodyFilters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentPurgeBodyFilters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentPurgeBodyFilters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentPurgeBodyFilters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentPurgeBodyFilters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentPurgeBodyFilters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs index 0c9e6d6374d3..f77a6195a737 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs @@ -6,17 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApplicationInsights.Models { /// User-defined filters to return data which will be purged from the table. public partial class ComponentPurgeBodyFilters { - /// Initializes a new instance of ComponentPurgeBodyFilters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComponentPurgeBodyFilters() { } + /// Initializes a new instance of . + /// The column of the table over which the given query should run. + /// A query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. + /// the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. + /// When filtering over custom dimensions, this key will be used as the name of the custom dimension. + /// Keeps track of any properties unknown to the library. + internal ComponentPurgeBodyFilters(string column, string @operator, BinaryData value, string key, Dictionary serializedAdditionalRawData) + { + Column = column; + Operator = @operator; + Value = value; + Key = key; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The column of the table over which the given query should run. public string Column { get; set; } /// A query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.Serialization.cs index f59d81ae30e5..74ea4a65b379 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.Serialization.cs @@ -5,20 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ComponentPurgeResponse + public partial class ComponentPurgeResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComponentPurgeResponse DeserializeComponentPurgeResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComponentPurgeResponse DeserializeComponentPurgeResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string operationId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationId"u8)) @@ -26,8 +57,61 @@ internal static ComponentPurgeResponse DeserializeComponentPurgeResponse(JsonEle operationId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComponentPurgeResponse(operationId); + return new ComponentPurgeResponse(operationId, serializedAdditionalRawData); + } + + ComponentPurgeResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentPurgeResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentPurgeResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentPurgeResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentPurgeResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentPurgeResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentPurgeResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs index 4d66b52cdc2e..73034da2adef 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApplicationInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Response containing operationId for a specific purge action. public partial class ComponentPurgeResponse { - /// Initializes a new instance of ComponentPurgeResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Id to use when querying for status for a particular purge operation. /// is null. internal ComponentPurgeResponse(string operationId) @@ -23,6 +27,20 @@ internal ComponentPurgeResponse(string operationId) OperationId = operationId; } + /// Initializes a new instance of . + /// Id to use when querying for status for a particular purge operation. + /// Keeps track of any properties unknown to the library. + internal ComponentPurgeResponse(string operationId, Dictionary serializedAdditionalRawData) + { + OperationId = operationId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ComponentPurgeResponse() + { + } + /// Id to use when querying for status for a particular purge operation. public string OperationId { get; } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.Serialization.cs index f8ed381a0b88..1cf172a68533 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.Serialization.cs @@ -5,20 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class ComponentPurgeStatusResponse + public partial class ComponentPurgeStatusResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComponentPurgeStatusResponse DeserializeComponentPurgeStatusResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComponentPurgeStatusResponse DeserializeComponentPurgeStatusResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } PurgeState status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -26,8 +57,61 @@ internal static ComponentPurgeStatusResponse DeserializeComponentPurgeStatusResp status = new PurgeState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComponentPurgeStatusResponse(status); + return new ComponentPurgeStatusResponse(status, serializedAdditionalRawData); + } + + ComponentPurgeStatusResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentPurgeStatusResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentPurgeStatusResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentPurgeStatusResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentPurgeStatusResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentPurgeStatusResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentPurgeStatusResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs index 4258b28c532e..37c15d2a4339 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Response containing status for a specific purge operation. public partial class ComponentPurgeStatusResponse { - /// Initializes a new instance of ComponentPurgeStatusResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Status of the operation represented by the requested Id. internal ComponentPurgeStatusResponse(PurgeState status) { Status = status; } + /// Initializes a new instance of . + /// Status of the operation represented by the requested Id. + /// Keeps track of any properties unknown to the library. + internal ComponentPurgeStatusResponse(PurgeState status, Dictionary serializedAdditionalRawData) + { + Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ComponentPurgeStatusResponse() + { + } + /// Status of the operation represented by the requested Id. public PurgeState Status { get; } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.Serialization.cs index 6c93611574a7..2faaf91bbf46 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class HeaderField : IUtf8JsonSerializable + public partial class HeaderField : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HeaderFieldName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(HeaderFieldValue); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HeaderField DeserializeHeaderField(JsonElement element) + internal static HeaderField DeserializeHeaderField(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional key = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -48,8 +71,61 @@ internal static HeaderField DeserializeHeaderField(JsonElement element) value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HeaderField(key.Value, value.Value, serializedAdditionalRawData); + } + + HeaderField IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHeaderField(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HeaderField IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHeaderField(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HeaderField model) + { + if (model is null) + { + return null; } - return new HeaderField(key.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HeaderField(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHeaderField(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.cs index 43887a876e45..930252973e51 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/HeaderField.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// A header to add to the WebTest. public partial class HeaderField { - /// Initializes a new instance of HeaderField. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HeaderField() { } - /// Initializes a new instance of HeaderField. + /// Initializes a new instance of . /// The name of the header. /// The value of the header. - internal HeaderField(string headerFieldName, string headerFieldValue) + /// Keeps track of any properties unknown to the library. + internal HeaderField(string headerFieldName, string headerFieldValue, Dictionary serializedAdditionalRawData) { HeaderFieldName = headerFieldName; HeaderFieldValue = headerFieldValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the header. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.Serialization.cs index 74a24d42a439..b98c4b47bd75 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class LiveTokenResponse + public partial class LiveTokenResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LiveTokenResponse DeserializeLiveTokenResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LiveTokenResponse DeserializeLiveTokenResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional liveToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("liveToken"u8)) @@ -26,8 +55,61 @@ internal static LiveTokenResponse DeserializeLiveTokenResponse(JsonElement eleme liveToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LiveTokenResponse(liveToken.Value); + return new LiveTokenResponse(liveToken.Value, serializedAdditionalRawData); + } + + LiveTokenResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLiveTokenResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LiveTokenResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLiveTokenResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LiveTokenResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LiveTokenResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLiveTokenResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.cs index 6e7eb9e62f32..38a657703e41 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/LiveTokenResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// The response to a live token query. public partial class LiveTokenResponse { - /// Initializes a new instance of LiveTokenResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LiveTokenResponse() { } - /// Initializes a new instance of LiveTokenResponse. + /// Initializes a new instance of . /// JWT token for accessing live metrics stream data. - internal LiveTokenResponse(string liveToken) + /// Keeps track of any properties unknown to the library. + internal LiveTokenResponse(string liveToken, Dictionary serializedAdditionalRawData) { LiveToken = liveToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// JWT token for accessing live metrics stream data. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookData.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookData.Serialization.cs index 38297af894e0..d8033059309b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookData.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApplicationInsights { - public partial class MyWorkbookData : IUtf8JsonSerializable + public partial class MyWorkbookData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -27,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } } if (Optional.IsDefined(Id)) { @@ -118,11 +131,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MyWorkbookData DeserializeMyWorkbookData(JsonElement element) + internal static MyWorkbookData DeserializeMyWorkbookData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -144,6 +171,7 @@ internal static MyWorkbookData DeserializeMyWorkbookData(JsonElement element) Optional userId = default; Optional sourceId = default; Optional storageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -287,8 +315,61 @@ internal static MyWorkbookData DeserializeMyWorkbookData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MyWorkbookData(identity.Value, id.Value, name.Value, type.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToDictionary(etag), Optional.ToNullable(kind), systemData, displayName.Value, serializedData.Value, version.Value, timeModified.Value, category.Value, userId.Value, sourceId.Value, storageUri.Value); + return new MyWorkbookData(identity.Value, id.Value, name.Value, type.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToDictionary(etag), Optional.ToNullable(kind), systemData, displayName.Value, serializedData.Value, version.Value, timeModified.Value, category.Value, userId.Value, sourceId.Value, storageUri.Value, serializedAdditionalRawData); + } + + MyWorkbookData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMyWorkbookData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MyWorkbookData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMyWorkbookData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MyWorkbookData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MyWorkbookData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMyWorkbookData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.Serialization.cs index ffedb679fd38..30e3b3e3dbec 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.Serialization.cs @@ -5,37 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class MyWorkbookManagedIdentity : IUtf8JsonSerializable + public partial class MyWorkbookManagedIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserAssignedIdentities)) { writer.WritePropertyName("userAssignedIdentities"u8); - writer.WriteObjectValue(UserAssignedIdentities); + if (UserAssignedIdentities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserAssignedIdentities).Serialize(writer, options); + } } if (Optional.IsDefined(IdentityType)) { writer.WritePropertyName("type"u8); writer.WriteStringValue(IdentityType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MyWorkbookManagedIdentity DeserializeMyWorkbookManagedIdentity(JsonElement element) + internal static MyWorkbookManagedIdentity DeserializeMyWorkbookManagedIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional userAssignedIdentities = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userAssignedIdentities"u8)) @@ -56,8 +86,61 @@ internal static MyWorkbookManagedIdentity DeserializeMyWorkbookManagedIdentity(J type = new MyWorkbookManagedIdentityType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MyWorkbookManagedIdentity(userAssignedIdentities.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + MyWorkbookManagedIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMyWorkbookManagedIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MyWorkbookManagedIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMyWorkbookManagedIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MyWorkbookManagedIdentity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MyWorkbookManagedIdentity(Response response) + { + if (response is null) + { + return null; } - return new MyWorkbookManagedIdentity(userAssignedIdentities.Value, Optional.ToNullable(type)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMyWorkbookManagedIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.cs index 5a61dd5306b1..8760d9069d0c 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookManagedIdentity.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Customer Managed Identity. public partial class MyWorkbookManagedIdentity { - /// Initializes a new instance of MyWorkbookManagedIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MyWorkbookManagedIdentity() { } - /// Initializes a new instance of MyWorkbookManagedIdentity. + /// Initializes a new instance of . /// Customer Managed Identity. /// The identity type. - internal MyWorkbookManagedIdentity(MyWorkbookUserAssignedIdentities userAssignedIdentities, MyWorkbookManagedIdentityType? identityType) + /// Keeps track of any properties unknown to the library. + internal MyWorkbookManagedIdentity(MyWorkbookUserAssignedIdentities userAssignedIdentities, MyWorkbookManagedIdentityType? identityType, Dictionary serializedAdditionalRawData) { UserAssignedIdentities = userAssignedIdentities; IdentityType = identityType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Customer Managed Identity. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.Serialization.cs index a613d8438da1..b8d9fa96c9ef 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class MyWorkbookResource : IUtf8JsonSerializable + public partial class MyWorkbookResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } } if (Optional.IsDefined(Id)) { @@ -63,11 +77,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MyWorkbookResource DeserializeMyWorkbookResource(JsonElement element) + internal static MyWorkbookResource DeserializeMyWorkbookResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +107,7 @@ internal static MyWorkbookResource DeserializeMyWorkbookResource(JsonElement ele Optional location = default; Optional> tags = default; Optional> etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -142,8 +171,61 @@ internal static MyWorkbookResource DeserializeMyWorkbookResource(JsonElement ele etag = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MyWorkbookResource(identity.Value, id.Value, name.Value, type.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToDictionary(etag), serializedAdditionalRawData); + } + + MyWorkbookResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMyWorkbookResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MyWorkbookResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMyWorkbookResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MyWorkbookResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MyWorkbookResource(Response response) + { + if (response is null) + { + return null; } - return new MyWorkbookResource(identity.Value, id.Value, name.Value, type.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToDictionary(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMyWorkbookResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.cs index b17fd0d43d05..db6b8303993d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// An azure resource object. public partial class MyWorkbookResource { - /// Initializes a new instance of MyWorkbookResource. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MyWorkbookResource() { Tags = new ChangeTrackingDictionary(); ETag = new ChangeTrackingDictionary(); } - /// Initializes a new instance of MyWorkbookResource. + /// Initializes a new instance of . /// Identity used for BYOS. /// Azure resource Id. /// Azure resource name. @@ -28,7 +32,8 @@ public MyWorkbookResource() /// Resource location. /// Resource tags. /// Resource etag. - internal MyWorkbookResource(MyWorkbookManagedIdentity identity, string id, string name, string resourceType, AzureLocation? location, IDictionary tags, IDictionary etag) + /// Keeps track of any properties unknown to the library. + internal MyWorkbookResource(MyWorkbookManagedIdentity identity, string id, string name, string resourceType, AzureLocation? location, IDictionary tags, IDictionary etag, Dictionary serializedAdditionalRawData) { Identity = identity; Id = id; @@ -37,6 +42,7 @@ internal MyWorkbookResource(MyWorkbookManagedIdentity identity, string id, strin Location = location; Tags = tags; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identity used for BYOS. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.Serialization.cs index f6641cd38c53..91409a723dac 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.Serialization.cs @@ -6,27 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class MyWorkbookUserAssignedIdentities : IUtf8JsonSerializable + public partial class MyWorkbookUserAssignedIdentities : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MyWorkbookUserAssignedIdentities DeserializeMyWorkbookUserAssignedIdentities(JsonElement element) + internal static MyWorkbookUserAssignedIdentities DeserializeMyWorkbookUserAssignedIdentities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional principalId = default; Optional tenantId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("principalId"u8)) @@ -43,8 +65,61 @@ internal static MyWorkbookUserAssignedIdentities DeserializeMyWorkbookUserAssign tenantId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MyWorkbookUserAssignedIdentities(principalId.Value, Optional.ToNullable(tenantId), serializedAdditionalRawData); + } + + MyWorkbookUserAssignedIdentities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMyWorkbookUserAssignedIdentities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MyWorkbookUserAssignedIdentities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMyWorkbookUserAssignedIdentities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MyWorkbookUserAssignedIdentities model) + { + if (model is null) + { + return null; } - return new MyWorkbookUserAssignedIdentities(principalId.Value, Optional.ToNullable(tenantId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MyWorkbookUserAssignedIdentities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMyWorkbookUserAssignedIdentities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.cs index d15db8a3a360..4e739a1b20ea 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbookUserAssignedIdentities.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApplicationInsights.Models { /// Customer Managed Identity. public partial class MyWorkbookUserAssignedIdentities { - /// Initializes a new instance of MyWorkbookUserAssignedIdentities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MyWorkbookUserAssignedIdentities() { } - /// Initializes a new instance of MyWorkbookUserAssignedIdentities. + /// Initializes a new instance of . /// The principal ID of resource identity. /// The tenant ID of resource. - internal MyWorkbookUserAssignedIdentities(string principalId, Guid? tenantId) + /// Keeps track of any properties unknown to the library. + internal MyWorkbookUserAssignedIdentities(string principalId, Guid? tenantId, Dictionary serializedAdditionalRawData) { PrincipalId = principalId; TenantId = tenantId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The principal ID of resource identity. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.Serialization.cs index c7ebec13dc1a..9bd5afb1b050 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class MyWorkbooksListResult + internal partial class MyWorkbooksListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MyWorkbooksListResult DeserializeMyWorkbooksListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MyWorkbooksListResult DeserializeMyWorkbooksListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static MyWorkbooksListResult DeserializeMyWorkbooksListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MyWorkbooksListResult(Optional.ToList(value), nextLink.Value); + return new MyWorkbooksListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MyWorkbooksListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMyWorkbooksListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MyWorkbooksListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMyWorkbooksListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MyWorkbooksListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MyWorkbooksListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMyWorkbooksListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.cs index 5f7bd0e986a3..0d7922303b6e 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/MyWorkbooksListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApplicationInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Workbook list result. internal partial class MyWorkbooksListResult { - /// Initializes a new instance of MyWorkbooksListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MyWorkbooksListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MyWorkbooksListResult. + /// Initializes a new instance of . /// An array of private workbooks. /// - internal MyWorkbooksListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MyWorkbooksListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of private workbooks. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.Serialization.cs index 64103cc522d7..9347c18d8cad 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class PrivateLinkScopedResource + public partial class PrivateLinkScopedResource : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PrivateLinkScopedResource DeserializePrivateLinkScopedResource(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("ResourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ScopeId)) + { + writer.WritePropertyName("ScopeId"u8); + writer.WriteStringValue(ScopeId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PrivateLinkScopedResource DeserializePrivateLinkScopedResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceId = default; Optional scopeId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ResourceId"u8)) @@ -32,8 +71,61 @@ internal static PrivateLinkScopedResource DeserializePrivateLinkScopedResource(J scopeId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PrivateLinkScopedResource(resourceId.Value, scopeId.Value); + return new PrivateLinkScopedResource(resourceId.Value, scopeId.Value, serializedAdditionalRawData); + } + + PrivateLinkScopedResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateLinkScopedResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateLinkScopedResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateLinkScopedResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateLinkScopedResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateLinkScopedResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateLinkScopedResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.cs index eb2a6de0a930..7cd293b4bd19 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/PrivateLinkScopedResource.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// The private link scope resource reference. public partial class PrivateLinkScopedResource { - /// Initializes a new instance of PrivateLinkScopedResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PrivateLinkScopedResource() { } - /// Initializes a new instance of PrivateLinkScopedResource. + /// Initializes a new instance of . /// The full resource Id of the private link scope resource. /// The private link scope unique Identifier. - internal PrivateLinkScopedResource(string resourceId, string scopeId) + /// Keeps track of any properties unknown to the library. + internal PrivateLinkScopedResource(string resourceId, string scopeId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; ScopeId = scopeId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The full resource Id of the private link scope resource. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.Serialization.cs index 82e0888e8a40..deedbf62d2b8 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class TagsResource : IUtf8JsonSerializable + public partial class TagsResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TagsResource DeserializeTagsResource(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TagsResource(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + TagsResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagsResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagsResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagsResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagsResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagsResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagsResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.cs index 06e5df2df81a..9573ad054742 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/TagsResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// A container holding only the Tags for a resource, allowing the user to update the tags on a WebTest instance. public partial class TagsResource { - /// Initializes a new instance of TagsResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TagsResource() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal TagsResource(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestData.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestData.Serialization.cs index 4f894cc8b659..7274a9ca9664 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestData.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApplicationInsights { - public partial class WebTestData : IUtf8JsonSerializable + public partial class WebTestData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -84,31 +91,73 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Locations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("Configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(Request)) { writer.WritePropertyName("Request"u8); - writer.WriteObjectValue(Request); + if (Request is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Request).Serialize(writer, options); + } } if (Optional.IsDefined(ValidationRules)) { writer.WritePropertyName("ValidationRules"u8); - writer.WriteObjectValue(ValidationRules); + if (ValidationRules is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ValidationRules).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebTestData DeserializeWebTestData(JsonElement element) + internal static WebTestData DeserializeWebTestData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -133,6 +182,7 @@ internal static WebTestData DeserializeWebTestData(JsonElement element) Optional provisioningState = default; Optional request = default; Optional validationRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -305,8 +355,61 @@ internal static WebTestData DeserializeWebTestData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WebTestData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), syntheticMonitorId.Value, name0.Value, description.Value, Optional.ToNullable(enabled), Optional.ToNullable(frequency), Optional.ToNullable(timeout), Optional.ToNullable(kind0), Optional.ToNullable(retryEnabled), Optional.ToList(locations), configuration.Value, provisioningState.Value, request.Value, validationRules.Value); + return new WebTestData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), syntheticMonitorId.Value, name0.Value, description.Value, Optional.ToNullable(enabled), Optional.ToNullable(frequency), Optional.ToNullable(timeout), Optional.ToNullable(kind0), Optional.ToNullable(retryEnabled), Optional.ToList(locations), configuration.Value, provisioningState.Value, request.Value, validationRules.Value, serializedAdditionalRawData); + } + + WebTestData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.Serialization.cs index dce5f24b72ca..edfd236768ba 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WebTestGeolocation : IUtf8JsonSerializable + public partial class WebTestGeolocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { writer.WritePropertyName("Id"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebTestGeolocation DeserializeWebTestGeolocation(JsonElement element) + internal static WebTestGeolocation DeserializeWebTestGeolocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Id"u8)) @@ -41,8 +64,61 @@ internal static WebTestGeolocation DeserializeWebTestGeolocation(JsonElement ele id = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebTestGeolocation(Optional.ToNullable(id), serializedAdditionalRawData); + } + + WebTestGeolocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestGeolocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestGeolocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestGeolocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestGeolocation model) + { + if (model is null) + { + return null; } - return new WebTestGeolocation(Optional.ToNullable(id)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestGeolocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestGeolocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs index 42f5169ad47a..be284b511ebd 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ApplicationInsights.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Geo-physical location to run a WebTest from. You must specify one or more locations for the test to run from. public partial class WebTestGeolocation { - /// Initializes a new instance of WebTestGeolocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WebTestGeolocation() { } - /// Initializes a new instance of WebTestGeolocation. + /// Initializes a new instance of . /// Location ID for the WebTest to run from. - internal WebTestGeolocation(AzureLocation? location) + /// Keeps track of any properties unknown to the library. + internal WebTestGeolocation(AzureLocation? location, Dictionary serializedAdditionalRawData) { Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location ID for the WebTest to run from. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.Serialization.cs index 2ce8209108d2..708d75c02c9b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class WebTestListResult + internal partial class WebTestListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WebTestListResult DeserializeWebTestListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WebTestListResult DeserializeWebTestListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static WebTestListResult DeserializeWebTestListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WebTestListResult(value, nextLink.Value); + return new WebTestListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + WebTestListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.cs index 24240fc9c730..0107bdfe4e22 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// A list of 0 or more Application Insights WebTest definitions. internal partial class WebTestListResult { - /// Initializes a new instance of WebTestListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Set of Application Insights WebTest definitions. /// is null. internal WebTestListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal WebTestListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of WebTestListResult. + /// Initializes a new instance of . /// Set of Application Insights WebTest definitions. /// The link to get the next part of the returned list of WebTest, should the return set be too large for a single request. May be null. - internal WebTestListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WebTestListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WebTestListResult() + { } /// Set of Application Insights WebTest definitions. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.Serialization.cs index 2a1815db5567..53e588319a8e 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class WebTestPropertiesConfiguration : IUtf8JsonSerializable + internal partial class WebTestPropertiesConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WebTest)) { writer.WritePropertyName("WebTest"u8); writer.WriteStringValue(WebTest); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebTestPropertiesConfiguration DeserializeWebTestPropertiesConfiguration(JsonElement element) + internal static WebTestPropertiesConfiguration DeserializeWebTestPropertiesConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional webTest = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("WebTest"u8)) @@ -37,8 +60,61 @@ internal static WebTestPropertiesConfiguration DeserializeWebTestPropertiesConfi webTest = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebTestPropertiesConfiguration(webTest.Value, serializedAdditionalRawData); + } + + WebTestPropertiesConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestPropertiesConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestPropertiesConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestPropertiesConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestPropertiesConfiguration model) + { + if (model is null) + { + return null; } - return new WebTestPropertiesConfiguration(webTest.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestPropertiesConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestPropertiesConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs index 20cd5ec6aaa9..11fad69e23e3 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// An XML configuration specification for a WebTest. internal partial class WebTestPropertiesConfiguration { - /// Initializes a new instance of WebTestPropertiesConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WebTestPropertiesConfiguration() { } - /// Initializes a new instance of WebTestPropertiesConfiguration. + /// Initializes a new instance of . /// The XML specification of a WebTest to run against an application. - internal WebTestPropertiesConfiguration(string webTest) + /// Keeps track of any properties unknown to the library. + internal WebTestPropertiesConfiguration(string webTest, Dictionary serializedAdditionalRawData) { WebTest = webTest; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The XML specification of a WebTest to run against an application. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.Serialization.cs index 6c4e25303f7e..5a88b0cc3ee6 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WebTestPropertiesRequest : IUtf8JsonSerializable + public partial class WebTestPropertiesRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RequestUri)) { @@ -28,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Headers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,11 +65,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("FollowRedirects"u8); writer.WriteBooleanValue(FollowRedirects.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebTestPropertiesRequest DeserializeWebTestPropertiesRequest(JsonElement element) + internal static WebTestPropertiesRequest DeserializeWebTestPropertiesRequest(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +94,7 @@ internal static WebTestPropertiesRequest DeserializeWebTestPropertiesRequest(Jso Optional requestBody = default; Optional parseDependentRequests = default; Optional followRedirects = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("RequestUrl"u8)) @@ -120,8 +148,61 @@ internal static WebTestPropertiesRequest DeserializeWebTestPropertiesRequest(Jso followRedirects = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebTestPropertiesRequest(requestUrl.Value, Optional.ToList(headers), httpVerb.Value, requestBody.Value, Optional.ToNullable(parseDependentRequests), Optional.ToNullable(followRedirects), serializedAdditionalRawData); + } + + WebTestPropertiesRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestPropertiesRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestPropertiesRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestPropertiesRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestPropertiesRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestPropertiesRequest(Response response) + { + if (response is null) + { + return null; } - return new WebTestPropertiesRequest(requestUrl.Value, Optional.ToList(headers), httpVerb.Value, requestBody.Value, Optional.ToNullable(parseDependentRequests), Optional.ToNullable(followRedirects)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestPropertiesRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.cs index 5570e2345fec..fb3766f50f86 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesRequest.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// The collection of request properties. public partial class WebTestPropertiesRequest { - /// Initializes a new instance of WebTestPropertiesRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WebTestPropertiesRequest() { Headers = new ChangeTrackingList(); } - /// Initializes a new instance of WebTestPropertiesRequest. + /// Initializes a new instance of . /// Url location to test. /// List of headers and their values to add to the WebTest call. /// Http verb to use for this web test. /// Base64 encoded string body to send with this web test. /// Parse Dependent request for this WebTest. /// Follow redirects for this web test. - internal WebTestPropertiesRequest(Uri requestUri, IList headers, string httpVerb, string requestBody, bool? parseDependentRequests, bool? followRedirects) + /// Keeps track of any properties unknown to the library. + internal WebTestPropertiesRequest(Uri requestUri, IList headers, string httpVerb, string requestBody, bool? parseDependentRequests, bool? followRedirects, Dictionary serializedAdditionalRawData) { RequestUri = requestUri; Headers = headers; @@ -35,6 +39,7 @@ internal WebTestPropertiesRequest(Uri requestUri, IList headers, st RequestBody = requestBody; ParseDependentRequests = parseDependentRequests; FollowRedirects = followRedirects; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Url location to test. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.Serialization.cs index ae3154475286..607f20942d7f 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WebTestPropertiesValidationRules : IUtf8JsonSerializable + public partial class WebTestPropertiesValidationRules : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContentValidation)) { writer.WritePropertyName("ContentValidation"u8); - writer.WriteObjectValue(ContentValidation); + if (ContentValidation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContentValidation).Serialize(writer, options); + } } if (Optional.IsDefined(CheckSsl)) { @@ -40,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("IgnoreHttpStatusCode"u8); writer.WriteBooleanValue(IgnoreHttpStatusCode.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebTestPropertiesValidationRules DeserializeWebTestPropertiesValidationRules(JsonElement element) + internal static WebTestPropertiesValidationRules DeserializeWebTestPropertiesValidationRules(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +83,7 @@ internal static WebTestPropertiesValidationRules DeserializeWebTestPropertiesVal Optional sslCertRemainingLifetimeCheck = default; Optional expectedHttpStatusCode = default; Optional ignoreHttpStatusCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ContentValidation"u8)) @@ -101,8 +131,61 @@ internal static WebTestPropertiesValidationRules DeserializeWebTestPropertiesVal ignoreHttpStatusCode = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebTestPropertiesValidationRules(contentValidation.Value, Optional.ToNullable(sslCheck), Optional.ToNullable(sslCertRemainingLifetimeCheck), Optional.ToNullable(expectedHttpStatusCode), Optional.ToNullable(ignoreHttpStatusCode), serializedAdditionalRawData); + } + + WebTestPropertiesValidationRules IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestPropertiesValidationRules(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestPropertiesValidationRules IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestPropertiesValidationRules(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestPropertiesValidationRules model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestPropertiesValidationRules(Response response) + { + if (response is null) + { + return null; } - return new WebTestPropertiesValidationRules(contentValidation.Value, Optional.ToNullable(sslCheck), Optional.ToNullable(sslCertRemainingLifetimeCheck), Optional.ToNullable(expectedHttpStatusCode), Optional.ToNullable(ignoreHttpStatusCode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestPropertiesValidationRules(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.cs index 9633166256a5..10a08624ae25 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRules.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// The collection of validation rule properties. public partial class WebTestPropertiesValidationRules { - /// Initializes a new instance of WebTestPropertiesValidationRules. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WebTestPropertiesValidationRules() { } - /// Initializes a new instance of WebTestPropertiesValidationRules. + /// Initializes a new instance of . /// The collection of content validation properties. /// Checks to see if the SSL cert is still valid. /// A number of days to check still remain before the the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. /// Validate that the WebTest returns the http status code provided. /// When set, validation will ignore the status code. - internal WebTestPropertiesValidationRules(WebTestPropertiesValidationRulesContentValidation contentValidation, bool? checkSsl, int? sslCertRemainingLifetimeCheck, int? expectedHttpStatusCode, bool? ignoreHttpStatusCode) + /// Keeps track of any properties unknown to the library. + internal WebTestPropertiesValidationRules(WebTestPropertiesValidationRulesContentValidation contentValidation, bool? checkSsl, int? sslCertRemainingLifetimeCheck, int? expectedHttpStatusCode, bool? ignoreHttpStatusCode, Dictionary serializedAdditionalRawData) { ContentValidation = contentValidation; CheckSsl = checkSsl; SSLCertRemainingLifetimeCheck = sslCertRemainingLifetimeCheck; ExpectedHttpStatusCode = expectedHttpStatusCode; IgnoreHttpStatusCode = ignoreHttpStatusCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of content validation properties. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.Serialization.cs index 7631eedf3447..15ad35e99858 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WebTestPropertiesValidationRulesContentValidation : IUtf8JsonSerializable + public partial class WebTestPropertiesValidationRulesContentValidation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContentMatch)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("PassIfTextFound"u8); writer.WriteBooleanValue(PassIfTextFound.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebTestPropertiesValidationRulesContentValidation DeserializeWebTestPropertiesValidationRulesContentValidation(JsonElement element) + internal static WebTestPropertiesValidationRulesContentValidation DeserializeWebTestPropertiesValidationRulesContentValidation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static WebTestPropertiesValidationRulesContentValidation DeserializeWeb Optional contentMatch = default; Optional ignoreCase = default; Optional passIfTextFound = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ContentMatch"u8)) @@ -67,8 +90,61 @@ internal static WebTestPropertiesValidationRulesContentValidation DeserializeWeb passIfTextFound = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebTestPropertiesValidationRulesContentValidation(contentMatch.Value, Optional.ToNullable(ignoreCase), Optional.ToNullable(passIfTextFound), serializedAdditionalRawData); + } + + WebTestPropertiesValidationRulesContentValidation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebTestPropertiesValidationRulesContentValidation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebTestPropertiesValidationRulesContentValidation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebTestPropertiesValidationRulesContentValidation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebTestPropertiesValidationRulesContentValidation model) + { + if (model is null) + { + return null; } - return new WebTestPropertiesValidationRulesContentValidation(contentMatch.Value, Optional.ToNullable(ignoreCase), Optional.ToNullable(passIfTextFound)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebTestPropertiesValidationRulesContentValidation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebTestPropertiesValidationRulesContentValidation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.cs index 977a932ecf29..3eaea8377acf 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WebTestPropertiesValidationRulesContentValidation.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// The collection of content validation properties. public partial class WebTestPropertiesValidationRulesContentValidation { - /// Initializes a new instance of WebTestPropertiesValidationRulesContentValidation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WebTestPropertiesValidationRulesContentValidation() { } - /// Initializes a new instance of WebTestPropertiesValidationRulesContentValidation. + /// Initializes a new instance of . /// Content to look for in the return of the WebTest. Must not be null or empty. /// When set, this value makes the ContentMatch validation case insensitive. /// When true, validation will pass if there is a match for the ContentMatch string. If false, validation will fail if there is a match. - internal WebTestPropertiesValidationRulesContentValidation(string contentMatch, bool? ignoreCase, bool? passIfTextFound) + /// Keeps track of any properties unknown to the library. + internal WebTestPropertiesValidationRulesContentValidation(string contentMatch, bool? ignoreCase, bool? passIfTextFound, Dictionary serializedAdditionalRawData) { ContentMatch = contentMatch; IgnoreCase = ignoreCase; PassIfTextFound = passIfTextFound; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Content to look for in the return of the WebTest. Must not be null or empty. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.Serialization.cs index 3673b777824a..595a7aff1ae2 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WorkItemConfiguration + public partial class WorkItemConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkItemConfiguration DeserializeWorkItemConfiguration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ConnectorId)) + { + writer.WritePropertyName("ConnectorId"u8); + writer.WriteStringValue(ConnectorId); + } + if (Optional.IsDefined(ConfigDisplayName)) + { + writer.WritePropertyName("ConfigDisplayName"u8); + writer.WriteStringValue(ConfigDisplayName); + } + if (Optional.IsDefined(IsDefault)) + { + writer.WritePropertyName("IsDefault"u8); + writer.WriteBooleanValue(IsDefault.Value); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("Id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ConfigProperties)) + { + writer.WritePropertyName("ConfigProperties"u8); + writer.WriteStringValue(ConfigProperties); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkItemConfiguration DeserializeWorkItemConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static WorkItemConfiguration DeserializeWorkItemConfiguration(JsonEleme Optional isDefault = default; Optional id = default; Optional configProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ConnectorId"u8)) @@ -54,8 +108,61 @@ internal static WorkItemConfiguration DeserializeWorkItemConfiguration(JsonEleme configProperties = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkItemConfiguration(connectorId.Value, configDisplayName.Value, Optional.ToNullable(isDefault), id.Value, configProperties.Value); + return new WorkItemConfiguration(connectorId.Value, configDisplayName.Value, Optional.ToNullable(isDefault), id.Value, configProperties.Value, serializedAdditionalRawData); + } + + WorkItemConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkItemConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkItemConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkItemConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkItemConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkItemConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkItemConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs index edcdb0db598c..c970854caea0 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Work item configuration associated with an application insights resource. public partial class WorkItemConfiguration { - /// Initializes a new instance of WorkItemConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkItemConfiguration() { } - /// Initializes a new instance of WorkItemConfiguration. + /// Initializes a new instance of . /// Connector identifier where work item is created. /// Configuration friendly name. /// Boolean value indicating whether configuration is default. /// Unique Id for work item. /// Serialized JSON object for detailed properties. - internal WorkItemConfiguration(string connectorId, string configDisplayName, bool? isDefault, string id, string configProperties) + /// Keeps track of any properties unknown to the library. + internal WorkItemConfiguration(string connectorId, string configDisplayName, bool? isDefault, string id, string configProperties, Dictionary serializedAdditionalRawData) { ConnectorId = connectorId; ConfigDisplayName = configDisplayName; IsDefault = isDefault; Id = id; ConfigProperties = configProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Connector identifier where work item is created. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.Serialization.cs index 5c9e0bd1c49d..3eeaede2d9c9 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class WorkItemConfigurationsListResult + internal partial class WorkItemConfigurationsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkItemConfigurationsListResult DeserializeWorkItemConfigurationsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkItemConfigurationsListResult DeserializeWorkItemConfigurationsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static WorkItemConfigurationsListResult DeserializeWorkItemConfiguratio value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkItemConfigurationsListResult(Optional.ToList(value)); + return new WorkItemConfigurationsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + WorkItemConfigurationsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkItemConfigurationsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkItemConfigurationsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkItemConfigurationsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkItemConfigurationsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkItemConfigurationsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkItemConfigurationsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.cs index 35078d2dc1f6..8921be7c5f16 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemConfigurationsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Work item configuration list result. internal partial class WorkItemConfigurationsListResult { - /// Initializes a new instance of WorkItemConfigurationsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkItemConfigurationsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkItemConfigurationsListResult. + /// Initializes a new instance of . /// An array of work item configurations. - internal WorkItemConfigurationsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal WorkItemConfigurationsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of work item configurations. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.Serialization.cs index eef009e6fd1d..b4da11ea7d7f 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WorkItemCreateConfiguration : IUtf8JsonSerializable + public partial class WorkItemCreateConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConnectorId)) { @@ -41,7 +49,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static WorkItemCreateConfiguration DeserializeWorkItemCreateConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional connectorId = default; + Optional connectorDataConfiguration = default; + Optional validateOnly = default; + Optional> workItemProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ConnectorId"u8)) + { + connectorId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ConnectorDataConfiguration"u8)) + { + connectorDataConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("ValidateOnly"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validateOnly = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("WorkItemProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + workItemProperties = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkItemCreateConfiguration(connectorId.Value, connectorDataConfiguration.Value, Optional.ToNullable(validateOnly), Optional.ToDictionary(workItemProperties), serializedAdditionalRawData); + } + + WorkItemCreateConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkItemCreateConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkItemCreateConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkItemCreateConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkItemCreateConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkItemCreateConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkItemCreateConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs index dfc15dcb2f58..c2518a611ac8 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Work item configuration creation payload. public partial class WorkItemCreateConfiguration { - /// Initializes a new instance of WorkItemCreateConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkItemCreateConfiguration() { WorkItemProperties = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Unique connector id. + /// Serialized JSON object for detailed properties. + /// Boolean indicating validate only. + /// Custom work item properties. + /// Keeps track of any properties unknown to the library. + internal WorkItemCreateConfiguration(string connectorId, string connectorDataConfiguration, bool? isValidateOnly, IDictionary workItemProperties, Dictionary serializedAdditionalRawData) + { + ConnectorId = connectorId; + ConnectorDataConfiguration = connectorDataConfiguration; + IsValidateOnly = isValidateOnly; + WorkItemProperties = workItemProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Unique connector id. public string ConnectorId { get; set; } /// Serialized JSON object for detailed properties. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookData.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookData.Serialization.cs index 999c649ff431..01fb18fccbdc 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookData.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApplicationInsights { - public partial class WorkbookData : IUtf8JsonSerializable + public partial class WorkbookData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -107,11 +112,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkbookData DeserializeWorkbookData(JsonElement element) + internal static WorkbookData DeserializeWorkbookData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -135,6 +154,7 @@ internal static WorkbookData DeserializeWorkbookData(JsonElement element) Optional storageUri = default; Optional description = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -293,8 +313,61 @@ internal static WorkbookData DeserializeWorkbookData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkbookData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, displayName.Value, serializedData.Value, version.Value, Optional.ToNullable(timeModified), category.Value, userId.Value, sourceId.Value, storageUri.Value, description.Value, revision.Value, identity, Optional.ToNullable(kind), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + WorkbookData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookData model) + { + if (model is null) + { + return null; } - return new WorkbookData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, displayName.Value, serializedData.Value, version.Value, Optional.ToNullable(timeModified), category.Value, userId.Value, sourceId.Value, storageUri.Value, description.Value, revision.Value, identity, Optional.ToNullable(kind), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.Serialization.cs index 3f8c940a1fdc..7683c5205172 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WorkbookPatch : IUtf8JsonSerializable + public partial class WorkbookPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -83,7 +91,179 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static WorkbookPatch DeserializeWorkbookPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional kind = default; + Optional> tags = default; + Optional displayName = default; + Optional serializedData = default; + Optional category = default; + Optional> tags0 = default; + Optional description = default; + Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new WorkbookUpdateSharedTypeKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("serializedData"u8)) + { + serializedData = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("category"u8)) + { + category = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("tags"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + tags0 = array; + continue; + } + if (property0.NameEquals("description"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + description = null; + continue; + } + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("revision"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + revision = null; + continue; + } + revision = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkbookPatch(Optional.ToNullable(kind), Optional.ToDictionary(tags), displayName.Value, serializedData.Value, category.Value, Optional.ToList(tags0), description.Value, revision.Value, serializedAdditionalRawData); + } + + WorkbookPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.cs index 6dbbf6595072..744a1bf80281 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,39 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// The parameters that can be provided when updating workbook properties properties. public partial class WorkbookPatch { - /// Initializes a new instance of WorkbookPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkbookPatch() { Tags = new ChangeTrackingDictionary(); TagsPropertiesTags = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The kind of workbook. Only valid value is shared. + /// Resource tags. + /// The user-defined name (display name) of the workbook. + /// Configuration of this particular workbook. Configuration data is a string containing valid JSON. + /// Workbook category, as defined by the user at creation time. + /// A list of 0 or more tags that are associated with this workbook definition. + /// The description of the workbook. + /// The unique revision id for this workbook definition. + /// Keeps track of any properties unknown to the library. + internal WorkbookPatch(WorkbookUpdateSharedTypeKind? kind, IDictionary tags, string displayName, string serializedData, string category, IList tagsPropertiesTags, string description, string revision, Dictionary serializedAdditionalRawData) + { + Kind = kind; + Tags = tags; + DisplayName = displayName; + SerializedData = serializedData; + Category = category; + TagsPropertiesTags = tagsPropertiesTags; + Description = description; + Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The kind of workbook. Only valid value is shared. public WorkbookUpdateSharedTypeKind? Kind { get; set; } /// Resource tags. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateData.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateData.Serialization.cs index eb9a27eabeee..d39ce9a1a0bf 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateData.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ApplicationInsights { - public partial class WorkbookTemplateData : IUtf8JsonSerializable + public partial class WorkbookTemplateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -59,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Galleries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -78,18 +91,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item0 in item.Value) { - writer.WriteObjectValue(item0); + if (item0 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item0).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkbookTemplateData DeserializeWorkbookTemplateData(JsonElement element) + internal static WorkbookTemplateData DeserializeWorkbookTemplateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -105,6 +139,7 @@ internal static WorkbookTemplateData DeserializeWorkbookTemplateData(JsonElement Optional templateData = default; Optional> galleries = default; Optional>> localized = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -225,8 +260,61 @@ internal static WorkbookTemplateData DeserializeWorkbookTemplateData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkbookTemplateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(priority), author.Value, templateData.Value, Optional.ToList(galleries), Optional.ToDictionary(localized), serializedAdditionalRawData); + } + + WorkbookTemplateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookTemplateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookTemplateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookTemplateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookTemplateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookTemplateData(Response response) + { + if (response is null) + { + return null; } - return new WorkbookTemplateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(priority), author.Value, templateData.Value, Optional.ToList(galleries), Optional.ToDictionary(localized)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookTemplateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.Serialization.cs index 2e3d6475fc8b..be6dc635cbf5 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WorkbookTemplateGallery : IUtf8JsonSerializable + public partial class WorkbookTemplateGallery : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("resourceType"u8); writer.WriteStringValue(ResourceType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkbookTemplateGallery DeserializeWorkbookTemplateGallery(JsonElement element) + internal static WorkbookTemplateGallery DeserializeWorkbookTemplateGallery(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static WorkbookTemplateGallery DeserializeWorkbookTemplateGallery(JsonE Optional type = default; Optional order = default; Optional resourceType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -85,8 +108,61 @@ internal static WorkbookTemplateGallery DeserializeWorkbookTemplateGallery(JsonE resourceType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkbookTemplateGallery(name.Value, category.Value, type.Value, Optional.ToNullable(order), resourceType.Value, serializedAdditionalRawData); + } + + WorkbookTemplateGallery IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookTemplateGallery(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookTemplateGallery IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookTemplateGallery(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookTemplateGallery model) + { + if (model is null) + { + return null; } - return new WorkbookTemplateGallery(name.Value, category.Value, type.Value, Optional.ToNullable(order), resourceType.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookTemplateGallery(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookTemplateGallery(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.cs index 22286ff39d54..74b44c7ee722 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateGallery.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ApplicationInsights.Models { /// Gallery information for a workbook template. public partial class WorkbookTemplateGallery { - /// Initializes a new instance of WorkbookTemplateGallery. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkbookTemplateGallery() { } - /// Initializes a new instance of WorkbookTemplateGallery. + /// Initializes a new instance of . /// Name of the workbook template in the gallery. /// Category for the gallery. /// Type of workbook supported by the workbook template. /// Order of the template within the gallery. /// Azure resource type supported by the gallery. - internal WorkbookTemplateGallery(string name, string category, string workbookTemplateGalleryType, int? order, string resourceType) + /// Keeps track of any properties unknown to the library. + internal WorkbookTemplateGallery(string name, string category, string workbookTemplateGalleryType, int? order, string resourceType, Dictionary serializedAdditionalRawData) { Name = name; Category = category; WorkbookTemplateGalleryType = workbookTemplateGalleryType; Order = order; ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the workbook template in the gallery. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.Serialization.cs index 831d37bb51d6..a2394c718edf 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WorkbookTemplateLocalizedGallery : IUtf8JsonSerializable + public partial class WorkbookTemplateLocalizedGallery : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TemplateData)) { @@ -32,21 +38,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Galleries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkbookTemplateLocalizedGallery DeserializeWorkbookTemplateLocalizedGallery(JsonElement element) + internal static WorkbookTemplateLocalizedGallery DeserializeWorkbookTemplateLocalizedGallery(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional templateData = default; Optional> galleries = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("templateData"u8)) @@ -72,8 +100,61 @@ internal static WorkbookTemplateLocalizedGallery DeserializeWorkbookTemplateLoca galleries = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkbookTemplateLocalizedGallery(templateData.Value, Optional.ToList(galleries)); + return new WorkbookTemplateLocalizedGallery(templateData.Value, Optional.ToList(galleries), serializedAdditionalRawData); + } + + WorkbookTemplateLocalizedGallery IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookTemplateLocalizedGallery(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookTemplateLocalizedGallery IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookTemplateLocalizedGallery(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookTemplateLocalizedGallery model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookTemplateLocalizedGallery(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookTemplateLocalizedGallery(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.cs index 91d019369bee..7ba131b74d1b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplateLocalizedGallery.cs @@ -14,19 +14,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Localized template data and gallery information. public partial class WorkbookTemplateLocalizedGallery { - /// Initializes a new instance of WorkbookTemplateLocalizedGallery. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkbookTemplateLocalizedGallery() { Galleries = new ChangeTrackingList(); } - /// Initializes a new instance of WorkbookTemplateLocalizedGallery. + /// Initializes a new instance of . /// Valid JSON object containing workbook template payload. /// Workbook galleries supported by the template. - internal WorkbookTemplateLocalizedGallery(BinaryData templateData, IList galleries) + /// Keeps track of any properties unknown to the library. + internal WorkbookTemplateLocalizedGallery(BinaryData templateData, IList galleries, Dictionary serializedAdditionalRawData) { TemplateData = templateData; Galleries = galleries; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.Serialization.cs index 83384ae230d0..96087c63f8ec 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ApplicationInsights.Models { - public partial class WorkbookTemplatePatch : IUtf8JsonSerializable + public partial class WorkbookTemplatePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -53,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Galleries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -72,14 +87,196 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item0 in item.Value) { - writer.WriteObjectValue(item0); + if (item0 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item0).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static WorkbookTemplatePatch DeserializeWorkbookTemplatePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional priority = default; + Optional author = default; + Optional templateData = default; + Optional> galleries = default; + Optional>> localized = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("priority"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priority = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("author"u8)) + { + author = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("templateData"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateData = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("galleries"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(WorkbookTemplateGallery.DeserializeWorkbookTemplateGallery(item)); + } + galleries = array; + continue; + } + if (property0.NameEquals("localized"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary> dictionary = new Dictionary>(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property1.Name, null); + } + else + { + List array = new List(); + foreach (var item in property1.Value.EnumerateArray()) + { + array.Add(WorkbookTemplateLocalizedGallery.DeserializeWorkbookTemplateLocalizedGallery(item)); + } + dictionary.Add(property1.Name, array); + } + } + localized = dictionary; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkbookTemplatePatch(Optional.ToDictionary(tags), Optional.ToNullable(priority), author.Value, templateData.Value, Optional.ToList(galleries), Optional.ToDictionary(localized), serializedAdditionalRawData); + } + + WorkbookTemplatePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookTemplatePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookTemplatePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookTemplatePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookTemplatePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookTemplatePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookTemplatePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.cs index 1a3b12e1b2ba..1a0fc1ba460c 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatePatch.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// The parameters that can be provided when updating workbook template. public partial class WorkbookTemplatePatch { - /// Initializes a new instance of WorkbookTemplatePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkbookTemplatePatch() { Tags = new ChangeTrackingDictionary(); @@ -22,6 +25,25 @@ public WorkbookTemplatePatch() Localized = new ChangeTrackingDictionary>(); } + /// Initializes a new instance of . + /// Resource tags. + /// Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. + /// Information about the author of the workbook template. + /// Valid JSON object containing workbook template payload. + /// Workbook galleries supported by the template. + /// Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal. + /// Keeps track of any properties unknown to the library. + internal WorkbookTemplatePatch(IDictionary tags, int? priority, string author, BinaryData templateData, IList galleries, IDictionary> localized, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Priority = priority; + Author = author; + TemplateData = templateData; + Galleries = galleries; + Localized = localized; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.Serialization.cs index fadded650dbd..f05b709df8bf 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class WorkbookTemplatesListResult + internal partial class WorkbookTemplatesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkbookTemplatesListResult DeserializeWorkbookTemplatesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkbookTemplatesListResult DeserializeWorkbookTemplatesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static WorkbookTemplatesListResult DeserializeWorkbookTemplatesListResu value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkbookTemplatesListResult(Optional.ToList(value)); + return new WorkbookTemplatesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + WorkbookTemplatesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbookTemplatesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbookTemplatesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbookTemplatesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbookTemplatesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbookTemplatesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbookTemplatesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.cs index 0f3d121ba4d6..92d6dd7e9314 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbookTemplatesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApplicationInsights; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// WorkbookTemplate list result. internal partial class WorkbookTemplatesListResult { - /// Initializes a new instance of WorkbookTemplatesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkbookTemplatesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkbookTemplatesListResult. + /// Initializes a new instance of . /// An array of workbook templates. - internal WorkbookTemplatesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal WorkbookTemplatesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of workbook templates. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.Serialization.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.Serialization.cs index bf959ac4a8c1..3737cd7d5c2a 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.Serialization.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ApplicationInsights; namespace Azure.ResourceManager.ApplicationInsights.Models { - internal partial class WorkbooksListResult + internal partial class WorkbooksListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkbooksListResult DeserializeWorkbooksListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkbooksListResult DeserializeWorkbooksListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static WorkbooksListResult DeserializeWorkbooksListResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkbooksListResult(Optional.ToList(value), nextLink.Value); + return new WorkbooksListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkbooksListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkbooksListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkbooksListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkbooksListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkbooksListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkbooksListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkbooksListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.cs index fc235f833853..d54834e2c7bd 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Models/WorkbooksListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApplicationInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ApplicationInsights.Models /// Workbook list result. internal partial class WorkbooksListResult { - /// Initializes a new instance of WorkbooksListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkbooksListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkbooksListResult. + /// Initializes a new instance of . /// An array of workbooks. /// - internal WorkbooksListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkbooksListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of workbooks. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs index 99d9fcb5b284..9d7c11104fe7 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookCollection.cs @@ -235,7 +235,7 @@ public virtual AsyncPageable GetAllAsync(CategoryType catego { HttpMessage FirstPageRequest(int? pageSizeHint) => _myWorkbookRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _myWorkbookRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), _myWorkbookClientDiagnostics, Pipeline, "MyWorkbookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), _myWorkbookClientDiagnostics, Pipeline, "MyWorkbookCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -261,7 +261,7 @@ public virtual Pageable GetAll(CategoryType category, IEnume { HttpMessage FirstPageRequest(int? pageSizeHint) => _myWorkbookRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _myWorkbookRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), _myWorkbookClientDiagnostics, Pipeline, "MyWorkbookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), _myWorkbookClientDiagnostics, Pipeline, "MyWorkbookCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookData.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookData.cs index 9ffeff201343..34c7a51cf076 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookData.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookData.cs @@ -19,12 +19,12 @@ namespace Azure.ResourceManager.ApplicationInsights /// public partial class MyWorkbookData : Models.MyWorkbookResource { - /// Initializes a new instance of MyWorkbookData. + /// Initializes a new instance of . public MyWorkbookData() { } - /// Initializes a new instance of MyWorkbookData. + /// Initializes a new instance of . /// Identity used for BYOS. /// Azure resource Id. /// Azure resource name. @@ -42,7 +42,8 @@ public MyWorkbookData() /// Unique user id of the specific user that owns this private workbook. /// Optional resourceId for a source resource. /// BYOS Storage Account URI. - internal MyWorkbookData(MyWorkbookManagedIdentity identity, string id, string name, string resourceType, AzureLocation? location, IDictionary tags, IDictionary etag, ApplicationInsightsKind? kind, SystemData systemData, string displayName, string serializedData, string version, string timeModified, string category, string userId, string sourceId, Uri storageUri) : base(identity, id, name, resourceType, location, tags, etag) + /// Keeps track of any properties unknown to the library. + internal MyWorkbookData(MyWorkbookManagedIdentity identity, string id, string name, string resourceType, AzureLocation? location, IDictionary tags, IDictionary etag, ApplicationInsightsKind? kind, SystemData systemData, string displayName, string serializedData, string version, string timeModified, string category, string userId, string sourceId, Uri storageUri, Dictionary serializedAdditionalRawData) : base(identity, id, name, resourceType, location, tags, etag, serializedAdditionalRawData) { Kind = kind; SystemData = systemData; diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/APIKeysRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/APIKeysRestOperations.cs index 74c919be05eb..b4ef1f96698b 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/APIKeysRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/APIKeysRestOperations.cs @@ -134,9 +134,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnalyticsItemsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnalyticsItemsRestOperations.cs index b03b2205f3a6..b36bdaa9fdc9 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnalyticsItemsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnalyticsItemsRestOperations.cs @@ -267,9 +267,7 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(itemProperties); - request.Content = content; + request.Content = itemProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnnotationsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnnotationsRestOperations.cs index dc461a01834f..ffcc6f5631cf 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnnotationsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/AnnotationsRestOperations.cs @@ -145,9 +145,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(annotationProperties); - request.Content = content; + request.Content = annotationProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentCurrentBillingFeaturesRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentCurrentBillingFeaturesRestOperations.cs index 1b4c7987c81e..f16bb404cca3 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentCurrentBillingFeaturesRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentCurrentBillingFeaturesRestOperations.cs @@ -134,9 +134,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(billingFeaturesProperties); - request.Content = content; + request.Content = billingFeaturesProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentLinkedStorageAccountsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentLinkedStorageAccountsRestOperations.cs index 160f7b13b4c7..8ea6eecc24fd 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentLinkedStorageAccountsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentLinkedStorageAccountsRestOperations.cs @@ -142,9 +142,7 @@ internal HttpMessage CreateCreateAndUpdateRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -232,9 +230,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentsRestOperations.cs index 22f8b394ddb4..36b8ad336ddc 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ComponentsRestOperations.cs @@ -346,9 +346,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -432,9 +430,7 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(componentTags); - request.Content = content; + request.Content = componentTags; _userAgent.Apply(message); return message; } @@ -519,9 +515,7 @@ internal HttpMessage CreatePurgeRequest(string subscriptionId, string resourceGr request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ExportConfigurationsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ExportConfigurationsRestOperations.cs index d15cf61db557..7c33bb9b5afa 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ExportConfigurationsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ExportConfigurationsRestOperations.cs @@ -145,9 +145,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(exportProperties); - request.Content = content; + request.Content = exportProperties; _userAgent.Apply(message); return message; } @@ -411,9 +409,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(exportProperties); - request.Content = content; + request.Content = exportProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/FavoritesRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/FavoritesRestOperations.cs index 3d2e68f659f1..e141f47cf3af 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/FavoritesRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/FavoritesRestOperations.cs @@ -254,9 +254,7 @@ internal HttpMessage CreateAddRequest(string subscriptionId, string resourceGrou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(favoriteProperties); - request.Content = content; + request.Content = favoriteProperties; _userAgent.Apply(message); return message; } @@ -346,9 +344,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(favoriteProperties); - request.Content = content; + request.Content = favoriteProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/MyWorkbooksRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/MyWorkbooksRestOperations.cs index 946535af9361..368de0a3a42d 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/MyWorkbooksRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/MyWorkbooksRestOperations.cs @@ -387,9 +387,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -481,9 +479,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ProactiveDetectionConfigurationsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ProactiveDetectionConfigurationsRestOperations.cs index 6a11d807cb2e..fe703ef5eeb1 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ProactiveDetectionConfigurationsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/ProactiveDetectionConfigurationsRestOperations.cs @@ -230,9 +230,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(proactiveDetectionProperties); - request.Content = content; + request.Content = proactiveDetectionProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WebTestsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WebTestsRestOperations.cs index c03e3e0a229d..a4a378f61f37 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WebTestsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WebTestsRestOperations.cs @@ -209,9 +209,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -295,9 +293,7 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(webTestTags); - request.Content = content; + request.Content = webTestTags; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkItemConfigurationsRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkItemConfigurationsRestOperations.cs index c98425473e0e..f2f8ae0e1cb3 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkItemConfigurationsRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkItemConfigurationsRestOperations.cs @@ -134,9 +134,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(workItemConfigurationProperties); - request.Content = content; + request.Content = workItemConfigurationProperties; _userAgent.Apply(message); return message; } @@ -458,9 +456,7 @@ internal HttpMessage CreateUpdateItemRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(workItemConfigurationProperties); - request.Content = content; + request.Content = workItemConfigurationProperties; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbookTemplatesRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbookTemplatesRestOperations.cs index 4f8a98116e0d..8f25437968cc 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbookTemplatesRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbookTemplatesRestOperations.cs @@ -279,9 +279,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -367,9 +365,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbooksRestOperations.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbooksRestOperations.cs index 9592586edc6a..533df2b833ee 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbooksRestOperations.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/RestOperations/WorkbooksRestOperations.cs @@ -393,9 +393,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -487,9 +485,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs index d7bcc5c0720b..b2ca62244fca 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _webTestRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _webTestRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "WebTestCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "WebTestCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _webTestRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _webTestRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "WebTestCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), _webTestClientDiagnostics, Pipeline, "WebTestCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestData.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestData.cs index 2ef403ca9bb7..5f1aa1ccddd7 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestData.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApplicationInsights.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.ApplicationInsights /// public partial class WebTestData : TrackedResourceData { - /// Initializes a new instance of WebTestData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public WebTestData(AzureLocation location) : base(location) { Locations = new ChangeTrackingList(); } - /// Initializes a new instance of WebTestData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -46,7 +50,8 @@ public WebTestData(AzureLocation location) : base(location) /// Current state of this component, whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. /// The collection of request properties. /// The collection of validation rule properties. - internal WebTestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WebTestKind? kind, string syntheticMonitorId, string webTestName, string description, bool? isEnabled, int? frequencyInSeconds, int? timeoutInSeconds, WebTestKind? webTestKind, bool? isRetryEnabled, IList locations, WebTestPropertiesConfiguration configuration, string provisioningState, WebTestPropertiesRequest request, WebTestPropertiesValidationRules validationRules) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal WebTestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WebTestKind? kind, string syntheticMonitorId, string webTestName, string description, bool? isEnabled, int? frequencyInSeconds, int? timeoutInSeconds, WebTestKind? webTestKind, bool? isRetryEnabled, IList locations, WebTestPropertiesConfiguration configuration, string provisioningState, WebTestPropertiesRequest request, WebTestPropertiesValidationRules validationRules, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; SyntheticMonitorId = syntheticMonitorId; @@ -62,6 +67,12 @@ internal WebTestData(ResourceIdentifier id, string name, ResourceType resourceTy ProvisioningState = provisioningState; Request = request; ValidationRules = validationRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WebTestData() + { } /// The kind of WebTest that this web test watches. Choices are ping, multistep and standard. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs index cbf563e933db..fb3d86174a16 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookCollection.cs @@ -237,7 +237,7 @@ public virtual AsyncPageable GetAllAsync(CategoryType category { HttpMessage FirstPageRequest(int? pageSizeHint) => _workbookRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workbookRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookClientDiagnostics, Pipeline, "WorkbookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookClientDiagnostics, Pipeline, "WorkbookCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -263,7 +263,7 @@ public virtual Pageable GetAll(CategoryType category, IEnumera { HttpMessage FirstPageRequest(int? pageSizeHint) => _workbookRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workbookRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, category, tags, sourceId, canFetchContent); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookClientDiagnostics, Pipeline, "WorkbookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookClientDiagnostics, Pipeline, "WorkbookCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookData.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookData.cs index 77e8b6f50ba1..d9003ffa2203 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookData.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.ApplicationInsights /// public partial class WorkbookData : TrackedResourceData { - /// Initializes a new instance of WorkbookData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public WorkbookData(AzureLocation location) : base(location) { } - /// Initializes a new instance of WorkbookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -46,7 +49,8 @@ public WorkbookData(AzureLocation location) : base(location) /// Identity used for BYOS. /// The kind of workbook. Only valid value is shared. /// Resource etag. - internal WorkbookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string displayName, string serializedData, string version, DateTimeOffset? modifiedOn, string category, string userId, string sourceId, Uri storageUri, string description, string revision, ManagedServiceIdentity identity, WorkbookSharedTypeKind? kind, ETag? etag) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal WorkbookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string displayName, string serializedData, string version, DateTimeOffset? modifiedOn, string category, string userId, string sourceId, Uri storageUri, string description, string revision, ManagedServiceIdentity identity, WorkbookSharedTypeKind? kind, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { DisplayName = displayName; SerializedData = serializedData; @@ -61,6 +65,12 @@ internal WorkbookData(ResourceIdentifier id, string name, ResourceType resourceT Identity = identity; Kind = kind; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkbookData() + { } /// The user-defined name (display name) of the workbook. diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs index 112e128b7732..93169346b55f 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _workbookRevisionWorkbooksRestClient.CreateRevisionsListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workbookRevisionWorkbooksRestClient.CreateRevisionsListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkbookRevisionResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookRevisionWorkbooksClientDiagnostics, Pipeline, "WorkbookRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkbookRevisionResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookRevisionWorkbooksClientDiagnostics, Pipeline, "WorkbookRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _workbookRevisionWorkbooksRestClient.CreateRevisionsListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workbookRevisionWorkbooksRestClient.CreateRevisionsListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkbookRevisionResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookRevisionWorkbooksClientDiagnostics, Pipeline, "WorkbookRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkbookRevisionResource(Client, WorkbookData.DeserializeWorkbookData(e)), _workbookRevisionWorkbooksClientDiagnostics, Pipeline, "WorkbookRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs index 9f5c984c24d0..4147ffe21603 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string resourceName, Cance public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _workbookTemplateRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new WorkbookTemplateResource(Client, WorkbookTemplateData.DeserializeWorkbookTemplateData(e)), _workbookTemplateClientDiagnostics, Pipeline, "WorkbookTemplateCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new WorkbookTemplateResource(Client, WorkbookTemplateData.DeserializeWorkbookTemplateData(e)), _workbookTemplateClientDiagnostics, Pipeline, "WorkbookTemplateCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _workbookTemplateRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new WorkbookTemplateResource(Client, WorkbookTemplateData.DeserializeWorkbookTemplateData(e)), _workbookTemplateClientDiagnostics, Pipeline, "WorkbookTemplateCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new WorkbookTemplateResource(Client, WorkbookTemplateData.DeserializeWorkbookTemplateData(e)), _workbookTemplateClientDiagnostics, Pipeline, "WorkbookTemplateCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateData.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateData.cs index b5575e9b0c60..c2d0dc264530 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateData.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.ApplicationInsights /// public partial class WorkbookTemplateData : TrackedResourceData { - /// Initializes a new instance of WorkbookTemplateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public WorkbookTemplateData(AzureLocation location) : base(location) { @@ -27,7 +30,7 @@ public WorkbookTemplateData(AzureLocation location) : base(location) LocalizedGalleries = new ChangeTrackingDictionary>(); } - /// Initializes a new instance of WorkbookTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,13 +42,20 @@ public WorkbookTemplateData(AzureLocation location) : base(location) /// Valid JSON object containing workbook template payload. /// Workbook galleries supported by the template. /// Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal. - internal WorkbookTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, int? priority, string author, BinaryData templateData, IList galleries, IDictionary> localizedGalleries) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal WorkbookTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, int? priority, string author, BinaryData templateData, IList galleries, IDictionary> localizedGalleries, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Priority = priority; Author = author; TemplateData = templateData; Galleries = galleries; LocalizedGalleries = localizedGalleries; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkbookTemplateData() + { } /// Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs index 920fc11d7ae3..0849b9ac4a46 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformApiPortalApiPortalsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformApiPortalApiPortalsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformApiPortalResource(Client, AppPlatformApiPortalData.DeserializeAppPlatformApiPortalData(e)), _appPlatformApiPortalApiPortalsClientDiagnostics, Pipeline, "AppPlatformApiPortalCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformApiPortalResource(Client, AppPlatformApiPortalData.DeserializeAppPlatformApiPortalData(e)), _appPlatformApiPortalApiPortalsClientDiagnostics, Pipeline, "AppPlatformApiPortalCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformApiPortalApiPortalsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformApiPortalApiPortalsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformApiPortalResource(Client, AppPlatformApiPortalData.DeserializeAppPlatformApiPortalData(e)), _appPlatformApiPortalApiPortalsClientDiagnostics, Pipeline, "AppPlatformApiPortalCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformApiPortalResource(Client, AppPlatformApiPortalData.DeserializeAppPlatformApiPortalData(e)), _appPlatformApiPortalApiPortalsClientDiagnostics, Pipeline, "AppPlatformApiPortalCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs index 529a6cd3c9c0..2c1db848d8f7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformApiPortalCustomDomainApiPortalCustomDomainsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformApiPortalCustomDomainApiPortalCustomDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformApiPortalCustomDomainResource(Client, AppPlatformApiPortalCustomDomainData.DeserializeAppPlatformApiPortalCustomDomainData(e)), _appPlatformApiPortalCustomDomainApiPortalCustomDomainsClientDiagnostics, Pipeline, "AppPlatformApiPortalCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformApiPortalCustomDomainResource(Client, AppPlatformApiPortalCustomDomainData.DeserializeAppPlatformApiPortalCustomDomainData(e)), _appPlatformApiPortalCustomDomainApiPortalCustomDomainsClientDiagnostics, Pipeline, "AppPlatformApiPortalCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformApiPortalCustomDomainApiPortalCustomDomainsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformApiPortalCustomDomainApiPortalCustomDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformApiPortalCustomDomainResource(Client, AppPlatformApiPortalCustomDomainData.DeserializeAppPlatformApiPortalCustomDomainData(e)), _appPlatformApiPortalCustomDomainApiPortalCustomDomainsClientDiagnostics, Pipeline, "AppPlatformApiPortalCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformApiPortalCustomDomainResource(Client, AppPlatformApiPortalCustomDomainData.DeserializeAppPlatformApiPortalCustomDomainData(e)), _appPlatformApiPortalCustomDomainApiPortalCustomDomainsClientDiagnostics, Pipeline, "AppPlatformApiPortalCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainData.cs index 3b87caac0c77..63bac88e03e7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformApiPortalCustomDomainData : ResourceData { - /// Initializes a new instance of AppPlatformApiPortalCustomDomainData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformApiPortalCustomDomainData() { } - /// Initializes a new instance of AppPlatformApiPortalCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The properties of custom domain for API portal. - internal AppPlatformApiPortalCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiPortalCustomDomainProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformApiPortalCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiPortalCustomDomainProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The properties of custom domain for API portal. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalData.cs index 240788511ec0..3539eeba9d4e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformApiPortalData : ResourceData { - /// Initializes a new instance of AppPlatformApiPortalData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformApiPortalData() { } - /// Initializes a new instance of AppPlatformApiPortalData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// API portal properties payload. /// Sku of the API portal resource. - internal AppPlatformApiPortalData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformApiPortalProperties properties, AppPlatformSku sku) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformApiPortalData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformApiPortalProperties properties, AppPlatformSku sku, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// API portal properties payload. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs index 56ea868cb95e..4ddb4913fae2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformAppAppsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformAppAppsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformAppResource(Client, AppPlatformAppData.DeserializeAppPlatformAppData(e)), _appPlatformAppAppsClientDiagnostics, Pipeline, "AppPlatformAppCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformAppResource(Client, AppPlatformAppData.DeserializeAppPlatformAppData(e)), _appPlatformAppAppsClientDiagnostics, Pipeline, "AppPlatformAppCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformAppAppsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformAppAppsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformAppResource(Client, AppPlatformAppData.DeserializeAppPlatformAppData(e)), _appPlatformAppAppsClientDiagnostics, Pipeline, "AppPlatformAppCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformAppResource(Client, AppPlatformAppData.DeserializeAppPlatformAppData(e)), _appPlatformAppAppsClientDiagnostics, Pipeline, "AppPlatformAppCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppData.cs index 4591af235225..80fb4c0e7036 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformAppData : ResourceData { - /// Initializes a new instance of AppPlatformAppData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformAppData() { } - /// Initializes a new instance of AppPlatformAppData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +35,13 @@ public AppPlatformAppData() /// Properties of the App resource. /// The Managed Identity type of the app resource. /// The GEO location of the application, always the same with its parent resource. - internal AppPlatformAppData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformAppProperties properties, ManagedServiceIdentity identity, AzureLocation? location) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformAppData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformAppProperties properties, ManagedServiceIdentity identity, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; Identity = identity; Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the App resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs index 801e690f95d8..ae2aa1ee3d82 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBindingBindingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBindingBindingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBindingResource(Client, AppPlatformBindingData.DeserializeAppPlatformBindingData(e)), _appPlatformBindingBindingsClientDiagnostics, Pipeline, "AppPlatformBindingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBindingResource(Client, AppPlatformBindingData.DeserializeAppPlatformBindingData(e)), _appPlatformBindingBindingsClientDiagnostics, Pipeline, "AppPlatformBindingCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBindingBindingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBindingBindingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBindingResource(Client, AppPlatformBindingData.DeserializeAppPlatformBindingData(e)), _appPlatformBindingBindingsClientDiagnostics, Pipeline, "AppPlatformBindingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBindingResource(Client, AppPlatformBindingData.DeserializeAppPlatformBindingData(e)), _appPlatformBindingBindingsClientDiagnostics, Pipeline, "AppPlatformBindingCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingData.cs index 04781cf2daaa..681d3164a5fc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBindingData : ResourceData { - /// Initializes a new instance of AppPlatformBindingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBindingData() { } - /// Initializes a new instance of AppPlatformBindingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the Binding resource. - internal AppPlatformBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBindingProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBindingProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the Binding resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs index 8b5c5e14cdf3..4f073be8d07e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildBuildServiceRestClient.CreateListBuildsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildBuildServiceRestClient.CreateListBuildsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildResource(Client, AppPlatformBuildData.DeserializeAppPlatformBuildData(e)), _appPlatformBuildBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildResource(Client, AppPlatformBuildData.DeserializeAppPlatformBuildData(e)), _appPlatformBuildBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildBuildServiceRestClient.CreateListBuildsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildBuildServiceRestClient.CreateListBuildsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildResource(Client, AppPlatformBuildData.DeserializeAppPlatformBuildData(e)), _appPlatformBuildBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildResource(Client, AppPlatformBuildData.DeserializeAppPlatformBuildData(e)), _appPlatformBuildBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildData.cs index 7e47ae8532e3..f27380d84b13 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBuildData : ResourceData { - /// Initializes a new instance of AppPlatformBuildData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildData() { } - /// Initializes a new instance of AppPlatformBuildData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the build resource. - internal AppPlatformBuildData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the build resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs index 4def9256ae1e..af63cf870adf 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildResultBuildServiceRestClient.CreateListBuildResultsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildResultBuildServiceRestClient.CreateListBuildResultsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildResultResource(Client, AppPlatformBuildResultData.DeserializeAppPlatformBuildResultData(e)), _appPlatformBuildResultBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildResultCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildResultResource(Client, AppPlatformBuildResultData.DeserializeAppPlatformBuildResultData(e)), _appPlatformBuildResultBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildResultCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildResultBuildServiceRestClient.CreateListBuildResultsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildResultBuildServiceRestClient.CreateListBuildResultsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildResultResource(Client, AppPlatformBuildResultData.DeserializeAppPlatformBuildResultData(e)), _appPlatformBuildResultBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildResultCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildResultResource(Client, AppPlatformBuildResultData.DeserializeAppPlatformBuildResultData(e)), _appPlatformBuildResultBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildResultCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultData.cs index 92eb9c9c58b2..c1695b4155e1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBuildResultData : ResourceData { - /// Initializes a new instance of AppPlatformBuildResultData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildResultData() { } - /// Initializes a new instance of AppPlatformBuildResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the build result resource. - internal AppPlatformBuildResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildResultProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildResultProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the build result resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs index 9827ce23c2b8..4c0747ed874a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildServiceAgentPoolResource(Client, AppPlatformBuildServiceAgentPoolData.DeserializeAppPlatformBuildServiceAgentPoolData(e)), _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolClientDiagnostics, Pipeline, "AppPlatformBuildServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildServiceAgentPoolResource(Client, AppPlatformBuildServiceAgentPoolData.DeserializeAppPlatformBuildServiceAgentPoolData(e)), _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolClientDiagnostics, Pipeline, "AppPlatformBuildServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildServiceAgentPoolResource(Client, AppPlatformBuildServiceAgentPoolData.DeserializeAppPlatformBuildServiceAgentPoolData(e)), _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolClientDiagnostics, Pipeline, "AppPlatformBuildServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildServiceAgentPoolResource(Client, AppPlatformBuildServiceAgentPoolData.DeserializeAppPlatformBuildServiceAgentPoolData(e)), _appPlatformBuildServiceAgentPoolBuildServiceAgentPoolClientDiagnostics, Pipeline, "AppPlatformBuildServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolData.cs index ea57d7866cc9..422cde4c4ceb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBuildServiceAgentPoolData : ResourceData { - /// Initializes a new instance of AppPlatformBuildServiceAgentPoolData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildServiceAgentPoolData() { } - /// Initializes a new instance of AppPlatformBuildServiceAgentPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// build service agent pool properties. - internal AppPlatformBuildServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildServiceAgentPoolProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildServiceAgentPoolProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// build service agent pool properties. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs index e476b05a4100..58e87b90ea01 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildServiceBuildServiceRestClient.CreateListBuildServicesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildServiceBuildServiceRestClient.CreateListBuildServicesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildServiceResource(Client, AppPlatformBuildServiceData.DeserializeAppPlatformBuildServiceData(e)), _appPlatformBuildServiceBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildServiceResource(Client, AppPlatformBuildServiceData.DeserializeAppPlatformBuildServiceData(e)), _appPlatformBuildServiceBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildServiceBuildServiceRestClient.CreateListBuildServicesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildServiceBuildServiceRestClient.CreateListBuildServicesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildServiceResource(Client, AppPlatformBuildServiceData.DeserializeAppPlatformBuildServiceData(e)), _appPlatformBuildServiceBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildServiceResource(Client, AppPlatformBuildServiceData.DeserializeAppPlatformBuildServiceData(e)), _appPlatformBuildServiceBuildServiceClientDiagnostics, Pipeline, "AppPlatformBuildServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceData.cs index 78015540ece9..997c06ba1ce0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBuildServiceData : ResourceData { - /// Initializes a new instance of AppPlatformBuildServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildServiceData() { } - /// Initializes a new instance of AppPlatformBuildServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the build resource. - internal AppPlatformBuildServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildServiceProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildServiceProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the build resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs index d4ac47f79245..ce9a1a8cd11c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuilderBuildServiceBuilderRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuilderBuildServiceBuilderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuilderResource(Client, AppPlatformBuilderData.DeserializeAppPlatformBuilderData(e)), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuilderResource(Client, AppPlatformBuilderData.DeserializeAppPlatformBuilderData(e)), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuilderBuildServiceBuilderRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuilderBuildServiceBuilderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuilderResource(Client, AppPlatformBuilderData.DeserializeAppPlatformBuilderData(e)), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuilderResource(Client, AppPlatformBuilderData.DeserializeAppPlatformBuilderData(e)), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderData.cs index cc9b2331a8b7..8a32e83dd316 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBuilderData : ResourceData { - /// Initializes a new instance of AppPlatformBuilderData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuilderData() { } - /// Initializes a new instance of AppPlatformBuilderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Property of the Builder resource. - internal AppPlatformBuilderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuilderProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuilderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuilderProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Property of the Builder resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs index d99eb8506a86..dbe18456572d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs @@ -366,7 +366,7 @@ public virtual ArmOperation Update(WaitUntil waitUnt public virtual AsyncPageable GetDeploymentsAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuilderBuildServiceBuilderRestClient.CreateListDeploymentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ResourceIdentifier(e.GetString()), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderResource.GetDeployments", "deployments", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ResourceIdentifier(e.GetString()), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderResource.GetDeployments", "deployments", null, cancellationToken); } /// @@ -387,7 +387,7 @@ public virtual AsyncPageable GetDeploymentsAsync(Cancellatio public virtual Pageable GetDeployments(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuilderBuildServiceBuilderRestClient.CreateListDeploymentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ResourceIdentifier(e.GetString()), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderResource.GetDeployments", "deployments", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ResourceIdentifier(e.GetString()), _appPlatformBuilderBuildServiceBuilderClientDiagnostics, Pipeline, "AppPlatformBuilderResource.GetDeployments", "deployments", null, cancellationToken); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs index 541066975741..0e51eacff1d6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildpackBindingBuildpackBindingRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildpackBindingBuildpackBindingRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildpackBindingResource(Client, AppPlatformBuildpackBindingData.DeserializeAppPlatformBuildpackBindingData(e)), _appPlatformBuildpackBindingBuildpackBindingClientDiagnostics, Pipeline, "AppPlatformBuildpackBindingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildpackBindingResource(Client, AppPlatformBuildpackBindingData.DeserializeAppPlatformBuildpackBindingData(e)), _appPlatformBuildpackBindingBuildpackBindingClientDiagnostics, Pipeline, "AppPlatformBuildpackBindingCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformBuildpackBindingBuildpackBindingRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformBuildpackBindingBuildpackBindingRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformBuildpackBindingResource(Client, AppPlatformBuildpackBindingData.DeserializeAppPlatformBuildpackBindingData(e)), _appPlatformBuildpackBindingBuildpackBindingClientDiagnostics, Pipeline, "AppPlatformBuildpackBindingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformBuildpackBindingResource(Client, AppPlatformBuildpackBindingData.DeserializeAppPlatformBuildpackBindingData(e)), _appPlatformBuildpackBindingBuildpackBindingClientDiagnostics, Pipeline, "AppPlatformBuildpackBindingCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingData.cs index 8854eee17217..f050d3742177 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformBuildpackBindingData : ResourceData { - /// Initializes a new instance of AppPlatformBuildpackBindingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildpackBindingData() { } - /// Initializes a new instance of AppPlatformBuildpackBindingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of a buildpack binding. - internal AppPlatformBuildpackBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildpackBindingProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildpackBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformBuildpackBindingProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of a buildpack binding. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs index 16c383574adf..46bea54008fb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformCertificateResource(Client, AppPlatformCertificateData.DeserializeAppPlatformCertificateData(e)), _appPlatformCertificateCertificatesClientDiagnostics, Pipeline, "AppPlatformCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformCertificateResource(Client, AppPlatformCertificateData.DeserializeAppPlatformCertificateData(e)), _appPlatformCertificateCertificatesClientDiagnostics, Pipeline, "AppPlatformCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformCertificateResource(Client, AppPlatformCertificateData.DeserializeAppPlatformCertificateData(e)), _appPlatformCertificateCertificatesClientDiagnostics, Pipeline, "AppPlatformCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformCertificateResource(Client, AppPlatformCertificateData.DeserializeAppPlatformCertificateData(e)), _appPlatformCertificateCertificatesClientDiagnostics, Pipeline, "AppPlatformCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateData.cs index 1118fe4f3d79..00cfb774403f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformCertificateData : ResourceData { - /// Initializes a new instance of AppPlatformCertificateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformCertificateData() { } - /// Initializes a new instance of AppPlatformCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +37,11 @@ public AppPlatformCertificateData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal AppPlatformCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformCertificateProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformCertificateProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerData.cs index 06899b68c44a..6106e851ff2c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformConfigServerData : ResourceData { - /// Initializes a new instance of AppPlatformConfigServerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformConfigServerData() { } - /// Initializes a new instance of AppPlatformConfigServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the Config Server resource. - internal AppPlatformConfigServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformConfigServerProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformConfigServerProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the Config Server resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs index 8a52227acf68..92e40eee3a8a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformConfigurationServiceConfigurationServicesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformConfigurationServiceConfigurationServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformConfigurationServiceResource(Client, AppPlatformConfigurationServiceData.DeserializeAppPlatformConfigurationServiceData(e)), _appPlatformConfigurationServiceConfigurationServicesClientDiagnostics, Pipeline, "AppPlatformConfigurationServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformConfigurationServiceResource(Client, AppPlatformConfigurationServiceData.DeserializeAppPlatformConfigurationServiceData(e)), _appPlatformConfigurationServiceConfigurationServicesClientDiagnostics, Pipeline, "AppPlatformConfigurationServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformConfigurationServiceConfigurationServicesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformConfigurationServiceConfigurationServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformConfigurationServiceResource(Client, AppPlatformConfigurationServiceData.DeserializeAppPlatformConfigurationServiceData(e)), _appPlatformConfigurationServiceConfigurationServicesClientDiagnostics, Pipeline, "AppPlatformConfigurationServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformConfigurationServiceResource(Client, AppPlatformConfigurationServiceData.DeserializeAppPlatformConfigurationServiceData(e)), _appPlatformConfigurationServiceConfigurationServicesClientDiagnostics, Pipeline, "AppPlatformConfigurationServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceData.cs index eff30b12079f..0ca4901a1e75 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformConfigurationServiceData : ResourceData { - /// Initializes a new instance of AppPlatformConfigurationServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformConfigurationServiceData() { } - /// Initializes a new instance of AppPlatformConfigurationServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Application Configuration Service properties payload. - internal AppPlatformConfigurationServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformConfigurationServiceProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformConfigurationServiceProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Application Configuration Service properties payload. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs index ca9dd0078394..ca4bf469eed0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformCustomDomainCustomDomainsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformCustomDomainCustomDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformCustomDomainResource(Client, AppPlatformCustomDomainData.DeserializeAppPlatformCustomDomainData(e)), _appPlatformCustomDomainCustomDomainsClientDiagnostics, Pipeline, "AppPlatformCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformCustomDomainResource(Client, AppPlatformCustomDomainData.DeserializeAppPlatformCustomDomainData(e)), _appPlatformCustomDomainCustomDomainsClientDiagnostics, Pipeline, "AppPlatformCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformCustomDomainCustomDomainsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformCustomDomainCustomDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformCustomDomainResource(Client, AppPlatformCustomDomainData.DeserializeAppPlatformCustomDomainData(e)), _appPlatformCustomDomainCustomDomainsClientDiagnostics, Pipeline, "AppPlatformCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformCustomDomainResource(Client, AppPlatformCustomDomainData.DeserializeAppPlatformCustomDomainData(e)), _appPlatformCustomDomainCustomDomainsClientDiagnostics, Pipeline, "AppPlatformCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainData.cs index 9f04578bfb45..d93709f9b5b6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformCustomDomainData : ResourceData { - /// Initializes a new instance of AppPlatformCustomDomainData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformCustomDomainData() { } - /// Initializes a new instance of AppPlatformCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the custom domain resource. - internal AppPlatformCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformCustomDomainProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformCustomDomainProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the custom domain resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs index 096bde7df59d..c2065ccdac7b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(IEnumera { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(IEnumerable _appPlatformDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentData.cs index aa9d1730b9c5..274b378ab43a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformDeploymentData : ResourceData { - /// Initializes a new instance of AppPlatformDeploymentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformDeploymentData() { } - /// Initializes a new instance of AppPlatformDeploymentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the Deployment resource. /// Sku of the Deployment resource. - internal AppPlatformDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformDeploymentProperties properties, AppPlatformSku sku) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformDeploymentProperties properties, AppPlatformSku sku, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the Deployment resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs index fb48c939a7fb..25d9e0130787 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformGatewayGatewaysRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformGatewayGatewaysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformGatewayResource(Client, AppPlatformGatewayData.DeserializeAppPlatformGatewayData(e)), _appPlatformGatewayGatewaysClientDiagnostics, Pipeline, "AppPlatformGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformGatewayResource(Client, AppPlatformGatewayData.DeserializeAppPlatformGatewayData(e)), _appPlatformGatewayGatewaysClientDiagnostics, Pipeline, "AppPlatformGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformGatewayGatewaysRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformGatewayGatewaysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformGatewayResource(Client, AppPlatformGatewayData.DeserializeAppPlatformGatewayData(e)), _appPlatformGatewayGatewaysClientDiagnostics, Pipeline, "AppPlatformGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformGatewayResource(Client, AppPlatformGatewayData.DeserializeAppPlatformGatewayData(e)), _appPlatformGatewayGatewaysClientDiagnostics, Pipeline, "AppPlatformGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs index 4a0be01db9b4..eb8a816ef562 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformGatewayCustomDomainGatewayCustomDomainsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformGatewayCustomDomainGatewayCustomDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformGatewayCustomDomainResource(Client, AppPlatformGatewayCustomDomainData.DeserializeAppPlatformGatewayCustomDomainData(e)), _appPlatformGatewayCustomDomainGatewayCustomDomainsClientDiagnostics, Pipeline, "AppPlatformGatewayCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformGatewayCustomDomainResource(Client, AppPlatformGatewayCustomDomainData.DeserializeAppPlatformGatewayCustomDomainData(e)), _appPlatformGatewayCustomDomainGatewayCustomDomainsClientDiagnostics, Pipeline, "AppPlatformGatewayCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformGatewayCustomDomainGatewayCustomDomainsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformGatewayCustomDomainGatewayCustomDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformGatewayCustomDomainResource(Client, AppPlatformGatewayCustomDomainData.DeserializeAppPlatformGatewayCustomDomainData(e)), _appPlatformGatewayCustomDomainGatewayCustomDomainsClientDiagnostics, Pipeline, "AppPlatformGatewayCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformGatewayCustomDomainResource(Client, AppPlatformGatewayCustomDomainData.DeserializeAppPlatformGatewayCustomDomainData(e)), _appPlatformGatewayCustomDomainGatewayCustomDomainsClientDiagnostics, Pipeline, "AppPlatformGatewayCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainData.cs index 55142fdd6575..f878914700ca 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformGatewayCustomDomainData : ResourceData { - /// Initializes a new instance of AppPlatformGatewayCustomDomainData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayCustomDomainData() { } - /// Initializes a new instance of AppPlatformGatewayCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The properties of custom domain for Spring Cloud Gateway. - internal AppPlatformGatewayCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GatewayCustomDomainProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GatewayCustomDomainProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The properties of custom domain for Spring Cloud Gateway. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayData.cs index 0c618c58d8e0..c5dbca6cac9a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformGatewayData : ResourceData { - /// Initializes a new instance of AppPlatformGatewayData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayData() { } - /// Initializes a new instance of AppPlatformGatewayData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Spring Cloud Gateway properties payload. /// Sku of the Spring Cloud Gateway resource. - internal AppPlatformGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformGatewayProperties properties, AppPlatformSku sku) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformGatewayProperties properties, AppPlatformSku sku, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Spring Cloud Gateway properties payload. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs index de39e0735515..277c4fcae2bc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformGatewayRouteConfigGatewayRouteConfigsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformGatewayRouteConfigGatewayRouteConfigsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformGatewayRouteConfigResource(Client, AppPlatformGatewayRouteConfigData.DeserializeAppPlatformGatewayRouteConfigData(e)), _appPlatformGatewayRouteConfigGatewayRouteConfigsClientDiagnostics, Pipeline, "AppPlatformGatewayRouteConfigCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformGatewayRouteConfigResource(Client, AppPlatformGatewayRouteConfigData.DeserializeAppPlatformGatewayRouteConfigData(e)), _appPlatformGatewayRouteConfigGatewayRouteConfigsClientDiagnostics, Pipeline, "AppPlatformGatewayRouteConfigCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformGatewayRouteConfigGatewayRouteConfigsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformGatewayRouteConfigGatewayRouteConfigsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformGatewayRouteConfigResource(Client, AppPlatformGatewayRouteConfigData.DeserializeAppPlatformGatewayRouteConfigData(e)), _appPlatformGatewayRouteConfigGatewayRouteConfigsClientDiagnostics, Pipeline, "AppPlatformGatewayRouteConfigCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformGatewayRouteConfigResource(Client, AppPlatformGatewayRouteConfigData.DeserializeAppPlatformGatewayRouteConfigData(e)), _appPlatformGatewayRouteConfigGatewayRouteConfigsClientDiagnostics, Pipeline, "AppPlatformGatewayRouteConfigCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigData.cs index b84bd7eb4fc2..295a2e25b6e7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformGatewayRouteConfigData : ResourceData { - /// Initializes a new instance of AppPlatformGatewayRouteConfigData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayRouteConfigData() { } - /// Initializes a new instance of AppPlatformGatewayRouteConfigData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// API route config of the Spring Cloud Gateway. - internal AppPlatformGatewayRouteConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformGatewayRouteConfigProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayRouteConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformGatewayRouteConfigProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// API route config of the Spring Cloud Gateway. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingData.cs index 47d744944cf5..e361036a6bba 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformMonitoringSettingData : ResourceData { - /// Initializes a new instance of AppPlatformMonitoringSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformMonitoringSettingData() { } - /// Initializes a new instance of AppPlatformMonitoringSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the Monitoring Setting resource. - internal AppPlatformMonitoringSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformMonitoringSettingProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformMonitoringSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformMonitoringSettingProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the Monitoring Setting resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs index a3bdd3827663..512e237add00 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformServiceServicesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), _appPlatformServiceServicesClientDiagnostics, Pipeline, "AppPlatformServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), _appPlatformServiceServicesClientDiagnostics, Pipeline, "AppPlatformServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformServiceServicesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), _appPlatformServiceServicesClientDiagnostics, Pipeline, "AppPlatformServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), _appPlatformServiceServicesClientDiagnostics, Pipeline, "AppPlatformServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceData.cs index 01e509838a69..8276061add89 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformServiceData : TrackedResourceData { - /// Initializes a new instance of AppPlatformServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AppPlatformServiceData(AzureLocation location) : base(location) { } - /// Initializes a new instance of AppPlatformServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public AppPlatformServiceData(AzureLocation location) : base(location) /// The location. /// Properties of the Service resource. /// Sku of the Service resource. - internal AppPlatformServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AppPlatformServiceProperties properties, AppPlatformSku sku) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AppPlatformServiceProperties properties, AppPlatformSku sku, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppPlatformServiceData() + { } /// Properties of the Service resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs index f55c11e56027..edca676a189e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryCollection.cs @@ -224,7 +224,7 @@ public virtual AsyncPageable GetAllAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformServiceRegistryServiceRegistriesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformServiceRegistryServiceRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceRegistryResource(Client, AppPlatformServiceRegistryData.DeserializeAppPlatformServiceRegistryData(e)), _appPlatformServiceRegistryServiceRegistriesClientDiagnostics, Pipeline, "AppPlatformServiceRegistryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformServiceRegistryResource(Client, AppPlatformServiceRegistryData.DeserializeAppPlatformServiceRegistryData(e)), _appPlatformServiceRegistryServiceRegistriesClientDiagnostics, Pipeline, "AppPlatformServiceRegistryCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -246,7 +246,7 @@ public virtual Pageable GetAll(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformServiceRegistryServiceRegistriesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformServiceRegistryServiceRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceRegistryResource(Client, AppPlatformServiceRegistryData.DeserializeAppPlatformServiceRegistryData(e)), _appPlatformServiceRegistryServiceRegistriesClientDiagnostics, Pipeline, "AppPlatformServiceRegistryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformServiceRegistryResource(Client, AppPlatformServiceRegistryData.DeserializeAppPlatformServiceRegistryData(e)), _appPlatformServiceRegistryServiceRegistriesClientDiagnostics, Pipeline, "AppPlatformServiceRegistryCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryData.cs index 738dd3068751..43e402bc54cd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformServiceRegistryData : ResourceData { - /// Initializes a new instance of AppPlatformServiceRegistryData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformServiceRegistryData() { } - /// Initializes a new instance of AppPlatformServiceRegistryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Service Registry properties payload. - internal AppPlatformServiceRegistryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformServiceRegistryProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceRegistryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformServiceRegistryProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Service Registry properties payload. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs index d9a3afe487d4..281005c3bf44 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs @@ -1228,7 +1228,7 @@ public virtual AsyncPageable GetDeploymentsAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformDeploymentDeploymentsRestClient.CreateListForClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, version); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformDeploymentDeploymentsRestClient.CreateListForClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, version); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformServiceResource.GetDeployments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformServiceResource.GetDeployments", "value", "nextLink", cancellationToken); } /// @@ -1251,7 +1251,7 @@ public virtual Pageable GetDeployments(IEnumerabl { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformDeploymentDeploymentsRestClient.CreateListForClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, version); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformDeploymentDeploymentsRestClient.CreateListForClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, version); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformServiceResource.GetDeployments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformDeploymentResource(Client, AppPlatformDeploymentData.DeserializeAppPlatformDeploymentData(e)), _appPlatformDeploymentDeploymentsClientDiagnostics, Pipeline, "AppPlatformServiceResource.GetDeployments", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs index 11d1ed995cc7..5822ec32d003 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformStorageStoragesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformStorageStoragesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformStorageResource(Client, AppPlatformStorageData.DeserializeAppPlatformStorageData(e)), _appPlatformStorageStoragesClientDiagnostics, Pipeline, "AppPlatformStorageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformStorageResource(Client, AppPlatformStorageData.DeserializeAppPlatformStorageData(e)), _appPlatformStorageStoragesClientDiagnostics, Pipeline, "AppPlatformStorageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformStorageStoragesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _appPlatformStorageStoragesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformStorageResource(Client, AppPlatformStorageData.DeserializeAppPlatformStorageData(e)), _appPlatformStorageStoragesClientDiagnostics, Pipeline, "AppPlatformStorageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformStorageResource(Client, AppPlatformStorageData.DeserializeAppPlatformStorageData(e)), _appPlatformStorageStoragesClientDiagnostics, Pipeline, "AppPlatformStorageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageData.cs index 43df5ad0e381..e30b3afc7c30 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformStorageData : ResourceData { - /// Initializes a new instance of AppPlatformStorageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformStorageData() { } - /// Initializes a new instance of AppPlatformStorageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +37,11 @@ public AppPlatformStorageData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// - internal AppPlatformStorageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformStorageProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformStorageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformStorageProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs index c8e8192dfce2..e2d1cb0e0621 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string buildp public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformSupportedBuildpackBuildServiceRestClient.CreateListSupportedBuildpacksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AppPlatformSupportedBuildpackResource(Client, AppPlatformSupportedBuildpackData.DeserializeAppPlatformSupportedBuildpackData(e)), _appPlatformSupportedBuildpackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedBuildpackCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AppPlatformSupportedBuildpackResource(Client, AppPlatformSupportedBuildpackData.DeserializeAppPlatformSupportedBuildpackData(e)), _appPlatformSupportedBuildpackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedBuildpackCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync( public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformSupportedBuildpackBuildServiceRestClient.CreateListSupportedBuildpacksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AppPlatformSupportedBuildpackResource(Client, AppPlatformSupportedBuildpackData.DeserializeAppPlatformSupportedBuildpackData(e)), _appPlatformSupportedBuildpackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedBuildpackCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AppPlatformSupportedBuildpackResource(Client, AppPlatformSupportedBuildpackData.DeserializeAppPlatformSupportedBuildpackData(e)), _appPlatformSupportedBuildpackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedBuildpackCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackData.cs index dcd9a185ff4d..8d97186cdf13 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformSupportedBuildpackData : ResourceData { - /// Initializes a new instance of AppPlatformSupportedBuildpackData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformSupportedBuildpackData() { } - /// Initializes a new instance of AppPlatformSupportedBuildpackData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Supported buildpack resource properties. - internal AppPlatformSupportedBuildpackData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SupportedBuildpackResourceProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSupportedBuildpackData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SupportedBuildpackResourceProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Supported buildpack resource properties. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs index 3d926d4f08ed..0cc16b7bd3e3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string stackName, public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformSupportedStackBuildServiceRestClient.CreateListSupportedStacksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AppPlatformSupportedStackResource(Client, AppPlatformSupportedStackData.DeserializeAppPlatformSupportedStackData(e)), _appPlatformSupportedStackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedStackCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AppPlatformSupportedStackResource(Client, AppPlatformSupportedStackData.DeserializeAppPlatformSupportedStackData(e)), _appPlatformSupportedStackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedStackCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync(Canc public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _appPlatformSupportedStackBuildServiceRestClient.CreateListSupportedStacksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AppPlatformSupportedStackResource(Client, AppPlatformSupportedStackData.DeserializeAppPlatformSupportedStackData(e)), _appPlatformSupportedStackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedStackCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AppPlatformSupportedStackResource(Client, AppPlatformSupportedStackData.DeserializeAppPlatformSupportedStackData(e)), _appPlatformSupportedStackBuildServiceClientDiagnostics, Pipeline, "AppPlatformSupportedStackCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackData.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackData.cs index 3fbbc6c77d70..07aaf52aef08 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackData.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppPlatform /// public partial class AppPlatformSupportedStackData : ResourceData { - /// Initializes a new instance of AppPlatformSupportedStackData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformSupportedStackData() { } - /// Initializes a new instance of AppPlatformSupportedStackData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Supported stack resource properties. - internal AppPlatformSupportedStackData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformSupportedStackProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSupportedStackData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppPlatformSupportedStackProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Supported stack resource properties. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/ArmAppPlatformModelFactory.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/ArmAppPlatformModelFactory.cs index a91d674ac90b..e795e92fd4cf 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/ArmAppPlatformModelFactory.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/ArmAppPlatformModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Model factory for models. public static partial class ArmAppPlatformModelFactory { - /// Initializes a new instance of AppPlatformServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,10 +32,10 @@ public static AppPlatformServiceData AppPlatformServiceData(ResourceIdentifier i { tags ??= new Dictionary(); - return new AppPlatformServiceData(id, name, resourceType, systemData, tags, location, properties, sku); + return new AppPlatformServiceData(id, name, resourceType, systemData, tags, location, properties, sku, default); } - /// Initializes a new instance of AppPlatformServiceProperties. + /// Initializes a new instance of . /// Provisioning state of the Service. /// Network profile of the Service. /// Additional Service settings in vnet injection instance. @@ -47,10 +47,10 @@ public static AppPlatformServiceData AppPlatformServiceData(ResourceIdentifier i /// A new instance for mocking. public static AppPlatformServiceProperties AppPlatformServiceProperties(AppPlatformServiceProvisioningState? provisioningState = null, AppPlatformServiceNetworkProfile networkProfile = null, bool? isLogStreamPublicEndpoint = null, int? version = null, string serviceInstanceId = null, AppPlatformServicePowerState? powerState = null, bool? isZoneRedundant = null, string fqdn = null) { - return new AppPlatformServiceProperties(provisioningState, networkProfile, isLogStreamPublicEndpoint != null ? new ServiceVnetAddons(isLogStreamPublicEndpoint) : null, version, serviceInstanceId, powerState, isZoneRedundant, fqdn); + return new AppPlatformServiceProperties(provisioningState, networkProfile, isLogStreamPublicEndpoint != null ? new ServiceVnetAddons(isLogStreamPublicEndpoint, new Dictionary()) : null, version, serviceInstanceId, powerState, isZoneRedundant, fqdn, default); } - /// Initializes a new instance of AppPlatformServiceNetworkProfile. + /// Initializes a new instance of . /// Fully qualified resource Id of the subnet to host Azure Spring Apps Service Runtime. /// Fully qualified resource Id of the subnet to host customer apps in Azure Spring Apps. /// Azure Spring Apps service reserved CIDR. @@ -66,10 +66,10 @@ public static AppPlatformServiceNetworkProfile AppPlatformServiceNetworkProfile( outboundPublicIPs ??= new List(); requiredTraffics ??= new List(); - return new AppPlatformServiceNetworkProfile(serviceRuntimeSubnetId, appSubnetId, serviceCidr, serviceRuntimeNetworkResourceGroup, appNetworkResourceGroup, outboundPublicIPs != null ? new NetworkProfileOutboundIPs(outboundPublicIPs?.ToList()) : null, requiredTraffics?.ToList(), ingressConfigReadTimeoutInSeconds != null ? new IngressConfig(ingressConfigReadTimeoutInSeconds) : null, outboundType); + return new AppPlatformServiceNetworkProfile(serviceRuntimeSubnetId, appSubnetId, serviceCidr, serviceRuntimeNetworkResourceGroup, appNetworkResourceGroup, outboundPublicIPs != null ? new NetworkProfileOutboundIPs(outboundPublicIPs?.ToList(), new Dictionary()) : null, requiredTraffics?.ToList(), ingressConfigReadTimeoutInSeconds != null ? new IngressConfig(ingressConfigReadTimeoutInSeconds, new Dictionary()) : null, outboundType, default); } - /// Initializes a new instance of AppPlatformServiceRequiredTraffic. + /// Initializes a new instance of . /// The protocol of required traffic. /// The port of required traffic. /// The ip list of required traffic. @@ -81,10 +81,10 @@ public static AppPlatformServiceRequiredTraffic AppPlatformServiceRequiredTraffi ips ??= new List(); fqdns ??= new List(); - return new AppPlatformServiceRequiredTraffic(protocol, port, ips?.ToList(), fqdns?.ToList(), direction); + return new AppPlatformServiceRequiredTraffic(protocol, port, ips?.ToList(), fqdns?.ToList(), direction, default); } - /// Initializes a new instance of AppPlatformServiceTestKeys. + /// Initializes a new instance of . /// Primary key. /// Secondary key. /// Primary test endpoint. @@ -93,10 +93,10 @@ public static AppPlatformServiceRequiredTraffic AppPlatformServiceRequiredTraffi /// A new instance for mocking. public static AppPlatformServiceTestKeys AppPlatformServiceTestKeys(string primaryKey = null, string secondaryKey = null, string primaryTestEndpoint = null, string secondaryTestEndpoint = null, bool? isEnabled = null) { - return new AppPlatformServiceTestKeys(primaryKey, secondaryKey, primaryTestEndpoint, secondaryTestEndpoint, isEnabled); + return new AppPlatformServiceTestKeys(primaryKey, secondaryKey, primaryTestEndpoint, secondaryTestEndpoint, isEnabled, default); } - /// Initializes a new instance of AppPlatformConfigServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -105,20 +105,20 @@ public static AppPlatformServiceTestKeys AppPlatformServiceTestKeys(string prima /// A new instance for mocking. public static AppPlatformConfigServerData AppPlatformConfigServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformConfigServerProperties properties = null) { - return new AppPlatformConfigServerData(id, name, resourceType, systemData, properties); + return new AppPlatformConfigServerData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformConfigServerProperties. + /// Initializes a new instance of . /// State of the config server. /// Error when apply config server settings. /// Settings of config server. /// A new instance for mocking. public static AppPlatformConfigServerProperties AppPlatformConfigServerProperties(AppPlatformConfigServerState? provisioningState = null, AppPlatformErrorInfo error = null, AppPlatformConfigServerGitProperty configServerGitProperty = null) { - return new AppPlatformConfigServerProperties(provisioningState, error, configServerGitProperty != null ? new ConfigServerSettings(configServerGitProperty) : null); + return new AppPlatformConfigServerProperties(provisioningState, error, configServerGitProperty != null ? new ConfigServerSettings(configServerGitProperty, new Dictionary()) : null, default); } - /// Initializes a new instance of ConfigServerSettingsValidateResult. + /// Initializes a new instance of . /// Indicate if the config server settings are valid. /// The detail validation results. /// A new instance for mocking. @@ -126,10 +126,10 @@ public static ConfigServerSettingsValidateResult ConfigServerSettingsValidateRes { details ??= new List(); - return new ConfigServerSettingsValidateResult(isValid, details?.ToList()); + return new ConfigServerSettingsValidateResult(isValid, details?.ToList(), default); } - /// Initializes a new instance of ConfigServerSettingsErrorRecord. + /// Initializes a new instance of . /// The name of the config server settings error record. /// The uri of the config server settings error record. /// The detail error messages of the record. @@ -138,10 +138,10 @@ public static ConfigServerSettingsErrorRecord ConfigServerSettingsErrorRecord(st { messages ??= new List(); - return new ConfigServerSettingsErrorRecord(name, uri, messages?.ToList()); + return new ConfigServerSettingsErrorRecord(name, uri, messages?.ToList(), default); } - /// Initializes a new instance of AppPlatformConfigurationServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -150,10 +150,10 @@ public static ConfigServerSettingsErrorRecord ConfigServerSettingsErrorRecord(st /// A new instance for mocking. public static AppPlatformConfigurationServiceData AppPlatformConfigurationServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformConfigurationServiceProperties properties = null) { - return new AppPlatformConfigurationServiceData(id, name, resourceType, systemData, properties); + return new AppPlatformConfigurationServiceData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformConfigurationServiceProperties. + /// Initializes a new instance of . /// State of the Application Configuration Service. /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Application Configuration Service. @@ -164,37 +164,37 @@ public static AppPlatformConfigurationServiceProperties AppPlatformConfiguration instances ??= new List(); configurationServiceGitRepositories ??= new List(); - return new AppPlatformConfigurationServiceProperties(provisioningState, resourceRequests, instances?.ToList(), configurationServiceGitRepositories != null ? new AppPlatformConfigurationServiceSettings(new ConfigurationServiceGitProperty(configurationServiceGitRepositories?.ToList())) : null); + return new AppPlatformConfigurationServiceProperties(provisioningState, resourceRequests, instances?.ToList(), configurationServiceGitRepositories != null ? new AppPlatformConfigurationServiceSettings(new ConfigurationServiceGitProperty(configurationServiceGitRepositories?.ToList(), new Dictionary()), new Dictionary()) : null, default); } - /// Initializes a new instance of AppPlatformConfigurationServiceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Application Configuration Service instance. /// Memory allocated to each Application Configuration Service instance. /// Instance count of the Application Configuration Service. /// A new instance for mocking. public static AppPlatformConfigurationServiceRequirements AppPlatformConfigurationServiceRequirements(string cpu = null, string memory = null, int? instanceCount = null) { - return new AppPlatformConfigurationServiceRequirements(cpu, memory, instanceCount); + return new AppPlatformConfigurationServiceRequirements(cpu, memory, instanceCount, default); } - /// Initializes a new instance of AppPlatformConfigurationServiceInstance. + /// Initializes a new instance of . /// Name of the Application Configuration Service instance. /// Status of the Application Configuration Service instance. /// A new instance for mocking. public static AppPlatformConfigurationServiceInstance AppPlatformConfigurationServiceInstance(string name = null, string status = null) { - return new AppPlatformConfigurationServiceInstance(name, status); + return new AppPlatformConfigurationServiceInstance(name, status, default); } - /// Initializes a new instance of AppPlatformConfigurationServiceSettingsValidateResult. + /// Initializes a new instance of . /// Validation result for configuration service settings. /// A new instance for mocking. public static AppPlatformConfigurationServiceSettingsValidateResult AppPlatformConfigurationServiceSettingsValidateResult(AppPlatformConfigurationServiceGitValidateResult gitPropertyValidationResult = null) { - return new AppPlatformConfigurationServiceSettingsValidateResult(gitPropertyValidationResult); + return new AppPlatformConfigurationServiceSettingsValidateResult(gitPropertyValidationResult, default); } - /// Initializes a new instance of AppPlatformConfigurationServiceGitValidateResult. + /// Initializes a new instance of . /// Indicate if the configuration service settings are valid. /// The detail validation results. /// A new instance for mocking. @@ -202,10 +202,10 @@ public static AppPlatformConfigurationServiceGitValidateResult AppPlatformConfig { gitReposValidationResult ??= new List(); - return new AppPlatformConfigurationServiceGitValidateResult(isValid, gitReposValidationResult?.ToList()); + return new AppPlatformConfigurationServiceGitValidateResult(isValid, gitReposValidationResult?.ToList(), default); } - /// Initializes a new instance of AppPlatformConfigurationServiceGitReposValidationMessages. + /// Initializes a new instance of . /// The name of the configuration service git repository. /// Detailed validation messages. /// A new instance for mocking. @@ -213,10 +213,10 @@ public static AppPlatformConfigurationServiceGitReposValidationMessages AppPlatf { messages ??= new List(); - return new AppPlatformConfigurationServiceGitReposValidationMessages(name, messages?.ToList()); + return new AppPlatformConfigurationServiceGitReposValidationMessages(name, messages?.ToList(), default); } - /// Initializes a new instance of AppPlatformServiceRegistryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -225,10 +225,10 @@ public static AppPlatformConfigurationServiceGitReposValidationMessages AppPlatf /// A new instance for mocking. public static AppPlatformServiceRegistryData AppPlatformServiceRegistryData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformServiceRegistryProperties properties = null) { - return new AppPlatformServiceRegistryData(id, name, resourceType, systemData, properties); + return new AppPlatformServiceRegistryData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformServiceRegistryProperties. + /// Initializes a new instance of . /// State of the Service Registry. /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Service Registry. @@ -237,29 +237,29 @@ public static AppPlatformServiceRegistryProperties AppPlatformServiceRegistryPro { instances ??= new List(); - return new AppPlatformServiceRegistryProperties(provisioningState, resourceRequests, instances?.ToList()); + return new AppPlatformServiceRegistryProperties(provisioningState, resourceRequests, instances?.ToList(), default); } - /// Initializes a new instance of AppPlatformServiceRegistryResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Service Registry instance. /// Memory allocated to each Service Registry instance. /// Instance count of the Service Registry. /// A new instance for mocking. public static AppPlatformServiceRegistryResourceRequirements AppPlatformServiceRegistryResourceRequirements(string cpu = null, string memory = null, int? instanceCount = null) { - return new AppPlatformServiceRegistryResourceRequirements(cpu, memory, instanceCount); + return new AppPlatformServiceRegistryResourceRequirements(cpu, memory, instanceCount, default); } - /// Initializes a new instance of AppPlatformServiceRegistryInstance. + /// Initializes a new instance of . /// Name of the Service Registry instance. /// Status of the Service Registry instance. /// A new instance for mocking. public static AppPlatformServiceRegistryInstance AppPlatformServiceRegistryInstance(string name = null, string status = null) { - return new AppPlatformServiceRegistryInstance(name, status); + return new AppPlatformServiceRegistryInstance(name, status, default); } - /// Initializes a new instance of AppPlatformBuildServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -268,29 +268,29 @@ public static AppPlatformServiceRegistryInstance AppPlatformServiceRegistryInsta /// A new instance for mocking. public static AppPlatformBuildServiceData AppPlatformBuildServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBuildServiceProperties properties = null) { - return new AppPlatformBuildServiceData(id, name, resourceType, systemData, properties); + return new AppPlatformBuildServiceData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuildServiceProperties. + /// Initializes a new instance of . /// The installed KPack version in this build service. /// Provisioning state of the KPack build result. /// The runtime resource configuration of this build service. /// A new instance for mocking. public static AppPlatformBuildServiceProperties AppPlatformBuildServiceProperties(string kPackVersion = null, AppPlatformBuildServiceProvisioningState? provisioningState = null, AppPlatformBuildServiceResourceRequirements resourceRequests = null) { - return new AppPlatformBuildServiceProperties(kPackVersion, provisioningState, resourceRequests); + return new AppPlatformBuildServiceProperties(kPackVersion, provisioningState, resourceRequests, default); } - /// Initializes a new instance of AppPlatformBuildServiceResourceRequirements. + /// Initializes a new instance of . /// vCPU allocated to the entire build service node pool. /// Memory allocated to the entire build service node pool. /// A new instance for mocking. public static AppPlatformBuildServiceResourceRequirements AppPlatformBuildServiceResourceRequirements(string cpu = null, string memory = null) { - return new AppPlatformBuildServiceResourceRequirements(cpu, memory); + return new AppPlatformBuildServiceResourceRequirements(cpu, memory, default); } - /// Initializes a new instance of AppPlatformBuildData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -299,10 +299,10 @@ public static AppPlatformBuildServiceResourceRequirements AppPlatformBuildServic /// A new instance for mocking. public static AppPlatformBuildData AppPlatformBuildData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBuildProperties properties = null) { - return new AppPlatformBuildData(id, name, resourceType, systemData, properties); + return new AppPlatformBuildData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuildProperties. + /// Initializes a new instance of . /// The relative path of source code. /// The resource id of builder to build the source code. /// The resource id of agent pool. @@ -315,10 +315,10 @@ public static AppPlatformBuildProperties AppPlatformBuildProperties(string relat { env ??= new Dictionary(); - return new AppPlatformBuildProperties(relativePath, builder, agentPool, provisioningState, env, triggeredBuildResultId != null ? ResourceManagerModelFactory.SubResource(triggeredBuildResultId) : null, resourceRequests); + return new AppPlatformBuildProperties(relativePath, builder, agentPool, provisioningState, env, triggeredBuildResultId != null ? ResourceManagerModelFactory.SubResource(triggeredBuildResultId) : null, resourceRequests, default); } - /// Initializes a new instance of AppPlatformBuildpackBindingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -327,20 +327,20 @@ public static AppPlatformBuildProperties AppPlatformBuildProperties(string relat /// A new instance for mocking. public static AppPlatformBuildpackBindingData AppPlatformBuildpackBindingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBuildpackBindingProperties properties = null) { - return new AppPlatformBuildpackBindingData(id, name, resourceType, systemData, properties); + return new AppPlatformBuildpackBindingData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuildpackBindingProperties. + /// Initializes a new instance of . /// Buildpack Binding Type. /// State of the Buildpack Binding. /// The object describes the buildpack binding launch properties. /// A new instance for mocking. public static AppPlatformBuildpackBindingProperties AppPlatformBuildpackBindingProperties(BuildpackBindingType? bindingType = null, BuildpackBindingProvisioningState? provisioningState = null, BuildpackBindingLaunchProperties launchProperties = null) { - return new AppPlatformBuildpackBindingProperties(bindingType, provisioningState, launchProperties); + return new AppPlatformBuildpackBindingProperties(bindingType, provisioningState, launchProperties, default); } - /// Initializes a new instance of AppPlatformBuildResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -349,10 +349,10 @@ public static AppPlatformBuildpackBindingProperties AppPlatformBuildpackBindingP /// A new instance for mocking. public static AppPlatformBuildResultData AppPlatformBuildResultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBuildResultProperties properties = null) { - return new AppPlatformBuildResultData(id, name, resourceType, systemData, properties); + return new AppPlatformBuildResultData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuildResultProperties. + /// Initializes a new instance of . /// The name of this build result. /// Provisioning state of the KPack build result. /// The build pod name which can be used to get the build log streaming. @@ -362,27 +362,27 @@ public static AppPlatformBuildResultProperties AppPlatformBuildResultProperties( { buildStages ??= new List(); - return new AppPlatformBuildResultProperties(name, provisioningState, buildPodName, buildStages?.ToList()); + return new AppPlatformBuildResultProperties(name, provisioningState, buildPodName, buildStages?.ToList(), default); } - /// Initializes a new instance of AppPlatformBuildStageProperties. + /// Initializes a new instance of . /// The name of this build stage resource. /// The provisioning state of this build stage resource. /// A new instance for mocking. public static AppPlatformBuildStageProperties AppPlatformBuildStageProperties(string name = null, KPackBuildStageProvisioningState? status = null) { - return new AppPlatformBuildStageProperties(name, status); + return new AppPlatformBuildStageProperties(name, status, default); } - /// Initializes a new instance of AppPlatformBuildResultLog. + /// Initializes a new instance of . /// The public download URL of this build result log. /// A new instance for mocking. public static AppPlatformBuildResultLog AppPlatformBuildResultLog(Uri blobUri = null) { - return new AppPlatformBuildResultLog(blobUri); + return new AppPlatformBuildResultLog(blobUri, default); } - /// Initializes a new instance of AppPlatformBuilderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -391,10 +391,10 @@ public static AppPlatformBuildResultLog AppPlatformBuildResultLog(Uri blobUri = /// A new instance for mocking. public static AppPlatformBuilderData AppPlatformBuilderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBuilderProperties properties = null) { - return new AppPlatformBuilderData(id, name, resourceType, systemData, properties); + return new AppPlatformBuilderData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuilderProperties. + /// Initializes a new instance of . /// Builder provision status. /// Builder cluster stack property. /// Builder buildpack groups. @@ -403,19 +403,19 @@ public static AppPlatformBuilderProperties AppPlatformBuilderProperties(AppPlatf { buildpackGroups ??= new List(); - return new AppPlatformBuilderProperties(provisioningState, stack, buildpackGroups?.ToList()); + return new AppPlatformBuilderProperties(provisioningState, stack, buildpackGroups?.ToList(), default); } - /// Initializes a new instance of AppPlatformResourceUploadResult. + /// Initializes a new instance of . /// Source relative path. /// Upload URL. /// A new instance for mocking. public static AppPlatformResourceUploadResult AppPlatformResourceUploadResult(string relativePath = null, Uri uploadUri = null) { - return new AppPlatformResourceUploadResult(relativePath, uploadUri); + return new AppPlatformResourceUploadResult(relativePath, uploadUri, default); } - /// Initializes a new instance of AppPlatformSupportedBuildpackData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -424,10 +424,10 @@ public static AppPlatformResourceUploadResult AppPlatformResourceUploadResult(st /// A new instance for mocking. public static AppPlatformSupportedBuildpackData AppPlatformSupportedBuildpackData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string supportedBuildpackId = null) { - return new AppPlatformSupportedBuildpackData(id, name, resourceType, systemData, supportedBuildpackId != null ? new SupportedBuildpackResourceProperties(supportedBuildpackId) : null); + return new AppPlatformSupportedBuildpackData(id, name, resourceType, systemData, supportedBuildpackId != null ? new SupportedBuildpackResourceProperties(supportedBuildpackId, new Dictionary()) : null, default); } - /// Initializes a new instance of AppPlatformSupportedStackData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -436,10 +436,10 @@ public static AppPlatformSupportedBuildpackData AppPlatformSupportedBuildpackDat /// A new instance for mocking. public static AppPlatformSupportedStackData AppPlatformSupportedStackData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformSupportedStackProperties properties = null) { - return new AppPlatformSupportedStackData(id, name, resourceType, systemData, properties); + return new AppPlatformSupportedStackData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuildServiceAgentPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -448,29 +448,29 @@ public static AppPlatformSupportedStackData AppPlatformSupportedStackData(Resour /// A new instance for mocking. public static AppPlatformBuildServiceAgentPoolData AppPlatformBuildServiceAgentPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBuildServiceAgentPoolProperties properties = null) { - return new AppPlatformBuildServiceAgentPoolData(id, name, resourceType, systemData, properties); + return new AppPlatformBuildServiceAgentPoolData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBuildServiceAgentPoolProperties. + /// Initializes a new instance of . /// Provisioning state of the build service agent pool. /// build service agent pool size properties. /// A new instance for mocking. public static AppPlatformBuildServiceAgentPoolProperties AppPlatformBuildServiceAgentPoolProperties(string provisioningState = null, BuildServiceAgentPoolSizeProperties poolSize = null) { - return new AppPlatformBuildServiceAgentPoolProperties(provisioningState, poolSize); + return new AppPlatformBuildServiceAgentPoolProperties(provisioningState, poolSize, default); } - /// Initializes a new instance of BuildServiceAgentPoolSizeProperties. + /// Initializes a new instance of . /// The name of build service agent pool size. /// The cpu property of build service agent pool size. /// The memory property of build service agent pool size. /// A new instance for mocking. public static BuildServiceAgentPoolSizeProperties BuildServiceAgentPoolSizeProperties(string name = null, string cpu = null, string memory = null) { - return new BuildServiceAgentPoolSizeProperties(name, cpu, memory); + return new BuildServiceAgentPoolSizeProperties(name, cpu, memory, default); } - /// Initializes a new instance of AppPlatformMonitoringSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -479,10 +479,10 @@ public static BuildServiceAgentPoolSizeProperties BuildServiceAgentPoolSizePrope /// A new instance for mocking. public static AppPlatformMonitoringSettingData AppPlatformMonitoringSettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformMonitoringSettingProperties properties = null) { - return new AppPlatformMonitoringSettingData(id, name, resourceType, systemData, properties); + return new AppPlatformMonitoringSettingData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformMonitoringSettingProperties. + /// Initializes a new instance of . /// State of the Monitoring Setting. /// Error when apply Monitoring Setting changes. /// Indicates whether enable the trace functionality, which will be deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate if monitoringSettings enabled or not. @@ -492,10 +492,10 @@ public static AppPlatformMonitoringSettingData AppPlatformMonitoringSettingData( /// A new instance for mocking. public static AppPlatformMonitoringSettingProperties AppPlatformMonitoringSettingProperties(AppPlatformMonitoringSettingState? provisioningState = null, AppPlatformErrorInfo error = null, bool? isTraceEnabled = null, string appInsightsInstrumentationKey = null, double? appInsightsSamplingRate = null, string appInsightsJavaAgentVersion = null) { - return new AppPlatformMonitoringSettingProperties(provisioningState, error, isTraceEnabled, appInsightsInstrumentationKey, appInsightsSamplingRate, appInsightsJavaAgentVersion != null ? new ApplicationInsightsAgentVersions(appInsightsJavaAgentVersion) : null); + return new AppPlatformMonitoringSettingProperties(provisioningState, error, isTraceEnabled, appInsightsInstrumentationKey, appInsightsSamplingRate, appInsightsJavaAgentVersion != null ? new ApplicationInsightsAgentVersions(appInsightsJavaAgentVersion, new Dictionary()) : null, default); } - /// Initializes a new instance of AppPlatformAppData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -506,10 +506,10 @@ public static AppPlatformMonitoringSettingProperties AppPlatformMonitoringSettin /// A new instance for mocking. public static AppPlatformAppData AppPlatformAppData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformAppProperties properties = null, ManagedServiceIdentity identity = null, AzureLocation? location = null) { - return new AppPlatformAppData(id, name, resourceType, systemData, properties, identity, location); + return new AppPlatformAppData(id, name, resourceType, systemData, properties, identity, location, default); } - /// Initializes a new instance of AppPlatformAppProperties. + /// Initializes a new instance of . /// Indicates whether the App exposes public endpoint. /// URL of the App. /// Collection of addons. @@ -530,29 +530,29 @@ public static AppPlatformAppProperties AppPlatformAppProperties(bool? isPublic = customPersistentDisks ??= new List(); loadedCertificates ??= new List(); - return new AppPlatformAppProperties(isPublic, uriString, addonConfigs, provisioningState, fqdn, isHttpsOnly, temporaryDisk, persistentDisk, customPersistentDisks?.ToList(), isEndToEndTlsEnabled, loadedCertificates?.ToList(), vnetAddons, ingressSettings); + return new AppPlatformAppProperties(isPublic, uriString, addonConfigs, provisioningState, fqdn, isHttpsOnly, temporaryDisk, persistentDisk, customPersistentDisks?.ToList(), isEndToEndTlsEnabled, loadedCertificates?.ToList(), vnetAddons, ingressSettings, default); } - /// Initializes a new instance of AppPersistentDisk. + /// Initializes a new instance of . /// Size of the persistent disk in GB. /// Size of the used persistent disk in GB. /// Mount path of the persistent disk. /// A new instance for mocking. public static AppPersistentDisk AppPersistentDisk(int? sizeInGB = null, int? usedInGB = null, string mountPath = null) { - return new AppPersistentDisk(sizeInGB, usedInGB, mountPath); + return new AppPersistentDisk(sizeInGB, usedInGB, mountPath, default); } - /// Initializes a new instance of AppVnetAddons. + /// Initializes a new instance of . /// Indicates whether the App in vnet injection instance exposes endpoint which could be accessed from internet. /// URL of the App in vnet injection instance which could be accessed from internet. /// A new instance for mocking. public static AppVnetAddons AppVnetAddons(bool? isPublicEndpoint = null, Uri publicEndpointUri = null) { - return new AppVnetAddons(isPublicEndpoint, publicEndpointUri); + return new AppVnetAddons(isPublicEndpoint, publicEndpointUri, default); } - /// Initializes a new instance of AppPlatformBindingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -561,10 +561,10 @@ public static AppVnetAddons AppVnetAddons(bool? isPublicEndpoint = null, Uri pub /// A new instance for mocking. public static AppPlatformBindingData AppPlatformBindingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformBindingProperties properties = null) { - return new AppPlatformBindingData(id, name, resourceType, systemData, properties); + return new AppPlatformBindingData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformBindingProperties. + /// Initializes a new instance of . /// The name of the bound resource. /// The standard Azure resource type of the bound resource. /// The Azure resource id of the bound resource. @@ -578,10 +578,10 @@ public static AppPlatformBindingProperties AppPlatformBindingProperties(string r { bindingParameters ??= new Dictionary(); - return new AppPlatformBindingProperties(resourceName, resourceType, resourceId, key, bindingParameters, generatedProperties, createdOn, updatedOn); + return new AppPlatformBindingProperties(resourceName, resourceType, resourceId, key, bindingParameters, generatedProperties, createdOn, updatedOn, default); } - /// Initializes a new instance of AppPlatformStorageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -594,10 +594,10 @@ public static AppPlatformBindingProperties AppPlatformBindingProperties(string r /// A new instance for mocking. public static AppPlatformStorageData AppPlatformStorageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformStorageProperties properties = null) { - return new AppPlatformStorageData(id, name, resourceType, systemData, properties); + return new AppPlatformStorageData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -610,10 +610,10 @@ public static AppPlatformStorageData AppPlatformStorageData(ResourceIdentifier i /// A new instance for mocking. public static AppPlatformCertificateData AppPlatformCertificateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformCertificateProperties properties = null) { - return new AppPlatformCertificateData(id, name, resourceType, systemData, properties); + return new AppPlatformCertificateData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformCertificateProperties. + /// Initializes a new instance of . /// The type of the certificate source. /// The thumbprint of certificate. /// The issuer of certificate. @@ -628,20 +628,20 @@ public static AppPlatformCertificateProperties AppPlatformCertificateProperties( { dnsNames ??= new List(); - return new UnknownCertificateProperties(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames?.ToList(), provisioningState); + return new UnknownCertificateProperties(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames?.ToList(), provisioningState, default); } - /// Initializes a new instance of AppPlatformNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates whether the name is available. /// Reason why the name is not available. /// Message why the name is not available. /// A new instance for mocking. public static AppPlatformNameAvailabilityResult AppPlatformNameAvailabilityResult(bool? isNameAvailable = null, string reason = null, string message = null) { - return new AppPlatformNameAvailabilityResult(isNameAvailable, reason, message); + return new AppPlatformNameAvailabilityResult(isNameAvailable, reason, message, default); } - /// Initializes a new instance of AppPlatformCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -650,10 +650,10 @@ public static AppPlatformNameAvailabilityResult AppPlatformNameAvailabilityResul /// A new instance for mocking. public static AppPlatformCustomDomainData AppPlatformCustomDomainData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformCustomDomainProperties properties = null) { - return new AppPlatformCustomDomainData(id, name, resourceType, systemData, properties); + return new AppPlatformCustomDomainData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformCustomDomainProperties. + /// Initializes a new instance of . /// The thumbprint of bound certificate. /// The app name of domain. /// The bound certificate name of domain. @@ -661,19 +661,19 @@ public static AppPlatformCustomDomainData AppPlatformCustomDomainData(ResourceId /// A new instance for mocking. public static AppPlatformCustomDomainProperties AppPlatformCustomDomainProperties(string thumbprint = null, string appName = null, string certName = null, AppPlatformCustomDomainProvisioningState? provisioningState = null) { - return new AppPlatformCustomDomainProperties(thumbprint, appName, certName, provisioningState); + return new AppPlatformCustomDomainProperties(thumbprint, appName, certName, provisioningState, default); } - /// Initializes a new instance of AppPlatformCustomDomainValidateResult. + /// Initializes a new instance of . /// Indicates if domain name is valid. /// Message of why domain name is invalid. /// A new instance for mocking. public static AppPlatformCustomDomainValidateResult AppPlatformCustomDomainValidateResult(bool? isValid = null, string message = null) { - return new AppPlatformCustomDomainValidateResult(isValid, message); + return new AppPlatformCustomDomainValidateResult(isValid, message, default); } - /// Initializes a new instance of AppPlatformDeploymentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -683,10 +683,10 @@ public static AppPlatformCustomDomainValidateResult AppPlatformCustomDomainValid /// A new instance for mocking. public static AppPlatformDeploymentData AppPlatformDeploymentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformDeploymentProperties properties = null, AppPlatformSku sku = null) { - return new AppPlatformDeploymentData(id, name, resourceType, systemData, properties, sku); + return new AppPlatformDeploymentData(id, name, resourceType, systemData, properties, sku, default); } - /// Initializes a new instance of AppPlatformDeploymentProperties. + /// Initializes a new instance of . /// /// Uploaded source information of the deployment. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -702,10 +702,10 @@ public static AppPlatformDeploymentProperties AppPlatformDeploymentProperties(Ap { instances ??= new List(); - return new AppPlatformDeploymentProperties(source, deploymentSettings, provisioningState, status, isActive, instances?.ToList()); + return new AppPlatformDeploymentProperties(source, deploymentSettings, provisioningState, status, isActive, instances?.ToList(), default); } - /// Initializes a new instance of AppPlatformDeploymentInstance. + /// Initializes a new instance of . /// Name of the deployment instance. /// Status of the deployment instance. /// Failed reason of the deployment instance. @@ -715,43 +715,37 @@ public static AppPlatformDeploymentProperties AppPlatformDeploymentProperties(Ap /// A new instance for mocking. public static AppPlatformDeploymentInstance AppPlatformDeploymentInstance(string name = null, string status = null, string reason = null, string discoveryStatus = null, DateTimeOffset? startedOn = null, string zone = null) { - return new AppPlatformDeploymentInstance(name, status, reason, discoveryStatus, startedOn, zone); + return new AppPlatformDeploymentInstance(name, status, reason, discoveryStatus, startedOn, zone, default); } - /// Initializes a new instance of ApplicationRemoteDebuggingConfig. + /// Initializes a new instance of . /// Application debugging port. /// Indicate if remote debugging is enabled. /// A new instance for mocking. public static ApplicationRemoteDebuggingConfig ApplicationRemoteDebuggingConfig(int? port = null, bool? isEnabled = null) { - return new ApplicationRemoteDebuggingConfig(port, isEnabled); + return new ApplicationRemoteDebuggingConfig(port, isEnabled, default); } - /// Initializes a new instance of AppPlatformLogFileUriResult. + /// Initializes a new instance of . /// URL of the log file. - /// is null. /// A new instance for mocking. public static AppPlatformLogFileUriResult AppPlatformLogFileUriResult(Uri uri = null) { - if (uri == null) - { - throw new ArgumentNullException(nameof(uri)); - } - - return new AppPlatformLogFileUriResult(uri); + return new AppPlatformLogFileUriResult(uri, default); } - /// Initializes a new instance of AppPlatformSupportedRuntimeVersion. + /// Initializes a new instance of . /// The raw value which could be passed to deployment CRUD operations. /// The platform of this runtime version (possible values: "Java" or ".NET"). /// The detailed version (major.minor) of the platform. /// A new instance for mocking. public static AppPlatformSupportedRuntimeVersion AppPlatformSupportedRuntimeVersion(AppPlatformSupportedRuntimeValue? value = null, AppPlatformSupportedRuntimePlatform? platform = null, string version = null) { - return new AppPlatformSupportedRuntimeVersion(value, platform, version); + return new AppPlatformSupportedRuntimeVersion(value, platform, version, default); } - /// Initializes a new instance of AvailableAppPlatformSku. + /// Initializes a new instance of . /// Gets the type of resource the SKU applies to. /// Gets the name of SKU. /// Gets the tier of SKU. @@ -769,10 +763,10 @@ public static AvailableAppPlatformSku AvailableAppPlatformSku(ResourceType? reso locationInfo ??= new List(); restrictions ??= new List(); - return new AvailableAppPlatformSku(resourceType, name, tier, capacity, locations?.ToList(), locationInfo?.ToList(), restrictions?.ToList()); + return new AvailableAppPlatformSku(resourceType, name, tier, capacity, locations?.ToList(), locationInfo?.ToList(), restrictions?.ToList(), default); } - /// Initializes a new instance of AppPlatformSkuCapacity. + /// Initializes a new instance of . /// Gets or sets the minimum. /// Gets or sets the maximum. /// Gets or sets the default. @@ -780,10 +774,10 @@ public static AvailableAppPlatformSku AvailableAppPlatformSku(ResourceType? reso /// A new instance for mocking. public static AppPlatformSkuCapacity AppPlatformSkuCapacity(int minimum = default, int? maximum = null, int? @default = null, AppPlatformSkuScaleType? scaleType = null) { - return new AppPlatformSkuCapacity(minimum, maximum, @default, scaleType); + return new AppPlatformSkuCapacity(minimum, maximum, @default, scaleType, default); } - /// Initializes a new instance of AppPlatformSkuLocationInfo. + /// Initializes a new instance of . /// Gets location of the SKU. /// Gets list of availability zones where the SKU is supported. /// Gets details of capabilities available to a SKU in specific zones. @@ -793,10 +787,10 @@ public static AppPlatformSkuLocationInfo AppPlatformSkuLocationInfo(AzureLocatio zones ??= new List(); zoneDetails ??= new List(); - return new AppPlatformSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList()); + return new AppPlatformSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList(), default); } - /// Initializes a new instance of AppPlatformSkuZoneDetails. + /// Initializes a new instance of . /// /// Gets the set of zones that the SKU is available in with the /// specified capabilities. @@ -811,19 +805,19 @@ public static AppPlatformSkuZoneDetails AppPlatformSkuZoneDetails(IEnumerable(); capabilities ??= new List(); - return new AppPlatformSkuZoneDetails(name?.ToList(), capabilities?.ToList()); + return new AppPlatformSkuZoneDetails(name?.ToList(), capabilities?.ToList(), default); } - /// Initializes a new instance of AppPlatformSkuCapabilities. + /// Initializes a new instance of . /// Gets an invariant to describe the feature. /// Gets an invariant if the feature is measured by quantity. /// A new instance for mocking. public static AppPlatformSkuCapabilities AppPlatformSkuCapabilities(string name = null, string value = null) { - return new AppPlatformSkuCapabilities(name, value); + return new AppPlatformSkuCapabilities(name, value, default); } - /// Initializes a new instance of AppPlatformSkuRestrictions. + /// Initializes a new instance of . /// Gets the type of restrictions. Possible values include: 'Location', 'Zone'. /// /// Gets the value of restrictions. If the restriction type is set to @@ -836,10 +830,10 @@ public static AppPlatformSkuRestrictions AppPlatformSkuRestrictions(AppPlatformS { values ??= new List(); - return new AppPlatformSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode); + return new AppPlatformSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode, default); } - /// Initializes a new instance of AppPlatformSkuRestrictionInfo. + /// Initializes a new instance of . /// Gets locations where the SKU is restricted. /// Gets list of availability zones where the SKU is restricted. /// A new instance for mocking. @@ -848,10 +842,10 @@ public static AppPlatformSkuRestrictionInfo AppPlatformSkuRestrictionInfo(IEnume locations ??= new List(); zones ??= new List(); - return new AppPlatformSkuRestrictionInfo(locations?.ToList(), zones?.ToList()); + return new AppPlatformSkuRestrictionInfo(locations?.ToList(), zones?.ToList(), default); } - /// Initializes a new instance of AppPlatformGatewayData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -861,10 +855,10 @@ public static AppPlatformSkuRestrictionInfo AppPlatformSkuRestrictionInfo(IEnume /// A new instance for mocking. public static AppPlatformGatewayData AppPlatformGatewayData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformGatewayProperties properties = null, AppPlatformSku sku = null) { - return new AppPlatformGatewayData(id, name, resourceType, systemData, properties, sku); + return new AppPlatformGatewayData(id, name, resourceType, systemData, properties, sku, default); } - /// Initializes a new instance of AppPlatformGatewayProperties. + /// Initializes a new instance of . /// State of the Spring Cloud Gateway. /// Indicates whether the Spring Cloud Gateway exposes endpoint. /// URL of the Spring Cloud Gateway, exposed when 'public' is true. @@ -880,19 +874,19 @@ public static AppPlatformGatewayProperties AppPlatformGatewayProperties(AppPlatf { instances ??= new List(); - return new AppPlatformGatewayProperties(provisioningState, isPublic, uri, isHttpsOnly, ssoProperties, apiMetadataProperties, corsProperties, resourceRequests, instances?.ToList(), operatorProperties); + return new AppPlatformGatewayProperties(provisioningState, isPublic, uri, isHttpsOnly, ssoProperties, apiMetadataProperties, corsProperties, resourceRequests, instances?.ToList(), operatorProperties, default); } - /// Initializes a new instance of AppPlatformGatewayInstance. + /// Initializes a new instance of . /// Name of the Spring Cloud Gateway instance. /// Status of the Spring Cloud Gateway instance. /// A new instance for mocking. public static AppPlatformGatewayInstance AppPlatformGatewayInstance(string name = null, string status = null) { - return new AppPlatformGatewayInstance(name, status); + return new AppPlatformGatewayInstance(name, status, default); } - /// Initializes a new instance of AppPlatformGatewayOperatorProperties. + /// Initializes a new instance of . /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Spring Cloud Gateway operator. /// A new instance for mocking. @@ -900,20 +894,20 @@ public static AppPlatformGatewayOperatorProperties AppPlatformGatewayOperatorPro { instances ??= new List(); - return new AppPlatformGatewayOperatorProperties(resourceRequests, instances?.ToList()); + return new AppPlatformGatewayOperatorProperties(resourceRequests, instances?.ToList(), default); } - /// Initializes a new instance of AppPlatformGatewayOperatorResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Spring Cloud Gateway Operator instance. /// Memory allocated to each Spring Cloud Gateway Operator instance. /// Instance count of the Spring Cloud Gateway Operator. /// A new instance for mocking. public static AppPlatformGatewayOperatorResourceRequirements AppPlatformGatewayOperatorResourceRequirements(string cpu = null, string memory = null, int? instanceCount = null) { - return new AppPlatformGatewayOperatorResourceRequirements(cpu, memory, instanceCount); + return new AppPlatformGatewayOperatorResourceRequirements(cpu, memory, instanceCount, default); } - /// Initializes a new instance of AppPlatformGatewayRouteConfigData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -922,10 +916,10 @@ public static AppPlatformGatewayOperatorResourceRequirements AppPlatformGatewayO /// A new instance for mocking. public static AppPlatformGatewayRouteConfigData AppPlatformGatewayRouteConfigData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformGatewayRouteConfigProperties properties = null) { - return new AppPlatformGatewayRouteConfigData(id, name, resourceType, systemData, properties); + return new AppPlatformGatewayRouteConfigData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AppPlatformGatewayRouteConfigProperties. + /// Initializes a new instance of . /// State of the Spring Cloud Gateway route config. /// The resource Id of the Azure Spring Apps app, required unless route defines `uri`. /// OpenAPI properties of Spring Cloud Gateway route config. @@ -936,10 +930,10 @@ public static AppPlatformGatewayRouteConfigProperties AppPlatformGatewayRouteCon { routes ??= new List(); - return new AppPlatformGatewayRouteConfigProperties(provisioningState, appResourceId, openApiUri != null ? new GatewayRouteConfigOpenApiProperties(openApiUri) : null, protocol, routes?.ToList()); + return new AppPlatformGatewayRouteConfigProperties(provisioningState, appResourceId, openApiUri != null ? new GatewayRouteConfigOpenApiProperties(openApiUri, new Dictionary()) : null, protocol, routes?.ToList(), default); } - /// Initializes a new instance of AppPlatformGatewayCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -948,10 +942,10 @@ public static AppPlatformGatewayRouteConfigProperties AppPlatformGatewayRouteCon /// A new instance for mocking. public static AppPlatformGatewayCustomDomainData AppPlatformGatewayCustomDomainData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string gatewayCustomDomainThumbprint = null) { - return new AppPlatformGatewayCustomDomainData(id, name, resourceType, systemData, gatewayCustomDomainThumbprint != null ? new GatewayCustomDomainProperties(gatewayCustomDomainThumbprint) : null); + return new AppPlatformGatewayCustomDomainData(id, name, resourceType, systemData, gatewayCustomDomainThumbprint != null ? new GatewayCustomDomainProperties(gatewayCustomDomainThumbprint, new Dictionary()) : null, default); } - /// Initializes a new instance of AppPlatformApiPortalData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -961,10 +955,10 @@ public static AppPlatformGatewayCustomDomainData AppPlatformGatewayCustomDomainD /// A new instance for mocking. public static AppPlatformApiPortalData AppPlatformApiPortalData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppPlatformApiPortalProperties properties = null, AppPlatformSku sku = null) { - return new AppPlatformApiPortalData(id, name, resourceType, systemData, properties, sku); + return new AppPlatformApiPortalData(id, name, resourceType, systemData, properties, sku, default); } - /// Initializes a new instance of AppPlatformApiPortalProperties. + /// Initializes a new instance of . /// State of the API portal. /// Indicates whether the API portal exposes endpoint. /// URL of the API portal, exposed when 'public' is true. @@ -981,28 +975,28 @@ public static AppPlatformApiPortalProperties AppPlatformApiPortalProperties(AppP sourceUris ??= new List(); instances ??= new List(); - return new AppPlatformApiPortalProperties(provisioningState, isPublic, uri, isHttpsOnly, gatewayIds?.ToList(), sourceUris?.ToList(), ssoProperties, resourceRequests, instances?.ToList()); + return new AppPlatformApiPortalProperties(provisioningState, isPublic, uri, isHttpsOnly, gatewayIds?.ToList(), sourceUris?.ToList(), ssoProperties, resourceRequests, instances?.ToList(), default); } - /// Initializes a new instance of AppPlatformApiPortalResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each API portal instance. /// Memory allocated to each API portal instance. /// A new instance for mocking. public static AppPlatformApiPortalResourceRequirements AppPlatformApiPortalResourceRequirements(string cpu = null, string memory = null) { - return new AppPlatformApiPortalResourceRequirements(cpu, memory); + return new AppPlatformApiPortalResourceRequirements(cpu, memory, default); } - /// Initializes a new instance of AppPlatformApiPortalInstance. + /// Initializes a new instance of . /// Name of the API portal instance. /// Status of the API portal instance. /// A new instance for mocking. public static AppPlatformApiPortalInstance AppPlatformApiPortalInstance(string name = null, string status = null) { - return new AppPlatformApiPortalInstance(name, status); + return new AppPlatformApiPortalInstance(name, status, default); } - /// Initializes a new instance of AppPlatformApiPortalCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1011,10 +1005,10 @@ public static AppPlatformApiPortalInstance AppPlatformApiPortalInstance(string n /// A new instance for mocking. public static AppPlatformApiPortalCustomDomainData AppPlatformApiPortalCustomDomainData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string apiPortalCustomDomainThumbprint = null) { - return new AppPlatformApiPortalCustomDomainData(id, name, resourceType, systemData, apiPortalCustomDomainThumbprint != null ? new ApiPortalCustomDomainProperties(apiPortalCustomDomainThumbprint) : null); + return new AppPlatformApiPortalCustomDomainData(id, name, resourceType, systemData, apiPortalCustomDomainThumbprint != null ? new ApiPortalCustomDomainProperties(apiPortalCustomDomainThumbprint, new Dictionary()) : null, default); } - /// Initializes a new instance of AppPlatformKeyVaultCertificateProperties. + /// Initializes a new instance of . /// The thumbprint of certificate. /// The issuer of certificate. /// The issue date of certificate. @@ -1032,10 +1026,10 @@ public static AppPlatformKeyVaultCertificateProperties AppPlatformKeyVaultCertif { dnsNames ??= new List(); - return new AppPlatformKeyVaultCertificateProperties("KeyVaultCertificate", thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames?.ToList(), provisioningState, vaultUri, keyVaultCertName, certVersion, isPrivateKeyExcluded); + return new AppPlatformKeyVaultCertificateProperties("KeyVaultCertificate", thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames?.ToList(), provisioningState, vaultUri, keyVaultCertName, certVersion, isPrivateKeyExcluded, default); } - /// Initializes a new instance of AppPlatformContentCertificateProperties. + /// Initializes a new instance of . /// The thumbprint of certificate. /// The issuer of certificate. /// The issue date of certificate. @@ -1050,7 +1044,7 @@ public static AppPlatformContentCertificateProperties AppPlatformContentCertific { dnsNames ??= new List(); - return new AppPlatformContentCertificateProperties("ContentCertificate", thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames?.ToList(), provisioningState, content); + return new AppPlatformContentCertificateProperties("ContentCertificate", thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames?.ToList(), provisioningState, content, default); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index d08e81e73920..8324dab3f46b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -131,7 +131,7 @@ public virtual AsyncPageable GetAppPlatformServicesA { HttpMessage FirstPageRequest(int? pageSizeHint) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppPlatformServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppPlatformServices", "value", "nextLink", cancellationToken); } /// @@ -153,7 +153,7 @@ public virtual Pageable GetAppPlatformServices(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppPlatformServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppPlatformServices", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.Serialization.cs index 0b0c44d2e4b7..6103dff0b4b0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ActiveAppPlatformDeploymentsContent : IUtf8JsonSerializable + public partial class ActiveAppPlatformDeploymentsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ActiveDeploymentNames)) { @@ -25,7 +33,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ActiveAppPlatformDeploymentsContent DeserializeActiveAppPlatformDeploymentsContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> activeDeploymentNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("activeDeploymentNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + activeDeploymentNames = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ActiveAppPlatformDeploymentsContent(Optional.ToList(activeDeploymentNames), serializedAdditionalRawData); + } + + ActiveAppPlatformDeploymentsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeActiveAppPlatformDeploymentsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ActiveAppPlatformDeploymentsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeActiveAppPlatformDeploymentsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ActiveAppPlatformDeploymentsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ActiveAppPlatformDeploymentsContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeActiveAppPlatformDeploymentsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.cs index 460fec666024..8c6b003ee50e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ActiveAppPlatformDeploymentsContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Deployment resource name and set them as active. public partial class ActiveAppPlatformDeploymentsContent { - /// Initializes a new instance of ActiveAppPlatformDeploymentsContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ActiveAppPlatformDeploymentsContent() { ActiveDeploymentNames = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Collection of Deployment name. + /// Keeps track of any properties unknown to the library. + internal ActiveAppPlatformDeploymentsContent(IList activeDeploymentNames, Dictionary serializedAdditionalRawData) + { + ActiveDeploymentNames = activeDeploymentNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Collection of Deployment name. public IList ActiveDeploymentNames { get; } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.Serialization.cs index e244905d1db9..1301d9e246ad 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ApiPortalCustomDomainProperties : IUtf8JsonSerializable + internal partial class ApiPortalCustomDomainProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Thumbprint)) { writer.WritePropertyName("thumbprint"u8); writer.WriteStringValue(Thumbprint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiPortalCustomDomainProperties DeserializeApiPortalCustomDomainProperties(JsonElement element) + internal static ApiPortalCustomDomainProperties DeserializeApiPortalCustomDomainProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional thumbprint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("thumbprint"u8)) @@ -37,8 +60,61 @@ internal static ApiPortalCustomDomainProperties DeserializeApiPortalCustomDomain thumbprint = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiPortalCustomDomainProperties(thumbprint.Value, serializedAdditionalRawData); + } + + ApiPortalCustomDomainProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiPortalCustomDomainProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiPortalCustomDomainProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiPortalCustomDomainProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiPortalCustomDomainProperties model) + { + if (model is null) + { + return null; } - return new ApiPortalCustomDomainProperties(thumbprint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiPortalCustomDomainProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiPortalCustomDomainProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.cs index 3504891acee2..adac6e771149 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The properties of custom domain for API portal. internal partial class ApiPortalCustomDomainProperties { - /// Initializes a new instance of ApiPortalCustomDomainProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiPortalCustomDomainProperties() { } - /// Initializes a new instance of ApiPortalCustomDomainProperties. + /// Initializes a new instance of . /// The thumbprint of bound certificate. - internal ApiPortalCustomDomainProperties(string thumbprint) + /// Keeps track of any properties unknown to the library. + internal ApiPortalCustomDomainProperties(string thumbprint, Dictionary serializedAdditionalRawData) { Thumbprint = thumbprint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The thumbprint of bound certificate. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.Serialization.cs index 5eb4511c4f27..b81a9ac1514d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ApiPortalCustomDomainResourceList + internal partial class ApiPortalCustomDomainResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiPortalCustomDomainResourceList DeserializeApiPortalCustomDomainResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiPortalCustomDomainResourceList DeserializeApiPortalCustomDomainResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ApiPortalCustomDomainResourceList DeserializeApiPortalCustomDoma nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiPortalCustomDomainResourceList(Optional.ToList(value), nextLink.Value); + return new ApiPortalCustomDomainResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ApiPortalCustomDomainResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiPortalCustomDomainResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiPortalCustomDomainResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiPortalCustomDomainResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiPortalCustomDomainResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiPortalCustomDomainResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiPortalCustomDomainResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.cs index 57965cf83caa..6487504933b8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalCustomDomainResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of API portal custom domain resources and a possible link for next set. internal partial class ApiPortalCustomDomainResourceList { - /// Initializes a new instance of ApiPortalCustomDomainResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiPortalCustomDomainResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiPortalCustomDomainResourceList. + /// Initializes a new instance of . /// Collection of API portal custom domain resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ApiPortalCustomDomainResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiPortalCustomDomainResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of API portal custom domain resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.Serialization.cs index ab551b404686..bfe74bfb2bb4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ApiPortalResourceList + internal partial class ApiPortalResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApiPortalResourceList DeserializeApiPortalResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApiPortalResourceList DeserializeApiPortalResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ApiPortalResourceList DeserializeApiPortalResourceList(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApiPortalResourceList(Optional.ToList(value), nextLink.Value); + return new ApiPortalResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ApiPortalResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiPortalResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiPortalResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiPortalResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiPortalResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiPortalResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiPortalResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.cs index 4e890c8956b1..0cf9ba026e05 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApiPortalResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of API portal resources and a possible link for next set. internal partial class ApiPortalResourceList { - /// Initializes a new instance of ApiPortalResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApiPortalResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ApiPortalResourceList. + /// Initializes a new instance of . /// Collection of API portal resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ApiPortalResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ApiPortalResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of API portal resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.Serialization.cs index 5afadacf8df3..a1be438b4000 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class AppBuildList + internal partial class AppBuildList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppBuildList DeserializeAppBuildList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppBuildList DeserializeAppBuildList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppBuildList DeserializeAppBuildList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppBuildList(Optional.ToList(value), nextLink.Value); + return new AppBuildList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppBuildList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppBuildList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppBuildList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppBuildList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppBuildList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppBuildList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppBuildList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.cs index e6a7ef6dd926..c41daf734b7b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Build resources and a possible link for next set. internal partial class AppBuildList { - /// Initializes a new instance of AppBuildList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppBuildList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppBuildList. + /// Initializes a new instance of . /// Collection of Build resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal AppBuildList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppBuildList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Build resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.Serialization.cs index e226c4493eb0..a546b3d474ae 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class AppBuildResultList + internal partial class AppBuildResultList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppBuildResultList DeserializeAppBuildResultList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppBuildResultList DeserializeAppBuildResultList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppBuildResultList DeserializeAppBuildResultList(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppBuildResultList(Optional.ToList(value), nextLink.Value); + return new AppBuildResultList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppBuildResultList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppBuildResultList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppBuildResultList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppBuildResultList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppBuildResultList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppBuildResultList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppBuildResultList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.cs index 381bc8ec68b7..b5cf6abe1b61 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildResultList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Build result resources and a possible link for next set. internal partial class AppBuildResultList { - /// Initializes a new instance of AppBuildResultList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppBuildResultList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppBuildResultList. + /// Initializes a new instance of . /// Collection of Build result resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal AppBuildResultList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppBuildResultList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Build result resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.Serialization.cs index 8cb7664612c9..90c2ab656587 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class AppBuildServiceList + internal partial class AppBuildServiceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppBuildServiceList DeserializeAppBuildServiceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppBuildServiceList DeserializeAppBuildServiceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppBuildServiceList DeserializeAppBuildServiceList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppBuildServiceList(Optional.ToList(value), nextLink.Value); + return new AppBuildServiceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppBuildServiceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppBuildServiceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppBuildServiceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppBuildServiceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppBuildServiceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppBuildServiceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppBuildServiceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.cs index 3d82d3f5863a..347f1f9cd362 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuildServiceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Build service resources and a possible link for next set. internal partial class AppBuildServiceList { - /// Initializes a new instance of AppBuildServiceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppBuildServiceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppBuildServiceList. + /// Initializes a new instance of . /// Collection of Build service resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal AppBuildServiceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppBuildServiceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Build service resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.Serialization.cs index 5ed64791a11e..226e519e7faf 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class AppBuilderResourceList + internal partial class AppBuilderResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppBuilderResourceList DeserializeAppBuilderResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppBuilderResourceList DeserializeAppBuilderResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppBuilderResourceList DeserializeAppBuilderResourceList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppBuilderResourceList(Optional.ToList(value), nextLink.Value); + return new AppBuilderResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppBuilderResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppBuilderResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppBuilderResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppBuilderResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppBuilderResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppBuilderResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppBuilderResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.cs index afdbec0ff1d2..0a46b08728e5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppBuilderResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Builder resources and a possible link for next set. internal partial class AppBuilderResourceList { - /// Initializes a new instance of AppBuilderResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppBuilderResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppBuilderResourceList. + /// Initializes a new instance of . /// Collection of Builder resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal AppBuilderResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppBuilderResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Builder resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.Serialization.cs index 2ce492036c83..d1c3bf6ce803 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.Serialization.cs @@ -5,34 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppCustomPersistentDisk : IUtf8JsonSerializable + public partial class AppCustomPersistentDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CustomPersistentDiskProperties)) { writer.WritePropertyName("customPersistentDiskProperties"u8); - writer.WriteObjectValue(CustomPersistentDiskProperties); + if (CustomPersistentDiskProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomPersistentDiskProperties).Serialize(writer, options); + } } writer.WritePropertyName("storageId"u8); writer.WriteStringValue(StorageId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppCustomPersistentDisk DeserializeAppCustomPersistentDisk(JsonElement element) + internal static AppCustomPersistentDisk DeserializeAppCustomPersistentDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional customPersistentDiskProperties = default; string storageId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("customPersistentDiskProperties"u8)) @@ -49,8 +79,61 @@ internal static AppCustomPersistentDisk DeserializeAppCustomPersistentDisk(JsonE storageId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppCustomPersistentDisk(customPersistentDiskProperties.Value, storageId, serializedAdditionalRawData); + } + + AppCustomPersistentDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppCustomPersistentDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppCustomPersistentDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppCustomPersistentDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppCustomPersistentDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppCustomPersistentDisk(Response response) + { + if (response is null) + { + return null; } - return new AppCustomPersistentDisk(customPersistentDiskProperties.Value, storageId); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppCustomPersistentDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.cs index e2384aae6e49..0b593bc06b14 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDisk.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppPlatform.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Custom persistent disk resource payload. public partial class AppCustomPersistentDisk { - /// Initializes a new instance of AppCustomPersistentDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource id of Azure Spring Apps Storage resource. /// is null. public AppCustomPersistentDisk(string storageId) @@ -23,17 +27,24 @@ public AppCustomPersistentDisk(string storageId) StorageId = storageId; } - /// Initializes a new instance of AppCustomPersistentDisk. + /// Initializes a new instance of . /// /// Properties of the custom persistent disk resource payload. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// /// The resource id of Azure Spring Apps Storage resource. - internal AppCustomPersistentDisk(AppCustomPersistentDiskProperties customPersistentDiskProperties, string storageId) + /// Keeps track of any properties unknown to the library. + internal AppCustomPersistentDisk(AppCustomPersistentDiskProperties customPersistentDiskProperties, string storageId, Dictionary serializedAdditionalRawData) { CustomPersistentDiskProperties = customPersistentDiskProperties; StorageId = storageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppCustomPersistentDisk() + { } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.Serialization.cs index 1035d739ccbd..dc182ac51af9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppCustomPersistentDiskProperties : IUtf8JsonSerializable + public partial class AppCustomPersistentDiskProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(UnderlyingResourceType.ToString()); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppCustomPersistentDiskProperties DeserializeAppCustomPersistentDiskProperties(JsonElement element) + internal static AppCustomPersistentDiskProperties DeserializeAppCustomPersistentDiskProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,7 +72,103 @@ internal static AppCustomPersistentDiskProperties DeserializeAppCustomPersistent case "AzureFileVolume": return AppPlatformAzureFileVolume.DeserializeAppPlatformAzureFileVolume(element); } } - return UnknownCustomPersistentDiskProperties.DeserializeUnknownCustomPersistentDiskProperties(element); + + // Unknown type found so we will deserialize the base properties only + UnderlyingResourceType type = default; + string mountPath = default; + Optional readOnly = default; + Optional> mountOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new UnderlyingResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("mountPath"u8)) + { + mountPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("readOnly"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readOnly = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("mountOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + mountOptions = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownCustomPersistentDiskProperties(type, mountPath, Optional.ToNullable(readOnly), Optional.ToList(mountOptions), serializedAdditionalRawData); + } + + AppCustomPersistentDiskProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppCustomPersistentDiskProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppCustomPersistentDiskProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppCustomPersistentDiskProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppCustomPersistentDiskProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppCustomPersistentDiskProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppCustomPersistentDiskProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.cs index fec6442cc584..9e9420f9b2fd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppCustomPersistentDiskProperties.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { @@ -16,9 +17,13 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// + [DeserializationProxy(typeof(UnknownCustomPersistentDiskProperties))] public abstract partial class AppCustomPersistentDiskProperties { - /// Initializes a new instance of AppCustomPersistentDiskProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The mount path of the persistent disk. /// is null. protected AppCustomPersistentDiskProperties(string mountPath) @@ -29,17 +34,24 @@ protected AppCustomPersistentDiskProperties(string mountPath) MountOptions = new ChangeTrackingList(); } - /// Initializes a new instance of AppCustomPersistentDiskProperties. + /// Initializes a new instance of . /// The type of the underlying resource to mount as a persistent disk. /// The mount path of the persistent disk. /// Indicates whether the persistent disk is a readOnly one. /// These are the mount options for a persistent disk. - internal AppCustomPersistentDiskProperties(UnderlyingResourceType underlyingResourceType, string mountPath, bool? isReadOnly, IList mountOptions) + /// Keeps track of any properties unknown to the library. + internal AppCustomPersistentDiskProperties(UnderlyingResourceType underlyingResourceType, string mountPath, bool? isReadOnly, IList mountOptions, Dictionary serializedAdditionalRawData) { UnderlyingResourceType = underlyingResourceType; MountPath = mountPath; IsReadOnly = isReadOnly; MountOptions = mountOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppCustomPersistentDiskProperties() + { } /// The type of the underlying resource to mount as a persistent disk. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.Serialization.cs index a82e2fb4d2b9..f15d6b76c6df 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppIngressSettings : IUtf8JsonSerializable + public partial class AppIngressSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ReadTimeoutInSeconds)) { @@ -43,13 +51,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ClientAuth)) { writer.WritePropertyName("clientAuth"u8); - writer.WriteObjectValue(ClientAuth); + if (ClientAuth is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientAuth).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppIngressSettings DeserializeAppIngressSettings(JsonElement element) + internal static AppIngressSettings DeserializeAppIngressSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +89,7 @@ internal static AppIngressSettings DeserializeAppIngressSettings(JsonElement ele Optional sessionCookieMaxAge = default; Optional backendProtocol = default; Optional clientAuth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("readTimeoutInSeconds"u8)) @@ -116,8 +146,61 @@ internal static AppIngressSettings DeserializeAppIngressSettings(JsonElement ele clientAuth = IngressSettingsClientAuth.DeserializeIngressSettingsClientAuth(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppIngressSettings(Optional.ToNullable(readTimeoutInSeconds), Optional.ToNullable(sendTimeoutInSeconds), Optional.ToNullable(sessionAffinity), Optional.ToNullable(sessionCookieMaxAge), Optional.ToNullable(backendProtocol), clientAuth.Value, serializedAdditionalRawData); + } + + AppIngressSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppIngressSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppIngressSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppIngressSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppIngressSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppIngressSettings(Response response) + { + if (response is null) + { + return null; } - return new AppIngressSettings(Optional.ToNullable(readTimeoutInSeconds), Optional.ToNullable(sendTimeoutInSeconds), Optional.ToNullable(sessionAffinity), Optional.ToNullable(sessionCookieMaxAge), Optional.ToNullable(backendProtocol), clientAuth.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppIngressSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.cs index e1c46d357a69..2a2e533c23dc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppIngressSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models @@ -12,19 +13,23 @@ namespace Azure.ResourceManager.AppPlatform.Models /// App ingress settings payload. public partial class AppIngressSettings { - /// Initializes a new instance of AppIngressSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppIngressSettings() { } - /// Initializes a new instance of AppIngressSettings. + /// Initializes a new instance of . /// Ingress read time out in seconds. /// Ingress send time out in seconds. /// Type of the affinity, set this to Cookie to enable session affinity. /// Time in seconds until the cookie expires. /// How ingress should communicate with this app backend service. /// Client-Certification Authentication. - internal AppIngressSettings(int? readTimeoutInSeconds, int? sendTimeoutInSeconds, AppSessionAffinity? sessionAffinity, int? sessionCookieMaxAge, AppBackendProtocol? backendProtocol, IngressSettingsClientAuth clientAuth) + /// Keeps track of any properties unknown to the library. + internal AppIngressSettings(int? readTimeoutInSeconds, int? sendTimeoutInSeconds, AppSessionAffinity? sessionAffinity, int? sessionCookieMaxAge, AppBackendProtocol? backendProtocol, IngressSettingsClientAuth clientAuth, Dictionary serializedAdditionalRawData) { ReadTimeoutInSeconds = readTimeoutInSeconds; SendTimeoutInSeconds = sendTimeoutInSeconds; @@ -32,6 +37,7 @@ internal AppIngressSettings(int? readTimeoutInSeconds, int? sendTimeoutInSeconds SessionCookieMaxAge = sessionCookieMaxAge; BackendProtocol = backendProtocol; ClientAuth = clientAuth; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Ingress read time out in seconds. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.Serialization.cs index 952aa6faeee1..a3a4fdb6ae85 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppInstanceExecAction : IUtf8JsonSerializable + public partial class AppInstanceExecAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Command)) { @@ -28,17 +35,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(ProbeActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppInstanceExecAction DeserializeAppInstanceExecAction(JsonElement element) + internal static AppInstanceExecAction DeserializeAppInstanceExecAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> command = default; ProbeActionType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("command"u8)) @@ -60,8 +82,61 @@ internal static AppInstanceExecAction DeserializeAppInstanceExecAction(JsonEleme type = new ProbeActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppInstanceExecAction(type, Optional.ToList(command), serializedAdditionalRawData); + } + + AppInstanceExecAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppInstanceExecAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppInstanceExecAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppInstanceExecAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppInstanceExecAction model) + { + if (model is null) + { + return null; } - return new AppInstanceExecAction(type, Optional.ToList(command)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppInstanceExecAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppInstanceExecAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.cs index 88accc63c53b..e152c339d7d9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceExecAction.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,18 @@ namespace Azure.ResourceManager.AppPlatform.Models /// ExecAction describes a "run in container" action. public partial class AppInstanceExecAction : AppInstanceProbeAction { - /// Initializes a new instance of AppInstanceExecAction. + /// Initializes a new instance of . public AppInstanceExecAction() { Command = new ChangeTrackingList(); ProbeActionType = ProbeActionType.ExecAction; } - /// Initializes a new instance of AppInstanceExecAction. + /// Initializes a new instance of . /// The type of the action to take to perform the health check. /// Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - internal AppInstanceExecAction(ProbeActionType probeActionType, IList command) : base(probeActionType) + /// Keeps track of any properties unknown to the library. + internal AppInstanceExecAction(ProbeActionType probeActionType, IList command, Dictionary serializedAdditionalRawData) : base(probeActionType, serializedAdditionalRawData) { Command = command; ProbeActionType = probeActionType; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.Serialization.cs index 8f56061166b4..ccabdce5c401 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppInstanceHttpGetAction : IUtf8JsonSerializable + public partial class AppInstanceHttpGetAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(ProbeActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppInstanceHttpGetAction DeserializeAppInstanceHttpGetAction(JsonElement element) + internal static AppInstanceHttpGetAction DeserializeAppInstanceHttpGetAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static AppInstanceHttpGetAction DeserializeAppInstanceHttpGetAction(Jso Optional path = default; Optional scheme = default; ProbeActionType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -60,8 +83,61 @@ internal static AppInstanceHttpGetAction DeserializeAppInstanceHttpGetAction(Jso type = new ProbeActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppInstanceHttpGetAction(type, path.Value, Optional.ToNullable(scheme), serializedAdditionalRawData); + } + + AppInstanceHttpGetAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppInstanceHttpGetAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppInstanceHttpGetAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppInstanceHttpGetAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppInstanceHttpGetAction model) + { + if (model is null) + { + return null; } - return new AppInstanceHttpGetAction(type, path.Value, Optional.ToNullable(scheme)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppInstanceHttpGetAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppInstanceHttpGetAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.cs index 3d5e790a7ac1..0a1f8e2f2e81 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceHttpGetAction.cs @@ -5,18 +5,21 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// HTTPGetAction describes an action based on HTTP Get requests. public partial class AppInstanceHttpGetAction : AppInstanceProbeAction { - /// Initializes a new instance of AppInstanceHttpGetAction. + /// Initializes a new instance of . public AppInstanceHttpGetAction() { ProbeActionType = ProbeActionType.HttpGetAction; } - /// Initializes a new instance of AppInstanceHttpGetAction. + /// Initializes a new instance of . /// The type of the action to take to perform the health check. /// Path to access on the HTTP server. /// @@ -26,7 +29,8 @@ public AppInstanceHttpGetAction() /// - `"HTTP"` means that the scheme used will be http:// /// - `"HTTPS"` means that the scheme used will be https:// /// - internal AppInstanceHttpGetAction(ProbeActionType probeActionType, string path, AppInstanceHttpSchemeType? scheme) : base(probeActionType) + /// Keeps track of any properties unknown to the library. + internal AppInstanceHttpGetAction(ProbeActionType probeActionType, string path, AppInstanceHttpSchemeType? scheme, Dictionary serializedAdditionalRawData) : base(probeActionType, serializedAdditionalRawData) { Path = path; Scheme = scheme; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.Serialization.cs index 227ff6ec4f2e..06c3bee40d3d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppInstanceProbe : IUtf8JsonSerializable + public partial class AppInstanceProbe : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProbeAction)) { writer.WritePropertyName("probeAction"u8); - writer.WriteObjectValue(ProbeAction); + if (ProbeAction is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProbeAction).Serialize(writer, options); + } } writer.WritePropertyName("disableProbe"u8); writer.WriteBooleanValue(IsProbeDisabled); @@ -47,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("successThreshold"u8); writer.WriteNumberValue(SuccessThreshold.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppInstanceProbe DeserializeAppInstanceProbe(JsonElement element) + internal static AppInstanceProbe DeserializeAppInstanceProbe(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +92,7 @@ internal static AppInstanceProbe DeserializeAppInstanceProbe(JsonElement element Optional timeoutSeconds = default; Optional failureThreshold = default; Optional successThreshold = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("probeAction"u8)) @@ -124,8 +154,61 @@ internal static AppInstanceProbe DeserializeAppInstanceProbe(JsonElement element successThreshold = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppInstanceProbe(probeAction.Value, disableProbe, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(timeoutSeconds), Optional.ToNullable(failureThreshold), Optional.ToNullable(successThreshold), serializedAdditionalRawData); + } + + AppInstanceProbe IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppInstanceProbe(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppInstanceProbe IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppInstanceProbe(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppInstanceProbe model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppInstanceProbe(Response response) + { + if (response is null) + { + return null; } - return new AppInstanceProbe(probeAction.Value, disableProbe, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(timeoutSeconds), Optional.ToNullable(failureThreshold), Optional.ToNullable(successThreshold)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppInstanceProbe(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.cs index f0fb3ac871b9..5e9a47f795f7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbe.cs @@ -5,19 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Probe describes a health check to be performed against an App Instance to determine whether it is alive or ready to receive traffic. public partial class AppInstanceProbe { - /// Initializes a new instance of AppInstanceProbe. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicate whether the probe is disabled. public AppInstanceProbe(bool isProbeDisabled) { IsProbeDisabled = isProbeDisabled; } - /// Initializes a new instance of AppInstanceProbe. + /// Initializes a new instance of . /// /// The action of the probe. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -29,7 +35,8 @@ public AppInstanceProbe(bool isProbeDisabled) /// Number of seconds after which the probe times out. Minimum value is 1. /// Minimum consecutive failures for the probe to be considered failed after having succeeded. Minimum value is 1. /// Minimum consecutive successes for the probe to be considered successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - internal AppInstanceProbe(AppInstanceProbeAction probeAction, bool isProbeDisabled, int? initialDelayInSeconds, int? periodInSeconds, int? timeoutInSeconds, int? failureThreshold, int? successThreshold) + /// Keeps track of any properties unknown to the library. + internal AppInstanceProbe(AppInstanceProbeAction probeAction, bool isProbeDisabled, int? initialDelayInSeconds, int? periodInSeconds, int? timeoutInSeconds, int? failureThreshold, int? successThreshold, Dictionary serializedAdditionalRawData) { ProbeAction = probeAction; IsProbeDisabled = isProbeDisabled; @@ -38,6 +45,12 @@ internal AppInstanceProbe(AppInstanceProbeAction probeAction, bool isProbeDisabl TimeoutInSeconds = timeoutInSeconds; FailureThreshold = failureThreshold; SuccessThreshold = successThreshold; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppInstanceProbe() + { } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.Serialization.cs index ef0acbb22dbb..bb7c9831e0d6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppInstanceProbeAction : IUtf8JsonSerializable + public partial class AppInstanceProbeAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ProbeActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppInstanceProbeAction DeserializeAppInstanceProbeAction(JsonElement element) + internal static AppInstanceProbeAction DeserializeAppInstanceProbeAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,7 +57,72 @@ internal static AppInstanceProbeAction DeserializeAppInstanceProbeAction(JsonEle case "TCPSocketAction": return AppInstanceTcpSocketAction.DeserializeAppInstanceTcpSocketAction(element); } } - return UnknownProbeAction.DeserializeUnknownProbeAction(element); + + // Unknown type found so we will deserialize the base properties only + ProbeActionType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ProbeActionType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownProbeAction(type, serializedAdditionalRawData); + } + + AppInstanceProbeAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppInstanceProbeAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppInstanceProbeAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppInstanceProbeAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppInstanceProbeAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppInstanceProbeAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppInstanceProbeAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.cs index 9ce3ce07e039..3a4dec158c1b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceProbeAction.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.AppPlatform.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownProbeAction))] public abstract partial class AppInstanceProbeAction { - /// Initializes a new instance of AppInstanceProbeAction. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AppInstanceProbeAction() { } - /// Initializes a new instance of AppInstanceProbeAction. + /// Initializes a new instance of . /// The type of the action to take to perform the health check. - internal AppInstanceProbeAction(ProbeActionType probeActionType) + /// Keeps track of any properties unknown to the library. + internal AppInstanceProbeAction(ProbeActionType probeActionType, Dictionary serializedAdditionalRawData) { ProbeActionType = probeActionType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the action to take to perform the health check. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.Serialization.cs index fec0c281a0f9..55cbc32c5ea0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppInstanceTcpSocketAction : IUtf8JsonSerializable + public partial class AppInstanceTcpSocketAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ProbeActionType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppInstanceTcpSocketAction DeserializeAppInstanceTcpSocketAction(JsonElement element) + internal static AppInstanceTcpSocketAction DeserializeAppInstanceTcpSocketAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ProbeActionType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -34,8 +57,61 @@ internal static AppInstanceTcpSocketAction DeserializeAppInstanceTcpSocketAction type = new ProbeActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppInstanceTcpSocketAction(type, serializedAdditionalRawData); + } + + AppInstanceTcpSocketAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppInstanceTcpSocketAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppInstanceTcpSocketAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppInstanceTcpSocketAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppInstanceTcpSocketAction model) + { + if (model is null) + { + return null; } - return new AppInstanceTcpSocketAction(type); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppInstanceTcpSocketAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppInstanceTcpSocketAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.cs index bfdbf655c5ff..055ea27eeff2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppInstanceTcpSocketAction.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// TCPSocketAction describes an action based on opening a socket. public partial class AppInstanceTcpSocketAction : AppInstanceProbeAction { - /// Initializes a new instance of AppInstanceTcpSocketAction. + /// Initializes a new instance of . public AppInstanceTcpSocketAction() { ProbeActionType = ProbeActionType.TCPSocketAction; } - /// Initializes a new instance of AppInstanceTcpSocketAction. + /// Initializes a new instance of . /// The type of the action to take to perform the health check. - internal AppInstanceTcpSocketAction(ProbeActionType probeActionType) : base(probeActionType) + /// Keeps track of any properties unknown to the library. + internal AppInstanceTcpSocketAction(ProbeActionType probeActionType, Dictionary serializedAdditionalRawData) : base(probeActionType, serializedAdditionalRawData) { ProbeActionType = probeActionType; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.Serialization.cs index 8de991fe1a64..a7b412692e02 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppLoadedCertificate : IUtf8JsonSerializable + public partial class AppLoadedCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("loadTrustStore"u8); writer.WriteBooleanValue(LoadTrustStore.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppLoadedCertificate DeserializeAppLoadedCertificate(JsonElement element) + internal static AppLoadedCertificate DeserializeAppLoadedCertificate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier resourceId = default; Optional loadTrustStore = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -49,8 +72,61 @@ internal static AppLoadedCertificate DeserializeAppLoadedCertificate(JsonElement loadTrustStore = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppLoadedCertificate(resourceId, Optional.ToNullable(loadTrustStore), serializedAdditionalRawData); + } + + AppLoadedCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppLoadedCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppLoadedCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppLoadedCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppLoadedCertificate model) + { + if (model is null) + { + return null; } - return new AppLoadedCertificate(resourceId, Optional.ToNullable(loadTrustStore)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppLoadedCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppLoadedCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.cs index ae427a441674..6a0387004de7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppLoadedCertificate.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppPlatform.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Loaded certificate payload. public partial class AppLoadedCertificate { - /// Initializes a new instance of AppLoadedCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Resource Id of loaded certificate. /// is null. public AppLoadedCertificate(ResourceIdentifier resourceId) @@ -23,13 +27,20 @@ public AppLoadedCertificate(ResourceIdentifier resourceId) ResourceId = resourceId; } - /// Initializes a new instance of AppLoadedCertificate. + /// Initializes a new instance of . /// Resource Id of loaded certificate. /// Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. - internal AppLoadedCertificate(ResourceIdentifier resourceId, bool? loadTrustStore) + /// Keeps track of any properties unknown to the library. + internal AppLoadedCertificate(ResourceIdentifier resourceId, bool? loadTrustStore, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; LoadTrustStore = loadTrustStore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppLoadedCertificate() + { } /// Resource Id of loaded certificate. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.Serialization.cs index 3cf240dfe075..990e0a8ffcdb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPersistentDisk : IUtf8JsonSerializable + public partial class AppPersistentDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SizeInGB)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mountPath"u8); writer.WriteStringValue(MountPath); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPersistentDisk DeserializeAppPersistentDisk(JsonElement element) + internal static AppPersistentDisk DeserializeAppPersistentDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static AppPersistentDisk DeserializeAppPersistentDisk(JsonElement eleme Optional sizeInGB = default; Optional usedInGB = default; Optional mountPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sizeInGB"u8)) @@ -62,8 +85,61 @@ internal static AppPersistentDisk DeserializeAppPersistentDisk(JsonElement eleme mountPath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPersistentDisk(Optional.ToNullable(sizeInGB), Optional.ToNullable(usedInGB), mountPath.Value, serializedAdditionalRawData); + } + + AppPersistentDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPersistentDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPersistentDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPersistentDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPersistentDisk model) + { + if (model is null) + { + return null; } - return new AppPersistentDisk(Optional.ToNullable(sizeInGB), Optional.ToNullable(usedInGB), mountPath.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPersistentDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPersistentDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.cs index 67a19d6c4d3b..2e3f329c997b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPersistentDisk.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Persistent disk payload. public partial class AppPersistentDisk { - /// Initializes a new instance of AppPersistentDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPersistentDisk() { } - /// Initializes a new instance of AppPersistentDisk. + /// Initializes a new instance of . /// Size of the persistent disk in GB. /// Size of the used persistent disk in GB. /// Mount path of the persistent disk. - internal AppPersistentDisk(int? sizeInGB, int? usedInGB, string mountPath) + /// Keeps track of any properties unknown to the library. + internal AppPersistentDisk(int? sizeInGB, int? usedInGB, string mountPath, Dictionary serializedAdditionalRawData) { SizeInGB = sizeInGB; UsedInGB = usedInGB; MountPath = mountPath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Size of the persistent disk in GB. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalCustomDomainData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalCustomDomainData.Serialization.cs index cf68b12f30f5..a40fb4c53463 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalCustomDomainData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalCustomDomainData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformApiPortalCustomDomainData : IUtf8JsonSerializable + public partial class AppPlatformApiPortalCustomDomainData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformApiPortalCustomDomainData DeserializeAppPlatformApiPortalCustomDomainData(JsonElement element) + internal static AppPlatformApiPortalCustomDomainData DeserializeAppPlatformApiPortalCustomDomainData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformApiPortalCustomDomainData DeserializeAppPlatformApiPo string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformApiPortalCustomDomainData DeserializeAppPlatformApiPo systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformApiPortalCustomDomainData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformApiPortalCustomDomainData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformApiPortalCustomDomainData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformApiPortalCustomDomainData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformApiPortalCustomDomainData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformApiPortalCustomDomainData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformApiPortalCustomDomainData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformApiPortalCustomDomainData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformApiPortalCustomDomainData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalData.Serialization.cs index 2d922bee7321..7712509aae91 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalData.Serialization.cs @@ -5,33 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformApiPortalData : IUtf8JsonSerializable + public partial class AppPlatformApiPortalData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformApiPortalData DeserializeAppPlatformApiPortalData(JsonElement element) + internal static AppPlatformApiPortalData DeserializeAppPlatformApiPortalData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static AppPlatformApiPortalData DeserializeAppPlatformApiPortalData(Jso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -86,8 +123,61 @@ internal static AppPlatformApiPortalData DeserializeAppPlatformApiPortalData(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformApiPortalData(id, name, type, systemData.Value, properties.Value, sku.Value, serializedAdditionalRawData); + } + + AppPlatformApiPortalData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformApiPortalData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformApiPortalData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformApiPortalData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformApiPortalData model) + { + if (model is null) + { + return null; } - return new AppPlatformApiPortalData(id, name, type, systemData.Value, properties.Value, sku.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformApiPortalData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformApiPortalData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.Serialization.cs index bba5d31315a4..1ffd2da106e5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformApiPortalInstance + public partial class AppPlatformApiPortalInstance : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformApiPortalInstance DeserializeAppPlatformApiPortalInstance(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformApiPortalInstance DeserializeAppPlatformApiPortalInstance(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static AppPlatformApiPortalInstance DeserializeAppPlatformApiPortalInst status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformApiPortalInstance(name.Value, status.Value); + return new AppPlatformApiPortalInstance(name.Value, status.Value, serializedAdditionalRawData); + } + + AppPlatformApiPortalInstance IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformApiPortalInstance(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformApiPortalInstance IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformApiPortalInstance(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformApiPortalInstance model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformApiPortalInstance(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformApiPortalInstance(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.cs index 5f34a69440ae..72330ee9c617 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalInstance.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Collection of instances belong to the API portal. public partial class AppPlatformApiPortalInstance { - /// Initializes a new instance of AppPlatformApiPortalInstance. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformApiPortalInstance() { } - /// Initializes a new instance of AppPlatformApiPortalInstance. + /// Initializes a new instance of . /// Name of the API portal instance. /// Status of the API portal instance. - internal AppPlatformApiPortalInstance(string name, string status) + /// Keeps track of any properties unknown to the library. + internal AppPlatformApiPortalInstance(string name, string status, Dictionary serializedAdditionalRawData) { Name = name; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the API portal instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.Serialization.cs index 37f830916255..5eae5cabb34b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformApiPortalProperties : IUtf8JsonSerializable + public partial class AppPlatformApiPortalProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsPublic)) { @@ -60,13 +66,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SsoProperties)) { writer.WritePropertyName("ssoProperties"u8); - writer.WriteObjectValue(SsoProperties); + if (SsoProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SsoProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformApiPortalProperties DeserializeAppPlatformApiPortalProperties(JsonElement element) + internal static AppPlatformApiPortalProperties DeserializeAppPlatformApiPortalProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -80,6 +107,7 @@ internal static AppPlatformApiPortalProperties DeserializeAppPlatformApiPortalPr Optional ssoProperties = default; Optional resourceRequests = default; Optional> instances = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -192,8 +220,61 @@ internal static AppPlatformApiPortalProperties DeserializeAppPlatformApiPortalPr instances = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformApiPortalProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(@public), uri.Value, Optional.ToNullable(httpsOnly), Optional.ToList(gatewayIds), Optional.ToList(sourceUris), ssoProperties.Value, resourceRequests.Value, Optional.ToList(instances), serializedAdditionalRawData); + } + + AppPlatformApiPortalProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformApiPortalProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformApiPortalProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformApiPortalProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformApiPortalProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformApiPortalProperties(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformApiPortalProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(@public), uri.Value, Optional.ToNullable(httpsOnly), Optional.ToList(gatewayIds), Optional.ToList(sourceUris), ssoProperties.Value, resourceRequests.Value, Optional.ToList(instances)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformApiPortalProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.cs index 4e2f1e45fb85..605a243ab2f6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalProperties.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// API portal properties payload. public partial class AppPlatformApiPortalProperties { - /// Initializes a new instance of AppPlatformApiPortalProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformApiPortalProperties() { GatewayIds = new ChangeTrackingList(); @@ -22,7 +25,7 @@ public AppPlatformApiPortalProperties() Instances = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformApiPortalProperties. + /// Initializes a new instance of . /// State of the API portal. /// Indicates whether the API portal exposes endpoint. /// URL of the API portal, exposed when 'public' is true. @@ -32,7 +35,8 @@ public AppPlatformApiPortalProperties() /// Single sign-on related configuration. /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to API portal. - internal AppPlatformApiPortalProperties(AppPlatformApiPortalProvisioningState? provisioningState, bool? isPublic, Uri uri, bool? isHttpsOnly, IList gatewayIds, IList sourceUris, AppPlatformSsoProperties ssoProperties, AppPlatformApiPortalResourceRequirements resourceRequests, IReadOnlyList instances) + /// Keeps track of any properties unknown to the library. + internal AppPlatformApiPortalProperties(AppPlatformApiPortalProvisioningState? provisioningState, bool? isPublic, Uri uri, bool? isHttpsOnly, IList gatewayIds, IList sourceUris, AppPlatformSsoProperties ssoProperties, AppPlatformApiPortalResourceRequirements resourceRequests, IReadOnlyList instances, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; IsPublic = isPublic; @@ -43,6 +47,7 @@ internal AppPlatformApiPortalProperties(AppPlatformApiPortalProvisioningState? p SsoProperties = ssoProperties; ResourceRequests = resourceRequests; Instances = instances; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the API portal. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.Serialization.cs index 579fe8b13100..1afae1ede2c4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformApiPortalResourceRequirements + public partial class AppPlatformApiPortalResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformApiPortalResourceRequirements DeserializeAppPlatformApiPortalResourceRequirements(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformApiPortalResourceRequirements DeserializeAppPlatformApiPortalResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cpu = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -32,8 +61,61 @@ internal static AppPlatformApiPortalResourceRequirements DeserializeAppPlatformA memory = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformApiPortalResourceRequirements(cpu.Value, memory.Value); + return new AppPlatformApiPortalResourceRequirements(cpu.Value, memory.Value, serializedAdditionalRawData); + } + + AppPlatformApiPortalResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformApiPortalResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformApiPortalResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformApiPortalResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformApiPortalResourceRequirements model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformApiPortalResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformApiPortalResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.cs index 2d349faa965f..a4eddde54b84 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformApiPortalResourceRequirements.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Resource requests of the API portal. public partial class AppPlatformApiPortalResourceRequirements { - /// Initializes a new instance of AppPlatformApiPortalResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformApiPortalResourceRequirements() { } - /// Initializes a new instance of AppPlatformApiPortalResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each API portal instance. /// Memory allocated to each API portal instance. - internal AppPlatformApiPortalResourceRequirements(string cpu, string memory) + /// Keeps track of any properties unknown to the library. + internal AppPlatformApiPortalResourceRequirements(string cpu, string memory, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cpu allocated to each API portal instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppData.Serialization.cs index c54cda8d075d..a7e5d7249619 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppData.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformAppData : IUtf8JsonSerializable + public partial class AppPlatformAppData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -33,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformAppData DeserializeAppPlatformAppData(JsonElement element) + internal static AppPlatformAppData DeserializeAppPlatformAppData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +78,7 @@ internal static AppPlatformAppData DeserializeAppPlatformAppData(JsonElement ele string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -103,8 +133,61 @@ internal static AppPlatformAppData DeserializeAppPlatformAppData(JsonElement ele systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformAppData(id, name, type, systemData.Value, properties.Value, identity, Optional.ToNullable(location), serializedAdditionalRawData); + } + + AppPlatformAppData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformAppData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformAppData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformAppData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformAppData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformAppData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformAppData(id, name, type, systemData.Value, properties.Value, identity, Optional.ToNullable(location)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformAppData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.Serialization.cs index 3ed9ce7a2ac4..e7557ead0188 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformAppProperties : IUtf8JsonSerializable + public partial class AppPlatformAppProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsPublic)) { @@ -61,12 +67,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TemporaryDisk)) { writer.WritePropertyName("temporaryDisk"u8); - writer.WriteObjectValue(TemporaryDisk); + if (TemporaryDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TemporaryDisk).Serialize(writer, options); + } } if (Optional.IsDefined(PersistentDisk)) { writer.WritePropertyName("persistentDisk"u8); - writer.WriteObjectValue(PersistentDisk); + if (PersistentDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PersistentDisk).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(CustomPersistentDisks)) { @@ -74,7 +94,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomPersistentDisks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -89,25 +116,60 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadedCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(VnetAddons)) { writer.WritePropertyName("vnetAddons"u8); - writer.WriteObjectValue(VnetAddons); + if (VnetAddons is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VnetAddons).Serialize(writer, options); + } } if (Optional.IsDefined(IngressSettings)) { writer.WritePropertyName("ingressSettings"u8); - writer.WriteObjectValue(IngressSettings); + if (IngressSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IngressSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformAppProperties DeserializeAppPlatformAppProperties(JsonElement element) + internal static AppPlatformAppProperties DeserializeAppPlatformAppProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -125,6 +187,7 @@ internal static AppPlatformAppProperties DeserializeAppPlatformAppProperties(Jso Optional> loadedCertificates = default; Optional vnetAddons = default; Optional ingressSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("public"u8)) @@ -270,8 +333,61 @@ internal static AppPlatformAppProperties DeserializeAppPlatformAppProperties(Jso ingressSettings = AppIngressSettings.DeserializeAppIngressSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformAppProperties(Optional.ToNullable(@public), uri.Value, Optional.ToDictionary(addonConfigs), Optional.ToNullable(provisioningState), fqdn.Value, Optional.ToNullable(httpsOnly), temporaryDisk.Value, persistentDisk.Value, Optional.ToList(customPersistentDisks), Optional.ToNullable(enableEndToEndTls), Optional.ToList(loadedCertificates), vnetAddons.Value, ingressSettings.Value, serializedAdditionalRawData); + } + + AppPlatformAppProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformAppProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformAppProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformAppProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformAppProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformAppProperties(Optional.ToNullable(@public), uri.Value, Optional.ToDictionary(addonConfigs), Optional.ToNullable(provisioningState), fqdn.Value, Optional.ToNullable(httpsOnly), temporaryDisk.Value, persistentDisk.Value, Optional.ToList(customPersistentDisks), Optional.ToNullable(enableEndToEndTls), Optional.ToList(loadedCertificates), vnetAddons.Value, ingressSettings.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformAppProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformAppProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.cs index c06af59142a6..3ba37abd50ff 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAppProperties.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// App resource properties payload. public partial class AppPlatformAppProperties { - /// Initializes a new instance of AppPlatformAppProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformAppProperties() { AddonConfigs = new ChangeTrackingDictionary>(); @@ -22,7 +25,7 @@ public AppPlatformAppProperties() LoadedCertificates = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformAppProperties. + /// Initializes a new instance of . /// Indicates whether the App exposes public endpoint. /// URL of the App. /// Collection of addons. @@ -36,7 +39,8 @@ public AppPlatformAppProperties() /// Collection of loaded certificates. /// Additional App settings in vnet injection instance. /// App ingress settings payload. - internal AppPlatformAppProperties(bool? isPublic, string uriString, IDictionary> addonConfigs, AppPlatformAppProvisioningState? provisioningState, string fqdn, bool? isHttpsOnly, AppTemporaryDisk temporaryDisk, AppPersistentDisk persistentDisk, IList customPersistentDisks, bool? isEndToEndTlsEnabled, IList loadedCertificates, AppVnetAddons vnetAddons, AppIngressSettings ingressSettings) + /// Keeps track of any properties unknown to the library. + internal AppPlatformAppProperties(bool? isPublic, string uriString, IDictionary> addonConfigs, AppPlatformAppProvisioningState? provisioningState, string fqdn, bool? isHttpsOnly, AppTemporaryDisk temporaryDisk, AppPersistentDisk persistentDisk, IList customPersistentDisks, bool? isEndToEndTlsEnabled, IList loadedCertificates, AppVnetAddons vnetAddons, AppIngressSettings ingressSettings, Dictionary serializedAdditionalRawData) { IsPublic = isPublic; UriString = uriString; @@ -51,6 +55,7 @@ internal AppPlatformAppProperties(bool? isPublic, string uriString, IDictionary< LoadedCertificates = loadedCertificates; VnetAddons = vnetAddons; IngressSettings = ingressSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the App exposes public endpoint. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.Serialization.cs index b1cb3109accc..c8a8020517ca 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformAzureFileVolume : IUtf8JsonSerializable + public partial class AppPlatformAzureFileVolume : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("shareName"u8); writer.WriteStringValue(ShareName); @@ -37,11 +44,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformAzureFileVolume DeserializeAppPlatformAzureFileVolume(JsonElement element) + internal static AppPlatformAzureFileVolume DeserializeAppPlatformAzureFileVolume(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +72,7 @@ internal static AppPlatformAzureFileVolume DeserializeAppPlatformAzureFileVolume string mountPath = default; Optional readOnly = default; Optional> mountOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shareName"u8)) @@ -91,8 +113,61 @@ internal static AppPlatformAzureFileVolume DeserializeAppPlatformAzureFileVolume mountOptions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformAzureFileVolume(type, mountPath, Optional.ToNullable(readOnly), Optional.ToList(mountOptions), shareName, serializedAdditionalRawData); + } + + AppPlatformAzureFileVolume IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformAzureFileVolume(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformAzureFileVolume IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformAzureFileVolume(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformAzureFileVolume model) + { + if (model is null) + { + return null; } - return new AppPlatformAzureFileVolume(type, mountPath, Optional.ToNullable(readOnly), Optional.ToList(mountOptions), shareName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformAzureFileVolume(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformAzureFileVolume(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.cs index 09c545c9ec90..8ebc073a4670 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformAzureFileVolume.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.AppPlatform.Models /// The properties of the Azure File volume. Azure File shares are mounted as volumes. public partial class AppPlatformAzureFileVolume : AppCustomPersistentDiskProperties { - /// Initializes a new instance of AppPlatformAzureFileVolume. + /// Initializes a new instance of . /// The mount path of the persistent disk. /// The share name of the Azure File share. /// or is null. @@ -27,18 +27,24 @@ public AppPlatformAzureFileVolume(string mountPath, string shareName) : base(mou UnderlyingResourceType = UnderlyingResourceType.AzureFileVolume; } - /// Initializes a new instance of AppPlatformAzureFileVolume. + /// Initializes a new instance of . /// The type of the underlying resource to mount as a persistent disk. /// The mount path of the persistent disk. /// Indicates whether the persistent disk is a readOnly one. /// These are the mount options for a persistent disk. /// The share name of the Azure File share. - internal AppPlatformAzureFileVolume(UnderlyingResourceType underlyingResourceType, string mountPath, bool? isReadOnly, IList mountOptions, string shareName) : base(underlyingResourceType, mountPath, isReadOnly, mountOptions) + /// Keeps track of any properties unknown to the library. + internal AppPlatformAzureFileVolume(UnderlyingResourceType underlyingResourceType, string mountPath, bool? isReadOnly, IList mountOptions, string shareName, Dictionary serializedAdditionalRawData) : base(underlyingResourceType, mountPath, isReadOnly, mountOptions, serializedAdditionalRawData) { ShareName = shareName; UnderlyingResourceType = underlyingResourceType; } + /// Initializes a new instance of for deserialization. + internal AppPlatformAzureFileVolume() + { + } + /// The share name of the Azure File share. public string ShareName { get; set; } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingData.Serialization.cs index 4b966ecb587e..19132b015b3e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBindingData : IUtf8JsonSerializable + public partial class AppPlatformBindingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBindingData DeserializeAppPlatformBindingData(JsonElement element) + internal static AppPlatformBindingData DeserializeAppPlatformBindingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBindingData DeserializeAppPlatformBindingData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBindingData DeserializeAppPlatformBindingData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBindingData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBindingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBindingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBindingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBindingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBindingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBindingData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBindingData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBindingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.Serialization.cs index 752dcf24fdb9..a68a31e66d55 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBindingProperties : IUtf8JsonSerializable + public partial class AppPlatformBindingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -47,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformBindingProperties DeserializeAppPlatformBindingProperties(JsonElement element) + internal static AppPlatformBindingProperties DeserializeAppPlatformBindingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +84,7 @@ internal static AppPlatformBindingProperties DeserializeAppPlatformBindingProper Optional generatedProperties = default; Optional createdAt = default; Optional updatedAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceName"u8)) @@ -134,8 +155,61 @@ internal static AppPlatformBindingProperties DeserializeAppPlatformBindingProper updatedAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformBindingProperties(resourceName.Value, resourceType.Value, resourceId.Value, key.Value, Optional.ToDictionary(bindingParameters), generatedProperties.Value, Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt)); + return new AppPlatformBindingProperties(resourceName.Value, resourceType.Value, resourceId.Value, key.Value, Optional.ToDictionary(bindingParameters), generatedProperties.Value, Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt), serializedAdditionalRawData); + } + + AppPlatformBindingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBindingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBindingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBindingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBindingProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBindingProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBindingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.cs index 53620644d371..d480d6d086a9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBindingProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Binding resource properties payload. public partial class AppPlatformBindingProperties { - /// Initializes a new instance of AppPlatformBindingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBindingProperties() { BindingParameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AppPlatformBindingProperties. + /// Initializes a new instance of . /// The name of the bound resource. /// The standard Azure resource type of the bound resource. /// The Azure resource id of the bound resource. @@ -29,7 +32,8 @@ public AppPlatformBindingProperties() /// The generated Spring Boot property file for this binding. The secret will be deducted. /// Creation time of the Binding resource. /// Update time of the Binding resource. - internal AppPlatformBindingProperties(string resourceName, string resourceType, ResourceIdentifier resourceId, string key, IDictionary bindingParameters, string generatedProperties, DateTimeOffset? createdOn, DateTimeOffset? updatedOn) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBindingProperties(string resourceName, string resourceType, ResourceIdentifier resourceId, string key, IDictionary bindingParameters, string generatedProperties, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, Dictionary serializedAdditionalRawData) { ResourceName = resourceName; ResourceType = resourceType; @@ -39,6 +43,7 @@ internal AppPlatformBindingProperties(string resourceName, string resourceType, GeneratedProperties = generatedProperties; CreatedOn = createdOn; UpdatedOn = updatedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the bound resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildData.Serialization.cs index 16bb25572276..100751b8fce1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBuildData : IUtf8JsonSerializable + public partial class AppPlatformBuildData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildData DeserializeAppPlatformBuildData(JsonElement element) + internal static AppPlatformBuildData DeserializeAppPlatformBuildData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBuildData DeserializeAppPlatformBuildData(JsonElement string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBuildData DeserializeAppPlatformBuildData(JsonElement systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBuildData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.Serialization.cs index 898d0a4b8c81..9fe063c60519 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildProperties : IUtf8JsonSerializable + public partial class AppPlatformBuildProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RelativePath)) { @@ -46,13 +53,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ResourceRequests)) { writer.WritePropertyName("resourceRequests"u8); - writer.WriteObjectValue(ResourceRequests); + if (ResourceRequests is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResourceRequests).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildProperties DeserializeAppPlatformBuildProperties(JsonElement element) + internal static AppPlatformBuildProperties DeserializeAppPlatformBuildProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +92,7 @@ internal static AppPlatformBuildProperties DeserializeAppPlatformBuildProperties Optional> env = default; Optional triggeredBuildResult = default; Optional resourceRequests = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("relativePath"u8)) @@ -122,8 +151,61 @@ internal static AppPlatformBuildProperties DeserializeAppPlatformBuildProperties resourceRequests = AppPlatformBuildResourceRequirements.DeserializeAppPlatformBuildResourceRequirements(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildProperties(relativePath.Value, builder.Value, agentPool.Value, Optional.ToNullable(provisioningState), Optional.ToDictionary(env), triggeredBuildResult, resourceRequests.Value, serializedAdditionalRawData); + } + + AppPlatformBuildProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildProperties(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildProperties(relativePath.Value, builder.Value, agentPool.Value, Optional.ToNullable(provisioningState), Optional.ToDictionary(env), triggeredBuildResult, resourceRequests.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.cs index 9c11982dccff..aa7fab2b912c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Build resource properties payload. public partial class AppPlatformBuildProperties { - /// Initializes a new instance of AppPlatformBuildProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildProperties() { Env = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AppPlatformBuildProperties. + /// Initializes a new instance of . /// The relative path of source code. /// The resource id of builder to build the source code. /// The resource id of agent pool. @@ -28,7 +32,8 @@ public AppPlatformBuildProperties() /// The environment variables for this build. /// The build result triggered by this build. /// The customized build resource for this build. - internal AppPlatformBuildProperties(string relativePath, string builder, string agentPool, AppPlatformBuildProvisioningState? provisioningState, IDictionary env, SubResource triggeredBuildResult, AppPlatformBuildResourceRequirements resourceRequests) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildProperties(string relativePath, string builder, string agentPool, AppPlatformBuildProvisioningState? provisioningState, IDictionary env, SubResource triggeredBuildResult, AppPlatformBuildResourceRequirements resourceRequests, Dictionary serializedAdditionalRawData) { RelativePath = relativePath; Builder = builder; @@ -37,6 +42,7 @@ internal AppPlatformBuildProperties(string relativePath, string builder, string Env = env; TriggeredBuildResult = triggeredBuildResult; ResourceRequests = resourceRequests; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The relative path of source code. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.Serialization.cs index 4e5997b6b177..8af06357e491 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildResourceRequirements : IUtf8JsonSerializable + public partial class AppPlatformBuildResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cpu)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("memory"u8); writer.WriteStringValue(Memory); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformBuildResourceRequirements DeserializeAppPlatformBuildResourceRequirements(JsonElement element) + internal static AppPlatformBuildResourceRequirements DeserializeAppPlatformBuildResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cpu = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformBuildResourceRequirements DeserializeAppPlatformBuild memory = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildResourceRequirements(cpu.Value, memory.Value, serializedAdditionalRawData); + } + + AppPlatformBuildResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildResourceRequirements model) + { + if (model is null) + { + return null; } - return new AppPlatformBuildResourceRequirements(cpu.Value, memory.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.cs index 897175426ad7..aa2eea1a3702 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResourceRequirements.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Resource request payload of Build Resource. public partial class AppPlatformBuildResourceRequirements { - /// Initializes a new instance of AppPlatformBuildResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildResourceRequirements() { } - /// Initializes a new instance of AppPlatformBuildResourceRequirements. + /// Initializes a new instance of . /// /// Optional Cpu allocated to the build resource. 1 core can be represented by 1 or 1000m. /// The default value is 1, this should not exceed build service agent pool cpu size. @@ -24,10 +30,12 @@ public AppPlatformBuildResourceRequirements() /// Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi or 1024Mi. /// The default value is 2Gi, this should not exceed build service agent pool memory size. /// - internal AppPlatformBuildResourceRequirements(string cpu, string memory) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildResourceRequirements(string cpu, string memory, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultData.Serialization.cs index 64607c12497e..8011bbef3955 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBuildResultData : IUtf8JsonSerializable + public partial class AppPlatformBuildResultData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildResultData DeserializeAppPlatformBuildResultData(JsonElement element) + internal static AppPlatformBuildResultData DeserializeAppPlatformBuildResultData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBuildResultData DeserializeAppPlatformBuildResultData string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBuildResultData DeserializeAppPlatformBuildResultData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildResultData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBuildResultData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildResultData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildResultData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildResultData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildResultData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildResultData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildResultData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildResultData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.Serialization.cs index 708c12320861..0f7887164dbe 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.Serialization.cs @@ -6,20 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildResultLog + public partial class AppPlatformBuildResultLog : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformBuildResultLog DeserializeAppPlatformBuildResultLog(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(BlobUri)) + { + writer.WritePropertyName("blobUrl"u8); + writer.WriteStringValue(BlobUri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformBuildResultLog DeserializeAppPlatformBuildResultLog(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional blobUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blobUrl"u8)) @@ -31,8 +64,61 @@ internal static AppPlatformBuildResultLog DeserializeAppPlatformBuildResultLog(J blobUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformBuildResultLog(blobUri.Value); + return new AppPlatformBuildResultLog(blobUri.Value, serializedAdditionalRawData); + } + + AppPlatformBuildResultLog IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildResultLog(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildResultLog IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildResultLog(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildResultLog model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildResultLog(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildResultLog(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.cs index d35c9644cd3c..2fe4429dc60c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultLog.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models { /// Build result log resource properties payload. public partial class AppPlatformBuildResultLog { - /// Initializes a new instance of AppPlatformBuildResultLog. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformBuildResultLog() { } - /// Initializes a new instance of AppPlatformBuildResultLog. + /// Initializes a new instance of . /// The public download URL of this build result log. - internal AppPlatformBuildResultLog(Uri blobUri) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildResultLog(Uri blobUri, Dictionary serializedAdditionalRawData) { BlobUri = blobUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The public download URL of this build result log. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.Serialization.cs index 8ec044ab319c..c0a12213cae1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildResultProperties : IUtf8JsonSerializable + public partial class AppPlatformBuildResultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("buildPodName"u8); writer.WriteStringValue(BuildPodName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformBuildResultProperties DeserializeAppPlatformBuildResultProperties(JsonElement element) + internal static AppPlatformBuildResultProperties DeserializeAppPlatformBuildResultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static AppPlatformBuildResultProperties DeserializeAppPlatformBuildResu Optional provisioningState = default; Optional buildPodName = default; Optional> buildStages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -74,8 +96,61 @@ internal static AppPlatformBuildResultProperties DeserializeAppPlatformBuildResu buildStages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildResultProperties(name.Value, Optional.ToNullable(provisioningState), buildPodName.Value, Optional.ToList(buildStages), serializedAdditionalRawData); + } + + AppPlatformBuildResultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildResultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildResultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildResultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildResultProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformBuildResultProperties(name.Value, Optional.ToNullable(provisioningState), buildPodName.Value, Optional.ToList(buildStages)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildResultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildResultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.cs index 9fa0a0bdfeec..deb07c547ab9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Build result resource properties payload. public partial class AppPlatformBuildResultProperties { - /// Initializes a new instance of AppPlatformBuildResultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildResultProperties() { BuildStages = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformBuildResultProperties. + /// Initializes a new instance of . /// The name of this build result. /// Provisioning state of the KPack build result. /// The build pod name which can be used to get the build log streaming. /// All of the build stage (init-container and container) resources in build pod. - internal AppPlatformBuildResultProperties(string name, AppPlatformBuildResultProvisioningState? provisioningState, string buildPodName, IReadOnlyList buildStages) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildResultProperties(string name, AppPlatformBuildResultProvisioningState? provisioningState, string buildPodName, IReadOnlyList buildStages, Dictionary serializedAdditionalRawData) { Name = name; ProvisioningState = provisioningState; BuildPodName = buildPodName; BuildStages = buildStages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of this build result. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.Serialization.cs index 18f86617e44d..65a8a2ba8378 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildResultUserSourceInfo : IUtf8JsonSerializable + public partial class AppPlatformBuildResultUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BuildResultId)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformBuildResultUserSourceInfo DeserializeAppPlatformBuildResultUserSourceInfo(JsonElement element) + internal static AppPlatformBuildResultUserSourceInfo DeserializeAppPlatformBuildResultUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static AppPlatformBuildResultUserSourceInfo DeserializeAppPlatformBuild Optional buildResultId = default; string type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("buildResultId"u8)) @@ -56,8 +79,61 @@ internal static AppPlatformBuildResultUserSourceInfo DeserializeAppPlatformBuild version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildResultUserSourceInfo(type, version.Value, buildResultId.Value, serializedAdditionalRawData); + } + + AppPlatformBuildResultUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildResultUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildResultUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildResultUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildResultUserSourceInfo model) + { + if (model is null) + { + return null; } - return new AppPlatformBuildResultUserSourceInfo(type, version.Value, buildResultId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildResultUserSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildResultUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.cs index aea1e47ea0ea..a9b7012204f8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildResultUserSourceInfo.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Reference to a build result. public partial class AppPlatformBuildResultUserSourceInfo : AppPlatformUserSourceInfo { - /// Initializes a new instance of AppPlatformBuildResultUserSourceInfo. + /// Initializes a new instance of . public AppPlatformBuildResultUserSourceInfo() { UserSourceInfoType = "BuildResult"; } - /// Initializes a new instance of AppPlatformBuildResultUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. /// Resource id of an existing succeeded build result under the same Spring instance. - internal AppPlatformBuildResultUserSourceInfo(string userSourceInfoType, string version, string buildResultId) : base(userSourceInfoType, version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildResultUserSourceInfo(string userSourceInfoType, string version, string buildResultId, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, serializedAdditionalRawData) { BuildResultId = buildResultId; UserSourceInfoType = userSourceInfoType ?? "BuildResult"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolData.Serialization.cs index 6ba0be0d4da8..ced6c51376d9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBuildServiceAgentPoolData : IUtf8JsonSerializable + public partial class AppPlatformBuildServiceAgentPoolData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildServiceAgentPoolData DeserializeAppPlatformBuildServiceAgentPoolData(JsonElement element) + internal static AppPlatformBuildServiceAgentPoolData DeserializeAppPlatformBuildServiceAgentPoolData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBuildServiceAgentPoolData DeserializeAppPlatformBuild string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBuildServiceAgentPoolData DeserializeAppPlatformBuild systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildServiceAgentPoolData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBuildServiceAgentPoolData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildServiceAgentPoolData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildServiceAgentPoolData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildServiceAgentPoolData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildServiceAgentPoolData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildServiceAgentPoolData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildServiceAgentPoolData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildServiceAgentPoolData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.Serialization.cs index 9a9ffc197d8b..392fd333f1e9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.Serialization.cs @@ -5,32 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildServiceAgentPoolProperties : IUtf8JsonSerializable + public partial class AppPlatformBuildServiceAgentPoolProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PoolSize)) { writer.WritePropertyName("poolSize"u8); - writer.WriteObjectValue(PoolSize); + if (PoolSize is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PoolSize).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildServiceAgentPoolProperties DeserializeAppPlatformBuildServiceAgentPoolProperties(JsonElement element) + internal static AppPlatformBuildServiceAgentPoolProperties DeserializeAppPlatformBuildServiceAgentPoolProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional provisioningState = default; Optional poolSize = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -47,8 +77,61 @@ internal static AppPlatformBuildServiceAgentPoolProperties DeserializeAppPlatfor poolSize = BuildServiceAgentPoolSizeProperties.DeserializeBuildServiceAgentPoolSizeProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildServiceAgentPoolProperties(provisioningState.Value, poolSize.Value, serializedAdditionalRawData); + } + + AppPlatformBuildServiceAgentPoolProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildServiceAgentPoolProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildServiceAgentPoolProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildServiceAgentPoolProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildServiceAgentPoolProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildServiceAgentPoolProperties(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildServiceAgentPoolProperties(provisioningState.Value, poolSize.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildServiceAgentPoolProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.cs index f088e8c67248..df68e06b1a39 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceAgentPoolProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Build service agent pool properties. public partial class AppPlatformBuildServiceAgentPoolProperties { - /// Initializes a new instance of AppPlatformBuildServiceAgentPoolProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildServiceAgentPoolProperties() { } - /// Initializes a new instance of AppPlatformBuildServiceAgentPoolProperties. + /// Initializes a new instance of . /// Provisioning state of the build service agent pool. /// build service agent pool size properties. - internal AppPlatformBuildServiceAgentPoolProperties(string provisioningState, BuildServiceAgentPoolSizeProperties poolSize) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildServiceAgentPoolProperties(string provisioningState, BuildServiceAgentPoolSizeProperties poolSize, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; PoolSize = poolSize; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the build service agent pool. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceData.Serialization.cs index 44f9388c5646..1a48144f93b5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBuildServiceData : IUtf8JsonSerializable + public partial class AppPlatformBuildServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildServiceData DeserializeAppPlatformBuildServiceData(JsonElement element) + internal static AppPlatformBuildServiceData DeserializeAppPlatformBuildServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBuildServiceData DeserializeAppPlatformBuildServiceDa string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBuildServiceData DeserializeAppPlatformBuildServiceDa systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildServiceData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBuildServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildServiceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildServiceData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildServiceData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.Serialization.cs index 2a826c45f49b..2c9e0eb31428 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildServiceProperties : IUtf8JsonSerializable + public partial class AppPlatformBuildServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KPackVersion)) { @@ -23,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ResourceRequests)) { writer.WritePropertyName("resourceRequests"u8); - writer.WriteObjectValue(ResourceRequests); + if (ResourceRequests is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResourceRequests).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildServiceProperties DeserializeAppPlatformBuildServiceProperties(JsonElement element) + internal static AppPlatformBuildServiceProperties DeserializeAppPlatformBuildServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +66,7 @@ internal static AppPlatformBuildServiceProperties DeserializeAppPlatformBuildSer Optional kPackVersion = default; Optional provisioningState = default; Optional resourceRequests = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kPackVersion"u8)) @@ -62,8 +92,61 @@ internal static AppPlatformBuildServiceProperties DeserializeAppPlatformBuildSer resourceRequests = AppPlatformBuildServiceResourceRequirements.DeserializeAppPlatformBuildServiceResourceRequirements(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildServiceProperties(kPackVersion.Value, Optional.ToNullable(provisioningState), resourceRequests.Value, serializedAdditionalRawData); + } + + AppPlatformBuildServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildServiceProperties(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildServiceProperties(kPackVersion.Value, Optional.ToNullable(provisioningState), resourceRequests.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.cs index 315ec0082079..e3ba4094996a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Build service resource properties payload. public partial class AppPlatformBuildServiceProperties { - /// Initializes a new instance of AppPlatformBuildServiceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildServiceProperties() { } - /// Initializes a new instance of AppPlatformBuildServiceProperties. + /// Initializes a new instance of . /// The installed KPack version in this build service. /// Provisioning state of the KPack build result. /// The runtime resource configuration of this build service. - internal AppPlatformBuildServiceProperties(string kPackVersion, AppPlatformBuildServiceProvisioningState? provisioningState, AppPlatformBuildServiceResourceRequirements resourceRequests) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildServiceProperties(string kPackVersion, AppPlatformBuildServiceProvisioningState? provisioningState, AppPlatformBuildServiceResourceRequirements resourceRequests, Dictionary serializedAdditionalRawData) { KPackVersion = kPackVersion; ProvisioningState = provisioningState; ResourceRequests = resourceRequests; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The installed KPack version in this build service. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.Serialization.cs index e009b63b2d91..50c10b332d10 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.Serialization.cs @@ -5,27 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildServiceResourceRequirements : IUtf8JsonSerializable + public partial class AppPlatformBuildServiceResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformBuildServiceResourceRequirements DeserializeAppPlatformBuildServiceResourceRequirements(JsonElement element) + internal static AppPlatformBuildServiceResourceRequirements DeserializeAppPlatformBuildServiceResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cpu = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -38,8 +61,61 @@ internal static AppPlatformBuildServiceResourceRequirements DeserializeAppPlatfo memory = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildServiceResourceRequirements(cpu.Value, memory.Value, serializedAdditionalRawData); + } + + AppPlatformBuildServiceResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildServiceResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildServiceResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildServiceResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildServiceResourceRequirements model) + { + if (model is null) + { + return null; } - return new AppPlatformBuildServiceResourceRequirements(cpu.Value, memory.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildServiceResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildServiceResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.cs index ccbe78d5e4d4..e74658f88808 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildServiceResourceRequirements.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The runtime resource configuration of this build service. public partial class AppPlatformBuildServiceResourceRequirements { - /// Initializes a new instance of AppPlatformBuildServiceResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildServiceResourceRequirements() { } - /// Initializes a new instance of AppPlatformBuildServiceResourceRequirements. + /// Initializes a new instance of . /// vCPU allocated to the entire build service node pool. /// Memory allocated to the entire build service node pool. - internal AppPlatformBuildServiceResourceRequirements(string cpu, string memory) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildServiceResourceRequirements(string cpu, string memory, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// vCPU allocated to the entire build service node pool. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.Serialization.cs index e2c5f741ba14..337cee63be01 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildStageProperties + public partial class AppPlatformBuildStageProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformBuildStageProperties DeserializeAppPlatformBuildStageProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformBuildStageProperties DeserializeAppPlatformBuildStageProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +65,61 @@ internal static AppPlatformBuildStageProperties DeserializeAppPlatformBuildStage status = new KPackBuildStageProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformBuildStageProperties(name.Value, Optional.ToNullable(status)); + return new AppPlatformBuildStageProperties(name.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + AppPlatformBuildStageProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildStageProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildStageProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildStageProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildStageProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildStageProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildStageProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.cs index 5ae34c835e41..d980a98647d5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildStageProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The build stage (init-container and container) resources in build pod. public partial class AppPlatformBuildStageProperties { - /// Initializes a new instance of AppPlatformBuildStageProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformBuildStageProperties() { } - /// Initializes a new instance of AppPlatformBuildStageProperties. + /// Initializes a new instance of . /// The name of this build stage resource. /// The provisioning state of this build stage resource. - internal AppPlatformBuildStageProperties(string name, KPackBuildStageProvisioningState? status) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildStageProperties(string name, KPackBuildStageProvisioningState? status, Dictionary serializedAdditionalRawData) { Name = name; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of this build stage resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderData.Serialization.cs index baecbff6135b..9b8f2c1c8d30 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBuilderData : IUtf8JsonSerializable + public partial class AppPlatformBuilderData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuilderData DeserializeAppPlatformBuilderData(JsonElement element) + internal static AppPlatformBuilderData DeserializeAppPlatformBuilderData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBuilderData DeserializeAppPlatformBuilderData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBuilderData DeserializeAppPlatformBuilderData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuilderData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBuilderData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuilderData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuilderData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuilderData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuilderData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuilderData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuilderData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuilderData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.Serialization.cs index a2646ddeb0dc..aa30a64ff72f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuilderProperties : IUtf8JsonSerializable + public partial class AppPlatformBuilderProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Stack)) { writer.WritePropertyName("stack"u8); - writer.WriteObjectValue(Stack); + if (Stack is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Stack).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(BuildpackGroups)) { @@ -27,15 +41,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in BuildpackGroups) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformBuilderProperties DeserializeAppPlatformBuilderProperties(JsonElement element) + internal static AppPlatformBuilderProperties DeserializeAppPlatformBuilderProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +78,7 @@ internal static AppPlatformBuilderProperties DeserializeAppPlatformBuilderProper Optional provisioningState = default; Optional stack = default; Optional> buildpackGroups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -77,8 +113,61 @@ internal static AppPlatformBuilderProperties DeserializeAppPlatformBuilderProper buildpackGroups = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuilderProperties(Optional.ToNullable(provisioningState), stack.Value, Optional.ToList(buildpackGroups), serializedAdditionalRawData); + } + + AppPlatformBuilderProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuilderProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuilderProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuilderProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuilderProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformBuilderProperties(Optional.ToNullable(provisioningState), stack.Value, Optional.ToList(buildpackGroups)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuilderProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuilderProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.cs index 9f2087d45e76..f253eac11389 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuilderProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.AppPlatform.Models /// KPack Builder properties payload. public partial class AppPlatformBuilderProperties { - /// Initializes a new instance of AppPlatformBuilderProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuilderProperties() { BuildpackGroups = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformBuilderProperties. + /// Initializes a new instance of . /// Builder provision status. /// Builder cluster stack property. /// Builder buildpack groups. - internal AppPlatformBuilderProperties(AppPlatformBuilderProvisioningState? provisioningState, AppPlatformClusterStackProperties stack, IList buildpackGroups) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuilderProperties(AppPlatformBuilderProvisioningState? provisioningState, AppPlatformClusterStackProperties stack, IList buildpackGroups, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Stack = stack; BuildpackGroups = buildpackGroups; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Builder provision status. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingData.Serialization.cs index 3da983c5f274..97b3c094e8c7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformBuildpackBindingData : IUtf8JsonSerializable + public partial class AppPlatformBuildpackBindingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildpackBindingData DeserializeAppPlatformBuildpackBindingData(JsonElement element) + internal static AppPlatformBuildpackBindingData DeserializeAppPlatformBuildpackBindingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformBuildpackBindingData DeserializeAppPlatformBuildpackB string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformBuildpackBindingData DeserializeAppPlatformBuildpackB systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildpackBindingData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformBuildpackBindingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildpackBindingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildpackBindingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildpackBindingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildpackBindingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildpackBindingData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildpackBindingData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildpackBindingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.Serialization.cs index 229a87a30ec8..176f1301e141 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformBuildpackBindingProperties : IUtf8JsonSerializable + public partial class AppPlatformBuildpackBindingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BindingType)) { @@ -23,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LaunchProperties)) { writer.WritePropertyName("launchProperties"u8); - writer.WriteObjectValue(LaunchProperties); + if (LaunchProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LaunchProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformBuildpackBindingProperties DeserializeAppPlatformBuildpackBindingProperties(JsonElement element) + internal static AppPlatformBuildpackBindingProperties DeserializeAppPlatformBuildpackBindingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +66,7 @@ internal static AppPlatformBuildpackBindingProperties DeserializeAppPlatformBuil Optional bindingType = default; Optional provisioningState = default; Optional launchProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("bindingType"u8)) @@ -66,8 +96,61 @@ internal static AppPlatformBuildpackBindingProperties DeserializeAppPlatformBuil launchProperties = BuildpackBindingLaunchProperties.DeserializeBuildpackBindingLaunchProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformBuildpackBindingProperties(Optional.ToNullable(bindingType), Optional.ToNullable(provisioningState), launchProperties.Value, serializedAdditionalRawData); + } + + AppPlatformBuildpackBindingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformBuildpackBindingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformBuildpackBindingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformBuildpackBindingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformBuildpackBindingProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformBuildpackBindingProperties(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformBuildpackBindingProperties(Optional.ToNullable(bindingType), Optional.ToNullable(provisioningState), launchProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformBuildpackBindingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.cs index e041a7ac497f..f3d912a4e3e1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformBuildpackBindingProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Properties of a buildpack binding. public partial class AppPlatformBuildpackBindingProperties { - /// Initializes a new instance of AppPlatformBuildpackBindingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformBuildpackBindingProperties() { } - /// Initializes a new instance of AppPlatformBuildpackBindingProperties. + /// Initializes a new instance of . /// Buildpack Binding Type. /// State of the Buildpack Binding. /// The object describes the buildpack binding launch properties. - internal AppPlatformBuildpackBindingProperties(BuildpackBindingType? bindingType, BuildpackBindingProvisioningState? provisioningState, BuildpackBindingLaunchProperties launchProperties) + /// Keeps track of any properties unknown to the library. + internal AppPlatformBuildpackBindingProperties(BuildpackBindingType? bindingType, BuildpackBindingProvisioningState? provisioningState, BuildpackBindingLaunchProperties launchProperties, Dictionary serializedAdditionalRawData) { BindingType = bindingType; ProvisioningState = provisioningState; LaunchProperties = launchProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Buildpack Binding Type. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateData.Serialization.cs index bed2a43e1c6f..0145f07e0927 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformCertificateData : IUtf8JsonSerializable + public partial class AppPlatformCertificateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformCertificateData DeserializeAppPlatformCertificateData(JsonElement element) + internal static AppPlatformCertificateData DeserializeAppPlatformCertificateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformCertificateData DeserializeAppPlatformCertificateData string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformCertificateData DeserializeAppPlatformCertificateData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformCertificateData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformCertificateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCertificateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCertificateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCertificateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCertificateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCertificateData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformCertificateData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCertificateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.Serialization.cs index 4a4c8899ce70..81433355eea1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformCertificateProperties : IUtf8JsonSerializable + public partial class AppPlatformCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CertificatePropertiesType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformCertificateProperties DeserializeAppPlatformCertificateProperties(JsonElement element) + internal static AppPlatformCertificateProperties DeserializeAppPlatformCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,7 +56,145 @@ internal static AppPlatformCertificateProperties DeserializeAppPlatformCertifica case "KeyVaultCertificate": return AppPlatformKeyVaultCertificateProperties.DeserializeAppPlatformKeyVaultCertificateProperties(element); } } - return UnknownCertificateProperties.DeserializeUnknownCertificateProperties(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional thumbprint = default; + Optional issuer = default; + Optional issuedDate = default; + Optional expirationDate = default; + Optional activateDate = default; + Optional subjectName = default; + Optional> dnsNames = default; + Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("thumbprint"u8)) + { + thumbprint = property.Value.GetString(); + continue; + } + if (property.NameEquals("issuer"u8)) + { + issuer = property.Value.GetString(); + continue; + } + if (property.NameEquals("issuedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + issuedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("expirationDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("activateDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activateDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("subjectName"u8)) + { + subjectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("dnsNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dnsNames = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AppPlatformCertificateProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownCertificateProperties(type, thumbprint.Value, issuer.Value, Optional.ToNullable(issuedDate), Optional.ToNullable(expirationDate), Optional.ToNullable(activateDate), subjectName.Value, Optional.ToList(dnsNames), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AppPlatformCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCertificateProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.cs index f6e1df5814b1..137e45b03589 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCertificateProperties.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { @@ -16,15 +17,19 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownCertificateProperties))] public abstract partial class AppPlatformCertificateProperties { - /// Initializes a new instance of AppPlatformCertificateProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AppPlatformCertificateProperties() { DnsNames = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformCertificateProperties. + /// Initializes a new instance of . /// The type of the certificate source. /// The thumbprint of certificate. /// The issuer of certificate. @@ -34,7 +39,8 @@ protected AppPlatformCertificateProperties() /// The subject name of certificate. /// The domain list of certificate. /// Provisioning state of the Certificate. - internal AppPlatformCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) { CertificatePropertiesType = certificatePropertiesType; Thumbprint = thumbprint; @@ -45,6 +51,7 @@ internal AppPlatformCertificateProperties(string certificatePropertiesType, stri SubjectName = subjectName; DnsNames = dnsNames; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the certificate source. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.Serialization.cs index 19213ffe3cc4..5a101f0a9dcc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformClusterStackProperties : IUtf8JsonSerializable + public partial class AppPlatformClusterStackProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformClusterStackProperties DeserializeAppPlatformClusterStackProperties(JsonElement element) + internal static AppPlatformClusterStackProperties DeserializeAppPlatformClusterStackProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformClusterStackProperties DeserializeAppPlatformClusterS version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformClusterStackProperties(id.Value, version.Value, serializedAdditionalRawData); + } + + AppPlatformClusterStackProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformClusterStackProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformClusterStackProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformClusterStackProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformClusterStackProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformClusterStackProperties(id.Value, version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformClusterStackProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformClusterStackProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.cs index 683d4f0dd6fe..096b75f24b73 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformClusterStackProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// KPack ClusterStack properties payload. public partial class AppPlatformClusterStackProperties { - /// Initializes a new instance of AppPlatformClusterStackProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformClusterStackProperties() { } - /// Initializes a new instance of AppPlatformClusterStackProperties. + /// Initializes a new instance of . /// Id of the ClusterStack. /// Version of the ClusterStack. - internal AppPlatformClusterStackProperties(string id, string version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformClusterStackProperties(string id, string version, Dictionary serializedAdditionalRawData) { Id = id; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of the ClusterStack. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerData.Serialization.cs index 09ae6b8dc7bf..59544345e74e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformConfigServerData : IUtf8JsonSerializable + public partial class AppPlatformConfigServerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformConfigServerData DeserializeAppPlatformConfigServerData(JsonElement element) + internal static AppPlatformConfigServerData DeserializeAppPlatformConfigServerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformConfigServerData DeserializeAppPlatformConfigServerDa string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformConfigServerData DeserializeAppPlatformConfigServerDa systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigServerData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformConfigServerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigServerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigServerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigServerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigServerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigServerData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformConfigServerData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigServerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.Serialization.cs index 07bfed887440..25fad65f1cdc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigServerGitProperty : IUtf8JsonSerializable + public partial class AppPlatformConfigServerGitProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Repositories)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Repositories) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -74,11 +87,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("strictHostKeyChecking"u8); writer.WriteBooleanValue(IsHostKeyCheckingStrict.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformConfigServerGitProperty DeserializeAppPlatformConfigServerGitProperty(JsonElement element) + internal static AppPlatformConfigServerGitProperty DeserializeAppPlatformConfigServerGitProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,6 +120,7 @@ internal static AppPlatformConfigServerGitProperty DeserializeAppPlatformConfigS Optional hostKeyAlgorithm = default; Optional privateKey = default; Optional strictHostKeyChecking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("repositories"u8)) @@ -167,8 +195,61 @@ internal static AppPlatformConfigServerGitProperty DeserializeAppPlatformConfigS strictHostKeyChecking = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigServerGitProperty(Optional.ToList(repositories), uri, label.Value, Optional.ToList(searchPaths), username.Value, password.Value, hostKey.Value, hostKeyAlgorithm.Value, privateKey.Value, Optional.ToNullable(strictHostKeyChecking), serializedAdditionalRawData); + } + + AppPlatformConfigServerGitProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigServerGitProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigServerGitProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigServerGitProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigServerGitProperty model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigServerGitProperty(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformConfigServerGitProperty(Optional.ToList(repositories), uri, label.Value, Optional.ToList(searchPaths), username.Value, password.Value, hostKey.Value, hostKeyAlgorithm.Value, privateKey.Value, Optional.ToNullable(strictHostKeyChecking)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigServerGitProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.cs index 350f977204b4..4bae8c45a98c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerGitProperty.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Property of git. public partial class AppPlatformConfigServerGitProperty { - /// Initializes a new instance of AppPlatformConfigServerGitProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// URI of the repository. /// is null. public AppPlatformConfigServerGitProperty(Uri uri) @@ -26,7 +29,7 @@ public AppPlatformConfigServerGitProperty(Uri uri) SearchPaths = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformConfigServerGitProperty. + /// Initializes a new instance of . /// Repositories of git. /// URI of the repository. /// Label of the repository. @@ -37,7 +40,8 @@ public AppPlatformConfigServerGitProperty(Uri uri) /// SshKey algorithm of git repository. /// Private sshKey algorithm of git repository. /// Strict host key checking or not. - internal AppPlatformConfigServerGitProperty(IList repositories, Uri uri, string label, IList searchPaths, string username, string password, string hostKey, string hostKeyAlgorithm, string privateKey, bool? isHostKeyCheckingStrict) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigServerGitProperty(IList repositories, Uri uri, string label, IList searchPaths, string username, string password, string hostKey, string hostKeyAlgorithm, string privateKey, bool? isHostKeyCheckingStrict, Dictionary serializedAdditionalRawData) { Repositories = repositories; Uri = uri; @@ -49,6 +53,12 @@ internal AppPlatformConfigServerGitProperty(IList Initializes a new instance of for deserialization. + internal AppPlatformConfigServerGitProperty() + { } /// Repositories of git. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.Serialization.cs index 85935a0b32d1..053329e1c256 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.Serialization.cs @@ -5,31 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigServerProperties : IUtf8JsonSerializable + public partial class AppPlatformConfigServerProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } if (Optional.IsDefined(ConfigServer)) { writer.WritePropertyName("configServer"u8); - writer.WriteObjectValue(ConfigServer); + if (ConfigServer is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConfigServer).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformConfigServerProperties DeserializeAppPlatformConfigServerProperties(JsonElement element) + internal static AppPlatformConfigServerProperties DeserializeAppPlatformConfigServerProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +73,7 @@ internal static AppPlatformConfigServerProperties DeserializeAppPlatformConfigSe Optional provisioningState = default; Optional error = default; Optional configServer = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -66,8 +103,61 @@ internal static AppPlatformConfigServerProperties DeserializeAppPlatformConfigSe configServer = ConfigServerSettings.DeserializeConfigServerSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigServerProperties(Optional.ToNullable(provisioningState), error.Value, configServer.Value, serializedAdditionalRawData); + } + + AppPlatformConfigServerProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigServerProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigServerProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigServerProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigServerProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformConfigServerProperties(Optional.ToNullable(provisioningState), error.Value, configServer.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigServerProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigServerProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.cs index 63fa356ba0ed..ae12352f00ee 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigServerProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Config server git properties payload. public partial class AppPlatformConfigServerProperties { - /// Initializes a new instance of AppPlatformConfigServerProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformConfigServerProperties() { } - /// Initializes a new instance of AppPlatformConfigServerProperties. + /// Initializes a new instance of . /// State of the config server. /// Error when apply config server settings. /// Settings of config server. - internal AppPlatformConfigServerProperties(AppPlatformConfigServerState? provisioningState, AppPlatformErrorInfo error, ConfigServerSettings configServer) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigServerProperties(AppPlatformConfigServerState? provisioningState, AppPlatformErrorInfo error, ConfigServerSettings configServer, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Error = error; ConfigServer = configServer; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the config server. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceData.Serialization.cs index 8117c2b7e686..8e00c988d665 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformConfigurationServiceData : IUtf8JsonSerializable + public partial class AppPlatformConfigurationServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformConfigurationServiceData DeserializeAppPlatformConfigurationServiceData(JsonElement element) + internal static AppPlatformConfigurationServiceData DeserializeAppPlatformConfigurationServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformConfigurationServiceData DeserializeAppPlatformConfig string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformConfigurationServiceData DeserializeAppPlatformConfig systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigurationServiceData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformConfigurationServiceData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.Serialization.cs index 88583eeac635..ab92accbd3f1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.Serialization.cs @@ -5,22 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceGitReposValidationMessages + public partial class AppPlatformConfigurationServiceGitReposValidationMessages : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformConfigurationServiceGitReposValidationMessages DeserializeAppPlatformConfigurationServiceGitReposValidationMessages(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Messages)) + { + writer.WritePropertyName("messages"u8); + writer.WriteStartArray(); + foreach (var item in Messages) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformConfigurationServiceGitReposValidationMessages DeserializeAppPlatformConfigurationServiceGitReposValidationMessages(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional> messages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +85,61 @@ internal static AppPlatformConfigurationServiceGitReposValidationMessages Deseri messages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformConfigurationServiceGitReposValidationMessages(name.Value, Optional.ToList(messages)); + return new AppPlatformConfigurationServiceGitReposValidationMessages(name.Value, Optional.ToList(messages), serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceGitReposValidationMessages IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceGitReposValidationMessages(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceGitReposValidationMessages IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceGitReposValidationMessages(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceGitReposValidationMessages model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceGitReposValidationMessages(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceGitReposValidationMessages(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.cs index 1d2701cc0ea1..536d1ac6c9b5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitReposValidationMessages.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Validate messages of the configuration service git repositories. public partial class AppPlatformConfigurationServiceGitReposValidationMessages { - /// Initializes a new instance of AppPlatformConfigurationServiceGitReposValidationMessages. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformConfigurationServiceGitReposValidationMessages() { Messages = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformConfigurationServiceGitReposValidationMessages. + /// Initializes a new instance of . /// The name of the configuration service git repository. /// Detailed validation messages. - internal AppPlatformConfigurationServiceGitReposValidationMessages(string name, IReadOnlyList messages) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceGitReposValidationMessages(string name, IReadOnlyList messages, Dictionary serializedAdditionalRawData) { Name = name; Messages = messages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the configuration service git repository. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.Serialization.cs index 7343ff55afd7..cc9361d51463 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceGitRepository : IUtf8JsonSerializable + public partial class AppPlatformConfigurationServiceGitRepository : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -70,11 +76,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("strictHostKeyChecking"u8); writer.WriteBooleanValue(IsHostKeyCheckingStrict.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformConfigurationServiceGitRepository DeserializeAppPlatformConfigurationServiceGitRepository(JsonElement element) + internal static AppPlatformConfigurationServiceGitRepository DeserializeAppPlatformConfigurationServiceGitRepository(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,6 +110,7 @@ internal static AppPlatformConfigurationServiceGitRepository DeserializeAppPlatf Optional hostKeyAlgorithm = default; Optional privateKey = default; Optional strictHostKeyChecking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -165,8 +186,61 @@ internal static AppPlatformConfigurationServiceGitRepository DeserializeAppPlatf strictHostKeyChecking = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigurationServiceGitRepository(name, patterns, uri, label, Optional.ToList(searchPaths), username.Value, password.Value, hostKey.Value, hostKeyAlgorithm.Value, privateKey.Value, Optional.ToNullable(strictHostKeyChecking), serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceGitRepository IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceGitRepository(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceGitRepository IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceGitRepository(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceGitRepository model) + { + if (model is null) + { + return null; } - return new AppPlatformConfigurationServiceGitRepository(name, patterns, uri, label, Optional.ToList(searchPaths), username.Value, password.Value, hostKey.Value, hostKeyAlgorithm.Value, privateKey.Value, Optional.ToNullable(strictHostKeyChecking)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceGitRepository(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceGitRepository(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.cs index 7f9d43c3382a..3746ac1bf911 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitRepository.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Git repository property payload for Application Configuration Service. public partial class AppPlatformConfigurationServiceGitRepository { - /// Initializes a new instance of AppPlatformConfigurationServiceGitRepository. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the repository. /// Collection of patterns of the repository. /// URI of the repository. @@ -35,7 +38,7 @@ public AppPlatformConfigurationServiceGitRepository(string name, IEnumerable(); } - /// Initializes a new instance of AppPlatformConfigurationServiceGitRepository. + /// Initializes a new instance of . /// Name of the repository. /// Collection of patterns of the repository. /// URI of the repository. @@ -47,7 +50,8 @@ public AppPlatformConfigurationServiceGitRepository(string name, IEnumerable SshKey algorithm of git repository. /// Private sshKey algorithm of git repository. /// Strict host key checking or not. - internal AppPlatformConfigurationServiceGitRepository(string name, IList patterns, Uri uri, string label, IList searchPaths, string username, string password, string hostKey, string hostKeyAlgorithm, string privateKey, bool? isHostKeyCheckingStrict) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceGitRepository(string name, IList patterns, Uri uri, string label, IList searchPaths, string username, string password, string hostKey, string hostKeyAlgorithm, string privateKey, bool? isHostKeyCheckingStrict, Dictionary serializedAdditionalRawData) { Name = name; Patterns = patterns; @@ -60,6 +64,12 @@ internal AppPlatformConfigurationServiceGitRepository(string name, IList HostKeyAlgorithm = hostKeyAlgorithm; PrivateKey = privateKey; IsHostKeyCheckingStrict = isHostKeyCheckingStrict; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppPlatformConfigurationServiceGitRepository() + { } /// Name of the repository. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.Serialization.cs index c606f4905f30..e2070b642f7b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceGitValidateResult + public partial class AppPlatformConfigurationServiceGitValidateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformConfigurationServiceGitValidateResult DeserializeAppPlatformConfigurationServiceGitValidateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsValid)) + { + writer.WritePropertyName("isValid"u8); + writer.WriteBooleanValue(IsValid.Value); + } + if (Optional.IsCollectionDefined(GitReposValidationResult)) + { + writer.WritePropertyName("gitReposValidationResult"u8); + writer.WriteStartArray(); + foreach (var item in GitReposValidationResult) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformConfigurationServiceGitValidateResult DeserializeAppPlatformConfigurationServiceGitValidateResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isValid = default; Optional> gitReposValidationResult = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isValid"u8)) @@ -46,8 +96,61 @@ internal static AppPlatformConfigurationServiceGitValidateResult DeserializeAppP gitReposValidationResult = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformConfigurationServiceGitValidateResult(Optional.ToNullable(isValid), Optional.ToList(gitReposValidationResult)); + return new AppPlatformConfigurationServiceGitValidateResult(Optional.ToNullable(isValid), Optional.ToList(gitReposValidationResult), serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceGitValidateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceGitValidateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceGitValidateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceGitValidateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceGitValidateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceGitValidateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceGitValidateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.cs index 951eb4d20779..578b58e4b23a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceGitValidateResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Validation result for configuration service settings. public partial class AppPlatformConfigurationServiceGitValidateResult { - /// Initializes a new instance of AppPlatformConfigurationServiceGitValidateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformConfigurationServiceGitValidateResult() { GitReposValidationResult = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformConfigurationServiceGitValidateResult. + /// Initializes a new instance of . /// Indicate if the configuration service settings are valid. /// The detail validation results. - internal AppPlatformConfigurationServiceGitValidateResult(bool? isValid, IReadOnlyList gitReposValidationResult) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceGitValidateResult(bool? isValid, IReadOnlyList gitReposValidationResult, Dictionary serializedAdditionalRawData) { IsValid = isValid; GitReposValidationResult = gitReposValidationResult; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicate if the configuration service settings are valid. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.Serialization.cs index 26b1cccc08c7..f58649c9b356 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceInstance + public partial class AppPlatformConfigurationServiceInstance : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformConfigurationServiceInstance DeserializeAppPlatformConfigurationServiceInstance(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformConfigurationServiceInstance DeserializeAppPlatformConfigurationServiceInstance(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static AppPlatformConfigurationServiceInstance DeserializeAppPlatformCo status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformConfigurationServiceInstance(name.Value, status.Value); + return new AppPlatformConfigurationServiceInstance(name.Value, status.Value, serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceInstance IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceInstance(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceInstance IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceInstance(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceInstance model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceInstance(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceInstance(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.cs index 9ee6612baba7..e9dc41cd92ef 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceInstance.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Collection of instances belong to the Application Configuration Service. public partial class AppPlatformConfigurationServiceInstance { - /// Initializes a new instance of AppPlatformConfigurationServiceInstance. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformConfigurationServiceInstance() { } - /// Initializes a new instance of AppPlatformConfigurationServiceInstance. + /// Initializes a new instance of . /// Name of the Application Configuration Service instance. /// Status of the Application Configuration Service instance. - internal AppPlatformConfigurationServiceInstance(string name, string status) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceInstance(string name, string status, Dictionary serializedAdditionalRawData) { Name = name; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Application Configuration Service instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.Serialization.cs index d30d0490fba7..4aa30357e0c0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.Serialization.cs @@ -5,27 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceProperties : IUtf8JsonSerializable + public partial class AppPlatformConfigurationServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Settings)) { writer.WritePropertyName("settings"u8); - writer.WriteObjectValue(Settings); + if (Settings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Settings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformConfigurationServiceProperties DeserializeAppPlatformConfigurationServiceProperties(JsonElement element) + internal static AppPlatformConfigurationServiceProperties DeserializeAppPlatformConfigurationServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +62,7 @@ internal static AppPlatformConfigurationServiceProperties DeserializeAppPlatform Optional resourceRequests = default; Optional> instances = default; Optional settings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -77,8 +106,61 @@ internal static AppPlatformConfigurationServiceProperties DeserializeAppPlatform settings = AppPlatformConfigurationServiceSettings.DeserializeAppPlatformConfigurationServiceSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigurationServiceProperties(Optional.ToNullable(provisioningState), resourceRequests.Value, Optional.ToList(instances), settings.Value, serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceProperties(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformConfigurationServiceProperties(Optional.ToNullable(provisioningState), resourceRequests.Value, Optional.ToList(instances), settings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.cs index 12882da28b03..ca33f3024eae 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Application Configuration Service properties payload. public partial class AppPlatformConfigurationServiceProperties { - /// Initializes a new instance of AppPlatformConfigurationServiceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformConfigurationServiceProperties() { Instances = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformConfigurationServiceProperties. + /// Initializes a new instance of . /// State of the Application Configuration Service. /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Application Configuration Service. /// The settings of Application Configuration Service. - internal AppPlatformConfigurationServiceProperties(AppPlatformConfigurationServiceProvisioningState? provisioningState, AppPlatformConfigurationServiceRequirements resourceRequests, IReadOnlyList instances, AppPlatformConfigurationServiceSettings settings) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceProperties(AppPlatformConfigurationServiceProvisioningState? provisioningState, AppPlatformConfigurationServiceRequirements resourceRequests, IReadOnlyList instances, AppPlatformConfigurationServiceSettings settings, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; ResourceRequests = resourceRequests; Instances = instances; Settings = settings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the Application Configuration Service. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.Serialization.cs index f521fd788329..f557b78dd8f7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceRequirements + public partial class AppPlatformConfigurationServiceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformConfigurationServiceRequirements DeserializeAppPlatformConfigurationServiceRequirements(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformConfigurationServiceRequirements DeserializeAppPlatformConfigurationServiceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AppPlatformConfigurationServiceRequirements DeserializeAppPlatfo Optional cpu = default; Optional memory = default; Optional instanceCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -42,8 +71,61 @@ internal static AppPlatformConfigurationServiceRequirements DeserializeAppPlatfo instanceCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformConfigurationServiceRequirements(cpu.Value, memory.Value, Optional.ToNullable(instanceCount)); + return new AppPlatformConfigurationServiceRequirements(cpu.Value, memory.Value, Optional.ToNullable(instanceCount), serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceRequirements model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.cs index 5050d7a93d43..fcab58489370 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceRequirements.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Resource request payload of Application Configuration Service. public partial class AppPlatformConfigurationServiceRequirements { - /// Initializes a new instance of AppPlatformConfigurationServiceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformConfigurationServiceRequirements() { } - /// Initializes a new instance of AppPlatformConfigurationServiceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Application Configuration Service instance. /// Memory allocated to each Application Configuration Service instance. /// Instance count of the Application Configuration Service. - internal AppPlatformConfigurationServiceRequirements(string cpu, string memory, int? instanceCount) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceRequirements(string cpu, string memory, int? instanceCount, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; InstanceCount = instanceCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cpu allocated to each Application Configuration Service instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.Serialization.cs index c646fb8da4ea..942dcaa77fd0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceSettings : IUtf8JsonSerializable + public partial class AppPlatformConfigurationServiceSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GitProperty)) { writer.WritePropertyName("gitProperty"u8); - writer.WriteObjectValue(GitProperty); + if (GitProperty is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitProperty).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformConfigurationServiceSettings DeserializeAppPlatformConfigurationServiceSettings(JsonElement element) + internal static AppPlatformConfigurationServiceSettings DeserializeAppPlatformConfigurationServiceSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional gitProperty = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gitProperty"u8)) @@ -41,8 +71,61 @@ internal static AppPlatformConfigurationServiceSettings DeserializeAppPlatformCo gitProperty = ConfigurationServiceGitProperty.DeserializeConfigurationServiceGitProperty(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformConfigurationServiceSettings(gitProperty.Value, serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceSettings(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformConfigurationServiceSettings(gitProperty.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.cs index 83306dfb4c83..74b04ed394bc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models @@ -12,16 +13,21 @@ namespace Azure.ResourceManager.AppPlatform.Models /// The settings of Application Configuration Service. public partial class AppPlatformConfigurationServiceSettings { - /// Initializes a new instance of AppPlatformConfigurationServiceSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformConfigurationServiceSettings() { } - /// Initializes a new instance of AppPlatformConfigurationServiceSettings. + /// Initializes a new instance of . /// Property of git environment. - internal AppPlatformConfigurationServiceSettings(ConfigurationServiceGitProperty gitProperty) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceSettings(ConfigurationServiceGitProperty gitProperty, Dictionary serializedAdditionalRawData) { GitProperty = gitProperty; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Property of git environment. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.Serialization.cs index 954642b6c7d6..e9cd90b1674c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformConfigurationServiceSettingsValidateResult + public partial class AppPlatformConfigurationServiceSettingsValidateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformConfigurationServiceSettingsValidateResult DeserializeAppPlatformConfigurationServiceSettingsValidateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(GitPropertyValidationResult)) + { + writer.WritePropertyName("gitPropertyValidationResult"u8); + if (GitPropertyValidationResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitPropertyValidationResult).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformConfigurationServiceSettingsValidateResult DeserializeAppPlatformConfigurationServiceSettingsValidateResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional gitPropertyValidationResult = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gitPropertyValidationResult"u8)) @@ -30,8 +71,61 @@ internal static AppPlatformConfigurationServiceSettingsValidateResult Deserializ gitPropertyValidationResult = AppPlatformConfigurationServiceGitValidateResult.DeserializeAppPlatformConfigurationServiceGitValidateResult(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformConfigurationServiceSettingsValidateResult(gitPropertyValidationResult.Value); + return new AppPlatformConfigurationServiceSettingsValidateResult(gitPropertyValidationResult.Value, serializedAdditionalRawData); + } + + AppPlatformConfigurationServiceSettingsValidateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformConfigurationServiceSettingsValidateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformConfigurationServiceSettingsValidateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformConfigurationServiceSettingsValidateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformConfigurationServiceSettingsValidateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformConfigurationServiceSettingsValidateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformConfigurationServiceSettingsValidateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.cs index e1e3797de8e1..4323fb49d362 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformConfigurationServiceSettingsValidateResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Validation result for configuration service settings. public partial class AppPlatformConfigurationServiceSettingsValidateResult { - /// Initializes a new instance of AppPlatformConfigurationServiceSettingsValidateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformConfigurationServiceSettingsValidateResult() { } - /// Initializes a new instance of AppPlatformConfigurationServiceSettingsValidateResult. + /// Initializes a new instance of . /// Validation result for configuration service settings. - internal AppPlatformConfigurationServiceSettingsValidateResult(AppPlatformConfigurationServiceGitValidateResult gitPropertyValidationResult) + /// Keeps track of any properties unknown to the library. + internal AppPlatformConfigurationServiceSettingsValidateResult(AppPlatformConfigurationServiceGitValidateResult gitPropertyValidationResult, Dictionary serializedAdditionalRawData) { GitPropertyValidationResult = gitPropertyValidationResult; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Validation result for configuration service settings. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.Serialization.cs index b5b6ceb1a671..a64e107aa865 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformContentCertificateProperties : IUtf8JsonSerializable + public partial class AppPlatformContentCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Content)) { @@ -24,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(CertificatePropertiesType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformContentCertificateProperties DeserializeAppPlatformContentCertificateProperties(JsonElement element) + internal static AppPlatformContentCertificateProperties DeserializeAppPlatformContentCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +63,7 @@ internal static AppPlatformContentCertificateProperties DeserializeAppPlatformCo Optional subjectName = default; Optional> dnsNames = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("content"u8)) @@ -120,8 +141,61 @@ internal static AppPlatformContentCertificateProperties DeserializeAppPlatformCo provisioningState = new AppPlatformCertificateProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformContentCertificateProperties(type, thumbprint.Value, issuer.Value, Optional.ToNullable(issuedDate), Optional.ToNullable(expirationDate), Optional.ToNullable(activateDate), subjectName.Value, Optional.ToList(dnsNames), Optional.ToNullable(provisioningState), content.Value, serializedAdditionalRawData); + } + + AppPlatformContentCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformContentCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformContentCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformContentCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformContentCertificateProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformContentCertificateProperties(type, thumbprint.Value, issuer.Value, Optional.ToNullable(issuedDate), Optional.ToNullable(expirationDate), Optional.ToNullable(activateDate), subjectName.Value, Optional.ToList(dnsNames), Optional.ToNullable(provisioningState), content.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformContentCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformContentCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.cs index 9633d5506285..fe78e8c3ba0e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformContentCertificateProperties.cs @@ -13,13 +13,13 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Properties of certificate imported from key vault. public partial class AppPlatformContentCertificateProperties : AppPlatformCertificateProperties { - /// Initializes a new instance of AppPlatformContentCertificateProperties. + /// Initializes a new instance of . public AppPlatformContentCertificateProperties() { CertificatePropertiesType = "ContentCertificate"; } - /// Initializes a new instance of AppPlatformContentCertificateProperties. + /// Initializes a new instance of . /// The type of the certificate source. /// The thumbprint of certificate. /// The issuer of certificate. @@ -30,7 +30,8 @@ public AppPlatformContentCertificateProperties() /// The domain list of certificate. /// Provisioning state of the Certificate. /// The content of uploaded certificate. - internal AppPlatformContentCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState, string content) : base(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames, provisioningState) + /// Keeps track of any properties unknown to the library. + internal AppPlatformContentCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState, string content, Dictionary serializedAdditionalRawData) : base(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames, provisioningState, serializedAdditionalRawData) { Content = content; CertificatePropertiesType = certificatePropertiesType ?? "ContentCertificate"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.Serialization.cs index fb189c6ec5ae..502555e138ee 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformCustomContainer : IUtf8JsonSerializable + public partial class AppPlatformCustomContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Server)) { @@ -49,18 +56,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ImageRegistryCredential)) { writer.WritePropertyName("imageRegistryCredential"u8); - writer.WriteObjectValue(ImageRegistryCredential); + if (ImageRegistryCredential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageRegistryCredential).Serialize(writer, options); + } } if (Optional.IsDefined(LanguageFramework)) { writer.WritePropertyName("languageFramework"u8); writer.WriteStringValue(LanguageFramework); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformCustomContainer DeserializeAppPlatformCustomContainer(JsonElement element) + internal static AppPlatformCustomContainer DeserializeAppPlatformCustomContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +99,7 @@ internal static AppPlatformCustomContainer DeserializeAppPlatformCustomContainer Optional> args = default; Optional imageRegistryCredential = default; Optional languageFramework = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("server"u8)) @@ -125,8 +154,61 @@ internal static AppPlatformCustomContainer DeserializeAppPlatformCustomContainer languageFramework = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformCustomContainer(server.Value, containerImage.Value, Optional.ToList(command), Optional.ToList(args), imageRegistryCredential.Value, languageFramework.Value, serializedAdditionalRawData); + } + + AppPlatformCustomContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCustomContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCustomContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCustomContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCustomContainer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCustomContainer(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformCustomContainer(server.Value, containerImage.Value, Optional.ToList(command), Optional.ToList(args), imageRegistryCredential.Value, languageFramework.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCustomContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.cs index 0ce0bddeed31..6ea53e33be8c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,25 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Custom container payload. public partial class AppPlatformCustomContainer { - /// Initializes a new instance of AppPlatformCustomContainer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformCustomContainer() { Command = new ChangeTrackingList(); Args = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformCustomContainer. + /// Initializes a new instance of . /// The name of the registry that contains the container image. /// Container image of the custom container. This should be in the form of <repository>:<tag> without the server name of the registry. /// Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. /// Arguments to the entrypoint. The docker image's CMD is used if this is not provided. /// Credential of the image registry. /// Language framework of the container image uploaded. - internal AppPlatformCustomContainer(string server, string containerImage, IList command, IList args, AppPlatformImageRegistryCredential imageRegistryCredential, string languageFramework) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCustomContainer(string server, string containerImage, IList command, IList args, AppPlatformImageRegistryCredential imageRegistryCredential, string languageFramework, Dictionary serializedAdditionalRawData) { Server = server; ContainerImage = containerImage; @@ -35,6 +40,7 @@ internal AppPlatformCustomContainer(string server, string containerImage, IList< Args = args; ImageRegistryCredential = imageRegistryCredential; LanguageFramework = languageFramework; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the registry that contains the container image. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.Serialization.cs index 599b0c515782..ef95e1d7cf96 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformCustomContainerUserSourceInfo : IUtf8JsonSerializable + public partial class AppPlatformCustomContainerUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CustomContainer)) { writer.WritePropertyName("customContainer"u8); - writer.WriteObjectValue(CustomContainer); + if (CustomContainer is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomContainer).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(UserSourceInfoType); @@ -27,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformCustomContainerUserSourceInfo DeserializeAppPlatformCustomContainerUserSourceInfo(JsonElement element) + internal static AppPlatformCustomContainerUserSourceInfo DeserializeAppPlatformCustomContainerUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static AppPlatformCustomContainerUserSourceInfo DeserializeAppPlatformC Optional customContainer = default; string type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("customContainer"u8)) @@ -60,8 +90,61 @@ internal static AppPlatformCustomContainerUserSourceInfo DeserializeAppPlatformC version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformCustomContainerUserSourceInfo(type, version.Value, customContainer.Value, serializedAdditionalRawData); + } + + AppPlatformCustomContainerUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCustomContainerUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCustomContainerUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCustomContainerUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCustomContainerUserSourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCustomContainerUserSourceInfo(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformCustomContainerUserSourceInfo(type, version.Value, customContainer.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCustomContainerUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.cs index a2c1b8c73f35..0db6fafa5359 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomContainerUserSourceInfo.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Custom container user source info. public partial class AppPlatformCustomContainerUserSourceInfo : AppPlatformUserSourceInfo { - /// Initializes a new instance of AppPlatformCustomContainerUserSourceInfo. + /// Initializes a new instance of . public AppPlatformCustomContainerUserSourceInfo() { UserSourceInfoType = "Container"; } - /// Initializes a new instance of AppPlatformCustomContainerUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. /// Custom container payload. - internal AppPlatformCustomContainerUserSourceInfo(string userSourceInfoType, string version, AppPlatformCustomContainer customContainer) : base(userSourceInfoType, version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCustomContainerUserSourceInfo(string userSourceInfoType, string version, AppPlatformCustomContainer customContainer, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, serializedAdditionalRawData) { CustomContainer = customContainer; UserSourceInfoType = userSourceInfoType ?? "Container"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainData.Serialization.cs index 0cf8996b9658..3c195378a317 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformCustomDomainData : IUtf8JsonSerializable + public partial class AppPlatformCustomDomainData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformCustomDomainData DeserializeAppPlatformCustomDomainData(JsonElement element) + internal static AppPlatformCustomDomainData DeserializeAppPlatformCustomDomainData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformCustomDomainData DeserializeAppPlatformCustomDomainDa string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformCustomDomainData DeserializeAppPlatformCustomDomainDa systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformCustomDomainData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformCustomDomainData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCustomDomainData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCustomDomainData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCustomDomainData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCustomDomainData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCustomDomainData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformCustomDomainData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCustomDomainData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.Serialization.cs index c94adbee735e..0df61da2305c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformCustomDomainProperties : IUtf8JsonSerializable + public partial class AppPlatformCustomDomainProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Thumbprint)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certName"u8); writer.WriteStringValue(CertName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformCustomDomainProperties DeserializeAppPlatformCustomDomainProperties(JsonElement element) + internal static AppPlatformCustomDomainProperties DeserializeAppPlatformCustomDomainProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static AppPlatformCustomDomainProperties DeserializeAppPlatformCustomDo Optional appName = default; Optional certName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("thumbprint"u8)) @@ -64,8 +87,61 @@ internal static AppPlatformCustomDomainProperties DeserializeAppPlatformCustomDo provisioningState = new AppPlatformCustomDomainProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformCustomDomainProperties(thumbprint.Value, appName.Value, certName.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AppPlatformCustomDomainProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCustomDomainProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCustomDomainProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCustomDomainProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCustomDomainProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformCustomDomainProperties(thumbprint.Value, appName.Value, certName.Value, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCustomDomainProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCustomDomainProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.cs index b3695365a1c7..34d310b57901 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainProperties.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Custom domain of app resource payload. public partial class AppPlatformCustomDomainProperties { - /// Initializes a new instance of AppPlatformCustomDomainProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformCustomDomainProperties() { } - /// Initializes a new instance of AppPlatformCustomDomainProperties. + /// Initializes a new instance of . /// The thumbprint of bound certificate. /// The app name of domain. /// The bound certificate name of domain. /// Provisioning state of the Domain. - internal AppPlatformCustomDomainProperties(string thumbprint, string appName, string certName, AppPlatformCustomDomainProvisioningState? provisioningState) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCustomDomainProperties(string thumbprint, string appName, string certName, AppPlatformCustomDomainProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) { Thumbprint = thumbprint; AppName = appName; CertName = certName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The thumbprint of bound certificate. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.Serialization.cs index dac457989a08..53032a4bcc35 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformCustomDomainValidateContent : IUtf8JsonSerializable + public partial class AppPlatformCustomDomainValidateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AppPlatformCustomDomainValidateContent DeserializeAppPlatformCustomDomainValidateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformCustomDomainValidateContent(name, serializedAdditionalRawData); + } + + AppPlatformCustomDomainValidateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCustomDomainValidateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCustomDomainValidateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCustomDomainValidateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCustomDomainValidateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCustomDomainValidateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCustomDomainValidateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.cs index 0966e56fc61c..d401b960040a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppPlatform.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Custom domain validate payload. public partial class AppPlatformCustomDomainValidateContent { - /// Initializes a new instance of AppPlatformCustomDomainValidateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name to be validated. /// is null. public AppPlatformCustomDomainValidateContent(string name) @@ -23,6 +27,20 @@ public AppPlatformCustomDomainValidateContent(string name) Name = name; } + /// Initializes a new instance of . + /// Name to be validated. + /// Keeps track of any properties unknown to the library. + internal AppPlatformCustomDomainValidateContent(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppPlatformCustomDomainValidateContent() + { + } + /// Name to be validated. public string Name { get; } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.Serialization.cs index 24c18a728c52..25c1e01d2209 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformCustomDomainValidateResult + public partial class AppPlatformCustomDomainValidateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformCustomDomainValidateResult DeserializeAppPlatformCustomDomainValidateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsValid)) + { + writer.WritePropertyName("isValid"u8); + writer.WriteBooleanValue(IsValid.Value); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformCustomDomainValidateResult DeserializeAppPlatformCustomDomainValidateResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isValid = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isValid"u8)) @@ -36,8 +75,61 @@ internal static AppPlatformCustomDomainValidateResult DeserializeAppPlatformCust message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformCustomDomainValidateResult(Optional.ToNullable(isValid), message.Value); + return new AppPlatformCustomDomainValidateResult(Optional.ToNullable(isValid), message.Value, serializedAdditionalRawData); + } + + AppPlatformCustomDomainValidateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformCustomDomainValidateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCustomDomainValidateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCustomDomainValidateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformCustomDomainValidateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformCustomDomainValidateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformCustomDomainValidateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.cs index 08088cd87902..d3347252fe72 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformCustomDomainValidateResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Validation result for custom domain. public partial class AppPlatformCustomDomainValidateResult { - /// Initializes a new instance of AppPlatformCustomDomainValidateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformCustomDomainValidateResult() { } - /// Initializes a new instance of AppPlatformCustomDomainValidateResult. + /// Initializes a new instance of . /// Indicates if domain name is valid. /// Message of why domain name is invalid. - internal AppPlatformCustomDomainValidateResult(bool? isValid, string message) + /// Keeps track of any properties unknown to the library. + internal AppPlatformCustomDomainValidateResult(bool? isValid, string message, Dictionary serializedAdditionalRawData) { IsValid = isValid; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if domain name is valid. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentData.Serialization.cs index c9f2ab8f0e9a..f83c2cd87c85 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentData.Serialization.cs @@ -5,33 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformDeploymentData : IUtf8JsonSerializable + public partial class AppPlatformDeploymentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformDeploymentData DeserializeAppPlatformDeploymentData(JsonElement element) + internal static AppPlatformDeploymentData DeserializeAppPlatformDeploymentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static AppPlatformDeploymentData DeserializeAppPlatformDeploymentData(J string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -86,8 +123,61 @@ internal static AppPlatformDeploymentData DeserializeAppPlatformDeploymentData(J systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformDeploymentData(id, name, type, systemData.Value, properties.Value, sku.Value, serializedAdditionalRawData); + } + + AppPlatformDeploymentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformDeploymentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformDeploymentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformDeploymentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformDeploymentData model) + { + if (model is null) + { + return null; } - return new AppPlatformDeploymentData(id, name, type, systemData.Value, properties.Value, sku.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformDeploymentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformDeploymentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.Serialization.cs index 9495a11d03b4..b34ffdf4cfb8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformDeploymentInstance + public partial class AppPlatformDeploymentInstance : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformDeploymentInstance DeserializeAppPlatformDeploymentInstance(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformDeploymentInstance DeserializeAppPlatformDeploymentInstance(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static AppPlatformDeploymentInstance DeserializeAppPlatformDeploymentIn Optional discoveryStatus = default; Optional startTime = default; Optional zone = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -61,8 +89,61 @@ internal static AppPlatformDeploymentInstance DeserializeAppPlatformDeploymentIn zone = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformDeploymentInstance(name.Value, status.Value, reason.Value, discoveryStatus.Value, Optional.ToNullable(startTime), zone.Value); + return new AppPlatformDeploymentInstance(name.Value, status.Value, reason.Value, discoveryStatus.Value, Optional.ToNullable(startTime), zone.Value, serializedAdditionalRawData); + } + + AppPlatformDeploymentInstance IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformDeploymentInstance(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformDeploymentInstance IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformDeploymentInstance(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformDeploymentInstance model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformDeploymentInstance(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformDeploymentInstance(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.cs index d140ef07d820..1ed7deefdf88 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentInstance.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models { /// Deployment instance payload. public partial class AppPlatformDeploymentInstance { - /// Initializes a new instance of AppPlatformDeploymentInstance. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformDeploymentInstance() { } - /// Initializes a new instance of AppPlatformDeploymentInstance. + /// Initializes a new instance of . /// Name of the deployment instance. /// Status of the deployment instance. /// Failed reason of the deployment instance. /// Discovery status of the deployment instance. /// Start time of the deployment instance. /// Availability zone information of the deployment instance. - internal AppPlatformDeploymentInstance(string name, string status, string reason, string discoveryStatus, DateTimeOffset? startedOn, string zone) + /// Keeps track of any properties unknown to the library. + internal AppPlatformDeploymentInstance(string name, string status, string reason, string discoveryStatus, DateTimeOffset? startedOn, string zone, Dictionary serializedAdditionalRawData) { Name = name; Status = status; @@ -32,6 +37,7 @@ internal AppPlatformDeploymentInstance(string name, string status, string reason DiscoveryStatus = discoveryStatus; StartedOn = startedOn; Zone = zone; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the deployment instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.Serialization.cs index 59158fc2c919..9cf33c497ab8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.Serialization.cs @@ -5,37 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformDeploymentProperties : IUtf8JsonSerializable + public partial class AppPlatformDeploymentProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsDefined(DeploymentSettings)) { writer.WritePropertyName("deploymentSettings"u8); - writer.WriteObjectValue(DeploymentSettings); + if (DeploymentSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeploymentSettings).Serialize(writer, options); + } } if (Optional.IsDefined(IsActive)) { writer.WritePropertyName("active"u8); writer.WriteBooleanValue(IsActive.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformDeploymentProperties DeserializeAppPlatformDeploymentProperties(JsonElement element) + internal static AppPlatformDeploymentProperties DeserializeAppPlatformDeploymentProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +81,7 @@ internal static AppPlatformDeploymentProperties DeserializeAppPlatformDeployment Optional status = default; Optional active = default; Optional> instances = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("source"u8)) @@ -107,8 +143,61 @@ internal static AppPlatformDeploymentProperties DeserializeAppPlatformDeployment instances = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformDeploymentProperties(source.Value, deploymentSettings.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), Optional.ToNullable(active), Optional.ToList(instances), serializedAdditionalRawData); + } + + AppPlatformDeploymentProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformDeploymentProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformDeploymentProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformDeploymentProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformDeploymentProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformDeploymentProperties(source.Value, deploymentSettings.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), Optional.ToNullable(active), Optional.ToList(instances)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformDeploymentProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformDeploymentProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.cs index 96440508c7eb..2f585d2eeb0c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Deployment resource properties payload. public partial class AppPlatformDeploymentProperties { - /// Initializes a new instance of AppPlatformDeploymentProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformDeploymentProperties() { Instances = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformDeploymentProperties. + /// Initializes a new instance of . /// /// Uploaded source information of the deployment. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -30,7 +34,8 @@ public AppPlatformDeploymentProperties() /// Status of the Deployment. /// Indicates whether the Deployment is active. /// Collection of instances belong to the Deployment. - internal AppPlatformDeploymentProperties(AppPlatformUserSourceInfo source, AppPlatformDeploymentSettings deploymentSettings, AppPlatformDeploymentProvisioningState? provisioningState, AppPlatformDeploymentStatus? status, bool? isActive, IReadOnlyList instances) + /// Keeps track of any properties unknown to the library. + internal AppPlatformDeploymentProperties(AppPlatformUserSourceInfo source, AppPlatformDeploymentSettings deploymentSettings, AppPlatformDeploymentProvisioningState? provisioningState, AppPlatformDeploymentStatus? status, bool? isActive, IReadOnlyList instances, Dictionary serializedAdditionalRawData) { Source = source; DeploymentSettings = deploymentSettings; @@ -38,6 +43,7 @@ internal AppPlatformDeploymentProperties(AppPlatformUserSourceInfo source, AppPl Status = status; IsActive = isActive; Instances = instances; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.Serialization.cs index deb33e9f6ae7..87c9b4538182 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformDeploymentResourceRequirements : IUtf8JsonSerializable + public partial class AppPlatformDeploymentResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cpu)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("memory"u8); writer.WriteStringValue(Memory); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformDeploymentResourceRequirements DeserializeAppPlatformDeploymentResourceRequirements(JsonElement element) + internal static AppPlatformDeploymentResourceRequirements DeserializeAppPlatformDeploymentResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cpu = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformDeploymentResourceRequirements DeserializeAppPlatform memory = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformDeploymentResourceRequirements(cpu.Value, memory.Value, serializedAdditionalRawData); + } + + AppPlatformDeploymentResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformDeploymentResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformDeploymentResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformDeploymentResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformDeploymentResourceRequirements model) + { + if (model is null) + { + return null; } - return new AppPlatformDeploymentResourceRequirements(cpu.Value, memory.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformDeploymentResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformDeploymentResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.cs index 8c4eaf9ee9e2..93dbd886fe75 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentResourceRequirements.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Deployment resource request payload. public partial class AppPlatformDeploymentResourceRequirements { - /// Initializes a new instance of AppPlatformDeploymentResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformDeploymentResourceRequirements() { } - /// Initializes a new instance of AppPlatformDeploymentResourceRequirements. + /// Initializes a new instance of . /// Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. /// Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - internal AppPlatformDeploymentResourceRequirements(string cpu, string memory) + /// Keeps track of any properties unknown to the library. + internal AppPlatformDeploymentResourceRequirements(string cpu, string memory, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.Serialization.cs index f70bf8f5f4ae..2ea79571ff3a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformDeploymentSettings : IUtf8JsonSerializable + public partial class AppPlatformDeploymentSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceRequests)) { writer.WritePropertyName("resourceRequests"u8); - writer.WriteObjectValue(ResourceRequests); + if (ResourceRequests is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResourceRequests).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(EnvironmentVariables)) { @@ -67,17 +80,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LivenessProbe)) { writer.WritePropertyName("livenessProbe"u8); - writer.WriteObjectValue(LivenessProbe); + if (LivenessProbe is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LivenessProbe).Serialize(writer, options); + } } if (Optional.IsDefined(ReadinessProbe)) { writer.WritePropertyName("readinessProbe"u8); - writer.WriteObjectValue(ReadinessProbe); + if (ReadinessProbe is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReadinessProbe).Serialize(writer, options); + } } if (Optional.IsDefined(StartupProbe)) { writer.WritePropertyName("startupProbe"u8); - writer.WriteObjectValue(StartupProbe); + if (StartupProbe is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StartupProbe).Serialize(writer, options); + } } if (Optional.IsDefined(TerminationGracePeriodInSeconds)) { @@ -87,13 +121,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContainerProbeSettings)) { writer.WritePropertyName("containerProbeSettings"u8); - writer.WriteObjectValue(ContainerProbeSettings); + if (ContainerProbeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContainerProbeSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformDeploymentSettings DeserializeAppPlatformDeploymentSettings(JsonElement element) + internal static AppPlatformDeploymentSettings DeserializeAppPlatformDeploymentSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -106,6 +161,7 @@ internal static AppPlatformDeploymentSettings DeserializeAppPlatformDeploymentSe Optional startupProbe = default; Optional terminationGracePeriodSeconds = default; Optional containerProbeSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceRequests"u8)) @@ -209,8 +265,61 @@ internal static AppPlatformDeploymentSettings DeserializeAppPlatformDeploymentSe containerProbeSettings = ContainerProbeSettings.DeserializeContainerProbeSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformDeploymentSettings(resourceRequests.Value, Optional.ToDictionary(environmentVariables), Optional.ToDictionary(addonConfigs), livenessProbe.Value, readinessProbe.Value, startupProbe.Value, Optional.ToNullable(terminationGracePeriodSeconds), containerProbeSettings.Value); + return new AppPlatformDeploymentSettings(resourceRequests.Value, Optional.ToDictionary(environmentVariables), Optional.ToDictionary(addonConfigs), livenessProbe.Value, readinessProbe.Value, startupProbe.Value, Optional.ToNullable(terminationGracePeriodSeconds), containerProbeSettings.Value, serializedAdditionalRawData); + } + + AppPlatformDeploymentSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformDeploymentSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformDeploymentSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformDeploymentSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformDeploymentSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformDeploymentSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformDeploymentSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.cs index 1a2ec483325a..1ae57c646b98 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformDeploymentSettings.cs @@ -14,14 +14,17 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Deployment settings payload. public partial class AppPlatformDeploymentSettings { - /// Initializes a new instance of AppPlatformDeploymentSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformDeploymentSettings() { EnvironmentVariables = new ChangeTrackingDictionary(); AddonConfigs = new ChangeTrackingDictionary>(); } - /// Initializes a new instance of AppPlatformDeploymentSettings. + /// Initializes a new instance of . /// The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. /// Collection of environment variables. /// Collection of addons. @@ -30,7 +33,8 @@ public AppPlatformDeploymentSettings() /// StartupProbe indicates that the App Instance has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a App Instance's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. /// Optional duration in seconds the App Instance needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the App Instance are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 90 seconds. /// Container liveness and readiness probe settings. - internal AppPlatformDeploymentSettings(AppPlatformDeploymentResourceRequirements resourceRequests, IDictionary environmentVariables, IDictionary> addonConfigs, AppInstanceProbe livenessProbe, AppInstanceProbe readinessProbe, AppInstanceProbe startupProbe, int? terminationGracePeriodInSeconds, ContainerProbeSettings containerProbeSettings) + /// Keeps track of any properties unknown to the library. + internal AppPlatformDeploymentSettings(AppPlatformDeploymentResourceRequirements resourceRequests, IDictionary environmentVariables, IDictionary> addonConfigs, AppInstanceProbe livenessProbe, AppInstanceProbe readinessProbe, AppInstanceProbe startupProbe, int? terminationGracePeriodInSeconds, ContainerProbeSettings containerProbeSettings, Dictionary serializedAdditionalRawData) { ResourceRequests = resourceRequests; EnvironmentVariables = environmentVariables; @@ -40,6 +44,7 @@ internal AppPlatformDeploymentSettings(AppPlatformDeploymentResourceRequirements StartupProbe = startupProbe; TerminationGracePeriodInSeconds = terminationGracePeriodInSeconds; ContainerProbeSettings = containerProbeSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.Serialization.cs index 9b565e0d39e8..2e09513b8d48 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformErrorInfo : IUtf8JsonSerializable + public partial class AppPlatformErrorInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformErrorInfo DeserializeAppPlatformErrorInfo(JsonElement element) + internal static AppPlatformErrorInfo DeserializeAppPlatformErrorInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformErrorInfo DeserializeAppPlatformErrorInfo(JsonElement message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformErrorInfo(code.Value, message.Value, serializedAdditionalRawData); + } + + AppPlatformErrorInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformErrorInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformErrorInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformErrorInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformErrorInfo model) + { + if (model is null) + { + return null; } - return new AppPlatformErrorInfo(code.Value, message.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformErrorInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformErrorInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.cs index 1627714a2b50..3c7299233f6f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformErrorInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The error code compose of code and message. public partial class AppPlatformErrorInfo { - /// Initializes a new instance of AppPlatformErrorInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformErrorInfo() { } - /// Initializes a new instance of AppPlatformErrorInfo. + /// Initializes a new instance of . /// The code of error. /// The message of error. - internal AppPlatformErrorInfo(string code, string message) + /// Keeps track of any properties unknown to the library. + internal AppPlatformErrorInfo(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The code of error. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.Serialization.cs index 41b9f8675745..932febcac569 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayApiMetadataProperties : IUtf8JsonSerializable + public partial class AppPlatformGatewayApiMetadataProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Title)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("serverUrl"u8); writer.WriteStringValue(ServerUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformGatewayApiMetadataProperties DeserializeAppPlatformGatewayApiMetadataProperties(JsonElement element) + internal static AppPlatformGatewayApiMetadataProperties DeserializeAppPlatformGatewayApiMetadataProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static AppPlatformGatewayApiMetadataProperties DeserializeAppPlatformGa Optional documentation = default; Optional version = default; Optional serverUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("title"u8)) @@ -86,8 +108,61 @@ internal static AppPlatformGatewayApiMetadataProperties DeserializeAppPlatformGa serverUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayApiMetadataProperties(title.Value, description.Value, documentation.Value, version.Value, serverUri.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayApiMetadataProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayApiMetadataProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayApiMetadataProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayApiMetadataProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayApiMetadataProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformGatewayApiMetadataProperties(title.Value, description.Value, documentation.Value, version.Value, serverUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayApiMetadataProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayApiMetadataProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.cs index a2aeae718eec..4de38ec4e0a1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiMetadataProperties.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models { /// API metadata property for Spring Cloud Gateway. public partial class AppPlatformGatewayApiMetadataProperties { - /// Initializes a new instance of AppPlatformGatewayApiMetadataProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayApiMetadataProperties() { } - /// Initializes a new instance of AppPlatformGatewayApiMetadataProperties. + /// Initializes a new instance of . /// Title describing the context of the APIs available on the Gateway instance (default: `Spring Cloud Gateway for K8S`). /// Detailed description of the APIs available on the Gateway instance (default: `Generated OpenAPI 3 document that describes the API routes configured.`). /// Location of additional documentation for the APIs available on the Gateway instance. /// Version of APIs available on this Gateway instance (default: `unspecified`). /// Base URL that API consumers will use to access APIs on the Gateway instance. - internal AppPlatformGatewayApiMetadataProperties(string title, string description, string documentation, string version, Uri serverUri) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayApiMetadataProperties(string title, string description, string documentation, string version, Uri serverUri, Dictionary serializedAdditionalRawData) { Title = title; Description = description; Documentation = documentation; Version = version; ServerUri = serverUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Title describing the context of the APIs available on the Gateway instance (default: `Spring Cloud Gateway for K8S`). diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.Serialization.cs index ee9bde9e24bf..4ad9231844f8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayApiRoute : IUtf8JsonSerializable + public partial class AppPlatformGatewayApiRoute : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Title)) { @@ -77,11 +83,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformGatewayApiRoute DeserializeAppPlatformGatewayApiRoute(JsonElement element) + internal static AppPlatformGatewayApiRoute DeserializeAppPlatformGatewayApiRoute(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -95,6 +115,7 @@ internal static AppPlatformGatewayApiRoute DeserializeAppPlatformGatewayApiRoute Optional> filters = default; Optional order = default; Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("title"u8)) @@ -185,8 +206,61 @@ internal static AppPlatformGatewayApiRoute DeserializeAppPlatformGatewayApiRoute tags = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayApiRoute(title.Value, description.Value, uri.Value, Optional.ToNullable(ssoEnabled), Optional.ToNullable(tokenRelay), Optional.ToList(predicates), Optional.ToList(filters), Optional.ToNullable(order), Optional.ToList(tags), serializedAdditionalRawData); + } + + AppPlatformGatewayApiRoute IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayApiRoute(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayApiRoute IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayApiRoute(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayApiRoute model) + { + if (model is null) + { + return null; } - return new AppPlatformGatewayApiRoute(title.Value, description.Value, uri.Value, Optional.ToNullable(ssoEnabled), Optional.ToNullable(tokenRelay), Optional.ToList(predicates), Optional.ToList(filters), Optional.ToNullable(order), Optional.ToList(tags)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayApiRoute(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayApiRoute(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.cs index d2cc94f937dd..bf7bea6c21bb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayApiRoute.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// API route config of the Spring Cloud Gateway. public partial class AppPlatformGatewayApiRoute { - /// Initializes a new instance of AppPlatformGatewayApiRoute. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayApiRoute() { Predicates = new ChangeTrackingList(); @@ -22,7 +25,7 @@ public AppPlatformGatewayApiRoute() Tags = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformGatewayApiRoute. + /// Initializes a new instance of . /// A title, will be applied to methods in the generated OpenAPI documentation. /// A description, will be applied to methods in the generated OpenAPI documentation. /// Full uri, will override `appName`. @@ -32,7 +35,8 @@ public AppPlatformGatewayApiRoute() /// To modify the request before sending it to the target endpoint, or the received response. /// Route processing order. /// Classification tags, will be applied to methods in the generated OpenAPI documentation. - internal AppPlatformGatewayApiRoute(string title, string description, Uri uri, bool? isSsoEnabled, bool? isTokenRelayed, IList predicates, IList filters, int? order, IList tags) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayApiRoute(string title, string description, Uri uri, bool? isSsoEnabled, bool? isTokenRelayed, IList predicates, IList filters, int? order, IList tags, Dictionary serializedAdditionalRawData) { Title = title; Description = description; @@ -43,6 +47,7 @@ internal AppPlatformGatewayApiRoute(string title, string description, Uri uri, b Filters = filters; Order = order; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A title, will be applied to methods in the generated OpenAPI documentation. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.Serialization.cs index 252e108210bd..c769bbd46abb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayCorsProperties : IUtf8JsonSerializable + public partial class AppPlatformGatewayCorsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AllowedOrigins)) { @@ -66,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformGatewayCorsProperties DeserializeAppPlatformGatewayCorsProperties(JsonElement element) + internal static AppPlatformGatewayCorsProperties DeserializeAppPlatformGatewayCorsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +102,7 @@ internal static AppPlatformGatewayCorsProperties DeserializeAppPlatformGatewayCo Optional maxAge = default; Optional allowCredentials = default; Optional> exposedHeaders = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowedOrigins"u8)) @@ -157,8 +179,61 @@ internal static AppPlatformGatewayCorsProperties DeserializeAppPlatformGatewayCo exposedHeaders = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayCorsProperties(Optional.ToList(allowedOrigins), Optional.ToList(allowedMethods), Optional.ToList(allowedHeaders), Optional.ToNullable(maxAge), Optional.ToNullable(allowCredentials), Optional.ToList(exposedHeaders), serializedAdditionalRawData); + } + + AppPlatformGatewayCorsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayCorsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayCorsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayCorsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayCorsProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformGatewayCorsProperties(Optional.ToList(allowedOrigins), Optional.ToList(allowedMethods), Optional.ToList(allowedHeaders), Optional.ToNullable(maxAge), Optional.ToNullable(allowCredentials), Optional.ToList(exposedHeaders)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayCorsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayCorsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.cs index 0efd1c4fd3cc..974fe70f7e71 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCorsProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Cross-Origin Resource Sharing property. public partial class AppPlatformGatewayCorsProperties { - /// Initializes a new instance of AppPlatformGatewayCorsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayCorsProperties() { AllowedOrigins = new ChangeTrackingList(); @@ -22,14 +26,15 @@ public AppPlatformGatewayCorsProperties() ExposedHeaders = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformGatewayCorsProperties. + /// Initializes a new instance of . /// Allowed origins to make cross-site requests. The special value `*` allows all domains. /// Allowed HTTP methods on cross-site requests. The special value `*` allows all methods. If not set, `GET` and `HEAD` are allowed by default. /// Allowed headers in cross-site requests. The special value `*` allows actual requests to send any header. /// How long, in seconds, the response from a pre-flight request can be cached by clients. /// Whether user credentials are supported on cross-site requests. Valid values: `true`, `false`. /// HTTP response headers to expose for cross-site requests. - internal AppPlatformGatewayCorsProperties(IList allowedOrigins, IList allowedMethods, IList allowedHeaders, int? maxAge, bool? areCredentialsAllowed, IList exposedHeaders) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayCorsProperties(IList allowedOrigins, IList allowedMethods, IList allowedHeaders, int? maxAge, bool? areCredentialsAllowed, IList exposedHeaders, Dictionary serializedAdditionalRawData) { AllowedOrigins = allowedOrigins; AllowedMethods = allowedMethods; @@ -37,6 +42,7 @@ internal AppPlatformGatewayCorsProperties(IList allowedOrigins, IList Allowed origins to make cross-site requests. The special value `*` allows all domains. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCustomDomainData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCustomDomainData.Serialization.cs index 1d1348c94799..ea2e1adc9ab7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCustomDomainData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayCustomDomainData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformGatewayCustomDomainData : IUtf8JsonSerializable + public partial class AppPlatformGatewayCustomDomainData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformGatewayCustomDomainData DeserializeAppPlatformGatewayCustomDomainData(JsonElement element) + internal static AppPlatformGatewayCustomDomainData DeserializeAppPlatformGatewayCustomDomainData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformGatewayCustomDomainData DeserializeAppPlatformGateway string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformGatewayCustomDomainData DeserializeAppPlatformGateway systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayCustomDomainData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayCustomDomainData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayCustomDomainData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayCustomDomainData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayCustomDomainData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayCustomDomainData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayCustomDomainData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformGatewayCustomDomainData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayCustomDomainData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayData.Serialization.cs index e04a722419df..36f02ca18160 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayData.Serialization.cs @@ -5,33 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformGatewayData : IUtf8JsonSerializable + public partial class AppPlatformGatewayData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformGatewayData DeserializeAppPlatformGatewayData(JsonElement element) + internal static AppPlatformGatewayData DeserializeAppPlatformGatewayData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static AppPlatformGatewayData DeserializeAppPlatformGatewayData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -86,8 +123,61 @@ internal static AppPlatformGatewayData DeserializeAppPlatformGatewayData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayData(id, name, type, systemData.Value, properties.Value, sku.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayData model) + { + if (model is null) + { + return null; } - return new AppPlatformGatewayData(id, name, type, systemData.Value, properties.Value, sku.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.Serialization.cs index d9935a81f04a..4cd85dec0bb1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayInstance + public partial class AppPlatformGatewayInstance : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformGatewayInstance DeserializeAppPlatformGatewayInstance(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformGatewayInstance DeserializeAppPlatformGatewayInstance(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static AppPlatformGatewayInstance DeserializeAppPlatformGatewayInstance status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformGatewayInstance(name.Value, status.Value); + return new AppPlatformGatewayInstance(name.Value, status.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayInstance IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayInstance(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayInstance IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayInstance(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayInstance model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayInstance(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayInstance(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.cs index 6c16a57a3030..6a66fe0999c2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayInstance.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Collection of instances belong to the Spring Cloud Gateway. public partial class AppPlatformGatewayInstance { - /// Initializes a new instance of AppPlatformGatewayInstance. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformGatewayInstance() { } - /// Initializes a new instance of AppPlatformGatewayInstance. + /// Initializes a new instance of . /// Name of the Spring Cloud Gateway instance. /// Status of the Spring Cloud Gateway instance. - internal AppPlatformGatewayInstance(string name, string status) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayInstance(string name, string status, Dictionary serializedAdditionalRawData) { Name = name; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Spring Cloud Gateway instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.Serialization.cs index 01b65c22a84c..aec62503e508 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayOperatorProperties + public partial class AppPlatformGatewayOperatorProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformGatewayOperatorProperties DeserializeAppPlatformGatewayOperatorProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformGatewayOperatorProperties DeserializeAppPlatformGatewayOperatorProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceRequests = default; Optional> instances = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceRequests"u8)) @@ -46,8 +74,61 @@ internal static AppPlatformGatewayOperatorProperties DeserializeAppPlatformGatew instances = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformGatewayOperatorProperties(resourceRequests.Value, Optional.ToList(instances)); + return new AppPlatformGatewayOperatorProperties(resourceRequests.Value, Optional.ToList(instances), serializedAdditionalRawData); + } + + AppPlatformGatewayOperatorProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayOperatorProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayOperatorProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayOperatorProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayOperatorProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayOperatorProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayOperatorProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.cs index afa3f7732ab3..2a1c0f1b0ec0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Properties of the Spring Cloud Gateway Operator. public partial class AppPlatformGatewayOperatorProperties { - /// Initializes a new instance of AppPlatformGatewayOperatorProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformGatewayOperatorProperties() { Instances = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformGatewayOperatorProperties. + /// Initializes a new instance of . /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Spring Cloud Gateway operator. - internal AppPlatformGatewayOperatorProperties(AppPlatformGatewayOperatorResourceRequirements resourceRequests, IReadOnlyList instances) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayOperatorProperties(AppPlatformGatewayOperatorResourceRequirements resourceRequests, IReadOnlyList instances, Dictionary serializedAdditionalRawData) { ResourceRequests = resourceRequests; Instances = instances; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The requested resource quantity for required CPU and Memory. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.Serialization.cs index 7a350f97ce4d..45e7cc5ef734 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayOperatorResourceRequirements + public partial class AppPlatformGatewayOperatorResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformGatewayOperatorResourceRequirements DeserializeAppPlatformGatewayOperatorResourceRequirements(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformGatewayOperatorResourceRequirements DeserializeAppPlatformGatewayOperatorResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AppPlatformGatewayOperatorResourceRequirements DeserializeAppPla Optional cpu = default; Optional memory = default; Optional instanceCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -42,8 +71,61 @@ internal static AppPlatformGatewayOperatorResourceRequirements DeserializeAppPla instanceCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformGatewayOperatorResourceRequirements(cpu.Value, memory.Value, Optional.ToNullable(instanceCount)); + return new AppPlatformGatewayOperatorResourceRequirements(cpu.Value, memory.Value, Optional.ToNullable(instanceCount), serializedAdditionalRawData); + } + + AppPlatformGatewayOperatorResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayOperatorResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayOperatorResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayOperatorResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayOperatorResourceRequirements model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayOperatorResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayOperatorResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.cs index a4cf7832c3ed..a1a17567f779 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayOperatorResourceRequirements.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Properties of the Spring Cloud Gateway Operator. public partial class AppPlatformGatewayOperatorResourceRequirements { - /// Initializes a new instance of AppPlatformGatewayOperatorResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformGatewayOperatorResourceRequirements() { } - /// Initializes a new instance of AppPlatformGatewayOperatorResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Spring Cloud Gateway Operator instance. /// Memory allocated to each Spring Cloud Gateway Operator instance. /// Instance count of the Spring Cloud Gateway Operator. - internal AppPlatformGatewayOperatorResourceRequirements(string cpu, string memory, int? instanceCount) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayOperatorResourceRequirements(string cpu, string memory, int? instanceCount, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; InstanceCount = instanceCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cpu allocated to each Spring Cloud Gateway Operator instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.Serialization.cs index e532fa6269fe..a5ba0ba1e3a1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayProperties : IUtf8JsonSerializable + public partial class AppPlatformGatewayProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsPublic)) { @@ -30,28 +36,70 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SsoProperties)) { writer.WritePropertyName("ssoProperties"u8); - writer.WriteObjectValue(SsoProperties); + if (SsoProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SsoProperties).Serialize(writer, options); + } } if (Optional.IsDefined(ApiMetadataProperties)) { writer.WritePropertyName("apiMetadataProperties"u8); - writer.WriteObjectValue(ApiMetadataProperties); + if (ApiMetadataProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiMetadataProperties).Serialize(writer, options); + } } if (Optional.IsDefined(CorsProperties)) { writer.WritePropertyName("corsProperties"u8); - writer.WriteObjectValue(CorsProperties); + if (CorsProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CorsProperties).Serialize(writer, options); + } } if (Optional.IsDefined(ResourceRequests)) { writer.WritePropertyName("resourceRequests"u8); - writer.WriteObjectValue(ResourceRequests); + if (ResourceRequests is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResourceRequests).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformGatewayProperties DeserializeAppPlatformGatewayProperties(JsonElement element) + internal static AppPlatformGatewayProperties DeserializeAppPlatformGatewayProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +114,7 @@ internal static AppPlatformGatewayProperties DeserializeAppPlatformGatewayProper Optional resourceRequests = default; Optional> instances = default; Optional operatorProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -163,8 +212,61 @@ internal static AppPlatformGatewayProperties DeserializeAppPlatformGatewayProper operatorProperties = AppPlatformGatewayOperatorProperties.DeserializeAppPlatformGatewayOperatorProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformGatewayProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(@public), uri.Value, Optional.ToNullable(httpsOnly), ssoProperties.Value, apiMetadataProperties.Value, corsProperties.Value, resourceRequests.Value, Optional.ToList(instances), operatorProperties.Value); + return new AppPlatformGatewayProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(@public), uri.Value, Optional.ToNullable(httpsOnly), ssoProperties.Value, apiMetadataProperties.Value, corsProperties.Value, resourceRequests.Value, Optional.ToList(instances), operatorProperties.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.cs index 7211558bc8a7..3963ed4e1fdd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Spring Cloud Gateway properties payload. public partial class AppPlatformGatewayProperties { - /// Initializes a new instance of AppPlatformGatewayProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayProperties() { Instances = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformGatewayProperties. + /// Initializes a new instance of . /// State of the Spring Cloud Gateway. /// Indicates whether the Spring Cloud Gateway exposes endpoint. /// URL of the Spring Cloud Gateway, exposed when 'public' is true. @@ -31,7 +34,8 @@ public AppPlatformGatewayProperties() /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Spring Cloud Gateway. /// Properties of the Spring Cloud Gateway Operator. - internal AppPlatformGatewayProperties(AppPlatformGatewayProvisioningState? provisioningState, bool? isPublic, Uri uri, bool? isHttpsOnly, AppPlatformSsoProperties ssoProperties, AppPlatformGatewayApiMetadataProperties apiMetadataProperties, AppPlatformGatewayCorsProperties corsProperties, AppPlatformGatewayResourceRequirements resourceRequests, IReadOnlyList instances, AppPlatformGatewayOperatorProperties operatorProperties) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayProperties(AppPlatformGatewayProvisioningState? provisioningState, bool? isPublic, Uri uri, bool? isHttpsOnly, AppPlatformSsoProperties ssoProperties, AppPlatformGatewayApiMetadataProperties apiMetadataProperties, AppPlatformGatewayCorsProperties corsProperties, AppPlatformGatewayResourceRequirements resourceRequests, IReadOnlyList instances, AppPlatformGatewayOperatorProperties operatorProperties, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; IsPublic = isPublic; @@ -43,6 +47,7 @@ internal AppPlatformGatewayProperties(AppPlatformGatewayProvisioningState? provi ResourceRequests = resourceRequests; Instances = instances; OperatorProperties = operatorProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the Spring Cloud Gateway. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.Serialization.cs index 0a2097bb5ff6..9d0403903e56 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayResourceRequirements : IUtf8JsonSerializable + public partial class AppPlatformGatewayResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cpu)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("memory"u8); writer.WriteStringValue(Memory); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformGatewayResourceRequirements DeserializeAppPlatformGatewayResourceRequirements(JsonElement element) + internal static AppPlatformGatewayResourceRequirements DeserializeAppPlatformGatewayResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cpu = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformGatewayResourceRequirements DeserializeAppPlatformGat memory = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayResourceRequirements(cpu.Value, memory.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayResourceRequirements model) + { + if (model is null) + { + return null; } - return new AppPlatformGatewayResourceRequirements(cpu.Value, memory.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.cs index b6226175ef23..0ad1a16740e4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayResourceRequirements.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Resource request payload of Spring Cloud Gateway. public partial class AppPlatformGatewayResourceRequirements { - /// Initializes a new instance of AppPlatformGatewayResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayResourceRequirements() { } - /// Initializes a new instance of AppPlatformGatewayResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Spring Cloud Gateway instance. /// Memory allocated to each Spring Cloud Gateway instance. - internal AppPlatformGatewayResourceRequirements(string cpu, string memory) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayResourceRequirements(string cpu, string memory, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cpu allocated to each Spring Cloud Gateway instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigData.Serialization.cs index 957a349e8eb2..25a22d996426 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformGatewayRouteConfigData : IUtf8JsonSerializable + public partial class AppPlatformGatewayRouteConfigData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformGatewayRouteConfigData DeserializeAppPlatformGatewayRouteConfigData(JsonElement element) + internal static AppPlatformGatewayRouteConfigData DeserializeAppPlatformGatewayRouteConfigData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformGatewayRouteConfigData DeserializeAppPlatformGatewayR string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformGatewayRouteConfigData DeserializeAppPlatformGatewayR systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayRouteConfigData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformGatewayRouteConfigData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayRouteConfigData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayRouteConfigData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayRouteConfigData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayRouteConfigData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayRouteConfigData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformGatewayRouteConfigData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayRouteConfigData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.Serialization.cs index ac2db2e1dc18..407a1afb389b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformGatewayRouteConfigProperties : IUtf8JsonSerializable + public partial class AppPlatformGatewayRouteConfigProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AppResourceId)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(OpenApi)) { writer.WritePropertyName("openApi"u8); - writer.WriteObjectValue(OpenApi); + if (OpenApi is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OpenApi).Serialize(writer, options); + } } if (Optional.IsDefined(Protocol)) { @@ -37,15 +51,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Routes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformGatewayRouteConfigProperties DeserializeAppPlatformGatewayRouteConfigProperties(JsonElement element) + internal static AppPlatformGatewayRouteConfigProperties DeserializeAppPlatformGatewayRouteConfigProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +90,7 @@ internal static AppPlatformGatewayRouteConfigProperties DeserializeAppPlatformGa Optional openApi = default; Optional protocol = default; Optional> routes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -107,8 +143,61 @@ internal static AppPlatformGatewayRouteConfigProperties DeserializeAppPlatformGa routes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformGatewayRouteConfigProperties(Optional.ToNullable(provisioningState), appResourceId.Value, openApi.Value, Optional.ToNullable(protocol), Optional.ToList(routes), serializedAdditionalRawData); + } + + AppPlatformGatewayRouteConfigProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformGatewayRouteConfigProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformGatewayRouteConfigProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformGatewayRouteConfigProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformGatewayRouteConfigProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformGatewayRouteConfigProperties(Optional.ToNullable(provisioningState), appResourceId.Value, openApi.Value, Optional.ToNullable(protocol), Optional.ToList(routes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformGatewayRouteConfigProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformGatewayRouteConfigProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.cs index c1b72df3d211..25ba80895b9e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformGatewayRouteConfigProperties.cs @@ -14,25 +14,30 @@ namespace Azure.ResourceManager.AppPlatform.Models /// API route config of the Spring Cloud Gateway. public partial class AppPlatformGatewayRouteConfigProperties { - /// Initializes a new instance of AppPlatformGatewayRouteConfigProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformGatewayRouteConfigProperties() { Routes = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformGatewayRouteConfigProperties. + /// Initializes a new instance of . /// State of the Spring Cloud Gateway route config. /// The resource Id of the Azure Spring Apps app, required unless route defines `uri`. /// OpenAPI properties of Spring Cloud Gateway route config. /// Protocol of routed Azure Spring Apps applications. /// Array of API routes, each route contains properties such as `title`, `uri`, `ssoEnabled`, `predicates`, `filters`. - internal AppPlatformGatewayRouteConfigProperties(AppPlatformGatewayProvisioningState? provisioningState, ResourceIdentifier appResourceId, GatewayRouteConfigOpenApiProperties openApi, AppPlatformGatewayRouteConfigProtocol? protocol, IList routes) + /// Keeps track of any properties unknown to the library. + internal AppPlatformGatewayRouteConfigProperties(AppPlatformGatewayProvisioningState? provisioningState, ResourceIdentifier appResourceId, GatewayRouteConfigOpenApiProperties openApi, AppPlatformGatewayRouteConfigProtocol? protocol, IList routes, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; AppResourceId = appResourceId; OpenApi = openApi; Protocol = protocol; Routes = routes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the Spring Cloud Gateway route config. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.Serialization.cs index 72db1d9eadaf..89937ddaee0b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformImageRegistryCredential : IUtf8JsonSerializable + public partial class AppPlatformImageRegistryCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Username)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformImageRegistryCredential DeserializeAppPlatformImageRegistryCredential(JsonElement element) + internal static AppPlatformImageRegistryCredential DeserializeAppPlatformImageRegistryCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional username = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformImageRegistryCredential DeserializeAppPlatformImageRe password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformImageRegistryCredential(username.Value, password.Value, serializedAdditionalRawData); + } + + AppPlatformImageRegistryCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformImageRegistryCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformImageRegistryCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformImageRegistryCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformImageRegistryCredential model) + { + if (model is null) + { + return null; } - return new AppPlatformImageRegistryCredential(username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformImageRegistryCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformImageRegistryCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.cs index 312483daa9cc..ff5af7058ffc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformImageRegistryCredential.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Credential of the image registry. public partial class AppPlatformImageRegistryCredential { - /// Initializes a new instance of AppPlatformImageRegistryCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformImageRegistryCredential() { } - /// Initializes a new instance of AppPlatformImageRegistryCredential. + /// Initializes a new instance of . /// The username of the image registry credential. /// The password of the image registry credential. - internal AppPlatformImageRegistryCredential(string username, string password) + /// Keeps track of any properties unknown to the library. + internal AppPlatformImageRegistryCredential(string username, string password, Dictionary serializedAdditionalRawData) { Username = username; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The username of the image registry credential. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.Serialization.cs index 59f859b196f6..40467f89048c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformKeyVaultCertificateProperties : IUtf8JsonSerializable + public partial class AppPlatformKeyVaultCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vaultUri"u8); writer.WriteStringValue(VaultUri.AbsoluteUri); @@ -33,11 +39,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(CertificatePropertiesType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformKeyVaultCertificateProperties DeserializeAppPlatformKeyVaultCertificateProperties(JsonElement element) + internal static AppPlatformKeyVaultCertificateProperties DeserializeAppPlatformKeyVaultCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +75,7 @@ internal static AppPlatformKeyVaultCertificateProperties DeserializeAppPlatformK Optional subjectName = default; Optional> dnsNames = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vaultUri"u8)) @@ -151,8 +172,61 @@ internal static AppPlatformKeyVaultCertificateProperties DeserializeAppPlatformK provisioningState = new AppPlatformCertificateProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformKeyVaultCertificateProperties(type, thumbprint.Value, issuer.Value, Optional.ToNullable(issuedDate), Optional.ToNullable(expirationDate), Optional.ToNullable(activateDate), subjectName.Value, Optional.ToList(dnsNames), Optional.ToNullable(provisioningState), vaultUri, keyVaultCertName, certVersion.Value, Optional.ToNullable(excludePrivateKey), serializedAdditionalRawData); + } + + AppPlatformKeyVaultCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformKeyVaultCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformKeyVaultCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformKeyVaultCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformKeyVaultCertificateProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformKeyVaultCertificateProperties(type, thumbprint.Value, issuer.Value, Optional.ToNullable(issuedDate), Optional.ToNullable(expirationDate), Optional.ToNullable(activateDate), subjectName.Value, Optional.ToList(dnsNames), Optional.ToNullable(provisioningState), vaultUri, keyVaultCertName, certVersion.Value, Optional.ToNullable(excludePrivateKey)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformKeyVaultCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformKeyVaultCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.cs index 820e65d17684..5c51140a3e98 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformKeyVaultCertificateProperties.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Properties of certificate imported from key vault. public partial class AppPlatformKeyVaultCertificateProperties : AppPlatformCertificateProperties { - /// Initializes a new instance of AppPlatformKeyVaultCertificateProperties. + /// Initializes a new instance of . /// The vault uri of user key vault. /// The certificate name of key vault. /// or is null. @@ -28,7 +28,7 @@ public AppPlatformKeyVaultCertificateProperties(Uri vaultUri, string keyVaultCer CertificatePropertiesType = "KeyVaultCertificate"; } - /// Initializes a new instance of AppPlatformKeyVaultCertificateProperties. + /// Initializes a new instance of . /// The type of the certificate source. /// The thumbprint of certificate. /// The issuer of certificate. @@ -42,7 +42,8 @@ public AppPlatformKeyVaultCertificateProperties(Uri vaultUri, string keyVaultCer /// The certificate name of key vault. /// The certificate version of key vault. /// Optional. If set to true, it will not import private key from key vault. - internal AppPlatformKeyVaultCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState, Uri vaultUri, string keyVaultCertName, string certVersion, bool? isPrivateKeyExcluded) : base(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames, provisioningState) + /// Keeps track of any properties unknown to the library. + internal AppPlatformKeyVaultCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState, Uri vaultUri, string keyVaultCertName, string certVersion, bool? isPrivateKeyExcluded, Dictionary serializedAdditionalRawData) : base(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames, provisioningState, serializedAdditionalRawData) { VaultUri = vaultUri; KeyVaultCertName = keyVaultCertName; @@ -51,6 +52,11 @@ internal AppPlatformKeyVaultCertificateProperties(string certificatePropertiesTy CertificatePropertiesType = certificatePropertiesType ?? "KeyVaultCertificate"; } + /// Initializes a new instance of for deserialization. + internal AppPlatformKeyVaultCertificateProperties() + { + } + /// The vault uri of user key vault. public Uri VaultUri { get; set; } /// The certificate name of key vault. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.Serialization.cs index 93a43db99d66..5aa31655de4c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.Serialization.cs @@ -6,20 +6,50 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformLogFileUriResult + public partial class AppPlatformLogFileUriResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformLogFileUriResult DeserializeAppPlatformLogFileUriResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformLogFileUriResult DeserializeAppPlatformLogFileUriResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Uri uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("url"u8)) @@ -27,8 +57,61 @@ internal static AppPlatformLogFileUriResult DeserializeAppPlatformLogFileUriResu uri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformLogFileUriResult(uri); + return new AppPlatformLogFileUriResult(uri, serializedAdditionalRawData); + } + + AppPlatformLogFileUriResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformLogFileUriResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformLogFileUriResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformLogFileUriResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformLogFileUriResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformLogFileUriResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformLogFileUriResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.cs index b802815df067..0e4310e84278 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformLogFileUriResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppPlatform.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Log file URL payload. public partial class AppPlatformLogFileUriResult { - /// Initializes a new instance of AppPlatformLogFileUriResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// URL of the log file. /// is null. internal AppPlatformLogFileUriResult(Uri uri) @@ -23,6 +27,20 @@ internal AppPlatformLogFileUriResult(Uri uri) Uri = uri; } + /// Initializes a new instance of . + /// URL of the log file. + /// Keeps track of any properties unknown to the library. + internal AppPlatformLogFileUriResult(Uri uri, Dictionary serializedAdditionalRawData) + { + Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppPlatformLogFileUriResult() + { + } + /// URL of the log file. public Uri Uri { get; } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingData.Serialization.cs index 93b6622c73e7..66a13481de89 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformMonitoringSettingData : IUtf8JsonSerializable + public partial class AppPlatformMonitoringSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformMonitoringSettingData DeserializeAppPlatformMonitoringSettingData(JsonElement element) + internal static AppPlatformMonitoringSettingData DeserializeAppPlatformMonitoringSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformMonitoringSettingData DeserializeAppPlatformMonitorin string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformMonitoringSettingData DeserializeAppPlatformMonitorin systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformMonitoringSettingData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformMonitoringSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformMonitoringSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformMonitoringSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformMonitoringSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformMonitoringSettingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformMonitoringSettingData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformMonitoringSettingData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformMonitoringSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.Serialization.cs index dc15cf7ad3e7..598b95aebcb8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformMonitoringSettingProperties : IUtf8JsonSerializable + public partial class AppPlatformMonitoringSettingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } if (Optional.IsDefined(IsTraceEnabled)) { @@ -38,13 +53,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppInsightsAgentVersions)) { writer.WritePropertyName("appInsightsAgentVersions"u8); - writer.WriteObjectValue(AppInsightsAgentVersions); + if (AppInsightsAgentVersions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppInsightsAgentVersions).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformMonitoringSettingProperties DeserializeAppPlatformMonitoringSettingProperties(JsonElement element) + internal static AppPlatformMonitoringSettingProperties DeserializeAppPlatformMonitoringSettingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +91,7 @@ internal static AppPlatformMonitoringSettingProperties DeserializeAppPlatformMon Optional appInsightsInstrumentationKey = default; Optional appInsightsSamplingRate = default; Optional appInsightsAgentVersions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -107,8 +144,61 @@ internal static AppPlatformMonitoringSettingProperties DeserializeAppPlatformMon appInsightsAgentVersions = ApplicationInsightsAgentVersions.DeserializeApplicationInsightsAgentVersions(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformMonitoringSettingProperties(Optional.ToNullable(provisioningState), error.Value, Optional.ToNullable(traceEnabled), appInsightsInstrumentationKey.Value, Optional.ToNullable(appInsightsSamplingRate), appInsightsAgentVersions.Value, serializedAdditionalRawData); + } + + AppPlatformMonitoringSettingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformMonitoringSettingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformMonitoringSettingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformMonitoringSettingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformMonitoringSettingProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformMonitoringSettingProperties(Optional.ToNullable(provisioningState), error.Value, Optional.ToNullable(traceEnabled), appInsightsInstrumentationKey.Value, Optional.ToNullable(appInsightsSamplingRate), appInsightsAgentVersions.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformMonitoringSettingProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformMonitoringSettingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.cs index dde39c82fd04..9e68e29d73e6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformMonitoringSettingProperties.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Monitoring Setting properties payload. public partial class AppPlatformMonitoringSettingProperties { - /// Initializes a new instance of AppPlatformMonitoringSettingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformMonitoringSettingProperties() { } - /// Initializes a new instance of AppPlatformMonitoringSettingProperties. + /// Initializes a new instance of . /// State of the Monitoring Setting. /// Error when apply Monitoring Setting changes. /// Indicates whether enable the trace functionality, which will be deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate if monitoringSettings enabled or not. /// Target application insight instrumentation key, null or whitespace include empty will disable monitoringSettings. /// Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. /// Indicates the versions of application insight agent. - internal AppPlatformMonitoringSettingProperties(AppPlatformMonitoringSettingState? provisioningState, AppPlatformErrorInfo error, bool? isTraceEnabled, string appInsightsInstrumentationKey, double? appInsightsSamplingRate, ApplicationInsightsAgentVersions appInsightsAgentVersions) + /// Keeps track of any properties unknown to the library. + internal AppPlatformMonitoringSettingProperties(AppPlatformMonitoringSettingState? provisioningState, AppPlatformErrorInfo error, bool? isTraceEnabled, string appInsightsInstrumentationKey, double? appInsightsSamplingRate, ApplicationInsightsAgentVersions appInsightsAgentVersions, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Error = error; @@ -30,6 +37,7 @@ internal AppPlatformMonitoringSettingProperties(AppPlatformMonitoringSettingStat AppInsightsInstrumentationKey = appInsightsInstrumentationKey; AppInsightsSamplingRate = appInsightsSamplingRate; AppInsightsAgentVersions = appInsightsAgentVersions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the Monitoring Setting. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.Serialization.cs index 6c83803c438f..24b621599140 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformNameAvailabilityContent : IUtf8JsonSerializable + public partial class AppPlatformNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AppPlatformNameAvailabilityContent DeserializeAppPlatformNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceType type = default; + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformNameAvailabilityContent(type, name, serializedAdditionalRawData); + } + + AppPlatformNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.cs index 48edea643f94..a712680b96a5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppPlatform.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Name availability parameters payload. public partial class AppPlatformNameAvailabilityContent { - /// Initializes a new instance of AppPlatformNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the resource to check name availability. /// Name to be checked. /// is null. @@ -25,6 +29,22 @@ public AppPlatformNameAvailabilityContent(ResourceType resourceType, string name Name = name; } + /// Initializes a new instance of . + /// Type of the resource to check name availability. + /// Name to be checked. + /// Keeps track of any properties unknown to the library. + internal AppPlatformNameAvailabilityContent(ResourceType resourceType, string name, Dictionary serializedAdditionalRawData) + { + ResourceType = resourceType; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppPlatformNameAvailabilityContent() + { + } + /// Type of the resource to check name availability. public ResourceType ResourceType { get; } /// Name to be checked. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.Serialization.cs index 9a72d94a3698..44e6ea1ba367 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformNameAvailabilityResult + public partial class AppPlatformNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformNameAvailabilityResult DeserializeAppPlatformNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformNameAvailabilityResult DeserializeAppPlatformNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static AppPlatformNameAvailabilityResult DeserializeAppPlatformNameAvai Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -42,8 +86,61 @@ internal static AppPlatformNameAvailabilityResult DeserializeAppPlatformNameAvai message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value); + return new AppPlatformNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value, serializedAdditionalRawData); + } + + AppPlatformNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.cs index fbefc093972f..4fadfff9637f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Name availability result payload. public partial class AppPlatformNameAvailabilityResult { - /// Initializes a new instance of AppPlatformNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformNameAvailabilityResult() { } - /// Initializes a new instance of AppPlatformNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates whether the name is available. /// Reason why the name is not available. /// Message why the name is not available. - internal AppPlatformNameAvailabilityResult(bool? isNameAvailable, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal AppPlatformNameAvailabilityResult(bool? isNameAvailable, string reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the name is available. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.Serialization.cs index c7b036f75aed..15f1a733e659 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformResourceUploadResult + public partial class AppPlatformResourceUploadResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformResourceUploadResult DeserializeAppPlatformResourceUploadResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RelativePath)) + { + writer.WritePropertyName("relativePath"u8); + writer.WriteStringValue(RelativePath); + } + if (Optional.IsDefined(UploadUri)) + { + writer.WritePropertyName("uploadUrl"u8); + writer.WriteStringValue(UploadUri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformResourceUploadResult DeserializeAppPlatformResourceUploadResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional relativePath = default; Optional uploadUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("relativePath"u8)) @@ -37,8 +75,61 @@ internal static AppPlatformResourceUploadResult DeserializeAppPlatformResourceUp uploadUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformResourceUploadResult(relativePath.Value, uploadUri.Value); + return new AppPlatformResourceUploadResult(relativePath.Value, uploadUri.Value, serializedAdditionalRawData); + } + + AppPlatformResourceUploadResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformResourceUploadResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformResourceUploadResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformResourceUploadResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformResourceUploadResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformResourceUploadResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformResourceUploadResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.cs index 073b10bd56f0..9fe9d2edf096 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformResourceUploadResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models { /// Resource upload definition payload. public partial class AppPlatformResourceUploadResult { - /// Initializes a new instance of AppPlatformResourceUploadResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformResourceUploadResult() { } - /// Initializes a new instance of AppPlatformResourceUploadResult. + /// Initializes a new instance of . /// Source relative path. /// Upload URL. - internal AppPlatformResourceUploadResult(string relativePath, Uri uploadUri) + /// Keeps track of any properties unknown to the library. + internal AppPlatformResourceUploadResult(string relativePath, Uri uploadUri, Dictionary serializedAdditionalRawData) { RelativePath = relativePath; UploadUri = uploadUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Source relative path. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceData.Serialization.cs index 39a00525878f..0e5ae1fb19d5 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceData.Serialization.cs @@ -5,28 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformServiceData : IUtf8JsonSerializable + public partial class AppPlatformServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -41,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformServiceData DeserializeAppPlatformServiceData(JsonElement element) + internal static AppPlatformServiceData DeserializeAppPlatformServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +93,7 @@ internal static AppPlatformServiceData DeserializeAppPlatformServiceData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -121,8 +157,61 @@ internal static AppPlatformServiceData DeserializeAppPlatformServiceData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, serializedAdditionalRawData); + } + + AppPlatformServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceData model) + { + if (model is null) + { + return null; } - return new AppPlatformServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.Serialization.cs index e1cc9b45a34b..2a94779b762f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceNetworkProfile : IUtf8JsonSerializable + public partial class AppPlatformServiceNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ServiceRuntimeSubnetId)) { @@ -44,18 +51,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IngressConfig)) { writer.WritePropertyName("ingressConfig"u8); - writer.WriteObjectValue(IngressConfig); + if (IngressConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IngressConfig).Serialize(writer, options); + } } if (Optional.IsDefined(OutboundType)) { writer.WritePropertyName("outboundType"u8); writer.WriteStringValue(OutboundType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformServiceNetworkProfile DeserializeAppPlatformServiceNetworkProfile(JsonElement element) + internal static AppPlatformServiceNetworkProfile DeserializeAppPlatformServiceNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +97,7 @@ internal static AppPlatformServiceNetworkProfile DeserializeAppPlatformServiceNe Optional> requiredTraffics = default; Optional ingressConfig = default; Optional outboundType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serviceRuntimeSubnetId"u8)) @@ -141,8 +170,61 @@ internal static AppPlatformServiceNetworkProfile DeserializeAppPlatformServiceNe outboundType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformServiceNetworkProfile(serviceRuntimeSubnetId.Value, appSubnetId.Value, serviceCidr.Value, serviceRuntimeNetworkResourceGroup.Value, appNetworkResourceGroup.Value, outboundIPs.Value, Optional.ToList(requiredTraffics), ingressConfig.Value, outboundType.Value, serializedAdditionalRawData); + } + + AppPlatformServiceNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceNetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceNetworkProfile(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformServiceNetworkProfile(serviceRuntimeSubnetId.Value, appSubnetId.Value, serviceCidr.Value, serviceRuntimeNetworkResourceGroup.Value, appNetworkResourceGroup.Value, outboundIPs.Value, Optional.ToList(requiredTraffics), ingressConfig.Value, outboundType.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.cs index a091c00fa31e..5037e39763aa 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Service network profile payload. public partial class AppPlatformServiceNetworkProfile { - /// Initializes a new instance of AppPlatformServiceNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformServiceNetworkProfile() { RequiredTraffics = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformServiceNetworkProfile. + /// Initializes a new instance of . /// Fully qualified resource Id of the subnet to host Azure Spring Apps Service Runtime. /// Fully qualified resource Id of the subnet to host customer apps in Azure Spring Apps. /// Azure Spring Apps service reserved CIDR. @@ -30,7 +34,8 @@ public AppPlatformServiceNetworkProfile() /// Required inbound or outbound traffics for Azure Spring Apps resource. /// Ingress configuration payload for Azure Spring Apps resource. /// The egress traffic type of Azure Spring Apps VNet instances. - internal AppPlatformServiceNetworkProfile(ResourceIdentifier serviceRuntimeSubnetId, ResourceIdentifier appSubnetId, string serviceCidr, string serviceRuntimeNetworkResourceGroup, string appNetworkResourceGroup, NetworkProfileOutboundIPs outboundIPs, IReadOnlyList requiredTraffics, IngressConfig ingressConfig, string outboundType) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceNetworkProfile(ResourceIdentifier serviceRuntimeSubnetId, ResourceIdentifier appSubnetId, string serviceCidr, string serviceRuntimeNetworkResourceGroup, string appNetworkResourceGroup, NetworkProfileOutboundIPs outboundIPs, IReadOnlyList requiredTraffics, IngressConfig ingressConfig, string outboundType, Dictionary serializedAdditionalRawData) { ServiceRuntimeSubnetId = serviceRuntimeSubnetId; AppSubnetId = appSubnetId; @@ -41,6 +46,7 @@ internal AppPlatformServiceNetworkProfile(ResourceIdentifier serviceRuntimeSubne RequiredTraffics = requiredTraffics; IngressConfig = ingressConfig; OutboundType = outboundType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Fully qualified resource Id of the subnet to host Azure Spring Apps Service Runtime. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.Serialization.cs index 46d7a461c4d6..b3b9e500d73c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.Serialization.cs @@ -5,36 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceProperties : IUtf8JsonSerializable + public partial class AppPlatformServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(VnetAddons)) { writer.WritePropertyName("vnetAddons"u8); - writer.WriteObjectValue(VnetAddons); + if (VnetAddons is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VnetAddons).Serialize(writer, options); + } } if (Optional.IsDefined(IsZoneRedundant)) { writer.WritePropertyName("zoneRedundant"u8); writer.WriteBooleanValue(IsZoneRedundant.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformServiceProperties DeserializeAppPlatformServiceProperties(JsonElement element) + internal static AppPlatformServiceProperties DeserializeAppPlatformServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +83,7 @@ internal static AppPlatformServiceProperties DeserializeAppPlatformServiceProper Optional powerState = default; Optional zoneRedundant = default; Optional fqdn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -113,8 +150,61 @@ internal static AppPlatformServiceProperties DeserializeAppPlatformServiceProper fqdn = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformServiceProperties(Optional.ToNullable(provisioningState), networkProfile.Value, vnetAddons.Value, Optional.ToNullable(version), serviceId.Value, Optional.ToNullable(powerState), Optional.ToNullable(zoneRedundant), fqdn.Value, serializedAdditionalRawData); + } + + AppPlatformServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformServiceProperties(Optional.ToNullable(provisioningState), networkProfile.Value, vnetAddons.Value, Optional.ToNullable(version), serviceId.Value, Optional.ToNullable(powerState), Optional.ToNullable(zoneRedundant), fqdn.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.cs index 3f0abfd3b948..45f245f7f2d2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceProperties.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Service properties payload. public partial class AppPlatformServiceProperties { - /// Initializes a new instance of AppPlatformServiceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformServiceProperties() { } - /// Initializes a new instance of AppPlatformServiceProperties. + /// Initializes a new instance of . /// Provisioning state of the Service. /// Network profile of the Service. /// Additional Service settings in vnet injection instance. @@ -24,7 +30,8 @@ public AppPlatformServiceProperties() /// Power state of the Service. /// /// Fully qualified dns name of the service instance. - internal AppPlatformServiceProperties(AppPlatformServiceProvisioningState? provisioningState, AppPlatformServiceNetworkProfile networkProfile, ServiceVnetAddons vnetAddons, int? version, string serviceInstanceId, AppPlatformServicePowerState? powerState, bool? isZoneRedundant, string fqdn) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceProperties(AppPlatformServiceProvisioningState? provisioningState, AppPlatformServiceNetworkProfile networkProfile, ServiceVnetAddons vnetAddons, int? version, string serviceInstanceId, AppPlatformServicePowerState? powerState, bool? isZoneRedundant, string fqdn, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; NetworkProfile = networkProfile; @@ -34,6 +41,7 @@ internal AppPlatformServiceProperties(AppPlatformServiceProvisioningState? provi PowerState = powerState; IsZoneRedundant = isZoneRedundant; Fqdn = fqdn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the Service. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryData.Serialization.cs index 00bb70eee0ad..34a926c370f4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformServiceRegistryData : IUtf8JsonSerializable + public partial class AppPlatformServiceRegistryData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformServiceRegistryData DeserializeAppPlatformServiceRegistryData(JsonElement element) + internal static AppPlatformServiceRegistryData DeserializeAppPlatformServiceRegistryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformServiceRegistryData DeserializeAppPlatformServiceRegi string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformServiceRegistryData DeserializeAppPlatformServiceRegi systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformServiceRegistryData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformServiceRegistryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceRegistryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceRegistryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceRegistryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceRegistryData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceRegistryData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformServiceRegistryData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceRegistryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.Serialization.cs index b8fbe63d2649..56091789a5d1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceRegistryInstance + public partial class AppPlatformServiceRegistryInstance : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformServiceRegistryInstance DeserializeAppPlatformServiceRegistryInstance(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformServiceRegistryInstance DeserializeAppPlatformServiceRegistryInstance(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static AppPlatformServiceRegistryInstance DeserializeAppPlatformService status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformServiceRegistryInstance(name.Value, status.Value); + return new AppPlatformServiceRegistryInstance(name.Value, status.Value, serializedAdditionalRawData); + } + + AppPlatformServiceRegistryInstance IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceRegistryInstance(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceRegistryInstance IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceRegistryInstance(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceRegistryInstance model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceRegistryInstance(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceRegistryInstance(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.cs index 30dccd331232..9302ddca0d3c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryInstance.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Collection of instances belong to the Service Registry. public partial class AppPlatformServiceRegistryInstance { - /// Initializes a new instance of AppPlatformServiceRegistryInstance. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformServiceRegistryInstance() { } - /// Initializes a new instance of AppPlatformServiceRegistryInstance. + /// Initializes a new instance of . /// Name of the Service Registry instance. /// Status of the Service Registry instance. - internal AppPlatformServiceRegistryInstance(string name, string status) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceRegistryInstance(string name, string status, Dictionary serializedAdditionalRawData) { Name = name; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Service Registry instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.Serialization.cs index 9e2cc9edee35..5d035173b3c7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.Serialization.cs @@ -5,22 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceRegistryProperties : IUtf8JsonSerializable + public partial class AppPlatformServiceRegistryProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformServiceRegistryProperties DeserializeAppPlatformServiceRegistryProperties(JsonElement element) + internal static AppPlatformServiceRegistryProperties DeserializeAppPlatformServiceRegistryProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +49,7 @@ internal static AppPlatformServiceRegistryProperties DeserializeAppPlatformServi Optional provisioningState = default; Optional resourceRequests = default; Optional> instances = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -62,8 +84,61 @@ internal static AppPlatformServiceRegistryProperties DeserializeAppPlatformServi instances = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformServiceRegistryProperties(Optional.ToNullable(provisioningState), resourceRequests.Value, Optional.ToList(instances), serializedAdditionalRawData); + } + + AppPlatformServiceRegistryProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceRegistryProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceRegistryProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceRegistryProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceRegistryProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformServiceRegistryProperties(Optional.ToNullable(provisioningState), resourceRequests.Value, Optional.ToList(instances)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceRegistryProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceRegistryProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.cs index 766be802ca5a..37fc4e0f2f2b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Service Registry properties payload. public partial class AppPlatformServiceRegistryProperties { - /// Initializes a new instance of AppPlatformServiceRegistryProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformServiceRegistryProperties() { Instances = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformServiceRegistryProperties. + /// Initializes a new instance of . /// State of the Service Registry. /// The requested resource quantity for required CPU and Memory. /// Collection of instances belong to Service Registry. - internal AppPlatformServiceRegistryProperties(AppPlatformServiceRegistryProvisioningState? provisioningState, AppPlatformServiceRegistryResourceRequirements resourceRequests, IReadOnlyList instances) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceRegistryProperties(AppPlatformServiceRegistryProvisioningState? provisioningState, AppPlatformServiceRegistryResourceRequirements resourceRequests, IReadOnlyList instances, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; ResourceRequests = resourceRequests; Instances = instances; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the Service Registry. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.Serialization.cs index b755b1cec033..adfb9e2eb97c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceRegistryResourceRequirements + public partial class AppPlatformServiceRegistryResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformServiceRegistryResourceRequirements DeserializeAppPlatformServiceRegistryResourceRequirements(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformServiceRegistryResourceRequirements DeserializeAppPlatformServiceRegistryResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AppPlatformServiceRegistryResourceRequirements DeserializeAppPla Optional cpu = default; Optional memory = default; Optional instanceCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -42,8 +71,61 @@ internal static AppPlatformServiceRegistryResourceRequirements DeserializeAppPla instanceCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformServiceRegistryResourceRequirements(cpu.Value, memory.Value, Optional.ToNullable(instanceCount)); + return new AppPlatformServiceRegistryResourceRequirements(cpu.Value, memory.Value, Optional.ToNullable(instanceCount), serializedAdditionalRawData); + } + + AppPlatformServiceRegistryResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceRegistryResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceRegistryResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceRegistryResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceRegistryResourceRequirements model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceRegistryResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceRegistryResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.cs index 68a97805821e..12c72b371668 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRegistryResourceRequirements.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Resource request payload of Service Registry. public partial class AppPlatformServiceRegistryResourceRequirements { - /// Initializes a new instance of AppPlatformServiceRegistryResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformServiceRegistryResourceRequirements() { } - /// Initializes a new instance of AppPlatformServiceRegistryResourceRequirements. + /// Initializes a new instance of . /// Cpu allocated to each Service Registry instance. /// Memory allocated to each Service Registry instance. /// Instance count of the Service Registry. - internal AppPlatformServiceRegistryResourceRequirements(string cpu, string memory, int? instanceCount) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceRegistryResourceRequirements(string cpu, string memory, int? instanceCount, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; InstanceCount = instanceCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cpu allocated to each Service Registry instance. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.Serialization.cs index 4fcf3f030a71..53ec004a8d7b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceRequiredTraffic + public partial class AppPlatformServiceRequiredTraffic : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformServiceRequiredTraffic DeserializeAppPlatformServiceRequiredTraffic(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformServiceRequiredTraffic DeserializeAppPlatformServiceRequiredTraffic(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static AppPlatformServiceRequiredTraffic DeserializeAppPlatformServiceR Optional> ips = default; Optional> fqdns = default; Optional direction = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("protocol"u8)) @@ -85,8 +113,61 @@ internal static AppPlatformServiceRequiredTraffic DeserializeAppPlatformServiceR direction = new AppPlatformServiceTrafficDirection(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformServiceRequiredTraffic(protocol.Value, Optional.ToNullable(port), Optional.ToList(ips), Optional.ToList(fqdns), Optional.ToNullable(direction)); + return new AppPlatformServiceRequiredTraffic(protocol.Value, Optional.ToNullable(port), Optional.ToList(ips), Optional.ToList(fqdns), Optional.ToNullable(direction), serializedAdditionalRawData); + } + + AppPlatformServiceRequiredTraffic IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceRequiredTraffic(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceRequiredTraffic IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceRequiredTraffic(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceRequiredTraffic model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceRequiredTraffic(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceRequiredTraffic(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.cs index d96b57c8b64c..433383fba2ed 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceRequiredTraffic.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -14,26 +15,31 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Required inbound or outbound traffic for Azure Spring Apps resource. public partial class AppPlatformServiceRequiredTraffic { - /// Initializes a new instance of AppPlatformServiceRequiredTraffic. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformServiceRequiredTraffic() { IPs = new ChangeTrackingList(); Fqdns = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformServiceRequiredTraffic. + /// Initializes a new instance of . /// The protocol of required traffic. /// The port of required traffic. /// The ip list of required traffic. /// The FQDN list of required traffic. /// The direction of required traffic. - internal AppPlatformServiceRequiredTraffic(string protocol, int? port, IReadOnlyList ips, IReadOnlyList fqdns, AppPlatformServiceTrafficDirection? direction) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceRequiredTraffic(string protocol, int? port, IReadOnlyList ips, IReadOnlyList fqdns, AppPlatformServiceTrafficDirection? direction, Dictionary serializedAdditionalRawData) { Protocol = protocol; Port = port; IPs = ips; Fqdns = fqdns; Direction = direction; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The protocol of required traffic. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.Serialization.cs index 7ae04a206b10..d70b52959eb3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformServiceTestKeys + public partial class AppPlatformServiceTestKeys : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformServiceTestKeys DeserializeAppPlatformServiceTestKeys(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PrimaryKey)) + { + writer.WritePropertyName("primaryKey"u8); + writer.WriteStringValue(PrimaryKey); + } + if (Optional.IsDefined(SecondaryKey)) + { + writer.WritePropertyName("secondaryKey"u8); + writer.WriteStringValue(SecondaryKey); + } + if (Optional.IsDefined(PrimaryTestEndpoint)) + { + writer.WritePropertyName("primaryTestEndpoint"u8); + writer.WriteStringValue(PrimaryTestEndpoint); + } + if (Optional.IsDefined(SecondaryTestEndpoint)) + { + writer.WritePropertyName("secondaryTestEndpoint"u8); + writer.WriteStringValue(SecondaryTestEndpoint); + } + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformServiceTestKeys DeserializeAppPlatformServiceTestKeys(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static AppPlatformServiceTestKeys DeserializeAppPlatformServiceTestKeys Optional primaryTestEndpoint = default; Optional secondaryTestEndpoint = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryKey"u8)) @@ -54,8 +108,61 @@ internal static AppPlatformServiceTestKeys DeserializeAppPlatformServiceTestKeys enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformServiceTestKeys(primaryKey.Value, secondaryKey.Value, primaryTestEndpoint.Value, secondaryTestEndpoint.Value, Optional.ToNullable(enabled)); + return new AppPlatformServiceTestKeys(primaryKey.Value, secondaryKey.Value, primaryTestEndpoint.Value, secondaryTestEndpoint.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + AppPlatformServiceTestKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformServiceTestKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformServiceTestKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformServiceTestKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformServiceTestKeys model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformServiceTestKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformServiceTestKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.cs index 10f578dd2096..68ebb9e791d7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformServiceTestKeys.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Test keys payload. public partial class AppPlatformServiceTestKeys { - /// Initializes a new instance of AppPlatformServiceTestKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformServiceTestKeys() { } - /// Initializes a new instance of AppPlatformServiceTestKeys. + /// Initializes a new instance of . /// Primary key. /// Secondary key. /// Primary test endpoint. /// Secondary test endpoint. /// Indicates whether the test endpoint feature enabled or not. - internal AppPlatformServiceTestKeys(string primaryKey, string secondaryKey, string primaryTestEndpoint, string secondaryTestEndpoint, bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal AppPlatformServiceTestKeys(string primaryKey, string secondaryKey, string primaryTestEndpoint, string secondaryTestEndpoint, bool? isEnabled, Dictionary serializedAdditionalRawData) { PrimaryKey = primaryKey; SecondaryKey = secondaryKey; PrimaryTestEndpoint = primaryTestEndpoint; SecondaryTestEndpoint = secondaryTestEndpoint; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Primary key. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.Serialization.cs index 704d68d7ce23..307fff2af6f3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSku : IUtf8JsonSerializable + public partial class AppPlatformSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformSku DeserializeAppPlatformSku(JsonElement element) + internal static AppPlatformSku DeserializeAppPlatformSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AppPlatformSku DeserializeAppPlatformSku(JsonElement element) Optional name = default; Optional tier = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +86,61 @@ internal static AppPlatformSku DeserializeAppPlatformSku(JsonElement element) capacity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformSku(name.Value, tier.Value, Optional.ToNullable(capacity), serializedAdditionalRawData); + } + + AppPlatformSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSku model) + { + if (model is null) + { + return null; } - return new AppPlatformSku(name.Value, tier.Value, Optional.ToNullable(capacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.cs index 3b59dfd659fe..a227f2568f53 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSku.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Sku of Azure Spring Apps. public partial class AppPlatformSku { - /// Initializes a new instance of AppPlatformSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformSku() { } - /// Initializes a new instance of AppPlatformSku. + /// Initializes a new instance of . /// Name of the Sku. /// Tier of the Sku. /// Current capacity of the target resource. - internal AppPlatformSku(string name, string tier, int? capacity) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSku(string name, string tier, int? capacity, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Sku. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.Serialization.cs index a1b815033768..8928ff4e62a7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSkuCapabilities + public partial class AppPlatformSkuCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSkuCapabilities DeserializeAppPlatformSkuCapabilities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSkuCapabilities DeserializeAppPlatformSkuCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static AppPlatformSkuCapabilities DeserializeAppPlatformSkuCapabilities value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSkuCapabilities(name.Value, value.Value); + return new AppPlatformSkuCapabilities(name.Value, value.Value, serializedAdditionalRawData); + } + + AppPlatformSkuCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSkuCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSkuCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSkuCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSkuCapabilities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSkuCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSkuCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.cs index 46b32e53a674..9b77525dae2a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapabilities.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The AppPlatformSkuCapabilities. public partial class AppPlatformSkuCapabilities { - /// Initializes a new instance of AppPlatformSkuCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformSkuCapabilities() { } - /// Initializes a new instance of AppPlatformSkuCapabilities. + /// Initializes a new instance of . /// Gets an invariant to describe the feature. /// Gets an invariant if the feature is measured by quantity. - internal AppPlatformSkuCapabilities(string name, string value) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSkuCapabilities(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets an invariant to describe the feature. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.Serialization.cs index c099bb1bf24e..1aae59521704 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.Serialization.cs @@ -5,15 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSkuCapacity + public partial class AppPlatformSkuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSkuCapacity DeserializeAppPlatformSkuCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("minimum"u8); + writer.WriteNumberValue(Minimum); + if (Optional.IsDefined(Maximum)) + { + writer.WritePropertyName("maximum"u8); + writer.WriteNumberValue(Maximum.Value); + } + if (Optional.IsDefined(Default)) + { + writer.WritePropertyName("default"u8); + writer.WriteNumberValue(Default.Value); + } + if (Optional.IsDefined(ScaleType)) + { + writer.WritePropertyName("scaleType"u8); + writer.WriteStringValue(ScaleType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSkuCapacity DeserializeAppPlatformSkuCapacity(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +67,7 @@ internal static AppPlatformSkuCapacity DeserializeAppPlatformSkuCapacity(JsonEle Optional maximum = default; Optional @default = default; Optional scaleType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -56,8 +102,61 @@ internal static AppPlatformSkuCapacity DeserializeAppPlatformSkuCapacity(JsonEle scaleType = new AppPlatformSkuScaleType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSkuCapacity(minimum, Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType)); + return new AppPlatformSkuCapacity(minimum, Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType), serializedAdditionalRawData); + } + + AppPlatformSkuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSkuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSkuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSkuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSkuCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSkuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSkuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.cs index 23927e1f3993..9c3e22980668 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuCapacity.cs @@ -5,29 +5,42 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The SKU capacity. public partial class AppPlatformSkuCapacity { - /// Initializes a new instance of AppPlatformSkuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the minimum. internal AppPlatformSkuCapacity(int minimum) { Minimum = minimum; } - /// Initializes a new instance of AppPlatformSkuCapacity. + /// Initializes a new instance of . /// Gets or sets the minimum. /// Gets or sets the maximum. /// Gets or sets the default. /// Gets or sets the type of the scale. - internal AppPlatformSkuCapacity(int minimum, int? maximum, int? @default, AppPlatformSkuScaleType? scaleType) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSkuCapacity(int minimum, int? maximum, int? @default, AppPlatformSkuScaleType? scaleType, Dictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; Default = @default; ScaleType = scaleType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AppPlatformSkuCapacity() + { } /// Gets or sets the minimum. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.Serialization.cs index 76fbf478ee1a..2b210cfad5e0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSkuLocationInfo + public partial class AppPlatformSkuLocationInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSkuLocationInfo DeserializeAppPlatformSkuLocationInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ZoneDetails)) + { + writer.WritePropertyName("zoneDetails"u8); + writer.WriteStartArray(); + foreach (var item in ZoneDetails) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSkuLocationInfo DeserializeAppPlatformSkuLocationInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +81,7 @@ internal static AppPlatformSkuLocationInfo DeserializeAppPlatformSkuLocationInfo Optional location = default; Optional> zones = default; Optional> zoneDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -61,8 +121,61 @@ internal static AppPlatformSkuLocationInfo DeserializeAppPlatformSkuLocationInfo zoneDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(zoneDetails)); + return new AppPlatformSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(zoneDetails), serializedAdditionalRawData); + } + + AppPlatformSkuLocationInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSkuLocationInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSkuLocationInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSkuLocationInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSkuLocationInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSkuLocationInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSkuLocationInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.cs index af149842c59d..7dcd0f936ea9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuLocationInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Locations and availability zones where the SKU is available. public partial class AppPlatformSkuLocationInfo { - /// Initializes a new instance of AppPlatformSkuLocationInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformSkuLocationInfo() { Zones = new ChangeTrackingList(); ZoneDetails = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformSkuLocationInfo. + /// Initializes a new instance of . /// Gets location of the SKU. /// Gets list of availability zones where the SKU is supported. /// Gets details of capabilities available to a SKU in specific zones. - internal AppPlatformSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList zoneDetails) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList zoneDetails, Dictionary serializedAdditionalRawData) { Location = location; Zones = zones; ZoneDetails = zoneDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets location of the SKU. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.Serialization.cs index 42b89d9c4de2..6488ba4a946d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.Serialization.cs @@ -5,22 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSkuRestrictionInfo + public partial class AppPlatformSkuRestrictionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSkuRestrictionInfo DeserializeAppPlatformSkuRestrictionInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSkuRestrictionInfo DeserializeAppPlatformSkuRestrictionInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> locations = default; Optional> zones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("locations"u8)) @@ -51,8 +99,61 @@ internal static AppPlatformSkuRestrictionInfo DeserializeAppPlatformSkuRestricti zones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones)); + return new AppPlatformSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones), serializedAdditionalRawData); + } + + AppPlatformSkuRestrictionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSkuRestrictionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSkuRestrictionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSkuRestrictionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSkuRestrictionInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSkuRestrictionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSkuRestrictionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.cs index 8e2b8d7af8ed..3ebfe13697ec 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictionInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Information about the restriction where the SKU cannot be used. public partial class AppPlatformSkuRestrictionInfo { - /// Initializes a new instance of AppPlatformSkuRestrictionInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformSkuRestrictionInfo() { Locations = new ChangeTrackingList(); Zones = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformSkuRestrictionInfo. + /// Initializes a new instance of . /// Gets locations where the SKU is restricted. /// Gets list of availability zones where the SKU is restricted. - internal AppPlatformSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones, Dictionary serializedAdditionalRawData) { Locations = locations; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets locations where the SKU is restricted. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.Serialization.cs index 84e8c56b809d..2f424fe9048f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSkuRestrictions + public partial class AppPlatformSkuRestrictions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSkuRestrictions DeserializeAppPlatformSkuRestrictions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RestrictionsType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RestrictionsType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RestrictionInfo)) + { + writer.WritePropertyName("restrictionInfo"u8); + if (RestrictionInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestrictionInfo).Serialize(writer, options); + } + } + if (Optional.IsDefined(ReasonCode)) + { + writer.WritePropertyName("reasonCode"u8); + writer.WriteStringValue(ReasonCode.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSkuRestrictions DeserializeAppPlatformSkuRestrictions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +82,7 @@ internal static AppPlatformSkuRestrictions DeserializeAppPlatformSkuRestrictions Optional> values = default; Optional restrictionInfo = default; Optional reasonCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -66,8 +126,61 @@ internal static AppPlatformSkuRestrictions DeserializeAppPlatformSkuRestrictions reasonCode = new AppPlatformSkuRestrictionsReasonCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode)); + return new AppPlatformSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode), serializedAdditionalRawData); + } + + AppPlatformSkuRestrictions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSkuRestrictions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSkuRestrictions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSkuRestrictions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSkuRestrictions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSkuRestrictions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSkuRestrictions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.cs index f167859bf436..938cf2abdf84 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuRestrictions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Restrictions where the SKU cannot be used. public partial class AppPlatformSkuRestrictions { - /// Initializes a new instance of AppPlatformSkuRestrictions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformSkuRestrictions() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformSkuRestrictions. + /// Initializes a new instance of . /// Gets the type of restrictions. Possible values include: 'Location', 'Zone'. /// /// Gets the value of restrictions. If the restriction type is set to @@ -27,12 +31,14 @@ internal AppPlatformSkuRestrictions() /// /// Gets the information about the restriction where the SKU cannot be used. /// Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. - internal AppPlatformSkuRestrictions(AppPlatformSkuRestrictionsType? restrictionsType, IReadOnlyList values, AppPlatformSkuRestrictionInfo restrictionInfo, AppPlatformSkuRestrictionsReasonCode? reasonCode) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSkuRestrictions(AppPlatformSkuRestrictionsType? restrictionsType, IReadOnlyList values, AppPlatformSkuRestrictionInfo restrictionInfo, AppPlatformSkuRestrictionsReasonCode? reasonCode, Dictionary serializedAdditionalRawData) { RestrictionsType = restrictionsType; Values = values; RestrictionInfo = restrictionInfo; ReasonCode = reasonCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the type of restrictions. Possible values include: 'Location', 'Zone'. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.Serialization.cs index 87be66722d9a..11ed9ab094e0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.Serialization.cs @@ -5,22 +5,77 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSkuZoneDetails + public partial class AppPlatformSkuZoneDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSkuZoneDetails DeserializeAppPlatformSkuZoneDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStartArray(); + foreach (var item in Name) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Capabilities)) + { + writer.WritePropertyName("capabilities"u8); + writer.WriteStartArray(); + foreach (var item in Capabilities) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSkuZoneDetails DeserializeAppPlatformSkuZoneDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> name = default; Optional> capabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -51,8 +106,61 @@ internal static AppPlatformSkuZoneDetails DeserializeAppPlatformSkuZoneDetails(J capabilities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSkuZoneDetails(Optional.ToList(name), Optional.ToList(capabilities)); + return new AppPlatformSkuZoneDetails(Optional.ToList(name), Optional.ToList(capabilities), serializedAdditionalRawData); + } + + AppPlatformSkuZoneDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSkuZoneDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSkuZoneDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSkuZoneDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSkuZoneDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSkuZoneDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSkuZoneDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.cs index 38f09a7a1689..0d5438b1d74b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSkuZoneDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Details of capabilities available to a SKU in specific zones. public partial class AppPlatformSkuZoneDetails { - /// Initializes a new instance of AppPlatformSkuZoneDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformSkuZoneDetails() { Name = new ChangeTrackingList(); Capabilities = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformSkuZoneDetails. + /// Initializes a new instance of . /// /// Gets the set of zones that the SKU is available in with the /// specified capabilities. @@ -29,10 +33,12 @@ internal AppPlatformSkuZoneDetails() /// Gets a list of capabilities that are available for the SKU in the /// specified list of zones. /// - internal AppPlatformSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities, Dictionary serializedAdditionalRawData) { Name = name; Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.Serialization.cs index 6ce6e4f6a214..58ce2b25c43b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSsoProperties : IUtf8JsonSerializable + public partial class AppPlatformSsoProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Scope)) { @@ -42,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("issuerUri"u8); writer.WriteStringValue(IssuerUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformSsoProperties DeserializeAppPlatformSsoProperties(JsonElement element) + internal static AppPlatformSsoProperties DeserializeAppPlatformSsoProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +75,7 @@ internal static AppPlatformSsoProperties DeserializeAppPlatformSsoProperties(Jso Optional clientId = default; Optional clientSecret = default; Optional issuerUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scope"u8)) @@ -90,8 +111,61 @@ internal static AppPlatformSsoProperties DeserializeAppPlatformSsoProperties(Jso issuerUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformSsoProperties(Optional.ToList(scope), clientId.Value, clientSecret.Value, issuerUri.Value, serializedAdditionalRawData); + } + + AppPlatformSsoProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSsoProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSsoProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSsoProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSsoProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformSsoProperties(Optional.ToList(scope), clientId.Value, clientSecret.Value, issuerUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSsoProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSsoProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.cs index 1e66c33e3e3b..c72c17ce3986 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSsoProperties.cs @@ -14,23 +14,28 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Single sign-on related configuration. public partial class AppPlatformSsoProperties { - /// Initializes a new instance of AppPlatformSsoProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformSsoProperties() { Scope = new ChangeTrackingList(); } - /// Initializes a new instance of AppPlatformSsoProperties. + /// Initializes a new instance of . /// It defines the specific actions applications can be allowed to do on a user's behalf. /// The public identifier for the application. /// The secret known only to the application and the authorization server. /// The URI of Issuer Identifier. - internal AppPlatformSsoProperties(IList scope, string clientId, string clientSecret, Uri issuerUri) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSsoProperties(IList scope, string clientId, string clientSecret, Uri issuerUri, Dictionary serializedAdditionalRawData) { Scope = scope; ClientId = clientId; ClientSecret = clientSecret; IssuerUri = issuerUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// It defines the specific actions applications can be allowed to do on a user's behalf. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.Serialization.cs index 4f66d1f1a026..47f809aa7f58 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformStorageAccount : IUtf8JsonSerializable + public partial class AppPlatformStorageAccount : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("accountName"u8); writer.WriteStringValue(AccountName); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AccountKey); writer.WritePropertyName("storageType"u8); writer.WriteStringValue(StorageType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformStorageAccount DeserializeAppPlatformStorageAccount(JsonElement element) + internal static AppPlatformStorageAccount DeserializeAppPlatformStorageAccount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static AppPlatformStorageAccount DeserializeAppPlatformStorageAccount(J string accountName = default; string accountKey = default; StorageType storageType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -50,8 +73,61 @@ internal static AppPlatformStorageAccount DeserializeAppPlatformStorageAccount(J storageType = new StorageType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformStorageAccount(storageType, accountName, accountKey, serializedAdditionalRawData); + } + + AppPlatformStorageAccount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformStorageAccount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformStorageAccount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformStorageAccount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformStorageAccount model) + { + if (model is null) + { + return null; } - return new AppPlatformStorageAccount(storageType, accountName, accountKey); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformStorageAccount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformStorageAccount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.cs index 741f067969cb..4f4ba6202469 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageAccount.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppPlatform.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.AppPlatform.Models /// storage resource of type Azure Storage Account. public partial class AppPlatformStorageAccount : AppPlatformStorageProperties { - /// Initializes a new instance of AppPlatformStorageAccount. + /// Initializes a new instance of . /// The account name of the Azure Storage Account. /// The account key of the Azure Storage Account. /// or is null. @@ -27,17 +28,23 @@ public AppPlatformStorageAccount(string accountName, string accountKey) StorageType = StorageType.StorageAccount; } - /// Initializes a new instance of AppPlatformStorageAccount. + /// Initializes a new instance of . /// The type of the storage. /// The account name of the Azure Storage Account. /// The account key of the Azure Storage Account. - internal AppPlatformStorageAccount(StorageType storageType, string accountName, string accountKey) : base(storageType) + /// Keeps track of any properties unknown to the library. + internal AppPlatformStorageAccount(StorageType storageType, string accountName, string accountKey, Dictionary serializedAdditionalRawData) : base(storageType, serializedAdditionalRawData) { AccountName = accountName; AccountKey = accountKey; StorageType = storageType; } + /// Initializes a new instance of for deserialization. + internal AppPlatformStorageAccount() + { + } + /// The account name of the Azure Storage Account. public string AccountName { get; set; } /// The account key of the Azure Storage Account. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageData.Serialization.cs index f9e4b056a3a2..420eca8a4036 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformStorageData : IUtf8JsonSerializable + public partial class AppPlatformStorageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformStorageData DeserializeAppPlatformStorageData(JsonElement element) + internal static AppPlatformStorageData DeserializeAppPlatformStorageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformStorageData DeserializeAppPlatformStorageData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformStorageData DeserializeAppPlatformStorageData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformStorageData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformStorageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformStorageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformStorageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformStorageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformStorageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformStorageData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformStorageData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformStorageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.Serialization.cs index 785ba710b65b..2f0ddc8b19da 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformStorageProperties : IUtf8JsonSerializable + public partial class AppPlatformStorageProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageType"u8); writer.WriteStringValue(StorageType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformStorageProperties DeserializeAppPlatformStorageProperties(JsonElement element) + internal static AppPlatformStorageProperties DeserializeAppPlatformStorageProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,7 +55,72 @@ internal static AppPlatformStorageProperties DeserializeAppPlatformStorageProper case "StorageAccount": return AppPlatformStorageAccount.DeserializeAppPlatformStorageAccount(element); } } - return UnknownStorageProperties.DeserializeUnknownStorageProperties(element); + + // Unknown type found so we will deserialize the base properties only + StorageType storageType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageType"u8)) + { + storageType = new StorageType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownStorageProperties(storageType, serializedAdditionalRawData); + } + + AppPlatformStorageProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformStorageProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformStorageProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformStorageProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformStorageProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformStorageProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformStorageProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.cs index 7c5a4a787735..e5d9ddf05388 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformStorageProperties.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.AppPlatform.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// + [DeserializationProxy(typeof(UnknownStorageProperties))] public abstract partial class AppPlatformStorageProperties { - /// Initializes a new instance of AppPlatformStorageProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AppPlatformStorageProperties() { } - /// Initializes a new instance of AppPlatformStorageProperties. + /// Initializes a new instance of . /// The type of the storage. - internal AppPlatformStorageProperties(StorageType storageType) + /// Keeps track of any properties unknown to the library. + internal AppPlatformStorageProperties(StorageType storageType, Dictionary serializedAdditionalRawData) { StorageType = storageType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the storage. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedBuildpackData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedBuildpackData.Serialization.cs index 19075e23bace..31be070f2d26 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedBuildpackData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedBuildpackData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformSupportedBuildpackData : IUtf8JsonSerializable + public partial class AppPlatformSupportedBuildpackData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformSupportedBuildpackData DeserializeAppPlatformSupportedBuildpackData(JsonElement element) + internal static AppPlatformSupportedBuildpackData DeserializeAppPlatformSupportedBuildpackData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformSupportedBuildpackData DeserializeAppPlatformSupporte string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformSupportedBuildpackData DeserializeAppPlatformSupporte systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformSupportedBuildpackData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformSupportedBuildpackData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSupportedBuildpackData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSupportedBuildpackData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSupportedBuildpackData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSupportedBuildpackData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSupportedBuildpackData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformSupportedBuildpackData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSupportedBuildpackData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.Serialization.cs index 63ccf71867a7..726ef2d11a04 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSupportedRuntimeVersion + public partial class AppPlatformSupportedRuntimeVersion : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppPlatformSupportedRuntimeVersion DeserializeAppPlatformSupportedRuntimeVersion(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value.Value.ToString()); + } + if (Optional.IsDefined(Platform)) + { + writer.WritePropertyName("platform"u8); + writer.WriteStringValue(Platform.Value.ToString()); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppPlatformSupportedRuntimeVersion DeserializeAppPlatformSupportedRuntimeVersion(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static AppPlatformSupportedRuntimeVersion DeserializeAppPlatformSupport Optional value = default; Optional platform = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -46,8 +90,61 @@ internal static AppPlatformSupportedRuntimeVersion DeserializeAppPlatformSupport version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformSupportedRuntimeVersion(Optional.ToNullable(value), Optional.ToNullable(platform), version.Value); + return new AppPlatformSupportedRuntimeVersion(Optional.ToNullable(value), Optional.ToNullable(platform), version.Value, serializedAdditionalRawData); + } + + AppPlatformSupportedRuntimeVersion IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSupportedRuntimeVersion(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSupportedRuntimeVersion IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSupportedRuntimeVersion(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSupportedRuntimeVersion model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSupportedRuntimeVersion(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSupportedRuntimeVersion(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.cs index 130c261075d9..2226b9742aad 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedRuntimeVersion.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Supported deployment runtime version descriptor. public partial class AppPlatformSupportedRuntimeVersion { - /// Initializes a new instance of AppPlatformSupportedRuntimeVersion. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppPlatformSupportedRuntimeVersion() { } - /// Initializes a new instance of AppPlatformSupportedRuntimeVersion. + /// Initializes a new instance of . /// The raw value which could be passed to deployment CRUD operations. /// The platform of this runtime version (possible values: "Java" or ".NET"). /// The detailed version (major.minor) of the platform. - internal AppPlatformSupportedRuntimeVersion(AppPlatformSupportedRuntimeValue? value, AppPlatformSupportedRuntimePlatform? platform, string version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSupportedRuntimeVersion(AppPlatformSupportedRuntimeValue? value, AppPlatformSupportedRuntimePlatform? platform, string version, Dictionary serializedAdditionalRawData) { Value = value; Platform = platform; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The raw value which could be passed to deployment CRUD operations. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackData.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackData.Serialization.cs index f1899e53433e..a8d544e838dc 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackData.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppPlatform { - public partial class AppPlatformSupportedStackData : IUtf8JsonSerializable + public partial class AppPlatformSupportedStackData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AppPlatformSupportedStackData DeserializeAppPlatformSupportedStackData(JsonElement element) + internal static AppPlatformSupportedStackData DeserializeAppPlatformSupportedStackData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AppPlatformSupportedStackData DeserializeAppPlatformSupportedSta string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AppPlatformSupportedStackData DeserializeAppPlatformSupportedSta systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformSupportedStackData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AppPlatformSupportedStackData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSupportedStackData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSupportedStackData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSupportedStackData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSupportedStackData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSupportedStackData(Response response) + { + if (response is null) + { + return null; } - return new AppPlatformSupportedStackData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSupportedStackData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.Serialization.cs index 058bfe9656ff..2077eab02c16 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformSupportedStackProperties : IUtf8JsonSerializable + public partial class AppPlatformSupportedStackProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StackId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformSupportedStackProperties DeserializeAppPlatformSupportedStackProperties(JsonElement element) + internal static AppPlatformSupportedStackProperties DeserializeAppPlatformSupportedStackProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional stackId = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("stackId"u8)) @@ -48,8 +71,61 @@ internal static AppPlatformSupportedStackProperties DeserializeAppPlatformSuppor version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppPlatformSupportedStackProperties(stackId.Value, version.Value, serializedAdditionalRawData); + } + + AppPlatformSupportedStackProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformSupportedStackProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformSupportedStackProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformSupportedStackProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformSupportedStackProperties model) + { + if (model is null) + { + return null; } - return new AppPlatformSupportedStackProperties(stackId.Value, version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformSupportedStackProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformSupportedStackProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.cs index 149901fbcfab..21ddf1658dd9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformSupportedStackProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Supported stack resource properties. public partial class AppPlatformSupportedStackProperties { - /// Initializes a new instance of AppPlatformSupportedStackProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppPlatformSupportedStackProperties() { } - /// Initializes a new instance of AppPlatformSupportedStackProperties. + /// Initializes a new instance of . /// The id of supported stack. /// The version of supported stack. - internal AppPlatformSupportedStackProperties(string stackId, string version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformSupportedStackProperties(string stackId, string version, Dictionary serializedAdditionalRawData) { StackId = stackId; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of supported stack. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.Serialization.cs index f489952cb09f..ae12e52e565f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformUploadedUserSourceInfo : IUtf8JsonSerializable + public partial class AppPlatformUploadedUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RelativePath)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformUploadedUserSourceInfo DeserializeAppPlatformUploadedUserSourceInfo(JsonElement element) + internal static AppPlatformUploadedUserSourceInfo DeserializeAppPlatformUploadedUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,9 +67,12 @@ internal static AppPlatformUploadedUserSourceInfo DeserializeAppPlatformUploaded case "Source": return SourceUploadedUserSourceInfo.DeserializeSourceUploadedUserSourceInfo(element); } } + + // Unknown type found so we will deserialize the base properties only Optional relativePath = default; string type = "UploadedUserSourceInfo"; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("relativePath"u8)) @@ -65,8 +90,61 @@ internal static AppPlatformUploadedUserSourceInfo DeserializeAppPlatformUploaded version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppPlatformUploadedUserSourceInfo(type, version.Value, relativePath.Value); + return new AppPlatformUploadedUserSourceInfo(type, version.Value, relativePath.Value, serializedAdditionalRawData); + } + + AppPlatformUploadedUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformUploadedUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformUploadedUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformUploadedUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformUploadedUserSourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformUploadedUserSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformUploadedUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.cs index c981b5b58bbd..98e79c8eb5c0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUploadedUserSourceInfo.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// @@ -14,17 +17,18 @@ namespace Azure.ResourceManager.AppPlatform.Models /// public partial class AppPlatformUploadedUserSourceInfo : AppPlatformUserSourceInfo { - /// Initializes a new instance of AppPlatformUploadedUserSourceInfo. + /// Initializes a new instance of . public AppPlatformUploadedUserSourceInfo() { UserSourceInfoType = "UploadedUserSourceInfo"; } - /// Initializes a new instance of AppPlatformUploadedUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. /// Relative path of the storage which stores the source. - internal AppPlatformUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath) : base(userSourceInfoType, version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, serializedAdditionalRawData) { RelativePath = relativePath; UserSourceInfoType = userSourceInfoType ?? "UploadedUserSourceInfo"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.Serialization.cs index cf50a388f066..6ba982e4efb8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppPlatformUserSourceInfo : IUtf8JsonSerializable + public partial class AppPlatformUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(UserSourceInfoType); @@ -22,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppPlatformUserSourceInfo DeserializeAppPlatformUserSourceInfo(JsonElement element) + internal static AppPlatformUserSourceInfo DeserializeAppPlatformUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,7 +65,78 @@ internal static AppPlatformUserSourceInfo DeserializeAppPlatformUserSourceInfo(J case "UploadedUserSourceInfo": return AppPlatformUploadedUserSourceInfo.DeserializeAppPlatformUploadedUserSourceInfo(element); } } - return UnknownUserSourceInfo.DeserializeUnknownUserSourceInfo(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownUserSourceInfo(type, version.Value, serializedAdditionalRawData); + } + + AppPlatformUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppPlatformUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppPlatformUserSourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppPlatformUserSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppPlatformUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.cs index 670a6781b372..dd49441e2298 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppPlatformUserSourceInfo.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.AppPlatform.Models { /// @@ -12,20 +16,26 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , and . /// + [DeserializationProxy(typeof(UnknownUserSourceInfo))] public abstract partial class AppPlatformUserSourceInfo { - /// Initializes a new instance of AppPlatformUserSourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AppPlatformUserSourceInfo() { } - /// Initializes a new instance of AppPlatformUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. - internal AppPlatformUserSourceInfo(string userSourceInfoType, string version) + /// Keeps track of any properties unknown to the library. + internal AppPlatformUserSourceInfo(string userSourceInfoType, string version, Dictionary serializedAdditionalRawData) { UserSourceInfoType = userSourceInfoType; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of the source uploaded. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.Serialization.cs index de27086c1b86..613f7299b533 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class AppResourceList + internal partial class AppResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AppResourceList DeserializeAppResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AppResourceList DeserializeAppResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AppResourceList DeserializeAppResourceList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AppResourceList(Optional.ToList(value), nextLink.Value); + return new AppResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AppResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.cs index 4281cdc1cfea..33ca1a5dbe64 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of App resources and a possible link for next set. internal partial class AppResourceList { - /// Initializes a new instance of AppResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AppResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AppResourceList. + /// Initializes a new instance of . /// Collection of App resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal AppResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AppResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of App resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.Serialization.cs index 4f7c90af0ff0..7e9083ddc643 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppTemporaryDisk : IUtf8JsonSerializable + public partial class AppTemporaryDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SizeInGB)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mountPath"u8); writer.WriteStringValue(MountPath); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppTemporaryDisk DeserializeAppTemporaryDisk(JsonElement element) + internal static AppTemporaryDisk DeserializeAppTemporaryDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sizeInGB = default; Optional mountPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sizeInGB"u8)) @@ -52,8 +75,61 @@ internal static AppTemporaryDisk DeserializeAppTemporaryDisk(JsonElement element mountPath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppTemporaryDisk(Optional.ToNullable(sizeInGB), mountPath.Value, serializedAdditionalRawData); + } + + AppTemporaryDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppTemporaryDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppTemporaryDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppTemporaryDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppTemporaryDisk model) + { + if (model is null) + { + return null; } - return new AppTemporaryDisk(Optional.ToNullable(sizeInGB), mountPath.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppTemporaryDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppTemporaryDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.cs index efca0f2e04d5..2a68ce236cf2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppTemporaryDisk.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Temporary disk payload. public partial class AppTemporaryDisk { - /// Initializes a new instance of AppTemporaryDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppTemporaryDisk() { } - /// Initializes a new instance of AppTemporaryDisk. + /// Initializes a new instance of . /// Size of the temporary disk in GB. /// Mount path of the temporary disk. - internal AppTemporaryDisk(int? sizeInGB, string mountPath) + /// Keeps track of any properties unknown to the library. + internal AppTemporaryDisk(int? sizeInGB, string mountPath, Dictionary serializedAdditionalRawData) { SizeInGB = sizeInGB; MountPath = mountPath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Size of the temporary disk in GB. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.Serialization.cs index 9940db0c2423..eaa496c338e6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.Serialization.cs @@ -6,32 +6,54 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AppVnetAddons : IUtf8JsonSerializable + public partial class AppVnetAddons : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsPublicEndpoint)) { writer.WritePropertyName("publicEndpoint"u8); writer.WriteBooleanValue(IsPublicEndpoint.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppVnetAddons DeserializeAppVnetAddons(JsonElement element) + internal static AppVnetAddons DeserializeAppVnetAddons(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional publicEndpoint = default; Optional publicEndpointUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicEndpoint"u8)) @@ -52,8 +74,61 @@ internal static AppVnetAddons DeserializeAppVnetAddons(JsonElement element) publicEndpointUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppVnetAddons(Optional.ToNullable(publicEndpoint), publicEndpointUri.Value, serializedAdditionalRawData); + } + + AppVnetAddons IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppVnetAddons(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppVnetAddons IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppVnetAddons(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppVnetAddons model) + { + if (model is null) + { + return null; } - return new AppVnetAddons(Optional.ToNullable(publicEndpoint), publicEndpointUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppVnetAddons(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppVnetAddons(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.cs index 9fb4c939fa78..bde0babd8dc3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AppVnetAddons.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models { /// Additional App settings in vnet injection instance. public partial class AppVnetAddons { - /// Initializes a new instance of AppVnetAddons. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppVnetAddons() { } - /// Initializes a new instance of AppVnetAddons. + /// Initializes a new instance of . /// Indicates whether the App in vnet injection instance exposes endpoint which could be accessed from internet. /// URL of the App in vnet injection instance which could be accessed from internet. - internal AppVnetAddons(bool? isPublicEndpoint, Uri publicEndpointUri) + /// Keeps track of any properties unknown to the library. + internal AppVnetAddons(bool? isPublicEndpoint, Uri publicEndpointUri, Dictionary serializedAdditionalRawData) { IsPublicEndpoint = isPublicEndpoint; PublicEndpointUri = publicEndpointUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the App in vnet injection instance exposes endpoint which could be accessed from internet. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.Serialization.cs index e11d721b8043..9a82f50622c4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ApplicationDiagnosticContent : IUtf8JsonSerializable + public partial class ApplicationDiagnosticContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AppInstance)) { @@ -30,7 +38,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("duration"u8); writer.WriteStringValue(DurationValue); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApplicationDiagnosticContent DeserializeApplicationDiagnosticContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional appInstance = default; + Optional filePath = default; + Optional duration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("appInstance"u8)) + { + appInstance = property.Value.GetString(); + continue; + } + if (property.NameEquals("filePath"u8)) + { + filePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("duration"u8)) + { + duration = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationDiagnosticContent(appInstance.Value, filePath.Value, duration.Value, serializedAdditionalRawData); + } + + ApplicationDiagnosticContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationDiagnosticContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationDiagnosticContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationDiagnosticContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationDiagnosticContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationDiagnosticContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationDiagnosticContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.cs index 24ecf6141d7f..bcfb891bacc3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationDiagnosticContent.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Diagnostic parameters of diagnostic operations. public partial class ApplicationDiagnosticContent { - /// Initializes a new instance of ApplicationDiagnosticContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationDiagnosticContent() { } + /// Initializes a new instance of . + /// App instance name. + /// Your target file path in your own BYOS. + /// Duration of your JFR. 1 min can be represented by 1m or 60s. + /// Keeps track of any properties unknown to the library. + internal ApplicationDiagnosticContent(string appInstance, string filePath, string durationValue, Dictionary serializedAdditionalRawData) + { + AppInstance = appInstance; + FilePath = filePath; + DurationValue = durationValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// App instance name. public string AppInstance { get; set; } /// Your target file path in your own BYOS. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.Serialization.cs index 9b84bad50993..6251338ba0cd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ApplicationInsightsAgentVersions : IUtf8JsonSerializable + internal partial class ApplicationInsightsAgentVersions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationInsightsAgentVersions DeserializeApplicationInsightsAgentVersions(JsonElement element) + internal static ApplicationInsightsAgentVersions DeserializeApplicationInsightsAgentVersions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional java = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("java"u8)) @@ -32,8 +55,61 @@ internal static ApplicationInsightsAgentVersions DeserializeApplicationInsightsA java = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationInsightsAgentVersions(java.Value, serializedAdditionalRawData); + } + + ApplicationInsightsAgentVersions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationInsightsAgentVersions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationInsightsAgentVersions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationInsightsAgentVersions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationInsightsAgentVersions model) + { + if (model is null) + { + return null; } - return new ApplicationInsightsAgentVersions(java.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationInsightsAgentVersions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationInsightsAgentVersions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.cs index f89f30f8c969..7cdacebd7a6c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationInsightsAgentVersions.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Application Insights agent versions properties payload. internal partial class ApplicationInsightsAgentVersions { - /// Initializes a new instance of ApplicationInsightsAgentVersions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationInsightsAgentVersions() { } - /// Initializes a new instance of ApplicationInsightsAgentVersions. + /// Initializes a new instance of . /// Indicates the version of application insight java agent. - internal ApplicationInsightsAgentVersions(string appInsightsJavaAgentVersion) + /// Keeps track of any properties unknown to the library. + internal ApplicationInsightsAgentVersions(string appInsightsJavaAgentVersion, Dictionary serializedAdditionalRawData) { AppInsightsJavaAgentVersion = appInsightsJavaAgentVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates the version of application insight java agent. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.Serialization.cs index 604d90133d05..3c0363f1e97c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ApplicationRemoteDebuggingConfig + public partial class ApplicationRemoteDebuggingConfig : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplicationRemoteDebuggingConfig DeserializeApplicationRemoteDebuggingConfig(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplicationRemoteDebuggingConfig DeserializeApplicationRemoteDebuggingConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional port = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("port"u8)) @@ -40,8 +79,61 @@ internal static ApplicationRemoteDebuggingConfig DeserializeApplicationRemoteDeb enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplicationRemoteDebuggingConfig(Optional.ToNullable(port), Optional.ToNullable(enabled)); + return new ApplicationRemoteDebuggingConfig(Optional.ToNullable(port), Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ApplicationRemoteDebuggingConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationRemoteDebuggingConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationRemoteDebuggingConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationRemoteDebuggingConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationRemoteDebuggingConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationRemoteDebuggingConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationRemoteDebuggingConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.cs index 10500f727643..555d8f4beac0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingConfig.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Remote debugging config. public partial class ApplicationRemoteDebuggingConfig { - /// Initializes a new instance of ApplicationRemoteDebuggingConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplicationRemoteDebuggingConfig() { } - /// Initializes a new instance of ApplicationRemoteDebuggingConfig. + /// Initializes a new instance of . /// Application debugging port. /// Indicate if remote debugging is enabled. - internal ApplicationRemoteDebuggingConfig(int? port, bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal ApplicationRemoteDebuggingConfig(int? port, bool? isEnabled, Dictionary serializedAdditionalRawData) { Port = port; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Application debugging port. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.Serialization.cs index 48200fef3488..a2a58363f4c4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ApplicationRemoteDebuggingContent : IUtf8JsonSerializable + public partial class ApplicationRemoteDebuggingContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Port)) { writer.WritePropertyName("port"u8); writer.WriteNumberValue(Port.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ApplicationRemoteDebuggingContent DeserializeApplicationRemoteDebuggingContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationRemoteDebuggingContent(Optional.ToNullable(port), serializedAdditionalRawData); + } + + ApplicationRemoteDebuggingContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationRemoteDebuggingContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationRemoteDebuggingContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationRemoteDebuggingContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationRemoteDebuggingContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationRemoteDebuggingContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationRemoteDebuggingContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.cs index 40877e2401e1..3b25d44c8f24 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ApplicationRemoteDebuggingContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Remote debugging payload. public partial class ApplicationRemoteDebuggingContent { - /// Initializes a new instance of ApplicationRemoteDebuggingContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationRemoteDebuggingContent() { } + /// Initializes a new instance of . + /// Application debugging port. + /// Keeps track of any properties unknown to the library. + internal ApplicationRemoteDebuggingContent(int? port, Dictionary serializedAdditionalRawData) + { + Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Application debugging port. public int? Port { get; set; } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.Serialization.cs index 447cdfb0ffcd..4c824fad9c26 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.Serialization.cs @@ -5,16 +5,114 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class AvailableAppPlatformSku + public partial class AvailableAppPlatformSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableAppPlatformSku DeserializeAvailableAppPlatformSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + if (Capacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capacity).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(LocationInfo)) + { + writer.WritePropertyName("locationInfo"u8); + writer.WriteStartArray(); + foreach (var item in LocationInfo) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Restrictions)) + { + writer.WritePropertyName("restrictions"u8); + writer.WriteStartArray(); + foreach (var item in Restrictions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableAppPlatformSku DeserializeAvailableAppPlatformSku(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +124,7 @@ internal static AvailableAppPlatformSku DeserializeAvailableAppPlatformSku(JsonE Optional> locations = default; Optional> locationInfo = default; Optional> restrictions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -98,8 +197,61 @@ internal static AvailableAppPlatformSku DeserializeAvailableAppPlatformSku(JsonE restrictions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableAppPlatformSku(Optional.ToNullable(resourceType), name.Value, tier.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(restrictions)); + return new AvailableAppPlatformSku(Optional.ToNullable(resourceType), name.Value, tier.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(restrictions), serializedAdditionalRawData); + } + + AvailableAppPlatformSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableAppPlatformSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableAppPlatformSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableAppPlatformSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableAppPlatformSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableAppPlatformSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableAppPlatformSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.cs index 8bf1c2170e47..11d9a0f2d5c2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableAppPlatformSku.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Describes an available Azure Spring Apps SKU. public partial class AvailableAppPlatformSku { - /// Initializes a new instance of AvailableAppPlatformSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableAppPlatformSku() { Locations = new ChangeTrackingList(); @@ -21,7 +25,7 @@ internal AvailableAppPlatformSku() Restrictions = new ChangeTrackingList(); } - /// Initializes a new instance of AvailableAppPlatformSku. + /// Initializes a new instance of . /// Gets the type of resource the SKU applies to. /// Gets the name of SKU. /// Gets the tier of SKU. @@ -32,7 +36,8 @@ internal AvailableAppPlatformSku() /// Gets the restrictions because of which SKU cannot be used. This is /// empty if there are no restrictions. /// - internal AvailableAppPlatformSku(ResourceType? resourceType, string name, string tier, AppPlatformSkuCapacity capacity, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList restrictions) + /// Keeps track of any properties unknown to the library. + internal AvailableAppPlatformSku(ResourceType? resourceType, string name, string tier, AppPlatformSkuCapacity capacity, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList restrictions, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Name = name; @@ -41,6 +46,7 @@ internal AvailableAppPlatformSku(ResourceType? resourceType, string name, string Locations = locations; LocationInfo = locationInfo; Restrictions = restrictions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the type of resource the SKU applies to. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.Serialization.cs index 913b27d15afa..237719e70e22 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class AvailableRuntimeVersions + internal partial class AvailableRuntimeVersions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableRuntimeVersions DeserializeAvailableRuntimeVersions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableRuntimeVersions DeserializeAvailableRuntimeVersions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static AvailableRuntimeVersions DeserializeAvailableRuntimeVersions(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableRuntimeVersions(Optional.ToList(value)); + return new AvailableRuntimeVersions(Optional.ToList(value), serializedAdditionalRawData); + } + + AvailableRuntimeVersions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableRuntimeVersions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableRuntimeVersions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableRuntimeVersions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableRuntimeVersions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableRuntimeVersions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableRuntimeVersions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.cs index ac18bf4bd191..8613d76a7b58 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/AvailableRuntimeVersions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.AppPlatform.Models /// The AvailableRuntimeVersions. internal partial class AvailableRuntimeVersions { - /// Initializes a new instance of AvailableRuntimeVersions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableRuntimeVersions() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AvailableRuntimeVersions. + /// Initializes a new instance of . /// A list of all supported runtime versions. - internal AvailableRuntimeVersions(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AvailableRuntimeVersions(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of all supported runtime versions. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.Serialization.cs index 4baaf1f4c432..0ea77a2c4b7f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class BindingResourceList + internal partial class BindingResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BindingResourceList DeserializeBindingResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BindingResourceList DeserializeBindingResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static BindingResourceList DeserializeBindingResourceList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BindingResourceList(Optional.ToList(value), nextLink.Value); + return new BindingResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BindingResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBindingResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BindingResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBindingResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BindingResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BindingResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBindingResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.cs index f26e89ab4423..70cc5f1ca365 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BindingResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Binding resources and a possible link for next set. internal partial class BindingResourceList { - /// Initializes a new instance of BindingResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BindingResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BindingResourceList. + /// Initializes a new instance of . /// Collection of Binding resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal BindingResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BindingResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Binding resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.Serialization.cs index 2ce8993277ae..33b55a84bcc6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class BuildServiceAgentPoolResourceList + internal partial class BuildServiceAgentPoolResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BuildServiceAgentPoolResourceList DeserializeBuildServiceAgentPoolResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BuildServiceAgentPoolResourceList DeserializeBuildServiceAgentPoolResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static BuildServiceAgentPoolResourceList DeserializeBuildServiceAgentPo nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BuildServiceAgentPoolResourceList(Optional.ToList(value), nextLink.Value); + return new BuildServiceAgentPoolResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BuildServiceAgentPoolResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBuildServiceAgentPoolResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BuildServiceAgentPoolResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBuildServiceAgentPoolResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BuildServiceAgentPoolResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BuildServiceAgentPoolResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBuildServiceAgentPoolResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.cs index abebba326525..ddd31dccba5b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of build service agent pool resources and a possible link for next set. internal partial class BuildServiceAgentPoolResourceList { - /// Initializes a new instance of BuildServiceAgentPoolResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BuildServiceAgentPoolResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BuildServiceAgentPoolResourceList. + /// Initializes a new instance of . /// Collection of build service agent pool resource. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal BuildServiceAgentPoolResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BuildServiceAgentPoolResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of build service agent pool resource. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.Serialization.cs index c26c7de007b5..26361b2b51b0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class BuildServiceAgentPoolSizeProperties : IUtf8JsonSerializable + public partial class BuildServiceAgentPoolSizeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BuildServiceAgentPoolSizeProperties DeserializeBuildServiceAgentPoolSizeProperties(JsonElement element) + internal static BuildServiceAgentPoolSizeProperties DeserializeBuildServiceAgentPoolSizeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +54,7 @@ internal static BuildServiceAgentPoolSizeProperties DeserializeBuildServiceAgent Optional name = default; Optional cpu = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -49,8 +72,61 @@ internal static BuildServiceAgentPoolSizeProperties DeserializeBuildServiceAgent memory = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BuildServiceAgentPoolSizeProperties(name.Value, cpu.Value, memory.Value, serializedAdditionalRawData); + } + + BuildServiceAgentPoolSizeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBuildServiceAgentPoolSizeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BuildServiceAgentPoolSizeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBuildServiceAgentPoolSizeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BuildServiceAgentPoolSizeProperties model) + { + if (model is null) + { + return null; } - return new BuildServiceAgentPoolSizeProperties(name.Value, cpu.Value, memory.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BuildServiceAgentPoolSizeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBuildServiceAgentPoolSizeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.cs index 1dcc74ca609f..a6aaa0ee6bfa 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildServiceAgentPoolSizeProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Build service agent pool size properties. public partial class BuildServiceAgentPoolSizeProperties { - /// Initializes a new instance of BuildServiceAgentPoolSizeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BuildServiceAgentPoolSizeProperties() { } - /// Initializes a new instance of BuildServiceAgentPoolSizeProperties. + /// Initializes a new instance of . /// The name of build service agent pool size. /// The cpu property of build service agent pool size. /// The memory property of build service agent pool size. - internal BuildServiceAgentPoolSizeProperties(string name, string cpu, string memory) + /// Keeps track of any properties unknown to the library. + internal BuildServiceAgentPoolSizeProperties(string name, string cpu, string memory, Dictionary serializedAdditionalRawData) { Name = name; Cpu = cpu; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of build service agent pool size. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.Serialization.cs index 3c8c3612bc97..b1909cab44a9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class BuildpackBindingLaunchProperties : IUtf8JsonSerializable + public partial class BuildpackBindingLaunchProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Properties)) { @@ -38,17 +45,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BuildpackBindingLaunchProperties DeserializeBuildpackBindingLaunchProperties(JsonElement element) + internal static BuildpackBindingLaunchProperties DeserializeBuildpackBindingLaunchProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> properties = default; Optional> secrets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -79,8 +101,61 @@ internal static BuildpackBindingLaunchProperties DeserializeBuildpackBindingLaun secrets = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BuildpackBindingLaunchProperties(Optional.ToDictionary(properties), Optional.ToDictionary(secrets), serializedAdditionalRawData); + } + + BuildpackBindingLaunchProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBuildpackBindingLaunchProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BuildpackBindingLaunchProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBuildpackBindingLaunchProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BuildpackBindingLaunchProperties model) + { + if (model is null) + { + return null; } - return new BuildpackBindingLaunchProperties(Optional.ToDictionary(properties), Optional.ToDictionary(secrets)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BuildpackBindingLaunchProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBuildpackBindingLaunchProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.cs index a3653578badc..ecfe9dde9ecd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingLaunchProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Buildpack Binding Launch Properties. public partial class BuildpackBindingLaunchProperties { - /// Initializes a new instance of BuildpackBindingLaunchProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BuildpackBindingLaunchProperties() { Properties = new ChangeTrackingDictionary(); Secrets = new ChangeTrackingDictionary(); } - /// Initializes a new instance of BuildpackBindingLaunchProperties. + /// Initializes a new instance of . /// Non-sensitive properties for launchProperties. /// Sensitive properties for launchProperties. - internal BuildpackBindingLaunchProperties(IDictionary properties, IDictionary secrets) + /// Keeps track of any properties unknown to the library. + internal BuildpackBindingLaunchProperties(IDictionary properties, IDictionary secrets, Dictionary serializedAdditionalRawData) { Properties = properties; Secrets = secrets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Non-sensitive properties for launchProperties. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.Serialization.cs index 823e03b5698f..a2ba3f495a6d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class BuildpackBindingResourceList + internal partial class BuildpackBindingResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BuildpackBindingResourceList DeserializeBuildpackBindingResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BuildpackBindingResourceList DeserializeBuildpackBindingResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static BuildpackBindingResourceList DeserializeBuildpackBindingResource nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BuildpackBindingResourceList(Optional.ToList(value), nextLink.Value); + return new BuildpackBindingResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BuildpackBindingResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBuildpackBindingResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BuildpackBindingResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBuildpackBindingResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BuildpackBindingResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BuildpackBindingResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBuildpackBindingResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.cs index a1589610a285..d671d2843631 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpackBindingResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of BuildpackBinding resources and a possible link for next set. internal partial class BuildpackBindingResourceList { - /// Initializes a new instance of BuildpackBindingResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BuildpackBindingResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BuildpackBindingResourceList. + /// Initializes a new instance of . /// Collection of BuildpackBinding resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal BuildpackBindingResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BuildpackBindingResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of BuildpackBinding resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.Serialization.cs index a15fe2b49043..9e81da373a1c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class BuildpacksGroupProperties : IUtf8JsonSerializable + public partial class BuildpacksGroupProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -32,17 +39,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BuildpacksGroupProperties DeserializeBuildpacksGroupProperties(JsonElement element) + internal static BuildpacksGroupProperties DeserializeBuildpacksGroupProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional> buildpacks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -64,8 +86,61 @@ internal static BuildpacksGroupProperties DeserializeBuildpacksGroupProperties(J buildpacks = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BuildpacksGroupProperties(name.Value, Optional.ToList(buildpacks), serializedAdditionalRawData); + } + + BuildpacksGroupProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBuildpacksGroupProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BuildpacksGroupProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBuildpacksGroupProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BuildpacksGroupProperties model) + { + if (model is null) + { + return null; } - return new BuildpacksGroupProperties(name.Value, Optional.ToList(buildpacks)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BuildpacksGroupProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBuildpacksGroupProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.cs index d3ca4f8c2e09..d6dc9c06396b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/BuildpacksGroupProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Buildpack group properties of the Builder. public partial class BuildpacksGroupProperties { - /// Initializes a new instance of BuildpacksGroupProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BuildpacksGroupProperties() { Buildpacks = new ChangeTrackingList(); } - /// Initializes a new instance of BuildpacksGroupProperties. + /// Initializes a new instance of . /// Buildpack group name. /// Buildpacks in the buildpack group. - internal BuildpacksGroupProperties(string name, IList buildpacks) + /// Keeps track of any properties unknown to the library. + internal BuildpacksGroupProperties(string name, IList buildpacks, Dictionary serializedAdditionalRawData) { Name = name; Buildpacks = buildpacks; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Buildpack group name. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.Serialization.cs index 49e643595e0d..4b7dee8bb939 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class CertificateResourceList + internal partial class CertificateResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CertificateResourceList DeserializeCertificateResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CertificateResourceList DeserializeCertificateResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static CertificateResourceList DeserializeCertificateResourceList(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CertificateResourceList(Optional.ToList(value), nextLink.Value); + return new CertificateResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CertificateResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCertificateResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CertificateResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCertificateResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CertificateResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CertificateResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCertificateResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.cs index ef6c46067836..4367c5d16b4d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CertificateResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Collection compose of certificate resources list and a possible link for next page. internal partial class CertificateResourceList { - /// Initializes a new instance of CertificateResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CertificateResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CertificateResourceList. + /// Initializes a new instance of . /// The certificate resources list. /// The link to next page of certificate list. - internal CertificateResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CertificateResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The certificate resources list. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.Serialization.cs index c163425907db..ba33d9a55534 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ConfigServerGitPatternRepository : IUtf8JsonSerializable + public partial class ConfigServerGitPatternRepository : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -76,11 +82,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("strictHostKeyChecking"u8); writer.WriteBooleanValue(IsHostKeyCheckingStrict.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfigServerGitPatternRepository DeserializeConfigServerGitPatternRepository(JsonElement element) + internal static ConfigServerGitPatternRepository DeserializeConfigServerGitPatternRepository(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -96,6 +116,7 @@ internal static ConfigServerGitPatternRepository DeserializeConfigServerGitPatte Optional hostKeyAlgorithm = default; Optional privateKey = default; Optional strictHostKeyChecking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -175,8 +196,61 @@ internal static ConfigServerGitPatternRepository DeserializeConfigServerGitPatte strictHostKeyChecking = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfigServerGitPatternRepository(name, Optional.ToList(pattern), uri, label.Value, Optional.ToList(searchPaths), username.Value, password.Value, hostKey.Value, hostKeyAlgorithm.Value, privateKey.Value, Optional.ToNullable(strictHostKeyChecking), serializedAdditionalRawData); + } + + ConfigServerGitPatternRepository IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigServerGitPatternRepository(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigServerGitPatternRepository IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigServerGitPatternRepository(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigServerGitPatternRepository model) + { + if (model is null) + { + return null; } - return new ConfigServerGitPatternRepository(name, Optional.ToList(pattern), uri, label.Value, Optional.ToList(searchPaths), username.Value, password.Value, hostKey.Value, hostKeyAlgorithm.Value, privateKey.Value, Optional.ToNullable(strictHostKeyChecking)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigServerGitPatternRepository(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigServerGitPatternRepository(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.cs index f6b363c4d59c..c1ea3b7cb2c8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerGitPatternRepository.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Git repository property payload for config server. public partial class ConfigServerGitPatternRepository { - /// Initializes a new instance of ConfigServerGitPatternRepository. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the repository. /// URI of the repository. /// or is null. @@ -29,7 +32,7 @@ public ConfigServerGitPatternRepository(string name, Uri uri) SearchPaths = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigServerGitPatternRepository. + /// Initializes a new instance of . /// Name of the repository. /// Collection of pattern of the repository. /// URI of the repository. @@ -41,7 +44,8 @@ public ConfigServerGitPatternRepository(string name, Uri uri) /// SshKey algorithm of git repository. /// Private sshKey algorithm of git repository. /// Strict host key checking or not. - internal ConfigServerGitPatternRepository(string name, IList pattern, Uri uri, string label, IList searchPaths, string username, string password, string hostKey, string hostKeyAlgorithm, string privateKey, bool? isHostKeyCheckingStrict) + /// Keeps track of any properties unknown to the library. + internal ConfigServerGitPatternRepository(string name, IList pattern, Uri uri, string label, IList searchPaths, string username, string password, string hostKey, string hostKeyAlgorithm, string privateKey, bool? isHostKeyCheckingStrict, Dictionary serializedAdditionalRawData) { Name = name; Pattern = pattern; @@ -54,6 +58,12 @@ internal ConfigServerGitPatternRepository(string name, IList pattern, Ur HostKeyAlgorithm = hostKeyAlgorithm; PrivateKey = privateKey; IsHostKeyCheckingStrict = isHostKeyCheckingStrict; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConfigServerGitPatternRepository() + { } /// Name of the repository. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.Serialization.cs index 2b123ff5f1e2..3a61f5fc3275 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ConfigServerSettings : IUtf8JsonSerializable + public partial class ConfigServerSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GitProperty)) { writer.WritePropertyName("gitProperty"u8); - writer.WriteObjectValue(GitProperty); + if (GitProperty is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitProperty).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ConfigServerSettings DeserializeConfigServerSettings(JsonElement element) + internal static ConfigServerSettings DeserializeConfigServerSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional gitProperty = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gitProperty"u8)) @@ -41,8 +71,61 @@ internal static ConfigServerSettings DeserializeConfigServerSettings(JsonElement gitProperty = AppPlatformConfigServerGitProperty.DeserializeAppPlatformConfigServerGitProperty(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfigServerSettings(gitProperty.Value, serializedAdditionalRawData); + } + + ConfigServerSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigServerSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigServerSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigServerSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigServerSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigServerSettings(Response response) + { + if (response is null) + { + return null; } - return new ConfigServerSettings(gitProperty.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigServerSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.cs index 70171042df8b..946156e82e89 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The settings of config server. public partial class ConfigServerSettings { - /// Initializes a new instance of ConfigServerSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfigServerSettings() { } - /// Initializes a new instance of ConfigServerSettings. + /// Initializes a new instance of . /// Property of git environment. - internal ConfigServerSettings(AppPlatformConfigServerGitProperty gitProperty) + /// Keeps track of any properties unknown to the library. + internal ConfigServerSettings(AppPlatformConfigServerGitProperty gitProperty, Dictionary serializedAdditionalRawData) { GitProperty = gitProperty; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Property of git environment. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.Serialization.cs index 971b2322a6a8..87b49cbd6eb2 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.Serialization.cs @@ -8,14 +8,60 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ConfigServerSettingsErrorRecord + public partial class ConfigServerSettingsErrorRecord : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigServerSettingsErrorRecord DeserializeConfigServerSettingsErrorRecord(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsCollectionDefined(Messages)) + { + writer.WritePropertyName("messages"u8); + writer.WriteStartArray(); + foreach (var item in Messages) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigServerSettingsErrorRecord DeserializeConfigServerSettingsErrorRecord(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +69,7 @@ internal static ConfigServerSettingsErrorRecord DeserializeConfigServerSettingsE Optional name = default; Optional uri = default; Optional> messages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -53,8 +100,61 @@ internal static ConfigServerSettingsErrorRecord DeserializeConfigServerSettingsE messages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigServerSettingsErrorRecord(name.Value, uri.Value, Optional.ToList(messages)); + return new ConfigServerSettingsErrorRecord(name.Value, uri.Value, Optional.ToList(messages), serializedAdditionalRawData); + } + + ConfigServerSettingsErrorRecord IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigServerSettingsErrorRecord(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigServerSettingsErrorRecord IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigServerSettingsErrorRecord(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigServerSettingsErrorRecord model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigServerSettingsErrorRecord(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigServerSettingsErrorRecord(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.cs index 9d82a4a2704f..974847abf7b6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsErrorRecord.cs @@ -14,21 +14,26 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Error record of the config server settings. public partial class ConfigServerSettingsErrorRecord { - /// Initializes a new instance of ConfigServerSettingsErrorRecord. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigServerSettingsErrorRecord() { Messages = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigServerSettingsErrorRecord. + /// Initializes a new instance of . /// The name of the config server settings error record. /// The uri of the config server settings error record. /// The detail error messages of the record. - internal ConfigServerSettingsErrorRecord(string name, Uri uri, IReadOnlyList messages) + /// Keeps track of any properties unknown to the library. + internal ConfigServerSettingsErrorRecord(string name, Uri uri, IReadOnlyList messages, Dictionary serializedAdditionalRawData) { Name = name; Uri = uri; Messages = messages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the config server settings error record. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.Serialization.cs index 7362c6dd6d4c..60e00a7c0cda 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class ConfigServerSettingsValidateResult + public partial class ConfigServerSettingsValidateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigServerSettingsValidateResult DeserializeConfigServerSettingsValidateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsValid)) + { + writer.WritePropertyName("isValid"u8); + writer.WriteBooleanValue(IsValid.Value); + } + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigServerSettingsValidateResult DeserializeConfigServerSettingsValidateResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isValid = default; Optional> details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isValid"u8)) @@ -46,8 +96,61 @@ internal static ConfigServerSettingsValidateResult DeserializeConfigServerSettin details = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigServerSettingsValidateResult(Optional.ToNullable(isValid), Optional.ToList(details)); + return new ConfigServerSettingsValidateResult(Optional.ToNullable(isValid), Optional.ToList(details), serializedAdditionalRawData); + } + + ConfigServerSettingsValidateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigServerSettingsValidateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigServerSettingsValidateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigServerSettingsValidateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigServerSettingsValidateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigServerSettingsValidateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigServerSettingsValidateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.cs index 5eaddba9adcc..a99ecdf2ece8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigServerSettingsValidateResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Validation result for config server settings. public partial class ConfigServerSettingsValidateResult { - /// Initializes a new instance of ConfigServerSettingsValidateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigServerSettingsValidateResult() { Details = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigServerSettingsValidateResult. + /// Initializes a new instance of . /// Indicate if the config server settings are valid. /// The detail validation results. - internal ConfigServerSettingsValidateResult(bool? isValid, IReadOnlyList details) + /// Keeps track of any properties unknown to the library. + internal ConfigServerSettingsValidateResult(bool? isValid, IReadOnlyList details, Dictionary serializedAdditionalRawData) { IsValid = isValid; Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicate if the config server settings are valid. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.Serialization.cs index 618cefcca355..3a4b9f9a7e20 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ConfigurationServiceGitProperty : IUtf8JsonSerializable + internal partial class ConfigurationServiceGitProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ConfigurationServiceGitRepositories)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ConfigurationServiceGitRepositories) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfigurationServiceGitProperty DeserializeConfigurationServiceGitProperty(JsonElement element) + internal static ConfigurationServiceGitProperty DeserializeConfigurationServiceGitProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> repositories = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("repositories"u8)) @@ -52,8 +81,61 @@ internal static ConfigurationServiceGitProperty DeserializeConfigurationServiceG repositories = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfigurationServiceGitProperty(Optional.ToList(repositories), serializedAdditionalRawData); + } + + ConfigurationServiceGitProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationServiceGitProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationServiceGitProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationServiceGitProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationServiceGitProperty model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationServiceGitProperty(Response response) + { + if (response is null) + { + return null; } - return new ConfigurationServiceGitProperty(Optional.ToList(repositories)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationServiceGitProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.cs index 9bf438277926..aa75cb859e0d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceGitProperty.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Property of git environment. internal partial class ConfigurationServiceGitProperty { - /// Initializes a new instance of ConfigurationServiceGitProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfigurationServiceGitProperty() { ConfigurationServiceGitRepositories = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigurationServiceGitProperty. + /// Initializes a new instance of . /// Repositories of Application Configuration Service git property. - internal ConfigurationServiceGitProperty(IList configurationServiceGitRepositories) + /// Keeps track of any properties unknown to the library. + internal ConfigurationServiceGitProperty(IList configurationServiceGitRepositories, Dictionary serializedAdditionalRawData) { ConfigurationServiceGitRepositories = configurationServiceGitRepositories; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Repositories of Application Configuration Service git property. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.Serialization.cs index 2ccf50f44c2e..f4cc1a0cf117 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ConfigurationServiceResourceList + internal partial class ConfigurationServiceResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigurationServiceResourceList DeserializeConfigurationServiceResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationServiceResourceList DeserializeConfigurationServiceResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ConfigurationServiceResourceList DeserializeConfigurationService nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigurationServiceResourceList(Optional.ToList(value), nextLink.Value); + return new ConfigurationServiceResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConfigurationServiceResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationServiceResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationServiceResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationServiceResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationServiceResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationServiceResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationServiceResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.cs index 32a48f459803..8e85ed212f62 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ConfigurationServiceResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of configuration service resources and a possible link for next set. internal partial class ConfigurationServiceResourceList { - /// Initializes a new instance of ConfigurationServiceResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigurationServiceResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigurationServiceResourceList. + /// Initializes a new instance of . /// Collection of configuration service resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ConfigurationServiceResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConfigurationServiceResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of configuration service resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.Serialization.cs index 50878993d82e..495fe421cb6d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ContainerProbeSettings : IUtf8JsonSerializable + internal partial class ContainerProbeSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsProbeDisabled)) { writer.WritePropertyName("disableProbe"u8); writer.WriteBooleanValue(IsProbeDisabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerProbeSettings DeserializeContainerProbeSettings(JsonElement element) + internal static ContainerProbeSettings DeserializeContainerProbeSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional disableProbe = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("disableProbe"u8)) @@ -41,8 +64,61 @@ internal static ContainerProbeSettings DeserializeContainerProbeSettings(JsonEle disableProbe = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerProbeSettings(Optional.ToNullable(disableProbe), serializedAdditionalRawData); + } + + ContainerProbeSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerProbeSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerProbeSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerProbeSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerProbeSettings model) + { + if (model is null) + { + return null; } - return new ContainerProbeSettings(Optional.ToNullable(disableProbe)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerProbeSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerProbeSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.cs index 84c185647d21..88f6098d854f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ContainerProbeSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Container liveness and readiness probe settings. internal partial class ContainerProbeSettings { - /// Initializes a new instance of ContainerProbeSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerProbeSettings() { } - /// Initializes a new instance of ContainerProbeSettings. + /// Initializes a new instance of . /// Indicates whether disable the liveness and readiness probe. - internal ContainerProbeSettings(bool? isProbeDisabled) + /// Keeps track of any properties unknown to the library. + internal ContainerProbeSettings(bool? isProbeDisabled, Dictionary serializedAdditionalRawData) { IsProbeDisabled = isProbeDisabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether disable the liveness and readiness probe. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.Serialization.cs index b9b8dccbc4b3..29f20a3ff14d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class CustomDomainResourceList + internal partial class CustomDomainResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CustomDomainResourceList DeserializeCustomDomainResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CustomDomainResourceList DeserializeCustomDomainResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static CustomDomainResourceList DeserializeCustomDomainResourceList(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CustomDomainResourceList(Optional.ToList(value), nextLink.Value); + return new CustomDomainResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CustomDomainResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDomainResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDomainResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDomainResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomDomainResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomDomainResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomDomainResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.cs index 45da80768166..e983ac61db73 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/CustomDomainResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Collection compose of a custom domain resources list and a possible link for next page. internal partial class CustomDomainResourceList { - /// Initializes a new instance of CustomDomainResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CustomDomainResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CustomDomainResourceList. + /// Initializes a new instance of . /// The custom domain resources list. /// The link to next page of custom domain list. - internal CustomDomainResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CustomDomainResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The custom domain resources list. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.Serialization.cs index 725b4b87ee44..cfba048800e6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.Serialization.cs @@ -5,21 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class DeploymentList + internal partial class DeploymentList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeploymentList DeserializeDeploymentList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Deployments)) + { + writer.WritePropertyName("deployments"u8); + writer.WriteStartArray(); + foreach (var item in Deployments) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeploymentList DeserializeDeploymentList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> deployments = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deployments"u8)) @@ -43,8 +86,61 @@ internal static DeploymentList DeserializeDeploymentList(JsonElement element) deployments = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeploymentList(Optional.ToList(deployments), serializedAdditionalRawData); + } + + DeploymentList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeploymentList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeploymentList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeploymentList model) + { + if (model is null) + { + return null; } - return new DeploymentList(Optional.ToList(deployments)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeploymentList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeploymentList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.cs index 486bb18b5e58..a3688b6ce3df 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.AppPlatform.Models /// A list of deployments resource ids. internal partial class DeploymentList { - /// Initializes a new instance of DeploymentList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeploymentList() { Deployments = new ChangeTrackingList(); } - /// Initializes a new instance of DeploymentList. + /// Initializes a new instance of . /// A list of deployment resource ids. - internal DeploymentList(IReadOnlyList deployments) + /// Keeps track of any properties unknown to the library. + internal DeploymentList(IReadOnlyList deployments, Dictionary serializedAdditionalRawData) { Deployments = deployments; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of deployment resource ids. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.Serialization.cs index d5744a5ae154..33b295ff503b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class DeploymentResourceList + internal partial class DeploymentResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeploymentResourceList DeserializeDeploymentResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeploymentResourceList DeserializeDeploymentResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DeploymentResourceList DeserializeDeploymentResourceList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeploymentResourceList(Optional.ToList(value), nextLink.Value); + return new DeploymentResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DeploymentResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeploymentResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeploymentResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeploymentResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeploymentResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeploymentResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.cs index 6035e0127d64..9e834803e4f1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/DeploymentResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of App resources and a possible link for next set. internal partial class DeploymentResourceList { - /// Initializes a new instance of DeploymentResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeploymentResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DeploymentResourceList. + /// Initializes a new instance of . /// Collection of Deployment resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal DeploymentResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DeploymentResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Deployment resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.Serialization.cs index 27ba5319d7e4..2861c2d5402f 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class GatewayCustomDomainProperties : IUtf8JsonSerializable + internal partial class GatewayCustomDomainProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Thumbprint)) { writer.WritePropertyName("thumbprint"u8); writer.WriteStringValue(Thumbprint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GatewayCustomDomainProperties DeserializeGatewayCustomDomainProperties(JsonElement element) + internal static GatewayCustomDomainProperties DeserializeGatewayCustomDomainProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional thumbprint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("thumbprint"u8)) @@ -37,8 +60,61 @@ internal static GatewayCustomDomainProperties DeserializeGatewayCustomDomainProp thumbprint = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GatewayCustomDomainProperties(thumbprint.Value, serializedAdditionalRawData); + } + + GatewayCustomDomainProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayCustomDomainProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayCustomDomainProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayCustomDomainProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayCustomDomainProperties model) + { + if (model is null) + { + return null; } - return new GatewayCustomDomainProperties(thumbprint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayCustomDomainProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayCustomDomainProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.cs index e05ad282e21d..c34fdff0baf6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The properties of custom domain for Spring Cloud Gateway. internal partial class GatewayCustomDomainProperties { - /// Initializes a new instance of GatewayCustomDomainProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GatewayCustomDomainProperties() { } - /// Initializes a new instance of GatewayCustomDomainProperties. + /// Initializes a new instance of . /// The thumbprint of bound certificate. - internal GatewayCustomDomainProperties(string thumbprint) + /// Keeps track of any properties unknown to the library. + internal GatewayCustomDomainProperties(string thumbprint, Dictionary serializedAdditionalRawData) { Thumbprint = thumbprint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The thumbprint of bound certificate. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.Serialization.cs index 0c9bbc0214d5..adec4cf022c1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class GatewayCustomDomainResourceList + internal partial class GatewayCustomDomainResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayCustomDomainResourceList DeserializeGatewayCustomDomainResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayCustomDomainResourceList DeserializeGatewayCustomDomainResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static GatewayCustomDomainResourceList DeserializeGatewayCustomDomainRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayCustomDomainResourceList(Optional.ToList(value), nextLink.Value); + return new GatewayCustomDomainResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + GatewayCustomDomainResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayCustomDomainResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayCustomDomainResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayCustomDomainResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayCustomDomainResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayCustomDomainResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayCustomDomainResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.cs index 76574fe20d15..ad2614d9a7fe 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayCustomDomainResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Spring Cloud Gateway custom domain resources and a possible link for next set. internal partial class GatewayCustomDomainResourceList { - /// Initializes a new instance of GatewayCustomDomainResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayCustomDomainResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayCustomDomainResourceList. + /// Initializes a new instance of . /// Collection of Spring Cloud Gateway custom domain resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal GatewayCustomDomainResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GatewayCustomDomainResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Spring Cloud Gateway custom domain resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.Serialization.cs index fec2329c6870..a28e0d5cdd76 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class GatewayResourceList + internal partial class GatewayResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayResourceList DeserializeGatewayResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayResourceList DeserializeGatewayResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static GatewayResourceList DeserializeGatewayResourceList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayResourceList(Optional.ToList(value), nextLink.Value); + return new GatewayResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + GatewayResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.cs index 39bf7209b035..227871628b30 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of gateway resources and a possible link for next set. internal partial class GatewayResourceList { - /// Initializes a new instance of GatewayResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayResourceList. + /// Initializes a new instance of . /// Collection of gateway resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal GatewayResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GatewayResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of gateway resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.Serialization.cs index 3bae74825ae7..3d4abdf9df90 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class GatewayRouteConfigOpenApiProperties : IUtf8JsonSerializable + internal partial class GatewayRouteConfigOpenApiProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Uri)) { writer.WritePropertyName("uri"u8); writer.WriteStringValue(Uri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GatewayRouteConfigOpenApiProperties DeserializeGatewayRouteConfigOpenApiProperties(JsonElement element) + internal static GatewayRouteConfigOpenApiProperties DeserializeGatewayRouteConfigOpenApiProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uri"u8)) @@ -42,8 +64,61 @@ internal static GatewayRouteConfigOpenApiProperties DeserializeGatewayRouteConfi uri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GatewayRouteConfigOpenApiProperties(uri.Value, serializedAdditionalRawData); + } + + GatewayRouteConfigOpenApiProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayRouteConfigOpenApiProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayRouteConfigOpenApiProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayRouteConfigOpenApiProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayRouteConfigOpenApiProperties model) + { + if (model is null) + { + return null; } - return new GatewayRouteConfigOpenApiProperties(uri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayRouteConfigOpenApiProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayRouteConfigOpenApiProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.cs index 59d5f0ce6fe1..eeeac48341be 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigOpenApiProperties.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models { /// OpenAPI properties of Spring Cloud Gateway route config. internal partial class GatewayRouteConfigOpenApiProperties { - /// Initializes a new instance of GatewayRouteConfigOpenApiProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GatewayRouteConfigOpenApiProperties() { } - /// Initializes a new instance of GatewayRouteConfigOpenApiProperties. + /// Initializes a new instance of . /// The URI of OpenAPI specification. - internal GatewayRouteConfigOpenApiProperties(Uri uri) + /// Keeps track of any properties unknown to the library. + internal GatewayRouteConfigOpenApiProperties(Uri uri, Dictionary serializedAdditionalRawData) { Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The URI of OpenAPI specification. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.Serialization.cs index 15bd7832f3e8..8ad1f6e94ffa 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class GatewayRouteConfigResourceList + internal partial class GatewayRouteConfigResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GatewayRouteConfigResourceList DeserializeGatewayRouteConfigResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GatewayRouteConfigResourceList DeserializeGatewayRouteConfigResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static GatewayRouteConfigResourceList DeserializeGatewayRouteConfigReso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GatewayRouteConfigResourceList(Optional.ToList(value), nextLink.Value); + return new GatewayRouteConfigResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + GatewayRouteConfigResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGatewayRouteConfigResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GatewayRouteConfigResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGatewayRouteConfigResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GatewayRouteConfigResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GatewayRouteConfigResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGatewayRouteConfigResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.cs index d9d2e0118908..fac7169a4eac 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/GatewayRouteConfigResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Spring Cloud Gateway route config resources and a possible link for next set. internal partial class GatewayRouteConfigResourceList { - /// Initializes a new instance of GatewayRouteConfigResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GatewayRouteConfigResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GatewayRouteConfigResourceList. + /// Initializes a new instance of . /// Collection of Spring Cloud Gateway route config resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal GatewayRouteConfigResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GatewayRouteConfigResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Spring Cloud Gateway route config resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.Serialization.cs index c839f07fd6ed..6b01f5dcf5d1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class IngressConfig : IUtf8JsonSerializable + internal partial class IngressConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ReadTimeoutInSeconds)) { writer.WritePropertyName("readTimeoutInSeconds"u8); writer.WriteNumberValue(ReadTimeoutInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IngressConfig DeserializeIngressConfig(JsonElement element) + internal static IngressConfig DeserializeIngressConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional readTimeoutInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("readTimeoutInSeconds"u8)) @@ -41,8 +64,61 @@ internal static IngressConfig DeserializeIngressConfig(JsonElement element) readTimeoutInSeconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IngressConfig(Optional.ToNullable(readTimeoutInSeconds), serializedAdditionalRawData); + } + + IngressConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIngressConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IngressConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIngressConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IngressConfig model) + { + if (model is null) + { + return null; } - return new IngressConfig(Optional.ToNullable(readTimeoutInSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IngressConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIngressConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.cs index 3fe670e23554..6cc0bfd99c58 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressConfig.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Ingress configuration payload for Azure Spring Apps resource. internal partial class IngressConfig { - /// Initializes a new instance of IngressConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IngressConfig() { } - /// Initializes a new instance of IngressConfig. + /// Initializes a new instance of . /// Ingress read time out in seconds. - internal IngressConfig(int? readTimeoutInSeconds) + /// Keeps track of any properties unknown to the library. + internal IngressConfig(int? readTimeoutInSeconds, Dictionary serializedAdditionalRawData) { ReadTimeoutInSeconds = readTimeoutInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Ingress read time out in seconds. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.Serialization.cs index 5739f4e415dc..b06dfb3f88fa 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class IngressSettingsClientAuth : IUtf8JsonSerializable + internal partial class IngressSettingsClientAuth : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Certificates)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IngressSettingsClientAuth DeserializeIngressSettingsClientAuth(JsonElement element) + internal static IngressSettingsClientAuth DeserializeIngressSettingsClientAuth(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> certificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificates"u8)) @@ -52,8 +74,61 @@ internal static IngressSettingsClientAuth DeserializeIngressSettingsClientAuth(J certificates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IngressSettingsClientAuth(Optional.ToList(certificates), serializedAdditionalRawData); + } + + IngressSettingsClientAuth IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIngressSettingsClientAuth(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IngressSettingsClientAuth IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIngressSettingsClientAuth(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IngressSettingsClientAuth model) + { + if (model is null) + { + return null; } - return new IngressSettingsClientAuth(Optional.ToList(certificates)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IngressSettingsClientAuth(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIngressSettingsClientAuth(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.cs index 85cfdf3c6fe1..7ed42d7aa814 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/IngressSettingsClientAuth.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Client-Certification Authentication. internal partial class IngressSettingsClientAuth { - /// Initializes a new instance of IngressSettingsClientAuth. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IngressSettingsClientAuth() { Certificates = new ChangeTrackingList(); } - /// Initializes a new instance of IngressSettingsClientAuth. + /// Initializes a new instance of . /// Collection of certificate resource id. - internal IngressSettingsClientAuth(IList certificates) + /// Keeps track of any properties unknown to the library. + internal IngressSettingsClientAuth(IList certificates, Dictionary serializedAdditionalRawData) { Certificates = certificates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of certificate resource id. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.Serialization.cs index a79f84720966..bfdd3738aaaa 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class JarUploadedUserSourceInfo : IUtf8JsonSerializable + public partial class JarUploadedUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RuntimeVersion)) { @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static JarUploadedUserSourceInfo DeserializeJarUploadedUserSourceInfo(JsonElement element) + internal static JarUploadedUserSourceInfo DeserializeJarUploadedUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static JarUploadedUserSourceInfo DeserializeJarUploadedUserSourceInfo(J Optional relativePath = default; string type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("runtimeVersion"u8)) @@ -78,8 +101,61 @@ internal static JarUploadedUserSourceInfo DeserializeJarUploadedUserSourceInfo(J version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JarUploadedUserSourceInfo(type, version.Value, relativePath.Value, runtimeVersion.Value, jvmOptions.Value, serializedAdditionalRawData); + } + + JarUploadedUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJarUploadedUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JarUploadedUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJarUploadedUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JarUploadedUserSourceInfo model) + { + if (model is null) + { + return null; } - return new JarUploadedUserSourceInfo(type, version.Value, relativePath.Value, runtimeVersion.Value, jvmOptions.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JarUploadedUserSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJarUploadedUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.cs index e74059b8d966..09b774d0543c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/JarUploadedUserSourceInfo.cs @@ -5,24 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Uploaded Jar binary for a deployment. public partial class JarUploadedUserSourceInfo : AppPlatformUploadedUserSourceInfo { - /// Initializes a new instance of JarUploadedUserSourceInfo. + /// Initializes a new instance of . public JarUploadedUserSourceInfo() { UserSourceInfoType = "Jar"; } - /// Initializes a new instance of JarUploadedUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. /// Relative path of the storage which stores the source. /// Runtime version of the Jar file. /// JVM parameter. - internal JarUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, string runtimeVersion, string jvmOptions) : base(userSourceInfoType, version, relativePath) + /// Keeps track of any properties unknown to the library. + internal JarUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, string runtimeVersion, string jvmOptions, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, relativePath, serializedAdditionalRawData) { RuntimeVersion = runtimeVersion; JvmOptions = jvmOptions; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.Serialization.cs index 5795055831b4..ce466ab1a545 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class NetCoreZipUploadedUserSourceInfo : IUtf8JsonSerializable + public partial class NetCoreZipUploadedUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NetCoreMainEntryPath)) { @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NetCoreZipUploadedUserSourceInfo DeserializeNetCoreZipUploadedUserSourceInfo(JsonElement element) + internal static NetCoreZipUploadedUserSourceInfo DeserializeNetCoreZipUploadedUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static NetCoreZipUploadedUserSourceInfo DeserializeNetCoreZipUploadedUs Optional relativePath = default; string type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("netCoreMainEntryPath"u8)) @@ -78,8 +101,61 @@ internal static NetCoreZipUploadedUserSourceInfo DeserializeNetCoreZipUploadedUs version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetCoreZipUploadedUserSourceInfo(type, version.Value, relativePath.Value, netCoreMainEntryPath.Value, runtimeVersion.Value, serializedAdditionalRawData); + } + + NetCoreZipUploadedUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetCoreZipUploadedUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetCoreZipUploadedUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetCoreZipUploadedUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetCoreZipUploadedUserSourceInfo model) + { + if (model is null) + { + return null; } - return new NetCoreZipUploadedUserSourceInfo(type, version.Value, relativePath.Value, netCoreMainEntryPath.Value, runtimeVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetCoreZipUploadedUserSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetCoreZipUploadedUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.cs index 8217463bf721..fa06dd92d6e0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetCoreZipUploadedUserSourceInfo.cs @@ -5,24 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Uploaded Jar binary for a deployment. public partial class NetCoreZipUploadedUserSourceInfo : AppPlatformUploadedUserSourceInfo { - /// Initializes a new instance of NetCoreZipUploadedUserSourceInfo. + /// Initializes a new instance of . public NetCoreZipUploadedUserSourceInfo() { UserSourceInfoType = "NetCoreZip"; } - /// Initializes a new instance of NetCoreZipUploadedUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. /// Relative path of the storage which stores the source. /// The path to the .NET executable relative to zip root. /// Runtime version of the .Net file. - internal NetCoreZipUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, string netCoreMainEntryPath, string runtimeVersion) : base(userSourceInfoType, version, relativePath) + /// Keeps track of any properties unknown to the library. + internal NetCoreZipUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, string netCoreMainEntryPath, string runtimeVersion, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, relativePath, serializedAdditionalRawData) { NetCoreMainEntryPath = netCoreMainEntryPath; RuntimeVersion = runtimeVersion; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.Serialization.cs index 3cbd3335bd0a..18dff682722b 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class NetworkProfileOutboundIPs + internal partial class NetworkProfileOutboundIPs : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NetworkProfileOutboundIPs DeserializeNetworkProfileOutboundIPs(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NetworkProfileOutboundIPs DeserializeNetworkProfileOutboundIPs(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> publicIPs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicIPs"u8)) @@ -44,8 +72,61 @@ internal static NetworkProfileOutboundIPs DeserializeNetworkProfileOutboundIPs(J publicIPs = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NetworkProfileOutboundIPs(Optional.ToList(publicIPs)); + return new NetworkProfileOutboundIPs(Optional.ToList(publicIPs), serializedAdditionalRawData); + } + + NetworkProfileOutboundIPs IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkProfileOutboundIPs(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkProfileOutboundIPs IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkProfileOutboundIPs(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkProfileOutboundIPs model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkProfileOutboundIPs(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkProfileOutboundIPs(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.cs index d09e6c22c653..33e1591db9bd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/NetworkProfileOutboundIPs.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Desired outbound IP resources for Azure Spring Apps resource. internal partial class NetworkProfileOutboundIPs { - /// Initializes a new instance of NetworkProfileOutboundIPs. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NetworkProfileOutboundIPs() { PublicIPs = new ChangeTrackingList(); } - /// Initializes a new instance of NetworkProfileOutboundIPs. + /// Initializes a new instance of . /// A list of public IP addresses. - internal NetworkProfileOutboundIPs(IReadOnlyList publicIPs) + /// Keeps track of any properties unknown to the library. + internal NetworkProfileOutboundIPs(IReadOnlyList publicIPs, Dictionary serializedAdditionalRawData) { PublicIPs = publicIPs; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of public IP addresses. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.Serialization.cs index f4668a408ffa..5e71080703fe 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class RegenerateAppPlatformServiceTestKeyContent : IUtf8JsonSerializable + public partial class RegenerateAppPlatformServiceTestKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyType"u8); writer.WriteStringValue(KeyType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RegenerateAppPlatformServiceTestKeyContent DeserializeRegenerateAppPlatformServiceTestKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AppPlatformServiceTestKeyType keyType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyType"u8)) + { + keyType = new AppPlatformServiceTestKeyType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RegenerateAppPlatformServiceTestKeyContent(keyType, serializedAdditionalRawData); + } + + RegenerateAppPlatformServiceTestKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegenerateAppPlatformServiceTestKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegenerateAppPlatformServiceTestKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegenerateAppPlatformServiceTestKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegenerateAppPlatformServiceTestKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegenerateAppPlatformServiceTestKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegenerateAppPlatformServiceTestKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.cs index b1719f712108..5da12d3a3d0a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/RegenerateAppPlatformServiceTestKeyContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Regenerate test key request payload. public partial class RegenerateAppPlatformServiceTestKeyContent { - /// Initializes a new instance of RegenerateAppPlatformServiceTestKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the test key. public RegenerateAppPlatformServiceTestKeyContent(AppPlatformServiceTestKeyType keyType) { KeyType = keyType; } + /// Initializes a new instance of . + /// Type of the test key. + /// Keeps track of any properties unknown to the library. + internal RegenerateAppPlatformServiceTestKeyContent(AppPlatformServiceTestKeyType keyType, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RegenerateAppPlatformServiceTestKeyContent() + { + } + /// Type of the test key. public AppPlatformServiceTestKeyType KeyType { get; } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.Serialization.cs index 0d75826f7706..cf74ca218658 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ResourceSkuList + internal partial class ResourceSkuList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceSkuList DeserializeResourceSkuList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceSkuList DeserializeResourceSkuList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static ResourceSkuList DeserializeResourceSkuList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceSkuList(Optional.ToList(value), nextLink.Value); + return new ResourceSkuList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ResourceSkuList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSkuList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSkuList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSkuList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSkuList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSkuList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.cs index 15c95bf0e45c..e084cb26ae50 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ResourceSkuList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Azure Spring Apps SKU and a possible link for next set. internal partial class ResourceSkuList { - /// Initializes a new instance of ResourceSkuList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceSkuList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ResourceSkuList. + /// Initializes a new instance of . /// Collection of resource SKU. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ResourceSkuList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ResourceSkuList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of resource SKU. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.Serialization.cs index 7d4d76587b68..01eaebebecc4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ServiceRegistryResourceList + internal partial class ServiceRegistryResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceRegistryResourceList DeserializeServiceRegistryResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceRegistryResourceList DeserializeServiceRegistryResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ServiceRegistryResourceList DeserializeServiceRegistryResourceLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceRegistryResourceList(Optional.ToList(value), nextLink.Value); + return new ServiceRegistryResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ServiceRegistryResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceRegistryResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceRegistryResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceRegistryResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceRegistryResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceRegistryResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceRegistryResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.cs index 3b352ab0c034..033c924910b8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceRegistryResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Service Registry resources and a possible link for next set. internal partial class ServiceRegistryResourceList { - /// Initializes a new instance of ServiceRegistryResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceRegistryResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceRegistryResourceList. + /// Initializes a new instance of . /// Collection of Service Registry resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ServiceRegistryResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ServiceRegistryResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Service Registry resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.Serialization.cs index 1bd77484e7ea..28249a93c89c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ServiceResourceList + internal partial class ServiceResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceResourceList DeserializeServiceResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceResourceList DeserializeServiceResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ServiceResourceList DeserializeServiceResourceList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceResourceList(Optional.ToList(value), nextLink.Value); + return new ServiceResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ServiceResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.cs index b037838c4c4a..d834315ee6d9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of Service resources and a possible link for next set. internal partial class ServiceResourceList { - /// Initializes a new instance of ServiceResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceResourceList. + /// Initializes a new instance of . /// Collection of Service resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal ServiceResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ServiceResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of Service resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.Serialization.cs index 41b2fa0df2d7..0e372a1fdcfa 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class ServiceVnetAddons : IUtf8JsonSerializable + internal partial class ServiceVnetAddons : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsLogStreamPublicEndpoint)) { writer.WritePropertyName("logStreamPublicEndpoint"u8); writer.WriteBooleanValue(IsLogStreamPublicEndpoint.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceVnetAddons DeserializeServiceVnetAddons(JsonElement element) + internal static ServiceVnetAddons DeserializeServiceVnetAddons(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional logStreamPublicEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logStreamPublicEndpoint"u8)) @@ -41,8 +64,61 @@ internal static ServiceVnetAddons DeserializeServiceVnetAddons(JsonElement eleme logStreamPublicEndpoint = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceVnetAddons(Optional.ToNullable(logStreamPublicEndpoint), serializedAdditionalRawData); + } + + ServiceVnetAddons IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceVnetAddons(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceVnetAddons IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceVnetAddons(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceVnetAddons model) + { + if (model is null) + { + return null; } - return new ServiceVnetAddons(Optional.ToNullable(logStreamPublicEndpoint)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceVnetAddons(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceVnetAddons(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.cs index 7fe5551b442b..e61f63c2a566 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/ServiceVnetAddons.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Additional Service settings in vnet injection instance. internal partial class ServiceVnetAddons { - /// Initializes a new instance of ServiceVnetAddons. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceVnetAddons() { } - /// Initializes a new instance of ServiceVnetAddons. + /// Initializes a new instance of . /// Indicates whether the log stream in vnet injection instance could be accessed from internet. - internal ServiceVnetAddons(bool? isLogStreamPublicEndpoint) + /// Keeps track of any properties unknown to the library. + internal ServiceVnetAddons(bool? isLogStreamPublicEndpoint, Dictionary serializedAdditionalRawData) { IsLogStreamPublicEndpoint = isLogStreamPublicEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the log stream in vnet injection instance could be accessed from internet. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.Serialization.cs index 67a2a385cf75..a0152440a487 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - public partial class SourceUploadedUserSourceInfo : IUtf8JsonSerializable + public partial class SourceUploadedUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ArtifactSelector)) { @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SourceUploadedUserSourceInfo DeserializeSourceUploadedUserSourceInfo(JsonElement element) + internal static SourceUploadedUserSourceInfo DeserializeSourceUploadedUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static SourceUploadedUserSourceInfo DeserializeSourceUploadedUserSource Optional relativePath = default; string type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("artifactSelector"u8)) @@ -78,8 +101,61 @@ internal static SourceUploadedUserSourceInfo DeserializeSourceUploadedUserSource version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceUploadedUserSourceInfo(type, version.Value, relativePath.Value, artifactSelector.Value, runtimeVersion.Value, serializedAdditionalRawData); + } + + SourceUploadedUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceUploadedUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceUploadedUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceUploadedUserSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceUploadedUserSourceInfo model) + { + if (model is null) + { + return null; } - return new SourceUploadedUserSourceInfo(type, version.Value, relativePath.Value, artifactSelector.Value, runtimeVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceUploadedUserSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceUploadedUserSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.cs index 52a84ea22dab..b3caef002f44 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SourceUploadedUserSourceInfo.cs @@ -5,18 +5,21 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Uploaded Java source code binary for a deployment. public partial class SourceUploadedUserSourceInfo : AppPlatformUploadedUserSourceInfo { - /// Initializes a new instance of SourceUploadedUserSourceInfo. + /// Initializes a new instance of . public SourceUploadedUserSourceInfo() { UserSourceInfoType = "Source"; } - /// Initializes a new instance of SourceUploadedUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. /// Relative path of the storage which stores the source. @@ -25,7 +28,8 @@ public SourceUploadedUserSourceInfo() /// the relative path to the target module/project. /// /// Runtime version of the source file. - internal SourceUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, string artifactSelector, string runtimeVersion) : base(userSourceInfoType, version, relativePath) + /// Keeps track of any properties unknown to the library. + internal SourceUploadedUserSourceInfo(string userSourceInfoType, string version, string relativePath, string artifactSelector, string runtimeVersion, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, relativePath, serializedAdditionalRawData) { ArtifactSelector = artifactSelector; RuntimeVersion = runtimeVersion; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.Serialization.cs index 89f077f64f61..0dae8bc4f331 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class StorageResourceList + internal partial class StorageResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static StorageResourceList DeserializeStorageResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static StorageResourceList DeserializeStorageResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static StorageResourceList DeserializeStorageResourceList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new StorageResourceList(Optional.ToList(value), nextLink.Value); + return new StorageResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + StorageResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.cs index c51314e1a3af..470975459a07 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/StorageResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Collection compose of storage resources list and a possible link for next page. internal partial class StorageResourceList { - /// Initializes a new instance of StorageResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal StorageResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of StorageResourceList. + /// Initializes a new instance of . /// The storage resources list. /// The link to next page of storage list. - internal StorageResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal StorageResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The storage resources list. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.Serialization.cs index bf2b631cdd12..63a4a6a19df8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class SupportedBuildpackResourceProperties : IUtf8JsonSerializable + internal partial class SupportedBuildpackResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BuildpackId)) { writer.WritePropertyName("buildpackId"u8); writer.WriteStringValue(BuildpackId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SupportedBuildpackResourceProperties DeserializeSupportedBuildpackResourceProperties(JsonElement element) + internal static SupportedBuildpackResourceProperties DeserializeSupportedBuildpackResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional buildpackId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("buildpackId"u8)) @@ -37,8 +60,61 @@ internal static SupportedBuildpackResourceProperties DeserializeSupportedBuildpa buildpackId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SupportedBuildpackResourceProperties(buildpackId.Value, serializedAdditionalRawData); + } + + SupportedBuildpackResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSupportedBuildpackResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SupportedBuildpackResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSupportedBuildpackResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SupportedBuildpackResourceProperties model) + { + if (model is null) + { + return null; } - return new SupportedBuildpackResourceProperties(buildpackId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SupportedBuildpackResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSupportedBuildpackResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.cs index 4534530b2275..be50c67e0192 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpackResourceProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// Supported buildpack resource properties. internal partial class SupportedBuildpackResourceProperties { - /// Initializes a new instance of SupportedBuildpackResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SupportedBuildpackResourceProperties() { } - /// Initializes a new instance of SupportedBuildpackResourceProperties. + /// Initializes a new instance of . /// The id of supported buildpack. - internal SupportedBuildpackResourceProperties(string buildpackId) + /// Keeps track of any properties unknown to the library. + internal SupportedBuildpackResourceProperties(string buildpackId, Dictionary serializedAdditionalRawData) { BuildpackId = buildpackId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of supported buildpack. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.Serialization.cs index 65c1a0e96ed7..3a1b353b09bb 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class SupportedBuildpacksList + internal partial class SupportedBuildpacksList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SupportedBuildpacksList DeserializeSupportedBuildpacksList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SupportedBuildpacksList DeserializeSupportedBuildpacksList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static SupportedBuildpacksList DeserializeSupportedBuildpacksList(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SupportedBuildpacksList(Optional.ToList(value), nextLink.Value); + return new SupportedBuildpacksList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SupportedBuildpacksList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSupportedBuildpacksList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SupportedBuildpacksList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSupportedBuildpacksList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SupportedBuildpacksList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SupportedBuildpacksList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSupportedBuildpacksList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.cs index 5d8dec3deb66..3e977b89d071 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedBuildpacksList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of supported buildpacks resources and a possible link for next set. internal partial class SupportedBuildpacksList { - /// Initializes a new instance of SupportedBuildpacksList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SupportedBuildpacksList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SupportedBuildpacksList. + /// Initializes a new instance of . /// Collection of supported buildpacks resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal SupportedBuildpacksList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SupportedBuildpacksList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of supported buildpacks resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.Serialization.cs index a99af6a89501..b939b08b37e6 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppPlatform; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class SupportedStacksList + internal partial class SupportedStacksList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SupportedStacksList DeserializeSupportedStacksList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SupportedStacksList DeserializeSupportedStacksList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static SupportedStacksList DeserializeSupportedStacksList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SupportedStacksList(Optional.ToList(value), nextLink.Value); + return new SupportedStacksList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SupportedStacksList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSupportedStacksList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SupportedStacksList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSupportedStacksList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SupportedStacksList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SupportedStacksList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSupportedStacksList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.cs index 1644705a8bf7..4c9d303acb69 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/SupportedStacksList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppPlatform; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.AppPlatform.Models /// Object that includes an array of supported stacks resources and a possible link for next set. internal partial class SupportedStacksList { - /// Initializes a new instance of SupportedStacksList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SupportedStacksList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SupportedStacksList. + /// Initializes a new instance of . /// Collection of supported stacks resources. /// /// URL client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal SupportedStacksList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SupportedStacksList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of supported stacks resources. diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.Serialization.cs index af4d253af35b..720e4973b112 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.Serialization.cs @@ -6,111 +6,61 @@ #nullable disable using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class UnknownCertificateProperties : IUtf8JsonSerializable + internal partial class UnknownCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CertificatePropertiesType); - writer.WriteEndObject(); - } - - internal static UnknownCertificateProperties DeserializeUnknownCertificateProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - Optional thumbprint = default; - Optional issuer = default; - Optional issuedDate = default; - Optional expirationDate = default; - Optional activateDate = default; - Optional subjectName = default; - Optional> dnsNames = default; - Optional provisioningState = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("thumbprint"u8)) - { - thumbprint = property.Value.GetString(); - continue; - } - if (property.NameEquals("issuer"u8)) - { - issuer = property.Value.GetString(); - continue; - } - if (property.NameEquals("issuedDate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - issuedDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("expirationDate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expirationDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("activateDate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - activateDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("subjectName"u8)) - { - subjectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("dnsNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - dnsNames = array; - continue; - } - if (property.NameEquals("provisioningState"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AppPlatformCertificateProvisioningState(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownCertificateProperties(type, thumbprint.Value, issuer.Value, Optional.ToNullable(issuedDate), Optional.ToNullable(expirationDate), Optional.ToNullable(activateDate), subjectName.Value, Optional.ToList(dnsNames), Optional.ToNullable(provisioningState)); + writer.WriteEndObject(); + } + + internal static AppPlatformCertificateProperties DeserializeUnknownCertificateProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeAppPlatformCertificateProperties(element, options); + + AppPlatformCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformCertificateProperties(doc.RootElement, options); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.cs index 7dd742bba4b1..d93057e67f7e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCertificateProperties.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.AppPlatform.Models /// The UnknownCertificateProperties. internal partial class UnknownCertificateProperties : AppPlatformCertificateProperties { - /// Initializes a new instance of UnknownCertificateProperties. + /// Initializes a new instance of . /// The type of the certificate source. /// The thumbprint of certificate. /// The issuer of certificate. @@ -23,9 +23,15 @@ internal partial class UnknownCertificateProperties : AppPlatformCertificateProp /// The subject name of certificate. /// The domain list of certificate. /// Provisioning state of the Certificate. - internal UnknownCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState) : base(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames, provisioningState) + /// Keeps track of any properties unknown to the library. + internal UnknownCertificateProperties(string certificatePropertiesType, string thumbprint, string issuer, DateTimeOffset? issuedOn, DateTimeOffset? expireOn, DateTimeOffset? activateOn, string subjectName, IReadOnlyList dnsNames, AppPlatformCertificateProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(certificatePropertiesType, thumbprint, issuer, issuedOn, expireOn, activateOn, subjectName, dnsNames, provisioningState, serializedAdditionalRawData) { CertificatePropertiesType = certificatePropertiesType ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownCertificateProperties() + { + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.Serialization.cs index 66ed9e52a271..41b0d9f7c736 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.Serialization.cs @@ -5,16 +5,21 @@ #nullable disable -using System.Collections.Generic; +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class UnknownCustomPersistentDiskProperties : IUtf8JsonSerializable + internal partial class UnknownCustomPersistentDiskProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(UnderlyingResourceType.ToString()); @@ -35,56 +40,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - writer.WriteEndObject(); - } - - internal static UnknownCustomPersistentDiskProperties DeserializeUnknownCustomPersistentDiskProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - UnderlyingResourceType type = "Unknown"; - string mountPath = default; - Optional readOnly = default; - Optional> mountOptions = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("type"u8)) - { - type = new UnderlyingResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("mountPath"u8)) - { - mountPath = property.Value.GetString(); - continue; - } - if (property.NameEquals("readOnly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - readOnly = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("mountOptions"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - mountOptions = array; - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownCustomPersistentDiskProperties(type, mountPath, Optional.ToNullable(readOnly), Optional.ToList(mountOptions)); + writer.WriteEndObject(); + } + + internal static AppCustomPersistentDiskProperties DeserializeUnknownCustomPersistentDiskProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeAppCustomPersistentDiskProperties(element, options); + + AppCustomPersistentDiskProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownCustomPersistentDiskProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppCustomPersistentDiskProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppCustomPersistentDiskProperties(doc.RootElement, options); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.cs index 7ca17a92f1fd..445ad88b3ede 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownCustomPersistentDiskProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppPlatform.Models @@ -12,14 +13,20 @@ namespace Azure.ResourceManager.AppPlatform.Models /// The UnknownCustomPersistentDiskProperties. internal partial class UnknownCustomPersistentDiskProperties : AppCustomPersistentDiskProperties { - /// Initializes a new instance of UnknownCustomPersistentDiskProperties. + /// Initializes a new instance of . /// The type of the underlying resource to mount as a persistent disk. /// The mount path of the persistent disk. /// Indicates whether the persistent disk is a readOnly one. /// These are the mount options for a persistent disk. - internal UnknownCustomPersistentDiskProperties(UnderlyingResourceType underlyingResourceType, string mountPath, bool? isReadOnly, IList mountOptions) : base(underlyingResourceType, mountPath, isReadOnly, mountOptions) + /// Keeps track of any properties unknown to the library. + internal UnknownCustomPersistentDiskProperties(UnderlyingResourceType underlyingResourceType, string mountPath, bool? isReadOnly, IList mountOptions, Dictionary serializedAdditionalRawData) : base(underlyingResourceType, mountPath, isReadOnly, mountOptions, serializedAdditionalRawData) { UnderlyingResourceType = underlyingResourceType; } + + /// Initializes a new instance of for deserialization. + internal UnknownCustomPersistentDiskProperties() + { + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.Serialization.cs index d0f94d7ccbd2..4f5ac9484ac4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class UnknownProbeAction : IUtf8JsonSerializable + internal partial class UnknownProbeAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ProbeActionType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownProbeAction DeserializeUnknownProbeAction(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - ProbeActionType type = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) + foreach (var property in _serializedAdditionalRawData) { - type = new ProbeActionType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownProbeAction(type); + writer.WriteEndObject(); + } + + internal static AppInstanceProbeAction DeserializeUnknownProbeAction(JsonElement element, ModelSerializerOptions options = default) => DeserializeAppInstanceProbeAction(element, options); + + AppInstanceProbeAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownProbeAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppInstanceProbeAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppInstanceProbeAction(doc.RootElement, options); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.cs index 1501be4723f3..c6ff5be22f23 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownProbeAction.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The UnknownProbeAction. internal partial class UnknownProbeAction : AppInstanceProbeAction { - /// Initializes a new instance of UnknownProbeAction. + /// Initializes a new instance of . /// The type of the action to take to perform the health check. - internal UnknownProbeAction(ProbeActionType probeActionType) : base(probeActionType) + /// Keeps track of any properties unknown to the library. + internal UnknownProbeAction(ProbeActionType probeActionType, Dictionary serializedAdditionalRawData) : base(probeActionType, serializedAdditionalRawData) { ProbeActionType = probeActionType; } + + /// Initializes a new instance of for deserialization. + internal UnknownProbeAction() + { + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.Serialization.cs index 8ad30b9c68d9..751aa22d0b80 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class UnknownStorageProperties : IUtf8JsonSerializable + internal partial class UnknownStorageProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageType"u8); writer.WriteStringValue(StorageType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownStorageProperties DeserializeUnknownStorageProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - StorageType storageType = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("storageType"u8)) + foreach (var property in _serializedAdditionalRawData) { - storageType = new StorageType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownStorageProperties(storageType); + writer.WriteEndObject(); + } + + internal static AppPlatformStorageProperties DeserializeUnknownStorageProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeAppPlatformStorageProperties(element, options); + + AppPlatformStorageProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownStorageProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformStorageProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformStorageProperties(doc.RootElement, options); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.cs index de723c7585cc..b170be4fd268 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownStorageProperties.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The UnknownStorageProperties. internal partial class UnknownStorageProperties : AppPlatformStorageProperties { - /// Initializes a new instance of UnknownStorageProperties. + /// Initializes a new instance of . /// The type of the storage. - internal UnknownStorageProperties(StorageType storageType) : base(storageType) + /// Keeps track of any properties unknown to the library. + internal UnknownStorageProperties(StorageType storageType, Dictionary serializedAdditionalRawData) : base(storageType, serializedAdditionalRawData) { StorageType = storageType; } + + /// Initializes a new instance of for deserialization. + internal UnknownStorageProperties() + { + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.Serialization.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.Serialization.cs index ac62f4179132..14dce7ee4119 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.Serialization.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppPlatform.Models { - internal partial class UnknownUserSourceInfo : IUtf8JsonSerializable + internal partial class UnknownUserSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(UserSourceInfoType); @@ -22,31 +28,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } - writer.WriteEndObject(); - } - - internal static UnknownUserSourceInfo DeserializeUnknownUserSourceInfo(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - Optional version = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("version"u8)) + foreach (var property in _serializedAdditionalRawData) { - version = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownUserSourceInfo(type, version.Value); + writer.WriteEndObject(); + } + + internal static AppPlatformUserSourceInfo DeserializeUnknownUserSourceInfo(JsonElement element, ModelSerializerOptions options = default) => DeserializeAppPlatformUserSourceInfo(element, options); + + AppPlatformUserSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownUserSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppPlatformUserSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppPlatformUserSourceInfo(doc.RootElement, options); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.cs index 522a58cf2de1..5069737aad2d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Models/UnknownUserSourceInfo.cs @@ -5,17 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppPlatform.Models { /// The UnknownUserSourceInfo. internal partial class UnknownUserSourceInfo : AppPlatformUserSourceInfo { - /// Initializes a new instance of UnknownUserSourceInfo. + /// Initializes a new instance of . /// Type of the source uploaded. /// Version of the source. - internal UnknownUserSourceInfo(string userSourceInfoType, string version) : base(userSourceInfoType, version) + /// Keeps track of any properties unknown to the library. + internal UnknownUserSourceInfo(string userSourceInfoType, string version, Dictionary serializedAdditionalRawData) : base(userSourceInfoType, version, serializedAdditionalRawData) { UserSourceInfoType = userSourceInfoType ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownUserSourceInfo() + { + } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalCustomDomainsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalCustomDomainsRestOperations.cs index 0ea6335243d0..52ea397d26a1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalCustomDomainsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalCustomDomainsRestOperations.cs @@ -152,9 +152,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalsRestOperations.cs index d6c8c3917ed4..ed4f7e940439 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ApiPortalsRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -386,9 +384,7 @@ internal HttpMessage CreateValidateDomainRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/AppsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/AppsRestOperations.cs index 160d692a60dc..facb46b0a4c4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/AppsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/AppsRestOperations.cs @@ -150,9 +150,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -314,9 +312,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -563,9 +559,7 @@ internal HttpMessage CreateSetActiveDeploymentsRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -648,9 +642,7 @@ internal HttpMessage CreateValidateDomainRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BindingsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BindingsRestOperations.cs index 672044b30b04..540bd27b5154 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BindingsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BindingsRestOperations.cs @@ -152,9 +152,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -328,9 +326,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceAgentPoolRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceAgentPoolRestOperations.cs index 2254863cc721..96f92f242692 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceAgentPoolRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceAgentPoolRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateUpdatePutRequest(string subscriptionId, string resour request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceBuilderRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceBuilderRestOperations.cs index 56e94fb3cab1..89d660e75985 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceBuilderRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceBuilderRestOperations.cs @@ -152,9 +152,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceRestOperations.cs index 9240eab73347..7d207c08e7b8 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildServiceRestOperations.cs @@ -404,9 +404,7 @@ internal HttpMessage CreateCreateOrUpdateBuildRequest(string subscriptionId, str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildpackBindingRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildpackBindingRestOperations.cs index 638802ed4951..d83668dd428a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildpackBindingRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/BuildpackBindingRestOperations.cs @@ -160,9 +160,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CertificatesRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CertificatesRestOperations.cs index 22c10796a43f..6750fa03a72c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CertificatesRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CertificatesRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigServersRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigServersRestOperations.cs index 6776bacd8b3a..01b3d3e069be 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigServersRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigServersRestOperations.cs @@ -138,9 +138,7 @@ internal HttpMessage CreateUpdatePutRequest(string subscriptionId, string resour request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -217,9 +215,7 @@ internal HttpMessage CreateUpdatePatchRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -296,9 +292,7 @@ internal HttpMessage CreateValidateRequest(string subscriptionId, string resourc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(settings); - request.Content = content; + request.Content = settings; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigurationServicesRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigurationServicesRestOperations.cs index 258c4f094095..2e8342e5e034 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigurationServicesRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ConfigurationServicesRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -386,9 +384,7 @@ internal HttpMessage CreateValidateRequest(string subscriptionId, string resourc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(settings); - request.Content = content; + request.Content = settings; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CustomDomainsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CustomDomainsRestOperations.cs index f27e49a857e6..0e28ab20e8e9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CustomDomainsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/CustomDomainsRestOperations.cs @@ -152,9 +152,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -328,9 +326,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/DeploymentsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/DeploymentsRestOperations.cs index b2281d94dc5b..340a930a77b9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/DeploymentsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/DeploymentsRestOperations.cs @@ -153,9 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -329,9 +327,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -853,9 +849,7 @@ internal HttpMessage CreateEnableRemoteDebuggingRequest(string subscriptionId, s if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; @@ -1212,9 +1206,7 @@ internal HttpMessage CreateGenerateHeapDumpRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1303,9 +1295,7 @@ internal HttpMessage CreateGenerateThreadDumpRequest(string subscriptionId, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1394,9 +1384,7 @@ internal HttpMessage CreateStartJfrRequest(string subscriptionId, string resourc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayCustomDomainsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayCustomDomainsRestOperations.cs index a21ef0526d1c..f03fe44acc47 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayCustomDomainsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayCustomDomainsRestOperations.cs @@ -152,9 +152,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayRouteConfigsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayRouteConfigsRestOperations.cs index dbf6ee0c9f46..f88ffe61332d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayRouteConfigsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewayRouteConfigsRestOperations.cs @@ -152,9 +152,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewaysRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewaysRestOperations.cs index 3b837ba509d0..19a06d0fdd87 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewaysRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/GatewaysRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -386,9 +384,7 @@ internal HttpMessage CreateValidateDomainRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/MonitoringSettingsRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/MonitoringSettingsRestOperations.cs index e560ce25580f..1684e4157d4e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/MonitoringSettingsRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/MonitoringSettingsRestOperations.cs @@ -137,9 +137,7 @@ internal HttpMessage CreateUpdatePutRequest(string subscriptionId, string resour request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -216,9 +214,7 @@ internal HttpMessage CreateUpdatePatchRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ServicesRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ServicesRestOperations.cs index 020811713b3c..09995d02a8ce 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ServicesRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/ServicesRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -288,9 +286,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -446,9 +442,7 @@ internal HttpMessage CreateRegenerateTestKeyRequest(string subscriptionId, strin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -817,9 +811,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/StoragesRestOperations.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/StoragesRestOperations.cs index f19ec274674c..53edf70fa91c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/StoragesRestOperations.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/RestOperations/StoragesRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ArmArcScVmmModelFactory.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ArmArcScVmmModelFactory.cs index 1ac6f0ff7d4e..635928108af4 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ArmArcScVmmModelFactory.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ArmArcScVmmModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Model factory for models. public static partial class ArmArcScVmmModelFactory { - /// Initializes a new instance of ScVmmServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,10 +39,10 @@ public static ScVmmServerData ScVmmServerData(ResourceIdentifier id = null, stri { tags ??= new Dictionary(); - return new ScVmmServerData(id, name, resourceType, systemData, tags, location, extendedLocation, credentials, fqdn, port, connectionStatus, errorMessage, uuid, version, provisioningState); + return new ScVmmServerData(id, name, resourceType, systemData, tags, location, extendedLocation, credentials, fqdn, port, connectionStatus, errorMessage, uuid, version, provisioningState, default); } - /// Initializes a new instance of ScVmmCloudData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -63,20 +63,20 @@ public static ScVmmCloudData ScVmmCloudData(ResourceIdentifier id = null, string tags ??= new Dictionary(); storageQoSPolicies ??= new List(); - return new ScVmmCloudData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, uuid, vmmServerId, cloudName, cloudCapacity, storageQoSPolicies?.ToList(), provisioningState); + return new ScVmmCloudData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, uuid, vmmServerId, cloudName, cloudCapacity, storageQoSPolicies?.ToList(), provisioningState, default); } - /// Initializes a new instance of CloudCapacity. + /// Initializes a new instance of . /// CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. /// MemoryMB specifies a memory usage limit in megabytes. /// VMCount gives the max number of VMs that can be deployed in the cloud. /// A new instance for mocking. public static CloudCapacity CloudCapacity(long? cpuCount = null, long? memoryMB = null, long? vmCount = null) { - return new CloudCapacity(cpuCount, memoryMB, vmCount); + return new CloudCapacity(cpuCount, memoryMB, vmCount, default); } - /// Initializes a new instance of StorageQoSPolicy. + /// Initializes a new instance of . /// The name of the policy. /// The ID of the QoS policy. /// The maximum IO operations per second. @@ -86,10 +86,10 @@ public static CloudCapacity CloudCapacity(long? cpuCount = null, long? memoryMB /// A new instance for mocking. public static StorageQoSPolicy StorageQoSPolicy(string name = null, string id = null, long? iopsMaximum = null, long? iopsMinimum = null, long? bandwidthLimit = null, string policyId = null) { - return new StorageQoSPolicy(name, id, iopsMaximum, iopsMinimum, bandwidthLimit, policyId); + return new StorageQoSPolicy(name, id, iopsMaximum, iopsMinimum, bandwidthLimit, policyId, default); } - /// Initializes a new instance of ScVmmVirtualNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -107,10 +107,10 @@ public static ScVmmVirtualNetworkData ScVmmVirtualNetworkData(ResourceIdentifier { tags ??= new Dictionary(); - return new ScVmmVirtualNetworkData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, uuid, vmmServerId, networkName, provisioningState); + return new ScVmmVirtualNetworkData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, uuid, vmmServerId, networkName, provisioningState, default); } - /// Initializes a new instance of ScVmmVirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -143,10 +143,10 @@ public static ScVmmVirtualMachineData ScVmmVirtualMachineData(ResourceIdentifier networkInterfaces ??= new List(); storageDisks ??= new List(); - return new ScVmmVirtualMachineData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, vmmServerId, cloudId, templateId, checkpointType, checkpoints?.ToList(), availabilitySets?.ToList(), osProfile, hardwareProfile, networkInterfaces != null ? new NetworkProfile(networkInterfaces?.ToList()) : null, storageDisks != null ? new StorageProfile(storageDisks?.ToList()) : null, vmName, uuid, generation, powerState, provisioningState); + return new ScVmmVirtualMachineData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, vmmServerId, cloudId, templateId, checkpointType, checkpoints?.ToList(), availabilitySets?.ToList(), osProfile, hardwareProfile, networkInterfaces != null ? new NetworkProfile(networkInterfaces?.ToList(), new Dictionary()) : null, storageDisks != null ? new StorageProfile(storageDisks?.ToList(), new Dictionary()) : null, vmName, uuid, generation, powerState, provisioningState, default); } - /// Initializes a new instance of OSProfile. + /// Initializes a new instance of . /// Admin password of the virtual machine. /// Gets or sets computer name. /// Gets or sets the type of the os. @@ -154,10 +154,10 @@ public static ScVmmVirtualMachineData ScVmmVirtualMachineData(ResourceIdentifier /// A new instance for mocking. public static OSProfile OSProfile(string adminPassword = null, string computerName = null, OSType? osType = null, string osName = null) { - return new OSProfile(adminPassword, computerName, osType, osName); + return new OSProfile(adminPassword, computerName, osType, osName, default); } - /// Initializes a new instance of NetworkInterfaces. + /// Initializes a new instance of . /// Gets or sets the name of the network interface. /// Gets the display name of the network interface as shown in the vmmServer. This is the fallback label for a NIC when the name is not set. /// Gets or sets the nic ipv4 addresses. @@ -175,10 +175,10 @@ public static NetworkInterfaces NetworkInterfaces(string name = null, string dis ipv4Addresses ??= new List(); ipv6Addresses ??= new List(); - return new NetworkInterfaces(name, displayName, ipv4Addresses?.ToList(), ipv6Addresses?.ToList(), macAddress, virtualNetworkId, networkName, ipv4AddressType, ipv6AddressType, macAddressType, nicId); + return new NetworkInterfaces(name, displayName, ipv4Addresses?.ToList(), ipv6Addresses?.ToList(), macAddress, virtualNetworkId, networkName, ipv4AddressType, ipv6AddressType, macAddressType, nicId, default); } - /// Initializes a new instance of VirtualDisk. + /// Initializes a new instance of . /// Gets or sets the name of the disk. /// Gets the display name of the virtual disk as shown in the vmmServer. This is the fallback label for a disk when the name is not set. /// Gets or sets the disk id. @@ -196,10 +196,10 @@ public static NetworkInterfaces NetworkInterfaces(string name = null, string dis /// A new instance for mocking. public static VirtualDisk VirtualDisk(string name = null, string displayName = null, string diskId = null, int? diskSizeGB = null, int? maxDiskSizeGB = null, int? bus = null, int? lun = null, string busType = null, string vhdType = null, string volumeType = null, string vhdFormatType = null, string templateDiskId = null, StorageQoSPolicyDetails storageQoSPolicy = null, CreateDiffDisk? createDiffDisk = null) { - return new VirtualDisk(name, displayName, diskId, diskSizeGB, maxDiskSizeGB, bus, lun, busType, vhdType, volumeType, vhdFormatType, templateDiskId, storageQoSPolicy, createDiffDisk); + return new VirtualDisk(name, displayName, diskId, diskSizeGB, maxDiskSizeGB, bus, lun, busType, vhdType, volumeType, vhdFormatType, templateDiskId, storageQoSPolicy, createDiffDisk, default); } - /// Initializes a new instance of ScVmmVirtualMachineTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -232,10 +232,10 @@ public static ScVmmVirtualMachineTemplateData ScVmmVirtualMachineTemplateData(Re networkInterfaces ??= new List(); disks ??= new List(); - return new ScVmmVirtualMachineTemplateData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, uuid, vmmServerId, osType, osName, computerName, memoryMB, cpuCount, limitCpuForMigration, dynamicMemoryEnabled, isCustomizable, dynamicMemoryMaxMB, dynamicMemoryMinMB, isHighlyAvailable, generation, networkInterfaces?.ToList(), disks?.ToList(), provisioningState); + return new ScVmmVirtualMachineTemplateData(id, name, resourceType, systemData, tags, location, extendedLocation, inventoryItemId, uuid, vmmServerId, osType, osName, computerName, memoryMB, cpuCount, limitCpuForMigration, dynamicMemoryEnabled, isCustomizable, dynamicMemoryMaxMB, dynamicMemoryMinMB, isHighlyAvailable, generation, networkInterfaces?.ToList(), disks?.ToList(), provisioningState, default); } - /// Initializes a new instance of ScVmmAvailabilitySetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -251,7 +251,7 @@ public static ScVmmAvailabilitySetData ScVmmAvailabilitySetData(ResourceIdentifi { tags ??= new Dictionary(); - return new ScVmmAvailabilitySetData(id, name, resourceType, systemData, tags, location, extendedLocation, availabilitySetName, vmmServerId, provisioningState); + return new ScVmmAvailabilitySetData(id, name, resourceType, systemData, tags, location, extendedLocation, availabilitySetName, vmmServerId, provisioningState, default); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 3b8b499bc428..2ed183b25cbd 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -80,7 +80,7 @@ public virtual AsyncPageable GetScVmmServersAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmServers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmServers", "value", "nextLink", cancellationToken); } /// @@ -102,7 +102,7 @@ public virtual Pageable GetScVmmServers(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmServers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmServers", "value", "nextLink", cancellationToken); } /// @@ -124,7 +124,7 @@ public virtual AsyncPageable GetScVmmCloudsAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmClouds", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmClouds", "value", "nextLink", cancellationToken); } /// @@ -146,7 +146,7 @@ public virtual Pageable GetScVmmClouds(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmClouds", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmClouds", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual AsyncPageable GetScVmmVirtualNetwork { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); } /// @@ -190,7 +190,7 @@ public virtual Pageable GetScVmmVirtualNetworks(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); } /// @@ -212,7 +212,7 @@ public virtual AsyncPageable GetScVmmVirtualMachine { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); } /// @@ -234,7 +234,7 @@ public virtual Pageable GetScVmmVirtualMachines(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); } /// @@ -256,7 +256,7 @@ public virtual AsyncPageable GetScVmmVirtua { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); } /// @@ -278,7 +278,7 @@ public virtual Pageable GetScVmmVirtualMach { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); } /// @@ -300,7 +300,7 @@ public virtual AsyncPageable GetScVmmAvailabilityS { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); } /// @@ -322,7 +322,7 @@ public virtual Pageable GetScVmmAvailabilitySets(C { HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs index 67c06d547798..c1b27772375d 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _inventoryItemRestClient.CreateListByVmmServerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _inventoryItemRestClient.CreateListByVmmServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _inventoryItemRestClient.CreateListByVmmServerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _inventoryItemRestClient.CreateListByVmmServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemData.cs index a05dbea5cd89..20a5b6ab93a8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm.Models; using Azure.ResourceManager.Models; @@ -17,14 +19,17 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class InventoryItemData : ResourceData { - /// Initializes a new instance of InventoryItemData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// They inventory type. public InventoryItemData(InventoryType inventoryType) { InventoryType = inventoryType; } - /// Initializes a new instance of InventoryItemData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +40,8 @@ public InventoryItemData(InventoryType inventoryType) /// Gets the UUID (which is assigned by VMM) for the inventory item. /// Gets the Managed Object name in VMM for the inventory item. /// Gets the provisioning state. - internal InventoryItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, InventoryType inventoryType, string managedResourceId, string uuid, string inventoryItemName, string provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal InventoryItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, InventoryType inventoryType, string managedResourceId, string uuid, string inventoryItemName, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; InventoryType = inventoryType; @@ -43,6 +49,12 @@ internal InventoryItemData(ResourceIdentifier id, string name, ResourceType reso Uuid = uuid; InventoryItemName = inventoryItemName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InventoryItemData() + { } /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.Serialization.cs index 067f1679a49a..3d473cec9b56 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class AvailabilitySetListItem : IUtf8JsonSerializable + public partial class AvailabilitySetListItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvailabilitySetListItem DeserializeAvailabilitySetListItem(JsonElement element) + internal static AvailabilitySetListItem DeserializeAvailabilitySetListItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -48,8 +71,61 @@ internal static AvailabilitySetListItem DeserializeAvailabilitySetListItem(JsonE name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvailabilitySetListItem(id.Value, name.Value, serializedAdditionalRawData); + } + + AvailabilitySetListItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailabilitySetListItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailabilitySetListItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailabilitySetListItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailabilitySetListItem model) + { + if (model is null) + { + return null; } - return new AvailabilitySetListItem(id.Value, name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailabilitySetListItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailabilitySetListItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.cs index 3484737f776f..5573891ea868 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Availability Set model. public partial class AvailabilitySetListItem { - /// Initializes a new instance of AvailabilitySetListItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvailabilitySetListItem() { } - /// Initializes a new instance of AvailabilitySetListItem. + /// Initializes a new instance of . /// Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. /// Gets or sets the name of the availability set. - internal AvailabilitySetListItem(string id, string name) + /// Keeps track of any properties unknown to the library. + internal AvailabilitySetListItem(string id, string name, Dictionary serializedAdditionalRawData) { Id = id; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.Serialization.cs index a5fb1eb58adb..f8626075b70d 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class AvailabilitySetListResult + internal partial class AvailabilitySetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailabilitySetListResult DeserializeAvailabilitySetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailabilitySetListResult DeserializeAvailabilitySetListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AvailabilitySetListResult DeserializeAvailabilitySetListResult(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailabilitySetListResult(Optional.ToList(value), nextLink.Value); + return new AvailabilitySetListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AvailabilitySetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailabilitySetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailabilitySetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailabilitySetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailabilitySetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailabilitySetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailabilitySetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.cs index 260bebe68f85..08ef7d5410c6 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/AvailabilitySetListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of AvailabilitySets. internal partial class AvailabilitySetListResult { - /// Initializes a new instance of AvailabilitySetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailabilitySetListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AvailabilitySetListResult. + /// Initializes a new instance of . /// List of AvailabilitySets. /// Url to follow for getting next page of resources. - internal AvailabilitySetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AvailabilitySetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AvailabilitySets. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.Serialization.cs index 9740eec5d240..1e5db1c0e6e2 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class Checkpoint : IUtf8JsonSerializable + public partial class Checkpoint : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ParentCheckpointId)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Checkpoint DeserializeCheckpoint(JsonElement element) + internal static Checkpoint DeserializeCheckpoint(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static Checkpoint DeserializeCheckpoint(JsonElement element) Optional checkpointId = default; Optional name = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parentCheckpointID"u8)) @@ -70,8 +93,61 @@ internal static Checkpoint DeserializeCheckpoint(JsonElement element) description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Checkpoint(parentCheckpointId.Value, checkpointId.Value, name.Value, description.Value, serializedAdditionalRawData); + } + + Checkpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCheckpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Checkpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCheckpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Checkpoint model) + { + if (model is null) + { + return null; } - return new Checkpoint(parentCheckpointId.Value, checkpointId.Value, name.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Checkpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCheckpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.cs index 6600a90e0686..b7b65728884e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/Checkpoint.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the resource properties. public partial class Checkpoint { - /// Initializes a new instance of Checkpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Checkpoint() { } - /// Initializes a new instance of Checkpoint. + /// Initializes a new instance of . /// Gets ID of parent of the checkpoint. /// Gets ID of the checkpoint. /// Gets name of the checkpoint. /// Gets description of the checkpoint. - internal Checkpoint(string parentCheckpointId, string checkpointId, string name, string description) + /// Keeps track of any properties unknown to the library. + internal Checkpoint(string parentCheckpointId, string checkpointId, string name, string description, Dictionary serializedAdditionalRawData) { ParentCheckpointId = parentCheckpointId; CheckpointId = checkpointId; Name = name; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets ID of parent of the checkpoint. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.Serialization.cs index 33404c53098c..ef9aaa13ed7b 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class CloudCapacity + public partial class CloudCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudCapacity DeserializeCloudCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CpuCount)) + { + writer.WritePropertyName("cpuCount"u8); + writer.WriteNumberValue(CpuCount.Value); + } + if (Optional.IsDefined(MemoryMB)) + { + writer.WritePropertyName("memoryMB"u8); + writer.WriteNumberValue(MemoryMB.Value); + } + if (Optional.IsDefined(VmCount)) + { + writer.WritePropertyName("vmCount"u8); + writer.WriteNumberValue(VmCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudCapacity DeserializeCloudCapacity(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static CloudCapacity DeserializeCloudCapacity(JsonElement element) Optional cpuCount = default; Optional memoryMB = default; Optional vmCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpuCount"u8)) @@ -50,8 +94,61 @@ internal static CloudCapacity DeserializeCloudCapacity(JsonElement element) vmCount = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudCapacity(Optional.ToNullable(cpuCount), Optional.ToNullable(memoryMB), Optional.ToNullable(vmCount)); + return new CloudCapacity(Optional.ToNullable(cpuCount), Optional.ToNullable(memoryMB), Optional.ToNullable(vmCount), serializedAdditionalRawData); + } + + CloudCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.cs index ed04a4da55eb..84b20207d1b8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudCapacity.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Cloud Capacity model. public partial class CloudCapacity { - /// Initializes a new instance of CloudCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudCapacity() { } - /// Initializes a new instance of CloudCapacity. + /// Initializes a new instance of . /// CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. /// MemoryMB specifies a memory usage limit in megabytes. /// VMCount gives the max number of VMs that can be deployed in the cloud. - internal CloudCapacity(long? cpuCount, long? memoryMB, long? vmCount) + /// Keeps track of any properties unknown to the library. + internal CloudCapacity(long? cpuCount, long? memoryMB, long? vmCount, Dictionary serializedAdditionalRawData) { CpuCount = cpuCount; MemoryMB = memoryMB; VmCount = vmCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.Serialization.cs index e7e024ba3553..625ac24be251 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class CloudListResult + internal partial class CloudListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudListResult DeserializeCloudListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudListResult DeserializeCloudListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static CloudListResult DeserializeCloudListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudListResult(Optional.ToList(value), nextLink.Value); + return new CloudListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CloudListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.cs index 104526423b31..99da378f6253 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/CloudListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of Clouds. internal partial class CloudListResult { - /// Initializes a new instance of CloudListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CloudListResult. + /// Initializes a new instance of . /// List of Clouds. /// Url to follow for getting next page of resources. - internal CloudListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CloudListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Clouds. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.Serialization.cs index 5332119868f6..b54169bcfdc8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class HardwareProfile : IUtf8JsonSerializable + public partial class HardwareProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MemoryMB)) { @@ -50,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isHighlyAvailable"u8); writer.WriteStringValue(IsHighlyAvailable); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HardwareProfile DeserializeHardwareProfile(JsonElement element) + internal static HardwareProfile DeserializeHardwareProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +88,7 @@ internal static HardwareProfile DeserializeHardwareProfile(JsonElement element) Optional dynamicMemoryMaxMB = default; Optional dynamicMemoryMinMB = default; Optional isHighlyAvailable = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("memoryMB"u8)) @@ -127,8 +150,61 @@ internal static HardwareProfile DeserializeHardwareProfile(JsonElement element) isHighlyAvailable = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HardwareProfile(Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), isHighlyAvailable.Value, serializedAdditionalRawData); + } + + HardwareProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHardwareProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HardwareProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHardwareProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HardwareProfile model) + { + if (model is null) + { + return null; } - return new HardwareProfile(Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), isHighlyAvailable.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HardwareProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHardwareProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.cs index 03da8039dd91..d7ce4a83ac1e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfile.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the resource properties. public partial class HardwareProfile { - /// Initializes a new instance of HardwareProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HardwareProfile() { } - /// Initializes a new instance of HardwareProfile. + /// Initializes a new instance of . /// MemoryMB is the size of a virtual machine's memory, in MB. /// Gets or sets the number of vCPUs for the vm. /// Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs. @@ -23,7 +29,8 @@ public HardwareProfile() /// Gets or sets the max dynamic memory for the vm. /// Gets or sets the min dynamic memory for the vm. /// Gets highly available property. - internal HardwareProfile(int? memoryMB, int? cpuCount, LimitCpuForMigration? limitCpuForMigration, DynamicMemoryEnabled? dynamicMemoryEnabled, int? dynamicMemoryMaxMB, int? dynamicMemoryMinMB, string isHighlyAvailable) + /// Keeps track of any properties unknown to the library. + internal HardwareProfile(int? memoryMB, int? cpuCount, LimitCpuForMigration? limitCpuForMigration, DynamicMemoryEnabled? dynamicMemoryEnabled, int? dynamicMemoryMaxMB, int? dynamicMemoryMinMB, string isHighlyAvailable, Dictionary serializedAdditionalRawData) { MemoryMB = memoryMB; CpuCount = cpuCount; @@ -32,6 +39,7 @@ internal HardwareProfile(int? memoryMB, int? cpuCount, LimitCpuForMigration? lim DynamicMemoryMaxMB = dynamicMemoryMaxMB; DynamicMemoryMinMB = dynamicMemoryMinMB; IsHighlyAvailable = isHighlyAvailable; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// MemoryMB is the size of a virtual machine's memory, in MB. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.Serialization.cs index 43bf5c6ca7df..9ede4c60931b 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class HardwareProfileUpdate : IUtf8JsonSerializable + public partial class HardwareProfileUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MemoryMB)) { @@ -45,7 +53,147 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dynamicMemoryMinMB"u8); writer.WriteNumberValue(DynamicMemoryMinMB.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HardwareProfileUpdate DeserializeHardwareProfileUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional memoryMB = default; + Optional cpuCount = default; + Optional limitCpuForMigration = default; + Optional dynamicMemoryEnabled = default; + Optional dynamicMemoryMaxMB = default; + Optional dynamicMemoryMinMB = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("memoryMB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + memoryMB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("cpuCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cpuCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("limitCpuForMigration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limitCpuForMigration = new LimitCpuForMigration(property.Value.GetString()); + continue; + } + if (property.NameEquals("dynamicMemoryEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicMemoryEnabled = new DynamicMemoryEnabled(property.Value.GetString()); + continue; + } + if (property.NameEquals("dynamicMemoryMaxMB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicMemoryMaxMB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("dynamicMemoryMinMB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicMemoryMinMB = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HardwareProfileUpdate(Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), serializedAdditionalRawData); + } + + HardwareProfileUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHardwareProfileUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HardwareProfileUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHardwareProfileUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HardwareProfileUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HardwareProfileUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHardwareProfileUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.cs index 47891cef16c2..cde4623cfedb 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/HardwareProfileUpdate.cs @@ -5,16 +5,41 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the resource properties. public partial class HardwareProfileUpdate { - /// Initializes a new instance of HardwareProfileUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HardwareProfileUpdate() { } + /// Initializes a new instance of . + /// MemoryMB is the size of a virtual machine's memory, in MB. + /// Gets or sets the number of vCPUs for the vm. + /// Gets or sets a value indicating whether to enable processor compatibility mode for live migration of VMs. + /// Gets or sets a value indicating whether to enable dynamic memory or not. + /// Gets or sets the max dynamic memory for the vm. + /// Gets or sets the min dynamic memory for the vm. + /// Keeps track of any properties unknown to the library. + internal HardwareProfileUpdate(int? memoryMB, int? cpuCount, LimitCpuForMigration? limitCpuForMigration, DynamicMemoryEnabled? dynamicMemoryEnabled, int? dynamicMemoryMaxMB, int? dynamicMemoryMinMB, Dictionary serializedAdditionalRawData) + { + MemoryMB = memoryMB; + CpuCount = cpuCount; + LimitCpuForMigration = limitCpuForMigration; + DynamicMemoryEnabled = dynamicMemoryEnabled; + DynamicMemoryMaxMB = dynamicMemoryMaxMB; + DynamicMemoryMinMB = dynamicMemoryMinMB; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// MemoryMB is the size of a virtual machine's memory, in MB. public int? MemoryMB { get; set; } /// Gets or sets the number of vCPUs for the vm. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemData.Serialization.cs index 6109bd0e7028..1e8922a31d30 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class InventoryItemData : IUtf8JsonSerializable + public partial class InventoryItemData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("inventoryType"u8); writer.WriteStringValue(InventoryType.ToString()); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InventoryItemData DeserializeInventoryItemData(JsonElement element) + internal static InventoryItemData DeserializeInventoryItemData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +68,7 @@ internal static InventoryItemData DeserializeInventoryItemData(JsonElement eleme Optional uuid = default; Optional inventoryItemName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -114,8 +137,61 @@ internal static InventoryItemData DeserializeInventoryItemData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InventoryItemData(id, name, type, systemData.Value, kind.Value, inventoryType, managedResourceId.Value, uuid.Value, inventoryItemName.Value, provisioningState.Value, serializedAdditionalRawData); + } + + InventoryItemData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryItemData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InventoryItemData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInventoryItemData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InventoryItemData model) + { + if (model is null) + { + return null; } - return new InventoryItemData(id, name, type, systemData.Value, kind.Value, inventoryType, managedResourceId.Value, uuid.Value, inventoryItemName.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InventoryItemData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInventoryItemData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.Serialization.cs index 7d289b746bf8..7f8411ecb75c 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class InventoryItemsList + internal partial class InventoryItemsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InventoryItemsList DeserializeInventoryItemsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InventoryItemsList DeserializeInventoryItemsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static InventoryItemsList DeserializeInventoryItemsList(JsonElement ele value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InventoryItemsList(nextLink.Value, value); + return new InventoryItemsList(nextLink.Value, value, serializedAdditionalRawData); + } + + InventoryItemsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryItemsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InventoryItemsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInventoryItemsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InventoryItemsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InventoryItemsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInventoryItemsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.cs index 66251fbe8a07..f223b15613ee 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/InventoryItemsList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of InventoryItems. internal partial class InventoryItemsList { - /// Initializes a new instance of InventoryItemsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of InventoryItems. /// is null. internal InventoryItemsList(IEnumerable value) @@ -26,13 +29,20 @@ internal InventoryItemsList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of InventoryItemsList. + /// Initializes a new instance of . /// Url to follow for getting next page of InventoryItems. /// Array of InventoryItems. - internal InventoryItemsList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal InventoryItemsList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InventoryItemsList() + { } /// Url to follow for getting next page of InventoryItems. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.Serialization.cs index d834876febb3..dba1defed414 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class NetworkInterfaces : IUtf8JsonSerializable + public partial class NetworkInterfaces : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("nicId"u8); writer.WriteStringValue(NicId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NetworkInterfaces DeserializeNetworkInterfaces(JsonElement element) + internal static NetworkInterfaces DeserializeNetworkInterfaces(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +92,7 @@ internal static NetworkInterfaces DeserializeNetworkInterfaces(JsonElement eleme Optional ipv6AddressType = default; Optional macAddressType = default; Optional nicId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -158,8 +180,61 @@ internal static NetworkInterfaces DeserializeNetworkInterfaces(JsonElement eleme nicId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkInterfaces(name.Value, displayName.Value, Optional.ToList(ipv4Addresses), Optional.ToList(ipv6Addresses), macAddress.Value, virtualNetworkId.Value, networkName.Value, Optional.ToNullable(ipv4AddressType), Optional.ToNullable(ipv6AddressType), Optional.ToNullable(macAddressType), nicId.Value, serializedAdditionalRawData); + } + + NetworkInterfaces IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkInterfaces(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkInterfaces IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkInterfaces(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkInterfaces model) + { + if (model is null) + { + return null; } - return new NetworkInterfaces(name.Value, displayName.Value, Optional.ToList(ipv4Addresses), Optional.ToList(ipv6Addresses), macAddress.Value, virtualNetworkId.Value, networkName.Value, Optional.ToNullable(ipv4AddressType), Optional.ToNullable(ipv6AddressType), Optional.ToNullable(macAddressType), nicId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkInterfaces(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkInterfaces(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.cs index 3ec1b6c90b09..1ee6973657c1 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfaces.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Network Interface model. public partial class NetworkInterfaces { - /// Initializes a new instance of NetworkInterfaces. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkInterfaces() { IPv4Addresses = new ChangeTrackingList(); IPv6Addresses = new ChangeTrackingList(); } - /// Initializes a new instance of NetworkInterfaces. + /// Initializes a new instance of . /// Gets or sets the name of the network interface. /// Gets the display name of the network interface as shown in the vmmServer. This is the fallback label for a NIC when the name is not set. /// Gets or sets the nic ipv4 addresses. @@ -32,7 +36,8 @@ public NetworkInterfaces() /// Gets or sets the ipv6 address type. /// Gets or sets the mac address type. /// Gets or sets the nic id. - internal NetworkInterfaces(string name, string displayName, IReadOnlyList ipv4Addresses, IReadOnlyList ipv6Addresses, string macAddress, string virtualNetworkId, string networkName, AllocationMethod? ipv4AddressType, AllocationMethod? ipv6AddressType, AllocationMethod? macAddressType, string nicId) + /// Keeps track of any properties unknown to the library. + internal NetworkInterfaces(string name, string displayName, IReadOnlyList ipv4Addresses, IReadOnlyList ipv6Addresses, string macAddress, string virtualNetworkId, string networkName, AllocationMethod? ipv4AddressType, AllocationMethod? ipv6AddressType, AllocationMethod? macAddressType, string nicId, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; @@ -45,6 +50,7 @@ internal NetworkInterfaces(string name, string displayName, IReadOnlyList Gets or sets the name of the network interface. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.Serialization.cs index 4a2ebc02fd74..d1da27433c1f 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class NetworkInterfacesUpdate : IUtf8JsonSerializable + public partial class NetworkInterfacesUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -50,7 +58,141 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("nicId"u8); writer.WriteStringValue(NicId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static NetworkInterfacesUpdate DeserializeNetworkInterfacesUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional macAddress = default; + Optional virtualNetworkId = default; + Optional ipv4AddressType = default; + Optional ipv6AddressType = default; + Optional macAddressType = default; + Optional nicId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("macAddress"u8)) + { + macAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("virtualNetworkId"u8)) + { + virtualNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ipv4AddressType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipv4AddressType = new AllocationMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("ipv6AddressType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipv6AddressType = new AllocationMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("macAddressType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + macAddressType = new AllocationMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("nicId"u8)) + { + nicId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkInterfacesUpdate(name.Value, macAddress.Value, virtualNetworkId.Value, Optional.ToNullable(ipv4AddressType), Optional.ToNullable(ipv6AddressType), Optional.ToNullable(macAddressType), nicId.Value, serializedAdditionalRawData); + } + + NetworkInterfacesUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkInterfacesUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkInterfacesUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkInterfacesUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkInterfacesUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkInterfacesUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkInterfacesUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.cs index 00ad8c56b390..6c9a18a29d75 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkInterfacesUpdate.cs @@ -5,16 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Network Interface model. public partial class NetworkInterfacesUpdate { - /// Initializes a new instance of NetworkInterfacesUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkInterfacesUpdate() { } + /// Initializes a new instance of . + /// Gets or sets the name of the network interface. + /// Gets or sets the nic MAC address. + /// Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to connect the nic. + /// Gets or sets the ipv4 address type. + /// Gets or sets the ipv6 address type. + /// Gets or sets the mac address type. + /// Gets or sets the nic id. + /// Keeps track of any properties unknown to the library. + internal NetworkInterfacesUpdate(string name, string macAddress, string virtualNetworkId, AllocationMethod? ipv4AddressType, AllocationMethod? ipv6AddressType, AllocationMethod? macAddressType, string nicId, Dictionary serializedAdditionalRawData) + { + Name = name; + MacAddress = macAddress; + VirtualNetworkId = virtualNetworkId; + IPv4AddressType = ipv4AddressType; + IPv6AddressType = ipv6AddressType; + MacAddressType = macAddressType; + NicId = nicId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the network interface. public string Name { get; set; } /// Gets or sets the nic MAC address. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.Serialization.cs index f1fa30fffc2f..7c0f9cdeea05 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class NetworkProfile : IUtf8JsonSerializable + internal partial class NetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NetworkInterfaces)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaces) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) + internal static NetworkProfile DeserializeNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> networkInterfaces = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces"u8)) @@ -52,8 +81,61 @@ internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) networkInterfaces = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkProfile(Optional.ToList(networkInterfaces), serializedAdditionalRawData); + } + + NetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkProfile(Response response) + { + if (response is null) + { + return null; } - return new NetworkProfile(Optional.ToList(networkInterfaces)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.cs index fe55de12f44d..4833be20d56d 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Defines the resource properties. internal partial class NetworkProfile { - /// Initializes a new instance of NetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkProfile() { NetworkInterfaces = new ChangeTrackingList(); } - /// Initializes a new instance of NetworkProfile. + /// Initializes a new instance of . /// Gets or sets the list of network interfaces associated with the virtual machine. - internal NetworkProfile(IList networkInterfaces) + /// Keeps track of any properties unknown to the library. + internal NetworkProfile(IList networkInterfaces, Dictionary serializedAdditionalRawData) { NetworkInterfaces = networkInterfaces; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the list of network interfaces associated with the virtual machine. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.Serialization.cs index c622312194bf..72858d6507e8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class NetworkProfileUpdate : IUtf8JsonSerializable + internal partial class NetworkProfileUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NetworkInterfaces)) { @@ -21,11 +29,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaces) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static NetworkProfileUpdate DeserializeNetworkProfileUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkInterfaces = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkInterfaces"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkInterfacesUpdate.DeserializeNetworkInterfacesUpdate(item)); + } + networkInterfaces = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkProfileUpdate(Optional.ToList(networkInterfaces), serializedAdditionalRawData); + } + + NetworkProfileUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkProfileUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkProfileUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkProfileUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkProfileUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkProfileUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkProfileUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.cs index e14e199beb4c..efa6aea9fc6c 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/NetworkProfileUpdate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Defines the resource properties. internal partial class NetworkProfileUpdate { - /// Initializes a new instance of NetworkProfileUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkProfileUpdate() { NetworkInterfaces = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Gets or sets the list of network interfaces associated with the virtual machine. + /// Keeps track of any properties unknown to the library. + internal NetworkProfileUpdate(IList networkInterfaces, Dictionary serializedAdditionalRawData) + { + NetworkInterfaces = networkInterfaces; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the list of network interfaces associated with the virtual machine. public IList NetworkInterfaces { get; } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.Serialization.cs index 7dd491e56e0e..7d0a8b68fbed 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class OSProfile : IUtf8JsonSerializable + public partial class OSProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AdminPassword)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("computerName"u8); writer.WriteStringValue(ComputerName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OSProfile DeserializeOSProfile(JsonElement element) + internal static OSProfile DeserializeOSProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +60,7 @@ internal static OSProfile DeserializeOSProfile(JsonElement element) Optional computerName = default; Optional osType = default; Optional osName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("adminPassword"u8)) @@ -64,8 +87,61 @@ internal static OSProfile DeserializeOSProfile(JsonElement element) osName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSProfile(adminPassword.Value, computerName.Value, Optional.ToNullable(osType), osName.Value, serializedAdditionalRawData); + } + + OSProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSProfile model) + { + if (model is null) + { + return null; } - return new OSProfile(adminPassword.Value, computerName.Value, Optional.ToNullable(osType), osName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.cs index 0e177dd0069c..a1aa5c459ed8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/OSProfile.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the resource properties. public partial class OSProfile { - /// Initializes a new instance of OSProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OSProfile() { } - /// Initializes a new instance of OSProfile. + /// Initializes a new instance of . /// Admin password of the virtual machine. /// Gets or sets computer name. /// Gets or sets the type of the os. /// Gets or sets os name. - internal OSProfile(string adminPassword, string computerName, OSType? osType, string osName) + /// Keeps track of any properties unknown to the library. + internal OSProfile(string adminPassword, string computerName, OSType? osType, string osName, Dictionary serializedAdditionalRawData) { AdminPassword = adminPassword; ComputerName = computerName; OSType = osType; OSName = osName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Admin password of the virtual machine. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.Serialization.cs index f434c2d75800..66a25f3f8f75 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class ResourcePatch : IUtf8JsonSerializable + public partial class ResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ResourcePatch DeserializeResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourcePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.cs index 69ecd35c572d..c4d026b2f7df 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ResourcePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Object containing tags updates for patch operations. public partial class ResourcePatch { - /// Initializes a new instance of ResourcePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourcePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal ResourcePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmAvailabilitySetData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmAvailabilitySetData.Serialization.cs index fda7975aad98..13a055978a26 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmAvailabilitySetData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmAvailabilitySetData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class ScVmmAvailabilitySetData : IUtf8JsonSerializable + public partial class ScVmmAvailabilitySetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -49,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VmmServerId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScVmmAvailabilitySetData DeserializeScVmmAvailabilitySetData(JsonElement element) + internal static ScVmmAvailabilitySetData DeserializeScVmmAvailabilitySetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +89,7 @@ internal static ScVmmAvailabilitySetData DeserializeScVmmAvailabilitySetData(Jso Optional availabilitySetName = default; Optional vmmServerId = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -149,8 +171,61 @@ internal static ScVmmAvailabilitySetData DeserializeScVmmAvailabilitySetData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmAvailabilitySetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, availabilitySetName.Value, vmmServerId.Value, provisioningState.Value, serializedAdditionalRawData); + } + + ScVmmAvailabilitySetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmAvailabilitySetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmAvailabilitySetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmAvailabilitySetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmAvailabilitySetData model) + { + if (model is null) + { + return null; } - return new ScVmmAvailabilitySetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, availabilitySetName.Value, vmmServerId.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmAvailabilitySetData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmAvailabilitySetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmCloudData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmCloudData.Serialization.cs index 8407bcf2079c..f3671b91bdab 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmCloudData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmCloudData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class ScVmmCloudData : IUtf8JsonSerializable + public partial class ScVmmCloudData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("extendedLocation"u8); JsonSerializer.Serialize(writer, ExtendedLocation); if (Optional.IsCollectionDefined(Tags)) @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VmmServerId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScVmmCloudData DeserializeScVmmCloudData(JsonElement element) + internal static ScVmmCloudData DeserializeScVmmCloudData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +95,7 @@ internal static ScVmmCloudData DeserializeScVmmCloudData(JsonElement element) Optional cloudCapacity = default; Optional> storageQoSPolicies = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -184,8 +206,61 @@ internal static ScVmmCloudData DeserializeScVmmCloudData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmCloudData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, cloudName.Value, cloudCapacity.Value, Optional.ToList(storageQoSPolicies), provisioningState.Value, serializedAdditionalRawData); + } + + ScVmmCloudData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmCloudData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmCloudData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmCloudData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmCloudData model) + { + if (model is null) + { + return null; } - return new ScVmmCloudData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, cloudName.Value, cloudCapacity.Value, Optional.ToList(storageQoSPolicies), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmCloudData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmCloudData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmServerData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmServerData.Serialization.cs index a8d96e1e36b6..7dbbde357220 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmServerData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmServerData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class ScVmmServerData : IUtf8JsonSerializable + public partial class ScVmmServerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("extendedLocation"u8); JsonSerializer.Serialize(writer, ExtendedLocation); if (Optional.IsCollectionDefined(Tags)) @@ -38,7 +45,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WritePropertyName("fqdn"u8); writer.WriteStringValue(Fqdn); @@ -48,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Port.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScVmmServerData DeserializeScVmmServerData(JsonElement element) + internal static ScVmmServerData DeserializeScVmmServerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +100,7 @@ internal static ScVmmServerData DeserializeScVmmServerData(JsonElement element) Optional uuid = default; Optional version = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -182,8 +211,61 @@ internal static ScVmmServerData DeserializeScVmmServerData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmServerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, credentials.Value, fqdn, Optional.ToNullable(port), connectionStatus.Value, errorMessage.Value, uuid.Value, version.Value, provisioningState.Value, serializedAdditionalRawData); + } + + ScVmmServerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmServerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmServerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmServerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmServerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmServerData(Response response) + { + if (response is null) + { + return null; } - return new ScVmmServerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, credentials.Value, fqdn, Optional.ToNullable(port), connectionStatus.Value, errorMessage.Value, uuid.Value, version.Value, provisioningState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmServerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineData.Serialization.cs index d67703709bf0..bacd5ca33b50 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class ScVmmVirtualMachineData : IUtf8JsonSerializable + public partial class ScVmmVirtualMachineData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("extendedLocation"u8); JsonSerializer.Serialize(writer, ExtendedLocation); if (Optional.IsCollectionDefined(Tags)) @@ -66,7 +73,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Checkpoints) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,29 +90,64 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AvailabilitySets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(VmName)) { @@ -116,11 +165,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Generation.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScVmmVirtualMachineData DeserializeScVmmVirtualMachineData(JsonElement element) + internal static ScVmmVirtualMachineData DeserializeScVmmVirtualMachineData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -148,6 +211,7 @@ internal static ScVmmVirtualMachineData DeserializeScVmmVirtualMachineData(JsonE Optional generation = default; Optional powerState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -328,8 +392,61 @@ internal static ScVmmVirtualMachineData DeserializeScVmmVirtualMachineData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmVirtualMachineData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, vmmServerId.Value, cloudId.Value, templateId.Value, checkpointType.Value, Optional.ToList(checkpoints), Optional.ToList(availabilitySets), osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, vmName.Value, uuid.Value, Optional.ToNullable(generation), powerState.Value, provisioningState.Value, serializedAdditionalRawData); + } + + ScVmmVirtualMachineData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmVirtualMachineData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmVirtualMachineData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmVirtualMachineData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmVirtualMachineData model) + { + if (model is null) + { + return null; } - return new ScVmmVirtualMachineData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, vmmServerId.Value, cloudId.Value, templateId.Value, checkpointType.Value, Optional.ToList(checkpoints), Optional.ToList(availabilitySets), osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, vmName.Value, uuid.Value, Optional.ToNullable(generation), powerState.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmVirtualMachineData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmVirtualMachineData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.Serialization.cs index ade59f512f84..1a744616df0a 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class ScVmmVirtualMachinePatch : IUtf8JsonSerializable + public partial class ScVmmVirtualMachinePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -31,7 +46,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ScVmmVirtualMachinePatch DeserializeScVmmVirtualMachinePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VirtualMachineUpdateProperties.DeserializeVirtualMachineUpdateProperties(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmVirtualMachinePatch(properties.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ScVmmVirtualMachinePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmVirtualMachinePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmVirtualMachinePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmVirtualMachinePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmVirtualMachinePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmVirtualMachinePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmVirtualMachinePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.cs index 9f2ed8595975..eeb19f6214ac 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachinePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Defines the virtualMachineUpdate. public partial class ScVmmVirtualMachinePatch { - /// Initializes a new instance of ScVmmVirtualMachinePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScVmmVirtualMachinePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Defines the resource properties. + /// Gets or sets the Resource tags. + /// Keeps track of any properties unknown to the library. + internal ScVmmVirtualMachinePatch(VirtualMachineUpdateProperties properties, IDictionary tags, Dictionary serializedAdditionalRawData) + { + Properties = properties; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Defines the resource properties. public VirtualMachineUpdateProperties Properties { get; set; } /// Gets or sets the Resource tags. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineTemplateData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineTemplateData.Serialization.cs index d9e5bf336fba..c5a4d25f2a17 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineTemplateData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualMachineTemplateData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class ScVmmVirtualMachineTemplateData : IUtf8JsonSerializable + public partial class ScVmmVirtualMachineTemplateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("extendedLocation"u8); JsonSerializer.Serialize(writer, ExtendedLocation); if (Optional.IsCollectionDefined(Tags)) @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VmmServerId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScVmmVirtualMachineTemplateData DeserializeScVmmVirtualMachineTemplateData(JsonElement element) + internal static ScVmmVirtualMachineTemplateData DeserializeScVmmVirtualMachineTemplateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +106,7 @@ internal static ScVmmVirtualMachineTemplateData DeserializeScVmmVirtualMachineTe Optional> networkInterfaces = default; Optional> disks = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -291,8 +313,61 @@ internal static ScVmmVirtualMachineTemplateData DeserializeScVmmVirtualMachineTe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmVirtualMachineTemplateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, Optional.ToNullable(osType), osName.Value, computerName.Value, Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(isCustomizable), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), isHighlyAvailable.Value, Optional.ToNullable(generation), Optional.ToList(networkInterfaces), Optional.ToList(disks), provisioningState.Value, serializedAdditionalRawData); + } + + ScVmmVirtualMachineTemplateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmVirtualMachineTemplateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmVirtualMachineTemplateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmVirtualMachineTemplateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmVirtualMachineTemplateData model) + { + if (model is null) + { + return null; } - return new ScVmmVirtualMachineTemplateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, Optional.ToNullable(osType), osName.Value, computerName.Value, Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(isCustomizable), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), isHighlyAvailable.Value, Optional.ToNullable(generation), Optional.ToList(networkInterfaces), Optional.ToList(disks), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmVirtualMachineTemplateData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmVirtualMachineTemplateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualNetworkData.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualNetworkData.Serialization.cs index 6c554a5797e9..cb9488a9420e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualNetworkData.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/ScVmmVirtualNetworkData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ArcScVmm { - public partial class ScVmmVirtualNetworkData : IUtf8JsonSerializable + public partial class ScVmmVirtualNetworkData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("extendedLocation"u8); JsonSerializer.Serialize(writer, ExtendedLocation); if (Optional.IsCollectionDefined(Tags)) @@ -50,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VmmServerId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScVmmVirtualNetworkData DeserializeScVmmVirtualNetworkData(JsonElement element) + internal static ScVmmVirtualNetworkData DeserializeScVmmVirtualNetworkData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +92,7 @@ internal static ScVmmVirtualNetworkData DeserializeScVmmVirtualNetworkData(JsonE Optional vmmServerId = default; Optional networkName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -158,8 +180,61 @@ internal static ScVmmVirtualNetworkData DeserializeScVmmVirtualNetworkData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScVmmVirtualNetworkData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, networkName.Value, provisioningState.Value, serializedAdditionalRawData); + } + + ScVmmVirtualNetworkData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScVmmVirtualNetworkData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScVmmVirtualNetworkData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScVmmVirtualNetworkData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScVmmVirtualNetworkData model) + { + if (model is null) + { + return null; } - return new ScVmmVirtualNetworkData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, networkName.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScVmmVirtualNetworkData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScVmmVirtualNetworkData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.Serialization.cs index 814e757d0a67..98e69925b557 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class StopVirtualMachineContent : IUtf8JsonSerializable + public partial class StopVirtualMachineContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SkipShutdown)) { writer.WritePropertyName("skipShutdown"u8); writer.WriteBooleanValue(SkipShutdown.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StopVirtualMachineContent DeserializeStopVirtualMachineContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional skipShutdown = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("skipShutdown"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + skipShutdown = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StopVirtualMachineContent(Optional.ToNullable(skipShutdown), serializedAdditionalRawData); + } + + StopVirtualMachineContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStopVirtualMachineContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StopVirtualMachineContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStopVirtualMachineContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StopVirtualMachineContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StopVirtualMachineContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStopVirtualMachineContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.cs index 00776d03f592..2e3e6c827c50 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StopVirtualMachineContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the stop action properties. public partial class StopVirtualMachineContent { - /// Initializes a new instance of StopVirtualMachineContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StopVirtualMachineContent() { } + /// Initializes a new instance of . + /// Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. + /// Keeps track of any properties unknown to the library. + internal StopVirtualMachineContent(bool? skipShutdown, Dictionary serializedAdditionalRawData) + { + SkipShutdown = skipShutdown; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. public bool? SkipShutdown { get; set; } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.Serialization.cs index 3c559a32da5e..da95b2847cf0 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class StorageProfile : IUtf8JsonSerializable + internal partial class StorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Disks)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Disks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StorageProfile DeserializeStorageProfile(JsonElement element) + internal static StorageProfile DeserializeStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> disks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("disks"u8)) @@ -52,8 +81,61 @@ internal static StorageProfile DeserializeStorageProfile(JsonElement element) disks = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StorageProfile(Optional.ToList(disks), serializedAdditionalRawData); + } + + StorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageProfile(Response response) + { + if (response is null) + { + return null; } - return new StorageProfile(Optional.ToList(disks)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.cs index e42825af0900..109511085cc6 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Defines the resource properties. internal partial class StorageProfile { - /// Initializes a new instance of StorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StorageProfile() { Disks = new ChangeTrackingList(); } - /// Initializes a new instance of StorageProfile. + /// Initializes a new instance of . /// Gets or sets the list of virtual disks associated with the virtual machine. - internal StorageProfile(IList disks) + /// Keeps track of any properties unknown to the library. + internal StorageProfile(IList disks, Dictionary serializedAdditionalRawData) { Disks = disks; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the list of virtual disks associated with the virtual machine. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.Serialization.cs index 978e2ec5a3d2..5f110bdf53e7 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class StorageProfileUpdate : IUtf8JsonSerializable + internal partial class StorageProfileUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Disks)) { @@ -21,11 +29,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Disks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StorageProfileUpdate DeserializeStorageProfileUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> disks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("disks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualDiskUpdate.DeserializeVirtualDiskUpdate(item)); + } + disks = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StorageProfileUpdate(Optional.ToList(disks), serializedAdditionalRawData); + } + + StorageProfileUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageProfileUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageProfileUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageProfileUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageProfileUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageProfileUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageProfileUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.cs index d2f9feb44fd1..126fdded87fd 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageProfileUpdate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Defines the resource properties. internal partial class StorageProfileUpdate { - /// Initializes a new instance of StorageProfileUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StorageProfileUpdate() { Disks = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Gets or sets the list of virtual disks associated with the virtual machine. + /// Keeps track of any properties unknown to the library. + internal StorageProfileUpdate(IList disks, Dictionary serializedAdditionalRawData) + { + Disks = disks; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the list of virtual disks associated with the virtual machine. public IList Disks { get; } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.Serialization.cs index bcb738e091e7..161862b959a6 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.Serialization.cs @@ -5,15 +5,73 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class StorageQoSPolicy + public partial class StorageQoSPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - internal static StorageQoSPolicy DeserializeStorageQoSPolicy(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(IopsMaximum)) + { + writer.WritePropertyName("iopsMaximum"u8); + writer.WriteNumberValue(IopsMaximum.Value); + } + if (Optional.IsDefined(IopsMinimum)) + { + writer.WritePropertyName("iopsMinimum"u8); + writer.WriteNumberValue(IopsMinimum.Value); + } + if (Optional.IsDefined(BandwidthLimit)) + { + writer.WritePropertyName("bandwidthLimit"u8); + writer.WriteNumberValue(BandwidthLimit.Value); + } + if (Optional.IsDefined(PolicyId)) + { + writer.WritePropertyName("policyId"u8); + writer.WriteStringValue(PolicyId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static StorageQoSPolicy DeserializeStorageQoSPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static StorageQoSPolicy DeserializeStorageQoSPolicy(JsonElement element Optional iopsMinimum = default; Optional bandwidthLimit = default; Optional policyId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -68,8 +127,61 @@ internal static StorageQoSPolicy DeserializeStorageQoSPolicy(JsonElement element policyId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new StorageQoSPolicy(name.Value, id.Value, Optional.ToNullable(iopsMaximum), Optional.ToNullable(iopsMinimum), Optional.ToNullable(bandwidthLimit), policyId.Value); + return new StorageQoSPolicy(name.Value, id.Value, Optional.ToNullable(iopsMaximum), Optional.ToNullable(iopsMinimum), Optional.ToNullable(bandwidthLimit), policyId.Value, serializedAdditionalRawData); + } + + StorageQoSPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageQoSPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageQoSPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageQoSPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageQoSPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageQoSPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageQoSPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.cs index d392131804b1..bdc9d1b277af 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicy.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// The StorageQoSPolicy definition. public partial class StorageQoSPolicy { - /// Initializes a new instance of StorageQoSPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal StorageQoSPolicy() { } - /// Initializes a new instance of StorageQoSPolicy. + /// Initializes a new instance of . /// The name of the policy. /// The ID of the QoS policy. /// The maximum IO operations per second. /// The minimum IO operations per second. /// The Bandwidth Limit for internet traffic. /// The underlying policy. - internal StorageQoSPolicy(string name, string id, long? iopsMaximum, long? iopsMinimum, long? bandwidthLimit, string policyId) + /// Keeps track of any properties unknown to the library. + internal StorageQoSPolicy(string name, string id, long? iopsMaximum, long? iopsMinimum, long? bandwidthLimit, string policyId, Dictionary serializedAdditionalRawData) { Name = name; Id = id; @@ -30,6 +37,7 @@ internal StorageQoSPolicy(string name, string id, long? iopsMaximum, long? iopsM IopsMinimum = iopsMinimum; BandwidthLimit = bandwidthLimit; PolicyId = policyId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the policy. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.Serialization.cs index 12dd3b5c87f7..e1cd8292fc28 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class StorageQoSPolicyDetails : IUtf8JsonSerializable + public partial class StorageQoSPolicyDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StorageQoSPolicyDetails DeserializeStorageQoSPolicyDetails(JsonElement element) + internal static StorageQoSPolicyDetails DeserializeStorageQoSPolicyDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static StorageQoSPolicyDetails DeserializeStorageQoSPolicyDetails(JsonE id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StorageQoSPolicyDetails(name.Value, id.Value, serializedAdditionalRawData); + } + + StorageQoSPolicyDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageQoSPolicyDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageQoSPolicyDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageQoSPolicyDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageQoSPolicyDetails model) + { + if (model is null) + { + return null; } - return new StorageQoSPolicyDetails(name.Value, id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageQoSPolicyDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageQoSPolicyDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.cs index cd9725aad464..c49538f59203 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/StorageQoSPolicyDetails.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// The StorageQoSPolicyDetails definition. public partial class StorageQoSPolicyDetails { - /// Initializes a new instance of StorageQoSPolicyDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StorageQoSPolicyDetails() { } - /// Initializes a new instance of StorageQoSPolicyDetails. + /// Initializes a new instance of . /// The name of the policy. /// The ID of the QoS policy. - internal StorageQoSPolicyDetails(string name, string id) + /// Keeps track of any properties unknown to the library. + internal StorageQoSPolicyDetails(string name, string id, Dictionary serializedAdditionalRawData) { Name = name; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the policy. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.Serialization.cs index 80bfb8b84d3a..350e528da3e0 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VirtualDisk : IUtf8JsonSerializable + public partial class VirtualDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -58,18 +66,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(StorageQoSPolicy)) { writer.WritePropertyName("storageQoSPolicy"u8); - writer.WriteObjectValue(StorageQoSPolicy); + if (StorageQoSPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageQoSPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(CreateDiffDisk)) { writer.WritePropertyName("createDiffDisk"u8); writer.WriteStringValue(CreateDiffDisk.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualDisk DeserializeVirtualDisk(JsonElement element) + internal static VirtualDisk DeserializeVirtualDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -88,6 +117,7 @@ internal static VirtualDisk DeserializeVirtualDisk(JsonElement element) Optional templateDiskId = default; Optional storageQoSPolicy = default; Optional createDiffDisk = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -184,8 +214,61 @@ internal static VirtualDisk DeserializeVirtualDisk(JsonElement element) createDiffDisk = new CreateDiffDisk(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualDisk(name.Value, displayName.Value, diskId.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(maxDiskSizeGB), Optional.ToNullable(bus), Optional.ToNullable(lun), busType.Value, vhdType.Value, volumeType.Value, vhdFormatType.Value, templateDiskId.Value, storageQoSPolicy.Value, Optional.ToNullable(createDiffDisk), serializedAdditionalRawData); + } + + VirtualDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualDisk(name.Value, displayName.Value, diskId.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(maxDiskSizeGB), Optional.ToNullable(bus), Optional.ToNullable(lun), busType.Value, vhdType.Value, volumeType.Value, vhdFormatType.Value, templateDiskId.Value, storageQoSPolicy.Value, Optional.ToNullable(createDiffDisk)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.cs index 1395f9db5e7c..859df38be6b8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDisk.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Virtual disk model. public partial class VirtualDisk { - /// Initializes a new instance of VirtualDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualDisk() { } - /// Initializes a new instance of VirtualDisk. + /// Initializes a new instance of . /// Gets or sets the name of the disk. /// Gets the display name of the virtual disk as shown in the vmmServer. This is the fallback label for a disk when the name is not set. /// Gets or sets the disk id. @@ -30,7 +36,8 @@ public VirtualDisk() /// Gets or sets the disk id in the template. /// The QoS policy for the disk. /// Gets or sets a value indicating diff disk. - internal VirtualDisk(string name, string displayName, string diskId, int? diskSizeGB, int? maxDiskSizeGB, int? bus, int? lun, string busType, string vhdType, string volumeType, string vhdFormatType, string templateDiskId, StorageQoSPolicyDetails storageQoSPolicy, CreateDiffDisk? createDiffDisk) + /// Keeps track of any properties unknown to the library. + internal VirtualDisk(string name, string displayName, string diskId, int? diskSizeGB, int? maxDiskSizeGB, int? bus, int? lun, string busType, string vhdType, string volumeType, string vhdFormatType, string templateDiskId, StorageQoSPolicyDetails storageQoSPolicy, CreateDiffDisk? createDiffDisk, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; @@ -46,6 +53,7 @@ internal VirtualDisk(string name, string displayName, string diskId, int? diskSi TemplateDiskId = templateDiskId; StorageQoSPolicy = storageQoSPolicy; CreateDiffDisk = createDiffDisk; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the disk. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.Serialization.cs index 340fbc479411..7254f95f1935 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VirtualDiskUpdate : IUtf8JsonSerializable + public partial class VirtualDiskUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -53,9 +61,160 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(StorageQoSPolicy)) { writer.WritePropertyName("storageQoSPolicy"u8); - writer.WriteObjectValue(StorageQoSPolicy); + if (StorageQoSPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageQoSPolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static VirtualDiskUpdate DeserializeVirtualDiskUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional diskId = default; + Optional diskSizeGB = default; + Optional bus = default; + Optional lun = default; + Optional busType = default; + Optional vhdType = default; + Optional storageQoSPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("diskId"u8)) + { + diskId = property.Value.GetString(); + continue; + } + if (property.NameEquals("diskSizeGB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("bus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bus = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("lun"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lun = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("busType"u8)) + { + busType = property.Value.GetString(); + continue; + } + if (property.NameEquals("vhdType"u8)) + { + vhdType = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageQoSPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageQoSPolicy = StorageQoSPolicyDetails.DeserializeStorageQoSPolicyDetails(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualDiskUpdate(name.Value, diskId.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(bus), Optional.ToNullable(lun), busType.Value, vhdType.Value, storageQoSPolicy.Value, serializedAdditionalRawData); + } + + VirtualDiskUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualDiskUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualDiskUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualDiskUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualDiskUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualDiskUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualDiskUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.cs index a540b3dce241..2e771d44213f 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualDiskUpdate.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Virtual disk model. public partial class VirtualDiskUpdate { - /// Initializes a new instance of VirtualDiskUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualDiskUpdate() { } + /// Initializes a new instance of . + /// Gets or sets the name of the disk. + /// Gets or sets the disk id. + /// Gets or sets the disk total size. + /// Gets or sets the disk bus. + /// Gets or sets the disk lun. + /// Gets or sets the disk bus type. + /// Gets or sets the disk vhd type. + /// The QoS policy for the disk. + /// Keeps track of any properties unknown to the library. + internal VirtualDiskUpdate(string name, string diskId, int? diskSizeGB, int? bus, int? lun, string busType, string vhdType, StorageQoSPolicyDetails storageQoSPolicy, Dictionary serializedAdditionalRawData) + { + Name = name; + DiskId = diskId; + DiskSizeGB = diskSizeGB; + Bus = bus; + Lun = lun; + BusType = busType; + VhdType = vhdType; + StorageQoSPolicy = storageQoSPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the disk. public string Name { get; set; } /// Gets or sets the disk id. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.Serialization.cs index bf6e9c7744b6..d4cffbf67047 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VirtualMachineCreateCheckpoint : IUtf8JsonSerializable + public partial class VirtualMachineCreateCheckpoint : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineCreateCheckpoint DeserializeVirtualMachineCreateCheckpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineCreateCheckpoint(name.Value, description.Value, serializedAdditionalRawData); + } + + VirtualMachineCreateCheckpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineCreateCheckpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineCreateCheckpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineCreateCheckpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineCreateCheckpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineCreateCheckpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineCreateCheckpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.cs index a3394940bb87..07ea43603aed 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineCreateCheckpoint.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the create checkpoint action properties. public partial class VirtualMachineCreateCheckpoint { - /// Initializes a new instance of VirtualMachineCreateCheckpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineCreateCheckpoint() { } + /// Initializes a new instance of . + /// Name of the checkpoint. + /// Description of the checkpoint. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineCreateCheckpoint(string name, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Name of the checkpoint. public string Name { get; set; } /// Description of the checkpoint. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.Serialization.cs index fe5b574ec777..ae18c2d88344 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VirtualMachineDeleteCheckpoint : IUtf8JsonSerializable + public partial class VirtualMachineDeleteCheckpoint : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineDeleteCheckpoint DeserializeVirtualMachineDeleteCheckpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineDeleteCheckpoint(id.Value, serializedAdditionalRawData); + } + + VirtualMachineDeleteCheckpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineDeleteCheckpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineDeleteCheckpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineDeleteCheckpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineDeleteCheckpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineDeleteCheckpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineDeleteCheckpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.cs index 4282b1a7cc14..63939fac0b14 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineDeleteCheckpoint.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the delete checkpoint action properties. public partial class VirtualMachineDeleteCheckpoint { - /// Initializes a new instance of VirtualMachineDeleteCheckpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineDeleteCheckpoint() { } + /// Initializes a new instance of . + /// ID of the checkpoint to be deleted. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineDeleteCheckpoint(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// ID of the checkpoint to be deleted. public string Id { get; set; } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.Serialization.cs index cf0272cf9bcf..080f10fc31e8 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class VirtualMachineListResult + internal partial class VirtualMachineListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineListResult DeserializeVirtualMachineListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineListResult DeserializeVirtualMachineListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static VirtualMachineListResult DeserializeVirtualMachineListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineListResult(Optional.ToList(value), nextLink.Value); + return new VirtualMachineListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.cs index ba15d3c414ea..4b6925d5d1c9 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of VirtualMachines. internal partial class VirtualMachineListResult { - /// Initializes a new instance of VirtualMachineListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineListResult. + /// Initializes a new instance of . /// List of VirtualMachines. /// Url to follow for getting next page of resources. - internal VirtualMachineListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of VirtualMachines. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.Serialization.cs index b92ebe23bc11..5014e258b3d1 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VirtualMachineRestoreCheckpoint : IUtf8JsonSerializable + public partial class VirtualMachineRestoreCheckpoint : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineRestoreCheckpoint DeserializeVirtualMachineRestoreCheckpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineRestoreCheckpoint(id.Value, serializedAdditionalRawData); + } + + VirtualMachineRestoreCheckpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRestoreCheckpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRestoreCheckpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRestoreCheckpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRestoreCheckpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRestoreCheckpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRestoreCheckpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.cs index 669b81260792..78092f897b5f 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineRestoreCheckpoint.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Defines the restore checkpoint action properties. public partial class VirtualMachineRestoreCheckpoint { - /// Initializes a new instance of VirtualMachineRestoreCheckpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineRestoreCheckpoint() { } + /// Initializes a new instance of . + /// ID of the checkpoint to be restored to. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRestoreCheckpoint(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// ID of the checkpoint to be restored to. public string Id { get; set; } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.Serialization.cs index 810acf2b0b13..0cf6eb55409a 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class VirtualMachineTemplateListResult + internal partial class VirtualMachineTemplateListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineTemplateListResult DeserializeVirtualMachineTemplateListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineTemplateListResult DeserializeVirtualMachineTemplateListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static VirtualMachineTemplateListResult DeserializeVirtualMachineTempla nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineTemplateListResult(Optional.ToList(value), nextLink.Value); + return new VirtualMachineTemplateListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineTemplateListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineTemplateListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineTemplateListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineTemplateListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineTemplateListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineTemplateListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineTemplateListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.cs index b5b40168f266..359ff016b499 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineTemplateListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of VirtualMachineTemplates. internal partial class VirtualMachineTemplateListResult { - /// Initializes a new instance of VirtualMachineTemplateListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineTemplateListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineTemplateListResult. + /// Initializes a new instance of . /// List of VirtualMachineTemplates. /// Url to follow for getting next page of resources. - internal VirtualMachineTemplateListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineTemplateListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of VirtualMachineTemplates. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.Serialization.cs index 56a65de488d1..32a42b674135 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.Serialization.cs @@ -5,30 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VirtualMachineUpdateProperties : IUtf8JsonSerializable + public partial class VirtualMachineUpdateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AvailabilitySets)) { @@ -36,11 +65,143 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AvailabilitySets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineUpdateProperties DeserializeVirtualMachineUpdateProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hardwareProfile = default; + Optional storageProfile = default; + Optional networkProfile = default; + Optional> availabilitySets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hardwareProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hardwareProfile = HardwareProfileUpdate.DeserializeHardwareProfileUpdate(property.Value); + continue; + } + if (property.NameEquals("storageProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = StorageProfileUpdate.DeserializeStorageProfileUpdate(property.Value); + continue; + } + if (property.NameEquals("networkProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = NetworkProfileUpdate.DeserializeNetworkProfileUpdate(property.Value); + continue; + } + if (property.NameEquals("availabilitySets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AvailabilitySetListItem.DeserializeAvailabilitySetListItem(item)); + } + availabilitySets = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineUpdateProperties(hardwareProfile.Value, storageProfile.Value, networkProfile.Value, Optional.ToList(availabilitySets), serializedAdditionalRawData); + } + + VirtualMachineUpdateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineUpdateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineUpdateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineUpdateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineUpdateProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineUpdateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineUpdateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.cs index 4e10fba1e674..45200ce84f9b 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualMachineUpdateProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// Defines the resource properties. public partial class VirtualMachineUpdateProperties { - /// Initializes a new instance of VirtualMachineUpdateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineUpdateProperties() { AvailabilitySets = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Defines the resource properties. + /// Defines the resource properties. + /// Defines the resource properties. + /// Availability Sets in vm. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineUpdateProperties(HardwareProfileUpdate hardwareProfile, StorageProfileUpdate storageProfile, NetworkProfileUpdate networkProfile, IList availabilitySets, Dictionary serializedAdditionalRawData) + { + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + AvailabilitySets = availabilitySets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Defines the resource properties. public HardwareProfileUpdate HardwareProfile { get; set; } /// Defines the resource properties. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.Serialization.cs index 4ff603349b71..673e0eeda9ab 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class VirtualNetworkListResult + internal partial class VirtualNetworkListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualNetworkListResult DeserializeVirtualNetworkListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualNetworkListResult DeserializeVirtualNetworkListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static VirtualNetworkListResult DeserializeVirtualNetworkListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualNetworkListResult(Optional.ToList(value), nextLink.Value); + return new VirtualNetworkListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + VirtualNetworkListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualNetworkListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualNetworkListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualNetworkListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualNetworkListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualNetworkListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualNetworkListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.cs index d02e37f4941f..f16138800030 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VirtualNetworkListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of VirtualNetworks. internal partial class VirtualNetworkListResult { - /// Initializes a new instance of VirtualNetworkListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualNetworkListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualNetworkListResult. + /// Initializes a new instance of . /// List of VirtualNetworks. /// Url to follow for getting next page of resources. - internal VirtualNetworkListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualNetworkListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of VirtualNetworks. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.Serialization.cs index 7e60fe3dd389..620a6d7cf154 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ArcScVmm; namespace Azure.ResourceManager.ArcScVmm.Models { - internal partial class VmmServerListResult + internal partial class VmmServerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VmmServerListResult DeserializeVmmServerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VmmServerListResult DeserializeVmmServerListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static VmmServerListResult DeserializeVmmServerListResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VmmServerListResult(Optional.ToList(value), nextLink.Value); + return new VmmServerListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + VmmServerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVmmServerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VmmServerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVmmServerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VmmServerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VmmServerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVmmServerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.cs index 03822913561f..e9f718d05a06 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ArcScVmm; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ArcScVmm.Models /// List of VmmServers. internal partial class VmmServerListResult { - /// Initializes a new instance of VmmServerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VmmServerListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VmmServerListResult. + /// Initializes a new instance of . /// List of VmmServers. /// Url to follow for getting next page of resources. - internal VmmServerListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VmmServerListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of VmmServers. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.Serialization.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.Serialization.cs index 82dea5021f2c..833b9b6c57b0 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.Serialization.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ArcScVmm.Models { - public partial class VmmServerPropertiesCredentials : IUtf8JsonSerializable + public partial class VmmServerPropertiesCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Username)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VmmServerPropertiesCredentials DeserializeVmmServerPropertiesCredentials(JsonElement element) + internal static VmmServerPropertiesCredentials DeserializeVmmServerPropertiesCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional username = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -48,8 +71,61 @@ internal static VmmServerPropertiesCredentials DeserializeVmmServerPropertiesCre password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VmmServerPropertiesCredentials(username.Value, password.Value, serializedAdditionalRawData); + } + + VmmServerPropertiesCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVmmServerPropertiesCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VmmServerPropertiesCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVmmServerPropertiesCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VmmServerPropertiesCredentials model) + { + if (model is null) + { + return null; } - return new VmmServerPropertiesCredentials(username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VmmServerPropertiesCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVmmServerPropertiesCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.cs index af11058f1766..39c4196d5390 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Models/VmmServerPropertiesCredentials.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ArcScVmm.Models { /// Credentials to connect to VMMServer. public partial class VmmServerPropertiesCredentials { - /// Initializes a new instance of VmmServerPropertiesCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VmmServerPropertiesCredentials() { } - /// Initializes a new instance of VmmServerPropertiesCredentials. + /// Initializes a new instance of . /// Username to use to connect to VMMServer. /// Credentials to use to connect to VMMServer. - internal VmmServerPropertiesCredentials(string username, string password) + /// Keeps track of any properties unknown to the library. + internal VmmServerPropertiesCredentials(string username, string password, Dictionary serializedAdditionalRawData) { Username = username; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Username to use to connect to VMMServer. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs index 4cd3f53dea5d..86dbc78d8d04 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -292,9 +290,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/CloudsRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/CloudsRestOperations.cs index 7c5aee63c0a4..09ed859fdc5e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/CloudsRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/CloudsRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -292,9 +290,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/InventoryItemsRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/InventoryItemsRestOperations.cs index 3bdacc88e501..4821ffa3fe15 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/InventoryItemsRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/InventoryItemsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs index 177545c1418f..068d5be56506 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -292,9 +290,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index 55758abf267f..1b209117b766 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -298,9 +296,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -381,9 +377,7 @@ internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGro if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; @@ -603,9 +597,7 @@ internal HttpMessage CreateCreateCheckpointRequest(string subscriptionId, string if (body != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } _userAgent.Apply(message); return message; @@ -683,9 +675,7 @@ internal HttpMessage CreateDeleteCheckpointRequest(string subscriptionId, string if (body != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } _userAgent.Apply(message); return message; @@ -763,9 +753,7 @@ internal HttpMessage CreateRestoreCheckpointRequest(string subscriptionId, strin if (body != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } _userAgent.Apply(message); return message; diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualNetworksRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualNetworksRestOperations.cs index 58d44ae8eca7..65901d4b03f6 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualNetworksRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VirtualNetworksRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -292,9 +290,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VmmServersRestOperations.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VmmServersRestOperations.cs index 22d2aa9f1780..cae386298d7e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VmmServersRestOperations.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/RestOperations/VmmServersRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -292,9 +290,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs index c9ddb2972f42..db1d0419f2a7 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmAvailabilitySetAvailabilitySetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmAvailabilitySetAvailabilitySetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "ScVmmAvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "ScVmmAvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmAvailabilitySetAvailabilitySetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmAvailabilitySetAvailabilitySetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "ScVmmAvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "ScVmmAvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetData.cs index fd4c555d3202..7d33ea35ccb0 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class ScVmmAvailabilitySetData : TrackedResourceData { - /// Initializes a new instance of ScVmmAvailabilitySetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ScVmmAvailabilitySetData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ScVmmAvailabilitySetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +39,19 @@ public ScVmmAvailabilitySetData(AzureLocation location) : base(location) /// Name of the availability set. /// ARM Id of the vmmServer resource in which this resource resides. /// Gets or sets the provisioning state. - internal ScVmmAvailabilitySetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string availabilitySetName, string vmmServerId, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ScVmmAvailabilitySetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string availabilitySetName, string vmmServerId, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; AvailabilitySetName = availabilitySetName; VmmServerId = vmmServerId; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScVmmAvailabilitySetData() + { } /// The extended location. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs index 1147c401409a..e079389c0fd9 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmCloudCloudsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmCloudCloudsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), _scVmmCloudCloudsClientDiagnostics, Pipeline, "ScVmmCloudCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), _scVmmCloudCloudsClientDiagnostics, Pipeline, "ScVmmCloudCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmCloudCloudsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmCloudCloudsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), _scVmmCloudCloudsClientDiagnostics, Pipeline, "ScVmmCloudCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), _scVmmCloudCloudsClientDiagnostics, Pipeline, "ScVmmCloudCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudData.cs index db57ebb33f17..02b3a24461ad 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class ScVmmCloudData : TrackedResourceData { - /// Initializes a new instance of ScVmmCloudData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The extended location. /// is null. @@ -32,7 +35,7 @@ public ScVmmCloudData(AzureLocation location, ExtendedLocation extendedLocation) StorageQoSPolicies = new ChangeTrackingList(); } - /// Initializes a new instance of ScVmmCloudData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +50,8 @@ public ScVmmCloudData(AzureLocation location, ExtendedLocation extendedLocation) /// Capacity of the cloud. /// List of QoS policies available for the cloud. /// Gets or sets the provisioning state. - internal ScVmmCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string cloudName, CloudCapacity cloudCapacity, IReadOnlyList storageQoSPolicies, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ScVmmCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string cloudName, CloudCapacity cloudCapacity, IReadOnlyList storageQoSPolicies, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; InventoryItemId = inventoryItemId; @@ -57,6 +61,12 @@ internal ScVmmCloudData(ResourceIdentifier id, string name, ResourceType resourc CloudCapacity = cloudCapacity; StorageQoSPolicies = storageQoSPolicies; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScVmmCloudData() + { } /// The extended location. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs index 1e330cb5a371..fdda26f4d53d 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmServerVmmServersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmServerVmmServersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), _scVmmServerVmmServersClientDiagnostics, Pipeline, "ScVmmServerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), _scVmmServerVmmServersClientDiagnostics, Pipeline, "ScVmmServerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmServerVmmServersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmServerVmmServersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), _scVmmServerVmmServersClientDiagnostics, Pipeline, "ScVmmServerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), _scVmmServerVmmServersClientDiagnostics, Pipeline, "ScVmmServerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerData.cs index 037735df7249..c59df4b84666 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class ScVmmServerData : TrackedResourceData { - /// Initializes a new instance of ScVmmServerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The extended location. /// Fqdn is the hostname/ip of the vmmServer. @@ -34,7 +37,7 @@ public ScVmmServerData(AzureLocation location, ExtendedLocation extendedLocation Fqdn = fqdn; } - /// Initializes a new instance of ScVmmServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,7 +53,8 @@ public ScVmmServerData(AzureLocation location, ExtendedLocation extendedLocation /// Unique ID of vmmServer. /// Version is the version of the vmmSever. /// Gets or sets the provisioning state. - internal ScVmmServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, VmmServerPropertiesCredentials credentials, string fqdn, int? port, string connectionStatus, string errorMessage, string uuid, string version, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ScVmmServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, VmmServerPropertiesCredentials credentials, string fqdn, int? port, string connectionStatus, string errorMessage, string uuid, string version, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Credentials = credentials; @@ -61,6 +65,12 @@ internal ScVmmServerData(ResourceIdentifier id, string name, ResourceType resour Uuid = uuid; Version = version; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScVmmServerData() + { } /// The extended location. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs index 39cdb20b5ce9..e9a901fdaa35 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmVirtualMachineVirtualMachinesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmVirtualMachineVirtualMachinesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), _scVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "ScVmmVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), _scVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "ScVmmVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmVirtualMachineVirtualMachinesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmVirtualMachineVirtualMachinesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), _scVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "ScVmmVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), _scVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "ScVmmVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineData.cs index fdaa552ab1ef..584475b1d92d 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class ScVmmVirtualMachineData : TrackedResourceData { - /// Initializes a new instance of ScVmmVirtualMachineData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The extended location. /// is null. @@ -33,7 +36,7 @@ public ScVmmVirtualMachineData(AzureLocation location, ExtendedLocation extended AvailabilitySets = new ChangeTrackingList(); } - /// Initializes a new instance of ScVmmVirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -57,7 +60,8 @@ public ScVmmVirtualMachineData(AzureLocation location, ExtendedLocation extended /// Gets or sets the generation for the vm. /// Gets the power state of the virtual machine. /// Gets or sets the provisioning state. - internal ScVmmVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string vmmServerId, string cloudId, string templateId, string checkpointType, IList checkpoints, IList availabilitySets, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, string vmName, string uuid, int? generation, string powerState, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ScVmmVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string vmmServerId, string cloudId, string templateId, string checkpointType, IList checkpoints, IList availabilitySets, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, string vmName, string uuid, int? generation, string powerState, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; InventoryItemId = inventoryItemId; @@ -76,6 +80,12 @@ internal ScVmmVirtualMachineData(ResourceIdentifier id, string name, ResourceTyp Generation = generation; PowerState = powerState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScVmmVirtualMachineData() + { } /// The extended location. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs index 25315fafec81..6d852fdca34f 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "ScVmmVirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "ScVmmVirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "ScVmmVirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "ScVmmVirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateData.cs index 320241897fd0..285f3425ad33 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class ScVmmVirtualMachineTemplateData : TrackedResourceData { - /// Initializes a new instance of ScVmmVirtualMachineTemplateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The extended location. /// is null. @@ -33,7 +36,7 @@ public ScVmmVirtualMachineTemplateData(AzureLocation location, ExtendedLocation Disks = new ChangeTrackingList(); } - /// Initializes a new instance of ScVmmVirtualMachineTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -59,7 +62,8 @@ public ScVmmVirtualMachineTemplateData(AzureLocation location, ExtendedLocation /// Gets or sets the network interfaces of the template. /// Gets or sets the disks of the template. /// Gets or sets the provisioning state. - internal ScVmmVirtualMachineTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, OSType? osType, string osName, string computerName, int? memoryMB, int? cpuCount, LimitCpuForMigration? limitCpuForMigration, DynamicMemoryEnabled? dynamicMemoryEnabled, IsCustomizable? isCustomizable, int? dynamicMemoryMaxMB, int? dynamicMemoryMinMB, string isHighlyAvailable, int? generation, IReadOnlyList networkInterfaces, IReadOnlyList disks, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ScVmmVirtualMachineTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, OSType? osType, string osName, string computerName, int? memoryMB, int? cpuCount, LimitCpuForMigration? limitCpuForMigration, DynamicMemoryEnabled? dynamicMemoryEnabled, IsCustomizable? isCustomizable, int? dynamicMemoryMaxMB, int? dynamicMemoryMinMB, string isHighlyAvailable, int? generation, IReadOnlyList networkInterfaces, IReadOnlyList disks, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; InventoryItemId = inventoryItemId; @@ -80,6 +84,12 @@ internal ScVmmVirtualMachineTemplateData(ResourceIdentifier id, string name, Res NetworkInterfaces = networkInterfaces; Disks = disks; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScVmmVirtualMachineTemplateData() + { } /// The extended location. diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs index d43dbd0e6936..a0b48784b3d3 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmVirtualNetworkVirtualNetworksRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmVirtualNetworkVirtualNetworksRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), _scVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "ScVmmVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), _scVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "ScVmmVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _scVmmVirtualNetworkVirtualNetworksRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scVmmVirtualNetworkVirtualNetworksRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), _scVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "ScVmmVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), _scVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "ScVmmVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkData.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkData.cs index df6748d85a79..a1b3007aef2e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkData.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.ArcScVmm /// public partial class ScVmmVirtualNetworkData : TrackedResourceData { - /// Initializes a new instance of ScVmmVirtualNetworkData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The extended location. /// is null. @@ -30,7 +33,7 @@ public ScVmmVirtualNetworkData(AzureLocation location, ExtendedLocation extended ExtendedLocation = extendedLocation; } - /// Initializes a new instance of ScVmmVirtualNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +46,8 @@ public ScVmmVirtualNetworkData(AzureLocation location, ExtendedLocation extended /// ARM Id of the vmmServer resource in which this resource resides. /// Name of the virtual network in vmmServer. /// Gets or sets the provisioning state. - internal ScVmmVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string networkName, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ScVmmVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string networkName, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; InventoryItemId = inventoryItemId; @@ -51,6 +55,12 @@ internal ScVmmVirtualNetworkData(ResourceIdentifier id, string name, ResourceTyp VmmServerId = vmmServerId; NetworkName = networkName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScVmmVirtualNetworkData() + { } /// The extended location. diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs index 2405cf61fb5d..654913a1304b 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Attestation.Models /// Model factory for models. public static partial class ArmAttestationModelFactory { - /// Initializes a new instance of AttestationProviderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,10 +35,10 @@ public static AttestationProviderData AttestationProviderData(ResourceIdentifier tags ??= new Dictionary(); privateEndpointConnections ??= new List(); - return new AttestationProviderData(id, name, resourceType, systemData, tags, location, trustModel, status, attestUri, publicNetworkAccess, privateEndpointConnections?.ToList()); + return new AttestationProviderData(id, name, resourceType, systemData, tags, location, trustModel, status, attestUri, publicNetworkAccess, privateEndpointConnections?.ToList(), default); } - /// Initializes a new instance of AttestationPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,10 +49,83 @@ public static AttestationProviderData AttestationProviderData(ResourceIdentifier /// A new instance for mocking. public static AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, AttestationPrivateLinkServiceConnectionState connectionState = null, AttestationPrivateEndpointConnectionProvisioningState? provisioningState = null) { - return new AttestationPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState); + return new AttestationPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, default); } - /// Initializes a new instance of AttestationPrivateLinkResource. + /// Initializes a new instance of . + /// The supported Azure location where the attestation provider should be created. + /// The tags that will be assigned to the attestation provider. + /// Properties of the attestation provider. + /// A new instance for mocking. + public static AttestationProviderCreateOrUpdateContent AttestationProviderCreateOrUpdateContent(AzureLocation location = default, IDictionary tags = null, AttestationServiceCreationSpecificParams properties = null) + { + tags ??= new Dictionary(); + + return new AttestationProviderCreateOrUpdateContent(location, tags, properties, default); + } + + /// Initializes a new instance of . + /// + /// The "alg" (algorithm) parameter identifies the algorithm intended for + /// use with the key. The values used should either be registered in the + /// IANA "JSON Web Signature and Encryption Algorithms" registry + /// established by [JWA] or be a value that contains a Collision- + /// Resistant Name. + /// + /// The "crv" (curve) parameter identifies the curve type. + /// RSA private exponent or ECC private key. + /// RSA Private Key Parameter. + /// RSA Private Key Parameter. + /// RSA public exponent, in Base64. + /// Symmetric key. + /// + /// The "kid" (key ID) parameter is used to match a specific key. This + /// is used, for instance, to choose among a set of keys within a JWK Set + /// during key rollover. The structure of the "kid" value is + /// unspecified. When "kid" values are used within a JWK Set, different + /// keys within the JWK Set SHOULD use distinct "kid" values. (One + /// example in which different keys might use the same "kid" value is if + /// they have different "kty" (key type) values but are considered to be + /// equivalent alternatives by the application using them.) The "kid" + /// value is a case-sensitive string. + /// + /// + /// The "kty" (key type) parameter identifies the cryptographic algorithm + /// family used with the key, such as "RSA" or "EC". "kty" values should + /// either be registered in the IANA "JSON Web Key Types" registry + /// established by [JWA] or be a value that contains a Collision- + /// Resistant Name. The "kty" value is a case-sensitive string. + /// + /// RSA modulus, in Base64. + /// RSA secret prime. + /// RSA secret prime, with p < q. + /// RSA Private Key Parameter. + /// + /// Use ("public key use") identifies the intended use of + /// the public key. The "use" parameter is employed to indicate whether + /// a public key is used for encrypting data or verifying the signature + /// on data. Values are commonly "sig" (signature) or "enc" (encryption). + /// + /// X coordinate for the Elliptic Curve point. + /// + /// The "x5c" (X.509 certificate chain) parameter contains a chain of one + /// or more PKIX certificates [RFC5280]. The certificate chain is + /// represented as a JSON array of certificate value strings. Each + /// string in the array is a base64-encoded (Section 4 of [RFC4648] -- + /// not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + /// The PKIX certificate containing the key value MUST be the first + /// certificate. + /// + /// Y coordinate for the Elliptic Curve point. + /// A new instance for mocking. + public static JsonWebKey JsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, IEnumerable x5C = null, string y = null) + { + x5C ??= new List(); + + return new JsonWebKey(alg, crv, d, dp, dq, e, k, kid, kty, n, p, q, qi, use, x, x5C?.ToList(), y, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -66,7 +139,7 @@ public static AttestationPrivateLinkResource AttestationPrivateLinkResource(Reso requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new AttestationPrivateLinkResource(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new AttestationPrivateLinkResource(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs index 2ebc377e53b1..a426974a9222 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationPrivateEndpointConnectionResource(Client, AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(e)), _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AttestationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AttestationPrivateEndpointConnectionResource(Client, AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(e)), _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AttestationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAl public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationPrivateEndpointConnectionResource(Client, AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(e)), _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AttestationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AttestationPrivateEndpointConnectionResource(Client, AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(e)), _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AttestationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs index 3a4b44be6328..4b3821ead702 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.Attestation /// public partial class AttestationPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of AttestationPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestationPrivateEndpointConnectionData() { } - /// Initializes a new instance of AttestationPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public AttestationPrivateEndpointConnectionData() /// The resource of private end point. /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. - internal AttestationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, AttestationPrivateLinkServiceConnectionState connectionState, AttestationPrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, AttestationPrivateLinkServiceConnectionState connectionState, AttestationPrivateEndpointConnectionProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of private end point. diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs index c7b0acdbb667..0c5d86ae5a05 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs @@ -229,7 +229,7 @@ public virtual Response Get(string providerName, Ca public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationProviderRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), _attestationProviderClientDiagnostics, Pipeline, "AttestationProviderCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), _attestationProviderClientDiagnostics, Pipeline, "AttestationProviderCollection.GetAll", "value", null, cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationProviderRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), _attestationProviderClientDiagnostics, Pipeline, "AttestationProviderCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), _attestationProviderClientDiagnostics, Pipeline, "AttestationProviderCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs index 10a9f0dce326..ab20a40e9f16 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Attestation /// public partial class AttestationProviderData : TrackedResourceData { - /// Initializes a new instance of AttestationProviderData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AttestationProviderData(AzureLocation location) : base(location) { PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of AttestationProviderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,13 +41,20 @@ public AttestationProviderData(AzureLocation location) : base(location) /// Gets the uri of attestation service. /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. /// List of private endpoint connections associated with the attestation provider. - internal AttestationProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string trustModel, AttestationServiceStatus? status, Uri attestUri, PublicNetworkAccessType? publicNetworkAccess, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AttestationProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string trustModel, AttestationServiceStatus? status, Uri attestUri, PublicNetworkAccessType? publicNetworkAccess, IReadOnlyList privateEndpointConnections, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { TrustModel = trustModel; Status = status; AttestUri = attestUri; PublicNetworkAccess = publicNetworkAccess; PrivateEndpointConnections = privateEndpointConnections; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AttestationProviderData() + { } /// Trust model for the attestation provider. diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index feff75ddea9d..b721fb978903 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -61,7 +61,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) public virtual AsyncPageable GetAttestationProvidersAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProviders", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProviders", "value", null, cancellationToken); } /// @@ -82,7 +82,7 @@ public virtual AsyncPageable GetAttestationProvider public virtual Pageable GetAttestationProviders(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProviders", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProviders", "value", null, cancellationToken); } /// @@ -103,7 +103,7 @@ public virtual Pageable GetAttestationProviders(Can public virtual AsyncPageable GetAttestationProvidersByDefaultProviderAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); } /// @@ -124,7 +124,7 @@ public virtual AsyncPageable GetAttestationProvider public virtual Pageable GetAttestationProvidersByDefaultProvider(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); } /// diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionData.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionData.Serialization.cs index 407072e9fbd5..17c1e5e17fea 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Attestation { - public partial class AttestationPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class AttestationPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AttestationPrivateEndpointConnectionData DeserializeAttestationPrivateEndpointConnectionData(JsonElement element) + internal static AttestationPrivateEndpointConnectionData DeserializeAttestationPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +76,7 @@ internal static AttestationPrivateEndpointConnectionData DeserializeAttestationP Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static AttestationPrivateEndpointConnectionData DeserializeAttestationP } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AttestationPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new AttestationPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } 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 0757cb17a039..7abe790fdefe 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 @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationPrivateEndpointConnectionListResult + internal partial class AttestationPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AttestationPrivateEndpointConnectionListResult DeserializeAttestationPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AttestationPrivateEndpointConnectionListResult DeserializeAttestationPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static AttestationPrivateEndpointConnectionListResult DeserializeAttest value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AttestationPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new AttestationPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AttestationPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs index 1113bab96ad9..f364dcab6d5e 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Attestation; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Attestation.Models /// List of private endpoint connection associated with the specified storage account. internal partial class AttestationPrivateEndpointConnectionListResult { - /// Initializes a new instance of AttestationPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AttestationPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AttestationPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal AttestationPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. 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 538636dd923e..a87ee672dcfd 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 @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationPrivateLinkResource : IUtf8JsonSerializable + public partial class AttestationPrivateLinkResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AttestationPrivateLinkResource DeserializeAttestationPrivateLinkResource(JsonElement element) + internal static AttestationPrivateLinkResource DeserializeAttestationPrivateLinkResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static AttestationPrivateLinkResource DeserializeAttestationPrivateLink Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -117,8 +139,61 @@ internal static AttestationPrivateLinkResource DeserializeAttestationPrivateLink } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationPrivateLinkResource(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + AttestationPrivateLinkResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationPrivateLinkResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationPrivateLinkResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationPrivateLinkResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationPrivateLinkResource model) + { + if (model is null) + { + return null; } - return new AttestationPrivateLinkResource(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationPrivateLinkResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationPrivateLinkResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs index be97e0caf8ef..327eb40f096a 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,14 +15,17 @@ namespace Azure.ResourceManager.Attestation.Models /// A private link resource. public partial class AttestationPrivateLinkResource : ResourceData { - /// Initializes a new instance of AttestationPrivateLinkResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestationPrivateLinkResource() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of AttestationPrivateLinkResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,11 +33,13 @@ public AttestationPrivateLinkResource() /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. - internal AttestationPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. 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 e7228532bccf..b1208d4b1ac6 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 @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationPrivateLinkResourceListResult + internal partial class AttestationPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AttestationPrivateLinkResourceListResult DeserializeAttestationPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AttestationPrivateLinkResourceListResult DeserializeAttestationPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static AttestationPrivateLinkResourceListResult DeserializeAttestationP value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AttestationPrivateLinkResourceListResult(Optional.ToList(value)); + return new AttestationPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AttestationPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs index d5bf9c3f6a95..9f0e84ff19df 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Attestation.Models /// A list of private link resources. internal partial class AttestationPrivateLinkResourceListResult { - /// Initializes a new instance of AttestationPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AttestationPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AttestationPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal AttestationPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. 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 d24ba3767993..116bf62d3847 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 @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class AttestationPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestationPrivateLinkServiceConnectionState(JsonElement element) + internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestationPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestat Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestat actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + AttestationPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new AttestationPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs index 03428ddd967f..ba1301a3e5dd 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Attestation.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class AttestationPrivateLinkServiceConnectionState { - /// Initializes a new instance of AttestationPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestationPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of AttestationPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal AttestationPrivateLinkServiceConnectionState(AttestationPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateLinkServiceConnectionState(AttestationPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. 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 01c79e368988..4cf89a71cfd8 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 @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationProviderCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AttestationProviderCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); @@ -29,8 +37,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AttestationProviderCreateOrUpdateContent DeserializeAttestationProviderCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation location = default; + Optional> tags = default; + AttestationServiceCreationSpecificParams properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + properties = AttestationServiceCreationSpecificParams.DeserializeAttestationServiceCreationSpecificParams(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationProviderCreateOrUpdateContent(location, Optional.ToDictionary(tags), properties, serializedAdditionalRawData); + } + + AttestationProviderCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationProviderCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationProviderCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationProviderCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationProviderCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationProviderCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationProviderCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs index 963c40b3de33..9ec72c0e5b86 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Attestation.Models /// Parameters for creating an attestation provider. public partial class AttestationProviderCreateOrUpdateContent { - /// Initializes a new instance of AttestationProviderCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The supported Azure location where the attestation provider should be created. /// Properties of the attestation provider. /// is null. @@ -27,6 +30,24 @@ public AttestationProviderCreateOrUpdateContent(AzureLocation location, Attestat Properties = properties; } + /// Initializes a new instance of . + /// The supported Azure location where the attestation provider should be created. + /// The tags that will be assigned to the attestation provider. + /// Properties of the attestation provider. + /// Keeps track of any properties unknown to the library. + internal AttestationProviderCreateOrUpdateContent(AzureLocation location, IDictionary tags, AttestationServiceCreationSpecificParams properties, Dictionary serializedAdditionalRawData) + { + Location = location; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AttestationProviderCreateOrUpdateContent() + { + } + /// The supported Azure location where the attestation provider should be created. public AzureLocation Location { get; } /// The tags that will be assigned to the attestation provider. diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderData.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderData.Serialization.cs index 73c27bb94923..1942251b3939 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderData.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation { - public partial class AttestationProviderData : IUtf8JsonSerializable + public partial class AttestationProviderData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -55,11 +61,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AttestationProviderData DeserializeAttestationProviderData(JsonElement element) + internal static AttestationProviderData DeserializeAttestationProviderData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +95,7 @@ internal static AttestationProviderData DeserializeAttestationProviderData(JsonE Optional attestUri = default; Optional publicNetworkAccess = default; Optional> privateEndpointConnections = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -178,8 +199,61 @@ internal static AttestationProviderData DeserializeAttestationProviderData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationProviderData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, trustModel.Value, Optional.ToNullable(status), attestUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(privateEndpointConnections), serializedAdditionalRawData); + } + + AttestationProviderData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationProviderData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationProviderData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationProviderData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationProviderData model) + { + if (model is null) + { + return null; } - return new AttestationProviderData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, trustModel.Value, Optional.ToNullable(status), attestUri.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToList(privateEndpointConnections)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationProviderData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationProviderData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } 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 f69ccb259a30..fb4784881903 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 @@ -5,24 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Attestation; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationProviderListResult + internal partial class AttestationProviderListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AttestationProviderListResult DeserializeAttestationProviderListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AttestationProviderListResult DeserializeAttestationProviderListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional systemData = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("systemData"u8)) @@ -48,8 +93,61 @@ internal static AttestationProviderListResult DeserializeAttestationProviderList value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AttestationProviderListResult(systemData, Optional.ToList(value)); + return new AttestationProviderListResult(systemData, Optional.ToList(value), serializedAdditionalRawData); + } + + AttestationProviderListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationProviderListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationProviderListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationProviderListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationProviderListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationProviderListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationProviderListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs index e9bb52ed616a..064013e4b630 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Attestation; @@ -15,19 +16,24 @@ namespace Azure.ResourceManager.Attestation.Models /// Attestation Providers List. internal partial class AttestationProviderListResult { - /// Initializes a new instance of AttestationProviderListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AttestationProviderListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AttestationProviderListResult. + /// Initializes a new instance of . /// The system metadata relating to this resource. /// Attestation Provider array. - internal AttestationProviderListResult(SystemData systemData, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AttestationProviderListResult(SystemData systemData, IReadOnlyList value, Dictionary serializedAdditionalRawData) { SystemData = systemData; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The system metadata relating to this resource. 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 86992c0134e4..2bbcee9cf48c 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 @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationProviderPatch : IUtf8JsonSerializable + public partial class AttestationProviderPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -29,9 +37,121 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static AttestationProviderPatch DeserializeAttestationProviderPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = AttestationServicePatchSpecificParams.DeserializeAttestationServicePatchSpecificParams(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationProviderPatch(Optional.ToDictionary(tags), properties.Value, serializedAdditionalRawData); + } + + AttestationProviderPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationProviderPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationProviderPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationProviderPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationProviderPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationProviderPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationProviderPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs index cdd1211eefef..b05383170f97 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.Attestation.Models /// Parameters for patching an attestation provider. public partial class AttestationProviderPatch { - /// Initializes a new instance of AttestationProviderPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestationProviderPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The tags that will be assigned to the attestation provider. + /// Properties of the attestation provider. + /// Keeps track of any properties unknown to the library. + internal AttestationProviderPatch(IDictionary tags, AttestationServicePatchSpecificParams properties, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The tags that will be assigned to the attestation provider. public IDictionary Tags { get; } /// Properties of the attestation provider. 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 c9f5dac087b0..db57f0290c20 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 @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationServiceCreationSpecificParams : IUtf8JsonSerializable + public partial class AttestationServiceCreationSpecificParams : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PublicNetworkAccess)) { @@ -23,9 +31,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PolicySigningCertificates)) { writer.WritePropertyName("policySigningCertificates"u8); - writer.WriteObjectValue(PolicySigningCertificates); + if (PolicySigningCertificates is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PolicySigningCertificates).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static AttestationServiceCreationSpecificParams DeserializeAttestationServiceCreationSpecificParams(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional publicNetworkAccess = default; + Optional policySigningCertificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccessType(property.Value.GetString()); + continue; + } + if (property.NameEquals("policySigningCertificates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policySigningCertificates = JsonWebKeySet.DeserializeJsonWebKeySet(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationServiceCreationSpecificParams(Optional.ToNullable(publicNetworkAccess), policySigningCertificates.Value, serializedAdditionalRawData); + } + + AttestationServiceCreationSpecificParams IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationServiceCreationSpecificParams(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationServiceCreationSpecificParams IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationServiceCreationSpecificParams(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationServiceCreationSpecificParams model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationServiceCreationSpecificParams(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationServiceCreationSpecificParams(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs index 7e82316a2f37..caeba37d84b1 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Attestation.Models @@ -12,11 +13,25 @@ namespace Azure.ResourceManager.Attestation.Models /// Client supplied parameters used to create a new attestation provider. public partial class AttestationServiceCreationSpecificParams { - /// Initializes a new instance of AttestationServiceCreationSpecificParams. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestationServiceCreationSpecificParams() { } + /// Initializes a new instance of . + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. + /// JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the signing certificate used for policy operations. + /// Keeps track of any properties unknown to the library. + internal AttestationServiceCreationSpecificParams(PublicNetworkAccessType? publicNetworkAccess, JsonWebKeySet policySigningCertificates, Dictionary serializedAdditionalRawData) + { + PublicNetworkAccess = publicNetworkAccess; + PolicySigningCertificates = policySigningCertificates; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. public PublicNetworkAccessType? PublicNetworkAccess { get; set; } /// JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the signing certificate used for policy operations. 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 477a20ad34e5..60933cc3211f 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 @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationServicePatchSpecificParams : IUtf8JsonSerializable + internal partial class AttestationServicePatchSpecificParams : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AttestationServicePatchSpecificParams DeserializeAttestationServicePatchSpecificParams(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional publicNetworkAccess = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccessType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationServicePatchSpecificParams(Optional.ToNullable(publicNetworkAccess), serializedAdditionalRawData); + } + + AttestationServicePatchSpecificParams IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationServicePatchSpecificParams(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationServicePatchSpecificParams IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationServicePatchSpecificParams(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationServicePatchSpecificParams model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationServicePatchSpecificParams(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationServicePatchSpecificParams(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs index f8932c57cb4b..55e26e573aaa 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Attestation.Models { /// Client supplied parameters used to patch an existing attestation provider. internal partial class AttestationServicePatchSpecificParams { - /// Initializes a new instance of AttestationServicePatchSpecificParams. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestationServicePatchSpecificParams() { } + /// Initializes a new instance of . + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. + /// Keeps track of any properties unknown to the library. + internal AttestationServicePatchSpecificParams(PublicNetworkAccessType? publicNetworkAccess, Dictionary serializedAdditionalRawData) + { + PublicNetworkAccess = publicNetworkAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. public PublicNetworkAccessType? PublicNetworkAccess { get; set; } } 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 ee4957f397bd..7be514edbfae 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 @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - public partial class JsonWebKey : IUtf8JsonSerializable + public partial class JsonWebKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Alg)) { @@ -102,7 +110,198 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("y"u8); writer.WriteStringValue(Y); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static JsonWebKey DeserializeJsonWebKey(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional alg = default; + Optional crv = default; + Optional d = default; + Optional dp = default; + Optional dq = default; + Optional e = default; + Optional k = default; + Optional kid = default; + string kty = default; + Optional n = default; + Optional p = default; + Optional q = default; + Optional qi = default; + Optional use = default; + Optional x = default; + Optional> x5c = default; + Optional y = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("alg"u8)) + { + alg = property.Value.GetString(); + continue; + } + if (property.NameEquals("crv"u8)) + { + crv = property.Value.GetString(); + continue; + } + if (property.NameEquals("d"u8)) + { + d = property.Value.GetString(); + continue; + } + if (property.NameEquals("dp"u8)) + { + dp = property.Value.GetString(); + continue; + } + if (property.NameEquals("dq"u8)) + { + dq = property.Value.GetString(); + continue; + } + if (property.NameEquals("e"u8)) + { + e = property.Value.GetString(); + continue; + } + if (property.NameEquals("k"u8)) + { + k = property.Value.GetString(); + continue; + } + if (property.NameEquals("kid"u8)) + { + kid = property.Value.GetString(); + continue; + } + if (property.NameEquals("kty"u8)) + { + kty = property.Value.GetString(); + continue; + } + if (property.NameEquals("n"u8)) + { + n = property.Value.GetString(); + continue; + } + if (property.NameEquals("p"u8)) + { + p = property.Value.GetString(); + continue; + } + if (property.NameEquals("q"u8)) + { + q = property.Value.GetString(); + continue; + } + if (property.NameEquals("qi"u8)) + { + qi = property.Value.GetString(); + continue; + } + if (property.NameEquals("use"u8)) + { + use = property.Value.GetString(); + continue; + } + if (property.NameEquals("x"u8)) + { + x = property.Value.GetString(); + continue; + } + if (property.NameEquals("x5c"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + x5c = array; + continue; + } + if (property.NameEquals("y"u8)) + { + y = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JsonWebKey(alg.Value, crv.Value, d.Value, dp.Value, dq.Value, e.Value, k.Value, kid.Value, kty, n.Value, p.Value, q.Value, qi.Value, use.Value, x.Value, Optional.ToList(x5c), y.Value, serializedAdditionalRawData); + } + + JsonWebKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonWebKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonWebKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonWebKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonWebKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonWebKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonWebKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs index af06f4dd0e2c..6a3a0b603a06 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Attestation.Models /// The JsonWebKey. public partial class JsonWebKey { - /// Initializes a new instance of JsonWebKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// The "kty" (key type) parameter identifies the cryptographic algorithm /// family used with the key, such as "RSA" or "EC". "kty" values should @@ -31,6 +34,87 @@ public JsonWebKey(string kty) X5C = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// The "alg" (algorithm) parameter identifies the algorithm intended for + /// use with the key. The values used should either be registered in the + /// IANA "JSON Web Signature and Encryption Algorithms" registry + /// established by [JWA] or be a value that contains a Collision- + /// Resistant Name. + /// + /// The "crv" (curve) parameter identifies the curve type. + /// RSA private exponent or ECC private key. + /// RSA Private Key Parameter. + /// RSA Private Key Parameter. + /// RSA public exponent, in Base64. + /// Symmetric key. + /// + /// The "kid" (key ID) parameter is used to match a specific key. This + /// is used, for instance, to choose among a set of keys within a JWK Set + /// during key rollover. The structure of the "kid" value is + /// unspecified. When "kid" values are used within a JWK Set, different + /// keys within the JWK Set SHOULD use distinct "kid" values. (One + /// example in which different keys might use the same "kid" value is if + /// they have different "kty" (key type) values but are considered to be + /// equivalent alternatives by the application using them.) The "kid" + /// value is a case-sensitive string. + /// + /// + /// The "kty" (key type) parameter identifies the cryptographic algorithm + /// family used with the key, such as "RSA" or "EC". "kty" values should + /// either be registered in the IANA "JSON Web Key Types" registry + /// established by [JWA] or be a value that contains a Collision- + /// Resistant Name. The "kty" value is a case-sensitive string. + /// + /// RSA modulus, in Base64. + /// RSA secret prime. + /// RSA secret prime, with p < q. + /// RSA Private Key Parameter. + /// + /// Use ("public key use") identifies the intended use of + /// the public key. The "use" parameter is employed to indicate whether + /// a public key is used for encrypting data or verifying the signature + /// on data. Values are commonly "sig" (signature) or "enc" (encryption). + /// + /// X coordinate for the Elliptic Curve point. + /// + /// The "x5c" (X.509 certificate chain) parameter contains a chain of one + /// or more PKIX certificates [RFC5280]. The certificate chain is + /// represented as a JSON array of certificate value strings. Each + /// string in the array is a base64-encoded (Section 4 of [RFC4648] -- + /// not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + /// The PKIX certificate containing the key value MUST be the first + /// certificate. + /// + /// Y coordinate for the Elliptic Curve point. + /// Keeps track of any properties unknown to the library. + internal JsonWebKey(string alg, string crv, string d, string dp, string dq, string e, string k, string kid, string kty, string n, string p, string q, string qi, string use, string x, IList x5C, string y, Dictionary serializedAdditionalRawData) + { + Alg = alg; + Crv = crv; + D = d; + Dp = dp; + Dq = dq; + E = e; + K = k; + Kid = kid; + Kty = kty; + N = n; + P = p; + Q = q; + Qi = qi; + Use = use; + X = x; + X5C = x5C; + Y = y; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal JsonWebKey() + { + } + /// /// The "alg" (algorithm) parameter identifies the algorithm intended for /// use with the key. The values used should either be registered in the 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 891a73aab8d1..f7b358abc153 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 @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Attestation.Models { - internal partial class JsonWebKeySet : IUtf8JsonSerializable + internal partial class JsonWebKeySet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Keys)) { @@ -21,11 +29,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Keys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static JsonWebKeySet DeserializeJsonWebKeySet(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> keys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keys"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonWebKey.DeserializeJsonWebKey(item)); + } + keys = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JsonWebKeySet(Optional.ToList(keys), serializedAdditionalRawData); + } + + JsonWebKeySet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonWebKeySet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonWebKeySet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonWebKeySet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonWebKeySet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonWebKeySet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonWebKeySet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs index 9a840a0e920e..356904a22ba3 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.Attestation.Models /// The JsonWebKeySet. internal partial class JsonWebKeySet { - /// Initializes a new instance of JsonWebKeySet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public JsonWebKeySet() { Keys = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// The value of the "keys" parameter is an array of JWK values. By + /// default, the order of the JWK values within the array does not imply + /// an order of preference among them, although applications of JWK Sets + /// can choose to assign a meaning to the order for their purposes, if + /// desired. + /// + /// Keeps track of any properties unknown to the library. + internal JsonWebKeySet(IList keys, Dictionary serializedAdditionalRawData) + { + Keys = keys; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// /// The value of the "keys" parameter is an array of JWK values. By /// default, the order of the JWK values within the array does not imply diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs index 85464a7a8bde..364145820f22 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -224,9 +222,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index bb33f8162bf5..7bc787e3d022 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/AttestationRestClient.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/AttestationRestClient.cs index 4ef2352fb983..29e00bfa29dd 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/AttestationRestClient.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/AttestationRestClient.cs @@ -50,9 +50,7 @@ internal HttpMessage CreateAttestOpenEnclaveRequest(AttestOpenEnclaveRequest req request0.Uri = uri; request0.Headers.Add("Accept", "application/json"); request0.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(request); - request0.Content = content; + request0.Content = request; return message; } @@ -124,9 +122,7 @@ internal HttpMessage CreateAttestSgxEnclaveRequest(AttestSgxEnclaveRequest reque request0.Uri = uri; request0.Headers.Add("Accept", "application/json"); request0.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(request); - request0.Content = content; + request0.Content = request; return message; } @@ -198,9 +194,7 @@ internal HttpMessage CreateAttestTpmRequest(TpmAttestationRequest request) request0.Uri = uri; request0.Headers.Add("Accept", "application/json"); request0.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(request); - request0.Content = content; + request0.Content = request; return message; } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.Serialization.cs index b3905befa2a1..fa085360fb1d 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class AttestOpenEnclaveRequest : IUtf8JsonSerializable + internal partial class AttestOpenEnclaveRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Report)) { @@ -23,19 +31,149 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RuntimeData)) { writer.WritePropertyName("runtimeData"u8); - writer.WriteObjectValue(RuntimeData); + if (RuntimeData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RuntimeData).Serialize(writer, options); + } } if (Optional.IsDefined(InitTimeData)) { writer.WritePropertyName("initTimeData"u8); - writer.WriteObjectValue(InitTimeData); + if (InitTimeData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InitTimeData).Serialize(writer, options); + } } if (Optional.IsDefined(DraftPolicyForAttestation)) { writer.WritePropertyName("draftPolicyForAttestation"u8); writer.WriteStringValue(DraftPolicyForAttestation); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AttestOpenEnclaveRequest DeserializeAttestOpenEnclaveRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional report = default; + Optional runtimeData = default; + Optional initTimeData = default; + Optional draftPolicyForAttestation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("report"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + report = property.Value.GetBytesFromBase64("U"); + continue; + } + if (property.NameEquals("runtimeData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runtimeData = RuntimeData.DeserializeRuntimeData(property.Value); + continue; + } + if (property.NameEquals("initTimeData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initTimeData = InitTimeData.DeserializeInitTimeData(property.Value); + continue; + } + if (property.NameEquals("draftPolicyForAttestation"u8)) + { + draftPolicyForAttestation = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestOpenEnclaveRequest(report.Value, runtimeData.Value, initTimeData.Value, draftPolicyForAttestation.Value, serializedAdditionalRawData); + } + + AttestOpenEnclaveRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestOpenEnclaveRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestOpenEnclaveRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestOpenEnclaveRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestOpenEnclaveRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestOpenEnclaveRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestOpenEnclaveRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.cs index a3980692b288..2f211ba5d6a3 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestOpenEnclaveRequest.cs @@ -6,17 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Security.Attestation { /// Attestation request for Intel SGX enclaves. internal partial class AttestOpenEnclaveRequest { - /// Initializes a new instance of AttestOpenEnclaveRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestOpenEnclaveRequest() { } + /// Initializes a new instance of . + /// OpenEnclave report from the enclave to be attested. + /// Runtime data provided by the enclave at the time of report generation. The MAA will verify that the first 32 bytes of the report_data field of the quote contains the SHA256 hash of the decoded "data" field of the runtime data. + /// Base64Url encoded "InitTime data". The MAA will verify that the init data was known to the enclave. Note that InitTimeData is invalid for CoffeeLake processors. + /// Attest against the provided draft policy. Note that the resulting token cannot be validated. + /// Keeps track of any properties unknown to the library. + internal AttestOpenEnclaveRequest(byte[] report, RuntimeData runtimeData, InitTimeData initTimeData, string draftPolicyForAttestation, Dictionary serializedAdditionalRawData) + { + Report = report; + RuntimeData = runtimeData; + InitTimeData = initTimeData; + DraftPolicyForAttestation = draftPolicyForAttestation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// OpenEnclave report from the enclave to be attested. public byte[] Report { get; set; } /// Runtime data provided by the enclave at the time of report generation. The MAA will verify that the first 32 bytes of the report_data field of the quote contains the SHA256 hash of the decoded "data" field of the runtime data. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.Serialization.cs index 9c7f35aba818..9ef5d3666f77 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class AttestSgxEnclaveRequest : IUtf8JsonSerializable + internal partial class AttestSgxEnclaveRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Quote)) { @@ -23,19 +31,149 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RuntimeData)) { writer.WritePropertyName("runtimeData"u8); - writer.WriteObjectValue(RuntimeData); + if (RuntimeData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RuntimeData).Serialize(writer, options); + } } if (Optional.IsDefined(InitTimeData)) { writer.WritePropertyName("initTimeData"u8); - writer.WriteObjectValue(InitTimeData); + if (InitTimeData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InitTimeData).Serialize(writer, options); + } } if (Optional.IsDefined(DraftPolicyForAttestation)) { writer.WritePropertyName("draftPolicyForAttestation"u8); writer.WriteStringValue(DraftPolicyForAttestation); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AttestSgxEnclaveRequest DeserializeAttestSgxEnclaveRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional quote = default; + Optional runtimeData = default; + Optional initTimeData = default; + Optional draftPolicyForAttestation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("quote"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quote = property.Value.GetBytesFromBase64("U"); + continue; + } + if (property.NameEquals("runtimeData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runtimeData = RuntimeData.DeserializeRuntimeData(property.Value); + continue; + } + if (property.NameEquals("initTimeData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initTimeData = InitTimeData.DeserializeInitTimeData(property.Value); + continue; + } + if (property.NameEquals("draftPolicyForAttestation"u8)) + { + draftPolicyForAttestation = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestSgxEnclaveRequest(quote.Value, runtimeData.Value, initTimeData.Value, draftPolicyForAttestation.Value, serializedAdditionalRawData); + } + + AttestSgxEnclaveRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestSgxEnclaveRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestSgxEnclaveRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestSgxEnclaveRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestSgxEnclaveRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestSgxEnclaveRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestSgxEnclaveRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.cs index 6611572933d0..e8f0caf1aa73 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestSgxEnclaveRequest.cs @@ -6,17 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Security.Attestation { /// Attestation request for Intel SGX enclaves. internal partial class AttestSgxEnclaveRequest { - /// Initializes a new instance of AttestSgxEnclaveRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AttestSgxEnclaveRequest() { } + /// Initializes a new instance of . + /// Quote of the enclave to be attested. + /// Runtime data provided by the enclave at the time of quote generation. The MAA will verify that the first 32 bytes of the report_data field of the quote contains the SHA256 hash of the decoded "data" field of the runtime data. + /// Initialization data provided when the enclave is created. MAA will verify that the init data was known to the enclave. Note that InitTimeData is invalid for CoffeeLake processors. + /// Attest against the provided draft policy. Note that the resulting token cannot be validated. + /// Keeps track of any properties unknown to the library. + internal AttestSgxEnclaveRequest(byte[] quote, RuntimeData runtimeData, InitTimeData initTimeData, string draftPolicyForAttestation, Dictionary serializedAdditionalRawData) + { + Quote = quote; + RuntimeData = runtimeData; + InitTimeData = initTimeData; + DraftPolicyForAttestation = draftPolicyForAttestation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Quote of the enclave to be attested. public byte[] Quote { get; set; } /// Runtime data provided by the enclave at the time of quote generation. The MAA will verify that the first 32 bytes of the report_data field of the quote contains the SHA256 hash of the decoded "data" field of the runtime data. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.Serialization.cs index 3257437a60d2..52fd74c062a4 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class AttestationResponse + internal partial class AttestationResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AttestationResponse DeserializeAttestationResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Token)) + { + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AttestationResponse DeserializeAttestationResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional token = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("token"u8)) @@ -26,8 +60,61 @@ internal static AttestationResponse DeserializeAttestationResponse(JsonElement e token = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AttestationResponse(token.Value); + return new AttestationResponse(token.Value, serializedAdditionalRawData); + } + + AttestationResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.cs index e37c110c19bf..e6c7307ecccf 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The result of an attestation operation. internal partial class AttestationResponse { - /// Initializes a new instance of AttestationResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AttestationResponse() { } - /// Initializes a new instance of AttestationResponse. + /// Initializes a new instance of . /// An RFC 7519 JSON Web Token, the body of which is an AttestationResult object. - internal AttestationResponse(string token) + /// Keeps track of any properties unknown to the library. + internal AttestationResponse(string token, Dictionary serializedAdditionalRawData) { Token = token; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An RFC 7519 JSON Web Token, the body of which is an AttestationResult object. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.Serialization.cs index d042d75bbcd6..3f42c1e8890a 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.Serialization.cs @@ -6,17 +6,228 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { [JsonConverter(typeof(AttestationResultConverter))] - public partial class AttestationResult + public partial class AttestationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AttestationResult DeserializeAttestationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(InternalJti)) + { + writer.WritePropertyName("jti"u8); + writer.WriteStringValue(InternalJti); + } + if (Optional.IsDefined(InternalIss)) + { + writer.WritePropertyName("iss"u8); + writer.WriteStringValue(InternalIss); + } + if (Optional.IsDefined(InternalIat)) + { + writer.WritePropertyName("iat"u8); + writer.WriteNumberValue(InternalIat.Value); + } + if (Optional.IsDefined(InternalExp)) + { + writer.WritePropertyName("exp"u8); + writer.WriteNumberValue(InternalExp.Value); + } + if (Optional.IsDefined(InternalNbf)) + { + writer.WritePropertyName("nbf"u8); + writer.WriteNumberValue(InternalNbf.Value); + } + if (Optional.IsDefined(InternalCnf)) + { + writer.WritePropertyName("cnf"u8); + writer.WriteObjectValue(InternalCnf); + } + if (Optional.IsDefined(Nonce)) + { + writer.WritePropertyName("nonce"u8); + writer.WriteStringValue(Nonce); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("x-ms-ver"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(RuntimeClaims)) + { + writer.WritePropertyName("x-ms-runtime"u8); + writer.WriteObjectValue(RuntimeClaims); + } + if (Optional.IsDefined(InittimeClaims)) + { + writer.WritePropertyName("x-ms-inittime"u8); + writer.WriteObjectValue(InittimeClaims); + } + if (Optional.IsDefined(PolicyClaims)) + { + writer.WritePropertyName("x-ms-policy"u8); + writer.WriteObjectValue(PolicyClaims); + } + if (Optional.IsDefined(VerifierType)) + { + writer.WritePropertyName("x-ms-attestation-type"u8); + writer.WriteStringValue(VerifierType); + } + if (Optional.IsDefined(InternalPolicySigner)) + { + writer.WritePropertyName("x-ms-policy-signer"u8); + if (InternalPolicySigner is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InternalPolicySigner).Serialize(writer, options); + } + } + if (Optional.IsDefined(InternalPolicyHash)) + { + writer.WritePropertyName("x-ms-policy-hash"u8); + writer.WriteStringValue(InternalPolicyHash); + } + if (Optional.IsDefined(IsDebuggable)) + { + writer.WritePropertyName("x-ms-sgx-is-debuggable"u8); + writer.WriteBooleanValue(IsDebuggable.Value); + } + if (Optional.IsDefined(ProductId)) + { + writer.WritePropertyName("x-ms-sgx-product-id"u8); + writer.WriteNumberValue(ProductId.Value); + } + if (Optional.IsDefined(MrEnclave)) + { + writer.WritePropertyName("x-ms-sgx-mrenclave"u8); + writer.WriteStringValue(MrEnclave); + } + if (Optional.IsDefined(MrSigner)) + { + writer.WritePropertyName("x-ms-sgx-mrsigner"u8); + writer.WriteStringValue(MrSigner); + } + if (Optional.IsDefined(Svn)) + { + writer.WritePropertyName("x-ms-sgx-svn"u8); + writer.WriteNumberValue(Svn.Value); + } + if (Optional.IsDefined(InternalEnclaveHeldData)) + { + writer.WritePropertyName("x-ms-sgx-ehd"u8); + writer.WriteStringValue(InternalEnclaveHeldData); + } + if (Optional.IsDefined(SgxCollateral)) + { + writer.WritePropertyName("x-ms-sgx-collateral"u8); + writer.WriteObjectValue(SgxCollateral); + } + if (Optional.IsDefined(InternalDeprecatedVersion)) + { + writer.WritePropertyName("ver"u8); + writer.WriteStringValue(InternalDeprecatedVersion); + } + if (Optional.IsDefined(InternalDeprecatedIsDebuggable)) + { + writer.WritePropertyName("is-debuggable"u8); + writer.WriteBooleanValue(InternalDeprecatedIsDebuggable.Value); + } + if (Optional.IsDefined(InternalDeprecatedSgxCollateral)) + { + writer.WritePropertyName("maa-attestationcollateral"u8); + writer.WriteObjectValue(InternalDeprecatedSgxCollateral); + } + if (Optional.IsDefined(InternalDeprecatedEnclaveHeldData)) + { + writer.WritePropertyName("aas-ehd"u8); + writer.WriteStringValue(InternalDeprecatedEnclaveHeldData); + } + if (Optional.IsDefined(InternalDeprecatedEnclaveHeldData2)) + { + writer.WritePropertyName("maa-ehd"u8); + writer.WriteStringValue(InternalDeprecatedEnclaveHeldData2); + } + if (Optional.IsDefined(InternalDeprecatedProductId)) + { + writer.WritePropertyName("product-id"u8); + writer.WriteNumberValue(InternalDeprecatedProductId.Value); + } + if (Optional.IsDefined(InternalDeprecatedMrEnclave)) + { + writer.WritePropertyName("sgx-mrenclave"u8); + writer.WriteStringValue(InternalDeprecatedMrEnclave); + } + if (Optional.IsDefined(InternalDeprecatedMrSigner)) + { + writer.WritePropertyName("sgx-mrsigner"u8); + writer.WriteStringValue(InternalDeprecatedMrSigner); + } + if (Optional.IsDefined(InternalDeprecatedSvn)) + { + writer.WritePropertyName("svn"u8); + writer.WriteNumberValue(InternalDeprecatedSvn.Value); + } + if (Optional.IsDefined(InternalDeprecatedTee)) + { + writer.WritePropertyName("tee"u8); + writer.WriteStringValue(InternalDeprecatedTee); + } + if (Optional.IsDefined(InternalDeprecatedPolicySigner)) + { + writer.WritePropertyName("policy_signer"u8); + if (InternalDeprecatedPolicySigner is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InternalDeprecatedPolicySigner).Serialize(writer, options); + } + } + if (Optional.IsDefined(InternalDeprecatedPolicyHash)) + { + writer.WritePropertyName("policy_hash"u8); + writer.WriteStringValue(InternalDeprecatedPolicyHash); + } + if (Optional.IsDefined(InternalDeprecatedRpData)) + { + writer.WritePropertyName("rp_data"u8); + writer.WriteStringValue(InternalDeprecatedRpData); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AttestationResult DeserializeAttestationResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +266,7 @@ internal static AttestationResult DeserializeAttestationResult(JsonElement eleme Optional policySigner = default; Optional policyHash = default; Optional rpData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jti"u8)) @@ -295,15 +507,68 @@ internal static AttestationResult DeserializeAttestationResult(JsonElement eleme rpData = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AttestationResult(jti.Value, iss.Value, Optional.ToNullable(iat), Optional.ToNullable(exp), Optional.ToNullable(nbf), cnf.Value, nonce.Value, xMsVer.Value, xMsRuntime.Value, xMsInittime.Value, xMsPolicy.Value, xMsAttestationType.Value, xMsPolicySigner.Value, xMsPolicyHash.Value, Optional.ToNullable(xMsSgxIsDebuggable), Optional.ToNullable(xMsSgxProductId), xMsSgxMrenclave.Value, xMsSgxMrsigner.Value, Optional.ToNullable(xMsSgxSvn), xMsSgxEhd.Value, xMsSgxCollateral.Value, ver.Value, Optional.ToNullable(isDebuggable), maaAttestationcollateral.Value, aasEhd.Value, maaEhd.Value, Optional.ToNullable(productId), sgxMrenclave.Value, sgxMrsigner.Value, Optional.ToNullable(svn), tee.Value, policySigner.Value, policyHash.Value, rpData.Value, serializedAdditionalRawData); + } + + AttestationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AttestationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAttestationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AttestationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AttestationResult(Response response) + { + if (response is null) + { + return null; } - return new AttestationResult(jti.Value, iss.Value, Optional.ToNullable(iat), Optional.ToNullable(exp), Optional.ToNullable(nbf), cnf.Value, nonce.Value, xMsVer.Value, xMsRuntime.Value, xMsInittime.Value, xMsPolicy.Value, xMsAttestationType.Value, xMsPolicySigner.Value, xMsPolicyHash.Value, Optional.ToNullable(xMsSgxIsDebuggable), Optional.ToNullable(xMsSgxProductId), xMsSgxMrenclave.Value, xMsSgxMrsigner.Value, Optional.ToNullable(xMsSgxSvn), xMsSgxEhd.Value, xMsSgxCollateral.Value, ver.Value, Optional.ToNullable(isDebuggable), maaAttestationcollateral.Value, aasEhd.Value, maaEhd.Value, Optional.ToNullable(productId), sgxMrenclave.Value, sgxMrsigner.Value, Optional.ToNullable(svn), tee.Value, policySigner.Value, policyHash.Value, rpData.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAttestationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class AttestationResultConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, AttestationResult model, JsonSerializerOptions options) { - throw new NotImplementedException(); + writer.WriteObjectValue(model); } public override AttestationResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.cs index 1322fade4740..ab8a15827d22 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/AttestationResult.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// A Microsoft Azure Attestation response token body - the body of a response token issued by MAA. public partial class AttestationResult { - /// Initializes a new instance of AttestationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Unique Identifier for the token. /// The Principal who issued the token. /// The time at which the token was issued, in the number of seconds since 1970-01-0T00:00:00Z UTC. @@ -45,7 +51,8 @@ public partial class AttestationResult /// DEPRECATED: Private Preview version of x-ms-policy-signer. /// DEPRECATED: Private Preview version of x-ms-policy-hash. /// DEPRECATED: Private Preview version of nonce. - internal AttestationResult(string internalJti, string internalIss, double? internalIat, double? internalExp, double? internalNbf, object internalCnf, string nonce, string version, object runtimeClaims, object inittimeClaims, object policyClaims, string verifierType, JsonWebKey internalPolicySigner, string internalPolicyHash, bool? isDebuggable, float? productId, string mrEnclave, string mrSigner, float? svn, string internalEnclaveHeldData, object sgxCollateral, string internalDeprecatedVersion, bool? internalDeprecatedIsDebuggable, object internalDeprecatedSgxCollateral, string internalDeprecatedEnclaveHeldData, string internalDeprecatedEnclaveHeldData2, float? internalDeprecatedProductId, string internalDeprecatedMrEnclave, string internalDeprecatedMrSigner, float? internalDeprecatedSvn, string internalDeprecatedTee, JsonWebKey internalDeprecatedPolicySigner, string internalDeprecatedPolicyHash, string internalDeprecatedRpData) + /// Keeps track of any properties unknown to the library. + internal AttestationResult(string internalJti, string internalIss, double? internalIat, double? internalExp, double? internalNbf, object internalCnf, string nonce, string version, object runtimeClaims, object inittimeClaims, object policyClaims, string verifierType, JsonWebKey internalPolicySigner, string internalPolicyHash, bool? isDebuggable, float? productId, string mrEnclave, string mrSigner, float? svn, string internalEnclaveHeldData, object sgxCollateral, string internalDeprecatedVersion, bool? internalDeprecatedIsDebuggable, object internalDeprecatedSgxCollateral, string internalDeprecatedEnclaveHeldData, string internalDeprecatedEnclaveHeldData2, float? internalDeprecatedProductId, string internalDeprecatedMrEnclave, string internalDeprecatedMrSigner, float? internalDeprecatedSvn, string internalDeprecatedTee, JsonWebKey internalDeprecatedPolicySigner, string internalDeprecatedPolicyHash, string internalDeprecatedRpData, Dictionary serializedAdditionalRawData) { InternalJti = internalJti; InternalIss = internalIss; @@ -81,6 +88,7 @@ internal AttestationResult(string internalJti, string internalIss, double? inter InternalDeprecatedPolicySigner = internalDeprecatedPolicySigner; InternalDeprecatedPolicyHash = internalDeprecatedPolicyHash; InternalDeprecatedRpData = internalDeprecatedRpData; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Nonce input to the attestation request, if provided. public string Nonce { get; } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.Serialization.cs index 620d61e7b910..f5e1ec6f6587 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation.Models { - internal partial class CloudError + internal partial class CloudError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudError DeserializeCloudError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudError DeserializeCloudError(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -30,8 +71,61 @@ internal static CloudError DeserializeCloudError(JsonElement element) error = CloudErrorBody.DeserializeCloudErrorBody(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudError(error.Value); + return new CloudError(error.Value, serializedAdditionalRawData); + } + + CloudError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.cs index 09e1b9e96064..4cfc3ae2205f 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudError.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation.Models { /// An error response from Attestation. internal partial class CloudError { - /// Initializes a new instance of CloudError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudError() { } - /// Initializes a new instance of CloudError. + /// Initializes a new instance of . /// An error response from Attestation. - internal CloudError(CloudErrorBody error) + /// Keeps track of any properties unknown to the library. + internal CloudError(CloudErrorBody error, Dictionary serializedAdditionalRawData) { Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An error response from Attestation. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.Serialization.cs index e691377991df..21b9b866dcc8 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation.Models { - internal partial class CloudErrorBody + internal partial class CloudErrorBody : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudErrorBody DeserializeCloudErrorBody(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudErrorBody DeserializeCloudErrorBody(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -32,8 +71,61 @@ internal static CloudErrorBody DeserializeCloudErrorBody(JsonElement element) message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudErrorBody(code.Value, message.Value); + return new CloudErrorBody(code.Value, message.Value, serializedAdditionalRawData); + } + + CloudErrorBody IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudErrorBody(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudErrorBody IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudErrorBody(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudErrorBody model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudErrorBody(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudErrorBody(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.cs index 31feb1863b07..b0afab214c95 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/CloudErrorBody.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation.Models { /// An error response from Attestation. internal partial class CloudErrorBody { - /// Initializes a new instance of CloudErrorBody. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudErrorBody() { } - /// Initializes a new instance of CloudErrorBody. + /// Initializes a new instance of . /// An identifier for the error. Codes are invariant and are intended to be consumed programmatically. /// A message describing the error, intended to be suitable for displaying in a user interface. - internal CloudErrorBody(string code, string message) + /// Keeps track of any properties unknown to the library. + internal CloudErrorBody(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An identifier for the error. Codes are invariant and are intended to be consumed programmatically. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.Serialization.cs index 1c146bd7dfab..cb4264eb0620 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class InitTimeData : IUtf8JsonSerializable + internal partial class InitTimeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Data)) { @@ -25,7 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dataType"u8); writer.WriteStringValue(DataType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static InitTimeData DeserializeInitTimeData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional data = default; + Optional dataType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("data"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + data = property.Value.GetBytesFromBase64("U"); + continue; + } + if (property.NameEquals("dataType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataType = new DataType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InitTimeData(data.Value, Optional.ToNullable(dataType), serializedAdditionalRawData); + } + + InitTimeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInitTimeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InitTimeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInitTimeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InitTimeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InitTimeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInitTimeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.cs index 3dd0b83e6d8a..f4d9a25ce81b 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/InitTimeData.cs @@ -6,17 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Security.Attestation { /// Defines the "initialization time data" used to provision the attestation target for use by the MAA. internal partial class InitTimeData { - /// Initializes a new instance of InitTimeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public InitTimeData() { } + /// Initializes a new instance of . + /// UTF-8 encoded Initialization Data passed into the trusted environment when it is created. + /// The type of data contained within the "data" field. + /// Keeps track of any properties unknown to the library. + internal InitTimeData(byte[] data, DataType? dataType, Dictionary serializedAdditionalRawData) + { + Data = data; + DataType = dataType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// UTF-8 encoded Initialization Data passed into the trusted environment when it is created. public byte[] Data { get; set; } /// The type of data contained within the "data" field. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs index 335ab2447fc8..ede5af531d32 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class JsonWebKey : IUtf8JsonSerializable + internal partial class JsonWebKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Alg)) { @@ -103,11 +110,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("y"u8); writer.WriteStringValue(Y); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static JsonWebKey DeserializeJsonWebKey(JsonElement element) + internal static JsonWebKey DeserializeJsonWebKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -129,6 +150,7 @@ internal static JsonWebKey DeserializeJsonWebKey(JsonElement element) Optional x = default; Optional> x5c = default; Optional y = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("alg"u8)) @@ -225,8 +247,61 @@ internal static JsonWebKey DeserializeJsonWebKey(JsonElement element) y = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JsonWebKey(alg.Value, crv.Value, d.Value, dp.Value, dq.Value, e.Value, k.Value, kid.Value, kty, n.Value, p.Value, q.Value, qi.Value, use.Value, x.Value, Optional.ToList(x5c), y.Value, serializedAdditionalRawData); + } + + JsonWebKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonWebKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonWebKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonWebKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonWebKey model) + { + if (model is null) + { + return null; } - return new JsonWebKey(alg.Value, crv.Value, d.Value, dp.Value, dq.Value, e.Value, k.Value, kid.Value, kty, n.Value, p.Value, q.Value, qi.Value, use.Value, x.Value, Optional.ToList(x5c), y.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonWebKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonWebKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.cs index bda29e2440f6..60c87adf8b7e 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKey.cs @@ -14,7 +14,10 @@ namespace Azure.Security.Attestation /// The JsonWebKey. internal partial class JsonWebKey { - /// Initializes a new instance of JsonWebKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// The "kty" (key type) parameter identifies the cryptographic algorithm /// family used with the key, such as "RSA" or "EC". "kty" values should @@ -31,7 +34,7 @@ public JsonWebKey(string kty) X5C = new ChangeTrackingList(); } - /// Initializes a new instance of JsonWebKey. + /// Initializes a new instance of . /// /// The "alg" (algorithm) parameter identifies the algorithm intended for /// use with the key. The values used should either be registered in the @@ -84,7 +87,8 @@ public JsonWebKey(string kty) /// certificate. /// /// Y coordinate for the Elliptic Curve point. - internal JsonWebKey(string alg, string crv, string d, string dp, string dq, string e, string k, string kid, string kty, string n, string p, string q, string qi, string use, string x, IList x5C, string y) + /// Keeps track of any properties unknown to the library. + internal JsonWebKey(string alg, string crv, string d, string dp, string dq, string e, string k, string kid, string kty, string n, string p, string q, string qi, string use, string x, IList x5C, string y, Dictionary serializedAdditionalRawData) { Alg = alg; Crv = crv; @@ -103,6 +107,12 @@ internal JsonWebKey(string alg, string crv, string d, string dp, string dq, stri X = x; X5C = x5C; Y = y; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal JsonWebKey() + { } /// diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs index 512009479732..7282796d995b 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class JsonWebKeySet + internal partial class JsonWebKeySet : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JsonWebKeySet DeserializeJsonWebKeySet(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Keys)) + { + writer.WritePropertyName("keys"u8); + writer.WriteStartArray(); + foreach (var item in Keys) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JsonWebKeySet DeserializeJsonWebKeySet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> keys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keys"u8)) @@ -36,8 +81,61 @@ internal static JsonWebKeySet DeserializeJsonWebKeySet(JsonElement element) keys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new JsonWebKeySet(Optional.ToList(keys)); + return new JsonWebKeySet(Optional.ToList(keys), serializedAdditionalRawData); + } + + JsonWebKeySet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonWebKeySet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonWebKeySet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonWebKeySet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonWebKeySet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonWebKeySet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonWebKeySet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.cs index 0c6d4533d07d..20e87f0a06e9 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/JsonWebKeySet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.Security.Attestation /// The JsonWebKeySet. internal partial class JsonWebKeySet { - /// Initializes a new instance of JsonWebKeySet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal JsonWebKeySet() { Keys = new ChangeTrackingList(); } - /// Initializes a new instance of JsonWebKeySet. + /// Initializes a new instance of . /// /// The value of the "keys" parameter is an array of JWK values. By /// default, the order of the JWK values within the array does not imply @@ -27,9 +31,11 @@ internal JsonWebKeySet() /// can choose to assign a meaning to the order for their purposes, if /// desired. /// - internal JsonWebKeySet(IReadOnlyList keys) + /// Keeps track of any properties unknown to the library. + internal JsonWebKeySet(IReadOnlyList keys, Dictionary serializedAdditionalRawData) { Keys = keys; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.Serialization.cs index a05dac03bf62..2cd9d65f5b54 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.Serialization.cs @@ -6,33 +6,62 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { [JsonConverter(typeof(PolicyCertificateModificationConverter))] - internal partial class PolicyCertificateModification : IUtf8JsonSerializable + internal partial class PolicyCertificateModification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InternalPolicyCertificate)) { writer.WritePropertyName("policyCertificate"u8); - writer.WriteObjectValue(InternalPolicyCertificate); + if (InternalPolicyCertificate is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InternalPolicyCertificate).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PolicyCertificateModification DeserializePolicyCertificateModification(JsonElement element) + internal static PolicyCertificateModification DeserializePolicyCertificateModification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional policyCertificate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("policyCertificate"u8)) @@ -44,8 +73,61 @@ internal static PolicyCertificateModification DeserializePolicyCertificateModifi policyCertificate = JsonWebKey.DeserializeJsonWebKey(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PolicyCertificateModification(policyCertificate.Value, serializedAdditionalRawData); + } + + PolicyCertificateModification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyCertificateModification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyCertificateModification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyCertificateModification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyCertificateModification model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyCertificateModification(Response response) + { + if (response is null) + { + return null; } - return new PolicyCertificateModification(policyCertificate.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyCertificateModification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class PolicyCertificateModificationConverter : JsonConverter diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.cs index 41ff8f8bc6a4..6097451cb207 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificateModification.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The body of the JWT used for the PolicyCertificates APIs. internal partial class PolicyCertificateModification { - /// Initializes a new instance of PolicyCertificateModification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PolicyCertificateModification() { } - /// Initializes a new instance of PolicyCertificateModification. + /// Initializes a new instance of . /// RFC 7517 Json Web Key describing the certificate. - internal PolicyCertificateModification(JsonWebKey internalPolicyCertificate) + /// Keeps track of any properties unknown to the library. + internal PolicyCertificateModification(JsonWebKey internalPolicyCertificate, Dictionary serializedAdditionalRawData) { InternalPolicyCertificate = internalPolicyCertificate; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.Serialization.cs index 41e6631f81de..cf77780594b2 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { [JsonConverter(typeof(PolicyCertificatesModificationResultConverter))] - public partial class PolicyCertificatesModificationResult : IUtf8JsonSerializable + public partial class PolicyCertificatesModificationResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CertificateThumbprint)) { @@ -28,17 +35,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("x-ms-policycertificates-result"u8); writer.WriteStringValue(CertificateResolution.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PolicyCertificatesModificationResult DeserializePolicyCertificatesModificationResult(JsonElement element) + internal static PolicyCertificatesModificationResult DeserializePolicyCertificatesModificationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional xMsCertificateThumbprint = default; Optional xMsPolicycertificatesResult = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("x-ms-certificate-thumbprint"u8)) @@ -55,8 +77,61 @@ internal static PolicyCertificatesModificationResult DeserializePolicyCertificat xMsPolicycertificatesResult = new PolicyCertificateResolution(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PolicyCertificatesModificationResult(xMsCertificateThumbprint.Value, Optional.ToNullable(xMsPolicycertificatesResult), serializedAdditionalRawData); + } + + PolicyCertificatesModificationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyCertificatesModificationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyCertificatesModificationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyCertificatesModificationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyCertificatesModificationResult model) + { + if (model is null) + { + return null; } - return new PolicyCertificatesModificationResult(xMsCertificateThumbprint.Value, Optional.ToNullable(xMsPolicycertificatesResult)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyCertificatesModificationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyCertificatesModificationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class PolicyCertificatesModificationResultConverter : JsonConverter diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.cs index aa0ae8562913..6a03472e1771 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModificationResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The result of a policy certificate modification. public partial class PolicyCertificatesModificationResult { - /// Initializes a new instance of PolicyCertificatesModificationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PolicyCertificatesModificationResult() { } - /// Initializes a new instance of PolicyCertificatesModificationResult. + /// Initializes a new instance of . /// Hex encoded SHA1 Hash of the binary representation certificate which was added or removed. /// The result of the operation. - internal PolicyCertificatesModificationResult(string certificateThumbprint, PolicyCertificateResolution? certificateResolution) + /// Keeps track of any properties unknown to the library. + internal PolicyCertificatesModificationResult(string certificateThumbprint, PolicyCertificateResolution? certificateResolution, Dictionary serializedAdditionalRawData) { CertificateThumbprint = certificateThumbprint; CertificateResolution = certificateResolution; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Hex encoded SHA1 Hash of the binary representation certificate which was added or removed. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.Serialization.cs index 281b8ac0ca00..3964b2bb2788 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class PolicyCertificatesModifyResponse + internal partial class PolicyCertificatesModifyResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyCertificatesModifyResponse DeserializePolicyCertificatesModifyResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Token)) + { + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyCertificatesModifyResponse DeserializePolicyCertificatesModifyResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional token = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("token"u8)) @@ -26,8 +60,61 @@ internal static PolicyCertificatesModifyResponse DeserializePolicyCertificatesMo token = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyCertificatesModifyResponse(token.Value); + return new PolicyCertificatesModifyResponse(token.Value, serializedAdditionalRawData); + } + + PolicyCertificatesModifyResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyCertificatesModifyResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyCertificatesModifyResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyCertificatesModifyResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyCertificatesModifyResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyCertificatesModifyResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyCertificatesModifyResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.cs index cba9ab96a687..d6dfb23e6c58 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesModifyResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The response to an attestation policy management API. internal partial class PolicyCertificatesModifyResponse { - /// Initializes a new instance of PolicyCertificatesModifyResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PolicyCertificatesModifyResponse() { } - /// Initializes a new instance of PolicyCertificatesModifyResponse. + /// Initializes a new instance of . /// An RFC7519 JSON Web Token structure whose body is a PolicyCertificatesModificationResult object. - internal PolicyCertificatesModifyResponse(string token) + /// Keeps track of any properties unknown to the library. + internal PolicyCertificatesModifyResponse(string token, Dictionary serializedAdditionalRawData) { Token = token; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An RFC7519 JSON Web Token structure whose body is a PolicyCertificatesModificationResult object. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.Serialization.cs index f20753e28810..9a16249eee22 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class PolicyCertificatesResponse + internal partial class PolicyCertificatesResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyCertificatesResponse DeserializePolicyCertificatesResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Token)) + { + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyCertificatesResponse DeserializePolicyCertificatesResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional token = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("token"u8)) @@ -26,8 +60,61 @@ internal static PolicyCertificatesResponse DeserializePolicyCertificatesResponse token = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyCertificatesResponse(token.Value); + return new PolicyCertificatesResponse(token.Value, serializedAdditionalRawData); + } + + PolicyCertificatesResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyCertificatesResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyCertificatesResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyCertificatesResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyCertificatesResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyCertificatesResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyCertificatesResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.cs index 8cfc4c4dcd46..a11ffcd9adc1 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The response to an attestation policy management API. internal partial class PolicyCertificatesResponse { - /// Initializes a new instance of PolicyCertificatesResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PolicyCertificatesResponse() { } - /// Initializes a new instance of PolicyCertificatesResponse. + /// Initializes a new instance of . /// An RFC7519 JSON Web Token structure containing a PolicyCertificatesResults object which contains the certificates used to validate policy changes. - internal PolicyCertificatesResponse(string token) + /// Keeps track of any properties unknown to the library. + internal PolicyCertificatesResponse(string token, Dictionary serializedAdditionalRawData) { Token = token; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An RFC7519 JSON Web Token structure containing a PolicyCertificatesResults object which contains the certificates used to validate policy changes. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.Serialization.cs index 8017ed0ba791..ef37b1384a64 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.Serialization.cs @@ -6,22 +6,62 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { [JsonConverter(typeof(PolicyCertificatesResultConverter))] - internal partial class PolicyCertificatesResult + internal partial class PolicyCertificatesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyCertificatesResult DeserializePolicyCertificatesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(InternalPolicyCertificates)) + { + writer.WritePropertyName("x-ms-policy-certificates"u8); + if (InternalPolicyCertificates is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InternalPolicyCertificates).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyCertificatesResult DeserializePolicyCertificatesResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional xMsPolicyCertificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("x-ms-policy-certificates"u8)) @@ -33,15 +73,68 @@ internal static PolicyCertificatesResult DeserializePolicyCertificatesResult(Jso xMsPolicyCertificates = JsonWebKeySet.DeserializeJsonWebKeySet(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyCertificatesResult(xMsPolicyCertificates.Value); + return new PolicyCertificatesResult(xMsPolicyCertificates.Value, serializedAdditionalRawData); + } + + PolicyCertificatesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyCertificatesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyCertificatesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyCertificatesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyCertificatesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyCertificatesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyCertificatesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class PolicyCertificatesResultConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, PolicyCertificatesResult model, JsonSerializerOptions options) { - throw new NotImplementedException(); + writer.WriteObjectValue(model); } public override PolicyCertificatesResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.cs index 6fc7bd0ab444..08f915beea4a 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyCertificatesResult.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The result of a call to retrieve policy certificates. internal partial class PolicyCertificatesResult { - /// Initializes a new instance of PolicyCertificatesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// SHA256 Hash of the binary representation certificate which was added or removed. - internal PolicyCertificatesResult(JsonWebKeySet internalPolicyCertificates) + /// Keeps track of any properties unknown to the library. + internal PolicyCertificatesResult(JsonWebKeySet internalPolicyCertificates, Dictionary serializedAdditionalRawData) { InternalPolicyCertificates = internalPolicyCertificates; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.Serialization.cs index 7876a3b8f584..5aa1a77c146d 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.Serialization.cs @@ -6,17 +6,71 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { [JsonConverter(typeof(PolicyModificationResultConverter))] - public partial class PolicyModificationResult + public partial class PolicyModificationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyModificationResult DeserializePolicyModificationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PolicyResolution)) + { + writer.WritePropertyName("x-ms-policy-result"u8); + writer.WriteStringValue(PolicyResolution.ToString()); + } + if (Optional.IsDefined(BasePolicyTokenHash)) + { + writer.WritePropertyName("x-ms-policy-token-hash"u8); + writer.WriteStringValue(BasePolicyTokenHash); + } + if (Optional.IsDefined(BasePolicySigner)) + { + writer.WritePropertyName("x-ms-policy-signer"u8); + if (BasePolicySigner is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BasePolicySigner).Serialize(writer, options); + } + } + if (Optional.IsDefined(BasePolicy)) + { + writer.WritePropertyName("x-ms-policy"u8); + writer.WriteStringValue(BasePolicy); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyModificationResult DeserializePolicyModificationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +79,7 @@ internal static PolicyModificationResult DeserializePolicyModificationResult(Jso Optional xMsPolicyTokenHash = default; Optional xMsPolicySigner = default; Optional xMsPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("x-ms-policy-result"u8)) @@ -55,15 +110,68 @@ internal static PolicyModificationResult DeserializePolicyModificationResult(Jso xMsPolicy = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyModificationResult(xMsPolicyResult, xMsPolicyTokenHash.Value, xMsPolicySigner.Value, xMsPolicy.Value); + return new PolicyModificationResult(xMsPolicyResult, xMsPolicyTokenHash.Value, xMsPolicySigner.Value, xMsPolicy.Value, serializedAdditionalRawData); + } + + PolicyModificationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyModificationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyModificationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyModificationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyModificationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyModificationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyModificationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class PolicyModificationResultConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, PolicyModificationResult model, JsonSerializerOptions options) { - throw new NotImplementedException(); + writer.WriteObjectValue(model); } public override PolicyModificationResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.cs index 424d0bbf25d1..6765e2b51450 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyModificationResult.cs @@ -5,22 +5,30 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The result of a policy certificate modification. public partial class PolicyModificationResult { - /// Initializes a new instance of PolicyModificationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The result of the operation. /// The SHA256 hash of the policy object modified. /// The certificate used to sign the policy object, if specified. /// A JSON Web Token containing a StoredAttestationPolicy object with the attestation policy. - internal PolicyModificationResult(PolicyModification policyResolution, string basePolicyTokenHash, JsonWebKey basePolicySigner, string basePolicy) + /// Keeps track of any properties unknown to the library. + internal PolicyModificationResult(PolicyModification policyResolution, string basePolicyTokenHash, JsonWebKey basePolicySigner, string basePolicy, Dictionary serializedAdditionalRawData) { PolicyResolution = policyResolution; BasePolicyTokenHash = basePolicyTokenHash; BasePolicySigner = basePolicySigner; BasePolicy = basePolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.Serialization.cs index 226a1e4facd7..e25284b942d8 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class PolicyResponse + internal partial class PolicyResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyResponse DeserializePolicyResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Token)) + { + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyResponse DeserializePolicyResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional token = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("token"u8)) @@ -26,8 +60,61 @@ internal static PolicyResponse DeserializePolicyResponse(JsonElement element) token = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyResponse(token.Value); + return new PolicyResponse(token.Value, serializedAdditionalRawData); + } + + PolicyResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.cs index 7d47e4795d07..ed3466f385b6 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/PolicyResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The response to an attestation policy operation. internal partial class PolicyResponse { - /// Initializes a new instance of PolicyResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PolicyResponse() { } - /// Initializes a new instance of PolicyResponse. + /// Initializes a new instance of . /// An RFC7519 JSON Web Token structure whose body is an PolicyResult object. - internal PolicyResponse(string token) + /// Keeps track of any properties unknown to the library. + internal PolicyResponse(string token, Dictionary serializedAdditionalRawData) { Token = token; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An RFC7519 JSON Web Token structure whose body is an PolicyResult object. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.Serialization.cs index d2fdfaa0bbfd..7df1990979fe 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - internal partial class RuntimeData : IUtf8JsonSerializable + internal partial class RuntimeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Data)) { @@ -25,7 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dataType"u8); writer.WriteStringValue(DataType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RuntimeData DeserializeRuntimeData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional data = default; + Optional dataType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("data"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + data = property.Value.GetBytesFromBase64("U"); + continue; + } + if (property.NameEquals("dataType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataType = new DataType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RuntimeData(data.Value, Optional.ToNullable(dataType), serializedAdditionalRawData); + } + + RuntimeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRuntimeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RuntimeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRuntimeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RuntimeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RuntimeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRuntimeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.cs index 6d55b61f2a8e..792dd54f76fb 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/RuntimeData.cs @@ -6,17 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Security.Attestation { /// Defines the "run time data" provided by the attestation target for use by the MAA. internal partial class RuntimeData { - /// Initializes a new instance of RuntimeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RuntimeData() { } + /// Initializes a new instance of . + /// UTF-8 encoded Runtime Data generated by the trusted environment. + /// The type of data contained within the "data" field. + /// Keeps track of any properties unknown to the library. + internal RuntimeData(byte[] data, DataType? dataType, Dictionary serializedAdditionalRawData) + { + Data = data; + DataType = dataType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// UTF-8 encoded Runtime Data generated by the trusted environment. public byte[] Data { get; set; } /// The type of data contained within the "data" field. diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/StoredAttestationPolicy.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/StoredAttestationPolicy.cs index 187867151950..28efd847f013 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/StoredAttestationPolicy.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/StoredAttestationPolicy.cs @@ -5,10 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// The StoredAttestationPolicy. public partial class StoredAttestationPolicy { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Policy text to set as a sequence of UTF-8 encoded octets. + /// Keeps track of any properties unknown to the library. + internal StoredAttestationPolicy(string attestationPolicy, Dictionary serializedAdditionalRawData) + { + AttestationPolicy = attestationPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.Serialization.cs index 9d83ad95ebba..40546359d1fd 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - public partial class TpmAttestationRequest : IUtf8JsonSerializable + public partial class TpmAttestationRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InternalData)) { writer.WritePropertyName("data"u8); writer.WriteStringValue(InternalData); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TpmAttestationRequest DeserializeTpmAttestationRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("data"u8)) + { + data = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TpmAttestationRequest(data.Value, serializedAdditionalRawData); + } + + TpmAttestationRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTpmAttestationRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TpmAttestationRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTpmAttestationRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TpmAttestationRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TpmAttestationRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTpmAttestationRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.cs index 8e2ca2f54f07..6c4c19dfd3e6 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationRequest.cs @@ -5,14 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// Attestation request for Trusted Platform Module (TPM) attestation. public partial class TpmAttestationRequest { - /// Initializes a new instance of TpmAttestationRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TpmAttestationRequest() { } + + /// Initializes a new instance of . + /// Protocol data containing artifacts for attestation. + /// Keeps track of any properties unknown to the library. + internal TpmAttestationRequest(string internalData, Dictionary serializedAdditionalRawData) + { + InternalData = internalData; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.Serialization.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.Serialization.cs index 8028eae35856..601a7827012e 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.Serialization.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Security.Attestation { - public partial class TpmAttestationResponse + public partial class TpmAttestationResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TpmAttestationResponse DeserializeTpmAttestationResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(InternalData)) + { + writer.WritePropertyName("data"u8); + writer.WriteStringValue(InternalData); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TpmAttestationResponse DeserializeTpmAttestationResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("data"u8)) @@ -26,8 +60,61 @@ internal static TpmAttestationResponse DeserializeTpmAttestationResponse(JsonEle data = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TpmAttestationResponse(data.Value); + return new TpmAttestationResponse(data.Value, serializedAdditionalRawData); + } + + TpmAttestationResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTpmAttestationResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TpmAttestationResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTpmAttestationResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TpmAttestationResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TpmAttestationResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTpmAttestationResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.cs index 711c50351d64..3e67e7a5f534 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/Models/TpmAttestationResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Security.Attestation { /// Attestation response for Trusted Platform Module (TPM) attestation. public partial class TpmAttestationResponse { - /// Initializes a new instance of TpmAttestationResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TpmAttestationResponse() { } - /// Initializes a new instance of TpmAttestationResponse. + /// Initializes a new instance of . /// Protocol data containing attestation service response. - internal TpmAttestationResponse(string internalData) + /// Keeps track of any properties unknown to the library. + internal TpmAttestationResponse(string internalData, Dictionary serializedAdditionalRawData) { InternalData = internalData; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/attestation/Azure.Security.Attestation/src/Generated/SecurityAttestationModelFactory.cs b/sdk/attestation/Azure.Security.Attestation/src/Generated/SecurityAttestationModelFactory.cs new file mode 100644 index 000000000000..3aed70bc6a2e --- /dev/null +++ b/sdk/attestation/Azure.Security.Attestation/src/Generated/SecurityAttestationModelFactory.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Security.Attestation; + +namespace Azure.Security.Attestation.Models +{ + /// Model factory for models. + public static partial class SecurityAttestationModelFactory + { + /// Initializes a new instance of . + /// Policy text to set as a sequence of UTF-8 encoded octets. + /// A new instance for mocking. + public static StoredAttestationPolicy StoredAttestationPolicy(string attestationPolicy = null) + { + return new StoredAttestationPolicy(attestationPolicy, default); + } + } +} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/ArmAuthorizationModelFactory.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/ArmAuthorizationModelFactory.cs index 296e8ba06c10..d0065a89c729 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/ArmAuthorizationModelFactory.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/ArmAuthorizationModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Authorization.Models /// Model factory for models. public static partial class ArmAuthorizationModelFactory { - /// Initializes a new instance of AuthorizationClassicAdministrator. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -27,10 +27,10 @@ public static partial class ArmAuthorizationModelFactory /// A new instance for mocking. public static AuthorizationClassicAdministrator AuthorizationClassicAdministrator(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string emailAddress = null, string role = null) { - return new AuthorizationClassicAdministrator(id, name, resourceType, systemData, emailAddress, role); + return new AuthorizationClassicAdministrator(id, name, resourceType, systemData, emailAddress, role, default); } - /// Initializes a new instance of DenyAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,10 +50,10 @@ public static DenyAssignmentData DenyAssignmentData(ResourceIdentifier id = null principals ??= new List(); excludePrincipals ??= new List(); - return new DenyAssignmentData(id, name, resourceType, systemData, denyAssignmentName, description, permissions?.ToList(), scope, isAppliedToChildScopes, principals?.ToList(), excludePrincipals?.ToList(), isSystemProtected); + return new DenyAssignmentData(id, name, resourceType, systemData, denyAssignmentName, description, permissions?.ToList(), scope, isAppliedToChildScopes, principals?.ToList(), excludePrincipals?.ToList(), isSystemProtected, default); } - /// Initializes a new instance of DenyAssignmentPermission. + /// Initializes a new instance of . /// Actions to which the deny assignment does not grant access. /// Actions to exclude from that the deny assignment does not grant access. /// Data actions to which the deny assignment does not grant access. @@ -68,10 +68,10 @@ public static DenyAssignmentPermission DenyAssignmentPermission(IEnumerable(); notDataActions ??= new List(); - return new DenyAssignmentPermission(actions?.ToList(), notActions?.ToList(), dataActions?.ToList(), notDataActions?.ToList(), condition, conditionVersion); + return new DenyAssignmentPermission(actions?.ToList(), notActions?.ToList(), dataActions?.ToList(), notDataActions?.ToList(), condition, conditionVersion, default); } - /// Initializes a new instance of RoleManagementPrincipal. + /// Initializes a new instance of . /// The id of the principal made changes. /// The name of the principal made changes. /// Type of the principal. @@ -79,10 +79,10 @@ public static DenyAssignmentPermission DenyAssignmentPermission(IEnumerable A new instance for mocking. public static RoleManagementPrincipal RoleManagementPrincipal(string id = null, string displayName = null, RoleManagementPrincipalType? principalType = null, string email = null) { - return new RoleManagementPrincipal(id, displayName, principalType, email); + return new RoleManagementPrincipal(id, displayName, principalType, email, default); } - /// Initializes a new instance of AuthorizationProviderOperationsMetadataData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -96,10 +96,10 @@ public static AuthorizationProviderOperationsMetadataData AuthorizationProviderO resourceTypes ??= new List(); operations ??= new List(); - return new AuthorizationProviderOperationsMetadataData(id, name, resourceType, systemData, displayName, resourceTypes?.ToList(), operations?.ToList()); + return new AuthorizationProviderOperationsMetadataData(id, name, resourceType, systemData, displayName, resourceTypes?.ToList(), operations?.ToList(), default); } - /// Initializes a new instance of AuthorizationProviderResourceType. + /// Initializes a new instance of . /// The resource type name. /// The resource type display name. /// The resource type operations. @@ -108,10 +108,10 @@ public static AuthorizationProviderResourceType AuthorizationProviderResourceTyp { operations ??= new List(); - return new AuthorizationProviderResourceType(name, displayName, operations?.ToList()); + return new AuthorizationProviderResourceType(name, displayName, operations?.ToList(), default); } - /// Initializes a new instance of AuthorizationProviderOperationInfo. + /// Initializes a new instance of . /// The operation name. /// The operation display name. /// The operation description. @@ -121,10 +121,10 @@ public static AuthorizationProviderResourceType AuthorizationProviderResourceTyp /// A new instance for mocking. public static AuthorizationProviderOperationInfo AuthorizationProviderOperationInfo(string name = null, string displayName = null, string description = null, string origin = null, BinaryData properties = null, bool? isDataAction = null) { - return new AuthorizationProviderOperationInfo(name, displayName, description, origin, properties, isDataAction); + return new AuthorizationProviderOperationInfo(name, displayName, description, origin, properties, isDataAction, default); } - /// Initializes a new instance of RoleAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -144,10 +144,29 @@ public static AuthorizationProviderOperationInfo AuthorizationProviderOperationI /// A new instance for mocking. public static RoleAssignmentData RoleAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, string description = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, string createdBy = null, string updatedBy = null, ResourceIdentifier delegatedManagedIdentityResourceId = null) { - return new RoleAssignmentData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, description, condition, conditionVersion, createdOn, updatedOn, createdBy, updatedBy, delegatedManagedIdentityResourceId); + return new RoleAssignmentData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, description, condition, conditionVersion, createdOn, updatedOn, createdBy, updatedBy, delegatedManagedIdentityResourceId, default); } - /// Initializes a new instance of AuthorizationRoleDefinitionData. + /// Initializes a new instance of . + /// The role assignment scope. + /// The role definition ID. + /// The principal ID. + /// The principal type of the assigned principal ID. + /// Description of role assignment. + /// The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'. + /// Version of the condition. Currently the only accepted value is '2.0'. + /// Time it was created. + /// Time it was updated. + /// Id of the user who created the assignment. + /// Id of the user who updated the assignment. + /// Id of the delegated managed identity resource. + /// A new instance for mocking. + public static RoleAssignmentCreateOrUpdateContent RoleAssignmentCreateOrUpdateContent(string scope = null, ResourceIdentifier roleDefinitionId = null, Guid principalId = default, RoleManagementPrincipalType? principalType = null, string description = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, string createdBy = null, string updatedBy = null, ResourceIdentifier delegatedManagedIdentityResourceId = null) + { + return new RoleAssignmentCreateOrUpdateContent(scope, roleDefinitionId, principalId, principalType, description, condition, conditionVersion, createdOn, updatedOn, createdBy, updatedBy, delegatedManagedIdentityResourceId, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -163,20 +182,20 @@ public static AuthorizationRoleDefinitionData AuthorizationRoleDefinitionData(Re permissions ??= new List(); assignableScopes ??= new List(); - return new AuthorizationRoleDefinitionData(id, name, resourceType, systemData, roleName, description, roleType, permissions?.ToList(), assignableScopes?.ToList()); + return new AuthorizationRoleDefinitionData(id, name, resourceType, systemData, roleName, description, roleType, permissions?.ToList(), assignableScopes?.ToList(), default); } - /// Initializes a new instance of EligibleChildResource. + /// Initializes a new instance of . /// The resource scope Id. /// The resource name. /// The resource type. /// A new instance for mocking. public static EligibleChildResource EligibleChildResource(string id = null, string name = null, string resourceType = null) { - return new EligibleChildResource(id, name, resourceType); + return new EligibleChildResource(id, name, resourceType, default); } - /// Initializes a new instance of RoleAssignmentScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -200,10 +219,10 @@ public static EligibleChildResource EligibleChildResource(string id = null, stri /// A new instance for mocking. public static RoleAssignmentScheduleData RoleAssignmentScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, ResourceIdentifier roleAssignmentScheduleRequestId = null, ResourceIdentifier linkedRoleEligibilityScheduleId = null, RoleAssignmentScheduleAssignmentType? assignmentType = null, RoleManagementScheduleMemberType? memberType = null, RoleManagementScheduleStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, RoleManagementExpandedProperties expandedProperties = null) { - return new RoleAssignmentScheduleData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleAssignmentScheduleRequestId, linkedRoleEligibilityScheduleId, assignmentType, memberType, status, startOn, endOn, condition, conditionVersion, createdOn, updatedOn, expandedProperties); + return new RoleAssignmentScheduleData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleAssignmentScheduleRequestId, linkedRoleEligibilityScheduleId, assignmentType, memberType, status, startOn, endOn, condition, conditionVersion, createdOn, updatedOn, expandedProperties, default); } - /// Initializes a new instance of RoleManagementExpandedProperties. + /// Initializes a new instance of . /// Id of the principal. /// Display name of the principal. /// Email id of the principal. @@ -217,10 +236,10 @@ public static RoleAssignmentScheduleData RoleAssignmentScheduleData(ResourceIden /// A new instance for mocking. public static RoleManagementExpandedProperties RoleManagementExpandedProperties(Guid? principalId = null, string principalDisplayName = null, string email = null, RoleManagementPrincipalType? principalType = null, ResourceIdentifier roleDefinitionId = null, string roleDefinitionDisplayName = null, AuthorizationRoleType? roleType = null, ResourceIdentifier scopeId = null, string scopeDisplayName = null, RoleManagementScopeType? scopeType = null) { - return new RoleManagementExpandedProperties(principalId, principalDisplayName, email, principalType, roleDefinitionId, roleDefinitionDisplayName, roleType, scopeId, scopeDisplayName, scopeType); + return new RoleManagementExpandedProperties(principalId, principalDisplayName, email, principalType, roleDefinitionId, roleDefinitionDisplayName, roleType, scopeId, scopeDisplayName, scopeType, default); } - /// Initializes a new instance of RoleAssignmentScheduleInstanceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -245,10 +264,10 @@ public static RoleManagementExpandedProperties RoleManagementExpandedProperties( /// A new instance for mocking. public static RoleAssignmentScheduleInstanceData RoleAssignmentScheduleInstanceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, ResourceIdentifier roleAssignmentScheduleId = null, ResourceIdentifier originRoleAssignmentId = null, RoleManagementScheduleStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, ResourceIdentifier linkedRoleEligibilityScheduleId = null, ResourceIdentifier linkedRoleEligibilityScheduleInstanceId = null, RoleAssignmentScheduleAssignmentType? assignmentType = null, RoleManagementScheduleMemberType? memberType = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, RoleManagementExpandedProperties expandedProperties = null) { - return new RoleAssignmentScheduleInstanceData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleAssignmentScheduleId, originRoleAssignmentId, status, startOn, endOn, linkedRoleEligibilityScheduleId, linkedRoleEligibilityScheduleInstanceId, assignmentType, memberType, condition, conditionVersion, createdOn, expandedProperties); + return new RoleAssignmentScheduleInstanceData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleAssignmentScheduleId, originRoleAssignmentId, status, startOn, endOn, linkedRoleEligibilityScheduleId, linkedRoleEligibilityScheduleInstanceId, assignmentType, memberType, condition, conditionVersion, createdOn, expandedProperties, default); } - /// Initializes a new instance of RoleAssignmentScheduleRequestData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -277,10 +296,10 @@ public static RoleAssignmentScheduleInstanceData RoleAssignmentScheduleInstanceD /// A new instance for mocking. public static RoleAssignmentScheduleRequestData RoleAssignmentScheduleRequestData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, RoleManagementScheduleRequestType? requestType = null, RoleManagementScheduleStatus? status = null, string approvalId = null, ResourceIdentifier targetRoleAssignmentScheduleId = null, ResourceIdentifier targetRoleAssignmentScheduleInstanceId = null, ResourceIdentifier linkedRoleEligibilityScheduleId = null, string justification = null, RoleAssignmentScheduleTicketInfo ticketInfo = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, Guid? requestorId = null, RoleManagementExpandedProperties expandedProperties = null, DateTimeOffset? startOn = null, RoleManagementScheduleExpirationType? expirationType = null, DateTimeOffset? endOn = null, TimeSpan? duration = null) { - return new RoleAssignmentScheduleRequestData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, requestType, status, approvalId, targetRoleAssignmentScheduleId, targetRoleAssignmentScheduleInstanceId, linkedRoleEligibilityScheduleId, justification, ticketInfo, condition, conditionVersion, createdOn, requestorId, expandedProperties, startOn, expirationType, endOn, duration); + return new RoleAssignmentScheduleRequestData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, requestType, status, approvalId, targetRoleAssignmentScheduleId, targetRoleAssignmentScheduleInstanceId, linkedRoleEligibilityScheduleId, justification, ticketInfo, condition, conditionVersion, createdOn, requestorId, expandedProperties, startOn, expirationType, endOn, duration, default); } - /// Initializes a new instance of RoleEligibilityScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -302,10 +321,10 @@ public static RoleAssignmentScheduleRequestData RoleAssignmentScheduleRequestDat /// A new instance for mocking. public static RoleEligibilityScheduleData RoleEligibilityScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, ResourceIdentifier roleEligibilityScheduleRequestId = null, RoleManagementScheduleMemberType? memberType = null, RoleManagementScheduleStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null, RoleManagementExpandedProperties expandedProperties = null) { - return new RoleEligibilityScheduleData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleEligibilityScheduleRequestId, memberType, status, startOn, endOn, condition, conditionVersion, createdOn, updatedOn, expandedProperties); + return new RoleEligibilityScheduleData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleEligibilityScheduleRequestId, memberType, status, startOn, endOn, condition, conditionVersion, createdOn, updatedOn, expandedProperties, default); } - /// Initializes a new instance of RoleEligibilityScheduleInstanceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -326,10 +345,10 @@ public static RoleEligibilityScheduleData RoleEligibilityScheduleData(ResourceId /// A new instance for mocking. public static RoleEligibilityScheduleInstanceData RoleEligibilityScheduleInstanceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, ResourceIdentifier roleEligibilityScheduleId = null, RoleManagementScheduleStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, RoleManagementScheduleMemberType? memberType = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, RoleManagementExpandedProperties expandedProperties = null) { - return new RoleEligibilityScheduleInstanceData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleEligibilityScheduleId, status, startOn, endOn, memberType, condition, conditionVersion, createdOn, expandedProperties); + return new RoleEligibilityScheduleInstanceData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, roleEligibilityScheduleId, status, startOn, endOn, memberType, condition, conditionVersion, createdOn, expandedProperties, default); } - /// Initializes a new instance of RoleEligibilityScheduleRequestData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -357,10 +376,10 @@ public static RoleEligibilityScheduleInstanceData RoleEligibilityScheduleInstanc /// A new instance for mocking. public static RoleEligibilityScheduleRequestData RoleEligibilityScheduleRequestData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scope = null, ResourceIdentifier roleDefinitionId = null, Guid? principalId = null, RoleManagementPrincipalType? principalType = null, RoleManagementScheduleRequestType? requestType = null, RoleManagementScheduleStatus? status = null, string approvalId = null, ResourceIdentifier targetRoleEligibilityScheduleId = null, ResourceIdentifier targetRoleEligibilityScheduleInstanceId = null, string justification = null, RoleEligibilityScheduleRequestPropertiesTicketInfo ticketInfo = null, string condition = null, string conditionVersion = null, DateTimeOffset? createdOn = null, Guid? requestorId = null, RoleManagementExpandedProperties expandedProperties = null, DateTimeOffset? startOn = null, RoleManagementScheduleExpirationType? expirationType = null, DateTimeOffset? endOn = null, TimeSpan? duration = null) { - return new RoleEligibilityScheduleRequestData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, requestType, status, approvalId, targetRoleEligibilityScheduleId, targetRoleEligibilityScheduleInstanceId, justification, ticketInfo, condition, conditionVersion, createdOn, requestorId, expandedProperties, startOn, expirationType, endOn, duration); + return new RoleEligibilityScheduleRequestData(id, name, resourceType, systemData, scope, roleDefinitionId, principalId, principalType, requestType, status, approvalId, targetRoleEligibilityScheduleId, targetRoleEligibilityScheduleInstanceId, justification, ticketInfo, condition, conditionVersion, createdOn, requestorId, expandedProperties, startOn, expirationType, endOn, duration, default); } - /// Initializes a new instance of RoleManagementPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -388,20 +407,20 @@ public static RoleManagementPolicyData RoleManagementPolicyData(ResourceIdentifi rules ??= new List(); effectiveRules ??= new List(); - return new RoleManagementPolicyData(id, name, resourceType, systemData, scope, displayName, description, isOrganizationDefault, lastModifiedBy, lastModifiedOn, rules?.ToList(), effectiveRules?.ToList(), policyProperties); + return new RoleManagementPolicyData(id, name, resourceType, systemData, scope, displayName, description, isOrganizationDefault, lastModifiedBy, lastModifiedOn, rules?.ToList(), effectiveRules?.ToList(), policyProperties, default); } - /// Initializes a new instance of RoleManagementPolicyProperties. + /// Initializes a new instance of . /// Scope id of the resource. /// Display name of the resource. /// Type of the scope. /// A new instance for mocking. public static RoleManagementPolicyProperties RoleManagementPolicyProperties(ResourceIdentifier scopeId = null, string scopeDisplayName = null, RoleManagementScopeType? scopeType = null) { - return new RoleManagementPolicyProperties(scopeId, scopeDisplayName, scopeType); + return new RoleManagementPolicyProperties(scopeId, scopeDisplayName, scopeType, default); } - /// Initializes a new instance of RoleManagementPolicyAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -420,10 +439,10 @@ public static RoleManagementPolicyAssignmentData RoleManagementPolicyAssignmentD { effectiveRules ??= new List(); - return new RoleManagementPolicyAssignmentData(id, name, resourceType, systemData, scope, roleDefinitionId, policyId, effectiveRules?.ToList(), policyAssignmentProperties); + return new RoleManagementPolicyAssignmentData(id, name, resourceType, systemData, scope, roleDefinitionId, policyId, effectiveRules?.ToList(), policyAssignmentProperties, default); } - /// Initializes a new instance of PolicyAssignmentProperties. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -440,7 +459,7 @@ public static RoleManagementPolicyAssignmentData RoleManagementPolicyAssignmentD /// A new instance for mocking. public static PolicyAssignmentProperties PolicyAssignmentProperties(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier policyId = null, RoleManagementPrincipal lastModifiedBy = null, DateTimeOffset? lastModifiedOn = null, ResourceIdentifier roleDefinitionId = null, string roleDefinitionDisplayName = null, AuthorizationRoleType? roleType = null, ResourceIdentifier scopeId = null, string scopeDisplayName = null, RoleManagementScopeType? scopeType = null) { - return new PolicyAssignmentProperties(id, name, resourceType, systemData, policyId, lastModifiedBy, lastModifiedOn, roleDefinitionId, roleDefinitionDisplayName, roleType, scopeId, scopeDisplayName, scopeType); + return new PolicyAssignmentProperties(id, name, resourceType, systemData, policyId, lastModifiedBy, lastModifiedOn, roleDefinitionId, roleDefinitionDisplayName, roleType, scopeId, scopeDisplayName, scopeType, default); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs index 4ec82405299b..2a098ec4f596 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataCollection.cs @@ -148,7 +148,7 @@ public virtual AsyncPageable Ge { HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationProviderOperationsMetadataProviderOperationsMetadataRestClient.CreateListRequest(expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationProviderOperationsMetadataProviderOperationsMetadataRestClient.CreateListNextPageRequest(nextLink, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationProviderOperationsMetadataResource(Client, AuthorizationProviderOperationsMetadataData.DeserializeAuthorizationProviderOperationsMetadataData(e)), _authorizationProviderOperationsMetadataProviderOperationsMetadataClientDiagnostics, Pipeline, "AuthorizationProviderOperationsMetadataCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AuthorizationProviderOperationsMetadataResource(Client, AuthorizationProviderOperationsMetadataData.DeserializeAuthorizationProviderOperationsMetadataData(e)), _authorizationProviderOperationsMetadataProviderOperationsMetadataClientDiagnostics, Pipeline, "AuthorizationProviderOperationsMetadataCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -171,7 +171,7 @@ public virtual Pageable GetAll( { HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationProviderOperationsMetadataProviderOperationsMetadataRestClient.CreateListRequest(expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationProviderOperationsMetadataProviderOperationsMetadataRestClient.CreateListNextPageRequest(nextLink, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationProviderOperationsMetadataResource(Client, AuthorizationProviderOperationsMetadataData.DeserializeAuthorizationProviderOperationsMetadataData(e)), _authorizationProviderOperationsMetadataProviderOperationsMetadataClientDiagnostics, Pipeline, "AuthorizationProviderOperationsMetadataCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AuthorizationProviderOperationsMetadataResource(Client, AuthorizationProviderOperationsMetadataData.DeserializeAuthorizationProviderOperationsMetadataData(e)), _authorizationProviderOperationsMetadataProviderOperationsMetadataClientDiagnostics, Pipeline, "AuthorizationProviderOperationsMetadataCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataData.cs index 77c203f498b8..3ac870cdc352 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.Authorization /// public partial class AuthorizationProviderOperationsMetadataData : ResourceData { - /// Initializes a new instance of AuthorizationProviderOperationsMetadataData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationProviderOperationsMetadataData() { ResourceTypes = new ChangeTrackingList(); Operations = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationProviderOperationsMetadataData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,11 +37,13 @@ internal AuthorizationProviderOperationsMetadataData() /// The provider display name. /// The provider resource types. /// The provider operations. - internal AuthorizationProviderOperationsMetadataData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IReadOnlyList resourceTypes, IReadOnlyList operations) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AuthorizationProviderOperationsMetadataData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IReadOnlyList resourceTypes, IReadOnlyList operations, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; ResourceTypes = resourceTypes; Operations = operations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The provider display name. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs index b394879d965e..cd606d2246fe 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionCollection.cs @@ -215,7 +215,7 @@ public virtual AsyncPageable GetAllAsync(st { HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationRoleDefinitionRoleDefinitionsRestClient.CreateListRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationRoleDefinitionRoleDefinitionsRestClient.CreateListNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationRoleDefinitionResource(Client, AuthorizationRoleDefinitionData.DeserializeAuthorizationRoleDefinitionData(e)), _authorizationRoleDefinitionRoleDefinitionsClientDiagnostics, Pipeline, "AuthorizationRoleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AuthorizationRoleDefinitionResource(Client, AuthorizationRoleDefinitionData.DeserializeAuthorizationRoleDefinitionData(e)), _authorizationRoleDefinitionRoleDefinitionsClientDiagnostics, Pipeline, "AuthorizationRoleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -238,7 +238,7 @@ public virtual Pageable GetAll(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationRoleDefinitionRoleDefinitionsRestClient.CreateListRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationRoleDefinitionRoleDefinitionsRestClient.CreateListNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationRoleDefinitionResource(Client, AuthorizationRoleDefinitionData.DeserializeAuthorizationRoleDefinitionData(e)), _authorizationRoleDefinitionRoleDefinitionsClientDiagnostics, Pipeline, "AuthorizationRoleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AuthorizationRoleDefinitionResource(Client, AuthorizationRoleDefinitionData.DeserializeAuthorizationRoleDefinitionData(e)), _authorizationRoleDefinitionRoleDefinitionsClientDiagnostics, Pipeline, "AuthorizationRoleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionData.cs index f11183c5d5f1..af24acd23524 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.Authorization /// public partial class AuthorizationRoleDefinitionData : ResourceData { - /// Initializes a new instance of AuthorizationRoleDefinitionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AuthorizationRoleDefinitionData() { Permissions = new ChangeTrackingList(); AssignableScopes = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationRoleDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +39,15 @@ public AuthorizationRoleDefinitionData() /// The role type. /// Role definition permissions. /// Role definition assignable scopes. - internal AuthorizationRoleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, string description, AuthorizationRoleType? roleType, IList permissions, IList assignableScopes) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AuthorizationRoleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, string description, AuthorizationRoleType? roleType, IList permissions, IList assignableScopes, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RoleName = roleName; Description = description; RoleType = roleType; Permissions = permissions; AssignableScopes = assignableScopes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role name. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs index a0c69fc9eacc..fc6ca3ae5f62 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentCollection.cs @@ -165,25 +165,25 @@ public virtual AsyncPageable GetAllAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } else if (Id.ResourceType == SubscriptionResource.ResourceType) { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListRequest(Id.SubscriptionId, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } else if (Id.ResourceType == "") { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } else { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListForResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.ResourceType.Namespace, Id.Parent.SubstringAfterProviderNamespace(), Id.ResourceType.GetLastType(), Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListForResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.ResourceType.Namespace, Id.Parent.SubstringAfterProviderNamespace(), Id.ResourceType.GetLastType(), Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } } @@ -233,25 +233,25 @@ public virtual Pageable GetAll(string filter = null, Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } else if (Id.ResourceType == SubscriptionResource.ResourceType) { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListRequest(Id.SubscriptionId, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } else if (Id.ResourceType == "") { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } else { HttpMessage FirstPageRequest(int? pageSizeHint) => _denyAssignmentRestClient.CreateListForResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.ResourceType.Namespace, Id.Parent.SubstringAfterProviderNamespace(), Id.ResourceType.GetLastType(), Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _denyAssignmentRestClient.CreateListForResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.ResourceType.Namespace, Id.Parent.SubstringAfterProviderNamespace(), Id.ResourceType.GetLastType(), Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DenyAssignmentResource(Client, DenyAssignmentData.DeserializeDenyAssignmentData(e)), _denyAssignmentClientDiagnostics, Pipeline, "DenyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentData.cs index cc3c67fc0fd3..2723699af4a0 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.Authorization /// public partial class DenyAssignmentData : ResourceData { - /// Initializes a new instance of DenyAssignmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DenyAssignmentData() { Permissions = new ChangeTrackingList(); @@ -26,7 +30,7 @@ internal DenyAssignmentData() ExcludePrincipals = new ChangeTrackingList(); } - /// Initializes a new instance of DenyAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ internal DenyAssignmentData() /// Array of principals to which the deny assignment applies. /// Array of principals to which the deny assignment does not apply. /// Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. - internal DenyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string denyAssignmentName, string description, IReadOnlyList permissions, string scope, bool? isAppliedToChildScopes, IReadOnlyList principals, IReadOnlyList excludePrincipals, bool? isSystemProtected) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DenyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string denyAssignmentName, string description, IReadOnlyList permissions, string scope, bool? isAppliedToChildScopes, IReadOnlyList principals, IReadOnlyList excludePrincipals, bool? isSystemProtected, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DenyAssignmentName = denyAssignmentName; Description = description; @@ -49,6 +54,7 @@ internal DenyAssignmentData(ResourceIdentifier id, string name, ResourceType res Principals = principals; ExcludePrincipals = excludePrincipals; IsSystemProtected = isSystemProtected; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The display name of the deny assignment. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.Serialization.cs index 0848eab6518f..b72ebc5ba5f6 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.Serialization.cs @@ -5,16 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization.Models { - public partial class AuthorizationClassicAdministrator + public partial class AuthorizationClassicAdministrator : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationClassicAdministrator DeserializeAuthorizationClassicAdministrator(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(EmailAddress)) + { + writer.WritePropertyName("emailAddress"u8); + writer.WriteStringValue(EmailAddress); + } + if (Optional.IsDefined(Role)) + { + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationClassicAdministrator DeserializeAuthorizationClassicAdministrator(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +66,7 @@ internal static AuthorizationClassicAdministrator DeserializeAuthorizationClassi Optional systemData = default; Optional emailAddress = default; Optional role = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -73,8 +115,61 @@ internal static AuthorizationClassicAdministrator DeserializeAuthorizationClassi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationClassicAdministrator(id, name, type, systemData.Value, emailAddress.Value, role.Value); + return new AuthorizationClassicAdministrator(id, name, type, systemData.Value, emailAddress.Value, role.Value, serializedAdditionalRawData); + } + + AuthorizationClassicAdministrator IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationClassicAdministrator(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationClassicAdministrator IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationClassicAdministrator(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationClassicAdministrator model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationClassicAdministrator(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationClassicAdministrator(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.cs index 8bee4b18ae66..bd1ec30466b4 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministrator.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,22 +15,27 @@ namespace Azure.ResourceManager.Authorization.Models /// Classic Administrators. public partial class AuthorizationClassicAdministrator : ResourceData { - /// Initializes a new instance of AuthorizationClassicAdministrator. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationClassicAdministrator() { } - /// Initializes a new instance of AuthorizationClassicAdministrator. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The email address of the administrator. /// The role of the administrator. - internal AuthorizationClassicAdministrator(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string emailAddress, string role) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AuthorizationClassicAdministrator(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string emailAddress, string role, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { EmailAddress = emailAddress; Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The email address of the administrator. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.Serialization.cs index 07da4d2a0018..d14ea1a9de68 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class AuthorizationClassicAdministratorListResult + internal partial class AuthorizationClassicAdministratorListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationClassicAdministratorListResult DeserializeAuthorizationClassicAdministratorListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationClassicAdministratorListResult DeserializeAuthorizationClassicAdministratorListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static AuthorizationClassicAdministratorListResult DeserializeAuthoriza nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationClassicAdministratorListResult(Optional.ToList(value), nextLink.Value); + return new AuthorizationClassicAdministratorListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AuthorizationClassicAdministratorListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationClassicAdministratorListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationClassicAdministratorListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationClassicAdministratorListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationClassicAdministratorListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationClassicAdministratorListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationClassicAdministratorListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.cs index d25df073afae..c28167843f56 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationClassicAdministratorListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Authorization.Models /// ClassicAdministrator list result information. internal partial class AuthorizationClassicAdministratorListResult { - /// Initializes a new instance of AuthorizationClassicAdministratorListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationClassicAdministratorListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationClassicAdministratorListResult. + /// Initializes a new instance of . /// An array of administrators. /// The URL to use for getting the next set of results. - internal AuthorizationClassicAdministratorListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AuthorizationClassicAdministratorListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of administrators. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.Serialization.cs index da9f2ac89c88..7fa75bf09761 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.Serialization.cs @@ -6,15 +6,83 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class AuthorizationProviderOperationInfo + public partial class AuthorizationProviderOperationInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationProviderOperationInfo DeserializeAuthorizationProviderOperationInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Origin)) + { + writer.WritePropertyName("origin"u8); + writer.WriteStringValue(Origin); + } + if (Optional.IsDefined(Properties)) + { + if (Properties != null) + { + writer.WritePropertyName("properties"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Properties); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(Properties.ToString()).RootElement); +#endif + } + else + { + writer.WriteNull("properties"); + } + } + if (Optional.IsDefined(IsDataAction)) + { + writer.WritePropertyName("isDataAction"u8); + writer.WriteBooleanValue(IsDataAction.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOperationInfo DeserializeAuthorizationProviderOperationInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +93,7 @@ internal static AuthorizationProviderOperationInfo DeserializeAuthorizationProvi Optional origin = default; Optional properties = default; Optional isDataAction = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -66,8 +135,61 @@ internal static AuthorizationProviderOperationInfo DeserializeAuthorizationProvi isDataAction = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationProviderOperationInfo(name.Value, displayName.Value, description.Value, origin.Value, properties.Value, Optional.ToNullable(isDataAction)); + return new AuthorizationProviderOperationInfo(name.Value, displayName.Value, description.Value, origin.Value, properties.Value, Optional.ToNullable(isDataAction), serializedAdditionalRawData); + } + + AuthorizationProviderOperationInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationProviderOperationInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationProviderOperationInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationProviderOperationInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationProviderOperationInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationProviderOperationInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationProviderOperationInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.cs index 2c9fa2255c52..2a4b5963c409 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationInfo.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Authorization.Models { /// Operation. public partial class AuthorizationProviderOperationInfo { - /// Initializes a new instance of AuthorizationProviderOperationInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationProviderOperationInfo() { } - /// Initializes a new instance of AuthorizationProviderOperationInfo. + /// Initializes a new instance of . /// The operation name. /// The operation display name. /// The operation description. /// The operation origin. /// The operation properties. /// The dataAction flag to specify the operation type. - internal AuthorizationProviderOperationInfo(string name, string displayName, string description, string origin, BinaryData properties, bool? isDataAction) + /// Keeps track of any properties unknown to the library. + internal AuthorizationProviderOperationInfo(string name, string displayName, string description, string origin, BinaryData properties, bool? isDataAction, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; @@ -32,6 +37,7 @@ internal AuthorizationProviderOperationInfo(string name, string displayName, str Origin = origin; Properties = properties; IsDataAction = isDataAction; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation name. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataData.Serialization.cs index 397ed5d13d14..a0ff6443604e 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataData.Serialization.cs @@ -5,18 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class AuthorizationProviderOperationsMetadataData + public partial class AuthorizationProviderOperationsMetadataData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationProviderOperationsMetadataData DeserializeAuthorizationProviderOperationsMetadataData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(ResourceTypes)) + { + writer.WritePropertyName("resourceTypes"u8); + writer.WriteStartArray(); + foreach (var item in ResourceTypes) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOperationsMetadataData DeserializeAuthorizationProviderOperationsMetadataData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +94,7 @@ internal static AuthorizationProviderOperationsMetadataData DeserializeAuthoriza string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayName"u8)) @@ -87,8 +154,61 @@ internal static AuthorizationProviderOperationsMetadataData DeserializeAuthoriza systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AuthorizationProviderOperationsMetadataData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(resourceTypes), Optional.ToList(operations), serializedAdditionalRawData); + } + + AuthorizationProviderOperationsMetadataData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationProviderOperationsMetadataData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationProviderOperationsMetadataData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationProviderOperationsMetadataData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationProviderOperationsMetadataData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationProviderOperationsMetadataData(Response response) + { + if (response is null) + { + return null; } - return new AuthorizationProviderOperationsMetadataData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(resourceTypes), Optional.ToList(operations)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationProviderOperationsMetadataData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.Serialization.cs index b9027296b0f3..0542a5629a61 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class AuthorizationProviderOperationsMetadataListResult + internal partial class AuthorizationProviderOperationsMetadataListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationProviderOperationsMetadataListResult DeserializeAuthorizationProviderOperationsMetadataListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOperationsMetadataListResult DeserializeAuthorizationProviderOperationsMetadataListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AuthorizationProviderOperationsMetadataListResult DeserializeAut nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationProviderOperationsMetadataListResult(Optional.ToList(value), nextLink.Value); + return new AuthorizationProviderOperationsMetadataListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AuthorizationProviderOperationsMetadataListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationProviderOperationsMetadataListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationProviderOperationsMetadataListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationProviderOperationsMetadataListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationProviderOperationsMetadataListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationProviderOperationsMetadataListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationProviderOperationsMetadataListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.cs index 65de6353ca8b..89be7cf25988 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderOperationsMetadataListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Provider operations metadata list. internal partial class AuthorizationProviderOperationsMetadataListResult { - /// Initializes a new instance of AuthorizationProviderOperationsMetadataListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationProviderOperationsMetadataListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationProviderOperationsMetadataListResult. + /// Initializes a new instance of . /// The list of providers. /// The URL to use for getting the next set of results. - internal AuthorizationProviderOperationsMetadataListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AuthorizationProviderOperationsMetadataListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of providers. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.Serialization.cs index 9f4643881eab..fb765ee6c4d7 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class AuthorizationProviderResourceType + public partial class AuthorizationProviderResourceType : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationProviderResourceType DeserializeAuthorizationProviderResourceType(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderResourceType DeserializeAuthorizationProviderResourceType(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static AuthorizationProviderResourceType DeserializeAuthorizationProvid Optional name = default; Optional displayName = default; Optional> operations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +103,61 @@ internal static AuthorizationProviderResourceType DeserializeAuthorizationProvid operations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationProviderResourceType(name.Value, displayName.Value, Optional.ToList(operations)); + return new AuthorizationProviderResourceType(name.Value, displayName.Value, Optional.ToList(operations), serializedAdditionalRawData); + } + + AuthorizationProviderResourceType IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationProviderResourceType(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationProviderResourceType IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationProviderResourceType(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationProviderResourceType model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationProviderResourceType(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationProviderResourceType(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.cs index 1ccc8918c085..0cab9b02e111 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationProviderResourceType.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Authorization.Models /// Resource Type. public partial class AuthorizationProviderResourceType { - /// Initializes a new instance of AuthorizationProviderResourceType. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationProviderResourceType() { Operations = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationProviderResourceType. + /// Initializes a new instance of . /// The resource type name. /// The resource type display name. /// The resource type operations. - internal AuthorizationProviderResourceType(string name, string displayName, IReadOnlyList operations) + /// Keeps track of any properties unknown to the library. + internal AuthorizationProviderResourceType(string name, string displayName, IReadOnlyList operations, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; Operations = operations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource type name. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationRoleDefinitionData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationRoleDefinitionData.Serialization.cs index ec2a0c4b0e60..b588d9943862 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationRoleDefinitionData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/AuthorizationRoleDefinitionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class AuthorizationRoleDefinitionData : IUtf8JsonSerializable + public partial class AuthorizationRoleDefinitionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -41,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Permissions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -56,11 +70,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AuthorizationRoleDefinitionData DeserializeAuthorizationRoleDefinitionData(JsonElement element) + internal static AuthorizationRoleDefinitionData DeserializeAuthorizationRoleDefinitionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +102,7 @@ internal static AuthorizationRoleDefinitionData DeserializeAuthorizationRoleDefi Optional type0 = default; Optional> permissions = default; Optional> assignableScopes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -159,8 +188,61 @@ internal static AuthorizationRoleDefinitionData DeserializeAuthorizationRoleDefi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AuthorizationRoleDefinitionData(id, name, type, systemData.Value, roleName.Value, description.Value, Optional.ToNullable(type0), Optional.ToList(permissions), Optional.ToList(assignableScopes), serializedAdditionalRawData); + } + + AuthorizationRoleDefinitionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationRoleDefinitionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationRoleDefinitionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationRoleDefinitionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationRoleDefinitionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationRoleDefinitionData(Response response) + { + if (response is null) + { + return null; } - return new AuthorizationRoleDefinitionData(id, name, type, systemData.Value, roleName.Value, description.Value, Optional.ToNullable(type0), Optional.ToList(permissions), Optional.ToList(assignableScopes)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationRoleDefinitionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentData.Serialization.cs index ac3f587b7008..46d08f468c26 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentData.Serialization.cs @@ -5,18 +5,124 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class DenyAssignmentData + public partial class DenyAssignmentData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DenyAssignmentData DeserializeDenyAssignmentData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DenyAssignmentName)) + { + writer.WritePropertyName("denyAssignmentName"u8); + writer.WriteStringValue(DenyAssignmentName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(IsAppliedToChildScopes)) + { + writer.WritePropertyName("doNotApplyToChildScopes"u8); + writer.WriteBooleanValue(IsAppliedToChildScopes.Value); + } + if (Optional.IsCollectionDefined(Principals)) + { + writer.WritePropertyName("principals"u8); + writer.WriteStartArray(); + foreach (var item in Principals) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExcludePrincipals)) + { + writer.WritePropertyName("excludePrincipals"u8); + writer.WriteStartArray(); + foreach (var item in ExcludePrincipals) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsSystemProtected)) + { + writer.WritePropertyName("isSystemProtected"u8); + writer.WriteBooleanValue(IsSystemProtected.Value); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DenyAssignmentData DeserializeDenyAssignmentData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +139,7 @@ internal static DenyAssignmentData DeserializeDenyAssignmentData(JsonElement ele Optional> principals = default; Optional> excludePrincipals = default; Optional isSystemProtected = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -146,8 +253,61 @@ internal static DenyAssignmentData DeserializeDenyAssignmentData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DenyAssignmentData(id, name, type, systemData.Value, denyAssignmentName.Value, description.Value, Optional.ToList(permissions), scope.Value, Optional.ToNullable(doNotApplyToChildScopes), Optional.ToList(principals), Optional.ToList(excludePrincipals), Optional.ToNullable(isSystemProtected), serializedAdditionalRawData); + } + + DenyAssignmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDenyAssignmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DenyAssignmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDenyAssignmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DenyAssignmentData model) + { + if (model is null) + { + return null; } - return new DenyAssignmentData(id, name, type, systemData.Value, denyAssignmentName.Value, description.Value, Optional.ToList(permissions), scope.Value, Optional.ToNullable(doNotApplyToChildScopes), Optional.ToList(principals), Optional.ToList(excludePrincipals), Optional.ToNullable(isSystemProtected)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DenyAssignmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDenyAssignmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.Serialization.cs index 897021ef42ae..64d22b408328 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class DenyAssignmentListResult + internal partial class DenyAssignmentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DenyAssignmentListResult DeserializeDenyAssignmentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DenyAssignmentListResult DeserializeDenyAssignmentListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DenyAssignmentListResult DeserializeDenyAssignmentListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DenyAssignmentListResult(Optional.ToList(value), nextLink.Value); + return new DenyAssignmentListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DenyAssignmentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDenyAssignmentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DenyAssignmentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDenyAssignmentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DenyAssignmentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DenyAssignmentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDenyAssignmentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.cs index aca966378fc5..2429afdc98c3 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Deny assignment list operation result. internal partial class DenyAssignmentListResult { - /// Initializes a new instance of DenyAssignmentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DenyAssignmentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DenyAssignmentListResult. + /// Initializes a new instance of . /// Deny assignment list. /// The URL to use for getting the next set of results. - internal DenyAssignmentListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DenyAssignmentListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Deny assignment list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.Serialization.cs index b2e35f49431e..5cc2c8680c76 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.Serialization.cs @@ -5,16 +5,93 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class DenyAssignmentPermission + public partial class DenyAssignmentPermission : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DenyAssignmentPermission DeserializeDenyAssignmentPermission(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Actions)) + { + writer.WritePropertyName("actions"u8); + writer.WriteStartArray(); + foreach (var item in Actions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NotActions)) + { + writer.WritePropertyName("notActions"u8); + writer.WriteStartArray(); + foreach (var item in NotActions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DataActions)) + { + writer.WritePropertyName("dataActions"u8); + writer.WriteStartArray(); + foreach (var item in DataActions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NotDataActions)) + { + writer.WritePropertyName("notDataActions"u8); + writer.WriteStartArray(); + foreach (var item in NotDataActions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(ConditionVersion)) + { + writer.WritePropertyName("conditionVersion"u8); + writer.WriteStringValue(ConditionVersion); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DenyAssignmentPermission DeserializeDenyAssignmentPermission(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +102,7 @@ internal static DenyAssignmentPermission DeserializeDenyAssignmentPermission(Jso Optional> notDataActions = default; Optional condition = default; Optional conditionVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actions"u8)) @@ -93,8 +171,61 @@ internal static DenyAssignmentPermission DeserializeDenyAssignmentPermission(Jso conditionVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DenyAssignmentPermission(Optional.ToList(actions), Optional.ToList(notActions), Optional.ToList(dataActions), Optional.ToList(notDataActions), condition.Value, conditionVersion.Value); + return new DenyAssignmentPermission(Optional.ToList(actions), Optional.ToList(notActions), Optional.ToList(dataActions), Optional.ToList(notDataActions), condition.Value, conditionVersion.Value, serializedAdditionalRawData); + } + + DenyAssignmentPermission IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDenyAssignmentPermission(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DenyAssignmentPermission IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDenyAssignmentPermission(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DenyAssignmentPermission model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DenyAssignmentPermission(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDenyAssignmentPermission(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.cs index 8d22a917f63b..af096d0e7841 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/DenyAssignmentPermission.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Authorization.Models /// Deny assignment permissions. public partial class DenyAssignmentPermission { - /// Initializes a new instance of DenyAssignmentPermission. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DenyAssignmentPermission() { Actions = new ChangeTrackingList(); @@ -22,14 +26,15 @@ internal DenyAssignmentPermission() NotDataActions = new ChangeTrackingList(); } - /// Initializes a new instance of DenyAssignmentPermission. + /// Initializes a new instance of . /// Actions to which the deny assignment does not grant access. /// Actions to exclude from that the deny assignment does not grant access. /// Data actions to which the deny assignment does not grant access. /// Data actions to exclude from that the deny assignment does not grant access. /// The conditions on the Deny assignment permission. This limits the resources it applies to. /// Version of the condition. - internal DenyAssignmentPermission(IReadOnlyList actions, IReadOnlyList notActions, IReadOnlyList dataActions, IReadOnlyList notDataActions, string condition, string conditionVersion) + /// Keeps track of any properties unknown to the library. + internal DenyAssignmentPermission(IReadOnlyList actions, IReadOnlyList notActions, IReadOnlyList dataActions, IReadOnlyList notDataActions, string condition, string conditionVersion, Dictionary serializedAdditionalRawData) { Actions = actions; NotActions = notActions; @@ -37,6 +42,7 @@ internal DenyAssignmentPermission(IReadOnlyList actions, IReadOnlyList Actions to which the deny assignment does not grant access. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.Serialization.cs index 7dc34f5c5d13..848e06c648e1 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class EligibleChildResource + public partial class EligibleChildResource : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EligibleChildResource DeserializeEligibleChildResource(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EligibleChildResource DeserializeEligibleChildResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static EligibleChildResource DeserializeEligibleChildResource(JsonEleme Optional id = default; Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -38,8 +67,61 @@ internal static EligibleChildResource DeserializeEligibleChildResource(JsonEleme type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EligibleChildResource(id.Value, name.Value, type.Value); + return new EligibleChildResource(id.Value, name.Value, type.Value, serializedAdditionalRawData); + } + + EligibleChildResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEligibleChildResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EligibleChildResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEligibleChildResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EligibleChildResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EligibleChildResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEligibleChildResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.cs index 83da2ad49739..6c44e37ab97d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResource.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// Eligible child resource. public partial class EligibleChildResource { - /// Initializes a new instance of EligibleChildResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EligibleChildResource() { } - /// Initializes a new instance of EligibleChildResource. + /// Initializes a new instance of . /// The resource scope Id. /// The resource name. /// The resource type. - internal EligibleChildResource(string id, string name, string resourceType) + /// Keeps track of any properties unknown to the library. + internal EligibleChildResource(string id, string name, string resourceType, Dictionary serializedAdditionalRawData) { Id = id; Name = name; ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource scope Id. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.Serialization.cs index c66511f9744a..0bcc1326ba78 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class EligibleChildResourcesListResult + internal partial class EligibleChildResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EligibleChildResourcesListResult DeserializeEligibleChildResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EligibleChildResourcesListResult DeserializeEligibleChildResourcesListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static EligibleChildResourcesListResult DeserializeEligibleChildResourc nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EligibleChildResourcesListResult(Optional.ToList(value), nextLink.Value); + return new EligibleChildResourcesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + EligibleChildResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEligibleChildResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EligibleChildResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEligibleChildResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EligibleChildResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EligibleChildResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEligibleChildResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.cs index 6d0ef039977c..52e4e6ae3d40 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/EligibleChildResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Eligible child resources list operation result. internal partial class EligibleChildResourcesListResult { - /// Initializes a new instance of EligibleChildResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EligibleChildResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of EligibleChildResourcesListResult. + /// Initializes a new instance of . /// Eligible child resource list. /// The URL to use for getting the next set of results. - internal EligibleChildResourcesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal EligibleChildResourcesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Eligible child resource list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs index e4fec3d3cdd5..25bb4ea8ea35 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs @@ -6,16 +6,92 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization.Models { - public partial class PolicyAssignmentProperties + public partial class PolicyAssignmentProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PolicyAssignmentProperties DeserializePolicyAssignmentProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("policy"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PolicyId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(PolicyId); + } + if (Optional.IsDefined(LastModifiedOn)) + { + writer.WritePropertyName("lastModifiedDateTime"u8); + writer.WriteStringValue(LastModifiedOn.Value, "O"); + } + writer.WriteEndObject(); + writer.WritePropertyName("roleDefinition"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(RoleDefinitionDisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(RoleDefinitionDisplayName); + } + if (Optional.IsDefined(RoleType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RoleType.Value.ToString()); + } + writer.WriteEndObject(); + writer.WritePropertyName("scope"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ScopeId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(ScopeId); + } + if (Optional.IsDefined(ScopeDisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(ScopeDisplayName); + } + if (Optional.IsDefined(ScopeType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ScopeType.Value.ToString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PolicyAssignmentProperties DeserializePolicyAssignmentProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +109,7 @@ internal static PolicyAssignmentProperties DeserializePolicyAssignmentProperties Optional id2 = default; Optional displayName0 = default; Optional type1 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -168,8 +245,61 @@ internal static PolicyAssignmentProperties DeserializePolicyAssignmentProperties } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PolicyAssignmentProperties(id, name, type, systemData.Value, id0.Value, lastModifiedBy.Value, Optional.ToNullable(lastModifiedDateTime), id1.Value, displayName.Value, Optional.ToNullable(type0), id2.Value, displayName0.Value, Optional.ToNullable(type1)); + return new PolicyAssignmentProperties(id, name, type, systemData.Value, id0.Value, lastModifiedBy.Value, Optional.ToNullable(lastModifiedDateTime), id1.Value, displayName.Value, Optional.ToNullable(type0), id2.Value, displayName0.Value, Optional.ToNullable(type1), serializedAdditionalRawData); + } + + PolicyAssignmentProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyAssignmentProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyAssignmentProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyAssignmentProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyAssignmentProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyAssignmentProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyAssignmentProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.cs index a0656ee3ab21..4eeb3ad025f9 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/PolicyAssignmentProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Authorization.Models /// Expanded info of resource scope, role definition and policy. public partial class PolicyAssignmentProperties : ResourceData { - /// Initializes a new instance of PolicyAssignmentProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PolicyAssignmentProperties() { } - /// Initializes a new instance of PolicyAssignmentProperties. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +37,8 @@ internal PolicyAssignmentProperties() /// Scope id of the resource. /// Display name of the resource. /// Type of the scope. - internal PolicyAssignmentProperties(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier policyId, RoleManagementPrincipal lastModifiedBy, DateTimeOffset? lastModifiedOn, ResourceIdentifier roleDefinitionId, string roleDefinitionDisplayName, AuthorizationRoleType? roleType, ResourceIdentifier scopeId, string scopeDisplayName, RoleManagementScopeType? scopeType) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PolicyAssignmentProperties(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier policyId, RoleManagementPrincipal lastModifiedBy, DateTimeOffset? lastModifiedOn, ResourceIdentifier roleDefinitionId, string roleDefinitionDisplayName, AuthorizationRoleType? roleType, ResourceIdentifier scopeId, string scopeDisplayName, RoleManagementScopeType? scopeType, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PolicyId = policyId; LastModifiedBy = lastModifiedBy; @@ -44,6 +49,7 @@ internal PolicyAssignmentProperties(ResourceIdentifier id, string name, Resource ScopeId = scopeId; ScopeDisplayName = scopeDisplayName; ScopeType = scopeType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of the policy. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.Serialization.cs index 147e82a81563..324b63eb5c9d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleAssignmentCreateOrUpdateContent : IUtf8JsonSerializable + public partial class RoleAssignmentCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -54,7 +62,188 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RoleAssignmentCreateOrUpdateContent DeserializeRoleAssignmentCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scope = default; + ResourceIdentifier roleDefinitionId = default; + Guid principalId = default; + Optional principalType = default; + Optional description = default; + Optional condition = default; + Optional conditionVersion = default; + Optional createdOn = default; + Optional updatedOn = default; + Optional createdBy = default; + Optional updatedBy = default; + Optional delegatedManagedIdentityResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("roleDefinitionId"u8)) + { + roleDefinitionId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("principalId"u8)) + { + principalId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("principalType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalType = new RoleManagementPrincipalType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("condition"u8)) + { + condition = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("conditionVersion"u8)) + { + conditionVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("createdOn"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("updatedOn"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedOn = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("createdBy"u8)) + { + createdBy = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("updatedBy"u8)) + { + updatedBy = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("delegatedManagedIdentityResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + delegatedManagedIdentityResourceId = null; + continue; + } + delegatedManagedIdentityResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleAssignmentCreateOrUpdateContent(scope.Value, roleDefinitionId, principalId, Optional.ToNullable(principalType), description.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), createdBy.Value, updatedBy.Value, delegatedManagedIdentityResourceId.Value, serializedAdditionalRawData); + } + + RoleAssignmentCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.cs index c4b016951dc9..ebc12d41dcc5 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Authorization.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Authorization.Models /// Role assignment create parameters. public partial class RoleAssignmentCreateOrUpdateContent { - /// Initializes a new instance of RoleAssignmentCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The role definition ID. /// The principal ID. /// is null. @@ -25,6 +29,42 @@ public RoleAssignmentCreateOrUpdateContent(ResourceIdentifier roleDefinitionId, PrincipalId = principalId; } + /// Initializes a new instance of . + /// The role assignment scope. + /// The role definition ID. + /// The principal ID. + /// The principal type of the assigned principal ID. + /// Description of role assignment. + /// The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'. + /// Version of the condition. Currently the only accepted value is '2.0'. + /// Time it was created. + /// Time it was updated. + /// Id of the user who created the assignment. + /// Id of the user who updated the assignment. + /// Id of the delegated managed identity resource. + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentCreateOrUpdateContent(string scope, ResourceIdentifier roleDefinitionId, Guid principalId, RoleManagementPrincipalType? principalType, string description, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string createdBy, string updatedBy, ResourceIdentifier delegatedManagedIdentityResourceId, Dictionary serializedAdditionalRawData) + { + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + Description = description; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + CreatedBy = createdBy; + UpdatedBy = updatedBy; + DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RoleAssignmentCreateOrUpdateContent() + { + } + /// The role assignment scope. public string Scope { get; } /// The role definition ID. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentData.Serialization.cs index bf1343f5a481..baa33fa75ade 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentData.Serialization.cs @@ -6,17 +6,89 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleAssignmentData + public partial class RoleAssignmentData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentData DeserializeRoleAssignmentData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(ConditionVersion)) + { + writer.WritePropertyName("conditionVersion"u8); + writer.WriteStringValue(ConditionVersion); + } + if (Optional.IsDefined(DelegatedManagedIdentityResourceId)) + { + if (DelegatedManagedIdentityResourceId != null) + { + writer.WritePropertyName("delegatedManagedIdentityResourceId"u8); + writer.WriteStringValue(DelegatedManagedIdentityResourceId); + } + else + { + writer.WriteNull("delegatedManagedIdentityResourceId"); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentData DeserializeRoleAssignmentData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +109,7 @@ internal static RoleAssignmentData DeserializeRoleAssignmentData(JsonElement ele Optional createdBy = default; Optional updatedBy = default; Optional delegatedManagedIdentityResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -160,8 +233,61 @@ internal static RoleAssignmentData DeserializeRoleAssignmentData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleAssignmentData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), description.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), createdBy.Value, updatedBy.Value, delegatedManagedIdentityResourceId.Value, serializedAdditionalRawData); + } + + RoleAssignmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentData(Response response) + { + if (response is null) + { + return null; } - return new RoleAssignmentData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), description.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), createdBy.Value, updatedBy.Value, delegatedManagedIdentityResourceId.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.Serialization.cs index 53276ed79ff0..f401dc884571 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleAssignmentListResult + internal partial class RoleAssignmentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentListResult(Optional.ToList(value), nextLink.Value); + return new RoleAssignmentListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleAssignmentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.cs index a12572f329f0..c1ec19605810 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role assignment list operation result. internal partial class RoleAssignmentListResult { - /// Initializes a new instance of RoleAssignmentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleAssignmentListResult. + /// Initializes a new instance of . /// Role assignment list. /// The skipToken to use for getting the next set of results. - internal RoleAssignmentListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role assignment list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleData.Serialization.cs index 65d829b17b3a..72ac20a9727a 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleData.Serialization.cs @@ -6,17 +6,134 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleAssignmentScheduleData + public partial class RoleAssignmentScheduleData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentScheduleData DeserializeRoleAssignmentScheduleData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(RoleAssignmentScheduleRequestId)) + { + writer.WritePropertyName("roleAssignmentScheduleRequestId"u8); + writer.WriteStringValue(RoleAssignmentScheduleRequestId); + } + if (Optional.IsDefined(LinkedRoleEligibilityScheduleId)) + { + writer.WritePropertyName("linkedRoleEligibilityScheduleId"u8); + writer.WriteStringValue(LinkedRoleEligibilityScheduleId); + } + if (Optional.IsDefined(AssignmentType)) + { + writer.WritePropertyName("assignmentType"u8); + writer.WriteStringValue(AssignmentType.Value.ToString()); + } + if (Optional.IsDefined(MemberType)) + { + writer.WritePropertyName("memberType"u8); + writer.WriteStringValue(MemberType.Value.ToString()); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(ConditionVersion)) + { + writer.WritePropertyName("conditionVersion"u8); + writer.WriteStringValue(ConditionVersion); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(UpdatedOn)) + { + writer.WritePropertyName("updatedOn"u8); + writer.WriteStringValue(UpdatedOn.Value, "O"); + } + if (Optional.IsDefined(ExpandedProperties)) + { + writer.WritePropertyName("expandedProperties"u8); + if (ExpandedProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExpandedProperties).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentScheduleData DeserializeRoleAssignmentScheduleData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +158,7 @@ internal static RoleAssignmentScheduleData DeserializeRoleAssignmentScheduleData Optional createdOn = default; Optional updatedOn = default; Optional expandedProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -211,8 +329,61 @@ internal static RoleAssignmentScheduleData DeserializeRoleAssignmentScheduleData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentScheduleData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleAssignmentScheduleRequestId.Value, linkedRoleEligibilityScheduleId.Value, Optional.ToNullable(assignmentType), Optional.ToNullable(memberType), Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), expandedProperties.Value); + return new RoleAssignmentScheduleData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleAssignmentScheduleRequestId.Value, linkedRoleEligibilityScheduleId.Value, Optional.ToNullable(assignmentType), Optional.ToNullable(memberType), Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), expandedProperties.Value, serializedAdditionalRawData); + } + + RoleAssignmentScheduleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceData.Serialization.cs index bedb3f404c49..8e199771063c 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceData.Serialization.cs @@ -6,17 +6,139 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleAssignmentScheduleInstanceData + public partial class RoleAssignmentScheduleInstanceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentScheduleInstanceData DeserializeRoleAssignmentScheduleInstanceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(RoleAssignmentScheduleId)) + { + writer.WritePropertyName("roleAssignmentScheduleId"u8); + writer.WriteStringValue(RoleAssignmentScheduleId); + } + if (Optional.IsDefined(OriginRoleAssignmentId)) + { + writer.WritePropertyName("originRoleAssignmentId"u8); + writer.WriteStringValue(OriginRoleAssignmentId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(LinkedRoleEligibilityScheduleId)) + { + writer.WritePropertyName("linkedRoleEligibilityScheduleId"u8); + writer.WriteStringValue(LinkedRoleEligibilityScheduleId); + } + if (Optional.IsDefined(LinkedRoleEligibilityScheduleInstanceId)) + { + writer.WritePropertyName("linkedRoleEligibilityScheduleInstanceId"u8); + writer.WriteStringValue(LinkedRoleEligibilityScheduleInstanceId); + } + if (Optional.IsDefined(AssignmentType)) + { + writer.WritePropertyName("assignmentType"u8); + writer.WriteStringValue(AssignmentType.Value.ToString()); + } + if (Optional.IsDefined(MemberType)) + { + writer.WritePropertyName("memberType"u8); + writer.WriteStringValue(MemberType.Value.ToString()); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(ConditionVersion)) + { + writer.WritePropertyName("conditionVersion"u8); + writer.WriteStringValue(ConditionVersion); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(ExpandedProperties)) + { + writer.WritePropertyName("expandedProperties"u8); + if (ExpandedProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExpandedProperties).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentScheduleInstanceData DeserializeRoleAssignmentScheduleInstanceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +164,7 @@ internal static RoleAssignmentScheduleInstanceData DeserializeRoleAssignmentSche Optional conditionVersion = default; Optional createdOn = default; Optional expandedProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -221,8 +344,61 @@ internal static RoleAssignmentScheduleInstanceData DeserializeRoleAssignmentSche } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleAssignmentScheduleInstanceData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleAssignmentScheduleId.Value, originRoleAssignmentId.Value, Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), linkedRoleEligibilityScheduleId.Value, linkedRoleEligibilityScheduleInstanceId.Value, Optional.ToNullable(assignmentType), Optional.ToNullable(memberType), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), expandedProperties.Value, serializedAdditionalRawData); + } + + RoleAssignmentScheduleInstanceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleInstanceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleInstanceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleInstanceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleInstanceData model) + { + if (model is null) + { + return null; } - return new RoleAssignmentScheduleInstanceData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleAssignmentScheduleId.Value, originRoleAssignmentId.Value, Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), linkedRoleEligibilityScheduleId.Value, linkedRoleEligibilityScheduleInstanceId.Value, Optional.ToNullable(assignmentType), Optional.ToNullable(memberType), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), expandedProperties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleInstanceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleInstanceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.Serialization.cs index 7f5ce21a624c..ddfd9044eab9 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleAssignmentScheduleInstanceListResult + internal partial class RoleAssignmentScheduleInstanceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentScheduleInstanceListResult DeserializeRoleAssignmentScheduleInstanceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentScheduleInstanceListResult DeserializeRoleAssignmentScheduleInstanceListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleAssignmentScheduleInstanceListResult DeserializeRoleAssignme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentScheduleInstanceListResult(Optional.ToList(value), nextLink.Value); + return new RoleAssignmentScheduleInstanceListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleAssignmentScheduleInstanceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleInstanceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleInstanceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleInstanceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleInstanceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleInstanceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleInstanceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.cs index ceee39b097d5..016a81471643 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role assignment schedule instance list operation result. internal partial class RoleAssignmentScheduleInstanceListResult { - /// Initializes a new instance of RoleAssignmentScheduleInstanceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentScheduleInstanceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleAssignmentScheduleInstanceListResult. + /// Initializes a new instance of . /// Role assignment schedule instance list. /// The URL to use for getting the next set of results. - internal RoleAssignmentScheduleInstanceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleInstanceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role assignment schedule instance list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.Serialization.cs index 84de5feac240..3f0775537a07 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleAssignmentScheduleListResult + internal partial class RoleAssignmentScheduleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentScheduleListResult DeserializeRoleAssignmentScheduleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentScheduleListResult DeserializeRoleAssignmentScheduleListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleAssignmentScheduleListResult DeserializeRoleAssignmentSchedu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentScheduleListResult(Optional.ToList(value), nextLink.Value); + return new RoleAssignmentScheduleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleAssignmentScheduleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.cs index ae99c2438eff..d2e58a51b01b 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role assignment schedule list operation result. internal partial class RoleAssignmentScheduleListResult { - /// Initializes a new instance of RoleAssignmentScheduleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentScheduleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleAssignmentScheduleListResult. + /// Initializes a new instance of . /// Role assignment schedule list. /// The URL to use for getting the next set of results. - internal RoleAssignmentScheduleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role assignment schedule list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestData.Serialization.cs index ea6eef4a3bcc..204945102509 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleAssignmentScheduleRequestData : IUtf8JsonSerializable + public partial class RoleAssignmentScheduleRequestData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -58,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TicketInfo)) { writer.WritePropertyName("ticketInfo"u8); - writer.WriteObjectValue(TicketInfo); + if (TicketInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TicketInfo).Serialize(writer, options); + } } if (Optional.IsDefined(Condition)) { @@ -97,11 +111,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleAssignmentScheduleRequestData DeserializeRoleAssignmentScheduleRequestData(JsonElement element) + internal static RoleAssignmentScheduleRequestData DeserializeRoleAssignmentScheduleRequestData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -131,6 +159,7 @@ internal static RoleAssignmentScheduleRequestData DeserializeRoleAssignmentSched Optional type0 = default; Optional endDateTime = default; Optional duration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -362,8 +391,61 @@ internal static RoleAssignmentScheduleRequestData DeserializeRoleAssignmentSched } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleAssignmentScheduleRequestData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), Optional.ToNullable(requestType), Optional.ToNullable(status), approvalId.Value, targetRoleAssignmentScheduleId.Value, targetRoleAssignmentScheduleInstanceId.Value, linkedRoleEligibilityScheduleId.Value, justification.Value, ticketInfo.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(requestorId), expandedProperties.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(type0), Optional.ToNullable(endDateTime), Optional.ToNullable(duration), serializedAdditionalRawData); + } + + RoleAssignmentScheduleRequestData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleRequestData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleRequestData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleRequestData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleRequestData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleRequestData(Response response) + { + if (response is null) + { + return null; } - return new RoleAssignmentScheduleRequestData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), Optional.ToNullable(requestType), Optional.ToNullable(status), approvalId.Value, targetRoleAssignmentScheduleId.Value, targetRoleAssignmentScheduleInstanceId.Value, linkedRoleEligibilityScheduleId.Value, justification.Value, ticketInfo.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(requestorId), expandedProperties.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(type0), Optional.ToNullable(endDateTime), Optional.ToNullable(duration)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleRequestData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.Serialization.cs index ca3a4011f683..cfdb033af14e 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleAssignmentScheduleRequestListResult + internal partial class RoleAssignmentScheduleRequestListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentScheduleRequestListResult DeserializeRoleAssignmentScheduleRequestListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentScheduleRequestListResult DeserializeRoleAssignmentScheduleRequestListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleAssignmentScheduleRequestListResult DeserializeRoleAssignmen nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentScheduleRequestListResult(Optional.ToList(value), nextLink.Value); + return new RoleAssignmentScheduleRequestListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleAssignmentScheduleRequestListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleRequestListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleRequestListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleRequestListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleRequestListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleRequestListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleRequestListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.cs index 7e68f8500336..61e3ef3dcf4d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role assignment schedule request list operation result. internal partial class RoleAssignmentScheduleRequestListResult { - /// Initializes a new instance of RoleAssignmentScheduleRequestListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentScheduleRequestListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleAssignmentScheduleRequestListResult. + /// Initializes a new instance of . /// Role assignment schedule request list. /// The URL to use for getting the next set of results. - internal RoleAssignmentScheduleRequestListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleRequestListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role assignment schedule request list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.Serialization.cs index 0afd62052aed..840abca633be 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleAssignmentScheduleTicketInfo : IUtf8JsonSerializable + public partial class RoleAssignmentScheduleTicketInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TicketNumber)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ticketSystem"u8); writer.WriteStringValue(TicketSystem); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleAssignmentScheduleTicketInfo DeserializeRoleAssignmentScheduleTicketInfo(JsonElement element) + internal static RoleAssignmentScheduleTicketInfo DeserializeRoleAssignmentScheduleTicketInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ticketNumber = default; Optional ticketSystem = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ticketNumber"u8)) @@ -48,8 +71,61 @@ internal static RoleAssignmentScheduleTicketInfo DeserializeRoleAssignmentSchedu ticketSystem = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleAssignmentScheduleTicketInfo(ticketNumber.Value, ticketSystem.Value, serializedAdditionalRawData); + } + + RoleAssignmentScheduleTicketInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentScheduleTicketInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentScheduleTicketInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentScheduleTicketInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentScheduleTicketInfo model) + { + if (model is null) + { + return null; } - return new RoleAssignmentScheduleTicketInfo(ticketNumber.Value, ticketSystem.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentScheduleTicketInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentScheduleTicketInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.cs index 5377f5a8956c..4af9f752cced 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleAssignmentScheduleTicketInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// Ticket Info of the role assignment. public partial class RoleAssignmentScheduleTicketInfo { - /// Initializes a new instance of RoleAssignmentScheduleTicketInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleAssignmentScheduleTicketInfo() { } - /// Initializes a new instance of RoleAssignmentScheduleTicketInfo. + /// Initializes a new instance of . /// Ticket number for the role assignment. /// Ticket system name for the role assignment. - internal RoleAssignmentScheduleTicketInfo(string ticketNumber, string ticketSystem) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleTicketInfo(string ticketNumber, string ticketSystem, Dictionary serializedAdditionalRawData) { TicketNumber = ticketNumber; TicketSystem = ticketSystem; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Ticket number for the role assignment. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.Serialization.cs index 2ec231b0d7a9..3560b293c807 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleDefinitionListResult + internal partial class RoleDefinitionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleDefinitionListResult DeserializeRoleDefinitionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleDefinitionListResult DeserializeRoleDefinitionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleDefinitionListResult DeserializeRoleDefinitionListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleDefinitionListResult(Optional.ToList(value), nextLink.Value); + return new RoleDefinitionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleDefinitionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleDefinitionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleDefinitionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleDefinitionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleDefinitionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleDefinitionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleDefinitionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.cs index cad51f2535c7..085dedf50101 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role definition list operation result. internal partial class RoleDefinitionListResult { - /// Initializes a new instance of RoleDefinitionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleDefinitionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleDefinitionListResult. + /// Initializes a new instance of . /// Role definition list. /// The URL to use for getting the next set of results. - internal RoleDefinitionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleDefinitionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role definition list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.Serialization.cs index bcf2902e950e..f3c071c31c60 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleDefinitionPermission : IUtf8JsonSerializable + public partial class RoleDefinitionPermission : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Actions)) { @@ -56,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleDefinitionPermission DeserializeRoleDefinitionPermission(JsonElement element) + internal static RoleDefinitionPermission DeserializeRoleDefinitionPermission(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +90,7 @@ internal static RoleDefinitionPermission DeserializeRoleDefinitionPermission(Jso Optional> notActions = default; Optional> dataActions = default; Optional> notDataActions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actions"u8)) @@ -127,8 +149,61 @@ internal static RoleDefinitionPermission DeserializeRoleDefinitionPermission(Jso notDataActions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleDefinitionPermission(Optional.ToList(actions), Optional.ToList(notActions), Optional.ToList(dataActions), Optional.ToList(notDataActions), serializedAdditionalRawData); + } + + RoleDefinitionPermission IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleDefinitionPermission(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleDefinitionPermission IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleDefinitionPermission(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleDefinitionPermission model) + { + if (model is null) + { + return null; } - return new RoleDefinitionPermission(Optional.ToList(actions), Optional.ToList(notActions), Optional.ToList(dataActions), Optional.ToList(notDataActions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleDefinitionPermission(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleDefinitionPermission(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.cs index ab5f0b50483a..1f6aee41ae05 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermission.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Authorization.Models /// Role definition permissions. public partial class RoleDefinitionPermission { - /// Initializes a new instance of RoleDefinitionPermission. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleDefinitionPermission() { Actions = new ChangeTrackingList(); @@ -22,17 +26,19 @@ public RoleDefinitionPermission() NotDataActions = new ChangeTrackingList(); } - /// Initializes a new instance of RoleDefinitionPermission. + /// Initializes a new instance of . /// Allowed actions. /// Denied actions. /// Allowed Data actions. /// Denied Data actions. - internal RoleDefinitionPermission(IList actions, IList notActions, IList dataActions, IList notDataActions) + /// Keeps track of any properties unknown to the library. + internal RoleDefinitionPermission(IList actions, IList notActions, IList dataActions, IList notDataActions, Dictionary serializedAdditionalRawData) { Actions = actions; NotActions = notActions; DataActions = dataActions; NotDataActions = notDataActions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Allowed actions. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.Serialization.cs index 729b5217b5f9..4e6f45f7e4ee 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleDefinitionPermissionListResult + internal partial class RoleDefinitionPermissionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleDefinitionPermissionListResult DeserializeRoleDefinitionPermissionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleDefinitionPermissionListResult DeserializeRoleDefinitionPermissionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static RoleDefinitionPermissionListResult DeserializeRoleDefinitionPerm nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleDefinitionPermissionListResult(Optional.ToList(value), nextLink.Value); + return new RoleDefinitionPermissionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleDefinitionPermissionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleDefinitionPermissionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleDefinitionPermissionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleDefinitionPermissionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleDefinitionPermissionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleDefinitionPermissionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleDefinitionPermissionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.cs index 06634e8525b0..1a7f96551eb3 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleDefinitionPermissionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Permissions information. internal partial class RoleDefinitionPermissionListResult { - /// Initializes a new instance of RoleDefinitionPermissionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleDefinitionPermissionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleDefinitionPermissionListResult. + /// Initializes a new instance of . /// An array of permissions. /// The URL to use for getting the next set of results. - internal RoleDefinitionPermissionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleDefinitionPermissionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of permissions. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleData.Serialization.cs index f855132a3918..0b28c7116d51 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleData.Serialization.cs @@ -6,17 +6,124 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleEligibilityScheduleData + public partial class RoleEligibilityScheduleData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleEligibilityScheduleData DeserializeRoleEligibilityScheduleData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(RoleEligibilityScheduleRequestId)) + { + writer.WritePropertyName("roleEligibilityScheduleRequestId"u8); + writer.WriteStringValue(RoleEligibilityScheduleRequestId); + } + if (Optional.IsDefined(MemberType)) + { + writer.WritePropertyName("memberType"u8); + writer.WriteStringValue(MemberType.Value.ToString()); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(ConditionVersion)) + { + writer.WritePropertyName("conditionVersion"u8); + writer.WriteStringValue(ConditionVersion); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(UpdatedOn)) + { + writer.WritePropertyName("updatedOn"u8); + writer.WriteStringValue(UpdatedOn.Value, "O"); + } + if (Optional.IsDefined(ExpandedProperties)) + { + writer.WritePropertyName("expandedProperties"u8); + if (ExpandedProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExpandedProperties).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleEligibilityScheduleData DeserializeRoleEligibilityScheduleData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +146,7 @@ internal static RoleEligibilityScheduleData DeserializeRoleEligibilityScheduleDa Optional createdOn = default; Optional updatedOn = default; Optional expandedProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -191,8 +299,61 @@ internal static RoleEligibilityScheduleData DeserializeRoleEligibilityScheduleDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleEligibilityScheduleData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleEligibilityScheduleRequestId.Value, Optional.ToNullable(memberType), Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), expandedProperties.Value); + return new RoleEligibilityScheduleData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleEligibilityScheduleRequestId.Value, Optional.ToNullable(memberType), Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(updatedOn), expandedProperties.Value, serializedAdditionalRawData); + } + + RoleEligibilityScheduleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceData.Serialization.cs index 1c465ec8cbca..4b294d512db9 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceData.Serialization.cs @@ -6,17 +6,119 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleEligibilityScheduleInstanceData + public partial class RoleEligibilityScheduleInstanceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleEligibilityScheduleInstanceData DeserializeRoleEligibilityScheduleInstanceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(RoleEligibilityScheduleId)) + { + writer.WritePropertyName("roleEligibilityScheduleId"u8); + writer.WriteStringValue(RoleEligibilityScheduleId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(MemberType)) + { + writer.WritePropertyName("memberType"u8); + writer.WriteStringValue(MemberType.Value.ToString()); + } + if (Optional.IsDefined(Condition)) + { + writer.WritePropertyName("condition"u8); + writer.WriteStringValue(Condition); + } + if (Optional.IsDefined(ConditionVersion)) + { + writer.WritePropertyName("conditionVersion"u8); + writer.WriteStringValue(ConditionVersion); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(ExpandedProperties)) + { + writer.WritePropertyName("expandedProperties"u8); + if (ExpandedProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExpandedProperties).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleEligibilityScheduleInstanceData DeserializeRoleEligibilityScheduleInstanceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +140,7 @@ internal static RoleEligibilityScheduleInstanceData DeserializeRoleEligibilitySc Optional conditionVersion = default; Optional createdOn = default; Optional expandedProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -181,8 +284,61 @@ internal static RoleEligibilityScheduleInstanceData DeserializeRoleEligibilitySc } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleEligibilityScheduleInstanceData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleEligibilityScheduleId.Value, Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), Optional.ToNullable(memberType), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), expandedProperties.Value, serializedAdditionalRawData); + } + + RoleEligibilityScheduleInstanceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleInstanceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleInstanceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleInstanceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleInstanceData model) + { + if (model is null) + { + return null; } - return new RoleEligibilityScheduleInstanceData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), roleEligibilityScheduleId.Value, Optional.ToNullable(status), Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), Optional.ToNullable(memberType), condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), expandedProperties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleInstanceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleInstanceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.Serialization.cs index 4fb2d076200d..cd39d7c53b3f 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleEligibilityScheduleInstanceListResult + internal partial class RoleEligibilityScheduleInstanceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleEligibilityScheduleInstanceListResult DeserializeRoleEligibilityScheduleInstanceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleEligibilityScheduleInstanceListResult DeserializeRoleEligibilityScheduleInstanceListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleEligibilityScheduleInstanceListResult DeserializeRoleEligibi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleEligibilityScheduleInstanceListResult(Optional.ToList(value), nextLink.Value); + return new RoleEligibilityScheduleInstanceListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleEligibilityScheduleInstanceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleInstanceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleInstanceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleInstanceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleInstanceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleInstanceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleInstanceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.cs index 747a60fc8e2d..63c85b1ed4a6 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role eligibility schedule instance list operation result. internal partial class RoleEligibilityScheduleInstanceListResult { - /// Initializes a new instance of RoleEligibilityScheduleInstanceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleEligibilityScheduleInstanceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleEligibilityScheduleInstanceListResult. + /// Initializes a new instance of . /// Role eligibility schedule instance list. /// The URL to use for getting the next set of results. - internal RoleEligibilityScheduleInstanceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleInstanceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role eligibility schedule instance list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.Serialization.cs index c353168ad133..34c31d1f5ffd 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleEligibilityScheduleListResult + internal partial class RoleEligibilityScheduleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleEligibilityScheduleListResult DeserializeRoleEligibilityScheduleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleEligibilityScheduleListResult DeserializeRoleEligibilityScheduleListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleEligibilityScheduleListResult DeserializeRoleEligibilitySche nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleEligibilityScheduleListResult(Optional.ToList(value), nextLink.Value); + return new RoleEligibilityScheduleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleEligibilityScheduleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.cs index 7f49fa5e2c6c..eeb19454dc34 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// role eligibility schedule list operation result. internal partial class RoleEligibilityScheduleListResult { - /// Initializes a new instance of RoleEligibilityScheduleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleEligibilityScheduleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleEligibilityScheduleListResult. + /// Initializes a new instance of . /// role eligibility schedule list. /// The URL to use for getting the next set of results. - internal RoleEligibilityScheduleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// role eligibility schedule list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestData.Serialization.cs index e417f8316c30..a5080e89a591 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleEligibilityScheduleRequestData : IUtf8JsonSerializable + public partial class RoleEligibilityScheduleRequestData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -53,7 +60,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TicketInfo)) { writer.WritePropertyName("ticketInfo"u8); - writer.WriteObjectValue(TicketInfo); + if (TicketInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TicketInfo).Serialize(writer, options); + } } if (Optional.IsDefined(Condition)) { @@ -92,11 +106,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleEligibilityScheduleRequestData DeserializeRoleEligibilityScheduleRequestData(JsonElement element) + internal static RoleEligibilityScheduleRequestData DeserializeRoleEligibilityScheduleRequestData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -125,6 +153,7 @@ internal static RoleEligibilityScheduleRequestData DeserializeRoleEligibilitySch Optional type0 = default; Optional endDateTime = default; Optional duration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -347,8 +376,61 @@ internal static RoleEligibilityScheduleRequestData DeserializeRoleEligibilitySch } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleEligibilityScheduleRequestData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), Optional.ToNullable(requestType), Optional.ToNullable(status), approvalId.Value, targetRoleEligibilityScheduleId.Value, targetRoleEligibilityScheduleInstanceId.Value, justification.Value, ticketInfo.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(requestorId), expandedProperties.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(type0), Optional.ToNullable(endDateTime), Optional.ToNullable(duration), serializedAdditionalRawData); + } + + RoleEligibilityScheduleRequestData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleRequestData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleRequestData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleRequestData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleRequestData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleRequestData(Response response) + { + if (response is null) + { + return null; } - return new RoleEligibilityScheduleRequestData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, Optional.ToNullable(principalId), Optional.ToNullable(principalType), Optional.ToNullable(requestType), Optional.ToNullable(status), approvalId.Value, targetRoleEligibilityScheduleId.Value, targetRoleEligibilityScheduleInstanceId.Value, justification.Value, ticketInfo.Value, condition.Value, conditionVersion.Value, Optional.ToNullable(createdOn), Optional.ToNullable(requestorId), expandedProperties.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(type0), Optional.ToNullable(endDateTime), Optional.ToNullable(duration)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleRequestData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.Serialization.cs index da2516c7708b..46cd4e4d8bfd 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleEligibilityScheduleRequestListResult + internal partial class RoleEligibilityScheduleRequestListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleEligibilityScheduleRequestListResult DeserializeRoleEligibilityScheduleRequestListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleEligibilityScheduleRequestListResult DeserializeRoleEligibilityScheduleRequestListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleEligibilityScheduleRequestListResult DeserializeRoleEligibil nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleEligibilityScheduleRequestListResult(Optional.ToList(value), nextLink.Value); + return new RoleEligibilityScheduleRequestListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleEligibilityScheduleRequestListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleRequestListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleRequestListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleRequestListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleRequestListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleRequestListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleRequestListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.cs index 3877af0f85cd..fe27be33d5b3 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role eligibility schedule request list operation result. internal partial class RoleEligibilityScheduleRequestListResult { - /// Initializes a new instance of RoleEligibilityScheduleRequestListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleEligibilityScheduleRequestListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleEligibilityScheduleRequestListResult. + /// Initializes a new instance of . /// Role eligibility schedule request list. /// The URL to use for getting the next set of results. - internal RoleEligibilityScheduleRequestListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleRequestListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role eligibility schedule request list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.Serialization.cs index d5b8de9c084f..84ff3165bddf 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleEligibilityScheduleRequestPropertiesTicketInfo : IUtf8JsonSerializable + public partial class RoleEligibilityScheduleRequestPropertiesTicketInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TicketNumber)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ticketSystem"u8); writer.WriteStringValue(TicketSystem); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleEligibilityScheduleRequestPropertiesTicketInfo DeserializeRoleEligibilityScheduleRequestPropertiesTicketInfo(JsonElement element) + internal static RoleEligibilityScheduleRequestPropertiesTicketInfo DeserializeRoleEligibilityScheduleRequestPropertiesTicketInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ticketNumber = default; Optional ticketSystem = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ticketNumber"u8)) @@ -48,8 +71,61 @@ internal static RoleEligibilityScheduleRequestPropertiesTicketInfo DeserializeRo ticketSystem = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleEligibilityScheduleRequestPropertiesTicketInfo(ticketNumber.Value, ticketSystem.Value, serializedAdditionalRawData); + } + + RoleEligibilityScheduleRequestPropertiesTicketInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleEligibilityScheduleRequestPropertiesTicketInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleEligibilityScheduleRequestPropertiesTicketInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleEligibilityScheduleRequestPropertiesTicketInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleEligibilityScheduleRequestPropertiesTicketInfo model) + { + if (model is null) + { + return null; } - return new RoleEligibilityScheduleRequestPropertiesTicketInfo(ticketNumber.Value, ticketSystem.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleEligibilityScheduleRequestPropertiesTicketInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleEligibilityScheduleRequestPropertiesTicketInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs index b6f05641a2e9..bd52f2b0b544 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// Ticket Info of the role eligibility. public partial class RoleEligibilityScheduleRequestPropertiesTicketInfo { - /// Initializes a new instance of RoleEligibilityScheduleRequestPropertiesTicketInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleEligibilityScheduleRequestPropertiesTicketInfo() { } - /// Initializes a new instance of RoleEligibilityScheduleRequestPropertiesTicketInfo. + /// Initializes a new instance of . /// Ticket number for the role eligibility. /// Ticket system name for the role eligibility. - internal RoleEligibilityScheduleRequestPropertiesTicketInfo(string ticketNumber, string ticketSystem) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleRequestPropertiesTicketInfo(string ticketNumber, string ticketSystem, Dictionary serializedAdditionalRawData) { TicketNumber = ticketNumber; TicketSystem = ticketSystem; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Ticket number for the role eligibility. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.Serialization.cs index 31fca7a41268..0e7d307f4d8e 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementApprovalSettings : IUtf8JsonSerializable + public partial class RoleManagementApprovalSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsApprovalRequired)) { @@ -42,15 +49,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApprovalStages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleManagementApprovalSettings DeserializeRoleManagementApprovalSettings(JsonElement element) + internal static RoleManagementApprovalSettings DeserializeRoleManagementApprovalSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +88,7 @@ internal static RoleManagementApprovalSettings DeserializeRoleManagementApproval Optional isRequestorJustificationRequired = default; Optional approvalMode = default; Optional> approvalStages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isApprovalRequired"u8)) @@ -112,8 +141,61 @@ internal static RoleManagementApprovalSettings DeserializeRoleManagementApproval approvalStages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementApprovalSettings(Optional.ToNullable(isApprovalRequired), Optional.ToNullable(isApprovalRequiredForExtension), Optional.ToNullable(isRequestorJustificationRequired), Optional.ToNullable(approvalMode), Optional.ToList(approvalStages), serializedAdditionalRawData); + } + + RoleManagementApprovalSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementApprovalSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementApprovalSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementApprovalSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementApprovalSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementApprovalSettings(Response response) + { + if (response is null) + { + return null; } - return new RoleManagementApprovalSettings(Optional.ToNullable(isApprovalRequired), Optional.ToNullable(isApprovalRequiredForExtension), Optional.ToNullable(isRequestorJustificationRequired), Optional.ToNullable(approvalMode), Optional.ToList(approvalStages)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementApprovalSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.cs index 5196b135c0ad..c77d3d76dd5c 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.Authorization.Models /// The approval settings. public partial class RoleManagementApprovalSettings { - /// Initializes a new instance of RoleManagementApprovalSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleManagementApprovalSettings() { ApprovalStages = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementApprovalSettings. + /// Initializes a new instance of . /// Determines whether approval is required or not. /// Determines whether approval is required for assignment extension. /// Determine whether requestor justification is required. /// The type of rule. /// The approval stages of the request. - internal RoleManagementApprovalSettings(bool? isApprovalRequired, bool? isApprovalRequiredForExtension, bool? isRequestorJustificationRequired, RoleManagementApprovalMode? approvalMode, IList approvalStages) + /// Keeps track of any properties unknown to the library. + internal RoleManagementApprovalSettings(bool? isApprovalRequired, bool? isApprovalRequiredForExtension, bool? isRequestorJustificationRequired, RoleManagementApprovalMode? approvalMode, IList approvalStages, Dictionary serializedAdditionalRawData) { IsApprovalRequired = isApprovalRequired; IsApprovalRequiredForExtension = isApprovalRequiredForExtension; IsRequestorJustificationRequired = isRequestorJustificationRequired; ApprovalMode = approvalMode; ApprovalStages = approvalStages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Determines whether approval is required or not. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.Serialization.cs index fcd5b0f96adf..2d19196ef611 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementApprovalStage : IUtf8JsonSerializable + public partial class RoleManagementApprovalStage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ApprovalStageTimeOutInDays)) { @@ -37,7 +44,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PrimaryApprovers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,15 +66,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EscalationApprovers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleManagementApprovalStage DeserializeRoleManagementApprovalStage(JsonElement element) + internal static RoleManagementApprovalStage DeserializeRoleManagementApprovalStage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +106,7 @@ internal static RoleManagementApprovalStage DeserializeRoleManagementApprovalSta Optional> primaryApprovers = default; Optional isEscalationEnabled = default; Optional> escalationApprovers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("approvalStageTimeOutInDays"u8)) @@ -137,8 +173,61 @@ internal static RoleManagementApprovalStage DeserializeRoleManagementApprovalSta escalationApprovers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementApprovalStage(Optional.ToNullable(approvalStageTimeOutInDays), Optional.ToNullable(isApproverJustificationRequired), Optional.ToNullable(escalationTimeInMinutes), Optional.ToList(primaryApprovers), Optional.ToNullable(isEscalationEnabled), Optional.ToList(escalationApprovers), serializedAdditionalRawData); + } + + RoleManagementApprovalStage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementApprovalStage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementApprovalStage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementApprovalStage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementApprovalStage model) + { + if (model is null) + { + return null; } - return new RoleManagementApprovalStage(Optional.ToNullable(approvalStageTimeOutInDays), Optional.ToNullable(isApproverJustificationRequired), Optional.ToNullable(escalationTimeInMinutes), Optional.ToList(primaryApprovers), Optional.ToNullable(isEscalationEnabled), Optional.ToList(escalationApprovers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementApprovalStage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementApprovalStage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.cs index 200a8c228433..f586759a4087 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementApprovalStage.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,25 @@ namespace Azure.ResourceManager.Authorization.Models /// The approval stage. public partial class RoleManagementApprovalStage { - /// Initializes a new instance of RoleManagementApprovalStage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleManagementApprovalStage() { PrimaryApprovers = new ChangeTrackingList(); EscalationApprovers = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementApprovalStage. + /// Initializes a new instance of . /// The time in days when approval request would be timed out. /// Determines whether approver need to provide justification for his decision. /// The time in minutes when the approval request would be escalated if the primary approver does not approve. /// The primary approver of the request. /// The value determine whether escalation feature is enabled. /// The escalation approver of the request. - internal RoleManagementApprovalStage(int? approvalStageTimeOutInDays, bool? isApproverJustificationRequired, int? escalationTimeInMinutes, IList primaryApprovers, bool? isEscalationEnabled, IList escalationApprovers) + /// Keeps track of any properties unknown to the library. + internal RoleManagementApprovalStage(int? approvalStageTimeOutInDays, bool? isApproverJustificationRequired, int? escalationTimeInMinutes, IList primaryApprovers, bool? isEscalationEnabled, IList escalationApprovers, Dictionary serializedAdditionalRawData) { ApprovalStageTimeOutInDays = approvalStageTimeOutInDays; IsApproverJustificationRequired = isApproverJustificationRequired; @@ -35,6 +40,7 @@ internal RoleManagementApprovalStage(int? approvalStageTimeOutInDays, bool? isAp PrimaryApprovers = primaryApprovers; IsEscalationEnabled = isEscalationEnabled; EscalationApprovers = escalationApprovers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The time in days when approval request would be timed out. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.Serialization.cs index 71dfe6b8bed1..6e9b264f9acb 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.Serialization.cs @@ -6,15 +6,101 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementExpandedProperties + public partial class RoleManagementExpandedProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleManagementExpandedProperties DeserializeRoleManagementExpandedProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("principal"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(PrincipalDisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(PrincipalDisplayName); + } + if (Optional.IsDefined(Email)) + { + writer.WritePropertyName("email"u8); + writer.WriteStringValue(Email); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + writer.WriteEndObject(); + writer.WritePropertyName("roleDefinition"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(RoleDefinitionDisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(RoleDefinitionDisplayName); + } + if (Optional.IsDefined(RoleType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RoleType.Value.ToString()); + } + writer.WriteEndObject(); + writer.WritePropertyName("scope"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ScopeId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(ScopeId); + } + if (Optional.IsDefined(ScopeDisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(ScopeDisplayName); + } + if (Optional.IsDefined(ScopeType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ScopeType.Value.ToString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleManagementExpandedProperties DeserializeRoleManagementExpandedProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +115,7 @@ internal static RoleManagementExpandedProperties DeserializeRoleManagementExpand Optional id1 = default; Optional displayName1 = default; Optional type1 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("principal"u8)) @@ -141,8 +228,61 @@ internal static RoleManagementExpandedProperties DeserializeRoleManagementExpand } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleManagementExpandedProperties(Optional.ToNullable(id), displayName.Value, email.Value, Optional.ToNullable(type), id0.Value, displayName0.Value, Optional.ToNullable(type0), id1.Value, displayName1.Value, Optional.ToNullable(type1)); + return new RoleManagementExpandedProperties(Optional.ToNullable(id), displayName.Value, email.Value, Optional.ToNullable(type), id0.Value, displayName0.Value, Optional.ToNullable(type0), id1.Value, displayName1.Value, Optional.ToNullable(type1), serializedAdditionalRawData); + } + + RoleManagementExpandedProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementExpandedProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementExpandedProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementExpandedProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementExpandedProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementExpandedProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementExpandedProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.cs index 47c79d74ee80..82aa99bce13f 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementExpandedProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Authorization.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Authorization.Models /// The RoleManagementExpandedProperties. public partial class RoleManagementExpandedProperties { - /// Initializes a new instance of RoleManagementExpandedProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleManagementExpandedProperties() { } - /// Initializes a new instance of RoleManagementExpandedProperties. + /// Initializes a new instance of . /// Id of the principal. /// Display name of the principal. /// Email id of the principal. @@ -29,7 +33,8 @@ internal RoleManagementExpandedProperties() /// Scope id of the resource. /// Display name of the resource. /// Type of the scope. - internal RoleManagementExpandedProperties(Guid? principalId, string principalDisplayName, string email, RoleManagementPrincipalType? principalType, ResourceIdentifier roleDefinitionId, string roleDefinitionDisplayName, AuthorizationRoleType? roleType, ResourceIdentifier scopeId, string scopeDisplayName, RoleManagementScopeType? scopeType) + /// Keeps track of any properties unknown to the library. + internal RoleManagementExpandedProperties(Guid? principalId, string principalDisplayName, string email, RoleManagementPrincipalType? principalType, ResourceIdentifier roleDefinitionId, string roleDefinitionDisplayName, AuthorizationRoleType? roleType, ResourceIdentifier scopeId, string scopeDisplayName, RoleManagementScopeType? scopeType, Dictionary serializedAdditionalRawData) { PrincipalId = principalId; PrincipalDisplayName = principalDisplayName; @@ -41,6 +46,7 @@ internal RoleManagementExpandedProperties(Guid? principalId, string principalDis ScopeId = scopeId; ScopeDisplayName = scopeDisplayName; ScopeType = scopeType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of the principal. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.Serialization.cs index 0bfb3c119507..cb2f1c2e2883 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyApprovalRule : IUtf8JsonSerializable + public partial class RoleManagementPolicyApprovalRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Settings)) { writer.WritePropertyName("setting"u8); - writer.WriteObjectValue(Settings); + if (Settings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Settings).Serialize(writer, options); + } } if (Optional.IsDefined(Id)) { @@ -30,13 +45,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RoleManagementPolicyApprovalRule DeserializeRoleManagementPolicyApprovalRule(JsonElement element) + internal static RoleManagementPolicyApprovalRule DeserializeRoleManagementPolicyApprovalRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +81,7 @@ internal static RoleManagementPolicyApprovalRule DeserializeRoleManagementPolicy Optional id = default; RoleManagementPolicyRuleType ruleType = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("setting"u8)) @@ -75,8 +112,61 @@ internal static RoleManagementPolicyApprovalRule DeserializeRoleManagementPolicy target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyApprovalRule(id.Value, ruleType, target.Value, setting.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyApprovalRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyApprovalRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyApprovalRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyApprovalRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyApprovalRule model) + { + if (model is null) + { + return null; } - return new RoleManagementPolicyApprovalRule(id.Value, ruleType, target.Value, setting.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyApprovalRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyApprovalRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs index 0dfab0779d47..4a342cd92f7d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs @@ -5,23 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// The role management policy approval rule. public partial class RoleManagementPolicyApprovalRule : RoleManagementPolicyRule { - /// Initializes a new instance of RoleManagementPolicyApprovalRule. + /// Initializes a new instance of . public RoleManagementPolicyApprovalRule() { RuleType = RoleManagementPolicyRuleType.RoleManagementPolicyApprovalRule; } - /// Initializes a new instance of RoleManagementPolicyApprovalRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. /// The approval setting. - internal RoleManagementPolicyApprovalRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, RoleManagementApprovalSettings settings) : base(id, ruleType, target) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyApprovalRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, RoleManagementApprovalSettings settings, Dictionary serializedAdditionalRawData) : base(id, ruleType, target, serializedAdditionalRawData) { Settings = settings; RuleType = ruleType; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentData.Serialization.cs index 650698e3ef80..0bdd5cae4a7c 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleManagementPolicyAssignmentData : IUtf8JsonSerializable + public partial class RoleManagementPolicyAssignmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PolicyId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleManagementPolicyAssignmentData DeserializeRoleManagementPolicyAssignmentData(JsonElement element) + internal static RoleManagementPolicyAssignmentData DeserializeRoleManagementPolicyAssignmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +75,7 @@ internal static RoleManagementPolicyAssignmentData DeserializeRoleManagementPoli Optional policyId = default; Optional> effectiveRules = default; Optional policyAssignmentProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -138,8 +160,61 @@ internal static RoleManagementPolicyAssignmentData DeserializeRoleManagementPoli } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyAssignmentData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, policyId.Value, Optional.ToList(effectiveRules), policyAssignmentProperties.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyAssignmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyAssignmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyAssignmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyAssignmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyAssignmentData model) + { + if (model is null) + { + return null; } - return new RoleManagementPolicyAssignmentData(id, name, type, systemData.Value, scope.Value, roleDefinitionId.Value, policyId.Value, Optional.ToList(effectiveRules), policyAssignmentProperties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyAssignmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyAssignmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.Serialization.cs index c3b313583b8c..34c229d6c6f0 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleManagementPolicyAssignmentListResult + internal partial class RoleManagementPolicyAssignmentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleManagementPolicyAssignmentListResult DeserializeRoleManagementPolicyAssignmentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleManagementPolicyAssignmentListResult DeserializeRoleManagementPolicyAssignmentListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleManagementPolicyAssignmentListResult DeserializeRoleManageme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleManagementPolicyAssignmentListResult(Optional.ToList(value), nextLink.Value); + return new RoleManagementPolicyAssignmentListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyAssignmentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyAssignmentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyAssignmentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyAssignmentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyAssignmentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyAssignmentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyAssignmentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.cs index 82ad15ebe3bb..46c02879c952 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAssignmentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role management policy assignment list operation result. internal partial class RoleManagementPolicyAssignmentListResult { - /// Initializes a new instance of RoleManagementPolicyAssignmentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleManagementPolicyAssignmentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementPolicyAssignmentListResult. + /// Initializes a new instance of . /// Role management policy assignment list. /// The URL to use for getting the next set of results. - internal RoleManagementPolicyAssignmentListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyAssignmentListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role management policy assignment list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.Serialization.cs index 12978f17614e..532d94b363a4 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyAuthenticationContextRule : IUtf8JsonSerializable + public partial class RoleManagementPolicyAuthenticationContextRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -35,13 +43,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RoleManagementPolicyAuthenticationContextRule DeserializeRoleManagementPolicyAuthenticationContextRule(JsonElement element) + internal static RoleManagementPolicyAuthenticationContextRule DeserializeRoleManagementPolicyAuthenticationContextRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +80,7 @@ internal static RoleManagementPolicyAuthenticationContextRule DeserializeRoleMan Optional id = default; RoleManagementPolicyRuleType ruleType = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isEnabled"u8)) @@ -86,8 +116,61 @@ internal static RoleManagementPolicyAuthenticationContextRule DeserializeRoleMan target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyAuthenticationContextRule(id.Value, ruleType, target.Value, Optional.ToNullable(isEnabled), claimValue.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyAuthenticationContextRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyAuthenticationContextRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyAuthenticationContextRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyAuthenticationContextRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyAuthenticationContextRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyAuthenticationContextRule(Response response) + { + if (response is null) + { + return null; } - return new RoleManagementPolicyAuthenticationContextRule(id.Value, ruleType, target.Value, Optional.ToNullable(isEnabled), claimValue.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyAuthenticationContextRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs index 96440de82865..07004c658e30 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs @@ -5,24 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// The role management policy authentication context rule. public partial class RoleManagementPolicyAuthenticationContextRule : RoleManagementPolicyRule { - /// Initializes a new instance of RoleManagementPolicyAuthenticationContextRule. + /// Initializes a new instance of . public RoleManagementPolicyAuthenticationContextRule() { RuleType = RoleManagementPolicyRuleType.RoleManagementPolicyAuthenticationContextRule; } - /// Initializes a new instance of RoleManagementPolicyAuthenticationContextRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. /// The value indicating if rule is enabled. /// The claim value. - internal RoleManagementPolicyAuthenticationContextRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, bool? isEnabled, string claimValue) : base(id, ruleType, target) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyAuthenticationContextRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, bool? isEnabled, string claimValue, Dictionary serializedAdditionalRawData) : base(id, ruleType, target, serializedAdditionalRawData) { IsEnabled = isEnabled; ClaimValue = claimValue; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyData.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyData.Serialization.cs index bbef19f623c0..6e76658850e5 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyData.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Authorization { - public partial class RoleManagementPolicyData : IUtf8JsonSerializable + public partial class RoleManagementPolicyData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -47,16 +53,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleManagementPolicyData DeserializeRoleManagementPolicyData(JsonElement element) + internal static RoleManagementPolicyData DeserializeRoleManagementPolicyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +101,7 @@ internal static RoleManagementPolicyData DeserializeRoleManagementPolicyData(Jso Optional> rules = default; Optional> effectiveRules = default; Optional policyProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -191,8 +219,61 @@ internal static RoleManagementPolicyData DeserializeRoleManagementPolicyData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyData(id, name, type, systemData.Value, scope.Value, displayName.Value, description.Value, Optional.ToNullable(isOrganizationDefault), lastModifiedBy.Value, Optional.ToNullable(lastModifiedDateTime), Optional.ToList(rules), Optional.ToList(effectiveRules), policyProperties.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyData(Response response) + { + if (response is null) + { + return null; } - return new RoleManagementPolicyData(id, name, type, systemData.Value, scope.Value, displayName.Value, description.Value, Optional.ToNullable(isOrganizationDefault), lastModifiedBy.Value, Optional.ToNullable(lastModifiedDateTime), Optional.ToList(rules), Optional.ToList(effectiveRules), policyProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.Serialization.cs index d78a8f34ffd6..8ded0fc14bb0 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyEnablementRule : IUtf8JsonSerializable + public partial class RoleManagementPolicyEnablementRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(EnablementRules)) { @@ -36,13 +43,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RoleManagementPolicyEnablementRule DeserializeRoleManagementPolicyEnablementRule(JsonElement element) + internal static RoleManagementPolicyEnablementRule DeserializeRoleManagementPolicyEnablementRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +79,7 @@ internal static RoleManagementPolicyEnablementRule DeserializeRoleManagementPoli Optional id = default; RoleManagementPolicyRuleType ruleType = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabledRules"u8)) @@ -86,8 +115,61 @@ internal static RoleManagementPolicyEnablementRule DeserializeRoleManagementPoli target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyEnablementRule(id.Value, ruleType, target.Value, Optional.ToList(enabledRules), serializedAdditionalRawData); + } + + RoleManagementPolicyEnablementRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyEnablementRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyEnablementRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyEnablementRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyEnablementRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyEnablementRule(Response response) + { + if (response is null) + { + return null; } - return new RoleManagementPolicyEnablementRule(id.Value, ruleType, target.Value, Optional.ToList(enabledRules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyEnablementRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs index 7e303e35005a..97d7d9936692 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,20 @@ namespace Azure.ResourceManager.Authorization.Models /// The role management policy enablement rule. public partial class RoleManagementPolicyEnablementRule : RoleManagementPolicyRule { - /// Initializes a new instance of RoleManagementPolicyEnablementRule. + /// Initializes a new instance of . public RoleManagementPolicyEnablementRule() { EnablementRules = new ChangeTrackingList(); RuleType = RoleManagementPolicyRuleType.RoleManagementPolicyEnablementRule; } - /// Initializes a new instance of RoleManagementPolicyEnablementRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. /// The list of enabled rules. - internal RoleManagementPolicyEnablementRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, IList enablementRules) : base(id, ruleType, target) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyEnablementRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, IList enablementRules, Dictionary serializedAdditionalRawData) : base(id, ruleType, target, serializedAdditionalRawData) { EnablementRules = enablementRules; RuleType = ruleType; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.Serialization.cs index 095519b31fcf..684b5d39a67f 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyExpirationRule : IUtf8JsonSerializable + public partial class RoleManagementPolicyExpirationRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsExpirationRequired)) { @@ -36,13 +43,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RoleManagementPolicyExpirationRule DeserializeRoleManagementPolicyExpirationRule(JsonElement element) + internal static RoleManagementPolicyExpirationRule DeserializeRoleManagementPolicyExpirationRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static RoleManagementPolicyExpirationRule DeserializeRoleManagementPoli Optional id = default; RoleManagementPolicyRuleType ruleType = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isExpirationRequired"u8)) @@ -91,8 +120,61 @@ internal static RoleManagementPolicyExpirationRule DeserializeRoleManagementPoli target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyExpirationRule(id.Value, ruleType, target.Value, Optional.ToNullable(isExpirationRequired), Optional.ToNullable(maximumDuration), serializedAdditionalRawData); + } + + RoleManagementPolicyExpirationRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyExpirationRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyExpirationRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyExpirationRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyExpirationRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyExpirationRule(Response response) + { + if (response is null) + { + return null; } - return new RoleManagementPolicyExpirationRule(id.Value, ruleType, target.Value, Optional.ToNullable(isExpirationRequired), Optional.ToNullable(maximumDuration)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyExpirationRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs index fe25a6f60db9..df722a5bc741 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs @@ -6,25 +6,27 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Authorization.Models { /// The role management policy expiration rule. public partial class RoleManagementPolicyExpirationRule : RoleManagementPolicyRule { - /// Initializes a new instance of RoleManagementPolicyExpirationRule. + /// Initializes a new instance of . public RoleManagementPolicyExpirationRule() { RuleType = RoleManagementPolicyRuleType.RoleManagementPolicyExpirationRule; } - /// Initializes a new instance of RoleManagementPolicyExpirationRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. /// The value indicating whether expiration is required. /// The maximum duration of expiration in timespan. - internal RoleManagementPolicyExpirationRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, bool? isExpirationRequired, TimeSpan? maximumDuration) : base(id, ruleType, target) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyExpirationRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, bool? isExpirationRequired, TimeSpan? maximumDuration, Dictionary serializedAdditionalRawData) : base(id, ruleType, target, serializedAdditionalRawData) { IsExpirationRequired = isExpirationRequired; MaximumDuration = maximumDuration; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.Serialization.cs index 8210c73da29c..4892f54c1eff 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Authorization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class RoleManagementPolicyListResult + internal partial class RoleManagementPolicyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleManagementPolicyListResult DeserializeRoleManagementPolicyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleManagementPolicyListResult DeserializeRoleManagementPolicyListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleManagementPolicyListResult DeserializeRoleManagementPolicyLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleManagementPolicyListResult(Optional.ToList(value), nextLink.Value); + return new RoleManagementPolicyListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.cs index 2ef952b08036..4553ba016430 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Authorization.Models /// Role management policy list operation result. internal partial class RoleManagementPolicyListResult { - /// Initializes a new instance of RoleManagementPolicyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleManagementPolicyListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementPolicyListResult. + /// Initializes a new instance of . /// Role management policy list. /// The URL to use for getting the next set of results. - internal RoleManagementPolicyListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role management policy list. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.Serialization.cs index bc0521a8daaf..d4835aff3b07 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyNotificationRule : IUtf8JsonSerializable + public partial class RoleManagementPolicyNotificationRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NotificationDeliveryType)) { @@ -56,13 +63,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RoleManagementPolicyNotificationRule DeserializeRoleManagementPolicyNotificationRule(JsonElement element) + internal static RoleManagementPolicyNotificationRule DeserializeRoleManagementPolicyNotificationRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +103,7 @@ internal static RoleManagementPolicyNotificationRule DeserializeRoleManagementPo Optional id = default; RoleManagementPolicyRuleType ruleType = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("notificationType"u8)) @@ -146,8 +175,61 @@ internal static RoleManagementPolicyNotificationRule DeserializeRoleManagementPo target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyNotificationRule(id.Value, ruleType, target.Value, Optional.ToNullable(notificationType), Optional.ToNullable(notificationLevel), Optional.ToNullable(recipientType), Optional.ToList(notificationRecipients), Optional.ToNullable(isDefaultRecipientsEnabled), serializedAdditionalRawData); + } + + RoleManagementPolicyNotificationRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyNotificationRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyNotificationRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyNotificationRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyNotificationRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyNotificationRule(Response response) + { + if (response is null) + { + return null; } - return new RoleManagementPolicyNotificationRule(id.Value, ruleType, target.Value, Optional.ToNullable(notificationType), Optional.ToNullable(notificationLevel), Optional.ToNullable(recipientType), Optional.ToList(notificationRecipients), Optional.ToNullable(isDefaultRecipientsEnabled)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyNotificationRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs index 39dc8d02ff64..7041da340140 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,14 @@ namespace Azure.ResourceManager.Authorization.Models /// The role management policy notification rule. public partial class RoleManagementPolicyNotificationRule : RoleManagementPolicyRule { - /// Initializes a new instance of RoleManagementPolicyNotificationRule. + /// Initializes a new instance of . public RoleManagementPolicyNotificationRule() { NotificationRecipients = new ChangeTrackingList(); RuleType = RoleManagementPolicyRuleType.RoleManagementPolicyNotificationRule; } - /// Initializes a new instance of RoleManagementPolicyNotificationRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. @@ -29,7 +30,8 @@ public RoleManagementPolicyNotificationRule() /// The recipient type. /// The list of notification recipients. /// Determines if the notification will be sent to the recipient type specified in the policy rule. - internal RoleManagementPolicyNotificationRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, NotificationDeliveryType? notificationDeliveryType, RoleManagementPolicyNotificationLevel? notificationLevel, RoleManagementPolicyRecipientType? recipientType, IList notificationRecipients, bool? areDefaultRecipientsEnabled) : base(id, ruleType, target) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyNotificationRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, NotificationDeliveryType? notificationDeliveryType, RoleManagementPolicyNotificationLevel? notificationLevel, RoleManagementPolicyRecipientType? recipientType, IList notificationRecipients, bool? areDefaultRecipientsEnabled, Dictionary serializedAdditionalRawData) : base(id, ruleType, target, serializedAdditionalRawData) { NotificationDeliveryType = notificationDeliveryType; NotificationLevel = notificationLevel; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.Serialization.cs index db178776bd47..815121a937a0 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.Serialization.cs @@ -5,15 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyProperties + public partial class RoleManagementPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleManagementPolicyProperties DeserializeRoleManagementPolicyProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("scope"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ScopeId)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(ScopeId); + } + if (Optional.IsDefined(ScopeDisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(ScopeDisplayName); + } + if (Optional.IsDefined(ScopeType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ScopeType.Value.ToString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleManagementPolicyProperties DeserializeRoleManagementPolicyProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +67,7 @@ internal static RoleManagementPolicyProperties DeserializeRoleManagementPolicyPr Optional id = default; Optional displayName = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scope"u8)) @@ -58,8 +105,61 @@ internal static RoleManagementPolicyProperties DeserializeRoleManagementPolicyPr } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleManagementPolicyProperties(id.Value, displayName.Value, Optional.ToNullable(type)); + return new RoleManagementPolicyProperties(id.Value, displayName.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + RoleManagementPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.cs index 2f51bab9a3b4..cf45046bd878 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Authorization.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.Authorization.Models /// Expanded info of resource scope. public partial class RoleManagementPolicyProperties { - /// Initializes a new instance of RoleManagementPolicyProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleManagementPolicyProperties() { } - /// Initializes a new instance of RoleManagementPolicyProperties. + /// Initializes a new instance of . /// Scope id of the resource. /// Display name of the resource. /// Type of the scope. - internal RoleManagementPolicyProperties(ResourceIdentifier scopeId, string scopeDisplayName, RoleManagementScopeType? scopeType) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyProperties(ResourceIdentifier scopeId, string scopeDisplayName, RoleManagementScopeType? scopeType, Dictionary serializedAdditionalRawData) { ScopeId = scopeId; ScopeDisplayName = scopeDisplayName; ScopeType = scopeType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scope id of the resource. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.Serialization.cs index 41179d502830..6467f7515648 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyRule : IUtf8JsonSerializable + public partial class RoleManagementPolicyRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -25,13 +33,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RoleManagementPolicyRule DeserializeRoleManagementPolicyRule(JsonElement element) + internal static RoleManagementPolicyRule DeserializeRoleManagementPolicyRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,7 +76,88 @@ internal static RoleManagementPolicyRule DeserializeRoleManagementPolicyRule(Jso case "RoleManagementPolicyNotificationRule": return RoleManagementPolicyNotificationRule.DeserializeRoleManagementPolicyNotificationRule(element); } } - return UnknownRoleManagementPolicyRule.DeserializeUnknownRoleManagementPolicyRule(element); + + // Unknown type found so we will deserialize the base properties only + Optional id = default; + RoleManagementPolicyRuleType ruleType = default; + Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("ruleType"u8)) + { + ruleType = new RoleManagementPolicyRuleType(property.Value.GetString()); + continue; + } + if (property.NameEquals("target"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownRoleManagementPolicyRule(id.Value, ruleType, target.Value, serializedAdditionalRawData); + } + + RoleManagementPolicyRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs index 6c47a0d68763..9ad11d3fc92d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Authorization.Models { /// @@ -12,22 +16,28 @@ namespace Azure.ResourceManager.Authorization.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// + [DeserializationProxy(typeof(UnknownRoleManagementPolicyRule))] public abstract partial class RoleManagementPolicyRule { - /// Initializes a new instance of RoleManagementPolicyRule. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected RoleManagementPolicyRule() { } - /// Initializes a new instance of RoleManagementPolicyRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. - internal RoleManagementPolicyRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, Dictionary serializedAdditionalRawData) { Id = id; RuleType = ruleType; Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the rule. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.Serialization.cs index 81cc8984b1ed..c24638dedab2 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPolicyRuleTarget : IUtf8JsonSerializable + public partial class RoleManagementPolicyRuleTarget : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Caller)) { @@ -66,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleManagementPolicyRuleTarget DeserializeRoleManagementPolicyRuleTarget(JsonElement element) + internal static RoleManagementPolicyRuleTarget DeserializeRoleManagementPolicyRuleTarget(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +102,7 @@ internal static RoleManagementPolicyRuleTarget DeserializeRoleManagementPolicyRu Optional> targetObjects = default; Optional> inheritableSettings = default; Optional> enforcedSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("caller"u8)) @@ -153,8 +175,61 @@ internal static RoleManagementPolicyRuleTarget DeserializeRoleManagementPolicyRu enforcedSettings = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementPolicyRuleTarget(caller.Value, Optional.ToList(operations), Optional.ToNullable(level), Optional.ToList(targetObjects), Optional.ToList(inheritableSettings), Optional.ToList(enforcedSettings), serializedAdditionalRawData); + } + + RoleManagementPolicyRuleTarget IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPolicyRuleTarget(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyRuleTarget IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyRuleTarget(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPolicyRuleTarget model) + { + if (model is null) + { + return null; } - return new RoleManagementPolicyRuleTarget(caller.Value, Optional.ToList(operations), Optional.ToNullable(level), Optional.ToList(targetObjects), Optional.ToList(inheritableSettings), Optional.ToList(enforcedSettings)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPolicyRuleTarget(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPolicyRuleTarget(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs index 7ca89f1f2f85..31f2e12e4841 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Authorization.Models /// The role management policy rule target. public partial class RoleManagementPolicyRuleTarget { - /// Initializes a new instance of RoleManagementPolicyRuleTarget. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleManagementPolicyRuleTarget() { Operations = new ChangeTrackingList(); @@ -22,14 +26,15 @@ public RoleManagementPolicyRuleTarget() EnforcedSettings = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementPolicyRuleTarget. + /// Initializes a new instance of . /// The caller of the setting. /// The type of operation. /// The assignment level to which rule is applied. /// The list of target objects. /// The list of inheritable settings. /// The list of enforced settings. - internal RoleManagementPolicyRuleTarget(string caller, IList operations, RoleManagementAssignmentLevel? level, IList targetObjects, IList inheritableSettings, IList enforcedSettings) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyRuleTarget(string caller, IList operations, RoleManagementAssignmentLevel? level, IList targetObjects, IList inheritableSettings, IList enforcedSettings, Dictionary serializedAdditionalRawData) { Caller = caller; Operations = operations; @@ -37,6 +42,7 @@ internal RoleManagementPolicyRuleTarget(string caller, IList operations, TargetObjects = targetObjects; InheritableSettings = inheritableSettings; EnforcedSettings = enforcedSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The caller of the setting. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.Serialization.cs index 2d609832b706..fae2da35deeb 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementPrincipal + public partial class RoleManagementPrincipal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleManagementPrincipal DeserializeRoleManagementPrincipal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(Email)) + { + writer.WritePropertyName("email"u8); + writer.WriteStringValue(Email); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleManagementPrincipal DeserializeRoleManagementPrincipal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static RoleManagementPrincipal DeserializeRoleManagementPrincipal(JsonE Optional displayName = default; Optional type = default; Optional email = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -48,8 +97,61 @@ internal static RoleManagementPrincipal DeserializeRoleManagementPrincipal(JsonE email = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleManagementPrincipal(id.Value, displayName.Value, Optional.ToNullable(type), email.Value); + return new RoleManagementPrincipal(id.Value, displayName.Value, Optional.ToNullable(type), email.Value, serializedAdditionalRawData); + } + + RoleManagementPrincipal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementPrincipal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPrincipal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPrincipal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementPrincipal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementPrincipal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementPrincipal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.cs index 6b9dc1e9f4d6..f247247f6ca2 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementPrincipal.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// The name of the entity last modified it. public partial class RoleManagementPrincipal { - /// Initializes a new instance of RoleManagementPrincipal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleManagementPrincipal() { } - /// Initializes a new instance of RoleManagementPrincipal. + /// Initializes a new instance of . /// The id of the principal made changes. /// The name of the principal made changes. /// Type of the principal. /// Email of principal. - internal RoleManagementPrincipal(string id, string displayName, RoleManagementPrincipalType? principalType, string email) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPrincipal(string id, string displayName, RoleManagementPrincipalType? principalType, string email, Dictionary serializedAdditionalRawData) { Id = id; DisplayName = displayName; PrincipalType = principalType; Email = email; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the principal made changes. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.Serialization.cs index a5cacf4ec48d..2ec5c42c4b64 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - public partial class RoleManagementUserInfo : IUtf8JsonSerializable + public partial class RoleManagementUserInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserType)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleManagementUserInfo DeserializeRoleManagementUserInfo(JsonElement element) + internal static RoleManagementUserInfo DeserializeRoleManagementUserInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static RoleManagementUserInfo DeserializeRoleManagementUserInfo(JsonEle Optional isBackup = default; Optional id = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userType"u8)) @@ -78,8 +101,61 @@ internal static RoleManagementUserInfo DeserializeRoleManagementUserInfo(JsonEle description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleManagementUserInfo(Optional.ToNullable(userType), Optional.ToNullable(isBackup), id.Value, description.Value, serializedAdditionalRawData); + } + + RoleManagementUserInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleManagementUserInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementUserInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementUserInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleManagementUserInfo model) + { + if (model is null) + { + return null; } - return new RoleManagementUserInfo(Optional.ToNullable(userType), Optional.ToNullable(isBackup), id.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleManagementUserInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleManagementUserInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.cs index 1ae63d0c7fa1..fa26c99fa88e 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/RoleManagementUserInfo.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// The detail of a user. public partial class RoleManagementUserInfo { - /// Initializes a new instance of RoleManagementUserInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleManagementUserInfo() { } - /// Initializes a new instance of RoleManagementUserInfo. + /// Initializes a new instance of . /// The type of user. /// The value indicating whether the user is a backup fallback approver. /// The object id of the user. /// The description of the user. - internal RoleManagementUserInfo(RoleManagementUserType? userType, bool? isBackup, string id, string description) + /// Keeps track of any properties unknown to the library. + internal RoleManagementUserInfo(RoleManagementUserType? userType, bool? isBackup, string id, string description, Dictionary serializedAdditionalRawData) { UserType = userType; IsBackup = isBackup; Id = id; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of user. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.Serialization.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.Serialization.cs index a513666b5740..eaf78716de5d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.Serialization.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Authorization.Models { - internal partial class UnknownRoleManagementPolicyRule : IUtf8JsonSerializable + internal partial class UnknownRoleManagementPolicyRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -25,43 +31,53 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Target)) { writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); - } - writer.WriteEndObject(); - } - - internal static UnknownRoleManagementPolicyRule DeserializeUnknownRoleManagementPolicyRule(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional id = default; - RoleManagementPolicyRuleType ruleType = "Unknown"; - Optional target = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) + if (Target is null) { - id = property.Value.GetString(); - continue; + writer.WriteNullValue(); } - if (property.NameEquals("ruleType"u8)) + else { - ruleType = new RoleManagementPolicyRuleType(property.Value.GetString()); - continue; + ((IModelJsonSerializable)Target).Serialize(writer, options); } - if (property.NameEquals("target"u8)) + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - target = RoleManagementPolicyRuleTarget.DeserializeRoleManagementPolicyRuleTarget(property.Value); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownRoleManagementPolicyRule(id.Value, ruleType, target.Value); + writer.WriteEndObject(); + } + + internal static RoleManagementPolicyRule DeserializeUnknownRoleManagementPolicyRule(JsonElement element, ModelSerializerOptions options = default) => DeserializeRoleManagementPolicyRule(element, options); + + RoleManagementPolicyRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownRoleManagementPolicyRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleManagementPolicyRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleManagementPolicyRule(doc.RootElement, options); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.cs index 560d463db19b..a9ca08e8726d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Models/UnknownRoleManagementPolicyRule.cs @@ -5,18 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Authorization.Models { /// The UnknownRoleManagementPolicyRule. internal partial class UnknownRoleManagementPolicyRule : RoleManagementPolicyRule { - /// Initializes a new instance of UnknownRoleManagementPolicyRule. + /// Initializes a new instance of . /// The id of the rule. /// The type of rule. /// The target of the current rule. - internal UnknownRoleManagementPolicyRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target) : base(id, ruleType, target) + /// Keeps track of any properties unknown to the library. + internal UnknownRoleManagementPolicyRule(string id, RoleManagementPolicyRuleType ruleType, RoleManagementPolicyRuleTarget target, Dictionary serializedAdditionalRawData) : base(id, ruleType, target, serializedAdditionalRawData) { RuleType = ruleType; } + + /// Initializes a new instance of for deserialization. + internal UnknownRoleManagementPolicyRule() + { + } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentScheduleRequestsRestOperations.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentScheduleRequestsRestOperations.cs index d5e0ec5d964c..713a21714c56 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentScheduleRequestsRestOperations.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentScheduleRequestsRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateCreateRequest(string scope, string roleAssignmentSche request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -343,9 +341,7 @@ internal HttpMessage CreateValidateRequest(string scope, string roleAssignmentSc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs index 52d6bc0e0cb8..a28b1f4b6191 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs @@ -132,9 +132,7 @@ internal HttpMessage CreateCreateRequest(string scope, string roleAssignmentName request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleDefinitionsRestOperations.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleDefinitionsRestOperations.cs index 753b6958f82e..ed5bb7bb667e 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleDefinitionsRestOperations.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleDefinitionsRestOperations.cs @@ -200,9 +200,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string scope, ResourceIdentifie request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleEligibilityScheduleRequestsRestOperations.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleEligibilityScheduleRequestsRestOperations.cs index f757601a7c76..6d6015cd9de0 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleEligibilityScheduleRequestsRestOperations.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleEligibilityScheduleRequestsRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateCreateRequest(string scope, string roleEligibilitySch request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -343,9 +341,7 @@ internal HttpMessage CreateValidateRequest(string scope, string roleEligibilityS request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPoliciesRestOperations.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPoliciesRestOperations.cs index 84d3f75307f4..c9194d196eca 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPoliciesRestOperations.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPoliciesRestOperations.cs @@ -128,9 +128,7 @@ internal HttpMessage CreateUpdateRequest(string scope, string roleManagementPoli request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPolicyAssignmentsRestOperations.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPolicyAssignmentsRestOperations.cs index 93d5d598484d..60ec0b2a0dba 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPolicyAssignmentsRestOperations.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RestOperations/RoleManagementPolicyAssignmentsRestOperations.cs @@ -128,9 +128,7 @@ internal HttpMessage CreateCreateRequest(string scope, string roleManagementPoli request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs index dcd3bcef6842..942c64dff998 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentCollection.cs @@ -220,7 +220,7 @@ public virtual AsyncPageable GetAllAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentRestClient.CreateListForScopeRequest(Id, filter, tenantId, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter, tenantId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentResource(Client, RoleAssignmentData.DeserializeRoleAssignmentData(e)), _roleAssignmentClientDiagnostics, Pipeline, "RoleAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentResource(Client, RoleAssignmentData.DeserializeRoleAssignmentData(e)), _roleAssignmentClientDiagnostics, Pipeline, "RoleAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -245,7 +245,7 @@ public virtual Pageable GetAll(string filter = null, str { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentRestClient.CreateListForScopeRequest(Id, filter, tenantId, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter, tenantId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentResource(Client, RoleAssignmentData.DeserializeRoleAssignmentData(e)), _roleAssignmentClientDiagnostics, Pipeline, "RoleAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentResource(Client, RoleAssignmentData.DeserializeRoleAssignmentData(e)), _roleAssignmentClientDiagnostics, Pipeline, "RoleAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentData.cs index e4430d18bb26..6a475aa3c392 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleAssignmentData : ResourceData { - /// Initializes a new instance of RoleAssignmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentData() { } - /// Initializes a new instance of RoleAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +44,8 @@ internal RoleAssignmentData() /// Id of the user who created the assignment. /// Id of the user who updated the assignment. /// Id of the delegated managed identity resource. - internal RoleAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, string description, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string createdBy, string updatedBy, ResourceIdentifier delegatedManagedIdentityResourceId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, string description, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, string createdBy, string updatedBy, ResourceIdentifier delegatedManagedIdentityResourceId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -54,6 +59,7 @@ internal RoleAssignmentData(ResourceIdentifier id, string name, ResourceType res CreatedBy = createdBy; UpdatedBy = updatedBy; DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role assignment scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs index ba0261684e3c..f04d0a8d509a 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleCollection.cs @@ -137,7 +137,7 @@ public virtual AsyncPageable GetAllAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentScheduleRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentScheduleRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentScheduleResource(Client, RoleAssignmentScheduleData.DeserializeRoleAssignmentScheduleData(e)), _roleAssignmentScheduleClientDiagnostics, Pipeline, "RoleAssignmentScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentScheduleResource(Client, RoleAssignmentScheduleData.DeserializeRoleAssignmentScheduleData(e)), _roleAssignmentScheduleClientDiagnostics, Pipeline, "RoleAssignmentScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -160,7 +160,7 @@ public virtual Pageable GetAll(string filter = n { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentScheduleRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentScheduleRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentScheduleResource(Client, RoleAssignmentScheduleData.DeserializeRoleAssignmentScheduleData(e)), _roleAssignmentScheduleClientDiagnostics, Pipeline, "RoleAssignmentScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentScheduleResource(Client, RoleAssignmentScheduleData.DeserializeRoleAssignmentScheduleData(e)), _roleAssignmentScheduleClientDiagnostics, Pipeline, "RoleAssignmentScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleData.cs index f2a6658cde97..28e2b1a8984b 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleAssignmentScheduleData : ResourceData { - /// Initializes a new instance of RoleAssignmentScheduleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentScheduleData() { } - /// Initializes a new instance of RoleAssignmentScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +48,8 @@ internal RoleAssignmentScheduleData() /// DateTime when role assignment schedule was created. /// DateTime when role assignment schedule was modified. /// Additional properties of principal, scope and role definition. - internal RoleAssignmentScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleAssignmentScheduleRequestId, ResourceIdentifier linkedRoleEligibilityScheduleId, RoleAssignmentScheduleAssignmentType? assignmentType, RoleManagementScheduleMemberType? memberType, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, RoleManagementExpandedProperties expandedProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleAssignmentScheduleRequestId, ResourceIdentifier linkedRoleEligibilityScheduleId, RoleAssignmentScheduleAssignmentType? assignmentType, RoleManagementScheduleMemberType? memberType, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, RoleManagementExpandedProperties expandedProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -62,6 +67,7 @@ internal RoleAssignmentScheduleData(ResourceIdentifier id, string name, Resource CreatedOn = createdOn; UpdatedOn = updatedOn; ExpandedProperties = expandedProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role assignment schedule scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs index bb4c2a0c9489..641ff8370071 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceCollection.cs @@ -137,7 +137,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentScheduleInstanceRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentScheduleInstanceRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentScheduleInstanceResource(Client, RoleAssignmentScheduleInstanceData.DeserializeRoleAssignmentScheduleInstanceData(e)), _roleAssignmentScheduleInstanceClientDiagnostics, Pipeline, "RoleAssignmentScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentScheduleInstanceResource(Client, RoleAssignmentScheduleInstanceData.DeserializeRoleAssignmentScheduleInstanceData(e)), _roleAssignmentScheduleInstanceClientDiagnostics, Pipeline, "RoleAssignmentScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -160,7 +160,7 @@ public virtual Pageable GetAll(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentScheduleInstanceRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentScheduleInstanceRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentScheduleInstanceResource(Client, RoleAssignmentScheduleInstanceData.DeserializeRoleAssignmentScheduleInstanceData(e)), _roleAssignmentScheduleInstanceClientDiagnostics, Pipeline, "RoleAssignmentScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentScheduleInstanceResource(Client, RoleAssignmentScheduleInstanceData.DeserializeRoleAssignmentScheduleInstanceData(e)), _roleAssignmentScheduleInstanceClientDiagnostics, Pipeline, "RoleAssignmentScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceData.cs index 0139879b811d..49e7c60c7713 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleAssignmentScheduleInstanceData : ResourceData { - /// Initializes a new instance of RoleAssignmentScheduleInstanceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentScheduleInstanceData() { } - /// Initializes a new instance of RoleAssignmentScheduleInstanceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ internal RoleAssignmentScheduleInstanceData() /// Version of the condition. Currently accepted value is '2.0'. /// DateTime when role assignment schedule was created. /// Additional properties of principal, scope and role definition. - internal RoleAssignmentScheduleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleAssignmentScheduleId, ResourceIdentifier originRoleAssignmentId, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, ResourceIdentifier linkedRoleEligibilityScheduleId, ResourceIdentifier linkedRoleEligibilityScheduleInstanceId, RoleAssignmentScheduleAssignmentType? assignmentType, RoleManagementScheduleMemberType? memberType, string condition, string conditionVersion, DateTimeOffset? createdOn, RoleManagementExpandedProperties expandedProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleAssignmentScheduleId, ResourceIdentifier originRoleAssignmentId, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, ResourceIdentifier linkedRoleEligibilityScheduleId, ResourceIdentifier linkedRoleEligibilityScheduleInstanceId, RoleAssignmentScheduleAssignmentType? assignmentType, RoleManagementScheduleMemberType? memberType, string condition, string conditionVersion, DateTimeOffset? createdOn, RoleManagementExpandedProperties expandedProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -64,6 +69,7 @@ internal RoleAssignmentScheduleInstanceData(ResourceIdentifier id, string name, ConditionVersion = conditionVersion; CreatedOn = createdOn; ExpandedProperties = expandedProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role assignment schedule scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs index 64ff4a4afaed..54accac4ef22 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestCollection.cs @@ -219,7 +219,7 @@ public virtual AsyncPageable GetAllAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentScheduleRequestRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentScheduleRequestRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentScheduleRequestResource(Client, RoleAssignmentScheduleRequestData.DeserializeRoleAssignmentScheduleRequestData(e)), _roleAssignmentScheduleRequestClientDiagnostics, Pipeline, "RoleAssignmentScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentScheduleRequestResource(Client, RoleAssignmentScheduleRequestData.DeserializeRoleAssignmentScheduleRequestData(e)), _roleAssignmentScheduleRequestClientDiagnostics, Pipeline, "RoleAssignmentScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -242,7 +242,7 @@ public virtual Pageable GetAll(string fil { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentScheduleRequestRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentScheduleRequestRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentScheduleRequestResource(Client, RoleAssignmentScheduleRequestData.DeserializeRoleAssignmentScheduleRequestData(e)), _roleAssignmentScheduleRequestClientDiagnostics, Pipeline, "RoleAssignmentScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentScheduleRequestResource(Client, RoleAssignmentScheduleRequestData.DeserializeRoleAssignmentScheduleRequestData(e)), _roleAssignmentScheduleRequestClientDiagnostics, Pipeline, "RoleAssignmentScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestData.cs index fb49c110086c..7f8a9ef9ec44 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleAssignmentScheduleRequestData : ResourceData { - /// Initializes a new instance of RoleAssignmentScheduleRequestData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleAssignmentScheduleRequestData() { } - /// Initializes a new instance of RoleAssignmentScheduleRequestData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +53,8 @@ public RoleAssignmentScheduleRequestData() /// Type of the role assignment schedule expiration. /// End DateTime of the role assignment schedule. /// Duration of the role assignment schedule in TimeSpan. - internal RoleAssignmentScheduleRequestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, RoleManagementScheduleRequestType? requestType, RoleManagementScheduleStatus? status, string approvalId, ResourceIdentifier targetRoleAssignmentScheduleId, ResourceIdentifier targetRoleAssignmentScheduleInstanceId, ResourceIdentifier linkedRoleEligibilityScheduleId, string justification, RoleAssignmentScheduleTicketInfo ticketInfo, string condition, string conditionVersion, DateTimeOffset? createdOn, Guid? requestorId, RoleManagementExpandedProperties expandedProperties, DateTimeOffset? startOn, RoleManagementScheduleExpirationType? expirationType, DateTimeOffset? endOn, TimeSpan? duration) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentScheduleRequestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, RoleManagementScheduleRequestType? requestType, RoleManagementScheduleStatus? status, string approvalId, ResourceIdentifier targetRoleAssignmentScheduleId, ResourceIdentifier targetRoleAssignmentScheduleInstanceId, ResourceIdentifier linkedRoleEligibilityScheduleId, string justification, RoleAssignmentScheduleTicketInfo ticketInfo, string condition, string conditionVersion, DateTimeOffset? createdOn, Guid? requestorId, RoleManagementExpandedProperties expandedProperties, DateTimeOffset? startOn, RoleManagementScheduleExpirationType? expirationType, DateTimeOffset? endOn, TimeSpan? duration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -72,6 +77,7 @@ internal RoleAssignmentScheduleRequestData(ResourceIdentifier id, string name, R ExpirationType = expirationType; EndOn = endOn; Duration = duration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role assignment schedule request scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs index 8a4f34393219..7828f39f9f04 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleCollection.cs @@ -137,7 +137,7 @@ public virtual AsyncPageable GetAllAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleEligibilityScheduleRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleEligibilityScheduleRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleEligibilityScheduleResource(Client, RoleEligibilityScheduleData.DeserializeRoleEligibilityScheduleData(e)), _roleEligibilityScheduleClientDiagnostics, Pipeline, "RoleEligibilityScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleEligibilityScheduleResource(Client, RoleEligibilityScheduleData.DeserializeRoleEligibilityScheduleData(e)), _roleEligibilityScheduleClientDiagnostics, Pipeline, "RoleEligibilityScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -160,7 +160,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleEligibilityScheduleRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleEligibilityScheduleRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleEligibilityScheduleResource(Client, RoleEligibilityScheduleData.DeserializeRoleEligibilityScheduleData(e)), _roleEligibilityScheduleClientDiagnostics, Pipeline, "RoleEligibilityScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleEligibilityScheduleResource(Client, RoleEligibilityScheduleData.DeserializeRoleEligibilityScheduleData(e)), _roleEligibilityScheduleClientDiagnostics, Pipeline, "RoleEligibilityScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleData.cs index d2401b6a4f74..c1d27b93ffe7 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleEligibilityScheduleData : ResourceData { - /// Initializes a new instance of RoleEligibilityScheduleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleEligibilityScheduleData() { } - /// Initializes a new instance of RoleEligibilityScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +46,8 @@ internal RoleEligibilityScheduleData() /// DateTime when role eligibility schedule was created. /// DateTime when role eligibility schedule was modified. /// Additional properties of principal, scope and role definition. - internal RoleEligibilityScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleEligibilityScheduleRequestId, RoleManagementScheduleMemberType? memberType, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, RoleManagementExpandedProperties expandedProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleEligibilityScheduleRequestId, RoleManagementScheduleMemberType? memberType, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, string condition, string conditionVersion, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, RoleManagementExpandedProperties expandedProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -58,6 +63,7 @@ internal RoleEligibilityScheduleData(ResourceIdentifier id, string name, Resourc CreatedOn = createdOn; UpdatedOn = updatedOn; ExpandedProperties = expandedProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role eligibility schedule scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs index 0418673fcf06..8bd0fa205210 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceCollection.cs @@ -137,7 +137,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleEligibilityScheduleInstanceRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleEligibilityScheduleInstanceRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleEligibilityScheduleInstanceResource(Client, RoleEligibilityScheduleInstanceData.DeserializeRoleEligibilityScheduleInstanceData(e)), _roleEligibilityScheduleInstanceClientDiagnostics, Pipeline, "RoleEligibilityScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleEligibilityScheduleInstanceResource(Client, RoleEligibilityScheduleInstanceData.DeserializeRoleEligibilityScheduleInstanceData(e)), _roleEligibilityScheduleInstanceClientDiagnostics, Pipeline, "RoleEligibilityScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -160,7 +160,7 @@ public virtual Pageable GetAll(string f { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleEligibilityScheduleInstanceRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleEligibilityScheduleInstanceRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleEligibilityScheduleInstanceResource(Client, RoleEligibilityScheduleInstanceData.DeserializeRoleEligibilityScheduleInstanceData(e)), _roleEligibilityScheduleInstanceClientDiagnostics, Pipeline, "RoleEligibilityScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleEligibilityScheduleInstanceResource(Client, RoleEligibilityScheduleInstanceData.DeserializeRoleEligibilityScheduleInstanceData(e)), _roleEligibilityScheduleInstanceClientDiagnostics, Pipeline, "RoleEligibilityScheduleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceData.cs index ec05c827aa72..366deadcc53a 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleEligibilityScheduleInstanceData : ResourceData { - /// Initializes a new instance of RoleEligibilityScheduleInstanceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleEligibilityScheduleInstanceData() { } - /// Initializes a new instance of RoleEligibilityScheduleInstanceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +45,8 @@ internal RoleEligibilityScheduleInstanceData() /// Version of the condition. Currently accepted value is '2.0'. /// DateTime when role eligibility schedule was created. /// Additional properties of principal, scope and role definition. - internal RoleEligibilityScheduleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleEligibilityScheduleId, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, RoleManagementScheduleMemberType? memberType, string condition, string conditionVersion, DateTimeOffset? createdOn, RoleManagementExpandedProperties expandedProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, ResourceIdentifier roleEligibilityScheduleId, RoleManagementScheduleStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, RoleManagementScheduleMemberType? memberType, string condition, string conditionVersion, DateTimeOffset? createdOn, RoleManagementExpandedProperties expandedProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -56,6 +61,7 @@ internal RoleEligibilityScheduleInstanceData(ResourceIdentifier id, string name, ConditionVersion = conditionVersion; CreatedOn = createdOn; ExpandedProperties = expandedProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role eligibility schedule scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs index defa45bf60b6..451b84a8701d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestCollection.cs @@ -219,7 +219,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleEligibilityScheduleRequestRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleEligibilityScheduleRequestRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleEligibilityScheduleRequestResource(Client, RoleEligibilityScheduleRequestData.DeserializeRoleEligibilityScheduleRequestData(e)), _roleEligibilityScheduleRequestClientDiagnostics, Pipeline, "RoleEligibilityScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleEligibilityScheduleRequestResource(Client, RoleEligibilityScheduleRequestData.DeserializeRoleEligibilityScheduleRequestData(e)), _roleEligibilityScheduleRequestClientDiagnostics, Pipeline, "RoleEligibilityScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -242,7 +242,7 @@ public virtual Pageable GetAll(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleEligibilityScheduleRequestRestClient.CreateListForScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleEligibilityScheduleRequestRestClient.CreateListForScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleEligibilityScheduleRequestResource(Client, RoleEligibilityScheduleRequestData.DeserializeRoleEligibilityScheduleRequestData(e)), _roleEligibilityScheduleRequestClientDiagnostics, Pipeline, "RoleEligibilityScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleEligibilityScheduleRequestResource(Client, RoleEligibilityScheduleRequestData.DeserializeRoleEligibilityScheduleRequestData(e)), _roleEligibilityScheduleRequestClientDiagnostics, Pipeline, "RoleEligibilityScheduleRequestCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestData.cs index 4ae3baa89976..415804fccff3 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleEligibilityScheduleRequestData : ResourceData { - /// Initializes a new instance of RoleEligibilityScheduleRequestData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleEligibilityScheduleRequestData() { } - /// Initializes a new instance of RoleEligibilityScheduleRequestData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +52,8 @@ public RoleEligibilityScheduleRequestData() /// Type of the role eligibility schedule expiration. /// End DateTime of the role eligibility schedule. /// Duration of the role eligibility schedule in TimeSpan. - internal RoleEligibilityScheduleRequestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, RoleManagementScheduleRequestType? requestType, RoleManagementScheduleStatus? status, string approvalId, ResourceIdentifier targetRoleEligibilityScheduleId, ResourceIdentifier targetRoleEligibilityScheduleInstanceId, string justification, RoleEligibilityScheduleRequestPropertiesTicketInfo ticketInfo, string condition, string conditionVersion, DateTimeOffset? createdOn, Guid? requestorId, RoleManagementExpandedProperties expandedProperties, DateTimeOffset? startOn, RoleManagementScheduleExpirationType? expirationType, DateTimeOffset? endOn, TimeSpan? duration) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleEligibilityScheduleRequestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, Guid? principalId, RoleManagementPrincipalType? principalType, RoleManagementScheduleRequestType? requestType, RoleManagementScheduleStatus? status, string approvalId, ResourceIdentifier targetRoleEligibilityScheduleId, ResourceIdentifier targetRoleEligibilityScheduleInstanceId, string justification, RoleEligibilityScheduleRequestPropertiesTicketInfo ticketInfo, string condition, string conditionVersion, DateTimeOffset? createdOn, Guid? requestorId, RoleManagementExpandedProperties expandedProperties, DateTimeOffset? startOn, RoleManagementScheduleExpirationType? expirationType, DateTimeOffset? endOn, TimeSpan? duration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; @@ -70,6 +75,7 @@ internal RoleEligibilityScheduleRequestData(ResourceIdentifier id, string name, ExpirationType = expirationType; EndOn = endOn; Duration = duration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role eligibility schedule request scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs index 3d37dd79861f..e08528725ee6 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentCollection.cs @@ -218,7 +218,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleManagementPolicyAssignmentRestClient.CreateListForScopeRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleManagementPolicyAssignmentRestClient.CreateListForScopeNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleManagementPolicyAssignmentResource(Client, RoleManagementPolicyAssignmentData.DeserializeRoleManagementPolicyAssignmentData(e)), _roleManagementPolicyAssignmentClientDiagnostics, Pipeline, "RoleManagementPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleManagementPolicyAssignmentResource(Client, RoleManagementPolicyAssignmentData.DeserializeRoleManagementPolicyAssignmentData(e)), _roleManagementPolicyAssignmentClientDiagnostics, Pipeline, "RoleManagementPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -240,7 +240,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleManagementPolicyAssignmentRestClient.CreateListForScopeRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleManagementPolicyAssignmentRestClient.CreateListForScopeNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleManagementPolicyAssignmentResource(Client, RoleManagementPolicyAssignmentData.DeserializeRoleManagementPolicyAssignmentData(e)), _roleManagementPolicyAssignmentClientDiagnostics, Pipeline, "RoleManagementPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleManagementPolicyAssignmentResource(Client, RoleManagementPolicyAssignmentData.DeserializeRoleManagementPolicyAssignmentData(e)), _roleManagementPolicyAssignmentClientDiagnostics, Pipeline, "RoleManagementPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentData.cs index 10205eca260e..5beeaf094f3d 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Authorization.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleManagementPolicyAssignmentData : ResourceData { - /// Initializes a new instance of RoleManagementPolicyAssignmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleManagementPolicyAssignmentData() { EffectiveRules = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementPolicyAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,13 +42,15 @@ public RoleManagementPolicyAssignmentData() /// The available derived classes include , , , and . /// /// Additional properties of scope, role definition and policy. - internal RoleManagementPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, ResourceIdentifier policyId, IReadOnlyList effectiveRules, PolicyAssignmentProperties policyAssignmentProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, ResourceIdentifier roleDefinitionId, ResourceIdentifier policyId, IReadOnlyList effectiveRules, PolicyAssignmentProperties policyAssignmentProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; RoleDefinitionId = roleDefinitionId; PolicyId = policyId; EffectiveRules = effectiveRules; PolicyAssignmentProperties = policyAssignmentProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role management policy scope. diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs index fd0427ee2c0b..6371b89ccc74 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyCollection.cs @@ -136,7 +136,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleManagementPolicyRestClient.CreateListForScopeRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleManagementPolicyRestClient.CreateListForScopeNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleManagementPolicyResource(Client, RoleManagementPolicyData.DeserializeRoleManagementPolicyData(e)), _roleManagementPolicyClientDiagnostics, Pipeline, "RoleManagementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleManagementPolicyResource(Client, RoleManagementPolicyData.DeserializeRoleManagementPolicyData(e)), _roleManagementPolicyClientDiagnostics, Pipeline, "RoleManagementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -158,7 +158,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleManagementPolicyRestClient.CreateListForScopeRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleManagementPolicyRestClient.CreateListForScopeNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleManagementPolicyResource(Client, RoleManagementPolicyData.DeserializeRoleManagementPolicyData(e)), _roleManagementPolicyClientDiagnostics, Pipeline, "RoleManagementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleManagementPolicyResource(Client, RoleManagementPolicyData.DeserializeRoleManagementPolicyData(e)), _roleManagementPolicyClientDiagnostics, Pipeline, "RoleManagementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyData.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyData.cs index e000b1aeaeff..3936fdbfef47 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyData.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Authorization /// public partial class RoleManagementPolicyData : ResourceData { - /// Initializes a new instance of RoleManagementPolicyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleManagementPolicyData() { Rules = new ChangeTrackingList(); EffectiveRules = new ChangeTrackingList(); } - /// Initializes a new instance of RoleManagementPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +51,8 @@ public RoleManagementPolicyData() /// The available derived classes include , , , and . /// /// Additional properties of scope. - internal RoleManagementPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, string displayName, string description, bool? isOrganizationDefault, RoleManagementPrincipal lastModifiedBy, DateTimeOffset? lastModifiedOn, IList rules, IReadOnlyList effectiveRules, RoleManagementPolicyProperties policyProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleManagementPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scope, string displayName, string description, bool? isOrganizationDefault, RoleManagementPrincipal lastModifiedBy, DateTimeOffset? lastModifiedOn, IList rules, IReadOnlyList effectiveRules, RoleManagementPolicyProperties policyProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Scope = scope; DisplayName = displayName; @@ -59,6 +63,7 @@ internal RoleManagementPolicyData(ResourceIdentifier id, string name, ResourceTy Rules = rules; EffectiveRules = effectiveRules; PolicyProperties = policyProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role management policy scope. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/ArmAutomanageModelFactory.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/ArmAutomanageModelFactory.cs index 59e8d1a23794..eba4fe4eb530 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/ArmAutomanageModelFactory.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/ArmAutomanageModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Automanage.Models /// Model factory for models. public static partial class ArmAutomanageModelFactory { - /// Initializes a new instance of AutomanageBestPracticeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -27,10 +27,10 @@ public static partial class ArmAutomanageModelFactory /// A new instance for mocking. public static AutomanageBestPracticeData AutomanageBestPracticeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BinaryData configuration = null) { - return new AutomanageBestPracticeData(id, name, resourceType, systemData, configuration); + return new AutomanageBestPracticeData(id, name, resourceType, systemData, configuration, default); } - /// Initializes a new instance of AutomanageConfigurationProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,10 +43,10 @@ public static AutomanageConfigurationProfileData AutomanageConfigurationProfileD { tags ??= new Dictionary(); - return new AutomanageConfigurationProfileData(id, name, resourceType, systemData, tags, location, configuration != null ? new ConfigurationProfileProperties(configuration) : null); + return new AutomanageConfigurationProfileData(id, name, resourceType, systemData, tags, location, configuration != null ? new ConfigurationProfileProperties(configuration, new Dictionary()) : null, default); } - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -56,20 +56,20 @@ public static AutomanageConfigurationProfileData AutomanageConfigurationProfileD /// A new instance for mocking. public static AutomanageConfigurationProfileAssignmentData AutomanageConfigurationProfileAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AutomanageConfigurationProfileAssignmentProperties properties = null, string managedBy = null) { - return new AutomanageConfigurationProfileAssignmentData(id, name, resourceType, systemData, properties, managedBy); + return new AutomanageConfigurationProfileAssignmentData(id, name, resourceType, systemData, properties, managedBy, default); } - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentProperties. + /// Initializes a new instance of . /// The Automanage configurationProfile ARM Resource URI. /// The target VM resource URI. /// The status of onboarding, which only appears in the response. /// A new instance for mocking. public static AutomanageConfigurationProfileAssignmentProperties AutomanageConfigurationProfileAssignmentProperties(ResourceIdentifier configurationProfile = null, ResourceIdentifier targetId = null, string status = null) { - return new AutomanageConfigurationProfileAssignmentProperties(configurationProfile, targetId, status); + return new AutomanageConfigurationProfileAssignmentProperties(configurationProfile, targetId, status, default); } - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentReportData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -89,10 +89,10 @@ public static AutomanageConfigurationProfileAssignmentReportData AutomanageConfi { resources ??= new List(); - return new AutomanageConfigurationProfileAssignmentReportData(id, name, resourceType, systemData, startOn, endOn, lastModifiedOn, duration, configurationProfileAssignmentProcessingType, status, configurationProfile, resources?.ToList(), error, reportFormatVersion); + return new AutomanageConfigurationProfileAssignmentReportData(id, name, resourceType, systemData, startOn, endOn, lastModifiedOn, duration, configurationProfileAssignmentProcessingType, status, configurationProfile, resources?.ToList(), error, reportFormatVersion, default); } - /// Initializes a new instance of ConfigurationProfileAssignmentReportResourceDetails. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -102,10 +102,10 @@ public static AutomanageConfigurationProfileAssignmentReportData AutomanageConfi /// A new instance for mocking. public static ConfigurationProfileAssignmentReportResourceDetails ConfigurationProfileAssignmentReportResourceDetails(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string status = null, ResponseError error = null) { - return new ConfigurationProfileAssignmentReportResourceDetails(id, name, resourceType, systemData, status, error); + return new ConfigurationProfileAssignmentReportResourceDetails(id, name, resourceType, systemData, status, error, default); } - /// Initializes a new instance of AutomanageServicePrincipalData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -115,7 +115,7 @@ public static ConfigurationProfileAssignmentReportResourceDetails ConfigurationP /// A new instance for mocking. public static AutomanageServicePrincipalData AutomanageServicePrincipalData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string servicePrincipalId = null, bool? isAuthorizationSet = null) { - return new AutomanageServicePrincipalData(id, name, resourceType, systemData, servicePrincipalId, isAuthorizationSet); + return new AutomanageServicePrincipalData(id, name, resourceType, systemData, servicePrincipalId, isAuthorizationSet, default); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs index f88d39076e84..731f99993e39 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeCollection.cs @@ -146,7 +146,7 @@ public virtual Response Get(string bestPracticeN public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageBestPracticeBestPracticesRestClient.CreateListByTenantRequest(); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageBestPracticeResource(Client, AutomanageBestPracticeData.DeserializeAutomanageBestPracticeData(e)), _automanageBestPracticeBestPracticesClientDiagnostics, Pipeline, "AutomanageBestPracticeCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageBestPracticeResource(Client, AutomanageBestPracticeData.DeserializeAutomanageBestPracticeData(e)), _automanageBestPracticeBestPracticesClientDiagnostics, Pipeline, "AutomanageBestPracticeCollection.GetAll", "value", null, cancellationToken); } /// @@ -167,7 +167,7 @@ public virtual AsyncPageable GetAllAsync(Cancell public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageBestPracticeBestPracticesRestClient.CreateListByTenantRequest(); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageBestPracticeResource(Client, AutomanageBestPracticeData.DeserializeAutomanageBestPracticeData(e)), _automanageBestPracticeBestPracticesClientDiagnostics, Pipeline, "AutomanageBestPracticeCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageBestPracticeResource(Client, AutomanageBestPracticeData.DeserializeAutomanageBestPracticeData(e)), _automanageBestPracticeBestPracticesClientDiagnostics, Pipeline, "AutomanageBestPracticeCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeData.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeData.cs index 757f91877f8e..1b7ed456ec2e 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeData.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,20 +18,25 @@ namespace Azure.ResourceManager.Automanage /// public partial class AutomanageBestPracticeData : ResourceData { - /// Initializes a new instance of AutomanageBestPracticeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomanageBestPracticeData() { } - /// Initializes a new instance of AutomanageBestPracticeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// configuration dictionary of the configuration profile. - internal AutomanageBestPracticeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BinaryData configuration) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomanageBestPracticeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BinaryData configuration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Configuration = configuration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentData.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentData.cs index 6c6484327bc3..452faff63fdd 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentData.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automanage.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.Automanage /// public partial class AutomanageConfigurationProfileAssignmentData : ResourceData { - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomanageConfigurationProfileAssignmentData() { } - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the configuration profile assignment. /// Azure resource id. Indicates if this resource is managed by another Azure resource. - internal AutomanageConfigurationProfileAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AutomanageConfigurationProfileAssignmentProperties properties, string managedBy) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomanageConfigurationProfileAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AutomanageConfigurationProfileAssignmentProperties properties, string managedBy, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ManagedBy = managedBy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the configuration profile assignment. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentReportData.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentReportData.cs index d29a6a2e148d..623455ec781e 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentReportData.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileAssignmentReportData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.Automanage /// public partial class AutomanageConfigurationProfileAssignmentReportData : ResourceData { - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentReportData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomanageConfigurationProfileAssignmentReportData() { Resources = new ChangeTrackingList(); } - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentReportData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public AutomanageConfigurationProfileAssignmentReportData() /// List of resources processed by the configuration profile assignment. /// Error message, if any, returned by the configuration profile assignment processing. /// Version of the report format. - internal AutomanageConfigurationProfileAssignmentReportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? startOn, DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, TimeSpan? duration, string configurationProfileAssignmentProcessingType, string status, string configurationProfile, IReadOnlyList resources, ResponseError error, string reportFormatVersion) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomanageConfigurationProfileAssignmentReportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? startOn, DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, TimeSpan? duration, string configurationProfileAssignmentProcessingType, string status, string configurationProfile, IReadOnlyList resources, ResponseError error, string reportFormatVersion, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { StartOn = startOn; EndOn = endOn; @@ -53,6 +57,7 @@ internal AutomanageConfigurationProfileAssignmentReportData(ResourceIdentifier i Resources = resources; Error = error; ReportFormatVersion = reportFormatVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Start time of the configuration profile assignment processing. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs index 772412d6f62b..ac14c4dcbca3 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string confi public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageConfigurationProfileConfigurationProfilesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "AutomanageConfigurationProfileCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "AutomanageConfigurationProfileCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageConfigurationProfileConfigurationProfilesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "AutomanageConfigurationProfileCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "AutomanageConfigurationProfileCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileData.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileData.cs index 0bda4c3fd8c1..fece0a326217 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileData.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automanage /// public partial class AutomanageConfigurationProfileData : TrackedResourceData { - /// Initializes a new instance of AutomanageConfigurationProfileData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AutomanageConfigurationProfileData(AzureLocation location) : base(location) { } - /// Initializes a new instance of AutomanageConfigurationProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,9 +36,16 @@ public AutomanageConfigurationProfileData(AzureLocation location) : base(locatio /// The tags. /// The location. /// Properties of the configuration profile. - internal AutomanageConfigurationProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfigurationProfileProperties properties) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AutomanageConfigurationProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfigurationProfileProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomanageConfigurationProfileData() + { } /// Properties of the configuration profile. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs index 311ec313175b..81128293c1e2 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(strin public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageConfigurationProfileVersionConfigurationProfilesVersionsRestClient.CreateListChildResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileVersionResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileVersionConfigurationProfilesVersionsClientDiagnostics, Pipeline, "AutomanageConfigurationProfileVersionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageConfigurationProfileVersionResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileVersionConfigurationProfilesVersionsClientDiagnostics, Pipeline, "AutomanageConfigurationProfileVersionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetA public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageConfigurationProfileVersionConfigurationProfilesVersionsRestClient.CreateListChildResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileVersionResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileVersionConfigurationProfilesVersionsClientDiagnostics, Pipeline, "AutomanageConfigurationProfileVersionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageConfigurationProfileVersionResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), _automanageConfigurationProfileVersionConfigurationProfilesVersionsClientDiagnostics, Pipeline, "AutomanageConfigurationProfileVersionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs index bfcdd3fcba5f..9294cd2f12aa 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentCollection.cs @@ -232,7 +232,7 @@ public virtual Response GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.CreateListByClusterNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageHciClusterConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageHciClusterConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual AsyncPageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.CreateListByClusterNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageHciClusterConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageHciClusterConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHciClusterConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs index f9263a250ee6..e38eba4d8a99 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportCollection.cs @@ -145,7 +145,7 @@ public virtual Response GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsRestClient.CreateListByConfigurationProfileAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageHciClusterConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageHciClusterConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsRestClient.CreateListByConfigurationProfileAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageHciClusterConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageHciClusterConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHciClusterConfigurationProfileAssignmentReportHCIReportsClientDiagnostics, Pipeline, "AutomanageHciClusterConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs index 3cc74d03dfc1..2d46dc47971c 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentCollection.cs @@ -232,7 +232,7 @@ public virtual Response Ge public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHcrpConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.CreateListByMachineNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageHcrpConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHcrpConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageHcrpConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHcrpConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual AsyncPageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHcrpConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.CreateListByMachineNameRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageHcrpConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHcrpConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageHcrpConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageHcrpConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs index 3fe683481505..fc830a7fe4d3 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportCollection.cs @@ -145,7 +145,7 @@ public virtual Response GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsRestClient.CreateListByConfigurationProfileAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageHcrpConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageHcrpConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsRestClient.CreateListByConfigurationProfileAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageHcrpConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageHcrpConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageHcrpConfigurationProfileAssignmentReportHCRPReportsClientDiagnostics, Pipeline, "AutomanageHcrpConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs index d1d906485ed8..8ca23d582f15 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get( public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.CreateListByVirtualMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageVmConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageVmConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsRestClient.CreateListByVirtualMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageVmConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageVmConfigurationProfileAssignmentResource(Client, AutomanageConfigurationProfileAssignmentData.DeserializeAutomanageConfigurationProfileAssignmentData(e)), _automanageVmConfigurationProfileAssignmentConfigurationProfileAssignmentsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs index 10219dc5604a..f9ffe9498bf5 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportCollection.cs @@ -145,7 +145,7 @@ public virtual Response GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageVmConfigurationProfileAssignmentReportreportsRestClient.CreateListByConfigurationProfileAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageVmConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageVmConfigurationProfileAssignmentReportreportsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageVmConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageVmConfigurationProfileAssignmentReportreportsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automanageVmConfigurationProfileAssignmentReportreportsRestClient.CreateListByConfigurationProfileAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageVmConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageVmConfigurationProfileAssignmentReportreportsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageVmConfigurationProfileAssignmentReportResource(Client, AutomanageConfigurationProfileAssignmentReportData.DeserializeAutomanageConfigurationProfileAssignmentReportData(e)), _automanageVmConfigurationProfileAssignmentReportreportsClientDiagnostics, Pipeline, "AutomanageVmConfigurationProfileAssignmentReportCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index e028579e77a9..7ff136a8e541 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -66,7 +66,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) public virtual AsyncPageable GetAutomanageConfigurationProfilesAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AutomanageConfigurationProfileConfigurationProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); } /// @@ -87,7 +87,7 @@ public virtual AsyncPageable GetAutomana public virtual Pageable GetAutomanageConfigurationProfiles(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => AutomanageConfigurationProfileConfigurationProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageBestPracticeData.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageBestPracticeData.Serialization.cs index 5d9c78de0050..540c0555072e 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageBestPracticeData.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageBestPracticeData.Serialization.cs @@ -6,16 +6,55 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automanage { - public partial class AutomanageBestPracticeData + public partial class AutomanageBestPracticeData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomanageBestPracticeData DeserializeAutomanageBestPracticeData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Configuration)) + { + writer.WritePropertyName("configuration"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Configuration); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(Configuration.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomanageBestPracticeData DeserializeAutomanageBestPracticeData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +64,7 @@ internal static AutomanageBestPracticeData DeserializeAutomanageBestPracticeData ResourceType type = default; Optional systemData = default; Optional configuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -72,8 +112,61 @@ internal static AutomanageBestPracticeData DeserializeAutomanageBestPracticeData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomanageBestPracticeData(id, name, type, systemData.Value, configuration.Value); + return new AutomanageBestPracticeData(id, name, type, systemData.Value, configuration.Value, serializedAdditionalRawData); + } + + AutomanageBestPracticeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageBestPracticeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageBestPracticeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageBestPracticeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageBestPracticeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageBestPracticeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageBestPracticeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentData.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentData.Serialization.cs index e3822254d8c5..d9a577f4328e 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentData.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automanage { - public partial class AutomanageConfigurationProfileAssignmentData : IUtf8JsonSerializable + public partial class AutomanageConfigurationProfileAssignmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AutomanageConfigurationProfileAssignmentData DeserializeAutomanageConfigurationProfileAssignmentData(JsonElement element) + internal static AutomanageConfigurationProfileAssignmentData DeserializeAutomanageConfigurationProfileAssignmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +66,7 @@ internal static AutomanageConfigurationProfileAssignmentData DeserializeAutomana string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -77,8 +107,61 @@ internal static AutomanageConfigurationProfileAssignmentData DeserializeAutomana systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageConfigurationProfileAssignmentData(id, name, type, systemData.Value, properties.Value, managedBy.Value, serializedAdditionalRawData); + } + + AutomanageConfigurationProfileAssignmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageConfigurationProfileAssignmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageConfigurationProfileAssignmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageConfigurationProfileAssignmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageConfigurationProfileAssignmentData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageConfigurationProfileAssignmentData(Response response) + { + if (response is null) + { + return null; } - return new AutomanageConfigurationProfileAssignmentData(id, name, type, systemData.Value, properties.Value, managedBy.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageConfigurationProfileAssignmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.Serialization.cs index b3b9aee11753..c27aaaf52859 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automanage.Models { - public partial class AutomanageConfigurationProfileAssignmentProperties : IUtf8JsonSerializable + public partial class AutomanageConfigurationProfileAssignmentProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConfigurationProfile)) { writer.WritePropertyName("configurationProfile"u8); writer.WriteStringValue(ConfigurationProfile); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomanageConfigurationProfileAssignmentProperties DeserializeAutomanageConfigurationProfileAssignmentProperties(JsonElement element) + internal static AutomanageConfigurationProfileAssignmentProperties DeserializeAutomanageConfigurationProfileAssignmentProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +54,7 @@ internal static AutomanageConfigurationProfileAssignmentProperties DeserializeAu Optional configurationProfile = default; Optional targetId = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("configurationProfile"u8)) @@ -57,8 +80,61 @@ internal static AutomanageConfigurationProfileAssignmentProperties DeserializeAu status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageConfigurationProfileAssignmentProperties(configurationProfile.Value, targetId.Value, status.Value, serializedAdditionalRawData); + } + + AutomanageConfigurationProfileAssignmentProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageConfigurationProfileAssignmentProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageConfigurationProfileAssignmentProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageConfigurationProfileAssignmentProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageConfigurationProfileAssignmentProperties model) + { + if (model is null) + { + return null; } - return new AutomanageConfigurationProfileAssignmentProperties(configurationProfile.Value, targetId.Value, status.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageConfigurationProfileAssignmentProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageConfigurationProfileAssignmentProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.cs index 2b3a32f7ac07..0c133fe8d8bc 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automanage.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.Automanage.Models /// Automanage configuration profile assignment properties. public partial class AutomanageConfigurationProfileAssignmentProperties { - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomanageConfigurationProfileAssignmentProperties() { } - /// Initializes a new instance of AutomanageConfigurationProfileAssignmentProperties. + /// Initializes a new instance of . /// The Automanage configurationProfile ARM Resource URI. /// The target VM resource URI. /// The status of onboarding, which only appears in the response. - internal AutomanageConfigurationProfileAssignmentProperties(ResourceIdentifier configurationProfile, ResourceIdentifier targetId, string status) + /// Keeps track of any properties unknown to the library. + internal AutomanageConfigurationProfileAssignmentProperties(ResourceIdentifier configurationProfile, ResourceIdentifier targetId, string status, Dictionary serializedAdditionalRawData) { ConfigurationProfile = configurationProfile; TargetId = targetId; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Automanage configurationProfile ARM Resource URI. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentReportData.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentReportData.Serialization.cs index 2cac66e82a48..b80bb37df958 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentReportData.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileAssignmentReportData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automanage { - public partial class AutomanageConfigurationProfileAssignmentReportData : IUtf8JsonSerializable + public partial class AutomanageConfigurationProfileAssignmentReportData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EndOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomanageConfigurationProfileAssignmentReportData DeserializeAutomanageConfigurationProfileAssignmentReportData(JsonElement element) + internal static AutomanageConfigurationProfileAssignmentReportData DeserializeAutomanageConfigurationProfileAssignmentReportData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +75,7 @@ internal static AutomanageConfigurationProfileAssignmentReportData DeserializeAu Optional> resources = default; Optional error = default; Optional reportFormatVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -173,8 +193,61 @@ internal static AutomanageConfigurationProfileAssignmentReportData DeserializeAu } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageConfigurationProfileAssignmentReportData(id, name, type, systemData.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(duration), type0.Value, status.Value, configurationProfile.Value, Optional.ToList(resources), error.Value, reportFormatVersion.Value, serializedAdditionalRawData); + } + + AutomanageConfigurationProfileAssignmentReportData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageConfigurationProfileAssignmentReportData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageConfigurationProfileAssignmentReportData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageConfigurationProfileAssignmentReportData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageConfigurationProfileAssignmentReportData model) + { + if (model is null) + { + return null; } - return new AutomanageConfigurationProfileAssignmentReportData(id, name, type, systemData.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(duration), type0.Value, status.Value, configurationProfile.Value, Optional.ToList(resources), error.Value, reportFormatVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageConfigurationProfileAssignmentReportData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageConfigurationProfileAssignmentReportData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileData.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileData.Serialization.cs index f38c80b9eafb..7074dbe7c1f5 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileData.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfileData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automanage { - public partial class AutomanageConfigurationProfileData : IUtf8JsonSerializable + public partial class AutomanageConfigurationProfileData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomanageConfigurationProfileData DeserializeAutomanageConfigurationProfileData(JsonElement element) + internal static AutomanageConfigurationProfileData DeserializeAutomanageConfigurationProfileData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static AutomanageConfigurationProfileData DeserializeAutomanageConfigur string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -106,8 +135,61 @@ internal static AutomanageConfigurationProfileData DeserializeAutomanageConfigur systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageConfigurationProfileData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, serializedAdditionalRawData); + } + + AutomanageConfigurationProfileData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageConfigurationProfileData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageConfigurationProfileData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageConfigurationProfileData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageConfigurationProfileData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageConfigurationProfileData(Response response) + { + if (response is null) + { + return null; } - return new AutomanageConfigurationProfileData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageConfigurationProfileData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.Serialization.cs index 7d93c846b24e..d95f54808ae4 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automanage.Models { - public partial class AutomanageConfigurationProfilePatch : IUtf8JsonSerializable + public partial class AutomanageConfigurationProfilePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -31,7 +46,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomanageConfigurationProfilePatch DeserializeAutomanageConfigurationProfilePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ConfigurationProfileProperties.DeserializeConfigurationProfileProperties(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageConfigurationProfilePatch(Optional.ToDictionary(tags), properties.Value, serializedAdditionalRawData); + } + + AutomanageConfigurationProfilePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageConfigurationProfilePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageConfigurationProfilePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageConfigurationProfilePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageConfigurationProfilePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageConfigurationProfilePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageConfigurationProfilePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.cs index 4a14d72ba35d..7722a841d59e 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageConfigurationProfilePatch.cs @@ -6,17 +6,27 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automanage.Models { /// Definition of the configuration profile. public partial class AutomanageConfigurationProfilePatch : AutomanageResourceUpdateDetails { - /// Initializes a new instance of AutomanageConfigurationProfilePatch. + /// Initializes a new instance of . public AutomanageConfigurationProfilePatch() { } + /// Initializes a new instance of . + /// The tags of the resource. + /// Properties of the configuration profile. + /// Keeps track of any properties unknown to the library. + internal AutomanageConfigurationProfilePatch(IDictionary tags, ConfigurationProfileProperties properties, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Properties = properties; + } + /// Properties of the configuration profile. internal ConfigurationProfileProperties Properties { get; set; } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.Serialization.cs index c3f67ffb9e3b..5a365e5fdf68 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automanage.Models { - public partial class AutomanageResourceUpdateDetails : IUtf8JsonSerializable + public partial class AutomanageResourceUpdateDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomanageResourceUpdateDetails DeserializeAutomanageResourceUpdateDetails(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageResourceUpdateDetails(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + AutomanageResourceUpdateDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageResourceUpdateDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageResourceUpdateDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageResourceUpdateDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageResourceUpdateDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageResourceUpdateDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageResourceUpdateDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.cs index 43d45f80390c..f0a2836d4468 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageResourceUpdateDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Automanage.Models /// Represents an update resource. public partial class AutomanageResourceUpdateDetails { - /// Initializes a new instance of AutomanageResourceUpdateDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomanageResourceUpdateDetails() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The tags of the resource. + /// Keeps track of any properties unknown to the library. + internal AutomanageResourceUpdateDetails(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The tags of the resource. public IDictionary Tags { get; } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.Serialization.cs index 565adb4b8324..d925064244b1 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automanage.Models { - public partial class AutomanageServicePrincipalData : IUtf8JsonSerializable + public partial class AutomanageServicePrincipalData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomanageServicePrincipalData DeserializeAutomanageServicePrincipalData(JsonElement element) + internal static AutomanageServicePrincipalData DeserializeAutomanageServicePrincipalData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +56,7 @@ internal static AutomanageServicePrincipalData DeserializeAutomanageServicePrinc Optional systemData = default; Optional servicePrincipalId = default; Optional authorizationSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +109,61 @@ internal static AutomanageServicePrincipalData DeserializeAutomanageServicePrinc } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomanageServicePrincipalData(id, name, type, systemData.Value, servicePrincipalId.Value, Optional.ToNullable(authorizationSet), serializedAdditionalRawData); + } + + AutomanageServicePrincipalData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomanageServicePrincipalData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomanageServicePrincipalData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomanageServicePrincipalData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomanageServicePrincipalData model) + { + if (model is null) + { + return null; } - return new AutomanageServicePrincipalData(id, name, type, systemData.Value, servicePrincipalId.Value, Optional.ToNullable(authorizationSet)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomanageServicePrincipalData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomanageServicePrincipalData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.cs index 89195681acf6..dbd0a8586dbf 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/AutomanageServicePrincipalData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,22 +15,27 @@ namespace Azure.ResourceManager.Automanage.Models /// The Service Principal Id for the subscription. public partial class AutomanageServicePrincipalData : ResourceData { - /// Initializes a new instance of AutomanageServicePrincipalData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomanageServicePrincipalData() { } - /// Initializes a new instance of AutomanageServicePrincipalData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The Service Principal Id for the subscription. /// Returns the contributor RBAC Role exist or not for the Service Principal Id. - internal AutomanageServicePrincipalData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string servicePrincipalId, bool? isAuthorizationSet) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomanageServicePrincipalData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string servicePrincipalId, bool? isAuthorizationSet, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ServicePrincipalId = servicePrincipalId; IsAuthorizationSet = isAuthorizationSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Service Principal Id for the subscription. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.Serialization.cs index 7e2ed390eec4..ea4b5a9072ae 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage; namespace Azure.ResourceManager.Automanage.Models { - internal partial class BestPracticeList + internal partial class BestPracticeList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BestPracticeList DeserializeBestPracticeList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BestPracticeList DeserializeBestPracticeList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static BestPracticeList DeserializeBestPracticeList(JsonElement element value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BestPracticeList(Optional.ToList(value)); + return new BestPracticeList(Optional.ToList(value), serializedAdditionalRawData); + } + + BestPracticeList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBestPracticeList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BestPracticeList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBestPracticeList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BestPracticeList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BestPracticeList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBestPracticeList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.cs index 229cef1a08f0..3b879eccd165 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/BestPracticeList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automanage; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Automanage.Models /// The response of the list best practice operation. internal partial class BestPracticeList { - /// Initializes a new instance of BestPracticeList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BestPracticeList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BestPracticeList. + /// Initializes a new instance of . /// Result of the list best practice operation. - internal BestPracticeList(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal BestPracticeList(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Result of the list best practice operation. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.Serialization.cs index b276dee3373b..f21a3d2e6213 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage; namespace Azure.ResourceManager.Automanage.Models { - internal partial class ConfigurationProfileAssignmentList + internal partial class ConfigurationProfileAssignmentList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigurationProfileAssignmentList DeserializeConfigurationProfileAssignmentList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationProfileAssignmentList DeserializeConfigurationProfileAssignmentList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static ConfigurationProfileAssignmentList DeserializeConfigurationProfi value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigurationProfileAssignmentList(Optional.ToList(value)); + return new ConfigurationProfileAssignmentList(Optional.ToList(value), serializedAdditionalRawData); + } + + ConfigurationProfileAssignmentList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationProfileAssignmentList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationProfileAssignmentList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationProfileAssignmentList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationProfileAssignmentList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationProfileAssignmentList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationProfileAssignmentList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.cs index 07386832e9d3..5b1326008cae 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automanage; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Automanage.Models /// The response of the list configuration profile assignment operation. internal partial class ConfigurationProfileAssignmentList { - /// Initializes a new instance of ConfigurationProfileAssignmentList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigurationProfileAssignmentList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigurationProfileAssignmentList. + /// Initializes a new instance of . /// Result of the list configuration profile assignment operation. - internal ConfigurationProfileAssignmentList(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ConfigurationProfileAssignmentList(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Result of the list configuration profile assignment operation. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.Serialization.cs index f89442a71721..57914ab6ed52 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automanage.Models { - public partial class ConfigurationProfileAssignmentReportResourceDetails + public partial class ConfigurationProfileAssignmentReportResourceDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigurationProfileAssignmentReportResourceDetails DeserializeConfigurationProfileAssignmentReportResourceDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationProfileAssignmentReportResourceDetails DeserializeConfigurationProfileAssignmentReportResourceDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +53,7 @@ internal static ConfigurationProfileAssignmentReportResourceDetails DeserializeC string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -66,8 +94,61 @@ internal static ConfigurationProfileAssignmentReportResourceDetails DeserializeC systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigurationProfileAssignmentReportResourceDetails(id, name, type, systemData.Value, status.Value, error.Value); + return new ConfigurationProfileAssignmentReportResourceDetails(id, name, type, systemData.Value, status.Value, error.Value, serializedAdditionalRawData); + } + + ConfigurationProfileAssignmentReportResourceDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationProfileAssignmentReportResourceDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationProfileAssignmentReportResourceDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationProfileAssignmentReportResourceDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationProfileAssignmentReportResourceDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationProfileAssignmentReportResourceDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationProfileAssignmentReportResourceDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.cs index 6054af9ed48c..74984565e3b2 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileAssignmentReportResourceDetails.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,22 +16,27 @@ namespace Azure.ResourceManager.Automanage.Models /// Details about the resource processed by the configuration profile assignment. public partial class ConfigurationProfileAssignmentReportResourceDetails : ResourceData { - /// Initializes a new instance of ConfigurationProfileAssignmentReportResourceDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigurationProfileAssignmentReportResourceDetails() { } - /// Initializes a new instance of ConfigurationProfileAssignmentReportResourceDetails. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Status of the resource. /// Error message, if any, returned when deploying the resource. - internal ConfigurationProfileAssignmentReportResourceDetails(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string status, ResponseError error) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConfigurationProfileAssignmentReportResourceDetails(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string status, ResponseError error, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Status = status; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of the resource. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.Serialization.cs index 046fba2a2b3c..0f6781f5c80a 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage; namespace Azure.ResourceManager.Automanage.Models { - internal partial class ConfigurationProfileList + internal partial class ConfigurationProfileList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfigurationProfileList DeserializeConfigurationProfileList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationProfileList DeserializeConfigurationProfileList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static ConfigurationProfileList DeserializeConfigurationProfileList(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigurationProfileList(Optional.ToList(value)); + return new ConfigurationProfileList(Optional.ToList(value), serializedAdditionalRawData); + } + + ConfigurationProfileList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationProfileList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationProfileList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationProfileList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationProfileList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationProfileList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationProfileList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.cs index 755f74691dcc..279cab03a001 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automanage; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Automanage.Models /// The response of the list configuration profile operation. internal partial class ConfigurationProfileList { - /// Initializes a new instance of ConfigurationProfileList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfigurationProfileList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfigurationProfileList. + /// Initializes a new instance of . /// Result of the list ConfigurationProfile operation. - internal ConfigurationProfileList(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ConfigurationProfileList(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Result of the list ConfigurationProfile operation. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.Serialization.cs index d59dcff0a2b6..119b58a77143 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automanage.Models { - internal partial class ConfigurationProfileProperties : IUtf8JsonSerializable + internal partial class ConfigurationProfileProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Configuration)) { @@ -25,16 +32,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(Configuration.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfigurationProfileProperties DeserializeConfigurationProfileProperties(JsonElement element) + internal static ConfigurationProfileProperties DeserializeConfigurationProfileProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional configuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("configuration"u8)) @@ -46,8 +68,61 @@ internal static ConfigurationProfileProperties DeserializeConfigurationProfilePr configuration = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfigurationProfileProperties(configuration.Value); + return new ConfigurationProfileProperties(configuration.Value, serializedAdditionalRawData); + } + + ConfigurationProfileProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationProfileProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfigurationProfileProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfigurationProfileProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfigurationProfileProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfigurationProfileProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfigurationProfileProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs index 241f159ac84e..bfeb1472f383 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automanage.Models { /// Automanage configuration profile properties. internal partial class ConfigurationProfileProperties { - /// Initializes a new instance of ConfigurationProfileProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfigurationProfileProperties() { } - /// Initializes a new instance of ConfigurationProfileProperties. + /// Initializes a new instance of . /// configuration dictionary of the configuration profile. - internal ConfigurationProfileProperties(BinaryData configuration) + /// Keeps track of any properties unknown to the library. + internal ConfigurationProfileProperties(BinaryData configuration, Dictionary serializedAdditionalRawData) { Configuration = configuration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.Serialization.cs index 0f6d38b3e00b..d44ec0852f8a 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automanage; namespace Azure.ResourceManager.Automanage.Models { - internal partial class ReportList + internal partial class ReportList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReportList DeserializeReportList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReportList DeserializeReportList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static ReportList DeserializeReportList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReportList(Optional.ToList(value)); + return new ReportList(Optional.ToList(value), serializedAdditionalRawData); + } + + ReportList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.cs index 44dac15382bc..ca20ea654649 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ReportList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automanage; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Automanage.Models /// The response of the list report operation. internal partial class ReportList { - /// Initializes a new instance of ReportList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReportList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReportList. + /// Initializes a new instance of . /// Result of the list report operation. - internal ReportList(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ReportList(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Result of the list report operation. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.Serialization.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.Serialization.cs index 8d7adc690cbd..9d42800ad48c 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.Serialization.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automanage.Models { - internal partial class ServicePrincipalListResult + internal partial class ServicePrincipalListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServicePrincipalListResult DeserializeServicePrincipalListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServicePrincipalListResult DeserializeServicePrincipalListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static ServicePrincipalListResult DeserializeServicePrincipalListResult value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServicePrincipalListResult(Optional.ToList(value)); + return new ServicePrincipalListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ServicePrincipalListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServicePrincipalListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServicePrincipalListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServicePrincipalListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServicePrincipalListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServicePrincipalListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServicePrincipalListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.cs index e3ebba7de1a3..11905c89f0c8 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Models/ServicePrincipalListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automanage.Models /// The list of ServicePrincipals. internal partial class ServicePrincipalListResult { - /// Initializes a new instance of ServicePrincipalListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServicePrincipalListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServicePrincipalListResult. + /// Initializes a new instance of . /// The list of servicePrincipals. - internal ServicePrincipalListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ServicePrincipalListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of servicePrincipals. diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileAssignmentsRestOperations.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileAssignmentsRestOperations.cs index 02a77d724125..407064656b4a 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileAssignmentsRestOperations.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileAssignmentsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHCIAssignmentsRestOperations.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHCIAssignmentsRestOperations.cs index 289849286557..b7d519fddbbf 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHCIAssignmentsRestOperations.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHCIAssignmentsRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHcrpAssignmentsRestOperations.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHcrpAssignmentsRestOperations.cs index 1dfc91f57978..7ef3f9448a4c 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHcrpAssignmentsRestOperations.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfileHcrpAssignmentsRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesRestOperations.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesRestOperations.cs index d710393a5880..4498e32d15ec 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesRestOperations.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -294,9 +292,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesVersionsRestOperations.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesVersionsRestOperations.cs index 7de5fa37b66d..c0554fefd5e7 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesVersionsRestOperations.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/RestOperations/ConfigurationProfilesVersionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/ArmAutomationModelFactory.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/ArmAutomationModelFactory.cs index 0aa1aa809f9a..a87e69e55f9a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/ArmAutomationModelFactory.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/ArmAutomationModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Automation.Models /// Model factory for models. public static partial class ArmAutomationModelFactory { - /// Initializes a new instance of AutomationPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,20 +31,20 @@ public static AutomationPrivateEndpointConnectionData AutomationPrivateEndpointC { groupIds ??= new List(); - return new AutomationPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, groupIds?.ToList(), connectionState); + return new AutomationPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, groupIds?.ToList(), connectionState, default); } - /// Initializes a new instance of AutomationPrivateLinkServiceConnectionStateProperty. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). /// A new instance for mocking. public static AutomationPrivateLinkServiceConnectionStateProperty AutomationPrivateLinkServiceConnectionStateProperty(string status = null, string description = null, string actionsRequired = null) { - return new AutomationPrivateLinkServiceConnectionStateProperty(status, description, actionsRequired); + return new AutomationPrivateLinkServiceConnectionStateProperty(status, description, actionsRequired, default); } - /// Initializes a new instance of AutomationPrivateLinkResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -56,10 +56,10 @@ public static AutomationPrivateLinkResource AutomationPrivateLinkResource(Resour { requiredMembers ??= new List(); - return new AutomationPrivateLinkResource(id, name, resourceType, systemData, groupId, requiredMembers?.ToList()); + return new AutomationPrivateLinkResource(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), default); } - /// Initializes a new instance of AutomationModuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -83,10 +83,21 @@ public static AutomationModuleData AutomationModuleData(ResourceIdentifier id = { tags ??= new Dictionary(); - return new AutomationModuleData(id, name, resourceType, systemData, tags, location, etag, isGlobal, version, sizeInBytes, activityCount, provisioningState, contentLink, error, createdOn, lastModifiedOn, description, isComposite); + return new AutomationModuleData(id, name, resourceType, systemData, tags, location, etag, isGlobal, version, sizeInBytes, activityCount, provisioningState, contentLink, error, createdOn, lastModifiedOn, description, isComposite, default); } - /// Initializes a new instance of AgentRegistration. + /// Initializes a new instance of . + /// Gets or sets the tags attached to the resource. + /// Gets or sets the module content link. + /// A new instance for mocking. + public static AutomationAccountPython2PackageCreateOrUpdateContent AutomationAccountPython2PackageCreateOrUpdateContent(IDictionary tags = null, AutomationContentLink contentLink = null) + { + tags ??= new Dictionary(); + + return new AutomationAccountPython2PackageCreateOrUpdateContent(tags, contentLink, default); + } + + /// Initializes a new instance of . /// Gets or sets the dsc meta configuration. /// Gets or sets the dsc server endpoint. /// Gets or sets the agent registration keys. @@ -94,19 +105,19 @@ public static AutomationModuleData AutomationModuleData(ResourceIdentifier id = /// A new instance for mocking. public static AgentRegistration AgentRegistration(string dscMetaConfiguration = null, Uri endpoint = null, AgentRegistrationKeys keys = null, ResourceIdentifier id = null) { - return new AgentRegistration(dscMetaConfiguration, endpoint, keys, id); + return new AgentRegistration(dscMetaConfiguration, endpoint, keys, id, default); } - /// Initializes a new instance of AgentRegistrationKeys. + /// Initializes a new instance of . /// Gets or sets the primary key. /// Gets or sets the secondary key. /// A new instance for mocking. public static AgentRegistrationKeys AgentRegistrationKeys(string primary = null, string secondary = null) { - return new AgentRegistrationKeys(primary, secondary); + return new AgentRegistrationKeys(primary, secondary, default); } - /// Initializes a new instance of DscNodeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -126,10 +137,10 @@ public static DscNodeData DscNodeData(ResourceIdentifier id = null, string name { extensionHandler ??= new List(); - return new DscNodeData(id, name, resourceType, systemData, lastSeenOn, registrationOn, ip, accountId, status, nodeId, etag, totalCount, extensionHandler?.ToList(), namePropertiesNodeConfigurationName); + return new DscNodeData(id, name, resourceType, systemData, lastSeenOn, registrationOn, ip, accountId, status, nodeId, etag, totalCount, extensionHandler?.ToList(), namePropertiesNodeConfigurationName, default); } - /// Initializes a new instance of DscNodeReport. + /// Initializes a new instance of . /// Gets or sets the end time of the node report. /// Gets or sets the lastModifiedTime of the node report. /// Gets or sets the start time of the node report. @@ -157,10 +168,10 @@ public static DscNodeReport DscNodeReport(DateTimeOffset? endOn = null, DateTime ipV4Addresses ??= new List(); ipV6Addresses ??= new List(); - return new DscNodeReport(endOn, lastModifiedOn, startOn, dscNodeReportType, reportId, status, refreshMode, rebootRequested, reportFormatVersion, configurationVersion, id, errors?.ToList(), resources?.ToList(), metaConfiguration, hostName, ipV4Addresses?.ToList(), ipV6Addresses?.ToList(), numberOfResources, rawErrors); + return new DscNodeReport(endOn, lastModifiedOn, startOn, dscNodeReportType, reportId, status, refreshMode, rebootRequested, reportFormatVersion, configurationVersion, id, errors?.ToList(), resources?.ToList(), metaConfiguration, hostName, ipV4Addresses?.ToList(), ipV6Addresses?.ToList(), numberOfResources, rawErrors, default); } - /// Initializes a new instance of DscReportError. + /// Initializes a new instance of . /// Gets or sets the source of the error. /// Gets or sets the resource ID which generated the error. /// Gets or sets the error code. @@ -170,10 +181,10 @@ public static DscNodeReport DscNodeReport(DateTimeOffset? endOn = null, DateTime /// A new instance for mocking. public static DscReportError DscReportError(string errorSource = null, string resourceId = null, string errorCode = null, string errorMessage = null, string locale = null, string errorDetails = null) { - return new DscReportError(errorSource, resourceId, errorCode, errorMessage, locale, errorDetails); + return new DscReportError(errorSource, resourceId, errorCode, errorMessage, locale, errorDetails, default); } - /// Initializes a new instance of DscReportResource. + /// Initializes a new instance of . /// Gets or sets the ID of the resource. /// Gets or sets the source info of the resource. /// Gets or sets the Resource Navigation values for resources the resource depends on. @@ -189,18 +200,18 @@ public static DscReportResource DscReportResource(string resourceId = null, stri { dependsOn ??= new List(); - return new DscReportResource(resourceId, sourceInfo, dependsOn?.ToList(), moduleName, moduleVersion, resourceName, error, status, durationInSeconds, startOn); + return new DscReportResource(resourceId, sourceInfo, dependsOn?.ToList(), moduleName, moduleVersion, resourceName, error, status, durationInSeconds, startOn, default); } - /// Initializes a new instance of DscReportResourceNavigation. + /// Initializes a new instance of . /// Gets or sets the ID of the resource to navigate to. /// A new instance for mocking. public static DscReportResourceNavigation DscReportResourceNavigation(string resourceId = null) { - return new DscReportResourceNavigation(resourceId); + return new DscReportResourceNavigation(resourceId, default); } - /// Initializes a new instance of DscMetaConfiguration. + /// Initializes a new instance of . /// Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. /// Gets or sets the RebootNodeIfNeeded value of the meta configuration. /// Gets or sets the ConfigurationMode value of the meta configuration. @@ -211,10 +222,10 @@ public static DscReportResourceNavigation DscReportResourceNavigation(string res /// A new instance for mocking. public static DscMetaConfiguration DscMetaConfiguration(int? configurationModeFrequencyMins = null, bool? rebootNodeIfNeeded = null, string configurationMode = null, string actionAfterReboot = null, string certificateId = null, int? refreshFrequencyMins = null, bool? allowModuleOverwrite = null) { - return new DscMetaConfiguration(configurationModeFrequencyMins, rebootNodeIfNeeded, configurationMode, actionAfterReboot, certificateId, refreshFrequencyMins, allowModuleOverwrite); + return new DscMetaConfiguration(configurationModeFrequencyMins, rebootNodeIfNeeded, configurationMode, actionAfterReboot, certificateId, refreshFrequencyMins, allowModuleOverwrite, default); } - /// Initializes a new instance of DscNodeConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -228,10 +239,26 @@ public static DscMetaConfiguration DscMetaConfiguration(int? configurationModeFr /// A new instance for mocking. public static DscNodeConfigurationData DscNodeConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? lastModifiedOn = null, DateTimeOffset? createdOn = null, string configurationName = null, string source = null, long? nodeCount = null, bool? isIncrementNodeConfigurationBuildRequired = null) { - return new DscNodeConfigurationData(id, name, resourceType, systemData, lastModifiedOn, createdOn, configurationName != null ? new DscConfigurationAssociationProperty(configurationName) : null, source, nodeCount, isIncrementNodeConfigurationBuildRequired); + return new DscNodeConfigurationData(id, name, resourceType, systemData, lastModifiedOn, createdOn, configurationName != null ? new DscConfigurationAssociationProperty(configurationName, new Dictionary()) : null, source, nodeCount, isIncrementNodeConfigurationBuildRequired, default); } - /// Initializes a new instance of DscCompilationJobData. + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the configuration. + /// Gets or sets the parameters of the job. + /// If a new build version of NodeConfiguration is required. + /// A new instance for mocking. + public static DscCompilationJobCreateOrUpdateContent DscCompilationJobCreateOrUpdateContent(string name = null, AzureLocation? location = null, IDictionary tags = null, string configurationName = null, IDictionary parameters = null, bool? isIncrementNodeConfigurationBuildRequired = null) + { + tags ??= new Dictionary(); + parameters ??= new Dictionary(); + + return new DscCompilationJobCreateOrUpdateContent(name, location, tags, configurationName != null ? new DscConfigurationAssociationProperty(configurationName, new Dictionary()) : null, parameters, isIncrementNodeConfigurationBuildRequired, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -255,10 +282,10 @@ public static DscCompilationJobData DscCompilationJobData(ResourceIdentifier id { parameters ??= new Dictionary(); - return new DscCompilationJobData(id, name, resourceType, systemData, configurationName != null ? new DscConfigurationAssociationProperty(configurationName) : null, startedBy, jobId, createdOn, provisioningState, runOn, status, statusDetails, startOn, endOn, exception, lastModifiedOn, lastStatusModifiedOn, parameters); + return new DscCompilationJobData(id, name, resourceType, systemData, configurationName != null ? new DscConfigurationAssociationProperty(configurationName, new Dictionary()) : null, startedBy, jobId, createdOn, provisioningState, runOn, status, statusDetails, startOn, endOn, exception, lastModifiedOn, lastStatusModifiedOn, parameters, default); } - /// Initializes a new instance of AutomationJobStream. + /// Initializes a new instance of . /// Gets or sets the id of the resource. /// Gets or sets the id of the job stream. /// Gets or sets the creation time of the job. @@ -271,19 +298,19 @@ public static AutomationJobStream AutomationJobStream(ResourceIdentifier id = nu { value ??= new Dictionary(); - return new AutomationJobStream(id, jobStreamId, time, streamType, streamText, summary, value); + return new AutomationJobStream(id, jobStreamId, time, streamType, streamText, summary, value, default); } - /// Initializes a new instance of DscNodeCount. + /// Initializes a new instance of . /// Gets the name of a count type. /// /// A new instance for mocking. public static DscNodeCount DscNodeCount(string name = null, int? nameCount = null) { - return new DscNodeCount(name, nameCount != null ? new DscNodeCountProperties(nameCount) : null); + return new DscNodeCount(name, nameCount != null ? new DscNodeCountProperties(nameCount, new Dictionary()) : null, default); } - /// Initializes a new instance of AutomationSourceControlData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -300,10 +327,10 @@ public static DscNodeCount DscNodeCount(string name = null, int? nameCount = nul /// A new instance for mocking. public static AutomationSourceControlData AutomationSourceControlData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Uri repoUri = null, string branch = null, string folderPath = null, bool? isAutoSyncEnabled = null, bool? isAutoPublishRunbookEnabled = null, SourceControlSourceType? sourceType = null, string description = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null) { - return new AutomationSourceControlData(id, name, resourceType, systemData, repoUri, branch, folderPath, isAutoSyncEnabled, isAutoPublishRunbookEnabled, sourceType, description, createdOn, lastModifiedOn); + return new AutomationSourceControlData(id, name, resourceType, systemData, repoUri, branch, folderPath, isAutoSyncEnabled, isAutoPublishRunbookEnabled, sourceType, description, createdOn, lastModifiedOn, default); } - /// Initializes a new instance of SourceControlSyncJob. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -317,10 +344,10 @@ public static AutomationSourceControlData AutomationSourceControlData(ResourceId /// A new instance for mocking. public static SourceControlSyncJob SourceControlSyncJob(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string sourceControlSyncJobId = null, DateTimeOffset? createdOn = null, SourceControlProvisioningState? provisioningState = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, SourceControlSyncType? syncType = null) { - return new SourceControlSyncJob(id, name, resourceType, systemData, sourceControlSyncJobId, createdOn, provisioningState, startOn, endOn, syncType); + return new SourceControlSyncJob(id, name, resourceType, systemData, sourceControlSyncJobId, createdOn, provisioningState, startOn, endOn, syncType, default); } - /// Initializes a new instance of SourceControlSyncJobResult. + /// Initializes a new instance of . /// The id of the job. /// The source control sync job id. /// The creation time of the job. @@ -332,10 +359,10 @@ public static SourceControlSyncJob SourceControlSyncJob(ResourceIdentifier id = /// A new instance for mocking. public static SourceControlSyncJobResult SourceControlSyncJobResult(ResourceIdentifier id = null, string sourceControlSyncJobId = null, DateTimeOffset? createdOn = null, SourceControlProvisioningState? provisioningState = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, SourceControlSyncType? syncType = null, string exception = null) { - return new SourceControlSyncJobResult(id, sourceControlSyncJobId, createdOn, provisioningState, startOn, endOn, syncType, exception); + return new SourceControlSyncJobResult(id, sourceControlSyncJobId, createdOn, provisioningState, startOn, endOn, syncType, exception, default); } - /// Initializes a new instance of SourceControlSyncJobStream. + /// Initializes a new instance of . /// Resource id. /// The sync job stream id. /// The summary of the sync job stream. @@ -344,10 +371,10 @@ public static SourceControlSyncJobResult SourceControlSyncJobResult(ResourceIden /// A new instance for mocking. public static SourceControlSyncJobStream SourceControlSyncJobStream(ResourceIdentifier id = null, string sourceControlSyncJobStreamId = null, string summary = null, DateTimeOffset? time = null, SourceControlStreamType? streamType = null) { - return new SourceControlSyncJobStream(id, sourceControlSyncJobStreamId, summary, time, streamType); + return new SourceControlSyncJobStream(id, sourceControlSyncJobStreamId, summary, time, streamType, default); } - /// Initializes a new instance of SourceControlSyncJobStreamResult. + /// Initializes a new instance of . /// Resource id. /// The sync job stream id. /// The summary of the sync job stream. @@ -360,10 +387,10 @@ public static SourceControlSyncJobStreamResult SourceControlSyncJobStreamResult( { value ??= new Dictionary(); - return new SourceControlSyncJobStreamResult(id, sourceControlSyncJobStreamId, summary, time, streamType, streamText, value); + return new SourceControlSyncJobStreamResult(id, sourceControlSyncJobStreamId, summary, time, streamType, streamText, value, default); } - /// Initializes a new instance of AutomationAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -389,10 +416,10 @@ public static AutomationAccountData AutomationAccountData(ResourceIdentifier id tags ??= new Dictionary(); privateEndpointConnections ??= new List(); - return new AutomationAccountData(id, name, resourceType, systemData, tags, location, etag, identity, sku, lastModifiedBy, state, createdOn, lastModifiedOn, description, encryption, privateEndpointConnections?.ToList(), isPublicNetworkAccessAllowed, isLocalAuthDisabled, automationHybridServiceUri); + return new AutomationAccountData(id, name, resourceType, systemData, tags, location, etag, identity, sku, lastModifiedBy, state, createdOn, lastModifiedOn, description, encryption, privateEndpointConnections?.ToList(), isPublicNetworkAccessAllowed, isLocalAuthDisabled, automationHybridServiceUri, default); } - /// Initializes a new instance of AutomationAccountStatistics. + /// Initializes a new instance of . /// Gets the property value of the statistic. /// Gets the value of the statistic. /// Gets the startTime of the statistic. @@ -401,10 +428,10 @@ public static AutomationAccountData AutomationAccountData(ResourceIdentifier id /// A new instance for mocking. public static AutomationAccountStatistics AutomationAccountStatistics(string counterProperty = null, long? counterValue = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string id = null) { - return new AutomationAccountStatistics(counterProperty, counterValue, startOn, endOn, id); + return new AutomationAccountStatistics(counterProperty, counterValue, startOn, endOn, id, default); } - /// Initializes a new instance of AutomationUsage. + /// Initializes a new instance of . /// Gets or sets the id of the resource. /// Gets or sets the usage counter name. /// Gets or sets the usage unit name. @@ -414,29 +441,29 @@ public static AutomationAccountStatistics AutomationAccountStatistics(string cou /// A new instance for mocking. public static AutomationUsage AutomationUsage(string id = null, AutomationUsageCounterName name = null, string unit = null, double? currentValue = null, long? limit = null, string throttleStatus = null) { - return new AutomationUsage(id, name, unit, currentValue, limit, throttleStatus); + return new AutomationUsage(id, name, unit, currentValue, limit, throttleStatus, default); } - /// Initializes a new instance of AutomationUsageCounterName. + /// Initializes a new instance of . /// Gets or sets the usage counter name. /// Gets or sets the localized usage counter name. /// A new instance for mocking. public static AutomationUsageCounterName AutomationUsageCounterName(string value = null, string localizedValue = null) { - return new AutomationUsageCounterName(value, localizedValue); + return new AutomationUsageCounterName(value, localizedValue, default); } - /// Initializes a new instance of AutomationKey. + /// Initializes a new instance of . /// Automation key name. /// Automation key permissions. /// Value of the Automation Key used for registration. /// A new instance for mocking. public static AutomationKey AutomationKey(AutomationKeyName? keyName = null, AutomationKeyPermission? permissions = null, string value = null) { - return new AutomationKey(keyName, permissions, value); + return new AutomationKey(keyName, permissions, value, default); } - /// Initializes a new instance of AutomationCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -450,10 +477,22 @@ public static AutomationKey AutomationKey(AutomationKeyName? keyName = null, Aut /// A new instance for mocking. public static AutomationCertificateData AutomationCertificateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string thumbprintString = null, DateTimeOffset? expireOn = null, bool? isExportable = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, string description = null) { - return new AutomationCertificateData(id, name, resourceType, systemData, thumbprintString, expireOn, isExportable, createdOn, lastModifiedOn, description); + return new AutomationCertificateData(id, name, resourceType, systemData, thumbprintString, expireOn, isExportable, createdOn, lastModifiedOn, description, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the certificate. + /// Gets or sets the base64 encoded value of the certificate. + /// Gets or sets the description of the certificate. + /// Gets or sets the thumbprint of the certificate. + /// Gets or sets the is exportable flag of the certificate. + /// A new instance for mocking. + public static AutomationCertificateCreateOrUpdateContent AutomationCertificateCreateOrUpdateContent(string name = null, string base64Value = null, string description = null, string thumbprintString = null, bool? isExportable = null) + { + return new AutomationCertificateCreateOrUpdateContent(name, base64Value, description, thumbprintString, isExportable, default); } - /// Initializes a new instance of AutomationConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -468,10 +507,23 @@ public static AutomationConnectionData AutomationConnectionData(ResourceIdentifi { fieldDefinitionValues ??= new Dictionary(); - return new AutomationConnectionData(id, name, resourceType, systemData, connectionTypeName != null ? new ConnectionTypeAssociationProperty(connectionTypeName) : null, fieldDefinitionValues, createdOn, lastModifiedOn, description); + return new AutomationConnectionData(id, name, resourceType, systemData, connectionTypeName != null ? new ConnectionTypeAssociationProperty(connectionTypeName, new Dictionary()) : null, fieldDefinitionValues, createdOn, lastModifiedOn, description, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the connection. + /// Gets or sets the description of the connection. + /// Gets or sets the connectionType of the connection. + /// Gets or sets the field definition properties of the connection. + /// A new instance for mocking. + public static AutomationConnectionCreateOrUpdateContent AutomationConnectionCreateOrUpdateContent(string name = null, string description = null, string connectionTypeName = null, IDictionary fieldDefinitionValues = null) + { + fieldDefinitionValues ??= new Dictionary(); + + return new AutomationConnectionCreateOrUpdateContent(name, description, connectionTypeName != null ? new ConnectionTypeAssociationProperty(connectionTypeName, new Dictionary()) : null, fieldDefinitionValues, default); } - /// Initializes a new instance of AutomationConnectionTypeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -486,10 +538,22 @@ public static AutomationConnectionTypeData AutomationConnectionTypeData(Resource { fieldDefinitions ??= new Dictionary(); - return new AutomationConnectionTypeData(id, name, resourceType, systemData, isGlobal, fieldDefinitions, createdOn, lastModifiedOn, description); + return new AutomationConnectionTypeData(id, name, resourceType, systemData, isGlobal, fieldDefinitions, createdOn, lastModifiedOn, description, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the connection type. + /// Gets or sets a Boolean value to indicate if the connection type is global. + /// Gets or sets the field definitions of the connection type. + /// A new instance for mocking. + public static AutomationConnectionTypeCreateOrUpdateContent AutomationConnectionTypeCreateOrUpdateContent(string name = null, bool? isGlobal = null, IDictionary fieldDefinitions = null) + { + fieldDefinitions ??= new Dictionary(); + + return new AutomationConnectionTypeCreateOrUpdateContent(name, isGlobal, fieldDefinitions, default); } - /// Initializes a new instance of AutomationCredentialData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -501,10 +565,21 @@ public static AutomationConnectionTypeData AutomationConnectionTypeData(Resource /// A new instance for mocking. public static AutomationCredentialData AutomationCredentialData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string userName = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, string description = null) { - return new AutomationCredentialData(id, name, resourceType, systemData, userName, createdOn, lastModifiedOn, description); + return new AutomationCredentialData(id, name, resourceType, systemData, userName, createdOn, lastModifiedOn, description, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the credential. + /// Gets or sets the user name of the credential. + /// Gets or sets the password of the credential. + /// Gets or sets the description of the credential. + /// A new instance for mocking. + public static AutomationCredentialCreateOrUpdateContent AutomationCredentialCreateOrUpdateContent(string name = null, string userName = null, string password = null, string description = null) + { + return new AutomationCredentialCreateOrUpdateContent(name, userName, password, description, default); } - /// Initializes a new instance of AutomationJobScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -519,18 +594,31 @@ public static AutomationJobScheduleData AutomationJobScheduleData(ResourceIdenti { parameters ??= new Dictionary(); - return new AutomationJobScheduleData(id, name, resourceType, systemData, jobScheduleId, scheduleName != null ? new ScheduleAssociationProperty(scheduleName) : null, runbookName != null ? new RunbookAssociationProperty(runbookName) : null, runOn, parameters); + return new AutomationJobScheduleData(id, name, resourceType, systemData, jobScheduleId, scheduleName != null ? new ScheduleAssociationProperty(scheduleName, new Dictionary()) : null, runbookName != null ? new RunbookAssociationProperty(runbookName, new Dictionary()) : null, runOn, parameters, default); } - /// Initializes a new instance of AutomationLinkedWorkspace. + /// Initializes a new instance of . + /// Gets or sets the schedule. + /// Gets or sets the runbook. + /// Gets or sets the hybrid worker group that the scheduled job should run on. + /// Gets or sets a list of job properties. + /// A new instance for mocking. + public static AutomationJobScheduleCreateOrUpdateContent AutomationJobScheduleCreateOrUpdateContent(string scheduleName = null, string runbookName = null, string runOn = null, IDictionary parameters = null) + { + parameters ??= new Dictionary(); + + return new AutomationJobScheduleCreateOrUpdateContent(scheduleName != null ? new ScheduleAssociationProperty(scheduleName, new Dictionary()) : null, runbookName != null ? new RunbookAssociationProperty(runbookName, new Dictionary()) : null, runOn, parameters, default); + } + + /// Initializes a new instance of . /// Gets the id of the linked workspace. /// A new instance for mocking. public static AutomationLinkedWorkspace AutomationLinkedWorkspace(string id = null) { - return new AutomationLinkedWorkspace(id); + return new AutomationLinkedWorkspace(id, default); } - /// Initializes a new instance of AutomationActivity. + /// Initializes a new instance of . /// Gets or sets the id of the resource. /// Gets the name of the activity. /// Gets or sets the user name of the activity. @@ -545,10 +633,10 @@ public static AutomationActivity AutomationActivity(ResourceIdentifier id = null parameterSets ??= new List(); outputTypes ??= new List(); - return new AutomationActivity(id, name, definition, parameterSets?.ToList(), outputTypes?.ToList(), createdOn, lastModifiedOn, description); + return new AutomationActivity(id, name, definition, parameterSets?.ToList(), outputTypes?.ToList(), createdOn, lastModifiedOn, description, default); } - /// Initializes a new instance of AutomationActivityParameterSet. + /// Initializes a new instance of . /// Gets or sets the name of the activity parameter set. /// Gets or sets the parameters of the activity parameter set. /// A new instance for mocking. @@ -556,10 +644,10 @@ public static AutomationActivityParameterSet AutomationActivityParameterSet(stri { parameters ??= new List(); - return new AutomationActivityParameterSet(name, parameters?.ToList()); + return new AutomationActivityParameterSet(name, parameters?.ToList(), default); } - /// Initializes a new instance of AutomationActivityParameterDefinition. + /// Initializes a new instance of . /// Gets or sets the name of the activity parameter. /// Gets or sets the type of the activity parameter. /// Gets or sets a Boolean value that indicates true if the parameter is required. If the value is false, the parameter is optional. @@ -575,36 +663,64 @@ public static AutomationActivityParameterDefinition AutomationActivityParameterD { validationSet ??= new List(); - return new AutomationActivityParameterDefinition(name, activityParameterType, isMandatory, isDynamic, position, canTakeValueFromPipeline, canTakeValueFromPipelineByPropertyName, canTakeValueValueFromRemainingArguments, description, validationSet?.ToList()); + return new AutomationActivityParameterDefinition(name, activityParameterType, isMandatory, isDynamic, position, canTakeValueFromPipeline, canTakeValueFromPipelineByPropertyName, canTakeValueValueFromRemainingArguments, description, validationSet?.ToList(), default); } - /// Initializes a new instance of AutomationActivityParameterValidationSet. + /// Initializes a new instance of . /// Gets or sets the name of the activity parameter validation set member. /// A new instance for mocking. public static AutomationActivityParameterValidationSet AutomationActivityParameterValidationSet(string memberValue = null) { - return new AutomationActivityParameterValidationSet(memberValue); + return new AutomationActivityParameterValidationSet(memberValue, default); } - /// Initializes a new instance of AutomationActivityOutputType. + /// Initializes a new instance of . /// Gets or sets the name of the activity output type. /// Gets or sets the type of the activity output type. /// A new instance for mocking. public static AutomationActivityOutputType AutomationActivityOutputType(string name = null, string activityOutputType = null) { - return new AutomationActivityOutputType(name, activityOutputType); + return new AutomationActivityOutputType(name, activityOutputType, default); } - /// Initializes a new instance of AutomationModuleField. + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the module content link. + /// A new instance for mocking. + public static AutomationAccountModuleCreateOrUpdateContent AutomationAccountModuleCreateOrUpdateContent(string name = null, AzureLocation? location = null, IDictionary tags = null, AutomationContentLink contentLink = null) + { + tags ??= new Dictionary(); + + return new AutomationAccountModuleCreateOrUpdateContent(name, location, tags, contentLink, default); + } + + /// Initializes a new instance of . /// Gets or sets the name of the field. /// Gets or sets the type of the field. /// A new instance for mocking. public static AutomationModuleField AutomationModuleField(string name = null, string fieldType = null) { - return new AutomationModuleField(name, fieldType); + return new AutomationModuleField(name, fieldType, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the Schedule. + /// Gets or sets the description of the schedule. + /// Gets or sets the start time of the schedule. + /// Gets or sets the end time of the schedule. + /// Gets or sets the interval of the schedule. + /// Gets or sets the frequency of the schedule. + /// Gets or sets the time zone of the schedule. + /// Gets or sets the AdvancedSchedule. + /// A new instance for mocking. + public static AutomationScheduleCreateOrUpdateContent AutomationScheduleCreateOrUpdateContent(string name = null, string description = null, DateTimeOffset startOn = default, DateTimeOffset? expireOn = null, BinaryData interval = null, AutomationScheduleFrequency frequency = default, string timeZone = null, AutomationAdvancedSchedule advancedSchedule = null) + { + return new AutomationScheduleCreateOrUpdateContent(name, description, startOn, expireOn, interval, frequency, timeZone, advancedSchedule, default); } - /// Initializes a new instance of AutomationScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -626,10 +742,21 @@ public static AutomationModuleField AutomationModuleField(string name = null, st /// A new instance for mocking. public static AutomationScheduleData AutomationScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? startOn = null, double? startInMinutes = null, DateTimeOffset? expireOn = null, double? expireInMinutes = null, bool? isEnabled = null, DateTimeOffset? nextRunOn = null, double? nextRunInMinutes = null, BinaryData interval = null, AutomationScheduleFrequency? frequency = null, string timeZone = null, AutomationAdvancedSchedule advancedSchedule = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, string description = null) { - return new AutomationScheduleData(id, name, resourceType, systemData, startOn, startInMinutes, expireOn, expireInMinutes, isEnabled, nextRunOn, nextRunInMinutes, interval, frequency, timeZone, advancedSchedule, createdOn, lastModifiedOn, description); + return new AutomationScheduleData(id, name, resourceType, systemData, startOn, startInMinutes, expireOn, expireInMinutes, isEnabled, nextRunOn, nextRunInMinutes, interval, frequency, timeZone, advancedSchedule, createdOn, lastModifiedOn, description, default); } - /// Initializes a new instance of AutomationVariableData. + /// Initializes a new instance of . + /// Gets or sets the name of the variable. + /// Gets or sets the value of the variable. + /// Gets or sets the description of the variable. + /// Gets or sets the encrypted flag of the variable. + /// A new instance for mocking. + public static AutomationVariableCreateOrUpdateContent AutomationVariableCreateOrUpdateContent(string name = null, string value = null, string description = null, bool? isEncrypted = null) + { + return new AutomationVariableCreateOrUpdateContent(name, value, description, isEncrypted, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -642,10 +769,10 @@ public static AutomationScheduleData AutomationScheduleData(ResourceIdentifier i /// A new instance for mocking. public static AutomationVariableData AutomationVariableData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, bool? isEncrypted = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, string description = null) { - return new AutomationVariableData(id, name, resourceType, systemData, value, isEncrypted, createdOn, lastModifiedOn, description); + return new AutomationVariableData(id, name, resourceType, systemData, value, isEncrypted, createdOn, lastModifiedOn, description, default); } - /// Initializes a new instance of AutomationWatcherData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -668,10 +795,10 @@ public static AutomationWatcherData AutomationWatcherData(ResourceIdentifier id tags ??= new Dictionary(); scriptParameters ??= new Dictionary(); - return new AutomationWatcherData(id, name, resourceType, systemData, tags, location, etag, executionFrequencyInSeconds, scriptName, scriptParameters, scriptRunOn, status, createdOn, lastModifiedOn, lastModifiedBy, description); + return new AutomationWatcherData(id, name, resourceType, systemData, tags, location, etag, executionFrequencyInSeconds, scriptName, scriptParameters, scriptRunOn, status, createdOn, lastModifiedOn, lastModifiedBy, description, default); } - /// Initializes a new instance of DscConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -695,10 +822,28 @@ public static DscConfigurationData DscConfigurationData(ResourceIdentifier id = tags ??= new Dictionary(); parameters ??= new Dictionary(); - return new DscConfigurationData(id, name, resourceType, systemData, tags, location, etag, provisioningState, jobCount, parameters, source, state, isLogVerboseEnabled, createdOn, lastModifiedOn, nodeConfigurationCount, description); + return new DscConfigurationData(id, name, resourceType, systemData, tags, location, etag, provisioningState, jobCount, parameters, source, state, isLogVerboseEnabled, createdOn, lastModifiedOn, nodeConfigurationCount, description, default); } - /// Initializes a new instance of AutomationJobData. + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets verbose log option. + /// Gets or sets progress log option. + /// Gets or sets the source. + /// Gets or sets the configuration parameters. + /// Gets or sets the description of the configuration. + /// A new instance for mocking. + public static DscConfigurationCreateOrUpdateContent DscConfigurationCreateOrUpdateContent(string name = null, AzureLocation? location = null, IDictionary tags = null, bool? isLogVerboseEnabled = null, bool? isLogProgressEnabled = null, AutomationContentSource source = null, IDictionary parameters = null, string description = null) + { + tags ??= new Dictionary(); + parameters ??= new Dictionary(); + + return new DscConfigurationCreateOrUpdateContent(name, location, tags, isLogVerboseEnabled, isLogProgressEnabled, source, parameters, description, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -722,10 +867,10 @@ public static AutomationJobData AutomationJobData(ResourceIdentifier id = null, { parameters ??= new Dictionary(); - return new AutomationJobData(id, name, resourceType, systemData, runbookName != null ? new RunbookAssociationProperty(runbookName) : null, startedBy, runOn, jobId, createdOn, status, statusDetails, startOn, endOn, exception, lastModifiedOn, lastStatusModifiedOn, parameters, provisioningState); + return new AutomationJobData(id, name, resourceType, systemData, runbookName != null ? new RunbookAssociationProperty(runbookName, new Dictionary()) : null, startedBy, runOn, jobId, createdOn, status, statusDetails, startOn, endOn, exception, lastModifiedOn, lastStatusModifiedOn, parameters, provisioningState, default); } - /// Initializes a new instance of AutomationJobCollectionItemData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -742,10 +887,10 @@ public static AutomationJobData AutomationJobData(ResourceIdentifier id = null, /// A new instance for mocking. public static AutomationJobCollectionItemData AutomationJobCollectionItemData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string runbookName = null, Guid? jobId = null, DateTimeOffset? createdOn = null, AutomationJobStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, DateTimeOffset? lastModifiedOn = null, string provisioningState = null, string runOn = null) { - return new AutomationJobCollectionItemData(id, name, resourceType, systemData, runbookName != null ? new RunbookAssociationProperty(runbookName) : null, jobId, createdOn, status, startOn, endOn, lastModifiedOn, provisioningState, runOn); + return new AutomationJobCollectionItemData(id, name, resourceType, systemData, runbookName != null ? new RunbookAssociationProperty(runbookName, new Dictionary()) : null, jobId, createdOn, status, startOn, endOn, lastModifiedOn, provisioningState, runOn, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -762,10 +907,10 @@ public static AutomationJobCollectionItemData AutomationJobCollectionItemData(Re /// A new instance for mocking. public static SoftwareUpdateConfigurationData SoftwareUpdateConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SoftwareUpdateConfigurationSpecificProperties updateConfiguration = null, SoftwareUpdateConfigurationScheduleProperties scheduleInfo = null, string provisioningState = null, AutomationResponseError error = null, DateTimeOffset? createdOn = null, string createdBy = null, DateTimeOffset? lastModifiedOn = null, string lastModifiedBy = null, SoftwareUpdateConfigurationTasks tasks = null) { - return new SoftwareUpdateConfigurationData(id, name, resourceType, systemData, updateConfiguration, scheduleInfo, provisioningState, error, createdOn, createdBy, lastModifiedOn, lastModifiedBy, tasks); + return new SoftwareUpdateConfigurationData(id, name, resourceType, systemData, updateConfiguration, scheduleInfo, provisioningState, error, createdOn, createdBy, lastModifiedOn, lastModifiedBy, tasks, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationScheduleProperties. + /// Initializes a new instance of . /// Gets or sets the start time of the schedule. /// Gets the start time's offset in minutes. /// Gets or sets the end time of the schedule. @@ -783,10 +928,10 @@ public static SoftwareUpdateConfigurationData SoftwareUpdateConfigurationData(Re /// A new instance for mocking. public static SoftwareUpdateConfigurationScheduleProperties SoftwareUpdateConfigurationScheduleProperties(DateTimeOffset? startOn = null, double? startInMinutes = null, DateTimeOffset? expireOn = null, double? expireInMinutes = null, bool? isEnabled = null, DateTimeOffset? nextRunOn = null, double? nextRunInMinutes = null, long? interval = null, AutomationScheduleFrequency? frequency = null, string timeZone = null, AutomationAdvancedSchedule advancedSchedule = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, string description = null) { - return new SoftwareUpdateConfigurationScheduleProperties(startOn, startInMinutes, expireOn, expireInMinutes, isEnabled, nextRunOn, nextRunInMinutes, interval, frequency, timeZone, advancedSchedule, createdOn, lastModifiedOn, description); + return new SoftwareUpdateConfigurationScheduleProperties(startOn, startInMinutes, expireOn, expireInMinutes, isEnabled, nextRunOn, nextRunInMinutes, interval, frequency, timeZone, advancedSchedule, createdOn, lastModifiedOn, description, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationCollectionItem. + /// Initializes a new instance of . /// Name of the software update configuration. /// Resource Id of the software update configuration. /// Update specific properties of the software update configuration. @@ -800,10 +945,10 @@ public static SoftwareUpdateConfigurationScheduleProperties SoftwareUpdateConfig /// A new instance for mocking. public static SoftwareUpdateConfigurationCollectionItem SoftwareUpdateConfigurationCollectionItem(string name = null, ResourceIdentifier id = null, SoftwareUpdateConfigurationSpecificProperties updateConfiguration = null, SoftwareUpdateConfigurationTasks tasks = null, AutomationScheduleFrequency? frequency = null, DateTimeOffset? startOn = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, string provisioningState = null, DateTimeOffset? nextRunOn = null) { - return new SoftwareUpdateConfigurationCollectionItem(name, id, updateConfiguration, tasks, frequency, startOn, createdOn, lastModifiedOn, provisioningState, nextRunOn); + return new SoftwareUpdateConfigurationCollectionItem(name, id, updateConfiguration, tasks, frequency, startOn, createdOn, lastModifiedOn, provisioningState, nextRunOn, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationRun. + /// Initializes a new instance of . /// Name of the software update configuration run. /// Resource Id of the software update configuration run. /// software update configuration triggered this run. @@ -822,29 +967,29 @@ public static SoftwareUpdateConfigurationCollectionItem SoftwareUpdateConfigurat /// A new instance for mocking. public static SoftwareUpdateConfigurationRun SoftwareUpdateConfigurationRun(string name = null, ResourceIdentifier id = null, string softwareUpdateName = null, string status = null, TimeSpan? configuredDuration = null, string osType = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, int? computerCount = null, int? failedCount = null, DateTimeOffset? createdOn = null, string createdBy = null, DateTimeOffset? lastModifiedOn = null, string lastModifiedBy = null, SoftwareUpdateConfigurationRunTasks tasks = null) { - return new SoftwareUpdateConfigurationRun(name, id, softwareUpdateName != null ? new SoftwareUpdateConfigurationNavigation(softwareUpdateName) : null, status, configuredDuration, osType, startOn, endOn, computerCount, failedCount, createdOn, createdBy, lastModifiedOn, lastModifiedBy, tasks); + return new SoftwareUpdateConfigurationRun(name, id, softwareUpdateName != null ? new SoftwareUpdateConfigurationNavigation(softwareUpdateName, new Dictionary()) : null, status, configuredDuration, osType, startOn, endOn, computerCount, failedCount, createdOn, createdBy, lastModifiedOn, lastModifiedBy, tasks, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationRunTasks. + /// Initializes a new instance of . /// Pre task properties. /// Post task properties. /// A new instance for mocking. public static SoftwareUpdateConfigurationRunTasks SoftwareUpdateConfigurationRunTasks(SoftwareUpdateConfigurationRunTaskProperties preTask = null, SoftwareUpdateConfigurationRunTaskProperties postTask = null) { - return new SoftwareUpdateConfigurationRunTasks(preTask, postTask); + return new SoftwareUpdateConfigurationRunTasks(preTask, postTask, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationRunTaskProperties. + /// Initializes a new instance of . /// The status of the task. /// The name of the source of the task. /// The job id of the task. /// A new instance for mocking. public static SoftwareUpdateConfigurationRunTaskProperties SoftwareUpdateConfigurationRunTaskProperties(string status = null, string source = null, Guid? jobId = null) { - return new SoftwareUpdateConfigurationRunTaskProperties(status, source, jobId); + return new SoftwareUpdateConfigurationRunTaskProperties(status, source, jobId, default); } - /// Initializes a new instance of SoftwareUpdateConfigurationMachineRun. + /// Initializes a new instance of . /// Name of the software update configuration machine run. /// Resource Id of the software update configuration machine run. /// name of the updated computer. @@ -866,19 +1011,19 @@ public static SoftwareUpdateConfigurationRunTaskProperties SoftwareUpdateConfigu /// A new instance for mocking. public static SoftwareUpdateConfigurationMachineRun SoftwareUpdateConfigurationMachineRun(string name = null, ResourceIdentifier id = null, ResourceIdentifier targetComputerId = null, string targetComputerType = null, string softwareUpdateName = null, string status = null, string osType = null, Guid? correlationId = null, Guid? sourceComputerId = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, TimeSpan? configuredDuration = null, Guid? jobId = null, DateTimeOffset? createdOn = null, string createdBy = null, DateTimeOffset? lastModifiedOn = null, string lastModifiedBy = null, AutomationResponseError error = null) { - return new SoftwareUpdateConfigurationMachineRun(name, id, targetComputerId, targetComputerType, softwareUpdateName != null ? new SoftwareUpdateConfigurationNavigation(softwareUpdateName) : null, status, osType, correlationId, sourceComputerId, startOn, endOn, configuredDuration, jobId != null ? new JobNavigation(jobId) : null, createdOn, createdBy, lastModifiedOn, lastModifiedBy, error); + return new SoftwareUpdateConfigurationMachineRun(name, id, targetComputerId, targetComputerType, softwareUpdateName != null ? new SoftwareUpdateConfigurationNavigation(softwareUpdateName, new Dictionary()) : null, status, osType, correlationId, sourceComputerId, startOn, endOn, configuredDuration, jobId != null ? new JobNavigation(jobId, new Dictionary()) : null, createdOn, createdBy, lastModifiedOn, lastModifiedBy, error, default); } - /// Initializes a new instance of RunbookDraftUndoEditResult. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static RunbookDraftUndoEditResult RunbookDraftUndoEditResult(AutomationHttpStatusCode? statusCode = null, string requestId = null) { - return new RunbookDraftUndoEditResult(statusCode, requestId); + return new RunbookDraftUndoEditResult(statusCode, requestId, default); } - /// Initializes a new instance of AutomationRunbookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -908,10 +1053,29 @@ public static AutomationRunbookData AutomationRunbookData(ResourceIdentifier id parameters ??= new Dictionary(); outputTypes ??= new List(); - return new AutomationRunbookData(id, name, resourceType, systemData, tags, location, etag, runbookType, publishContentLink, state, isLogVerboseEnabled, isLogProgressEnabled, logActivityTrace, jobCount, parameters, outputTypes?.ToList(), draft, provisioningState, lastModifiedBy, createdOn, lastModifiedOn, description); + return new AutomationRunbookData(id, name, resourceType, systemData, tags, location, etag, runbookType, publishContentLink, state, isLogVerboseEnabled, isLogProgressEnabled, logActivityTrace, jobCount, parameters, outputTypes?.ToList(), draft, provisioningState, lastModifiedBy, createdOn, lastModifiedOn, description, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets verbose log option. + /// Gets or sets progress log option. + /// Gets or sets the type of the runbook. + /// Gets or sets the draft runbook properties. + /// Gets or sets the published runbook content link. + /// Gets or sets the description of the runbook. + /// Gets or sets the activity-level tracing options of the runbook. + /// A new instance for mocking. + public static AutomationRunbookCreateOrUpdateContent AutomationRunbookCreateOrUpdateContent(string name = null, AzureLocation? location = null, IDictionary tags = null, bool? isLogVerboseEnabled = null, bool? isLogProgressEnabled = null, AutomationRunbookType runbookType = default, AutomationRunbookDraft draft = null, AutomationContentLink publishContentLink = null, string description = null, int? logActivityTrace = null) + { + tags ??= new Dictionary(); + + return new AutomationRunbookCreateOrUpdateContent(name, location, tags, isLogVerboseEnabled, isLogProgressEnabled, runbookType, draft, publishContentLink, description, logActivityTrace, default); } - /// Initializes a new instance of RunbookTestJob. + /// Initializes a new instance of . /// Gets or sets the creation time of the test job. /// Gets or sets the status of the test job. /// Gets or sets the status details of the test job. @@ -928,10 +1092,10 @@ public static RunbookTestJob RunbookTestJob(DateTimeOffset? createdOn = null, st { parameters ??= new Dictionary(); - return new RunbookTestJob(createdOn, status, statusDetails, runOn, startOn, endOn, exception, lastModifiedOn, lastStatusModifiedOn, parameters, logActivityTrace); + return new RunbookTestJob(createdOn, status, statusDetails, runOn, startOn, endOn, exception, lastModifiedOn, lastStatusModifiedOn, parameters, logActivityTrace, default); } - /// Initializes a new instance of AutomationWebhookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -952,10 +1116,26 @@ public static AutomationWebhookData AutomationWebhookData(ResourceIdentifier id { parameters ??= new Dictionary(); - return new AutomationWebhookData(id, name, resourceType, systemData, isEnabled, uri, expireOn, lastInvokedOn, parameters, runbookName != null ? new RunbookAssociationProperty(runbookName) : null, runOn, createdOn, lastModifiedOn, lastModifiedBy, description); + return new AutomationWebhookData(id, name, resourceType, systemData, isEnabled, uri, expireOn, lastInvokedOn, parameters, runbookName != null ? new RunbookAssociationProperty(runbookName, new Dictionary()) : null, runOn, createdOn, lastModifiedOn, lastModifiedBy, description, default); + } + + /// Initializes a new instance of . + /// Gets or sets the name of the webhook. + /// Gets or sets the value of the enabled flag of webhook. + /// Gets or sets the uri. + /// Gets or sets the expiry time. + /// Gets or sets the parameters of the job. + /// Gets or sets the runbook. + /// Gets or sets the name of the hybrid worker group the webhook job will run on. + /// A new instance for mocking. + public static AutomationWebhookCreateOrUpdateContent AutomationWebhookCreateOrUpdateContent(string name = null, bool? isEnabled = null, Uri uri = null, DateTimeOffset? expireOn = null, IDictionary parameters = null, string runbookName = null, string runOn = null) + { + parameters ??= new Dictionary(); + + return new AutomationWebhookCreateOrUpdateContent(name, isEnabled, uri, expireOn, parameters, runbookName != null ? new RunbookAssociationProperty(runbookName, new Dictionary()) : null, runOn, default); } - /// Initializes a new instance of HybridRunbookWorkerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -969,10 +1149,10 @@ public static AutomationWebhookData AutomationWebhookData(ResourceIdentifier id /// A new instance for mocking. public static HybridRunbookWorkerData HybridRunbookWorkerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string ip = null, DateTimeOffset? registeredOn = null, DateTimeOffset? lastSeenOn = null, ResourceIdentifier vmResourceId = null, HybridWorkerType? workerType = null, string workerName = null) { - return new HybridRunbookWorkerData(id, name, resourceType, systemData, ip, registeredOn, lastSeenOn, vmResourceId, workerType, workerName); + return new HybridRunbookWorkerData(id, name, resourceType, systemData, ip, registeredOn, lastSeenOn, vmResourceId, workerType, workerName, default); } - /// Initializes a new instance of DeletedAutomationAccount. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -985,10 +1165,10 @@ public static HybridRunbookWorkerData HybridRunbookWorkerData(ResourceIdentifier /// A new instance for mocking. public static DeletedAutomationAccount DeletedAutomationAccount(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ResourceIdentifier automationAccountResourceId = null, string automationAccountId = null, string locationPropertiesLocation = null, DateTimeOffset? deletedOn = null) { - return new DeletedAutomationAccount(id, name, resourceType, systemData, location, automationAccountResourceId, automationAccountId, locationPropertiesLocation, deletedOn); + return new DeletedAutomationAccount(id, name, resourceType, systemData, location, automationAccountResourceId, automationAccountId, locationPropertiesLocation, deletedOn, default); } - /// Initializes a new instance of HybridRunbookWorkerGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -998,7 +1178,7 @@ public static DeletedAutomationAccount DeletedAutomationAccount(ResourceIdentifi /// A new instance for mocking. public static HybridRunbookWorkerGroupData HybridRunbookWorkerGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, HybridWorkerGroup? groupType = null, string credentialName = null) { - return new HybridRunbookWorkerGroupData(id, name, resourceType, systemData, groupType, credentialName != null ? new RunAsCredentialAssociationProperty(credentialName) : null); + return new HybridRunbookWorkerGroupData(id, name, resourceType, systemData, groupType, credentialName != null ? new RunAsCredentialAssociationProperty(credentialName, new Dictionary()) : null, default); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs index a6e80f02ef1f..2173a7abfc96 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationAccountRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationAccountRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), _automationAccountClientDiagnostics, Pipeline, "AutomationAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), _automationAccountClientDiagnostics, Pipeline, "AutomationAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationAccountRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationAccountRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), _automationAccountClientDiagnostics, Pipeline, "AutomationAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), _automationAccountClientDiagnostics, Pipeline, "AutomationAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountData.cs index 2985edd8a943..931c76669b50 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountData.cs @@ -20,14 +20,17 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationAccountData : TrackedResourceData { - /// Initializes a new instance of AutomationAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AutomationAccountData(AzureLocation location) : base(location) { PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +50,8 @@ public AutomationAccountData(AzureLocation location) : base(location) /// Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is allowed from the public internet. /// Indicates whether requests using non-AAD authentication are blocked. /// URL of automation hybrid service which is used for hybrid worker on-boarding. - internal AutomationAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedServiceIdentity identity, AutomationSku sku, string lastModifiedBy, AutomationAccountState? state, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, AutomationEncryptionProperties encryption, IList privateEndpointConnections, bool? isPublicNetworkAccessAllowed, bool? isLocalAuthDisabled, Uri automationHybridServiceUri) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AutomationAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedServiceIdentity identity, AutomationSku sku, string lastModifiedBy, AutomationAccountState? state, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, AutomationEncryptionProperties encryption, IList privateEndpointConnections, bool? isPublicNetworkAccessAllowed, bool? isLocalAuthDisabled, Uri automationHybridServiceUri, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; Identity = identity; @@ -62,6 +66,12 @@ internal AutomationAccountData(ResourceIdentifier id, string name, ResourceType IsPublicNetworkAccessAllowed = isPublicNetworkAccessAllowed; IsLocalAuthDisabled = isLocalAuthDisabled; AutomationHybridServiceUri = automationHybridServiceUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationAccountData() + { } /// Gets or sets the etag of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs index ed29fdb5b5c9..819d9e276d15 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationAccountModuleModuleRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationAccountModuleModuleRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountModuleResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountModuleModuleClientDiagnostics, Pipeline, "AutomationAccountModuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountModuleResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountModuleModuleClientDiagnostics, Pipeline, "AutomationAccountModuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationAccountModuleModuleRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationAccountModuleModuleRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountModuleResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountModuleModuleClientDiagnostics, Pipeline, "AutomationAccountModuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountModuleResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountModuleModuleClientDiagnostics, Pipeline, "AutomationAccountModuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs index a27d66aae3f6..0fb89028e165 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationAccountPython2PackagePython2PackageRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationAccountPython2PackagePython2PackageRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountPython2PackageResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountPython2PackagePython2PackageClientDiagnostics, Pipeline, "AutomationAccountPython2PackageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountPython2PackageResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountPython2PackagePython2PackageClientDiagnostics, Pipeline, "AutomationAccountPython2PackageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationAccountPython2PackagePython2PackageRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationAccountPython2PackagePython2PackageRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountPython2PackageResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountPython2PackagePython2PackageClientDiagnostics, Pipeline, "AutomationAccountPython2PackageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountPython2PackageResource(Client, AutomationModuleData.DeserializeAutomationModuleData(e)), _automationAccountPython2PackagePython2PackageClientDiagnostics, Pipeline, "AutomationAccountPython2PackageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs index 19c1ea318cab..1a01acb60328 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationCertificateCertificateRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationCertificateCertificateRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationCertificateResource(Client, AutomationCertificateData.DeserializeAutomationCertificateData(e)), _automationCertificateCertificateClientDiagnostics, Pipeline, "AutomationCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationCertificateResource(Client, AutomationCertificateData.DeserializeAutomationCertificateData(e)), _automationCertificateCertificateClientDiagnostics, Pipeline, "AutomationCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationCertificateCertificateRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationCertificateCertificateRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationCertificateResource(Client, AutomationCertificateData.DeserializeAutomationCertificateData(e)), _automationCertificateCertificateClientDiagnostics, Pipeline, "AutomationCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationCertificateResource(Client, AutomationCertificateData.DeserializeAutomationCertificateData(e)), _automationCertificateCertificateClientDiagnostics, Pipeline, "AutomationCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateData.cs index 97d615f9c854..85d07c944158 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationCertificateData : ResourceData { - /// Initializes a new instance of AutomationCertificateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationCertificateData() { } - /// Initializes a new instance of AutomationCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +37,8 @@ public AutomationCertificateData() /// Gets the creation time. /// Gets the last modified time. /// Gets or sets the description. - internal AutomationCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string thumbprintString, DateTimeOffset? expireOn, bool? isExportable, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string thumbprintString, DateTimeOffset? expireOn, bool? isExportable, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ThumbprintString = thumbprintString; ExpireOn = expireOn; @@ -41,6 +46,7 @@ internal AutomationCertificateData(ResourceIdentifier id, string name, ResourceT CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the thumbprint of the certificate. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs index 8b4e84d248e5..e55ed9157922 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationConnectionConnectionRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationConnectionConnectionRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationConnectionResource(Client, AutomationConnectionData.DeserializeAutomationConnectionData(e)), _automationConnectionConnectionClientDiagnostics, Pipeline, "AutomationConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationConnectionResource(Client, AutomationConnectionData.DeserializeAutomationConnectionData(e)), _automationConnectionConnectionClientDiagnostics, Pipeline, "AutomationConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationConnectionConnectionRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationConnectionConnectionRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationConnectionResource(Client, AutomationConnectionData.DeserializeAutomationConnectionData(e)), _automationConnectionConnectionClientDiagnostics, Pipeline, "AutomationConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationConnectionResource(Client, AutomationConnectionData.DeserializeAutomationConnectionData(e)), _automationConnectionConnectionClientDiagnostics, Pipeline, "AutomationConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionData.cs index c57532c4a848..8b35273a7928 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationConnectionData : ResourceData { - /// Initializes a new instance of AutomationConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationConnectionData() { FieldDefinitionValues = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +38,15 @@ public AutomationConnectionData() /// Gets the creation time. /// Gets the last modified time. /// Gets or sets the description. - internal AutomationConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConnectionTypeAssociationProperty connectionType, IReadOnlyDictionary fieldDefinitionValues, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConnectionTypeAssociationProperty connectionType, IReadOnlyDictionary fieldDefinitionValues, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ConnectionType = connectionType; FieldDefinitionValues = fieldDefinitionValues; CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the connectionType of the connection. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs index c1d1d4a0f946..45354c73bfb4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationConnectionTypeConnectionTypeRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationConnectionTypeConnectionTypeRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationConnectionTypeResource(Client, AutomationConnectionTypeData.DeserializeAutomationConnectionTypeData(e)), _automationConnectionTypeConnectionTypeClientDiagnostics, Pipeline, "AutomationConnectionTypeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationConnectionTypeResource(Client, AutomationConnectionTypeData.DeserializeAutomationConnectionTypeData(e)), _automationConnectionTypeConnectionTypeClientDiagnostics, Pipeline, "AutomationConnectionTypeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationConnectionTypeConnectionTypeRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationConnectionTypeConnectionTypeRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationConnectionTypeResource(Client, AutomationConnectionTypeData.DeserializeAutomationConnectionTypeData(e)), _automationConnectionTypeConnectionTypeClientDiagnostics, Pipeline, "AutomationConnectionTypeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationConnectionTypeResource(Client, AutomationConnectionTypeData.DeserializeAutomationConnectionTypeData(e)), _automationConnectionTypeConnectionTypeClientDiagnostics, Pipeline, "AutomationConnectionTypeCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeData.cs index 6d1eb7e1e5a1..ed13b5161408 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationConnectionTypeData : ResourceData { - /// Initializes a new instance of AutomationConnectionTypeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationConnectionTypeData() { FieldDefinitions = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationConnectionTypeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +38,15 @@ internal AutomationConnectionTypeData() /// Gets the creation time. /// Gets or sets the last modified time. /// Gets or sets the description. - internal AutomationConnectionTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isGlobal, IReadOnlyDictionary fieldDefinitions, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isGlobal, IReadOnlyDictionary fieldDefinitions, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IsGlobal = isGlobal; FieldDefinitions = fieldDefinitions; CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a Boolean value to indicate if the connection type is global. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs index 7aa18c3e0d7a..2753406dbb33 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationCredentialCredentialRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationCredentialCredentialRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationCredentialResource(Client, AutomationCredentialData.DeserializeAutomationCredentialData(e)), _automationCredentialCredentialClientDiagnostics, Pipeline, "AutomationCredentialCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationCredentialResource(Client, AutomationCredentialData.DeserializeAutomationCredentialData(e)), _automationCredentialCredentialClientDiagnostics, Pipeline, "AutomationCredentialCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationCredentialCredentialRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationCredentialCredentialRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationCredentialResource(Client, AutomationCredentialData.DeserializeAutomationCredentialData(e)), _automationCredentialCredentialClientDiagnostics, Pipeline, "AutomationCredentialCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationCredentialResource(Client, AutomationCredentialData.DeserializeAutomationCredentialData(e)), _automationCredentialCredentialClientDiagnostics, Pipeline, "AutomationCredentialCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialData.cs index c2fbb49298e8..402ad84fb1b6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationCredentialData : ResourceData { - /// Initializes a new instance of AutomationCredentialData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationCredentialData() { } - /// Initializes a new instance of AutomationCredentialData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +35,14 @@ public AutomationCredentialData() /// Gets the creation time. /// Gets the last modified time. /// Gets or sets the description. - internal AutomationCredentialData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string userName, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationCredentialData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string userName, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { UserName = userName; CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the user name of the credential. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobData.cs index c2b60fb2b67f..34a46cf27c3a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationJobData : ResourceData { - /// Initializes a new instance of AutomationJobData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationJobData() { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +47,8 @@ public AutomationJobData() /// Gets or sets the last status modified time of the job. /// Gets or sets the parameters of the job. /// The current provisioning state of the job. - internal AutomationJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RunbookAssociationProperty runbook, string startedBy, string runOn, Guid? jobId, DateTimeOffset? createdOn, AutomationJobStatus? status, string statusDetails, DateTimeOffset? startOn, DateTimeOffset? endOn, string exception, DateTimeOffset? lastModifiedOn, DateTimeOffset? lastStatusModifiedOn, IDictionary parameters, JobProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RunbookAssociationProperty runbook, string startedBy, string runOn, Guid? jobId, DateTimeOffset? createdOn, AutomationJobStatus? status, string statusDetails, DateTimeOffset? startOn, DateTimeOffset? endOn, string exception, DateTimeOffset? lastModifiedOn, DateTimeOffset? lastStatusModifiedOn, IDictionary parameters, JobProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Runbook = runbook; StartedBy = startedBy; @@ -60,6 +64,7 @@ internal AutomationJobData(ResourceIdentifier id, string name, ResourceType reso LastStatusModifiedOn = lastStatusModifiedOn; Parameters = parameters; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the runbook. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs index f914219e2adb..6ce941c09c72 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleCollection.cs @@ -218,7 +218,7 @@ public virtual AsyncPageable GetAllAsync(string f { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationJobScheduleJobScheduleRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationJobScheduleJobScheduleRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationJobScheduleResource(Client, AutomationJobScheduleData.DeserializeAutomationJobScheduleData(e)), _automationJobScheduleJobScheduleClientDiagnostics, Pipeline, "AutomationJobScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationJobScheduleResource(Client, AutomationJobScheduleData.DeserializeAutomationJobScheduleData(e)), _automationJobScheduleJobScheduleClientDiagnostics, Pipeline, "AutomationJobScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual Pageable GetAll(string filter = nu { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationJobScheduleJobScheduleRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationJobScheduleJobScheduleRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationJobScheduleResource(Client, AutomationJobScheduleData.DeserializeAutomationJobScheduleData(e)), _automationJobScheduleJobScheduleClientDiagnostics, Pipeline, "AutomationJobScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationJobScheduleResource(Client, AutomationJobScheduleData.DeserializeAutomationJobScheduleData(e)), _automationJobScheduleJobScheduleClientDiagnostics, Pipeline, "AutomationJobScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleData.cs index 9c6bc210b25e..bcf712300824 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationJobScheduleData : ResourceData { - /// Initializes a new instance of AutomationJobScheduleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationJobScheduleData() { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationJobScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +38,15 @@ internal AutomationJobScheduleData() /// Gets or sets the runbook. /// Gets or sets the hybrid worker group that the scheduled job should run on. /// Gets or sets the parameters of the job schedule. - internal AutomationJobScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? jobScheduleId, ScheduleAssociationProperty schedule, RunbookAssociationProperty runbook, string runOn, IReadOnlyDictionary parameters) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationJobScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? jobScheduleId, ScheduleAssociationProperty schedule, RunbookAssociationProperty runbook, string runOn, IReadOnlyDictionary parameters, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { JobScheduleId = jobScheduleId; Schedule = schedule; Runbook = runbook; RunOn = runOn; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the id of job schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationModuleData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationModuleData.cs index fc99b6c8d2fb..24d22213ee1d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationModuleData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationModuleData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationModuleData : TrackedResourceData { - /// Initializes a new instance of AutomationModuleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AutomationModuleData(AzureLocation location) : base(location) { } - /// Initializes a new instance of AutomationModuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +48,8 @@ public AutomationModuleData(AzureLocation location) : base(location) /// Gets or sets the last modified time. /// Gets or sets the description. /// Gets or sets type of module, if its composite or not. - internal AutomationModuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, bool? isGlobal, string version, long? sizeInBytes, int? activityCount, ModuleProvisioningState? provisioningState, AutomationContentLink contentLink, AutomationModuleErrorInfo error, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, bool? isComposite) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AutomationModuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, bool? isGlobal, string version, long? sizeInBytes, int? activityCount, ModuleProvisioningState? provisioningState, AutomationContentLink contentLink, AutomationModuleErrorInfo error, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, bool? isComposite, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; IsGlobal = isGlobal; @@ -59,6 +63,12 @@ internal AutomationModuleData(ResourceIdentifier id, string name, ResourceType r LastModifiedOn = lastModifiedOn; Description = description; IsComposite = isComposite; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationModuleData() + { } /// Gets or sets the etag of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs index f5a1f09b6138..8f55d34b4b63 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomationPrivateEndpointConnectionResource(Client, AutomationPrivateEndpointConnectionData.DeserializeAutomationPrivateEndpointConnectionData(e)), _automationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AutomationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new AutomationPrivateEndpointConnectionResource(Client, AutomationPrivateEndpointConnectionData.DeserializeAutomationPrivateEndpointConnectionData(e)), _automationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AutomationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAll public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomationPrivateEndpointConnectionResource(Client, AutomationPrivateEndpointConnectionData.DeserializeAutomationPrivateEndpointConnectionData(e)), _automationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AutomationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new AutomationPrivateEndpointConnectionResource(Client, AutomationPrivateEndpointConnectionData.DeserializeAutomationPrivateEndpointConnectionData(e)), _automationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AutomationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionData.cs index 17ef461e83af..13c2b9f6d74d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of AutomationPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationPrivateEndpointConnectionData() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,11 +37,13 @@ public AutomationPrivateEndpointConnectionData() /// Private endpoint which the connection belongs to. /// Gets the groupIds. /// Connection State of the Private Endpoint Connection. - internal AutomationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WritableSubResource privateEndpoint, IList groupIds, AutomationPrivateLinkServiceConnectionStateProperty connectionState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WritableSubResource privateEndpoint, IList groupIds, AutomationPrivateLinkServiceConnectionStateProperty connectionState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; GroupIds = groupIds; ConnectionState = connectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Private endpoint which the connection belongs to. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs index e176603c2db2..1bbab2fda3cd 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationRunbookRunbookRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationRunbookRunbookRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationRunbookResource(Client, AutomationRunbookData.DeserializeAutomationRunbookData(e)), _automationRunbookRunbookClientDiagnostics, Pipeline, "AutomationRunbookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationRunbookResource(Client, AutomationRunbookData.DeserializeAutomationRunbookData(e)), _automationRunbookRunbookClientDiagnostics, Pipeline, "AutomationRunbookCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationRunbookRunbookRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationRunbookRunbookRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationRunbookResource(Client, AutomationRunbookData.DeserializeAutomationRunbookData(e)), _automationRunbookRunbookClientDiagnostics, Pipeline, "AutomationRunbookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationRunbookResource(Client, AutomationRunbookData.DeserializeAutomationRunbookData(e)), _automationRunbookRunbookClientDiagnostics, Pipeline, "AutomationRunbookCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookData.cs index f7d4dc241ef8..99eeab9bbdf8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationRunbookData : TrackedResourceData { - /// Initializes a new instance of AutomationRunbookData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AutomationRunbookData(AzureLocation location) : base(location) { @@ -28,7 +31,7 @@ public AutomationRunbookData(AzureLocation location) : base(location) OutputTypes = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationRunbookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -51,7 +54,8 @@ public AutomationRunbookData(AzureLocation location) : base(location) /// Gets or sets the creation time. /// Gets or sets the last modified time. /// Gets or sets the description. - internal AutomationRunbookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, AutomationRunbookType? runbookType, AutomationContentLink publishContentLink, RunbookState? state, bool? isLogVerboseEnabled, bool? isLogProgressEnabled, int? logActivityTrace, int? jobCount, IDictionary parameters, IList outputTypes, AutomationRunbookDraft draft, RunbookProvisioningState? provisioningState, string lastModifiedBy, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AutomationRunbookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, AutomationRunbookType? runbookType, AutomationContentLink publishContentLink, RunbookState? state, bool? isLogVerboseEnabled, bool? isLogProgressEnabled, int? logActivityTrace, int? jobCount, IDictionary parameters, IList outputTypes, AutomationRunbookDraft draft, RunbookProvisioningState? provisioningState, string lastModifiedBy, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; RunbookType = runbookType; @@ -69,6 +73,12 @@ internal AutomationRunbookData(ResourceIdentifier id, string name, ResourceType CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationRunbookData() + { } /// Gets or sets the etag of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs index 48f9559cbb6f..b18f854d6487 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationScheduleScheduleRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationScheduleScheduleRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationScheduleResource(Client, AutomationScheduleData.DeserializeAutomationScheduleData(e)), _automationScheduleScheduleClientDiagnostics, Pipeline, "AutomationScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationScheduleResource(Client, AutomationScheduleData.DeserializeAutomationScheduleData(e)), _automationScheduleScheduleClientDiagnostics, Pipeline, "AutomationScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationScheduleScheduleRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationScheduleScheduleRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationScheduleResource(Client, AutomationScheduleData.DeserializeAutomationScheduleData(e)), _automationScheduleScheduleClientDiagnostics, Pipeline, "AutomationScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationScheduleResource(Client, AutomationScheduleData.DeserializeAutomationScheduleData(e)), _automationScheduleScheduleClientDiagnostics, Pipeline, "AutomationScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleData.cs index f719e18a4de1..773d6df12466 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationScheduleData : ResourceData { - /// Initializes a new instance of AutomationScheduleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationScheduleData() { } - /// Initializes a new instance of AutomationScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +46,8 @@ public AutomationScheduleData() /// Gets or sets the creation time. /// Gets or sets the last modified time. /// Gets or sets the description. - internal AutomationScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? startOn, double? startInMinutes, DateTimeOffset? expireOn, double? expireInMinutes, bool? isEnabled, DateTimeOffset? nextRunOn, double? nextRunInMinutes, BinaryData interval, AutomationScheduleFrequency? frequency, string timeZone, AutomationAdvancedSchedule advancedSchedule, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? startOn, double? startInMinutes, DateTimeOffset? expireOn, double? expireInMinutes, bool? isEnabled, DateTimeOffset? nextRunOn, double? nextRunInMinutes, BinaryData interval, AutomationScheduleFrequency? frequency, string timeZone, AutomationAdvancedSchedule advancedSchedule, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { StartOn = startOn; StartInMinutes = startInMinutes; @@ -58,6 +63,7 @@ internal AutomationScheduleData(ResourceIdentifier id, string name, ResourceType CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the start time of the schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs index fc2709fd4e42..9e14adae2af0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationSourceControlSourceControlRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationSourceControlSourceControlRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationSourceControlResource(Client, AutomationSourceControlData.DeserializeAutomationSourceControlData(e)), _automationSourceControlSourceControlClientDiagnostics, Pipeline, "AutomationSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationSourceControlResource(Client, AutomationSourceControlData.DeserializeAutomationSourceControlData(e)), _automationSourceControlSourceControlClientDiagnostics, Pipeline, "AutomationSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationSourceControlSourceControlRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationSourceControlSourceControlRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationSourceControlResource(Client, AutomationSourceControlData.DeserializeAutomationSourceControlData(e)), _automationSourceControlSourceControlClientDiagnostics, Pipeline, "AutomationSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationSourceControlResource(Client, AutomationSourceControlData.DeserializeAutomationSourceControlData(e)), _automationSourceControlSourceControlClientDiagnostics, Pipeline, "AutomationSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlData.cs index 7d4f1639bcc3..e416ab528ef5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationSourceControlData : ResourceData { - /// Initializes a new instance of AutomationSourceControlData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationSourceControlData() { } - /// Initializes a new instance of AutomationSourceControlData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public AutomationSourceControlData() /// The description. /// The creation time. /// The last modified time. - internal AutomationSourceControlData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Uri repoUri, string branch, string folderPath, bool? isAutoSyncEnabled, bool? isAutoPublishRunbookEnabled, SourceControlSourceType? sourceType, string description, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationSourceControlData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Uri repoUri, string branch, string folderPath, bool? isAutoSyncEnabled, bool? isAutoPublishRunbookEnabled, SourceControlSourceType? sourceType, string description, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RepoUri = repoUri; Branch = branch; @@ -48,6 +53,7 @@ internal AutomationSourceControlData(ResourceIdentifier id, string name, Resourc Description = description; CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The repo url of the source control. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs index 584776b211a5..863573d27de0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationVariableVariableRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationVariableVariableRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationVariableResource(Client, AutomationVariableData.DeserializeAutomationVariableData(e)), _automationVariableVariableClientDiagnostics, Pipeline, "AutomationVariableCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationVariableResource(Client, AutomationVariableData.DeserializeAutomationVariableData(e)), _automationVariableVariableClientDiagnostics, Pipeline, "AutomationVariableCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationVariableVariableRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationVariableVariableRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationVariableResource(Client, AutomationVariableData.DeserializeAutomationVariableData(e)), _automationVariableVariableClientDiagnostics, Pipeline, "AutomationVariableCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationVariableResource(Client, AutomationVariableData.DeserializeAutomationVariableData(e)), _automationVariableVariableClientDiagnostics, Pipeline, "AutomationVariableCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableData.cs index 8b1d8a5a3cdc..43d796e00d25 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationVariableData : ResourceData { - /// Initializes a new instance of AutomationVariableData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationVariableData() { } - /// Initializes a new instance of AutomationVariableData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,13 +36,15 @@ public AutomationVariableData() /// Gets or sets the creation time. /// Gets or sets the last modified time. /// Gets or sets the description. - internal AutomationVariableData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, bool? isEncrypted, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationVariableData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, bool? isEncrypted, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Value = value; IsEncrypted = isEncrypted; CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the value of the variable. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs index c695defe3862..b77bc29288d6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationWatcherWatcherRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationWatcherWatcherRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationWatcherResource(Client, AutomationWatcherData.DeserializeAutomationWatcherData(e)), _automationWatcherWatcherClientDiagnostics, Pipeline, "AutomationWatcherCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationWatcherResource(Client, AutomationWatcherData.DeserializeAutomationWatcherData(e)), _automationWatcherWatcherClientDiagnostics, Pipeline, "AutomationWatcherCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationWatcherWatcherRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationWatcherWatcherRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationWatcherResource(Client, AutomationWatcherData.DeserializeAutomationWatcherData(e)), _automationWatcherWatcherClientDiagnostics, Pipeline, "AutomationWatcherCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationWatcherResource(Client, AutomationWatcherData.DeserializeAutomationWatcherData(e)), _automationWatcherWatcherClientDiagnostics, Pipeline, "AutomationWatcherCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherData.cs index 7689dc0085e0..487856ee92a0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationWatcherData : TrackedResourceData { - /// Initializes a new instance of AutomationWatcherData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AutomationWatcherData(AzureLocation location) : base(location) { ScriptParameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationWatcherData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +46,8 @@ public AutomationWatcherData(AzureLocation location) : base(location) /// Gets or sets the last modified time. /// Details of the user who last modified the watcher. /// Gets or sets the description. - internal AutomationWatcherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, long? executionFrequencyInSeconds, string scriptName, IDictionary scriptParameters, string scriptRunOn, string status, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string lastModifiedBy, string description) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AutomationWatcherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, long? executionFrequencyInSeconds, string scriptName, IDictionary scriptParameters, string scriptRunOn, string status, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string lastModifiedBy, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; ExecutionFrequencyInSeconds = executionFrequencyInSeconds; @@ -55,6 +59,12 @@ internal AutomationWatcherData(ResourceIdentifier id, string name, ResourceType LastModifiedOn = lastModifiedOn; LastModifiedBy = lastModifiedBy; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationWatcherData() + { } /// Gets or sets the etag of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs index a2bfbf07ccdd..c42a35e7f209 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationWebhookWebhookRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationWebhookWebhookRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationWebhookResource(Client, AutomationWebhookData.DeserializeAutomationWebhookData(e)), _automationWebhookWebhookClientDiagnostics, Pipeline, "AutomationWebhookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationWebhookResource(Client, AutomationWebhookData.DeserializeAutomationWebhookData(e)), _automationWebhookWebhookClientDiagnostics, Pipeline, "AutomationWebhookCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _automationWebhookWebhookRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _automationWebhookWebhookRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationWebhookResource(Client, AutomationWebhookData.DeserializeAutomationWebhookData(e)), _automationWebhookWebhookClientDiagnostics, Pipeline, "AutomationWebhookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationWebhookResource(Client, AutomationWebhookData.DeserializeAutomationWebhookData(e)), _automationWebhookWebhookClientDiagnostics, Pipeline, "AutomationWebhookCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookData.cs index d987b5c3b970..d92b2fa80342 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automation /// public partial class AutomationWebhookData : ResourceData { - /// Initializes a new instance of AutomationWebhookData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationWebhookData() { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationWebhookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public AutomationWebhookData() /// Gets or sets the last modified time. /// Details of the user who last modified the Webhook. /// Gets or sets the description. - internal AutomationWebhookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isEnabled, Uri uri, DateTimeOffset? expireOn, DateTimeOffset? lastInvokedOn, IDictionary parameters, RunbookAssociationProperty runbook, string runOn, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string lastModifiedBy, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationWebhookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isEnabled, Uri uri, DateTimeOffset? expireOn, DateTimeOffset? lastInvokedOn, IDictionary parameters, RunbookAssociationProperty runbook, string runOn, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string lastModifiedBy, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IsEnabled = isEnabled; Uri = uri; @@ -54,6 +58,7 @@ internal AutomationWebhookData(ResourceIdentifier id, string name, ResourceType LastModifiedOn = lastModifiedOn; LastModifiedBy = lastModifiedBy; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the value of the enabled flag of the webhook. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs index 569eddccac1f..d4325f46c2a3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string filte { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscCompilationJobRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscCompilationJobRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DscCompilationJobResource(Client, DscCompilationJobData.DeserializeDscCompilationJobData(e)), _dscCompilationJobClientDiagnostics, Pipeline, "DscCompilationJobCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DscCompilationJobResource(Client, DscCompilationJobData.DeserializeDscCompilationJobData(e)), _dscCompilationJobClientDiagnostics, Pipeline, "DscCompilationJobCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscCompilationJobRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscCompilationJobRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DscCompilationJobResource(Client, DscCompilationJobData.DeserializeDscCompilationJobData(e)), _dscCompilationJobClientDiagnostics, Pipeline, "DscCompilationJobCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DscCompilationJobResource(Client, DscCompilationJobData.DeserializeDscCompilationJobData(e)), _dscCompilationJobClientDiagnostics, Pipeline, "DscCompilationJobCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobData.cs index 84fa7ac9f270..423d5c6218b0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Automation /// public partial class DscCompilationJobData : ResourceData { - /// Initializes a new instance of DscCompilationJobData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscCompilationJobData() { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DscCompilationJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +47,8 @@ public DscCompilationJobData() /// Gets the last modified time of the job. /// Gets the last status modified time of the job. /// Gets or sets the parameters of the job. - internal DscCompilationJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DscConfigurationAssociationProperty configuration, string startedBy, Guid? jobId, DateTimeOffset? createdOn, JobProvisioningState? provisioningState, string runOn, AutomationJobStatus? status, string statusDetails, DateTimeOffset? startOn, DateTimeOffset? endOn, string exception, DateTimeOffset? lastModifiedOn, DateTimeOffset? lastStatusModifiedOn, IDictionary parameters) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DscCompilationJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DscConfigurationAssociationProperty configuration, string startedBy, Guid? jobId, DateTimeOffset? createdOn, JobProvisioningState? provisioningState, string runOn, AutomationJobStatus? status, string statusDetails, DateTimeOffset? startOn, DateTimeOffset? endOn, string exception, DateTimeOffset? lastModifiedOn, DateTimeOffset? lastStatusModifiedOn, IDictionary parameters, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Configuration = configuration; StartedBy = startedBy; @@ -60,6 +64,7 @@ internal DscCompilationJobData(ResourceIdentifier id, string name, ResourceType LastModifiedOn = lastModifiedOn; LastStatusModifiedOn = lastStatusModifiedOn; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs index 43a363ec5132..6e1b20969983 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscConfigurationRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscConfigurationRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DscConfigurationResource(Client, DscConfigurationData.DeserializeDscConfigurationData(e)), _dscConfigurationClientDiagnostics, Pipeline, "DscConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DscConfigurationResource(Client, DscConfigurationData.DeserializeDscConfigurationData(e)), _dscConfigurationClientDiagnostics, Pipeline, "DscConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +259,7 @@ public virtual Pageable GetAll(string filter = null, i { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscConfigurationRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscConfigurationRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DscConfigurationResource(Client, DscConfigurationData.DeserializeDscConfigurationData(e)), _dscConfigurationClientDiagnostics, Pipeline, "DscConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DscConfigurationResource(Client, DscConfigurationData.DeserializeDscConfigurationData(e)), _dscConfigurationClientDiagnostics, Pipeline, "DscConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationData.cs index 6b91d08f9ed4..8eee50d34c3c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationData.cs @@ -20,14 +20,17 @@ namespace Azure.ResourceManager.Automation /// public partial class DscConfigurationData : TrackedResourceData { - /// Initializes a new instance of DscConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DscConfigurationData(AzureLocation location) : base(location) { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DscConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +48,8 @@ public DscConfigurationData(AzureLocation location) : base(location) /// Gets or sets the last modified time. /// Gets the number of compiled node configurations. /// Gets or sets the description. - internal DscConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, DscConfigurationProvisioningState? provisioningState, int? jobCount, IDictionary parameters, AutomationContentSource source, DscConfigurationState? state, bool? isLogVerboseEnabled, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, int? nodeConfigurationCount, string description) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DscConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, DscConfigurationProvisioningState? provisioningState, int? jobCount, IDictionary parameters, AutomationContentSource source, DscConfigurationState? state, bool? isLogVerboseEnabled, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, int? nodeConfigurationCount, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; ProvisioningState = provisioningState; @@ -58,6 +62,12 @@ internal DscConfigurationData(ResourceIdentifier id, string name, ResourceType r LastModifiedOn = lastModifiedOn; NodeConfigurationCount = nodeConfigurationCount; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DscConfigurationData() + { } /// Gets or sets the etag of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs index 682829a8f3d7..7152ee3ede93 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeCollection.cs @@ -150,7 +150,7 @@ public virtual AsyncPageable GetAllAsync(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscNodeRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscNodeRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DscNodeResource(Client, DscNodeData.DeserializeDscNodeData(e)), _dscNodeClientDiagnostics, Pipeline, "DscNodeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DscNodeResource(Client, DscNodeData.DeserializeDscNodeData(e)), _dscNodeClientDiagnostics, Pipeline, "DscNodeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -176,7 +176,7 @@ public virtual Pageable GetAll(string filter = null, int? skip { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscNodeRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscNodeRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DscNodeResource(Client, DscNodeData.DeserializeDscNodeData(e)), _dscNodeClientDiagnostics, Pipeline, "DscNodeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DscNodeResource(Client, DscNodeData.DeserializeDscNodeData(e)), _dscNodeClientDiagnostics, Pipeline, "DscNodeCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs index d836318973da..57f29a247c62 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscNodeConfigurationRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscNodeConfigurationRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DscNodeConfigurationResource(Client, DscNodeConfigurationData.DeserializeDscNodeConfigurationData(e)), _dscNodeConfigurationClientDiagnostics, Pipeline, "DscNodeConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DscNodeConfigurationResource(Client, DscNodeConfigurationData.DeserializeDscNodeConfigurationData(e)), _dscNodeConfigurationClientDiagnostics, Pipeline, "DscNodeConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +259,7 @@ public virtual Pageable GetAll(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _dscNodeConfigurationRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dscNodeConfigurationRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, skip, top, inlinecount); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DscNodeConfigurationResource(Client, DscNodeConfigurationData.DeserializeDscNodeConfigurationData(e)), _dscNodeConfigurationClientDiagnostics, Pipeline, "DscNodeConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DscNodeConfigurationResource(Client, DscNodeConfigurationData.DeserializeDscNodeConfigurationData(e)), _dscNodeConfigurationClientDiagnostics, Pipeline, "DscNodeConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationData.cs index 7c6c3c0f6bc4..cd4406598711 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Automation /// public partial class DscNodeConfigurationData : ResourceData { - /// Initializes a new instance of DscNodeConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscNodeConfigurationData() { } - /// Initializes a new instance of DscNodeConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +38,8 @@ public DscNodeConfigurationData() /// Source of node configuration. /// Number of nodes with this node configuration assigned. /// If a new build version of NodeConfiguration is required. - internal DscNodeConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? lastModifiedOn, DateTimeOffset? createdOn, DscConfigurationAssociationProperty configuration, string source, long? nodeCount, bool? isIncrementNodeConfigurationBuildRequired) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DscNodeConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? lastModifiedOn, DateTimeOffset? createdOn, DscConfigurationAssociationProperty configuration, string source, long? nodeCount, bool? isIncrementNodeConfigurationBuildRequired, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { LastModifiedOn = lastModifiedOn; CreatedOn = createdOn; @@ -42,6 +47,7 @@ internal DscNodeConfigurationData(ResourceIdentifier id, string name, ResourceTy Source = source; NodeCount = nodeCount; IsIncrementNodeConfigurationBuildRequired = isIncrementNodeConfigurationBuildRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the last modified time. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeData.cs index 7663ad1ba670..d902e2c8b32a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.Automation /// public partial class DscNodeData : ResourceData { - /// Initializes a new instance of DscNodeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscNodeData() { ExtensionHandler = new ChangeTrackingList(); } - /// Initializes a new instance of DscNodeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public DscNodeData() /// Gets the total number of records matching filter criteria. /// Gets or sets the list of extensionHandler properties for a Node. /// Gets or sets the name of the dsc node configuration. - internal DscNodeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? lastSeenOn, DateTimeOffset? registrationOn, string ip, string accountId, string status, string nodeId, ETag? etag, int? totalCount, IList extensionHandler, string namePropertiesNodeConfigurationName) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DscNodeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? lastSeenOn, DateTimeOffset? registrationOn, string ip, string accountId, string status, string nodeId, ETag? etag, int? totalCount, IList extensionHandler, string namePropertiesNodeConfigurationName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { LastSeenOn = lastSeenOn; RegistrationOn = registrationOn; @@ -53,6 +57,7 @@ internal DscNodeData(ResourceIdentifier id, string name, ResourceType resourceTy TotalCount = totalCount; ExtensionHandler = extensionHandler; NamePropertiesNodeConfigurationName = namePropertiesNodeConfigurationName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the last seen time of the node. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 31a4ee41b117..24ba73a97406 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -65,7 +65,7 @@ public virtual AsyncPageable GetAutomationAccountsAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => AutomationAccountRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutomationAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomationAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomationAccounts", "value", "nextLink", cancellationToken); } /// @@ -87,7 +87,7 @@ public virtual Pageable GetAutomationAccounts(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => AutomationAccountRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutomationAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomationAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomationAccounts", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs index b2fe6b73aece..d4a13d150cd6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string fil { HttpMessage FirstPageRequest(int? pageSizeHint) => _hybridRunbookWorkerRestClient.CreateListByHybridRunbookWorkerGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hybridRunbookWorkerRestClient.CreateListByHybridRunbookWorkerGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridRunbookWorkerResource(Client, HybridRunbookWorkerData.DeserializeHybridRunbookWorkerData(e)), _hybridRunbookWorkerClientDiagnostics, Pipeline, "HybridRunbookWorkerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HybridRunbookWorkerResource(Client, HybridRunbookWorkerData.DeserializeHybridRunbookWorkerData(e)), _hybridRunbookWorkerClientDiagnostics, Pipeline, "HybridRunbookWorkerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = null { HttpMessage FirstPageRequest(int? pageSizeHint) => _hybridRunbookWorkerRestClient.CreateListByHybridRunbookWorkerGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hybridRunbookWorkerRestClient.CreateListByHybridRunbookWorkerGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridRunbookWorkerResource(Client, HybridRunbookWorkerData.DeserializeHybridRunbookWorkerData(e)), _hybridRunbookWorkerClientDiagnostics, Pipeline, "HybridRunbookWorkerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HybridRunbookWorkerResource(Client, HybridRunbookWorkerData.DeserializeHybridRunbookWorkerData(e)), _hybridRunbookWorkerClientDiagnostics, Pipeline, "HybridRunbookWorkerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerData.cs index 302712feac15..c1b44d0ed626 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Automation /// public partial class HybridRunbookWorkerData : ResourceData { - /// Initializes a new instance of HybridRunbookWorkerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HybridRunbookWorkerData() { } - /// Initializes a new instance of HybridRunbookWorkerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +38,8 @@ public HybridRunbookWorkerData() /// Azure Resource Manager Id for a virtual machine. /// Type of the HybridWorker. /// Name of the HybridWorker. - internal HybridRunbookWorkerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string ip, DateTimeOffset? registeredOn, DateTimeOffset? lastSeenOn, ResourceIdentifier vmResourceId, HybridWorkerType? workerType, string workerName) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string ip, DateTimeOffset? registeredOn, DateTimeOffset? lastSeenOn, ResourceIdentifier vmResourceId, HybridWorkerType? workerType, string workerName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IP = ip; RegisteredOn = registeredOn; @@ -42,6 +47,7 @@ internal HybridRunbookWorkerData(ResourceIdentifier id, string name, ResourceTyp VmResourceId = vmResourceId; WorkerType = workerType; WorkerName = workerName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the assigned machine IP address. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs index bdff0cb317e8..3b007736efde 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _hybridRunbookWorkerGroupRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hybridRunbookWorkerGroupRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridRunbookWorkerGroupResource(Client, HybridRunbookWorkerGroupData.DeserializeHybridRunbookWorkerGroupData(e)), _hybridRunbookWorkerGroupClientDiagnostics, Pipeline, "HybridRunbookWorkerGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HybridRunbookWorkerGroupResource(Client, HybridRunbookWorkerGroupData.DeserializeHybridRunbookWorkerGroupData(e)), _hybridRunbookWorkerGroupClientDiagnostics, Pipeline, "HybridRunbookWorkerGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _hybridRunbookWorkerGroupRestClient.CreateListByAutomationAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hybridRunbookWorkerGroupRestClient.CreateListByAutomationAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridRunbookWorkerGroupResource(Client, HybridRunbookWorkerGroupData.DeserializeHybridRunbookWorkerGroupData(e)), _hybridRunbookWorkerGroupClientDiagnostics, Pipeline, "HybridRunbookWorkerGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HybridRunbookWorkerGroupResource(Client, HybridRunbookWorkerGroupData.DeserializeHybridRunbookWorkerGroupData(e)), _hybridRunbookWorkerGroupClientDiagnostics, Pipeline, "HybridRunbookWorkerGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupData.cs index 74d35d86c41b..072bd3a6787d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.Automation /// public partial class HybridRunbookWorkerGroupData : ResourceData { - /// Initializes a new instance of HybridRunbookWorkerGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HybridRunbookWorkerGroupData() { } - /// Initializes a new instance of HybridRunbookWorkerGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Type of the HybridWorkerGroup. /// Sets the credential of a worker group. - internal HybridRunbookWorkerGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HybridWorkerGroup? groupType, RunAsCredentialAssociationProperty credential) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkerGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HybridWorkerGroup? groupType, RunAsCredentialAssociationProperty credential, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupType = groupType; Credential = credential; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of the HybridWorkerGroup. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.Serialization.cs index 4b7a9805f69d..40252070f6cc 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.Serialization.cs @@ -6,15 +6,69 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AgentRegistration + public partial class AgentRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentRegistration DeserializeAgentRegistration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DscMetaConfiguration)) + { + writer.WritePropertyName("dscMetaConfiguration"u8); + writer.WriteStringValue(DscMetaConfiguration); + } + if (Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint.AbsoluteUri); + } + if (Optional.IsDefined(Keys)) + { + writer.WritePropertyName("keys"u8); + if (Keys is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Keys).Serialize(writer, options); + } + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentRegistration DeserializeAgentRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static AgentRegistration DeserializeAgentRegistration(JsonElement eleme Optional endpoint = default; Optional keys = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dscMetaConfiguration"u8)) @@ -57,8 +112,61 @@ internal static AgentRegistration DeserializeAgentRegistration(JsonElement eleme id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentRegistration(dscMetaConfiguration.Value, endpoint.Value, keys.Value, id.Value); + return new AgentRegistration(dscMetaConfiguration.Value, endpoint.Value, keys.Value, id.Value, serializedAdditionalRawData); + } + + AgentRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentRegistration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.cs index ae151f4469e3..c6b85acf0fd5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the agent registration information type. public partial class AgentRegistration { - /// Initializes a new instance of AgentRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgentRegistration() { } - /// Initializes a new instance of AgentRegistration. + /// Initializes a new instance of . /// Gets or sets the dsc meta configuration. /// Gets or sets the dsc server endpoint. /// Gets or sets the agent registration keys. /// Gets or sets the id. - internal AgentRegistration(string dscMetaConfiguration, Uri endpoint, AgentRegistrationKeys keys, ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal AgentRegistration(string dscMetaConfiguration, Uri endpoint, AgentRegistrationKeys keys, ResourceIdentifier id, Dictionary serializedAdditionalRawData) { DscMetaConfiguration = dscMetaConfiguration; Endpoint = endpoint; Keys = keys; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the dsc meta configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.Serialization.cs index a4ffd5ce0f65..1595e0e7556f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AgentRegistrationKeys + public partial class AgentRegistrationKeys : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentRegistrationKeys DeserializeAgentRegistrationKeys(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Primary)) + { + writer.WritePropertyName("primary"u8); + writer.WriteStringValue(Primary); + } + if (Optional.IsDefined(Secondary)) + { + writer.WritePropertyName("secondary"u8); + writer.WriteStringValue(Secondary); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentRegistrationKeys DeserializeAgentRegistrationKeys(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional primary = default; Optional secondary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primary"u8)) @@ -32,8 +71,61 @@ internal static AgentRegistrationKeys DeserializeAgentRegistrationKeys(JsonEleme secondary = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentRegistrationKeys(primary.Value, secondary.Value); + return new AgentRegistrationKeys(primary.Value, secondary.Value, serializedAdditionalRawData); + } + + AgentRegistrationKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentRegistrationKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentRegistrationKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentRegistrationKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentRegistrationKeys model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentRegistrationKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentRegistrationKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.cs index fc8c377eb87e..956953805510 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationKeys.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the agent registration keys. public partial class AgentRegistrationKeys { - /// Initializes a new instance of AgentRegistrationKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgentRegistrationKeys() { } - /// Initializes a new instance of AgentRegistrationKeys. + /// Initializes a new instance of . /// Gets or sets the primary key. /// Gets or sets the secondary key. - internal AgentRegistrationKeys(string primary, string secondary) + /// Keeps track of any properties unknown to the library. + internal AgentRegistrationKeys(string primary, string secondary, Dictionary serializedAdditionalRawData) { Primary = primary; Secondary = secondary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the primary key. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.Serialization.cs index 86553935a71b..875cbbf03a8c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AgentRegistrationRegenerateKeyContent : IUtf8JsonSerializable + public partial class AgentRegistrationRegenerateKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyName.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AgentRegistrationRegenerateKeyContent DeserializeAgentRegistrationRegenerateKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgentRegistrationKeyName keyName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyName"u8)) + { + keyName = new AgentRegistrationKeyName(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgentRegistrationRegenerateKeyContent(keyName, serializedAdditionalRawData); + } + + AgentRegistrationRegenerateKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentRegistrationRegenerateKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentRegistrationRegenerateKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentRegistrationRegenerateKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentRegistrationRegenerateKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentRegistrationRegenerateKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentRegistrationRegenerateKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.cs index 6dd9d7bfd008..b4d91b20dd9f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AgentRegistrationRegenerateKeyContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the regenerate keys operation. public partial class AgentRegistrationRegenerateKeyContent { - /// Initializes a new instance of AgentRegistrationRegenerateKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the agent registration key name - primary or secondary. public AgentRegistrationRegenerateKeyContent(AgentRegistrationKeyName keyName) { KeyName = keyName; } + /// Initializes a new instance of . + /// Gets or sets the agent registration key name - primary or secondary. + /// Keeps track of any properties unknown to the library. + internal AgentRegistrationRegenerateKeyContent(AgentRegistrationKeyName keyName, Dictionary serializedAdditionalRawData) + { + KeyName = keyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgentRegistrationRegenerateKeyContent() + { + } + /// Gets or sets the agent registration key name - primary or secondary. public AgentRegistrationKeyName KeyName { get; } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.Serialization.cs index 5bc6de8a65a5..4391af229e17 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationAccountCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -46,12 +55,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(IsPublicNetworkAccessAllowed)) { @@ -64,7 +87,180 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsLocalAuthDisabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationAccountCreateOrUpdateContent DeserializeAutomationAccountCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional identity = default; + Optional> tags = default; + Optional sku = default; + Optional encryption = default; + Optional publicNetworkAccess = default; + Optional disableLocalAuth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("sku"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AutomationSku.DeserializeAutomationSku(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = AutomationEncryptionProperties.DeserializeAutomationEncryptionProperties(property0.Value); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("disableLocalAuth"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountCreateOrUpdateContent(name.Value, Optional.ToNullable(location), identity, Optional.ToDictionary(tags), sku.Value, encryption.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), serializedAdditionalRawData); + } + + AutomationAccountCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.cs index b5e588b6713d..6ea4dcc2237b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,38 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update automation account operation. public partial class AutomationAccountCreateOrUpdateContent { - /// Initializes a new instance of AutomationAccountCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationAccountCreateOrUpdateContent() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Sets the identity property for automation account. + /// Gets or sets the tags attached to the resource. + /// Gets or sets account SKU. + /// Set the encryption properties for the automation account. + /// Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is allowed from the public internet. + /// Indicates whether requests using non-AAD authentication are blocked. + /// Keeps track of any properties unknown to the library. + internal AutomationAccountCreateOrUpdateContent(string name, AzureLocation? location, ManagedServiceIdentity identity, IDictionary tags, AutomationSku sku, AutomationEncryptionProperties encryption, bool? isPublicNetworkAccessAllowed, bool? isLocalAuthDisabled, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Identity = identity; + Tags = tags; + Sku = sku; + Encryption = encryption; + IsPublicNetworkAccessAllowed = isPublicNetworkAccessAllowed; + IsLocalAuthDisabled = isLocalAuthDisabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountData.Serialization.cs index 73d2521d1825..a0ef166fe21a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationAccountData : IUtf8JsonSerializable + public partial class AutomationAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -48,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(LastModifiedBy)) { @@ -63,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(PrivateEndpointConnections)) { @@ -71,7 +90,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PrivateEndpointConnections) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -91,11 +117,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AutomationHybridServiceUri.AbsoluteUri); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationAccountData DeserializeAutomationAccountData(JsonElement element) + internal static AutomationAccountData DeserializeAutomationAccountData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -119,6 +159,7 @@ internal static AutomationAccountData DeserializeAutomationAccountData(JsonEleme Optional publicNetworkAccess = default; Optional disableLocalAuth = default; Optional automationHybridServiceUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -290,8 +331,61 @@ internal static AutomationAccountData DeserializeAutomationAccountData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), identity, sku.Value, lastModifiedBy.Value, Optional.ToNullable(state), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), automationHybridServiceUrl.Value, serializedAdditionalRawData); + } + + AutomationAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountData(Response response) + { + if (response is null) + { + return null; } - return new AutomationAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), identity, sku.Value, lastModifiedBy.Value, Optional.ToNullable(state), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), automationHybridServiceUrl.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.Serialization.cs index a8e185a74f1f..a560b6fdbb0f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationAccountListResult + internal partial class AutomationAccountListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationAccountListResult DeserializeAutomationAccountListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationAccountListResult DeserializeAutomationAccountListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationAccountListResult DeserializeAutomationAccountListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationAccountListResult(Optional.ToList(value), nextLink.Value); + return new AutomationAccountListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationAccountListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.cs index 4239da88e33d..4ad224219b9e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list account operation. internal partial class AutomationAccountListResult { - /// Initializes a new instance of AutomationAccountListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationAccountListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationAccountListResult. + /// Initializes a new instance of . /// Gets or sets list of accounts. /// Gets or sets the next link. - internal AutomationAccountListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationAccountListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets list of accounts. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.Serialization.cs index fab5cecb976f..d1c6a24a533f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountModuleCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationAccountModuleCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -39,9 +47,145 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("contentLink"u8); - writer.WriteObjectValue(ContentLink); + if (ContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContentLink).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationAccountModuleCreateOrUpdateContent DeserializeAutomationAccountModuleCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional> tags = default; + AutomationContentLink contentLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("contentLink"u8)) + { + contentLink = AutomationContentLink.DeserializeAutomationContentLink(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountModuleCreateOrUpdateContent(name.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), contentLink, serializedAdditionalRawData); + } + + AutomationAccountModuleCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountModuleCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountModuleCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountModuleCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountModuleCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountModuleCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountModuleCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.cs index 05eb6fcafeec..09e98b50f9db 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModuleCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update module operation. public partial class AutomationAccountModuleCreateOrUpdateContent { - /// Initializes a new instance of AutomationAccountModuleCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the module content link. /// is null. public AutomationAccountModuleCreateOrUpdateContent(AutomationContentLink contentLink) @@ -25,6 +28,26 @@ public AutomationAccountModuleCreateOrUpdateContent(AutomationContentLink conten ContentLink = contentLink; } + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the module content link. + /// Keeps track of any properties unknown to the library. + internal AutomationAccountModuleCreateOrUpdateContent(string name, AzureLocation? location, IDictionary tags, AutomationContentLink contentLink, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Tags = tags; + ContentLink = contentLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationAccountModuleCreateOrUpdateContent() + { + } + /// Gets or sets name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.Serialization.cs index 38d3886021ed..54976d518078 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountModulePatch : IUtf8JsonSerializable + public partial class AutomationAccountModulePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -41,10 +49,150 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContentLink)) { writer.WritePropertyName("contentLink"u8); - writer.WriteObjectValue(ContentLink); + if (ContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContentLink).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationAccountModulePatch DeserializeAutomationAccountModulePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional> tags = default; + Optional contentLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("contentLink"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contentLink = AutomationContentLink.DeserializeAutomationContentLink(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountModulePatch(name.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), contentLink.Value, serializedAdditionalRawData); + } + + AutomationAccountModulePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountModulePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountModulePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountModulePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountModulePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountModulePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountModulePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.cs index 16d29ecc6269..a1147d4e5209 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountModulePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the update module operation. public partial class AutomationAccountModulePatch { - /// Initializes a new instance of AutomationAccountModulePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationAccountModulePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the module content link. + /// Keeps track of any properties unknown to the library. + internal AutomationAccountModulePatch(string name, AzureLocation? location, IDictionary tags, AutomationContentLink contentLink, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Tags = tags; + ContentLink = contentLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.Serialization.cs index e0f8df666ab0..b5a3c9a88d44 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountPatch : IUtf8JsonSerializable + public partial class AutomationAccountPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -46,12 +55,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(IsPublicNetworkAccessAllowed)) { @@ -64,7 +87,180 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsLocalAuthDisabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationAccountPatch DeserializeAutomationAccountPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional identity = default; + Optional> tags = default; + Optional sku = default; + Optional encryption = default; + Optional publicNetworkAccess = default; + Optional disableLocalAuth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("sku"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AutomationSku.DeserializeAutomationSku(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = AutomationEncryptionProperties.DeserializeAutomationEncryptionProperties(property0.Value); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("disableLocalAuth"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountPatch(name.Value, Optional.ToNullable(location), identity, Optional.ToDictionary(tags), sku.Value, encryption.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), serializedAdditionalRawData); + } + + AutomationAccountPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.cs index 3d5c55e1dd81..19ab856f7dca 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,38 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the update automation account operation. public partial class AutomationAccountPatch { - /// Initializes a new instance of AutomationAccountPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationAccountPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Gets or sets the location of the resource. + /// Sets the identity property for automation account. + /// Gets or sets the tags attached to the resource. + /// Gets or sets account SKU. + /// Set the encryption properties for the automation account. + /// Indicates whether traffic on the non-ARM endpoint (Webhook/Agent) is allowed from the public internet. + /// Indicates whether requests using non-AAD authentication are blocked. + /// Keeps track of any properties unknown to the library. + internal AutomationAccountPatch(string name, AzureLocation? location, ManagedServiceIdentity identity, IDictionary tags, AutomationSku sku, AutomationEncryptionProperties encryption, bool? isPublicNetworkAccessAllowed, bool? isLocalAuthDisabled, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Identity = identity; + Tags = tags; + Sku = sku; + Encryption = encryption; + IsPublicNetworkAccessAllowed = isPublicNetworkAccessAllowed; + IsLocalAuthDisabled = isLocalAuthDisabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.Serialization.cs index d31378ddbb58..3f2b3b8dbf16 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountPython2PackageCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationAccountPython2PackageCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -29,9 +37,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("contentLink"u8); - writer.WriteObjectValue(ContentLink); + if (ContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContentLink).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationAccountPython2PackageCreateOrUpdateContent DeserializeAutomationAccountPython2PackageCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + AutomationContentLink contentLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("contentLink"u8)) + { + contentLink = AutomationContentLink.DeserializeAutomationContentLink(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountPython2PackageCreateOrUpdateContent(Optional.ToDictionary(tags), contentLink, serializedAdditionalRawData); + } + + AutomationAccountPython2PackageCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountPython2PackageCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountPython2PackageCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountPython2PackageCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountPython2PackageCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountPython2PackageCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountPython2PackageCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.cs index d5b4e28384f1..7e24cf05ab5a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackageCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update module operation. public partial class AutomationAccountPython2PackageCreateOrUpdateContent { - /// Initializes a new instance of AutomationAccountPython2PackageCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the module content link. /// is null. public AutomationAccountPython2PackageCreateOrUpdateContent(AutomationContentLink contentLink) @@ -25,6 +28,22 @@ public AutomationAccountPython2PackageCreateOrUpdateContent(AutomationContentLin ContentLink = contentLink; } + /// Initializes a new instance of . + /// Gets or sets the tags attached to the resource. + /// Gets or sets the module content link. + /// Keeps track of any properties unknown to the library. + internal AutomationAccountPython2PackageCreateOrUpdateContent(IDictionary tags, AutomationContentLink contentLink, Dictionary serializedAdditionalRawData) + { + Tags = tags; + ContentLink = contentLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationAccountPython2PackageCreateOrUpdateContent() + { + } + /// Gets or sets the tags attached to the resource. public IDictionary Tags { get; } /// Gets or sets the module content link. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.Serialization.cs index 8f2073e414f8..5a6468434837 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountPython2PackagePatch : IUtf8JsonSerializable + public partial class AutomationAccountPython2PackagePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationAccountPython2PackagePatch DeserializeAutomationAccountPython2PackagePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAccountPython2PackagePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + AutomationAccountPython2PackagePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountPython2PackagePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountPython2PackagePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountPython2PackagePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountPython2PackagePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountPython2PackagePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountPython2PackagePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.cs index 8e7e70b8feb3..d04537f147ed 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountPython2PackagePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the update module operation. public partial class AutomationAccountPython2PackagePatch { - /// Initializes a new instance of AutomationAccountPython2PackagePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationAccountPython2PackagePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the tags attached to the resource. + /// Keeps track of any properties unknown to the library. + internal AutomationAccountPython2PackagePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the tags attached to the resource. public IDictionary Tags { get; } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.Serialization.cs index 81dc52890db6..aee05a84ee69 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAccountStatistics + public partial class AutomationAccountStatistics : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationAccountStatistics DeserializeAutomationAccountStatistics(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationAccountStatistics DeserializeAutomationAccountStatistics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static AutomationAccountStatistics DeserializeAutomationAccountStatisti Optional startTime = default; Optional endTime = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("counterProperty"u8)) @@ -64,8 +92,61 @@ internal static AutomationAccountStatistics DeserializeAutomationAccountStatisti id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationAccountStatistics(counterProperty.Value, Optional.ToNullable(counterValue), Optional.ToNullable(startTime), Optional.ToNullable(endTime), id.Value); + return new AutomationAccountStatistics(counterProperty.Value, Optional.ToNullable(counterValue), Optional.ToNullable(startTime), Optional.ToNullable(endTime), id.Value, serializedAdditionalRawData); + } + + AutomationAccountStatistics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountStatistics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountStatistics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountStatistics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountStatistics model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountStatistics(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountStatistics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.cs index 4809c6eec51a..91c0611229df 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatistics.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// Definition of the statistic. public partial class AutomationAccountStatistics { - /// Initializes a new instance of AutomationAccountStatistics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationAccountStatistics() { } - /// Initializes a new instance of AutomationAccountStatistics. + /// Initializes a new instance of . /// Gets the property value of the statistic. /// Gets the value of the statistic. /// Gets the startTime of the statistic. /// Gets the endTime of the statistic. /// Gets the id. - internal AutomationAccountStatistics(string counterProperty, long? counterValue, DateTimeOffset? startOn, DateTimeOffset? endOn, string id) + /// Keeps track of any properties unknown to the library. + internal AutomationAccountStatistics(string counterProperty, long? counterValue, DateTimeOffset? startOn, DateTimeOffset? endOn, string id, Dictionary serializedAdditionalRawData) { CounterProperty = counterProperty; CounterValue = counterValue; StartOn = startOn; EndOn = endOn; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the property value of the statistic. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.Serialization.cs index 9c03a40d9d8f..b3246561c96c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationAccountStatisticsListResult + internal partial class AutomationAccountStatisticsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationAccountStatisticsListResult DeserializeAutomationAccountStatisticsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationAccountStatisticsListResult DeserializeAutomationAccountStatisticsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static AutomationAccountStatisticsListResult DeserializeAutomationAccou value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationAccountStatisticsListResult(Optional.ToList(value)); + return new AutomationAccountStatisticsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AutomationAccountStatisticsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAccountStatisticsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAccountStatisticsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAccountStatisticsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAccountStatisticsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAccountStatisticsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAccountStatisticsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.cs index d2f7daa8524f..35d5cdea2347 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAccountStatisticsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list statistics operation. internal partial class AutomationAccountStatisticsListResult { - /// Initializes a new instance of AutomationAccountStatisticsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationAccountStatisticsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationAccountStatisticsListResult. + /// Initializes a new instance of . /// Gets or sets a list of statistics. - internal AutomationAccountStatisticsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AutomationAccountStatisticsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of statistics. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.Serialization.cs index 3bba7c3c5b8f..02406a1e5981 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.Serialization.cs @@ -8,14 +8,102 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationActivity + public partial class AutomationActivity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationActivity DeserializeAutomationActivity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Definition)) + { + writer.WritePropertyName("definition"u8); + writer.WriteStringValue(Definition); + } + if (Optional.IsCollectionDefined(ParameterSets)) + { + writer.WritePropertyName("parameterSets"u8); + writer.WriteStartArray(); + foreach (var item in ParameterSets) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OutputTypes)) + { + writer.WritePropertyName("outputTypes"u8); + writer.WriteStartArray(); + foreach (var item in OutputTypes) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationTime"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(LastModifiedOn)) + { + writer.WritePropertyName("lastModifiedTime"u8); + writer.WriteStringValue(LastModifiedOn.Value, "O"); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationActivity DeserializeAutomationActivity(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +116,7 @@ internal static AutomationActivity DeserializeAutomationActivity(JsonElement ele Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +201,61 @@ internal static AutomationActivity DeserializeAutomationActivity(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationActivity(id.Value, name.Value, definition.Value, Optional.ToList(parameterSets), Optional.ToList(outputTypes), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationActivity model) + { + if (model is null) + { + return null; } - return new AutomationActivity(id.Value, name.Value, definition.Value, Optional.ToList(parameterSets), Optional.ToList(outputTypes), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.cs index d5afade94e3a..00ae6bf99305 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivity.cs @@ -14,14 +14,17 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the activity. public partial class AutomationActivity { - /// Initializes a new instance of AutomationActivity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationActivity() { ParameterSets = new ChangeTrackingList(); OutputTypes = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationActivity. + /// Initializes a new instance of . /// Gets or sets the id of the resource. /// Gets the name of the activity. /// Gets or sets the user name of the activity. @@ -30,7 +33,8 @@ internal AutomationActivity() /// Gets or sets the creation time. /// Gets or sets the last modified time. /// Gets or sets the description. - internal AutomationActivity(ResourceIdentifier id, string name, string definition, IReadOnlyList parameterSets, IReadOnlyList outputTypes, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) + /// Keeps track of any properties unknown to the library. + internal AutomationActivity(ResourceIdentifier id, string name, string definition, IReadOnlyList parameterSets, IReadOnlyList outputTypes, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -40,6 +44,7 @@ internal AutomationActivity(ResourceIdentifier id, string name, string definitio CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the id of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.Serialization.cs index 31caf1f51fd5..7aa142867098 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationActivityListResult + internal partial class AutomationActivityListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationActivityListResult DeserializeAutomationActivityListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationActivityListResult DeserializeAutomationActivityListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static AutomationActivityListResult DeserializeAutomationActivityListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationActivityListResult(Optional.ToList(value), nextLink.Value); + return new AutomationActivityListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationActivityListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationActivityListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationActivityListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationActivityListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationActivityListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationActivityListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationActivityListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.cs index 81debaf5f7fb..a7cefd175083 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list activity operation. internal partial class AutomationActivityListResult { - /// Initializes a new instance of AutomationActivityListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationActivityListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationActivityListResult. + /// Initializes a new instance of . /// Gets or sets a list of activities. /// Gets or sets the next link. - internal AutomationActivityListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationActivityListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of activities. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.Serialization.cs index 03f09a611bd5..fe4ae51aef46 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationActivityOutputType + public partial class AutomationActivityOutputType : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationActivityOutputType DeserializeAutomationActivityOutputType(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ActivityOutputType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ActivityOutputType); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationActivityOutputType DeserializeAutomationActivityOutputType(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static AutomationActivityOutputType DeserializeAutomationActivityOutput type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationActivityOutputType(name.Value, type.Value); + return new AutomationActivityOutputType(name.Value, type.Value, serializedAdditionalRawData); + } + + AutomationActivityOutputType IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationActivityOutputType(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationActivityOutputType IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationActivityOutputType(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationActivityOutputType model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationActivityOutputType(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationActivityOutputType(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.cs index 53ddb4eae2b5..7912178463f0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityOutputType.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the activity output type. public partial class AutomationActivityOutputType { - /// Initializes a new instance of AutomationActivityOutputType. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationActivityOutputType() { } - /// Initializes a new instance of AutomationActivityOutputType. + /// Initializes a new instance of . /// Gets or sets the name of the activity output type. /// Gets or sets the type of the activity output type. - internal AutomationActivityOutputType(string name, string activityOutputType) + /// Keeps track of any properties unknown to the library. + internal AutomationActivityOutputType(string name, string activityOutputType, Dictionary serializedAdditionalRawData) { Name = name; ActivityOutputType = activityOutputType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the activity output type. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.Serialization.cs index feab04154d42..c27861d8efa4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.Serialization.cs @@ -5,16 +5,105 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationActivityParameterDefinition + public partial class AutomationActivityParameterDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationActivityParameterDefinition DeserializeAutomationActivityParameterDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ActivityParameterType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ActivityParameterType); + } + if (Optional.IsDefined(IsMandatory)) + { + writer.WritePropertyName("isMandatory"u8); + writer.WriteBooleanValue(IsMandatory.Value); + } + if (Optional.IsDefined(IsDynamic)) + { + writer.WritePropertyName("isDynamic"u8); + writer.WriteBooleanValue(IsDynamic.Value); + } + if (Optional.IsDefined(Position)) + { + writer.WritePropertyName("position"u8); + writer.WriteNumberValue(Position.Value); + } + if (Optional.IsDefined(CanTakeValueFromPipeline)) + { + writer.WritePropertyName("valueFromPipeline"u8); + writer.WriteBooleanValue(CanTakeValueFromPipeline.Value); + } + if (Optional.IsDefined(CanTakeValueFromPipelineByPropertyName)) + { + writer.WritePropertyName("valueFromPipelineByPropertyName"u8); + writer.WriteBooleanValue(CanTakeValueFromPipelineByPropertyName.Value); + } + if (Optional.IsDefined(CanTakeValueValueFromRemainingArguments)) + { + writer.WritePropertyName("valueFromRemainingArguments"u8); + writer.WriteBooleanValue(CanTakeValueValueFromRemainingArguments.Value); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(ValidationSet)) + { + writer.WritePropertyName("validationSet"u8); + writer.WriteStartArray(); + foreach (var item in ValidationSet) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationActivityParameterDefinition DeserializeAutomationActivityParameterDefinition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +118,7 @@ internal static AutomationActivityParameterDefinition DeserializeAutomationActiv Optional valueFromRemainingArguments = default; Optional description = default; Optional> validationSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -114,8 +204,61 @@ internal static AutomationActivityParameterDefinition DeserializeAutomationActiv validationSet = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationActivityParameterDefinition(name.Value, type.Value, Optional.ToNullable(isMandatory), Optional.ToNullable(isDynamic), Optional.ToNullable(position), Optional.ToNullable(valueFromPipeline), Optional.ToNullable(valueFromPipelineByPropertyName), Optional.ToNullable(valueFromRemainingArguments), description.Value, Optional.ToList(validationSet), serializedAdditionalRawData); + } + + AutomationActivityParameterDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationActivityParameterDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationActivityParameterDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationActivityParameterDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationActivityParameterDefinition model) + { + if (model is null) + { + return null; } - return new AutomationActivityParameterDefinition(name.Value, type.Value, Optional.ToNullable(isMandatory), Optional.ToNullable(isDynamic), Optional.ToNullable(position), Optional.ToNullable(valueFromPipeline), Optional.ToNullable(valueFromPipelineByPropertyName), Optional.ToNullable(valueFromRemainingArguments), description.Value, Optional.ToList(validationSet)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationActivityParameterDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationActivityParameterDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.cs index a66ffa0f0bcc..c70156886a37 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the activity parameter. public partial class AutomationActivityParameterDefinition { - /// Initializes a new instance of AutomationActivityParameterDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationActivityParameterDefinition() { ValidationSet = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationActivityParameterDefinition. + /// Initializes a new instance of . /// Gets or sets the name of the activity parameter. /// Gets or sets the type of the activity parameter. /// Gets or sets a Boolean value that indicates true if the parameter is required. If the value is false, the parameter is optional. @@ -30,7 +34,8 @@ internal AutomationActivityParameterDefinition() /// Gets or sets a Boolean value that indicates true if the cmdlet parameter accepts all the remaining command-line arguments that are associated with this parameter in the form of an array. false if the cmdlet parameter does not accept all the remaining argument values. /// Gets or sets the description of the activity parameter. /// Gets or sets the validation set of activity parameter. - internal AutomationActivityParameterDefinition(string name, string activityParameterType, bool? isMandatory, bool? isDynamic, long? position, bool? canTakeValueFromPipeline, bool? canTakeValueFromPipelineByPropertyName, bool? canTakeValueValueFromRemainingArguments, string description, IReadOnlyList validationSet) + /// Keeps track of any properties unknown to the library. + internal AutomationActivityParameterDefinition(string name, string activityParameterType, bool? isMandatory, bool? isDynamic, long? position, bool? canTakeValueFromPipeline, bool? canTakeValueFromPipelineByPropertyName, bool? canTakeValueValueFromRemainingArguments, string description, IReadOnlyList validationSet, Dictionary serializedAdditionalRawData) { Name = name; ActivityParameterType = activityParameterType; @@ -42,6 +47,7 @@ internal AutomationActivityParameterDefinition(string name, string activityParam CanTakeValueValueFromRemainingArguments = canTakeValueValueFromRemainingArguments; Description = description; ValidationSet = validationSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the activity parameter. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.Serialization.cs index d14bc60f2798..aa870a042735 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationActivityParameterSet + public partial class AutomationActivityParameterSet : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationActivityParameterSet DeserializeAutomationActivityParameterSet(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationActivityParameterSet DeserializeAutomationActivityParameterSet(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +92,61 @@ internal static AutomationActivityParameterSet DeserializeAutomationActivityPara parameters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationActivityParameterSet(name.Value, Optional.ToList(parameters)); + return new AutomationActivityParameterSet(name.Value, Optional.ToList(parameters), serializedAdditionalRawData); + } + + AutomationActivityParameterSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationActivityParameterSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationActivityParameterSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationActivityParameterSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationActivityParameterSet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationActivityParameterSet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationActivityParameterSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.cs index 5b1b80521fc9..ce0509540af7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterSet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the activity parameter set. public partial class AutomationActivityParameterSet { - /// Initializes a new instance of AutomationActivityParameterSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationActivityParameterSet() { Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationActivityParameterSet. + /// Initializes a new instance of . /// Gets or sets the name of the activity parameter set. /// Gets or sets the parameters of the activity parameter set. - internal AutomationActivityParameterSet(string name, IReadOnlyList parameters) + /// Keeps track of any properties unknown to the library. + internal AutomationActivityParameterSet(string name, IReadOnlyList parameters, Dictionary serializedAdditionalRawData) { Name = name; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the activity parameter set. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.Serialization.cs index 9f7be21a1e17..c940a1ea1ac2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationActivityParameterValidationSet + public partial class AutomationActivityParameterValidationSet : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationActivityParameterValidationSet DeserializeAutomationActivityParameterValidationSet(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(MemberValue)) + { + writer.WritePropertyName("memberValue"u8); + writer.WriteStringValue(MemberValue); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationActivityParameterValidationSet DeserializeAutomationActivityParameterValidationSet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional memberValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("memberValue"u8)) @@ -26,8 +60,61 @@ internal static AutomationActivityParameterValidationSet DeserializeAutomationAc memberValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationActivityParameterValidationSet(memberValue.Value); + return new AutomationActivityParameterValidationSet(memberValue.Value, serializedAdditionalRawData); + } + + AutomationActivityParameterValidationSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationActivityParameterValidationSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationActivityParameterValidationSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationActivityParameterValidationSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationActivityParameterValidationSet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationActivityParameterValidationSet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationActivityParameterValidationSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.cs index 2b534658a2a8..b690173aa7cb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationActivityParameterValidationSet.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the activity parameter validation set. public partial class AutomationActivityParameterValidationSet { - /// Initializes a new instance of AutomationActivityParameterValidationSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationActivityParameterValidationSet() { } - /// Initializes a new instance of AutomationActivityParameterValidationSet. + /// Initializes a new instance of . /// Gets or sets the name of the activity parameter validation set member. - internal AutomationActivityParameterValidationSet(string memberValue) + /// Keeps track of any properties unknown to the library. + internal AutomationActivityParameterValidationSet(string memberValue, Dictionary serializedAdditionalRawData) { MemberValue = memberValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the activity parameter validation set member. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.Serialization.cs index cf5bcb92d942..266033d5e555 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAdvancedSchedule : IUtf8JsonSerializable + public partial class AutomationAdvancedSchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(WeekDays)) { @@ -42,15 +49,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MonthlyOccurrences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationAdvancedSchedule DeserializeAutomationAdvancedSchedule(JsonElement element) + internal static AutomationAdvancedSchedule DeserializeAutomationAdvancedSchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static AutomationAdvancedSchedule DeserializeAutomationAdvancedSchedule Optional> weekDays = default; Optional> monthDays = default; Optional> monthlyOccurrences = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weekDays"u8)) @@ -102,8 +131,61 @@ internal static AutomationAdvancedSchedule DeserializeAutomationAdvancedSchedule monthlyOccurrences = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAdvancedSchedule(Optional.ToList(weekDays), Optional.ToList(monthDays), Optional.ToList(monthlyOccurrences), serializedAdditionalRawData); + } + + AutomationAdvancedSchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAdvancedSchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAdvancedSchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAdvancedSchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAdvancedSchedule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAdvancedSchedule(Response response) + { + if (response is null) + { + return null; } - return new AutomationAdvancedSchedule(Optional.ToList(weekDays), Optional.ToList(monthDays), Optional.ToList(monthlyOccurrences)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAdvancedSchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.cs index 529cd5d5fca4..dc56301fc43c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedSchedule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The properties of the create Advanced Schedule. public partial class AutomationAdvancedSchedule { - /// Initializes a new instance of AutomationAdvancedSchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationAdvancedSchedule() { WeekDays = new ChangeTrackingList(); @@ -21,15 +25,17 @@ public AutomationAdvancedSchedule() MonthlyOccurrences = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationAdvancedSchedule. + /// Initializes a new instance of . /// Days of the week that the job should execute on. /// Days of the month that the job should execute on. Must be between 1 and 31. /// Occurrences of days within a month. - internal AutomationAdvancedSchedule(IList weekDays, IList monthDays, IList monthlyOccurrences) + /// Keeps track of any properties unknown to the library. + internal AutomationAdvancedSchedule(IList weekDays, IList monthDays, IList monthlyOccurrences, Dictionary serializedAdditionalRawData) { WeekDays = weekDays; MonthDays = monthDays; MonthlyOccurrences = monthlyOccurrences; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Days of the week that the job should execute on. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.Serialization.cs index fb02dd2d9c55..ab5a22f6c9bb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationAdvancedScheduleMonthlyOccurrence : IUtf8JsonSerializable + public partial class AutomationAdvancedScheduleMonthlyOccurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Occurrence)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("day"u8); writer.WriteStringValue(Day.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationAdvancedScheduleMonthlyOccurrence DeserializeAutomationAdvancedScheduleMonthlyOccurrence(JsonElement element) + internal static AutomationAdvancedScheduleMonthlyOccurrence DeserializeAutomationAdvancedScheduleMonthlyOccurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional occurrence = default; Optional day = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("occurrence"u8)) @@ -56,8 +79,61 @@ internal static AutomationAdvancedScheduleMonthlyOccurrence DeserializeAutomatio day = new AutomationDayOfWeek(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationAdvancedScheduleMonthlyOccurrence(Optional.ToNullable(occurrence), Optional.ToNullable(day), serializedAdditionalRawData); + } + + AutomationAdvancedScheduleMonthlyOccurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationAdvancedScheduleMonthlyOccurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationAdvancedScheduleMonthlyOccurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationAdvancedScheduleMonthlyOccurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationAdvancedScheduleMonthlyOccurrence model) + { + if (model is null) + { + return null; } - return new AutomationAdvancedScheduleMonthlyOccurrence(Optional.ToNullable(occurrence), Optional.ToNullable(day)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationAdvancedScheduleMonthlyOccurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationAdvancedScheduleMonthlyOccurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.cs index e2985b04f7b4..48d72efa2512 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationAdvancedScheduleMonthlyOccurrence.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The properties of the create advanced schedule monthly occurrence. public partial class AutomationAdvancedScheduleMonthlyOccurrence { - /// Initializes a new instance of AutomationAdvancedScheduleMonthlyOccurrence. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationAdvancedScheduleMonthlyOccurrence() { } - /// Initializes a new instance of AutomationAdvancedScheduleMonthlyOccurrence. + /// Initializes a new instance of . /// Occurrence of the week within the month. Must be between 1 and 5. /// Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday. - internal AutomationAdvancedScheduleMonthlyOccurrence(int? occurrence, AutomationDayOfWeek? day) + /// Keeps track of any properties unknown to the library. + internal AutomationAdvancedScheduleMonthlyOccurrence(int? occurrence, AutomationDayOfWeek? day, Dictionary serializedAdditionalRawData) { Occurrence = occurrence; Day = day; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Occurrence of the week within the month. Must be between 1 and 5. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.Serialization.cs index 032f63739030..85d94e7c58dc 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationCertificateCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationCertificateCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -37,7 +45,133 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsExportable.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationCertificateCreateOrUpdateContent DeserializeAutomationCertificateCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string base64Value = default; + Optional description = default; + Optional thumbprint = default; + Optional isExportable = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("base64Value"u8)) + { + base64Value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("thumbprint"u8)) + { + thumbprint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isExportable"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isExportable = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationCertificateCreateOrUpdateContent(name, base64Value, description.Value, thumbprint.Value, Optional.ToNullable(isExportable), serializedAdditionalRawData); + } + + AutomationCertificateCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCertificateCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCertificateCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCertificateCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCertificateCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCertificateCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCertificateCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.cs index 03df214b3b6a..d5e37b733a33 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update or replace certificate operation. public partial class AutomationCertificateCreateOrUpdateContent { - /// Initializes a new instance of AutomationCertificateCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the certificate. /// Gets or sets the base64 encoded value of the certificate. /// or is null. @@ -26,6 +30,28 @@ public AutomationCertificateCreateOrUpdateContent(string name, string base64Valu Base64Value = base64Value; } + /// Initializes a new instance of . + /// Gets or sets the name of the certificate. + /// Gets or sets the base64 encoded value of the certificate. + /// Gets or sets the description of the certificate. + /// Gets or sets the thumbprint of the certificate. + /// Gets or sets the is exportable flag of the certificate. + /// Keeps track of any properties unknown to the library. + internal AutomationCertificateCreateOrUpdateContent(string name, string base64Value, string description, string thumbprintString, bool? isExportable, Dictionary serializedAdditionalRawData) + { + Name = name; + Base64Value = base64Value; + Description = description; + ThumbprintString = thumbprintString; + IsExportable = isExportable; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationCertificateCreateOrUpdateContent() + { + } + /// Gets or sets the name of the certificate. public string Name { get; } /// Gets or sets the base64 encoded value of the certificate. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateData.Serialization.cs index 59f00fe6b1bc..ab4351cc20a3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationCertificateData : IUtf8JsonSerializable + public partial class AutomationCertificateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationCertificateData DeserializeAutomationCertificateData(JsonElement element) + internal static AutomationCertificateData DeserializeAutomationCertificateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +65,7 @@ internal static AutomationCertificateData DeserializeAutomationCertificateData(J Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -128,8 +150,61 @@ internal static AutomationCertificateData DeserializeAutomationCertificateData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationCertificateData(id, name, type, systemData.Value, thumbprint.Value, Optional.ToNullable(expiryTime), Optional.ToNullable(isExportable), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationCertificateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCertificateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCertificateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCertificateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCertificateData model) + { + if (model is null) + { + return null; } - return new AutomationCertificateData(id, name, type, systemData.Value, thumbprint.Value, Optional.ToNullable(expiryTime), Optional.ToNullable(isExportable), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCertificateData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCertificateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.Serialization.cs index d98179f23a83..44a2ce4ecc25 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationCertificateListResult + internal partial class AutomationCertificateListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationCertificateListResult DeserializeAutomationCertificateListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationCertificateListResult DeserializeAutomationCertificateListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationCertificateListResult DeserializeAutomationCertificate nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationCertificateListResult(Optional.ToList(value), nextLink.Value); + return new AutomationCertificateListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationCertificateListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCertificateListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCertificateListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCertificateListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCertificateListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCertificateListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCertificateListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.cs index cec31965082a..49cf5e6ba37e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificateListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list certificate operation. internal partial class AutomationCertificateListResult { - /// Initializes a new instance of AutomationCertificateListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationCertificateListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationCertificateListResult. + /// Initializes a new instance of . /// Gets or sets a list of certificates. /// Gets or sets the next link. - internal AutomationCertificateListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationCertificateListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of certificates. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.Serialization.cs index c9eb8502a017..cf194035bdc3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationCertificatePatch : IUtf8JsonSerializable + public partial class AutomationCertificatePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -28,7 +36,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationCertificatePatch DeserializeAutomationCertificatePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationCertificatePatch(name.Value, description.Value, serializedAdditionalRawData); + } + + AutomationCertificatePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCertificatePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCertificatePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCertificatePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCertificatePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCertificatePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCertificatePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.cs index baa3ae7f9293..36ff0ed3af5d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCertificatePatch.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the update certificate operation. public partial class AutomationCertificatePatch { - /// Initializes a new instance of AutomationCertificatePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationCertificatePatch() { } + /// Initializes a new instance of . + /// Gets or sets the name of the certificate. + /// Gets or sets the description of the certificate. + /// Keeps track of any properties unknown to the library. + internal AutomationCertificatePatch(string name, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the certificate. public string Name { get; set; } /// Gets or sets the description of the certificate. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.Serialization.cs index e880f6242d28..917b389c2e14 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationConnectionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationConnectionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -25,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WritePropertyName("connectionType"u8); - writer.WriteObjectValue(ConnectionType); + if (ConnectionType is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionType).Serialize(writer, options); + } if (Optional.IsCollectionDefined(FieldDefinitionValues)) { writer.WritePropertyName("fieldDefinitionValues"u8); @@ -38,7 +53,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationConnectionCreateOrUpdateContent DeserializeAutomationConnectionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional description = default; + ConnectionTypeAssociationProperty connectionType = default; + Optional> fieldDefinitionValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionType"u8)) + { + connectionType = ConnectionTypeAssociationProperty.DeserializeConnectionTypeAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("fieldDefinitionValues"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + fieldDefinitionValues = dictionary; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationConnectionCreateOrUpdateContent(name, description.Value, connectionType, Optional.ToDictionary(fieldDefinitionValues), serializedAdditionalRawData); + } + + AutomationConnectionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.cs index 6bd60b01aed2..b31757e3bed8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update connection operation. public partial class AutomationConnectionCreateOrUpdateContent { - /// Initializes a new instance of AutomationConnectionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the connection. /// Gets or sets the connectionType of the connection. /// or is null. @@ -28,6 +31,26 @@ public AutomationConnectionCreateOrUpdateContent(string name, ConnectionTypeAsso FieldDefinitionValues = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the name of the connection. + /// Gets or sets the description of the connection. + /// Gets or sets the connectionType of the connection. + /// Gets or sets the field definition properties of the connection. + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionCreateOrUpdateContent(string name, string description, ConnectionTypeAssociationProperty connectionType, IDictionary fieldDefinitionValues, Dictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + ConnectionType = connectionType; + FieldDefinitionValues = fieldDefinitionValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationConnectionCreateOrUpdateContent() + { + } + /// Gets or sets the name of the connection. public string Name { get; } /// Gets or sets the description of the connection. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionData.Serialization.cs index 081c2fa3b632..f1e15da9ada7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionData.Serialization.cs @@ -8,23 +8,36 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationConnectionData : IUtf8JsonSerializable + public partial class AutomationConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ConnectionType)) { writer.WritePropertyName("connectionType"u8); - writer.WriteObjectValue(ConnectionType); + if (ConnectionType is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionType).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -32,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationConnectionData DeserializeAutomationConnectionData(JsonElement element) + internal static AutomationConnectionData DeserializeAutomationConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +77,7 @@ internal static AutomationConnectionData DeserializeAutomationConnectionData(Jso Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -134,8 +162,61 @@ internal static AutomationConnectionData DeserializeAutomationConnectionData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationConnectionData(id, name, type, systemData.Value, connectionType.Value, Optional.ToDictionary(fieldDefinitionValues), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionData(Response response) + { + if (response is null) + { + return null; } - return new AutomationConnectionData(id, name, type, systemData.Value, connectionType.Value, Optional.ToDictionary(fieldDefinitionValues), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.Serialization.cs index 56dcf4436fd3..3fdf6fe38790 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationConnectionFieldDefinition : IUtf8JsonSerializable + public partial class AutomationConnectionFieldDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEncrypted)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(FieldDefinitionType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationConnectionFieldDefinition DeserializeAutomationConnectionFieldDefinition(JsonElement element) + internal static AutomationConnectionFieldDefinition DeserializeAutomationConnectionFieldDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static AutomationConnectionFieldDefinition DeserializeAutomationConnect Optional isEncrypted = default; Optional isOptional = default; string type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isEncrypted"u8)) @@ -64,8 +87,61 @@ internal static AutomationConnectionFieldDefinition DeserializeAutomationConnect type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationConnectionFieldDefinition(Optional.ToNullable(isEncrypted), Optional.ToNullable(isOptional), type, serializedAdditionalRawData); + } + + AutomationConnectionFieldDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionFieldDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionFieldDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionFieldDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionFieldDefinition model) + { + if (model is null) + { + return null; } - return new AutomationConnectionFieldDefinition(Optional.ToNullable(isEncrypted), Optional.ToNullable(isOptional), type); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionFieldDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionFieldDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.cs index 71742325b859..0c71ddfcc0c6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionFieldDefinition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the connection fields. public partial class AutomationConnectionFieldDefinition { - /// Initializes a new instance of AutomationConnectionFieldDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the type of the connection field definition. /// is null. public AutomationConnectionFieldDefinition(string fieldDefinitionType) @@ -23,15 +27,22 @@ public AutomationConnectionFieldDefinition(string fieldDefinitionType) FieldDefinitionType = fieldDefinitionType; } - /// Initializes a new instance of AutomationConnectionFieldDefinition. + /// Initializes a new instance of . /// Gets or sets the isEncrypted flag of the connection field definition. /// Gets or sets the isOptional flag of the connection field definition. /// Gets or sets the type of the connection field definition. - internal AutomationConnectionFieldDefinition(bool? isEncrypted, bool? isOptional, string fieldDefinitionType) + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionFieldDefinition(bool? isEncrypted, bool? isOptional, string fieldDefinitionType, Dictionary serializedAdditionalRawData) { IsEncrypted = isEncrypted; IsOptional = isOptional; FieldDefinitionType = fieldDefinitionType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationConnectionFieldDefinition() + { } /// Gets or sets the isEncrypted flag of the connection field definition. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.Serialization.cs index 4aa2c6c66a77..7e513b6f00c9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationConnectionListResult + internal partial class AutomationConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationConnectionListResult DeserializeAutomationConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationConnectionListResult DeserializeAutomationConnectionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationConnectionListResult DeserializeAutomationConnectionLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationConnectionListResult(Optional.ToList(value), nextLink.Value); + return new AutomationConnectionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.cs index 272e700199be..422c537705b5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list connection operation. internal partial class AutomationConnectionListResult { - /// Initializes a new instance of AutomationConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationConnectionListResult. + /// Initializes a new instance of . /// Gets or sets a list of connection. /// Gets or sets the next link. - internal AutomationConnectionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of connection. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.Serialization.cs index 588fcdaf5be2..f4840823dead 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationConnectionPatch : IUtf8JsonSerializable + public partial class AutomationConnectionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -39,7 +47,126 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationConnectionPatch DeserializeAutomationConnectionPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional description = default; + Optional> fieldDefinitionValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("fieldDefinitionValues"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + fieldDefinitionValues = dictionary; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationConnectionPatch(name.Value, description.Value, Optional.ToDictionary(fieldDefinitionValues), serializedAdditionalRawData); + } + + AutomationConnectionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.cs index 69a307eb9e2f..5befcfe045d0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the update connection operation. public partial class AutomationConnectionPatch { - /// Initializes a new instance of AutomationConnectionPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationConnectionPatch() { FieldDefinitionValues = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the name of the connection. + /// Gets or sets the description of the connection. + /// Gets or sets the field definition values of the connection. + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionPatch(string name, string description, IDictionary fieldDefinitionValues, Dictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + FieldDefinitionValues = fieldDefinitionValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the connection. public string Name { get; set; } /// Gets or sets the description of the connection. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.Serialization.cs index 79be1efdacf4..12c5a605faeb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationConnectionTypeCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationConnectionTypeCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -29,11 +37,137 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in FieldDefinitions) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationConnectionTypeCreateOrUpdateContent DeserializeAutomationConnectionTypeCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional isGlobal = default; + IDictionary fieldDefinitions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("isGlobal"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isGlobal = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("fieldDefinitions"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, AutomationConnectionFieldDefinition.DeserializeAutomationConnectionFieldDefinition(property1.Value)); + } + fieldDefinitions = dictionary; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationConnectionTypeCreateOrUpdateContent(name, Optional.ToNullable(isGlobal), fieldDefinitions, serializedAdditionalRawData); + } + + AutomationConnectionTypeCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionTypeCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionTypeCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionTypeCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionTypeCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionTypeCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionTypeCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.cs index d93b48f9245e..ddcd9ff6e86c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update connection type operation. public partial class AutomationConnectionTypeCreateOrUpdateContent { - /// Initializes a new instance of AutomationConnectionTypeCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the connection type. /// Gets or sets the field definitions of the connection type. /// or is null. @@ -27,6 +30,24 @@ public AutomationConnectionTypeCreateOrUpdateContent(string name, IDictionary Initializes a new instance of . + /// Gets or sets the name of the connection type. + /// Gets or sets a Boolean value to indicate if the connection type is global. + /// Gets or sets the field definitions of the connection type. + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionTypeCreateOrUpdateContent(string name, bool? isGlobal, IDictionary fieldDefinitions, Dictionary serializedAdditionalRawData) + { + Name = name; + IsGlobal = isGlobal; + FieldDefinitions = fieldDefinitions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationConnectionTypeCreateOrUpdateContent() + { + } + /// Gets or sets the name of the connection type. public string Name { get; } /// Gets or sets a Boolean value to indicate if the connection type is global. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeData.Serialization.cs index 216dc935d235..f1e85ecb893e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeData.Serialization.cs @@ -8,16 +8,60 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationConnectionTypeData + public partial class AutomationConnectionTypeData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationConnectionTypeData DeserializeAutomationConnectionTypeData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(IsGlobal)) + { + writer.WritePropertyName("isGlobal"u8); + writer.WriteBooleanValue(IsGlobal.Value); + } + if (Optional.IsDefined(LastModifiedOn)) + { + writer.WritePropertyName("lastModifiedTime"u8); + writer.WriteStringValue(LastModifiedOn.Value, "O"); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationConnectionTypeData DeserializeAutomationConnectionTypeData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +75,7 @@ internal static AutomationConnectionTypeData DeserializeAutomationConnectionType Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -115,8 +160,61 @@ internal static AutomationConnectionTypeData DeserializeAutomationConnectionType } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationConnectionTypeData(id, name, type, systemData.Value, Optional.ToNullable(isGlobal), Optional.ToDictionary(fieldDefinitions), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + return new AutomationConnectionTypeData(id, name, type, systemData.Value, Optional.ToNullable(isGlobal), Optional.ToDictionary(fieldDefinitions), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationConnectionTypeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionTypeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionTypeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionTypeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionTypeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionTypeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionTypeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.Serialization.cs index ba6235ac97f5..58e0c4427249 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationConnectionTypeListResult + internal partial class AutomationConnectionTypeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationConnectionTypeListResult DeserializeAutomationConnectionTypeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationConnectionTypeListResult DeserializeAutomationConnectionTypeListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationConnectionTypeListResult DeserializeAutomationConnecti nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationConnectionTypeListResult(Optional.ToList(value), nextLink.Value); + return new AutomationConnectionTypeListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationConnectionTypeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationConnectionTypeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationConnectionTypeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationConnectionTypeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationConnectionTypeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationConnectionTypeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationConnectionTypeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.cs index f5e3301c48bf..01f795964ffc 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationConnectionTypeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list connection type operation. internal partial class AutomationConnectionTypeListResult { - /// Initializes a new instance of AutomationConnectionTypeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationConnectionTypeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationConnectionTypeListResult. + /// Initializes a new instance of . /// Gets or sets a list of connection types. /// Gets or sets the next link. - internal AutomationConnectionTypeListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationConnectionTypeListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of connection types. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.Serialization.cs index b8f80ea3fea5..f7c756080971 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationContentHash : IUtf8JsonSerializable + public partial class AutomationContentHash : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("algorithm"u8); writer.WriteStringValue(Algorithm); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationContentHash DeserializeAutomationContentHash(JsonElement element) + internal static AutomationContentHash DeserializeAutomationContentHash(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string algorithm = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("algorithm"u8)) @@ -42,8 +65,61 @@ internal static AutomationContentHash DeserializeAutomationContentHash(JsonEleme value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationContentHash(algorithm, value, serializedAdditionalRawData); + } + + AutomationContentHash IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationContentHash(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationContentHash IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationContentHash(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationContentHash model) + { + if (model is null) + { + return null; } - return new AutomationContentHash(algorithm, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationContentHash(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationContentHash(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.cs index b8ac980d4a7f..3b3579384a9a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentHash.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the runbook property type. public partial class AutomationContentHash { - /// Initializes a new instance of AutomationContentHash. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the content hash algorithm used to hash the content. /// Gets or sets expected hash value of the content. /// or is null. @@ -26,6 +30,22 @@ public AutomationContentHash(string algorithm, string value) Value = value; } + /// Initializes a new instance of . + /// Gets or sets the content hash algorithm used to hash the content. + /// Gets or sets expected hash value of the content. + /// Keeps track of any properties unknown to the library. + internal AutomationContentHash(string algorithm, string value, Dictionary serializedAdditionalRawData) + { + Algorithm = algorithm; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationContentHash() + { + } + /// Gets or sets the content hash algorithm used to hash the content. public string Algorithm { get; set; } /// Gets or sets expected hash value of the content. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.Serialization.cs index 65856d522683..7a35341e58a7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationContentLink : IUtf8JsonSerializable + public partial class AutomationContentLink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Uri)) { @@ -24,18 +31,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContentHash)) { writer.WritePropertyName("contentHash"u8); - writer.WriteObjectValue(ContentHash); + if (ContentHash is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContentHash).Serialize(writer, options); + } } if (Optional.IsDefined(Version)) { writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationContentLink DeserializeAutomationContentLink(JsonElement element) + internal static AutomationContentLink DeserializeAutomationContentLink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static AutomationContentLink DeserializeAutomationContentLink(JsonEleme Optional uri = default; Optional contentHash = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uri"u8)) @@ -68,8 +97,61 @@ internal static AutomationContentLink DeserializeAutomationContentLink(JsonEleme version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationContentLink(uri.Value, contentHash.Value, version.Value, serializedAdditionalRawData); + } + + AutomationContentLink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationContentLink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationContentLink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationContentLink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationContentLink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationContentLink(Response response) + { + if (response is null) + { + return null; } - return new AutomationContentLink(uri.Value, contentHash.Value, version.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationContentLink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.cs index 8db527e9e527..8181b87f421b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentLink.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// Definition of the content link. public partial class AutomationContentLink { - /// Initializes a new instance of AutomationContentLink. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationContentLink() { } - /// Initializes a new instance of AutomationContentLink. + /// Initializes a new instance of . /// Gets or sets the uri of the runbook content. /// Gets or sets the hash. /// Gets or sets the version of the content. - internal AutomationContentLink(Uri uri, AutomationContentHash contentHash, string version) + /// Keeps track of any properties unknown to the library. + internal AutomationContentLink(Uri uri, AutomationContentHash contentHash, string version, Dictionary serializedAdditionalRawData) { Uri = uri; ContentHash = contentHash; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the uri of the runbook content. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.Serialization.cs index dab574e91524..14ea8fa47445 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationContentSource : IUtf8JsonSerializable + public partial class AutomationContentSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Hash)) { writer.WritePropertyName("hash"u8); - writer.WriteObjectValue(Hash); + if (Hash is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Hash).Serialize(writer, options); + } } if (Optional.IsDefined(SourceType)) { @@ -35,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationContentSource DeserializeAutomationContentSource(JsonElement element) + internal static AutomationContentSource DeserializeAutomationContentSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +77,7 @@ internal static AutomationContentSource DeserializeAutomationContentSource(JsonE Optional type = default; Optional value = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hash"u8)) @@ -78,8 +108,61 @@ internal static AutomationContentSource DeserializeAutomationContentSource(JsonE version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationContentSource(hash.Value, Optional.ToNullable(type), value.Value, version.Value, serializedAdditionalRawData); + } + + AutomationContentSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationContentSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationContentSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationContentSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationContentSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationContentSource(Response response) + { + if (response is null) + { + return null; } - return new AutomationContentSource(hash.Value, Optional.ToNullable(type), value.Value, version.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationContentSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.cs index 0ead8a46894d..b6ff5e26736a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationContentSource.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the content source. public partial class AutomationContentSource { - /// Initializes a new instance of AutomationContentSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationContentSource() { } - /// Initializes a new instance of AutomationContentSource. + /// Initializes a new instance of . /// Gets or sets the hash. /// Gets or sets the content source type. /// Gets or sets the value of the content. This is based on the content source type. /// Gets or sets the version of the content. - internal AutomationContentSource(AutomationContentHash hash, AutomationContentSourceType? sourceType, string value, string version) + /// Keeps track of any properties unknown to the library. + internal AutomationContentSource(AutomationContentHash hash, AutomationContentSourceType? sourceType, string value, string version, Dictionary serializedAdditionalRawData) { Hash = hash; SourceType = sourceType; Value = value; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the hash. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.Serialization.cs index 78d068e8a83b..e44eb3f63b5c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationCredentialCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationCredentialCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -29,7 +37,123 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationCredentialCreateOrUpdateContent DeserializeAutomationCredentialCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string userName = default; + string password = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("userName"u8)) + { + userName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("password"u8)) + { + password = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationCredentialCreateOrUpdateContent(name, userName, password, description.Value, serializedAdditionalRawData); + } + + AutomationCredentialCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCredentialCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCredentialCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCredentialCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCredentialCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCredentialCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCredentialCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.cs index 9435e1765e99..6ebfefdcb1ce 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update credential operation. public partial class AutomationCredentialCreateOrUpdateContent { - /// Initializes a new instance of AutomationCredentialCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the credential. /// Gets or sets the user name of the credential. /// Gets or sets the password of the credential. @@ -29,6 +33,26 @@ public AutomationCredentialCreateOrUpdateContent(string name, string userName, s Password = password; } + /// Initializes a new instance of . + /// Gets or sets the name of the credential. + /// Gets or sets the user name of the credential. + /// Gets or sets the password of the credential. + /// Gets or sets the description of the credential. + /// Keeps track of any properties unknown to the library. + internal AutomationCredentialCreateOrUpdateContent(string name, string userName, string password, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + UserName = userName; + Password = password; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationCredentialCreateOrUpdateContent() + { + } + /// Gets or sets the name of the credential. public string Name { get; } /// Gets or sets the user name of the credential. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialData.Serialization.cs index 64c74875e397..a4244d97e6f8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationCredentialData : IUtf8JsonSerializable + public partial class AutomationCredentialData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationCredentialData DeserializeAutomationCredentialData(JsonElement element) + internal static AutomationCredentialData DeserializeAutomationCredentialData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +63,7 @@ internal static AutomationCredentialData DeserializeAutomationCredentialData(Jso Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -108,8 +130,61 @@ internal static AutomationCredentialData DeserializeAutomationCredentialData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationCredentialData(id, name, type, systemData.Value, userName.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationCredentialData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCredentialData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCredentialData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCredentialData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCredentialData model) + { + if (model is null) + { + return null; } - return new AutomationCredentialData(id, name, type, systemData.Value, userName.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCredentialData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCredentialData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.Serialization.cs index 77e67044461e..fc04e515d6cb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationCredentialListResult + internal partial class AutomationCredentialListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationCredentialListResult DeserializeAutomationCredentialListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationCredentialListResult DeserializeAutomationCredentialListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationCredentialListResult DeserializeAutomationCredentialLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationCredentialListResult(Optional.ToList(value), nextLink.Value); + return new AutomationCredentialListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationCredentialListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCredentialListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCredentialListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCredentialListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCredentialListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCredentialListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCredentialListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.cs index e37d8404c3f4..cd85ae1287ed 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list credential operation. internal partial class AutomationCredentialListResult { - /// Initializes a new instance of AutomationCredentialListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationCredentialListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationCredentialListResult. + /// Initializes a new instance of . /// Gets or sets a list of credentials. /// Gets or sets the next link. - internal AutomationCredentialListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationCredentialListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of credentials. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.Serialization.cs index a63c68f7230d..051a8bddd1c0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationCredentialPatch : IUtf8JsonSerializable + public partial class AutomationCredentialPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -38,7 +46,123 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationCredentialPatch DeserializeAutomationCredentialPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional userName = default; + Optional password = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("userName"u8)) + { + userName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("password"u8)) + { + password = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationCredentialPatch(name.Value, userName.Value, password.Value, description.Value, serializedAdditionalRawData); + } + + AutomationCredentialPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationCredentialPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationCredentialPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationCredentialPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationCredentialPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationCredentialPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationCredentialPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.cs index 2a9531c5200e..6014a328d3e2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationCredentialPatch.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the Update credential operation. public partial class AutomationCredentialPatch { - /// Initializes a new instance of AutomationCredentialPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationCredentialPatch() { } + /// Initializes a new instance of . + /// Gets or sets the name of the credential. + /// Gets or sets the user name of the credential. + /// Gets or sets the password of the credential. + /// Gets or sets the description of the credential. + /// Keeps track of any properties unknown to the library. + internal AutomationCredentialPatch(string name, string userName, string password, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + UserName = userName; + Password = password; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the credential. public string Name { get; set; } /// Gets or sets the user name of the credential. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.Serialization.cs index 3e7faaef66b8..19e7db6a7767 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationEncryptionProperties : IUtf8JsonSerializable + public partial class AutomationEncryptionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyVaultProperties)) { writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties); + if (KeyVaultProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProperties).Serialize(writer, options); + } } if (Optional.IsDefined(KeySource)) { @@ -28,13 +43,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AutomationEncryptionProperties DeserializeAutomationEncryptionProperties(JsonElement element) + internal static AutomationEncryptionProperties DeserializeAutomationEncryptionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static AutomationEncryptionProperties DeserializeAutomationEncryptionPr Optional keyVaultProperties = default; Optional keySource = default; Optional identity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyVaultProperties"u8)) @@ -71,8 +108,61 @@ internal static AutomationEncryptionProperties DeserializeAutomationEncryptionPr identity = EncryptionPropertiesIdentity.DeserializeEncryptionPropertiesIdentity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationEncryptionProperties(keyVaultProperties.Value, Optional.ToNullable(keySource), identity.Value, serializedAdditionalRawData); + } + + AutomationEncryptionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationEncryptionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationEncryptionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationEncryptionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationEncryptionProperties model) + { + if (model is null) + { + return null; } - return new AutomationEncryptionProperties(keyVaultProperties.Value, Optional.ToNullable(keySource), identity.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationEncryptionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationEncryptionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.cs index 1378fbc9c1bf..72c91e39b63b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationEncryptionProperties.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// The encryption settings for automation account. public partial class AutomationEncryptionProperties { - /// Initializes a new instance of AutomationEncryptionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationEncryptionProperties() { } - /// Initializes a new instance of AutomationEncryptionProperties. + /// Initializes a new instance of . /// Key vault properties. /// Encryption Key Source. /// User identity used for CMK. - internal AutomationEncryptionProperties(AutomationKeyVaultProperties keyVaultProperties, EncryptionKeySourceType? keySource, EncryptionPropertiesIdentity identity) + /// Keeps track of any properties unknown to the library. + internal AutomationEncryptionProperties(AutomationKeyVaultProperties keyVaultProperties, EncryptionKeySourceType? keySource, EncryptionPropertiesIdentity identity, Dictionary serializedAdditionalRawData) { KeyVaultProperties = keyVaultProperties; KeySource = keySource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key vault properties. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.Serialization.cs index f3d79acba4a6..00c3e2b5f812 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationJobCollectionItemData : IUtf8JsonSerializable + public partial class AutomationJobCollectionItemData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RunOn); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationJobCollectionItemData DeserializeAutomationJobCollectionItemData(JsonElement element) + internal static AutomationJobCollectionItemData DeserializeAutomationJobCollectionItemData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +68,7 @@ internal static AutomationJobCollectionItemData DeserializeAutomationJobCollecti Optional lastModifiedTime = default; Optional provisioningState = default; Optional runOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -161,8 +183,61 @@ internal static AutomationJobCollectionItemData DeserializeAutomationJobCollecti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationJobCollectionItemData(id, name, type, systemData.Value, runbook.Value, Optional.ToNullable(jobId), Optional.ToNullable(creationTime), Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(lastModifiedTime), provisioningState.Value, runOn.Value, serializedAdditionalRawData); + } + + AutomationJobCollectionItemData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobCollectionItemData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobCollectionItemData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobCollectionItemData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobCollectionItemData model) + { + if (model is null) + { + return null; } - return new AutomationJobCollectionItemData(id, name, type, systemData.Value, runbook.Value, Optional.ToNullable(jobId), Optional.ToNullable(creationTime), Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(lastModifiedTime), provisioningState.Value, runOn.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobCollectionItemData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobCollectionItemData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.cs index 0ddd6683165d..de7a2ad9fe09 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCollectionItemData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Automation.Models /// Job collection item properties. public partial class AutomationJobCollectionItemData : ResourceData { - /// Initializes a new instance of AutomationJobCollectionItemData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationJobCollectionItemData() { } - /// Initializes a new instance of AutomationJobCollectionItemData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +37,8 @@ public AutomationJobCollectionItemData() /// The last modified time of the job. /// The provisioning state of a resource. /// Specifies the runOn group name where the job was executed. - internal AutomationJobCollectionItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RunbookAssociationProperty runbook, Guid? jobId, DateTimeOffset? createdOn, AutomationJobStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, string provisioningState, string runOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationJobCollectionItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RunbookAssociationProperty runbook, Guid? jobId, DateTimeOffset? createdOn, AutomationJobStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, string provisioningState, string runOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Runbook = runbook; JobId = jobId; @@ -44,6 +49,7 @@ internal AutomationJobCollectionItemData(ResourceIdentifier id, string name, Res LastModifiedOn = lastModifiedOn; ProvisioningState = provisioningState; RunOn = runOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The runbook association. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.Serialization.cs index 8375c58638b5..ed062c1e663d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationJobCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationJobCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Runbook)) { writer.WritePropertyName("runbook"u8); - writer.WriteObjectValue(Runbook); + if (Runbook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Runbook).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Parameters)) { @@ -39,7 +54,130 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RunOn); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationJobCreateOrUpdateContent DeserializeAutomationJobCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional runbook = default; + Optional> parameters = default; + Optional runOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("runbook"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runbook = RunbookAssociationProperty.DeserializeRunbookAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("runOn"u8)) + { + runOn = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationJobCreateOrUpdateContent(runbook.Value, Optional.ToDictionary(parameters), runOn.Value, serializedAdditionalRawData); + } + + AutomationJobCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.cs index 9732f6a68cee..8fdef301f03e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create job operation. public partial class AutomationJobCreateOrUpdateContent { - /// Initializes a new instance of AutomationJobCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationJobCreateOrUpdateContent() { Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the runbook. + /// Gets or sets the parameters of the job. + /// Gets or sets the runOn which specifies the group name where the job is to be executed. + /// Keeps track of any properties unknown to the library. + internal AutomationJobCreateOrUpdateContent(RunbookAssociationProperty runbook, IDictionary parameters, string runOn, Dictionary serializedAdditionalRawData) + { + Runbook = runbook; + Parameters = parameters; + RunOn = runOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the runbook. internal RunbookAssociationProperty Runbook { get; set; } /// Gets or sets the name of the runbook. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobData.Serialization.cs index 4c7c3e254e44..69670c2ffbf2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobData.Serialization.cs @@ -8,23 +8,36 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationJobData : IUtf8JsonSerializable + public partial class AutomationJobData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Runbook)) { writer.WritePropertyName("runbook"u8); - writer.WriteObjectValue(Runbook); + if (Runbook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Runbook).Serialize(writer, options); + } } if (Optional.IsDefined(StartedBy)) { @@ -126,11 +139,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationJobData DeserializeAutomationJobData(JsonElement element) + internal static AutomationJobData DeserializeAutomationJobData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -153,6 +180,7 @@ internal static AutomationJobData DeserializeAutomationJobData(JsonElement eleme Optional lastStatusModifiedTime = default; Optional> parameters = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -310,8 +338,61 @@ internal static AutomationJobData DeserializeAutomationJobData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationJobData(id, name, type, systemData.Value, runbook.Value, startedBy.Value, runOn.Value, Optional.ToNullable(jobId), Optional.ToNullable(creationTime), Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), exception.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(lastStatusModifiedTime), Optional.ToDictionary(parameters), Optional.ToNullable(provisioningState)); + return new AutomationJobData(id, name, type, systemData.Value, runbook.Value, startedBy.Value, runOn.Value, Optional.ToNullable(jobId), Optional.ToNullable(creationTime), Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), exception.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(lastStatusModifiedTime), Optional.ToDictionary(parameters), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AutomationJobData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.Serialization.cs index 25c350f2e51b..57f1bf28ef80 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationJobListResultV2 + internal partial class AutomationJobListResultV2 : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationJobListResultV2 DeserializeAutomationJobListResultV2(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationJobListResultV2 DeserializeAutomationJobListResultV2(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +87,61 @@ internal static AutomationJobListResultV2 DeserializeAutomationJobListResultV2(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationJobListResultV2(Optional.ToList(value), nextLink.Value); + return new AutomationJobListResultV2(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationJobListResultV2 IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobListResultV2(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobListResultV2 IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobListResultV2(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobListResultV2 model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobListResultV2(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobListResultV2(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.cs index de5675278703..583a2c1ba7e1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobListResultV2.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list job operation. internal partial class AutomationJobListResultV2 { - /// Initializes a new instance of AutomationJobListResultV2. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationJobListResultV2() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationJobListResultV2. + /// Initializes a new instance of . /// List of jobs. /// The link to the next page. - internal AutomationJobListResultV2(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationJobListResultV2(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of jobs. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.Serialization.cs index 0771bc583da8..5abd30d068d9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.Serialization.cs @@ -5,22 +5,44 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationJobScheduleCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationJobScheduleCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } writer.WritePropertyName("runbook"u8); - writer.WriteObjectValue(Runbook); + if (Runbook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Runbook).Serialize(writer, options); + } if (Optional.IsDefined(RunOn)) { writer.WritePropertyName("runOn"u8); @@ -38,7 +60,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationJobScheduleCreateOrUpdateContent DeserializeAutomationJobScheduleCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScheduleAssociationProperty schedule = default; + RunbookAssociationProperty runbook = default; + Optional runOn = default; + Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("schedule"u8)) + { + schedule = ScheduleAssociationProperty.DeserializeScheduleAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("runbook"u8)) + { + runbook = RunbookAssociationProperty.DeserializeRunbookAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("runOn"u8)) + { + runOn = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationJobScheduleCreateOrUpdateContent(schedule, runbook, runOn.Value, Optional.ToDictionary(parameters), serializedAdditionalRawData); + } + + AutomationJobScheduleCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobScheduleCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobScheduleCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobScheduleCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobScheduleCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobScheduleCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobScheduleCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.cs index 5533f6854c2c..59f7ffac9a9f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create job schedule operation. public partial class AutomationJobScheduleCreateOrUpdateContent { - /// Initializes a new instance of AutomationJobScheduleCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the schedule. /// Gets or sets the runbook. /// or is null. @@ -28,6 +31,26 @@ public AutomationJobScheduleCreateOrUpdateContent(ScheduleAssociationProperty sc Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the schedule. + /// Gets or sets the runbook. + /// Gets or sets the hybrid worker group that the scheduled job should run on. + /// Gets or sets a list of job properties. + /// Keeps track of any properties unknown to the library. + internal AutomationJobScheduleCreateOrUpdateContent(ScheduleAssociationProperty schedule, RunbookAssociationProperty runbook, string runOn, IDictionary parameters, Dictionary serializedAdditionalRawData) + { + Schedule = schedule; + Runbook = runbook; + RunOn = runOn; + Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationJobScheduleCreateOrUpdateContent() + { + } + /// Gets or sets the schedule. internal ScheduleAssociationProperty Schedule { get; } /// Gets or sets the name of the Schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleData.Serialization.cs index 5370f440108c..e969c20dc965 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleData.Serialization.cs @@ -8,16 +8,90 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationJobScheduleData + public partial class AutomationJobScheduleData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationJobScheduleData DeserializeAutomationJobScheduleData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(JobScheduleId)) + { + writer.WritePropertyName("jobScheduleId"u8); + writer.WriteStringValue(JobScheduleId.Value); + } + if (Optional.IsDefined(Schedule)) + { + writer.WritePropertyName("schedule"u8); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } + } + if (Optional.IsDefined(Runbook)) + { + writer.WritePropertyName("runbook"u8); + if (Runbook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Runbook).Serialize(writer, options); + } + } + if (Optional.IsDefined(RunOn)) + { + writer.WritePropertyName("runOn"u8); + writer.WriteStringValue(RunOn); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationJobScheduleData DeserializeAutomationJobScheduleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +105,7 @@ internal static AutomationJobScheduleData DeserializeAutomationJobScheduleData(J Optional runbook = default; Optional runOn = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -115,8 +190,61 @@ internal static AutomationJobScheduleData DeserializeAutomationJobScheduleData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationJobScheduleData(id, name, type, systemData.Value, Optional.ToNullable(jobScheduleId), schedule.Value, runbook.Value, runOn.Value, Optional.ToDictionary(parameters)); + return new AutomationJobScheduleData(id, name, type, systemData.Value, Optional.ToNullable(jobScheduleId), schedule.Value, runbook.Value, runOn.Value, Optional.ToDictionary(parameters), serializedAdditionalRawData); + } + + AutomationJobScheduleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobScheduleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobScheduleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobScheduleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobScheduleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobScheduleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobScheduleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.Serialization.cs index 3892171068ff..500821ee0300 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationJobScheduleListResult + internal partial class AutomationJobScheduleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationJobScheduleListResult DeserializeAutomationJobScheduleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationJobScheduleListResult DeserializeAutomationJobScheduleListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationJobScheduleListResult DeserializeAutomationJobSchedule nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationJobScheduleListResult(Optional.ToList(value), nextLink.Value); + return new AutomationJobScheduleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationJobScheduleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobScheduleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobScheduleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobScheduleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobScheduleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobScheduleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobScheduleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.cs index c23af96131d9..8a8533a599c8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobScheduleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list job schedule operation. internal partial class AutomationJobScheduleListResult { - /// Initializes a new instance of AutomationJobScheduleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationJobScheduleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationJobScheduleListResult. + /// Initializes a new instance of . /// Gets or sets a list of job schedules. /// Gets or sets the next link. - internal AutomationJobScheduleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationJobScheduleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of job schedules. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.Serialization.cs index cdc5d7b5c678..ddb2980d9058 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.Serialization.cs @@ -8,14 +8,93 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationJobStream + public partial class AutomationJobStream : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationJobStream DeserializeAutomationJobStream(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(JobStreamId)) + { + writer.WritePropertyName("jobStreamId"u8); + writer.WriteStringValue(JobStreamId); + } + if (Optional.IsDefined(Time)) + { + writer.WritePropertyName("time"u8); + writer.WriteStringValue(Time.Value, "O"); + } + if (Optional.IsDefined(StreamType)) + { + writer.WritePropertyName("streamType"u8); + writer.WriteStringValue(StreamType.Value.ToString()); + } + if (Optional.IsDefined(StreamText)) + { + writer.WritePropertyName("streamText"u8); + writer.WriteStringValue(StreamText); + } + if (Optional.IsDefined(Summary)) + { + writer.WritePropertyName("summary"u8); + writer.WriteStringValue(Summary); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartObject(); + foreach (var item in Value) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationJobStream DeserializeAutomationJobStream(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +106,7 @@ internal static AutomationJobStream DeserializeAutomationJobStream(JsonElement e Optional streamText = default; Optional summary = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -104,8 +184,61 @@ internal static AutomationJobStream DeserializeAutomationJobStream(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationJobStream(id.Value, jobStreamId.Value, Optional.ToNullable(time), Optional.ToNullable(streamType), streamText.Value, summary.Value, Optional.ToDictionary(value)); + return new AutomationJobStream(id.Value, jobStreamId.Value, Optional.ToNullable(time), Optional.ToNullable(streamType), streamText.Value, summary.Value, Optional.ToDictionary(value), serializedAdditionalRawData); + } + + AutomationJobStream IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobStream(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobStream IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobStream(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobStream model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobStream(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobStream(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.cs index 91a89d96d55b..03fd4d069569 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStream.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the job stream. public partial class AutomationJobStream { - /// Initializes a new instance of AutomationJobStream. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationJobStream() { Value = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AutomationJobStream. + /// Initializes a new instance of . /// Gets or sets the id of the resource. /// Gets or sets the id of the job stream. /// Gets or sets the creation time of the job. @@ -28,7 +31,8 @@ internal AutomationJobStream() /// Gets or sets the stream text. /// Gets or sets the summary. /// Gets or sets the values of the job stream. - internal AutomationJobStream(ResourceIdentifier id, string jobStreamId, DateTimeOffset? time, AutomationJobStreamType? streamType, string streamText, string summary, IReadOnlyDictionary value) + /// Keeps track of any properties unknown to the library. + internal AutomationJobStream(ResourceIdentifier id, string jobStreamId, DateTimeOffset? time, AutomationJobStreamType? streamType, string streamText, string summary, IReadOnlyDictionary value, Dictionary serializedAdditionalRawData) { Id = id; JobStreamId = jobStreamId; @@ -37,6 +41,7 @@ internal AutomationJobStream(ResourceIdentifier id, string jobStreamId, DateTime StreamText = streamText; Summary = summary; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the id of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.Serialization.cs index 51a49e4518de..b621768a01de 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationJobStreamListResult + internal partial class AutomationJobStreamListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationJobStreamListResult DeserializeAutomationJobStreamListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationJobStreamListResult DeserializeAutomationJobStreamListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static AutomationJobStreamListResult DeserializeAutomationJobStreamList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationJobStreamListResult(Optional.ToList(value), nextLink.Value); + return new AutomationJobStreamListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationJobStreamListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationJobStreamListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationJobStreamListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationJobStreamListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationJobStreamListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationJobStreamListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationJobStreamListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.cs index 90de81c69086..9ee030e267ab 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationJobStreamListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list job stream operation. internal partial class AutomationJobStreamListResult { - /// Initializes a new instance of AutomationJobStreamListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationJobStreamListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationJobStreamListResult. + /// Initializes a new instance of . /// A list of job streams. /// Gets or sets the next link. - internal AutomationJobStreamListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationJobStreamListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of job streams. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.Serialization.cs index fa22df5b90d2..4d6202e68a1b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationKey + public partial class AutomationKey : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationKey DeserializeAutomationKey(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationKey DeserializeAutomationKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AutomationKey DeserializeAutomationKey(JsonElement element) Optional keyName = default; Optional permissions = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("KeyName"u8)) @@ -46,8 +75,61 @@ internal static AutomationKey DeserializeAutomationKey(JsonElement element) value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationKey(Optional.ToNullable(keyName), Optional.ToNullable(permissions), value.Value); + return new AutomationKey(Optional.ToNullable(keyName), Optional.ToNullable(permissions), value.Value, serializedAdditionalRawData); + } + + AutomationKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.cs index 2715d63005ec..135039f9ac14 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKey.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Automation key which is used to register a DSC Node. public partial class AutomationKey { - /// Initializes a new instance of AutomationKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationKey() { } - /// Initializes a new instance of AutomationKey. + /// Initializes a new instance of . /// Automation key name. /// Automation key permissions. /// Value of the Automation Key used for registration. - internal AutomationKey(AutomationKeyName? keyName, AutomationKeyPermission? permissions, string value) + /// Keeps track of any properties unknown to the library. + internal AutomationKey(AutomationKeyName? keyName, AutomationKeyPermission? permissions, string value, Dictionary serializedAdditionalRawData) { KeyName = keyName; Permissions = permissions; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Automation key name. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.Serialization.cs index 5fa3942336d9..a92df5ecc876 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationKeyListResult + internal partial class AutomationKeyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationKeyListResult DeserializeAutomationKeyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Keys)) + { + writer.WritePropertyName("keys"u8); + writer.WriteStartArray(); + foreach (var item in Keys) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationKeyListResult DeserializeAutomationKeyListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> keys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keys"u8)) @@ -36,8 +81,61 @@ internal static AutomationKeyListResult DeserializeAutomationKeyListResult(JsonE keys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationKeyListResult(Optional.ToList(keys)); + return new AutomationKeyListResult(Optional.ToList(keys), serializedAdditionalRawData); + } + + AutomationKeyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationKeyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationKeyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationKeyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationKeyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationKeyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationKeyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.cs index 991c97385c15..652876ab3899 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// The AutomationKeyListResult. internal partial class AutomationKeyListResult { - /// Initializes a new instance of AutomationKeyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationKeyListResult() { Keys = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationKeyListResult. + /// Initializes a new instance of . /// Lists the automation keys. - internal AutomationKeyListResult(IReadOnlyList keys) + /// Keeps track of any properties unknown to the library. + internal AutomationKeyListResult(IReadOnlyList keys, Dictionary serializedAdditionalRawData) { Keys = keys; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Lists the automation keys. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.Serialization.cs index 900ef9177e12..7da531d8819c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationKeyVaultProperties : IUtf8JsonSerializable + public partial class AutomationKeyVaultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyvaultUri)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVersion"u8); writer.WriteStringValue(KeyVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationKeyVaultProperties DeserializeAutomationKeyVaultProperties(JsonElement element) + internal static AutomationKeyVaultProperties DeserializeAutomationKeyVaultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static AutomationKeyVaultProperties DeserializeAutomationKeyVaultProper Optional keyvaultUri = default; Optional keyName = default; Optional keyVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyvaultUri"u8)) @@ -64,8 +86,61 @@ internal static AutomationKeyVaultProperties DeserializeAutomationKeyVaultProper keyVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationKeyVaultProperties(keyvaultUri.Value, keyName.Value, keyVersion.Value, serializedAdditionalRawData); + } + + AutomationKeyVaultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationKeyVaultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationKeyVaultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationKeyVaultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationKeyVaultProperties model) + { + if (model is null) + { + return null; } - return new AutomationKeyVaultProperties(keyvaultUri.Value, keyName.Value, keyVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationKeyVaultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationKeyVaultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.cs index eaf0a40db6bd..b8dc17e99a8f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationKeyVaultProperties.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// Settings concerning key vault encryption for a configuration store. public partial class AutomationKeyVaultProperties { - /// Initializes a new instance of AutomationKeyVaultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationKeyVaultProperties() { } - /// Initializes a new instance of AutomationKeyVaultProperties. + /// Initializes a new instance of . /// The URI of the key vault key used to encrypt data. /// The name of key used to encrypt data. /// The key version of the key used to encrypt data. - internal AutomationKeyVaultProperties(Uri keyvaultUri, string keyName, string keyVersion) + /// Keeps track of any properties unknown to the library. + internal AutomationKeyVaultProperties(Uri keyvaultUri, string keyName, string keyVersion, Dictionary serializedAdditionalRawData) { KeyvaultUri = keyvaultUri; KeyName = keyName; KeyVersion = keyVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The URI of the key vault key used to encrypt data. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.Serialization.cs index 66cc9063886f..bd86c50ce392 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationLinkedWorkspace + public partial class AutomationLinkedWorkspace : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationLinkedWorkspace DeserializeAutomationLinkedWorkspace(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationLinkedWorkspace DeserializeAutomationLinkedWorkspace(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -26,8 +55,61 @@ internal static AutomationLinkedWorkspace DeserializeAutomationLinkedWorkspace(J id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationLinkedWorkspace(id.Value); + return new AutomationLinkedWorkspace(id.Value, serializedAdditionalRawData); + } + + AutomationLinkedWorkspace IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationLinkedWorkspace(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationLinkedWorkspace IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationLinkedWorkspace(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationLinkedWorkspace model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationLinkedWorkspace(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationLinkedWorkspace(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.cs index 6e32af4c9f47..f44c52831392 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationLinkedWorkspace.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the linked workspace. public partial class AutomationLinkedWorkspace { - /// Initializes a new instance of AutomationLinkedWorkspace. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationLinkedWorkspace() { } - /// Initializes a new instance of AutomationLinkedWorkspace. + /// Initializes a new instance of . /// Gets the id of the linked workspace. - internal AutomationLinkedWorkspace(string id) + /// Keeps track of any properties unknown to the library. + internal AutomationLinkedWorkspace(string id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the id of the linked workspace. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleData.Serialization.cs index c0bf469f0dd9..1180e4ead7d8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationModuleData : IUtf8JsonSerializable + public partial class AutomationModuleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -68,12 +73,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContentLink)) { writer.WritePropertyName("contentLink"u8); - writer.WriteObjectValue(ContentLink); + if (ContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContentLink).Serialize(writer, options); + } } if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } if (Optional.IsDefined(CreatedOn)) { @@ -96,11 +115,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsComposite.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationModuleData DeserializeAutomationModuleData(JsonElement element) + internal static AutomationModuleData DeserializeAutomationModuleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -123,6 +156,7 @@ internal static AutomationModuleData DeserializeAutomationModuleData(JsonElement Optional lastModifiedTime = default; Optional description = default; Optional isComposite = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -280,8 +314,61 @@ internal static AutomationModuleData DeserializeAutomationModuleData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationModuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(isGlobal), version.Value, Optional.ToNullable(sizeInBytes), Optional.ToNullable(activityCount), Optional.ToNullable(provisioningState), contentLink.Value, error.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, Optional.ToNullable(isComposite), serializedAdditionalRawData); + } + + AutomationModuleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationModuleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationModuleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationModuleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationModuleData model) + { + if (model is null) + { + return null; } - return new AutomationModuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(isGlobal), version.Value, Optional.ToNullable(sizeInBytes), Optional.ToNullable(activityCount), Optional.ToNullable(provisioningState), contentLink.Value, error.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, Optional.ToNullable(isComposite)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationModuleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationModuleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.Serialization.cs index 4753ccb8f1ab..b41c73f71073 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationModuleErrorInfo : IUtf8JsonSerializable + public partial class AutomationModuleErrorInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationModuleErrorInfo DeserializeAutomationModuleErrorInfo(JsonElement element) + internal static AutomationModuleErrorInfo DeserializeAutomationModuleErrorInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -48,8 +71,61 @@ internal static AutomationModuleErrorInfo DeserializeAutomationModuleErrorInfo(J message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationModuleErrorInfo(code.Value, message.Value, serializedAdditionalRawData); + } + + AutomationModuleErrorInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationModuleErrorInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationModuleErrorInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationModuleErrorInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationModuleErrorInfo model) + { + if (model is null) + { + return null; } - return new AutomationModuleErrorInfo(code.Value, message.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationModuleErrorInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationModuleErrorInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.cs index cea325d74b8b..2845aacce037 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleErrorInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the module error info type. public partial class AutomationModuleErrorInfo { - /// Initializes a new instance of AutomationModuleErrorInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationModuleErrorInfo() { } - /// Initializes a new instance of AutomationModuleErrorInfo. + /// Initializes a new instance of . /// Gets or sets the error code. /// Gets or sets the error message. - internal AutomationModuleErrorInfo(string code, string message) + /// Keeps track of any properties unknown to the library. + internal AutomationModuleErrorInfo(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the error code. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.Serialization.cs index b2de51919a1b..28a4b6e033e7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationModuleField + public partial class AutomationModuleField : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationModuleField DeserializeAutomationModuleField(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(FieldType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(FieldType); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationModuleField DeserializeAutomationModuleField(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static AutomationModuleField DeserializeAutomationModuleField(JsonEleme type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationModuleField(name.Value, type.Value); + return new AutomationModuleField(name.Value, type.Value, serializedAdditionalRawData); + } + + AutomationModuleField IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationModuleField(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationModuleField IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationModuleField(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationModuleField model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationModuleField(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationModuleField(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.cs index 4e9cae59eb9e..0e0a27a53497 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleField.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Information about a field of a type. public partial class AutomationModuleField { - /// Initializes a new instance of AutomationModuleField. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationModuleField() { } - /// Initializes a new instance of AutomationModuleField. + /// Initializes a new instance of . /// Gets or sets the name of the field. /// Gets or sets the type of the field. - internal AutomationModuleField(string name, string fieldType) + /// Keeps track of any properties unknown to the library. + internal AutomationModuleField(string name, string fieldType, Dictionary serializedAdditionalRawData) { Name = name; FieldType = fieldType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the field. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.Serialization.cs index 235f393a1b94..76251a63ac13 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationModuleFieldListResult + internal partial class AutomationModuleFieldListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationModuleFieldListResult DeserializeAutomationModuleFieldListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationModuleFieldListResult DeserializeAutomationModuleFieldListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static AutomationModuleFieldListResult DeserializeAutomationModuleField value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationModuleFieldListResult(Optional.ToList(value)); + return new AutomationModuleFieldListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AutomationModuleFieldListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationModuleFieldListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationModuleFieldListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationModuleFieldListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationModuleFieldListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationModuleFieldListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationModuleFieldListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.cs index b19ea62f415a..772e4980fc94 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleFieldListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list fields operation. internal partial class AutomationModuleFieldListResult { - /// Initializes a new instance of AutomationModuleFieldListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationModuleFieldListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationModuleFieldListResult. + /// Initializes a new instance of . /// Gets or sets a list of fields. - internal AutomationModuleFieldListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AutomationModuleFieldListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of fields. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.Serialization.cs index 52db35d94d48..33b9c312013a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationModuleListResult + internal partial class AutomationModuleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationModuleListResult DeserializeAutomationModuleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationModuleListResult DeserializeAutomationModuleListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationModuleListResult DeserializeAutomationModuleListResult nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationModuleListResult(Optional.ToList(value), nextLink.Value); + return new AutomationModuleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationModuleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationModuleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationModuleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationModuleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationModuleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationModuleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationModuleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.cs index c7f61a092bd2..1e9d1e5128c5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationModuleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list module operation. internal partial class AutomationModuleListResult { - /// Initializes a new instance of AutomationModuleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationModuleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationModuleListResult. + /// Initializes a new instance of . /// Gets or sets a list of modules. /// Gets or sets the next link. - internal AutomationModuleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationModuleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of modules. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionData.Serialization.cs index 8a82bfdb67e7..dd83581a7e74 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class AutomationPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -39,14 +46,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationPrivateEndpointConnectionData DeserializeAutomationPrivateEndpointConnectionData(JsonElement element) + internal static AutomationPrivateEndpointConnectionData DeserializeAutomationPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static AutomationPrivateEndpointConnectionData DeserializeAutomationPri Optional privateEndpoint = default; Optional> groupIds = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -128,8 +157,61 @@ internal static AutomationPrivateEndpointConnectionData DeserializeAutomationPri } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + AutomationPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new AutomationPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.Serialization.cs index 1c131a655861..51b0e5833fae 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationPrivateEndpointConnectionListResult + internal partial class AutomationPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationPrivateEndpointConnectionListResult DeserializeAutomationPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationPrivateEndpointConnectionListResult DeserializeAutomationPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static AutomationPrivateEndpointConnectionListResult DeserializeAutomat value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new AutomationPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AutomationPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.cs index 07f94817dbc8..3c99466d3342 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Automation.Models /// A list of private endpoint connections. internal partial class AutomationPrivateEndpointConnectionListResult { - /// Initializes a new instance of AutomationPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal AutomationPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AutomationPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.Serialization.cs index d1d63ef79075..d26b401f42eb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationPrivateLinkResource : IUtf8JsonSerializable + public partial class AutomationPrivateLinkResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationPrivateLinkResource DeserializeAutomationPrivateLinkResource(JsonElement element) + internal static AutomationPrivateLinkResource DeserializeAutomationPrivateLinkResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +56,7 @@ internal static AutomationPrivateLinkResource DeserializeAutomationPrivateLinkRe Optional systemData = default; Optional groupId = default; Optional> requiredMembers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -92,8 +114,61 @@ internal static AutomationPrivateLinkResource DeserializeAutomationPrivateLinkRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationPrivateLinkResource(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), serializedAdditionalRawData); + } + + AutomationPrivateLinkResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationPrivateLinkResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationPrivateLinkResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationPrivateLinkResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationPrivateLinkResource model) + { + if (model is null) + { + return null; } - return new AutomationPrivateLinkResource(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationPrivateLinkResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationPrivateLinkResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.cs index bacafb4bab9d..5531224a3331 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.Automation.Models /// A private link resource. public partial class AutomationPrivateLinkResource : ResourceData { - /// Initializes a new instance of AutomationPrivateLinkResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationPrivateLinkResource() { RequiredMembers = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationPrivateLinkResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The private link resource group id. /// The private link resource required member names. - internal AutomationPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AutomationPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.Serialization.cs index b6ebc4fe92e7..986eef30ce28 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationPrivateLinkResourceListResult + internal partial class AutomationPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationPrivateLinkResourceListResult DeserializeAutomationPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationPrivateLinkResourceListResult DeserializeAutomationPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static AutomationPrivateLinkResourceListResult DeserializeAutomationPri value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationPrivateLinkResourceListResult(Optional.ToList(value)); + return new AutomationPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AutomationPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.cs index 1d73df90b48e..4b4c584bbecf 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// A list of private link resources. internal partial class AutomationPrivateLinkResourceListResult { - /// Initializes a new instance of AutomationPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal AutomationPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AutomationPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.Serialization.cs index ac6e2b2e670e..8c7e1939da3c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationPrivateLinkServiceConnectionStateProperty : IUtf8JsonSerializable + public partial class AutomationPrivateLinkServiceConnectionStateProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationPrivateLinkServiceConnectionStateProperty DeserializeAutomationPrivateLinkServiceConnectionStateProperty(JsonElement element) + internal static AutomationPrivateLinkServiceConnectionStateProperty DeserializeAutomationPrivateLinkServiceConnectionStateProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static AutomationPrivateLinkServiceConnectionStateProperty DeserializeA Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -54,8 +77,61 @@ internal static AutomationPrivateLinkServiceConnectionStateProperty DeserializeA actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationPrivateLinkServiceConnectionStateProperty(status.Value, description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + AutomationPrivateLinkServiceConnectionStateProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationPrivateLinkServiceConnectionStateProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationPrivateLinkServiceConnectionStateProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationPrivateLinkServiceConnectionStateProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationPrivateLinkServiceConnectionStateProperty model) + { + if (model is null) + { + return null; } - return new AutomationPrivateLinkServiceConnectionStateProperty(status.Value, description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationPrivateLinkServiceConnectionStateProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationPrivateLinkServiceConnectionStateProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.cs index 1e2fab642c47..b2e74ce250de 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationPrivateLinkServiceConnectionStateProperty.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Connection State of the Private Endpoint Connection. public partial class AutomationPrivateLinkServiceConnectionStateProperty { - /// Initializes a new instance of AutomationPrivateLinkServiceConnectionStateProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationPrivateLinkServiceConnectionStateProperty() { } - /// Initializes a new instance of AutomationPrivateLinkServiceConnectionStateProperty. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). - internal AutomationPrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal AutomationPrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link service connection status. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.Serialization.cs index 7d58a16a69f2..632b358b1c2e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationResponseError : IUtf8JsonSerializable + public partial class AutomationResponseError : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationResponseError DeserializeAutomationResponseError(JsonElement element) + internal static AutomationResponseError DeserializeAutomationResponseError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -48,8 +71,61 @@ internal static AutomationResponseError DeserializeAutomationResponseError(JsonE message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationResponseError(code.Value, message.Value, serializedAdditionalRawData); + } + + AutomationResponseError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationResponseError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationResponseError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationResponseError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationResponseError model) + { + if (model is null) + { + return null; } - return new AutomationResponseError(code.Value, message.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationResponseError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationResponseError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.cs index ded494bd1453..8bc324e76fdb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationResponseError.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Error response of an operation failure. public partial class AutomationResponseError { - /// Initializes a new instance of AutomationResponseError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationResponseError() { } - /// Initializes a new instance of AutomationResponseError. + /// Initializes a new instance of . /// Error code. /// Error message indicating why the operation failed. - internal AutomationResponseError(string code, string message) + /// Keeps track of any properties unknown to the library. + internal AutomationResponseError(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.Serialization.cs index d7d869125f33..af52be343c6b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationRunbookCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationRunbookCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -53,12 +61,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Draft)) { writer.WritePropertyName("draft"u8); - writer.WriteObjectValue(Draft); + if (Draft is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Draft).Serialize(writer, options); + } } if (Optional.IsDefined(PublishContentLink)) { writer.WritePropertyName("publishContentLink"u8); - writer.WriteObjectValue(PublishContentLink); + if (PublishContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublishContentLink).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -71,7 +93,192 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(LogActivityTrace.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationRunbookCreateOrUpdateContent DeserializeAutomationRunbookCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional> tags = default; + Optional logVerbose = default; + Optional logProgress = default; + AutomationRunbookType runbookType = default; + Optional draft = default; + Optional publishContentLink = default; + Optional description = default; + Optional logActivityTrace = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("logVerbose"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logVerbose = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("logProgress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logProgress = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("runbookType"u8)) + { + runbookType = new AutomationRunbookType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("draft"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + draft = AutomationRunbookDraft.DeserializeAutomationRunbookDraft(property0.Value); + continue; + } + if (property0.NameEquals("publishContentLink"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publishContentLink = AutomationContentLink.DeserializeAutomationContentLink(property0.Value); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("logActivityTrace"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logActivityTrace = property0.Value.GetInt32(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationRunbookCreateOrUpdateContent(name.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToNullable(logVerbose), Optional.ToNullable(logProgress), runbookType, draft.Value, publishContentLink.Value, description.Value, Optional.ToNullable(logActivityTrace), serializedAdditionalRawData); + } + + AutomationRunbookCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationRunbookCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationRunbookCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationRunbookCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationRunbookCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationRunbookCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationRunbookCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.cs index f8012b028697..b3ee4276a407 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update runbook operation. public partial class AutomationRunbookCreateOrUpdateContent { - /// Initializes a new instance of AutomationRunbookCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the type of the runbook. public AutomationRunbookCreateOrUpdateContent(AutomationRunbookType runbookType) { @@ -21,6 +25,38 @@ public AutomationRunbookCreateOrUpdateContent(AutomationRunbookType runbookType) RunbookType = runbookType; } + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets verbose log option. + /// Gets or sets progress log option. + /// Gets or sets the type of the runbook. + /// Gets or sets the draft runbook properties. + /// Gets or sets the published runbook content link. + /// Gets or sets the description of the runbook. + /// Gets or sets the activity-level tracing options of the runbook. + /// Keeps track of any properties unknown to the library. + internal AutomationRunbookCreateOrUpdateContent(string name, AzureLocation? location, IDictionary tags, bool? isLogVerboseEnabled, bool? isLogProgressEnabled, AutomationRunbookType runbookType, AutomationRunbookDraft draft, AutomationContentLink publishContentLink, string description, int? logActivityTrace, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Tags = tags; + IsLogVerboseEnabled = isLogVerboseEnabled; + IsLogProgressEnabled = isLogProgressEnabled; + RunbookType = runbookType; + Draft = draft; + PublishContentLink = publishContentLink; + Description = description; + LogActivityTrace = logActivityTrace; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationRunbookCreateOrUpdateContent() + { + } + /// Gets or sets the name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookData.Serialization.cs index b4c74331395e..db24a9cfa077 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationRunbookData : IUtf8JsonSerializable + public partial class AutomationRunbookData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -48,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublishContentLink)) { writer.WritePropertyName("publishContentLink"u8); - writer.WriteObjectValue(PublishContentLink); + if (PublishContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublishContentLink).Serialize(writer, options); + } } if (Optional.IsDefined(State)) { @@ -82,7 +94,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -99,7 +118,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Draft)) { writer.WritePropertyName("draft"u8); - writer.WriteObjectValue(Draft); + if (Draft is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Draft).Serialize(writer, options); + } } if (Optional.IsDefined(ProvisioningState)) { @@ -127,11 +153,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationRunbookData DeserializeAutomationRunbookData(JsonElement element) + internal static AutomationRunbookData DeserializeAutomationRunbookData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,6 +198,7 @@ internal static AutomationRunbookData DeserializeAutomationRunbookData(JsonEleme Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -361,8 +402,61 @@ internal static AutomationRunbookData DeserializeAutomationRunbookData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationRunbookData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(runbookType), publishContentLink.Value, Optional.ToNullable(state), Optional.ToNullable(logVerbose), Optional.ToNullable(logProgress), Optional.ToNullable(logActivityTrace), Optional.ToNullable(jobCount), Optional.ToDictionary(parameters), Optional.ToList(outputTypes), draft.Value, Optional.ToNullable(provisioningState), lastModifiedBy.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationRunbookData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationRunbookData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationRunbookData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationRunbookData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationRunbookData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationRunbookData(Response response) + { + if (response is null) + { + return null; } - return new AutomationRunbookData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(runbookType), publishContentLink.Value, Optional.ToNullable(state), Optional.ToNullable(logVerbose), Optional.ToNullable(logProgress), Optional.ToNullable(logActivityTrace), Optional.ToNullable(jobCount), Optional.ToDictionary(parameters), Optional.ToList(outputTypes), draft.Value, Optional.ToNullable(provisioningState), lastModifiedBy.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationRunbookData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.Serialization.cs index ace527a23cf2..578b0f42547c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationRunbookDraft : IUtf8JsonSerializable + public partial class AutomationRunbookDraft : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsInEditMode)) { @@ -25,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DraftContentLink)) { writer.WritePropertyName("draftContentLink"u8); - writer.WriteObjectValue(DraftContentLink); + if (DraftContentLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DraftContentLink).Serialize(writer, options); + } } if (Optional.IsDefined(CreatedOn)) { @@ -44,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -58,11 +78,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationRunbookDraft DeserializeAutomationRunbookDraft(JsonElement element) + internal static AutomationRunbookDraft DeserializeAutomationRunbookDraft(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +107,7 @@ internal static AutomationRunbookDraft DeserializeAutomationRunbookDraft(JsonEle Optional lastModifiedTime = default; Optional> parameters = default; Optional> outputTypes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inEdit"u8)) @@ -139,8 +174,61 @@ internal static AutomationRunbookDraft DeserializeAutomationRunbookDraft(JsonEle outputTypes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationRunbookDraft(Optional.ToNullable(inEdit), draftContentLink.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), Optional.ToDictionary(parameters), Optional.ToList(outputTypes), serializedAdditionalRawData); + } + + AutomationRunbookDraft IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationRunbookDraft(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationRunbookDraft IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationRunbookDraft(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationRunbookDraft model) + { + if (model is null) + { + return null; } - return new AutomationRunbookDraft(Optional.ToNullable(inEdit), draftContentLink.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), Optional.ToDictionary(parameters), Optional.ToList(outputTypes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationRunbookDraft(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationRunbookDraft(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.cs index 0aea8744bf47..74ef5836d7c2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookDraft.cs @@ -14,21 +14,25 @@ namespace Azure.ResourceManager.Automation.Models /// The AutomationRunbookDraft. public partial class AutomationRunbookDraft { - /// Initializes a new instance of AutomationRunbookDraft. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationRunbookDraft() { Parameters = new ChangeTrackingDictionary(); OutputTypes = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationRunbookDraft. + /// Initializes a new instance of . /// Gets or sets whether runbook is in edit mode. /// Gets or sets the draft runbook content link. /// Gets or sets the creation time of the runbook draft. /// Gets or sets the last modified time of the runbook draft. /// Gets or sets the runbook draft parameters. /// Gets or sets the runbook output types. - internal AutomationRunbookDraft(bool? isInEditMode, AutomationContentLink draftContentLink, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, IDictionary parameters, IList outputTypes) + /// Keeps track of any properties unknown to the library. + internal AutomationRunbookDraft(bool? isInEditMode, AutomationContentLink draftContentLink, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, IDictionary parameters, IList outputTypes, Dictionary serializedAdditionalRawData) { IsInEditMode = isInEditMode; DraftContentLink = draftContentLink; @@ -36,6 +40,7 @@ internal AutomationRunbookDraft(bool? isInEditMode, AutomationContentLink draftC LastModifiedOn = lastModifiedOn; Parameters = parameters; OutputTypes = outputTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets whether runbook is in edit mode. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.Serialization.cs index aa6eaaeae800..6c977657d6ac 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationRunbookListResult + internal partial class AutomationRunbookListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationRunbookListResult DeserializeAutomationRunbookListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationRunbookListResult DeserializeAutomationRunbookListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationRunbookListResult DeserializeAutomationRunbookListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationRunbookListResult(Optional.ToList(value), nextLink.Value); + return new AutomationRunbookListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationRunbookListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationRunbookListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationRunbookListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationRunbookListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationRunbookListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationRunbookListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationRunbookListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.cs index 8de623cf79db..e73aabbea438 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list runbook operation. internal partial class AutomationRunbookListResult { - /// Initializes a new instance of AutomationRunbookListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationRunbookListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationRunbookListResult. + /// Initializes a new instance of . /// Gets or sets a list of runbooks. /// Gets or sets the next link. - internal AutomationRunbookListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationRunbookListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of runbooks. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.Serialization.cs index 4ae33b60abac..730736221d91 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationRunbookPatch : IUtf8JsonSerializable + public partial class AutomationRunbookPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -59,7 +67,166 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(LogActivityTrace.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationRunbookPatch DeserializeAutomationRunbookPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional> tags = default; + Optional description = default; + Optional logVerbose = default; + Optional logProgress = default; + Optional logActivityTrace = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("logVerbose"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logVerbose = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("logProgress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logProgress = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("logActivityTrace"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logActivityTrace = property0.Value.GetInt32(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationRunbookPatch(name.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), description.Value, Optional.ToNullable(logVerbose), Optional.ToNullable(logProgress), Optional.ToNullable(logActivityTrace), serializedAdditionalRawData); + } + + AutomationRunbookPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationRunbookPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationRunbookPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationRunbookPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationRunbookPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationRunbookPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationRunbookPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.cs index 9ceb493997f6..3a45a96f9676 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationRunbookPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,36 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the update runbook operation. public partial class AutomationRunbookPatch { - /// Initializes a new instance of AutomationRunbookPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationRunbookPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the description of the runbook. + /// Gets or sets verbose log option. + /// Gets or sets progress log option. + /// Gets or sets the activity-level tracing options of the runbook. + /// Keeps track of any properties unknown to the library. + internal AutomationRunbookPatch(string name, AzureLocation? location, IDictionary tags, string description, bool? isLogVerboseEnabled, bool? isLogProgressEnabled, int? logActivityTrace, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Tags = tags; + Description = description; + IsLogVerboseEnabled = isLogVerboseEnabled; + IsLogProgressEnabled = isLogProgressEnabled; + LogActivityTrace = logActivityTrace; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.Serialization.cs index b235a7264ffa..0ba4a2e27880 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationScheduleCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationScheduleCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -57,10 +65,170 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdvancedSchedule)) { writer.WritePropertyName("advancedSchedule"u8); - writer.WriteObjectValue(AdvancedSchedule); + if (AdvancedSchedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdvancedSchedule).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationScheduleCreateOrUpdateContent DeserializeAutomationScheduleCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional description = default; + DateTimeOffset startTime = default; + Optional expiryTime = default; + Optional interval = default; + AutomationScheduleFrequency frequency = default; + Optional timeZone = default; + Optional advancedSchedule = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("startTime"u8)) + { + startTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("expiryTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + expiryTime = null; + continue; + } + expiryTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("interval"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interval = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("frequency"u8)) + { + frequency = new AutomationScheduleFrequency(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("timeZone"u8)) + { + timeZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("advancedSchedule"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + advancedSchedule = AutomationAdvancedSchedule.DeserializeAutomationAdvancedSchedule(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationScheduleCreateOrUpdateContent(name, description.Value, startTime, Optional.ToNullable(expiryTime), interval.Value, frequency, timeZone.Value, advancedSchedule.Value, serializedAdditionalRawData); + } + + AutomationScheduleCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationScheduleCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationScheduleCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationScheduleCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationScheduleCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationScheduleCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationScheduleCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.cs index 11275292f29a..363124958f28 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update schedule operation. public partial class AutomationScheduleCreateOrUpdateContent { - /// Initializes a new instance of AutomationScheduleCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the Schedule. /// Gets or sets the start time of the schedule. /// Gets or sets the frequency of the schedule. @@ -27,6 +31,34 @@ public AutomationScheduleCreateOrUpdateContent(string name, DateTimeOffset start Frequency = frequency; } + /// Initializes a new instance of . + /// Gets or sets the name of the Schedule. + /// Gets or sets the description of the schedule. + /// Gets or sets the start time of the schedule. + /// Gets or sets the end time of the schedule. + /// Gets or sets the interval of the schedule. + /// Gets or sets the frequency of the schedule. + /// Gets or sets the time zone of the schedule. + /// Gets or sets the AdvancedSchedule. + /// Keeps track of any properties unknown to the library. + internal AutomationScheduleCreateOrUpdateContent(string name, string description, DateTimeOffset startOn, DateTimeOffset? expireOn, BinaryData interval, AutomationScheduleFrequency frequency, string timeZone, AutomationAdvancedSchedule advancedSchedule, Dictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + StartOn = startOn; + ExpireOn = expireOn; + Interval = interval; + Frequency = frequency; + TimeZone = timeZone; + AdvancedSchedule = advancedSchedule; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationScheduleCreateOrUpdateContent() + { + } + /// Gets or sets the name of the Schedule. public string Name { get; } /// Gets or sets the description of the schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleData.Serialization.cs index 98c6cee577f9..713bca71960a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationScheduleData : IUtf8JsonSerializable + public partial class AutomationScheduleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -86,7 +93,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdvancedSchedule)) { writer.WritePropertyName("advancedSchedule"u8); - writer.WriteObjectValue(AdvancedSchedule); + if (AdvancedSchedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdvancedSchedule).Serialize(writer, options); + } } if (Optional.IsDefined(CreatedOn)) { @@ -104,11 +118,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationScheduleData DeserializeAutomationScheduleData(JsonElement element) + internal static AutomationScheduleData DeserializeAutomationScheduleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -131,6 +159,7 @@ internal static AutomationScheduleData DeserializeAutomationScheduleData(JsonEle Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -289,8 +318,61 @@ internal static AutomationScheduleData DeserializeAutomationScheduleData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationScheduleData(id, name, type, systemData.Value, Optional.ToNullable(startTime), Optional.ToNullable(startTimeOffsetMinutes), Optional.ToNullable(expiryTime), Optional.ToNullable(expiryTimeOffsetMinutes), Optional.ToNullable(isEnabled), Optional.ToNullable(nextRun), Optional.ToNullable(nextRunOffsetMinutes), interval.Value, Optional.ToNullable(frequency), timeZone.Value, advancedSchedule.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationScheduleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationScheduleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationScheduleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationScheduleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationScheduleData model) + { + if (model is null) + { + return null; } - return new AutomationScheduleData(id, name, type, systemData.Value, Optional.ToNullable(startTime), Optional.ToNullable(startTimeOffsetMinutes), Optional.ToNullable(expiryTime), Optional.ToNullable(expiryTimeOffsetMinutes), Optional.ToNullable(isEnabled), Optional.ToNullable(nextRun), Optional.ToNullable(nextRunOffsetMinutes), interval.Value, Optional.ToNullable(frequency), timeZone.Value, advancedSchedule.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationScheduleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationScheduleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.Serialization.cs index 73cafd4e2997..54c7bdbe9893 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationScheduleListResult + internal partial class AutomationScheduleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationScheduleListResult DeserializeAutomationScheduleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationScheduleListResult DeserializeAutomationScheduleListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationScheduleListResult DeserializeAutomationScheduleListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationScheduleListResult(Optional.ToList(value), nextLink.Value); + return new AutomationScheduleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationScheduleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationScheduleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationScheduleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationScheduleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationScheduleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationScheduleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationScheduleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.cs index 67670c04c93e..5ee9f5a83882 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationScheduleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list schedule operation. internal partial class AutomationScheduleListResult { - /// Initializes a new instance of AutomationScheduleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationScheduleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationScheduleListResult. + /// Initializes a new instance of . /// Gets or sets a list of schedules. /// Gets or sets the next link. - internal AutomationScheduleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationScheduleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of schedules. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.Serialization.cs index 834aee072b6f..0db3a0eddcf1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationSchedulePatch : IUtf8JsonSerializable + public partial class AutomationSchedulePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -33,7 +41,121 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationSchedulePatch DeserializeAutomationSchedulePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional description = default; + Optional isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEnabled = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationSchedulePatch(name.Value, description.Value, Optional.ToNullable(isEnabled), serializedAdditionalRawData); + } + + AutomationSchedulePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationSchedulePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationSchedulePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationSchedulePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationSchedulePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationSchedulePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationSchedulePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.cs index fef45ab1cdce..1799fc8cf8e6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSchedulePatch.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the update schedule operation. public partial class AutomationSchedulePatch { - /// Initializes a new instance of AutomationSchedulePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationSchedulePatch() { } + /// Initializes a new instance of . + /// Gets or sets the name of the Schedule. + /// Gets or sets the description of the schedule. + /// Gets or sets a value indicating whether this schedule is enabled. + /// Keeps track of any properties unknown to the library. + internal AutomationSchedulePatch(string name, string description, bool? isEnabled, Dictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the Schedule. public string Name { get; set; } /// Gets or sets the description of the schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.Serialization.cs index 7c86f098f2ce..143ede64624c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationSku : IUtf8JsonSerializable + public partial class AutomationSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationSku DeserializeAutomationSku(JsonElement element) + internal static AutomationSku DeserializeAutomationSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static AutomationSku DeserializeAutomationSku(JsonElement element) AutomationSkuName name = default; Optional family = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -60,8 +83,61 @@ internal static AutomationSku DeserializeAutomationSku(JsonElement element) capacity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationSku(name, family.Value, Optional.ToNullable(capacity), serializedAdditionalRawData); + } + + AutomationSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationSku model) + { + if (model is null) + { + return null; } - return new AutomationSku(name, family.Value, Optional.ToNullable(capacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.cs index 0cb829937fb8..6a6176f5597a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSku.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The account SKU. public partial class AutomationSku { - /// Initializes a new instance of AutomationSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the SKU name of the account. public AutomationSku(AutomationSkuName name) { Name = name; } - /// Initializes a new instance of AutomationSku. + /// Initializes a new instance of . /// Gets or sets the SKU name of the account. /// Gets or sets the SKU family. /// Gets or sets the SKU capacity. - internal AutomationSku(AutomationSkuName name, string family, int? capacity) + /// Keeps track of any properties unknown to the library. + internal AutomationSku(AutomationSkuName name, string family, int? capacity, Dictionary serializedAdditionalRawData) { Name = name; Family = family; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationSku() + { } /// Gets or sets the SKU name of the account. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.Serialization.cs index 52ab1993b18e..c7184e518983 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationSourceControlCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationSourceControlCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -50,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityToken)) { writer.WritePropertyName("securityToken"u8); - writer.WriteObjectValue(SecurityToken); + if (SecurityToken is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityToken).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -58,7 +73,167 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationSourceControlCreateOrUpdateContent DeserializeAutomationSourceControlCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional repoUrl = default; + Optional branch = default; + Optional folderPath = default; + Optional autoSync = default; + Optional publishRunbook = default; + Optional sourceType = default; + Optional securityToken = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("repoUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + repoUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("branch"u8)) + { + branch = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("folderPath"u8)) + { + folderPath = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("autoSync"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoSync = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publishRunbook"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publishRunbook = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("sourceType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceType = new SourceControlSourceType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("securityToken"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityToken = SourceControlSecurityTokenProperties.DeserializeSourceControlSecurityTokenProperties(property0.Value); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationSourceControlCreateOrUpdateContent(repoUrl.Value, branch.Value, folderPath.Value, Optional.ToNullable(autoSync), Optional.ToNullable(publishRunbook), Optional.ToNullable(sourceType), securityToken.Value, description.Value, serializedAdditionalRawData); + } + + AutomationSourceControlCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationSourceControlCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationSourceControlCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationSourceControlCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationSourceControlCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationSourceControlCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationSourceControlCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.cs index f62de7f7e80c..885adfcbe9db 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlCreateOrUpdateContent.cs @@ -6,17 +6,44 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the create or update source control operation. public partial class AutomationSourceControlCreateOrUpdateContent { - /// Initializes a new instance of AutomationSourceControlCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationSourceControlCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// The repo url of the source control. + /// The repo branch of the source control. Include branch as empty string for VsoTfvc. + /// The folder path of the source control. Path must be relative. + /// The auto async of the source control. Default is false. + /// The auto publish of the source control. Default is true. + /// The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive. + /// The authorization token for the repo of the source control. + /// The user description of the source control. + /// Keeps track of any properties unknown to the library. + internal AutomationSourceControlCreateOrUpdateContent(Uri repoUri, string branch, string folderPath, bool? isAutoSyncEnabled, bool? isAutoPublishRunbookEnabled, SourceControlSourceType? sourceType, SourceControlSecurityTokenProperties securityToken, string description, Dictionary serializedAdditionalRawData) + { + RepoUri = repoUri; + Branch = branch; + FolderPath = folderPath; + IsAutoSyncEnabled = isAutoSyncEnabled; + IsAutoPublishRunbookEnabled = isAutoPublishRunbookEnabled; + SourceType = sourceType; + SecurityToken = securityToken; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The repo url of the source control. public Uri RepoUri { get; set; } /// The repo branch of the source control. Include branch as empty string for VsoTfvc. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlData.Serialization.cs index 3a04cda27e13..fb59c99ec241 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationSourceControlData : IUtf8JsonSerializable + public partial class AutomationSourceControlData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -66,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LastModifiedOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationSourceControlData DeserializeAutomationSourceControlData(JsonElement element) + internal static AutomationSourceControlData DeserializeAutomationSourceControlData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -88,6 +109,7 @@ internal static AutomationSourceControlData DeserializeAutomationSourceControlDa Optional description = default; Optional creationTime = default; Optional lastModifiedTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -195,8 +217,61 @@ internal static AutomationSourceControlData DeserializeAutomationSourceControlDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationSourceControlData(id, name, type, systemData.Value, repoUrl.Value, branch.Value, folderPath.Value, Optional.ToNullable(autoSync), Optional.ToNullable(publishRunbook), Optional.ToNullable(sourceType), description.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), serializedAdditionalRawData); + } + + AutomationSourceControlData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationSourceControlData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationSourceControlData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationSourceControlData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationSourceControlData model) + { + if (model is null) + { + return null; } - return new AutomationSourceControlData(id, name, type, systemData.Value, repoUrl.Value, branch.Value, folderPath.Value, Optional.ToNullable(autoSync), Optional.ToNullable(publishRunbook), Optional.ToNullable(sourceType), description.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationSourceControlData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationSourceControlData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.Serialization.cs index 7d2cdb497f9f..679368e18f84 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationSourceControlListResult + internal partial class AutomationSourceControlListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationSourceControlListResult DeserializeAutomationSourceControlListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationSourceControlListResult DeserializeAutomationSourceControlListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationSourceControlListResult DeserializeAutomationSourceCon nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationSourceControlListResult(Optional.ToList(value), nextLink.Value); + return new AutomationSourceControlListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationSourceControlListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationSourceControlListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationSourceControlListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationSourceControlListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationSourceControlListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationSourceControlListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationSourceControlListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.cs index 2d740f18e25a..5b4930e87d0b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list source controls operation. internal partial class AutomationSourceControlListResult { - /// Initializes a new instance of AutomationSourceControlListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationSourceControlListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationSourceControlListResult. + /// Initializes a new instance of . /// The list of source controls. /// The next link. - internal AutomationSourceControlListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationSourceControlListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of source controls. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.Serialization.cs index 92d5770f2c94..5c6c9887d094 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationSourceControlPatch : IUtf8JsonSerializable + public partial class AutomationSourceControlPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -40,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityToken)) { writer.WritePropertyName("securityToken"u8); - writer.WriteObjectValue(SecurityToken); + if (SecurityToken is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityToken).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -48,7 +63,147 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationSourceControlPatch DeserializeAutomationSourceControlPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional branch = default; + Optional folderPath = default; + Optional autoSync = default; + Optional publishRunbook = default; + Optional securityToken = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("branch"u8)) + { + branch = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("folderPath"u8)) + { + folderPath = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("autoSync"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoSync = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publishRunbook"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publishRunbook = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("securityToken"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityToken = SourceControlSecurityTokenProperties.DeserializeSourceControlSecurityTokenProperties(property0.Value); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationSourceControlPatch(branch.Value, folderPath.Value, Optional.ToNullable(autoSync), Optional.ToNullable(publishRunbook), securityToken.Value, description.Value, serializedAdditionalRawData); + } + + AutomationSourceControlPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationSourceControlPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationSourceControlPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationSourceControlPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationSourceControlPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationSourceControlPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationSourceControlPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.cs index 4cec72a0af7f..2d925d930f73 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationSourceControlPatch.cs @@ -5,16 +5,41 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the update source control operation. public partial class AutomationSourceControlPatch { - /// Initializes a new instance of AutomationSourceControlPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationSourceControlPatch() { } + /// Initializes a new instance of . + /// The repo branch of the source control. + /// The folder path of the source control. Path must be relative. + /// The auto sync of the source control. Default is false. + /// The auto publish of the source control. Default is true. + /// The authorization token for the repo of the source control. + /// The user description of the source control. + /// Keeps track of any properties unknown to the library. + internal AutomationSourceControlPatch(string branch, string folderPath, bool? isAutoSyncEnabled, bool? isAutoPublishRunbookEnabled, SourceControlSecurityTokenProperties securityToken, string description, Dictionary serializedAdditionalRawData) + { + Branch = branch; + FolderPath = folderPath; + IsAutoSyncEnabled = isAutoSyncEnabled; + IsAutoPublishRunbookEnabled = isAutoPublishRunbookEnabled; + SecurityToken = securityToken; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The repo branch of the source control. public string Branch { get; set; } /// The folder path of the source control. Path must be relative. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.Serialization.cs index aa3e0d6a6a74..c3fa3bc217c4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.Serialization.cs @@ -5,15 +5,80 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationUsage + public partial class AutomationUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationUsage DeserializeAutomationUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + if (Name is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Name).Serialize(writer, options); + } + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (Optional.IsDefined(CurrentValue)) + { + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue.Value); + } + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(ThrottleStatus)) + { + writer.WritePropertyName("throttleStatus"u8); + writer.WriteStringValue(ThrottleStatus); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationUsage DeserializeAutomationUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +89,7 @@ internal static AutomationUsage DeserializeAutomationUsage(JsonElement element) Optional currentValue = default; Optional limit = default; Optional throttleStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -68,8 +134,61 @@ internal static AutomationUsage DeserializeAutomationUsage(JsonElement element) throttleStatus = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationUsage(id.Value, name.Value, unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), throttleStatus.Value); + return new AutomationUsage(id.Value, name.Value, unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), throttleStatus.Value, serializedAdditionalRawData); + } + + AutomationUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.cs index 95b58cd6503e..d0f8381c7f92 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsage.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of Usage. public partial class AutomationUsage { - /// Initializes a new instance of AutomationUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationUsage() { } - /// Initializes a new instance of AutomationUsage. + /// Initializes a new instance of . /// Gets or sets the id of the resource. /// Gets or sets the usage counter name. /// Gets or sets the usage unit name. /// Gets or sets the current usage value. /// Gets or sets max limit. -1 for unlimited. /// Gets or sets the throttle status. - internal AutomationUsage(string id, AutomationUsageCounterName name, string unit, double? currentValue, long? limit, string throttleStatus) + /// Keeps track of any properties unknown to the library. + internal AutomationUsage(string id, AutomationUsageCounterName name, string unit, double? currentValue, long? limit, string throttleStatus, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -30,6 +37,7 @@ internal AutomationUsage(string id, AutomationUsageCounterName name, string unit CurrentValue = currentValue; Limit = limit; ThrottleStatus = throttleStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the id of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.Serialization.cs index 1a4403984692..eb3883fc81a1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationUsageCounterName + public partial class AutomationUsageCounterName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationUsageCounterName DeserializeAutomationUsageCounterName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationUsageCounterName DeserializeAutomationUsageCounterName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional localizedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +71,61 @@ internal static AutomationUsageCounterName DeserializeAutomationUsageCounterName localizedValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationUsageCounterName(value.Value, localizedValue.Value); + return new AutomationUsageCounterName(value.Value, localizedValue.Value, serializedAdditionalRawData); + } + + AutomationUsageCounterName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationUsageCounterName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationUsageCounterName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationUsageCounterName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationUsageCounterName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationUsageCounterName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationUsageCounterName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.cs index 83999272e8ea..153c8cbe9af4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageCounterName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of usage counter name. public partial class AutomationUsageCounterName { - /// Initializes a new instance of AutomationUsageCounterName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationUsageCounterName() { } - /// Initializes a new instance of AutomationUsageCounterName. + /// Initializes a new instance of . /// Gets or sets the usage counter name. /// Gets or sets the localized usage counter name. - internal AutomationUsageCounterName(string value, string localizedValue) + /// Keeps track of any properties unknown to the library. + internal AutomationUsageCounterName(string value, string localizedValue, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the usage counter name. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.Serialization.cs index e66d07adb74f..34dcbdee5eb9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationUsageListResult + internal partial class AutomationUsageListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationUsageListResult DeserializeAutomationUsageListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationUsageListResult DeserializeAutomationUsageListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static AutomationUsageListResult DeserializeAutomationUsageListResult(J value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationUsageListResult(Optional.ToList(value)); + return new AutomationUsageListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AutomationUsageListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationUsageListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationUsageListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationUsageListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationUsageListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationUsageListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationUsageListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.cs index 9d4da31930f2..933f85ef3a92 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationUsageListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the get usage operation. internal partial class AutomationUsageListResult { - /// Initializes a new instance of AutomationUsageListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationUsageListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationUsageListResult. + /// Initializes a new instance of . /// Gets or sets usage. - internal AutomationUsageListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AutomationUsageListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets usage. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.Serialization.cs index e25939c568b0..6452ba14e4f6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationVariableCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationVariableCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -35,7 +43,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsEncrypted.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationVariableCreateOrUpdateContent DeserializeAutomationVariableCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional value = default; + Optional description = default; + Optional isEncrypted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isEncrypted"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEncrypted = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationVariableCreateOrUpdateContent(name, value.Value, description.Value, Optional.ToNullable(isEncrypted), serializedAdditionalRawData); + } + + AutomationVariableCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationVariableCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationVariableCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationVariableCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationVariableCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationVariableCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationVariableCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.cs index 9eb743cc9895..7790ac725420 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update variable operation. public partial class AutomationVariableCreateOrUpdateContent { - /// Initializes a new instance of AutomationVariableCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the variable. /// is null. public AutomationVariableCreateOrUpdateContent(string name) @@ -23,6 +27,26 @@ public AutomationVariableCreateOrUpdateContent(string name) Name = name; } + /// Initializes a new instance of . + /// Gets or sets the name of the variable. + /// Gets or sets the value of the variable. + /// Gets or sets the description of the variable. + /// Gets or sets the encrypted flag of the variable. + /// Keeps track of any properties unknown to the library. + internal AutomationVariableCreateOrUpdateContent(string name, string value, string description, bool? isEncrypted, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + Description = description; + IsEncrypted = isEncrypted; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationVariableCreateOrUpdateContent() + { + } + /// Gets or sets the name of the variable. public string Name { get; } /// Gets or sets the value of the variable. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableData.Serialization.cs index 6572456f923e..d71a23a45c56 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationVariableData : IUtf8JsonSerializable + public partial class AutomationVariableData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -52,11 +59,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationVariableData DeserializeAutomationVariableData(JsonElement element) + internal static AutomationVariableData DeserializeAutomationVariableData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +91,7 @@ internal static AutomationVariableData DeserializeAutomationVariableData(JsonEle Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -146,8 +168,61 @@ internal static AutomationVariableData DeserializeAutomationVariableData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationVariableData(id, name, type, systemData.Value, value.Value, Optional.ToNullable(isEncrypted), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + AutomationVariableData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationVariableData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationVariableData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationVariableData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationVariableData model) + { + if (model is null) + { + return null; } - return new AutomationVariableData(id, name, type, systemData.Value, value.Value, Optional.ToNullable(isEncrypted), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationVariableData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationVariableData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.Serialization.cs index e37ae83e6fec..455d2ddefcfe 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationVariableListResult + internal partial class AutomationVariableListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationVariableListResult DeserializeAutomationVariableListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationVariableListResult DeserializeAutomationVariableListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationVariableListResult DeserializeAutomationVariableListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationVariableListResult(Optional.ToList(value), nextLink.Value); + return new AutomationVariableListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationVariableListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationVariableListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationVariableListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationVariableListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationVariableListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationVariableListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationVariableListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.cs index eb5ccc5e75c8..f280fec471af 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariableListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list variables operation. internal partial class AutomationVariableListResult { - /// Initializes a new instance of AutomationVariableListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationVariableListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationVariableListResult. + /// Initializes a new instance of . /// Gets or sets a list of variables. /// Gets or sets the next link. - internal AutomationVariableListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationVariableListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of variables. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.Serialization.cs index 20ad8b2eed5a..253cd0eacdfe 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationVariablePatch : IUtf8JsonSerializable + public partial class AutomationVariablePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -33,7 +41,117 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationVariablePatch DeserializeAutomationVariablePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional value = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationVariablePatch(name.Value, value.Value, description.Value, serializedAdditionalRawData); + } + + AutomationVariablePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationVariablePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationVariablePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationVariablePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationVariablePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationVariablePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationVariablePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.cs index b1194efc064e..67f992e74e2b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationVariablePatch.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the update variable operation. public partial class AutomationVariablePatch { - /// Initializes a new instance of AutomationVariablePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationVariablePatch() { } + /// Initializes a new instance of . + /// Gets or sets the name of the variable. + /// Gets or sets the value of the variable. + /// Gets or sets the description of the variable. + /// Keeps track of any properties unknown to the library. + internal AutomationVariablePatch(string name, string value, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the variable. public string Name { get; set; } /// Gets or sets the value of the variable. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherData.Serialization.cs index 9607d7aed475..7fdf49e289ed 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherData.Serialization.cs @@ -10,14 +10,19 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationWatcherData : IUtf8JsonSerializable + public partial class AutomationWatcherData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -71,11 +76,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationWatcherData DeserializeAutomationWatcherData(JsonElement element) + internal static AutomationWatcherData DeserializeAutomationWatcherData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -96,6 +115,7 @@ internal static AutomationWatcherData DeserializeAutomationWatcherData(JsonEleme Optional lastModifiedTime = default; Optional lastModifiedBy = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -228,8 +248,61 @@ internal static AutomationWatcherData DeserializeAutomationWatcherData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationWatcherData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(executionFrequencyInSeconds), scriptName.Value, Optional.ToDictionary(scriptParameters), scriptRunOn.Value, status.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, description.Value, serializedAdditionalRawData); + } + + AutomationWatcherData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWatcherData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWatcherData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWatcherData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWatcherData model) + { + if (model is null) + { + return null; } - return new AutomationWatcherData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(executionFrequencyInSeconds), scriptName.Value, Optional.ToDictionary(scriptParameters), scriptRunOn.Value, status.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWatcherData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWatcherData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.Serialization.cs index 36f520abfeed..af410afb0f61 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationWatcherListResult + internal partial class AutomationWatcherListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationWatcherListResult DeserializeAutomationWatcherListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationWatcherListResult DeserializeAutomationWatcherListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationWatcherListResult DeserializeAutomationWatcherListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationWatcherListResult(Optional.ToList(value), nextLink.Value); + return new AutomationWatcherListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationWatcherListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWatcherListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWatcherListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWatcherListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWatcherListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWatcherListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWatcherListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.cs index 49b4f153f68d..7b9844be3ce8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list watcher operation. internal partial class AutomationWatcherListResult { - /// Initializes a new instance of AutomationWatcherListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationWatcherListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationWatcherListResult. + /// Initializes a new instance of . /// Gets or sets a list of watchers. /// Gets or sets the next link. - internal AutomationWatcherListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationWatcherListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of watchers. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.Serialization.cs index 653d2d8f90ba..a0920ed54b31 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationWatcherPatch : IUtf8JsonSerializable + public partial class AutomationWatcherPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -28,7 +36,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(ExecutionFrequencyInSeconds.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationWatcherPatch DeserializeAutomationWatcherPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional executionFrequencyInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("executionFrequencyInSeconds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + executionFrequencyInSeconds = property0.Value.GetInt64(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationWatcherPatch(name.Value, Optional.ToNullable(executionFrequencyInSeconds), serializedAdditionalRawData); + } + + AutomationWatcherPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWatcherPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWatcherPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWatcherPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWatcherPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWatcherPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWatcherPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.cs index 48e2e54e535b..e0f8aef492b5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWatcherPatch.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The AutomationWatcherPatch. public partial class AutomationWatcherPatch { - /// Initializes a new instance of AutomationWatcherPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationWatcherPatch() { } + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Gets or sets the frequency at which the watcher is invoked. + /// Keeps track of any properties unknown to the library. + internal AutomationWatcherPatch(string name, long? executionFrequencyInSeconds, Dictionary serializedAdditionalRawData) + { + Name = name; + ExecutionFrequencyInSeconds = executionFrequencyInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the resource. public string Name { get; set; } /// Gets or sets the frequency at which the watcher is invoked. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.Serialization.cs index 9b72d0bc80ef..09fcfae74e4b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationWebhookCreateOrUpdateContent : IUtf8JsonSerializable + public partial class AutomationWebhookCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -48,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Runbook)) { writer.WritePropertyName("runbook"u8); - writer.WriteObjectValue(Runbook); + if (Runbook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Runbook).Serialize(writer, options); + } } if (Optional.IsDefined(RunOn)) { @@ -56,7 +71,166 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RunOn); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationWebhookCreateOrUpdateContent DeserializeAutomationWebhookCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional isEnabled = default; + Optional uri = default; + Optional expiryTime = default; + Optional> parameters = default; + Optional runbook = default; + Optional runOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("isEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("uri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("expiryTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiryTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("runbook"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runbook = RunbookAssociationProperty.DeserializeRunbookAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("runOn"u8)) + { + runOn = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationWebhookCreateOrUpdateContent(name, Optional.ToNullable(isEnabled), uri.Value, Optional.ToNullable(expiryTime), Optional.ToDictionary(parameters), runbook.Value, runOn.Value, serializedAdditionalRawData); + } + + AutomationWebhookCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWebhookCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWebhookCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWebhookCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWebhookCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWebhookCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWebhookCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.cs index 0c0d9d72d509..2fd952d2eca7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update webhook operation. public partial class AutomationWebhookCreateOrUpdateContent { - /// Initializes a new instance of AutomationWebhookCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the name of the webhook. /// is null. public AutomationWebhookCreateOrUpdateContent(string name) @@ -25,6 +28,32 @@ public AutomationWebhookCreateOrUpdateContent(string name) Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the name of the webhook. + /// Gets or sets the value of the enabled flag of webhook. + /// Gets or sets the uri. + /// Gets or sets the expiry time. + /// Gets or sets the parameters of the job. + /// Gets or sets the runbook. + /// Gets or sets the name of the hybrid worker group the webhook job will run on. + /// Keeps track of any properties unknown to the library. + internal AutomationWebhookCreateOrUpdateContent(string name, bool? isEnabled, Uri uri, DateTimeOffset? expireOn, IDictionary parameters, RunbookAssociationProperty runbook, string runOn, Dictionary serializedAdditionalRawData) + { + Name = name; + IsEnabled = isEnabled; + Uri = uri; + ExpireOn = expireOn; + Parameters = parameters; + Runbook = runbook; + RunOn = runOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomationWebhookCreateOrUpdateContent() + { + } + /// Gets or sets the name of the webhook. public string Name { get; } /// Gets or sets the value of the enabled flag of webhook. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookData.Serialization.cs index 932928814c5c..6bc86211c5c8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class AutomationWebhookData : IUtf8JsonSerializable + public partial class AutomationWebhookData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -62,7 +68,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Runbook)) { writer.WritePropertyName("runbook"u8); - writer.WriteObjectValue(Runbook); + if (Runbook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Runbook).Serialize(writer, options); + } } if (Optional.IsDefined(RunOn)) { @@ -90,11 +103,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomationWebhookData DeserializeAutomationWebhookData(JsonElement element) + internal static AutomationWebhookData DeserializeAutomationWebhookData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -114,6 +141,7 @@ internal static AutomationWebhookData DeserializeAutomationWebhookData(JsonEleme Optional lastModifiedTime = default; Optional lastModifiedBy = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -245,8 +273,61 @@ internal static AutomationWebhookData DeserializeAutomationWebhookData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationWebhookData(id, name, type, systemData.Value, Optional.ToNullable(isEnabled), uri.Value, Optional.ToNullable(expiryTime), Optional.ToNullable(lastInvokedTime), Optional.ToDictionary(parameters), runbook.Value, runOn.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, description.Value); + return new AutomationWebhookData(id, name, type, systemData.Value, Optional.ToNullable(isEnabled), uri.Value, Optional.ToNullable(expiryTime), Optional.ToNullable(lastInvokedTime), Optional.ToDictionary(parameters), runbook.Value, runOn.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, description.Value, serializedAdditionalRawData); + } + + AutomationWebhookData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWebhookData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWebhookData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWebhookData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWebhookData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWebhookData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWebhookData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.Serialization.cs index 278d3bec0c37..864f82d2bc7a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class AutomationWebhookListResult + internal partial class AutomationWebhookListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AutomationWebhookListResult DeserializeAutomationWebhookListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AutomationWebhookListResult DeserializeAutomationWebhookListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AutomationWebhookListResult DeserializeAutomationWebhookListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AutomationWebhookListResult(Optional.ToList(value), nextLink.Value); + return new AutomationWebhookListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AutomationWebhookListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWebhookListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWebhookListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWebhookListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWebhookListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWebhookListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWebhookListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.cs index 53d8de150d2d..3481ea2441a1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list webhook operation. internal partial class AutomationWebhookListResult { - /// Initializes a new instance of AutomationWebhookListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AutomationWebhookListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AutomationWebhookListResult. + /// Initializes a new instance of . /// Gets or sets a list of webhooks. /// Gets or sets the next link. - internal AutomationWebhookListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AutomationWebhookListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of webhooks. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.Serialization.cs index c3117c5b8105..daf6b8326287 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AutomationWebhookPatch : IUtf8JsonSerializable + public partial class AutomationWebhookPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -49,7 +57,142 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AutomationWebhookPatch DeserializeAutomationWebhookPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional isEnabled = default; + Optional runOn = default; + Optional> parameters = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("isEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("runOn"u8)) + { + runOn = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomationWebhookPatch(name.Value, Optional.ToNullable(isEnabled), runOn.Value, Optional.ToDictionary(parameters), description.Value, serializedAdditionalRawData); + } + + AutomationWebhookPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomationWebhookPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomationWebhookPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomationWebhookPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomationWebhookPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomationWebhookPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomationWebhookPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.cs index fcf260d12f4e..e44939a1bb80 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AutomationWebhookPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,32 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the update webhook operation. public partial class AutomationWebhookPatch { - /// Initializes a new instance of AutomationWebhookPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomationWebhookPatch() { Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the name of the webhook. + /// Gets or sets the value of the enabled flag of webhook. + /// Gets or sets the name of the hybrid worker group the webhook job will run on. + /// Gets or sets the parameters of the job. + /// Gets or sets the description of the webhook. + /// Keeps track of any properties unknown to the library. + internal AutomationWebhookPatch(string name, bool? isEnabled, string runOn, IDictionary parameters, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + IsEnabled = isEnabled; + RunOn = runOn; + Parameters = parameters; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the webhook. public string Name { get; set; } /// Gets or sets the value of the enabled flag of webhook. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.Serialization.cs index f475a1f500ac..a2a52d55d1c8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class AzureQueryProperties : IUtf8JsonSerializable + public partial class AzureQueryProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Scope)) { @@ -39,13 +46,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TagSettings)) { writer.WritePropertyName("tagSettings"u8); - writer.WriteObjectValue(TagSettings); + if (TagSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TagSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AzureQueryProperties DeserializeAzureQueryProperties(JsonElement element) + internal static AzureQueryProperties DeserializeAzureQueryProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +81,7 @@ internal static AzureQueryProperties DeserializeAzureQueryProperties(JsonElement Optional> scope = default; Optional> locations = default; Optional tagSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scope"u8)) @@ -92,8 +121,61 @@ internal static AzureQueryProperties DeserializeAzureQueryProperties(JsonElement tagSettings = QueryTagSettingsProperties.DeserializeQueryTagSettingsProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureQueryProperties(Optional.ToList(scope), Optional.ToList(locations), tagSettings.Value, serializedAdditionalRawData); + } + + AzureQueryProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureQueryProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureQueryProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureQueryProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureQueryProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureQueryProperties(Response response) + { + if (response is null) + { + return null; } - return new AzureQueryProperties(Optional.ToList(scope), Optional.ToList(locations), tagSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureQueryProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.cs index 453e587437dc..79543275f6f7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/AzureQueryProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Automation.Models /// Azure query for the update configuration. public partial class AzureQueryProperties { - /// Initializes a new instance of AzureQueryProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AzureQueryProperties() { Scope = new ChangeTrackingList(); Locations = new ChangeTrackingList(); } - /// Initializes a new instance of AzureQueryProperties. + /// Initializes a new instance of . /// List of Subscription or Resource Group ARM Ids. /// List of locations to scope the query to. /// Tag settings for the VM. - internal AzureQueryProperties(IList scope, IList locations, QueryTagSettingsProperties tagSettings) + /// Keeps track of any properties unknown to the library. + internal AzureQueryProperties(IList scope, IList locations, QueryTagSettingsProperties tagSettings, Dictionary serializedAdditionalRawData) { Scope = scope; Locations = locations; TagSettings = tagSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Subscription or Resource Group ARM Ids. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.Serialization.cs index e5782e347350..8cb4dc2c9c5d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class ConnectionTypeAssociationProperty : IUtf8JsonSerializable + public partial class ConnectionTypeAssociationProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectionTypeAssociationProperty DeserializeConnectionTypeAssociationProperty(JsonElement element) + internal static ConnectionTypeAssociationProperty DeserializeConnectionTypeAssociationProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static ConnectionTypeAssociationProperty DeserializeConnectionTypeAssoc name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectionTypeAssociationProperty(name.Value, serializedAdditionalRawData); + } + + ConnectionTypeAssociationProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectionTypeAssociationProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectionTypeAssociationProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectionTypeAssociationProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectionTypeAssociationProperty model) + { + if (model is null) + { + return null; } - return new ConnectionTypeAssociationProperty(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectionTypeAssociationProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectionTypeAssociationProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.cs index d1e0af35347d..86f0299eb108 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ConnectionTypeAssociationProperty.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The connection type property associated with the entity. public partial class ConnectionTypeAssociationProperty { - /// Initializes a new instance of ConnectionTypeAssociationProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectionTypeAssociationProperty() { } - /// Initializes a new instance of ConnectionTypeAssociationProperty. + /// Initializes a new instance of . /// Gets or sets the name of the connection type. - internal ConnectionTypeAssociationProperty(string name) + /// Keeps track of any properties unknown to the library. + internal ConnectionTypeAssociationProperty(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the connection type. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.Serialization.cs index f8dda1fa04e9..2c3a0f517ff8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.Serialization.cs @@ -6,16 +6,66 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation.Models { - public partial class DeletedAutomationAccount + public partial class DeletedAutomationAccount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeletedAutomationAccount DeserializeDeletedAutomationAccount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AutomationAccountResourceId)) + { + writer.WritePropertyName("automationAccountResourceId"u8); + writer.WriteStringValue(AutomationAccountResourceId); + } + if (Optional.IsDefined(AutomationAccountId)) + { + writer.WritePropertyName("automationAccountId"u8); + writer.WriteStringValue(AutomationAccountId); + } + if (Optional.IsDefined(LocationPropertiesLocation)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(LocationPropertiesLocation); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeletedAutomationAccount DeserializeDeletedAutomationAccount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +79,7 @@ internal static DeletedAutomationAccount DeserializeDeletedAutomationAccount(Jso Optional automationAccountId = default; Optional location0 = default; Optional deletionTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -104,8 +155,61 @@ internal static DeletedAutomationAccount DeserializeDeletedAutomationAccount(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeletedAutomationAccount(id, name, type, systemData.Value, Optional.ToNullable(location), automationAccountResourceId.Value, automationAccountId.Value, location0.Value, Optional.ToNullable(deletionTime)); + return new DeletedAutomationAccount(id, name, type, systemData.Value, Optional.ToNullable(location), automationAccountResourceId.Value, automationAccountId.Value, location0.Value, Optional.ToNullable(deletionTime), serializedAdditionalRawData); + } + + DeletedAutomationAccount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeletedAutomationAccount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeletedAutomationAccount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeletedAutomationAccount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeletedAutomationAccount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeletedAutomationAccount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeletedAutomationAccount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.cs index 636e1f7cf6b7..3a4519ffcd17 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccount.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the deleted automation account type. public partial class DeletedAutomationAccount : ResourceData { - /// Initializes a new instance of DeletedAutomationAccount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeletedAutomationAccount() { } - /// Initializes a new instance of DeletedAutomationAccount. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,13 +33,15 @@ internal DeletedAutomationAccount() /// Gets or sets the Automation Account Id. /// Gets or sets the location of the resource. /// Gets the deletion time. - internal DeletedAutomationAccount(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ResourceIdentifier automationAccountResourceId, string automationAccountId, string locationPropertiesLocation, DateTimeOffset? deletedOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DeletedAutomationAccount(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ResourceIdentifier automationAccountResourceId, string automationAccountId, string locationPropertiesLocation, DateTimeOffset? deletedOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; AutomationAccountResourceId = automationAccountResourceId; AutomationAccountId = automationAccountId; LocationPropertiesLocation = locationPropertiesLocation; DeletedOn = deletedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.Serialization.cs index 204a653c459e..b704c23f70c0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class DeletedAutomationAccountListResult + internal partial class DeletedAutomationAccountListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeletedAutomationAccountListResult DeserializeDeletedAutomationAccountListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeletedAutomationAccountListResult DeserializeDeletedAutomationAccountListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static DeletedAutomationAccountListResult DeserializeDeletedAutomationA value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeletedAutomationAccountListResult(Optional.ToList(value)); + return new DeletedAutomationAccountListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + DeletedAutomationAccountListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeletedAutomationAccountListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeletedAutomationAccountListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeletedAutomationAccountListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeletedAutomationAccountListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeletedAutomationAccountListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeletedAutomationAccountListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs index 34a764c83744..caa643a79063 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list deleted automation account. internal partial class DeletedAutomationAccountListResult { - /// Initializes a new instance of DeletedAutomationAccountListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeletedAutomationAccountListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DeletedAutomationAccountListResult. + /// Initializes a new instance of . /// Gets or sets the list of deleted automation accounts. - internal DeletedAutomationAccountListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal DeletedAutomationAccountListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the list of deleted automation accounts. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.Serialization.cs index 4db8a455d49d..079c63eb1d32 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscCompilationJobCreateOrUpdateContent : IUtf8JsonSerializable + public partial class DscCompilationJobCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -39,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Parameters)) { writer.WritePropertyName("parameters"u8); @@ -57,7 +72,161 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsIncrementNodeConfigurationBuildRequired.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DscCompilationJobCreateOrUpdateContent DeserializeDscCompilationJobCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional> tags = default; + DscConfigurationAssociationProperty configuration = default; + Optional> parameters = default; + Optional incrementNodeConfigurationBuild = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("configuration"u8)) + { + configuration = DscConfigurationAssociationProperty.DeserializeDscConfigurationAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("incrementNodeConfigurationBuild"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + incrementNodeConfigurationBuild = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscCompilationJobCreateOrUpdateContent(name.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), configuration, Optional.ToDictionary(parameters), Optional.ToNullable(incrementNodeConfigurationBuild), serializedAdditionalRawData); + } + + DscCompilationJobCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscCompilationJobCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscCompilationJobCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscCompilationJobCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscCompilationJobCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscCompilationJobCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscCompilationJobCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.cs index 5d7658bde0fa..58b9eeef9514 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create compilation job operation. public partial class DscCompilationJobCreateOrUpdateContent { - /// Initializes a new instance of DscCompilationJobCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the configuration. /// is null. public DscCompilationJobCreateOrUpdateContent(DscConfigurationAssociationProperty configuration) @@ -26,6 +29,30 @@ public DscCompilationJobCreateOrUpdateContent(DscConfigurationAssociationPropert Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the configuration. + /// Gets or sets the parameters of the job. + /// If a new build version of NodeConfiguration is required. + /// Keeps track of any properties unknown to the library. + internal DscCompilationJobCreateOrUpdateContent(string name, AzureLocation? location, IDictionary tags, DscConfigurationAssociationProperty configuration, IDictionary parameters, bool? isIncrementNodeConfigurationBuildRequired, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Tags = tags; + Configuration = configuration; + Parameters = parameters; + IsIncrementNodeConfigurationBuildRequired = isIncrementNodeConfigurationBuildRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DscCompilationJobCreateOrUpdateContent() + { + } + /// Gets or sets name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobData.Serialization.cs index 62b9f95a17a3..f2790656fda2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobData.Serialization.cs @@ -8,23 +8,36 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class DscCompilationJobData : IUtf8JsonSerializable + public partial class DscCompilationJobData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(ProvisioningState)) { @@ -58,11 +71,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscCompilationJobData DeserializeDscCompilationJobData(JsonElement element) + internal static DscCompilationJobData DeserializeDscCompilationJobData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +112,7 @@ internal static DscCompilationJobData DeserializeDscCompilationJobData(JsonEleme Optional lastModifiedTime = default; Optional lastStatusModifiedTime = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -241,8 +269,61 @@ internal static DscCompilationJobData DeserializeDscCompilationJobData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscCompilationJobData(id, name, type, systemData.Value, configuration.Value, startedBy.Value, Optional.ToNullable(jobId), Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), runOn.Value, Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), exception.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(lastStatusModifiedTime), Optional.ToDictionary(parameters), serializedAdditionalRawData); + } + + DscCompilationJobData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscCompilationJobData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscCompilationJobData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscCompilationJobData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscCompilationJobData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscCompilationJobData(Response response) + { + if (response is null) + { + return null; } - return new DscCompilationJobData(id, name, type, systemData.Value, configuration.Value, startedBy.Value, Optional.ToNullable(jobId), Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), runOn.Value, Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), exception.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(lastStatusModifiedTime), Optional.ToDictionary(parameters)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscCompilationJobData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.Serialization.cs index 6daa12a3fa90..833cd266e907 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscCompilationJobListResult + internal partial class DscCompilationJobListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscCompilationJobListResult DeserializeDscCompilationJobListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscCompilationJobListResult DeserializeDscCompilationJobListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DscCompilationJobListResult DeserializeDscCompilationJobListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscCompilationJobListResult(Optional.ToList(value), nextLink.Value); + return new DscCompilationJobListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DscCompilationJobListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscCompilationJobListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscCompilationJobListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscCompilationJobListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscCompilationJobListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscCompilationJobListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscCompilationJobListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.cs index 39f5f24ed97f..a44299a29fa1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscCompilationJobListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list job operation. internal partial class DscCompilationJobListResult { - /// Initializes a new instance of DscCompilationJobListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscCompilationJobListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DscCompilationJobListResult. + /// Initializes a new instance of . /// Gets or sets a list of Dsc Compilation jobs. /// Gets or sets the next link. - internal DscCompilationJobListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DscCompilationJobListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of Dsc Compilation jobs. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.Serialization.cs index d2345359be0f..ff845e156e8e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscConfigurationAssociationProperty : IUtf8JsonSerializable + public partial class DscConfigurationAssociationProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConfigurationName)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(ConfigurationName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscConfigurationAssociationProperty DeserializeDscConfigurationAssociationProperty(JsonElement element) + internal static DscConfigurationAssociationProperty DeserializeDscConfigurationAssociationProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static DscConfigurationAssociationProperty DeserializeDscConfigurationA name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscConfigurationAssociationProperty(name.Value, serializedAdditionalRawData); + } + + DscConfigurationAssociationProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscConfigurationAssociationProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscConfigurationAssociationProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscConfigurationAssociationProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscConfigurationAssociationProperty model) + { + if (model is null) + { + return null; } - return new DscConfigurationAssociationProperty(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscConfigurationAssociationProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscConfigurationAssociationProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.cs index 7e9b0cb7ea34..5d4cd2fe5edf 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationAssociationProperty.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The Dsc configuration property associated with the entity. public partial class DscConfigurationAssociationProperty { - /// Initializes a new instance of DscConfigurationAssociationProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscConfigurationAssociationProperty() { } - /// Initializes a new instance of DscConfigurationAssociationProperty. + /// Initializes a new instance of . /// Gets or sets the name of the Dsc configuration. - internal DscConfigurationAssociationProperty(string configurationName) + /// Keeps track of any properties unknown to the library. + internal DscConfigurationAssociationProperty(string configurationName, Dictionary serializedAdditionalRawData) { ConfigurationName = configurationName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the Dsc configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.Serialization.cs index 92ed8197771d..295da4a385c5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscConfigurationCreateOrUpdateContent : IUtf8JsonSerializable + public partial class DscConfigurationCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -49,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsLogProgressEnabled.Value); } writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Parameters)) { writer.WritePropertyName("parameters"u8); @@ -57,7 +72,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -67,7 +89,177 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DscConfigurationCreateOrUpdateContent DeserializeDscConfigurationCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + Optional> tags = default; + Optional logVerbose = default; + Optional logProgress = default; + AutomationContentSource source = default; + Optional> parameters = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("logVerbose"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logVerbose = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("logProgress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logProgress = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("source"u8)) + { + source = AutomationContentSource.DeserializeAutomationContentSource(property0.Value); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, DscConfigurationParameterDefinition.DeserializeDscConfigurationParameterDefinition(property1.Value)); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscConfigurationCreateOrUpdateContent(name.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), Optional.ToNullable(logVerbose), Optional.ToNullable(logProgress), source, Optional.ToDictionary(parameters), description.Value, serializedAdditionalRawData); + } + + DscConfigurationCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscConfigurationCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscConfigurationCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscConfigurationCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscConfigurationCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscConfigurationCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscConfigurationCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.cs index 9df9934b04db..18276fb42065 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update configuration operation. public partial class DscConfigurationCreateOrUpdateContent { - /// Initializes a new instance of DscConfigurationCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Gets or sets the source. /// is null. public DscConfigurationCreateOrUpdateContent(AutomationContentSource source) @@ -26,6 +29,34 @@ public DscConfigurationCreateOrUpdateContent(AutomationContentSource source) Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the location of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets verbose log option. + /// Gets or sets progress log option. + /// Gets or sets the source. + /// Gets or sets the configuration parameters. + /// Gets or sets the description of the configuration. + /// Keeps track of any properties unknown to the library. + internal DscConfigurationCreateOrUpdateContent(string name, AzureLocation? location, IDictionary tags, bool? isLogVerboseEnabled, bool? isLogProgressEnabled, AutomationContentSource source, IDictionary parameters, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + Tags = tags; + IsLogVerboseEnabled = isLogVerboseEnabled; + IsLogProgressEnabled = isLogProgressEnabled; + Source = source; + Parameters = parameters; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DscConfigurationCreateOrUpdateContent() + { + } + /// Gets or sets name of the resource. public string Name { get; set; } /// Gets or sets the location of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationData.Serialization.cs index fce7b7ac9aa7..819a2870c9e6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class DscConfigurationData : IUtf8JsonSerializable + public partial class DscConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -57,14 +62,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsDefined(State)) { @@ -97,11 +116,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscConfigurationData DeserializeDscConfigurationData(JsonElement element) + internal static DscConfigurationData DeserializeDscConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -123,6 +156,7 @@ internal static DscConfigurationData DeserializeDscConfigurationData(JsonElement Optional lastModifiedTime = default; Optional nodeConfigurationCount = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -280,8 +314,61 @@ internal static DscConfigurationData DeserializeDscConfigurationData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscConfigurationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(provisioningState), Optional.ToNullable(jobCount), Optional.ToDictionary(parameters), source.Value, Optional.ToNullable(state), Optional.ToNullable(logVerbose), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(nodeConfigurationCount), description.Value, serializedAdditionalRawData); + } + + DscConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscConfigurationData model) + { + if (model is null) + { + return null; } - return new DscConfigurationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(provisioningState), Optional.ToNullable(jobCount), Optional.ToDictionary(parameters), source.Value, Optional.ToNullable(state), Optional.ToNullable(logVerbose), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(nodeConfigurationCount), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscConfigurationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.Serialization.cs index eb189900ed6e..2536b45d2f6a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscConfigurationListResult + internal partial class DscConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscConfigurationListResult DeserializeDscConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsDefined(TotalCount)) + { + writer.WritePropertyName("totalCount"u8); + writer.WriteNumberValue(TotalCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscConfigurationListResult DeserializeDscConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static DscConfigurationListResult DeserializeDscConfigurationListResult Optional> value = default; Optional nextLink = default; Optional totalCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static DscConfigurationListResult DeserializeDscConfigurationListResult totalCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscConfigurationListResult(Optional.ToList(value), nextLink.Value, Optional.ToNullable(totalCount)); + return new DscConfigurationListResult(Optional.ToList(value), nextLink.Value, Optional.ToNullable(totalCount), serializedAdditionalRawData); + } + + DscConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.cs index 381a13db5264..d88cb79827aa 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list configuration operation. internal partial class DscConfigurationListResult { - /// Initializes a new instance of DscConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DscConfigurationListResult. + /// Initializes a new instance of . /// Gets or sets a list of configurations. /// Gets or sets the next link. /// Gets the total number of configurations matching filter criteria. - internal DscConfigurationListResult(IReadOnlyList value, string nextLink, int? totalCount) + /// Keeps track of any properties unknown to the library. + internal DscConfigurationListResult(IReadOnlyList value, string nextLink, int? totalCount, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; TotalCount = totalCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of configurations. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.Serialization.cs index a279de052730..8556588a8d70 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscConfigurationParameterDefinition : IUtf8JsonSerializable + public partial class DscConfigurationParameterDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DscConfigurationParameterType)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("defaultValue"u8); writer.WriteStringValue(DefaultValue); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscConfigurationParameterDefinition DeserializeDscConfigurationParameterDefinition(JsonElement element) + internal static DscConfigurationParameterDefinition DeserializeDscConfigurationParameterDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static DscConfigurationParameterDefinition DeserializeDscConfigurationP Optional isMandatory = default; Optional position = default; Optional defaultValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -78,8 +101,61 @@ internal static DscConfigurationParameterDefinition DeserializeDscConfigurationP defaultValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscConfigurationParameterDefinition(type.Value, Optional.ToNullable(isMandatory), Optional.ToNullable(position), defaultValue.Value, serializedAdditionalRawData); + } + + DscConfigurationParameterDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscConfigurationParameterDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscConfigurationParameterDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscConfigurationParameterDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscConfigurationParameterDefinition model) + { + if (model is null) + { + return null; } - return new DscConfigurationParameterDefinition(type.Value, Optional.ToNullable(isMandatory), Optional.ToNullable(position), defaultValue.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscConfigurationParameterDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscConfigurationParameterDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.cs index 464a43b57922..36c035e5f718 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationParameterDefinition.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the configuration parameter type. public partial class DscConfigurationParameterDefinition { - /// Initializes a new instance of DscConfigurationParameterDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscConfigurationParameterDefinition() { } - /// Initializes a new instance of DscConfigurationParameterDefinition. + /// Initializes a new instance of . /// Gets or sets the type of the parameter. /// Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. /// Get or sets the position of the parameter. /// Gets or sets the default value of parameter. - internal DscConfigurationParameterDefinition(string dscConfigurationParameterType, bool? isMandatory, int? position, string defaultValue) + /// Keeps track of any properties unknown to the library. + internal DscConfigurationParameterDefinition(string dscConfigurationParameterType, bool? isMandatory, int? position, string defaultValue, Dictionary serializedAdditionalRawData) { DscConfigurationParameterType = dscConfigurationParameterType; IsMandatory = isMandatory; Position = position; DefaultValue = defaultValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the type of the parameter. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.Serialization.cs index 39c52ac3c598..61a48eabc8ef 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscConfigurationPatch : IUtf8JsonSerializable + public partial class DscConfigurationPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -46,7 +54,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Parameters)) { @@ -55,7 +70,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -65,7 +87,171 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DscConfigurationPatch DeserializeDscConfigurationPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional> tags = default; + Optional logVerbose = default; + Optional logProgress = default; + Optional source = default; + Optional> parameters = default; + Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("logVerbose"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logVerbose = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("logProgress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logProgress = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("source"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = AutomationContentSource.DeserializeAutomationContentSource(property0.Value); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, DscConfigurationParameterDefinition.DeserializeDscConfigurationParameterDefinition(property1.Value)); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscConfigurationPatch(name.Value, Optional.ToDictionary(tags), Optional.ToNullable(logVerbose), Optional.ToNullable(logProgress), source.Value, Optional.ToDictionary(parameters), description.Value, serializedAdditionalRawData); + } + + DscConfigurationPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscConfigurationPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscConfigurationPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscConfigurationPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscConfigurationPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscConfigurationPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscConfigurationPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.cs index 952048bedd20..f168cb851542 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscConfigurationPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,37 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update configuration operation. public partial class DscConfigurationPatch { - /// Initializes a new instance of DscConfigurationPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscConfigurationPatch() { Tags = new ChangeTrackingDictionary(); Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets name of the resource. + /// Gets or sets the tags attached to the resource. + /// Gets or sets verbose log option. + /// Gets or sets progress log option. + /// Gets or sets the source. + /// Gets or sets the configuration parameters. + /// Gets or sets the description of the configuration. + /// Keeps track of any properties unknown to the library. + internal DscConfigurationPatch(string name, IDictionary tags, bool? isLogVerboseEnabled, bool? isLogProgressEnabled, AutomationContentSource source, IDictionary parameters, string description, Dictionary serializedAdditionalRawData) + { + Name = name; + Tags = tags; + IsLogVerboseEnabled = isLogVerboseEnabled; + IsLogProgressEnabled = isLogProgressEnabled; + Source = source; + Parameters = parameters; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets name of the resource. public string Name { get; set; } /// Gets or sets the tags attached to the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.Serialization.cs index 82939cd490c6..e63a4852158b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.Serialization.cs @@ -5,15 +5,78 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscMetaConfiguration + public partial class DscMetaConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscMetaConfiguration DeserializeDscMetaConfiguration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationModeFrequencyMins)) + { + writer.WritePropertyName("configurationModeFrequencyMins"u8); + writer.WriteNumberValue(ConfigurationModeFrequencyMins.Value); + } + if (Optional.IsDefined(RebootNodeIfNeeded)) + { + writer.WritePropertyName("rebootNodeIfNeeded"u8); + writer.WriteBooleanValue(RebootNodeIfNeeded.Value); + } + if (Optional.IsDefined(ConfigurationMode)) + { + writer.WritePropertyName("configurationMode"u8); + writer.WriteStringValue(ConfigurationMode); + } + if (Optional.IsDefined(ActionAfterReboot)) + { + writer.WritePropertyName("actionAfterReboot"u8); + writer.WriteStringValue(ActionAfterReboot); + } + if (Optional.IsDefined(CertificateId)) + { + writer.WritePropertyName("certificateId"u8); + writer.WriteStringValue(CertificateId); + } + if (Optional.IsDefined(RefreshFrequencyMins)) + { + writer.WritePropertyName("refreshFrequencyMins"u8); + writer.WriteNumberValue(RefreshFrequencyMins.Value); + } + if (Optional.IsDefined(AllowModuleOverwrite)) + { + writer.WritePropertyName("allowModuleOverwrite"u8); + writer.WriteBooleanValue(AllowModuleOverwrite.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscMetaConfiguration DeserializeDscMetaConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +88,7 @@ internal static DscMetaConfiguration DeserializeDscMetaConfiguration(JsonElement Optional certificateId = default; Optional refreshFrequencyMins = default; Optional allowModuleOverwrite = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("configurationModeFrequencyMins"u8)) @@ -78,8 +142,61 @@ internal static DscMetaConfiguration DeserializeDscMetaConfiguration(JsonElement allowModuleOverwrite = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscMetaConfiguration(Optional.ToNullable(configurationModeFrequencyMins), Optional.ToNullable(rebootNodeIfNeeded), configurationMode.Value, actionAfterReboot.Value, certificateId.Value, Optional.ToNullable(refreshFrequencyMins), Optional.ToNullable(allowModuleOverwrite)); + return new DscMetaConfiguration(Optional.ToNullable(configurationModeFrequencyMins), Optional.ToNullable(rebootNodeIfNeeded), configurationMode.Value, actionAfterReboot.Value, certificateId.Value, Optional.ToNullable(refreshFrequencyMins), Optional.ToNullable(allowModuleOverwrite), serializedAdditionalRawData); + } + + DscMetaConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscMetaConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscMetaConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscMetaConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscMetaConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscMetaConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscMetaConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.cs index 4e9ff807b8da..99641f254b44 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscMetaConfiguration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the DSC Meta Configuration. public partial class DscMetaConfiguration { - /// Initializes a new instance of DscMetaConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscMetaConfiguration() { } - /// Initializes a new instance of DscMetaConfiguration. + /// Initializes a new instance of . /// Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. /// Gets or sets the RebootNodeIfNeeded value of the meta configuration. /// Gets or sets the ConfigurationMode value of the meta configuration. @@ -23,7 +29,8 @@ internal DscMetaConfiguration() /// Gets or sets the CertificateId value of the meta configuration. /// Gets or sets the RefreshFrequencyMins value of the meta configuration. /// Gets or sets the AllowModuleOverwrite value of the meta configuration. - internal DscMetaConfiguration(int? configurationModeFrequencyMins, bool? rebootNodeIfNeeded, string configurationMode, string actionAfterReboot, string certificateId, int? refreshFrequencyMins, bool? allowModuleOverwrite) + /// Keeps track of any properties unknown to the library. + internal DscMetaConfiguration(int? configurationModeFrequencyMins, bool? rebootNodeIfNeeded, string configurationMode, string actionAfterReboot, string certificateId, int? refreshFrequencyMins, bool? allowModuleOverwrite, Dictionary serializedAdditionalRawData) { ConfigurationModeFrequencyMins = configurationModeFrequencyMins; RebootNodeIfNeeded = rebootNodeIfNeeded; @@ -32,6 +39,7 @@ internal DscMetaConfiguration(int? configurationModeFrequencyMins, bool? rebootN CertificateId = certificateId; RefreshFrequencyMins = refreshFrequencyMins; AllowModuleOverwrite = allowModuleOverwrite; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the ConfigurationModeFrequencyMins value of the meta configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.Serialization.cs index 7c012e77f10f..3b7b1a83548e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscNodeConfigurationCreateOrUpdateContent : IUtf8JsonSerializable + public partial class DscNodeConfigurationCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -36,12 +44,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(IsIncrementNodeConfigurationBuildRequired)) { @@ -49,7 +71,150 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsIncrementNodeConfigurationBuildRequired.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DscNodeConfigurationCreateOrUpdateContent DeserializeDscNodeConfigurationCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional> tags = default; + Optional source = default; + Optional configuration = default; + Optional incrementNodeConfigurationBuild = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("source"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = AutomationContentSource.DeserializeAutomationContentSource(property0.Value); + continue; + } + if (property0.NameEquals("configuration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = DscConfigurationAssociationProperty.DeserializeDscConfigurationAssociationProperty(property0.Value); + continue; + } + if (property0.NameEquals("incrementNodeConfigurationBuild"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + incrementNodeConfigurationBuild = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscNodeConfigurationCreateOrUpdateContent(name.Value, Optional.ToDictionary(tags), source.Value, configuration.Value, Optional.ToNullable(incrementNodeConfigurationBuild), serializedAdditionalRawData); + } + + DscNodeConfigurationCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeConfigurationCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeConfigurationCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeConfigurationCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeConfigurationCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeConfigurationCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeConfigurationCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.cs index 2779e807d1ce..d9ba00cba9f3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,32 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create or update node configuration operation. public partial class DscNodeConfigurationCreateOrUpdateContent { - /// Initializes a new instance of DscNodeConfigurationCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscNodeConfigurationCreateOrUpdateContent() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Name of the node configuration. + /// Gets or sets the tags attached to the resource. + /// Gets or sets the source. + /// Gets or sets the configuration of the node. + /// If a new build version of NodeConfiguration is required. + /// Keeps track of any properties unknown to the library. + internal DscNodeConfigurationCreateOrUpdateContent(string name, IDictionary tags, AutomationContentSource source, DscConfigurationAssociationProperty configuration, bool? isIncrementNodeConfigurationBuildRequired, Dictionary serializedAdditionalRawData) + { + Name = name; + Tags = tags; + Source = source; + Configuration = configuration; + IsIncrementNodeConfigurationBuildRequired = isIncrementNodeConfigurationBuildRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Name of the node configuration. public string Name { get; set; } /// Gets or sets the tags attached to the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationData.Serialization.cs index 1e409417aaf0..a048c9746928 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class DscNodeConfigurationData : IUtf8JsonSerializable + public partial class DscNodeConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +40,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(Source)) { @@ -51,11 +65,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsIncrementNodeConfigurationBuildRequired.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscNodeConfigurationData DeserializeDscNodeConfigurationData(JsonElement element) + internal static DscNodeConfigurationData DeserializeDscNodeConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +98,7 @@ internal static DscNodeConfigurationData DeserializeDscNodeConfigurationData(Jso Optional source = default; Optional nodeCount = default; Optional incrementNodeConfigurationBuild = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -158,8 +187,61 @@ internal static DscNodeConfigurationData DeserializeDscNodeConfigurationData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscNodeConfigurationData(id, name, type, systemData.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(creationTime), configuration.Value, source.Value, Optional.ToNullable(nodeCount), Optional.ToNullable(incrementNodeConfigurationBuild), serializedAdditionalRawData); + } + + DscNodeConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeConfigurationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeConfigurationData(Response response) + { + if (response is null) + { + return null; } - return new DscNodeConfigurationData(id, name, type, systemData.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(creationTime), configuration.Value, source.Value, Optional.ToNullable(nodeCount), Optional.ToNullable(incrementNodeConfigurationBuild)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.Serialization.cs index 6d4e5ed410a3..301e17a96b43 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscNodeConfigurationListResult + internal partial class DscNodeConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeConfigurationListResult DeserializeDscNodeConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsDefined(TotalCount)) + { + writer.WritePropertyName("totalCount"u8); + writer.WriteNumberValue(TotalCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeConfigurationListResult DeserializeDscNodeConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static DscNodeConfigurationListResult DeserializeDscNodeConfigurationLi Optional> value = default; Optional nextLink = default; Optional totalCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static DscNodeConfigurationListResult DeserializeDscNodeConfigurationLi totalCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeConfigurationListResult(Optional.ToList(value), nextLink.Value, Optional.ToNullable(totalCount)); + return new DscNodeConfigurationListResult(Optional.ToList(value), nextLink.Value, Optional.ToNullable(totalCount), serializedAdditionalRawData); + } + + DscNodeConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.cs index 7c18300232ca..b710ccbbc260 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list job operation. internal partial class DscNodeConfigurationListResult { - /// Initializes a new instance of DscNodeConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DscNodeConfigurationListResult. + /// Initializes a new instance of . /// Gets or sets a list of Dsc node configurations. /// Gets or sets the next link. /// Gets or sets the total rows in query. - internal DscNodeConfigurationListResult(IReadOnlyList value, string nextLink, int? totalCount) + /// Keeps track of any properties unknown to the library. + internal DscNodeConfigurationListResult(IReadOnlyList value, string nextLink, int? totalCount, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; TotalCount = totalCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of Dsc node configurations. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.Serialization.cs index 537bd3088266..980fdc04d34f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscNodeCount + public partial class DscNodeCount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeCount DeserializeDscNodeCount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeCount DeserializeDscNodeCount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +82,61 @@ internal static DscNodeCount DeserializeDscNodeCount(JsonElement element) properties = DscNodeCountProperties.DeserializeDscNodeCountProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeCount(name.Value, properties.Value); + return new DscNodeCount(name.Value, properties.Value, serializedAdditionalRawData); + } + + DscNodeCount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeCount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeCount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeCount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeCount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeCount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeCount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.cs index d24b59a2b717..24a41f470919 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCount.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Number of nodes based on the Filter. public partial class DscNodeCount { - /// Initializes a new instance of DscNodeCount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeCount() { } - /// Initializes a new instance of DscNodeCount. + /// Initializes a new instance of . /// Gets the name of a count type. /// - internal DscNodeCount(string name, DscNodeCountProperties properties) + /// Keeps track of any properties unknown to the library. + internal DscNodeCount(string name, DscNodeCountProperties properties, Dictionary serializedAdditionalRawData) { Name = name; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the name of a count type. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.Serialization.cs index 3cd08c531d66..d25a83f8fe97 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscNodeCountListResult + internal partial class DscNodeCountListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeCountListResult DeserializeDscNodeCountListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TotalCount)) + { + writer.WritePropertyName("totalCount"u8); + writer.WriteNumberValue(TotalCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeCountListResult DeserializeDscNodeCountListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional totalCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -46,8 +96,61 @@ internal static DscNodeCountListResult DeserializeDscNodeCountListResult(JsonEle totalCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeCountListResult(Optional.ToList(value), Optional.ToNullable(totalCount)); + return new DscNodeCountListResult(Optional.ToList(value), Optional.ToNullable(totalCount), serializedAdditionalRawData); + } + + DscNodeCountListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeCountListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeCountListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeCountListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeCountListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeCountListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeCountListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.cs index 30ce2348e850..a0fe46537e64 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// Gets the count of nodes by count type. internal partial class DscNodeCountListResult { - /// Initializes a new instance of DscNodeCountListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeCountListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DscNodeCountListResult. + /// Initializes a new instance of . /// Gets an array of counts. /// Gets the total number of records matching countType criteria. - internal DscNodeCountListResult(IReadOnlyList value, int? totalCount) + /// Keeps track of any properties unknown to the library. + internal DscNodeCountListResult(IReadOnlyList value, int? totalCount, Dictionary serializedAdditionalRawData) { Value = value; TotalCount = totalCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets an array of counts. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.Serialization.cs index ecf73ddb0a16..be8e2e552713 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscNodeCountProperties + internal partial class DscNodeCountProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeCountProperties DeserializeDscNodeCountProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NameCount)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(NameCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeCountProperties DeserializeDscNodeCountProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -30,8 +64,61 @@ internal static DscNodeCountProperties DeserializeDscNodeCountProperties(JsonEle count = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeCountProperties(Optional.ToNullable(count)); + return new DscNodeCountProperties(Optional.ToNullable(count), serializedAdditionalRawData); + } + + DscNodeCountProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeCountProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeCountProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeCountProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeCountProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeCountProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeCountProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.cs index a77a62df12e9..84242e0c369e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeCountProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The DscNodeCountProperties. internal partial class DscNodeCountProperties { - /// Initializes a new instance of DscNodeCountProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeCountProperties() { } - /// Initializes a new instance of DscNodeCountProperties. + /// Initializes a new instance of . /// Gets the count for the name. - internal DscNodeCountProperties(int? nameCount) + /// Keeps track of any properties unknown to the library. + internal DscNodeCountProperties(int? nameCount, Dictionary serializedAdditionalRawData) { NameCount = nameCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the count for the name. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeData.Serialization.cs index eb265319fef1..34cfe0ee5412 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class DscNodeData : IUtf8JsonSerializable + public partial class DscNodeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -68,7 +73,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExtensionHandler) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -88,11 +100,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscNodeData DeserializeDscNodeData(JsonElement element) + internal static DscNodeData DeserializeDscNodeData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -111,6 +137,7 @@ internal static DscNodeData DeserializeDscNodeData(JsonElement element) Optional totalCount = default; Optional> extensionHandler = default; Optional name0 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -241,8 +268,61 @@ internal static DscNodeData DeserializeDscNodeData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscNodeData(id, name, type, systemData.Value, Optional.ToNullable(lastSeen), Optional.ToNullable(registrationTime), ip.Value, accountId.Value, status.Value, nodeId.Value, Optional.ToNullable(etag), Optional.ToNullable(totalCount), Optional.ToList(extensionHandler), name0.Value, serializedAdditionalRawData); + } + + DscNodeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeData(Response response) + { + if (response is null) + { + return null; } - return new DscNodeData(id, name, type, systemData.Value, Optional.ToNullable(lastSeen), Optional.ToNullable(registrationTime), ip.Value, accountId.Value, status.Value, nodeId.Value, Optional.ToNullable(etag), Optional.ToNullable(totalCount), Optional.ToList(extensionHandler), name0.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.Serialization.cs index 1f2f866bab10..cedd01bb60ca 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscNodeExtensionHandlerAssociationProperty : IUtf8JsonSerializable + public partial class DscNodeExtensionHandlerAssociationProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DscNodeExtensionHandlerAssociationProperty DeserializeDscNodeExtensionHandlerAssociationProperty(JsonElement element) + internal static DscNodeExtensionHandlerAssociationProperty DeserializeDscNodeExtensionHandlerAssociationProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static DscNodeExtensionHandlerAssociationProperty DeserializeDscNodeExt version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscNodeExtensionHandlerAssociationProperty(name.Value, version.Value, serializedAdditionalRawData); + } + + DscNodeExtensionHandlerAssociationProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeExtensionHandlerAssociationProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeExtensionHandlerAssociationProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeExtensionHandlerAssociationProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeExtensionHandlerAssociationProperty model) + { + if (model is null) + { + return null; } - return new DscNodeExtensionHandlerAssociationProperty(name.Value, version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeExtensionHandlerAssociationProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeExtensionHandlerAssociationProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.cs index 647ab6aef8f9..7e5ccaf659c4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeExtensionHandlerAssociationProperty.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The dsc extensionHandler property associated with the node. public partial class DscNodeExtensionHandlerAssociationProperty { - /// Initializes a new instance of DscNodeExtensionHandlerAssociationProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscNodeExtensionHandlerAssociationProperty() { } - /// Initializes a new instance of DscNodeExtensionHandlerAssociationProperty. + /// Initializes a new instance of . /// Gets or sets the name of the extension handler. /// Gets or sets the version of the extension handler. - internal DscNodeExtensionHandlerAssociationProperty(string name, string version) + /// Keeps track of any properties unknown to the library. + internal DscNodeExtensionHandlerAssociationProperty(string name, string version, Dictionary serializedAdditionalRawData) { Name = name; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the extension handler. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.Serialization.cs index 1fc81ab692cc..7175a7150b6c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.Serialization.cs @@ -5,17 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscNodeListResult + internal partial class DscNodeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeListResult DeserializeDscNodeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsDefined(TotalCount)) + { + writer.WritePropertyName("totalCount"u8); + writer.WriteNumberValue(TotalCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeListResult DeserializeDscNodeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +77,7 @@ internal static DscNodeListResult DeserializeDscNodeListResult(JsonElement eleme Optional> value = default; Optional nextLink = default; Optional totalCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +108,61 @@ internal static DscNodeListResult DeserializeDscNodeListResult(JsonElement eleme totalCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeListResult(Optional.ToList(value), nextLink.Value, Optional.ToNullable(totalCount)); + return new DscNodeListResult(Optional.ToList(value), nextLink.Value, Optional.ToNullable(totalCount), serializedAdditionalRawData); + } + + DscNodeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.cs index 617729e98804..6da65b1d9a7f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list dsc nodes operation. internal partial class DscNodeListResult { - /// Initializes a new instance of DscNodeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DscNodeListResult. + /// Initializes a new instance of . /// Gets or sets a list of dsc nodes. /// Gets or sets the next link. /// Gets the total number of nodes matching filter criteria. - internal DscNodeListResult(IReadOnlyList value, string nextLink, int? totalCount) + /// Keeps track of any properties unknown to the library. + internal DscNodeListResult(IReadOnlyList value, string nextLink, int? totalCount, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; TotalCount = totalCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of dsc nodes. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.Serialization.cs index 6c43b0a269a1..4a785154d316 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscNodePatch : IUtf8JsonSerializable + public partial class DscNodePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NodeId)) { @@ -23,9 +31,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static DscNodePatch DeserializeDscNodePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nodeId = default; + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nodeId"u8)) + { + nodeId = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DscNodeUpdateParametersProperties.DeserializeDscNodeUpdateParametersProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscNodePatch(nodeId.Value, properties.Value, serializedAdditionalRawData); + } + + DscNodePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.cs index bd97efab530c..4c26f62c08e8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodePatch.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the update dsc node operation. public partial class DscNodePatch { - /// Initializes a new instance of DscNodePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscNodePatch() { } + /// Initializes a new instance of . + /// Gets or sets the id of the dsc node. + /// + /// Keeps track of any properties unknown to the library. + internal DscNodePatch(string nodeId, DscNodeUpdateParametersProperties properties, Dictionary serializedAdditionalRawData) + { + NodeId = nodeId; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the id of the dsc node. public string NodeId { get; set; } /// Gets or sets the properties. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.Serialization.cs index 3dcea62dc002..1dda72d89183 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.Serialization.cs @@ -8,14 +8,190 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscNodeReport + public partial class DscNodeReport : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeReport DeserializeDscNodeReport(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(EndOn)) + { + if (EndOn != null) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + else + { + writer.WriteNull("endTime"); + } + } + if (Optional.IsDefined(LastModifiedOn)) + { + writer.WritePropertyName("lastModifiedTime"u8); + writer.WriteStringValue(LastModifiedOn.Value, "O"); + } + if (Optional.IsDefined(StartOn)) + { + if (StartOn != null) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + else + { + writer.WriteNull("startTime"); + } + } + if (Optional.IsDefined(DscNodeReportType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DscNodeReportType); + } + if (Optional.IsDefined(ReportId)) + { + writer.WritePropertyName("reportId"u8); + writer.WriteStringValue(ReportId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(RefreshMode)) + { + writer.WritePropertyName("refreshMode"u8); + writer.WriteStringValue(RefreshMode); + } + if (Optional.IsDefined(RebootRequested)) + { + writer.WritePropertyName("rebootRequested"u8); + writer.WriteStringValue(RebootRequested); + } + if (Optional.IsDefined(ReportFormatVersion)) + { + writer.WritePropertyName("reportFormatVersion"u8); + writer.WriteStringValue(ReportFormatVersion); + } + if (Optional.IsDefined(ConfigurationVersion)) + { + writer.WritePropertyName("configurationVersion"u8); + writer.WriteStringValue(ConfigurationVersion); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Resources)) + { + writer.WritePropertyName("resources"u8); + writer.WriteStartArray(); + foreach (var item in Resources) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(MetaConfiguration)) + { + writer.WritePropertyName("metaConfiguration"u8); + if (MetaConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MetaConfiguration).Serialize(writer, options); + } + } + if (Optional.IsDefined(HostName)) + { + writer.WritePropertyName("hostName"u8); + writer.WriteStringValue(HostName); + } + if (Optional.IsCollectionDefined(IPV4Addresses)) + { + writer.WritePropertyName("iPV4Addresses"u8); + writer.WriteStartArray(); + foreach (var item in IPV4Addresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IPV6Addresses)) + { + writer.WritePropertyName("iPV6Addresses"u8); + writer.WriteStartArray(); + foreach (var item in IPV6Addresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NumberOfResources)) + { + writer.WritePropertyName("numberOfResources"u8); + writer.WriteNumberValue(NumberOfResources.Value); + } + if (Optional.IsDefined(RawErrors)) + { + writer.WritePropertyName("rawErrors"u8); + writer.WriteStringValue(RawErrors); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeReport DeserializeDscNodeReport(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +215,7 @@ internal static DscNodeReport DeserializeDscNodeReport(JsonElement element) Optional> ipV6Addresses = default; Optional numberOfResources = default; Optional rawErrors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endTime"u8)) @@ -194,8 +371,61 @@ internal static DscNodeReport DeserializeDscNodeReport(JsonElement element) rawErrors = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeReport(Optional.ToNullable(endTime), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(startTime), type.Value, reportId.Value, status.Value, refreshMode.Value, rebootRequested.Value, reportFormatVersion.Value, configurationVersion.Value, id.Value, Optional.ToList(errors), Optional.ToList(resources), metaConfiguration.Value, hostName.Value, Optional.ToList(ipV4Addresses), Optional.ToList(ipV6Addresses), Optional.ToNullable(numberOfResources), rawErrors.Value); + return new DscNodeReport(Optional.ToNullable(endTime), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(startTime), type.Value, reportId.Value, status.Value, refreshMode.Value, rebootRequested.Value, reportFormatVersion.Value, configurationVersion.Value, id.Value, Optional.ToList(errors), Optional.ToList(resources), metaConfiguration.Value, hostName.Value, Optional.ToList(ipV4Addresses), Optional.ToList(ipV6Addresses), Optional.ToNullable(numberOfResources), rawErrors.Value, serializedAdditionalRawData); + } + + DscNodeReport IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeReport(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeReport IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeReport(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeReport model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeReport(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeReport(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.cs index 776cc9d9f7a2..47145e777b66 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReport.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the dsc node report type. public partial class DscNodeReport { - /// Initializes a new instance of DscNodeReport. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeReport() { Errors = new ChangeTrackingList(); @@ -23,7 +26,7 @@ internal DscNodeReport() IPV6Addresses = new ChangeTrackingList(); } - /// Initializes a new instance of DscNodeReport. + /// Initializes a new instance of . /// Gets or sets the end time of the node report. /// Gets or sets the lastModifiedTime of the node report. /// Gets or sets the start time of the node report. @@ -43,7 +46,8 @@ internal DscNodeReport() /// Gets or sets the IPv6 address of the node that sent the report. /// Gets or sets the number of resource in the node report. /// Gets or sets the unparsed errors for the node report. - internal DscNodeReport(DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, DateTimeOffset? startOn, string dscNodeReportType, string reportId, string status, string refreshMode, string rebootRequested, string reportFormatVersion, string configurationVersion, string id, IReadOnlyList errors, IReadOnlyList resources, DscMetaConfiguration metaConfiguration, string hostName, IReadOnlyList ipV4Addresses, IReadOnlyList ipV6Addresses, int? numberOfResources, string rawErrors) + /// Keeps track of any properties unknown to the library. + internal DscNodeReport(DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, DateTimeOffset? startOn, string dscNodeReportType, string reportId, string status, string refreshMode, string rebootRequested, string reportFormatVersion, string configurationVersion, string id, IReadOnlyList errors, IReadOnlyList resources, DscMetaConfiguration metaConfiguration, string hostName, IReadOnlyList ipV4Addresses, IReadOnlyList ipV6Addresses, int? numberOfResources, string rawErrors, Dictionary serializedAdditionalRawData) { EndOn = endOn; LastModifiedOn = lastModifiedOn; @@ -64,6 +68,7 @@ internal DscNodeReport(DateTimeOffset? endOn, DateTimeOffset? lastModifiedOn, Da IPV6Addresses = ipV6Addresses; NumberOfResources = numberOfResources; RawErrors = rawErrors; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the end time of the node report. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.Serialization.cs index 1f80fae5ec8e..9fc1f5fa4139 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscNodeReportListResult + internal partial class DscNodeReportListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscNodeReportListResult DeserializeDscNodeReportListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscNodeReportListResult DeserializeDscNodeReportListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static DscNodeReportListResult DeserializeDscNodeReportListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscNodeReportListResult(Optional.ToList(value), nextLink.Value); + return new DscNodeReportListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DscNodeReportListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeReportListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeReportListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeReportListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeReportListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeReportListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeReportListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.cs index 4ac92bb3b309..c4f0dba309ed 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeReportListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list dsc nodes operation. internal partial class DscNodeReportListResult { - /// Initializes a new instance of DscNodeReportListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscNodeReportListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DscNodeReportListResult. + /// Initializes a new instance of . /// Gets or sets a list of dsc node reports. /// Gets or sets the next link. - internal DscNodeReportListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DscNodeReportListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of dsc node reports. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.Serialization.cs index b9d91bb3cd85..156e94e066a6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class DscNodeUpdateParametersProperties : IUtf8JsonSerializable + internal partial class DscNodeUpdateParametersProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("nodeConfiguration"u8); writer.WriteStartObject(); @@ -23,7 +31,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Name); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DscNodeUpdateParametersProperties DeserializeDscNodeUpdateParametersProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nodeConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("name"u8)) + { + name = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscNodeUpdateParametersProperties(name.Value, serializedAdditionalRawData); + } + + DscNodeUpdateParametersProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscNodeUpdateParametersProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscNodeUpdateParametersProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscNodeUpdateParametersProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscNodeUpdateParametersProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscNodeUpdateParametersProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscNodeUpdateParametersProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.cs index 33a3a5fcd52b..5faaa720ecc0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscNodeUpdateParametersProperties.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The DscNodeUpdateParametersProperties. internal partial class DscNodeUpdateParametersProperties { - /// Initializes a new instance of DscNodeUpdateParametersProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DscNodeUpdateParametersProperties() { } + /// Initializes a new instance of . + /// Gets or sets the name of the dsc node configuration. + /// Keeps track of any properties unknown to the library. + internal DscNodeUpdateParametersProperties(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the dsc node configuration. public string Name { get; set; } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.Serialization.cs index e0f854035801..06b923345825 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.Serialization.cs @@ -5,15 +5,73 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscReportError + public partial class DscReportError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscReportError DeserializeDscReportError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ErrorSource)) + { + writer.WritePropertyName("errorSource"u8); + writer.WriteStringValue(ErrorSource); + } + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ErrorCode)) + { + writer.WritePropertyName("errorCode"u8); + writer.WriteStringValue(ErrorCode); + } + if (Optional.IsDefined(ErrorMessage)) + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + if (Optional.IsDefined(Locale)) + { + writer.WritePropertyName("locale"u8); + writer.WriteStringValue(Locale); + } + if (Optional.IsDefined(ErrorDetails)) + { + writer.WritePropertyName("errorDetails"u8); + writer.WriteStringValue(ErrorDetails); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscReportError DeserializeDscReportError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static DscReportError DeserializeDscReportError(JsonElement element) Optional errorMessage = default; Optional locale = default; Optional errorDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errorSource"u8)) @@ -56,8 +115,61 @@ internal static DscReportError DeserializeDscReportError(JsonElement element) errorDetails = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscReportError(errorSource.Value, resourceId.Value, errorCode.Value, errorMessage.Value, locale.Value, errorDetails.Value); + return new DscReportError(errorSource.Value, resourceId.Value, errorCode.Value, errorMessage.Value, locale.Value, errorDetails.Value, serializedAdditionalRawData); + } + + DscReportError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscReportError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscReportError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscReportError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscReportError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscReportError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscReportError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.cs index bc7c4b57eb5f..0510d962034e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportError.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the dsc node report error type. public partial class DscReportError { - /// Initializes a new instance of DscReportError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscReportError() { } - /// Initializes a new instance of DscReportError. + /// Initializes a new instance of . /// Gets or sets the source of the error. /// Gets or sets the resource ID which generated the error. /// Gets or sets the error code. /// Gets or sets the error message. /// Gets or sets the locale of the error. /// Gets or sets the error details. - internal DscReportError(string errorSource, string resourceId, string errorCode, string errorMessage, string locale, string errorDetails) + /// Keeps track of any properties unknown to the library. + internal DscReportError(string errorSource, string resourceId, string errorCode, string errorMessage, string locale, string errorDetails, Dictionary serializedAdditionalRawData) { ErrorSource = errorSource; ResourceId = resourceId; @@ -30,6 +37,7 @@ internal DscReportError(string errorSource, string resourceId, string errorCode, ErrorMessage = errorMessage; Locale = locale; ErrorDetails = errorDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the source of the error. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.Serialization.cs index cdc951dfc40d..0fbf706b22cd 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.Serialization.cs @@ -8,14 +8,102 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscReportResource + public partial class DscReportResource : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscReportResource DeserializeDscReportResource(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(SourceInfo)) + { + writer.WritePropertyName("sourceInfo"u8); + writer.WriteStringValue(SourceInfo); + } + if (Optional.IsCollectionDefined(DependsOn)) + { + writer.WritePropertyName("dependsOn"u8); + writer.WriteStartArray(); + foreach (var item in DependsOn) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ModuleName)) + { + writer.WritePropertyName("moduleName"u8); + writer.WriteStringValue(ModuleName); + } + if (Optional.IsDefined(ModuleVersion)) + { + writer.WritePropertyName("moduleVersion"u8); + writer.WriteStringValue(ModuleVersion); + } + if (Optional.IsDefined(ResourceName)) + { + writer.WritePropertyName("resourceName"u8); + writer.WriteStringValue(ResourceName); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteStringValue(Error); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(DurationInSeconds)) + { + writer.WritePropertyName("durationInSeconds"u8); + writer.WriteNumberValue(DurationInSeconds.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDate"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscReportResource DeserializeDscReportResource(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +118,7 @@ internal static DscReportResource DeserializeDscReportResource(JsonElement eleme Optional status = default; Optional durationInSeconds = default; Optional startDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -99,8 +188,61 @@ internal static DscReportResource DeserializeDscReportResource(JsonElement eleme startDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DscReportResource(resourceId.Value, sourceInfo.Value, Optional.ToList(dependsOn), moduleName.Value, moduleVersion.Value, resourceName.Value, error.Value, status.Value, Optional.ToNullable(durationInSeconds), Optional.ToNullable(startDate), serializedAdditionalRawData); + } + + DscReportResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscReportResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscReportResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscReportResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscReportResource model) + { + if (model is null) + { + return null; } - return new DscReportResource(resourceId.Value, sourceInfo.Value, Optional.ToList(dependsOn), moduleName.Value, moduleVersion.Value, resourceName.Value, error.Value, status.Value, Optional.ToNullable(durationInSeconds), Optional.ToNullable(startDate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscReportResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscReportResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.cs index 65d6e5709f19..7a14b46e9acf 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResource.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the DSC Report Resource. public partial class DscReportResource { - /// Initializes a new instance of DscReportResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscReportResource() { DependsOn = new ChangeTrackingList(); } - /// Initializes a new instance of DscReportResource. + /// Initializes a new instance of . /// Gets or sets the ID of the resource. /// Gets or sets the source info of the resource. /// Gets or sets the Resource Navigation values for resources the resource depends on. @@ -31,7 +34,8 @@ internal DscReportResource() /// Gets or sets the status of the resource. /// Gets or sets the duration in seconds for the resource. /// Gets or sets the start date of the resource. - internal DscReportResource(string resourceId, string sourceInfo, IReadOnlyList dependsOn, string moduleName, string moduleVersion, string resourceName, string error, string status, double? durationInSeconds, DateTimeOffset? startOn) + /// Keeps track of any properties unknown to the library. + internal DscReportResource(string resourceId, string sourceInfo, IReadOnlyList dependsOn, string moduleName, string moduleVersion, string resourceName, string error, string status, double? durationInSeconds, DateTimeOffset? startOn, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; SourceInfo = sourceInfo; @@ -43,6 +47,7 @@ internal DscReportResource(string resourceId, string sourceInfo, IReadOnlyList Gets or sets the ID of the resource. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.Serialization.cs index 73b274dee7ed..8cbb53721cc7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class DscReportResourceNavigation + public partial class DscReportResourceNavigation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DscReportResourceNavigation DeserializeDscReportResourceNavigation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DscReportResourceNavigation DeserializeDscReportResourceNavigation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -26,8 +60,61 @@ internal static DscReportResourceNavigation DeserializeDscReportResourceNavigati resourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DscReportResourceNavigation(resourceId.Value); + return new DscReportResourceNavigation(resourceId.Value, serializedAdditionalRawData); + } + + DscReportResourceNavigation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDscReportResourceNavigation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DscReportResourceNavigation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDscReportResourceNavigation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DscReportResourceNavigation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DscReportResourceNavigation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDscReportResourceNavigation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.cs index d7b584881fc2..9147dd24dd3d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/DscReportResourceNavigation.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Navigation for DSC Report Resource. public partial class DscReportResourceNavigation { - /// Initializes a new instance of DscReportResourceNavigation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DscReportResourceNavigation() { } - /// Initializes a new instance of DscReportResourceNavigation. + /// Initializes a new instance of . /// Gets or sets the ID of the resource to navigate to. - internal DscReportResourceNavigation(string resourceId) + /// Keeps track of any properties unknown to the library. + internal DscReportResourceNavigation(string resourceId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the ID of the resource to navigate to. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.Serialization.cs index 7d7381409bf5..57a9f078f591 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class EncryptionPropertiesIdentity : IUtf8JsonSerializable + internal partial class EncryptionPropertiesIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserAssignedIdentity)) { @@ -25,16 +32,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(UserAssignedIdentity.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EncryptionPropertiesIdentity DeserializeEncryptionPropertiesIdentity(JsonElement element) + internal static EncryptionPropertiesIdentity DeserializeEncryptionPropertiesIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional userAssignedIdentity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userAssignedIdentity"u8)) @@ -46,8 +68,61 @@ internal static EncryptionPropertiesIdentity DeserializeEncryptionPropertiesIden userAssignedIdentity = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EncryptionPropertiesIdentity(userAssignedIdentity.Value); + return new EncryptionPropertiesIdentity(userAssignedIdentity.Value, serializedAdditionalRawData); + } + + EncryptionPropertiesIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionPropertiesIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EncryptionPropertiesIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEncryptionPropertiesIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EncryptionPropertiesIdentity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EncryptionPropertiesIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEncryptionPropertiesIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.cs index 8c66143f1294..19086b0441d7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/EncryptionPropertiesIdentity.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// User identity used for CMK. internal partial class EncryptionPropertiesIdentity { - /// Initializes a new instance of EncryptionPropertiesIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EncryptionPropertiesIdentity() { } - /// Initializes a new instance of EncryptionPropertiesIdentity. + /// Initializes a new instance of . /// The user identity used for CMK. It will be an ARM resource id in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - internal EncryptionPropertiesIdentity(BinaryData userAssignedIdentity) + /// Keeps track of any properties unknown to the library. + internal EncryptionPropertiesIdentity(BinaryData userAssignedIdentity, Dictionary serializedAdditionalRawData) { UserAssignedIdentity = userAssignedIdentity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.Serialization.cs index 9cbbfa0b460e..25e5c9598a1d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class GraphicalRunbookContent : IUtf8JsonSerializable + public partial class GraphicalRunbookContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RawContent)) { if (RawContent != null) { writer.WritePropertyName("rawContent"u8); - writer.WriteObjectValue(RawContent); + if (RawContent is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RawContent).Serialize(writer, options); + } } else { @@ -39,17 +54,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("graphRunbookJson"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GraphicalRunbookContent DeserializeGraphicalRunbookContent(JsonElement element) + internal static GraphicalRunbookContent DeserializeGraphicalRunbookContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional rawContent = default; Optional graphRunbookJson = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rawContent"u8)) @@ -72,8 +102,61 @@ internal static GraphicalRunbookContent DeserializeGraphicalRunbookContent(JsonE graphRunbookJson = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GraphicalRunbookContent(rawContent.Value, graphRunbookJson.Value, serializedAdditionalRawData); + } + + GraphicalRunbookContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphicalRunbookContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphicalRunbookContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphicalRunbookContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphicalRunbookContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphicalRunbookContent(Response response) + { + if (response is null) + { + return null; } - return new GraphicalRunbookContent(rawContent.Value, graphRunbookJson.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphicalRunbookContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.cs index 2d51526a2ce5..1fb6456b50e0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/GraphicalRunbookContent.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Graphical Runbook Content. public partial class GraphicalRunbookContent { - /// Initializes a new instance of GraphicalRunbookContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GraphicalRunbookContent() { } - /// Initializes a new instance of GraphicalRunbookContent. + /// Initializes a new instance of . /// Raw graphical Runbook content. /// Graphical Runbook content as JSON. - internal GraphicalRunbookContent(RawGraphicalRunbookContent rawContent, string graphRunbookJson) + /// Keeps track of any properties unknown to the library. + internal GraphicalRunbookContent(RawGraphicalRunbookContent rawContent, string graphRunbookJson, Dictionary serializedAdditionalRawData) { RawContent = rawContent; GraphRunbookJson = graphRunbookJson; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Raw graphical Runbook content. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.Serialization.cs index daf9a3f9f180..90c419153fe0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class HybridRunbookWorkerCreateOrUpdateContent : IUtf8JsonSerializable + public partial class HybridRunbookWorkerCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -28,7 +36,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VmResourceId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HybridRunbookWorkerCreateOrUpdateContent DeserializeHybridRunbookWorkerCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional vmResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("vmResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vmResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HybridRunbookWorkerCreateOrUpdateContent(name.Value, vmResourceId.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkerCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkerCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkerCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkerCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkerCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkerCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkerCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.cs index b44d52ebd9c1..f1e32438c9fd 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerCreateOrUpdateContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create hybrid runbook worker operation. public partial class HybridRunbookWorkerCreateOrUpdateContent { - /// Initializes a new instance of HybridRunbookWorkerCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HybridRunbookWorkerCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Azure Resource Manager Id for a virtual machine. + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkerCreateOrUpdateContent(string name, ResourceIdentifier vmResourceId, Dictionary serializedAdditionalRawData) + { + Name = name; + VmResourceId = vmResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the resource. public string Name { get; set; } /// Azure Resource Manager Id for a virtual machine. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerData.Serialization.cs index a724cf760816..661418387aa9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class HybridRunbookWorkerData : IUtf8JsonSerializable + public partial class HybridRunbookWorkerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(WorkerName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HybridRunbookWorkerData DeserializeHybridRunbookWorkerData(JsonElement element) + internal static HybridRunbookWorkerData DeserializeHybridRunbookWorkerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +91,7 @@ internal static HybridRunbookWorkerData DeserializeHybridRunbookWorkerData(JsonE Optional vmResourceId = default; Optional workerType = default; Optional workerName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -154,8 +176,61 @@ internal static HybridRunbookWorkerData DeserializeHybridRunbookWorkerData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HybridRunbookWorkerData(id, name, type, systemData.Value, ip.Value, Optional.ToNullable(registeredDateTime), Optional.ToNullable(lastSeenDateTime), vmResourceId.Value, Optional.ToNullable(workerType), workerName.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkerData model) + { + if (model is null) + { + return null; } - return new HybridRunbookWorkerData(id, name, type, systemData.Value, ip.Value, Optional.ToNullable(registeredDateTime), Optional.ToNullable(lastSeenDateTime), vmResourceId.Value, Optional.ToNullable(workerType), workerName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkerData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.Serialization.cs index d0eca6081649..c916fee04ee1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class HybridRunbookWorkerGroupCreateOrUpdateContent : IUtf8JsonSerializable + public partial class HybridRunbookWorkerGroupCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,10 +33,125 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HybridRunbookWorkerGroupCreateOrUpdateContent DeserializeHybridRunbookWorkerGroupCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional credential = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("credential"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + credential = RunAsCredentialAssociationProperty.DeserializeRunAsCredentialAssociationProperty(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HybridRunbookWorkerGroupCreateOrUpdateContent(name.Value, credential.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkerGroupCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkerGroupCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkerGroupCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkerGroupCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkerGroupCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkerGroupCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkerGroupCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.cs index 4e82b5520164..177fd15ea2fc 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The parameters supplied to the create hybrid runbook worker group operation. public partial class HybridRunbookWorkerGroupCreateOrUpdateContent { - /// Initializes a new instance of HybridRunbookWorkerGroupCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HybridRunbookWorkerGroupCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Gets or sets the name of the resource. + /// Sets the credential of a worker group. + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkerGroupCreateOrUpdateContent(string name, RunAsCredentialAssociationProperty credential, Dictionary serializedAdditionalRawData) + { + Name = name; + Credential = credential; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the resource. public string Name { get; set; } /// Sets the credential of a worker group. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupData.Serialization.cs index 68016053d295..be855a9069d8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class HybridRunbookWorkerGroupData : IUtf8JsonSerializable + public partial class HybridRunbookWorkerGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -27,14 +35,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HybridRunbookWorkerGroupData DeserializeHybridRunbookWorkerGroupData(JsonElement element) + internal static HybridRunbookWorkerGroupData DeserializeHybridRunbookWorkerGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +74,7 @@ internal static HybridRunbookWorkerGroupData DeserializeHybridRunbookWorkerGroup Optional systemData = default; Optional groupType = default; Optional credential = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -101,8 +131,61 @@ internal static HybridRunbookWorkerGroupData DeserializeHybridRunbookWorkerGroup } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HybridRunbookWorkerGroupData(id, name, type, systemData.Value, Optional.ToNullable(groupType), credential.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkerGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkerGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkerGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkerGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkerGroupData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkerGroupData(Response response) + { + if (response is null) + { + return null; } - return new HybridRunbookWorkerGroupData(id, name, type, systemData.Value, Optional.ToNullable(groupType), credential.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkerGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.Serialization.cs index e3d1d202f8b8..03e38bb584ca 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class HybridRunbookWorkerGroupsListResult + internal partial class HybridRunbookWorkerGroupsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HybridRunbookWorkerGroupsListResult DeserializeHybridRunbookWorkerGroupsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HybridRunbookWorkerGroupsListResult DeserializeHybridRunbookWorkerGroupsListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static HybridRunbookWorkerGroupsListResult DeserializeHybridRunbookWork nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HybridRunbookWorkerGroupsListResult(Optional.ToList(value), nextLink.Value); + return new HybridRunbookWorkerGroupsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkerGroupsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkerGroupsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkerGroupsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkerGroupsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkerGroupsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkerGroupsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkerGroupsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.cs index faea1f5385ff..45d82d3757b1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerGroupsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list hybrid runbook worker groups. internal partial class HybridRunbookWorkerGroupsListResult { - /// Initializes a new instance of HybridRunbookWorkerGroupsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HybridRunbookWorkerGroupsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HybridRunbookWorkerGroupsListResult. + /// Initializes a new instance of . /// Gets or sets a list of hybrid runbook worker groups. /// Gets or sets the next link. - internal HybridRunbookWorkerGroupsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkerGroupsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of hybrid runbook worker groups. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.Serialization.cs index e3199388fcea..c24099f228e3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class HybridRunbookWorkerMoveContent : IUtf8JsonSerializable + public partial class HybridRunbookWorkerMoveContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HybridRunbookWorkerGroupName)) { writer.WritePropertyName("hybridRunbookWorkerGroupName"u8); writer.WriteStringValue(HybridRunbookWorkerGroupName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HybridRunbookWorkerMoveContent DeserializeHybridRunbookWorkerMoveContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hybridRunbookWorkerGroupName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hybridRunbookWorkerGroupName"u8)) + { + hybridRunbookWorkerGroupName = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HybridRunbookWorkerMoveContent(hybridRunbookWorkerGroupName.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkerMoveContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkerMoveContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkerMoveContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkerMoveContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkerMoveContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkerMoveContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkerMoveContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.cs index 4c8abd331d57..c310610b90ea 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkerMoveContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Parameters supplied to move hybrid worker operation. public partial class HybridRunbookWorkerMoveContent { - /// Initializes a new instance of HybridRunbookWorkerMoveContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HybridRunbookWorkerMoveContent() { } + /// Initializes a new instance of . + /// Gets or sets the target hybrid runbook worker group. + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkerMoveContent(string hybridRunbookWorkerGroupName, Dictionary serializedAdditionalRawData) + { + HybridRunbookWorkerGroupName = hybridRunbookWorkerGroupName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the target hybrid runbook worker group. public string HybridRunbookWorkerGroupName { get; set; } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.Serialization.cs index cf86c32e3312..5ab99454f0ad 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation; namespace Azure.ResourceManager.Automation.Models { - internal partial class HybridRunbookWorkersListResult + internal partial class HybridRunbookWorkersListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HybridRunbookWorkersListResult DeserializeHybridRunbookWorkersListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HybridRunbookWorkersListResult DeserializeHybridRunbookWorkersListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static HybridRunbookWorkersListResult DeserializeHybridRunbookWorkersLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HybridRunbookWorkersListResult(Optional.ToList(value), nextLink.Value); + return new HybridRunbookWorkersListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HybridRunbookWorkersListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridRunbookWorkersListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridRunbookWorkersListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridRunbookWorkersListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridRunbookWorkersListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridRunbookWorkersListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridRunbookWorkersListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.cs index 3ab146d0d872..a75fd514ac58 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/HybridRunbookWorkersListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list hybrid runbook workers. internal partial class HybridRunbookWorkersListResult { - /// Initializes a new instance of HybridRunbookWorkersListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HybridRunbookWorkersListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HybridRunbookWorkersListResult. + /// Initializes a new instance of . /// Gets or sets a list of hybrid runbook workers. /// Gets or sets the next link. - internal HybridRunbookWorkersListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HybridRunbookWorkersListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a list of hybrid runbook workers. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.Serialization.cs index 97e88733bb2b..916b32bdc37a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.Serialization.cs @@ -6,20 +6,48 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class JobNavigation + internal partial class JobNavigation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JobNavigation DeserializeJobNavigation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JobNavigation DeserializeJobNavigation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -31,8 +59,61 @@ internal static JobNavigation DeserializeJobNavigation(JsonElement element) id = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new JobNavigation(Optional.ToNullable(id)); + return new JobNavigation(Optional.ToNullable(id), serializedAdditionalRawData); + } + + JobNavigation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobNavigation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobNavigation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobNavigation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobNavigation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobNavigation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobNavigation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.cs index 8d7a6b66a167..287a4ecb7827 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/JobNavigation.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// Software update configuration machine run job navigation properties. internal partial class JobNavigation { - /// Initializes a new instance of JobNavigation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal JobNavigation() { } - /// Initializes a new instance of JobNavigation. + /// Initializes a new instance of . /// Id of the job associated with the software update configuration run. - internal JobNavigation(Guid? id) + /// Keeps track of any properties unknown to the library. + internal JobNavigation(Guid? id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of the job associated with the software update configuration run. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.Serialization.cs index 66b6a24fba04..22bd5377ec73 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class LinuxUpdateConfigurationProperties : IUtf8JsonSerializable + public partial class LinuxUpdateConfigurationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IncludedPackageClassifications)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("rebootSetting"u8); writer.WriteStringValue(RebootSetting); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinuxUpdateConfigurationProperties DeserializeLinuxUpdateConfigurationProperties(JsonElement element) + internal static LinuxUpdateConfigurationProperties DeserializeLinuxUpdateConfigurationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static LinuxUpdateConfigurationProperties DeserializeLinuxUpdateConfigu Optional> excludedPackageNameMasks = default; Optional> includedPackageNameMasks = default; Optional rebootSetting = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("includedPackageClassifications"u8)) @@ -103,8 +125,61 @@ internal static LinuxUpdateConfigurationProperties DeserializeLinuxUpdateConfigu rebootSetting = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinuxUpdateConfigurationProperties(Optional.ToNullable(includedPackageClassifications), Optional.ToList(excludedPackageNameMasks), Optional.ToList(includedPackageNameMasks), rebootSetting.Value, serializedAdditionalRawData); + } + + LinuxUpdateConfigurationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinuxUpdateConfigurationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinuxUpdateConfigurationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinuxUpdateConfigurationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinuxUpdateConfigurationProperties model) + { + if (model is null) + { + return null; } - return new LinuxUpdateConfigurationProperties(Optional.ToNullable(includedPackageClassifications), Optional.ToList(excludedPackageNameMasks), Optional.ToList(includedPackageNameMasks), rebootSetting.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinuxUpdateConfigurationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinuxUpdateConfigurationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.cs index ebb31a4f0f97..1cd00f281ef0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/LinuxUpdateConfigurationProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Automation.Models /// Linux specific update configuration. public partial class LinuxUpdateConfigurationProperties { - /// Initializes a new instance of LinuxUpdateConfigurationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinuxUpdateConfigurationProperties() { ExcludedPackageNameMasks = new ChangeTrackingList(); IncludedPackageNameMasks = new ChangeTrackingList(); } - /// Initializes a new instance of LinuxUpdateConfigurationProperties. + /// Initializes a new instance of . /// Update classifications included in the software update configuration. /// packages excluded from the software update configuration. /// packages included from the software update configuration. /// Reboot setting for the software update configuration. - internal LinuxUpdateConfigurationProperties(LinuxUpdateClassification? includedPackageClassifications, IList excludedPackageNameMasks, IList includedPackageNameMasks, string rebootSetting) + /// Keeps track of any properties unknown to the library. + internal LinuxUpdateConfigurationProperties(LinuxUpdateClassification? includedPackageClassifications, IList excludedPackageNameMasks, IList includedPackageNameMasks, string rebootSetting, Dictionary serializedAdditionalRawData) { IncludedPackageClassifications = includedPackageClassifications; ExcludedPackageNameMasks = excludedPackageNameMasks; IncludedPackageNameMasks = includedPackageNameMasks; RebootSetting = rebootSetting; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Update classifications included in the software update configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.Serialization.cs index 6acb37a9d003..b18c2a842d2c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class NonAzureQueryProperties : IUtf8JsonSerializable + public partial class NonAzureQueryProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FunctionAlias)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("workspaceId"u8); writer.WriteStringValue(WorkspaceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NonAzureQueryProperties DeserializeNonAzureQueryProperties(JsonElement element) + internal static NonAzureQueryProperties DeserializeNonAzureQueryProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional functionAlias = default; Optional workspaceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("functionAlias"u8)) @@ -48,8 +71,61 @@ internal static NonAzureQueryProperties DeserializeNonAzureQueryProperties(JsonE workspaceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NonAzureQueryProperties(functionAlias.Value, workspaceId.Value, serializedAdditionalRawData); + } + + NonAzureQueryProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNonAzureQueryProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NonAzureQueryProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNonAzureQueryProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NonAzureQueryProperties model) + { + if (model is null) + { + return null; } - return new NonAzureQueryProperties(functionAlias.Value, workspaceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NonAzureQueryProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNonAzureQueryProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.cs index 495f3de1d3b1..e52ae4d17267 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/NonAzureQueryProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Non Azure query for the update configuration. public partial class NonAzureQueryProperties { - /// Initializes a new instance of NonAzureQueryProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NonAzureQueryProperties() { } - /// Initializes a new instance of NonAzureQueryProperties. + /// Initializes a new instance of . /// Log Analytics Saved Search name. /// Workspace Id for Log Analytics in which the saved Search is resided. - internal NonAzureQueryProperties(string functionAlias, string workspaceId) + /// Keeps track of any properties unknown to the library. + internal NonAzureQueryProperties(string functionAlias, string workspaceId, Dictionary serializedAdditionalRawData) { FunctionAlias = functionAlias; WorkspaceId = workspaceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Log Analytics Saved Search name. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.Serialization.cs index 65431f14b44b..6389174b879b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class QueryTagSettingsProperties : IUtf8JsonSerializable + public partial class QueryTagSettingsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -42,17 +49,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("filterOperator"u8); writer.WriteStringValue(FilterOperator.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static QueryTagSettingsProperties DeserializeQueryTagSettingsProperties(JsonElement element) + internal static QueryTagSettingsProperties DeserializeQueryTagSettingsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional>> tags = default; Optional filterOperator = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -90,8 +112,61 @@ internal static QueryTagSettingsProperties DeserializeQueryTagSettingsProperties filterOperator = property.Value.GetString().ToQueryTagOperator(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryTagSettingsProperties(Optional.ToDictionary(tags), Optional.ToNullable(filterOperator), serializedAdditionalRawData); + } + + QueryTagSettingsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryTagSettingsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryTagSettingsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryTagSettingsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryTagSettingsProperties model) + { + if (model is null) + { + return null; } - return new QueryTagSettingsProperties(Optional.ToDictionary(tags), Optional.ToNullable(filterOperator)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryTagSettingsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryTagSettingsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.cs index 3b4a14f97b53..7bdad307c5cb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/QueryTagSettingsProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// Tag filter information for the VM. public partial class QueryTagSettingsProperties { - /// Initializes a new instance of QueryTagSettingsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public QueryTagSettingsProperties() { Tags = new ChangeTrackingDictionary>(); } - /// Initializes a new instance of QueryTagSettingsProperties. + /// Initializes a new instance of . /// Dictionary of tags with its list of values. /// Filter VMs by Any or All specified tags. - internal QueryTagSettingsProperties(IDictionary> tags, QueryTagOperator? filterOperator) + /// Keeps track of any properties unknown to the library. + internal QueryTagSettingsProperties(IDictionary> tags, QueryTagOperator? filterOperator, Dictionary serializedAdditionalRawData) { Tags = tags; FilterOperator = filterOperator; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Dictionary of tags with its list of values. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.Serialization.cs index e44b7060f0c2..f7349933a4d7 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class RawGraphicalRunbookContent : IUtf8JsonSerializable + public partial class RawGraphicalRunbookContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SchemaVersion)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("runbookType"u8); writer.WriteStringValue(RunbookType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RawGraphicalRunbookContent DeserializeRawGraphicalRunbookContent(JsonElement element) + internal static RawGraphicalRunbookContent DeserializeRawGraphicalRunbookContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static RawGraphicalRunbookContent DeserializeRawGraphicalRunbookContent Optional schemaVersion = default; Optional runbookDefinition = default; Optional runbookType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schemaVersion"u8)) @@ -63,8 +86,61 @@ internal static RawGraphicalRunbookContent DeserializeRawGraphicalRunbookContent runbookType = new GraphRunbookType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RawGraphicalRunbookContent(schemaVersion.Value, runbookDefinition.Value, Optional.ToNullable(runbookType), serializedAdditionalRawData); + } + + RawGraphicalRunbookContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRawGraphicalRunbookContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RawGraphicalRunbookContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRawGraphicalRunbookContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RawGraphicalRunbookContent model) + { + if (model is null) + { + return null; } - return new RawGraphicalRunbookContent(schemaVersion.Value, runbookDefinition.Value, Optional.ToNullable(runbookType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RawGraphicalRunbookContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRawGraphicalRunbookContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.cs index 2a6482155913..d882b63aef9d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RawGraphicalRunbookContent.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Raw Graphical Runbook content. public partial class RawGraphicalRunbookContent { - /// Initializes a new instance of RawGraphicalRunbookContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RawGraphicalRunbookContent() { } - /// Initializes a new instance of RawGraphicalRunbookContent. + /// Initializes a new instance of . /// Schema version of the serializer. /// Serialized Graphical runbook. /// Runbook Type. - internal RawGraphicalRunbookContent(string schemaVersion, string runbookDefinition, GraphRunbookType? runbookType) + /// Keeps track of any properties unknown to the library. + internal RawGraphicalRunbookContent(string schemaVersion, string runbookDefinition, GraphRunbookType? runbookType, Dictionary serializedAdditionalRawData) { SchemaVersion = schemaVersion; RunbookDefinition = runbookDefinition; RunbookType = runbookType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Schema version of the serializer. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.Serialization.cs index 4d73c4571773..5d64a46be2c0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class RunAsCredentialAssociationProperty : IUtf8JsonSerializable + internal partial class RunAsCredentialAssociationProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RunAsCredentialAssociationProperty DeserializeRunAsCredentialAssociationProperty(JsonElement element) + internal static RunAsCredentialAssociationProperty DeserializeRunAsCredentialAssociationProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static RunAsCredentialAssociationProperty DeserializeRunAsCredentialAss name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunAsCredentialAssociationProperty(name.Value, serializedAdditionalRawData); + } + + RunAsCredentialAssociationProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunAsCredentialAssociationProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunAsCredentialAssociationProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunAsCredentialAssociationProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunAsCredentialAssociationProperty model) + { + if (model is null) + { + return null; } - return new RunAsCredentialAssociationProperty(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunAsCredentialAssociationProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunAsCredentialAssociationProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.cs index f7ba798bfe52..ae1b83880b90 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunAsCredentialAssociationProperty.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of RunAs credential to use for hybrid worker. internal partial class RunAsCredentialAssociationProperty { - /// Initializes a new instance of RunAsCredentialAssociationProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RunAsCredentialAssociationProperty() { } - /// Initializes a new instance of RunAsCredentialAssociationProperty. + /// Initializes a new instance of . /// Gets or sets the name of the credential. - internal RunAsCredentialAssociationProperty(string name) + /// Keeps track of any properties unknown to the library. + internal RunAsCredentialAssociationProperty(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the credential. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.Serialization.cs index 78435981ba36..bb323e3d51f9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class RunbookAssociationProperty : IUtf8JsonSerializable + public partial class RunbookAssociationProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RunbookAssociationProperty DeserializeRunbookAssociationProperty(JsonElement element) + internal static RunbookAssociationProperty DeserializeRunbookAssociationProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static RunbookAssociationProperty DeserializeRunbookAssociationProperty name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunbookAssociationProperty(name.Value, serializedAdditionalRawData); + } + + RunbookAssociationProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunbookAssociationProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunbookAssociationProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunbookAssociationProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunbookAssociationProperty model) + { + if (model is null) + { + return null; } - return new RunbookAssociationProperty(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunbookAssociationProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunbookAssociationProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.cs index 2cb971eb7685..f9577b20d0fa 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookAssociationProperty.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The runbook property associated with the entity. public partial class RunbookAssociationProperty { - /// Initializes a new instance of RunbookAssociationProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RunbookAssociationProperty() { } - /// Initializes a new instance of RunbookAssociationProperty. + /// Initializes a new instance of . /// Gets or sets the name of the runbook. - internal RunbookAssociationProperty(string name) + /// Keeps track of any properties unknown to the library. + internal RunbookAssociationProperty(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the runbook. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.Serialization.cs index 78a2e85adc7d..709b3f104072 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class RunbookDraftUndoEditResult + public partial class RunbookDraftUndoEditResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RunbookDraftUndoEditResult DeserializeRunbookDraftUndoEditResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(StatusCode)) + { + writer.WritePropertyName("statusCode"u8); + writer.WriteStringValue(StatusCode.Value.ToString()); + } + if (Optional.IsDefined(RequestId)) + { + writer.WritePropertyName("requestId"u8); + writer.WriteStringValue(RequestId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RunbookDraftUndoEditResult DeserializeRunbookDraftUndoEditResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional statusCode = default; Optional requestId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("statusCode"u8)) @@ -36,8 +75,61 @@ internal static RunbookDraftUndoEditResult DeserializeRunbookDraftUndoEditResult requestId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RunbookDraftUndoEditResult(Optional.ToNullable(statusCode), requestId.Value); + return new RunbookDraftUndoEditResult(Optional.ToNullable(statusCode), requestId.Value, serializedAdditionalRawData); + } + + RunbookDraftUndoEditResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunbookDraftUndoEditResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunbookDraftUndoEditResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunbookDraftUndoEditResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunbookDraftUndoEditResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunbookDraftUndoEditResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunbookDraftUndoEditResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.cs index 87339862de81..b73fcb768f8c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookDraftUndoEditResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The response model for the undo edit runbook operation. public partial class RunbookDraftUndoEditResult { - /// Initializes a new instance of RunbookDraftUndoEditResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RunbookDraftUndoEditResult() { } - /// Initializes a new instance of RunbookDraftUndoEditResult. + /// Initializes a new instance of . /// /// - internal RunbookDraftUndoEditResult(AutomationHttpStatusCode? statusCode, string requestId) + /// Keeps track of any properties unknown to the library. + internal RunbookDraftUndoEditResult(AutomationHttpStatusCode? statusCode, string requestId, Dictionary serializedAdditionalRawData) { StatusCode = statusCode; RequestId = requestId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the status code. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.Serialization.cs index 7f786a98c88b..7eda34dbb6b9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class RunbookParameterDefinition : IUtf8JsonSerializable + public partial class RunbookParameterDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RunbookParameterType)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("defaultValue"u8); writer.WriteStringValue(DefaultValue); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RunbookParameterDefinition DeserializeRunbookParameterDefinition(JsonElement element) + internal static RunbookParameterDefinition DeserializeRunbookParameterDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static RunbookParameterDefinition DeserializeRunbookParameterDefinition Optional isMandatory = default; Optional position = default; Optional defaultValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -78,8 +101,61 @@ internal static RunbookParameterDefinition DeserializeRunbookParameterDefinition defaultValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunbookParameterDefinition(type.Value, Optional.ToNullable(isMandatory), Optional.ToNullable(position), defaultValue.Value, serializedAdditionalRawData); + } + + RunbookParameterDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunbookParameterDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunbookParameterDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunbookParameterDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunbookParameterDefinition model) + { + if (model is null) + { + return null; } - return new RunbookParameterDefinition(type.Value, Optional.ToNullable(isMandatory), Optional.ToNullable(position), defaultValue.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunbookParameterDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunbookParameterDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.cs index b08330d64ca5..5ebb4332e25d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookParameterDefinition.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Definition of the runbook parameter type. public partial class RunbookParameterDefinition { - /// Initializes a new instance of RunbookParameterDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RunbookParameterDefinition() { } - /// Initializes a new instance of RunbookParameterDefinition. + /// Initializes a new instance of . /// Gets or sets the type of the parameter. /// Gets or sets a Boolean value to indicate whether the parameter is mandatory or not. /// Get or sets the position of the parameter. /// Gets or sets the default value of parameter. - internal RunbookParameterDefinition(string runbookParameterType, bool? isMandatory, int? position, string defaultValue) + /// Keeps track of any properties unknown to the library. + internal RunbookParameterDefinition(string runbookParameterType, bool? isMandatory, int? position, string defaultValue, Dictionary serializedAdditionalRawData) { RunbookParameterType = runbookParameterType; IsMandatory = isMandatory; Position = position; DefaultValue = defaultValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the type of the parameter. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.Serialization.cs index fe9dcaf6e66f..ca79a423e287 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.Serialization.cs @@ -8,14 +8,122 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class RunbookTestJob + public partial class RunbookTestJob : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RunbookTestJob DeserializeRunbookTestJob(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationTime"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(StatusDetails)) + { + writer.WritePropertyName("statusDetails"u8); + writer.WriteStringValue(StatusDetails); + } + if (Optional.IsDefined(RunOn)) + { + writer.WritePropertyName("runOn"u8); + writer.WriteStringValue(RunOn); + } + if (Optional.IsDefined(StartOn)) + { + if (StartOn != null) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + else + { + writer.WriteNull("startTime"); + } + } + if (Optional.IsDefined(EndOn)) + { + if (EndOn != null) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + else + { + writer.WriteNull("endTime"); + } + } + if (Optional.IsDefined(Exception)) + { + writer.WritePropertyName("exception"u8); + writer.WriteStringValue(Exception); + } + if (Optional.IsDefined(LastModifiedOn)) + { + writer.WritePropertyName("lastModifiedTime"u8); + writer.WriteStringValue(LastModifiedOn.Value, "O"); + } + if (Optional.IsDefined(LastStatusModifiedOn)) + { + if (LastStatusModifiedOn != null) + { + writer.WritePropertyName("lastStatusModifiedTime"u8); + writer.WriteStringValue(LastStatusModifiedOn.Value, "O"); + } + else + { + writer.WriteNull("lastStatusModifiedTime"); + } + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(LogActivityTrace)) + { + writer.WritePropertyName("logActivityTrace"u8); + writer.WriteNumberValue(LogActivityTrace.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RunbookTestJob DeserializeRunbookTestJob(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +139,7 @@ internal static RunbookTestJob DeserializeRunbookTestJob(JsonElement element) Optional lastStatusModifiedTime = default; Optional> parameters = default; Optional logActivityTrace = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("creationTime"u8)) @@ -124,8 +233,61 @@ internal static RunbookTestJob DeserializeRunbookTestJob(JsonElement element) logActivityTrace = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RunbookTestJob(Optional.ToNullable(creationTime), status.Value, statusDetails.Value, runOn.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), exception.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(lastStatusModifiedTime), Optional.ToDictionary(parameters), Optional.ToNullable(logActivityTrace)); + return new RunbookTestJob(Optional.ToNullable(creationTime), status.Value, statusDetails.Value, runOn.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), exception.Value, Optional.ToNullable(lastModifiedTime), Optional.ToNullable(lastStatusModifiedTime), Optional.ToDictionary(parameters), Optional.ToNullable(logActivityTrace), serializedAdditionalRawData); + } + + RunbookTestJob IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunbookTestJob(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunbookTestJob IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunbookTestJob(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunbookTestJob model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunbookTestJob(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunbookTestJob(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.cs index 5fadfedec586..69eb765d5b7d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJob.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the test job. public partial class RunbookTestJob { - /// Initializes a new instance of RunbookTestJob. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RunbookTestJob() { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of RunbookTestJob. + /// Initializes a new instance of . /// Gets or sets the creation time of the test job. /// Gets or sets the status of the test job. /// Gets or sets the status details of the test job. @@ -32,7 +35,8 @@ internal RunbookTestJob() /// Gets or sets the last status modified time of the test job. /// Gets or sets the parameters of the test job. /// The activity-level tracing options of the runbook. - internal RunbookTestJob(DateTimeOffset? createdOn, string status, string statusDetails, string runOn, DateTimeOffset? startOn, DateTimeOffset? endOn, string exception, DateTimeOffset? lastModifiedOn, DateTimeOffset? lastStatusModifiedOn, IReadOnlyDictionary parameters, int? logActivityTrace) + /// Keeps track of any properties unknown to the library. + internal RunbookTestJob(DateTimeOffset? createdOn, string status, string statusDetails, string runOn, DateTimeOffset? startOn, DateTimeOffset? endOn, string exception, DateTimeOffset? lastModifiedOn, DateTimeOffset? lastStatusModifiedOn, IReadOnlyDictionary parameters, int? logActivityTrace, Dictionary serializedAdditionalRawData) { CreatedOn = createdOn; Status = status; @@ -45,6 +49,7 @@ internal RunbookTestJob(DateTimeOffset? createdOn, string status, string statusD LastStatusModifiedOn = lastStatusModifiedOn; Parameters = parameters; LogActivityTrace = logActivityTrace; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the creation time of the test job. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.Serialization.cs index 017e2f76e34e..345f0c9d42d4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class RunbookTestJobCreateContent : IUtf8JsonSerializable + public partial class RunbookTestJobCreateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Parameters)) { @@ -31,7 +39,108 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("runOn"u8); writer.WriteStringValue(RunOn); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RunbookTestJobCreateContent DeserializeRunbookTestJobCreateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> parameters = default; + Optional runOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property.NameEquals("runOn"u8)) + { + runOn = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunbookTestJobCreateContent(Optional.ToDictionary(parameters), runOn.Value, serializedAdditionalRawData); + } + + RunbookTestJobCreateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunbookTestJobCreateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunbookTestJobCreateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunbookTestJobCreateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunbookTestJobCreateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunbookTestJobCreateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunbookTestJobCreateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.cs index 05eb744bd64c..13a80e1f4d60 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/RunbookTestJobCreateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create test job operation. public partial class RunbookTestJobCreateContent { - /// Initializes a new instance of RunbookTestJobCreateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RunbookTestJobCreateContent() { Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the parameters of the test job. + /// Gets or sets the runOn which specifies the group name where the job is to be executed. + /// Keeps track of any properties unknown to the library. + internal RunbookTestJobCreateContent(IDictionary parameters, string runOn, Dictionary serializedAdditionalRawData) + { + Parameters = parameters; + RunOn = runOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the parameters of the test job. public IDictionary Parameters { get; } /// Gets or sets the runOn which specifies the group name where the job is to be executed. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.Serialization.cs index 64dce64dc9f4..923623447bd3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class ScheduleAssociationProperty : IUtf8JsonSerializable + public partial class ScheduleAssociationProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScheduleAssociationProperty DeserializeScheduleAssociationProperty(JsonElement element) + internal static ScheduleAssociationProperty DeserializeScheduleAssociationProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static ScheduleAssociationProperty DeserializeScheduleAssociationProper name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScheduleAssociationProperty(name.Value, serializedAdditionalRawData); + } + + ScheduleAssociationProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleAssociationProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduleAssociationProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduleAssociationProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduleAssociationProperty model) + { + if (model is null) + { + return null; } - return new ScheduleAssociationProperty(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduleAssociationProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduleAssociationProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.cs index e79dcfa9b1ae..fd9a0bf4a8ce 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/ScheduleAssociationProperty.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The schedule property associated with the entity. public partial class ScheduleAssociationProperty { - /// Initializes a new instance of ScheduleAssociationProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScheduleAssociationProperty() { } - /// Initializes a new instance of ScheduleAssociationProperty. + /// Initializes a new instance of . /// Gets or sets the name of the Schedule. - internal ScheduleAssociationProperty(string name) + /// Keeps track of any properties unknown to the library. + internal ScheduleAssociationProperty(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the Schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.Serialization.cs index db27169db235..9b1a2052a6e5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.Serialization.cs @@ -6,15 +6,91 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationCollectionItem + public partial class SoftwareUpdateConfigurationCollectionItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationCollectionItem DeserializeSoftwareUpdateConfigurationCollectionItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UpdateConfiguration)) + { + writer.WritePropertyName("updateConfiguration"u8); + if (UpdateConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpdateConfiguration).Serialize(writer, options); + } + } + if (Optional.IsDefined(Tasks)) + { + writer.WritePropertyName("tasks"u8); + if (Tasks is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tasks).Serialize(writer, options); + } + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(NextRunOn)) + { + if (NextRunOn != null) + { + writer.WritePropertyName("nextRun"u8); + writer.WriteStringValue(NextRunOn.Value, "O"); + } + else + { + writer.WriteNull("nextRun"); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationCollectionItem DeserializeSoftwareUpdateConfigurationCollectionItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +105,7 @@ internal static SoftwareUpdateConfigurationCollectionItem DeserializeSoftwareUpd Optional lastModifiedTime = default; Optional provisioningState = default; Optional nextRun = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -126,8 +203,61 @@ internal static SoftwareUpdateConfigurationCollectionItem DeserializeSoftwareUpd } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareUpdateConfigurationCollectionItem(name.Value, id.Value, updateConfiguration.Value, tasks.Value, Optional.ToNullable(frequency), Optional.ToNullable(startTime), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), provisioningState.Value, Optional.ToNullable(nextRun), serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationCollectionItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationCollectionItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationCollectionItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationCollectionItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationCollectionItem model) + { + if (model is null) + { + return null; } - return new SoftwareUpdateConfigurationCollectionItem(name.Value, id.Value, updateConfiguration.Value, tasks.Value, Optional.ToNullable(frequency), Optional.ToNullable(startTime), Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), provisioningState.Value, Optional.ToNullable(nextRun)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationCollectionItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationCollectionItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.cs index 9d909ca04c7f..29e73831e3a1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationCollectionItem.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Automation.Models /// Software update configuration collection item properties. public partial class SoftwareUpdateConfigurationCollectionItem { - /// Initializes a new instance of SoftwareUpdateConfigurationCollectionItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationCollectionItem() { } - /// Initializes a new instance of SoftwareUpdateConfigurationCollectionItem. + /// Initializes a new instance of . /// Name of the software update configuration. /// Resource Id of the software update configuration. /// Update specific properties of the software update configuration. @@ -29,7 +33,8 @@ internal SoftwareUpdateConfigurationCollectionItem() /// Last time software update configuration was modified, which only appears in the response. /// Provisioning state for the software update configuration, which only appears in the response. /// ext run time of the update. - internal SoftwareUpdateConfigurationCollectionItem(string name, ResourceIdentifier id, SoftwareUpdateConfigurationSpecificProperties updateConfiguration, SoftwareUpdateConfigurationTasks tasks, AutomationScheduleFrequency? frequency, DateTimeOffset? startOn, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string provisioningState, DateTimeOffset? nextRunOn) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationCollectionItem(string name, ResourceIdentifier id, SoftwareUpdateConfigurationSpecificProperties updateConfiguration, SoftwareUpdateConfigurationTasks tasks, AutomationScheduleFrequency? frequency, DateTimeOffset? startOn, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string provisioningState, DateTimeOffset? nextRunOn, Dictionary serializedAdditionalRawData) { Name = name; Id = id; @@ -41,6 +46,7 @@ internal SoftwareUpdateConfigurationCollectionItem(string name, ResourceIdentifi LastModifiedOn = lastModifiedOn; ProvisioningState = provisioningState; NextRunOn = nextRunOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the software update configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationData.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationData.Serialization.cs index 0f7b51512cda..838281e9ddb2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationData.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationData.Serialization.cs @@ -6,40 +6,89 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation { - public partial class SoftwareUpdateConfigurationData : IUtf8JsonSerializable + public partial class SoftwareUpdateConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("updateConfiguration"u8); - writer.WriteObjectValue(UpdateConfiguration); + if (UpdateConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpdateConfiguration).Serialize(writer, options); + } writer.WritePropertyName("scheduleInfo"u8); - writer.WriteObjectValue(ScheduleInfo); + if (ScheduleInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduleInfo).Serialize(writer, options); + } if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } if (Optional.IsDefined(Tasks)) { writer.WritePropertyName("tasks"u8); - writer.WriteObjectValue(Tasks); + if (Tasks is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tasks).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SoftwareUpdateConfigurationData DeserializeSoftwareUpdateConfigurationData(JsonElement element) + internal static SoftwareUpdateConfigurationData DeserializeSoftwareUpdateConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +106,7 @@ internal static SoftwareUpdateConfigurationData DeserializeSoftwareUpdateConfigu Optional lastModifiedTime = default; Optional lastModifiedBy = default; Optional tasks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -156,8 +206,61 @@ internal static SoftwareUpdateConfigurationData DeserializeSoftwareUpdateConfigu } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationData(id, name, type, systemData.Value, updateConfiguration, scheduleInfo, provisioningState.Value, error.Value, Optional.ToNullable(creationTime), createdBy.Value, Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, tasks.Value); + return new SoftwareUpdateConfigurationData(id, name, type, systemData.Value, updateConfiguration, scheduleInfo, provisioningState.Value, error.Value, Optional.ToNullable(creationTime), createdBy.Value, Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, tasks.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.Serialization.cs index d1085a9159c9..ce359610b258 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class SoftwareUpdateConfigurationListResult + internal partial class SoftwareUpdateConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationListResult DeserializeSoftwareUpdateConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationListResult DeserializeSoftwareUpdateConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static SoftwareUpdateConfigurationListResult DeserializeSoftwareUpdateC value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationListResult(Optional.ToList(value)); + return new SoftwareUpdateConfigurationListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.cs index ebdfaab3c6e4..27142c32af09 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Automation.Models /// result of listing all software update configuration. internal partial class SoftwareUpdateConfigurationListResult { - /// Initializes a new instance of SoftwareUpdateConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SoftwareUpdateConfigurationListResult. + /// Initializes a new instance of . /// outer object returned when listing all software update configurations. - internal SoftwareUpdateConfigurationListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// outer object returned when listing all software update configurations. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.Serialization.cs index 19fc065a5f82..e374bcf5ac49 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.Serialization.cs @@ -6,15 +6,81 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationMachineRun + public partial class SoftwareUpdateConfigurationMachineRun : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationMachineRun DeserializeSoftwareUpdateConfigurationMachineRun(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SoftwareUpdateConfiguration)) + { + writer.WritePropertyName("softwareUpdateConfiguration"u8); + if (SoftwareUpdateConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SoftwareUpdateConfiguration).Serialize(writer, options); + } + } + if (Optional.IsDefined(Job)) + { + writer.WritePropertyName("job"u8); + if (Job is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Job).Serialize(writer, options); + } + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationMachineRun DeserializeSoftwareUpdateConfigurationMachineRun(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +103,7 @@ internal static SoftwareUpdateConfigurationMachineRun DeserializeSoftwareUpdateC Optional lastModifiedTime = default; Optional lastModifiedBy = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -190,8 +257,61 @@ internal static SoftwareUpdateConfigurationMachineRun DeserializeSoftwareUpdateC } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareUpdateConfigurationMachineRun(name.Value, id.Value, targetComputer.Value, targetComputerType.Value, softwareUpdateConfiguration.Value, status.Value, osType.Value, Optional.ToNullable(correlationId), Optional.ToNullable(sourceComputerId), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(configuredDuration), job.Value, Optional.ToNullable(creationTime), createdBy.Value, Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, error.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationMachineRun IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationMachineRun(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationMachineRun IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationMachineRun(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationMachineRun model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationMachineRun(Response response) + { + if (response is null) + { + return null; } - return new SoftwareUpdateConfigurationMachineRun(name.Value, id.Value, targetComputer.Value, targetComputerType.Value, softwareUpdateConfiguration.Value, status.Value, osType.Value, Optional.ToNullable(correlationId), Optional.ToNullable(sourceComputerId), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(configuredDuration), job.Value, Optional.ToNullable(creationTime), createdBy.Value, Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, error.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationMachineRun(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.cs index 7560f822a1d4..b29dbb0baed4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRun.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Automation.Models /// Software update configuration machine run model. public partial class SoftwareUpdateConfigurationMachineRun { - /// Initializes a new instance of SoftwareUpdateConfigurationMachineRun. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationMachineRun() { } - /// Initializes a new instance of SoftwareUpdateConfigurationMachineRun. + /// Initializes a new instance of . /// Name of the software update configuration machine run. /// Resource Id of the software update configuration machine run. /// name of the updated computer. @@ -37,7 +41,8 @@ internal SoftwareUpdateConfigurationMachineRun() /// Last time resource was modified, which only appears in the response. /// lastModifiedBy property, which only appears in the response. /// Details of provisioning error. - internal SoftwareUpdateConfigurationMachineRun(string name, ResourceIdentifier id, ResourceIdentifier targetComputerId, string targetComputerType, SoftwareUpdateConfigurationNavigation softwareUpdateConfiguration, string status, string osType, Guid? correlationId, Guid? sourceComputerId, DateTimeOffset? startOn, DateTimeOffset? endOn, TimeSpan? configuredDuration, JobNavigation job, DateTimeOffset? createdOn, string createdBy, DateTimeOffset? lastModifiedOn, string lastModifiedBy, AutomationResponseError error) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationMachineRun(string name, ResourceIdentifier id, ResourceIdentifier targetComputerId, string targetComputerType, SoftwareUpdateConfigurationNavigation softwareUpdateConfiguration, string status, string osType, Guid? correlationId, Guid? sourceComputerId, DateTimeOffset? startOn, DateTimeOffset? endOn, TimeSpan? configuredDuration, JobNavigation job, DateTimeOffset? createdOn, string createdBy, DateTimeOffset? lastModifiedOn, string lastModifiedBy, AutomationResponseError error, Dictionary serializedAdditionalRawData) { Name = name; Id = id; @@ -57,6 +62,7 @@ internal SoftwareUpdateConfigurationMachineRun(string name, ResourceIdentifier i LastModifiedOn = lastModifiedOn; LastModifiedBy = lastModifiedBy; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the software update configuration machine run. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.Serialization.cs index 301a2860f048..97227e602f68 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class SoftwareUpdateConfigurationMachineRunListResult + internal partial class SoftwareUpdateConfigurationMachineRunListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationMachineRunListResult DeserializeSoftwareUpdateConfigurationMachineRunListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationMachineRunListResult DeserializeSoftwareUpdateConfigurationMachineRunListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static SoftwareUpdateConfigurationMachineRunListResult DeserializeSoftw nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationMachineRunListResult(Optional.ToList(value), nextLink.Value); + return new SoftwareUpdateConfigurationMachineRunListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationMachineRunListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationMachineRunListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationMachineRunListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationMachineRunListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationMachineRunListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationMachineRunListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationMachineRunListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.cs index 6515eae8065d..ea23a7076ec5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationMachineRunListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// result of listing all software update configuration machine runs. internal partial class SoftwareUpdateConfigurationMachineRunListResult { - /// Initializes a new instance of SoftwareUpdateConfigurationMachineRunListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationMachineRunListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SoftwareUpdateConfigurationMachineRunListResult. + /// Initializes a new instance of . /// outer object returned when listing all software update configuration machine runs. /// link to next page of results. - internal SoftwareUpdateConfigurationMachineRunListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationMachineRunListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// outer object returned when listing all software update configuration machine runs. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.Serialization.cs index 74d3fa488e79..b1446c42ca37 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class SoftwareUpdateConfigurationNavigation + internal partial class SoftwareUpdateConfigurationNavigation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationNavigation DeserializeSoftwareUpdateConfigurationNavigation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationNavigation DeserializeSoftwareUpdateConfigurationNavigation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -26,8 +55,61 @@ internal static SoftwareUpdateConfigurationNavigation DeserializeSoftwareUpdateC name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationNavigation(name.Value); + return new SoftwareUpdateConfigurationNavigation(name.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationNavigation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationNavigation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationNavigation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationNavigation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationNavigation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationNavigation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationNavigation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.cs index 4f5f190e3a8d..62836a3e4d33 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationNavigation.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Software update configuration Run Navigation model. internal partial class SoftwareUpdateConfigurationNavigation { - /// Initializes a new instance of SoftwareUpdateConfigurationNavigation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationNavigation() { } - /// Initializes a new instance of SoftwareUpdateConfigurationNavigation. + /// Initializes a new instance of . /// Name of the software update configuration triggered the software update configuration run. - internal SoftwareUpdateConfigurationNavigation(string name) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationNavigation(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the software update configuration triggered the software update configuration run. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.Serialization.cs index 6a11481a74bd..701e98d3e908 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.Serialization.cs @@ -6,15 +6,69 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationRun + public partial class SoftwareUpdateConfigurationRun : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationRun DeserializeSoftwareUpdateConfigurationRun(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SoftwareUpdateConfiguration)) + { + writer.WritePropertyName("softwareUpdateConfiguration"u8); + if (SoftwareUpdateConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SoftwareUpdateConfiguration).Serialize(writer, options); + } + } + if (Optional.IsDefined(Tasks)) + { + writer.WritePropertyName("tasks"u8); + if (Tasks is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tasks).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationRun DeserializeSoftwareUpdateConfigurationRun(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +88,7 @@ internal static SoftwareUpdateConfigurationRun DeserializeSoftwareUpdateConfigur Optional lastModifiedTime = default; Optional lastModifiedBy = default; Optional tasks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -164,8 +219,61 @@ internal static SoftwareUpdateConfigurationRun DeserializeSoftwareUpdateConfigur } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationRun(name.Value, id.Value, softwareUpdateConfiguration.Value, status.Value, Optional.ToNullable(configuredDuration), osType.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(computerCount), Optional.ToNullable(failedCount), Optional.ToNullable(creationTime), createdBy.Value, Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, tasks.Value); + return new SoftwareUpdateConfigurationRun(name.Value, id.Value, softwareUpdateConfiguration.Value, status.Value, Optional.ToNullable(configuredDuration), osType.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(computerCount), Optional.ToNullable(failedCount), Optional.ToNullable(creationTime), createdBy.Value, Optional.ToNullable(lastModifiedTime), lastModifiedBy.Value, tasks.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationRun IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationRun(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationRun IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationRun(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationRun model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationRun(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationRun(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.cs index 243c66109336..90c639d4caca 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRun.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Automation.Models /// Software update configuration Run properties. public partial class SoftwareUpdateConfigurationRun { - /// Initializes a new instance of SoftwareUpdateConfigurationRun. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationRun() { } - /// Initializes a new instance of SoftwareUpdateConfigurationRun. + /// Initializes a new instance of . /// Name of the software update configuration run. /// Resource Id of the software update configuration run. /// software update configuration triggered this run. @@ -34,7 +38,8 @@ internal SoftwareUpdateConfigurationRun() /// Last time resource was modified, which only appears in the response. /// LastModifiedBy property, which only appears in the response. /// Software update configuration tasks triggered in this run. - internal SoftwareUpdateConfigurationRun(string name, ResourceIdentifier id, SoftwareUpdateConfigurationNavigation softwareUpdateConfiguration, string status, TimeSpan? configuredDuration, string osType, DateTimeOffset? startOn, DateTimeOffset? endOn, int? computerCount, int? failedCount, DateTimeOffset? createdOn, string createdBy, DateTimeOffset? lastModifiedOn, string lastModifiedBy, SoftwareUpdateConfigurationRunTasks tasks) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationRun(string name, ResourceIdentifier id, SoftwareUpdateConfigurationNavigation softwareUpdateConfiguration, string status, TimeSpan? configuredDuration, string osType, DateTimeOffset? startOn, DateTimeOffset? endOn, int? computerCount, int? failedCount, DateTimeOffset? createdOn, string createdBy, DateTimeOffset? lastModifiedOn, string lastModifiedBy, SoftwareUpdateConfigurationRunTasks tasks, Dictionary serializedAdditionalRawData) { Name = name; Id = id; @@ -51,6 +56,7 @@ internal SoftwareUpdateConfigurationRun(string name, ResourceIdentifier id, Soft LastModifiedOn = lastModifiedOn; LastModifiedBy = lastModifiedBy; Tasks = tasks; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the software update configuration run. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.Serialization.cs index 757a4f0fd618..dd680234d208 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class SoftwareUpdateConfigurationRunListResult + internal partial class SoftwareUpdateConfigurationRunListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationRunListResult DeserializeSoftwareUpdateConfigurationRunListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationRunListResult DeserializeSoftwareUpdateConfigurationRunListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static SoftwareUpdateConfigurationRunListResult DeserializeSoftwareUpda nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationRunListResult(Optional.ToList(value), nextLink.Value); + return new SoftwareUpdateConfigurationRunListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationRunListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationRunListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationRunListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationRunListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationRunListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationRunListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationRunListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.cs index 9bff5ddd24d2..d2908b194802 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// result of listing all software update configuration runs. internal partial class SoftwareUpdateConfigurationRunListResult { - /// Initializes a new instance of SoftwareUpdateConfigurationRunListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationRunListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SoftwareUpdateConfigurationRunListResult. + /// Initializes a new instance of . /// outer object returned when listing all software update configuration runs. /// link to next page of results. - internal SoftwareUpdateConfigurationRunListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationRunListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// outer object returned when listing all software update configuration runs. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.Serialization.cs index a95b1672db7d..9cf836bcb2d9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationRunTaskProperties + public partial class SoftwareUpdateConfigurationRunTaskProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationRunTaskProperties DeserializeSoftwareUpdateConfigurationRunTaskProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source); + } + if (Optional.IsDefined(JobId)) + { + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationRunTaskProperties DeserializeSoftwareUpdateConfigurationRunTaskProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static SoftwareUpdateConfigurationRunTaskProperties DeserializeSoftware Optional status = default; Optional source = default; Optional jobId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -43,8 +86,61 @@ internal static SoftwareUpdateConfigurationRunTaskProperties DeserializeSoftware jobId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationRunTaskProperties(status.Value, source.Value, Optional.ToNullable(jobId)); + return new SoftwareUpdateConfigurationRunTaskProperties(status.Value, source.Value, Optional.ToNullable(jobId), serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationRunTaskProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationRunTaskProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationRunTaskProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationRunTaskProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationRunTaskProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationRunTaskProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationRunTaskProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.cs index 2d42af86140f..6ea00d0ef137 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTaskProperties.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// Task properties of the software update configuration. public partial class SoftwareUpdateConfigurationRunTaskProperties { - /// Initializes a new instance of SoftwareUpdateConfigurationRunTaskProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationRunTaskProperties() { } - /// Initializes a new instance of SoftwareUpdateConfigurationRunTaskProperties. + /// Initializes a new instance of . /// The status of the task. /// The name of the source of the task. /// The job id of the task. - internal SoftwareUpdateConfigurationRunTaskProperties(string status, string source, Guid? jobId) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationRunTaskProperties(string status, string source, Guid? jobId, Dictionary serializedAdditionalRawData) { Status = status; Source = source; JobId = jobId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status of the task. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.Serialization.cs index ddba18de5673..f9ca118cdd8c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.Serialization.cs @@ -5,21 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationRunTasks + public partial class SoftwareUpdateConfigurationRunTasks : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SoftwareUpdateConfigurationRunTasks DeserializeSoftwareUpdateConfigurationRunTasks(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PreTask)) + { + writer.WritePropertyName("preTask"u8); + if (PreTask is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PreTask).Serialize(writer, options); + } + } + if (Optional.IsDefined(PostTask)) + { + writer.WritePropertyName("postTask"u8); + if (PostTask is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PostTask).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SoftwareUpdateConfigurationRunTasks DeserializeSoftwareUpdateConfigurationRunTasks(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional preTask = default; Optional postTask = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("preTask"u8)) @@ -40,8 +93,61 @@ internal static SoftwareUpdateConfigurationRunTasks DeserializeSoftwareUpdateCon postTask = SoftwareUpdateConfigurationRunTaskProperties.DeserializeSoftwareUpdateConfigurationRunTaskProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationRunTasks(preTask.Value, postTask.Value); + return new SoftwareUpdateConfigurationRunTasks(preTask.Value, postTask.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationRunTasks IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationRunTasks(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationRunTasks IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationRunTasks(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationRunTasks model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationRunTasks(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationRunTasks(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.cs index d5e18f3a6fcc..5bd0330fab36 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationRunTasks.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Software update configuration run tasks model. public partial class SoftwareUpdateConfigurationRunTasks { - /// Initializes a new instance of SoftwareUpdateConfigurationRunTasks. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SoftwareUpdateConfigurationRunTasks() { } - /// Initializes a new instance of SoftwareUpdateConfigurationRunTasks. + /// Initializes a new instance of . /// Pre task properties. /// Post task properties. - internal SoftwareUpdateConfigurationRunTasks(SoftwareUpdateConfigurationRunTaskProperties preTask, SoftwareUpdateConfigurationRunTaskProperties postTask) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationRunTasks(SoftwareUpdateConfigurationRunTaskProperties preTask, SoftwareUpdateConfigurationRunTaskProperties postTask, Dictionary serializedAdditionalRawData) { PreTask = preTask; PostTask = postTask; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Pre task properties. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.Serialization.cs index effab81299f6..3a64d389305f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationScheduleProperties : IUtf8JsonSerializable + public partial class SoftwareUpdateConfigurationScheduleProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StartOn)) { @@ -78,7 +85,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdvancedSchedule)) { writer.WritePropertyName("advancedSchedule"u8); - writer.WriteObjectValue(AdvancedSchedule); + if (AdvancedSchedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdvancedSchedule).Serialize(writer, options); + } } if (Optional.IsDefined(CreatedOn)) { @@ -95,11 +109,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SoftwareUpdateConfigurationScheduleProperties DeserializeSoftwareUpdateConfigurationScheduleProperties(JsonElement element) + internal static SoftwareUpdateConfigurationScheduleProperties DeserializeSoftwareUpdateConfigurationScheduleProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -118,6 +146,7 @@ internal static SoftwareUpdateConfigurationScheduleProperties DeserializeSoftwar Optional creationTime = default; Optional lastModifiedTime = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("startTime"u8)) @@ -240,8 +269,61 @@ internal static SoftwareUpdateConfigurationScheduleProperties DeserializeSoftwar description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SoftwareUpdateConfigurationScheduleProperties(Optional.ToNullable(startTime), Optional.ToNullable(startTimeOffsetMinutes), Optional.ToNullable(expiryTime), Optional.ToNullable(expiryTimeOffsetMinutes), Optional.ToNullable(isEnabled), Optional.ToNullable(nextRun), Optional.ToNullable(nextRunOffsetMinutes), Optional.ToNullable(interval), Optional.ToNullable(frequency), timeZone.Value, advancedSchedule.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value); + return new SoftwareUpdateConfigurationScheduleProperties(Optional.ToNullable(startTime), Optional.ToNullable(startTimeOffsetMinutes), Optional.ToNullable(expiryTime), Optional.ToNullable(expiryTimeOffsetMinutes), Optional.ToNullable(isEnabled), Optional.ToNullable(nextRun), Optional.ToNullable(nextRunOffsetMinutes), Optional.ToNullable(interval), Optional.ToNullable(frequency), timeZone.Value, advancedSchedule.Value, Optional.ToNullable(creationTime), Optional.ToNullable(lastModifiedTime), description.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationScheduleProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationScheduleProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationScheduleProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationScheduleProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationScheduleProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationScheduleProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationScheduleProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.cs index 003a628855db..3d4909546e90 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationScheduleProperties.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Automation.Models { /// Definition of schedule parameters. public partial class SoftwareUpdateConfigurationScheduleProperties { - /// Initializes a new instance of SoftwareUpdateConfigurationScheduleProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareUpdateConfigurationScheduleProperties() { } - /// Initializes a new instance of SoftwareUpdateConfigurationScheduleProperties. + /// Initializes a new instance of . /// Gets or sets the start time of the schedule. /// Gets the start time's offset in minutes. /// Gets or sets the end time of the schedule. @@ -32,7 +36,8 @@ public SoftwareUpdateConfigurationScheduleProperties() /// Gets or sets the creation time. /// Gets or sets the last modified time. /// Gets or sets the description. - internal SoftwareUpdateConfigurationScheduleProperties(DateTimeOffset? startOn, double? startInMinutes, DateTimeOffset? expireOn, double? expireInMinutes, bool? isEnabled, DateTimeOffset? nextRunOn, double? nextRunInMinutes, long? interval, AutomationScheduleFrequency? frequency, string timeZone, AutomationAdvancedSchedule advancedSchedule, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationScheduleProperties(DateTimeOffset? startOn, double? startInMinutes, DateTimeOffset? expireOn, double? expireInMinutes, bool? isEnabled, DateTimeOffset? nextRunOn, double? nextRunInMinutes, long? interval, AutomationScheduleFrequency? frequency, string timeZone, AutomationAdvancedSchedule advancedSchedule, DateTimeOffset? createdOn, DateTimeOffset? lastModifiedOn, string description, Dictionary serializedAdditionalRawData) { StartOn = startOn; StartInMinutes = startInMinutes; @@ -48,6 +53,7 @@ internal SoftwareUpdateConfigurationScheduleProperties(DateTimeOffset? startOn, CreatedOn = createdOn; LastModifiedOn = lastModifiedOn; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the start time of the schedule. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.Serialization.cs index 7af6c4acb85d..64ff8ce70093 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.Serialization.cs @@ -8,26 +8,46 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationSpecificProperties : IUtf8JsonSerializable + public partial class SoftwareUpdateConfigurationSpecificProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("operatingSystem"u8); writer.WriteStringValue(OperatingSystem.ToSerialString()); if (Optional.IsDefined(Windows)) { writer.WritePropertyName("windows"u8); - writer.WriteObjectValue(Windows); + if (Windows is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Windows).Serialize(writer, options); + } } if (Optional.IsDefined(Linux)) { writer.WritePropertyName("linux"u8); - writer.WriteObjectValue(Linux); + if (Linux is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Linux).Serialize(writer, options); + } } if (Optional.IsDefined(Duration)) { @@ -57,13 +77,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Targets)) { writer.WritePropertyName("targets"u8); - writer.WriteObjectValue(Targets); + if (Targets is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Targets).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static SoftwareUpdateConfigurationSpecificProperties DeserializeSoftwareUpdateConfigurationSpecificProperties(JsonElement element) + internal static SoftwareUpdateConfigurationSpecificProperties DeserializeSoftwareUpdateConfigurationSpecificProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +116,7 @@ internal static SoftwareUpdateConfigurationSpecificProperties DeserializeSoftwar Optional> azureVirtualMachines = default; Optional> nonAzureComputerNames = default; Optional targets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operatingSystem"u8)) @@ -146,8 +188,61 @@ internal static SoftwareUpdateConfigurationSpecificProperties DeserializeSoftwar targets = SoftwareUpdateConfigurationTargetProperties.DeserializeSoftwareUpdateConfigurationTargetProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareUpdateConfigurationSpecificProperties(operatingSystem, windows.Value, linux.Value, Optional.ToNullable(duration), Optional.ToList(azureVirtualMachines), Optional.ToList(nonAzureComputerNames), targets.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationSpecificProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationSpecificProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationSpecificProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationSpecificProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationSpecificProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationSpecificProperties(Response response) + { + if (response is null) + { + return null; } - return new SoftwareUpdateConfigurationSpecificProperties(operatingSystem, windows.Value, linux.Value, Optional.ToNullable(duration), Optional.ToList(azureVirtualMachines), Optional.ToList(nonAzureComputerNames), targets.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationSpecificProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.cs index 69c692e2189a..80bc534ef811 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationSpecificProperties.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// Update specific properties of the software update configuration. public partial class SoftwareUpdateConfigurationSpecificProperties { - /// Initializes a new instance of SoftwareUpdateConfigurationSpecificProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// operating system of target machines. public SoftwareUpdateConfigurationSpecificProperties(SoftwareUpdateConfigurationOperatingSystemType operatingSystem) { @@ -23,7 +26,7 @@ public SoftwareUpdateConfigurationSpecificProperties(SoftwareUpdateConfiguration NonAzureComputerNames = new ChangeTrackingList(); } - /// Initializes a new instance of SoftwareUpdateConfigurationSpecificProperties. + /// Initializes a new instance of . /// operating system of target machines. /// Windows specific update configuration. /// Linux specific update configuration. @@ -31,7 +34,8 @@ public SoftwareUpdateConfigurationSpecificProperties(SoftwareUpdateConfiguration /// List of azure resource Ids for azure virtual machines targeted by the software update configuration. /// List of names of non-azure machines targeted by the software update configuration. /// Group targets for the software update configuration. - internal SoftwareUpdateConfigurationSpecificProperties(SoftwareUpdateConfigurationOperatingSystemType operatingSystem, WindowsUpdateConfigurationProperties windows, LinuxUpdateConfigurationProperties linux, TimeSpan? duration, IList azureVirtualMachines, IList nonAzureComputerNames, SoftwareUpdateConfigurationTargetProperties targets) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationSpecificProperties(SoftwareUpdateConfigurationOperatingSystemType operatingSystem, WindowsUpdateConfigurationProperties windows, LinuxUpdateConfigurationProperties linux, TimeSpan? duration, IList azureVirtualMachines, IList nonAzureComputerNames, SoftwareUpdateConfigurationTargetProperties targets, Dictionary serializedAdditionalRawData) { OperatingSystem = operatingSystem; Windows = windows; @@ -40,6 +44,12 @@ internal SoftwareUpdateConfigurationSpecificProperties(SoftwareUpdateConfigurati AzureVirtualMachines = azureVirtualMachines; NonAzureComputerNames = nonAzureComputerNames; Targets = targets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SoftwareUpdateConfigurationSpecificProperties() + { } /// operating system of target machines. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.Serialization.cs index f848f1a644e1..1a0891b8b291 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationTargetProperties : IUtf8JsonSerializable + public partial class SoftwareUpdateConfigurationTargetProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AzureQueries)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AzureQueries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,21 +46,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NonAzureQueries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SoftwareUpdateConfigurationTargetProperties DeserializeSoftwareUpdateConfigurationTargetProperties(JsonElement element) + internal static SoftwareUpdateConfigurationTargetProperties DeserializeSoftwareUpdateConfigurationTargetProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> azureQueries = default; Optional> nonAzureQueries = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("azureQueries"u8)) @@ -77,8 +113,61 @@ internal static SoftwareUpdateConfigurationTargetProperties DeserializeSoftwareU nonAzureQueries = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareUpdateConfigurationTargetProperties(Optional.ToList(azureQueries), Optional.ToList(nonAzureQueries), serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationTargetProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationTargetProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationTargetProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationTargetProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationTargetProperties model) + { + if (model is null) + { + return null; } - return new SoftwareUpdateConfigurationTargetProperties(Optional.ToList(azureQueries), Optional.ToList(nonAzureQueries)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationTargetProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationTargetProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.cs index 8241a3a37cbc..b7a941b3cf46 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTargetProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Automation.Models /// Group specific to the update configuration. public partial class SoftwareUpdateConfigurationTargetProperties { - /// Initializes a new instance of SoftwareUpdateConfigurationTargetProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareUpdateConfigurationTargetProperties() { AzureQueries = new ChangeTrackingList(); NonAzureQueries = new ChangeTrackingList(); } - /// Initializes a new instance of SoftwareUpdateConfigurationTargetProperties. + /// Initializes a new instance of . /// List of Azure queries in the software update configuration. /// List of non Azure queries in the software update configuration. - internal SoftwareUpdateConfigurationTargetProperties(IList azureQueries, IList nonAzureQueries) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationTargetProperties(IList azureQueries, IList nonAzureQueries, Dictionary serializedAdditionalRawData) { AzureQueries = azureQueries; NonAzureQueries = nonAzureQueries; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Azure queries in the software update configuration. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.Serialization.cs index 4740a17286fc..7e186dc6e9e1 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationTaskProperties : IUtf8JsonSerializable + public partial class SoftwareUpdateConfigurationTaskProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Parameters)) { @@ -32,17 +39,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("source"u8); writer.WriteStringValue(Source); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SoftwareUpdateConfigurationTaskProperties DeserializeSoftwareUpdateConfigurationTaskProperties(JsonElement element) + internal static SoftwareUpdateConfigurationTaskProperties DeserializeSoftwareUpdateConfigurationTaskProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> parameters = default; Optional source = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -64,8 +86,61 @@ internal static SoftwareUpdateConfigurationTaskProperties DeserializeSoftwareUpd source = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareUpdateConfigurationTaskProperties(Optional.ToDictionary(parameters), source.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationTaskProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationTaskProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationTaskProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationTaskProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationTaskProperties model) + { + if (model is null) + { + return null; } - return new SoftwareUpdateConfigurationTaskProperties(Optional.ToDictionary(parameters), source.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationTaskProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationTaskProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.cs index c23daa507f6f..540bcdef7b70 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTaskProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// Task properties of the software update configuration. public partial class SoftwareUpdateConfigurationTaskProperties { - /// Initializes a new instance of SoftwareUpdateConfigurationTaskProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareUpdateConfigurationTaskProperties() { Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of SoftwareUpdateConfigurationTaskProperties. + /// Initializes a new instance of . /// Gets or sets the parameters of the task. /// Gets or sets the name of the runbook. - internal SoftwareUpdateConfigurationTaskProperties(IDictionary parameters, string source) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationTaskProperties(IDictionary parameters, string source, Dictionary serializedAdditionalRawData) { Parameters = parameters; Source = source; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the parameters of the task. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.Serialization.cs index 281627031faa..96f548c235ba 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SoftwareUpdateConfigurationTasks : IUtf8JsonSerializable + public partial class SoftwareUpdateConfigurationTasks : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreTask)) { writer.WritePropertyName("preTask"u8); - writer.WriteObjectValue(PreTask); + if (PreTask is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PreTask).Serialize(writer, options); + } } if (Optional.IsDefined(PostTask)) { writer.WritePropertyName("postTask"u8); - writer.WriteObjectValue(PostTask); + if (PostTask is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PostTask).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static SoftwareUpdateConfigurationTasks DeserializeSoftwareUpdateConfigurationTasks(JsonElement element) + internal static SoftwareUpdateConfigurationTasks DeserializeSoftwareUpdateConfigurationTasks(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional preTask = default; Optional postTask = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("preTask"u8)) @@ -56,8 +93,61 @@ internal static SoftwareUpdateConfigurationTasks DeserializeSoftwareUpdateConfig postTask = SoftwareUpdateConfigurationTaskProperties.DeserializeSoftwareUpdateConfigurationTaskProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareUpdateConfigurationTasks(preTask.Value, postTask.Value, serializedAdditionalRawData); + } + + SoftwareUpdateConfigurationTasks IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareUpdateConfigurationTasks(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareUpdateConfigurationTasks IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareUpdateConfigurationTasks(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareUpdateConfigurationTasks model) + { + if (model is null) + { + return null; } - return new SoftwareUpdateConfigurationTasks(preTask.Value, postTask.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareUpdateConfigurationTasks(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareUpdateConfigurationTasks(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.cs index 944717d2d749..d51cf9c1c2fb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SoftwareUpdateConfigurationTasks.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// Task properties of the software update configuration. public partial class SoftwareUpdateConfigurationTasks { - /// Initializes a new instance of SoftwareUpdateConfigurationTasks. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareUpdateConfigurationTasks() { } - /// Initializes a new instance of SoftwareUpdateConfigurationTasks. + /// Initializes a new instance of . /// Pre task properties. /// Post task properties. - internal SoftwareUpdateConfigurationTasks(SoftwareUpdateConfigurationTaskProperties preTask, SoftwareUpdateConfigurationTaskProperties postTask) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationTasks(SoftwareUpdateConfigurationTaskProperties preTask, SoftwareUpdateConfigurationTaskProperties postTask, Dictionary serializedAdditionalRawData) { PreTask = preTask; PostTask = postTask; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Pre task properties. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.Serialization.cs index a29489b066c1..a71c578bb270 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SourceControlSecurityTokenProperties : IUtf8JsonSerializable + public partial class SourceControlSecurityTokenProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AccessToken)) { @@ -30,7 +38,109 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tokenType"u8); writer.WriteStringValue(TokenType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SourceControlSecurityTokenProperties DeserializeSourceControlSecurityTokenProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional accessToken = default; + Optional refreshToken = default; + Optional tokenType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("accessToken"u8)) + { + accessToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("refreshToken"u8)) + { + refreshToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("tokenType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tokenType = new SourceControlTokenType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceControlSecurityTokenProperties(accessToken.Value, refreshToken.Value, Optional.ToNullable(tokenType), serializedAdditionalRawData); + } + + SourceControlSecurityTokenProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSecurityTokenProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSecurityTokenProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSecurityTokenProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSecurityTokenProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSecurityTokenProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSecurityTokenProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.cs index c9c83417498e..14f94fd3eda4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSecurityTokenProperties.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Automation.Models { /// The SourceControlSecurityTokenProperties. public partial class SourceControlSecurityTokenProperties { - /// Initializes a new instance of SourceControlSecurityTokenProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SourceControlSecurityTokenProperties() { } + /// Initializes a new instance of . + /// The access token. + /// The refresh token. + /// The token type. Must be either PersonalAccessToken or Oauth. + /// Keeps track of any properties unknown to the library. + internal SourceControlSecurityTokenProperties(string accessToken, string refreshToken, SourceControlTokenType? tokenType, Dictionary serializedAdditionalRawData) + { + AccessToken = accessToken; + RefreshToken = refreshToken; + TokenType = tokenType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The access token. public string AccessToken { get; set; } /// The refresh token. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.Serialization.cs index ee848c7aee94..355e85b33275 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.Serialization.cs @@ -6,16 +6,61 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Automation.Models { - public partial class SourceControlSyncJob + public partial class SourceControlSyncJob : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlSyncJob DeserializeSourceControlSyncJob(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SourceControlSyncJobId)) + { + writer.WritePropertyName("sourceControlSyncJobId"u8); + writer.WriteStringValue(SourceControlSyncJobId); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(SyncType)) + { + writer.WritePropertyName("syncType"u8); + writer.WriteStringValue(SyncType.Value.ToString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlSyncJob DeserializeSourceControlSyncJob(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +75,7 @@ internal static SourceControlSyncJob DeserializeSourceControlSyncJob(JsonElement Optional startTime = default; Optional endTime = default; Optional syncType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -120,8 +166,61 @@ internal static SourceControlSyncJob DeserializeSourceControlSyncJob(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlSyncJob(id, name, type, systemData.Value, sourceControlSyncJobId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(syncType)); + return new SourceControlSyncJob(id, name, type, systemData.Value, sourceControlSyncJobId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(syncType), serializedAdditionalRawData); + } + + SourceControlSyncJob IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJob(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJob IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJob(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJob model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJob(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJob(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.cs index 390a5c10e011..a2a4501c36d5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJob.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the source control sync job. public partial class SourceControlSyncJob : ResourceData { - /// Initializes a new instance of SourceControlSyncJob. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceControlSyncJob() { } - /// Initializes a new instance of SourceControlSyncJob. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,7 +34,8 @@ internal SourceControlSyncJob() /// The start time of the job. /// The end time of the job. /// The sync type. - internal SourceControlSyncJob(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string sourceControlSyncJobId, DateTimeOffset? createdOn, SourceControlProvisioningState? provisioningState, DateTimeOffset? startOn, DateTimeOffset? endOn, SourceControlSyncType? syncType) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJob(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string sourceControlSyncJobId, DateTimeOffset? createdOn, SourceControlProvisioningState? provisioningState, DateTimeOffset? startOn, DateTimeOffset? endOn, SourceControlSyncType? syncType, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { SourceControlSyncJobId = sourceControlSyncJobId; CreatedOn = createdOn; @@ -38,6 +43,7 @@ internal SourceControlSyncJob(ResourceIdentifier id, string name, ResourceType r StartOn = startOn; EndOn = endOn; SyncType = syncType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The source control sync job id. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.Serialization.cs index 17b750080974..19b3e42c5f2b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.Serialization.cs @@ -5,22 +5,128 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SourceControlSyncJobCreateContent : IUtf8JsonSerializable + public partial class SourceControlSyncJobCreateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("commitId"u8); writer.WriteStringValue(CommitId); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SourceControlSyncJobCreateContent DeserializeSourceControlSyncJobCreateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string commitId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("commitId"u8)) + { + commitId = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceControlSyncJobCreateContent(commitId, serializedAdditionalRawData); + } + + SourceControlSyncJobCreateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJobCreateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJobCreateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJobCreateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJobCreateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJobCreateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJobCreateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.cs index 0cace6f088e0..99dfaf58bc08 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobCreateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Automation.Models /// The parameters supplied to the create source control sync job operation. public partial class SourceControlSyncJobCreateContent { - /// Initializes a new instance of SourceControlSyncJobCreateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. /// is null. public SourceControlSyncJobCreateContent(string commitId) @@ -23,6 +27,20 @@ public SourceControlSyncJobCreateContent(string commitId) CommitId = commitId; } + /// Initializes a new instance of . + /// The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJobCreateContent(string commitId, Dictionary serializedAdditionalRawData) + { + CommitId = commitId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SourceControlSyncJobCreateContent() + { + } + /// The commit id of the source control sync job. If not syncing to a commitId, enter an empty string. public string CommitId { get; } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.Serialization.cs index b840a9741c46..f531a067fd0a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class SourceControlSyncJobListResult + internal partial class SourceControlSyncJobListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlSyncJobListResult DeserializeSourceControlSyncJobListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlSyncJobListResult DeserializeSourceControlSyncJobListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static SourceControlSyncJobListResult DeserializeSourceControlSyncJobLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlSyncJobListResult(Optional.ToList(value), nextLink.Value); + return new SourceControlSyncJobListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SourceControlSyncJobListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJobListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJobListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJobListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJobListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJobListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJobListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.cs index f2f049f17684..bd14f9cc3dcf 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list source control sync jobs operation. internal partial class SourceControlSyncJobListResult { - /// Initializes a new instance of SourceControlSyncJobListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceControlSyncJobListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SourceControlSyncJobListResult. + /// Initializes a new instance of . /// The list of source control sync jobs. /// The next link. - internal SourceControlSyncJobListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJobListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of source control sync jobs. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.Serialization.cs index 5e240b611370..17039ca2b602 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.Serialization.cs @@ -6,15 +6,70 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SourceControlSyncJobResult + public partial class SourceControlSyncJobResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlSyncJobResult DeserializeSourceControlSyncJobResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SourceControlSyncJobId)) + { + writer.WritePropertyName("sourceControlSyncJobId"u8); + writer.WriteStringValue(SourceControlSyncJobId); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(SyncType)) + { + writer.WritePropertyName("syncType"u8); + writer.WriteStringValue(SyncType.Value.ToString()); + } + if (Optional.IsDefined(Exception)) + { + writer.WritePropertyName("exception"u8); + writer.WriteStringValue(Exception); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlSyncJobResult DeserializeSourceControlSyncJobResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +82,7 @@ internal static SourceControlSyncJobResult DeserializeSourceControlSyncJobResult Optional endTime = default; Optional syncType = default; Optional exception = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -107,8 +163,61 @@ internal static SourceControlSyncJobResult DeserializeSourceControlSyncJobResult } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlSyncJobResult(id.Value, sourceControlSyncJobId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(syncType), exception.Value); + return new SourceControlSyncJobResult(id.Value, sourceControlSyncJobId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(syncType), exception.Value, serializedAdditionalRawData); + } + + SourceControlSyncJobResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJobResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJobResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJobResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJobResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJobResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJobResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.cs index be031579f2b1..1448dfcb325c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the source control sync job. public partial class SourceControlSyncJobResult { - /// Initializes a new instance of SourceControlSyncJobResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceControlSyncJobResult() { } - /// Initializes a new instance of SourceControlSyncJobResult. + /// Initializes a new instance of . /// The id of the job. /// The source control sync job id. /// The creation time of the job. @@ -27,7 +31,8 @@ internal SourceControlSyncJobResult() /// The end time of the job. /// The sync type. /// The exceptions that occurred while running the sync job. - internal SourceControlSyncJobResult(ResourceIdentifier id, string sourceControlSyncJobId, DateTimeOffset? createdOn, SourceControlProvisioningState? provisioningState, DateTimeOffset? startOn, DateTimeOffset? endOn, SourceControlSyncType? syncType, string exception) + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJobResult(ResourceIdentifier id, string sourceControlSyncJobId, DateTimeOffset? createdOn, SourceControlProvisioningState? provisioningState, DateTimeOffset? startOn, DateTimeOffset? endOn, SourceControlSyncType? syncType, string exception, Dictionary serializedAdditionalRawData) { Id = id; SourceControlSyncJobId = sourceControlSyncJobId; @@ -37,6 +42,7 @@ internal SourceControlSyncJobResult(ResourceIdentifier id, string sourceControlS EndOn = endOn; SyncType = syncType; Exception = exception; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the job. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.Serialization.cs index 6f20699a8571..7233e2290646 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.Serialization.cs @@ -6,15 +6,60 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SourceControlSyncJobStream + public partial class SourceControlSyncJobStream : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlSyncJobStream DeserializeSourceControlSyncJobStream(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SourceControlSyncJobStreamId)) + { + writer.WritePropertyName("sourceControlSyncJobStreamId"u8); + writer.WriteStringValue(SourceControlSyncJobStreamId); + } + if (Optional.IsDefined(Summary)) + { + writer.WritePropertyName("summary"u8); + writer.WriteStringValue(Summary); + } + if (Optional.IsDefined(StreamType)) + { + writer.WritePropertyName("streamType"u8); + writer.WriteStringValue(StreamType.Value.ToString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlSyncJobStream DeserializeSourceControlSyncJobStream(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +69,7 @@ internal static SourceControlSyncJobStream DeserializeSourceControlSyncJobStream Optional summary = default; Optional time = default; Optional streamType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -76,8 +122,61 @@ internal static SourceControlSyncJobStream DeserializeSourceControlSyncJobStream } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlSyncJobStream(id.Value, sourceControlSyncJobStreamId.Value, summary.Value, Optional.ToNullable(time), Optional.ToNullable(streamType)); + return new SourceControlSyncJobStream(id.Value, sourceControlSyncJobStreamId.Value, summary.Value, Optional.ToNullable(time), Optional.ToNullable(streamType), serializedAdditionalRawData); + } + + SourceControlSyncJobStream IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJobStream(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJobStream IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJobStream(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJobStream model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJobStream(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJobStream(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.cs index 692bd2e6dae9..7d5a100398a4 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStream.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Automation.Models @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the source control sync job stream. public partial class SourceControlSyncJobStream { - /// Initializes a new instance of SourceControlSyncJobStream. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceControlSyncJobStream() { } - /// Initializes a new instance of SourceControlSyncJobStream. + /// Initializes a new instance of . /// Resource id. /// The sync job stream id. /// The summary of the sync job stream. /// The time of the sync job stream. /// The type of the sync job stream. - internal SourceControlSyncJobStream(ResourceIdentifier id, string sourceControlSyncJobStreamId, string summary, DateTimeOffset? time, SourceControlStreamType? streamType) + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJobStream(ResourceIdentifier id, string sourceControlSyncJobStreamId, string summary, DateTimeOffset? time, SourceControlStreamType? streamType, Dictionary serializedAdditionalRawData) { Id = id; SourceControlSyncJobStreamId = sourceControlSyncJobStreamId; Summary = summary; Time = time; StreamType = streamType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource id. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.Serialization.cs index a1f0f7646501..3cd2025247d3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - internal partial class SourceControlSyncJobStreamListResult + internal partial class SourceControlSyncJobStreamListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlSyncJobStreamListResult DeserializeSourceControlSyncJobStreamListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlSyncJobStreamListResult DeserializeSourceControlSyncJobStreamListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +87,61 @@ internal static SourceControlSyncJobStreamListResult DeserializeSourceControlSyn nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlSyncJobStreamListResult(Optional.ToList(value), nextLink.Value); + return new SourceControlSyncJobStreamListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SourceControlSyncJobStreamListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJobStreamListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJobStreamListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJobStreamListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJobStreamListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJobStreamListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJobStreamListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.cs index 8318a53065fa..333abb16633d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Automation.Models /// The response model for the list source control sync job streams operation. internal partial class SourceControlSyncJobStreamListResult { - /// Initializes a new instance of SourceControlSyncJobStreamListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceControlSyncJobStreamListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SourceControlSyncJobStreamListResult. + /// Initializes a new instance of . /// The list of source control sync job streams. /// The next link. - internal SourceControlSyncJobStreamListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJobStreamListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of source control sync job streams. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.Serialization.cs index 5719e14c52f7..a0d36fa10747 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.Serialization.cs @@ -8,14 +8,83 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class SourceControlSyncJobStreamResult + public partial class SourceControlSyncJobStreamResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlSyncJobStreamResult DeserializeSourceControlSyncJobStreamResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SourceControlSyncJobStreamId)) + { + writer.WritePropertyName("sourceControlSyncJobStreamId"u8); + writer.WriteStringValue(SourceControlSyncJobStreamId); + } + if (Optional.IsDefined(Summary)) + { + writer.WritePropertyName("summary"u8); + writer.WriteStringValue(Summary); + } + if (Optional.IsDefined(StreamType)) + { + writer.WritePropertyName("streamType"u8); + writer.WriteStringValue(StreamType.Value.ToString()); + } + if (Optional.IsDefined(StreamText)) + { + writer.WritePropertyName("streamText"u8); + writer.WriteStringValue(StreamText); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartObject(); + foreach (var item in Value) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlSyncJobStreamResult DeserializeSourceControlSyncJobStreamResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +96,7 @@ internal static SourceControlSyncJobStreamResult DeserializeSourceControlSyncJob Optional streamType = default; Optional streamText = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -105,8 +175,61 @@ internal static SourceControlSyncJobStreamResult DeserializeSourceControlSyncJob } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlSyncJobStreamResult(id.Value, sourceControlSyncJobStreamId.Value, summary.Value, Optional.ToNullable(time), Optional.ToNullable(streamType), streamText.Value, Optional.ToDictionary(value)); + return new SourceControlSyncJobStreamResult(id.Value, sourceControlSyncJobStreamId.Value, summary.Value, Optional.ToNullable(time), Optional.ToNullable(streamType), streamText.Value, Optional.ToDictionary(value), serializedAdditionalRawData); + } + + SourceControlSyncJobStreamResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlSyncJobStreamResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlSyncJobStreamResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlSyncJobStreamResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlSyncJobStreamResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlSyncJobStreamResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlSyncJobStreamResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.cs index 039e9e5825fb..0f0b07609ecd 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/SourceControlSyncJobStreamResult.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Automation.Models /// Definition of the source control sync job stream by id. public partial class SourceControlSyncJobStreamResult { - /// Initializes a new instance of SourceControlSyncJobStreamResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceControlSyncJobStreamResult() { Value = new ChangeTrackingDictionary(); } - /// Initializes a new instance of SourceControlSyncJobStreamResult. + /// Initializes a new instance of . /// Resource id. /// The sync job stream id. /// The summary of the sync job stream. @@ -28,7 +31,8 @@ internal SourceControlSyncJobStreamResult() /// The type of the sync job stream. /// The text of the sync job stream. /// The values of the job stream. - internal SourceControlSyncJobStreamResult(ResourceIdentifier id, string sourceControlSyncJobStreamId, string summary, DateTimeOffset? time, SourceControlStreamType? streamType, string streamText, IReadOnlyDictionary value) + /// Keeps track of any properties unknown to the library. + internal SourceControlSyncJobStreamResult(ResourceIdentifier id, string sourceControlSyncJobStreamId, string summary, DateTimeOffset? time, SourceControlStreamType? streamType, string streamText, IReadOnlyDictionary value, Dictionary serializedAdditionalRawData) { Id = id; SourceControlSyncJobStreamId = sourceControlSyncJobStreamId; @@ -37,6 +41,7 @@ internal SourceControlSyncJobStreamResult(ResourceIdentifier id, string sourceCo StreamType = streamType; StreamText = streamText; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource id. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.Serialization.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.Serialization.cs index e5c130502729..96062f293b57 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.Serialization.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Automation.Models { - public partial class WindowsUpdateConfigurationProperties : IUtf8JsonSerializable + public partial class WindowsUpdateConfigurationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IncludedUpdateClassifications)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("rebootSetting"u8); writer.WriteStringValue(RebootSetting); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WindowsUpdateConfigurationProperties DeserializeWindowsUpdateConfigurationProperties(JsonElement element) + internal static WindowsUpdateConfigurationProperties DeserializeWindowsUpdateConfigurationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static WindowsUpdateConfigurationProperties DeserializeWindowsUpdateCon Optional> excludedKbNumbers = default; Optional> includedKbNumbers = default; Optional rebootSetting = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("includedUpdateClassifications"u8)) @@ -103,8 +125,61 @@ internal static WindowsUpdateConfigurationProperties DeserializeWindowsUpdateCon rebootSetting = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WindowsUpdateConfigurationProperties(Optional.ToNullable(includedUpdateClassifications), Optional.ToList(excludedKbNumbers), Optional.ToList(includedKbNumbers), rebootSetting.Value, serializedAdditionalRawData); + } + + WindowsUpdateConfigurationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWindowsUpdateConfigurationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WindowsUpdateConfigurationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWindowsUpdateConfigurationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WindowsUpdateConfigurationProperties model) + { + if (model is null) + { + return null; } - return new WindowsUpdateConfigurationProperties(Optional.ToNullable(includedUpdateClassifications), Optional.ToList(excludedKbNumbers), Optional.ToList(includedKbNumbers), rebootSetting.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WindowsUpdateConfigurationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWindowsUpdateConfigurationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.cs index 0459b95e592e..9e2c1a301436 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Models/WindowsUpdateConfigurationProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Automation.Models /// Windows specific update configuration. public partial class WindowsUpdateConfigurationProperties { - /// Initializes a new instance of WindowsUpdateConfigurationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WindowsUpdateConfigurationProperties() { ExcludedKBNumbers = new ChangeTrackingList(); IncludedKBNumbers = new ChangeTrackingList(); } - /// Initializes a new instance of WindowsUpdateConfigurationProperties. + /// Initializes a new instance of . /// Update classification included in the software update configuration. A comma separated string with required values. /// KB numbers excluded from the software update configuration. /// KB numbers included from the software update configuration. /// Reboot setting for the software update configuration. - internal WindowsUpdateConfigurationProperties(WindowsUpdateClassification? includedUpdateClassifications, IList excludedKBNumbers, IList includedKBNumbers, string rebootSetting) + /// Keeps track of any properties unknown to the library. + internal WindowsUpdateConfigurationProperties(WindowsUpdateClassification? includedUpdateClassifications, IList excludedKBNumbers, IList includedKBNumbers, string rebootSetting, Dictionary serializedAdditionalRawData) { IncludedUpdateClassifications = includedUpdateClassifications; ExcludedKBNumbers = excludedKBNumbers; IncludedKBNumbers = includedKBNumbers; RebootSetting = rebootSetting; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Update classification included in the software update configuration. A comma separated string with required values. diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AgentRegistrationInformationRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AgentRegistrationInformationRestOperations.cs index d0ee93d38414..cf6b5ba28a91 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AgentRegistrationInformationRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AgentRegistrationInformationRestOperations.cs @@ -134,9 +134,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationAccountRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationAccountRestOperations.cs index fb8924576173..8fe8b8c964c2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationAccountRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationAccountRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationRestOperations.cs index 8bba8a024da1..dd355063844b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/AutomationRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateConvertGraphRunbookContentRequest(string subscription request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CertificateRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CertificateRestOperations.cs index 4c6fa807f5c5..27badeaf87cf 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CertificateRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CertificateRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -312,9 +310,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionRestOperations.cs index 9dac78844eae..8885b7c8789c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionRestOperations.cs @@ -220,9 +220,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -314,9 +312,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionTypeRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionTypeRestOperations.cs index 61912b2814d9..6cea8c7e695c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionTypeRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ConnectionTypeRestOperations.cs @@ -220,9 +220,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CredentialRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CredentialRestOperations.cs index 460f78381e05..189622dabb37 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CredentialRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/CredentialRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -312,9 +310,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscCompilationJobRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscCompilationJobRestOperations.cs index 1a18943ee1ce..735d1aad563c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscCompilationJobRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscCompilationJobRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscConfigurationRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscConfigurationRestOperations.cs index 2fb3243517f3..5c3882fc5b10 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscConfigurationRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscConfigurationRestOperations.cs @@ -221,9 +221,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -315,9 +313,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeConfigurationRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeConfigurationRestOperations.cs index c3894607ede3..55fb9d91d2d9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeConfigurationRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeConfigurationRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeRestOperations.cs index 18cf3579734a..f9d519028458 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/DscNodeRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkerGroupRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkerGroupRestOperations.cs index 6c696bc75152..bf4ab16b1f78 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkerGroupRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkerGroupRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -310,9 +308,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkersRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkersRestOperations.cs index eea189dc3f5a..494a33541f68 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkersRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/HybridRunbookWorkersRestOperations.cs @@ -234,9 +234,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -333,9 +331,7 @@ internal HttpMessage CreateMoveRequest(string subscriptionId, string resourceGro request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobRestOperations.cs index 030001ee55f8..58e5f67aeb24 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobRestOperations.cs @@ -495,9 +495,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobScheduleRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobScheduleRestOperations.cs index f5e1bbb64e46..3961eae7ed34 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobScheduleRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/JobScheduleRestOperations.cs @@ -214,9 +214,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ModuleRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ModuleRestOperations.cs index b532922dbd85..bc0f07b3452b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ModuleRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ModuleRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -312,9 +310,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index ca9457a84e8f..c9a8df64974e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/Python2PackageRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/Python2PackageRestOperations.cs index fa26d06f1a2a..38fdf344ca74 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/Python2PackageRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/Python2PackageRestOperations.cs @@ -218,9 +218,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -312,9 +310,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/RunbookRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/RunbookRestOperations.cs index db97ed2c36b9..3d56c6107525 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/RunbookRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/RunbookRestOperations.cs @@ -303,9 +303,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -397,9 +395,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ScheduleRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ScheduleRestOperations.cs index 039481b56683..7c049220d42d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ScheduleRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/ScheduleRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -154,9 +152,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SoftwareUpdateConfigurationsRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SoftwareUpdateConfigurationsRestOperations.cs index 6fde91c078e6..3494b8ecc5f5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SoftwareUpdateConfigurationsRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SoftwareUpdateConfigurationsRestOperations.cs @@ -60,9 +60,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlRestOperations.cs index 4c088b7c4aca..57be99e811e9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -150,9 +148,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlSyncJobRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlSyncJobRestOperations.cs index f61bf8c8d445..210c30de7b07 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlSyncJobRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/SourceControlSyncJobRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/TestJobRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/TestJobRestOperations.cs index e051e18faf2d..0d83bf6e1895 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/TestJobRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/TestJobRestOperations.cs @@ -57,9 +57,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/VariableRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/VariableRestOperations.cs index 070768c9cc0f..1d8d15b684c5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/VariableRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/VariableRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -150,9 +148,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WatcherRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WatcherRestOperations.cs index 57f377785a97..a7d7ed82d5f8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WatcherRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WatcherRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -238,9 +236,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WebhookRestOperations.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WebhookRestOperations.cs index 1fc18b8f9d58..d71e8d8fb87a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WebhookRestOperations.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/RestOperations/WebhookRestOperations.cs @@ -297,9 +297,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -391,9 +389,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationData.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationData.cs index 8bf6477e60c3..66fc649f9671 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationData.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.Automation /// public partial class SoftwareUpdateConfigurationData : ResourceData { - /// Initializes a new instance of SoftwareUpdateConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// update specific properties for the Software update configuration. /// Schedule information for the Software update configuration. /// or is null. @@ -31,7 +35,7 @@ public SoftwareUpdateConfigurationData(SoftwareUpdateConfigurationSpecificProper ScheduleInfo = scheduleInfo; } - /// Initializes a new instance of SoftwareUpdateConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ public SoftwareUpdateConfigurationData(SoftwareUpdateConfigurationSpecificProper /// Last time resource was modified, which only appears in the response. /// LastModifiedBy property, which only appears in the response. /// Tasks information for the Software update configuration. - internal SoftwareUpdateConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SoftwareUpdateConfigurationSpecificProperties updateConfiguration, SoftwareUpdateConfigurationScheduleProperties scheduleInfo, string provisioningState, AutomationResponseError error, DateTimeOffset? createdOn, string createdBy, DateTimeOffset? lastModifiedOn, string lastModifiedBy, SoftwareUpdateConfigurationTasks tasks) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SoftwareUpdateConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SoftwareUpdateConfigurationSpecificProperties updateConfiguration, SoftwareUpdateConfigurationScheduleProperties scheduleInfo, string provisioningState, AutomationResponseError error, DateTimeOffset? createdOn, string createdBy, DateTimeOffset? lastModifiedOn, string lastModifiedBy, SoftwareUpdateConfigurationTasks tasks, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { UpdateConfiguration = updateConfiguration; ScheduleInfo = scheduleInfo; @@ -56,6 +61,12 @@ internal SoftwareUpdateConfigurationData(ResourceIdentifier id, string name, Res LastModifiedOn = lastModifiedOn; LastModifiedBy = lastModifiedBy; Tasks = tasks; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SoftwareUpdateConfigurationData() + { } /// update specific properties for the Software update configuration. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs index da5357554aa6..7bc1454e290c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs @@ -18,16 +18,16 @@ namespace Azure.ResourceManager.Avs.Models /// Model factory for models. public static partial class ArmAvsModelFactory { - /// Initializes a new instance of AvsSubscriptionTrialAvailabilityResult. + /// Initializes a new instance of . /// Trial status. /// Number of trial hosts available. /// A new instance for mocking. public static AvsSubscriptionTrialAvailabilityResult AvsSubscriptionTrialAvailabilityResult(AvsSubscriptionTrialStatus? status = null, int? availableHosts = null) { - return new AvsSubscriptionTrialAvailabilityResult(status, availableHosts); + return new AvsSubscriptionTrialAvailabilityResult(status, availableHosts, default); } - /// Initializes a new instance of AvsSubscriptionQuotaAvailabilityResult. + /// Initializes a new instance of . /// Remaining hosts quota by sku type. /// Host quota is active for current subscription. /// A new instance for mocking. @@ -35,10 +35,10 @@ public static AvsSubscriptionQuotaAvailabilityResult AvsSubscriptionQuotaAvailab { hostsRemaining ??= new Dictionary(); - return new AvsSubscriptionQuotaAvailabilityResult(hostsRemaining, quotaEnabled); + return new AvsSubscriptionQuotaAvailabilityResult(hostsRemaining, quotaEnabled, default); } - /// Initializes a new instance of AvsPrivateCloudData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -73,10 +73,10 @@ public static AvsPrivateCloudData AvsPrivateCloudData(ResourceIdentifier id = nu identitySources ??= new List(); externalCloudLinks ??= new List(); - return new AvsPrivateCloudData(id, name, resourceType, systemData, tags, location, skuName != null ? new AvsSku(skuName) : null, identity, managementCluster, internet, identitySources?.ToList(), availability, encryption, provisioningState, circuit, endpoints, networkBlock, managementNetwork, provisioningNetwork, vMotionNetwork, vCenterPassword, nsxtPassword, vCenterCertificateThumbprint, nsxtCertificateThumbprint, externalCloudLinks?.ToList(), secondaryCircuit, nsxPublicIPQuotaRaised); + return new AvsPrivateCloudData(id, name, resourceType, systemData, tags, location, skuName != null ? new AvsSku(skuName, new Dictionary()) : null, identity, managementCluster, internet, identitySources?.ToList(), availability, encryption, provisioningState, circuit, endpoints, networkBlock, managementNetwork, provisioningNetwork, vMotionNetwork, vCenterPassword, nsxtPassword, vCenterCertificateThumbprint, nsxtCertificateThumbprint, externalCloudLinks?.ToList(), secondaryCircuit, nsxPublicIPQuotaRaised, default); } - /// Initializes a new instance of ExpressRouteCircuit. + /// Initializes a new instance of . /// CIDR of primary subnet. /// CIDR of secondary subnet. /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). @@ -84,20 +84,20 @@ public static AvsPrivateCloudData AvsPrivateCloudData(ResourceIdentifier id = nu /// A new instance for mocking. public static ExpressRouteCircuit ExpressRouteCircuit(string primarySubnet = null, string secondarySubnet = null, ResourceIdentifier expressRouteId = null, ResourceIdentifier expressRoutePrivatePeeringId = null) { - return new ExpressRouteCircuit(primarySubnet, secondarySubnet, expressRouteId, expressRoutePrivatePeeringId); + return new ExpressRouteCircuit(primarySubnet, secondarySubnet, expressRouteId, expressRoutePrivatePeeringId, default); } - /// Initializes a new instance of AvsPrivateCloudEndpoints. + /// Initializes a new instance of . /// Endpoint for the NSX-T Data Center manager. /// Endpoint for Virtual Center Server Appliance. /// Endpoint for the HCX Cloud Manager. /// A new instance for mocking. public static AvsPrivateCloudEndpoints AvsPrivateCloudEndpoints(string nsxtManager = null, string vcsa = null, string hcxCloudManager = null) { - return new AvsPrivateCloudEndpoints(nsxtManager, vcsa, hcxCloudManager); + return new AvsPrivateCloudEndpoints(nsxtManager, vcsa, hcxCloudManager, default); } - /// Initializes a new instance of AvsManagementCluster. + /// Initializes a new instance of . /// The cluster size. /// The state of the cluster provisioning. /// The identity. @@ -107,10 +107,10 @@ public static AvsManagementCluster AvsManagementCluster(int? clusterSize = null, { hosts ??= new List(); - return new AvsManagementCluster(clusterSize, provisioningState, clusterId, hosts?.ToList()); + return new AvsManagementCluster(clusterSize, provisioningState, clusterId, hosts?.ToList(), default); } - /// Initializes a new instance of CommonClusterProperties. + /// Initializes a new instance of . /// The cluster size. /// The state of the cluster provisioning. /// The identity. @@ -120,10 +120,10 @@ public static CommonClusterProperties CommonClusterProperties(int? clusterSize = { hosts ??= new List(); - return new CommonClusterProperties(clusterSize, provisioningState, clusterId, hosts?.ToList()); + return new CommonClusterProperties(clusterSize, provisioningState, clusterId, hosts?.ToList(), default); } - /// Initializes a new instance of AvsEncryptionKeyVaultProperties. + /// Initializes a new instance of . /// The name of the key. /// The version of the key. /// The auto-detected version of the key if versionType is auto-detected. @@ -133,10 +133,10 @@ public static CommonClusterProperties CommonClusterProperties(int? clusterSize = /// A new instance for mocking. public static AvsEncryptionKeyVaultProperties AvsEncryptionKeyVaultProperties(string keyName = null, string keyVersion = null, string autoDetectedKeyVersion = null, Uri keyVaultUri = null, AvsEncryptionKeyStatus? keyState = null, AvsEncryptionVersionType? versionType = null) { - return new AvsEncryptionKeyVaultProperties(keyName, keyVersion, autoDetectedKeyVersion, keyVaultUri, keyState, versionType); + return new AvsEncryptionKeyVaultProperties(keyName, keyVersion, autoDetectedKeyVersion, keyVaultUri, keyState, versionType, default); } - /// Initializes a new instance of AvsPrivateCloudClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -151,10 +151,10 @@ public static AvsPrivateCloudClusterData AvsPrivateCloudClusterData(ResourceIden { hosts ??= new List(); - return new AvsPrivateCloudClusterData(id, name, resourceType, systemData, skuName != null ? new AvsSku(skuName) : null, clusterSize, provisioningState, clusterId, hosts?.ToList()); + return new AvsPrivateCloudClusterData(id, name, resourceType, systemData, skuName != null ? new AvsSku(skuName, new Dictionary()) : null, clusterSize, provisioningState, clusterId, hosts?.ToList(), default); } - /// Initializes a new instance of AvsClusterZone. + /// Initializes a new instance of . /// List of hosts belonging to the availability zone in a cluster. /// Availability zone identifier. /// A new instance for mocking. @@ -162,10 +162,10 @@ public static AvsClusterZone AvsClusterZone(IEnumerable hosts = null, st { hosts ??= new List(); - return new AvsClusterZone(hosts?.ToList(), zone); + return new AvsClusterZone(hosts?.ToList(), zone, default); } - /// Initializes a new instance of AvsPrivateCloudDatastoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -177,10 +177,10 @@ public static AvsClusterZone AvsClusterZone(IEnumerable hosts = null, st /// A new instance for mocking. public static AvsPrivateCloudDatastoreData AvsPrivateCloudDatastoreData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsPrivateCloudDatastoreProvisioningState? provisioningState = null, ResourceIdentifier netAppVolumeId = null, DiskPoolVolume diskPoolVolume = null, DatastoreStatus? status = null) { - return new AvsPrivateCloudDatastoreData(id, name, resourceType, systemData, provisioningState, netAppVolumeId != null ? ResourceManagerModelFactory.WritableSubResource(netAppVolumeId) : null, diskPoolVolume, status); + return new AvsPrivateCloudDatastoreData(id, name, resourceType, systemData, provisioningState, netAppVolumeId != null ? ResourceManagerModelFactory.WritableSubResource(netAppVolumeId) : null, diskPoolVolume, status, default); } - /// Initializes a new instance of DiskPoolVolume. + /// Initializes a new instance of . /// Azure resource ID of the iSCSI target. /// Name of the LUN to be used for datastore. /// Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN. @@ -188,10 +188,10 @@ public static AvsPrivateCloudDatastoreData AvsPrivateCloudDatastoreData(Resource /// A new instance for mocking. public static DiskPoolVolume DiskPoolVolume(ResourceIdentifier targetId = null, string lunName = null, LunMountMode? mountOption = null, string path = null) { - return new DiskPoolVolume(targetId, lunName, mountOption, path); + return new DiskPoolVolume(targetId, lunName, mountOption, path, default); } - /// Initializes a new instance of AdminCredentials. + /// Initializes a new instance of . /// NSX-T Manager username. /// NSX-T Manager password. /// vCenter admin username. @@ -199,10 +199,10 @@ public static DiskPoolVolume DiskPoolVolume(ResourceIdentifier targetId = null, /// A new instance for mocking. public static AdminCredentials AdminCredentials(string nsxtUsername = null, string nsxtPassword = null, string vCenterUsername = null, string vCenterPassword = null) { - return new AdminCredentials(nsxtUsername, nsxtPassword, vCenterUsername, vCenterPassword); + return new AdminCredentials(nsxtUsername, nsxtPassword, vCenterUsername, vCenterPassword, default); } - /// Initializes a new instance of HcxEnterpriseSiteData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -212,10 +212,10 @@ public static AdminCredentials AdminCredentials(string nsxtUsername = null, stri /// A new instance for mocking. public static HcxEnterpriseSiteData HcxEnterpriseSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string activationKey = null, HcxEnterpriseSiteStatus? status = null) { - return new HcxEnterpriseSiteData(id, name, resourceType, systemData, activationKey, status); + return new HcxEnterpriseSiteData(id, name, resourceType, systemData, activationKey, status, default); } - /// Initializes a new instance of ExpressRouteAuthorizationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -227,10 +227,10 @@ public static HcxEnterpriseSiteData HcxEnterpriseSiteData(ResourceIdentifier id /// A new instance for mocking. public static ExpressRouteAuthorizationData ExpressRouteAuthorizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExpressRouteAuthorizationProvisioningState? provisioningState = null, ResourceIdentifier expressRouteAuthorizationId = null, string expressRouteAuthorizationKey = null, ResourceIdentifier expressRouteId = null) { - return new ExpressRouteAuthorizationData(id, name, resourceType, systemData, provisioningState, expressRouteAuthorizationId, expressRouteAuthorizationKey, expressRouteId); + return new ExpressRouteAuthorizationData(id, name, resourceType, systemData, provisioningState, expressRouteAuthorizationId, expressRouteAuthorizationKey, expressRouteId, default); } - /// Initializes a new instance of GlobalReachConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -244,10 +244,10 @@ public static ExpressRouteAuthorizationData ExpressRouteAuthorizationData(Resour /// A new instance for mocking. public static GlobalReachConnectionData GlobalReachConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GlobalReachConnectionProvisioningState? provisioningState = null, string addressPrefix = null, string authorizationKey = null, GlobalReachConnectionStatus? circuitConnectionStatus = null, ResourceIdentifier peerExpressRouteCircuit = null, ResourceIdentifier expressRouteId = null) { - return new GlobalReachConnectionData(id, name, resourceType, systemData, provisioningState, addressPrefix, authorizationKey, circuitConnectionStatus, peerExpressRouteCircuit, expressRouteId); + return new GlobalReachConnectionData(id, name, resourceType, systemData, provisioningState, addressPrefix, authorizationKey, circuitConnectionStatus, peerExpressRouteCircuit, expressRouteId, default); } - /// Initializes a new instance of WorkloadNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -255,10 +255,10 @@ public static GlobalReachConnectionData GlobalReachConnectionData(ResourceIdenti /// A new instance for mocking. public static WorkloadNetworkData WorkloadNetworkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null) { - return new WorkloadNetworkData(id, name, resourceType, systemData); + return new WorkloadNetworkData(id, name, resourceType, systemData, default); } - /// Initializes a new instance of WorkloadNetworkSegmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -275,18 +275,18 @@ public static WorkloadNetworkSegmentData WorkloadNetworkSegmentData(ResourceIden { portVif ??= new List(); - return new WorkloadNetworkSegmentData(id, name, resourceType, systemData, displayName, connectedGateway, subnet, portVif?.ToList(), status, provisioningState, revision); + return new WorkloadNetworkSegmentData(id, name, resourceType, systemData, displayName, connectedGateway, subnet, portVif?.ToList(), status, provisioningState, revision, default); } - /// Initializes a new instance of WorkloadNetworkSegmentPortVif. + /// Initializes a new instance of . /// Name of port or VIF attached to segment. /// A new instance for mocking. public static WorkloadNetworkSegmentPortVif WorkloadNetworkSegmentPortVif(string portName = null) { - return new WorkloadNetworkSegmentPortVif(portName); + return new WorkloadNetworkSegmentPortVif(portName, default); } - /// Initializes a new instance of WorkloadNetworkDhcpData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -299,10 +299,10 @@ public static WorkloadNetworkSegmentPortVif WorkloadNetworkSegmentPortVif(string /// A new instance for mocking. public static WorkloadNetworkDhcpData WorkloadNetworkDhcpData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkDhcpEntity properties = null) { - return new WorkloadNetworkDhcpData(id, name, resourceType, systemData, properties); + return new WorkloadNetworkDhcpData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of WorkloadNetworkDhcpEntity. + /// Initializes a new instance of . /// Type of DHCP: SERVER or RELAY. /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. @@ -313,10 +313,10 @@ public static WorkloadNetworkDhcpEntity WorkloadNetworkDhcpEntity(string dhcpTyp { segments ??= new List(); - return new UnknownWorkloadNetworkDhcpEntity(dhcpType, displayName, segments?.ToList(), provisioningState, revision); + return new UnknownWorkloadNetworkDhcpEntity(dhcpType, displayName, segments?.ToList(), provisioningState, revision, default); } - /// Initializes a new instance of WorkloadNetworkGatewayData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -326,10 +326,10 @@ public static WorkloadNetworkDhcpEntity WorkloadNetworkDhcpEntity(string dhcpTyp /// A new instance for mocking. public static WorkloadNetworkGatewayData WorkloadNetworkGatewayData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string path = null) { - return new WorkloadNetworkGatewayData(id, name, resourceType, systemData, displayName, path); + return new WorkloadNetworkGatewayData(id, name, resourceType, systemData, displayName, path, default); } - /// Initializes a new instance of WorkloadNetworkPortMirroringProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -344,10 +344,10 @@ public static WorkloadNetworkGatewayData WorkloadNetworkGatewayData(ResourceIden /// A new instance for mocking. public static WorkloadNetworkPortMirroringProfileData WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, PortMirroringProfileDirection? direction = null, string source = null, string destination = null, PortMirroringProfileStatus? status = null, WorkloadNetworkPortMirroringProfileProvisioningState? provisioningState = null, long? revision = null) { - return new WorkloadNetworkPortMirroringProfileData(id, name, resourceType, systemData, displayName, direction, source, destination, status, provisioningState, revision); + return new WorkloadNetworkPortMirroringProfileData(id, name, resourceType, systemData, displayName, direction, source, destination, status, provisioningState, revision, default); } - /// Initializes a new instance of WorkloadNetworkVmGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -362,10 +362,10 @@ public static WorkloadNetworkVmGroupData WorkloadNetworkVmGroupData(ResourceIden { members ??= new List(); - return new WorkloadNetworkVmGroupData(id, name, resourceType, systemData, displayName, members?.ToList(), status, provisioningState, revision); + return new WorkloadNetworkVmGroupData(id, name, resourceType, systemData, displayName, members?.ToList(), status, provisioningState, revision, default); } - /// Initializes a new instance of WorkloadNetworkVirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -375,10 +375,10 @@ public static WorkloadNetworkVmGroupData WorkloadNetworkVmGroupData(ResourceIden /// A new instance for mocking. public static WorkloadNetworkVirtualMachineData WorkloadNetworkVirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, WorkloadNetworkVmType? vmType = null) { - return new WorkloadNetworkVirtualMachineData(id, name, resourceType, systemData, displayName, vmType); + return new WorkloadNetworkVirtualMachineData(id, name, resourceType, systemData, displayName, vmType, default); } - /// Initializes a new instance of WorkloadNetworkDnsServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -396,10 +396,10 @@ public static WorkloadNetworkDnsServiceData WorkloadNetworkDnsServiceData(Resour { fqdnZones ??= new List(); - return new WorkloadNetworkDnsServiceData(id, name, resourceType, systemData, displayName, dnsServiceIP, defaultDnsZone, fqdnZones?.ToList(), logLevel, status, provisioningState, revision); + return new WorkloadNetworkDnsServiceData(id, name, resourceType, systemData, displayName, dnsServiceIP, defaultDnsZone, fqdnZones?.ToList(), logLevel, status, provisioningState, revision, default); } - /// Initializes a new instance of WorkloadNetworkDnsZoneData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -417,10 +417,10 @@ public static WorkloadNetworkDnsZoneData WorkloadNetworkDnsZoneData(ResourceIden domain ??= new List(); dnsServerIPs ??= new List(); - return new WorkloadNetworkDnsZoneData(id, name, resourceType, systemData, displayName, domain?.ToList(), dnsServerIPs?.ToList(), sourceIP, dnsServices, provisioningState, revision); + return new WorkloadNetworkDnsZoneData(id, name, resourceType, systemData, displayName, domain?.ToList(), dnsServerIPs?.ToList(), sourceIP, dnsServices, provisioningState, revision, default); } - /// Initializes a new instance of WorkloadNetworkPublicIPData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -432,10 +432,10 @@ public static WorkloadNetworkDnsZoneData WorkloadNetworkDnsZoneData(ResourceIden /// A new instance for mocking. public static WorkloadNetworkPublicIPData WorkloadNetworkPublicIPData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, long? numberOfPublicIPs = null, string publicIPBlock = null, WorkloadNetworkPublicIPProvisioningState? provisioningState = null) { - return new WorkloadNetworkPublicIPData(id, name, resourceType, systemData, displayName, numberOfPublicIPs, publicIPBlock, provisioningState); + return new WorkloadNetworkPublicIPData(id, name, resourceType, systemData, displayName, numberOfPublicIPs, publicIPBlock, provisioningState, default); } - /// Initializes a new instance of AvsCloudLinkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -445,10 +445,10 @@ public static WorkloadNetworkPublicIPData WorkloadNetworkPublicIPData(ResourceId /// A new instance for mocking. public static AvsCloudLinkData AvsCloudLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsCloudLinkStatus? status = null, ResourceIdentifier linkedCloud = null) { - return new AvsCloudLinkData(id, name, resourceType, systemData, status, linkedCloud); + return new AvsCloudLinkData(id, name, resourceType, systemData, status, linkedCloud, default); } - /// Initializes a new instance of AvsPrivateCloudAddonData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -461,19 +461,19 @@ public static AvsCloudLinkData AvsCloudLinkData(ResourceIdentifier id = null, st /// A new instance for mocking. public static AvsPrivateCloudAddonData AvsPrivateCloudAddonData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsPrivateCloudAddonProperties properties = null) { - return new AvsPrivateCloudAddonData(id, name, resourceType, systemData, properties); + return new AvsPrivateCloudAddonData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of AvsPrivateCloudAddonProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. /// A new instance for mocking. public static AvsPrivateCloudAddonProperties AvsPrivateCloudAddonProperties(string addonType = "Unknown", AddonProvisioningState? provisioningState = null) { - return new UnknownAddonProperties(addonType, provisioningState); + return new UnknownAddonProperties(addonType, provisioningState, default); } - /// Initializes a new instance of AvsPrivateCloudClusterVirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -485,10 +485,10 @@ public static AvsPrivateCloudAddonProperties AvsPrivateCloudAddonProperties(stri /// A new instance for mocking. public static AvsPrivateCloudClusterVirtualMachineData AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string moRefId = null, string folderPath = null, VirtualMachineRestrictMovementState? restrictMovement = null) { - return new AvsPrivateCloudClusterVirtualMachineData(id, name, resourceType, systemData, displayName, moRefId, folderPath, restrictMovement); + return new AvsPrivateCloudClusterVirtualMachineData(id, name, resourceType, systemData, displayName, moRefId, folderPath, restrictMovement, default); } - /// Initializes a new instance of PlacementPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -501,10 +501,10 @@ public static AvsPrivateCloudClusterVirtualMachineData AvsPrivateCloudClusterVir /// A new instance for mocking. public static PlacementPolicyData PlacementPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PlacementPolicyProperties properties = null) { - return new PlacementPolicyData(id, name, resourceType, systemData, properties); + return new PlacementPolicyData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of PlacementPolicyProperties. + /// Initializes a new instance of . /// placement policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. @@ -512,10 +512,10 @@ public static PlacementPolicyData PlacementPolicyData(ResourceIdentifier id = nu /// A new instance for mocking. public static PlacementPolicyProperties PlacementPolicyProperties(string policyType = "Unknown", PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null) { - return new UnknownPlacementPolicyProperties(policyType, state, displayName, provisioningState); + return new UnknownPlacementPolicyProperties(policyType, state, displayName, provisioningState, default); } - /// Initializes a new instance of ScriptPackageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -527,10 +527,10 @@ public static PlacementPolicyProperties PlacementPolicyProperties(string policyT /// A new instance for mocking. public static ScriptPackageData ScriptPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string version = null, string company = null, Uri uri = null) { - return new ScriptPackageData(id, name, resourceType, systemData, description, version, company, uri); + return new ScriptPackageData(id, name, resourceType, systemData, description, version, company, uri, default); } - /// Initializes a new instance of ScriptCmdletData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -543,10 +543,10 @@ public static ScriptCmdletData ScriptCmdletData(ResourceIdentifier id = null, st { parameters ??= new List(); - return new ScriptCmdletData(id, name, resourceType, systemData, description, timeout, parameters?.ToList()); + return new ScriptCmdletData(id, name, resourceType, systemData, description, timeout, parameters?.ToList(), default); } - /// Initializes a new instance of ScriptParameter. + /// Initializes a new instance of . /// The type of parameter the script is expecting. psCredential is a PSCredentialObject. /// The parameter name that the script will expect a parameter value for. /// User friendly description of the parameter. @@ -555,10 +555,10 @@ public static ScriptCmdletData ScriptCmdletData(ResourceIdentifier id = null, st /// A new instance for mocking. public static ScriptParameter ScriptParameter(ScriptParameterType? parameterType = null, string name = null, string description = null, ParameterVisibilityStatus? visibility = null, ParameterOptionalityStatus? optional = null) { - return new ScriptParameter(parameterType, name, description, visibility, optional); + return new ScriptParameter(parameterType, name, description, visibility, optional, default); } - /// Initializes a new instance of ScriptExecutionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -596,46 +596,46 @@ public static ScriptExecutionData ScriptExecutionData(ResourceIdentifier id = nu warnings ??= new List(); errors ??= new List(); - return new ScriptExecutionData(id, name, resourceType, systemData, scriptCmdletId, parameters?.ToList(), hiddenParameters?.ToList(), failureReason, timeout, retention, submittedOn, startedOn, finishedOn, provisioningState, output?.ToList(), namedOutputs, information?.ToList(), warnings?.ToList(), errors?.ToList()); + return new ScriptExecutionData(id, name, resourceType, systemData, scriptCmdletId, parameters?.ToList(), hiddenParameters?.ToList(), failureReason, timeout, retention, submittedOn, startedOn, finishedOn, provisioningState, output?.ToList(), namedOutputs, information?.ToList(), warnings?.ToList(), errors?.ToList(), default); } - /// Initializes a new instance of AddonSrmProperties. + /// Initializes a new instance of . /// The state of the addon provisioning. /// The Site Recovery Manager (SRM) license. /// A new instance for mocking. public static AddonSrmProperties AddonSrmProperties(AddonProvisioningState? provisioningState = null, string licenseKey = null) { - return new AddonSrmProperties(AddonType.SRM, provisioningState, licenseKey); + return new AddonSrmProperties(AddonType.SRM, provisioningState, licenseKey, default); } - /// Initializes a new instance of AddonVrProperties. + /// Initializes a new instance of . /// The state of the addon provisioning. /// The vSphere Replication Server (VRS) count. /// A new instance for mocking. public static AddonVrProperties AddonVrProperties(AddonProvisioningState? provisioningState = null, int vrsCount = default) { - return new AddonVrProperties(AddonType.VR, provisioningState, vrsCount); + return new AddonVrProperties(AddonType.VR, provisioningState, vrsCount, default); } - /// Initializes a new instance of AddonHcxProperties. + /// Initializes a new instance of . /// The state of the addon provisioning. /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). /// A new instance for mocking. public static AddonHcxProperties AddonHcxProperties(AddonProvisioningState? provisioningState = null, string offer = null) { - return new AddonHcxProperties(AddonType.HCX, provisioningState, offer); + return new AddonHcxProperties(AddonType.HCX, provisioningState, offer, default); } - /// Initializes a new instance of AddonArcProperties. + /// Initializes a new instance of . /// The state of the addon provisioning. /// The VMware vCenter resource ID. /// A new instance for mocking. public static AddonArcProperties AddonArcProperties(AddonProvisioningState? provisioningState = null, string vCenter = null) { - return new AddonArcProperties(AddonType.Arc, provisioningState, vCenter); + return new AddonArcProperties(AddonType.Arc, provisioningState, vCenter, default); } - /// Initializes a new instance of WorkloadNetworkDhcpServer. + /// Initializes a new instance of . /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. /// The provisioning state. @@ -647,10 +647,10 @@ public static WorkloadNetworkDhcpServer WorkloadNetworkDhcpServer(string display { segments ??= new List(); - return new WorkloadNetworkDhcpServer(DhcpTypeEnum.Server, displayName, segments?.ToList(), provisioningState, revision, serverAddress, leaseTime); + return new WorkloadNetworkDhcpServer(DhcpTypeEnum.Server, displayName, segments?.ToList(), provisioningState, revision, serverAddress, leaseTime, default); } - /// Initializes a new instance of WorkloadNetworkDhcpRelay. + /// Initializes a new instance of . /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. /// The provisioning state. @@ -662,10 +662,10 @@ public static WorkloadNetworkDhcpRelay WorkloadNetworkDhcpRelay(string displayNa segments ??= new List(); serverAddresses ??= new List(); - return new WorkloadNetworkDhcpRelay(DhcpTypeEnum.Relay, displayName, segments?.ToList(), provisioningState, revision, serverAddresses?.ToList()); + return new WorkloadNetworkDhcpRelay(DhcpTypeEnum.Relay, displayName, segments?.ToList(), provisioningState, revision, serverAddresses?.ToList(), default); } - /// Initializes a new instance of VmPlacementPolicyProperties. + /// Initializes a new instance of . /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. @@ -676,10 +676,10 @@ public static VmPlacementPolicyProperties VmPlacementPolicyProperties(PlacementP { vmMembers ??= new List(); - return new VmPlacementPolicyProperties(PlacementPolicyType.VmVm, state, displayName, provisioningState, vmMembers?.ToList(), affinityType); + return new VmPlacementPolicyProperties(PlacementPolicyType.VmVm, state, displayName, provisioningState, vmMembers?.ToList(), affinityType, default); } - /// Initializes a new instance of VmHostPlacementPolicyProperties. + /// Initializes a new instance of . /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. @@ -694,7 +694,7 @@ public static VmHostPlacementPolicyProperties VmHostPlacementPolicyProperties(Pl vmMembers ??= new List(); hostMembers ??= new List(); - return new VmHostPlacementPolicyProperties(PlacementPolicyType.VmHost, state, displayName, provisioningState, vmMembers?.ToList(), hostMembers?.ToList(), affinityType, affinityStrength, azureHybridBenefitType); + return new VmHostPlacementPolicyProperties(PlacementPolicyType.VmHost, state, displayName, provisioningState, vmMembers?.ToList(), hostMembers?.ToList(), affinityType, affinityStrength, azureHybridBenefitType, default); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs index 3961e221a7ae..85f1b160a36d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsCloudLinkCloudLinksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsCloudLinkCloudLinksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsCloudLinkResource(Client, AvsCloudLinkData.DeserializeAvsCloudLinkData(e)), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, "AvsCloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsCloudLinkResource(Client, AvsCloudLinkData.DeserializeAvsCloudLinkData(e)), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, "AvsCloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsCloudLinkCloudLinksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsCloudLinkCloudLinksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsCloudLinkResource(Client, AvsCloudLinkData.DeserializeAvsCloudLinkData(e)), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, "AvsCloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsCloudLinkResource(Client, AvsCloudLinkData.DeserializeAvsCloudLinkData(e)), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, "AvsCloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs index bdc56acf8f65..60939f38d41a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.Avs /// public partial class AvsCloudLinkData : ResourceData { - /// Initializes a new instance of AvsCloudLinkData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsCloudLinkData() { } - /// Initializes a new instance of AvsCloudLinkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The state of the cloud link. /// Identifier of the other private cloud participating in the link. - internal AvsCloudLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsCloudLinkStatus? status, ResourceIdentifier linkedCloud) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AvsCloudLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsCloudLinkStatus? status, ResourceIdentifier linkedCloud, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Status = status; LinkedCloud = linkedCloud; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the cloud link. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs index 931d793d79d9..d6da734440e6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudAddonAddonsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudAddonAddonsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudAddonResource(Client, AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(e)), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, "AvsPrivateCloudAddonCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudAddonResource(Client, AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(e)), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, "AvsPrivateCloudAddonCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudAddonAddonsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudAddonAddonsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudAddonResource(Client, AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(e)), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, "AvsPrivateCloudAddonCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudAddonResource(Client, AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(e)), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, "AvsPrivateCloudAddonCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs index 952ec06d10e2..390ea5722760 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class AvsPrivateCloudAddonData : ResourceData { - /// Initializes a new instance of AvsPrivateCloudAddonData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsPrivateCloudAddonData() { } - /// Initializes a new instance of AvsPrivateCloudAddonData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +37,11 @@ public AvsPrivateCloudAddonData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// - internal AvsPrivateCloudAddonData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudAddonProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudAddonData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudAddonProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs index a8ef397496ed..180545acabb3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterClustersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterResource(Client, AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(e)), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudClusterResource(Client, AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(e)), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterClustersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterResource(Client, AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(e)), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudClusterResource(Client, AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(e)), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs index 8a0c268a0550..00c0c34b44be 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Avs /// public partial class AvsPrivateCloudClusterData : ResourceData { - /// Initializes a new instance of AvsPrivateCloudClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The cluster SKU. /// is null. public AvsPrivateCloudClusterData(AvsSku sku) @@ -30,7 +33,7 @@ public AvsPrivateCloudClusterData(AvsSku sku) Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of AvsPrivateCloudClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,13 +43,20 @@ public AvsPrivateCloudClusterData(AvsSku sku) /// The state of the cluster provisioning. /// The identity. /// The hosts. - internal AvsPrivateCloudClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsSku sku, int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsSku sku, int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; ClusterSize = clusterSize; ProvisioningState = provisioningState; ClusterId = clusterId; Hosts = hosts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvsPrivateCloudClusterData() + { } /// The cluster SKU. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs index 72958c868e88..b05d0cf5f032 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterVirtualMachineResource(Client, AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(e)), _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "AvsPrivateCloudClusterVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudClusterVirtualMachineResource(Client, AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(e)), _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "AvsPrivateCloudClusterVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterVirtualMachineResource(Client, AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(e)), _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "AvsPrivateCloudClusterVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudClusterVirtualMachineResource(Client, AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(e)), _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "AvsPrivateCloudClusterVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs index 8a5f35966721..e2a1f3659877 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class AvsPrivateCloudClusterVirtualMachineData : ResourceData { - /// Initializes a new instance of AvsPrivateCloudClusterVirtualMachineData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsPrivateCloudClusterVirtualMachineData() { } - /// Initializes a new instance of AvsPrivateCloudClusterVirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +36,14 @@ public AvsPrivateCloudClusterVirtualMachineData() /// Virtual machine managed object reference id. /// Path to virtual machine's folder starting from datacenter virtual machine folder. /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). - internal AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; MoRefId = moRefId; FolderPath = folderPath; RestrictMovement = restrictMovement; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the VM. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs index 6861e3ee38e1..4ccbfcc444fa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudPrivateCloudsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudPrivateCloudsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "AvsPrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "AvsPrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudPrivateCloudsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudPrivateCloudsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "AvsPrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "AvsPrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs index 7420cb2de967..1d69a68d74a3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Avs /// public partial class AvsPrivateCloudData : TrackedResourceData { - /// Initializes a new instance of AvsPrivateCloudData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The private cloud SKU. /// is null. @@ -32,7 +35,7 @@ public AvsPrivateCloudData(AzureLocation location, AvsSku sku) : base(location) ExternalCloudLinks = new ChangeTrackingList(); } - /// Initializes a new instance of AvsPrivateCloudData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -60,7 +63,8 @@ public AvsPrivateCloudData(AzureLocation location, AvsSku sku) : base(location) /// Array of cloud link IDs from other clouds that connect to this one. /// A secondary expressRoute circuit from a separate AZ. Only present in a stretched private cloud. /// Flag to indicate whether the private cloud has the quota for provisioned NSX Public IP count raised from 64 to 1024. - internal AvsPrivateCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AvsSku sku, ManagedServiceIdentity identity, AvsManagementCluster managementCluster, InternetConnectivityState? internet, IList identitySources, PrivateCloudAvailabilityProperties availability, CustomerManagedEncryption encryption, AvsPrivateCloudProvisioningState? provisioningState, ExpressRouteCircuit circuit, AvsPrivateCloudEndpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vMotionNetwork, string vCenterPassword, string nsxtPassword, string vCenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, ExpressRouteCircuit secondaryCircuit, NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AvsSku sku, ManagedServiceIdentity identity, AvsManagementCluster managementCluster, InternetConnectivityState? internet, IList identitySources, PrivateCloudAvailabilityProperties availability, CustomerManagedEncryption encryption, AvsPrivateCloudProvisioningState? provisioningState, ExpressRouteCircuit circuit, AvsPrivateCloudEndpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vMotionNetwork, string vCenterPassword, string nsxtPassword, string vCenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, ExpressRouteCircuit secondaryCircuit, NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -83,6 +87,12 @@ internal AvsPrivateCloudData(ResourceIdentifier id, string name, ResourceType re ExternalCloudLinks = externalCloudLinks; SecondaryCircuit = secondaryCircuit; NsxPublicIPQuotaRaised = nsxPublicIPQuotaRaised; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvsPrivateCloudData() + { } /// The private cloud SKU. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs index 6f1d6d25fefb..e9a21364528f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudDatastoreResource(Client, AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(e)), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, "AvsPrivateCloudDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudDatastoreResource(Client, AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(e)), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, "AvsPrivateCloudDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudDatastoreResource(Client, AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(e)), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, "AvsPrivateCloudDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudDatastoreResource(Client, AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(e)), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, "AvsPrivateCloudDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs index 1cc350a94b09..5312fc99f6e1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.Avs /// public partial class AvsPrivateCloudDatastoreData : ResourceData { - /// Initializes a new instance of AvsPrivateCloudDatastoreData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsPrivateCloudDatastoreData() { } - /// Initializes a new instance of AvsPrivateCloudDatastoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,12 +37,14 @@ public AvsPrivateCloudDatastoreData() /// An Azure NetApp Files volume. /// An iSCSI volume. /// The operational status of the datastore. - internal AvsPrivateCloudDatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudDatastoreProvisioningState? provisioningState, WritableSubResource netAppVolume, DiskPoolVolume diskPoolVolume, DatastoreStatus? status) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudDatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudDatastoreProvisioningState? provisioningState, WritableSubResource netAppVolume, DiskPoolVolume diskPoolVolume, DatastoreStatus? status, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; NetAppVolume = netAppVolume; DiskPoolVolume = diskPoolVolume; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the datastore provisioning. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs index d8e339e6f9bf..2c3232bda872 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _expressRouteAuthorizationAuthorizationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _expressRouteAuthorizationAuthorizationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteAuthorizationResource(Client, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(e)), _expressRouteAuthorizationAuthorizationsClientDiagnostics, Pipeline, "ExpressRouteAuthorizationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ExpressRouteAuthorizationResource(Client, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(e)), _expressRouteAuthorizationAuthorizationsClientDiagnostics, Pipeline, "ExpressRouteAuthorizationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _expressRouteAuthorizationAuthorizationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _expressRouteAuthorizationAuthorizationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteAuthorizationResource(Client, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(e)), _expressRouteAuthorizationAuthorizationsClientDiagnostics, Pipeline, "ExpressRouteAuthorizationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ExpressRouteAuthorizationResource(Client, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(e)), _expressRouteAuthorizationAuthorizationsClientDiagnostics, Pipeline, "ExpressRouteAuthorizationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs index f46e2342705f..340b022912f0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class ExpressRouteAuthorizationData : ResourceData { - /// Initializes a new instance of ExpressRouteAuthorizationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExpressRouteAuthorizationData() { } - /// Initializes a new instance of ExpressRouteAuthorizationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +36,14 @@ public ExpressRouteAuthorizationData() /// The ID of the ExpressRoute Circuit Authorization. /// The key of the ExpressRoute Circuit Authorization. /// The ID of the ExpressRoute Circuit. - internal ExpressRouteAuthorizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExpressRouteAuthorizationProvisioningState? provisioningState, ResourceIdentifier expressRouteAuthorizationId, string expressRouteAuthorizationKey, ResourceIdentifier expressRouteId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ExpressRouteAuthorizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExpressRouteAuthorizationProvisioningState? provisioningState, ResourceIdentifier expressRouteAuthorizationId, string expressRouteAuthorizationKey, ResourceIdentifier expressRouteId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; ExpressRouteAuthorizationId = expressRouteAuthorizationId; ExpressRouteAuthorizationKey = expressRouteAuthorizationKey; ExpressRouteId = expressRouteId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the ExpressRoute Circuit Authorization provisioning. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 44ae45f53536..afbe0577b380 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -193,7 +193,7 @@ public virtual AsyncPageable GetAvsPrivateCloudsAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); } /// @@ -215,7 +215,7 @@ public virtual Pageable GetAvsPrivateClouds(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs index 0b6993821650..b2e76a8437cc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _globalReachConnectionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _globalReachConnectionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GlobalReachConnectionResource(Client, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(e)), _globalReachConnectionClientDiagnostics, Pipeline, "GlobalReachConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GlobalReachConnectionResource(Client, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(e)), _globalReachConnectionClientDiagnostics, Pipeline, "GlobalReachConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _globalReachConnectionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _globalReachConnectionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GlobalReachConnectionResource(Client, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(e)), _globalReachConnectionClientDiagnostics, Pipeline, "GlobalReachConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GlobalReachConnectionResource(Client, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(e)), _globalReachConnectionClientDiagnostics, Pipeline, "GlobalReachConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs index cb5dfd95247f..1baa9d439250 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class GlobalReachConnectionData : ResourceData { - /// Initializes a new instance of GlobalReachConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GlobalReachConnectionData() { } - /// Initializes a new instance of GlobalReachConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +38,8 @@ public GlobalReachConnectionData() /// The connection status of the global reach connection. /// Identifier of the ExpressRoute Circuit to peer with in the global reach connection. /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the global reach connection. - internal GlobalReachConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GlobalReachConnectionProvisioningState? provisioningState, string addressPrefix, string authorizationKey, GlobalReachConnectionStatus? circuitConnectionStatus, ResourceIdentifier peerExpressRouteCircuit, ResourceIdentifier expressRouteId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal GlobalReachConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GlobalReachConnectionProvisioningState? provisioningState, string addressPrefix, string authorizationKey, GlobalReachConnectionStatus? circuitConnectionStatus, ResourceIdentifier peerExpressRouteCircuit, ResourceIdentifier expressRouteId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; AddressPrefix = addressPrefix; @@ -41,6 +47,7 @@ internal GlobalReachConnectionData(ResourceIdentifier id, string name, ResourceT CircuitConnectionStatus = circuitConnectionStatus; PeerExpressRouteCircuit = peerExpressRouteCircuit; ExpressRouteId = expressRouteId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the ExpressRoute Circuit Authorization provisioning. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs index 94f174f1c885..8399fe891eb9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _hcxEnterpriseSiteRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hcxEnterpriseSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HcxEnterpriseSiteResource(Client, HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(e)), _hcxEnterpriseSiteClientDiagnostics, Pipeline, "HcxEnterpriseSiteCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HcxEnterpriseSiteResource(Client, HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(e)), _hcxEnterpriseSiteClientDiagnostics, Pipeline, "HcxEnterpriseSiteCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _hcxEnterpriseSiteRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hcxEnterpriseSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HcxEnterpriseSiteResource(Client, HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(e)), _hcxEnterpriseSiteClientDiagnostics, Pipeline, "HcxEnterpriseSiteCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HcxEnterpriseSiteResource(Client, HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(e)), _hcxEnterpriseSiteClientDiagnostics, Pipeline, "HcxEnterpriseSiteCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs index d0b5e846e9b9..cab39a46cb3f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.Avs /// public partial class HcxEnterpriseSiteData : ResourceData { - /// Initializes a new instance of HcxEnterpriseSiteData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HcxEnterpriseSiteData() { } - /// Initializes a new instance of HcxEnterpriseSiteData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The activation key. /// The status of the HCX Enterprise Site. - internal HcxEnterpriseSiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string activationKey, HcxEnterpriseSiteStatus? status) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal HcxEnterpriseSiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string activationKey, HcxEnterpriseSiteStatus? status, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ActivationKey = activationKey; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The activation key. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.Serialization.cs index 5e7d8d9d5eba..1298071d5955 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AddonArcProperties : IUtf8JsonSerializable + public partial class AddonArcProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VCenter)) { @@ -22,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("addonType"u8); writer.WriteStringValue(AddonType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AddonArcProperties DeserializeAddonArcProperties(JsonElement element) + internal static AddonArcProperties DeserializeAddonArcProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +56,7 @@ internal static AddonArcProperties DeserializeAddonArcProperties(JsonElement ele Optional vCenter = default; AddonType addonType = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vCenter"u8)) @@ -55,8 +78,61 @@ internal static AddonArcProperties DeserializeAddonArcProperties(JsonElement ele provisioningState = new AddonProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddonArcProperties(addonType, Optional.ToNullable(provisioningState), vCenter.Value, serializedAdditionalRawData); + } + + AddonArcProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddonArcProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddonArcProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddonArcProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddonArcProperties model) + { + if (model is null) + { + return null; } - return new AddonArcProperties(addonType, Optional.ToNullable(provisioningState), vCenter.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddonArcProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddonArcProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs index 54cacc3159d4..00fac172b910 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The properties of an Arc addon. public partial class AddonArcProperties : AvsPrivateCloudAddonProperties { - /// Initializes a new instance of AddonArcProperties. + /// Initializes a new instance of . public AddonArcProperties() { AddonType = AddonType.Arc; } - /// Initializes a new instance of AddonArcProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. /// The VMware vCenter resource ID. - internal AddonArcProperties(AddonType addonType, AddonProvisioningState? provisioningState, string vCenter) : base(addonType, provisioningState) + /// Keeps track of any properties unknown to the library. + internal AddonArcProperties(AddonType addonType, AddonProvisioningState? provisioningState, string vCenter, Dictionary serializedAdditionalRawData) : base(addonType, provisioningState, serializedAdditionalRawData) { VCenter = vCenter; AddonType = addonType; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs index e32153b21a8a..81665f43955b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AddonHcxProperties : IUtf8JsonSerializable + public partial class AddonHcxProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("offer"u8); writer.WriteStringValue(Offer); writer.WritePropertyName("addonType"u8); writer.WriteStringValue(AddonType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement element) + internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +53,7 @@ internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement ele string offer = default; AddonType addonType = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("offer"u8)) @@ -52,8 +75,61 @@ internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement ele provisioningState = new AddonProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddonHcxProperties(addonType, Optional.ToNullable(provisioningState), offer, serializedAdditionalRawData); + } + + AddonHcxProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddonHcxProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddonHcxProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddonHcxProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddonHcxProperties model) + { + if (model is null) + { + return null; } - return new AddonHcxProperties(addonType, Optional.ToNullable(provisioningState), offer); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddonHcxProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddonHcxProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs index 577f51ad8abe..511123e7f83f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Avs.Models /// The properties of an HCX addon. public partial class AddonHcxProperties : AvsPrivateCloudAddonProperties { - /// Initializes a new instance of AddonHcxProperties. + /// Initializes a new instance of . /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). /// is null. public AddonHcxProperties(string offer) @@ -24,16 +25,22 @@ public AddonHcxProperties(string offer) AddonType = AddonType.HCX; } - /// Initializes a new instance of AddonHcxProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). - internal AddonHcxProperties(AddonType addonType, AddonProvisioningState? provisioningState, string offer) : base(addonType, provisioningState) + /// Keeps track of any properties unknown to the library. + internal AddonHcxProperties(AddonType addonType, AddonProvisioningState? provisioningState, string offer, Dictionary serializedAdditionalRawData) : base(addonType, provisioningState, serializedAdditionalRawData) { Offer = offer; AddonType = addonType; } + /// Initializes a new instance of for deserialization. + internal AddonHcxProperties() + { + } + /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). public string Offer { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs index 71e2d8022c32..03bda7be3c56 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class AddonList + internal partial class AddonList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddonList DeserializeAddonList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddonList DeserializeAddonList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static AddonList DeserializeAddonList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddonList(Optional.ToList(value), nextLink.Value); + return new AddonList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AddonList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddonList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddonList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddonList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddonList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddonList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddonList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs index 12bcb27fd944..bc638342eed3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of addons. internal partial class AddonList { - /// Initializes a new instance of AddonList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddonList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AddonList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal AddonList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AddonList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs index 28caf011b16e..a77b8b1cda60 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AddonSrmProperties : IUtf8JsonSerializable + public partial class AddonSrmProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LicenseKey)) { @@ -22,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("addonType"u8); writer.WriteStringValue(AddonType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AddonSrmProperties DeserializeAddonSrmProperties(JsonElement element) + internal static AddonSrmProperties DeserializeAddonSrmProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +56,7 @@ internal static AddonSrmProperties DeserializeAddonSrmProperties(JsonElement ele Optional licenseKey = default; AddonType addonType = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("licenseKey"u8)) @@ -55,8 +78,61 @@ internal static AddonSrmProperties DeserializeAddonSrmProperties(JsonElement ele provisioningState = new AddonProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddonSrmProperties(addonType, Optional.ToNullable(provisioningState), licenseKey.Value, serializedAdditionalRawData); + } + + AddonSrmProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddonSrmProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddonSrmProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddonSrmProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddonSrmProperties model) + { + if (model is null) + { + return null; } - return new AddonSrmProperties(addonType, Optional.ToNullable(provisioningState), licenseKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddonSrmProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddonSrmProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs index 85790a0d2a67..00e6431de8c0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The properties of a Site Recovery Manager (SRM) addon. public partial class AddonSrmProperties : AvsPrivateCloudAddonProperties { - /// Initializes a new instance of AddonSrmProperties. + /// Initializes a new instance of . public AddonSrmProperties() { AddonType = AddonType.SRM; } - /// Initializes a new instance of AddonSrmProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. /// The Site Recovery Manager (SRM) license. - internal AddonSrmProperties(AddonType addonType, AddonProvisioningState? provisioningState, string licenseKey) : base(addonType, provisioningState) + /// Keeps track of any properties unknown to the library. + internal AddonSrmProperties(AddonType addonType, AddonProvisioningState? provisioningState, string licenseKey, Dictionary serializedAdditionalRawData) : base(addonType, provisioningState, serializedAdditionalRawData) { LicenseKey = licenseKey; AddonType = addonType; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs index e986dca5d4eb..ddb49cff6772 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AddonVrProperties : IUtf8JsonSerializable + public partial class AddonVrProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vrsCount"u8); writer.WriteNumberValue(VrsCount); writer.WritePropertyName("addonType"u8); writer.WriteStringValue(AddonType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AddonVrProperties DeserializeAddonVrProperties(JsonElement element) + internal static AddonVrProperties DeserializeAddonVrProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +53,7 @@ internal static AddonVrProperties DeserializeAddonVrProperties(JsonElement eleme int vrsCount = default; AddonType addonType = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vrsCount"u8)) @@ -52,8 +75,61 @@ internal static AddonVrProperties DeserializeAddonVrProperties(JsonElement eleme provisioningState = new AddonProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddonVrProperties(addonType, Optional.ToNullable(provisioningState), vrsCount, serializedAdditionalRawData); + } + + AddonVrProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddonVrProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddonVrProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddonVrProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddonVrProperties model) + { + if (model is null) + { + return null; } - return new AddonVrProperties(addonType, Optional.ToNullable(provisioningState), vrsCount); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddonVrProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddonVrProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs index ee8cfa29d85b..b29ed6adcd66 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs @@ -5,12 +5,15 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The properties of a vSphere Replication (VR) addon. public partial class AddonVrProperties : AvsPrivateCloudAddonProperties { - /// Initializes a new instance of AddonVrProperties. + /// Initializes a new instance of . /// The vSphere Replication Server (VRS) count. public AddonVrProperties(int vrsCount) { @@ -18,16 +21,22 @@ public AddonVrProperties(int vrsCount) AddonType = AddonType.VR; } - /// Initializes a new instance of AddonVrProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. /// The vSphere Replication Server (VRS) count. - internal AddonVrProperties(AddonType addonType, AddonProvisioningState? provisioningState, int vrsCount) : base(addonType, provisioningState) + /// Keeps track of any properties unknown to the library. + internal AddonVrProperties(AddonType addonType, AddonProvisioningState? provisioningState, int vrsCount, Dictionary serializedAdditionalRawData) : base(addonType, provisioningState, serializedAdditionalRawData) { VrsCount = vrsCount; AddonType = addonType; } + /// Initializes a new instance of for deserialization. + internal AddonVrProperties() + { + } + /// The vSphere Replication Server (VRS) count. public int VrsCount { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs index 52eddd9acb2c..67217f42aded 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AdminCredentials + public partial class AdminCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AdminCredentials DeserializeAdminCredentials(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AdminCredentials DeserializeAdminCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static AdminCredentials DeserializeAdminCredentials(JsonElement element Optional nsxtPassword = default; Optional vcenterUsername = default; Optional vcenterPassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nsxtUsername"u8)) @@ -44,8 +73,61 @@ internal static AdminCredentials DeserializeAdminCredentials(JsonElement element vcenterPassword = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AdminCredentials(nsxtUsername.Value, nsxtPassword.Value, vcenterUsername.Value, vcenterPassword.Value); + return new AdminCredentials(nsxtUsername.Value, nsxtPassword.Value, vcenterUsername.Value, vcenterPassword.Value, serializedAdditionalRawData); + } + + AdminCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAdminCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AdminCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAdminCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AdminCredentials model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AdminCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAdminCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs index ebbac40b04b9..3e24b364d7e4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// Administrative credentials for accessing vCenter and NSX-T. public partial class AdminCredentials { - /// Initializes a new instance of AdminCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AdminCredentials() { } - /// Initializes a new instance of AdminCredentials. + /// Initializes a new instance of . /// NSX-T Manager username. /// NSX-T Manager password. /// vCenter admin username. /// vCenter admin password. - internal AdminCredentials(string nsxtUsername, string nsxtPassword, string vCenterUsername, string vCenterPassword) + /// Keeps track of any properties unknown to the library. + internal AdminCredentials(string nsxtUsername, string nsxtPassword, string vCenterUsername, string vCenterPassword, Dictionary serializedAdditionalRawData) { NsxtUsername = nsxtUsername; NsxtPassword = nsxtPassword; VCenterUsername = vCenterUsername; VCenterPassword = vCenterPassword; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// NSX-T Manager username. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkData.Serialization.cs index 69d8bd64f7b8..164b706118ca 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class AvsCloudLinkData : IUtf8JsonSerializable + public partial class AvsCloudLinkData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LinkedCloud); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element) + internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +62,7 @@ internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element Optional systemData = default; Optional status = default; Optional linkedCloud = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -96,8 +119,61 @@ internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsCloudLinkData(id, name, type, systemData.Value, Optional.ToNullable(status), linkedCloud.Value, serializedAdditionalRawData); + } + + AvsCloudLinkData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsCloudLinkData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsCloudLinkData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsCloudLinkData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsCloudLinkData model) + { + if (model is null) + { + return null; } - return new AvsCloudLinkData(id, name, type, systemData.Value, Optional.ToNullable(status), linkedCloud.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsCloudLinkData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsCloudLinkData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs index 4d7f9652a764..6070ea13b2e6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsClusterZone + public partial class AvsClusterZone : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvsClusterZone DeserializeAvsClusterZone(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvsClusterZone DeserializeAvsClusterZone(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> hosts = default; Optional zone = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hosts"u8)) @@ -42,8 +70,61 @@ internal static AvsClusterZone DeserializeAvsClusterZone(JsonElement element) zone = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvsClusterZone(Optional.ToList(hosts), zone.Value); + return new AvsClusterZone(Optional.ToList(hosts), zone.Value, serializedAdditionalRawData); + } + + AvsClusterZone IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsClusterZone(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsClusterZone IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsClusterZone(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsClusterZone model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsClusterZone(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsClusterZone(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs index ece1cc831fc5..02e712ae3f71 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Avs.Models /// Zone and associated hosts info. public partial class AvsClusterZone { - /// Initializes a new instance of AvsClusterZone. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvsClusterZone() { Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of AvsClusterZone. + /// Initializes a new instance of . /// List of hosts belonging to the availability zone in a cluster. /// Availability zone identifier. - internal AvsClusterZone(IReadOnlyList hosts, string zone) + /// Keeps track of any properties unknown to the library. + internal AvsClusterZone(IReadOnlyList hosts, string zone, Dictionary serializedAdditionalRawData) { Hosts = hosts; Zone = zone; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of hosts belonging to the availability zone in a cluster. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs index 8d5209666b1d..65d1ac4e4b86 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsEncryptionKeyVaultProperties : IUtf8JsonSerializable + public partial class AvsEncryptionKeyVaultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyName)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVaultUrl"u8); writer.WriteStringValue(KeyVaultUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVaultProperties(JsonElement element) + internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVaultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault Optional keyVaultUrl = default; Optional keyState = default; Optional versionType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyName"u8)) @@ -90,8 +112,61 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault versionType = new AvsEncryptionVersionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsEncryptionKeyVaultProperties(keyName.Value, keyVersion.Value, autoDetectedKeyVersion.Value, keyVaultUrl.Value, Optional.ToNullable(keyState), Optional.ToNullable(versionType), serializedAdditionalRawData); + } + + AvsEncryptionKeyVaultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsEncryptionKeyVaultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsEncryptionKeyVaultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsEncryptionKeyVaultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsEncryptionKeyVaultProperties model) + { + if (model is null) + { + return null; } - return new AvsEncryptionKeyVaultProperties(keyName.Value, keyVersion.Value, autoDetectedKeyVersion.Value, keyVaultUrl.Value, Optional.ToNullable(keyState), Optional.ToNullable(versionType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsEncryptionKeyVaultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsEncryptionKeyVaultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs index 97246d924178..6fba801b8344 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Avs.Models { /// An Encryption Key. public partial class AvsEncryptionKeyVaultProperties { - /// Initializes a new instance of AvsEncryptionKeyVaultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsEncryptionKeyVaultProperties() { } - /// Initializes a new instance of AvsEncryptionKeyVaultProperties. + /// Initializes a new instance of . /// The name of the key. /// The version of the key. /// The auto-detected version of the key if versionType is auto-detected. /// The URL of the vault. /// The state of key provided. /// Property of the key if user provided or auto detected. - internal AvsEncryptionKeyVaultProperties(string keyName, string keyVersion, string autoDetectedKeyVersion, Uri keyVaultUri, AvsEncryptionKeyStatus? keyState, AvsEncryptionVersionType? versionType) + /// Keeps track of any properties unknown to the library. + internal AvsEncryptionKeyVaultProperties(string keyName, string keyVersion, string autoDetectedKeyVersion, Uri keyVaultUri, AvsEncryptionKeyStatus? keyState, AvsEncryptionVersionType? versionType, Dictionary serializedAdditionalRawData) { KeyName = keyName; KeyVersion = keyVersion; @@ -32,6 +37,7 @@ internal AvsEncryptionKeyVaultProperties(string keyName, string keyVersion, stri KeyVaultUri = keyVaultUri; KeyState = keyState; VersionType = versionType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the key. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs index 9681104e7420..2b86705e56c9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsManagementCluster : IUtf8JsonSerializable + public partial class AvsManagementCluster : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClusterSize)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement element) + internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +65,7 @@ internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement Optional provisioningState = default; Optional clusterId = default; Optional> hosts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clusterSize"u8)) @@ -87,8 +109,61 @@ internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement hosts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsManagementCluster(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts), serializedAdditionalRawData); + } + + AvsManagementCluster IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsManagementCluster(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsManagementCluster IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsManagementCluster(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsManagementCluster model) + { + if (model is null) + { + return null; } - return new AvsManagementCluster(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsManagementCluster(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsManagementCluster(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs index 649f4d3e4671..ef1b8d143420 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Avs.Models @@ -12,17 +13,18 @@ namespace Azure.ResourceManager.Avs.Models /// The properties of a management cluster. public partial class AvsManagementCluster : CommonClusterProperties { - /// Initializes a new instance of AvsManagementCluster. + /// Initializes a new instance of . public AvsManagementCluster() { } - /// Initializes a new instance of AvsManagementCluster. + /// Initializes a new instance of . /// The cluster size. /// The state of the cluster provisioning. /// The identity. /// The hosts. - internal AvsManagementCluster(int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts) : base(clusterSize, provisioningState, clusterId, hosts) + /// Keeps track of any properties unknown to the library. + internal AvsManagementCluster(int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts, Dictionary serializedAdditionalRawData) : base(clusterSize, provisioningState, clusterId, hosts, serializedAdditionalRawData) { } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonData.Serialization.cs index d9d55d845efa..69b8579e370f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class AvsPrivateCloudAddonData : IUtf8JsonSerializable + public partial class AvsPrivateCloudAddonData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(JsonElement element) + internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(Jso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudAddonData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + AvsPrivateCloudAddonData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudAddonData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudAddonData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudAddonData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudAddonData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudAddonData(Response response) + { + if (response is null) + { + return null; } - return new AvsPrivateCloudAddonData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudAddonData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs index 8b77472d6169..011ab7240540 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudAddonProperties : IUtf8JsonSerializable + public partial class AvsPrivateCloudAddonProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("addonType"u8); writer.WriteStringValue(AddonType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsPrivateCloudAddonProperties DeserializeAvsPrivateCloudAddonProperties(JsonElement element) + internal static AvsPrivateCloudAddonProperties DeserializeAvsPrivateCloudAddonProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,7 +58,82 @@ internal static AvsPrivateCloudAddonProperties DeserializeAvsPrivateCloudAddonPr case "VR": return AddonVrProperties.DeserializeAddonVrProperties(element); } } - return UnknownAddonProperties.DeserializeUnknownAddonProperties(element); + + // Unknown type found so we will deserialize the base properties only + AddonType addonType = default; + Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("addonType"u8)) + { + addonType = new AddonType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AddonProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownAddonProperties(addonType, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + AvsPrivateCloudAddonProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudAddonProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudAddonProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudAddonProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudAddonProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudAddonProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudAddonProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs index 28e202788e7b..c753bb51ec15 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Avs.Models { /// @@ -12,20 +16,26 @@ namespace Azure.ResourceManager.Avs.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownAddonProperties))] public abstract partial class AvsPrivateCloudAddonProperties { - /// Initializes a new instance of AvsPrivateCloudAddonProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected AvsPrivateCloudAddonProperties() { } - /// Initializes a new instance of AvsPrivateCloudAddonProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. - internal AvsPrivateCloudAddonProperties(AddonType addonType, AddonProvisioningState? provisioningState) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudAddonProperties(AddonType addonType, AddonProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) { AddonType = addonType; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of private cloud addon. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterData.Serialization.cs index 324a8a68e162..3b7a2864e03f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterData.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class AvsPrivateCloudClusterData : IUtf8JsonSerializable + public partial class AvsPrivateCloudClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ClusterSize)) @@ -38,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsPrivateCloudClusterData DeserializeAvsPrivateCloudClusterData(JsonElement element) + internal static AvsPrivateCloudClusterData DeserializeAvsPrivateCloudClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +84,7 @@ internal static AvsPrivateCloudClusterData DeserializeAvsPrivateCloudClusterData Optional provisioningState = default; Optional clusterId = default; Optional> hosts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -140,8 +169,61 @@ internal static AvsPrivateCloudClusterData DeserializeAvsPrivateCloudClusterData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudClusterData(id, name, type, systemData.Value, sku, Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts), serializedAdditionalRawData); + } + + AvsPrivateCloudClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudClusterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudClusterData(Response response) + { + if (response is null) + { + return null; } - return new AvsPrivateCloudClusterData(id, name, type, systemData.Value, sku, Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs index 0c5602ecc8ad..e39903edca24 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudClusterPatch : IUtf8JsonSerializable + public partial class AvsPrivateCloudClusterPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AvsPrivateCloudClusterPatch DeserializeAvsPrivateCloudClusterPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clusterSize = default; + Optional> hosts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("clusterSize"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterSize = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("hosts"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hosts = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudClusterPatch(Optional.ToNullable(clusterSize), Optional.ToList(hosts), serializedAdditionalRawData); + } + + AvsPrivateCloudClusterPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudClusterPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudClusterPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudClusterPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudClusterPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudClusterPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudClusterPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs index d6499836f3eb..98606db86a76 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.Avs.Models /// An update of a cluster resource. public partial class AvsPrivateCloudClusterPatch { - /// Initializes a new instance of AvsPrivateCloudClusterPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsPrivateCloudClusterPatch() { Hosts = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The cluster size. + /// The hosts. + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudClusterPatch(int? clusterSize, IList hosts, Dictionary serializedAdditionalRawData) + { + ClusterSize = clusterSize; + Hosts = hosts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The cluster size. public int? ClusterSize { get; set; } /// The hosts. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs index 85b5a0cb6fb9..34de51916127 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class AvsPrivateCloudClusterVirtualMachineData : IUtf8JsonSerializable + public partial class AvsPrivateCloudClusterVirtualMachineData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsPrivateCloudClusterVirtualMachineData DeserializeAvsPrivateCloudClusterVirtualMachineData(JsonElement element) + internal static AvsPrivateCloudClusterVirtualMachineData DeserializeAvsPrivateCloudClusterVirtualMachineData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static AvsPrivateCloudClusterVirtualMachineData DeserializeAvsPrivateCl Optional moRefId = default; Optional folderPath = default; Optional restrictMovement = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -99,8 +122,61 @@ internal static AvsPrivateCloudClusterVirtualMachineData DeserializeAvsPrivateCl } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudClusterVirtualMachineData(id, name, type, systemData.Value, displayName.Value, moRefId.Value, folderPath.Value, Optional.ToNullable(restrictMovement), serializedAdditionalRawData); + } + + AvsPrivateCloudClusterVirtualMachineData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudClusterVirtualMachineData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudClusterVirtualMachineData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudClusterVirtualMachineData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudClusterVirtualMachineData model) + { + if (model is null) + { + return null; } - return new AvsPrivateCloudClusterVirtualMachineData(id, name, type, systemData.Value, displayName.Value, moRefId.Value, folderPath.Value, Optional.ToNullable(restrictMovement)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudClusterVirtualMachineData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudClusterVirtualMachineData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs index 9896dae42f53..10b7e616352f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudClusterVirtualMachineRestrictMovement : IUtf8JsonSerializable + public partial class AvsPrivateCloudClusterVirtualMachineRestrictMovement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RestrictMovement)) { writer.WritePropertyName("restrictMovement"u8); writer.WriteStringValue(RestrictMovement.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AvsPrivateCloudClusterVirtualMachineRestrictMovement DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional restrictMovement = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("restrictMovement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + restrictMovement = new VirtualMachineRestrictMovementState(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudClusterVirtualMachineRestrictMovement(Optional.ToNullable(restrictMovement), serializedAdditionalRawData); + } + + AvsPrivateCloudClusterVirtualMachineRestrictMovement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudClusterVirtualMachineRestrictMovement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudClusterVirtualMachineRestrictMovement model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudClusterVirtualMachineRestrictMovement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs index 69676a4ec41a..1d509faf46d8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// Set VM DRS-driven movement to restricted (enabled) or not (disabled). public partial class AvsPrivateCloudClusterVirtualMachineRestrictMovement { - /// Initializes a new instance of AvsPrivateCloudClusterVirtualMachineRestrictMovement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsPrivateCloudClusterVirtualMachineRestrictMovement() { } + /// Initializes a new instance of . + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudClusterVirtualMachineRestrictMovement(VirtualMachineRestrictMovementState? restrictMovement, Dictionary serializedAdditionalRawData) + { + RestrictMovement = restrictMovement; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). public VirtualMachineRestrictMovementState? RestrictMovement { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudData.Serialization.cs index 1a7f56e66f47..4c5fabd5fc55 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudData.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class AvsPrivateCloudData : IUtf8JsonSerializable + public partial class AvsPrivateCloudData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -43,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagementCluster)) { writer.WritePropertyName("managementCluster"u8); - writer.WriteObjectValue(ManagementCluster); + if (ManagementCluster is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagementCluster).Serialize(writer, options); + } } if (Optional.IsDefined(Internet)) { @@ -56,24 +77,52 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IdentitySources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Availability)) { writer.WritePropertyName("availability"u8); - writer.WriteObjectValue(Availability); + if (Availability is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Availability).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(Circuit)) { writer.WritePropertyName("circuit"u8); - writer.WriteObjectValue(Circuit); + if (Circuit is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Circuit).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkBlock)) { @@ -93,14 +142,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecondaryCircuit)) { writer.WritePropertyName("secondaryCircuit"u8); - writer.WriteObjectValue(SecondaryCircuit); + if (SecondaryCircuit is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecondaryCircuit).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsPrivateCloudData DeserializeAvsPrivateCloudData(JsonElement element) + internal static AvsPrivateCloudData DeserializeAvsPrivateCloudData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -132,6 +202,7 @@ internal static AvsPrivateCloudData DeserializeAvsPrivateCloudData(JsonElement e Optional> externalCloudLinks = default; Optional secondaryCircuit = default; Optional nsxPublicIPQuotaRaised = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -359,8 +430,61 @@ internal static AvsPrivateCloudData DeserializeAvsPrivateCloudData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, managementCluster.Value, Optional.ToNullable(internet), Optional.ToList(identitySources), availability.Value, encryption.Value, Optional.ToNullable(provisioningState), circuit.Value, endpoints.Value, networkBlock.Value, managementNetwork.Value, provisioningNetwork.Value, vmotionNetwork.Value, vcenterPassword.Value, nsxtPassword.Value, vcenterCertificateThumbprint.Value, nsxtCertificateThumbprint.Value, Optional.ToList(externalCloudLinks), secondaryCircuit.Value, Optional.ToNullable(nsxPublicIPQuotaRaised), serializedAdditionalRawData); + } + + AvsPrivateCloudData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudData model) + { + if (model is null) + { + return null; } - return new AvsPrivateCloudData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, managementCluster.Value, Optional.ToNullable(internet), Optional.ToList(identitySources), availability.Value, encryption.Value, Optional.ToNullable(provisioningState), circuit.Value, endpoints.Value, networkBlock.Value, managementNetwork.Value, provisioningNetwork.Value, vmotionNetwork.Value, vcenterPassword.Value, nsxtPassword.Value, vcenterCertificateThumbprint.Value, nsxtCertificateThumbprint.Value, Optional.ToList(externalCloudLinks), secondaryCircuit.Value, Optional.ToNullable(nsxPublicIPQuotaRaised)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreData.Serialization.cs index d0cbb48c2c29..0f298de59cfd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { - public partial class AvsPrivateCloudDatastoreData : IUtf8JsonSerializable + public partial class AvsPrivateCloudDatastoreData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiskPoolVolume)) { writer.WritePropertyName("diskPoolVolume"u8); - writer.WriteObjectValue(DiskPoolVolume); + if (DiskPoolVolume is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskPoolVolume).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsPrivateCloudDatastoreData DeserializeAvsPrivateCloudDatastoreData(JsonElement element) + internal static AvsPrivateCloudDatastoreData DeserializeAvsPrivateCloudDatastoreData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +77,7 @@ internal static AvsPrivateCloudDatastoreData DeserializeAvsPrivateCloudDatastore Optional netAppVolume = default; Optional diskPoolVolume = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -122,8 +152,61 @@ internal static AvsPrivateCloudDatastoreData DeserializeAvsPrivateCloudDatastore } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudDatastoreData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), netAppVolume, diskPoolVolume.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + AvsPrivateCloudDatastoreData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudDatastoreData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudDatastoreData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudDatastoreData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudDatastoreData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudDatastoreData(Response response) + { + if (response is null) + { + return null; } - return new AvsPrivateCloudDatastoreData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), netAppVolume, diskPoolVolume.Value, Optional.ToNullable(status)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudDatastoreData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs index df2aaa78344f..dd2e893cdc6f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudEndpoints + public partial class AvsPrivateCloudEndpoints : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(Jso Optional nsxtManager = default; Optional vcsa = default; Optional hcxCloudManager = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nsxtManager"u8)) @@ -38,8 +67,61 @@ internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(Jso hcxCloudManager = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvsPrivateCloudEndpoints(nsxtManager.Value, vcsa.Value, hcxCloudManager.Value); + return new AvsPrivateCloudEndpoints(nsxtManager.Value, vcsa.Value, hcxCloudManager.Value, serializedAdditionalRawData); + } + + AvsPrivateCloudEndpoints IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudEndpoints(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudEndpoints IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudEndpoints(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudEndpoints model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudEndpoints(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudEndpoints(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs index 64bc871be1a2..6e383f651927 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// Endpoint addresses. public partial class AvsPrivateCloudEndpoints { - /// Initializes a new instance of AvsPrivateCloudEndpoints. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvsPrivateCloudEndpoints() { } - /// Initializes a new instance of AvsPrivateCloudEndpoints. + /// Initializes a new instance of . /// Endpoint for the NSX-T Data Center manager. /// Endpoint for Virtual Center Server Appliance. /// Endpoint for the HCX Cloud Manager. - internal AvsPrivateCloudEndpoints(string nsxtManager, string vcsa, string hcxCloudManager) + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudEndpoints(string nsxtManager, string vcsa, string hcxCloudManager, Dictionary serializedAdditionalRawData) { NsxtManager = nsxtManager; Vcsa = vcsa; HcxCloudManager = hcxCloudManager; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Endpoint for the NSX-T Data Center manager. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs index c44332fcc230..17e9e4b280d3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudPatch : IUtf8JsonSerializable + public partial class AvsPrivateCloudPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,7 +45,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagementCluster)) { writer.WritePropertyName("managementCluster"u8); - writer.WriteObjectValue(ManagementCluster); + if (ManagementCluster is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagementCluster).Serialize(writer, options); + } } if (Optional.IsDefined(Internet)) { @@ -49,22 +65,215 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IdentitySources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Availability)) { writer.WritePropertyName("availability"u8); - writer.WriteObjectValue(Availability); + if (Availability is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Availability).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional managementCluster = default; + Optional internet = default; + Optional> identitySources = default; + Optional availability = default; + Optional encryption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("managementCluster"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managementCluster = AvsManagementCluster.DeserializeAvsManagementCluster(property0.Value); + continue; + } + if (property0.NameEquals("internet"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + internet = new InternetConnectivityState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("identitySources"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(SingleSignOnIdentitySource.DeserializeSingleSignOnIdentitySource(item)); + } + identitySources = array; + continue; + } + if (property0.NameEquals("availability"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availability = PrivateCloudAvailabilityProperties.DeserializePrivateCloudAvailabilityProperties(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = CustomerManagedEncryption.DeserializeCustomerManagedEncryption(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsPrivateCloudPatch(Optional.ToDictionary(tags), identity, managementCluster.Value, Optional.ToNullable(internet), Optional.ToList(identitySources), availability.Value, encryption.Value, serializedAdditionalRawData); + } + + AvsPrivateCloudPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsPrivateCloudPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsPrivateCloudPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsPrivateCloudPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsPrivateCloudPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs index 4d2b85d9bd85..6d1713f8538e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,37 @@ namespace Azure.ResourceManager.Avs.Models /// An update to a private cloud resource. public partial class AvsPrivateCloudPatch { - /// Initializes a new instance of AvsPrivateCloudPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AvsPrivateCloudPatch() { Tags = new ChangeTrackingDictionary(); IdentitySources = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// The identity of the private cloud, if configured. Current supported identity types: SystemAssigned, None. + /// The default cluster used for management. + /// Connectivity to internet is enabled or disabled. + /// vCenter Single Sign On Identity Sources. + /// Properties describing how the cloud is distributed across availability zones. + /// Customer managed key encryption, can be enabled or disabled. + /// Keeps track of any properties unknown to the library. + internal AvsPrivateCloudPatch(IDictionary tags, ManagedServiceIdentity identity, AvsManagementCluster managementCluster, InternetConnectivityState? internet, IList identitySources, PrivateCloudAvailabilityProperties availability, CustomerManagedEncryption encryption, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + ManagementCluster = managementCluster; + Internet = internet; + IdentitySources = identitySources; + Availability = availability; + Encryption = encryption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// The identity of the private cloud, if configured. Current supported identity types: SystemAssigned, None. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.Serialization.cs index af6bbe8527fc..4120eb16f2fb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsSku : IUtf8JsonSerializable + public partial class AvsSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvsSku DeserializeAvsSku(JsonElement element) + internal static AvsSku DeserializeAvsSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -34,8 +57,61 @@ internal static AvsSku DeserializeAvsSku(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvsSku(name, serializedAdditionalRawData); + } + + AvsSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsSku model) + { + if (model is null) + { + return null; } - return new AvsSku(name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs index 965b3a3c0e80..780cfd776063 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Avs.Models /// The resource model definition representing SKU. public partial class AvsSku { - /// Initializes a new instance of AvsSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the SKU. /// is null. public AvsSku(string name) @@ -23,6 +27,20 @@ public AvsSku(string name) Name = name; } + /// Initializes a new instance of . + /// The name of the SKU. + /// Keeps track of any properties unknown to the library. + internal AvsSku(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvsSku() + { + } + /// The name of the SKU. public string Name { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs index 3861051d37a3..1e7d2081e1aa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsSubscriptionQuotaAvailabilityResult + public partial class AvsSubscriptionQuotaAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptionQuotaAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptionQuotaAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> hostsRemaining = default; Optional quotaEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hostsRemaining"u8)) @@ -46,8 +74,61 @@ internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptio quotaEnabled = new AvsSubscriptionQuotaEnabled(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvsSubscriptionQuotaAvailabilityResult(Optional.ToDictionary(hostsRemaining), Optional.ToNullable(quotaEnabled)); + return new AvsSubscriptionQuotaAvailabilityResult(Optional.ToDictionary(hostsRemaining), Optional.ToNullable(quotaEnabled), serializedAdditionalRawData); + } + + AvsSubscriptionQuotaAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsSubscriptionQuotaAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsSubscriptionQuotaAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsSubscriptionQuotaAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsSubscriptionQuotaAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsSubscriptionQuotaAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsSubscriptionQuotaAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs index 7952d3fb16fc..24c9fadc44d6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Avs.Models /// Subscription quotas. public partial class AvsSubscriptionQuotaAvailabilityResult { - /// Initializes a new instance of AvsSubscriptionQuotaAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvsSubscriptionQuotaAvailabilityResult() { HostsRemaining = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AvsSubscriptionQuotaAvailabilityResult. + /// Initializes a new instance of . /// Remaining hosts quota by sku type. /// Host quota is active for current subscription. - internal AvsSubscriptionQuotaAvailabilityResult(IReadOnlyDictionary hostsRemaining, AvsSubscriptionQuotaEnabled? quotaEnabled) + /// Keeps track of any properties unknown to the library. + internal AvsSubscriptionQuotaAvailabilityResult(IReadOnlyDictionary hostsRemaining, AvsSubscriptionQuotaEnabled? quotaEnabled, Dictionary serializedAdditionalRawData) { HostsRemaining = hostsRemaining; QuotaEnabled = quotaEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Remaining hosts quota by sku type. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs index f20e996cfd87..b092c49d2514 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class AvsSubscriptionTrialAvailabilityResult + public partial class AvsSubscriptionTrialAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptionTrialAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptionTrialAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional availableHosts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -40,8 +69,61 @@ internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptio availableHosts = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvsSubscriptionTrialAvailabilityResult(Optional.ToNullable(status), Optional.ToNullable(availableHosts)); + return new AvsSubscriptionTrialAvailabilityResult(Optional.ToNullable(status), Optional.ToNullable(availableHosts), serializedAdditionalRawData); + } + + AvsSubscriptionTrialAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvsSubscriptionTrialAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsSubscriptionTrialAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsSubscriptionTrialAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvsSubscriptionTrialAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvsSubscriptionTrialAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvsSubscriptionTrialAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs index 2b1fac0d0afc..339fc2b85c0d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// Subscription trial availability. public partial class AvsSubscriptionTrialAvailabilityResult { - /// Initializes a new instance of AvsSubscriptionTrialAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvsSubscriptionTrialAvailabilityResult() { } - /// Initializes a new instance of AvsSubscriptionTrialAvailabilityResult. + /// Initializes a new instance of . /// Trial status. /// Number of trial hosts available. - internal AvsSubscriptionTrialAvailabilityResult(AvsSubscriptionTrialStatus? status, int? availableHosts) + /// Keeps track of any properties unknown to the library. + internal AvsSubscriptionTrialAvailabilityResult(AvsSubscriptionTrialStatus? status, int? availableHosts, Dictionary serializedAdditionalRawData) { Status = status; AvailableHosts = availableHosts; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Trial status. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs index e0f91b366c83..18f32aa3fbb7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class CloudLinkList + internal partial class CloudLinkList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudLinkList DeserializeCloudLinkList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudLinkList DeserializeCloudLinkList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static CloudLinkList DeserializeCloudLinkList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudLinkList(Optional.ToList(value), nextLink.Value); + return new CloudLinkList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CloudLinkList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudLinkList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudLinkList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudLinkList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudLinkList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudLinkList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudLinkList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs index fcca7fe0dd1c..0a5319b86c93 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of cloud links. internal partial class CloudLinkList { - /// Initializes a new instance of CloudLinkList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudLinkList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CloudLinkList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal CloudLinkList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CloudLinkList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs index 97963681d612..52e6142665fb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class ClusterList + internal partial class ClusterList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClusterList DeserializeClusterList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClusterList DeserializeClusterList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ClusterList DeserializeClusterList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClusterList(Optional.ToList(value), nextLink.Value); + return new ClusterList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ClusterList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClusterList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClusterList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClusterList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClusterList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClusterList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClusterList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs index 8634106d2a11..89fc8e8546bb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of clusters. internal partial class ClusterList { - /// Initializes a new instance of ClusterList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ClusterList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ClusterList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal ClusterList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ClusterList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs index 8d6417d379fb..26c4bcf73e9f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - internal partial class ClusterZoneList + internal partial class ClusterZoneList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClusterZoneList DeserializeClusterZoneList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClusterZoneList DeserializeClusterZoneList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> zones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -36,8 +81,61 @@ internal static ClusterZoneList DeserializeClusterZoneList(JsonElement element) zones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClusterZoneList(Optional.ToList(zones)); + return new ClusterZoneList(Optional.ToList(zones), serializedAdditionalRawData); + } + + ClusterZoneList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClusterZoneList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClusterZoneList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClusterZoneList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClusterZoneList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClusterZoneList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClusterZoneList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs index c7360a4048e3..7fb7a0855b58 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Avs.Models /// List of all zones and associated hosts for a cluster. internal partial class ClusterZoneList { - /// Initializes a new instance of ClusterZoneList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ClusterZoneList() { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of ClusterZoneList. + /// Initializes a new instance of . /// Zone and associated hosts info. - internal ClusterZoneList(IReadOnlyList zones) + /// Keeps track of any properties unknown to the library. + internal ClusterZoneList(IReadOnlyList zones, Dictionary serializedAdditionalRawData) { Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Zone and associated hosts info. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs index c671710fc3fa..70638f9ba089 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class CommonClusterProperties : IUtf8JsonSerializable + public partial class CommonClusterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClusterSize)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommonClusterProperties DeserializeCommonClusterProperties(JsonElement element) + internal static CommonClusterProperties DeserializeCommonClusterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +65,7 @@ internal static CommonClusterProperties DeserializeCommonClusterProperties(JsonE Optional provisioningState = default; Optional clusterId = default; Optional> hosts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clusterSize"u8)) @@ -87,8 +109,61 @@ internal static CommonClusterProperties DeserializeCommonClusterProperties(JsonE hosts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommonClusterProperties(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts), serializedAdditionalRawData); + } + + CommonClusterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommonClusterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommonClusterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommonClusterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommonClusterProperties model) + { + if (model is null) + { + return null; } - return new CommonClusterProperties(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommonClusterProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommonClusterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs index 83417d1721d1..dfb69d2e34c3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Avs.Models /// The common properties of a cluster. public partial class CommonClusterProperties { - /// Initializes a new instance of CommonClusterProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommonClusterProperties() { Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of CommonClusterProperties. + /// Initializes a new instance of . /// The cluster size. /// The state of the cluster provisioning. /// The identity. /// The hosts. - internal CommonClusterProperties(int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts) + /// Keeps track of any properties unknown to the library. + internal CommonClusterProperties(int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts, Dictionary serializedAdditionalRawData) { ClusterSize = clusterSize; ProvisioningState = provisioningState; ClusterId = clusterId; Hosts = hosts; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The cluster size. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs index 84bb21c8026f..cf4ffa8a8dc4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class CustomerManagedEncryption : IUtf8JsonSerializable + public partial class CustomerManagedEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProperties)) { writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties); + if (KeyVaultProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(JsonElement element) + internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional keyVaultProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -56,8 +86,61 @@ internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(J keyVaultProperties = AvsEncryptionKeyVaultProperties.DeserializeAvsEncryptionKeyVaultProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomerManagedEncryption(Optional.ToNullable(status), keyVaultProperties.Value, serializedAdditionalRawData); + } + + CustomerManagedEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomerManagedEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomerManagedEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomerManagedEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomerManagedEncryption model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomerManagedEncryption(Response response) + { + if (response is null) + { + return null; } - return new CustomerManagedEncryption(Optional.ToNullable(status), keyVaultProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomerManagedEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs index fa7038957a26..a57af680bf24 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The properties of customer managed encryption key. public partial class CustomerManagedEncryption { - /// Initializes a new instance of CustomerManagedEncryption. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomerManagedEncryption() { } - /// Initializes a new instance of CustomerManagedEncryption. + /// Initializes a new instance of . /// Status of customer managed encryption key. /// The key vault where the encryption key is stored. - internal CustomerManagedEncryption(AvsEncryptionState? status, AvsEncryptionKeyVaultProperties keyVaultProperties) + /// Keeps track of any properties unknown to the library. + internal CustomerManagedEncryption(AvsEncryptionState? status, AvsEncryptionKeyVaultProperties keyVaultProperties, Dictionary serializedAdditionalRawData) { Status = status; KeyVaultProperties = keyVaultProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of customer managed encryption key. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs index cfd41633ad17..4bf5513979ec 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class DatastoreList + internal partial class DatastoreList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatastoreList DeserializeDatastoreList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatastoreList DeserializeDatastoreList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static DatastoreList DeserializeDatastoreList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatastoreList(Optional.ToList(value), nextLink.Value); + return new DatastoreList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DatastoreList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatastoreList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatastoreList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatastoreList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatastoreList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatastoreList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatastoreList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs index c8a3454f7e68..5fa9e3bcc575 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of datastores. internal partial class DatastoreList { - /// Initializes a new instance of DatastoreList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatastoreList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatastoreList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal DatastoreList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DatastoreList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs index dafe34742360..150199577cdd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class DiskPoolVolume : IUtf8JsonSerializable + public partial class DiskPoolVolume : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targetId"u8); writer.WriteStringValue(TargetId); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mountOption"u8); writer.WriteStringValue(MountOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element) + internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element) string lunName = default; Optional mountOption = default; Optional path = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetId"u8)) @@ -63,8 +86,61 @@ internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element) path = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskPoolVolume(targetId, lunName, Optional.ToNullable(mountOption), path.Value, serializedAdditionalRawData); + } + + DiskPoolVolume IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskPoolVolume(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskPoolVolume IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskPoolVolume(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskPoolVolume model) + { + if (model is null) + { + return null; } - return new DiskPoolVolume(targetId, lunName, Optional.ToNullable(mountOption), path.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskPoolVolume(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskPoolVolume(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs index ab4d55c097e9..27b905df75a0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Avs.Models /// An iSCSI volume from Microsoft.StoragePool provider. public partial class DiskPoolVolume { - /// Initializes a new instance of DiskPoolVolume. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Azure resource ID of the iSCSI target. /// Name of the LUN to be used for datastore. /// or is null. @@ -26,17 +30,24 @@ public DiskPoolVolume(ResourceIdentifier targetId, string lunName) LunName = lunName; } - /// Initializes a new instance of DiskPoolVolume. + /// Initializes a new instance of . /// Azure resource ID of the iSCSI target. /// Name of the LUN to be used for datastore. /// Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN. /// Device path. - internal DiskPoolVolume(ResourceIdentifier targetId, string lunName, LunMountMode? mountOption, string path) + /// Keeps track of any properties unknown to the library. + internal DiskPoolVolume(ResourceIdentifier targetId, string lunName, LunMountMode? mountOption, string path, Dictionary serializedAdditionalRawData) { TargetId = targetId; LunName = lunName; MountOption = mountOption; Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskPoolVolume() + { } /// Azure resource ID of the iSCSI target. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs index 191b9f1bbdbd..cfd966f8838e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class ExpressRouteAuthorizationData : IUtf8JsonSerializable + public partial class ExpressRouteAuthorizationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExpressRouteId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizationData(JsonElement element) + internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizati Optional expressRouteAuthorizationId = default; Optional expressRouteAuthorizationKey = default; Optional expressRouteId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +135,61 @@ internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizati } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExpressRouteAuthorizationData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), expressRouteAuthorizationId.Value, expressRouteAuthorizationKey.Value, expressRouteId.Value, serializedAdditionalRawData); + } + + ExpressRouteAuthorizationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExpressRouteAuthorizationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExpressRouteAuthorizationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExpressRouteAuthorizationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExpressRouteAuthorizationData model) + { + if (model is null) + { + return null; } - return new ExpressRouteAuthorizationData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), expressRouteAuthorizationId.Value, expressRouteAuthorizationKey.Value, expressRouteId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExpressRouteAuthorizationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExpressRouteAuthorizationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs index 74154159ecb1..7d3eb94042e3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class ExpressRouteAuthorizationList + internal partial class ExpressRouteAuthorizationList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExpressRouteAuthorizationList DeserializeExpressRouteAuthorizationList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExpressRouteAuthorizationList DeserializeExpressRouteAuthorizationList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ExpressRouteAuthorizationList DeserializeExpressRouteAuthorizati nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExpressRouteAuthorizationList(Optional.ToList(value), nextLink.Value); + return new ExpressRouteAuthorizationList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ExpressRouteAuthorizationList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExpressRouteAuthorizationList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExpressRouteAuthorizationList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExpressRouteAuthorizationList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExpressRouteAuthorizationList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExpressRouteAuthorizationList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExpressRouteAuthorizationList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs index 79a226b87dcf..e6c098326e81 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of ExpressRoute Circuit Authorizations. internal partial class ExpressRouteAuthorizationList { - /// Initializes a new instance of ExpressRouteAuthorizationList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExpressRouteAuthorizationList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExpressRouteAuthorizationList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal ExpressRouteAuthorizationList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ExpressRouteAuthorizationList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs index 17729bb92a6f..6b3f98316afe 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs @@ -5,21 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class ExpressRouteCircuit : IUtf8JsonSerializable + public partial class ExpressRouteCircuit : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement element) + internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +50,7 @@ internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement e Optional secondarySubnet = default; Optional expressRouteId = default; Optional expressRoutePrivatePeeringId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primarySubnet"u8)) @@ -58,8 +81,61 @@ internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement e expressRoutePrivatePeeringId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExpressRouteCircuit(primarySubnet.Value, secondarySubnet.Value, expressRouteId.Value, expressRoutePrivatePeeringId.Value, serializedAdditionalRawData); + } + + ExpressRouteCircuit IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExpressRouteCircuit(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExpressRouteCircuit IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExpressRouteCircuit(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExpressRouteCircuit model) + { + if (model is null) + { + return null; } - return new ExpressRouteCircuit(primarySubnet.Value, secondarySubnet.Value, expressRouteId.Value, expressRoutePrivatePeeringId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExpressRouteCircuit(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExpressRouteCircuit(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs index 5931b2fc7e15..67185dd0f3f3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.Avs.Models /// An ExpressRoute Circuit. public partial class ExpressRouteCircuit { - /// Initializes a new instance of ExpressRouteCircuit. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExpressRouteCircuit() { } - /// Initializes a new instance of ExpressRouteCircuit. + /// Initializes a new instance of . /// CIDR of primary subnet. /// CIDR of secondary subnet. /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). /// ExpressRoute Circuit private peering identifier. - internal ExpressRouteCircuit(string primarySubnet, string secondarySubnet, ResourceIdentifier expressRouteId, ResourceIdentifier expressRoutePrivatePeeringId) + /// Keeps track of any properties unknown to the library. + internal ExpressRouteCircuit(string primarySubnet, string secondarySubnet, ResourceIdentifier expressRouteId, ResourceIdentifier expressRoutePrivatePeeringId, Dictionary serializedAdditionalRawData) { PrimarySubnet = primarySubnet; SecondarySubnet = secondarySubnet; ExpressRouteId = expressRouteId; ExpressRoutePrivatePeeringId = expressRoutePrivatePeeringId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// CIDR of primary subnet. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs index 7047cb777c15..34175c96aefa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class GlobalReachConnectionData : IUtf8JsonSerializable + public partial class GlobalReachConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ExpressRouteId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(JsonElement element) + internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(J Optional circuitConnectionStatus = default; Optional peerExpressRouteCircuit = default; Optional expressRouteId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -138,8 +161,61 @@ internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GlobalReachConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), addressPrefix.Value, authorizationKey.Value, Optional.ToNullable(circuitConnectionStatus), peerExpressRouteCircuit.Value, expressRouteId.Value, serializedAdditionalRawData); + } + + GlobalReachConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGlobalReachConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GlobalReachConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGlobalReachConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GlobalReachConnectionData model) + { + if (model is null) + { + return null; } - return new GlobalReachConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), addressPrefix.Value, authorizationKey.Value, Optional.ToNullable(circuitConnectionStatus), peerExpressRouteCircuit.Value, expressRouteId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GlobalReachConnectionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGlobalReachConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs index 17b9b9c906b9..a319e65f63f0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class GlobalReachConnectionList + internal partial class GlobalReachConnectionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GlobalReachConnectionList DeserializeGlobalReachConnectionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GlobalReachConnectionList DeserializeGlobalReachConnectionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static GlobalReachConnectionList DeserializeGlobalReachConnectionList(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GlobalReachConnectionList(Optional.ToList(value), nextLink.Value); + return new GlobalReachConnectionList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + GlobalReachConnectionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGlobalReachConnectionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GlobalReachConnectionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGlobalReachConnectionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GlobalReachConnectionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GlobalReachConnectionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGlobalReachConnectionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs index 22696ce39f9b..2b49d4a69526 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of global reach connections. internal partial class GlobalReachConnectionList { - /// Initializes a new instance of GlobalReachConnectionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GlobalReachConnectionList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GlobalReachConnectionList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal GlobalReachConnectionList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GlobalReachConnectionList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs index e01fd88fdac3..5f5c7b059b60 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class HcxEnterpriseSiteData : IUtf8JsonSerializable + public partial class HcxEnterpriseSiteData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonElement element) + internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +57,7 @@ internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonEleme Optional systemData = default; Optional activationKey = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -87,8 +110,61 @@ internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HcxEnterpriseSiteData(id, name, type, systemData.Value, activationKey.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + HcxEnterpriseSiteData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHcxEnterpriseSiteData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HcxEnterpriseSiteData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHcxEnterpriseSiteData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HcxEnterpriseSiteData model) + { + if (model is null) + { + return null; } - return new HcxEnterpriseSiteData(id, name, type, systemData.Value, activationKey.Value, Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HcxEnterpriseSiteData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHcxEnterpriseSiteData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs index e29dd8b559c6..48a2a113e82f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class HcxEnterpriseSiteList + internal partial class HcxEnterpriseSiteList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HcxEnterpriseSiteList DeserializeHcxEnterpriseSiteList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HcxEnterpriseSiteList DeserializeHcxEnterpriseSiteList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static HcxEnterpriseSiteList DeserializeHcxEnterpriseSiteList(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HcxEnterpriseSiteList(Optional.ToList(value), nextLink.Value); + return new HcxEnterpriseSiteList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HcxEnterpriseSiteList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHcxEnterpriseSiteList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HcxEnterpriseSiteList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHcxEnterpriseSiteList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HcxEnterpriseSiteList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HcxEnterpriseSiteList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHcxEnterpriseSiteList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs index 5932fc66d6f4..8d15cbdb1e7b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of HCX Enterprise Sites. internal partial class HcxEnterpriseSiteList { - /// Initializes a new instance of HcxEnterpriseSiteList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HcxEnterpriseSiteList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HcxEnterpriseSiteList. + /// Initializes a new instance of . /// The items on a page. /// URL to get the next page if any. - internal HcxEnterpriseSiteList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HcxEnterpriseSiteList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on a page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs index 1ecb3c06bb82..c5dbf4ce9503 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class PSCredentialExecutionParameterDetails : IUtf8JsonSerializable + public partial class PSCredentialExecutionParameterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Username)) { @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PSCredentialExecutionParameterDetails DeserializePSCredentialExecutionParameterDetails(JsonElement element) + internal static PSCredentialExecutionParameterDetails DeserializePSCredentialExecutionParameterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static PSCredentialExecutionParameterDetails DeserializePSCredentialExe Optional password = default; string name = default; ScriptExecutionParameterType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -64,8 +87,61 @@ internal static PSCredentialExecutionParameterDetails DeserializePSCredentialExe type = new ScriptExecutionParameterType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PSCredentialExecutionParameterDetails(name, type, username.Value, password.Value, serializedAdditionalRawData); + } + + PSCredentialExecutionParameterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePSCredentialExecutionParameterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PSCredentialExecutionParameterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePSCredentialExecutionParameterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PSCredentialExecutionParameterDetails model) + { + if (model is null) + { + return null; } - return new PSCredentialExecutionParameterDetails(name, type, username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PSCredentialExecutionParameterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePSCredentialExecutionParameterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs index 3b2773da6d79..50e6c1098343 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Avs.Models /// a powershell credential object. public partial class PSCredentialExecutionParameterDetails : ScriptExecutionParameterDetails { - /// Initializes a new instance of PSCredentialExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// is null. public PSCredentialExecutionParameterDetails(string name) : base(name) @@ -23,18 +24,24 @@ public PSCredentialExecutionParameterDetails(string name) : base(name) ParameterType = ScriptExecutionParameterType.Credential; } - /// Initializes a new instance of PSCredentialExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// The type of execution parameter. /// username for login. /// password for login. - internal PSCredentialExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, string username, string password) : base(name, parameterType) + /// Keeps track of any properties unknown to the library. + internal PSCredentialExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, string username, string password, Dictionary serializedAdditionalRawData) : base(name, parameterType, serializedAdditionalRawData) { Username = username; Password = password; ParameterType = parameterType; } + /// Initializes a new instance of for deserialization. + internal PSCredentialExecutionParameterDetails() + { + } + /// username for login. public string Username { get; set; } /// password for login. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs index 4a45310223e5..90d55400378a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class PlacementPoliciesList + internal partial class PlacementPoliciesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PlacementPoliciesList DeserializePlacementPoliciesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PlacementPoliciesList DeserializePlacementPoliciesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static PlacementPoliciesList DeserializePlacementPoliciesList(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PlacementPoliciesList(Optional.ToList(value), nextLink.Value); + return new PlacementPoliciesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PlacementPoliciesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlacementPoliciesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlacementPoliciesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlacementPoliciesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlacementPoliciesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlacementPoliciesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlacementPoliciesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs index 55965a14c506..190c4a1ac415 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// Represents list of placement policies. internal partial class PlacementPoliciesList { - /// Initializes a new instance of PlacementPoliciesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PlacementPoliciesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PlacementPoliciesList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal PlacementPoliciesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PlacementPoliciesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs index 1d23bfa14f24..3385fb317f57 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class PlacementPolicyData : IUtf8JsonSerializable + public partial class PlacementPolicyData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PlacementPolicyData DeserializePlacementPolicyData(JsonElement element) + internal static PlacementPolicyData DeserializePlacementPolicyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static PlacementPolicyData DeserializePlacementPolicyData(JsonElement e string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static PlacementPolicyData DeserializePlacementPolicyData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlacementPolicyData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + PlacementPolicyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlacementPolicyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlacementPolicyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlacementPolicyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlacementPolicyData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlacementPolicyData(Response response) + { + if (response is null) + { + return null; } - return new PlacementPolicyData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlacementPolicyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs index b9e1d3c86524..9bbc4de2d0b2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class PlacementPolicyPatch : IUtf8JsonSerializable + public partial class PlacementPolicyPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -58,7 +66,166 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AzureHybridBenefitType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PlacementPolicyPatch DeserializePlacementPolicyPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional state = default; + Optional> vmMembers = default; + Optional> hostMembers = default; + Optional affinityStrength = default; + Optional azureHybridBenefitType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new PlacementPolicyState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("vmMembers"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new ResourceIdentifier(item.GetString())); + } + } + vmMembers = array; + continue; + } + if (property0.NameEquals("hostMembers"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hostMembers = array; + continue; + } + if (property0.NameEquals("affinityStrength"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + affinityStrength = new VmHostPlacementPolicyAffinityStrength(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("azureHybridBenefitType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureHybridBenefitType = new AzureHybridBenefitType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlacementPolicyPatch(Optional.ToNullable(state), Optional.ToList(vmMembers), Optional.ToList(hostMembers), Optional.ToNullable(affinityStrength), Optional.ToNullable(azureHybridBenefitType), serializedAdditionalRawData); + } + + PlacementPolicyPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlacementPolicyPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlacementPolicyPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlacementPolicyPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlacementPolicyPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlacementPolicyPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlacementPolicyPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs index ce126e0c67a1..9511d10c4fe3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,33 @@ namespace Azure.ResourceManager.Avs.Models /// An update of a DRS placement policy resource. public partial class PlacementPolicyPatch { - /// Initializes a new instance of PlacementPolicyPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PlacementPolicyPatch() { VmMembers = new ChangeTrackingList(); HostMembers = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Whether the placement policy is enabled or disabled. + /// Virtual machine members list. + /// Host members list. + /// vm-host placement policy affinity strength (should/must). + /// placement policy azure hybrid benefit opt-in type. + /// Keeps track of any properties unknown to the library. + internal PlacementPolicyPatch(PlacementPolicyState? state, IList vmMembers, IList hostMembers, VmHostPlacementPolicyAffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType, Dictionary serializedAdditionalRawData) + { + State = state; + VmMembers = vmMembers; + HostMembers = hostMembers; + AffinityStrength = affinityStrength; + AzureHybridBenefitType = azureHybridBenefitType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Whether the placement policy is enabled or disabled. public PlacementPolicyState? State { get; set; } /// Virtual machine members list. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs index 4a1067c9821c..3c3e27c77557 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class PlacementPolicyProperties : IUtf8JsonSerializable + public partial class PlacementPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(PolicyType.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PlacementPolicyProperties DeserializePlacementPolicyProperties(JsonElement element) + internal static PlacementPolicyProperties DeserializePlacementPolicyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,7 +66,98 @@ internal static PlacementPolicyProperties DeserializePlacementPolicyProperties(J case "VmVm": return VmPlacementPolicyProperties.DeserializeVmPlacementPolicyProperties(element); } } - return UnknownPlacementPolicyProperties.DeserializeUnknownPlacementPolicyProperties(element); + + // Unknown type found so we will deserialize the base properties only + PlacementPolicyType type = default; + Optional state = default; + Optional displayName = default; + Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new PlacementPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new PlacementPolicyState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + PlacementPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlacementPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlacementPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlacementPolicyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlacementPolicyProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlacementPolicyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlacementPolicyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs index f100a94df776..d94e817301f2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Avs.Models { /// @@ -12,24 +16,30 @@ namespace Azure.ResourceManager.Avs.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownPlacementPolicyProperties))] public abstract partial class PlacementPolicyProperties { - /// Initializes a new instance of PlacementPolicyProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected PlacementPolicyProperties() { } - /// Initializes a new instance of PlacementPolicyProperties. + /// Initializes a new instance of . /// placement policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. - internal PlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState) + /// Keeps track of any properties unknown to the library. + internal PlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) { PolicyType = policyType; State = state; DisplayName = displayName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// placement policy type. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs index 8a1bad05639a..10188fcb2f1d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class PrivateCloudAvailabilityProperties : IUtf8JsonSerializable + public partial class PrivateCloudAvailabilityProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Strategy)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secondaryZone"u8); writer.WriteNumberValue(SecondaryZone.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PrivateCloudAvailabilityProperties DeserializePrivateCloudAvailabilityProperties(JsonElement element) + internal static PrivateCloudAvailabilityProperties DeserializePrivateCloudAvailabilityProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static PrivateCloudAvailabilityProperties DeserializePrivateCloudAvaila Optional strategy = default; Optional zone = default; Optional secondaryZone = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("strategy"u8)) @@ -71,8 +94,61 @@ internal static PrivateCloudAvailabilityProperties DeserializePrivateCloudAvaila secondaryZone = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PrivateCloudAvailabilityProperties(Optional.ToNullable(strategy), Optional.ToNullable(zone), Optional.ToNullable(secondaryZone), serializedAdditionalRawData); + } + + PrivateCloudAvailabilityProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateCloudAvailabilityProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateCloudAvailabilityProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateCloudAvailabilityProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateCloudAvailabilityProperties model) + { + if (model is null) + { + return null; } - return new PrivateCloudAvailabilityProperties(Optional.ToNullable(strategy), Optional.ToNullable(zone), Optional.ToNullable(secondaryZone)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateCloudAvailabilityProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateCloudAvailabilityProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs index cd12c63f0a77..5e44006c4e6f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The properties describing private cloud availability zone distribution. public partial class PrivateCloudAvailabilityProperties { - /// Initializes a new instance of PrivateCloudAvailabilityProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PrivateCloudAvailabilityProperties() { } - /// Initializes a new instance of PrivateCloudAvailabilityProperties. + /// Initializes a new instance of . /// The availability strategy for the private cloud. /// The primary availability zone for the private cloud. /// The secondary availability zone for the private cloud. - internal PrivateCloudAvailabilityProperties(AvailabilityStrategy? strategy, int? zone, int? secondaryZone) + /// Keeps track of any properties unknown to the library. + internal PrivateCloudAvailabilityProperties(AvailabilityStrategy? strategy, int? zone, int? secondaryZone, Dictionary serializedAdditionalRawData) { Strategy = strategy; Zone = zone; SecondaryZone = secondaryZone; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The availability strategy for the private cloud. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs index d726f4472e24..e412c49d858f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class PrivateCloudList + internal partial class PrivateCloudList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PrivateCloudList DeserializePrivateCloudList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PrivateCloudList DeserializePrivateCloudList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static PrivateCloudList DeserializePrivateCloudList(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PrivateCloudList(Optional.ToList(value), nextLink.Value); + return new PrivateCloudList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PrivateCloudList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateCloudList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateCloudList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateCloudList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateCloudList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateCloudList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateCloudList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs index a8c9d088b2c4..df3a54cc4d9a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A paged list of private clouds. internal partial class PrivateCloudList { - /// Initializes a new instance of PrivateCloudList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PrivateCloudList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PrivateCloudList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal PrivateCloudList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PrivateCloudList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs index b69b17d82be1..4cbb08e8f687 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class ScriptCmdletData : IUtf8JsonSerializable + public partial class ScriptCmdletData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element) + internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +58,7 @@ internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element Optional description = default; Optional timeout = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -104,8 +125,61 @@ internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptCmdletData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(timeout), Optional.ToList(parameters), serializedAdditionalRawData); + } + + ScriptCmdletData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptCmdletData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptCmdletData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptCmdletData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptCmdletData model) + { + if (model is null) + { + return null; } - return new ScriptCmdletData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(timeout), Optional.ToList(parameters)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptCmdletData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptCmdletData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs index 9a02acc17cb6..ee3f20532c67 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class ScriptCmdletsList + internal partial class ScriptCmdletsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScriptCmdletsList DeserializeScriptCmdletsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScriptCmdletsList DeserializeScriptCmdletsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ScriptCmdletsList DeserializeScriptCmdletsList(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScriptCmdletsList(Optional.ToList(value), nextLink.Value); + return new ScriptCmdletsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ScriptCmdletsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptCmdletsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptCmdletsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptCmdletsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptCmdletsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptCmdletsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptCmdletsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs index b051b0ff76d8..652c9caaf686 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// Pageable list of scripts/cmdlets. internal partial class ScriptCmdletsList { - /// Initializes a new instance of ScriptCmdletsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScriptCmdletsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptCmdletsList. + /// Initializes a new instance of . /// List of scripts. /// URL to get the next page if any. - internal ScriptCmdletsList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ScriptCmdletsList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of scripts. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs index 811ebc110b63..59579fd56421 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class ScriptExecutionData : IUtf8JsonSerializable + public partial class ScriptExecutionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -32,7 +38,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HiddenParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -81,11 +101,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement element) + internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,6 +143,7 @@ internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement e Optional> information = default; Optional> warnings = default; Optional> errors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -300,8 +335,61 @@ internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScriptExecutionData(id, name, type, systemData.Value, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), namedOutputs.Value, Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors)); + return new ScriptExecutionData(id, name, type, systemData.Value, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), namedOutputs.Value, Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors), serializedAdditionalRawData); + } + + ScriptExecutionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptExecutionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptExecutionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptExecutionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptExecutionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptExecutionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptExecutionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs index 0caba63d8709..2ec0f9b6bd8e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptExecutionParameterDetails : IUtf8JsonSerializable + public partial class ScriptExecutionParameterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptExecutionParameterDetails DeserializeScriptExecutionParameterDetails(JsonElement element) + internal static ScriptExecutionParameterDetails DeserializeScriptExecutionParameterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,7 +59,78 @@ internal static ScriptExecutionParameterDetails DeserializeScriptExecutionParame case "Value": return ScriptStringExecutionParameterDetails.DeserializeScriptStringExecutionParameterDetails(element); } } - return UnknownScriptExecutionParameter.DeserializeUnknownScriptExecutionParameter(element); + + // Unknown type found so we will deserialize the base properties only + string name = default; + ScriptExecutionParameterType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ScriptExecutionParameterType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownScriptExecutionParameter(name, type, serializedAdditionalRawData); + } + + ScriptExecutionParameterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptExecutionParameterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptExecutionParameterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptExecutionParameterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptExecutionParameterDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptExecutionParameterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptExecutionParameterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs index c47ffe7b8698..b5016c572ec9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs @@ -6,7 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { @@ -15,9 +17,13 @@ namespace Azure.ResourceManager.Avs.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownScriptExecutionParameter))] public abstract partial class ScriptExecutionParameterDetails { - /// Initializes a new instance of ScriptExecutionParameterDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The parameter name. /// is null. protected ScriptExecutionParameterDetails(string name) @@ -27,13 +33,20 @@ protected ScriptExecutionParameterDetails(string name) Name = name; } - /// Initializes a new instance of ScriptExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// The type of execution parameter. - internal ScriptExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType) + /// Keeps track of any properties unknown to the library. + internal ScriptExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, Dictionary serializedAdditionalRawData) { Name = name; ParameterType = parameterType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScriptExecutionParameterDetails() + { } /// The parameter name. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs index 071c96243f81..cae0d93d09f8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class ScriptExecutionsList + internal partial class ScriptExecutionsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScriptExecutionsList(Optional.ToList(value), nextLink.Value); + return new ScriptExecutionsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ScriptExecutionsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptExecutionsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptExecutionsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptExecutionsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptExecutionsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptExecutionsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptExecutionsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs index 4c81417d6982..3460d05e8d36 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// Pageable list of script executions. internal partial class ScriptExecutionsList { - /// Initializes a new instance of ScriptExecutionsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScriptExecutionsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptExecutionsList. + /// Initializes a new instance of . /// List of scripts. /// URL to get the next page if any. - internal ScriptExecutionsList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ScriptExecutionsList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of scripts. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs index b6251a11b51a..dc50838afa69 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs @@ -6,25 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class ScriptPackageData : IUtf8JsonSerializable + public partial class ScriptPackageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptPackageData DeserializeScriptPackageData(JsonElement element) + internal static ScriptPackageData DeserializeScriptPackageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +58,7 @@ internal static ScriptPackageData DeserializeScriptPackageData(JsonElement eleme Optional version = default; Optional company = default; Optional uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -99,8 +121,61 @@ internal static ScriptPackageData DeserializeScriptPackageData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptPackageData(id, name, type, systemData.Value, description.Value, version.Value, company.Value, uri.Value, serializedAdditionalRawData); + } + + ScriptPackageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptPackageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptPackageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptPackageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptPackageData model) + { + if (model is null) + { + return null; } - return new ScriptPackageData(id, name, type, systemData.Value, description.Value, version.Value, company.Value, uri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptPackageData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptPackageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs index 2debf7a75920..4d8958a7dd13 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class ScriptPackagesList + internal partial class ScriptPackagesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScriptPackagesList DeserializeScriptPackagesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScriptPackagesList DeserializeScriptPackagesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ScriptPackagesList DeserializeScriptPackagesList(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScriptPackagesList(Optional.ToList(value), nextLink.Value); + return new ScriptPackagesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ScriptPackagesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptPackagesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptPackagesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptPackagesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptPackagesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptPackagesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptPackagesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs index b012b2055a38..8c2c3e45baea 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of the available script packages. internal partial class ScriptPackagesList { - /// Initializes a new instance of ScriptPackagesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScriptPackagesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptPackagesList. + /// Initializes a new instance of . /// List of script package resources. /// URL to get the next page if any. - internal ScriptPackagesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ScriptPackagesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of script package resources. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs index d7d3ec0ea0b2..86ac9b8dcf50 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs @@ -5,15 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptParameter + public partial class ScriptParameter : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScriptParameter DeserializeScriptParameter(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Core.Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScriptParameter DeserializeScriptParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +56,7 @@ internal static ScriptParameter DeserializeScriptParameter(JsonElement element) Optional description = default; Optional visibility = default; Optional optional = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -62,8 +96,61 @@ internal static ScriptParameter DeserializeScriptParameter(JsonElement element) optional = new ParameterOptionalityStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScriptParameter(Core.Optional.ToNullable(type), name.Value, description.Value, Core.Optional.ToNullable(visibility), Core.Optional.ToNullable(optional)); + return new ScriptParameter(Core.Optional.ToNullable(type), name.Value, description.Value, Core.Optional.ToNullable(visibility), Core.Optional.ToNullable(optional), serializedAdditionalRawData); + } + + ScriptParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptParameter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs index 4f6f9d91bd66..084d5f126b0d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// An parameter that the script will accept. public partial class ScriptParameter { - /// Initializes a new instance of ScriptParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScriptParameter() { } - /// Initializes a new instance of ScriptParameter. + /// Initializes a new instance of . /// The type of parameter the script is expecting. psCredential is a PSCredentialObject. /// The parameter name that the script will expect a parameter value for. /// User friendly description of the parameter. /// Should this parameter be visible to arm and passed in the parameters argument when executing. /// Is this parameter required or optional. - internal ScriptParameter(ScriptParameterType? parameterType, string name, string description, ParameterVisibilityStatus? visibility, ParameterOptionalityStatus? optional) + /// Keeps track of any properties unknown to the library. + internal ScriptParameter(ScriptParameterType? parameterType, string name, string description, ParameterVisibilityStatus? visibility, ParameterOptionalityStatus? optional, Dictionary serializedAdditionalRawData) { ParameterType = parameterType; Name = name; Description = description; Visibility = visibility; Optional = optional; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of parameter the script is expecting. psCredential is a PSCredentialObject. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs index 4f975fb5e689..16f5e7767124 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptSecureStringExecutionParameterDetails : IUtf8JsonSerializable + public partial class ScriptSecureStringExecutionParameterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecureValue)) { @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptSecureStringExecutionParameterDetails DeserializeScriptSecureStringExecutionParameterDetails(JsonElement element) + internal static ScriptSecureStringExecutionParameterDetails DeserializeScriptSecureStringExecutionParameterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ScriptSecureStringExecutionParameterDetails DeserializeScriptSec Optional secureValue = default; string name = default; ScriptExecutionParameterType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secureValue"u8)) @@ -53,8 +76,61 @@ internal static ScriptSecureStringExecutionParameterDetails DeserializeScriptSec type = new ScriptExecutionParameterType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptSecureStringExecutionParameterDetails(name, type, secureValue.Value, serializedAdditionalRawData); + } + + ScriptSecureStringExecutionParameterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptSecureStringExecutionParameterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptSecureStringExecutionParameterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptSecureStringExecutionParameterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptSecureStringExecutionParameterDetails model) + { + if (model is null) + { + return null; } - return new ScriptSecureStringExecutionParameterDetails(name, type, secureValue.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptSecureStringExecutionParameterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptSecureStringExecutionParameterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs index 90088d68ce64..6e5aefcf5730 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Avs.Models /// a plain text value execution parameter. public partial class ScriptSecureStringExecutionParameterDetails : ScriptExecutionParameterDetails { - /// Initializes a new instance of ScriptSecureStringExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// is null. public ScriptSecureStringExecutionParameterDetails(string name) : base(name) @@ -23,16 +24,22 @@ public ScriptSecureStringExecutionParameterDetails(string name) : base(name) ParameterType = ScriptExecutionParameterType.SecureValue; } - /// Initializes a new instance of ScriptSecureStringExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// The type of execution parameter. /// A secure value for the passed parameter, not to be stored in logs. - internal ScriptSecureStringExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, string secureValue) : base(name, parameterType) + /// Keeps track of any properties unknown to the library. + internal ScriptSecureStringExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, string secureValue, Dictionary serializedAdditionalRawData) : base(name, parameterType, serializedAdditionalRawData) { SecureValue = secureValue; ParameterType = parameterType; } + /// Initializes a new instance of for deserialization. + internal ScriptSecureStringExecutionParameterDetails() + { + } + /// A secure value for the passed parameter, not to be stored in logs. public string SecureValue { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs index 46b67fa8a652..f48463dc4312 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptStringExecutionParameterDetails : IUtf8JsonSerializable + public partial class ScriptStringExecutionParameterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Value)) { @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptStringExecutionParameterDetails DeserializeScriptStringExecutionParameterDetails(JsonElement element) + internal static ScriptStringExecutionParameterDetails DeserializeScriptStringExecutionParameterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ScriptStringExecutionParameterDetails DeserializeScriptStringExe Optional value = default; string name = default; ScriptExecutionParameterType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +76,61 @@ internal static ScriptStringExecutionParameterDetails DeserializeScriptStringExe type = new ScriptExecutionParameterType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptStringExecutionParameterDetails(name, type, value.Value, serializedAdditionalRawData); + } + + ScriptStringExecutionParameterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptStringExecutionParameterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptStringExecutionParameterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptStringExecutionParameterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptStringExecutionParameterDetails model) + { + if (model is null) + { + return null; } - return new ScriptStringExecutionParameterDetails(name, type, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptStringExecutionParameterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptStringExecutionParameterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs index 95bb4d7a9faa..f0a839defe9d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Avs.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Avs.Models /// a plain text value execution parameter. public partial class ScriptStringExecutionParameterDetails : ScriptExecutionParameterDetails { - /// Initializes a new instance of ScriptStringExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// is null. public ScriptStringExecutionParameterDetails(string name) : base(name) @@ -23,16 +24,22 @@ public ScriptStringExecutionParameterDetails(string name) : base(name) ParameterType = ScriptExecutionParameterType.Value; } - /// Initializes a new instance of ScriptStringExecutionParameterDetails. + /// Initializes a new instance of . /// The parameter name. /// The type of execution parameter. /// The value for the passed parameter. - internal ScriptStringExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, string value) : base(name, parameterType) + /// Keeps track of any properties unknown to the library. + internal ScriptStringExecutionParameterDetails(string name, ScriptExecutionParameterType parameterType, string value, Dictionary serializedAdditionalRawData) : base(name, parameterType, serializedAdditionalRawData) { Value = value; ParameterType = parameterType; } + /// Initializes a new instance of for deserialization. + internal ScriptStringExecutionParameterDetails() + { + } + /// The value for the passed parameter. public string Value { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs index 03d3e11e43d6..aa8532907406 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class SingleSignOnIdentitySource : IUtf8JsonSerializable + public partial class SingleSignOnIdentitySource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -66,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource(JsonElement element) + internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +106,7 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource Optional ssl = default; Optional username = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -149,8 +171,61 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SingleSignOnIdentitySource(name.Value, @alias.Value, domain.Value, baseUserDN.Value, baseGroupDN.Value, primaryServer.Value, secondaryServer.Value, Optional.ToNullable(ssl), username.Value, password.Value, serializedAdditionalRawData); + } + + SingleSignOnIdentitySource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSingleSignOnIdentitySource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SingleSignOnIdentitySource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSingleSignOnIdentitySource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SingleSignOnIdentitySource model) + { + if (model is null) + { + return null; } - return new SingleSignOnIdentitySource(name.Value, @alias.Value, domain.Value, baseUserDN.Value, baseGroupDN.Value, primaryServer.Value, secondaryServer.Value, Optional.ToNullable(ssl), username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SingleSignOnIdentitySource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSingleSignOnIdentitySource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs index c5b8dd73bd66..94472e8053dc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Avs.Models { /// vCenter Single Sign On Identity Source. public partial class SingleSignOnIdentitySource { - /// Initializes a new instance of SingleSignOnIdentitySource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SingleSignOnIdentitySource() { } - /// Initializes a new instance of SingleSignOnIdentitySource. + /// Initializes a new instance of . /// The name of the identity source. /// The domain's NetBIOS name. /// The domain's dns name. @@ -28,7 +32,8 @@ public SingleSignOnIdentitySource() /// Protect LDAP communication using SSL certificate (LDAPS). /// The ID of an Active Directory user with a minimum of read-only access to Base DN for users and group. /// The password of the Active Directory user with a minimum of read-only access to Base DN for users and groups. - internal SingleSignOnIdentitySource(string name, string @alias, string domain, string baseUserDN, string baseGroupDN, Uri primaryServer, Uri secondaryServer, SslCertificateStatus? ssl, string username, string password) + /// Keeps track of any properties unknown to the library. + internal SingleSignOnIdentitySource(string name, string @alias, string domain, string baseUserDN, string baseGroupDN, Uri primaryServer, Uri secondaryServer, SslCertificateStatus? ssl, string username, string password, Dictionary serializedAdditionalRawData) { Name = name; Alias = @alias; @@ -40,6 +45,7 @@ internal SingleSignOnIdentitySource(string name, string @alias, string domain, s Ssl = ssl; Username = username; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the identity source. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs index 583e39e6ee08..227f8c591b84 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs @@ -5,47 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - internal partial class UnknownAddonProperties : IUtf8JsonSerializable + internal partial class UnknownAddonProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("addonType"u8); writer.WriteStringValue(AddonType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownAddonProperties DeserializeUnknownAddonProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - AddonType addonType = "Unknown"; - Optional provisioningState = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("addonType"u8)) - { - addonType = new AddonType(property.Value.GetString()); - continue; - } - if (property.NameEquals("provisioningState"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AddonProvisioningState(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownAddonProperties(addonType, Optional.ToNullable(provisioningState)); + writer.WriteEndObject(); + } + + internal static AvsPrivateCloudAddonProperties DeserializeUnknownAddonProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeAvsPrivateCloudAddonProperties(element, options); + + AvsPrivateCloudAddonProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownAddonProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvsPrivateCloudAddonProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvsPrivateCloudAddonProperties(doc.RootElement, options); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs index 4a3356c88da5..8ba370a783eb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs @@ -5,17 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The UnknownAddonProperties. internal partial class UnknownAddonProperties : AvsPrivateCloudAddonProperties { - /// Initializes a new instance of UnknownAddonProperties. + /// Initializes a new instance of . /// The type of private cloud addon. /// The state of the addon provisioning. - internal UnknownAddonProperties(AddonType addonType, AddonProvisioningState? provisioningState) : base(addonType, provisioningState) + /// Keeps track of any properties unknown to the library. + internal UnknownAddonProperties(AddonType addonType, AddonProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(addonType, provisioningState, serializedAdditionalRawData) { AddonType = addonType; } + + /// Initializes a new instance of for deserialization. + internal UnknownAddonProperties() + { + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.Serialization.cs index beec6992a0be..6749f8b9a24e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - internal partial class UnknownPlacementPolicyProperties : IUtf8JsonSerializable + internal partial class UnknownPlacementPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(PolicyType.ToString()); @@ -27,51 +33,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } - writer.WriteEndObject(); - } - - internal static UnknownPlacementPolicyProperties DeserializeUnknownPlacementPolicyProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - PlacementPolicyType type = "Unknown"; - Optional state = default; - Optional displayName = default; - Optional provisioningState = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("type"u8)) - { - type = new PlacementPolicyType(property.Value.GetString()); - continue; - } - if (property.NameEquals("state"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - state = new PlacementPolicyState(property.Value.GetString()); - continue; - } - if (property.NameEquals("displayName"u8)) - { - displayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("provisioningState"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState)); + writer.WriteEndObject(); + } + + internal static PlacementPolicyProperties DeserializeUnknownPlacementPolicyProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializePlacementPolicyProperties(element, options); + + PlacementPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownPlacementPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlacementPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlacementPolicyProperties(doc.RootElement, options); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs index bd14daf488bf..0d1b662775fc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs @@ -5,19 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The UnknownPlacementPolicyProperties. internal partial class UnknownPlacementPolicyProperties : PlacementPolicyProperties { - /// Initializes a new instance of UnknownPlacementPolicyProperties. + /// Initializes a new instance of . /// placement policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. - internal UnknownPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState) : base(policyType, state, displayName, provisioningState) + /// Keeps track of any properties unknown to the library. + internal UnknownPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(policyType, state, displayName, provisioningState, serializedAdditionalRawData) { PolicyType = policyType; } + + /// Initializes a new instance of for deserialization. + internal UnknownPlacementPolicyProperties() + { + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs index a37d1e31d5bc..cc91fa46106f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs @@ -5,45 +5,64 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - internal partial class UnknownScriptExecutionParameter : IUtf8JsonSerializable + internal partial class UnknownScriptExecutionParameter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownScriptExecutionParameter DeserializeUnknownScriptExecutionParameter(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string name = default; - ScriptExecutionParameterType type = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) + foreach (var property in _serializedAdditionalRawData) { - type = new ScriptExecutionParameterType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownScriptExecutionParameter(name, type); + writer.WriteEndObject(); + } + + internal static ScriptExecutionParameterDetails DeserializeUnknownScriptExecutionParameter(JsonElement element, ModelSerializerOptions options = default) => DeserializeScriptExecutionParameterDetails(element, options); + + ScriptExecutionParameterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownScriptExecutionParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptExecutionParameterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptExecutionParameterDetails(doc.RootElement, options); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs index dc2dfa724515..c52988f89768 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs @@ -5,17 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// The UnknownScriptExecutionParameter. internal partial class UnknownScriptExecutionParameter : ScriptExecutionParameterDetails { - /// Initializes a new instance of UnknownScriptExecutionParameter. + /// Initializes a new instance of . /// The parameter name. /// The type of execution parameter. - internal UnknownScriptExecutionParameter(string name, ScriptExecutionParameterType parameterType) : base(name, parameterType) + /// Keeps track of any properties unknown to the library. + internal UnknownScriptExecutionParameter(string name, ScriptExecutionParameterType parameterType, Dictionary serializedAdditionalRawData) : base(name, parameterType, serializedAdditionalRawData) { ParameterType = parameterType; } + + /// Initializes a new instance of for deserialization. + internal UnknownScriptExecutionParameter() + { + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.Serialization.cs index 5a565af0c5e5..3c4173759252 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.Serialization.cs @@ -5,16 +5,21 @@ #nullable disable -using System.Collections.Generic; +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - internal partial class UnknownWorkloadNetworkDhcpEntity : IUtf8JsonSerializable + internal partial class UnknownWorkloadNetworkDhcpEntity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dhcpType"u8); writer.WriteStringValue(DhcpType.ToString()); @@ -28,66 +33,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("revision"u8); writer.WriteNumberValue(Revision.Value); } - writer.WriteEndObject(); - } - - internal static UnknownWorkloadNetworkDhcpEntity DeserializeUnknownWorkloadNetworkDhcpEntity(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DhcpTypeEnum dhcpType = "Unknown"; - Optional displayName = default; - Optional> segments = default; - Optional provisioningState = default; - Optional revision = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("dhcpType"u8)) - { - dhcpType = new DhcpTypeEnum(property.Value.GetString()); - continue; - } - if (property.NameEquals("displayName"u8)) - { - displayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("segments"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - segments = array; - continue; - } - if (property.NameEquals("provisioningState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkDhcpProvisioningState(property.Value.GetString()); - continue; - } - if (property.NameEquals("revision"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property.Value.GetInt64(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownWorkloadNetworkDhcpEntity(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDhcpEntity DeserializeUnknownWorkloadNetworkDhcpEntity(JsonElement element, ModelSerializerOptions options = default) => DeserializeWorkloadNetworkDhcpEntity(element, options); + + WorkloadNetworkDhcpEntity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownWorkloadNetworkDhcpEntity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDhcpEntity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDhcpEntity(doc.RootElement, options); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.cs index 9e5628c2a83d..ed27010f8998 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownWorkloadNetworkDhcpEntity.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Avs.Models @@ -12,15 +13,21 @@ namespace Azure.ResourceManager.Avs.Models /// The UnknownWorkloadNetworkDhcpEntity. internal partial class UnknownWorkloadNetworkDhcpEntity : WorkloadNetworkDhcpEntity { - /// Initializes a new instance of UnknownWorkloadNetworkDhcpEntity. + /// Initializes a new instance of . /// Type of DHCP: SERVER or RELAY. /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. /// The provisioning state. /// NSX revision number. - internal UnknownWorkloadNetworkDhcpEntity(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision) : base(dhcpType, displayName, segments, provisioningState, revision) + /// Keeps track of any properties unknown to the library. + internal UnknownWorkloadNetworkDhcpEntity(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) : base(dhcpType, displayName, segments, provisioningState, revision, serializedAdditionalRawData) { DhcpType = dhcpType; } + + /// Initializes a new instance of for deserialization. + internal UnknownWorkloadNetworkDhcpEntity() + { + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs index 757b23d33dfa..f3e8c99e216c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class VirtualMachinesList + internal partial class VirtualMachinesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachinesList(Optional.ToList(value), nextLink.Value); + return new VirtualMachinesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachinesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs index 3496133d11ce..90ee3f55c103 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of Virtual Machines. internal partial class VirtualMachinesList { - /// Initializes a new instance of VirtualMachinesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachinesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachinesList. + /// Initializes a new instance of . /// The items to be displayed on the page. /// URL to get the next page if any. - internal VirtualMachinesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachinesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items to be displayed on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs index 886b08fa0807..18b5a3967dea 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class VmHostPlacementPolicyProperties : IUtf8JsonSerializable + public partial class VmHostPlacementPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vmMembers"u8); writer.WriteStartArray(); @@ -59,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicyProperties(JsonElement element) + internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +98,7 @@ internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicy Optional state = default; Optional displayName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmMembers"u8)) @@ -157,8 +179,61 @@ internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicy provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VmHostPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), vmMembers, hostMembers, affinityType, Optional.ToNullable(affinityStrength), Optional.ToNullable(azureHybridBenefitType), serializedAdditionalRawData); + } + + VmHostPlacementPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVmHostPlacementPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VmHostPlacementPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVmHostPlacementPolicyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VmHostPlacementPolicyProperties model) + { + if (model is null) + { + return null; } - return new VmHostPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), vmMembers, hostMembers, affinityType, Optional.ToNullable(affinityStrength), Optional.ToNullable(azureHybridBenefitType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VmHostPlacementPolicyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVmHostPlacementPolicyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs index ecef7d991193..e9dbba0454ba 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Avs.Models /// VM-Host placement policy properties. public partial class VmHostPlacementPolicyProperties : PlacementPolicyProperties { - /// Initializes a new instance of VmHostPlacementPolicyProperties. + /// Initializes a new instance of . /// Virtual machine members list. /// Host members list. /// placement policy affinity type. @@ -31,7 +31,7 @@ public VmHostPlacementPolicyProperties(IEnumerable vmMembers PolicyType = PlacementPolicyType.VmHost; } - /// Initializes a new instance of VmHostPlacementPolicyProperties. + /// Initializes a new instance of . /// placement policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. @@ -41,7 +41,8 @@ public VmHostPlacementPolicyProperties(IEnumerable vmMembers /// placement policy affinity type. /// vm-host placement policy affinity strength (should/must). /// placement policy azure hybrid benefit opt-in type. - internal VmHostPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IList vmMembers, IList hostMembers, AvsPlacementPolicyAffinityType affinityType, VmHostPlacementPolicyAffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType) : base(policyType, state, displayName, provisioningState) + /// Keeps track of any properties unknown to the library. + internal VmHostPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IList vmMembers, IList hostMembers, AvsPlacementPolicyAffinityType affinityType, VmHostPlacementPolicyAffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType, Dictionary serializedAdditionalRawData) : base(policyType, state, displayName, provisioningState, serializedAdditionalRawData) { VmMembers = vmMembers; HostMembers = hostMembers; @@ -51,6 +52,11 @@ internal VmHostPlacementPolicyProperties(PlacementPolicyType policyType, Placeme PolicyType = policyType; } + /// Initializes a new instance of for deserialization. + internal VmHostPlacementPolicyProperties() + { + } + /// Virtual machine members list. public IList VmMembers { get; } /// Host members list. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs index 30bc4322e3d0..f5c0d65a5060 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class VmPlacementPolicyProperties : IUtf8JsonSerializable + public partial class VmPlacementPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vmMembers"u8); writer.WriteStartArray(); @@ -42,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperties(JsonElement element) + internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +78,7 @@ internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperti Optional state = default; Optional displayName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmMembers"u8)) @@ -109,8 +131,61 @@ internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperti provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VmPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), vmMembers, affinityType, serializedAdditionalRawData); + } + + VmPlacementPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVmPlacementPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VmPlacementPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVmPlacementPolicyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VmPlacementPolicyProperties model) + { + if (model is null) + { + return null; } - return new VmPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), vmMembers, affinityType); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VmPlacementPolicyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVmPlacementPolicyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs index 28a55127f435..937e931bf470 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Avs.Models /// VM-VM placement policy properties. public partial class VmPlacementPolicyProperties : PlacementPolicyProperties { - /// Initializes a new instance of VmPlacementPolicyProperties. + /// Initializes a new instance of . /// Virtual machine members list. /// placement policy affinity type. /// is null. @@ -28,20 +28,26 @@ public VmPlacementPolicyProperties(IEnumerable vmMembers, Av PolicyType = PlacementPolicyType.VmVm; } - /// Initializes a new instance of VmPlacementPolicyProperties. + /// Initializes a new instance of . /// placement policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. /// Virtual machine members list. /// placement policy affinity type. - internal VmPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IList vmMembers, AvsPlacementPolicyAffinityType affinityType) : base(policyType, state, displayName, provisioningState) + /// Keeps track of any properties unknown to the library. + internal VmPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IList vmMembers, AvsPlacementPolicyAffinityType affinityType, Dictionary serializedAdditionalRawData) : base(policyType, state, displayName, provisioningState, serializedAdditionalRawData) { VmMembers = vmMembers; AffinityType = affinityType; PolicyType = policyType; } + /// Initializes a new instance of for deserialization. + internal VmPlacementPolicyProperties() + { + } + /// Virtual machine members list. public IList VmMembers { get; } /// placement policy affinity type. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkData.Serialization.cs index 44a645957aaa..3cc79718cb72 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkData.Serialization.cs @@ -5,22 +5,44 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkData : IUtf8JsonSerializable + public partial class WorkloadNetworkData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement element) + internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +51,7 @@ internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement e string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -55,8 +78,61 @@ internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkData(id, name, type, systemData.Value, serializedAdditionalRawData); + } + + WorkloadNetworkData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkData(id, name, type, systemData.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs index c3ecc4dc7df3..ed4da34c39bf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkDhcpData : IUtf8JsonSerializable + public partial class WorkloadNetworkDhcpData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonElement element) + internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonE string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonE systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkDhcpData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + WorkloadNetworkDhcpData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDhcpData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDhcpData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDhcpData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDhcpData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDhcpData(Response response) + { + if (response is null) + { + return null; } - return new WorkloadNetworkDhcpData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDhcpData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs index fbb97fc4ffe4..a38e00272528 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkDhcpEntity : IUtf8JsonSerializable + public partial class WorkloadNetworkDhcpEntity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dhcpType"u8); writer.WriteStringValue(DhcpType.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("revision"u8); writer.WriteNumberValue(Revision.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkDhcpEntity DeserializeWorkloadNetworkDhcpEntity(JsonElement element) + internal static WorkloadNetworkDhcpEntity DeserializeWorkloadNetworkDhcpEntity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,7 +66,113 @@ internal static WorkloadNetworkDhcpEntity DeserializeWorkloadNetworkDhcpEntity(J case "SERVER": return WorkloadNetworkDhcpServer.DeserializeWorkloadNetworkDhcpServer(element); } } - return UnknownWorkloadNetworkDhcpEntity.DeserializeUnknownWorkloadNetworkDhcpEntity(element); + + // Unknown type found so we will deserialize the base properties only + DhcpTypeEnum dhcpType = default; + Optional displayName = default; + Optional> segments = default; + Optional provisioningState = default; + Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dhcpType"u8)) + { + dhcpType = new DhcpTypeEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("segments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + segments = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkDhcpProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + revision = property.Value.GetInt64(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownWorkloadNetworkDhcpEntity(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serializedAdditionalRawData); + } + + WorkloadNetworkDhcpEntity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDhcpEntity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDhcpEntity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDhcpEntity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDhcpEntity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDhcpEntity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDhcpEntity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs index 59ecc4d8d1ce..6877cc53e488 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs @@ -5,8 +5,10 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { @@ -15,27 +17,33 @@ namespace Azure.ResourceManager.Avs.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownWorkloadNetworkDhcpEntity))] public abstract partial class WorkloadNetworkDhcpEntity { - /// Initializes a new instance of WorkloadNetworkDhcpEntity. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected WorkloadNetworkDhcpEntity() { Segments = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDhcpEntity. + /// Initializes a new instance of . /// Type of DHCP: SERVER or RELAY. /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkDhcpEntity(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDhcpEntity(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) { DhcpType = dhcpType; DisplayName = displayName; Segments = segments; ProvisioningState = provisioningState; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of DHCP: SERVER or RELAY. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs index 6c0355955e76..ee5d152c3e7f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkDhcpList + internal partial class WorkloadNetworkDhcpList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkDhcpList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkDhcpList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkDhcpList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDhcpList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDhcpList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDhcpList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDhcpList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDhcpList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDhcpList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs index 563f1b69d8e3..1fde0757a66f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX dhcp entities. internal partial class WorkloadNetworkDhcpList { - /// Initializes a new instance of WorkloadNetworkDhcpList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkDhcpList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDhcpList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkDhcpList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDhcpList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs index d694836d6e20..49ac79f0ee28 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkDhcpRelay : IUtf8JsonSerializable + public partial class WorkloadNetworkDhcpRelay : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ServerAddresses)) { @@ -38,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("revision"u8); writer.WriteNumberValue(Revision.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkDhcpRelay DeserializeWorkloadNetworkDhcpRelay(JsonElement element) + internal static WorkloadNetworkDhcpRelay DeserializeWorkloadNetworkDhcpRelay(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +74,7 @@ internal static WorkloadNetworkDhcpRelay DeserializeWorkloadNetworkDhcpRelay(Jso Optional> segments = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serverAddresses"u8)) @@ -111,8 +133,61 @@ internal static WorkloadNetworkDhcpRelay DeserializeWorkloadNetworkDhcpRelay(Jso revision = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkDhcpRelay(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), Optional.ToList(serverAddresses), serializedAdditionalRawData); + } + + WorkloadNetworkDhcpRelay IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDhcpRelay(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDhcpRelay IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDhcpRelay(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDhcpRelay model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkDhcpRelay(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), Optional.ToList(serverAddresses)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDhcpRelay(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDhcpRelay(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs index 3a69270f4e6a..d4cbf8a7b370 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,22 @@ namespace Azure.ResourceManager.Avs.Models /// NSX DHCP Relay. public partial class WorkloadNetworkDhcpRelay : WorkloadNetworkDhcpEntity { - /// Initializes a new instance of WorkloadNetworkDhcpRelay. + /// Initializes a new instance of . public WorkloadNetworkDhcpRelay() { ServerAddresses = new ChangeTrackingList(); DhcpType = DhcpTypeEnum.Relay; } - /// Initializes a new instance of WorkloadNetworkDhcpRelay. + /// Initializes a new instance of . /// Type of DHCP: SERVER or RELAY. /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. /// The provisioning state. /// NSX revision number. /// DHCP Relay Addresses. Max 3. - internal WorkloadNetworkDhcpRelay(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, IList serverAddresses) : base(dhcpType, displayName, segments, provisioningState, revision) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDhcpRelay(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, IList serverAddresses, Dictionary serializedAdditionalRawData) : base(dhcpType, displayName, segments, provisioningState, revision, serializedAdditionalRawData) { ServerAddresses = serverAddresses; DhcpType = dhcpType; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs index 30ef4359a930..55230f63403a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkDhcpServer : IUtf8JsonSerializable + public partial class WorkloadNetworkDhcpServer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ServerAddress)) { @@ -38,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("revision"u8); writer.WriteNumberValue(Revision.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkDhcpServer DeserializeWorkloadNetworkDhcpServer(JsonElement element) + internal static WorkloadNetworkDhcpServer DeserializeWorkloadNetworkDhcpServer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +75,7 @@ internal static WorkloadNetworkDhcpServer DeserializeWorkloadNetworkDhcpServer(J Optional> segments = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serverAddress"u8)) @@ -112,8 +134,61 @@ internal static WorkloadNetworkDhcpServer DeserializeWorkloadNetworkDhcpServer(J revision = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkDhcpServer(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serverAddress.Value, Optional.ToNullable(leaseTime), serializedAdditionalRawData); + } + + WorkloadNetworkDhcpServer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDhcpServer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDhcpServer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDhcpServer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDhcpServer model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkDhcpServer(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serverAddress.Value, Optional.ToNullable(leaseTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDhcpServer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDhcpServer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs index c095d657a4c7..ae886dadcf2b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Avs.Models @@ -12,13 +13,13 @@ namespace Azure.ResourceManager.Avs.Models /// NSX DHCP Server. public partial class WorkloadNetworkDhcpServer : WorkloadNetworkDhcpEntity { - /// Initializes a new instance of WorkloadNetworkDhcpServer. + /// Initializes a new instance of . public WorkloadNetworkDhcpServer() { DhcpType = DhcpTypeEnum.Server; } - /// Initializes a new instance of WorkloadNetworkDhcpServer. + /// Initializes a new instance of . /// Type of DHCP: SERVER or RELAY. /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. @@ -26,7 +27,8 @@ public WorkloadNetworkDhcpServer() /// NSX revision number. /// DHCP Server Address. /// DHCP Server Lease Time. - internal WorkloadNetworkDhcpServer(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, string serverAddress, long? leaseTime) : base(dhcpType, displayName, segments, provisioningState, revision) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDhcpServer(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, string serverAddress, long? leaseTime, Dictionary serializedAdditionalRawData) : base(dhcpType, displayName, segments, provisioningState, revision, serializedAdditionalRawData) { ServerAddress = serverAddress; LeaseTime = leaseTime; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs index 1d952659057a..47ee0f680ec4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkDnsServiceData : IUtf8JsonSerializable + public partial class WorkloadNetworkDnsServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -57,11 +64,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Revision.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkDnsServiceData DeserializeWorkloadNetworkDnsServiceData(JsonElement element) + internal static WorkloadNetworkDnsServiceData DeserializeWorkloadNetworkDnsServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +99,7 @@ internal static WorkloadNetworkDnsServiceData DeserializeWorkloadNetworkDnsServi Optional status = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -185,8 +207,61 @@ internal static WorkloadNetworkDnsServiceData DeserializeWorkloadNetworkDnsServi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkDnsServiceData(id, name, type, systemData.Value, displayName.Value, dnsServiceIP.Value, defaultDnsZone.Value, Optional.ToList(fqdnZones), Optional.ToNullable(logLevel), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serializedAdditionalRawData); + } + + WorkloadNetworkDnsServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDnsServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDnsServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDnsServiceData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkDnsServiceData(id, name, type, systemData.Value, displayName.Value, dnsServiceIP.Value, defaultDnsZone.Value, Optional.ToList(fqdnZones), Optional.ToNullable(logLevel), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDnsServiceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDnsServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs index dafdd80f85e3..f0d68fe45ac4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkDnsServicesList + internal partial class WorkloadNetworkDnsServicesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServicesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServicesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServ nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkDnsServicesList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkDnsServicesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkDnsServicesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsServicesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDnsServicesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDnsServicesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDnsServicesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDnsServicesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDnsServicesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs index 76a80cc2cc7d..4bedce377d1f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX DNS Services. internal partial class WorkloadNetworkDnsServicesList { - /// Initializes a new instance of WorkloadNetworkDnsServicesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkDnsServicesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDnsServicesList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkDnsServicesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDnsServicesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs index f3045ddb61f3..b5a8e296c3af 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkDnsZoneData : IUtf8JsonSerializable + public partial class WorkloadNetworkDnsZoneData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -67,11 +74,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Revision.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkDnsZoneData DeserializeWorkloadNetworkDnsZoneData(JsonElement element) + internal static WorkloadNetworkDnsZoneData DeserializeWorkloadNetworkDnsZoneData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +108,7 @@ internal static WorkloadNetworkDnsZoneData DeserializeWorkloadNetworkDnsZoneData Optional dnsServices = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -201,8 +223,61 @@ internal static WorkloadNetworkDnsZoneData DeserializeWorkloadNetworkDnsZoneData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkDnsZoneData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(domain), Optional.ToList(dnsServerIPs), sourceIP.Value, Optional.ToNullable(dnsServices), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serializedAdditionalRawData); + } + + WorkloadNetworkDnsZoneData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsZoneData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDnsZoneData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDnsZoneData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDnsZoneData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkDnsZoneData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(domain), Optional.ToList(dnsServerIPs), sourceIP.Value, Optional.ToNullable(dnsServices), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDnsZoneData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDnsZoneData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs index 7ef02edcba81..d142f7486cb1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkDnsZonesList + internal partial class WorkloadNetworkDnsZonesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkDnsZonesList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkDnsZonesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkDnsZonesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsZonesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkDnsZonesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkDnsZonesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkDnsZonesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkDnsZonesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkDnsZonesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs index 4bc05586abc0..8363daccc643 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX DNS Zones. internal partial class WorkloadNetworkDnsZonesList { - /// Initializes a new instance of WorkloadNetworkDnsZonesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkDnsZonesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDnsZonesList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkDnsZonesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDnsZonesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs index 42dce04405f2..897d005aec56 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkGatewayData : IUtf8JsonSerializable + public partial class WorkloadNetworkGatewayData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData(JsonElement element) + internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData Optional systemData = default; Optional displayName = default; Optional path = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -87,8 +110,61 @@ internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkGatewayData(id, name, type, systemData.Value, displayName.Value, path.Value, serializedAdditionalRawData); + } + + WorkloadNetworkGatewayData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkGatewayData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkGatewayData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkGatewayData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkGatewayData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkGatewayData(id, name, type, systemData.Value, displayName.Value, path.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkGatewayData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkGatewayData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs index 2cdb7fb87da1..3498161d4842 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkGatewayList + internal partial class WorkloadNetworkGatewayList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkGatewayList DeserializeWorkloadNetworkGatewayList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkGatewayList DeserializeWorkloadNetworkGatewayList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkGatewayList DeserializeWorkloadNetworkGatewayList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkGatewayList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkGatewayList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkGatewayList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkGatewayList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkGatewayList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkGatewayList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkGatewayList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkGatewayList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkGatewayList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs index e6e1b4c38ace..422e60cedb05 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX Gateways. internal partial class WorkloadNetworkGatewayList { - /// Initializes a new instance of WorkloadNetworkGatewayList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkGatewayList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkGatewayList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkGatewayList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkGatewayList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.Serialization.cs index 44736ded69ad..7cc4fdb1d5ad 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkList + internal partial class WorkloadNetworkList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkList DeserializeWorkloadNetworkList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkList DeserializeWorkloadNetworkList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkList DeserializeWorkloadNetworkList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.cs index e8c73c05380d..903ae381b553 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of workload networks. internal partial class WorkloadNetworkList { - /// Initializes a new instance of WorkloadNetworkList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs index 38309b603177..abde688fa240 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkPortMirroringList + internal partial class WorkloadNetworkPortMirroringList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortMirroringList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortMirroringList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortM nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkPortMirroringList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkPortMirroringList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkPortMirroringList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPortMirroringList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkPortMirroringList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkPortMirroringList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkPortMirroringList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkPortMirroringList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkPortMirroringList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs index a0e5ce1a7b42..bff5ac744c3e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX Port Mirroring. internal partial class WorkloadNetworkPortMirroringList { - /// Initializes a new instance of WorkloadNetworkPortMirroringList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkPortMirroringList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkPortMirroringList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkPortMirroringList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkPortMirroringList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileData.Serialization.cs index 57adabe1a092..e5ecf4e3e99b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkPortMirroringProfileData : IUtf8JsonSerializable + public partial class WorkloadNetworkPortMirroringProfileData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -45,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Revision.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkPortMirroringProfileData DeserializeWorkloadNetworkPortMirroringProfileData(JsonElement element) + internal static WorkloadNetworkPortMirroringProfileData DeserializeWorkloadNetworkPortMirroringProfileData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +87,7 @@ internal static WorkloadNetworkPortMirroringProfileData DeserializeWorkloadNetwo Optional status = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -154,8 +177,61 @@ internal static WorkloadNetworkPortMirroringProfileData DeserializeWorkloadNetwo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkPortMirroringProfileData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(direction), source.Value, destination.Value, Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serializedAdditionalRawData); + } + + WorkloadNetworkPortMirroringProfileData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPortMirroringProfileData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkPortMirroringProfileData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkPortMirroringProfileData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkPortMirroringProfileData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkPortMirroringProfileData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(direction), source.Value, destination.Value, Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkPortMirroringProfileData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkPortMirroringProfileData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs index 9773bac5ff6a..683c7cccdaa5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkPublicIPData : IUtf8JsonSerializable + public partial class WorkloadNetworkPublicIPData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(NumberOfPublicIPs.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkPublicIPData DeserializeWorkloadNetworkPublicIPData(JsonElement element) + internal static WorkloadNetworkPublicIPData DeserializeWorkloadNetworkPublicIPData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +69,7 @@ internal static WorkloadNetworkPublicIPData DeserializeWorkloadNetworkPublicIPDa Optional numberOfPublicIPs = default; Optional publicIPBlock = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -113,8 +136,61 @@ internal static WorkloadNetworkPublicIPData DeserializeWorkloadNetworkPublicIPDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkPublicIPData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(numberOfPublicIPs), publicIPBlock.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + WorkloadNetworkPublicIPData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPublicIPData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkPublicIPData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkPublicIPData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkPublicIPData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkPublicIPData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(numberOfPublicIPs), publicIPBlock.Value, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkPublicIPData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkPublicIPData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs index 78709a260ba0..d8d111860cf9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkPublicIPsList + internal partial class WorkloadNetworkPublicIPsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPs nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkPublicIPsList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkPublicIPsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkPublicIPsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPublicIPsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkPublicIPsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkPublicIPsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkPublicIPsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkPublicIPsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkPublicIPsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs index 0caf8e082b41..b395dadbb1c4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX Public IP Blocks. internal partial class WorkloadNetworkPublicIPsList { - /// Initializes a new instance of WorkloadNetworkPublicIPsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkPublicIPsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkPublicIPsList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkPublicIPsList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkPublicIPsList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs index 2360636633f0..0f7dfe1da65c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkSegmentData : IUtf8JsonSerializable + public partial class WorkloadNetworkSegmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +40,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"u8); - writer.WriteObjectValue(Subnet); + if (Subnet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Subnet).Serialize(writer, options); + } } if (Optional.IsDefined(Revision)) { @@ -41,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Revision.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData(JsonElement element) + internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +89,7 @@ internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData Optional status = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -159,8 +188,61 @@ internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkSegmentData(id, name, type, systemData.Value, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serializedAdditionalRawData); + } + + WorkloadNetworkSegmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkSegmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkSegmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkSegmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkSegmentData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkSegmentData(Response response) + { + if (response is null) + { + return null; } - return new WorkloadNetworkSegmentData(id, name, type, systemData.Value, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkSegmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs index 04c9a174aa9f..279459b2b7f5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkSegmentPortVif + public partial class WorkloadNetworkSegmentPortVif : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkSegmentPortVif DeserializeWorkloadNetworkSegmentPortVif(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PortName)) + { + writer.WritePropertyName("portName"u8); + writer.WriteStringValue(PortName); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkSegmentPortVif DeserializeWorkloadNetworkSegmentPortVif(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional portName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("portName"u8)) @@ -26,8 +60,61 @@ internal static WorkloadNetworkSegmentPortVif DeserializeWorkloadNetworkSegmentP portName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkSegmentPortVif(portName.Value); + return new WorkloadNetworkSegmentPortVif(portName.Value, serializedAdditionalRawData); + } + + WorkloadNetworkSegmentPortVif IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkSegmentPortVif(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkSegmentPortVif IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkSegmentPortVif(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkSegmentPortVif model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkSegmentPortVif(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkSegmentPortVif(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs index 603255c99318..e4aeca7c8292 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Avs.Models { /// Ports and any VIF attached to segment. public partial class WorkloadNetworkSegmentPortVif { - /// Initializes a new instance of WorkloadNetworkSegmentPortVif. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkSegmentPortVif() { } - /// Initializes a new instance of WorkloadNetworkSegmentPortVif. + /// Initializes a new instance of . /// Name of port or VIF attached to segment. - internal WorkloadNetworkSegmentPortVif(string portName) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkSegmentPortVif(string portName, Dictionary serializedAdditionalRawData) { PortName = portName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of port or VIF attached to segment. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs index e1e5f9aff473..0d1b319d9b16 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkSegmentSubnet : IUtf8JsonSerializable + public partial class WorkloadNetworkSegmentSubnet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DhcpRanges)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("gatewayAddress"u8); writer.WriteStringValue(GatewayAddress); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkSegmentSubnet DeserializeWorkloadNetworkSegmentSubnet(JsonElement element) + internal static WorkloadNetworkSegmentSubnet DeserializeWorkloadNetworkSegmentSubnet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> dhcpRanges = default; Optional gatewayAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dhcpRanges"u8)) @@ -63,8 +85,61 @@ internal static WorkloadNetworkSegmentSubnet DeserializeWorkloadNetworkSegmentSu gatewayAddress = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkSegmentSubnet(Optional.ToList(dhcpRanges), gatewayAddress.Value, serializedAdditionalRawData); + } + + WorkloadNetworkSegmentSubnet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkSegmentSubnet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkSegmentSubnet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkSegmentSubnet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkSegmentSubnet model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkSegmentSubnet(Optional.ToList(dhcpRanges), gatewayAddress.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkSegmentSubnet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkSegmentSubnet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs index db7bfe7acb87..f506f60340b9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Avs.Models /// Subnet configuration for segment. public partial class WorkloadNetworkSegmentSubnet { - /// Initializes a new instance of WorkloadNetworkSegmentSubnet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkSegmentSubnet() { DhcpRanges = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkSegmentSubnet. + /// Initializes a new instance of . /// DHCP Range assigned for subnet. /// Gateway address. - internal WorkloadNetworkSegmentSubnet(IList dhcpRanges, string gatewayAddress) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkSegmentSubnet(IList dhcpRanges, string gatewayAddress, Dictionary serializedAdditionalRawData) { DhcpRanges = dhcpRanges; GatewayAddress = gatewayAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// DHCP Range assigned for subnet. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs index 1b7db01c519a..f104545e0782 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkSegmentsList + internal partial class WorkloadNetworkSegmentsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkSegmentsList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkSegmentsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkSegmentsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkSegmentsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkSegmentsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkSegmentsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkSegmentsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkSegmentsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkSegmentsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs index e2ee4ad25dcf..31b03cc475ae 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX Segments. internal partial class WorkloadNetworkSegmentsList { - /// Initializes a new instance of WorkloadNetworkSegmentsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkSegmentsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkSegmentsList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs index 06555646a36d..f39b3e6d62b4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkVirtualMachineData : IUtf8JsonSerializable + public partial class WorkloadNetworkVirtualMachineData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirtualMachineData(JsonElement element) + internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirtualMachineData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +62,7 @@ internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirt Optional systemData = default; Optional displayName = default; Optional vmType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -92,8 +115,61 @@ internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirt } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkVirtualMachineData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(vmType), serializedAdditionalRawData); + } + + WorkloadNetworkVirtualMachineData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVirtualMachineData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkVirtualMachineData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkVirtualMachineData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkVirtualMachineData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkVirtualMachineData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(vmType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkVirtualMachineData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkVirtualMachineData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs index b7a58fb0a103..009168429b48 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkVirtualMachinesList + internal partial class WorkloadNetworkVirtualMachinesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkVirtualMachinesList DeserializeWorkloadNetworkVirtualMachinesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkVirtualMachinesList DeserializeWorkloadNetworkVirtualMachinesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkVirtualMachinesList DeserializeWorkloadNetworkVir nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkVirtualMachinesList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkVirtualMachinesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkVirtualMachinesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVirtualMachinesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkVirtualMachinesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkVirtualMachinesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkVirtualMachinesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkVirtualMachinesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkVirtualMachinesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs index 659d8b38d66e..bc4bf6018e91 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX Virtual Machines. internal partial class WorkloadNetworkVirtualMachinesList { - /// Initializes a new instance of WorkloadNetworkVirtualMachinesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkVirtualMachinesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkVirtualMachinesList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkVirtualMachinesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkVirtualMachinesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupData.Serialization.cs index 3538bfc42e98..ce57c2a31af3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkVmGroupData : IUtf8JsonSerializable + public partial class WorkloadNetworkVmGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Revision.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkloadNetworkVmGroupData DeserializeWorkloadNetworkVmGroupData(JsonElement element) + internal static WorkloadNetworkVmGroupData DeserializeWorkloadNetworkVmGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static WorkloadNetworkVmGroupData DeserializeWorkloadNetworkVmGroupData Optional status = default; Optional provisioningState = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -143,8 +165,61 @@ internal static WorkloadNetworkVmGroupData DeserializeWorkloadNetworkVmGroupData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkloadNetworkVmGroupData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(members), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serializedAdditionalRawData); + } + + WorkloadNetworkVmGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVmGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkVmGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkVmGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkVmGroupData model) + { + if (model is null) + { + return null; } - return new WorkloadNetworkVmGroupData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(members), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkVmGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkVmGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs index 76159ebccc60..a953ffedd24c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { - internal partial class WorkloadNetworkVmGroupsList + internal partial class WorkloadNetworkVmGroupsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadNetworkVmGroupsList DeserializeWorkloadNetworkVmGroupsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkVmGroupsList DeserializeWorkloadNetworkVmGroupsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static WorkloadNetworkVmGroupsList DeserializeWorkloadNetworkVmGroupsLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadNetworkVmGroupsList(Optional.ToList(value), nextLink.Value); + return new WorkloadNetworkVmGroupsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WorkloadNetworkVmGroupsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVmGroupsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadNetworkVmGroupsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadNetworkVmGroupsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadNetworkVmGroupsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadNetworkVmGroupsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadNetworkVmGroupsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs index b9d8255b65de..d818897c3f9e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Avs.Models /// A list of NSX VM Groups. internal partial class WorkloadNetworkVmGroupsList { - /// Initializes a new instance of WorkloadNetworkVmGroupsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WorkloadNetworkVmGroupsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkVmGroupsList. + /// Initializes a new instance of . /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkVmGroupsList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkVmGroupsList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The items on the page. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs index 17a3126d3b23..d30324ed9310 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _placementPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _placementPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PlacementPolicyResource(Client, PlacementPolicyData.DeserializePlacementPolicyData(e)), _placementPolicyClientDiagnostics, Pipeline, "PlacementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new PlacementPolicyResource(Client, PlacementPolicyData.DeserializePlacementPolicyData(e)), _placementPolicyClientDiagnostics, Pipeline, "PlacementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _placementPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _placementPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PlacementPolicyResource(Client, PlacementPolicyData.DeserializePlacementPolicyData(e)), _placementPolicyClientDiagnostics, Pipeline, "PlacementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new PlacementPolicyResource(Client, PlacementPolicyData.DeserializePlacementPolicyData(e)), _placementPolicyClientDiagnostics, Pipeline, "PlacementPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs index 0a287d8c4be2..d5b6cc361504 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class PlacementPolicyData : ResourceData { - /// Initializes a new instance of PlacementPolicyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PlacementPolicyData() { } - /// Initializes a new instance of PlacementPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +37,11 @@ public PlacementPolicyData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal PlacementPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PlacementPolicyProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PlacementPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PlacementPolicyProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs index c8dc3622428f..c2bed9536437 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs index c775714918c7..67dff5be26b5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs index 627407f233be..97ef07e5f99a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs index eb7c96e1ba03..b6ab9d94cd91 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -307,9 +305,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs index 62ba6f0d7c9a..60a8edb7839e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs index 211e707d249d..5eeda8050539 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs index bb389792d4f1..02d452dddd5b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs index da88bc6dca9b..9d55ef5ac832 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateCheckTrialAvailabilityRequest(string subscriptionId, if (sku != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sku); - request.Content = content; + request.Content = sku; } _userAgent.Apply(message); return message; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs index 698f77a02231..039602dec12a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -327,9 +325,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs index 1b4c3120f666..a1b1a463015c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -354,9 +352,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs index 93a72c24377e..7449dc6df6ab 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs @@ -224,9 +224,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index a0a4280cd499..a7259f0a7e0f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -238,9 +238,7 @@ internal HttpMessage CreateRestrictMovementRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(restrictMovement); - request.Content = content; + request.Content = restrictMovement; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs index 3ff86f5c72c1..dd720f0f0994 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs @@ -388,9 +388,7 @@ internal HttpMessage CreateCreateSegmentsRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -472,9 +470,7 @@ internal HttpMessage CreateUpdateSegmentsRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -801,9 +797,7 @@ internal HttpMessage CreateCreateDhcpRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -885,9 +879,7 @@ internal HttpMessage CreateUpdateDhcpRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1381,9 +1373,7 @@ internal HttpMessage CreateCreatePortMirroringRequest(string subscriptionId, str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1465,9 +1455,7 @@ internal HttpMessage CreateUpdatePortMirroringRequest(string subscriptionId, str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1794,9 +1782,7 @@ internal HttpMessage CreateCreateVmGroupRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1878,9 +1864,7 @@ internal HttpMessage CreateUpdateVmGroupRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -2374,9 +2358,7 @@ internal HttpMessage CreateCreateDnsServiceRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -2458,9 +2440,7 @@ internal HttpMessage CreateUpdateDnsServiceRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -2787,9 +2767,7 @@ internal HttpMessage CreateCreateDnsZoneRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -2871,9 +2849,7 @@ internal HttpMessage CreateUpdateDnsZoneRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -3200,9 +3176,7 @@ internal HttpMessage CreateCreatePublicIPRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs index 14369b38cb0b..f047495ae4f5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _scriptCmdletRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scriptCmdletRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScriptCmdletResource(Client, ScriptCmdletData.DeserializeScriptCmdletData(e)), _scriptCmdletClientDiagnostics, Pipeline, "ScriptCmdletCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScriptCmdletResource(Client, ScriptCmdletData.DeserializeScriptCmdletData(e)), _scriptCmdletClientDiagnostics, Pipeline, "ScriptCmdletCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _scriptCmdletRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scriptCmdletRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScriptCmdletResource(Client, ScriptCmdletData.DeserializeScriptCmdletData(e)), _scriptCmdletClientDiagnostics, Pipeline, "ScriptCmdletCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScriptCmdletResource(Client, ScriptCmdletData.DeserializeScriptCmdletData(e)), _scriptCmdletClientDiagnostics, Pipeline, "ScriptCmdletCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs index 7f6838bb2d51..4871bfe542be 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Avs /// public partial class ScriptCmdletData : ResourceData { - /// Initializes a new instance of ScriptCmdletData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScriptCmdletData() { Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptCmdletData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,11 +36,13 @@ public ScriptCmdletData() /// Description of the scripts functionality. /// Recommended time limit for execution. /// Parameters the script will accept. - internal ScriptCmdletData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, TimeSpan? timeout, IReadOnlyList parameters) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ScriptCmdletData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, TimeSpan? timeout, IReadOnlyList parameters, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; Timeout = timeout; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the scripts functionality. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs index 641319956764..490dc01d6aa1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _scriptExecutionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scriptExecutionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScriptExecutionResource(Client, ScriptExecutionData.DeserializeScriptExecutionData(e)), _scriptExecutionClientDiagnostics, Pipeline, "ScriptExecutionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScriptExecutionResource(Client, ScriptExecutionData.DeserializeScriptExecutionData(e)), _scriptExecutionClientDiagnostics, Pipeline, "ScriptExecutionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _scriptExecutionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scriptExecutionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScriptExecutionResource(Client, ScriptExecutionData.DeserializeScriptExecutionData(e)), _scriptExecutionClientDiagnostics, Pipeline, "ScriptExecutionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScriptExecutionResource(Client, ScriptExecutionData.DeserializeScriptExecutionData(e)), _scriptExecutionClientDiagnostics, Pipeline, "ScriptExecutionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs index eecd6af13626..25917c6cb3c9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Avs /// public partial class ScriptExecutionData : ResourceData { - /// Initializes a new instance of ScriptExecutionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScriptExecutionData() { Parameters = new ChangeTrackingList(); @@ -30,7 +33,7 @@ public ScriptExecutionData() Errors = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptExecutionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -58,7 +61,8 @@ public ScriptExecutionData() /// Standard information out stream from the powershell execution. /// Standard warning out stream from the powershell execution. /// Standard error output stream from the powershell execution. - internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedOn, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, ScriptExecutionProvisioningState? provisioningState, IList output, BinaryData namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedOn, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, ScriptExecutionProvisioningState? provisioningState, IList output, BinaryData namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ScriptCmdletId = scriptCmdletId; Parameters = parameters; @@ -75,6 +79,7 @@ internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType re Information = information; Warnings = warnings; Errors = errors; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A reference to the script cmdlet resource if user is running a AVS script. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs index 3cb97ab24edc..d73d0dd9ceb5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _scriptPackageRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scriptPackageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScriptPackageResource(Client, ScriptPackageData.DeserializeScriptPackageData(e)), _scriptPackageClientDiagnostics, Pipeline, "ScriptPackageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScriptPackageResource(Client, ScriptPackageData.DeserializeScriptPackageData(e)), _scriptPackageClientDiagnostics, Pipeline, "ScriptPackageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _scriptPackageRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scriptPackageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScriptPackageResource(Client, ScriptPackageData.DeserializeScriptPackageData(e)), _scriptPackageClientDiagnostics, Pipeline, "ScriptPackageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScriptPackageResource(Client, ScriptPackageData.DeserializeScriptPackageData(e)), _scriptPackageClientDiagnostics, Pipeline, "ScriptPackageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs index 20898150fae9..bd8a0ff9ef2e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.Avs /// public partial class ScriptPackageData : ResourceData { - /// Initializes a new instance of ScriptPackageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScriptPackageData() { } - /// Initializes a new instance of ScriptPackageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +35,14 @@ public ScriptPackageData() /// Module version. /// Company that created and supports the package. /// Link to support by the package vendor. - internal ScriptPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string version, string company, Uri uri) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ScriptPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string version, string company, Uri uri, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; Version = version; Company = company; Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// User friendly description of the package. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs index 269028045dde..7124600e3d45 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkCollection.cs @@ -139,7 +139,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkResource(Client, WorkloadNetworkData.DeserializeWorkloadNetworkData(e)), _workloadNetworkClientDiagnostics, Pipeline, "WorkloadNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkResource(Client, WorkloadNetworkData.DeserializeWorkloadNetworkData(e)), _workloadNetworkClientDiagnostics, Pipeline, "WorkloadNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -161,7 +161,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkResource(Client, WorkloadNetworkData.DeserializeWorkloadNetworkData(e)), _workloadNetworkClientDiagnostics, Pipeline, "WorkloadNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkResource(Client, WorkloadNetworkData.DeserializeWorkloadNetworkData(e)), _workloadNetworkClientDiagnostics, Pipeline, "WorkloadNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs index 8512ae404f20..5099d65367e5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,18 +18,23 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkData : ResourceData { - /// Initializes a new instance of WorkloadNetworkData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkData() { } - /// Initializes a new instance of WorkloadNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - internal WorkloadNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs index 81d8495d66a1..41d040030f2d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDhcpResource(Client, WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(e)), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDhcpCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkDhcpResource(Client, WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(e)), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDhcpCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDhcpResource(Client, WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(e)), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDhcpCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkDhcpResource(Client, WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(e)), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDhcpCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs index 92304a0a1479..3017cf6b132f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkDhcpData : ResourceData { - /// Initializes a new instance of WorkloadNetworkDhcpData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkDhcpData() { } - /// Initializes a new instance of WorkloadNetworkDhcpData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +37,11 @@ public WorkloadNetworkDhcpData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal WorkloadNetworkDhcpData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkDhcpEntity properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDhcpData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkDhcpEntity properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs index fcd3dfd4676b..d816e7f38686 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsServiceResource(Client, WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(e)), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkDnsServiceResource(Client, WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(e)), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsServiceResource(Client, WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(e)), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkDnsServiceResource(Client, WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(e)), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs index 532d4f14b800..50987c6e0c37 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkDnsServiceData : ResourceData { - /// Initializes a new instance of WorkloadNetworkDnsServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkDnsServiceData() { FqdnZones = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDnsServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +42,8 @@ public WorkloadNetworkDnsServiceData() /// DNS Service status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkDnsServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IPAddress dnsServiceIP, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevel? logLevel, DnsServiceStatus? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDnsServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IPAddress dnsServiceIP, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevel? logLevel, DnsServiceStatus? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; DnsServiceIP = dnsServiceIP; @@ -48,6 +53,7 @@ internal WorkloadNetworkDnsServiceData(ResourceIdentifier id, string name, Resou Status = status; ProvisioningState = provisioningState; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the DNS Service. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs index 804b377a8e9f..867ba977563a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsZoneResource(Client, WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(e)), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsZoneCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkDnsZoneResource(Client, WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(e)), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsZoneCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsZoneResource(Client, WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(e)), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsZoneCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkDnsZoneResource(Client, WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(e)), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsZoneCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs index 29de389d71c2..9f63aa5cd0a1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkDnsZoneData : ResourceData { - /// Initializes a new instance of WorkloadNetworkDnsZoneData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkDnsZoneData() { Domain = new ChangeTrackingList(); DnsServerIPs = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDnsZoneData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +42,8 @@ public WorkloadNetworkDnsZoneData() /// Number of DNS Services using the DNS zone. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkDnsZoneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IList domain, IList dnsServerIPs, IPAddress sourceIP, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDnsZoneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IList domain, IList dnsServerIPs, IPAddress sourceIP, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Domain = domain; @@ -47,6 +52,7 @@ internal WorkloadNetworkDnsZoneData(ResourceIdentifier id, string name, Resource DnsServices = dnsServices; ProvisioningState = provisioningState; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the DNS Zone. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs index 8c608043db83..1e130078622d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs index 357a5136ea4d..ae384a51cb59 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,22 +18,27 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkGatewayData : ResourceData { - /// Initializes a new instance of WorkloadNetworkGatewayData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkGatewayData() { } - /// Initializes a new instance of WorkloadNetworkGatewayData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Display name of the DHCP entity. /// NSX Gateway Path. - internal WorkloadNetworkGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string path) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string path, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the DHCP entity. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs index 6cb027f73c6c..fbf781a87709 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAll { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPortMirroringProfileResource(Client, WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(e)), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPortMirroringProfileCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkPortMirroringProfileResource(Client, WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(e)), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPortMirroringProfileCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPortMirroringProfileResource(Client, WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(e)), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPortMirroringProfileCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkPortMirroringProfileResource(Client, WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(e)), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPortMirroringProfileCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs index 300280c81923..4f8ab91eb4e7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkPortMirroringProfileData : ResourceData { - /// Initializes a new instance of WorkloadNetworkPortMirroringProfileData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkPortMirroringProfileData() { } - /// Initializes a new instance of WorkloadNetworkPortMirroringProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +39,8 @@ public WorkloadNetworkPortMirroringProfileData() /// Port Mirroring Status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, PortMirroringProfileDirection? direction, string source, string destination, PortMirroringProfileStatus? status, WorkloadNetworkPortMirroringProfileProvisioningState? provisioningState, long? revision) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, PortMirroringProfileDirection? direction, string source, string destination, PortMirroringProfileStatus? status, WorkloadNetworkPortMirroringProfileProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Direction = direction; @@ -43,6 +49,7 @@ internal WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id, string n Status = status; ProvisioningState = provisioningState; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the port mirroring profile. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs index 57f41f9a5119..96aaccf09faf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPublicIPResource(Client, WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(e)), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPublicIPCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkPublicIPResource(Client, WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(e)), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPublicIPCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPublicIPResource(Client, WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(e)), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPublicIPCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkPublicIPResource(Client, WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(e)), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPublicIPCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs index c012d6fea20b..14c125d03754 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkPublicIPData : ResourceData { - /// Initializes a new instance of WorkloadNetworkPublicIPData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkPublicIPData() { } - /// Initializes a new instance of WorkloadNetworkPublicIPData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +36,14 @@ public WorkloadNetworkPublicIPData() /// Number of Public IPs requested. /// CIDR Block of the Public IP Block. /// The provisioning state. - internal WorkloadNetworkPublicIPData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkPublicIPData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; NumberOfPublicIPs = numberOfPublicIPs; PublicIPBlock = publicIPBlock; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the Public IP Block. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs index deb613f81a1c..272d12947217 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs index 9e372a6c883c..84931ecbe5f9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkSegmentData : ResourceData { - /// Initializes a new instance of WorkloadNetworkSegmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkSegmentData() { PortVif = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkSegmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +40,8 @@ public WorkloadNetworkSegmentData() /// Segment status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, WorkloadNetworkSegmentStatus? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, WorkloadNetworkSegmentStatus? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; ConnectedGateway = connectedGateway; @@ -45,6 +50,7 @@ internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, Resource Status = status; ProvisioningState = provisioningState; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the segment. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs index f618f1bac111..ed61ba37fd95 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs index de27218c4816..d1b5474af5bd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkVirtualMachineData : ResourceData { - /// Initializes a new instance of WorkloadNetworkVirtualMachineData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkVirtualMachineData() { } - /// Initializes a new instance of WorkloadNetworkVirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Display name of the VM. /// Virtual machine type. - internal WorkloadNetworkVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, WorkloadNetworkVmType? vmType) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, WorkloadNetworkVmType? vmType, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; VmType = vmType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the VM. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs index 3efc206442c4..94c2bc4add31 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVmGroupResource(Client, WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(e)), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVmGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkVmGroupResource(Client, WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(e)), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVmGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVmGroupResource(Client, WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(e)), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVmGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WorkloadNetworkVmGroupResource(Client, WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(e)), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVmGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs index 7dab41e2b0a5..84665b44a878 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Avs.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkVmGroupData : ResourceData { - /// Initializes a new instance of WorkloadNetworkVmGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WorkloadNetworkVmGroupData() { Members = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkVmGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,13 +38,15 @@ public WorkloadNetworkVmGroupData() /// VM Group status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkVmGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IList members, WorkloadNetworkVmGroupStatus? status, WorkloadNetworkVmGroupProvisioningState? provisioningState, long? revision) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkVmGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IList members, WorkloadNetworkVmGroupStatus? status, WorkloadNetworkVmGroupProvisioningState? provisioningState, long? revision, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Members = members; Status = status; ProvisioningState = provisioningState; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Display name of the VM group. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs index 6cf3f598a744..196dc45c155f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _arcExtensionExtensionsRestClient.CreateListByArcSettingRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _arcExtensionExtensionsRestClient.CreateListByArcSettingNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArcExtensionResource(Client, ArcExtensionData.DeserializeArcExtensionData(e)), _arcExtensionExtensionsClientDiagnostics, Pipeline, "ArcExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ArcExtensionResource(Client, ArcExtensionData.DeserializeArcExtensionData(e)), _arcExtensionExtensionsClientDiagnostics, Pipeline, "ArcExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _arcExtensionExtensionsRestClient.CreateListByArcSettingRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _arcExtensionExtensionsRestClient.CreateListByArcSettingNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArcExtensionResource(Client, ArcExtensionData.DeserializeArcExtensionData(e)), _arcExtensionExtensionsClientDiagnostics, Pipeline, "ArcExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ArcExtensionResource(Client, ArcExtensionData.DeserializeArcExtensionData(e)), _arcExtensionExtensionsClientDiagnostics, Pipeline, "ArcExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionData.cs index f7503da99b39..1d5067218712 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Hci /// public partial class ArcExtensionData : ResourceData { - /// Initializes a new instance of ArcExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ArcExtensionData() { PerNodeExtensionDetails = new ChangeTrackingList(); } - /// Initializes a new instance of ArcExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public ArcExtensionData() /// Json formatted public settings for the extension. /// Protected settings (may contain secrets). /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. - internal ArcExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HciProvisioningState? provisioningState, ArcExtensionAggregateState? aggregateState, IReadOnlyList perNodeExtensionDetails, string forceUpdateTag, string publisher, string arcExtensionType, string typeHandlerVersion, bool? shouldAutoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, bool? enableAutomaticUpgrade) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ArcExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HciProvisioningState? provisioningState, ArcExtensionAggregateState? aggregateState, IReadOnlyList perNodeExtensionDetails, string forceUpdateTag, string publisher, string arcExtensionType, string typeHandlerVersion, bool? shouldAutoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, bool? enableAutomaticUpgrade, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; AggregateState = aggregateState; @@ -54,6 +58,7 @@ internal ArcExtensionData(ResourceIdentifier id, string name, ResourceType resou Settings = settings; ProtectedSettings = protectedSettings; EnableAutomaticUpgrade = enableAutomaticUpgrade; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the Extension proxy resource. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs index c19d909e46bc..7f806e1c4ceb 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _arcSettingRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _arcSettingRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArcSettingResource(Client, ArcSettingData.DeserializeArcSettingData(e)), _arcSettingClientDiagnostics, Pipeline, "ArcSettingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ArcSettingResource(Client, ArcSettingData.DeserializeArcSettingData(e)), _arcSettingClientDiagnostics, Pipeline, "ArcSettingCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _arcSettingRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _arcSettingRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArcSettingResource(Client, ArcSettingData.DeserializeArcSettingData(e)), _arcSettingClientDiagnostics, Pipeline, "ArcSettingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ArcSettingResource(Client, ArcSettingData.DeserializeArcSettingData(e)), _arcSettingClientDiagnostics, Pipeline, "ArcSettingCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingData.cs index 27f20dc60e79..45815987fe6a 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Hci /// public partial class ArcSettingData : ResourceData { - /// Initializes a new instance of ArcSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ArcSettingData() { PerNodeDetails = new ChangeTrackingList(); } - /// Initializes a new instance of ArcSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +42,8 @@ public ArcSettingData() /// Aggregate state of Arc agent across the nodes in this HCI cluster. /// State of Arc agent in each of the nodes. /// contains connectivity related configuration for ARC resources. - internal ArcSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HciProvisioningState? provisioningState, string arcInstanceResourceGroup, Guid? arcApplicationClientId, Guid? arcApplicationTenantId, Guid? arcServicePrincipalObjectId, Guid? arcApplicationObjectId, ArcSettingAggregateState? aggregateState, IReadOnlyList perNodeDetails, BinaryData connectivityProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ArcSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HciProvisioningState? provisioningState, string arcInstanceResourceGroup, Guid? arcApplicationClientId, Guid? arcApplicationTenantId, Guid? arcServicePrincipalObjectId, Guid? arcApplicationObjectId, ArcSettingAggregateState? aggregateState, IReadOnlyList perNodeDetails, BinaryData connectivityProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; ArcInstanceResourceGroup = arcInstanceResourceGroup; @@ -50,6 +54,7 @@ internal ArcSettingData(ResourceIdentifier id, string name, ResourceType resourc AggregateState = aggregateState; PerNodeDetails = perNodeDetails; ConnectivityProperties = connectivityProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the ArcSetting proxy resource. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArmHciModelFactory.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArmHciModelFactory.cs index 7f1a0d49682b..3716aa1266fa 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArmHciModelFactory.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArmHciModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Hci.Models /// Model factory for models. public static partial class ArmHciModelFactory { - /// Initializes a new instance of ArcSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,20 +36,20 @@ public static ArcSettingData ArcSettingData(ResourceIdentifier id = null, string { perNodeDetails ??= new List(); - return new ArcSettingData(id, name, resourceType, systemData, provisioningState, arcInstanceResourceGroup, arcApplicationClientId, arcApplicationTenantId, arcServicePrincipalObjectId, arcApplicationObjectId, aggregateState, perNodeDetails?.ToList(), connectivityProperties); + return new ArcSettingData(id, name, resourceType, systemData, provisioningState, arcInstanceResourceGroup, arcApplicationClientId, arcApplicationTenantId, arcServicePrincipalObjectId, arcApplicationObjectId, aggregateState, perNodeDetails?.ToList(), connectivityProperties, default); } - /// Initializes a new instance of PerNodeArcState. + /// Initializes a new instance of . /// Name of the Node in HCI Cluster. /// Fully qualified resource ID for the Arc agent of this node. /// State of Arc agent in this node. /// A new instance for mocking. public static PerNodeArcState PerNodeArcState(string name = null, string arcInstance = null, NodeArcState? state = null) { - return new PerNodeArcState(name, arcInstance, state); + return new PerNodeArcState(name, arcInstance, state, default); } - /// Initializes a new instance of ArcPasswordCredential. + /// Initializes a new instance of . /// /// /// @@ -57,10 +57,10 @@ public static PerNodeArcState PerNodeArcState(string name = null, string arcInst /// A new instance for mocking. public static ArcPasswordCredential ArcPasswordCredential(string secretText = null, string keyId = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null) { - return new ArcPasswordCredential(secretText, keyId, startOn, endOn); + return new ArcPasswordCredential(secretText, keyId, startOn, endOn, default); } - /// Initializes a new instance of ArcIdentityResult. + /// Initializes a new instance of . /// /// /// @@ -68,10 +68,10 @@ public static ArcPasswordCredential ArcPasswordCredential(string secretText = nu /// A new instance for mocking. public static ArcIdentityResult ArcIdentityResult(Guid? arcApplicationClientId = null, Guid? arcApplicationTenantId = null, Guid? arcServicePrincipalObjectId = null, Guid? arcApplicationObjectId = null) { - return new ArcIdentityResult(arcApplicationClientId, arcApplicationTenantId, arcServicePrincipalObjectId, arcApplicationObjectId); + return new ArcIdentityResult(arcApplicationClientId, arcApplicationTenantId, arcServicePrincipalObjectId, arcApplicationObjectId, default); } - /// Initializes a new instance of HciClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -106,20 +106,20 @@ public static HciClusterData HciClusterData(ResourceIdentifier id = null, string tags ??= new Dictionary(); userAssignedIdentities ??= new Dictionary(); - return new HciClusterData(id, name, resourceType, systemData, tags, location, provisioningState, status, cloudId, cloudManagementEndpoint, aadClientId, aadTenantId, aadApplicationObjectId, aadServicePrincipalObjectId, softwareAssuranceProperties, desiredProperties, reportedProperties, trialDaysRemaining, billingModel, registrationTimestamp, lastSyncTimestamp, lastBillingTimestamp, serviceEndpoint, resourceProviderObjectId, principalId, tenantId, typeIdentityType, userAssignedIdentities); + return new HciClusterData(id, name, resourceType, systemData, tags, location, provisioningState, status, cloudId, cloudManagementEndpoint, aadClientId, aadTenantId, aadApplicationObjectId, aadServicePrincipalObjectId, softwareAssuranceProperties, desiredProperties, reportedProperties, trialDaysRemaining, billingModel, registrationTimestamp, lastSyncTimestamp, lastBillingTimestamp, serviceEndpoint, resourceProviderObjectId, principalId, tenantId, typeIdentityType, userAssignedIdentities, default); } - /// Initializes a new instance of SoftwareAssuranceProperties. + /// Initializes a new instance of . /// Status of the Software Assurance for the cluster. /// Customer Intent for Software Assurance Benefit. /// TimeStamp denoting the latest SA benefit applicability is validated. /// A new instance for mocking. public static SoftwareAssuranceProperties SoftwareAssuranceProperties(SoftwareAssuranceStatus? softwareAssuranceStatus = null, SoftwareAssuranceIntent? softwareAssuranceIntent = null, DateTimeOffset? lastUpdated = null) { - return new SoftwareAssuranceProperties(softwareAssuranceStatus, softwareAssuranceIntent, lastUpdated); + return new SoftwareAssuranceProperties(softwareAssuranceStatus, softwareAssuranceIntent, lastUpdated, default); } - /// Initializes a new instance of HciClusterReportedProperties. + /// Initializes a new instance of . /// Name of the on-prem cluster connected to this resource. /// Unique id generated by the on-prem cluster. /// Version of the cluster software. @@ -134,10 +134,10 @@ public static HciClusterReportedProperties HciClusterReportedProperties(string c nodes ??= new List(); supportedCapabilities ??= new List(); - return new HciClusterReportedProperties(clusterName, clusterId, clusterVersion, nodes?.ToList(), lastUpdatedOn, imdsAttestation, diagnosticLevel, supportedCapabilities?.ToList()); + return new HciClusterReportedProperties(clusterName, clusterId, clusterVersion, nodes?.ToList(), lastUpdatedOn, imdsAttestation, diagnosticLevel, supportedCapabilities?.ToList(), default); } - /// Initializes a new instance of HciClusterNode. + /// Initializes a new instance of . /// Name of the cluster node. /// Id of the node in the cluster. /// State of Windows Server Subscription. @@ -155,10 +155,29 @@ public static HciClusterReportedProperties HciClusterReportedProperties(string c /// A new instance for mocking. public static HciClusterNode HciClusterNode(string name = null, float? id = null, WindowsServerSubscription? windowsServerSubscription = null, ClusterNodeType? nodeType = null, string ehcResourceId = null, string manufacturer = null, string model = null, string osName = null, string osVersion = null, string osDisplayVersion = null, string serialNumber = null, float? coreCount = null, float? memoryInGiB = null, DateTimeOffset? lastLicensingTimestamp = null) { - return new HciClusterNode(name, id, windowsServerSubscription, nodeType, ehcResourceId, manufacturer, model, osName, osVersion, osDisplayVersion, serialNumber, coreCount, memoryInGiB, lastLicensingTimestamp); + return new HciClusterNode(name, id, windowsServerSubscription, nodeType, ehcResourceId, manufacturer, model, osName, osVersion, osDisplayVersion, serialNumber, coreCount, memoryInGiB, lastLicensingTimestamp, default); } - /// Initializes a new instance of HciClusterIdentityResult. + /// Initializes a new instance of . + /// Resource tags. + /// Endpoint configured for management from the Azure portal. + /// App id of cluster AAD identity. + /// Tenant id of cluster AAD identity. + /// Desired properties of the cluster. + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + /// The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + /// A new instance for mocking. + public static HciClusterPatch HciClusterPatch(IDictionary tags = null, string cloudManagementEndpoint = null, Guid? aadClientId = null, Guid? aadTenantId = null, HciClusterDesiredProperties desiredProperties = null, Guid? principalId = null, Guid? tenantId = null, HciManagedServiceIdentityType? managedServiceIdentityType = null, IDictionary userAssignedIdentities = null) + { + tags ??= new Dictionary(); + userAssignedIdentities ??= new Dictionary(); + + return new HciClusterPatch(tags, cloudManagementEndpoint, aadClientId, aadTenantId, desiredProperties, principalId, tenantId, managedServiceIdentityType, userAssignedIdentities, default); + } + + /// Initializes a new instance of . /// /// /// @@ -166,10 +185,10 @@ public static HciClusterNode HciClusterNode(string name = null, float? id = null /// A new instance for mocking. public static HciClusterIdentityResult HciClusterIdentityResult(Guid? aadClientId = null, Guid? aadTenantId = null, Guid? aadServicePrincipalObjectId = null, Guid? aadApplicationObjectId = null) { - return new HciClusterIdentityResult(aadClientId, aadTenantId, aadServicePrincipalObjectId, aadApplicationObjectId); + return new HciClusterIdentityResult(aadClientId, aadTenantId, aadServicePrincipalObjectId, aadApplicationObjectId, default); } - /// Initializes a new instance of ArcExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -190,10 +209,10 @@ public static ArcExtensionData ArcExtensionData(ResourceIdentifier id = null, st { perNodeExtensionDetails ??= new List(); - return new ArcExtensionData(id, name, resourceType, systemData, provisioningState, aggregateState, perNodeExtensionDetails?.ToList(), forceUpdateTag, publisher, arcExtensionType, typeHandlerVersion, shouldAutoUpgradeMinorVersion, settings, protectedSettings, enableAutomaticUpgrade); + return new ArcExtensionData(id, name, resourceType, systemData, provisioningState, aggregateState, perNodeExtensionDetails?.ToList(), forceUpdateTag, publisher, arcExtensionType, typeHandlerVersion, shouldAutoUpgradeMinorVersion, settings, protectedSettings, enableAutomaticUpgrade, default); } - /// Initializes a new instance of PerNodeExtensionState. + /// Initializes a new instance of . /// Name of the node in HCI Cluster. /// Fully qualified resource ID for the particular Arc Extension on this node. /// Specifies the version of the script handler. @@ -202,10 +221,10 @@ public static ArcExtensionData ArcExtensionData(ResourceIdentifier id = null, st /// A new instance for mocking. public static PerNodeExtensionState PerNodeExtensionState(string name = null, string extension = null, string typeHandlerVersion = null, NodeExtensionState? state = null, HciExtensionInstanceView instanceView = null) { - return new PerNodeExtensionState(name, extension, typeHandlerVersion, state, instanceView); + return new PerNodeExtensionState(name, extension, typeHandlerVersion, state, instanceView, default); } - /// Initializes a new instance of HciExtensionInstanceView. + /// Initializes a new instance of . /// The extension name. /// Specifies the type of the extension; an example is "MicrosoftMonitoringAgent". /// Specifies the version of the script handler. @@ -213,10 +232,10 @@ public static PerNodeExtensionState PerNodeExtensionState(string name = null, st /// A new instance for mocking. public static HciExtensionInstanceView HciExtensionInstanceView(string name = null, string extensionInstanceViewType = null, string typeHandlerVersion = null, ExtensionInstanceViewStatus status = null) { - return new HciExtensionInstanceView(name, extensionInstanceViewType, typeHandlerVersion, status); + return new HciExtensionInstanceView(name, extensionInstanceViewType, typeHandlerVersion, status, default); } - /// Initializes a new instance of ExtensionInstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The level code. /// The short localizable label for the status. @@ -225,10 +244,10 @@ public static HciExtensionInstanceView HciExtensionInstanceView(string name = nu /// A new instance for mocking. public static ExtensionInstanceViewStatus ExtensionInstanceViewStatus(string code = null, HciStatusLevelType? level = null, string displayStatus = null, string message = null, DateTimeOffset? time = null) { - return new ExtensionInstanceViewStatus(code, level, displayStatus, message, time); + return new ExtensionInstanceViewStatus(code, level, displayStatus, message, time, default); } - /// Initializes a new instance of OfferData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -243,10 +262,10 @@ public static OfferData OfferData(ResourceIdentifier id = null, string name = nu { skuMappings ??= new List(); - return new OfferData(id, name, resourceType, systemData, provisioningState, publisherId, content, contentVersion, skuMappings?.ToList()); + return new OfferData(id, name, resourceType, systemData, provisioningState, publisherId, content, contentVersion, skuMappings?.ToList(), default); } - /// Initializes a new instance of PublisherData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -255,10 +274,10 @@ public static OfferData OfferData(ResourceIdentifier id = null, string name = nu /// A new instance for mocking. public static PublisherData PublisherData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string provisioningState = null) { - return new PublisherData(id, name, resourceType, systemData, provisioningState); + return new PublisherData(id, name, resourceType, systemData, provisioningState, default); } - /// Initializes a new instance of HciSkuData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -274,10 +293,10 @@ public static HciSkuData HciSkuData(ResourceIdentifier id = null, string name = { skuMappings ??= new List(); - return new HciSkuData(id, name, resourceType, systemData, provisioningState, publisherId, offerId, content, contentVersion, skuMappings?.ToList()); + return new HciSkuData(id, name, resourceType, systemData, provisioningState, publisherId, offerId, content, contentVersion, skuMappings?.ToList(), default); } - /// Initializes a new instance of UpdateRunData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -301,10 +320,10 @@ public static UpdateRunData UpdateRunData(ResourceIdentifier id = null, string n { steps ??= new List(); - return new UpdateRunData(id, name, resourceType, systemData, location, provisioningState, timeStarted, lastUpdatedOn, duration, state, namePropertiesProgressName, description, errorMessage, status, startTimeUtc, endTimeUtc, lastUpdatedTimeUtc, steps?.ToList()); + return new UpdateRunData(id, name, resourceType, systemData, location, provisioningState, timeStarted, lastUpdatedOn, duration, state, namePropertiesProgressName, description, errorMessage, status, startTimeUtc, endTimeUtc, lastUpdatedTimeUtc, steps?.ToList(), default); } - /// Initializes a new instance of UpdateSummaryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -327,10 +346,10 @@ public static UpdateSummaryData UpdateSummaryData(ResourceIdentifier id = null, packageVersions ??= new List(); healthCheckResult ??= new List(); - return new UpdateSummaryData(id, name, resourceType, systemData, location, provisioningState, oemFamily, hardwareModel, packageVersions?.ToList(), currentVersion, lastUpdated, lastChecked, healthState, healthCheckResult?.ToList(), healthCheckOn, state); + return new UpdateSummaryData(id, name, resourceType, systemData, location, provisioningState, oemFamily, hardwareModel, packageVersions?.ToList(), currentVersion, lastUpdated, lastChecked, healthState, healthCheckResult?.ToList(), healthCheckOn, state, default); } - /// Initializes a new instance of UpdateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -364,7 +383,7 @@ public static UpdateData UpdateData(ResourceIdentifier id = null, string name = componentVersions ??= new List(); healthCheckResult ??= new List(); - return new UpdateData(id, name, resourceType, systemData, location, provisioningState, installedOn, description, state, prerequisites?.ToList(), componentVersions?.ToList(), rebootRequired, healthState, healthCheckResult?.ToList(), healthCheckOn, packagePath, packageSizeInMb, displayName, version, publisher, releaseLink, availabilityType, packageType, additionalProperties, progressPercentage, notifyMessage); + return new UpdateData(id, name, resourceType, systemData, location, provisioningState, installedOn, description, state, prerequisites?.ToList(), componentVersions?.ToList(), rebootRequired, healthState, healthCheckResult?.ToList(), healthCheckOn, packagePath, packageSizeInMb, displayName, version, publisher, releaseLink, availabilityType, packageType, additionalProperties, progressPercentage, notifyMessage, default); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 9b937d2dced4..662443882e70 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -60,7 +60,7 @@ public virtual AsyncPageable GetHciClustersAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => HciClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HciClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHciClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHciClusters", "value", "nextLink", cancellationToken); } /// @@ -82,7 +82,7 @@ public virtual Pageable GetHciClusters(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => HciClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HciClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHciClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHciClusters", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs index 10a54c3466e5..34113a1267e5 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _hciClusterClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hciClusterClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), _hciClusterClustersClientDiagnostics, Pipeline, "HciClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), _hciClusterClustersClientDiagnostics, Pipeline, "HciClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _hciClusterClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hciClusterClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), _hciClusterClustersClientDiagnostics, Pipeline, "HciClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), _hciClusterClustersClientDiagnostics, Pipeline, "HciClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterData.cs index cf9a634092e0..c87c4228d465 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Hci /// public partial class HciClusterData : TrackedResourceData { - /// Initializes a new instance of HciClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public HciClusterData(AzureLocation location) : base(location) { UserAssignedIdentities = new ChangeTrackingDictionary(); } - /// Initializes a new instance of HciClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -55,7 +58,8 @@ public HciClusterData(AzureLocation location) : base(location) /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). /// The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. - internal HciClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, HciProvisioningState? provisioningState, HciClusterStatus? status, Guid? cloudId, string cloudManagementEndpoint, Guid? aadClientId, Guid? aadTenantId, Guid? aadApplicationObjectId, Guid? aadServicePrincipalObjectId, SoftwareAssuranceProperties softwareAssuranceProperties, HciClusterDesiredProperties desiredProperties, HciClusterReportedProperties reportedProperties, float? trialDaysRemaining, string billingModel, DateTimeOffset? registrationTimestamp, DateTimeOffset? lastSyncTimestamp, DateTimeOffset? lastBillingTimestamp, string serviceEndpoint, string resourceProviderObjectId, Guid? principalId, Guid? tenantId, HciManagedServiceIdentityType? typeIdentityType, IDictionary userAssignedIdentities) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal HciClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, HciProvisioningState? provisioningState, HciClusterStatus? status, Guid? cloudId, string cloudManagementEndpoint, Guid? aadClientId, Guid? aadTenantId, Guid? aadApplicationObjectId, Guid? aadServicePrincipalObjectId, SoftwareAssuranceProperties softwareAssuranceProperties, HciClusterDesiredProperties desiredProperties, HciClusterReportedProperties reportedProperties, float? trialDaysRemaining, string billingModel, DateTimeOffset? registrationTimestamp, DateTimeOffset? lastSyncTimestamp, DateTimeOffset? lastBillingTimestamp, string serviceEndpoint, string resourceProviderObjectId, Guid? principalId, Guid? tenantId, HciManagedServiceIdentityType? typeIdentityType, IDictionary userAssignedIdentities, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; Status = status; @@ -79,6 +83,12 @@ internal HciClusterData(ResourceIdentifier id, string name, ResourceType resourc TenantId = tenantId; TypeIdentityType = typeIdentityType; UserAssignedIdentities = userAssignedIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HciClusterData() + { } /// Provisioning state. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs index 209a217201a5..08ee299577a2 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs @@ -701,7 +701,7 @@ public virtual AsyncPageable GetOffersAsync(string expand = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _offerRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _offerRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "HciClusterResource.GetOffers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "HciClusterResource.GetOffers", "value", "nextLink", cancellationToken); } /// @@ -724,7 +724,7 @@ public virtual Pageable GetOffers(string expand = null, Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _offerRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _offerRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "HciClusterResource.GetOffers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "HciClusterResource.GetOffers", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs index 39fb387f72c9..8ac2e6adf455 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuCollection.cs @@ -149,7 +149,7 @@ public virtual AsyncPageable GetAllAsync(string expand = null, C { HttpMessage FirstPageRequest(int? pageSizeHint) => _hciSkuSkusRestClient.CreateListByOfferRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hciSkuSkusRestClient.CreateListByOfferNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HciSkuResource(Client, HciSkuData.DeserializeHciSkuData(e)), _hciSkuSkusClientDiagnostics, Pipeline, "HciSkuCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HciSkuResource(Client, HciSkuData.DeserializeHciSkuData(e)), _hciSkuSkusClientDiagnostics, Pipeline, "HciSkuCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -172,7 +172,7 @@ public virtual Pageable GetAll(string expand = null, Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _hciSkuSkusRestClient.CreateListByOfferRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hciSkuSkusRestClient.CreateListByOfferNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HciSkuResource(Client, HciSkuData.DeserializeHciSkuData(e)), _hciSkuSkusClientDiagnostics, Pipeline, "HciSkuCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HciSkuResource(Client, HciSkuData.DeserializeHciSkuData(e)), _hciSkuSkusClientDiagnostics, Pipeline, "HciSkuCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuData.cs index 3e21eb6260ee..93769a7a43fa 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Hci /// public partial class HciSkuData : ResourceData { - /// Initializes a new instance of HciSkuData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciSkuData() { SkuMappings = new ChangeTrackingList(); } - /// Initializes a new instance of HciSkuData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public HciSkuData() /// JSON serialized catalog content of the sku offer. /// The API version of the catalog service used to serve the catalog content. /// Array of SKU mappings. - internal HciSkuData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, string publisherId, string offerId, string content, string contentVersion, IList skuMappings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal HciSkuData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, string publisherId, string offerId, string content, string contentVersion, IList skuMappings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PublisherId = publisherId; @@ -43,6 +48,7 @@ internal HciSkuData(ResourceIdentifier id, string name, ResourceType resourceTyp Content = content; ContentVersion = contentVersion; SkuMappings = skuMappings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning State. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionData.Serialization.cs index fcd2d0d6bb83..c06643f29df3 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class ArcExtensionData : IUtf8JsonSerializable + public partial class ArcExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -73,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ArcExtensionData DeserializeArcExtensionData(JsonElement element) + internal static ArcExtensionData DeserializeArcExtensionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -97,6 +117,7 @@ internal static ArcExtensionData DeserializeArcExtensionData(JsonElement element Optional settings = default; Optional protectedSettings = default; Optional enableAutomaticUpgrade = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -235,8 +256,61 @@ internal static ArcExtensionData DeserializeArcExtensionData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArcExtensionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(aggregateState), Optional.ToList(perNodeExtensionDetails), forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, Optional.ToNullable(enableAutomaticUpgrade)); + return new ArcExtensionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(aggregateState), Optional.ToList(perNodeExtensionDetails), forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, Optional.ToNullable(enableAutomaticUpgrade), serializedAdditionalRawData); + } + + ArcExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcExtensionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.Serialization.cs index 2d660485a5db..41dc5d8b925c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class ArcExtensionListResult + internal partial class ArcExtensionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArcExtensionListResult DeserializeArcExtensionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArcExtensionListResult DeserializeArcExtensionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ArcExtensionListResult DeserializeArcExtensionListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArcExtensionListResult(Optional.ToList(value), nextLink.Value); + return new ArcExtensionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ArcExtensionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcExtensionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcExtensionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcExtensionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcExtensionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcExtensionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcExtensionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.cs index 2cf9dca46cf9..d7c30d2f6e2e 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcExtensionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of Extensions in HCI cluster. internal partial class ArcExtensionListResult { - /// Initializes a new instance of ArcExtensionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ArcExtensionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ArcExtensionListResult. + /// Initializes a new instance of . /// List of Extensions in HCI cluster. /// Link to the next set of results. - internal ArcExtensionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ArcExtensionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Extensions in HCI cluster. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.Serialization.cs index 97b6f21408f1..d3431fca708f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.Serialization.cs @@ -6,15 +6,65 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class ArcIdentityResult + public partial class ArcIdentityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArcIdentityResult DeserializeArcIdentityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ArcApplicationClientId)) + { + writer.WritePropertyName("arcApplicationClientId"u8); + writer.WriteStringValue(ArcApplicationClientId.Value); + } + if (Optional.IsDefined(ArcApplicationTenantId)) + { + writer.WritePropertyName("arcApplicationTenantId"u8); + writer.WriteStringValue(ArcApplicationTenantId.Value); + } + if (Optional.IsDefined(ArcServicePrincipalObjectId)) + { + writer.WritePropertyName("arcServicePrincipalObjectId"u8); + writer.WriteStringValue(ArcServicePrincipalObjectId.Value); + } + if (Optional.IsDefined(ArcApplicationObjectId)) + { + writer.WritePropertyName("arcApplicationObjectId"u8); + writer.WriteStringValue(ArcApplicationObjectId.Value); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArcIdentityResult DeserializeArcIdentityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +73,7 @@ internal static ArcIdentityResult DeserializeArcIdentityResult(JsonElement eleme Optional arcApplicationTenantId = default; Optional arcServicePrincipalObjectId = default; Optional arcApplicationObjectId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -73,8 +124,61 @@ internal static ArcIdentityResult DeserializeArcIdentityResult(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArcIdentityResult(Optional.ToNullable(arcApplicationClientId), Optional.ToNullable(arcApplicationTenantId), Optional.ToNullable(arcServicePrincipalObjectId), Optional.ToNullable(arcApplicationObjectId)); + return new ArcIdentityResult(Optional.ToNullable(arcApplicationClientId), Optional.ToNullable(arcApplicationTenantId), Optional.ToNullable(arcServicePrincipalObjectId), Optional.ToNullable(arcApplicationObjectId), serializedAdditionalRawData); + } + + ArcIdentityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcIdentityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcIdentityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcIdentityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcIdentityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcIdentityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcIdentityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.cs index 90524b4262d3..b2fe37243c89 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcIdentityResult.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// ArcIdentity details. public partial class ArcIdentityResult { - /// Initializes a new instance of ArcIdentityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ArcIdentityResult() { } - /// Initializes a new instance of ArcIdentityResult. + /// Initializes a new instance of . /// /// /// /// - internal ArcIdentityResult(Guid? arcApplicationClientId, Guid? arcApplicationTenantId, Guid? arcServicePrincipalObjectId, Guid? arcApplicationObjectId) + /// Keeps track of any properties unknown to the library. + internal ArcIdentityResult(Guid? arcApplicationClientId, Guid? arcApplicationTenantId, Guid? arcServicePrincipalObjectId, Guid? arcApplicationObjectId, Dictionary serializedAdditionalRawData) { ArcApplicationClientId = arcApplicationClientId; ArcApplicationTenantId = arcApplicationTenantId; ArcServicePrincipalObjectId = arcServicePrincipalObjectId; ArcApplicationObjectId = arcApplicationObjectId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the arc application client id. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.Serialization.cs index 18b090b53de5..f4c45a598be5 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.Serialization.cs @@ -6,15 +6,62 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class ArcPasswordCredential + public partial class ArcPasswordCredential : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArcPasswordCredential DeserializeArcPasswordCredential(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(SecretText)) + { + writer.WritePropertyName("secretText"u8); + writer.WriteStringValue(SecretText); + } + if (Optional.IsDefined(KeyId)) + { + writer.WritePropertyName("keyId"u8); + writer.WriteStringValue(KeyId); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArcPasswordCredential DeserializeArcPasswordCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +70,7 @@ internal static ArcPasswordCredential DeserializeArcPasswordCredential(JsonEleme Optional keyId = default; Optional startDateTime = default; Optional endDateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretText"u8)) @@ -53,8 +101,61 @@ internal static ArcPasswordCredential DeserializeArcPasswordCredential(JsonEleme endDateTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArcPasswordCredential(secretText.Value, keyId.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime)); + return new ArcPasswordCredential(secretText.Value, keyId.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(endDateTime), serializedAdditionalRawData); + } + + ArcPasswordCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcPasswordCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcPasswordCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcPasswordCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcPasswordCredential model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcPasswordCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcPasswordCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.cs index 1e8f4716926d..520e0830f370 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcPasswordCredential.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// The ArcPasswordCredential. public partial class ArcPasswordCredential { - /// Initializes a new instance of ArcPasswordCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ArcPasswordCredential() { } - /// Initializes a new instance of ArcPasswordCredential. + /// Initializes a new instance of . /// /// /// /// - internal ArcPasswordCredential(string secretText, string keyId, DateTimeOffset? startOn, DateTimeOffset? endOn) + /// Keeps track of any properties unknown to the library. + internal ArcPasswordCredential(string secretText, string keyId, DateTimeOffset? startOn, DateTimeOffset? endOn, Dictionary serializedAdditionalRawData) { SecretText = secretText; KeyId = keyId; StartOn = startOn; EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the secret text. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingData.Serialization.cs index 837aa01dc9ff..730ac4d3a471 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class ArcSettingData : IUtf8JsonSerializable + public partial class ArcSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -56,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ArcSettingData DeserializeArcSettingData(JsonElement element) + internal static ArcSettingData DeserializeArcSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +98,7 @@ internal static ArcSettingData DeserializeArcSettingData(JsonElement element) Optional aggregateState = default; Optional> perNodeDetails = default; Optional connectivityProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -198,8 +219,61 @@ internal static ArcSettingData DeserializeArcSettingData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArcSettingData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), arcInstanceResourceGroup.Value, Optional.ToNullable(arcApplicationClientId), Optional.ToNullable(arcApplicationTenantId), Optional.ToNullable(arcServicePrincipalObjectId), Optional.ToNullable(arcApplicationObjectId), Optional.ToNullable(aggregateState), Optional.ToList(perNodeDetails), connectivityProperties.Value); + return new ArcSettingData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), arcInstanceResourceGroup.Value, Optional.ToNullable(arcApplicationClientId), Optional.ToNullable(arcApplicationTenantId), Optional.ToNullable(arcServicePrincipalObjectId), Optional.ToNullable(arcApplicationObjectId), Optional.ToNullable(aggregateState), Optional.ToList(perNodeDetails), connectivityProperties.Value, serializedAdditionalRawData); + } + + ArcSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcSettingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcSettingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.Serialization.cs index 9744ddb740e0..9f38457bc2b9 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class ArcSettingList + internal partial class ArcSettingList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArcSettingList DeserializeArcSettingList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArcSettingList DeserializeArcSettingList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ArcSettingList DeserializeArcSettingList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArcSettingList(Optional.ToList(value), nextLink.Value); + return new ArcSettingList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ArcSettingList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcSettingList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcSettingList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcSettingList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcSettingList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcSettingList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcSettingList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.cs index 9d01843e4932..7c29eb53eeba 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of ArcSetting proxy resources for the HCI cluster. internal partial class ArcSettingList { - /// Initializes a new instance of ArcSettingList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ArcSettingList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ArcSettingList. + /// Initializes a new instance of . /// List of ArcSetting proxy resources. /// Link to the next set of results. - internal ArcSettingList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ArcSettingList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of ArcSetting proxy resources. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.Serialization.cs index f1830de999cc..e3fac02313a4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class ArcSettingPatch : IUtf8JsonSerializable + public partial class ArcSettingPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -38,7 +46,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ArcSettingPatch DeserializeArcSettingPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional connectivityProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("connectivityProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectivityProperties = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ArcSettingPatch(Optional.ToDictionary(tags), connectivityProperties.Value, serializedAdditionalRawData); + } + + ArcSettingPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArcSettingPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArcSettingPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArcSettingPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArcSettingPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArcSettingPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArcSettingPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.cs index 09e7e0a3a691..44fb07b4e9c8 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ArcSettingPatch.cs @@ -14,12 +14,26 @@ namespace Azure.ResourceManager.Hci.Models /// ArcSetting details to update. public partial class ArcSettingPatch { - /// Initializes a new instance of ArcSettingPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ArcSettingPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// contains connectivity related configuration for ARC resources. + /// Keeps track of any properties unknown to the library. + internal ArcSettingPatch(IDictionary tags, BinaryData connectivityProperties, Dictionary serializedAdditionalRawData) + { + Tags = tags; + ConnectivityProperties = connectivityProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.Serialization.cs index d10d4cef3474..ac2a95341993 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.Serialization.cs @@ -6,15 +6,67 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class ExtensionInstanceViewStatus + public partial class ExtensionInstanceViewStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtensionInstanceViewStatus DeserializeExtensionInstanceViewStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Level)) + { + writer.WritePropertyName("level"u8); + writer.WriteStringValue(Level.Value.ToString()); + } + if (Optional.IsDefined(DisplayStatus)) + { + writer.WritePropertyName("displayStatus"u8); + writer.WriteStringValue(DisplayStatus); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(Time)) + { + writer.WritePropertyName("time"u8); + writer.WriteStringValue(Time.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtensionInstanceViewStatus DeserializeExtensionInstanceViewStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +76,7 @@ internal static ExtensionInstanceViewStatus DeserializeExtensionInstanceViewStat Optional displayStatus = default; Optional message = default; Optional time = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -59,8 +112,61 @@ internal static ExtensionInstanceViewStatus DeserializeExtensionInstanceViewStat time = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtensionInstanceViewStatus(code.Value, Optional.ToNullable(level), displayStatus.Value, message.Value, Optional.ToNullable(time)); + return new ExtensionInstanceViewStatus(code.Value, Optional.ToNullable(level), displayStatus.Value, message.Value, Optional.ToNullable(time), serializedAdditionalRawData); + } + + ExtensionInstanceViewStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtensionInstanceViewStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtensionInstanceViewStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtensionInstanceViewStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtensionInstanceViewStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtensionInstanceViewStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtensionInstanceViewStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.cs index 6ff0cbdc4fe1..25d9215d2679 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionInstanceViewStatus.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// Instance view status. public partial class ExtensionInstanceViewStatus { - /// Initializes a new instance of ExtensionInstanceViewStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtensionInstanceViewStatus() { } - /// Initializes a new instance of ExtensionInstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The level code. /// The short localizable label for the status. /// The detailed status message, including for alerts and error messages. /// The time of the status. - internal ExtensionInstanceViewStatus(string code, HciStatusLevelType? level, string displayStatus, string message, DateTimeOffset? time) + /// Keeps track of any properties unknown to the library. + internal ExtensionInstanceViewStatus(string code, HciStatusLevelType? level, string displayStatus, string message, DateTimeOffset? time, Dictionary serializedAdditionalRawData) { Code = code; Level = level; DisplayStatus = displayStatus; Message = message; Time = time; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status code. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.Serialization.cs index aee525ee4560..fce4a84507b6 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class ExtensionUpgradeContent : IUtf8JsonSerializable + public partial class ExtensionUpgradeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TargetVersion)) { writer.WritePropertyName("targetVersion"u8); writer.WriteStringValue(TargetVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ExtensionUpgradeContent DeserializeExtensionUpgradeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional targetVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetVersion"u8)) + { + targetVersion = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtensionUpgradeContent(targetVersion.Value, serializedAdditionalRawData); + } + + ExtensionUpgradeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtensionUpgradeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtensionUpgradeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtensionUpgradeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtensionUpgradeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtensionUpgradeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtensionUpgradeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.cs index 00041ec15662..66cb9fdb011f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/ExtensionUpgradeContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// Describes the parameters for Extension upgrade. public partial class ExtensionUpgradeContent { - /// Initializes a new instance of ExtensionUpgradeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExtensionUpgradeContent() { } + /// Initializes a new instance of . + /// Extension Upgrade Target Version. + /// Keeps track of any properties unknown to the library. + internal ExtensionUpgradeContent(string targetVersion, Dictionary serializedAdditionalRawData) + { + TargetVersion = targetVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Extension Upgrade Target Version. public string TargetVersion { get; set; } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.Serialization.cs index 9b6403f48dcd..7dc529f2633b 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciClusterCertificateContent : IUtf8JsonSerializable + public partial class HciClusterCertificateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static HciClusterCertificateContent DeserializeHciClusterCertificateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = HciClusterRawCertificate.DeserializeHciClusterRawCertificate(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciClusterCertificateContent(properties.Value, serializedAdditionalRawData); + } + + HciClusterCertificateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterCertificateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterCertificateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterCertificateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterCertificateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterCertificateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterCertificateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.cs index aa1a8933f3ce..7c7944517a7c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterCertificateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models @@ -12,11 +13,23 @@ namespace Azure.ResourceManager.Hci.Models /// The HciClusterCertificateContent. public partial class HciClusterCertificateContent { - /// Initializes a new instance of HciClusterCertificateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciClusterCertificateContent() { } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal HciClusterCertificateContent(HciClusterRawCertificate properties, Dictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the properties. internal HciClusterRawCertificate Properties { get; set; } /// Gets the certificates. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterData.Serialization.cs index 8f8cf00131fb..3d61b1404af2 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class HciClusterData : IUtf8JsonSerializable + public partial class HciClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -62,12 +68,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SoftwareAssuranceProperties)) { writer.WritePropertyName("softwareAssuranceProperties"u8); - writer.WriteObjectValue(SoftwareAssuranceProperties); + if (SoftwareAssuranceProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SoftwareAssuranceProperties).Serialize(writer, options); + } } if (Optional.IsDefined(DesiredProperties)) { writer.WritePropertyName("desiredProperties"u8); - writer.WriteObjectValue(DesiredProperties); + if (DesiredProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DesiredProperties).Serialize(writer, options); + } } writer.WriteEndObject(); writer.WritePropertyName("identity"u8); @@ -89,11 +109,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciClusterData DeserializeHciClusterData(JsonElement element) + internal static HciClusterData DeserializeHciClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -126,6 +160,7 @@ internal static HciClusterData DeserializeHciClusterData(JsonElement element) Optional tenantId = default; Optional type0 = default; Optional> userAssignedIdentities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -382,8 +417,61 @@ internal static HciClusterData DeserializeHciClusterData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), Optional.ToNullable(status), Optional.ToNullable(cloudId), cloudManagementEndpoint.Value, Optional.ToNullable(aadClientId), Optional.ToNullable(aadTenantId), Optional.ToNullable(aadApplicationObjectId), Optional.ToNullable(aadServicePrincipalObjectId), softwareAssuranceProperties.Value, desiredProperties.Value, reportedProperties.Value, Optional.ToNullable(trialDaysRemaining), billingModel.Value, Optional.ToNullable(registrationTimestamp), Optional.ToNullable(lastSyncTimestamp), Optional.ToNullable(lastBillingTimestamp), serviceEndpoint.Value, resourceProviderObjectId.Value, Optional.ToNullable(principalId), Optional.ToNullable(tenantId), Optional.ToNullable(type0), Optional.ToDictionary(userAssignedIdentities), serializedAdditionalRawData); + } + + HciClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterData model) + { + if (model is null) + { + return null; } - return new HciClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), Optional.ToNullable(status), Optional.ToNullable(cloudId), cloudManagementEndpoint.Value, Optional.ToNullable(aadClientId), Optional.ToNullable(aadTenantId), Optional.ToNullable(aadApplicationObjectId), Optional.ToNullable(aadServicePrincipalObjectId), softwareAssuranceProperties.Value, desiredProperties.Value, reportedProperties.Value, Optional.ToNullable(trialDaysRemaining), billingModel.Value, Optional.ToNullable(registrationTimestamp), Optional.ToNullable(lastSyncTimestamp), Optional.ToNullable(lastBillingTimestamp), serviceEndpoint.Value, resourceProviderObjectId.Value, Optional.ToNullable(principalId), Optional.ToNullable(tenantId), Optional.ToNullable(type0), Optional.ToDictionary(userAssignedIdentities)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.Serialization.cs index 36ed7d9b48d1..d7dbad323056 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciClusterDesiredProperties : IUtf8JsonSerializable + public partial class HciClusterDesiredProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WindowsServerSubscription)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diagnosticLevel"u8); writer.WriteStringValue(DiagnosticLevel.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciClusterDesiredProperties DeserializeHciClusterDesiredProperties(JsonElement element) + internal static HciClusterDesiredProperties DeserializeHciClusterDesiredProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional windowsServerSubscription = default; Optional diagnosticLevel = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("windowsServerSubscription"u8)) @@ -56,8 +79,61 @@ internal static HciClusterDesiredProperties DeserializeHciClusterDesiredProperti diagnosticLevel = new HciClusterDiagnosticLevel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciClusterDesiredProperties(Optional.ToNullable(windowsServerSubscription), Optional.ToNullable(diagnosticLevel), serializedAdditionalRawData); + } + + HciClusterDesiredProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterDesiredProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterDesiredProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterDesiredProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterDesiredProperties model) + { + if (model is null) + { + return null; } - return new HciClusterDesiredProperties(Optional.ToNullable(windowsServerSubscription), Optional.ToNullable(diagnosticLevel)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterDesiredProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterDesiredProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.cs index 0c00484ca3c5..f077e574dd81 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterDesiredProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// Desired properties of the cluster. public partial class HciClusterDesiredProperties { - /// Initializes a new instance of HciClusterDesiredProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciClusterDesiredProperties() { } - /// Initializes a new instance of HciClusterDesiredProperties. + /// Initializes a new instance of . /// Desired state of Windows Server Subscription. /// Desired level of diagnostic data emitted by the cluster. - internal HciClusterDesiredProperties(WindowsServerSubscription? windowsServerSubscription, HciClusterDiagnosticLevel? diagnosticLevel) + /// Keeps track of any properties unknown to the library. + internal HciClusterDesiredProperties(WindowsServerSubscription? windowsServerSubscription, HciClusterDiagnosticLevel? diagnosticLevel, Dictionary serializedAdditionalRawData) { WindowsServerSubscription = windowsServerSubscription; DiagnosticLevel = diagnosticLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Desired state of Windows Server Subscription. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.Serialization.cs index 51a265cc976e..ed08cd4b508a 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.Serialization.cs @@ -6,15 +6,65 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciClusterIdentityResult + public partial class HciClusterIdentityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciClusterIdentityResult DeserializeHciClusterIdentityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AadClientId)) + { + writer.WritePropertyName("aadClientId"u8); + writer.WriteStringValue(AadClientId.Value); + } + if (Optional.IsDefined(AadTenantId)) + { + writer.WritePropertyName("aadTenantId"u8); + writer.WriteStringValue(AadTenantId.Value); + } + if (Optional.IsDefined(AadServicePrincipalObjectId)) + { + writer.WritePropertyName("aadServicePrincipalObjectId"u8); + writer.WriteStringValue(AadServicePrincipalObjectId.Value); + } + if (Optional.IsDefined(AadApplicationObjectId)) + { + writer.WritePropertyName("aadApplicationObjectId"u8); + writer.WriteStringValue(AadApplicationObjectId.Value); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciClusterIdentityResult DeserializeHciClusterIdentityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +73,7 @@ internal static HciClusterIdentityResult DeserializeHciClusterIdentityResult(Jso Optional aadTenantId = default; Optional aadServicePrincipalObjectId = default; Optional aadApplicationObjectId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -73,8 +124,61 @@ internal static HciClusterIdentityResult DeserializeHciClusterIdentityResult(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciClusterIdentityResult(Optional.ToNullable(aadClientId), Optional.ToNullable(aadTenantId), Optional.ToNullable(aadServicePrincipalObjectId), Optional.ToNullable(aadApplicationObjectId)); + return new HciClusterIdentityResult(Optional.ToNullable(aadClientId), Optional.ToNullable(aadTenantId), Optional.ToNullable(aadServicePrincipalObjectId), Optional.ToNullable(aadApplicationObjectId), serializedAdditionalRawData); + } + + HciClusterIdentityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterIdentityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterIdentityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterIdentityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterIdentityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterIdentityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterIdentityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.cs index 93ae8cc05301..6bb383bb9cf6 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterIdentityResult.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// Cluster Identity details. public partial class HciClusterIdentityResult { - /// Initializes a new instance of HciClusterIdentityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciClusterIdentityResult() { } - /// Initializes a new instance of HciClusterIdentityResult. + /// Initializes a new instance of . /// /// /// /// - internal HciClusterIdentityResult(Guid? aadClientId, Guid? aadTenantId, Guid? aadServicePrincipalObjectId, Guid? aadApplicationObjectId) + /// Keeps track of any properties unknown to the library. + internal HciClusterIdentityResult(Guid? aadClientId, Guid? aadTenantId, Guid? aadServicePrincipalObjectId, Guid? aadApplicationObjectId, Dictionary serializedAdditionalRawData) { AadClientId = aadClientId; AadTenantId = aadTenantId; AadServicePrincipalObjectId = aadServicePrincipalObjectId; AadApplicationObjectId = aadApplicationObjectId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the aad client id. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.Serialization.cs index 29e57f7a3870..2bdaa5fc5069 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class HciClusterListResult + internal partial class HciClusterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciClusterListResult DeserializeHciClusterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciClusterListResult DeserializeHciClusterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static HciClusterListResult DeserializeHciClusterListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciClusterListResult(Optional.ToList(value), nextLink.Value); + return new HciClusterListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HciClusterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.cs index 8e4524719a68..1cef7eda1bc9 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of clusters. internal partial class HciClusterListResult { - /// Initializes a new instance of HciClusterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciClusterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HciClusterListResult. + /// Initializes a new instance of . /// List of clusters. /// Link to the next set of results. - internal HciClusterListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HciClusterListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of clusters. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.Serialization.cs index b228d5cd1c52..36e49dc15512 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciClusterNode + public partial class HciClusterNode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciClusterNode DeserializeHciClusterNode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciClusterNode DeserializeHciClusterNode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +60,7 @@ internal static HciClusterNode DeserializeHciClusterNode(JsonElement element) Optional coreCount = default; Optional memoryInGiB = default; Optional lastLicensingTimestamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -129,8 +157,61 @@ internal static HciClusterNode DeserializeHciClusterNode(JsonElement element) lastLicensingTimestamp = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciClusterNode(name.Value, Optional.ToNullable(id), Optional.ToNullable(windowsServerSubscription), Optional.ToNullable(nodeType), ehcResourceId.Value, manufacturer.Value, model.Value, osName.Value, osVersion.Value, osDisplayVersion.Value, serialNumber.Value, Optional.ToNullable(coreCount), Optional.ToNullable(memoryInGiB), Optional.ToNullable(lastLicensingTimestamp)); + return new HciClusterNode(name.Value, Optional.ToNullable(id), Optional.ToNullable(windowsServerSubscription), Optional.ToNullable(nodeType), ehcResourceId.Value, manufacturer.Value, model.Value, osName.Value, osVersion.Value, osDisplayVersion.Value, serialNumber.Value, Optional.ToNullable(coreCount), Optional.ToNullable(memoryInGiB), Optional.ToNullable(lastLicensingTimestamp), serializedAdditionalRawData); + } + + HciClusterNode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterNode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterNode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterNode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterNode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterNode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterNode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.cs index ea0836062a96..afc1cc762fb8 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterNode.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// Cluster node details. public partial class HciClusterNode { - /// Initializes a new instance of HciClusterNode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciClusterNode() { } - /// Initializes a new instance of HciClusterNode. + /// Initializes a new instance of . /// Name of the cluster node. /// Id of the node in the cluster. /// State of Windows Server Subscription. @@ -32,7 +36,8 @@ internal HciClusterNode() /// Number of physical cores on the cluster node. /// Total available memory on the cluster node (in GiB). /// Most recent licensing timestamp. - internal HciClusterNode(string name, float? id, WindowsServerSubscription? windowsServerSubscription, ClusterNodeType? nodeType, string ehcResourceId, string manufacturer, string model, string osName, string osVersion, string osDisplayVersion, string serialNumber, float? coreCount, float? memoryInGiB, DateTimeOffset? lastLicensingTimestamp) + /// Keeps track of any properties unknown to the library. + internal HciClusterNode(string name, float? id, WindowsServerSubscription? windowsServerSubscription, ClusterNodeType? nodeType, string ehcResourceId, string manufacturer, string model, string osName, string osVersion, string osDisplayVersion, string serialNumber, float? coreCount, float? memoryInGiB, DateTimeOffset? lastLicensingTimestamp, Dictionary serializedAdditionalRawData) { Name = name; Id = id; @@ -48,6 +53,7 @@ internal HciClusterNode(string name, float? id, WindowsServerSubscription? windo CoreCount = coreCount; MemoryInGiB = memoryInGiB; LastLicensingTimestamp = lastLicensingTimestamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the cluster node. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.Serialization.cs index 5c8df4477c71..e419e8ffa193 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci.Models { - public partial class HciClusterPatch : IUtf8JsonSerializable + public partial class HciClusterPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -46,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DesiredProperties)) { writer.WritePropertyName("desiredProperties"u8); - writer.WriteObjectValue(DesiredProperties); + if (DesiredProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DesiredProperties).Serialize(writer, options); + } } writer.WriteEndObject(); writer.WritePropertyName("identity"u8); @@ -68,7 +84,207 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HciClusterPatch DeserializeHciClusterPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional cloudManagementEndpoint = default; + Optional aadClientId = default; + Optional aadTenantId = default; + Optional desiredProperties = default; + Optional principalId = default; + Optional tenantId = default; + Optional type = default; + Optional> userAssignedIdentities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("cloudManagementEndpoint"u8)) + { + cloudManagementEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("aadClientId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aadClientId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("aadTenantId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aadTenantId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("desiredProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desiredProperties = HciClusterDesiredProperties.DeserializeHciClusterDesiredProperties(property0.Value); + continue; + } + } + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("principalId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("tenantId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new HciManagedServiceIdentityType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("userAssignedIdentities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, JsonSerializer.Deserialize(property1.Value.GetRawText())); + } + userAssignedIdentities = dictionary; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciClusterPatch(Optional.ToDictionary(tags), cloudManagementEndpoint.Value, Optional.ToNullable(aadClientId), Optional.ToNullable(aadTenantId), desiredProperties.Value, Optional.ToNullable(principalId), Optional.ToNullable(tenantId), Optional.ToNullable(type), Optional.ToDictionary(userAssignedIdentities), serializedAdditionalRawData); + } + + HciClusterPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.cs index 64e6684a2c38..c13fa35e0f96 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterPatch.cs @@ -15,13 +15,41 @@ namespace Azure.ResourceManager.Hci.Models /// Cluster details to update. public partial class HciClusterPatch { - /// Initializes a new instance of HciClusterPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciClusterPatch() { Tags = new ChangeTrackingDictionary(); UserAssignedIdentities = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Endpoint configured for management from the Azure portal. + /// App id of cluster AAD identity. + /// Tenant id of cluster AAD identity. + /// Desired properties of the cluster. + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + /// The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + /// Keeps track of any properties unknown to the library. + internal HciClusterPatch(IDictionary tags, string cloudManagementEndpoint, Guid? aadClientId, Guid? aadTenantId, HciClusterDesiredProperties desiredProperties, Guid? principalId, Guid? tenantId, HciManagedServiceIdentityType? managedServiceIdentityType, IDictionary userAssignedIdentities, Dictionary serializedAdditionalRawData) + { + Tags = tags; + CloudManagementEndpoint = cloudManagementEndpoint; + AadClientId = aadClientId; + AadTenantId = aadTenantId; + DesiredProperties = desiredProperties; + PrincipalId = principalId; + TenantId = tenantId; + ManagedServiceIdentityType = managedServiceIdentityType; + UserAssignedIdentities = userAssignedIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// Endpoint configured for management from the Azure portal. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.Serialization.cs index d066654d2b56..47d5aff13532 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - internal partial class HciClusterRawCertificate : IUtf8JsonSerializable + internal partial class HciClusterRawCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Certificates)) { @@ -25,7 +33,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HciClusterRawCertificate DeserializeHciClusterRawCertificate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> certificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("certificates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + certificates = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciClusterRawCertificate(Optional.ToList(certificates), serializedAdditionalRawData); + } + + HciClusterRawCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterRawCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterRawCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterRawCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterRawCertificate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterRawCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterRawCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.cs index 7af3804a8788..6ca3d180b50e 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterRawCertificate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Hci.Models /// The HciClusterRawCertificate. internal partial class HciClusterRawCertificate { - /// Initializes a new instance of HciClusterRawCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciClusterRawCertificate() { Certificates = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal HciClusterRawCertificate(IList certificates, Dictionary serializedAdditionalRawData) + { + Certificates = certificates; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets the certificates. public IList Certificates { get; } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.Serialization.cs index 9694d4da3d5a..92de360f94f4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.Serialization.cs @@ -8,14 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciClusterReportedProperties + public partial class HciClusterReportedProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciClusterReportedProperties DeserializeHciClusterReportedProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DiagnosticLevel)) + { + writer.WritePropertyName("diagnosticLevel"u8); + writer.WriteStringValue(DiagnosticLevel.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciClusterReportedProperties DeserializeHciClusterReportedProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +59,7 @@ internal static HciClusterReportedProperties DeserializeHciClusterReportedProper Optional imdsAttestation = default; Optional diagnosticLevel = default; Optional> supportedCapabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clusterName"u8)) @@ -104,8 +136,61 @@ internal static HciClusterReportedProperties DeserializeHciClusterReportedProper supportedCapabilities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciClusterReportedProperties(clusterName.Value, Optional.ToNullable(clusterId), clusterVersion.Value, Optional.ToList(nodes), Optional.ToNullable(lastUpdated), Optional.ToNullable(imdsAttestation), Optional.ToNullable(diagnosticLevel), Optional.ToList(supportedCapabilities)); + return new HciClusterReportedProperties(clusterName.Value, Optional.ToNullable(clusterId), clusterVersion.Value, Optional.ToList(nodes), Optional.ToNullable(lastUpdated), Optional.ToNullable(imdsAttestation), Optional.ToNullable(diagnosticLevel), Optional.ToList(supportedCapabilities), serializedAdditionalRawData); + } + + HciClusterReportedProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciClusterReportedProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciClusterReportedProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciClusterReportedProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciClusterReportedProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciClusterReportedProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciClusterReportedProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.cs index bc6f6a3de60f..dc74b8c7d8ea 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciClusterReportedProperties.cs @@ -14,14 +14,17 @@ namespace Azure.ResourceManager.Hci.Models /// Properties reported by cluster agent. public partial class HciClusterReportedProperties { - /// Initializes a new instance of HciClusterReportedProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciClusterReportedProperties() { Nodes = new ChangeTrackingList(); SupportedCapabilities = new ChangeTrackingList(); } - /// Initializes a new instance of HciClusterReportedProperties. + /// Initializes a new instance of . /// Name of the on-prem cluster connected to this resource. /// Unique id generated by the on-prem cluster. /// Version of the cluster software. @@ -30,7 +33,8 @@ internal HciClusterReportedProperties() /// IMDS attestation status of the cluster. /// Level of diagnostic data emitted by the cluster. /// Capabilities supported by the cluster. - internal HciClusterReportedProperties(string clusterName, Guid? clusterId, string clusterVersion, IReadOnlyList nodes, DateTimeOffset? lastUpdatedOn, ImdsAttestationState? imdsAttestation, HciClusterDiagnosticLevel? diagnosticLevel, IReadOnlyList supportedCapabilities) + /// Keeps track of any properties unknown to the library. + internal HciClusterReportedProperties(string clusterName, Guid? clusterId, string clusterVersion, IReadOnlyList nodes, DateTimeOffset? lastUpdatedOn, ImdsAttestationState? imdsAttestation, HciClusterDiagnosticLevel? diagnosticLevel, IReadOnlyList supportedCapabilities, Dictionary serializedAdditionalRawData) { ClusterName = clusterName; ClusterId = clusterId; @@ -40,6 +44,7 @@ internal HciClusterReportedProperties(string clusterName, Guid? clusterId, strin ImdsAttestation = imdsAttestation; DiagnosticLevel = diagnosticLevel; SupportedCapabilities = supportedCapabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the on-prem cluster connected to this resource. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.Serialization.cs index dabed6fd9f32..c4fd3c4cb333 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.Serialization.cs @@ -5,15 +5,70 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciExtensionInstanceView + public partial class HciExtensionInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciExtensionInstanceView DeserializeHciExtensionInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ExtensionInstanceViewType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ExtensionInstanceViewType); + } + if (Optional.IsDefined(TypeHandlerVersion)) + { + writer.WritePropertyName("typeHandlerVersion"u8); + writer.WriteStringValue(TypeHandlerVersion); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + if (Status is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Status).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciExtensionInstanceView DeserializeHciExtensionInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +77,7 @@ internal static HciExtensionInstanceView DeserializeHciExtensionInstanceView(Jso Optional type = default; Optional typeHandlerVersion = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +104,61 @@ internal static HciExtensionInstanceView DeserializeHciExtensionInstanceView(Jso status = ExtensionInstanceViewStatus.DeserializeExtensionInstanceViewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, status.Value); + return new HciExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, status.Value, serializedAdditionalRawData); + } + + HciExtensionInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciExtensionInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciExtensionInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciExtensionInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciExtensionInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciExtensionInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciExtensionInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.cs index 11f6f6ab5ef5..0b2696955eb4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciExtensionInstanceView.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// Describes the Extension Instance View. public partial class HciExtensionInstanceView { - /// Initializes a new instance of HciExtensionInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciExtensionInstanceView() { } - /// Initializes a new instance of HciExtensionInstanceView. + /// Initializes a new instance of . /// The extension name. /// Specifies the type of the extension; an example is "MicrosoftMonitoringAgent". /// Specifies the version of the script handler. /// Instance view status. - internal HciExtensionInstanceView(string name, string extensionInstanceViewType, string typeHandlerVersion, ExtensionInstanceViewStatus status) + /// Keeps track of any properties unknown to the library. + internal HciExtensionInstanceView(string name, string extensionInstanceViewType, string typeHandlerVersion, ExtensionInstanceViewStatus status, Dictionary serializedAdditionalRawData) { Name = name; ExtensionInstanceViewType = extensionInstanceViewType; TypeHandlerVersion = typeHandlerVersion; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The extension name. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.Serialization.cs index 550b2b68f7b7..27054dcf7764 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class HciOfferList + internal partial class HciOfferList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciOfferList DeserializeHciOfferList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciOfferList DeserializeHciOfferList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static HciOfferList DeserializeHciOfferList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciOfferList(Optional.ToList(value), nextLink.Value); + return new HciOfferList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HciOfferList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciOfferList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciOfferList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciOfferList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciOfferList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciOfferList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciOfferList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.cs index ced1a4c9be84..b6ca087e7181 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciOfferList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of Offer proxy resources for the HCI cluster. internal partial class HciOfferList { - /// Initializes a new instance of HciOfferList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciOfferList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HciOfferList. + /// Initializes a new instance of . /// List of Offer proxy resources. /// Link to the next set of results. - internal HciOfferList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HciOfferList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Offer proxy resources. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.Serialization.cs index 818aaa6eb506..35cb16d1769c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciPackageVersionInfo : IUtf8JsonSerializable + public partial class HciPackageVersionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PackageType)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("lastUpdated"u8); writer.WriteStringValue(LastUpdated.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciPackageVersionInfo DeserializeHciPackageVersionInfo(JsonElement element) + internal static HciPackageVersionInfo DeserializeHciPackageVersionInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static HciPackageVersionInfo DeserializeHciPackageVersionInfo(JsonEleme Optional packageType = default; Optional version = default; Optional lastUpdated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("packageType"u8)) @@ -64,8 +86,61 @@ internal static HciPackageVersionInfo DeserializeHciPackageVersionInfo(JsonEleme lastUpdated = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciPackageVersionInfo(packageType.Value, version.Value, Optional.ToNullable(lastUpdated), serializedAdditionalRawData); + } + + HciPackageVersionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciPackageVersionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciPackageVersionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciPackageVersionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciPackageVersionInfo model) + { + if (model is null) + { + return null; } - return new HciPackageVersionInfo(packageType.Value, version.Value, Optional.ToNullable(lastUpdated)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciPackageVersionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciPackageVersionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.cs index 0c42a00fe659..cd16d7a67059 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPackageVersionInfo.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// Current version of each updatable component. public partial class HciPackageVersionInfo { - /// Initializes a new instance of HciPackageVersionInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciPackageVersionInfo() { } - /// Initializes a new instance of HciPackageVersionInfo. + /// Initializes a new instance of . /// Package type. /// Package version. /// Last time this component was updated. - internal HciPackageVersionInfo(string packageType, string version, DateTimeOffset? lastUpdated) + /// Keeps track of any properties unknown to the library. + internal HciPackageVersionInfo(string packageType, string version, DateTimeOffset? lastUpdated, Dictionary serializedAdditionalRawData) { PackageType = packageType; Version = version; LastUpdated = lastUpdated; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Package type. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.Serialization.cs index 53d773e88707..646bc168189d 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciPrecheckResult : IUtf8JsonSerializable + public partial class HciPrecheckResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Tags)) { writer.WritePropertyName("tags"u8); - writer.WriteObjectValue(Tags); + if (Tags is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tags).Serialize(writer, options); + } } if (Optional.IsDefined(Title)) { @@ -76,11 +90,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("healthCheckSource"u8); writer.WriteStringValue(HealthCheckSource); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciPrecheckResult DeserializeHciPrecheckResult(JsonElement element) + internal static HciPrecheckResult DeserializeHciPrecheckResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -97,6 +125,7 @@ internal static HciPrecheckResult DeserializeHciPrecheckResult(JsonElement eleme Optional timestamp = default; Optional additionalData = default; Optional healthCheckSource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -175,8 +204,61 @@ internal static HciPrecheckResult DeserializeHciPrecheckResult(JsonElement eleme healthCheckSource = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciPrecheckResult(name.Value, tags.Value, title.Value, Optional.ToNullable(status), Optional.ToNullable(severity), description.Value, remediation.Value, targetResourceId.Value, targetResourceName.Value, Optional.ToNullable(timestamp), additionalData.Value, healthCheckSource.Value, serializedAdditionalRawData); + } + + HciPrecheckResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciPrecheckResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciPrecheckResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciPrecheckResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciPrecheckResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciPrecheckResult(Response response) + { + if (response is null) + { + return null; } - return new HciPrecheckResult(name.Value, tags.Value, title.Value, Optional.ToNullable(status), Optional.ToNullable(severity), description.Value, remediation.Value, targetResourceId.Value, targetResourceName.Value, Optional.ToNullable(timestamp), additionalData.Value, healthCheckSource.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciPrecheckResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.cs index 9c125380bdc0..a7cd8b029330 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResult.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// The HciPrecheckResult. public partial class HciPrecheckResult { - /// Initializes a new instance of HciPrecheckResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciPrecheckResult() { } - /// Initializes a new instance of HciPrecheckResult. + /// Initializes a new instance of . /// Name of the individual test/rule/alert that was executed. Unique, not exposed to the customer. /// Key-value pairs that allow grouping/filtering individual tests. /// User-facing name; one or more sentences indicating the direct issue. @@ -30,7 +34,8 @@ public HciPrecheckResult() /// The Time in which the HealthCheck was called. /// Property bag of key value pairs for additional information. /// The name of the services called for the HealthCheck (I.E. Test-AzureStack, Test-Cluster). - internal HciPrecheckResult(string name, HciPrecheckResultTags tags, string title, HciClusterStatus? status, UpdateSeverity? severity, string description, string remediation, string targetResourceId, string targetResourceName, DateTimeOffset? timestamp, string additionalData, string healthCheckSource) + /// Keeps track of any properties unknown to the library. + internal HciPrecheckResult(string name, HciPrecheckResultTags tags, string title, HciClusterStatus? status, UpdateSeverity? severity, string description, string remediation, string targetResourceId, string targetResourceName, DateTimeOffset? timestamp, string additionalData, string healthCheckSource, Dictionary serializedAdditionalRawData) { Name = name; Tags = tags; @@ -44,6 +49,7 @@ internal HciPrecheckResult(string name, HciPrecheckResultTags tags, string title Timestamp = timestamp; AdditionalData = additionalData; HealthCheckSource = healthCheckSource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the individual test/rule/alert that was executed. Unique, not exposed to the customer. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.Serialization.cs index 4c8dc882515b..8d5ab5093928 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciPrecheckResultTags : IUtf8JsonSerializable + public partial class HciPrecheckResultTags : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Key)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciPrecheckResultTags DeserializeHciPrecheckResultTags(JsonElement element) + internal static HciPrecheckResultTags DeserializeHciPrecheckResultTags(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional key = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -48,8 +71,61 @@ internal static HciPrecheckResultTags DeserializeHciPrecheckResultTags(JsonEleme value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciPrecheckResultTags(key.Value, value.Value, serializedAdditionalRawData); + } + + HciPrecheckResultTags IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciPrecheckResultTags(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciPrecheckResultTags IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciPrecheckResultTags(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciPrecheckResultTags model) + { + if (model is null) + { + return null; } - return new HciPrecheckResultTags(key.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciPrecheckResultTags(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciPrecheckResultTags(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.cs index 7238eb1b6bbd..9dcd90ea057f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPrecheckResultTags.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// Key-value pairs that allow grouping/filtering individual tests. public partial class HciPrecheckResultTags { - /// Initializes a new instance of HciPrecheckResultTags. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciPrecheckResultTags() { } - /// Initializes a new instance of HciPrecheckResultTags. + /// Initializes a new instance of . /// Key that allow grouping/filtering individual tests. /// Value of the key that allow grouping/filtering individual tests. - internal HciPrecheckResultTags(string key, string value) + /// Keeps track of any properties unknown to the library. + internal HciPrecheckResultTags(string key, string value, Dictionary serializedAdditionalRawData) { Key = key; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key that allow grouping/filtering individual tests. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.Serialization.cs index 0d76104aea8f..51c6322ad021 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class HciPublisherList + internal partial class HciPublisherList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciPublisherList DeserializeHciPublisherList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciPublisherList DeserializeHciPublisherList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static HciPublisherList DeserializeHciPublisherList(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciPublisherList(Optional.ToList(value), nextLink.Value); + return new HciPublisherList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HciPublisherList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciPublisherList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciPublisherList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciPublisherList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciPublisherList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciPublisherList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciPublisherList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.cs index 2f33437ef74b..e1ebef3838eb 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciPublisherList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of Publisher proxy resources for the HCI cluster. internal partial class HciPublisherList { - /// Initializes a new instance of HciPublisherList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciPublisherList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HciPublisherList. + /// Initializes a new instance of . /// List of Publisher proxy resources. /// Link to the next set of results. - internal HciPublisherList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HciPublisherList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Publisher proxy resources. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuData.Serialization.cs index 2af73271bc67..0cda96a4ea21 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class HciSkuData : IUtf8JsonSerializable + public partial class HciSkuData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,16 +53,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SkuMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciSkuData DeserializeHciSkuData(JsonElement element) + internal static HciSkuData DeserializeHciSkuData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +98,7 @@ internal static HciSkuData DeserializeHciSkuData(JsonElement element) Optional content = default; Optional contentVersion = default; Optional> skuMappings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -147,8 +176,61 @@ internal static HciSkuData DeserializeHciSkuData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciSkuData(id, name, type, systemData.Value, provisioningState.Value, publisherId.Value, offerId.Value, content.Value, contentVersion.Value, Optional.ToList(skuMappings), serializedAdditionalRawData); + } + + HciSkuData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciSkuData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciSkuData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciSkuData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciSkuData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciSkuData(Response response) + { + if (response is null) + { + return null; } - return new HciSkuData(id, name, type, systemData.Value, provisioningState.Value, publisherId.Value, offerId.Value, content.Value, contentVersion.Value, Optional.ToList(skuMappings)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciSkuData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.Serialization.cs index ac16d584cd12..43084f974074 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class HciSkuList + internal partial class HciSkuList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciSkuList DeserializeHciSkuList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciSkuList DeserializeHciSkuList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static HciSkuList DeserializeHciSkuList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciSkuList(Optional.ToList(value), nextLink.Value); + return new HciSkuList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HciSkuList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciSkuList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciSkuList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciSkuList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciSkuList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciSkuList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciSkuList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.cs index fa73a06cd7bb..e68ebe89ac74 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of SKU proxy resources for the HCI cluster. internal partial class HciSkuList { - /// Initializes a new instance of HciSkuList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciSkuList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HciSkuList. + /// Initializes a new instance of . /// List of SKU proxy resources. /// Link to the next set of results. - internal HciSkuList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HciSkuList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of SKU proxy resources. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.Serialization.cs index c118e4bdf553..71aa5827033b 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciSkuMappings : IUtf8JsonSerializable + public partial class HciSkuMappings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CatalogPlanId)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciSkuMappings DeserializeHciSkuMappings(JsonElement element) + internal static HciSkuMappings DeserializeHciSkuMappings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static HciSkuMappings DeserializeHciSkuMappings(JsonElement element) Optional catalogPlanId = default; Optional marketplaceSkuId = default; Optional> marketplaceSkuVersions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("catalogPlanId"u8)) @@ -74,8 +96,61 @@ internal static HciSkuMappings DeserializeHciSkuMappings(JsonElement element) marketplaceSkuVersions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciSkuMappings(catalogPlanId.Value, marketplaceSkuId.Value, Optional.ToList(marketplaceSkuVersions), serializedAdditionalRawData); + } + + HciSkuMappings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciSkuMappings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciSkuMappings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciSkuMappings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciSkuMappings model) + { + if (model is null) + { + return null; } - return new HciSkuMappings(catalogPlanId.Value, marketplaceSkuId.Value, Optional.ToList(marketplaceSkuVersions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciSkuMappings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciSkuMappings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.cs index 10bccc3e4643..d6258a8aede2 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciSkuMappings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Hci.Models /// SKU Mapping details. public partial class HciSkuMappings { - /// Initializes a new instance of HciSkuMappings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciSkuMappings() { MarketplaceSkuVersions = new ChangeTrackingList(); } - /// Initializes a new instance of HciSkuMappings. + /// Initializes a new instance of . /// Identifier of the CatalogPlan for the sku. /// Identifier for the sku. /// Array of SKU versions available. - internal HciSkuMappings(string catalogPlanId, string marketplaceSkuId, IList marketplaceSkuVersions) + /// Keeps track of any properties unknown to the library. + internal HciSkuMappings(string catalogPlanId, string marketplaceSkuId, IList marketplaceSkuVersions, Dictionary serializedAdditionalRawData) { CatalogPlanId = catalogPlanId; MarketplaceSkuId = marketplaceSkuId; MarketplaceSkuVersions = marketplaceSkuVersions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifier of the CatalogPlan for the sku. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.Serialization.cs index 8e886a6f3799..f5e8b8622a5a 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class HciUpdateList + internal partial class HciUpdateList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HciUpdateList DeserializeHciUpdateList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HciUpdateList DeserializeHciUpdateList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static HciUpdateList DeserializeHciUpdateList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HciUpdateList(Optional.ToList(value), nextLink.Value); + return new HciUpdateList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HciUpdateList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciUpdateList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciUpdateList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciUpdateList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciUpdateList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciUpdateList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciUpdateList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.cs index 95bdda4045a8..3604890e3af0 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of Updates. internal partial class HciUpdateList { - /// Initializes a new instance of HciUpdateList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HciUpdateList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HciUpdateList. + /// Initializes a new instance of . /// List of Updates. /// Link to the next set of results. - internal HciUpdateList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HciUpdateList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Updates. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.Serialization.cs index a01b388ba066..d2e7f787238e 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class HciUpdateStep : IUtf8JsonSerializable + public partial class HciUpdateStep : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -58,15 +64,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Steps) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HciUpdateStep DeserializeHciUpdateStep(JsonElement element) + internal static HciUpdateStep DeserializeHciUpdateStep(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +106,7 @@ internal static HciUpdateStep DeserializeHciUpdateStep(JsonElement element) Optional endTimeUtc = default; Optional lastUpdatedTimeUtc = default; Optional> steps = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -142,8 +170,61 @@ internal static HciUpdateStep DeserializeHciUpdateStep(JsonElement element) steps = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HciUpdateStep(name.Value, description.Value, errorMessage.Value, status.Value, Optional.ToNullable(startTimeUtc), Optional.ToNullable(endTimeUtc), Optional.ToNullable(lastUpdatedTimeUtc), Optional.ToList(steps), serializedAdditionalRawData); + } + + HciUpdateStep IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHciUpdateStep(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HciUpdateStep IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHciUpdateStep(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HciUpdateStep model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HciUpdateStep(Response response) + { + if (response is null) + { + return null; } - return new HciUpdateStep(name.Value, description.Value, errorMessage.Value, status.Value, Optional.ToNullable(startTimeUtc), Optional.ToNullable(endTimeUtc), Optional.ToNullable(lastUpdatedTimeUtc), Optional.ToList(steps)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHciUpdateStep(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.cs index e70c286690b0..0d2534282222 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/HciUpdateStep.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Hci.Models /// Progress representation of the update run steps. public partial class HciUpdateStep { - /// Initializes a new instance of HciUpdateStep. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HciUpdateStep() { Steps = new ChangeTrackingList(); } - /// Initializes a new instance of HciUpdateStep. + /// Initializes a new instance of . /// Name of the step. /// More detailed description of the step. /// Error message, specified if the step is in a failed state. @@ -29,7 +32,8 @@ public HciUpdateStep() /// When the step reached a terminal state. /// Completion time of this step or the last completed sub-step. /// Recursive model for child steps of this step. - internal HciUpdateStep(string name, string description, string errorMessage, string status, DateTimeOffset? startTimeUtc, DateTimeOffset? endTimeUtc, DateTimeOffset? lastUpdatedTimeUtc, IList steps) + /// Keeps track of any properties unknown to the library. + internal HciUpdateStep(string name, string description, string errorMessage, string status, DateTimeOffset? startTimeUtc, DateTimeOffset? endTimeUtc, DateTimeOffset? lastUpdatedTimeUtc, IList steps, Dictionary serializedAdditionalRawData) { Name = name; Description = description; @@ -39,6 +43,7 @@ internal HciUpdateStep(string name, string description, string errorMessage, str EndTimeUtc = endTimeUtc; LastUpdatedTimeUtc = lastUpdatedTimeUtc; Steps = steps; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the step. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/OfferData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/OfferData.Serialization.cs index 8c25b4b6b0fc..aa5452aec55b 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/OfferData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/OfferData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class OfferData : IUtf8JsonSerializable + public partial class OfferData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -41,16 +48,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SkuMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OfferData DeserializeOfferData(JsonElement element) + internal static OfferData DeserializeOfferData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +92,7 @@ internal static OfferData DeserializeOfferData(JsonElement element) Optional content = default; Optional contentVersion = default; Optional> skuMappings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -136,8 +165,61 @@ internal static OfferData DeserializeOfferData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OfferData(id, name, type, systemData.Value, provisioningState.Value, publisherId.Value, content.Value, contentVersion.Value, Optional.ToList(skuMappings), serializedAdditionalRawData); + } + + OfferData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOfferData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OfferData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOfferData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OfferData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OfferData(Response response) + { + if (response is null) + { + return null; } - return new OfferData(id, name, type, systemData.Value, provisioningState.Value, publisherId.Value, content.Value, contentVersion.Value, Optional.ToList(skuMappings)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOfferData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.Serialization.cs index 48116d03a989..ad3b62f995bf 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class PerNodeArcState + public partial class PerNodeArcState : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PerNodeArcState DeserializePerNodeArcState(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PerNodeArcState DeserializePerNodeArcState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static PerNodeArcState DeserializePerNodeArcState(JsonElement element) Optional name = default; Optional arcInstance = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +71,61 @@ internal static PerNodeArcState DeserializePerNodeArcState(JsonElement element) state = new NodeArcState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PerNodeArcState(name.Value, arcInstance.Value, Optional.ToNullable(state)); + return new PerNodeArcState(name.Value, arcInstance.Value, Optional.ToNullable(state), serializedAdditionalRawData); + } + + PerNodeArcState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePerNodeArcState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PerNodeArcState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePerNodeArcState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PerNodeArcState model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PerNodeArcState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePerNodeArcState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.cs index 77750c40218d..cfbccd61e6c0 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeArcState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// Status of Arc agent for a particular node in HCI Cluster. public partial class PerNodeArcState { - /// Initializes a new instance of PerNodeArcState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PerNodeArcState() { } - /// Initializes a new instance of PerNodeArcState. + /// Initializes a new instance of . /// Name of the Node in HCI Cluster. /// Fully qualified resource ID for the Arc agent of this node. /// State of Arc agent in this node. - internal PerNodeArcState(string name, string arcInstance, NodeArcState? state) + /// Keeps track of any properties unknown to the library. + internal PerNodeArcState(string name, string arcInstance, NodeArcState? state, Dictionary serializedAdditionalRawData) { Name = name; ArcInstance = arcInstance; State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Node in HCI Cluster. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.Serialization.cs index 2bc77251f3d6..1c9b96240e7f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class PerNodeExtensionState + public partial class PerNodeExtensionState : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PerNodeExtensionState DeserializePerNodeExtensionState(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PerNodeExtensionState DeserializePerNodeExtensionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static PerNodeExtensionState DeserializePerNodeExtensionState(JsonEleme Optional typeHandlerVersion = default; Optional state = default; Optional instanceView = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -58,8 +87,61 @@ internal static PerNodeExtensionState DeserializePerNodeExtensionState(JsonEleme instanceView = HciExtensionInstanceView.DeserializeHciExtensionInstanceView(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PerNodeExtensionState(name.Value, extension.Value, typeHandlerVersion.Value, Optional.ToNullable(state), instanceView.Value); + return new PerNodeExtensionState(name.Value, extension.Value, typeHandlerVersion.Value, Optional.ToNullable(state), instanceView.Value, serializedAdditionalRawData); + } + + PerNodeExtensionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePerNodeExtensionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PerNodeExtensionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePerNodeExtensionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PerNodeExtensionState model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PerNodeExtensionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePerNodeExtensionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.cs index baadb8b47566..7519ddc42316 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PerNodeExtensionState.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// Status of Arc Extension for a particular node in HCI Cluster. public partial class PerNodeExtensionState { - /// Initializes a new instance of PerNodeExtensionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PerNodeExtensionState() { } - /// Initializes a new instance of PerNodeExtensionState. + /// Initializes a new instance of . /// Name of the node in HCI Cluster. /// Fully qualified resource ID for the particular Arc Extension on this node. /// Specifies the version of the script handler. /// State of Arc Extension in this node. /// The extension instance view. - internal PerNodeExtensionState(string name, string extension, string typeHandlerVersion, NodeExtensionState? state, HciExtensionInstanceView instanceView) + /// Keeps track of any properties unknown to the library. + internal PerNodeExtensionState(string name, string extension, string typeHandlerVersion, NodeExtensionState? state, HciExtensionInstanceView instanceView, Dictionary serializedAdditionalRawData) { Name = name; Extension = extension; TypeHandlerVersion = typeHandlerVersion; State = state; InstanceView = instanceView; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the node in HCI Cluster. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PublisherData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PublisherData.Serialization.cs index 10097d487a04..d05d3dcbe2b3 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PublisherData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/PublisherData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class PublisherData : IUtf8JsonSerializable + public partial class PublisherData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PublisherData DeserializePublisherData(JsonElement element) + internal static PublisherData DeserializePublisherData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static PublisherData DeserializePublisherData(JsonElement element) ResourceType type = default; Optional systemData = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -76,8 +99,61 @@ internal static PublisherData DeserializePublisherData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PublisherData(id, name, type, systemData.Value, provisioningState.Value, serializedAdditionalRawData); + } + + PublisherData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePublisherData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PublisherData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePublisherData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PublisherData model) + { + if (model is null) + { + return null; } - return new PublisherData(id, name, type, systemData.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PublisherData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePublisherData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.Serialization.cs index a8508eae8387..c0a7187258d4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class SoftwareAssuranceChangeContent : IUtf8JsonSerializable + public partial class SoftwareAssuranceChangeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static SoftwareAssuranceChangeContent DeserializeSoftwareAssuranceChangeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SoftwareAssuranceChangeRequestProperties.DeserializeSoftwareAssuranceChangeRequestProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareAssuranceChangeContent(properties.Value, serializedAdditionalRawData); + } + + SoftwareAssuranceChangeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareAssuranceChangeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareAssuranceChangeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareAssuranceChangeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareAssuranceChangeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareAssuranceChangeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareAssuranceChangeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.cs index 444cb52b05f8..496ece829232 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// The SoftwareAssuranceChangeContent. public partial class SoftwareAssuranceChangeContent { - /// Initializes a new instance of SoftwareAssuranceChangeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareAssuranceChangeContent() { } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal SoftwareAssuranceChangeContent(SoftwareAssuranceChangeRequestProperties properties, Dictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the properties. internal SoftwareAssuranceChangeRequestProperties Properties { get; set; } /// Customer Intent for Software Assurance Benefit. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.Serialization.cs index 1ff941f4f67c..2cc63d2066a8 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - internal partial class SoftwareAssuranceChangeRequestProperties : IUtf8JsonSerializable + internal partial class SoftwareAssuranceChangeRequestProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SoftwareAssuranceIntent)) { writer.WritePropertyName("softwareAssuranceIntent"u8); writer.WriteStringValue(SoftwareAssuranceIntent.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SoftwareAssuranceChangeRequestProperties DeserializeSoftwareAssuranceChangeRequestProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional softwareAssuranceIntent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("softwareAssuranceIntent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + softwareAssuranceIntent = new SoftwareAssuranceIntent(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareAssuranceChangeRequestProperties(Optional.ToNullable(softwareAssuranceIntent), serializedAdditionalRawData); + } + + SoftwareAssuranceChangeRequestProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareAssuranceChangeRequestProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareAssuranceChangeRequestProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareAssuranceChangeRequestProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareAssuranceChangeRequestProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareAssuranceChangeRequestProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareAssuranceChangeRequestProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.cs index d10fdc4017bf..9999907d0fa5 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceChangeRequestProperties.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// The SoftwareAssuranceChangeRequestProperties. internal partial class SoftwareAssuranceChangeRequestProperties { - /// Initializes a new instance of SoftwareAssuranceChangeRequestProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareAssuranceChangeRequestProperties() { } + /// Initializes a new instance of . + /// Customer Intent for Software Assurance Benefit. + /// Keeps track of any properties unknown to the library. + internal SoftwareAssuranceChangeRequestProperties(SoftwareAssuranceIntent? softwareAssuranceIntent, Dictionary serializedAdditionalRawData) + { + SoftwareAssuranceIntent = softwareAssuranceIntent; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Customer Intent for Software Assurance Benefit. public SoftwareAssuranceIntent? SoftwareAssuranceIntent { get; set; } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.Serialization.cs index fa78f3c568eb..0261600213bd 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class SoftwareAssuranceProperties : IUtf8JsonSerializable + public partial class SoftwareAssuranceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SoftwareAssuranceStatus)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("softwareAssuranceIntent"u8); writer.WriteStringValue(SoftwareAssuranceIntent.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SoftwareAssuranceProperties DeserializeSoftwareAssuranceProperties(JsonElement element) + internal static SoftwareAssuranceProperties DeserializeSoftwareAssuranceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +59,7 @@ internal static SoftwareAssuranceProperties DeserializeSoftwareAssuranceProperti Optional softwareAssuranceStatus = default; Optional softwareAssuranceIntent = default; Optional lastUpdated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("softwareAssuranceStatus"u8)) @@ -67,8 +89,61 @@ internal static SoftwareAssuranceProperties DeserializeSoftwareAssuranceProperti lastUpdated = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftwareAssuranceProperties(Optional.ToNullable(softwareAssuranceStatus), Optional.ToNullable(softwareAssuranceIntent), Optional.ToNullable(lastUpdated), serializedAdditionalRawData); + } + + SoftwareAssuranceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftwareAssuranceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftwareAssuranceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftwareAssuranceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftwareAssuranceProperties model) + { + if (model is null) + { + return null; } - return new SoftwareAssuranceProperties(Optional.ToNullable(softwareAssuranceStatus), Optional.ToNullable(softwareAssuranceIntent), Optional.ToNullable(lastUpdated)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftwareAssuranceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftwareAssuranceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.cs index c33d4250857e..e2aa45bc84ca 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/SoftwareAssuranceProperties.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Hci.Models { /// Software Assurance properties of the cluster. public partial class SoftwareAssuranceProperties { - /// Initializes a new instance of SoftwareAssuranceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftwareAssuranceProperties() { } - /// Initializes a new instance of SoftwareAssuranceProperties. + /// Initializes a new instance of . /// Status of the Software Assurance for the cluster. /// Customer Intent for Software Assurance Benefit. /// TimeStamp denoting the latest SA benefit applicability is validated. - internal SoftwareAssuranceProperties(SoftwareAssuranceStatus? softwareAssuranceStatus, SoftwareAssuranceIntent? softwareAssuranceIntent, DateTimeOffset? lastUpdated) + /// Keeps track of any properties unknown to the library. + internal SoftwareAssuranceProperties(SoftwareAssuranceStatus? softwareAssuranceStatus, SoftwareAssuranceIntent? softwareAssuranceIntent, DateTimeOffset? lastUpdated, Dictionary serializedAdditionalRawData) { SoftwareAssuranceStatus = softwareAssuranceStatus; SoftwareAssuranceIntent = softwareAssuranceIntent; LastUpdated = lastUpdated; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of the Software Assurance for the cluster. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateData.Serialization.cs index 5f54848c7bad..a63f0626700b 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class UpdateData : IUtf8JsonSerializable + public partial class UpdateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -47,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Prerequisites) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -57,7 +70,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ComponentVersions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -77,7 +97,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HealthCheckResult) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -145,11 +172,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UpdateData DeserializeUpdateData(JsonElement element) + internal static UpdateData DeserializeUpdateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -180,6 +221,7 @@ internal static UpdateData DeserializeUpdateData(JsonElement element) Optional additionalProperties = default; Optional progressPercentage = default; Optional notifyMessage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -407,8 +449,61 @@ internal static UpdateData DeserializeUpdateData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToNullable(provisioningState), Optional.ToNullable(installedDate), description.Value, Optional.ToNullable(state), Optional.ToList(prerequisites), Optional.ToList(componentVersions), Optional.ToNullable(rebootRequired), Optional.ToNullable(healthState), Optional.ToList(healthCheckResult), Optional.ToNullable(healthCheckDate), packagePath.Value, Optional.ToNullable(packageSizeInMb), displayName.Value, version.Value, publisher.Value, releaseLink.Value, Optional.ToNullable(availabilityType), packageType.Value, additionalProperties.Value, Optional.ToNullable(progressPercentage), notifyMessage.Value, serializedAdditionalRawData); + } + + UpdateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateData(Response response) + { + if (response is null) + { + return null; } - return new UpdateData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToNullable(provisioningState), Optional.ToNullable(installedDate), description.Value, Optional.ToNullable(state), Optional.ToList(prerequisites), Optional.ToList(componentVersions), Optional.ToNullable(rebootRequired), Optional.ToNullable(healthState), Optional.ToList(healthCheckResult), Optional.ToNullable(healthCheckDate), packagePath.Value, Optional.ToNullable(packageSizeInMb), displayName.Value, version.Value, publisher.Value, releaseLink.Value, Optional.ToNullable(availabilityType), packageType.Value, additionalProperties.Value, Optional.ToNullable(progressPercentage), notifyMessage.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.Serialization.cs index 71a8a10acea7..424ecd1817c0 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Hci.Models { - public partial class UpdatePrerequisite : IUtf8JsonSerializable + public partial class UpdatePrerequisite : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UpdateType)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("packageName"u8); writer.WriteStringValue(PackageName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UpdatePrerequisite DeserializeUpdatePrerequisite(JsonElement element) + internal static UpdatePrerequisite DeserializeUpdatePrerequisite(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static UpdatePrerequisite DeserializeUpdatePrerequisite(JsonElement ele Optional updateType = default; Optional version = default; Optional packageName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("updateType"u8)) @@ -59,8 +82,61 @@ internal static UpdatePrerequisite DeserializeUpdatePrerequisite(JsonElement ele packageName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdatePrerequisite(updateType.Value, version.Value, packageName.Value, serializedAdditionalRawData); + } + + UpdatePrerequisite IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdatePrerequisite(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdatePrerequisite IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdatePrerequisite(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdatePrerequisite model) + { + if (model is null) + { + return null; } - return new UpdatePrerequisite(updateType.Value, version.Value, packageName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdatePrerequisite(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdatePrerequisite(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.cs index 0b5d5cb12251..2f2c34ad32bb 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdatePrerequisite.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Hci.Models { /// If update State is HasPrerequisite, this property contains an array of objects describing prerequisite updates before installing this update. Otherwise, it is empty. public partial class UpdatePrerequisite { - /// Initializes a new instance of UpdatePrerequisite. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdatePrerequisite() { } - /// Initializes a new instance of UpdatePrerequisite. + /// Initializes a new instance of . /// Updatable component type. /// Version of the prerequisite. /// Friendly name of the prerequisite. - internal UpdatePrerequisite(string updateType, string version, string packageName) + /// Keeps track of any properties unknown to the library. + internal UpdatePrerequisite(string updateType, string version, string packageName, Dictionary serializedAdditionalRawData) { UpdateType = updateType; Version = version; PackageName = packageName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Updatable component type. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunData.Serialization.cs index 4f45249d2fdc..0f8ce55ce9b7 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class UpdateRunData : IUtf8JsonSerializable + public partial class UpdateRunData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -89,17 +95,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Steps) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UpdateRunData DeserializeUpdateRunData(JsonElement element) + internal static UpdateRunData DeserializeUpdateRunData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -122,6 +149,7 @@ internal static UpdateRunData DeserializeUpdateRunData(JsonElement element) Optional endTimeUtc = default; Optional lastUpdatedTimeUtc = default; Optional> steps = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -283,8 +311,61 @@ internal static UpdateRunData DeserializeUpdateRunData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateRunData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToNullable(provisioningState), Optional.ToNullable(timeStarted), Optional.ToNullable(lastUpdatedTime), duration.Value, Optional.ToNullable(state), name0.Value, description.Value, errorMessage.Value, status.Value, Optional.ToNullable(startTimeUtc), Optional.ToNullable(endTimeUtc), Optional.ToNullable(lastUpdatedTimeUtc), Optional.ToList(steps), serializedAdditionalRawData); + } + + UpdateRunData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateRunData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateRunData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateRunData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateRunData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateRunData(Response response) + { + if (response is null) + { + return null; } - return new UpdateRunData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToNullable(provisioningState), Optional.ToNullable(timeStarted), Optional.ToNullable(lastUpdatedTime), duration.Value, Optional.ToNullable(state), name0.Value, description.Value, errorMessage.Value, status.Value, Optional.ToNullable(startTimeUtc), Optional.ToNullable(endTimeUtc), Optional.ToNullable(lastUpdatedTimeUtc), Optional.ToList(steps)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateRunData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.Serialization.cs index 3227b457a999..a135de7d1837 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class UpdateRunList + internal partial class UpdateRunList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpdateRunList DeserializeUpdateRunList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpdateRunList DeserializeUpdateRunList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static UpdateRunList DeserializeUpdateRunList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpdateRunList(Optional.ToList(value), nextLink.Value); + return new UpdateRunList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + UpdateRunList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateRunList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateRunList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateRunList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateRunList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateRunList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateRunList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.cs index e8253dd005e1..3a4e34c2b2dc 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateRunList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of Update runs. internal partial class UpdateRunList { - /// Initializes a new instance of UpdateRunList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpdateRunList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UpdateRunList. + /// Initializes a new instance of . /// List of Update runs. /// Link to the next set of results. - internal UpdateRunList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UpdateRunList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Update runs. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.Serialization.cs index 01b44f6af01d..830d3b66f89f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci; namespace Azure.ResourceManager.Hci.Models { - internal partial class UpdateSummariesList + internal partial class UpdateSummariesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpdateSummariesList DeserializeUpdateSummariesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpdateSummariesList DeserializeUpdateSummariesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static UpdateSummariesList DeserializeUpdateSummariesList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpdateSummariesList(Optional.ToList(value), nextLink.Value); + return new UpdateSummariesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + UpdateSummariesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateSummariesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateSummariesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateSummariesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateSummariesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateSummariesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateSummariesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.cs index 171f9e615b90..6d2677a3b5d5 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummariesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Hci.Models /// List of Update Summaries. internal partial class UpdateSummariesList { - /// Initializes a new instance of UpdateSummariesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpdateSummariesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UpdateSummariesList. + /// Initializes a new instance of . /// List of Update Summaries. /// Link to the next set of results. - internal UpdateSummariesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UpdateSummariesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Update Summaries. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummaryData.Serialization.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummaryData.Serialization.cs index 63140a44aac7..c2f65c5272e4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummaryData.Serialization.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Models/UpdateSummaryData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Hci.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Hci { - public partial class UpdateSummaryData : IUtf8JsonSerializable + public partial class UpdateSummaryData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -42,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PackageVersions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -72,7 +85,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HealthCheckResult) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,11 +107,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(State.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UpdateSummaryData DeserializeUpdateSummaryData(JsonElement element) + internal static UpdateSummaryData DeserializeUpdateSummaryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -112,6 +146,7 @@ internal static UpdateSummaryData DeserializeUpdateSummaryData(JsonElement eleme Optional> healthCheckResult = default; Optional healthCheckDate = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -256,8 +291,61 @@ internal static UpdateSummaryData DeserializeUpdateSummaryData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateSummaryData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToNullable(provisioningState), oemFamily.Value, hardwareModel.Value, Optional.ToList(packageVersions), currentVersion.Value, Optional.ToNullable(lastUpdated), Optional.ToNullable(lastChecked), Optional.ToNullable(healthState), Optional.ToList(healthCheckResult), Optional.ToNullable(healthCheckDate), Optional.ToNullable(state), serializedAdditionalRawData); + } + + UpdateSummaryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateSummaryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateSummaryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateSummaryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateSummaryData model) + { + if (model is null) + { + return null; } - return new UpdateSummaryData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToNullable(provisioningState), oemFamily.Value, hardwareModel.Value, Optional.ToList(packageVersions), currentVersion.Value, Optional.ToNullable(lastUpdated), Optional.ToNullable(lastChecked), Optional.ToNullable(healthState), Optional.ToList(healthCheckResult), Optional.ToNullable(healthCheckDate), Optional.ToNullable(state)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateSummaryData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateSummaryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs index a109fa47a654..f1de0ea7c61d 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferCollection.cs @@ -149,7 +149,7 @@ public virtual AsyncPageable GetAllAsync(string expand = null, Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _offerRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _offerRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "OfferCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "OfferCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -172,7 +172,7 @@ public virtual Pageable GetAll(string expand = null, Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _offerRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _offerRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "OfferCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new OfferResource(Client, OfferData.DeserializeOfferData(e)), _offerClientDiagnostics, Pipeline, "OfferCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferData.cs index 6fd18392bb36..eb83ba3455b9 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Hci.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Hci /// public partial class OfferData : ResourceData { - /// Initializes a new instance of OfferData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OfferData() { SkuMappings = new ChangeTrackingList(); } - /// Initializes a new instance of OfferData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,13 +38,15 @@ public OfferData() /// JSON serialized catalog content of the offer. /// The API version of the catalog service used to serve the catalog content. /// Array of SKU mappings. - internal OfferData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, string publisherId, string content, string contentVersion, IList skuMappings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal OfferData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, string publisherId, string content, string contentVersion, IList skuMappings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PublisherId = publisherId; Content = content; ContentVersion = contentVersion; SkuMappings = skuMappings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning State. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs index 118820095902..73c357d8a1b1 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _publisherRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publisherRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _publisherRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publisherRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherData.cs index bf74ab53623e..71f1d38f8308 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,20 +18,25 @@ namespace Azure.ResourceManager.Hci /// public partial class PublisherData : ResourceData { - /// Initializes a new instance of PublisherData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PublisherData() { } - /// Initializes a new instance of PublisherData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Provisioning State. - internal PublisherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PublisherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning State. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ArcSettingsRestOperations.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ArcSettingsRestOperations.cs index 0dceb7b33208..ba55012b41c0 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ArcSettingsRestOperations.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ArcSettingsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -315,9 +313,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ClustersRestOperations.cs index 8b8fea5d2a5b..f6e0e403bf6e 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ClustersRestOperations.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ClustersRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -362,9 +360,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -521,9 +517,7 @@ internal HttpMessage CreateUploadCertificateRequest(string subscriptionId, strin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -669,9 +663,7 @@ internal HttpMessage CreateExtendSoftwareAssuranceBenefitRequest(string subscrip request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ExtensionsRestOperations.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ExtensionsRestOperations.cs index 9f938d7cca51..6fee77a39b9f 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ExtensionsRestOperations.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/ExtensionsRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -327,9 +325,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -502,9 +498,7 @@ internal HttpMessage CreateUpgradeRequest(string subscriptionId, string resource request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateRunsRestOperations.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateRunsRestOperations.cs index 593c123121be..a8b16106d059 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateRunsRestOperations.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateRunsRestOperations.cs @@ -227,9 +227,7 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateSummariesRestOperations.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateSummariesRestOperations.cs index 02bca0e68904..a02807d3e6e0 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateSummariesRestOperations.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdateSummariesRestOperations.cs @@ -207,9 +207,7 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdatesRestOperations.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdatesRestOperations.cs index 72dbfc5630ef..094971a9b851 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdatesRestOperations.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/RestOperations/UpdatesRestOperations.cs @@ -290,9 +290,7 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs index 1e46c7c1a522..c73fd65e997c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _updateRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _updateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UpdateResource(Client, UpdateData.DeserializeUpdateData(e)), _updateClientDiagnostics, Pipeline, "UpdateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new UpdateResource(Client, UpdateData.DeserializeUpdateData(e)), _updateClientDiagnostics, Pipeline, "UpdateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _updateRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _updateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UpdateResource(Client, UpdateData.DeserializeUpdateData(e)), _updateClientDiagnostics, Pipeline, "UpdateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new UpdateResource(Client, UpdateData.DeserializeUpdateData(e)), _updateClientDiagnostics, Pipeline, "UpdateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateData.cs index 8418e8e6d5f0..0db57aca4f30 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Hci /// public partial class UpdateData : ResourceData { - /// Initializes a new instance of UpdateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateData() { Prerequisites = new ChangeTrackingList(); @@ -27,7 +30,7 @@ public UpdateData() HealthCheckResult = new ChangeTrackingList(); } - /// Initializes a new instance of UpdateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -54,7 +57,8 @@ public UpdateData() /// Extensible KV pairs serialized as a string. This is currently used to report the stamp OEM family and hardware model information when an update is flagged as Invalid for the stamp based on OEM type. /// Progress percentage of ongoing operation. Currently this property is only valid when the update is in the Downloading state, where it maps to how much of the update content has been downloaded. /// Brief message with instructions for updates of AvailabilityType Notify. - internal UpdateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, HciProvisioningState? provisioningState, DateTimeOffset? installedOn, string description, HciUpdateState? state, IList prerequisites, IList componentVersions, HciNodeRebootRequirement? rebootRequired, HciHealthState? healthState, IList healthCheckResult, DateTimeOffset? healthCheckOn, string packagePath, float? packageSizeInMb, string displayName, string version, string publisher, string releaseLink, HciAvailabilityType? availabilityType, string packageType, string additionalProperties, float? progressPercentage, string notifyMessage) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal UpdateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, HciProvisioningState? provisioningState, DateTimeOffset? installedOn, string description, HciUpdateState? state, IList prerequisites, IList componentVersions, HciNodeRebootRequirement? rebootRequired, HciHealthState? healthState, IList healthCheckResult, DateTimeOffset? healthCheckOn, string packagePath, float? packageSizeInMb, string displayName, string version, string publisher, string releaseLink, HciAvailabilityType? availabilityType, string packageType, string additionalProperties, float? progressPercentage, string notifyMessage, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; ProvisioningState = provisioningState; @@ -78,6 +82,7 @@ internal UpdateData(ResourceIdentifier id, string name, ResourceType resourceTyp AdditionalProperties = additionalProperties; ProgressPercentage = progressPercentage; NotifyMessage = notifyMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The geo-location where the resource lives. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs index efaf937bf49e..6c99499a297a 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _updateRunRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _updateRunRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UpdateRunResource(Client, UpdateRunData.DeserializeUpdateRunData(e)), _updateRunClientDiagnostics, Pipeline, "UpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new UpdateRunResource(Client, UpdateRunData.DeserializeUpdateRunData(e)), _updateRunClientDiagnostics, Pipeline, "UpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _updateRunRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _updateRunRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UpdateRunResource(Client, UpdateRunData.DeserializeUpdateRunData(e)), _updateRunClientDiagnostics, Pipeline, "UpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new UpdateRunResource(Client, UpdateRunData.DeserializeUpdateRunData(e)), _updateRunClientDiagnostics, Pipeline, "UpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunData.cs index c4d221004698..b8a22dbc31fa 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Hci /// public partial class UpdateRunData : ResourceData { - /// Initializes a new instance of UpdateRunData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateRunData() { Steps = new ChangeTrackingList(); } - /// Initializes a new instance of UpdateRunData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +47,8 @@ public UpdateRunData() /// When the step reached a terminal state. /// Completion time of this step or the last completed sub-step. /// Recursive model for child steps of this step. - internal UpdateRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, HciProvisioningState? provisioningState, DateTimeOffset? timeStarted, DateTimeOffset? lastUpdatedOn, string duration, UpdateRunPropertiesState? state, string namePropertiesProgressName, string description, string errorMessage, string status, DateTimeOffset? startTimeUtc, DateTimeOffset? endTimeUtc, DateTimeOffset? lastUpdatedTimeUtc, IList steps) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal UpdateRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, HciProvisioningState? provisioningState, DateTimeOffset? timeStarted, DateTimeOffset? lastUpdatedOn, string duration, UpdateRunPropertiesState? state, string namePropertiesProgressName, string description, string errorMessage, string status, DateTimeOffset? startTimeUtc, DateTimeOffset? endTimeUtc, DateTimeOffset? lastUpdatedTimeUtc, IList steps, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; ProvisioningState = provisioningState; @@ -60,6 +64,7 @@ internal UpdateRunData(ResourceIdentifier id, string name, ResourceType resource EndTimeUtc = endTimeUtc; LastUpdatedTimeUtc = lastUpdatedTimeUtc; Steps = steps; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The geo-location where the resource lives. diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryData.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryData.cs index 746c7a652b40..7baa71c1f288 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryData.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Hci /// public partial class UpdateSummaryData : ResourceData { - /// Initializes a new instance of UpdateSummaryData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateSummaryData() { PackageVersions = new ChangeTrackingList(); HealthCheckResult = new ChangeTrackingList(); } - /// Initializes a new instance of UpdateSummaryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +46,8 @@ public UpdateSummaryData() /// An array of pre-check result objects. /// Last time the package-specific checks were run. /// Overall update state of the stamp. - internal UpdateSummaryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, HciProvisioningState? provisioningState, string oemFamily, string hardwareModel, IList packageVersions, string currentVersion, DateTimeOffset? lastUpdated, DateTimeOffset? lastChecked, HciHealthState? healthState, IList healthCheckResult, DateTimeOffset? healthCheckOn, UpdateSummariesPropertiesState? state) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal UpdateSummaryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, HciProvisioningState? provisioningState, string oemFamily, string hardwareModel, IList packageVersions, string currentVersion, DateTimeOffset? lastUpdated, DateTimeOffset? lastChecked, HciHealthState? healthState, IList healthCheckResult, DateTimeOffset? healthCheckOn, UpdateSummariesPropertiesState? state, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; ProvisioningState = provisioningState; @@ -57,6 +61,7 @@ internal UpdateSummaryData(ResourceIdentifier id, string name, ResourceType reso HealthCheckResult = healthCheckResult; HealthCheckOn = healthCheckOn; State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The geo-location where the resource lives. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/ArmBatchModelFactory.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/ArmBatchModelFactory.cs index 534628836820..542a1a24664d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/ArmBatchModelFactory.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/ArmBatchModelFactory.cs @@ -18,16 +18,36 @@ namespace Azure.ResourceManager.Batch.Models /// Model factory for models. public static partial class ArmBatchModelFactory { - /// Initializes a new instance of BatchIPRule. + /// Initializes a new instance of . + /// The region in which to create the account. + /// The user-specified tags associated with the account. + /// The identity of the Batch account. Current supported identity types: None, SystemAssigned, UserAssigned. + /// The properties related to the auto-storage account. + /// The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. + /// A reference to the Azure key vault associated with the Batch account. + /// If not specified, the default value is 'enabled'. + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + /// List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. + /// A new instance for mocking. + public static BatchAccountCreateOrUpdateContent BatchAccountCreateOrUpdateContent(AzureLocation location = default, IDictionary tags = null, ManagedServiceIdentity identity = null, BatchAccountAutoStorageBaseConfiguration autoStorage = null, BatchAccountPoolAllocationMode? poolAllocationMode = null, BatchKeyVaultReference keyVaultReference = null, BatchPublicNetworkAccess? publicNetworkAccess = null, BatchNetworkProfile networkProfile = null, BatchAccountEncryptionConfiguration encryption = null, IEnumerable allowedAuthenticationModes = null) + { + tags ??= new Dictionary(); + allowedAuthenticationModes ??= new List(); + + return new BatchAccountCreateOrUpdateContent(location, tags, identity, autoStorage, poolAllocationMode, keyVaultReference, publicNetworkAccess, networkProfile, encryption, allowedAuthenticationModes?.ToList(), default); + } + + /// Initializes a new instance of . /// Action when client IP address is matched. /// IPv4 address, or IPv4 address range in CIDR format. /// A new instance for mocking. public static BatchIPRule BatchIPRule(BatchIPRuleAction action = default, string value = null) { - return new BatchIPRule(action, value); + return new BatchIPRule(action, value, default); } - /// Initializes a new instance of BatchAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -60,10 +80,10 @@ public static BatchAccountData BatchAccountData(ResourceIdentifier id = null, st allowedAuthenticationModes ??= new List(); tags ??= new Dictionary(); - return new BatchAccountData(id, name, resourceType, systemData, identity, accountEndpoint, nodeManagementEndpoint, provisioningState, poolAllocationMode, keyVaultReference, publicNetworkAccess, networkProfile, privateEndpointConnections?.ToList(), autoStorage, encryption, dedicatedCoreQuota, lowPriorityCoreQuota, dedicatedCoreQuotaPerVmFamily?.ToList(), isDedicatedCoreQuotaPerVmFamilyEnforced, poolQuota, activeJobAndJobScheduleQuota, allowedAuthenticationModes?.ToList(), location, tags); + return new BatchAccountData(id, name, resourceType, systemData, identity, accountEndpoint, nodeManagementEndpoint, provisioningState, poolAllocationMode, keyVaultReference, publicNetworkAccess, networkProfile, privateEndpointConnections?.ToList(), autoStorage, encryption, dedicatedCoreQuota, lowPriorityCoreQuota, dedicatedCoreQuotaPerVmFamily?.ToList(), isDedicatedCoreQuotaPerVmFamilyEnforced, poolQuota, activeJobAndJobScheduleQuota, allowedAuthenticationModes?.ToList(), location, tags, default); } - /// Initializes a new instance of BatchPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -78,39 +98,39 @@ public static BatchPrivateEndpointConnectionData BatchPrivateEndpointConnectionD { groupIds ??= new List(); - return new BatchPrivateEndpointConnectionData(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, groupIds?.ToList(), connectionState, etag); + return new BatchPrivateEndpointConnectionData(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, groupIds?.ToList(), connectionState, etag, default); } - /// Initializes a new instance of BatchPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// The status of the Batch private endpoint connection. /// Description of the private Connection state. /// Action required on the private connection state. /// A new instance for mocking. public static BatchPrivateLinkServiceConnectionState BatchPrivateLinkServiceConnectionState(BatchPrivateLinkServiceConnectionStatus status = default, string description = null, string actionRequired = null) { - return new BatchPrivateLinkServiceConnectionState(status, description, actionRequired); + return new BatchPrivateLinkServiceConnectionState(status, description, actionRequired, default); } - /// Initializes a new instance of BatchVmFamilyCoreQuota. + /// Initializes a new instance of . /// The Virtual Machine family name. /// The core quota for the VM family for the Batch account. /// A new instance for mocking. public static BatchVmFamilyCoreQuota BatchVmFamilyCoreQuota(string name = null, int? coreQuota = null) { - return new BatchVmFamilyCoreQuota(name, coreQuota); + return new BatchVmFamilyCoreQuota(name, coreQuota, default); } - /// Initializes a new instance of BatchAccountKeys. + /// Initializes a new instance of . /// The Batch account name. /// The primary key associated with the account. /// The secondary key associated with the account. /// A new instance for mocking. public static BatchAccountKeys BatchAccountKeys(string accountName = null, string primary = null, string secondary = null) { - return new BatchAccountKeys(accountName, primary, secondary); + return new BatchAccountKeys(accountName, primary, secondary, default); } - /// Initializes a new instance of BatchApplicationPackageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -124,10 +144,10 @@ public static BatchAccountKeys BatchAccountKeys(string accountName = null, strin /// A new instance for mocking. public static BatchApplicationPackageData BatchApplicationPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BatchApplicationPackageState? state = null, string format = null, Uri storageUri = null, DateTimeOffset? storageUriExpireOn = null, DateTimeOffset? lastActivatedOn = null, ETag? etag = null) { - return new BatchApplicationPackageData(id, name, resourceType, systemData, state, format, storageUri, storageUriExpireOn, lastActivatedOn, etag); + return new BatchApplicationPackageData(id, name, resourceType, systemData, state, format, storageUri, storageUriExpireOn, lastActivatedOn, etag, default); } - /// Initializes a new instance of BatchApplicationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -139,18 +159,18 @@ public static BatchApplicationPackageData BatchApplicationPackageData(ResourceId /// A new instance for mocking. public static BatchApplicationData BatchApplicationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, bool? allowUpdates = null, string defaultVersion = null, ETag? etag = null) { - return new BatchApplicationData(id, name, resourceType, systemData, displayName, allowUpdates, defaultVersion, etag); + return new BatchApplicationData(id, name, resourceType, systemData, displayName, allowUpdates, defaultVersion, etag, default); } - /// Initializes a new instance of BatchLocationQuota. + /// Initializes a new instance of . /// The number of Batch accounts that may be created under the subscription in the specified region. /// A new instance for mocking. public static BatchLocationQuota BatchLocationQuota(int? accountQuota = null) { - return new BatchLocationQuota(accountQuota); + return new BatchLocationQuota(accountQuota, default); } - /// Initializes a new instance of BatchSupportedSku. + /// Initializes a new instance of . /// The name of the SKU. /// The family name of the SKU. /// A collection of capabilities which this SKU supports. @@ -159,29 +179,38 @@ public static BatchSupportedSku BatchSupportedSku(string name = null, string fam { capabilities ??= new List(); - return new BatchSupportedSku(name, familyName, capabilities?.ToList()); + return new BatchSupportedSku(name, familyName, capabilities?.ToList(), default); } - /// Initializes a new instance of BatchSkuCapability. + /// Initializes a new instance of . /// The name of the feature. /// The value of the feature. /// A new instance for mocking. public static BatchSkuCapability BatchSkuCapability(string name = null, string value = null) { - return new BatchSkuCapability(name, value); + return new BatchSkuCapability(name, value, default); + } + + /// Initializes a new instance of . + /// The name to check for availability. + /// The resource type. + /// A new instance for mocking. + public static BatchNameAvailabilityContent BatchNameAvailabilityContent(string name = null, ResourceType resourceType = default) + { + return new BatchNameAvailabilityContent(name, resourceType, default); } - /// Initializes a new instance of BatchNameAvailabilityResult. + /// Initializes a new instance of . /// Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. /// Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. /// Gets an error message explaining the Reason value in more detail. /// A new instance for mocking. public static BatchNameAvailabilityResult BatchNameAvailabilityResult(bool? isNameAvailable = null, BatchNameUnavailableReason? reason = null, string message = null) { - return new BatchNameAvailabilityResult(isNameAvailable, reason, message); + return new BatchNameAvailabilityResult(isNameAvailable, reason, message, default); } - /// Initializes a new instance of BatchAccountCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -199,10 +228,10 @@ public static BatchNameAvailabilityResult BatchNameAvailabilityResult(bool? isNa /// A new instance for mocking. public static BatchAccountCertificateData BatchAccountCertificateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string thumbprintAlgorithm = null, string thumbprintString = null, BatchAccountCertificateFormat? format = null, BatchAccountCertificateProvisioningState? provisioningState = null, DateTimeOffset? provisioningStateTransitOn = null, BatchAccountCertificateProvisioningState? previousProvisioningState = null, DateTimeOffset? previousProvisioningStateTransitOn = null, string publicData = null, ResponseError deleteCertificateError = null, ETag? etag = null) { - return new BatchAccountCertificateData(id, name, resourceType, systemData, thumbprintAlgorithm, thumbprintString, format, provisioningState, provisioningStateTransitOn, previousProvisioningState, previousProvisioningStateTransitOn, publicData, deleteCertificateError, etag); + return new BatchAccountCertificateData(id, name, resourceType, systemData, thumbprintAlgorithm, thumbprintString, format, provisioningState, provisioningStateTransitOn, previousProvisioningState, previousProvisioningStateTransitOn, publicData, deleteCertificateError, etag, default); } - /// Initializes a new instance of BatchAccountCertificateCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -216,10 +245,10 @@ public static BatchAccountCertificateData BatchAccountCertificateData(ResourceId /// A new instance for mocking. public static BatchAccountCertificateCreateOrUpdateContent BatchAccountCertificateCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string thumbprintAlgorithm = null, string thumbprintString = null, BatchAccountCertificateFormat? format = null, BinaryData data = null, string password = null, ETag? etag = null) { - return new BatchAccountCertificateCreateOrUpdateContent(id, name, resourceType, systemData, thumbprintAlgorithm, thumbprintString, format, data, password, etag); + return new BatchAccountCertificateCreateOrUpdateContent(id, name, resourceType, systemData, thumbprintAlgorithm, thumbprintString, format, data, password, etag, default); } - /// Initializes a new instance of BatchAccountDetectorData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -229,10 +258,10 @@ public static BatchAccountCertificateCreateOrUpdateContent BatchAccountCertifica /// A new instance for mocking. public static BatchAccountDetectorData BatchAccountDetectorData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, ETag? etag = null) { - return new BatchAccountDetectorData(id, name, resourceType, systemData, value, etag); + return new BatchAccountDetectorData(id, name, resourceType, systemData, value, etag, default); } - /// Initializes a new instance of BatchPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -247,10 +276,10 @@ public static BatchPrivateLinkResourceData BatchPrivateLinkResourceData(Resource requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new BatchPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), etag); + return new BatchPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), etag, default); } - /// Initializes a new instance of BatchAccountPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -298,20 +327,20 @@ public static BatchAccountPoolData BatchAccountPoolData(ResourceIdentifier id = applicationLicenses ??= new List(); mountConfiguration ??= new List(); - return new BatchAccountPoolData(id, name, resourceType, systemData, identity, displayName, lastModifiedOn, createdOn, provisioningState, provisioningStateTransitOn, allocationState, allocationStateTransitionOn, vmSize, deploymentConfiguration, currentDedicatedNodes, currentLowPriorityNodes, scaleSettings, autoScaleRun, interNodeCommunication, networkConfiguration, taskSlotsPerNode, taskSchedulingNodeFillType.HasValue ? new TaskSchedulingPolicy(taskSchedulingNodeFillType.Value) : null, userAccounts?.ToList(), metadata?.ToList(), startTask, certificates?.ToList(), applicationPackages?.ToList(), applicationLicenses?.ToList(), resizeOperationStatus, mountConfiguration?.ToList(), targetNodeCommunicationMode, currentNodeCommunicationMode, etag); + return new BatchAccountPoolData(id, name, resourceType, systemData, identity, displayName, lastModifiedOn, createdOn, provisioningState, provisioningStateTransitOn, allocationState, allocationStateTransitionOn, vmSize, deploymentConfiguration, currentDedicatedNodes, currentLowPriorityNodes, scaleSettings, autoScaleRun, interNodeCommunication, networkConfiguration, taskSlotsPerNode, taskSchedulingNodeFillType.HasValue ? new TaskSchedulingPolicy(taskSchedulingNodeFillType.Value, new Dictionary()) : null, userAccounts?.ToList(), metadata?.ToList(), startTask, certificates?.ToList(), applicationPackages?.ToList(), applicationLicenses?.ToList(), resizeOperationStatus, mountConfiguration?.ToList(), targetNodeCommunicationMode, currentNodeCommunicationMode, etag, default); } - /// Initializes a new instance of BatchAccountPoolAutoScaleRun. + /// Initializes a new instance of . /// The time at which the autoscale formula was last evaluated. /// Each variable value is returned in the form $variable=value, and variables are separated by semicolons. /// An error that occurred when autoscaling a pool. /// A new instance for mocking. public static BatchAccountPoolAutoScaleRun BatchAccountPoolAutoScaleRun(DateTimeOffset evaluationOn = default, string results = null, ResponseError error = null) { - return new BatchAccountPoolAutoScaleRun(evaluationOn, results, error); + return new BatchAccountPoolAutoScaleRun(evaluationOn, results, error, default); } - /// Initializes a new instance of BatchResizeOperationStatus. + /// Initializes a new instance of . /// The desired number of dedicated compute nodes in the pool. /// The desired number of Spot/low-priority compute nodes in the pool. /// The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). @@ -323,10 +352,10 @@ public static BatchResizeOperationStatus BatchResizeOperationStatus(int? targetD { errors ??= new List(); - return new BatchResizeOperationStatus(targetDedicatedNodes, targetLowPriorityNodes, resizeTimeout, nodeDeallocationOption, startOn, errors?.ToList()); + return new BatchResizeOperationStatus(targetDedicatedNodes, targetLowPriorityNodes, resizeTimeout, nodeDeallocationOption, startOn, errors?.ToList(), default); } - /// Initializes a new instance of BatchAccountOutboundEnvironmentEndpoint. + /// Initializes a new instance of . /// The type of service that the Batch service connects to. /// The endpoints for this service to which the Batch service makes outbound calls. /// A new instance for mocking. @@ -334,10 +363,10 @@ public static BatchAccountOutboundEnvironmentEndpoint BatchAccountOutboundEnviro { endpoints ??= new List(); - return new BatchAccountOutboundEnvironmentEndpoint(category, endpoints?.ToList()); + return new BatchAccountOutboundEnvironmentEndpoint(category, endpoints?.ToList(), default); } - /// Initializes a new instance of BatchAccountEndpointDependency. + /// Initializes a new instance of . /// The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. /// Human-readable supplemental information about the dependency and when it is applicable. /// The list of connection details for this endpoint. @@ -346,15 +375,15 @@ public static BatchAccountEndpointDependency BatchAccountEndpointDependency(stri { endpointDetails ??= new List(); - return new BatchAccountEndpointDependency(domainName, description, endpointDetails?.ToList()); + return new BatchAccountEndpointDependency(domainName, description, endpointDetails?.ToList(), default); } - /// Initializes a new instance of BatchEndpointDetail. + /// Initializes a new instance of . /// The port an endpoint is connected to. /// A new instance for mocking. public static BatchEndpointDetail BatchEndpointDetail(int? port = null) { - return new BatchEndpointDetail(port); + return new BatchEndpointDetail(port, default); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs index 5a54c31719d4..20891bc62ab1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateCollection.cs @@ -236,7 +236,7 @@ public virtual AsyncPageable GetAllAsync(int? m { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountCertificateCertificateRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountCertificateCertificateRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountCertificateResource(Client, BatchAccountCertificateData.DeserializeBatchAccountCertificateData(e)), _batchAccountCertificateCertificateClientDiagnostics, Pipeline, "BatchAccountCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountCertificateResource(Client, BatchAccountCertificateData.DeserializeBatchAccountCertificateData(e)), _batchAccountCertificateCertificateClientDiagnostics, Pipeline, "BatchAccountCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -261,7 +261,7 @@ public virtual Pageable GetAll(int? maxresults { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountCertificateCertificateRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountCertificateCertificateRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountCertificateResource(Client, BatchAccountCertificateData.DeserializeBatchAccountCertificateData(e)), _batchAccountCertificateCertificateClientDiagnostics, Pipeline, "BatchAccountCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountCertificateResource(Client, BatchAccountCertificateData.DeserializeBatchAccountCertificateData(e)), _batchAccountCertificateCertificateClientDiagnostics, Pipeline, "BatchAccountCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateData.cs index 29584c20c824..ea28797a89cd 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Batch.Models; @@ -19,12 +20,15 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchAccountCertificateData : ResourceData { - /// Initializes a new instance of BatchAccountCertificateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountCertificateData() { } - /// Initializes a new instance of BatchAccountCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public BatchAccountCertificateData() /// The public key of the certificate. /// This is only returned when the certificate provisioningState is 'Failed'. /// The ETag of the resource, used for concurrency statements. - internal BatchAccountCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string thumbprintAlgorithm, string thumbprintString, BatchAccountCertificateFormat? format, BatchAccountCertificateProvisioningState? provisioningState, DateTimeOffset? provisioningStateTransitOn, BatchAccountCertificateProvisioningState? previousProvisioningState, DateTimeOffset? previousProvisioningStateTransitOn, string publicData, ResponseError deleteCertificateError, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchAccountCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string thumbprintAlgorithm, string thumbprintString, BatchAccountCertificateFormat? format, BatchAccountCertificateProvisioningState? provisioningState, DateTimeOffset? provisioningStateTransitOn, BatchAccountCertificateProvisioningState? previousProvisioningState, DateTimeOffset? previousProvisioningStateTransitOn, string publicData, ResponseError deleteCertificateError, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ThumbprintAlgorithm = thumbprintAlgorithm; ThumbprintString = thumbprintString; @@ -51,6 +56,7 @@ internal BatchAccountCertificateData(ResourceIdentifier id, string name, Resourc PublicData = publicData; DeleteCertificateError = deleteCertificateError; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This must match the first portion of the certificate name. Currently required to be 'SHA1'. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs index 008642a165e0..7fde8cd1c2a6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), _batchAccountClientDiagnostics, Pipeline, "BatchAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), _batchAccountClientDiagnostics, Pipeline, "BatchAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), _batchAccountClientDiagnostics, Pipeline, "BatchAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), _batchAccountClientDiagnostics, Pipeline, "BatchAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountData.cs index f5df8579507e..723767d4780f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchAccountData : ResourceData { - /// Initializes a new instance of BatchAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountData() { PrivateEndpointConnections = new ChangeTrackingList(); @@ -27,7 +31,7 @@ public BatchAccountData() Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of BatchAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -52,7 +56,8 @@ public BatchAccountData() /// List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. /// The location of the resource. /// The tags of the resource. - internal BatchAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, string accountEndpoint, string nodeManagementEndpoint, BatchProvisioningState? provisioningState, BatchAccountPoolAllocationMode? poolAllocationMode, BatchKeyVaultReference keyVaultReference, BatchPublicNetworkAccess? publicNetworkAccess, BatchNetworkProfile networkProfile, IReadOnlyList privateEndpointConnections, BatchAccountAutoStorageConfiguration autoStorage, BatchAccountEncryptionConfiguration encryption, int? dedicatedCoreQuota, int? lowPriorityCoreQuota, IReadOnlyList dedicatedCoreQuotaPerVmFamily, bool? isDedicatedCoreQuotaPerVmFamilyEnforced, int? poolQuota, int? activeJobAndJobScheduleQuota, IReadOnlyList allowedAuthenticationModes, AzureLocation? location, IDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, string accountEndpoint, string nodeManagementEndpoint, BatchProvisioningState? provisioningState, BatchAccountPoolAllocationMode? poolAllocationMode, BatchKeyVaultReference keyVaultReference, BatchPublicNetworkAccess? publicNetworkAccess, BatchNetworkProfile networkProfile, IReadOnlyList privateEndpointConnections, BatchAccountAutoStorageConfiguration autoStorage, BatchAccountEncryptionConfiguration encryption, int? dedicatedCoreQuota, int? lowPriorityCoreQuota, IReadOnlyList dedicatedCoreQuotaPerVmFamily, bool? isDedicatedCoreQuotaPerVmFamilyEnforced, int? poolQuota, int? activeJobAndJobScheduleQuota, IReadOnlyList allowedAuthenticationModes, AzureLocation? location, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Identity = identity; AccountEndpoint = accountEndpoint; @@ -74,6 +79,7 @@ internal BatchAccountData(ResourceIdentifier id, string name, ResourceType resou AllowedAuthenticationModes = allowedAuthenticationModes; Location = location; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The identity of the Batch account. Current supported identity types: None, SystemAssigned, UserAssigned. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs index 238fb46f61b5..2ced76a43d35 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountDetectorBatchAccountRestClient.CreateListDetectorsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountDetectorBatchAccountRestClient.CreateListDetectorsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountDetectorResource(Client, BatchAccountDetectorData.DeserializeBatchAccountDetectorData(e)), _batchAccountDetectorBatchAccountClientDiagnostics, Pipeline, "BatchAccountDetectorCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountDetectorResource(Client, BatchAccountDetectorData.DeserializeBatchAccountDetectorData(e)), _batchAccountDetectorBatchAccountClientDiagnostics, Pipeline, "BatchAccountDetectorCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountDetectorBatchAccountRestClient.CreateListDetectorsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountDetectorBatchAccountRestClient.CreateListDetectorsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountDetectorResource(Client, BatchAccountDetectorData.DeserializeBatchAccountDetectorData(e)), _batchAccountDetectorBatchAccountClientDiagnostics, Pipeline, "BatchAccountDetectorCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountDetectorResource(Client, BatchAccountDetectorData.DeserializeBatchAccountDetectorData(e)), _batchAccountDetectorBatchAccountClientDiagnostics, Pipeline, "BatchAccountDetectorCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorData.cs index b6bb5f41f71d..a15bdf8f180a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchAccountDetectorData : ResourceData { - /// Initializes a new instance of BatchAccountDetectorData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountDetectorData() { } - /// Initializes a new instance of BatchAccountDetectorData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// A base64 encoded string that represents the content of a detector. /// The ETag of the resource, used for concurrency statements. - internal BatchAccountDetectorData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchAccountDetectorData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Value = value; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A base64 encoded string that represents the content of a detector. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs index 4c3609090985..81c6e644bbd2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolCollection.cs @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(int? maxresul { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountPoolPoolRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountPoolPoolRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountPoolResource(Client, BatchAccountPoolData.DeserializeBatchAccountPoolData(e)), _batchAccountPoolPoolClientDiagnostics, Pipeline, "BatchAccountPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountPoolResource(Client, BatchAccountPoolData.DeserializeBatchAccountPoolData(e)), _batchAccountPoolPoolClientDiagnostics, Pipeline, "BatchAccountPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -288,7 +288,7 @@ public virtual Pageable GetAll(int? maxresults = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchAccountPoolPoolRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchAccountPoolPoolRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults, select, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountPoolResource(Client, BatchAccountPoolData.DeserializeBatchAccountPoolData(e)), _batchAccountPoolPoolClientDiagnostics, Pipeline, "BatchAccountPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountPoolResource(Client, BatchAccountPoolData.DeserializeBatchAccountPoolData(e)), _batchAccountPoolPoolClientDiagnostics, Pipeline, "BatchAccountPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolData.cs index fd0faeedb23a..af77bc0dcc96 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchAccountPoolData : ResourceData { - /// Initializes a new instance of BatchAccountPoolData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountPoolData() { UserAccounts = new ChangeTrackingList(); @@ -31,7 +34,7 @@ public BatchAccountPoolData() MountConfiguration = new ChangeTrackingList(); } - /// Initializes a new instance of BatchAccountPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -69,7 +72,8 @@ public BatchAccountPoolData() /// If omitted, the default value is Default. /// Determines how a pool communicates with the Batch service. /// The ETag of the resource, used for concurrency statements. - internal BatchAccountPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, string displayName, DateTimeOffset? lastModifiedOn, DateTimeOffset? createdOn, BatchAccountPoolProvisioningState? provisioningState, DateTimeOffset? provisioningStateTransitOn, BatchAccountPoolAllocationState? allocationState, DateTimeOffset? allocationStateTransitionOn, string vmSize, BatchDeploymentConfiguration deploymentConfiguration, int? currentDedicatedNodes, int? currentLowPriorityNodes, BatchAccountPoolScaleSettings scaleSettings, BatchAccountPoolAutoScaleRun autoScaleRun, InterNodeCommunicationState? interNodeCommunication, BatchNetworkConfiguration networkConfiguration, int? taskSlotsPerNode, TaskSchedulingPolicy taskSchedulingPolicy, IList userAccounts, IList metadata, BatchAccountPoolStartTask startTask, IList certificates, IList applicationPackages, IList applicationLicenses, BatchResizeOperationStatus resizeOperationStatus, IList mountConfiguration, NodeCommunicationMode? targetNodeCommunicationMode, NodeCommunicationMode? currentNodeCommunicationMode, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchAccountPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, string displayName, DateTimeOffset? lastModifiedOn, DateTimeOffset? createdOn, BatchAccountPoolProvisioningState? provisioningState, DateTimeOffset? provisioningStateTransitOn, BatchAccountPoolAllocationState? allocationState, DateTimeOffset? allocationStateTransitionOn, string vmSize, BatchDeploymentConfiguration deploymentConfiguration, int? currentDedicatedNodes, int? currentLowPriorityNodes, BatchAccountPoolScaleSettings scaleSettings, BatchAccountPoolAutoScaleRun autoScaleRun, InterNodeCommunicationState? interNodeCommunication, BatchNetworkConfiguration networkConfiguration, int? taskSlotsPerNode, TaskSchedulingPolicy taskSchedulingPolicy, IList userAccounts, IList metadata, BatchAccountPoolStartTask startTask, IList certificates, IList applicationPackages, IList applicationLicenses, BatchResizeOperationStatus resizeOperationStatus, IList mountConfiguration, NodeCommunicationMode? targetNodeCommunicationMode, NodeCommunicationMode? currentNodeCommunicationMode, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Identity = identity; DisplayName = displayName; @@ -100,6 +104,7 @@ internal BatchAccountPoolData(ResourceIdentifier id, string name, ResourceType r TargetNodeCommunicationMode = targetNodeCommunicationMode; CurrentNodeCommunicationMode = currentNodeCommunicationMode; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of identity used for the Batch Pool. Current supported identity types: UserAssigned, None. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs index 9f5b7a850bbe..e2fd600ccc68 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(int? maxresul { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchApplicationApplicationRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchApplicationApplicationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchApplicationResource(Client, BatchApplicationData.DeserializeBatchApplicationData(e)), _batchApplicationApplicationClientDiagnostics, Pipeline, "BatchApplicationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchApplicationResource(Client, BatchApplicationData.DeserializeBatchApplicationData(e)), _batchApplicationApplicationClientDiagnostics, Pipeline, "BatchApplicationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(int? maxresults = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchApplicationApplicationRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchApplicationApplicationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchApplicationResource(Client, BatchApplicationData.DeserializeBatchApplicationData(e)), _batchApplicationApplicationClientDiagnostics, Pipeline, "BatchApplicationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchApplicationResource(Client, BatchApplicationData.DeserializeBatchApplicationData(e)), _batchApplicationApplicationClientDiagnostics, Pipeline, "BatchApplicationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationData.cs index 9068a19d4b2d..78458e145aaf 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchApplicationData : ResourceData { - /// Initializes a new instance of BatchApplicationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchApplicationData() { } - /// Initializes a new instance of BatchApplicationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +36,14 @@ public BatchApplicationData() /// A value indicating whether packages within the application may be overwritten using the same version string. /// The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. /// The ETag of the resource, used for concurrency statements. - internal BatchApplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, bool? allowUpdates, string defaultVersion, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchApplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, bool? allowUpdates, string defaultVersion, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; AllowUpdates = allowUpdates; DefaultVersion = defaultVersion; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The display name for the application. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs index a7e38d4b0baf..4b9451ac71a2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(int? m { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchApplicationPackageApplicationPackageRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchApplicationPackageApplicationPackageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, maxresults); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchApplicationPackageResource(Client, BatchApplicationPackageData.DeserializeBatchApplicationPackageData(e)), _batchApplicationPackageApplicationPackageClientDiagnostics, Pipeline, "BatchApplicationPackageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchApplicationPackageResource(Client, BatchApplicationPackageData.DeserializeBatchApplicationPackageData(e)), _batchApplicationPackageApplicationPackageClientDiagnostics, Pipeline, "BatchApplicationPackageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(int? maxresults { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchApplicationPackageApplicationPackageRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchApplicationPackageApplicationPackageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, maxresults); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchApplicationPackageResource(Client, BatchApplicationPackageData.DeserializeBatchApplicationPackageData(e)), _batchApplicationPackageApplicationPackageClientDiagnostics, Pipeline, "BatchApplicationPackageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchApplicationPackageResource(Client, BatchApplicationPackageData.DeserializeBatchApplicationPackageData(e)), _batchApplicationPackageApplicationPackageClientDiagnostics, Pipeline, "BatchApplicationPackageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageData.cs index 4cdd321ad2e6..01f279afd01b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Batch.Models; @@ -19,12 +20,15 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchApplicationPackageData : ResourceData { - /// Initializes a new instance of BatchApplicationPackageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchApplicationPackageData() { } - /// Initializes a new instance of BatchApplicationPackageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public BatchApplicationPackageData() /// The UTC time at which the Azure Storage URL will expire. /// The time at which the package was last activated, if the package is active. /// The ETag of the resource, used for concurrency statements. - internal BatchApplicationPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BatchApplicationPackageState? state, string format, Uri storageUri, DateTimeOffset? storageUriExpireOn, DateTimeOffset? lastActivatedOn, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchApplicationPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BatchApplicationPackageState? state, string format, Uri storageUri, DateTimeOffset? storageUriExpireOn, DateTimeOffset? lastActivatedOn, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { State = state; Format = format; @@ -43,6 +48,7 @@ internal BatchApplicationPackageData(ResourceIdentifier id, string name, Resourc StorageUriExpireOn = storageUriExpireOn; LastActivatedOn = lastActivatedOn; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The current state of the application package. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs index e55b2f3a9097..ae0ae394a81c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchPrivateEndpointConnectionPrivateEndpointConnectionRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchPrivateEndpointConnectionPrivateEndpointConnectionRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchPrivateEndpointConnectionResource(Client, BatchPrivateEndpointConnectionData.DeserializeBatchPrivateEndpointConnectionData(e)), _batchPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "BatchPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchPrivateEndpointConnectionResource(Client, BatchPrivateEndpointConnectionData.DeserializeBatchPrivateEndpointConnectionData(e)), _batchPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "BatchPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(int? maxr { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchPrivateEndpointConnectionPrivateEndpointConnectionRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchPrivateEndpointConnectionPrivateEndpointConnectionRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchPrivateEndpointConnectionResource(Client, BatchPrivateEndpointConnectionData.DeserializeBatchPrivateEndpointConnectionData(e)), _batchPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "BatchPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchPrivateEndpointConnectionResource(Client, BatchPrivateEndpointConnectionData.DeserializeBatchPrivateEndpointConnectionData(e)), _batchPrivateEndpointConnectionPrivateEndpointConnectionClientDiagnostics, Pipeline, "BatchPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionData.cs index f3535fc58e35..636aae414329 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -20,13 +21,16 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of BatchPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchPrivateEndpointConnectionData() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of BatchPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,13 +40,15 @@ public BatchPrivateEndpointConnectionData() /// The value has one and only one group id. /// The private link service connection state of the private endpoint connection. /// The ETag of the resource, used for concurrency statements. - internal BatchPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BatchPrivateEndpointConnectionProvisioningState? provisioningState, SubResource privateEndpoint, IReadOnlyList groupIds, BatchPrivateLinkServiceConnectionState connectionState, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BatchPrivateEndpointConnectionProvisioningState? provisioningState, SubResource privateEndpoint, IReadOnlyList groupIds, BatchPrivateLinkServiceConnectionState connectionState, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; GroupIds = groupIds; ConnectionState = connectionState; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The provisioning state of the private endpoint connection. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs index ad01c32af724..abf04d2c790b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAllAsync(int? maxresul { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchPrivateLinkResourcePrivateLinkResourceRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchPrivateLinkResourcePrivateLinkResourceRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchPrivateLinkResource(Client, BatchPrivateLinkResourceData.DeserializeBatchPrivateLinkResourceData(e)), _batchPrivateLinkResourcePrivateLinkResourceClientDiagnostics, Pipeline, "BatchPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchPrivateLinkResource(Client, BatchPrivateLinkResourceData.DeserializeBatchPrivateLinkResourceData(e)), _batchPrivateLinkResourcePrivateLinkResourceClientDiagnostics, Pipeline, "BatchPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(int? maxresults = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _batchPrivateLinkResourcePrivateLinkResourceRestClient.CreateListByBatchAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _batchPrivateLinkResourcePrivateLinkResourceRestClient.CreateListByBatchAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, maxresults); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchPrivateLinkResource(Client, BatchPrivateLinkResourceData.DeserializeBatchPrivateLinkResourceData(e)), _batchPrivateLinkResourcePrivateLinkResourceClientDiagnostics, Pipeline, "BatchPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchPrivateLinkResource(Client, BatchPrivateLinkResourceData.DeserializeBatchPrivateLinkResourceData(e)), _batchPrivateLinkResourcePrivateLinkResourceClientDiagnostics, Pipeline, "BatchPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceData.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceData.cs index b06acac6df8d..746b9470ae14 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceData.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.Batch /// public partial class BatchPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of BatchPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of BatchPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,12 +38,14 @@ public BatchPrivateLinkResourceData() /// The list of required members that are used to establish the private link connection. /// The list of required zone names for the private DNS resource name. /// The ETag of the resource, used for concurrency statements. - internal BatchPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The group id is used to establish the private link connection. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 90cea14bd93e..c3a1aed0d3db 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -67,7 +67,7 @@ public virtual AsyncPageable GetBatchAccountsAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => BatchAccountRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BatchAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchAccounts", "value", "nextLink", cancellationToken); } /// @@ -89,7 +89,7 @@ public virtual Pageable GetBatchAccounts(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => BatchAccountRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BatchAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchAccounts", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.Serialization.cs index 42afb14d4387..ff7f9304d78b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountAutoScaleSettings : IUtf8JsonSerializable + public partial class BatchAccountAutoScaleSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("formula"u8); writer.WriteStringValue(Formula); @@ -23,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("evaluationInterval"u8); writer.WriteStringValue(EvaluationInterval.Value, "P"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountAutoScaleSettings DeserializeBatchAccountAutoScaleSettings(JsonElement element) + internal static BatchAccountAutoScaleSettings DeserializeBatchAccountAutoScaleSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string formula = default; Optional evaluationInterval = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("formula"u8)) @@ -50,8 +72,61 @@ internal static BatchAccountAutoScaleSettings DeserializeBatchAccountAutoScaleSe evaluationInterval = property.Value.GetTimeSpan("P"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountAutoScaleSettings(formula, Optional.ToNullable(evaluationInterval), serializedAdditionalRawData); + } + + BatchAccountAutoScaleSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountAutoScaleSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountAutoScaleSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountAutoScaleSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountAutoScaleSettings model) + { + if (model is null) + { + return null; } - return new BatchAccountAutoScaleSettings(formula, Optional.ToNullable(evaluationInterval)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountAutoScaleSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountAutoScaleSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.cs index 0f15fddf6c77..3d0c5f3239a1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoScaleSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// AutoScale settings for the pool. public partial class BatchAccountAutoScaleSettings { - /// Initializes a new instance of BatchAccountAutoScaleSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A formula for the desired number of compute nodes in the pool. /// is null. public BatchAccountAutoScaleSettings(string formula) @@ -23,13 +27,20 @@ public BatchAccountAutoScaleSettings(string formula) Formula = formula; } - /// Initializes a new instance of BatchAccountAutoScaleSettings. + /// Initializes a new instance of . /// A formula for the desired number of compute nodes in the pool. /// If omitted, the default value is 15 minutes (PT15M). - internal BatchAccountAutoScaleSettings(string formula, TimeSpan? evaluationInterval) + /// Keeps track of any properties unknown to the library. + internal BatchAccountAutoScaleSettings(string formula, TimeSpan? evaluationInterval, Dictionary serializedAdditionalRawData) { Formula = formula; EvaluationInterval = evaluationInterval; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchAccountAutoScaleSettings() + { } /// A formula for the desired number of compute nodes in the pool. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.Serialization.cs index d629702c5a6c..931d18055ba6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountAutoStorageBaseConfiguration : IUtf8JsonSerializable + public partial class BatchAccountAutoStorageBaseConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageAccountId"u8); writer.WriteStringValue(StorageAccountId); @@ -25,13 +33,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NodeIdentity)) { writer.WritePropertyName("nodeIdentityReference"u8); - writer.WriteObjectValue(NodeIdentity); + if (NodeIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NodeIdentity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchAccountAutoStorageBaseConfiguration DeserializeBatchAccountAutoStorageBaseConfiguration(JsonElement element) + internal static BatchAccountAutoStorageBaseConfiguration DeserializeBatchAccountAutoStorageBaseConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static BatchAccountAutoStorageBaseConfiguration DeserializeBatchAccount ResourceIdentifier storageAccountId = default; Optional authenticationMode = default; Optional nodeIdentityReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountId"u8)) @@ -64,8 +94,61 @@ internal static BatchAccountAutoStorageBaseConfiguration DeserializeBatchAccount nodeIdentityReference = ComputeNodeIdentityReference.DeserializeComputeNodeIdentityReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountAutoStorageBaseConfiguration(storageAccountId, Optional.ToNullable(authenticationMode), nodeIdentityReference.Value, serializedAdditionalRawData); + } + + BatchAccountAutoStorageBaseConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountAutoStorageBaseConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountAutoStorageBaseConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountAutoStorageBaseConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountAutoStorageBaseConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountAutoStorageBaseConfiguration(Response response) + { + if (response is null) + { + return null; } - return new BatchAccountAutoStorageBaseConfiguration(storageAccountId, Optional.ToNullable(authenticationMode), nodeIdentityReference.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountAutoStorageBaseConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.cs index aef6fa34d205..0eb0efbe28ca 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageBaseConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The properties related to the auto-storage account. public partial class BatchAccountAutoStorageBaseConfiguration { - /// Initializes a new instance of BatchAccountAutoStorageBaseConfiguration. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource ID of the storage account to be used for auto-storage account. /// is null. public BatchAccountAutoStorageBaseConfiguration(ResourceIdentifier storageAccountId) @@ -23,15 +27,22 @@ public BatchAccountAutoStorageBaseConfiguration(ResourceIdentifier storageAccoun StorageAccountId = storageAccountId; } - /// Initializes a new instance of BatchAccountAutoStorageBaseConfiguration. + /// Initializes a new instance of . /// The resource ID of the storage account to be used for auto-storage account. /// The authentication mode which the Batch service will use to manage the auto-storage account. /// The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. - internal BatchAccountAutoStorageBaseConfiguration(ResourceIdentifier storageAccountId, BatchAutoStorageAuthenticationMode? authenticationMode, ComputeNodeIdentityReference nodeIdentity) + /// Keeps track of any properties unknown to the library. + internal BatchAccountAutoStorageBaseConfiguration(ResourceIdentifier storageAccountId, BatchAutoStorageAuthenticationMode? authenticationMode, ComputeNodeIdentityReference nodeIdentity, Dictionary serializedAdditionalRawData) { StorageAccountId = storageAccountId; AuthenticationMode = authenticationMode; NodeIdentity = nodeIdentity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchAccountAutoStorageBaseConfiguration() + { } /// The resource ID of the storage account to be used for auto-storage account. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.Serialization.cs index 9b16ceb0f60d..df018298df18 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountAutoStorageConfiguration : IUtf8JsonSerializable + public partial class BatchAccountAutoStorageConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lastKeySync"u8); writer.WriteStringValue(LastKeySyncedOn, "O"); @@ -28,13 +35,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NodeIdentity)) { writer.WritePropertyName("nodeIdentityReference"u8); - writer.WriteObjectValue(NodeIdentity); + if (NodeIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NodeIdentity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchAccountAutoStorageConfiguration DeserializeBatchAccountAutoStorageConfiguration(JsonElement element) + internal static BatchAccountAutoStorageConfiguration DeserializeBatchAccountAutoStorageConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static BatchAccountAutoStorageConfiguration DeserializeBatchAccountAuto ResourceIdentifier storageAccountId = default; Optional authenticationMode = default; Optional nodeIdentityReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lastKeySync"u8)) @@ -73,8 +102,61 @@ internal static BatchAccountAutoStorageConfiguration DeserializeBatchAccountAuto nodeIdentityReference = ComputeNodeIdentityReference.DeserializeComputeNodeIdentityReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountAutoStorageConfiguration(storageAccountId, Optional.ToNullable(authenticationMode), nodeIdentityReference.Value, lastKeySync, serializedAdditionalRawData); + } + + BatchAccountAutoStorageConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountAutoStorageConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountAutoStorageConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountAutoStorageConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountAutoStorageConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountAutoStorageConfiguration(Response response) + { + if (response is null) + { + return null; } - return new BatchAccountAutoStorageConfiguration(storageAccountId, Optional.ToNullable(authenticationMode), nodeIdentityReference.Value, lastKeySync); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountAutoStorageConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.cs index 5dd6c1f59ac3..9e3b9b39fe64 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountAutoStorageConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Batch.Models /// Contains information about the auto-storage account associated with a Batch account. public partial class BatchAccountAutoStorageConfiguration : BatchAccountAutoStorageBaseConfiguration { - /// Initializes a new instance of BatchAccountAutoStorageConfiguration. + /// Initializes a new instance of . /// The resource ID of the storage account to be used for auto-storage account. /// The UTC time at which storage keys were last synchronized with the Batch account. /// is null. @@ -24,16 +25,22 @@ public BatchAccountAutoStorageConfiguration(ResourceIdentifier storageAccountId, LastKeySyncedOn = lastKeySyncedOn; } - /// Initializes a new instance of BatchAccountAutoStorageConfiguration. + /// Initializes a new instance of . /// The resource ID of the storage account to be used for auto-storage account. /// The authentication mode which the Batch service will use to manage the auto-storage account. /// The identity referenced here must be assigned to pools which have compute nodes that need access to auto-storage. /// The UTC time at which storage keys were last synchronized with the Batch account. - internal BatchAccountAutoStorageConfiguration(ResourceIdentifier storageAccountId, BatchAutoStorageAuthenticationMode? authenticationMode, ComputeNodeIdentityReference nodeIdentity, DateTimeOffset lastKeySyncedOn) : base(storageAccountId, authenticationMode, nodeIdentity) + /// Keeps track of any properties unknown to the library. + internal BatchAccountAutoStorageConfiguration(ResourceIdentifier storageAccountId, BatchAutoStorageAuthenticationMode? authenticationMode, ComputeNodeIdentityReference nodeIdentity, DateTimeOffset lastKeySyncedOn, Dictionary serializedAdditionalRawData) : base(storageAccountId, authenticationMode, nodeIdentity, serializedAdditionalRawData) { LastKeySyncedOn = lastKeySyncedOn; } + /// Initializes a new instance of for deserialization. + internal BatchAccountAutoStorageConfiguration() + { + } + /// The UTC time at which storage keys were last synchronized with the Batch account. public DateTimeOffset LastKeySyncedOn { get; set; } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.Serialization.cs index eb83fac52066..9b264a24e28e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.Serialization.cs @@ -6,17 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountCertificateCreateOrUpdateContent : IUtf8JsonSerializable + public partial class BatchAccountCertificateCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -50,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Password); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountCertificateCreateOrUpdateContent DeserializeBatchAccountCertificateCreateOrUpdateContent(JsonElement element) + internal static BatchAccountCertificateCreateOrUpdateContent DeserializeBatchAccountCertificateCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +89,7 @@ internal static BatchAccountCertificateCreateOrUpdateContent DeserializeBatchAcc Optional format = default; Optional data = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -149,8 +170,61 @@ internal static BatchAccountCertificateCreateOrUpdateContent DeserializeBatchAcc } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountCertificateCreateOrUpdateContent(id, name, type, systemData.Value, thumbprintAlgorithm.Value, thumbprint.Value, Optional.ToNullable(format), data.Value, password.Value, Optional.ToNullable(etag)); + return new BatchAccountCertificateCreateOrUpdateContent(id, name, type, systemData.Value, thumbprintAlgorithm.Value, thumbprint.Value, Optional.ToNullable(format), data.Value, password.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchAccountCertificateCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountCertificateCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountCertificateCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountCertificateCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountCertificateCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountCertificateCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountCertificateCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.cs index b5b8a602bacd..1ae453006377 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,12 +16,15 @@ namespace Azure.ResourceManager.Batch.Models /// Contains information about a certificate. public partial class BatchAccountCertificateCreateOrUpdateContent : ResourceData { - /// Initializes a new instance of BatchAccountCertificateCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountCertificateCreateOrUpdateContent() { } - /// Initializes a new instance of BatchAccountCertificateCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,7 +35,8 @@ public BatchAccountCertificateCreateOrUpdateContent() /// The maximum size is 10KB. /// This must not be specified if the certificate format is Cer. /// The ETag of the resource, used for concurrency statements. - internal BatchAccountCertificateCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string thumbprintAlgorithm, string thumbprintString, BatchAccountCertificateFormat? format, BinaryData data, string password, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BatchAccountCertificateCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string thumbprintAlgorithm, string thumbprintString, BatchAccountCertificateFormat? format, BinaryData data, string password, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ThumbprintAlgorithm = thumbprintAlgorithm; ThumbprintString = thumbprintString; @@ -39,6 +44,7 @@ internal BatchAccountCertificateCreateOrUpdateContent(ResourceIdentifier id, str Data = data; Password = password; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This must match the first portion of the certificate name. Currently required to be 'SHA1'. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateData.Serialization.cs index 529fe78115b6..384d59e43c81 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCertificateData.Serialization.cs @@ -6,18 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchAccountCertificateData : IUtf8JsonSerializable + public partial class BatchAccountCertificateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -37,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Format.Value.ToSerialString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountCertificateData DeserializeBatchAccountCertificateData(JsonElement element) + internal static BatchAccountCertificateData DeserializeBatchAccountCertificateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +80,7 @@ internal static BatchAccountCertificateData DeserializeBatchAccountCertificateDa Optional previousProvisioningStateTransitionTime = default; Optional publicData = default; Optional deleteCertificateError = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -176,8 +197,61 @@ internal static BatchAccountCertificateData DeserializeBatchAccountCertificateDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountCertificateData(id, name, type, systemData.Value, thumbprintAlgorithm.Value, thumbprint.Value, Optional.ToNullable(format), Optional.ToNullable(provisioningState), Optional.ToNullable(provisioningStateTransitionTime), Optional.ToNullable(previousProvisioningState), Optional.ToNullable(previousProvisioningStateTransitionTime), publicData.Value, deleteCertificateError.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchAccountCertificateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountCertificateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountCertificateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountCertificateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountCertificateData model) + { + if (model is null) + { + return null; } - return new BatchAccountCertificateData(id, name, type, systemData.Value, thumbprintAlgorithm.Value, thumbprint.Value, Optional.ToNullable(format), Optional.ToNullable(provisioningState), Optional.ToNullable(provisioningStateTransitionTime), Optional.ToNullable(previousProvisioningState), Optional.ToNullable(previousProvisioningStateTransitionTime), publicData.Value, deleteCertificateError.Value, Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountCertificateData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountCertificateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.Serialization.cs index a4e543579de7..193c9a81bff8 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountCreateOrUpdateContent : IUtf8JsonSerializable + public partial class BatchAccountCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); @@ -38,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoStorage)) { writer.WritePropertyName("autoStorage"u8); - writer.WriteObjectValue(AutoStorage); + if (AutoStorage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoStorage).Serialize(writer, options); + } } if (Optional.IsDefined(PoolAllocationMode)) { @@ -48,7 +64,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultReference)) { writer.WritePropertyName("keyVaultReference"u8); - writer.WriteObjectValue(KeyVaultReference); + if (KeyVaultReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultReference).Serialize(writer, options); + } } if (Optional.IsDefined(PublicNetworkAccess)) { @@ -58,12 +81,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AllowedAuthenticationModes)) { @@ -83,7 +120,206 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BatchAccountCreateOrUpdateContent DeserializeBatchAccountCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation location = default; + Optional> tags = default; + Optional identity = default; + Optional autoStorage = default; + Optional poolAllocationMode = default; + Optional keyVaultReference = default; + Optional publicNetworkAccess = default; + Optional networkProfile = default; + Optional encryption = default; + Optional> allowedAuthenticationModes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("autoStorage"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoStorage = BatchAccountAutoStorageBaseConfiguration.DeserializeBatchAccountAutoStorageBaseConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("poolAllocationMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + poolAllocationMode = property0.Value.GetString().ToBatchAccountPoolAllocationMode(); + continue; + } + if (property0.NameEquals("keyVaultReference"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultReference = BatchKeyVaultReference.DeserializeBatchKeyVaultReference(property0.Value); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = property0.Value.GetString().ToBatchPublicNetworkAccess(); + continue; + } + if (property0.NameEquals("networkProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = BatchNetworkProfile.DeserializeBatchNetworkProfile(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = BatchAccountEncryptionConfiguration.DeserializeBatchAccountEncryptionConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("allowedAuthenticationModes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + allowedAuthenticationModes = null; + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString().ToBatchAuthenticationMode()); + } + allowedAuthenticationModes = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountCreateOrUpdateContent(location, Optional.ToDictionary(tags), identity, autoStorage.Value, Optional.ToNullable(poolAllocationMode), keyVaultReference.Value, Optional.ToNullable(publicNetworkAccess), networkProfile.Value, encryption.Value, Optional.ToList(allowedAuthenticationModes), serializedAdditionalRawData); + } + + BatchAccountCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.cs index 5e2ff9f60a1b..8911bd028233 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Batch.Models /// Parameters supplied to the Create operation. public partial class BatchAccountCreateOrUpdateContent { - /// Initializes a new instance of BatchAccountCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The region in which to create the account. public BatchAccountCreateOrUpdateContent(AzureLocation location) { @@ -23,6 +27,38 @@ public BatchAccountCreateOrUpdateContent(AzureLocation location) AllowedAuthenticationModes = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The region in which to create the account. + /// The user-specified tags associated with the account. + /// The identity of the Batch account. Current supported identity types: None, SystemAssigned, UserAssigned. + /// The properties related to the auto-storage account. + /// The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. + /// A reference to the Azure key vault associated with the Batch account. + /// If not specified, the default value is 'enabled'. + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + /// List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. + /// Keeps track of any properties unknown to the library. + internal BatchAccountCreateOrUpdateContent(AzureLocation location, IDictionary tags, ManagedServiceIdentity identity, BatchAccountAutoStorageBaseConfiguration autoStorage, BatchAccountPoolAllocationMode? poolAllocationMode, BatchKeyVaultReference keyVaultReference, BatchPublicNetworkAccess? publicNetworkAccess, BatchNetworkProfile networkProfile, BatchAccountEncryptionConfiguration encryption, IList allowedAuthenticationModes, Dictionary serializedAdditionalRawData) + { + Location = location; + Tags = tags; + Identity = identity; + AutoStorage = autoStorage; + PoolAllocationMode = poolAllocationMode; + KeyVaultReference = keyVaultReference; + PublicNetworkAccess = publicNetworkAccess; + NetworkProfile = networkProfile; + Encryption = encryption; + AllowedAuthenticationModes = allowedAuthenticationModes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchAccountCreateOrUpdateContent() + { + } + /// The region in which to create the account. public AzureLocation Location { get; } /// The user-specified tags associated with the account. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountData.Serialization.cs index 0fb271bc40ef..42b1937326f2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchAccountData : IUtf8JsonSerializable + public partial class BatchAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -53,7 +60,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (NetworkProfile != null) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } else { @@ -61,11 +75,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountData DeserializeBatchAccountData(JsonElement element) + internal static BatchAccountData DeserializeBatchAccountData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -94,6 +122,7 @@ internal static BatchAccountData DeserializeBatchAccountData(JsonElement element Optional poolQuota = default; Optional activeJobAndJobScheduleQuota = default; Optional> allowedAuthenticationModes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -331,8 +360,61 @@ internal static BatchAccountData DeserializeBatchAccountData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountData(id, name, type, systemData.Value, identity, accountEndpoint.Value, nodeManagementEndpoint.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(poolAllocationMode), keyVaultReference.Value, Optional.ToNullable(publicNetworkAccess), networkProfile.Value, Optional.ToList(privateEndpointConnections), autoStorage.Value, encryption.Value, Optional.ToNullable(dedicatedCoreQuota), Optional.ToNullable(lowPriorityCoreQuota), Optional.ToList(dedicatedCoreQuotaPerVmFamily), Optional.ToNullable(dedicatedCoreQuotaPerVmFamilyEnforced), Optional.ToNullable(poolQuota), Optional.ToNullable(activeJobAndJobScheduleQuota), Optional.ToList(allowedAuthenticationModes), Optional.ToNullable(location), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + BatchAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountData(Response response) + { + if (response is null) + { + return null; } - return new BatchAccountData(id, name, type, systemData.Value, identity, accountEndpoint.Value, nodeManagementEndpoint.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(poolAllocationMode), keyVaultReference.Value, Optional.ToNullable(publicNetworkAccess), networkProfile.Value, Optional.ToList(privateEndpointConnections), autoStorage.Value, encryption.Value, Optional.ToNullable(dedicatedCoreQuota), Optional.ToNullable(lowPriorityCoreQuota), Optional.ToList(dedicatedCoreQuotaPerVmFamily), Optional.ToNullable(dedicatedCoreQuotaPerVmFamilyEnforced), Optional.ToNullable(poolQuota), Optional.ToNullable(activeJobAndJobScheduleQuota), Optional.ToList(allowedAuthenticationModes), Optional.ToNullable(location), Optional.ToDictionary(tags)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountDetectorData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountDetectorData.Serialization.cs index 7ed7331e2614..469829f99f2d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountDetectorData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountDetectorData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchAccountDetectorData : IUtf8JsonSerializable + public partial class BatchAccountDetectorData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountDetectorData DeserializeBatchAccountDetectorData(JsonElement element) + internal static BatchAccountDetectorData DeserializeBatchAccountDetectorData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static BatchAccountDetectorData DeserializeBatchAccountDetectorData(Jso ResourceType type = default; Optional systemData = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -92,8 +114,61 @@ internal static BatchAccountDetectorData DeserializeBatchAccountDetectorData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountDetectorData(id, name, type, systemData.Value, value.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchAccountDetectorData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountDetectorData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountDetectorData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountDetectorData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountDetectorData model) + { + if (model is null) + { + return null; } - return new BatchAccountDetectorData(id, name, type, systemData.Value, value.Value, Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountDetectorData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountDetectorData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.Serialization.cs index a63669ddaec9..e4ada797ef12 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountEncryptionConfiguration : IUtf8JsonSerializable + public partial class BatchAccountEncryptionConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeySource)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProperties)) { writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties); + if (KeyVaultProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchAccountEncryptionConfiguration DeserializeBatchAccountEncryptionConfiguration(JsonElement element) + internal static BatchAccountEncryptionConfiguration DeserializeBatchAccountEncryptionConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional keySource = default; Optional keyVaultProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keySource"u8)) @@ -56,8 +86,61 @@ internal static BatchAccountEncryptionConfiguration DeserializeBatchAccountEncry keyVaultProperties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountEncryptionConfiguration(Optional.ToNullable(keySource), keyVaultProperties.Value, serializedAdditionalRawData); + } + + BatchAccountEncryptionConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountEncryptionConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountEncryptionConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountEncryptionConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountEncryptionConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountEncryptionConfiguration(Response response) + { + if (response is null) + { + return null; } - return new BatchAccountEncryptionConfiguration(Optional.ToNullable(keySource), keyVaultProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountEncryptionConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.cs index e09761920479..11edd2ca8919 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEncryptionConfiguration.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Batch.Models { /// Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. public partial class BatchAccountEncryptionConfiguration { - /// Initializes a new instance of BatchAccountEncryptionConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountEncryptionConfiguration() { } - /// Initializes a new instance of BatchAccountEncryptionConfiguration. + /// Initializes a new instance of . /// Type of the key source. /// Additional details when using Microsoft.KeyVault. - internal BatchAccountEncryptionConfiguration(BatchAccountKeySource? keySource, KeyVaultProperties keyVaultProperties) + /// Keeps track of any properties unknown to the library. + internal BatchAccountEncryptionConfiguration(BatchAccountKeySource? keySource, KeyVaultProperties keyVaultProperties, Dictionary serializedAdditionalRawData) { KeySource = keySource; KeyVaultProperties = keyVaultProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of the key source. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.Serialization.cs index 16c59e66d4bd..d605a09e69f7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountEndpointDependency + public partial class BatchAccountEndpointDependency : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchAccountEndpointDependency DeserializeBatchAccountEndpointDependency(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchAccountEndpointDependency DeserializeBatchAccountEndpointDependency(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static BatchAccountEndpointDependency DeserializeBatchAccountEndpointDe Optional domainName = default; Optional description = default; Optional> endpointDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainName"u8)) @@ -48,8 +76,61 @@ internal static BatchAccountEndpointDependency DeserializeBatchAccountEndpointDe endpointDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountEndpointDependency(domainName.Value, description.Value, Optional.ToList(endpointDetails)); + return new BatchAccountEndpointDependency(domainName.Value, description.Value, Optional.ToList(endpointDetails), serializedAdditionalRawData); + } + + BatchAccountEndpointDependency IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountEndpointDependency(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountEndpointDependency IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountEndpointDependency(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountEndpointDependency model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountEndpointDependency(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountEndpointDependency(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.cs index 1595246590ab..f02000a4321d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountEndpointDependency.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Batch.Models /// A domain name and connection details used to access a dependency. public partial class BatchAccountEndpointDependency { - /// Initializes a new instance of BatchAccountEndpointDependency. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchAccountEndpointDependency() { EndpointDetails = new ChangeTrackingList(); } - /// Initializes a new instance of BatchAccountEndpointDependency. + /// Initializes a new instance of . /// The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. /// Human-readable supplemental information about the dependency and when it is applicable. /// The list of connection details for this endpoint. - internal BatchAccountEndpointDependency(string domainName, string description, IReadOnlyList endpointDetails) + /// Keeps track of any properties unknown to the library. + internal BatchAccountEndpointDependency(string domainName, string description, IReadOnlyList endpointDetails, Dictionary serializedAdditionalRawData) { DomainName = domainName; Description = description; EndpointDetails = endpointDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.Serialization.cs index d12e0dbc9ca5..37ea425a9461 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountFixedScaleSettings : IUtf8JsonSerializable + public partial class BatchAccountFixedScaleSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResizeTimeout)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("nodeDeallocationOption"u8); writer.WriteStringValue(NodeDeallocationOption.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountFixedScaleSettings DeserializeBatchAccountFixedScaleSettings(JsonElement element) + internal static BatchAccountFixedScaleSettings DeserializeBatchAccountFixedScaleSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static BatchAccountFixedScaleSettings DeserializeBatchAccountFixedScale Optional targetDedicatedNodes = default; Optional targetLowPriorityNodes = default; Optional nodeDeallocationOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resizeTimeout"u8)) @@ -87,8 +109,61 @@ internal static BatchAccountFixedScaleSettings DeserializeBatchAccountFixedScale nodeDeallocationOption = property.Value.GetString().ToBatchNodeDeallocationOption(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountFixedScaleSettings(Optional.ToNullable(resizeTimeout), Optional.ToNullable(targetDedicatedNodes), Optional.ToNullable(targetLowPriorityNodes), Optional.ToNullable(nodeDeallocationOption), serializedAdditionalRawData); + } + + BatchAccountFixedScaleSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountFixedScaleSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountFixedScaleSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountFixedScaleSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountFixedScaleSettings model) + { + if (model is null) + { + return null; } - return new BatchAccountFixedScaleSettings(Optional.ToNullable(resizeTimeout), Optional.ToNullable(targetDedicatedNodes), Optional.ToNullable(targetLowPriorityNodes), Optional.ToNullable(nodeDeallocationOption)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountFixedScaleSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountFixedScaleSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.cs index a1e7dc1629c4..eb84792ea40a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountFixedScaleSettings.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Batch.Models { /// Fixed scale settings for the pool. public partial class BatchAccountFixedScaleSettings { - /// Initializes a new instance of BatchAccountFixedScaleSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountFixedScaleSettings() { } - /// Initializes a new instance of BatchAccountFixedScaleSettings. + /// Initializes a new instance of . /// The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). /// At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. /// At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. /// If omitted, the default value is Requeue. - internal BatchAccountFixedScaleSettings(TimeSpan? resizeTimeout, int? targetDedicatedNodes, int? targetLowPriorityNodes, BatchNodeDeallocationOption? nodeDeallocationOption) + /// Keeps track of any properties unknown to the library. + internal BatchAccountFixedScaleSettings(TimeSpan? resizeTimeout, int? targetDedicatedNodes, int? targetLowPriorityNodes, BatchNodeDeallocationOption? nodeDeallocationOption, Dictionary serializedAdditionalRawData) { ResizeTimeout = resizeTimeout; TargetDedicatedNodes = targetDedicatedNodes; TargetLowPriorityNodes = targetLowPriorityNodes; NodeDeallocationOption = nodeDeallocationOption; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.Serialization.cs index bc2f06288851..9a2f977a7edd 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountKeys + public partial class BatchAccountKeys : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchAccountKeys DeserializeBatchAccountKeys(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchAccountKeys DeserializeBatchAccountKeys(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static BatchAccountKeys DeserializeBatchAccountKeys(JsonElement element Optional accountName = default; Optional primary = default; Optional secondary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -38,8 +67,61 @@ internal static BatchAccountKeys DeserializeBatchAccountKeys(JsonElement element secondary = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountKeys(accountName.Value, primary.Value, secondary.Value); + return new BatchAccountKeys(accountName.Value, primary.Value, secondary.Value, serializedAdditionalRawData); + } + + BatchAccountKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountKeys model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.cs index c77fe708a43b..23fd8236e3bc 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountKeys.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// A set of Azure Batch account keys. public partial class BatchAccountKeys { - /// Initializes a new instance of BatchAccountKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchAccountKeys() { } - /// Initializes a new instance of BatchAccountKeys. + /// Initializes a new instance of . /// The Batch account name. /// The primary key associated with the account. /// The secondary key associated with the account. - internal BatchAccountKeys(string accountName, string primary, string secondary) + /// Keeps track of any properties unknown to the library. + internal BatchAccountKeys(string accountName, string primary, string secondary, Dictionary serializedAdditionalRawData) { AccountName = accountName; Primary = primary; Secondary = secondary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Batch account name. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.Serialization.cs index 734d4b0ffeb9..8a6a9204e9b3 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class BatchAccountListResult + internal partial class BatchAccountListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchAccountListResult DeserializeBatchAccountListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchAccountListResult DeserializeBatchAccountListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static BatchAccountListResult DeserializeBatchAccountListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountListResult(Optional.ToList(value), nextLink.Value); + return new BatchAccountListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BatchAccountListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.cs index 56ea176a3713..0ce79a73a75b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class BatchAccountListResult { - /// Initializes a new instance of BatchAccountListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchAccountListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BatchAccountListResult. + /// Initializes a new instance of . /// The collection of Batch accounts returned by the listing operation. /// The continuation token. - internal BatchAccountListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BatchAccountListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of Batch accounts returned by the listing operation. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.Serialization.cs index 36a43261a9bc..68a6f353a0b5 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountOutboundEnvironmentEndpoint + public partial class BatchAccountOutboundEnvironmentEndpoint : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchAccountOutboundEnvironmentEndpoint DeserializeBatchAccountOutboundEnvironmentEndpoint(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchAccountOutboundEnvironmentEndpoint DeserializeBatchAccountOutboundEnvironmentEndpoint(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional category = default; Optional> endpoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -42,8 +70,61 @@ internal static BatchAccountOutboundEnvironmentEndpoint DeserializeBatchAccountO endpoints = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountOutboundEnvironmentEndpoint(category.Value, Optional.ToList(endpoints)); + return new BatchAccountOutboundEnvironmentEndpoint(category.Value, Optional.ToList(endpoints), serializedAdditionalRawData); + } + + BatchAccountOutboundEnvironmentEndpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountOutboundEnvironmentEndpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountOutboundEnvironmentEndpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountOutboundEnvironmentEndpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountOutboundEnvironmentEndpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountOutboundEnvironmentEndpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountOutboundEnvironmentEndpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.cs index fa84a684bafe..aaba906dae1a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountOutboundEnvironmentEndpoint.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Batch.Models /// A collection of related endpoints from the same service for which the Batch service requires outbound access. public partial class BatchAccountOutboundEnvironmentEndpoint { - /// Initializes a new instance of BatchAccountOutboundEnvironmentEndpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchAccountOutboundEnvironmentEndpoint() { Endpoints = new ChangeTrackingList(); } - /// Initializes a new instance of BatchAccountOutboundEnvironmentEndpoint. + /// Initializes a new instance of . /// The type of service that the Batch service connects to. /// The endpoints for this service to which the Batch service makes outbound calls. - internal BatchAccountOutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints) + /// Keeps track of any properties unknown to the library. + internal BatchAccountOutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints, Dictionary serializedAdditionalRawData) { Category = category; Endpoints = endpoints; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of service that the Batch service connects to. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.Serialization.cs index 515a8dc366fb..af476adbc44f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountPatch : IUtf8JsonSerializable + public partial class BatchAccountPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,12 +45,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoStorage)) { writer.WritePropertyName("autoStorage"u8); - writer.WriteObjectValue(AutoStorage); + if (AutoStorage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoStorage).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AllowedAuthenticationModes)) { @@ -68,10 +91,190 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BatchAccountPatch DeserializeBatchAccountPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional autoStorage = default; + Optional encryption = default; + Optional> allowedAuthenticationModes = default; + Optional publicNetworkAccess = default; + Optional networkProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("autoStorage"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoStorage = BatchAccountAutoStorageBaseConfiguration.DeserializeBatchAccountAutoStorageBaseConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = BatchAccountEncryptionConfiguration.DeserializeBatchAccountEncryptionConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("allowedAuthenticationModes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + allowedAuthenticationModes = null; + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString().ToBatchAuthenticationMode()); + } + allowedAuthenticationModes = array; + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = property0.Value.GetString().ToBatchPublicNetworkAccess(); + continue; + } + if (property0.NameEquals("networkProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = BatchNetworkProfile.DeserializeBatchNetworkProfile(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountPatch(Optional.ToDictionary(tags), identity, autoStorage.Value, encryption.Value, Optional.ToList(allowedAuthenticationModes), Optional.ToNullable(publicNetworkAccess), networkProfile.Value, serializedAdditionalRawData); + } + + BatchAccountPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.cs index af93c8d8ea8a..c787e6bd68eb 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,37 @@ namespace Azure.ResourceManager.Batch.Models /// Parameters for updating an Azure Batch account. public partial class BatchAccountPatch { - /// Initializes a new instance of BatchAccountPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountPatch() { Tags = new ChangeTrackingDictionary(); AllowedAuthenticationModes = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The user-specified tags associated with the account. + /// The identity of the Batch account. Current supported identity types: None, SystemAssigned, UserAssigned. + /// The properties related to the auto-storage account. + /// Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + /// List of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane. + /// If not specified, the default value is 'enabled'. + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// Keeps track of any properties unknown to the library. + internal BatchAccountPatch(IDictionary tags, ManagedServiceIdentity identity, BatchAccountAutoStorageBaseConfiguration autoStorage, BatchAccountEncryptionConfiguration encryption, IList allowedAuthenticationModes, BatchPublicNetworkAccess? publicNetworkAccess, BatchNetworkProfile networkProfile, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + AutoStorage = autoStorage; + Encryption = encryption; + AllowedAuthenticationModes = allowedAuthenticationModes; + PublicNetworkAccess = publicNetworkAccess; + NetworkProfile = networkProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The user-specified tags associated with the account. public IDictionary Tags { get; } /// The identity of the Batch account. Current supported identity types: None, SystemAssigned, UserAssigned. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.Serialization.cs index f01fa3190d46..a6b4560761a6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.Serialization.cs @@ -6,16 +6,54 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountPoolAutoScaleRun + public partial class BatchAccountPoolAutoScaleRun : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchAccountPoolAutoScaleRun DeserializeBatchAccountPoolAutoScaleRun(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("evaluationTime"u8); + writer.WriteStringValue(EvaluationOn, "O"); + if (Optional.IsDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStringValue(Results); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchAccountPoolAutoScaleRun DeserializeBatchAccountPoolAutoScaleRun(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +61,7 @@ internal static BatchAccountPoolAutoScaleRun DeserializeBatchAccountPoolAutoScal DateTimeOffset evaluationTime = default; Optional results = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("evaluationTime"u8)) @@ -44,8 +83,61 @@ internal static BatchAccountPoolAutoScaleRun DeserializeBatchAccountPoolAutoScal error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountPoolAutoScaleRun(evaluationTime, results.Value, error.Value); + return new BatchAccountPoolAutoScaleRun(evaluationTime, results.Value, error.Value, serializedAdditionalRawData); + } + + BatchAccountPoolAutoScaleRun IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountPoolAutoScaleRun(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountPoolAutoScaleRun IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountPoolAutoScaleRun(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountPoolAutoScaleRun model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountPoolAutoScaleRun(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountPoolAutoScaleRun(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.cs index 383653c4b681..e1c9eecb2210 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolAutoScaleRun.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.Batch.Models @@ -13,22 +14,32 @@ namespace Azure.ResourceManager.Batch.Models /// The results and errors from an execution of a pool autoscale formula. public partial class BatchAccountPoolAutoScaleRun { - /// Initializes a new instance of BatchAccountPoolAutoScaleRun. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The time at which the autoscale formula was last evaluated. internal BatchAccountPoolAutoScaleRun(DateTimeOffset evaluationOn) { EvaluationOn = evaluationOn; } - /// Initializes a new instance of BatchAccountPoolAutoScaleRun. + /// Initializes a new instance of . /// The time at which the autoscale formula was last evaluated. /// Each variable value is returned in the form $variable=value, and variables are separated by semicolons. /// An error that occurred when autoscaling a pool. - internal BatchAccountPoolAutoScaleRun(DateTimeOffset evaluationOn, string results, ResponseError error) + /// Keeps track of any properties unknown to the library. + internal BatchAccountPoolAutoScaleRun(DateTimeOffset evaluationOn, string results, ResponseError error, Dictionary serializedAdditionalRawData) { EvaluationOn = evaluationOn; Results = results; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchAccountPoolAutoScaleRun() + { } /// The time at which the autoscale formula was last evaluated. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolData.Serialization.cs index 6824b7bd86c8..35d983f08603 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchAccountPoolData : IUtf8JsonSerializable + public partial class BatchAccountPoolData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -40,12 +45,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DeploymentConfiguration)) { writer.WritePropertyName("deploymentConfiguration"u8); - writer.WriteObjectValue(DeploymentConfiguration); + if (DeploymentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeploymentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(ScaleSettings)) { writer.WritePropertyName("scaleSettings"u8); - writer.WriteObjectValue(ScaleSettings); + if (ScaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScaleSettings).Serialize(writer, options); + } } if (Optional.IsDefined(InterNodeCommunication)) { @@ -55,7 +74,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkConfiguration)) { writer.WritePropertyName("networkConfiguration"u8); - writer.WriteObjectValue(NetworkConfiguration); + if (NetworkConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(TaskSlotsPerNode)) { @@ -65,7 +91,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TaskSchedulingPolicy)) { writer.WritePropertyName("taskSchedulingPolicy"u8); - writer.WriteObjectValue(TaskSchedulingPolicy); + if (TaskSchedulingPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TaskSchedulingPolicy).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(UserAccounts)) { @@ -73,7 +106,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserAccounts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -83,14 +123,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Metadata) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(StartTask)) { writer.WritePropertyName("startTask"u8); - writer.WriteObjectValue(StartTask); + if (StartTask is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StartTask).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Certificates)) { @@ -98,7 +152,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Certificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -108,7 +169,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationPackages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -128,7 +196,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MountConfiguration) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -138,11 +213,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(TargetNodeCommunicationMode.Value.ToSerialString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountPoolData DeserializeBatchAccountPoolData(JsonElement element) + internal static BatchAccountPoolData DeserializeBatchAccountPoolData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -180,6 +269,7 @@ internal static BatchAccountPoolData DeserializeBatchAccountPoolData(JsonElement Optional> mountConfiguration = default; Optional targetNodeCommunicationMode = default; Optional currentNodeCommunicationMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -502,8 +592,61 @@ internal static BatchAccountPoolData DeserializeBatchAccountPoolData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountPoolData(id, name, type, systemData.Value, identity, displayName.Value, Optional.ToNullable(lastModified), Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), Optional.ToNullable(provisioningStateTransitionTime), Optional.ToNullable(allocationState), Optional.ToNullable(allocationStateTransitionTime), vmSize.Value, deploymentConfiguration.Value, Optional.ToNullable(currentDedicatedNodes), Optional.ToNullable(currentLowPriorityNodes), scaleSettings.Value, autoScaleRun.Value, Optional.ToNullable(interNodeCommunication), networkConfiguration.Value, Optional.ToNullable(taskSlotsPerNode), taskSchedulingPolicy.Value, Optional.ToList(userAccounts), Optional.ToList(metadata), startTask.Value, Optional.ToList(certificates), Optional.ToList(applicationPackages), Optional.ToList(applicationLicenses), resizeOperationStatus.Value, Optional.ToList(mountConfiguration), Optional.ToNullable(targetNodeCommunicationMode), Optional.ToNullable(currentNodeCommunicationMode), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchAccountPoolData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountPoolData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountPoolData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountPoolData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountPoolData model) + { + if (model is null) + { + return null; } - return new BatchAccountPoolData(id, name, type, systemData.Value, identity, displayName.Value, Optional.ToNullable(lastModified), Optional.ToNullable(creationTime), Optional.ToNullable(provisioningState), Optional.ToNullable(provisioningStateTransitionTime), Optional.ToNullable(allocationState), Optional.ToNullable(allocationStateTransitionTime), vmSize.Value, deploymentConfiguration.Value, Optional.ToNullable(currentDedicatedNodes), Optional.ToNullable(currentLowPriorityNodes), scaleSettings.Value, autoScaleRun.Value, Optional.ToNullable(interNodeCommunication), networkConfiguration.Value, Optional.ToNullable(taskSlotsPerNode), taskSchedulingPolicy.Value, Optional.ToList(userAccounts), Optional.ToList(metadata), startTask.Value, Optional.ToList(certificates), Optional.ToList(applicationPackages), Optional.ToList(applicationLicenses), resizeOperationStatus.Value, Optional.ToList(mountConfiguration), Optional.ToNullable(targetNodeCommunicationMode), Optional.ToNullable(currentNodeCommunicationMode), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountPoolData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountPoolData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.Serialization.cs index 12784a815500..d34670950e8f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountPoolMetadataItem : IUtf8JsonSerializable + public partial class BatchAccountPoolMetadataItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAccountPoolMetadataItem DeserializeBatchAccountPoolMetadataItem(JsonElement element) + internal static BatchAccountPoolMetadataItem DeserializeBatchAccountPoolMetadataItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +65,61 @@ internal static BatchAccountPoolMetadataItem DeserializeBatchAccountPoolMetadata value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountPoolMetadataItem(name, value, serializedAdditionalRawData); + } + + BatchAccountPoolMetadataItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountPoolMetadataItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountPoolMetadataItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountPoolMetadataItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountPoolMetadataItem model) + { + if (model is null) + { + return null; } - return new BatchAccountPoolMetadataItem(name, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountPoolMetadataItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountPoolMetadataItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.cs index 79fa981f9391..5a030ad5232e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolMetadataItem.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The Batch service does not assign any meaning to this metadata; it is solely for the use of user code. public partial class BatchAccountPoolMetadataItem { - /// Initializes a new instance of BatchAccountPoolMetadataItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the metadata item. /// The value of the metadata item. /// or is null. @@ -26,6 +30,22 @@ public BatchAccountPoolMetadataItem(string name, string value) Value = value; } + /// Initializes a new instance of . + /// The name of the metadata item. + /// The value of the metadata item. + /// Keeps track of any properties unknown to the library. + internal BatchAccountPoolMetadataItem(string name, string value, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchAccountPoolMetadataItem() + { + } + /// The name of the metadata item. public string Name { get; set; } /// The value of the metadata item. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.Serialization.cs index c931d36e65e6..0dbea4273114 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountPoolScaleSettings : IUtf8JsonSerializable + public partial class BatchAccountPoolScaleSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FixedScale)) { writer.WritePropertyName("fixedScale"u8); - writer.WriteObjectValue(FixedScale); + if (FixedScale is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FixedScale).Serialize(writer, options); + } } if (Optional.IsDefined(AutoScale)) { writer.WritePropertyName("autoScale"u8); - writer.WriteObjectValue(AutoScale); + if (AutoScale is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoScale).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchAccountPoolScaleSettings DeserializeBatchAccountPoolScaleSettings(JsonElement element) + internal static BatchAccountPoolScaleSettings DeserializeBatchAccountPoolScaleSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional fixedScale = default; Optional autoScale = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("fixedScale"u8)) @@ -56,8 +93,61 @@ internal static BatchAccountPoolScaleSettings DeserializeBatchAccountPoolScaleSe autoScale = BatchAccountAutoScaleSettings.DeserializeBatchAccountAutoScaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountPoolScaleSettings(fixedScale.Value, autoScale.Value, serializedAdditionalRawData); + } + + BatchAccountPoolScaleSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountPoolScaleSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountPoolScaleSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountPoolScaleSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountPoolScaleSettings model) + { + if (model is null) + { + return null; } - return new BatchAccountPoolScaleSettings(fixedScale.Value, autoScale.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountPoolScaleSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountPoolScaleSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.cs index b842f469cb04..a8ec5447ccff 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolScaleSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Defines the desired size of the pool. This can either be 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. public partial class BatchAccountPoolScaleSettings { - /// Initializes a new instance of BatchAccountPoolScaleSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountPoolScaleSettings() { } - /// Initializes a new instance of BatchAccountPoolScaleSettings. + /// Initializes a new instance of . /// This property and autoScale are mutually exclusive and one of the properties must be specified. /// This property and fixedScale are mutually exclusive and one of the properties must be specified. - internal BatchAccountPoolScaleSettings(BatchAccountFixedScaleSettings fixedScale, BatchAccountAutoScaleSettings autoScale) + /// Keeps track of any properties unknown to the library. + internal BatchAccountPoolScaleSettings(BatchAccountFixedScaleSettings fixedScale, BatchAccountAutoScaleSettings autoScale, Dictionary serializedAdditionalRawData) { FixedScale = fixedScale; AutoScale = autoScale; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property and autoScale are mutually exclusive and one of the properties must be specified. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.Serialization.cs index 6ed49ff2de80..0f50a9240631 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountPoolStartTask : IUtf8JsonSerializable + public partial class BatchAccountPoolStartTask : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CommandLine)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ResourceFiles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,14 +51,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EnvironmentSettings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(UserIdentity)) { writer.WritePropertyName("userIdentity"u8); - writer.WriteObjectValue(UserIdentity); + if (UserIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(MaxTaskRetryCount)) { @@ -59,13 +87,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContainerSettings)) { writer.WritePropertyName("containerSettings"u8); - writer.WriteObjectValue(ContainerSettings); + if (ContainerSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContainerSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchAccountPoolStartTask DeserializeBatchAccountPoolStartTask(JsonElement element) + internal static BatchAccountPoolStartTask DeserializeBatchAccountPoolStartTask(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +126,7 @@ internal static BatchAccountPoolStartTask DeserializeBatchAccountPoolStartTask(J Optional maxTaskRetryCount = default; Optional waitForSuccess = default; Optional containerSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("commandLine"u8)) @@ -148,8 +198,61 @@ internal static BatchAccountPoolStartTask DeserializeBatchAccountPoolStartTask(J containerSettings = BatchTaskContainerSettings.DeserializeBatchTaskContainerSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchAccountPoolStartTask(commandLine.Value, Optional.ToList(resourceFiles), Optional.ToList(environmentSettings), userIdentity.Value, Optional.ToNullable(maxTaskRetryCount), Optional.ToNullable(waitForSuccess), containerSettings.Value); + return new BatchAccountPoolStartTask(commandLine.Value, Optional.ToList(resourceFiles), Optional.ToList(environmentSettings), userIdentity.Value, Optional.ToNullable(maxTaskRetryCount), Optional.ToNullable(waitForSuccess), containerSettings.Value, serializedAdditionalRawData); + } + + BatchAccountPoolStartTask IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountPoolStartTask(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountPoolStartTask IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountPoolStartTask(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountPoolStartTask model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountPoolStartTask(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountPoolStartTask(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.cs index f04f01cbcbe1..f82d2694f0be 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountPoolStartTask.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.Batch.Models /// In some cases the start task may be re-run even though the node was not rebooted. Due to this, start tasks should be idempotent and exit gracefully if the setup they're performing has already been done. Special care should be taken to avoid start tasks which create breakaway process or install/launch services from the start task working directory, as this will block Batch from being able to re-run the start task. public partial class BatchAccountPoolStartTask { - /// Initializes a new instance of BatchAccountPoolStartTask. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAccountPoolStartTask() { ResourceFiles = new ChangeTrackingList(); EnvironmentSettings = new ChangeTrackingList(); } - /// Initializes a new instance of BatchAccountPoolStartTask. + /// Initializes a new instance of . /// The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. /// A list of files that the Batch service will download to the compute node before running the command line. /// A list of environment variable settings for the start task. @@ -28,7 +32,8 @@ public BatchAccountPoolStartTask() /// The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. /// If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. /// When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. - internal BatchAccountPoolStartTask(string commandLine, IList resourceFiles, IList environmentSettings, BatchUserIdentity userIdentity, int? maxTaskRetryCount, bool? waitForSuccess, BatchTaskContainerSettings containerSettings) + /// Keeps track of any properties unknown to the library. + internal BatchAccountPoolStartTask(string commandLine, IList resourceFiles, IList environmentSettings, BatchUserIdentity userIdentity, int? maxTaskRetryCount, bool? waitForSuccess, BatchTaskContainerSettings containerSettings, Dictionary serializedAdditionalRawData) { CommandLine = commandLine; ResourceFiles = resourceFiles; @@ -37,6 +42,7 @@ internal BatchAccountPoolStartTask(string commandLine, IList MaxTaskRetryCount = maxTaskRetryCount; WaitForSuccess = waitForSuccess; ContainerSettings = containerSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.Serialization.cs index 5fa977fdb558..6c746c56e437 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAccountRegenerateKeyContent : IUtf8JsonSerializable + public partial class BatchAccountRegenerateKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BatchAccountRegenerateKeyContent DeserializeBatchAccountRegenerateKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BatchAccountKeyType keyName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyName"u8)) + { + keyName = property.Value.GetString().ToBatchAccountKeyType(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAccountRegenerateKeyContent(keyName, serializedAdditionalRawData); + } + + BatchAccountRegenerateKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAccountRegenerateKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAccountRegenerateKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAccountRegenerateKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAccountRegenerateKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAccountRegenerateKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAccountRegenerateKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.cs index 08b342e91703..1959f17b7be3 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAccountRegenerateKeyContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Parameters supplied to the RegenerateKey operation. public partial class BatchAccountRegenerateKeyContent { - /// Initializes a new instance of BatchAccountRegenerateKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of account key to regenerate. public BatchAccountRegenerateKeyContent(BatchAccountKeyType keyType) { KeyType = keyType; } + /// Initializes a new instance of . + /// The type of account key to regenerate. + /// Keeps track of any properties unknown to the library. + internal BatchAccountRegenerateKeyContent(BatchAccountKeyType keyType, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchAccountRegenerateKeyContent() + { + } + /// The type of account key to regenerate. public BatchAccountKeyType KeyType { get; } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationData.Serialization.cs index b7352c7b7b8f..3b7a1bcb74c0 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchApplicationData : IUtf8JsonSerializable + public partial class BatchApplicationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DefaultVersion); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchApplicationData DeserializeBatchApplicationData(JsonElement element) + internal static BatchApplicationData DeserializeBatchApplicationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +73,7 @@ internal static BatchApplicationData DeserializeBatchApplicationData(JsonElement Optional displayName = default; Optional allowUpdates = default; Optional defaultVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -118,8 +140,61 @@ internal static BatchApplicationData DeserializeBatchApplicationData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchApplicationData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(allowUpdates), defaultVersion.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchApplicationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchApplicationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchApplicationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchApplicationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchApplicationData model) + { + if (model is null) + { + return null; } - return new BatchApplicationData(id, name, type, systemData.Value, displayName.Value, Optional.ToNullable(allowUpdates), defaultVersion.Value, Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchApplicationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchApplicationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.Serialization.cs index bac2acbdaa3b..b8bfe49cb3dc 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchApplicationPackageActivateContent : IUtf8JsonSerializable + public partial class BatchApplicationPackageActivateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("format"u8); writer.WriteStringValue(Format); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BatchApplicationPackageActivateContent DeserializeBatchApplicationPackageActivateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string format = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("format"u8)) + { + format = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchApplicationPackageActivateContent(format, serializedAdditionalRawData); + } + + BatchApplicationPackageActivateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchApplicationPackageActivateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchApplicationPackageActivateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchApplicationPackageActivateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchApplicationPackageActivateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchApplicationPackageActivateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchApplicationPackageActivateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.cs index 37e4ba99f1a9..9ff832bf0b06 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageActivateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Parameters for an activating an application package. public partial class BatchApplicationPackageActivateContent { - /// Initializes a new instance of BatchApplicationPackageActivateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The format of the application package binary file. /// is null. public BatchApplicationPackageActivateContent(string format) @@ -23,6 +27,20 @@ public BatchApplicationPackageActivateContent(string format) Format = format; } + /// Initializes a new instance of . + /// The format of the application package binary file. + /// Keeps track of any properties unknown to the library. + internal BatchApplicationPackageActivateContent(string format, Dictionary serializedAdditionalRawData) + { + Format = format; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchApplicationPackageActivateContent() + { + } + /// The format of the application package binary file. public string Format { get; } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageData.Serialization.cs index cf0d6915aa56..09d925d1bf3d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageData.Serialization.cs @@ -6,27 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchApplicationPackageData : IUtf8JsonSerializable + public partial class BatchApplicationPackageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchApplicationPackageData DeserializeBatchApplicationPackageData(JsonElement element) + internal static BatchApplicationPackageData DeserializeBatchApplicationPackageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +61,7 @@ internal static BatchApplicationPackageData DeserializeBatchApplicationPackageDa Optional storageUrl = default; Optional storageUrlExpiry = default; Optional lastActivationTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -129,8 +150,61 @@ internal static BatchApplicationPackageData DeserializeBatchApplicationPackageDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchApplicationPackageData(id, name, type, systemData.Value, Optional.ToNullable(state), format.Value, storageUrl.Value, Optional.ToNullable(storageUrlExpiry), Optional.ToNullable(lastActivationTime), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchApplicationPackageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchApplicationPackageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchApplicationPackageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchApplicationPackageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchApplicationPackageData model) + { + if (model is null) + { + return null; } - return new BatchApplicationPackageData(id, name, type, systemData.Value, Optional.ToNullable(state), format.Value, storageUrl.Value, Optional.ToNullable(storageUrlExpiry), Optional.ToNullable(lastActivationTime), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchApplicationPackageData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchApplicationPackageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.Serialization.cs index 4119ba0f7b43..a4675269e1a4 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchApplicationPackageReference : IUtf8JsonSerializable + public partial class BatchApplicationPackageReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchApplicationPackageReference DeserializeBatchApplicationPackageReference(JsonElement element) + internal static BatchApplicationPackageReference DeserializeBatchApplicationPackageReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -45,8 +68,61 @@ internal static BatchApplicationPackageReference DeserializeBatchApplicationPack version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchApplicationPackageReference(id, version.Value, serializedAdditionalRawData); + } + + BatchApplicationPackageReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchApplicationPackageReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchApplicationPackageReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchApplicationPackageReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchApplicationPackageReference model) + { + if (model is null) + { + return null; } - return new BatchApplicationPackageReference(id, version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchApplicationPackageReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchApplicationPackageReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.cs index 045454051545..be9a631eead9 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchApplicationPackageReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Link to an application package inside the batch account. public partial class BatchApplicationPackageReference { - /// Initializes a new instance of BatchApplicationPackageReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The ID of the application package to install. This must be inside the same batch account as the pool. This can either be a reference to a specific version or the default version if one exists. /// is null. public BatchApplicationPackageReference(ResourceIdentifier id) @@ -23,13 +27,20 @@ public BatchApplicationPackageReference(ResourceIdentifier id) Id = id; } - /// Initializes a new instance of BatchApplicationPackageReference. + /// Initializes a new instance of . /// The ID of the application package to install. This must be inside the same batch account as the pool. This can either be a reference to a specific version or the default version if one exists. /// If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. - internal BatchApplicationPackageReference(ResourceIdentifier id, string version) + /// Keeps track of any properties unknown to the library. + internal BatchApplicationPackageReference(ResourceIdentifier id, string version, Dictionary serializedAdditionalRawData) { Id = id; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchApplicationPackageReference() + { } /// The ID of the application package to install. This must be inside the same batch account as the pool. This can either be a reference to a specific version or the default version if one exists. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.Serialization.cs index be0bb3f6ade9..01d58b314c49 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchAutoUserSpecification : IUtf8JsonSerializable + public partial class BatchAutoUserSpecification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Scope)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("elevationLevel"u8); writer.WriteStringValue(ElevationLevel.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchAutoUserSpecification DeserializeBatchAutoUserSpecification(JsonElement element) + internal static BatchAutoUserSpecification DeserializeBatchAutoUserSpecification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional scope = default; Optional elevationLevel = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scope"u8)) @@ -56,8 +79,61 @@ internal static BatchAutoUserSpecification DeserializeBatchAutoUserSpecification elevationLevel = property.Value.GetString().ToBatchUserAccountElevationLevel(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchAutoUserSpecification(Optional.ToNullable(scope), Optional.ToNullable(elevationLevel), serializedAdditionalRawData); + } + + BatchAutoUserSpecification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchAutoUserSpecification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchAutoUserSpecification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchAutoUserSpecification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchAutoUserSpecification model) + { + if (model is null) + { + return null; } - return new BatchAutoUserSpecification(Optional.ToNullable(scope), Optional.ToNullable(elevationLevel)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchAutoUserSpecification(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchAutoUserSpecification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.cs index 87c9dda015c3..592c83668186 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchAutoUserSpecification.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Specifies the parameters for the auto user that runs a task on the Batch service. public partial class BatchAutoUserSpecification { - /// Initializes a new instance of BatchAutoUserSpecification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchAutoUserSpecification() { } - /// Initializes a new instance of BatchAutoUserSpecification. + /// Initializes a new instance of . /// The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. /// The default value is nonAdmin. - internal BatchAutoUserSpecification(BatchAutoUserScope? scope, BatchUserAccountElevationLevel? elevationLevel) + /// Keeps track of any properties unknown to the library. + internal BatchAutoUserSpecification(BatchAutoUserScope? scope, BatchUserAccountElevationLevel? elevationLevel, Dictionary serializedAdditionalRawData) { Scope = scope; ElevationLevel = elevationLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.Serialization.cs index 71d8aff47552..928f474feb3e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchBlobFileSystemConfiguration : IUtf8JsonSerializable + public partial class BatchBlobFileSystemConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("accountName"u8); writer.WriteStringValue(AccountName); @@ -39,13 +47,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identityReference"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchBlobFileSystemConfiguration DeserializeBatchBlobFileSystemConfiguration(JsonElement element) + internal static BatchBlobFileSystemConfiguration DeserializeBatchBlobFileSystemConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +86,7 @@ internal static BatchBlobFileSystemConfiguration DeserializeBatchBlobFileSystemC Optional blobfuseOptions = default; string relativeMountPath = default; Optional identityReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -98,8 +128,61 @@ internal static BatchBlobFileSystemConfiguration DeserializeBatchBlobFileSystemC identityReference = ComputeNodeIdentityReference.DeserializeComputeNodeIdentityReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchBlobFileSystemConfiguration(accountName, containerName, accountKey.Value, sasKey.Value, blobfuseOptions.Value, relativeMountPath, identityReference.Value, serializedAdditionalRawData); + } + + BatchBlobFileSystemConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchBlobFileSystemConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchBlobFileSystemConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchBlobFileSystemConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchBlobFileSystemConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchBlobFileSystemConfiguration(Response response) + { + if (response is null) + { + return null; } - return new BatchBlobFileSystemConfiguration(accountName, containerName, accountKey.Value, sasKey.Value, blobfuseOptions.Value, relativeMountPath, identityReference.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchBlobFileSystemConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.cs index f084ffd9b951..c62d7ee25c39 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchBlobFileSystemConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Information used to connect to an Azure Storage Container using Blobfuse. public partial class BatchBlobFileSystemConfiguration { - /// Initializes a new instance of BatchBlobFileSystemConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Azure Storage Account name. /// The Azure Blob Storage Container name. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. @@ -29,7 +33,7 @@ public BatchBlobFileSystemConfiguration(string accountName, string containerName RelativeMountPath = relativeMountPath; } - /// Initializes a new instance of BatchBlobFileSystemConfiguration. + /// Initializes a new instance of . /// The Azure Storage Account name. /// The Azure Blob Storage Container name. /// This property is mutually exclusive with both sasKey and identity; exactly one must be specified. @@ -37,7 +41,8 @@ public BatchBlobFileSystemConfiguration(string accountName, string containerName /// These are 'net use' options in Windows and 'mount' options in Linux. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. /// This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified. - internal BatchBlobFileSystemConfiguration(string accountName, string containerName, string accountKey, string sasKey, string blobfuseOptions, string relativeMountPath, ComputeNodeIdentityReference identity) + /// Keeps track of any properties unknown to the library. + internal BatchBlobFileSystemConfiguration(string accountName, string containerName, string accountKey, string sasKey, string blobfuseOptions, string relativeMountPath, ComputeNodeIdentityReference identity, Dictionary serializedAdditionalRawData) { AccountName = accountName; ContainerName = containerName; @@ -46,6 +51,12 @@ internal BatchBlobFileSystemConfiguration(string accountName, string containerNa BlobfuseOptions = blobfuseOptions; RelativeMountPath = relativeMountPath; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchBlobFileSystemConfiguration() + { } /// The Azure Storage Account name. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.Serialization.cs index 690062b7f3ce..1af6fae8edaa 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchCertificateReference : IUtf8JsonSerializable + public partial class BatchCertificateReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -38,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchCertificateReference DeserializeBatchCertificateReference(JsonElement element) + internal static BatchCertificateReference DeserializeBatchCertificateReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +72,7 @@ internal static BatchCertificateReference DeserializeBatchCertificateReference(J Optional storeLocation = default; Optional storeName = default; Optional> visibility = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +108,61 @@ internal static BatchCertificateReference DeserializeBatchCertificateReference(J visibility = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchCertificateReference(id, Optional.ToNullable(storeLocation), storeName.Value, Optional.ToList(visibility), serializedAdditionalRawData); + } + + BatchCertificateReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchCertificateReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchCertificateReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchCertificateReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchCertificateReference model) + { + if (model is null) + { + return null; } - return new BatchCertificateReference(id, Optional.ToNullable(storeLocation), storeName.Value, Optional.ToList(visibility)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchCertificateReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchCertificateReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.cs index 543d56cb3c7f..d43e52b8827f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCertificateReference.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Warning: This object is deprecated and will be removed after February, 2024. Please use the [Azure KeyVault Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) instead. public partial class BatchCertificateReference { - /// Initializes a new instance of BatchCertificateReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The fully qualified ID of the certificate to install on the pool. This must be inside the same batch account as the pool. /// is null. public BatchCertificateReference(ResourceIdentifier id) @@ -25,17 +28,24 @@ public BatchCertificateReference(ResourceIdentifier id) Visibility = new ChangeTrackingList(); } - /// Initializes a new instance of BatchCertificateReference. + /// Initializes a new instance of . /// The fully qualified ID of the certificate to install on the pool. This must be inside the same batch account as the pool. /// The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. /// This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. /// Which user accounts on the compute node should have access to the private data of the certificate. - internal BatchCertificateReference(ResourceIdentifier id, BatchCertificateStoreLocation? storeLocation, string storeName, IList visibility) + /// Keeps track of any properties unknown to the library. + internal BatchCertificateReference(ResourceIdentifier id, BatchCertificateStoreLocation? storeLocation, string storeName, IList visibility, Dictionary serializedAdditionalRawData) { Id = id; StoreLocation = storeLocation; StoreName = storeName; Visibility = visibility; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchCertificateReference() + { } /// The fully qualified ID of the certificate to install on the pool. This must be inside the same batch account as the pool. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.Serialization.cs index 6814f867ac9b..825c24e25eb6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchCifsMountConfiguration : IUtf8JsonSerializable + public partial class BatchCifsMountConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userName"u8); writer.WriteStringValue(Username); @@ -28,11 +36,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchCifsMountConfiguration DeserializeBatchCifsMountConfiguration(JsonElement element) + internal static BatchCifsMountConfiguration DeserializeBatchCifsMountConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static BatchCifsMountConfiguration DeserializeBatchCifsMountConfigurati string relativeMountPath = default; Optional mountOptions = default; string password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userName"u8)) @@ -69,8 +92,61 @@ internal static BatchCifsMountConfiguration DeserializeBatchCifsMountConfigurati password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchCifsMountConfiguration(userName, source, relativeMountPath, mountOptions.Value, password, serializedAdditionalRawData); + } + + BatchCifsMountConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchCifsMountConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchCifsMountConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchCifsMountConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchCifsMountConfiguration model) + { + if (model is null) + { + return null; } - return new BatchCifsMountConfiguration(userName, source, relativeMountPath, mountOptions.Value, password); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchCifsMountConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchCifsMountConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.cs index b87bd493db4d..cb4a4a4b665e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCifsMountConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Information used to connect to a CIFS file system. public partial class BatchCifsMountConfiguration { - /// Initializes a new instance of BatchCifsMountConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The user to use for authentication against the CIFS file system. /// The URI of the file system to mount. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. @@ -32,19 +36,26 @@ public BatchCifsMountConfiguration(string username, string source, string relati Password = password; } - /// Initializes a new instance of BatchCifsMountConfiguration. + /// Initializes a new instance of . /// The user to use for authentication against the CIFS file system. /// The URI of the file system to mount. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. /// These are 'net use' options in Windows and 'mount' options in Linux. /// The password to use for authentication against the CIFS file system. - internal BatchCifsMountConfiguration(string username, string source, string relativeMountPath, string mountOptions, string password) + /// Keeps track of any properties unknown to the library. + internal BatchCifsMountConfiguration(string username, string source, string relativeMountPath, string mountOptions, string password, Dictionary serializedAdditionalRawData) { Username = username; Source = source; RelativeMountPath = relativeMountPath; MountOptions = mountOptions; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchCifsMountConfiguration() + { } /// The user to use for authentication against the CIFS file system. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.Serialization.cs index d303db6bd37e..95f8f7d03eb4 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchCloudServiceConfiguration : IUtf8JsonSerializable + public partial class BatchCloudServiceConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("osFamily"u8); writer.WriteStringValue(OSFamily); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("osVersion"u8); writer.WriteStringValue(OSVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchCloudServiceConfiguration DeserializeBatchCloudServiceConfiguration(JsonElement element) + internal static BatchCloudServiceConfiguration DeserializeBatchCloudServiceConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string osFamily = default; Optional osVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osFamily"u8)) @@ -45,8 +68,61 @@ internal static BatchCloudServiceConfiguration DeserializeBatchCloudServiceConfi osVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchCloudServiceConfiguration(osFamily, osVersion.Value, serializedAdditionalRawData); + } + + BatchCloudServiceConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchCloudServiceConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchCloudServiceConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchCloudServiceConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchCloudServiceConfiguration model) + { + if (model is null) + { + return null; } - return new BatchCloudServiceConfiguration(osFamily, osVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchCloudServiceConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchCloudServiceConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.cs index 24cf1d0b9eb7..445b28db1a85 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchCloudServiceConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The configuration for nodes in a pool based on the Azure Cloud Services platform. public partial class BatchCloudServiceConfiguration { - /// Initializes a new instance of BatchCloudServiceConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). /// is null. public BatchCloudServiceConfiguration(string osFamily) @@ -23,13 +27,20 @@ public BatchCloudServiceConfiguration(string osFamily) OSFamily = osFamily; } - /// Initializes a new instance of BatchCloudServiceConfiguration. + /// Initializes a new instance of . /// Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). /// The default value is * which specifies the latest operating system version for the specified OS family. - internal BatchCloudServiceConfiguration(string osFamily, string osVersion) + /// Keeps track of any properties unknown to the library. + internal BatchCloudServiceConfiguration(string osFamily, string osVersion, Dictionary serializedAdditionalRawData) { OSFamily = osFamily; OSVersion = osVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchCloudServiceConfiguration() + { } /// Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.Serialization.cs index 08265da251d8..6c2787148120 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchDeploymentConfiguration : IUtf8JsonSerializable + public partial class BatchDeploymentConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CloudServiceConfiguration)) { writer.WritePropertyName("cloudServiceConfiguration"u8); - writer.WriteObjectValue(CloudServiceConfiguration); + if (CloudServiceConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CloudServiceConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(VmConfiguration)) { writer.WritePropertyName("virtualMachineConfiguration"u8); - writer.WriteObjectValue(VmConfiguration); + if (VmConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VmConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchDeploymentConfiguration DeserializeBatchDeploymentConfiguration(JsonElement element) + internal static BatchDeploymentConfiguration DeserializeBatchDeploymentConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cloudServiceConfiguration = default; Optional virtualMachineConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cloudServiceConfiguration"u8)) @@ -56,8 +93,61 @@ internal static BatchDeploymentConfiguration DeserializeBatchDeploymentConfigura virtualMachineConfiguration = BatchVmConfiguration.DeserializeBatchVmConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchDeploymentConfiguration(cloudServiceConfiguration.Value, virtualMachineConfiguration.Value, serializedAdditionalRawData); + } + + BatchDeploymentConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchDeploymentConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchDeploymentConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchDeploymentConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchDeploymentConfiguration model) + { + if (model is null) + { + return null; } - return new BatchDeploymentConfiguration(cloudServiceConfiguration.Value, virtualMachineConfiguration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchDeploymentConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchDeploymentConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.cs index 4ad85eb61977..cd9c600b0275 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchDeploymentConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Deployment configuration properties. public partial class BatchDeploymentConfiguration { - /// Initializes a new instance of BatchDeploymentConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchDeploymentConfiguration() { } - /// Initializes a new instance of BatchDeploymentConfiguration. + /// Initializes a new instance of . /// This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. /// This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. - internal BatchDeploymentConfiguration(BatchCloudServiceConfiguration cloudServiceConfiguration, BatchVmConfiguration vmConfiguration) + /// Keeps track of any properties unknown to the library. + internal BatchDeploymentConfiguration(BatchCloudServiceConfiguration cloudServiceConfiguration, BatchVmConfiguration vmConfiguration, Dictionary serializedAdditionalRawData) { CloudServiceConfiguration = cloudServiceConfiguration; VmConfiguration = vmConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.Serialization.cs index f098f6652126..30580e47a6d6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchEndpointAccessProfile : IUtf8JsonSerializable + public partial class BatchEndpointAccessProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("defaultAction"u8); writer.WriteStringValue(DefaultAction.ToSerialString()); @@ -24,21 +31,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchEndpointAccessProfile DeserializeBatchEndpointAccessProfile(JsonElement element) + internal static BatchEndpointAccessProfile DeserializeBatchEndpointAccessProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } BatchEndpointAccessDefaultAction defaultAction = default; Optional> ipRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defaultAction"u8)) @@ -60,8 +89,61 @@ internal static BatchEndpointAccessProfile DeserializeBatchEndpointAccessProfile ipRules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchEndpointAccessProfile(defaultAction, Optional.ToList(ipRules), serializedAdditionalRawData); + } + + BatchEndpointAccessProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchEndpointAccessProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchEndpointAccessProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchEndpointAccessProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchEndpointAccessProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchEndpointAccessProfile(Response response) + { + if (response is null) + { + return null; } - return new BatchEndpointAccessProfile(defaultAction, Optional.ToList(ipRules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchEndpointAccessProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.cs index 5d4548902879..39532ffb9a77 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointAccessProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Network access profile for Batch endpoint. public partial class BatchEndpointAccessProfile { - /// Initializes a new instance of BatchEndpointAccessProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. public BatchEndpointAccessProfile(BatchEndpointAccessDefaultAction defaultAction) { @@ -21,13 +25,20 @@ public BatchEndpointAccessProfile(BatchEndpointAccessDefaultAction defaultAction IPRules = new ChangeTrackingList(); } - /// Initializes a new instance of BatchEndpointAccessProfile. + /// Initializes a new instance of . /// Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. /// Array of IP ranges to filter client IP address. - internal BatchEndpointAccessProfile(BatchEndpointAccessDefaultAction defaultAction, IList ipRules) + /// Keeps track of any properties unknown to the library. + internal BatchEndpointAccessProfile(BatchEndpointAccessDefaultAction defaultAction, IList ipRules, Dictionary serializedAdditionalRawData) { DefaultAction = defaultAction; IPRules = ipRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchEndpointAccessProfile() + { } /// Default action for endpoint access. It is only applicable when publicNetworkAccess is enabled. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.Serialization.cs index f4cb16ae7c37..e925aef83653 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchEndpointDetail + public partial class BatchEndpointDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchEndpointDetail DeserializeBatchEndpointDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchEndpointDetail DeserializeBatchEndpointDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("port"u8)) @@ -30,8 +59,61 @@ internal static BatchEndpointDetail DeserializeBatchEndpointDetail(JsonElement e port = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchEndpointDetail(Optional.ToNullable(port)); + return new BatchEndpointDetail(Optional.ToNullable(port), serializedAdditionalRawData); + } + + BatchEndpointDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchEndpointDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchEndpointDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchEndpointDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchEndpointDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchEndpointDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchEndpointDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.cs index 70e60a58530f..fc4a5008c321 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEndpointDetail.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Details about the connection between the Batch service and the endpoint. public partial class BatchEndpointDetail { - /// Initializes a new instance of BatchEndpointDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchEndpointDetail() { } - /// Initializes a new instance of BatchEndpointDetail. + /// Initializes a new instance of . /// The port an endpoint is connected to. - internal BatchEndpointDetail(int? port) + /// Keeps track of any properties unknown to the library. + internal BatchEndpointDetail(int? port, Dictionary serializedAdditionalRawData) { Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The port an endpoint is connected to. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.Serialization.cs index 6274c93b4876..8265c2942e63 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchEnvironmentSetting : IUtf8JsonSerializable + public partial class BatchEnvironmentSetting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchEnvironmentSetting DeserializeBatchEnvironmentSetting(JsonElement element) + internal static BatchEnvironmentSetting DeserializeBatchEnvironmentSetting(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -45,8 +68,61 @@ internal static BatchEnvironmentSetting DeserializeBatchEnvironmentSetting(JsonE value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchEnvironmentSetting(name, value.Value, serializedAdditionalRawData); + } + + BatchEnvironmentSetting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchEnvironmentSetting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchEnvironmentSetting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchEnvironmentSetting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchEnvironmentSetting model) + { + if (model is null) + { + return null; } - return new BatchEnvironmentSetting(name, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchEnvironmentSetting(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchEnvironmentSetting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.cs index 09184f3d4f56..7d93ad7fe1a2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchEnvironmentSetting.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// An environment variable to be set on a task process. public partial class BatchEnvironmentSetting { - /// Initializes a new instance of BatchEnvironmentSetting. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the environment variable. /// is null. public BatchEnvironmentSetting(string name) @@ -23,13 +27,20 @@ public BatchEnvironmentSetting(string name) Name = name; } - /// Initializes a new instance of BatchEnvironmentSetting. + /// Initializes a new instance of . /// The name of the environment variable. /// The value of the environment variable. - internal BatchEnvironmentSetting(string name, string value) + /// Keeps track of any properties unknown to the library. + internal BatchEnvironmentSetting(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchEnvironmentSetting() + { } /// The name of the environment variable. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.Serialization.cs index 1a3c86c02c88..3449c19019b0 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchFileShareConfiguration : IUtf8JsonSerializable + public partial class BatchFileShareConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("accountName"u8); writer.WriteStringValue(AccountName); @@ -29,11 +36,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mountOptions"u8); writer.WriteStringValue(MountOptions); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchFileShareConfiguration DeserializeBatchFileShareConfiguration(JsonElement element) + internal static BatchFileShareConfiguration DeserializeBatchFileShareConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static BatchFileShareConfiguration DeserializeBatchFileShareConfigurati string accountKey = default; string relativeMountPath = default; Optional mountOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -70,8 +92,61 @@ internal static BatchFileShareConfiguration DeserializeBatchFileShareConfigurati mountOptions = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchFileShareConfiguration(accountName, azureFileUrl, accountKey, relativeMountPath, mountOptions.Value, serializedAdditionalRawData); + } + + BatchFileShareConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchFileShareConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchFileShareConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchFileShareConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchFileShareConfiguration model) + { + if (model is null) + { + return null; } - return new BatchFileShareConfiguration(accountName, azureFileUrl, accountKey, relativeMountPath, mountOptions.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchFileShareConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchFileShareConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.cs index 2a765e5130ec..22c9b4ce6eda 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchFileShareConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Information used to connect to an Azure Fileshare. public partial class BatchFileShareConfiguration { - /// Initializes a new instance of BatchFileShareConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Azure Storage account name. /// This is of the form 'https://{account}.file.core.windows.net/'. /// The Azure Storage account key. @@ -32,19 +36,26 @@ public BatchFileShareConfiguration(string accountName, Uri fileUri, string accou RelativeMountPath = relativeMountPath; } - /// Initializes a new instance of BatchFileShareConfiguration. + /// Initializes a new instance of . /// The Azure Storage account name. /// This is of the form 'https://{account}.file.core.windows.net/'. /// The Azure Storage account key. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. /// These are 'net use' options in Windows and 'mount' options in Linux. - internal BatchFileShareConfiguration(string accountName, Uri fileUri, string accountKey, string relativeMountPath, string mountOptions) + /// Keeps track of any properties unknown to the library. + internal BatchFileShareConfiguration(string accountName, Uri fileUri, string accountKey, string relativeMountPath, string mountOptions, Dictionary serializedAdditionalRawData) { AccountName = accountName; FileUri = fileUri; AccountKey = accountKey; RelativeMountPath = relativeMountPath; MountOptions = mountOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchFileShareConfiguration() + { } /// The Azure Storage account name. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.Serialization.cs index 030949025521..e998bd623bef 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchIPRule : IUtf8JsonSerializable + public partial class BatchIPRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.ToString()); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchIPRule DeserializeBatchIPRule(JsonElement element) + internal static BatchIPRule DeserializeBatchIPRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } BatchIPRuleAction action = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action"u8)) @@ -42,8 +65,61 @@ internal static BatchIPRule DeserializeBatchIPRule(JsonElement element) value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchIPRule(action, value, serializedAdditionalRawData); + } + + BatchIPRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchIPRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchIPRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchIPRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchIPRule model) + { + if (model is null) + { + return null; } - return new BatchIPRule(action, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchIPRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchIPRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.cs index 1c4707463327..d3027a375a9e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchIPRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Rule to filter client IP address. public partial class BatchIPRule { - /// Initializes a new instance of BatchIPRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// IPv4 address, or IPv4 address range in CIDR format. /// is null. public BatchIPRule(string value) @@ -24,13 +28,20 @@ public BatchIPRule(string value) Value = value; } - /// Initializes a new instance of BatchIPRule. + /// Initializes a new instance of . /// Action when client IP address is matched. /// IPv4 address, or IPv4 address range in CIDR format. - internal BatchIPRule(BatchIPRuleAction action, string value) + /// Keeps track of any properties unknown to the library. + internal BatchIPRule(BatchIPRuleAction action, string value, Dictionary serializedAdditionalRawData) { Action = action; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchIPRule() + { } /// IPv4 address, or IPv4 address range in CIDR format. public string Value { get; set; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.Serialization.cs index 576955d8faec..f19ded3030e7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchImageReference : IUtf8JsonSerializable + public partial class BatchImageReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Publisher)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchImageReference DeserializeBatchImageReference(JsonElement element) + internal static BatchImageReference DeserializeBatchImageReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static BatchImageReference DeserializeBatchImageReference(JsonElement e Optional sku = default; Optional version = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher"u8)) @@ -85,8 +108,61 @@ internal static BatchImageReference DeserializeBatchImageReference(JsonElement e id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchImageReference(publisher.Value, offer.Value, sku.Value, version.Value, id.Value, serializedAdditionalRawData); + } + + BatchImageReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchImageReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchImageReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchImageReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchImageReference model) + { + if (model is null) + { + return null; } - return new BatchImageReference(publisher.Value, offer.Value, sku.Value, version.Value, id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchImageReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchImageReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.cs index f05a15897630..5a4b47ad9d53 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchImageReference.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -12,24 +14,29 @@ namespace Azure.ResourceManager.Batch.Models /// A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. public partial class BatchImageReference { - /// Initializes a new instance of BatchImageReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchImageReference() { } - /// Initializes a new instance of BatchImageReference. + /// Initializes a new instance of . /// For example, Canonical or MicrosoftWindowsServer. /// For example, UbuntuServer or WindowsServer. /// For example, 18.04-LTS or 2022-datacenter. /// A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. /// This property is mutually exclusive with other properties. The Shared Image Gallery image must have replicas in the same region as the Azure Batch account. For information about the firewall settings for the Batch node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. - internal BatchImageReference(string publisher, string offer, string sku, string version, ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal BatchImageReference(string publisher, string offer, string sku, string version, ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Publisher = publisher; Offer = offer; Sku = sku; Version = version; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// For example, Canonical or MicrosoftWindowsServer. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.Serialization.cs index 85a68c3c02a5..29a056456a3a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchInboundNatPool : IUtf8JsonSerializable + public partial class BatchInboundNatPool : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -32,15 +39,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkSecurityGroupRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchInboundNatPool DeserializeBatchInboundNatPool(JsonElement element) + internal static BatchInboundNatPool DeserializeBatchInboundNatPool(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +79,7 @@ internal static BatchInboundNatPool DeserializeBatchInboundNatPool(JsonElement e int frontendPortRangeStart = default; int frontendPortRangeEnd = default; Optional> networkSecurityGroupRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -92,8 +121,61 @@ internal static BatchInboundNatPool DeserializeBatchInboundNatPool(JsonElement e networkSecurityGroupRules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchInboundNatPool(name, protocol, backendPort, frontendPortRangeStart, frontendPortRangeEnd, Optional.ToList(networkSecurityGroupRules), serializedAdditionalRawData); + } + + BatchInboundNatPool IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchInboundNatPool(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchInboundNatPool IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchInboundNatPool(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchInboundNatPool model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchInboundNatPool(Response response) + { + if (response is null) + { + return null; } - return new BatchInboundNatPool(name, protocol, backendPort, frontendPortRangeStart, frontendPortRangeEnd, Optional.ToList(networkSecurityGroupRules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchInboundNatPool(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.cs index a5f1c548ddcf..f62af0a6b289 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchInboundNatPool.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// A inbound NAT pool that can be used to address specific ports on compute nodes in a Batch pool externally. public partial class BatchInboundNatPool { - /// Initializes a new instance of BatchInboundNatPool. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. /// The protocol of the endpoint. /// This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. @@ -33,14 +36,15 @@ public BatchInboundNatPool(string name, BatchInboundEndpointProtocol protocol, i NetworkSecurityGroupRules = new ChangeTrackingList(); } - /// Initializes a new instance of BatchInboundNatPool. + /// Initializes a new instance of . /// The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. /// The protocol of the endpoint. /// This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. /// Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. /// Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. /// The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. - internal BatchInboundNatPool(string name, BatchInboundEndpointProtocol protocol, int backendPort, int frontendPortRangeStart, int frontendPortRangeEnd, IList networkSecurityGroupRules) + /// Keeps track of any properties unknown to the library. + internal BatchInboundNatPool(string name, BatchInboundEndpointProtocol protocol, int backendPort, int frontendPortRangeStart, int frontendPortRangeEnd, IList networkSecurityGroupRules, Dictionary serializedAdditionalRawData) { Name = name; Protocol = protocol; @@ -48,6 +52,12 @@ internal BatchInboundNatPool(string name, BatchInboundEndpointProtocol protocol, FrontendPortRangeStart = frontendPortRangeStart; FrontendPortRangeEnd = frontendPortRangeEnd; NetworkSecurityGroupRules = networkSecurityGroupRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchInboundNatPool() + { } /// The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.Serialization.cs index 5727f377b84a..3d547b6b7c4d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchKeyVaultReference : IUtf8JsonSerializable + public partial class BatchKeyVaultReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("url"u8); writer.WriteStringValue(Uri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchKeyVaultReference DeserializeBatchKeyVaultReference(JsonElement element) + internal static BatchKeyVaultReference DeserializeBatchKeyVaultReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; Uri url = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -43,8 +65,61 @@ internal static BatchKeyVaultReference DeserializeBatchKeyVaultReference(JsonEle url = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchKeyVaultReference(id, url, serializedAdditionalRawData); + } + + BatchKeyVaultReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchKeyVaultReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchKeyVaultReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchKeyVaultReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchKeyVaultReference model) + { + if (model is null) + { + return null; } - return new BatchKeyVaultReference(id, url); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchKeyVaultReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchKeyVaultReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.cs index 1093c4e57453..01ecb8417df7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchKeyVaultReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Identifies the Azure key vault associated with a Batch account. public partial class BatchKeyVaultReference { - /// Initializes a new instance of BatchKeyVaultReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource ID of the Azure key vault associated with the Batch account. /// The URL of the Azure key vault associated with the Batch account. /// or is null. @@ -26,6 +30,22 @@ public BatchKeyVaultReference(ResourceIdentifier id, Uri uri) Uri = uri; } + /// Initializes a new instance of . + /// The resource ID of the Azure key vault associated with the Batch account. + /// The URL of the Azure key vault associated with the Batch account. + /// Keeps track of any properties unknown to the library. + internal BatchKeyVaultReference(ResourceIdentifier id, Uri uri, Dictionary serializedAdditionalRawData) + { + Id = id; + Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchKeyVaultReference() + { + } + /// The resource ID of the Azure key vault associated with the Batch account. public ResourceIdentifier Id { get; set; } /// The URL of the Azure key vault associated with the Batch account. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.Serialization.cs index 86c160ba1c79..2c5262a5aa14 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchLinuxUserConfiguration : IUtf8JsonSerializable + public partial class BatchLinuxUserConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Uid)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sshPrivateKey"u8); writer.WriteStringValue(SshPrivateKey); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchLinuxUserConfiguration DeserializeBatchLinuxUserConfiguration(JsonElement element) + internal static BatchLinuxUserConfiguration DeserializeBatchLinuxUserConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static BatchLinuxUserConfiguration DeserializeBatchLinuxUserConfigurati Optional uid = default; Optional gid = default; Optional sshPrivateKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uid"u8)) @@ -67,8 +90,61 @@ internal static BatchLinuxUserConfiguration DeserializeBatchLinuxUserConfigurati sshPrivateKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchLinuxUserConfiguration(Optional.ToNullable(uid), Optional.ToNullable(gid), sshPrivateKey.Value, serializedAdditionalRawData); + } + + BatchLinuxUserConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchLinuxUserConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchLinuxUserConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchLinuxUserConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchLinuxUserConfiguration model) + { + if (model is null) + { + return null; } - return new BatchLinuxUserConfiguration(Optional.ToNullable(uid), Optional.ToNullable(gid), sshPrivateKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchLinuxUserConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchLinuxUserConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.cs index 320ad8b5f215..c26d4ba56bc4 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLinuxUserConfiguration.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Properties used to create a user account on a Linux node. public partial class BatchLinuxUserConfiguration { - /// Initializes a new instance of BatchLinuxUserConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchLinuxUserConfiguration() { } - /// Initializes a new instance of BatchLinuxUserConfiguration. + /// Initializes a new instance of . /// The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. /// The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. /// The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). - internal BatchLinuxUserConfiguration(int? uid, int? gid, string sshPrivateKey) + /// Keeps track of any properties unknown to the library. + internal BatchLinuxUserConfiguration(int? uid, int? gid, string sshPrivateKey, Dictionary serializedAdditionalRawData) { Uid = uid; Gid = gid; SshPrivateKey = sshPrivateKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.Serialization.cs index 2a38e5f80737..ec91264cce22 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchLocationQuota + public partial class BatchLocationQuota : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchLocationQuota DeserializeBatchLocationQuota(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchLocationQuota DeserializeBatchLocationQuota(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional accountQuota = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountQuota"u8)) @@ -30,8 +59,61 @@ internal static BatchLocationQuota DeserializeBatchLocationQuota(JsonElement ele accountQuota = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchLocationQuota(Optional.ToNullable(accountQuota)); + return new BatchLocationQuota(Optional.ToNullable(accountQuota), serializedAdditionalRawData); + } + + BatchLocationQuota IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchLocationQuota(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchLocationQuota IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchLocationQuota(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchLocationQuota model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchLocationQuota(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchLocationQuota(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.cs index c147e6af9c3f..154f4fc2029b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchLocationQuota.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Quotas associated with a Batch region for a particular subscription. public partial class BatchLocationQuota { - /// Initializes a new instance of BatchLocationQuota. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchLocationQuota() { } - /// Initializes a new instance of BatchLocationQuota. + /// Initializes a new instance of . /// The number of Batch accounts that may be created under the subscription in the specified region. - internal BatchLocationQuota(int? accountQuota) + /// Keeps track of any properties unknown to the library. + internal BatchLocationQuota(int? accountQuota, Dictionary serializedAdditionalRawData) { AccountQuota = accountQuota; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of Batch accounts that may be created under the subscription in the specified region. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.Serialization.cs index 456b28dae728..0c63e6cc45af 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.Serialization.cs @@ -5,41 +5,91 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchMountConfiguration : IUtf8JsonSerializable + public partial class BatchMountConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BlobFileSystemConfiguration)) { writer.WritePropertyName("azureBlobFileSystemConfiguration"u8); - writer.WriteObjectValue(BlobFileSystemConfiguration); + if (BlobFileSystemConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BlobFileSystemConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(NfsMountConfiguration)) { writer.WritePropertyName("nfsMountConfiguration"u8); - writer.WriteObjectValue(NfsMountConfiguration); + if (NfsMountConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NfsMountConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(CifsMountConfiguration)) { writer.WritePropertyName("cifsMountConfiguration"u8); - writer.WriteObjectValue(CifsMountConfiguration); + if (CifsMountConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CifsMountConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(FileShareConfiguration)) { writer.WritePropertyName("azureFileShareConfiguration"u8); - writer.WriteObjectValue(FileShareConfiguration); + if (FileShareConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FileShareConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchMountConfiguration DeserializeBatchMountConfiguration(JsonElement element) + internal static BatchMountConfiguration DeserializeBatchMountConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +98,7 @@ internal static BatchMountConfiguration DeserializeBatchMountConfiguration(JsonE Optional nfsMountConfiguration = default; Optional cifsMountConfiguration = default; Optional azureFileShareConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("azureBlobFileSystemConfiguration"u8)) @@ -86,8 +137,61 @@ internal static BatchMountConfiguration DeserializeBatchMountConfiguration(JsonE azureFileShareConfiguration = BatchFileShareConfiguration.DeserializeBatchFileShareConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchMountConfiguration(azureBlobFileSystemConfiguration.Value, nfsMountConfiguration.Value, cifsMountConfiguration.Value, azureFileShareConfiguration.Value); + return new BatchMountConfiguration(azureBlobFileSystemConfiguration.Value, nfsMountConfiguration.Value, cifsMountConfiguration.Value, azureFileShareConfiguration.Value, serializedAdditionalRawData); + } + + BatchMountConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchMountConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchMountConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchMountConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchMountConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchMountConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchMountConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.cs index d02b547e203d..935ca1f999ad 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchMountConfiguration.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// The file system to mount on each node. public partial class BatchMountConfiguration { - /// Initializes a new instance of BatchMountConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchMountConfiguration() { } - /// Initializes a new instance of BatchMountConfiguration. + /// Initializes a new instance of . /// This property is mutually exclusive with all other properties. /// This property is mutually exclusive with all other properties. /// This property is mutually exclusive with all other properties. /// This property is mutually exclusive with all other properties. - internal BatchMountConfiguration(BatchBlobFileSystemConfiguration blobFileSystemConfiguration, BatchNfsMountConfiguration nfsMountConfiguration, BatchCifsMountConfiguration cifsMountConfiguration, BatchFileShareConfiguration fileShareConfiguration) + /// Keeps track of any properties unknown to the library. + internal BatchMountConfiguration(BatchBlobFileSystemConfiguration blobFileSystemConfiguration, BatchNfsMountConfiguration nfsMountConfiguration, BatchCifsMountConfiguration cifsMountConfiguration, BatchFileShareConfiguration fileShareConfiguration, Dictionary serializedAdditionalRawData) { BlobFileSystemConfiguration = blobFileSystemConfiguration; NfsMountConfiguration = nfsMountConfiguration; CifsMountConfiguration = cifsMountConfiguration; FileShareConfiguration = fileShareConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property is mutually exclusive with all other properties. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.Serialization.cs index 8e975d5d3c75..d171c3816e47 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchNameAvailabilityContent : IUtf8JsonSerializable + public partial class BatchNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BatchNameAvailabilityContent DeserializeBatchNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ResourceType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + BatchNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.cs index 3a34d4aac82b..47e6de9a1b96 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Parameters for a check name availability request. public partial class BatchNameAvailabilityContent { - /// Initializes a new instance of BatchNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name to check for availability. /// is null. public BatchNameAvailabilityContent(string name) @@ -24,6 +28,22 @@ public BatchNameAvailabilityContent(string name) ResourceType = "Microsoft.Batch/batchAccounts"; } + /// Initializes a new instance of . + /// The name to check for availability. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal BatchNameAvailabilityContent(string name, ResourceType resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchNameAvailabilityContent() + { + } + /// The name to check for availability. public string Name { get; } /// The resource type. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.Serialization.cs index 6ea8aa0e2988..9cbbc2495fd4 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchNameAvailabilityResult + public partial class BatchNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchNameAvailabilityResult DeserializeBatchNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchNameAvailabilityResult DeserializeBatchNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static BatchNameAvailabilityResult DeserializeBatchNameAvailabilityResu Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +75,61 @@ internal static BatchNameAvailabilityResult DeserializeBatchNameAvailabilityResu message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new BatchNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + BatchNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.cs index aa1e845174a2..33f2c1ddcfe1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// The CheckNameAvailability operation response. public partial class BatchNameAvailabilityResult { - /// Initializes a new instance of BatchNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchNameAvailabilityResult() { } - /// Initializes a new instance of BatchNameAvailabilityResult. + /// Initializes a new instance of . /// Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. /// Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. /// Gets an error message explaining the Reason value in more detail. - internal BatchNameAvailabilityResult(bool? isNameAvailable, BatchNameUnavailableReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal BatchNameAvailabilityResult(bool? isNameAvailable, BatchNameUnavailableReason? reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.Serialization.cs index ea54c9a66c96..15b45419bb9d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchNetworkConfiguration : IUtf8JsonSerializable + public partial class BatchNetworkConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SubnetId)) { @@ -28,23 +36,51 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EndpointConfiguration)) { writer.WritePropertyName("endpointConfiguration"u8); - writer.WriteObjectValue(EndpointConfiguration); + if (EndpointConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EndpointConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(PublicIPAddressConfiguration)) { writer.WritePropertyName("publicIPAddressConfiguration"u8); - writer.WriteObjectValue(PublicIPAddressConfiguration); + if (PublicIPAddressConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublicIPAddressConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(EnableAcceleratedNetworking)) { writer.WritePropertyName("enableAcceleratedNetworking"u8); writer.WriteBooleanValue(EnableAcceleratedNetworking.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchNetworkConfiguration DeserializeBatchNetworkConfiguration(JsonElement element) + internal static BatchNetworkConfiguration DeserializeBatchNetworkConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +90,7 @@ internal static BatchNetworkConfiguration DeserializeBatchNetworkConfiguration(J Optional endpointConfiguration = default; Optional publicIPAddressConfiguration = default; Optional enableAcceleratedNetworking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subnetId"u8)) @@ -101,8 +138,61 @@ internal static BatchNetworkConfiguration DeserializeBatchNetworkConfiguration(J enableAcceleratedNetworking = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchNetworkConfiguration(subnetId.Value, Optional.ToNullable(dynamicVnetAssignmentScope), endpointConfiguration.Value, publicIPAddressConfiguration.Value, Optional.ToNullable(enableAcceleratedNetworking), serializedAdditionalRawData); + } + + BatchNetworkConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchNetworkConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchNetworkConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchNetworkConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchNetworkConfiguration model) + { + if (model is null) + { + return null; } - return new BatchNetworkConfiguration(subnetId.Value, Optional.ToNullable(dynamicVnetAssignmentScope), endpointConfiguration.Value, publicIPAddressConfiguration.Value, Optional.ToNullable(enableAcceleratedNetworking)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchNetworkConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchNetworkConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.cs index cc69552f4f05..1ffe103e1858 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Batch.Models /// The network configuration for a pool. public partial class BatchNetworkConfiguration { - /// Initializes a new instance of BatchNetworkConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchNetworkConfiguration() { } - /// Initializes a new instance of BatchNetworkConfiguration. + /// Initializes a new instance of . /// The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. /// The scope of dynamic vnet assignment. /// Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. /// This property is only supported on Pools with the virtualMachineConfiguration property. /// Accelerated networking enables single root I/O virtualization (SR-IOV) to a VM, which may lead to improved networking performance. For more details, see: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview. - internal BatchNetworkConfiguration(ResourceIdentifier subnetId, DynamicVNetAssignmentScope? dynamicVNetAssignmentScope, PoolEndpointConfiguration endpointConfiguration, BatchPublicIPAddressConfiguration publicIPAddressConfiguration, bool? enableAcceleratedNetworking) + /// Keeps track of any properties unknown to the library. + internal BatchNetworkConfiguration(ResourceIdentifier subnetId, DynamicVNetAssignmentScope? dynamicVNetAssignmentScope, PoolEndpointConfiguration endpointConfiguration, BatchPublicIPAddressConfiguration publicIPAddressConfiguration, bool? enableAcceleratedNetworking, Dictionary serializedAdditionalRawData) { SubnetId = subnetId; DynamicVNetAssignmentScope = dynamicVNetAssignmentScope; EndpointConfiguration = endpointConfiguration; PublicIPAddressConfiguration = publicIPAddressConfiguration; EnableAcceleratedNetworking = enableAcceleratedNetworking; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.Serialization.cs index bccd717d0260..870a649d9c95 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchNetworkProfile : IUtf8JsonSerializable + public partial class BatchNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AccountAccess)) { writer.WritePropertyName("accountAccess"u8); - writer.WriteObjectValue(AccountAccess); + if (AccountAccess is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AccountAccess).Serialize(writer, options); + } } if (Optional.IsDefined(NodeManagementAccess)) { writer.WritePropertyName("nodeManagementAccess"u8); - writer.WriteObjectValue(NodeManagementAccess); + if (NodeManagementAccess is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NodeManagementAccess).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchNetworkProfile DeserializeBatchNetworkProfile(JsonElement element) + internal static BatchNetworkProfile DeserializeBatchNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional accountAccess = default; Optional nodeManagementAccess = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountAccess"u8)) @@ -56,8 +93,61 @@ internal static BatchNetworkProfile DeserializeBatchNetworkProfile(JsonElement e nodeManagementAccess = BatchEndpointAccessProfile.DeserializeBatchEndpointAccessProfile(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchNetworkProfile(accountAccess.Value, nodeManagementAccess.Value, serializedAdditionalRawData); + } + + BatchNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchNetworkProfile model) + { + if (model is null) + { + return null; } - return new BatchNetworkProfile(accountAccess.Value, nodeManagementAccess.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchNetworkProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.cs index f52f8fdcf247..8dcca8a334e7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Network profile for Batch account, which contains network rule settings for each endpoint. public partial class BatchNetworkProfile { - /// Initializes a new instance of BatchNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchNetworkProfile() { } - /// Initializes a new instance of BatchNetworkProfile. + /// Initializes a new instance of . /// Network access profile for batchAccount endpoint (Batch account data plane API). /// Network access profile for nodeManagement endpoint (Batch service managing compute nodes for Batch pools). - internal BatchNetworkProfile(BatchEndpointAccessProfile accountAccess, BatchEndpointAccessProfile nodeManagementAccess) + /// Keeps track of any properties unknown to the library. + internal BatchNetworkProfile(BatchEndpointAccessProfile accountAccess, BatchEndpointAccessProfile nodeManagementAccess, Dictionary serializedAdditionalRawData) { AccountAccess = accountAccess; NodeManagementAccess = nodeManagementAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Network access profile for batchAccount endpoint (Batch account data plane API). diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.Serialization.cs index 36ec02153c29..11a8540ca87a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchNetworkSecurityGroupRule : IUtf8JsonSerializable + public partial class BatchNetworkSecurityGroupRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("priority"u8); writer.WriteNumberValue(Priority); @@ -32,11 +39,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchNetworkSecurityGroupRule DeserializeBatchNetworkSecurityGroupRule(JsonElement element) + internal static BatchNetworkSecurityGroupRule DeserializeBatchNetworkSecurityGroupRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +66,7 @@ internal static BatchNetworkSecurityGroupRule DeserializeBatchNetworkSecurityGro BatchNetworkSecurityGroupRuleAccess access = default; string sourceAddressPrefix = default; Optional> sourcePortRanges = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("priority"u8)) @@ -76,8 +98,61 @@ internal static BatchNetworkSecurityGroupRule DeserializeBatchNetworkSecurityGro sourcePortRanges = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchNetworkSecurityGroupRule(priority, access, sourceAddressPrefix, Optional.ToList(sourcePortRanges), serializedAdditionalRawData); + } + + BatchNetworkSecurityGroupRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchNetworkSecurityGroupRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchNetworkSecurityGroupRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchNetworkSecurityGroupRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchNetworkSecurityGroupRule model) + { + if (model is null) + { + return null; } - return new BatchNetworkSecurityGroupRule(priority, access, sourceAddressPrefix, Optional.ToList(sourcePortRanges)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchNetworkSecurityGroupRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchNetworkSecurityGroupRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.cs index 306f8f9aa6d3..37ffe8ba3d51 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNetworkSecurityGroupRule.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// A network security group rule to apply to an inbound endpoint. public partial class BatchNetworkSecurityGroupRule { - /// Initializes a new instance of BatchNetworkSecurityGroupRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. /// The action that should be taken for a specified IP address, subnet range or tag. /// Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. @@ -29,17 +32,24 @@ public BatchNetworkSecurityGroupRule(int priority, BatchNetworkSecurityGroupRule SourcePortRanges = new ChangeTrackingList(); } - /// Initializes a new instance of BatchNetworkSecurityGroupRule. + /// Initializes a new instance of . /// Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. /// The action that should be taken for a specified IP address, subnet range or tag. /// Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. /// Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If any other values are provided the request fails with HTTP status code 400. Default value will be *. - internal BatchNetworkSecurityGroupRule(int priority, BatchNetworkSecurityGroupRuleAccess access, string sourceAddressPrefix, IList sourcePortRanges) + /// Keeps track of any properties unknown to the library. + internal BatchNetworkSecurityGroupRule(int priority, BatchNetworkSecurityGroupRuleAccess access, string sourceAddressPrefix, IList sourcePortRanges, Dictionary serializedAdditionalRawData) { Priority = priority; Access = access; SourceAddressPrefix = sourceAddressPrefix; SourcePortRanges = sourcePortRanges; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchNetworkSecurityGroupRule() + { } /// Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.Serialization.cs index c2c21223d44a..3cae803f9a8e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchNfsMountConfiguration : IUtf8JsonSerializable + public partial class BatchNfsMountConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("source"u8); writer.WriteStringValue(Source); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mountOptions"u8); writer.WriteStringValue(MountOptions); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchNfsMountConfiguration DeserializeBatchNfsMountConfiguration(JsonElement element) + internal static BatchNfsMountConfiguration DeserializeBatchNfsMountConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static BatchNfsMountConfiguration DeserializeBatchNfsMountConfiguration string source = default; string relativeMountPath = default; Optional mountOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("source"u8)) @@ -53,8 +76,61 @@ internal static BatchNfsMountConfiguration DeserializeBatchNfsMountConfiguration mountOptions = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchNfsMountConfiguration(source, relativeMountPath, mountOptions.Value, serializedAdditionalRawData); + } + + BatchNfsMountConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchNfsMountConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchNfsMountConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchNfsMountConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchNfsMountConfiguration model) + { + if (model is null) + { + return null; } - return new BatchNfsMountConfiguration(source, relativeMountPath, mountOptions.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchNfsMountConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchNfsMountConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.cs index 862062395cfa..eab0a88defcf 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchNfsMountConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Information used to connect to an NFS file system. public partial class BatchNfsMountConfiguration { - /// Initializes a new instance of BatchNfsMountConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The URI of the file system to mount. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. /// or is null. @@ -26,15 +30,22 @@ public BatchNfsMountConfiguration(string source, string relativeMountPath) RelativeMountPath = relativeMountPath; } - /// Initializes a new instance of BatchNfsMountConfiguration. + /// Initializes a new instance of . /// The URI of the file system to mount. /// All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. /// These are 'net use' options in Windows and 'mount' options in Linux. - internal BatchNfsMountConfiguration(string source, string relativeMountPath, string mountOptions) + /// Keeps track of any properties unknown to the library. + internal BatchNfsMountConfiguration(string source, string relativeMountPath, string mountOptions, Dictionary serializedAdditionalRawData) { Source = source; RelativeMountPath = relativeMountPath; MountOptions = mountOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchNfsMountConfiguration() + { } /// The URI of the file system to mount. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateEndpointConnectionData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateEndpointConnectionData.Serialization.cs index 8290b9855773..0094aba1b5cf 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateEndpointConnectionData.Serialization.cs @@ -5,34 +5,61 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class BatchPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchPrivateEndpointConnectionData DeserializeBatchPrivateEndpointConnectionData(JsonElement element) + internal static BatchPrivateEndpointConnectionData DeserializeBatchPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +73,7 @@ internal static BatchPrivateEndpointConnectionData DeserializeBatchPrivateEndpoi Optional privateEndpoint = default; Optional> groupIds = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -134,8 +162,61 @@ internal static BatchPrivateEndpointConnectionData DeserializeBatchPrivateEndpoi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new BatchPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkResourceData.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkResourceData.Serialization.cs index 750e2dfc2b3b..7d41eab6d211 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkResourceData.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkResourceData.Serialization.cs @@ -5,27 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Batch { - public partial class BatchPrivateLinkResourceData : IUtf8JsonSerializable + public partial class BatchPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchPrivateLinkResourceData DeserializeBatchPrivateLinkResourceData(JsonElement element) + internal static BatchPrivateLinkResourceData DeserializeBatchPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +58,7 @@ internal static BatchPrivateLinkResourceData DeserializeBatchPrivateLinkResource Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -118,8 +139,61 @@ internal static BatchPrivateLinkResourceData DeserializeBatchPrivateLinkResource } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + BatchPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchPrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new BatchPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.Serialization.cs index 1774ede448b2..a35468d6f838 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class BatchPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToSerialString()); @@ -22,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchPrivateLinkServiceConnectionState DeserializeBatchPrivateLinkServiceConnectionState(JsonElement element) + internal static BatchPrivateLinkServiceConnectionState DeserializeBatchPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +56,7 @@ internal static BatchPrivateLinkServiceConnectionState DeserializeBatchPrivateLi BatchPrivateLinkServiceConnectionStatus status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -51,8 +74,61 @@ internal static BatchPrivateLinkServiceConnectionState DeserializeBatchPrivateLi actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchPrivateLinkServiceConnectionState(status, description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + BatchPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new BatchPrivateLinkServiceConnectionState(status, description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.cs index 22152b91a553..c7458e84ebd7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPrivateLinkServiceConnectionState.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// The private link service connection state of the private endpoint connection. public partial class BatchPrivateLinkServiceConnectionState { - /// Initializes a new instance of BatchPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The status of the Batch private endpoint connection. public BatchPrivateLinkServiceConnectionState(BatchPrivateLinkServiceConnectionStatus status) { Status = status; } - /// Initializes a new instance of BatchPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// The status of the Batch private endpoint connection. /// Description of the private Connection state. /// Action required on the private connection state. - internal BatchPrivateLinkServiceConnectionState(BatchPrivateLinkServiceConnectionStatus status, string description, string actionRequired) + /// Keeps track of any properties unknown to the library. + internal BatchPrivateLinkServiceConnectionState(BatchPrivateLinkServiceConnectionStatus status, string description, string actionRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionRequired = actionRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchPrivateLinkServiceConnectionState() + { } /// The status of the Batch private endpoint connection. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.Serialization.cs index 6ae8e1598b96..d9ac26907a0c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchPublicIPAddressConfiguration : IUtf8JsonSerializable + public partial class BatchPublicIPAddressConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Provision)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchPublicIPAddressConfiguration DeserializeBatchPublicIPAddressConfiguration(JsonElement element) + internal static BatchPublicIPAddressConfiguration DeserializeBatchPublicIPAddressConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional provision = default; Optional> ipAddressIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provision"u8)) @@ -79,8 +101,61 @@ internal static BatchPublicIPAddressConfiguration DeserializeBatchPublicIPAddres ipAddressIds = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchPublicIPAddressConfiguration(Optional.ToNullable(provision), Optional.ToList(ipAddressIds), serializedAdditionalRawData); + } + + BatchPublicIPAddressConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchPublicIPAddressConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchPublicIPAddressConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchPublicIPAddressConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchPublicIPAddressConfiguration model) + { + if (model is null) + { + return null; } - return new BatchPublicIPAddressConfiguration(Optional.ToNullable(provision), Optional.ToList(ipAddressIds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchPublicIPAddressConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchPublicIPAddressConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.cs index 8149ea64adca..e8df6fc9f937 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchPublicIPAddressConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Batch.Models /// The public IP Address configuration of the networking configuration of a Pool. public partial class BatchPublicIPAddressConfiguration { - /// Initializes a new instance of BatchPublicIPAddressConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchPublicIPAddressConfiguration() { IPAddressIds = new ChangeTrackingList(); } - /// Initializes a new instance of BatchPublicIPAddressConfiguration. + /// Initializes a new instance of . /// The default value is BatchManaged. /// The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. - internal BatchPublicIPAddressConfiguration(BatchIPAddressProvisioningType? provision, IList ipAddressIds) + /// Keeps track of any properties unknown to the library. + internal BatchPublicIPAddressConfiguration(BatchIPAddressProvisioningType? provision, IList ipAddressIds, Dictionary serializedAdditionalRawData) { Provision = provision; IPAddressIds = ipAddressIds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The default value is BatchManaged. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.Serialization.cs index 61c4f29c63c0..9a95b47f9982 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.Serialization.cs @@ -10,13 +10,73 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchResizeOperationStatus + public partial class BatchResizeOperationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchResizeOperationStatus DeserializeBatchResizeOperationStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(TargetDedicatedNodes)) + { + writer.WritePropertyName("targetDedicatedNodes"u8); + writer.WriteNumberValue(TargetDedicatedNodes.Value); + } + if (Optional.IsDefined(TargetLowPriorityNodes)) + { + writer.WritePropertyName("targetLowPriorityNodes"u8); + writer.WriteNumberValue(TargetLowPriorityNodes.Value); + } + if (Optional.IsDefined(ResizeTimeout)) + { + writer.WritePropertyName("resizeTimeout"u8); + writer.WriteStringValue(ResizeTimeout.Value, "P"); + } + if (Optional.IsDefined(NodeDeallocationOption)) + { + writer.WritePropertyName("nodeDeallocationOption"u8); + writer.WriteStringValue(NodeDeallocationOption.Value.ToSerialString()); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchResizeOperationStatus DeserializeBatchResizeOperationStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +87,7 @@ internal static BatchResizeOperationStatus DeserializeBatchResizeOperationStatus Optional nodeDeallocationOption = default; Optional startTime = default; Optional> errors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetDedicatedNodes"u8)) @@ -88,8 +149,61 @@ internal static BatchResizeOperationStatus DeserializeBatchResizeOperationStatus errors = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchResizeOperationStatus(Optional.ToNullable(targetDedicatedNodes), Optional.ToNullable(targetLowPriorityNodes), Optional.ToNullable(resizeTimeout), Optional.ToNullable(nodeDeallocationOption), Optional.ToNullable(startTime), Optional.ToList(errors)); + return new BatchResizeOperationStatus(Optional.ToNullable(targetDedicatedNodes), Optional.ToNullable(targetLowPriorityNodes), Optional.ToNullable(resizeTimeout), Optional.ToNullable(nodeDeallocationOption), Optional.ToNullable(startTime), Optional.ToList(errors), serializedAdditionalRawData); + } + + BatchResizeOperationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchResizeOperationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchResizeOperationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchResizeOperationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchResizeOperationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchResizeOperationStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchResizeOperationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.cs index 22c9503c2554..d9bf464e70df 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResizeOperationStatus.cs @@ -15,20 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Describes either the current operation (if the pool AllocationState is Resizing) or the previously completed operation (if the AllocationState is Steady). public partial class BatchResizeOperationStatus { - /// Initializes a new instance of BatchResizeOperationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchResizeOperationStatus() { Errors = new ChangeTrackingList(); } - /// Initializes a new instance of BatchResizeOperationStatus. + /// Initializes a new instance of . /// The desired number of dedicated compute nodes in the pool. /// The desired number of Spot/low-priority compute nodes in the pool. /// The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). /// The default value is requeue. /// The time when this resize operation was started. /// This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. - internal BatchResizeOperationStatus(int? targetDedicatedNodes, int? targetLowPriorityNodes, TimeSpan? resizeTimeout, BatchNodeDeallocationOption? nodeDeallocationOption, DateTimeOffset? startOn, IReadOnlyList errors) + /// Keeps track of any properties unknown to the library. + internal BatchResizeOperationStatus(int? targetDedicatedNodes, int? targetLowPriorityNodes, TimeSpan? resizeTimeout, BatchNodeDeallocationOption? nodeDeallocationOption, DateTimeOffset? startOn, IReadOnlyList errors, Dictionary serializedAdditionalRawData) { TargetDedicatedNodes = targetDedicatedNodes; TargetLowPriorityNodes = targetLowPriorityNodes; @@ -36,6 +40,7 @@ internal BatchResizeOperationStatus(int? targetDedicatedNodes, int? targetLowPri NodeDeallocationOption = nodeDeallocationOption; StartOn = startOn; Errors = errors; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The desired number of dedicated compute nodes in the pool. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.Serialization.cs index cc353af7181f..73eb258ac5da 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchResourceFile : IUtf8JsonSerializable + public partial class BatchResourceFile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AutoBlobContainerName)) { @@ -49,13 +56,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identityReference"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchResourceFile DeserializeBatchResourceFile(JsonElement element) + internal static BatchResourceFile DeserializeBatchResourceFile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +95,7 @@ internal static BatchResourceFile DeserializeBatchResourceFile(JsonElement eleme Optional filePath = default; Optional fileMode = default; Optional identityReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("autoStorageContainerName"u8)) @@ -116,8 +145,61 @@ internal static BatchResourceFile DeserializeBatchResourceFile(JsonElement eleme identityReference = ComputeNodeIdentityReference.DeserializeComputeNodeIdentityReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchResourceFile(autoStorageContainerName.Value, storageContainerUrl.Value, httpUrl.Value, blobPrefix.Value, filePath.Value, fileMode.Value, identityReference.Value, serializedAdditionalRawData); + } + + BatchResourceFile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchResourceFile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchResourceFile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchResourceFile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchResourceFile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchResourceFile(Response response) + { + if (response is null) + { + return null; } - return new BatchResourceFile(autoStorageContainerName.Value, storageContainerUrl.Value, httpUrl.Value, blobPrefix.Value, filePath.Value, fileMode.Value, identityReference.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchResourceFile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.cs index c6db0d09fdc4..57ae34e6795e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchResourceFile.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Batch.Models /// A single file or multiple files to be downloaded to a compute node. public partial class BatchResourceFile { - /// Initializes a new instance of BatchResourceFile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchResourceFile() { } - /// Initializes a new instance of BatchResourceFile. + /// Initializes a new instance of . /// The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. /// The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access. /// The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access. @@ -26,7 +30,8 @@ public BatchResourceFile() /// If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). /// This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. /// The reference to a user assigned identity associated with the Batch pool which a compute node will use. - internal BatchResourceFile(string autoBlobContainerName, Uri blobContainerUri, Uri httpUri, string blobPrefix, string filePath, string fileMode, ComputeNodeIdentityReference identity) + /// Keeps track of any properties unknown to the library. + internal BatchResourceFile(string autoBlobContainerName, Uri blobContainerUri, Uri httpUri, string blobPrefix, string filePath, string fileMode, ComputeNodeIdentityReference identity, Dictionary serializedAdditionalRawData) { AutoBlobContainerName = autoBlobContainerName; BlobContainerUri = blobContainerUri; @@ -35,6 +40,7 @@ internal BatchResourceFile(string autoBlobContainerName, Uri blobContainerUri, U FilePath = filePath; FileMode = fileMode; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.Serialization.cs index 85a582df6c06..85f72cf3f9f7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchSkuCapability + public partial class BatchSkuCapability : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchSkuCapability DeserializeBatchSkuCapability(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchSkuCapability DeserializeBatchSkuCapability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static BatchSkuCapability DeserializeBatchSkuCapability(JsonElement ele value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchSkuCapability(name.Value, value.Value); + return new BatchSkuCapability(name.Value, value.Value, serializedAdditionalRawData); + } + + BatchSkuCapability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchSkuCapability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchSkuCapability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchSkuCapability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchSkuCapability model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchSkuCapability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchSkuCapability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.cs index 286c81eea50a..39563072f774 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSkuCapability.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// A SKU capability, such as the number of cores. public partial class BatchSkuCapability { - /// Initializes a new instance of BatchSkuCapability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchSkuCapability() { } - /// Initializes a new instance of BatchSkuCapability. + /// Initializes a new instance of . /// The name of the feature. /// The value of the feature. - internal BatchSkuCapability(string name, string value) + /// Keeps track of any properties unknown to the library. + internal BatchSkuCapability(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the feature. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.Serialization.cs index cc71a99fd085..dc7eb77d563e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchSupportedSku + public partial class BatchSupportedSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchSupportedSku DeserializeBatchSupportedSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchSupportedSku DeserializeBatchSupportedSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static BatchSupportedSku DeserializeBatchSupportedSku(JsonElement eleme Optional name = default; Optional familyName = default; Optional> capabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +76,61 @@ internal static BatchSupportedSku DeserializeBatchSupportedSku(JsonElement eleme capabilities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchSupportedSku(name.Value, familyName.Value, Optional.ToList(capabilities)); + return new BatchSupportedSku(name.Value, familyName.Value, Optional.ToList(capabilities), serializedAdditionalRawData); + } + + BatchSupportedSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchSupportedSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchSupportedSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchSupportedSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchSupportedSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchSupportedSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchSupportedSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.cs index 0dcad8a886e0..2cef4d07e6ec 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchSupportedSku.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Batch.Models /// Describes a Batch supported SKU. public partial class BatchSupportedSku { - /// Initializes a new instance of BatchSupportedSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchSupportedSku() { Capabilities = new ChangeTrackingList(); } - /// Initializes a new instance of BatchSupportedSku. + /// Initializes a new instance of . /// The name of the SKU. /// The family name of the SKU. /// A collection of capabilities which this SKU supports. - internal BatchSupportedSku(string name, string familyName, IReadOnlyList capabilities) + /// Keeps track of any properties unknown to the library. + internal BatchSupportedSku(string name, string familyName, IReadOnlyList capabilities, Dictionary serializedAdditionalRawData) { Name = name; FamilyName = familyName; Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the SKU. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.Serialization.cs index 82eed0eaa8b3..31649e62602e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchTaskContainerSettings : IUtf8JsonSerializable + public partial class BatchTaskContainerSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContainerRunOptions)) { @@ -25,18 +33,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registry)) { writer.WritePropertyName("registry"u8); - writer.WriteObjectValue(Registry); + if (Registry is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registry).Serialize(writer, options); + } } if (Optional.IsDefined(WorkingDirectory)) { writer.WritePropertyName("workingDirectory"u8); writer.WriteStringValue(WorkingDirectory.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchTaskContainerSettings DeserializeBatchTaskContainerSettings(JsonElement element) + internal static BatchTaskContainerSettings DeserializeBatchTaskContainerSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +74,7 @@ internal static BatchTaskContainerSettings DeserializeBatchTaskContainerSettings string imageName = default; Optional registry = default; Optional workingDirectory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("containerRunOptions"u8)) @@ -75,8 +105,61 @@ internal static BatchTaskContainerSettings DeserializeBatchTaskContainerSettings workingDirectory = property.Value.GetString().ToBatchContainerWorkingDirectory(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchTaskContainerSettings(containerRunOptions.Value, imageName, registry.Value, Optional.ToNullable(workingDirectory), serializedAdditionalRawData); + } + + BatchTaskContainerSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchTaskContainerSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchTaskContainerSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchTaskContainerSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchTaskContainerSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchTaskContainerSettings(Response response) + { + if (response is null) + { + return null; } - return new BatchTaskContainerSettings(containerRunOptions.Value, imageName, registry.Value, Optional.ToNullable(workingDirectory)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchTaskContainerSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.cs index 57f2e42158f9..e94aa9a9fa99 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchTaskContainerSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The container settings for a task. public partial class BatchTaskContainerSettings { - /// Initializes a new instance of BatchTaskContainerSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. /// is null. public BatchTaskContainerSettings(string imageName) @@ -23,17 +27,24 @@ public BatchTaskContainerSettings(string imageName) ImageName = imageName; } - /// Initializes a new instance of BatchTaskContainerSettings. + /// Initializes a new instance of . /// These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. /// This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. /// This setting can be omitted if was already provided at pool creation. /// A flag to indicate where the container task working directory is. The default is 'taskWorkingDirectory'. - internal BatchTaskContainerSettings(string containerRunOptions, string imageName, BatchVmContainerRegistry registry, BatchContainerWorkingDirectory? workingDirectory) + /// Keeps track of any properties unknown to the library. + internal BatchTaskContainerSettings(string containerRunOptions, string imageName, BatchVmContainerRegistry registry, BatchContainerWorkingDirectory? workingDirectory, Dictionary serializedAdditionalRawData) { ContainerRunOptions = containerRunOptions; ImageName = imageName; Registry = registry; WorkingDirectory = workingDirectory; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchTaskContainerSettings() + { } /// These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.Serialization.cs index b8d06cda79ff..f087f2f6e210 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchUserAccount : IUtf8JsonSerializable + public partial class BatchUserAccount : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -27,18 +35,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LinuxUserConfiguration)) { writer.WritePropertyName("linuxUserConfiguration"u8); - writer.WriteObjectValue(LinuxUserConfiguration); + if (LinuxUserConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxUserConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(WindowsUserConfiguration)) { writer.WritePropertyName("windowsUserConfiguration"u8); - writer.WriteObjectValue(WindowsUserConfiguration); + if (WindowsUserConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsUserConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchUserAccount DeserializeBatchUserAccount(JsonElement element) + internal static BatchUserAccount DeserializeBatchUserAccount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +84,7 @@ internal static BatchUserAccount DeserializeBatchUserAccount(JsonElement element Optional elevationLevel = default; Optional linuxUserConfiguration = default; Optional windowsUserConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -87,8 +124,61 @@ internal static BatchUserAccount DeserializeBatchUserAccount(JsonElement element windowsUserConfiguration = BatchWindowsUserConfiguration.DeserializeBatchWindowsUserConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchUserAccount(name, password, Optional.ToNullable(elevationLevel), linuxUserConfiguration.Value, windowsUserConfiguration.Value, serializedAdditionalRawData); + } + + BatchUserAccount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchUserAccount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchUserAccount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchUserAccount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchUserAccount model) + { + if (model is null) + { + return null; } - return new BatchUserAccount(name, password, Optional.ToNullable(elevationLevel), linuxUserConfiguration.Value, windowsUserConfiguration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchUserAccount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchUserAccount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.cs index 4e977544360d..d47074cce6a6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserAccount.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// Properties used to create a user on an Azure Batch node. public partial class BatchUserAccount { - /// Initializes a new instance of BatchUserAccount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the user account. Names can contain any Unicode characters up to a maximum length of 20. /// The password for the user account. /// or is null. @@ -26,19 +30,26 @@ public BatchUserAccount(string name, string password) Password = password; } - /// Initializes a new instance of BatchUserAccount. + /// Initializes a new instance of . /// The name of the user account. Names can contain any Unicode characters up to a maximum length of 20. /// The password for the user account. /// nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. /// This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. /// This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. - internal BatchUserAccount(string name, string password, BatchUserAccountElevationLevel? elevationLevel, BatchLinuxUserConfiguration linuxUserConfiguration, BatchWindowsUserConfiguration windowsUserConfiguration) + /// Keeps track of any properties unknown to the library. + internal BatchUserAccount(string name, string password, BatchUserAccountElevationLevel? elevationLevel, BatchLinuxUserConfiguration linuxUserConfiguration, BatchWindowsUserConfiguration windowsUserConfiguration, Dictionary serializedAdditionalRawData) { Name = name; Password = password; ElevationLevel = elevationLevel; LinuxUserConfiguration = linuxUserConfiguration; WindowsUserConfiguration = windowsUserConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchUserAccount() + { } /// The name of the user account. Names can contain any Unicode characters up to a maximum length of 20. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.Serialization.cs index 97b2603def80..9815c03d0435 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchUserIdentity : IUtf8JsonSerializable + public partial class BatchUserIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserName)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoUser)) { writer.WritePropertyName("autoUser"u8); - writer.WriteObjectValue(AutoUser); + if (AutoUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoUser).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchUserIdentity DeserializeBatchUserIdentity(JsonElement element) + internal static BatchUserIdentity DeserializeBatchUserIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional userName = default; Optional autoUser = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userName"u8)) @@ -52,8 +82,61 @@ internal static BatchUserIdentity DeserializeBatchUserIdentity(JsonElement eleme autoUser = BatchAutoUserSpecification.DeserializeBatchAutoUserSpecification(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchUserIdentity(userName.Value, autoUser.Value, serializedAdditionalRawData); + } + + BatchUserIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchUserIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchUserIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchUserIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchUserIdentity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchUserIdentity(Response response) + { + if (response is null) + { + return null; } - return new BatchUserIdentity(userName.Value, autoUser.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchUserIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.cs index 43f1e46adcc0..68b1ec0d340f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchUserIdentity.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Specify either the userName or autoUser property, but not both. public partial class BatchUserIdentity { - /// Initializes a new instance of BatchUserIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchUserIdentity() { } - /// Initializes a new instance of BatchUserIdentity. + /// Initializes a new instance of . /// The userName and autoUser properties are mutually exclusive; you must specify one but not both. /// The userName and autoUser properties are mutually exclusive; you must specify one but not both. - internal BatchUserIdentity(string userName, BatchAutoUserSpecification autoUser) + /// Keeps track of any properties unknown to the library. + internal BatchUserIdentity(string userName, BatchAutoUserSpecification autoUser, Dictionary serializedAdditionalRawData) { UserName = userName; AutoUser = autoUser; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The userName and autoUser properties are mutually exclusive; you must specify one but not both. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.Serialization.cs index 9b4696b85faa..7fbb85dc8a8f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.Serialization.cs @@ -5,25 +5,46 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchVmConfiguration : IUtf8JsonSerializable + public partial class BatchVmConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("imageReference"u8); - writer.WriteObjectValue(ImageReference); + if (ImageReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageReference).Serialize(writer, options); + } writer.WritePropertyName("nodeAgentSkuId"u8); writer.WriteStringValue(NodeAgentSkuId); if (Optional.IsDefined(WindowsConfiguration)) { writer.WritePropertyName("windowsConfiguration"u8); - writer.WriteObjectValue(WindowsConfiguration); + if (WindowsConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDisks)) { @@ -31,7 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDisks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -43,17 +71,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContainerConfiguration)) { writer.WritePropertyName("containerConfiguration"u8); - writer.WriteObjectValue(ContainerConfiguration); + if (ContainerConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContainerConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(DiskEncryptionConfiguration)) { writer.WritePropertyName("diskEncryptionConfiguration"u8); - writer.WriteObjectValue(DiskEncryptionConfiguration); + if (DiskEncryptionConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskEncryptionConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(NodePlacementConfiguration)) { writer.WritePropertyName("nodePlacementConfiguration"u8); - writer.WriteObjectValue(NodePlacementConfiguration); + if (NodePlacementConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NodePlacementConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Extensions)) { @@ -61,20 +110,48 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Extensions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(OSDisk)) { writer.WritePropertyName("osDisk"u8); - writer.WriteObjectValue(OSDisk); + if (OSDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDisk).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchVmConfiguration DeserializeBatchVmConfiguration(JsonElement element) + internal static BatchVmConfiguration DeserializeBatchVmConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +166,7 @@ internal static BatchVmConfiguration DeserializeBatchVmConfiguration(JsonElement Optional nodePlacementConfiguration = default; Optional> extensions = default; Optional osDisk = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageReference"u8)) @@ -179,8 +257,61 @@ internal static BatchVmConfiguration DeserializeBatchVmConfiguration(JsonElement osDisk = OSDisk.DeserializeOSDisk(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchVmConfiguration(imageReference, nodeAgentSkuId, windowsConfiguration.Value, Optional.ToList(dataDisks), licenseType.Value, containerConfiguration.Value, diskEncryptionConfiguration.Value, nodePlacementConfiguration.Value, Optional.ToList(extensions), osDisk.Value, serializedAdditionalRawData); + } + + BatchVmConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchVmConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchVmConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchVmConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchVmConfiguration model) + { + if (model is null) + { + return null; } - return new BatchVmConfiguration(imageReference, nodeAgentSkuId, windowsConfiguration.Value, Optional.ToList(dataDisks), licenseType.Value, containerConfiguration.Value, diskEncryptionConfiguration.Value, nodePlacementConfiguration.Value, Optional.ToList(extensions), osDisk.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchVmConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchVmConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.cs index f3144c36cbe6..5512e7834fcd 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmConfiguration.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The configuration for compute nodes in a pool based on the Azure Virtual Machines infrastructure. public partial class BatchVmConfiguration { - /// Initializes a new instance of BatchVmConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. /// The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. /// or is null. @@ -29,7 +32,7 @@ public BatchVmConfiguration(BatchImageReference imageReference, string nodeAgent Extensions = new ChangeTrackingList(); } - /// Initializes a new instance of BatchVmConfiguration. + /// Initializes a new instance of . /// A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. /// The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. /// This property must not be specified if the imageReference specifies a Linux OS image. @@ -46,7 +49,8 @@ public BatchVmConfiguration(BatchImageReference imageReference, string nodeAgent /// This configuration will specify rules on how nodes in the pool will be physically allocated. /// If specified, the extensions mentioned in this configuration will be installed on each node. /// Contains configuration for ephemeral OSDisk settings. - internal BatchVmConfiguration(BatchImageReference imageReference, string nodeAgentSkuId, WindowsConfiguration windowsConfiguration, IList dataDisks, string licenseType, BatchVmContainerConfiguration containerConfiguration, DiskEncryptionConfiguration diskEncryptionConfiguration, NodePlacementConfiguration nodePlacementConfiguration, IList extensions, OSDisk osDisk) + /// Keeps track of any properties unknown to the library. + internal BatchVmConfiguration(BatchImageReference imageReference, string nodeAgentSkuId, WindowsConfiguration windowsConfiguration, IList dataDisks, string licenseType, BatchVmContainerConfiguration containerConfiguration, DiskEncryptionConfiguration diskEncryptionConfiguration, NodePlacementConfiguration nodePlacementConfiguration, IList extensions, OSDisk osDisk, Dictionary serializedAdditionalRawData) { ImageReference = imageReference; NodeAgentSkuId = nodeAgentSkuId; @@ -58,6 +62,12 @@ internal BatchVmConfiguration(BatchImageReference imageReference, string nodeAge NodePlacementConfiguration = nodePlacementConfiguration; Extensions = extensions; OSDisk = osDisk; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchVmConfiguration() + { } /// A reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.Serialization.cs index 6354a3a2c713..9dcdf08e53be 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchVmContainerConfiguration : IUtf8JsonSerializable + public partial class BatchVmContainerConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ContainerType.ToString()); @@ -34,15 +41,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ContainerRegistries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchVmContainerConfiguration DeserializeBatchVmContainerConfiguration(JsonElement element) + internal static BatchVmContainerConfiguration DeserializeBatchVmContainerConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +78,7 @@ internal static BatchVmContainerConfiguration DeserializeBatchVmContainerConfigu BatchVmContainerType type = default; Optional> containerImageNames = default; Optional> containerRegistries = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -85,8 +114,61 @@ internal static BatchVmContainerConfiguration DeserializeBatchVmContainerConfigu containerRegistries = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchVmContainerConfiguration(type, Optional.ToList(containerImageNames), Optional.ToList(containerRegistries), serializedAdditionalRawData); + } + + BatchVmContainerConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchVmContainerConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchVmContainerConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchVmContainerConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchVmContainerConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchVmContainerConfiguration(Response response) + { + if (response is null) + { + return null; } - return new BatchVmContainerConfiguration(type, Optional.ToList(containerImageNames), Optional.ToList(containerRegistries)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchVmContainerConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.cs index b207d00702bd..d92f5ea9afff 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The configuration for container-enabled pools. public partial class BatchVmContainerConfiguration { - /// Initializes a new instance of BatchVmContainerConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The container technology to be used. public BatchVmContainerConfiguration(BatchVmContainerType containerType) { @@ -22,15 +26,17 @@ public BatchVmContainerConfiguration(BatchVmContainerType containerType) ContainerRegistries = new ChangeTrackingList(); } - /// Initializes a new instance of BatchVmContainerConfiguration. + /// Initializes a new instance of . /// The container technology to be used. /// This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. /// If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. - internal BatchVmContainerConfiguration(BatchVmContainerType containerType, IList containerImageNames, IList containerRegistries) + /// Keeps track of any properties unknown to the library. + internal BatchVmContainerConfiguration(BatchVmContainerType containerType, IList containerImageNames, IList containerRegistries, Dictionary serializedAdditionalRawData) { ContainerType = containerType; ContainerImageNames = containerImageNames; ContainerRegistries = containerRegistries; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. public IList ContainerImageNames { get; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.Serialization.cs index ae2403664cdd..00142ecbd15e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchVmContainerRegistry : IUtf8JsonSerializable + public partial class BatchVmContainerRegistry : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserName)) { @@ -33,13 +41,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identityReference"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BatchVmContainerRegistry DeserializeBatchVmContainerRegistry(JsonElement element) + internal static BatchVmContainerRegistry DeserializeBatchVmContainerRegistry(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +77,7 @@ internal static BatchVmContainerRegistry DeserializeBatchVmContainerRegistry(Jso Optional password = default; Optional registryServer = default; Optional identityReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -74,8 +104,61 @@ internal static BatchVmContainerRegistry DeserializeBatchVmContainerRegistry(Jso identityReference = ComputeNodeIdentityReference.DeserializeComputeNodeIdentityReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchVmContainerRegistry(username.Value, password.Value, registryServer.Value, identityReference.Value, serializedAdditionalRawData); + } + + BatchVmContainerRegistry IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchVmContainerRegistry(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchVmContainerRegistry IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchVmContainerRegistry(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchVmContainerRegistry model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchVmContainerRegistry(Response response) + { + if (response is null) + { + return null; } - return new BatchVmContainerRegistry(username.Value, password.Value, registryServer.Value, identityReference.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchVmContainerRegistry(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.cs index 570d6e9f5d24..9ed7b8583204 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmContainerRegistry.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.Batch.Models /// A private container registry. public partial class BatchVmContainerRegistry { - /// Initializes a new instance of BatchVmContainerRegistry. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchVmContainerRegistry() { } - /// Initializes a new instance of BatchVmContainerRegistry. + /// Initializes a new instance of . /// The user name to log into the registry server. /// The password to log into the registry server. /// If omitted, the default is "docker.io". /// The reference to a user assigned identity associated with the Batch pool which a compute node will use. - internal BatchVmContainerRegistry(string userName, string password, string registryServer, ComputeNodeIdentityReference identity) + /// Keeps track of any properties unknown to the library. + internal BatchVmContainerRegistry(string userName, string password, string registryServer, ComputeNodeIdentityReference identity, Dictionary serializedAdditionalRawData) { UserName = userName; Password = password; RegistryServer = registryServer; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The user name to log into the registry server. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.Serialization.cs index 65dad7416313..12e739abac08 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchVmDataDisk : IUtf8JsonSerializable + public partial class BatchVmDataDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lun"u8); writer.WriteNumberValue(Lun); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("storageAccountType"u8); writer.WriteStringValue(StorageAccountType.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchVmDataDisk DeserializeBatchVmDataDisk(JsonElement element) + internal static BatchVmDataDisk DeserializeBatchVmDataDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static BatchVmDataDisk DeserializeBatchVmDataDisk(JsonElement element) Optional caching = default; int diskSizeGB = default; Optional storageAccountType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -72,8 +95,61 @@ internal static BatchVmDataDisk DeserializeBatchVmDataDisk(JsonElement element) storageAccountType = property.Value.GetString().ToBatchStorageAccountType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchVmDataDisk(lun, Optional.ToNullable(caching), diskSizeGB, Optional.ToNullable(storageAccountType), serializedAdditionalRawData); + } + + BatchVmDataDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchVmDataDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchVmDataDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchVmDataDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchVmDataDisk model) + { + if (model is null) + { + return null; } - return new BatchVmDataDisk(lun, Optional.ToNullable(caching), diskSizeGB, Optional.ToNullable(storageAccountType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchVmDataDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchVmDataDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.cs index 143a8130c4ec..94585d9b8c6c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmDataDisk.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Settings which will be used by the data disks associated to Compute Nodes in the Pool. When using attached data disks, you need to mount and format the disks from within a VM to use them. public partial class BatchVmDataDisk { - /// Initializes a new instance of BatchVmDataDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. /// The initial disk size in GB when creating new data disk. public BatchVmDataDisk(int lun, int diskSizeInGB) @@ -19,7 +25,7 @@ public BatchVmDataDisk(int lun, int diskSizeInGB) DiskSizeInGB = diskSizeInGB; } - /// Initializes a new instance of BatchVmDataDisk. + /// Initializes a new instance of . /// The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. /// /// Values are: @@ -37,12 +43,19 @@ public BatchVmDataDisk(int lun, int diskSizeInGB) /// Standard_LRS - The data disk should use standard locally redundant storage. /// Premium_LRS - The data disk should use premium locally redundant storage. /// - internal BatchVmDataDisk(int lun, BatchDiskCachingType? caching, int diskSizeInGB, BatchStorageAccountType? storageAccountType) + /// Keeps track of any properties unknown to the library. + internal BatchVmDataDisk(int lun, BatchDiskCachingType? caching, int diskSizeInGB, BatchStorageAccountType? storageAccountType, Dictionary serializedAdditionalRawData) { Lun = lun; Caching = caching; DiskSizeInGB = diskSizeInGB; StorageAccountType = storageAccountType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchVmDataDisk() + { } /// The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.Serialization.cs index ba678a994b41..3f503db959b7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchVmExtension : IUtf8JsonSerializable + public partial class BatchVmExtension : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -66,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchVmExtension DeserializeBatchVmExtension(JsonElement element) + internal static BatchVmExtension DeserializeBatchVmExtension(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +104,7 @@ internal static BatchVmExtension DeserializeBatchVmExtension(JsonElement element Optional settings = default; Optional protectedSettings = default; Optional> provisionAfterExtensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -156,8 +177,61 @@ internal static BatchVmExtension DeserializeBatchVmExtension(JsonElement element provisionAfterExtensions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchVmExtension(name, publisher, type, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, Optional.ToList(provisionAfterExtensions)); + return new BatchVmExtension(name, publisher, type, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, Optional.ToList(provisionAfterExtensions), serializedAdditionalRawData); + } + + BatchVmExtension IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchVmExtension(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchVmExtension IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchVmExtension(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchVmExtension model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchVmExtension(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchVmExtension(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.cs index 70f2280b1dd8..372be1615152 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmExtension.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Batch.Models /// The configuration for virtual machine extensions. public partial class BatchVmExtension { - /// Initializes a new instance of BatchVmExtension. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the virtual machine extension. /// The name of the extension handler publisher. /// The type of the extensions. @@ -31,7 +34,7 @@ public BatchVmExtension(string name, string publisher, string extensionType) ProvisionAfterExtensions = new ChangeTrackingList(); } - /// Initializes a new instance of BatchVmExtension. + /// Initializes a new instance of . /// The name of the virtual machine extension. /// The name of the extension handler publisher. /// The type of the extensions. @@ -41,7 +44,8 @@ public BatchVmExtension(string name, string publisher, string extensionType) /// JSON formatted public settings for the extension. /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. /// Collection of extension names after which this extension needs to be provisioned. - internal BatchVmExtension(string name, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, IList provisionAfterExtensions) + /// Keeps track of any properties unknown to the library. + internal BatchVmExtension(string name, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, IList provisionAfterExtensions, Dictionary serializedAdditionalRawData) { Name = name; Publisher = publisher; @@ -52,6 +56,12 @@ internal BatchVmExtension(string name, string publisher, string extensionType, s Settings = settings; ProtectedSettings = protectedSettings; ProvisionAfterExtensions = provisionAfterExtensions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BatchVmExtension() + { } /// The name of the virtual machine extension. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.Serialization.cs index fed3b42e4d90..f90d85a22548 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - public partial class BatchVmFamilyCoreQuota + public partial class BatchVmFamilyCoreQuota : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BatchVmFamilyCoreQuota DeserializeBatchVmFamilyCoreQuota(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BatchVmFamilyCoreQuota DeserializeBatchVmFamilyCoreQuota(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional coreQuota = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +65,61 @@ internal static BatchVmFamilyCoreQuota DeserializeBatchVmFamilyCoreQuota(JsonEle coreQuota = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BatchVmFamilyCoreQuota(name.Value, Optional.ToNullable(coreQuota)); + return new BatchVmFamilyCoreQuota(name.Value, Optional.ToNullable(coreQuota), serializedAdditionalRawData); + } + + BatchVmFamilyCoreQuota IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchVmFamilyCoreQuota(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchVmFamilyCoreQuota IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchVmFamilyCoreQuota(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchVmFamilyCoreQuota model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchVmFamilyCoreQuota(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchVmFamilyCoreQuota(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.cs index c9500976aff5..bc43a81b67c0 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchVmFamilyCoreQuota.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// A VM Family and its associated core quota for the Batch account. public partial class BatchVmFamilyCoreQuota { - /// Initializes a new instance of BatchVmFamilyCoreQuota. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BatchVmFamilyCoreQuota() { } - /// Initializes a new instance of BatchVmFamilyCoreQuota. + /// Initializes a new instance of . /// The Virtual Machine family name. /// The core quota for the VM family for the Batch account. - internal BatchVmFamilyCoreQuota(string name, int? coreQuota) + /// Keeps track of any properties unknown to the library. + internal BatchVmFamilyCoreQuota(string name, int? coreQuota, Dictionary serializedAdditionalRawData) { Name = name; CoreQuota = coreQuota; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Virtual Machine family name. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.Serialization.cs index 9ecb86a44d38..c81c2d48ae4a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class BatchWindowsUserConfiguration : IUtf8JsonSerializable + internal partial class BatchWindowsUserConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LoginMode)) { writer.WritePropertyName("loginMode"u8); writer.WriteStringValue(LoginMode.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BatchWindowsUserConfiguration DeserializeBatchWindowsUserConfiguration(JsonElement element) + internal static BatchWindowsUserConfiguration DeserializeBatchWindowsUserConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional loginMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("loginMode"u8)) @@ -41,8 +64,61 @@ internal static BatchWindowsUserConfiguration DeserializeBatchWindowsUserConfigu loginMode = property.Value.GetString().ToBatchWindowsLoginMode(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BatchWindowsUserConfiguration(Optional.ToNullable(loginMode), serializedAdditionalRawData); + } + + BatchWindowsUserConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBatchWindowsUserConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BatchWindowsUserConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBatchWindowsUserConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BatchWindowsUserConfiguration model) + { + if (model is null) + { + return null; } - return new BatchWindowsUserConfiguration(Optional.ToNullable(loginMode)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BatchWindowsUserConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBatchWindowsUserConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.cs index c45744dd1bed..59cef9b72596 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/BatchWindowsUserConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Properties used to create a user account on a Windows node. internal partial class BatchWindowsUserConfiguration { - /// Initializes a new instance of BatchWindowsUserConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BatchWindowsUserConfiguration() { } - /// Initializes a new instance of BatchWindowsUserConfiguration. + /// Initializes a new instance of . /// Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. - internal BatchWindowsUserConfiguration(BatchWindowsLoginMode? loginMode) + /// Keeps track of any properties unknown to the library. + internal BatchWindowsUserConfiguration(BatchWindowsLoginMode? loginMode, Dictionary serializedAdditionalRawData) { LoginMode = loginMode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.Serialization.cs index a6fce871b250..4b8669ef56d1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class ComputeNodeIdentityReference : IUtf8JsonSerializable + internal partial class ComputeNodeIdentityReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputeNodeIdentityReference DeserializeComputeNodeIdentityReference(JsonElement element) + internal static ComputeNodeIdentityReference DeserializeComputeNodeIdentityReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -41,8 +64,61 @@ internal static ComputeNodeIdentityReference DeserializeComputeNodeIdentityRefer resourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeNodeIdentityReference(resourceId.Value, serializedAdditionalRawData); + } + + ComputeNodeIdentityReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeNodeIdentityReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeNodeIdentityReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeNodeIdentityReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeNodeIdentityReference model) + { + if (model is null) + { + return null; } - return new ComputeNodeIdentityReference(resourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeNodeIdentityReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeNodeIdentityReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.cs index d314a6160f7a..427a1a46ae21 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ComputeNodeIdentityReference.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Batch.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Batch.Models /// The reference to a user assigned identity associated with the Batch pool which a compute node will use. internal partial class ComputeNodeIdentityReference { - /// Initializes a new instance of ComputeNodeIdentityReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeNodeIdentityReference() { } - /// Initializes a new instance of ComputeNodeIdentityReference. + /// Initializes a new instance of . /// The ARM resource id of the user assigned identity. - internal ComputeNodeIdentityReference(ResourceIdentifier resourceId) + /// Keeps track of any properties unknown to the library. + internal ComputeNodeIdentityReference(ResourceIdentifier resourceId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ARM resource id of the user assigned identity. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.Serialization.cs index cf6ae0393958..ce5143ddab06 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class DetectorListResult + internal partial class DetectorListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DetectorListResult DeserializeDetectorListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DetectorListResult DeserializeDetectorListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DetectorListResult DeserializeDetectorListResult(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DetectorListResult(Optional.ToList(value), nextLink.Value); + return new DetectorListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DetectorListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDetectorListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DetectorListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDetectorListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DetectorListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DetectorListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDetectorListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.cs index 7687c0bd2ba5..aedbba2937f9 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DetectorListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class DetectorListResult { - /// Initializes a new instance of DetectorListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DetectorListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DetectorListResult. + /// Initializes a new instance of . /// The collection of Batch account detectors returned by the listing operation. /// The URL to get the next set of results. - internal DetectorListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DetectorListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of Batch account detectors returned by the listing operation. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.Serialization.cs index 5aa56e5d21b5..ce76860ce2ab 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class DiffDiskSettings : IUtf8JsonSerializable + internal partial class DiffDiskSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Placement)) { writer.WritePropertyName("placement"u8); writer.WriteStringValue(Placement.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element) + internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional placement = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("placement"u8)) @@ -41,8 +64,61 @@ internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element placement = new BatchDiffDiskPlacement(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiffDiskSettings(Optional.ToNullable(placement), serializedAdditionalRawData); + } + + DiffDiskSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiffDiskSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiffDiskSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiffDiskSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiffDiskSettings model) + { + if (model is null) + { + return null; } - return new DiffDiskSettings(Optional.ToNullable(placement)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiffDiskSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiffDiskSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.cs index 094dab474a04..472169a9e506 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiffDiskSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. internal partial class DiffDiskSettings { - /// Initializes a new instance of DiffDiskSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiffDiskSettings() { } - /// Initializes a new instance of DiffDiskSettings. + /// Initializes a new instance of . /// This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. - internal DiffDiskSettings(BatchDiffDiskPlacement? placement) + /// Keeps track of any properties unknown to the library. + internal DiffDiskSettings(BatchDiffDiskPlacement? placement, Dictionary serializedAdditionalRawData) { Placement = placement; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.Serialization.cs index 409e4d01252b..8fee5f34d21d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class DiskEncryptionConfiguration : IUtf8JsonSerializable + internal partial class DiskEncryptionConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Targets)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskEncryptionConfiguration DeserializeDiskEncryptionConfiguration(JsonElement element) + internal static DiskEncryptionConfiguration DeserializeDiskEncryptionConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> targets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targets"u8)) @@ -52,8 +74,61 @@ internal static DiskEncryptionConfiguration DeserializeDiskEncryptionConfigurati targets = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskEncryptionConfiguration(Optional.ToList(targets), serializedAdditionalRawData); + } + + DiskEncryptionConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskEncryptionConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskEncryptionConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskEncryptionConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskEncryptionConfiguration model) + { + if (model is null) + { + return null; } - return new DiskEncryptionConfiguration(Optional.ToList(targets)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskEncryptionConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskEncryptionConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.cs index f895a0f5b2cf..97a4cb4fd568 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/DiskEncryptionConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Batch.Models /// The disk encryption configuration applied on compute nodes in the pool. Disk encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared Image Gallery Image. internal partial class DiskEncryptionConfiguration { - /// Initializes a new instance of DiskEncryptionConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskEncryptionConfiguration() { Targets = new ChangeTrackingList(); } - /// Initializes a new instance of DiskEncryptionConfiguration. + /// Initializes a new instance of . /// On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. - internal DiskEncryptionConfiguration(IList targets) + /// Keeps track of any properties unknown to the library. + internal DiskEncryptionConfiguration(IList targets, Dictionary serializedAdditionalRawData) { Targets = targets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.Serialization.cs index d688f76844c1..40a059b3c92a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class KeyVaultProperties : IUtf8JsonSerializable + internal partial class KeyVaultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyIdentifier)) { writer.WritePropertyName("keyIdentifier"u8); writer.WriteStringValue(KeyIdentifier.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element) + internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional keyIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyIdentifier"u8)) @@ -42,8 +64,61 @@ internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement ele keyIdentifier = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultProperties(keyIdentifier.Value, serializedAdditionalRawData); + } + + KeyVaultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultProperties model) + { + if (model is null) + { + return null; } - return new KeyVaultProperties(keyIdentifier.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.cs index 2cdd01973077..5e4aaf24b3c4 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/KeyVaultProperties.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Batch.Models { /// KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault. internal partial class KeyVaultProperties { - /// Initializes a new instance of KeyVaultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public KeyVaultProperties() { } - /// Initializes a new instance of KeyVaultProperties. + /// Initializes a new instance of . /// /// Full path to the secret with or without version. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. or https://mykeyvault.vault.azure.net/keys/testkey. To be usable the following prerequisites must be met: /// @@ -25,9 +29,11 @@ public KeyVaultProperties() /// The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions /// The KeyVault has soft-delete and purge protection enabled /// - internal KeyVaultProperties(Uri keyIdentifier) + /// Keeps track of any properties unknown to the library. + internal KeyVaultProperties(Uri keyIdentifier, Dictionary serializedAdditionalRawData) { KeyIdentifier = keyIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.Serialization.cs index 34767ddb8099..30c627bcb6f1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class ListApplicationPackagesResult + internal partial class ListApplicationPackagesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListApplicationPackagesResult DeserializeListApplicationPackagesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListApplicationPackagesResult DeserializeListApplicationPackagesResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ListApplicationPackagesResult DeserializeListApplicationPackages nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListApplicationPackagesResult(Optional.ToList(value), nextLink.Value); + return new ListApplicationPackagesResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ListApplicationPackagesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListApplicationPackagesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListApplicationPackagesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListApplicationPackagesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListApplicationPackagesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListApplicationPackagesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListApplicationPackagesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.cs index 27229cf3eecb..248877cebc90 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationPackagesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// The result of performing list application packages. internal partial class ListApplicationPackagesResult { - /// Initializes a new instance of ListApplicationPackagesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListApplicationPackagesResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListApplicationPackagesResult. + /// Initializes a new instance of . /// The list of application packages. /// The URL to get the next set of results. - internal ListApplicationPackagesResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListApplicationPackagesResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of application packages. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.Serialization.cs index c0625c090c3d..7853556fcb09 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class ListApplicationsResult + internal partial class ListApplicationsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListApplicationsResult DeserializeListApplicationsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListApplicationsResult DeserializeListApplicationsResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ListApplicationsResult DeserializeListApplicationsResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListApplicationsResult(Optional.ToList(value), nextLink.Value); + return new ListApplicationsResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ListApplicationsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListApplicationsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListApplicationsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListApplicationsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListApplicationsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListApplicationsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListApplicationsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.cs index de7e87a576d8..a2bc48e2d46c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListApplicationsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// The result of performing list applications. internal partial class ListApplicationsResult { - /// Initializes a new instance of ListApplicationsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListApplicationsResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListApplicationsResult. + /// Initializes a new instance of . /// The list of applications. /// The URL to get the next set of results. - internal ListApplicationsResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListApplicationsResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of applications. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.Serialization.cs index 9ab185dcc218..bd2b0747f132 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class ListCertificatesResult + internal partial class ListCertificatesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListCertificatesResult DeserializeListCertificatesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListCertificatesResult DeserializeListCertificatesResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ListCertificatesResult DeserializeListCertificatesResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListCertificatesResult(Optional.ToList(value), nextLink.Value); + return new ListCertificatesResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ListCertificatesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListCertificatesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListCertificatesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListCertificatesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListCertificatesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListCertificatesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListCertificatesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.cs index f7ff9c2cf963..1eed9af760b7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListCertificatesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class ListCertificatesResult { - /// Initializes a new instance of ListCertificatesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListCertificatesResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListCertificatesResult. + /// Initializes a new instance of . /// The collection of returned certificates. /// The continuation token. - internal ListCertificatesResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListCertificatesResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of returned certificates. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.Serialization.cs index 70b6dcc96d30..e2c3409c0f9d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class ListPoolsResult + internal partial class ListPoolsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListPoolsResult DeserializeListPoolsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListPoolsResult DeserializeListPoolsResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ListPoolsResult DeserializeListPoolsResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListPoolsResult(Optional.ToList(value), nextLink.Value); + return new ListPoolsResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ListPoolsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListPoolsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListPoolsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListPoolsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListPoolsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListPoolsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListPoolsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.cs index 0625688e6cb7..a4e41e3df7c5 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPoolsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class ListPoolsResult { - /// Initializes a new instance of ListPoolsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListPoolsResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListPoolsResult. + /// Initializes a new instance of . /// The collection of returned pools. /// The continuation token. - internal ListPoolsResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListPoolsResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of returned pools. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.Serialization.cs index 872a5e2d1ecd..bf1984d95789 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class ListPrivateEndpointConnectionsResult + internal partial class ListPrivateEndpointConnectionsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListPrivateEndpointConnectionsResult DeserializeListPrivateEndpointConnectionsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListPrivateEndpointConnectionsResult DeserializeListPrivateEndpointConnectionsResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ListPrivateEndpointConnectionsResult DeserializeListPrivateEndpo nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListPrivateEndpointConnectionsResult(Optional.ToList(value), nextLink.Value); + return new ListPrivateEndpointConnectionsResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ListPrivateEndpointConnectionsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListPrivateEndpointConnectionsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListPrivateEndpointConnectionsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListPrivateEndpointConnectionsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListPrivateEndpointConnectionsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListPrivateEndpointConnectionsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListPrivateEndpointConnectionsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.cs index 4dd68a0cc39f..0425d62ed8f6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateEndpointConnectionsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class ListPrivateEndpointConnectionsResult { - /// Initializes a new instance of ListPrivateEndpointConnectionsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListPrivateEndpointConnectionsResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListPrivateEndpointConnectionsResult. + /// Initializes a new instance of . /// The collection of returned private endpoint connection. /// The continuation token. - internal ListPrivateEndpointConnectionsResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListPrivateEndpointConnectionsResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of returned private endpoint connection. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.Serialization.cs index 2cb9ddb428f3..1bfac0fa87c7 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Batch; namespace Azure.ResourceManager.Batch.Models { - internal partial class ListPrivateLinkResourcesResult + internal partial class ListPrivateLinkResourcesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListPrivateLinkResourcesResult DeserializeListPrivateLinkResourcesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListPrivateLinkResourcesResult DeserializeListPrivateLinkResourcesResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ListPrivateLinkResourcesResult DeserializeListPrivateLinkResourc nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListPrivateLinkResourcesResult(Optional.ToList(value), nextLink.Value); + return new ListPrivateLinkResourcesResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ListPrivateLinkResourcesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListPrivateLinkResourcesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListPrivateLinkResourcesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListPrivateLinkResourcesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListPrivateLinkResourcesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListPrivateLinkResourcesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListPrivateLinkResourcesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.cs index 86a246c4575f..259bde4a922f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/ListPrivateLinkResourcesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Batch; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class ListPrivateLinkResourcesResult { - /// Initializes a new instance of ListPrivateLinkResourcesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListPrivateLinkResourcesResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListPrivateLinkResourcesResult. + /// Initializes a new instance of . /// The collection of returned private link resources. /// The continuation token. - internal ListPrivateLinkResourcesResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListPrivateLinkResourcesResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of returned private link resources. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.Serialization.cs index 1b8ae5c42e5d..00415c7d73c2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class NodePlacementConfiguration : IUtf8JsonSerializable + internal partial class NodePlacementConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); writer.WriteStringValue(Policy.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NodePlacementConfiguration DeserializeNodePlacementConfiguration(JsonElement element) + internal static NodePlacementConfiguration DeserializeNodePlacementConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional policy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("policy"u8)) @@ -41,8 +64,61 @@ internal static NodePlacementConfiguration DeserializeNodePlacementConfiguration policy = property.Value.GetString().ToBatchNodePlacementPolicyType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NodePlacementConfiguration(Optional.ToNullable(policy), serializedAdditionalRawData); + } + + NodePlacementConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNodePlacementConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NodePlacementConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNodePlacementConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NodePlacementConfiguration model) + { + if (model is null) + { + return null; } - return new NodePlacementConfiguration(Optional.ToNullable(policy)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NodePlacementConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNodePlacementConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.cs index dece0f4b202c..47d8a203b2d3 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/NodePlacementConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Allocation configuration used by Batch Service to provision the nodes. internal partial class NodePlacementConfiguration { - /// Initializes a new instance of NodePlacementConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NodePlacementConfiguration() { } - /// Initializes a new instance of NodePlacementConfiguration. + /// Initializes a new instance of . /// Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. - internal NodePlacementConfiguration(BatchNodePlacementPolicyType? policy) + /// Keeps track of any properties unknown to the library. + internal NodePlacementConfiguration(BatchNodePlacementPolicyType? policy, Dictionary serializedAdditionalRawData) { Policy = policy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.Serialization.cs index e43ef75ead29..f7594a43345e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class OSDisk : IUtf8JsonSerializable + internal partial class OSDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EphemeralOSDiskSettings)) { writer.WritePropertyName("ephemeralOSDiskSettings"u8); - writer.WriteObjectValue(EphemeralOSDiskSettings); + if (EphemeralOSDiskSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EphemeralOSDiskSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static OSDisk DeserializeOSDisk(JsonElement element) + internal static OSDisk DeserializeOSDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ephemeralOSDiskSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ephemeralOSDiskSettings"u8)) @@ -41,8 +71,61 @@ internal static OSDisk DeserializeOSDisk(JsonElement element) ephemeralOSDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSDisk(ephemeralOSDiskSettings.Value, serializedAdditionalRawData); + } + + OSDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSDisk(Response response) + { + if (response is null) + { + return null; } - return new OSDisk(ephemeralOSDiskSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.cs index a836e1e07208..9de5fbd782e5 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OSDisk.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Settings for the operating system disk of the virtual machine. internal partial class OSDisk { - /// Initializes a new instance of OSDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OSDisk() { } - /// Initializes a new instance of OSDisk. + /// Initializes a new instance of . /// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. - internal OSDisk(DiffDiskSettings ephemeralOSDiskSettings) + /// Keeps track of any properties unknown to the library. + internal OSDisk(DiffDiskSettings ephemeralOSDiskSettings, Dictionary serializedAdditionalRawData) { EphemeralOSDiskSettings = ephemeralOSDiskSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.Serialization.cs index 2cabdba0838d..745f5f3e24bc 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class OutboundEnvironmentEndpointCollection + internal partial class OutboundEnvironmentEndpointCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OutboundEnvironmentEndpointCollection DeserializeOutboundEnvironmentEndpointCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OutboundEnvironmentEndpointCollection DeserializeOutboundEnvironmentEndpointCollection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +75,61 @@ internal static OutboundEnvironmentEndpointCollection DeserializeOutboundEnviron nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OutboundEnvironmentEndpointCollection(Optional.ToList(value), nextLink.Value); + return new OutboundEnvironmentEndpointCollection(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + OutboundEnvironmentEndpointCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOutboundEnvironmentEndpointCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OutboundEnvironmentEndpointCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOutboundEnvironmentEndpointCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OutboundEnvironmentEndpointCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OutboundEnvironmentEndpointCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOutboundEnvironmentEndpointCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.cs index 573303453e04..b2d4a2104e30 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/OutboundEnvironmentEndpointCollection.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Batch.Models /// Values returned by the List operation. internal partial class OutboundEnvironmentEndpointCollection { - /// Initializes a new instance of OutboundEnvironmentEndpointCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OutboundEnvironmentEndpointCollection() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of OutboundEnvironmentEndpointCollection. + /// Initializes a new instance of . /// The collection of outbound network dependency endpoints returned by the listing operation. /// The continuation token. - internal OutboundEnvironmentEndpointCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OutboundEnvironmentEndpointCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of outbound network dependency endpoints returned by the listing operation. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.Serialization.cs index 2ff4ec736b4c..ed28da66acf1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.Serialization.cs @@ -5,34 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class PoolEndpointConfiguration : IUtf8JsonSerializable + internal partial class PoolEndpointConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("inboundNatPools"u8); writer.WriteStartArray(); foreach (var item in InboundNatPools) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PoolEndpointConfiguration DeserializePoolEndpointConfiguration(JsonElement element) + internal static PoolEndpointConfiguration DeserializePoolEndpointConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList inboundNatPools = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inboundNatPools"u8)) @@ -45,8 +74,61 @@ internal static PoolEndpointConfiguration DeserializePoolEndpointConfiguration(J inboundNatPools = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PoolEndpointConfiguration(inboundNatPools, serializedAdditionalRawData); + } + + PoolEndpointConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePoolEndpointConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PoolEndpointConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePoolEndpointConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PoolEndpointConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PoolEndpointConfiguration(Response response) + { + if (response is null) + { + return null; } - return new PoolEndpointConfiguration(inboundNatPools); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePoolEndpointConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.cs index 8c0ae1b34cba..1ee1cc46b38c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/PoolEndpointConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Batch.Models /// The endpoint configuration for a pool. internal partial class PoolEndpointConfiguration { - /// Initializes a new instance of PoolEndpointConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. /// is null. public PoolEndpointConfiguration(IEnumerable inboundNatPools) @@ -25,11 +28,18 @@ public PoolEndpointConfiguration(IEnumerable inboundNatPool InboundNatPools = inboundNatPools.ToList(); } - /// Initializes a new instance of PoolEndpointConfiguration. + /// Initializes a new instance of . /// The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. - internal PoolEndpointConfiguration(IList inboundNatPools) + /// Keeps track of any properties unknown to the library. + internal PoolEndpointConfiguration(IList inboundNatPools, Dictionary serializedAdditionalRawData) { InboundNatPools = inboundNatPools; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PoolEndpointConfiguration() + { } /// The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.Serialization.cs index 683123474528..7dedf57b4351 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class SupportedSkusResult + internal partial class SupportedSkusResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SupportedSkusResult DeserializeSupportedSkusResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SupportedSkusResult DeserializeSupportedSkusResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static SupportedSkusResult DeserializeSupportedSkusResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SupportedSkusResult(value, nextLink.Value); + return new SupportedSkusResult(value, nextLink.Value, serializedAdditionalRawData); + } + + SupportedSkusResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSupportedSkusResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SupportedSkusResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSupportedSkusResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SupportedSkusResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SupportedSkusResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSupportedSkusResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.cs index 3c6df9c189e4..730482fe39f1 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/SupportedSkusResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Batch.Models /// The Batch List supported SKUs operation response. internal partial class SupportedSkusResult { - /// Initializes a new instance of SupportedSkusResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of SKUs available for the Batch service in the location. /// is null. internal SupportedSkusResult(IEnumerable value) @@ -25,13 +28,20 @@ internal SupportedSkusResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SupportedSkusResult. + /// Initializes a new instance of . /// The list of SKUs available for the Batch service in the location. /// The URL to use for getting the next set of results. - internal SupportedSkusResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SupportedSkusResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SupportedSkusResult() + { } /// The list of SKUs available for the Batch service in the location. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.Serialization.cs index 4918190317b0..92a2bfa740e2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class TaskSchedulingPolicy : IUtf8JsonSerializable + internal partial class TaskSchedulingPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("nodeFillType"u8); writer.WriteStringValue(NodeFillType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TaskSchedulingPolicy DeserializeTaskSchedulingPolicy(JsonElement element) + internal static TaskSchedulingPolicy DeserializeTaskSchedulingPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } BatchNodeFillType nodeFillType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nodeFillType"u8)) @@ -34,8 +57,61 @@ internal static TaskSchedulingPolicy DeserializeTaskSchedulingPolicy(JsonElement nodeFillType = property.Value.GetString().ToBatchNodeFillType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TaskSchedulingPolicy(nodeFillType, serializedAdditionalRawData); + } + + TaskSchedulingPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTaskSchedulingPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TaskSchedulingPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTaskSchedulingPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TaskSchedulingPolicy model) + { + if (model is null) + { + return null; } - return new TaskSchedulingPolicy(nodeFillType); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TaskSchedulingPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTaskSchedulingPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.cs index 5c190a29db88..583122231f92 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/TaskSchedulingPolicy.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Specifies how tasks should be distributed across compute nodes. internal partial class TaskSchedulingPolicy { - /// Initializes a new instance of TaskSchedulingPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// How tasks should be distributed across compute nodes. public TaskSchedulingPolicy(BatchNodeFillType nodeFillType) { NodeFillType = nodeFillType; } + /// Initializes a new instance of . + /// How tasks should be distributed across compute nodes. + /// Keeps track of any properties unknown to the library. + internal TaskSchedulingPolicy(BatchNodeFillType nodeFillType, Dictionary serializedAdditionalRawData) + { + NodeFillType = nodeFillType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TaskSchedulingPolicy() + { + } + /// How tasks should be distributed across compute nodes. public BatchNodeFillType NodeFillType { get; set; } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.Serialization.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.Serialization.cs index c8f9def8d8fa..43c7abc81f3b 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.Serialization.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Batch.Models { - internal partial class WindowsConfiguration : IUtf8JsonSerializable + internal partial class WindowsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsAutomaticUpdateEnabled)) { writer.WritePropertyName("enableAutomaticUpdates"u8); writer.WriteBooleanValue(IsAutomaticUpdateEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement element) + internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enableAutomaticUpdates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enableAutomaticUpdates"u8)) @@ -41,8 +64,61 @@ internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement enableAutomaticUpdates = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WindowsConfiguration(Optional.ToNullable(enableAutomaticUpdates), serializedAdditionalRawData); + } + + WindowsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWindowsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WindowsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWindowsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WindowsConfiguration model) + { + if (model is null) + { + return null; } - return new WindowsConfiguration(Optional.ToNullable(enableAutomaticUpdates)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WindowsConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWindowsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.cs index e3bc78372d05..876131ebb6f9 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Models/WindowsConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Batch.Models { /// Windows operating system settings to apply to the virtual machine. internal partial class WindowsConfiguration { - /// Initializes a new instance of WindowsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WindowsConfiguration() { } - /// Initializes a new instance of WindowsConfiguration. + /// Initializes a new instance of . /// If omitted, the default value is true. - internal WindowsConfiguration(bool? isAutomaticUpdateEnabled) + /// Keeps track of any properties unknown to the library. + internal WindowsConfiguration(bool? isAutomaticUpdateEnabled, Dictionary serializedAdditionalRawData) { IsAutomaticUpdateEnabled = isAutomaticUpdateEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// If omitted, the default value is true. diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationPackageRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationPackageRestOperations.cs index bdc4fea80e17..59a2c3d27909 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationPackageRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationPackageRestOperations.cs @@ -59,9 +59,7 @@ internal HttpMessage CreateActivateRequest(string subscriptionId, string resourc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -157,9 +155,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationRestOperations.cs index 2175a1322f04..f8b2ca366b77 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/ApplicationRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -312,9 +310,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/BatchAccountRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/BatchAccountRestOperations.cs index 08da4f8eb326..e091844db6c2 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/BatchAccountRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/BatchAccountRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -582,9 +578,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/CertificateRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/CertificateRestOperations.cs index fc965849b090..f0707b6ca710 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/CertificateRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/CertificateRestOperations.cs @@ -161,9 +161,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -261,9 +259,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/LocationRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/LocationRestOperations.cs index 1296730856b2..b083f9f854c6 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/LocationRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/LocationRestOperations.cs @@ -290,9 +290,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PoolRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PoolRestOperations.cs index 439fdc8b0177..b487fc5e7dfe 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PoolRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PoolRestOperations.cs @@ -189,9 +189,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -289,9 +287,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs index 0aa4045f1102..dd5c3ba107a4 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs @@ -233,9 +233,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs index 9943c58e4d05..b87f4e87fefb 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Billing.Models /// Model factory for models. public static partial class ArmBillingModelFactory { - /// Initializes a new instance of BillingSubscriptionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -65,28 +65,28 @@ public static BillingSubscriptionData BillingSubscriptionData(ResourceIdentifier billingPolicies ??= new Dictionary(); suspensionReasons ??= new List(); - return new BillingSubscriptionData(id, name, resourceType, systemData, autoRenew, beneficiaryTenantId, billingFrequency, billingProfileId, billingPolicies, billingProfileDisplayName, billingProfileName, consumptionCostCenter, customerId, customerDisplayName, displayName, enrollmentAccountId, enrollmentAccountDisplayName, invoiceSectionId, invoiceSectionDisplayName, invoiceSectionName, lastMonthCharges, monthToDateCharges, nextBillingCycleBillingFrequency != null ? new NextBillingCycleDetails(nextBillingCycleBillingFrequency) : null, offerId, productCategory, productType, productTypeId, purchaseOn, quantity, reseller, renewalTermDetails, skuDescription, skuId, status, subscriptionId, suspensionReasons?.ToList(), termDuration, termStartOn, termEndOn, subscriptionEnrollmentAccountStatus, enrollmentAccountStartOn); + return new BillingSubscriptionData(id, name, resourceType, systemData, autoRenew, beneficiaryTenantId, billingFrequency, billingProfileId, billingPolicies, billingProfileDisplayName, billingProfileName, consumptionCostCenter, customerId, customerDisplayName, displayName, enrollmentAccountId, enrollmentAccountDisplayName, invoiceSectionId, invoiceSectionDisplayName, invoiceSectionName, lastMonthCharges, monthToDateCharges, nextBillingCycleBillingFrequency != null ? new NextBillingCycleDetails(nextBillingCycleBillingFrequency, new Dictionary()) : null, offerId, productCategory, productType, productTypeId, purchaseOn, quantity, reseller, renewalTermDetails, skuDescription, skuId, status, subscriptionId, suspensionReasons?.ToList(), termDuration, termStartOn, termEndOn, subscriptionEnrollmentAccountStatus, enrollmentAccountStartOn, default); } - /// Initializes a new instance of BillingAmount. + /// Initializes a new instance of . /// The currency for the amount value. /// Amount value. /// A new instance for mocking. public static BillingAmount BillingAmount(string currency = null, float? value = null) { - return new BillingAmount(currency, value); + return new BillingAmount(currency, value, default); } - /// Initializes a new instance of CreatedSubscriptionReseller. + /// Initializes a new instance of . /// The MPN ID of the reseller. /// The name of the reseller. /// A new instance for mocking. public static CreatedSubscriptionReseller CreatedSubscriptionReseller(string resellerId = null, string description = null) { - return new CreatedSubscriptionReseller(resellerId, description); + return new CreatedSubscriptionReseller(resellerId, description, default); } - /// Initializes a new instance of SubscriptionRenewalTermDetails. + /// Initializes a new instance of . /// The billing frequency of the subscription. /// The ID of the product. /// The number of licenses. @@ -95,29 +95,29 @@ public static CreatedSubscriptionReseller CreatedSubscriptionReseller(string res /// A new instance for mocking. public static SubscriptionRenewalTermDetails SubscriptionRenewalTermDetails(string billingFrequency = null, string productTypeId = null, long? quantity = null, string skuId = null, TimeSpan? termDuration = null) { - return new SubscriptionRenewalTermDetails(billingFrequency, productTypeId, quantity, skuId, termDuration); + return new SubscriptionRenewalTermDetails(billingFrequency, productTypeId, quantity, skuId, termDuration, default); } - /// Initializes a new instance of BillingSubscriptionValidateMoveEligibilityResult. + /// Initializes a new instance of . /// Specifies whether the subscription is eligible to move. /// Validation error details. /// A new instance for mocking. public static BillingSubscriptionValidateMoveEligibilityResult BillingSubscriptionValidateMoveEligibilityResult(bool? isMoveEligible = null, BillingSubscriptionValidateMoveEligibilityError errorDetails = null) { - return new BillingSubscriptionValidateMoveEligibilityResult(isMoveEligible, errorDetails); + return new BillingSubscriptionValidateMoveEligibilityResult(isMoveEligible, errorDetails, default); } - /// Initializes a new instance of BillingSubscriptionValidateMoveEligibilityError. + /// Initializes a new instance of . /// Error code for the billing subscription move validation. /// The error message. /// Detailed error message explaining the error. /// A new instance for mocking. public static BillingSubscriptionValidateMoveEligibilityError BillingSubscriptionValidateMoveEligibilityError(SubscriptionTransferValidationErrorCode? code = null, string message = null, string details = null) { - return new BillingSubscriptionValidateMoveEligibilityError(code, message, details); + return new BillingSubscriptionValidateMoveEligibilityError(code, message, details, default); } - /// Initializes a new instance of BillingSubscriptionAliasData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -166,10 +166,10 @@ public static BillingSubscriptionAliasData BillingSubscriptionAliasData(Resource billingPolicies ??= new Dictionary(); suspensionReasons ??= new List(); - return new BillingSubscriptionAliasData(id, name, resourceType, systemData, autoRenew, beneficiaryTenantId, billingFrequency, billingProfileId, billingPolicies, billingProfileDisplayName, billingProfileName, consumptionCostCenter, customerId, customerDisplayName, displayName, enrollmentAccountId, enrollmentAccountDisplayName, invoiceSectionId, invoiceSectionDisplayName, invoiceSectionName, lastMonthCharges, monthToDateCharges, nextBillingCycleBillingFrequency != null ? new NextBillingCycleDetails(nextBillingCycleBillingFrequency) : null, offerId, productCategory, productType, productTypeId, purchaseOn, quantity, reseller, renewalTermDetails, skuDescription, skuId, status, subscriptionId, suspensionReasons?.ToList(), termDuration, termStartOn, termEndOn, subscriptionEnrollmentAccountStatus, enrollmentAccountStartOn, billingSubscriptionId); + return new BillingSubscriptionAliasData(id, name, resourceType, systemData, autoRenew, beneficiaryTenantId, billingFrequency, billingProfileId, billingPolicies, billingProfileDisplayName, billingProfileName, consumptionCostCenter, customerId, customerDisplayName, displayName, enrollmentAccountId, enrollmentAccountDisplayName, invoiceSectionId, invoiceSectionDisplayName, invoiceSectionName, lastMonthCharges, monthToDateCharges, nextBillingCycleBillingFrequency != null ? new NextBillingCycleDetails(nextBillingCycleBillingFrequency, new Dictionary()) : null, offerId, productCategory, productType, productTypeId, purchaseOn, quantity, reseller, renewalTermDetails, skuDescription, skuId, status, subscriptionId, suspensionReasons?.ToList(), termDuration, termStartOn, termEndOn, subscriptionEnrollmentAccountStatus, enrollmentAccountStartOn, billingSubscriptionId, default); } - /// Initializes a new instance of BillingPaymentMethodData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -187,19 +187,19 @@ public static BillingPaymentMethodData BillingPaymentMethodData(ResourceIdentifi { logos ??= new List(); - return new BillingPaymentMethodData(id, name, resourceType, systemData, family, paymentMethodType, accountHolderName, expiration, lastFourDigits, displayName, logos?.ToList(), status); + return new BillingPaymentMethodData(id, name, resourceType, systemData, family, paymentMethodType, accountHolderName, expiration, lastFourDigits, displayName, logos?.ToList(), status, default); } - /// Initializes a new instance of PaymentMethodLogo. + /// Initializes a new instance of . /// MIME type of the logo. /// Public URL of image of the logo. /// A new instance for mocking. public static PaymentMethodLogo PaymentMethodLogo(string mimeType = null, Uri uri = null) { - return new PaymentMethodLogo(mimeType, uri); + return new PaymentMethodLogo(mimeType, uri, default); } - /// Initializes a new instance of BillingPaymentMethodLinkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -208,10 +208,10 @@ public static PaymentMethodLogo PaymentMethodLogo(string mimeType = null, Uri ur /// A new instance for mocking. public static BillingPaymentMethodLinkData BillingPaymentMethodLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PaymentMethodProjectionProperties paymentMethod = null) { - return new BillingPaymentMethodLinkData(id, name, resourceType, systemData, paymentMethod); + return new BillingPaymentMethodLinkData(id, name, resourceType, systemData, paymentMethod, default); } - /// Initializes a new instance of PaymentMethodProjectionProperties. + /// Initializes a new instance of . /// Id of payment method. /// The family of payment method. /// The type of payment method. @@ -226,7 +226,7 @@ public static PaymentMethodProjectionProperties PaymentMethodProjectionPropertie { logos ??= new List(); - return new PaymentMethodProjectionProperties(paymentMethodId, family, paymentMethodProjectionPropertiesType, accountHolderName, expiration, lastFourDigits, displayName, logos?.ToList(), status); + return new PaymentMethodProjectionProperties(paymentMethodId, family, paymentMethodProjectionPropertiesType, accountHolderName, expiration, lastFourDigits, displayName, logos?.ToList(), status, default); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs index 63bb1f8f96a2..42c0475866a2 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodCollection.cs @@ -152,7 +152,7 @@ public virtual AsyncPageable GetAllAsync(Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingAccountPaymentMethodPaymentMethodsRestClient.CreateListByBillingAccountRequest(_billingAccountName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingAccountPaymentMethodPaymentMethodsRestClient.CreateListByBillingAccountNextPageRequest(nextLink, _billingAccountName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingAccountPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingAccountPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingAccountPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingAccountPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingAccountPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingAccountPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -174,7 +174,7 @@ public virtual Pageable GetAll(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingAccountPaymentMethodPaymentMethodsRestClient.CreateListByBillingAccountRequest(_billingAccountName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingAccountPaymentMethodPaymentMethodsRestClient.CreateListByBillingAccountNextPageRequest(nextLink, _billingAccountName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingAccountPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingAccountPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingAccountPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingAccountPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingAccountPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingAccountPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs index a07d2d51ef15..0ae6066b6f6a 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingPaymentMethodPaymentMethodsRestClient.CreateListByUserRequest(); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingPaymentMethodPaymentMethodsRestClient.CreateListByUserNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -169,7 +169,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingPaymentMethodPaymentMethodsRestClient.CreateListByUserRequest(); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingPaymentMethodPaymentMethodsRestClient.CreateListByUserNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingPaymentMethodResource(Client, BillingPaymentMethodData.DeserializeBillingPaymentMethodData(e)), _billingPaymentMethodPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodData.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodData.cs index a05ed8296f55..6e732be11c07 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodData.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Billing.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Billing /// public partial class BillingPaymentMethodData : ResourceData { - /// Initializes a new instance of BillingPaymentMethodData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingPaymentMethodData() { Logos = new ChangeTrackingList(); } - /// Initializes a new instance of BillingPaymentMethodData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public BillingPaymentMethodData() /// The display name of the payment method. /// The list of logos for the payment method. /// Status of the payment method. - internal BillingPaymentMethodData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PaymentMethodFamily? family, string paymentMethodType, string accountHolderName, string expiration, string lastFourDigits, string displayName, IList logos, PaymentMethodStatus? status) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingPaymentMethodData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PaymentMethodFamily? family, string paymentMethodType, string accountHolderName, string expiration, string lastFourDigits, string displayName, IList logos, PaymentMethodStatus? status, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Family = family; PaymentMethodType = paymentMethodType; @@ -47,6 +52,7 @@ internal BillingPaymentMethodData(ResourceIdentifier id, string name, ResourceTy DisplayName = displayName; Logos = logos; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The family of payment method. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs index c53a377b7d2d..910d1c1a7a1d 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkCollection.cs @@ -155,7 +155,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingPaymentMethodLinkPaymentMethodsRestClient.CreateListByBillingProfileRequest(_billingAccountName, _billingProfileName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingPaymentMethodLinkPaymentMethodsRestClient.CreateListByBillingProfileNextPageRequest(nextLink, _billingAccountName, _billingProfileName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingPaymentMethodLinkResource(Client, BillingPaymentMethodLinkData.DeserializeBillingPaymentMethodLinkData(e)), _billingPaymentMethodLinkPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodLinkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingPaymentMethodLinkResource(Client, BillingPaymentMethodLinkData.DeserializeBillingPaymentMethodLinkData(e)), _billingPaymentMethodLinkPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodLinkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -177,7 +177,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingPaymentMethodLinkPaymentMethodsRestClient.CreateListByBillingProfileRequest(_billingAccountName, _billingProfileName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingPaymentMethodLinkPaymentMethodsRestClient.CreateListByBillingProfileNextPageRequest(nextLink, _billingAccountName, _billingProfileName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingPaymentMethodLinkResource(Client, BillingPaymentMethodLinkData.DeserializeBillingPaymentMethodLinkData(e)), _billingPaymentMethodLinkPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodLinkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingPaymentMethodLinkResource(Client, BillingPaymentMethodLinkData.DeserializeBillingPaymentMethodLinkData(e)), _billingPaymentMethodLinkPaymentMethodsClientDiagnostics, Pipeline, "BillingPaymentMethodLinkCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkData.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkData.cs index fd89f2157661..9c2a509b75ac 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkData.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Billing.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.Billing /// public partial class BillingPaymentMethodLinkData : ResourceData { - /// Initializes a new instance of BillingPaymentMethodLinkData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingPaymentMethodLinkData() { } - /// Initializes a new instance of BillingPaymentMethodLinkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Projection of a payment method. - internal BillingPaymentMethodLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PaymentMethodProjectionProperties paymentMethod) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingPaymentMethodLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PaymentMethodProjectionProperties paymentMethod, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PaymentMethod = paymentMethod; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Projection of a payment method. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs index f785eff8d441..a81437b927c5 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingSubscriptionAliasBillingSubscriptionsAliasesRestClient.CreateListByBillingAccountRequest(_billingAccountName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingSubscriptionAliasBillingSubscriptionsAliasesRestClient.CreateListByBillingAccountNextPageRequest(nextLink, _billingAccountName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingSubscriptionAliasResource(Client, BillingSubscriptionAliasData.DeserializeBillingSubscriptionAliasData(e)), _billingSubscriptionAliasBillingSubscriptionsAliasesClientDiagnostics, Pipeline, "BillingSubscriptionAliasCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingSubscriptionAliasResource(Client, BillingSubscriptionAliasData.DeserializeBillingSubscriptionAliasData(e)), _billingSubscriptionAliasBillingSubscriptionsAliasesClientDiagnostics, Pipeline, "BillingSubscriptionAliasCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,7 +256,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingSubscriptionAliasBillingSubscriptionsAliasesRestClient.CreateListByBillingAccountRequest(_billingAccountName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingSubscriptionAliasBillingSubscriptionsAliasesRestClient.CreateListByBillingAccountNextPageRequest(nextLink, _billingAccountName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingSubscriptionAliasResource(Client, BillingSubscriptionAliasData.DeserializeBillingSubscriptionAliasData(e)), _billingSubscriptionAliasBillingSubscriptionsAliasesClientDiagnostics, Pipeline, "BillingSubscriptionAliasCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingSubscriptionAliasResource(Client, BillingSubscriptionAliasData.DeserializeBillingSubscriptionAliasData(e)), _billingSubscriptionAliasBillingSubscriptionsAliasesClientDiagnostics, Pipeline, "BillingSubscriptionAliasCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs index b7b2df09b1f0..6b01915cdcf5 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Billing /// public partial class BillingSubscriptionAliasData : ResourceData { - /// Initializes a new instance of BillingSubscriptionAliasData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingSubscriptionAliasData() { BillingPolicies = new ChangeTrackingDictionary(); SuspensionReasons = new ChangeTrackingList(); } - /// Initializes a new instance of BillingSubscriptionAliasData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -69,7 +72,8 @@ public BillingSubscriptionAliasData() /// The current enrollment account status of the subscription. This field is available only for the Enterprise Agreement billing accounts. /// The enrollment Account and the subscription association start date. This field is available only for the Enterprise Agreement billing accounts. /// The ID of the billing subscription with the subscription alias. - internal BillingSubscriptionAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingSubscriptionAutoRenewState? autoRenew, string beneficiaryTenantId, string billingFrequency, ResourceIdentifier billingProfileId, IReadOnlyDictionary billingPolicies, string billingProfileDisplayName, string billingProfileName, string consumptionCostCenter, string customerId, string customerDisplayName, string displayName, string enrollmentAccountId, string enrollmentAccountDisplayName, ResourceIdentifier invoiceSectionId, string invoiceSectionDisplayName, string invoiceSectionName, BillingAmount lastMonthCharges, BillingAmount monthToDateCharges, NextBillingCycleDetails nextBillingCycleDetails, string offerId, string productCategory, string productType, string productTypeId, DateTimeOffset? purchaseOn, long? quantity, CreatedSubscriptionReseller reseller, SubscriptionRenewalTermDetails renewalTermDetails, string skuDescription, string skuId, BillingSubscriptionStatus? status, string subscriptionId, IReadOnlyList suspensionReasons, TimeSpan? termDuration, DateTimeOffset? termStartOn, DateTimeOffset? termEndOn, SubscriptionEnrollmentAccountStatus? subscriptionEnrollmentAccountStatus, DateTimeOffset? enrollmentAccountStartOn, ResourceIdentifier billingSubscriptionId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingSubscriptionAutoRenewState? autoRenew, string beneficiaryTenantId, string billingFrequency, ResourceIdentifier billingProfileId, IReadOnlyDictionary billingPolicies, string billingProfileDisplayName, string billingProfileName, string consumptionCostCenter, string customerId, string customerDisplayName, string displayName, string enrollmentAccountId, string enrollmentAccountDisplayName, ResourceIdentifier invoiceSectionId, string invoiceSectionDisplayName, string invoiceSectionName, BillingAmount lastMonthCharges, BillingAmount monthToDateCharges, NextBillingCycleDetails nextBillingCycleDetails, string offerId, string productCategory, string productType, string productTypeId, DateTimeOffset? purchaseOn, long? quantity, CreatedSubscriptionReseller reseller, SubscriptionRenewalTermDetails renewalTermDetails, string skuDescription, string skuId, BillingSubscriptionStatus? status, string subscriptionId, IReadOnlyList suspensionReasons, TimeSpan? termDuration, DateTimeOffset? termStartOn, DateTimeOffset? termEndOn, SubscriptionEnrollmentAccountStatus? subscriptionEnrollmentAccountStatus, DateTimeOffset? enrollmentAccountStartOn, ResourceIdentifier billingSubscriptionId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { AutoRenew = autoRenew; BeneficiaryTenantId = beneficiaryTenantId; @@ -109,6 +113,7 @@ internal BillingSubscriptionAliasData(ResourceIdentifier id, string name, Resour SubscriptionEnrollmentAccountStatus = subscriptionEnrollmentAccountStatus; EnrollmentAccountStartOn = enrollmentAccountStartOn; BillingSubscriptionId = billingSubscriptionId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether auto renewal is turned on or off for a subscription. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs index a70b4bb68f8e..4afa5ff6726f 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionCollection.cs @@ -152,7 +152,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingSubscriptionRestClient.CreateListByBillingAccountRequest(_billingAccountName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingSubscriptionRestClient.CreateListByBillingAccountNextPageRequest(nextLink, _billingAccountName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingSubscriptionResource(Client, BillingSubscriptionData.DeserializeBillingSubscriptionData(e)), _billingSubscriptionClientDiagnostics, Pipeline, "BillingSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingSubscriptionResource(Client, BillingSubscriptionData.DeserializeBillingSubscriptionData(e)), _billingSubscriptionClientDiagnostics, Pipeline, "BillingSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -174,7 +174,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingSubscriptionRestClient.CreateListByBillingAccountRequest(_billingAccountName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingSubscriptionRestClient.CreateListByBillingAccountNextPageRequest(nextLink, _billingAccountName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingSubscriptionResource(Client, BillingSubscriptionData.DeserializeBillingSubscriptionData(e)), _billingSubscriptionClientDiagnostics, Pipeline, "BillingSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingSubscriptionResource(Client, BillingSubscriptionData.DeserializeBillingSubscriptionData(e)), _billingSubscriptionClientDiagnostics, Pipeline, "BillingSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs index 27927bde7549..3b0a91bc7d10 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Billing /// public partial class BillingSubscriptionData : ResourceData { - /// Initializes a new instance of BillingSubscriptionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingSubscriptionData() { BillingPolicies = new ChangeTrackingDictionary(); SuspensionReasons = new ChangeTrackingList(); } - /// Initializes a new instance of BillingSubscriptionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -68,7 +71,8 @@ public BillingSubscriptionData() /// The end date of the term in UTC time. /// The current enrollment account status of the subscription. This field is available only for the Enterprise Agreement billing accounts. /// The enrollment Account and the subscription association start date. This field is available only for the Enterprise Agreement billing accounts. - internal BillingSubscriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingSubscriptionAutoRenewState? autoRenew, string beneficiaryTenantId, string billingFrequency, ResourceIdentifier billingProfileId, IReadOnlyDictionary billingPolicies, string billingProfileDisplayName, string billingProfileName, string consumptionCostCenter, string customerId, string customerDisplayName, string displayName, string enrollmentAccountId, string enrollmentAccountDisplayName, ResourceIdentifier invoiceSectionId, string invoiceSectionDisplayName, string invoiceSectionName, BillingAmount lastMonthCharges, BillingAmount monthToDateCharges, NextBillingCycleDetails nextBillingCycleDetails, string offerId, string productCategory, string productType, string productTypeId, DateTimeOffset? purchaseOn, long? quantity, CreatedSubscriptionReseller reseller, SubscriptionRenewalTermDetails renewalTermDetails, string skuDescription, string skuId, BillingSubscriptionStatus? status, string subscriptionId, IReadOnlyList suspensionReasons, TimeSpan? termDuration, DateTimeOffset? termStartOn, DateTimeOffset? termEndOn, SubscriptionEnrollmentAccountStatus? subscriptionEnrollmentAccountStatus, DateTimeOffset? enrollmentAccountStartOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingSubscriptionAutoRenewState? autoRenew, string beneficiaryTenantId, string billingFrequency, ResourceIdentifier billingProfileId, IReadOnlyDictionary billingPolicies, string billingProfileDisplayName, string billingProfileName, string consumptionCostCenter, string customerId, string customerDisplayName, string displayName, string enrollmentAccountId, string enrollmentAccountDisplayName, ResourceIdentifier invoiceSectionId, string invoiceSectionDisplayName, string invoiceSectionName, BillingAmount lastMonthCharges, BillingAmount monthToDateCharges, NextBillingCycleDetails nextBillingCycleDetails, string offerId, string productCategory, string productType, string productTypeId, DateTimeOffset? purchaseOn, long? quantity, CreatedSubscriptionReseller reseller, SubscriptionRenewalTermDetails renewalTermDetails, string skuDescription, string skuId, BillingSubscriptionStatus? status, string subscriptionId, IReadOnlyList suspensionReasons, TimeSpan? termDuration, DateTimeOffset? termStartOn, DateTimeOffset? termEndOn, SubscriptionEnrollmentAccountStatus? subscriptionEnrollmentAccountStatus, DateTimeOffset? enrollmentAccountStartOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { AutoRenew = autoRenew; BeneficiaryTenantId = beneficiaryTenantId; @@ -107,6 +111,7 @@ internal BillingSubscriptionData(ResourceIdentifier id, string name, ResourceTyp TermEndOn = termEndOn; SubscriptionEnrollmentAccountStatus = subscriptionEnrollmentAccountStatus; EnrollmentAccountStartOn = enrollmentAccountStartOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether auto renewal is turned on or off for a subscription. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.Serialization.cs index cd5b6f6c0457..e02f41f04196 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class BillingAmount + public partial class BillingAmount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingAmount DeserializeBillingAmount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingAmount DeserializeBillingAmount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional currency = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("currency"u8)) @@ -36,8 +65,61 @@ internal static BillingAmount DeserializeBillingAmount(JsonElement element) value = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingAmount(currency.Value, Optional.ToNullable(value)); + return new BillingAmount(currency.Value, Optional.ToNullable(value), serializedAdditionalRawData); + } + + BillingAmount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingAmount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingAmount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingAmount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingAmount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingAmount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingAmount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.cs index 77acc9493f2d..a741711c6d36 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingAmount.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Billing.Models { /// The amount. public partial class BillingAmount { - /// Initializes a new instance of BillingAmount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingAmount() { } - /// Initializes a new instance of BillingAmount. + /// Initializes a new instance of . /// The currency for the amount value. /// Amount value. - internal BillingAmount(string currency, float? value) + /// Keeps track of any properties unknown to the library. + internal BillingAmount(string currency, float? value, Dictionary serializedAdditionalRawData) { Currency = currency; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The currency for the amount value. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodData.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodData.Serialization.cs index 6cf1bb5007ce..6d84b0dfa911 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodData.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Billing { - public partial class BillingPaymentMethodData : IUtf8JsonSerializable + public partial class BillingPaymentMethodData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -31,7 +38,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Logos) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Status.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingPaymentMethodData DeserializeBillingPaymentMethodData(JsonElement element) + internal static BillingPaymentMethodData DeserializeBillingPaymentMethodData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static BillingPaymentMethodData DeserializeBillingPaymentMethodData(Jso Optional displayName = default; Optional> logos = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -157,8 +186,61 @@ internal static BillingPaymentMethodData DeserializeBillingPaymentMethodData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingPaymentMethodData(id, name, type, systemData.Value, Optional.ToNullable(family), type0.Value, accountHolderName.Value, expiration.Value, lastFourDigits.Value, displayName.Value, Optional.ToList(logos), Optional.ToNullable(status), serializedAdditionalRawData); + } + + BillingPaymentMethodData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingPaymentMethodData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingPaymentMethodData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingPaymentMethodData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingPaymentMethodData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingPaymentMethodData(Response response) + { + if (response is null) + { + return null; } - return new BillingPaymentMethodData(id, name, type, systemData.Value, Optional.ToNullable(family), type0.Value, accountHolderName.Value, expiration.Value, lastFourDigits.Value, displayName.Value, Optional.ToList(logos), Optional.ToNullable(status)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingPaymentMethodData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodLinkData.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodLinkData.Serialization.cs index 00a4f0ed9df1..e3c4d44b72af 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodLinkData.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingPaymentMethodLinkData.Serialization.cs @@ -5,31 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Billing { - public partial class BillingPaymentMethodLinkData : IUtf8JsonSerializable + public partial class BillingPaymentMethodLinkData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PaymentMethod)) { writer.WritePropertyName("paymentMethod"u8); - writer.WriteObjectValue(PaymentMethod); + if (PaymentMethod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PaymentMethod).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingPaymentMethodLinkData DeserializeBillingPaymentMethodLinkData(JsonElement element) + internal static BillingPaymentMethodLinkData DeserializeBillingPaymentMethodLinkData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static BillingPaymentMethodLinkData DeserializeBillingPaymentMethodLink ResourceType type = default; Optional systemData = default; Optional paymentMethod = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +116,61 @@ internal static BillingPaymentMethodLinkData DeserializeBillingPaymentMethodLink } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingPaymentMethodLinkData(id, name, type, systemData.Value, paymentMethod.Value, serializedAdditionalRawData); + } + + BillingPaymentMethodLinkData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingPaymentMethodLinkData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingPaymentMethodLinkData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingPaymentMethodLinkData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingPaymentMethodLinkData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingPaymentMethodLinkData(Response response) + { + if (response is null) + { + return null; } - return new BillingPaymentMethodLinkData(id, name, type, systemData.Value, paymentMethod.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingPaymentMethodLinkData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasData.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasData.Serialization.cs index 4a4f9ed99600..00cd6172bafb 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasData.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Billing { - public partial class BillingSubscriptionAliasData : IUtf8JsonSerializable + public partial class BillingSubscriptionAliasData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -85,11 +91,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingSubscriptionAliasData DeserializeBillingSubscriptionAliasData(JsonElement element) + internal static BillingSubscriptionAliasData DeserializeBillingSubscriptionAliasData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -136,6 +156,7 @@ internal static BillingSubscriptionAliasData DeserializeBillingSubscriptionAlias Optional billingSubscriptionId = default; Optional subscriptionEnrollmentAccountStatus = default; Optional enrollmentAccountStartDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -462,8 +483,61 @@ internal static BillingSubscriptionAliasData DeserializeBillingSubscriptionAlias } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingSubscriptionAliasData(id, name, type, systemData.Value, Optional.ToNullable(autoRenew), beneficiaryTenantId.Value, billingFrequency.Value, billingProfileId.Value, Optional.ToDictionary(billingPolicies), billingProfileDisplayName.Value, billingProfileName.Value, consumptionCostCenter.Value, customerId.Value, customerDisplayName.Value, displayName.Value, enrollmentAccountId.Value, enrollmentAccountDisplayName.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, invoiceSectionName.Value, lastMonthCharges.Value, monthToDateCharges.Value, nextBillingCycleDetails.Value, offerId.Value, productCategory.Value, productType.Value, productTypeId.Value, Optional.ToNullable(purchaseDate), Optional.ToNullable(quantity), reseller.Value, renewalTermDetails.Value, skuDescription.Value, skuId.Value, Optional.ToNullable(status), subscriptionId.Value, Optional.ToList(suspensionReasons), Optional.ToNullable(termDuration), Optional.ToNullable(termStartDate), Optional.ToNullable(termEndDate), Optional.ToNullable(subscriptionEnrollmentAccountStatus), Optional.ToNullable(enrollmentAccountStartDate), billingSubscriptionId.Value, serializedAdditionalRawData); + } + + BillingSubscriptionAliasData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionAliasData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionAliasData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionAliasData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionAliasData model) + { + if (model is null) + { + return null; } - return new BillingSubscriptionAliasData(id, name, type, systemData.Value, Optional.ToNullable(autoRenew), beneficiaryTenantId.Value, billingFrequency.Value, billingProfileId.Value, Optional.ToDictionary(billingPolicies), billingProfileDisplayName.Value, billingProfileName.Value, consumptionCostCenter.Value, customerId.Value, customerDisplayName.Value, displayName.Value, enrollmentAccountId.Value, enrollmentAccountDisplayName.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, invoiceSectionName.Value, lastMonthCharges.Value, monthToDateCharges.Value, nextBillingCycleDetails.Value, offerId.Value, productCategory.Value, productType.Value, productTypeId.Value, Optional.ToNullable(purchaseDate), Optional.ToNullable(quantity), reseller.Value, renewalTermDetails.Value, skuDescription.Value, skuId.Value, Optional.ToNullable(status), subscriptionId.Value, Optional.ToList(suspensionReasons), Optional.ToNullable(termDuration), Optional.ToNullable(termStartDate), Optional.ToNullable(termEndDate), Optional.ToNullable(subscriptionEnrollmentAccountStatus), Optional.ToNullable(enrollmentAccountStartDate), billingSubscriptionId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionAliasData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionAliasData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.Serialization.cs index 757078eea9a1..ce474beb597b 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing; namespace Azure.ResourceManager.Billing.Models { - internal partial class BillingSubscriptionAliasListResult + internal partial class BillingSubscriptionAliasListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingSubscriptionAliasListResult DeserializeBillingSubscriptionAliasListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingSubscriptionAliasListResult DeserializeBillingSubscriptionAliasListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static BillingSubscriptionAliasListResult DeserializeBillingSubscriptio nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingSubscriptionAliasListResult(Optional.ToList(value), nextLink.Value); + return new BillingSubscriptionAliasListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BillingSubscriptionAliasListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionAliasListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionAliasListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionAliasListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionAliasListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionAliasListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionAliasListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.cs index c66d609004a6..38f9164d127d 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionAliasListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Billing; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Billing.Models /// The list of billing subscription aliases. internal partial class BillingSubscriptionAliasListResult { - /// Initializes a new instance of BillingSubscriptionAliasListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingSubscriptionAliasListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BillingSubscriptionAliasListResult. + /// Initializes a new instance of . /// The list of billing subscription aliases. /// The link (url) to the next page of results. - internal BillingSubscriptionAliasListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionAliasListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of billing subscription aliases. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionData.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionData.Serialization.cs index b5995a8b8b2d..8ab207e43cc9 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionData.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Billing { - public partial class BillingSubscriptionData : IUtf8JsonSerializable + public partial class BillingSubscriptionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -85,11 +91,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingSubscriptionData DeserializeBillingSubscriptionData(JsonElement element) + internal static BillingSubscriptionData DeserializeBillingSubscriptionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -135,6 +155,7 @@ internal static BillingSubscriptionData DeserializeBillingSubscriptionData(JsonE Optional termEndDate = default; Optional subscriptionEnrollmentAccountStatus = default; Optional enrollmentAccountStartDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -452,8 +473,61 @@ internal static BillingSubscriptionData DeserializeBillingSubscriptionData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingSubscriptionData(id, name, type, systemData.Value, Optional.ToNullable(autoRenew), beneficiaryTenantId.Value, billingFrequency.Value, billingProfileId.Value, Optional.ToDictionary(billingPolicies), billingProfileDisplayName.Value, billingProfileName.Value, consumptionCostCenter.Value, customerId.Value, customerDisplayName.Value, displayName.Value, enrollmentAccountId.Value, enrollmentAccountDisplayName.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, invoiceSectionName.Value, lastMonthCharges.Value, monthToDateCharges.Value, nextBillingCycleDetails.Value, offerId.Value, productCategory.Value, productType.Value, productTypeId.Value, Optional.ToNullable(purchaseDate), Optional.ToNullable(quantity), reseller.Value, renewalTermDetails.Value, skuDescription.Value, skuId.Value, Optional.ToNullable(status), subscriptionId.Value, Optional.ToList(suspensionReasons), Optional.ToNullable(termDuration), Optional.ToNullable(termStartDate), Optional.ToNullable(termEndDate), Optional.ToNullable(subscriptionEnrollmentAccountStatus), Optional.ToNullable(enrollmentAccountStartDate), serializedAdditionalRawData); + } + + BillingSubscriptionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionData model) + { + if (model is null) + { + return null; } - return new BillingSubscriptionData(id, name, type, systemData.Value, Optional.ToNullable(autoRenew), beneficiaryTenantId.Value, billingFrequency.Value, billingProfileId.Value, Optional.ToDictionary(billingPolicies), billingProfileDisplayName.Value, billingProfileName.Value, consumptionCostCenter.Value, customerId.Value, customerDisplayName.Value, displayName.Value, enrollmentAccountId.Value, enrollmentAccountDisplayName.Value, invoiceSectionId.Value, invoiceSectionDisplayName.Value, invoiceSectionName.Value, lastMonthCharges.Value, monthToDateCharges.Value, nextBillingCycleDetails.Value, offerId.Value, productCategory.Value, productType.Value, productTypeId.Value, Optional.ToNullable(purchaseDate), Optional.ToNullable(quantity), reseller.Value, renewalTermDetails.Value, skuDescription.Value, skuId.Value, Optional.ToNullable(status), subscriptionId.Value, Optional.ToList(suspensionReasons), Optional.ToNullable(termDuration), Optional.ToNullable(termStartDate), Optional.ToNullable(termEndDate), Optional.ToNullable(subscriptionEnrollmentAccountStatus), Optional.ToNullable(enrollmentAccountStartDate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.Serialization.cs index a18721010513..4a6b9783c60c 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class BillingSubscriptionMergeContent : IUtf8JsonSerializable + public partial class BillingSubscriptionMergeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TargetBillingSubscriptionName)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("quantity"u8); writer.WriteNumberValue(Quantity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BillingSubscriptionMergeContent DeserializeBillingSubscriptionMergeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional targetBillingSubscriptionName = default; + Optional quantity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetBillingSubscriptionName"u8)) + { + targetBillingSubscriptionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("quantity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quantity = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingSubscriptionMergeContent(targetBillingSubscriptionName.Value, Optional.ToNullable(quantity), serializedAdditionalRawData); + } + + BillingSubscriptionMergeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionMergeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionMergeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionMergeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionMergeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionMergeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionMergeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.cs index a0951245ee68..8984f9599f36 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMergeContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Billing.Models { /// Request to merge two billing subscriptions. public partial class BillingSubscriptionMergeContent { - /// Initializes a new instance of BillingSubscriptionMergeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingSubscriptionMergeContent() { } + /// Initializes a new instance of . + /// The ID of the target billing subscription that will be merged with the source subscription provided in the request. + /// The quantity of the source billing subscription that will be merged with the target billing subscription. + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionMergeContent(string targetBillingSubscriptionName, int? quantity, Dictionary serializedAdditionalRawData) + { + TargetBillingSubscriptionName = targetBillingSubscriptionName; + Quantity = quantity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The ID of the target billing subscription that will be merged with the source subscription provided in the request. public string TargetBillingSubscriptionName { get; set; } /// The quantity of the source billing subscription that will be merged with the target billing subscription. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.Serialization.cs index 6d42fc4bf1fc..f80f21c2822a 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class BillingSubscriptionMoveContent : IUtf8JsonSerializable + public partial class BillingSubscriptionMoveContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DestinationEnrollmentAccountId)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("destinationInvoiceSectionId"u8); writer.WriteStringValue(DestinationInvoiceSectionId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BillingSubscriptionMoveContent DeserializeBillingSubscriptionMoveContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional destinationEnrollmentAccountId = default; + Optional destinationInvoiceSectionId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("destinationEnrollmentAccountId"u8)) + { + destinationEnrollmentAccountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("destinationInvoiceSectionId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + destinationInvoiceSectionId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingSubscriptionMoveContent(destinationEnrollmentAccountId.Value, destinationInvoiceSectionId.Value, serializedAdditionalRawData); + } + + BillingSubscriptionMoveContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionMoveContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionMoveContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionMoveContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionMoveContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionMoveContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionMoveContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.cs index 47ac80963bbf..1f2b0f17ae9a 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionMoveContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Billing.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.Billing.Models /// Request parameters to transfer billing subscription. public partial class BillingSubscriptionMoveContent { - /// Initializes a new instance of BillingSubscriptionMoveContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingSubscriptionMoveContent() { } + /// Initializes a new instance of . + /// The destination enrollment account id. + /// The destination invoice section id. + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionMoveContent(string destinationEnrollmentAccountId, ResourceIdentifier destinationInvoiceSectionId, Dictionary serializedAdditionalRawData) + { + DestinationEnrollmentAccountId = destinationEnrollmentAccountId; + DestinationInvoiceSectionId = destinationInvoiceSectionId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The destination enrollment account id. public string DestinationEnrollmentAccountId { get; set; } /// The destination invoice section id. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.Serialization.cs index d9b95f53000e..4f4c6cca6181 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class BillingSubscriptionSplitContent : IUtf8JsonSerializable + public partial class BillingSubscriptionSplitContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BillingFrequency)) { @@ -40,7 +48,125 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("termDuration"u8); writer.WriteStringValue(TermDuration.Value, "P"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BillingSubscriptionSplitContent DeserializeBillingSubscriptionSplitContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional billingFrequency = default; + Optional quantity = default; + Optional targetProductTypeId = default; + Optional targetSkuId = default; + Optional termDuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("billingFrequency"u8)) + { + billingFrequency = property.Value.GetString(); + continue; + } + if (property.NameEquals("quantity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quantity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("targetProductTypeId"u8)) + { + targetProductTypeId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetSkuId"u8)) + { + targetSkuId = property.Value.GetString(); + continue; + } + if (property.NameEquals("termDuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + termDuration = property.Value.GetTimeSpan("P"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingSubscriptionSplitContent(billingFrequency.Value, Optional.ToNullable(quantity), targetProductTypeId.Value, targetSkuId.Value, Optional.ToNullable(termDuration), serializedAdditionalRawData); + } + + BillingSubscriptionSplitContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionSplitContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionSplitContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionSplitContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionSplitContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionSplitContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionSplitContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.cs index 336bc65099d8..3e8e1ed66c96 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionSplitContent.cs @@ -6,17 +6,38 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Billing.Models { /// Request to split a billing subscription. public partial class BillingSubscriptionSplitContent { - /// Initializes a new instance of BillingSubscriptionSplitContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingSubscriptionSplitContent() { } + /// Initializes a new instance of . + /// The billing frequency of the target subscription in the ISO8601 format. Example: P1M, P3M, P1Y. + /// The quantity of the target product to which the subscription needs to be split into. + /// The ID of the target product to which the subscription needs to be split into. This value is not same as the value returned in Get API call and can be retrieved from Catalog API to know the product id to split into. + /// The ID of the target product to which the subscription needs to be split into. This value is not same as the value returned in Get API call and can be retrieved from Catalog API to know the sku id to split into. + /// The term duration of the target in ISO8601 format product to which the subscription needs to be split into. Example: P1M, P1Y. + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionSplitContent(string billingFrequency, int? quantity, string targetProductTypeId, string targetSkuId, TimeSpan? termDuration, Dictionary serializedAdditionalRawData) + { + BillingFrequency = billingFrequency; + Quantity = quantity; + TargetProductTypeId = targetProductTypeId; + TargetSkuId = targetSkuId; + TermDuration = termDuration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The billing frequency of the target subscription in the ISO8601 format. Example: P1M, P3M, P1Y. public string BillingFrequency { get; set; } /// The quantity of the target product to which the subscription needs to be split into. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.Serialization.cs index bf69e657c1f3..08e5967e0487 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class BillingSubscriptionValidateMoveEligibilityError + public partial class BillingSubscriptionValidateMoveEligibilityError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingSubscriptionValidateMoveEligibilityError DeserializeBillingSubscriptionValidateMoveEligibilityError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStringValue(Details); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingSubscriptionValidateMoveEligibilityError DeserializeBillingSubscriptionValidateMoveEligibilityError(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static BillingSubscriptionValidateMoveEligibilityError DeserializeBilli Optional code = default; Optional message = default; Optional details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -42,8 +86,61 @@ internal static BillingSubscriptionValidateMoveEligibilityError DeserializeBilli details = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingSubscriptionValidateMoveEligibilityError(Optional.ToNullable(code), message.Value, details.Value); + return new BillingSubscriptionValidateMoveEligibilityError(Optional.ToNullable(code), message.Value, details.Value, serializedAdditionalRawData); + } + + BillingSubscriptionValidateMoveEligibilityError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionValidateMoveEligibilityError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionValidateMoveEligibilityError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionValidateMoveEligibilityError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionValidateMoveEligibilityError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionValidateMoveEligibilityError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionValidateMoveEligibilityError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.cs index 0dee88b95fd2..d64aff28ac16 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityError.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Billing.Models { /// Error details of the transfer eligibility validation. public partial class BillingSubscriptionValidateMoveEligibilityError { - /// Initializes a new instance of BillingSubscriptionValidateMoveEligibilityError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingSubscriptionValidateMoveEligibilityError() { } - /// Initializes a new instance of BillingSubscriptionValidateMoveEligibilityError. + /// Initializes a new instance of . /// Error code for the billing subscription move validation. /// The error message. /// Detailed error message explaining the error. - internal BillingSubscriptionValidateMoveEligibilityError(SubscriptionTransferValidationErrorCode? code, string message, string details) + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionValidateMoveEligibilityError(SubscriptionTransferValidationErrorCode? code, string message, string details, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code for the billing subscription move validation. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.Serialization.cs index 28b0528cf6c7..6363687be4eb 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.Serialization.cs @@ -5,21 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class BillingSubscriptionValidateMoveEligibilityResult + public partial class BillingSubscriptionValidateMoveEligibilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingSubscriptionValidateMoveEligibilityResult DeserializeBillingSubscriptionValidateMoveEligibilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ErrorDetails)) + { + writer.WritePropertyName("errorDetails"u8); + if (ErrorDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ErrorDetails).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingSubscriptionValidateMoveEligibilityResult DeserializeBillingSubscriptionValidateMoveEligibilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isMoveEligible = default; Optional errorDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isMoveEligible"u8)) @@ -40,8 +81,61 @@ internal static BillingSubscriptionValidateMoveEligibilityResult DeserializeBill errorDetails = BillingSubscriptionValidateMoveEligibilityError.DeserializeBillingSubscriptionValidateMoveEligibilityError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingSubscriptionValidateMoveEligibilityResult(Optional.ToNullable(isMoveEligible), errorDetails.Value); + return new BillingSubscriptionValidateMoveEligibilityResult(Optional.ToNullable(isMoveEligible), errorDetails.Value, serializedAdditionalRawData); + } + + BillingSubscriptionValidateMoveEligibilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionValidateMoveEligibilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionValidateMoveEligibilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionValidateMoveEligibilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionValidateMoveEligibilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionValidateMoveEligibilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionValidateMoveEligibilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.cs index 5b5a432a163f..8e85c004dedf 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionValidateMoveEligibilityResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Billing.Models { /// Result of the transfer eligibility validation. public partial class BillingSubscriptionValidateMoveEligibilityResult { - /// Initializes a new instance of BillingSubscriptionValidateMoveEligibilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingSubscriptionValidateMoveEligibilityResult() { } - /// Initializes a new instance of BillingSubscriptionValidateMoveEligibilityResult. + /// Initializes a new instance of . /// Specifies whether the subscription is eligible to move. /// Validation error details. - internal BillingSubscriptionValidateMoveEligibilityResult(bool? isMoveEligible, BillingSubscriptionValidateMoveEligibilityError errorDetails) + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionValidateMoveEligibilityResult(bool? isMoveEligible, BillingSubscriptionValidateMoveEligibilityError errorDetails, Dictionary serializedAdditionalRawData) { IsMoveEligible = isMoveEligible; ErrorDetails = errorDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies whether the subscription is eligible to move. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.Serialization.cs index 6d614f400211..1615192dd601 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing; namespace Azure.ResourceManager.Billing.Models { - internal partial class BillingSubscriptionsListResult + internal partial class BillingSubscriptionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingSubscriptionsListResult DeserializeBillingSubscriptionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingSubscriptionsListResult DeserializeBillingSubscriptionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static BillingSubscriptionsListResult DeserializeBillingSubscriptionsLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingSubscriptionsListResult(Optional.ToList(value), nextLink.Value); + return new BillingSubscriptionsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BillingSubscriptionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingSubscriptionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingSubscriptionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingSubscriptionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingSubscriptionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingSubscriptionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingSubscriptionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs index 0b5a95bb008b..00797f1fed85 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Billing; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Billing.Models /// The list of billing subscriptions. internal partial class BillingSubscriptionsListResult { - /// Initializes a new instance of BillingSubscriptionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingSubscriptionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BillingSubscriptionsListResult. + /// Initializes a new instance of . /// The list of billing subscriptions. /// The link (url) to the next page of results. - internal BillingSubscriptionsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BillingSubscriptionsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of billing subscriptions. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.Serialization.cs index aa9f8f5e0f16..132017b8b172 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class CreatedSubscriptionReseller + public partial class CreatedSubscriptionReseller : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CreatedSubscriptionReseller DeserializeCreatedSubscriptionReseller(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CreatedSubscriptionReseller DeserializeCreatedSubscriptionReseller(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resellerId = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resellerId"u8)) @@ -32,8 +61,61 @@ internal static CreatedSubscriptionReseller DeserializeCreatedSubscriptionResell description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CreatedSubscriptionReseller(resellerId.Value, description.Value); + return new CreatedSubscriptionReseller(resellerId.Value, description.Value, serializedAdditionalRawData); + } + + CreatedSubscriptionReseller IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreatedSubscriptionReseller(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreatedSubscriptionReseller IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreatedSubscriptionReseller(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreatedSubscriptionReseller model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreatedSubscriptionReseller(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreatedSubscriptionReseller(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.cs index cb90d97299fa..34a862bd2762 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/CreatedSubscriptionReseller.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Billing.Models { /// Details of the reseller. public partial class CreatedSubscriptionReseller { - /// Initializes a new instance of CreatedSubscriptionReseller. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CreatedSubscriptionReseller() { } - /// Initializes a new instance of CreatedSubscriptionReseller. + /// Initializes a new instance of . /// The MPN ID of the reseller. /// The name of the reseller. - internal CreatedSubscriptionReseller(string resellerId, string description) + /// Keeps track of any properties unknown to the library. + internal CreatedSubscriptionReseller(string resellerId, string description, Dictionary serializedAdditionalRawData) { ResellerId = resellerId; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The MPN ID of the reseller. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.Serialization.cs index d4bf329f94a3..28dfc1c01bca 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - internal partial class NextBillingCycleDetails + internal partial class NextBillingCycleDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NextBillingCycleDetails DeserializeNextBillingCycleDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NextBillingCycleDetails DeserializeNextBillingCycleDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional billingFrequency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("billingFrequency"u8)) @@ -26,8 +55,61 @@ internal static NextBillingCycleDetails DeserializeNextBillingCycleDetails(JsonE billingFrequency = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NextBillingCycleDetails(billingFrequency.Value); + return new NextBillingCycleDetails(billingFrequency.Value, serializedAdditionalRawData); + } + + NextBillingCycleDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNextBillingCycleDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NextBillingCycleDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNextBillingCycleDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NextBillingCycleDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NextBillingCycleDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNextBillingCycleDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.cs index 58366d580947..52e37d1f4b26 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/NextBillingCycleDetails.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Billing.Models { /// The next billing cycle details of the subscription. internal partial class NextBillingCycleDetails { - /// Initializes a new instance of NextBillingCycleDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NextBillingCycleDetails() { } - /// Initializes a new instance of NextBillingCycleDetails. + /// Initializes a new instance of . /// The billing frequency of the subscription in the next billing cycle. - internal NextBillingCycleDetails(string nextBillingCycleBillingFrequency) + /// Keeps track of any properties unknown to the library. + internal NextBillingCycleDetails(string nextBillingCycleBillingFrequency, Dictionary serializedAdditionalRawData) { NextBillingCycleBillingFrequency = nextBillingCycleBillingFrequency; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The billing frequency of the subscription in the next billing cycle. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.Serialization.cs index ed88c5b34595..2d29db59b017 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing; namespace Azure.ResourceManager.Billing.Models { - internal partial class PaymentMethodLinksListResult + internal partial class PaymentMethodLinksListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PaymentMethodLinksListResult DeserializePaymentMethodLinksListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PaymentMethodLinksListResult DeserializePaymentMethodLinksListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static PaymentMethodLinksListResult DeserializePaymentMethodLinksListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PaymentMethodLinksListResult(Optional.ToList(value), nextLink.Value); + return new PaymentMethodLinksListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PaymentMethodLinksListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaymentMethodLinksListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaymentMethodLinksListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaymentMethodLinksListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaymentMethodLinksListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaymentMethodLinksListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaymentMethodLinksListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.cs index b7041ce5bbed..69798d8c08e3 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLinksListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Billing; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Billing.Models /// The list of payment method links. internal partial class PaymentMethodLinksListResult { - /// Initializes a new instance of PaymentMethodLinksListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PaymentMethodLinksListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PaymentMethodLinksListResult. + /// Initializes a new instance of . /// The list of payment method links. /// The link (url) to the next page of results. - internal PaymentMethodLinksListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PaymentMethodLinksListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of payment method links. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.Serialization.cs index 9cd846ad22e2..d0eaf8826ebc 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.Serialization.cs @@ -6,27 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class PaymentMethodLogo : IUtf8JsonSerializable + public partial class PaymentMethodLogo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PaymentMethodLogo DeserializePaymentMethodLogo(JsonElement element) + internal static PaymentMethodLogo DeserializePaymentMethodLogo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional mimeType = default; Optional url = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mimeType"u8)) @@ -43,8 +65,61 @@ internal static PaymentMethodLogo DeserializePaymentMethodLogo(JsonElement eleme url = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PaymentMethodLogo(mimeType.Value, url.Value, serializedAdditionalRawData); + } + + PaymentMethodLogo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaymentMethodLogo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaymentMethodLogo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaymentMethodLogo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaymentMethodLogo model) + { + if (model is null) + { + return null; } - return new PaymentMethodLogo(mimeType.Value, url.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaymentMethodLogo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaymentMethodLogo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.cs index cab03358bcb3..0fe4120abd35 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodLogo.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Billing.Models { /// Logo of payment method. public partial class PaymentMethodLogo { - /// Initializes a new instance of PaymentMethodLogo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PaymentMethodLogo() { } - /// Initializes a new instance of PaymentMethodLogo. + /// Initializes a new instance of . /// MIME type of the logo. /// Public URL of image of the logo. - internal PaymentMethodLogo(string mimeType, Uri uri) + /// Keeps track of any properties unknown to the library. + internal PaymentMethodLogo(string mimeType, Uri uri, Dictionary serializedAdditionalRawData) { MimeType = mimeType; Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// MIME type of the logo. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.Serialization.cs index 5312d45d61b8..d5a9fe987384 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class PaymentMethodProjectionProperties : IUtf8JsonSerializable + public partial class PaymentMethodProjectionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Family)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Logos) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PaymentMethodProjectionProperties DeserializePaymentMethodProjectionProperties(JsonElement element) + internal static PaymentMethodProjectionProperties DeserializePaymentMethodProjectionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static PaymentMethodProjectionProperties DeserializePaymentMethodProjec Optional displayName = default; Optional> logos = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -122,8 +151,61 @@ internal static PaymentMethodProjectionProperties DeserializePaymentMethodProjec status = new PaymentMethodStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PaymentMethodProjectionProperties(id.Value, Optional.ToNullable(family), type.Value, accountHolderName.Value, expiration.Value, lastFourDigits.Value, displayName.Value, Optional.ToList(logos), Optional.ToNullable(status), serializedAdditionalRawData); + } + + PaymentMethodProjectionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaymentMethodProjectionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaymentMethodProjectionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaymentMethodProjectionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaymentMethodProjectionProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaymentMethodProjectionProperties(Response response) + { + if (response is null) + { + return null; } - return new PaymentMethodProjectionProperties(id.Value, Optional.ToNullable(family), type.Value, accountHolderName.Value, expiration.Value, lastFourDigits.Value, displayName.Value, Optional.ToList(logos), Optional.ToNullable(status)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaymentMethodProjectionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.cs index 74741c37308d..28c6c9662309 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodProjectionProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.Billing.Models /// The properties of a payment method projection. public partial class PaymentMethodProjectionProperties { - /// Initializes a new instance of PaymentMethodProjectionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PaymentMethodProjectionProperties() { Logos = new ChangeTrackingList(); } - /// Initializes a new instance of PaymentMethodProjectionProperties. + /// Initializes a new instance of . /// Id of payment method. /// The family of payment method. /// The type of payment method. @@ -29,7 +33,8 @@ public PaymentMethodProjectionProperties() /// The display name of the payment method. /// The list of logos for the payment method. /// Status of the payment method. - internal PaymentMethodProjectionProperties(ResourceIdentifier paymentMethodId, PaymentMethodFamily? family, string paymentMethodProjectionPropertiesType, string accountHolderName, string expiration, string lastFourDigits, string displayName, IList logos, PaymentMethodStatus? status) + /// Keeps track of any properties unknown to the library. + internal PaymentMethodProjectionProperties(ResourceIdentifier paymentMethodId, PaymentMethodFamily? family, string paymentMethodProjectionPropertiesType, string accountHolderName, string expiration, string lastFourDigits, string displayName, IList logos, PaymentMethodStatus? status, Dictionary serializedAdditionalRawData) { PaymentMethodId = paymentMethodId; Family = family; @@ -40,6 +45,7 @@ internal PaymentMethodProjectionProperties(ResourceIdentifier paymentMethodId, P DisplayName = displayName; Logos = logos; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of payment method. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.Serialization.cs index d915e4c4d488..3a4fae291e25 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Billing; namespace Azure.ResourceManager.Billing.Models { - internal partial class PaymentMethodsListResult + internal partial class PaymentMethodsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PaymentMethodsListResult DeserializePaymentMethodsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PaymentMethodsListResult DeserializePaymentMethodsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static PaymentMethodsListResult DeserializePaymentMethodsListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PaymentMethodsListResult(Optional.ToList(value), nextLink.Value); + return new PaymentMethodsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PaymentMethodsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaymentMethodsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaymentMethodsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaymentMethodsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaymentMethodsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaymentMethodsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaymentMethodsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.cs index 2ee014bb6896..060991cb53d4 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/PaymentMethodsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Billing; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Billing.Models /// The list of payment methods. internal partial class PaymentMethodsListResult { - /// Initializes a new instance of PaymentMethodsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PaymentMethodsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PaymentMethodsListResult. + /// Initializes a new instance of . /// The list of payment methods. /// The link (url) to the next page of results. - internal PaymentMethodsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PaymentMethodsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of payment methods. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.Serialization.cs index 62ba8b0d108c..83890d4124b4 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.Serialization.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.Serialization.cs @@ -6,15 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Billing.Models { - public partial class SubscriptionRenewalTermDetails + public partial class SubscriptionRenewalTermDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SubscriptionRenewalTermDetails DeserializeSubscriptionRenewalTermDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Quantity)) + { + writer.WritePropertyName("quantity"u8); + writer.WriteNumberValue(Quantity.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SubscriptionRenewalTermDetails DeserializeSubscriptionRenewalTermDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +56,7 @@ internal static SubscriptionRenewalTermDetails DeserializeSubscriptionRenewalTer Optional quantity = default; Optional skuId = default; Optional termDuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("billingFrequency"u8)) @@ -59,8 +92,61 @@ internal static SubscriptionRenewalTermDetails DeserializeSubscriptionRenewalTer termDuration = property.Value.GetTimeSpan("P"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SubscriptionRenewalTermDetails(billingFrequency.Value, productTypeId.Value, Optional.ToNullable(quantity), skuId.Value, Optional.ToNullable(termDuration)); + return new SubscriptionRenewalTermDetails(billingFrequency.Value, productTypeId.Value, Optional.ToNullable(quantity), skuId.Value, Optional.ToNullable(termDuration), serializedAdditionalRawData); + } + + SubscriptionRenewalTermDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionRenewalTermDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionRenewalTermDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionRenewalTermDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionRenewalTermDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionRenewalTermDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionRenewalTermDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.cs index 3927b0288b14..c208153db70e 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/SubscriptionRenewalTermDetails.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Billing.Models { /// The term details of the subscription at renewal. public partial class SubscriptionRenewalTermDetails { - /// Initializes a new instance of SubscriptionRenewalTermDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SubscriptionRenewalTermDetails() { } - /// Initializes a new instance of SubscriptionRenewalTermDetails. + /// Initializes a new instance of . /// The billing frequency of the subscription. /// The ID of the product. /// The number of licenses. /// The SKU ID of the product. /// The term duration of the subscription. Example P1M and P1Y. - internal SubscriptionRenewalTermDetails(string billingFrequency, string productTypeId, long? quantity, string skuId, TimeSpan? termDuration) + /// Keeps track of any properties unknown to the library. + internal SubscriptionRenewalTermDetails(string billingFrequency, string productTypeId, long? quantity, string skuId, TimeSpan? termDuration, Dictionary serializedAdditionalRawData) { BillingFrequency = billingFrequency; ProductTypeId = productTypeId; Quantity = quantity; SkuId = skuId; TermDuration = termDuration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The billing frequency of the subscription. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsAliasesRestOperations.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsAliasesRestOperations.cs index 35c9b6a71ec2..d0eb58dc01cc 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsAliasesRestOperations.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsAliasesRestOperations.cs @@ -195,9 +195,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string billingAccountName, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsRestOperations.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsRestOperations.cs index db1bc7efb215..392cec4914e8 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsRestOperations.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingSubscriptionsRestOperations.cs @@ -195,9 +195,7 @@ internal HttpMessage CreateUpdateRequest(string billingAccountName, string billi request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -334,9 +332,7 @@ internal HttpMessage CreateMoveRequest(string billingAccountName, string billing request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -407,9 +403,7 @@ internal HttpMessage CreateValidateMoveEligibilityRequest(string billingAccountN request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -488,9 +482,7 @@ internal HttpMessage CreateMergeRequest(string billingAccountName, string billin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -561,9 +553,7 @@ internal HttpMessage CreateSplitRequest(string billingAccountName, string billin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/ArmBillingBenefitsModelFactory.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/ArmBillingBenefitsModelFactory.cs index d7acdf286f58..717b20ac9fae 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/ArmBillingBenefitsModelFactory.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/ArmBillingBenefitsModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// Model factory for models. public static partial class ArmBillingBenefitsModelFactory { - /// Initializes a new instance of BillingBenefitsSavingsPlanOrderAliasData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,10 +36,10 @@ public static partial class ArmBillingBenefitsModelFactory /// A new instance for mocking. public static BillingBenefitsSavingsPlanOrderAliasData BillingBenefitsSavingsPlanOrderAliasData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string skuName = null, string kind = null, string displayName = null, ResourceIdentifier savingsPlanOrderId = null, BillingBenefitsProvisioningState? provisioningState = null, ResourceIdentifier billingScopeId = null, BillingBenefitsTerm? term = null, BillingBenefitsBillingPlan? billingPlan = null, BillingBenefitsAppliedScopeType? appliedScopeType = null, BillingBenefitsAppliedScopeProperties appliedScopeProperties = null, BillingBenefitsCommitment commitment = null) { - return new BillingBenefitsSavingsPlanOrderAliasData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName) : null, kind, displayName, savingsPlanOrderId, provisioningState, billingScopeId, term, billingPlan, appliedScopeType, appliedScopeProperties, commitment); + return new BillingBenefitsSavingsPlanOrderAliasData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName, new Dictionary()) : null, kind, displayName, savingsPlanOrderId, provisioningState, billingScopeId, term, billingPlan, appliedScopeType, appliedScopeProperties, commitment, default); } - /// Initializes a new instance of BillingBenefitsSavingsPlanOrderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -63,10 +63,10 @@ public static BillingBenefitsSavingsPlanOrderData BillingBenefitsSavingsPlanOrde { savingsPlans ??= new List(); - return new BillingBenefitsSavingsPlanOrderData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName) : null, displayName, provisioningState, billingScopeId, billingProfileId, customerId, billingAccountId, term, billingPlan, expireOn, benefitStartOn, planInformation, savingsPlans?.ToList(), extendedStatusInfo); + return new BillingBenefitsSavingsPlanOrderData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName, new Dictionary()) : null, displayName, provisioningState, billingScopeId, billingProfileId, customerId, billingAccountId, term, billingPlan, expireOn, benefitStartOn, planInformation, savingsPlans?.ToList(), extendedStatusInfo, default); } - /// Initializes a new instance of SavingsPlanOrderPaymentDetail. + /// Initializes a new instance of . /// Date when the payment needs to be done. /// Date when the transaction is completed. Is null when it is scheduled. /// Amount in pricing currency. Tax not included. @@ -77,19 +77,19 @@ public static BillingBenefitsSavingsPlanOrderData BillingBenefitsSavingsPlanOrde /// A new instance for mocking. public static SavingsPlanOrderPaymentDetail SavingsPlanOrderPaymentDetail(DateTimeOffset? dueOn = null, DateTimeOffset? payOn = null, BillingBenefitsPrice pricingCurrencyTotal = null, BillingBenefitsPrice billingCurrencyTotal = null, BillingBenefitsPaymentStatus? status = null, BillingBenefitsExtendedStatusInfo extendedStatusInfo = null, string billingAccount = null) { - return new SavingsPlanOrderPaymentDetail(dueOn, payOn, pricingCurrencyTotal, billingCurrencyTotal, status, extendedStatusInfo, billingAccount); + return new SavingsPlanOrderPaymentDetail(dueOn, payOn, pricingCurrencyTotal, billingCurrencyTotal, status, extendedStatusInfo, billingAccount, default); } - /// Initializes a new instance of BillingBenefitsExtendedStatusInfo. + /// Initializes a new instance of . /// Status code providing additional information. /// The message giving detailed information about the status code. /// A new instance for mocking. public static BillingBenefitsExtendedStatusInfo BillingBenefitsExtendedStatusInfo(string statusCode = null, string message = null) { - return new BillingBenefitsExtendedStatusInfo(statusCode, message); + return new BillingBenefitsExtendedStatusInfo(statusCode, message, default); } - /// Initializes a new instance of BillingBenefitsRoleAssignmentEntity. + /// Initializes a new instance of . /// Role assignment entity id. /// Role assignment entity name. /// Principal Id. @@ -98,10 +98,10 @@ public static BillingBenefitsExtendedStatusInfo BillingBenefitsExtendedStatusInf /// A new instance for mocking. public static BillingBenefitsRoleAssignmentEntity BillingBenefitsRoleAssignmentEntity(ResourceIdentifier id = null, string name = null, string principalId = null, ResourceIdentifier roleDefinitionId = null, ResourceIdentifier scope = null) { - return new BillingBenefitsRoleAssignmentEntity(id, name, principalId, roleDefinitionId, scope); + return new BillingBenefitsRoleAssignmentEntity(id, name, principalId, roleDefinitionId, scope, default); } - /// Initializes a new instance of BillingBenefitsSavingsPlanData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -133,10 +133,10 @@ public static BillingBenefitsRoleAssignmentEntity BillingBenefitsRoleAssignmentE /// A new instance for mocking. public static BillingBenefitsSavingsPlanData BillingBenefitsSavingsPlanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string skuName = null, string displayName = null, BillingBenefitsProvisioningState? provisioningState = null, string displayProvisioningState = null, ResourceIdentifier billingScopeId = null, ResourceIdentifier billingProfileId = null, string customerId = null, ResourceIdentifier billingAccountId = null, BillingBenefitsTerm? term = null, BillingBenefitsBillingPlan? billingPlan = null, BillingBenefitsAppliedScopeType? appliedScopeType = null, string userFriendlyAppliedScopeType = null, BillingBenefitsAppliedScopeProperties appliedScopeProperties = null, BillingBenefitsCommitment commitment = null, DateTimeOffset? effectOn = null, DateTimeOffset? expireOn = null, DateTimeOffset? purchaseOn = null, DateTimeOffset? benefitStartOn = null, BillingBenefitsExtendedStatusInfo extendedStatusInfo = null, bool? isRenewed = null, BillingBenefitsSavingsPlanUtilization utilization = null, string renewSource = null, string renewDestination = null, BillingBenefitsPurchaseContent renewPurchaseProperties = null) { - return new BillingBenefitsSavingsPlanData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName) : null, displayName, provisioningState, displayProvisioningState, billingScopeId, billingProfileId, customerId, billingAccountId, term, billingPlan, appliedScopeType, userFriendlyAppliedScopeType, appliedScopeProperties, commitment, effectOn, expireOn, purchaseOn, benefitStartOn, extendedStatusInfo, isRenewed, utilization, renewSource, renewDestination, renewPurchaseProperties != null ? new RenewProperties(renewPurchaseProperties) : null); + return new BillingBenefitsSavingsPlanData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName, new Dictionary()) : null, displayName, provisioningState, displayProvisioningState, billingScopeId, billingProfileId, customerId, billingAccountId, term, billingPlan, appliedScopeType, userFriendlyAppliedScopeType, appliedScopeProperties, commitment, effectOn, expireOn, purchaseOn, benefitStartOn, extendedStatusInfo, isRenewed, utilization, renewSource, renewDestination, renewPurchaseProperties != null ? new RenewProperties(renewPurchaseProperties, new Dictionary()) : null, default); } - /// Initializes a new instance of BillingBenefitsSavingsPlanUtilization. + /// Initializes a new instance of . /// The number of days trend for a savings plan. /// The array of aggregates of a savings plan's utilization. /// A new instance for mocking. @@ -144,10 +144,10 @@ public static BillingBenefitsSavingsPlanUtilization BillingBenefitsSavingsPlanUt { aggregates ??= new List(); - return new BillingBenefitsSavingsPlanUtilization(trend, aggregates?.ToList()); + return new BillingBenefitsSavingsPlanUtilization(trend, aggregates?.ToList(), default); } - /// Initializes a new instance of BillingBenefitsSavingsPlanUtilizationAggregate. + /// Initializes a new instance of . /// The grain of the aggregate. /// The grain unit of the aggregate. /// The aggregate value. @@ -155,10 +155,10 @@ public static BillingBenefitsSavingsPlanUtilization BillingBenefitsSavingsPlanUt /// A new instance for mocking. public static BillingBenefitsSavingsPlanUtilizationAggregate BillingBenefitsSavingsPlanUtilizationAggregate(float? grain = null, string grainUnit = null, float? value = null, string valueUnit = null) { - return new BillingBenefitsSavingsPlanUtilizationAggregate(grain, grainUnit, value, valueUnit); + return new BillingBenefitsSavingsPlanUtilizationAggregate(grain, grainUnit, value, valueUnit, default); } - /// Initializes a new instance of BillingBenefitsPurchaseContent. + /// Initializes a new instance of . /// The SKU to be applied for this resource. /// Friendly name of the savings plan. /// Subscription that will be charged for purchasing the benefit. @@ -172,20 +172,20 @@ public static BillingBenefitsSavingsPlanUtilizationAggregate BillingBenefitsSavi /// A new instance for mocking. public static BillingBenefitsPurchaseContent BillingBenefitsPurchaseContent(string skuName = null, string displayName = null, ResourceIdentifier billingScopeId = null, BillingBenefitsTerm? term = null, BillingBenefitsBillingPlan? billingPlan = null, BillingBenefitsAppliedScopeType? appliedScopeType = null, BillingBenefitsCommitment commitment = null, DateTimeOffset? effectOn = null, bool? isRenewed = null, BillingBenefitsAppliedScopeProperties appliedScopeProperties = null) { - return new BillingBenefitsPurchaseContent(skuName != null ? new BillingBenefitsSku(skuName) : null, displayName, billingScopeId, term, billingPlan, appliedScopeType, commitment, effectOn, isRenewed, appliedScopeProperties); + return new BillingBenefitsPurchaseContent(skuName != null ? new BillingBenefitsSku(skuName, new Dictionary()) : null, displayName, billingScopeId, term, billingPlan, appliedScopeType, commitment, effectOn, isRenewed, appliedScopeProperties, default); } - /// Initializes a new instance of SavingsPlanValidateResult. + /// Initializes a new instance of . /// Indicates if the provided input was valid. /// Failure reason code if the provided input was invalid. /// Failure reason if the provided input was invalid. /// A new instance for mocking. public static SavingsPlanValidateResult SavingsPlanValidateResult(bool? isValid = null, string reasonCode = null, string reason = null) { - return new SavingsPlanValidateResult(isValid, reasonCode, reason); + return new SavingsPlanValidateResult(isValid, reasonCode, reason, default); } - /// Initializes a new instance of BillingBenefitsReservationOrderAliasCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -206,10 +206,10 @@ public static SavingsPlanValidateResult SavingsPlanValidateResult(bool? isValid /// A new instance for mocking. public static BillingBenefitsReservationOrderAliasCreateOrUpdateContent BillingBenefitsReservationOrderAliasCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string skuName = null, AzureLocation? location = null, string displayName = null, ResourceIdentifier billingScopeId = null, BillingBenefitsTerm? term = null, BillingBenefitsBillingPlan? billingPlan = null, BillingBenefitsAppliedScopeType? appliedScopeType = null, BillingBenefitsAppliedScopeProperties appliedScopeProperties = null, int? quantity = null, bool? isRenewed = null, BillingBenefitsReservedResourceType? reservedResourceType = null, DateTimeOffset? reviewOn = null, BillingBenefitsInstanceFlexibility? reservedResourceInstanceFlexibility = null) { - return new BillingBenefitsReservationOrderAliasCreateOrUpdateContent(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName) : null, location, displayName, billingScopeId, term, billingPlan, appliedScopeType, appliedScopeProperties, quantity, isRenewed, reservedResourceType, reviewOn, reservedResourceInstanceFlexibility != null ? new ReservationOrderAliasRequestPropertiesReservedResourceProperties(reservedResourceInstanceFlexibility) : null); + return new BillingBenefitsReservationOrderAliasCreateOrUpdateContent(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName, new Dictionary()) : null, location, displayName, billingScopeId, term, billingPlan, appliedScopeType, appliedScopeProperties, quantity, isRenewed, reservedResourceType, reviewOn, reservedResourceInstanceFlexibility != null ? new ReservationOrderAliasRequestPropertiesReservedResourceProperties(reservedResourceInstanceFlexibility, new Dictionary()) : null, default); } - /// Initializes a new instance of BillingBenefitsReservationOrderAliasData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -232,7 +232,7 @@ public static BillingBenefitsReservationOrderAliasCreateOrUpdateContent BillingB /// A new instance for mocking. public static BillingBenefitsReservationOrderAliasData BillingBenefitsReservationOrderAliasData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string skuName = null, AzureLocation? location = null, string displayName = null, ResourceIdentifier reservationOrderId = null, BillingBenefitsProvisioningState? provisioningState = null, ResourceIdentifier billingScopeId = null, BillingBenefitsTerm? term = null, BillingBenefitsBillingPlan? billingPlan = null, BillingBenefitsAppliedScopeType? appliedScopeType = null, BillingBenefitsAppliedScopeProperties appliedScopeProperties = null, int? quantity = null, bool? isRenewed = null, BillingBenefitsReservedResourceType? reservedResourceType = null, DateTimeOffset? reviewOn = null, BillingBenefitsInstanceFlexibility? reservedResourceInstanceFlexibility = null) { - return new BillingBenefitsReservationOrderAliasData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName) : null, location, displayName, reservationOrderId, provisioningState, billingScopeId, term, billingPlan, appliedScopeType, appliedScopeProperties, quantity, isRenewed, reservedResourceType, reviewOn, reservedResourceInstanceFlexibility != null ? new ReservationOrderAliasResponsePropertiesReservedResourceProperties(reservedResourceInstanceFlexibility) : null); + return new BillingBenefitsReservationOrderAliasData(id, name, resourceType, systemData, skuName != null ? new BillingBenefitsSku(skuName, new Dictionary()) : null, location, displayName, reservationOrderId, provisioningState, billingScopeId, term, billingPlan, appliedScopeType, appliedScopeProperties, quantity, isRenewed, reservedResourceType, reviewOn, reservedResourceInstanceFlexibility != null ? new ReservationOrderAliasResponsePropertiesReservedResourceProperties(reservedResourceInstanceFlexibility, new Dictionary()) : null, default); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasData.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasData.cs index 75877b823c3e..6e72bed80de3 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasData.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.BillingBenefits /// public partial class BillingBenefitsReservationOrderAliasData : ResourceData { - /// Initializes a new instance of BillingBenefitsReservationOrderAliasData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Reservation order SKU. /// is null. public BillingBenefitsReservationOrderAliasData(BillingBenefitsSku sku) @@ -28,7 +32,7 @@ public BillingBenefitsReservationOrderAliasData(BillingBenefitsSku sku) Sku = sku; } - /// Initializes a new instance of BillingBenefitsReservationOrderAliasData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +52,8 @@ public BillingBenefitsReservationOrderAliasData(BillingBenefitsSku sku) /// The type of the resource that is being reserved. /// This is the date-time when the Reservation needs to be reviewed. /// Properties specific to each reserved resource type. Not required if not applicable. - internal BillingBenefitsReservationOrderAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, AzureLocation? location, string displayName, ResourceIdentifier reservationOrderId, BillingBenefitsProvisioningState? provisioningState, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, int? quantity, bool? isRenewed, BillingBenefitsReservedResourceType? reservedResourceType, DateTimeOffset? reviewOn, ReservationOrderAliasResponsePropertiesReservedResourceProperties reservedResourceProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsReservationOrderAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, AzureLocation? location, string displayName, ResourceIdentifier reservationOrderId, BillingBenefitsProvisioningState? provisioningState, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, int? quantity, bool? isRenewed, BillingBenefitsReservedResourceType? reservedResourceType, DateTimeOffset? reviewOn, ReservationOrderAliasResponsePropertiesReservedResourceProperties reservedResourceProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; Location = location; @@ -65,6 +70,12 @@ internal BillingBenefitsReservationOrderAliasData(ResourceIdentifier id, string ReservedResourceType = reservedResourceType; ReviewOn = reviewOn; ReservedResourceProperties = reservedResourceProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingBenefitsReservationOrderAliasData() + { } /// Reservation order SKU. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs index 0a6cffd7be04..fee6368a8ea8 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanCollection.cs @@ -148,7 +148,7 @@ public virtual AsyncPageable GetAllAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingBenefitsSavingsPlanSavingsPlanRestClient.CreateListRequest(Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingBenefitsSavingsPlanSavingsPlanRestClient.CreateListNextPageRequest(nextLink, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingBenefitsSavingsPlanSavingsPlanRestClient.CreateListRequest(Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingBenefitsSavingsPlanSavingsPlanRestClient.CreateListNextPageRequest(nextLink, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanData.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanData.cs index 6d025cf862d4..cfe136c2fd6f 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanData.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.BillingBenefits /// public partial class BillingBenefitsSavingsPlanData : ResourceData { - /// Initializes a new instance of BillingBenefitsSavingsPlanData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Savings plan SKU. /// is null. public BillingBenefitsSavingsPlanData(BillingBenefitsSku sku) @@ -28,7 +32,7 @@ public BillingBenefitsSavingsPlanData(BillingBenefitsSku sku) Sku = sku; } - /// Initializes a new instance of BillingBenefitsSavingsPlanData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -57,7 +61,8 @@ public BillingBenefitsSavingsPlanData(BillingBenefitsSku sku) /// SavingsPlan Id of the SavingsPlan from which this SavingsPlan is renewed. /// SavingsPlan Id of the SavingsPlan which is purchased because of renew. /// - internal BillingBenefitsSavingsPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, string displayName, BillingBenefitsProvisioningState? provisioningState, string displayProvisioningState, ResourceIdentifier billingScopeId, ResourceIdentifier billingProfileId, string customerId, ResourceIdentifier billingAccountId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, string userFriendlyAppliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, BillingBenefitsCommitment commitment, DateTimeOffset? effectOn, DateTimeOffset? expireOn, DateTimeOffset? purchaseOn, DateTimeOffset? benefitStartOn, BillingBenefitsExtendedStatusInfo extendedStatusInfo, bool? isRenewed, BillingBenefitsSavingsPlanUtilization utilization, string renewSource, string renewDestination, RenewProperties renewProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, string displayName, BillingBenefitsProvisioningState? provisioningState, string displayProvisioningState, ResourceIdentifier billingScopeId, ResourceIdentifier billingProfileId, string customerId, ResourceIdentifier billingAccountId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, string userFriendlyAppliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, BillingBenefitsCommitment commitment, DateTimeOffset? effectOn, DateTimeOffset? expireOn, DateTimeOffset? purchaseOn, DateTimeOffset? benefitStartOn, BillingBenefitsExtendedStatusInfo extendedStatusInfo, bool? isRenewed, BillingBenefitsSavingsPlanUtilization utilization, string renewSource, string renewDestination, RenewProperties renewProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; DisplayName = displayName; @@ -83,6 +88,12 @@ internal BillingBenefitsSavingsPlanData(ResourceIdentifier id, string name, Reso RenewSource = renewSource; RenewDestination = renewDestination; RenewProperties = renewProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingBenefitsSavingsPlanData() + { } /// Savings plan SKU. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasData.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasData.cs index b5229e1fd86b..f7c027162503 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasData.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.BillingBenefits /// public partial class BillingBenefitsSavingsPlanOrderAliasData : ResourceData { - /// Initializes a new instance of BillingBenefitsSavingsPlanOrderAliasData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Savings plan SKU. /// is null. public BillingBenefitsSavingsPlanOrderAliasData(BillingBenefitsSku sku) @@ -28,7 +32,7 @@ public BillingBenefitsSavingsPlanOrderAliasData(BillingBenefitsSku sku) Sku = sku; } - /// Initializes a new instance of BillingBenefitsSavingsPlanOrderAliasData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +48,8 @@ public BillingBenefitsSavingsPlanOrderAliasData(BillingBenefitsSku sku) /// Type of the Applied Scope. /// Properties specific to applied scope type. Not required if not applicable. /// Commitment towards the benefit. - internal BillingBenefitsSavingsPlanOrderAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, string kind, string displayName, ResourceIdentifier savingsPlanOrderId, BillingBenefitsProvisioningState? provisioningState, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, BillingBenefitsCommitment commitment) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanOrderAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, string kind, string displayName, ResourceIdentifier savingsPlanOrderId, BillingBenefitsProvisioningState? provisioningState, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, BillingBenefitsCommitment commitment, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; Kind = kind; @@ -57,6 +62,12 @@ internal BillingBenefitsSavingsPlanOrderAliasData(ResourceIdentifier id, string AppliedScopeType = appliedScopeType; AppliedScopeProperties = appliedScopeProperties; Commitment = commitment; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingBenefitsSavingsPlanOrderAliasData() + { } /// Savings plan SKU. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs index c433a2a05ef8..52ee0f61e7ea 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderCollection.cs @@ -149,7 +149,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingBenefitsSavingsPlanOrderSavingsPlanOrderRestClient.CreateListRequest(); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingBenefitsSavingsPlanOrderSavingsPlanOrderRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanOrderResource(Client, BillingBenefitsSavingsPlanOrderData.DeserializeBillingBenefitsSavingsPlanOrderData(e)), _billingBenefitsSavingsPlanOrderSavingsPlanOrderClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanOrderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingBenefitsSavingsPlanOrderResource(Client, BillingBenefitsSavingsPlanOrderData.DeserializeBillingBenefitsSavingsPlanOrderData(e)), _billingBenefitsSavingsPlanOrderSavingsPlanOrderClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanOrderCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -171,7 +171,7 @@ public virtual Pageable GetAll(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _billingBenefitsSavingsPlanOrderSavingsPlanOrderRestClient.CreateListRequest(); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingBenefitsSavingsPlanOrderSavingsPlanOrderRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanOrderResource(Client, BillingBenefitsSavingsPlanOrderData.DeserializeBillingBenefitsSavingsPlanOrderData(e)), _billingBenefitsSavingsPlanOrderSavingsPlanOrderClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanOrderCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingBenefitsSavingsPlanOrderResource(Client, BillingBenefitsSavingsPlanOrderData.DeserializeBillingBenefitsSavingsPlanOrderData(e)), _billingBenefitsSavingsPlanOrderSavingsPlanOrderClientDiagnostics, Pipeline, "BillingBenefitsSavingsPlanOrderCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderData.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderData.cs index b02bbbf97803..e30d5b5dd276 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderData.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.BillingBenefits /// public partial class BillingBenefitsSavingsPlanOrderData : ResourceData { - /// Initializes a new instance of BillingBenefitsSavingsPlanOrderData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Savings plan SKU. /// is null. public BillingBenefitsSavingsPlanOrderData(BillingBenefitsSku sku) @@ -30,7 +33,7 @@ public BillingBenefitsSavingsPlanOrderData(BillingBenefitsSku sku) SavingsPlans = new ChangeTrackingList(); } - /// Initializes a new instance of BillingBenefitsSavingsPlanOrderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public BillingBenefitsSavingsPlanOrderData(BillingBenefitsSku sku) /// Information describing the type of billing plan for this savings plan. /// /// - internal BillingBenefitsSavingsPlanOrderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, string displayName, BillingBenefitsProvisioningState? provisioningState, ResourceIdentifier billingScopeId, ResourceIdentifier billingProfileId, string customerId, ResourceIdentifier billingAccountId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, DateTimeOffset? expireOn, DateTimeOffset? benefitStartOn, BillingPlanInformation planInformation, IList savingsPlans, BillingBenefitsExtendedStatusInfo extendedStatusInfo) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanOrderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, string displayName, BillingBenefitsProvisioningState? provisioningState, ResourceIdentifier billingScopeId, ResourceIdentifier billingProfileId, string customerId, ResourceIdentifier billingAccountId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, DateTimeOffset? expireOn, DateTimeOffset? benefitStartOn, BillingPlanInformation planInformation, IList savingsPlans, BillingBenefitsExtendedStatusInfo extendedStatusInfo, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; DisplayName = displayName; @@ -65,6 +69,12 @@ internal BillingBenefitsSavingsPlanOrderData(ResourceIdentifier id, string name, PlanInformation = planInformation; SavingsPlans = savingsPlans; ExtendedStatusInfo = extendedStatusInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingBenefitsSavingsPlanOrderData() + { } /// Savings plan SKU. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs index 1508ec66d244..830f3e4b7fac 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs @@ -87,7 +87,7 @@ public virtual AsyncPageable GetBillingBenef { HttpMessage FirstPageRequest(int? pageSizeHint) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllRequest(options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); } /// @@ -110,7 +110,7 @@ public virtual Pageable GetBillingBenefitsSa { HttpMessage FirstPageRequest(int? pageSizeHint) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllRequest(options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.Serialization.cs index bbec5c554694..a5ff633d20e5 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsAppliedScopeProperties : IUtf8JsonSerializable + public partial class BillingBenefitsAppliedScopeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TenantId)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsAppliedScopeProperties DeserializeBillingBenefitsAppliedScopeProperties(JsonElement element) + internal static BillingBenefitsAppliedScopeProperties DeserializeBillingBenefitsAppliedScopeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static BillingBenefitsAppliedScopeProperties DeserializeBillingBenefits Optional subscriptionId = default; Optional resourceGroupId = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId"u8)) @@ -98,8 +120,61 @@ internal static BillingBenefitsAppliedScopeProperties DeserializeBillingBenefits displayName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsAppliedScopeProperties(Optional.ToNullable(tenantId), managementGroupId.Value, subscriptionId.Value, resourceGroupId.Value, displayName.Value, serializedAdditionalRawData); + } + + BillingBenefitsAppliedScopeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsAppliedScopeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsAppliedScopeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsAppliedScopeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsAppliedScopeProperties model) + { + if (model is null) + { + return null; } - return new BillingBenefitsAppliedScopeProperties(Optional.ToNullable(tenantId), managementGroupId.Value, subscriptionId.Value, resourceGroupId.Value, displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsAppliedScopeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsAppliedScopeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.cs index 7b461c652afd..7150be2694ad 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsAppliedScopeProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BillingBenefits.Models @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// Properties specific to applied scope type. Not required if not applicable. public partial class BillingBenefitsAppliedScopeProperties { - /// Initializes a new instance of BillingBenefitsAppliedScopeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingBenefitsAppliedScopeProperties() { } - /// Initializes a new instance of BillingBenefitsAppliedScopeProperties. + /// Initializes a new instance of . /// Tenant ID where the benefit is applied. /// Fully-qualified identifier of the management group where the benefit must be applied. /// Fully-qualified identifier of the subscription. /// Fully-qualified identifier of the resource group. /// Display name. - internal BillingBenefitsAppliedScopeProperties(Guid? tenantId, ResourceIdentifier managementGroupId, ResourceIdentifier subscriptionId, ResourceIdentifier resourceGroupId, string displayName) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsAppliedScopeProperties(Guid? tenantId, ResourceIdentifier managementGroupId, ResourceIdentifier subscriptionId, ResourceIdentifier resourceGroupId, string displayName, Dictionary serializedAdditionalRawData) { TenantId = tenantId; ManagementGroupId = managementGroupId; SubscriptionId = subscriptionId; ResourceGroupId = resourceGroupId; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Tenant ID where the benefit is applied. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.Serialization.cs index 89c4f190736d..5ec8fe0b199a 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsCommitment : IUtf8JsonSerializable + public partial class BillingBenefitsCommitment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Grain)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("amount"u8); writer.WriteNumberValue(Amount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsCommitment DeserializeBillingBenefitsCommitment(JsonElement element) + internal static BillingBenefitsCommitment DeserializeBillingBenefitsCommitment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static BillingBenefitsCommitment DeserializeBillingBenefitsCommitment(J Optional grain = default; Optional currencyCode = default; Optional amount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("grain"u8)) @@ -67,8 +90,61 @@ internal static BillingBenefitsCommitment DeserializeBillingBenefitsCommitment(J amount = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsCommitment(currencyCode.Value, Optional.ToNullable(amount), Optional.ToNullable(grain), serializedAdditionalRawData); + } + + BillingBenefitsCommitment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsCommitment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsCommitment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsCommitment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsCommitment model) + { + if (model is null) + { + return null; } - return new BillingBenefitsCommitment(currencyCode.Value, Optional.ToNullable(amount), Optional.ToNullable(grain)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsCommitment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsCommitment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.cs index 175a7ed7d577..f7ef00a8b6cb 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsCommitment.cs @@ -5,21 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Commitment towards the benefit. public partial class BillingBenefitsCommitment : BillingBenefitsPrice { - /// Initializes a new instance of BillingBenefitsCommitment. + /// Initializes a new instance of . public BillingBenefitsCommitment() { } - /// Initializes a new instance of BillingBenefitsCommitment. + /// Initializes a new instance of . /// The ISO 4217 3-letter currency code for the currency used by this purchase record. /// /// Commitment grain. - internal BillingBenefitsCommitment(string currencyCode, double? amount, BillingBenefitsCommitmentGrain? grain) : base(currencyCode, amount) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsCommitment(string currencyCode, double? amount, BillingBenefitsCommitmentGrain? grain, Dictionary serializedAdditionalRawData) : base(currencyCode, amount, serializedAdditionalRawData) { Grain = grain; } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.Serialization.cs index 85915c444a0a..5624a69206cf 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsExtendedStatusInfo + public partial class BillingBenefitsExtendedStatusInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingBenefitsExtendedStatusInfo DeserializeBillingBenefitsExtendedStatusInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(StatusCode)) + { + writer.WritePropertyName("statusCode"u8); + writer.WriteStringValue(StatusCode); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingBenefitsExtendedStatusInfo DeserializeBillingBenefitsExtendedStatusInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional statusCode = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("statusCode"u8)) @@ -32,8 +71,61 @@ internal static BillingBenefitsExtendedStatusInfo DeserializeBillingBenefitsExte message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingBenefitsExtendedStatusInfo(statusCode.Value, message.Value); + return new BillingBenefitsExtendedStatusInfo(statusCode.Value, message.Value, serializedAdditionalRawData); + } + + BillingBenefitsExtendedStatusInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsExtendedStatusInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsExtendedStatusInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsExtendedStatusInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsExtendedStatusInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsExtendedStatusInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsExtendedStatusInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.cs index c8ee9d6b819c..92fac8168cf2 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsExtendedStatusInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// The BillingBenefitsExtendedStatusInfo. public partial class BillingBenefitsExtendedStatusInfo { - /// Initializes a new instance of BillingBenefitsExtendedStatusInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingBenefitsExtendedStatusInfo() { } - /// Initializes a new instance of BillingBenefitsExtendedStatusInfo. + /// Initializes a new instance of . /// Status code providing additional information. /// The message giving detailed information about the status code. - internal BillingBenefitsExtendedStatusInfo(string statusCode, string message) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsExtendedStatusInfo(string statusCode, string message, Dictionary serializedAdditionalRawData) { StatusCode = statusCode; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status code providing additional information. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.Serialization.cs index 4f47200a52b8..48636e80137f 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsPrice : IUtf8JsonSerializable + public partial class BillingBenefitsPrice : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CurrencyCode)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("amount"u8); writer.WriteNumberValue(Amount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsPrice DeserializeBillingBenefitsPrice(JsonElement element) + internal static BillingBenefitsPrice DeserializeBillingBenefitsPrice(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional currencyCode = default; Optional amount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("currencyCode"u8)) @@ -52,8 +75,61 @@ internal static BillingBenefitsPrice DeserializeBillingBenefitsPrice(JsonElement amount = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsPrice(currencyCode.Value, Optional.ToNullable(amount), serializedAdditionalRawData); + } + + BillingBenefitsPrice IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsPrice(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsPrice IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsPrice(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsPrice model) + { + if (model is null) + { + return null; } - return new BillingBenefitsPrice(currencyCode.Value, Optional.ToNullable(amount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsPrice(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsPrice(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.cs index 0264615384be..4be3a0569c82 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPrice.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// The BillingBenefitsPrice. public partial class BillingBenefitsPrice { - /// Initializes a new instance of BillingBenefitsPrice. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingBenefitsPrice() { } - /// Initializes a new instance of BillingBenefitsPrice. + /// Initializes a new instance of . /// The ISO 4217 3-letter currency code for the currency used by this purchase record. /// - internal BillingBenefitsPrice(string currencyCode, double? amount) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsPrice(string currencyCode, double? amount, Dictionary serializedAdditionalRawData) { CurrencyCode = currencyCode; Amount = amount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ISO 4217 3-letter currency code for the currency used by this purchase record. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.Serialization.cs index 7a4cfe7d3575..99d2c752257a 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.Serialization.cs @@ -6,20 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsPurchaseContent : IUtf8JsonSerializable + public partial class BillingBenefitsPurchaseContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Commitment)) { writer.WritePropertyName("commitment"u8); - writer.WriteObjectValue(Commitment); + if (Commitment is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Commitment).Serialize(writer, options); + } } if (Optional.IsDefined(IsRenewed)) { @@ -61,14 +82,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppliedScopeProperties)) { writer.WritePropertyName("appliedScopeProperties"u8); - writer.WriteObjectValue(AppliedScopeProperties); + if (AppliedScopeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppliedScopeProperties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsPurchaseContent DeserializeBillingBenefitsPurchaseContent(JsonElement element) + internal static BillingBenefitsPurchaseContent DeserializeBillingBenefitsPurchaseContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,6 +125,7 @@ internal static BillingBenefitsPurchaseContent DeserializeBillingBenefitsPurchas Optional effectiveDateTime = default; Optional renew = default; Optional appliedScopeProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -183,8 +226,61 @@ internal static BillingBenefitsPurchaseContent DeserializeBillingBenefitsPurchas } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsPurchaseContent(sku.Value, displayName.Value, billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), commitment.Value, Optional.ToNullable(effectiveDateTime), Optional.ToNullable(renew), appliedScopeProperties.Value, serializedAdditionalRawData); + } + + BillingBenefitsPurchaseContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsPurchaseContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsPurchaseContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsPurchaseContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsPurchaseContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsPurchaseContent(Response response) + { + if (response is null) + { + return null; } - return new BillingBenefitsPurchaseContent(sku.Value, displayName.Value, billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), commitment.Value, Optional.ToNullable(effectiveDateTime), Optional.ToNullable(renew), appliedScopeProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsPurchaseContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.cs index b6f24b1b15a4..50de4104fdf4 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsPurchaseContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BillingBenefits.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The BillingBenefitsPurchaseContent. public partial class BillingBenefitsPurchaseContent { - /// Initializes a new instance of BillingBenefitsPurchaseContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingBenefitsPurchaseContent() { } - /// Initializes a new instance of BillingBenefitsPurchaseContent. + /// Initializes a new instance of . /// The SKU to be applied for this resource. /// Friendly name of the savings plan. /// Subscription that will be charged for purchasing the benefit. @@ -29,7 +33,8 @@ public BillingBenefitsPurchaseContent() /// DateTime of the savings plan starts providing benefit from. /// Setting this to true will automatically purchase a new benefit on the expiration date time. /// Properties specific to applied scope type. Not required if not applicable. - internal BillingBenefitsPurchaseContent(BillingBenefitsSku sku, string displayName, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsCommitment commitment, DateTimeOffset? effectOn, bool? isRenewed, BillingBenefitsAppliedScopeProperties appliedScopeProperties) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsPurchaseContent(BillingBenefitsSku sku, string displayName, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsCommitment commitment, DateTimeOffset? effectOn, bool? isRenewed, BillingBenefitsAppliedScopeProperties appliedScopeProperties, Dictionary serializedAdditionalRawData) { Sku = sku; DisplayName = displayName; @@ -41,6 +46,7 @@ internal BillingBenefitsPurchaseContent(BillingBenefitsSku sku, string displayNa EffectOn = effectOn; IsRenewed = isRenewed; AppliedScopeProperties = appliedScopeProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The SKU to be applied for this resource. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.Serialization.cs index 7fcab4e80b8e..a6af91db6dd7 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.Serialization.cs @@ -6,19 +6,33 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsReservationOrderAliasCreateOrUpdateContent : IUtf8JsonSerializable + public partial class BillingBenefitsReservationOrderAliasCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); @@ -54,7 +68,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppliedScopeProperties)) { writer.WritePropertyName("appliedScopeProperties"u8); - writer.WriteObjectValue(AppliedScopeProperties); + if (AppliedScopeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppliedScopeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Quantity)) { @@ -79,14 +100,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ReservedResourceProperties)) { writer.WritePropertyName("reservedResourceProperties"u8); - writer.WriteObjectValue(ReservedResourceProperties); + if (ReservedResourceProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReservedResourceProperties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsReservationOrderAliasCreateOrUpdateContent DeserializeBillingBenefitsReservationOrderAliasCreateOrUpdateContent(JsonElement element) + internal static BillingBenefitsReservationOrderAliasCreateOrUpdateContent DeserializeBillingBenefitsReservationOrderAliasCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -108,6 +150,7 @@ internal static BillingBenefitsReservationOrderAliasCreateOrUpdateContent Deseri Optional reservedResourceType = default; Optional reviewDateTime = default; Optional reservedResourceProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -255,8 +298,61 @@ internal static BillingBenefitsReservationOrderAliasCreateOrUpdateContent Deseri } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsReservationOrderAliasCreateOrUpdateContent(id, name, type, systemData.Value, sku, Optional.ToNullable(location), displayName.Value, billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, Optional.ToNullable(quantity), Optional.ToNullable(renew), Optional.ToNullable(reservedResourceType), Optional.ToNullable(reviewDateTime), reservedResourceProperties.Value, serializedAdditionalRawData); + } + + BillingBenefitsReservationOrderAliasCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsReservationOrderAliasCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsReservationOrderAliasCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsReservationOrderAliasCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsReservationOrderAliasCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsReservationOrderAliasCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; } - return new BillingBenefitsReservationOrderAliasCreateOrUpdateContent(id, name, type, systemData.Value, sku, Optional.ToNullable(location), displayName.Value, billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, Optional.ToNullable(quantity), Optional.ToNullable(renew), Optional.ToNullable(reservedResourceType), Optional.ToNullable(reviewDateTime), reservedResourceProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsReservationOrderAliasCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.cs index d3f3dcda254c..c2f8d28bd2c2 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// Reservation order alias. public partial class BillingBenefitsReservationOrderAliasCreateOrUpdateContent : ResourceData { - /// Initializes a new instance of BillingBenefitsReservationOrderAliasCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Reservation order SKU. /// is null. public BillingBenefitsReservationOrderAliasCreateOrUpdateContent(BillingBenefitsSku sku) @@ -24,7 +28,7 @@ public BillingBenefitsReservationOrderAliasCreateOrUpdateContent(BillingBenefits Sku = sku; } - /// Initializes a new instance of BillingBenefitsReservationOrderAliasCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +46,8 @@ public BillingBenefitsReservationOrderAliasCreateOrUpdateContent(BillingBenefits /// The type of the resource that is being reserved. /// This is the date-time when the Azure Hybrid Benefit needs to be reviewed. /// Properties specific to each reserved resource type. Not required if not applicable. - internal BillingBenefitsReservationOrderAliasCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, AzureLocation? location, string displayName, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, int? quantity, bool? isRenewed, BillingBenefitsReservedResourceType? reservedResourceType, DateTimeOffset? reviewOn, ReservationOrderAliasRequestPropertiesReservedResourceProperties reservedResourceProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsReservationOrderAliasCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingBenefitsSku sku, AzureLocation? location, string displayName, ResourceIdentifier billingScopeId, BillingBenefitsTerm? term, BillingBenefitsBillingPlan? billingPlan, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, int? quantity, bool? isRenewed, BillingBenefitsReservedResourceType? reservedResourceType, DateTimeOffset? reviewOn, ReservationOrderAliasRequestPropertiesReservedResourceProperties reservedResourceProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; Location = location; @@ -57,6 +62,12 @@ internal BillingBenefitsReservationOrderAliasCreateOrUpdateContent(ResourceIdent ReservedResourceType = reservedResourceType; ReviewOn = reviewOn; ReservedResourceProperties = reservedResourceProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingBenefitsReservationOrderAliasCreateOrUpdateContent() + { } /// Reservation order SKU. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasData.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasData.Serialization.cs index a04ccdbd56fe..81e9329b077d 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasData.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsReservationOrderAliasData.Serialization.cs @@ -6,20 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BillingBenefits { - public partial class BillingBenefitsReservationOrderAliasData : IUtf8JsonSerializable + public partial class BillingBenefitsReservationOrderAliasData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); @@ -55,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppliedScopeProperties)) { writer.WritePropertyName("appliedScopeProperties"u8); - writer.WriteObjectValue(AppliedScopeProperties); + if (AppliedScopeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppliedScopeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Quantity)) { @@ -80,14 +101,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ReservedResourceProperties)) { writer.WritePropertyName("reservedResourceProperties"u8); - writer.WriteObjectValue(ReservedResourceProperties); + if (ReservedResourceProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReservedResourceProperties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsReservationOrderAliasData DeserializeBillingBenefitsReservationOrderAliasData(JsonElement element) + internal static BillingBenefitsReservationOrderAliasData DeserializeBillingBenefitsReservationOrderAliasData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -111,6 +153,7 @@ internal static BillingBenefitsReservationOrderAliasData DeserializeBillingBenef Optional reservedResourceType = default; Optional reviewDateTime = default; Optional reservedResourceProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -276,8 +319,61 @@ internal static BillingBenefitsReservationOrderAliasData DeserializeBillingBenef } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsReservationOrderAliasData(id, name, type, systemData.Value, sku, Optional.ToNullable(location), displayName.Value, reservationOrderId.Value, Optional.ToNullable(provisioningState), billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, Optional.ToNullable(quantity), Optional.ToNullable(renew), Optional.ToNullable(reservedResourceType), Optional.ToNullable(reviewDateTime), reservedResourceProperties.Value, serializedAdditionalRawData); + } + + BillingBenefitsReservationOrderAliasData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsReservationOrderAliasData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsReservationOrderAliasData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsReservationOrderAliasData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsReservationOrderAliasData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsReservationOrderAliasData(Response response) + { + if (response is null) + { + return null; } - return new BillingBenefitsReservationOrderAliasData(id, name, type, systemData.Value, sku, Optional.ToNullable(location), displayName.Value, reservationOrderId.Value, Optional.ToNullable(provisioningState), billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, Optional.ToNullable(quantity), Optional.ToNullable(renew), Optional.ToNullable(reservedResourceType), Optional.ToNullable(reviewDateTime), reservedResourceProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsReservationOrderAliasData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.Serialization.cs index 68e542c3fec4..3649d81da34e 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.Serialization.cs @@ -5,15 +5,71 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsRoleAssignmentEntity + public partial class BillingBenefitsRoleAssignmentEntity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingBenefitsRoleAssignmentEntity DeserializeBillingBenefitsRoleAssignmentEntity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId); + } + if (Optional.IsDefined(RoleDefinitionId)) + { + writer.WritePropertyName("roleDefinitionId"u8); + writer.WriteStringValue(RoleDefinitionId); + } + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingBenefitsRoleAssignmentEntity DeserializeBillingBenefitsRoleAssignmentEntity(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +79,7 @@ internal static BillingBenefitsRoleAssignmentEntity DeserializeBillingBenefitsRo Optional principalId = default; Optional roleDefinitionId = default; Optional scope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -74,8 +131,61 @@ internal static BillingBenefitsRoleAssignmentEntity DeserializeBillingBenefitsRo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingBenefitsRoleAssignmentEntity(id.Value, name.Value, principalId.Value, roleDefinitionId.Value, scope.Value); + return new BillingBenefitsRoleAssignmentEntity(id.Value, name.Value, principalId.Value, roleDefinitionId.Value, scope.Value, serializedAdditionalRawData); + } + + BillingBenefitsRoleAssignmentEntity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsRoleAssignmentEntity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsRoleAssignmentEntity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsRoleAssignmentEntity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsRoleAssignmentEntity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsRoleAssignmentEntity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsRoleAssignmentEntity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.cs index 60ebfee93fe7..248a546d01c6 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsRoleAssignmentEntity.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BillingBenefits.Models @@ -12,24 +14,29 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// Role assignment entity. public partial class BillingBenefitsRoleAssignmentEntity { - /// Initializes a new instance of BillingBenefitsRoleAssignmentEntity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingBenefitsRoleAssignmentEntity() { } - /// Initializes a new instance of BillingBenefitsRoleAssignmentEntity. + /// Initializes a new instance of . /// Role assignment entity id. /// Role assignment entity name. /// Principal Id. /// Role definition id. /// Scope of the role assignment entity. - internal BillingBenefitsRoleAssignmentEntity(ResourceIdentifier id, string name, string principalId, ResourceIdentifier roleDefinitionId, ResourceIdentifier scope) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsRoleAssignmentEntity(ResourceIdentifier id, string name, string principalId, ResourceIdentifier roleDefinitionId, ResourceIdentifier scope, Dictionary serializedAdditionalRawData) { Id = id; Name = name; PrincipalId = principalId; RoleDefinitionId = roleDefinitionId; Scope = scope; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role assignment entity id. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanData.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanData.Serialization.cs index f40a6b78209e..11e5ff44b59d 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanData.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanData.Serialization.cs @@ -6,20 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BillingBenefits { - public partial class BillingBenefitsSavingsPlanData : IUtf8JsonSerializable + public partial class BillingBenefitsSavingsPlanData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DisplayName)) @@ -50,12 +64,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppliedScopeProperties)) { writer.WritePropertyName("appliedScopeProperties"u8); - writer.WriteObjectValue(AppliedScopeProperties); + if (AppliedScopeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppliedScopeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Commitment)) { writer.WritePropertyName("commitment"u8); - writer.WriteObjectValue(Commitment); + if (Commitment is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Commitment).Serialize(writer, options); + } } if (Optional.IsDefined(BenefitStartOn)) { @@ -80,14 +108,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RenewProperties)) { writer.WritePropertyName("renewProperties"u8); - writer.WriteObjectValue(RenewProperties); + if (RenewProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RenewProperties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsSavingsPlanData DeserializeBillingBenefitsSavingsPlanData(JsonElement element) + internal static BillingBenefitsSavingsPlanData DeserializeBillingBenefitsSavingsPlanData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -120,6 +169,7 @@ internal static BillingBenefitsSavingsPlanData DeserializeBillingBenefitsSavings Optional renewSource = default; Optional renewDestination = default; Optional renewProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -346,8 +396,61 @@ internal static BillingBenefitsSavingsPlanData DeserializeBillingBenefitsSavings } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingBenefitsSavingsPlanData(id, name, type, systemData.Value, sku, displayName.Value, Optional.ToNullable(provisioningState), displayProvisioningState.Value, billingScopeId.Value, billingProfileId.Value, customerId.Value, billingAccountId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), userFriendlyAppliedScopeType.Value, appliedScopeProperties.Value, commitment.Value, Optional.ToNullable(effectiveDateTime), Optional.ToNullable(expiryDateTime), Optional.ToNullable(purchaseDateTime), Optional.ToNullable(benefitStartTime), extendedStatusInfo.Value, Optional.ToNullable(renew), utilization.Value, renewSource.Value, renewDestination.Value, renewProperties.Value); + return new BillingBenefitsSavingsPlanData(id, name, type, systemData.Value, sku, displayName.Value, Optional.ToNullable(provisioningState), displayProvisioningState.Value, billingScopeId.Value, billingProfileId.Value, customerId.Value, billingAccountId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), userFriendlyAppliedScopeType.Value, appliedScopeProperties.Value, commitment.Value, Optional.ToNullable(effectiveDateTime), Optional.ToNullable(expiryDateTime), Optional.ToNullable(purchaseDateTime), Optional.ToNullable(benefitStartTime), extendedStatusInfo.Value, Optional.ToNullable(renew), utilization.Value, renewSource.Value, renewDestination.Value, renewProperties.Value, serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderAliasData.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderAliasData.Serialization.cs index baa4daac1535..a2b3df7f6b66 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderAliasData.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderAliasData.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BillingBenefits { - public partial class BillingBenefitsSavingsPlanOrderAliasData : IUtf8JsonSerializable + public partial class BillingBenefitsSavingsPlanOrderAliasData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Kind)) { writer.WritePropertyName("kind"u8); @@ -54,19 +69,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppliedScopeProperties)) { writer.WritePropertyName("appliedScopeProperties"u8); - writer.WriteObjectValue(AppliedScopeProperties); + if (AppliedScopeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppliedScopeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Commitment)) { writer.WritePropertyName("commitment"u8); - writer.WriteObjectValue(Commitment); + if (Commitment is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Commitment).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsSavingsPlanOrderAliasData DeserializeBillingBenefitsSavingsPlanOrderAliasData(JsonElement element) + internal static BillingBenefitsSavingsPlanOrderAliasData DeserializeBillingBenefitsSavingsPlanOrderAliasData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -86,6 +129,7 @@ internal static BillingBenefitsSavingsPlanOrderAliasData DeserializeBillingBenef Optional appliedScopeType = default; Optional appliedScopeProperties = default; Optional commitment = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -211,8 +255,61 @@ internal static BillingBenefitsSavingsPlanOrderAliasData DeserializeBillingBenef } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsSavingsPlanOrderAliasData(id, name, type, systemData.Value, sku, kind.Value, displayName.Value, savingsPlanOrderId.Value, Optional.ToNullable(provisioningState), billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, commitment.Value, serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanOrderAliasData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanOrderAliasData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanOrderAliasData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanOrderAliasData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanOrderAliasData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanOrderAliasData(Response response) + { + if (response is null) + { + return null; } - return new BillingBenefitsSavingsPlanOrderAliasData(id, name, type, systemData.Value, sku, kind.Value, displayName.Value, savingsPlanOrderId.Value, Optional.ToNullable(provisioningState), billingScopeId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, commitment.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanOrderAliasData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderData.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderData.Serialization.cs index cf6a9412db34..a3cd86002015 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderData.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanOrderData.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BillingBenefits { - public partial class BillingBenefitsSavingsPlanOrderData : IUtf8JsonSerializable + public partial class BillingBenefitsSavingsPlanOrderData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DisplayName)) @@ -51,7 +64,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PlanInformation)) { writer.WritePropertyName("planInformation"u8); - writer.WriteObjectValue(PlanInformation); + if (PlanInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlanInformation).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(SavingsPlans)) { @@ -64,11 +84,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsSavingsPlanOrderData DeserializeBillingBenefitsSavingsPlanOrderData(JsonElement element) + internal static BillingBenefitsSavingsPlanOrderData DeserializeBillingBenefitsSavingsPlanOrderData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +125,7 @@ internal static BillingBenefitsSavingsPlanOrderData DeserializeBillingBenefitsSa Optional planInformation = default; Optional> savingsPlans = default; Optional extendedStatusInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -248,8 +283,61 @@ internal static BillingBenefitsSavingsPlanOrderData DeserializeBillingBenefitsSa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsSavingsPlanOrderData(id, name, type, systemData.Value, sku, displayName.Value, Optional.ToNullable(provisioningState), billingScopeId.Value, billingProfileId.Value, customerId.Value, billingAccountId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(expiryDateTime), Optional.ToNullable(benefitStartTime), planInformation.Value, Optional.ToList(savingsPlans), extendedStatusInfo.Value, serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanOrderData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanOrderData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanOrderData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanOrderData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanOrderData model) + { + if (model is null) + { + return null; } - return new BillingBenefitsSavingsPlanOrderData(id, name, type, systemData.Value, sku, displayName.Value, Optional.ToNullable(provisioningState), billingScopeId.Value, billingProfileId.Value, customerId.Value, billingAccountId.Value, Optional.ToNullable(term), Optional.ToNullable(billingPlan), Optional.ToNullable(expiryDateTime), Optional.ToNullable(benefitStartTime), planInformation.Value, Optional.ToList(savingsPlans), extendedStatusInfo.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanOrderData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanOrderData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.Serialization.cs index b9a11487ec55..6704bfce4db1 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsSavingsPlanPatch : IUtf8JsonSerializable + public partial class BillingBenefitsSavingsPlanPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static BillingBenefitsSavingsPlanPatch DeserializeBillingBenefitsSavingsPlanPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BillingBenefitsSavingsPlanPatchProperties.DeserializeBillingBenefitsSavingsPlanPatchProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsSavingsPlanPatch(properties.Value, serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.cs index c613e755367c..8456c48d81a6 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatch.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Savings plan patch request. public partial class BillingBenefitsSavingsPlanPatch { - /// Initializes a new instance of BillingBenefitsSavingsPlanPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingBenefitsSavingsPlanPatch() { } + /// Initializes a new instance of . + /// Savings plan patch request. + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanPatch(BillingBenefitsSavingsPlanPatchProperties properties, Dictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Savings plan patch request. public BillingBenefitsSavingsPlanPatchProperties Properties { get; set; } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.Serialization.cs index dd100c3ef8f9..a84679d96e9a 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsSavingsPlanPatchProperties : IUtf8JsonSerializable + public partial class BillingBenefitsSavingsPlanPatchProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DisplayName)) { @@ -28,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AppliedScopeProperties)) { writer.WritePropertyName("appliedScopeProperties"u8); - writer.WriteObjectValue(AppliedScopeProperties); + if (AppliedScopeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppliedScopeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(IsRenewed)) { @@ -38,9 +53,142 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RenewProperties)) { writer.WritePropertyName("renewProperties"u8); - writer.WriteObjectValue(RenewProperties); + if (RenewProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RenewProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static BillingBenefitsSavingsPlanPatchProperties DeserializeBillingBenefitsSavingsPlanPatchProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional appliedScopeType = default; + Optional appliedScopeProperties = default; + Optional renew = default; + Optional renewProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("appliedScopeType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appliedScopeType = new BillingBenefitsAppliedScopeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("appliedScopeProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appliedScopeProperties = BillingBenefitsAppliedScopeProperties.DeserializeBillingBenefitsAppliedScopeProperties(property.Value); + continue; + } + if (property.NameEquals("renew"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + renew = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("renewProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + renewProperties = RenewProperties.DeserializeRenewProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsSavingsPlanPatchProperties(displayName.Value, Optional.ToNullable(appliedScopeType), appliedScopeProperties.Value, Optional.ToNullable(renew), renewProperties.Value, serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanPatchProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanPatchProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanPatchProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanPatchProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanPatchProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanPatchProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanPatchProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.cs index aec8e0aeb979..584b06f92509 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanPatchProperties.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Savings plan patch request. public partial class BillingBenefitsSavingsPlanPatchProperties { - /// Initializes a new instance of BillingBenefitsSavingsPlanPatchProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingBenefitsSavingsPlanPatchProperties() { } + /// Initializes a new instance of . + /// Display name. + /// Type of the Applied Scope. + /// Properties specific to applied scope type. Not required if not applicable. + /// Setting this to true will automatically purchase a new benefit on the expiration date time. + /// + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanPatchProperties(string displayName, BillingBenefitsAppliedScopeType? appliedScopeType, BillingBenefitsAppliedScopeProperties appliedScopeProperties, bool? isRenewed, RenewProperties renewProperties, Dictionary serializedAdditionalRawData) + { + DisplayName = displayName; + AppliedScopeType = appliedScopeType; + AppliedScopeProperties = appliedScopeProperties; + IsRenewed = isRenewed; + RenewProperties = renewProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Display name. public string DisplayName { get; set; } /// Type of the Applied Scope. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.Serialization.cs index 0e748b1fcdc2..6001bdb8790b 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsSavingsPlanUtilization + public partial class BillingBenefitsSavingsPlanUtilization : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingBenefitsSavingsPlanUtilization DeserializeBillingBenefitsSavingsPlanUtilization(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Aggregates)) + { + writer.WritePropertyName("aggregates"u8); + writer.WriteStartArray(); + foreach (var item in Aggregates) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingBenefitsSavingsPlanUtilization DeserializeBillingBenefitsSavingsPlanUtilization(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional trend = default; Optional> aggregates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("trend"u8)) @@ -42,8 +87,61 @@ internal static BillingBenefitsSavingsPlanUtilization DeserializeBillingBenefits aggregates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingBenefitsSavingsPlanUtilization(trend.Value, Optional.ToList(aggregates)); + return new BillingBenefitsSavingsPlanUtilization(trend.Value, Optional.ToList(aggregates), serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanUtilization IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanUtilization(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanUtilization IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanUtilization(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanUtilization model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanUtilization(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanUtilization(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.cs index 3d854ec0f8ad..f7c4d24ddf3c 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilization.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// Savings plan utilization. public partial class BillingBenefitsSavingsPlanUtilization { - /// Initializes a new instance of BillingBenefitsSavingsPlanUtilization. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingBenefitsSavingsPlanUtilization() { Aggregates = new ChangeTrackingList(); } - /// Initializes a new instance of BillingBenefitsSavingsPlanUtilization. + /// Initializes a new instance of . /// The number of days trend for a savings plan. /// The array of aggregates of a savings plan's utilization. - internal BillingBenefitsSavingsPlanUtilization(string trend, IReadOnlyList aggregates) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanUtilization(string trend, IReadOnlyList aggregates, Dictionary serializedAdditionalRawData) { Trend = trend; Aggregates = aggregates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of days trend for a savings plan. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.Serialization.cs index e6c64e223a03..6657b1c55d38 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsSavingsPlanUtilizationAggregate + public partial class BillingBenefitsSavingsPlanUtilizationAggregate : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingBenefitsSavingsPlanUtilizationAggregate DeserializeBillingBenefitsSavingsPlanUtilizationAggregate(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingBenefitsSavingsPlanUtilizationAggregate DeserializeBillingBenefitsSavingsPlanUtilizationAggregate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static BillingBenefitsSavingsPlanUtilizationAggregate DeserializeBillin Optional grainUnit = default; Optional value = default; Optional valueUnit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("grain"u8)) @@ -52,8 +81,61 @@ internal static BillingBenefitsSavingsPlanUtilizationAggregate DeserializeBillin valueUnit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingBenefitsSavingsPlanUtilizationAggregate(Optional.ToNullable(grain), grainUnit.Value, Optional.ToNullable(value), valueUnit.Value); + return new BillingBenefitsSavingsPlanUtilizationAggregate(Optional.ToNullable(grain), grainUnit.Value, Optional.ToNullable(value), valueUnit.Value, serializedAdditionalRawData); + } + + BillingBenefitsSavingsPlanUtilizationAggregate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSavingsPlanUtilizationAggregate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSavingsPlanUtilizationAggregate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSavingsPlanUtilizationAggregate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSavingsPlanUtilizationAggregate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSavingsPlanUtilizationAggregate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSavingsPlanUtilizationAggregate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.cs index 96f76d73a0e9..3d1706db40b2 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSavingsPlanUtilizationAggregate.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// The aggregate values of savings plan utilization. public partial class BillingBenefitsSavingsPlanUtilizationAggregate { - /// Initializes a new instance of BillingBenefitsSavingsPlanUtilizationAggregate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BillingBenefitsSavingsPlanUtilizationAggregate() { } - /// Initializes a new instance of BillingBenefitsSavingsPlanUtilizationAggregate. + /// Initializes a new instance of . /// The grain of the aggregate. /// The grain unit of the aggregate. /// The aggregate value. /// The aggregate value unit. - internal BillingBenefitsSavingsPlanUtilizationAggregate(float? grain, string grainUnit, float? value, string valueUnit) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSavingsPlanUtilizationAggregate(float? grain, string grainUnit, float? value, string valueUnit, Dictionary serializedAdditionalRawData) { Grain = grain; GrainUnit = grainUnit; Value = value; ValueUnit = valueUnit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The grain of the aggregate. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.Serialization.cs index c7f0992325f6..682905b311ff 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingBenefitsSku : IUtf8JsonSerializable + public partial class BillingBenefitsSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingBenefitsSku DeserializeBillingBenefitsSku(JsonElement element) + internal static BillingBenefitsSku DeserializeBillingBenefitsSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static BillingBenefitsSku DeserializeBillingBenefitsSku(JsonElement ele name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingBenefitsSku(name.Value, serializedAdditionalRawData); + } + + BillingBenefitsSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingBenefitsSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingBenefitsSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingBenefitsSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingBenefitsSku model) + { + if (model is null) + { + return null; } - return new BillingBenefitsSku(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingBenefitsSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingBenefitsSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.cs index 48de4acaa961..d3ac800b7922 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingBenefitsSku.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// The SKU to be applied for this resource. public partial class BillingBenefitsSku { - /// Initializes a new instance of BillingBenefitsSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingBenefitsSku() { } - /// Initializes a new instance of BillingBenefitsSku. + /// Initializes a new instance of . /// Name of the SKU to be applied. - internal BillingBenefitsSku(string name) + /// Keeps track of any properties unknown to the library. + internal BillingBenefitsSku(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the SKU to be applied. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.Serialization.cs index 07f782d19def..fbf98d435df3 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class BillingPlanInformation : IUtf8JsonSerializable + public partial class BillingPlanInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PricingCurrencyTotal)) { writer.WritePropertyName("pricingCurrencyTotal"u8); - writer.WriteObjectValue(PricingCurrencyTotal); + if (PricingCurrencyTotal is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PricingCurrencyTotal).Serialize(writer, options); + } } if (Optional.IsDefined(StartOn)) { @@ -38,15 +51,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Transactions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingPlanInformation DeserializeBillingPlanInformation(JsonElement element) + internal static BillingPlanInformation DeserializeBillingPlanInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +89,7 @@ internal static BillingPlanInformation DeserializeBillingPlanInformation(JsonEle Optional startDate = default; Optional nextPaymentDueDate = default; Optional> transactions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("pricingCurrencyTotal"u8)) @@ -98,8 +133,61 @@ internal static BillingPlanInformation DeserializeBillingPlanInformation(JsonEle transactions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingPlanInformation(pricingCurrencyTotal.Value, Optional.ToNullable(startDate), Optional.ToNullable(nextPaymentDueDate), Optional.ToList(transactions), serializedAdditionalRawData); + } + + BillingPlanInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingPlanInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingPlanInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingPlanInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingPlanInformation model) + { + if (model is null) + { + return null; } - return new BillingPlanInformation(pricingCurrencyTotal.Value, Optional.ToNullable(startDate), Optional.ToNullable(nextPaymentDueDate), Optional.ToList(transactions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingPlanInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingPlanInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.cs index 9e8e5966dc54..397c26f8c5b2 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/BillingPlanInformation.cs @@ -14,23 +14,28 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// Information describing the type of billing plan for this savings plan. public partial class BillingPlanInformation { - /// Initializes a new instance of BillingPlanInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingPlanInformation() { Transactions = new ChangeTrackingList(); } - /// Initializes a new instance of BillingPlanInformation. + /// Initializes a new instance of . /// Amount of money to be paid for the Order. Tax is not included. /// Date when the billing plan has started. /// For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off. /// - internal BillingPlanInformation(BillingBenefitsPrice pricingCurrencyTotal, DateTimeOffset? startOn, DateTimeOffset? nextPaymentDueOn, IList transactions) + /// Keeps track of any properties unknown to the library. + internal BillingPlanInformation(BillingBenefitsPrice pricingCurrencyTotal, DateTimeOffset? startOn, DateTimeOffset? nextPaymentDueOn, IList transactions, Dictionary serializedAdditionalRawData) { PricingCurrencyTotal = pricingCurrencyTotal; StartOn = startOn; NextPaymentDueOn = nextPaymentDueOn; Transactions = transactions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Amount of money to be paid for the Order. Tax is not included. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.Serialization.cs index 097df0dac182..93639b98607e 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class RenewProperties : IUtf8JsonSerializable + internal partial class RenewProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PurchaseProperties)) { writer.WritePropertyName("purchaseProperties"u8); - writer.WriteObjectValue(PurchaseProperties); + if (PurchaseProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchaseProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RenewProperties DeserializeRenewProperties(JsonElement element) + internal static RenewProperties DeserializeRenewProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional purchaseProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("purchaseProperties"u8)) @@ -41,8 +71,61 @@ internal static RenewProperties DeserializeRenewProperties(JsonElement element) purchaseProperties = BillingBenefitsPurchaseContent.DeserializeBillingBenefitsPurchaseContent(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RenewProperties(purchaseProperties.Value, serializedAdditionalRawData); + } + + RenewProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRenewProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RenewProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRenewProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RenewProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RenewProperties(Response response) + { + if (response is null) + { + return null; } - return new RenewProperties(purchaseProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRenewProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.cs index bd3991780fa2..6d3454578e2f 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/RenewProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// The RenewProperties. internal partial class RenewProperties { - /// Initializes a new instance of RenewProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RenewProperties() { } - /// Initializes a new instance of RenewProperties. + /// Initializes a new instance of . /// - internal RenewProperties(BillingBenefitsPurchaseContent purchaseProperties) + /// Keeps track of any properties unknown to the library. + internal RenewProperties(BillingBenefitsPurchaseContent purchaseProperties, Dictionary serializedAdditionalRawData) { PurchaseProperties = purchaseProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the purchase properties. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.Serialization.cs index 0ab6fe0bd43e..099306fd459f 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class ReservationOrderAliasRequestPropertiesReservedResourceProperties : IUtf8JsonSerializable + internal partial class ReservationOrderAliasRequestPropertiesReservedResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InstanceFlexibility)) { writer.WritePropertyName("instanceFlexibility"u8); writer.WriteStringValue(InstanceFlexibility.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReservationOrderAliasRequestPropertiesReservedResourceProperties DeserializeReservationOrderAliasRequestPropertiesReservedResourceProperties(JsonElement element) + internal static ReservationOrderAliasRequestPropertiesReservedResourceProperties DeserializeReservationOrderAliasRequestPropertiesReservedResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional instanceFlexibility = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("instanceFlexibility"u8)) @@ -41,8 +64,61 @@ internal static ReservationOrderAliasRequestPropertiesReservedResourceProperties instanceFlexibility = new BillingBenefitsInstanceFlexibility(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReservationOrderAliasRequestPropertiesReservedResourceProperties(Optional.ToNullable(instanceFlexibility), serializedAdditionalRawData); + } + + ReservationOrderAliasRequestPropertiesReservedResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReservationOrderAliasRequestPropertiesReservedResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReservationOrderAliasRequestPropertiesReservedResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReservationOrderAliasRequestPropertiesReservedResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReservationOrderAliasRequestPropertiesReservedResourceProperties model) + { + if (model is null) + { + return null; } - return new ReservationOrderAliasRequestPropertiesReservedResourceProperties(Optional.ToNullable(instanceFlexibility)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReservationOrderAliasRequestPropertiesReservedResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReservationOrderAliasRequestPropertiesReservedResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.cs index 4ce8672b7c9a..a1703c905afc 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasRequestPropertiesReservedResourceProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Properties specific to each reserved resource type. Not required if not applicable. internal partial class ReservationOrderAliasRequestPropertiesReservedResourceProperties { - /// Initializes a new instance of ReservationOrderAliasRequestPropertiesReservedResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReservationOrderAliasRequestPropertiesReservedResourceProperties() { } - /// Initializes a new instance of ReservationOrderAliasRequestPropertiesReservedResourceProperties. + /// Initializes a new instance of . /// Turning this on will apply the reservation discount to other VMs in the same VM size group. - internal ReservationOrderAliasRequestPropertiesReservedResourceProperties(BillingBenefitsInstanceFlexibility? instanceFlexibility) + /// Keeps track of any properties unknown to the library. + internal ReservationOrderAliasRequestPropertiesReservedResourceProperties(BillingBenefitsInstanceFlexibility? instanceFlexibility, Dictionary serializedAdditionalRawData) { InstanceFlexibility = instanceFlexibility; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Turning this on will apply the reservation discount to other VMs in the same VM size group. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.Serialization.cs index 2535ff00b466..5a64189755b5 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class ReservationOrderAliasResponsePropertiesReservedResourceProperties : IUtf8JsonSerializable + internal partial class ReservationOrderAliasResponsePropertiesReservedResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InstanceFlexibility)) { writer.WritePropertyName("instanceFlexibility"u8); writer.WriteStringValue(InstanceFlexibility.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReservationOrderAliasResponsePropertiesReservedResourceProperties DeserializeReservationOrderAliasResponsePropertiesReservedResourceProperties(JsonElement element) + internal static ReservationOrderAliasResponsePropertiesReservedResourceProperties DeserializeReservationOrderAliasResponsePropertiesReservedResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional instanceFlexibility = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("instanceFlexibility"u8)) @@ -41,8 +64,61 @@ internal static ReservationOrderAliasResponsePropertiesReservedResourcePropertie instanceFlexibility = new BillingBenefitsInstanceFlexibility(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReservationOrderAliasResponsePropertiesReservedResourceProperties(Optional.ToNullable(instanceFlexibility), serializedAdditionalRawData); + } + + ReservationOrderAliasResponsePropertiesReservedResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReservationOrderAliasResponsePropertiesReservedResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReservationOrderAliasResponsePropertiesReservedResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReservationOrderAliasResponsePropertiesReservedResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReservationOrderAliasResponsePropertiesReservedResourceProperties model) + { + if (model is null) + { + return null; } - return new ReservationOrderAliasResponsePropertiesReservedResourceProperties(Optional.ToNullable(instanceFlexibility)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReservationOrderAliasResponsePropertiesReservedResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReservationOrderAliasResponsePropertiesReservedResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.cs index 207f8253e720..9ab2042091ee 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/ReservationOrderAliasResponsePropertiesReservedResourceProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Properties specific to each reserved resource type. Not required if not applicable. internal partial class ReservationOrderAliasResponsePropertiesReservedResourceProperties { - /// Initializes a new instance of ReservationOrderAliasResponsePropertiesReservedResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReservationOrderAliasResponsePropertiesReservedResourceProperties() { } - /// Initializes a new instance of ReservationOrderAliasResponsePropertiesReservedResourceProperties. + /// Initializes a new instance of . /// Turning this on will apply the reservation discount to other VMs in the same VM size group. - internal ReservationOrderAliasResponsePropertiesReservedResourceProperties(BillingBenefitsInstanceFlexibility? instanceFlexibility) + /// Keeps track of any properties unknown to the library. + internal ReservationOrderAliasResponsePropertiesReservedResourceProperties(BillingBenefitsInstanceFlexibility? instanceFlexibility, Dictionary serializedAdditionalRawData) { InstanceFlexibility = instanceFlexibility; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Turning this on will apply the reservation discount to other VMs in the same VM size group. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.Serialization.cs index 9a328760323f..b0863d0b4b7a 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class SavingsPlanModelList + internal partial class SavingsPlanModelList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanModelList DeserializeSavingsPlanModelList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanModelList DeserializeSavingsPlanModelList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static SavingsPlanModelList DeserializeSavingsPlanModelList(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanModelList(Optional.ToList(value), nextLink.Value); + return new SavingsPlanModelList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SavingsPlanModelList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanModelList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanModelList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanModelList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanModelList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanModelList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanModelList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.cs index 312c80483e7a..3442ffcc638c 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The SavingsPlanModelList. internal partial class SavingsPlanModelList { - /// Initializes a new instance of SavingsPlanModelList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanModelList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SavingsPlanModelList. + /// Initializes a new instance of . /// /// Url to get the next page. - internal SavingsPlanModelList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanModelList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the value. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.Serialization.cs index 186e511dc241..b295acb859e8 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class SavingsPlanModelListResult + internal partial class SavingsPlanModelListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanModelListResult DeserializeSavingsPlanModelListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanModelListResult DeserializeSavingsPlanModelListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static SavingsPlanModelListResult DeserializeSavingsPlanModelListResult Optional> value = default; Optional nextLink = default; Optional> additionalProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -58,8 +86,61 @@ internal static SavingsPlanModelListResult DeserializeSavingsPlanModelListResult additionalProperties = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanModelListResult(Optional.ToList(value), nextLink.Value, Optional.ToList(additionalProperties)); + return new SavingsPlanModelListResult(Optional.ToList(value), nextLink.Value, Optional.ToList(additionalProperties), serializedAdditionalRawData); + } + + SavingsPlanModelListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanModelListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanModelListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanModelListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanModelListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanModelListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanModelListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.cs index c7992bbfe017..bb4d901bb76f 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanModelListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The SavingsPlanModelListResult. internal partial class SavingsPlanModelListResult { - /// Initializes a new instance of SavingsPlanModelListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanModelListResult() { Value = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingList(); } - /// Initializes a new instance of SavingsPlanModelListResult. + /// Initializes a new instance of . /// The list of savings plans. /// Url to get the next page. /// The roll out count summary of the savings plans. - internal SavingsPlanModelListResult(IReadOnlyList value, string nextLink, IReadOnlyList additionalProperties) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanModelListResult(IReadOnlyList value, string nextLink, IReadOnlyList additionalProperties, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; AdditionalProperties = additionalProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of savings plans. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.Serialization.cs index 7c7cc818a8cb..5b3d6c36caac 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BillingBenefits; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class SavingsPlanOrderModelList + internal partial class SavingsPlanOrderModelList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanOrderModelList DeserializeSavingsPlanOrderModelList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanOrderModelList DeserializeSavingsPlanOrderModelList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static SavingsPlanOrderModelList DeserializeSavingsPlanOrderModelList(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanOrderModelList(Optional.ToList(value), nextLink.Value); + return new SavingsPlanOrderModelList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SavingsPlanOrderModelList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanOrderModelList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanOrderModelList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanOrderModelList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanOrderModelList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanOrderModelList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanOrderModelList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.cs index 7629ea8e6c10..2de6a3efdaf3 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderModelList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The SavingsPlanOrderModelList. internal partial class SavingsPlanOrderModelList { - /// Initializes a new instance of SavingsPlanOrderModelList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanOrderModelList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SavingsPlanOrderModelList. + /// Initializes a new instance of . /// /// Url to get the next page. - internal SavingsPlanOrderModelList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanOrderModelList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the value. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.Serialization.cs index 428f17a3eba7..508d645f9054 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class SavingsPlanOrderPaymentDetail : IUtf8JsonSerializable + public partial class SavingsPlanOrderPaymentDetail : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DueOn)) { @@ -29,12 +36,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PricingCurrencyTotal)) { writer.WritePropertyName("pricingCurrencyTotal"u8); - writer.WriteObjectValue(PricingCurrencyTotal); + if (PricingCurrencyTotal is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PricingCurrencyTotal).Serialize(writer, options); + } } if (Optional.IsDefined(BillingCurrencyTotal)) { writer.WritePropertyName("billingCurrencyTotal"u8); - writer.WriteObjectValue(BillingCurrencyTotal); + if (BillingCurrencyTotal is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BillingCurrencyTotal).Serialize(writer, options); + } } if (Optional.IsDefined(Status)) { @@ -46,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("billingAccount"u8); writer.WriteStringValue(BillingAccount); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SavingsPlanOrderPaymentDetail DeserializeSavingsPlanOrderPaymentDetail(JsonElement element) + internal static SavingsPlanOrderPaymentDetail DeserializeSavingsPlanOrderPaymentDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +97,7 @@ internal static SavingsPlanOrderPaymentDetail DeserializeSavingsPlanOrderPayment Optional status = default; Optional extendedStatusInfo = default; Optional billingAccount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dueDate"u8)) @@ -123,8 +159,61 @@ internal static SavingsPlanOrderPaymentDetail DeserializeSavingsPlanOrderPayment billingAccount = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SavingsPlanOrderPaymentDetail(Optional.ToNullable(dueDate), Optional.ToNullable(paymentDate), pricingCurrencyTotal.Value, billingCurrencyTotal.Value, Optional.ToNullable(status), extendedStatusInfo.Value, billingAccount.Value, serializedAdditionalRawData); + } + + SavingsPlanOrderPaymentDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanOrderPaymentDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanOrderPaymentDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanOrderPaymentDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanOrderPaymentDetail model) + { + if (model is null) + { + return null; } - return new SavingsPlanOrderPaymentDetail(Optional.ToNullable(dueDate), Optional.ToNullable(paymentDate), pricingCurrencyTotal.Value, billingCurrencyTotal.Value, Optional.ToNullable(status), extendedStatusInfo.Value, billingAccount.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanOrderPaymentDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanOrderPaymentDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.cs index 6b3f9c6c00d0..2f867b884d76 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanOrderPaymentDetail.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.BillingBenefits.Models { /// Information about payment related to a savings plan order. public partial class SavingsPlanOrderPaymentDetail { - /// Initializes a new instance of SavingsPlanOrderPaymentDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SavingsPlanOrderPaymentDetail() { } - /// Initializes a new instance of SavingsPlanOrderPaymentDetail. + /// Initializes a new instance of . /// Date when the payment needs to be done. /// Date when the transaction is completed. Is null when it is scheduled. /// Amount in pricing currency. Tax not included. @@ -25,7 +29,8 @@ public SavingsPlanOrderPaymentDetail() /// Describes whether the payment is completed, failed, cancelled or scheduled in the future. /// /// Billing account. - internal SavingsPlanOrderPaymentDetail(DateTimeOffset? dueOn, DateTimeOffset? payOn, BillingBenefitsPrice pricingCurrencyTotal, BillingBenefitsPrice billingCurrencyTotal, BillingBenefitsPaymentStatus? status, BillingBenefitsExtendedStatusInfo extendedStatusInfo, string billingAccount) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanOrderPaymentDetail(DateTimeOffset? dueOn, DateTimeOffset? payOn, BillingBenefitsPrice pricingCurrencyTotal, BillingBenefitsPrice billingCurrencyTotal, BillingBenefitsPaymentStatus? status, BillingBenefitsExtendedStatusInfo extendedStatusInfo, string billingAccount, Dictionary serializedAdditionalRawData) { DueOn = dueOn; PayOn = payOn; @@ -34,6 +39,7 @@ internal SavingsPlanOrderPaymentDetail(DateTimeOffset? dueOn, DateTimeOffset? pa Status = status; ExtendedStatusInfo = extendedStatusInfo; BillingAccount = billingAccount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Date when the payment needs to be done. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.Serialization.cs index 215bf3d37b2f..9c9427b99908 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.BillingBenefits; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class SavingsPlanPurchaseValidateContent : IUtf8JsonSerializable + public partial class SavingsPlanPurchaseValidateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Benefits)) { @@ -21,11 +30,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Benefits) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SavingsPlanPurchaseValidateContent DeserializeSavingsPlanPurchaseValidateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> benefits = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("benefits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BillingBenefitsSavingsPlanOrderAliasData.DeserializeBillingBenefitsSavingsPlanOrderAliasData(item)); + } + benefits = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SavingsPlanPurchaseValidateContent(Optional.ToList(benefits), serializedAdditionalRawData); + } + + SavingsPlanPurchaseValidateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanPurchaseValidateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanPurchaseValidateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanPurchaseValidateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanPurchaseValidateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanPurchaseValidateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanPurchaseValidateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.cs index 77a780bbcaba..a324cf0cb12b 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanPurchaseValidateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BillingBenefits; @@ -14,12 +15,24 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The SavingsPlanPurchaseValidateContent. public partial class SavingsPlanPurchaseValidateContent { - /// Initializes a new instance of SavingsPlanPurchaseValidateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SavingsPlanPurchaseValidateContent() { Benefits = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal SavingsPlanPurchaseValidateContent(IList benefits, Dictionary serializedAdditionalRawData) + { + Benefits = benefits; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets the benefits. public IList Benefits { get; } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.Serialization.cs index cf418479409c..656176a6f712 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.Serialization.cs @@ -5,21 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class SavingsPlanSummary + internal partial class SavingsPlanSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanSummary DeserializeSavingsPlanSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + if (Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Value).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanSummary DeserializeSavingsPlanSummary(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +77,61 @@ internal static SavingsPlanSummary DeserializeSavingsPlanSummary(JsonElement ele value = SavingsPlanSummaryCount.DeserializeSavingsPlanSummaryCount(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanSummary(name.Value, value.Value); + return new SavingsPlanSummary(name.Value, value.Value, serializedAdditionalRawData); + } + + SavingsPlanSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.cs index 6f1374d95d1c..5f044fc9cf60 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummary.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Savings plans list summary. internal partial class SavingsPlanSummary { - /// Initializes a new instance of SavingsPlanSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanSummary() { } - /// Initializes a new instance of SavingsPlanSummary. + /// Initializes a new instance of . /// This property has value 'summary'. /// The roll up count summary of savings plans in each state. - internal SavingsPlanSummary(string name, SavingsPlanSummaryCount value) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanSummary(string name, SavingsPlanSummaryCount value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property has value 'summary'. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.Serialization.cs index 687fae62fdaa..5c6a77efdb57 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class SavingsPlanSummaryCount + internal partial class SavingsPlanSummaryCount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanSummaryCount DeserializeSavingsPlanSummaryCount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanSummaryCount DeserializeSavingsPlanSummaryCount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +55,7 @@ internal static SavingsPlanSummaryCount DeserializeSavingsPlanSummaryCount(JsonE Optional processingCount = default; Optional noBenefitCount = default; Optional warningCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("succeededCount"u8)) @@ -110,8 +139,61 @@ internal static SavingsPlanSummaryCount DeserializeSavingsPlanSummaryCount(JsonE warningCount = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanSummaryCount(Optional.ToNullable(succeededCount), Optional.ToNullable(failedCount), Optional.ToNullable(expiringCount), Optional.ToNullable(expiredCount), Optional.ToNullable(pendingCount), Optional.ToNullable(cancelledCount), Optional.ToNullable(processingCount), Optional.ToNullable(noBenefitCount), Optional.ToNullable(warningCount)); + return new SavingsPlanSummaryCount(Optional.ToNullable(succeededCount), Optional.ToNullable(failedCount), Optional.ToNullable(expiringCount), Optional.ToNullable(expiredCount), Optional.ToNullable(pendingCount), Optional.ToNullable(cancelledCount), Optional.ToNullable(processingCount), Optional.ToNullable(noBenefitCount), Optional.ToNullable(warningCount), serializedAdditionalRawData); + } + + SavingsPlanSummaryCount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanSummaryCount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanSummaryCount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanSummaryCount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanSummaryCount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanSummaryCount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanSummaryCount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.cs index 2e54aa96e84c..8908b4692e1b 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanSummaryCount.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// The roll up count summary of savings plans in each state. internal partial class SavingsPlanSummaryCount { - /// Initializes a new instance of SavingsPlanSummaryCount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanSummaryCount() { } - /// Initializes a new instance of SavingsPlanSummaryCount. + /// Initializes a new instance of . /// The number of savings plans in Succeeded state. /// The number of savings plans in Failed state. /// The number of savings plans in Expiring state. @@ -25,7 +31,8 @@ internal SavingsPlanSummaryCount() /// The number of savings plans in Processing state. /// The number of savings plans in No Benefit state. /// The number of savings plans in Warning state. - internal SavingsPlanSummaryCount(float? succeededCount, float? failedCount, float? expiringCount, float? expiredCount, float? pendingCount, float? cancelledCount, float? processingCount, float? noBenefitCount, float? warningCount) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanSummaryCount(float? succeededCount, float? failedCount, float? expiringCount, float? expiredCount, float? pendingCount, float? cancelledCount, float? processingCount, float? noBenefitCount, float? warningCount, Dictionary serializedAdditionalRawData) { SucceededCount = succeededCount; FailedCount = failedCount; @@ -36,6 +43,7 @@ internal SavingsPlanSummaryCount(float? succeededCount, float? failedCount, floa ProcessingCount = processingCount; NoBenefitCount = noBenefitCount; WarningCount = warningCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of savings plans in Succeeded state. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.Serialization.cs index 841815aac31c..50d1b055863c 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class SavingsPlanUpdateValidateContent : IUtf8JsonSerializable + public partial class SavingsPlanUpdateValidateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Benefits)) { @@ -21,11 +29,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Benefits) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SavingsPlanUpdateValidateContent DeserializeSavingsPlanUpdateValidateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> benefits = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("benefits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BillingBenefitsSavingsPlanPatchProperties.DeserializeBillingBenefitsSavingsPlanPatchProperties(item)); + } + benefits = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SavingsPlanUpdateValidateContent(Optional.ToList(benefits), serializedAdditionalRawData); + } + + SavingsPlanUpdateValidateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanUpdateValidateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanUpdateValidateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanUpdateValidateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanUpdateValidateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanUpdateValidateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanUpdateValidateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.cs index 9c7925a11d0b..fa2ca55b2afe 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanUpdateValidateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The SavingsPlanUpdateValidateContent. public partial class SavingsPlanUpdateValidateContent { - /// Initializes a new instance of SavingsPlanUpdateValidateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SavingsPlanUpdateValidateContent() { Benefits = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal SavingsPlanUpdateValidateContent(IList benefits, Dictionary serializedAdditionalRawData) + { + Benefits = benefits; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets the benefits. public IList Benefits { get; } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.Serialization.cs index 717a29668ae4..f96bf1bd0cc7 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - internal partial class SavingsPlanValidateResponse + internal partial class SavingsPlanValidateResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanValidateResponse DeserializeSavingsPlanValidateResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Benefits)) + { + writer.WritePropertyName("benefits"u8); + writer.WriteStartArray(); + foreach (var item in Benefits) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanValidateResponse DeserializeSavingsPlanValidateResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> benefits = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("benefits"u8)) @@ -42,8 +92,61 @@ internal static SavingsPlanValidateResponse DeserializeSavingsPlanValidateRespon nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanValidateResponse(Optional.ToList(benefits), nextLink.Value); + return new SavingsPlanValidateResponse(Optional.ToList(benefits), nextLink.Value, serializedAdditionalRawData); + } + + SavingsPlanValidateResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanValidateResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanValidateResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanValidateResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanValidateResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanValidateResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanValidateResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.cs index 243e1f43cb0f..c341aa4933eb 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.BillingBenefits.Models /// The SavingsPlanValidateResponse. internal partial class SavingsPlanValidateResponse { - /// Initializes a new instance of SavingsPlanValidateResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanValidateResponse() { Benefits = new ChangeTrackingList(); } - /// Initializes a new instance of SavingsPlanValidateResponse. + /// Initializes a new instance of . /// /// Url to get the next page. - internal SavingsPlanValidateResponse(IReadOnlyList benefits, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanValidateResponse(IReadOnlyList benefits, string nextLink, Dictionary serializedAdditionalRawData) { Benefits = benefits; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the benefits. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.Serialization.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.Serialization.cs index 0baa51b10c4e..265381665335 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.Serialization.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BillingBenefits.Models { - public partial class SavingsPlanValidateResult + public partial class SavingsPlanValidateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SavingsPlanValidateResult DeserializeSavingsPlanValidateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsValid)) + { + writer.WritePropertyName("valid"u8); + writer.WriteBooleanValue(IsValid.Value); + } + if (Optional.IsDefined(ReasonCode)) + { + writer.WritePropertyName("reasonCode"u8); + writer.WriteStringValue(ReasonCode); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SavingsPlanValidateResult DeserializeSavingsPlanValidateResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static SavingsPlanValidateResult DeserializeSavingsPlanValidateResult(J Optional valid = default; Optional reasonCode = default; Optional reason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("valid"u8)) @@ -42,8 +86,61 @@ internal static SavingsPlanValidateResult DeserializeSavingsPlanValidateResult(J reason = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SavingsPlanValidateResult(Optional.ToNullable(valid), reasonCode.Value, reason.Value); + return new SavingsPlanValidateResult(Optional.ToNullable(valid), reasonCode.Value, reason.Value, serializedAdditionalRawData); + } + + SavingsPlanValidateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanValidateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanValidateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanValidateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanValidateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanValidateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanValidateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.cs index 8ac662225e05..42c99ed33e3e 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Models/SavingsPlanValidateResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BillingBenefits.Models { /// Benefit scope response property. public partial class SavingsPlanValidateResult { - /// Initializes a new instance of SavingsPlanValidateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SavingsPlanValidateResult() { } - /// Initializes a new instance of SavingsPlanValidateResult. + /// Initializes a new instance of . /// Indicates if the provided input was valid. /// Failure reason code if the provided input was invalid. /// Failure reason if the provided input was invalid. - internal SavingsPlanValidateResult(bool? isValid, string reasonCode, string reason) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanValidateResult(bool? isValid, string reasonCode, string reason, Dictionary serializedAdditionalRawData) { IsValid = isValid; ReasonCode = reasonCode; Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the provided input was valid. diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/BillingBenefitsRPRestOperations.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/BillingBenefitsRPRestOperations.cs index b8e589af4123..76175c9dd370 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/BillingBenefitsRPRestOperations.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/BillingBenefitsRPRestOperations.cs @@ -49,9 +49,7 @@ internal HttpMessage CreateValidatePurchaseRequest(SavingsPlanPurchaseValidateCo request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/ReservationOrderAliasRestOperations.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/ReservationOrderAliasRestOperations.cs index 00d165e884a8..351edcc0f435 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/ReservationOrderAliasRestOperations.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/ReservationOrderAliasRestOperations.cs @@ -50,9 +50,7 @@ internal HttpMessage CreateCreateRequest(string reservationOrderAliasName, Billi request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanOrderAliasRestOperations.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanOrderAliasRestOperations.cs index 4ed591454737..e61f32dae36d 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanOrderAliasRestOperations.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanOrderAliasRestOperations.cs @@ -49,9 +49,7 @@ internal HttpMessage CreateCreateRequest(string savingsPlanOrderAliasName, Billi request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanRestOperations.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanRestOperations.cs index b9e5804188e9..70013b54e42b 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanRestOperations.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/RestOperations/SavingsPlanRestOperations.cs @@ -292,9 +292,7 @@ internal HttpMessage CreateUpdateRequest(string savingsPlanOrderId, string savin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -377,9 +375,7 @@ internal HttpMessage CreateValidateUpdateRequest(string savingsPlanOrderId, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArmBlueprintModelFactory.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArmBlueprintModelFactory.cs index 0705186ed498..27eefde32066 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArmBlueprintModelFactory.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArmBlueprintModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Blueprint.Models /// Model factory for models. public static partial class ArmBlueprintModelFactory { - /// Initializes a new instance of BlueprintData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,28 +36,28 @@ public static BlueprintData BlueprintData(ResourceIdentifier id = null, string n parameters ??= new Dictionary(); resourceGroups ??= new Dictionary(); - return new BlueprintData(id, name, resourceType, systemData, displayName, description, status, targetScope, parameters, resourceGroups, versions, layout); + return new BlueprintData(id, name, resourceType, systemData, displayName, description, status, targetScope, parameters, resourceGroups, versions, layout, default); } - /// Initializes a new instance of BlueprintStatus. + /// Initializes a new instance of . /// Creation time of this blueprint definition. /// Last modified time of this blueprint definition. /// A new instance for mocking. public static BlueprintStatus BlueprintStatus(DateTimeOffset? timeCreated = null, DateTimeOffset? lastModified = null) { - return new BlueprintStatus(timeCreated, lastModified); + return new BlueprintStatus(timeCreated, lastModified, default); } - /// Initializes a new instance of BlueprintResourceStatusBase. + /// Initializes a new instance of . /// Creation time of this blueprint definition. /// Last modified time of this blueprint definition. /// A new instance for mocking. public static BlueprintResourceStatusBase BlueprintResourceStatusBase(DateTimeOffset? timeCreated = null, DateTimeOffset? lastModified = null) { - return new BlueprintResourceStatusBase(timeCreated, lastModified); + return new BlueprintResourceStatusBase(timeCreated, lastModified, default); } - /// Initializes a new instance of ArtifactData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -66,10 +66,10 @@ public static BlueprintResourceStatusBase BlueprintResourceStatusBase(DateTimeOf /// A new instance for mocking. public static ArtifactData ArtifactData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = "Unknown") { - return new ArtifactData(id, name, resourceType, systemData, kind); + return new ArtifactData(id, name, resourceType, systemData, kind, default); } - /// Initializes a new instance of PublishedBlueprintData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -88,10 +88,10 @@ public static PublishedBlueprintData PublishedBlueprintData(ResourceIdentifier i parameters ??= new Dictionary(); resourceGroups ??= new Dictionary(); - return new PublishedBlueprintData(id, name, resourceType, systemData, displayName, description, status, targetScope, parameters, resourceGroups, blueprintName, changeNotes); + return new PublishedBlueprintData(id, name, resourceType, systemData, displayName, description, status, targetScope, parameters, resourceGroups, blueprintName, changeNotes, default); } - /// Initializes a new instance of AssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -113,10 +113,10 @@ public static AssignmentData AssignmentData(ResourceIdentifier id = null, string parameters ??= new Dictionary(); resourceGroups ??= new Dictionary(); - return new AssignmentData(id, name, resourceType, systemData, identity, displayName, description, blueprintId, scope, parameters, resourceGroups, status, locks, provisioningState, location); + return new AssignmentData(id, name, resourceType, systemData, identity, displayName, description, blueprintId, scope, parameters, resourceGroups, status, locks, provisioningState, location, default); } - /// Initializes a new instance of AssignmentStatus. + /// Initializes a new instance of . /// Creation time of this blueprint definition. /// Last modified time of this blueprint definition. /// List of resources that were created by the blueprint assignment. @@ -125,18 +125,18 @@ public static AssignmentStatus AssignmentStatus(DateTimeOffset? timeCreated = nu { managedResources ??= new List(); - return new AssignmentStatus(timeCreated, lastModified, managedResources?.ToList()); + return new AssignmentStatus(timeCreated, lastModified, managedResources?.ToList(), default); } - /// Initializes a new instance of WhoIsBlueprintContract. + /// Initializes a new instance of . /// AAD object Id of the Azure Blueprints service principal in the tenant. /// A new instance for mocking. public static WhoIsBlueprintContract WhoIsBlueprintContract(string objectId = null) { - return new WhoIsBlueprintContract(objectId); + return new WhoIsBlueprintContract(objectId, default); } - /// Initializes a new instance of AssignmentOperationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -152,10 +152,10 @@ public static AssignmentOperationData AssignmentOperationData(ResourceIdentifier { deployments ??= new List(); - return new AssignmentOperationData(id, name, resourceType, systemData, blueprintVersion, assignmentState, timeCreated, timeStarted, timeFinished, deployments?.ToList()); + return new AssignmentOperationData(id, name, resourceType, systemData, blueprintVersion, assignmentState, timeCreated, timeStarted, timeFinished, deployments?.ToList(), default); } - /// Initializes a new instance of AssignmentJobCreatedResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -166,10 +166,10 @@ public static AssignmentJobCreatedResource AssignmentJobCreatedResource(Resource { properties ??= new Dictionary(); - return new AssignmentJobCreatedResource(id, name, resourceType, systemData, properties); + return new AssignmentJobCreatedResource(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of TemplateArtifact. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -186,10 +186,10 @@ public static TemplateArtifact TemplateArtifact(ResourceIdentifier id = null, st dependsOn ??= new List(); parameters ??= new Dictionary(); - return new TemplateArtifact(id, name, resourceType, systemData, ArtifactKind.Template, displayName, description, dependsOn?.ToList(), template, resourceGroup, parameters); + return new TemplateArtifact(id, name, resourceType, systemData, ArtifactKind.Template, displayName, description, dependsOn?.ToList(), template, resourceGroup, parameters, default); } - /// Initializes a new instance of RoleAssignmentArtifact. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -205,10 +205,10 @@ public static RoleAssignmentArtifact RoleAssignmentArtifact(ResourceIdentifier i { dependsOn ??= new List(); - return new RoleAssignmentArtifact(id, name, resourceType, systemData, ArtifactKind.RoleAssignment, displayName, description, dependsOn?.ToList(), roleDefinitionId, principalIds, resourceGroup); + return new RoleAssignmentArtifact(id, name, resourceType, systemData, ArtifactKind.RoleAssignment, displayName, description, dependsOn?.ToList(), roleDefinitionId, principalIds, resourceGroup, default); } - /// Initializes a new instance of PolicyAssignmentArtifact. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -225,7 +225,7 @@ public static PolicyAssignmentArtifact PolicyAssignmentArtifact(ResourceIdentifi dependsOn ??= new List(); parameters ??= new Dictionary(); - return new PolicyAssignmentArtifact(id, name, resourceType, systemData, ArtifactKind.PolicyAssignment, displayName, description, dependsOn?.ToList(), policyDefinitionId, parameters, resourceGroup); + return new PolicyAssignmentArtifact(id, name, resourceType, systemData, ArtifactKind.PolicyAssignment, displayName, description, dependsOn?.ToList(), policyDefinitionId, parameters, resourceGroup, default); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArtifactData.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArtifactData.cs index dd0186e5bdc4..87894272668a 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArtifactData.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/ArtifactData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint.Models; using Azure.ResourceManager.Models; @@ -19,20 +21,25 @@ namespace Azure.ResourceManager.Blueprint /// public partial class ArtifactData : ResourceData { - /// Initializes a new instance of ArtifactData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ArtifactData() { } - /// Initializes a new instance of ArtifactData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Specifies the kind of blueprint artifact. - internal ArtifactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ArtifactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the kind of blueprint artifact. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs index 564c3a3d9b8f..612558c55d31 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentCollection.cs @@ -218,7 +218,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _assignmentRestClient.CreateListRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _assignmentRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AssignmentResource(Client, AssignmentData.DeserializeAssignmentData(e)), _assignmentClientDiagnostics, Pipeline, "AssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AssignmentResource(Client, AssignmentData.DeserializeAssignmentData(e)), _assignmentClientDiagnostics, Pipeline, "AssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -240,7 +240,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _assignmentRestClient.CreateListRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _assignmentRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AssignmentResource(Client, AssignmentData.DeserializeAssignmentData(e)), _assignmentClientDiagnostics, Pipeline, "AssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AssignmentResource(Client, AssignmentData.DeserializeAssignmentData(e)), _assignmentClientDiagnostics, Pipeline, "AssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentData.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentData.cs index c706d21a69cf..fdca6b61d681 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentData.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Blueprint /// public partial class AssignmentData : ResourceData { - /// Initializes a new instance of AssignmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Managed identity for this blueprint assignment. /// Blueprint assignment parameter values. /// Names and locations of resource group placeholders. @@ -37,7 +40,7 @@ public AssignmentData(Models.ManagedServiceIdentity identity, IDictionary Initializes a new instance of AssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -53,7 +56,8 @@ public AssignmentData(Models.ManagedServiceIdentity identity, IDictionary Defines how resources deployed by a blueprint assignment are locked. /// State of the blueprint assignment. /// The location of this blueprint assignment. - internal AssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Models.ManagedServiceIdentity identity, string displayName, string description, string blueprintId, string scope, IDictionary parameters, IDictionary resourceGroups, AssignmentStatus status, AssignmentLockSettings locks, AssignmentProvisioningState? provisioningState, AzureLocation location) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Models.ManagedServiceIdentity identity, string displayName, string description, string blueprintId, string scope, IDictionary parameters, IDictionary resourceGroups, AssignmentStatus status, AssignmentLockSettings locks, AssignmentProvisioningState? provisioningState, AzureLocation location, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Identity = identity; DisplayName = displayName; @@ -66,6 +70,12 @@ internal AssignmentData(ResourceIdentifier id, string name, ResourceType resourc Locks = locks; ProvisioningState = provisioningState; Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssignmentData() + { } /// Managed identity for this blueprint assignment. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs index 11dc4ffb4361..e90f75679e27 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _assignmentOperationRestClient.CreateListRequest(Id.Parent, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _assignmentOperationRestClient.CreateListNextPageRequest(nextLink, Id.Parent, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AssignmentOperationResource(Client, AssignmentOperationData.DeserializeAssignmentOperationData(e)), _assignmentOperationClientDiagnostics, Pipeline, "AssignmentOperationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AssignmentOperationResource(Client, AssignmentOperationData.DeserializeAssignmentOperationData(e)), _assignmentOperationClientDiagnostics, Pipeline, "AssignmentOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _assignmentOperationRestClient.CreateListRequest(Id.Parent, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _assignmentOperationRestClient.CreateListNextPageRequest(nextLink, Id.Parent, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AssignmentOperationResource(Client, AssignmentOperationData.DeserializeAssignmentOperationData(e)), _assignmentOperationClientDiagnostics, Pipeline, "AssignmentOperationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AssignmentOperationResource(Client, AssignmentOperationData.DeserializeAssignmentOperationData(e)), _assignmentOperationClientDiagnostics, Pipeline, "AssignmentOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationData.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationData.cs index 32e70b2abd23..93be6ebbbeb7 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationData.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Blueprint /// public partial class AssignmentOperationData : ResourceData { - /// Initializes a new instance of AssignmentOperationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AssignmentOperationData() { Deployments = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentOperationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public AssignmentOperationData() /// Start time of the underlying deployment. /// Finish time of the overall underlying deployments. /// List of jobs in this blueprint assignment operation. - internal AssignmentOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string blueprintVersion, string assignmentState, string timeCreated, string timeStarted, string timeFinished, IList deployments) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AssignmentOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string blueprintVersion, string assignmentState, string timeCreated, string timeStarted, string timeFinished, IList deployments, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { BlueprintVersion = blueprintVersion; AssignmentState = assignmentState; @@ -43,6 +48,7 @@ internal AssignmentOperationData(ResourceIdentifier id, string name, ResourceTyp TimeStarted = timeStarted; TimeFinished = timeFinished; Deployments = deployments; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The published version of the blueprint definition used for the blueprint assignment operation. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs index bd0ec0f7b6e9..038e24d752e3 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _blueprintArtifactArtifactsRestClient.CreateListRequest(Id.Parent, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _blueprintArtifactArtifactsRestClient.CreateListNextPageRequest(nextLink, Id.Parent, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BlueprintArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintArtifactArtifactsClientDiagnostics, Pipeline, "BlueprintArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BlueprintArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintArtifactArtifactsClientDiagnostics, Pipeline, "BlueprintArtifactCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _blueprintArtifactArtifactsRestClient.CreateListRequest(Id.Parent, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _blueprintArtifactArtifactsRestClient.CreateListNextPageRequest(nextLink, Id.Parent, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BlueprintArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintArtifactArtifactsClientDiagnostics, Pipeline, "BlueprintArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BlueprintArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintArtifactArtifactsClientDiagnostics, Pipeline, "BlueprintArtifactCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs index 77b6132681d2..dd82cb6af4cf 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintCollection.cs @@ -218,7 +218,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _blueprintRestClient.CreateListRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _blueprintRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BlueprintResource(Client, BlueprintData.DeserializeBlueprintData(e)), _blueprintClientDiagnostics, Pipeline, "BlueprintCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BlueprintResource(Client, BlueprintData.DeserializeBlueprintData(e)), _blueprintClientDiagnostics, Pipeline, "BlueprintCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -240,7 +240,7 @@ public virtual Pageable GetAll(CancellationToken cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _blueprintRestClient.CreateListRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _blueprintRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BlueprintResource(Client, BlueprintData.DeserializeBlueprintData(e)), _blueprintClientDiagnostics, Pipeline, "BlueprintCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BlueprintResource(Client, BlueprintData.DeserializeBlueprintData(e)), _blueprintClientDiagnostics, Pipeline, "BlueprintCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintData.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintData.cs index a17f8ad3a29b..fbc4973722cf 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintData.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Blueprint /// public partial class BlueprintData : ResourceData { - /// Initializes a new instance of BlueprintData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BlueprintData() { Parameters = new ChangeTrackingDictionary(); ResourceGroups = new ChangeTrackingDictionary(); } - /// Initializes a new instance of BlueprintData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +42,8 @@ public BlueprintData() /// Resource group placeholders defined by this blueprint definition. /// Published versions of this blueprint definition. /// Layout view of the blueprint definition for UI reference. - internal BlueprintData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, BlueprintStatus status, BlueprintTargetScope? targetScope, IDictionary parameters, IDictionary resourceGroups, BinaryData versions, BinaryData layout) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BlueprintData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, BlueprintStatus status, BlueprintTargetScope? targetScope, IDictionary parameters, IDictionary resourceGroups, BinaryData versions, BinaryData layout, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; @@ -49,6 +53,7 @@ internal BlueprintData(ResourceIdentifier id, string name, ResourceType resource ResourceGroups = resourceGroups; Versions = versions; Layout = layout; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// One-liner string explain this resource. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs index d64496c84ecb..d4a85a448eb8 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs @@ -425,7 +425,7 @@ public virtual AsyncPageable GetPublishedBlueprintsA { HttpMessage FirstPageRequest(int? pageSizeHint) => _publishedBlueprintRestClient.CreateListRequest(Id.Parent, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publishedBlueprintRestClient.CreateListNextPageRequest(nextLink, Id.Parent, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublishedBlueprintResource(Client, PublishedBlueprintData.DeserializePublishedBlueprintData(e)), _publishedBlueprintClientDiagnostics, Pipeline, "BlueprintResource.GetPublishedBlueprints", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new PublishedBlueprintResource(Client, PublishedBlueprintData.DeserializePublishedBlueprintData(e)), _publishedBlueprintClientDiagnostics, Pipeline, "BlueprintResource.GetPublishedBlueprints", "value", "nextLink", cancellationToken); } /// @@ -447,7 +447,7 @@ public virtual Pageable GetPublishedBlueprints(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _publishedBlueprintRestClient.CreateListRequest(Id.Parent, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publishedBlueprintRestClient.CreateListNextPageRequest(nextLink, Id.Parent, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublishedBlueprintResource(Client, PublishedBlueprintData.DeserializePublishedBlueprintData(e)), _publishedBlueprintClientDiagnostics, Pipeline, "BlueprintResource.GetPublishedBlueprints", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new PublishedBlueprintResource(Client, PublishedBlueprintData.DeserializePublishedBlueprintData(e)), _publishedBlueprintClientDiagnostics, Pipeline, "BlueprintResource.GetPublishedBlueprints", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs index f70680ffb003..56ce7f9d93e4 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _blueprintVersionArtifactPublishedArtifactsRestClient.CreateListRequest(Id.Parent.Parent, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _blueprintVersionArtifactPublishedArtifactsRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Parent, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BlueprintVersionArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintVersionArtifactPublishedArtifactsClientDiagnostics, Pipeline, "BlueprintVersionArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BlueprintVersionArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintVersionArtifactPublishedArtifactsClientDiagnostics, Pipeline, "BlueprintVersionArtifactCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _blueprintVersionArtifactPublishedArtifactsRestClient.CreateListRequest(Id.Parent.Parent, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _blueprintVersionArtifactPublishedArtifactsRestClient.CreateListNextPageRequest(nextLink, Id.Parent.Parent, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BlueprintVersionArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintVersionArtifactPublishedArtifactsClientDiagnostics, Pipeline, "BlueprintVersionArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BlueprintVersionArtifactResource(Client, ArtifactData.DeserializeArtifactData(e)), _blueprintVersionArtifactPublishedArtifactsClientDiagnostics, Pipeline, "BlueprintVersionArtifactCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactData.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactData.Serialization.cs index faefe2400906..3ba58a37afcc 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactData.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint { - public partial class ArtifactData : IUtf8JsonSerializable + public partial class ArtifactData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ArtifactData DeserializeArtifactData(JsonElement element) + internal static ArtifactData DeserializeArtifactData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,11 +59,14 @@ internal static ArtifactData DeserializeArtifactData(JsonElement element) case "template": return TemplateArtifact.DeserializeTemplateArtifact(element); } } + + // Unknown type found so we will deserialize the base properties only ArtifactKind kind = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -73,8 +98,61 @@ internal static ArtifactData DeserializeArtifactData(JsonElement element) systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArtifactData(id, name, type, systemData.Value, kind); + return new ArtifactData(id, name, type, systemData.Value, kind, serializedAdditionalRawData); + } + + ArtifactData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArtifactData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArtifactData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArtifactData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArtifactData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArtifactData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.Serialization.cs index 369807412d6e..4a70b0f3f290 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint; namespace Azure.ResourceManager.Blueprint.Models { - internal partial class ArtifactList + internal partial class ArtifactList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArtifactList DeserializeArtifactList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArtifactList DeserializeArtifactList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ArtifactList DeserializeArtifactList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArtifactList(Optional.ToList(value), nextLink.Value); + return new ArtifactList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ArtifactList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArtifactList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArtifactList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArtifactList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArtifactList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArtifactList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.cs index 15ba8b1d2882..b91f03f70c55 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ArtifactList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.Blueprint.Models /// List of blueprint artifacts. internal partial class ArtifactList { - /// Initializes a new instance of ArtifactList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ArtifactList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ArtifactList. + /// Initializes a new instance of . /// /// List of blueprint artifacts. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// /// Link to the next page of results. - internal ArtifactList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ArtifactList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentData.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentData.Serialization.cs index 2a936d42f07e..60b130e479d4 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentData.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentData.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint { - public partial class AssignmentData : IUtf8JsonSerializable + public partial class AssignmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); writer.WritePropertyName("properties"u8); @@ -49,7 +63,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); writer.WritePropertyName("resourceGroups"u8); @@ -57,20 +78,48 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in ResourceGroups) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); if (Optional.IsDefined(Locks)) { writer.WritePropertyName("locks"u8); - writer.WriteObjectValue(Locks); + if (Locks is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Locks).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentData DeserializeAssignmentData(JsonElement element) + internal static AssignmentData DeserializeAssignmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,6 +139,7 @@ internal static AssignmentData DeserializeAssignmentData(JsonElement element) Optional status = default; Optional locks = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -205,8 +255,61 @@ internal static AssignmentData DeserializeAssignmentData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssignmentData(id, name, type, systemData.Value, identity, displayName.Value, description.Value, blueprintId.Value, scope.Value, parameters, resourceGroups, status.Value, locks.Value, Optional.ToNullable(provisioningState), location); + return new AssignmentData(id, name, type, systemData.Value, identity, displayName.Value, description.Value, blueprintId.Value, scope.Value, parameters, resourceGroups, status.Value, locks.Value, Optional.ToNullable(provisioningState), location, serializedAdditionalRawData); + } + + AssignmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.Serialization.cs index 12f30cd6575c..0241c7c1a900 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class AssignmentDeploymentJob : IUtf8JsonSerializable + public partial class AssignmentDeploymentJob : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -40,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Result)) { writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result); + if (Result is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Result).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(History)) { @@ -48,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in History) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -57,11 +77,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("requestUri"u8); writer.WriteStringValue(RequestUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentDeploymentJob DeserializeAssignmentDeploymentJob(JsonElement element) + internal static AssignmentDeploymentJob DeserializeAssignmentDeploymentJob(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +107,7 @@ internal static AssignmentDeploymentJob DeserializeAssignmentDeploymentJob(JsonE Optional result = default; Optional> history = default; Optional requestUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -127,8 +162,61 @@ internal static AssignmentDeploymentJob DeserializeAssignmentDeploymentJob(JsonE requestUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssignmentDeploymentJob(kind.Value, action.Value, jobId.Value, jobState.Value, result.Value, Optional.ToList(history), requestUri.Value, serializedAdditionalRawData); + } + + AssignmentDeploymentJob IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentDeploymentJob(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentDeploymentJob IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentDeploymentJob(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentDeploymentJob model) + { + if (model is null) + { + return null; } - return new AssignmentDeploymentJob(kind.Value, action.Value, jobId.Value, jobState.Value, result.Value, Optional.ToList(history), requestUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentDeploymentJob(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentDeploymentJob(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.cs index 7f523966e06f..eddad9bbde66 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJob.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Blueprint.Models /// Represents individual job in given blueprint assignment operation. public partial class AssignmentDeploymentJob { - /// Initializes a new instance of AssignmentDeploymentJob. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AssignmentDeploymentJob() { History = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentDeploymentJob. + /// Initializes a new instance of . /// Kind of job. /// Name of the action performed in this job. /// Id of this job. @@ -28,7 +31,8 @@ public AssignmentDeploymentJob() /// Deployment job result. /// Result of this deployment job for each retry. /// Reference to deployment job resource id. - internal AssignmentDeploymentJob(string kind, string action, string jobId, string jobState, AssignmentDeploymentJobResult result, IList history, Uri requestUri) + /// Keeps track of any properties unknown to the library. + internal AssignmentDeploymentJob(string kind, string action, string jobId, string jobState, AssignmentDeploymentJobResult result, IList history, Uri requestUri, Dictionary serializedAdditionalRawData) { Kind = kind; Action = action; @@ -37,6 +41,7 @@ internal AssignmentDeploymentJob(string kind, string action, string jobId, strin Result = result; History = history; RequestUri = requestUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Kind of job. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.Serialization.cs index 1fe6c7e5ce63..652a904fe4ac 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class AssignmentDeploymentJobResult : IUtf8JsonSerializable + public partial class AssignmentDeploymentJobResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Resources)) { @@ -27,21 +41,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Resources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentDeploymentJobResult DeserializeAssignmentDeploymentJobResult(JsonElement element) + internal static AssignmentDeploymentJobResult DeserializeAssignmentDeploymentJobResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; Optional> resources = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -67,8 +103,61 @@ internal static AssignmentDeploymentJobResult DeserializeAssignmentDeploymentJob resources = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssignmentDeploymentJobResult(error.Value, Optional.ToList(resources), serializedAdditionalRawData); + } + + AssignmentDeploymentJobResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentDeploymentJobResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentDeploymentJobResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentDeploymentJobResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentDeploymentJobResult model) + { + if (model is null) + { + return null; } - return new AssignmentDeploymentJobResult(error.Value, Optional.ToList(resources)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentDeploymentJobResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentDeploymentJobResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.cs index 25b5f3470abe..7d225bf90743 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentDeploymentJobResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Blueprint.Models /// Result of each individual deployment in a blueprint assignment. public partial class AssignmentDeploymentJobResult { - /// Initializes a new instance of AssignmentDeploymentJobResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AssignmentDeploymentJobResult() { Resources = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentDeploymentJobResult. + /// Initializes a new instance of . /// Contains error details if deployment job failed. /// Resources created as result of the deployment job. - internal AssignmentDeploymentJobResult(AzureResourceManagerError error, IList resources) + /// Keeps track of any properties unknown to the library. + internal AssignmentDeploymentJobResult(AzureResourceManagerError error, IList resources, Dictionary serializedAdditionalRawData) { Error = error; Resources = resources; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Contains error details if deployment job failed. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.Serialization.cs index 9fdfff880fe1..c1c653da3f7c 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint.Models { - public partial class AssignmentJobCreatedResource : IUtf8JsonSerializable + public partial class AssignmentJobCreatedResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Properties)) { @@ -28,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentJobCreatedResource DeserializeAssignmentJobCreatedResource(JsonElement element) + internal static AssignmentJobCreatedResource DeserializeAssignmentJobCreatedResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +63,7 @@ internal static AssignmentJobCreatedResource DeserializeAssignmentJobCreatedReso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -82,8 +104,61 @@ internal static AssignmentJobCreatedResource DeserializeAssignmentJobCreatedReso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssignmentJobCreatedResource(id, name, type, systemData.Value, Optional.ToDictionary(properties), serializedAdditionalRawData); + } + + AssignmentJobCreatedResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentJobCreatedResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentJobCreatedResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentJobCreatedResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentJobCreatedResource model) + { + if (model is null) + { + return null; } - return new AssignmentJobCreatedResource(id, name, type, systemData.Value, Optional.ToDictionary(properties)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentJobCreatedResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentJobCreatedResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.cs index 6ca2e140dde0..fb5dc573a6d7 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentJobCreatedResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.Blueprint.Models /// Azure resource created from deployment job. public partial class AssignmentJobCreatedResource : ResourceData { - /// Initializes a new instance of AssignmentJobCreatedResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AssignmentJobCreatedResource() { Properties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AssignmentJobCreatedResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Additional properties in a dictionary. - internal AssignmentJobCreatedResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AssignmentJobCreatedResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Additional properties in a dictionary. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.Serialization.cs index e0b06ab0dd58..9893c94d7c1d 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint; namespace Azure.ResourceManager.Blueprint.Models { - internal partial class AssignmentList + internal partial class AssignmentList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssignmentList DeserializeAssignmentList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssignmentList DeserializeAssignmentList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static AssignmentList DeserializeAssignmentList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssignmentList(Optional.ToList(value), nextLink.Value); + return new AssignmentList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AssignmentList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.cs index 3315a5aa3c10..c5750bea1d5f 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Blueprint.Models /// List of blueprint assignments. internal partial class AssignmentList { - /// Initializes a new instance of AssignmentList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AssignmentList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentList. + /// Initializes a new instance of . /// List of blueprint assignments. /// Link to the next page of results. - internal AssignmentList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AssignmentList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of blueprint assignments. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.Serialization.cs index 4cf4e2af917a..26d5844bd060 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class AssignmentLockSettings : IUtf8JsonSerializable + public partial class AssignmentLockSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Mode)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentLockSettings DeserializeAssignmentLockSettings(JsonElement element) + internal static AssignmentLockSettings DeserializeAssignmentLockSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +74,7 @@ internal static AssignmentLockSettings DeserializeAssignmentLockSettings(JsonEle Optional mode = default; Optional> excludedPrincipals = default; Optional> excludedActions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mode"u8)) @@ -92,8 +114,61 @@ internal static AssignmentLockSettings DeserializeAssignmentLockSettings(JsonEle excludedActions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssignmentLockSettings(Optional.ToNullable(mode), Optional.ToList(excludedPrincipals), Optional.ToList(excludedActions), serializedAdditionalRawData); + } + + AssignmentLockSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentLockSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentLockSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentLockSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentLockSettings model) + { + if (model is null) + { + return null; } - return new AssignmentLockSettings(Optional.ToNullable(mode), Optional.ToList(excludedPrincipals), Optional.ToList(excludedActions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentLockSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentLockSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.cs index f1bd944357bf..3793dab8cd3c 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentLockSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Blueprint.Models /// Defines how resources deployed by a blueprint assignment are locked. public partial class AssignmentLockSettings { - /// Initializes a new instance of AssignmentLockSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AssignmentLockSettings() { ExcludedPrincipals = new ChangeTrackingList(); ExcludedActions = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentLockSettings. + /// Initializes a new instance of . /// Lock mode. /// List of AAD principals excluded from blueprint locks. Up to 5 principals are permitted. /// List of management operations that are excluded from blueprint locks. Up to 200 actions are permitted. If the lock mode is set to 'AllResourcesReadOnly', then the following actions are automatically appended to 'excludedActions': '*/read', 'Microsoft.Network/virtualNetworks/subnets/join/action' and 'Microsoft.Authorization/locks/delete'. If the lock mode is set to 'AllResourcesDoNotDelete', then the following actions are automatically appended to 'excludedActions': 'Microsoft.Authorization/locks/delete'. Duplicate actions will get removed. - internal AssignmentLockSettings(AssignmentLockMode? mode, IList excludedPrincipals, IList excludedActions) + /// Keeps track of any properties unknown to the library. + internal AssignmentLockSettings(AssignmentLockMode? mode, IList excludedPrincipals, IList excludedActions, Dictionary serializedAdditionalRawData) { Mode = mode; ExcludedPrincipals = excludedPrincipals; ExcludedActions = excludedActions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Lock mode. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationData.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationData.Serialization.cs index 442bfe0d6ba5..456fcc986aaf 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationData.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint { - public partial class AssignmentOperationData : IUtf8JsonSerializable + public partial class AssignmentOperationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,16 +58,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Deployments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentOperationData DeserializeAssignmentOperationData(JsonElement element) + internal static AssignmentOperationData DeserializeAssignmentOperationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +103,7 @@ internal static AssignmentOperationData DeserializeAssignmentOperationData(JsonE Optional timeStarted = default; Optional timeFinished = default; Optional> deployments = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -152,8 +181,61 @@ internal static AssignmentOperationData DeserializeAssignmentOperationData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssignmentOperationData(id, name, type, systemData.Value, blueprintVersion.Value, assignmentState.Value, timeCreated.Value, timeStarted.Value, timeFinished.Value, Optional.ToList(deployments), serializedAdditionalRawData); + } + + AssignmentOperationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentOperationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentOperationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentOperationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentOperationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentOperationData(Response response) + { + if (response is null) + { + return null; } - return new AssignmentOperationData(id, name, type, systemData.Value, blueprintVersion.Value, assignmentState.Value, timeCreated.Value, timeStarted.Value, timeFinished.Value, Optional.ToList(deployments)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentOperationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.Serialization.cs index 78725b55b3ac..3697a6a93c9b 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint; namespace Azure.ResourceManager.Blueprint.Models { - internal partial class AssignmentOperationList + internal partial class AssignmentOperationList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssignmentOperationList DeserializeAssignmentOperationList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssignmentOperationList DeserializeAssignmentOperationList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static AssignmentOperationList DeserializeAssignmentOperationList(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssignmentOperationList(Optional.ToList(value), nextLink.Value); + return new AssignmentOperationList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AssignmentOperationList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentOperationList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentOperationList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentOperationList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentOperationList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentOperationList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentOperationList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.cs index fc4716fd151a..879b69830ef7 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentOperationList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Blueprint.Models /// List of AssignmentOperation. internal partial class AssignmentOperationList { - /// Initializes a new instance of AssignmentOperationList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AssignmentOperationList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentOperationList. + /// Initializes a new instance of . /// List of AssignmentOperation. /// Link to the next page of results. - internal AssignmentOperationList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AssignmentOperationList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AssignmentOperation. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.Serialization.cs index 4777b480050d..b851bb678b5f 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class AssignmentStatus + public partial class AssignmentStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AssignmentStatus DeserializeAssignmentStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AssignmentStatus DeserializeAssignmentStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +49,7 @@ internal static AssignmentStatus DeserializeAssignmentStatus(JsonElement element Optional> managedResources = default; Optional timeCreated = default; Optional lastModified = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedResources"u8)) @@ -57,8 +84,61 @@ internal static AssignmentStatus DeserializeAssignmentStatus(JsonElement element lastModified = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AssignmentStatus(Optional.ToNullable(timeCreated), Optional.ToNullable(lastModified), Optional.ToList(managedResources)); + return new AssignmentStatus(Optional.ToNullable(timeCreated), Optional.ToNullable(lastModified), Optional.ToList(managedResources), serializedAdditionalRawData); + } + + AssignmentStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.cs index 803f47d02ba1..e9546f0dd59e 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AssignmentStatus.cs @@ -14,17 +14,18 @@ namespace Azure.ResourceManager.Blueprint.Models /// The status of a blueprint assignment. This field is readonly. public partial class AssignmentStatus : BlueprintResourceStatusBase { - /// Initializes a new instance of AssignmentStatus. + /// Initializes a new instance of . internal AssignmentStatus() { ManagedResources = new ChangeTrackingList(); } - /// Initializes a new instance of AssignmentStatus. + /// Initializes a new instance of . /// Creation time of this blueprint definition. /// Last modified time of this blueprint definition. /// List of resources that were created by the blueprint assignment. - internal AssignmentStatus(DateTimeOffset? timeCreated, DateTimeOffset? lastModified, IReadOnlyList managedResources) : base(timeCreated, lastModified) + /// Keeps track of any properties unknown to the library. + internal AssignmentStatus(DateTimeOffset? timeCreated, DateTimeOffset? lastModified, IReadOnlyList managedResources, Dictionary serializedAdditionalRawData) : base(timeCreated, lastModified, serializedAdditionalRawData) { ManagedResources = managedResources; } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.Serialization.cs index 4bbbddd61f82..4a0dcc0bb1fe 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class AzureResourceManagerError : IUtf8JsonSerializable + public partial class AzureResourceManagerError : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AzureResourceManagerError DeserializeAzureResourceManagerError(JsonElement element) + internal static AzureResourceManagerError DeserializeAzureResourceManagerError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -48,8 +71,61 @@ internal static AzureResourceManagerError DeserializeAzureResourceManagerError(J message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureResourceManagerError(code.Value, message.Value, serializedAdditionalRawData); + } + + AzureResourceManagerError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureResourceManagerError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureResourceManagerError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureResourceManagerError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureResourceManagerError model) + { + if (model is null) + { + return null; } - return new AzureResourceManagerError(code.Value, message.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureResourceManagerError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureResourceManagerError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.cs index 600b280f0273..f15aedea2684 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/AzureResourceManagerError.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Blueprint.Models { /// Error code and message. public partial class AzureResourceManagerError { - /// Initializes a new instance of AzureResourceManagerError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AzureResourceManagerError() { } - /// Initializes a new instance of AzureResourceManagerError. + /// Initializes a new instance of . /// Error code. /// Error message. - internal AzureResourceManagerError(string code, string message) + /// Keeps track of any properties unknown to the library. + internal AzureResourceManagerError(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintData.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintData.Serialization.cs index 8f4ffd5caff8..597c83864078 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintData.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint { - public partial class BlueprintData : IUtf8JsonSerializable + public partial class BlueprintData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -54,7 +67,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in ResourceGroups) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -68,11 +88,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BlueprintData DeserializeBlueprintData(JsonElement element) + internal static BlueprintData DeserializeBlueprintData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +123,7 @@ internal static BlueprintData DeserializeBlueprintData(JsonElement element) Optional> resourceGroups = default; Optional versions = default; Optional layout = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -201,8 +236,61 @@ internal static BlueprintData DeserializeBlueprintData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BlueprintData(id, name, type, systemData.Value, displayName.Value, description.Value, status.Value, Optional.ToNullable(targetScope), Optional.ToDictionary(parameters), Optional.ToDictionary(resourceGroups), versions.Value, layout.Value); + return new BlueprintData(id, name, type, systemData.Value, displayName.Value, description.Value, status.Value, Optional.ToNullable(targetScope), Optional.ToDictionary(parameters), Optional.ToDictionary(resourceGroups), versions.Value, layout.Value, serializedAdditionalRawData); + } + + BlueprintData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBlueprintData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BlueprintData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBlueprintData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BlueprintData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BlueprintData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBlueprintData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.Serialization.cs index f70a3840b6b2..fdc94545053e 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint; namespace Azure.ResourceManager.Blueprint.Models { - internal partial class BlueprintList + internal partial class BlueprintList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BlueprintList DeserializeBlueprintList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BlueprintList DeserializeBlueprintList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static BlueprintList DeserializeBlueprintList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BlueprintList(Optional.ToList(value), nextLink.Value); + return new BlueprintList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BlueprintList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBlueprintList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BlueprintList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBlueprintList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BlueprintList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BlueprintList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBlueprintList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.cs index e59c0ceabc68..6ff52d89765a 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Blueprint.Models /// List of blueprint definitions. internal partial class BlueprintList { - /// Initializes a new instance of BlueprintList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BlueprintList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BlueprintList. + /// Initializes a new instance of . /// List of blueprint definitions. /// Link to the next page of results. - internal BlueprintList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BlueprintList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of blueprint definitions. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.Serialization.cs index 3a42e51aa226..5e7833b495c5 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class BlueprintResourceStatusBase + public partial class BlueprintResourceStatusBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BlueprintResourceStatusBase DeserializeBlueprintResourceStatusBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BlueprintResourceStatusBase DeserializeBlueprintResourceStatusBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional timeCreated = default; Optional lastModified = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timeCreated"u8)) @@ -41,8 +69,61 @@ internal static BlueprintResourceStatusBase DeserializeBlueprintResourceStatusBa lastModified = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BlueprintResourceStatusBase(Optional.ToNullable(timeCreated), Optional.ToNullable(lastModified)); + return new BlueprintResourceStatusBase(Optional.ToNullable(timeCreated), Optional.ToNullable(lastModified), serializedAdditionalRawData); + } + + BlueprintResourceStatusBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBlueprintResourceStatusBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BlueprintResourceStatusBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBlueprintResourceStatusBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BlueprintResourceStatusBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BlueprintResourceStatusBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBlueprintResourceStatusBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.cs index 3279965a9439..a2c0ba6c29c8 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintResourceStatusBase.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Blueprint.Models { /// Shared status properties between all blueprint resources. public partial class BlueprintResourceStatusBase { - /// Initializes a new instance of BlueprintResourceStatusBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BlueprintResourceStatusBase() { } - /// Initializes a new instance of BlueprintResourceStatusBase. + /// Initializes a new instance of . /// Creation time of this blueprint definition. /// Last modified time of this blueprint definition. - internal BlueprintResourceStatusBase(DateTimeOffset? timeCreated, DateTimeOffset? lastModified) + /// Keeps track of any properties unknown to the library. + internal BlueprintResourceStatusBase(DateTimeOffset? timeCreated, DateTimeOffset? lastModified, Dictionary serializedAdditionalRawData) { TimeCreated = timeCreated; LastModified = lastModified; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Creation time of this blueprint definition. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.Serialization.cs index 8c2c40eab2a6..9d524a45d0ca 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class BlueprintStatus + public partial class BlueprintStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BlueprintStatus DeserializeBlueprintStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BlueprintStatus DeserializeBlueprintStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional timeCreated = default; Optional lastModified = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timeCreated"u8)) @@ -41,8 +69,61 @@ internal static BlueprintStatus DeserializeBlueprintStatus(JsonElement element) lastModified = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BlueprintStatus(Optional.ToNullable(timeCreated), Optional.ToNullable(lastModified)); + return new BlueprintStatus(Optional.ToNullable(timeCreated), Optional.ToNullable(lastModified), serializedAdditionalRawData); + } + + BlueprintStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBlueprintStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BlueprintStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBlueprintStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BlueprintStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BlueprintStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBlueprintStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.cs index aa945e567310..3cbfeb5aadb6 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/BlueprintStatus.cs @@ -6,21 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Blueprint.Models { /// The status of the blueprint. This field is readonly. public partial class BlueprintStatus : BlueprintResourceStatusBase { - /// Initializes a new instance of BlueprintStatus. + /// Initializes a new instance of . internal BlueprintStatus() { } - /// Initializes a new instance of BlueprintStatus. + /// Initializes a new instance of . /// Creation time of this blueprint definition. /// Last modified time of this blueprint definition. - internal BlueprintStatus(DateTimeOffset? timeCreated, DateTimeOffset? lastModified) : base(timeCreated, lastModified) + /// Keeps track of any properties unknown to the library. + internal BlueprintStatus(DateTimeOffset? timeCreated, DateTimeOffset? lastModified, Dictionary serializedAdditionalRawData) : base(timeCreated, lastModified, serializedAdditionalRawData) { } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.Serialization.cs index 0d8c75c866a3..3a8ceaf70bb7 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint.Models { - public partial class ManagedServiceIdentity : IUtf8JsonSerializable + public partial class ManagedServiceIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(IdentityType.ToString()); @@ -41,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element) + internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +74,7 @@ internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonEle Optional principalId = default; Optional tenantId = default; Optional> userAssignedIdentities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -89,8 +110,61 @@ internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonEle userAssignedIdentities = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedServiceIdentity(type, principalId.Value, Optional.ToNullable(tenantId), Optional.ToDictionary(userAssignedIdentities), serializedAdditionalRawData); + } + + ManagedServiceIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedServiceIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedServiceIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedServiceIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedServiceIdentity model) + { + if (model is null) + { + return null; } - return new ManagedServiceIdentity(type, principalId.Value, Optional.ToNullable(tenantId), Optional.ToDictionary(userAssignedIdentities)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedServiceIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedServiceIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.cs index 70623ab9f2a1..4dcf62aa650a 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ManagedServiceIdentity.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Blueprint.Models /// Managed identity generic object. public partial class ManagedServiceIdentity { - /// Initializes a new instance of ManagedServiceIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the managed identity. public ManagedServiceIdentity(ManagedServiceIdentityType identityType) { @@ -23,17 +26,24 @@ public ManagedServiceIdentity(ManagedServiceIdentityType identityType) UserAssignedIdentities = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ManagedServiceIdentity. + /// Initializes a new instance of . /// Type of the managed identity. /// Azure Active Directory principal ID associated with this Identity. /// ID of the Azure Active Directory. /// The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed identity. - internal ManagedServiceIdentity(ManagedServiceIdentityType identityType, string principalId, Guid? tenantId, IDictionary userAssignedIdentities) + /// Keeps track of any properties unknown to the library. + internal ManagedServiceIdentity(ManagedServiceIdentityType identityType, string principalId, Guid? tenantId, IDictionary userAssignedIdentities, Dictionary serializedAdditionalRawData) { IdentityType = identityType; PrincipalId = principalId; TenantId = tenantId; UserAssignedIdentities = userAssignedIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedServiceIdentity() + { } /// Type of the managed identity. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.Serialization.cs index a939368ef110..e920fb751708 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class ParameterDefinition : IUtf8JsonSerializable + public partial class ParameterDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(TemplateParameterType.ToString()); @@ -65,11 +71,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StrongType); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ParameterDefinition DeserializeParameterDefinition(JsonElement element) + internal static ParameterDefinition DeserializeParameterDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -80,6 +100,7 @@ internal static ParameterDefinition DeserializeParameterDefinition(JsonElement e Optional displayName = default; Optional description = default; Optional strongType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -144,8 +165,61 @@ internal static ParameterDefinition DeserializeParameterDefinition(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ParameterDefinition(type, defaultValue.Value, Optional.ToList(allowedValues), displayName.Value, description.Value, strongType.Value); + return new ParameterDefinition(type, defaultValue.Value, Optional.ToList(allowedValues), displayName.Value, description.Value, strongType.Value, serializedAdditionalRawData); + } + + ParameterDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParameterDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParameterDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParameterDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParameterDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParameterDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParameterDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.cs index 48d1336a7118..d3d8b8ebab45 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterDefinition.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Blueprint.Models /// Represent a parameter with constrains and metadata. public partial class ParameterDefinition { - /// Initializes a new instance of ParameterDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Allowed data types for Resource Manager template parameters. public ParameterDefinition(TemplateParameterType templateParameterType) { @@ -22,14 +25,15 @@ public ParameterDefinition(TemplateParameterType templateParameterType) AllowedValues = new ChangeTrackingList(); } - /// Initializes a new instance of ParameterDefinition. + /// Initializes a new instance of . /// Allowed data types for Resource Manager template parameters. /// Default Value for this parameter. /// Array of allowed values for this parameter. /// DisplayName of this parameter/resourceGroup. /// Description of this parameter/resourceGroup. /// StrongType for UI to render rich experience during blueprint assignment. Supported strong types are resourceType, principalId and location. - internal ParameterDefinition(TemplateParameterType templateParameterType, BinaryData defaultValue, IList allowedValues, string displayName, string description, string strongType) + /// Keeps track of any properties unknown to the library. + internal ParameterDefinition(TemplateParameterType templateParameterType, BinaryData defaultValue, IList allowedValues, string displayName, string description, string strongType, Dictionary serializedAdditionalRawData) { TemplateParameterType = templateParameterType; DefaultValue = defaultValue; @@ -37,6 +41,12 @@ internal ParameterDefinition(TemplateParameterType templateParameterType, Binary DisplayName = displayName; Description = description; StrongType = strongType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ParameterDefinition() + { } /// Allowed data types for Resource Manager template parameters. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.Serialization.cs index 4efc296f1722..5d5f531f1ef5 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class ParameterValue : IUtf8JsonSerializable + public partial class ParameterValue : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Value)) { @@ -28,19 +35,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Reference)) { writer.WritePropertyName("reference"u8); - writer.WriteObjectValue(Reference); + if (Reference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Reference).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ParameterValue DeserializeParameterValue(JsonElement element) + internal static ParameterValue DeserializeParameterValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional reference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -61,8 +90,61 @@ internal static ParameterValue DeserializeParameterValue(JsonElement element) reference = SecretValueReference.DeserializeSecretValueReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ParameterValue(value.Value, reference.Value); + return new ParameterValue(value.Value, reference.Value, serializedAdditionalRawData); + } + + ParameterValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParameterValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParameterValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParameterValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParameterValue model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParameterValue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParameterValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.cs index 79e73e29ae32..14f96fcf1f98 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ParameterValue.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Blueprint.Models { /// Value for the specified parameter. Can be either 'value' or 'reference' but not both. public partial class ParameterValue { - /// Initializes a new instance of ParameterValue. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ParameterValue() { } - /// Initializes a new instance of ParameterValue. + /// Initializes a new instance of . /// Parameter value. Any valid JSON value is allowed including objects, arrays, strings, numbers and booleans. /// Parameter value as reference type. - internal ParameterValue(BinaryData value, SecretValueReference reference) + /// Keeps track of any properties unknown to the library. + internal ParameterValue(BinaryData value, SecretValueReference reference, Dictionary serializedAdditionalRawData) { Value = value; Reference = reference; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.Serialization.cs index 903c3664c39a..7c47b616e2d8 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint.Models { - public partial class PolicyAssignmentArtifact : IUtf8JsonSerializable + public partial class PolicyAssignmentArtifact : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -48,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); if (Optional.IsDefined(ResourceGroup)) @@ -57,11 +71,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ResourceGroup); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PolicyAssignmentArtifact DeserializePolicyAssignmentArtifact(JsonElement element) + internal static PolicyAssignmentArtifact DeserializePolicyAssignmentArtifact(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +105,7 @@ internal static PolicyAssignmentArtifact DeserializePolicyAssignmentArtifact(Jso string policyDefinitionId = default; IDictionary parameters = default; Optional resourceGroup = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -164,8 +193,61 @@ internal static PolicyAssignmentArtifact DeserializePolicyAssignmentArtifact(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PolicyAssignmentArtifact(id, name, type, systemData.Value, kind, displayName.Value, description.Value, Optional.ToList(dependsOn), policyDefinitionId, parameters, resourceGroup.Value, serializedAdditionalRawData); + } + + PolicyAssignmentArtifact IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolicyAssignmentArtifact(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolicyAssignmentArtifact IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolicyAssignmentArtifact(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolicyAssignmentArtifact model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolicyAssignmentArtifact(Response response) + { + if (response is null) + { + return null; } - return new PolicyAssignmentArtifact(id, name, type, systemData.Value, kind, displayName.Value, description.Value, Optional.ToList(dependsOn), policyDefinitionId, parameters, resourceGroup.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolicyAssignmentArtifact(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.cs index 0dc62b5ea3bb..584847fe5bc4 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PolicyAssignmentArtifact.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Blueprint.Models /// Blueprint artifact that applies a Policy assignment. public partial class PolicyAssignmentArtifact : ArtifactData { - /// Initializes a new instance of PolicyAssignmentArtifact. + /// Initializes a new instance of . /// Azure resource ID of the policy definition. /// Parameter values for the policy definition. /// or is null. @@ -31,7 +31,7 @@ public PolicyAssignmentArtifact(string policyDefinitionId, IDictionary Initializes a new instance of PolicyAssignmentArtifact. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +43,8 @@ public PolicyAssignmentArtifact(string policyDefinitionId, IDictionary Azure resource ID of the policy definition. /// Parameter values for the policy definition. /// Name of the resource group placeholder to which the policy will be assigned. - internal PolicyAssignmentArtifact(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, string displayName, string description, IList dependsOn, string policyDefinitionId, IDictionary parameters, string resourceGroup) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal PolicyAssignmentArtifact(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, string displayName, string description, IList dependsOn, string policyDefinitionId, IDictionary parameters, string resourceGroup, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { DisplayName = displayName; Description = description; @@ -54,6 +55,11 @@ internal PolicyAssignmentArtifact(ResourceIdentifier id, string name, ResourceTy Kind = kind; } + /// Initializes a new instance of for deserialization. + internal PolicyAssignmentArtifact() + { + } + /// One-liner string explain this resource. public string DisplayName { get; set; } /// Multi-line explain this resource. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintData.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintData.Serialization.cs index 0a48eadc87e8..38276d1e0b14 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintData.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint { - public partial class PublishedBlueprintData : IUtf8JsonSerializable + public partial class PublishedBlueprintData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -42,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -53,7 +67,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in ResourceGroups) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -68,11 +89,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ChangeNotes); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PublishedBlueprintData DeserializePublishedBlueprintData(JsonElement element) + internal static PublishedBlueprintData DeserializePublishedBlueprintData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +124,7 @@ internal static PublishedBlueprintData DeserializePublishedBlueprintData(JsonEle Optional> resourceGroups = default; Optional blueprintName = default; Optional changeNotes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -193,8 +229,61 @@ internal static PublishedBlueprintData DeserializePublishedBlueprintData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PublishedBlueprintData(id, name, type, systemData.Value, displayName.Value, description.Value, status.Value, Optional.ToNullable(targetScope), Optional.ToDictionary(parameters), Optional.ToDictionary(resourceGroups), blueprintName.Value, changeNotes.Value, serializedAdditionalRawData); + } + + PublishedBlueprintData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePublishedBlueprintData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PublishedBlueprintData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePublishedBlueprintData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PublishedBlueprintData model) + { + if (model is null) + { + return null; } - return new PublishedBlueprintData(id, name, type, systemData.Value, displayName.Value, description.Value, status.Value, Optional.ToNullable(targetScope), Optional.ToDictionary(parameters), Optional.ToDictionary(resourceGroups), blueprintName.Value, changeNotes.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PublishedBlueprintData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePublishedBlueprintData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.Serialization.cs index dbda328beb98..3462187a001a 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Blueprint; namespace Azure.ResourceManager.Blueprint.Models { - internal partial class PublishedBlueprintList + internal partial class PublishedBlueprintList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PublishedBlueprintList DeserializePublishedBlueprintList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PublishedBlueprintList DeserializePublishedBlueprintList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static PublishedBlueprintList DeserializePublishedBlueprintList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PublishedBlueprintList(Optional.ToList(value), nextLink.Value); + return new PublishedBlueprintList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PublishedBlueprintList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePublishedBlueprintList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PublishedBlueprintList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePublishedBlueprintList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PublishedBlueprintList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PublishedBlueprintList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePublishedBlueprintList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.cs index 9229becde0af..0c32ac553830 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/PublishedBlueprintList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Blueprint.Models /// List of published blueprint definitions. internal partial class PublishedBlueprintList { - /// Initializes a new instance of PublishedBlueprintList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PublishedBlueprintList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PublishedBlueprintList. + /// Initializes a new instance of . /// List of published blueprint definitions. /// Link to the next page of results. - internal PublishedBlueprintList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PublishedBlueprintList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of published blueprint definitions. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.Serialization.cs index c9d700cd04aa..d4b8fb6ee574 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class ResourceGroupDefinition : IUtf8JsonSerializable + public partial class ResourceGroupDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -65,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StrongType); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceGroupDefinition DeserializeResourceGroupDefinition(JsonElement element) + internal static ResourceGroupDefinition DeserializeResourceGroupDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +102,7 @@ internal static ResourceGroupDefinition DeserializeResourceGroupDefinition(JsonE Optional displayName = default; Optional description = default; Optional strongType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -152,8 +174,61 @@ internal static ResourceGroupDefinition DeserializeResourceGroupDefinition(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceGroupDefinition(name.Value, Optional.ToNullable(location), Optional.ToList(dependsOn), Optional.ToDictionary(tags), displayName.Value, description.Value, strongType.Value, serializedAdditionalRawData); + } + + ResourceGroupDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceGroupDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceGroupDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceGroupDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceGroupDefinition model) + { + if (model is null) + { + return null; } - return new ResourceGroupDefinition(name.Value, Optional.ToNullable(location), Optional.ToList(dependsOn), Optional.ToDictionary(tags), displayName.Value, description.Value, strongType.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceGroupDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceGroupDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.cs index ec0b3596f146..a820921701d7 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.Blueprint.Models /// Represents an Azure resource group in a blueprint definition. public partial class ResourceGroupDefinition { - /// Initializes a new instance of ResourceGroupDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourceGroupDefinition() { DependsOn = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ResourceGroupDefinition. + /// Initializes a new instance of . /// Name of this resourceGroup. Leave empty if the resource group name will be specified during the blueprint assignment. /// Location of this resourceGroup. Leave empty if the resource group location will be specified during the blueprint assignment. /// Artifacts which need to be deployed before this resource group. @@ -28,7 +32,8 @@ public ResourceGroupDefinition() /// DisplayName of this parameter/resourceGroup. /// Description of this parameter/resourceGroup. /// StrongType for UI to render rich experience during blueprint assignment. Supported strong types are resourceType, principalId and location. - internal ResourceGroupDefinition(string name, AzureLocation? location, IList dependsOn, IDictionary tags, string displayName, string description, string strongType) + /// Keeps track of any properties unknown to the library. + internal ResourceGroupDefinition(string name, AzureLocation? location, IList dependsOn, IDictionary tags, string displayName, string description, string strongType, Dictionary serializedAdditionalRawData) { Name = name; Location = location; @@ -37,6 +42,7 @@ internal ResourceGroupDefinition(string name, AzureLocation? location, IList Name of this resourceGroup. Leave empty if the resource group name will be specified during the blueprint assignment. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.Serialization.cs index 26364726fb57..1d8a4bcd0eda 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class ResourceGroupValue : IUtf8JsonSerializable + public partial class ResourceGroupValue : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceGroupValue DeserializeResourceGroupValue(JsonElement element) + internal static ResourceGroupValue DeserializeResourceGroupValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +75,61 @@ internal static ResourceGroupValue DeserializeResourceGroupValue(JsonElement ele location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceGroupValue(name.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + ResourceGroupValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceGroupValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceGroupValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceGroupValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceGroupValue model) + { + if (model is null) + { + return null; } - return new ResourceGroupValue(name.Value, Optional.ToNullable(location)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceGroupValue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceGroupValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.cs index 9b9f7268d0e0..97bd839f4ba6 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/ResourceGroupValue.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Blueprint.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Blueprint.Models /// Represents an Azure resource group. public partial class ResourceGroupValue { - /// Initializes a new instance of ResourceGroupValue. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourceGroupValue() { } - /// Initializes a new instance of ResourceGroupValue. + /// Initializes a new instance of . /// Name of the resource group. /// Location of the resource group. - internal ResourceGroupValue(string name, AzureLocation? location) + /// Keeps track of any properties unknown to the library. + internal ResourceGroupValue(string name, AzureLocation? location, Dictionary serializedAdditionalRawData) { Name = name; Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the resource group. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.Serialization.cs index 3ca9994b9f9c..d26a0bd896f1 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint.Models { - public partial class RoleAssignmentArtifact : IUtf8JsonSerializable + public partial class RoleAssignmentArtifact : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -56,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ResourceGroup); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleAssignmentArtifact DeserializeRoleAssignmentArtifact(JsonElement element) + internal static RoleAssignmentArtifact DeserializeRoleAssignmentArtifact(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -76,6 +96,7 @@ internal static RoleAssignmentArtifact DeserializeRoleAssignmentArtifact(JsonEle string roleDefinitionId = default; BinaryData principalIds = default; Optional resourceGroup = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -158,8 +179,61 @@ internal static RoleAssignmentArtifact DeserializeRoleAssignmentArtifact(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentArtifact(id, name, type, systemData.Value, kind, displayName.Value, description.Value, Optional.ToList(dependsOn), roleDefinitionId, principalIds, resourceGroup.Value); + return new RoleAssignmentArtifact(id, name, type, systemData.Value, kind, displayName.Value, description.Value, Optional.ToList(dependsOn), roleDefinitionId, principalIds, resourceGroup.Value, serializedAdditionalRawData); + } + + RoleAssignmentArtifact IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentArtifact(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentArtifact IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentArtifact(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentArtifact model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentArtifact(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentArtifact(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.cs index 141a9dd792ce..580af28fbb9e 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/RoleAssignmentArtifact.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Blueprint.Models /// Blueprint artifact that applies a Role assignment. public partial class RoleAssignmentArtifact : ArtifactData { - /// Initializes a new instance of RoleAssignmentArtifact. + /// Initializes a new instance of . /// Azure resource ID of the RoleDefinition. /// Array of user or group identities in Azure Active Directory. The roleDefinition will apply to each identity. /// or is null. @@ -31,7 +31,7 @@ public RoleAssignmentArtifact(string roleDefinitionId, BinaryData principalIds) Kind = ArtifactKind.RoleAssignment; } - /// Initializes a new instance of RoleAssignmentArtifact. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +43,8 @@ public RoleAssignmentArtifact(string roleDefinitionId, BinaryData principalIds) /// Azure resource ID of the RoleDefinition. /// Array of user or group identities in Azure Active Directory. The roleDefinition will apply to each identity. /// RoleAssignment will be scope to this resourceGroup. If empty, it scopes to the subscription. - internal RoleAssignmentArtifact(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, string displayName, string description, IList dependsOn, string roleDefinitionId, BinaryData principalIds, string resourceGroup) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentArtifact(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, string displayName, string description, IList dependsOn, string roleDefinitionId, BinaryData principalIds, string resourceGroup, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { DisplayName = displayName; Description = description; @@ -54,6 +55,11 @@ internal RoleAssignmentArtifact(ResourceIdentifier id, string name, ResourceType Kind = kind; } + /// Initializes a new instance of for deserialization. + internal RoleAssignmentArtifact() + { + } + /// One-liner string explain this resource. public string DisplayName { get; set; } /// Multi-line explain this resource. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.Serialization.cs index ea23acffeae3..b35bb5349930 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Blueprint.Models { - public partial class SecretValueReference : IUtf8JsonSerializable + public partial class SecretValueReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyVault"u8); JsonSerializer.Serialize(writer, KeyVault); writer.WritePropertyName("secretName"u8); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secretVersion"u8); writer.WriteStringValue(SecretVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecretValueReference DeserializeSecretValueReference(JsonElement element) + internal static SecretValueReference DeserializeSecretValueReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static SecretValueReference DeserializeSecretValueReference(JsonElement WritableSubResource keyVault = default; string secretName = default; Optional secretVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyVault"u8)) @@ -53,8 +76,61 @@ internal static SecretValueReference DeserializeSecretValueReference(JsonElement secretVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SecretValueReference(keyVault, secretName, secretVersion.Value, serializedAdditionalRawData); + } + + SecretValueReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecretValueReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecretValueReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecretValueReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecretValueReference model) + { + if (model is null) + { + return null; } - return new SecretValueReference(keyVault, secretName, secretVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecretValueReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecretValueReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.cs index a80d70a5c725..d317845404b2 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/SecretValueReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Blueprint.Models /// Reference to a Key Vault secret. public partial class SecretValueReference { - /// Initializes a new instance of SecretValueReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the reference to a given Azure Key Vault. /// Name of the secret. /// or is null. @@ -27,15 +31,22 @@ public SecretValueReference(WritableSubResource keyVault, string secretName) SecretName = secretName; } - /// Initializes a new instance of SecretValueReference. + /// Initializes a new instance of . /// Specifies the reference to a given Azure Key Vault. /// Name of the secret. /// The version of the secret to use. If left blank, the latest version of the secret is used. - internal SecretValueReference(WritableSubResource keyVault, string secretName, string secretVersion) + /// Keeps track of any properties unknown to the library. + internal SecretValueReference(WritableSubResource keyVault, string secretName, string secretVersion, Dictionary serializedAdditionalRawData) { KeyVault = keyVault; SecretName = secretName; SecretVersion = secretVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretValueReference() + { } /// Specifies the reference to a given Azure Key Vault. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.Serialization.cs index 31d999da0af7..ce61f77ae719 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Blueprint.Models { - public partial class TemplateArtifact : IUtf8JsonSerializable + public partial class TemplateArtifact : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -58,15 +64,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TemplateArtifact DeserializeTemplateArtifact(JsonElement element) + internal static TemplateArtifact DeserializeTemplateArtifact(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -82,6 +109,7 @@ internal static TemplateArtifact DeserializeTemplateArtifact(JsonElement element BinaryData template = default; Optional resourceGroup = default; IDictionary parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -169,8 +197,61 @@ internal static TemplateArtifact DeserializeTemplateArtifact(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TemplateArtifact(id, name, type, systemData.Value, kind, displayName.Value, description.Value, Optional.ToList(dependsOn), template, resourceGroup.Value, parameters); + return new TemplateArtifact(id, name, type, systemData.Value, kind, displayName.Value, description.Value, Optional.ToList(dependsOn), template, resourceGroup.Value, parameters, serializedAdditionalRawData); + } + + TemplateArtifact IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTemplateArtifact(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TemplateArtifact IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTemplateArtifact(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TemplateArtifact model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TemplateArtifact(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTemplateArtifact(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.cs index fb7949170844..7d128b06b141 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/TemplateArtifact.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Blueprint.Models /// Blueprint artifact that deploys a Resource Manager template. public partial class TemplateArtifact : ArtifactData { - /// Initializes a new instance of TemplateArtifact. + /// Initializes a new instance of . /// The Resource Manager template blueprint artifact body. /// Resource Manager template blueprint artifact parameter values. /// or is null. @@ -31,7 +31,7 @@ public TemplateArtifact(BinaryData template, IDictionary Kind = ArtifactKind.Template; } - /// Initializes a new instance of TemplateArtifact. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +43,8 @@ public TemplateArtifact(BinaryData template, IDictionary /// The Resource Manager template blueprint artifact body. /// If applicable, the name of the resource group placeholder to which the Resource Manager template blueprint artifact will be deployed. /// Resource Manager template blueprint artifact parameter values. - internal TemplateArtifact(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, string displayName, string description, IList dependsOn, BinaryData template, string resourceGroup, IDictionary parameters) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal TemplateArtifact(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ArtifactKind kind, string displayName, string description, IList dependsOn, BinaryData template, string resourceGroup, IDictionary parameters, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { DisplayName = displayName; Description = description; @@ -54,6 +55,11 @@ internal TemplateArtifact(ResourceIdentifier id, string name, ResourceType resou Kind = kind; } + /// Initializes a new instance of for deserialization. + internal TemplateArtifact() + { + } + /// One-liner string explain this resource. public string DisplayName { get; set; } /// Multi-line explain this resource. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.Serialization.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.Serialization.cs index 2fbf4db294f6..f1da4bae2aa2 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.Serialization.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Blueprint.Models { - public partial class WhoIsBlueprintContract + public partial class WhoIsBlueprintContract : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WhoIsBlueprintContract DeserializeWhoIsBlueprintContract(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ObjectId)) + { + writer.WritePropertyName("objectId"u8); + writer.WriteStringValue(ObjectId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WhoIsBlueprintContract DeserializeWhoIsBlueprintContract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional objectId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("objectId"u8)) @@ -26,8 +60,61 @@ internal static WhoIsBlueprintContract DeserializeWhoIsBlueprintContract(JsonEle objectId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WhoIsBlueprintContract(objectId.Value); + return new WhoIsBlueprintContract(objectId.Value, serializedAdditionalRawData); + } + + WhoIsBlueprintContract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWhoIsBlueprintContract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WhoIsBlueprintContract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWhoIsBlueprintContract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WhoIsBlueprintContract model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WhoIsBlueprintContract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWhoIsBlueprintContract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.cs index ffd8cbc245a4..3f564e9cd665 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Models/WhoIsBlueprintContract.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Blueprint.Models { /// Response schema for querying the Azure Blueprints service principal in the tenant. public partial class WhoIsBlueprintContract { - /// Initializes a new instance of WhoIsBlueprintContract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WhoIsBlueprintContract() { } - /// Initializes a new instance of WhoIsBlueprintContract. + /// Initializes a new instance of . /// AAD object Id of the Azure Blueprints service principal in the tenant. - internal WhoIsBlueprintContract(string objectId) + /// Keeps track of any properties unknown to the library. + internal WhoIsBlueprintContract(string objectId, Dictionary serializedAdditionalRawData) { ObjectId = objectId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// AAD object Id of the Azure Blueprints service principal in the tenant. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintData.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintData.cs index ddecf4e8163f..24ccea44cb4e 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintData.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Blueprint.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.Blueprint /// public partial class PublishedBlueprintData : ResourceData { - /// Initializes a new instance of PublishedBlueprintData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PublishedBlueprintData() { Parameters = new ChangeTrackingDictionary(); ResourceGroups = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PublishedBlueprintData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +42,8 @@ public PublishedBlueprintData() /// Resource group placeholders defined by this blueprint definition. /// Name of the published blueprint definition. /// Version-specific change notes. - internal PublishedBlueprintData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, BlueprintStatus status, BlueprintTargetScope? targetScope, IDictionary parameters, IDictionary resourceGroups, string blueprintName, string changeNotes) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PublishedBlueprintData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, BlueprintStatus status, BlueprintTargetScope? targetScope, IDictionary parameters, IDictionary resourceGroups, string blueprintName, string changeNotes, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; @@ -48,6 +53,7 @@ internal PublishedBlueprintData(ResourceIdentifier id, string name, ResourceType ResourceGroups = resourceGroups; BlueprintName = blueprintName; ChangeNotes = changeNotes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// One-liner string explain this resource. diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/ArtifactsRestOperations.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/ArtifactsRestOperations.cs index 6f5f73314da1..239a52edac4b 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/ArtifactsRestOperations.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/ArtifactsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceScope, string bl request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/AssignmentsRestOperations.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/AssignmentsRestOperations.cs index 66a3e0f609ad..0c3021f5e96b 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/AssignmentsRestOperations.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/AssignmentsRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceScope, string as request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/BlueprintsRestOperations.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/BlueprintsRestOperations.cs index 0731459c4fbd..f6c507ea0c89 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/BlueprintsRestOperations.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/BlueprintsRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceScope, string bl request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/PublishedBlueprintsRestOperations.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/PublishedBlueprintsRestOperations.cs index f44cb4cf1359..6387b46d3c87 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/PublishedBlueprintsRestOperations.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/RestOperations/PublishedBlueprintsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string resourceScope, string blueprintN request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/ArmBotServiceModelFactory.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/ArmBotServiceModelFactory.cs index 9332e090552e..324c33af369e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/ArmBotServiceModelFactory.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/ArmBotServiceModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.BotService.Models /// Model factory for models. public static partial class ArmBotServiceModelFactory { - /// Initializes a new instance of BotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,10 +36,10 @@ public static BotData BotData(ResourceIdentifier id = null, string name = null, tags ??= new Dictionary(); zones ??= new List(); - return new BotData(id, name, resourceType, systemData, tags, location, properties, sku, kind, etag, zones?.ToList()); + return new BotData(id, name, resourceType, systemData, tags, location, properties, sku, kind, etag, zones?.ToList(), default); } - /// Initializes a new instance of BotProperties. + /// Initializes a new instance of . /// The Name of the bot. /// The description of the bot. /// The Icon Url of the bot. @@ -85,10 +85,10 @@ public static BotProperties BotProperties(string displayName = null, string desc luisAppIds ??= new List(); privateEndpointConnections ??= new List(); - return new BotProperties(displayName, description, iconUri, endpoint, endpointVersion, allSettings, parameters, manifestUri, msaAppType, msaAppId, msaAppTenantId, msaAppMSIResourceId, configuredChannels?.ToList(), enabledChannels?.ToList(), developerAppInsightKey, developerAppInsightsApiKey, developerAppInsightsApplicationId, luisAppIds?.ToList(), luisKey, isCmekEnabled, cmekKeyVaultUri, cmekEncryptionStatus, tenantId, publicNetworkAccess, isStreamingSupported, isDeveloperAppInsightsApiKeySet, migrationToken, isLocalAuthDisabled, schemaTransformationVersion, storageResourceId, privateEndpointConnections?.ToList(), openWithHint, appPasswordHint, provisioningState, publishingCredentials); + return new BotProperties(displayName, description, iconUri, endpoint, endpointVersion, allSettings, parameters, manifestUri, msaAppType, msaAppId, msaAppTenantId, msaAppMSIResourceId, configuredChannels?.ToList(), enabledChannels?.ToList(), developerAppInsightKey, developerAppInsightsApiKey, developerAppInsightsApplicationId, luisAppIds?.ToList(), luisKey, isCmekEnabled, cmekKeyVaultUri, cmekEncryptionStatus, tenantId, publicNetworkAccess, isStreamingSupported, isDeveloperAppInsightsApiKeySet, migrationToken, isLocalAuthDisabled, schemaTransformationVersion, storageResourceId, privateEndpointConnections?.ToList(), openWithHint, appPasswordHint, provisioningState, publishingCredentials, default); } - /// Initializes a new instance of BotServicePrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -102,19 +102,19 @@ public static BotServicePrivateEndpointConnectionData BotServicePrivateEndpointC { groupIds ??= new List(); - return new BotServicePrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, groupIds?.ToList()); + return new BotServicePrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, groupIds?.ToList(), default); } - /// Initializes a new instance of BotServiceSku. + /// Initializes a new instance of . /// The sku name. /// Gets the sku tier. This is based on the SKU name. /// A new instance for mocking. public static BotServiceSku BotServiceSku(BotServiceSkuName name = default, BotServiceSkuTier? tier = null) { - return new BotServiceSku(name, tier); + return new BotServiceSku(name, tier, default); } - /// Initializes a new instance of BotChannelData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -136,10 +136,10 @@ public static BotChannelData BotChannelData(ResourceIdentifier id = null, string tags ??= new Dictionary(); zones ??= new List(); - return new BotChannelData(id, name, resourceType, systemData, tags, location, properties, sku, kind, etag, zones?.ToList()); + return new BotChannelData(id, name, resourceType, systemData, tags, location, properties, sku, kind, etag, zones?.ToList(), default); } - /// Initializes a new instance of BotChannelProperties. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. @@ -147,10 +147,10 @@ public static BotChannelData BotChannelData(ResourceIdentifier id = null, string /// A new instance for mocking. public static BotChannelProperties BotChannelProperties(string channelName = null, ETag? etag = null, string provisioningState = null, AzureLocation? location = null) { - return new UnknownChannel(channelName, etag, provisioningState, location); + return new UnknownChannel(channelName, etag, provisioningState, location, default); } - /// Initializes a new instance of BotChannelGetWithKeysResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -181,10 +181,10 @@ public static BotChannelGetWithKeysResult BotChannelGetWithKeysResult(ResourceId tags ??= new Dictionary(); zones ??= new List(); - return new BotChannelGetWithKeysResult(id, name, resourceType, systemData, tags, location, resource, setting, provisioningState, entityTag, changedTime, properties, sku, kind, etag, zones?.ToList()); + return new BotChannelGetWithKeysResult(id, name, resourceType, systemData, tags, location, resource, setting, provisioningState, entityTag, changedTime, properties, sku, kind, etag, zones?.ToList(), default); } - /// Initializes a new instance of BotChannelSite. + /// Initializes a new instance of . /// Tenant Id. /// Site Id. /// Site name. @@ -209,38 +209,38 @@ public static BotChannelSite BotChannelSite(Guid? tenantId = null, string siteId { trustedOrigins ??= new List(); - return new BotChannelSite(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins?.ToList(), isWebChatSpeechEnabled, isWebchatPreviewEnabled); + return new BotChannelSite(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins?.ToList(), isWebChatSpeechEnabled, isWebchatPreviewEnabled, default); } - /// Initializes a new instance of BotCreateEmailSignInUriResult. + /// Initializes a new instance of . /// Specifies the resource ID. /// Specifies the location of the resource. /// The set of properties specific to sign in url. /// A new instance for mocking. public static BotCreateEmailSignInUriResult BotCreateEmailSignInUriResult(ResourceIdentifier id = null, AzureLocation? location = null, Uri createEmailSignInUrlResponseUri = null) { - return new BotCreateEmailSignInUriResult(id, location, createEmailSignInUrlResponseUri != null ? new CreateEmailSignInUrlResponseProperties(createEmailSignInUrlResponseUri) : null); + return new BotCreateEmailSignInUriResult(id, location, createEmailSignInUrlResponseUri != null ? new CreateEmailSignInUrlResponseProperties(createEmailSignInUrlResponseUri, new Dictionary()) : null, default); } - /// Initializes a new instance of BotServiceNameAvailabilityResult. + /// Initializes a new instance of . /// indicates if the bot name is valid. /// additional message from the bot management api showing why a bot name is not available. /// response code from ABS. /// A new instance for mocking. public static BotServiceNameAvailabilityResult BotServiceNameAvailabilityResult(bool? isValid = null, string message = null, string absCode = null) { - return new BotServiceNameAvailabilityResult(isValid, message, absCode); + return new BotServiceNameAvailabilityResult(isValid, message, absCode, default); } - /// Initializes a new instance of BotServiceProvider. + /// Initializes a new instance of . /// The Properties of a Service Provider Object. /// A new instance for mocking. public static BotServiceProvider BotServiceProvider(BotServiceProviderProperties properties = null) { - return new BotServiceProvider(properties); + return new BotServiceProvider(properties, default); } - /// Initializes a new instance of BotServiceProviderProperties. + /// Initializes a new instance of . /// Id for Service Provider. /// Display Name of the Service Provider. /// Name of the Service Provider. @@ -252,10 +252,10 @@ public static BotServiceProviderProperties BotServiceProviderProperties(string i { parameters ??= new List(); - return new BotServiceProviderProperties(id, displayName, serviceProviderName, devPortalUri, iconUri, parameters?.ToList()); + return new BotServiceProviderProperties(id, displayName, serviceProviderName, devPortalUri, iconUri, parameters?.ToList(), default); } - /// Initializes a new instance of BotServiceProviderParameter. + /// Initializes a new instance of . /// Name of the Service Provider. /// Type of the Service Provider. /// Display Name of the Service Provider. @@ -266,10 +266,10 @@ public static BotServiceProviderProperties BotServiceProviderProperties(string i /// A new instance for mocking. public static BotServiceProviderParameter BotServiceProviderParameter(string name = null, string serviceProviderParameterType = null, string displayName = null, string description = null, Uri helpUri = null, string @default = null, bool? isRequired = null) { - return new BotServiceProviderParameter(name, serviceProviderParameterType, displayName, description, helpUri, @default, isRequired != null ? new ServiceProviderParameterMetadata(new ServiceProviderParameterMetadataConstraints(isRequired)) : null); + return new BotServiceProviderParameter(name, serviceProviderParameterType, displayName, description, helpUri, @default, isRequired != null ? new ServiceProviderParameterMetadata(new ServiceProviderParameterMetadataConstraints(isRequired, new Dictionary()), new Dictionary()) : null, default); } - /// Initializes a new instance of GetBotServiceQnAMakerEndpointKeyResult. + /// Initializes a new instance of . /// Primary Access Key. /// Secondary Access Key. /// Current version of runtime. @@ -277,10 +277,10 @@ public static BotServiceProviderParameter BotServiceProviderParameter(string nam /// A new instance for mocking. public static GetBotServiceQnAMakerEndpointKeyResult GetBotServiceQnAMakerEndpointKeyResult(string primaryEndpointKey = null, string secondaryEndpointKey = null, string installedVersion = null, string lastStableVersion = null) { - return new GetBotServiceQnAMakerEndpointKeyResult(primaryEndpointKey, secondaryEndpointKey, installedVersion, lastStableVersion); + return new GetBotServiceQnAMakerEndpointKeyResult(primaryEndpointKey, secondaryEndpointKey, installedVersion, lastStableVersion, default); } - /// Initializes a new instance of BotConnectionSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -298,10 +298,10 @@ public static BotConnectionSettingData BotConnectionSettingData(ResourceIdentifi tags ??= new Dictionary(); zones ??= new List(); - return new BotConnectionSettingData(id, name, resourceType, systemData, tags, location, properties, sku, kind, etag, zones?.ToList()); + return new BotConnectionSettingData(id, name, resourceType, systemData, tags, location, properties, sku, kind, etag, zones?.ToList(), default); } - /// Initializes a new instance of BotConnectionSettingProperties. + /// Initializes a new instance of . /// Client Id associated with the Connection Setting. /// Setting Id set by the service for the Connection Setting. /// Client Secret associated with the Connection Setting. @@ -315,10 +315,10 @@ public static BotConnectionSettingProperties BotConnectionSettingProperties(stri { parameters ??= new List(); - return new BotConnectionSettingProperties(clientId, settingId, clientSecret, scopes, serviceProviderId, serviceProviderDisplayName, parameters?.ToList(), provisioningState); + return new BotConnectionSettingProperties(clientId, settingId, clientSecret, scopes, serviceProviderId, serviceProviderDisplayName, parameters?.ToList(), provisioningState, default); } - /// Initializes a new instance of BotServiceHostSettingsResult. + /// Initializes a new instance of . /// For in-conversation bot user authentication. /// For verifying incoming tokens from the channels. /// For verifying incoming tokens from the channels. @@ -330,10 +330,10 @@ public static BotConnectionSettingProperties BotConnectionSettingProperties(stri /// A new instance for mocking. public static BotServiceHostSettingsResult BotServiceHostSettingsResult(Uri oAuthUri = null, Uri toBotFromChannelOpenIdMetadataUri = null, string toBotFromChannelTokenIssuer = null, Uri toBotFromEmulatorOpenIdMetadataUri = null, Uri toChannelFromBotLoginUri = null, string toChannelFromBotOAuthScope = null, bool? validateAuthority = null, string botOpenIdMetadata = null) { - return new BotServiceHostSettingsResult(oAuthUri, toBotFromChannelOpenIdMetadataUri, toBotFromChannelTokenIssuer, toBotFromEmulatorOpenIdMetadataUri, toChannelFromBotLoginUri, toChannelFromBotOAuthScope, validateAuthority, botOpenIdMetadata); + return new BotServiceHostSettingsResult(oAuthUri, toBotFromChannelOpenIdMetadataUri, toBotFromChannelTokenIssuer, toBotFromEmulatorOpenIdMetadataUri, toChannelFromBotLoginUri, toChannelFromBotOAuthScope, validateAuthority, botOpenIdMetadata, default); } - /// Initializes a new instance of BotServicePrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -347,10 +347,10 @@ public static BotServicePrivateLinkResourceData BotServicePrivateLinkResourceDat requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new BotServicePrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new BotServicePrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } - /// Initializes a new instance of AlexaChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -358,10 +358,10 @@ public static BotServicePrivateLinkResourceData BotServicePrivateLinkResourceDat /// A new instance for mocking. public static AlexaChannel AlexaChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, AlexaChannelProperties properties = null) { - return new AlexaChannel("AlexaChannel", etag, provisioningState, location, properties); + return new AlexaChannel("AlexaChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of AlexaChannelProperties. + /// Initializes a new instance of . /// The Alexa skill Id. /// Url fragment used in part of the Uri configured in Alexa. /// Full Uri used to configured the skill in Alexa. @@ -369,10 +369,10 @@ public static AlexaChannel AlexaChannel(ETag? etag = null, string provisioningSt /// A new instance for mocking. public static AlexaChannelProperties AlexaChannelProperties(string alexaSkillId = null, string uriFragment = null, Uri serviceEndpointUri = null, bool isEnabled = default) { - return new AlexaChannelProperties(alexaSkillId, uriFragment, serviceEndpointUri, isEnabled); + return new AlexaChannelProperties(alexaSkillId, uriFragment, serviceEndpointUri, isEnabled, default); } - /// Initializes a new instance of FacebookChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -380,10 +380,10 @@ public static AlexaChannelProperties AlexaChannelProperties(string alexaSkillId /// A new instance for mocking. public static FacebookChannel FacebookChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, FacebookChannelProperties properties = null) { - return new FacebookChannel("FacebookChannel", etag, provisioningState, location, properties); + return new FacebookChannel("FacebookChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of FacebookChannelProperties. + /// Initializes a new instance of . /// Verify token. Value only returned through POST to the action Channel List API, otherwise empty. /// The list of Facebook pages. /// Facebook application id. @@ -395,10 +395,10 @@ public static FacebookChannelProperties FacebookChannelProperties(string verifyT { pages ??= new List(); - return new FacebookChannelProperties(verifyToken, pages?.ToList(), appId, appSecret, callbackUri, isEnabled); + return new FacebookChannelProperties(verifyToken, pages?.ToList(), appId, appSecret, callbackUri, isEnabled, default); } - /// Initializes a new instance of EmailChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -406,20 +406,20 @@ public static FacebookChannelProperties FacebookChannelProperties(string verifyT /// A new instance for mocking. public static EmailChannel EmailChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, EmailChannelProperties properties = null) { - return new EmailChannel("EmailChannel", etag, provisioningState, location, properties); + return new EmailChannel("EmailChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of OutlookChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// A new instance for mocking. public static OutlookChannel OutlookChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null) { - return new OutlookChannel("OutlookChannel", etag, provisioningState, location); + return new OutlookChannel("OutlookChannel", etag, provisioningState, location, default); } - /// Initializes a new instance of MsTeamsChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -427,10 +427,10 @@ public static OutlookChannel OutlookChannel(ETag? etag = null, string provisioni /// A new instance for mocking. public static MsTeamsChannel MsTeamsChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, MsTeamsChannelProperties properties = null) { - return new MsTeamsChannel("MsTeamsChannel", etag, provisioningState, location, properties); + return new MsTeamsChannel("MsTeamsChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of SkypeChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -438,10 +438,10 @@ public static MsTeamsChannel MsTeamsChannel(ETag? etag = null, string provisioni /// A new instance for mocking. public static SkypeChannel SkypeChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, SkypeChannelProperties properties = null) { - return new SkypeChannel("SkypeChannel", etag, provisioningState, location, properties); + return new SkypeChannel("SkypeChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of KikChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -449,10 +449,10 @@ public static SkypeChannel SkypeChannel(ETag? etag = null, string provisioningSt /// A new instance for mocking. public static KikChannel KikChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, KikChannelProperties properties = null) { - return new KikChannel("KikChannel", etag, provisioningState, location, properties); + return new KikChannel("KikChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of WebChatChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -460,10 +460,10 @@ public static KikChannel KikChannel(ETag? etag = null, string provisioningState /// A new instance for mocking. public static WebChatChannel WebChatChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, WebChatChannelProperties properties = null) { - return new WebChatChannel("WebChatChannel", etag, provisioningState, location, properties); + return new WebChatChannel("WebChatChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of WebChatChannelProperties. + /// Initializes a new instance of . /// Web chat control embed code. /// The list of Web Chat sites. /// A new instance for mocking. @@ -471,10 +471,10 @@ public static WebChatChannelProperties WebChatChannelProperties(string webChatEm { sites ??= new List(); - return new WebChatChannelProperties(webChatEmbedCode, sites?.ToList()); + return new WebChatChannelProperties(webChatEmbedCode, sites?.ToList(), default); } - /// Initializes a new instance of WebChatSite. + /// Initializes a new instance of . /// Tenant Id. /// Site Id. /// Site name. @@ -499,10 +499,10 @@ public static WebChatSite WebChatSite(Guid? tenantId = null, string siteId = nul { trustedOrigins ??= new List(); - return new WebChatSite(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins?.ToList(), isWebChatSpeechEnabled, isWebchatPreviewEnabled); + return new WebChatSite(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins?.ToList(), isWebChatSpeechEnabled, isWebchatPreviewEnabled, default); } - /// Initializes a new instance of DirectLineChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -510,10 +510,10 @@ public static WebChatSite WebChatSite(Guid? tenantId = null, string siteId = nul /// A new instance for mocking. public static DirectLineChannel DirectLineChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, DirectLineChannelProperties properties = null) { - return new DirectLineChannel("DirectLineChannel", etag, provisioningState, location, properties); + return new DirectLineChannel("DirectLineChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of DirectLineSite. + /// Initializes a new instance of . /// Tenant Id. /// Site Id. /// Site name. @@ -538,10 +538,10 @@ public static DirectLineSite DirectLineSite(Guid? tenantId = null, string siteId { trustedOrigins ??= new List(); - return new DirectLineSite(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins?.ToList(), isWebChatSpeechEnabled, isWebchatPreviewEnabled); + return new DirectLineSite(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins?.ToList(), isWebChatSpeechEnabled, isWebchatPreviewEnabled, default); } - /// Initializes a new instance of TelegramChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -549,10 +549,10 @@ public static DirectLineSite DirectLineSite(Guid? tenantId = null, string siteId /// A new instance for mocking. public static TelegramChannel TelegramChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, TelegramChannelProperties properties = null) { - return new TelegramChannel("TelegramChannel", etag, provisioningState, location, properties); + return new TelegramChannel("TelegramChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of SmsChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -560,10 +560,10 @@ public static TelegramChannel TelegramChannel(ETag? etag = null, string provisio /// A new instance for mocking. public static SmsChannel SmsChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, SmsChannelProperties properties = null) { - return new SmsChannel("SmsChannel", etag, provisioningState, location, properties); + return new SmsChannel("SmsChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of SlackChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -571,10 +571,10 @@ public static SmsChannel SmsChannel(ETag? etag = null, string provisioningState /// A new instance for mocking. public static SlackChannel SlackChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, SlackChannelProperties properties = null) { - return new SlackChannel("SlackChannel", etag, provisioningState, location, properties); + return new SlackChannel("SlackChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of SlackChannelProperties. + /// Initializes a new instance of . /// The Slack client id. /// The Slack client secret. Value only returned through POST to the action Channel List API, otherwise empty. /// The Slack verification token. Value only returned through POST to the action Channel List API, otherwise empty. @@ -589,10 +589,10 @@ public static SlackChannel SlackChannel(ETag? etag = null, string provisioningSt /// A new instance for mocking. public static SlackChannelProperties SlackChannelProperties(string clientId = null, string clientSecret = null, string verificationToken = null, string scopes = null, Uri landingPageUri = null, string redirectAction = null, string lastSubmissionId = null, bool? registerBeforeOAuthFlow = null, bool? isValidated = null, string signingSecret = null, bool isEnabled = default) { - return new SlackChannelProperties(clientId, clientSecret, verificationToken, scopes, landingPageUri, redirectAction, lastSubmissionId, registerBeforeOAuthFlow, isValidated, signingSecret, isEnabled); + return new SlackChannelProperties(clientId, clientSecret, verificationToken, scopes, landingPageUri, redirectAction, lastSubmissionId, registerBeforeOAuthFlow, isValidated, signingSecret, isEnabled, default); } - /// Initializes a new instance of LineChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -600,10 +600,10 @@ public static SlackChannelProperties SlackChannelProperties(string clientId = nu /// A new instance for mocking. public static LineChannel LineChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, LineChannelProperties properties = null) { - return new LineChannel("LineChannel", etag, provisioningState, location, properties); + return new LineChannel("LineChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of LineChannelProperties. + /// Initializes a new instance of . /// The list of line channel registrations. /// Callback Url to enter in line registration. /// Whether this channel is validated for the bot. @@ -612,20 +612,20 @@ public static LineChannelProperties LineChannelProperties(IEnumerable(); - return new LineChannelProperties(lineRegistrations?.ToList(), callbackUri, isValidated); + return new LineChannelProperties(lineRegistrations?.ToList(), callbackUri, isValidated, default); } - /// Initializes a new instance of LineRegistration. + /// Initializes a new instance of . /// Id generated for the line channel registration. /// Secret for the line channel registration. /// Access token for the line channel registration. /// A new instance for mocking. public static LineRegistration LineRegistration(string generatedId = null, string channelSecret = null, string channelAccessToken = null) { - return new LineRegistration(generatedId, channelSecret, channelAccessToken); + return new LineRegistration(generatedId, channelSecret, channelAccessToken, default); } - /// Initializes a new instance of DirectLineSpeechChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -633,20 +633,20 @@ public static LineRegistration LineRegistration(string generatedId = null, strin /// A new instance for mocking. public static DirectLineSpeechChannel DirectLineSpeechChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, DirectLineSpeechChannelProperties properties = null) { - return new DirectLineSpeechChannel("DirectLineSpeechChannel", etag, provisioningState, location, properties); + return new DirectLineSpeechChannel("DirectLineSpeechChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of Omnichannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// A new instance for mocking. public static Omnichannel Omnichannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null) { - return new Omnichannel("Omnichannel", etag, provisioningState, location); + return new Omnichannel("Omnichannel", etag, provisioningState, location, default); } - /// Initializes a new instance of TelephonyChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. @@ -654,37 +654,37 @@ public static Omnichannel Omnichannel(ETag? etag = null, string provisioningStat /// A new instance for mocking. public static TelephonyChannel TelephonyChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null, TelephonyChannelProperties properties = null) { - return new TelephonyChannel("TelephonyChannel", etag, provisioningState, location, properties); + return new TelephonyChannel("TelephonyChannel", etag, provisioningState, location, properties, default); } - /// Initializes a new instance of AcsChatChannel. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// A new instance for mocking. public static AcsChatChannel AcsChatChannel(ETag? etag = null, string provisioningState = null, AzureLocation? location = null) { - return new AcsChatChannel("AcsChatChannel", etag, provisioningState, location); + return new AcsChatChannel("AcsChatChannel", etag, provisioningState, location, default); } - /// Initializes a new instance of SearchAssistant. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// A new instance for mocking. public static SearchAssistant SearchAssistant(ETag? etag = null, string provisioningState = null, AzureLocation? location = null) { - return new SearchAssistant("SearchAssistant", etag, provisioningState, location); + return new SearchAssistant("SearchAssistant", etag, provisioningState, location, default); } - /// Initializes a new instance of M365Extensions. + /// Initializes a new instance of . /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// A new instance for mocking. public static M365Extensions M365Extensions(ETag? etag = null, string provisioningState = null, AzureLocation? location = null) { - return new M365Extensions("M365Extensions", etag, provisioningState, location); + return new M365Extensions("M365Extensions", etag, provisioningState, location, default); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs index 9902bf8df84b..bde074370a19 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelCollection.cs @@ -217,7 +217,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _botChannelChannelsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _botChannelChannelsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BotChannelResource(Client, BotChannelData.DeserializeBotChannelData(e)), _botChannelChannelsClientDiagnostics, Pipeline, "BotChannelCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BotChannelResource(Client, BotChannelData.DeserializeBotChannelData(e)), _botChannelChannelsClientDiagnostics, Pipeline, "BotChannelCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -239,7 +239,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _botChannelChannelsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _botChannelChannelsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BotChannelResource(Client, BotChannelData.DeserializeBotChannelData(e)), _botChannelChannelsClientDiagnostics, Pipeline, "BotChannelCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BotChannelResource(Client, BotChannelData.DeserializeBotChannelData(e)), _botChannelChannelsClientDiagnostics, Pipeline, "BotChannelCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelData.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelData.cs index 1f8dd9a80195..de5de9e4d888 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelData.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.BotService /// public partial class BotChannelData : TrackedResourceData { - /// Initializes a new instance of BotChannelData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public BotChannelData(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of BotChannelData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,13 +46,20 @@ public BotChannelData(AzureLocation location) : base(location) /// Required. Gets or sets the Kind of the resource. /// Entity Tag. /// Entity zones. - internal BotChannelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotChannelProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal BotChannelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotChannelProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; Sku = sku; Kind = kind; ETag = etag; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotChannelData() + { } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs index 94ff7d8ed6ea..260a92396d66 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _botRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _botRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), _botClientDiagnostics, Pipeline, "BotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BotResource(Client, BotData.DeserializeBotData(e)), _botClientDiagnostics, Pipeline, "BotCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _botRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _botRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), _botClientDiagnostics, Pipeline, "BotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BotResource(Client, BotData.DeserializeBotData(e)), _botClientDiagnostics, Pipeline, "BotCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs index 72f4cf3ae6b7..82e142acf77d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _botConnectionSettingBotConnectionRestClient.CreateListByBotServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _botConnectionSettingBotConnectionRestClient.CreateListByBotServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BotConnectionSettingResource(Client, BotConnectionSettingData.DeserializeBotConnectionSettingData(e)), _botConnectionSettingBotConnectionClientDiagnostics, Pipeline, "BotConnectionSettingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BotConnectionSettingResource(Client, BotConnectionSettingData.DeserializeBotConnectionSettingData(e)), _botConnectionSettingBotConnectionClientDiagnostics, Pipeline, "BotConnectionSettingCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _botConnectionSettingBotConnectionRestClient.CreateListByBotServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _botConnectionSettingBotConnectionRestClient.CreateListByBotServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BotConnectionSettingResource(Client, BotConnectionSettingData.DeserializeBotConnectionSettingData(e)), _botConnectionSettingBotConnectionClientDiagnostics, Pipeline, "BotConnectionSettingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BotConnectionSettingResource(Client, BotConnectionSettingData.DeserializeBotConnectionSettingData(e)), _botConnectionSettingBotConnectionClientDiagnostics, Pipeline, "BotConnectionSettingCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingData.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingData.cs index 1281dbba8bf0..68bf1bce09a3 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingData.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.BotService /// public partial class BotConnectionSettingData : TrackedResourceData { - /// Initializes a new instance of BotConnectionSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public BotConnectionSettingData(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of BotConnectionSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,13 +42,20 @@ public BotConnectionSettingData(AzureLocation location) : base(location) /// Required. Gets or sets the Kind of the resource. /// Entity Tag. /// Entity zones. - internal BotConnectionSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotConnectionSettingProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal BotConnectionSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotConnectionSettingProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; Sku = sku; Kind = kind; ETag = etag; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotConnectionSettingData() + { } /// The set of properties specific to bot channel resource. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotData.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotData.cs index 4c0487a80ccc..c3143ded1a5c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotData.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.BotService /// public partial class BotData : TrackedResourceData { - /// Initializes a new instance of BotData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public BotData(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of BotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,13 +42,20 @@ public BotData(AzureLocation location) : base(location) /// Required. Gets or sets the Kind of the resource. /// Entity Tag. /// Entity zones. - internal BotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal BotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; Sku = sku; Kind = kind; ETag = etag; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotData() + { } /// The set of properties specific to bot resource. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs index 2ef5b4236fc9..8d1dea26d493 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _botServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new BotServicePrivateEndpointConnectionResource(Client, BotServicePrivateEndpointConnectionData.DeserializeBotServicePrivateEndpointConnectionData(e)), _botServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "BotServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new BotServicePrivateEndpointConnectionResource(Client, BotServicePrivateEndpointConnectionData.DeserializeBotServicePrivateEndpointConnectionData(e)), _botServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "BotServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAll public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _botServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new BotServicePrivateEndpointConnectionResource(Client, BotServicePrivateEndpointConnectionData.DeserializeBotServicePrivateEndpointConnectionData(e)), _botServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "BotServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new BotServicePrivateEndpointConnectionResource(Client, BotServicePrivateEndpointConnectionData.DeserializeBotServicePrivateEndpointConnectionData(e)), _botServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "BotServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionData.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionData.cs index 6cede218d3ed..def46d8419ad 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionData.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BotService.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.BotService /// public partial class BotServicePrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of BotServicePrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotServicePrivateEndpointConnectionData() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of BotServicePrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,12 +38,14 @@ public BotServicePrivateEndpointConnectionData() /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. /// Group ids. - internal BotServicePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, BotServicePrivateLinkServiceConnectionState connectionState, BotServicePrivateEndpointConnectionProvisioningState? provisioningState, IList groupIds) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BotServicePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, BotServicePrivateLinkServiceConnectionState connectionState, BotServicePrivateEndpointConnectionProvisioningState? provisioningState, IList groupIds, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; GroupIds = groupIds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of private end point. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 1ee03e510f37..d87a043fe22d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -75,7 +75,7 @@ public virtual AsyncPageable GetBotsAsync(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => BotRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBots", "value", "nextLink", cancellationToken); } /// @@ -97,7 +97,7 @@ public virtual Pageable GetBots(CancellationToken cancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => BotRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBots", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.Serialization.cs index 982195ecd371..ed467d5091fa 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class AcsChatChannel : IUtf8JsonSerializable + public partial class AcsChatChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AcsChatChannel DeserializeAcsChatChannel(JsonElement element) + internal static AcsChatChannel DeserializeAcsChatChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static AcsChatChannel DeserializeAcsChatChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("channelName"u8)) @@ -79,8 +101,61 @@ internal static AcsChatChannel DeserializeAcsChatChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AcsChatChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + AcsChatChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcsChatChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcsChatChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcsChatChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcsChatChannel model) + { + if (model is null) + { + return null; } - return new AcsChatChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcsChatChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcsChatChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.cs index af2fd19fff25..c7ac510a5e6a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AcsChatChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,18 +15,19 @@ namespace Azure.ResourceManager.BotService.Models /// AcsChat channel definition. public partial class AcsChatChannel : BotChannelProperties { - /// Initializes a new instance of AcsChatChannel. + /// Initializes a new instance of . public AcsChatChannel() { ChannelName = "AcsChatChannel"; } - /// Initializes a new instance of AcsChatChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal AcsChatChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal AcsChatChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { ChannelName = channelName ?? "AcsChatChannel"; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.Serialization.cs index eda289e064c7..299458e26182 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class AlexaChannel : IUtf8JsonSerializable + public partial class AlexaChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlexaChannel DeserializeAlexaChannel(JsonElement element) + internal static AlexaChannel DeserializeAlexaChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static AlexaChannel DeserializeAlexaChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static AlexaChannel DeserializeAlexaChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AlexaChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new AlexaChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + AlexaChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlexaChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlexaChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlexaChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlexaChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlexaChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlexaChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.cs index 3361dc9c3c1e..c7af717c033c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Alexa channel definition. public partial class AlexaChannel : BotChannelProperties { - /// Initializes a new instance of AlexaChannel. + /// Initializes a new instance of . public AlexaChannel() { ChannelName = "AlexaChannel"; } - /// Initializes a new instance of AlexaChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Alexa channel resource. - internal AlexaChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, AlexaChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal AlexaChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, AlexaChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "AlexaChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.Serialization.cs index b1b5436aface..5ce5ddf41691 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.Serialization.cs @@ -6,25 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class AlexaChannelProperties : IUtf8JsonSerializable + public partial class AlexaChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("alexaSkillId"u8); writer.WriteStringValue(AlexaSkillId); writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlexaChannelProperties DeserializeAlexaChannelProperties(JsonElement element) + internal static AlexaChannelProperties DeserializeAlexaChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +54,7 @@ internal static AlexaChannelProperties DeserializeAlexaChannelProperties(JsonEle Optional urlFragment = default; Optional serviceEndpointUri = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("alexaSkillId"u8)) @@ -59,8 +81,61 @@ internal static AlexaChannelProperties DeserializeAlexaChannelProperties(JsonEle isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlexaChannelProperties(alexaSkillId, urlFragment.Value, serviceEndpointUri.Value, isEnabled, serializedAdditionalRawData); + } + + AlexaChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlexaChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlexaChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlexaChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlexaChannelProperties model) + { + if (model is null) + { + return null; } - return new AlexaChannelProperties(alexaSkillId, urlFragment.Value, serviceEndpointUri.Value, isEnabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlexaChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlexaChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.cs index 453c63ef2a96..3acd643ecff2 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/AlexaChannelProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Alexa channel. public partial class AlexaChannelProperties { - /// Initializes a new instance of AlexaChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Alexa skill Id. /// Whether this channel is enabled for the bot. /// is null. @@ -25,17 +29,24 @@ public AlexaChannelProperties(string alexaSkillId, bool isEnabled) IsEnabled = isEnabled; } - /// Initializes a new instance of AlexaChannelProperties. + /// Initializes a new instance of . /// The Alexa skill Id. /// Url fragment used in part of the Uri configured in Alexa. /// Full Uri used to configured the skill in Alexa. /// Whether this channel is enabled for the bot. - internal AlexaChannelProperties(string alexaSkillId, string uriFragment, Uri serviceEndpointUri, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal AlexaChannelProperties(string alexaSkillId, string uriFragment, Uri serviceEndpointUri, bool isEnabled, Dictionary serializedAdditionalRawData) { AlexaSkillId = alexaSkillId; UriFragment = uriFragment; ServiceEndpointUri = serviceEndpointUri; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AlexaChannelProperties() + { } /// The Alexa skill Id. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelData.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelData.Serialization.cs index b68e6be6969f..2f4471899eff 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelData.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelData.Serialization.cs @@ -5,29 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BotService { - public partial class BotChannelData : IUtf8JsonSerializable + public partial class BotChannelData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Kind)) { @@ -59,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotChannelData DeserializeBotChannelData(JsonElement element) + internal static BotChannelData DeserializeBotChannelData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +113,7 @@ internal static BotChannelData DeserializeBotChannelData(JsonElement element) string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -175,8 +210,61 @@ internal static BotChannelData DeserializeBotChannelData(JsonElement element) systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotChannelData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones), serializedAdditionalRawData); + } + + BotChannelData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotChannelData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotChannelData model) + { + if (model is null) + { + return null; } - return new BotChannelData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotChannelData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotChannelData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.Serialization.cs index fabb46db70b2..e62d08fb32d8 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.Serialization.cs @@ -5,28 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BotService.Models { - public partial class BotChannelGetWithKeysResult : IUtf8JsonSerializable + public partial class BotChannelGetWithKeysResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Setting)) { writer.WritePropertyName("setting"u8); - writer.WriteObjectValue(Setting); + if (Setting is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Setting).Serialize(writer, options); + } } if (Optional.IsDefined(ProvisioningState)) { @@ -46,12 +66,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Kind)) { @@ -83,11 +117,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotChannelGetWithKeysResult DeserializeBotChannelGetWithKeysResult(JsonElement element) + internal static BotChannelGetWithKeysResult DeserializeBotChannelGetWithKeysResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -108,6 +156,7 @@ internal static BotChannelGetWithKeysResult DeserializeBotChannelGetWithKeysResu string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resource"u8)) @@ -237,8 +286,61 @@ internal static BotChannelGetWithKeysResult DeserializeBotChannelGetWithKeysResu systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotChannelGetWithKeysResult(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, setting.Value, provisioningState.Value, entityTag.Value, changedTime.Value, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones), serializedAdditionalRawData); + } + + BotChannelGetWithKeysResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotChannelGetWithKeysResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelGetWithKeysResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelGetWithKeysResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotChannelGetWithKeysResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotChannelGetWithKeysResult(Response response) + { + if (response is null) + { + return null; } - return new BotChannelGetWithKeysResult(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, setting.Value, provisioningState.Value, entityTag.Value, changedTime.Value, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotChannelGetWithKeysResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.cs index 8ff73110c59c..db1e95e2778d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelGetWithKeysResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -15,14 +16,17 @@ namespace Azure.ResourceManager.BotService.Models /// The ARM channel of list channel with keys operation response. public partial class BotChannelGetWithKeysResult : TrackedResourceData { - /// Initializes a new instance of BotChannelGetWithKeysResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public BotChannelGetWithKeysResult(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of BotChannelGetWithKeysResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +51,8 @@ public BotChannelGetWithKeysResult(AzureLocation location) : base(location) /// Required. Gets or sets the Kind of the resource. /// Entity Tag. /// Entity zones. - internal BotChannelGetWithKeysResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotChannelProperties resource, BotChannelSettings setting, string provisioningState, string entityTag, string changedTime, BotChannelProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal BotChannelGetWithKeysResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, BotChannelProperties resource, BotChannelSettings setting, string provisioningState, string entityTag, string changedTime, BotChannelProperties properties, BotServiceSku sku, BotServiceKind? kind, ETag? etag, IReadOnlyList zones, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Setting = setting; @@ -59,6 +64,12 @@ internal BotChannelGetWithKeysResult(ResourceIdentifier id, string name, Resourc Kind = kind; ETag = etag; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotChannelGetWithKeysResult() + { } /// diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.Serialization.cs index fc4cbc752f41..2e271335fd04 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotChannelProperties : IUtf8JsonSerializable + public partial class BotChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotChannelProperties DeserializeBotChannelProperties(JsonElement element) + internal static BotChannelProperties DeserializeBotChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,7 +90,99 @@ internal static BotChannelProperties DeserializeBotChannelProperties(JsonElement case "WebChatChannel": return WebChatChannel.DeserializeWebChatChannel(element); } } - return UnknownChannel.DeserializeUnknownChannel(element); + + // Unknown type found so we will deserialize the base properties only + string channelName = default; + Optional etag = default; + Optional provisioningState = default; + Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("channelName"u8)) + { + channelName = property.Value.GetString(); + continue; + } + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + etag = null; + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + BotChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotChannelProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.cs index b0c86061741a..fb460903daa5 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelProperties.cs @@ -5,8 +5,11 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { @@ -15,24 +18,30 @@ namespace Azure.ResourceManager.BotService.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , , , , , , , , , , , , , , and . /// + [DeserializationProxy(typeof(UnknownChannel))] public abstract partial class BotChannelProperties { - /// Initializes a new instance of BotChannelProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected BotChannelProperties() { } - /// Initializes a new instance of BotChannelProperties. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal BotChannelProperties(string channelName, ETag? etag, string provisioningState, AzureLocation? location) + /// Keeps track of any properties unknown to the library. + internal BotChannelProperties(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) { ChannelName = channelName; ETag = etag; ProvisioningState = provisioningState; Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The channel name. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.Serialization.cs index b53915d7ad61..47e44a6e39a7 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotChannelRegenerateKeysContent : IUtf8JsonSerializable + public partial class BotChannelRegenerateKeysContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("siteName"u8); writer.WriteStringValue(SiteName); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BotChannelRegenerateKeysContent DeserializeBotChannelRegenerateKeysContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string siteName = default; + BotServiceKey key = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("siteName"u8)) + { + siteName = property.Value.GetString(); + continue; + } + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString().ToBotServiceKey(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotChannelRegenerateKeysContent(siteName, key, serializedAdditionalRawData); + } + + BotChannelRegenerateKeysContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotChannelRegenerateKeysContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelRegenerateKeysContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelRegenerateKeysContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotChannelRegenerateKeysContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotChannelRegenerateKeysContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotChannelRegenerateKeysContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.cs index 05c92ced0aa9..fde2b86a787c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelRegenerateKeysContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.BotService.Models /// Site information for WebChat or DirectLine Channels to identify which site to regenerate keys for. public partial class BotChannelRegenerateKeysContent { - /// Initializes a new instance of BotChannelRegenerateKeysContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The site name. /// Determines which key is to be regenerated. /// is null. @@ -25,6 +29,22 @@ public BotChannelRegenerateKeysContent(string siteName, BotServiceKey key) Key = key; } + /// Initializes a new instance of . + /// The site name. + /// Determines which key is to be regenerated. + /// Keeps track of any properties unknown to the library. + internal BotChannelRegenerateKeysContent(string siteName, BotServiceKey key, Dictionary serializedAdditionalRawData) + { + SiteName = siteName; + Key = key; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotChannelRegenerateKeysContent() + { + } + /// The site name. public string SiteName { get; } /// Determines which key is to be regenerated. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.Serialization.cs index 061d68a0cf3e..0fa5ddad6670 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotChannelSettings : IUtf8JsonSerializable + public partial class BotChannelSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtensionKey1)) { @@ -33,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sites) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -72,11 +85,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("requireTermsAgreement"u8); writer.WriteBooleanValue(RequireTermsAgreement.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotChannelSettings DeserializeBotChannelSettings(JsonElement element) + internal static BotChannelSettings DeserializeBotChannelSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +118,7 @@ internal static BotChannelSettings DeserializeBotChannelSettings(JsonElement ele Optional isEnabled = default; Optional disableLocalAuth = default; Optional requireTermsAgreement = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extensionKey1"u8)) @@ -168,8 +196,61 @@ internal static BotChannelSettings DeserializeBotChannelSettings(JsonElement ele requireTermsAgreement = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotChannelSettings(extensionKey1.Value, extensionKey2.Value, Optional.ToList(sites), channelId.Value, channelDisplayName.Value, botId.Value, botIconUrl.Value, Optional.ToNullable(isEnabled), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(requireTermsAgreement), serializedAdditionalRawData); + } + + BotChannelSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotChannelSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotChannelSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotChannelSettings(Response response) + { + if (response is null) + { + return null; } - return new BotChannelSettings(extensionKey1.Value, extensionKey2.Value, Optional.ToList(sites), channelId.Value, channelDisplayName.Value, botId.Value, botIconUrl.Value, Optional.ToNullable(isEnabled), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(requireTermsAgreement)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotChannelSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.cs index 9fa40e2626de..99620aa75089 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSettings.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.BotService.Models /// Channel settings definition. public partial class BotChannelSettings { - /// Initializes a new instance of BotChannelSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotChannelSettings() { Sites = new ChangeTrackingList(); } - /// Initializes a new instance of BotChannelSettings. + /// Initializes a new instance of . /// The extensionKey1. /// The extensionKey2. /// The list of sites. @@ -31,7 +34,8 @@ public BotChannelSettings() /// Whether this channel is enabled for the bot. /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. /// Whether customer needs to agree to new terms. - internal BotChannelSettings(string extensionKey1, string extensionKey2, IList sites, string channelId, string channelDisplayName, string botId, Uri botIconUri, bool? isEnabled, bool? disableLocalAuth, bool? requireTermsAgreement) + /// Keeps track of any properties unknown to the library. + internal BotChannelSettings(string extensionKey1, string extensionKey2, IList sites, string channelId, string channelDisplayName, string botId, Uri botIconUri, bool? isEnabled, bool? disableLocalAuth, bool? requireTermsAgreement, Dictionary serializedAdditionalRawData) { ExtensionKey1 = extensionKey1; ExtensionKey2 = extensionKey2; @@ -43,6 +47,7 @@ internal BotChannelSettings(string extensionKey1, string extensionKey2, IList The extensionKey1. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.Serialization.cs index c65cad2d0989..72335d4ba87f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.Serialization.cs @@ -10,13 +10,18 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotChannelSite : IUtf8JsonSerializable + public partial class BotChannelSite : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TenantId)) { @@ -99,11 +104,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isWebchatPreviewEnabled"u8); writer.WriteBooleanValue(IsWebchatPreviewEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotChannelSite DeserializeBotChannelSite(JsonElement element) + internal static BotChannelSite DeserializeBotChannelSite(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,6 +146,7 @@ internal static BotChannelSite DeserializeBotChannelSite(JsonElement element) Optional> trustedOrigins = default; Optional isWebChatSpeechEnabled = default; Optional isWebchatPreviewEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId"u8)) @@ -282,8 +302,61 @@ internal static BotChannelSite DeserializeBotChannelSite(JsonElement element) isWebchatPreviewEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotChannelSite(Optional.ToNullable(tenantId), siteId.Value, siteName, key.Value, key2.Value, isEnabled, Optional.ToNullable(isTokenEnabled), Optional.ToNullable(isEndpointParametersEnabled), Optional.ToNullable(isDetailedLoggingEnabled), Optional.ToNullable(isBlockUserUploadEnabled), Optional.ToNullable(isNoStorageEnabled), Optional.ToNullable(eTag), appId.Value, Optional.ToNullable(isV1Enabled), Optional.ToNullable(isV3Enabled), Optional.ToNullable(isSecureSiteEnabled), Optional.ToList(trustedOrigins), Optional.ToNullable(isWebChatSpeechEnabled), Optional.ToNullable(isWebchatPreviewEnabled), serializedAdditionalRawData); + } + + BotChannelSite IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotChannelSite(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelSite IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelSite(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotChannelSite model) + { + if (model is null) + { + return null; } - return new BotChannelSite(Optional.ToNullable(tenantId), siteId.Value, siteName, key.Value, key2.Value, isEnabled, Optional.ToNullable(isTokenEnabled), Optional.ToNullable(isEndpointParametersEnabled), Optional.ToNullable(isDetailedLoggingEnabled), Optional.ToNullable(isBlockUserUploadEnabled), Optional.ToNullable(isNoStorageEnabled), Optional.ToNullable(eTag), appId.Value, Optional.ToNullable(isV1Enabled), Optional.ToNullable(isV3Enabled), Optional.ToNullable(isSecureSiteEnabled), Optional.ToList(trustedOrigins), Optional.ToNullable(isWebChatSpeechEnabled), Optional.ToNullable(isWebchatPreviewEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotChannelSite(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotChannelSite(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.cs index d2174d8fef68..a5e8778e0f9d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotChannelSite.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.BotService.Models /// A site for the channel. public partial class BotChannelSite { - /// Initializes a new instance of BotChannelSite. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Site name. /// Whether this site is enabled for DirectLine channel. /// is null. @@ -28,7 +31,7 @@ public BotChannelSite(string siteName, bool isEnabled) TrustedOrigins = new ChangeTrackingList(); } - /// Initializes a new instance of BotChannelSite. + /// Initializes a new instance of . /// Tenant Id. /// Site Id. /// Site name. @@ -48,7 +51,8 @@ public BotChannelSite(string siteName, bool isEnabled) /// List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. /// Whether this site is enabled for Webchat Speech. /// Whether this site is enabled for preview versions of Webchat. - internal BotChannelSite(Guid? tenantId, string siteId, string siteName, string key, string key2, bool isEnabled, bool? isTokenEnabled, bool? isEndpointParametersEnabled, bool? isDetailedLoggingEnabled, bool? isBlockUserUploadEnabled, bool? isNoStorageEnabled, ETag? etag, string appId, bool? isV1Enabled, bool? isV3Enabled, bool? isSecureSiteEnabled, IList trustedOrigins, bool? isWebChatSpeechEnabled, bool? isWebchatPreviewEnabled) + /// Keeps track of any properties unknown to the library. + internal BotChannelSite(Guid? tenantId, string siteId, string siteName, string key, string key2, bool isEnabled, bool? isTokenEnabled, bool? isEndpointParametersEnabled, bool? isDetailedLoggingEnabled, bool? isBlockUserUploadEnabled, bool? isNoStorageEnabled, ETag? etag, string appId, bool? isV1Enabled, bool? isV3Enabled, bool? isSecureSiteEnabled, IList trustedOrigins, bool? isWebChatSpeechEnabled, bool? isWebchatPreviewEnabled, Dictionary serializedAdditionalRawData) { TenantId = tenantId; SiteId = siteId; @@ -69,6 +73,12 @@ internal BotChannelSite(Guid? tenantId, string siteId, string siteName, string k TrustedOrigins = trustedOrigins; IsWebChatSpeechEnabled = isWebChatSpeechEnabled; IsWebchatPreviewEnabled = isWebchatPreviewEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotChannelSite() + { } /// Tenant Id. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingData.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingData.Serialization.cs index 8d443328105a..5291f53848d7 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingData.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingData.Serialization.cs @@ -5,29 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BotService { - public partial class BotConnectionSettingData : IUtf8JsonSerializable + public partial class BotConnectionSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Kind)) { @@ -59,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotConnectionSettingData DeserializeBotConnectionSettingData(JsonElement element) + internal static BotConnectionSettingData DeserializeBotConnectionSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +113,7 @@ internal static BotConnectionSettingData DeserializeBotConnectionSettingData(Jso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -175,8 +210,61 @@ internal static BotConnectionSettingData DeserializeBotConnectionSettingData(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotConnectionSettingData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones), serializedAdditionalRawData); + } + + BotConnectionSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotConnectionSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotConnectionSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotConnectionSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotConnectionSettingData model) + { + if (model is null) + { + return null; } - return new BotConnectionSettingData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotConnectionSettingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotConnectionSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.Serialization.cs index 34b3b9557bd3..416abff8f785 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotConnectionSettingParameter : IUtf8JsonSerializable + public partial class BotConnectionSettingParameter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Key)) { @@ -32,17 +40,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("value"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotConnectionSettingParameter DeserializeBotConnectionSettingParameter(JsonElement element) + internal static BotConnectionSettingParameter DeserializeBotConnectionSettingParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional key = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -60,8 +83,61 @@ internal static BotConnectionSettingParameter DeserializeBotConnectionSettingPar value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotConnectionSettingParameter(key.Value, value.Value, serializedAdditionalRawData); + } + + BotConnectionSettingParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotConnectionSettingParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotConnectionSettingParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotConnectionSettingParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotConnectionSettingParameter model) + { + if (model is null) + { + return null; } - return new BotConnectionSettingParameter(key.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotConnectionSettingParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotConnectionSettingParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.cs index 525e56f4a197..dc56abe3f7e2 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingParameter.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// Extra Parameter in a Connection Setting Properties to indicate service provider specific properties. public partial class BotConnectionSettingParameter { - /// Initializes a new instance of BotConnectionSettingParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotConnectionSettingParameter() { } - /// Initializes a new instance of BotConnectionSettingParameter. + /// Initializes a new instance of . /// Key for the Connection Setting Parameter. /// Value associated with the Connection Setting Parameter. - internal BotConnectionSettingParameter(string key, string value) + /// Keeps track of any properties unknown to the library. + internal BotConnectionSettingParameter(string key, string value, Dictionary serializedAdditionalRawData) { Key = key; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key for the Connection Setting Parameter. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.Serialization.cs index 3bc0cb2a9e24..ff2fa4ffa1fd 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotConnectionSettingProperties : IUtf8JsonSerializable + public partial class BotConnectionSettingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -47,7 +54,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -56,11 +70,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotConnectionSettingProperties DeserializeBotConnectionSettingProperties(JsonElement element) + internal static BotConnectionSettingProperties DeserializeBotConnectionSettingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +101,7 @@ internal static BotConnectionSettingProperties DeserializeBotConnectionSettingPr Optional serviceProviderDisplayName = default; Optional> parameters = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -124,8 +153,61 @@ internal static BotConnectionSettingProperties DeserializeBotConnectionSettingPr provisioningState = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotConnectionSettingProperties(clientId.Value, settingId.Value, clientSecret.Value, scopes.Value, serviceProviderId.Value, serviceProviderDisplayName.Value, Optional.ToList(parameters), provisioningState.Value, serializedAdditionalRawData); + } + + BotConnectionSettingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotConnectionSettingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotConnectionSettingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotConnectionSettingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotConnectionSettingProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotConnectionSettingProperties(Response response) + { + if (response is null) + { + return null; } - return new BotConnectionSettingProperties(clientId.Value, settingId.Value, clientSecret.Value, scopes.Value, serviceProviderId.Value, serviceProviderDisplayName.Value, Optional.ToList(parameters), provisioningState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotConnectionSettingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.cs index 73c28c940381..b33548ea9cd8 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotConnectionSettingProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.BotService.Models /// Properties for a Connection Setting Item. public partial class BotConnectionSettingProperties { - /// Initializes a new instance of BotConnectionSettingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotConnectionSettingProperties() { Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of BotConnectionSettingProperties. + /// Initializes a new instance of . /// Client Id associated with the Connection Setting. /// Setting Id set by the service for the Connection Setting. /// Client Secret associated with the Connection Setting. @@ -28,7 +32,8 @@ public BotConnectionSettingProperties() /// Service Provider Display Name associated with the Connection Setting. /// Service Provider Parameters associated with the Connection Setting. /// Provisioning state of the resource. - internal BotConnectionSettingProperties(string clientId, string settingId, string clientSecret, string scopes, string serviceProviderId, string serviceProviderDisplayName, IList parameters, string provisioningState) + /// Keeps track of any properties unknown to the library. + internal BotConnectionSettingProperties(string clientId, string settingId, string clientSecret, string scopes, string serviceProviderId, string serviceProviderDisplayName, IList parameters, string provisioningState, Dictionary serializedAdditionalRawData) { ClientId = clientId; SettingId = settingId; @@ -38,6 +43,7 @@ internal BotConnectionSettingProperties(string clientId, string settingId, strin ServiceProviderDisplayName = serviceProviderDisplayName; Parameters = parameters; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Client Id associated with the Connection Setting. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.Serialization.cs index 099a28e847e1..9af88ab7a75a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.Serialization.cs @@ -5,15 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotCreateEmailSignInUriResult + public partial class BotCreateEmailSignInUriResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotCreateEmailSignInUriResult DeserializeBotCreateEmailSignInUriResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotCreateEmailSignInUriResult DeserializeBotCreateEmailSignInUriResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +66,7 @@ internal static BotCreateEmailSignInUriResult DeserializeBotCreateEmailSignInUri Optional id = default; Optional location = default; Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -50,8 +96,61 @@ internal static BotCreateEmailSignInUriResult DeserializeBotCreateEmailSignInUri properties = CreateEmailSignInUrlResponseProperties.DeserializeCreateEmailSignInUrlResponseProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotCreateEmailSignInUriResult(id.Value, Optional.ToNullable(location), properties.Value); + return new BotCreateEmailSignInUriResult(id.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + BotCreateEmailSignInUriResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotCreateEmailSignInUriResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotCreateEmailSignInUriResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotCreateEmailSignInUriResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotCreateEmailSignInUriResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotCreateEmailSignInUriResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotCreateEmailSignInUriResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.cs index f4d08210660d..7d5a853c4a41 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotCreateEmailSignInUriResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.BotService.Models /// The ARM create email sign in url operation response. public partial class BotCreateEmailSignInUriResult { - /// Initializes a new instance of BotCreateEmailSignInUriResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotCreateEmailSignInUriResult() { } - /// Initializes a new instance of BotCreateEmailSignInUriResult. + /// Initializes a new instance of . /// Specifies the resource ID. /// Specifies the location of the resource. /// The set of properties specific to sign in url. - internal BotCreateEmailSignInUriResult(ResourceIdentifier id, AzureLocation? location, CreateEmailSignInUrlResponseProperties properties) + /// Keeps track of any properties unknown to the library. + internal BotCreateEmailSignInUriResult(ResourceIdentifier id, AzureLocation? location, CreateEmailSignInUrlResponseProperties properties, Dictionary serializedAdditionalRawData) { Id = id; Location = location; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the resource ID. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotData.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotData.Serialization.cs index 0e0dafc9f9d7..23da65eb6cdc 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotData.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotData.Serialization.cs @@ -5,29 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BotService { - public partial class BotData : IUtf8JsonSerializable + public partial class BotData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Kind)) { @@ -59,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotData DeserializeBotData(JsonElement element) + internal static BotData DeserializeBotData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +113,7 @@ internal static BotData DeserializeBotData(JsonElement element) string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -175,8 +210,61 @@ internal static BotData DeserializeBotData(JsonElement element) systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones), serializedAdditionalRawData); + } + + BotData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotData model) + { + if (model is null) + { + return null; } - return new BotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, sku.Value, Optional.ToNullable(kind), Optional.ToNullable(etag), Optional.ToList(zones)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.Serialization.cs index 12ce1760bbb6..24b64a4e28a1 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService; namespace Azure.ResourceManager.BotService.Models { - public partial class BotProperties : IUtf8JsonSerializable + public partial class BotProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); @@ -175,11 +181,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publishingCredentials"u8); writer.WriteStringValue(PublishingCredentials); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotProperties DeserializeBotProperties(JsonElement element) + internal static BotProperties DeserializeBotProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -219,6 +239,7 @@ internal static BotProperties DeserializeBotProperties(JsonElement element) Optional appPasswordHint = default; Optional provisioningState = default; Optional publishingCredentials = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayName"u8)) @@ -508,8 +529,61 @@ internal static BotProperties DeserializeBotProperties(JsonElement element) publishingCredentials = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotProperties(displayName, description.Value, iconUrl.Value, endpoint, endpointVersion.Value, Optional.ToDictionary(allSettings), Optional.ToDictionary(parameters), manifestUrl.Value, Optional.ToNullable(msaAppType), msaAppId, msaAppTenantId.Value, msaAppMSIResourceId.Value, Optional.ToList(configuredChannels), Optional.ToList(enabledChannels), developerAppInsightKey.Value, developerAppInsightsApiKey.Value, developerAppInsightsApplicationId.Value, Optional.ToList(luisAppIds), luisKey.Value, Optional.ToNullable(isCmekEnabled), cmekKeyVaultUrl.Value, cmekEncryptionStatus.Value, Optional.ToNullable(tenantId), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(isStreamingSupported), Optional.ToNullable(isDeveloperAppInsightsApiKeySet), migrationToken.Value, Optional.ToNullable(disableLocalAuth), schemaTransformationVersion.Value, storageResourceId.Value, Optional.ToList(privateEndpointConnections), openWithHint.Value, appPasswordHint.Value, provisioningState.Value, publishingCredentials.Value, serializedAdditionalRawData); + } + + BotProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotProperties model) + { + if (model is null) + { + return null; } - return new BotProperties(displayName, description.Value, iconUrl.Value, endpoint, endpointVersion.Value, Optional.ToDictionary(allSettings), Optional.ToDictionary(parameters), manifestUrl.Value, Optional.ToNullable(msaAppType), msaAppId, msaAppTenantId.Value, msaAppMSIResourceId.Value, Optional.ToList(configuredChannels), Optional.ToList(enabledChannels), developerAppInsightKey.Value, developerAppInsightsApiKey.Value, developerAppInsightsApplicationId.Value, Optional.ToList(luisAppIds), luisKey.Value, Optional.ToNullable(isCmekEnabled), cmekKeyVaultUrl.Value, cmekEncryptionStatus.Value, Optional.ToNullable(tenantId), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(isStreamingSupported), Optional.ToNullable(isDeveloperAppInsightsApiKeySet), migrationToken.Value, Optional.ToNullable(disableLocalAuth), schemaTransformationVersion.Value, storageResourceId.Value, Optional.ToList(privateEndpointConnections), openWithHint.Value, appPasswordHint.Value, provisioningState.Value, publishingCredentials.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.cs index 4d63c5428988..6c83d39ebf23 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Bot. public partial class BotProperties { - /// Initializes a new instance of BotProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Name of the bot. /// The bot's endpoint. /// Microsoft App Id for the bot. @@ -36,7 +39,7 @@ public BotProperties(string displayName, Uri endpoint, string msaAppId) PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of BotProperties. + /// Initializes a new instance of . /// The Name of the bot. /// The description of the bot. /// The Icon Url of the bot. @@ -72,7 +75,8 @@ public BotProperties(string displayName, Uri endpoint, string msaAppId) /// The hint (e.g. keyVault secret resourceId) on how to fetch the app secret. /// Provisioning state of the resource. /// Publishing credentials of the resource. - internal BotProperties(string displayName, string description, Uri iconUri, Uri endpoint, string endpointVersion, IDictionary allSettings, IDictionary parameters, Uri manifestUri, BotMsaAppType? msaAppType, string msaAppId, string msaAppTenantId, ResourceIdentifier msaAppMSIResourceId, IReadOnlyList configuredChannels, IReadOnlyList enabledChannels, string developerAppInsightKey, string developerAppInsightsApiKey, string developerAppInsightsApplicationId, IList luisAppIds, string luisKey, bool? isCmekEnabled, Uri cmekKeyVaultUri, string cmekEncryptionStatus, Guid? tenantId, BotServicePublicNetworkAccess? publicNetworkAccess, bool? isStreamingSupported, bool? isDeveloperAppInsightsApiKeySet, string migrationToken, bool? isLocalAuthDisabled, string schemaTransformationVersion, ResourceIdentifier storageResourceId, IReadOnlyList privateEndpointConnections, string openWithHint, string appPasswordHint, string provisioningState, string publishingCredentials) + /// Keeps track of any properties unknown to the library. + internal BotProperties(string displayName, string description, Uri iconUri, Uri endpoint, string endpointVersion, IDictionary allSettings, IDictionary parameters, Uri manifestUri, BotMsaAppType? msaAppType, string msaAppId, string msaAppTenantId, ResourceIdentifier msaAppMSIResourceId, IReadOnlyList configuredChannels, IReadOnlyList enabledChannels, string developerAppInsightKey, string developerAppInsightsApiKey, string developerAppInsightsApplicationId, IList luisAppIds, string luisKey, bool? isCmekEnabled, Uri cmekKeyVaultUri, string cmekEncryptionStatus, Guid? tenantId, BotServicePublicNetworkAccess? publicNetworkAccess, bool? isStreamingSupported, bool? isDeveloperAppInsightsApiKeySet, string migrationToken, bool? isLocalAuthDisabled, string schemaTransformationVersion, ResourceIdentifier storageResourceId, IReadOnlyList privateEndpointConnections, string openWithHint, string appPasswordHint, string provisioningState, string publishingCredentials, Dictionary serializedAdditionalRawData) { DisplayName = displayName; Description = description; @@ -109,6 +113,12 @@ internal BotProperties(string displayName, string description, Uri iconUri, Uri AppPasswordHint = appPasswordHint; ProvisioningState = provisioningState; PublishingCredentials = publishingCredentials; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotProperties() + { } /// The Name of the bot. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.Serialization.cs index 4464e6905af1..c1a7ff71583f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService; namespace Azure.ResourceManager.BotService.Models { - internal partial class BotResponseList + internal partial class BotResponseList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotResponseList DeserializeBotResponseList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotResponseList DeserializeBotResponseList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static BotResponseList DeserializeBotResponseList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotResponseList(nextLink.Value, Optional.ToList(value)); + return new BotResponseList(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + BotResponseList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotResponseList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotResponseList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotResponseList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotResponseList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotResponseList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotResponseList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.cs index e2f90cc045d1..bc86b9e9d5d7 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotResponseList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BotService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.BotService.Models /// The list of bot service operation response. internal partial class BotResponseList { - /// Initializes a new instance of BotResponseList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotResponseList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BotResponseList. + /// Initializes a new instance of . /// The link used to get the next page of bot service resources. /// Gets the list of bot service results and their properties. - internal BotResponseList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal BotResponseList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of bot service resources. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.Serialization.cs index 977122e744be..e6656ce9b08c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.Serialization.cs @@ -6,15 +6,82 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceHostSettingsResult + public partial class BotServiceHostSettingsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServiceHostSettingsResult DeserializeBotServiceHostSettingsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OAuthUri)) + { + writer.WritePropertyName("OAuthUrl"u8); + writer.WriteStringValue(OAuthUri.AbsoluteUri); + } + if (Optional.IsDefined(ToBotFromChannelOpenIdMetadataUri)) + { + writer.WritePropertyName("ToBotFromChannelOpenIdMetadataUrl"u8); + writer.WriteStringValue(ToBotFromChannelOpenIdMetadataUri.AbsoluteUri); + } + if (Optional.IsDefined(ToBotFromChannelTokenIssuer)) + { + writer.WritePropertyName("ToBotFromChannelTokenIssuer"u8); + writer.WriteStringValue(ToBotFromChannelTokenIssuer); + } + if (Optional.IsDefined(ToBotFromEmulatorOpenIdMetadataUri)) + { + writer.WritePropertyName("ToBotFromEmulatorOpenIdMetadataUrl"u8); + writer.WriteStringValue(ToBotFromEmulatorOpenIdMetadataUri.AbsoluteUri); + } + if (Optional.IsDefined(ToChannelFromBotLoginUri)) + { + writer.WritePropertyName("ToChannelFromBotLoginUrl"u8); + writer.WriteStringValue(ToChannelFromBotLoginUri.AbsoluteUri); + } + if (Optional.IsDefined(ToChannelFromBotOAuthScope)) + { + writer.WritePropertyName("ToChannelFromBotOAuthScope"u8); + writer.WriteStringValue(ToChannelFromBotOAuthScope); + } + if (Optional.IsDefined(ValidateAuthority)) + { + writer.WritePropertyName("ValidateAuthority"u8); + writer.WriteBooleanValue(ValidateAuthority.Value); + } + if (Optional.IsDefined(BotOpenIdMetadata)) + { + writer.WritePropertyName("BotOpenIdMetadata"u8); + writer.WriteStringValue(BotOpenIdMetadata); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServiceHostSettingsResult DeserializeBotServiceHostSettingsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +94,7 @@ internal static BotServiceHostSettingsResult DeserializeBotServiceHostSettingsRe Optional toChannelFromBotOAuthScope = default; Optional validateAuthority = default; Optional botOpenIdMetadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("OAuthUrl"u8)) @@ -89,8 +157,61 @@ internal static BotServiceHostSettingsResult DeserializeBotServiceHostSettingsRe botOpenIdMetadata = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServiceHostSettingsResult(oAuthUrl.Value, toBotFromChannelOpenIdMetadataUrl.Value, toBotFromChannelTokenIssuer.Value, toBotFromEmulatorOpenIdMetadataUrl.Value, toChannelFromBotLoginUrl.Value, toChannelFromBotOAuthScope.Value, Optional.ToNullable(validateAuthority), botOpenIdMetadata.Value); + return new BotServiceHostSettingsResult(oAuthUrl.Value, toBotFromChannelOpenIdMetadataUrl.Value, toBotFromChannelTokenIssuer.Value, toBotFromEmulatorOpenIdMetadataUrl.Value, toChannelFromBotLoginUrl.Value, toChannelFromBotOAuthScope.Value, Optional.ToNullable(validateAuthority), botOpenIdMetadata.Value, serializedAdditionalRawData); + } + + BotServiceHostSettingsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceHostSettingsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceHostSettingsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceHostSettingsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceHostSettingsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceHostSettingsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceHostSettingsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.cs index 3e5e61732eba..aeb1e78cdec4 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceHostSettingsResult.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.BotService.Models { /// The response body returned for a request to Bot Service Management to check per subscription hostSettings. public partial class BotServiceHostSettingsResult { - /// Initializes a new instance of BotServiceHostSettingsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServiceHostSettingsResult() { } - /// Initializes a new instance of BotServiceHostSettingsResult. + /// Initializes a new instance of . /// For in-conversation bot user authentication. /// For verifying incoming tokens from the channels. /// For verifying incoming tokens from the channels. @@ -26,7 +30,8 @@ internal BotServiceHostSettingsResult() /// For getting access token to channels from bot host. /// Per cloud OAuth setting on whether authority is validated. /// Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. - internal BotServiceHostSettingsResult(Uri oAuthUri, Uri toBotFromChannelOpenIdMetadataUri, string toBotFromChannelTokenIssuer, Uri toBotFromEmulatorOpenIdMetadataUri, Uri toChannelFromBotLoginUri, string toChannelFromBotOAuthScope, bool? validateAuthority, string botOpenIdMetadata) + /// Keeps track of any properties unknown to the library. + internal BotServiceHostSettingsResult(Uri oAuthUri, Uri toBotFromChannelOpenIdMetadataUri, string toBotFromChannelTokenIssuer, Uri toBotFromEmulatorOpenIdMetadataUri, Uri toChannelFromBotLoginUri, string toChannelFromBotOAuthScope, bool? validateAuthority, string botOpenIdMetadata, Dictionary serializedAdditionalRawData) { OAuthUri = oAuthUri; ToBotFromChannelOpenIdMetadataUri = toBotFromChannelOpenIdMetadataUri; @@ -36,6 +41,7 @@ internal BotServiceHostSettingsResult(Uri oAuthUri, Uri toBotFromChannelOpenIdMe ToChannelFromBotOAuthScope = toChannelFromBotOAuthScope; ValidateAuthority = validateAuthority; BotOpenIdMetadata = botOpenIdMetadata; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// For in-conversation bot user authentication. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.Serialization.cs index a8c1978df0c3..684737b1f801 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceNameAvailabilityContent : IUtf8JsonSerializable + public partial class BotServiceNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BotServiceNameAvailabilityContent DeserializeBotServiceNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotServiceNameAvailabilityContent(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + BotServiceNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.cs index 14c9559a6706..3d8e5dc98391 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.BotService.Models /// The request body for a request to Bot Service Management to check availability of a bot name. public partial class BotServiceNameAvailabilityContent { - /// Initializes a new instance of BotServiceNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotServiceNameAvailabilityContent() { } + /// Initializes a new instance of . + /// the name of the bot for which availability needs to be checked. + /// the type of the bot for which availability needs to be checked. + /// Keeps track of any properties unknown to the library. + internal BotServiceNameAvailabilityContent(string name, ResourceType? resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// the name of the bot for which availability needs to be checked. public string Name { get; set; } /// the type of the bot for which availability needs to be checked. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.Serialization.cs index 2021ccdf7e0f..54eb50f27c64 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceNameAvailabilityResult + public partial class BotServiceNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServiceNameAvailabilityResult DeserializeBotServiceNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsValid)) + { + writer.WritePropertyName("valid"u8); + writer.WriteBooleanValue(IsValid.Value); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(AbsCode)) + { + writer.WritePropertyName("absCode"u8); + writer.WriteStringValue(AbsCode); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServiceNameAvailabilityResult DeserializeBotServiceNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static BotServiceNameAvailabilityResult DeserializeBotServiceNameAvaila Optional valid = default; Optional message = default; Optional absCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("valid"u8)) @@ -42,8 +86,61 @@ internal static BotServiceNameAvailabilityResult DeserializeBotServiceNameAvaila absCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServiceNameAvailabilityResult(Optional.ToNullable(valid), message.Value, absCode.Value); + return new BotServiceNameAvailabilityResult(Optional.ToNullable(valid), message.Value, absCode.Value, serializedAdditionalRawData); + } + + BotServiceNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.cs index ef31f2670f2d..368ef8e1b947 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The response body returned for a request to Bot Service Management to check availability of a bot name. public partial class BotServiceNameAvailabilityResult { - /// Initializes a new instance of BotServiceNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServiceNameAvailabilityResult() { } - /// Initializes a new instance of BotServiceNameAvailabilityResult. + /// Initializes a new instance of . /// indicates if the bot name is valid. /// additional message from the bot management api showing why a bot name is not available. /// response code from ABS. - internal BotServiceNameAvailabilityResult(bool? isValid, string message, string absCode) + /// Keeps track of any properties unknown to the library. + internal BotServiceNameAvailabilityResult(bool? isValid, string message, string absCode, Dictionary serializedAdditionalRawData) { IsValid = isValid; Message = message; AbsCode = absCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// indicates if the bot name is valid. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionData.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionData.Serialization.cs index d5fe54ead2ad..ff9777df54f5 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionData.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.BotService { - public partial class BotServicePrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class BotServicePrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(GroupIds)) { @@ -42,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotServicePrivateEndpointConnectionData DeserializeBotServicePrivateEndpointConnectionData(JsonElement element) + internal static BotServicePrivateEndpointConnectionData DeserializeBotServicePrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +87,7 @@ internal static BotServicePrivateEndpointConnectionData DeserializeBotServicePri Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; Optional> groupIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -138,8 +167,61 @@ internal static BotServicePrivateEndpointConnectionData DeserializeBotServicePri } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotServicePrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), Optional.ToList(groupIds), serializedAdditionalRawData); + } + + BotServicePrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServicePrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServicePrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServicePrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServicePrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServicePrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new BotServicePrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), Optional.ToList(groupIds)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServicePrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.Serialization.cs index 95fb2f820a7c..ca66b58fe8da 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService; namespace Azure.ResourceManager.BotService.Models { - internal partial class BotServicePrivateEndpointConnectionListResult + internal partial class BotServicePrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServicePrivateEndpointConnectionListResult DeserializeBotServicePrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServicePrivateEndpointConnectionListResult DeserializeBotServicePrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static BotServicePrivateEndpointConnectionListResult DeserializeBotServ value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServicePrivateEndpointConnectionListResult(Optional.ToList(value)); + return new BotServicePrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + BotServicePrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServicePrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServicePrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServicePrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServicePrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServicePrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServicePrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.cs index e5918ff8b9e4..a76577997edf 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BotService; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.BotService.Models /// List of private endpoint connection associated with the specified storage account. internal partial class BotServicePrivateEndpointConnectionListResult { - /// Initializes a new instance of BotServicePrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServicePrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BotServicePrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal BotServicePrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal BotServicePrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.Serialization.cs index 06490c58a04f..1347de97002d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServicePrivateLinkResourceData : IUtf8JsonSerializable + public partial class BotServicePrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotServicePrivateLinkResourceData DeserializeBotServicePrivateLinkResourceData(JsonElement element) + internal static BotServicePrivateLinkResourceData DeserializeBotServicePrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static BotServicePrivateLinkResourceData DeserializeBotServicePrivateLi Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -117,8 +139,61 @@ internal static BotServicePrivateLinkResourceData DeserializeBotServicePrivateLi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotServicePrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + BotServicePrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServicePrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServicePrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServicePrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServicePrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new BotServicePrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServicePrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServicePrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.cs index 902cb0dbc422..99725bc0e2cd 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,14 +15,17 @@ namespace Azure.ResourceManager.BotService.Models /// A private link resource. public partial class BotServicePrivateLinkResourceData : ResourceData { - /// Initializes a new instance of BotServicePrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotServicePrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of BotServicePrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,11 +33,13 @@ public BotServicePrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. - internal BotServicePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BotServicePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.Serialization.cs index 805fe706e9f5..e5a54a46444c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - internal partial class BotServicePrivateLinkResourceListResult + internal partial class BotServicePrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServicePrivateLinkResourceListResult DeserializeBotServicePrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServicePrivateLinkResourceListResult DeserializeBotServicePrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static BotServicePrivateLinkResourceListResult DeserializeBotServicePri value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServicePrivateLinkResourceListResult(Optional.ToList(value)); + return new BotServicePrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + BotServicePrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServicePrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServicePrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServicePrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServicePrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServicePrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServicePrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.cs index 75c7588576f0..fd41e59d35d1 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.BotService.Models /// A list of private link resources. internal partial class BotServicePrivateLinkResourceListResult { - /// Initializes a new instance of BotServicePrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServicePrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BotServicePrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal BotServicePrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal BotServicePrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.Serialization.cs index d31279ef53cc..042b79756152 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServicePrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class BotServicePrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotServicePrivateLinkServiceConnectionState DeserializeBotServicePrivateLinkServiceConnectionState(JsonElement element) + internal static BotServicePrivateLinkServiceConnectionState DeserializeBotServicePrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static BotServicePrivateLinkServiceConnectionState DeserializeBotServic Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static BotServicePrivateLinkServiceConnectionState DeserializeBotServic actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotServicePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + BotServicePrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServicePrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServicePrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServicePrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServicePrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new BotServicePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServicePrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServicePrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.cs index 668e05177bd4..11a4649af6cf 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServicePrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class BotServicePrivateLinkServiceConnectionState { - /// Initializes a new instance of BotServicePrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BotServicePrivateLinkServiceConnectionState() { } - /// Initializes a new instance of BotServicePrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal BotServicePrivateLinkServiceConnectionState(BotServicePrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal BotServicePrivateLinkServiceConnectionState(BotServicePrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.Serialization.cs index 5a40cda79894..f431da73c8e6 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceProvider + public partial class BotServiceProvider : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServiceProvider DeserializeBotServiceProvider(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServiceProvider DeserializeBotServiceProvider(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -30,8 +71,61 @@ internal static BotServiceProvider DeserializeBotServiceProvider(JsonElement ele properties = BotServiceProviderProperties.DeserializeBotServiceProviderProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServiceProvider(properties.Value); + return new BotServiceProvider(properties.Value, serializedAdditionalRawData); + } + + BotServiceProvider IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceProvider(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceProvider IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceProvider(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceProvider model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceProvider(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceProvider(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.cs index 5ecd2cebf997..43d0443a460a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProvider.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// Service Provider Definition. public partial class BotServiceProvider { - /// Initializes a new instance of BotServiceProvider. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServiceProvider() { } - /// Initializes a new instance of BotServiceProvider. + /// Initializes a new instance of . /// The Properties of a Service Provider Object. - internal BotServiceProvider(BotServiceProviderProperties properties) + /// Keeps track of any properties unknown to the library. + internal BotServiceProvider(BotServiceProviderProperties properties, Dictionary serializedAdditionalRawData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Properties of a Service Provider Object. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.Serialization.cs index 6444af7ab286..37dcd9210b73 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceProviderParameter + public partial class BotServiceProviderParameter : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServiceProviderParameter DeserializeBotServiceProviderParameter(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServiceProviderParameter DeserializeBotServiceProviderParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +53,7 @@ internal static BotServiceProviderParameter DeserializeBotServiceProviderParamet Optional helpUrl = default; Optional @default = default; Optional metadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -71,8 +99,61 @@ internal static BotServiceProviderParameter DeserializeBotServiceProviderParamet metadata = ServiceProviderParameterMetadata.DeserializeServiceProviderParameterMetadata(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServiceProviderParameter(name.Value, type.Value, displayName.Value, description.Value, helpUrl.Value, @default.Value, metadata.Value); + return new BotServiceProviderParameter(name.Value, type.Value, displayName.Value, description.Value, helpUrl.Value, @default.Value, metadata.Value, serializedAdditionalRawData); + } + + BotServiceProviderParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceProviderParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceProviderParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceProviderParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceProviderParameter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceProviderParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceProviderParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.cs index 549cd39da365..a85e73dcf5bf 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderParameter.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.BotService.Models { /// Extra Parameters specific to each Service Provider. public partial class BotServiceProviderParameter { - /// Initializes a new instance of BotServiceProviderParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServiceProviderParameter() { } - /// Initializes a new instance of BotServiceProviderParameter. + /// Initializes a new instance of . /// Name of the Service Provider. /// Type of the Service Provider. /// Display Name of the Service Provider. @@ -25,7 +29,8 @@ internal BotServiceProviderParameter() /// Help Url for the Service Provider. /// Default Name for the Service Provider. /// Meta data for the Service Provider. - internal BotServiceProviderParameter(string name, string serviceProviderParameterType, string displayName, string description, Uri helpUri, string @default, ServiceProviderParameterMetadata metadata) + /// Keeps track of any properties unknown to the library. + internal BotServiceProviderParameter(string name, string serviceProviderParameterType, string displayName, string description, Uri helpUri, string @default, ServiceProviderParameterMetadata metadata, Dictionary serializedAdditionalRawData) { Name = name; ServiceProviderParameterType = serviceProviderParameterType; @@ -34,6 +39,7 @@ internal BotServiceProviderParameter(string name, string serviceProviderParamete HelpUri = helpUri; Default = @default; Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Service Provider. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.Serialization.cs index 5c23acb638e9..1e79d516c514 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.Serialization.cs @@ -8,14 +8,62 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceProviderProperties + public partial class BotServiceProviderProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BotServiceProviderProperties DeserializeBotServiceProviderProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IconUri)) + { + writer.WritePropertyName("iconUrl"u8); + writer.WriteStringValue(IconUri.AbsoluteUri); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BotServiceProviderProperties DeserializeBotServiceProviderProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +74,7 @@ internal static BotServiceProviderProperties DeserializeBotServiceProviderProper Optional devPortalUrl = default; Optional iconUrl = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -75,8 +124,61 @@ internal static BotServiceProviderProperties DeserializeBotServiceProviderProper parameters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BotServiceProviderProperties(id.Value, displayName.Value, serviceProviderName.Value, devPortalUrl.Value, iconUrl.Value, Optional.ToList(parameters)); + return new BotServiceProviderProperties(id.Value, displayName.Value, serviceProviderName.Value, devPortalUrl.Value, iconUrl.Value, Optional.ToList(parameters), serializedAdditionalRawData); + } + + BotServiceProviderProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceProviderProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceProviderProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceProviderProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceProviderProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceProviderProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceProviderProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.cs index fd1d32bd7533..6e28fc4ffee9 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceProviderProperties.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.BotService.Models /// The Object used to describe a Service Provider supported by Bot Service. public partial class BotServiceProviderProperties { - /// Initializes a new instance of BotServiceProviderProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BotServiceProviderProperties() { Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of BotServiceProviderProperties. + /// Initializes a new instance of . /// Id for Service Provider. /// Display Name of the Service Provider. /// Name of the Service Provider. /// URL of Dev Portal. /// The URL of icon. /// The list of parameters for the Service Provider. - internal BotServiceProviderProperties(string id, string displayName, string serviceProviderName, Uri devPortalUri, Uri iconUri, IReadOnlyList parameters) + /// Keeps track of any properties unknown to the library. + internal BotServiceProviderProperties(string id, string displayName, string serviceProviderName, Uri devPortalUri, Uri iconUri, IReadOnlyList parameters, Dictionary serializedAdditionalRawData) { Id = id; DisplayName = displayName; @@ -35,6 +39,7 @@ internal BotServiceProviderProperties(string id, string displayName, string serv DevPortalUri = devPortalUri; IconUri = iconUri; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id for Service Provider. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.Serialization.cs index ce40df4b6b4a..46215cdf4a7c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.Serialization.cs @@ -5,29 +5,52 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class BotServiceSku : IUtf8JsonSerializable + public partial class BotServiceSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BotServiceSku DeserializeBotServiceSku(JsonElement element) + internal static BotServiceSku DeserializeBotServiceSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } BotServiceSkuName name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -44,8 +67,61 @@ internal static BotServiceSku DeserializeBotServiceSku(JsonElement element) tier = new BotServiceSkuTier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BotServiceSku(name, Optional.ToNullable(tier), serializedAdditionalRawData); + } + + BotServiceSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBotServiceSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotServiceSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotServiceSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BotServiceSku model) + { + if (model is null) + { + return null; } - return new BotServiceSku(name, Optional.ToNullable(tier)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BotServiceSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBotServiceSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.cs index f11978682b7b..2f77128d9d2a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/BotServiceSku.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The SKU of the cognitive services account. public partial class BotServiceSku { - /// Initializes a new instance of BotServiceSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The sku name. public BotServiceSku(BotServiceSkuName name) { Name = name; } - /// Initializes a new instance of BotServiceSku. + /// Initializes a new instance of . /// The sku name. /// Gets the sku tier. This is based on the SKU name. - internal BotServiceSku(BotServiceSkuName name, BotServiceSkuTier? tier) + /// Keeps track of any properties unknown to the library. + internal BotServiceSku(BotServiceSkuName name, BotServiceSkuTier? tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BotServiceSku() + { } /// The sku name. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.Serialization.cs index ddf1c4aea5d9..6d5724be8d6c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService; namespace Azure.ResourceManager.BotService.Models { - internal partial class ChannelResponseList + internal partial class ChannelResponseList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChannelResponseList DeserializeChannelResponseList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChannelResponseList DeserializeChannelResponseList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static ChannelResponseList DeserializeChannelResponseList(JsonElement e value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChannelResponseList(nextLink.Value, Optional.ToList(value)); + return new ChannelResponseList(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ChannelResponseList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChannelResponseList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChannelResponseList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChannelResponseList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChannelResponseList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChannelResponseList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChannelResponseList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.cs index f6a2c537143b..cc9ef9e94a75 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ChannelResponseList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BotService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.BotService.Models /// The list of bot service channel operation response. internal partial class ChannelResponseList { - /// Initializes a new instance of ChannelResponseList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ChannelResponseList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ChannelResponseList. + /// Initializes a new instance of . /// The link used to get the next page of bot service channel resources. /// Gets the list of bot service channel results and their properties. - internal ChannelResponseList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ChannelResponseList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of bot service channel resources. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.Serialization.cs index d973db677d97..4fe7f73833ba 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.BotService; namespace Azure.ResourceManager.BotService.Models { - internal partial class ConnectionSettingResponseList + internal partial class ConnectionSettingResponseList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectionSettingResponseList DeserializeConnectionSettingResponseList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectionSettingResponseList DeserializeConnectionSettingResponseList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static ConnectionSettingResponseList DeserializeConnectionSettingRespon value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectionSettingResponseList(nextLink.Value, Optional.ToList(value)); + return new ConnectionSettingResponseList(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ConnectionSettingResponseList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectionSettingResponseList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectionSettingResponseList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectionSettingResponseList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectionSettingResponseList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectionSettingResponseList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectionSettingResponseList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.cs index b727f015a788..8f83972688d9 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ConnectionSettingResponseList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.BotService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.BotService.Models /// The list of bot service connection settings response. internal partial class ConnectionSettingResponseList { - /// Initializes a new instance of ConnectionSettingResponseList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectionSettingResponseList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConnectionSettingResponseList. + /// Initializes a new instance of . /// The link used to get the next page of bot service connection setting resources. /// Gets the list of bot service connection settings and their properties. - internal ConnectionSettingResponseList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ConnectionSettingResponseList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of bot service connection setting resources. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.Serialization.cs index c74585a5422a..85ae3e886d69 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.Serialization.cs @@ -6,20 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - internal partial class CreateEmailSignInUrlResponseProperties + internal partial class CreateEmailSignInUrlResponseProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CreateEmailSignInUrlResponseProperties DeserializeCreateEmailSignInUrlResponseProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CreateEmailSignInUrlResponseProperties DeserializeCreateEmailSignInUrlResponseProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional url = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("url"u8)) @@ -31,8 +64,61 @@ internal static CreateEmailSignInUrlResponseProperties DeserializeCreateEmailSig url = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CreateEmailSignInUrlResponseProperties(url.Value); + return new CreateEmailSignInUrlResponseProperties(url.Value, serializedAdditionalRawData); + } + + CreateEmailSignInUrlResponseProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateEmailSignInUrlResponseProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateEmailSignInUrlResponseProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateEmailSignInUrlResponseProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateEmailSignInUrlResponseProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateEmailSignInUrlResponseProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateEmailSignInUrlResponseProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.cs index 2e09a55df68b..ac3b05791e1e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/CreateEmailSignInUrlResponseProperties.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.BotService.Models { /// The set of properties specific to sign in url. internal partial class CreateEmailSignInUrlResponseProperties { - /// Initializes a new instance of CreateEmailSignInUrlResponseProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CreateEmailSignInUrlResponseProperties() { } - /// Initializes a new instance of CreateEmailSignInUrlResponseProperties. + /// Initializes a new instance of . /// Sign in url. - internal CreateEmailSignInUrlResponseProperties(Uri uri) + /// Keeps track of any properties unknown to the library. + internal CreateEmailSignInUrlResponseProperties(Uri uri, Dictionary serializedAdditionalRawData) { Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sign in url. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.Serialization.cs index 9f02b91029c2..a5dd0ddccb53 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class DirectLineChannel : IUtf8JsonSerializable + public partial class DirectLineChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DirectLineChannel DeserializeDirectLineChannel(JsonElement element) + internal static DirectLineChannel DeserializeDirectLineChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static DirectLineChannel DeserializeDirectLineChannel(JsonElement eleme Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static DirectLineChannel DeserializeDirectLineChannel(JsonElement eleme location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DirectLineChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new DirectLineChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + DirectLineChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDirectLineChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DirectLineChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDirectLineChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DirectLineChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DirectLineChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDirectLineChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.cs index e11652073e2c..c38d54ae8ba6 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Direct Line channel definition. public partial class DirectLineChannel : BotChannelProperties { - /// Initializes a new instance of DirectLineChannel. + /// Initializes a new instance of . public DirectLineChannel() { ChannelName = "DirectLineChannel"; } - /// Initializes a new instance of DirectLineChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Direct Line channel resource. - internal DirectLineChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, DirectLineChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal DirectLineChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, DirectLineChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "DirectLineChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.Serialization.cs index a0b6649836be..acefd3bf4f3d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class DirectLineChannelProperties : IUtf8JsonSerializable + public partial class DirectLineChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Sites)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sites) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("DirectLineEmbedCode"u8); writer.WriteStringValue(DirectLineEmbedCode); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DirectLineChannelProperties DeserializeDirectLineChannelProperties(JsonElement element) + internal static DirectLineChannelProperties DeserializeDirectLineChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static DirectLineChannelProperties DeserializeDirectLineChannelProperti Optional extensionKey1 = default; Optional extensionKey2 = default; Optional directLineEmbedCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sites"u8)) @@ -85,8 +114,61 @@ internal static DirectLineChannelProperties DeserializeDirectLineChannelProperti directLineEmbedCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DirectLineChannelProperties(Optional.ToList(sites), extensionKey1.Value, extensionKey2.Value, directLineEmbedCode.Value, serializedAdditionalRawData); + } + + DirectLineChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDirectLineChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DirectLineChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDirectLineChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DirectLineChannelProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DirectLineChannelProperties(Response response) + { + if (response is null) + { + return null; } - return new DirectLineChannelProperties(Optional.ToList(sites), extensionKey1.Value, extensionKey2.Value, directLineEmbedCode.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDirectLineChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.cs index 4716379a7193..13fcf8f15926 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineChannelProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Direct Line channel. public partial class DirectLineChannelProperties { - /// Initializes a new instance of DirectLineChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DirectLineChannelProperties() { Sites = new ChangeTrackingList(); } - /// Initializes a new instance of DirectLineChannelProperties. + /// Initializes a new instance of . /// The list of Direct Line sites. /// The extensionKey1. /// The extensionKey2. /// Direct Line embed code of the resource. - internal DirectLineChannelProperties(IList sites, string extensionKey1, string extensionKey2, string directLineEmbedCode) + /// Keeps track of any properties unknown to the library. + internal DirectLineChannelProperties(IList sites, string extensionKey1, string extensionKey2, string directLineEmbedCode, Dictionary serializedAdditionalRawData) { Sites = sites; ExtensionKey1 = extensionKey1; ExtensionKey2 = extensionKey2; DirectLineEmbedCode = directLineEmbedCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of Direct Line sites. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.Serialization.cs index 3def0b0299bc..9b32402e43a1 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.Serialization.cs @@ -10,13 +10,18 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class DirectLineSite : IUtf8JsonSerializable + public partial class DirectLineSite : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TenantId)) { @@ -99,11 +104,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isWebchatPreviewEnabled"u8); writer.WriteBooleanValue(IsWebchatPreviewEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DirectLineSite DeserializeDirectLineSite(JsonElement element) + internal static DirectLineSite DeserializeDirectLineSite(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,6 +146,7 @@ internal static DirectLineSite DeserializeDirectLineSite(JsonElement element) Optional> trustedOrigins = default; Optional isWebChatSpeechEnabled = default; Optional isWebchatPreviewEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId"u8)) @@ -282,8 +302,61 @@ internal static DirectLineSite DeserializeDirectLineSite(JsonElement element) isWebchatPreviewEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DirectLineSite(Optional.ToNullable(tenantId), siteId.Value, siteName, key.Value, key2.Value, isEnabled, Optional.ToNullable(isTokenEnabled), Optional.ToNullable(isEndpointParametersEnabled), Optional.ToNullable(isDetailedLoggingEnabled), Optional.ToNullable(isBlockUserUploadEnabled), Optional.ToNullable(isNoStorageEnabled), Optional.ToNullable(eTag), appId.Value, Optional.ToNullable(isV1Enabled), Optional.ToNullable(isV3Enabled), Optional.ToNullable(isSecureSiteEnabled), Optional.ToList(trustedOrigins), Optional.ToNullable(isWebChatSpeechEnabled), Optional.ToNullable(isWebchatPreviewEnabled), serializedAdditionalRawData); + } + + DirectLineSite IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDirectLineSite(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DirectLineSite IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDirectLineSite(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DirectLineSite model) + { + if (model is null) + { + return null; } - return new DirectLineSite(Optional.ToNullable(tenantId), siteId.Value, siteName, key.Value, key2.Value, isEnabled, Optional.ToNullable(isTokenEnabled), Optional.ToNullable(isEndpointParametersEnabled), Optional.ToNullable(isDetailedLoggingEnabled), Optional.ToNullable(isBlockUserUploadEnabled), Optional.ToNullable(isNoStorageEnabled), Optional.ToNullable(eTag), appId.Value, Optional.ToNullable(isV1Enabled), Optional.ToNullable(isV3Enabled), Optional.ToNullable(isSecureSiteEnabled), Optional.ToList(trustedOrigins), Optional.ToNullable(isWebChatSpeechEnabled), Optional.ToNullable(isWebchatPreviewEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DirectLineSite(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDirectLineSite(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.cs index b1c10efc70b8..a5760b46b3bb 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSite.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.BotService.Models /// A site for the Direct Line channel. public partial class DirectLineSite : BotChannelSite { - /// Initializes a new instance of DirectLineSite. + /// Initializes a new instance of . /// Site name. /// Whether this site is enabled for DirectLine channel. /// is null. @@ -24,7 +24,7 @@ public DirectLineSite(string siteName, bool isEnabled) : base(siteName, isEnable Argument.AssertNotNull(siteName, nameof(siteName)); } - /// Initializes a new instance of DirectLineSite. + /// Initializes a new instance of . /// Tenant Id. /// Site Id. /// Site name. @@ -44,7 +44,13 @@ public DirectLineSite(string siteName, bool isEnabled) : base(siteName, isEnable /// List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. /// Whether this site is enabled for Webchat Speech. /// Whether this site is enabled for preview versions of Webchat. - internal DirectLineSite(Guid? tenantId, string siteId, string siteName, string key, string key2, bool isEnabled, bool? isTokenEnabled, bool? isEndpointParametersEnabled, bool? isDetailedLoggingEnabled, bool? isBlockUserUploadEnabled, bool? isNoStorageEnabled, ETag? etag, string appId, bool? isV1Enabled, bool? isV3Enabled, bool? isSecureSiteEnabled, IList trustedOrigins, bool? isWebChatSpeechEnabled, bool? isWebchatPreviewEnabled) : base(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins, isWebChatSpeechEnabled, isWebchatPreviewEnabled) + /// Keeps track of any properties unknown to the library. + internal DirectLineSite(Guid? tenantId, string siteId, string siteName, string key, string key2, bool isEnabled, bool? isTokenEnabled, bool? isEndpointParametersEnabled, bool? isDetailedLoggingEnabled, bool? isBlockUserUploadEnabled, bool? isNoStorageEnabled, ETag? etag, string appId, bool? isV1Enabled, bool? isV3Enabled, bool? isSecureSiteEnabled, IList trustedOrigins, bool? isWebChatSpeechEnabled, bool? isWebchatPreviewEnabled, Dictionary serializedAdditionalRawData) : base(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins, isWebChatSpeechEnabled, isWebchatPreviewEnabled, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal DirectLineSite() { } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.Serialization.cs index acf531f7b56c..194a4998b52a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class DirectLineSpeechChannel : IUtf8JsonSerializable + public partial class DirectLineSpeechChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DirectLineSpeechChannel DeserializeDirectLineSpeechChannel(JsonElement element) + internal static DirectLineSpeechChannel DeserializeDirectLineSpeechChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static DirectLineSpeechChannel DeserializeDirectLineSpeechChannel(JsonE Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static DirectLineSpeechChannel DeserializeDirectLineSpeechChannel(JsonE location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DirectLineSpeechChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new DirectLineSpeechChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + DirectLineSpeechChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDirectLineSpeechChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DirectLineSpeechChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDirectLineSpeechChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DirectLineSpeechChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DirectLineSpeechChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDirectLineSpeechChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.cs index 5942bac04cc7..d9156bbd1e8a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// DirectLine Speech channel definition. public partial class DirectLineSpeechChannel : BotChannelProperties { - /// Initializes a new instance of DirectLineSpeechChannel. + /// Initializes a new instance of . public DirectLineSpeechChannel() { ChannelName = "DirectLineSpeechChannel"; } - /// Initializes a new instance of DirectLineSpeechChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to DirectLine Speech channel resource. - internal DirectLineSpeechChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, DirectLineSpeechChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal DirectLineSpeechChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, DirectLineSpeechChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "DirectLineSpeechChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.Serialization.cs index 894e7efd9351..967d1cd2b53a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class DirectLineSpeechChannelProperties : IUtf8JsonSerializable + public partial class DirectLineSpeechChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CognitiveServiceResourceId)) { @@ -64,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isDefaultBotForCogSvcAccount"u8); writer.WriteBooleanValue(IsDefaultBotForCogSvcAccount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DirectLineSpeechChannelProperties DeserializeDirectLineSpeechChannelProperties(JsonElement element) + internal static DirectLineSpeechChannelProperties DeserializeDirectLineSpeechChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -80,6 +102,7 @@ internal static DirectLineSpeechChannelProperties DeserializeDirectLineSpeechCha Optional customVoiceDeploymentId = default; Optional customSpeechModelId = default; Optional isDefaultBotForCogSvcAccount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cognitiveServiceResourceId"u8)) @@ -139,8 +162,61 @@ internal static DirectLineSpeechChannelProperties DeserializeDirectLineSpeechCha isDefaultBotForCogSvcAccount = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DirectLineSpeechChannelProperties(cognitiveServiceResourceId.Value, cognitiveServiceRegion.Value, cognitiveServiceSubscriptionKey.Value, Optional.ToNullable(isEnabled), customVoiceDeploymentId.Value, customSpeechModelId.Value, Optional.ToNullable(isDefaultBotForCogSvcAccount), serializedAdditionalRawData); + } + + DirectLineSpeechChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDirectLineSpeechChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DirectLineSpeechChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDirectLineSpeechChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DirectLineSpeechChannelProperties model) + { + if (model is null) + { + return null; } - return new DirectLineSpeechChannelProperties(cognitiveServiceResourceId.Value, cognitiveServiceRegion.Value, cognitiveServiceSubscriptionKey.Value, Optional.ToNullable(isEnabled), customVoiceDeploymentId.Value, customSpeechModelId.Value, Optional.ToNullable(isDefaultBotForCogSvcAccount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DirectLineSpeechChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDirectLineSpeechChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs index 7a17c8152cb4..f055cbcefa4f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -12,12 +14,15 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the DirectLine Speech channel. public partial class DirectLineSpeechChannelProperties { - /// Initializes a new instance of DirectLineSpeechChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DirectLineSpeechChannelProperties() { } - /// Initializes a new instance of DirectLineSpeechChannelProperties. + /// Initializes a new instance of . /// The cognitive service id with this channel registration. /// The cognitive service region with this channel registration. /// The cognitive service subscription key to use with this channel registration. @@ -25,7 +30,8 @@ public DirectLineSpeechChannelProperties() /// Custom speech model id (optional). /// Custom voice deployment id (optional). /// Make this a default bot for chosen cognitive service account. - internal DirectLineSpeechChannelProperties(ResourceIdentifier cognitiveServiceResourceId, string cognitiveServiceRegion, string cognitiveServiceSubscriptionKey, bool? isEnabled, string customVoiceDeploymentId, string customSpeechModelId, bool? isDefaultBotForCogSvcAccount) + /// Keeps track of any properties unknown to the library. + internal DirectLineSpeechChannelProperties(ResourceIdentifier cognitiveServiceResourceId, string cognitiveServiceRegion, string cognitiveServiceSubscriptionKey, bool? isEnabled, string customVoiceDeploymentId, string customSpeechModelId, bool? isDefaultBotForCogSvcAccount, Dictionary serializedAdditionalRawData) { CognitiveServiceResourceId = cognitiveServiceResourceId; CognitiveServiceRegion = cognitiveServiceRegion; @@ -34,6 +40,7 @@ internal DirectLineSpeechChannelProperties(ResourceIdentifier cognitiveServiceRe CustomVoiceDeploymentId = customVoiceDeploymentId; CustomSpeechModelId = customSpeechModelId; IsDefaultBotForCogSvcAccount = isDefaultBotForCogSvcAccount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The cognitive service id with this channel registration. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.Serialization.cs index ac09af2eeb48..b5c000659e8c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class EmailChannel : IUtf8JsonSerializable + public partial class EmailChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EmailChannel DeserializeEmailChannel(JsonElement element) + internal static EmailChannel DeserializeEmailChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static EmailChannel DeserializeEmailChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static EmailChannel DeserializeEmailChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EmailChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new EmailChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + EmailChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.cs index 39c8be8c158a..2b2d7c705521 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/EmailChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Email channel definition. public partial class EmailChannel : BotChannelProperties { - /// Initializes a new instance of EmailChannel. + /// Initializes a new instance of . public EmailChannel() { ChannelName = "EmailChannel"; } - /// Initializes a new instance of EmailChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to email channel resource. - internal EmailChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, EmailChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal EmailChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, EmailChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "EmailChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.Serialization.cs index d576ac243c61..81aa4a5f1516 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class FacebookChannel : IUtf8JsonSerializable + public partial class FacebookChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FacebookChannel DeserializeFacebookChannel(JsonElement element) + internal static FacebookChannel DeserializeFacebookChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static FacebookChannel DeserializeFacebookChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static FacebookChannel DeserializeFacebookChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FacebookChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new FacebookChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + FacebookChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFacebookChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FacebookChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFacebookChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FacebookChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FacebookChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFacebookChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.cs index 0077e5640cd6..ac6f2a2c5b9f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Facebook channel definition. public partial class FacebookChannel : BotChannelProperties { - /// Initializes a new instance of FacebookChannel. + /// Initializes a new instance of . public FacebookChannel() { ChannelName = "FacebookChannel"; } - /// Initializes a new instance of FacebookChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to bot facebook channel. - internal FacebookChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, FacebookChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal FacebookChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, FacebookChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "FacebookChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.Serialization.cs index 183f6802d520..954dabd9cbd4 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class FacebookChannelProperties : IUtf8JsonSerializable + public partial class FacebookChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Pages)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -36,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FacebookChannelProperties DeserializeFacebookChannelProperties(JsonElement element) + internal static FacebookChannelProperties DeserializeFacebookChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +78,7 @@ internal static FacebookChannelProperties DeserializeFacebookChannelProperties(J Optional appSecret = default; Optional callbackUrl = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("verifyToken"u8)) @@ -96,8 +124,61 @@ internal static FacebookChannelProperties DeserializeFacebookChannelProperties(J isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FacebookChannelProperties(verifyToken.Value, Optional.ToList(pages), appId, appSecret.Value, callbackUrl.Value, isEnabled, serializedAdditionalRawData); + } + + FacebookChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFacebookChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FacebookChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFacebookChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FacebookChannelProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FacebookChannelProperties(Response response) + { + if (response is null) + { + return null; } - return new FacebookChannelProperties(verifyToken.Value, Optional.ToList(pages), appId, appSecret.Value, callbackUrl.Value, isEnabled); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFacebookChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.cs index d015ed745631..09457b54dd1b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookChannelProperties.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Facebook channel. public partial class FacebookChannelProperties { - /// Initializes a new instance of FacebookChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Facebook application id. /// Whether this channel is enabled for the bot. /// is null. @@ -27,14 +30,15 @@ public FacebookChannelProperties(string appId, bool isEnabled) IsEnabled = isEnabled; } - /// Initializes a new instance of FacebookChannelProperties. + /// Initializes a new instance of . /// Verify token. Value only returned through POST to the action Channel List API, otherwise empty. /// The list of Facebook pages. /// Facebook application id. /// Facebook application secret. Value only returned through POST to the action Channel List API, otherwise empty. /// Callback Url. /// Whether this channel is enabled for the bot. - internal FacebookChannelProperties(string verifyToken, IList pages, string appId, string appSecret, Uri callbackUri, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal FacebookChannelProperties(string verifyToken, IList pages, string appId, string appSecret, Uri callbackUri, bool isEnabled, Dictionary serializedAdditionalRawData) { VerifyToken = verifyToken; Pages = pages; @@ -42,6 +46,12 @@ internal FacebookChannelProperties(string verifyToken, IList pages AppSecret = appSecret; CallbackUri = callbackUri; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FacebookChannelProperties() + { } /// Verify token. Value only returned through POST to the action Channel List API, otherwise empty. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.Serialization.cs index 4f0c69c7db40..f2b85fa1719b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class FacebookPage : IUtf8JsonSerializable + public partial class FacebookPage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("accessToken"u8); writer.WriteStringValue(AccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FacebookPage DeserializeFacebookPage(JsonElement element) + internal static FacebookPage DeserializeFacebookPage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; Optional accessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -45,8 +68,61 @@ internal static FacebookPage DeserializeFacebookPage(JsonElement element) accessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FacebookPage(id, accessToken.Value, serializedAdditionalRawData); + } + + FacebookPage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFacebookPage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FacebookPage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFacebookPage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FacebookPage model) + { + if (model is null) + { + return null; } - return new FacebookPage(id, accessToken.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FacebookPage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFacebookPage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.cs index db49b396d1e3..f30495e1761f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/FacebookPage.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.BotService.Models /// A Facebook page for Facebook channel registration. public partial class FacebookPage { - /// Initializes a new instance of FacebookPage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Page id. /// is null. public FacebookPage(string id) @@ -23,13 +27,20 @@ public FacebookPage(string id) Id = id; } - /// Initializes a new instance of FacebookPage. + /// Initializes a new instance of . /// Page id. /// Facebook application access token. Value only returned through POST to the action Channel List API, otherwise empty. - internal FacebookPage(string id, string accessToken) + /// Keeps track of any properties unknown to the library. + internal FacebookPage(string id, string accessToken, Dictionary serializedAdditionalRawData) { Id = id; AccessToken = accessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FacebookPage() + { } /// Page id. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.Serialization.cs index f0b4c133ea53..48ce35eb1eb5 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class GetBotServiceQnAMakerEndpointKeyContent : IUtf8JsonSerializable + public partial class GetBotServiceQnAMakerEndpointKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Hostname)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("authkey"u8); writer.WriteStringValue(Authkey); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GetBotServiceQnAMakerEndpointKeyContent DeserializeGetBotServiceQnAMakerEndpointKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hostname = default; + Optional authkey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hostname"u8)) + { + hostname = property.Value.GetString(); + continue; + } + if (property.NameEquals("authkey"u8)) + { + authkey = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GetBotServiceQnAMakerEndpointKeyContent(hostname.Value, authkey.Value, serializedAdditionalRawData); + } + + GetBotServiceQnAMakerEndpointKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetBotServiceQnAMakerEndpointKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetBotServiceQnAMakerEndpointKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetBotServiceQnAMakerEndpointKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetBotServiceQnAMakerEndpointKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetBotServiceQnAMakerEndpointKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetBotServiceQnAMakerEndpointKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.cs index db2909440791..fd1c6db83389 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The request body for a request to Bot Service Management to list QnA Maker endpoint keys. public partial class GetBotServiceQnAMakerEndpointKeyContent { - /// Initializes a new instance of GetBotServiceQnAMakerEndpointKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GetBotServiceQnAMakerEndpointKeyContent() { } + /// Initializes a new instance of . + /// the host name of the QnA Maker endpoint. + /// Subscription key which provides access to this API. + /// Keeps track of any properties unknown to the library. + internal GetBotServiceQnAMakerEndpointKeyContent(string hostname, string authkey, Dictionary serializedAdditionalRawData) + { + Hostname = hostname; + Authkey = authkey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// the host name of the QnA Maker endpoint. public string Hostname { get; set; } /// Subscription key which provides access to this API. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.Serialization.cs index 7ada8658db70..330da8a66be4 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class GetBotServiceQnAMakerEndpointKeyResult + public partial class GetBotServiceQnAMakerEndpointKeyResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GetBotServiceQnAMakerEndpointKeyResult DeserializeGetBotServiceQnAMakerEndpointKeyResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PrimaryEndpointKey)) + { + writer.WritePropertyName("primaryEndpointKey"u8); + writer.WriteStringValue(PrimaryEndpointKey); + } + if (Optional.IsDefined(SecondaryEndpointKey)) + { + writer.WritePropertyName("secondaryEndpointKey"u8); + writer.WriteStringValue(SecondaryEndpointKey); + } + if (Optional.IsDefined(InstalledVersion)) + { + writer.WritePropertyName("installedVersion"u8); + writer.WriteStringValue(InstalledVersion); + } + if (Optional.IsDefined(LastStableVersion)) + { + writer.WritePropertyName("lastStableVersion"u8); + writer.WriteStringValue(LastStableVersion); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GetBotServiceQnAMakerEndpointKeyResult DeserializeGetBotServiceQnAMakerEndpointKeyResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static GetBotServiceQnAMakerEndpointKeyResult DeserializeGetBotServiceQ Optional secondaryEndpointKey = default; Optional installedVersion = default; Optional lastStableVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryEndpointKey"u8)) @@ -44,8 +93,61 @@ internal static GetBotServiceQnAMakerEndpointKeyResult DeserializeGetBotServiceQ lastStableVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GetBotServiceQnAMakerEndpointKeyResult(primaryEndpointKey.Value, secondaryEndpointKey.Value, installedVersion.Value, lastStableVersion.Value); + return new GetBotServiceQnAMakerEndpointKeyResult(primaryEndpointKey.Value, secondaryEndpointKey.Value, installedVersion.Value, lastStableVersion.Value, serializedAdditionalRawData); + } + + GetBotServiceQnAMakerEndpointKeyResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetBotServiceQnAMakerEndpointKeyResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetBotServiceQnAMakerEndpointKeyResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetBotServiceQnAMakerEndpointKeyResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetBotServiceQnAMakerEndpointKeyResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetBotServiceQnAMakerEndpointKeyResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetBotServiceQnAMakerEndpointKeyResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.cs index 0808aba62e3c..88a3a2a91ede 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/GetBotServiceQnAMakerEndpointKeyResult.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// Schema for EndpointKeys generate/refresh operations. public partial class GetBotServiceQnAMakerEndpointKeyResult { - /// Initializes a new instance of GetBotServiceQnAMakerEndpointKeyResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GetBotServiceQnAMakerEndpointKeyResult() { } - /// Initializes a new instance of GetBotServiceQnAMakerEndpointKeyResult. + /// Initializes a new instance of . /// Primary Access Key. /// Secondary Access Key. /// Current version of runtime. /// Latest version of runtime. - internal GetBotServiceQnAMakerEndpointKeyResult(string primaryEndpointKey, string secondaryEndpointKey, string installedVersion, string lastStableVersion) + /// Keeps track of any properties unknown to the library. + internal GetBotServiceQnAMakerEndpointKeyResult(string primaryEndpointKey, string secondaryEndpointKey, string installedVersion, string lastStableVersion, Dictionary serializedAdditionalRawData) { PrimaryEndpointKey = primaryEndpointKey; SecondaryEndpointKey = secondaryEndpointKey; InstalledVersion = installedVersion; LastStableVersion = lastStableVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Primary Access Key. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.Serialization.cs index 6c192cb9122f..ed498783ac07 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class KikChannel : IUtf8JsonSerializable + public partial class KikChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KikChannel DeserializeKikChannel(JsonElement element) + internal static KikChannel DeserializeKikChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static KikChannel DeserializeKikChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static KikChannel DeserializeKikChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KikChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new KikChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + KikChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKikChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KikChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKikChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KikChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KikChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKikChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.cs index 30e53e504ccc..7a56c625dd70 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Kik channel definition. public partial class KikChannel : BotChannelProperties { - /// Initializes a new instance of KikChannel. + /// Initializes a new instance of . public KikChannel() { ChannelName = "KikChannel"; } - /// Initializes a new instance of KikChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Kik channel resource. - internal KikChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, KikChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal KikChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, KikChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "KikChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.Serialization.cs index 8eb156d6e62a..a68fb28a0b74 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class KikChannelProperties : IUtf8JsonSerializable + public partial class KikChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userName"u8); writer.WriteStringValue(UserName); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KikChannelProperties DeserializeKikChannelProperties(JsonElement element) + internal static KikChannelProperties DeserializeKikChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static KikChannelProperties DeserializeKikChannelProperties(JsonElement Optional apiKey = default; Optional isValidated = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userName"u8)) @@ -68,8 +91,61 @@ internal static KikChannelProperties DeserializeKikChannelProperties(JsonElement isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KikChannelProperties(userName, apiKey.Value, Optional.ToNullable(isValidated), isEnabled, serializedAdditionalRawData); + } + + KikChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKikChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KikChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKikChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KikChannelProperties model) + { + if (model is null) + { + return null; } - return new KikChannelProperties(userName, apiKey.Value, Optional.ToNullable(isValidated), isEnabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KikChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKikChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.cs index 002944ec9ab8..eeb7d76407b8 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/KikChannelProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Kik channel. public partial class KikChannelProperties { - /// Initializes a new instance of KikChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Kik user name. /// Whether this channel is enabled for the bot. /// is null. @@ -25,17 +29,24 @@ public KikChannelProperties(string userName, bool isEnabled) IsEnabled = isEnabled; } - /// Initializes a new instance of KikChannelProperties. + /// Initializes a new instance of . /// The Kik user name. /// Kik API key. Value only returned through POST to the action Channel List API, otherwise empty. /// Whether this channel is validated for the bot. /// Whether this channel is enabled for the bot. - internal KikChannelProperties(string userName, string apiKey, bool? isValidated, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal KikChannelProperties(string userName, string apiKey, bool? isValidated, bool isEnabled, Dictionary serializedAdditionalRawData) { UserName = userName; ApiKey = apiKey; IsValidated = isValidated; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KikChannelProperties() + { } /// The Kik user name. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.Serialization.cs index 797e32a58655..1e5357fea245 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class LineChannel : IUtf8JsonSerializable + public partial class LineChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LineChannel DeserializeLineChannel(JsonElement element) + internal static LineChannel DeserializeLineChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static LineChannel DeserializeLineChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static LineChannel DeserializeLineChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LineChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new LineChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + LineChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLineChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LineChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLineChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LineChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LineChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLineChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.cs index c3b2b33c0b00..37baef93e174 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Line channel definition. public partial class LineChannel : BotChannelProperties { - /// Initializes a new instance of LineChannel. + /// Initializes a new instance of . public LineChannel() { ChannelName = "LineChannel"; } - /// Initializes a new instance of LineChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to line channel resource. - internal LineChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, LineChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal LineChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, LineChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "LineChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.Serialization.cs index ebf77a601a5e..a352521dbae0 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.Serialization.cs @@ -8,27 +8,54 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class LineChannelProperties : IUtf8JsonSerializable + public partial class LineChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lineRegistrations"u8); writer.WriteStartArray(); foreach (var item in LineRegistrations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LineChannelProperties DeserializeLineChannelProperties(JsonElement element) + internal static LineChannelProperties DeserializeLineChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +63,7 @@ internal static LineChannelProperties DeserializeLineChannelProperties(JsonEleme IList lineRegistrations = default; Optional callbackUrl = default; Optional isValidated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lineRegistrations"u8)) @@ -66,8 +94,61 @@ internal static LineChannelProperties DeserializeLineChannelProperties(JsonEleme isValidated = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LineChannelProperties(lineRegistrations, callbackUrl.Value, Optional.ToNullable(isValidated), serializedAdditionalRawData); + } + + LineChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLineChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LineChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLineChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LineChannelProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LineChannelProperties(Response response) + { + if (response is null) + { + return null; } - return new LineChannelProperties(lineRegistrations, callbackUrl.Value, Optional.ToNullable(isValidated)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLineChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.cs index debb6f5faf32..5fbb03e4000a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineChannelProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Line channel. public partial class LineChannelProperties { - /// Initializes a new instance of LineChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of line channel registrations. /// is null. public LineChannelProperties(IEnumerable lineRegistrations) @@ -25,15 +28,22 @@ public LineChannelProperties(IEnumerable lineRegistrations) LineRegistrations = lineRegistrations.ToList(); } - /// Initializes a new instance of LineChannelProperties. + /// Initializes a new instance of . /// The list of line channel registrations. /// Callback Url to enter in line registration. /// Whether this channel is validated for the bot. - internal LineChannelProperties(IList lineRegistrations, Uri callbackUri, bool? isValidated) + /// Keeps track of any properties unknown to the library. + internal LineChannelProperties(IList lineRegistrations, Uri callbackUri, bool? isValidated, Dictionary serializedAdditionalRawData) { LineRegistrations = lineRegistrations; CallbackUri = callbackUri; IsValidated = isValidated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LineChannelProperties() + { } /// The list of line channel registrations. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.Serialization.cs index 0842fc92d585..790b60270ecf 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class LineRegistration : IUtf8JsonSerializable + public partial class LineRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ChannelSecret)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("channelAccessToken"u8); writer.WriteStringValue(ChannelAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LineRegistration DeserializeLineRegistration(JsonElement element) + internal static LineRegistration DeserializeLineRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static LineRegistration DeserializeLineRegistration(JsonElement element Optional generatedId = default; Optional channelSecret = default; Optional channelAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("generatedId"u8)) @@ -54,8 +77,61 @@ internal static LineRegistration DeserializeLineRegistration(JsonElement element channelAccessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LineRegistration(generatedId.Value, channelSecret.Value, channelAccessToken.Value, serializedAdditionalRawData); + } + + LineRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLineRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LineRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLineRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LineRegistration model) + { + if (model is null) + { + return null; } - return new LineRegistration(generatedId.Value, channelSecret.Value, channelAccessToken.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LineRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLineRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.cs index ad086bb42583..5401a3ecdab1 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/LineRegistration.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The properties corresponding to a line channel registration. public partial class LineRegistration { - /// Initializes a new instance of LineRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LineRegistration() { } - /// Initializes a new instance of LineRegistration. + /// Initializes a new instance of . /// Id generated for the line channel registration. /// Secret for the line channel registration. /// Access token for the line channel registration. - internal LineRegistration(string generatedId, string channelSecret, string channelAccessToken) + /// Keeps track of any properties unknown to the library. + internal LineRegistration(string generatedId, string channelSecret, string channelAccessToken, Dictionary serializedAdditionalRawData) { GeneratedId = generatedId; ChannelSecret = channelSecret; ChannelAccessToken = channelAccessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id generated for the line channel registration. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.Serialization.cs index 4e5fe6fda3ab..7c0303901be9 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class M365Extensions : IUtf8JsonSerializable + public partial class M365Extensions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static M365Extensions DeserializeM365Extensions(JsonElement element) + internal static M365Extensions DeserializeM365Extensions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static M365Extensions DeserializeM365Extensions(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("channelName"u8)) @@ -79,8 +101,61 @@ internal static M365Extensions DeserializeM365Extensions(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new M365Extensions(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + M365Extensions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeM365Extensions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + M365Extensions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeM365Extensions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(M365Extensions model) + { + if (model is null) + { + return null; } - return new M365Extensions(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator M365Extensions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeM365Extensions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.cs index aacc4b8d26fb..8c8990ff4a1e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/M365Extensions.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,18 +15,19 @@ namespace Azure.ResourceManager.BotService.Models /// M365 Extensions definition. public partial class M365Extensions : BotChannelProperties { - /// Initializes a new instance of M365Extensions. + /// Initializes a new instance of . public M365Extensions() { ChannelName = "M365Extensions"; } - /// Initializes a new instance of M365Extensions. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal M365Extensions(string channelName, ETag? etag, string provisioningState, AzureLocation? location) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal M365Extensions(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { ChannelName = channelName ?? "M365Extensions"; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.Serialization.cs index 226c158162cd..bd4dcc71eb88 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class MsTeamsChannel : IUtf8JsonSerializable + public partial class MsTeamsChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MsTeamsChannel DeserializeMsTeamsChannel(JsonElement element) + internal static MsTeamsChannel DeserializeMsTeamsChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static MsTeamsChannel DeserializeMsTeamsChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static MsTeamsChannel DeserializeMsTeamsChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MsTeamsChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new MsTeamsChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + MsTeamsChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMsTeamsChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MsTeamsChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMsTeamsChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MsTeamsChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MsTeamsChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMsTeamsChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.cs index bd26a9a245f1..5bbfcfae31d7 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Microsoft Teams channel definition. public partial class MsTeamsChannel : BotChannelProperties { - /// Initializes a new instance of MsTeamsChannel. + /// Initializes a new instance of . public MsTeamsChannel() { ChannelName = "MsTeamsChannel"; } - /// Initializes a new instance of MsTeamsChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Microsoft Teams channel resource. - internal MsTeamsChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, MsTeamsChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal MsTeamsChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, MsTeamsChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "MsTeamsChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.Serialization.cs index 494976df1639..d1d733432a15 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class MsTeamsChannelProperties : IUtf8JsonSerializable + public partial class MsTeamsChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsCallingEnabled)) { @@ -49,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("acceptedTerms"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MsTeamsChannelProperties DeserializeMsTeamsChannelProperties(JsonElement element) + internal static MsTeamsChannelProperties DeserializeMsTeamsChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +86,7 @@ internal static MsTeamsChannelProperties DeserializeMsTeamsChannelProperties(Jso Optional incomingCallRoute = default; Optional deploymentEnvironment = default; Optional acceptedTerms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enableCalling"u8)) @@ -105,8 +128,61 @@ internal static MsTeamsChannelProperties DeserializeMsTeamsChannelProperties(Jso acceptedTerms = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MsTeamsChannelProperties(Optional.ToNullable(enableCalling), callingWebhook.Value, isEnabled, incomingCallRoute.Value, deploymentEnvironment.Value, Optional.ToNullable(acceptedTerms), serializedAdditionalRawData); + } + + MsTeamsChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMsTeamsChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MsTeamsChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMsTeamsChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MsTeamsChannelProperties model) + { + if (model is null) + { + return null; } - return new MsTeamsChannelProperties(Optional.ToNullable(enableCalling), callingWebhook.Value, isEnabled, incomingCallRoute.Value, deploymentEnvironment.Value, Optional.ToNullable(acceptedTerms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MsTeamsChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMsTeamsChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.cs index 268619ab0485..b37fa1884a56 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/MsTeamsChannelProperties.cs @@ -5,26 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The parameters to provide for the Microsoft Teams channel. public partial class MsTeamsChannelProperties { - /// Initializes a new instance of MsTeamsChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether this channel is enabled for the bot. public MsTeamsChannelProperties(bool isEnabled) { IsEnabled = isEnabled; } - /// Initializes a new instance of MsTeamsChannelProperties. + /// Initializes a new instance of . /// Enable calling for Microsoft Teams channel. /// Webhook for Microsoft Teams channel calls. /// Whether this channel is enabled for the bot. /// Webhook for Microsoft Teams channel calls. /// Deployment environment for Microsoft Teams channel calls. /// Whether this channel accepted terms. - internal MsTeamsChannelProperties(bool? isCallingEnabled, string callingWebhook, bool isEnabled, string incomingCallRoute, string deploymentEnvironment, bool? acceptedTerms) + /// Keeps track of any properties unknown to the library. + internal MsTeamsChannelProperties(bool? isCallingEnabled, string callingWebhook, bool isEnabled, string incomingCallRoute, string deploymentEnvironment, bool? acceptedTerms, Dictionary serializedAdditionalRawData) { IsCallingEnabled = isCallingEnabled; CallingWebhook = callingWebhook; @@ -32,6 +39,12 @@ internal MsTeamsChannelProperties(bool? isCallingEnabled, string callingWebhook, IncomingCallRoute = incomingCallRoute; DeploymentEnvironment = deploymentEnvironment; AcceptedTerms = acceptedTerms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MsTeamsChannelProperties() + { } /// Enable calling for Microsoft Teams channel. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.Serialization.cs index 6a727aba130e..d8ba6eb478d8 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class Omnichannel : IUtf8JsonSerializable + public partial class Omnichannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Omnichannel DeserializeOmnichannel(JsonElement element) + internal static Omnichannel DeserializeOmnichannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static Omnichannel DeserializeOmnichannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("channelName"u8)) @@ -79,8 +101,61 @@ internal static Omnichannel DeserializeOmnichannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Omnichannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + Omnichannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOmnichannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Omnichannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOmnichannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Omnichannel model) + { + if (model is null) + { + return null; } - return new Omnichannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Omnichannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOmnichannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.cs index 9cab3f9dc6f4..51a627e4611b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/Omnichannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,18 +15,19 @@ namespace Azure.ResourceManager.BotService.Models /// Omnichannel channel definition. public partial class Omnichannel : BotChannelProperties { - /// Initializes a new instance of Omnichannel. + /// Initializes a new instance of . public Omnichannel() { ChannelName = "Omnichannel"; } - /// Initializes a new instance of Omnichannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal Omnichannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal Omnichannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { ChannelName = channelName ?? "Omnichannel"; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.Serialization.cs index 3c4ee3cb440c..ce377ebd5c48 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class OutlookChannel : IUtf8JsonSerializable + public partial class OutlookChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OutlookChannel DeserializeOutlookChannel(JsonElement element) + internal static OutlookChannel DeserializeOutlookChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static OutlookChannel DeserializeOutlookChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("channelName"u8)) @@ -79,8 +101,61 @@ internal static OutlookChannel DeserializeOutlookChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OutlookChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + OutlookChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOutlookChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OutlookChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOutlookChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OutlookChannel model) + { + if (model is null) + { + return null; } - return new OutlookChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OutlookChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOutlookChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.cs index f4b14f4ceee4..e191d9b1b3e3 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/OutlookChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,18 +15,19 @@ namespace Azure.ResourceManager.BotService.Models /// Outlook channel definition. public partial class OutlookChannel : BotChannelProperties { - /// Initializes a new instance of OutlookChannel. + /// Initializes a new instance of . public OutlookChannel() { ChannelName = "OutlookChannel"; } - /// Initializes a new instance of OutlookChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal OutlookChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal OutlookChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { ChannelName = channelName ?? "OutlookChannel"; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.Serialization.cs index 84b22009e346..4f206f0210f1 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SearchAssistant : IUtf8JsonSerializable + public partial class SearchAssistant : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SearchAssistant DeserializeSearchAssistant(JsonElement element) + internal static SearchAssistant DeserializeSearchAssistant(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static SearchAssistant DeserializeSearchAssistant(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("channelName"u8)) @@ -79,8 +101,61 @@ internal static SearchAssistant DeserializeSearchAssistant(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SearchAssistant(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + SearchAssistant IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSearchAssistant(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SearchAssistant IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSearchAssistant(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SearchAssistant model) + { + if (model is null) + { + return null; } - return new SearchAssistant(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SearchAssistant(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSearchAssistant(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.cs index 5af380a8d3b9..a647c28849da 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SearchAssistant.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,18 +15,19 @@ namespace Azure.ResourceManager.BotService.Models /// SearchAssistant definition. public partial class SearchAssistant : BotChannelProperties { - /// Initializes a new instance of SearchAssistant. + /// Initializes a new instance of . public SearchAssistant() { ChannelName = "SearchAssistant"; } - /// Initializes a new instance of SearchAssistant. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal SearchAssistant(string channelName, ETag? etag, string provisioningState, AzureLocation? location) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal SearchAssistant(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { ChannelName = channelName ?? "SearchAssistant"; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.Serialization.cs index 8355cc95831e..3ca0bf909400 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - internal partial class ServiceProviderParameterMetadata + internal partial class ServiceProviderParameterMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceProviderParameterMetadata DeserializeServiceProviderParameterMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Constraints)) + { + writer.WritePropertyName("constraints"u8); + if (Constraints is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Constraints).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceProviderParameterMetadata DeserializeServiceProviderParameterMetadata(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional constraints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("constraints"u8)) @@ -30,8 +71,61 @@ internal static ServiceProviderParameterMetadata DeserializeServiceProviderParam constraints = ServiceProviderParameterMetadataConstraints.DeserializeServiceProviderParameterMetadataConstraints(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceProviderParameterMetadata(constraints.Value); + return new ServiceProviderParameterMetadata(constraints.Value, serializedAdditionalRawData); + } + + ServiceProviderParameterMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceProviderParameterMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceProviderParameterMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceProviderParameterMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceProviderParameterMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceProviderParameterMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceProviderParameterMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.cs index cc20110b307c..affb61b31b54 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadata.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// Meta data for the Service Provider. internal partial class ServiceProviderParameterMetadata { - /// Initializes a new instance of ServiceProviderParameterMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceProviderParameterMetadata() { } - /// Initializes a new instance of ServiceProviderParameterMetadata. + /// Initializes a new instance of . /// the constraints of the bot meta data. - internal ServiceProviderParameterMetadata(ServiceProviderParameterMetadataConstraints constraints) + /// Keeps track of any properties unknown to the library. + internal ServiceProviderParameterMetadata(ServiceProviderParameterMetadataConstraints constraints, Dictionary serializedAdditionalRawData) { Constraints = constraints; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// the constraints of the bot meta data. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.Serialization.cs index a466d3a1cf2a..6f329b40401e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - internal partial class ServiceProviderParameterMetadataConstraints + internal partial class ServiceProviderParameterMetadataConstraints : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceProviderParameterMetadataConstraints DeserializeServiceProviderParameterMetadataConstraints(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsRequired)) + { + writer.WritePropertyName("required"u8); + writer.WriteBooleanValue(IsRequired.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceProviderParameterMetadataConstraints DeserializeServiceProviderParameterMetadataConstraints(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional required = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("required"u8)) @@ -30,8 +64,61 @@ internal static ServiceProviderParameterMetadataConstraints DeserializeServicePr required = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceProviderParameterMetadataConstraints(Optional.ToNullable(required)); + return new ServiceProviderParameterMetadataConstraints(Optional.ToNullable(required), serializedAdditionalRawData); + } + + ServiceProviderParameterMetadataConstraints IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceProviderParameterMetadataConstraints(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceProviderParameterMetadataConstraints IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceProviderParameterMetadataConstraints(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceProviderParameterMetadataConstraints model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceProviderParameterMetadataConstraints(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceProviderParameterMetadataConstraints(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.cs index 888208d7b5aa..fdc29c1e815b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderParameterMetadataConstraints.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// the constraints of the bot meta data. internal partial class ServiceProviderParameterMetadataConstraints { - /// Initializes a new instance of ServiceProviderParameterMetadataConstraints. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceProviderParameterMetadataConstraints() { } - /// Initializes a new instance of ServiceProviderParameterMetadataConstraints. + /// Initializes a new instance of . /// Whether required the constraints of the bot meta data. - internal ServiceProviderParameterMetadataConstraints(bool? isRequired) + /// Keeps track of any properties unknown to the library. + internal ServiceProviderParameterMetadataConstraints(bool? isRequired, Dictionary serializedAdditionalRawData) { IsRequired = isRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether required the constraints of the bot meta data. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.Serialization.cs index 004e0590001b..67bd02133092 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - internal partial class ServiceProviderResponseList + internal partial class ServiceProviderResponseList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceProviderResponseList DeserializeServiceProviderResponseList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceProviderResponseList DeserializeServiceProviderResponseList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -42,8 +75,61 @@ internal static ServiceProviderResponseList DeserializeServiceProviderResponseLi value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceProviderResponseList(nextLink.Value, Optional.ToList(value)); + return new ServiceProviderResponseList(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ServiceProviderResponseList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceProviderResponseList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceProviderResponseList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceProviderResponseList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceProviderResponseList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceProviderResponseList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceProviderResponseList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.cs index f32e80dc881d..6b203ab6f1ba 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/ServiceProviderResponseList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.BotService.Models /// The list of bot service providers response. internal partial class ServiceProviderResponseList { - /// Initializes a new instance of ServiceProviderResponseList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceProviderResponseList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceProviderResponseList. + /// Initializes a new instance of . /// The link used to get the next page of bot service providers. /// Gets the list of bot service providers and their properties. - internal ServiceProviderResponseList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ServiceProviderResponseList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of bot service providers. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.Serialization.cs index 5cd7f2bd71ba..4a043431a072 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SkypeChannel : IUtf8JsonSerializable + public partial class SkypeChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SkypeChannel DeserializeSkypeChannel(JsonElement element) + internal static SkypeChannel DeserializeSkypeChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static SkypeChannel DeserializeSkypeChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static SkypeChannel DeserializeSkypeChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SkypeChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new SkypeChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + SkypeChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSkypeChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SkypeChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSkypeChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SkypeChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SkypeChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSkypeChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.cs index c766f82c072e..00b7d69986e8 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Skype channel definition. public partial class SkypeChannel : BotChannelProperties { - /// Initializes a new instance of SkypeChannel. + /// Initializes a new instance of . public SkypeChannel() { ChannelName = "SkypeChannel"; } - /// Initializes a new instance of SkypeChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Skype channel resource. - internal SkypeChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, SkypeChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal SkypeChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, SkypeChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "SkypeChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.Serialization.cs index b345c47a13aa..0b8b7a74b2ff 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SkypeChannelProperties : IUtf8JsonSerializable + public partial class SkypeChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsMessagingEnabled)) { @@ -62,11 +70,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SkypeChannelProperties DeserializeSkypeChannelProperties(JsonElement element) + internal static SkypeChannelProperties DeserializeSkypeChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +103,7 @@ internal static SkypeChannelProperties DeserializeSkypeChannelProperties(JsonEle Optional callingWebHook = default; Optional incomingCallRoute = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enableMessaging"u8)) @@ -157,8 +180,61 @@ internal static SkypeChannelProperties DeserializeSkypeChannelProperties(JsonEle isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SkypeChannelProperties(Optional.ToNullable(enableMessaging), Optional.ToNullable(enableMediaCards), Optional.ToNullable(enableVideo), Optional.ToNullable(enableCalling), Optional.ToNullable(enableScreenSharing), Optional.ToNullable(enableGroups), groupsMode.Value, callingWebHook.Value, incomingCallRoute.Value, isEnabled, serializedAdditionalRawData); + } + + SkypeChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSkypeChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SkypeChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSkypeChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SkypeChannelProperties model) + { + if (model is null) + { + return null; } - return new SkypeChannelProperties(Optional.ToNullable(enableMessaging), Optional.ToNullable(enableMediaCards), Optional.ToNullable(enableVideo), Optional.ToNullable(enableCalling), Optional.ToNullable(enableScreenSharing), Optional.ToNullable(enableGroups), groupsMode.Value, callingWebHook.Value, incomingCallRoute.Value, isEnabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SkypeChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSkypeChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.cs index 2d07f9179b85..cd9bb91bc765 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SkypeChannelProperties.cs @@ -5,19 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The parameters to provide for the Microsoft Teams channel. public partial class SkypeChannelProperties { - /// Initializes a new instance of SkypeChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether this channel is enabled for the bot. public SkypeChannelProperties(bool isEnabled) { IsEnabled = isEnabled; } - /// Initializes a new instance of SkypeChannelProperties. + /// Initializes a new instance of . /// Enable messaging for Skype channel. /// Enable media cards for Skype channel. /// Enable video for Skype channel. @@ -28,7 +34,8 @@ public SkypeChannelProperties(bool isEnabled) /// Calling web hook for Skype channel. /// Incoming call route for Skype channel. /// Whether this channel is enabled for the bot. - internal SkypeChannelProperties(bool? isMessagingEnabled, bool? isMediaCardsEnabled, bool? isVideoEnabled, bool? isCallingEnabled, bool? isScreenSharingEnabled, bool? isGroupsEnabled, string groupsMode, string callingWebHook, string incomingCallRoute, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal SkypeChannelProperties(bool? isMessagingEnabled, bool? isMediaCardsEnabled, bool? isVideoEnabled, bool? isCallingEnabled, bool? isScreenSharingEnabled, bool? isGroupsEnabled, string groupsMode, string callingWebHook, string incomingCallRoute, bool isEnabled, Dictionary serializedAdditionalRawData) { IsMessagingEnabled = isMessagingEnabled; IsMediaCardsEnabled = isMediaCardsEnabled; @@ -40,6 +47,12 @@ internal SkypeChannelProperties(bool? isMessagingEnabled, bool? isMediaCardsEnab CallingWebHook = callingWebHook; IncomingCallRoute = incomingCallRoute; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SkypeChannelProperties() + { } /// Enable messaging for Skype channel. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.Serialization.cs index 6b0f222b3d6f..68ce7558eb42 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SlackChannel : IUtf8JsonSerializable + public partial class SlackChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SlackChannel DeserializeSlackChannel(JsonElement element) + internal static SlackChannel DeserializeSlackChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static SlackChannel DeserializeSlackChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static SlackChannel DeserializeSlackChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SlackChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new SlackChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + SlackChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSlackChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SlackChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSlackChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SlackChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SlackChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSlackChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.cs index 9d2177d831ff..f80ec657a51f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Slack channel definition. public partial class SlackChannel : BotChannelProperties { - /// Initializes a new instance of SlackChannel. + /// Initializes a new instance of . public SlackChannel() { ChannelName = "SlackChannel"; } - /// Initializes a new instance of SlackChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Slack channel resource. - internal SlackChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, SlackChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal SlackChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, SlackChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "SlackChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.Serialization.cs index a855f8c91566..cfd89dea9507 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SlackChannelProperties : IUtf8JsonSerializable + public partial class SlackChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -53,11 +60,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SlackChannelProperties DeserializeSlackChannelProperties(JsonElement element) + internal static SlackChannelProperties DeserializeSlackChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +94,7 @@ internal static SlackChannelProperties DeserializeSlackChannelProperties(JsonEle Optional isValidated = default; Optional signingSecret = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -142,8 +164,61 @@ internal static SlackChannelProperties DeserializeSlackChannelProperties(JsonEle isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SlackChannelProperties(clientId.Value, clientSecret.Value, verificationToken.Value, scopes.Value, landingPageUrl.Value, redirectAction.Value, lastSubmissionId.Value, Optional.ToNullable(registerBeforeOAuthFlow), Optional.ToNullable(isValidated), signingSecret.Value, isEnabled, serializedAdditionalRawData); + } + + SlackChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSlackChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SlackChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSlackChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SlackChannelProperties model) + { + if (model is null) + { + return null; } - return new SlackChannelProperties(clientId.Value, clientSecret.Value, verificationToken.Value, scopes.Value, landingPageUrl.Value, redirectAction.Value, lastSubmissionId.Value, Optional.ToNullable(registerBeforeOAuthFlow), Optional.ToNullable(isValidated), signingSecret.Value, isEnabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SlackChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSlackChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.cs index 591053425d56..00197874afa3 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SlackChannelProperties.cs @@ -6,20 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.BotService.Models { /// The parameters to provide for the Slack channel. public partial class SlackChannelProperties { - /// Initializes a new instance of SlackChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether this channel is enabled for the bot. public SlackChannelProperties(bool isEnabled) { IsEnabled = isEnabled; } - /// Initializes a new instance of SlackChannelProperties. + /// Initializes a new instance of . /// The Slack client id. /// The Slack client secret. Value only returned through POST to the action Channel List API, otherwise empty. /// The Slack verification token. Value only returned through POST to the action Channel List API, otherwise empty. @@ -31,7 +35,8 @@ public SlackChannelProperties(bool isEnabled) /// Whether this channel is validated for the bot. /// The Slack signing secret. /// Whether this channel is enabled for the bot. - internal SlackChannelProperties(string clientId, string clientSecret, string verificationToken, string scopes, Uri landingPageUri, string redirectAction, string lastSubmissionId, bool? registerBeforeOAuthFlow, bool? isValidated, string signingSecret, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal SlackChannelProperties(string clientId, string clientSecret, string verificationToken, string scopes, Uri landingPageUri, string redirectAction, string lastSubmissionId, bool? registerBeforeOAuthFlow, bool? isValidated, string signingSecret, bool isEnabled, Dictionary serializedAdditionalRawData) { ClientId = clientId; ClientSecret = clientSecret; @@ -44,6 +49,12 @@ internal SlackChannelProperties(string clientId, string clientSecret, string ver IsValidated = isValidated; SigningSecret = signingSecret; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SlackChannelProperties() + { } /// The Slack client id. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.Serialization.cs index 4884a925af31..4e750db8b841 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SmsChannel : IUtf8JsonSerializable + public partial class SmsChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SmsChannel DeserializeSmsChannel(JsonElement element) + internal static SmsChannel DeserializeSmsChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static SmsChannel DeserializeSmsChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static SmsChannel DeserializeSmsChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SmsChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new SmsChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + SmsChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmsChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmsChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmsChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmsChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmsChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmsChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.cs index a47a832da55a..2009dbee981e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Sms channel definition. public partial class SmsChannel : BotChannelProperties { - /// Initializes a new instance of SmsChannel. + /// Initializes a new instance of . public SmsChannel() { ChannelName = "SmsChannel"; } - /// Initializes a new instance of SmsChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Sms channel resource. - internal SmsChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, SmsChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal SmsChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, SmsChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "SmsChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.Serialization.cs index b32e7a461bd1..43ec94dbd9a9 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class SmsChannelProperties : IUtf8JsonSerializable + public partial class SmsChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("phone"u8); writer.WriteStringValue(Phone); @@ -31,11 +39,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SmsChannelProperties DeserializeSmsChannelProperties(JsonElement element) + internal static SmsChannelProperties DeserializeSmsChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static SmsChannelProperties DeserializeSmsChannelProperties(JsonElement Optional authToken = default; Optional isValidated = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("phone"u8)) @@ -76,8 +99,61 @@ internal static SmsChannelProperties DeserializeSmsChannelProperties(JsonElement isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmsChannelProperties(phone, accountSID, authToken.Value, Optional.ToNullable(isValidated), isEnabled, serializedAdditionalRawData); + } + + SmsChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmsChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmsChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmsChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmsChannelProperties model) + { + if (model is null) + { + return null; } - return new SmsChannelProperties(phone, accountSID, authToken.Value, Optional.ToNullable(isValidated), isEnabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmsChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmsChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.cs index c24b64c0ebca..bf8305b91cdb 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/SmsChannelProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Sms channel. public partial class SmsChannelProperties { - /// Initializes a new instance of SmsChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Sms phone. /// The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty. /// Whether this channel is enabled for the bot. @@ -28,19 +32,26 @@ public SmsChannelProperties(string phone, string accountSID, bool isEnabled) IsEnabled = isEnabled; } - /// Initializes a new instance of SmsChannelProperties. + /// Initializes a new instance of . /// The Sms phone. /// The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty. /// The Sms auth token. Value only returned through POST to the action Channel List API, otherwise empty. /// Whether this channel is validated for the bot. /// Whether this channel is enabled for the bot. - internal SmsChannelProperties(string phone, string accountSID, string authToken, bool? isValidated, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal SmsChannelProperties(string phone, string accountSID, string authToken, bool? isValidated, bool isEnabled, Dictionary serializedAdditionalRawData) { Phone = phone; AccountSID = accountSID; AuthToken = authToken; IsValidated = isValidated; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SmsChannelProperties() + { } /// The Sms phone. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.Serialization.cs index 1bf62978500f..9705d99a9304 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class TelegramChannel : IUtf8JsonSerializable + public partial class TelegramChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TelegramChannel DeserializeTelegramChannel(JsonElement element) + internal static TelegramChannel DeserializeTelegramChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static TelegramChannel DeserializeTelegramChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static TelegramChannel DeserializeTelegramChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TelegramChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new TelegramChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + TelegramChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTelegramChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TelegramChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTelegramChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TelegramChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TelegramChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTelegramChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.cs index d90ca88c9394..2ad3571e33df 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Telegram channel definition. public partial class TelegramChannel : BotChannelProperties { - /// Initializes a new instance of TelegramChannel. + /// Initializes a new instance of . public TelegramChannel() { ChannelName = "TelegramChannel"; } - /// Initializes a new instance of TelegramChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Telegram channel resource. - internal TelegramChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, TelegramChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal TelegramChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, TelegramChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "TelegramChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.Serialization.cs index 1672d248f2e1..91c027230c4f 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class TelegramChannelProperties : IUtf8JsonSerializable + public partial class TelegramChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AccessToken)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TelegramChannelProperties DeserializeTelegramChannelProperties(JsonElement element) + internal static TelegramChannelProperties DeserializeTelegramChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static TelegramChannelProperties DeserializeTelegramChannelProperties(J Optional accessToken = default; Optional isValidated = default; bool isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accessToken"u8)) @@ -60,8 +83,61 @@ internal static TelegramChannelProperties DeserializeTelegramChannelProperties(J isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TelegramChannelProperties(accessToken.Value, Optional.ToNullable(isValidated), isEnabled, serializedAdditionalRawData); + } + + TelegramChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTelegramChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TelegramChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTelegramChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TelegramChannelProperties model) + { + if (model is null) + { + return null; } - return new TelegramChannelProperties(accessToken.Value, Optional.ToNullable(isValidated), isEnabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TelegramChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTelegramChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.cs index 455bc33c9008..6480fdb7e4aa 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelegramChannelProperties.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.BotService.Models { /// The parameters to provide for the Telegram channel. public partial class TelegramChannelProperties { - /// Initializes a new instance of TelegramChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether this channel is enabled for the bot. public TelegramChannelProperties(bool isEnabled) { IsEnabled = isEnabled; } - /// Initializes a new instance of TelegramChannelProperties. + /// Initializes a new instance of . /// The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. /// Whether this channel is validated for the bot. /// Whether this channel is enabled for the bot. - internal TelegramChannelProperties(string accessToken, bool? isValidated, bool isEnabled) + /// Keeps track of any properties unknown to the library. + internal TelegramChannelProperties(string accessToken, bool? isValidated, bool isEnabled, Dictionary serializedAdditionalRawData) { AccessToken = accessToken; IsValidated = isValidated; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TelegramChannelProperties() + { } /// The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.Serialization.cs index 27bde404258e..e965a9dedf92 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class TelephonyChannel : IUtf8JsonSerializable + public partial class TelephonyChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TelephonyChannel DeserializeTelephonyChannel(JsonElement element) + internal static TelephonyChannel DeserializeTelephonyChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static TelephonyChannel DeserializeTelephonyChannel(JsonElement element Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static TelephonyChannel DeserializeTelephonyChannel(JsonElement element location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TelephonyChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new TelephonyChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + TelephonyChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTelephonyChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TelephonyChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTelephonyChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TelephonyChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TelephonyChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTelephonyChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.cs index 2faf9f3e5ebe..435aaed14822 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Telephony channel definition. public partial class TelephonyChannel : BotChannelProperties { - /// Initializes a new instance of TelephonyChannel. + /// Initializes a new instance of . public TelephonyChannel() { ChannelName = "TelephonyChannel"; } - /// Initializes a new instance of TelephonyChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Telephony channel resource. - internal TelephonyChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, TelephonyChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal TelephonyChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, TelephonyChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "TelephonyChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.Serialization.cs index 2223d534b5cd..86aa62a07fa9 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class TelephonyChannelProperties : IUtf8JsonSerializable + public partial class TelephonyChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PhoneNumbers)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PhoneNumbers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApiConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -89,11 +110,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isEnabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TelephonyChannelProperties DeserializeTelephonyChannelProperties(JsonElement element) + internal static TelephonyChannelProperties DeserializeTelephonyChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -105,6 +140,7 @@ internal static TelephonyChannelProperties DeserializeTelephonyChannelProperties Optional defaultLocale = default; Optional premiumSku = default; Optional isEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("phoneNumbers"u8)) @@ -184,8 +220,61 @@ internal static TelephonyChannelProperties DeserializeTelephonyChannelProperties isEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TelephonyChannelProperties(Optional.ToList(phoneNumbers), Optional.ToList(apiConfigurations), cognitiveServiceSubscriptionKey.Value, cognitiveServiceRegion.Value, defaultLocale.Value, premiumSku.Value, Optional.ToNullable(isEnabled), serializedAdditionalRawData); + } + + TelephonyChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTelephonyChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TelephonyChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTelephonyChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TelephonyChannelProperties model) + { + if (model is null) + { + return null; } - return new TelephonyChannelProperties(Optional.ToList(phoneNumbers), Optional.ToList(apiConfigurations), cognitiveServiceSubscriptionKey.Value, cognitiveServiceRegion.Value, defaultLocale.Value, premiumSku.Value, Optional.ToNullable(isEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TelephonyChannelProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTelephonyChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.cs index 60182b377f0c..538394ae4b29 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Direct Line channel. public partial class TelephonyChannelProperties { - /// Initializes a new instance of TelephonyChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TelephonyChannelProperties() { PhoneNumbers = new ChangeTrackingList(); ApiConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of TelephonyChannelProperties. + /// Initializes a new instance of . /// The list of Telephony phone numbers. /// The list of Telephony api configuration. /// The extensionKey1. @@ -28,7 +32,8 @@ public TelephonyChannelProperties() /// The default locale of the channel. /// The premium SKU applied to the channel. /// Whether the channel is enabled. - internal TelephonyChannelProperties(IList phoneNumbers, IList apiConfigurations, string cognitiveServiceSubscriptionKey, string cognitiveServiceRegion, string defaultLocale, string premiumSku, bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal TelephonyChannelProperties(IList phoneNumbers, IList apiConfigurations, string cognitiveServiceSubscriptionKey, string cognitiveServiceRegion, string defaultLocale, string premiumSku, bool? isEnabled, Dictionary serializedAdditionalRawData) { PhoneNumbers = phoneNumbers; ApiConfigurations = apiConfigurations; @@ -37,6 +42,7 @@ internal TelephonyChannelProperties(IList phoneNumbers, I DefaultLocale = defaultLocale; PremiumSku = premiumSku; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of Telephony phone numbers. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.Serialization.cs index 18edc3a86f78..95e7ecf8db03 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class TelephonyChannelResourceApiConfiguration : IUtf8JsonSerializable + public partial class TelephonyChannelResourceApiConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -80,11 +88,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("defaultLocale"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TelephonyChannelResourceApiConfiguration DeserializeTelephonyChannelResourceApiConfiguration(JsonElement element) + internal static TelephonyChannelResourceApiConfiguration DeserializeTelephonyChannelResourceApiConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -95,6 +117,7 @@ internal static TelephonyChannelResourceApiConfiguration DeserializeTelephonyCha Optional cognitiveServiceRegion = default; Optional cognitiveServiceResourceId = default; Optional defaultLocale = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -152,8 +175,61 @@ internal static TelephonyChannelResourceApiConfiguration DeserializeTelephonyCha defaultLocale = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TelephonyChannelResourceApiConfiguration(id.Value, providerName.Value, cognitiveServiceSubscriptionKey.Value, cognitiveServiceRegion.Value, cognitiveServiceResourceId.Value, defaultLocale.Value, serializedAdditionalRawData); + } + + TelephonyChannelResourceApiConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTelephonyChannelResourceApiConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TelephonyChannelResourceApiConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTelephonyChannelResourceApiConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TelephonyChannelResourceApiConfiguration model) + { + if (model is null) + { + return null; } - return new TelephonyChannelResourceApiConfiguration(id.Value, providerName.Value, cognitiveServiceSubscriptionKey.Value, cognitiveServiceRegion.Value, cognitiveServiceResourceId.Value, defaultLocale.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TelephonyChannelResourceApiConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTelephonyChannelResourceApiConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.cs index 5927a7e7122d..c7a2ed2a2873 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyChannelResourceApiConfiguration.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -12,19 +14,23 @@ namespace Azure.ResourceManager.BotService.Models /// A resource Api configuration for the Telephony channel. public partial class TelephonyChannelResourceApiConfiguration { - /// Initializes a new instance of TelephonyChannelResourceApiConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TelephonyChannelResourceApiConfiguration() { } - /// Initializes a new instance of TelephonyChannelResourceApiConfiguration. + /// Initializes a new instance of . /// The id of config. /// The provider name. /// The cognitive service subscription key. /// The cognitive service region. /// The cognitive service resourceId. /// The default locale. - internal TelephonyChannelResourceApiConfiguration(string id, string providerName, string cognitiveServiceSubscriptionKey, string cognitiveServiceRegion, ResourceIdentifier cognitiveServiceResourceId, string defaultLocale) + /// Keeps track of any properties unknown to the library. + internal TelephonyChannelResourceApiConfiguration(string id, string providerName, string cognitiveServiceSubscriptionKey, string cognitiveServiceRegion, ResourceIdentifier cognitiveServiceResourceId, string defaultLocale, Dictionary serializedAdditionalRawData) { Id = id; ProviderName = providerName; @@ -32,6 +38,7 @@ internal TelephonyChannelResourceApiConfiguration(string id, string providerName CognitiveServiceRegion = cognitiveServiceRegion; CognitiveServiceResourceId = cognitiveServiceResourceId; DefaultLocale = defaultLocale; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of config. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.Serialization.cs index c58a33a43af2..ef39c3e2f152 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class TelephonyPhoneNumbers : IUtf8JsonSerializable + public partial class TelephonyPhoneNumbers : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -121,11 +129,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("offerType"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TelephonyPhoneNumbers DeserializeTelephonyPhoneNumbers(JsonElement element) + internal static TelephonyPhoneNumbers DeserializeTelephonyPhoneNumbers(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -140,6 +162,7 @@ internal static TelephonyPhoneNumbers DeserializeTelephonyPhoneNumbers(JsonEleme Optional cognitiveServiceResourceId = default; Optional defaultLocale = default; Optional offerType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -232,8 +255,61 @@ internal static TelephonyPhoneNumbers DeserializeTelephonyPhoneNumbers(JsonEleme offerType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TelephonyPhoneNumbers(id.Value, phoneNumber.Value, acsEndpoint.Value, acsSecret.Value, acsResourceId.Value, cognitiveServiceSubscriptionKey.Value, cognitiveServiceRegion.Value, cognitiveServiceResourceId.Value, defaultLocale.Value, offerType.Value, serializedAdditionalRawData); + } + + TelephonyPhoneNumbers IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTelephonyPhoneNumbers(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TelephonyPhoneNumbers IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTelephonyPhoneNumbers(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TelephonyPhoneNumbers model) + { + if (model is null) + { + return null; } - return new TelephonyPhoneNumbers(id.Value, phoneNumber.Value, acsEndpoint.Value, acsSecret.Value, acsResourceId.Value, cognitiveServiceSubscriptionKey.Value, cognitiveServiceRegion.Value, cognitiveServiceResourceId.Value, defaultLocale.Value, offerType.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TelephonyPhoneNumbers(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTelephonyPhoneNumbers(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.cs index e2c372a08bce..e7156cee4bed 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/TelephonyPhoneNumbers.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.BotService.Models @@ -12,12 +14,15 @@ namespace Azure.ResourceManager.BotService.Models /// A telephone number for the Telephony channel. public partial class TelephonyPhoneNumbers { - /// Initializes a new instance of TelephonyPhoneNumbers. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TelephonyPhoneNumbers() { } - /// Initializes a new instance of TelephonyPhoneNumbers. + /// Initializes a new instance of . /// The element id. /// The phone number. /// The endpoint of ACS. @@ -28,7 +33,8 @@ public TelephonyPhoneNumbers() /// The resource id of cognitive service. /// The default locale of the phone number. /// Optional Property that will determine the offering type of the phone. - internal TelephonyPhoneNumbers(string id, string phoneNumber, string acsEndpoint, string acsSecret, ResourceIdentifier acsResourceId, string cognitiveServiceSubscriptionKey, string cognitiveServiceRegion, ResourceIdentifier cognitiveServiceResourceId, string defaultLocale, string offerType) + /// Keeps track of any properties unknown to the library. + internal TelephonyPhoneNumbers(string id, string phoneNumber, string acsEndpoint, string acsSecret, ResourceIdentifier acsResourceId, string cognitiveServiceSubscriptionKey, string cognitiveServiceRegion, ResourceIdentifier cognitiveServiceResourceId, string defaultLocale, string offerType, Dictionary serializedAdditionalRawData) { Id = id; PhoneNumber = phoneNumber; @@ -40,6 +46,7 @@ internal TelephonyPhoneNumbers(string id, string phoneNumber, string acsEndpoint CognitiveServiceResourceId = cognitiveServiceResourceId; DefaultLocale = defaultLocale; OfferType = offerType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The element id. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.Serialization.cs index 42748b201f9a..d87d4afe8a8c 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.Serialization.cs @@ -5,16 +5,21 @@ #nullable disable +using System; using System.Text.Json; -using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - internal partial class UnknownChannel : IUtf8JsonSerializable + internal partial class UnknownChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -35,52 +40,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } - writer.WriteEndObject(); - } - - internal static UnknownChannel DeserializeUnknownChannel(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string channelName = "Unknown"; - Optional etag = default; - Optional provisioningState = default; - Optional location = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("channelName"u8)) - { - channelName = property.Value.GetString(); - continue; - } - if (property.NameEquals("etag"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - etag = null; - continue; - } - etag = new ETag(property.Value.GetString()); - continue; - } - if (property.NameEquals("provisioningState"u8)) - { - provisioningState = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location)); + writer.WriteEndObject(); + } + + internal static BotChannelProperties DeserializeUnknownChannel(JsonElement element, ModelSerializerOptions options = default) => DeserializeBotChannelProperties(element, options); + + BotChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BotChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBotChannelProperties(doc.RootElement, options); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.cs index 95a16b9fecf5..3a225962a9c0 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/UnknownChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,14 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// The UnknownChannel. internal partial class UnknownChannel : BotChannelProperties { - /// Initializes a new instance of UnknownChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. - internal UnknownChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal UnknownChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { ChannelName = channelName ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownChannel() + { + } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.Serialization.cs index 1d19e80f6af6..18f6081a0267 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class WebChatChannel : IUtf8JsonSerializable + public partial class WebChatChannel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WritePropertyName("channelName"u8); writer.WriteStringValue(ChannelName); @@ -40,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebChatChannel DeserializeWebChatChannel(JsonElement element) + internal static WebChatChannel DeserializeWebChatChannel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static WebChatChannel DeserializeWebChatChannel(JsonElement element) Optional etag = default; Optional provisioningState = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -94,8 +123,61 @@ internal static WebChatChannel DeserializeWebChatChannel(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WebChatChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value); + return new WebChatChannel(channelName, Optional.ToNullable(etag), provisioningState.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + WebChatChannel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebChatChannel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebChatChannel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebChatChannel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebChatChannel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebChatChannel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebChatChannel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.cs index 662e16755835..7256ca0e0e73 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -13,19 +15,20 @@ namespace Azure.ResourceManager.BotService.Models /// Web Chat channel definition. public partial class WebChatChannel : BotChannelProperties { - /// Initializes a new instance of WebChatChannel. + /// Initializes a new instance of . public WebChatChannel() { ChannelName = "WebChatChannel"; } - /// Initializes a new instance of WebChatChannel. + /// Initializes a new instance of . /// The channel name. /// Entity Tag of the resource. /// Provisioning state of the resource. /// Specifies the location of the resource. /// The set of properties specific to Web Chat channel resource. - internal WebChatChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, WebChatChannelProperties properties) : base(channelName, etag, provisioningState, location) + /// Keeps track of any properties unknown to the library. + internal WebChatChannel(string channelName, ETag? etag, string provisioningState, AzureLocation? location, WebChatChannelProperties properties, Dictionary serializedAdditionalRawData) : base(channelName, etag, provisioningState, location, serializedAdditionalRawData) { Properties = properties; ChannelName = channelName ?? "WebChatChannel"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.Serialization.cs index 4a59c9edfff9..eb46e9788b1d 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class WebChatChannelProperties : IUtf8JsonSerializable + public partial class WebChatChannelProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Sites)) { @@ -22,21 +29,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sites) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebChatChannelProperties DeserializeWebChatChannelProperties(JsonElement element) + internal static WebChatChannelProperties DeserializeWebChatChannelProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional webChatEmbedCode = default; Optional> sites = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("webChatEmbedCode"u8)) @@ -58,8 +87,61 @@ internal static WebChatChannelProperties DeserializeWebChatChannelProperties(Jso sites = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebChatChannelProperties(webChatEmbedCode.Value, Optional.ToList(sites), serializedAdditionalRawData); + } + + WebChatChannelProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebChatChannelProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebChatChannelProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebChatChannelProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebChatChannelProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebChatChannelProperties(Response response) + { + if (response is null) + { + return null; } - return new WebChatChannelProperties(webChatEmbedCode.Value, Optional.ToList(sites)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebChatChannelProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.cs index a017e51a0aa7..b167ccc68ec1 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatChannelProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.BotService.Models /// The parameters to provide for the Web Chat channel. public partial class WebChatChannelProperties { - /// Initializes a new instance of WebChatChannelProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WebChatChannelProperties() { Sites = new ChangeTrackingList(); } - /// Initializes a new instance of WebChatChannelProperties. + /// Initializes a new instance of . /// Web chat control embed code. /// The list of Web Chat sites. - internal WebChatChannelProperties(string webChatEmbedCode, IList sites) + /// Keeps track of any properties unknown to the library. + internal WebChatChannelProperties(string webChatEmbedCode, IList sites, Dictionary serializedAdditionalRawData) { WebChatEmbedCode = webChatEmbedCode; Sites = sites; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Web chat control embed code. diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.Serialization.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.Serialization.cs index 1e212d1364ab..5a16d30c506a 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.Serialization.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.Serialization.cs @@ -10,13 +10,18 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.BotService.Models { - public partial class WebChatSite : IUtf8JsonSerializable + public partial class WebChatSite : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TenantId)) { @@ -99,11 +104,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isWebchatPreviewEnabled"u8); writer.WriteBooleanValue(IsWebchatPreviewEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebChatSite DeserializeWebChatSite(JsonElement element) + internal static WebChatSite DeserializeWebChatSite(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,6 +146,7 @@ internal static WebChatSite DeserializeWebChatSite(JsonElement element) Optional> trustedOrigins = default; Optional isWebChatSpeechEnabled = default; Optional isWebchatPreviewEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId"u8)) @@ -282,8 +302,61 @@ internal static WebChatSite DeserializeWebChatSite(JsonElement element) isWebchatPreviewEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebChatSite(Optional.ToNullable(tenantId), siteId.Value, siteName, key.Value, key2.Value, isEnabled, Optional.ToNullable(isTokenEnabled), Optional.ToNullable(isEndpointParametersEnabled), Optional.ToNullable(isDetailedLoggingEnabled), Optional.ToNullable(isBlockUserUploadEnabled), Optional.ToNullable(isNoStorageEnabled), Optional.ToNullable(eTag), appId.Value, Optional.ToNullable(isV1Enabled), Optional.ToNullable(isV3Enabled), Optional.ToNullable(isSecureSiteEnabled), Optional.ToList(trustedOrigins), Optional.ToNullable(isWebChatSpeechEnabled), Optional.ToNullable(isWebchatPreviewEnabled), serializedAdditionalRawData); + } + + WebChatSite IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebChatSite(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebChatSite IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebChatSite(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebChatSite model) + { + if (model is null) + { + return null; } - return new WebChatSite(Optional.ToNullable(tenantId), siteId.Value, siteName, key.Value, key2.Value, isEnabled, Optional.ToNullable(isTokenEnabled), Optional.ToNullable(isEndpointParametersEnabled), Optional.ToNullable(isDetailedLoggingEnabled), Optional.ToNullable(isBlockUserUploadEnabled), Optional.ToNullable(isNoStorageEnabled), Optional.ToNullable(eTag), appId.Value, Optional.ToNullable(isV1Enabled), Optional.ToNullable(isV3Enabled), Optional.ToNullable(isSecureSiteEnabled), Optional.ToList(trustedOrigins), Optional.ToNullable(isWebChatSpeechEnabled), Optional.ToNullable(isWebchatPreviewEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebChatSite(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebChatSite(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.cs index 5fc58f4ee29d..b51fc085a31b 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Models/WebChatSite.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.BotService.Models /// A site for the Webchat channel. public partial class WebChatSite : BotChannelSite { - /// Initializes a new instance of WebChatSite. + /// Initializes a new instance of . /// Site name. /// Whether this site is enabled for DirectLine channel. /// is null. @@ -24,7 +24,7 @@ public WebChatSite(string siteName, bool isEnabled) : base(siteName, isEnabled) Argument.AssertNotNull(siteName, nameof(siteName)); } - /// Initializes a new instance of WebChatSite. + /// Initializes a new instance of . /// Tenant Id. /// Site Id. /// Site name. @@ -44,7 +44,13 @@ public WebChatSite(string siteName, bool isEnabled) : base(siteName, isEnabled) /// List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. /// Whether this site is enabled for Webchat Speech. /// Whether this site is enabled for preview versions of Webchat. - internal WebChatSite(Guid? tenantId, string siteId, string siteName, string key, string key2, bool isEnabled, bool? isTokenEnabled, bool? isEndpointParametersEnabled, bool? isDetailedLoggingEnabled, bool? isBlockUserUploadEnabled, bool? isNoStorageEnabled, ETag? etag, string appId, bool? isV1Enabled, bool? isV3Enabled, bool? isSecureSiteEnabled, IList trustedOrigins, bool? isWebChatSpeechEnabled, bool? isWebchatPreviewEnabled) : base(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins, isWebChatSpeechEnabled, isWebchatPreviewEnabled) + /// Keeps track of any properties unknown to the library. + internal WebChatSite(Guid? tenantId, string siteId, string siteName, string key, string key2, bool isEnabled, bool? isTokenEnabled, bool? isEndpointParametersEnabled, bool? isDetailedLoggingEnabled, bool? isBlockUserUploadEnabled, bool? isNoStorageEnabled, ETag? etag, string appId, bool? isV1Enabled, bool? isV3Enabled, bool? isSecureSiteEnabled, IList trustedOrigins, bool? isWebChatSpeechEnabled, bool? isWebchatPreviewEnabled, Dictionary serializedAdditionalRawData) : base(tenantId, siteId, siteName, key, key2, isEnabled, isTokenEnabled, isEndpointParametersEnabled, isDetailedLoggingEnabled, isBlockUserUploadEnabled, isNoStorageEnabled, etag, appId, isV1Enabled, isV3Enabled, isSecureSiteEnabled, trustedOrigins, isWebChatSpeechEnabled, isWebchatPreviewEnabled, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal WebChatSite() { } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotConnectionRestOperations.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotConnectionRestOperations.cs index d95af3596d77..1a5e2e39cf01 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotConnectionRestOperations.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotConnectionRestOperations.cs @@ -208,9 +208,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -302,9 +300,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotsRestOperations.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotsRestOperations.cs index 17507215a1d8..341158dc5493 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotsRestOperations.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/BotsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -517,9 +513,7 @@ internal HttpMessage CreateGetCheckNameAvailabilityRequest(BotServiceNameAvailab request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/ChannelsRestOperations.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/ChannelsRestOperations.cs index 82f395c4377e..f95a4d8a1814 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/ChannelsRestOperations.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/ChannelsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -148,9 +146,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/DirectLineRestOperations.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/DirectLineRestOperations.cs index f56a592ecb53..747c3a4acd24 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/DirectLineRestOperations.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/DirectLineRestOperations.cs @@ -57,9 +57,7 @@ internal HttpMessage CreateRegenerateKeysRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 0112a65a5157..000f3c11811e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/QnAMakerEndpointKeysRestOperations.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/QnAMakerEndpointKeysRestOperations.cs index 82c5b263ce4f..389092cf51a6 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/QnAMakerEndpointKeysRestOperations.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/RestOperations/QnAMakerEndpointKeysRestOperations.cs @@ -51,9 +51,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, GetBotServiceQnAMak request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ArmCdnModelFactory.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ArmCdnModelFactory.cs index 060c8abe029e..b0520090ff3a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ArmCdnModelFactory.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ArmCdnModelFactory.cs @@ -19,7 +19,17 @@ namespace Azure.ResourceManager.Cdn.Models /// Model factory for models. public static partial class ArmCdnModelFactory { - /// Initializes a new instance of EndpointNameAvailabilityResult. + /// Initializes a new instance of . + /// The resource name to validate. + /// The type of the resource whose name is to be validated. + /// Indicates the endpoint name reuse scope. The default value is TenantReuse. + /// A new instance for mocking. + public static EndpointNameAvailabilityContent EndpointNameAvailabilityContent(string name = null, CdnResourceType resourceType = default, DomainNameLabelScope? autoGeneratedDomainNameLabelScope = null) + { + return new EndpointNameAvailabilityContent(name, resourceType, autoGeneratedDomainNameLabelScope, default); + } + + /// Initializes a new instance of . /// Indicates whether the name is available. /// Returns the available hostname generated based on the AutoGeneratedDomainNameLabelScope when the name is available, otherwise it returns empty string. /// The reason why the name is not available. @@ -27,10 +37,10 @@ public static partial class ArmCdnModelFactory /// A new instance for mocking. public static EndpointNameAvailabilityResult EndpointNameAvailabilityResult(bool? nameAvailable = null, string availableHostname = null, string reason = null, string message = null) { - return new EndpointNameAvailabilityResult(nameAvailable, availableHostname, reason, message); + return new EndpointNameAvailabilityResult(nameAvailable, availableHostname, reason, message, default); } - /// Initializes a new instance of FrontDoorUsage. + /// Initializes a new instance of . /// Resource identifier. /// An enum describing the unit of measurement. /// The current value of the usage. @@ -39,29 +49,29 @@ public static EndpointNameAvailabilityResult EndpointNameAvailabilityResult(bool /// A new instance for mocking. public static FrontDoorUsage FrontDoorUsage(ResourceIdentifier id = null, FrontDoorUsageUnit unit = default, long currentValue = default, long limit = default, FrontDoorUsageResourceName name = null) { - return new FrontDoorUsage(id, unit, currentValue, limit, name); + return new FrontDoorUsage(id, unit, currentValue, limit, name, default); } - /// Initializes a new instance of FrontDoorUsageResourceName. + /// Initializes a new instance of . /// A string describing the resource name. /// A localized string describing the resource name. /// A new instance for mocking. public static FrontDoorUsageResourceName FrontDoorUsageResourceName(string value = null, string localizedValue = null) { - return new FrontDoorUsageResourceName(value, localizedValue); + return new FrontDoorUsageResourceName(value, localizedValue, default); } - /// Initializes a new instance of CdnNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates whether the name is available. /// The reason why the name is not available. /// The detailed error message describing why the name is not available. /// A new instance for mocking. public static CdnNameAvailabilityResult CdnNameAvailabilityResult(bool? nameAvailable = null, string reason = null, string message = null) { - return new CdnNameAvailabilityResult(nameAvailable, reason, message); + return new CdnNameAvailabilityResult(nameAvailable, reason, message, default); } - /// Initializes a new instance of FrontDoorCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -78,19 +88,30 @@ public static CdnNameAvailabilityResult CdnNameAvailabilityResult(bool? nameAvai /// A new instance for mocking. public static FrontDoorCustomDomainData FrontDoorCustomDomainData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string profileName = null, FrontDoorCustomDomainHttpsContent tlsSettings = null, ResourceIdentifier dnsZoneId = null, ResourceIdentifier preValidatedCustomDomainResourceId = null, FrontDoorProvisioningState? provisioningState = null, FrontDoorDeploymentStatus? deploymentStatus = null, DomainValidationState? domainValidationState = null, string hostName = null, DomainValidationProperties validationProperties = null) { - return new FrontDoorCustomDomainData(id, name, resourceType, systemData, profileName, tlsSettings, dnsZoneId != null ? ResourceManagerModelFactory.WritableSubResource(dnsZoneId) : null, preValidatedCustomDomainResourceId != null ? new FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(preValidatedCustomDomainResourceId) : null, provisioningState, deploymentStatus, domainValidationState, hostName, validationProperties); + return new FrontDoorCustomDomainData(id, name, resourceType, systemData, profileName, tlsSettings, dnsZoneId != null ? ResourceManagerModelFactory.WritableSubResource(dnsZoneId) : null, preValidatedCustomDomainResourceId != null ? new FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(preValidatedCustomDomainResourceId, new Dictionary()) : null, provisioningState, deploymentStatus, domainValidationState, hostName, validationProperties, default); } - /// Initializes a new instance of DomainValidationProperties. + /// Initializes a new instance of . /// Challenge used for DNS TXT record or file based validation. /// The date time that the token expires. /// A new instance for mocking. public static DomainValidationProperties DomainValidationProperties(string validationToken = null, DateTimeOffset? expiresOn = null) { - return new DomainValidationProperties(validationToken, expiresOn); + return new DomainValidationProperties(validationToken, expiresOn, default); + } + + /// Initializes a new instance of . + /// The name of the profile which holds the domain. + /// The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. + /// Resource reference to the Azure DNS zone. + /// Resource reference to the Azure resource where custom domain ownership was prevalidated. + /// A new instance for mocking. + public static FrontDoorCustomDomainPatch FrontDoorCustomDomainPatch(string profileName = null, FrontDoorCustomDomainHttpsContent tlsSettings = null, ResourceIdentifier dnsZoneId = null, ResourceIdentifier preValidatedCustomDomainResourceId = null) + { + return new FrontDoorCustomDomainPatch(profileName, tlsSettings, dnsZoneId != null ? ResourceManagerModelFactory.WritableSubResource(dnsZoneId) : null, preValidatedCustomDomainResourceId != null ? new FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(preValidatedCustomDomainResourceId, new Dictionary()) : null, default); } - /// Initializes a new instance of FrontDoorEndpointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -108,20 +129,32 @@ public static FrontDoorEndpointData FrontDoorEndpointData(ResourceIdentifier id { tags ??= new Dictionary(); - return new FrontDoorEndpointData(id, name, resourceType, systemData, tags, location, profileName, enabledState, provisioningState, deploymentStatus, hostName, autoGeneratedDomainNameLabelScope); + return new FrontDoorEndpointData(id, name, resourceType, systemData, tags, location, profileName, enabledState, provisioningState, deploymentStatus, hostName, autoGeneratedDomainNameLabelScope, default); + } + + /// Initializes a new instance of . + /// Endpoint tags. + /// The name of the profile which holds the endpoint. + /// Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. + /// A new instance for mocking. + public static FrontDoorEndpointPatch FrontDoorEndpointPatch(IDictionary tags = null, string profileName = null, EnabledState? enabledState = null) + { + tags ??= new Dictionary(); + + return new FrontDoorEndpointPatch(tags, profileName, enabledState, default); } - /// Initializes a new instance of ValidateCustomDomainResult. + /// Initializes a new instance of . /// Indicates whether the custom domain is valid or not. /// The reason why the custom domain is not valid. /// Error message describing why the custom domain is not valid. /// A new instance for mocking. public static ValidateCustomDomainResult ValidateCustomDomainResult(bool? isCustomDomainValid = null, string reason = null, string message = null) { - return new ValidateCustomDomainResult(isCustomDomainValid, reason, message); + return new ValidateCustomDomainResult(isCustomDomainValid, reason, message, default); } - /// Initializes a new instance of FrontDoorOriginGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -136,10 +169,22 @@ public static ValidateCustomDomainResult ValidateCustomDomainResult(bool? isCust /// A new instance for mocking. public static FrontDoorOriginGroupData FrontDoorOriginGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string profileName = null, LoadBalancingSettings loadBalancingSettings = null, HealthProbeSettings healthProbeSettings = null, int? trafficRestorationTimeInMinutes = null, EnabledState? sessionAffinityState = null, FrontDoorProvisioningState? provisioningState = null, FrontDoorDeploymentStatus? deploymentStatus = null) { - return new FrontDoorOriginGroupData(id, name, resourceType, systemData, profileName, loadBalancingSettings, healthProbeSettings, trafficRestorationTimeInMinutes, sessionAffinityState, provisioningState, deploymentStatus); + return new FrontDoorOriginGroupData(id, name, resourceType, systemData, profileName, loadBalancingSettings, healthProbeSettings, trafficRestorationTimeInMinutes, sessionAffinityState, provisioningState, deploymentStatus, default); + } + + /// Initializes a new instance of . + /// The name of the profile which holds the origin group. + /// Load balancing settings for a backend pool. + /// Health probe settings to the origin that is used to determine the health of the origin. + /// Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + /// Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. + /// A new instance for mocking. + public static FrontDoorOriginGroupPatch FrontDoorOriginGroupPatch(string profileName = null, LoadBalancingSettings loadBalancingSettings = null, HealthProbeSettings healthProbeSettings = null, int? trafficRestorationTimeInMinutes = null, EnabledState? sessionAffinityState = null) + { + return new FrontDoorOriginGroupPatch(profileName, loadBalancingSettings, healthProbeSettings, trafficRestorationTimeInMinutes, sessionAffinityState, default); } - /// Initializes a new instance of FrontDoorOriginData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -160,10 +205,28 @@ public static FrontDoorOriginGroupData FrontDoorOriginGroupData(ResourceIdentifi /// A new instance for mocking. public static FrontDoorOriginData FrontDoorOriginData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string originGroupName = null, ResourceIdentifier originId = null, string hostName = null, int? httpPort = null, int? httpsPort = null, string originHostHeader = null, int? priority = null, int? weight = null, SharedPrivateLinkResourceProperties sharedPrivateLinkResource = null, EnabledState? enabledState = null, bool? enforceCertificateNameCheck = null, FrontDoorProvisioningState? provisioningState = null, FrontDoorDeploymentStatus? deploymentStatus = null) { - return new FrontDoorOriginData(id, name, resourceType, systemData, originGroupName, originId != null ? ResourceManagerModelFactory.WritableSubResource(originId) : null, hostName, httpPort, httpsPort, originHostHeader, priority, weight, sharedPrivateLinkResource, enabledState, enforceCertificateNameCheck, provisioningState, deploymentStatus); + return new FrontDoorOriginData(id, name, resourceType, systemData, originGroupName, originId != null ? ResourceManagerModelFactory.WritableSubResource(originId) : null, hostName, httpPort, httpsPort, originHostHeader, priority, weight, sharedPrivateLinkResource, enabledState, enforceCertificateNameCheck, provisioningState, deploymentStatus, default); + } + + /// Initializes a new instance of . + /// The name of the origin group which contains this origin. + /// Resource reference to the Azure origin resource. + /// The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + /// The value of the HTTP port. Must be between 1 and 65535. + /// The value of the HTTPS port. Must be between 1 and 65535. + /// The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. + /// Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. + /// Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. + /// The properties of the private link resource for private origin. + /// Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. + /// Whether to enable certificate name check at origin level. + /// A new instance for mocking. + public static FrontDoorOriginPatch FrontDoorOriginPatch(string originGroupName = null, ResourceIdentifier originId = null, string hostName = null, int? httpPort = null, int? httpsPort = null, string originHostHeader = null, int? priority = null, int? weight = null, SharedPrivateLinkResourceProperties sharedPrivateLinkResource = null, EnabledState? enabledState = null, bool? enforceCertificateNameCheck = null) + { + return new FrontDoorOriginPatch(originGroupName, originId != null ? ResourceManagerModelFactory.WritableSubResource(originId) : null, hostName, httpPort, httpsPort, originHostHeader, priority, weight, sharedPrivateLinkResource, enabledState, enforceCertificateNameCheck, default); } - /// Initializes a new instance of FrontDoorRouteData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -190,19 +253,43 @@ public static FrontDoorRouteData FrontDoorRouteData(ResourceIdentifier id = null supportedProtocols ??= new List(); patternsToMatch ??= new List(); - return new FrontDoorRouteData(id, name, resourceType, systemData, endpointName, customDomains?.ToList(), originGroupId != null ? ResourceManagerModelFactory.WritableSubResource(originGroupId) : null, originPath, ruleSets?.ToList(), supportedProtocols?.ToList(), patternsToMatch?.ToList(), cacheConfiguration, forwardingProtocol, linkToDefaultDomain, httpsRedirect, enabledState, provisioningState, deploymentStatus); + return new FrontDoorRouteData(id, name, resourceType, systemData, endpointName, customDomains?.ToList(), originGroupId != null ? ResourceManagerModelFactory.WritableSubResource(originGroupId) : null, originPath, ruleSets?.ToList(), supportedProtocols?.ToList(), patternsToMatch?.ToList(), cacheConfiguration, forwardingProtocol, linkToDefaultDomain, httpsRedirect, enabledState, provisioningState, deploymentStatus, default); } - /// Initializes a new instance of FrontDoorActivatedResourceInfo. + /// Initializes a new instance of . /// Resource ID. /// Whether the resource is active or inactive. /// A new instance for mocking. public static FrontDoorActivatedResourceInfo FrontDoorActivatedResourceInfo(ResourceIdentifier id = null, bool? isActive = null) { - return new FrontDoorActivatedResourceInfo(id, isActive); + return new FrontDoorActivatedResourceInfo(id, isActive, default); } - /// Initializes a new instance of FrontDoorRuleSetData. + /// Initializes a new instance of . + /// The name of the endpoint which holds the route. + /// Domains referenced by this endpoint. + /// A reference to the origin group. + /// A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + /// rule sets referenced by this endpoint. + /// List of supported protocols for this route. + /// The route patterns of the rule. + /// The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + /// Protocol this rule will use when forwarding traffic to backends. + /// whether this route will be linked to the default endpoint domain. + /// Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. + /// Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. + /// A new instance for mocking. + public static FrontDoorRoutePatch FrontDoorRoutePatch(string endpointName = null, IEnumerable customDomains = null, ResourceIdentifier originGroupId = null, string originPath = null, IEnumerable ruleSets = null, IEnumerable supportedProtocols = null, IEnumerable patternsToMatch = null, FrontDoorRouteCacheConfiguration cacheConfiguration = null, ForwardingProtocol? forwardingProtocol = null, LinkToDefaultDomain? linkToDefaultDomain = null, HttpsRedirect? httpsRedirect = null, EnabledState? enabledState = null) + { + customDomains ??= new List(); + ruleSets ??= new List(); + supportedProtocols ??= new List(); + patternsToMatch ??= new List(); + + return new FrontDoorRoutePatch(endpointName, customDomains?.ToList(), originGroupId != null ? ResourceManagerModelFactory.WritableSubResource(originGroupId) : null, originPath, ruleSets?.ToList(), supportedProtocols?.ToList(), patternsToMatch?.ToList(), cacheConfiguration, forwardingProtocol, linkToDefaultDomain, httpsRedirect, enabledState, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -213,10 +300,10 @@ public static FrontDoorActivatedResourceInfo FrontDoorActivatedResourceInfo(Reso /// A new instance for mocking. public static FrontDoorRuleSetData FrontDoorRuleSetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, FrontDoorProvisioningState? provisioningState = null, FrontDoorDeploymentStatus? deploymentStatus = null, string profileName = null) { - return new FrontDoorRuleSetData(id, name, resourceType, systemData, provisioningState, deploymentStatus, profileName); + return new FrontDoorRuleSetData(id, name, resourceType, systemData, provisioningState, deploymentStatus, profileName, default); } - /// Initializes a new instance of FrontDoorRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -242,10 +329,33 @@ public static FrontDoorRuleData FrontDoorRuleData(ResourceIdentifier id = null, conditions ??= new List(); actions ??= new List(); - return new FrontDoorRuleData(id, name, resourceType, systemData, ruleSetName, order, conditions?.ToList(), actions?.ToList(), matchProcessingBehavior, provisioningState, deploymentStatus); + return new FrontDoorRuleData(id, name, resourceType, systemData, ruleSetName, order, conditions?.ToList(), actions?.ToList(), matchProcessingBehavior, provisioningState, deploymentStatus, default); + } + + /// Initializes a new instance of . + /// The name of the rule set containing the rule. + /// The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + /// + /// A list of conditions that must be matched for the actions to be executed + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// + /// + /// A list of actions that are executed when all the conditions of a rule are satisfied. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. + /// A new instance for mocking. + public static FrontDoorRulePatch FrontDoorRulePatch(string ruleSetName = null, int? order = null, IEnumerable conditions = null, IEnumerable actions = null, MatchProcessingBehavior? matchProcessingBehavior = null) + { + conditions ??= new List(); + actions ??= new List(); + + return new FrontDoorRulePatch(ruleSetName, order, conditions?.ToList(), actions?.ToList(), matchProcessingBehavior, default); } - /// Initializes a new instance of FrontDoorSecurityPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -261,10 +371,10 @@ public static FrontDoorRuleData FrontDoorRuleData(ResourceIdentifier id = null, /// A new instance for mocking. public static FrontDoorSecurityPolicyData FrontDoorSecurityPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, FrontDoorProvisioningState? provisioningState = null, FrontDoorDeploymentStatus? deploymentStatus = null, string profileName = null, SecurityPolicyProperties properties = null) { - return new FrontDoorSecurityPolicyData(id, name, resourceType, systemData, provisioningState, deploymentStatus, profileName, properties); + return new FrontDoorSecurityPolicyData(id, name, resourceType, systemData, provisioningState, deploymentStatus, profileName, properties, default); } - /// Initializes a new instance of FrontDoorSecretData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -280,10 +390,10 @@ public static FrontDoorSecurityPolicyData FrontDoorSecurityPolicyData(ResourceId /// A new instance for mocking. public static FrontDoorSecretData FrontDoorSecretData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, FrontDoorProvisioningState? provisioningState = null, FrontDoorDeploymentStatus? deploymentStatus = null, string profileName = null, FrontDoorSecretProperties properties = null) { - return new FrontDoorSecretData(id, name, resourceType, systemData, provisioningState, deploymentStatus, profileName, properties); + return new FrontDoorSecretData(id, name, resourceType, systemData, provisioningState, deploymentStatus, profileName, properties, default); } - /// Initializes a new instance of MetricsResponse. + /// Initializes a new instance of . /// /// /// @@ -293,10 +403,10 @@ public static MetricsResponse MetricsResponse(DateTimeOffset? dateTimeBegin = nu { series ??= new List(); - return new MetricsResponse(dateTimeBegin, dateTimeEnd, granularity, series?.ToList()); + return new MetricsResponse(dateTimeBegin, dateTimeEnd, granularity, series?.ToList(), default); } - /// Initializes a new instance of MetricsResponseSeriesItem. + /// Initializes a new instance of . /// /// /// @@ -307,28 +417,28 @@ public static MetricsResponseSeriesItem MetricsResponseSeriesItem(string metric groups ??= new List(); data ??= new List(); - return new MetricsResponseSeriesItem(metric, unit, groups?.ToList(), data?.ToList()); + return new MetricsResponseSeriesItem(metric, unit, groups?.ToList(), data?.ToList(), default); } - /// Initializes a new instance of MetricsResponseSeriesPropertiesItemsItem. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static MetricsResponseSeriesPropertiesItemsItem MetricsResponseSeriesPropertiesItemsItem(string name = null, string value = null) { - return new MetricsResponseSeriesPropertiesItemsItem(name, value); + return new MetricsResponseSeriesPropertiesItemsItem(name, value, default); } - /// Initializes a new instance of Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(DateTimeOffset? dateOn = null, float? value = null) { - return new Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(dateOn, value); + return new Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(dateOn, value, default); } - /// Initializes a new instance of RankingsResponse. + /// Initializes a new instance of . /// /// /// @@ -337,10 +447,10 @@ public static RankingsResponse RankingsResponse(DateTimeOffset? dateTimeBegin = { tables ??= new List(); - return new RankingsResponse(dateTimeBegin, dateTimeEnd, tables?.ToList()); + return new RankingsResponse(dateTimeBegin, dateTimeEnd, tables?.ToList(), default); } - /// Initializes a new instance of RankingsResponseTablesItem. + /// Initializes a new instance of . /// /// /// A new instance for mocking. @@ -348,10 +458,10 @@ public static RankingsResponseTablesItem RankingsResponseTablesItem(string ranki { data ??= new List(); - return new RankingsResponseTablesItem(ranking, data?.ToList()); + return new RankingsResponseTablesItem(ranking, data?.ToList(), default); } - /// Initializes a new instance of RankingsResponseTablesPropertiesItemsItem. + /// Initializes a new instance of . /// /// /// A new instance for mocking. @@ -359,20 +469,20 @@ public static RankingsResponseTablesPropertiesItemsItem RankingsResponseTablesPr { metrics ??= new List(); - return new RankingsResponseTablesPropertiesItemsItem(name, metrics?.ToList()); + return new RankingsResponseTablesPropertiesItemsItem(name, metrics?.ToList(), default); } - /// Initializes a new instance of RankingsResponseTablesPropertiesItemsMetricsItem. + /// Initializes a new instance of . /// /// /// /// A new instance for mocking. public static RankingsResponseTablesPropertiesItemsMetricsItem RankingsResponseTablesPropertiesItemsMetricsItem(string metric = null, long? value = null, float? percentage = null) { - return new RankingsResponseTablesPropertiesItemsMetricsItem(metric, value, percentage); + return new RankingsResponseTablesPropertiesItemsMetricsItem(metric, value, percentage, default); } - /// Initializes a new instance of ContinentsResponse. + /// Initializes a new instance of . /// /// /// A new instance for mocking. @@ -381,27 +491,27 @@ public static ContinentsResponse ContinentsResponse(IEnumerable(); countryOrRegions ??= new List(); - return new ContinentsResponse(continents?.ToList(), countryOrRegions?.ToList()); + return new ContinentsResponse(continents?.ToList(), countryOrRegions?.ToList(), default); } - /// Initializes a new instance of ContinentsResponseContinentsItem. + /// Initializes a new instance of . /// /// A new instance for mocking. public static ContinentsResponseContinentsItem ContinentsResponseContinentsItem(string id = null) { - return new ContinentsResponseContinentsItem(id); + return new ContinentsResponseContinentsItem(id, default); } - /// Initializes a new instance of ContinentsResponseCountryOrRegionsItem. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static ContinentsResponseCountryOrRegionsItem ContinentsResponseCountryOrRegionsItem(string id = null, string continentId = null) { - return new ContinentsResponseCountryOrRegionsItem(id, continentId); + return new ContinentsResponseCountryOrRegionsItem(id, continentId, default); } - /// Initializes a new instance of ResourcesResponse. + /// Initializes a new instance of . /// /// /// A new instance for mocking. @@ -410,10 +520,10 @@ public static ResourcesResponse ResourcesResponse(IEnumerable(); customDomains ??= new List(); - return new ResourcesResponse(endpoints?.ToList(), customDomains?.ToList()); + return new ResourcesResponse(endpoints?.ToList(), customDomains?.ToList(), default); } - /// Initializes a new instance of ResourcesResponseEndpointsItem. + /// Initializes a new instance of . /// /// /// @@ -423,10 +533,10 @@ public static ResourcesResponseEndpointsItem ResourcesResponseEndpointsItem(stri { customDomains ??= new List(); - return new ResourcesResponseEndpointsItem(id, name, history, customDomains?.ToList()); + return new ResourcesResponseEndpointsItem(id, name, history, customDomains?.ToList(), default); } - /// Initializes a new instance of ResourcesResponseEndpointsPropertiesItemsItem. + /// Initializes a new instance of . /// /// /// @@ -434,10 +544,10 @@ public static ResourcesResponseEndpointsItem ResourcesResponseEndpointsItem(stri /// A new instance for mocking. public static ResourcesResponseEndpointsPropertiesItemsItem ResourcesResponseEndpointsPropertiesItemsItem(string id = null, string name = null, string endpointId = null, bool? history = null) { - return new ResourcesResponseEndpointsPropertiesItemsItem(id, name, endpointId, history); + return new ResourcesResponseEndpointsPropertiesItemsItem(id, name, endpointId, history, default); } - /// Initializes a new instance of ResourcesResponseCustomDomainsItem. + /// Initializes a new instance of . /// /// /// @@ -445,10 +555,10 @@ public static ResourcesResponseEndpointsPropertiesItemsItem ResourcesResponseEnd /// A new instance for mocking. public static ResourcesResponseCustomDomainsItem ResourcesResponseCustomDomainsItem(string id = null, string name = null, string endpointId = null, bool? history = null) { - return new ResourcesResponseCustomDomainsItem(id, name, endpointId, history); + return new ResourcesResponseCustomDomainsItem(id, name, endpointId, history, default); } - /// Initializes a new instance of WafMetricsResponse. + /// Initializes a new instance of . /// /// /// @@ -458,10 +568,10 @@ public static WafMetricsResponse WafMetricsResponse(DateTimeOffset? dateTimeBegi { series ??= new List(); - return new WafMetricsResponse(dateTimeBegin, dateTimeEnd, granularity, series?.ToList()); + return new WafMetricsResponse(dateTimeBegin, dateTimeEnd, granularity, series?.ToList(), default); } - /// Initializes a new instance of WafMetricsResponseSeriesItem. + /// Initializes a new instance of . /// /// /// @@ -472,28 +582,28 @@ public static WafMetricsResponseSeriesItem WafMetricsResponseSeriesItem(string m groups ??= new List(); data ??= new List(); - return new WafMetricsResponseSeriesItem(metric, unit, groups?.ToList(), data?.ToList()); + return new WafMetricsResponseSeriesItem(metric, unit, groups?.ToList(), data?.ToList(), default); } - /// Initializes a new instance of WafMetricsResponseSeriesPropertiesItemsItem. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static WafMetricsResponseSeriesPropertiesItemsItem WafMetricsResponseSeriesPropertiesItemsItem(string name = null, string value = null) { - return new WafMetricsResponseSeriesPropertiesItemsItem(name, value); + return new WafMetricsResponseSeriesPropertiesItemsItem(name, value, default); } - /// Initializes a new instance of Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(DateTimeOffset? dateOn = null, float? value = null) { - return new Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(dateOn, value); + return new Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(dateOn, value, default); } - /// Initializes a new instance of WafRankingsResponse. + /// Initializes a new instance of . /// /// /// @@ -504,10 +614,10 @@ public static WafRankingsResponse WafRankingsResponse(DateTimeOffset? dateTimeBe groups ??= new List(); data ??= new List(); - return new WafRankingsResponse(dateTimeBegin, dateTimeEnd, groups?.ToList(), data?.ToList()); + return new WafRankingsResponse(dateTimeBegin, dateTimeEnd, groups?.ToList(), data?.ToList(), default); } - /// Initializes a new instance of WafRankingsResponseDataItem. + /// Initializes a new instance of . /// /// /// A new instance for mocking. @@ -516,20 +626,20 @@ public static WafRankingsResponseDataItem WafRankingsResponseDataItem(IEnumerabl groupValues ??= new List(); metrics ??= new List(); - return new WafRankingsResponseDataItem(groupValues?.ToList(), metrics?.ToList()); + return new WafRankingsResponseDataItem(groupValues?.ToList(), metrics?.ToList(), default); } - /// Initializes a new instance of ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. + /// Initializes a new instance of . /// /// /// /// A new instance for mocking. public static ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(string metric = null, long? value = null, double? percentage = null) { - return new ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(metric, value, percentage); + return new ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(metric, value, percentage, default); } - /// Initializes a new instance of ProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -547,28 +657,28 @@ public static ProfileData ProfileData(ResourceIdentifier id = null, string name { tags ??= new Dictionary(); - return new ProfileData(id, name, resourceType, systemData, tags, location, skuName != null ? new CdnSku(skuName) : null, kind, resourceState, provisioningState, frontDoorId, originResponseTimeoutSeconds); + return new ProfileData(id, name, resourceType, systemData, tags, location, skuName != null ? new CdnSku(skuName, new Dictionary()) : null, kind, resourceState, provisioningState, frontDoorId, originResponseTimeoutSeconds, default); } - /// Initializes a new instance of SsoUri. + /// Initializes a new instance of . /// The URI used to login to the supplemental portal. /// A new instance for mocking. public static SsoUri SsoUri(Uri availableSsoUri = null) { - return new SsoUri(availableSsoUri); + return new SsoUri(availableSsoUri, default); } - /// Initializes a new instance of SupportedOptimizationTypesListResult. + /// Initializes a new instance of . /// Supported optimization types for a profile. /// A new instance for mocking. public static SupportedOptimizationTypesListResult SupportedOptimizationTypesListResult(IEnumerable supportedOptimizationTypes = null) { supportedOptimizationTypes ??= new List(); - return new SupportedOptimizationTypesListResult(supportedOptimizationTypes?.ToList()); + return new SupportedOptimizationTypesListResult(supportedOptimizationTypes?.ToList(), default); } - /// Initializes a new instance of CdnUsage. + /// Initializes a new instance of . /// Resource type for which the usage is provided. /// Unit of the usage. e.g. count. /// Actual value of usage on the specified resource type. @@ -576,10 +686,10 @@ public static SupportedOptimizationTypesListResult SupportedOptimizationTypesLis /// A new instance for mocking. public static CdnUsage CdnUsage(string resourceType = null, CdnUsageUnit? unit = null, int? currentValue = null, int? limit = null) { - return new CdnUsage(resourceType, unit, currentValue, limit); + return new CdnUsage(resourceType, unit, currentValue, limit, default); } - /// Initializes a new instance of CdnEndpointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -617,10 +727,10 @@ public static CdnEndpointData CdnEndpointData(ResourceIdentifier id = null, stri originGroups ??= new List(); customDomains ??= new List(); - return new CdnEndpointData(id, name, resourceType, systemData, tags, location, originPath, contentTypesToCompress?.ToList(), originHostHeader, isCompressionEnabled, isHttpAllowed, isHttpsAllowed, queryStringCachingBehavior, optimizationType, probePath, geoFilters?.ToList(), defaultOriginGroupId != null ? new EndpointPropertiesUpdateParametersDefaultOriginGroup(defaultOriginGroupId) : null, uriSigningKeys?.ToList(), deliveryPolicy, webApplicationFirewallPolicyLinkId != null ? new EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(webApplicationFirewallPolicyLinkId) : null, hostName, origins?.ToList(), originGroups?.ToList(), customDomains?.ToList(), resourceState, provisioningState); + return new CdnEndpointData(id, name, resourceType, systemData, tags, location, originPath, contentTypesToCompress?.ToList(), originHostHeader, isCompressionEnabled, isHttpAllowed, isHttpsAllowed, queryStringCachingBehavior, optimizationType, probePath, geoFilters?.ToList(), defaultOriginGroupId != null ? new EndpointPropertiesUpdateParametersDefaultOriginGroup(defaultOriginGroupId, new Dictionary()) : null, uriSigningKeys?.ToList(), deliveryPolicy, webApplicationFirewallPolicyLinkId != null ? new EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(webApplicationFirewallPolicyLinkId, new Dictionary()) : null, hostName, origins?.ToList(), originGroups?.ToList(), customDomains?.ToList(), resourceState, provisioningState, default); } - /// Initializes a new instance of DeepCreatedOrigin. + /// Initializes a new instance of . /// Origin name which must be unique within the endpoint. /// The address of the origin. It can be a domain name, IPv4 address, or IPv6 address. This should be unique across all origins in an endpoint. /// The value of the HTTP port. Must be between 1 and 65535. @@ -637,10 +747,10 @@ public static CdnEndpointData CdnEndpointData(ResourceIdentifier id = null, stri /// A new instance for mocking. public static DeepCreatedOrigin DeepCreatedOrigin(string name = null, string hostName = null, int? httpPort = null, int? httpsPort = null, string originHostHeader = null, int? priority = null, int? weight = null, bool? enabled = null, string privateLinkAlias = null, ResourceIdentifier privateLinkResourceId = null, string privateLinkLocation = null, string privateLinkApprovalMessage = null, PrivateEndpointStatus? privateEndpointStatus = null) { - return new DeepCreatedOrigin(name, hostName, httpPort, httpsPort, originHostHeader, priority, weight, enabled, privateLinkAlias, privateLinkResourceId, privateLinkLocation, privateLinkApprovalMessage, privateEndpointStatus); + return new DeepCreatedOrigin(name, hostName, httpPort, httpsPort, originHostHeader, priority, weight, enabled, privateLinkAlias, privateLinkResourceId, privateLinkLocation, privateLinkApprovalMessage, privateEndpointStatus, default); } - /// Initializes a new instance of CdnCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -659,10 +769,10 @@ public static DeepCreatedOrigin DeepCreatedOrigin(string name = null, string hos /// A new instance for mocking. public static CdnCustomDomainData CdnCustomDomainData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string hostName = null, CustomDomainResourceState? resourceState = null, CustomHttpsProvisioningState? customHttpsProvisioningState = null, CustomHttpsAvailabilityState? customHttpsAvailabilityState = null, CustomDomainHttpsContent customDomainHttpsContent = null, string validationData = null, CustomHttpsProvisioningState? provisioningState = null) { - return new CdnCustomDomainData(id, name, resourceType, systemData, hostName, resourceState, customHttpsProvisioningState, customHttpsAvailabilityState, customDomainHttpsContent, validationData, provisioningState); + return new CdnCustomDomainData(id, name, resourceType, systemData, hostName, resourceState, customHttpsProvisioningState, customHttpsAvailabilityState, customDomainHttpsContent, validationData, provisioningState, default); } - /// Initializes a new instance of CdnOriginData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -684,10 +794,10 @@ public static CdnCustomDomainData CdnCustomDomainData(ResourceIdentifier id = nu /// A new instance for mocking. public static CdnOriginData CdnOriginData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string hostName = null, int? httpPort = null, int? httpsPort = null, string originHostHeader = null, int? priority = null, int? weight = null, bool? enabled = null, string privateLinkAlias = null, ResourceIdentifier privateLinkResourceId = null, string privateLinkLocation = null, string privateLinkApprovalMessage = null, OriginResourceState? resourceState = null, OriginProvisioningState? provisioningState = null, PrivateEndpointStatus? privateEndpointStatus = null) { - return new CdnOriginData(id, name, resourceType, systemData, hostName, httpPort, httpsPort, originHostHeader, priority, weight, enabled, privateLinkAlias, privateLinkResourceId, privateLinkLocation, privateLinkApprovalMessage, resourceState, provisioningState, privateEndpointStatus); + return new CdnOriginData(id, name, resourceType, systemData, hostName, httpPort, httpsPort, originHostHeader, priority, weight, enabled, privateLinkAlias, privateLinkResourceId, privateLinkLocation, privateLinkApprovalMessage, resourceState, provisioningState, privateEndpointStatus, default); } - /// Initializes a new instance of CdnOriginGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -703,20 +813,20 @@ public static CdnOriginGroupData CdnOriginGroupData(ResourceIdentifier id = null { origins ??= new List(); - return new CdnOriginGroupData(id, name, resourceType, systemData, healthProbeSettings, origins?.ToList(), trafficRestorationTimeToHealedOrNewEndpointsInMinutes, responseBasedOriginErrorDetectionSettings, resourceState, provisioningState); + return new CdnOriginGroupData(id, name, resourceType, systemData, healthProbeSettings, origins?.ToList(), trafficRestorationTimeToHealedOrNewEndpointsInMinutes, responseBasedOriginErrorDetectionSettings, resourceState, provisioningState, default); } - /// Initializes a new instance of ValidateProbeResult. + /// Initializes a new instance of . /// Indicates whether the probe URL is accepted or not. /// Specifies the error code when the probe url is not accepted. /// The detailed error message describing why the probe URL is not accepted. /// A new instance for mocking. public static ValidateProbeResult ValidateProbeResult(bool? isValid = null, string errorCode = null, string message = null) { - return new ValidateProbeResult(isValid, errorCode, message); + return new ValidateProbeResult(isValid, errorCode, message, default); } - /// Initializes a new instance of EdgeNode. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -727,10 +837,10 @@ public static EdgeNode EdgeNode(ResourceIdentifier id = null, string name = null { ipAddressGroups ??= new List(); - return new EdgeNode(id, name, resourceType, systemData, ipAddressGroups?.ToList()); + return new EdgeNode(id, name, resourceType, systemData, ipAddressGroups?.ToList(), default); } - /// Initializes a new instance of CdnWebApplicationFirewallPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -755,10 +865,10 @@ public static CdnWebApplicationFirewallPolicyData CdnWebApplicationFirewallPolic managedRuleSets ??= new List(); endpointLinks ??= new List(); - return new CdnWebApplicationFirewallPolicyData(id, name, resourceType, systemData, tags, location, etag, skuName != null ? new CdnSku(skuName) : null, policySettings, rateLimitRules != null ? new RateLimitRuleList(rateLimitRules?.ToList()) : null, customRules != null ? new CustomRuleList(customRules?.ToList()) : null, managedRuleSets != null ? new ManagedRuleSetList(managedRuleSets?.ToList()) : null, endpointLinks?.ToList(), provisioningState, resourceState); + return new CdnWebApplicationFirewallPolicyData(id, name, resourceType, systemData, tags, location, etag, skuName != null ? new CdnSku(skuName, new Dictionary()) : null, policySettings, rateLimitRules != null ? new RateLimitRuleList(rateLimitRules?.ToList(), new Dictionary()) : null, customRules != null ? new CustomRuleList(customRules?.ToList(), new Dictionary()) : null, managedRuleSets != null ? new ManagedRuleSetList(managedRuleSets?.ToList(), new Dictionary()) : null, endpointLinks?.ToList(), provisioningState, resourceState, default); } - /// Initializes a new instance of ManagedRuleSetDefinition. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -773,10 +883,10 @@ public static ManagedRuleSetDefinition ManagedRuleSetDefinition(ResourceIdentifi { ruleGroups ??= new List(); - return new ManagedRuleSetDefinition(id, name, resourceType, systemData, skuName != null ? new CdnSku(skuName) : null, provisioningState, ruleSetType, ruleSetVersion, ruleGroups?.ToList()); + return new ManagedRuleSetDefinition(id, name, resourceType, systemData, skuName != null ? new CdnSku(skuName, new Dictionary()) : null, provisioningState, ruleSetType, ruleSetVersion, ruleGroups?.ToList(), default); } - /// Initializes a new instance of ManagedRuleGroupDefinition. + /// Initializes a new instance of . /// Name of the managed rule group. /// Description of the managed rule group. /// List of rules within the managed rule group. @@ -785,28 +895,28 @@ public static ManagedRuleGroupDefinition ManagedRuleGroupDefinition(string ruleG { rules ??= new List(); - return new ManagedRuleGroupDefinition(ruleGroupName, description, rules?.ToList()); + return new ManagedRuleGroupDefinition(ruleGroupName, description, rules?.ToList(), default); } - /// Initializes a new instance of ManagedRuleDefinition. + /// Initializes a new instance of . /// Identifier for the managed rule. /// Describes the functionality of the managed rule. /// A new instance for mocking. public static ManagedRuleDefinition ManagedRuleDefinition(string ruleId = null, string description = null) { - return new ManagedRuleDefinition(ruleId, description); + return new ManagedRuleDefinition(ruleId, description, default); } - /// Initializes a new instance of ManagedCertificateProperties. + /// Initializes a new instance of . /// Subject name in the certificate. /// Certificate expiration date. /// A new instance for mocking. public static ManagedCertificateProperties ManagedCertificateProperties(string subject = null, DateTimeOffset? expiresOn = null) { - return new ManagedCertificateProperties(SecretType.ManagedCertificate, subject, expiresOn); + return new ManagedCertificateProperties(SecretType.ManagedCertificate, subject, expiresOn, default); } - /// Initializes a new instance of CustomerCertificateProperties. + /// Initializes a new instance of . /// Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. /// Version of the secret to be used. /// Whether to use the latest version for the certificate. @@ -820,7 +930,7 @@ public static CustomerCertificateProperties CustomerCertificateProperties(Resour { subjectAlternativeNames ??= new List(); - return new CustomerCertificateProperties(SecretType.CustomerCertificate, secretSourceId != null ? ResourceManagerModelFactory.WritableSubResource(secretSourceId) : null, secretVersion, useLatestVersion, subject, expiresOn, certificateAuthority, subjectAlternativeNames?.ToList(), thumbprint); + return new CustomerCertificateProperties(SecretType.CustomerCertificate, secretSourceId != null ? ResourceManagerModelFactory.WritableSubResource(secretSourceId) : null, secretVersion, useLatestVersion, subject, expiresOn, certificateAuthority, subjectAlternativeNames?.ToList(), thumbprint, default); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs index f3f0562b2e6e..44c19cd3c6e5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnCustomDomainRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnCustomDomainRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CdnCustomDomainResource(Client, CdnCustomDomainData.DeserializeCdnCustomDomainData(e)), _cdnCustomDomainClientDiagnostics, Pipeline, "CdnCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnCustomDomainResource(Client, CdnCustomDomainData.DeserializeCdnCustomDomainData(e)), _cdnCustomDomainClientDiagnostics, Pipeline, "CdnCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnCustomDomainRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnCustomDomainRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CdnCustomDomainResource(Client, CdnCustomDomainData.DeserializeCdnCustomDomainData(e)), _cdnCustomDomainClientDiagnostics, Pipeline, "CdnCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnCustomDomainResource(Client, CdnCustomDomainData.DeserializeCdnCustomDomainData(e)), _cdnCustomDomainClientDiagnostics, Pipeline, "CdnCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainData.cs index b36bb88b7618..6d79615bb927 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class CdnCustomDomainData : ResourceData { - /// Initializes a new instance of CdnCustomDomainData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnCustomDomainData() { } - /// Initializes a new instance of CdnCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +43,8 @@ public CdnCustomDomainData() /// /// Special validation or data may be required when delivering CDN to some regions due to local compliance reasons. E.g. ICP license number of a custom domain is required to deliver content in China. /// Provisioning status of Custom Https of the custom domain. - internal CdnCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string hostName, CustomDomainResourceState? resourceState, CustomHttpsProvisioningState? customHttpsProvisioningState, CustomHttpsAvailabilityState? customHttpsAvailabilityState, CustomDomainHttpsContent customDomainHttpsContent, string validationData, CustomHttpsProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CdnCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string hostName, CustomDomainResourceState? resourceState, CustomHttpsProvisioningState? customHttpsProvisioningState, CustomHttpsAvailabilityState? customHttpsAvailabilityState, CustomDomainHttpsContent customDomainHttpsContent, string validationData, CustomHttpsProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { HostName = hostName; ResourceState = resourceState; @@ -47,6 +53,7 @@ internal CdnCustomDomainData(ResourceIdentifier id, string name, ResourceType re CustomDomainHttpsContent = customDomainHttpsContent; ValidationData = validationData; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The host name of the custom domain. Must be a domain name. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs index b5abe7d63ef5..0178276cc3dc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnEndpointRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnEndpointRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CdnEndpointResource(Client, CdnEndpointData.DeserializeCdnEndpointData(e)), _cdnEndpointClientDiagnostics, Pipeline, "CdnEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnEndpointResource(Client, CdnEndpointData.DeserializeCdnEndpointData(e)), _cdnEndpointClientDiagnostics, Pipeline, "CdnEndpointCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnEndpointRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnEndpointRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CdnEndpointResource(Client, CdnEndpointData.DeserializeCdnEndpointData(e)), _cdnEndpointClientDiagnostics, Pipeline, "CdnEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnEndpointResource(Client, CdnEndpointData.DeserializeCdnEndpointData(e)), _cdnEndpointClientDiagnostics, Pipeline, "CdnEndpointCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointData.cs index 99483bef28e4..271e20d11fcc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.Cdn /// public partial class CdnEndpointData : TrackedResourceData { - /// Initializes a new instance of CdnEndpointData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CdnEndpointData(AzureLocation location) : base(location) { @@ -30,7 +34,7 @@ public CdnEndpointData(AzureLocation location) : base(location) CustomDomains = new ChangeTrackingList(); } - /// Initializes a new instance of CdnEndpointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -57,7 +61,8 @@ public CdnEndpointData(AzureLocation location) : base(location) /// The custom domains under the endpoint. /// Resource status of the endpoint. /// Provisioning status of the endpoint. - internal CdnEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string originPath, IList contentTypesToCompress, string originHostHeader, bool? isCompressionEnabled, bool? isHttpAllowed, bool? isHttpsAllowed, QueryStringCachingBehavior? queryStringCachingBehavior, OptimizationType? optimizationType, string probePath, IList geoFilters, EndpointPropertiesUpdateParametersDefaultOriginGroup defaultOriginGroup, IList uriSigningKeys, EndpointDeliveryPolicy deliveryPolicy, EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink webApplicationFirewallPolicyLink, string hostName, IList origins, IList originGroups, IReadOnlyList customDomains, EndpointResourceState? resourceState, CdnEndpointProvisioningState? provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CdnEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string originPath, IList contentTypesToCompress, string originHostHeader, bool? isCompressionEnabled, bool? isHttpAllowed, bool? isHttpsAllowed, QueryStringCachingBehavior? queryStringCachingBehavior, OptimizationType? optimizationType, string probePath, IList geoFilters, EndpointPropertiesUpdateParametersDefaultOriginGroup defaultOriginGroup, IList uriSigningKeys, EndpointDeliveryPolicy deliveryPolicy, EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink webApplicationFirewallPolicyLink, string hostName, IList origins, IList originGroups, IReadOnlyList customDomains, EndpointResourceState? resourceState, CdnEndpointProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { OriginPath = originPath; ContentTypesToCompress = contentTypesToCompress; @@ -79,6 +84,12 @@ internal CdnEndpointData(ResourceIdentifier id, string name, ResourceType resour CustomDomains = customDomains; ResourceState = resourceState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CdnEndpointData() + { } /// A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs index e5467e558c36..8cb70261a56f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnOriginRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnOriginRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CdnOriginResource(Client, CdnOriginData.DeserializeCdnOriginData(e)), _cdnOriginClientDiagnostics, Pipeline, "CdnOriginCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnOriginResource(Client, CdnOriginData.DeserializeCdnOriginData(e)), _cdnOriginClientDiagnostics, Pipeline, "CdnOriginCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnOriginRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnOriginRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CdnOriginResource(Client, CdnOriginData.DeserializeCdnOriginData(e)), _cdnOriginClientDiagnostics, Pipeline, "CdnOriginCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnOriginResource(Client, CdnOriginData.DeserializeCdnOriginData(e)), _cdnOriginClientDiagnostics, Pipeline, "CdnOriginCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginData.cs index 6aa5d7e220cc..58d7c5d9a3ec 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class CdnOriginData : ResourceData { - /// Initializes a new instance of CdnOriginData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnOriginData() { } - /// Initializes a new instance of CdnOriginData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +46,8 @@ public CdnOriginData() /// Resource status of the origin. /// Provisioning status of the origin. /// The approval status for the connection to the Private Link. - internal CdnOriginData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, bool? enabled, string privateLinkAlias, ResourceIdentifier privateLinkResourceId, string privateLinkLocation, string privateLinkApprovalMessage, OriginResourceState? resourceState, OriginProvisioningState? provisioningState, PrivateEndpointStatus? privateEndpointStatus) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CdnOriginData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, bool? enabled, string privateLinkAlias, ResourceIdentifier privateLinkResourceId, string privateLinkLocation, string privateLinkApprovalMessage, OriginResourceState? resourceState, OriginProvisioningState? provisioningState, PrivateEndpointStatus? privateEndpointStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { HostName = hostName; HttpPort = httpPort; @@ -57,6 +63,7 @@ internal CdnOriginData(ResourceIdentifier id, string name, ResourceType resource ResourceState = resourceState; ProvisioningState = provisioningState; PrivateEndpointStatus = privateEndpointStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs index 6c21ed1514bc..c4de5e115c2e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnOriginGroupRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnOriginGroupRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CdnOriginGroupResource(Client, CdnOriginGroupData.DeserializeCdnOriginGroupData(e)), _cdnOriginGroupClientDiagnostics, Pipeline, "CdnOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnOriginGroupResource(Client, CdnOriginGroupData.DeserializeCdnOriginGroupData(e)), _cdnOriginGroupClientDiagnostics, Pipeline, "CdnOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnOriginGroupRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnOriginGroupRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CdnOriginGroupResource(Client, CdnOriginGroupData.DeserializeCdnOriginGroupData(e)), _cdnOriginGroupClientDiagnostics, Pipeline, "CdnOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnOriginGroupResource(Client, CdnOriginGroupData.DeserializeCdnOriginGroupData(e)), _cdnOriginGroupClientDiagnostics, Pipeline, "CdnOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupData.cs index cfd90c7c8cda..05311d4ca7e8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Cdn /// public partial class CdnOriginGroupData : ResourceData { - /// Initializes a new instance of CdnOriginGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnOriginGroupData() { Origins = new ChangeTrackingList(); } - /// Initializes a new instance of CdnOriginGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +40,8 @@ public CdnOriginGroupData() /// The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. /// Resource status of the origin group. /// Provisioning status of the origin group. - internal CdnOriginGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HealthProbeSettings healthProbeSettings, IList origins, int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes, ResponseBasedOriginErrorDetectionSettings responseBasedOriginErrorDetectionSettings, OriginGroupResourceState? resourceState, OriginGroupProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CdnOriginGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HealthProbeSettings healthProbeSettings, IList origins, int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes, ResponseBasedOriginErrorDetectionSettings responseBasedOriginErrorDetectionSettings, OriginGroupResourceState? resourceState, OriginGroupProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { HealthProbeSettings = healthProbeSettings; Origins = origins; @@ -44,6 +49,7 @@ internal CdnOriginGroupData(ResourceIdentifier id, string name, ResourceType res ResponseBasedOriginErrorDetectionSettings = responseBasedOriginErrorDetectionSettings; ResourceState = resourceState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Health probe settings to the origin that is used to determine the health of the origin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs index 282fdc656fdf..55dcbefe76af 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnWebApplicationFirewallPolicyPoliciesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnWebApplicationFirewallPolicyPoliciesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CdnWebApplicationFirewallPolicyResource(Client, CdnWebApplicationFirewallPolicyData.DeserializeCdnWebApplicationFirewallPolicyData(e)), _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics, Pipeline, "CdnWebApplicationFirewallPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnWebApplicationFirewallPolicyResource(Client, CdnWebApplicationFirewallPolicyData.DeserializeCdnWebApplicationFirewallPolicyData(e)), _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics, Pipeline, "CdnWebApplicationFirewallPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _cdnWebApplicationFirewallPolicyPoliciesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cdnWebApplicationFirewallPolicyPoliciesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CdnWebApplicationFirewallPolicyResource(Client, CdnWebApplicationFirewallPolicyData.DeserializeCdnWebApplicationFirewallPolicyData(e)), _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics, Pipeline, "CdnWebApplicationFirewallPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CdnWebApplicationFirewallPolicyResource(Client, CdnWebApplicationFirewallPolicyData.DeserializeCdnWebApplicationFirewallPolicyData(e)), _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics, Pipeline, "CdnWebApplicationFirewallPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyData.cs index 186a9a2db82a..fe5bf6d07de9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyData.cs @@ -21,7 +21,10 @@ namespace Azure.ResourceManager.Cdn /// public partial class CdnWebApplicationFirewallPolicyData : TrackedResourceData { - /// Initializes a new instance of CdnWebApplicationFirewallPolicyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. /// is null. @@ -33,7 +36,7 @@ public CdnWebApplicationFirewallPolicyData(AzureLocation location, CdnSku sku) : EndpointLinks = new ChangeTrackingList(); } - /// Initializes a new instance of CdnWebApplicationFirewallPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public CdnWebApplicationFirewallPolicyData(AzureLocation location, CdnSku sku) : /// Describes Azure CDN endpoints associated with this Web Application Firewall policy. /// Provisioning state of the WebApplicationFirewallPolicy. /// Resource status of the policy. - internal CdnWebApplicationFirewallPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, CdnSku sku, WafPolicySettings policySettings, RateLimitRuleList rateLimitSettings, CustomRuleList customSettings, ManagedRuleSetList managedRules, IReadOnlyList endpointLinks, WebApplicationFirewallPolicyProvisioningState? provisioningState, PolicyResourceState? resourceState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CdnWebApplicationFirewallPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, CdnSku sku, WafPolicySettings policySettings, RateLimitRuleList rateLimitSettings, CustomRuleList customSettings, ManagedRuleSetList managedRules, IReadOnlyList endpointLinks, WebApplicationFirewallPolicyProvisioningState? provisioningState, PolicyResourceState? resourceState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; Sku = sku; @@ -60,6 +64,12 @@ internal CdnWebApplicationFirewallPolicyData(ResourceIdentifier id, string name, EndpointLinks = endpointLinks; ProvisioningState = provisioningState; ResourceState = resourceState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CdnWebApplicationFirewallPolicyData() + { } /// Gets a unique read-only string that changes whenever the resource is updated. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 277cbfe600a8..d45e389022e3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -199,7 +199,7 @@ public virtual AsyncPageable GetProfilesAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => ProfileRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProfileRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProfiles", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProfiles", "value", "nextLink", cancellationToken); } /// @@ -221,7 +221,7 @@ public virtual Pageable GetProfiles(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => ProfileRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProfileRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProfiles", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProfiles", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs index c9f48b5702c0..ede6ea11c596 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorCustomDomainRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorCustomDomainRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorCustomDomainResource(Client, FrontDoorCustomDomainData.DeserializeFrontDoorCustomDomainData(e)), _frontDoorCustomDomainClientDiagnostics, Pipeline, "FrontDoorCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorCustomDomainResource(Client, FrontDoorCustomDomainData.DeserializeFrontDoorCustomDomainData(e)), _frontDoorCustomDomainClientDiagnostics, Pipeline, "FrontDoorCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorCustomDomainRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorCustomDomainRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorCustomDomainResource(Client, FrontDoorCustomDomainData.DeserializeFrontDoorCustomDomainData(e)), _frontDoorCustomDomainClientDiagnostics, Pipeline, "FrontDoorCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorCustomDomainResource(Client, FrontDoorCustomDomainData.DeserializeFrontDoorCustomDomainData(e)), _frontDoorCustomDomainClientDiagnostics, Pipeline, "FrontDoorCustomDomainCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainData.cs index ea21d6f1106a..835751d9c360 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorCustomDomainData : ResourceData { - /// Initializes a new instance of FrontDoorCustomDomainData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorCustomDomainData() { } - /// Initializes a new instance of FrontDoorCustomDomainData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +42,8 @@ public FrontDoorCustomDomainData() /// Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for DomainControlValidation. /// The host name of the domain. Must be a domain name. /// Values the customer needs to validate domain ownership. - internal FrontDoorCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string profileName, FrontDoorCustomDomainHttpsContent tlsSettings, WritableSubResource dnsZone, FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId preValidatedCustomDomainResource, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, DomainValidationState? domainValidationState, string hostName, DomainValidationProperties validationProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorCustomDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string profileName, FrontDoorCustomDomainHttpsContent tlsSettings, WritableSubResource dnsZone, FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId preValidatedCustomDomainResource, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, DomainValidationState? domainValidationState, string hostName, DomainValidationProperties validationProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProfileName = profileName; TlsSettings = tlsSettings; @@ -48,6 +54,7 @@ internal FrontDoorCustomDomainData(ResourceIdentifier id, string name, ResourceT DomainValidationState = domainValidationState; HostName = hostName; ValidationProperties = validationProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the profile which holds the domain. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs index 283ad903c1f5..14822016cd0b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorEndpointRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorEndpointRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorEndpointResource(Client, FrontDoorEndpointData.DeserializeFrontDoorEndpointData(e)), _frontDoorEndpointClientDiagnostics, Pipeline, "FrontDoorEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorEndpointResource(Client, FrontDoorEndpointData.DeserializeFrontDoorEndpointData(e)), _frontDoorEndpointClientDiagnostics, Pipeline, "FrontDoorEndpointCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorEndpointRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorEndpointRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorEndpointResource(Client, FrontDoorEndpointData.DeserializeFrontDoorEndpointData(e)), _frontDoorEndpointClientDiagnostics, Pipeline, "FrontDoorEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorEndpointResource(Client, FrontDoorEndpointData.DeserializeFrontDoorEndpointData(e)), _frontDoorEndpointClientDiagnostics, Pipeline, "FrontDoorEndpointCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointData.cs index a842b3787c70..14bb9ae0e355 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorEndpointData : TrackedResourceData { - /// Initializes a new instance of FrontDoorEndpointData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public FrontDoorEndpointData(AzureLocation location) : base(location) { } - /// Initializes a new instance of FrontDoorEndpointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public FrontDoorEndpointData(AzureLocation location) : base(location) /// /// The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. contoso.azureedge.net. /// Indicates the endpoint name reuse scope. The default value is TenantReuse. - internal FrontDoorEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string profileName, EnabledState? enabledState, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string hostName, DomainNameLabelScope? autoGeneratedDomainNameLabelScope) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal FrontDoorEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string profileName, EnabledState? enabledState, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string hostName, DomainNameLabelScope? autoGeneratedDomainNameLabelScope, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProfileName = profileName; EnabledState = enabledState; @@ -45,6 +50,12 @@ internal FrontDoorEndpointData(ResourceIdentifier id, string name, ResourceType DeploymentStatus = deploymentStatus; HostName = hostName; AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FrontDoorEndpointData() + { } /// The name of the profile which holds the endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs index ae917e0ae579..6ac41f8fa7b7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorOriginRestClient.CreateListByOriginGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorOriginRestClient.CreateListByOriginGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorOriginResource(Client, FrontDoorOriginData.DeserializeFrontDoorOriginData(e)), _frontDoorOriginClientDiagnostics, Pipeline, "FrontDoorOriginCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorOriginResource(Client, FrontDoorOriginData.DeserializeFrontDoorOriginData(e)), _frontDoorOriginClientDiagnostics, Pipeline, "FrontDoorOriginCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorOriginRestClient.CreateListByOriginGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorOriginRestClient.CreateListByOriginGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorOriginResource(Client, FrontDoorOriginData.DeserializeFrontDoorOriginData(e)), _frontDoorOriginClientDiagnostics, Pipeline, "FrontDoorOriginCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorOriginResource(Client, FrontDoorOriginData.DeserializeFrontDoorOriginData(e)), _frontDoorOriginClientDiagnostics, Pipeline, "FrontDoorOriginCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginData.cs index 689e8c2de1be..7f3129c2125b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorOriginData : ResourceData { - /// Initializes a new instance of FrontDoorOriginData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorOriginData() { } - /// Initializes a new instance of FrontDoorOriginData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +46,8 @@ public FrontDoorOriginData() /// Whether to enable certificate name check at origin level. /// Provisioning status. /// - internal FrontDoorOriginData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string originGroupName, WritableSubResource origin, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, SharedPrivateLinkResourceProperties sharedPrivateLinkResource, EnabledState? enabledState, bool? enforceCertificateNameCheck, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorOriginData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string originGroupName, WritableSubResource origin, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, SharedPrivateLinkResourceProperties sharedPrivateLinkResource, EnabledState? enabledState, bool? enforceCertificateNameCheck, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OriginGroupName = originGroupName; Origin = origin; @@ -56,6 +62,7 @@ internal FrontDoorOriginData(ResourceIdentifier id, string name, ResourceType re EnforceCertificateNameCheck = enforceCertificateNameCheck; ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the origin group which contains this origin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs index 2d412bc48e26..82359ebdf253 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorOriginGroupRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorOriginGroupRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorOriginGroupResource(Client, FrontDoorOriginGroupData.DeserializeFrontDoorOriginGroupData(e)), _frontDoorOriginGroupClientDiagnostics, Pipeline, "FrontDoorOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorOriginGroupResource(Client, FrontDoorOriginGroupData.DeserializeFrontDoorOriginGroupData(e)), _frontDoorOriginGroupClientDiagnostics, Pipeline, "FrontDoorOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorOriginGroupRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorOriginGroupRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorOriginGroupResource(Client, FrontDoorOriginGroupData.DeserializeFrontDoorOriginGroupData(e)), _frontDoorOriginGroupClientDiagnostics, Pipeline, "FrontDoorOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorOriginGroupResource(Client, FrontDoorOriginGroupData.DeserializeFrontDoorOriginGroupData(e)), _frontDoorOriginGroupClientDiagnostics, Pipeline, "FrontDoorOriginGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupData.cs index 40e44aa04d42..5936ac4f9243 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorOriginGroupData : ResourceData { - /// Initializes a new instance of FrontDoorOriginGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorOriginGroupData() { } - /// Initializes a new instance of FrontDoorOriginGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +39,8 @@ public FrontDoorOriginGroupData() /// Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. /// Provisioning status. /// - internal FrontDoorOriginGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string profileName, LoadBalancingSettings loadBalancingSettings, HealthProbeSettings healthProbeSettings, int? trafficRestorationTimeInMinutes, EnabledState? sessionAffinityState, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorOriginGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string profileName, LoadBalancingSettings loadBalancingSettings, HealthProbeSettings healthProbeSettings, int? trafficRestorationTimeInMinutes, EnabledState? sessionAffinityState, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProfileName = profileName; LoadBalancingSettings = loadBalancingSettings; @@ -43,6 +49,7 @@ internal FrontDoorOriginGroupData(ResourceIdentifier id, string name, ResourceTy SessionAffinityState = sessionAffinityState; ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the profile which holds the origin group. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs index a14876299438..70aad5f1fa64 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorRouteRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorRouteRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorRouteResource(Client, FrontDoorRouteData.DeserializeFrontDoorRouteData(e)), _frontDoorRouteClientDiagnostics, Pipeline, "FrontDoorRouteCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorRouteResource(Client, FrontDoorRouteData.DeserializeFrontDoorRouteData(e)), _frontDoorRouteClientDiagnostics, Pipeline, "FrontDoorRouteCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorRouteRestClient.CreateListByEndpointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorRouteRestClient.CreateListByEndpointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorRouteResource(Client, FrontDoorRouteData.DeserializeFrontDoorRouteData(e)), _frontDoorRouteClientDiagnostics, Pipeline, "FrontDoorRouteCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorRouteResource(Client, FrontDoorRouteData.DeserializeFrontDoorRouteData(e)), _frontDoorRouteClientDiagnostics, Pipeline, "FrontDoorRouteCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteData.cs index 599b2dc47e88..b8e651eba306 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorRouteData : ResourceData { - /// Initializes a new instance of FrontDoorRouteData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorRouteData() { CustomDomains = new ChangeTrackingList(); @@ -28,7 +32,7 @@ public FrontDoorRouteData() PatternsToMatch = new ChangeTrackingList(); } - /// Initializes a new instance of FrontDoorRouteData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +51,8 @@ public FrontDoorRouteData() /// Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. /// Provisioning status. /// - internal FrontDoorRouteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string endpointName, IList customDomains, WritableSubResource originGroup, string originPath, IList ruleSets, IList supportedProtocols, IList patternsToMatch, FrontDoorRouteCacheConfiguration cacheConfiguration, ForwardingProtocol? forwardingProtocol, LinkToDefaultDomain? linkToDefaultDomain, HttpsRedirect? httpsRedirect, EnabledState? enabledState, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorRouteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string endpointName, IList customDomains, WritableSubResource originGroup, string originPath, IList ruleSets, IList supportedProtocols, IList patternsToMatch, FrontDoorRouteCacheConfiguration cacheConfiguration, ForwardingProtocol? forwardingProtocol, LinkToDefaultDomain? linkToDefaultDomain, HttpsRedirect? httpsRedirect, EnabledState? enabledState, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { EndpointName = endpointName; CustomDomains = customDomains; @@ -63,6 +68,7 @@ internal FrontDoorRouteData(ResourceIdentifier id, string name, ResourceType res EnabledState = enabledState; ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the endpoint which holds the route. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs index f4156417bf11..712802b077aa 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorRuleRestClient.CreateListByRuleSetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorRuleRestClient.CreateListByRuleSetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorRuleResource(Client, FrontDoorRuleData.DeserializeFrontDoorRuleData(e)), _frontDoorRuleClientDiagnostics, Pipeline, "FrontDoorRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorRuleResource(Client, FrontDoorRuleData.DeserializeFrontDoorRuleData(e)), _frontDoorRuleClientDiagnostics, Pipeline, "FrontDoorRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorRuleRestClient.CreateListByRuleSetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorRuleRestClient.CreateListByRuleSetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorRuleResource(Client, FrontDoorRuleData.DeserializeFrontDoorRuleData(e)), _frontDoorRuleClientDiagnostics, Pipeline, "FrontDoorRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorRuleResource(Client, FrontDoorRuleData.DeserializeFrontDoorRuleData(e)), _frontDoorRuleClientDiagnostics, Pipeline, "FrontDoorRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleData.cs index 8523e6340356..f03ea5e76fd0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorRuleData : ResourceData { - /// Initializes a new instance of FrontDoorRuleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorRuleData() { Conditions = new ChangeTrackingList(); Actions = new ChangeTrackingList(); } - /// Initializes a new instance of FrontDoorRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ public FrontDoorRuleData() /// If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. /// Provisioning status. /// - internal FrontDoorRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string ruleSetName, int? order, IList conditions, IList actions, MatchProcessingBehavior? matchProcessingBehavior, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string ruleSetName, int? order, IList conditions, IList actions, MatchProcessingBehavior? matchProcessingBehavior, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RuleSetName = ruleSetName; Order = order; @@ -54,6 +59,7 @@ internal FrontDoorRuleData(ResourceIdentifier id, string name, ResourceType reso MatchProcessingBehavior = matchProcessingBehavior; ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the rule set containing the rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs index 09e465225e48..5525c5d36019 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetCollection.cs @@ -224,7 +224,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorRuleSetRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorRuleSetRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorRuleSetResource(Client, FrontDoorRuleSetData.DeserializeFrontDoorRuleSetData(e)), _frontDoorRuleSetClientDiagnostics, Pipeline, "FrontDoorRuleSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorRuleSetResource(Client, FrontDoorRuleSetData.DeserializeFrontDoorRuleSetData(e)), _frontDoorRuleSetClientDiagnostics, Pipeline, "FrontDoorRuleSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -246,7 +246,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorRuleSetRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorRuleSetRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorRuleSetResource(Client, FrontDoorRuleSetData.DeserializeFrontDoorRuleSetData(e)), _frontDoorRuleSetClientDiagnostics, Pipeline, "FrontDoorRuleSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorRuleSetResource(Client, FrontDoorRuleSetData.DeserializeFrontDoorRuleSetData(e)), _frontDoorRuleSetClientDiagnostics, Pipeline, "FrontDoorRuleSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetData.cs index 5183a6cefdc1..0eb5028b1aca 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorRuleSetData : ResourceData { - /// Initializes a new instance of FrontDoorRuleSetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorRuleSetData() { } - /// Initializes a new instance of FrontDoorRuleSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +35,13 @@ public FrontDoorRuleSetData() /// Provisioning status. /// /// The name of the profile which holds the rule set. - internal FrontDoorRuleSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string profileName) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorRuleSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string profileName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; ProfileName = profileName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning status. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs index e3119e341283..4a46bb697811 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorSecretRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorSecretRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorSecretResource(Client, FrontDoorSecretData.DeserializeFrontDoorSecretData(e)), _frontDoorSecretClientDiagnostics, Pipeline, "FrontDoorSecretCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorSecretResource(Client, FrontDoorSecretData.DeserializeFrontDoorSecretData(e)), _frontDoorSecretClientDiagnostics, Pipeline, "FrontDoorSecretCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorSecretRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorSecretRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorSecretResource(Client, FrontDoorSecretData.DeserializeFrontDoorSecretData(e)), _frontDoorSecretClientDiagnostics, Pipeline, "FrontDoorSecretCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorSecretResource(Client, FrontDoorSecretData.DeserializeFrontDoorSecretData(e)), _frontDoorSecretClientDiagnostics, Pipeline, "FrontDoorSecretCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretData.cs index 249f801ef04b..1cf530e7da72 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorSecretData : ResourceData { - /// Initializes a new instance of FrontDoorSecretData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorSecretData() { } - /// Initializes a new instance of FrontDoorSecretData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +40,14 @@ public FrontDoorSecretData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// - internal FrontDoorSecretData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string profileName, FrontDoorSecretProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorSecretData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string profileName, FrontDoorSecretProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; ProfileName = profileName; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning status. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs index 0e5430ae5e17..4ad27e2e416c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorSecurityPolicyRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorSecurityPolicyRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorSecurityPolicyResource(Client, FrontDoorSecurityPolicyData.DeserializeFrontDoorSecurityPolicyData(e)), _frontDoorSecurityPolicyClientDiagnostics, Pipeline, "FrontDoorSecurityPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorSecurityPolicyResource(Client, FrontDoorSecurityPolicyData.DeserializeFrontDoorSecurityPolicyData(e)), _frontDoorSecurityPolicyClientDiagnostics, Pipeline, "FrontDoorSecurityPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _frontDoorSecurityPolicyRestClient.CreateListByProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _frontDoorSecurityPolicyRestClient.CreateListByProfileNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorSecurityPolicyResource(Client, FrontDoorSecurityPolicyData.DeserializeFrontDoorSecurityPolicyData(e)), _frontDoorSecurityPolicyClientDiagnostics, Pipeline, "FrontDoorSecurityPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new FrontDoorSecurityPolicyResource(Client, FrontDoorSecurityPolicyData.DeserializeFrontDoorSecurityPolicyData(e)), _frontDoorSecurityPolicyClientDiagnostics, Pipeline, "FrontDoorSecurityPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyData.cs index c59e7fbf4fcb..d9231a8df39a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Cdn /// public partial class FrontDoorSecurityPolicyData : ResourceData { - /// Initializes a new instance of FrontDoorSecurityPolicyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorSecurityPolicyData() { } - /// Initializes a new instance of FrontDoorSecurityPolicyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +40,14 @@ public FrontDoorSecurityPolicyData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// - internal FrontDoorSecurityPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string profileName, SecurityPolicyProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal FrontDoorSecurityPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FrontDoorProvisioningState? provisioningState, FrontDoorDeploymentStatus? deploymentStatus, string profileName, SecurityPolicyProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; DeploymentStatus = deploymentStatus; ProfileName = profileName; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning status. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.Serialization.cs index 308f5be7c9f7..bd72bd735ee9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class AzureFirstPartyManagedCertificateProperties : IUtf8JsonSerializable + public partial class AzureFirstPartyManagedCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(SecretType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AzureFirstPartyManagedCertificateProperties DeserializeAzureFirstPartyManagedCertificateProperties(JsonElement element) + internal static AzureFirstPartyManagedCertificateProperties DeserializeAzureFirstPartyManagedCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } SecretType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -34,8 +57,61 @@ internal static AzureFirstPartyManagedCertificateProperties DeserializeAzureFirs type = new SecretType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureFirstPartyManagedCertificateProperties(type, serializedAdditionalRawData); + } + + AzureFirstPartyManagedCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFirstPartyManagedCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFirstPartyManagedCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFirstPartyManagedCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFirstPartyManagedCertificateProperties model) + { + if (model is null) + { + return null; } - return new AzureFirstPartyManagedCertificateProperties(type); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFirstPartyManagedCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFirstPartyManagedCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.cs index e3b39d2efd6f..05b510bdcfdd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/AzureFirstPartyManagedCertificateProperties.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Azure FirstParty Managed Certificate provided by other first party resource providers to enable HTTPS. public partial class AzureFirstPartyManagedCertificateProperties : FrontDoorSecretProperties { - /// Initializes a new instance of AzureFirstPartyManagedCertificateProperties. + /// Initializes a new instance of . public AzureFirstPartyManagedCertificateProperties() { SecretType = SecretType.AzureFirstPartyManagedCertificate; } - /// Initializes a new instance of AzureFirstPartyManagedCertificateProperties. + /// Initializes a new instance of . /// The type of the secret resource. - internal AzureFirstPartyManagedCertificateProperties(SecretType secretType) : base(secretType) + /// Keeps track of any properties unknown to the library. + internal AzureFirstPartyManagedCertificateProperties(SecretType secretType, Dictionary serializedAdditionalRawData) : base(secretType, serializedAdditionalRawData) { SecretType = secretType; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.Serialization.cs index 639c5b8927ef..8bac6e55f560 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CacheConfiguration : IUtf8JsonSerializable + public partial class CacheConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QueryStringCachingBehavior)) { @@ -48,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("cacheDuration"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CacheConfiguration DeserializeCacheConfiguration(JsonElement element) + internal static CacheConfiguration DeserializeCacheConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +83,7 @@ internal static CacheConfiguration DeserializeCacheConfiguration(JsonElement ele Optional isCompressionEnabled = default; Optional cacheBehavior = default; Optional cacheDuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queryStringCachingBehavior"u8)) @@ -106,8 +128,61 @@ internal static CacheConfiguration DeserializeCacheConfiguration(JsonElement ele cacheDuration = property.Value.GetTimeSpan("c"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CacheConfiguration(Optional.ToNullable(queryStringCachingBehavior), queryParameters.Value, Optional.ToNullable(isCompressionEnabled), Optional.ToNullable(cacheBehavior), Optional.ToNullable(cacheDuration), serializedAdditionalRawData); + } + + CacheConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCacheConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CacheConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCacheConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CacheConfiguration model) + { + if (model is null) + { + return null; } - return new CacheConfiguration(Optional.ToNullable(queryStringCachingBehavior), queryParameters.Value, Optional.ToNullable(isCompressionEnabled), Optional.ToNullable(cacheBehavior), Optional.ToNullable(cacheDuration)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CacheConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCacheConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.cs index 50baf3e5a21c..687ae089768c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheConfiguration.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. public partial class CacheConfiguration { - /// Initializes a new instance of CacheConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CacheConfiguration() { } - /// Initializes a new instance of CacheConfiguration. + /// Initializes a new instance of . /// Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. /// query parameters to include or exclude (comma separated). /// Indicates whether content compression is enabled. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. /// Caching behavior for the requests. /// The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss. - internal CacheConfiguration(RuleQueryStringCachingBehavior? queryStringCachingBehavior, string queryParameters, RuleIsCompressionEnabled? isCompressionEnabled, RuleCacheBehavior? cacheBehavior, TimeSpan? cacheDuration) + /// Keeps track of any properties unknown to the library. + internal CacheConfiguration(RuleQueryStringCachingBehavior? queryStringCachingBehavior, string queryParameters, RuleIsCompressionEnabled? isCompressionEnabled, RuleCacheBehavior? cacheBehavior, TimeSpan? cacheDuration, Dictionary serializedAdditionalRawData) { QueryStringCachingBehavior = queryStringCachingBehavior; QueryParameters = queryParameters; IsCompressionEnabled = isCompressionEnabled; CacheBehavior = cacheBehavior; CacheDuration = cacheDuration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.Serialization.cs index 27840f07704a..3ee85c435f14 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CacheExpirationActionProperties : IUtf8JsonSerializable + public partial class CacheExpirationActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -34,11 +41,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("cacheDuration"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CacheExpirationActionProperties DeserializeCacheExpirationActionProperties(JsonElement element) + internal static CacheExpirationActionProperties DeserializeCacheExpirationActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +68,7 @@ internal static CacheExpirationActionProperties DeserializeCacheExpirationAction CacheBehaviorSetting cacheBehavior = default; CdnCacheLevel cacheType = default; Optional cacheDuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -74,8 +96,61 @@ internal static CacheExpirationActionProperties DeserializeCacheExpirationAction cacheDuration = property.Value.GetTimeSpan("c"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CacheExpirationActionProperties(typeName, cacheBehavior, cacheType, Optional.ToNullable(cacheDuration), serializedAdditionalRawData); + } + + CacheExpirationActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCacheExpirationActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CacheExpirationActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCacheExpirationActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CacheExpirationActionProperties model) + { + if (model is null) + { + return null; } - return new CacheExpirationActionProperties(typeName, cacheBehavior, cacheType, Optional.ToNullable(cacheDuration)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CacheExpirationActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCacheExpirationActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.cs index cae072e54d35..a29f6a5071ba 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheExpirationActionProperties.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// Defines the parameters for the cache expiration action. public partial class CacheExpirationActionProperties { - /// Initializes a new instance of CacheExpirationActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Caching behavior for the requests. /// The level at which the content needs to be cached. @@ -23,17 +27,24 @@ public CacheExpirationActionProperties(CacheExpirationActionType actionType, Cac CacheType = cacheType; } - /// Initializes a new instance of CacheExpirationActionProperties. + /// Initializes a new instance of . /// /// Caching behavior for the requests. /// The level at which the content needs to be cached. /// The duration for which the content needs to be cached. Allowed format is [d.]hh:mm:ss. - internal CacheExpirationActionProperties(CacheExpirationActionType actionType, CacheBehaviorSetting cacheBehavior, CdnCacheLevel cacheType, TimeSpan? cacheDuration) + /// Keeps track of any properties unknown to the library. + internal CacheExpirationActionProperties(CacheExpirationActionType actionType, CacheBehaviorSetting cacheBehavior, CdnCacheLevel cacheType, TimeSpan? cacheDuration, Dictionary serializedAdditionalRawData) { ActionType = actionType; CacheBehavior = cacheBehavior; CacheType = cacheType; CacheDuration = cacheDuration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CacheExpirationActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.Serialization.cs index 2c30ddf60c68..7468a4599fae 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CacheKeyQueryStringActionProperties : IUtf8JsonSerializable + public partial class CacheKeyQueryStringActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -31,11 +39,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("queryParameters"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CacheKeyQueryStringActionProperties DeserializeCacheKeyQueryStringActionProperties(JsonElement element) + internal static CacheKeyQueryStringActionProperties DeserializeCacheKeyQueryStringActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +65,7 @@ internal static CacheKeyQueryStringActionProperties DeserializeCacheKeyQueryStri CacheKeyQueryStringActionType typeName = default; QueryStringBehavior queryStringBehavior = default; Optional queryParameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -65,8 +88,61 @@ internal static CacheKeyQueryStringActionProperties DeserializeCacheKeyQueryStri queryParameters = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CacheKeyQueryStringActionProperties(typeName, queryStringBehavior, queryParameters.Value, serializedAdditionalRawData); + } + + CacheKeyQueryStringActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCacheKeyQueryStringActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CacheKeyQueryStringActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCacheKeyQueryStringActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CacheKeyQueryStringActionProperties model) + { + if (model is null) + { + return null; } - return new CacheKeyQueryStringActionProperties(typeName, queryStringBehavior, queryParameters.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CacheKeyQueryStringActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCacheKeyQueryStringActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.cs index 4148fd5b15ce..45cec6d75e92 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CacheKeyQueryStringActionProperties.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Defines the parameters for the cache-key query string action. public partial class CacheKeyQueryStringActionProperties { - /// Initializes a new instance of CacheKeyQueryStringActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Caching behavior for the requests. public CacheKeyQueryStringActionProperties(CacheKeyQueryStringActionType actionType, QueryStringBehavior queryStringBehavior) @@ -19,15 +25,22 @@ public CacheKeyQueryStringActionProperties(CacheKeyQueryStringActionType actionT QueryStringBehavior = queryStringBehavior; } - /// Initializes a new instance of CacheKeyQueryStringActionProperties. + /// Initializes a new instance of . /// /// Caching behavior for the requests. /// query parameters to include or exclude (comma separated). - internal CacheKeyQueryStringActionProperties(CacheKeyQueryStringActionType actionType, QueryStringBehavior queryStringBehavior, string queryParameters) + /// Keeps track of any properties unknown to the library. + internal CacheKeyQueryStringActionProperties(CacheKeyQueryStringActionType actionType, QueryStringBehavior queryStringBehavior, string queryParameters, Dictionary serializedAdditionalRawData) { ActionType = actionType; QueryStringBehavior = queryStringBehavior; QueryParameters = queryParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CacheKeyQueryStringActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.Serialization.cs index b5d94cc02d47..a7f0dcab4518 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnCertificateSource : IUtf8JsonSerializable + public partial class CdnCertificateSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(SourceType.ToString()); writer.WritePropertyName("certificateType"u8); writer.WriteStringValue(CertificateType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnCertificateSource DeserializeCdnCertificateSource(JsonElement element) + internal static CdnCertificateSource DeserializeCdnCertificateSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CdnCertificateSourceType typeName = default; CdnManagedCertificateType certificateType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -42,8 +65,61 @@ internal static CdnCertificateSource DeserializeCdnCertificateSource(JsonElement certificateType = new CdnManagedCertificateType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnCertificateSource(typeName, certificateType, serializedAdditionalRawData); + } + + CdnCertificateSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnCertificateSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnCertificateSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnCertificateSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnCertificateSource model) + { + if (model is null) + { + return null; } - return new CdnCertificateSource(typeName, certificateType); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnCertificateSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnCertificateSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.cs index 010e246e6af1..16e76ded22ce 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCertificateSource.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Defines the parameters for using CDN managed certificate for securing custom domain. public partial class CdnCertificateSource { - /// Initializes a new instance of CdnCertificateSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Type of certificate used. public CdnCertificateSource(CdnCertificateSourceType sourceType, CdnManagedCertificateType certificateType) @@ -19,6 +25,22 @@ public CdnCertificateSource(CdnCertificateSourceType sourceType, CdnManagedCerti CertificateType = certificateType; } + /// Initializes a new instance of . + /// + /// Type of certificate used. + /// Keeps track of any properties unknown to the library. + internal CdnCertificateSource(CdnCertificateSourceType sourceType, CdnManagedCertificateType certificateType, Dictionary serializedAdditionalRawData) + { + SourceType = sourceType; + CertificateType = certificateType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CdnCertificateSource() + { + } + /// Gets or sets the source type. public CdnCertificateSourceType SourceType { get; set; } /// Type of certificate used. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.Serialization.cs index 440b194d3fe5..e76731b65a88 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnCustomDomainCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CdnCustomDomainCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -23,7 +31,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(HostName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CdnCustomDomainCreateOrUpdateContent DeserializeCdnCustomDomainCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hostName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("hostName"u8)) + { + hostName = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnCustomDomainCreateOrUpdateContent(hostName.Value, serializedAdditionalRawData); + } + + CdnCustomDomainCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnCustomDomainCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnCustomDomainCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnCustomDomainCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnCustomDomainCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnCustomDomainCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnCustomDomainCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.cs index 8fbd2f5a2cc3..bbad2ada601d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainCreateOrUpdateContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The customDomain JSON object required for custom domain creation or update. public partial class CdnCustomDomainCreateOrUpdateContent { - /// Initializes a new instance of CdnCustomDomainCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnCustomDomainCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// The host name of the custom domain. Must be a domain name. + /// Keeps track of any properties unknown to the library. + internal CdnCustomDomainCreateOrUpdateContent(string hostName, Dictionary serializedAdditionalRawData) + { + HostName = hostName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The host name of the custom domain. Must be a domain name. public string HostName { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainData.Serialization.cs index 80ef3953a95d..356951fdb5ab 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnCustomDomainData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class CdnCustomDomainData : IUtf8JsonSerializable + public partial class CdnCustomDomainData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,7 +37,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (CustomDomainHttpsContent != null) { writer.WritePropertyName("customHttpsParameters"u8); - writer.WriteObjectValue(CustomDomainHttpsContent); + if (CustomDomainHttpsContent is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomDomainHttpsContent).Serialize(writer, options); + } } else { @@ -42,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ValidationData); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnCustomDomainData DeserializeCdnCustomDomainData(JsonElement element) + internal static CdnCustomDomainData DeserializeCdnCustomDomainData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +91,7 @@ internal static CdnCustomDomainData DeserializeCdnCustomDomainData(JsonElement e Optional customHttpsParameters = default; Optional validationData = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -156,8 +186,61 @@ internal static CdnCustomDomainData DeserializeCdnCustomDomainData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnCustomDomainData(id, name, type, systemData.Value, hostName.Value, Optional.ToNullable(resourceState), Optional.ToNullable(customHttpsProvisioningState), Optional.ToNullable(customHttpsProvisioningSubstate), customHttpsParameters.Value, validationData.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CdnCustomDomainData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnCustomDomainData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnCustomDomainData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnCustomDomainData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnCustomDomainData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnCustomDomainData(Response response) + { + if (response is null) + { + return null; } - return new CdnCustomDomainData(id, name, type, systemData.Value, hostName.Value, Optional.ToNullable(resourceState), Optional.ToNullable(customHttpsProvisioningState), Optional.ToNullable(customHttpsProvisioningSubstate), customHttpsParameters.Value, validationData.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnCustomDomainData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointData.Serialization.cs index 6be1c9c9916f..b39ee5e1a868 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class CdnEndpointData : IUtf8JsonSerializable + public partial class CdnEndpointData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -96,7 +103,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in GeoFilters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -105,7 +119,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (DefaultOriginGroup != null) { writer.WritePropertyName("defaultOriginGroup"u8); - writer.WriteObjectValue(DefaultOriginGroup); + if (DefaultOriginGroup is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DefaultOriginGroup).Serialize(writer, options); + } } else { @@ -120,7 +141,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UriSigningKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -134,7 +162,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (DeliveryPolicy != null) { writer.WritePropertyName("deliveryPolicy"u8); - writer.WriteObjectValue(DeliveryPolicy); + if (DeliveryPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeliveryPolicy).Serialize(writer, options); + } } else { @@ -146,7 +181,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (WebApplicationFirewallPolicyLink != null) { writer.WritePropertyName("webApplicationFirewallPolicyLink"u8); - writer.WriteObjectValue(WebApplicationFirewallPolicyLink); + if (WebApplicationFirewallPolicyLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WebApplicationFirewallPolicyLink).Serialize(writer, options); + } } else { @@ -159,7 +201,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Origins) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -169,16 +218,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in OriginGroups) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnEndpointData DeserializeCdnEndpointData(JsonElement element) + internal static CdnEndpointData DeserializeCdnEndpointData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -209,6 +279,7 @@ internal static CdnEndpointData DeserializeCdnEndpointData(JsonElement element) Optional> customDomains = default; Optional resourceState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -465,8 +536,61 @@ internal static CdnEndpointData DeserializeCdnEndpointData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnEndpointData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, originPath.Value, Optional.ToList(contentTypesToCompress), originHostHeader.Value, Optional.ToNullable(isCompressionEnabled), Optional.ToNullable(isHttpAllowed), Optional.ToNullable(isHttpsAllowed), Optional.ToNullable(queryStringCachingBehavior), Optional.ToNullable(optimizationType), probePath.Value, Optional.ToList(geoFilters), defaultOriginGroup.Value, Optional.ToList(uriSigningKeys), deliveryPolicy.Value, webApplicationFirewallPolicyLink.Value, hostName.Value, Optional.ToList(origins), Optional.ToList(originGroups), Optional.ToList(customDomains), Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CdnEndpointData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnEndpointData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnEndpointData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnEndpointData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnEndpointData model) + { + if (model is null) + { + return null; } - return new CdnEndpointData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, originPath.Value, Optional.ToList(contentTypesToCompress), originHostHeader.Value, Optional.ToNullable(isCompressionEnabled), Optional.ToNullable(isHttpAllowed), Optional.ToNullable(isHttpsAllowed), Optional.ToNullable(queryStringCachingBehavior), Optional.ToNullable(optimizationType), probePath.Value, Optional.ToList(geoFilters), defaultOriginGroup.Value, Optional.ToList(uriSigningKeys), deliveryPolicy.Value, webApplicationFirewallPolicyLink.Value, hostName.Value, Optional.ToList(origins), Optional.ToList(originGroups), Optional.ToList(customDomains), Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnEndpointData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnEndpointData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.Serialization.cs index 8603c50ae3e1..0642911cff9b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnEndpointPatch : IUtf8JsonSerializable + public partial class CdnEndpointPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -91,7 +99,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in GeoFilters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -100,7 +115,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (DefaultOriginGroup != null) { writer.WritePropertyName("defaultOriginGroup"u8); - writer.WriteObjectValue(DefaultOriginGroup); + if (DefaultOriginGroup is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DefaultOriginGroup).Serialize(writer, options); + } } else { @@ -115,7 +137,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UriSigningKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -129,7 +158,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (DeliveryPolicy != null) { writer.WritePropertyName("deliveryPolicy"u8); - writer.WriteObjectValue(DeliveryPolicy); + if (DeliveryPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeliveryPolicy).Serialize(writer, options); + } } else { @@ -141,7 +177,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (WebApplicationFirewallPolicyLink != null) { writer.WritePropertyName("webApplicationFirewallPolicyLink"u8); - writer.WriteObjectValue(WebApplicationFirewallPolicyLink); + if (WebApplicationFirewallPolicyLink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WebApplicationFirewallPolicyLink).Serialize(writer, options); + } } else { @@ -149,7 +192,262 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CdnEndpointPatch DeserializeCdnEndpointPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional originPath = default; + Optional> contentTypesToCompress = default; + Optional originHostHeader = default; + Optional isCompressionEnabled = default; + Optional isHttpAllowed = default; + Optional isHttpsAllowed = default; + Optional queryStringCachingBehavior = default; + Optional optimizationType = default; + Optional probePath = default; + Optional> geoFilters = default; + Optional defaultOriginGroup = default; + Optional> uriSigningKeys = default; + Optional deliveryPolicy = default; + Optional webApplicationFirewallPolicyLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("originPath"u8)) + { + originPath = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("contentTypesToCompress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contentTypesToCompress = array; + continue; + } + if (property0.NameEquals("originHostHeader"u8)) + { + originHostHeader = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isCompressionEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isCompressionEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isHttpAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isHttpAllowed = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isHttpsAllowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isHttpsAllowed = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("queryStringCachingBehavior"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queryStringCachingBehavior = property0.Value.GetString().ToQueryStringCachingBehavior(); + continue; + } + if (property0.NameEquals("optimizationType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + optimizationType = null; + continue; + } + optimizationType = new OptimizationType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("probePath"u8)) + { + probePath = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("geoFilters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(GeoFilter.DeserializeGeoFilter(item)); + } + geoFilters = array; + continue; + } + if (property0.NameEquals("defaultOriginGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + defaultOriginGroup = null; + continue; + } + defaultOriginGroup = EndpointPropertiesUpdateParametersDefaultOriginGroup.DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(property0.Value); + continue; + } + if (property0.NameEquals("urlSigningKeys"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + uriSigningKeys = null; + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(UriSigningKey.DeserializeUriSigningKey(item)); + } + uriSigningKeys = array; + continue; + } + if (property0.NameEquals("deliveryPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + deliveryPolicy = null; + continue; + } + deliveryPolicy = EndpointDeliveryPolicy.DeserializeEndpointDeliveryPolicy(property0.Value); + continue; + } + if (property0.NameEquals("webApplicationFirewallPolicyLink"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + webApplicationFirewallPolicyLink = null; + continue; + } + webApplicationFirewallPolicyLink = EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnEndpointPatch(Optional.ToDictionary(tags), originPath.Value, Optional.ToList(contentTypesToCompress), originHostHeader.Value, Optional.ToNullable(isCompressionEnabled), Optional.ToNullable(isHttpAllowed), Optional.ToNullable(isHttpsAllowed), Optional.ToNullable(queryStringCachingBehavior), Optional.ToNullable(optimizationType), probePath.Value, Optional.ToList(geoFilters), defaultOriginGroup.Value, Optional.ToList(uriSigningKeys), deliveryPolicy.Value, webApplicationFirewallPolicyLink.Value, serializedAdditionalRawData); + } + + CdnEndpointPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnEndpointPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnEndpointPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnEndpointPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnEndpointPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnEndpointPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnEndpointPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.cs index 22d0413dec85..5a1ad80dda75 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnEndpointPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Properties required to create or update an endpoint. public partial class CdnEndpointPatch { - /// Initializes a new instance of CdnEndpointPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnEndpointPatch() { Tags = new ChangeTrackingDictionary(); @@ -22,6 +26,43 @@ public CdnEndpointPatch() UriSigningKeys = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Endpoint tags. + /// A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + /// List of content types on which compression applies. The value should be a valid MIME type. + /// The host header value sent to the origin with each request. This property at Endpoint is only allowed when endpoint uses single origin and can be overridden by the same property specified at origin.If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. + /// Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB. + /// Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + /// Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed. + /// Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. + /// Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. + /// Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path. This property is only relevant when using a single origin. + /// List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an access rule to a specified path or content, e.g. block APAC for path /pictures/. + /// A reference to the origin group. + /// List of keys used to validate the signed URL hashes. + /// A policy that specifies the delivery rules to be used for an endpoint. + /// Defines the Web Application Firewall policy for the endpoint (if applicable). + /// Keeps track of any properties unknown to the library. + internal CdnEndpointPatch(IDictionary tags, string originPath, IList contentTypesToCompress, string originHostHeader, bool? isCompressionEnabled, bool? isHttpAllowed, bool? isHttpsAllowed, QueryStringCachingBehavior? queryStringCachingBehavior, OptimizationType? optimizationType, string probePath, IList geoFilters, EndpointPropertiesUpdateParametersDefaultOriginGroup defaultOriginGroup, IList uriSigningKeys, EndpointDeliveryPolicy deliveryPolicy, EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink webApplicationFirewallPolicyLink, Dictionary serializedAdditionalRawData) + { + Tags = tags; + OriginPath = originPath; + ContentTypesToCompress = contentTypesToCompress; + OriginHostHeader = originHostHeader; + IsCompressionEnabled = isCompressionEnabled; + IsHttpAllowed = isHttpAllowed; + IsHttpsAllowed = isHttpsAllowed; + QueryStringCachingBehavior = queryStringCachingBehavior; + OptimizationType = optimizationType; + ProbePath = probePath; + GeoFilters = geoFilters; + DefaultOriginGroup = defaultOriginGroup; + UriSigningKeys = uriSigningKeys; + DeliveryPolicy = deliveryPolicy; + WebApplicationFirewallPolicyLink = webApplicationFirewallPolicyLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Endpoint tags. public IDictionary Tags { get; } /// A directory path on the origin that CDN can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.Serialization.cs index 0c106e79155f..dd468f2fc435 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.Serialization.cs @@ -5,18 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnManagedHttpsContent : IUtf8JsonSerializable + public partial class CdnManagedHttpsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("certificateSourceParameters"u8); - writer.WriteObjectValue(CertificateSourceParameters); + if (CertificateSourceParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CertificateSourceParameters).Serialize(writer, options); + } writer.WritePropertyName("certificateSource"u8); writer.WriteStringValue(CertificateSource.ToString()); writer.WritePropertyName("protocolType"u8); @@ -26,11 +41,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimumTlsVersion"u8); writer.WriteStringValue(MinimumTlsVersion.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnManagedHttpsContent DeserializeCdnManagedHttpsContent(JsonElement element) + internal static CdnManagedHttpsContent DeserializeCdnManagedHttpsContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static CdnManagedHttpsContent DeserializeCdnManagedHttpsContent(JsonEle CertificateSource certificateSource = default; SecureDeliveryProtocolType protocolType = default; Optional minimumTlsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificateSourceParameters"u8)) @@ -65,8 +95,61 @@ internal static CdnManagedHttpsContent DeserializeCdnManagedHttpsContent(JsonEle minimumTlsVersion = property.Value.GetString().ToCdnMinimumTlsVersion(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnManagedHttpsContent(certificateSource, protocolType, Optional.ToNullable(minimumTlsVersion), certificateSourceParameters, serializedAdditionalRawData); + } + + CdnManagedHttpsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnManagedHttpsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnManagedHttpsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnManagedHttpsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnManagedHttpsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnManagedHttpsContent(Response response) + { + if (response is null) + { + return null; } - return new CdnManagedHttpsContent(certificateSource, protocolType, Optional.ToNullable(minimumTlsVersion), certificateSourceParameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnManagedHttpsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.cs index dcaef27204a4..096332b1cb1b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnManagedHttpsContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the certificate source parameters using CDN managed certificate for enabling SSL. public partial class CdnManagedHttpsContent : CustomDomainHttpsContent { - /// Initializes a new instance of CdnManagedHttpsContent. + /// Initializes a new instance of . /// Defines the TLS extension protocol that is used for secure delivery. /// Defines the certificate source parameters using CDN managed certificate for enabling SSL. /// is null. @@ -25,17 +26,23 @@ public CdnManagedHttpsContent(SecureDeliveryProtocolType protocolType, CdnCertif CertificateSource = CertificateSource.Cdn; } - /// Initializes a new instance of CdnManagedHttpsContent. + /// Initializes a new instance of . /// Defines the source of the SSL certificate. /// Defines the TLS extension protocol that is used for secure delivery. /// TLS protocol version that will be used for Https. /// Defines the certificate source parameters using CDN managed certificate for enabling SSL. - internal CdnManagedHttpsContent(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion, CdnCertificateSource certificateSourceParameters) : base(certificateSource, protocolType, minimumTlsVersion) + /// Keeps track of any properties unknown to the library. + internal CdnManagedHttpsContent(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion, CdnCertificateSource certificateSourceParameters, Dictionary serializedAdditionalRawData) : base(certificateSource, protocolType, minimumTlsVersion, serializedAdditionalRawData) { CertificateSourceParameters = certificateSourceParameters; CertificateSource = certificateSource; } + /// Initializes a new instance of for deserialization. + internal CdnManagedHttpsContent() + { + } + /// Defines the certificate source parameters using CDN managed certificate for enabling SSL. public CdnCertificateSource CertificateSourceParameters { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.Serialization.cs index d4ad83f559b7..49a61298c68d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnNameAvailabilityContent : IUtf8JsonSerializable + public partial class CdnNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CdnNameAvailabilityContent DeserializeCdnNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + CdnResourceType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new CdnResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + CdnNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.cs index 334a4a7874b0..7fa849936922 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Input of CheckNameAvailability API. public partial class CdnNameAvailabilityContent { - /// Initializes a new instance of CdnNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource name to validate. /// The type of the resource whose name is to be validated. /// is null. @@ -25,6 +29,22 @@ public CdnNameAvailabilityContent(string name, CdnResourceType resourceType) ResourceType = resourceType; } + /// Initializes a new instance of . + /// The resource name to validate. + /// The type of the resource whose name is to be validated. + /// Keeps track of any properties unknown to the library. + internal CdnNameAvailabilityContent(string name, CdnResourceType resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CdnNameAvailabilityContent() + { + } + /// The resource name to validate. public string Name { get; } /// The type of the resource whose name is to be validated. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.Serialization.cs index b756bcce23b0..5532c6eb6d56 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnNameAvailabilityResult + public partial class CdnNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CdnNameAvailabilityResult DeserializeCdnNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CdnNameAvailabilityResult DeserializeCdnNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static CdnNameAvailabilityResult DeserializeCdnNameAvailabilityResult(J Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -42,8 +71,61 @@ internal static CdnNameAvailabilityResult DeserializeCdnNameAvailabilityResult(J message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CdnNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value); + return new CdnNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value, serializedAdditionalRawData); + } + + CdnNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.cs index 2076241ee873..c44fc371ed3f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Output of check name availability API. public partial class CdnNameAvailabilityResult { - /// Initializes a new instance of CdnNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CdnNameAvailabilityResult() { } - /// Initializes a new instance of CdnNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates whether the name is available. /// The reason why the name is not available. /// The detailed error message describing why the name is not available. - internal CdnNameAvailabilityResult(bool? nameAvailable, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal CdnNameAvailabilityResult(bool? nameAvailable, string reason, string message, Dictionary serializedAdditionalRawData) { NameAvailable = nameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the name is available. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginData.Serialization.cs index fa03c7779043..233c8818dce7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class CdnOriginData : IUtf8JsonSerializable + public partial class CdnOriginData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -110,11 +118,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrivateLinkApprovalMessage); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnOriginData DeserializeCdnOriginData(JsonElement element) + internal static CdnOriginData DeserializeCdnOriginData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -137,6 +159,7 @@ internal static CdnOriginData DeserializeCdnOriginData(JsonElement element) Optional resourceState = default; Optional provisioningState = default; Optional privateEndpointStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -287,8 +310,61 @@ internal static CdnOriginData DeserializeCdnOriginData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnOriginData(id, name, type, systemData.Value, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), Optional.ToNullable(enabled), privateLinkAlias.Value, privateLinkResourceId.Value, privateLinkLocation.Value, privateLinkApprovalMessage.Value, Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState), Optional.ToNullable(privateEndpointStatus), serializedAdditionalRawData); + } + + CdnOriginData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnOriginData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnOriginData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnOriginData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnOriginData model) + { + if (model is null) + { + return null; } - return new CdnOriginData(id, name, type, systemData.Value, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), Optional.ToNullable(enabled), privateLinkAlias.Value, privateLinkResourceId.Value, privateLinkLocation.Value, privateLinkApprovalMessage.Value, Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState), Optional.ToNullable(privateEndpointStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnOriginData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnOriginData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupData.Serialization.cs index 4e1565ad94ae..841ab1d07a94 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn { - public partial class CdnOriginGroupData : IUtf8JsonSerializable + public partial class CdnOriginGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -26,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (HealthProbeSettings != null) { writer.WritePropertyName("healthProbeSettings"u8); - writer.WriteObjectValue(HealthProbeSettings); + if (HealthProbeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HealthProbeSettings).Serialize(writer, options); + } } else { @@ -60,7 +74,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (ResponseBasedOriginErrorDetectionSettings != null) { writer.WritePropertyName("responseBasedOriginErrorDetectionSettings"u8); - writer.WriteObjectValue(ResponseBasedOriginErrorDetectionSettings); + if (ResponseBasedOriginErrorDetectionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResponseBasedOriginErrorDetectionSettings).Serialize(writer, options); + } } else { @@ -68,11 +89,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnOriginGroupData DeserializeCdnOriginGroupData(JsonElement element) + internal static CdnOriginGroupData DeserializeCdnOriginGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +122,7 @@ internal static CdnOriginGroupData DeserializeCdnOriginGroupData(JsonElement ele Optional responseBasedOriginErrorDetectionSettings = default; Optional resourceState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -187,8 +223,61 @@ internal static CdnOriginGroupData DeserializeCdnOriginGroupData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnOriginGroupData(id, name, type, systemData.Value, healthProbeSettings.Value, Optional.ToList(origins), Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), responseBasedOriginErrorDetectionSettings.Value, Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CdnOriginGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnOriginGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnOriginGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnOriginGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnOriginGroupData model) + { + if (model is null) + { + return null; } - return new CdnOriginGroupData(id, name, type, systemData.Value, healthProbeSettings.Value, Optional.ToList(origins), Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), responseBasedOriginErrorDetectionSettings.Value, Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnOriginGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnOriginGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.Serialization.cs index 44ac68281bfc..38298a075da0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnOriginGroupPatch : IUtf8JsonSerializable + public partial class CdnOriginGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -22,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (HealthProbeSettings != null) { writer.WritePropertyName("healthProbeSettings"u8); - writer.WriteObjectValue(HealthProbeSettings); + if (HealthProbeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HealthProbeSettings).Serialize(writer, options); + } } else { @@ -56,7 +72,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (ResponseBasedOriginErrorDetectionSettings != null) { writer.WritePropertyName("responseBasedOriginErrorDetectionSettings"u8); - writer.WriteObjectValue(ResponseBasedOriginErrorDetectionSettings); + if (ResponseBasedOriginErrorDetectionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResponseBasedOriginErrorDetectionSettings).Serialize(writer, options); + } } else { @@ -64,7 +87,147 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CdnOriginGroupPatch DeserializeCdnOriginGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional healthProbeSettings = default; + Optional> origins = default; + Optional trafficRestorationTimeToHealedOrNewEndpointsInMinutes = default; + Optional responseBasedOriginErrorDetectionSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("healthProbeSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + healthProbeSettings = null; + continue; + } + healthProbeSettings = HealthProbeSettings.DeserializeHealthProbeSettings(property0.Value); + continue; + } + if (property0.NameEquals("origins"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + origins = array; + continue; + } + if (property0.NameEquals("trafficRestorationTimeToHealedOrNewEndpointsInMinutes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + trafficRestorationTimeToHealedOrNewEndpointsInMinutes = null; + continue; + } + trafficRestorationTimeToHealedOrNewEndpointsInMinutes = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("responseBasedOriginErrorDetectionSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + responseBasedOriginErrorDetectionSettings = null; + continue; + } + responseBasedOriginErrorDetectionSettings = ResponseBasedOriginErrorDetectionSettings.DeserializeResponseBasedOriginErrorDetectionSettings(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnOriginGroupPatch(healthProbeSettings.Value, Optional.ToList(origins), Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), responseBasedOriginErrorDetectionSettings.Value, serializedAdditionalRawData); + } + + CdnOriginGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnOriginGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnOriginGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnOriginGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnOriginGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnOriginGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnOriginGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.cs index 487d4ac02260..ef0cf2c13fb1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginGroupPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,12 +15,30 @@ namespace Azure.ResourceManager.Cdn.Models /// Origin group properties needed for origin group creation or update. public partial class CdnOriginGroupPatch { - /// Initializes a new instance of CdnOriginGroupPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnOriginGroupPatch() { Origins = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Health probe settings to the origin that is used to determine the health of the origin. + /// The source of the content being delivered via CDN within given origin group. + /// Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + /// The JSON object that contains the properties to determine origin health using real requests/responses. This property is currently not supported. + /// Keeps track of any properties unknown to the library. + internal CdnOriginGroupPatch(HealthProbeSettings healthProbeSettings, IList origins, int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes, ResponseBasedOriginErrorDetectionSettings responseBasedOriginErrorDetectionSettings, Dictionary serializedAdditionalRawData) + { + HealthProbeSettings = healthProbeSettings; + Origins = origins; + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes; + ResponseBasedOriginErrorDetectionSettings = responseBasedOriginErrorDetectionSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Health probe settings to the origin that is used to determine the health of the origin. public HealthProbeSettings HealthProbeSettings { get; set; } /// The source of the content being delivered via CDN within given origin group. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.Serialization.cs index 37a05ab96695..fef1f4438968 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnOriginPatch : IUtf8JsonSerializable + public partial class CdnOriginPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -108,7 +116,194 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrivateLinkApprovalMessage); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CdnOriginPatch DeserializeCdnOriginPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hostName = default; + Optional httpPort = default; + Optional httpsPort = default; + Optional originHostHeader = default; + Optional priority = default; + Optional weight = default; + Optional enabled = default; + Optional privateLinkAlias = default; + Optional privateLinkResourceId = default; + Optional privateLinkLocation = default; + Optional privateLinkApprovalMessage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("hostName"u8)) + { + hostName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("httpPort"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + httpPort = null; + continue; + } + httpPort = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("httpsPort"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + httpsPort = null; + continue; + } + httpsPort = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("originHostHeader"u8)) + { + originHostHeader = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("priority"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + priority = null; + continue; + } + priority = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("weight"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + weight = null; + continue; + } + weight = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("enabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("privateLinkAlias"u8)) + { + privateLinkAlias = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privateLinkResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + privateLinkResourceId = null; + continue; + } + privateLinkResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("privateLinkLocation"u8)) + { + privateLinkLocation = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privateLinkApprovalMessage"u8)) + { + privateLinkApprovalMessage = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnOriginPatch(hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), Optional.ToNullable(enabled), privateLinkAlias.Value, privateLinkResourceId.Value, privateLinkLocation.Value, privateLinkApprovalMessage.Value, serializedAdditionalRawData); + } + + CdnOriginPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnOriginPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnOriginPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnOriginPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnOriginPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnOriginPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnOriginPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.cs index f8d36471688f..06ef26c3118a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnOriginPatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,11 +14,43 @@ namespace Azure.ResourceManager.Cdn.Models /// Origin properties needed for origin update. public partial class CdnOriginPatch { - /// Initializes a new instance of CdnOriginPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnOriginPatch() { } + /// Initializes a new instance of . + /// The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + /// The value of the HTTP port. Must be between 1 and 65535. + /// The value of the HTTPS port. Must be between 1 and 65535. + /// The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. + /// Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. + /// Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. + /// Origin is enabled for load balancing or not. + /// The Alias of the Private Link resource. Populating this optional field indicates that this origin is 'Private'. + /// The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is 'Private'. + /// The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated. + /// A custom message to be included in the approval request to connect to the Private Link. + /// Keeps track of any properties unknown to the library. + internal CdnOriginPatch(string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, bool? enabled, string privateLinkAlias, ResourceIdentifier privateLinkResourceId, string privateLinkLocation, string privateLinkApprovalMessage, Dictionary serializedAdditionalRawData) + { + HostName = hostName; + HttpPort = httpPort; + HttpsPort = httpsPort; + OriginHostHeader = originHostHeader; + Priority = priority; + Weight = weight; + Enabled = enabled; + PrivateLinkAlias = privateLinkAlias; + PrivateLinkResourceId = privateLinkResourceId; + PrivateLinkLocation = privateLinkLocation; + PrivateLinkApprovalMessage = privateLinkApprovalMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. public string HostName { get; set; } /// The value of the HTTP port. Must be between 1 and 65535. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.Serialization.cs index 439394e6f6ba..a774e2e33227 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnSku : IUtf8JsonSerializable + public partial class CdnSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnSku DeserializeCdnSku(JsonElement element) + internal static CdnSku DeserializeCdnSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -41,8 +64,61 @@ internal static CdnSku DeserializeCdnSku(JsonElement element) name = new CdnSkuName(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnSku(Optional.ToNullable(name), serializedAdditionalRawData); + } + + CdnSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnSku model) + { + if (model is null) + { + return null; } - return new CdnSku(Optional.ToNullable(name)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.cs index 670e1d4eb28a..f11f4c485bd0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnSku.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// @@ -25,16 +28,21 @@ namespace Azure.ResourceManager.Cdn.Models /// public partial class CdnSku { - /// Initializes a new instance of CdnSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnSku() { } - /// Initializes a new instance of CdnSku. + /// Initializes a new instance of . /// Name of the pricing tier. - internal CdnSku(CdnSkuName? name) + /// Keeps track of any properties unknown to the library. + internal CdnSku(CdnSkuName? name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the pricing tier. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.Serialization.cs index 9d32ecd55a7c..742ff1f34418 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnUsage + public partial class CdnUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CdnUsage DeserializeCdnUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CdnUsage DeserializeCdnUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static CdnUsage DeserializeCdnUsage(JsonElement element) Optional unit = default; Optional currentValue = default; Optional limit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -56,8 +85,61 @@ internal static CdnUsage DeserializeCdnUsage(JsonElement element) limit = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CdnUsage(resourceType.Value, Optional.ToNullable(unit), Optional.ToNullable(currentValue), Optional.ToNullable(limit)); + return new CdnUsage(resourceType.Value, Optional.ToNullable(unit), Optional.ToNullable(currentValue), Optional.ToNullable(limit), serializedAdditionalRawData); + } + + CdnUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.cs index b53973eefa8c..d135dafc1e6e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnUsage.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Output of check resource usage API. public partial class CdnUsage { - /// Initializes a new instance of CdnUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CdnUsage() { } - /// Initializes a new instance of CdnUsage. + /// Initializes a new instance of . /// Resource type for which the usage is provided. /// Unit of the usage. e.g. count. /// Actual value of usage on the specified resource type. /// Quota of the specified resource type. - internal CdnUsage(string resourceType, CdnUsageUnit? unit, int? currentValue, int? limit) + /// Keeps track of any properties unknown to the library. + internal CdnUsage(string resourceType, CdnUsageUnit? unit, int? currentValue, int? limit, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Unit = unit; CurrentValue = currentValue; Limit = limit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource type for which the usage is provided. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyData.Serialization.cs index 6d556634349e..0ae7088cac6c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyData.Serialization.cs @@ -5,20 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn { - public partial class CdnWebApplicationFirewallPolicyData : IUtf8JsonSerializable + public partial class CdnWebApplicationFirewallPolicyData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ETag.Value.ToString()); } writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -45,29 +58,71 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PolicySettings)) { writer.WritePropertyName("policySettings"u8); - writer.WriteObjectValue(PolicySettings); + if (PolicySettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PolicySettings).Serialize(writer, options); + } } if (Optional.IsDefined(RateLimitSettings)) { writer.WritePropertyName("rateLimitRules"u8); - writer.WriteObjectValue(RateLimitSettings); + if (RateLimitSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RateLimitSettings).Serialize(writer, options); + } } if (Optional.IsDefined(CustomSettings)) { writer.WritePropertyName("customRules"u8); - writer.WriteObjectValue(CustomSettings); + if (CustomSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomSettings).Serialize(writer, options); + } } if (Optional.IsDefined(ManagedRules)) { writer.WritePropertyName("managedRules"u8); - writer.WriteObjectValue(ManagedRules); + if (ManagedRules is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedRules).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CdnWebApplicationFirewallPolicyData DeserializeCdnWebApplicationFirewallPolicyData(JsonElement element) + internal static CdnWebApplicationFirewallPolicyData DeserializeCdnWebApplicationFirewallPolicyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +142,7 @@ internal static CdnWebApplicationFirewallPolicyData DeserializeCdnWebApplication Optional> endpointLinks = default; Optional provisioningState = default; Optional resourceState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -226,8 +282,61 @@ internal static CdnWebApplicationFirewallPolicyData DeserializeCdnWebApplication } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnWebApplicationFirewallPolicyData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), sku, policySettings.Value, rateLimitRules.Value, customRules.Value, managedRules.Value, Optional.ToList(endpointLinks), Optional.ToNullable(provisioningState), Optional.ToNullable(resourceState), serializedAdditionalRawData); + } + + CdnWebApplicationFirewallPolicyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnWebApplicationFirewallPolicyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnWebApplicationFirewallPolicyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnWebApplicationFirewallPolicyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnWebApplicationFirewallPolicyData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnWebApplicationFirewallPolicyData(Response response) + { + if (response is null) + { + return null; } - return new CdnWebApplicationFirewallPolicyData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), sku, policySettings.Value, rateLimitRules.Value, customRules.Value, managedRules.Value, Optional.ToList(endpointLinks), Optional.ToNullable(provisioningState), Optional.ToNullable(resourceState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnWebApplicationFirewallPolicyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.Serialization.cs index 8ec32afc6ae5..bee9d61ef9af 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class CdnWebApplicationFirewallPolicyList + internal partial class CdnWebApplicationFirewallPolicyList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CdnWebApplicationFirewallPolicyList DeserializeCdnWebApplicationFirewallPolicyList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CdnWebApplicationFirewallPolicyList DeserializeCdnWebApplicationFirewallPolicyList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static CdnWebApplicationFirewallPolicyList DeserializeCdnWebApplication nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CdnWebApplicationFirewallPolicyList(Optional.ToList(value), nextLink.Value); + return new CdnWebApplicationFirewallPolicyList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CdnWebApplicationFirewallPolicyList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnWebApplicationFirewallPolicyList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnWebApplicationFirewallPolicyList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnWebApplicationFirewallPolicyList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnWebApplicationFirewallPolicyList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnWebApplicationFirewallPolicyList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnWebApplicationFirewallPolicyList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.cs index 62ed0428c6e0..26b4fc12c77b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines a list of WebApplicationFirewallPolicies for Azure CDN. It contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. internal partial class CdnWebApplicationFirewallPolicyList { - /// Initializes a new instance of CdnWebApplicationFirewallPolicyList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CdnWebApplicationFirewallPolicyList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CdnWebApplicationFirewallPolicyList. + /// Initializes a new instance of . /// List of Azure CDN WebApplicationFirewallPolicies within a resource group. /// URL to get the next set of WebApplicationFirewallPolicy objects if there are any. - internal CdnWebApplicationFirewallPolicyList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CdnWebApplicationFirewallPolicyList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Azure CDN WebApplicationFirewallPolicies within a resource group. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.Serialization.cs index f6130bb5cf2d..c21240265e8b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CdnWebApplicationFirewallPolicyPatch : IUtf8JsonSerializable + public partial class CdnWebApplicationFirewallPolicyPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CdnWebApplicationFirewallPolicyPatch DeserializeCdnWebApplicationFirewallPolicyPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CdnWebApplicationFirewallPolicyPatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + CdnWebApplicationFirewallPolicyPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCdnWebApplicationFirewallPolicyPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CdnWebApplicationFirewallPolicyPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCdnWebApplicationFirewallPolicyPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CdnWebApplicationFirewallPolicyPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CdnWebApplicationFirewallPolicyPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCdnWebApplicationFirewallPolicyPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.cs index 7fd9318352ec..424844076a52 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Properties required to update a CdnWebApplicationFirewallPolicy. public partial class CdnWebApplicationFirewallPolicyPatch { - /// Initializes a new instance of CdnWebApplicationFirewallPolicyPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CdnWebApplicationFirewallPolicyPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// CdnWebApplicationFirewallPolicy tags. + /// Keeps track of any properties unknown to the library. + internal CdnWebApplicationFirewallPolicyPatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// CdnWebApplicationFirewallPolicy tags. public IDictionary Tags { get; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.Serialization.cs index 105b76d162c0..d6866a50d41b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CidrIPAddress : IUtf8JsonSerializable + public partial class CidrIPAddress : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BaseIPAddress)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("prefixLength"u8); writer.WriteNumberValue(PrefixLength.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CidrIPAddress DeserializeCidrIPAddress(JsonElement element) + internal static CidrIPAddress DeserializeCidrIPAddress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional baseIPAddress = default; Optional prefixLength = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("baseIpAddress"u8)) @@ -52,8 +75,61 @@ internal static CidrIPAddress DeserializeCidrIPAddress(JsonElement element) prefixLength = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CidrIPAddress(baseIPAddress.Value, Optional.ToNullable(prefixLength), serializedAdditionalRawData); + } + + CidrIPAddress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCidrIPAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CidrIPAddress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCidrIPAddress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CidrIPAddress model) + { + if (model is null) + { + return null; } - return new CidrIPAddress(baseIPAddress.Value, Optional.ToNullable(prefixLength)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CidrIPAddress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCidrIPAddress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.cs index d6af21b3e971..8fd070cfae45 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CidrIPAddress.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// CIDR Ip address. public partial class CidrIPAddress { - /// Initializes a new instance of CidrIPAddress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CidrIPAddress() { } - /// Initializes a new instance of CidrIPAddress. + /// Initializes a new instance of . /// Ip address itself. /// The length of the prefix of the ip address. - internal CidrIPAddress(string baseIPAddress, int? prefixLength) + /// Keeps track of any properties unknown to the library. + internal CidrIPAddress(string baseIPAddress, int? prefixLength, Dictionary serializedAdditionalRawData) { BaseIPAddress = baseIPAddress; PrefixLength = prefixLength; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Ip address itself. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.Serialization.cs index d0d2ceb15459..b0e316931c1a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ClientPortMatchCondition : IUtf8JsonSerializable + public partial class ClientPortMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ClientPortMatchCondition DeserializeClientPortMatchCondition(JsonElement element) + internal static ClientPortMatchCondition DeserializeClientPortMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static ClientPortMatchCondition DeserializeClientPortMatchCondition(Jso Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static ClientPortMatchCondition DeserializeClientPortMatchCondition(Jso transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ClientPortMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + ClientPortMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClientPortMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClientPortMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClientPortMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClientPortMatchCondition model) + { + if (model is null) + { + return null; } - return new ClientPortMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClientPortMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClientPortMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.cs index aee8dccbe626..3e3e3a97366e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ClientPortMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for ClientPort match conditions. public partial class ClientPortMatchCondition { - /// Initializes a new instance of ClientPortMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public ClientPortMatchCondition(ClientPortMatchConditionType conditionType, ClientPortOperator clientPortOperator) @@ -24,19 +28,26 @@ public ClientPortMatchCondition(ClientPortMatchConditionType conditionType, Clie Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of ClientPortMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal ClientPortMatchCondition(ClientPortMatchConditionType conditionType, ClientPortOperator clientPortOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal ClientPortMatchCondition(ClientPortMatchConditionType conditionType, ClientPortOperator clientPortOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; ClientPortOperator = clientPortOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClientPortMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs index 80fe9aec35e0..7b543fbf70d2 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems + public partial class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems DeserializeComponents18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DateOn)) + { + writer.WritePropertyName("dateTime"u8); + writer.WriteStringValue(DateOn.Value, "O"); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems DeserializeComponents18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional dateTime = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dateTime"u8)) @@ -41,8 +79,61 @@ internal static Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsP value = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(Optional.ToNullable(dateTime), Optional.ToNullable(value)); + return new Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(Optional.ToNullable(dateTime), Optional.ToNullable(value), serializedAdditionalRawData); + } + + Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponents18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponents18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponents18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs index bb9cde345e02..a3d093eded62 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// The Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. public partial class Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems { - /// Initializes a new instance of Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems() { } - /// Initializes a new instance of Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. + /// Initializes a new instance of . /// /// - internal Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(DateTimeOffset? dateOn, float? value) + /// Keeps track of any properties unknown to the library. + internal Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems(DateTimeOffset? dateOn, float? value, Dictionary serializedAdditionalRawData) { DateOn = dateOn; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the date on. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs index 738640653aa6..abc02dafadef 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems + public partial class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems DeserializeComponents1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DateOn)) + { + writer.WritePropertyName("dateTime"u8); + writer.WriteStringValue(DateOn.Value, "O"); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems DeserializeComponents1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional dateTime = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dateTime"u8)) @@ -41,8 +79,61 @@ internal static Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsProp value = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(Optional.ToNullable(dateTime), Optional.ToNullable(value)); + return new Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(Optional.ToNullable(dateTime), Optional.ToNullable(value), serializedAdditionalRawData); + } + + Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponents1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponents1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponents1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs index 773a9bf70eae..90341d49c089 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// The Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. public partial class Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems { - /// Initializes a new instance of Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems() { } - /// Initializes a new instance of Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. + /// Initializes a new instance of . /// /// - internal Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(DateTimeOffset? dateOn, float? value) + /// Keeps track of any properties unknown to the library. + internal Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems(DateTimeOffset? dateOn, float? value, Dictionary serializedAdditionalRawData) { DateOn = dateOn; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the date on. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.Serialization.cs index 4ede1c05b0dc..c950a471b98d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems + public partial class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems DeserializeComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Metric)) + { + writer.WritePropertyName("metric"u8); + writer.WriteStringValue(Metric); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsDefined(Percentage)) + { + writer.WritePropertyName("percentage"u8); + writer.WriteNumberValue(Percentage.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems DeserializeComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPro Optional metric = default; Optional value = default; Optional percentage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metric"u8)) @@ -46,8 +90,61 @@ internal static ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPro percentage = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(metric.Value, Optional.ToNullable(value), Optional.ToNullable(percentage)); + return new ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(metric.Value, Optional.ToNullable(value), Optional.ToNullable(percentage), serializedAdditionalRawData); + } + + ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.cs index 7799330752f6..655de1c96c97 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. public partial class ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems { - /// Initializes a new instance of ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems() { } - /// Initializes a new instance of ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems. + /// Initializes a new instance of . /// /// /// - internal ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(string metric, long? value, double? percentage) + /// Keeps track of any properties unknown to the library. + internal ComponentsKpo1PjSchemasWafrankingsresponsePropertiesDataItemsPropertiesMetricsItems(string metric, long? value, double? percentage, Dictionary serializedAdditionalRawData) { Metric = metric; Value = value; Percentage = percentage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the metric. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.Serialization.cs index e3200e3918c1..a6f3b3791e9a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.Serialization.cs @@ -5,22 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ContinentsResponse + public partial class ContinentsResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinentsResponse DeserializeContinentsResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Continents)) + { + writer.WritePropertyName("continents"u8); + writer.WriteStartArray(); + foreach (var item in Continents) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CountryOrRegions)) + { + writer.WritePropertyName("countryOrRegions"u8); + writer.WriteStartArray(); + foreach (var item in CountryOrRegions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinentsResponse DeserializeContinentsResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> continents = default; Optional> countryOrRegions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("continents"u8)) @@ -51,8 +113,61 @@ internal static ContinentsResponse DeserializeContinentsResponse(JsonElement ele countryOrRegions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinentsResponse(Optional.ToList(continents), Optional.ToList(countryOrRegions)); + return new ContinentsResponse(Optional.ToList(continents), Optional.ToList(countryOrRegions), serializedAdditionalRawData); + } + + ContinentsResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinentsResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinentsResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinentsResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinentsResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinentsResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinentsResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.cs index 63ac7d3e1c40..2fae676173e7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Cdn.Models /// Continents Response. public partial class ContinentsResponse { - /// Initializes a new instance of ContinentsResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinentsResponse() { Continents = new ChangeTrackingList(); CountryOrRegions = new ChangeTrackingList(); } - /// Initializes a new instance of ContinentsResponse. + /// Initializes a new instance of . /// /// - internal ContinentsResponse(IReadOnlyList continents, IReadOnlyList countryOrRegions) + /// Keeps track of any properties unknown to the library. + internal ContinentsResponse(IReadOnlyList continents, IReadOnlyList countryOrRegions, Dictionary serializedAdditionalRawData) { Continents = continents; CountryOrRegions = countryOrRegions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the continents. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.Serialization.cs index dd95a403ebef..4b188ec21fb4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ContinentsResponseContinentsItem + public partial class ContinentsResponseContinentsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinentsResponseContinentsItem DeserializeContinentsResponseContinentsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinentsResponseContinentsItem DeserializeContinentsResponseContinentsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -26,8 +60,61 @@ internal static ContinentsResponseContinentsItem DeserializeContinentsResponseCo id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinentsResponseContinentsItem(id.Value); + return new ContinentsResponseContinentsItem(id.Value, serializedAdditionalRawData); + } + + ContinentsResponseContinentsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinentsResponseContinentsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinentsResponseContinentsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinentsResponseContinentsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinentsResponseContinentsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinentsResponseContinentsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinentsResponseContinentsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.cs index 6c698832bf76..a4124e60e073 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseContinentsItem.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The ContinentsResponseContinentsItem. public partial class ContinentsResponseContinentsItem { - /// Initializes a new instance of ContinentsResponseContinentsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinentsResponseContinentsItem() { } - /// Initializes a new instance of ContinentsResponseContinentsItem. + /// Initializes a new instance of . /// - internal ContinentsResponseContinentsItem(string id) + /// Keeps track of any properties unknown to the library. + internal ContinentsResponseContinentsItem(string id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the id. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.Serialization.cs index e6f020e12b13..97caea8e1a21 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ContinentsResponseCountryOrRegionsItem + public partial class ContinentsResponseCountryOrRegionsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinentsResponseCountryOrRegionsItem DeserializeContinentsResponseCountryOrRegionsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ContinentId)) + { + writer.WritePropertyName("continentId"u8); + writer.WriteStringValue(ContinentId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinentsResponseCountryOrRegionsItem DeserializeContinentsResponseCountryOrRegionsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional continentId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -32,8 +71,61 @@ internal static ContinentsResponseCountryOrRegionsItem DeserializeContinentsResp continentId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinentsResponseCountryOrRegionsItem(id.Value, continentId.Value); + return new ContinentsResponseCountryOrRegionsItem(id.Value, continentId.Value, serializedAdditionalRawData); + } + + ContinentsResponseCountryOrRegionsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinentsResponseCountryOrRegionsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinentsResponseCountryOrRegionsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinentsResponseCountryOrRegionsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinentsResponseCountryOrRegionsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinentsResponseCountryOrRegionsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinentsResponseCountryOrRegionsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.cs index 4ce6f3069e4d..8c28b3cb7087 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponseCountryOrRegionsItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The ContinentsResponseCountryOrRegionsItem. public partial class ContinentsResponseCountryOrRegionsItem { - /// Initializes a new instance of ContinentsResponseCountryOrRegionsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinentsResponseCountryOrRegionsItem() { } - /// Initializes a new instance of ContinentsResponseCountryOrRegionsItem. + /// Initializes a new instance of . /// /// - internal ContinentsResponseCountryOrRegionsItem(string id, string continentId) + /// Keeps track of any properties unknown to the library. + internal ContinentsResponseCountryOrRegionsItem(string id, string continentId, Dictionary serializedAdditionalRawData) { Id = id; ContinentId = continentId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the id. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.Serialization.cs index 94149f1a3eca..a090c0b0de0e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CookiesMatchCondition : IUtf8JsonSerializable + public partial class CookiesMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -50,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CookiesMatchCondition DeserializeCookiesMatchCondition(JsonElement element) + internal static CookiesMatchCondition DeserializeCookiesMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +86,7 @@ internal static CookiesMatchCondition DeserializeCookiesMatchCondition(JsonEleme Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -119,8 +141,61 @@ internal static CookiesMatchCondition DeserializeCookiesMatchCondition(JsonEleme transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CookiesMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + CookiesMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCookiesMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CookiesMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCookiesMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CookiesMatchCondition model) + { + if (model is null) + { + return null; } - return new CookiesMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CookiesMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCookiesMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.cs index 75750b208870..72c6d400c823 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CookiesMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for Cookies match conditions. public partial class CookiesMatchCondition { - /// Initializes a new instance of CookiesMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public CookiesMatchCondition(CookiesMatchConditionType conditionType, CookiesOperator cookiesOperator) @@ -24,14 +28,15 @@ public CookiesMatchCondition(CookiesMatchConditionType conditionType, CookiesOpe Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of CookiesMatchCondition. + /// Initializes a new instance of . /// /// Name of Cookies to be matched. /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal CookiesMatchCondition(CookiesMatchConditionType conditionType, string selector, CookiesOperator cookiesOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal CookiesMatchCondition(CookiesMatchConditionType conditionType, string selector, CookiesOperator cookiesOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; Selector = selector; @@ -39,6 +44,12 @@ internal CookiesMatchCondition(CookiesMatchConditionType conditionType, string s NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CookiesMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.Serialization.cs index ec1b0c9906f1..ce502bf0d5cd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CustomDomainHttpsContent : IUtf8JsonSerializable + public partial class CustomDomainHttpsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("certificateSource"u8); writer.WriteStringValue(CertificateSource.ToString()); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimumTlsVersion"u8); writer.WriteStringValue(MinimumTlsVersion.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomDomainHttpsContent DeserializeCustomDomainHttpsContent(JsonElement element) + internal static CustomDomainHttpsContent DeserializeCustomDomainHttpsContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,7 +63,88 @@ internal static CustomDomainHttpsContent DeserializeCustomDomainHttpsContent(Jso case "Cdn": return CdnManagedHttpsContent.DeserializeCdnManagedHttpsContent(element); } } - return UnknownCustomDomainHttpsParameters.DeserializeUnknownCustomDomainHttpsParameters(element); + + // Unknown type found so we will deserialize the base properties only + CertificateSource certificateSource = default; + SecureDeliveryProtocolType protocolType = default; + Optional minimumTlsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("certificateSource"u8)) + { + certificateSource = new CertificateSource(property.Value.GetString()); + continue; + } + if (property.NameEquals("protocolType"u8)) + { + protocolType = new SecureDeliveryProtocolType(property.Value.GetString()); + continue; + } + if (property.NameEquals("minimumTlsVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimumTlsVersion = property.Value.GetString().ToCdnMinimumTlsVersion(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownCustomDomainHttpsParameters(certificateSource, protocolType, Optional.ToNullable(minimumTlsVersion), serializedAdditionalRawData); + } + + CustomDomainHttpsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDomainHttpsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDomainHttpsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDomainHttpsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomDomainHttpsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomDomainHttpsContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomDomainHttpsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.cs index db0eb12ac654..9e26e7f7ebc8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainHttpsContent.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Cdn.Models { /// @@ -12,24 +16,35 @@ namespace Azure.ResourceManager.Cdn.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownCustomDomainHttpsParameters))] public abstract partial class CustomDomainHttpsContent { - /// Initializes a new instance of CustomDomainHttpsContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the TLS extension protocol that is used for secure delivery. protected CustomDomainHttpsContent(SecureDeliveryProtocolType protocolType) { ProtocolType = protocolType; } - /// Initializes a new instance of CustomDomainHttpsContent. + /// Initializes a new instance of . /// Defines the source of the SSL certificate. /// Defines the TLS extension protocol that is used for secure delivery. /// TLS protocol version that will be used for Https. - internal CustomDomainHttpsContent(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion) + /// Keeps track of any properties unknown to the library. + internal CustomDomainHttpsContent(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion, Dictionary serializedAdditionalRawData) { CertificateSource = certificateSource; ProtocolType = protocolType; MinimumTlsVersion = minimumTlsVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomDomainHttpsContent() + { } /// Defines the source of the SSL certificate. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.Serialization.cs index 5583b6454794..c0b3996e286c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class CustomDomainListResult + internal partial class CustomDomainListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CustomDomainListResult DeserializeCustomDomainListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CustomDomainListResult DeserializeCustomDomainListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static CustomDomainListResult DeserializeCustomDomainListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CustomDomainListResult(Optional.ToList(value), nextLink.Value); + return new CustomDomainListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CustomDomainListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDomainListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDomainListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDomainListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomDomainListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomDomainListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomDomainListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.cs index e53f25495421..ac3e8b2ada49 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomDomainListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list custom domains. It contains a list of custom domain objects and a URL link to get the next set of results. internal partial class CustomDomainListResult { - /// Initializes a new instance of CustomDomainListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CustomDomainListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CustomDomainListResult. + /// Initializes a new instance of . /// List of CDN CustomDomains within an endpoint. /// URL to get the next set of custom domain objects if there are any. - internal CustomDomainListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CustomDomainListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN CustomDomains within an endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.Serialization.cs index f708904e8946..8d2fd40f7d60 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CustomRule : IUtf8JsonSerializable + public partial class CustomRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -29,16 +36,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MatchConditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomRule DeserializeCustomRule(JsonElement element) + internal static CustomRule DeserializeCustomRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static CustomRule DeserializeCustomRule(JsonElement element) int priority = default; IList matchConditions = default; OverrideActionType action = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -84,8 +113,61 @@ internal static CustomRule DeserializeCustomRule(JsonElement element) action = new OverrideActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomRule(name, Optional.ToNullable(enabledState), priority, matchConditions, action, serializedAdditionalRawData); + } + + CustomRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomRule(Response response) + { + if (response is null) + { + return null; } - return new CustomRule(name, Optional.ToNullable(enabledState), priority, matchConditions, action); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.cs index 5be0ea98cdbc..720402e4f2c8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRule.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the common attributes for a custom rule that can be included in a waf policy. public partial class CustomRule { - /// Initializes a new instance of CustomRule. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the name of the custom rule. /// Defines in what order this rule be evaluated in the overall list of custom rules. /// List of match conditions. @@ -32,19 +35,26 @@ public CustomRule(string name, int priority, IEnumerable Initializes a new instance of CustomRule. + /// Initializes a new instance of . /// Defines the name of the custom rule. /// Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. /// Defines in what order this rule be evaluated in the overall list of custom rules. /// List of match conditions. /// Describes what action to be applied when rule matches. - internal CustomRule(string name, CustomRuleEnabledState? enabledState, int priority, IList matchConditions, OverrideActionType action) + /// Keeps track of any properties unknown to the library. + internal CustomRule(string name, CustomRuleEnabledState? enabledState, int priority, IList matchConditions, OverrideActionType action, Dictionary serializedAdditionalRawData) { Name = name; EnabledState = enabledState; Priority = priority; MatchConditions = matchConditions; Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomRule() + { } /// Defines the name of the custom rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.Serialization.cs index 8e9b599dddfd..7f133c918528 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class CustomRuleList : IUtf8JsonSerializable + internal partial class CustomRuleList : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Rules)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomRuleList DeserializeCustomRuleList(JsonElement element) + internal static CustomRuleList DeserializeCustomRuleList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rules"u8)) @@ -52,8 +81,61 @@ internal static CustomRuleList DeserializeCustomRuleList(JsonElement element) rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomRuleList(Optional.ToList(rules), serializedAdditionalRawData); + } + + CustomRuleList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomRuleList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomRuleList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomRuleList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomRuleList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomRuleList(Response response) + { + if (response is null) + { + return null; } - return new CustomRuleList(Optional.ToList(rules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomRuleList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.cs index 0f8220824501..3576780292f7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines contents of custom rules. internal partial class CustomRuleList { - /// Initializes a new instance of CustomRuleList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomRuleList() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of CustomRuleList. + /// Initializes a new instance of . /// List of rules. - internal CustomRuleList(IList rules) + /// Keeps track of any properties unknown to the library. + internal CustomRuleList(IList rules, Dictionary serializedAdditionalRawData) { Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of rules. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.Serialization.cs index e66d25f51e97..4af2f9e74bc9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class CustomRuleMatchCondition : IUtf8JsonSerializable + public partial class CustomRuleMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("matchVariable"u8); writer.WriteStringValue(MatchVariable.ToString()); @@ -47,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomRuleMatchCondition DeserializeCustomRuleMatchCondition(JsonElement element) + internal static CustomRuleMatchCondition DeserializeCustomRuleMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +83,7 @@ internal static CustomRuleMatchCondition DeserializeCustomRuleMatchCondition(Jso Optional negateCondition = default; IList matchValue = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("matchVariable"u8)) @@ -112,8 +134,61 @@ internal static CustomRuleMatchCondition DeserializeCustomRuleMatchCondition(Jso transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomRuleMatchCondition(matchVariable, selector.Value, @operator, Optional.ToNullable(negateCondition), matchValue, Optional.ToList(transforms), serializedAdditionalRawData); + } + + CustomRuleMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomRuleMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomRuleMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomRuleMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomRuleMatchCondition model) + { + if (model is null) + { + return null; } - return new CustomRuleMatchCondition(matchVariable, selector.Value, @operator, Optional.ToNullable(negateCondition), matchValue, Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomRuleMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomRuleMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.cs index 015359fa45f2..bc69e06dd7b8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomRuleMatchCondition.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Define match conditions. public partial class CustomRuleMatchCondition { - /// Initializes a new instance of CustomRuleMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Match variable to compare against. /// Describes operator to be matched. /// List of possible match values. @@ -30,14 +33,15 @@ public CustomRuleMatchCondition(WafMatchVariable matchVariable, MatchOperator ma Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of CustomRuleMatchCondition. + /// Initializes a new instance of . /// Match variable to compare against. /// Selector can used to match a specific key for QueryString, Cookies, RequestHeader or PostArgs. /// Describes operator to be matched. /// Describes if the result of this condition should be negated. /// List of possible match values. /// List of transforms. - internal CustomRuleMatchCondition(WafMatchVariable matchVariable, string selector, MatchOperator matchOperator, bool? negateCondition, IList matchValue, IList transforms) + /// Keeps track of any properties unknown to the library. + internal CustomRuleMatchCondition(WafMatchVariable matchVariable, string selector, MatchOperator matchOperator, bool? negateCondition, IList matchValue, IList transforms, Dictionary serializedAdditionalRawData) { MatchVariable = matchVariable; Selector = selector; @@ -45,6 +49,12 @@ internal CustomRuleMatchCondition(WafMatchVariable matchVariable, string selecto NegateCondition = negateCondition; MatchValue = matchValue; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomRuleMatchCondition() + { } /// Match variable to compare against. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.Serialization.cs index cc17b704fcf3..4fafcfe9c0cd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class CustomerCertificateProperties : IUtf8JsonSerializable + public partial class CustomerCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("secretSource"u8); JsonSerializer.Serialize(writer, SecretSource); if (Optional.IsDefined(SecretVersion)) @@ -41,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(SecretType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomerCertificateProperties DeserializeCustomerCertificateProperties(JsonElement element) + internal static CustomerCertificateProperties DeserializeCustomerCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +79,7 @@ internal static CustomerCertificateProperties DeserializeCustomerCertificateProp Optional> subjectAlternativeNames = default; Optional thumbprint = default; SecretType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretSource"u8)) @@ -123,8 +144,61 @@ internal static CustomerCertificateProperties DeserializeCustomerCertificateProp type = new SecretType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomerCertificateProperties(type, secretSource, secretVersion.Value, Optional.ToNullable(useLatestVersion), subject.Value, Optional.ToNullable(expirationDate), certificateAuthority.Value, Optional.ToList(subjectAlternativeNames), thumbprint.Value, serializedAdditionalRawData); + } + + CustomerCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomerCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomerCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomerCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomerCertificateProperties model) + { + if (model is null) + { + return null; } - return new CustomerCertificateProperties(type, secretSource, secretVersion.Value, Optional.ToNullable(useLatestVersion), subject.Value, Optional.ToNullable(expirationDate), certificateAuthority.Value, Optional.ToList(subjectAlternativeNames), thumbprint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomerCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomerCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.cs index 8225a1af2ba1..46acac15ec4b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/CustomerCertificateProperties.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Customer Certificate used for https. public partial class CustomerCertificateProperties : FrontDoorSecretProperties { - /// Initializes a new instance of CustomerCertificateProperties. + /// Initializes a new instance of . /// Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. /// is null. public CustomerCertificateProperties(WritableSubResource secretSource) @@ -27,7 +27,7 @@ public CustomerCertificateProperties(WritableSubResource secretSource) SecretType = SecretType.CustomerCertificate; } - /// Initializes a new instance of CustomerCertificateProperties. + /// Initializes a new instance of . /// The type of the secret resource. /// Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. /// Version of the secret to be used. @@ -37,7 +37,8 @@ public CustomerCertificateProperties(WritableSubResource secretSource) /// Certificate issuing authority. /// The list of SANs. /// Certificate thumbprint. - internal CustomerCertificateProperties(SecretType secretType, WritableSubResource secretSource, string secretVersion, bool? useLatestVersion, string subject, DateTimeOffset? expiresOn, string certificateAuthority, IList subjectAlternativeNames, string thumbprint) : base(secretType) + /// Keeps track of any properties unknown to the library. + internal CustomerCertificateProperties(SecretType secretType, WritableSubResource secretSource, string secretVersion, bool? useLatestVersion, string subject, DateTimeOffset? expiresOn, string certificateAuthority, IList subjectAlternativeNames, string thumbprint, Dictionary serializedAdditionalRawData) : base(secretType, serializedAdditionalRawData) { SecretSource = secretSource; SecretVersion = secretVersion; @@ -50,6 +51,11 @@ internal CustomerCertificateProperties(SecretType secretType, WritableSubResourc SecretType = secretType; } + /// Initializes a new instance of for deserialization. + internal CustomerCertificateProperties() + { + } + /// Resource reference to the Azure Key Vault certificate. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{certificateName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. internal WritableSubResource SecretSource { get; set; } /// Gets or sets Id. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.Serialization.cs index fbd917bd5977..956de8ed3bd3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeepCreatedOrigin : IUtf8JsonSerializable + public partial class DeepCreatedOrigin : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -110,11 +118,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrivateLinkApprovalMessage); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeepCreatedOrigin DeserializeDeepCreatedOrigin(JsonElement element) + internal static DeepCreatedOrigin DeserializeDeepCreatedOrigin(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -132,6 +154,7 @@ internal static DeepCreatedOrigin DeserializeDeepCreatedOrigin(JsonElement eleme Optional privateLinkLocation = default; Optional privateLinkApprovalMessage = default; Optional privateEndpointStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -245,8 +268,61 @@ internal static DeepCreatedOrigin DeserializeDeepCreatedOrigin(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeepCreatedOrigin(name, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), Optional.ToNullable(enabled), privateLinkAlias.Value, privateLinkResourceId.Value, privateLinkLocation.Value, privateLinkApprovalMessage.Value, Optional.ToNullable(privateEndpointStatus), serializedAdditionalRawData); + } + + DeepCreatedOrigin IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeepCreatedOrigin(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeepCreatedOrigin IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeepCreatedOrigin(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeepCreatedOrigin model) + { + if (model is null) + { + return null; } - return new DeepCreatedOrigin(name, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), Optional.ToNullable(enabled), privateLinkAlias.Value, privateLinkResourceId.Value, privateLinkLocation.Value, privateLinkApprovalMessage.Value, Optional.ToNullable(privateEndpointStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeepCreatedOrigin(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeepCreatedOrigin(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.cs index dd13755f6638..1d5fefecf2a7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOrigin.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// The main origin of CDN content which is added when creating a CDN endpoint. public partial class DeepCreatedOrigin { - /// Initializes a new instance of DeepCreatedOrigin. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Origin name which must be unique within the endpoint. /// is null. public DeepCreatedOrigin(string name) @@ -23,7 +27,7 @@ public DeepCreatedOrigin(string name) Name = name; } - /// Initializes a new instance of DeepCreatedOrigin. + /// Initializes a new instance of . /// Origin name which must be unique within the endpoint. /// The address of the origin. It can be a domain name, IPv4 address, or IPv6 address. This should be unique across all origins in an endpoint. /// The value of the HTTP port. Must be between 1 and 65535. @@ -37,7 +41,8 @@ public DeepCreatedOrigin(string name) /// The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated. /// A custom message to be included in the approval request to connect to the Private Link. /// The approval status for the connection to the Private Link. - internal DeepCreatedOrigin(string name, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, bool? enabled, string privateLinkAlias, ResourceIdentifier privateLinkResourceId, string privateLinkLocation, string privateLinkApprovalMessage, PrivateEndpointStatus? privateEndpointStatus) + /// Keeps track of any properties unknown to the library. + internal DeepCreatedOrigin(string name, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, bool? enabled, string privateLinkAlias, ResourceIdentifier privateLinkResourceId, string privateLinkLocation, string privateLinkApprovalMessage, PrivateEndpointStatus? privateEndpointStatus, Dictionary serializedAdditionalRawData) { Name = name; HostName = hostName; @@ -52,6 +57,12 @@ internal DeepCreatedOrigin(string name, string hostName, int? httpPort, int? htt PrivateLinkLocation = privateLinkLocation; PrivateLinkApprovalMessage = privateLinkApprovalMessage; PrivateEndpointStatus = privateEndpointStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeepCreatedOrigin() + { } /// Origin name which must be unique within the endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.Serialization.cs index 77ae1e05264b..4938347a6b22 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeepCreatedOriginGroup : IUtf8JsonSerializable + public partial class DeepCreatedOriginGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -26,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (HealthProbeSettings != null) { writer.WritePropertyName("healthProbeSettings"u8); - writer.WriteObjectValue(HealthProbeSettings); + if (HealthProbeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HealthProbeSettings).Serialize(writer, options); + } } else { @@ -60,7 +74,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (ResponseBasedOriginErrorDetectionSettings != null) { writer.WritePropertyName("responseBasedOriginErrorDetectionSettings"u8); - writer.WriteObjectValue(ResponseBasedOriginErrorDetectionSettings); + if (ResponseBasedOriginErrorDetectionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResponseBasedOriginErrorDetectionSettings).Serialize(writer, options); + } } else { @@ -68,11 +89,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeepCreatedOriginGroup DeserializeDeepCreatedOriginGroup(JsonElement element) + internal static DeepCreatedOriginGroup DeserializeDeepCreatedOriginGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -82,6 +117,7 @@ internal static DeepCreatedOriginGroup DeserializeDeepCreatedOriginGroup(JsonEle Optional> origins = default; Optional trafficRestorationTimeToHealedOrNewEndpointsInMinutes = default; Optional responseBasedOriginErrorDetectionSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -145,8 +181,61 @@ internal static DeepCreatedOriginGroup DeserializeDeepCreatedOriginGroup(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeepCreatedOriginGroup(name, healthProbeSettings.Value, Optional.ToList(origins), Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), responseBasedOriginErrorDetectionSettings.Value, serializedAdditionalRawData); + } + + DeepCreatedOriginGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeepCreatedOriginGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeepCreatedOriginGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeepCreatedOriginGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeepCreatedOriginGroup model) + { + if (model is null) + { + return null; } - return new DeepCreatedOriginGroup(name, healthProbeSettings.Value, Optional.ToList(origins), Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), responseBasedOriginErrorDetectionSettings.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeepCreatedOriginGroup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeepCreatedOriginGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs index 324ee2125bec..3dbba4453078 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// The origin group for CDN content which is added when creating a CDN endpoint. Traffic is sent to the origins within the origin group based on origin health. public partial class DeepCreatedOriginGroup { - /// Initializes a new instance of DeepCreatedOriginGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Origin group name which must be unique within the endpoint. /// is null. public DeepCreatedOriginGroup(string name) @@ -26,19 +29,26 @@ public DeepCreatedOriginGroup(string name) Origins = new ChangeTrackingList(); } - /// Initializes a new instance of DeepCreatedOriginGroup. + /// Initializes a new instance of . /// Origin group name which must be unique within the endpoint. /// Health probe settings to the origin that is used to determine the health of the origin. /// The source of the content being delivered via CDN within given origin group. /// Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. /// The JSON object that contains the properties to determine origin health using real requests/responses.This property is currently not supported. - internal DeepCreatedOriginGroup(string name, HealthProbeSettings healthProbeSettings, IList origins, int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes, ResponseBasedOriginErrorDetectionSettings responseBasedOriginErrorDetectionSettings) + /// Keeps track of any properties unknown to the library. + internal DeepCreatedOriginGroup(string name, HealthProbeSettings healthProbeSettings, IList origins, int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes, ResponseBasedOriginErrorDetectionSettings responseBasedOriginErrorDetectionSettings, Dictionary serializedAdditionalRawData) { Name = name; HealthProbeSettings = healthProbeSettings; Origins = origins; TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes; ResponseBasedOriginErrorDetectionSettings = responseBasedOriginErrorDetectionSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeepCreatedOriginGroup() + { } /// Origin group name which must be unique within the endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.Serialization.cs index f8dd5f0fdd59..e1af95664aed 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRule : IUtf8JsonSerializable + public partial class DeliveryRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Conditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,14 +51,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Actions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRule DeserializeDeliveryRule(JsonElement element) + internal static DeliveryRule DeserializeDeliveryRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +88,7 @@ internal static DeliveryRule DeserializeDeliveryRule(JsonElement element) int order = default; Optional> conditions = default; IList actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -89,8 +125,61 @@ internal static DeliveryRule DeserializeDeliveryRule(JsonElement element) actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRule(name.Value, order, Optional.ToList(conditions), actions, serializedAdditionalRawData); + } + + DeliveryRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRule model) + { + if (model is null) + { + return null; } - return new DeliveryRule(name.Value, order, Optional.ToList(conditions), actions); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.cs index 2573b6c11bfc..b7bb0402e775 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRule.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// A rule that specifies a set of actions and conditions. public partial class DeliveryRule { - /// Initializes a new instance of DeliveryRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. /// /// A list of actions that are executed when all the conditions of a rule are satisfied. @@ -32,7 +35,7 @@ public DeliveryRule(int order, IEnumerable actions) Actions = actions.ToList(); } - /// Initializes a new instance of DeliveryRule. + /// Initializes a new instance of . /// Name of the rule. /// The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. /// @@ -45,12 +48,19 @@ public DeliveryRule(int order, IEnumerable actions) /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , , , , and . /// - internal DeliveryRule(string name, int order, IList conditions, IList actions) + /// Keeps track of any properties unknown to the library. + internal DeliveryRule(string name, int order, IList conditions, IList actions, Dictionary serializedAdditionalRawData) { Name = name; Order = order; Conditions = conditions; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeliveryRule() + { } /// Name of the rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.Serialization.cs index 6a14f0a822c3..8c816b7785ee 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleAction : IUtf8JsonSerializable + public partial class DeliveryRuleAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleAction DeserializeDeliveryRuleAction(JsonElement element) + internal static DeliveryRuleAction DeserializeDeliveryRuleAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,7 +63,72 @@ internal static DeliveryRuleAction DeserializeDeliveryRuleAction(JsonElement ele case "UrlSigning": return UriSigningAction.DeserializeUriSigningAction(element); } } - return UnknownDeliveryRuleAction.DeserializeUnknownDeliveryRuleAction(element); + + // Unknown type found so we will deserialize the base properties only + DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new DeliveryRuleActionType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDeliveryRuleAction(name, serializedAdditionalRawData); + } + + DeliveryRuleAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.cs index fd6e439cfade..9285a28fd51c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleAction.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Cdn.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , , , , and . /// + [DeserializationProxy(typeof(UnknownDeliveryRuleAction))] public abstract partial class DeliveryRuleAction { - /// Initializes a new instance of DeliveryRuleAction. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DeliveryRuleAction() { } - /// Initializes a new instance of DeliveryRuleAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. - internal DeliveryRuleAction(DeliveryRuleActionType name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleAction(DeliveryRuleActionType name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the action for the delivery rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.Serialization.cs index b2634f3aa7c8..493f7d75e673 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleCacheExpirationAction : IUtf8JsonSerializable + public partial class DeliveryRuleCacheExpirationAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleCacheExpirationAction DeserializeDeliveryRuleCacheExpirationAction(JsonElement element) + internal static DeliveryRuleCacheExpirationAction DeserializeDeliveryRuleCacheExpirationAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CacheExpirationActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleCacheExpirationAction DeserializeDeliveryRuleCacheEx name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleCacheExpirationAction(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleCacheExpirationAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleCacheExpirationAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleCacheExpirationAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleCacheExpirationAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleCacheExpirationAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleCacheExpirationAction(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleCacheExpirationAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleCacheExpirationAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.cs index fdc4f2de71c8..38ae455bf8ab 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheExpirationAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the cache expiration action for the delivery rule. public partial class DeliveryRuleCacheExpirationAction : DeliveryRuleAction { - /// Initializes a new instance of DeliveryRuleCacheExpirationAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public DeliveryRuleCacheExpirationAction(CacheExpirationActionProperties properties) @@ -24,15 +25,21 @@ public DeliveryRuleCacheExpirationAction(CacheExpirationActionProperties propert Name = DeliveryRuleActionType.CacheExpiration; } - /// Initializes a new instance of DeliveryRuleCacheExpirationAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal DeliveryRuleCacheExpirationAction(DeliveryRuleActionType name, CacheExpirationActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleCacheExpirationAction(DeliveryRuleActionType name, CacheExpirationActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleCacheExpirationAction() + { + } + /// Defines the parameters for the action. public CacheExpirationActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.Serialization.cs index de1c06b8d9f8..9f025f8a76a4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleCacheKeyQueryStringAction : IUtf8JsonSerializable + public partial class DeliveryRuleCacheKeyQueryStringAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleCacheKeyQueryStringAction DeserializeDeliveryRuleCacheKeyQueryStringAction(JsonElement element) + internal static DeliveryRuleCacheKeyQueryStringAction DeserializeDeliveryRuleCacheKeyQueryStringAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CacheKeyQueryStringActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleCacheKeyQueryStringAction DeserializeDeliveryRuleCac name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleCacheKeyQueryStringAction(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleCacheKeyQueryStringAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleCacheKeyQueryStringAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleCacheKeyQueryStringAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleCacheKeyQueryStringAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleCacheKeyQueryStringAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleCacheKeyQueryStringAction(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleCacheKeyQueryStringAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleCacheKeyQueryStringAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.cs index 605af12b4763..606c4b3cb719 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCacheKeyQueryStringAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the cache-key query string action for the delivery rule. public partial class DeliveryRuleCacheKeyQueryStringAction : DeliveryRuleAction { - /// Initializes a new instance of DeliveryRuleCacheKeyQueryStringAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public DeliveryRuleCacheKeyQueryStringAction(CacheKeyQueryStringActionProperties properties) @@ -24,15 +25,21 @@ public DeliveryRuleCacheKeyQueryStringAction(CacheKeyQueryStringActionProperties Name = DeliveryRuleActionType.CacheKeyQueryString; } - /// Initializes a new instance of DeliveryRuleCacheKeyQueryStringAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleActionType name, CacheKeyQueryStringActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleCacheKeyQueryStringAction(DeliveryRuleActionType name, CacheKeyQueryStringActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleCacheKeyQueryStringAction() + { + } + /// Defines the parameters for the action. public CacheKeyQueryStringActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.Serialization.cs index 2c0d91b7b997..753ffd5958d0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleClientPortCondition : IUtf8JsonSerializable + public partial class DeliveryRuleClientPortCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleClientPortCondition DeserializeDeliveryRuleClientPortCondition(JsonElement element) + internal static DeliveryRuleClientPortCondition DeserializeDeliveryRuleClientPortCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ClientPortMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleClientPortCondition DeserializeDeliveryRuleClientPor name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleClientPortCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleClientPortCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleClientPortCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleClientPortCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleClientPortCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleClientPortCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleClientPortCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleClientPortCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleClientPortCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.cs index 96104afedf94..35d5f7dea640 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleClientPortCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the ClientPort condition for the delivery rule. public partial class DeliveryRuleClientPortCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleClientPortCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleClientPortCondition(ClientPortMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleClientPortCondition(ClientPortMatchCondition properties) Name = MatchVariable.ClientPort; } - /// Initializes a new instance of DeliveryRuleClientPortCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleClientPortCondition(MatchVariable name, ClientPortMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleClientPortCondition(MatchVariable name, ClientPortMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleClientPortCondition() + { + } + /// Defines the parameters for the condition. public ClientPortMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.Serialization.cs index 5fdb21cfcf3e..49cc8869c2af 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleCondition : IUtf8JsonSerializable + public partial class DeliveryRuleCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleCondition DeserializeDeliveryRuleCondition(JsonElement element) + internal static DeliveryRuleCondition DeserializeDeliveryRuleCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,7 +73,72 @@ internal static DeliveryRuleCondition DeserializeDeliveryRuleCondition(JsonEleme case "UrlPath": return DeliveryRuleUriPathCondition.DeserializeDeliveryRuleUriPathCondition(element); } } - return UnknownDeliveryRuleCondition.DeserializeUnknownDeliveryRuleCondition(element); + + // Unknown type found so we will deserialize the base properties only + MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new MatchVariable(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDeliveryRuleCondition(name, serializedAdditionalRawData); + } + + DeliveryRuleCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.cs index 42a027bc44dc..179727583285 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCondition.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Cdn.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , , , , , , , , , , , , , , and . /// + [DeserializationProxy(typeof(UnknownDeliveryRuleCondition))] public abstract partial class DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleCondition. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DeliveryRuleCondition() { } - /// Initializes a new instance of DeliveryRuleCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. - internal DeliveryRuleCondition(MatchVariable name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleCondition(MatchVariable name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the condition for the delivery rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.Serialization.cs index 0147704259b1..1f5cfe8c74e3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleCookiesCondition : IUtf8JsonSerializable + public partial class DeliveryRuleCookiesCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleCookiesCondition DeserializeDeliveryRuleCookiesCondition(JsonElement element) + internal static DeliveryRuleCookiesCondition DeserializeDeliveryRuleCookiesCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CookiesMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleCookiesCondition DeserializeDeliveryRuleCookiesCondi name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleCookiesCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleCookiesCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleCookiesCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleCookiesCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleCookiesCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleCookiesCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleCookiesCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleCookiesCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleCookiesCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.cs index e7afd8cc89f7..bfc3052d9d2b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleCookiesCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the Cookies condition for the delivery rule. public partial class DeliveryRuleCookiesCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleCookiesCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleCookiesCondition(CookiesMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleCookiesCondition(CookiesMatchCondition properties) Name = MatchVariable.Cookies; } - /// Initializes a new instance of DeliveryRuleCookiesCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleCookiesCondition(MatchVariable name, CookiesMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleCookiesCondition(MatchVariable name, CookiesMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleCookiesCondition() + { + } + /// Defines the parameters for the condition. public CookiesMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.Serialization.cs index 4631853e3ec2..8b09a9cdfb7e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleHostNameCondition : IUtf8JsonSerializable + public partial class DeliveryRuleHostNameCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleHostNameCondition DeserializeDeliveryRuleHostNameCondition(JsonElement element) + internal static DeliveryRuleHostNameCondition DeserializeDeliveryRuleHostNameCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } HostNameMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleHostNameCondition DeserializeDeliveryRuleHostNameCon name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleHostNameCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleHostNameCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleHostNameCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleHostNameCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleHostNameCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleHostNameCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleHostNameCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleHostNameCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleHostNameCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.cs index 6c8c5ead74e3..1bef4c039a24 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHostNameCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the HostName condition for the delivery rule. public partial class DeliveryRuleHostNameCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleHostNameCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleHostNameCondition(HostNameMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleHostNameCondition(HostNameMatchCondition properties) Name = MatchVariable.HostName; } - /// Initializes a new instance of DeliveryRuleHostNameCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleHostNameCondition(MatchVariable name, HostNameMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleHostNameCondition(MatchVariable name, HostNameMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleHostNameCondition() + { + } + /// Defines the parameters for the condition. public HostNameMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.Serialization.cs index 05a9e2c07cf9..7a0886616660 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleHttpVersionCondition : IUtf8JsonSerializable + public partial class DeliveryRuleHttpVersionCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleHttpVersionCondition DeserializeDeliveryRuleHttpVersionCondition(JsonElement element) + internal static DeliveryRuleHttpVersionCondition DeserializeDeliveryRuleHttpVersionCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } HttpVersionMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleHttpVersionCondition DeserializeDeliveryRuleHttpVers name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleHttpVersionCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleHttpVersionCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleHttpVersionCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleHttpVersionCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleHttpVersionCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleHttpVersionCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleHttpVersionCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleHttpVersionCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleHttpVersionCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.cs index a8d1ee9aab7c..5c9dd04a14eb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleHttpVersionCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the HttpVersion condition for the delivery rule. public partial class DeliveryRuleHttpVersionCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleHttpVersionCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleHttpVersionCondition(HttpVersionMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleHttpVersionCondition(HttpVersionMatchCondition properties) Name = MatchVariable.HttpVersion; } - /// Initializes a new instance of DeliveryRuleHttpVersionCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleHttpVersionCondition(MatchVariable name, HttpVersionMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleHttpVersionCondition(MatchVariable name, HttpVersionMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleHttpVersionCondition() + { + } + /// Defines the parameters for the condition. public HttpVersionMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.Serialization.cs index b424241121fe..63ffaa278110 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleIsDeviceCondition : IUtf8JsonSerializable + public partial class DeliveryRuleIsDeviceCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleIsDeviceCondition DeserializeDeliveryRuleIsDeviceCondition(JsonElement element) + internal static DeliveryRuleIsDeviceCondition DeserializeDeliveryRuleIsDeviceCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IsDeviceMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleIsDeviceCondition DeserializeDeliveryRuleIsDeviceCon name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleIsDeviceCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleIsDeviceCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleIsDeviceCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleIsDeviceCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleIsDeviceCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleIsDeviceCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleIsDeviceCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleIsDeviceCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleIsDeviceCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.cs index 4f896b1d55b0..98c977eabee6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleIsDeviceCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the IsDevice condition for the delivery rule. public partial class DeliveryRuleIsDeviceCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleIsDeviceCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleIsDeviceCondition(IsDeviceMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleIsDeviceCondition(IsDeviceMatchCondition properties) Name = MatchVariable.IsDevice; } - /// Initializes a new instance of DeliveryRuleIsDeviceCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleIsDeviceCondition(MatchVariable name, IsDeviceMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleIsDeviceCondition(MatchVariable name, IsDeviceMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleIsDeviceCondition() + { + } + /// Defines the parameters for the condition. public IsDeviceMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.Serialization.cs index e61fb6338010..aaee6115af9d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRulePostArgsCondition : IUtf8JsonSerializable + public partial class DeliveryRulePostArgsCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRulePostArgsCondition DeserializeDeliveryRulePostArgsCondition(JsonElement element) + internal static DeliveryRulePostArgsCondition DeserializeDeliveryRulePostArgsCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } PostArgsMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRulePostArgsCondition DeserializeDeliveryRulePostArgsCon name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRulePostArgsCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRulePostArgsCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRulePostArgsCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRulePostArgsCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRulePostArgsCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRulePostArgsCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRulePostArgsCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRulePostArgsCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRulePostArgsCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.cs index 549765b8dd02..3c29c0240009 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRulePostArgsCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the PostArgs condition for the delivery rule. public partial class DeliveryRulePostArgsCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRulePostArgsCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRulePostArgsCondition(PostArgsMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRulePostArgsCondition(PostArgsMatchCondition properties) Name = MatchVariable.PostArgs; } - /// Initializes a new instance of DeliveryRulePostArgsCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRulePostArgsCondition(MatchVariable name, PostArgsMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRulePostArgsCondition(MatchVariable name, PostArgsMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRulePostArgsCondition() + { + } + /// Defines the parameters for the condition. public PostArgsMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.Serialization.cs index cb57f5233787..5e587579d3c5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleQueryStringCondition : IUtf8JsonSerializable + public partial class DeliveryRuleQueryStringCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleQueryStringCondition DeserializeDeliveryRuleQueryStringCondition(JsonElement element) + internal static DeliveryRuleQueryStringCondition DeserializeDeliveryRuleQueryStringCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } QueryStringMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleQueryStringCondition DeserializeDeliveryRuleQueryStr name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleQueryStringCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleQueryStringCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleQueryStringCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleQueryStringCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleQueryStringCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleQueryStringCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleQueryStringCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleQueryStringCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleQueryStringCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.cs index 15d794697477..289402e10a88 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleQueryStringCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the QueryString condition for the delivery rule. public partial class DeliveryRuleQueryStringCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleQueryStringCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleQueryStringCondition(QueryStringMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleQueryStringCondition(QueryStringMatchCondition properties) Name = MatchVariable.QueryString; } - /// Initializes a new instance of DeliveryRuleQueryStringCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleQueryStringCondition(MatchVariable name, QueryStringMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleQueryStringCondition(MatchVariable name, QueryStringMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleQueryStringCondition() + { + } + /// Defines the parameters for the condition. public QueryStringMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.Serialization.cs index fcecc54788d1..e15f6584191f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRemoteAddressCondition : IUtf8JsonSerializable + public partial class DeliveryRuleRemoteAddressCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRemoteAddressCondition DeserializeDeliveryRuleRemoteAddressCondition(JsonElement element) + internal static DeliveryRuleRemoteAddressCondition DeserializeDeliveryRuleRemoteAddressCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RemoteAddressMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRemoteAddressCondition DeserializeDeliveryRuleRemote name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRemoteAddressCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRemoteAddressCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRemoteAddressCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRemoteAddressCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRemoteAddressCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRemoteAddressCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRemoteAddressCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRemoteAddressCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRemoteAddressCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.cs index a18e295c7f2b..df274f65bac8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRemoteAddressCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the RemoteAddress condition for the delivery rule. public partial class DeliveryRuleRemoteAddressCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleRemoteAddressCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleRemoteAddressCondition(RemoteAddressMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleRemoteAddressCondition(RemoteAddressMatchCondition properties Name = MatchVariable.RemoteAddress; } - /// Initializes a new instance of DeliveryRuleRemoteAddressCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleRemoteAddressCondition(MatchVariable name, RemoteAddressMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRemoteAddressCondition(MatchVariable name, RemoteAddressMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRemoteAddressCondition() + { + } + /// Defines the parameters for the condition. public RemoteAddressMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.Serialization.cs index 77c237b019f0..b099412ae0a7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRequestBodyCondition : IUtf8JsonSerializable + public partial class DeliveryRuleRequestBodyCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRequestBodyCondition DeserializeDeliveryRuleRequestBodyCondition(JsonElement element) + internal static DeliveryRuleRequestBodyCondition DeserializeDeliveryRuleRequestBodyCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RequestBodyMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRequestBodyCondition DeserializeDeliveryRuleRequestB name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRequestBodyCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRequestBodyCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRequestBodyCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRequestBodyCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRequestBodyCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRequestBodyCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRequestBodyCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRequestBodyCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRequestBodyCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.cs index 1d769c5f4dd9..8218db2aa83f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestBodyCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the RequestBody condition for the delivery rule. public partial class DeliveryRuleRequestBodyCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleRequestBodyCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleRequestBodyCondition(RequestBodyMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleRequestBodyCondition(RequestBodyMatchCondition properties) Name = MatchVariable.RequestBody; } - /// Initializes a new instance of DeliveryRuleRequestBodyCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleRequestBodyCondition(MatchVariable name, RequestBodyMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRequestBodyCondition(MatchVariable name, RequestBodyMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRequestBodyCondition() + { + } + /// Defines the parameters for the condition. public RequestBodyMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.Serialization.cs index bfc56122066a..b1fe22a99517 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRequestHeaderAction : IUtf8JsonSerializable + public partial class DeliveryRuleRequestHeaderAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRequestHeaderAction DeserializeDeliveryRuleRequestHeaderAction(JsonElement element) + internal static DeliveryRuleRequestHeaderAction DeserializeDeliveryRuleRequestHeaderAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } HeaderActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRequestHeaderAction DeserializeDeliveryRuleRequestHe name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRequestHeaderAction(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRequestHeaderAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRequestHeaderAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRequestHeaderAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRequestHeaderAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRequestHeaderAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRequestHeaderAction(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRequestHeaderAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRequestHeaderAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.cs index 803de9ac1add..9fa12fb26d61 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the request header action for the delivery rule. public partial class DeliveryRuleRequestHeaderAction : DeliveryRuleAction { - /// Initializes a new instance of DeliveryRuleRequestHeaderAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public DeliveryRuleRequestHeaderAction(HeaderActionProperties properties) @@ -24,15 +25,21 @@ public DeliveryRuleRequestHeaderAction(HeaderActionProperties properties) Name = DeliveryRuleActionType.ModifyRequestHeader; } - /// Initializes a new instance of DeliveryRuleRequestHeaderAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal DeliveryRuleRequestHeaderAction(DeliveryRuleActionType name, HeaderActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRequestHeaderAction(DeliveryRuleActionType name, HeaderActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRequestHeaderAction() + { + } + /// Defines the parameters for the action. public HeaderActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.Serialization.cs index 1f72589e515b..58816469c021 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRequestHeaderCondition : IUtf8JsonSerializable + public partial class DeliveryRuleRequestHeaderCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRequestHeaderCondition DeserializeDeliveryRuleRequestHeaderCondition(JsonElement element) + internal static DeliveryRuleRequestHeaderCondition DeserializeDeliveryRuleRequestHeaderCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RequestHeaderMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRequestHeaderCondition DeserializeDeliveryRuleReques name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRequestHeaderCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRequestHeaderCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRequestHeaderCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRequestHeaderCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRequestHeaderCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRequestHeaderCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRequestHeaderCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRequestHeaderCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRequestHeaderCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.cs index 2f7373d00cb1..99cdd9201146 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestHeaderCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the RequestHeader condition for the delivery rule. public partial class DeliveryRuleRequestHeaderCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleRequestHeaderCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleRequestHeaderCondition(RequestHeaderMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleRequestHeaderCondition(RequestHeaderMatchCondition properties Name = MatchVariable.RequestHeader; } - /// Initializes a new instance of DeliveryRuleRequestHeaderCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleRequestHeaderCondition(MatchVariable name, RequestHeaderMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRequestHeaderCondition(MatchVariable name, RequestHeaderMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRequestHeaderCondition() + { + } + /// Defines the parameters for the condition. public RequestHeaderMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.Serialization.cs index 07db82561ad6..bfa077302560 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRequestMethodCondition : IUtf8JsonSerializable + public partial class DeliveryRuleRequestMethodCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRequestMethodCondition DeserializeDeliveryRuleRequestMethodCondition(JsonElement element) + internal static DeliveryRuleRequestMethodCondition DeserializeDeliveryRuleRequestMethodCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RequestMethodMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRequestMethodCondition DeserializeDeliveryRuleReques name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRequestMethodCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRequestMethodCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRequestMethodCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRequestMethodCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRequestMethodCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRequestMethodCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRequestMethodCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRequestMethodCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRequestMethodCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.cs index eb1e937a9244..0ede60d99b36 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestMethodCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the RequestMethod condition for the delivery rule. public partial class DeliveryRuleRequestMethodCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleRequestMethodCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleRequestMethodCondition(RequestMethodMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleRequestMethodCondition(RequestMethodMatchCondition properties Name = MatchVariable.RequestMethod; } - /// Initializes a new instance of DeliveryRuleRequestMethodCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleRequestMethodCondition(MatchVariable name, RequestMethodMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRequestMethodCondition(MatchVariable name, RequestMethodMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRequestMethodCondition() + { + } + /// Defines the parameters for the condition. public RequestMethodMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.Serialization.cs index ec849d432343..52f782914720 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRequestSchemeCondition : IUtf8JsonSerializable + public partial class DeliveryRuleRequestSchemeCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRequestSchemeCondition DeserializeDeliveryRuleRequestSchemeCondition(JsonElement element) + internal static DeliveryRuleRequestSchemeCondition DeserializeDeliveryRuleRequestSchemeCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RequestSchemeMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRequestSchemeCondition DeserializeDeliveryRuleReques name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRequestSchemeCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRequestSchemeCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRequestSchemeCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRequestSchemeCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRequestSchemeCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRequestSchemeCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRequestSchemeCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRequestSchemeCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRequestSchemeCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.cs index 83d48894da65..8f1a5d03115f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestSchemeCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the RequestScheme condition for the delivery rule. public partial class DeliveryRuleRequestSchemeCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleRequestSchemeCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleRequestSchemeCondition(RequestSchemeMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleRequestSchemeCondition(RequestSchemeMatchCondition properties Name = MatchVariable.RequestScheme; } - /// Initializes a new instance of DeliveryRuleRequestSchemeCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleRequestSchemeCondition(MatchVariable name, RequestSchemeMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRequestSchemeCondition(MatchVariable name, RequestSchemeMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRequestSchemeCondition() + { + } + /// Defines the parameters for the condition. public RequestSchemeMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.Serialization.cs index 177caac97471..cbc65f3e829e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRequestUriCondition : IUtf8JsonSerializable + public partial class DeliveryRuleRequestUriCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRequestUriCondition DeserializeDeliveryRuleRequestUriCondition(JsonElement element) + internal static DeliveryRuleRequestUriCondition DeserializeDeliveryRuleRequestUriCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RequestUriMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRequestUriCondition DeserializeDeliveryRuleRequestUr name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRequestUriCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRequestUriCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRequestUriCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRequestUriCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRequestUriCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRequestUriCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRequestUriCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRequestUriCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRequestUriCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.cs index faafd36ba1f7..407b5ab879eb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRequestUriCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the RequestUri condition for the delivery rule. public partial class DeliveryRuleRequestUriCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleRequestUriCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleRequestUriCondition(RequestUriMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleRequestUriCondition(RequestUriMatchCondition properties) Name = MatchVariable.RequestUri; } - /// Initializes a new instance of DeliveryRuleRequestUriCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleRequestUriCondition(MatchVariable name, RequestUriMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRequestUriCondition(MatchVariable name, RequestUriMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRequestUriCondition() + { + } + /// Defines the parameters for the condition. public RequestUriMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.Serialization.cs index 6e3453716c34..cf4b01c980eb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleResponseHeaderAction : IUtf8JsonSerializable + public partial class DeliveryRuleResponseHeaderAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleResponseHeaderAction DeserializeDeliveryRuleResponseHeaderAction(JsonElement element) + internal static DeliveryRuleResponseHeaderAction DeserializeDeliveryRuleResponseHeaderAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } HeaderActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleResponseHeaderAction DeserializeDeliveryRuleResponse name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleResponseHeaderAction(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleResponseHeaderAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleResponseHeaderAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleResponseHeaderAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleResponseHeaderAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleResponseHeaderAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleResponseHeaderAction(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleResponseHeaderAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleResponseHeaderAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.cs index 0a312c9d2106..efbe1a5480a2 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleResponseHeaderAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the response header action for the delivery rule. public partial class DeliveryRuleResponseHeaderAction : DeliveryRuleAction { - /// Initializes a new instance of DeliveryRuleResponseHeaderAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public DeliveryRuleResponseHeaderAction(HeaderActionProperties properties) @@ -24,15 +25,21 @@ public DeliveryRuleResponseHeaderAction(HeaderActionProperties properties) Name = DeliveryRuleActionType.ModifyResponseHeader; } - /// Initializes a new instance of DeliveryRuleResponseHeaderAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal DeliveryRuleResponseHeaderAction(DeliveryRuleActionType name, HeaderActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleResponseHeaderAction(DeliveryRuleActionType name, HeaderActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleResponseHeaderAction() + { + } + /// Defines the parameters for the action. public HeaderActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.Serialization.cs index 7b685bc7277d..2281d4fde6ab 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleRouteConfigurationOverrideAction : IUtf8JsonSerializable + public partial class DeliveryRuleRouteConfigurationOverrideAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleRouteConfigurationOverrideAction DeserializeDeliveryRuleRouteConfigurationOverrideAction(JsonElement element) + internal static DeliveryRuleRouteConfigurationOverrideAction DeserializeDeliveryRuleRouteConfigurationOverrideAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RouteConfigurationOverrideActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleRouteConfigurationOverrideAction DeserializeDelivery name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleRouteConfigurationOverrideAction(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleRouteConfigurationOverrideAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleRouteConfigurationOverrideAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleRouteConfigurationOverrideAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleRouteConfigurationOverrideAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleRouteConfigurationOverrideAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleRouteConfigurationOverrideAction(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleRouteConfigurationOverrideAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleRouteConfigurationOverrideAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.cs index 2abcb73c39e9..623b1dd919f9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleRouteConfigurationOverrideAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the route configuration override action for the delivery rule. Only applicable to Frontdoor Standard/Premium Profiles. public partial class DeliveryRuleRouteConfigurationOverrideAction : DeliveryRuleAction { - /// Initializes a new instance of DeliveryRuleRouteConfigurationOverrideAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public DeliveryRuleRouteConfigurationOverrideAction(RouteConfigurationOverrideActionProperties properties) @@ -24,15 +25,21 @@ public DeliveryRuleRouteConfigurationOverrideAction(RouteConfigurationOverrideAc Name = DeliveryRuleActionType.RouteConfigurationOverride; } - /// Initializes a new instance of DeliveryRuleRouteConfigurationOverrideAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal DeliveryRuleRouteConfigurationOverrideAction(DeliveryRuleActionType name, RouteConfigurationOverrideActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleRouteConfigurationOverrideAction(DeliveryRuleActionType name, RouteConfigurationOverrideActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleRouteConfigurationOverrideAction() + { + } + /// Defines the parameters for the action. public RouteConfigurationOverrideActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.Serialization.cs index 25055549ad2f..4dced750a68d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleServerPortCondition : IUtf8JsonSerializable + public partial class DeliveryRuleServerPortCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleServerPortCondition DeserializeDeliveryRuleServerPortCondition(JsonElement element) + internal static DeliveryRuleServerPortCondition DeserializeDeliveryRuleServerPortCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ServerPortMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleServerPortCondition DeserializeDeliveryRuleServerPor name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleServerPortCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleServerPortCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleServerPortCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleServerPortCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleServerPortCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleServerPortCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleServerPortCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleServerPortCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleServerPortCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.cs index cf7f8e31e557..2b5b9f3d9cca 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleServerPortCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the ServerPort condition for the delivery rule. public partial class DeliveryRuleServerPortCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleServerPortCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleServerPortCondition(ServerPortMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleServerPortCondition(ServerPortMatchCondition properties) Name = MatchVariable.ServerPort; } - /// Initializes a new instance of DeliveryRuleServerPortCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleServerPortCondition(MatchVariable name, ServerPortMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleServerPortCondition(MatchVariable name, ServerPortMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleServerPortCondition() + { + } + /// Defines the parameters for the condition. public ServerPortMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.Serialization.cs index 8e7d2a167bdd..d465fd4b47a4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleSocketAddressCondition : IUtf8JsonSerializable + public partial class DeliveryRuleSocketAddressCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleSocketAddressCondition DeserializeDeliveryRuleSocketAddressCondition(JsonElement element) + internal static DeliveryRuleSocketAddressCondition DeserializeDeliveryRuleSocketAddressCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } SocketAddressMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleSocketAddressCondition DeserializeDeliveryRuleSocket name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleSocketAddressCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleSocketAddressCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleSocketAddressCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleSocketAddressCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleSocketAddressCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleSocketAddressCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleSocketAddressCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleSocketAddressCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleSocketAddressCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.cs index ae465a6f8027..ecf707a80b41 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSocketAddressCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the SocketAddress condition for the delivery rule. public partial class DeliveryRuleSocketAddressCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleSocketAddressCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleSocketAddressCondition(SocketAddressMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleSocketAddressCondition(SocketAddressMatchCondition properties Name = MatchVariable.SocketAddr; } - /// Initializes a new instance of DeliveryRuleSocketAddressCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleSocketAddressCondition(MatchVariable name, SocketAddressMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleSocketAddressCondition(MatchVariable name, SocketAddressMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleSocketAddressCondition() + { + } + /// Defines the parameters for the condition. public SocketAddressMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.Serialization.cs index 0fd946953e7c..852b1a376bde 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleSslProtocolCondition : IUtf8JsonSerializable + public partial class DeliveryRuleSslProtocolCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleSslProtocolCondition DeserializeDeliveryRuleSslProtocolCondition(JsonElement element) + internal static DeliveryRuleSslProtocolCondition DeserializeDeliveryRuleSslProtocolCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DeliveryRuleSslProtocolMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleSslProtocolCondition DeserializeDeliveryRuleSslProto name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleSslProtocolCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleSslProtocolCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleSslProtocolCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleSslProtocolCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleSslProtocolCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleSslProtocolCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleSslProtocolCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleSslProtocolCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleSslProtocolCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.cs index 848fe9166239..a56ddec0929e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the SslProtocol condition for the delivery rule. public partial class DeliveryRuleSslProtocolCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleSslProtocolCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleSslProtocolCondition(DeliveryRuleSslProtocolMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleSslProtocolCondition(DeliveryRuleSslProtocolMatchCondition pr Name = MatchVariable.SslProtocol; } - /// Initializes a new instance of DeliveryRuleSslProtocolCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleSslProtocolCondition(MatchVariable name, DeliveryRuleSslProtocolMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleSslProtocolCondition(MatchVariable name, DeliveryRuleSslProtocolMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleSslProtocolCondition() + { + } + /// Defines the parameters for the condition. public DeliveryRuleSslProtocolMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.Serialization.cs index 3f129ca85754..e4ef77059881 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleSslProtocolMatchCondition : IUtf8JsonSerializable + public partial class DeliveryRuleSslProtocolMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(SslProtocolMatchConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleSslProtocolMatchCondition DeserializeDeliveryRuleSslProtocolMatchCondition(JsonElement element) + internal static DeliveryRuleSslProtocolMatchCondition DeserializeDeliveryRuleSslProtocolMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static DeliveryRuleSslProtocolMatchCondition DeserializeDeliveryRuleSsl Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static DeliveryRuleSslProtocolMatchCondition DeserializeDeliveryRuleSsl transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleSslProtocolMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + DeliveryRuleSslProtocolMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleSslProtocolMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleSslProtocolMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleSslProtocolMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleSslProtocolMatchCondition model) + { + if (model is null) + { + return null; } - return new DeliveryRuleSslProtocolMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleSslProtocolMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleSslProtocolMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.cs index 7360c1775b22..e2603ea07a07 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleSslProtocolMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for SslProtocol match conditions. public partial class DeliveryRuleSslProtocolMatchCondition { - /// Initializes a new instance of DeliveryRuleSslProtocolMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public DeliveryRuleSslProtocolMatchCondition(SslProtocolMatchConditionType sslProtocolMatchConditionType, SslProtocolOperator sslProtocolOperator) @@ -24,19 +28,26 @@ public DeliveryRuleSslProtocolMatchCondition(SslProtocolMatchConditionType sslPr Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of DeliveryRuleSslProtocolMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal DeliveryRuleSslProtocolMatchCondition(SslProtocolMatchConditionType sslProtocolMatchConditionType, SslProtocolOperator sslProtocolOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleSslProtocolMatchCondition(SslProtocolMatchConditionType sslProtocolMatchConditionType, SslProtocolOperator sslProtocolOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { SslProtocolMatchConditionType = sslProtocolMatchConditionType; SslProtocolOperator = sslProtocolOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeliveryRuleSslProtocolMatchCondition() + { } /// Gets or sets the ssl protocol match condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.Serialization.cs index b5015e8180be..2abc962287a2 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleUriFileExtensionCondition : IUtf8JsonSerializable + public partial class DeliveryRuleUriFileExtensionCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleUriFileExtensionCondition DeserializeDeliveryRuleUriFileExtensionCondition(JsonElement element) + internal static DeliveryRuleUriFileExtensionCondition DeserializeDeliveryRuleUriFileExtensionCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } UriFileExtensionMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleUriFileExtensionCondition DeserializeDeliveryRuleUri name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleUriFileExtensionCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleUriFileExtensionCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleUriFileExtensionCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleUriFileExtensionCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleUriFileExtensionCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleUriFileExtensionCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleUriFileExtensionCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleUriFileExtensionCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleUriFileExtensionCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.cs index 08a3897a61eb..2d7d3467b9e1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileExtensionCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the UrlFileExtension condition for the delivery rule. public partial class DeliveryRuleUriFileExtensionCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleUriFileExtensionCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleUriFileExtensionCondition(UriFileExtensionMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleUriFileExtensionCondition(UriFileExtensionMatchCondition prop Name = MatchVariable.UriFileExtension; } - /// Initializes a new instance of DeliveryRuleUriFileExtensionCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleUriFileExtensionCondition(MatchVariable name, UriFileExtensionMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleUriFileExtensionCondition(MatchVariable name, UriFileExtensionMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleUriFileExtensionCondition() + { + } + /// Defines the parameters for the condition. public UriFileExtensionMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.Serialization.cs index 6b0e5bf45a8e..e16408c8a49b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleUriFileNameCondition : IUtf8JsonSerializable + public partial class DeliveryRuleUriFileNameCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleUriFileNameCondition DeserializeDeliveryRuleUriFileNameCondition(JsonElement element) + internal static DeliveryRuleUriFileNameCondition DeserializeDeliveryRuleUriFileNameCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } UriFileNameMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleUriFileNameCondition DeserializeDeliveryRuleUriFileN name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleUriFileNameCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleUriFileNameCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleUriFileNameCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleUriFileNameCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleUriFileNameCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleUriFileNameCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleUriFileNameCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleUriFileNameCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleUriFileNameCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.cs index 64728cdd8b08..099f6796889c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriFileNameCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the UrlFileName condition for the delivery rule. public partial class DeliveryRuleUriFileNameCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleUriFileNameCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleUriFileNameCondition(UriFileNameMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleUriFileNameCondition(UriFileNameMatchCondition properties) Name = MatchVariable.UriFileName; } - /// Initializes a new instance of DeliveryRuleUriFileNameCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleUriFileNameCondition(MatchVariable name, UriFileNameMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleUriFileNameCondition(MatchVariable name, UriFileNameMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleUriFileNameCondition() + { + } + /// Defines the parameters for the condition. public UriFileNameMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.Serialization.cs index 93a8de0a31bd..fc89bab35382 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DeliveryRuleUriPathCondition : IUtf8JsonSerializable + public partial class DeliveryRuleUriPathCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeliveryRuleUriPathCondition DeserializeDeliveryRuleUriPathCondition(JsonElement element) + internal static DeliveryRuleUriPathCondition DeserializeDeliveryRuleUriPathCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } UriPathMatchCondition parameters = default; MatchVariable name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static DeliveryRuleUriPathCondition DeserializeDeliveryRuleUriPathCondi name = new MatchVariable(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeliveryRuleUriPathCondition(name, parameters, serializedAdditionalRawData); + } + + DeliveryRuleUriPathCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeliveryRuleUriPathCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleUriPathCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleUriPathCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeliveryRuleUriPathCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeliveryRuleUriPathCondition(Response response) + { + if (response is null) + { + return null; } - return new DeliveryRuleUriPathCondition(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeliveryRuleUriPathCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.cs index 8410acf6ec03..3f21b296a86b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DeliveryRuleUriPathCondition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the UrlPath condition for the delivery rule. public partial class DeliveryRuleUriPathCondition : DeliveryRuleCondition { - /// Initializes a new instance of DeliveryRuleUriPathCondition. + /// Initializes a new instance of . /// Defines the parameters for the condition. /// is null. public DeliveryRuleUriPathCondition(UriPathMatchCondition properties) @@ -24,15 +25,21 @@ public DeliveryRuleUriPathCondition(UriPathMatchCondition properties) Name = MatchVariable.UriPath; } - /// Initializes a new instance of DeliveryRuleUriPathCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. /// Defines the parameters for the condition. - internal DeliveryRuleUriPathCondition(MatchVariable name, UriPathMatchCondition properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal DeliveryRuleUriPathCondition(MatchVariable name, UriPathMatchCondition properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal DeliveryRuleUriPathCondition() + { + } + /// Defines the parameters for the condition. public UriPathMatchCondition Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.Serialization.cs index 01ab90343dbe..af99bbc95f9e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class DomainValidationProperties + public partial class DomainValidationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DomainValidationProperties DeserializeDomainValidationProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DomainValidationProperties DeserializeDomainValidationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional validationToken = default; Optional expirationDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("validationToken"u8)) @@ -37,8 +65,61 @@ internal static DomainValidationProperties DeserializeDomainValidationProperties expirationDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DomainValidationProperties(validationToken.Value, Optional.ToNullable(expirationDate)); + return new DomainValidationProperties(validationToken.Value, Optional.ToNullable(expirationDate), serializedAdditionalRawData); + } + + DomainValidationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDomainValidationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DomainValidationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDomainValidationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DomainValidationProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DomainValidationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDomainValidationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.cs index d1dac32d8f9e..1a05fcdce304 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/DomainValidationProperties.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// The JSON object that contains the properties to validate a domain. public partial class DomainValidationProperties { - /// Initializes a new instance of DomainValidationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DomainValidationProperties() { } - /// Initializes a new instance of DomainValidationProperties. + /// Initializes a new instance of . /// Challenge used for DNS TXT record or file based validation. /// The date time that the token expires. - internal DomainValidationProperties(string validationToken, DateTimeOffset? expiresOn) + /// Keeps track of any properties unknown to the library. + internal DomainValidationProperties(string validationToken, DateTimeOffset? expiresOn, Dictionary serializedAdditionalRawData) { ValidationToken = validationToken; ExpiresOn = expiresOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Challenge used for DNS TXT record or file based validation. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.Serialization.cs index 1df1ce708821..0aea4803b743 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class EdgeNode : IUtf8JsonSerializable + public partial class EdgeNode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,16 +32,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPAddressGroups) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeNode DeserializeEdgeNode(JsonElement element) + internal static EdgeNode DeserializeEdgeNode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +72,7 @@ internal static EdgeNode DeserializeEdgeNode(JsonElement element) ResourceType type = default; Optional systemData = default; Optional> ipAddressGroups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -96,8 +125,61 @@ internal static EdgeNode DeserializeEdgeNode(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeNode(id, name, type, systemData.Value, Optional.ToList(ipAddressGroups), serializedAdditionalRawData); + } + + EdgeNode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeNode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeNode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeNode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeNode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeNode(Response response) + { + if (response is null) + { + return null; } - return new EdgeNode(id, name, type, systemData.Value, Optional.ToList(ipAddressGroups)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeNode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.cs index cb548ee980c9..7fe617d99c92 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgeNode.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.Cdn.Models /// Edgenode is a global Point of Presence (POP) location used to deliver CDN content to end users. public partial class EdgeNode : ResourceData { - /// Initializes a new instance of EdgeNode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeNode() { IPAddressGroups = new ChangeTrackingList(); } - /// Initializes a new instance of EdgeNode. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// List of ip address groups. - internal EdgeNode(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList ipAddressGroups) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal EdgeNode(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList ipAddressGroups, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IPAddressGroups = ipAddressGroups; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of ip address groups. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.Serialization.cs index 82c2dee529de..d173022443f4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class EdgenodeResult + internal partial class EdgenodeResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgenodeResult DeserializeEdgenodeResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgenodeResult DeserializeEdgenodeResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +75,61 @@ internal static EdgenodeResult DeserializeEdgenodeResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EdgenodeResult(Optional.ToList(value), nextLink.Value); + return new EdgenodeResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + EdgenodeResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgenodeResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgenodeResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgenodeResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgenodeResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgenodeResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgenodeResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.cs index e375fbceecf0..7f287c1df213 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EdgenodeResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list CDN edgenodes. It contains a list of ip address group and a URL link to get the next set of results. internal partial class EdgenodeResult { - /// Initializes a new instance of EdgenodeResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgenodeResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of EdgenodeResult. + /// Initializes a new instance of . /// Edge node of CDN service. /// URL to get the next set of edgenode list results if there are any. - internal EdgenodeResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal EdgenodeResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Edge node of CDN service. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.Serialization.cs index 3adbf1899086..6596f287b10c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class EndpointDeliveryPolicy : IUtf8JsonSerializable + public partial class EndpointDeliveryPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Description)) { @@ -25,20 +32,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EndpointDeliveryPolicy DeserializeEndpointDeliveryPolicy(JsonElement element) + internal static EndpointDeliveryPolicy DeserializeEndpointDeliveryPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional description = default; IList rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description"u8)) @@ -56,8 +85,61 @@ internal static EndpointDeliveryPolicy DeserializeEndpointDeliveryPolicy(JsonEle rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EndpointDeliveryPolicy(description.Value, rules, serializedAdditionalRawData); + } + + EndpointDeliveryPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointDeliveryPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointDeliveryPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointDeliveryPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointDeliveryPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointDeliveryPolicy(Response response) + { + if (response is null) + { + return null; } - return new EndpointDeliveryPolicy(description.Value, rules); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointDeliveryPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.cs index bfb8cd13ab3c..36c7fb089f6b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointDeliveryPolicy.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// A policy that specifies the delivery rules to be used for an endpoint. public partial class EndpointDeliveryPolicy { - /// Initializes a new instance of EndpointDeliveryPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of the delivery rules. /// is null. public EndpointDeliveryPolicy(IEnumerable rules) @@ -25,13 +28,20 @@ public EndpointDeliveryPolicy(IEnumerable rules) Rules = rules.ToList(); } - /// Initializes a new instance of EndpointDeliveryPolicy. + /// Initializes a new instance of . /// User-friendly description of the policy. /// A list of the delivery rules. - internal EndpointDeliveryPolicy(string description, IList rules) + /// Keeps track of any properties unknown to the library. + internal EndpointDeliveryPolicy(string description, IList rules, Dictionary serializedAdditionalRawData) { Description = description; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EndpointDeliveryPolicy() + { } /// User-friendly description of the policy. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.Serialization.cs index 9df489bb4d1e..fc681bc0ef72 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class EndpointListResult + internal partial class EndpointListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EndpointListResult DeserializeEndpointListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EndpointListResult DeserializeEndpointListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static EndpointListResult DeserializeEndpointListResult(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EndpointListResult(Optional.ToList(value), nextLink.Value); + return new EndpointListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + EndpointListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.cs index c04d40378a00..b9478b997cc0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list endpoints. It contains a list of endpoint objects and a URL link to get the next set of results. internal partial class EndpointListResult { - /// Initializes a new instance of EndpointListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EndpointListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of EndpointListResult. + /// Initializes a new instance of . /// List of CDN endpoints within a profile. /// URL to get the next set of endpoint objects if there is any. - internal EndpointListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal EndpointListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN endpoints within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.Serialization.cs index 33809c148b89..78a9caa1df52 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class EndpointNameAvailabilityContent : IUtf8JsonSerializable + public partial class EndpointNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -24,7 +32,109 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("autoGeneratedDomainNameLabelScope"u8); writer.WriteStringValue(AutoGeneratedDomainNameLabelScope.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EndpointNameAvailabilityContent DeserializeEndpointNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + CdnResourceType type = default; + Optional autoGeneratedDomainNameLabelScope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new CdnResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("autoGeneratedDomainNameLabelScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoGeneratedDomainNameLabelScope = new DomainNameLabelScope(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EndpointNameAvailabilityContent(name, type, Optional.ToNullable(autoGeneratedDomainNameLabelScope), serializedAdditionalRawData); + } + + EndpointNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.cs index 4e7c52c8b8de..30e02697e54d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Input of CheckNameAvailability API. public partial class EndpointNameAvailabilityContent { - /// Initializes a new instance of EndpointNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource name to validate. /// The type of the resource whose name is to be validated. /// is null. @@ -25,6 +29,24 @@ public EndpointNameAvailabilityContent(string name, CdnResourceType resourceType ResourceType = resourceType; } + /// Initializes a new instance of . + /// The resource name to validate. + /// The type of the resource whose name is to be validated. + /// Indicates the endpoint name reuse scope. The default value is TenantReuse. + /// Keeps track of any properties unknown to the library. + internal EndpointNameAvailabilityContent(string name, CdnResourceType resourceType, DomainNameLabelScope? autoGeneratedDomainNameLabelScope, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EndpointNameAvailabilityContent() + { + } + /// The resource name to validate. public string Name { get; } /// The type of the resource whose name is to be validated. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.Serialization.cs index 31f65cebd11f..407c7779f848 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class EndpointNameAvailabilityResult + public partial class EndpointNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EndpointNameAvailabilityResult DeserializeEndpointNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EndpointNameAvailabilityResult DeserializeEndpointNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static EndpointNameAvailabilityResult DeserializeEndpointNameAvailabili Optional availableHostname = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -48,8 +77,61 @@ internal static EndpointNameAvailabilityResult DeserializeEndpointNameAvailabili message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EndpointNameAvailabilityResult(Optional.ToNullable(nameAvailable), availableHostname.Value, reason.Value, message.Value); + return new EndpointNameAvailabilityResult(Optional.ToNullable(nameAvailable), availableHostname.Value, reason.Value, message.Value, serializedAdditionalRawData); + } + + EndpointNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.cs index df67098cea9c..9f1f925d838d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointNameAvailabilityResult.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Output of check name availability API. public partial class EndpointNameAvailabilityResult { - /// Initializes a new instance of EndpointNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EndpointNameAvailabilityResult() { } - /// Initializes a new instance of EndpointNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates whether the name is available. /// Returns the available hostname generated based on the AutoGeneratedDomainNameLabelScope when the name is available, otherwise it returns empty string. /// The reason why the name is not available. /// The detailed error message describing why the name is not available. - internal EndpointNameAvailabilityResult(bool? nameAvailable, string availableHostname, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal EndpointNameAvailabilityResult(bool? nameAvailable, string availableHostname, string reason, string message, Dictionary serializedAdditionalRawData) { NameAvailable = nameAvailable; AvailableHostname = availableHostname; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the name is available. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.Serialization.cs index 330dc86330bd..32d3b567375d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class EndpointPropertiesUpdateParametersDefaultOriginGroup : IUtf8JsonSerializable + internal partial class EndpointPropertiesUpdateParametersDefaultOriginGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EndpointPropertiesUpdateParametersDefaultOriginGroup DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(JsonElement element) + internal static EndpointPropertiesUpdateParametersDefaultOriginGroup DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static EndpointPropertiesUpdateParametersDefaultOriginGroup Deserialize id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EndpointPropertiesUpdateParametersDefaultOriginGroup(id.Value, serializedAdditionalRawData); + } + + EndpointPropertiesUpdateParametersDefaultOriginGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointPropertiesUpdateParametersDefaultOriginGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointPropertiesUpdateParametersDefaultOriginGroup model) + { + if (model is null) + { + return null; } - return new EndpointPropertiesUpdateParametersDefaultOriginGroup(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointPropertiesUpdateParametersDefaultOriginGroup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointPropertiesUpdateParametersDefaultOriginGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.cs index 9002a5f9586a..e56b9f585fe4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersDefaultOriginGroup.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Cdn.Models /// A reference to the origin group. internal partial class EndpointPropertiesUpdateParametersDefaultOriginGroup { - /// Initializes a new instance of EndpointPropertiesUpdateParametersDefaultOriginGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EndpointPropertiesUpdateParametersDefaultOriginGroup() { } - /// Initializes a new instance of EndpointPropertiesUpdateParametersDefaultOriginGroup. + /// Initializes a new instance of . /// Resource ID. - internal EndpointPropertiesUpdateParametersDefaultOriginGroup(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal EndpointPropertiesUpdateParametersDefaultOriginGroup(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.Serialization.cs index 1b48cc0fe32f..51fd22aa363d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink : IUtf8JsonSerializable + internal partial class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(JsonElement element) + internal static EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLi id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(id.Value, serializedAdditionalRawData); + } + + EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink model) + { + if (model is null) + { + return null; } - return new EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs index 8558827ecdb3..2bdd0d1f5473 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the Web Application Firewall policy for the endpoint (if applicable). internal partial class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink { - /// Initializes a new instance of EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink() { } - /// Initializes a new instance of EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink. + /// Initializes a new instance of . /// Resource ID. - internal EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.Serialization.cs index 7f99be1bd072..a9e40ce3c916 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorActivatedResourceInfo : IUtf8JsonSerializable + public partial class FrontDoorActivatedResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorActivatedResourceInfo DeserializeFrontDoorActivatedResourceInfo(JsonElement element) + internal static FrontDoorActivatedResourceInfo DeserializeFrontDoorActivatedResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional isActive = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -51,8 +74,61 @@ internal static FrontDoorActivatedResourceInfo DeserializeFrontDoorActivatedReso isActive = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorActivatedResourceInfo(id.Value, Optional.ToNullable(isActive), serializedAdditionalRawData); + } + + FrontDoorActivatedResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorActivatedResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorActivatedResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorActivatedResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorActivatedResourceInfo model) + { + if (model is null) + { + return null; } - return new FrontDoorActivatedResourceInfo(id.Value, Optional.ToNullable(isActive)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorActivatedResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorActivatedResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.cs index f129b56856ae..0268dbd22c93 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorActivatedResourceInfo.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Cdn.Models /// Reference to another resource along with its state. public partial class FrontDoorActivatedResourceInfo { - /// Initializes a new instance of FrontDoorActivatedResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorActivatedResourceInfo() { } - /// Initializes a new instance of FrontDoorActivatedResourceInfo. + /// Initializes a new instance of . /// Resource ID. /// Whether the resource is active or inactive. - internal FrontDoorActivatedResourceInfo(ResourceIdentifier id, bool? isActive) + /// Keeps track of any properties unknown to the library. + internal FrontDoorActivatedResourceInfo(ResourceIdentifier id, bool? isActive, Dictionary serializedAdditionalRawData) { Id = id; IsActive = isActive; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainData.Serialization.cs index a019eb80f6bd..e413ec4339b5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainData.Serialization.cs @@ -5,25 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorCustomDomainData : IUtf8JsonSerializable + public partial class FrontDoorCustomDomainData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(TlsSettings)) { writer.WritePropertyName("tlsSettings"u8); - writer.WriteObjectValue(TlsSettings); + if (TlsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TlsSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DnsZone)) { @@ -35,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (PreValidatedCustomDomainResource != null) { writer.WritePropertyName("preValidatedCustomDomainResourceId"u8); - writer.WriteObjectValue(PreValidatedCustomDomainResource); + if (PreValidatedCustomDomainResource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PreValidatedCustomDomainResource).Serialize(writer, options); + } } else { @@ -48,11 +70,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(HostName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorCustomDomainData DeserializeFrontDoorCustomDomainData(JsonElement element) + internal static FrontDoorCustomDomainData DeserializeFrontDoorCustomDomainData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +106,7 @@ internal static FrontDoorCustomDomainData DeserializeFrontDoorCustomDomainData(J Optional domainValidationState = default; Optional hostName = default; Optional validationProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -182,8 +219,61 @@ internal static FrontDoorCustomDomainData DeserializeFrontDoorCustomDomainData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorCustomDomainData(id, name, type, systemData.Value, profileName.Value, tlsSettings.Value, azureDnsZone, preValidatedCustomDomainResourceId.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), Optional.ToNullable(domainValidationState), hostName.Value, validationProperties.Value); + return new FrontDoorCustomDomainData(id, name, type, systemData.Value, profileName.Value, tlsSettings.Value, azureDnsZone, preValidatedCustomDomainResourceId.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), Optional.ToNullable(domainValidationState), hostName.Value, validationProperties.Value, serializedAdditionalRawData); + } + + FrontDoorCustomDomainData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorCustomDomainData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorCustomDomainData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorCustomDomainData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorCustomDomainData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorCustomDomainData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorCustomDomainData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.Serialization.cs index b0a13b053737..9204d3af7083 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorCustomDomainHttpsContent : IUtf8JsonSerializable + public partial class FrontDoorCustomDomainHttpsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("certificateType"u8); writer.WriteStringValue(CertificateType.ToString()); @@ -27,18 +35,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Secret != null) { writer.WritePropertyName("secret"u8); - writer.WriteObjectValue(Secret); + if (Secret is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Secret).Serialize(writer, options); + } } else { writer.WriteNull("secret"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorCustomDomainHttpsContent DeserializeFrontDoorCustomDomainHttpsContent(JsonElement element) + internal static FrontDoorCustomDomainHttpsContent DeserializeFrontDoorCustomDomainHttpsContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +75,7 @@ internal static FrontDoorCustomDomainHttpsContent DeserializeFrontDoorCustomDoma FrontDoorCertificateType certificateType = default; Optional minimumTlsVersion = default; Optional secret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificateType"u8)) @@ -72,8 +102,61 @@ internal static FrontDoorCustomDomainHttpsContent DeserializeFrontDoorCustomDoma secret = FrontDoorCustomDomainHttpsContentSecret.DeserializeFrontDoorCustomDomainHttpsContentSecret(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorCustomDomainHttpsContent(certificateType, Optional.ToNullable(minimumTlsVersion), secret.Value, serializedAdditionalRawData); + } + + FrontDoorCustomDomainHttpsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorCustomDomainHttpsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorCustomDomainHttpsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorCustomDomainHttpsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorCustomDomainHttpsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorCustomDomainHttpsContent(Response response) + { + if (response is null) + { + return null; } - return new FrontDoorCustomDomainHttpsContent(certificateType, Optional.ToNullable(minimumTlsVersion), secret.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorCustomDomainHttpsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.cs index f07e507839d8..221f41a7e0c5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,22 +14,32 @@ namespace Azure.ResourceManager.Cdn.Models /// The JSON object that contains the properties to secure a domain. public partial class FrontDoorCustomDomainHttpsContent { - /// Initializes a new instance of FrontDoorCustomDomainHttpsContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the source of the SSL certificate. public FrontDoorCustomDomainHttpsContent(FrontDoorCertificateType certificateType) { CertificateType = certificateType; } - /// Initializes a new instance of FrontDoorCustomDomainHttpsContent. + /// Initializes a new instance of . /// Defines the source of the SSL certificate. /// TLS protocol version that will be used for Https. /// Resource reference to the secret. ie. subs/rg/profile/secret. - internal FrontDoorCustomDomainHttpsContent(FrontDoorCertificateType certificateType, FrontDoorMinimumTlsVersion? minimumTlsVersion, FrontDoorCustomDomainHttpsContentSecret secret) + /// Keeps track of any properties unknown to the library. + internal FrontDoorCustomDomainHttpsContent(FrontDoorCertificateType certificateType, FrontDoorMinimumTlsVersion? minimumTlsVersion, FrontDoorCustomDomainHttpsContentSecret secret, Dictionary serializedAdditionalRawData) { CertificateType = certificateType; MinimumTlsVersion = minimumTlsVersion; Secret = secret; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FrontDoorCustomDomainHttpsContent() + { } /// Defines the source of the SSL certificate. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.Serialization.cs index 7076a43b39a2..79ca6ff58524 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class FrontDoorCustomDomainHttpsContentSecret : IUtf8JsonSerializable + internal partial class FrontDoorCustomDomainHttpsContentSecret : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorCustomDomainHttpsContentSecret DeserializeFrontDoorCustomDomainHttpsContentSecret(JsonElement element) + internal static FrontDoorCustomDomainHttpsContentSecret DeserializeFrontDoorCustomDomainHttpsContentSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static FrontDoorCustomDomainHttpsContentSecret DeserializeFrontDoorCust id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorCustomDomainHttpsContentSecret(id.Value, serializedAdditionalRawData); + } + + FrontDoorCustomDomainHttpsContentSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorCustomDomainHttpsContentSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorCustomDomainHttpsContentSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorCustomDomainHttpsContentSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorCustomDomainHttpsContentSecret model) + { + if (model is null) + { + return null; } - return new FrontDoorCustomDomainHttpsContentSecret(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorCustomDomainHttpsContentSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorCustomDomainHttpsContentSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.cs index b170b88dab5f..6df27bfaf243 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainHttpsContentSecret.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Cdn.Models /// Resource reference to the secret. ie. subs/rg/profile/secret. internal partial class FrontDoorCustomDomainHttpsContentSecret { - /// Initializes a new instance of FrontDoorCustomDomainHttpsContentSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorCustomDomainHttpsContentSecret() { } - /// Initializes a new instance of FrontDoorCustomDomainHttpsContentSecret. + /// Initializes a new instance of . /// Resource ID. - internal FrontDoorCustomDomainHttpsContentSecret(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal FrontDoorCustomDomainHttpsContentSecret(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.Serialization.cs index 6bce68f5aec5..71d36fb67bae 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class FrontDoorCustomDomainListResult + internal partial class FrontDoorCustomDomainListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FrontDoorCustomDomainListResult DeserializeFrontDoorCustomDomainListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FrontDoorCustomDomainListResult DeserializeFrontDoorCustomDomainListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static FrontDoorCustomDomainListResult DeserializeFrontDoorCustomDomain nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorCustomDomainListResult(Optional.ToList(value), nextLink.Value); + return new FrontDoorCustomDomainListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FrontDoorCustomDomainListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorCustomDomainListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorCustomDomainListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorCustomDomainListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorCustomDomainListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorCustomDomainListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorCustomDomainListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.cs index 97fe2f4ea680..85f06d407568 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list domains. It contains a list of domain objects and a URL link to get the next set of results. internal partial class FrontDoorCustomDomainListResult { - /// Initializes a new instance of FrontDoorCustomDomainListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FrontDoorCustomDomainListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FrontDoorCustomDomainListResult. + /// Initializes a new instance of . /// List of AzureFrontDoor domains within a profile. /// URL to get the next set of domain objects if there are any. - internal FrontDoorCustomDomainListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FrontDoorCustomDomainListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AzureFrontDoor domains within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.Serialization.cs index 5844ffdbf506..8bed0874bd51 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.Serialization.cs @@ -5,22 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorCustomDomainPatch : IUtf8JsonSerializable + public partial class FrontDoorCustomDomainPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(TlsSettings)) { writer.WritePropertyName("tlsSettings"u8); - writer.WriteObjectValue(TlsSettings); + if (TlsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TlsSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DnsZone)) { @@ -32,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (PreValidatedCustomDomainResource != null) { writer.WritePropertyName("preValidatedCustomDomainResourceId"u8); - writer.WriteObjectValue(PreValidatedCustomDomainResource); + if (PreValidatedCustomDomainResource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PreValidatedCustomDomainResource).Serialize(writer, options); + } } else { @@ -40,7 +63,136 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorCustomDomainPatch DeserializeFrontDoorCustomDomainPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional profileName = default; + Optional tlsSettings = default; + Optional azureDnsZone = default; + Optional preValidatedCustomDomainResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("profileName"u8)) + { + profileName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("tlsSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tlsSettings = FrontDoorCustomDomainHttpsContent.DeserializeFrontDoorCustomDomainHttpsContent(property0.Value); + continue; + } + if (property0.NameEquals("azureDnsZone"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureDnsZone = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("preValidatedCustomDomainResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + preValidatedCustomDomainResourceId = null; + continue; + } + preValidatedCustomDomainResourceId = FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.DeserializeFrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorCustomDomainPatch(profileName.Value, tlsSettings.Value, azureDnsZone, preValidatedCustomDomainResourceId.Value, serializedAdditionalRawData); + } + + FrontDoorCustomDomainPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorCustomDomainPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorCustomDomainPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorCustomDomainPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorCustomDomainPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorCustomDomainPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorCustomDomainPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.cs index eef7a8991371..ab0bd5c64880 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainPatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,11 +15,29 @@ namespace Azure.ResourceManager.Cdn.Models /// The domain JSON object required for domain creation or update. public partial class FrontDoorCustomDomainPatch { - /// Initializes a new instance of FrontDoorCustomDomainPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorCustomDomainPatch() { } + /// Initializes a new instance of . + /// The name of the profile which holds the domain. + /// The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. + /// Resource reference to the Azure DNS zone. + /// Resource reference to the Azure resource where custom domain ownership was prevalidated. + /// Keeps track of any properties unknown to the library. + internal FrontDoorCustomDomainPatch(string profileName, FrontDoorCustomDomainHttpsContent tlsSettings, WritableSubResource dnsZone, FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId preValidatedCustomDomainResource, Dictionary serializedAdditionalRawData) + { + ProfileName = profileName; + TlsSettings = tlsSettings; + DnsZone = dnsZone; + PreValidatedCustomDomainResource = preValidatedCustomDomainResource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the profile which holds the domain. public string ProfileName { get; } /// The configuration specifying how to enable HTTPS for the domain - using AzureFrontDoor managed certificate or user's own certificate. If not specified, enabling ssl uses AzureFrontDoor managed certificate by default. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.Serialization.cs index 0c11f033a567..f42346b032f5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId : IUtf8JsonSerializable + internal partial class FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId DeserializeFrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(JsonElement element) + internal static FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId DeserializeFrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCusto id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(id.Value, serializedAdditionalRawData); + } + + FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId model) + { + if (model is null) + { + return null; } - return new FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.cs index 176cfd45afa1..6d0e81356bf1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Cdn.Models /// Resource reference to the Azure resource where custom domain ownership was prevalidated. internal partial class FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId { - /// Initializes a new instance of FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId() { } - /// Initializes a new instance of FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId. + /// Initializes a new instance of . /// Resource ID. - internal FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal FrontDoorCustomDomainUpdatePropertiesParametersPreValidatedCustomDomainResourceId(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointData.Serialization.cs index 9060c848f23f..94e239b09a46 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorEndpointData : IUtf8JsonSerializable + public partial class FrontDoorEndpointData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorEndpointData DeserializeFrontDoorEndpointData(JsonElement element) + internal static FrontDoorEndpointData DeserializeFrontDoorEndpointData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +93,7 @@ internal static FrontDoorEndpointData DeserializeFrontDoorEndpointData(JsonEleme Optional deploymentStatus = default; Optional hostName = default; Optional autoGeneratedDomainNameLabelScope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -176,8 +198,61 @@ internal static FrontDoorEndpointData DeserializeFrontDoorEndpointData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorEndpointData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, profileName.Value, Optional.ToNullable(enabledState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), hostName.Value, Optional.ToNullable(autoGeneratedDomainNameLabelScope), serializedAdditionalRawData); + } + + FrontDoorEndpointData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorEndpointData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorEndpointData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorEndpointData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorEndpointData model) + { + if (model is null) + { + return null; } - return new FrontDoorEndpointData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, profileName.Value, Optional.ToNullable(enabledState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), hostName.Value, Optional.ToNullable(autoGeneratedDomainNameLabelScope)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorEndpointData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorEndpointData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.Serialization.cs index 33186946584f..dd4e5783aa7b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class FrontDoorEndpointListResult + internal partial class FrontDoorEndpointListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FrontDoorEndpointListResult DeserializeFrontDoorEndpointListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FrontDoorEndpointListResult DeserializeFrontDoorEndpointListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static FrontDoorEndpointListResult DeserializeFrontDoorEndpointListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorEndpointListResult(Optional.ToList(value), nextLink.Value); + return new FrontDoorEndpointListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FrontDoorEndpointListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorEndpointListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorEndpointListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorEndpointListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorEndpointListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorEndpointListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorEndpointListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.cs index f5bc5ab46d34..971eab909b6c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list endpoints. It contains a list of endpoint objects and a URL link to get the next set of results. internal partial class FrontDoorEndpointListResult { - /// Initializes a new instance of FrontDoorEndpointListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FrontDoorEndpointListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FrontDoorEndpointListResult. + /// Initializes a new instance of . /// List of AzureFrontDoor endpoints within a profile. /// URL to get the next set of endpoint objects if there is any. - internal FrontDoorEndpointListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FrontDoorEndpointListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AzureFrontDoor endpoints within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.Serialization.cs index 4477ec66d32d..025fdd8d07d1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorEndpointPatch : IUtf8JsonSerializable + public partial class FrontDoorEndpointPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,130 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EnabledState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorEndpointPatch DeserializeFrontDoorEndpointPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional profileName = default; + Optional enabledState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("profileName"u8)) + { + profileName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("enabledState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabledState = new EnabledState(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorEndpointPatch(Optional.ToDictionary(tags), profileName.Value, Optional.ToNullable(enabledState), serializedAdditionalRawData); + } + + FrontDoorEndpointPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorEndpointPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorEndpointPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorEndpointPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorEndpointPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorEndpointPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorEndpointPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.cs index 29777d3e0a4b..837186b01e8d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorEndpointPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.ResourceManager.Cdn.Models /// Properties required to create or update an endpoint. public partial class FrontDoorEndpointPatch { - /// Initializes a new instance of FrontDoorEndpointPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorEndpointPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Endpoint tags. + /// The name of the profile which holds the endpoint. + /// Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. + /// Keeps track of any properties unknown to the library. + internal FrontDoorEndpointPatch(IDictionary tags, string profileName, EnabledState? enabledState, Dictionary serializedAdditionalRawData) + { + Tags = tags; + ProfileName = profileName; + EnabledState = enabledState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Endpoint tags. public IDictionary Tags { get; } /// The name of the profile which holds the endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginData.Serialization.cs index fdc8d980c20c..4e8e85231a21 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorOriginData : IUtf8JsonSerializable + public partial class FrontDoorOriginData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -74,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (SharedPrivateLinkResource != null) { writer.WritePropertyName("sharedPrivateLinkResource"u8); - writer.WriteObjectValue(SharedPrivateLinkResource); + if (SharedPrivateLinkResource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SharedPrivateLinkResource).Serialize(writer, options); + } } else { @@ -92,11 +107,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(EnforceCertificateNameCheck.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorOriginData DeserializeFrontDoorOriginData(JsonElement element) + internal static FrontDoorOriginData DeserializeFrontDoorOriginData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -118,6 +147,7 @@ internal static FrontDoorOriginData DeserializeFrontDoorOriginData(JsonElement e Optional enforceCertificateNameCheck = default; Optional provisioningState = default; Optional deploymentStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -264,8 +294,61 @@ internal static FrontDoorOriginData DeserializeFrontDoorOriginData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorOriginData(id, name, type, systemData.Value, originGroupName.Value, azureOrigin, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), sharedPrivateLinkResource.Value, Optional.ToNullable(enabledState), Optional.ToNullable(enforceCertificateNameCheck), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), serializedAdditionalRawData); + } + + FrontDoorOriginData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorOriginData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorOriginData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorOriginData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorOriginData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorOriginData(Response response) + { + if (response is null) + { + return null; } - return new FrontDoorOriginData(id, name, type, systemData.Value, originGroupName.Value, azureOrigin, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), sharedPrivateLinkResource.Value, Optional.ToNullable(enabledState), Optional.ToNullable(enforceCertificateNameCheck), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorOriginData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupData.Serialization.cs index 57fc3830e438..7666478372c9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupData.Serialization.cs @@ -5,29 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorOriginGroupData : IUtf8JsonSerializable + public partial class FrontDoorOriginGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(LoadBalancingSettings)) { writer.WritePropertyName("loadBalancingSettings"u8); - writer.WriteObjectValue(LoadBalancingSettings); + if (LoadBalancingSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LoadBalancingSettings).Serialize(writer, options); + } } if (Optional.IsDefined(HealthProbeSettings)) { writer.WritePropertyName("healthProbeSettings"u8); - writer.WriteObjectValue(HealthProbeSettings); + if (HealthProbeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HealthProbeSettings).Serialize(writer, options); + } } if (Optional.IsDefined(TrafficRestorationTimeInMinutes)) { @@ -47,11 +69,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SessionAffinityState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorOriginGroupData DeserializeFrontDoorOriginGroupData(JsonElement element) + internal static FrontDoorOriginGroupData DeserializeFrontDoorOriginGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +103,7 @@ internal static FrontDoorOriginGroupData DeserializeFrontDoorOriginGroupData(Jso Optional sessionAffinityState = default; Optional provisioningState = default; Optional deploymentStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -165,8 +202,61 @@ internal static FrontDoorOriginGroupData DeserializeFrontDoorOriginGroupData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorOriginGroupData(id, name, type, systemData.Value, profileName.Value, loadBalancingSettings.Value, healthProbeSettings.Value, Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), Optional.ToNullable(sessionAffinityState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), serializedAdditionalRawData); + } + + FrontDoorOriginGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorOriginGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorOriginGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorOriginGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorOriginGroupData model) + { + if (model is null) + { + return null; } - return new FrontDoorOriginGroupData(id, name, type, systemData.Value, profileName.Value, loadBalancingSettings.Value, healthProbeSettings.Value, Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), Optional.ToNullable(sessionAffinityState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorOriginGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorOriginGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.Serialization.cs index 49b0ec24dcaf..986c9547d435 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class FrontDoorOriginGroupListResult + internal partial class FrontDoorOriginGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FrontDoorOriginGroupListResult DeserializeFrontDoorOriginGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FrontDoorOriginGroupListResult DeserializeFrontDoorOriginGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static FrontDoorOriginGroupListResult DeserializeFrontDoorOriginGroupLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorOriginGroupListResult(Optional.ToList(value), nextLink.Value); + return new FrontDoorOriginGroupListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FrontDoorOriginGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorOriginGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorOriginGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorOriginGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorOriginGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorOriginGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorOriginGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.cs index 643be8153d57..505708750c00 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list origin groups. It contains a list of origin groups objects and a URL link to get the next set of results. internal partial class FrontDoorOriginGroupListResult { - /// Initializes a new instance of FrontDoorOriginGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FrontDoorOriginGroupListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FrontDoorOriginGroupListResult. + /// Initializes a new instance of . /// List of CDN origin groups within an endpoint. /// URL to get the next set of origin objects if there are any. - internal FrontDoorOriginGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FrontDoorOriginGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN origin groups within an endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.Serialization.cs index 351d7f594c5a..255669f3de6c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.Serialization.cs @@ -5,27 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorOriginGroupPatch : IUtf8JsonSerializable + public partial class FrontDoorOriginGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(LoadBalancingSettings)) { writer.WritePropertyName("loadBalancingSettings"u8); - writer.WriteObjectValue(LoadBalancingSettings); + if (LoadBalancingSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LoadBalancingSettings).Serialize(writer, options); + } } if (Optional.IsDefined(HealthProbeSettings)) { writer.WritePropertyName("healthProbeSettings"u8); - writer.WriteObjectValue(HealthProbeSettings); + if (HealthProbeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HealthProbeSettings).Serialize(writer, options); + } } if (Optional.IsDefined(TrafficRestorationTimeInMinutes)) { @@ -45,7 +67,146 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SessionAffinityState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorOriginGroupPatch DeserializeFrontDoorOriginGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional profileName = default; + Optional loadBalancingSettings = default; + Optional healthProbeSettings = default; + Optional trafficRestorationTimeToHealedOrNewEndpointsInMinutes = default; + Optional sessionAffinityState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("profileName"u8)) + { + profileName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("loadBalancingSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loadBalancingSettings = LoadBalancingSettings.DeserializeLoadBalancingSettings(property0.Value); + continue; + } + if (property0.NameEquals("healthProbeSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + healthProbeSettings = HealthProbeSettings.DeserializeHealthProbeSettings(property0.Value); + continue; + } + if (property0.NameEquals("trafficRestorationTimeToHealedOrNewEndpointsInMinutes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + trafficRestorationTimeToHealedOrNewEndpointsInMinutes = null; + continue; + } + trafficRestorationTimeToHealedOrNewEndpointsInMinutes = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("sessionAffinityState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionAffinityState = new EnabledState(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorOriginGroupPatch(profileName.Value, loadBalancingSettings.Value, healthProbeSettings.Value, Optional.ToNullable(trafficRestorationTimeToHealedOrNewEndpointsInMinutes), Optional.ToNullable(sessionAffinityState), serializedAdditionalRawData); + } + + FrontDoorOriginGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorOriginGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorOriginGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorOriginGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorOriginGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorOriginGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorOriginGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.cs index a5efd8a3b9a5..eb3600a77ed5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginGroupPatch.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// AFDOrigin group properties needed for origin group creation or update. public partial class FrontDoorOriginGroupPatch { - /// Initializes a new instance of FrontDoorOriginGroupPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorOriginGroupPatch() { } + /// Initializes a new instance of . + /// The name of the profile which holds the origin group. + /// Load balancing settings for a backend pool. + /// Health probe settings to the origin that is used to determine the health of the origin. + /// Time in minutes to shift the traffic to the endpoint gradually when an unhealthy endpoint comes healthy or a new endpoint is added. Default is 10 mins. This property is currently not supported. + /// Whether to allow session affinity on this host. Valid options are 'Enabled' or 'Disabled'. + /// Keeps track of any properties unknown to the library. + internal FrontDoorOriginGroupPatch(string profileName, LoadBalancingSettings loadBalancingSettings, HealthProbeSettings healthProbeSettings, int? trafficRestorationTimeInMinutes, EnabledState? sessionAffinityState, Dictionary serializedAdditionalRawData) + { + ProfileName = profileName; + LoadBalancingSettings = loadBalancingSettings; + HealthProbeSettings = healthProbeSettings; + TrafficRestorationTimeInMinutes = trafficRestorationTimeInMinutes; + SessionAffinityState = sessionAffinityState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the profile which holds the origin group. public string ProfileName { get; } /// Load balancing settings for a backend pool. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.Serialization.cs index 7b9afef798ae..e3369328022a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class FrontDoorOriginListResult + internal partial class FrontDoorOriginListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FrontDoorOriginListResult DeserializeFrontDoorOriginListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FrontDoorOriginListResult DeserializeFrontDoorOriginListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static FrontDoorOriginListResult DeserializeFrontDoorOriginListResult(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorOriginListResult(Optional.ToList(value), nextLink.Value); + return new FrontDoorOriginListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FrontDoorOriginListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorOriginListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorOriginListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorOriginListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorOriginListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorOriginListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorOriginListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.cs index 414688ad19d2..00d326be9c2f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list origins. It contains a list of origin objects and a URL link to get the next set of results. internal partial class FrontDoorOriginListResult { - /// Initializes a new instance of FrontDoorOriginListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FrontDoorOriginListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FrontDoorOriginListResult. + /// Initializes a new instance of . /// List of CDN origins within an endpoint. /// URL to get the next set of origin objects if there are any. - internal FrontDoorOriginListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FrontDoorOriginListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN origins within an endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.Serialization.cs index c44ca1efe0fc..cd2fabec38d1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorOriginPatch : IUtf8JsonSerializable + public partial class FrontDoorOriginPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -71,7 +80,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (SharedPrivateLinkResource != null) { writer.WritePropertyName("sharedPrivateLinkResource"u8); - writer.WriteObjectValue(SharedPrivateLinkResource); + if (SharedPrivateLinkResource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SharedPrivateLinkResource).Serialize(writer, options); + } } else { @@ -89,7 +105,200 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(EnforceCertificateNameCheck.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorOriginPatch DeserializeFrontDoorOriginPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional originGroupName = default; + Optional azureOrigin = default; + Optional hostName = default; + Optional httpPort = default; + Optional httpsPort = default; + Optional originHostHeader = default; + Optional priority = default; + Optional weight = default; + Optional sharedPrivateLinkResource = default; + Optional enabledState = default; + Optional enforceCertificateNameCheck = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("originGroupName"u8)) + { + originGroupName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("azureOrigin"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureOrigin = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("hostName"u8)) + { + hostName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("httpPort"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpPort = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("httpsPort"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpsPort = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("originHostHeader"u8)) + { + originHostHeader = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("priority"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + priority = null; + continue; + } + priority = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("weight"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + weight = null; + continue; + } + weight = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("sharedPrivateLinkResource"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + sharedPrivateLinkResource = null; + continue; + } + sharedPrivateLinkResource = SharedPrivateLinkResourceProperties.DeserializeSharedPrivateLinkResourceProperties(property0.Value); + continue; + } + if (property0.NameEquals("enabledState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabledState = new EnabledState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enforceCertificateNameCheck"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enforceCertificateNameCheck = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorOriginPatch(originGroupName.Value, azureOrigin, hostName.Value, Optional.ToNullable(httpPort), Optional.ToNullable(httpsPort), originHostHeader.Value, Optional.ToNullable(priority), Optional.ToNullable(weight), sharedPrivateLinkResource.Value, Optional.ToNullable(enabledState), Optional.ToNullable(enforceCertificateNameCheck), serializedAdditionalRawData); + } + + FrontDoorOriginPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorOriginPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorOriginPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorOriginPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorOriginPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorOriginPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorOriginPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.cs index 84f241cc4e9f..bf93ac4af82d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorOriginPatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,11 +15,43 @@ namespace Azure.ResourceManager.Cdn.Models /// AFDOrigin properties needed for origin update. public partial class FrontDoorOriginPatch { - /// Initializes a new instance of FrontDoorOriginPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorOriginPatch() { } + /// Initializes a new instance of . + /// The name of the origin group which contains this origin. + /// Resource reference to the Azure origin resource. + /// The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be unique across all origins in an endpoint. + /// The value of the HTTP port. Must be between 1 and 65535. + /// The value of the HTTPS port. Must be between 1 and 65535. + /// The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint. + /// Priority of origin in given origin group for load balancing. Higher priorities will not be used for load balancing if any lower priority origin is healthy.Must be between 1 and 5. + /// Weight of the origin in given origin group for load balancing. Must be between 1 and 1000. + /// The properties of the private link resource for private origin. + /// Whether to enable health probes to be made against backends defined under backendPools. Health probes can only be disabled if there is a single enabled backend in single enabled backend pool. + /// Whether to enable certificate name check at origin level. + /// Keeps track of any properties unknown to the library. + internal FrontDoorOriginPatch(string originGroupName, WritableSubResource origin, string hostName, int? httpPort, int? httpsPort, string originHostHeader, int? priority, int? weight, SharedPrivateLinkResourceProperties sharedPrivateLinkResource, EnabledState? enabledState, bool? enforceCertificateNameCheck, Dictionary serializedAdditionalRawData) + { + OriginGroupName = originGroupName; + Origin = origin; + HostName = hostName; + HttpPort = httpPort; + HttpsPort = httpsPort; + OriginHostHeader = originHostHeader; + Priority = priority; + Weight = weight; + SharedPrivateLinkResource = sharedPrivateLinkResource; + EnabledState = enabledState; + EnforceCertificateNameCheck = enforceCertificateNameCheck; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the origin group which contains this origin. public string OriginGroupName { get; } /// Resource reference to the Azure origin resource. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.Serialization.cs index 715c193e4625..33bf08647cb3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorPurgeContent : IUtf8JsonSerializable + public partial class FrontDoorPurgeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contentPaths"u8); writer.WriteStartArray(); @@ -32,7 +40,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorPurgeContent DeserializeFrontDoorPurgeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList contentPaths = default; + Optional> domains = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contentPaths"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contentPaths = array; + continue; + } + if (property.NameEquals("domains"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + domains = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorPurgeContent(contentPaths, Optional.ToList(domains), serializedAdditionalRawData); + } + + FrontDoorPurgeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorPurgeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorPurgeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorPurgeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorPurgeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorPurgeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorPurgeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.cs index 10dff1c8ae9c..f4a7200f8726 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorPurgeContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Parameters required for content purge. public partial class FrontDoorPurgeContent { - /// Initializes a new instance of FrontDoorPurgeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The path to the content to be purged. Can describe a file path or a wild card directory. /// is null. public FrontDoorPurgeContent(IEnumerable contentPaths) @@ -26,6 +29,22 @@ public FrontDoorPurgeContent(IEnumerable contentPaths) Domains = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The path to the content to be purged. Can describe a file path or a wild card directory. + /// List of domains. + /// Keeps track of any properties unknown to the library. + internal FrontDoorPurgeContent(IList contentPaths, IList domains, Dictionary serializedAdditionalRawData) + { + ContentPaths = contentPaths; + Domains = domains; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FrontDoorPurgeContent() + { + } + /// The path to the content to be purged. Can describe a file path or a wild card directory. public IList ContentPaths { get; } /// List of domains. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.Serialization.cs index b4180c8ea258..a2f0f21ef042 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorRouteCacheConfiguration : IUtf8JsonSerializable + public partial class FrontDoorRouteCacheConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QueryStringCachingBehavior)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CompressionSettings)) { writer.WritePropertyName("compressionSettings"u8); - writer.WriteObjectValue(CompressionSettings); + if (CompressionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CompressionSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static FrontDoorRouteCacheConfiguration DeserializeFrontDoorRouteCacheConfiguration(JsonElement element) + internal static FrontDoorRouteCacheConfiguration DeserializeFrontDoorRouteCacheConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static FrontDoorRouteCacheConfiguration DeserializeFrontDoorRouteCacheC Optional queryStringCachingBehavior = default; Optional queryParameters = default; Optional compressionSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queryStringCachingBehavior"u8)) @@ -67,8 +97,61 @@ internal static FrontDoorRouteCacheConfiguration DeserializeFrontDoorRouteCacheC compressionSettings = RouteCacheCompressionSettings.DeserializeRouteCacheCompressionSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorRouteCacheConfiguration(Optional.ToNullable(queryStringCachingBehavior), queryParameters.Value, compressionSettings.Value, serializedAdditionalRawData); + } + + FrontDoorRouteCacheConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorRouteCacheConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorRouteCacheConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorRouteCacheConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorRouteCacheConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorRouteCacheConfiguration(Response response) + { + if (response is null) + { + return null; } - return new FrontDoorRouteCacheConfiguration(Optional.ToNullable(queryStringCachingBehavior), queryParameters.Value, compressionSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorRouteCacheConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.cs index f82d1f3fe9ac..1b78335add85 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteCacheConfiguration.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Caching settings for a caching-type route. To disable caching, do not provide a cacheConfiguration object. public partial class FrontDoorRouteCacheConfiguration { - /// Initializes a new instance of FrontDoorRouteCacheConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorRouteCacheConfiguration() { } - /// Initializes a new instance of FrontDoorRouteCacheConfiguration. + /// Initializes a new instance of . /// Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. /// query parameters to include or exclude (comma separated). /// compression settings. - internal FrontDoorRouteCacheConfiguration(FrontDoorQueryStringCachingBehavior? queryStringCachingBehavior, string queryParameters, RouteCacheCompressionSettings compressionSettings) + /// Keeps track of any properties unknown to the library. + internal FrontDoorRouteCacheConfiguration(FrontDoorQueryStringCachingBehavior? queryStringCachingBehavior, string queryParameters, RouteCacheCompressionSettings compressionSettings, Dictionary serializedAdditionalRawData) { QueryStringCachingBehavior = queryStringCachingBehavior; QueryParameters = queryParameters; CompressionSettings = compressionSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Defines how Frontdoor caches requests that include query strings. You can ignore any query strings when caching, ignore specific query strings, cache every request with a unique URL, or cache specific query strings. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteData.Serialization.cs index 3c4b7ec04ec2..4ff9fd77efe3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRouteData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorRouteData : IUtf8JsonSerializable + public partial class FrontDoorRouteData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomDomains) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,7 +90,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (CacheConfiguration != null) { writer.WritePropertyName("cacheConfiguration"u8); - writer.WriteObjectValue(CacheConfiguration); + if (CacheConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CacheConfiguration).Serialize(writer, options); + } } else { @@ -104,11 +125,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EnabledState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorRouteData DeserializeFrontDoorRouteData(JsonElement element) + internal static FrontDoorRouteData DeserializeFrontDoorRouteData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -131,6 +166,7 @@ internal static FrontDoorRouteData DeserializeFrontDoorRouteData(JsonElement ele Optional enabledState = default; Optional provisioningState = default; Optional deploymentStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -308,8 +344,61 @@ internal static FrontDoorRouteData DeserializeFrontDoorRouteData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorRouteData(id, name, type, systemData.Value, endpointName.Value, Optional.ToList(customDomains), originGroup, originPath.Value, Optional.ToList(ruleSets), Optional.ToList(supportedProtocols), Optional.ToList(patternsToMatch), cacheConfiguration.Value, Optional.ToNullable(forwardingProtocol), Optional.ToNullable(linkToDefaultDomain), Optional.ToNullable(httpsRedirect), Optional.ToNullable(enabledState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), serializedAdditionalRawData); + } + + FrontDoorRouteData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorRouteData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorRouteData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorRouteData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorRouteData model) + { + if (model is null) + { + return null; } - return new FrontDoorRouteData(id, name, type, systemData.Value, endpointName.Value, Optional.ToList(customDomains), originGroup, originPath.Value, Optional.ToList(ruleSets), Optional.ToList(supportedProtocols), Optional.ToList(patternsToMatch), cacheConfiguration.Value, Optional.ToNullable(forwardingProtocol), Optional.ToNullable(linkToDefaultDomain), Optional.ToNullable(httpsRedirect), Optional.ToNullable(enabledState), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorRouteData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorRouteData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.Serialization.cs index 4802388b3f8c..7870b79005f4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorRoutePatch : IUtf8JsonSerializable + public partial class FrontDoorRoutePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -23,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomDomains) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -72,7 +88,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (CacheConfiguration != null) { writer.WritePropertyName("cacheConfiguration"u8); - writer.WriteObjectValue(CacheConfiguration); + if (CacheConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CacheConfiguration).Serialize(writer, options); + } } else { @@ -100,7 +123,232 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EnabledState.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorRoutePatch DeserializeFrontDoorRoutePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional endpointName = default; + Optional> customDomains = default; + Optional originGroup = default; + Optional originPath = default; + Optional> ruleSets = default; + Optional> supportedProtocols = default; + Optional> patternsToMatch = default; + Optional cacheConfiguration = default; + Optional forwardingProtocol = default; + Optional linkToDefaultDomain = default; + Optional httpsRedirect = default; + Optional enabledState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("endpointName"u8)) + { + endpointName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("customDomains"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(FrontDoorActivatedResourceInfo.DeserializeFrontDoorActivatedResourceInfo(item)); + } + customDomains = array; + continue; + } + if (property0.NameEquals("originGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + originGroup = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("originPath"u8)) + { + originPath = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("ruleSets"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + ruleSets = array; + continue; + } + if (property0.NameEquals("supportedProtocols"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new FrontDoorEndpointProtocol(item.GetString())); + } + supportedProtocols = array; + continue; + } + if (property0.NameEquals("patternsToMatch"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + patternsToMatch = array; + continue; + } + if (property0.NameEquals("cacheConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + cacheConfiguration = null; + continue; + } + cacheConfiguration = FrontDoorRouteCacheConfiguration.DeserializeFrontDoorRouteCacheConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("forwardingProtocol"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forwardingProtocol = new ForwardingProtocol(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("linkToDefaultDomain"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + linkToDefaultDomain = new LinkToDefaultDomain(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("httpsRedirect"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpsRedirect = new HttpsRedirect(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enabledState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabledState = new EnabledState(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorRoutePatch(endpointName.Value, Optional.ToList(customDomains), originGroup, originPath.Value, Optional.ToList(ruleSets), Optional.ToList(supportedProtocols), Optional.ToList(patternsToMatch), cacheConfiguration.Value, Optional.ToNullable(forwardingProtocol), Optional.ToNullable(linkToDefaultDomain), Optional.ToNullable(httpsRedirect), Optional.ToNullable(enabledState), serializedAdditionalRawData); + } + + FrontDoorRoutePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorRoutePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorRoutePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorRoutePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorRoutePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorRoutePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorRoutePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.cs index 53a9c03193c6..7ba41537bb5d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRoutePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// The domain JSON object required for domain creation or update. public partial class FrontDoorRoutePatch { - /// Initializes a new instance of FrontDoorRoutePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorRoutePatch() { CustomDomains = new ChangeTrackingList(); @@ -23,6 +27,37 @@ public FrontDoorRoutePatch() PatternsToMatch = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The name of the endpoint which holds the route. + /// Domains referenced by this endpoint. + /// A reference to the origin group. + /// A directory path on the origin that AzureFrontDoor can use to retrieve content from, e.g. contoso.cloudapp.net/originpath. + /// rule sets referenced by this endpoint. + /// List of supported protocols for this route. + /// The route patterns of the rule. + /// The caching configuration for this route. To disable caching, do not provide a cacheConfiguration object. + /// Protocol this rule will use when forwarding traffic to backends. + /// whether this route will be linked to the default endpoint domain. + /// Whether to automatically redirect HTTP traffic to HTTPS traffic. Note that this is a easy way to set up this rule and it will be the first rule that gets executed. + /// Whether to enable use of this rule. Permitted values are 'Enabled' or 'Disabled'. + /// Keeps track of any properties unknown to the library. + internal FrontDoorRoutePatch(string endpointName, IList customDomains, WritableSubResource originGroup, string originPath, IList ruleSets, IList supportedProtocols, IList patternsToMatch, FrontDoorRouteCacheConfiguration cacheConfiguration, ForwardingProtocol? forwardingProtocol, LinkToDefaultDomain? linkToDefaultDomain, HttpsRedirect? httpsRedirect, EnabledState? enabledState, Dictionary serializedAdditionalRawData) + { + EndpointName = endpointName; + CustomDomains = customDomains; + OriginGroup = originGroup; + OriginPath = originPath; + RuleSets = ruleSets; + SupportedProtocols = supportedProtocols; + PatternsToMatch = patternsToMatch; + CacheConfiguration = cacheConfiguration; + ForwardingProtocol = forwardingProtocol; + LinkToDefaultDomain = linkToDefaultDomain; + HttpsRedirect = httpsRedirect; + EnabledState = enabledState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the endpoint which holds the route. public string EndpointName { get; } /// Domains referenced by this endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleData.Serialization.cs index b8fce5505d7a..5f9115924bba 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorRuleData : IUtf8JsonSerializable + public partial class FrontDoorRuleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -31,7 +38,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Conditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Actions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -51,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(MatchProcessingBehavior.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorRuleData DeserializeFrontDoorRuleData(JsonElement element) + internal static FrontDoorRuleData DeserializeFrontDoorRuleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +106,7 @@ internal static FrontDoorRuleData DeserializeFrontDoorRuleData(JsonElement eleme Optional matchProcessingBehavior = default; Optional provisioningState = default; Optional deploymentStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -178,8 +214,61 @@ internal static FrontDoorRuleData DeserializeFrontDoorRuleData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorRuleData(id, name, type, systemData.Value, ruleSetName.Value, Optional.ToNullable(order), Optional.ToList(conditions), Optional.ToList(actions), Optional.ToNullable(matchProcessingBehavior), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), serializedAdditionalRawData); + } + + FrontDoorRuleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorRuleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorRuleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorRuleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorRuleData model) + { + if (model is null) + { + return null; } - return new FrontDoorRuleData(id, name, type, systemData.Value, ruleSetName.Value, Optional.ToNullable(order), Optional.ToList(conditions), Optional.ToList(actions), Optional.ToNullable(matchProcessingBehavior), Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorRuleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorRuleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.Serialization.cs index cc2dc0a808e1..be7958c1a109 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorRulePatch : IUtf8JsonSerializable + public partial class FrontDoorRulePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Conditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -38,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Actions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -48,7 +70,155 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(MatchProcessingBehavior.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorRulePatch DeserializeFrontDoorRulePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional ruleSetName = default; + Optional order = default; + Optional> conditions = default; + Optional> actions = default; + Optional matchProcessingBehavior = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("ruleSetName"u8)) + { + ruleSetName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("order"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + order = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("conditions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DeliveryRuleCondition.DeserializeDeliveryRuleCondition(item)); + } + conditions = array; + continue; + } + if (property0.NameEquals("actions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DeliveryRuleAction.DeserializeDeliveryRuleAction(item)); + } + actions = array; + continue; + } + if (property0.NameEquals("matchProcessingBehavior"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + matchProcessingBehavior = new MatchProcessingBehavior(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorRulePatch(ruleSetName.Value, Optional.ToNullable(order), Optional.ToList(conditions), Optional.ToList(actions), Optional.ToNullable(matchProcessingBehavior), serializedAdditionalRawData); + } + + FrontDoorRulePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorRulePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorRulePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorRulePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorRulePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorRulePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorRulePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.cs index bc0f86fcbbe2..c80885ae380a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRulePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,41 @@ namespace Azure.ResourceManager.Cdn.Models /// The domain JSON object required for domain creation or update. public partial class FrontDoorRulePatch { - /// Initializes a new instance of FrontDoorRulePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorRulePatch() { Conditions = new ChangeTrackingList(); Actions = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The name of the rule set containing the rule. + /// The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. + /// + /// A list of conditions that must be matched for the actions to be executed + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , and . + /// + /// + /// A list of actions that are executed when all the conditions of a rule are satisfied. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , and . + /// + /// If this rule is a match should the rules engine continue running the remaining rules or stop. If not present, defaults to Continue. + /// Keeps track of any properties unknown to the library. + internal FrontDoorRulePatch(string ruleSetName, int? order, IList conditions, IList actions, MatchProcessingBehavior? matchProcessingBehavior, Dictionary serializedAdditionalRawData) + { + RuleSetName = ruleSetName; + Order = order; + Conditions = conditions; + Actions = actions; + MatchProcessingBehavior = matchProcessingBehavior; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the rule set containing the rule. public string RuleSetName { get; } /// The order in which the rules are applied for the endpoint. Possible values {0,1,2,3,………}. A rule with a lesser order will be applied before a rule with a greater order. Rule with order 0 is a special rule. It does not require any condition and actions listed in it will always be applied. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleSetData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleSetData.Serialization.cs index 01d5a48ace88..817eb9edd427 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleSetData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorRuleSetData.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorRuleSetData : IUtf8JsonSerializable + public partial class FrontDoorRuleSetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorRuleSetData DeserializeFrontDoorRuleSetData(JsonElement element) + internal static FrontDoorRuleSetData DeserializeFrontDoorRuleSetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static FrontDoorRuleSetData DeserializeFrontDoorRuleSetData(JsonElement Optional provisioningState = default; Optional deploymentStatus = default; Optional profileName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +120,61 @@ internal static FrontDoorRuleSetData DeserializeFrontDoorRuleSetData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorRuleSetData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), profileName.Value, serializedAdditionalRawData); + } + + FrontDoorRuleSetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorRuleSetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorRuleSetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorRuleSetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorRuleSetData model) + { + if (model is null) + { + return null; } - return new FrontDoorRuleSetData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), profileName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorRuleSetData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorRuleSetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretData.Serialization.cs index 3dfab55f3176..3524b24caf7e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretData.Serialization.cs @@ -5,31 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorSecretData : IUtf8JsonSerializable + public partial class FrontDoorSecretData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorSecretData DeserializeFrontDoorSecretData(JsonElement element) + internal static FrontDoorSecretData DeserializeFrontDoorSecretData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static FrontDoorSecretData DeserializeFrontDoorSecretData(JsonElement e Optional deploymentStatus = default; Optional profileName = default; Optional parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static FrontDoorSecretData DeserializeFrontDoorSecretData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorSecretData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), profileName.Value, parameters.Value, serializedAdditionalRawData); + } + + FrontDoorSecretData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorSecretData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorSecretData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorSecretData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorSecretData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorSecretData(Response response) + { + if (response is null) + { + return null; } - return new FrontDoorSecretData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), profileName.Value, parameters.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorSecretData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.Serialization.cs index 4158463e4e2e..083e5d77d18f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorSecretProperties : IUtf8JsonSerializable + public partial class FrontDoorSecretProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(SecretType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorSecretProperties DeserializeFrontDoorSecretProperties(JsonElement element) + internal static FrontDoorSecretProperties DeserializeFrontDoorSecretProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,7 +58,72 @@ internal static FrontDoorSecretProperties DeserializeFrontDoorSecretProperties(J case "UrlSigningKey": return UriSigningKeyProperties.DeserializeUriSigningKeyProperties(element); } } - return UnknownSecretProperties.DeserializeUnknownSecretProperties(element); + + // Unknown type found so we will deserialize the base properties only + SecretType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new SecretType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownSecretProperties(type, serializedAdditionalRawData); + } + + FrontDoorSecretProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorSecretProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorSecretProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorSecretProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorSecretProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorSecretProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorSecretProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.cs index 2e71a0a5e601..3956ccd4fa79 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecretProperties.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Cdn.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownSecretProperties))] public abstract partial class FrontDoorSecretProperties { - /// Initializes a new instance of FrontDoorSecretProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected FrontDoorSecretProperties() { } - /// Initializes a new instance of FrontDoorSecretProperties. + /// Initializes a new instance of . /// The type of the secret resource. - internal FrontDoorSecretProperties(SecretType secretType) + /// Keeps track of any properties unknown to the library. + internal FrontDoorSecretProperties(SecretType secretType, Dictionary serializedAdditionalRawData) { SecretType = secretType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the secret resource. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyData.Serialization.cs index 4bb32a074208..08535488b446 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyData.Serialization.cs @@ -5,31 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class FrontDoorSecurityPolicyData : IUtf8JsonSerializable + public partial class FrontDoorSecurityPolicyData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FrontDoorSecurityPolicyData DeserializeFrontDoorSecurityPolicyData(JsonElement element) + internal static FrontDoorSecurityPolicyData DeserializeFrontDoorSecurityPolicyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static FrontDoorSecurityPolicyData DeserializeFrontDoorSecurityPolicyDa Optional deploymentStatus = default; Optional profileName = default; Optional parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static FrontDoorSecurityPolicyData DeserializeFrontDoorSecurityPolicyDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorSecurityPolicyData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), profileName.Value, parameters.Value, serializedAdditionalRawData); + } + + FrontDoorSecurityPolicyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorSecurityPolicyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorSecurityPolicyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorSecurityPolicyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorSecurityPolicyData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorSecurityPolicyData(Response response) + { + if (response is null) + { + return null; } - return new FrontDoorSecurityPolicyData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(deploymentStatus), profileName.Value, parameters.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorSecurityPolicyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.Serialization.cs index e4673489778b..7726efb9c44d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.Serialization.cs @@ -5,25 +5,142 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorSecurityPolicyPatch : IUtf8JsonSerializable + public partial class FrontDoorSecurityPolicyPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FrontDoorSecurityPolicyPatch DeserializeFrontDoorSecurityPolicyPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = SecurityPolicyProperties.DeserializeSecurityPolicyProperties(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FrontDoorSecurityPolicyPatch(parameters.Value, serializedAdditionalRawData); + } + + FrontDoorSecurityPolicyPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorSecurityPolicyPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorSecurityPolicyPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorSecurityPolicyPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorSecurityPolicyPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorSecurityPolicyPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorSecurityPolicyPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.cs index 2eb9a1719d03..140aad4c4c26 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorSecurityPolicyPatch.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The JSON object containing security policy update parameters. public partial class FrontDoorSecurityPolicyPatch { - /// Initializes a new instance of FrontDoorSecurityPolicyPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FrontDoorSecurityPolicyPatch() { } + /// Initializes a new instance of . + /// + /// object which contains security policy parameters + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// Keeps track of any properties unknown to the library. + internal FrontDoorSecurityPolicyPatch(SecurityPolicyProperties properties, Dictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// /// object which contains security policy parameters /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.Serialization.cs index 51f7ae6ee71f..55e59db71a1d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorUsage + public partial class FrontDoorUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FrontDoorUsage DeserializeFrontDoorUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue); + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit); + writer.WritePropertyName("name"u8); + if (Name is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Name).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FrontDoorUsage DeserializeFrontDoorUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +66,7 @@ internal static FrontDoorUsage DeserializeFrontDoorUsage(JsonElement element) long currentValue = default; long limit = default; FrontDoorUsageResourceName name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -54,8 +98,61 @@ internal static FrontDoorUsage DeserializeFrontDoorUsage(JsonElement element) name = FrontDoorUsageResourceName.DeserializeFrontDoorUsageResourceName(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorUsage(id.Value, unit, currentValue, limit, name); + return new FrontDoorUsage(id.Value, unit, currentValue, limit, name, serializedAdditionalRawData); + } + + FrontDoorUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.cs index e9eded4b7b36..e70854383927 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsage.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Describes resource usage. public partial class FrontDoorUsage { - /// Initializes a new instance of FrontDoorUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// An enum describing the unit of measurement. /// The current value of the usage. /// The limit of usage. @@ -29,19 +33,26 @@ internal FrontDoorUsage(FrontDoorUsageUnit unit, long currentValue, long limit, Name = name; } - /// Initializes a new instance of FrontDoorUsage. + /// Initializes a new instance of . /// Resource identifier. /// An enum describing the unit of measurement. /// The current value of the usage. /// The limit of usage. /// The name of the type of usage. - internal FrontDoorUsage(ResourceIdentifier id, FrontDoorUsageUnit unit, long currentValue, long limit, FrontDoorUsageResourceName name) + /// Keeps track of any properties unknown to the library. + internal FrontDoorUsage(ResourceIdentifier id, FrontDoorUsageUnit unit, long currentValue, long limit, FrontDoorUsageResourceName name, Dictionary serializedAdditionalRawData) { Id = id; Unit = unit; CurrentValue = currentValue; Limit = limit; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FrontDoorUsage() + { } /// Resource identifier. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.Serialization.cs index c7cbdea2d7bf..9da048867053 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class FrontDoorUsageResourceName + public partial class FrontDoorUsageResourceName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FrontDoorUsageResourceName DeserializeFrontDoorUsageResourceName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FrontDoorUsageResourceName DeserializeFrontDoorUsageResourceName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional localizedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +71,61 @@ internal static FrontDoorUsageResourceName DeserializeFrontDoorUsageResourceName localizedValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FrontDoorUsageResourceName(value.Value, localizedValue.Value); + return new FrontDoorUsageResourceName(value.Value, localizedValue.Value, serializedAdditionalRawData); + } + + FrontDoorUsageResourceName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFrontDoorUsageResourceName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorUsageResourceName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorUsageResourceName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FrontDoorUsageResourceName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FrontDoorUsageResourceName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFrontDoorUsageResourceName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.cs index a46af4a3b488..5ad6b55201ff 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/FrontDoorUsageResourceName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The usage names. public partial class FrontDoorUsageResourceName { - /// Initializes a new instance of FrontDoorUsageResourceName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FrontDoorUsageResourceName() { } - /// Initializes a new instance of FrontDoorUsageResourceName. + /// Initializes a new instance of . /// A string describing the resource name. /// A localized string describing the resource name. - internal FrontDoorUsageResourceName(string value, string localizedValue) + /// Keeps track of any properties unknown to the library. + internal FrontDoorUsageResourceName(string value, string localizedValue, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A string describing the resource name. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.Serialization.cs index 0546b8fec12b..dba2bd90ee5d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class GeoFilter : IUtf8JsonSerializable + public partial class GeoFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("relativePath"u8); writer.WriteStringValue(RelativePath); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GeoFilter DeserializeGeoFilter(JsonElement element) + internal static GeoFilter DeserializeGeoFilter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static GeoFilter DeserializeGeoFilter(JsonElement element) string relativePath = default; GeoFilterAction action = default; IList countryCodes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("relativePath"u8)) @@ -61,8 +83,61 @@ internal static GeoFilter DeserializeGeoFilter(JsonElement element) countryCodes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GeoFilter(relativePath, action, countryCodes, serializedAdditionalRawData); + } + + GeoFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGeoFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GeoFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGeoFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GeoFilter model) + { + if (model is null) + { + return null; } - return new GeoFilter(relativePath, action, countryCodes); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GeoFilter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGeoFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.cs index 35c8b3da38e4..e02863b855b8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/GeoFilter.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Rules defining user's geo access within a CDN endpoint. public partial class GeoFilter { - /// Initializes a new instance of GeoFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.). /// Action of the geo filter, i.e. allow or block access. /// Two letter country or region codes defining user country or region access in a geo filter, e.g. AU, MX, US. @@ -30,15 +33,22 @@ public GeoFilter(string relativePath, GeoFilterAction action, IEnumerable Initializes a new instance of GeoFilter. + /// Initializes a new instance of . /// Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.). /// Action of the geo filter, i.e. allow or block access. /// Two letter country or region codes defining user country or region access in a geo filter, e.g. AU, MX, US. - internal GeoFilter(string relativePath, GeoFilterAction action, IList countryCodes) + /// Keeps track of any properties unknown to the library. + internal GeoFilter(string relativePath, GeoFilterAction action, IList countryCodes, Dictionary serializedAdditionalRawData) { RelativePath = relativePath; Action = action; CountryCodes = countryCodes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GeoFilter() + { } /// Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.). diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.Serialization.cs index b3f5eace0703..3084620bb1d6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class HeaderActionProperties : IUtf8JsonSerializable + public partial class HeaderActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HeaderActionProperties DeserializeHeaderActionProperties(JsonElement element) + internal static HeaderActionProperties DeserializeHeaderActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static HeaderActionProperties DeserializeHeaderActionProperties(JsonEle HeaderAction headerAction = default; string headerName = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -61,8 +84,61 @@ internal static HeaderActionProperties DeserializeHeaderActionProperties(JsonEle value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HeaderActionProperties(typeName, headerAction, headerName, value.Value, serializedAdditionalRawData); + } + + HeaderActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHeaderActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HeaderActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHeaderActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HeaderActionProperties model) + { + if (model is null) + { + return null; } - return new HeaderActionProperties(typeName, headerAction, headerName, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HeaderActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHeaderActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.cs index 9332243e00fa..25df9a709a67 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HeaderActionProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for the request header action. public partial class HeaderActionProperties { - /// Initializes a new instance of HeaderActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Action to perform. /// Name of the header to modify. @@ -27,17 +31,24 @@ public HeaderActionProperties(HeaderActionType actionType, HeaderAction headerAc HeaderName = headerName; } - /// Initializes a new instance of HeaderActionProperties. + /// Initializes a new instance of . /// /// Action to perform. /// Name of the header to modify. /// Value for the specified action. - internal HeaderActionProperties(HeaderActionType actionType, HeaderAction headerAction, string headerName, string value) + /// Keeps track of any properties unknown to the library. + internal HeaderActionProperties(HeaderActionType actionType, HeaderAction headerAction, string headerName, string value, Dictionary serializedAdditionalRawData) { ActionType = actionType; HeaderAction = headerAction; HeaderName = headerName; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HeaderActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.Serialization.cs index dbebb7eb9316..bd279286c268 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class HealthProbeSettings : IUtf8JsonSerializable + public partial class HealthProbeSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProbePath)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("probeIntervalInSeconds"u8); writer.WriteNumberValue(ProbeIntervalInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HealthProbeSettings DeserializeHealthProbeSettings(JsonElement element) + internal static HealthProbeSettings DeserializeHealthProbeSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static HealthProbeSettings DeserializeHealthProbeSettings(JsonElement e Optional probeRequestType = default; Optional probeProtocol = default; Optional probeIntervalInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("probePath"u8)) @@ -82,8 +105,61 @@ internal static HealthProbeSettings DeserializeHealthProbeSettings(JsonElement e probeIntervalInSeconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HealthProbeSettings(probePath.Value, Optional.ToNullable(probeRequestType), Optional.ToNullable(probeProtocol), Optional.ToNullable(probeIntervalInSeconds), serializedAdditionalRawData); + } + + HealthProbeSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHealthProbeSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HealthProbeSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHealthProbeSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HealthProbeSettings model) + { + if (model is null) + { + return null; } - return new HealthProbeSettings(probePath.Value, Optional.ToNullable(probeRequestType), Optional.ToNullable(probeProtocol), Optional.ToNullable(probeIntervalInSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HealthProbeSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHealthProbeSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.cs index a1ed47e916f1..3babae1216c6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HealthProbeSettings.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The JSON object that contains the properties to send health probes to origin. public partial class HealthProbeSettings { - /// Initializes a new instance of HealthProbeSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HealthProbeSettings() { } - /// Initializes a new instance of HealthProbeSettings. + /// Initializes a new instance of . /// The path relative to the origin that is used to determine the health of the origin. /// The type of health probe request that is made. /// Protocol to use for health probe. /// The number of seconds between health probes.Default is 240sec. - internal HealthProbeSettings(string probePath, HealthProbeRequestType? probeRequestType, HealthProbeProtocol? probeProtocol, int? probeIntervalInSeconds) + /// Keeps track of any properties unknown to the library. + internal HealthProbeSettings(string probePath, HealthProbeRequestType? probeRequestType, HealthProbeProtocol? probeProtocol, int? probeIntervalInSeconds, Dictionary serializedAdditionalRawData) { ProbePath = probePath; ProbeRequestType = probeRequestType; ProbeProtocol = probeProtocol; ProbeIntervalInSeconds = probeIntervalInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The path relative to the origin that is used to determine the health of the origin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.Serialization.cs index 5dda12262636..91d1440d5213 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class HostNameAvailabilityContent : IUtf8JsonSerializable + public partial class HostNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("hostName"u8); writer.WriteStringValue(HostName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HostNameAvailabilityContent DeserializeHostNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string hostName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hostName"u8)) + { + hostName = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HostNameAvailabilityContent(hostName, serializedAdditionalRawData); + } + + HostNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHostNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HostNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHostNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HostNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HostNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHostNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.cs index 0a8f64c454fa..f9a002efd47c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Input of CheckHostNameAvailability API. public partial class HostNameAvailabilityContent { - /// Initializes a new instance of HostNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The host name to validate. /// is null. public HostNameAvailabilityContent(string hostName) @@ -23,6 +27,20 @@ public HostNameAvailabilityContent(string hostName) HostName = hostName; } + /// Initializes a new instance of . + /// The host name to validate. + /// Keeps track of any properties unknown to the library. + internal HostNameAvailabilityContent(string hostName, Dictionary serializedAdditionalRawData) + { + HostName = hostName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostNameAvailabilityContent() + { + } + /// The host name to validate. public string HostName { get; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.Serialization.cs index 66e09c1f8a6e..a1f8ee8ef0bc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class HostNameMatchCondition : IUtf8JsonSerializable + public partial class HostNameMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HostNameMatchCondition DeserializeHostNameMatchCondition(JsonElement element) + internal static HostNameMatchCondition DeserializeHostNameMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static HostNameMatchCondition DeserializeHostNameMatchCondition(JsonEle Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static HostNameMatchCondition DeserializeHostNameMatchCondition(JsonEle transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HostNameMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + HostNameMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHostNameMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HostNameMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHostNameMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HostNameMatchCondition model) + { + if (model is null) + { + return null; } - return new HostNameMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HostNameMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHostNameMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.cs index c9d0226c4b31..2d6c2d5ae116 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HostNameMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for HostName match conditions. public partial class HostNameMatchCondition { - /// Initializes a new instance of HostNameMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public HostNameMatchCondition(HostNameMatchConditionType conditionType, HostNameOperator hostNameOperator) @@ -24,19 +28,26 @@ public HostNameMatchCondition(HostNameMatchConditionType conditionType, HostName Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of HostNameMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal HostNameMatchCondition(HostNameMatchConditionType conditionType, HostNameOperator hostNameOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal HostNameMatchCondition(HostNameMatchConditionType conditionType, HostNameOperator hostNameOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; HostNameOperator = hostNameOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostNameMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.Serialization.cs index 12ac926c34e2..c0705781941b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class HttpErrorRange : IUtf8JsonSerializable + public partial class HttpErrorRange : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Begin)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("end"u8); writer.WriteNumberValue(End.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HttpErrorRange DeserializeHttpErrorRange(JsonElement element) + internal static HttpErrorRange DeserializeHttpErrorRange(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional begin = default; Optional end = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("begin"u8)) @@ -56,8 +79,61 @@ internal static HttpErrorRange DeserializeHttpErrorRange(JsonElement element) end = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HttpErrorRange(Optional.ToNullable(begin), Optional.ToNullable(end), serializedAdditionalRawData); + } + + HttpErrorRange IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpErrorRange(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpErrorRange IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpErrorRange(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpErrorRange model) + { + if (model is null) + { + return null; } - return new HttpErrorRange(Optional.ToNullable(begin), Optional.ToNullable(end)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpErrorRange(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpErrorRange(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.cs index 1e0e5471e40c..2d5a75a711f0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpErrorRange.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The JSON object that represents the range for http status codes. public partial class HttpErrorRange { - /// Initializes a new instance of HttpErrorRange. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HttpErrorRange() { } - /// Initializes a new instance of HttpErrorRange. + /// Initializes a new instance of . /// The inclusive start of the http status code range. /// The inclusive end of the http status code range. - internal HttpErrorRange(int? begin, int? end) + /// Keeps track of any properties unknown to the library. + internal HttpErrorRange(int? begin, int? end, Dictionary serializedAdditionalRawData) { Begin = begin; End = end; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The inclusive start of the http status code range. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.Serialization.cs index a4ee396c64c2..1a4680cb8748 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class HttpVersionMatchCondition : IUtf8JsonSerializable + public partial class HttpVersionMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HttpVersionMatchCondition DeserializeHttpVersionMatchCondition(JsonElement element) + internal static HttpVersionMatchCondition DeserializeHttpVersionMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static HttpVersionMatchCondition DeserializeHttpVersionMatchCondition(J Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static HttpVersionMatchCondition DeserializeHttpVersionMatchCondition(J transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HttpVersionMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + HttpVersionMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpVersionMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpVersionMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpVersionMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpVersionMatchCondition model) + { + if (model is null) + { + return null; } - return new HttpVersionMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpVersionMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpVersionMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.cs index ddb85d50608a..d8b8571f3e27 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/HttpVersionMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for HttpVersion match conditions. public partial class HttpVersionMatchCondition { - /// Initializes a new instance of HttpVersionMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public HttpVersionMatchCondition(HttpVersionMatchConditionType conditionType, HttpVersionOperator httpVersionOperator) @@ -24,19 +28,26 @@ public HttpVersionMatchCondition(HttpVersionMatchConditionType conditionType, Ht Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of HttpVersionMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal HttpVersionMatchCondition(HttpVersionMatchConditionType conditionType, HttpVersionOperator httpVersionOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal HttpVersionMatchCondition(HttpVersionMatchConditionType conditionType, HttpVersionOperator httpVersionOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; HttpVersionOperator = httpVersionOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HttpVersionMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.Serialization.cs index e3cd1ca897bf..7c3c10c21004 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class IPAddressGroup : IUtf8JsonSerializable + public partial class IPAddressGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DeliveryRegion)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPv4Addresses) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,15 +51,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPv6Addresses) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IPAddressGroup DeserializeIPAddressGroup(JsonElement element) + internal static IPAddressGroup DeserializeIPAddressGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +88,7 @@ internal static IPAddressGroup DeserializeIPAddressGroup(JsonElement element) Optional deliveryRegion = default; Optional> ipv4Addresses = default; Optional> ipv6Addresses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deliveryRegion"u8)) @@ -88,8 +124,61 @@ internal static IPAddressGroup DeserializeIPAddressGroup(JsonElement element) ipv6Addresses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IPAddressGroup(deliveryRegion.Value, Optional.ToList(ipv4Addresses), Optional.ToList(ipv6Addresses), serializedAdditionalRawData); + } + + IPAddressGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIPAddressGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IPAddressGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIPAddressGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IPAddressGroup model) + { + if (model is null) + { + return null; } - return new IPAddressGroup(deliveryRegion.Value, Optional.ToList(ipv4Addresses), Optional.ToList(ipv6Addresses)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IPAddressGroup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIPAddressGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.cs index a3c021f907ca..aa97d5bb125e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IPAddressGroup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Cdn.Models /// CDN Ip address group. public partial class IPAddressGroup { - /// Initializes a new instance of IPAddressGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IPAddressGroup() { IPv4Addresses = new ChangeTrackingList(); IPv6Addresses = new ChangeTrackingList(); } - /// Initializes a new instance of IPAddressGroup. + /// Initializes a new instance of . /// The delivery region of the ip address group. /// The list of ip v4 addresses. /// The list of ip v6 addresses. - internal IPAddressGroup(string deliveryRegion, IList ipv4Addresses, IList ipv6Addresses) + /// Keeps track of any properties unknown to the library. + internal IPAddressGroup(string deliveryRegion, IList ipv4Addresses, IList ipv6Addresses, Dictionary serializedAdditionalRawData) { DeliveryRegion = deliveryRegion; IPv4Addresses = ipv4Addresses; IPv6Addresses = ipv6Addresses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The delivery region of the ip address group. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.Serialization.cs index 7d8c7e990077..e5ba61afc0fb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class IsDeviceMatchCondition : IUtf8JsonSerializable + public partial class IsDeviceMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IsDeviceMatchCondition DeserializeIsDeviceMatchCondition(JsonElement element) + internal static IsDeviceMatchCondition DeserializeIsDeviceMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static IsDeviceMatchCondition DeserializeIsDeviceMatchCondition(JsonEle Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static IsDeviceMatchCondition DeserializeIsDeviceMatchCondition(JsonEle transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IsDeviceMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + IsDeviceMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIsDeviceMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IsDeviceMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIsDeviceMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IsDeviceMatchCondition model) + { + if (model is null) + { + return null; } - return new IsDeviceMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IsDeviceMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIsDeviceMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.cs index 448df5d0fe0f..bc5edbbf41d6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/IsDeviceMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for IsDevice match conditions. public partial class IsDeviceMatchCondition { - /// Initializes a new instance of IsDeviceMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public IsDeviceMatchCondition(IsDeviceMatchConditionType conditionType, IsDeviceOperator isDeviceOperator) @@ -24,19 +28,26 @@ public IsDeviceMatchCondition(IsDeviceMatchConditionType conditionType, IsDevice Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of IsDeviceMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal IsDeviceMatchCondition(IsDeviceMatchConditionType conditionType, IsDeviceOperator isDeviceOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal IsDeviceMatchCondition(IsDeviceMatchConditionType conditionType, IsDeviceOperator isDeviceOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; IsDeviceOperator = isDeviceOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IsDeviceMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.Serialization.cs index 722a8c5e903b..a828329aef1d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class KeyVaultCertificateSource : IUtf8JsonSerializable + public partial class KeyVaultCertificateSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(SourceType.ToString()); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UpdateRule.ToString()); writer.WritePropertyName("deleteRule"u8); writer.WriteStringValue(DeleteRule.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultCertificateSource DeserializeKeyVaultCertificateSource(JsonElement element) + internal static KeyVaultCertificateSource DeserializeKeyVaultCertificateSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static KeyVaultCertificateSource DeserializeKeyVaultCertificateSource(J Optional secretVersion = default; CertificateUpdateAction updateRule = default; CertificateDeleteAction deleteRule = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -93,8 +116,61 @@ internal static KeyVaultCertificateSource DeserializeKeyVaultCertificateSource(J deleteRule = new CertificateDeleteAction(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultCertificateSource(typeName, subscriptionId, resourceGroupName, vaultName, secretName, secretVersion.Value, updateRule, deleteRule, serializedAdditionalRawData); + } + + KeyVaultCertificateSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultCertificateSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultCertificateSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultCertificateSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultCertificateSource model) + { + if (model is null) + { + return null; } - return new KeyVaultCertificateSource(typeName, subscriptionId, resourceGroupName, vaultName, secretName, secretVersion.Value, updateRule, deleteRule); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultCertificateSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultCertificateSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.cs index aad8518ab6d4..c9895bb0aa2b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultCertificateSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Describes the parameters for using a user's KeyVault certificate for securing custom domain. public partial class KeyVaultCertificateSource { - /// Initializes a new instance of KeyVaultCertificateSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Subscription Id of the user's Key Vault containing the SSL certificate. /// Resource group of the user's Key Vault containing the SSL certificate. @@ -38,7 +42,7 @@ public KeyVaultCertificateSource(KeyVaultCertificateSourceType sourceType, strin DeleteRule = deleteRule; } - /// Initializes a new instance of KeyVaultCertificateSource. + /// Initializes a new instance of . /// /// Subscription Id of the user's Key Vault containing the SSL certificate. /// Resource group of the user's Key Vault containing the SSL certificate. @@ -47,7 +51,8 @@ public KeyVaultCertificateSource(KeyVaultCertificateSourceType sourceType, strin /// The version(GUID) of Key Vault Secret in Key Vault. /// Describes the action that shall be taken when the certificate is updated in Key Vault. /// Describes the action that shall be taken when the certificate is removed from Key Vault. - internal KeyVaultCertificateSource(KeyVaultCertificateSourceType sourceType, string subscriptionId, string resourceGroupName, string vaultName, string secretName, string secretVersion, CertificateUpdateAction updateRule, CertificateDeleteAction deleteRule) + /// Keeps track of any properties unknown to the library. + internal KeyVaultCertificateSource(KeyVaultCertificateSourceType sourceType, string subscriptionId, string resourceGroupName, string vaultName, string secretName, string secretVersion, CertificateUpdateAction updateRule, CertificateDeleteAction deleteRule, Dictionary serializedAdditionalRawData) { SourceType = sourceType; SubscriptionId = subscriptionId; @@ -57,6 +62,12 @@ internal KeyVaultCertificateSource(KeyVaultCertificateSourceType sourceType, str SecretVersion = secretVersion; UpdateRule = updateRule; DeleteRule = deleteRule; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultCertificateSource() + { } /// Gets or sets the source type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.Serialization.cs index 843ef16ae043..1708b2ce9188 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class KeyVaultSigningKey : IUtf8JsonSerializable + public partial class KeyVaultSigningKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(KeyType.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SecretName); writer.WritePropertyName("secretVersion"u8); writer.WriteStringValue(SecretVersion); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultSigningKey DeserializeKeyVaultSigningKey(JsonElement element) + internal static KeyVaultSigningKey DeserializeKeyVaultSigningKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static KeyVaultSigningKey DeserializeKeyVaultSigningKey(JsonElement ele string vaultName = default; string secretName = default; string secretVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -74,8 +97,61 @@ internal static KeyVaultSigningKey DeserializeKeyVaultSigningKey(JsonElement ele secretVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultSigningKey(typeName, subscriptionId, resourceGroupName, vaultName, secretName, secretVersion, serializedAdditionalRawData); + } + + KeyVaultSigningKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultSigningKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultSigningKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultSigningKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultSigningKey model) + { + if (model is null) + { + return null; } - return new KeyVaultSigningKey(typeName, subscriptionId, resourceGroupName, vaultName, secretName, secretVersion); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultSigningKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultSigningKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.cs index 2bc75fc8d948..b77fd13c4451 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/KeyVaultSigningKey.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Describes the parameters for using a user's KeyVault for URL Signing Key. public partial class KeyVaultSigningKey { - /// Initializes a new instance of KeyVaultSigningKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Subscription Id of the user's Key Vault containing the secret. /// Resource group of the user's Key Vault containing the secret. @@ -37,6 +41,30 @@ public KeyVaultSigningKey(KeyVaultSigningKeyType keyType, string subscriptionId, SecretVersion = secretVersion; } + /// Initializes a new instance of . + /// + /// Subscription Id of the user's Key Vault containing the secret. + /// Resource group of the user's Key Vault containing the secret. + /// The name of the user's Key Vault containing the secret. + /// The name of secret in Key Vault. + /// The version(GUID) of secret in Key Vault. + /// Keeps track of any properties unknown to the library. + internal KeyVaultSigningKey(KeyVaultSigningKeyType keyType, string subscriptionId, string resourceGroupName, string vaultName, string secretName, string secretVersion, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + SubscriptionId = subscriptionId; + ResourceGroupName = resourceGroupName; + VaultName = vaultName; + SecretName = secretName; + SecretVersion = secretVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultSigningKey() + { + } + /// Gets or sets the key type. public KeyVaultSigningKeyType KeyType { get; set; } /// Subscription Id of the user's Key Vault containing the secret. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.Serialization.cs index 2585b13ac120..ff44c957ddd9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class LoadBalancingSettings : IUtf8JsonSerializable + public partial class LoadBalancingSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SampleSize)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("additionalLatencyInMilliseconds"u8); writer.WriteNumberValue(AdditionalLatencyInMilliseconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LoadBalancingSettings DeserializeLoadBalancingSettings(JsonElement element) + internal static LoadBalancingSettings DeserializeLoadBalancingSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static LoadBalancingSettings DeserializeLoadBalancingSettings(JsonEleme Optional sampleSize = default; Optional successfulSamplesRequired = default; Optional additionalLatencyInMilliseconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sampleSize"u8)) @@ -71,8 +94,61 @@ internal static LoadBalancingSettings DeserializeLoadBalancingSettings(JsonEleme additionalLatencyInMilliseconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LoadBalancingSettings(Optional.ToNullable(sampleSize), Optional.ToNullable(successfulSamplesRequired), Optional.ToNullable(additionalLatencyInMilliseconds), serializedAdditionalRawData); + } + + LoadBalancingSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLoadBalancingSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LoadBalancingSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLoadBalancingSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LoadBalancingSettings model) + { + if (model is null) + { + return null; } - return new LoadBalancingSettings(Optional.ToNullable(sampleSize), Optional.ToNullable(successfulSamplesRequired), Optional.ToNullable(additionalLatencyInMilliseconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LoadBalancingSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLoadBalancingSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.cs index 81ada794f039..010754657da5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadBalancingSettings.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Round-Robin load balancing settings for a backend pool. public partial class LoadBalancingSettings { - /// Initializes a new instance of LoadBalancingSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LoadBalancingSettings() { } - /// Initializes a new instance of LoadBalancingSettings. + /// Initializes a new instance of . /// The number of samples to consider for load balancing decisions. /// The number of samples within the sample period that must succeed. /// The additional latency in milliseconds for probes to fall into the lowest latency bucket. - internal LoadBalancingSettings(int? sampleSize, int? successfulSamplesRequired, int? additionalLatencyInMilliseconds) + /// Keeps track of any properties unknown to the library. + internal LoadBalancingSettings(int? sampleSize, int? successfulSamplesRequired, int? additionalLatencyInMilliseconds, Dictionary serializedAdditionalRawData) { SampleSize = sampleSize; SuccessfulSamplesRequired = successfulSamplesRequired; AdditionalLatencyInMilliseconds = additionalLatencyInMilliseconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of samples to consider for load balancing decisions. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.Serialization.cs index 688aad1f0783..62545486d73a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class LoadContent : IUtf8JsonSerializable + public partial class LoadContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contentPaths"u8); writer.WriteStartArray(); @@ -22,7 +30,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static LoadContent DeserializeLoadContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList contentPaths = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contentPaths"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contentPaths = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LoadContent(contentPaths, serializedAdditionalRawData); + } + + LoadContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLoadContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LoadContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLoadContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LoadContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LoadContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLoadContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.cs index a2814a2a2e28..1473d20ca410 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/LoadContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Parameters required for content load. public partial class LoadContent { - /// Initializes a new instance of LoadContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The path to the content to be loaded. Path should be a relative file URL of the origin. /// is null. public LoadContent(IEnumerable contentPaths) @@ -25,6 +28,20 @@ public LoadContent(IEnumerable contentPaths) ContentPaths = contentPaths.ToList(); } + /// Initializes a new instance of . + /// The path to the content to be loaded. Path should be a relative file URL of the origin. + /// Keeps track of any properties unknown to the library. + internal LoadContent(IList contentPaths, Dictionary serializedAdditionalRawData) + { + ContentPaths = contentPaths; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LoadContent() + { + } + /// The path to the content to be loaded. Path should be a relative file URL of the origin. public IList ContentPaths { get; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.Serialization.cs index fb1115eed84a..7416172389f7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.Serialization.cs @@ -6,23 +6,44 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ManagedCertificateProperties : IUtf8JsonSerializable + public partial class ManagedCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(SecretType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedCertificateProperties DeserializeManagedCertificateProperties(JsonElement element) + internal static ManagedCertificateProperties DeserializeManagedCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +51,7 @@ internal static ManagedCertificateProperties DeserializeManagedCertificateProper Optional subject = default; Optional expirationDate = default; SecretType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subject"u8)) @@ -51,8 +73,61 @@ internal static ManagedCertificateProperties DeserializeManagedCertificateProper type = new SecretType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedCertificateProperties(type, subject.Value, Optional.ToNullable(expirationDate), serializedAdditionalRawData); + } + + ManagedCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedCertificateProperties model) + { + if (model is null) + { + return null; } - return new ManagedCertificateProperties(type, subject.Value, Optional.ToNullable(expirationDate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.cs index a75b82a93a90..a714bc1cdc67 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedCertificateProperties.cs @@ -6,23 +6,25 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// Managed Certificate used for https. public partial class ManagedCertificateProperties : FrontDoorSecretProperties { - /// Initializes a new instance of ManagedCertificateProperties. + /// Initializes a new instance of . public ManagedCertificateProperties() { SecretType = SecretType.ManagedCertificate; } - /// Initializes a new instance of ManagedCertificateProperties. + /// Initializes a new instance of . /// The type of the secret resource. /// Subject name in the certificate. /// Certificate expiration date. - internal ManagedCertificateProperties(SecretType secretType, string subject, DateTimeOffset? expiresOn) : base(secretType) + /// Keeps track of any properties unknown to the library. + internal ManagedCertificateProperties(SecretType secretType, string subject, DateTimeOffset? expiresOn, Dictionary serializedAdditionalRawData) : base(secretType, serializedAdditionalRawData) { Subject = subject; ExpiresOn = expiresOn; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.Serialization.cs index acb799cd7672..030e3ca1da0c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ManagedRuleDefinition + public partial class ManagedRuleDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedRuleDefinition DeserializeManagedRuleDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedRuleDefinition DeserializeManagedRuleDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ruleId = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ruleId"u8)) @@ -32,8 +61,61 @@ internal static ManagedRuleDefinition DeserializeManagedRuleDefinition(JsonEleme description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedRuleDefinition(ruleId.Value, description.Value); + return new ManagedRuleDefinition(ruleId.Value, description.Value, serializedAdditionalRawData); + } + + ManagedRuleDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.cs index 322aa8bd68b4..525ee889c324 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleDefinition.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Describes a managed rule definition. public partial class ManagedRuleDefinition { - /// Initializes a new instance of ManagedRuleDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedRuleDefinition() { } - /// Initializes a new instance of ManagedRuleDefinition. + /// Initializes a new instance of . /// Identifier for the managed rule. /// Describes the functionality of the managed rule. - internal ManagedRuleDefinition(string ruleId, string description) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleDefinition(string ruleId, string description, Dictionary serializedAdditionalRawData) { RuleId = ruleId; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifier for the managed rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.Serialization.cs index 648583520460..b9ab52e3fb6a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ManagedRuleGroupDefinition + public partial class ManagedRuleGroupDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedRuleGroupDefinition DeserializeManagedRuleGroupDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedRuleGroupDefinition DeserializeManagedRuleGroupDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static ManagedRuleGroupDefinition DeserializeManagedRuleGroupDefinition Optional ruleGroupName = default; Optional description = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ruleGroupName"u8)) @@ -48,8 +76,61 @@ internal static ManagedRuleGroupDefinition DeserializeManagedRuleGroupDefinition rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedRuleGroupDefinition(ruleGroupName.Value, description.Value, Optional.ToList(rules)); + return new ManagedRuleGroupDefinition(ruleGroupName.Value, description.Value, Optional.ToList(rules), serializedAdditionalRawData); + } + + ManagedRuleGroupDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleGroupDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleGroupDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleGroupDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleGroupDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleGroupDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleGroupDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs index a923c31caae7..1342a5190bd1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Cdn.Models /// Describes a managed rule group. public partial class ManagedRuleGroupDefinition { - /// Initializes a new instance of ManagedRuleGroupDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedRuleGroupDefinition() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedRuleGroupDefinition. + /// Initializes a new instance of . /// Name of the managed rule group. /// Description of the managed rule group. /// List of rules within the managed rule group. - internal ManagedRuleGroupDefinition(string ruleGroupName, string description, IReadOnlyList rules) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleGroupDefinition(string ruleGroupName, string description, IReadOnlyList rules, Dictionary serializedAdditionalRawData) { RuleGroupName = ruleGroupName; Description = description; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the managed rule group. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.Serialization.cs index e70393f91625..c8f5ac334e3e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ManagedRuleGroupOverrideSetting : IUtf8JsonSerializable + public partial class ManagedRuleGroupOverrideSetting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("ruleGroupName"u8); writer.WriteStringValue(RuleGroupName); @@ -24,21 +31,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedRuleGroupOverrideSetting DeserializeManagedRuleGroupOverrideSetting(JsonElement element) + internal static ManagedRuleGroupOverrideSetting DeserializeManagedRuleGroupOverrideSetting(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string ruleGroupName = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ruleGroupName"u8)) @@ -60,8 +89,61 @@ internal static ManagedRuleGroupOverrideSetting DeserializeManagedRuleGroupOverr rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedRuleGroupOverrideSetting(ruleGroupName, Optional.ToList(rules), serializedAdditionalRawData); + } + + ManagedRuleGroupOverrideSetting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleGroupOverrideSetting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleGroupOverrideSetting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleGroupOverrideSetting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleGroupOverrideSetting model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleGroupOverrideSetting(Response response) + { + if (response is null) + { + return null; } - return new ManagedRuleGroupOverrideSetting(ruleGroupName, Optional.ToList(rules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleGroupOverrideSetting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.cs index 854340c2a470..ac99a41b5881 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleGroupOverrideSetting.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines a managed rule group override setting. public partial class ManagedRuleGroupOverrideSetting { - /// Initializes a new instance of ManagedRuleGroupOverrideSetting. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Describes the managed rule group within the rule set to override. /// is null. public ManagedRuleGroupOverrideSetting(string ruleGroupName) @@ -25,13 +28,20 @@ public ManagedRuleGroupOverrideSetting(string ruleGroupName) Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedRuleGroupOverrideSetting. + /// Initializes a new instance of . /// Describes the managed rule group within the rule set to override. /// List of rules that will be disabled. If none specified, all rules in the group will be disabled. - internal ManagedRuleGroupOverrideSetting(string ruleGroupName, IList rules) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleGroupOverrideSetting(string ruleGroupName, IList rules, Dictionary serializedAdditionalRawData) { RuleGroupName = ruleGroupName; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedRuleGroupOverrideSetting() + { } /// Describes the managed rule group within the rule set to override. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.Serialization.cs index e4b1769ca6c4..44effbdd7df1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ManagedRuleOverrideSetting : IUtf8JsonSerializable + public partial class ManagedRuleOverrideSetting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("ruleId"u8); writer.WriteStringValue(RuleId); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedRuleOverrideSetting DeserializeManagedRuleOverrideSetting(JsonElement element) + internal static ManagedRuleOverrideSetting DeserializeManagedRuleOverrideSetting(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ManagedRuleOverrideSetting DeserializeManagedRuleOverrideSetting string ruleId = default; Optional enabledState = default; Optional action = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ruleId"u8)) @@ -64,8 +87,61 @@ internal static ManagedRuleOverrideSetting DeserializeManagedRuleOverrideSetting action = new OverrideActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedRuleOverrideSetting(ruleId, Optional.ToNullable(enabledState), Optional.ToNullable(action), serializedAdditionalRawData); + } + + ManagedRuleOverrideSetting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleOverrideSetting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleOverrideSetting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleOverrideSetting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleOverrideSetting model) + { + if (model is null) + { + return null; } - return new ManagedRuleOverrideSetting(ruleId, Optional.ToNullable(enabledState), Optional.ToNullable(action)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleOverrideSetting(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleOverrideSetting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.cs index fb289ae450e6..cdc7278c73cc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleOverrideSetting.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines a managed rule group override setting. public partial class ManagedRuleOverrideSetting { - /// Initializes a new instance of ManagedRuleOverrideSetting. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Identifier for the managed rule. /// is null. public ManagedRuleOverrideSetting(string ruleId) @@ -23,15 +27,22 @@ public ManagedRuleOverrideSetting(string ruleId) RuleId = ruleId; } - /// Initializes a new instance of ManagedRuleOverrideSetting. + /// Initializes a new instance of . /// Identifier for the managed rule. /// Describes if the managed rule is in enabled or disabled state. Defaults to Disabled if not specified. /// Describes the override action to be applied when rule matches. - internal ManagedRuleOverrideSetting(string ruleId, ManagedRuleSetupState? enabledState, OverrideActionType? action) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleOverrideSetting(string ruleId, ManagedRuleSetupState? enabledState, OverrideActionType? action, Dictionary serializedAdditionalRawData) { RuleId = ruleId; EnabledState = enabledState; Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedRuleOverrideSetting() + { } /// Identifier for the managed rule. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.Serialization.cs index 79700fa07f95..9c3210272203 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.Serialization.cs @@ -5,31 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class ManagedRuleSetDefinition : IUtf8JsonSerializable + public partial class ManagedRuleSetDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedRuleSetDefinition DeserializeManagedRuleSetDefinition(JsonElement element) + internal static ManagedRuleSetDefinition DeserializeManagedRuleSetDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static ManagedRuleSetDefinition DeserializeManagedRuleSetDefinition(Jso Optional ruleSetType = default; Optional ruleSetVersion = default; Optional> ruleGroups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -119,8 +148,61 @@ internal static ManagedRuleSetDefinition DeserializeManagedRuleSetDefinition(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedRuleSetDefinition(id, name, type, systemData.Value, sku.Value, provisioningState.Value, ruleSetType.Value, ruleSetVersion.Value, Optional.ToList(ruleGroups), serializedAdditionalRawData); + } + + ManagedRuleSetDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleSetDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleSetDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleSetDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleSetDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleSetDefinition(Response response) + { + if (response is null) + { + return null; } - return new ManagedRuleSetDefinition(id, name, type, systemData.Value, sku.Value, provisioningState.Value, ruleSetType.Value, ruleSetVersion.Value, Optional.ToList(ruleGroups)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleSetDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs index 3b7d8f497f17..f09e5f261a00 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.Cdn.Models /// Describes a managed rule set definition. public partial class ManagedRuleSetDefinition : ResourceData { - /// Initializes a new instance of ManagedRuleSetDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedRuleSetDefinition() { RuleGroups = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedRuleSetDefinition. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,13 +34,15 @@ public ManagedRuleSetDefinition() /// Type of the managed rule set. /// Version of the managed rule set type. /// Rule groups of the managed rule set. - internal ManagedRuleSetDefinition(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CdnSku sku, string provisioningState, string ruleSetType, string ruleSetVersion, IReadOnlyList ruleGroups) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleSetDefinition(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CdnSku sku, string provisioningState, string ruleSetType, string ruleSetVersion, IReadOnlyList ruleGroups, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; ProvisioningState = provisioningState; RuleSetType = ruleSetType; RuleSetVersion = ruleSetVersion; RuleGroups = ruleGroups; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The pricing tier (defines a CDN provider, feature list and rate) of the CdnWebApplicationFirewallPolicy. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.Serialization.cs index da48bd8e74b5..adcdbfe5c2f5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class ManagedRuleSetDefinitionList + internal partial class ManagedRuleSetDefinitionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedRuleSetDefinitionList DeserializeManagedRuleSetDefinitionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedRuleSetDefinitionList DeserializeManagedRuleSetDefinitionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +75,61 @@ internal static ManagedRuleSetDefinitionList DeserializeManagedRuleSetDefinition nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedRuleSetDefinitionList(Optional.ToList(value), nextLink.Value); + return new ManagedRuleSetDefinitionList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ManagedRuleSetDefinitionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleSetDefinitionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleSetDefinitionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleSetDefinitionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleSetDefinitionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleSetDefinitionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleSetDefinitionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.cs index 48dd047536e5..358e54ecc1cc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetDefinitionList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// List of managed rule set definitions available for use in a policy. internal partial class ManagedRuleSetDefinitionList { - /// Initializes a new instance of ManagedRuleSetDefinitionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedRuleSetDefinitionList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedRuleSetDefinitionList. + /// Initializes a new instance of . /// List of managed rule set definitions. /// URL to retrieve next set of managed rule set definitions. - internal ManagedRuleSetDefinitionList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleSetDefinitionList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of managed rule set definitions. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.Serialization.cs index c4ce6cededa2..774dfdb46a73 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class ManagedRuleSetList : IUtf8JsonSerializable + internal partial class ManagedRuleSetList : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ManagedRuleSets)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ManagedRuleSets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedRuleSetList DeserializeManagedRuleSetList(JsonElement element) + internal static ManagedRuleSetList DeserializeManagedRuleSetList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> managedRuleSets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedRuleSets"u8)) @@ -52,8 +81,61 @@ internal static ManagedRuleSetList DeserializeManagedRuleSetList(JsonElement ele managedRuleSets = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedRuleSetList(Optional.ToList(managedRuleSets), serializedAdditionalRawData); + } + + ManagedRuleSetList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedRuleSetList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedRuleSetList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedRuleSetList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedRuleSetList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedRuleSetList(Response response) + { + if (response is null) + { + return null; } - return new ManagedRuleSetList(Optional.ToList(managedRuleSets)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedRuleSetList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.cs index 3ce2bf4e491f..0cc72db2baca 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ManagedRuleSetList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the list of managed rule sets for the policy. internal partial class ManagedRuleSetList { - /// Initializes a new instance of ManagedRuleSetList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedRuleSetList() { ManagedRuleSets = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedRuleSetList. + /// Initializes a new instance of . /// List of rule sets. - internal ManagedRuleSetList(IList managedRuleSets) + /// Keeps track of any properties unknown to the library. + internal ManagedRuleSetList(IList managedRuleSets, Dictionary serializedAdditionalRawData) { ManagedRuleSets = managedRuleSets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of rule sets. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.Serialization.cs index 945bb8162903..562f9821c5f6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.Serialization.cs @@ -8,14 +8,72 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class MetricsResponse + public partial class MetricsResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MetricsResponse DeserializeMetricsResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DateTimeBegin)) + { + writer.WritePropertyName("dateTimeBegin"u8); + writer.WriteStringValue(DateTimeBegin.Value, "O"); + } + if (Optional.IsDefined(DateTimeEnd)) + { + writer.WritePropertyName("dateTimeEnd"u8); + writer.WriteStringValue(DateTimeEnd.Value, "O"); + } + if (Optional.IsDefined(Granularity)) + { + writer.WritePropertyName("granularity"u8); + writer.WriteStringValue(Granularity.Value.ToString()); + } + if (Optional.IsCollectionDefined(Series)) + { + writer.WritePropertyName("series"u8); + writer.WriteStartArray(); + foreach (var item in Series) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MetricsResponse DeserializeMetricsResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static MetricsResponse DeserializeMetricsResponse(JsonElement element) Optional dateTimeEnd = default; Optional granularity = default; Optional> series = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dateTimeBegin"u8)) @@ -67,8 +126,61 @@ internal static MetricsResponse DeserializeMetricsResponse(JsonElement element) series = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MetricsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToNullable(granularity), Optional.ToList(series)); + return new MetricsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToNullable(granularity), Optional.ToList(series), serializedAdditionalRawData); + } + + MetricsResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetricsResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetricsResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetricsResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetricsResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetricsResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetricsResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.cs index d358264676c7..ff319d55eb9f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponse.cs @@ -14,23 +14,28 @@ namespace Azure.ResourceManager.Cdn.Models /// Metrics Response. public partial class MetricsResponse { - /// Initializes a new instance of MetricsResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MetricsResponse() { Series = new ChangeTrackingList(); } - /// Initializes a new instance of MetricsResponse. + /// Initializes a new instance of . /// /// /// /// - internal MetricsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, MetricsResponseGranularity? granularity, IReadOnlyList series) + /// Keeps track of any properties unknown to the library. + internal MetricsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, MetricsResponseGranularity? granularity, IReadOnlyList series, Dictionary serializedAdditionalRawData) { DateTimeBegin = dateTimeBegin; DateTimeEnd = dateTimeEnd; Granularity = granularity; Series = series; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the date time begin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.Serialization.cs index 67012f776d2e..e02aa426025d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.Serialization.cs @@ -5,16 +5,87 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class MetricsResponseSeriesItem + public partial class MetricsResponseSeriesItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MetricsResponseSeriesItem DeserializeMetricsResponseSeriesItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Metric)) + { + writer.WritePropertyName("metric"u8); + writer.WriteStringValue(Metric); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (Optional.IsCollectionDefined(Groups)) + { + writer.WritePropertyName("groups"u8); + writer.WriteStartArray(); + foreach (var item in Groups) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MetricsResponseSeriesItem DeserializeMetricsResponseSeriesItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +94,7 @@ internal static MetricsResponseSeriesItem DeserializeMetricsResponseSeriesItem(J Optional unit = default; Optional> groups = default; Optional> data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metric"u8)) @@ -67,8 +139,61 @@ internal static MetricsResponseSeriesItem DeserializeMetricsResponseSeriesItem(J data = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MetricsResponseSeriesItem(metric.Value, Optional.ToNullable(unit), Optional.ToList(groups), Optional.ToList(data)); + return new MetricsResponseSeriesItem(metric.Value, Optional.ToNullable(unit), Optional.ToList(groups), Optional.ToList(data), serializedAdditionalRawData); + } + + MetricsResponseSeriesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetricsResponseSeriesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetricsResponseSeriesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetricsResponseSeriesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetricsResponseSeriesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetricsResponseSeriesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetricsResponseSeriesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.cs index c3b2d726ddfd..8de33b1651b8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Cdn.Models /// The MetricsResponseSeriesItem. public partial class MetricsResponseSeriesItem { - /// Initializes a new instance of MetricsResponseSeriesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MetricsResponseSeriesItem() { Groups = new ChangeTrackingList(); Data = new ChangeTrackingList(); } - /// Initializes a new instance of MetricsResponseSeriesItem. + /// Initializes a new instance of . /// /// /// /// - internal MetricsResponseSeriesItem(string metric, MetricsResponseSeriesItemUnit? unit, IReadOnlyList groups, IReadOnlyList data) + /// Keeps track of any properties unknown to the library. + internal MetricsResponseSeriesItem(string metric, MetricsResponseSeriesItemUnit? unit, IReadOnlyList groups, IReadOnlyList data, Dictionary serializedAdditionalRawData) { Metric = metric; Unit = unit; Groups = groups; Data = data; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the metric. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.Serialization.cs index 91b197bc8a49..f543fdac3c42 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class MetricsResponseSeriesPropertiesItemsItem + public partial class MetricsResponseSeriesPropertiesItemsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MetricsResponseSeriesPropertiesItemsItem DeserializeMetricsResponseSeriesPropertiesItemsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MetricsResponseSeriesPropertiesItemsItem DeserializeMetricsResponseSeriesPropertiesItemsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static MetricsResponseSeriesPropertiesItemsItem DeserializeMetricsRespo value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MetricsResponseSeriesPropertiesItemsItem(name.Value, value.Value); + return new MetricsResponseSeriesPropertiesItemsItem(name.Value, value.Value, serializedAdditionalRawData); + } + + MetricsResponseSeriesPropertiesItemsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetricsResponseSeriesPropertiesItemsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetricsResponseSeriesPropertiesItemsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetricsResponseSeriesPropertiesItemsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetricsResponseSeriesPropertiesItemsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetricsResponseSeriesPropertiesItemsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetricsResponseSeriesPropertiesItemsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.cs index d67bdc0c5f6d..d01f581e51c9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/MetricsResponseSeriesPropertiesItemsItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The MetricsResponseSeriesPropertiesItemsItem. public partial class MetricsResponseSeriesPropertiesItemsItem { - /// Initializes a new instance of MetricsResponseSeriesPropertiesItemsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MetricsResponseSeriesPropertiesItemsItem() { } - /// Initializes a new instance of MetricsResponseSeriesPropertiesItemsItem. + /// Initializes a new instance of . /// /// - internal MetricsResponseSeriesPropertiesItemsItem(string name, string value) + /// Keeps track of any properties unknown to the library. + internal MetricsResponseSeriesPropertiesItemsItem(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the name. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.Serialization.cs index e59dc8db54b0..a3b63d35b49c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class OriginGroupListResult + internal partial class OriginGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OriginGroupListResult DeserializeOriginGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OriginGroupListResult DeserializeOriginGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static OriginGroupListResult DeserializeOriginGroupListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OriginGroupListResult(Optional.ToList(value), nextLink.Value); + return new OriginGroupListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + OriginGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOriginGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OriginGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOriginGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OriginGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OriginGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOriginGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.cs index e465a0548b65..1caa3b2f3a13 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list origin groups. It contains a list of origin groups objects and a URL link to get the next set of results. internal partial class OriginGroupListResult { - /// Initializes a new instance of OriginGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OriginGroupListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of OriginGroupListResult. + /// Initializes a new instance of . /// List of CDN origin groups within an endpoint. /// URL to get the next set of origin objects if there are any. - internal OriginGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OriginGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN origin groups within an endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.Serialization.cs index dba6ba98bb27..f057d92766f1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class OriginGroupOverride : IUtf8JsonSerializable + public partial class OriginGroupOverride : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OriginGroup)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("forwardingProtocol"u8); writer.WriteStringValue(ForwardingProtocol.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OriginGroupOverride DeserializeOriginGroupOverride(JsonElement element) + internal static OriginGroupOverride DeserializeOriginGroupOverride(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional originGroup = default; Optional forwardingProtocol = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("originGroup"u8)) @@ -57,8 +80,61 @@ internal static OriginGroupOverride DeserializeOriginGroupOverride(JsonElement e forwardingProtocol = new ForwardingProtocol(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OriginGroupOverride(originGroup, Optional.ToNullable(forwardingProtocol), serializedAdditionalRawData); + } + + OriginGroupOverride IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOriginGroupOverride(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OriginGroupOverride IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOriginGroupOverride(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OriginGroupOverride model) + { + if (model is null) + { + return null; } - return new OriginGroupOverride(originGroup, Optional.ToNullable(forwardingProtocol)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OriginGroupOverride(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOriginGroupOverride(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.cs index b5c878d218e5..7d724e91c006 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverride.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,18 +15,23 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for the origin group override configuration. public partial class OriginGroupOverride { - /// Initializes a new instance of OriginGroupOverride. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OriginGroupOverride() { } - /// Initializes a new instance of OriginGroupOverride. + /// Initializes a new instance of . /// defines the OriginGroup that would override the DefaultOriginGroup on route. /// Protocol this rule will use when forwarding traffic to backends. - internal OriginGroupOverride(WritableSubResource originGroup, ForwardingProtocol? forwardingProtocol) + /// Keeps track of any properties unknown to the library. + internal OriginGroupOverride(WritableSubResource originGroup, ForwardingProtocol? forwardingProtocol, Dictionary serializedAdditionalRawData) { OriginGroup = originGroup; ForwardingProtocol = forwardingProtocol; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// defines the OriginGroup that would override the DefaultOriginGroup on route. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.Serialization.cs index f2c0504a5d61..c2dff188b0ec 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class OriginGroupOverrideAction : IUtf8JsonSerializable + public partial class OriginGroupOverrideAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OriginGroupOverrideAction DeserializeOriginGroupOverrideAction(JsonElement element) + internal static OriginGroupOverrideAction DeserializeOriginGroupOverrideAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } OriginGroupOverrideActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static OriginGroupOverrideAction DeserializeOriginGroupOverrideAction(J name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OriginGroupOverrideAction(name, parameters, serializedAdditionalRawData); + } + + OriginGroupOverrideAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOriginGroupOverrideAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OriginGroupOverrideAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOriginGroupOverrideAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OriginGroupOverrideAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OriginGroupOverrideAction(Response response) + { + if (response is null) + { + return null; } - return new OriginGroupOverrideAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOriginGroupOverrideAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.cs index 14c7fdfac4cc..916e091d86d1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the origin group override action for the delivery rule. public partial class OriginGroupOverrideAction : DeliveryRuleAction { - /// Initializes a new instance of OriginGroupOverrideAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public OriginGroupOverrideAction(OriginGroupOverrideActionProperties properties) @@ -24,15 +25,21 @@ public OriginGroupOverrideAction(OriginGroupOverrideActionProperties properties) Name = DeliveryRuleActionType.OriginGroupOverride; } - /// Initializes a new instance of OriginGroupOverrideAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal OriginGroupOverrideAction(DeliveryRuleActionType name, OriginGroupOverrideActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal OriginGroupOverrideAction(DeliveryRuleActionType name, OriginGroupOverrideActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal OriginGroupOverrideAction() + { + } + /// Defines the parameters for the action. public OriginGroupOverrideActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.Serialization.cs index d9aadd3671b7..9c9a719ce60a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class OriginGroupOverrideActionProperties : IUtf8JsonSerializable + public partial class OriginGroupOverrideActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); writer.WritePropertyName("originGroup"u8); - JsonSerializer.Serialize(writer, OriginGroup); writer.WriteEndObject(); + JsonSerializer.Serialize(writer, OriginGroup); if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); } - internal static OriginGroupOverrideActionProperties DeserializeOriginGroupOverrideActionProperties(JsonElement element) + internal static OriginGroupOverrideActionProperties DeserializeOriginGroupOverrideActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } OriginGroupOverrideActionType typeName = default; WritableSubResource originGroup = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -42,8 +65,61 @@ internal static OriginGroupOverrideActionProperties DeserializeOriginGroupOverri originGroup = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OriginGroupOverrideActionProperties(typeName, originGroup, serializedAdditionalRawData); + } + + OriginGroupOverrideActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOriginGroupOverrideActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OriginGroupOverrideActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOriginGroupOverrideActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OriginGroupOverrideActionProperties model) + { + if (model is null) + { + return null; } - return new OriginGroupOverrideActionProperties(typeName, originGroup); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OriginGroupOverrideActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOriginGroupOverrideActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.cs index 429938673196..081d0689b93c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginGroupOverrideActionProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for the origin group override action. public partial class OriginGroupOverrideActionProperties { - /// Initializes a new instance of OriginGroupOverrideActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// defines the OriginGroup that would override the DefaultOriginGroup. /// is null. @@ -26,6 +30,22 @@ public OriginGroupOverrideActionProperties(OriginGroupOverrideActionType actionT OriginGroup = originGroup; } + /// Initializes a new instance of . + /// + /// defines the OriginGroup that would override the DefaultOriginGroup. + /// Keeps track of any properties unknown to the library. + internal OriginGroupOverrideActionProperties(OriginGroupOverrideActionType actionType, WritableSubResource originGroup, Dictionary serializedAdditionalRawData) + { + ActionType = actionType; + OriginGroup = originGroup; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OriginGroupOverrideActionProperties() + { + } + /// Gets or sets the action type. public OriginGroupOverrideActionType ActionType { get; set; } /// defines the OriginGroup that would override the DefaultOriginGroup. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.Serialization.cs index 192ffdd5a4ca..8d9d9cd0f8aa 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class OriginListResult + internal partial class OriginListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OriginListResult DeserializeOriginListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OriginListResult DeserializeOriginListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static OriginListResult DeserializeOriginListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OriginListResult(Optional.ToList(value), nextLink.Value); + return new OriginListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + OriginListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOriginListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OriginListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOriginListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OriginListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OriginListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOriginListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.cs index 885295eb4474..a39bb2aa6543 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/OriginListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list origins. It contains a list of origin objects and a URL link to get the next set of results. internal partial class OriginListResult { - /// Initializes a new instance of OriginListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OriginListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of OriginListResult. + /// Initializes a new instance of . /// List of CDN origins within an endpoint. /// URL to get the next set of origin objects if there are any. - internal OriginListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OriginListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN origins within an endpoint. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.Serialization.cs index 624abcad418c..f77e72ed478d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class PostArgsMatchCondition : IUtf8JsonSerializable + public partial class PostArgsMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -50,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PostArgsMatchCondition DeserializePostArgsMatchCondition(JsonElement element) + internal static PostArgsMatchCondition DeserializePostArgsMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +86,7 @@ internal static PostArgsMatchCondition DeserializePostArgsMatchCondition(JsonEle Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -119,8 +141,61 @@ internal static PostArgsMatchCondition DeserializePostArgsMatchCondition(JsonEle transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PostArgsMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + PostArgsMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePostArgsMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PostArgsMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePostArgsMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PostArgsMatchCondition model) + { + if (model is null) + { + return null; } - return new PostArgsMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PostArgsMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePostArgsMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.cs index 09392fbf2541..ff953b43a88c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PostArgsMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for PostArgs match conditions. public partial class PostArgsMatchCondition { - /// Initializes a new instance of PostArgsMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public PostArgsMatchCondition(PostArgsMatchConditionType conditionType, PostArgsOperator postArgsOperator) @@ -24,14 +28,15 @@ public PostArgsMatchCondition(PostArgsMatchConditionType conditionType, PostArgs Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of PostArgsMatchCondition. + /// Initializes a new instance of . /// /// Name of PostArg to be matched. /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal PostArgsMatchCondition(PostArgsMatchConditionType conditionType, string selector, PostArgsOperator postArgsOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal PostArgsMatchCondition(PostArgsMatchConditionType conditionType, string selector, PostArgsOperator postArgsOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; Selector = selector; @@ -39,6 +44,12 @@ internal PostArgsMatchCondition(PostArgsMatchConditionType conditionType, string NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PostArgsMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileData.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileData.Serialization.cs index 1667f81f2b48..08ce89c2fdd4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileData.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileData.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Cdn { - public partial class ProfileData : IUtf8JsonSerializable + public partial class ProfileData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -49,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProfileData DeserializeProfileData(JsonElement element) + internal static ProfileData DeserializeProfileData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +97,7 @@ internal static ProfileData DeserializeProfileData(JsonElement element) Optional provisioningState = default; Optional frontDoorId = default; Optional originResponseTimeoutSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -174,8 +202,61 @@ internal static ProfileData DeserializeProfileData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProfileData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, kind.Value, Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState), Optional.ToNullable(frontDoorId), Optional.ToNullable(originResponseTimeoutSeconds), serializedAdditionalRawData); + } + + ProfileData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProfileData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProfileData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProfileData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProfileData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProfileData(Response response) + { + if (response is null) + { + return null; } - return new ProfileData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, kind.Value, Optional.ToNullable(resourceState), Optional.ToNullable(provisioningState), Optional.ToNullable(frontDoorId), Optional.ToNullable(originResponseTimeoutSeconds)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProfileData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.Serialization.cs index 18d91652fbac..6dfb66c65a32 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class ProfileListResult + internal partial class ProfileListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ProfileListResult DeserializeProfileListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ProfileListResult DeserializeProfileListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static ProfileListResult DeserializeProfileListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ProfileListResult(Optional.ToList(value), nextLink.Value); + return new ProfileListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ProfileListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProfileListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProfileListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProfileListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProfileListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProfileListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProfileListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.cs index 5b288c7cd131..41d55067edd6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list profiles. It contains a list of profile objects and a URL link to get the next set of results. internal partial class ProfileListResult { - /// Initializes a new instance of ProfileListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ProfileListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ProfileListResult. + /// Initializes a new instance of . /// List of CDN profiles within a resource group. /// URL to get the next set of profile objects if there are any. - internal ProfileListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ProfileListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CDN profiles within a resource group. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.Serialization.cs index c70a31219354..9b21f50f85d4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ProfilePatch : IUtf8JsonSerializable + public partial class ProfilePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(OriginResponseTimeoutSeconds.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ProfilePatch DeserializeProfilePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional originResponseTimeoutSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("originResponseTimeoutSeconds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + originResponseTimeoutSeconds = property0.Value.GetInt32(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProfilePatch(Optional.ToDictionary(tags), Optional.ToNullable(originResponseTimeoutSeconds), serializedAdditionalRawData); + } + + ProfilePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProfilePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProfilePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProfilePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProfilePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProfilePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProfilePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.cs index 6a34f2a7440b..442b4f0bcdb7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfilePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.Cdn.Models /// Properties required to update a profile. public partial class ProfilePatch { - /// Initializes a new instance of ProfilePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProfilePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Profile tags. + /// Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. + /// Keeps track of any properties unknown to the library. + internal ProfilePatch(IDictionary tags, int? originResponseTimeoutSeconds, Dictionary serializedAdditionalRawData) + { + Tags = tags; + OriginResponseTimeoutSeconds = originResponseTimeoutSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Profile tags. public IDictionary Tags { get; } /// Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsMetricsOptions.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsMetricsOptions.cs index cdf8749ae537..46ea5c565c22 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsMetricsOptions.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsMetricsOptions.cs @@ -40,6 +40,11 @@ public ProfileResourceGetLogAnalyticsMetricsOptions(IEnumerable metri CountryOrRegions = new ChangeTrackingList(); } + /// Initializes a new instance of for deserialization. + internal ProfileResourceGetLogAnalyticsMetricsOptions() + { + } + /// The ArrayOfLogMetric to use. public IList Metrics { get; } /// The DateTime to use. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsRankingsOptions.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsRankingsOptions.cs index a07d6d06cc1d..832bc104fac8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsRankingsOptions.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetLogAnalyticsRankingsOptions.cs @@ -35,6 +35,11 @@ public ProfileResourceGetLogAnalyticsRankingsOptions(IEnumerable ran CustomDomains = new ChangeTrackingList(); } + /// Initializes a new instance of for deserialization. + internal ProfileResourceGetLogAnalyticsRankingsOptions() + { + } + /// The ArrayOfLogRanking to use. public IList Rankings { get; } /// The ArrayOfLogRankingMetric to use. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsMetricsOptions.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsMetricsOptions.cs index ce43ee2b1bce..3c56d2165945 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsMetricsOptions.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsMetricsOptions.cs @@ -34,6 +34,11 @@ public ProfileResourceGetWafLogAnalyticsMetricsOptions(IEnumerable me RuleTypes = new ChangeTrackingList(); } + /// Initializes a new instance of for deserialization. + internal ProfileResourceGetWafLogAnalyticsMetricsOptions() + { + } + /// The ArrayOfWafMetric to use. public IList Metrics { get; } /// The DateTime to use. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsRankingsOptions.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsRankingsOptions.cs index 942825add56c..024854e0b747 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsRankingsOptions.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ProfileResourceGetWafLogAnalyticsRankingsOptions.cs @@ -36,6 +36,11 @@ public ProfileResourceGetWafLogAnalyticsRankingsOptions(IEnumerable m RuleTypes = new ChangeTrackingList(); } + /// Initializes a new instance of for deserialization. + internal ProfileResourceGetWafLogAnalyticsRankingsOptions() + { + } + /// The ArrayOfWafMetric to use. public IList Metrics { get; } /// The DateTime to use. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.Serialization.cs index 171bd4ea3400..f6c64ccc6629 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class PurgeContent : IUtf8JsonSerializable + public partial class PurgeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contentPaths"u8); writer.WriteStartArray(); @@ -22,7 +30,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PurgeContent DeserializePurgeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList contentPaths = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contentPaths"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contentPaths = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PurgeContent(contentPaths, serializedAdditionalRawData); + } + + PurgeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePurgeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PurgeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePurgeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PurgeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PurgeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePurgeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.cs index d70fdf500ecc..bae1f0a92f5f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/PurgeContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Parameters required for content purge. public partial class PurgeContent { - /// Initializes a new instance of PurgeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The path to the content to be purged. Can describe a file path or a wild card directory. /// is null. public PurgeContent(IEnumerable contentPaths) @@ -25,6 +28,20 @@ public PurgeContent(IEnumerable contentPaths) ContentPaths = contentPaths.ToList(); } + /// Initializes a new instance of . + /// The path to the content to be purged. Can describe a file path or a wild card directory. + /// Keeps track of any properties unknown to the library. + internal PurgeContent(IList contentPaths, Dictionary serializedAdditionalRawData) + { + ContentPaths = contentPaths; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PurgeContent() + { + } + /// The path to the content to be purged. Can describe a file path or a wild card directory. public IList ContentPaths { get; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.Serialization.cs index f8bd936938b0..a6ce27a291a3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class QueryStringMatchCondition : IUtf8JsonSerializable + public partial class QueryStringMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static QueryStringMatchCondition DeserializeQueryStringMatchCondition(JsonElement element) + internal static QueryStringMatchCondition DeserializeQueryStringMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static QueryStringMatchCondition DeserializeQueryStringMatchCondition(J Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static QueryStringMatchCondition DeserializeQueryStringMatchCondition(J transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryStringMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + QueryStringMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryStringMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryStringMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryStringMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryStringMatchCondition model) + { + if (model is null) + { + return null; } - return new QueryStringMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryStringMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryStringMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.cs index 9fee1d9070be..f7ad082eadab 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/QueryStringMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for QueryString match conditions. public partial class QueryStringMatchCondition { - /// Initializes a new instance of QueryStringMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public QueryStringMatchCondition(QueryStringMatchConditionType conditionType, QueryStringOperator queryStringOperator) @@ -24,19 +28,26 @@ public QueryStringMatchCondition(QueryStringMatchConditionType conditionType, Qu Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of QueryStringMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal QueryStringMatchCondition(QueryStringMatchConditionType conditionType, QueryStringOperator queryStringOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal QueryStringMatchCondition(QueryStringMatchConditionType conditionType, QueryStringOperator queryStringOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; QueryStringOperator = queryStringOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueryStringMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.Serialization.cs index fe47452a7b7f..2a5f954fae2e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.Serialization.cs @@ -8,14 +8,67 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RankingsResponse + public partial class RankingsResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RankingsResponse DeserializeRankingsResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DateTimeBegin)) + { + writer.WritePropertyName("dateTimeBegin"u8); + writer.WriteStringValue(DateTimeBegin.Value, "O"); + } + if (Optional.IsDefined(DateTimeEnd)) + { + writer.WritePropertyName("dateTimeEnd"u8); + writer.WriteStringValue(DateTimeEnd.Value, "O"); + } + if (Optional.IsCollectionDefined(Tables)) + { + writer.WritePropertyName("tables"u8); + writer.WriteStartArray(); + foreach (var item in Tables) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RankingsResponse DeserializeRankingsResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static RankingsResponse DeserializeRankingsResponse(JsonElement element Optional dateTimeBegin = default; Optional dateTimeEnd = default; Optional> tables = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dateTimeBegin"u8)) @@ -57,8 +111,61 @@ internal static RankingsResponse DeserializeRankingsResponse(JsonElement element tables = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RankingsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToList(tables)); + return new RankingsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToList(tables), serializedAdditionalRawData); + } + + RankingsResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRankingsResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RankingsResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRankingsResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RankingsResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RankingsResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRankingsResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.cs index 83a0ab12f6af..9bd071af5245 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponse.cs @@ -14,21 +14,26 @@ namespace Azure.ResourceManager.Cdn.Models /// Rankings Response. public partial class RankingsResponse { - /// Initializes a new instance of RankingsResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RankingsResponse() { Tables = new ChangeTrackingList(); } - /// Initializes a new instance of RankingsResponse. + /// Initializes a new instance of . /// /// /// - internal RankingsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, IReadOnlyList tables) + /// Keeps track of any properties unknown to the library. + internal RankingsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, IReadOnlyList tables, Dictionary serializedAdditionalRawData) { DateTimeBegin = dateTimeBegin; DateTimeEnd = dateTimeEnd; Tables = tables; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the date time begin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.Serialization.cs index a3ea11d6e908..532d9d33032d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RankingsResponseTablesItem + public partial class RankingsResponseTablesItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RankingsResponseTablesItem DeserializeRankingsResponseTablesItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Ranking)) + { + writer.WritePropertyName("ranking"u8); + writer.WriteStringValue(Ranking); + } + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RankingsResponseTablesItem DeserializeRankingsResponseTablesItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ranking = default; Optional> data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ranking"u8)) @@ -42,8 +92,61 @@ internal static RankingsResponseTablesItem DeserializeRankingsResponseTablesItem data = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RankingsResponseTablesItem(ranking.Value, Optional.ToList(data)); + return new RankingsResponseTablesItem(ranking.Value, Optional.ToList(data), serializedAdditionalRawData); + } + + RankingsResponseTablesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRankingsResponseTablesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RankingsResponseTablesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRankingsResponseTablesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RankingsResponseTablesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RankingsResponseTablesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRankingsResponseTablesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.cs index 92fb2d8d03a5..da4d530d63db 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// The RankingsResponseTablesItem. public partial class RankingsResponseTablesItem { - /// Initializes a new instance of RankingsResponseTablesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RankingsResponseTablesItem() { Data = new ChangeTrackingList(); } - /// Initializes a new instance of RankingsResponseTablesItem. + /// Initializes a new instance of . /// /// - internal RankingsResponseTablesItem(string ranking, IReadOnlyList data) + /// Keeps track of any properties unknown to the library. + internal RankingsResponseTablesItem(string ranking, IReadOnlyList data, Dictionary serializedAdditionalRawData) { Ranking = ranking; Data = data; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the ranking. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.Serialization.cs index 5ff912168a74..7e309bf2e833 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RankingsResponseTablesPropertiesItemsItem + public partial class RankingsResponseTablesPropertiesItemsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RankingsResponseTablesPropertiesItemsItem DeserializeRankingsResponseTablesPropertiesItemsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RankingsResponseTablesPropertiesItemsItem DeserializeRankingsResponseTablesPropertiesItemsItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional> metrics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +92,61 @@ internal static RankingsResponseTablesPropertiesItemsItem DeserializeRankingsRes metrics = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RankingsResponseTablesPropertiesItemsItem(name.Value, Optional.ToList(metrics)); + return new RankingsResponseTablesPropertiesItemsItem(name.Value, Optional.ToList(metrics), serializedAdditionalRawData); + } + + RankingsResponseTablesPropertiesItemsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRankingsResponseTablesPropertiesItemsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RankingsResponseTablesPropertiesItemsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRankingsResponseTablesPropertiesItemsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RankingsResponseTablesPropertiesItemsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RankingsResponseTablesPropertiesItemsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRankingsResponseTablesPropertiesItemsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.cs index 0365e3776c0d..118567d69930 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// The RankingsResponseTablesPropertiesItemsItem. public partial class RankingsResponseTablesPropertiesItemsItem { - /// Initializes a new instance of RankingsResponseTablesPropertiesItemsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RankingsResponseTablesPropertiesItemsItem() { Metrics = new ChangeTrackingList(); } - /// Initializes a new instance of RankingsResponseTablesPropertiesItemsItem. + /// Initializes a new instance of . /// /// - internal RankingsResponseTablesPropertiesItemsItem(string name, IReadOnlyList metrics) + /// Keeps track of any properties unknown to the library. + internal RankingsResponseTablesPropertiesItemsItem(string name, IReadOnlyList metrics, Dictionary serializedAdditionalRawData) { Name = name; Metrics = metrics; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the name. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.Serialization.cs index 9fec969035a7..87deb06eba9e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RankingsResponseTablesPropertiesItemsMetricsItem + public partial class RankingsResponseTablesPropertiesItemsMetricsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RankingsResponseTablesPropertiesItemsMetricsItem DeserializeRankingsResponseTablesPropertiesItemsMetricsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Metric)) + { + writer.WritePropertyName("metric"u8); + writer.WriteStringValue(Metric); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsDefined(Percentage)) + { + writer.WritePropertyName("percentage"u8); + writer.WriteNumberValue(Percentage.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RankingsResponseTablesPropertiesItemsMetricsItem DeserializeRankingsResponseTablesPropertiesItemsMetricsItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static RankingsResponseTablesPropertiesItemsMetricsItem DeserializeRank Optional metric = default; Optional value = default; Optional percentage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metric"u8)) @@ -46,8 +90,61 @@ internal static RankingsResponseTablesPropertiesItemsMetricsItem DeserializeRank percentage = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RankingsResponseTablesPropertiesItemsMetricsItem(metric.Value, Optional.ToNullable(value), Optional.ToNullable(percentage)); + return new RankingsResponseTablesPropertiesItemsMetricsItem(metric.Value, Optional.ToNullable(value), Optional.ToNullable(percentage), serializedAdditionalRawData); + } + + RankingsResponseTablesPropertiesItemsMetricsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRankingsResponseTablesPropertiesItemsMetricsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RankingsResponseTablesPropertiesItemsMetricsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRankingsResponseTablesPropertiesItemsMetricsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RankingsResponseTablesPropertiesItemsMetricsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RankingsResponseTablesPropertiesItemsMetricsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRankingsResponseTablesPropertiesItemsMetricsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.cs index 77dee7083edf..040400f8b340 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RankingsResponseTablesPropertiesItemsMetricsItem.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The RankingsResponseTablesPropertiesItemsMetricsItem. public partial class RankingsResponseTablesPropertiesItemsMetricsItem { - /// Initializes a new instance of RankingsResponseTablesPropertiesItemsMetricsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RankingsResponseTablesPropertiesItemsMetricsItem() { } - /// Initializes a new instance of RankingsResponseTablesPropertiesItemsMetricsItem. + /// Initializes a new instance of . /// /// /// - internal RankingsResponseTablesPropertiesItemsMetricsItem(string metric, long? value, float? percentage) + /// Keeps track of any properties unknown to the library. + internal RankingsResponseTablesPropertiesItemsMetricsItem(string metric, long? value, float? percentage, Dictionary serializedAdditionalRawData) { Metric = metric; Value = value; Percentage = percentage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the metric. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.Serialization.cs index 2b8714d9a5d5..566ab293e790 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RateLimitRule : IUtf8JsonSerializable + public partial class RateLimitRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("rateLimitThreshold"u8); writer.WriteNumberValue(RateLimitThreshold); @@ -33,16 +40,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MatchConditions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RateLimitRule DeserializeRateLimitRule(JsonElement element) + internal static RateLimitRule DeserializeRateLimitRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static RateLimitRule DeserializeRateLimitRule(JsonElement element) int priority = default; IList matchConditions = default; OverrideActionType action = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rateLimitThreshold"u8)) @@ -100,8 +129,61 @@ internal static RateLimitRule DeserializeRateLimitRule(JsonElement element) action = new OverrideActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RateLimitRule(name, Optional.ToNullable(enabledState), priority, matchConditions, action, rateLimitThreshold, rateLimitDurationInMinutes, serializedAdditionalRawData); + } + + RateLimitRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRateLimitRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RateLimitRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRateLimitRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RateLimitRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RateLimitRule(Response response) + { + if (response is null) + { + return null; } - return new RateLimitRule(name, Optional.ToNullable(enabledState), priority, matchConditions, action, rateLimitThreshold, rateLimitDurationInMinutes); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRateLimitRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.cs index 2bfc32fc06c4..15166439e24f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRule.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines a rate limiting rule that can be included in a waf policy. public partial class RateLimitRule : CustomRule { - /// Initializes a new instance of RateLimitRule. + /// Initializes a new instance of . /// Defines the name of the custom rule. /// Defines in what order this rule be evaluated in the overall list of custom rules. /// List of match conditions. @@ -31,7 +31,7 @@ public RateLimitRule(string name, int priority, IEnumerable Initializes a new instance of RateLimitRule. + /// Initializes a new instance of . /// Defines the name of the custom rule. /// Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified. /// Defines in what order this rule be evaluated in the overall list of custom rules. @@ -39,12 +39,18 @@ public RateLimitRule(string name, int priority, IEnumerable Describes what action to be applied when rule matches. /// Defines rate limit threshold. /// Defines rate limit duration. Default is 1 minute. - internal RateLimitRule(string name, CustomRuleEnabledState? enabledState, int priority, IList matchConditions, OverrideActionType action, int rateLimitThreshold, int rateLimitDurationInMinutes) : base(name, enabledState, priority, matchConditions, action) + /// Keeps track of any properties unknown to the library. + internal RateLimitRule(string name, CustomRuleEnabledState? enabledState, int priority, IList matchConditions, OverrideActionType action, int rateLimitThreshold, int rateLimitDurationInMinutes, Dictionary serializedAdditionalRawData) : base(name, enabledState, priority, matchConditions, action, serializedAdditionalRawData) { RateLimitThreshold = rateLimitThreshold; RateLimitDurationInMinutes = rateLimitDurationInMinutes; } + /// Initializes a new instance of for deserialization. + internal RateLimitRule() + { + } + /// Defines rate limit threshold. public int RateLimitThreshold { get; set; } /// Defines rate limit duration. Default is 1 minute. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.Serialization.cs index d5d51bf4ea72..c0dd103dfa83 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class RateLimitRuleList : IUtf8JsonSerializable + internal partial class RateLimitRuleList : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Rules)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RateLimitRuleList DeserializeRateLimitRuleList(JsonElement element) + internal static RateLimitRuleList DeserializeRateLimitRuleList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rules"u8)) @@ -52,8 +81,61 @@ internal static RateLimitRuleList DeserializeRateLimitRuleList(JsonElement eleme rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RateLimitRuleList(Optional.ToList(rules), serializedAdditionalRawData); + } + + RateLimitRuleList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRateLimitRuleList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RateLimitRuleList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRateLimitRuleList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RateLimitRuleList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RateLimitRuleList(Response response) + { + if (response is null) + { + return null; } - return new RateLimitRuleList(Optional.ToList(rules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRateLimitRuleList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.cs index 0fd91124ea4f..142b6f2dd685 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RateLimitRuleList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines contents of rate limit rules. internal partial class RateLimitRuleList { - /// Initializes a new instance of RateLimitRuleList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RateLimitRuleList() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of RateLimitRuleList. + /// Initializes a new instance of . /// List of rules. - internal RateLimitRuleList(IList rules) + /// Keeps track of any properties unknown to the library. + internal RateLimitRuleList(IList rules, Dictionary serializedAdditionalRawData) { Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of rules. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.Serialization.cs index 6e6a2e73bcf8..a1187fdedf83 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RemoteAddressMatchCondition : IUtf8JsonSerializable + public partial class RemoteAddressMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RemoteAddressMatchCondition DeserializeRemoteAddressMatchCondition(JsonElement element) + internal static RemoteAddressMatchCondition DeserializeRemoteAddressMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static RemoteAddressMatchCondition DeserializeRemoteAddressMatchConditi Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static RemoteAddressMatchCondition DeserializeRemoteAddressMatchConditi transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RemoteAddressMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + RemoteAddressMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoteAddressMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoteAddressMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoteAddressMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoteAddressMatchCondition model) + { + if (model is null) + { + return null; } - return new RemoteAddressMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoteAddressMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoteAddressMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.cs index 35e296659f9d..f995c672da8f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RemoteAddressMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for RemoteAddress match conditions. public partial class RemoteAddressMatchCondition { - /// Initializes a new instance of RemoteAddressMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public RemoteAddressMatchCondition(RemoteAddressMatchConditionType conditionType, RemoteAddressOperator remoteAddressOperator) @@ -24,19 +28,26 @@ public RemoteAddressMatchCondition(RemoteAddressMatchConditionType conditionType Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of RemoteAddressMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. /// List of transforms. - internal RemoteAddressMatchCondition(RemoteAddressMatchConditionType conditionType, RemoteAddressOperator remoteAddressOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal RemoteAddressMatchCondition(RemoteAddressMatchConditionType conditionType, RemoteAddressOperator remoteAddressOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; RemoteAddressOperator = remoteAddressOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RemoteAddressMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.Serialization.cs index 2d55112cf19a..073af1d1944e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RequestBodyMatchCondition : IUtf8JsonSerializable + public partial class RequestBodyMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RequestBodyMatchCondition DeserializeRequestBodyMatchCondition(JsonElement element) + internal static RequestBodyMatchCondition DeserializeRequestBodyMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static RequestBodyMatchCondition DeserializeRequestBodyMatchCondition(J Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static RequestBodyMatchCondition DeserializeRequestBodyMatchCondition(J transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestBodyMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + RequestBodyMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestBodyMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestBodyMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestBodyMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestBodyMatchCondition model) + { + if (model is null) + { + return null; } - return new RequestBodyMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestBodyMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestBodyMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.cs index c8a1b6d1ae81..7377744ec82c 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestBodyMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for RequestBody match conditions. public partial class RequestBodyMatchCondition { - /// Initializes a new instance of RequestBodyMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public RequestBodyMatchCondition(RequestBodyMatchConditionType conditionType, RequestBodyOperator requestBodyOperator) @@ -24,19 +28,26 @@ public RequestBodyMatchCondition(RequestBodyMatchConditionType conditionType, Re Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of RequestBodyMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal RequestBodyMatchCondition(RequestBodyMatchConditionType conditionType, RequestBodyOperator requestBodyOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal RequestBodyMatchCondition(RequestBodyMatchConditionType conditionType, RequestBodyOperator requestBodyOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; RequestBodyOperator = requestBodyOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestBodyMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.Serialization.cs index c91428de5fe5..03bb49fd1b05 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RequestHeaderMatchCondition : IUtf8JsonSerializable + public partial class RequestHeaderMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -50,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RequestHeaderMatchCondition DeserializeRequestHeaderMatchCondition(JsonElement element) + internal static RequestHeaderMatchCondition DeserializeRequestHeaderMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +86,7 @@ internal static RequestHeaderMatchCondition DeserializeRequestHeaderMatchConditi Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -119,8 +141,61 @@ internal static RequestHeaderMatchCondition DeserializeRequestHeaderMatchConditi transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestHeaderMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + RequestHeaderMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestHeaderMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestHeaderMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestHeaderMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestHeaderMatchCondition model) + { + if (model is null) + { + return null; } - return new RequestHeaderMatchCondition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestHeaderMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestHeaderMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.cs index 7bddac50c4c8..fe94b6186c40 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestHeaderMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for RequestHeader match conditions. public partial class RequestHeaderMatchCondition { - /// Initializes a new instance of RequestHeaderMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public RequestHeaderMatchCondition(RequestHeaderMatchConditionType conditionType, RequestHeaderOperator requestHeaderOperator) @@ -24,14 +28,15 @@ public RequestHeaderMatchCondition(RequestHeaderMatchConditionType conditionType Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of RequestHeaderMatchCondition. + /// Initializes a new instance of . /// /// Name of Header to be matched. /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal RequestHeaderMatchCondition(RequestHeaderMatchConditionType conditionType, string selector, RequestHeaderOperator requestHeaderOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal RequestHeaderMatchCondition(RequestHeaderMatchConditionType conditionType, string selector, RequestHeaderOperator requestHeaderOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; Selector = selector; @@ -39,6 +44,12 @@ internal RequestHeaderMatchCondition(RequestHeaderMatchConditionType conditionTy NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestHeaderMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.Serialization.cs index 16ac54d5aed9..4fdd516c7a68 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RequestMethodMatchCondition : IUtf8JsonSerializable + public partial class RequestMethodMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RequestMethodMatchCondition DeserializeRequestMethodMatchCondition(JsonElement element) + internal static RequestMethodMatchCondition DeserializeRequestMethodMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static RequestMethodMatchCondition DeserializeRequestMethodMatchConditi Optional negateCondition = default; Optional> transforms = default; Optional> matchValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static RequestMethodMatchCondition DeserializeRequestMethodMatchConditi matchValues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestMethodMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(transforms), Optional.ToList(matchValues), serializedAdditionalRawData); + } + + RequestMethodMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestMethodMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestMethodMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestMethodMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestMethodMatchCondition model) + { + if (model is null) + { + return null; } - return new RequestMethodMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(transforms), Optional.ToList(matchValues)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestMethodMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestMethodMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.cs index 397fa2ee14b6..e570d0e8a14f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestMethodMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for RequestMethod match conditions. public partial class RequestMethodMatchCondition { - /// Initializes a new instance of RequestMethodMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public RequestMethodMatchCondition(RequestMethodMatchConditionType conditionType, RequestMethodOperator requestMethodOperator) @@ -24,19 +28,26 @@ public RequestMethodMatchCondition(RequestMethodMatchConditionType conditionType MatchValues = new ChangeTrackingList(); } - /// Initializes a new instance of RequestMethodMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// List of transforms. /// The match value for the condition of the delivery rule. - internal RequestMethodMatchCondition(RequestMethodMatchConditionType conditionType, RequestMethodOperator requestMethodOperator, bool? negateCondition, IList transforms, IList matchValues) + /// Keeps track of any properties unknown to the library. + internal RequestMethodMatchCondition(RequestMethodMatchConditionType conditionType, RequestMethodOperator requestMethodOperator, bool? negateCondition, IList transforms, IList matchValues, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; RequestMethodOperator = requestMethodOperator; NegateCondition = negateCondition; Transforms = transforms; MatchValues = matchValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestMethodMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.Serialization.cs index fb5c44a3d2b5..794e33181554 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RequestSchemeMatchCondition : IUtf8JsonSerializable + public partial class RequestSchemeMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RequestSchemeMatchCondition DeserializeRequestSchemeMatchCondition(JsonElement element) + internal static RequestSchemeMatchCondition DeserializeRequestSchemeMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static RequestSchemeMatchCondition DeserializeRequestSchemeMatchConditi Optional negateCondition = default; Optional> transforms = default; Optional> matchValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static RequestSchemeMatchCondition DeserializeRequestSchemeMatchConditi matchValues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestSchemeMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(transforms), Optional.ToList(matchValues), serializedAdditionalRawData); + } + + RequestSchemeMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestSchemeMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestSchemeMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestSchemeMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestSchemeMatchCondition model) + { + if (model is null) + { + return null; } - return new RequestSchemeMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(transforms), Optional.ToList(matchValues)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestSchemeMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestSchemeMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.cs index d66748e4aa88..e9418f273649 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestSchemeMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for RequestScheme match conditions. public partial class RequestSchemeMatchCondition { - /// Initializes a new instance of RequestSchemeMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public RequestSchemeMatchCondition(RequestSchemeMatchConditionType conditionType, RequestSchemeOperator requestSchemeOperator) @@ -24,19 +28,26 @@ public RequestSchemeMatchCondition(RequestSchemeMatchConditionType conditionType MatchValues = new ChangeTrackingList(); } - /// Initializes a new instance of RequestSchemeMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// List of transforms. /// The match value for the condition of the delivery rule. - internal RequestSchemeMatchCondition(RequestSchemeMatchConditionType conditionType, RequestSchemeOperator requestSchemeOperator, bool? negateCondition, IList transforms, IList matchValues) + /// Keeps track of any properties unknown to the library. + internal RequestSchemeMatchCondition(RequestSchemeMatchConditionType conditionType, RequestSchemeOperator requestSchemeOperator, bool? negateCondition, IList transforms, IList matchValues, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; RequestSchemeOperator = requestSchemeOperator; NegateCondition = negateCondition; Transforms = transforms; MatchValues = matchValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestSchemeMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.Serialization.cs index a377e26d54cd..76d58105460b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RequestUriMatchCondition : IUtf8JsonSerializable + public partial class RequestUriMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RequestUriMatchCondition DeserializeRequestUriMatchCondition(JsonElement element) + internal static RequestUriMatchCondition DeserializeRequestUriMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static RequestUriMatchCondition DeserializeRequestUriMatchCondition(Jso Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static RequestUriMatchCondition DeserializeRequestUriMatchCondition(Jso transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestUriMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + RequestUriMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestUriMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestUriMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestUriMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestUriMatchCondition model) + { + if (model is null) + { + return null; } - return new RequestUriMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestUriMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestUriMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.cs index 74718d650dbb..5264617999a1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RequestUriMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for RequestUri match conditions. public partial class RequestUriMatchCondition { - /// Initializes a new instance of RequestUriMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public RequestUriMatchCondition(RequestUriMatchConditionType conditionType, RequestUriOperator requestUriOperator) @@ -24,19 +28,26 @@ public RequestUriMatchCondition(RequestUriMatchConditionType conditionType, Requ Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of RequestUriMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal RequestUriMatchCondition(RequestUriMatchConditionType conditionType, RequestUriOperator requestUriOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal RequestUriMatchCondition(RequestUriMatchConditionType conditionType, RequestUriOperator requestUriOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; RequestUriOperator = requestUriOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestUriMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.Serialization.cs index 74f6ec7df395..d41895cdc124 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class ResourceUsageListResult + internal partial class ResourceUsageListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceUsageListResult DeserializeResourceUsageListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceUsageListResult DeserializeResourceUsageListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +75,61 @@ internal static ResourceUsageListResult DeserializeResourceUsageListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceUsageListResult(Optional.ToList(value), nextLink.Value); + return new ResourceUsageListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ResourceUsageListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceUsageListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceUsageListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceUsageListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceUsageListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceUsageListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceUsageListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.cs index ad4366b7abcf..b18a45d891eb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourceUsageListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Output of check resource usage API. internal partial class ResourceUsageListResult { - /// Initializes a new instance of ResourceUsageListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceUsageListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ResourceUsageListResult. + /// Initializes a new instance of . /// List of resource usages. /// URL to get the next set of custom domain objects if there are any. - internal ResourceUsageListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ResourceUsageListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of resource usages. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.Serialization.cs index 219f82a64d21..5f112c3809cc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.Serialization.cs @@ -5,22 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ResourcesResponse + public partial class ResourcesResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourcesResponse DeserializeResourcesResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Endpoints)) + { + writer.WritePropertyName("endpoints"u8); + writer.WriteStartArray(); + foreach (var item in Endpoints) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CustomDomains)) + { + writer.WritePropertyName("customDomains"u8); + writer.WriteStartArray(); + foreach (var item in CustomDomains) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourcesResponse DeserializeResourcesResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> endpoints = default; Optional> customDomains = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endpoints"u8)) @@ -51,8 +113,61 @@ internal static ResourcesResponse DeserializeResourcesResponse(JsonElement eleme customDomains = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourcesResponse(Optional.ToList(endpoints), Optional.ToList(customDomains)); + return new ResourcesResponse(Optional.ToList(endpoints), Optional.ToList(customDomains), serializedAdditionalRawData); + } + + ResourcesResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcesResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcesResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcesResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcesResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcesResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcesResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.cs index f4547d7875d3..1df3d0514b97 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Cdn.Models /// Resources Response. public partial class ResourcesResponse { - /// Initializes a new instance of ResourcesResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourcesResponse() { Endpoints = new ChangeTrackingList(); CustomDomains = new ChangeTrackingList(); } - /// Initializes a new instance of ResourcesResponse. + /// Initializes a new instance of . /// /// - internal ResourcesResponse(IReadOnlyList endpoints, IReadOnlyList customDomains) + /// Keeps track of any properties unknown to the library. + internal ResourcesResponse(IReadOnlyList endpoints, IReadOnlyList customDomains, Dictionary serializedAdditionalRawData) { Endpoints = endpoints; CustomDomains = customDomains; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the endpoints. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.Serialization.cs index 44e6634372ed..d043471d4fec 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ResourcesResponseCustomDomainsItem + public partial class ResourcesResponseCustomDomainsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourcesResponseCustomDomainsItem DeserializeResourcesResponseCustomDomainsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(EndpointId)) + { + writer.WritePropertyName("endpointId"u8); + writer.WriteStringValue(EndpointId); + } + if (Optional.IsDefined(History)) + { + writer.WritePropertyName("history"u8); + writer.WriteBooleanValue(History.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourcesResponseCustomDomainsItem DeserializeResourcesResponseCustomDomainsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static ResourcesResponseCustomDomainsItem DeserializeResourcesResponseC Optional name = default; Optional endpointId = default; Optional history = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -48,8 +97,61 @@ internal static ResourcesResponseCustomDomainsItem DeserializeResourcesResponseC history = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourcesResponseCustomDomainsItem(id.Value, name.Value, endpointId.Value, Optional.ToNullable(history)); + return new ResourcesResponseCustomDomainsItem(id.Value, name.Value, endpointId.Value, Optional.ToNullable(history), serializedAdditionalRawData); + } + + ResourcesResponseCustomDomainsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcesResponseCustomDomainsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcesResponseCustomDomainsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcesResponseCustomDomainsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcesResponseCustomDomainsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcesResponseCustomDomainsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcesResponseCustomDomainsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.cs index b2640d26b928..9c2101fced17 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseCustomDomainsItem.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The ResourcesResponseCustomDomainsItem. public partial class ResourcesResponseCustomDomainsItem { - /// Initializes a new instance of ResourcesResponseCustomDomainsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourcesResponseCustomDomainsItem() { } - /// Initializes a new instance of ResourcesResponseCustomDomainsItem. + /// Initializes a new instance of . /// /// /// /// - internal ResourcesResponseCustomDomainsItem(string id, string name, string endpointId, bool? history) + /// Keeps track of any properties unknown to the library. + internal ResourcesResponseCustomDomainsItem(string id, string name, string endpointId, bool? history, Dictionary serializedAdditionalRawData) { Id = id; Name = name; EndpointId = endpointId; History = history; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the id. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.Serialization.cs index f2a4d9028498..93c8f5b377bb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ResourcesResponseEndpointsItem + public partial class ResourcesResponseEndpointsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourcesResponseEndpointsItem DeserializeResourcesResponseEndpointsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(History)) + { + writer.WritePropertyName("history"u8); + writer.WriteBooleanValue(History.Value); + } + if (Optional.IsCollectionDefined(CustomDomains)) + { + writer.WritePropertyName("customDomains"u8); + writer.WriteStartArray(); + foreach (var item in CustomDomains) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourcesResponseEndpointsItem DeserializeResourcesResponseEndpointsItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +82,7 @@ internal static ResourcesResponseEndpointsItem DeserializeResourcesResponseEndpo Optional name = default; Optional history = default; Optional> customDomains = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -58,8 +118,61 @@ internal static ResourcesResponseEndpointsItem DeserializeResourcesResponseEndpo customDomains = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourcesResponseEndpointsItem(id.Value, name.Value, Optional.ToNullable(history), Optional.ToList(customDomains)); + return new ResourcesResponseEndpointsItem(id.Value, name.Value, Optional.ToNullable(history), Optional.ToList(customDomains), serializedAdditionalRawData); + } + + ResourcesResponseEndpointsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcesResponseEndpointsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcesResponseEndpointsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcesResponseEndpointsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcesResponseEndpointsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcesResponseEndpointsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcesResponseEndpointsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.cs index 3d74bda00e75..b54e6341f9ec 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Cdn.Models /// The ResourcesResponseEndpointsItem. public partial class ResourcesResponseEndpointsItem { - /// Initializes a new instance of ResourcesResponseEndpointsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourcesResponseEndpointsItem() { CustomDomains = new ChangeTrackingList(); } - /// Initializes a new instance of ResourcesResponseEndpointsItem. + /// Initializes a new instance of . /// /// /// /// - internal ResourcesResponseEndpointsItem(string id, string name, bool? history, IReadOnlyList customDomains) + /// Keeps track of any properties unknown to the library. + internal ResourcesResponseEndpointsItem(string id, string name, bool? history, IReadOnlyList customDomains, Dictionary serializedAdditionalRawData) { Id = id; Name = name; History = history; CustomDomains = customDomains; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the id. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.Serialization.cs index b76b097923fa..1a43585816c0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ResourcesResponseEndpointsPropertiesItemsItem + public partial class ResourcesResponseEndpointsPropertiesItemsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourcesResponseEndpointsPropertiesItemsItem DeserializeResourcesResponseEndpointsPropertiesItemsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(EndpointId)) + { + writer.WritePropertyName("endpointId"u8); + writer.WriteStringValue(EndpointId); + } + if (Optional.IsDefined(History)) + { + writer.WritePropertyName("history"u8); + writer.WriteBooleanValue(History.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourcesResponseEndpointsPropertiesItemsItem DeserializeResourcesResponseEndpointsPropertiesItemsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static ResourcesResponseEndpointsPropertiesItemsItem DeserializeResourc Optional name = default; Optional endpointId = default; Optional history = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -48,8 +97,61 @@ internal static ResourcesResponseEndpointsPropertiesItemsItem DeserializeResourc history = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourcesResponseEndpointsPropertiesItemsItem(id.Value, name.Value, endpointId.Value, Optional.ToNullable(history)); + return new ResourcesResponseEndpointsPropertiesItemsItem(id.Value, name.Value, endpointId.Value, Optional.ToNullable(history), serializedAdditionalRawData); + } + + ResourcesResponseEndpointsPropertiesItemsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcesResponseEndpointsPropertiesItemsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcesResponseEndpointsPropertiesItemsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcesResponseEndpointsPropertiesItemsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcesResponseEndpointsPropertiesItemsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcesResponseEndpointsPropertiesItemsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcesResponseEndpointsPropertiesItemsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.cs index ed19b32d1a53..b34f9c351f8b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResourcesResponseEndpointsPropertiesItemsItem.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The ResourcesResponseEndpointsPropertiesItemsItem. public partial class ResourcesResponseEndpointsPropertiesItemsItem { - /// Initializes a new instance of ResourcesResponseEndpointsPropertiesItemsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourcesResponseEndpointsPropertiesItemsItem() { } - /// Initializes a new instance of ResourcesResponseEndpointsPropertiesItemsItem. + /// Initializes a new instance of . /// /// /// /// - internal ResourcesResponseEndpointsPropertiesItemsItem(string id, string name, string endpointId, bool? history) + /// Keeps track of any properties unknown to the library. + internal ResourcesResponseEndpointsPropertiesItemsItem(string id, string name, string endpointId, bool? history, Dictionary serializedAdditionalRawData) { Id = id; Name = name; EndpointId = endpointId; History = history; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the id. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.Serialization.cs index de05f558f143..dd98304c5367 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ResponseBasedOriginErrorDetectionSettings : IUtf8JsonSerializable + public partial class ResponseBasedOriginErrorDetectionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResponseBasedDetectedErrorType)) { @@ -32,15 +39,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HttpErrorRanges) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResponseBasedOriginErrorDetectionSettings DeserializeResponseBasedOriginErrorDetectionSettings(JsonElement element) + internal static ResponseBasedOriginErrorDetectionSettings DeserializeResponseBasedOriginErrorDetectionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static ResponseBasedOriginErrorDetectionSettings DeserializeResponseBas Optional responseBasedDetectedErrorTypes = default; Optional responseBasedFailoverThresholdPercentage = default; Optional> httpErrorRanges = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("responseBasedDetectedErrorTypes"u8)) @@ -82,8 +111,61 @@ internal static ResponseBasedOriginErrorDetectionSettings DeserializeResponseBas httpErrorRanges = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResponseBasedOriginErrorDetectionSettings(Optional.ToNullable(responseBasedDetectedErrorTypes), Optional.ToNullable(responseBasedFailoverThresholdPercentage), Optional.ToList(httpErrorRanges), serializedAdditionalRawData); + } + + ResponseBasedOriginErrorDetectionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResponseBasedOriginErrorDetectionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResponseBasedOriginErrorDetectionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResponseBasedOriginErrorDetectionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResponseBasedOriginErrorDetectionSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResponseBasedOriginErrorDetectionSettings(Response response) + { + if (response is null) + { + return null; } - return new ResponseBasedOriginErrorDetectionSettings(Optional.ToNullable(responseBasedDetectedErrorTypes), Optional.ToNullable(responseBasedFailoverThresholdPercentage), Optional.ToList(httpErrorRanges)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResponseBasedOriginErrorDetectionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.cs index bada51e67a41..75c5eef89104 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Cdn.Models /// The JSON object that contains the properties to determine origin health using real requests/responses. public partial class ResponseBasedOriginErrorDetectionSettings { - /// Initializes a new instance of ResponseBasedOriginErrorDetectionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResponseBasedOriginErrorDetectionSettings() { HttpErrorRanges = new ChangeTrackingList(); } - /// Initializes a new instance of ResponseBasedOriginErrorDetectionSettings. + /// Initializes a new instance of . /// Type of response errors for real user requests for which origin will be deemed unhealthy. /// The percentage of failed requests in the sample where failover should trigger. /// The list of Http status code ranges that are considered as server errors for origin and it is marked as unhealthy. - internal ResponseBasedOriginErrorDetectionSettings(ResponseBasedDetectedErrorType? responseBasedDetectedErrorType, int? responseBasedFailoverThresholdPercentage, IList httpErrorRanges) + /// Keeps track of any properties unknown to the library. + internal ResponseBasedOriginErrorDetectionSettings(ResponseBasedDetectedErrorType? responseBasedDetectedErrorType, int? responseBasedFailoverThresholdPercentage, IList httpErrorRanges, Dictionary serializedAdditionalRawData) { ResponseBasedDetectedErrorType = responseBasedDetectedErrorType; ResponseBasedFailoverThresholdPercentage = responseBasedFailoverThresholdPercentage; HttpErrorRanges = httpErrorRanges; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of response errors for real user requests for which origin will be deemed unhealthy. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.Serialization.cs index a7613c67e3a0..c3a1c310828f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RouteCacheCompressionSettings : IUtf8JsonSerializable + public partial class RouteCacheCompressionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ContentTypesToCompress)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isCompressionEnabled"u8); writer.WriteBooleanValue(IsCompressionEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RouteCacheCompressionSettings DeserializeRouteCacheCompressionSettings(JsonElement element) + internal static RouteCacheCompressionSettings DeserializeRouteCacheCompressionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> contentTypesToCompress = default; Optional isCompressionEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contentTypesToCompress"u8)) @@ -67,8 +89,61 @@ internal static RouteCacheCompressionSettings DeserializeRouteCacheCompressionSe isCompressionEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RouteCacheCompressionSettings(Optional.ToList(contentTypesToCompress), Optional.ToNullable(isCompressionEnabled), serializedAdditionalRawData); + } + + RouteCacheCompressionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouteCacheCompressionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouteCacheCompressionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouteCacheCompressionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouteCacheCompressionSettings model) + { + if (model is null) + { + return null; } - return new RouteCacheCompressionSettings(Optional.ToList(contentTypesToCompress), Optional.ToNullable(isCompressionEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouteCacheCompressionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouteCacheCompressionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.cs index f8775b42b7fa..800207c750d7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteCacheCompressionSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// settings for compression. public partial class RouteCacheCompressionSettings { - /// Initializes a new instance of RouteCacheCompressionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RouteCacheCompressionSettings() { ContentTypesToCompress = new ChangeTrackingList(); } - /// Initializes a new instance of RouteCacheCompressionSettings. + /// Initializes a new instance of . /// List of content types on which compression applies. The value should be a valid MIME type. /// Indicates whether content compression is enabled on AzureFrontDoor. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on AzureFrontDoor when requested content is smaller than 1 byte or larger than 1 MB. - internal RouteCacheCompressionSettings(IList contentTypesToCompress, bool? isCompressionEnabled) + /// Keeps track of any properties unknown to the library. + internal RouteCacheCompressionSettings(IList contentTypesToCompress, bool? isCompressionEnabled, Dictionary serializedAdditionalRawData) { ContentTypesToCompress = contentTypesToCompress; IsCompressionEnabled = isCompressionEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of content types on which compression applies. The value should be a valid MIME type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.Serialization.cs index 4a8015ed748b..c0e73ccb4bb0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class RouteConfigurationOverrideActionProperties : IUtf8JsonSerializable + public partial class RouteConfigurationOverrideActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -22,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (OriginGroupOverride != null) { writer.WritePropertyName("originGroupOverride"u8); - writer.WriteObjectValue(OriginGroupOverride); + if (OriginGroupOverride is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OriginGroupOverride).Serialize(writer, options); + } } else { @@ -32,13 +47,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CacheConfiguration)) { writer.WritePropertyName("cacheConfiguration"u8); - writer.WriteObjectValue(CacheConfiguration); + if (CacheConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CacheConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RouteConfigurationOverrideActionProperties DeserializeRouteConfigurationOverrideActionProperties(JsonElement element) + internal static RouteConfigurationOverrideActionProperties DeserializeRouteConfigurationOverrideActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +82,7 @@ internal static RouteConfigurationOverrideActionProperties DeserializeRouteConfi RouteConfigurationOverrideActionType typeName = default; Optional originGroupOverride = default; Optional cacheConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -72,8 +109,61 @@ internal static RouteConfigurationOverrideActionProperties DeserializeRouteConfi cacheConfiguration = CacheConfiguration.DeserializeCacheConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouteConfigurationOverrideActionProperties(typeName, originGroupOverride.Value, cacheConfiguration.Value); + return new RouteConfigurationOverrideActionProperties(typeName, originGroupOverride.Value, cacheConfiguration.Value, serializedAdditionalRawData); + } + + RouteConfigurationOverrideActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouteConfigurationOverrideActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouteConfigurationOverrideActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouteConfigurationOverrideActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouteConfigurationOverrideActionProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouteConfigurationOverrideActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouteConfigurationOverrideActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.cs index 69ca71825421..888357312499 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteConfigurationOverrideActionProperties.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Defines the parameters for the route configuration override action. public partial class RouteConfigurationOverrideActionProperties { - /// Initializes a new instance of RouteConfigurationOverrideActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// public RouteConfigurationOverrideActionProperties(RouteConfigurationOverrideActionType actionType) { ActionType = actionType; } - /// Initializes a new instance of RouteConfigurationOverrideActionProperties. + /// Initializes a new instance of . /// /// A reference to the origin group override configuration. Leave empty to use the default origin group on route. /// The caching configuration associated with this rule. To disable caching, do not provide a cacheConfiguration object. - internal RouteConfigurationOverrideActionProperties(RouteConfigurationOverrideActionType actionType, OriginGroupOverride originGroupOverride, CacheConfiguration cacheConfiguration) + /// Keeps track of any properties unknown to the library. + internal RouteConfigurationOverrideActionProperties(RouteConfigurationOverrideActionType actionType, OriginGroupOverride originGroupOverride, CacheConfiguration cacheConfiguration, Dictionary serializedAdditionalRawData) { ActionType = actionType; OriginGroupOverride = originGroupOverride; CacheConfiguration = cacheConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouteConfigurationOverrideActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.Serialization.cs index 94e2fcd468fa..70b893afb2b9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class RouteListResult + internal partial class RouteListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouteListResult DeserializeRouteListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouteListResult DeserializeRouteListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static RouteListResult DeserializeRouteListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouteListResult(Optional.ToList(value), nextLink.Value); + return new RouteListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RouteListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouteListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouteListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouteListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouteListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouteListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouteListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.cs index e15f96583d67..58882abbde1e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RouteListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list routes. It contains a list of route objects and a URL link to get the next set of results. internal partial class RouteListResult { - /// Initializes a new instance of RouteListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RouteListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RouteListResult. + /// Initializes a new instance of . /// List of AzureFrontDoor routes within a profile. /// URL to get the next set of route objects if there are any. - internal RouteListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RouteListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AzureFrontDoor routes within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.Serialization.cs index f098233bed41..97e2123b899f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class RuleListResult + internal partial class RuleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RuleListResult DeserializeRuleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RuleListResult DeserializeRuleListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static RuleListResult DeserializeRuleListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RuleListResult(Optional.ToList(value), nextLink.Value); + return new RuleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RuleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRuleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RuleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRuleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RuleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RuleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRuleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.cs index a07da1104240..fe7159e21184 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list rules. It contains a list of rule objects and a URL link to get the next set of results. internal partial class RuleListResult { - /// Initializes a new instance of RuleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RuleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RuleListResult. + /// Initializes a new instance of . /// List of AzureFrontDoor rules within a rule set. /// URL to get the next set of rule objects if there are any. - internal RuleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RuleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AzureFrontDoor rules within a rule set. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.Serialization.cs index 1560fbbcf81a..38ed2c30532a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class RuleSetListResult + internal partial class RuleSetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RuleSetListResult DeserializeRuleSetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RuleSetListResult DeserializeRuleSetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static RuleSetListResult DeserializeRuleSetListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RuleSetListResult(Optional.ToList(value), nextLink.Value); + return new RuleSetListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RuleSetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRuleSetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RuleSetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRuleSetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RuleSetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RuleSetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRuleSetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.cs index c952c5e366dc..6bdbadb117e0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/RuleSetListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list rule sets. It contains a list of rule set objects and a URL link to get the next set of results. internal partial class RuleSetListResult { - /// Initializes a new instance of RuleSetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RuleSetListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RuleSetListResult. + /// Initializes a new instance of . /// List of AzureFrontDoor rule sets within a profile. /// URL to get the next set of rule set objects if there are any. - internal RuleSetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RuleSetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AzureFrontDoor rule sets within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.Serialization.cs index d84dde6e6fde..cf8bc413e5a4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class SecretListResult + internal partial class SecretListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SecretListResult DeserializeSecretListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SecretListResult DeserializeSecretListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static SecretListResult DeserializeSecretListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SecretListResult(Optional.ToList(value), nextLink.Value); + return new SecretListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SecretListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecretListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecretListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecretListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecretListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecretListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecretListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.cs index 43222520383c..46d21e236eb8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecretListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list secrets. It contains a list of Secret objects and a URL link to get the next set of results. internal partial class SecretListResult { - /// Initializes a new instance of SecretListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SecretListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SecretListResult. + /// Initializes a new instance of . /// List of AzureFrontDoor secrets within a profile. /// URL to get the next set of Secret objects if there are any. - internal SecretListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SecretListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of AzureFrontDoor secrets within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.Serialization.cs index 3fbf657c2adb..0ee34fbc12d1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Cdn; namespace Azure.ResourceManager.Cdn.Models { - internal partial class SecurityPolicyListResult + internal partial class SecurityPolicyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SecurityPolicyListResult DeserializeSecurityPolicyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SecurityPolicyListResult DeserializeSecurityPolicyListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +76,61 @@ internal static SecurityPolicyListResult DeserializeSecurityPolicyListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SecurityPolicyListResult(Optional.ToList(value), nextLink.Value); + return new SecurityPolicyListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SecurityPolicyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityPolicyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecurityPolicyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecurityPolicyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecurityPolicyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecurityPolicyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecurityPolicyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.cs index ba4cd1c98b6e..4d0f86383eb4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Cdn; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Result of the request to list security policies. It contains a list of security policy objects and a URL link to get the next set of results. internal partial class SecurityPolicyListResult { - /// Initializes a new instance of SecurityPolicyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SecurityPolicyListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SecurityPolicyListResult. + /// Initializes a new instance of . /// List of Security policies within a profile. /// URL to get the next set of security policy objects if there is any. - internal SecurityPolicyListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SecurityPolicyListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Security policies within a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.Serialization.cs index 47e8905408dd..944652e2c373 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class SecurityPolicyProperties : IUtf8JsonSerializable + public partial class SecurityPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(PolicyType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecurityPolicyProperties DeserializeSecurityPolicyProperties(JsonElement element) + internal static SecurityPolicyProperties DeserializeSecurityPolicyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,7 +55,72 @@ internal static SecurityPolicyProperties DeserializeSecurityPolicyProperties(Jso case "WebApplicationFirewall": return SecurityPolicyWebApplicationFirewall.DeserializeSecurityPolicyWebApplicationFirewall(element); } } - return UnknownSecurityPolicyProperties.DeserializeUnknownSecurityPolicyProperties(element); + + // Unknown type found so we will deserialize the base properties only + SecurityPolicyType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new SecurityPolicyType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownSecurityPolicyProperties(type, serializedAdditionalRawData); + } + + SecurityPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecurityPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecurityPolicyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecurityPolicyProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecurityPolicyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecurityPolicyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.cs index ecbbe6272e8c..6037f3c1cb9a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyProperties.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Cdn.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.Cdn.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// + [DeserializationProxy(typeof(UnknownSecurityPolicyProperties))] public abstract partial class SecurityPolicyProperties { - /// Initializes a new instance of SecurityPolicyProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected SecurityPolicyProperties() { } - /// Initializes a new instance of SecurityPolicyProperties. + /// Initializes a new instance of . /// The type of the Security policy to create. - internal SecurityPolicyProperties(SecurityPolicyType policyType) + /// Keeps track of any properties unknown to the library. + internal SecurityPolicyProperties(SecurityPolicyType policyType, Dictionary serializedAdditionalRawData) { PolicyType = policyType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the Security policy to create. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.Serialization.cs index 35986bc43f2d..7a2c8215d61d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class SecurityPolicyWebApplicationFirewall : IUtf8JsonSerializable + public partial class SecurityPolicyWebApplicationFirewall : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WafPolicy)) { @@ -28,17 +35,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Associations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("type"u8); writer.WriteStringValue(PolicyType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecurityPolicyWebApplicationFirewall DeserializeSecurityPolicyWebApplicationFirewall(JsonElement element) + internal static SecurityPolicyWebApplicationFirewall DeserializeSecurityPolicyWebApplicationFirewall(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +74,7 @@ internal static SecurityPolicyWebApplicationFirewall DeserializeSecurityPolicyWe Optional wafPolicy = default; Optional> associations = default; SecurityPolicyType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("wafPolicy"u8)) @@ -76,8 +105,61 @@ internal static SecurityPolicyWebApplicationFirewall DeserializeSecurityPolicyWe type = new SecurityPolicyType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SecurityPolicyWebApplicationFirewall(type, wafPolicy, Optional.ToList(associations), serializedAdditionalRawData); + } + + SecurityPolicyWebApplicationFirewall IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityPolicyWebApplicationFirewall(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecurityPolicyWebApplicationFirewall IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecurityPolicyWebApplicationFirewall(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecurityPolicyWebApplicationFirewall model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecurityPolicyWebApplicationFirewall(Response response) + { + if (response is null) + { + return null; } - return new SecurityPolicyWebApplicationFirewall(type, wafPolicy, Optional.ToList(associations)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecurityPolicyWebApplicationFirewall(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.cs index 9b512f61d036..243fb1eef1b3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewall.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,18 +15,19 @@ namespace Azure.ResourceManager.Cdn.Models /// The json object containing security policy waf parameters. public partial class SecurityPolicyWebApplicationFirewall : SecurityPolicyProperties { - /// Initializes a new instance of SecurityPolicyWebApplicationFirewall. + /// Initializes a new instance of . public SecurityPolicyWebApplicationFirewall() { Associations = new ChangeTrackingList(); PolicyType = SecurityPolicyType.WebApplicationFirewall; } - /// Initializes a new instance of SecurityPolicyWebApplicationFirewall. + /// Initializes a new instance of . /// The type of the Security policy to create. /// Resource ID. /// Waf associations. - internal SecurityPolicyWebApplicationFirewall(SecurityPolicyType policyType, WritableSubResource wafPolicy, IList associations) : base(policyType) + /// Keeps track of any properties unknown to the library. + internal SecurityPolicyWebApplicationFirewall(SecurityPolicyType policyType, WritableSubResource wafPolicy, IList associations, Dictionary serializedAdditionalRawData) : base(policyType, serializedAdditionalRawData) { WafPolicy = wafPolicy; Associations = associations; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.Serialization.cs index 744df34ba623..9e2136a623af 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class SecurityPolicyWebApplicationFirewallAssociation : IUtf8JsonSerializable + public partial class SecurityPolicyWebApplicationFirewallAssociation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Domains)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Domains) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -36,17 +50,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecurityPolicyWebApplicationFirewallAssociation DeserializeSecurityPolicyWebApplicationFirewallAssociation(JsonElement element) + internal static SecurityPolicyWebApplicationFirewallAssociation DeserializeSecurityPolicyWebApplicationFirewallAssociation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> domains = default; Optional> patternsToMatch = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domains"u8)) @@ -77,8 +106,61 @@ internal static SecurityPolicyWebApplicationFirewallAssociation DeserializeSecur patternsToMatch = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SecurityPolicyWebApplicationFirewallAssociation(Optional.ToList(domains), Optional.ToList(patternsToMatch), serializedAdditionalRawData); + } + + SecurityPolicyWebApplicationFirewallAssociation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityPolicyWebApplicationFirewallAssociation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecurityPolicyWebApplicationFirewallAssociation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecurityPolicyWebApplicationFirewallAssociation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecurityPolicyWebApplicationFirewallAssociation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecurityPolicyWebApplicationFirewallAssociation(Response response) + { + if (response is null) + { + return null; } - return new SecurityPolicyWebApplicationFirewallAssociation(Optional.ToList(domains), Optional.ToList(patternsToMatch)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecurityPolicyWebApplicationFirewallAssociation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.cs index 946ef3f5fa7a..1837e5cf1702 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SecurityPolicyWebApplicationFirewallAssociation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Cdn.Models /// settings for security policy patterns to match. public partial class SecurityPolicyWebApplicationFirewallAssociation { - /// Initializes a new instance of SecurityPolicyWebApplicationFirewallAssociation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SecurityPolicyWebApplicationFirewallAssociation() { Domains = new ChangeTrackingList(); PatternsToMatch = new ChangeTrackingList(); } - /// Initializes a new instance of SecurityPolicyWebApplicationFirewallAssociation. + /// Initializes a new instance of . /// List of domains. /// List of paths. - internal SecurityPolicyWebApplicationFirewallAssociation(IList domains, IList patternsToMatch) + /// Keeps track of any properties unknown to the library. + internal SecurityPolicyWebApplicationFirewallAssociation(IList domains, IList patternsToMatch, Dictionary serializedAdditionalRawData) { Domains = domains; PatternsToMatch = patternsToMatch; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of domains. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.Serialization.cs index 606205856f87..05e1240ec4ce 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ServerPortMatchCondition : IUtf8JsonSerializable + public partial class ServerPortMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServerPortMatchCondition DeserializeServerPortMatchCondition(JsonElement element) + internal static ServerPortMatchCondition DeserializeServerPortMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static ServerPortMatchCondition DeserializeServerPortMatchCondition(Jso Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static ServerPortMatchCondition DeserializeServerPortMatchCondition(Jso transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServerPortMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + ServerPortMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServerPortMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServerPortMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServerPortMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServerPortMatchCondition model) + { + if (model is null) + { + return null; } - return new ServerPortMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServerPortMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServerPortMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.cs index c6f9c1ea9154..26432a1be3f1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ServerPortMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for ServerPort match conditions. public partial class ServerPortMatchCondition { - /// Initializes a new instance of ServerPortMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public ServerPortMatchCondition(ServerPortMatchConditionType conditionType, ServerPortOperator serverPortOperator) @@ -24,19 +28,26 @@ public ServerPortMatchCondition(ServerPortMatchConditionType conditionType, Serv Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of ServerPortMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal ServerPortMatchCondition(ServerPortMatchConditionType conditionType, ServerPortOperator serverPortOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal ServerPortMatchCondition(ServerPortMatchConditionType conditionType, ServerPortOperator serverPortOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; ServerPortOperator = serverPortOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ServerPortMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.Serialization.cs index 5e3a5fd57ce2..408dc3abf97f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class SharedPrivateLinkResourceProperties : IUtf8JsonSerializable + public partial class SharedPrivateLinkResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PrivateLink)) { @@ -41,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SharedPrivateLinkResourceProperties DeserializeSharedPrivateLinkResourceProperties(JsonElement element) + internal static SharedPrivateLinkResourceProperties DeserializeSharedPrivateLinkResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +77,7 @@ internal static SharedPrivateLinkResourceProperties DeserializeSharedPrivateLink Optional groupId = default; Optional requestMessage = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("privateLink"u8)) @@ -90,8 +113,61 @@ internal static SharedPrivateLinkResourceProperties DeserializeSharedPrivateLink status = property.Value.GetString().ToSharedPrivateLinkResourceStatus(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SharedPrivateLinkResourceProperties(privateLink, privateLinkLocation.Value, groupId.Value, requestMessage.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + SharedPrivateLinkResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedPrivateLinkResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedPrivateLinkResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedPrivateLinkResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedPrivateLinkResourceProperties model) + { + if (model is null) + { + return null; } - return new SharedPrivateLinkResourceProperties(privateLink, privateLinkLocation.Value, groupId.Value, requestMessage.Value, Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedPrivateLinkResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedPrivateLinkResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.cs index b400b4742c2c..b11564704e67 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SharedPrivateLinkResourceProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,24 +15,29 @@ namespace Azure.ResourceManager.Cdn.Models /// Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin. public partial class SharedPrivateLinkResourceProperties { - /// Initializes a new instance of SharedPrivateLinkResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SharedPrivateLinkResourceProperties() { } - /// Initializes a new instance of SharedPrivateLinkResourceProperties. + /// Initializes a new instance of . /// The resource id of the resource the shared private link resource is for. /// The location of the shared private link resource. /// The group id from the provider of resource the shared private link resource is for. /// The request message for requesting approval of the shared private link resource. /// Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout. - internal SharedPrivateLinkResourceProperties(WritableSubResource privateLink, string privateLinkLocation, string groupId, string requestMessage, SharedPrivateLinkResourceStatus? status) + /// Keeps track of any properties unknown to the library. + internal SharedPrivateLinkResourceProperties(WritableSubResource privateLink, string privateLinkLocation, string groupId, string requestMessage, SharedPrivateLinkResourceStatus? status, Dictionary serializedAdditionalRawData) { PrivateLink = privateLink; PrivateLinkLocation = privateLinkLocation; GroupId = groupId; RequestMessage = requestMessage; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource id of the resource the shared private link resource is for. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.Serialization.cs index 94634bbaec91..8af049287a61 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class SocketAddressMatchCondition : IUtf8JsonSerializable + public partial class SocketAddressMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SocketAddressMatchCondition DeserializeSocketAddressMatchCondition(JsonElement element) + internal static SocketAddressMatchCondition DeserializeSocketAddressMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static SocketAddressMatchCondition DeserializeSocketAddressMatchConditi Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static SocketAddressMatchCondition DeserializeSocketAddressMatchConditi transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SocketAddressMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + SocketAddressMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSocketAddressMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SocketAddressMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSocketAddressMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SocketAddressMatchCondition model) + { + if (model is null) + { + return null; } - return new SocketAddressMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SocketAddressMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSocketAddressMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.cs index 04dc024daf02..0722b24b5cbf 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SocketAddressMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for SocketAddress match conditions. public partial class SocketAddressMatchCondition { - /// Initializes a new instance of SocketAddressMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public SocketAddressMatchCondition(SocketAddressMatchConditionType conditionType, SocketAddressOperator socketAddressOperator) @@ -24,19 +28,26 @@ public SocketAddressMatchCondition(SocketAddressMatchConditionType conditionType Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of SocketAddressMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal SocketAddressMatchCondition(SocketAddressMatchConditionType conditionType, SocketAddressOperator socketAddressOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal SocketAddressMatchCondition(SocketAddressMatchConditionType conditionType, SocketAddressOperator socketAddressOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; SocketAddressOperator = socketAddressOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SocketAddressMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.Serialization.cs index 63cc843e559c..bfaeb4410272 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.Serialization.cs @@ -6,20 +6,48 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class SsoUri + public partial class SsoUri : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SsoUri DeserializeSsoUri(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SsoUri DeserializeSsoUri(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ssoUriValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ssoUriValue"u8)) @@ -31,8 +59,61 @@ internal static SsoUri DeserializeSsoUri(JsonElement element) ssoUriValue = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SsoUri(ssoUriValue.Value); + return new SsoUri(ssoUriValue.Value, serializedAdditionalRawData); + } + + SsoUri IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSsoUri(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SsoUri IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSsoUri(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SsoUri model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SsoUri(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSsoUri(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.cs index b840b066ebdb..69346b181571 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SsoUri.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// The URI required to login to the supplemental portal from the Azure portal. public partial class SsoUri { - /// Initializes a new instance of SsoUri. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SsoUri() { } - /// Initializes a new instance of SsoUri. + /// Initializes a new instance of . /// The URI used to login to the supplemental portal. - internal SsoUri(Uri availableSsoUri) + /// Keeps track of any properties unknown to the library. + internal SsoUri(Uri availableSsoUri, Dictionary serializedAdditionalRawData) { AvailableSsoUri = availableSsoUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The URI used to login to the supplemental portal. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.Serialization.cs index 09730ad5be86..8e317c582ec1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class SupportedOptimizationTypesListResult + public partial class SupportedOptimizationTypesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SupportedOptimizationTypesListResult DeserializeSupportedOptimizationTypesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SupportedOptimizationTypesListResult DeserializeSupportedOptimizationTypesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> supportedOptimizationTypes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("supportedOptimizationTypes"u8)) @@ -36,8 +64,61 @@ internal static SupportedOptimizationTypesListResult DeserializeSupportedOptimiz supportedOptimizationTypes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SupportedOptimizationTypesListResult(Optional.ToList(supportedOptimizationTypes)); + return new SupportedOptimizationTypesListResult(Optional.ToList(supportedOptimizationTypes), serializedAdditionalRawData); + } + + SupportedOptimizationTypesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSupportedOptimizationTypesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SupportedOptimizationTypesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSupportedOptimizationTypesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SupportedOptimizationTypesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SupportedOptimizationTypesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSupportedOptimizationTypesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.cs index 92b81a14ccc5..74f12b378b18 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/SupportedOptimizationTypesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Cdn.Models /// The result of the GetSupportedOptimizationTypes API. public partial class SupportedOptimizationTypesListResult { - /// Initializes a new instance of SupportedOptimizationTypesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SupportedOptimizationTypesListResult() { SupportedOptimizationTypes = new ChangeTrackingList(); } - /// Initializes a new instance of SupportedOptimizationTypesListResult. + /// Initializes a new instance of . /// Supported optimization types for a profile. - internal SupportedOptimizationTypesListResult(IReadOnlyList supportedOptimizationTypes) + /// Keeps track of any properties unknown to the library. + internal SupportedOptimizationTypesListResult(IReadOnlyList supportedOptimizationTypes, Dictionary serializedAdditionalRawData) { SupportedOptimizationTypes = supportedOptimizationTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Supported optimization types for a profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.Serialization.cs index 2d79175624e9..8a637d764ee7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class UnknownCustomDomainHttpsParameters : IUtf8JsonSerializable + internal partial class UnknownCustomDomainHttpsParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("certificateSource"u8); writer.WriteStringValue(CertificateSource.ToString()); @@ -24,41 +30,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimumTlsVersion"u8); writer.WriteStringValue(MinimumTlsVersion.Value.ToSerialString()); } - writer.WriteEndObject(); - } - - internal static UnknownCustomDomainHttpsParameters DeserializeUnknownCustomDomainHttpsParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - CertificateSource certificateSource = "Unknown"; - SecureDeliveryProtocolType protocolType = default; - Optional minimumTlsVersion = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("certificateSource"u8)) - { - certificateSource = new CertificateSource(property.Value.GetString()); - continue; - } - if (property.NameEquals("protocolType"u8)) + foreach (var property in _serializedAdditionalRawData) { - protocolType = new SecureDeliveryProtocolType(property.Value.GetString()); - continue; - } - if (property.NameEquals("minimumTlsVersion"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minimumTlsVersion = property.Value.GetString().ToCdnMinimumTlsVersion(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownCustomDomainHttpsParameters(certificateSource, protocolType, Optional.ToNullable(minimumTlsVersion)); + writer.WriteEndObject(); + } + + internal static CustomDomainHttpsContent DeserializeUnknownCustomDomainHttpsParameters(JsonElement element, ModelSerializerOptions options = default) => DeserializeCustomDomainHttpsContent(element, options); + + CustomDomainHttpsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownCustomDomainHttpsParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDomainHttpsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDomainHttpsContent(doc.RootElement, options); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.cs index 09036e93b888..d5a7af203bcf 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownCustomDomainHttpsParameters.cs @@ -5,18 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The UnknownCustomDomainHttpsParameters. internal partial class UnknownCustomDomainHttpsParameters : CustomDomainHttpsContent { - /// Initializes a new instance of UnknownCustomDomainHttpsParameters. + /// Initializes a new instance of . /// Defines the source of the SSL certificate. /// Defines the TLS extension protocol that is used for secure delivery. /// TLS protocol version that will be used for Https. - internal UnknownCustomDomainHttpsParameters(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion) : base(certificateSource, protocolType, minimumTlsVersion) + /// Keeps track of any properties unknown to the library. + internal UnknownCustomDomainHttpsParameters(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion, Dictionary serializedAdditionalRawData) : base(certificateSource, protocolType, minimumTlsVersion, serializedAdditionalRawData) { CertificateSource = certificateSource; } + + /// Initializes a new instance of for deserialization. + internal UnknownCustomDomainHttpsParameters() + { + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.Serialization.cs index 0fd73f8d1373..7a5148dc48f6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class UnknownDeliveryRuleAction : IUtf8JsonSerializable + internal partial class UnknownDeliveryRuleAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownDeliveryRuleAction DeserializeUnknownDeliveryRuleAction(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - DeliveryRuleActionType name = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) + foreach (var property in _serializedAdditionalRawData) { - name = new DeliveryRuleActionType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownDeliveryRuleAction(name); + writer.WriteEndObject(); + } + + internal static DeliveryRuleAction DeserializeUnknownDeliveryRuleAction(JsonElement element, ModelSerializerOptions options = default) => DeserializeDeliveryRuleAction(element, options); + + DeliveryRuleAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownDeliveryRuleAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleAction(doc.RootElement, options); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.cs index bfa766d37858..4a298b418630 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleAction.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The UnknownDeliveryRuleAction. internal partial class UnknownDeliveryRuleAction : DeliveryRuleAction { - /// Initializes a new instance of UnknownDeliveryRuleAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. - internal UnknownDeliveryRuleAction(DeliveryRuleActionType name) : base(name) + /// Keeps track of any properties unknown to the library. + internal UnknownDeliveryRuleAction(DeliveryRuleActionType name, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Name = name; } + + /// Initializes a new instance of for deserialization. + internal UnknownDeliveryRuleAction() + { + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.Serialization.cs index 8c90b860b0d2..b09745cab044 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class UnknownDeliveryRuleCondition : IUtf8JsonSerializable + internal partial class UnknownDeliveryRuleCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownDeliveryRuleCondition DeserializeUnknownDeliveryRuleCondition(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - MatchVariable name = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) + foreach (var property in _serializedAdditionalRawData) { - name = new MatchVariable(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownDeliveryRuleCondition(name); + writer.WriteEndObject(); + } + + internal static DeliveryRuleCondition DeserializeUnknownDeliveryRuleCondition(JsonElement element, ModelSerializerOptions options = default) => DeserializeDeliveryRuleCondition(element, options); + + DeliveryRuleCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownDeliveryRuleCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeliveryRuleCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeliveryRuleCondition(doc.RootElement, options); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.cs index f58f02e12b9b..eeb86162b248 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownDeliveryRuleCondition.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The UnknownDeliveryRuleCondition. internal partial class UnknownDeliveryRuleCondition : DeliveryRuleCondition { - /// Initializes a new instance of UnknownDeliveryRuleCondition. + /// Initializes a new instance of . /// The name of the condition for the delivery rule. - internal UnknownDeliveryRuleCondition(MatchVariable name) : base(name) + /// Keeps track of any properties unknown to the library. + internal UnknownDeliveryRuleCondition(MatchVariable name, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Name = name; } + + /// Initializes a new instance of for deserialization. + internal UnknownDeliveryRuleCondition() + { + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.Serialization.cs index 88f84f7ebec1..bc27d6072659 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class UnknownSecretProperties : IUtf8JsonSerializable + internal partial class UnknownSecretProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(SecretType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownSecretProperties DeserializeUnknownSecretProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - SecretType type = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) + foreach (var property in _serializedAdditionalRawData) { - type = new SecretType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownSecretProperties(type); + writer.WriteEndObject(); + } + + internal static FrontDoorSecretProperties DeserializeUnknownSecretProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeFrontDoorSecretProperties(element, options); + + FrontDoorSecretProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownSecretProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FrontDoorSecretProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFrontDoorSecretProperties(doc.RootElement, options); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.cs index 56593981fbb9..00ee26abb48e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecretProperties.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The UnknownSecretProperties. internal partial class UnknownSecretProperties : FrontDoorSecretProperties { - /// Initializes a new instance of UnknownSecretProperties. + /// Initializes a new instance of . /// The type of the secret resource. - internal UnknownSecretProperties(SecretType secretType) : base(secretType) + /// Keeps track of any properties unknown to the library. + internal UnknownSecretProperties(SecretType secretType, Dictionary serializedAdditionalRawData) : base(secretType, serializedAdditionalRawData) { SecretType = secretType; } + + /// Initializes a new instance of for deserialization. + internal UnknownSecretProperties() + { + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.Serialization.cs index 0387b1bdd5bf..19e2c3452ba5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class UnknownSecurityPolicyProperties : IUtf8JsonSerializable + internal partial class UnknownSecurityPolicyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(PolicyType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownSecurityPolicyProperties DeserializeUnknownSecurityPolicyProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - SecurityPolicyType type = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) + foreach (var property in _serializedAdditionalRawData) { - type = new SecurityPolicyType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownSecurityPolicyProperties(type); + writer.WriteEndObject(); + } + + internal static SecurityPolicyProperties DeserializeUnknownSecurityPolicyProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeSecurityPolicyProperties(element, options); + + SecurityPolicyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownSecurityPolicyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecurityPolicyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecurityPolicyProperties(doc.RootElement, options); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.cs index beff9018adee..d8494024a26d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UnknownSecurityPolicyProperties.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The UnknownSecurityPolicyProperties. internal partial class UnknownSecurityPolicyProperties : SecurityPolicyProperties { - /// Initializes a new instance of UnknownSecurityPolicyProperties. + /// Initializes a new instance of . /// The type of the Security policy to create. - internal UnknownSecurityPolicyProperties(SecurityPolicyType policyType) : base(policyType) + /// Keeps track of any properties unknown to the library. + internal UnknownSecurityPolicyProperties(SecurityPolicyType policyType, Dictionary serializedAdditionalRawData) : base(policyType, serializedAdditionalRawData) { PolicyType = policyType; } + + /// Initializes a new instance of for deserialization. + internal UnknownSecurityPolicyProperties() + { + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.Serialization.cs index 45cd0dc24cc2..94738acbca51 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriFileExtensionMatchCondition : IUtf8JsonSerializable + public partial class UriFileExtensionMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriFileExtensionMatchCondition DeserializeUriFileExtensionMatchCondition(JsonElement element) + internal static UriFileExtensionMatchCondition DeserializeUriFileExtensionMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static UriFileExtensionMatchCondition DeserializeUriFileExtensionMatchC Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static UriFileExtensionMatchCondition DeserializeUriFileExtensionMatchC transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriFileExtensionMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + UriFileExtensionMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriFileExtensionMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriFileExtensionMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriFileExtensionMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriFileExtensionMatchCondition model) + { + if (model is null) + { + return null; } - return new UriFileExtensionMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriFileExtensionMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriFileExtensionMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.cs index a22edf7a5e45..b1ae6eaeb07a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileExtensionMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for UrlFileExtension match conditions. public partial class UriFileExtensionMatchCondition { - /// Initializes a new instance of UriFileExtensionMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public UriFileExtensionMatchCondition(UriFileExtensionMatchConditionType conditionType, UriFileExtensionOperator uriFileExtensionOperator) @@ -24,19 +28,26 @@ public UriFileExtensionMatchCondition(UriFileExtensionMatchConditionType conditi Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of UriFileExtensionMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal UriFileExtensionMatchCondition(UriFileExtensionMatchConditionType conditionType, UriFileExtensionOperator uriFileExtensionOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal UriFileExtensionMatchCondition(UriFileExtensionMatchConditionType conditionType, UriFileExtensionOperator uriFileExtensionOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; UriFileExtensionOperator = uriFileExtensionOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriFileExtensionMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.Serialization.cs index a9d144de429f..924b67eadf2a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriFileNameMatchCondition : IUtf8JsonSerializable + public partial class UriFileNameMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriFileNameMatchCondition DeserializeUriFileNameMatchCondition(JsonElement element) + internal static UriFileNameMatchCondition DeserializeUriFileNameMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static UriFileNameMatchCondition DeserializeUriFileNameMatchCondition(J Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static UriFileNameMatchCondition DeserializeUriFileNameMatchCondition(J transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriFileNameMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + UriFileNameMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriFileNameMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriFileNameMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriFileNameMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriFileNameMatchCondition model) + { + if (model is null) + { + return null; } - return new UriFileNameMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriFileNameMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriFileNameMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.cs index 325a6438aaad..68d7627555eb 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriFileNameMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for UrlFilename match conditions. public partial class UriFileNameMatchCondition { - /// Initializes a new instance of UriFileNameMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public UriFileNameMatchCondition(UriFileNameMatchConditionType conditionType, UriFileNameOperator uriFileNameOperator) @@ -24,19 +28,26 @@ public UriFileNameMatchCondition(UriFileNameMatchConditionType conditionType, Ur Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of UriFileNameMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal UriFileNameMatchCondition(UriFileNameMatchConditionType conditionType, UriFileNameOperator uriFileNameOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal UriFileNameMatchCondition(UriFileNameMatchConditionType conditionType, UriFileNameOperator uriFileNameOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; UriFileNameOperator = uriFileNameOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriFileNameMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.Serialization.cs index c462eb48f4d8..cc3fcc95307d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriPathMatchCondition : IUtf8JsonSerializable + public partial class UriPathMatchCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ConditionType.ToString()); @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriPathMatchCondition DeserializeUriPathMatchCondition(JsonElement element) + internal static UriPathMatchCondition DeserializeUriPathMatchCondition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +80,7 @@ internal static UriPathMatchCondition DeserializeUriPathMatchCondition(JsonEleme Optional negateCondition = default; Optional> matchValues = default; Optional> transforms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -108,8 +130,61 @@ internal static UriPathMatchCondition DeserializeUriPathMatchCondition(JsonEleme transforms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriPathMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms), serializedAdditionalRawData); + } + + UriPathMatchCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriPathMatchCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriPathMatchCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriPathMatchCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriPathMatchCondition model) + { + if (model is null) + { + return null; } - return new UriPathMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriPathMatchCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriPathMatchCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.cs index b51e4a1292d3..6ff133636281 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriPathMatchCondition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for UrlPath match conditions. public partial class UriPathMatchCondition { - /// Initializes a new instance of UriPathMatchCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Describes operator to be matched. public UriPathMatchCondition(UriPathMatchConditionType conditionType, UriPathOperator uriPathOperator) @@ -24,19 +28,26 @@ public UriPathMatchCondition(UriPathMatchConditionType conditionType, UriPathOpe Transforms = new ChangeTrackingList(); } - /// Initializes a new instance of UriPathMatchCondition. + /// Initializes a new instance of . /// /// Describes operator to be matched. /// Describes if this is negate condition or not. /// The match value for the condition of the delivery rule. /// List of transforms. - internal UriPathMatchCondition(UriPathMatchConditionType conditionType, UriPathOperator uriPathOperator, bool? negateCondition, IList matchValues, IList transforms) + /// Keeps track of any properties unknown to the library. + internal UriPathMatchCondition(UriPathMatchConditionType conditionType, UriPathOperator uriPathOperator, bool? negateCondition, IList matchValues, IList transforms, Dictionary serializedAdditionalRawData) { ConditionType = conditionType; UriPathOperator = uriPathOperator; NegateCondition = negateCondition; MatchValues = matchValues; Transforms = transforms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriPathMatchCondition() + { } /// Gets or sets the condition type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.Serialization.cs index b3c06e8cc8df..74301bcf7f68 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriRedirectAction : IUtf8JsonSerializable + public partial class UriRedirectAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriRedirectAction DeserializeUriRedirectAction(JsonElement element) + internal static UriRedirectAction DeserializeUriRedirectAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } UriRedirectActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static UriRedirectAction DeserializeUriRedirectAction(JsonElement eleme name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriRedirectAction(name, parameters, serializedAdditionalRawData); + } + + UriRedirectAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriRedirectAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriRedirectAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriRedirectAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriRedirectAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriRedirectAction(Response response) + { + if (response is null) + { + return null; } - return new UriRedirectAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriRedirectAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.cs index 051cbf88b443..2283f35c8c5b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the url redirect action for the delivery rule. public partial class UriRedirectAction : DeliveryRuleAction { - /// Initializes a new instance of UriRedirectAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public UriRedirectAction(UriRedirectActionProperties properties) @@ -24,15 +25,21 @@ public UriRedirectAction(UriRedirectActionProperties properties) Name = DeliveryRuleActionType.UriRedirect; } - /// Initializes a new instance of UriRedirectAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal UriRedirectAction(DeliveryRuleActionType name, UriRedirectActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal UriRedirectAction(DeliveryRuleActionType name, UriRedirectActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal UriRedirectAction() + { + } + /// Defines the parameters for the action. public UriRedirectActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.Serialization.cs index 7c8d471388e7..58115bad0c32 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriRedirectActionProperties : IUtf8JsonSerializable + public partial class UriRedirectActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -44,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("customFragment"u8); writer.WriteStringValue(CustomFragment); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriRedirectActionProperties DeserializeUriRedirectActionProperties(JsonElement element) + internal static UriRedirectActionProperties DeserializeUriRedirectActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +82,7 @@ internal static UriRedirectActionProperties DeserializeUriRedirectActionProperti Optional customHostname = default; Optional customQueryString = default; Optional customFragment = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -101,8 +124,61 @@ internal static UriRedirectActionProperties DeserializeUriRedirectActionProperti customFragment = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriRedirectActionProperties(typeName, redirectType, Optional.ToNullable(destinationProtocol), customPath.Value, customHostname.Value, customQueryString.Value, customFragment.Value, serializedAdditionalRawData); + } + + UriRedirectActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriRedirectActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriRedirectActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriRedirectActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriRedirectActionProperties model) + { + if (model is null) + { + return null; } - return new UriRedirectActionProperties(typeName, redirectType, Optional.ToNullable(destinationProtocol), customPath.Value, customHostname.Value, customQueryString.Value, customFragment.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriRedirectActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriRedirectActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.cs index 760935c15715..35940ed427d7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRedirectActionProperties.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Defines the parameters for the url redirect action. public partial class UriRedirectActionProperties { - /// Initializes a new instance of UriRedirectActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// The redirect type the rule will use when redirecting traffic. public UriRedirectActionProperties(UriRedirectActionType actionType, RedirectType redirectType) @@ -19,7 +25,7 @@ public UriRedirectActionProperties(UriRedirectActionType actionType, RedirectTyp RedirectType = redirectType; } - /// Initializes a new instance of UriRedirectActionProperties. + /// Initializes a new instance of . /// /// The redirect type the rule will use when redirecting traffic. /// Protocol to use for the redirect. The default value is MatchRequest. @@ -27,7 +33,8 @@ public UriRedirectActionProperties(UriRedirectActionType actionType, RedirectTyp /// Host to redirect. Leave empty to use the incoming host as the destination host. /// The set of query strings to be placed in the redirect URL. Setting this value would replace any existing query string; leave empty to preserve the incoming query string. Query string must be in <key>=<value> format. ? and & will be added automatically so do not include them. /// Fragment to add to the redirect URL. Fragment is the part of the URL that comes after #. Do not include the #. - internal UriRedirectActionProperties(UriRedirectActionType actionType, RedirectType redirectType, DestinationProtocol? destinationProtocol, string customPath, string customHostname, string customQueryString, string customFragment) + /// Keeps track of any properties unknown to the library. + internal UriRedirectActionProperties(UriRedirectActionType actionType, RedirectType redirectType, DestinationProtocol? destinationProtocol, string customPath, string customHostname, string customQueryString, string customFragment, Dictionary serializedAdditionalRawData) { ActionType = actionType; RedirectType = redirectType; @@ -36,6 +43,12 @@ internal UriRedirectActionProperties(UriRedirectActionType actionType, RedirectT CustomHostname = customHostname; CustomQueryString = customQueryString; CustomFragment = customFragment; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriRedirectActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.Serialization.cs index 7a5a01caa6b2..1be93ceb6329 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriRewriteAction : IUtf8JsonSerializable + public partial class UriRewriteAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriRewriteAction DeserializeUriRewriteAction(JsonElement element) + internal static UriRewriteAction DeserializeUriRewriteAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } UriRewriteActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static UriRewriteAction DeserializeUriRewriteAction(JsonElement element name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriRewriteAction(name, parameters, serializedAdditionalRawData); + } + + UriRewriteAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriRewriteAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriRewriteAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriRewriteAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriRewriteAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriRewriteAction(Response response) + { + if (response is null) + { + return null; } - return new UriRewriteAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriRewriteAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.cs index ce0d97dc7ecc..c2faec05f518 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the url rewrite action for the delivery rule. public partial class UriRewriteAction : DeliveryRuleAction { - /// Initializes a new instance of UriRewriteAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public UriRewriteAction(UriRewriteActionProperties properties) @@ -24,15 +25,21 @@ public UriRewriteAction(UriRewriteActionProperties properties) Name = DeliveryRuleActionType.UriRewrite; } - /// Initializes a new instance of UriRewriteAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal UriRewriteAction(DeliveryRuleActionType name, UriRewriteActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal UriRewriteAction(DeliveryRuleActionType name, UriRewriteActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal UriRewriteAction() + { + } + /// Defines the parameters for the action. public UriRewriteActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.Serialization.cs index 117562c0757f..62a18deca943 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriRewriteActionProperties : IUtf8JsonSerializable + public partial class UriRewriteActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("preserveUnmatchedPath"u8); writer.WriteBooleanValue(PreserveUnmatchedPath.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriRewriteActionProperties DeserializeUriRewriteActionProperties(JsonElement element) + internal static UriRewriteActionProperties DeserializeUriRewriteActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static UriRewriteActionProperties DeserializeUriRewriteActionProperties string sourcePattern = default; string destination = default; Optional preserveUnmatchedPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -65,8 +88,61 @@ internal static UriRewriteActionProperties DeserializeUriRewriteActionProperties preserveUnmatchedPath = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriRewriteActionProperties(typeName, sourcePattern, destination, Optional.ToNullable(preserveUnmatchedPath), serializedAdditionalRawData); + } + + UriRewriteActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriRewriteActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriRewriteActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriRewriteActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriRewriteActionProperties model) + { + if (model is null) + { + return null; } - return new UriRewriteActionProperties(typeName, sourcePattern, destination, Optional.ToNullable(preserveUnmatchedPath)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriRewriteActionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriRewriteActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.cs index ce31f63ee30d..f0ff839e2841 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriRewriteActionProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for the url rewrite action. public partial class UriRewriteActionProperties { - /// Initializes a new instance of UriRewriteActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// define a request URI pattern that identifies the type of requests that may be rewritten. If value is blank, all strings are matched. /// Define the relative URL to which the above requests will be rewritten by. @@ -28,17 +32,24 @@ public UriRewriteActionProperties(UriRewriteActionType actionType, string source Destination = destination; } - /// Initializes a new instance of UriRewriteActionProperties. + /// Initializes a new instance of . /// /// define a request URI pattern that identifies the type of requests that may be rewritten. If value is blank, all strings are matched. /// Define the relative URL to which the above requests will be rewritten by. /// Whether to preserve unmatched path. Default value is true. - internal UriRewriteActionProperties(UriRewriteActionType actionType, string sourcePattern, string destination, bool? preserveUnmatchedPath) + /// Keeps track of any properties unknown to the library. + internal UriRewriteActionProperties(UriRewriteActionType actionType, string sourcePattern, string destination, bool? preserveUnmatchedPath, Dictionary serializedAdditionalRawData) { ActionType = actionType; SourcePattern = sourcePattern; Destination = destination; PreserveUnmatchedPath = preserveUnmatchedPath; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriRewriteActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.Serialization.cs index 3069e13a3edc..71a724dd3010 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriSigningAction : IUtf8JsonSerializable + public partial class UriSigningAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriSigningAction DeserializeUriSigningAction(JsonElement element) + internal static UriSigningAction DeserializeUriSigningAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } UriSigningActionProperties parameters = default; DeliveryRuleActionType name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -42,8 +72,61 @@ internal static UriSigningAction DeserializeUriSigningAction(JsonElement element name = new DeliveryRuleActionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriSigningAction(name, parameters, serializedAdditionalRawData); + } + + UriSigningAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriSigningAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriSigningAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriSigningAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriSigningAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriSigningAction(Response response) + { + if (response is null) + { + return null; } - return new UriSigningAction(name, parameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriSigningAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.cs index 92db5ceb1e5e..4471828b88b8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the url signing action for the delivery rule. public partial class UriSigningAction : DeliveryRuleAction { - /// Initializes a new instance of UriSigningAction. + /// Initializes a new instance of . /// Defines the parameters for the action. /// is null. public UriSigningAction(UriSigningActionProperties properties) @@ -24,15 +25,21 @@ public UriSigningAction(UriSigningActionProperties properties) Name = DeliveryRuleActionType.UriSigning; } - /// Initializes a new instance of UriSigningAction. + /// Initializes a new instance of . /// The name of the action for the delivery rule. /// Defines the parameters for the action. - internal UriSigningAction(DeliveryRuleActionType name, UriSigningActionProperties properties) : base(name) + /// Keeps track of any properties unknown to the library. + internal UriSigningAction(DeliveryRuleActionType name, UriSigningActionProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) { Properties = properties; Name = name; } + /// Initializes a new instance of for deserialization. + internal UriSigningAction() + { + } + /// Defines the parameters for the action. public UriSigningActionProperties Properties { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.Serialization.cs index 31c03a96a920..a8378558b645 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriSigningActionProperties : IUtf8JsonSerializable + public partial class UriSigningActionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeName"u8); writer.WriteStringValue(ActionType.ToString()); @@ -29,15 +36,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ParameterNameOverride) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriSigningActionProperties DeserializeUriSigningActionProperties(JsonElement element) + internal static UriSigningActionProperties DeserializeUriSigningActionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +73,7 @@ internal static UriSigningActionProperties DeserializeUriSigningActionProperties UriSigningActionType typeName = default; Optional algorithm = default; Optional> parameterNameOverride = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -75,8 +104,61 @@ internal static UriSigningActionProperties DeserializeUriSigningActionProperties parameterNameOverride = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriSigningActionProperties(typeName, Optional.ToNullable(algorithm), Optional.ToList(parameterNameOverride), serializedAdditionalRawData); + } + + UriSigningActionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriSigningActionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriSigningActionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriSigningActionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriSigningActionProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriSigningActionProperties(Response response) + { + if (response is null) + { + return null; } - return new UriSigningActionProperties(typeName, Optional.ToNullable(algorithm), Optional.ToList(parameterNameOverride)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriSigningActionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.cs index 8708bef64f12..4c876bee1dbf 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningActionProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the parameters for the Url Signing action. public partial class UriSigningActionProperties { - /// Initializes a new instance of UriSigningActionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// public UriSigningActionProperties(UriSigningActionType actionType) { @@ -21,15 +25,22 @@ public UriSigningActionProperties(UriSigningActionType actionType) ParameterNameOverride = new ChangeTrackingList(); } - /// Initializes a new instance of UriSigningActionProperties. + /// Initializes a new instance of . /// /// Algorithm to use for URL signing. /// Defines which query string parameters in the url to be considered for expires, key id etc. - internal UriSigningActionProperties(UriSigningActionType actionType, UriSigningAlgorithm? algorithm, IList parameterNameOverride) + /// Keeps track of any properties unknown to the library. + internal UriSigningActionProperties(UriSigningActionType actionType, UriSigningAlgorithm? algorithm, IList parameterNameOverride, Dictionary serializedAdditionalRawData) { ActionType = actionType; Algorithm = algorithm; ParameterNameOverride = parameterNameOverride; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriSigningActionProperties() + { } /// Gets or sets the action type. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.Serialization.cs index fa4d30445874..98bc710f397f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriSigningKey : IUtf8JsonSerializable + public partial class UriSigningKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyId"u8); writer.WriteStringValue(KeyId); writer.WritePropertyName("keySourceParameters"u8); - writer.WriteObjectValue(KeySourceParameters); + if (KeySourceParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeySourceParameters).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriSigningKey DeserializeUriSigningKey(JsonElement element) + internal static UriSigningKey DeserializeUriSigningKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string keyId = default; KeyVaultSigningKey keySourceParameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyId"u8)) @@ -42,8 +72,61 @@ internal static UriSigningKey DeserializeUriSigningKey(JsonElement element) keySourceParameters = KeyVaultSigningKey.DeserializeKeyVaultSigningKey(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriSigningKey(keyId, keySourceParameters, serializedAdditionalRawData); + } + + UriSigningKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriSigningKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriSigningKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriSigningKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriSigningKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriSigningKey(Response response) + { + if (response is null) + { + return null; } - return new UriSigningKey(keyId, keySourceParameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriSigningKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.cs index a39405577dfb..60a435004f34 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKey.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Url signing key. public partial class UriSigningKey { - /// Initializes a new instance of UriSigningKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. /// Defines the parameters for using customer key vault for Url Signing Key. /// or is null. @@ -26,6 +30,22 @@ public UriSigningKey(string keyId, KeyVaultSigningKey keySourceParameters) KeySourceParameters = keySourceParameters; } + /// Initializes a new instance of . + /// Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. + /// Defines the parameters for using customer key vault for Url Signing Key. + /// Keeps track of any properties unknown to the library. + internal UriSigningKey(string keyId, KeyVaultSigningKey keySourceParameters, Dictionary serializedAdditionalRawData) + { + KeyId = keyId; + KeySourceParameters = keySourceParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriSigningKey() + { + } + /// Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. public string KeyId { get; set; } /// Defines the parameters for using customer key vault for Url Signing Key. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.Serialization.cs index 212c67a61e8e..ef03dafd0a92 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriSigningKeyProperties : IUtf8JsonSerializable + public partial class UriSigningKeyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyId"u8); writer.WriteStringValue(KeyId); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(SecretType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriSigningKeyProperties DeserializeUriSigningKeyProperties(JsonElement element) + internal static UriSigningKeyProperties DeserializeUriSigningKeyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static UriSigningKeyProperties DeserializeUriSigningKeyProperties(JsonE WritableSubResource secretSource = default; Optional secretVersion = default; SecretType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyId"u8)) @@ -61,8 +84,61 @@ internal static UriSigningKeyProperties DeserializeUriSigningKeyProperties(JsonE type = new SecretType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriSigningKeyProperties(type, keyId, secretSource, secretVersion.Value, serializedAdditionalRawData); + } + + UriSigningKeyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriSigningKeyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriSigningKeyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriSigningKeyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriSigningKeyProperties model) + { + if (model is null) + { + return null; } - return new UriSigningKeyProperties(type, keyId, secretSource, secretVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriSigningKeyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriSigningKeyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.cs index 7d58fabece72..4db4e4b7660f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningKeyProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Url signing key parameters. public partial class UriSigningKeyProperties : FrontDoorSecretProperties { - /// Initializes a new instance of UriSigningKeyProperties. + /// Initializes a new instance of . /// Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. /// Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. /// or is null. @@ -28,12 +29,13 @@ public UriSigningKeyProperties(string keyId, WritableSubResource secretSource) SecretType = SecretType.UriSigningKey; } - /// Initializes a new instance of UriSigningKeyProperties. + /// Initializes a new instance of . /// The type of the secret resource. /// Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. /// Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. /// Version of the secret to be used. - internal UriSigningKeyProperties(SecretType secretType, string keyId, WritableSubResource secretSource, string secretVersion) : base(secretType) + /// Keeps track of any properties unknown to the library. + internal UriSigningKeyProperties(SecretType secretType, string keyId, WritableSubResource secretSource, string secretVersion, Dictionary serializedAdditionalRawData) : base(secretType, serializedAdditionalRawData) { KeyId = keyId; SecretSource = secretSource; @@ -41,6 +43,11 @@ internal UriSigningKeyProperties(SecretType secretType, string keyId, WritableSu SecretType = secretType; } + /// Initializes a new instance of for deserialization. + internal UriSigningKeyProperties() + { + } + /// Defines the customer defined key Id. This id will exist in the incoming request to indicate the key used to form the hash. public string KeyId { get; set; } /// Resource reference to the Azure Key Vault secret. Expected to be in format of /subscriptions/{​​​​​​​​​subscriptionId}​​​​​​​​​/resourceGroups/{​​​​​​​​​resourceGroupName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/providers/Microsoft.KeyVault/vaults/{vaultName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/secrets/{secretName}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.Serialization.cs index d13d69e571b0..312f40a09ad0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UriSigningParamIdentifier : IUtf8JsonSerializable + public partial class UriSigningParamIdentifier : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("paramIndicator"u8); writer.WriteStringValue(ParamIndicator.ToString()); writer.WritePropertyName("paramName"u8); writer.WriteStringValue(ParamName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UriSigningParamIdentifier DeserializeUriSigningParamIdentifier(JsonElement element) + internal static UriSigningParamIdentifier DeserializeUriSigningParamIdentifier(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ParamIndicator paramIndicator = default; string paramName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("paramIndicator"u8)) @@ -42,8 +65,61 @@ internal static UriSigningParamIdentifier DeserializeUriSigningParamIdentifier(J paramName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriSigningParamIdentifier(paramIndicator, paramName, serializedAdditionalRawData); + } + + UriSigningParamIdentifier IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriSigningParamIdentifier(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriSigningParamIdentifier IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriSigningParamIdentifier(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriSigningParamIdentifier model) + { + if (model is null) + { + return null; } - return new UriSigningParamIdentifier(paramIndicator, paramName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriSigningParamIdentifier(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriSigningParamIdentifier(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.cs index 21dd2dc3e716..f5616ae284f7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UriSigningParamIdentifier.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines how to identify a parameter for a specific purpose e.g. expires. public partial class UriSigningParamIdentifier { - /// Initializes a new instance of UriSigningParamIdentifier. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicates the purpose of the parameter. /// Parameter name. /// is null. @@ -25,6 +29,22 @@ public UriSigningParamIdentifier(ParamIndicator paramIndicator, string paramName ParamName = paramName; } + /// Initializes a new instance of . + /// Indicates the purpose of the parameter. + /// Parameter name. + /// Keeps track of any properties unknown to the library. + internal UriSigningParamIdentifier(ParamIndicator paramIndicator, string paramName, Dictionary serializedAdditionalRawData) + { + ParamIndicator = paramIndicator; + ParamName = paramName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriSigningParamIdentifier() + { + } + /// Indicates the purpose of the parameter. public ParamIndicator ParamIndicator { get; set; } /// Parameter name. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.Serialization.cs index e77679e8715f..a0547b1789e5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - internal partial class UsagesListResult + internal partial class UsagesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UsagesListResult DeserializeUsagesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UsagesListResult DeserializeUsagesListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static UsagesListResult DeserializeUsagesListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UsagesListResult(Optional.ToList(value), nextLink.Value); + return new UsagesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + UsagesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUsagesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UsagesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUsagesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UsagesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UsagesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUsagesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.cs index 454261c08221..c04883207611 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UsagesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Cdn.Models /// The list usages operation response. internal partial class UsagesListResult { - /// Initializes a new instance of UsagesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UsagesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UsagesListResult. + /// Initializes a new instance of . /// The list of resource usages. /// URL to get the next set of results. - internal UsagesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UsagesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of resource usages. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.Serialization.cs index 90cc8b8c1fad..03cc634a9eb0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.Serialization.cs @@ -5,18 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class UserManagedHttpsContent : IUtf8JsonSerializable + public partial class UserManagedHttpsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("certificateSourceParameters"u8); - writer.WriteObjectValue(CertificateSourceParameters); + if (CertificateSourceParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CertificateSourceParameters).Serialize(writer, options); + } writer.WritePropertyName("certificateSource"u8); writer.WriteStringValue(CertificateSource.ToString()); writer.WritePropertyName("protocolType"u8); @@ -26,11 +41,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimumTlsVersion"u8); writer.WriteStringValue(MinimumTlsVersion.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserManagedHttpsContent DeserializeUserManagedHttpsContent(JsonElement element) + internal static UserManagedHttpsContent DeserializeUserManagedHttpsContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static UserManagedHttpsContent DeserializeUserManagedHttpsContent(JsonE CertificateSource certificateSource = default; SecureDeliveryProtocolType protocolType = default; Optional minimumTlsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificateSourceParameters"u8)) @@ -65,8 +95,61 @@ internal static UserManagedHttpsContent DeserializeUserManagedHttpsContent(JsonE minimumTlsVersion = property.Value.GetString().ToCdnMinimumTlsVersion(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserManagedHttpsContent(certificateSource, protocolType, Optional.ToNullable(minimumTlsVersion), certificateSourceParameters, serializedAdditionalRawData); + } + + UserManagedHttpsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserManagedHttpsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserManagedHttpsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserManagedHttpsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserManagedHttpsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserManagedHttpsContent(Response response) + { + if (response is null) + { + return null; } - return new UserManagedHttpsContent(certificateSource, protocolType, Optional.ToNullable(minimumTlsVersion), certificateSourceParameters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserManagedHttpsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.cs index 0c304d9c92f7..6114f48c6352 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/UserManagedHttpsContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines the certificate source parameters using user's keyvault certificate for enabling SSL. public partial class UserManagedHttpsContent : CustomDomainHttpsContent { - /// Initializes a new instance of UserManagedHttpsContent. + /// Initializes a new instance of . /// Defines the TLS extension protocol that is used for secure delivery. /// Defines the certificate source parameters using user's keyvault certificate for enabling SSL. /// is null. @@ -25,17 +26,23 @@ public UserManagedHttpsContent(SecureDeliveryProtocolType protocolType, KeyVault CertificateSource = CertificateSource.AzureKeyVault; } - /// Initializes a new instance of UserManagedHttpsContent. + /// Initializes a new instance of . /// Defines the source of the SSL certificate. /// Defines the TLS extension protocol that is used for secure delivery. /// TLS protocol version that will be used for Https. /// Defines the certificate source parameters using user's keyvault certificate for enabling SSL. - internal UserManagedHttpsContent(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion, KeyVaultCertificateSource certificateSourceParameters) : base(certificateSource, protocolType, minimumTlsVersion) + /// Keeps track of any properties unknown to the library. + internal UserManagedHttpsContent(CertificateSource certificateSource, SecureDeliveryProtocolType protocolType, CdnMinimumTlsVersion? minimumTlsVersion, KeyVaultCertificateSource certificateSourceParameters, Dictionary serializedAdditionalRawData) : base(certificateSource, protocolType, minimumTlsVersion, serializedAdditionalRawData) { CertificateSourceParameters = certificateSourceParameters; CertificateSource = certificateSource; } + /// Initializes a new instance of for deserialization. + internal UserManagedHttpsContent() + { + } + /// Defines the certificate source parameters using user's keyvault certificate for enabling SSL. public KeyVaultCertificateSource CertificateSourceParameters { get; set; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.Serialization.cs index f11d33fa7f8d..a2568b496f4f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ValidateCustomDomainContent : IUtf8JsonSerializable + public partial class ValidateCustomDomainContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("hostName"u8); writer.WriteStringValue(HostName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ValidateCustomDomainContent DeserializeValidateCustomDomainContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string hostName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hostName"u8)) + { + hostName = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ValidateCustomDomainContent(hostName, serializedAdditionalRawData); + } + + ValidateCustomDomainContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeValidateCustomDomainContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ValidateCustomDomainContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeValidateCustomDomainContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ValidateCustomDomainContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ValidateCustomDomainContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeValidateCustomDomainContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.cs index e3db6b69bb99..dddb029ea02d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Input of the custom domain to be validated for DNS mapping. public partial class ValidateCustomDomainContent { - /// Initializes a new instance of ValidateCustomDomainContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The host name of the custom domain. Must be a domain name. /// is null. public ValidateCustomDomainContent(string hostName) @@ -23,6 +27,20 @@ public ValidateCustomDomainContent(string hostName) HostName = hostName; } + /// Initializes a new instance of . + /// The host name of the custom domain. Must be a domain name. + /// Keeps track of any properties unknown to the library. + internal ValidateCustomDomainContent(string hostName, Dictionary serializedAdditionalRawData) + { + HostName = hostName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ValidateCustomDomainContent() + { + } + /// The host name of the custom domain. Must be a domain name. public string HostName { get; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.Serialization.cs index dd7ad0994e87..92f9051a7024 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ValidateCustomDomainResult + public partial class ValidateCustomDomainResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ValidateCustomDomainResult DeserializeValidateCustomDomainResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ValidateCustomDomainResult DeserializeValidateCustomDomainResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ValidateCustomDomainResult DeserializeValidateCustomDomainResult Optional customDomainValidated = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("customDomainValidated"u8)) @@ -42,8 +71,61 @@ internal static ValidateCustomDomainResult DeserializeValidateCustomDomainResult message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ValidateCustomDomainResult(Optional.ToNullable(customDomainValidated), reason.Value, message.Value); + return new ValidateCustomDomainResult(Optional.ToNullable(customDomainValidated), reason.Value, message.Value, serializedAdditionalRawData); + } + + ValidateCustomDomainResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeValidateCustomDomainResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ValidateCustomDomainResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeValidateCustomDomainResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ValidateCustomDomainResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ValidateCustomDomainResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeValidateCustomDomainResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.cs index ef813fa9a7a9..cb70e2df2ba3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateCustomDomainResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Output of custom domain validation. public partial class ValidateCustomDomainResult { - /// Initializes a new instance of ValidateCustomDomainResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ValidateCustomDomainResult() { } - /// Initializes a new instance of ValidateCustomDomainResult. + /// Initializes a new instance of . /// Indicates whether the custom domain is valid or not. /// The reason why the custom domain is not valid. /// Error message describing why the custom domain is not valid. - internal ValidateCustomDomainResult(bool? isCustomDomainValid, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal ValidateCustomDomainResult(bool? isCustomDomainValid, string reason, string message, Dictionary serializedAdditionalRawData) { IsCustomDomainValid = isCustomDomainValid; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the custom domain is valid or not. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.Serialization.cs index 846d5f2ed412..af48950beb22 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ValidateProbeContent : IUtf8JsonSerializable + public partial class ValidateProbeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("probeURL"u8); writer.WriteStringValue(ProbeUri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ValidateProbeContent DeserializeValidateProbeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri probeUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("probeURL"u8)) + { + probeUri = new Uri(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ValidateProbeContent(probeUri, serializedAdditionalRawData); + } + + ValidateProbeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeValidateProbeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ValidateProbeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeValidateProbeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ValidateProbeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ValidateProbeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeValidateProbeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.cs index 2fba7ad697f7..e9d72fb1f3a2 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Cdn.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Input of the validate probe API. public partial class ValidateProbeContent { - /// Initializes a new instance of ValidateProbeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The probe URL to validate. /// is null. public ValidateProbeContent(Uri probeUri) @@ -23,6 +27,20 @@ public ValidateProbeContent(Uri probeUri) ProbeUri = probeUri; } + /// Initializes a new instance of . + /// The probe URL to validate. + /// Keeps track of any properties unknown to the library. + internal ValidateProbeContent(Uri probeUri, Dictionary serializedAdditionalRawData) + { + ProbeUri = probeUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ValidateProbeContent() + { + } + /// The probe URL to validate. public Uri ProbeUri { get; } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.Serialization.cs index f48f0ce91963..c40ecd16526b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class ValidateProbeResult + public partial class ValidateProbeResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ValidateProbeResult DeserializeValidateProbeResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ValidateProbeResult DeserializeValidateProbeResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ValidateProbeResult DeserializeValidateProbeResult(JsonElement e Optional isValid = default; Optional errorCode = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isValid"u8)) @@ -42,8 +71,61 @@ internal static ValidateProbeResult DeserializeValidateProbeResult(JsonElement e message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ValidateProbeResult(Optional.ToNullable(isValid), errorCode.Value, message.Value); + return new ValidateProbeResult(Optional.ToNullable(isValid), errorCode.Value, message.Value, serializedAdditionalRawData); + } + + ValidateProbeResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeValidateProbeResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ValidateProbeResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeValidateProbeResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ValidateProbeResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ValidateProbeResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeValidateProbeResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.cs index 906746df49e3..3c9827e0cec3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ValidateProbeResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// Output of the validate probe API. public partial class ValidateProbeResult { - /// Initializes a new instance of ValidateProbeResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ValidateProbeResult() { } - /// Initializes a new instance of ValidateProbeResult. + /// Initializes a new instance of . /// Indicates whether the probe URL is accepted or not. /// Specifies the error code when the probe url is not accepted. /// The detailed error message describing why the probe URL is not accepted. - internal ValidateProbeResult(bool? isValid, string errorCode, string message) + /// Keeps track of any properties unknown to the library. + internal ValidateProbeResult(bool? isValid, string errorCode, string message, Dictionary serializedAdditionalRawData) { IsValid = isValid; ErrorCode = errorCode; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the probe URL is accepted or not. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.Serialization.cs index 4a2beec31de8..1d4e6d9b9c8e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.Serialization.cs @@ -8,14 +8,72 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafMetricsResponse + public partial class WafMetricsResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WafMetricsResponse DeserializeWafMetricsResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DateTimeBegin)) + { + writer.WritePropertyName("dateTimeBegin"u8); + writer.WriteStringValue(DateTimeBegin.Value, "O"); + } + if (Optional.IsDefined(DateTimeEnd)) + { + writer.WritePropertyName("dateTimeEnd"u8); + writer.WriteStringValue(DateTimeEnd.Value, "O"); + } + if (Optional.IsDefined(Granularity)) + { + writer.WritePropertyName("granularity"u8); + writer.WriteStringValue(Granularity.Value.ToString()); + } + if (Optional.IsCollectionDefined(Series)) + { + writer.WritePropertyName("series"u8); + writer.WriteStartArray(); + foreach (var item in Series) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WafMetricsResponse DeserializeWafMetricsResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static WafMetricsResponse DeserializeWafMetricsResponse(JsonElement ele Optional dateTimeEnd = default; Optional granularity = default; Optional> series = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dateTimeBegin"u8)) @@ -67,8 +126,61 @@ internal static WafMetricsResponse DeserializeWafMetricsResponse(JsonElement ele series = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WafMetricsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToNullable(granularity), Optional.ToList(series)); + return new WafMetricsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToNullable(granularity), Optional.ToList(series), serializedAdditionalRawData); + } + + WafMetricsResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafMetricsResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafMetricsResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafMetricsResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafMetricsResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafMetricsResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafMetricsResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.cs index 24b12c301c63..889a4e6745f8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponse.cs @@ -14,23 +14,28 @@ namespace Azure.ResourceManager.Cdn.Models /// Waf Metrics Response. public partial class WafMetricsResponse { - /// Initializes a new instance of WafMetricsResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WafMetricsResponse() { Series = new ChangeTrackingList(); } - /// Initializes a new instance of WafMetricsResponse. + /// Initializes a new instance of . /// /// /// /// - internal WafMetricsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, WafMetricsResponseGranularity? granularity, IReadOnlyList series) + /// Keeps track of any properties unknown to the library. + internal WafMetricsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, WafMetricsResponseGranularity? granularity, IReadOnlyList series, Dictionary serializedAdditionalRawData) { DateTimeBegin = dateTimeBegin; DateTimeEnd = dateTimeEnd; Granularity = granularity; Series = series; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the date time begin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.Serialization.cs index 2e6e34ff42be..f9ce91523cab 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.Serialization.cs @@ -5,16 +5,94 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafMetricsResponseSeriesItem + public partial class WafMetricsResponseSeriesItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WafMetricsResponseSeriesItem DeserializeWafMetricsResponseSeriesItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Metric)) + { + writer.WritePropertyName("metric"u8); + writer.WriteStringValue(Metric); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (Optional.IsCollectionDefined(Groups)) + { + if (Groups != null) + { + writer.WritePropertyName("groups"u8); + writer.WriteStartArray(); + foreach (var item in Groups) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("groups"); + } + } + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WafMetricsResponseSeriesItem DeserializeWafMetricsResponseSeriesItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +101,7 @@ internal static WafMetricsResponseSeriesItem DeserializeWafMetricsResponseSeries Optional unit = default; Optional> groups = default; Optional> data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metric"u8)) @@ -68,8 +147,61 @@ internal static WafMetricsResponseSeriesItem DeserializeWafMetricsResponseSeries data = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WafMetricsResponseSeriesItem(metric.Value, Optional.ToNullable(unit), Optional.ToList(groups), Optional.ToList(data)); + return new WafMetricsResponseSeriesItem(metric.Value, Optional.ToNullable(unit), Optional.ToList(groups), Optional.ToList(data), serializedAdditionalRawData); + } + + WafMetricsResponseSeriesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafMetricsResponseSeriesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafMetricsResponseSeriesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafMetricsResponseSeriesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafMetricsResponseSeriesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafMetricsResponseSeriesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafMetricsResponseSeriesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.cs index 1432f3f7d94d..e6bdee0550e3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Cdn.Models /// The WafMetricsResponseSeriesItem. public partial class WafMetricsResponseSeriesItem { - /// Initializes a new instance of WafMetricsResponseSeriesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WafMetricsResponseSeriesItem() { Groups = new ChangeTrackingList(); Data = new ChangeTrackingList(); } - /// Initializes a new instance of WafMetricsResponseSeriesItem. + /// Initializes a new instance of . /// /// /// /// - internal WafMetricsResponseSeriesItem(string metric, WafMetricsResponseSeriesItemUnit? unit, IReadOnlyList groups, IReadOnlyList data) + /// Keeps track of any properties unknown to the library. + internal WafMetricsResponseSeriesItem(string metric, WafMetricsResponseSeriesItemUnit? unit, IReadOnlyList groups, IReadOnlyList data, Dictionary serializedAdditionalRawData) { Metric = metric; Unit = unit; Groups = groups; Data = data; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the metric. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.Serialization.cs index 23f6dcf7b3e1..9033f0380544 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafMetricsResponseSeriesPropertiesItemsItem + public partial class WafMetricsResponseSeriesPropertiesItemsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WafMetricsResponseSeriesPropertiesItemsItem DeserializeWafMetricsResponseSeriesPropertiesItemsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WafMetricsResponseSeriesPropertiesItemsItem DeserializeWafMetricsResponseSeriesPropertiesItemsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static WafMetricsResponseSeriesPropertiesItemsItem DeserializeWafMetric value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WafMetricsResponseSeriesPropertiesItemsItem(name.Value, value.Value); + return new WafMetricsResponseSeriesPropertiesItemsItem(name.Value, value.Value, serializedAdditionalRawData); + } + + WafMetricsResponseSeriesPropertiesItemsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafMetricsResponseSeriesPropertiesItemsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafMetricsResponseSeriesPropertiesItemsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafMetricsResponseSeriesPropertiesItemsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafMetricsResponseSeriesPropertiesItemsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafMetricsResponseSeriesPropertiesItemsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafMetricsResponseSeriesPropertiesItemsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.cs index b6a5c4eba372..f8c81b4f68fd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafMetricsResponseSeriesPropertiesItemsItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Cdn.Models { /// The WafMetricsResponseSeriesPropertiesItemsItem. public partial class WafMetricsResponseSeriesPropertiesItemsItem { - /// Initializes a new instance of WafMetricsResponseSeriesPropertiesItemsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WafMetricsResponseSeriesPropertiesItemsItem() { } - /// Initializes a new instance of WafMetricsResponseSeriesPropertiesItemsItem. + /// Initializes a new instance of . /// /// - internal WafMetricsResponseSeriesPropertiesItemsItem(string name, string value) + /// Keeps track of any properties unknown to the library. + internal WafMetricsResponseSeriesPropertiesItemsItem(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the name. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.Serialization.cs index 22c27b45721e..8ebc616a5ae6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafPolicyManagedRuleSet : IUtf8JsonSerializable + public partial class WafPolicyManagedRuleSet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("ruleSetType"u8); writer.WriteStringValue(RuleSetType); @@ -31,15 +38,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in RuleGroupOverrides) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WafPolicyManagedRuleSet DeserializeWafPolicyManagedRuleSet(JsonElement element) + internal static WafPolicyManagedRuleSet DeserializeWafPolicyManagedRuleSet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static WafPolicyManagedRuleSet DeserializeWafPolicyManagedRuleSet(JsonE string ruleSetVersion = default; Optional anomalyScore = default; Optional> ruleGroupOverrides = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ruleSetType"u8)) @@ -83,8 +112,61 @@ internal static WafPolicyManagedRuleSet DeserializeWafPolicyManagedRuleSet(JsonE ruleGroupOverrides = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WafPolicyManagedRuleSet(ruleSetType, ruleSetVersion, Optional.ToNullable(anomalyScore), Optional.ToList(ruleGroupOverrides), serializedAdditionalRawData); + } + + WafPolicyManagedRuleSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafPolicyManagedRuleSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafPolicyManagedRuleSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafPolicyManagedRuleSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafPolicyManagedRuleSet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafPolicyManagedRuleSet(Response response) + { + if (response is null) + { + return null; } - return new WafPolicyManagedRuleSet(ruleSetType, ruleSetVersion, Optional.ToNullable(anomalyScore), Optional.ToList(ruleGroupOverrides)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafPolicyManagedRuleSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.cs index 7e08b29f29f5..56ddbb1eacbc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicyManagedRuleSet.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Cdn.Models /// Defines a managed rule set. public partial class WafPolicyManagedRuleSet { - /// Initializes a new instance of WafPolicyManagedRuleSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the rule set type to use. /// Defines the version of the rule set to use. /// or is null. @@ -28,17 +31,24 @@ public WafPolicyManagedRuleSet(string ruleSetType, string ruleSetVersion) RuleGroupOverrides = new ChangeTrackingList(); } - /// Initializes a new instance of WafPolicyManagedRuleSet. + /// Initializes a new instance of . /// Defines the rule set type to use. /// Defines the version of the rule set to use. /// Verizon only : If the rule set supports anomaly detection mode, this describes the threshold for blocking requests. /// Defines the rule overrides to apply to the rule set. - internal WafPolicyManagedRuleSet(string ruleSetType, string ruleSetVersion, int? anomalyScore, IList ruleGroupOverrides) + /// Keeps track of any properties unknown to the library. + internal WafPolicyManagedRuleSet(string ruleSetType, string ruleSetVersion, int? anomalyScore, IList ruleGroupOverrides, Dictionary serializedAdditionalRawData) { RuleSetType = ruleSetType; RuleSetVersion = ruleSetVersion; AnomalyScore = anomalyScore; RuleGroupOverrides = ruleGroupOverrides; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WafPolicyManagedRuleSet() + { } /// Defines the rule set type to use. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.Serialization.cs index a6c70b878ca7..92a342861c30 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafPolicySettings : IUtf8JsonSerializable + public partial class WafPolicySettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EnabledState)) { @@ -59,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("defaultCustomBlockResponseBody"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WafPolicySettings DeserializeWafPolicySettings(JsonElement element) + internal static WafPolicySettings DeserializeWafPolicySettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +94,7 @@ internal static WafPolicySettings DeserializeWafPolicySettings(JsonElement eleme Optional defaultRedirectUri = default; Optional defaultCustomBlockResponseStatusCode = default; Optional defaultCustomBlockResponseBody = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabledState"u8)) @@ -122,8 +144,61 @@ internal static WafPolicySettings DeserializeWafPolicySettings(JsonElement eleme defaultCustomBlockResponseBody = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WafPolicySettings(Optional.ToNullable(enabledState), Optional.ToNullable(mode), defaultRedirectUri.Value, Optional.ToNullable(defaultCustomBlockResponseStatusCode), defaultCustomBlockResponseBody.Value); + return new WafPolicySettings(Optional.ToNullable(enabledState), Optional.ToNullable(mode), defaultRedirectUri.Value, Optional.ToNullable(defaultCustomBlockResponseStatusCode), defaultCustomBlockResponseBody.Value, serializedAdditionalRawData); + } + + WafPolicySettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafPolicySettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafPolicySettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafPolicySettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafPolicySettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafPolicySettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafPolicySettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.cs index 9b7451294026..cfc0a647cda9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafPolicySettings.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Cdn.Models { /// Defines contents of a web application firewall global configuration. public partial class WafPolicySettings { - /// Initializes a new instance of WafPolicySettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WafPolicySettings() { } - /// Initializes a new instance of WafPolicySettings. + /// Initializes a new instance of . /// describes if the policy is in enabled state or disabled state. /// Describes if it is in detection mode or prevention mode at policy level. /// If action type is redirect, this field represents the default redirect URL for the client. /// If the action type is block, this field defines the default customer overridable http response status code. /// If the action type is block, customer can override the response body. The body must be specified in base64 encoding. - internal WafPolicySettings(PolicyEnabledState? enabledState, PolicyMode? mode, Uri defaultRedirectUri, PolicySettingsDefaultCustomBlockResponseStatusCode? defaultCustomBlockResponseStatusCode, BinaryData defaultCustomBlockResponseBody) + /// Keeps track of any properties unknown to the library. + internal WafPolicySettings(PolicyEnabledState? enabledState, PolicyMode? mode, Uri defaultRedirectUri, PolicySettingsDefaultCustomBlockResponseStatusCode? defaultCustomBlockResponseStatusCode, BinaryData defaultCustomBlockResponseBody, Dictionary serializedAdditionalRawData) { EnabledState = enabledState; Mode = mode; DefaultRedirectUri = defaultRedirectUri; DefaultCustomBlockResponseStatusCode = defaultCustomBlockResponseStatusCode; DefaultCustomBlockResponseBody = defaultCustomBlockResponseBody; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// describes if the policy is in enabled state or disabled state. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.Serialization.cs index 135ac2ee63c0..8623fba2953e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.Serialization.cs @@ -8,14 +8,77 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafRankingsResponse + public partial class WafRankingsResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WafRankingsResponse DeserializeWafRankingsResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DateTimeBegin)) + { + writer.WritePropertyName("dateTimeBegin"u8); + writer.WriteStringValue(DateTimeBegin.Value, "O"); + } + if (Optional.IsDefined(DateTimeEnd)) + { + writer.WritePropertyName("dateTimeEnd"u8); + writer.WriteStringValue(DateTimeEnd.Value, "O"); + } + if (Optional.IsCollectionDefined(Groups)) + { + writer.WritePropertyName("groups"u8); + writer.WriteStartArray(); + foreach (var item in Groups) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WafRankingsResponse DeserializeWafRankingsResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +87,7 @@ internal static WafRankingsResponse DeserializeWafRankingsResponse(JsonElement e Optional dateTimeEnd = default; Optional> groups = default; Optional> data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dateTimeBegin"u8)) @@ -72,8 +136,61 @@ internal static WafRankingsResponse DeserializeWafRankingsResponse(JsonElement e data = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WafRankingsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToList(groups), Optional.ToList(data)); + return new WafRankingsResponse(Optional.ToNullable(dateTimeBegin), Optional.ToNullable(dateTimeEnd), Optional.ToList(groups), Optional.ToList(data), serializedAdditionalRawData); + } + + WafRankingsResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafRankingsResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafRankingsResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafRankingsResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafRankingsResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafRankingsResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafRankingsResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.cs index c6fbc535f4d5..867248af5458 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponse.cs @@ -14,24 +14,29 @@ namespace Azure.ResourceManager.Cdn.Models /// Waf Rankings Response. public partial class WafRankingsResponse { - /// Initializes a new instance of WafRankingsResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WafRankingsResponse() { Groups = new ChangeTrackingList(); Data = new ChangeTrackingList(); } - /// Initializes a new instance of WafRankingsResponse. + /// Initializes a new instance of . /// /// /// /// - internal WafRankingsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, IReadOnlyList groups, IReadOnlyList data) + /// Keeps track of any properties unknown to the library. + internal WafRankingsResponse(DateTimeOffset? dateTimeBegin, DateTimeOffset? dateTimeEnd, IReadOnlyList groups, IReadOnlyList data, Dictionary serializedAdditionalRawData) { DateTimeBegin = dateTimeBegin; DateTimeEnd = dateTimeEnd; Groups = groups; Data = data; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the date time begin. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.Serialization.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.Serialization.cs index 50d439a716f1..3045e178cbad 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.Serialization.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.Serialization.cs @@ -5,22 +5,77 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Cdn.Models { - public partial class WafRankingsResponseDataItem + public partial class WafRankingsResponseDataItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WafRankingsResponseDataItem DeserializeWafRankingsResponseDataItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(GroupValues)) + { + writer.WritePropertyName("groupValues"u8); + writer.WriteStartArray(); + foreach (var item in GroupValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WafRankingsResponseDataItem DeserializeWafRankingsResponseDataItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> groupValues = default; Optional> metrics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("groupValues"u8)) @@ -51,8 +106,61 @@ internal static WafRankingsResponseDataItem DeserializeWafRankingsResponseDataIt metrics = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WafRankingsResponseDataItem(Optional.ToList(groupValues), Optional.ToList(metrics)); + return new WafRankingsResponseDataItem(Optional.ToList(groupValues), Optional.ToList(metrics), serializedAdditionalRawData); + } + + WafRankingsResponseDataItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWafRankingsResponseDataItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WafRankingsResponseDataItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWafRankingsResponseDataItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WafRankingsResponseDataItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WafRankingsResponseDataItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWafRankingsResponseDataItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.cs index cfac6aea3e77..c1c961853d4e 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/WafRankingsResponseDataItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Cdn.Models /// The WafRankingsResponseDataItem. public partial class WafRankingsResponseDataItem { - /// Initializes a new instance of WafRankingsResponseDataItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WafRankingsResponseDataItem() { GroupValues = new ChangeTrackingList(); Metrics = new ChangeTrackingList(); } - /// Initializes a new instance of WafRankingsResponseDataItem. + /// Initializes a new instance of . /// /// - internal WafRankingsResponseDataItem(IReadOnlyList groupValues, IReadOnlyList metrics) + /// Keeps track of any properties unknown to the library. + internal WafRankingsResponseDataItem(IReadOnlyList groupValues, IReadOnlyList metrics, Dictionary serializedAdditionalRawData) { GroupValues = groupValues; Metrics = metrics; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the group values. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs index b42e9ed370e2..36851dabee39 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _profileRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _profileRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), _profileClientDiagnostics, Pipeline, "ProfileCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), _profileClientDiagnostics, Pipeline, "ProfileCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _profileRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _profileRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), _profileClientDiagnostics, Pipeline, "ProfileCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), _profileClientDiagnostics, Pipeline, "ProfileCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileData.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileData.cs index 8d56d470de87..65b347b5ce9d 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileData.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Cdn /// public partial class ProfileData : TrackedResourceData { - /// Initializes a new instance of ProfileData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The pricing tier (defines Azure Front Door Standard or Premium or a CDN provider, feature list and rate) of the profile. /// is null. @@ -30,7 +33,7 @@ public ProfileData(AzureLocation location, CdnSku sku) : base(location) Sku = sku; } - /// Initializes a new instance of ProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +46,8 @@ public ProfileData(AzureLocation location, CdnSku sku) : base(location) /// Provisioning status of the profile. /// The Id of the frontdoor. /// Send and receive timeout on forwarding request to the origin. When timeout is reached, the request fails and returns. - internal ProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CdnSku sku, string kind, ProfileResourceState? resourceState, ProfileProvisioningState? provisioningState, Guid? frontDoorId, int? originResponseTimeoutSeconds) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CdnSku sku, string kind, ProfileResourceState? resourceState, ProfileProvisioningState? provisioningState, Guid? frontDoorId, int? originResponseTimeoutSeconds, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Kind = kind; @@ -51,6 +55,12 @@ internal ProfileData(ResourceIdentifier id, string name, ResourceType resourceTy ProvisioningState = provisioningState; FrontDoorId = frontDoorId; OriginResponseTimeoutSeconds = originResponseTimeoutSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ProfileData() + { } /// The pricing tier (defines Azure Front Door Standard or Premium or a CDN provider, feature list and rate) of the profile. diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnCustomDomainsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnCustomDomainsRestOperations.cs index 52aec5133057..d2158a39c1a1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnCustomDomainsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnCustomDomainsRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -499,9 +497,7 @@ internal HttpMessage CreateEnableCustomHttpsRequest(string subscriptionId, strin if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnEndpointsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnEndpointsRestOperations.cs index a2e81e63eccf..ba109cc3c08f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnEndpointsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnEndpointsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -309,9 +307,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -626,9 +622,7 @@ internal HttpMessage CreatePurgeContentRequest(string subscriptionId, string res request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -711,9 +705,7 @@ internal HttpMessage CreateLoadContentRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -796,9 +788,7 @@ internal HttpMessage CreateValidateCustomDomainRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnManagementRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnManagementRestOperations.cs index dc5f239a4d52..f1725f5b7c40 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnManagementRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnManagementRestOperations.cs @@ -53,9 +53,7 @@ internal HttpMessage CreateCheckEndpointNameAvailabilityRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -130,9 +128,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(CdnNameAvailabilityConte request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -199,9 +195,7 @@ internal HttpMessage CreateCheckNameAvailabilityWithSubscriptionRequest(string s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -274,9 +268,7 @@ internal HttpMessage CreateValidateProbeRequest(string subscriptionId, ValidateP request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginGroupsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginGroupsRestOperations.cs index d4b57e83284b..3c6b793f19a7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginGroupsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginGroupsRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -329,9 +327,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginsRestOperations.cs index f403e355d862..8b48ccc1e5b7 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/CdnOriginsRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -329,9 +327,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorCustomDomainsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorCustomDomainsRestOperations.cs index 878bcc896906..8e52c7d812d3 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorCustomDomainsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorCustomDomainsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -309,9 +307,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorEndpointsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorEndpointsRestOperations.cs index 2383b034aa32..29549ce24df2 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorEndpointsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorEndpointsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -309,9 +307,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -472,9 +468,7 @@ internal HttpMessage CreatePurgeContentRequest(string subscriptionId, string res request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -642,9 +636,7 @@ internal HttpMessage CreateValidateCustomDomainRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginGroupsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginGroupsRestOperations.cs index d1ba5c828d11..de9da08d33b9 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginGroupsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginGroupsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -309,9 +307,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginsRestOperations.cs index 5163902d5d34..34c587e0d1fc 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorOriginsRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -329,9 +327,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorProfilesRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorProfilesRestOperations.cs index ed9b79a31042..a23c9574276b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorProfilesRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorProfilesRestOperations.cs @@ -134,9 +134,7 @@ internal HttpMessage CreateCheckHostNameAvailabilityRequest(string subscriptionI request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRoutesRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRoutesRestOperations.cs index e58a00fc1cf0..3bb84c57cb0a 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRoutesRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRoutesRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -329,9 +327,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRulesRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRulesRestOperations.cs index 737871f392df..e4ec6dd4434b 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRulesRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorRulesRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -329,9 +327,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecretsRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecretsRestOperations.cs index df30aa50f99e..97f5663317c0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecretsRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecretsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecurityPoliciesRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecurityPoliciesRestOperations.cs index e2f817782ea5..692287554eb1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecurityPoliciesRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/FrontDoorSecurityPoliciesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -309,9 +307,7 @@ internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGr request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/PoliciesRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/PoliciesRestOperations.cs index 18e1a4702e7e..d11e1a20ddb5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/PoliciesRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/PoliciesRestOperations.cs @@ -209,9 +209,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -289,9 +287,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/ProfilesRestOperations.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/ProfilesRestOperations.cs index 9fa159c3bef4..0fbafc4bcea8 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/ProfilesRestOperations.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/RestOperations/ProfilesRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -356,9 +354,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/ArmChangeAnalysisModelFactory.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/ArmChangeAnalysisModelFactory.cs index 3cd04d94008b..7c534b777f9a 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/ArmChangeAnalysisModelFactory.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/ArmChangeAnalysisModelFactory.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.ChangeAnalysis.Models /// Model factory for models. public static partial class ArmChangeAnalysisModelFactory { - /// Initializes a new instance of DetectedChangeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -25,10 +25,10 @@ public static partial class ArmChangeAnalysisModelFactory /// A new instance for mocking. public static DetectedChangeData DetectedChangeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ChangeProperties properties = null) { - return new DetectedChangeData(id, name, resourceType, systemData, properties); + return new DetectedChangeData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of ChangeProperties. + /// Initializes a new instance of . /// The resource id that the change is attached to. /// The time when the change is detected. /// @@ -43,10 +43,10 @@ public static ChangeProperties ChangeProperties(ResourceIdentifier resourceId = initiatedByList ??= new List(); propertyChanges ??= new List(); - return new ChangeProperties(resourceId, changeDetectedOn, initiatedByList?.ToList(), changeType, propertyChanges?.ToList()); + return new ChangeProperties(resourceId, changeDetectedOn, initiatedByList?.ToList(), changeType, propertyChanges?.ToList(), default); } - /// Initializes a new instance of PropertyChange. + /// Initializes a new instance of . /// The type of the change. /// The change category. /// The json path of the changed property. @@ -59,7 +59,7 @@ public static ChangeProperties ChangeProperties(ResourceIdentifier resourceId = /// A new instance for mocking. public static PropertyChange PropertyChange(ChangeType? changeType = null, ChangeCategory? changeCategory = null, string jsonPath = null, string displayName = null, PropertyChangeLevel? level = null, string description = null, string oldValue = null, string newValue = null, bool? isDataMasked = null) { - return new PropertyChange(changeType, changeCategory, jsonPath, displayName, level, description, oldValue, newValue, isDataMasked); + return new PropertyChange(changeType, changeCategory, jsonPath, displayName, level, description, oldValue, newValue, isDataMasked, default); } } } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.Serialization.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.Serialization.cs index 5880bf0c1932..cdcfbeb0ced2 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.Serialization.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ChangeAnalysis.Models { - internal partial class ChangeList + internal partial class ChangeList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChangeList DeserializeChangeList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChangeList DeserializeChangeList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static ChangeList DeserializeChangeList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChangeList(Optional.ToList(value), nextLink.Value); + return new ChangeList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ChangeList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChangeList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChangeList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChangeList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChangeList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChangeList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChangeList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.cs index 9b442e1b09db..7e97d63595a1 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ChangeAnalysis.Models /// The list of detected changes. internal partial class ChangeList { - /// Initializes a new instance of ChangeList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ChangeList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ChangeList. + /// Initializes a new instance of . /// The list of changes. /// The URI that can be used to request the next page of changes. - internal ChangeList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ChangeList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of changes. diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.Serialization.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.Serialization.cs index 21cb2056bd64..e3e8c31a2c96 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.Serialization.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.Serialization.cs @@ -8,14 +8,82 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ChangeAnalysis.Models { - public partial class ChangeProperties + public partial class ChangeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChangeProperties DeserializeChangeProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ChangeDetectedOn)) + { + writer.WritePropertyName("timeStamp"u8); + writer.WriteStringValue(ChangeDetectedOn.Value, "O"); + } + if (Optional.IsCollectionDefined(InitiatedByList)) + { + writer.WritePropertyName("initiatedByList"u8); + writer.WriteStartArray(); + foreach (var item in InitiatedByList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ChangeType)) + { + writer.WritePropertyName("changeType"u8); + writer.WriteStringValue(ChangeType.Value.ToString()); + } + if (Optional.IsCollectionDefined(PropertyChanges)) + { + writer.WritePropertyName("propertyChanges"u8); + writer.WriteStartArray(); + foreach (var item in PropertyChanges) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChangeProperties DeserializeChangeProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +93,7 @@ internal static ChangeProperties DeserializeChangeProperties(JsonElement element Optional> initiatedByList = default; Optional changeType = default; Optional> propertyChanges = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -82,8 +151,61 @@ internal static ChangeProperties DeserializeChangeProperties(JsonElement element propertyChanges = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChangeProperties(resourceId.Value, Optional.ToNullable(timeStamp), Optional.ToList(initiatedByList), Optional.ToNullable(changeType), Optional.ToList(propertyChanges), serializedAdditionalRawData); + } + + ChangeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChangeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChangeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChangeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChangeProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChangeProperties(Response response) + { + if (response is null) + { + return null; } - return new ChangeProperties(resourceId.Value, Optional.ToNullable(timeStamp), Optional.ToList(initiatedByList), Optional.ToNullable(changeType), Optional.ToList(propertyChanges)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChangeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.cs index 5ab46eda3d20..52258d6d944f 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/ChangeProperties.cs @@ -14,14 +14,17 @@ namespace Azure.ResourceManager.ChangeAnalysis.Models /// The properties of a change. public partial class ChangeProperties { - /// Initializes a new instance of ChangeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ChangeProperties() { InitiatedByList = new ChangeTrackingList(); PropertyChanges = new ChangeTrackingList(); } - /// Initializes a new instance of ChangeProperties. + /// Initializes a new instance of . /// The resource id that the change is attached to. /// The time when the change is detected. /// @@ -30,13 +33,15 @@ internal ChangeProperties() /// /// The type of the change. /// The list of detailed changes at json property level. - internal ChangeProperties(ResourceIdentifier resourceId, DateTimeOffset? changeDetectedOn, IReadOnlyList initiatedByList, ChangeType? changeType, IReadOnlyList propertyChanges) + /// Keeps track of any properties unknown to the library. + internal ChangeProperties(ResourceIdentifier resourceId, DateTimeOffset? changeDetectedOn, IReadOnlyList initiatedByList, ChangeType? changeType, IReadOnlyList propertyChanges, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; ChangeDetectedOn = changeDetectedOn; InitiatedByList = initiatedByList; ChangeType = changeType; PropertyChanges = propertyChanges; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource id that the change is attached to. diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.Serialization.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.Serialization.cs index 0d78de83d723..0b5e6f6c1a60 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.Serialization.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.Serialization.cs @@ -5,16 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ChangeAnalysis.Models { - public partial class DetectedChangeData + public partial class DetectedChangeData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DetectedChangeData DeserializeDetectedChangeData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DetectedChangeData DeserializeDetectedChangeData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +64,7 @@ internal static DetectedChangeData DeserializeDetectedChangeData(JsonElement ele string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -59,8 +100,61 @@ internal static DetectedChangeData DeserializeDetectedChangeData(JsonElement ele systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DetectedChangeData(id, name, type, systemData.Value, properties.Value); + return new DetectedChangeData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + DetectedChangeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDetectedChangeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DetectedChangeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDetectedChangeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DetectedChangeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DetectedChangeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDetectedChangeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.cs index 19f1b6a68d1d..2551631ef1cf 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/DetectedChangeData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.ChangeAnalysis.Models /// The detected change. public partial class DetectedChangeData : ResourceData { - /// Initializes a new instance of DetectedChangeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DetectedChangeData() { } - /// Initializes a new instance of DetectedChangeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The properties of a change. - internal DetectedChangeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChangeProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DetectedChangeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChangeProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The properties of a change. diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.Serialization.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.Serialization.cs index 706f0fab25ac..dc6592216456 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.Serialization.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.Serialization.cs @@ -5,15 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ChangeAnalysis.Models { - public partial class PropertyChange + public partial class PropertyChange : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PropertyChange DeserializePropertyChange(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ChangeType)) + { + writer.WritePropertyName("changeType"u8); + writer.WriteStringValue(ChangeType.Value.ToString()); + } + if (Optional.IsDefined(ChangeCategory)) + { + writer.WritePropertyName("changeCategory"u8); + writer.WriteStringValue(ChangeCategory.Value.ToSerialString()); + } + if (Optional.IsDefined(JsonPath)) + { + writer.WritePropertyName("jsonPath"u8); + writer.WriteStringValue(JsonPath); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Level)) + { + writer.WritePropertyName("level"u8); + writer.WriteStringValue(Level.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(OldValue)) + { + writer.WritePropertyName("oldValue"u8); + writer.WriteStringValue(OldValue); + } + if (Optional.IsDefined(NewValue)) + { + writer.WritePropertyName("newValue"u8); + writer.WriteStringValue(NewValue); + } + if (Optional.IsDefined(IsDataMasked)) + { + writer.WritePropertyName("isDataMasked"u8); + writer.WriteBooleanValue(IsDataMasked.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PropertyChange DeserializePropertyChange(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +100,7 @@ internal static PropertyChange DeserializePropertyChange(JsonElement element) Optional oldValue = default; Optional newValue = default; Optional isDataMasked = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("changeType"u8)) @@ -90,8 +164,61 @@ internal static PropertyChange DeserializePropertyChange(JsonElement element) isDataMasked = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PropertyChange(Optional.ToNullable(changeType), Optional.ToNullable(changeCategory), jsonPath.Value, displayName.Value, Optional.ToNullable(level), description.Value, oldValue.Value, newValue.Value, Optional.ToNullable(isDataMasked), serializedAdditionalRawData); + } + + PropertyChange IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePropertyChange(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PropertyChange IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePropertyChange(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PropertyChange model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PropertyChange(Response response) + { + if (response is null) + { + return null; } - return new PropertyChange(Optional.ToNullable(changeType), Optional.ToNullable(changeCategory), jsonPath.Value, displayName.Value, Optional.ToNullable(level), description.Value, oldValue.Value, newValue.Value, Optional.ToNullable(isDataMasked)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePropertyChange(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.cs index edab3fb39381..239c1f225aa5 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Models/PropertyChange.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ChangeAnalysis.Models { /// Data of a property change. public partial class PropertyChange { - /// Initializes a new instance of PropertyChange. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PropertyChange() { } - /// Initializes a new instance of PropertyChange. + /// Initializes a new instance of . /// The type of the change. /// The change category. /// The json path of the changed property. @@ -25,7 +31,8 @@ internal PropertyChange() /// The value of the property before the change. /// The value of the property after the change. /// The boolean indicating whether the oldValue and newValue are masked. The values are masked if it contains sensitive information that the user doesn't have access to. - internal PropertyChange(ChangeType? changeType, ChangeCategory? changeCategory, string jsonPath, string displayName, PropertyChangeLevel? level, string description, string oldValue, string newValue, bool? isDataMasked) + /// Keeps track of any properties unknown to the library. + internal PropertyChange(ChangeType? changeType, ChangeCategory? changeCategory, string jsonPath, string displayName, PropertyChangeLevel? level, string description, string oldValue, string newValue, bool? isDataMasked, Dictionary serializedAdditionalRawData) { ChangeType = changeType; ChangeCategory = changeCategory; @@ -36,6 +43,7 @@ internal PropertyChange(ChangeType? changeType, ChangeCategory? changeCategory, OldValue = oldValue; NewValue = newValue; IsDataMasked = isDataMasked; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the change. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ArmChaosModelFactory.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ArmChaosModelFactory.cs index 0725514a2f7a..297f6cee8ecc 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ArmChaosModelFactory.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ArmChaosModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Chaos.Models /// Model factory for models. public static partial class ArmChaosModelFactory { - /// Initializes a new instance of CapabilityData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,10 +30,10 @@ public static partial class ArmChaosModelFactory /// A new instance for mocking. public static CapabilityData CapabilityData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string publisher = null, string targetType = null, string description = null, string parametersSchema = null, string urn = null) { - return new CapabilityData(id, name, resourceType, systemData, publisher, targetType, description, parametersSchema, urn); + return new CapabilityData(id, name, resourceType, systemData, publisher, targetType, description, parametersSchema, urn, default); } - /// Initializes a new instance of CapabilityTypeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,10 +50,10 @@ public static CapabilityData CapabilityData(ResourceIdentifier id = null, string /// A new instance for mocking. public static CapabilityTypeData CapabilityTypeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, string publisher = null, string targetType = null, string displayName = null, string description = null, string parametersSchema = null, string urn = null, string kind = null, string runtimeKind = null) { - return new CapabilityTypeData(id, name, resourceType, systemData, location, publisher, targetType, displayName, description, parametersSchema, urn, kind, runtimeKind != null ? new CapabilityTypePropertiesRuntimeProperties(runtimeKind) : null); + return new CapabilityTypeData(id, name, resourceType, systemData, location, publisher, targetType, displayName, description, parametersSchema, urn, kind, runtimeKind != null ? new CapabilityTypePropertiesRuntimeProperties(runtimeKind, new Dictionary()) : null, default); } - /// Initializes a new instance of ExperimentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -71,37 +71,37 @@ public static ExperimentData ExperimentData(ResourceIdentifier id = null, string steps ??= new List(); selectors ??= new List(); - return new ExperimentData(id, name, resourceType, systemData, tags, location, identity, steps?.ToList(), selectors?.ToList(), startOnCreation); + return new ExperimentData(id, name, resourceType, systemData, tags, location, identity, steps?.ToList(), selectors?.ToList(), startOnCreation, default); } - /// Initializes a new instance of TargetReference. + /// Initializes a new instance of . /// Enum of the Target reference type. /// String of the resource ID of a Target resource. /// A new instance for mocking. public static TargetReference TargetReference(TargetReferenceType referenceType = default, string id = null) { - return new TargetReference(referenceType, id); + return new TargetReference(referenceType, id, default); } - /// Initializes a new instance of ExperimentCancelOperationResult. + /// Initializes a new instance of . /// String of the Experiment name. /// URL to retrieve the Experiment status. /// A new instance for mocking. public static ExperimentCancelOperationResult ExperimentCancelOperationResult(string name = null, string statusUri = null) { - return new ExperimentCancelOperationResult(name, statusUri); + return new ExperimentCancelOperationResult(name, statusUri, default); } - /// Initializes a new instance of ExperimentStartOperationResult. + /// Initializes a new instance of . /// String of the Experiment name. /// URL to retrieve the Experiment status. /// A new instance for mocking. public static ExperimentStartOperationResult ExperimentStartOperationResult(string name = null, string statusUri = null) { - return new ExperimentStartOperationResult(name, statusUri); + return new ExperimentStartOperationResult(name, statusUri, default); } - /// Initializes a new instance of ExperimentStatusData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -112,10 +112,10 @@ public static ExperimentStartOperationResult ExperimentStartOperationResult(stri /// A new instance for mocking. public static ExperimentStatusData ExperimentStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string status = null, DateTimeOffset? createdDateUtc = null, DateTimeOffset? endDateUtc = null) { - return new ExperimentStatusData(id, name, resourceType, systemData, status, createdDateUtc, endDateUtc); + return new ExperimentStatusData(id, name, resourceType, systemData, status, createdDateUtc, endDateUtc, default); } - /// Initializes a new instance of ExperimentExecutionDetailData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -133,10 +133,10 @@ public static ExperimentExecutionDetailData ExperimentExecutionDetailData(Resour { runInformationSteps ??= new List(); - return new ExperimentExecutionDetailData(id, name, resourceType, systemData, experimentId, status, failureReason, createdOn, lastActionOn, startOn, stopOn, runInformationSteps != null ? new ExperimentExecutionDetailsPropertiesRunInformation(runInformationSteps?.ToList()) : null); + return new ExperimentExecutionDetailData(id, name, resourceType, systemData, experimentId, status, failureReason, createdOn, lastActionOn, startOn, stopOn, runInformationSteps != null ? new ExperimentExecutionDetailsPropertiesRunInformation(runInformationSteps?.ToList(), new Dictionary()) : null, default); } - /// Initializes a new instance of StepStatus. + /// Initializes a new instance of . /// The name of the step. /// The id of the step. /// The value of the status of the step. @@ -146,10 +146,10 @@ public static StepStatus StepStatus(string stepName = null, string stepId = null { branches ??= new List(); - return new StepStatus(stepName, stepId, status, branches?.ToList()); + return new StepStatus(stepName, stepId, status, branches?.ToList(), default); } - /// Initializes a new instance of BranchStatus. + /// Initializes a new instance of . /// The name of the branch status. /// The id of the branch status. /// The status of the branch. @@ -159,10 +159,10 @@ public static BranchStatus BranchStatus(string branchName = null, string branchI { actions ??= new List(); - return new BranchStatus(branchName, branchId, status, actions?.ToList()); + return new BranchStatus(branchName, branchId, status, actions?.ToList(), default); } - /// Initializes a new instance of ActionStatus. + /// Initializes a new instance of . /// The name of the action status. /// The id of the action status. /// The status of the action. @@ -174,10 +174,10 @@ public static ActionStatus ActionStatus(string actionName = null, string actionI { targets ??= new List(); - return new ActionStatus(actionName, actionId, status, startOn, endOn, targets?.ToList()); + return new ActionStatus(actionName, actionId, status, startOn, endOn, targets?.ToList(), default); } - /// Initializes a new instance of ExperimentExecutionActionTargetDetailsProperties. + /// Initializes a new instance of . /// The status of the execution. /// The target for the action. /// String that represents the failed date time. @@ -186,19 +186,19 @@ public static ActionStatus ActionStatus(string actionName = null, string actionI /// A new instance for mocking. public static ExperimentExecutionActionTargetDetailsProperties ExperimentExecutionActionTargetDetailsProperties(string status = null, string target = null, DateTimeOffset? targetFailedOn = null, DateTimeOffset? targetCompletedOn = null, ExperimentExecutionActionTargetDetailsError error = null) { - return new ExperimentExecutionActionTargetDetailsProperties(status, target, targetFailedOn, targetCompletedOn, error); + return new ExperimentExecutionActionTargetDetailsProperties(status, target, targetFailedOn, targetCompletedOn, error, default); } - /// Initializes a new instance of ExperimentExecutionActionTargetDetailsError. + /// Initializes a new instance of . /// The error code. /// The error message. /// A new instance for mocking. public static ExperimentExecutionActionTargetDetailsError ExperimentExecutionActionTargetDetailsError(string code = null, string message = null) { - return new ExperimentExecutionActionTargetDetailsError(code, message); + return new ExperimentExecutionActionTargetDetailsError(code, message, default); } - /// Initializes a new instance of TargetTypeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -213,10 +213,10 @@ public static TargetTypeData TargetTypeData(ResourceIdentifier id = null, string { resourceTypes ??= new List(); - return new TargetTypeData(id, name, resourceType, systemData, location, displayName, description, propertiesSchema, resourceTypes?.ToList()); + return new TargetTypeData(id, name, resourceType, systemData, location, displayName, description, propertiesSchema, resourceTypes?.ToList(), default); } - /// Initializes a new instance of TargetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -228,7 +228,7 @@ public static TargetData TargetData(ResourceIdentifier id = null, string name = { properties ??= new Dictionary(); - return new TargetData(id, name, resourceType, systemData, location, properties); + return new TargetData(id, name, resourceType, systemData, location, properties, default); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs index 78425fc19442..34cc7a0865ad 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string continuation { HttpMessage FirstPageRequest(int? pageSizeHint) => _capabilityRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capabilityRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapabilityResource(Client, CapabilityData.DeserializeCapabilityData(e)), _capabilityClientDiagnostics, Pipeline, "CapabilityCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CapabilityResource(Client, CapabilityData.DeserializeCapabilityData(e)), _capabilityClientDiagnostics, Pipeline, "CapabilityCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string continuationToken = nu { HttpMessage FirstPageRequest(int? pageSizeHint) => _capabilityRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capabilityRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapabilityResource(Client, CapabilityData.DeserializeCapabilityData(e)), _capabilityClientDiagnostics, Pipeline, "CapabilityCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CapabilityResource(Client, CapabilityData.DeserializeCapabilityData(e)), _capabilityClientDiagnostics, Pipeline, "CapabilityCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityData.cs index 3830ceb75255..42cb45a74075 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.Chaos /// public partial class CapabilityData : ResourceData { - /// Initializes a new instance of CapabilityData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CapabilityData() { } - /// Initializes a new instance of CapabilityData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,13 +36,15 @@ public CapabilityData() /// Localized string of the description. /// URL to retrieve JSON schema of the Capability parameters. /// String of the URN for this Capability Type. - internal CapabilityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string publisher, string targetType, string description, string parametersSchema, string urn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CapabilityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string publisher, string targetType, string description, string parametersSchema, string urn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Publisher = publisher; TargetType = targetType; Description = description; ParametersSchema = parametersSchema; Urn = urn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// String of the Publisher that this Capability extends. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs index ad415b1235cf..5adb76bae69b 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAllAsync(string continua { HttpMessage FirstPageRequest(int? pageSizeHint) => _capabilityTypeRestClient.CreateListRequest(Id.SubscriptionId, Id.Parent.Name, Id.Name, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capabilityTypeRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.Parent.Name, Id.Name, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapabilityTypeResource(Client, CapabilityTypeData.DeserializeCapabilityTypeData(e)), _capabilityTypeClientDiagnostics, Pipeline, "CapabilityTypeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CapabilityTypeResource(Client, CapabilityTypeData.DeserializeCapabilityTypeData(e)), _capabilityTypeClientDiagnostics, Pipeline, "CapabilityTypeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(string continuationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _capabilityTypeRestClient.CreateListRequest(Id.SubscriptionId, Id.Parent.Name, Id.Name, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capabilityTypeRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.Parent.Name, Id.Name, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapabilityTypeResource(Client, CapabilityTypeData.DeserializeCapabilityTypeData(e)), _capabilityTypeClientDiagnostics, Pipeline, "CapabilityTypeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CapabilityTypeResource(Client, CapabilityTypeData.DeserializeCapabilityTypeData(e)), _capabilityTypeClientDiagnostics, Pipeline, "CapabilityTypeCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeData.cs index 121570175ccf..2e046c8bd5b3 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Chaos /// public partial class CapabilityTypeData : ResourceData { - /// Initializes a new instance of CapabilityTypeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CapabilityTypeData() { } - /// Initializes a new instance of CapabilityTypeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +41,8 @@ public CapabilityTypeData() /// String of the URN for this Capability Type. /// String of the kind of this Capability Type. /// Runtime properties of this Capability Type. - internal CapabilityTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string publisher, string targetType, string displayName, string description, string parametersSchema, string urn, string kind, CapabilityTypePropertiesRuntimeProperties runtimeProperties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CapabilityTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string publisher, string targetType, string displayName, string description, string parametersSchema, string urn, string kind, CapabilityTypePropertiesRuntimeProperties runtimeProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Publisher = publisher; @@ -47,6 +53,7 @@ internal CapabilityTypeData(ResourceIdentifier id, string name, ResourceType res Urn = urn; Kind = kind; RuntimeProperties = runtimeProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of the Capability Type resource. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs index cf2d28ccdd0b..9790236fab01 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(bool? running = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _experimentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, running, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _experimentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, running, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), _experimentClientDiagnostics, Pipeline, "ExperimentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), _experimentClientDiagnostics, Pipeline, "ExperimentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -255,7 +255,7 @@ public virtual Pageable GetAll(bool? running = null, string { HttpMessage FirstPageRequest(int? pageSizeHint) => _experimentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, running, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _experimentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, running, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), _experimentClientDiagnostics, Pipeline, "ExperimentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), _experimentClientDiagnostics, Pipeline, "ExperimentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentData.cs index d6c576f87f3a..4812312dbcba 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Chaos /// public partial class ExperimentData : TrackedResourceData { - /// Initializes a new instance of ExperimentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// List of steps. /// List of selectors. @@ -34,7 +37,7 @@ public ExperimentData(AzureLocation location, IEnumerable steps, IEnumerab Selectors = selectors.ToList(); } - /// Initializes a new instance of ExperimentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,12 +48,19 @@ public ExperimentData(AzureLocation location, IEnumerable steps, IEnumerab /// List of steps. /// List of selectors. /// A boolean value that indicates if experiment should be started on creation or not. - internal ExperimentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, IList steps, IList selectors, bool? startOnCreation) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ExperimentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, IList steps, IList selectors, bool? startOnCreation, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; Steps = steps; Selectors = selectors; StartOnCreation = startOnCreation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExperimentData() + { } /// The identity of the experiment resource. Current supported identity types: None, SystemAssigned. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs index 195ad0a3e089..adc3c9e35acb 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _experimentExecutionDetailExperimentsRestClient.CreateListExecutionDetailsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _experimentExecutionDetailExperimentsRestClient.CreateListExecutionDetailsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExperimentExecutionDetailResource(Client, ExperimentExecutionDetailData.DeserializeExperimentExecutionDetailData(e)), _experimentExecutionDetailExperimentsClientDiagnostics, Pipeline, "ExperimentExecutionDetailCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentExecutionDetailResource(Client, ExperimentExecutionDetailData.DeserializeExperimentExecutionDetailData(e)), _experimentExecutionDetailExperimentsClientDiagnostics, Pipeline, "ExperimentExecutionDetailCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _experimentExecutionDetailExperimentsRestClient.CreateListExecutionDetailsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _experimentExecutionDetailExperimentsRestClient.CreateListExecutionDetailsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExperimentExecutionDetailResource(Client, ExperimentExecutionDetailData.DeserializeExperimentExecutionDetailData(e)), _experimentExecutionDetailExperimentsClientDiagnostics, Pipeline, "ExperimentExecutionDetailCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentExecutionDetailResource(Client, ExperimentExecutionDetailData.DeserializeExperimentExecutionDetailData(e)), _experimentExecutionDetailExperimentsClientDiagnostics, Pipeline, "ExperimentExecutionDetailCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailData.cs index abba9c4ef798..a9d5cac871fe 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailData.cs @@ -19,12 +19,15 @@ namespace Azure.ResourceManager.Chaos /// public partial class ExperimentExecutionDetailData : ResourceData { - /// Initializes a new instance of ExperimentExecutionDetailData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentExecutionDetailData() { } - /// Initializes a new instance of ExperimentExecutionDetailData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +40,8 @@ internal ExperimentExecutionDetailData() /// String that represents the start date time. /// String that represents the stop date time. /// The information of the experiment run. - internal ExperimentExecutionDetailData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string experimentId, string status, string failureReason, DateTimeOffset? createdOn, DateTimeOffset? lastActionOn, DateTimeOffset? startOn, DateTimeOffset? stopOn, ExperimentExecutionDetailsPropertiesRunInformation runInformation) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ExperimentExecutionDetailData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string experimentId, string status, string failureReason, DateTimeOffset? createdOn, DateTimeOffset? lastActionOn, DateTimeOffset? startOn, DateTimeOffset? stopOn, ExperimentExecutionDetailsPropertiesRunInformation runInformation, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ExperimentId = experimentId; Status = status; @@ -47,6 +51,7 @@ internal ExperimentExecutionDetailData(ResourceIdentifier id, string name, Resou StartOn = startOn; StopOn = stopOn; RunInformation = runInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the experiment. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs index acf5ece7b556..429a3793d6de 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _experimentStatusExperimentsRestClient.CreateListAllStatusesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _experimentStatusExperimentsRestClient.CreateListAllStatusesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExperimentStatusResource(Client, ExperimentStatusData.DeserializeExperimentStatusData(e)), _experimentStatusExperimentsClientDiagnostics, Pipeline, "ExperimentStatusCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentStatusResource(Client, ExperimentStatusData.DeserializeExperimentStatusData(e)), _experimentStatusExperimentsClientDiagnostics, Pipeline, "ExperimentStatusCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _experimentStatusExperimentsRestClient.CreateListAllStatusesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _experimentStatusExperimentsRestClient.CreateListAllStatusesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExperimentStatusResource(Client, ExperimentStatusData.DeserializeExperimentStatusData(e)), _experimentStatusExperimentsClientDiagnostics, Pipeline, "ExperimentStatusCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentStatusResource(Client, ExperimentStatusData.DeserializeExperimentStatusData(e)), _experimentStatusExperimentsClientDiagnostics, Pipeline, "ExperimentStatusCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusData.cs index 3d85a50f4251..f1e6eeaa7e86 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.Chaos /// public partial class ExperimentStatusData : ResourceData { - /// Initializes a new instance of ExperimentStatusData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentStatusData() { } - /// Initializes a new instance of ExperimentStatusData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +34,13 @@ internal ExperimentStatusData() /// String that represents the status of a Experiment. /// String that represents the created date time of a Experiment. /// String that represents the end date time of a Experiment. - internal ExperimentStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string status, DateTimeOffset? createdDateUtc, DateTimeOffset? endDateUtc) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ExperimentStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string status, DateTimeOffset? createdDateUtc, DateTimeOffset? endDateUtc, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Status = status; CreatedDateUtc = createdDateUtc; EndDateUtc = endDateUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// String that represents the status of a Experiment. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 6c32f2eb0fb8..4faf8c4a6f5c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -70,7 +70,7 @@ public virtual AsyncPageable GetExperimentsAsync(bool? runni { HttpMessage FirstPageRequest(int? pageSizeHint) => ExperimentRestClient.CreateListAllRequest(Id.SubscriptionId, running, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExperimentRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, running, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExperiments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExperiments", "value", "nextLink", cancellationToken); } /// @@ -94,7 +94,7 @@ public virtual Pageable GetExperiments(bool? running = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => ExperimentRestClient.CreateListAllRequest(Id.SubscriptionId, running, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExperimentRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, running, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExperiments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExperiments", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.Serialization.cs index 09e4bb2328ff..fa60d189b813 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class Action : IUtf8JsonSerializable + public partial class Action : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ActionType); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Action DeserializeAction(JsonElement element) + internal static Action DeserializeAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,7 +59,78 @@ internal static Action DeserializeAction(JsonElement element) case "discrete": return DiscreteAction.DeserializeDiscreteAction(element); } } - return UnknownAction.DeserializeUnknownAction(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownAction(type, name, serializedAdditionalRawData); + } + + Action IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Action IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Action model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Action(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.cs index b753291a1f6e..0a6b59a0c673 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Action.cs @@ -6,7 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { @@ -15,9 +17,13 @@ namespace Azure.ResourceManager.Chaos.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownAction))] public abstract partial class Action { - /// Initializes a new instance of Action. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// String that represents a Capability URN. /// is null. protected Action(string name) @@ -27,13 +33,20 @@ protected Action(string name) Name = name; } - /// Initializes a new instance of Action. + /// Initializes a new instance of . /// Enum that discriminates between action models. /// String that represents a Capability URN. - internal Action(string actionType, string name) + /// Keeps track of any properties unknown to the library. + internal Action(string actionType, string name, Dictionary serializedAdditionalRawData) { ActionType = actionType; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Action() + { } /// Enum that discriminates between action models. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.Serialization.cs index d351c98c0a84..37f083c54a6f 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class ActionStatus + public partial class ActionStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ActionStatus DeserializeActionStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ActionStatus DeserializeActionStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +52,7 @@ internal static ActionStatus DeserializeActionStatus(JsonElement element) Optional startTime = default; Optional endTime = default; Optional> targets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actionName"u8)) @@ -75,8 +102,61 @@ internal static ActionStatus DeserializeActionStatus(JsonElement element) targets = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ActionStatus(actionName.Value, actionId.Value, status.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(targets)); + return new ActionStatus(actionName.Value, actionId.Value, status.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(targets), serializedAdditionalRawData); + } + + ActionStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeActionStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ActionStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeActionStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ActionStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ActionStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeActionStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.cs index f94cf8e5be3b..e785a7369921 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ActionStatus.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents the an action and its status. public partial class ActionStatus { - /// Initializes a new instance of ActionStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ActionStatus() { Targets = new ChangeTrackingList(); } - /// Initializes a new instance of ActionStatus. + /// Initializes a new instance of . /// The name of the action status. /// The id of the action status. /// The status of the action. /// String that represents the start time of the action. /// String that represents the end time of the action. /// The array of targets. - internal ActionStatus(string actionName, string actionId, string status, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList targets) + /// Keeps track of any properties unknown to the library. + internal ActionStatus(string actionName, string actionId, string status, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList targets, Dictionary serializedAdditionalRawData) { ActionName = actionName; ActionId = actionId; @@ -35,6 +39,7 @@ internal ActionStatus(string actionName, string actionId, string status, DateTim StartOn = startOn; EndOn = endOn; Targets = targets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the action status. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.Serialization.cs index 763be75bf91f..31eb4662e88e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class Branch : IUtf8JsonSerializable + public partial class Branch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Actions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Branch DeserializeBranch(JsonElement element) + internal static Branch DeserializeBranch(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; IList actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -53,8 +82,61 @@ internal static Branch DeserializeBranch(JsonElement element) actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Branch(name, actions, serializedAdditionalRawData); + } + + Branch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBranch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Branch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBranch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Branch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Branch(Response response) + { + if (response is null) + { + return null; } - return new Branch(name, actions); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBranch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.cs index acc4eb719ae7..798589ebc2eb 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Branch.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a branch in the step. public partial class Branch { - /// Initializes a new instance of Branch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// String of the branch name. /// /// List of actions. @@ -32,17 +35,24 @@ public Branch(string name, IEnumerable actions) Actions = actions.ToList(); } - /// Initializes a new instance of Branch. + /// Initializes a new instance of . /// String of the branch name. /// /// List of actions. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// - internal Branch(string name, IList actions) + /// Keeps track of any properties unknown to the library. + internal Branch(string name, IList actions, Dictionary serializedAdditionalRawData) { Name = name; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Branch() + { } /// String of the branch name. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.Serialization.cs index 91c32dd351a3..9b3f500efced 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class BranchStatus + public partial class BranchStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BranchStatus DeserializeBranchStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BranchStatus DeserializeBranchStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static BranchStatus DeserializeBranchStatus(JsonElement element) Optional branchId = default; Optional status = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("branchName"u8)) @@ -54,8 +82,61 @@ internal static BranchStatus DeserializeBranchStatus(JsonElement element) actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BranchStatus(branchName.Value, branchId.Value, status.Value, Optional.ToList(actions)); + return new BranchStatus(branchName.Value, branchId.Value, status.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + BranchStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBranchStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BranchStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBranchStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BranchStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BranchStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBranchStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.cs index 92d0dbe172c3..5c814ee60a44 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/BranchStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents the a list of actions and action statuses. public partial class BranchStatus { - /// Initializes a new instance of BranchStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BranchStatus() { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of BranchStatus. + /// Initializes a new instance of . /// The name of the branch status. /// The id of the branch status. /// The status of the branch. /// The array of actions. - internal BranchStatus(string branchName, string branchId, string status, IReadOnlyList actions) + /// Keeps track of any properties unknown to the library. + internal BranchStatus(string branchName, string branchId, string status, IReadOnlyList actions, Dictionary serializedAdditionalRawData) { BranchName = branchName; BranchId = branchId; Status = status; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the branch status. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityData.Serialization.cs index eda9ead0d52f..3f6dcb8b8793 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class CapabilityData : IUtf8JsonSerializable + public partial class CapabilityData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CapabilityData DeserializeCapabilityData(JsonElement element) + internal static CapabilityData DeserializeCapabilityData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static CapabilityData DeserializeCapabilityData(JsonElement element) Optional description = default; Optional parametersSchema = default; Optional urn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -100,8 +123,61 @@ internal static CapabilityData DeserializeCapabilityData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapabilityData(id, name, type, systemData.Value, publisher.Value, targetType.Value, description.Value, parametersSchema.Value, urn.Value, serializedAdditionalRawData); + } + + CapabilityData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapabilityData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapabilityData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapabilityData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapabilityData model) + { + if (model is null) + { + return null; } - return new CapabilityData(id, name, type, systemData.Value, publisher.Value, targetType.Value, description.Value, parametersSchema.Value, urn.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapabilityData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapabilityData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.Serialization.cs index cecd654f7482..a63d7d77e467 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class CapabilityListResult + internal partial class CapabilityListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapabilityListResult DeserializeCapabilityListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapabilityListResult DeserializeCapabilityListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static CapabilityListResult DeserializeCapabilityListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapabilityListResult(Optional.ToList(value), nextLink.Value); + return new CapabilityListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CapabilityListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapabilityListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapabilityListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapabilityListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapabilityListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapabilityListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapabilityListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.cs index 9ceea7e91f24..d4d0a9325e9c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Capability resources and a link for pagination. internal partial class CapabilityListResult { - /// Initializes a new instance of CapabilityListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CapabilityListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CapabilityListResult. + /// Initializes a new instance of . /// List of Capability resources. /// URL to retrieve the next page of Capability resources. - internal CapabilityListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CapabilityListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Capability resources. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeData.Serialization.cs index 59c31cdcc415..de7b426067bf 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class CapabilityTypeData : IUtf8JsonSerializable + public partial class CapabilityTypeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -27,14 +35,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RuntimeProperties)) { writer.WritePropertyName("runtimeProperties"u8); - writer.WriteObjectValue(RuntimeProperties); + if (RuntimeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RuntimeProperties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CapabilityTypeData DeserializeCapabilityTypeData(JsonElement element) + internal static CapabilityTypeData DeserializeCapabilityTypeData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +81,7 @@ internal static CapabilityTypeData DeserializeCapabilityTypeData(JsonElement ele Optional urn = default; Optional kind = default; Optional runtimeProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -143,8 +173,61 @@ internal static CapabilityTypeData DeserializeCapabilityTypeData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapabilityTypeData(id, name, type, systemData.Value, Optional.ToNullable(location), publisher.Value, targetType.Value, displayName.Value, description.Value, parametersSchema.Value, urn.Value, kind.Value, runtimeProperties.Value, serializedAdditionalRawData); + } + + CapabilityTypeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapabilityTypeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapabilityTypeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapabilityTypeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapabilityTypeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapabilityTypeData(Response response) + { + if (response is null) + { + return null; } - return new CapabilityTypeData(id, name, type, systemData.Value, Optional.ToNullable(location), publisher.Value, targetType.Value, displayName.Value, description.Value, parametersSchema.Value, urn.Value, kind.Value, runtimeProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapabilityTypeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.Serialization.cs index 312852827b21..1fa45666199f 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class CapabilityTypeListResult + internal partial class CapabilityTypeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapabilityTypeListResult DeserializeCapabilityTypeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapabilityTypeListResult DeserializeCapabilityTypeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static CapabilityTypeListResult DeserializeCapabilityTypeListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapabilityTypeListResult(Optional.ToList(value), nextLink.Value); + return new CapabilityTypeListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CapabilityTypeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapabilityTypeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapabilityTypeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapabilityTypeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapabilityTypeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapabilityTypeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapabilityTypeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.cs index 121d21a98020..99489be63b21 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Capability Type resources and a link for pagination. internal partial class CapabilityTypeListResult { - /// Initializes a new instance of CapabilityTypeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CapabilityTypeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CapabilityTypeListResult. + /// Initializes a new instance of . /// List of Capability Type resources. /// URL to retrieve the next page of Capability Type resources. - internal CapabilityTypeListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CapabilityTypeListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Capability Type resources. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.Serialization.cs index f526ed3889f6..65d670790fb3 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - internal partial class CapabilityTypePropertiesRuntimeProperties : IUtf8JsonSerializable + internal partial class CapabilityTypePropertiesRuntimeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CapabilityTypePropertiesRuntimeProperties DeserializeCapabilityTypePropertiesRuntimeProperties(JsonElement element) + internal static CapabilityTypePropertiesRuntimeProperties DeserializeCapabilityTypePropertiesRuntimeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -32,8 +55,61 @@ internal static CapabilityTypePropertiesRuntimeProperties DeserializeCapabilityT kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapabilityTypePropertiesRuntimeProperties(kind.Value, serializedAdditionalRawData); + } + + CapabilityTypePropertiesRuntimeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapabilityTypePropertiesRuntimeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapabilityTypePropertiesRuntimeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapabilityTypePropertiesRuntimeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapabilityTypePropertiesRuntimeProperties model) + { + if (model is null) + { + return null; } - return new CapabilityTypePropertiesRuntimeProperties(kind.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapabilityTypePropertiesRuntimeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapabilityTypePropertiesRuntimeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.cs index 6ea4fcb3e1c7..286ce20528de 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/CapabilityTypePropertiesRuntimeProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Chaos.Models { /// Runtime properties of this Capability Type. internal partial class CapabilityTypePropertiesRuntimeProperties { - /// Initializes a new instance of CapabilityTypePropertiesRuntimeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CapabilityTypePropertiesRuntimeProperties() { } - /// Initializes a new instance of CapabilityTypePropertiesRuntimeProperties. + /// Initializes a new instance of . /// String of the kind of the resource's action type (continuous or discrete). - internal CapabilityTypePropertiesRuntimeProperties(string kind) + /// Keeps track of any properties unknown to the library. + internal CapabilityTypePropertiesRuntimeProperties(string kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// String of the kind of the resource's action type (continuous or discrete). diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.Serialization.cs index 6fb35f297c0f..d811f810677b 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class ContinuousAction : IUtf8JsonSerializable + public partial class ContinuousAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("duration"u8); writer.WriteStringValue(Duration, "P"); @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("selectorId"u8); @@ -32,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ActionType); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContinuousAction DeserializeContinuousAction(JsonElement element) + internal static ContinuousAction DeserializeContinuousAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +73,7 @@ internal static ContinuousAction DeserializeContinuousAction(JsonElement element string selectorId = default; string type = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("duration"u8)) @@ -78,8 +106,61 @@ internal static ContinuousAction DeserializeContinuousAction(JsonElement element name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContinuousAction(type, name, duration, parameters, selectorId, serializedAdditionalRawData); + } + + ContinuousAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousAction(Response response) + { + if (response is null) + { + return null; } - return new ContinuousAction(type, name, duration, parameters, selectorId); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.cs index 3243d46e6426..4f0a92a85920 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ContinuousAction.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a continuous action. public partial class ContinuousAction : Action { - /// Initializes a new instance of ContinuousAction. + /// Initializes a new instance of . /// String that represents a Capability URN. /// ISO8601 formatted string that represents a duration. /// List of key value pairs. @@ -33,13 +33,14 @@ public ContinuousAction(string name, TimeSpan duration, IEnumerable Initializes a new instance of ContinuousAction. + /// Initializes a new instance of . /// Enum that discriminates between action models. /// String that represents a Capability URN. /// ISO8601 formatted string that represents a duration. /// List of key value pairs. /// String that represents a selector. - internal ContinuousAction(string actionType, string name, TimeSpan duration, IList parameters, string selectorId) : base(actionType, name) + /// Keeps track of any properties unknown to the library. + internal ContinuousAction(string actionType, string name, TimeSpan duration, IList parameters, string selectorId, Dictionary serializedAdditionalRawData) : base(actionType, name, serializedAdditionalRawData) { Duration = duration; Parameters = parameters; @@ -47,6 +48,11 @@ internal ContinuousAction(string actionType, string name, TimeSpan duration, ILi ActionType = actionType ?? "continuous"; } + /// Initializes a new instance of for deserialization. + internal ContinuousAction() + { + } + /// ISO8601 formatted string that represents a duration. public TimeSpan Duration { get; set; } /// List of key value pairs. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.Serialization.cs index b44756191b4c..01d530b49318 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class DelayAction : IUtf8JsonSerializable + public partial class DelayAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("duration"u8); writer.WriteStringValue(Duration, "P"); @@ -22,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ActionType); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DelayAction DeserializeDelayAction(JsonElement element) + internal static DelayAction DeserializeDelayAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +55,7 @@ internal static DelayAction DeserializeDelayAction(JsonElement element) TimeSpan duration = default; string type = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("duration"u8)) @@ -51,8 +73,61 @@ internal static DelayAction DeserializeDelayAction(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DelayAction(type, name, duration, serializedAdditionalRawData); + } + + DelayAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDelayAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DelayAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDelayAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DelayAction model) + { + if (model is null) + { + return null; } - return new DelayAction(type, name, duration); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DelayAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDelayAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.cs index 581db568af78..718c39318cf6 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DelayAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Chaos.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a delay action. public partial class DelayAction : Action { - /// Initializes a new instance of DelayAction. + /// Initializes a new instance of . /// String that represents a Capability URN. /// ISO8601 formatted string that represents a duration. /// is null. @@ -25,16 +26,22 @@ public DelayAction(string name, TimeSpan duration) : base(name) ActionType = "delay"; } - /// Initializes a new instance of DelayAction. + /// Initializes a new instance of . /// Enum that discriminates between action models. /// String that represents a Capability URN. /// ISO8601 formatted string that represents a duration. - internal DelayAction(string actionType, string name, TimeSpan duration) : base(actionType, name) + /// Keeps track of any properties unknown to the library. + internal DelayAction(string actionType, string name, TimeSpan duration, Dictionary serializedAdditionalRawData) : base(actionType, name, serializedAdditionalRawData) { Duration = duration; ActionType = actionType ?? "delay"; } + /// Initializes a new instance of for deserialization. + internal DelayAction() + { + } + /// ISO8601 formatted string that represents a duration. public TimeSpan Duration { get; set; } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.Serialization.cs index 5fe02f12055a..0ffbf430ce52 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.Serialization.cs @@ -5,22 +5,36 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class DiscreteAction : IUtf8JsonSerializable + public partial class DiscreteAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("parameters"u8); writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("selectorId"u8); @@ -29,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ActionType); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiscreteAction DeserializeDiscreteAction(JsonElement element) + internal static DiscreteAction DeserializeDiscreteAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +70,7 @@ internal static DiscreteAction DeserializeDiscreteAction(JsonElement element) string selectorId = default; string type = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -69,8 +98,61 @@ internal static DiscreteAction DeserializeDiscreteAction(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiscreteAction(type, name, parameters, selectorId, serializedAdditionalRawData); + } + + DiscreteAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiscreteAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiscreteAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiscreteAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiscreteAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiscreteAction(Response response) + { + if (response is null) + { + return null; } - return new DiscreteAction(type, name, parameters, selectorId); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiscreteAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.cs index 053237bed2e1..31215f4cced7 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/DiscreteAction.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a discrete action. public partial class DiscreteAction : Action { - /// Initializes a new instance of DiscreteAction. + /// Initializes a new instance of . /// String that represents a Capability URN. /// List of key value pairs. /// String that represents a selector. @@ -31,18 +31,24 @@ public DiscreteAction(string name, IEnumerable parameters, string ActionType = "discrete"; } - /// Initializes a new instance of DiscreteAction. + /// Initializes a new instance of . /// Enum that discriminates between action models. /// String that represents a Capability URN. /// List of key value pairs. /// String that represents a selector. - internal DiscreteAction(string actionType, string name, IList parameters, string selectorId) : base(actionType, name) + /// Keeps track of any properties unknown to the library. + internal DiscreteAction(string actionType, string name, IList parameters, string selectorId, Dictionary serializedAdditionalRawData) : base(actionType, name, serializedAdditionalRawData) { Parameters = parameters; SelectorId = selectorId; ActionType = actionType ?? "discrete"; } + /// Initializes a new instance of for deserialization. + internal DiscreteAction() + { + } + /// List of key value pairs. public IList Parameters { get; } /// String that represents a selector. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.Serialization.cs index 39ffb481642d..5b76a549d232 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class ExperimentCancelOperationResult + public partial class ExperimentCancelOperationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentCancelOperationResult DeserializeExperimentCancelOperationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentCancelOperationResult DeserializeExperimentCancelOperationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional statusUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ExperimentCancelOperationResult DeserializeExperimentCancelOpera statusUrl = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentCancelOperationResult(name.Value, statusUrl.Value); + return new ExperimentCancelOperationResult(name.Value, statusUrl.Value, serializedAdditionalRawData); + } + + ExperimentCancelOperationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentCancelOperationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentCancelOperationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentCancelOperationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentCancelOperationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentCancelOperationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentCancelOperationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.cs index fe042dfd7b0b..1f04ad77893e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentCancelOperationResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Chaos.Models { /// Model that represents the result of a cancel Experiment operation. public partial class ExperimentCancelOperationResult { - /// Initializes a new instance of ExperimentCancelOperationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentCancelOperationResult() { } - /// Initializes a new instance of ExperimentCancelOperationResult. + /// Initializes a new instance of . /// String of the Experiment name. /// URL to retrieve the Experiment status. - internal ExperimentCancelOperationResult(string name, string statusUri) + /// Keeps track of any properties unknown to the library. + internal ExperimentCancelOperationResult(string name, string statusUri, Dictionary serializedAdditionalRawData) { Name = name; StatusUri = statusUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// String of the Experiment name. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentData.Serialization.cs index 8bfa3d37085e..2a2b6fab5c9f 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class ExperimentData : IUtf8JsonSerializable + public partial class ExperimentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,14 +49,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Steps) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("selectors"u8); writer.WriteStartArray(); foreach (var item in Selectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(StartOnCreation)) @@ -65,11 +86,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExperimentData DeserializeExperimentData(JsonElement element) + internal static ExperimentData DeserializeExperimentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +119,7 @@ internal static ExperimentData DeserializeExperimentData(JsonElement element) IList steps = default; IList selectors = default; Optional startOnCreation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -180,8 +216,61 @@ internal static ExperimentData DeserializeExperimentData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExperimentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, steps, selectors, Optional.ToNullable(startOnCreation), serializedAdditionalRawData); + } + + ExperimentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentData model) + { + if (model is null) + { + return null; } - return new ExperimentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, steps, selectors, Optional.ToNullable(startOnCreation)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.Serialization.cs index 7342696a908e..df236b373a0d 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class ExperimentExecutionActionTargetDetailsError + public partial class ExperimentExecutionActionTargetDetailsError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentExecutionActionTargetDetailsError DeserializeExperimentExecutionActionTargetDetailsError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentExecutionActionTargetDetailsError DeserializeExperimentExecutionActionTargetDetailsError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -32,8 +61,61 @@ internal static ExperimentExecutionActionTargetDetailsError DeserializeExperimen message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentExecutionActionTargetDetailsError(code.Value, message.Value); + return new ExperimentExecutionActionTargetDetailsError(code.Value, message.Value, serializedAdditionalRawData); + } + + ExperimentExecutionActionTargetDetailsError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentExecutionActionTargetDetailsError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentExecutionActionTargetDetailsError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentExecutionActionTargetDetailsError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentExecutionActionTargetDetailsError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentExecutionActionTargetDetailsError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentExecutionActionTargetDetailsError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.cs index 171716a6564c..ca59d3530c42 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsError.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Chaos.Models { /// Model that represents the Experiment action target details error model. public partial class ExperimentExecutionActionTargetDetailsError { - /// Initializes a new instance of ExperimentExecutionActionTargetDetailsError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentExecutionActionTargetDetailsError() { } - /// Initializes a new instance of ExperimentExecutionActionTargetDetailsError. + /// Initializes a new instance of . /// The error code. /// The error message. - internal ExperimentExecutionActionTargetDetailsError(string code, string message) + /// Keeps track of any properties unknown to the library. + internal ExperimentExecutionActionTargetDetailsError(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error code. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.Serialization.cs index fa4267e1ad99..bae364448aea 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class ExperimentExecutionActionTargetDetailsProperties + public partial class ExperimentExecutionActionTargetDetailsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentExecutionActionTargetDetailsProperties DeserializeExperimentExecutionActionTargetDetailsProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentExecutionActionTargetDetailsProperties DeserializeExperimentExecutionActionTargetDetailsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static ExperimentExecutionActionTargetDetailsProperties DeserializeExpe Optional targetFailedTime = default; Optional targetCompletedTime = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -66,8 +94,61 @@ internal static ExperimentExecutionActionTargetDetailsProperties DeserializeExpe error = ExperimentExecutionActionTargetDetailsError.DeserializeExperimentExecutionActionTargetDetailsError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentExecutionActionTargetDetailsProperties(status.Value, target.Value, Optional.ToNullable(targetFailedTime), Optional.ToNullable(targetCompletedTime), error.Value); + return new ExperimentExecutionActionTargetDetailsProperties(status.Value, target.Value, Optional.ToNullable(targetFailedTime), Optional.ToNullable(targetCompletedTime), error.Value, serializedAdditionalRawData); + } + + ExperimentExecutionActionTargetDetailsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentExecutionActionTargetDetailsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentExecutionActionTargetDetailsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentExecutionActionTargetDetailsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentExecutionActionTargetDetailsProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentExecutionActionTargetDetailsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentExecutionActionTargetDetailsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.cs index e9df84ebb997..35bca80eeda0 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionActionTargetDetailsProperties.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Chaos.Models { /// Model that represents the Experiment action target details properties model. public partial class ExperimentExecutionActionTargetDetailsProperties { - /// Initializes a new instance of ExperimentExecutionActionTargetDetailsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentExecutionActionTargetDetailsProperties() { } - /// Initializes a new instance of ExperimentExecutionActionTargetDetailsProperties. + /// Initializes a new instance of . /// The status of the execution. /// The target for the action. /// String that represents the failed date time. /// String that represents the completed date time. /// The error of the action. - internal ExperimentExecutionActionTargetDetailsProperties(string status, string target, DateTimeOffset? targetFailedOn, DateTimeOffset? targetCompletedOn, ExperimentExecutionActionTargetDetailsError error) + /// Keeps track of any properties unknown to the library. + internal ExperimentExecutionActionTargetDetailsProperties(string status, string target, DateTimeOffset? targetFailedOn, DateTimeOffset? targetCompletedOn, ExperimentExecutionActionTargetDetailsError error, Dictionary serializedAdditionalRawData) { Status = status; Target = target; TargetFailedOn = targetFailedOn; TargetCompletedOn = targetCompletedOn; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status of the execution. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailData.Serialization.cs index 4c07e12198da..325c8345751e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailData.Serialization.cs @@ -6,17 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class ExperimentExecutionDetailData + public partial class ExperimentExecutionDetailData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentExecutionDetailData DeserializeExperimentExecutionDetailData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentExecutionDetailData DeserializeExperimentExecutionDetailData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +63,7 @@ internal static ExperimentExecutionDetailData DeserializeExperimentExecutionDeta Optional startDateTime = default; Optional stopDateTime = default; Optional runInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -131,8 +162,61 @@ internal static ExperimentExecutionDetailData DeserializeExperimentExecutionDeta } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentExecutionDetailData(id, name, type, systemData.Value, experimentId.Value, status.Value, failureReason.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(lastActionDateTime), Optional.ToNullable(startDateTime), Optional.ToNullable(stopDateTime), runInformation.Value); + return new ExperimentExecutionDetailData(id, name, type, systemData.Value, experimentId.Value, status.Value, failureReason.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(lastActionDateTime), Optional.ToNullable(startDateTime), Optional.ToNullable(stopDateTime), runInformation.Value, serializedAdditionalRawData); + } + + ExperimentExecutionDetailData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentExecutionDetailData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentExecutionDetailData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentExecutionDetailData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentExecutionDetailData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentExecutionDetailData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentExecutionDetailData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.Serialization.cs index bb6c3550956e..468faec97b79 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class ExperimentExecutionDetailsListResult + internal partial class ExperimentExecutionDetailsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentExecutionDetailsListResult DeserializeExperimentExecutionDetailsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentExecutionDetailsListResult DeserializeExperimentExecutionDetailsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static ExperimentExecutionDetailsListResult DeserializeExperimentExecut nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentExecutionDetailsListResult(Optional.ToList(value), nextLink.Value); + return new ExperimentExecutionDetailsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ExperimentExecutionDetailsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentExecutionDetailsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentExecutionDetailsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentExecutionDetailsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentExecutionDetailsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentExecutionDetailsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentExecutionDetailsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.cs index 060bad49a047..6d75c6fda671 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Experiment execution details and a link for pagination. internal partial class ExperimentExecutionDetailsListResult { - /// Initializes a new instance of ExperimentExecutionDetailsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentExecutionDetailsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExperimentExecutionDetailsListResult. + /// Initializes a new instance of . /// List of Experiment execution details. /// URL to retrieve the next page of Experiment execution details. - internal ExperimentExecutionDetailsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ExperimentExecutionDetailsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Experiment execution details. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.Serialization.cs index 632dfb530b09..eb6f8ad45796 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - internal partial class ExperimentExecutionDetailsPropertiesRunInformation + internal partial class ExperimentExecutionDetailsPropertiesRunInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentExecutionDetailsPropertiesRunInformation DeserializeExperimentExecutionDetailsPropertiesRunInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentExecutionDetailsPropertiesRunInformation DeserializeExperimentExecutionDetailsPropertiesRunInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> steps = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("steps"u8)) @@ -36,8 +64,61 @@ internal static ExperimentExecutionDetailsPropertiesRunInformation DeserializeEx steps = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentExecutionDetailsPropertiesRunInformation(Optional.ToList(steps)); + return new ExperimentExecutionDetailsPropertiesRunInformation(Optional.ToList(steps), serializedAdditionalRawData); + } + + ExperimentExecutionDetailsPropertiesRunInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentExecutionDetailsPropertiesRunInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentExecutionDetailsPropertiesRunInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentExecutionDetailsPropertiesRunInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentExecutionDetailsPropertiesRunInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentExecutionDetailsPropertiesRunInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentExecutionDetailsPropertiesRunInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.cs index 7523e41058d9..50cd609e96d9 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentExecutionDetailsPropertiesRunInformation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Chaos.Models /// The information of the experiment run. internal partial class ExperimentExecutionDetailsPropertiesRunInformation { - /// Initializes a new instance of ExperimentExecutionDetailsPropertiesRunInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentExecutionDetailsPropertiesRunInformation() { Steps = new ChangeTrackingList(); } - /// Initializes a new instance of ExperimentExecutionDetailsPropertiesRunInformation. + /// Initializes a new instance of . /// The steps of the experiment run. - internal ExperimentExecutionDetailsPropertiesRunInformation(IReadOnlyList steps) + /// Keeps track of any properties unknown to the library. + internal ExperimentExecutionDetailsPropertiesRunInformation(IReadOnlyList steps, Dictionary serializedAdditionalRawData) { Steps = steps; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The steps of the experiment run. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.Serialization.cs index 7f5389316d0d..93fa1c54e510 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class ExperimentListResult + internal partial class ExperimentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentListResult DeserializeExperimentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentListResult DeserializeExperimentListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static ExperimentListResult DeserializeExperimentListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentListResult(Optional.ToList(value), nextLink.Value); + return new ExperimentListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ExperimentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.cs index 1ccc68fa250f..a4dcc0847178 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Experiment resources and a link for pagination. internal partial class ExperimentListResult { - /// Initializes a new instance of ExperimentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExperimentListResult. + /// Initializes a new instance of . /// List of Experiment resources. /// URL to retrieve the next page of Experiment resources. - internal ExperimentListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ExperimentListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Experiment resources. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.Serialization.cs index 3fa043544a41..924b51fa5f07 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class ExperimentStartOperationResult + public partial class ExperimentStartOperationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentStartOperationResult DeserializeExperimentStartOperationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentStartOperationResult DeserializeExperimentStartOperationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional statusUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ExperimentStartOperationResult DeserializeExperimentStartOperati statusUrl = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentStartOperationResult(name.Value, statusUrl.Value); + return new ExperimentStartOperationResult(name.Value, statusUrl.Value, serializedAdditionalRawData); + } + + ExperimentStartOperationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentStartOperationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentStartOperationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentStartOperationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentStartOperationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentStartOperationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentStartOperationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.cs index d458cb571b8f..b6197d17caa5 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStartOperationResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Chaos.Models { /// Model that represents the result of a start Experiment operation. public partial class ExperimentStartOperationResult { - /// Initializes a new instance of ExperimentStartOperationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentStartOperationResult() { } - /// Initializes a new instance of ExperimentStartOperationResult. + /// Initializes a new instance of . /// String of the Experiment name. /// URL to retrieve the Experiment status. - internal ExperimentStartOperationResult(string name, string statusUri) + /// Keeps track of any properties unknown to the library. + internal ExperimentStartOperationResult(string name, string statusUri, Dictionary serializedAdditionalRawData) { Name = name; StatusUri = statusUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// String of the Experiment name. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusData.Serialization.cs index 33003b654df2..315c3813c45e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusData.Serialization.cs @@ -6,16 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class ExperimentStatusData + public partial class ExperimentStatusData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentStatusData DeserializeExperimentStatusData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentStatusData DeserializeExperimentStatusData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +57,7 @@ internal static ExperimentStatusData DeserializeExperimentStatusData(JsonElement Optional status = default; Optional createdDateUtc = default; Optional endDateUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -89,8 +120,61 @@ internal static ExperimentStatusData DeserializeExperimentStatusData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentStatusData(id, name, type, systemData.Value, status.Value, Optional.ToNullable(createdDateUtc), Optional.ToNullable(endDateUtc)); + return new ExperimentStatusData(id, name, type, systemData.Value, status.Value, Optional.ToNullable(createdDateUtc), Optional.ToNullable(endDateUtc), serializedAdditionalRawData); + } + + ExperimentStatusData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentStatusData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentStatusData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentStatusData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentStatusData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentStatusData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentStatusData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.Serialization.cs index 7a4c27de75e3..3f701a1241a1 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class ExperimentStatusListResult + internal partial class ExperimentStatusListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExperimentStatusListResult DeserializeExperimentStatusListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExperimentStatusListResult DeserializeExperimentStatusListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static ExperimentStatusListResult DeserializeExperimentStatusListResult nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExperimentStatusListResult(Optional.ToList(value), nextLink.Value); + return new ExperimentStatusListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ExperimentStatusListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExperimentStatusListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExperimentStatusListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExperimentStatusListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExperimentStatusListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExperimentStatusListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExperimentStatusListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.cs index d2436b37c2f3..60099ba88722 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/ExperimentStatusListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Experiment statuses and a link for pagination. internal partial class ExperimentStatusListResult { - /// Initializes a new instance of ExperimentStatusListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExperimentStatusListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExperimentStatusListResult. + /// Initializes a new instance of . /// List of Experiment statuses. /// URL to retrieve the next page of Experiment statuses. - internal ExperimentStatusListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ExperimentStatusListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Experiment statuses. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.Serialization.cs index fc405bdb5dec..3f9b939daed0 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class Filter : IUtf8JsonSerializable + public partial class Filter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(FilterType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Filter DeserializeFilter(JsonElement element) + internal static Filter DeserializeFilter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,7 +55,72 @@ internal static Filter DeserializeFilter(JsonElement element) case "Simple": return SimpleFilter.DeserializeSimpleFilter(element); } } - return UnknownFilter.DeserializeUnknownFilter(element); + + // Unknown type found so we will deserialize the base properties only + FilterType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new FilterType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownFilter(type, serializedAdditionalRawData); + } + + Filter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Filter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Filter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Filter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.cs index 4f3282a9d6a5..3efda6b1f50d 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Filter.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.Chaos.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// + [DeserializationProxy(typeof(UnknownFilter))] public abstract partial class Filter { - /// Initializes a new instance of Filter. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected Filter() { } - /// Initializes a new instance of Filter. + /// Initializes a new instance of . /// Enum that discriminates between filter types. Currently only `Simple` type is supported. - internal Filter(FilterType filterType) + /// Keeps track of any properties unknown to the library. + internal Filter(FilterType filterType, Dictionary serializedAdditionalRawData) { FilterType = filterType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Enum that discriminates between filter types. Currently only `Simple` type is supported. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.Serialization.cs index 5ec53b143266..cf49e0a4650d 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class KeyValuePair : IUtf8JsonSerializable + public partial class KeyValuePair : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyValuePair DeserializeKeyValuePair(JsonElement element) + internal static KeyValuePair DeserializeKeyValuePair(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string key = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -42,8 +65,61 @@ internal static KeyValuePair DeserializeKeyValuePair(JsonElement element) value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyValuePair(key, value, serializedAdditionalRawData); + } + + KeyValuePair IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyValuePair(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyValuePair IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyValuePair(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyValuePair model) + { + if (model is null) + { + return null; } - return new KeyValuePair(key, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyValuePair(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyValuePair(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.cs index 24be6c0d291a..46fff005b44e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/KeyValuePair.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Chaos.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Chaos.Models /// A map to describe the settings of an action. public partial class KeyValuePair { - /// Initializes a new instance of KeyValuePair. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the setting for the action. /// The value of the setting for the action. /// or is null. @@ -26,6 +30,22 @@ public KeyValuePair(string key, string value) Value = value; } + /// Initializes a new instance of . + /// The name of the setting for the action. + /// The value of the setting for the action. + /// Keeps track of any properties unknown to the library. + internal KeyValuePair(string key, string value, Dictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyValuePair() + { + } + /// The name of the setting for the action. public string Key { get; set; } /// The value of the setting for the action. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.Serialization.cs index d5192cfb2731..8c19fdeaee09 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class Selector : IUtf8JsonSerializable + public partial class Selector : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(SelectorType.ToSerialString()); @@ -24,19 +31,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Targets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(Filter)) { writer.WritePropertyName("filter"u8); - writer.WriteObjectValue(Filter); + if (Filter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Filter).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static Selector DeserializeSelector(JsonElement element) + internal static Selector DeserializeSelector(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +80,7 @@ internal static Selector DeserializeSelector(JsonElement element) string id = default; IList targets = default; Optional filter = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -76,8 +112,61 @@ internal static Selector DeserializeSelector(JsonElement element) filter = Filter.DeserializeFilter(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Selector(type, id, targets, filter.Value, serializedAdditionalRawData); + } + + Selector IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSelector(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Selector IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSelector(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Selector model) + { + if (model is null) + { + return null; } - return new Selector(type, id, targets, filter.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Selector(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSelector(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.cs index 6f11120fb936..e739d877e68c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Selector.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a selector in the Experiment resource. public partial class Selector { - /// Initializes a new instance of Selector. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Enum of the selector type. /// String of the selector ID. /// List of Target references. @@ -30,7 +33,7 @@ public Selector(SelectorType selectorType, string id, IEnumerable Initializes a new instance of Selector. + /// Initializes a new instance of . /// Enum of the selector type. /// String of the selector ID. /// List of Target references. @@ -39,12 +42,19 @@ public Selector(SelectorType selectorType, string id, IEnumerable is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// - internal Selector(SelectorType selectorType, string id, IList targets, Filter filter) + /// Keeps track of any properties unknown to the library. + internal Selector(SelectorType selectorType, string id, IList targets, Filter filter, Dictionary serializedAdditionalRawData) { SelectorType = selectorType; Id = id; Targets = targets; Filter = filter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Selector() + { } /// Enum of the selector type. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.Serialization.cs index 55854839dc38..b2694d2e4d39 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.Serialization.cs @@ -5,34 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class SimpleFilter : IUtf8JsonSerializable + public partial class SimpleFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Parameters)) { writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Parameters); + if (Parameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Parameters).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(FilterType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SimpleFilter DeserializeSimpleFilter(JsonElement element) + internal static SimpleFilter DeserializeSimpleFilter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional parameters = default; FilterType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters"u8)) @@ -49,8 +79,61 @@ internal static SimpleFilter DeserializeSimpleFilter(JsonElement element) type = new FilterType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SimpleFilter(type, parameters.Value, serializedAdditionalRawData); + } + + SimpleFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSimpleFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SimpleFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSimpleFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SimpleFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SimpleFilter(Response response) + { + if (response is null) + { + return null; } - return new SimpleFilter(type, parameters.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSimpleFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.cs index e0e5ea172648..2356989e51e9 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilter.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Chaos.Models @@ -12,16 +13,17 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a simple target filter. public partial class SimpleFilter : Filter { - /// Initializes a new instance of SimpleFilter. + /// Initializes a new instance of . public SimpleFilter() { FilterType = FilterType.Simple; } - /// Initializes a new instance of SimpleFilter. + /// Initializes a new instance of . /// Enum that discriminates between filter types. Currently only `Simple` type is supported. /// Model that represents the Simple filter parameters. - internal SimpleFilter(FilterType filterType, SimpleFilterParameters parameters) : base(filterType) + /// Keeps track of any properties unknown to the library. + internal SimpleFilter(FilterType filterType, SimpleFilterParameters parameters, Dictionary serializedAdditionalRawData) : base(filterType, serializedAdditionalRawData) { Parameters = parameters; FilterType = filterType; diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.Serialization.cs index 7b207ff5d215..f7a4bd6dcc72 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - internal partial class SimpleFilterParameters : IUtf8JsonSerializable + internal partial class SimpleFilterParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SimpleFilterParameters DeserializeSimpleFilterParameters(JsonElement element) + internal static SimpleFilterParameters DeserializeSimpleFilterParameters(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> zones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -52,8 +74,61 @@ internal static SimpleFilterParameters DeserializeSimpleFilterParameters(JsonEle zones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SimpleFilterParameters(Optional.ToList(zones), serializedAdditionalRawData); + } + + SimpleFilterParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSimpleFilterParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SimpleFilterParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSimpleFilterParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SimpleFilterParameters model) + { + if (model is null) + { + return null; } - return new SimpleFilterParameters(Optional.ToList(zones)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SimpleFilterParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSimpleFilterParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.cs index 99dba9326cfb..c60febcc58ce 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/SimpleFilterParameters.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents the Simple filter parameters. internal partial class SimpleFilterParameters { - /// Initializes a new instance of SimpleFilterParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SimpleFilterParameters() { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of SimpleFilterParameters. + /// Initializes a new instance of . /// List of Azure availability zones to filter targets by. - internal SimpleFilterParameters(IList zones) + /// Keeps track of any properties unknown to the library. + internal SimpleFilterParameters(IList zones, Dictionary serializedAdditionalRawData) { Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Azure availability zones to filter targets by. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.Serialization.cs index bf3315a5555a..93b9e002d9a5 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class Step : IUtf8JsonSerializable + public partial class Step : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Branches) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Step DeserializeStep(JsonElement element) + internal static Step DeserializeStep(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; IList branches = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -53,8 +82,61 @@ internal static Step DeserializeStep(JsonElement element) branches = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Step(name, branches, serializedAdditionalRawData); + } + + Step IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStep(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Step IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStep(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Step model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Step(Response response) + { + if (response is null) + { + return null; } - return new Step(name, branches); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStep(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.cs index f5952e559698..e53e87a86f6a 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/Step.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a step in the Experiment resource. public partial class Step { - /// Initializes a new instance of Step. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// String of the step name. /// List of branches. /// or is null. @@ -28,13 +31,20 @@ public Step(string name, IEnumerable branches) Branches = branches.ToList(); } - /// Initializes a new instance of Step. + /// Initializes a new instance of . /// String of the step name. /// List of branches. - internal Step(string name, IList branches) + /// Keeps track of any properties unknown to the library. + internal Step(string name, IList branches, Dictionary serializedAdditionalRawData) { Name = name; Branches = branches; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Step() + { } /// String of the step name. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.Serialization.cs index 46bd73f1e58d..a8d9642c6407 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class StepStatus + public partial class StepStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static StepStatus DeserializeStepStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static StepStatus DeserializeStepStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static StepStatus DeserializeStepStatus(JsonElement element) Optional stepId = default; Optional status = default; Optional> branches = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("stepName"u8)) @@ -54,8 +82,61 @@ internal static StepStatus DeserializeStepStatus(JsonElement element) branches = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new StepStatus(stepName.Value, stepId.Value, status.Value, Optional.ToList(branches)); + return new StepStatus(stepName.Value, stepId.Value, status.Value, Optional.ToList(branches), serializedAdditionalRawData); + } + + StepStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStepStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StepStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStepStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StepStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StepStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStepStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.cs index 19f6a873ff70..76556866ceff 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/StepStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents the a list of branches and branch statuses. public partial class StepStatus { - /// Initializes a new instance of StepStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal StepStatus() { Branches = new ChangeTrackingList(); } - /// Initializes a new instance of StepStatus. + /// Initializes a new instance of . /// The name of the step. /// The id of the step. /// The value of the status of the step. /// The array of branches. - internal StepStatus(string stepName, string stepId, string status, IReadOnlyList branches) + /// Keeps track of any properties unknown to the library. + internal StepStatus(string stepName, string stepId, string status, IReadOnlyList branches, Dictionary serializedAdditionalRawData) { StepName = stepName; StepId = stepId; Status = status; Branches = branches; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the step. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetData.Serialization.cs index 203abb8af625..dfc43176936c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class TargetData : IUtf8JsonSerializable + public partial class TargetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -40,11 +46,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TargetData DeserializeTargetData(JsonElement element) + internal static TargetData DeserializeTargetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +75,7 @@ internal static TargetData DeserializeTargetData(JsonElement element) string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -107,8 +128,61 @@ internal static TargetData DeserializeTargetData(JsonElement element) systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TargetData(id, name, type, systemData.Value, Optional.ToNullable(location), properties); + return new TargetData(id, name, type, systemData.Value, Optional.ToNullable(location), properties, serializedAdditionalRawData); + } + + TargetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTargetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TargetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTargetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TargetData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TargetData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTargetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.Serialization.cs index 905a0de61c05..fdcb6cafa0c0 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class TargetListResult + internal partial class TargetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TargetListResult DeserializeTargetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TargetListResult DeserializeTargetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static TargetListResult DeserializeTargetListResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TargetListResult(Optional.ToList(value), nextLink.Value); + return new TargetListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + TargetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTargetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TargetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTargetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TargetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TargetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTargetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.cs index a00e86dee8bf..b3cf7742e0a3 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Target resources and a link for pagination. internal partial class TargetListResult { - /// Initializes a new instance of TargetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TargetListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TargetListResult. + /// Initializes a new instance of . /// List of Target resources. /// URL to retrieve the next page of Target resources. - internal TargetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TargetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Target resources. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.Serialization.cs index b78c23013630..e11c4eaa3f63 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - public partial class TargetReference : IUtf8JsonSerializable + public partial class TargetReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TargetReference DeserializeTargetReference(JsonElement element) + internal static TargetReference DeserializeTargetReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } TargetReferenceType type = default; string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -42,8 +65,61 @@ internal static TargetReference DeserializeTargetReference(JsonElement element) id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TargetReference(type, id, serializedAdditionalRawData); + } + + TargetReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTargetReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TargetReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTargetReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TargetReference model) + { + if (model is null) + { + return null; } - return new TargetReference(type, id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TargetReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTargetReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.cs index 6b1e477073b5..2eedf770cc54 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Chaos.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a reference to a Target in the selector. public partial class TargetReference { - /// Initializes a new instance of TargetReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// String of the resource ID of a Target resource. /// is null. public TargetReference(string id) @@ -24,13 +28,20 @@ public TargetReference(string id) Id = id; } - /// Initializes a new instance of TargetReference. + /// Initializes a new instance of . /// Enum of the Target reference type. /// String of the resource ID of a Target resource. - internal TargetReference(TargetReferenceType referenceType, string id) + /// Keeps track of any properties unknown to the library. + internal TargetReference(TargetReferenceType referenceType, string id, Dictionary serializedAdditionalRawData) { ReferenceType = referenceType; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetReference() + { } /// Enum of the Target reference type. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeData.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeData.Serialization.cs index 0208847b7a1f..f5d1eeb8d720 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeData.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Chaos { - public partial class TargetTypeData : IUtf8JsonSerializable + public partial class TargetTypeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TargetTypeData DeserializeTargetTypeData(JsonElement element) + internal static TargetTypeData DeserializeTargetTypeData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static TargetTypeData DeserializeTargetTypeData(JsonElement element) Optional description = default; Optional propertiesSchema = default; Optional> resourceTypes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -119,8 +141,61 @@ internal static TargetTypeData DeserializeTargetTypeData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TargetTypeData(id, name, type, systemData.Value, Optional.ToNullable(location), displayName.Value, description.Value, propertiesSchema.Value, Optional.ToList(resourceTypes), serializedAdditionalRawData); + } + + TargetTypeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTargetTypeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TargetTypeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTargetTypeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TargetTypeData model) + { + if (model is null) + { + return null; } - return new TargetTypeData(id, name, type, systemData.Value, Optional.ToNullable(location), displayName.Value, description.Value, propertiesSchema.Value, Optional.ToList(resourceTypes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TargetTypeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTargetTypeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.Serialization.cs index ccab299422ff..e26916a4af89 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Chaos; namespace Azure.ResourceManager.Chaos.Models { - internal partial class TargetTypeListResult + internal partial class TargetTypeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TargetTypeListResult DeserializeTargetTypeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TargetTypeListResult DeserializeTargetTypeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static TargetTypeListResult DeserializeTargetTypeListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TargetTypeListResult(Optional.ToList(value), nextLink.Value); + return new TargetTypeListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + TargetTypeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTargetTypeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TargetTypeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTargetTypeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TargetTypeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TargetTypeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTargetTypeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.cs index 32ed4a8ff62f..353c6b9e4975 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/TargetTypeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Chaos; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Chaos.Models /// Model that represents a list of Target Type resources and a link for pagination. internal partial class TargetTypeListResult { - /// Initializes a new instance of TargetTypeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TargetTypeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TargetTypeListResult. + /// Initializes a new instance of . /// List of Target Type resources. /// URL to retrieve the next page of Target Type resources. - internal TargetTypeListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TargetTypeListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Target Type resources. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.Serialization.cs index 829de22f2249..8914e5e58a6a 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.Serialization.cs @@ -5,45 +5,64 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - internal partial class UnknownAction : IUtf8JsonSerializable + internal partial class UnknownAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ActionType); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); - writer.WriteEndObject(); - } - - internal static UnknownAction DeserializeUnknownAction(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string type = "Unknown"; - string name = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) + foreach (var property in _serializedAdditionalRawData) { - name = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownAction(type, name); + writer.WriteEndObject(); + } + + internal static Action DeserializeUnknownAction(JsonElement element, ModelSerializerOptions options = default) => DeserializeAction(element, options); + + Action IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Action IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAction(doc.RootElement, options); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.cs index 1e9fd87c7e50..5a80e29012d8 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownAction.cs @@ -5,17 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Chaos.Models { /// The UnknownAction. internal partial class UnknownAction : Action { - /// Initializes a new instance of UnknownAction. + /// Initializes a new instance of . /// Enum that discriminates between action models. /// String that represents a Capability URN. - internal UnknownAction(string actionType, string name) : base(actionType, name) + /// Keeps track of any properties unknown to the library. + internal UnknownAction(string actionType, string name, Dictionary serializedAdditionalRawData) : base(actionType, name, serializedAdditionalRawData) { ActionType = actionType ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownAction() + { + } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.Serialization.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.Serialization.cs index 91c5ea5b5988..43d50b0f9e61 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.Serialization.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Chaos.Models { - internal partial class UnknownFilter : IUtf8JsonSerializable + internal partial class UnknownFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(FilterType.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownFilter DeserializeUnknownFilter(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - FilterType type = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) + foreach (var property in _serializedAdditionalRawData) { - type = new FilterType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownFilter(type); + writer.WriteEndObject(); + } + + internal static Filter DeserializeUnknownFilter(JsonElement element, ModelSerializerOptions options = default) => DeserializeFilter(element, options); + + Filter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Filter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFilter(doc.RootElement, options); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.cs index c925562bc59a..3c0d39e53ba5 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Models/UnknownFilter.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Chaos.Models { /// The UnknownFilter. internal partial class UnknownFilter : Filter { - /// Initializes a new instance of UnknownFilter. + /// Initializes a new instance of . /// Enum that discriminates between filter types. Currently only `Simple` type is supported. - internal UnknownFilter(FilterType filterType) : base(filterType) + /// Keeps track of any properties unknown to the library. + internal UnknownFilter(FilterType filterType, Dictionary serializedAdditionalRawData) : base(filterType, serializedAdditionalRawData) { FilterType = filterType; } + + /// Initializes a new instance of for deserialization. + internal UnknownFilter() + { + } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/CapabilitiesRestOperations.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/CapabilitiesRestOperations.cs index e2e73c54cd28..a7d9cdd67152 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/CapabilitiesRestOperations.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/CapabilitiesRestOperations.cs @@ -365,9 +365,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/ExperimentsRestOperations.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/ExperimentsRestOperations.cs index 9d523dc4d7b6..76989c63a61d 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/ExperimentsRestOperations.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/ExperimentsRestOperations.cs @@ -370,9 +370,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/TargetsRestOperations.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/TargetsRestOperations.cs index 68a0bf2afc7f..3e14caca0674 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/TargetsRestOperations.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/RestOperations/TargetsRestOperations.cs @@ -345,9 +345,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs index 80e1ff780654..b05cd84255ee 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetCollection.cs @@ -241,7 +241,7 @@ public virtual AsyncPageable GetAllAsync(string continuationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _targetRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, _parentProviderNamespace, _parentResourceType, _parentResourceName, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _targetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, _parentProviderNamespace, _parentResourceType, _parentResourceName, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TargetResource(Client, TargetData.DeserializeTargetData(e)), _targetClientDiagnostics, Pipeline, "TargetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new TargetResource(Client, TargetData.DeserializeTargetData(e)), _targetClientDiagnostics, Pipeline, "TargetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -264,7 +264,7 @@ public virtual Pageable GetAll(string continuationToken = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _targetRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, _parentProviderNamespace, _parentResourceType, _parentResourceName, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _targetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, _parentProviderNamespace, _parentResourceType, _parentResourceName, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TargetResource(Client, TargetData.DeserializeTargetData(e)), _targetClientDiagnostics, Pipeline, "TargetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new TargetResource(Client, TargetData.DeserializeTargetData(e)), _targetClientDiagnostics, Pipeline, "TargetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetData.cs index 707a21d4c14a..787eff8b5033 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetData.cs @@ -18,7 +18,10 @@ namespace Azure.ResourceManager.Chaos /// public partial class TargetData : ResourceData { - /// Initializes a new instance of TargetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The properties of the target resource. /// is null. public TargetData(IDictionary properties) @@ -28,17 +31,24 @@ public TargetData(IDictionary properties) Properties = properties; } - /// Initializes a new instance of TargetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Location of the target resource. /// The properties of the target resource. - internal TargetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IDictionary properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal TargetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IDictionary properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetData() + { } /// Location of the target resource. diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs index 4997ec1c6af2..4e7af151dbde 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeCollection.cs @@ -153,7 +153,7 @@ public virtual AsyncPageable GetAllAsync(string continuation { HttpMessage FirstPageRequest(int? pageSizeHint) => _targetTypeRestClient.CreateListRequest(Id.SubscriptionId, _locationName, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _targetTypeRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, _locationName, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TargetTypeResource(Client, TargetTypeData.DeserializeTargetTypeData(e)), _targetTypeClientDiagnostics, Pipeline, "TargetTypeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new TargetTypeResource(Client, TargetTypeData.DeserializeTargetTypeData(e)), _targetTypeClientDiagnostics, Pipeline, "TargetTypeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -176,7 +176,7 @@ public virtual Pageable GetAll(string continuationToken = nu { HttpMessage FirstPageRequest(int? pageSizeHint) => _targetTypeRestClient.CreateListRequest(Id.SubscriptionId, _locationName, continuationToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _targetTypeRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, _locationName, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TargetTypeResource(Client, TargetTypeData.DeserializeTargetTypeData(e)), _targetTypeClientDiagnostics, Pipeline, "TargetTypeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new TargetTypeResource(Client, TargetTypeData.DeserializeTargetTypeData(e)), _targetTypeClientDiagnostics, Pipeline, "TargetTypeCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeData.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeData.cs index 298b996ae92c..9ee0a8aa12ff 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeData.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,13 +18,16 @@ namespace Azure.ResourceManager.Chaos /// public partial class TargetTypeData : ResourceData { - /// Initializes a new instance of TargetTypeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TargetTypeData() { ResourceTypes = new ChangeTrackingList(); } - /// Initializes a new instance of TargetTypeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,13 +37,15 @@ public TargetTypeData() /// Localized string of the description. /// URL to retrieve JSON schema of the Target Type properties. /// List of resource types this Target Type can extend. - internal TargetTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string displayName, string description, string propertiesSchema, IReadOnlyList resourceTypes) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal TargetTypeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string displayName, string description, string propertiesSchema, IReadOnlyList resourceTypes, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; DisplayName = displayName; Description = description; PropertiesSchema = propertiesSchema; ResourceTypes = resourceTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of the Target Type resource. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs index 52ee49763fef..868549a27251 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs @@ -1016,7 +1016,7 @@ public virtual AsyncPageable GetProjectsAsync(RequestContext context { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetProjects", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetProjects", "value", "nextLink", context); } /// @@ -1037,7 +1037,7 @@ public virtual Pageable GetProjects(RequestContext context = null) { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetProjects", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetProjects", "value", "nextLink", context); } /// @@ -1063,7 +1063,7 @@ public virtual AsyncPageable GetDeploymentsAsync(string projectName, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetDeployments", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetDeployments", "value", "nextLink", context); } /// @@ -1089,7 +1089,7 @@ public virtual Pageable GetDeployments(string projectName, RequestCo HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetDeployments", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetDeployments", "value", "nextLink", context); } /// @@ -1115,7 +1115,7 @@ public virtual AsyncPageable GetTrainedModelsAsync(string projectNam HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainedModelsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainedModelsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainedModels", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainedModels", "value", "nextLink", context); } /// @@ -1141,7 +1141,7 @@ public virtual Pageable GetTrainedModels(string projectName, Request HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainedModelsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainedModelsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainedModels", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainedModels", "value", "nextLink", context); } /// @@ -1171,7 +1171,7 @@ public virtual AsyncPageable GetModelEvaluationResultsAsync(string p HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetModelEvaluationResultsRequest(projectName, trainedModelLabel, stringIndexType, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetModelEvaluationResultsNextPageRequest(nextLink, projectName, trainedModelLabel, stringIndexType, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetModelEvaluationResults", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetModelEvaluationResults", "value", "nextLink", context); } /// @@ -1201,7 +1201,7 @@ public virtual Pageable GetModelEvaluationResults(string projectName HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetModelEvaluationResultsRequest(projectName, trainedModelLabel, stringIndexType, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetModelEvaluationResultsNextPageRequest(nextLink, projectName, trainedModelLabel, stringIndexType, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetModelEvaluationResults", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetModelEvaluationResults", "value", "nextLink", context); } /// @@ -1227,7 +1227,7 @@ public virtual AsyncPageable GetTrainingJobsAsync(string projectName HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingJobsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingJobsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingJobs", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingJobs", "value", "nextLink", context); } /// @@ -1253,7 +1253,7 @@ public virtual Pageable GetTrainingJobs(string projectName, RequestC HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingJobsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingJobsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingJobs", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingJobs", "value", "nextLink", context); } /// @@ -1278,7 +1278,7 @@ public virtual AsyncPageable GetSupportedLanguagesAsync(string proje HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(projectKind, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedLanguages", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedLanguages", "value", "nextLink", context); } /// @@ -1303,7 +1303,7 @@ public virtual Pageable GetSupportedLanguages(string projectKind, Re HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(projectKind, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedLanguages", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedLanguages", "value", "nextLink", context); } /// @@ -1326,7 +1326,7 @@ public virtual AsyncPageable GetSupportedPrebuiltEntitiesAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedPrebuiltEntitiesRequest(language, multilingual, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedPrebuiltEntitiesNextPageRequest(nextLink, language, multilingual, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedPrebuiltEntities", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedPrebuiltEntities", "value", "nextLink", context); } /// @@ -1349,7 +1349,7 @@ public virtual Pageable GetSupportedPrebuiltEntities(string language { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedPrebuiltEntitiesRequest(language, multilingual, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedPrebuiltEntitiesNextPageRequest(nextLink, language, multilingual, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedPrebuiltEntities", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedPrebuiltEntities", "value", "nextLink", context); } /// @@ -1374,7 +1374,7 @@ public virtual AsyncPageable GetTrainingConfigVersionsAsync(string p HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(projectKind, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingConfigVersions", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingConfigVersions", "value", "nextLink", context); } /// @@ -1399,7 +1399,7 @@ public virtual Pageable GetTrainingConfigVersions(string projectKind HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(projectKind, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingConfigVersions", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingConfigVersions", "value", "nextLink", context); } /// diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.Serialization.cs index 1f5db26bb0cb..9ed459dc2302 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class AnswerSpan + public partial class AnswerSpan : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnswerSpan DeserializeAnswerSpan(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(Confidence)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence.Value); + } + if (Optional.IsDefined(Offset)) + { + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset.Value); + } + if (Optional.IsDefined(Length)) + { + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnswerSpan DeserializeAnswerSpan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static AnswerSpan DeserializeAnswerSpan(JsonElement element) Optional confidenceScore = default; Optional offset = default; Optional length = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("text"u8)) @@ -56,8 +105,61 @@ internal static AnswerSpan DeserializeAnswerSpan(JsonElement element) length = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnswerSpan(text.Value, Optional.ToNullable(confidenceScore), Optional.ToNullable(offset), Optional.ToNullable(length)); + return new AnswerSpan(text.Value, Optional.ToNullable(confidenceScore), Optional.ToNullable(offset), Optional.ToNullable(length), serializedAdditionalRawData); + } + + AnswerSpan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswerSpan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswerSpan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswerSpan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswerSpan model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswerSpan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswerSpan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.cs index a594b5ee7ce9..28661aa45734 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswerSpan.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// Answer span object of QnA. public partial class AnswerSpan { - /// Initializes a new instance of AnswerSpan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnswerSpan() { } - /// Initializes a new instance of AnswerSpan. + /// Initializes a new instance of . /// Predicted text of answer span. /// Predicted score of answer span, value ranges from 0 to 1. /// The answer span offset from the start of answer. /// The length of the answer span. - internal AnswerSpan(string text, double? confidence, int? offset, int? length) + /// Keeps track of any properties unknown to the library. + internal AnswerSpan(string text, double? confidence, int? offset, int? length, Dictionary serializedAdditionalRawData) { Text = text; Confidence = confidence; Offset = offset; Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Predicted text of answer span. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.Serialization.cs index 4c47907471e9..da25a1ec8ba1 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class AnswersFromTextOptions : IUtf8JsonSerializable + public partial class AnswersFromTextOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("question"u8); writer.WriteStringValue(Question); @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TextDocuments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(Language)) @@ -34,7 +49,120 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("stringIndexType"u8); writer.WriteStringValue(StringIndexType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AnswersFromTextOptions DeserializeAnswersFromTextOptions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string question = default; + IList records = default; + Optional language = default; + Optional stringIndexType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("question"u8)) + { + question = property.Value.GetString(); + continue; + } + if (property.NameEquals("records"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TextDocument.DeserializeTextDocument(item)); + } + records = array; + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnswersFromTextOptions(question, records, language.Value, Optional.ToNullable(stringIndexType), serializedAdditionalRawData); + } + + AnswersFromTextOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswersFromTextOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswersFromTextOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswersFromTextOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswersFromTextOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswersFromTextOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswersFromTextOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.cs index bfe19c4fb82a..e12b90e445f2 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextOptions.cs @@ -15,5 +15,27 @@ namespace Azure.AI.Language.QuestionAnswering /// The question and text record parameters to answer. public partial class AnswersFromTextOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// User question to query against the given text records. + /// Text records to be searched for given question. + /// Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. + /// Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + /// Keeps track of any properties unknown to the library. + internal AnswersFromTextOptions(string question, IList textDocuments, string language, StringIndexType? stringIndexType, Dictionary serializedAdditionalRawData) + { + Question = question; + TextDocuments = textDocuments; + Language = language; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnswersFromTextOptions() + { + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.Serialization.cs index 8dfac3badc70..9d048ed26474 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class AnswersFromTextResult + public partial class AnswersFromTextResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnswersFromTextResult DeserializeAnswersFromTextResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Answers)) + { + writer.WritePropertyName("answers"u8); + writer.WriteStartArray(); + foreach (var item in Answers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnswersFromTextResult DeserializeAnswersFromTextResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> answers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("answers"u8)) @@ -36,8 +81,61 @@ internal static AnswersFromTextResult DeserializeAnswersFromTextResult(JsonEleme answers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnswersFromTextResult(Optional.ToList(answers)); + return new AnswersFromTextResult(Optional.ToList(answers), serializedAdditionalRawData); + } + + AnswersFromTextResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswersFromTextResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswersFromTextResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswersFromTextResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswersFromTextResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswersFromTextResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswersFromTextResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.cs index 9f4686e4edea..2d066a762799 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersFromTextResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.AI.Language.QuestionAnswering /// Represents the answer results. public partial class AnswersFromTextResult { - /// Initializes a new instance of AnswersFromTextResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnswersFromTextResult() { Answers = new ChangeTrackingList(); } - /// Initializes a new instance of AnswersFromTextResult. + /// Initializes a new instance of . /// Represents the answer results. - internal AnswersFromTextResult(IReadOnlyList answers) + /// Keeps track of any properties unknown to the library. + internal AnswersFromTextResult(IReadOnlyList answers, Dictionary serializedAdditionalRawData) { Answers = answers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Represents the answer results. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.Serialization.cs index 7d36056c86e3..f2e7b1e60907 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class AnswersOptions : IUtf8JsonSerializable + public partial class AnswersOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QnaId)) { @@ -43,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AnswerContext)) { writer.WritePropertyName("context"u8); - writer.WriteObjectValue(AnswerContext); + if (AnswerContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnswerContext).Serialize(writer, options); + } } if (Optional.IsDefined(RankerKind)) { @@ -53,19 +68,205 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Filters)) { writer.WritePropertyName("filters"u8); - writer.WriteObjectValue(Filters); + if (Filters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Filters).Serialize(writer, options); + } } if (Optional.IsDefined(ShortAnswerOptions)) { writer.WritePropertyName("answerSpanRequest"u8); - writer.WriteObjectValue(ShortAnswerOptions); + if (ShortAnswerOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShortAnswerOptions).Serialize(writer, options); + } } if (Optional.IsDefined(IncludeUnstructuredSources)) { writer.WritePropertyName("includeUnstructuredSources"u8); writer.WriteBooleanValue(IncludeUnstructuredSources.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AnswersOptions DeserializeAnswersOptions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional qnaId = default; + Optional question = default; + Optional top = default; + Optional userId = default; + Optional confidenceScoreThreshold = default; + Optional context = default; + Optional rankerType = default; + Optional filters = default; + Optional answerSpanRequest = default; + Optional includeUnstructuredSources = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("qnaId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qnaId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("question"u8)) + { + question = property.Value.GetString(); + continue; + } + if (property.NameEquals("top"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + top = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("userId"u8)) + { + userId = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScoreThreshold"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScoreThreshold = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("context"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + context = KnowledgeBaseAnswerContext.DeserializeKnowledgeBaseAnswerContext(property.Value); + continue; + } + if (property.NameEquals("rankerType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rankerType = new RankerKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = QueryFilters.DeserializeQueryFilters(property.Value); + continue; + } + if (property.NameEquals("answerSpanRequest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + answerSpanRequest = ShortAnswerOptions.DeserializeShortAnswerOptions(property.Value); + continue; + } + if (property.NameEquals("includeUnstructuredSources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + includeUnstructuredSources = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnswersOptions(Optional.ToNullable(qnaId), question.Value, Optional.ToNullable(top), userId.Value, Optional.ToNullable(confidenceScoreThreshold), context.Value, Optional.ToNullable(rankerType), filters.Value, answerSpanRequest.Value, Optional.ToNullable(includeUnstructuredSources), serializedAdditionalRawData); + } + + AnswersOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswersOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswersOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswersOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswersOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswersOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswersOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.cs index 6cbe1d0adc54..b629a5f44069 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersOptions.cs @@ -5,15 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// Parameters to query a knowledge base. public partial class AnswersOptions { - /// Initializes a new instance of AnswersOptions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnswersOptions() { } + + /// Initializes a new instance of . + /// Exact QnA ID to fetch from the knowledge base, this field takes priority over question. + /// User question to query against the knowledge base. + /// Max number of answers to be returned for the question. + /// Unique identifier for the user. + /// Minimum threshold score for answers, value ranges from 0 to 1. + /// Context object with previous QnA's information. + /// Type of ranker to be used. + /// Filter QnAs based on given metadata list and knowledge base sources. + /// To configure Answer span prediction feature. + /// (Optional) Flag to enable Query over Unstructured Sources. + /// Keeps track of any properties unknown to the library. + internal AnswersOptions(int? qnaId, string question, int? size, string userId, double? confidenceThreshold, KnowledgeBaseAnswerContext answerContext, RankerKind? rankerKind, QueryFilters filters, ShortAnswerOptions shortAnswerOptions, bool? includeUnstructuredSources, Dictionary serializedAdditionalRawData) + { + QnaId = qnaId; + Question = question; + Size = size; + UserId = userId; + ConfidenceThreshold = confidenceThreshold; + AnswerContext = answerContext; + RankerKind = rankerKind; + Filters = filters; + ShortAnswerOptions = shortAnswerOptions; + IncludeUnstructuredSources = includeUnstructuredSources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } /// Unique identifier for the user. public string UserId { get; set; } /// Minimum threshold score for answers, value ranges from 0 to 1. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.Serialization.cs index b5c9a018370d..cc083bbf92d1 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class AnswersResult + public partial class AnswersResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnswersResult DeserializeAnswersResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Answers)) + { + writer.WritePropertyName("answers"u8); + writer.WriteStartArray(); + foreach (var item in Answers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnswersResult DeserializeAnswersResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> answers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("answers"u8)) @@ -36,8 +81,61 @@ internal static AnswersResult DeserializeAnswersResult(JsonElement element) answers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AnswersResult(Optional.ToList(answers)); + return new AnswersResult(Optional.ToList(answers), serializedAdditionalRawData); + } + + AnswersResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswersResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswersResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswersResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswersResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswersResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswersResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.cs index 380674d5a010..35a3a8b10e7d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/AnswersResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.AI.Language.QuestionAnswering /// Represents List of Question Answers. public partial class AnswersResult { - /// Initializes a new instance of AnswersResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AnswersResult() { Answers = new ChangeTrackingList(); } - /// Initializes a new instance of AnswersResult. + /// Initializes a new instance of . /// Represents Answer Result list. - internal AnswersResult(IReadOnlyList answers) + /// Keeps track of any properties unknown to the library. + internal AnswersResult(IReadOnlyList answers, Dictionary serializedAdditionalRawData) { Answers = answers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Represents Answer Result list. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.Serialization.cs index dc5603ef0c2b..607c5191f843 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.Serialization.cs @@ -5,16 +5,81 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - internal partial class Error + internal partial class Error : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Error DeserializeError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Innererror)) + { + writer.WritePropertyName("innererror"u8); + if (Innererror is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Innererror).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Error DeserializeError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +89,7 @@ internal static Error DeserializeError(JsonElement element) Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +130,61 @@ internal static Error DeserializeError(JsonElement element) innererror = InnerErrorModel.DeserializeInnerErrorModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Error(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new Error(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + Error IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Error IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Error model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Error(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.cs index 61b256c357b1..a132d7e479ac 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/Error.cs @@ -14,7 +14,10 @@ namespace Azure.AI.Language.QuestionAnswering /// The error object. internal partial class Error { - /// Initializes a new instance of Error. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// One of a server-defined set of error codes. /// A human-readable representation of the error. /// is null. @@ -27,19 +30,26 @@ internal Error(ErrorCode code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of Error. + /// Initializes a new instance of . /// One of a server-defined set of error codes. /// A human-readable representation of the error. /// The target of the error. /// An array of details about specific errors that led to this reported error. /// An object containing more specific information than the current object about the error. - internal Error(ErrorCode code, string message, string target, IReadOnlyList details, InnerErrorModel innererror) + /// Keeps track of any properties unknown to the library. + internal Error(ErrorCode code, string message, string target, IReadOnlyList details, InnerErrorModel innererror, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Error() + { } /// One of a server-defined set of error codes. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.Serialization.cs index 5f982591998f..bb7563751370 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - internal partial class ErrorResponse + internal partial class ErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -30,8 +71,61 @@ internal static ErrorResponse DeserializeErrorResponse(JsonElement element) error = Error.DeserializeError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ErrorResponse(error.Value); + return new ErrorResponse(error.Value, serializedAdditionalRawData); + } + + ErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.cs index d79937290e9c..204350898692 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ErrorResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// Error response. internal partial class ErrorResponse { - /// Initializes a new instance of ErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ErrorResponse() { } - /// Initializes a new instance of ErrorResponse. + /// Initializes a new instance of . /// The error object. - internal ErrorResponse(Error error) + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(Error error, Dictionary serializedAdditionalRawData) { Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error object. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.Serialization.cs index 8c0384b42d7b..cdd2c2482a7f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - internal partial class InnerErrorModel + internal partial class InnerErrorModel : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartObject(); + foreach (var item in Details) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsDefined(Innererror)) + { + writer.WritePropertyName("innererror"u8); + if (Innererror is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Innererror).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +83,7 @@ internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element) Optional> details = default; Optional target = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +124,61 @@ internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element) innererror = DeserializeInnerErrorModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InnerErrorModel(code, message, Optional.ToDictionary(details), target.Value, innererror.Value); + return new InnerErrorModel(code, message, Optional.ToDictionary(details), target.Value, innererror.Value, serializedAdditionalRawData); + } + + InnerErrorModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInnerErrorModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InnerErrorModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInnerErrorModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InnerErrorModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InnerErrorModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInnerErrorModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.cs index 61476cce87d9..76e454c303bf 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/InnerErrorModel.cs @@ -14,7 +14,10 @@ namespace Azure.AI.Language.QuestionAnswering /// An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. internal partial class InnerErrorModel { - /// Initializes a new instance of InnerErrorModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// One of a server-defined set of error codes. /// Error message. /// is null. @@ -27,19 +30,26 @@ internal InnerErrorModel(InnerErrorCode code, string message) Details = new ChangeTrackingDictionary(); } - /// Initializes a new instance of InnerErrorModel. + /// Initializes a new instance of . /// One of a server-defined set of error codes. /// Error message. /// Error details. /// Error target. /// An object containing more specific information than the current object about the error. - internal InnerErrorModel(InnerErrorCode code, string message, IReadOnlyDictionary details, string target, InnerErrorModel innererror) + /// Keeps track of any properties unknown to the library. + internal InnerErrorModel(InnerErrorCode code, string message, IReadOnlyDictionary details, string target, InnerErrorModel innererror, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Details = details; Target = target; Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InnerErrorModel() + { } /// One of a server-defined set of error codes. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs index 7efafb2a8c9c..6cc6e2a4fd90 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs @@ -5,16 +5,108 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class KnowledgeBaseAnswer + public partial class KnowledgeBaseAnswer : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KnowledgeBaseAnswer DeserializeKnowledgeBaseAnswer(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Questions)) + { + writer.WritePropertyName("questions"u8); + writer.WriteStartArray(); + foreach (var item in Questions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Answer)) + { + writer.WritePropertyName("answer"u8); + writer.WriteStringValue(Answer); + } + if (Optional.IsDefined(Confidence)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence.Value); + } + if (Optional.IsDefined(QnaId)) + { + writer.WritePropertyName("id"u8); + writer.WriteNumberValue(QnaId.Value); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Dialog)) + { + writer.WritePropertyName("dialog"u8); + if (Dialog is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dialog).Serialize(writer, options); + } + } + if (Optional.IsDefined(ShortAnswer)) + { + writer.WritePropertyName("answerSpan"u8); + if (ShortAnswer is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShortAnswer).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KnowledgeBaseAnswer DeserializeKnowledgeBaseAnswer(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +119,7 @@ internal static KnowledgeBaseAnswer DeserializeKnowledgeBaseAnswer(JsonElement e Optional> metadata = default; Optional dialog = default; Optional answerSpan = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("questions"u8)) @@ -103,8 +196,61 @@ internal static KnowledgeBaseAnswer DeserializeKnowledgeBaseAnswer(JsonElement e answerSpan = AnswerSpan.DeserializeAnswerSpan(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KnowledgeBaseAnswer(Optional.ToList(questions), answer.Value, Optional.ToNullable(confidenceScore), Optional.ToNullable(id), source.Value, Optional.ToDictionary(metadata), dialog.Value, answerSpan.Value); + return new KnowledgeBaseAnswer(Optional.ToList(questions), answer.Value, Optional.ToNullable(confidenceScore), Optional.ToNullable(id), source.Value, Optional.ToDictionary(metadata), dialog.Value, answerSpan.Value, serializedAdditionalRawData); + } + + KnowledgeBaseAnswer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KnowledgeBaseAnswer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKnowledgeBaseAnswer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KnowledgeBaseAnswer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KnowledgeBaseAnswer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKnowledgeBaseAnswer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.cs index b367fdbc3599..40717ab1cf05 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.AI.Language.QuestionAnswering /// Represents knowledge base answer. public partial class KnowledgeBaseAnswer { - /// Initializes a new instance of KnowledgeBaseAnswer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal KnowledgeBaseAnswer() { Questions = new ChangeTrackingList(); Metadata = new ChangeTrackingDictionary(); } - /// Initializes a new instance of KnowledgeBaseAnswer. + /// Initializes a new instance of . /// List of questions associated with the answer. /// Answer text. /// Answer confidence score, value ranges from 0 to 1. @@ -29,7 +33,8 @@ internal KnowledgeBaseAnswer() /// Metadata associated with the answer, useful to categorize or filter question answers. /// Dialog associated with Answer. /// Answer span object of QnA with respect to user's question. - internal KnowledgeBaseAnswer(IReadOnlyList questions, string answer, double? confidence, int? qnaId, string source, IReadOnlyDictionary metadata, KnowledgeBaseAnswerDialog dialog, AnswerSpan shortAnswer) + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswer(IReadOnlyList questions, string answer, double? confidence, int? qnaId, string source, IReadOnlyDictionary metadata, KnowledgeBaseAnswerDialog dialog, AnswerSpan shortAnswer, Dictionary serializedAdditionalRawData) { Questions = questions; Answer = answer; @@ -39,6 +44,7 @@ internal KnowledgeBaseAnswer(IReadOnlyList questions, string answer, dou Metadata = metadata; Dialog = dialog; ShortAnswer = shortAnswer; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of questions associated with the answer. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs index b1a75130e0a7..529bd27b076b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class KnowledgeBaseAnswerContext : IUtf8JsonSerializable + public partial class KnowledgeBaseAnswerContext : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("previousQnaId"u8); writer.WriteNumberValue(PreviousQnaId); @@ -22,7 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("previousUserQuery"u8); writer.WriteStringValue(PreviousQuestion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static KnowledgeBaseAnswerContext DeserializeKnowledgeBaseAnswerContext(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int previousQnaId = default; + Optional previousUserQuery = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("previousQnaId"u8)) + { + previousQnaId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("previousUserQuery"u8)) + { + previousUserQuery = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KnowledgeBaseAnswerContext(previousQnaId, previousUserQuery.Value, serializedAdditionalRawData); + } + + KnowledgeBaseAnswerContext IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswerContext(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KnowledgeBaseAnswerContext IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKnowledgeBaseAnswerContext(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KnowledgeBaseAnswerContext model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KnowledgeBaseAnswerContext(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKnowledgeBaseAnswerContext(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.cs index 494487e36ebf..8915fa55d57a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerContext.cs @@ -5,18 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// Context object with previous QnA's information. public partial class KnowledgeBaseAnswerContext { - /// Initializes a new instance of KnowledgeBaseAnswerContext. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Previous turn top answer result QnA ID. public KnowledgeBaseAnswerContext(int previousQnaId) { PreviousQnaId = previousQnaId; } + /// Initializes a new instance of . + /// Previous turn top answer result QnA ID. + /// Previous user query. + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswerContext(int previousQnaId, string previousQuestion, Dictionary serializedAdditionalRawData) + { + PreviousQnaId = previousQnaId; + PreviousQuestion = previousQuestion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KnowledgeBaseAnswerContext() + { + } + /// Previous turn top answer result QnA ID. public int PreviousQnaId { get; } /// Previous user query. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs index e8238fb2f2fd..2422608fc86e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class KnowledgeBaseAnswerDialog + public partial class KnowledgeBaseAnswerDialog : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KnowledgeBaseAnswerDialog DeserializeKnowledgeBaseAnswerDialog(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsContextOnly)) + { + writer.WritePropertyName("isContextOnly"u8); + writer.WriteBooleanValue(IsContextOnly.Value); + } + if (Optional.IsCollectionDefined(Prompts)) + { + writer.WritePropertyName("prompts"u8); + writer.WriteStartArray(); + foreach (var item in Prompts) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KnowledgeBaseAnswerDialog DeserializeKnowledgeBaseAnswerDialog(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isContextOnly = default; Optional> prompts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isContextOnly"u8)) @@ -46,8 +96,61 @@ internal static KnowledgeBaseAnswerDialog DeserializeKnowledgeBaseAnswerDialog(J prompts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KnowledgeBaseAnswerDialog(Optional.ToNullable(isContextOnly), Optional.ToList(prompts)); + return new KnowledgeBaseAnswerDialog(Optional.ToNullable(isContextOnly), Optional.ToList(prompts), serializedAdditionalRawData); + } + + KnowledgeBaseAnswerDialog IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswerDialog(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KnowledgeBaseAnswerDialog IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKnowledgeBaseAnswerDialog(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KnowledgeBaseAnswerDialog model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KnowledgeBaseAnswerDialog(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKnowledgeBaseAnswerDialog(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.cs index e33a15213f6f..1ec7c8718d4b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerDialog.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.AI.Language.QuestionAnswering /// Dialog associated with Answer. public partial class KnowledgeBaseAnswerDialog { - /// Initializes a new instance of KnowledgeBaseAnswerDialog. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal KnowledgeBaseAnswerDialog() { Prompts = new ChangeTrackingList(); } - /// Initializes a new instance of KnowledgeBaseAnswerDialog. + /// Initializes a new instance of . /// To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. /// List of prompts associated with the answer. - internal KnowledgeBaseAnswerDialog(bool? isContextOnly, IReadOnlyList prompts) + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswerDialog(bool? isContextOnly, IReadOnlyList prompts, Dictionary serializedAdditionalRawData) { IsContextOnly = isContextOnly; Prompts = prompts; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs index 1a018c5a2e37..557c3a7dfa8e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class KnowledgeBaseAnswerPrompt + public partial class KnowledgeBaseAnswerPrompt : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KnowledgeBaseAnswerPrompt DeserializeKnowledgeBaseAnswerPrompt(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayOrder)) + { + writer.WritePropertyName("displayOrder"u8); + writer.WriteNumberValue(DisplayOrder.Value); + } + if (Optional.IsDefined(QnaId)) + { + writer.WritePropertyName("qnaId"u8); + writer.WriteNumberValue(QnaId.Value); + } + if (Optional.IsDefined(DisplayText)) + { + writer.WritePropertyName("displayText"u8); + writer.WriteStringValue(DisplayText); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KnowledgeBaseAnswerPrompt DeserializeKnowledgeBaseAnswerPrompt(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static KnowledgeBaseAnswerPrompt DeserializeKnowledgeBaseAnswerPrompt(J Optional displayOrder = default; Optional qnaId = default; Optional displayText = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayOrder"u8)) @@ -46,8 +90,61 @@ internal static KnowledgeBaseAnswerPrompt DeserializeKnowledgeBaseAnswerPrompt(J displayText = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KnowledgeBaseAnswerPrompt(Optional.ToNullable(displayOrder), Optional.ToNullable(qnaId), displayText.Value); + return new KnowledgeBaseAnswerPrompt(Optional.ToNullable(displayOrder), Optional.ToNullable(qnaId), displayText.Value, serializedAdditionalRawData); + } + + KnowledgeBaseAnswerPrompt IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswerPrompt(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KnowledgeBaseAnswerPrompt IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKnowledgeBaseAnswerPrompt(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KnowledgeBaseAnswerPrompt model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KnowledgeBaseAnswerPrompt(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKnowledgeBaseAnswerPrompt(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs index 6e33cd213abb..1b8d57f79924 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// Prompt for an answer. public partial class KnowledgeBaseAnswerPrompt { - /// Initializes a new instance of KnowledgeBaseAnswerPrompt. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal KnowledgeBaseAnswerPrompt() { } - /// Initializes a new instance of KnowledgeBaseAnswerPrompt. + /// Initializes a new instance of . /// Index of the prompt - used in ordering of the prompts. /// QnA ID corresponding to the prompt. /// Text displayed to represent a follow up question prompt. - internal KnowledgeBaseAnswerPrompt(int? displayOrder, int? qnaId, string displayText) + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswerPrompt(int? displayOrder, int? qnaId, string displayText, Dictionary serializedAdditionalRawData) { DisplayOrder = displayOrder; QnaId = qnaId; DisplayText = displayText; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Index of the prompt - used in ordering of the prompts. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.Serialization.cs index 3a4fc112ca1a..1b9415f2fa1f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class MetadataFilter : IUtf8JsonSerializable + public partial class MetadataFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Metadata)) { @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Metadata) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -30,7 +45,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logicalOperation"u8); writer.WriteStringValue(LogicalOperation.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MetadataFilter DeserializeMetadataFilter(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> metadata = default; + Optional logicalOperation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetadataRecord.DeserializeMetadataRecord(item)); + } + metadata = array; + continue; + } + if (property.NameEquals("logicalOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logicalOperation = new LogicalOperationKind(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MetadataFilter(Optional.ToList(metadata), Optional.ToNullable(logicalOperation), serializedAdditionalRawData); + } + + MetadataFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetadataFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetadataFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetadataFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetadataFilter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetadataFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.cs index 4a3b1d40fd20..cd768cee9893 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataFilter.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.AI.Language.QuestionAnswering /// Find QnAs that are associated with the given list of metadata. public partial class MetadataFilter { - /// Initializes a new instance of MetadataFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MetadataFilter() { Metadata = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// Operation used to join metadata filters. + /// Keeps track of any properties unknown to the library. + internal MetadataFilter(IList metadata, LogicalOperationKind? logicalOperation, Dictionary serializedAdditionalRawData) + { + Metadata = metadata; + LogicalOperation = logicalOperation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets the metadata. public IList Metadata { get; } /// Operation used to join metadata filters. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.Serialization.cs index 766a32113876..8b90e9474611 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class MetadataRecord : IUtf8JsonSerializable + public partial class MetadataRecord : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MetadataRecord DeserializeMetadataRecord(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MetadataRecord(key, value, serializedAdditionalRawData); + } + + MetadataRecord IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataRecord(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetadataRecord IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetadataRecord(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetadataRecord model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetadataRecord(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetadataRecord(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.cs index cf9d98867c42..456a6d3f0497 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/MetadataRecord.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.Language.QuestionAnswering @@ -13,7 +14,10 @@ namespace Azure.AI.Language.QuestionAnswering /// Object to provide the key value pair for each metadata. public partial class MetadataRecord { - /// Initializes a new instance of MetadataRecord. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Metadata Key from Metadata dictionary used in the QnA. /// Metadata Value from Metadata dictionary used in the QnA. /// or is null. @@ -26,6 +30,22 @@ public MetadataRecord(string key, string value) Value = value; } + /// Initializes a new instance of . + /// Metadata Key from Metadata dictionary used in the QnA. + /// Metadata Value from Metadata dictionary used in the QnA. + /// Keeps track of any properties unknown to the library. + internal MetadataRecord(string key, string value, Dictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MetadataRecord() + { + } + /// Metadata Key from Metadata dictionary used in the QnA. public string Key { get; } /// Metadata Value from Metadata dictionary used in the QnA. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.Serialization.cs index 34b8750a8efe..34ad73906375 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class QueryFilters : IUtf8JsonSerializable + public partial class QueryFilters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MetadataFilter)) { writer.WritePropertyName("metadataFilter"u8); - writer.WriteObjectValue(MetadataFilter); + if (MetadataFilter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MetadataFilter).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(SourceFilter)) { @@ -35,7 +50,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logicalOperation"u8); writer.WriteStringValue(LogicalOperation.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryFilters DeserializeQueryFilters(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional metadataFilter = default; + Optional> sourceFilter = default; + Optional logicalOperation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadataFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadataFilter = MetadataFilter.DeserializeMetadataFilter(property.Value); + continue; + } + if (property.NameEquals("sourceFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + sourceFilter = array; + continue; + } + if (property.NameEquals("logicalOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logicalOperation = new LogicalOperationKind(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryFilters(metadataFilter.Value, Optional.ToList(sourceFilter), Optional.ToNullable(logicalOperation), serializedAdditionalRawData); + } + + QueryFilters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryFilters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryFilters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryFilters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryFilters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryFilters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryFilters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.cs index 7edae90985d2..2643c8755899 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/QueryFilters.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.AI.Language.QuestionAnswering /// filters over knowledge base. public partial class QueryFilters { - /// Initializes a new instance of QueryFilters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public QueryFilters() { SourceFilter = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Find QnAs that are associated with the given list of metadata. + /// Find QnAs that are associated with any of the given list of sources in knowledge base. + /// Logical operation used to join metadata filter with source filter. + /// Keeps track of any properties unknown to the library. + internal QueryFilters(MetadataFilter metadataFilter, IList sourceFilter, LogicalOperationKind? logicalOperation, Dictionary serializedAdditionalRawData) + { + MetadataFilter = metadataFilter; + SourceFilter = sourceFilter; + LogicalOperation = logicalOperation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Find QnAs that are associated with the given list of metadata. public MetadataFilter MetadataFilter { get; set; } /// Find QnAs that are associated with any of the given list of sources in knowledge base. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.Serialization.cs index 119b28cf41c2..5df7803de717 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class ShortAnswerOptions : IUtf8JsonSerializable + public partial class ShortAnswerOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enable"u8); writer.WriteBooleanValue(Enable); @@ -27,7 +35,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("topAnswersWithSpan"u8); writer.WriteNumberValue(Size.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ShortAnswerOptions DeserializeShortAnswerOptions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool enable = default; + Optional confidenceScoreThreshold = default; + Optional topAnswersWithSpan = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enable"u8)) + { + enable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("confidenceScoreThreshold"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScoreThreshold = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("topAnswersWithSpan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topAnswersWithSpan = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ShortAnswerOptions(enable, Optional.ToNullable(confidenceScoreThreshold), Optional.ToNullable(topAnswersWithSpan), serializedAdditionalRawData); + } + + ShortAnswerOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShortAnswerOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShortAnswerOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShortAnswerOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShortAnswerOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShortAnswerOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShortAnswerOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.cs index 75137bd4b366..d9559244414d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/ShortAnswerOptions.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// To configure Answer span prediction feature. public partial class ShortAnswerOptions { - /// Initializes a new instance of ShortAnswerOptions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ShortAnswerOptions() { Enable = true; } + + /// Initializes a new instance of . + /// Enable or disable Answer Span prediction. + /// Minimum threshold score required to include an answer span, value ranges from 0 to 1. + /// Number of Top answers to be considered for span prediction from 1 to 10. + /// Keeps track of any properties unknown to the library. + internal ShortAnswerOptions(bool enable, double? confidenceThreshold, int? size, Dictionary serializedAdditionalRawData) + { + Enable = enable; + ConfidenceThreshold = confidenceThreshold; + Size = size; + _serializedAdditionalRawData = serializedAdditionalRawData; + } /// Minimum threshold score required to include an answer span, value ranges from 0 to 1. public double? ConfidenceThreshold { get; set; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.Serialization.cs index 95575ddad074..d6e550e59ece 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.Serialization.cs @@ -5,15 +5,80 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class TextAnswer + public partial class TextAnswer : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TextAnswer DeserializeTextAnswer(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Answer)) + { + writer.WritePropertyName("answer"u8); + writer.WriteStringValue(Answer); + } + if (Optional.IsDefined(Confidence)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence.Value); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ShortAnswer)) + { + writer.WritePropertyName("answerSpan"u8); + if (ShortAnswer is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShortAnswer).Serialize(writer, options); + } + } + if (Optional.IsDefined(Offset)) + { + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset.Value); + } + if (Optional.IsDefined(Length)) + { + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TextAnswer DeserializeTextAnswer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +89,7 @@ internal static TextAnswer DeserializeTextAnswer(JsonElement element) Optional answerSpan = default; Optional offset = default; Optional length = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("answer"u8)) @@ -72,8 +138,61 @@ internal static TextAnswer DeserializeTextAnswer(JsonElement element) length = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TextAnswer(answer.Value, Optional.ToNullable(confidenceScore), id.Value, answerSpan.Value, Optional.ToNullable(offset), Optional.ToNullable(length)); + return new TextAnswer(answer.Value, Optional.ToNullable(confidenceScore), id.Value, answerSpan.Value, Optional.ToNullable(offset), Optional.ToNullable(length), serializedAdditionalRawData); + } + + TextAnswer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextAnswer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextAnswer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextAnswer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextAnswer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TextAnswer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextAnswer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.cs index 389364e97f61..5c2155d68bc0 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextAnswer.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.Language.QuestionAnswering { /// Represents answer result. public partial class TextAnswer { - /// Initializes a new instance of TextAnswer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TextAnswer() { } - /// Initializes a new instance of TextAnswer. + /// Initializes a new instance of . /// Answer. /// answer confidence score, value ranges from 0 to 1. /// record ID. /// Answer span object with respect to user's question. /// The sentence offset from the start of the document. /// The length of the sentence. - internal TextAnswer(string answer, double? confidence, string id, AnswerSpan shortAnswer, int? offset, int? length) + /// Keeps track of any properties unknown to the library. + internal TextAnswer(string answer, double? confidence, string id, AnswerSpan shortAnswer, int? offset, int? length, Dictionary serializedAdditionalRawData) { Answer = answer; Confidence = confidence; @@ -30,6 +37,7 @@ internal TextAnswer(string answer, double? confidence, string id, AnswerSpan sho ShortAnswer = shortAnswer; Offset = offset; Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Answer. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.Serialization.cs index 9bdae6edf3b1..706e2641594d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.Language.QuestionAnswering { - public partial class TextDocument : IUtf8JsonSerializable + public partial class TextDocument : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TextDocument DeserializeTextDocument(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string text = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextDocument(id, text, serializedAdditionalRawData); + } + + TextDocument IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextDocument(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextDocument IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextDocument(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextDocument model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TextDocument(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextDocument(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.cs index 7c844055725a..d4bf05d5518a 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/Models/TextDocument.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.Language.QuestionAnswering @@ -13,5 +14,23 @@ namespace Azure.AI.Language.QuestionAnswering /// Represent input text record to be queried. public partial class TextDocument { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique identifier for the text record. + /// Text contents of the record. + /// Keeps track of any properties unknown to the library. + internal TextDocument(string id, string text, Dictionary serializedAdditionalRawData) + { + Id = id; + Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextDocument() + { + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringAuthoringClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringAuthoringClient.cs index 5ab7d4dd0dab..bed98c6c86bd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringAuthoringClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringAuthoringClient.cs @@ -816,7 +816,7 @@ public virtual AsyncPageable GetProjectsAsync(RequestContext context { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", context); } /// @@ -837,7 +837,7 @@ public virtual Pageable GetProjects(RequestContext context = null) { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", context); } /// @@ -863,7 +863,7 @@ public virtual AsyncPageable GetDeploymentsAsync(string projectName, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", context); } /// @@ -889,7 +889,7 @@ public virtual Pageable GetDeployments(string projectName, RequestCo HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", context); } /// @@ -915,7 +915,7 @@ public virtual AsyncPageable GetSynonymsAsync(string projectName, Re HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSynonymsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSynonymsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", context); } /// @@ -941,7 +941,7 @@ public virtual Pageable GetSynonyms(string projectName, RequestConte HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSynonymsRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSynonymsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", context); } /// @@ -967,7 +967,7 @@ public virtual AsyncPageable GetSourcesAsync(string projectName, Req HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSourcesRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSourcesNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", context); } /// @@ -993,7 +993,7 @@ public virtual Pageable GetSources(string projectName, RequestContex HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSourcesRequest(projectName, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSourcesNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", context); } /// @@ -1020,7 +1020,7 @@ public virtual AsyncPageable GetQnasAsync(string projectName, string HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQnasRequest(projectName, source, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQnasNextPageRequest(nextLink, projectName, source, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", context); } /// @@ -1047,7 +1047,7 @@ public virtual Pageable GetQnas(string projectName, string source = HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQnasRequest(projectName, source, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQnasNextPageRequest(nextLink, projectName, source, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", context); } /// @@ -1382,7 +1382,7 @@ public virtual async Task>> UpdateSourcesAsy { HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateUpdateSourcesNextPageRequest(nextLink, projectName, content, context); using HttpMessage message = CreateUpdateSourcesRequest(projectName, content, context); - return await GeneratorPageableHelpers.CreateAsyncPageable(waitUntil, message, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateSources", "value", "nextLink", context).ConfigureAwait(false); + return await GeneratorPageableHelpers.CreateAsyncPageable(waitUntil, message, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateSources", "value", "nextLink", context).ConfigureAwait(false); } catch (Exception e) { @@ -1421,7 +1421,7 @@ public virtual Operation> UpdateSources(WaitUntil waitUntil { HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateUpdateSourcesNextPageRequest(nextLink, projectName, content, context); using HttpMessage message = CreateUpdateSourcesRequest(projectName, content, context); - return GeneratorPageableHelpers.CreatePageable(waitUntil, message, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateSources", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(waitUntil, message, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateSources", "value", "nextLink", context); } catch (Exception e) { @@ -1460,7 +1460,7 @@ public virtual async Task>> UpdateQnasAsync( { HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateUpdateQnasNextPageRequest(nextLink, projectName, content, context); using HttpMessage message = CreateUpdateQnasRequest(projectName, content, context); - return await GeneratorPageableHelpers.CreateAsyncPageable(waitUntil, message, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateQnas", "value", "nextLink", context).ConfigureAwait(false); + return await GeneratorPageableHelpers.CreateAsyncPageable(waitUntil, message, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateQnas", "value", "nextLink", context).ConfigureAwait(false); } catch (Exception e) { @@ -1499,7 +1499,7 @@ public virtual Operation> UpdateQnas(WaitUntil waitUntil, s { HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateUpdateQnasNextPageRequest(nextLink, projectName, content, context); using HttpMessage message = CreateUpdateQnasRequest(projectName, content, context); - return GeneratorPageableHelpers.CreatePageable(waitUntil, message, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateQnas", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(waitUntil, message, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, OperationFinalStateVia.Location, "QuestionAnsweringAuthoringClient.UpdateQnas", "value", "nextLink", context); } catch (Exception e) { diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringModelFactory.cs index 7eb7d563e65b..788b898b6c8e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringModelFactory.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringModelFactory.cs @@ -13,17 +13,26 @@ namespace Azure.AI.Language.QuestionAnswering /// Model factory for models. public static partial class QuestionAnsweringModelFactory { - /// Initializes a new instance of AnswersResult. + /// Initializes a new instance of . + /// Previous turn top answer result QnA ID. + /// Previous user query. + /// A new instance for mocking. + public static KnowledgeBaseAnswerContext KnowledgeBaseAnswerContext(int previousQnaId = default, string previousQuestion = null) + { + return new KnowledgeBaseAnswerContext(previousQnaId, previousQuestion, default); + } + + /// Initializes a new instance of . /// Represents Answer Result list. /// A new instance for mocking. public static AnswersResult AnswersResult(IEnumerable answers = null) { answers ??= new List(); - return new AnswersResult(answers?.ToList()); + return new AnswersResult(answers?.ToList(), default); } - /// Initializes a new instance of KnowledgeBaseAnswer. + /// Initializes a new instance of . /// List of questions associated with the answer. /// Answer text. /// Answer confidence score, value ranges from 0 to 1. @@ -38,10 +47,10 @@ public static KnowledgeBaseAnswer KnowledgeBaseAnswer(IEnumerable questi questions ??= new List(); metadata ??= new Dictionary(); - return new KnowledgeBaseAnswer(questions?.ToList(), answer, confidence, qnaId, source, metadata, dialog, shortAnswer); + return new KnowledgeBaseAnswer(questions?.ToList(), answer, confidence, qnaId, source, metadata, dialog, shortAnswer, default); } - /// Initializes a new instance of KnowledgeBaseAnswerDialog. + /// Initializes a new instance of . /// To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. /// List of prompts associated with the answer. /// A new instance for mocking. @@ -49,20 +58,20 @@ public static KnowledgeBaseAnswerDialog KnowledgeBaseAnswerDialog(bool? isContex { prompts ??= new List(); - return new KnowledgeBaseAnswerDialog(isContextOnly, prompts?.ToList()); + return new KnowledgeBaseAnswerDialog(isContextOnly, prompts?.ToList(), default); } - /// Initializes a new instance of KnowledgeBaseAnswerPrompt. + /// Initializes a new instance of . /// Index of the prompt - used in ordering of the prompts. /// QnA ID corresponding to the prompt. /// Text displayed to represent a follow up question prompt. /// A new instance for mocking. public static KnowledgeBaseAnswerPrompt KnowledgeBaseAnswerPrompt(int? displayOrder = null, int? qnaId = null, string displayText = null) { - return new KnowledgeBaseAnswerPrompt(displayOrder, qnaId, displayText); + return new KnowledgeBaseAnswerPrompt(displayOrder, qnaId, displayText, default); } - /// Initializes a new instance of AnswerSpan. + /// Initializes a new instance of . /// Predicted text of answer span. /// Predicted score of answer span, value ranges from 0 to 1. /// The answer span offset from the start of answer. @@ -70,20 +79,20 @@ public static KnowledgeBaseAnswerPrompt KnowledgeBaseAnswerPrompt(int? displayOr /// A new instance for mocking. public static AnswerSpan AnswerSpan(string text = null, double? confidence = null, int? offset = null, int? length = null) { - return new AnswerSpan(text, confidence, offset, length); + return new AnswerSpan(text, confidence, offset, length, default); } - /// Initializes a new instance of AnswersFromTextResult. + /// Initializes a new instance of . /// Represents the answer results. /// A new instance for mocking. public static AnswersFromTextResult AnswersFromTextResult(IEnumerable answers = null) { answers ??= new List(); - return new AnswersFromTextResult(answers?.ToList()); + return new AnswersFromTextResult(answers?.ToList(), default); } - /// Initializes a new instance of TextAnswer. + /// Initializes a new instance of . /// Answer. /// answer confidence score, value ranges from 0 to 1. /// record ID. @@ -93,7 +102,7 @@ public static AnswersFromTextResult AnswersFromTextResult(IEnumerable A new instance for mocking. public static TextAnswer TextAnswer(string answer = null, double? confidence = null, string id = null, AnswerSpan shortAnswer = null, int? offset = null, int? length = null) { - return new TextAnswer(answer, confidence, id, shortAnswer, offset, length); + return new TextAnswer(answer, confidence, id, shortAnswer, offset, length, default); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringRestClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringRestClient.cs index 845c3f3313ed..679d6ba06769 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringRestClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/Generated/QuestionAnsweringRestClient.cs @@ -53,9 +53,7 @@ internal HttpMessage CreateGetAnswersRequest(string projectName, string deployme request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(knowledgeBaseQueryOptions); - request.Content = content; + request.Content = knowledgeBaseQueryOptions; return message; } @@ -146,9 +144,7 @@ internal HttpMessage CreateGetAnswersFromTextRequest(AnswersFromTextOptions text request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(textQueryOptions); - request.Content = content; + request.Content = textQueryOptions; return message; } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs index 4446fe043c51..c7d6407f934a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Model factory for models. public static partial class ArmCognitiveServicesModelFactory { - /// Initializes a new instance of CognitiveServicesAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,10 +35,10 @@ public static CognitiveServicesAccountData CognitiveServicesAccountData(Resource { tags ??= new Dictionary(); - return new CognitiveServicesAccountData(id, name, resourceType, systemData, tags, location, kind, sku, identity, properties, etag); + return new CognitiveServicesAccountData(id, name, resourceType, systemData, tags, location, kind, sku, identity, properties, etag, default); } - /// Initializes a new instance of CognitiveServicesAccountProperties. + /// Initializes a new instance of . /// Gets the status of the cognitive services account at the time the operation was called. /// Endpoint of the created account. /// Gets the capabilities of the cognitive services account. Each item indicates the capability of a specific feature. The values are read-only and for reference only. @@ -76,29 +76,29 @@ public static CognitiveServicesAccountProperties CognitiveServicesAccountPropert endpoints ??= new Dictionary(); commitmentPlanAssociations ??= new List(); - return new CognitiveServicesAccountProperties(provisioningState, endpoint, capabilities?.ToList(), isMigrated, migrationToken, skuChangeInfo, customSubDomainName, networkAcls, encryption, userOwnedStorage?.ToList(), privateEndpointConnections?.ToList(), publicNetworkAccess, apiProperties, createdOn, callRateLimit, enableDynamicThrottling, quotaLimit, restrictOutboundNetworkAccess, allowedFqdnList?.ToList(), disableLocalAuth, endpoints, restore, deletedOn, scheduledPurgeDate, locations, commitmentPlanAssociations?.ToList(), abusePenalty); + return new CognitiveServicesAccountProperties(provisioningState, endpoint, capabilities?.ToList(), isMigrated, migrationToken, skuChangeInfo, customSubDomainName, networkAcls, encryption, userOwnedStorage?.ToList(), privateEndpointConnections?.ToList(), publicNetworkAccess, apiProperties, createdOn, callRateLimit, enableDynamicThrottling, quotaLimit, restrictOutboundNetworkAccess, allowedFqdnList?.ToList(), disableLocalAuth, endpoints, restore, deletedOn, scheduledPurgeDate, locations, commitmentPlanAssociations?.ToList(), abusePenalty, default); } - /// Initializes a new instance of CognitiveServicesSkuCapability. + /// Initializes a new instance of . /// The name of the SkuCapability. /// The value of the SkuCapability. /// A new instance for mocking. public static CognitiveServicesSkuCapability CognitiveServicesSkuCapability(string name = null, string value = null) { - return new CognitiveServicesSkuCapability(name, value); + return new CognitiveServicesSkuCapability(name, value, default); } - /// Initializes a new instance of CognitiveServicesSkuChangeInfo. + /// Initializes a new instance of . /// Gets the count of downgrades. /// Gets the count of upgrades after downgrades. /// Gets the last change date. /// A new instance for mocking. public static CognitiveServicesSkuChangeInfo CognitiveServicesSkuChangeInfo(float? countOfDowngrades = null, float? countOfUpgradesAfterDowngrades = null, DateTimeOffset? lastChangedOn = null) { - return new CognitiveServicesSkuChangeInfo(countOfDowngrades, countOfUpgradesAfterDowngrades, lastChangedOn); + return new CognitiveServicesSkuChangeInfo(countOfDowngrades, countOfUpgradesAfterDowngrades, lastChangedOn, default); } - /// Initializes a new instance of CognitiveServicesPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -114,10 +114,10 @@ public static CognitiveServicesPrivateEndpointConnectionData CognitiveServicesPr { groupIds ??= new List(); - return new CognitiveServicesPrivateEndpointConnectionData(id, name, resourceType, systemData, location, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, groupIds?.ToList(), etag); + return new CognitiveServicesPrivateEndpointConnectionData(id, name, resourceType, systemData, location, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, groupIds?.ToList(), etag, default); } - /// Initializes a new instance of ServiceAccountCallRateLimit. + /// Initializes a new instance of . /// The count value of Call Rate Limit. /// The renewal period in seconds of Call Rate Limit. /// @@ -126,10 +126,10 @@ public static ServiceAccountCallRateLimit ServiceAccountCallRateLimit(float? cou { rules ??= new List(); - return new ServiceAccountCallRateLimit(count, renewalPeriod, rules?.ToList()); + return new ServiceAccountCallRateLimit(count, renewalPeriod, rules?.ToList(), default); } - /// Initializes a new instance of ServiceAccountThrottlingRule. + /// Initializes a new instance of . /// /// /// @@ -141,19 +141,19 @@ public static ServiceAccountThrottlingRule ServiceAccountThrottlingRule(string k { matchPatterns ??= new List(); - return new ServiceAccountThrottlingRule(key, renewalPeriod, count, minCount, isDynamicThrottlingEnabled, matchPatterns?.ToList()); + return new ServiceAccountThrottlingRule(key, renewalPeriod, count, minCount, isDynamicThrottlingEnabled, matchPatterns?.ToList(), default); } - /// Initializes a new instance of ServiceAccountThrottlingMatchPattern. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static ServiceAccountThrottlingMatchPattern ServiceAccountThrottlingMatchPattern(string path = null, string method = null) { - return new ServiceAccountThrottlingMatchPattern(path, method); + return new ServiceAccountThrottlingMatchPattern(path, method, default); } - /// Initializes a new instance of ServiceAccountQuotaLimit. + /// Initializes a new instance of . /// /// /// @@ -162,38 +162,38 @@ public static ServiceAccountQuotaLimit ServiceAccountQuotaLimit(float? count = n { rules ??= new List(); - return new ServiceAccountQuotaLimit(count, renewalPeriod, rules?.ToList()); + return new ServiceAccountQuotaLimit(count, renewalPeriod, rules?.ToList(), default); } - /// Initializes a new instance of CommitmentPlanAssociation. + /// Initializes a new instance of . /// The Azure resource id of the commitment plan. /// The location of of the commitment plan. /// A new instance for mocking. public static CommitmentPlanAssociation CommitmentPlanAssociation(ResourceIdentifier commitmentPlanId = null, string commitmentPlanLocation = null) { - return new CommitmentPlanAssociation(commitmentPlanId, commitmentPlanLocation); + return new CommitmentPlanAssociation(commitmentPlanId, commitmentPlanLocation, default); } - /// Initializes a new instance of AbusePenalty. + /// Initializes a new instance of . /// The action of AbusePenalty. /// The percentage of rate limit. /// The datetime of expiration of the AbusePenalty. /// A new instance for mocking. public static AbusePenalty AbusePenalty(AbusePenaltyAction? action = null, float? rateLimitPercentage = null, DateTimeOffset? expiration = null) { - return new AbusePenalty(action, rateLimitPercentage, expiration); + return new AbusePenalty(action, rateLimitPercentage, expiration, default); } - /// Initializes a new instance of ServiceAccountApiKeys. + /// Initializes a new instance of . /// Gets the value of key 1. /// Gets the value of key 2. /// A new instance for mocking. public static ServiceAccountApiKeys ServiceAccountApiKeys(string key1 = null, string key2 = null) { - return new ServiceAccountApiKeys(key1, key2); + return new ServiceAccountApiKeys(key1, key2, default); } - /// Initializes a new instance of AvailableCognitiveServicesSku. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// The name of SKU. /// Specifies the tier of Cognitive Services account. @@ -206,10 +206,10 @@ public static AvailableCognitiveServicesSku AvailableCognitiveServicesSku(string locations ??= new List(); restrictions ??= new List(); - return new AvailableCognitiveServicesSku(resourceType, name, tier, kind, locations?.ToList(), restrictions?.ToList()); + return new AvailableCognitiveServicesSku(resourceType, name, tier, kind, locations?.ToList(), restrictions?.ToList(), default); } - /// Initializes a new instance of CognitiveServicesSkuRestrictions. + /// Initializes a new instance of . /// The type of restrictions. /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. /// The information about the restriction where the SKU cannot be used. @@ -219,10 +219,10 @@ public static CognitiveServicesSkuRestrictions CognitiveServicesSkuRestrictions( { values ??= new List(); - return new CognitiveServicesSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode); + return new CognitiveServicesSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode, default); } - /// Initializes a new instance of CognitiveServicesSkuRestrictionInfo. + /// Initializes a new instance of . /// Locations where the SKU is restricted. /// List of availability zones where the SKU is restricted. /// A new instance for mocking. @@ -231,19 +231,19 @@ public static CognitiveServicesSkuRestrictionInfo CognitiveServicesSkuRestrictio locations ??= new List(); zones ??= new List(); - return new CognitiveServicesSkuRestrictionInfo(locations?.ToList(), zones?.ToList()); + return new CognitiveServicesSkuRestrictionInfo(locations?.ToList(), zones?.ToList(), default); } - /// Initializes a new instance of CognitiveServicesAccountSku. + /// Initializes a new instance of . /// Resource Namespace and Type. /// The SKU of Cognitive Services account. /// A new instance for mocking. public static CognitiveServicesAccountSku CognitiveServicesAccountSku(ResourceType? resourceType = null, CognitiveServicesSku sku = null) { - return new CognitiveServicesAccountSku(resourceType, sku); + return new CognitiveServicesAccountSku(resourceType, sku, default); } - /// Initializes a new instance of ServiceAccountUsage. + /// Initializes a new instance of . /// The unit of the metric. /// The name information for the metric. /// The quota period used to summarize the usage values. @@ -254,19 +254,19 @@ public static CognitiveServicesAccountSku CognitiveServicesAccountSku(ResourceTy /// A new instance for mocking. public static ServiceAccountUsage ServiceAccountUsage(ServiceAccountUsageUnitType? unit = null, ServiceAccountUsageMetricName name = null, string quotaPeriod = null, double? limit = null, double? currentValue = null, string nextResetTime = null, ServiceAccountQuotaUsageStatus? status = null) { - return new ServiceAccountUsage(unit, name, quotaPeriod, limit, currentValue, nextResetTime, status); + return new ServiceAccountUsage(unit, name, quotaPeriod, limit, currentValue, nextResetTime, status, default); } - /// Initializes a new instance of ServiceAccountUsageMetricName. + /// Initializes a new instance of . /// The name of the metric. /// The friendly name of the metric. /// A new instance for mocking. public static ServiceAccountUsageMetricName ServiceAccountUsageMetricName(string value = null, string localizedValue = null) { - return new ServiceAccountUsageMetricName(value, localizedValue); + return new ServiceAccountUsageMetricName(value, localizedValue, default); } - /// Initializes a new instance of CognitiveServicesAccountModel. + /// Initializes a new instance of . /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. @@ -288,10 +288,10 @@ public static CognitiveServicesAccountModel CognitiveServicesAccountModel(string capabilities ??= new Dictionary(); finetuneCapabilities ??= new Dictionary(); - return new CognitiveServicesAccountModel(format, name, version, source, callRateLimit, baseModel, isDefaultVersion, skus?.ToList(), maxCapacity, capabilities, finetuneCapabilities, deprecation, lifecycleStatus, systemData); + return new CognitiveServicesAccountModel(format, name, version, source, callRateLimit, baseModel, isDefaultVersion, skus?.ToList(), maxCapacity, capabilities, finetuneCapabilities, deprecation, lifecycleStatus, systemData, default); } - /// Initializes a new instance of CognitiveServicesAccountDeploymentModel. + /// Initializes a new instance of . /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. @@ -300,10 +300,10 @@ public static CognitiveServicesAccountModel CognitiveServicesAccountModel(string /// A new instance for mocking. public static CognitiveServicesAccountDeploymentModel CognitiveServicesAccountDeploymentModel(string format = null, string name = null, string version = null, string source = null, ServiceAccountCallRateLimit callRateLimit = null) { - return new CognitiveServicesAccountDeploymentModel(format, name, version, source, callRateLimit); + return new CognitiveServicesAccountDeploymentModel(format, name, version, source, callRateLimit, default); } - /// Initializes a new instance of CognitiveServicesModelSku. + /// Initializes a new instance of . /// The name of the model SKU. /// The usage name of the model SKU. /// The datetime of deprecation of the model SKU. @@ -314,10 +314,10 @@ public static CognitiveServicesModelSku CognitiveServicesModelSku(string name = { rateLimits ??= new List(); - return new CognitiveServicesModelSku(name, usageName, deprecationOn, capacity, rateLimits?.ToList()); + return new CognitiveServicesModelSku(name, usageName, deprecationOn, capacity, rateLimits?.ToList(), default); } - /// Initializes a new instance of CognitiveServicesSkuAvailabilityList. + /// Initializes a new instance of . /// The Kind of the resource. /// The Type of the resource. /// The SKU of Cognitive Services account. @@ -327,10 +327,10 @@ public static CognitiveServicesModelSku CognitiveServicesModelSku(string name = /// A new instance for mocking. public static CognitiveServicesSkuAvailabilityList CognitiveServicesSkuAvailabilityList(string kind = null, string skuAvailabilityType = null, string skuName = null, bool? isSkuAvailable = null, string reason = null, string message = null) { - return new CognitiveServicesSkuAvailabilityList(kind, skuAvailabilityType, skuName, isSkuAvailable, reason, message); + return new CognitiveServicesSkuAvailabilityList(kind, skuAvailabilityType, skuName, isSkuAvailable, reason, message, default); } - /// Initializes a new instance of CommitmentTier. + /// Initializes a new instance of . /// The Kind of the resource. /// The name of the SKU. Ex - P3. It is typically a letter+number code. /// Account hosting model. @@ -342,38 +342,48 @@ public static CognitiveServicesSkuAvailabilityList CognitiveServicesSkuAvailabil /// A new instance for mocking. public static CommitmentTier CommitmentTier(string kind = null, string skuName = null, ServiceAccountHostingModel? hostingModel = null, string planType = null, string tier = null, int? maxCount = null, CommitmentQuota quota = null, CommitmentCost cost = null) { - return new CommitmentTier(kind, skuName, hostingModel, planType, tier, maxCount, quota, cost); + return new CommitmentTier(kind, skuName, hostingModel, planType, tier, maxCount, quota, cost, default); } - /// Initializes a new instance of CommitmentQuota. + /// Initializes a new instance of . /// Commitment quota quantity. /// Commitment quota unit. /// A new instance for mocking. public static CommitmentQuota CommitmentQuota(long? quantity = null, string unit = null) { - return new CommitmentQuota(quantity, unit); + return new CommitmentQuota(quantity, unit, default); } - /// Initializes a new instance of CommitmentCost. + /// Initializes a new instance of . /// Commitment meter Id. /// Overage meter Id. /// A new instance for mocking. public static CommitmentCost CommitmentCost(string commitmentMeterId = null, string overageMeterId = null) { - return new CommitmentCost(commitmentMeterId, overageMeterId); + return new CommitmentCost(commitmentMeterId, overageMeterId, default); } - /// Initializes a new instance of CognitiveServicesModel. + /// Initializes a new instance of . /// Model Metadata. /// The Kind of the Model. /// The SKU of the Model. /// A new instance for mocking. public static CognitiveServicesModel CognitiveServicesModel(CognitiveServicesAccountModel model = null, string kind = null, string skuName = null) { - return new CognitiveServicesModel(model, kind, skuName); + return new CognitiveServicesModel(model, kind, skuName, default); } - /// Initializes a new instance of CognitiveServicesDomainAvailabilityList. + /// Initializes a new instance of . + /// The subdomain name to use. + /// The Type of the resource. + /// The Kind of the resource. + /// A new instance for mocking. + public static CognitiveServicesDomainAvailabilityContent CognitiveServicesDomainAvailabilityContent(string subdomainName = null, ResourceType resourceType = default, string kind = null) + { + return new CognitiveServicesDomainAvailabilityContent(subdomainName, resourceType, kind, default); + } + + /// Initializes a new instance of . /// Indicates the given SKU is available or not. /// Reason why the SKU is not available. /// The subdomain name to use. @@ -382,10 +392,10 @@ public static CognitiveServicesModel CognitiveServicesModel(CognitiveServicesAcc /// A new instance for mocking. public static CognitiveServicesDomainAvailabilityList CognitiveServicesDomainAvailabilityList(bool? isSubdomainAvailable = null, string reason = null, string subdomainName = null, string domainAvailabilityType = null, string kind = null) { - return new CognitiveServicesDomainAvailabilityList(isSubdomainAvailable, reason, subdomainName, domainAvailabilityType, kind); + return new CognitiveServicesDomainAvailabilityList(isSubdomainAvailable, reason, subdomainName, domainAvailabilityType, kind, default); } - /// Initializes a new instance of CognitiveServicesPrivateLinkResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -394,10 +404,10 @@ public static CognitiveServicesDomainAvailabilityList CognitiveServicesDomainAva /// A new instance for mocking. public static CognitiveServicesPrivateLinkResource CognitiveServicesPrivateLinkResource(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CognitiveServicesPrivateLinkResourceProperties properties = null) { - return new CognitiveServicesPrivateLinkResource(id, name, resourceType, systemData, properties); + return new CognitiveServicesPrivateLinkResource(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of CognitiveServicesPrivateLinkResourceProperties. + /// Initializes a new instance of . /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. @@ -408,10 +418,10 @@ public static CognitiveServicesPrivateLinkResourceProperties CognitiveServicesPr requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new CognitiveServicesPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), displayName); + return new CognitiveServicesPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), displayName, default); } - /// Initializes a new instance of CognitiveServicesAccountDeploymentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -422,10 +432,10 @@ public static CognitiveServicesPrivateLinkResourceProperties CognitiveServicesPr /// A new instance for mocking. public static CognitiveServicesAccountDeploymentData CognitiveServicesAccountDeploymentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CognitiveServicesSku sku = null, ETag? etag = null, CognitiveServicesAccountDeploymentProperties properties = null) { - return new CognitiveServicesAccountDeploymentData(id, name, resourceType, systemData, sku, etag, properties); + return new CognitiveServicesAccountDeploymentData(id, name, resourceType, systemData, sku, etag, properties, default); } - /// Initializes a new instance of CognitiveServicesAccountDeploymentProperties. + /// Initializes a new instance of . /// Gets the status of the resource at the time the operation was called. /// Properties of Cognitive Services account deployment model. /// Properties of Cognitive Services account deployment model. @@ -440,20 +450,20 @@ public static CognitiveServicesAccountDeploymentProperties CognitiveServicesAcco capabilities ??= new Dictionary(); rateLimits ??= new List(); - return new CognitiveServicesAccountDeploymentProperties(provisioningState, model, scaleSettings, capabilities, raiPolicyName, callRateLimit, rateLimits?.ToList(), versionUpgradeOption); + return new CognitiveServicesAccountDeploymentProperties(provisioningState, model, scaleSettings, capabilities, raiPolicyName, callRateLimit, rateLimits?.ToList(), versionUpgradeOption, default); } - /// Initializes a new instance of CognitiveServicesAccountDeploymentScaleSettings. + /// Initializes a new instance of . /// Deployment scale type. /// Deployment capacity. /// Deployment active capacity. This value might be different from `capacity` if customer recently updated `capacity`. /// A new instance for mocking. public static CognitiveServicesAccountDeploymentScaleSettings CognitiveServicesAccountDeploymentScaleSettings(CognitiveServicesAccountDeploymentScaleType? scaleType = null, int? capacity = null, int? activeCapacity = null) { - return new CognitiveServicesAccountDeploymentScaleSettings(scaleType, capacity, activeCapacity); + return new CognitiveServicesAccountDeploymentScaleSettings(scaleType, capacity, activeCapacity, default); } - /// Initializes a new instance of CommitmentPlanData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -469,10 +479,10 @@ public static CommitmentPlanData CommitmentPlanData(ResourceIdentifier id = null { tags ??= new Dictionary(); - return new CommitmentPlanData(id, name, resourceType, systemData, etag, kind, sku, tags, location, properties); + return new CommitmentPlanData(id, name, resourceType, systemData, etag, kind, sku, tags, location, properties, default); } - /// Initializes a new instance of CommitmentPlanProperties. + /// Initializes a new instance of . /// Gets the status of the resource at the time the operation was called. /// Commitment plan guid. /// Account hosting model. @@ -487,10 +497,10 @@ public static CommitmentPlanProperties CommitmentPlanProperties(CommitmentPlanPr { provisioningIssues ??= new List(); - return new CommitmentPlanProperties(provisioningState, commitmentPlanGuid, hostingModel, planType, current, autoRenew, next, last, provisioningIssues?.ToList()); + return new CommitmentPlanProperties(provisioningState, commitmentPlanGuid, hostingModel, planType, current, autoRenew, next, last, provisioningIssues?.ToList(), default); } - /// Initializes a new instance of CommitmentPeriod. + /// Initializes a new instance of . /// Commitment period commitment tier. /// Commitment period commitment count. /// Cognitive Services account commitment quota. @@ -499,10 +509,10 @@ public static CommitmentPlanProperties CommitmentPlanProperties(CommitmentPlanPr /// A new instance for mocking. public static CommitmentPeriod CommitmentPeriod(string tier = null, int? count = null, CommitmentQuota quota = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null) { - return new CommitmentPeriod(tier, count, quota, startOn, endOn); + return new CommitmentPeriod(tier, count, quota, startOn, endOn, default); } - /// Initializes a new instance of CommitmentPlanAccountAssociationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -512,7 +522,7 @@ public static CommitmentPeriod CommitmentPeriod(string tier = null, int? count = /// A new instance for mocking. public static CommitmentPlanAccountAssociationData CommitmentPlanAccountAssociationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, string accountId = null) { - return new CommitmentPlanAccountAssociationData(id, name, resourceType, systemData, etag, accountId); + return new CommitmentPlanAccountAssociationData(id, name, resourceType, systemData, etag, accountId, default); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs index 28114a871ba5..3943e515a736 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesAccountAccountsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesAccountAccountsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), _cognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "CognitiveServicesAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), _cognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "CognitiveServicesAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesAccountAccountsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesAccountAccountsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), _cognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "CognitiveServicesAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), _cognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "CognitiveServicesAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountData.cs index 5e0198031da8..dd19828e466d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.CognitiveServices /// public partial class CognitiveServicesAccountData : TrackedResourceData { - /// Initializes a new instance of CognitiveServicesAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CognitiveServicesAccountData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CognitiveServicesAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,13 +41,20 @@ public CognitiveServicesAccountData(AzureLocation location) : base(location) /// Identity for the resource. /// Properties of Cognitive Services account. /// Resource Etag. - internal CognitiveServicesAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string kind, CognitiveServicesSku sku, ManagedServiceIdentity identity, CognitiveServicesAccountProperties properties, ETag? etag) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string kind, CognitiveServicesSku sku, ManagedServiceIdentity identity, CognitiveServicesAccountProperties properties, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; Sku = sku; Identity = identity; Properties = properties; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CognitiveServicesAccountData() + { } /// The Kind of the resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs index 8178aee1ee59..702c6d84cb2f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllA { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountDeploymentResource(Client, CognitiveServicesAccountDeploymentData.DeserializeCognitiveServicesAccountDeploymentData(e)), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, "CognitiveServicesAccountDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesAccountDeploymentResource(Client, CognitiveServicesAccountDeploymentData.DeserializeCognitiveServicesAccountDeploymentData(e)), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, "CognitiveServicesAccountDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountDeploymentResource(Client, CognitiveServicesAccountDeploymentData.DeserializeCognitiveServicesAccountDeploymentData(e)), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, "CognitiveServicesAccountDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesAccountDeploymentResource(Client, CognitiveServicesAccountDeploymentData.DeserializeCognitiveServicesAccountDeploymentData(e)), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, "CognitiveServicesAccountDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs index e8d86e54a0b8..18682135eebc 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.CognitiveServices.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.CognitiveServices /// public partial class CognitiveServicesAccountDeploymentData : ResourceData { - /// Initializes a new instance of CognitiveServicesAccountDeploymentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesAccountDeploymentData() { } - /// Initializes a new instance of CognitiveServicesAccountDeploymentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public CognitiveServicesAccountDeploymentData() /// The resource model definition representing SKU. /// Resource Etag. /// Properties of Cognitive Services account deployment. - internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, CognitiveServicesAccountDeploymentProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, CognitiveServicesAccountDeploymentProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; ETag = etag; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource model definition representing SKU. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs index dfe1b5fbe3eb..b33daa5bfeff 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "CognitiveServicesCommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "CognitiveServicesCommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "CognitiveServicesCommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "CognitiveServicesCommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs index e78bb59c7d75..6233b4c60f07 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get( public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CognitiveServicesPrivateEndpointConnectionResource(Client, CognitiveServicesPrivateEndpointConnectionData.DeserializeCognitiveServicesPrivateEndpointConnectionData(e)), _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CognitiveServicesPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CognitiveServicesPrivateEndpointConnectionResource(Client, CognitiveServicesPrivateEndpointConnectionData.DeserializeCognitiveServicesPrivateEndpointConnectionData(e)), _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CognitiveServicesPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CognitiveServicesPrivateEndpointConnectionResource(Client, CognitiveServicesPrivateEndpointConnectionData.DeserializeCognitiveServicesPrivateEndpointConnectionData(e)), _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CognitiveServicesPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CognitiveServicesPrivateEndpointConnectionResource(Client, CognitiveServicesPrivateEndpointConnectionData.DeserializeCognitiveServicesPrivateEndpointConnectionData(e)), _cognitiveServicesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CognitiveServicesPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionData.cs index 4f135fd43489..2ae08af67590 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -20,13 +21,16 @@ namespace Azure.ResourceManager.CognitiveServices /// public partial class CognitiveServicesPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of CognitiveServicesPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesPrivateEndpointConnectionData() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public CognitiveServicesPrivateEndpointConnectionData() /// The provisioning state of the private endpoint connection resource. /// The private link resource group ids. /// Resource Etag. - internal CognitiveServicesPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, SubResource privateEndpoint, CognitiveServicesPrivateLinkServiceConnectionState connectionState, CognitiveServicesPrivateEndpointConnectionProvisioningState? provisioningState, IList groupIds, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, SubResource privateEndpoint, CognitiveServicesPrivateLinkServiceConnectionState connectionState, CognitiveServicesPrivateEndpointConnectionProvisioningState? provisioningState, IList groupIds, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; PrivateEndpoint = privateEndpoint; @@ -45,6 +50,7 @@ internal CognitiveServicesPrivateEndpointConnectionData(ResourceIdentifier id, s ProvisioningState = provisioningState; GroupIds = groupIds; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The location of the private endpoint connection. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs index 588e9c41f13d..db600fbf0e72 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _commitmentPlanAccountAssociationCommitmentPlansRestClient.CreateListAssociationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _commitmentPlanAccountAssociationCommitmentPlansRestClient.CreateListAssociationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommitmentPlanAccountAssociationResource(Client, CommitmentPlanAccountAssociationData.DeserializeCommitmentPlanAccountAssociationData(e)), _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics, Pipeline, "CommitmentPlanAccountAssociationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommitmentPlanAccountAssociationResource(Client, CommitmentPlanAccountAssociationData.DeserializeCommitmentPlanAccountAssociationData(e)), _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics, Pipeline, "CommitmentPlanAccountAssociationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _commitmentPlanAccountAssociationCommitmentPlansRestClient.CreateListAssociationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _commitmentPlanAccountAssociationCommitmentPlansRestClient.CreateListAssociationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommitmentPlanAccountAssociationResource(Client, CommitmentPlanAccountAssociationData.DeserializeCommitmentPlanAccountAssociationData(e)), _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics, Pipeline, "CommitmentPlanAccountAssociationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommitmentPlanAccountAssociationResource(Client, CommitmentPlanAccountAssociationData.DeserializeCommitmentPlanAccountAssociationData(e)), _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics, Pipeline, "CommitmentPlanAccountAssociationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs index 5bdc5599d1c2..b44e961e8e24 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,22 +19,27 @@ namespace Azure.ResourceManager.CognitiveServices /// public partial class CommitmentPlanAccountAssociationData : ResourceData { - /// Initializes a new instance of CommitmentPlanAccountAssociationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommitmentPlanAccountAssociationData() { } - /// Initializes a new instance of CommitmentPlanAccountAssociationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Resource Etag. /// The Azure resource id of the account. - internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string accountId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string accountId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ETag = etag; AccountId = accountId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Etag. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs index 85f095428071..7835d95ede50 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _commitmentPlanRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _commitmentPlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _commitmentPlanClientDiagnostics, Pipeline, "CommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _commitmentPlanClientDiagnostics, Pipeline, "CommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _commitmentPlanRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _commitmentPlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _commitmentPlanClientDiagnostics, Pipeline, "CommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), _commitmentPlanClientDiagnostics, Pipeline, "CommitmentPlanCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanData.cs index 24718f209826..67e313eec4dd 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.CognitiveServices /// public partial class CommitmentPlanData : ResourceData { - /// Initializes a new instance of CommitmentPlanData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommitmentPlanData() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CommitmentPlanData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +40,8 @@ public CommitmentPlanData() /// Resource tags. /// The geo-location where the resource lives. /// Properties of Cognitive Services account commitment plan. - internal CommitmentPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string kind, CognitiveServicesSku sku, IDictionary tags, AzureLocation? location, CommitmentPlanProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CommitmentPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string kind, CognitiveServicesSku sku, IDictionary tags, AzureLocation? location, CommitmentPlanProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ETag = etag; Kind = kind; @@ -44,6 +49,7 @@ internal CommitmentPlanData(ResourceIdentifier id, string name, ResourceType res Tags = tags; Location = location; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Etag. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 1e92e72295e4..2cb1ef4049a0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -98,7 +98,7 @@ public virtual AsyncPageable GetCognitiveServi { HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); } /// @@ -120,7 +120,7 @@ public virtual Pageable GetCognitiveServicesAc { HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); } /// @@ -142,7 +142,7 @@ public virtual AsyncPageable GetDeleted { HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); } /// @@ -164,7 +164,7 @@ public virtual Pageable GetDeletedAccou { HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); } /// @@ -478,7 +478,7 @@ public virtual AsyncPageable GetCogniti { HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); } /// @@ -500,7 +500,7 @@ public virtual Pageable GetCognitiveSer { HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.Serialization.cs index dff6c8005e08..51526f31c5ad 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class AbusePenalty + public partial class AbusePenalty : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AbusePenalty DeserializeAbusePenalty(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.Value.ToString()); + } + if (Optional.IsDefined(RateLimitPercentage)) + { + writer.WritePropertyName("rateLimitPercentage"u8); + writer.WriteNumberValue(RateLimitPercentage.Value); + } + if (Optional.IsDefined(Expiration)) + { + writer.WritePropertyName("expiration"u8); + writer.WriteStringValue(Expiration.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AbusePenalty DeserializeAbusePenalty(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static AbusePenalty DeserializeAbusePenalty(JsonElement element) Optional action = default; Optional rateLimitPercentage = default; Optional expiration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action"u8)) @@ -51,8 +94,61 @@ internal static AbusePenalty DeserializeAbusePenalty(JsonElement element) expiration = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AbusePenalty(Optional.ToNullable(action), Optional.ToNullable(rateLimitPercentage), Optional.ToNullable(expiration)); + return new AbusePenalty(Optional.ToNullable(action), Optional.ToNullable(rateLimitPercentage), Optional.ToNullable(expiration), serializedAdditionalRawData); + } + + AbusePenalty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAbusePenalty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AbusePenalty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAbusePenalty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AbusePenalty model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AbusePenalty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAbusePenalty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.cs index c4fb8d5084f3..c1c1fa522e9b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AbusePenalty.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CognitiveServices.Models { /// The abuse penalty. public partial class AbusePenalty { - /// Initializes a new instance of AbusePenalty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AbusePenalty() { } - /// Initializes a new instance of AbusePenalty. + /// Initializes a new instance of . /// The action of AbusePenalty. /// The percentage of rate limit. /// The datetime of expiration of the AbusePenalty. - internal AbusePenalty(AbusePenaltyAction? action, float? rateLimitPercentage, DateTimeOffset? expiration) + /// Keeps track of any properties unknown to the library. + internal AbusePenalty(AbusePenaltyAction? action, float? rateLimitPercentage, DateTimeOffset? expiration, Dictionary serializedAdditionalRawData) { Action = action; RateLimitPercentage = rateLimitPercentage; Expiration = expiration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The action of AbusePenalty. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.Serialization.cs index 4ba812b2f65f..c50d5d3a7366 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.Serialization.cs @@ -5,16 +5,90 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class AvailableCognitiveServicesSku + public partial class AvailableCognitiveServicesSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableCognitiveServicesSku DeserializeAvailableCognitiveServicesSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Restrictions)) + { + writer.WritePropertyName("restrictions"u8); + writer.WriteStartArray(); + foreach (var item in Restrictions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableCognitiveServicesSku DeserializeAvailableCognitiveServicesSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +99,7 @@ internal static AvailableCognitiveServicesSku DeserializeAvailableCognitiveServi Optional kind = default; Optional> locations = default; Optional> restrictions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -75,8 +150,61 @@ internal static AvailableCognitiveServicesSku DeserializeAvailableCognitiveServi restrictions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableCognitiveServicesSku(resourceType.Value, name.Value, tier.Value, kind.Value, Optional.ToList(locations), Optional.ToList(restrictions)); + return new AvailableCognitiveServicesSku(resourceType.Value, name.Value, tier.Value, kind.Value, Optional.ToList(locations), Optional.ToList(restrictions), serializedAdditionalRawData); + } + + AvailableCognitiveServicesSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableCognitiveServicesSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableCognitiveServicesSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableCognitiveServicesSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableCognitiveServicesSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableCognitiveServicesSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableCognitiveServicesSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.cs index 5de2bd5bb0c8..89fe93858032 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSku.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,25 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Describes an available Cognitive Services SKU. public partial class AvailableCognitiveServicesSku { - /// Initializes a new instance of AvailableCognitiveServicesSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableCognitiveServicesSku() { Locations = new ChangeTrackingList(); Restrictions = new ChangeTrackingList(); } - /// Initializes a new instance of AvailableCognitiveServicesSku. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// The name of SKU. /// Specifies the tier of Cognitive Services account. /// The Kind of resources that are supported in this SKU. /// The set of locations that the SKU is available. /// The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - internal AvailableCognitiveServicesSku(string resourceType, string name, string tier, string kind, IReadOnlyList locations, IReadOnlyList restrictions) + /// Keeps track of any properties unknown to the library. + internal AvailableCognitiveServicesSku(string resourceType, string name, string tier, string kind, IReadOnlyList locations, IReadOnlyList restrictions, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Name = name; @@ -35,6 +40,7 @@ internal AvailableCognitiveServicesSku(string resourceType, string name, string Kind = kind; Locations = locations; Restrictions = restrictions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of resource the SKU applies to. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.Serialization.cs index 71337b87a5fb..461a4b0dbd05 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class AvailableCognitiveServicesSkuResult + internal partial class AvailableCognitiveServicesSkuResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableCognitiveServicesSkuResult DeserializeAvailableCognitiveServicesSkuResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableCognitiveServicesSkuResult DeserializeAvailableCognitiveServicesSkuResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static AvailableCognitiveServicesSkuResult DeserializeAvailableCognitiv nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableCognitiveServicesSkuResult(value, nextLink.Value); + return new AvailableCognitiveServicesSkuResult(value, nextLink.Value, serializedAdditionalRawData); + } + + AvailableCognitiveServicesSkuResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableCognitiveServicesSkuResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableCognitiveServicesSkuResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableCognitiveServicesSkuResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableCognitiveServicesSkuResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableCognitiveServicesSkuResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableCognitiveServicesSkuResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.cs index 34e5803c5937..9e54ded2e617 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AvailableCognitiveServicesSkuResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The Get Skus operation response. internal partial class AvailableCognitiveServicesSkuResult { - /// Initializes a new instance of AvailableCognitiveServicesSkuResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of skus available for the subscription. /// is null. internal AvailableCognitiveServicesSkuResult(IEnumerable value) @@ -25,13 +28,20 @@ internal AvailableCognitiveServicesSkuResult(IEnumerable Initializes a new instance of AvailableCognitiveServicesSkuResult. + /// Initializes a new instance of . /// The list of skus available for the subscription. /// The uri to fetch the next page of Skus. - internal AvailableCognitiveServicesSkuResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AvailableCognitiveServicesSkuResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailableCognitiveServicesSkuResult() + { } /// The list of skus available for the subscription. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountData.Serialization.cs index 304311b296fa..bb973a25ea99 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountData.Serialization.cs @@ -5,19 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices { - public partial class CognitiveServicesAccountData : IUtf8JsonSerializable + public partial class CognitiveServicesAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -27,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -52,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesAccountData DeserializeCognitiveServicesAccountData(JsonElement element) + internal static CognitiveServicesAccountData DeserializeCognitiveServicesAccountData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +106,7 @@ internal static CognitiveServicesAccountData DeserializeCognitiveServicesAccount string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -158,8 +193,61 @@ internal static CognitiveServicesAccountData DeserializeCognitiveServicesAccount systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kind.Value, sku.Value, identity, properties.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + CognitiveServicesAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountData model) + { + if (model is null) + { + return null; } - return new CognitiveServicesAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kind.Value, sku.Value, identity, properties.Value, Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs index 23bfb1dc6c59..764c9e734d81 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs @@ -5,34 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices { - public partial class CognitiveServicesAccountDeploymentData : IUtf8JsonSerializable + public partial class CognitiveServicesAccountDeploymentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServicesAccountDeploymentData(JsonElement element) + internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServicesAccountDeploymentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +79,7 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -97,8 +133,61 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountDeploymentData(id, name, type, systemData.Value, sku.Value, Optional.ToNullable(etag), properties.Value, serializedAdditionalRawData); + } + + CognitiveServicesAccountDeploymentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountDeploymentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountDeploymentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountDeploymentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountDeploymentData model) + { + if (model is null) + { + return null; } - return new CognitiveServicesAccountDeploymentData(id, name, type, systemData.Value, sku.Value, Optional.ToNullable(etag), properties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountDeploymentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountDeploymentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.Serialization.cs index b2b1a3fe090b..d5e79efafeba 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesAccountDeploymentListResult + internal partial class CognitiveServicesAccountDeploymentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesAccountDeploymentListResult DeserializeCognitiveServicesAccountDeploymentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesAccountDeploymentListResult DeserializeCognitiveServicesAccountDeploymentListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static CognitiveServicesAccountDeploymentListResult DeserializeCognitiv value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesAccountDeploymentListResult(nextLink.Value, Optional.ToList(value)); + return new CognitiveServicesAccountDeploymentListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesAccountDeploymentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountDeploymentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountDeploymentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountDeploymentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountDeploymentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountDeploymentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountDeploymentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.cs index 328bc7312a28..d6b009cb251c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CognitiveServices; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services accounts operation response. internal partial class CognitiveServicesAccountDeploymentListResult { - /// Initializes a new instance of CognitiveServicesAccountDeploymentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesAccountDeploymentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesAccountDeploymentListResult. + /// Initializes a new instance of . /// The link used to get the next page of Deployment. /// Gets the list of Cognitive Services accounts Deployment and their properties. - internal CognitiveServicesAccountDeploymentListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountDeploymentListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of Deployment. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs index 1a152c0e5ca4..93051d7e0c25 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesAccountDeploymentModel : IUtf8JsonSerializable + public partial class CognitiveServicesAccountDeploymentModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Format)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("source"u8); writer.WriteStringValue(Source); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServicesAccountDeploymentModel(JsonElement element) + internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServicesAccountDeploymentModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +71,7 @@ internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServ Optional version = default; Optional source = default; Optional callRateLimit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("format"u8)) @@ -80,8 +103,61 @@ internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServ callRateLimit = ServiceAccountCallRateLimit.DeserializeServiceAccountCallRateLimit(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountDeploymentModel(format.Value, name.Value, version.Value, source.Value, callRateLimit.Value, serializedAdditionalRawData); + } + + CognitiveServicesAccountDeploymentModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountDeploymentModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountDeploymentModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountDeploymentModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountDeploymentModel model) + { + if (model is null) + { + return null; } - return new CognitiveServicesAccountDeploymentModel(format.Value, name.Value, version.Value, source.Value, callRateLimit.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountDeploymentModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountDeploymentModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs index 170b8d937f57..9e9ae12de8b9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Properties of Cognitive Services account deployment model. public partial class CognitiveServicesAccountDeploymentModel { - /// Initializes a new instance of CognitiveServicesAccountDeploymentModel. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesAccountDeploymentModel() { } - /// Initializes a new instance of CognitiveServicesAccountDeploymentModel. + /// Initializes a new instance of . /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. /// Optional. Deployment model source ARM resource ID. /// The call rate limit Cognitive Services account. - internal CognitiveServicesAccountDeploymentModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountDeploymentModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit, Dictionary serializedAdditionalRawData) { Format = format; Name = name; Version = version; Source = source; CallRateLimit = callRateLimit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Deployment model format. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs index 98f35dc63466..bae2ae5827c4 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesAccountDeploymentProperties : IUtf8JsonSerializable + public partial class CognitiveServicesAccountDeploymentProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Model)) { writer.WritePropertyName("model"u8); - writer.WriteObjectValue(Model); + if (Model is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Model).Serialize(writer, options); + } } if (Optional.IsDefined(ScaleSettings)) { writer.WritePropertyName("scaleSettings"u8); - writer.WriteObjectValue(ScaleSettings); + if (ScaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScaleSettings).Serialize(writer, options); + } } if (Optional.IsDefined(RaiPolicyName)) { @@ -36,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("versionUpgradeOption"u8); writer.WriteStringValue(VersionUpgradeOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiveServicesAccountDeploymentProperties(JsonElement element) + internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiveServicesAccountDeploymentProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +88,7 @@ internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiv Optional callRateLimit = default; Optional> rateLimits = default; Optional versionUpgradeOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -133,8 +169,61 @@ internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiv versionUpgradeOption = new DeploymentModelVersionUpgradeOption(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountDeploymentProperties(Optional.ToNullable(provisioningState), model.Value, scaleSettings.Value, Optional.ToDictionary(capabilities), raiPolicyName.Value, callRateLimit.Value, Optional.ToList(rateLimits), Optional.ToNullable(versionUpgradeOption), serializedAdditionalRawData); + } + + CognitiveServicesAccountDeploymentProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountDeploymentProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountDeploymentProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountDeploymentProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountDeploymentProperties model) + { + if (model is null) + { + return null; } - return new CognitiveServicesAccountDeploymentProperties(Optional.ToNullable(provisioningState), model.Value, scaleSettings.Value, Optional.ToDictionary(capabilities), raiPolicyName.Value, callRateLimit.Value, Optional.ToList(rateLimits), Optional.ToNullable(versionUpgradeOption)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountDeploymentProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountDeploymentProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs index c8f2e209336f..29751691ee56 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Properties of Cognitive Services account deployment. public partial class CognitiveServicesAccountDeploymentProperties { - /// Initializes a new instance of CognitiveServicesAccountDeploymentProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesAccountDeploymentProperties() { Capabilities = new ChangeTrackingDictionary(); RateLimits = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesAccountDeploymentProperties. + /// Initializes a new instance of . /// Gets the status of the resource at the time the operation was called. /// Properties of Cognitive Services account deployment model. /// Properties of Cognitive Services account deployment model. @@ -29,7 +33,8 @@ public CognitiveServicesAccountDeploymentProperties() /// The call rate limit Cognitive Services account. /// /// Deployment model version upgrade option. - internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IReadOnlyList rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IReadOnlyList rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Model = model; @@ -39,6 +44,7 @@ internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDe CallRateLimit = callRateLimit; RateLimits = rateLimits; VersionUpgradeOption = versionUpgradeOption; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the status of the resource at the time the operation was called. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.Serialization.cs index e7e4ae925904..9633247d4754 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesAccountDeploymentScaleSettings : IUtf8JsonSerializable + public partial class CognitiveServicesAccountDeploymentScaleSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ScaleType)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesAccountDeploymentScaleSettings DeserializeCognitiveServicesAccountDeploymentScaleSettings(JsonElement element) + internal static CognitiveServicesAccountDeploymentScaleSettings DeserializeCognitiveServicesAccountDeploymentScaleSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static CognitiveServicesAccountDeploymentScaleSettings DeserializeCogni Optional scaleType = default; Optional capacity = default; Optional activeCapacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scaleType"u8)) @@ -66,8 +89,61 @@ internal static CognitiveServicesAccountDeploymentScaleSettings DeserializeCogni activeCapacity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountDeploymentScaleSettings(Optional.ToNullable(scaleType), Optional.ToNullable(capacity), Optional.ToNullable(activeCapacity), serializedAdditionalRawData); + } + + CognitiveServicesAccountDeploymentScaleSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountDeploymentScaleSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountDeploymentScaleSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountDeploymentScaleSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountDeploymentScaleSettings model) + { + if (model is null) + { + return null; } - return new CognitiveServicesAccountDeploymentScaleSettings(Optional.ToNullable(scaleType), Optional.ToNullable(capacity), Optional.ToNullable(activeCapacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountDeploymentScaleSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountDeploymentScaleSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs index ea7806f9f11b..92a158308637 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Properties of Cognitive Services account deployment model. public partial class CognitiveServicesAccountDeploymentScaleSettings { - /// Initializes a new instance of CognitiveServicesAccountDeploymentScaleSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesAccountDeploymentScaleSettings() { } - /// Initializes a new instance of CognitiveServicesAccountDeploymentScaleSettings. + /// Initializes a new instance of . /// Deployment scale type. /// Deployment capacity. /// Deployment active capacity. This value might be different from `capacity` if customer recently updated `capacity`. - internal CognitiveServicesAccountDeploymentScaleSettings(CognitiveServicesAccountDeploymentScaleType? scaleType, int? capacity, int? activeCapacity) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountDeploymentScaleSettings(CognitiveServicesAccountDeploymentScaleType? scaleType, int? capacity, int? activeCapacity, Dictionary serializedAdditionalRawData) { ScaleType = scaleType; Capacity = capacity; ActiveCapacity = activeCapacity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Deployment scale type. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.Serialization.cs index 53ad870b9f72..ef761c74b7d1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesAccountListResult + internal partial class CognitiveServicesAccountListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesAccountListResult DeserializeCognitiveServicesAccountListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesAccountListResult DeserializeCognitiveServicesAccountListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static CognitiveServicesAccountListResult DeserializeCognitiveServicesA value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesAccountListResult(nextLink.Value, Optional.ToList(value)); + return new CognitiveServicesAccountListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesAccountListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.cs index abd4cec45761..d2ff8c551471 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CognitiveServices; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services accounts operation response. internal partial class CognitiveServicesAccountListResult { - /// Initializes a new instance of CognitiveServicesAccountListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesAccountListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesAccountListResult. + /// Initializes a new instance of . /// The link used to get the next page of accounts. /// Gets the list of Cognitive Services accounts and their properties. - internal CognitiveServicesAccountListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of accounts. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs index 94f74c123cc1..bed27ecc8a79 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs @@ -5,22 +5,36 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesAccountModel : IUtf8JsonSerializable + public partial class CognitiveServicesAccountModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BaseModel)) { writer.WritePropertyName("baseModel"u8); - writer.WriteObjectValue(BaseModel); + if (BaseModel is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BaseModel).Serialize(writer, options); + } } if (Optional.IsDefined(IsDefaultVersion)) { @@ -33,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Skus) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -67,7 +88,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Deprecation)) { writer.WritePropertyName("deprecation"u8); - writer.WriteObjectValue(Deprecation); + if (Deprecation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Deprecation).Serialize(writer, options); + } } if (Optional.IsDefined(LifecycleStatus)) { @@ -94,11 +122,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("source"u8); writer.WriteStringValue(Source); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccountModel(JsonElement element) + internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccountModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,6 +159,7 @@ internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccoun Optional version = default; Optional source = default; Optional callRateLimit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("baseModel"u8)) @@ -244,8 +287,61 @@ internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccoun callRateLimit = ServiceAccountCallRateLimit.DeserializeServiceAccountCallRateLimit(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountModel(format.Value, name.Value, version.Value, source.Value, callRateLimit.Value, baseModel.Value, Optional.ToNullable(isDefaultVersion), Optional.ToList(skus), Optional.ToNullable(maxCapacity), Optional.ToDictionary(capabilities), Optional.ToDictionary(finetuneCapabilities), deprecation.Value, Optional.ToNullable(lifecycleStatus), systemData, serializedAdditionalRawData); + } + + CognitiveServicesAccountModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountModel(Response response) + { + if (response is null) + { + return null; } - return new CognitiveServicesAccountModel(format.Value, name.Value, version.Value, source.Value, callRateLimit.Value, baseModel.Value, Optional.ToNullable(isDefaultVersion), Optional.ToList(skus), Optional.ToNullable(maxCapacity), Optional.ToDictionary(capabilities), Optional.ToDictionary(finetuneCapabilities), deprecation.Value, Optional.ToNullable(lifecycleStatus), systemData); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs index d38a3a925d85..e29bd205fea2 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Cognitive Services account Model. public partial class CognitiveServicesAccountModel : CognitiveServicesAccountDeploymentModel { - /// Initializes a new instance of CognitiveServicesAccountModel. + /// Initializes a new instance of . public CognitiveServicesAccountModel() { Skus = new ChangeTrackingList(); @@ -22,7 +23,7 @@ public CognitiveServicesAccountModel() FinetuneCapabilities = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CognitiveServicesAccountModel. + /// Initializes a new instance of . /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. @@ -37,7 +38,8 @@ public CognitiveServicesAccountModel() /// Cognitive Services account ModelDeprecationInfo. /// Model lifecycle status. /// Metadata pertaining to creation and last modification of the resource. - internal CognitiveServicesAccountModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit, CognitiveServicesAccountDeploymentModel baseModel, bool? isDefaultVersion, IList skus, int? maxCapacity, IDictionary capabilities, IDictionary finetuneCapabilities, ServiceAccountModelDeprecationInfo deprecation, ModelLifecycleStatus? lifecycleStatus, SystemData systemData) : base(format, name, version, source, callRateLimit) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit, CognitiveServicesAccountDeploymentModel baseModel, bool? isDefaultVersion, IList skus, int? maxCapacity, IDictionary capabilities, IDictionary finetuneCapabilities, ServiceAccountModelDeprecationInfo deprecation, ModelLifecycleStatus? lifecycleStatus, SystemData systemData, Dictionary serializedAdditionalRawData) : base(format, name, version, source, callRateLimit, serializedAdditionalRawData) { BaseModel = baseModel; IsDefaultVersion = isDefaultVersion; diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.Serialization.cs index 0c3ac9bc753d..6a9fc15e371d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesAccountModelListResult + internal partial class CognitiveServicesAccountModelListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesAccountModelListResult DeserializeCognitiveServicesAccountModelListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesAccountModelListResult DeserializeCognitiveServicesAccountModelListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -42,8 +92,61 @@ internal static CognitiveServicesAccountModelListResult DeserializeCognitiveServ value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesAccountModelListResult(nextLink.Value, Optional.ToList(value)); + return new CognitiveServicesAccountModelListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesAccountModelListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountModelListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountModelListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountModelListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountModelListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountModelListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountModelListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.cs index 0469b1545e6f..48cf8c1daff9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModelListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services accounts operation response. internal partial class CognitiveServicesAccountModelListResult { - /// Initializes a new instance of CognitiveServicesAccountModelListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesAccountModelListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesAccountModelListResult. + /// Initializes a new instance of . /// The link used to get the next page of Model. /// Gets the list of Cognitive Services accounts Model and their properties. - internal CognitiveServicesAccountModelListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountModelListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of Model. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs index ef9d72c14c64..6c0faced06a6 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesAccountProperties : IUtf8JsonSerializable + public partial class CognitiveServicesAccountProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MigrationToken)) { @@ -31,12 +37,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkAcls)) { writer.WritePropertyName("networkAcls"u8); - writer.WriteObjectValue(NetworkAcls); + if (NetworkAcls is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkAcls).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(UserOwnedStorage)) { @@ -44,7 +64,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserOwnedStorage) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -56,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiProperties)) { writer.WritePropertyName("apiProperties"u8); - writer.WriteObjectValue(ApiProperties); + if (ApiProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiProperties).Serialize(writer, options); + } } if (Optional.IsDefined(EnableDynamicThrottling)) { @@ -91,13 +125,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Locations)) { writer.WritePropertyName("locations"u8); - writer.WriteObjectValue(Locations); + if (Locations is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Locations).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesAccountProperties(JsonElement element) + internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesAccountProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -129,6 +184,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA Optional locations = default; Optional> commitmentPlanAssociations = default; Optional abusePenalty = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -388,8 +444,61 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA abusePenalty = AbusePenalty.DeserializeAbusePenalty(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesAccountProperties(Optional.ToNullable(provisioningState), endpoint.Value, Optional.ToList(capabilities), Optional.ToNullable(isMigrated), migrationToken.Value, skuChangeInfo.Value, customSubDomainName.Value, networkAcls.Value, encryption.Value, Optional.ToList(userOwnedStorage), Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), apiProperties.Value, Optional.ToNullable(dateCreated), callRateLimit.Value, Optional.ToNullable(dynamicThrottlingEnabled), quotaLimit.Value, Optional.ToNullable(restrictOutboundNetworkAccess), Optional.ToList(allowedFqdnList), Optional.ToNullable(disableLocalAuth), Optional.ToDictionary(endpoints), Optional.ToNullable(restore), Optional.ToNullable(deletionDate), scheduledPurgeDate.Value, locations.Value, Optional.ToList(commitmentPlanAssociations), abusePenalty.Value, serializedAdditionalRawData); + } + + CognitiveServicesAccountProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountProperties(Response response) + { + if (response is null) + { + return null; } - return new CognitiveServicesAccountProperties(Optional.ToNullable(provisioningState), endpoint.Value, Optional.ToList(capabilities), Optional.ToNullable(isMigrated), migrationToken.Value, skuChangeInfo.Value, customSubDomainName.Value, networkAcls.Value, encryption.Value, Optional.ToList(userOwnedStorage), Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), apiProperties.Value, Optional.ToNullable(dateCreated), callRateLimit.Value, Optional.ToNullable(dynamicThrottlingEnabled), quotaLimit.Value, Optional.ToNullable(restrictOutboundNetworkAccess), Optional.ToList(allowedFqdnList), Optional.ToNullable(disableLocalAuth), Optional.ToDictionary(endpoints), Optional.ToNullable(restore), Optional.ToNullable(deletionDate), scheduledPurgeDate.Value, locations.Value, Optional.ToList(commitmentPlanAssociations), abusePenalty.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs index 0c142d9857aa..93305d20a271 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Properties of Cognitive Services account. public partial class CognitiveServicesAccountProperties { - /// Initializes a new instance of CognitiveServicesAccountProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesAccountProperties() { Capabilities = new ChangeTrackingList(); @@ -26,7 +29,7 @@ public CognitiveServicesAccountProperties() CommitmentPlanAssociations = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesAccountProperties. + /// Initializes a new instance of . /// Gets the status of the cognitive services account at the time the operation was called. /// Endpoint of the created account. /// Gets the capabilities of the cognitive services account. Each item indicates the capability of a specific feature. The values are read-only and for reference only. @@ -54,7 +57,8 @@ public CognitiveServicesAccountProperties() /// The multiregion settings of Cognitive Services account. /// The commitment plan associations of Cognitive Services account. /// The abuse penalty. - internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState, string endpoint, IReadOnlyList capabilities, bool? isMigrated, string migrationToken, CognitiveServicesSkuChangeInfo skuChangeInfo, string customSubDomainName, CognitiveServicesNetworkRuleSet networkAcls, ServiceAccountEncryptionProperties encryption, IList userOwnedStorage, IReadOnlyList privateEndpointConnections, ServiceAccountPublicNetworkAccess? publicNetworkAccess, ServiceAccountApiProperties apiProperties, DateTimeOffset? createdOn, ServiceAccountCallRateLimit callRateLimit, bool? enableDynamicThrottling, ServiceAccountQuotaLimit quotaLimit, bool? restrictOutboundNetworkAccess, IList allowedFqdnList, bool? disableLocalAuth, IReadOnlyDictionary endpoints, bool? restore, DateTimeOffset? deletedOn, string scheduledPurgeDate, CognitiveServicesMultiRegionSettings locations, IReadOnlyList commitmentPlanAssociations, AbusePenalty abusePenalty) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState, string endpoint, IReadOnlyList capabilities, bool? isMigrated, string migrationToken, CognitiveServicesSkuChangeInfo skuChangeInfo, string customSubDomainName, CognitiveServicesNetworkRuleSet networkAcls, ServiceAccountEncryptionProperties encryption, IList userOwnedStorage, IReadOnlyList privateEndpointConnections, ServiceAccountPublicNetworkAccess? publicNetworkAccess, ServiceAccountApiProperties apiProperties, DateTimeOffset? createdOn, ServiceAccountCallRateLimit callRateLimit, bool? enableDynamicThrottling, ServiceAccountQuotaLimit quotaLimit, bool? restrictOutboundNetworkAccess, IList allowedFqdnList, bool? disableLocalAuth, IReadOnlyDictionary endpoints, bool? restore, DateTimeOffset? deletedOn, string scheduledPurgeDate, CognitiveServicesMultiRegionSettings locations, IReadOnlyList commitmentPlanAssociations, AbusePenalty abusePenalty, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Endpoint = endpoint; @@ -83,6 +87,7 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro Locations = locations; CommitmentPlanAssociations = commitmentPlanAssociations; AbusePenalty = abusePenalty; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the status of the cognitive services account at the time the operation was called. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.Serialization.cs index 941130a08cd1..65341af3d5fe 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesAccountSku + public partial class CognitiveServicesAccountSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesAccountSku DeserializeCognitiveServicesAccountSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesAccountSku DeserializeCognitiveServicesAccountSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceType = default; Optional sku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -40,8 +86,61 @@ internal static CognitiveServicesAccountSku DeserializeCognitiveServicesAccountS sku = CognitiveServicesSku.DeserializeCognitiveServicesSku(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesAccountSku(Optional.ToNullable(resourceType), sku.Value); + return new CognitiveServicesAccountSku(Optional.ToNullable(resourceType), sku.Value, serializedAdditionalRawData); + } + + CognitiveServicesAccountSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.cs index 6a3ba021c500..2156e721d204 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSku.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Cognitive Services resource type and SKU. public partial class CognitiveServicesAccountSku { - /// Initializes a new instance of CognitiveServicesAccountSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesAccountSku() { } - /// Initializes a new instance of CognitiveServicesAccountSku. + /// Initializes a new instance of . /// Resource Namespace and Type. /// The SKU of Cognitive Services account. - internal CognitiveServicesAccountSku(ResourceType? resourceType, CognitiveServicesSku sku) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountSku(ResourceType? resourceType, CognitiveServicesSku sku, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Namespace and Type. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.Serialization.cs index b784b35a487c..2384add6524c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesAccountSkuListResult + internal partial class CognitiveServicesAccountSkuListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesAccountSkuListResult DeserializeCognitiveServicesAccountSkuListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesAccountSkuListResult DeserializeCognitiveServicesAccountSkuListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static CognitiveServicesAccountSkuListResult DeserializeCognitiveServic value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesAccountSkuListResult(Optional.ToList(value)); + return new CognitiveServicesAccountSkuListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesAccountSkuListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesAccountSkuListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesAccountSkuListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesAccountSkuListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesAccountSkuListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesAccountSkuListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesAccountSkuListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.cs index 40f6ec295b8b..7bee413b67fe 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountSkuListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services accounts operation response. internal partial class CognitiveServicesAccountSkuListResult { - /// Initializes a new instance of CognitiveServicesAccountSkuListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesAccountSkuListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesAccountSkuListResult. + /// Initializes a new instance of . /// Gets the list of Cognitive Services accounts and their properties. - internal CognitiveServicesAccountSkuListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesAccountSkuListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the list of Cognitive Services accounts and their properties. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs index 511978dedd2f..f088947af131 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesCapacityConfig : IUtf8JsonSerializable + public partial class CognitiveServicesCapacityConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Minimum)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("default"u8); writer.WriteNumberValue(Default.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapacityConfig(JsonElement element) + internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapacityConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapa Optional maximum = default; Optional step = default; Optional @default = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -86,8 +109,61 @@ internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapa @default = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesCapacityConfig(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(step), Optional.ToNullable(@default), serializedAdditionalRawData); + } + + CognitiveServicesCapacityConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesCapacityConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesCapacityConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesCapacityConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesCapacityConfig model) + { + if (model is null) + { + return null; } - return new CognitiveServicesCapacityConfig(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(step), Optional.ToNullable(@default)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesCapacityConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesCapacityConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs index b1e135760cc1..fe96de932baa 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The capacity configuration. public partial class CognitiveServicesCapacityConfig { - /// Initializes a new instance of CognitiveServicesCapacityConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesCapacityConfig() { } - /// Initializes a new instance of CognitiveServicesCapacityConfig. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity. /// The minimal incremental between allowed values for capacity. /// The default capacity. - internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, int? @default) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, int? @default, Dictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; Step = step; Default = @default; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum capacity. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs index 2e54f2bcdd69..bb1ca1234242 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesCommitmentPlanPatch : IUtf8JsonSerializable + public partial class CognitiveServicesCommitmentPlanPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -31,7 +46,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CognitiveServicesCommitmentPlanPatch DeserializeCognitiveServicesCommitmentPlanPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = CognitiveServicesSku.DeserializeCognitiveServicesSku(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesCommitmentPlanPatch(Optional.ToDictionary(tags), sku.Value, serializedAdditionalRawData); + } + + CognitiveServicesCommitmentPlanPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesCommitmentPlanPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesCommitmentPlanPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesCommitmentPlanPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesCommitmentPlanPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesCommitmentPlanPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesCommitmentPlanPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs index bc237f5c6518..7209c48d1e60 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs @@ -5,16 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The object being used to update tags and sku of a resource, in general used for PATCH operations. public partial class CognitiveServicesCommitmentPlanPatch : CognitiveServicesPatchResourceTags { - /// Initializes a new instance of CognitiveServicesCommitmentPlanPatch. + /// Initializes a new instance of . public CognitiveServicesCommitmentPlanPatch() { } + /// Initializes a new instance of . + /// Resource tags. + /// The resource model definition representing SKU. + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesCommitmentPlanPatch(IDictionary tags, CognitiveServicesSku sku, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Sku = sku; + } + /// The resource model definition representing SKU. public CognitiveServicesSku Sku { get; set; } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.Serialization.cs index af715fe3b221..f2944c8c0f13 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesDomainAvailabilityContent : IUtf8JsonSerializable + public partial class CognitiveServicesDomainAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("subdomainName"u8); writer.WriteStringValue(SubdomainName); @@ -24,7 +32,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CognitiveServicesDomainAvailabilityContent DeserializeCognitiveServicesDomainAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subdomainName = default; + ResourceType type = default; + Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subdomainName"u8)) + { + subdomainName = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesDomainAvailabilityContent(subdomainName, type, kind.Value, serializedAdditionalRawData); + } + + CognitiveServicesDomainAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesDomainAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesDomainAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesDomainAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesDomainAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesDomainAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesDomainAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.cs index defcb82fa281..999d8c8ea432 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Check Domain availability parameter. public partial class CognitiveServicesDomainAvailabilityContent { - /// Initializes a new instance of CognitiveServicesDomainAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The subdomain name to use. /// The Type of the resource. /// is null. @@ -25,6 +29,24 @@ public CognitiveServicesDomainAvailabilityContent(string subdomainName, Resource ResourceType = resourceType; } + /// Initializes a new instance of . + /// The subdomain name to use. + /// The Type of the resource. + /// The Kind of the resource. + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesDomainAvailabilityContent(string subdomainName, ResourceType resourceType, string kind, Dictionary serializedAdditionalRawData) + { + SubdomainName = subdomainName; + ResourceType = resourceType; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CognitiveServicesDomainAvailabilityContent() + { + } + /// The subdomain name to use. public string SubdomainName { get; } /// The Type of the resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.Serialization.cs index ce0ff0b3625d..9f5b9e39d28d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesDomainAvailabilityList + public partial class CognitiveServicesDomainAvailabilityList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesDomainAvailabilityList DeserializeCognitiveServicesDomainAvailabilityList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsSubdomainAvailable)) + { + writer.WritePropertyName("isSubdomainAvailable"u8); + writer.WriteBooleanValue(IsSubdomainAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (Optional.IsDefined(SubdomainName)) + { + writer.WritePropertyName("subdomainName"u8); + writer.WriteStringValue(SubdomainName); + } + if (Optional.IsDefined(DomainAvailabilityType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DomainAvailabilityType); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesDomainAvailabilityList DeserializeCognitiveServicesDomainAvailabilityList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static CognitiveServicesDomainAvailabilityList DeserializeCognitiveServ Optional subdomainName = default; Optional type = default; Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isSubdomainAvailable"u8)) @@ -54,8 +108,61 @@ internal static CognitiveServicesDomainAvailabilityList DeserializeCognitiveServ kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesDomainAvailabilityList(Optional.ToNullable(isSubdomainAvailable), reason.Value, subdomainName.Value, type.Value, kind.Value); + return new CognitiveServicesDomainAvailabilityList(Optional.ToNullable(isSubdomainAvailable), reason.Value, subdomainName.Value, type.Value, kind.Value, serializedAdditionalRawData); + } + + CognitiveServicesDomainAvailabilityList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesDomainAvailabilityList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesDomainAvailabilityList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesDomainAvailabilityList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesDomainAvailabilityList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesDomainAvailabilityList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesDomainAvailabilityList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.cs index 0b4e329c0419..668deb514921 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesDomainAvailabilityList.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Domain availability. public partial class CognitiveServicesDomainAvailabilityList { - /// Initializes a new instance of CognitiveServicesDomainAvailabilityList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesDomainAvailabilityList() { } - /// Initializes a new instance of CognitiveServicesDomainAvailabilityList. + /// Initializes a new instance of . /// Indicates the given SKU is available or not. /// Reason why the SKU is not available. /// The subdomain name to use. /// The Type of the resource. /// The Kind of the resource. - internal CognitiveServicesDomainAvailabilityList(bool? isSubdomainAvailable, string reason, string subdomainName, string domainAvailabilityType, string kind) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesDomainAvailabilityList(bool? isSubdomainAvailable, string reason, string subdomainName, string domainAvailabilityType, string kind, Dictionary serializedAdditionalRawData) { IsSubdomainAvailable = isSubdomainAvailable; Reason = reason; SubdomainName = subdomainName; DomainAvailabilityType = domainAvailabilityType; Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates the given SKU is available or not. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.Serialization.cs index 76d8a8fdf3db..9d96fe456e6e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesIPRule : IUtf8JsonSerializable + public partial class CognitiveServicesIPRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesIPRule DeserializeCognitiveServicesIPRule(JsonElement element) + internal static CognitiveServicesIPRule DeserializeCognitiveServicesIPRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -34,8 +57,61 @@ internal static CognitiveServicesIPRule DeserializeCognitiveServicesIPRule(JsonE value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesIPRule(value, serializedAdditionalRawData); + } + + CognitiveServicesIPRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesIPRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesIPRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesIPRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesIPRule model) + { + if (model is null) + { + return null; } - return new CognitiveServicesIPRule(value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesIPRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesIPRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.cs index 0431dc1961ee..929983740426 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesIPRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// A rule governing the accessibility from a specific ip address or ip range. public partial class CognitiveServicesIPRule { - /// Initializes a new instance of CognitiveServicesIPRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). /// is null. public CognitiveServicesIPRule(string value) @@ -23,6 +27,20 @@ public CognitiveServicesIPRule(string value) Value = value; } + /// Initializes a new instance of . + /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesIPRule(string value, Dictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CognitiveServicesIPRule() + { + } + /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). public string Value { get; set; } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.Serialization.cs index 3ffaffb8fab6..a8670db4760c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesKeyVaultProperties : IUtf8JsonSerializable + public partial class CognitiveServicesKeyVaultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyName)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identityClientId"u8); writer.WriteStringValue(IdentityClientId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesKeyVaultProperties DeserializeCognitiveServicesKeyVaultProperties(JsonElement element) + internal static CognitiveServicesKeyVaultProperties DeserializeCognitiveServicesKeyVaultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static CognitiveServicesKeyVaultProperties DeserializeCognitiveServices Optional keyVersion = default; Optional keyVaultUri = default; Optional identityClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyName"u8)) @@ -79,8 +101,61 @@ internal static CognitiveServicesKeyVaultProperties DeserializeCognitiveServices identityClientId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesKeyVaultProperties(keyName.Value, keyVersion.Value, keyVaultUri.Value, Optional.ToNullable(identityClientId), serializedAdditionalRawData); + } + + CognitiveServicesKeyVaultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesKeyVaultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesKeyVaultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesKeyVaultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesKeyVaultProperties model) + { + if (model is null) + { + return null; } - return new CognitiveServicesKeyVaultProperties(keyName.Value, keyVersion.Value, keyVaultUri.Value, Optional.ToNullable(identityClientId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesKeyVaultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesKeyVaultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.cs index 58352ba26754..ef4fcbe94101 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesKeyVaultProperties.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CognitiveServices.Models { /// Properties to configure keyVault Properties. public partial class CognitiveServicesKeyVaultProperties { - /// Initializes a new instance of CognitiveServicesKeyVaultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesKeyVaultProperties() { } - /// Initializes a new instance of CognitiveServicesKeyVaultProperties. + /// Initializes a new instance of . /// Name of the Key from KeyVault. /// Version of the Key from KeyVault. /// Uri of KeyVault. /// - internal CognitiveServicesKeyVaultProperties(string keyName, string keyVersion, Uri keyVaultUri, Guid? identityClientId) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesKeyVaultProperties(string keyName, string keyVersion, Uri keyVaultUri, Guid? identityClientId, Dictionary serializedAdditionalRawData) { KeyName = keyName; KeyVersion = keyVersion; KeyVaultUri = keyVaultUri; IdentityClientId = identityClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Key from KeyVault. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs index dbac5e8287a1..ec014d16f14f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs @@ -5,15 +5,65 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesModel + public partial class CognitiveServicesModel : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesModel DeserializeCognitiveServicesModel(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + if (Model is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Model).Serialize(writer, options); + } + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesModel DeserializeCognitiveServicesModel(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +71,7 @@ internal static CognitiveServicesModel DeserializeCognitiveServicesModel(JsonEle Optional model = default; Optional kind = default; Optional skuName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("model"u8)) @@ -42,8 +93,61 @@ internal static CognitiveServicesModel DeserializeCognitiveServicesModel(JsonEle skuName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesModel(model.Value, kind.Value, skuName.Value); + return new CognitiveServicesModel(model.Value, kind.Value, skuName.Value, serializedAdditionalRawData); + } + + CognitiveServicesModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs index 128b035498b2..80bcd1d97083 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Cognitive Services Model. public partial class CognitiveServicesModel { - /// Initializes a new instance of CognitiveServicesModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesModel() { } - /// Initializes a new instance of CognitiveServicesModel. + /// Initializes a new instance of . /// Model Metadata. /// The Kind of the Model. /// The SKU of the Model. - internal CognitiveServicesModel(CognitiveServicesAccountModel model, string kind, string skuName) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesModel(CognitiveServicesAccountModel model, string kind, string skuName, Dictionary serializedAdditionalRawData) { Model = model; Kind = kind; SkuName = skuName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Model Metadata. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.Serialization.cs index 8fa502fee7a2..27fefe006cef 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesModelListResult + internal partial class CognitiveServicesModelListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesModelListResult DeserializeCognitiveServicesModelListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesModelListResult DeserializeCognitiveServicesModelListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -42,8 +92,61 @@ internal static CognitiveServicesModelListResult DeserializeCognitiveServicesMod value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesModelListResult(nextLink.Value, Optional.ToList(value)); + return new CognitiveServicesModelListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesModelListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesModelListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesModelListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesModelListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesModelListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesModelListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesModelListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.cs index cd80a777594c..4e6938fa5d45 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services models. internal partial class CognitiveServicesModelListResult { - /// Initializes a new instance of CognitiveServicesModelListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesModelListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesModelListResult. + /// Initializes a new instance of . /// The link used to get the next page of Model. /// Gets the list of Cognitive Services accounts Model and their properties. - internal CognitiveServicesModelListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesModelListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of Model. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs index 3306b590a528..ebb7a0448e6c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesModelSku : IUtf8JsonSerializable + public partial class CognitiveServicesModelSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -35,13 +41,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Capacity)) { writer.WritePropertyName("capacity"u8); - writer.WriteObjectValue(Capacity); + if (Capacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capacity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(JsonElement element) + internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +78,7 @@ internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(J Optional deprecationDate = default; Optional capacity = default; Optional> rateLimits = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -95,8 +123,61 @@ internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(J rateLimits = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesModelSku(name.Value, usageName.Value, Optional.ToNullable(deprecationDate), capacity.Value, Optional.ToList(rateLimits), serializedAdditionalRawData); + } + + CognitiveServicesModelSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesModelSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesModelSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesModelSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesModelSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesModelSku(Response response) + { + if (response is null) + { + return null; } - return new CognitiveServicesModelSku(name.Value, usageName.Value, Optional.ToNullable(deprecationDate), capacity.Value, Optional.ToList(rateLimits)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesModelSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs index 623446dbdbeb..f545fcaa585a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs @@ -14,25 +14,30 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Describes an available Cognitive Services Model SKU. public partial class CognitiveServicesModelSku { - /// Initializes a new instance of CognitiveServicesModelSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesModelSku() { RateLimits = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesModelSku. + /// Initializes a new instance of . /// The name of the model SKU. /// The usage name of the model SKU. /// The datetime of deprecation of the model SKU. /// The capacity configuration. /// The list of rateLimit. - internal CognitiveServicesModelSku(string name, string usageName, DateTimeOffset? deprecationOn, CognitiveServicesCapacityConfig capacity, IReadOnlyList rateLimits) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesModelSku(string name, string usageName, DateTimeOffset? deprecationOn, CognitiveServicesCapacityConfig capacity, IReadOnlyList rateLimits, Dictionary serializedAdditionalRawData) { Name = name; UsageName = usageName; DeprecationOn = deprecationOn; Capacity = capacity; RateLimits = rateLimits; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the model SKU. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.Serialization.cs index cc81f1447d50..23f0627b4d37 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesMultiRegionSettings : IUtf8JsonSerializable + public partial class CognitiveServicesMultiRegionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RoutingMethod)) { @@ -27,21 +34,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Regions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesMultiRegionSettings DeserializeCognitiveServicesMultiRegionSettings(JsonElement element) + internal static CognitiveServicesMultiRegionSettings DeserializeCognitiveServicesMultiRegionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional routingMethod = default; Optional> regions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("routingMethod"u8)) @@ -67,8 +96,61 @@ internal static CognitiveServicesMultiRegionSettings DeserializeCognitiveService regions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesMultiRegionSettings(Optional.ToNullable(routingMethod), Optional.ToList(regions), serializedAdditionalRawData); + } + + CognitiveServicesMultiRegionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesMultiRegionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesMultiRegionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesMultiRegionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesMultiRegionSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesMultiRegionSettings(Response response) + { + if (response is null) + { + return null; } - return new CognitiveServicesMultiRegionSettings(Optional.ToNullable(routingMethod), Optional.ToList(regions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesMultiRegionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.cs index b0986f9b1e86..4875cbedf1b2 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesMultiRegionSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The multiregion settings Cognitive Services account. public partial class CognitiveServicesMultiRegionSettings { - /// Initializes a new instance of CognitiveServicesMultiRegionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesMultiRegionSettings() { Regions = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesMultiRegionSettings. + /// Initializes a new instance of . /// Multiregion routing methods. /// - internal CognitiveServicesMultiRegionSettings(CognitiveServicesRoutingMethod? routingMethod, IList regions) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesMultiRegionSettings(CognitiveServicesRoutingMethod? routingMethod, IList regions, Dictionary serializedAdditionalRawData) { RoutingMethod = routingMethod; Regions = regions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Multiregion routing methods. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs index 86a09963391d..b5b7c2bf9d16 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesNetworkRuleSet : IUtf8JsonSerializable + public partial class CognitiveServicesNetworkRuleSet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DefaultAction)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,15 +51,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualNetworkRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetworkRuleSet(JsonElement element) + internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetworkRuleSet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +88,7 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw Optional defaultAction = default; Optional> ipRules = default; Optional> virtualNetworkRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defaultAction"u8)) @@ -92,8 +128,61 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw virtualNetworkRules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesNetworkRuleSet(Optional.ToNullable(defaultAction), Optional.ToList(ipRules), Optional.ToList(virtualNetworkRules), serializedAdditionalRawData); + } + + CognitiveServicesNetworkRuleSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesNetworkRuleSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesNetworkRuleSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesNetworkRuleSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesNetworkRuleSet model) + { + if (model is null) + { + return null; } - return new CognitiveServicesNetworkRuleSet(Optional.ToNullable(defaultAction), Optional.ToList(ipRules), Optional.ToList(virtualNetworkRules)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesNetworkRuleSet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesNetworkRuleSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs index b77882cbbaea..612b8436b5e3 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// A set of rules governing the network accessibility. public partial class CognitiveServicesNetworkRuleSet { - /// Initializes a new instance of CognitiveServicesNetworkRuleSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesNetworkRuleSet() { IPRules = new ChangeTrackingList(); VirtualNetworkRules = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesNetworkRuleSet. + /// Initializes a new instance of . /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. /// The list of IP address rules. /// The list of virtual network rules. - internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules, Dictionary serializedAdditionalRawData) { DefaultAction = defaultAction; IPRules = ipRules; VirtualNetworkRules = virtualNetworkRules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.Serialization.cs index c97610027e14..44e2f371b105 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesPatchResourceTags : IUtf8JsonSerializable + public partial class CognitiveServicesPatchResourceTags : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CognitiveServicesPatchResourceTags DeserializeCognitiveServicesPatchResourceTags(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesPatchResourceTags(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + CognitiveServicesPatchResourceTags IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPatchResourceTags(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPatchResourceTags IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPatchResourceTags(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPatchResourceTags model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPatchResourceTags(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPatchResourceTags(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.cs index 1c997598c098..039aa45b43ed 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPatchResourceTags.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The object being used to update tags of a resource, in general used for PATCH operations. public partial class CognitiveServicesPatchResourceTags { - /// Initializes a new instance of CognitiveServicesPatchResourceTags. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesPatchResourceTags() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPatchResourceTags(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionData.Serialization.cs index 9ad15de3fad6..f27e842602cb 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionData.Serialization.cs @@ -5,20 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.CognitiveServices { - public partial class CognitiveServicesPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class CognitiveServicesPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -35,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(GroupIds)) { @@ -48,11 +61,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesPrivateEndpointConnectionData DeserializeCognitiveServicesPrivateEndpointConnectionData(JsonElement element) + internal static CognitiveServicesPrivateEndpointConnectionData DeserializeCognitiveServicesPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +94,7 @@ internal static CognitiveServicesPrivateEndpointConnectionData DeserializeCognit Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; Optional> groupIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -164,8 +192,61 @@ internal static CognitiveServicesPrivateEndpointConnectionData DeserializeCognit } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(location), privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), Optional.ToList(groupIds), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + CognitiveServicesPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new CognitiveServicesPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(location), privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), Optional.ToList(groupIds), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.Serialization.cs index bbfde55a8701..da9d6d72aefb 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesPrivateEndpointConnectionListResult + internal partial class CognitiveServicesPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesPrivateEndpointConnectionListResult DeserializeCognitiveServicesPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesPrivateEndpointConnectionListResult DeserializeCognitiveServicesPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CognitiveServicesPrivateEndpointConnectionListResult Deserialize value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new CognitiveServicesPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.cs index 796ebc53c8a3..fa25412958fc 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CognitiveServices; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// A list of private endpoint connections. internal partial class CognitiveServicesPrivateEndpointConnectionListResult { - /// Initializes a new instance of CognitiveServicesPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal CognitiveServicesPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.Serialization.cs index 7bc281d93a7f..a35a42a2108e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesPrivateLinkResource : IUtf8JsonSerializable + public partial class CognitiveServicesPrivateLinkResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CognitiveServicesPrivateLinkResource DeserializeCognitiveServicesPrivateLinkResource(JsonElement element) + internal static CognitiveServicesPrivateLinkResource DeserializeCognitiveServicesPrivateLinkResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static CognitiveServicesPrivateLinkResource DeserializeCognitiveService string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -70,8 +100,61 @@ internal static CognitiveServicesPrivateLinkResource DeserializeCognitiveService systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesPrivateLinkResource(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + CognitiveServicesPrivateLinkResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPrivateLinkResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPrivateLinkResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPrivateLinkResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPrivateLinkResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPrivateLinkResource(Response response) + { + if (response is null) + { + return null; } - return new CognitiveServicesPrivateLinkResource(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPrivateLinkResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.cs index 73eb0ea7d69e..448ad7cb456e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResource.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// A private link resource. public partial class CognitiveServicesPrivateLinkResource : ResourceData { - /// Initializes a new instance of CognitiveServicesPrivateLinkResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesPrivateLinkResource() { } - /// Initializes a new instance of CognitiveServicesPrivateLinkResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Resource properties. - internal CognitiveServicesPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesPrivateLinkResourceProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesPrivateLinkResourceProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource properties. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.Serialization.cs index 791444e83c7b..823163425fe3 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesPrivateLinkResourceListResult + internal partial class CognitiveServicesPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesPrivateLinkResourceListResult DeserializeCognitiveServicesPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesPrivateLinkResourceListResult DeserializeCognitiveServicesPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static CognitiveServicesPrivateLinkResourceListResult DeserializeCognit value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesPrivateLinkResourceListResult(Optional.ToList(value)); + return new CognitiveServicesPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.cs index c268bc958a98..36b0f7b3a7d8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// A list of private link resources. internal partial class CognitiveServicesPrivateLinkResourceListResult { - /// Initializes a new instance of CognitiveServicesPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal CognitiveServicesPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.Serialization.cs index a285b304cf8f..5339bd46f2c5 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesPrivateLinkResourceProperties : IUtf8JsonSerializable + public partial class CognitiveServicesPrivateLinkResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(RequiredZoneNames)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesPrivateLinkResourceProperties DeserializeCognitiveServicesPrivateLinkResourceProperties(JsonElement element) + internal static CognitiveServicesPrivateLinkResourceProperties DeserializeCognitiveServicesPrivateLinkResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static CognitiveServicesPrivateLinkResourceProperties DeserializeCognit Optional> requiredMembers = default; Optional> requiredZoneNames = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("groupId"u8)) @@ -79,8 +101,61 @@ internal static CognitiveServicesPrivateLinkResourceProperties DeserializeCognit displayName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesPrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), displayName.Value, serializedAdditionalRawData); + } + + CognitiveServicesPrivateLinkResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPrivateLinkResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPrivateLinkResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPrivateLinkResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPrivateLinkResourceProperties model) + { + if (model is null) + { + return null; } - return new CognitiveServicesPrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPrivateLinkResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPrivateLinkResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.cs index c55552cff31a..06c7443e9cb0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkResourceProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Properties of a private link resource. public partial class CognitiveServicesPrivateLinkResourceProperties { - /// Initializes a new instance of CognitiveServicesPrivateLinkResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesPrivateLinkResourceProperties() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesPrivateLinkResourceProperties. + /// Initializes a new instance of . /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. /// The private link resource display name. - internal CognitiveServicesPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, string displayName) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, string displayName, Dictionary serializedAdditionalRawData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.Serialization.cs index 4f617e8c3301..13c39fe06eac 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class CognitiveServicesPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesPrivateLinkServiceConnectionState DeserializeCognitiveServicesPrivateLinkServiceConnectionState(JsonElement element) + internal static CognitiveServicesPrivateLinkServiceConnectionState DeserializeCognitiveServicesPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static CognitiveServicesPrivateLinkServiceConnectionState DeserializeCo Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static CognitiveServicesPrivateLinkServiceConnectionState DeserializeCo actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + CognitiveServicesPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new CognitiveServicesPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.cs index 8884baa42ae5..5026d5237bbd 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class CognitiveServicesPrivateLinkServiceConnectionState { - /// Initializes a new instance of CognitiveServicesPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of CognitiveServicesPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal CognitiveServicesPrivateLinkServiceConnectionState(CognitiveServicesPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesPrivateLinkServiceConnectionState(CognitiveServicesPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.Serialization.cs index 4b21a4e332aa..7d6a93d49c1c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesRegionSetting : IUtf8JsonSerializable + public partial class CognitiveServicesRegionSetting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("customsubdomain"u8); writer.WriteStringValue(Customsubdomain); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesRegionSetting DeserializeCognitiveServicesRegionSetting(JsonElement element) + internal static CognitiveServicesRegionSetting DeserializeCognitiveServicesRegionSetting(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static CognitiveServicesRegionSetting DeserializeCognitiveServicesRegio Optional name = default; Optional value = default; Optional customsubdomain = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +86,61 @@ internal static CognitiveServicesRegionSetting DeserializeCognitiveServicesRegio customsubdomain = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesRegionSetting(name.Value, Optional.ToNullable(value), customsubdomain.Value, serializedAdditionalRawData); + } + + CognitiveServicesRegionSetting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesRegionSetting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesRegionSetting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesRegionSetting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesRegionSetting model) + { + if (model is null) + { + return null; } - return new CognitiveServicesRegionSetting(name.Value, Optional.ToNullable(value), customsubdomain.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesRegionSetting(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesRegionSetting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.cs index 99d4928e53fe..e0efe37e9024 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesRegionSetting.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The call rate limit Cognitive Services account. public partial class CognitiveServicesRegionSetting { - /// Initializes a new instance of CognitiveServicesRegionSetting. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CognitiveServicesRegionSetting() { } - /// Initializes a new instance of CognitiveServicesRegionSetting. + /// Initializes a new instance of . /// Name of the region. /// A value for priority or weighted routing methods. /// Maps the region to the regional custom subdomain. - internal CognitiveServicesRegionSetting(string name, float? value, string customsubdomain) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesRegionSetting(string name, float? value, string customsubdomain, Dictionary serializedAdditionalRawData) { Name = name; Value = value; Customsubdomain = customsubdomain; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the region. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.Serialization.cs index 058e452ad3ef..0d20e716e240 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSku : IUtf8JsonSerializable + public partial class CognitiveServicesSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesSku DeserializeCognitiveServicesSku(JsonElement element) + internal static CognitiveServicesSku DeserializeCognitiveServicesSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static CognitiveServicesSku DeserializeCognitiveServicesSku(JsonElement Optional size = default; Optional family = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -86,8 +109,61 @@ internal static CognitiveServicesSku DeserializeCognitiveServicesSku(JsonElement capacity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesSku(name, Optional.ToNullable(tier), size.Value, family.Value, Optional.ToNullable(capacity), serializedAdditionalRawData); + } + + CognitiveServicesSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSku model) + { + if (model is null) + { + return null; } - return new CognitiveServicesSku(name, Optional.ToNullable(tier), size.Value, family.Value, Optional.ToNullable(capacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.cs index d57480c298a5..8da3cbb38abf 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSku.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The resource model definition representing SKU. public partial class CognitiveServicesSku { - /// Initializes a new instance of CognitiveServicesSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the SKU. Ex - P3. It is typically a letter+number code. /// is null. public CognitiveServicesSku(string name) @@ -23,19 +27,26 @@ public CognitiveServicesSku(string name) Name = name; } - /// Initializes a new instance of CognitiveServicesSku. + /// Initializes a new instance of . /// The name of the SKU. Ex - P3. It is typically a letter+number code. /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. /// The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. /// If the service has different generations of hardware, for the same SKU, then that can be captured here. /// If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - internal CognitiveServicesSku(string name, CognitiveServicesSkuTier? tier, string size, string family, int? capacity) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSku(string name, CognitiveServicesSkuTier? tier, string size, string family, int? capacity, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; Size = size; Family = family; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CognitiveServicesSku() + { } /// The name of the SKU. Ex - P3. It is typically a letter+number code. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.Serialization.cs index 510ce073c522..31e793789353 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSkuAvailabilityContent : IUtf8JsonSerializable + public partial class CognitiveServicesSkuAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("skus"u8); writer.WriteStartArray(); @@ -26,7 +34,110 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Kind); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CognitiveServicesSkuAvailabilityContent DeserializeCognitiveServicesSkuAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList skus = default; + string kind = default; + ResourceType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("skus"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + skus = array; + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesSkuAvailabilityContent(skus, kind, type, serializedAdditionalRawData); + } + + CognitiveServicesSkuAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs index 2bfb0e77ae21..5ab0f2b40b93 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Check SKU availability parameter. public partial class CognitiveServicesSkuAvailabilityContent { - /// Initializes a new instance of CognitiveServicesSkuAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The SKU of the resource. /// The Kind of the resource. /// The Type of the resource. @@ -30,6 +33,24 @@ public CognitiveServicesSkuAvailabilityContent(IEnumerable skus, string ResourceType = resourceType; } + /// Initializes a new instance of . + /// The SKU of the resource. + /// The Kind of the resource. + /// The Type of the resource. + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuAvailabilityContent(IList skus, string kind, ResourceType resourceType, Dictionary serializedAdditionalRawData) + { + Skus = skus; + Kind = kind; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CognitiveServicesSkuAvailabilityContent() + { + } + /// The SKU of the resource. public IList Skus { get; } /// The Kind of the resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.Serialization.cs index 8b56853b3e31..3facb8daec0f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.Serialization.cs @@ -5,15 +5,73 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSkuAvailabilityList + public partial class CognitiveServicesSkuAvailabilityList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesSkuAvailabilityList DeserializeCognitiveServicesSkuAvailabilityList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (Optional.IsDefined(SkuAvailabilityType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(SkuAvailabilityType); + } + if (Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName); + } + if (Optional.IsDefined(IsSkuAvailable)) + { + writer.WritePropertyName("skuAvailable"u8); + writer.WriteBooleanValue(IsSkuAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesSkuAvailabilityList DeserializeCognitiveServicesSkuAvailabilityList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static CognitiveServicesSkuAvailabilityList DeserializeCognitiveService Optional skuAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -60,8 +119,61 @@ internal static CognitiveServicesSkuAvailabilityList DeserializeCognitiveService message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesSkuAvailabilityList(kind.Value, type.Value, skuName.Value, Optional.ToNullable(skuAvailable), reason.Value, message.Value); + return new CognitiveServicesSkuAvailabilityList(kind.Value, type.Value, skuName.Value, Optional.ToNullable(skuAvailable), reason.Value, message.Value, serializedAdditionalRawData); + } + + CognitiveServicesSkuAvailabilityList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuAvailabilityList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuAvailabilityList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuAvailabilityList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuAvailabilityList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuAvailabilityList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuAvailabilityList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.cs index e8c4d68b29c4..1652f9fda93d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityList.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// SKU availability. public partial class CognitiveServicesSkuAvailabilityList { - /// Initializes a new instance of CognitiveServicesSkuAvailabilityList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesSkuAvailabilityList() { } - /// Initializes a new instance of CognitiveServicesSkuAvailabilityList. + /// Initializes a new instance of . /// The Kind of the resource. /// The Type of the resource. /// The SKU of Cognitive Services account. /// Indicates the given SKU is available or not. /// Reason why the SKU is not available. /// Additional error message. - internal CognitiveServicesSkuAvailabilityList(string kind, string skuAvailabilityType, string skuName, bool? isSkuAvailable, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuAvailabilityList(string kind, string skuAvailabilityType, string skuName, bool? isSkuAvailable, string reason, string message, Dictionary serializedAdditionalRawData) { Kind = kind; SkuAvailabilityType = skuAvailabilityType; @@ -30,6 +37,7 @@ internal CognitiveServicesSkuAvailabilityList(string kind, string skuAvailabilit IsSkuAvailable = isSkuAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Kind of the resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.Serialization.cs index 934e18a0b70e..01fd9fccfd07 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CognitiveServicesSkuAvailabilityListResult + internal partial class CognitiveServicesSkuAvailabilityListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesSkuAvailabilityListResult DeserializeCognitiveServicesSkuAvailabilityListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesSkuAvailabilityListResult DeserializeCognitiveServicesSkuAvailabilityListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static CognitiveServicesSkuAvailabilityListResult DeserializeCognitiveS value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesSkuAvailabilityListResult(Optional.ToList(value)); + return new CognitiveServicesSkuAvailabilityListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CognitiveServicesSkuAvailabilityListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuAvailabilityListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuAvailabilityListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuAvailabilityListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuAvailabilityListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuAvailabilityListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuAvailabilityListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.cs index 5a46770279b7..de60768c909b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Check SKU availability result list. internal partial class CognitiveServicesSkuAvailabilityListResult { - /// Initializes a new instance of CognitiveServicesSkuAvailabilityListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesSkuAvailabilityListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesSkuAvailabilityListResult. + /// Initializes a new instance of . /// Check SKU availability result list. - internal CognitiveServicesSkuAvailabilityListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuAvailabilityListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Check SKU availability result list. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.Serialization.cs index f15005c7e4de..4a9887fe07dc 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSkuCapability + public partial class CognitiveServicesSkuCapability : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesSkuCapability DeserializeCognitiveServicesSkuCapability(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesSkuCapability DeserializeCognitiveServicesSkuCapability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static CognitiveServicesSkuCapability DeserializeCognitiveServicesSkuCa value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesSkuCapability(name.Value, value.Value); + return new CognitiveServicesSkuCapability(name.Value, value.Value, serializedAdditionalRawData); + } + + CognitiveServicesSkuCapability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuCapability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuCapability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuCapability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuCapability model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuCapability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuCapability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.cs index f4834cc588b5..e89249f35c76 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuCapability.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// SkuCapability indicates the capability of a certain feature. public partial class CognitiveServicesSkuCapability { - /// Initializes a new instance of CognitiveServicesSkuCapability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesSkuCapability() { } - /// Initializes a new instance of CognitiveServicesSkuCapability. + /// Initializes a new instance of . /// The name of the SkuCapability. /// The value of the SkuCapability. - internal CognitiveServicesSkuCapability(string name, string value) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuCapability(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the SkuCapability. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.Serialization.cs index 49bb74e362bf..a730bb1fa784 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSkuChangeInfo + public partial class CognitiveServicesSkuChangeInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesSkuChangeInfo DeserializeCognitiveServicesSkuChangeInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CountOfDowngrades)) + { + writer.WritePropertyName("countOfDowngrades"u8); + writer.WriteNumberValue(CountOfDowngrades.Value); + } + if (Optional.IsDefined(CountOfUpgradesAfterDowngrades)) + { + writer.WritePropertyName("countOfUpgradesAfterDowngrades"u8); + writer.WriteNumberValue(CountOfUpgradesAfterDowngrades.Value); + } + if (Optional.IsDefined(LastChangedOn)) + { + writer.WritePropertyName("lastChangeDate"u8); + writer.WriteStringValue(LastChangedOn.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesSkuChangeInfo DeserializeCognitiveServicesSkuChangeInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static CognitiveServicesSkuChangeInfo DeserializeCognitiveServicesSkuCh Optional countOfDowngrades = default; Optional countOfUpgradesAfterDowngrades = default; Optional lastChangeDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("countOfDowngrades"u8)) @@ -51,8 +94,61 @@ internal static CognitiveServicesSkuChangeInfo DeserializeCognitiveServicesSkuCh lastChangeDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesSkuChangeInfo(Optional.ToNullable(countOfDowngrades), Optional.ToNullable(countOfUpgradesAfterDowngrades), Optional.ToNullable(lastChangeDate)); + return new CognitiveServicesSkuChangeInfo(Optional.ToNullable(countOfDowngrades), Optional.ToNullable(countOfUpgradesAfterDowngrades), Optional.ToNullable(lastChangeDate), serializedAdditionalRawData); + } + + CognitiveServicesSkuChangeInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuChangeInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuChangeInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuChangeInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuChangeInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuChangeInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuChangeInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.cs index 9d03464d886f..37211d64e703 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuChangeInfo.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CognitiveServices.Models { /// Sku change info of account. public partial class CognitiveServicesSkuChangeInfo { - /// Initializes a new instance of CognitiveServicesSkuChangeInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesSkuChangeInfo() { } - /// Initializes a new instance of CognitiveServicesSkuChangeInfo. + /// Initializes a new instance of . /// Gets the count of downgrades. /// Gets the count of upgrades after downgrades. /// Gets the last change date. - internal CognitiveServicesSkuChangeInfo(float? countOfDowngrades, float? countOfUpgradesAfterDowngrades, DateTimeOffset? lastChangedOn) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuChangeInfo(float? countOfDowngrades, float? countOfUpgradesAfterDowngrades, DateTimeOffset? lastChangedOn, Dictionary serializedAdditionalRawData) { CountOfDowngrades = countOfDowngrades; CountOfUpgradesAfterDowngrades = countOfUpgradesAfterDowngrades; LastChangedOn = lastChangedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the count of downgrades. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.Serialization.cs index ac2f21ed1d50..fa5176b8fd8d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.Serialization.cs @@ -5,22 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSkuRestrictionInfo + public partial class CognitiveServicesSkuRestrictionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesSkuRestrictionInfo DeserializeCognitiveServicesSkuRestrictionInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesSkuRestrictionInfo DeserializeCognitiveServicesSkuRestrictionInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> locations = default; Optional> zones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("locations"u8)) @@ -51,8 +99,61 @@ internal static CognitiveServicesSkuRestrictionInfo DeserializeCognitiveServices zones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones)); + return new CognitiveServicesSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones), serializedAdditionalRawData); + } + + CognitiveServicesSkuRestrictionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuRestrictionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuRestrictionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuRestrictionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuRestrictionInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuRestrictionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuRestrictionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.cs index bb7068e50f32..89d66904f8d0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictionInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The CognitiveServicesSkuRestrictionInfo. public partial class CognitiveServicesSkuRestrictionInfo { - /// Initializes a new instance of CognitiveServicesSkuRestrictionInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesSkuRestrictionInfo() { Locations = new ChangeTrackingList(); Zones = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesSkuRestrictionInfo. + /// Initializes a new instance of . /// Locations where the SKU is restricted. /// List of availability zones where the SKU is restricted. - internal CognitiveServicesSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones, Dictionary serializedAdditionalRawData) { Locations = locations; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Locations where the SKU is restricted. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.Serialization.cs index 0943f51f4e62..37ef49fe3e03 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesSkuRestrictions + public partial class CognitiveServicesSkuRestrictions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CognitiveServicesSkuRestrictions DeserializeCognitiveServicesSkuRestrictions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RestrictionsType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RestrictionsType.Value.ToSerialString()); + } + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RestrictionInfo)) + { + writer.WritePropertyName("restrictionInfo"u8); + if (RestrictionInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestrictionInfo).Serialize(writer, options); + } + } + if (Optional.IsDefined(ReasonCode)) + { + writer.WritePropertyName("reasonCode"u8); + writer.WriteStringValue(ReasonCode.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CognitiveServicesSkuRestrictions DeserializeCognitiveServicesSkuRestrictions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +82,7 @@ internal static CognitiveServicesSkuRestrictions DeserializeCognitiveServicesSku Optional> values = default; Optional restrictionInfo = default; Optional reasonCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -66,8 +126,61 @@ internal static CognitiveServicesSkuRestrictions DeserializeCognitiveServicesSku reasonCode = new CognitiveServicesSkuRestrictionReasonCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CognitiveServicesSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode)); + return new CognitiveServicesSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode), serializedAdditionalRawData); + } + + CognitiveServicesSkuRestrictions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesSkuRestrictions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesSkuRestrictions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesSkuRestrictions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesSkuRestrictions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesSkuRestrictions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesSkuRestrictions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.cs index 033340168d20..8dc6a664cf14 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuRestrictions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Describes restrictions of a SKU. public partial class CognitiveServicesSkuRestrictions { - /// Initializes a new instance of CognitiveServicesSkuRestrictions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CognitiveServicesSkuRestrictions() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of CognitiveServicesSkuRestrictions. + /// Initializes a new instance of . /// The type of restrictions. /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. /// The information about the restriction where the SKU cannot be used. /// The reason for restriction. - internal CognitiveServicesSkuRestrictions(CognitiveServicesSkuRestrictionsType? restrictionsType, IReadOnlyList values, CognitiveServicesSkuRestrictionInfo restrictionInfo, CognitiveServicesSkuRestrictionReasonCode? reasonCode) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesSkuRestrictions(CognitiveServicesSkuRestrictionsType? restrictionsType, IReadOnlyList values, CognitiveServicesSkuRestrictionInfo restrictionInfo, CognitiveServicesSkuRestrictionReasonCode? reasonCode, Dictionary serializedAdditionalRawData) { RestrictionsType = restrictionsType; Values = values; RestrictionInfo = restrictionInfo; ReasonCode = reasonCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of restrictions. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.Serialization.cs index 1e994323d010..84f46cc8c292 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesVirtualNetworkRule : IUtf8JsonSerializable + public partial class CognitiveServicesVirtualNetworkRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ignoreMissingVnetServiceEndpoint"u8); writer.WriteBooleanValue(IgnoreMissingVnetServiceEndpoint.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CognitiveServicesVirtualNetworkRule DeserializeCognitiveServicesVirtualNetworkRule(JsonElement element) + internal static CognitiveServicesVirtualNetworkRule DeserializeCognitiveServicesVirtualNetworkRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static CognitiveServicesVirtualNetworkRule DeserializeCognitiveServices ResourceIdentifier id = default; Optional state = default; Optional ignoreMissingVnetServiceEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -60,8 +83,61 @@ internal static CognitiveServicesVirtualNetworkRule DeserializeCognitiveServices ignoreMissingVnetServiceEndpoint = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CognitiveServicesVirtualNetworkRule(id, state.Value, Optional.ToNullable(ignoreMissingVnetServiceEndpoint), serializedAdditionalRawData); + } + + CognitiveServicesVirtualNetworkRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCognitiveServicesVirtualNetworkRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CognitiveServicesVirtualNetworkRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCognitiveServicesVirtualNetworkRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CognitiveServicesVirtualNetworkRule model) + { + if (model is null) + { + return null; } - return new CognitiveServicesVirtualNetworkRule(id, state.Value, Optional.ToNullable(ignoreMissingVnetServiceEndpoint)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CognitiveServicesVirtualNetworkRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCognitiveServicesVirtualNetworkRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.cs index e69f681c8a97..c10954403161 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesVirtualNetworkRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// A rule governing the accessibility from a specific virtual network. public partial class CognitiveServicesVirtualNetworkRule { - /// Initializes a new instance of CognitiveServicesVirtualNetworkRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. /// is null. public CognitiveServicesVirtualNetworkRule(ResourceIdentifier id) @@ -23,15 +27,22 @@ public CognitiveServicesVirtualNetworkRule(ResourceIdentifier id) Id = id; } - /// Initializes a new instance of CognitiveServicesVirtualNetworkRule. + /// Initializes a new instance of . /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. /// Gets the state of virtual network rule. /// Ignore missing vnet service endpoint or not. - internal CognitiveServicesVirtualNetworkRule(ResourceIdentifier id, string state, bool? ignoreMissingVnetServiceEndpoint) + /// Keeps track of any properties unknown to the library. + internal CognitiveServicesVirtualNetworkRule(ResourceIdentifier id, string state, bool? ignoreMissingVnetServiceEndpoint, Dictionary serializedAdditionalRawData) { Id = id; State = state; IgnoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CognitiveServicesVirtualNetworkRule() + { } /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.Serialization.cs index 4f20e698628a..22c0320b96e9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CommitmentCost + public partial class CommitmentCost : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentCost DeserializeCommitmentCost(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CommitmentMeterId)) + { + writer.WritePropertyName("commitmentMeterId"u8); + writer.WriteStringValue(CommitmentMeterId); + } + if (Optional.IsDefined(OverageMeterId)) + { + writer.WritePropertyName("overageMeterId"u8); + writer.WriteStringValue(OverageMeterId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentCost DeserializeCommitmentCost(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional commitmentMeterId = default; Optional overageMeterId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("commitmentMeterId"u8)) @@ -32,8 +71,61 @@ internal static CommitmentCost DeserializeCommitmentCost(JsonElement element) overageMeterId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentCost(commitmentMeterId.Value, overageMeterId.Value); + return new CommitmentCost(commitmentMeterId.Value, overageMeterId.Value, serializedAdditionalRawData); + } + + CommitmentCost IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentCost(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentCost IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentCost(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentCost model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentCost(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentCost(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.cs index ee26db6ea9dc..5fa0d907872a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentCost.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Cognitive Services account commitment cost. public partial class CommitmentCost { - /// Initializes a new instance of CommitmentCost. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentCost() { } - /// Initializes a new instance of CommitmentCost. + /// Initializes a new instance of . /// Commitment meter Id. /// Overage meter Id. - internal CommitmentCost(string commitmentMeterId, string overageMeterId) + /// Keeps track of any properties unknown to the library. + internal CommitmentCost(string commitmentMeterId, string overageMeterId, Dictionary serializedAdditionalRawData) { CommitmentMeterId = commitmentMeterId; OverageMeterId = overageMeterId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Commitment meter Id. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.Serialization.cs index 630f3ffc2eef..8aaad3721e7f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CommitmentPeriod : IUtf8JsonSerializable + public partial class CommitmentPeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Tier)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("count"u8); writer.WriteNumberValue(Count.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommitmentPeriod DeserializeCommitmentPeriod(JsonElement element) + internal static CommitmentPeriod DeserializeCommitmentPeriod(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static CommitmentPeriod DeserializeCommitmentPeriod(JsonElement element Optional quota = default; Optional startDate = default; Optional endDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tier"u8)) @@ -83,8 +105,61 @@ internal static CommitmentPeriod DeserializeCommitmentPeriod(JsonElement element endDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommitmentPeriod(tier.Value, Optional.ToNullable(count), quota.Value, Optional.ToNullable(startDate), Optional.ToNullable(endDate), serializedAdditionalRawData); + } + + CommitmentPeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPeriod model) + { + if (model is null) + { + return null; } - return new CommitmentPeriod(tier.Value, Optional.ToNullable(count), quota.Value, Optional.ToNullable(startDate), Optional.ToNullable(endDate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.cs index 0b267b661565..a74585b27931 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPeriod.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CognitiveServices.Models { /// Cognitive Services account commitment period. public partial class CommitmentPeriod { - /// Initializes a new instance of CommitmentPeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommitmentPeriod() { } - /// Initializes a new instance of CommitmentPeriod. + /// Initializes a new instance of . /// Commitment period commitment tier. /// Commitment period commitment count. /// Cognitive Services account commitment quota. /// Commitment period start date. /// Commitment period end date. - internal CommitmentPeriod(string tier, int? count, CommitmentQuota quota, DateTimeOffset? startOn, DateTimeOffset? endOn) + /// Keeps track of any properties unknown to the library. + internal CommitmentPeriod(string tier, int? count, CommitmentQuota quota, DateTimeOffset? startOn, DateTimeOffset? endOn, Dictionary serializedAdditionalRawData) { Tier = tier; Count = count; Quota = quota; StartOn = startOn; EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Commitment period commitment tier. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs index 2e1f200c1229..6a52ada52802 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices { - public partial class CommitmentPlanAccountAssociationData : IUtf8JsonSerializable + public partial class CommitmentPlanAccountAssociationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AccountId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAccountAssociationData(JsonElement element) + internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAccountAssociationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc ResourceType type = default; Optional systemData = default; Optional accountId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -92,8 +114,61 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommitmentPlanAccountAssociationData(id, name, type, systemData.Value, Optional.ToNullable(etag), accountId.Value, serializedAdditionalRawData); + } + + CommitmentPlanAccountAssociationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPlanAccountAssociationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPlanAccountAssociationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPlanAccountAssociationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPlanAccountAssociationData model) + { + if (model is null) + { + return null; } - return new CommitmentPlanAccountAssociationData(id, name, type, systemData.Value, Optional.ToNullable(etag), accountId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPlanAccountAssociationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPlanAccountAssociationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.Serialization.cs index 72e2eb68881d..39f297a65513 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CommitmentPlanAccountAssociationListResult + internal partial class CommitmentPlanAccountAssociationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentPlanAccountAssociationListResult DeserializeCommitmentPlanAccountAssociationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentPlanAccountAssociationListResult DeserializeCommitmentPlanAccountAssociationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static CommitmentPlanAccountAssociationListResult DeserializeCommitment value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentPlanAccountAssociationListResult(nextLink.Value, Optional.ToList(value)); + return new CommitmentPlanAccountAssociationListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CommitmentPlanAccountAssociationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPlanAccountAssociationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPlanAccountAssociationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPlanAccountAssociationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPlanAccountAssociationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPlanAccountAssociationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPlanAccountAssociationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.cs index 24b460cc68bd..6ef660ebd495 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CognitiveServices; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services Commitment Plan Account Association operation response. internal partial class CommitmentPlanAccountAssociationListResult { - /// Initializes a new instance of CommitmentPlanAccountAssociationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentPlanAccountAssociationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CommitmentPlanAccountAssociationListResult. + /// Initializes a new instance of . /// The link used to get the next page of Commitment Plan Account Association. /// Gets the list of Cognitive Services Commitment Plan Account Association and their properties. - internal CommitmentPlanAccountAssociationListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CommitmentPlanAccountAssociationListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of Commitment Plan Account Association. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.Serialization.cs index 1c768acf7c3b..1c479e7bd4d0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CommitmentPlanAssociation + public partial class CommitmentPlanAssociation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentPlanAssociation DeserializeCommitmentPlanAssociation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CommitmentPlanId)) + { + writer.WritePropertyName("commitmentPlanId"u8); + writer.WriteStringValue(CommitmentPlanId); + } + if (Optional.IsDefined(CommitmentPlanLocation)) + { + writer.WritePropertyName("commitmentPlanLocation"u8); + writer.WriteStringValue(CommitmentPlanLocation); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentPlanAssociation DeserializeCommitmentPlanAssociation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional commitmentPlanId = default; Optional commitmentPlanLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("commitmentPlanId"u8)) @@ -36,8 +75,61 @@ internal static CommitmentPlanAssociation DeserializeCommitmentPlanAssociation(J commitmentPlanLocation = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentPlanAssociation(commitmentPlanId.Value, commitmentPlanLocation.Value); + return new CommitmentPlanAssociation(commitmentPlanId.Value, commitmentPlanLocation.Value, serializedAdditionalRawData); + } + + CommitmentPlanAssociation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPlanAssociation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPlanAssociation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPlanAssociation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPlanAssociation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPlanAssociation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPlanAssociation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.cs index ace6ceb19bca..fe8ed2118299 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAssociation.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The commitment plan association. public partial class CommitmentPlanAssociation { - /// Initializes a new instance of CommitmentPlanAssociation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentPlanAssociation() { } - /// Initializes a new instance of CommitmentPlanAssociation. + /// Initializes a new instance of . /// The Azure resource id of the commitment plan. /// The location of of the commitment plan. - internal CommitmentPlanAssociation(ResourceIdentifier commitmentPlanId, string commitmentPlanLocation) + /// Keeps track of any properties unknown to the library. + internal CommitmentPlanAssociation(ResourceIdentifier commitmentPlanId, string commitmentPlanLocation, Dictionary serializedAdditionalRawData) { CommitmentPlanId = commitmentPlanId; CommitmentPlanLocation = commitmentPlanLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Azure resource id of the commitment plan. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanData.Serialization.cs index 1cbff16c3541..7f31056be325 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanData.Serialization.cs @@ -5,19 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices { - public partial class CommitmentPlanData : IUtf8JsonSerializable + public partial class CommitmentPlanData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -27,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -48,13 +61,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CommitmentPlanData DeserializeCommitmentPlanData(JsonElement element) + internal static CommitmentPlanData DeserializeCommitmentPlanData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +103,7 @@ internal static CommitmentPlanData DeserializeCommitmentPlanData(JsonElement ele string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -150,8 +185,61 @@ internal static CommitmentPlanData DeserializeCommitmentPlanData(JsonElement ele systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommitmentPlanData(id, name, type, systemData.Value, Optional.ToNullable(etag), kind.Value, sku.Value, Optional.ToDictionary(tags), Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + CommitmentPlanData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPlanData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPlanData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPlanData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPlanData model) + { + if (model is null) + { + return null; } - return new CommitmentPlanData(id, name, type, systemData.Value, Optional.ToNullable(etag), kind.Value, sku.Value, Optional.ToDictionary(tags), Optional.ToNullable(location), properties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPlanData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPlanData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.Serialization.cs index f9676b75d769..bc3f9f4a9d38 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.Serialization.cs @@ -5,23 +5,56 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CognitiveServices; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CommitmentPlanListResult + internal partial class CommitmentPlanListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentPlanListResult DeserializeCommitmentPlanListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentPlanListResult DeserializeCommitmentPlanListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -43,8 +76,61 @@ internal static CommitmentPlanListResult DeserializeCommitmentPlanListResult(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentPlanListResult(nextLink.Value, Optional.ToList(value)); + return new CommitmentPlanListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CommitmentPlanListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPlanListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPlanListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPlanListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPlanListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPlanListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPlanListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.cs index 3536299fc8ee..047310c96836 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CognitiveServices; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services accounts operation response. internal partial class CommitmentPlanListResult { - /// Initializes a new instance of CommitmentPlanListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentPlanListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CommitmentPlanListResult. + /// Initializes a new instance of . /// The link used to get the next page of CommitmentPlan. /// Gets the list of Cognitive Services accounts CommitmentPlan and their properties. - internal CommitmentPlanListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CommitmentPlanListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of CommitmentPlan. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.Serialization.cs index 306d11bbb654..0c50296c5447 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CommitmentPlanProperties : IUtf8JsonSerializable + public partial class CommitmentPlanProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CommitmentPlanGuid)) { @@ -35,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Current)) { writer.WritePropertyName("current"u8); - writer.WriteObjectValue(Current); + if (Current is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Current).Serialize(writer, options); + } } if (Optional.IsDefined(AutoRenew)) { @@ -45,13 +58,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Next)) { writer.WritePropertyName("next"u8); - writer.WriteObjectValue(Next); + if (Next is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Next).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CommitmentPlanProperties DeserializeCommitmentPlanProperties(JsonElement element) + internal static CommitmentPlanProperties DeserializeCommitmentPlanProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +99,7 @@ internal static CommitmentPlanProperties DeserializeCommitmentPlanProperties(Jso Optional next = default; Optional last = default; Optional> provisioningIssues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -149,8 +184,61 @@ internal static CommitmentPlanProperties DeserializeCommitmentPlanProperties(Jso provisioningIssues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommitmentPlanProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(commitmentPlanGuid), Optional.ToNullable(hostingModel), planType.Value, current.Value, Optional.ToNullable(autoRenew), next.Value, last.Value, Optional.ToList(provisioningIssues), serializedAdditionalRawData); + } + + CommitmentPlanProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentPlanProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentPlanProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentPlanProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentPlanProperties model) + { + if (model is null) + { + return null; } - return new CommitmentPlanProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(commitmentPlanGuid), Optional.ToNullable(hostingModel), planType.Value, current.Value, Optional.ToNullable(autoRenew), next.Value, last.Value, Optional.ToList(provisioningIssues)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentPlanProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentPlanProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.cs index 0306f88af5e2..46cd343e0364 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// Properties of Cognitive Services account commitment plan. public partial class CommitmentPlanProperties { - /// Initializes a new instance of CommitmentPlanProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommitmentPlanProperties() { ProvisioningIssues = new ChangeTrackingList(); } - /// Initializes a new instance of CommitmentPlanProperties. + /// Initializes a new instance of . /// Gets the status of the resource at the time the operation was called. /// Commitment plan guid. /// Account hosting model. @@ -30,7 +33,8 @@ public CommitmentPlanProperties() /// Cognitive Services account commitment period. /// Cognitive Services account commitment period. /// The list of ProvisioningIssue. - internal CommitmentPlanProperties(CommitmentPlanProvisioningState? provisioningState, Guid? commitmentPlanGuid, ServiceAccountHostingModel? hostingModel, string planType, CommitmentPeriod current, bool? autoRenew, CommitmentPeriod next, CommitmentPeriod last, IReadOnlyList provisioningIssues) + /// Keeps track of any properties unknown to the library. + internal CommitmentPlanProperties(CommitmentPlanProvisioningState? provisioningState, Guid? commitmentPlanGuid, ServiceAccountHostingModel? hostingModel, string planType, CommitmentPeriod current, bool? autoRenew, CommitmentPeriod next, CommitmentPeriod last, IReadOnlyList provisioningIssues, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; CommitmentPlanGuid = commitmentPlanGuid; @@ -41,6 +45,7 @@ internal CommitmentPlanProperties(CommitmentPlanProvisioningState? provisioningS Next = next; Last = last; ProvisioningIssues = provisioningIssues; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the status of the resource at the time the operation was called. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.Serialization.cs index 26580b498f23..83ef945d1371 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CommitmentQuota + public partial class CommitmentQuota : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentQuota DeserializeCommitmentQuota(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Quantity)) + { + writer.WritePropertyName("quantity"u8); + writer.WriteNumberValue(Quantity.Value); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentQuota DeserializeCommitmentQuota(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional quantity = default; Optional unit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("quantity"u8)) @@ -36,8 +75,61 @@ internal static CommitmentQuota DeserializeCommitmentQuota(JsonElement element) unit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentQuota(Optional.ToNullable(quantity), unit.Value); + return new CommitmentQuota(Optional.ToNullable(quantity), unit.Value, serializedAdditionalRawData); + } + + CommitmentQuota IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentQuota(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentQuota IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentQuota(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentQuota model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentQuota(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentQuota(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.cs index 8ec4dd97e1b5..42de6ad939d1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentQuota.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Cognitive Services account commitment quota. public partial class CommitmentQuota { - /// Initializes a new instance of CommitmentQuota. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentQuota() { } - /// Initializes a new instance of CommitmentQuota. + /// Initializes a new instance of . /// Commitment quota quantity. /// Commitment quota unit. - internal CommitmentQuota(long? quantity, string unit) + /// Keeps track of any properties unknown to the library. + internal CommitmentQuota(long? quantity, string unit, Dictionary serializedAdditionalRawData) { Quantity = quantity; Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Commitment quota quantity. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.Serialization.cs index 94dd34fc91e2..08ecff6227cd 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.Serialization.cs @@ -5,15 +5,97 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CommitmentTier + public partial class CommitmentTier : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentTier DeserializeCommitmentTier(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName); + } + if (Optional.IsDefined(HostingModel)) + { + writer.WritePropertyName("hostingModel"u8); + writer.WriteStringValue(HostingModel.Value.ToString()); + } + if (Optional.IsDefined(PlanType)) + { + writer.WritePropertyName("planType"u8); + writer.WriteStringValue(PlanType); + } + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(MaxCount)) + { + writer.WritePropertyName("maxCount"u8); + writer.WriteNumberValue(MaxCount.Value); + } + if (Optional.IsDefined(Quota)) + { + writer.WritePropertyName("quota"u8); + if (Quota is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Quota).Serialize(writer, options); + } + } + if (Optional.IsDefined(Cost)) + { + writer.WritePropertyName("cost"u8); + if (Cost is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Cost).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentTier DeserializeCommitmentTier(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +108,7 @@ internal static CommitmentTier DeserializeCommitmentTier(JsonElement element) Optional maxCount = default; Optional quota = default; Optional cost = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -84,8 +167,61 @@ internal static CommitmentTier DeserializeCommitmentTier(JsonElement element) cost = CommitmentCost.DeserializeCommitmentCost(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentTier(kind.Value, skuName.Value, Optional.ToNullable(hostingModel), planType.Value, tier.Value, Optional.ToNullable(maxCount), quota.Value, cost.Value); + return new CommitmentTier(kind.Value, skuName.Value, Optional.ToNullable(hostingModel), planType.Value, tier.Value, Optional.ToNullable(maxCount), quota.Value, cost.Value, serializedAdditionalRawData); + } + + CommitmentTier IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentTier(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentTier IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentTier(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentTier model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentTier(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentTier(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.cs index 83c8a91f924a..c432098eba58 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTier.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Cognitive Services account commitment tier. public partial class CommitmentTier { - /// Initializes a new instance of CommitmentTier. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentTier() { } - /// Initializes a new instance of CommitmentTier. + /// Initializes a new instance of . /// The Kind of the resource. /// The name of the SKU. Ex - P3. It is typically a letter+number code. /// Account hosting model. @@ -24,7 +30,8 @@ internal CommitmentTier() /// Commitment period commitment max count. /// Cognitive Services account commitment quota. /// Cognitive Services account commitment cost. - internal CommitmentTier(string kind, string skuName, ServiceAccountHostingModel? hostingModel, string planType, string tier, int? maxCount, CommitmentQuota quota, CommitmentCost cost) + /// Keeps track of any properties unknown to the library. + internal CommitmentTier(string kind, string skuName, ServiceAccountHostingModel? hostingModel, string planType, string tier, int? maxCount, CommitmentQuota quota, CommitmentCost cost, Dictionary serializedAdditionalRawData) { Kind = kind; SkuName = skuName; @@ -34,6 +41,7 @@ internal CommitmentTier(string kind, string skuName, ServiceAccountHostingModel? MaxCount = maxCount; Quota = quota; Cost = cost; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Kind of the resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.Serialization.cs index 43a89fac6634..01d2444c6a05 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class CommitmentTierListResult + internal partial class CommitmentTierListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommitmentTierListResult DeserializeCommitmentTierListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommitmentTierListResult DeserializeCommitmentTierListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -42,8 +75,61 @@ internal static CommitmentTierListResult DeserializeCommitmentTierListResult(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommitmentTierListResult(nextLink.Value, Optional.ToList(value)); + return new CommitmentTierListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + CommitmentTierListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommitmentTierListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommitmentTierListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommitmentTierListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommitmentTierListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommitmentTierListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommitmentTierListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.cs index eb6d02b06672..50dfe3def86b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentTierListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The list of cognitive services accounts operation response. internal partial class CommitmentTierListResult { - /// Initializes a new instance of CommitmentTierListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommitmentTierListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CommitmentTierListResult. + /// Initializes a new instance of . /// The link used to get the next page of CommitmentTier. /// Gets the list of Cognitive Services accounts CommitmentTier and their properties. - internal CommitmentTierListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CommitmentTierListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of CommitmentTier. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.Serialization.cs index 3d65e7cf5d7d..11c6c4514cae 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class RegenerateServiceAccountKeyContent : IUtf8JsonSerializable + public partial class RegenerateServiceAccountKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyName.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RegenerateServiceAccountKeyContent DeserializeRegenerateServiceAccountKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ServiceAccountKeyName keyName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyName"u8)) + { + keyName = property.Value.GetString().ToServiceAccountKeyName(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RegenerateServiceAccountKeyContent(keyName, serializedAdditionalRawData); + } + + RegenerateServiceAccountKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegenerateServiceAccountKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegenerateServiceAccountKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegenerateServiceAccountKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegenerateServiceAccountKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegenerateServiceAccountKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegenerateServiceAccountKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.cs index f18c5d004945..5be43865f419 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RegenerateServiceAccountKeyContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Regenerate key parameters. public partial class RegenerateServiceAccountKeyContent { - /// Initializes a new instance of RegenerateServiceAccountKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// key name to generate (Key1|Key2). public RegenerateServiceAccountKeyContent(ServiceAccountKeyName keyName) { KeyName = keyName; } + /// Initializes a new instance of . + /// key name to generate (Key1|Key2). + /// Keeps track of any properties unknown to the library. + internal RegenerateServiceAccountKeyContent(ServiceAccountKeyName keyName, Dictionary serializedAdditionalRawData) + { + KeyName = keyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RegenerateServiceAccountKeyContent() + { + } + /// key name to generate (Key1|Key2). public ServiceAccountKeyName KeyName { get; } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.Serialization.cs index 744a4d44b456..4fb189b1e74d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountApiKeys + public partial class ServiceAccountApiKeys : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountApiKeys DeserializeServiceAccountApiKeys(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Key1)) + { + writer.WritePropertyName("key1"u8); + writer.WriteStringValue(Key1); + } + if (Optional.IsDefined(Key2)) + { + writer.WritePropertyName("key2"u8); + writer.WriteStringValue(Key2); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountApiKeys DeserializeServiceAccountApiKeys(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional key1 = default; Optional key2 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key1"u8)) @@ -32,8 +71,61 @@ internal static ServiceAccountApiKeys DeserializeServiceAccountApiKeys(JsonEleme key2 = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAccountApiKeys(key1.Value, key2.Value); + return new ServiceAccountApiKeys(key1.Value, key2.Value, serializedAdditionalRawData); + } + + ServiceAccountApiKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountApiKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountApiKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountApiKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountApiKeys model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountApiKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountApiKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.cs index 1adefa8fb242..533d4dd65153 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiKeys.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The access keys for the cognitive services account. public partial class ServiceAccountApiKeys { - /// Initializes a new instance of ServiceAccountApiKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountApiKeys() { } - /// Initializes a new instance of ServiceAccountApiKeys. + /// Initializes a new instance of . /// Gets the value of key 1. /// Gets the value of key 2. - internal ServiceAccountApiKeys(string key1, string key2) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountApiKeys(string key1, string key2, Dictionary serializedAdditionalRawData) { Key1 = key1; Key2 = key2; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the value of key 1. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.Serialization.cs index cc0c436abee8..52a3ddce8533 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountApiProperties : IUtf8JsonSerializable + public partial class ServiceAccountApiProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QnaRuntimeEndpoint)) { @@ -79,8 +85,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ServiceAccountApiProperties DeserializeServiceAccountApiProperties(JsonElement element) + internal static ServiceAccountApiProperties DeserializeServiceAccountApiProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -170,5 +178,53 @@ internal static ServiceAccountApiProperties DeserializeServiceAccountApiProperti additionalProperties = additionalPropertiesDictionary; return new ServiceAccountApiProperties(qnaRuntimeEndpoint.Value, qnaAzureSearchEndpointKey.Value, qnaAzureSearchEndpointId.Value, Optional.ToNullable(statisticsEnabled), eventHubConnectionString.Value, storageAccountConnectionString.Value, Optional.ToNullable(aadClientId), Optional.ToNullable(aadTenantId), superUser.Value, websiteName.Value, additionalProperties); } + + ServiceAccountApiProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountApiProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountApiProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountApiProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountApiProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountApiProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountApiProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.cs index c03d277c687f..c3d353083786 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountApiProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The api properties for special APIs. public partial class ServiceAccountApiProperties { - /// Initializes a new instance of ServiceAccountApiProperties. + /// Initializes a new instance of . public ServiceAccountApiProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ServiceAccountApiProperties. + /// Initializes a new instance of . /// (QnAMaker Only) The runtime endpoint of QnAMaker. /// (QnAMaker Only) The Azure Search endpoint key of QnAMaker. /// (QnAMaker Only) The Azure Search endpoint id of QnAMaker. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.Serialization.cs index 4d146b2bde2a..1861b1d69ee8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountCallRateLimit + public partial class ServiceAccountCallRateLimit : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountCallRateLimit DeserializeServiceAccountCallRateLimit(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(RenewalPeriod)) + { + writer.WritePropertyName("renewalPeriod"u8); + writer.WriteNumberValue(RenewalPeriod.Value); + } + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountCallRateLimit DeserializeServiceAccountCallRateLimit(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static ServiceAccountCallRateLimit DeserializeServiceAccountCallRateLim Optional count = default; Optional renewalPeriod = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -56,8 +111,61 @@ internal static ServiceAccountCallRateLimit DeserializeServiceAccountCallRateLim rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAccountCallRateLimit(Optional.ToNullable(count), Optional.ToNullable(renewalPeriod), Optional.ToList(rules)); + return new ServiceAccountCallRateLimit(Optional.ToNullable(count), Optional.ToNullable(renewalPeriod), Optional.ToList(rules), serializedAdditionalRawData); + } + + ServiceAccountCallRateLimit IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountCallRateLimit(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountCallRateLimit IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountCallRateLimit(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountCallRateLimit model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountCallRateLimit(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountCallRateLimit(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.cs index 39ad7500e476..2aeef9d53e75 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountCallRateLimit.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The call rate limit Cognitive Services account. public partial class ServiceAccountCallRateLimit { - /// Initializes a new instance of ServiceAccountCallRateLimit. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountCallRateLimit() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAccountCallRateLimit. + /// Initializes a new instance of . /// The count value of Call Rate Limit. /// The renewal period in seconds of Call Rate Limit. /// - internal ServiceAccountCallRateLimit(float? count, float? renewalPeriod, IReadOnlyList rules) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountCallRateLimit(float? count, float? renewalPeriod, IReadOnlyList rules, Dictionary serializedAdditionalRawData) { Count = count; RenewalPeriod = renewalPeriod; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The count value of Call Rate Limit. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.Serialization.cs index 7ed8b7fed11e..f2f6225411c1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.Serialization.cs @@ -5,37 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountEncryptionProperties : IUtf8JsonSerializable + public partial class ServiceAccountEncryptionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyVaultProperties)) { writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties); + if (KeyVaultProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProperties).Serialize(writer, options); + } } if (Optional.IsDefined(KeySource)) { writer.WritePropertyName("keySource"u8); writer.WriteStringValue(KeySource.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAccountEncryptionProperties DeserializeServiceAccountEncryptionProperties(JsonElement element) + internal static ServiceAccountEncryptionProperties DeserializeServiceAccountEncryptionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional keyVaultProperties = default; Optional keySource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyVaultProperties"u8)) @@ -56,8 +86,61 @@ internal static ServiceAccountEncryptionProperties DeserializeServiceAccountEncr keySource = new ServiceAccountEncryptionKeySource(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAccountEncryptionProperties(keyVaultProperties.Value, Optional.ToNullable(keySource), serializedAdditionalRawData); + } + + ServiceAccountEncryptionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountEncryptionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountEncryptionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountEncryptionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountEncryptionProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountEncryptionProperties(Response response) + { + if (response is null) + { + return null; } - return new ServiceAccountEncryptionProperties(keyVaultProperties.Value, Optional.ToNullable(keySource)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountEncryptionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs index ecf019ca9198..f5df520c20ee 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// Properties to configure Encryption. public partial class ServiceAccountEncryptionProperties { - /// Initializes a new instance of ServiceAccountEncryptionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAccountEncryptionProperties() { } - /// Initializes a new instance of ServiceAccountEncryptionProperties. + /// Initializes a new instance of . /// Properties of KeyVault. /// Enumerates the possible value of keySource for Encryption. - internal ServiceAccountEncryptionProperties(CognitiveServicesKeyVaultProperties keyVaultProperties, ServiceAccountEncryptionKeySource? keySource) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountEncryptionProperties(CognitiveServicesKeyVaultProperties keyVaultProperties, ServiceAccountEncryptionKeySource? keySource, Dictionary serializedAdditionalRawData) { KeyVaultProperties = keyVaultProperties; KeySource = keySource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of KeyVault. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.Serialization.cs index 8e0d14f86b31..9c31f544ad3b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountModelDeprecationInfo : IUtf8JsonSerializable + public partial class ServiceAccountModelDeprecationInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FineTuneOn)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("inference"u8); writer.WriteStringValue(InferenceOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAccountModelDeprecationInfo DeserializeServiceAccountModelDeprecationInfo(JsonElement element) + internal static ServiceAccountModelDeprecationInfo DeserializeServiceAccountModelDeprecationInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional fineTune = default; Optional inference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("fineTune"u8)) @@ -57,8 +79,61 @@ internal static ServiceAccountModelDeprecationInfo DeserializeServiceAccountMode inference = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAccountModelDeprecationInfo(Optional.ToNullable(fineTune), Optional.ToNullable(inference), serializedAdditionalRawData); + } + + ServiceAccountModelDeprecationInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountModelDeprecationInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountModelDeprecationInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountModelDeprecationInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountModelDeprecationInfo model) + { + if (model is null) + { + return null; } - return new ServiceAccountModelDeprecationInfo(Optional.ToNullable(fineTune), Optional.ToNullable(inference)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountModelDeprecationInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountModelDeprecationInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.cs index ff80776762b5..852730125c2e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountModelDeprecationInfo.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CognitiveServices.Models { /// Cognitive Services account ModelDeprecationInfo. public partial class ServiceAccountModelDeprecationInfo { - /// Initializes a new instance of ServiceAccountModelDeprecationInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAccountModelDeprecationInfo() { } - /// Initializes a new instance of ServiceAccountModelDeprecationInfo. + /// Initializes a new instance of . /// The datetime of deprecation of the fineTune Model. /// The datetime of deprecation of the inference Model. - internal ServiceAccountModelDeprecationInfo(DateTimeOffset? fineTuneOn, DateTimeOffset? inferenceOn) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountModelDeprecationInfo(DateTimeOffset? fineTuneOn, DateTimeOffset? inferenceOn, Dictionary serializedAdditionalRawData) { FineTuneOn = fineTuneOn; InferenceOn = inferenceOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The datetime of deprecation of the fineTune Model. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.Serialization.cs index 2473e167a568..0161493647ef 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountQuotaLimit + public partial class ServiceAccountQuotaLimit : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountQuotaLimit DeserializeServiceAccountQuotaLimit(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(RenewalPeriod)) + { + writer.WritePropertyName("renewalPeriod"u8); + writer.WriteNumberValue(RenewalPeriod.Value); + } + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountQuotaLimit DeserializeServiceAccountQuotaLimit(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static ServiceAccountQuotaLimit DeserializeServiceAccountQuotaLimit(Jso Optional count = default; Optional renewalPeriod = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -56,8 +111,61 @@ internal static ServiceAccountQuotaLimit DeserializeServiceAccountQuotaLimit(Jso rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAccountQuotaLimit(Optional.ToNullable(count), Optional.ToNullable(renewalPeriod), Optional.ToList(rules)); + return new ServiceAccountQuotaLimit(Optional.ToNullable(count), Optional.ToNullable(renewalPeriod), Optional.ToList(rules), serializedAdditionalRawData); + } + + ServiceAccountQuotaLimit IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountQuotaLimit(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountQuotaLimit IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountQuotaLimit(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountQuotaLimit model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountQuotaLimit(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountQuotaLimit(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.cs index 9fc55643c32e..b262a4c6c227 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountQuotaLimit.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The ServiceAccountQuotaLimit. public partial class ServiceAccountQuotaLimit { - /// Initializes a new instance of ServiceAccountQuotaLimit. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountQuotaLimit() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAccountQuotaLimit. + /// Initializes a new instance of . /// /// /// - internal ServiceAccountQuotaLimit(float? count, float? renewalPeriod, IReadOnlyList rules) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountQuotaLimit(float? count, float? renewalPeriod, IReadOnlyList rules, Dictionary serializedAdditionalRawData) { Count = count; RenewalPeriod = renewalPeriod; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the count. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.Serialization.cs index d7c4dbb07685..a50b03a41065 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountThrottlingMatchPattern + public partial class ServiceAccountThrottlingMatchPattern : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountThrottlingMatchPattern DeserializeServiceAccountThrottlingMatchPattern(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Method)) + { + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountThrottlingMatchPattern DeserializeServiceAccountThrottlingMatchPattern(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional path = default; Optional method = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -32,8 +71,61 @@ internal static ServiceAccountThrottlingMatchPattern DeserializeServiceAccountTh method = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAccountThrottlingMatchPattern(path.Value, method.Value); + return new ServiceAccountThrottlingMatchPattern(path.Value, method.Value, serializedAdditionalRawData); + } + + ServiceAccountThrottlingMatchPattern IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountThrottlingMatchPattern(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountThrottlingMatchPattern IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountThrottlingMatchPattern(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountThrottlingMatchPattern model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountThrottlingMatchPattern(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountThrottlingMatchPattern(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.cs index ccb3da58931a..4ff26a9d3249 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingMatchPattern.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The ServiceAccountThrottlingMatchPattern. public partial class ServiceAccountThrottlingMatchPattern { - /// Initializes a new instance of ServiceAccountThrottlingMatchPattern. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountThrottlingMatchPattern() { } - /// Initializes a new instance of ServiceAccountThrottlingMatchPattern. + /// Initializes a new instance of . /// /// - internal ServiceAccountThrottlingMatchPattern(string path, string method) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountThrottlingMatchPattern(string path, string method, Dictionary serializedAdditionalRawData) { Path = path; Method = method; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the path. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.Serialization.cs index 19cbab581ae5..599f5be1af75 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.Serialization.cs @@ -5,16 +5,85 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountThrottlingRule + public partial class ServiceAccountThrottlingRule : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountThrottlingRule DeserializeServiceAccountThrottlingRule(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(RenewalPeriod)) + { + writer.WritePropertyName("renewalPeriod"u8); + writer.WriteNumberValue(RenewalPeriod.Value); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(MinCount)) + { + writer.WritePropertyName("minCount"u8); + writer.WriteNumberValue(MinCount.Value); + } + if (Optional.IsDefined(IsDynamicThrottlingEnabled)) + { + writer.WritePropertyName("dynamicThrottlingEnabled"u8); + writer.WriteBooleanValue(IsDynamicThrottlingEnabled.Value); + } + if (Optional.IsCollectionDefined(MatchPatterns)) + { + writer.WritePropertyName("matchPatterns"u8); + writer.WriteStartArray(); + foreach (var item in MatchPatterns) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountThrottlingRule DeserializeServiceAccountThrottlingRule(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +94,7 @@ internal static ServiceAccountThrottlingRule DeserializeServiceAccountThrottling Optional minCount = default; Optional dynamicThrottlingEnabled = default; Optional> matchPatterns = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -82,8 +152,61 @@ internal static ServiceAccountThrottlingRule DeserializeServiceAccountThrottling matchPatterns = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAccountThrottlingRule(key.Value, Optional.ToNullable(renewalPeriod), Optional.ToNullable(count), Optional.ToNullable(minCount), Optional.ToNullable(dynamicThrottlingEnabled), Optional.ToList(matchPatterns), serializedAdditionalRawData); + } + + ServiceAccountThrottlingRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountThrottlingRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountThrottlingRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountThrottlingRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountThrottlingRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountThrottlingRule(Response response) + { + if (response is null) + { + return null; } - return new ServiceAccountThrottlingRule(key.Value, Optional.ToNullable(renewalPeriod), Optional.ToNullable(count), Optional.ToNullable(minCount), Optional.ToNullable(dynamicThrottlingEnabled), Optional.ToList(matchPatterns)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountThrottlingRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.cs index f9f28ee4ac4b..85a260e2646d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountThrottlingRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The ServiceAccountThrottlingRule. public partial class ServiceAccountThrottlingRule { - /// Initializes a new instance of ServiceAccountThrottlingRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountThrottlingRule() { MatchPatterns = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAccountThrottlingRule. + /// Initializes a new instance of . /// /// /// /// /// /// - internal ServiceAccountThrottlingRule(string key, float? renewalPeriod, float? count, float? minCount, bool? isDynamicThrottlingEnabled, IReadOnlyList matchPatterns) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountThrottlingRule(string key, float? renewalPeriod, float? count, float? minCount, bool? isDynamicThrottlingEnabled, IReadOnlyList matchPatterns, Dictionary serializedAdditionalRawData) { Key = key; RenewalPeriod = renewalPeriod; @@ -34,6 +39,7 @@ internal ServiceAccountThrottlingRule(string key, float? renewalPeriod, float? c MinCount = minCount; IsDynamicThrottlingEnabled = isDynamicThrottlingEnabled; MatchPatterns = matchPatterns; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the key. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.Serialization.cs index bfdf6e052cc2..b28d5fdefa62 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.Serialization.cs @@ -5,15 +5,85 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountUsage + public partial class ServiceAccountUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountUsage DeserializeServiceAccountUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + if (Name is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Name).Serialize(writer, options); + } + } + if (Optional.IsDefined(QuotaPeriod)) + { + writer.WritePropertyName("quotaPeriod"u8); + writer.WriteStringValue(QuotaPeriod); + } + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(CurrentValue)) + { + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue.Value); + } + if (Optional.IsDefined(NextResetTime)) + { + writer.WritePropertyName("nextResetTime"u8); + writer.WriteStringValue(NextResetTime); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountUsage DeserializeServiceAccountUsage(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +95,7 @@ internal static ServiceAccountUsage DeserializeServiceAccountUsage(JsonElement e Optional currentValue = default; Optional nextResetTime = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("unit"u8)) @@ -82,8 +153,61 @@ internal static ServiceAccountUsage DeserializeServiceAccountUsage(JsonElement e status = new ServiceAccountQuotaUsageStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAccountUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), nextResetTime.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + ServiceAccountUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountUsage(Response response) + { + if (response is null) + { + return null; } - return new ServiceAccountUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), nextResetTime.Value, Optional.ToNullable(status)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.cs index 7c92ad66e32d..21ae14671b96 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsage.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The usage data for a usage request. public partial class ServiceAccountUsage { - /// Initializes a new instance of ServiceAccountUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountUsage() { } - /// Initializes a new instance of ServiceAccountUsage. + /// Initializes a new instance of . /// The unit of the metric. /// The name information for the metric. /// The quota period used to summarize the usage values. @@ -23,7 +29,8 @@ internal ServiceAccountUsage() /// Current value for this metric. /// Next reset time for current quota. /// Cognitive Services account quota usage status. - internal ServiceAccountUsage(ServiceAccountUsageUnitType? unit, ServiceAccountUsageMetricName name, string quotaPeriod, double? limit, double? currentValue, string nextResetTime, ServiceAccountQuotaUsageStatus? status) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountUsage(ServiceAccountUsageUnitType? unit, ServiceAccountUsageMetricName name, string quotaPeriod, double? limit, double? currentValue, string nextResetTime, ServiceAccountQuotaUsageStatus? status, Dictionary serializedAdditionalRawData) { Unit = unit; Name = name; @@ -32,6 +39,7 @@ internal ServiceAccountUsage(ServiceAccountUsageUnitType? unit, ServiceAccountUs CurrentValue = currentValue; NextResetTime = nextResetTime; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unit of the metric. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.Serialization.cs index c4f8fc2e58bb..39ccfa1880b1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - internal partial class ServiceAccountUsageListResult + internal partial class ServiceAccountUsageListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountUsageListResult DeserializeServiceAccountUsageListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountUsageListResult DeserializeServiceAccountUsageListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -42,8 +92,61 @@ internal static ServiceAccountUsageListResult DeserializeServiceAccountUsageList value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAccountUsageListResult(nextLink.Value, Optional.ToList(value)); + return new ServiceAccountUsageListResult(nextLink.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ServiceAccountUsageListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountUsageListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountUsageListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountUsageListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountUsageListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountUsageListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountUsageListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.cs index dac65ba0fe71..a5e8acee8592 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The response to a list usage request. internal partial class ServiceAccountUsageListResult { - /// Initializes a new instance of ServiceAccountUsageListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountUsageListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServiceAccountUsageListResult. + /// Initializes a new instance of . /// The link used to get the next page of Usages. /// The list of usages for Cognitive Service account. - internal ServiceAccountUsageListResult(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountUsageListResult(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link used to get the next page of Usages. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.Serialization.cs index 992b9a1f302f..a391d1ffecfa 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountUsageMetricName + public partial class ServiceAccountUsageMetricName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServiceAccountUsageMetricName DeserializeServiceAccountUsageMetricName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServiceAccountUsageMetricName DeserializeServiceAccountUsageMetricName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional localizedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +71,61 @@ internal static ServiceAccountUsageMetricName DeserializeServiceAccountUsageMetr localizedValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServiceAccountUsageMetricName(value.Value, localizedValue.Value); + return new ServiceAccountUsageMetricName(value.Value, localizedValue.Value, serializedAdditionalRawData); + } + + ServiceAccountUsageMetricName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountUsageMetricName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountUsageMetricName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountUsageMetricName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountUsageMetricName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountUsageMetricName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountUsageMetricName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.cs index 9bad67383a54..f1dc3362b108 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUsageMetricName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CognitiveServices.Models { /// A metric name. public partial class ServiceAccountUsageMetricName { - /// Initializes a new instance of ServiceAccountUsageMetricName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServiceAccountUsageMetricName() { } - /// Initializes a new instance of ServiceAccountUsageMetricName. + /// Initializes a new instance of . /// The name of the metric. /// The friendly name of the metric. - internal ServiceAccountUsageMetricName(string value, string localizedValue) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountUsageMetricName(string value, string localizedValue, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the metric. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.Serialization.cs index 8b29b1453395..bf900a052111 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class ServiceAccountUserOwnedStorage : IUtf8JsonSerializable + public partial class ServiceAccountUserOwnedStorage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identityClientId"u8); writer.WriteStringValue(IdentityClientId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServiceAccountUserOwnedStorage DeserializeServiceAccountUserOwnedStorage(JsonElement element) + internal static ServiceAccountUserOwnedStorage DeserializeServiceAccountUserOwnedStorage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceId = default; Optional identityClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -57,8 +79,61 @@ internal static ServiceAccountUserOwnedStorage DeserializeServiceAccountUserOwne identityClientId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServiceAccountUserOwnedStorage(resourceId.Value, Optional.ToNullable(identityClientId), serializedAdditionalRawData); + } + + ServiceAccountUserOwnedStorage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceAccountUserOwnedStorage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceAccountUserOwnedStorage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceAccountUserOwnedStorage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceAccountUserOwnedStorage model) + { + if (model is null) + { + return null; } - return new ServiceAccountUserOwnedStorage(resourceId.Value, Optional.ToNullable(identityClientId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceAccountUserOwnedStorage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceAccountUserOwnedStorage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.cs index ed92a86f70b8..a02f934dfb8b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountUserOwnedStorage.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models @@ -13,18 +14,23 @@ namespace Azure.ResourceManager.CognitiveServices.Models /// The user owned storage for Cognitive Services account. public partial class ServiceAccountUserOwnedStorage { - /// Initializes a new instance of ServiceAccountUserOwnedStorage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServiceAccountUserOwnedStorage() { } - /// Initializes a new instance of ServiceAccountUserOwnedStorage. + /// Initializes a new instance of . /// Full resource id of a Microsoft.Storage resource. /// - internal ServiceAccountUserOwnedStorage(ResourceIdentifier resourceId, Guid? identityClientId) + /// Keeps track of any properties unknown to the library. + internal ServiceAccountUserOwnedStorage(ResourceIdentifier resourceId, Guid? identityClientId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; IdentityClientId = identityClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Full resource id of a Microsoft.Storage resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs index 194a1dcd654a..aa5c61e2666c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -134,9 +132,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -586,9 +582,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs index ef63b1106292..af1ea22eafff 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs @@ -53,9 +53,7 @@ internal HttpMessage CreateCheckSkuAvailabilityRequest(string subscriptionId, Az request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -130,9 +128,7 @@ internal HttpMessage CreateCheckDomainAvailabilityRequest(string subscriptionId, request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs index 911469321d88..e0cbd01c925c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -393,9 +391,7 @@ internal HttpMessage CreateCreateOrUpdatePlanRequest(string subscriptionId, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -471,9 +467,7 @@ internal HttpMessage CreateUpdatePlanRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -1012,9 +1006,7 @@ internal HttpMessage CreateCreateOrUpdateAssociationRequest(string subscriptionI request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs index d3588381b65b..111a1aa796bf 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/AlphaIdsRestClient.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/AlphaIdsRestClient.cs index dae9ab933683..f12b3441ed26 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/AlphaIdsRestClient.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/AlphaIdsRestClient.cs @@ -106,9 +106,7 @@ internal HttpMessage CreateUpsertConfigurationRequest(bool enabled) request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); var model = new AlphaIdConfiguration(enabled); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.Serialization.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.Serialization.cs index 148ef8b4cb92..25c4263042ad 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.Serialization.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.AlphaIds.Models { - public partial class AlphaIdConfiguration : IUtf8JsonSerializable + public partial class AlphaIdConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(Enabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlphaIdConfiguration DeserializeAlphaIdConfiguration(JsonElement element) + internal static AlphaIdConfiguration DeserializeAlphaIdConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } bool enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -34,8 +57,61 @@ internal static AlphaIdConfiguration DeserializeAlphaIdConfiguration(JsonElement enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlphaIdConfiguration(enabled, serializedAdditionalRawData); + } + + AlphaIdConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlphaIdConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlphaIdConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlphaIdConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlphaIdConfiguration model) + { + if (model is null) + { + return null; } - return new AlphaIdConfiguration(enabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlphaIdConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlphaIdConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.cs index 5a343cfb1fe0..7413fae60bbb 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/AlphaIdConfiguration.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.AlphaIds.Models { /// @@ -15,13 +18,30 @@ namespace Azure.Communication.AlphaIds.Models /// public partial class AlphaIdConfiguration { - /// Initializes a new instance of AlphaIdConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicates whether the use of Alpha IDs is supported for a specific resource. public AlphaIdConfiguration(bool enabled) { Enabled = enabled; } + /// Initializes a new instance of . + /// Indicates whether the use of Alpha IDs is supported for a specific resource. + /// Keeps track of any properties unknown to the library. + internal AlphaIdConfiguration(bool enabled, Dictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AlphaIdConfiguration() + { + } + /// Indicates whether the use of Alpha IDs is supported for a specific resource. public bool Enabled { get; set; } } diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.Serialization.cs index a72c0838b20a..71930e03297c 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.AlphaIds.Models { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.cs index 06f62a216c1e..e2cba4b411d1 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.AlphaIds.Models /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 69feee0b28af..4990346be0fb 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.AlphaIds.Models { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.cs index d1450777ba05..3afdd7ee80a4 100644 --- a/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.AlphaIds/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.AlphaIds.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.AlphaIds.Models /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs index 838300cdcc4f..ead530fb3a9c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateCreateCallRequest(CreateCallRequestInternal createCal request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(createCallRequest); - request.Content = content; + request.Content = createCallRequest; return message; } @@ -126,9 +124,7 @@ internal HttpMessage CreateAnswerCallRequest(AnswerCallRequestInternal answerCal request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(answerCallRequest); - request.Content = content; + request.Content = answerCallRequest; return message; } @@ -202,9 +198,7 @@ internal HttpMessage CreateRedirectCallRequest(RedirectCallRequestInternal redir request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(redirectCallRequest); - request.Content = content; + request.Content = redirectCallRequest; return message; } @@ -266,9 +260,7 @@ internal HttpMessage CreateRejectCallRequest(RejectCallRequestInternal rejectCal request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(rejectCallRequest); - request.Content = content; + request.Content = rejectCallRequest; return message; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs index e6a809669073..92c38843eb61 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs @@ -244,9 +244,7 @@ internal HttpMessage CreateTransferToParticipantRequest(string callConnectionId, request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(transferToParticipantRequest); - request.Content = content; + request.Content = transferToParticipantRequest; return message; } @@ -400,9 +398,7 @@ internal HttpMessage CreateAddParticipantRequest(string callConnectionId, AddPar request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(addParticipantRequest); - request.Content = content; + request.Content = addParticipantRequest; return message; } @@ -486,9 +482,7 @@ internal HttpMessage CreateRemoveParticipantRequest(string callConnectionId, Rem request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(removeParticipantRequest); - request.Content = content; + request.Content = removeParticipantRequest; return message; } @@ -572,9 +566,7 @@ internal HttpMessage CreateMuteRequest(string callConnectionId, MuteParticipants request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(muteParticipantsRequest); - request.Content = content; + request.Content = muteParticipantsRequest; return message; } @@ -658,9 +650,7 @@ internal HttpMessage CreateUnmuteRequest(string callConnectionId, UnmuteParticip request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(unmuteParticipantsRequest); - request.Content = content; + request.Content = unmuteParticipantsRequest; return message; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs index 1477cd8f3553..5690d8f72726 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs @@ -53,9 +53,7 @@ internal HttpMessage CreateStartDialogRequest(string callConnectionId, string di request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(startDialogRequest); - request.Content = content; + request.Content = startDialogRequest; return message; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs index c518ab9f4cf0..a24e642d1f88 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs @@ -51,9 +51,7 @@ internal HttpMessage CreatePlayRequest(string callConnectionId, PlayRequestInter request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(playRequest); - request.Content = content; + request.Content = playRequest; return message; } @@ -185,9 +183,7 @@ internal HttpMessage CreateRecognizeRequest(string callConnectionId, RecognizeRe request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(recognizeRequest); - request.Content = content; + request.Content = recognizeRequest; return message; } @@ -259,9 +255,7 @@ internal HttpMessage CreateStartContinuousDtmfRecognitionRequest(string callConn request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(continuousDtmfRecognitionRequest); - request.Content = content; + request.Content = continuousDtmfRecognitionRequest; return message; } @@ -333,9 +327,7 @@ internal HttpMessage CreateStopContinuousDtmfRecognitionRequest(string callConne request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(continuousDtmfRecognitionRequest); - request.Content = content; + request.Content = continuousDtmfRecognitionRequest; return message; } @@ -407,9 +399,7 @@ internal HttpMessage CreateSendDtmfRequest(string callConnectionId, SendDtmfRequ request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sendDtmfRequest); - request.Content = content; + request.Content = sendDtmfRequest; return message; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs index 90fcfad75f0f..251585154af1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateStartRecordingRequest(StartCallRecordingRequestIntern request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(startCallRecording); - request.Content = content; + request.Content = startCallRecording; return message; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs index 8fb755f5d335..a5cbcbb0dca9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs @@ -14,50 +14,50 @@ namespace Azure.Communication.CallAutomation /// Model factory for models. public static partial class CommunicationCallAutomationModelFactory { - /// Initializes a new instance of TransferCallToParticipantResult. + /// Initializes a new instance of . /// The operation context provided by client. /// A new instance for mocking. public static TransferCallToParticipantResult TransferCallToParticipantResult(string operationContext = null) { - return new TransferCallToParticipantResult(operationContext); + return new TransferCallToParticipantResult(operationContext, default); } - /// Initializes a new instance of MuteParticipantsResult. + /// Initializes a new instance of . /// The operation context provided by client. /// A new instance for mocking. public static MuteParticipantsResult MuteParticipantsResult(string operationContext = null) { - return new MuteParticipantsResult(operationContext); + return new MuteParticipantsResult(operationContext, default); } - /// Initializes a new instance of UnmuteParticipantsResult. + /// Initializes a new instance of . /// The operation context provided by client. /// A new instance for mocking. public static UnmuteParticipantsResult UnmuteParticipantsResult(string operationContext = null) { - return new UnmuteParticipantsResult(operationContext); + return new UnmuteParticipantsResult(operationContext, default); } - /// Initializes a new instance of RecordingStateResult. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static RecordingStateResult RecordingStateResult(string recordingId = null, RecordingState? recordingState = null) { - return new RecordingStateResult(recordingId, recordingState); + return new RecordingStateResult(recordingId, recordingState, default); } - /// Initializes a new instance of ResultInformation. + /// Initializes a new instance of . /// Code of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. /// Subcode of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. /// Detail message that describes the current result. /// A new instance for mocking. public static ResultInformation ResultInformation(int? code = null, int? subCode = null, string message = null) { - return new ResultInformation(code, subCode, message); + return new ResultInformation(code, subCode, message, default); } - /// Initializes a new instance of CallConnected. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -65,10 +65,10 @@ public static ResultInformation ResultInformation(int? code = null, int? subCode /// A new instance for mocking. public static CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { - return new CallConnected(callConnectionId, serverCallId, correlationId, operationContext); + return new CallConnected(callConnectionId, serverCallId, correlationId, operationContext, default); } - /// Initializes a new instance of CallDisconnected. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -76,10 +76,10 @@ public static CallConnected CallConnected(string callConnectionId = null, string /// A new instance for mocking. public static CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { - return new CallDisconnected(callConnectionId, serverCallId, correlationId, operationContext); + return new CallDisconnected(callConnectionId, serverCallId, correlationId, operationContext, default); } - /// Initializes a new instance of CallTransferFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -88,10 +88,10 @@ public static CallDisconnected CallDisconnected(string callConnectionId = null, /// A new instance for mocking. public static CallTransferFailed CallTransferFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new CallTransferFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new CallTransferFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } - /// Initializes a new instance of RecordingStateChanged. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -101,10 +101,10 @@ public static CallTransferFailed CallTransferFailed(string callConnectionId = nu /// A new instance for mocking. public static RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, RecordingState state = default, DateTimeOffset? startDateTime = null) { - return new RecordingStateChanged(callConnectionId, serverCallId, correlationId, recordingId, state, startDateTime); + return new RecordingStateChanged(callConnectionId, serverCallId, correlationId, recordingId, state, startDateTime, default); } - /// Initializes a new instance of PlayCompleted. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -113,10 +113,10 @@ public static RecordingStateChanged RecordingStateChanged(string callConnectionI /// A new instance for mocking. public static PlayCompleted PlayCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new PlayCompleted(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new PlayCompleted(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } - /// Initializes a new instance of PlayFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -125,10 +125,10 @@ public static PlayCompleted PlayCompleted(string callConnectionId = null, string /// A new instance for mocking. public static PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new PlayFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new PlayFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } - /// Initializes a new instance of PlayCanceled. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -136,30 +136,30 @@ public static PlayFailed PlayFailed(string callConnectionId = null, string serve /// A new instance for mocking. public static PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { - return new PlayCanceled(callConnectionId, serverCallId, correlationId, operationContext); + return new PlayCanceled(callConnectionId, serverCallId, correlationId, operationContext, default); } - /// Initializes a new instance of CollectTonesResult. + /// Initializes a new instance of . /// /// A new instance for mocking. public static CollectTonesResult CollectTonesResult(IEnumerable tones = null) { tones ??= new List(); - return new CollectTonesResult(tones?.ToList()); + return new CollectTonesResult(tones?.ToList(), default); } - /// Initializes a new instance of DtmfResult. + /// Initializes a new instance of . /// /// A new instance for mocking. public static DtmfResult DtmfResult(IEnumerable tones = null) { tones ??= new List(); - return new DtmfResult(tones?.ToList()); + return new DtmfResult(tones?.ToList(), default); } - /// Initializes a new instance of ChoiceResult. + /// Initializes a new instance of . /// Label is the primary identifier for the choice detected. /// /// Phrases are set to the value if choice is selected via phrase detection. @@ -168,18 +168,18 @@ public static DtmfResult DtmfResult(IEnumerable tones = null) /// A new instance for mocking. public static ChoiceResult ChoiceResult(string label = null, string recognizedPhrase = null) { - return new ChoiceResult(label, recognizedPhrase); + return new ChoiceResult(label, recognizedPhrase, default); } - /// Initializes a new instance of SpeechResult. + /// Initializes a new instance of . /// The recognized speech in string. /// A new instance for mocking. public static SpeechResult SpeechResult(string speech = null) { - return new SpeechResult(speech); + return new SpeechResult(speech, default); } - /// Initializes a new instance of RecognizeFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -188,10 +188,10 @@ public static SpeechResult SpeechResult(string speech = null) /// A new instance for mocking. public static RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new RecognizeFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new RecognizeFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } - /// Initializes a new instance of RecognizeCanceled. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -199,18 +199,18 @@ public static RecognizeFailed RecognizeFailed(string callConnectionId = null, st /// A new instance for mocking. public static RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { - return new RecognizeCanceled(callConnectionId, serverCallId, correlationId, operationContext); + return new RecognizeCanceled(callConnectionId, serverCallId, correlationId, operationContext, default); } - /// Initializes a new instance of UserConsent. + /// Initializes a new instance of . /// /// A new instance for mocking. public static UserConsent UserConsent(int? recording = null) { - return new UserConsent(recording); + return new UserConsent(recording, default); } - /// Initializes a new instance of ContinuousDtmfRecognitionToneFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -219,10 +219,10 @@ public static UserConsent UserConsent(int? recording = null) /// A new instance for mocking. public static ContinuousDtmfRecognitionToneFailed ContinuousDtmfRecognitionToneFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, ResultInformation resultInformation = null, string operationContext = null) { - return new ContinuousDtmfRecognitionToneFailed(callConnectionId, serverCallId, correlationId, resultInformation, operationContext); + return new ContinuousDtmfRecognitionToneFailed(callConnectionId, serverCallId, correlationId, resultInformation, operationContext, default); } - /// Initializes a new instance of ContinuousDtmfRecognitionToneReceived. + /// Initializes a new instance of . /// Information about Tone. /// Call connection ID. /// Server call ID. @@ -232,19 +232,19 @@ public static ContinuousDtmfRecognitionToneFailed ContinuousDtmfRecognitionToneF /// A new instance for mocking. public static ContinuousDtmfRecognitionToneReceived ContinuousDtmfRecognitionToneReceived(ToneInfo toneInfo = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, ResultInformation resultInformation = null, string operationContext = null) { - return new ContinuousDtmfRecognitionToneReceived(toneInfo, callConnectionId, serverCallId, correlationId, resultInformation, operationContext); + return new ContinuousDtmfRecognitionToneReceived(toneInfo, callConnectionId, serverCallId, correlationId, resultInformation, operationContext, default); } - /// Initializes a new instance of ToneInfo. + /// Initializes a new instance of . /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. /// /// A new instance for mocking. public static ToneInfo ToneInfo(int sequenceId = default, DtmfTone tone = default) { - return new ToneInfo(sequenceId, tone); + return new ToneInfo(sequenceId, tone, default); } - /// Initializes a new instance of ContinuousDtmfRecognitionStopped. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -253,10 +253,10 @@ public static ToneInfo ToneInfo(int sequenceId = default, DtmfTone tone = defaul /// A new instance for mocking. public static ContinuousDtmfRecognitionStopped ContinuousDtmfRecognitionStopped(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new ContinuousDtmfRecognitionStopped(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new ContinuousDtmfRecognitionStopped(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } - /// Initializes a new instance of SendDtmfCompleted. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -265,10 +265,10 @@ public static ContinuousDtmfRecognitionStopped ContinuousDtmfRecognitionStopped( /// A new instance for mocking. public static SendDtmfCompleted SendDtmfCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new SendDtmfCompleted(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new SendDtmfCompleted(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } - /// Initializes a new instance of SendDtmfFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -277,7 +277,7 @@ public static SendDtmfCompleted SendDtmfCompleted(string callConnectionId = null /// A new instance for mocking. public static SendDtmfFailed SendDtmfFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new SendDtmfFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new SendDtmfFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, default); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs index 2f478294bfcb..6fd2ef795907 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs @@ -5,16 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class AddParticipantFailedInternal + internal partial class AddParticipantFailedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddParticipantFailedInternal DeserializeAddParticipantFailedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(Participant)) + { + writer.WritePropertyName("participant"u8); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddParticipantFailedInternal DeserializeAddParticipantFailedInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +97,7 @@ internal static AddParticipantFailedInternal DeserializeAddParticipantFailedInte Optional operationContext = default; Optional resultInformation = default; Optional participant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -65,8 +138,61 @@ internal static AddParticipantFailedInternal DeserializeAddParticipantFailedInte participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddParticipantFailedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value); + return new AddParticipantFailedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value, serializedAdditionalRawData); + } + + AddParticipantFailedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantFailedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantFailedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantFailedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantFailedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantFailedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantFailedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs index cb5f2081fc56..bdef3c396a84 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallAutomation @@ -12,19 +14,23 @@ namespace Azure.Communication.CallAutomation /// The failed to add participant event. internal partial class AddParticipantFailedInternal { - /// Initializes a new instance of AddParticipantFailedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddParticipantFailedInternal() { } - /// Initializes a new instance of AddParticipantFailedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code/sub-code and message from NGC services. /// Participant. - internal AddParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) + /// Keeps track of any properties unknown to the library. + internal AddParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -32,6 +38,7 @@ internal AddParticipantFailedInternal(string callConnectionId, string serverCall OperationContext = operationContext; ResultInformation = resultInformation; Participant = participant; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs index 1247be0dccd2..48b4192123fb 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs @@ -5,20 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class AddParticipantRequestInternal : IUtf8JsonSerializable + internal partial class AddParticipantRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceCallerIdNumber)) { writer.WritePropertyName("sourceCallerIdNumber"u8); - writer.WriteObjectValue(SourceCallerIdNumber); + if (SourceCallerIdNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceCallerIdNumber).Serialize(writer, options); + } } if (Optional.IsDefined(SourceDisplayName)) { @@ -26,7 +42,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SourceDisplayName); } writer.WritePropertyName("participantToAdd"u8); - writer.WriteObjectValue(ParticipantToAdd); + if (ParticipantToAdd is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ParticipantToAdd).Serialize(writer, options); + } if (Optional.IsDefined(InvitationTimeoutInSeconds)) { writer.WritePropertyName("invitationTimeoutInSeconds"u8); @@ -40,14 +63,155 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CustomContext)) { writer.WritePropertyName("customContext"u8); - writer.WriteObjectValue(CustomContext); + if (CustomContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomContext).Serialize(writer, options); + } } if (Optional.IsDefined(CallbackUri)) { writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AddParticipantRequestInternal DeserializeAddParticipantRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sourceCallerIdNumber = default; + Optional sourceDisplayName = default; + CommunicationIdentifierModel participantToAdd = default; + Optional invitationTimeoutInSeconds = default; + Optional operationContext = default; + Optional customContext = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceCallerIdNumber"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceCallerIdNumber = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("sourceDisplayName"u8)) + { + sourceDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("participantToAdd"u8)) + { + participantToAdd = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("invitationTimeoutInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + invitationTimeoutInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("customContext"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customContext = CustomContextInternal.DeserializeCustomContextInternal(property.Value); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddParticipantRequestInternal(sourceCallerIdNumber.Value, sourceDisplayName.Value, participantToAdd, Optional.ToNullable(invitationTimeoutInSeconds), operationContext.Value, customContext.Value, callbackUri.Value, serializedAdditionalRawData); + } + + AddParticipantRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs index 5953ac8580db..cf6bf5a51e78 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for adding participant to the call. internal partial class AddParticipantRequestInternal { - /// Initializes a new instance of AddParticipantRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The participant to invite. /// is null. public AddParticipantRequestInternal(CommunicationIdentifierModel participantToAdd) @@ -24,6 +28,41 @@ public AddParticipantRequestInternal(CommunicationIdentifierModel participantToA ParticipantToAdd = participantToAdd; } + /// Initializes a new instance of . + /// + /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. + /// Required only when inviting a PSTN participant. + /// + /// + /// (Optional) The display name of the source that is associated with this invite operation when + /// adding a PSTN participant or teams user. Note: Will not update the display name in the roster. + /// + /// The participant to invite. + /// + /// Gets or sets the timeout to wait for the invited participant to pickup. + /// The maximum value of this is 180 seconds + /// + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Used by customer to send custom context to targets. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal AddParticipantRequestInternal(PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel participantToAdd, int? invitationTimeoutInSeconds, string operationContext, CustomContextInternal customContext, string callbackUri, Dictionary serializedAdditionalRawData) + { + SourceCallerIdNumber = sourceCallerIdNumber; + SourceDisplayName = sourceDisplayName; + ParticipantToAdd = participantToAdd; + InvitationTimeoutInSeconds = invitationTimeoutInSeconds; + OperationContext = operationContext; + CustomContext = customContext; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AddParticipantRequestInternal() + { + } + /// /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. /// Required only when inviting a PSTN participant. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.Serialization.cs index a56c0df43ad3..474dc0415a5e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class AddParticipantResponseInternal + internal partial class AddParticipantResponseInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddParticipantResponseInternal DeserializeAddParticipantResponseInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Participant)) + { + writer.WritePropertyName("participant"u8); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddParticipantResponseInternal DeserializeAddParticipantResponseInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional participant = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("participant"u8)) @@ -36,8 +82,61 @@ internal static AddParticipantResponseInternal DeserializeAddParticipantResponse operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddParticipantResponseInternal(participant.Value, operationContext.Value); + return new AddParticipantResponseInternal(participant.Value, operationContext.Value, serializedAdditionalRawData); + } + + AddParticipantResponseInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantResponseInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantResponseInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantResponseInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantResponseInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantResponseInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantResponseInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.cs index 2c7c3242a9c1..e00cee306130 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantResponseInternal.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The response payload for adding participants to the call. internal partial class AddParticipantResponseInternal { - /// Initializes a new instance of AddParticipantResponseInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddParticipantResponseInternal() { } - /// Initializes a new instance of AddParticipantResponseInternal. + /// Initializes a new instance of . /// List of current participants in the call. /// The operation context provided by client. - internal AddParticipantResponseInternal(CallParticipantInternal participant, string operationContext) + /// Keeps track of any properties unknown to the library. + internal AddParticipantResponseInternal(CallParticipantInternal participant, string operationContext, Dictionary serializedAdditionalRawData) { Participant = participant; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of current participants in the call. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs index df4d009a905e..a0fc03cd0f15 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs @@ -5,16 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class AddParticipantSucceededInternal + internal partial class AddParticipantSucceededInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddParticipantSucceededInternal DeserializeAddParticipantSucceededInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(Participant)) + { + writer.WritePropertyName("participant"u8); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddParticipantSucceededInternal DeserializeAddParticipantSucceededInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +97,7 @@ internal static AddParticipantSucceededInternal DeserializeAddParticipantSucceed Optional operationContext = default; Optional resultInformation = default; Optional participant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -65,8 +138,61 @@ internal static AddParticipantSucceededInternal DeserializeAddParticipantSucceed participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddParticipantSucceededInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value); + return new AddParticipantSucceededInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value, serializedAdditionalRawData); + } + + AddParticipantSucceededInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantSucceededInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantSucceededInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantSucceededInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantSucceededInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantSucceededInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantSucceededInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs index 16ced7486b88..6629c357fac6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallAutomation @@ -12,19 +14,23 @@ namespace Azure.Communication.CallAutomation /// The participant successfully added event. internal partial class AddParticipantSucceededInternal { - /// Initializes a new instance of AddParticipantSucceededInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddParticipantSucceededInternal() { } - /// Initializes a new instance of AddParticipantSucceededInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code/sub-code and message from NGC services. /// Participant. - internal AddParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) + /// Keeps track of any properties unknown to the library. + internal AddParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -32,6 +38,7 @@ internal AddParticipantSucceededInternal(string callConnectionId, string serverC OperationContext = operationContext; ResultInformation = resultInformation; Participant = participant; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs index 2687ff70177a..502665c4541a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class AnswerCallRequestInternal : IUtf8JsonSerializable + internal partial class AnswerCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("incomingCallContext"u8); writer.WriteStringValue(IncomingCallContext); @@ -27,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MediaStreamingConfiguration)) { writer.WritePropertyName("mediaStreamingConfiguration"u8); - writer.WriteObjectValue(MediaStreamingConfiguration); + if (MediaStreamingConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MediaStreamingConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(AzureCognitiveServicesEndpointUrl)) { @@ -37,9 +53,140 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AnsweredByIdentifier)) { writer.WritePropertyName("answeredByIdentifier"u8); - writer.WriteObjectValue(AnsweredByIdentifier); + if (AnsweredByIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnsweredByIdentifier).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static AnswerCallRequestInternal DeserializeAnswerCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string incomingCallContext = default; + string callbackUri = default; + Optional operationContext = default; + Optional mediaStreamingConfiguration = default; + Optional azureCognitiveServicesEndpointUrl = default; + Optional answeredByIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("incomingCallContext"u8)) + { + incomingCallContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaStreamingConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mediaStreamingConfiguration = MediaStreamingOptionsInternal.DeserializeMediaStreamingOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("azureCognitiveServicesEndpointUrl"u8)) + { + azureCognitiveServicesEndpointUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("answeredByIdentifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + answeredByIdentifier = CommunicationUserIdentifierModel.DeserializeCommunicationUserIdentifierModel(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnswerCallRequestInternal(incomingCallContext, callbackUri, operationContext.Value, mediaStreamingConfiguration.Value, azureCognitiveServicesEndpointUrl.Value, answeredByIdentifier.Value, serializedAdditionalRawData); + } + + AnswerCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswerCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswerCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswerCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswerCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswerCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswerCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs index 52a98a9d01f2..a9f52898b83d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for answering the call. internal partial class AnswerCallRequestInternal { - /// Initializes a new instance of AnswerCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The context associated with the call. /// The callback uri. /// or is null. @@ -27,6 +31,30 @@ public AnswerCallRequestInternal(string incomingCallContext, string callbackUri) CallbackUri = callbackUri; } + /// Initializes a new instance of . + /// The context associated with the call. + /// The callback uri. + /// A customer set value used to track the answering of a call. + /// Media Streaming Configuration. + /// The endpoint URL of the Azure Cognitive Services resource attached. + /// The identifier of the call automation entity which answers the call. + /// Keeps track of any properties unknown to the library. + internal AnswerCallRequestInternal(string incomingCallContext, string callbackUri, string operationContext, MediaStreamingOptionsInternal mediaStreamingConfiguration, string azureCognitiveServicesEndpointUrl, CommunicationUserIdentifierModel answeredByIdentifier, Dictionary serializedAdditionalRawData) + { + IncomingCallContext = incomingCallContext; + CallbackUri = callbackUri; + OperationContext = operationContext; + MediaStreamingConfiguration = mediaStreamingConfiguration; + AzureCognitiveServicesEndpointUrl = azureCognitiveServicesEndpointUrl; + AnsweredByIdentifier = answeredByIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnswerCallRequestInternal() + { + } + /// The context associated with the call. public string IncomingCallContext { get; } /// The callback uri. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.Serialization.cs index ebe44d96f602..f716ab2dba65 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class BlobStorageInternal : IUtf8JsonSerializable + internal partial class BlobStorageInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("containerUri"u8); writer.WriteStringValue(ContainerUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BlobStorageInternal DeserializeBlobStorageInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string containerUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("containerUri"u8)) + { + containerUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BlobStorageInternal(containerUri, serializedAdditionalRawData); + } + + BlobStorageInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBlobStorageInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BlobStorageInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBlobStorageInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BlobStorageInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BlobStorageInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBlobStorageInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.cs index bc445e794727..4d63d8e7ff7c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/BlobStorageInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// Used to specify Blob container url to recording storage. internal partial class BlobStorageInternal { - /// Initializes a new instance of BlobStorageInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Url of a container or a location within a container. /// is null. public BlobStorageInternal(string containerUri) @@ -23,6 +27,20 @@ public BlobStorageInternal(string containerUri) ContainerUri = containerUri; } + /// Initializes a new instance of . + /// Url of a container or a location within a container. + /// Keeps track of any properties unknown to the library. + internal BlobStorageInternal(string containerUri, Dictionary serializedAdditionalRawData) + { + ContainerUri = containerUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BlobStorageInternal() + { + } + /// Url of a container or a location within a container. public string ContainerUri { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs index 57dec5b5a2c7..169bbe65bbc4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class CallConnected + public partial class CallConnected : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallConnected DeserializeCallConnected(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallConnected DeserializeCallConnected(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static CallConnected DeserializeCallConnected(JsonElement element) Optional serverCallId = default; Optional correlationId = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -44,8 +93,61 @@ internal static CallConnected DeserializeCallConnected(JsonElement element) operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallConnected(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value); + return new CallConnected(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, serializedAdditionalRawData); + } + + CallConnected IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallConnected(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallConnected IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallConnected(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallConnected model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallConnected(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallConnected(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs index 666e9bf954c8..b358d0f11faf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The call connected event. public partial class CallConnected { - /// Initializes a new instance of CallConnected. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallConnected() { } - /// Initializes a new instance of CallConnected. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers to set the context for creating a new call. This property will be null for answering a call. - internal CallConnected(string callConnectionId, string serverCallId, string correlationId, string operationContext) + /// Keeps track of any properties unknown to the library. + internal CallConnected(string callConnectionId, string serverCallId, string correlationId, string operationContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs index c423598401c6..30519233c4d3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs @@ -5,17 +5,132 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CallConnectionPropertiesInternal + internal partial class CallConnectionPropertiesInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallConnectionPropertiesInternal DeserializeCallConnectionPropertiesInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsCollectionDefined(Targets)) + { + writer.WritePropertyName("targets"u8); + writer.WriteStartArray(); + foreach (var item in Targets) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(CallConnectionState)) + { + writer.WritePropertyName("callConnectionState"u8); + writer.WriteStringValue(CallConnectionState.Value.ToString()); + } + if (Optional.IsDefined(CallbackUri)) + { + writer.WritePropertyName("callbackUri"u8); + writer.WriteStringValue(CallbackUri); + } + if (Optional.IsDefined(MediaSubscriptionId)) + { + writer.WritePropertyName("mediaSubscriptionId"u8); + writer.WriteStringValue(MediaSubscriptionId); + } + if (Optional.IsDefined(SourceCallerIdNumber)) + { + writer.WritePropertyName("sourceCallerIdNumber"u8); + if (SourceCallerIdNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceCallerIdNumber).Serialize(writer, options); + } + } + if (Optional.IsDefined(SourceDisplayName)) + { + writer.WritePropertyName("sourceDisplayName"u8); + writer.WriteStringValue(SourceDisplayName); + } + if (Optional.IsDefined(SourceIdentity)) + { + writer.WritePropertyName("sourceIdentity"u8); + if (SourceIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceIdentity).Serialize(writer, options); + } + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(AnsweredByIdentifier)) + { + writer.WritePropertyName("answeredByIdentifier"u8); + if (AnsweredByIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnsweredByIdentifier).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallConnectionPropertiesInternal DeserializeCallConnectionPropertiesInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +146,7 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper Optional sourceIdentity = default; Optional correlationId = default; Optional answeredByIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -113,8 +229,61 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper answeredByIdentifier = CommunicationUserIdentifierModel.DeserializeCommunicationUserIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), callbackUri.Value, mediaSubscriptionId.Value, sourceCallerIdNumber.Value, sourceDisplayName.Value, sourceIdentity.Value, correlationId.Value, answeredByIdentifier.Value); + return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), callbackUri.Value, mediaSubscriptionId.Value, sourceCallerIdNumber.Value, sourceDisplayName.Value, sourceIdentity.Value, correlationId.Value, answeredByIdentifier.Value, serializedAdditionalRawData); + } + + CallConnectionPropertiesInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallConnectionPropertiesInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallConnectionPropertiesInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallConnectionPropertiesInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallConnectionPropertiesInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallConnectionPropertiesInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallConnectionPropertiesInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs index 923217d55125..fc9b2804de72 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.Communication.CallAutomation /// Properties of a call connection. internal partial class CallConnectionPropertiesInternal { - /// Initializes a new instance of CallConnectionPropertiesInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallConnectionPropertiesInternal() { Targets = new ChangeTrackingList(); } - /// Initializes a new instance of CallConnectionPropertiesInternal. + /// Initializes a new instance of . /// The call connection id. /// The server call id. /// The targets of the call. @@ -35,7 +39,8 @@ internal CallConnectionPropertiesInternal() /// Source identity. /// The correlation ID. /// Identity of the answering entity. Only populated when identity is provided in the request. - internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel sourceIdentity, string correlationId, CommunicationUserIdentifierModel answeredByIdentifier) + /// Keeps track of any properties unknown to the library. + internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel sourceIdentity, string correlationId, CommunicationUserIdentifierModel answeredByIdentifier, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -48,6 +53,7 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server SourceIdentity = sourceIdentity; CorrelationId = correlationId; AnsweredByIdentifier = answeredByIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The call connection id. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs index 5a67cf4d308d..465543d75473 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class CallDisconnected + public partial class CallDisconnected : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallDisconnected DeserializeCallDisconnected(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallDisconnected DeserializeCallDisconnected(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static CallDisconnected DeserializeCallDisconnected(JsonElement element Optional serverCallId = default; Optional correlationId = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -44,8 +93,61 @@ internal static CallDisconnected DeserializeCallDisconnected(JsonElement element operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallDisconnected(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value); + return new CallDisconnected(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, serializedAdditionalRawData); + } + + CallDisconnected IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallDisconnected(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallDisconnected IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallDisconnected(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallDisconnected model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallDisconnected(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallDisconnected(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs index a899aa9620ff..2210a0ac1de3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The call disconnected event. public partial class CallDisconnected { - /// Initializes a new instance of CallDisconnected. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallDisconnected() { } - /// Initializes a new instance of CallDisconnected. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers to set the context for creating a new call. This property will be null for answering a call. - internal CallDisconnected(string callConnectionId, string serverCallId, string correlationId, string operationContext) + /// Keeps track of any properties unknown to the library. + internal CallDisconnected(string callConnectionId, string serverCallId, string correlationId, string operationContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs index 555a9924eb6b..80a617359c2d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CallLocatorInternal : IUtf8JsonSerializable + internal partial class CallLocatorInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GroupCallId)) { @@ -30,7 +38,109 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CallLocatorInternal DeserializeCallLocatorInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional groupCallId = default; + Optional serverCallId = default; + Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupCallId"u8)) + { + groupCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new CallLocatorKindInternal(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CallLocatorInternal(groupCallId.Value, serverCallId.Value, Optional.ToNullable(kind), serializedAdditionalRawData); + } + + CallLocatorInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallLocatorInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallLocatorInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallLocatorInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallLocatorInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallLocatorInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallLocatorInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs index 468dd6de64c7..ca01e857a838 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The locator used for joining or taking action on a call. internal partial class CallLocatorInternal { - /// Initializes a new instance of CallLocatorInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CallLocatorInternal() { } + /// Initializes a new instance of . + /// The group call id. + /// The server call id. + /// The call locator kind. + /// Keeps track of any properties unknown to the library. + internal CallLocatorInternal(string groupCallId, string serverCallId, CallLocatorKindInternal? kind, Dictionary serializedAdditionalRawData) + { + GroupCallId = groupCallId; + ServerCallId = serverCallId; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The group call id. public string GroupCallId { get; set; } /// The server call id. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.Serialization.cs index e32ef9fd48ad..29804e5156e9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.Serialization.cs @@ -5,22 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CallParticipantInternal + internal partial class CallParticipantInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallParticipantInternal DeserializeCallParticipantInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } + } + if (Optional.IsDefined(IsMuted)) + { + writer.WritePropertyName("isMuted"u8); + writer.WriteBooleanValue(IsMuted.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallParticipantInternal DeserializeCallParticipantInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional identifier = default; Optional isMuted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identifier"u8)) @@ -41,8 +87,61 @@ internal static CallParticipantInternal DeserializeCallParticipantInternal(JsonE isMuted = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallParticipantInternal(identifier.Value, Optional.ToNullable(isMuted)); + return new CallParticipantInternal(identifier.Value, Optional.ToNullable(isMuted), serializedAdditionalRawData); + } + + CallParticipantInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallParticipantInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallParticipantInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallParticipantInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallParticipantInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallParticipantInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallParticipantInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.cs index 2aeed4397302..f254c9642b76 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallParticipantInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallAutomation @@ -12,18 +14,23 @@ namespace Azure.Communication.CallAutomation /// Contract model of an ACS call participant. internal partial class CallParticipantInternal { - /// Initializes a new instance of CallParticipantInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallParticipantInternal() { } - /// Initializes a new instance of CallParticipantInternal. + /// Initializes a new instance of . /// Communication identifier of the participant. /// Is participant muted. - internal CallParticipantInternal(CommunicationIdentifierModel identifier, bool? isMuted) + /// Keeps track of any properties unknown to the library. + internal CallParticipantInternal(CommunicationIdentifierModel identifier, bool? isMuted, Dictionary serializedAdditionalRawData) { Identifier = identifier; IsMuted = isMuted; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Communication identifier of the participant. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs index f22e31f1c99e..78b8d1f024a2 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs @@ -5,16 +5,76 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CallTransferAcceptedInternal + internal partial class CallTransferAcceptedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallTransferAcceptedInternal DeserializeCallTransferAcceptedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallTransferAcceptedInternal DeserializeCallTransferAcceptedInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +86,7 @@ internal static CallTransferAcceptedInternal DeserializeCallTransferAcceptedInte Optional resultInformation = default; Optional transferTarget = default; Optional transferee = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -75,8 +136,61 @@ internal static CallTransferAcceptedInternal DeserializeCallTransferAcceptedInte transferee = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallTransferAcceptedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, transferTarget.Value, transferee.Value); + return new CallTransferAcceptedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, transferTarget.Value, transferee.Value, serializedAdditionalRawData); + } + + CallTransferAcceptedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallTransferAcceptedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallTransferAcceptedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallTransferAcceptedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallTransferAcceptedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallTransferAcceptedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallTransferAcceptedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs index ccc124e1f54b..f376bcde3cbe 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallAutomation @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation /// The call transfer accepted event. internal partial class CallTransferAcceptedInternal { - /// Initializes a new instance of CallTransferAcceptedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallTransferAcceptedInternal() { } - /// Initializes a new instance of CallTransferAcceptedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -25,7 +30,8 @@ internal CallTransferAcceptedInternal() /// Contains the resulting SIP code/sub-code and message from NGC services. /// Traffer target: the user that transferee will be transferred to. /// Transferee: the participant being transferred away. - internal CallTransferAcceptedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel transferTarget, CommunicationIdentifierModel transferee) + /// Keeps track of any properties unknown to the library. + internal CallTransferAcceptedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel transferTarget, CommunicationIdentifierModel transferee, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -34,6 +40,7 @@ internal CallTransferAcceptedInternal(string callConnectionId, string serverCall ResultInformation = resultInformation; TransferTarget = transferTarget; Transferee = transferee; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs index 7a798dbc9c29..e702367dadfd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class CallTransferFailed + public partial class CallTransferFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement ele Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement ele resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallTransferFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new CallTransferFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + CallTransferFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallTransferFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallTransferFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallTransferFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallTransferFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallTransferFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallTransferFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs index 73c3d3f9a70f..e02d1f47f890 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The call transfer failed event. public partial class CallTransferFailed { - /// Initializes a new instance of CallTransferFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallTransferFailed() { } - /// Initializes a new instance of CallTransferFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code/sub-code and message from NGC services. - internal CallTransferFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + /// Keeps track of any properties unknown to the library. + internal CallTransferFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.Serialization.cs index 5598c8243dd6..1190ffcf1e3d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class ChannelAffinityInternal : IUtf8JsonSerializable + internal partial class ChannelAffinityInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Channel)) { @@ -21,8 +30,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Channel.Value); } writer.WritePropertyName("participant"u8); - writer.WriteObjectValue(Participant); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ChannelAffinityInternal DeserializeChannelAffinityInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional channel = default; + CommunicationIdentifierModel participant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("channel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + channel = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("participant"u8)) + { + participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChannelAffinityInternal(Optional.ToNullable(channel), participant, serializedAdditionalRawData); + } + + ChannelAffinityInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChannelAffinityInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChannelAffinityInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChannelAffinityInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChannelAffinityInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChannelAffinityInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChannelAffinityInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.cs index fc44abaabf54..4f000223a3ee 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChannelAffinityInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// Channel affinity for a participant. internal partial class ChannelAffinityInternal { - /// Initializes a new instance of ChannelAffinityInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// The identifier for the participant whose bitstream will be written to the channel /// represented by the channel number. @@ -27,6 +31,25 @@ public ChannelAffinityInternal(CommunicationIdentifierModel participant) Participant = participant; } + /// Initializes a new instance of . + /// Channel number to which bitstream from a particular participant will be written. + /// + /// The identifier for the participant whose bitstream will be written to the channel + /// represented by the channel number. + /// + /// Keeps track of any properties unknown to the library. + internal ChannelAffinityInternal(int? channel, CommunicationIdentifierModel participant, Dictionary serializedAdditionalRawData) + { + Channel = channel; + Participant = participant; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChannelAffinityInternal() + { + } + /// Channel number to which bitstream from a particular participant will be written. public int? Channel { get; set; } /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.Serialization.cs index 50f18be24e91..56d9407eb4be 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class ChoiceResult + public partial class ChoiceResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChoiceResult DeserializeChoiceResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Label)) + { + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + } + if (Optional.IsDefined(RecognizedPhrase)) + { + writer.WritePropertyName("recognizedPhrase"u8); + writer.WriteStringValue(RecognizedPhrase); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChoiceResult DeserializeChoiceResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional label = default; Optional recognizedPhrase = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("label"u8)) @@ -32,8 +71,61 @@ internal static ChoiceResult DeserializeChoiceResult(JsonElement element) recognizedPhrase = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChoiceResult(label.Value, recognizedPhrase.Value); + return new ChoiceResult(label.Value, recognizedPhrase.Value, serializedAdditionalRawData); + } + + ChoiceResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChoiceResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChoiceResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChoiceResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChoiceResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChoiceResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChoiceResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.cs index 1eb8655ae0b4..959a7a15d8f1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ChoiceResult.cs @@ -5,26 +5,34 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The ChoiceResult. public partial class ChoiceResult { - /// Initializes a new instance of ChoiceResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ChoiceResult() { } - /// Initializes a new instance of ChoiceResult. + /// Initializes a new instance of . /// Label is the primary identifier for the choice detected. /// /// Phrases are set to the value if choice is selected via phrase detection. /// If Dtmf input is recognized, then Label will be the identifier for the choice detected and phrases will be set to null /// - internal ChoiceResult(string label, string recognizedPhrase) + /// Keeps track of any properties unknown to the library. + internal ChoiceResult(string label, string recognizedPhrase, Dictionary serializedAdditionalRawData) { Label = label; RecognizedPhrase = recognizedPhrase; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Label is the primary identifier for the choice detected. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs index 1b0a553c6fac..da50f5baed82 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class CollectTonesResult + public partial class CollectTonesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> tones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tones"u8)) @@ -36,8 +64,61 @@ internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement ele tones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CollectTonesResult(Optional.ToList(tones)); + return new CollectTonesResult(Optional.ToList(tones), serializedAdditionalRawData); + } + + CollectTonesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCollectTonesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CollectTonesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCollectTonesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CollectTonesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CollectTonesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCollectTonesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs index 0bd35b05d5a9..48b884d6dd76 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.Communication.CallAutomation /// The CollectTonesResult. public partial class CollectTonesResult { - /// Initializes a new instance of CollectTonesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CollectTonesResult() { Tones = new ChangeTrackingList(); } - /// Initializes a new instance of CollectTonesResult. + /// Initializes a new instance of . /// - internal CollectTonesResult(IReadOnlyList tones) + /// Keeps track of any properties unknown to the library. + internal CollectTonesResult(IReadOnlyList tones, Dictionary serializedAdditionalRawData) { Tones = tones; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.Serialization.cs index ce8def8c4104..086aab4b41bd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.cs index c21f3e0e1ed4..7ff3f8f9bfb6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 627cf3acb2e8..870473768e12 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.cs index 94ae151ef327..9ee852145a3a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs index b7fa28126211..fcf511637d5f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -28,23 +36,58 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CommunicationUser)) { writer.WritePropertyName("communicationUser"u8); - writer.WriteObjectValue(CommunicationUser); + if (CommunicationUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommunicationUser).Serialize(writer, options); + } } if (Optional.IsDefined(PhoneNumber)) { writer.WritePropertyName("phoneNumber"u8); - writer.WriteObjectValue(PhoneNumber); + if (PhoneNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PhoneNumber).Serialize(writer, options); + } } if (Optional.IsDefined(MicrosoftTeamsUser)) { writer.WritePropertyName("microsoftTeamsUser"u8); - writer.WriteObjectValue(MicrosoftTeamsUser); + if (MicrosoftTeamsUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MicrosoftTeamsUser).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element) + internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +97,7 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM Optional communicationUser = default; Optional phoneNumber = default; Optional microsoftTeamsUser = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -97,8 +141,61 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM microsoftTeamsUser = MicrosoftTeamsUserIdentifierModel.DeserializeMicrosoftTeamsUserIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIdentifierModel(Optional.ToNullable(kind), rawId.Value, communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value, serializedAdditionalRawData); + } + + CommunicationIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentifierModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentifierModel(Response response) + { + if (response is null) + { + return null; } - return new CommunicationIdentifierModel(Optional.ToNullable(kind), rawId.Value, communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.cs index 906d45583658..0ee509511296 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationIdentifierModel.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication { /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. internal partial class CommunicationIdentifierModel { - /// Initializes a new instance of CommunicationIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationIdentifierModel() { } - /// Initializes a new instance of CommunicationIdentifierModel. + /// Initializes a new instance of . /// The identifier kind. Only required in responses. /// Raw Id of the identifier. Optional in requests, required in responses. /// The communication user. /// The phone number. /// The Microsoft Teams user. - internal CommunicationIdentifierModel(CommunicationIdentifierModelKind? kind, string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser) + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentifierModel(CommunicationIdentifierModelKind? kind, string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, Dictionary serializedAdditionalRawData) { Kind = kind; RawId = rawId; CommunicationUser = communicationUser; PhoneNumber = phoneNumber; MicrosoftTeamsUser = microsoftTeamsUser; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The identifier kind. Only required in responses. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs index 606b9637a4ea..ed94ea13226d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element) + internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -34,8 +57,61 @@ internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIde id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationUserIdentifierModel(id, serializedAdditionalRawData); + } + + CommunicationUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new CommunicationUserIdentifierModel(id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.cs index 1f90746ab01e..f4e6bdb9c80d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CommunicationUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A user that got created with an Azure Communication Services resource. internal partial class CommunicationUserIdentifierModel { - /// Initializes a new instance of CommunicationUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the communication user. /// is null. public CommunicationUserIdentifierModel(string id) @@ -23,6 +27,20 @@ public CommunicationUserIdentifierModel(string id) Id = id; } + /// Initializes a new instance of . + /// The Id of the communication user. + /// Keeps track of any properties unknown to the library. + internal CommunicationUserIdentifierModel(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationUserIdentifierModel() + { + } + /// The Id of the communication user. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.Serialization.cs index 2205d8a22d68..ce3f7140de7d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.Serialization.cs @@ -5,18 +5,34 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class ContinuousDtmfRecognitionRequestInternal : IUtf8JsonSerializable + internal partial class ContinuousDtmfRecognitionRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + if (TargetParticipant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TargetParticipant).Serialize(writer, options); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); @@ -27,7 +43,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContinuousDtmfRecognitionRequestInternal DeserializeContinuousDtmfRecognitionRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationIdentifierModel targetParticipant = default; + Optional operationContext = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetParticipant"u8)) + { + targetParticipant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContinuousDtmfRecognitionRequestInternal(targetParticipant, operationContext.Value, callbackUri.Value, serializedAdditionalRawData); + } + + ContinuousDtmfRecognitionRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousDtmfRecognitionRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousDtmfRecognitionRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousDtmfRecognitionRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousDtmfRecognitionRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousDtmfRecognitionRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousDtmfRecognitionRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.cs index bc6188582a17..0902963d1ffe 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The ContinuousDtmfRecognitionRequest. internal partial class ContinuousDtmfRecognitionRequestInternal { - /// Initializes a new instance of ContinuousDtmfRecognitionRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines options for recognition. /// is null. public ContinuousDtmfRecognitionRequestInternal(CommunicationIdentifierModel targetParticipant) @@ -24,6 +28,24 @@ public ContinuousDtmfRecognitionRequestInternal(CommunicationIdentifierModel tar TargetParticipant = targetParticipant; } + /// Initializes a new instance of . + /// Defines options for recognition. + /// The value to identify context of the operation. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal ContinuousDtmfRecognitionRequestInternal(CommunicationIdentifierModel targetParticipant, string operationContext, string callbackUri, Dictionary serializedAdditionalRawData) + { + TargetParticipant = targetParticipant; + OperationContext = operationContext; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContinuousDtmfRecognitionRequestInternal() + { + } + /// Defines options for recognition. public CommunicationIdentifierModel TargetParticipant { get; } /// The value to identify context of the operation. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs index ea7fae65cdf3..71ed42356f07 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class ContinuousDtmfRecognitionStopped + public partial class ContinuousDtmfRecognitionStopped : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinuousDtmfRecognitionStopped DeserializeContinuousDtmfRecognitionStopped(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinuousDtmfRecognitionStopped DeserializeContinuousDtmfRecognitionStopped(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static ContinuousDtmfRecognitionStopped DeserializeContinuousDtmfRecogn Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static ContinuousDtmfRecognitionStopped DeserializeContinuousDtmfRecogn resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinuousDtmfRecognitionStopped(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new ContinuousDtmfRecognitionStopped(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + ContinuousDtmfRecognitionStopped IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousDtmfRecognitionStopped(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousDtmfRecognitionStopped IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousDtmfRecognitionStopped(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousDtmfRecognitionStopped model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousDtmfRecognitionStopped(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousDtmfRecognitionStopped(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs index 4837bf8255a4..7247a00f864b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The ContinuousDtmfRecognitionStopped. public partial class ContinuousDtmfRecognitionStopped { - /// Initializes a new instance of ContinuousDtmfRecognitionStopped. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinuousDtmfRecognitionStopped() { } - /// Initializes a new instance of ContinuousDtmfRecognitionStopped. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code, sub-code and message. - internal ContinuousDtmfRecognitionStopped(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + /// Keeps track of any properties unknown to the library. + internal ContinuousDtmfRecognitionStopped(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs index 1c9adc999ce4..4b9dcc4ef418 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class ContinuousDtmfRecognitionToneFailed + public partial class ContinuousDtmfRecognitionToneFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinuousDtmfRecognitionToneFailed DeserializeContinuousDtmfRecognitionToneFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinuousDtmfRecognitionToneFailed DeserializeContinuousDtmfRecognitionToneFailed(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static ContinuousDtmfRecognitionToneFailed DeserializeContinuousDtmfRec Optional correlationId = default; Optional resultInformation = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static ContinuousDtmfRecognitionToneFailed DeserializeContinuousDtmfRec operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinuousDtmfRecognitionToneFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, resultInformation.Value, operationContext.Value); + return new ContinuousDtmfRecognitionToneFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, resultInformation.Value, operationContext.Value, serializedAdditionalRawData); + } + + ContinuousDtmfRecognitionToneFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousDtmfRecognitionToneFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousDtmfRecognitionToneFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousDtmfRecognitionToneFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousDtmfRecognitionToneFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousDtmfRecognitionToneFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousDtmfRecognitionToneFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs index 83d1320d3626..b2ce9d068733 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The ContinuousDtmfRecognitionToneFailed. public partial class ContinuousDtmfRecognitionToneFailed { - /// Initializes a new instance of ContinuousDtmfRecognitionToneFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinuousDtmfRecognitionToneFailed() { } - /// Initializes a new instance of ContinuousDtmfRecognitionToneFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// Contains the resulting SIP code, sub-code and message. /// Used by customers when calling mid-call actions to correlate the request to the response event. - internal ContinuousDtmfRecognitionToneFailed(string callConnectionId, string serverCallId, string correlationId, ResultInformation resultInformation, string operationContext) + /// Keeps track of any properties unknown to the library. + internal ContinuousDtmfRecognitionToneFailed(string callConnectionId, string serverCallId, string correlationId, ResultInformation resultInformation, string operationContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; ResultInformation = resultInformation; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs index 7552e3a70424..52eb8989097f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs @@ -5,15 +5,87 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class ContinuousDtmfRecognitionToneReceived + public partial class ContinuousDtmfRecognitionToneReceived : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfRecognitionToneReceived(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ToneInfo)) + { + writer.WritePropertyName("toneInfo"u8); + if (ToneInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ToneInfo).Serialize(writer, options); + } + } + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfRecognitionToneReceived(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +96,7 @@ internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfR Optional correlationId = default; Optional resultInformation = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("toneInfo"u8)) @@ -64,8 +137,61 @@ internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfR operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinuousDtmfRecognitionToneReceived(toneInfo.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, resultInformation.Value, operationContext.Value); + return new ContinuousDtmfRecognitionToneReceived(toneInfo.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, resultInformation.Value, operationContext.Value, serializedAdditionalRawData); + } + + ContinuousDtmfRecognitionToneReceived IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousDtmfRecognitionToneReceived(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousDtmfRecognitionToneReceived IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousDtmfRecognitionToneReceived(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousDtmfRecognitionToneReceived model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousDtmfRecognitionToneReceived(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousDtmfRecognitionToneReceived(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs index cd2fb276deec..cbbc34dfa050 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The ContinuousDtmfRecognitionToneReceived. public partial class ContinuousDtmfRecognitionToneReceived { - /// Initializes a new instance of ContinuousDtmfRecognitionToneReceived. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinuousDtmfRecognitionToneReceived() { } - /// Initializes a new instance of ContinuousDtmfRecognitionToneReceived. + /// Initializes a new instance of . /// Information about Tone. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId or skype chain ID. /// Contains the resulting SIP code, sub-code and message. /// Used by customers when calling mid-call actions to correlate the request to the response event. - internal ContinuousDtmfRecognitionToneReceived(ToneInfo toneInfo, string callConnectionId, string serverCallId, string correlationId, ResultInformation resultInformation, string operationContext) + /// Keeps track of any properties unknown to the library. + internal ContinuousDtmfRecognitionToneReceived(ToneInfo toneInfo, string callConnectionId, string serverCallId, string correlationId, ResultInformation resultInformation, string operationContext, Dictionary serializedAdditionalRawData) { ToneInfo = toneInfo; CallConnectionId = callConnectionId; @@ -30,6 +37,7 @@ internal ContinuousDtmfRecognitionToneReceived(ToneInfo toneInfo, string callCon CorrelationId = correlationId; ResultInformation = resultInformation; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Information about Tone. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs index 81b288e5932f..83dffc878117 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs @@ -5,27 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CreateCallRequestInternal : IUtf8JsonSerializable + internal partial class CreateCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targets"u8); writer.WriteStartArray(); foreach (var item in Targets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(SourceCallerIdNumber)) { writer.WritePropertyName("sourceCallerIdNumber"u8); - writer.WriteObjectValue(SourceCallerIdNumber); + if (SourceCallerIdNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceCallerIdNumber).Serialize(writer, options); + } } if (Optional.IsDefined(SourceDisplayName)) { @@ -35,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceIdentity)) { writer.WritePropertyName("sourceIdentity"u8); - writer.WriteObjectValue(SourceIdentity); + if (SourceIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(OperationContext)) { @@ -47,7 +77,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MediaStreamingConfiguration)) { writer.WritePropertyName("mediaStreamingConfiguration"u8); - writer.WriteObjectValue(MediaStreamingConfiguration); + if (MediaStreamingConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MediaStreamingConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(AzureCognitiveServicesEndpointUrl)) { @@ -57,9 +94,171 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CustomContext)) { writer.WritePropertyName("customContext"u8); - writer.WriteObjectValue(CustomContext); + if (CustomContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomContext).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static CreateCallRequestInternal DeserializeCreateCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList targets = default; + Optional sourceCallerIdNumber = default; + Optional sourceDisplayName = default; + Optional sourceIdentity = default; + Optional operationContext = default; + string callbackUri = default; + Optional mediaStreamingConfiguration = default; + Optional azureCognitiveServicesEndpointUrl = default; + Optional customContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targets"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + targets = array; + continue; + } + if (property.NameEquals("sourceCallerIdNumber"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceCallerIdNumber = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("sourceDisplayName"u8)) + { + sourceDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceIdentity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceIdentity = CommunicationUserIdentifierModel.DeserializeCommunicationUserIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaStreamingConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mediaStreamingConfiguration = MediaStreamingOptionsInternal.DeserializeMediaStreamingOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("azureCognitiveServicesEndpointUrl"u8)) + { + azureCognitiveServicesEndpointUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("customContext"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customContext = CustomContextInternal.DeserializeCustomContextInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateCallRequestInternal(targets, sourceCallerIdNumber.Value, sourceDisplayName.Value, sourceIdentity.Value, operationContext.Value, callbackUri, mediaStreamingConfiguration.Value, azureCognitiveServicesEndpointUrl.Value, customContext.Value, serializedAdditionalRawData); + } + + CreateCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs index b7cd614b126f..897dffa15549 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for creating the call. internal partial class CreateCallRequestInternal { - /// Initializes a new instance of CreateCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The targets of the call. /// The callback URI. /// or is null. @@ -29,6 +32,39 @@ public CreateCallRequestInternal(IEnumerable targe CallbackUri = callbackUri; } + /// Initializes a new instance of . + /// The targets of the call. + /// + /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. + /// Required only when calling a PSTN callee. + /// + /// Display name of the call if dialing out to a pstn number. + /// The identifier of the source of the call. + /// A customer set value used to track the answering of a call. + /// The callback URI. + /// Media Streaming Configuration. + /// The identifier of the Cognitive Service resource assigned to this call. + /// Used by customer to send custom context to targets. + /// Keeps track of any properties unknown to the library. + internal CreateCallRequestInternal(IList targets, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationUserIdentifierModel sourceIdentity, string operationContext, string callbackUri, MediaStreamingOptionsInternal mediaStreamingConfiguration, string azureCognitiveServicesEndpointUrl, CustomContextInternal customContext, Dictionary serializedAdditionalRawData) + { + Targets = targets; + SourceCallerIdNumber = sourceCallerIdNumber; + SourceDisplayName = sourceDisplayName; + SourceIdentity = sourceIdentity; + OperationContext = operationContext; + CallbackUri = callbackUri; + MediaStreamingConfiguration = mediaStreamingConfiguration; + AzureCognitiveServicesEndpointUrl = azureCognitiveServicesEndpointUrl; + CustomContext = customContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateCallRequestInternal() + { + } + /// The targets of the call. public IList Targets { get; } /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.Serialization.cs index 27f2b7bdc749..de5798a8db93 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class CustomContextInternal : IUtf8JsonSerializable + internal partial class CustomContextInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(VoipHeaders)) { @@ -37,7 +45,117 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CustomContextInternal DeserializeCustomContextInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> voipHeaders = default; + Optional> sipHeaders = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("voipHeaders"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + voipHeaders = dictionary; + continue; + } + if (property.NameEquals("sipHeaders"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + sipHeaders = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomContextInternal(Optional.ToDictionary(voipHeaders), Optional.ToDictionary(sipHeaders), serializedAdditionalRawData); + } + + CustomContextInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomContextInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomContextInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomContextInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomContextInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomContextInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomContextInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.cs index dd327b4ae9e5..35ca9018f39c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContextInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,27 @@ namespace Azure.Communication.CallAutomation /// The CustomContext. internal partial class CustomContextInternal { - /// Initializes a new instance of CustomContextInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomContextInternal() { VoipHeaders = new ChangeTrackingDictionary(); SipHeaders = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Dictionary of <string>. + /// Dictionary of <string>. + /// Keeps track of any properties unknown to the library. + internal CustomContextInternal(IDictionary voipHeaders, IDictionary sipHeaders, Dictionary serializedAdditionalRawData) + { + VoipHeaders = voipHeaders; + SipHeaders = sipHeaders; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Dictionary of <string>. public IDictionary VoipHeaders { get; } /// Dictionary of <string>. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs index b697d9f9c32f..243a368e66c7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogCompletedInternal + internal partial class DialogCompletedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogCompletedInternal DeserializeDialogCompletedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogCompletedInternal DeserializeDialogCompletedInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +69,7 @@ internal static DialogCompletedInternal DeserializeDialogCompletedInternal(JsonE Optional resultInformation = default; Optional dialogInputType = default; Optional dialogId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -71,8 +115,61 @@ internal static DialogCompletedInternal DeserializeDialogCompletedInternal(JsonE dialogId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogCompletedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value); + return new DialogCompletedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, serializedAdditionalRawData); + } + + DialogCompletedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogCompletedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogCompletedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogCompletedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogCompletedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogCompletedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogCompletedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs index 0d9bedbfdb0f..f1b73427a8e7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogCompleted. internal partial class DialogCompletedInternal { - /// Initializes a new instance of DialogCompletedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogCompletedInternal() { } - /// Initializes a new instance of DialogCompletedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -25,7 +30,8 @@ internal DialogCompletedInternal() /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. - internal DialogCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId) + /// Keeps track of any properties unknown to the library. + internal DialogCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -34,6 +40,7 @@ internal DialogCompletedInternal(string callConnectionId, string serverCallId, s ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs index 105c6fb71bd5..2863c0483fce 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogConsentInternal + internal partial class DialogConsentInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogConsentInternal DeserializeDialogConsentInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogConsentInternal DeserializeDialogConsentInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +70,7 @@ internal static DialogConsentInternal DeserializeDialogConsentInternal(JsonEleme Optional dialogInputType = default; Optional userConsent = default; Optional dialogId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -81,8 +125,61 @@ internal static DialogConsentInternal DeserializeDialogConsentInternal(JsonEleme dialogId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogConsentInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), userConsent.Value, dialogId.Value); + return new DialogConsentInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), userConsent.Value, dialogId.Value, serializedAdditionalRawData); + } + + DialogConsentInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogConsentInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogConsentInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogConsentInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogConsentInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogConsentInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogConsentInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs index 58354d4a8300..a43ab8e52f19 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogConsent. internal partial class DialogConsentInternal { - /// Initializes a new instance of DialogConsentInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogConsentInternal() { } - /// Initializes a new instance of DialogConsentInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -26,7 +31,8 @@ internal DialogConsentInternal() /// Determines the type of the dialog. /// UserConsent data from the Conversation Conductor. /// Dialog ID. - internal DialogConsentInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, UserConsent userConsent, string dialogId) + /// Keeps track of any properties unknown to the library. + internal DialogConsentInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, UserConsent userConsent, string dialogId, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -36,6 +42,7 @@ internal DialogConsentInternal(string callConnectionId, string serverCallId, str DialogInputType = dialogInputType; UserConsent = userConsent; DialogId = dialogId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs index a2bb5b11f07b..8191cd917ea2 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogFailedInternal + internal partial class DialogFailedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogFailedInternal DeserializeDialogFailedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogFailedInternal DeserializeDialogFailedInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +69,7 @@ internal static DialogFailedInternal DeserializeDialogFailedInternal(JsonElement Optional resultInformation = default; Optional dialogInputType = default; Optional dialogId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -71,8 +115,61 @@ internal static DialogFailedInternal DeserializeDialogFailedInternal(JsonElement dialogId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogFailedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value); + return new DialogFailedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, serializedAdditionalRawData); + } + + DialogFailedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogFailedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogFailedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogFailedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogFailedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogFailedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogFailedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs index 23bc1f646dba..74677d102fb1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogFailed. internal partial class DialogFailedInternal { - /// Initializes a new instance of DialogFailedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogFailedInternal() { } - /// Initializes a new instance of DialogFailedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -25,7 +30,8 @@ internal DialogFailedInternal() /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. - internal DialogFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId) + /// Keeps track of any properties unknown to the library. + internal DialogFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -34,6 +40,7 @@ internal DialogFailedInternal(string callConnectionId, string serverCallId, stri ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs index 29141fee40bd..0546efa7baf6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogHangupInternal + internal partial class DialogHangupInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogHangupInternal DeserializeDialogHangupInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogHangupInternal DeserializeDialogHangupInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +70,7 @@ internal static DialogHangupInternal DeserializeDialogHangupInternal(JsonElement Optional dialogInputType = default; Optional dialogId = default; Optional ivrContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -81,8 +125,61 @@ internal static DialogHangupInternal DeserializeDialogHangupInternal(JsonElement ivrContext = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogHangupInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, ivrContext.Value); + return new DialogHangupInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, ivrContext.Value, serializedAdditionalRawData); + } + + DialogHangupInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogHangupInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogHangupInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogHangupInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogHangupInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogHangupInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogHangupInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs index 8b45b03f8a01..dc8141eaa888 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogHangup. internal partial class DialogHangupInternal { - /// Initializes a new instance of DialogHangupInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogHangupInternal() { } - /// Initializes a new instance of DialogHangupInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -26,7 +31,8 @@ internal DialogHangupInternal() /// Determines the type of the dialog. /// Dialog ID. /// Ivr Context. - internal DialogHangupInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, object ivrContext) + /// Keeps track of any properties unknown to the library. + internal DialogHangupInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, object ivrContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -36,6 +42,7 @@ internal DialogHangupInternal(string callConnectionId, string serverCallId, stri DialogInputType = dialogInputType; DialogId = dialogId; IvrContext = ivrContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs index a7221c682745..e560ec86bb97 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogLanguageChangeInternal + internal partial class DialogLanguageChangeInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +71,7 @@ internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInte Optional dialogId = default; Optional selectedLanguage = default; Optional ivrContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -87,8 +131,61 @@ internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInte ivrContext = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogLanguageChangeInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, selectedLanguage.Value, ivrContext.Value); + return new DialogLanguageChangeInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, selectedLanguage.Value, ivrContext.Value, serializedAdditionalRawData); + } + + DialogLanguageChangeInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogLanguageChangeInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogLanguageChangeInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogLanguageChangeInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogLanguageChangeInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogLanguageChangeInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogLanguageChangeInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs index 5b1410fc1785..681985fb049f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogLanguageChange. internal partial class DialogLanguageChangeInternal { - /// Initializes a new instance of DialogLanguageChangeInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogLanguageChangeInternal() { } - /// Initializes a new instance of DialogLanguageChangeInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -27,7 +32,8 @@ internal DialogLanguageChangeInternal() /// Dialog ID. /// Selected Language. /// Ivr Context. - internal DialogLanguageChangeInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string selectedLanguage, object ivrContext) + /// Keeps track of any properties unknown to the library. + internal DialogLanguageChangeInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string selectedLanguage, object ivrContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -38,6 +44,7 @@ internal DialogLanguageChangeInternal(string callConnectionId, string serverCall DialogId = dialogId; SelectedLanguage = selectedLanguage; IvrContext = ivrContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs index 623f68f6f34d..c171e3ce3092 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class DialogOptionsInternal : IUtf8JsonSerializable + internal partial class DialogOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("botAppId"u8); writer.WriteStringValue(BotAppId); @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DialogOptionsInternal DeserializeDialogOptionsInternal(JsonElement element) + internal static DialogOptionsInternal DeserializeDialogOptionsInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string botAppId = default; IDictionary dialogContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("botAppId"u8)) @@ -66,8 +88,61 @@ internal static DialogOptionsInternal DeserializeDialogOptionsInternal(JsonEleme dialogContext = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DialogOptionsInternal(botAppId, dialogContext, serializedAdditionalRawData); + } + + DialogOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogOptionsInternal model) + { + if (model is null) + { + return null; } - return new DialogOptionsInternal(botAppId, dialogContext); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs index ace1e2de2f6b..7f0f326b04d3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The DialogOptions. internal partial class DialogOptionsInternal { - /// Initializes a new instance of DialogOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Bot identifier. /// Dialog context. /// or is null. @@ -27,6 +30,22 @@ public DialogOptionsInternal(string botAppId, IDictionary dialog DialogContext = dialogContext; } + /// Initializes a new instance of . + /// Bot identifier. + /// Dialog context. + /// Keeps track of any properties unknown to the library. + internal DialogOptionsInternal(string botAppId, IDictionary dialogContext, Dictionary serializedAdditionalRawData) + { + BotAppId = botAppId; + DialogContext = dialogContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DialogOptionsInternal() + { + } + /// Bot identifier. public string BotAppId { get; set; } /// Dialog context. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs index b0f18257b973..e1393f10236d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogSensitivityUpdateInternal + internal partial class DialogSensitivityUpdateInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogSensitivityUpdateInternal DeserializeDialogSensitivityUpdateInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogSensitivityUpdateInternal DeserializeDialogSensitivityUpdateInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +70,7 @@ internal static DialogSensitivityUpdateInternal DeserializeDialogSensitivityUpda Optional dialogInputType = default; Optional dialogId = default; Optional sensitiveMask = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -81,8 +125,61 @@ internal static DialogSensitivityUpdateInternal DeserializeDialogSensitivityUpda sensitiveMask = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogSensitivityUpdateInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, Optional.ToNullable(sensitiveMask)); + return new DialogSensitivityUpdateInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, Optional.ToNullable(sensitiveMask), serializedAdditionalRawData); + } + + DialogSensitivityUpdateInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogSensitivityUpdateInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogSensitivityUpdateInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogSensitivityUpdateInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogSensitivityUpdateInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogSensitivityUpdateInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogSensitivityUpdateInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs index 683a379bab2e..3755453b610f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogSensitivityUpdate. internal partial class DialogSensitivityUpdateInternal { - /// Initializes a new instance of DialogSensitivityUpdateInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogSensitivityUpdateInternal() { } - /// Initializes a new instance of DialogSensitivityUpdateInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -26,7 +31,8 @@ internal DialogSensitivityUpdateInternal() /// Determines the type of the dialog. /// Dialog ID. /// SensitiveMask. - internal DialogSensitivityUpdateInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, bool? sensitiveMask) + /// Keeps track of any properties unknown to the library. + internal DialogSensitivityUpdateInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, bool? sensitiveMask, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -36,6 +42,7 @@ internal DialogSensitivityUpdateInternal(string callConnectionId, string serverC DialogInputType = dialogInputType; DialogId = dialogId; SensitiveMask = sensitiveMask; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs index 628e4aac7b9c..ac44496a288f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogStartedInternal + internal partial class DialogStartedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogStartedInternal DeserializeDialogStartedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogStartedInternal DeserializeDialogStartedInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +69,7 @@ internal static DialogStartedInternal DeserializeDialogStartedInternal(JsonEleme Optional resultInformation = default; Optional dialogInputType = default; Optional dialogId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -71,8 +115,61 @@ internal static DialogStartedInternal DeserializeDialogStartedInternal(JsonEleme dialogId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogStartedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value); + return new DialogStartedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, serializedAdditionalRawData); + } + + DialogStartedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogStartedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogStartedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogStartedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogStartedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogStartedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogStartedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs index 25c814b35236..1c611a49cccf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogStarted. internal partial class DialogStartedInternal { - /// Initializes a new instance of DialogStartedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogStartedInternal() { } - /// Initializes a new instance of DialogStartedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -25,7 +30,8 @@ internal DialogStartedInternal() /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. - internal DialogStartedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId) + /// Keeps track of any properties unknown to the library. + internal DialogStartedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -34,6 +40,7 @@ internal DialogStartedInternal(string callConnectionId, string serverCallId, str ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.Serialization.cs index 2bc05a0bcca3..544126a86d4b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.Serialization.cs @@ -5,15 +5,70 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class DialogStateResponseInternal + internal partial class DialogStateResponseInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogStateResponseInternal DeserializeDialogStateResponseInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DialogId)) + { + writer.WritePropertyName("dialogId"u8); + writer.WriteStringValue(DialogId); + } + if (Optional.IsDefined(DialogOptions)) + { + writer.WritePropertyName("dialogOptions"u8); + if (DialogOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DialogOptions).Serialize(writer, options); + } + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogStateResponseInternal DeserializeDialogStateResponseInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +77,7 @@ internal static DialogStateResponseInternal DeserializeDialogStateResponseIntern Optional dialogOptions = default; Optional dialogInputType = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dialogId"u8)) @@ -52,8 +108,61 @@ internal static DialogStateResponseInternal DeserializeDialogStateResponseIntern operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogStateResponseInternal(dialogId.Value, dialogOptions.Value, Optional.ToNullable(dialogInputType), operationContext.Value); + return new DialogStateResponseInternal(dialogId.Value, dialogOptions.Value, Optional.ToNullable(dialogInputType), operationContext.Value, serializedAdditionalRawData); + } + + DialogStateResponseInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogStateResponseInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogStateResponseInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogStateResponseInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogStateResponseInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogStateResponseInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogStateResponseInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.cs index aebdaff1b95f..69baffbec7ac 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStateResponseInternal.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The DialogStateResponse. internal partial class DialogStateResponseInternal { - /// Initializes a new instance of DialogStateResponseInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogStateResponseInternal() { } - /// Initializes a new instance of DialogStateResponseInternal. + /// Initializes a new instance of . /// The dialog ID. /// Defines options for dialog. /// Determines the type of the dialog. /// The value to identify context of the operation. - internal DialogStateResponseInternal(string dialogId, DialogOptionsInternal dialogOptions, DialogInputType? dialogInputType, string operationContext) + /// Keeps track of any properties unknown to the library. + internal DialogStateResponseInternal(string dialogId, DialogOptionsInternal dialogOptions, DialogInputType? dialogInputType, string operationContext, Dictionary serializedAdditionalRawData) { DialogId = dialogId; DialogOptions = dialogOptions; DialogInputType = dialogInputType; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The dialog ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs index e132ecad39a6..5585abb579e6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.CallAutomation; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation.Models.Events { - internal partial class DialogTransferInternal + internal partial class DialogTransferInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(DialogInputType)) + { + writer.WritePropertyName("dialogInputType"u8); + writer.WriteStringValue(DialogInputType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +72,7 @@ internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonEle Optional transferType = default; Optional transferDestination = default; Optional ivrContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -93,8 +137,61 @@ internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonEle ivrContext = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DialogTransferInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, transferType.Value, transferDestination.Value, ivrContext.Value); + return new DialogTransferInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, Optional.ToNullable(dialogInputType), dialogId.Value, transferType.Value, transferDestination.Value, ivrContext.Value, serializedAdditionalRawData); + } + + DialogTransferInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDialogTransferInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DialogTransferInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDialogTransferInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DialogTransferInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DialogTransferInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDialogTransferInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs index 92066c5a8fa3..7307812384ff 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.CallAutomation; namespace Azure.Communication.CallAutomation.Models.Events @@ -12,12 +14,15 @@ namespace Azure.Communication.CallAutomation.Models.Events /// The DialogTransfer. internal partial class DialogTransferInternal { - /// Initializes a new instance of DialogTransferInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DialogTransferInternal() { } - /// Initializes a new instance of DialogTransferInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. @@ -28,7 +33,8 @@ internal DialogTransferInternal() /// Transfer type. /// Transfer destination. /// IVR context. - internal DialogTransferInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string transferType, string transferDestination, object ivrContext) + /// Keeps track of any properties unknown to the library. + internal DialogTransferInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string transferType, string transferDestination, object ivrContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -40,6 +46,7 @@ internal DialogTransferInternal(string callConnectionId, string serverCallId, st TransferType = transferType; TransferDestination = transferDestination; IvrContext = ivrContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.Serialization.cs index 514fd851bfd3..0c7ec86d853c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class DtmfOptionsInternal : IUtf8JsonSerializable + internal partial class DtmfOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InterToneTimeoutInSeconds)) { @@ -35,7 +43,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DtmfOptionsInternal DeserializeDtmfOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional interToneTimeoutInSeconds = default; + Optional maxTonesToCollect = default; + Optional> stopTones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("interToneTimeoutInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interToneTimeoutInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxTonesToCollect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxTonesToCollect = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stopTones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new DtmfTone(item.GetString())); + } + stopTones = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DtmfOptionsInternal(Optional.ToNullable(interToneTimeoutInSeconds), Optional.ToNullable(maxTonesToCollect), Optional.ToList(stopTones), serializedAdditionalRawData); + } + + DtmfOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDtmfOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DtmfOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDtmfOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DtmfOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DtmfOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDtmfOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.cs index 8556dd2add9d..5665334e7d30 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfOptionsInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.Communication.CallAutomation /// Options for DTMF recognition. internal partial class DtmfOptionsInternal { - /// Initializes a new instance of DtmfOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DtmfOptionsInternal() { StopTones = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Time to wait between DTMF inputs to stop recognizing. + /// Maximum number of DTMF tones to be collected. + /// List of tones that will stop recognizing. + /// Keeps track of any properties unknown to the library. + internal DtmfOptionsInternal(int? interToneTimeoutInSeconds, int? maxTonesToCollect, IReadOnlyList stopTones, Dictionary serializedAdditionalRawData) + { + InterToneTimeoutInSeconds = interToneTimeoutInSeconds; + MaxTonesToCollect = maxTonesToCollect; + StopTones = stopTones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Time to wait between DTMF inputs to stop recognizing. public int? InterToneTimeoutInSeconds { get; set; } /// Maximum number of DTMF tones to be collected. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.Serialization.cs index c59afef94ffb..570ea72e8402 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class DtmfResult + public partial class DtmfResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DtmfResult DeserializeDtmfResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DtmfResult DeserializeDtmfResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> tones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tones"u8)) @@ -36,8 +64,61 @@ internal static DtmfResult DeserializeDtmfResult(JsonElement element) tones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DtmfResult(Optional.ToList(tones)); + return new DtmfResult(Optional.ToList(tones), serializedAdditionalRawData); + } + + DtmfResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDtmfResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DtmfResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDtmfResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DtmfResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DtmfResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDtmfResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.cs index 3c0d33e8c38d..1e9dc0e506a3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DtmfResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.Communication.CallAutomation /// The DtmfResult. public partial class DtmfResult { - /// Initializes a new instance of DtmfResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DtmfResult() { Tones = new ChangeTrackingList(); } - /// Initializes a new instance of DtmfResult. + /// Initializes a new instance of . /// - internal DtmfResult(IReadOnlyList tones) + /// Keeps track of any properties unknown to the library. + internal DtmfResult(IReadOnlyList tones, Dictionary serializedAdditionalRawData) { Tones = tones; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.Serialization.cs index d3b19f82ccfa..368d126897df 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.Serialization.cs @@ -5,24 +5,135 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class ExternalStorageInternal : IUtf8JsonSerializable + internal partial class ExternalStorageInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageType"u8); writer.WriteStringValue(StorageType.ToString()); if (Optional.IsDefined(BlobStorage)) { writer.WritePropertyName("blobStorage"u8); - writer.WriteObjectValue(BlobStorage); + if (BlobStorage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BlobStorage).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ExternalStorageInternal DeserializeExternalStorageInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RecordingStorageType storageType = default; + Optional blobStorage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageType"u8)) + { + storageType = new RecordingStorageType(property.Value.GetString()); + continue; + } + if (property.NameEquals("blobStorage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blobStorage = BlobStorageInternal.DeserializeBlobStorageInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExternalStorageInternal(storageType, blobStorage.Value, serializedAdditionalRawData); + } + + ExternalStorageInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExternalStorageInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExternalStorageInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExternalStorageInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExternalStorageInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExternalStorageInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExternalStorageInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.cs index dc5ad1971596..6e6d53de74dc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ExternalStorageInternal.cs @@ -5,18 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The ExternalStorage. internal partial class ExternalStorageInternal { - /// Initializes a new instance of ExternalStorageInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the type of external storage. public ExternalStorageInternal(RecordingStorageType storageType) { StorageType = storageType; } + /// Initializes a new instance of . + /// Defines the type of external storage. + /// Defines the blob storage location where the recording will be stored. + /// Keeps track of any properties unknown to the library. + internal ExternalStorageInternal(RecordingStorageType storageType, BlobStorageInternal blobStorage, Dictionary serializedAdditionalRawData) + { + StorageType = storageType; + BlobStorage = blobStorage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExternalStorageInternal() + { + } + /// Defines the type of external storage. public RecordingStorageType StorageType { get; } /// Defines the blob storage location where the recording will be stored. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.Serialization.cs index 28c71d33c0f5..aa09a853e07a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class FileSourceInternal : IUtf8JsonSerializable + internal partial class FileSourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("uri"u8); writer.WriteStringValue(Uri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FileSourceInternal DeserializeFileSourceInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri"u8)) + { + uri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FileSourceInternal(uri, serializedAdditionalRawData); + } + + FileSourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileSourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileSourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileSourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileSourceInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileSourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileSourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.cs index 3dd5988eef28..99810d99e109 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/FileSourceInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The FileSource. internal partial class FileSourceInternal { - /// Initializes a new instance of FileSourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Uri for the audio file to be played. /// is null. public FileSourceInternal(string uri) @@ -23,6 +27,20 @@ public FileSourceInternal(string uri) Uri = uri; } + /// Initializes a new instance of . + /// Uri for the audio file to be played. + /// Keeps track of any properties unknown to the library. + internal FileSourceInternal(string uri, Dictionary serializedAdditionalRawData) + { + Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileSourceInternal() + { + } + /// Uri for the audio file to be played. public string Uri { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs index be99cbf7e5dc..9a01cb2e8cc6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class GetParticipantsResponseInternal + internal partial class GetParticipantsResponseInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GetParticipantsResponseInternal DeserializeGetParticipantsResponseInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GetParticipantsResponseInternal DeserializeGetParticipantsResponseInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> values = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("values"u8)) @@ -42,8 +92,61 @@ internal static GetParticipantsResponseInternal DeserializeGetParticipantsRespon nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GetParticipantsResponseInternal(Optional.ToList(values), nextLink.Value); + return new GetParticipantsResponseInternal(Optional.ToList(values), nextLink.Value, serializedAdditionalRawData); + } + + GetParticipantsResponseInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetParticipantsResponseInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetParticipantsResponseInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetParticipantsResponseInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetParticipantsResponseInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetParticipantsResponseInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetParticipantsResponseInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.cs index 9890fd592b64..14ac774d18f9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/GetParticipantsResponseInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.CallAutomation /// The response payload for getting participants of the call. internal partial class GetParticipantsResponseInternal { - /// Initializes a new instance of GetParticipantsResponseInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GetParticipantsResponseInternal() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of GetParticipantsResponseInternal. + /// Initializes a new instance of . /// List of the current participants in the call. /// Continue of the list of participants. - internal GetParticipantsResponseInternal(IReadOnlyList values, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GetParticipantsResponseInternal(IReadOnlyList values, string nextLink, Dictionary serializedAdditionalRawData) { Values = values; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of the current participants in the call. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs index 424812f03b4c..a290862ba7bc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class MediaStreamingOptionsInternal : IUtf8JsonSerializable + internal partial class MediaStreamingOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("transportUrl"u8); writer.WriteStringValue(TransportUrl); @@ -23,7 +31,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ContentType.ToString()); writer.WritePropertyName("audioChannelType"u8); writer.WriteStringValue(AudioChannelType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MediaStreamingOptionsInternal DeserializeMediaStreamingOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string transportUrl = default; + MediaStreamingTransport transportType = default; + MediaStreamingContent contentType = default; + MediaStreamingAudioChannel audioChannelType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("transportUrl"u8)) + { + transportUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("transportType"u8)) + { + transportType = new MediaStreamingTransport(property.Value.GetString()); + continue; + } + if (property.NameEquals("contentType"u8)) + { + contentType = new MediaStreamingContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("audioChannelType"u8)) + { + audioChannelType = new MediaStreamingAudioChannel(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MediaStreamingOptionsInternal(transportUrl, transportType, contentType, audioChannelType, serializedAdditionalRawData); + } + + MediaStreamingOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMediaStreamingOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaStreamingOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaStreamingOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MediaStreamingOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MediaStreamingOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMediaStreamingOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs index 5d1de2685201..67199f76a5e4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// Configuration of Media streaming. internal partial class MediaStreamingOptionsInternal { - /// Initializes a new instance of MediaStreamingOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Transport URL for media streaming. /// The type of transport to be used for media streaming, eg. Websocket. /// Content type to stream, eg. audio, audio/video. @@ -29,6 +33,26 @@ public MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTranspor AudioChannelType = audioChannelType; } + /// Initializes a new instance of . + /// Transport URL for media streaming. + /// The type of transport to be used for media streaming, eg. Websocket. + /// Content type to stream, eg. audio, audio/video. + /// Audio channel type to stream, eg. unmixed audio, mixed audio. + /// Keeps track of any properties unknown to the library. + internal MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTransport transportType, MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType, Dictionary serializedAdditionalRawData) + { + TransportUrl = transportUrl; + TransportType = transportType; + ContentType = contentType; + AudioChannelType = audioChannelType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MediaStreamingOptionsInternal() + { + } + /// Transport URL for media streaming. public string TransportUrl { get; } /// The type of transport to be used for media streaming, eg. Websocket. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs index b84cac6e4d46..670616c6d8ce 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable + internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userId"u8); writer.WriteStringValue(UserId); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cloud"u8); writer.WriteStringValue(Cloud.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element) + internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI string userId = default; Optional isAnonymous = default; Optional cloud = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userId"u8)) @@ -64,8 +87,61 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud), serializedAdditionalRawData); + } + + MicrosoftTeamsUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftTeamsUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftTeamsUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftTeamsUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs index 20dfff30e6fe..3e8733d38ce9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A Microsoft Teams user. internal partial class MicrosoftTeamsUserIdentifierModel { - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// is null. public MicrosoftTeamsUserIdentifierModel(string userId) @@ -23,15 +27,22 @@ public MicrosoftTeamsUserIdentifierModel(string userId) UserId = userId; } - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// True if the Microsoft Teams user is anonymous. By default false if missing. /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud) + /// Keeps track of any properties unknown to the library. + internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud, Dictionary serializedAdditionalRawData) { UserId = userId; IsAnonymous = isAnonymous; Cloud = cloud; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MicrosoftTeamsUserIdentifierModel() + { } /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.Serialization.cs index a522f12aa8f5..b9137d4b20f7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.Serialization.cs @@ -5,21 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class MuteParticipantsRequestInternal : IUtf8JsonSerializable + internal partial class MuteParticipantsRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targetParticipants"u8); writer.WriteStartArray(); foreach (var item in TargetParticipants) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(OperationContext)) @@ -27,7 +43,104 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MuteParticipantsRequestInternal DeserializeMuteParticipantsRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList targetParticipants = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetParticipants"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + targetParticipants = array; + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MuteParticipantsRequestInternal(targetParticipants, operationContext.Value, serializedAdditionalRawData); + } + + MuteParticipantsRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMuteParticipantsRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MuteParticipantsRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMuteParticipantsRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MuteParticipantsRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MuteParticipantsRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMuteParticipantsRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.cs index 99191de0fe37..9fa1decccbc3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for muting participants from the call. internal partial class MuteParticipantsRequestInternal { - /// Initializes a new instance of MuteParticipantsRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Participants to be muted from the call. /// Only ACS Users are supported. @@ -29,6 +32,25 @@ public MuteParticipantsRequestInternal(IEnumerable TargetParticipants = targetParticipants.ToList(); } + /// Initializes a new instance of . + /// + /// Participants to be muted from the call. + /// Only ACS Users are supported. + /// + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Keeps track of any properties unknown to the library. + internal MuteParticipantsRequestInternal(IList targetParticipants, string operationContext, Dictionary serializedAdditionalRawData) + { + TargetParticipants = targetParticipants; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MuteParticipantsRequestInternal() + { + } + /// /// Participants to be muted from the call. /// Only ACS Users are supported. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs index 617bafaa5485..7b80f0c1745a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class MuteParticipantsResult + public partial class MuteParticipantsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MuteParticipantsResult DeserializeMuteParticipantsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MuteParticipantsResult DeserializeMuteParticipantsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -26,8 +60,61 @@ internal static MuteParticipantsResult DeserializeMuteParticipantsResult(JsonEle operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MuteParticipantsResult(operationContext.Value); + return new MuteParticipantsResult(operationContext.Value, serializedAdditionalRawData); + } + + MuteParticipantsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMuteParticipantsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MuteParticipantsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMuteParticipantsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MuteParticipantsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MuteParticipantsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMuteParticipantsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs index aca681bb6414..7477ea472cc1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The response payload for muting participants from the call. public partial class MuteParticipantsResult { - /// Initializes a new instance of MuteParticipantsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MuteParticipantsResult() { } - /// Initializes a new instance of MuteParticipantsResult. + /// Initializes a new instance of . /// The operation context provided by client. - internal MuteParticipantsResult(string operationContext) + /// Keeps track of any properties unknown to the library. + internal MuteParticipantsResult(string operationContext, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation context provided by client. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs index 77b306e8039e..eb267c833419 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs @@ -5,16 +5,80 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class ParticipantsUpdatedInternal + internal partial class ParticipantsUpdatedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(SequenceNumber)) + { + writer.WritePropertyName("sequenceNumber"u8); + writer.WriteNumberValue(SequenceNumber.Value); + } + if (Optional.IsCollectionDefined(Participants)) + { + writer.WritePropertyName("participants"u8); + writer.WriteStartArray(); + foreach (var item in Participants) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +88,7 @@ internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedIntern Optional correlationId = default; Optional sequenceNumber = default; Optional> participants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -64,8 +129,61 @@ internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedIntern participants = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ParticipantsUpdatedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, Optional.ToNullable(sequenceNumber), Optional.ToList(participants)); + return new ParticipantsUpdatedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, Optional.ToNullable(sequenceNumber), Optional.ToList(participants), serializedAdditionalRawData); + } + + ParticipantsUpdatedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantsUpdatedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantsUpdatedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantsUpdatedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantsUpdatedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantsUpdatedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantsUpdatedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs index 7d9055aa0e65..c9f6ebaf7f70 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.Communication.CallAutomation /// The participants updated in a call event. internal partial class ParticipantsUpdatedInternal { - /// Initializes a new instance of ParticipantsUpdatedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ParticipantsUpdatedInternal() { Participants = new ChangeTrackingList(); } - /// Initializes a new instance of ParticipantsUpdatedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The Sequence Number of the event. /// The list of participants in the call. - internal ParticipantsUpdatedInternal(string callConnectionId, string serverCallId, string correlationId, int? sequenceNumber, IReadOnlyList participants) + /// Keeps track of any properties unknown to the library. + internal ParticipantsUpdatedInternal(string callConnectionId, string serverCallId, string correlationId, int? sequenceNumber, IReadOnlyList participants, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; SequenceNumber = sequenceNumber; Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs index dce7185be6bd..004f3f6df1a9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable + internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element) + internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -34,8 +57,61 @@ internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberIdentifierModel(value, serializedAdditionalRawData); + } + + PhoneNumberIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberIdentifierModel model) + { + if (model is null) + { + return null; } - return new PhoneNumberIdentifierModel(value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.cs index d9416ecf4e45..0a9a484b4f83 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PhoneNumberIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A phone number. internal partial class PhoneNumberIdentifierModel { - /// Initializes a new instance of PhoneNumberIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The phone number in E.164 format. /// is null. public PhoneNumberIdentifierModel(string value) @@ -23,6 +27,20 @@ public PhoneNumberIdentifierModel(string value) Value = value; } + /// Initializes a new instance of . + /// The phone number in E.164 format. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberIdentifierModel(string value, Dictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberIdentifierModel() + { + } + /// The phone number in E.164 format. public string Value { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs index b3b143956915..dcdfeb7d1dda 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class PlayCanceled + public partial class PlayCanceled : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PlayCanceled DeserializePlayCanceled(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PlayCanceled DeserializePlayCanceled(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static PlayCanceled DeserializePlayCanceled(JsonElement element) Optional serverCallId = default; Optional correlationId = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -44,8 +93,61 @@ internal static PlayCanceled DeserializePlayCanceled(JsonElement element) operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PlayCanceled(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value); + return new PlayCanceled(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, serializedAdditionalRawData); + } + + PlayCanceled IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayCanceled(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayCanceled IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayCanceled(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayCanceled model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayCanceled(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayCanceled(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs index 7cec639fdd6a..50b4c33cee22 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The PlayCanceled. public partial class PlayCanceled { - /// Initializes a new instance of PlayCanceled. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PlayCanceled() { } - /// Initializes a new instance of PlayCanceled. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// Used by customers when calling mid-call actions to correlate the request to the response event. - internal PlayCanceled(string callConnectionId, string serverCallId, string correlationId, string operationContext) + /// Keeps track of any properties unknown to the library. + internal PlayCanceled(string callConnectionId, string serverCallId, string correlationId, string operationContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs index a427cdb86527..260a5322db9e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class PlayCompleted + public partial class PlayCompleted : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PlayCompleted DeserializePlayCompleted(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PlayCompleted DeserializePlayCompleted(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static PlayCompleted DeserializePlayCompleted(JsonElement element) Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static PlayCompleted DeserializePlayCompleted(JsonElement element) resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PlayCompleted(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new PlayCompleted(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + PlayCompleted IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayCompleted(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayCompleted IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayCompleted(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayCompleted model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayCompleted(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayCompleted(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs index b928f1fa7af0..b8923e472231 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs @@ -5,14 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The PlayCompleted. public partial class PlayCompleted { - /// Initializes a new instance of PlayCompleted. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PlayCompleted() { } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Keeps track of any properties unknown to the library. + internal PlayCompleted(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs index 0f69679e71c0..2bddedd27356 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class PlayFailed + public partial class PlayFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PlayFailed DeserializePlayFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PlayFailed DeserializePlayFailed(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static PlayFailed DeserializePlayFailed(JsonElement element) Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static PlayFailed DeserializePlayFailed(JsonElement element) resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PlayFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new PlayFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + PlayFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs index 9086073e42d0..942fdb36ba88 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs @@ -5,14 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The PlayFailed. public partial class PlayFailed { - /// Initializes a new instance of PlayFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PlayFailed() { } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Keeps track of any properties unknown to the library. + internal PlayFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.Serialization.cs index 381740b2ef7a..f2c638f8a3e4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class PlayOptionsInternal : IUtf8JsonSerializable + internal partial class PlayOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("loop"u8); writer.WriteBooleanValue(Loop); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PlayOptionsInternal DeserializePlayOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool loop = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loop"u8)) + { + loop = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlayOptionsInternal(loop, serializedAdditionalRawData); + } + + PlayOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.cs index f20d29808e38..eba6a4108ca0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayOptionsInternal.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The PlayOptions. internal partial class PlayOptionsInternal { - /// Initializes a new instance of PlayOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The option to play the provided audio source in loop when set to true. public PlayOptionsInternal(bool loop) { Loop = loop; } + /// Initializes a new instance of . + /// The option to play the provided audio source in loop when set to true. + /// Keeps track of any properties unknown to the library. + internal PlayOptionsInternal(bool loop, Dictionary serializedAdditionalRawData) + { + Loop = loop; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlayOptionsInternal() + { + } + /// The option to play the provided audio source in loop when set to true. public bool Loop { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.Serialization.cs index 143d2d58fee6..79425a089ff6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.Serialization.cs @@ -5,32 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class PlayRequestInternal : IUtf8JsonSerializable + internal partial class PlayRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("playSourceInfo"u8); - writer.WriteObjectValue(PlaySourceInfo); + if (PlaySourceInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlaySourceInfo).Serialize(writer, options); + } if (Optional.IsCollectionDefined(PlayTo)) { writer.WritePropertyName("playTo"u8); writer.WriteStartArray(); foreach (var item in PlayTo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(PlayOptions)) { writer.WritePropertyName("playOptions"u8); - writer.WriteObjectValue(PlayOptions); + if (PlayOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlayOptions).Serialize(writer, options); + } } if (Optional.IsDefined(OperationContext)) { @@ -42,7 +72,130 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PlayRequestInternal DeserializePlayRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaySourceInternal playSourceInfo = default; + Optional> playTo = default; + Optional playOptions = default; + Optional operationContext = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("playSourceInfo"u8)) + { + playSourceInfo = PlaySourceInternal.DeserializePlaySourceInternal(property.Value); + continue; + } + if (property.NameEquals("playTo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + playTo = array; + continue; + } + if (property.NameEquals("playOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + playOptions = PlayOptionsInternal.DeserializePlayOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlayRequestInternal(playSourceInfo, Optional.ToList(playTo), playOptions.Value, operationContext.Value, callbackUri.Value, serializedAdditionalRawData); + } + + PlayRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.cs index aa290fb3caa3..590f8810de88 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayRequestInternal.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The PlayRequest. internal partial class PlayRequestInternal { - /// Initializes a new instance of PlayRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The source of the audio to be played. /// is null. public PlayRequestInternal(PlaySourceInternal playSourceInfo) @@ -26,6 +29,31 @@ public PlayRequestInternal(PlaySourceInternal playSourceInfo) PlayTo = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The source of the audio to be played. + /// + /// The list of call participants play provided audio to. + /// Plays to everyone in the call when not provided. + /// + /// Defines options for playing the audio. + /// The value to identify context of the operation. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal PlayRequestInternal(PlaySourceInternal playSourceInfo, IList playTo, PlayOptionsInternal playOptions, string operationContext, string callbackUri, Dictionary serializedAdditionalRawData) + { + PlaySourceInfo = playSourceInfo; + PlayTo = playTo; + PlayOptions = playOptions; + OperationContext = operationContext; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlayRequestInternal() + { + } + /// The source of the audio to be played. public PlaySourceInternal PlaySourceInfo { get; } /// Defines options for playing the audio. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.Serialization.cs index eca5ba2cf7f7..341c408a969a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class PlaySourceInternal : IUtf8JsonSerializable + internal partial class PlaySourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceType"u8); writer.WriteStringValue(SourceType.ToString()); @@ -25,19 +33,162 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(FileSource)) { writer.WritePropertyName("fileSource"u8); - writer.WriteObjectValue(FileSource); + if (FileSource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FileSource).Serialize(writer, options); + } } if (Optional.IsDefined(TextSource)) { writer.WritePropertyName("textSource"u8); - writer.WriteObjectValue(TextSource); + if (TextSource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TextSource).Serialize(writer, options); + } } if (Optional.IsDefined(SsmlSource)) { writer.WritePropertyName("ssmlSource"u8); - writer.WriteObjectValue(SsmlSource); + if (SsmlSource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SsmlSource).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static PlaySourceInternal DeserializePlaySourceInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaySourceTypeInternal sourceType = default; + Optional playSourceId = default; + Optional fileSource = default; + Optional textSource = default; + Optional ssmlSource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceType"u8)) + { + sourceType = new PlaySourceTypeInternal(property.Value.GetString()); + continue; + } + if (property.NameEquals("playSourceId"u8)) + { + playSourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fileSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSource = FileSourceInternal.DeserializeFileSourceInternal(property.Value); + continue; + } + if (property.NameEquals("textSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + textSource = TextSourceInternal.DeserializeTextSourceInternal(property.Value); + continue; + } + if (property.NameEquals("ssmlSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ssmlSource = SsmlSourceInternal.DeserializeSsmlSourceInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlaySourceInternal(sourceType, playSourceId.Value, fileSource.Value, textSource.Value, ssmlSource.Value, serializedAdditionalRawData); + } + + PlaySourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlaySourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlaySourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlaySourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlaySourceInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlaySourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlaySourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.cs index c6b69e0b497e..9c660917356f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlaySourceInternal.cs @@ -5,18 +5,46 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The PlaySource. internal partial class PlaySourceInternal { - /// Initializes a new instance of PlaySourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the type of the play source. public PlaySourceInternal(PlaySourceTypeInternal sourceType) { SourceType = sourceType; } + /// Initializes a new instance of . + /// Defines the type of the play source. + /// Defines the identifier to be used for caching related media. + /// Defines the file source info to be used for play. + /// Defines the text source info to be used for play. + /// Defines the ssml(Speech Synthesis Markup Language) source info to be used for play. + /// Keeps track of any properties unknown to the library. + internal PlaySourceInternal(PlaySourceTypeInternal sourceType, string playSourceId, FileSourceInternal fileSource, TextSourceInternal textSource, SsmlSourceInternal ssmlSource, Dictionary serializedAdditionalRawData) + { + SourceType = sourceType; + PlaySourceId = playSourceId; + FileSource = fileSource; + TextSource = textSource; + SsmlSource = ssmlSource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlaySourceInternal() + { + } + /// Defines the type of the play source. public PlaySourceTypeInternal SourceType { get; } /// Defines the identifier to be used for caching related media. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs index 1653f4d7d1bc..0dad1b4c6e7b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class RecognizeCanceled + public partial class RecognizeCanceled : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecognizeCanceled DeserializeRecognizeCanceled(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecognizeCanceled DeserializeRecognizeCanceled(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static RecognizeCanceled DeserializeRecognizeCanceled(JsonElement eleme Optional serverCallId = default; Optional correlationId = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -44,8 +93,61 @@ internal static RecognizeCanceled DeserializeRecognizeCanceled(JsonElement eleme operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecognizeCanceled(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value); + return new RecognizeCanceled(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, serializedAdditionalRawData); + } + + RecognizeCanceled IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeCanceled(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeCanceled IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeCanceled(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeCanceled model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeCanceled(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeCanceled(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs index e3b3124293f5..e6bbd0aea74a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The RecognizeCanceled. public partial class RecognizeCanceled { - /// Initializes a new instance of RecognizeCanceled. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecognizeCanceled() { } - /// Initializes a new instance of RecognizeCanceled. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// Used by customers when calling mid-call actions to correlate the request to the response event. - internal RecognizeCanceled(string callConnectionId, string serverCallId, string correlationId, string operationContext) + /// Keeps track of any properties unknown to the library. + internal RecognizeCanceled(string callConnectionId, string serverCallId, string correlationId, string operationContext, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.Serialization.cs index a3aee2b3360f..e15b5218f8cd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class RecognizeChoice : IUtf8JsonSerializable + public partial class RecognizeChoice : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("label"u8); writer.WriteStringValue(Label); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tone"u8); writer.WriteStringValue(Tone.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RecognizeChoice DeserializeRecognizeChoice(JsonElement element) + internal static RecognizeChoice DeserializeRecognizeChoice(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +63,7 @@ internal static RecognizeChoice DeserializeRecognizeChoice(JsonElement element) string label = default; IList phrases = default; Optional tone = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("label"u8)) @@ -68,8 +90,61 @@ internal static RecognizeChoice DeserializeRecognizeChoice(JsonElement element) tone = new DtmfTone(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecognizeChoice(label, phrases, Optional.ToNullable(tone), serializedAdditionalRawData); + } + + RecognizeChoice IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeChoice(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeChoice IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeChoice(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeChoice model) + { + if (model is null) + { + return null; } - return new RecognizeChoice(label, phrases, Optional.ToNullable(tone)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeChoice(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeChoice(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.cs index cd2a29ac9f46..026c3c7285d0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeChoice.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The Choice. public partial class RecognizeChoice { - /// Initializes a new instance of RecognizeChoice. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Identifier for a given choice. /// List of phrases to recognize. /// or is null. @@ -28,15 +31,22 @@ public RecognizeChoice(string label, IEnumerable phrases) Phrases = phrases.ToList(); } - /// Initializes a new instance of RecognizeChoice. + /// Initializes a new instance of . /// Identifier for a given choice. /// List of phrases to recognize. /// - internal RecognizeChoice(string label, IList phrases, DtmfTone? tone) + /// Keeps track of any properties unknown to the library. + internal RecognizeChoice(string label, IList phrases, DtmfTone? tone, Dictionary serializedAdditionalRawData) { Label = label; Phrases = phrases; Tone = tone; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RecognizeChoice() + { } /// Identifier for a given choice. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs index 5dac41a9dfb6..241673aa86ee 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs @@ -5,15 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RecognizeCompletedInternal + internal partial class RecognizeCompletedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(RecognitionType)) + { + writer.WritePropertyName("recognitionType"u8); + writer.WriteStringValue(RecognitionType.ToString()); + } + if (Optional.IsDefined(CollectTonesResult)) + { + writer.WritePropertyName("collectTonesResult"u8); + if (CollectTonesResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CollectTonesResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(DtmfResult)) + { + writer.WritePropertyName("dtmfResult"u8); + if (DtmfResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DtmfResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(ChoiceResult)) + { + writer.WritePropertyName("choiceResult"u8); + if (ChoiceResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ChoiceResult).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +129,7 @@ internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal Optional dtmfResult = default; Optional choiceResult = default; Optional speechResult = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -104,8 +206,61 @@ internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal speechResult = SpeechResult.DeserializeSpeechResult(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecognizeCompletedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, recognitionType, collectTonesResult.Value, dtmfResult.Value, choiceResult.Value, speechResult.Value, serializedAdditionalRawData); + } + + RecognizeCompletedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeCompletedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeCompletedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeCompletedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeCompletedInternal model) + { + if (model is null) + { + return null; } - return new RecognizeCompletedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, recognitionType, collectTonesResult.Value, dtmfResult.Value, choiceResult.Value, speechResult.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeCompletedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeCompletedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs index d51b3839657c..0e59711b35e1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The RecognizeCompleted. internal partial class RecognizeCompletedInternal { - /// Initializes a new instance of RecognizeCompletedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecognizeCompletedInternal() { } - /// Initializes a new instance of RecognizeCompletedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. @@ -32,7 +38,8 @@ internal RecognizeCompletedInternal() /// Defines the result for RecognitionType = Dtmf. /// Defines the result for RecognitionType = Choices. /// Defines the result for RecognitionType = Speech and SpeechOrDtmf. - internal RecognizeCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CallMediaRecognitionType recognitionType, CollectTonesResult collectTonesResult, DtmfResult dtmfResult, ChoiceResult choiceResult, SpeechResult speechResult) + /// Keeps track of any properties unknown to the library. + internal RecognizeCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CallMediaRecognitionType recognitionType, CollectTonesResult collectTonesResult, DtmfResult dtmfResult, ChoiceResult choiceResult, SpeechResult speechResult, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -44,6 +51,7 @@ internal RecognizeCompletedInternal(string callConnectionId, string serverCallId DtmfResult = dtmfResult; ChoiceResult = choiceResult; SpeechResult = speechResult; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// /// Defines the result for RecognitionType = Dtmf diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs index 2d436de10af4..91a30fdc04ed 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class RecognizeFailed + public partial class RecognizeFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecognizeFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new RecognizeFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + RecognizeFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs index 2a17792464ef..cab80291440d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs @@ -5,14 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The RecognizeFailed. public partial class RecognizeFailed { - /// Initializes a new instance of RecognizeFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecognizeFailed() { } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Keeps track of any properties unknown to the library. + internal RecognizeFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs index 64e657456221..cc249d6da456 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RecognizeOptionsInternal : IUtf8JsonSerializable + internal partial class RecognizeOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InterruptPrompt)) { @@ -26,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(InitialSilenceTimeoutInSeconds.Value); } writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + if (TargetParticipant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TargetParticipant).Serialize(writer, options); + } if (Optional.IsDefined(SpeechLanguage)) { writer.WritePropertyName("speechLanguage"u8); @@ -40,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DtmfOptions)) { writer.WritePropertyName("dtmfOptions"u8); - writer.WriteObjectValue(DtmfOptions); + if (DtmfOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DtmfOptions).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Choices)) { @@ -48,16 +71,183 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Choices) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(SpeechOptions)) { writer.WritePropertyName("speechOptions"u8); - writer.WriteObjectValue(SpeechOptions); + if (SpeechOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SpeechOptions).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static RecognizeOptionsInternal DeserializeRecognizeOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional interruptPrompt = default; + Optional initialSilenceTimeoutInSeconds = default; + CommunicationIdentifierModel targetParticipant = default; + Optional speechLanguage = default; + Optional speechRecognitionModelEndpointId = default; + Optional dtmfOptions = default; + Optional> choices = default; + Optional speechOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("interruptPrompt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interruptPrompt = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("initialSilenceTimeoutInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialSilenceTimeoutInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("targetParticipant"u8)) + { + targetParticipant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("speechLanguage"u8)) + { + speechLanguage = property.Value.GetString(); + continue; + } + if (property.NameEquals("speechRecognitionModelEndpointId"u8)) + { + speechRecognitionModelEndpointId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dtmfOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dtmfOptions = DtmfOptionsInternal.DeserializeDtmfOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("choices"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RecognizeChoice.DeserializeRecognizeChoice(item)); + } + choices = array; + continue; + } + if (property.NameEquals("speechOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + speechOptions = SpeechOptionsInternal.DeserializeSpeechOptionsInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecognizeOptionsInternal(Optional.ToNullable(interruptPrompt), Optional.ToNullable(initialSilenceTimeoutInSeconds), targetParticipant, speechLanguage.Value, speechRecognitionModelEndpointId.Value, dtmfOptions.Value, Optional.ToList(choices), speechOptions.Value, serializedAdditionalRawData); + } + + RecognizeOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.cs index 75c7747ba747..6fdceda0f1cb 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The RecognizeOptions. internal partial class RecognizeOptionsInternal { - /// Initializes a new instance of RecognizeOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Target participant of DTMF tone recognition. /// is null. public RecognizeOptionsInternal(CommunicationIdentifierModel targetParticipant) @@ -26,6 +29,34 @@ public RecognizeOptionsInternal(CommunicationIdentifierModel targetParticipant) Choices = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Determines if we interrupt the prompt and start recognizing. + /// Time to wait for first input after prompt (if any). + /// Target participant of DTMF tone recognition. + /// Speech language to be recognized, If not set default is en-US. + /// Endpoint where the custom model was deployed. + /// Defines configurations for DTMF. + /// Defines Ivr choices for recognize. + /// Defines continuous speech recognition option. + /// Keeps track of any properties unknown to the library. + internal RecognizeOptionsInternal(bool? interruptPrompt, int? initialSilenceTimeoutInSeconds, CommunicationIdentifierModel targetParticipant, string speechLanguage, string speechRecognitionModelEndpointId, DtmfOptionsInternal dtmfOptions, IList choices, SpeechOptionsInternal speechOptions, Dictionary serializedAdditionalRawData) + { + InterruptPrompt = interruptPrompt; + InitialSilenceTimeoutInSeconds = initialSilenceTimeoutInSeconds; + TargetParticipant = targetParticipant; + SpeechLanguage = speechLanguage; + SpeechRecognitionModelEndpointId = speechRecognitionModelEndpointId; + DtmfOptions = dtmfOptions; + Choices = choices; + SpeechOptions = speechOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RecognizeOptionsInternal() + { + } + /// Determines if we interrupt the prompt and start recognizing. public bool? InterruptPrompt { get; set; } /// Time to wait for first input after prompt (if any). diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs index f9734e52501c..d9164e7e0257 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RecognizeRequestInternal : IUtf8JsonSerializable + internal partial class RecognizeRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("recognizeInputType"u8); writer.WriteStringValue(RecognizeInputType.ToString()); if (Optional.IsDefined(PlayPrompt)) { writer.WritePropertyName("playPrompt"u8); - writer.WriteObjectValue(PlayPrompt); + if (PlayPrompt is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlayPrompt).Serialize(writer, options); + } } if (Optional.IsDefined(InterruptCallMediaOperation)) { @@ -28,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(InterruptCallMediaOperation.Value); } writer.WritePropertyName("recognizeOptions"u8); - writer.WriteObjectValue(RecognizeOptions); + if (RecognizeOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RecognizeOptions).Serialize(writer, options); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); @@ -39,7 +61,131 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RecognizeRequestInternal DeserializeRecognizeRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RecognizeInputType recognizeInputType = default; + Optional playPrompt = default; + Optional interruptCallMediaOperation = default; + RecognizeOptionsInternal recognizeOptions = default; + Optional operationContext = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("recognizeInputType"u8)) + { + recognizeInputType = new RecognizeInputType(property.Value.GetString()); + continue; + } + if (property.NameEquals("playPrompt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + playPrompt = PlaySourceInternal.DeserializePlaySourceInternal(property.Value); + continue; + } + if (property.NameEquals("interruptCallMediaOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interruptCallMediaOperation = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("recognizeOptions"u8)) + { + recognizeOptions = RecognizeOptionsInternal.DeserializeRecognizeOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecognizeRequestInternal(recognizeInputType, playPrompt.Value, Optional.ToNullable(interruptCallMediaOperation), recognizeOptions, operationContext.Value, callbackUri.Value, serializedAdditionalRawData); + } + + RecognizeRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs index 0e4fd7152ffe..3f4b8f9faa01 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The RecognizeRequest. internal partial class RecognizeRequestInternal { - /// Initializes a new instance of RecognizeRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Determines the type of the recognition. /// Defines options for recognition. /// is null. @@ -25,6 +29,30 @@ public RecognizeRequestInternal(RecognizeInputType recognizeInputType, Recognize RecognizeOptions = recognizeOptions; } + /// Initializes a new instance of . + /// Determines the type of the recognition. + /// The source of the audio to be played for recognition. + /// If set recognize can barge into other existing queued-up/currently-processing requests. + /// Defines options for recognition. + /// The value to identify context of the operation. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal RecognizeRequestInternal(RecognizeInputType recognizeInputType, PlaySourceInternal playPrompt, bool? interruptCallMediaOperation, RecognizeOptionsInternal recognizeOptions, string operationContext, string callbackUri, Dictionary serializedAdditionalRawData) + { + RecognizeInputType = recognizeInputType; + PlayPrompt = playPrompt; + InterruptCallMediaOperation = interruptCallMediaOperation; + RecognizeOptions = recognizeOptions; + OperationContext = operationContext; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RecognizeRequestInternal() + { + } + /// Determines the type of the recognition. public RecognizeInputType RecognizeInputType { get; } /// The source of the audio to be played for recognition. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs index 42059839df81..00f057bb7299 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs @@ -6,15 +6,62 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class RecordingStateChanged + public partial class RecordingStateChanged : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecordingStateChanged DeserializeRecordingStateChanged(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecordingStateChanged DeserializeRecordingStateChanged(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +72,7 @@ internal static RecordingStateChanged DeserializeRecordingStateChanged(JsonEleme Optional recordingId = default; Optional state = default; Optional startDateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -65,8 +113,61 @@ internal static RecordingStateChanged DeserializeRecordingStateChanged(JsonEleme startDateTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecordingStateChanged(callConnectionId.Value, serverCallId.Value, correlationId.Value, recordingId.Value, state, Optional.ToNullable(startDateTime)); + return new RecordingStateChanged(callConnectionId.Value, serverCallId.Value, correlationId.Value, recordingId.Value, state, Optional.ToNullable(startDateTime), serializedAdditionalRawData); + } + + RecordingStateChanged IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecordingStateChanged(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecordingStateChanged IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecordingStateChanged(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecordingStateChanged model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecordingStateChanged(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecordingStateChanged(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs index 788dd25c2f9f..666050c5561f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.CallAutomation { /// The RecordingStateChanged. public partial class RecordingStateChanged { - /// Initializes a new instance of RecordingStateChanged. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecordingStateChanged() { } - /// Initializes a new instance of RecordingStateChanged. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// The call recording id. /// /// The time of the recording started. - internal RecordingStateChanged(string callConnectionId, string serverCallId, string correlationId, string recordingId, RecordingState state, DateTimeOffset? startDateTime) + /// Keeps track of any properties unknown to the library. + internal RecordingStateChanged(string callConnectionId, string serverCallId, string correlationId, string recordingId, RecordingState state, DateTimeOffset? startDateTime, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -32,6 +37,7 @@ internal RecordingStateChanged(string callConnectionId, string serverCallId, str RecordingId = recordingId; State = state; StartDateTime = startDateTime; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The call recording id. public string RecordingId { get; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.Serialization.cs index f65ac7a01b97..e94e33b5c22e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class RecordingStateResult + public partial class RecordingStateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecordingStateResult DeserializeRecordingStateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RecordingId)) + { + writer.WritePropertyName("recordingId"u8); + writer.WriteStringValue(RecordingId); + } + if (Optional.IsDefined(RecordingState)) + { + writer.WritePropertyName("recordingState"u8); + writer.WriteStringValue(RecordingState.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecordingStateResult DeserializeRecordingStateResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional recordingId = default; Optional recordingState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("recordingId"u8)) @@ -36,8 +75,61 @@ internal static RecordingStateResult DeserializeRecordingStateResult(JsonElement recordingState = new RecordingState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecordingStateResult(recordingId.Value, Optional.ToNullable(recordingState)); + return new RecordingStateResult(recordingId.Value, Optional.ToNullable(recordingState), serializedAdditionalRawData); + } + + RecordingStateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecordingStateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecordingStateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecordingStateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecordingStateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecordingStateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecordingStateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.cs index b9dd8af48a85..3ffd7429beb7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The RecordingStateResponse. public partial class RecordingStateResult { - /// Initializes a new instance of RecordingStateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecordingStateResult() { } - /// Initializes a new instance of RecordingStateResult. + /// Initializes a new instance of . /// /// - internal RecordingStateResult(string recordingId, RecordingState? recordingState) + /// Keeps track of any properties unknown to the library. + internal RecordingStateResult(string recordingId, RecordingState? recordingState, Dictionary serializedAdditionalRawData) { RecordingId = recordingId; RecordingState = recordingState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the recording id. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs index c4d7608f7978..47b890ae92e9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs @@ -5,26 +5,151 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RedirectCallRequestInternal : IUtf8JsonSerializable + internal partial class RedirectCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("incomingCallContext"u8); writer.WriteStringValue(IncomingCallContext); writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } if (Optional.IsDefined(CustomContext)) { writer.WritePropertyName("customContext"u8); - writer.WriteObjectValue(CustomContext); + if (CustomContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomContext).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static RedirectCallRequestInternal DeserializeRedirectCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string incomingCallContext = default; + CommunicationIdentifierModel target = default; + Optional customContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("incomingCallContext"u8)) + { + incomingCallContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("customContext"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customContext = CustomContextInternal.DeserializeCustomContextInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RedirectCallRequestInternal(incomingCallContext, target, customContext.Value, serializedAdditionalRawData); + } + + RedirectCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRedirectCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RedirectCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRedirectCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RedirectCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RedirectCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRedirectCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.cs index 6f96b735c5e2..7f015f0c9a65 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RedirectCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for redirecting the call. internal partial class RedirectCallRequestInternal { - /// Initializes a new instance of RedirectCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The context associated with the call. /// The target identity to redirect the call to. /// or is null. @@ -27,6 +31,24 @@ public RedirectCallRequestInternal(string incomingCallContext, CommunicationIden Target = target; } + /// Initializes a new instance of . + /// The context associated with the call. + /// The target identity to redirect the call to. + /// Used by customer to send custom context to targets. + /// Keeps track of any properties unknown to the library. + internal RedirectCallRequestInternal(string incomingCallContext, CommunicationIdentifierModel target, CustomContextInternal customContext, Dictionary serializedAdditionalRawData) + { + IncomingCallContext = incomingCallContext; + Target = target; + CustomContext = customContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedirectCallRequestInternal() + { + } + /// The context associated with the call. public string IncomingCallContext { get; } /// The target identity to redirect the call to. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.Serialization.cs index f49a9065faa2..07e6bd1be16a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RejectCallRequestInternal : IUtf8JsonSerializable + internal partial class RejectCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("incomingCallContext"u8); writer.WriteStringValue(IncomingCallContext); @@ -22,7 +30,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callRejectReason"u8); writer.WriteStringValue(CallRejectReason.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RejectCallRequestInternal DeserializeRejectCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string incomingCallContext = default; + Optional callRejectReason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("incomingCallContext"u8)) + { + incomingCallContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callRejectReason"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callRejectReason = new CallRejectReason(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RejectCallRequestInternal(incomingCallContext, Optional.ToNullable(callRejectReason), serializedAdditionalRawData); + } + + RejectCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRejectCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RejectCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRejectCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RejectCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RejectCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRejectCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.cs index c0890b906cc0..a897654d4efe 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RejectCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for rejecting the call. internal partial class RejectCallRequestInternal { - /// Initializes a new instance of RejectCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The context associated with the call. /// is null. public RejectCallRequestInternal(string incomingCallContext) @@ -23,6 +27,22 @@ public RejectCallRequestInternal(string incomingCallContext) IncomingCallContext = incomingCallContext; } + /// Initializes a new instance of . + /// The context associated with the call. + /// The rejection reason. + /// Keeps track of any properties unknown to the library. + internal RejectCallRequestInternal(string incomingCallContext, CallRejectReason? callRejectReason, Dictionary serializedAdditionalRawData) + { + IncomingCallContext = incomingCallContext; + CallRejectReason = callRejectReason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RejectCallRequestInternal() + { + } + /// The context associated with the call. public string IncomingCallContext { get; } /// The rejection reason. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs index a2d3d590a6e2..0bc3fc296c28 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs @@ -5,16 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RemoveParticipantFailedInternal + internal partial class RemoveParticipantFailedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RemoveParticipantFailedInternal DeserializeRemoveParticipantFailedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(Participant)) + { + writer.WritePropertyName("participant"u8); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RemoveParticipantFailedInternal DeserializeRemoveParticipantFailedInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +97,7 @@ internal static RemoveParticipantFailedInternal DeserializeRemoveParticipantFail Optional operationContext = default; Optional resultInformation = default; Optional participant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -65,8 +138,61 @@ internal static RemoveParticipantFailedInternal DeserializeRemoveParticipantFail participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RemoveParticipantFailedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value); + return new RemoveParticipantFailedInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value, serializedAdditionalRawData); + } + + RemoveParticipantFailedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantFailedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveParticipantFailedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveParticipantFailedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveParticipantFailedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveParticipantFailedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveParticipantFailedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs index 50e3b793ab41..5491bc5b7e05 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallAutomation @@ -12,19 +14,23 @@ namespace Azure.Communication.CallAutomation /// The failed to remove participant event. internal partial class RemoveParticipantFailedInternal { - /// Initializes a new instance of RemoveParticipantFailedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RemoveParticipantFailedInternal() { } - /// Initializes a new instance of RemoveParticipantFailedInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code/sub-code and message from NGC services. /// Participant. - internal RemoveParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -32,6 +38,7 @@ internal RemoveParticipantFailedInternal(string callConnectionId, string serverC OperationContext = operationContext; ResultInformation = resultInformation; Participant = participant; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs index 73bdcc964717..16cd1f7653bc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs @@ -5,18 +5,34 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RemoveParticipantRequestInternal : IUtf8JsonSerializable + internal partial class RemoveParticipantRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("participantToRemove"u8); - writer.WriteObjectValue(ParticipantToRemove); + if (ParticipantToRemove is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ParticipantToRemove).Serialize(writer, options); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); @@ -27,7 +43,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RemoveParticipantRequestInternal DeserializeRemoveParticipantRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationIdentifierModel participantToRemove = default; + Optional operationContext = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("participantToRemove"u8)) + { + participantToRemove = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RemoveParticipantRequestInternal(participantToRemove, operationContext.Value, callbackUri.Value, serializedAdditionalRawData); + } + + RemoveParticipantRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveParticipantRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveParticipantRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveParticipantRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveParticipantRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveParticipantRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs index b1b668e22eea..90461656f120 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The remove participant by identifier request. internal partial class RemoveParticipantRequestInternal { - /// Initializes a new instance of RemoveParticipantRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The participants to be removed from the call. /// is null. public RemoveParticipantRequestInternal(CommunicationIdentifierModel participantToRemove) @@ -24,6 +28,24 @@ public RemoveParticipantRequestInternal(CommunicationIdentifierModel participant ParticipantToRemove = participantToRemove; } + /// Initializes a new instance of . + /// The participants to be removed from the call. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantRequestInternal(CommunicationIdentifierModel participantToRemove, string operationContext, string callbackUri, Dictionary serializedAdditionalRawData) + { + ParticipantToRemove = participantToRemove; + OperationContext = operationContext; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RemoveParticipantRequestInternal() + { + } + /// The participants to be removed from the call. public CommunicationIdentifierModel ParticipantToRemove { get; } /// Used by customers when calling mid-call actions to correlate the request to the response event. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.Serialization.cs index b3dbfebd967d..da3fc907f988 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RemoveParticipantResponseInternal + internal partial class RemoveParticipantResponseInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RemoveParticipantResponseInternal DeserializeRemoveParticipantResponseInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RemoveParticipantResponseInternal DeserializeRemoveParticipantResponseInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -26,8 +60,61 @@ internal static RemoveParticipantResponseInternal DeserializeRemoveParticipantRe operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RemoveParticipantResponseInternal(operationContext.Value); + return new RemoveParticipantResponseInternal(operationContext.Value, serializedAdditionalRawData); + } + + RemoveParticipantResponseInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantResponseInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveParticipantResponseInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveParticipantResponseInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveParticipantResponseInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveParticipantResponseInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveParticipantResponseInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.cs index 9e3654fc5117..92fb1c57b774 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantResponseInternal.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The response payload for removing participants of the call. internal partial class RemoveParticipantResponseInternal { - /// Initializes a new instance of RemoveParticipantResponseInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RemoveParticipantResponseInternal() { } - /// Initializes a new instance of RemoveParticipantResponseInternal. + /// Initializes a new instance of . /// The operation context provided by client. - internal RemoveParticipantResponseInternal(string operationContext) + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantResponseInternal(string operationContext, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation context provided by client. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs index 74663dd22292..3f9cd03c95b7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs @@ -5,16 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class RemoveParticipantSucceededInternal + internal partial class RemoveParticipantSucceededInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RemoveParticipantSucceededInternal DeserializeRemoveParticipantSucceededInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (Optional.IsDefined(Participant)) + { + writer.WritePropertyName("participant"u8); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RemoveParticipantSucceededInternal DeserializeRemoveParticipantSucceededInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +97,7 @@ internal static RemoveParticipantSucceededInternal DeserializeRemoveParticipantS Optional operationContext = default; Optional resultInformation = default; Optional participant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -65,8 +138,61 @@ internal static RemoveParticipantSucceededInternal DeserializeRemoveParticipantS participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RemoveParticipantSucceededInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value); + return new RemoveParticipantSucceededInternal(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, participant.Value, serializedAdditionalRawData); + } + + RemoveParticipantSucceededInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantSucceededInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveParticipantSucceededInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveParticipantSucceededInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveParticipantSucceededInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveParticipantSucceededInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveParticipantSucceededInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs index c159aac3febf..bec3496514a5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallAutomation @@ -12,19 +14,23 @@ namespace Azure.Communication.CallAutomation /// The participant removed event. internal partial class RemoveParticipantSucceededInternal { - /// Initializes a new instance of RemoveParticipantSucceededInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RemoveParticipantSucceededInternal() { } - /// Initializes a new instance of RemoveParticipantSucceededInternal. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code/sub-code and message from NGC services. /// Participant. - internal RemoveParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -32,6 +38,7 @@ internal RemoveParticipantSucceededInternal(string callConnectionId, string serv OperationContext = operationContext; ResultInformation = resultInformation; Participant = participant; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Call connection ID. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.Serialization.cs index 47b1f90f80a6..0e9944e8aae1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class ResultInformation + public partial class ResultInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResultInformation DeserializeResultInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteNumberValue(Code.Value); + } + if (Optional.IsDefined(SubCode)) + { + writer.WritePropertyName("subCode"u8); + writer.WriteNumberValue(SubCode.Value); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResultInformation DeserializeResultInformation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ResultInformation DeserializeResultInformation(JsonElement eleme Optional code = default; Optional subCode = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -46,8 +90,61 @@ internal static ResultInformation DeserializeResultInformation(JsonElement eleme message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResultInformation(Optional.ToNullable(code), Optional.ToNullable(subCode), message.Value); + return new ResultInformation(Optional.ToNullable(code), Optional.ToNullable(subCode), message.Value, serializedAdditionalRawData); + } + + ResultInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResultInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResultInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResultInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResultInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResultInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResultInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.cs index b32642c9e453..036171842401 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ResultInformation.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The ResultInformation. public partial class ResultInformation { - /// Initializes a new instance of ResultInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResultInformation() { } - /// Initializes a new instance of ResultInformation. + /// Initializes a new instance of . /// Code of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. /// Subcode of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. /// Detail message that describes the current result. - internal ResultInformation(int? code, int? subCode, string message) + /// Keeps track of any properties unknown to the library. + internal ResultInformation(int? code, int? subCode, string message, Dictionary serializedAdditionalRawData) { Code = code; SubCode = subCode; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Code of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.Serialization.cs index b7eaaf96bc45..41e034ec527f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class SendDtmfCompleted + public partial class SendDtmfCompleted : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SendDtmfCompleted DeserializeSendDtmfCompleted(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SendDtmfCompleted DeserializeSendDtmfCompleted(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static SendDtmfCompleted DeserializeSendDtmfCompleted(JsonElement eleme Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static SendDtmfCompleted DeserializeSendDtmfCompleted(JsonElement eleme resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SendDtmfCompleted(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new SendDtmfCompleted(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + SendDtmfCompleted IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendDtmfCompleted(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendDtmfCompleted IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendDtmfCompleted(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendDtmfCompleted model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendDtmfCompleted(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendDtmfCompleted(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.cs index 2f35cff84796..168451055273 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfCompleted.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The SendDtmfCompleted. public partial class SendDtmfCompleted { - /// Initializes a new instance of SendDtmfCompleted. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SendDtmfCompleted() { } - /// Initializes a new instance of SendDtmfCompleted. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code, sub-code and message. - internal SendDtmfCompleted(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + /// Keeps track of any properties unknown to the library. + internal SendDtmfCompleted(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.Serialization.cs index 4bf095ef3260..8f4ed91dbad5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.Serialization.cs @@ -5,15 +5,75 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class SendDtmfFailed + public partial class SendDtmfFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SendDtmfFailed DeserializeSendDtmfFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(ResultInformation)) + { + writer.WritePropertyName("resultInformation"u8); + if (ResultInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResultInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SendDtmfFailed DeserializeSendDtmfFailed(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +83,7 @@ internal static SendDtmfFailed DeserializeSendDtmfFailed(JsonElement element) Optional correlationId = default; Optional operationContext = default; Optional resultInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -54,8 +115,61 @@ internal static SendDtmfFailed DeserializeSendDtmfFailed(JsonElement element) resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SendDtmfFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value); + return new SendDtmfFailed(callConnectionId.Value, serverCallId.Value, correlationId.Value, operationContext.Value, resultInformation.Value, serializedAdditionalRawData); + } + + SendDtmfFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendDtmfFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendDtmfFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendDtmfFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendDtmfFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendDtmfFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendDtmfFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.cs index 15e625d941d7..140dba9e6760 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfFailed.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The SendDtmfFailed. public partial class SendDtmfFailed { - /// Initializes a new instance of SendDtmfFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SendDtmfFailed() { } - /// Initializes a new instance of SendDtmfFailed. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code, sub-code and message. - internal SendDtmfFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + /// Keeps track of any properties unknown to the library. + internal SendDtmfFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; OperationContext = operationContext; ResultInformation = resultInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.Serialization.cs index eb1c265cbddf..291a52e927d7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class SendDtmfRequestInternal : IUtf8JsonSerializable + internal partial class SendDtmfRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("tones"u8); writer.WriteStartArray(); @@ -23,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + if (TargetParticipant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TargetParticipant).Serialize(writer, options); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); @@ -34,7 +50,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SendDtmfRequestInternal DeserializeSendDtmfRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList tones = default; + CommunicationIdentifierModel targetParticipant = default; + Optional operationContext = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tones"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new DtmfTone(item.GetString())); + } + tones = array; + continue; + } + if (property.NameEquals("targetParticipant"u8)) + { + targetParticipant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SendDtmfRequestInternal(tones, targetParticipant, operationContext.Value, callbackUri.Value, serializedAdditionalRawData); + } + + SendDtmfRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendDtmfRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendDtmfRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendDtmfRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendDtmfRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendDtmfRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendDtmfRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.cs index b08a0e1e5a68..48c198f8dfb9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallAutomation /// The SendDtmfRequest. internal partial class SendDtmfRequestInternal { - /// Initializes a new instance of SendDtmfRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of tones to be sent to target participant. /// Target participant of send DTMF. /// or is null. @@ -29,6 +32,26 @@ public SendDtmfRequestInternal(IEnumerable tones, CommunicationIdentif TargetParticipant = targetParticipant; } + /// Initializes a new instance of . + /// List of tones to be sent to target participant. + /// Target participant of send DTMF. + /// The value to identify context of the operation. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal SendDtmfRequestInternal(IList tones, CommunicationIdentifierModel targetParticipant, string operationContext, string callbackUri, Dictionary serializedAdditionalRawData) + { + Tones = tones; + TargetParticipant = targetParticipant; + OperationContext = operationContext; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendDtmfRequestInternal() + { + } + /// List of tones to be sent to target participant. public IList Tones { get; } /// Target participant of send DTMF. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.Serialization.cs index d13218841d36..ae9fa884c809 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class SpeechOptionsInternal : IUtf8JsonSerializable + internal partial class SpeechOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EndSilenceTimeoutInMs)) { writer.WritePropertyName("endSilenceTimeoutInMs"u8); writer.WriteNumberValue(EndSilenceTimeoutInMs.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SpeechOptionsInternal DeserializeSpeechOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional endSilenceTimeoutInMs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endSilenceTimeoutInMs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endSilenceTimeoutInMs = property.Value.GetInt64(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SpeechOptionsInternal(Optional.ToNullable(endSilenceTimeoutInMs), serializedAdditionalRawData); + } + + SpeechOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSpeechOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SpeechOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSpeechOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SpeechOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SpeechOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSpeechOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.cs index 46988d0eff6a..fe480f8c7a95 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechOptionsInternal.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// Options for continuous speech recognition. internal partial class SpeechOptionsInternal { - /// Initializes a new instance of SpeechOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SpeechOptionsInternal() { } + /// Initializes a new instance of . + /// The length of end silence when user stops speaking and cogservice send response. + /// Keeps track of any properties unknown to the library. + internal SpeechOptionsInternal(long? endSilenceTimeoutInMs, Dictionary serializedAdditionalRawData) + { + EndSilenceTimeoutInMs = endSilenceTimeoutInMs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The length of end silence when user stops speaking and cogservice send response. public long? EndSilenceTimeoutInMs { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.Serialization.cs index 4a2cb4857623..a76bb86c3913 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class SpeechResult + public partial class SpeechResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SpeechResult DeserializeSpeechResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Speech)) + { + writer.WritePropertyName("speech"u8); + writer.WriteStringValue(Speech); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SpeechResult DeserializeSpeechResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional speech = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("speech"u8)) @@ -26,8 +60,61 @@ internal static SpeechResult DeserializeSpeechResult(JsonElement element) speech = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SpeechResult(speech.Value); + return new SpeechResult(speech.Value, serializedAdditionalRawData); + } + + SpeechResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSpeechResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SpeechResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSpeechResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SpeechResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SpeechResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSpeechResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs index 627320d3b285..c26723ecd1cd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The speech status as a result. public partial class SpeechResult { - /// Initializes a new instance of SpeechResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SpeechResult() { } - /// Initializes a new instance of SpeechResult. + /// Initializes a new instance of . /// The recognized speech in string. - internal SpeechResult(string speech) + /// Keeps track of any properties unknown to the library. + internal SpeechResult(string speech, Dictionary serializedAdditionalRawData) { Speech = speech; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The recognized speech in string. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.Serialization.cs index 0794b308c93a..ec805caa2977 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class SsmlSourceInternal : IUtf8JsonSerializable + internal partial class SsmlSourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("ssmlText"u8); writer.WriteStringValue(SsmlText); @@ -22,7 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("customVoiceEndpointId"u8); writer.WriteStringValue(CustomVoiceEndpointId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SsmlSourceInternal DeserializeSsmlSourceInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string ssmlText = default; + Optional customVoiceEndpointId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ssmlText"u8)) + { + ssmlText = property.Value.GetString(); + continue; + } + if (property.NameEquals("customVoiceEndpointId"u8)) + { + customVoiceEndpointId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SsmlSourceInternal(ssmlText, customVoiceEndpointId.Value, serializedAdditionalRawData); + } + + SsmlSourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSsmlSourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SsmlSourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSsmlSourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SsmlSourceInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SsmlSourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSsmlSourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.cs index 3ad406964e33..4af59daafc6a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SsmlSourceInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The SsmlSource. internal partial class SsmlSourceInternal { - /// Initializes a new instance of SsmlSourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Ssml string for the cognitive service to be played. /// is null. public SsmlSourceInternal(string ssmlText) @@ -23,6 +27,22 @@ public SsmlSourceInternal(string ssmlText) SsmlText = ssmlText; } + /// Initializes a new instance of . + /// Ssml string for the cognitive service to be played. + /// Endpoint where the custom voice was deployed. + /// Keeps track of any properties unknown to the library. + internal SsmlSourceInternal(string ssmlText, string customVoiceEndpointId, Dictionary serializedAdditionalRawData) + { + SsmlText = ssmlText; + CustomVoiceEndpointId = customVoiceEndpointId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SsmlSourceInternal() + { + } + /// Ssml string for the cognitive service to be played. public string SsmlText { get; } /// Endpoint where the custom voice was deployed. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs index 233a426655f4..b84665071455 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs @@ -5,18 +5,34 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class StartCallRecordingRequestInternal : IUtf8JsonSerializable + internal partial class StartCallRecordingRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("callLocator"u8); - writer.WriteObjectValue(CallLocator); + if (CallLocator is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CallLocator).Serialize(writer, options); + } if (Optional.IsDefined(RecordingStateCallbackUri)) { writer.WritePropertyName("recordingStateCallbackUri"u8); @@ -43,7 +59,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AudioChannelParticipantOrdering) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,16 +76,192 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ChannelAffinity) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(ExternalStorage)) { writer.WritePropertyName("externalStorage"u8); - writer.WriteObjectValue(ExternalStorage); + if (ExternalStorage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExternalStorage).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static StartCallRecordingRequestInternal DeserializeStartCallRecordingRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CallLocatorInternal callLocator = default; + Optional recordingStateCallbackUri = default; + Optional recordingContentType = default; + Optional recordingChannelType = default; + Optional recordingFormatType = default; + Optional> audioChannelParticipantOrdering = default; + Optional> channelAffinity = default; + Optional externalStorage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("callLocator"u8)) + { + callLocator = CallLocatorInternal.DeserializeCallLocatorInternal(property.Value); + continue; + } + if (property.NameEquals("recordingStateCallbackUri"u8)) + { + recordingStateCallbackUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("recordingContentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recordingContentType = new RecordingContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("recordingChannelType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recordingChannelType = new RecordingChannel(property.Value.GetString()); + continue; + } + if (property.NameEquals("recordingFormatType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recordingFormatType = new RecordingFormat(property.Value.GetString()); + continue; + } + if (property.NameEquals("audioChannelParticipantOrdering"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + audioChannelParticipantOrdering = array; + continue; + } + if (property.NameEquals("channelAffinity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ChannelAffinityInternal.DeserializeChannelAffinityInternal(item)); + } + channelAffinity = array; + continue; + } + if (property.NameEquals("externalStorage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + externalStorage = ExternalStorageInternal.DeserializeExternalStorageInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StartCallRecordingRequestInternal(callLocator, recordingStateCallbackUri.Value, Optional.ToNullable(recordingContentType), Optional.ToNullable(recordingChannelType), Optional.ToNullable(recordingFormatType), Optional.ToList(audioChannelParticipantOrdering), Optional.ToList(channelAffinity), externalStorage.Value, serializedAdditionalRawData); + } + + StartCallRecordingRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStartCallRecordingRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StartCallRecordingRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStartCallRecordingRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StartCallRecordingRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StartCallRecordingRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStartCallRecordingRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs index f6339c95c77a..10d871266199 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The request payload start for call recording operation with call locator. internal partial class StartCallRecordingRequestInternal { - /// Initializes a new instance of StartCallRecordingRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The call locator. /// is null. public StartCallRecordingRequestInternal(CallLocatorInternal callLocator) @@ -27,6 +30,44 @@ public StartCallRecordingRequestInternal(CallLocatorInternal callLocator) ChannelAffinity = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The call locator. + /// The uri to send notifications to. + /// The content type of call recording. + /// The channel type of call recording. + /// The format type of call recording. + /// + /// The sequential order in which audio channels are assigned to participants in the unmixed recording. + /// When 'recordingChannelType' is set to 'unmixed' and `audioChannelParticipantOrdering is not specified, + /// the audio channel to participant mapping will be automatically assigned based on the order in which participant + /// first audio was detected. Channel to participant mapping details can be found in the metadata of the recording. + /// + /// + /// The channel affinity of call recording + /// When 'recordingChannelType' is set to 'unmixed', if channelAffinity is not specified, 'channel' will be automatically assigned. + /// Channel-Participant mapping details can be found in the metadata of the recording. + /// /// + /// + /// Optional property to specify location where recording will be stored. + /// Keeps track of any properties unknown to the library. + internal StartCallRecordingRequestInternal(CallLocatorInternal callLocator, string recordingStateCallbackUri, RecordingContent? recordingContentType, RecordingChannel? recordingChannelType, RecordingFormat? recordingFormatType, IList audioChannelParticipantOrdering, IList channelAffinity, ExternalStorageInternal externalStorage, Dictionary serializedAdditionalRawData) + { + CallLocator = callLocator; + RecordingStateCallbackUri = recordingStateCallbackUri; + RecordingContentType = recordingContentType; + RecordingChannelType = recordingChannelType; + RecordingFormatType = recordingFormatType; + AudioChannelParticipantOrdering = audioChannelParticipantOrdering; + ChannelAffinity = channelAffinity; + ExternalStorage = externalStorage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StartCallRecordingRequestInternal() + { + } + /// The call locator. public CallLocatorInternal CallLocator { get; } /// The uri to send notifications to. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.Serialization.cs index ab4b2bb45342..105748ab1dc3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.Serialization.cs @@ -5,18 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class StartDialogRequestInternal : IUtf8JsonSerializable + internal partial class StartDialogRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dialogOptions"u8); - writer.WriteObjectValue(DialogOptions); + if (DialogOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DialogOptions).Serialize(writer, options); + } writer.WritePropertyName("dialogInputType"u8); writer.WriteStringValue(DialogInputType.ToString()); if (Optional.IsDefined(OperationContext)) @@ -24,7 +39,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StartDialogRequestInternal DeserializeStartDialogRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DialogOptionsInternal dialogOptions = default; + DialogInputType dialogInputType = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dialogOptions"u8)) + { + dialogOptions = DialogOptionsInternal.DeserializeDialogOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("dialogInputType"u8)) + { + dialogInputType = new DialogInputType(property.Value.GetString()); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StartDialogRequestInternal(dialogOptions, dialogInputType, operationContext.Value, serializedAdditionalRawData); + } + + StartDialogRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStartDialogRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StartDialogRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStartDialogRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StartDialogRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StartDialogRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStartDialogRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.cs index 94fb825f4e0d..cfd318a71ea0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartDialogRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The StartDialogRequest. internal partial class StartDialogRequestInternal { - /// Initializes a new instance of StartDialogRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines options for dialog. /// Determines the type of the dialog. /// is null. @@ -25,6 +29,24 @@ public StartDialogRequestInternal(DialogOptionsInternal dialogOptions, DialogInp DialogInputType = dialogInputType; } + /// Initializes a new instance of . + /// Defines options for dialog. + /// Determines the type of the dialog. + /// The value to identify context of the operation. + /// Keeps track of any properties unknown to the library. + internal StartDialogRequestInternal(DialogOptionsInternal dialogOptions, DialogInputType dialogInputType, string operationContext, Dictionary serializedAdditionalRawData) + { + DialogOptions = dialogOptions; + DialogInputType = dialogInputType; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StartDialogRequestInternal() + { + } + /// Defines options for dialog. public DialogOptionsInternal DialogOptions { get; } /// Determines the type of the dialog. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.Serialization.cs index 27ad60ec8107..f0e2facb16a6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class TextSourceInternal : IUtf8JsonSerializable + internal partial class TextSourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); @@ -37,7 +45,121 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("customVoiceEndpointId"u8); writer.WriteStringValue(CustomVoiceEndpointId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TextSourceInternal DeserializeTextSourceInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + Optional sourceLocale = default; + Optional voiceGender = default; + Optional voiceName = default; + Optional customVoiceEndpointId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceLocale"u8)) + { + sourceLocale = property.Value.GetString(); + continue; + } + if (property.NameEquals("voiceGender"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + voiceGender = new GenderType(property.Value.GetString()); + continue; + } + if (property.NameEquals("voiceName"u8)) + { + voiceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("customVoiceEndpointId"u8)) + { + customVoiceEndpointId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextSourceInternal(text, sourceLocale.Value, Optional.ToNullable(voiceGender), voiceName.Value, customVoiceEndpointId.Value, serializedAdditionalRawData); + } + + TextSourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextSourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextSourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextSourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextSourceInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TextSourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextSourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.cs index 1d18a5067e12..1c3e63adba3e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TextSourceInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -13,7 +14,10 @@ namespace Azure.Communication.CallAutomation /// The TextSource. internal partial class TextSourceInternal { - /// Initializes a new instance of TextSourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Text for the cognitive service to be played. /// is null. public TextSourceInternal(string text) @@ -23,6 +27,34 @@ public TextSourceInternal(string text) Text = text; } + /// Initializes a new instance of . + /// Text for the cognitive service to be played. + /// + /// Source language locale to be played + /// Refer to available locales here: <seealso href="https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts" /> + /// + /// Voice gender type. + /// + /// Voice name to be played + /// Refer to available Text-to-speech voices here: <seealso href="https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts" /> + /// + /// Endpoint where the custom voice was deployed. + /// Keeps track of any properties unknown to the library. + internal TextSourceInternal(string text, string sourceLocale, GenderType? voiceGender, string voiceName, string customVoiceEndpointId, Dictionary serializedAdditionalRawData) + { + Text = text; + SourceLocale = sourceLocale; + VoiceGender = voiceGender; + VoiceName = voiceName; + CustomVoiceEndpointId = customVoiceEndpointId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextSourceInternal() + { + } + /// Text for the cognitive service to be played. public string Text { get; } /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.Serialization.cs index 1f8bbf9bfeb6..1bcb2350f170 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class ToneInfo + public partial class ToneInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ToneInfo DeserializeToneInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("sequenceId"u8); + writer.WriteNumberValue(SequenceId); + writer.WritePropertyName("tone"u8); + writer.WriteStringValue(Tone.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ToneInfo DeserializeToneInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int sequenceId = default; DtmfTone tone = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sequenceId"u8)) @@ -32,8 +65,61 @@ internal static ToneInfo DeserializeToneInfo(JsonElement element) tone = new DtmfTone(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ToneInfo(sequenceId, tone); + return new ToneInfo(sequenceId, tone, serializedAdditionalRawData); + } + + ToneInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeToneInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ToneInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeToneInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ToneInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ToneInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeToneInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.cs index 9d8bec0d8013..f56bc0c662db 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ToneInfo.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The information about the tone. public partial class ToneInfo { - /// Initializes a new instance of ToneInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. /// internal ToneInfo(int sequenceId, DtmfTone tone) @@ -19,6 +25,22 @@ internal ToneInfo(int sequenceId, DtmfTone tone) Tone = tone; } + /// Initializes a new instance of . + /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. + /// + /// Keeps track of any properties unknown to the library. + internal ToneInfo(int sequenceId, DtmfTone tone, Dictionary serializedAdditionalRawData) + { + SequenceId = sequenceId; + Tone = tone; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ToneInfo() + { + } + /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. public int SequenceId { get; } /// Gets the tone. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs index 9849cf382a32..4193d91649f7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class TransferCallToParticipantResult + public partial class TransferCallToParticipantResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TransferCallToParticipantResult DeserializeTransferCallToParticipantResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TransferCallToParticipantResult DeserializeTransferCallToParticipantResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -26,8 +60,61 @@ internal static TransferCallToParticipantResult DeserializeTransferCallToPartici operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TransferCallToParticipantResult(operationContext.Value); + return new TransferCallToParticipantResult(operationContext.Value, serializedAdditionalRawData); + } + + TransferCallToParticipantResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferCallToParticipantResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferCallToParticipantResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferCallToParticipantResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferCallToParticipantResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferCallToParticipantResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferCallToParticipantResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.cs index d0fe132c94d2..b320ee256e67 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferCallToParticipantResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The response payload for transferring the call. public partial class TransferCallToParticipantResult { - /// Initializes a new instance of TransferCallToParticipantResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TransferCallToParticipantResult() { } - /// Initializes a new instance of TransferCallToParticipantResult. + /// Initializes a new instance of . /// The operation context provided by client. - internal TransferCallToParticipantResult(string operationContext) + /// Keeps track of any properties unknown to the library. + internal TransferCallToParticipantResult(string operationContext, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation context provided by client. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs index 4209a8a10b30..599c9041e82b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs @@ -5,22 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class TransferToParticipantRequestInternal : IUtf8JsonSerializable + internal partial class TransferToParticipantRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + if (TargetParticipant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TargetParticipant).Serialize(writer, options); + } if (Optional.IsDefined(CustomContext)) { writer.WritePropertyName("customContext"u8); - writer.WriteObjectValue(CustomContext); + if (CustomContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomContext).Serialize(writer, options); + } } if (Optional.IsDefined(OperationContext)) { @@ -30,14 +53,139 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Transferee)) { writer.WritePropertyName("transferee"u8); - writer.WriteObjectValue(Transferee); + if (Transferee is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Transferee).Serialize(writer, options); + } } if (Optional.IsDefined(CallbackUri)) { writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TransferToParticipantRequestInternal DeserializeTransferToParticipantRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationIdentifierModel targetParticipant = default; + Optional customContext = default; + Optional operationContext = default; + Optional transferee = default; + Optional callbackUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetParticipant"u8)) + { + targetParticipant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("customContext"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customContext = CustomContextInternal.DeserializeCustomContextInternal(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("transferee"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transferee = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferToParticipantRequestInternal(targetParticipant, customContext.Value, operationContext.Value, transferee.Value, callbackUri.Value, serializedAdditionalRawData); + } + + TransferToParticipantRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferToParticipantRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferToParticipantRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferToParticipantRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferToParticipantRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferToParticipantRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferToParticipantRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs index 0fdd0ceb227e..3b38265769e2 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for transferring call to a participant. internal partial class TransferToParticipantRequestInternal { - /// Initializes a new instance of TransferToParticipantRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The identity of the target where call should be transferred to. /// is null. public TransferToParticipantRequestInternal(CommunicationIdentifierModel targetParticipant) @@ -24,6 +28,28 @@ public TransferToParticipantRequestInternal(CommunicationIdentifierModel targetP TargetParticipant = targetParticipant; } + /// Initializes a new instance of . + /// The identity of the target where call should be transferred to. + /// Used by customer to send custom context to targets. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Transferee is the participant who is transferring the call. + /// The callback URI to override the main callback URI. + /// Keeps track of any properties unknown to the library. + internal TransferToParticipantRequestInternal(CommunicationIdentifierModel targetParticipant, CustomContextInternal customContext, string operationContext, CommunicationIdentifierModel transferee, string callbackUri, Dictionary serializedAdditionalRawData) + { + TargetParticipant = targetParticipant; + CustomContext = customContext; + OperationContext = operationContext; + Transferee = transferee; + CallbackUri = callbackUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TransferToParticipantRequestInternal() + { + } + /// The identity of the target where call should be transferred to. public CommunicationIdentifierModel TargetParticipant { get; } /// Used by customer to send custom context to targets. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.Serialization.cs index 059a7742b555..8edee278110d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.Serialization.cs @@ -5,21 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - internal partial class UnmuteParticipantsRequestInternal : IUtf8JsonSerializable + internal partial class UnmuteParticipantsRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targetParticipants"u8); writer.WriteStartArray(); foreach (var item in TargetParticipants) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(OperationContext)) @@ -27,7 +43,104 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UnmuteParticipantsRequestInternal DeserializeUnmuteParticipantsRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList targetParticipants = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetParticipants"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + targetParticipants = array; + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnmuteParticipantsRequestInternal(targetParticipants, operationContext.Value, serializedAdditionalRawData); + } + + UnmuteParticipantsRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnmuteParticipantsRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnmuteParticipantsRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnmuteParticipantsRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnmuteParticipantsRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnmuteParticipantsRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnmuteParticipantsRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.cs index 5f8a73cd3f74..5be16fc94d21 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallAutomation /// The request payload for unmuting participant from the call. internal partial class UnmuteParticipantsRequestInternal { - /// Initializes a new instance of UnmuteParticipantsRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Participants to be unmuted from the call. /// Only ACS Users are supported. @@ -29,6 +32,25 @@ public UnmuteParticipantsRequestInternal(IEnumerable Initializes a new instance of . + /// + /// Participants to be unmuted from the call. + /// Only ACS Users are supported. + /// + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Keeps track of any properties unknown to the library. + internal UnmuteParticipantsRequestInternal(IList targetParticipants, string operationContext, Dictionary serializedAdditionalRawData) + { + TargetParticipants = targetParticipants; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UnmuteParticipantsRequestInternal() + { + } + /// /// Participants to be unmuted from the call. /// Only ACS Users are supported. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs index a23c2a91a993..3dc7e698bcdc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class UnmuteParticipantsResult + public partial class UnmuteParticipantsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnmuteParticipantsResult DeserializeUnmuteParticipantsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnmuteParticipantsResult DeserializeUnmuteParticipantsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -26,8 +60,61 @@ internal static UnmuteParticipantsResult DeserializeUnmuteParticipantsResult(Jso operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UnmuteParticipantsResult(operationContext.Value); + return new UnmuteParticipantsResult(operationContext.Value, serializedAdditionalRawData); + } + + UnmuteParticipantsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnmuteParticipantsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnmuteParticipantsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnmuteParticipantsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnmuteParticipantsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnmuteParticipantsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnmuteParticipantsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs index 80dc112b86e3..636f1fecc62d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The response payload for unmuting participants from the call. public partial class UnmuteParticipantsResult { - /// Initializes a new instance of UnmuteParticipantsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UnmuteParticipantsResult() { } - /// Initializes a new instance of UnmuteParticipantsResult. + /// Initializes a new instance of . /// The operation context provided by client. - internal UnmuteParticipantsResult(string operationContext) + /// Keeps track of any properties unknown to the library. + internal UnmuteParticipantsResult(string operationContext, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation context provided by client. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.Serialization.cs index 0c72e9dbd56a..8177338325e4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallAutomation { - public partial class UserConsent + public partial class UserConsent : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UserConsent DeserializeUserConsent(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Recording)) + { + writer.WritePropertyName("recording"u8); + writer.WriteNumberValue(Recording.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UserConsent DeserializeUserConsent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional recording = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("recording"u8)) @@ -30,8 +64,61 @@ internal static UserConsent DeserializeUserConsent(JsonElement element) recording = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UserConsent(Optional.ToNullable(recording)); + return new UserConsent(Optional.ToNullable(recording), serializedAdditionalRawData); + } + + UserConsent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserConsent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserConsent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserConsent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserConsent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserConsent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserConsent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.cs index 52eda6d2df5a..b6c97bed112f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UserConsent.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallAutomation { /// The UserConsent. public partial class UserConsent { - /// Initializes a new instance of UserConsent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UserConsent() { } - /// Initializes a new instance of UserConsent. + /// Initializes a new instance of . /// - internal UserConsent(int? recording) + /// Keeps track of any properties unknown to the library. + internal UserConsent(int? recording, Dictionary serializedAdditionalRawData) { Recording = recording; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionsRestClient.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionsRestClient.cs index caa9ceb58acb..1f18df5fe37d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionsRestClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionsRestClient.cs @@ -242,9 +242,7 @@ internal HttpMessage CreateTransferToParticipantRequest(string callConnectionId, request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(transferToParticipantRequest); - request.Content = content; + request.Content = transferToParticipantRequest; return message; } @@ -398,9 +396,7 @@ internal HttpMessage CreateAddParticipantRequest(string callConnectionId, AddPar request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(addParticipantsRequest); - request.Content = content; + request.Content = addParticipantsRequest; return message; } @@ -484,9 +480,7 @@ internal HttpMessage CreateRemoveParticipantsRequest(string callConnectionId, Re request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(removeParticipantsRequest); - request.Content = content; + request.Content = removeParticipantsRequest; return message; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/CommunicationCallingServerModelFactory.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CommunicationCallingServerModelFactory.cs index 766de9cdd847..42d6e78ebfbb 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/CommunicationCallingServerModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CommunicationCallingServerModelFactory.cs @@ -14,42 +14,54 @@ namespace Azure.Communication.CallingServer /// Model factory for models. public static partial class CommunicationCallingServerModelFactory { - /// Initializes a new instance of TransferCallToParticipantResult. + /// Initializes a new instance of . /// The operation context provided by client. /// A new instance for mocking. public static TransferCallToParticipantResult TransferCallToParticipantResult(string operationContext = null) { - return new TransferCallToParticipantResult(operationContext); + return new TransferCallToParticipantResult(operationContext, default); } - /// Initializes a new instance of RemoveParticipantsResult. + /// Initializes a new instance of . + /// Time to wait between DTMF inputs to stop recognizing. + /// Maximum number of DTMF tones to be collected. + /// List of tones that will stop recognizing. + /// A new instance for mocking. + public static DtmfOptionsInternal DtmfOptionsInternal(int? interToneTimeoutInSeconds = null, int? maxTonesToCollect = null, IEnumerable stopTones = null) + { + stopTones ??= new List(); + + return new DtmfOptionsInternal(interToneTimeoutInSeconds, maxTonesToCollect, stopTones?.ToList(), default); + } + + /// Initializes a new instance of . /// The operation context provided by client. /// A new instance for mocking. public static RemoveParticipantsResult RemoveParticipantsResult(string operationContext = null) { - return new RemoveParticipantsResult(operationContext); + return new RemoveParticipantsResult(operationContext, default); } - /// Initializes a new instance of RecordingStateResult. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static RecordingStateResult RecordingStateResult(string recordingId = null, RecordingState? recordingState = null) { - return new RecordingStateResult(recordingId, recordingState); + return new RecordingStateResult(recordingId, recordingState, default); } - /// Initializes a new instance of ResultInformation. + /// Initializes a new instance of . /// /// /// /// A new instance for mocking. public static ResultInformation ResultInformation(int? code = null, int? subCode = null, string message = null) { - return new ResultInformation(code, subCode, message); + return new ResultInformation(code, subCode, message, default); } - /// Initializes a new instance of CallConnected. + /// Initializes a new instance of . /// /// Used to determine the version of the event. /// Used by customers when calling mid-call actions to correlate the request to the response event. @@ -61,10 +73,10 @@ public static ResultInformation ResultInformation(int? code = null, int? subCode /// A new instance for mocking. public static CallConnected CallConnected(string eventSource = null, string version = null, string operationContext = null, ResultInformation resultInformation = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new CallConnected(eventSource, version, operationContext, resultInformation, callConnectionId, serverCallId, correlationId, publicEventType); + return new CallConnected(eventSource, version, operationContext, resultInformation, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of CallDisconnected. + /// Initializes a new instance of . /// /// Used to determine the version of the event. /// Used by customers when calling mid-call actions to correlate the request to the response event. @@ -76,10 +88,10 @@ public static CallConnected CallConnected(string eventSource = null, string vers /// A new instance for mocking. public static CallDisconnected CallDisconnected(string eventSource = null, string version = null, string operationContext = null, ResultInformation resultInformation = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new CallDisconnected(eventSource, version, operationContext, resultInformation, callConnectionId, serverCallId, correlationId, publicEventType); + return new CallDisconnected(eventSource, version, operationContext, resultInformation, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of CallTransferAccepted. + /// Initializes a new instance of . /// /// /// @@ -91,10 +103,10 @@ public static CallDisconnected CallDisconnected(string eventSource = null, strin /// A new instance for mocking. public static CallTransferAccepted CallTransferAccepted(string eventSource = null, string operationContext = null, ResultInformation resultInformation = null, string version = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new CallTransferAccepted(eventSource, operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType); + return new CallTransferAccepted(eventSource, operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of CallTransferFailed. + /// Initializes a new instance of . /// /// /// @@ -106,10 +118,10 @@ public static CallTransferAccepted CallTransferAccepted(string eventSource = nul /// A new instance for mocking. public static CallTransferFailed CallTransferFailed(string eventSource = null, string operationContext = null, ResultInformation resultInformation = null, string version = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new CallTransferFailed(eventSource, operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType); + return new CallTransferFailed(eventSource, operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of CallRecordingStateChanged. + /// Initializes a new instance of . /// /// The call recording id. /// @@ -124,10 +136,10 @@ public static CallTransferFailed CallTransferFailed(string eventSource = null, s /// A new instance for mocking. public static CallRecordingStateChanged CallRecordingStateChanged(string eventSource = null, string recordingId = null, RecordingState state = default, DateTimeOffset? startDateTime = null, string version = null, string operationContext = null, ResultInformation resultInformation = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new CallRecordingStateChanged(eventSource, recordingId, state, startDateTime, version, operationContext, resultInformation, callConnectionId, serverCallId, correlationId, publicEventType); + return new CallRecordingStateChanged(eventSource, recordingId, state, startDateTime, version, operationContext, resultInformation, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of PlayCompleted. + /// Initializes a new instance of . /// /// /// Used to determine the version of the event. @@ -138,10 +150,10 @@ public static CallRecordingStateChanged CallRecordingStateChanged(string eventSo /// A new instance for mocking. public static PlayCompleted PlayCompleted(string operationContext = null, ResultInformation resultInformation = null, string version = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new PlayCompleted(operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType); + return new PlayCompleted(operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of PlayFailed. + /// Initializes a new instance of . /// /// /// @@ -153,10 +165,10 @@ public static PlayCompleted PlayCompleted(string operationContext = null, Result /// A new instance for mocking. public static PlayFailed PlayFailed(string eventSource = null, string operationContext = null, ResultInformation resultInformation = null, string version = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new PlayFailed(eventSource, operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType); + return new PlayFailed(eventSource, operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of RecognizeCompleted. + /// Initializes a new instance of . /// /// Result information defines the code, subcode and message. /// @@ -172,20 +184,20 @@ public static PlayFailed PlayFailed(string eventSource = null, string operationC /// A new instance for mocking. public static RecognizeCompleted RecognizeCompleted(string operationContext = null, ResultInformation resultInformation = null, CallMediaRecognitionType recognitionType = default, CollectTonesResult collectTonesResult = null, string version = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new RecognizeCompleted(operationContext, resultInformation, recognitionType, collectTonesResult, version, callConnectionId, serverCallId, correlationId, publicEventType); + return new RecognizeCompleted(operationContext, resultInformation, recognitionType, collectTonesResult, version, callConnectionId, serverCallId, correlationId, publicEventType, default); } - /// Initializes a new instance of CollectTonesResult. + /// Initializes a new instance of . /// /// A new instance for mocking. public static CollectTonesResult CollectTonesResult(IEnumerable tones = null) { tones ??= new List(); - return new CollectTonesResult(tones?.ToList()); + return new CollectTonesResult(tones?.ToList(), default); } - /// Initializes a new instance of RecognizeFailed. + /// Initializes a new instance of . /// /// /// Used to determine the version of the event. @@ -196,7 +208,7 @@ public static CollectTonesResult CollectTonesResult(IEnumerable tones /// A new instance for mocking. public static RecognizeFailed RecognizeFailed(string operationContext = null, ResultInformation resultInformation = null, string version = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string publicEventType = null) { - return new RecognizeFailed(operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType); + return new RecognizeFailed(operationContext, resultInformation, version, callConnectionId, serverCallId, correlationId, publicEventType, default); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/ContentRestClient.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/ContentRestClient.cs index d81d832fa72e..c7813b8d5ec7 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/ContentRestClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/ContentRestClient.cs @@ -51,9 +51,7 @@ internal HttpMessage CreatePlayRequest(string callConnectionId, PlayRequestInter uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(playRequest); - request.Content = content; + request.Content = playRequest; return message; } @@ -183,9 +181,7 @@ internal HttpMessage CreateRecognizeRequest(string callConnectionId, RecognizeRe uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(recognizeRequest); - request.Content = content; + request.Content = recognizeRequest; return message; } @@ -257,9 +253,7 @@ internal HttpMessage CreateRecordingRequest(StartCallRecordingRequestInternal st request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(startCallRecording); - request.Content = content; + request.Content = startCallRecording; return message; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.Serialization.cs index cd81a6c50197..6e24d406012a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.Serialization.cs @@ -5,22 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class AcsCallParticipantInternal + internal partial class AcsCallParticipantInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcsCallParticipantInternal DeserializeAcsCallParticipantInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } + } + if (Optional.IsDefined(IsMuted)) + { + writer.WritePropertyName("isMuted"u8); + writer.WriteBooleanValue(IsMuted.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcsCallParticipantInternal DeserializeAcsCallParticipantInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional identifier = default; Optional isMuted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identifier"u8)) @@ -41,8 +87,61 @@ internal static AcsCallParticipantInternal DeserializeAcsCallParticipantInternal isMuted = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcsCallParticipantInternal(identifier.Value, Optional.ToNullable(isMuted)); + return new AcsCallParticipantInternal(identifier.Value, Optional.ToNullable(isMuted), serializedAdditionalRawData); + } + + AcsCallParticipantInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcsCallParticipantInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcsCallParticipantInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcsCallParticipantInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcsCallParticipantInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcsCallParticipantInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcsCallParticipantInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.cs index c85245699f82..a5e9c4ccf049 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AcsCallParticipantInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallingServer @@ -12,18 +14,23 @@ namespace Azure.Communication.CallingServer /// The AcsCallParticipant. internal partial class AcsCallParticipantInternal { - /// Initializes a new instance of AcsCallParticipantInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AcsCallParticipantInternal() { } - /// Initializes a new instance of AcsCallParticipantInternal. + /// Initializes a new instance of . /// Communication identifier of the participant. /// Is participant muted. - internal AcsCallParticipantInternal(CommunicationIdentifierModel identifier, bool? isMuted) + /// Keeps track of any properties unknown to the library. + internal AcsCallParticipantInternal(CommunicationIdentifierModel identifier, bool? isMuted, Dictionary serializedAdditionalRawData) { Identifier = identifier; IsMuted = isMuted; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Communication identifier of the participant. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.Serialization.cs index 0de9fdc06104..51ade6800171 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class AddParticipantsFailedInternal + internal partial class AddParticipantsFailedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddParticipantsFailedInternal DeserializeAddParticipantsFailedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddParticipantsFailedInternal DeserializeAddParticipantsFailedInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +56,7 @@ internal static AddParticipantsFailedInternal DeserializeAddParticipantsFailedIn Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -89,8 +117,61 @@ internal static AddParticipantsFailedInternal DeserializeAddParticipantsFailedIn publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddParticipantsFailedInternal(eventSource.Value, operationContext.Value, resultInformation.Value, Optional.ToList(participants), version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new AddParticipantsFailedInternal(eventSource.Value, operationContext.Value, resultInformation.Value, Optional.ToList(participants), version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + AddParticipantsFailedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantsFailedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantsFailedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantsFailedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantsFailedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantsFailedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantsFailedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.cs index 3c14975e9a1f..de0f4032377d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsFailedInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.Communication.CallingServer /// The AddParticipantsFailedEvent. internal partial class AddParticipantsFailedInternal { - /// Initializes a new instance of AddParticipantsFailedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddParticipantsFailedInternal() { Participants = new ChangeTrackingList(); } - /// Initializes a new instance of AddParticipantsFailedInternal. + /// Initializes a new instance of . /// /// /// @@ -30,7 +34,8 @@ internal AddParticipantsFailedInternal() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal AddParticipantsFailedInternal(string eventSource, string operationContext, ResultInformation resultInformation, IReadOnlyList participants, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal AddParticipantsFailedInternal(string eventSource, string operationContext, ResultInformation resultInformation, IReadOnlyList participants, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; OperationContext = operationContext; @@ -41,6 +46,7 @@ internal AddParticipantsFailedInternal(string eventSource, string operationConte ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs index f695f0dbba26..667a46c8e058 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class AddParticipantsRequestInternal : IUtf8JsonSerializable + internal partial class AddParticipantsRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceCallerId)) { writer.WritePropertyName("sourceCallerId"u8); - writer.WriteObjectValue(SourceCallerId); + if (SourceCallerId is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceCallerId).Serialize(writer, options); + } } writer.WritePropertyName("participantsToAdd"u8); writer.WriteStartArray(); foreach (var item in ParticipantsToAdd) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(InvitationTimeoutInSeconds)) @@ -37,7 +60,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AddParticipantsRequestInternal DeserializeAddParticipantsRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sourceCallerId = default; + IList participantsToAdd = default; + Optional invitationTimeoutInSeconds = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceCallerId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceCallerId = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("participantsToAdd"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + participantsToAdd = array; + continue; + } + if (property.NameEquals("invitationTimeoutInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + invitationTimeoutInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddParticipantsRequestInternal(sourceCallerId.Value, participantsToAdd, Optional.ToNullable(invitationTimeoutInSeconds), operationContext.Value, serializedAdditionalRawData); + } + + AddParticipantsRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantsRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantsRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantsRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantsRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantsRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantsRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.cs index 6b2aba9c6b20..1448e5d20bd2 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallingServer /// The AddParticipantsRequest. internal partial class AddParticipantsRequestInternal { - /// Initializes a new instance of AddParticipantsRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The participants to invite. /// is null. public AddParticipantsRequestInternal(IEnumerable participantsToAdd) @@ -26,6 +29,29 @@ public AddParticipantsRequestInternal(IEnumerable ParticipantsToAdd = participantsToAdd.ToList(); } + /// Initializes a new instance of . + /// The source caller Id that's shown to the PSTN participant being invited. Required only when inviting a PSTN participant. + /// The participants to invite. + /// + /// Gets or sets the timeout to wait for the invited participant to pickup. + /// The maximum value of this is 180 seconds + /// + /// The operation context. + /// Keeps track of any properties unknown to the library. + internal AddParticipantsRequestInternal(PhoneNumberIdentifierModel sourceCallerId, IList participantsToAdd, int? invitationTimeoutInSeconds, string operationContext, Dictionary serializedAdditionalRawData) + { + SourceCallerId = sourceCallerId; + ParticipantsToAdd = participantsToAdd; + InvitationTimeoutInSeconds = invitationTimeoutInSeconds; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AddParticipantsRequestInternal() + { + } + /// The source caller Id that's shown to the PSTN participant being invited. Required only when inviting a PSTN participant. public PhoneNumberIdentifierModel SourceCallerId { get; set; } /// The participants to invite. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.Serialization.cs index f8a9495b74b8..9899a00a5f22 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class AddParticipantsResponseInternal + internal partial class AddParticipantsResponseInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddParticipantsResponseInternal DeserializeAddParticipantsResponseInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Participants)) + { + writer.WritePropertyName("participants"u8); + writer.WriteStartArray(); + foreach (var item in Participants) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddParticipantsResponseInternal DeserializeAddParticipantsResponseInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> participants = default; Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("participants"u8)) @@ -42,8 +92,61 @@ internal static AddParticipantsResponseInternal DeserializeAddParticipantsRespon operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddParticipantsResponseInternal(Optional.ToList(participants), operationContext.Value); + return new AddParticipantsResponseInternal(Optional.ToList(participants), operationContext.Value, serializedAdditionalRawData); + } + + AddParticipantsResponseInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantsResponseInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantsResponseInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantsResponseInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantsResponseInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantsResponseInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantsResponseInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.cs index 1ff384b9fadb..fc9ac2e57ae0 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsResponseInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.CallingServer /// The AddParticipantsResponse. internal partial class AddParticipantsResponseInternal { - /// Initializes a new instance of AddParticipantsResponseInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddParticipantsResponseInternal() { Participants = new ChangeTrackingList(); } - /// Initializes a new instance of AddParticipantsResponseInternal. + /// Initializes a new instance of . /// /// The operation context provided by client. - internal AddParticipantsResponseInternal(IReadOnlyList participants, string operationContext) + /// Keeps track of any properties unknown to the library. + internal AddParticipantsResponseInternal(IReadOnlyList participants, string operationContext, Dictionary serializedAdditionalRawData) { Participants = participants; OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the participants. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.Serialization.cs index 25c5911d8d1a..052e9af7084b 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class AddParticipantsSucceededInternal + internal partial class AddParticipantsSucceededInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddParticipantsSucceededInternal DeserializeAddParticipantsSucceededInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddParticipantsSucceededInternal DeserializeAddParticipantsSucceededInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +56,7 @@ internal static AddParticipantsSucceededInternal DeserializeAddParticipantsSucce Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -89,8 +117,61 @@ internal static AddParticipantsSucceededInternal DeserializeAddParticipantsSucce publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddParticipantsSucceededInternal(eventSource.Value, operationContext.Value, resultInformation.Value, Optional.ToList(participants), version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new AddParticipantsSucceededInternal(eventSource.Value, operationContext.Value, resultInformation.Value, Optional.ToList(participants), version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + AddParticipantsSucceededInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantsSucceededInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddParticipantsSucceededInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddParticipantsSucceededInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddParticipantsSucceededInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddParticipantsSucceededInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddParticipantsSucceededInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.cs index 76f91bcbc311..01892e72b39b 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AddParticipantsSucceededInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.Communication.CallingServer /// The AddParticipantsSucceededEvent. internal partial class AddParticipantsSucceededInternal { - /// Initializes a new instance of AddParticipantsSucceededInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddParticipantsSucceededInternal() { Participants = new ChangeTrackingList(); } - /// Initializes a new instance of AddParticipantsSucceededInternal. + /// Initializes a new instance of . /// /// /// @@ -30,7 +34,8 @@ internal AddParticipantsSucceededInternal() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal AddParticipantsSucceededInternal(string eventSource, string operationContext, ResultInformation resultInformation, IReadOnlyList participants, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal AddParticipantsSucceededInternal(string eventSource, string operationContext, ResultInformation resultInformation, IReadOnlyList participants, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; OperationContext = operationContext; @@ -41,6 +46,7 @@ internal AddParticipantsSucceededInternal(string eventSource, string operationCo ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs index 31454061fae4..68de0e1fa85e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class AnswerCallRequestInternal : IUtf8JsonSerializable + internal partial class AnswerCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("incomingCallContext"u8); writer.WriteStringValue(IncomingCallContext); @@ -22,9 +30,118 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MediaStreamingConfiguration)) { writer.WritePropertyName("mediaStreamingConfiguration"u8); - writer.WriteObjectValue(MediaStreamingConfiguration); + if (MediaStreamingConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MediaStreamingConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static AnswerCallRequestInternal DeserializeAnswerCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string incomingCallContext = default; + string callbackUri = default; + Optional mediaStreamingConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("incomingCallContext"u8)) + { + incomingCallContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaStreamingConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mediaStreamingConfiguration = MediaStreamingOptionsInternal.DeserializeMediaStreamingOptionsInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnswerCallRequestInternal(incomingCallContext, callbackUri, mediaStreamingConfiguration.Value, serializedAdditionalRawData); + } + + AnswerCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnswerCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnswerCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnswerCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnswerCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnswerCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnswerCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.cs index f37190bf527c..4309c7e80b0a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/AnswerCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallingServer @@ -13,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The request payload for answering the call. internal partial class AnswerCallRequestInternal { - /// Initializes a new instance of AnswerCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The context associated with the call. /// The callback uri. /// or is null. @@ -26,6 +30,24 @@ public AnswerCallRequestInternal(string incomingCallContext, string callbackUri) CallbackUri = callbackUri; } + /// Initializes a new instance of . + /// The context associated with the call. + /// The callback uri. + /// Media Streaming Configuration. + /// Keeps track of any properties unknown to the library. + internal AnswerCallRequestInternal(string incomingCallContext, string callbackUri, MediaStreamingOptionsInternal mediaStreamingConfiguration, Dictionary serializedAdditionalRawData) + { + IncomingCallContext = incomingCallContext; + CallbackUri = callbackUri; + MediaStreamingConfiguration = mediaStreamingConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnswerCallRequestInternal() + { + } + /// The context associated with the call. public string IncomingCallContext { get; } /// The callback uri. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.Serialization.cs index 6c6a29c132ba..8ed5d1c05d98 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class CallConnected + public partial class CallConnected : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallConnected DeserializeCallConnected(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallConnected DeserializeCallConnected(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +54,7 @@ internal static CallConnected DeserializeCallConnected(JsonElement element) Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -72,8 +101,61 @@ internal static CallConnected DeserializeCallConnected(JsonElement element) publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallConnected(eventSource.Value, version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new CallConnected(eventSource.Value, version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + CallConnected IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallConnected(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallConnected IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallConnected(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallConnected model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallConnected(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallConnected(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.cs index 7373afef34d7..9079ec9527ff 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnected.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The CallConnectedEvent. public partial class CallConnected { - /// Initializes a new instance of CallConnected. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallConnected() { } - /// Initializes a new instance of CallConnected. + /// Initializes a new instance of . /// /// Used to determine the version of the event. /// Used by customers when calling mid-call actions to correlate the request to the response event. @@ -24,7 +30,8 @@ internal CallConnected() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal CallConnected(string eventSource, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal CallConnected(string eventSource, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; Version = version; @@ -34,6 +41,7 @@ internal CallConnected(string eventSource, string version, string operationConte ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs index 52a731027b57..e9a523074831 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs @@ -5,17 +5,103 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class CallConnectionPropertiesInternal + internal partial class CallConnectionPropertiesInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallConnectionPropertiesInternal DeserializeCallConnectionPropertiesInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } + if (Optional.IsDefined(ServerCallId)) + { + writer.WritePropertyName("serverCallId"u8); + writer.WriteStringValue(ServerCallId); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Targets)) + { + writer.WritePropertyName("targets"u8); + writer.WriteStartArray(); + foreach (var item in Targets) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(CallConnectionState)) + { + writer.WritePropertyName("callConnectionState"u8); + writer.WriteStringValue(CallConnectionState.Value.ToString()); + } + if (Optional.IsDefined(Subject)) + { + writer.WritePropertyName("subject"u8); + writer.WriteStringValue(Subject); + } + if (Optional.IsDefined(CallbackUri)) + { + writer.WritePropertyName("callbackUri"u8); + writer.WriteStringValue(CallbackUri); + } + if (Optional.IsDefined(MediaSubscriptionId)) + { + writer.WritePropertyName("mediaSubscriptionId"u8); + writer.WriteStringValue(MediaSubscriptionId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallConnectionPropertiesInternal DeserializeCallConnectionPropertiesInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +114,7 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper Optional subject = default; Optional callbackUri = default; Optional mediaSubscriptionId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId"u8)) @@ -87,8 +174,61 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper mediaSubscriptionId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, source.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), subject.Value, callbackUri.Value, mediaSubscriptionId.Value, serializedAdditionalRawData); + } + + CallConnectionPropertiesInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallConnectionPropertiesInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallConnectionPropertiesInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallConnectionPropertiesInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallConnectionPropertiesInternal model) + { + if (model is null) + { + return null; } - return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, source.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), subject.Value, callbackUri.Value, mediaSubscriptionId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallConnectionPropertiesInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallConnectionPropertiesInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.cs index 33755da75fa4..6ad91c7f730f 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallConnectionPropertiesInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.Communication.CallingServer /// The CallConnectionProperties. internal partial class CallConnectionPropertiesInternal { - /// Initializes a new instance of CallConnectionPropertiesInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallConnectionPropertiesInternal() { Targets = new ChangeTrackingList(); } - /// Initializes a new instance of CallConnectionPropertiesInternal. + /// Initializes a new instance of . /// The call connection id. /// The server call id. /// The source of the call. @@ -29,7 +33,8 @@ internal CallConnectionPropertiesInternal() /// The subject. /// The callback URI. /// SubscriptionId for media streaming. - internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, CallSourceInternal source, IReadOnlyList targets, CallConnectionState? callConnectionState, string subject, string callbackUri, string mediaSubscriptionId) + /// Keeps track of any properties unknown to the library. + internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, CallSourceInternal source, IReadOnlyList targets, CallConnectionState? callConnectionState, string subject, string callbackUri, string mediaSubscriptionId, Dictionary serializedAdditionalRawData) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -39,6 +44,7 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server Subject = subject; CallbackUri = callbackUri; MediaSubscriptionId = mediaSubscriptionId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The call connection id. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.Serialization.cs index 6ae90cccdb0d..b070a500ac1e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class CallDisconnected + public partial class CallDisconnected : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallDisconnected DeserializeCallDisconnected(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallDisconnected DeserializeCallDisconnected(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +54,7 @@ internal static CallDisconnected DeserializeCallDisconnected(JsonElement element Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -72,8 +101,61 @@ internal static CallDisconnected DeserializeCallDisconnected(JsonElement element publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallDisconnected(eventSource.Value, version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new CallDisconnected(eventSource.Value, version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + CallDisconnected IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallDisconnected(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallDisconnected IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallDisconnected(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallDisconnected model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallDisconnected(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallDisconnected(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.cs index 08c5db74cba2..69a378d09447 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallDisconnected.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The CallDisconnectedEvent. public partial class CallDisconnected { - /// Initializes a new instance of CallDisconnected. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallDisconnected() { } - /// Initializes a new instance of CallDisconnected. + /// Initializes a new instance of . /// /// Used to determine the version of the event. /// Used by customers when calling mid-call actions to correlate the request to the response event. @@ -24,7 +30,8 @@ internal CallDisconnected() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal CallDisconnected(string eventSource, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal CallDisconnected(string eventSource, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; Version = version; @@ -34,6 +41,7 @@ internal CallDisconnected(string eventSource, string version, string operationCo ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.Serialization.cs index b479dd6c5288..7122e9f239d9 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class CallLocatorInternal : IUtf8JsonSerializable + internal partial class CallLocatorInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GroupCallId)) { @@ -30,7 +38,109 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CallLocatorInternal DeserializeCallLocatorInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional groupCallId = default; + Optional serverCallId = default; + Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupCallId"u8)) + { + groupCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new CallLocatorKindInternal(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CallLocatorInternal(groupCallId.Value, serverCallId.Value, Optional.ToNullable(kind), serializedAdditionalRawData); + } + + CallLocatorInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallLocatorInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallLocatorInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallLocatorInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallLocatorInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallLocatorInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallLocatorInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.cs index 45678bcab4ea..74cc5ed02d0f 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallLocatorInternal.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The locator used for joining or taking action on a call. internal partial class CallLocatorInternal { - /// Initializes a new instance of CallLocatorInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CallLocatorInternal() { } + /// Initializes a new instance of . + /// The group call id. + /// The server call id. + /// The call locator kind. + /// Keeps track of any properties unknown to the library. + internal CallLocatorInternal(string groupCallId, string serverCallId, CallLocatorKindInternal? kind, Dictionary serializedAdditionalRawData) + { + GroupCallId = groupCallId; + ServerCallId = serverCallId; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The group call id. public string GroupCallId { get; set; } /// The server call id. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.Serialization.cs index d0a1a6828cf0..4afbe6559869 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.Serialization.cs @@ -6,15 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class CallRecordingStateChanged + public partial class CallRecordingStateChanged : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallRecordingStateChanged DeserializeCallRecordingStateChanged(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallRecordingStateChanged DeserializeCallRecordingStateChanged(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +62,7 @@ internal static CallRecordingStateChanged DeserializeCallRecordingStateChanged(J Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -99,8 +132,61 @@ internal static CallRecordingStateChanged DeserializeCallRecordingStateChanged(J publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallRecordingStateChanged(eventSource.Value, recordingId.Value, state, Optional.ToNullable(startDateTime), version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new CallRecordingStateChanged(eventSource.Value, recordingId.Value, state, Optional.ToNullable(startDateTime), version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + CallRecordingStateChanged IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallRecordingStateChanged(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallRecordingStateChanged IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallRecordingStateChanged(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallRecordingStateChanged model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallRecordingStateChanged(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallRecordingStateChanged(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.cs index 946056750de3..279f277aefb9 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateChanged.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.CallingServer { /// The RecordingStateChangedEvent. public partial class CallRecordingStateChanged { - /// Initializes a new instance of CallRecordingStateChanged. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallRecordingStateChanged() { } - /// Initializes a new instance of CallRecordingStateChanged. + /// Initializes a new instance of . /// /// The call recording id. /// @@ -29,7 +33,8 @@ internal CallRecordingStateChanged() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal CallRecordingStateChanged(string eventSource, string recordingId, RecordingState state, DateTimeOffset? startDateTime, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal CallRecordingStateChanged(string eventSource, string recordingId, RecordingState state, DateTimeOffset? startDateTime, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; RecordingId = recordingId; @@ -42,6 +47,7 @@ internal CallRecordingStateChanged(string eventSource, string recordingId, Recor ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.Serialization.cs index 89fd47ccd44d..526ccdca98e8 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class CallSourceInternal : IUtf8JsonSerializable + internal partial class CallSourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CallerId)) { writer.WritePropertyName("callerId"u8); - writer.WriteObjectValue(CallerId); + if (CallerId is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CallerId).Serialize(writer, options); + } } if (Optional.IsDefined(DisplayName)) { @@ -27,12 +42,33 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WritePropertyName("identifier"u8); - writer.WriteObjectValue(Identifier); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CallSourceInternal DeserializeCallSourceInternal(JsonElement element) + internal static CallSourceInternal DeserializeCallSourceInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +76,7 @@ internal static CallSourceInternal DeserializeCallSourceInternal(JsonElement ele Optional callerId = default; Optional displayName = default; CommunicationIdentifierModel identifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callerId"u8)) @@ -61,8 +98,61 @@ internal static CallSourceInternal DeserializeCallSourceInternal(JsonElement ele identifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CallSourceInternal(callerId.Value, displayName.Value, identifier, serializedAdditionalRawData); + } + + CallSourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallSourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallSourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallSourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallSourceInternal model) + { + if (model is null) + { + return null; } - return new CallSourceInternal(callerId.Value, displayName.Value, identifier); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallSourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallSourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.cs index 2c64964993ab..aeaedada650d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallSourceInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallingServer /// The CallSource. internal partial class CallSourceInternal { - /// Initializes a new instance of CallSourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The identifier of the source of the call. /// is null. public CallSourceInternal(CommunicationIdentifierModel identifier) @@ -24,15 +28,22 @@ public CallSourceInternal(CommunicationIdentifierModel identifier) Identifier = identifier; } - /// Initializes a new instance of CallSourceInternal. + /// Initializes a new instance of . /// The alternate identity of the source of the call if dialing out to a pstn number. /// Display name of the call if dialing out to a pstn number. /// The identifier of the source of the call. - internal CallSourceInternal(PhoneNumberIdentifierModel callerId, string displayName, CommunicationIdentifierModel identifier) + /// Keeps track of any properties unknown to the library. + internal CallSourceInternal(PhoneNumberIdentifierModel callerId, string displayName, CommunicationIdentifierModel identifier, Dictionary serializedAdditionalRawData) { CallerId = callerId; DisplayName = displayName; Identifier = identifier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CallSourceInternal() + { } /// The alternate identity of the source of the call if dialing out to a pstn number. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.Serialization.cs index c563ecfc8f37..2fc9ffe3fa0a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class CallTransferAccepted + public partial class CallTransferAccepted : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallTransferAccepted DeserializeCallTransferAccepted(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallTransferAccepted DeserializeCallTransferAccepted(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +54,7 @@ internal static CallTransferAccepted DeserializeCallTransferAccepted(JsonElement Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -72,8 +101,61 @@ internal static CallTransferAccepted DeserializeCallTransferAccepted(JsonElement publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallTransferAccepted(eventSource.Value, operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new CallTransferAccepted(eventSource.Value, operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + CallTransferAccepted IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallTransferAccepted(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallTransferAccepted IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallTransferAccepted(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallTransferAccepted model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallTransferAccepted(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallTransferAccepted(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.cs index dfaca71a01e2..0745a01bad10 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferAccepted.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The CallTransferAcceptedEvent. public partial class CallTransferAccepted { - /// Initializes a new instance of CallTransferAccepted. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallTransferAccepted() { } - /// Initializes a new instance of CallTransferAccepted. + /// Initializes a new instance of . /// /// /// @@ -24,7 +30,8 @@ internal CallTransferAccepted() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal CallTransferAccepted(string eventSource, string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal CallTransferAccepted(string eventSource, string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; OperationContext = operationContext; @@ -34,6 +41,7 @@ internal CallTransferAccepted(string eventSource, string operationContext, Resul ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.Serialization.cs index 7a1df6b12424..ec90c08e68e1 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class CallTransferFailed + public partial class CallTransferFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +54,7 @@ internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement ele Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -72,8 +101,61 @@ internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement ele publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CallTransferFailed(eventSource.Value, operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new CallTransferFailed(eventSource.Value, operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + CallTransferFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCallTransferFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CallTransferFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCallTransferFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CallTransferFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CallTransferFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCallTransferFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.cs index 719e7219b04a..34062ab8a922 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallTransferFailed.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The CallTransferFailedEvent. public partial class CallTransferFailed { - /// Initializes a new instance of CallTransferFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CallTransferFailed() { } - /// Initializes a new instance of CallTransferFailed. + /// Initializes a new instance of . /// /// /// @@ -24,7 +30,8 @@ internal CallTransferFailed() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal CallTransferFailed(string eventSource, string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal CallTransferFailed(string eventSource, string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; OperationContext = operationContext; @@ -34,6 +41,7 @@ internal CallTransferFailed(string eventSource, string operationContext, ResultI ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.Serialization.cs index 45d8334a272f..83b2cf2f5599 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class ChannelAffinityInternal : IUtf8JsonSerializable + internal partial class ChannelAffinityInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Channel)) { @@ -23,9 +32,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Participant)) { writer.WritePropertyName("participant"u8); - writer.WriteObjectValue(Participant); + if (Participant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Participant).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ChannelAffinityInternal DeserializeChannelAffinityInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional channel = default; + Optional participant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("channel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + channel = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("participant"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChannelAffinityInternal(Optional.ToNullable(channel), participant.Value, serializedAdditionalRawData); + } + + ChannelAffinityInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChannelAffinityInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChannelAffinityInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChannelAffinityInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChannelAffinityInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChannelAffinityInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChannelAffinityInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.cs index dcff4e4493d8..06974bfe8cb6 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ChannelAffinityInternal.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication; namespace Azure.Communication.CallingServer @@ -12,11 +14,28 @@ namespace Azure.Communication.CallingServer /// Channel affinity for a participant. internal partial class ChannelAffinityInternal { - /// Initializes a new instance of ChannelAffinityInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ChannelAffinityInternal() { } + /// Initializes a new instance of . + /// Channel number to which bitstream from a particular participant will be written. + /// + /// The identifier for the participant whose bitstream will be written to the channel + /// represented by the channel number. + /// + /// Keeps track of any properties unknown to the library. + internal ChannelAffinityInternal(int? channel, CommunicationIdentifierModel participant, Dictionary serializedAdditionalRawData) + { + Channel = channel; + Participant = participant; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Channel number to which bitstream from a particular participant will be written. public int? Channel { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.Serialization.cs index 42e05b326bbc..d8c30a31297a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class CollectTonesResult + public partial class CollectTonesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> tones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tones"u8)) @@ -36,8 +64,61 @@ internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement ele tones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CollectTonesResult(Optional.ToList(tones)); + return new CollectTonesResult(Optional.ToList(tones), serializedAdditionalRawData); + } + + CollectTonesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCollectTonesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CollectTonesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCollectTonesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CollectTonesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CollectTonesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCollectTonesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.cs index 3313c1c274b6..62673dd9f751 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CollectTonesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.Communication.CallingServer /// The CollectTonesResult. public partial class CollectTonesResult { - /// Initializes a new instance of CollectTonesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CollectTonesResult() { Tones = new ChangeTrackingList(); } - /// Initializes a new instance of CollectTonesResult. + /// Initializes a new instance of . /// - internal CollectTonesResult(IReadOnlyList tones) + /// Keeps track of any properties unknown to the library. + internal CollectTonesResult(IReadOnlyList tones, Dictionary serializedAdditionalRawData) { Tones = tones; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationError.cs index e61525c6182c..8011f64557fb 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationError.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,32 @@ namespace Azure.Communication.CallingServer /// The CommunicationError. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommunicationError() { Details = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innererror, Dictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Target = target; + Details = details; + Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets the code. public string Code { get; } /// Gets the message. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationErrorResponse.cs index 905be7aaef33..79e7c75f8674 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallingServer @@ -13,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The Communication Services error response. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// Gets the error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs index 0dbc80a5b1b2..44c52be2e14e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RawId)) { @@ -28,23 +36,58 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CommunicationUser)) { writer.WritePropertyName("communicationUser"u8); - writer.WriteObjectValue(CommunicationUser); + if (CommunicationUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommunicationUser).Serialize(writer, options); + } } if (Optional.IsDefined(PhoneNumber)) { writer.WritePropertyName("phoneNumber"u8); - writer.WriteObjectValue(PhoneNumber); + if (PhoneNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PhoneNumber).Serialize(writer, options); + } } if (Optional.IsDefined(MicrosoftTeamsUser)) { writer.WritePropertyName("microsoftTeamsUser"u8); - writer.WriteObjectValue(MicrosoftTeamsUser); + if (MicrosoftTeamsUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MicrosoftTeamsUser).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element) + internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +97,7 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM Optional communicationUser = default; Optional phoneNumber = default; Optional microsoftTeamsUser = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rawId"u8)) @@ -97,8 +141,61 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM microsoftTeamsUser = MicrosoftTeamsUserIdentifierModel.DeserializeMicrosoftTeamsUserIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIdentifierModel(rawId.Value, Optional.ToNullable(kind), communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value, serializedAdditionalRawData); + } + + CommunicationIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentifierModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentifierModel(Response response) + { + if (response is null) + { + return null; } - return new CommunicationIdentifierModel(rawId.Value, Optional.ToNullable(kind), communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.cs index 8c3afafad7af..49a86342e1ed 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationIdentifierModel.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication { /// The CommunicationIdentifierModel. internal partial class CommunicationIdentifierModel { - /// Initializes a new instance of CommunicationIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationIdentifierModel() { } - /// Initializes a new instance of CommunicationIdentifierModel. + /// Initializes a new instance of . /// Full ID of the identifier. /// Type of CommunicationIdentifierModel. /// The communication user. /// The phone number. /// The Microsoft Teams user. - internal CommunicationIdentifierModel(string rawId, CommunicationIdentifierModelKind? kind, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser) + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentifierModel(string rawId, CommunicationIdentifierModelKind? kind, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, Dictionary serializedAdditionalRawData) { RawId = rawId; Kind = kind; CommunicationUser = communicationUser; PhoneNumber = phoneNumber; MicrosoftTeamsUser = microsoftTeamsUser; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Full ID of the identifier. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs index 606b9637a4ea..ed94ea13226d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element) + internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -34,8 +57,61 @@ internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIde id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationUserIdentifierModel(id, serializedAdditionalRawData); + } + + CommunicationUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new CommunicationUserIdentifierModel(id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.cs index 2fb542163bf1..847b29c5ab1b 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CommunicationUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// The CommunicationUserIdentifierModel. internal partial class CommunicationUserIdentifierModel { - /// Initializes a new instance of CommunicationUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. public CommunicationUserIdentifierModel(string id) @@ -23,6 +27,20 @@ public CommunicationUserIdentifierModel(string id) Id = id; } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal CommunicationUserIdentifierModel(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationUserIdentifierModel() + { + } + /// Gets or sets the id. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.Serialization.cs index 2780e0e6e12e..49baec552b00 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.Serialization.cs @@ -5,25 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class CreateCallRequestInternal : IUtf8JsonSerializable + internal partial class CreateCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targets"u8); writer.WriteStartArray(); foreach (var item in Targets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } if (Optional.IsDefined(Subject)) { writer.WritePropertyName("subject"u8); @@ -34,9 +57,135 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MediaStreamingConfiguration)) { writer.WritePropertyName("mediaStreamingConfiguration"u8); - writer.WriteObjectValue(MediaStreamingConfiguration); + if (MediaStreamingConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MediaStreamingConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static CreateCallRequestInternal DeserializeCreateCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList targets = default; + CallSourceInternal source = default; + Optional subject = default; + string callbackUri = default; + Optional mediaStreamingConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targets"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + targets = array; + continue; + } + if (property.NameEquals("source"u8)) + { + source = CallSourceInternal.DeserializeCallSourceInternal(property.Value); + continue; + } + if (property.NameEquals("subject"u8)) + { + subject = property.Value.GetString(); + continue; + } + if (property.NameEquals("callbackUri"u8)) + { + callbackUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaStreamingConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mediaStreamingConfiguration = MediaStreamingOptionsInternal.DeserializeMediaStreamingOptionsInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateCallRequestInternal(targets, source, subject.Value, callbackUri, mediaStreamingConfiguration.Value, serializedAdditionalRawData); + } + + CreateCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.cs index d23ff66cc714..003df2ee5211 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallingServer /// The CreateCallRequest. internal partial class CreateCallRequestInternal { - /// Initializes a new instance of CreateCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The targets of the call. /// The source of the call. /// The callback URI. @@ -32,6 +35,28 @@ public CreateCallRequestInternal(IEnumerable targe CallbackUri = callbackUri; } + /// Initializes a new instance of . + /// The targets of the call. + /// The source of the call. + /// The subject. + /// The callback URI. + /// Media Streaming Configuration. + /// Keeps track of any properties unknown to the library. + internal CreateCallRequestInternal(IList targets, CallSourceInternal source, string subject, string callbackUri, MediaStreamingOptionsInternal mediaStreamingConfiguration, Dictionary serializedAdditionalRawData) + { + Targets = targets; + Source = source; + Subject = subject; + CallbackUri = callbackUri; + MediaStreamingConfiguration = mediaStreamingConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateCallRequestInternal() + { + } + /// The targets of the call. public IList Targets { get; } /// The source of the call. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.Serialization.cs index b8b8a2ffef52..8c7b5399c03f 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class DtmfOptionsInternal : IUtf8JsonSerializable + public partial class DtmfOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InterToneTimeoutInSeconds)) { @@ -35,7 +43,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DtmfOptionsInternal DeserializeDtmfOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional interToneTimeoutInSeconds = default; + Optional maxTonesToCollect = default; + Optional> stopTones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("interToneTimeoutInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interToneTimeoutInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxTonesToCollect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxTonesToCollect = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stopTones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new DtmfTone(item.GetString())); + } + stopTones = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DtmfOptionsInternal(Optional.ToNullable(interToneTimeoutInSeconds), Optional.ToNullable(maxTonesToCollect), Optional.ToList(stopTones), serializedAdditionalRawData); + } + + DtmfOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDtmfOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DtmfOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDtmfOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DtmfOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DtmfOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDtmfOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.cs index 908d3c37a1bd..023239c3b06a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/DtmfOptionsInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.Communication.CallingServer /// Options for DTMF recognition. public partial class DtmfOptionsInternal { - /// Initializes a new instance of DtmfOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DtmfOptionsInternal() { StopTones = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Time to wait between DTMF inputs to stop recognizing. + /// Maximum number of DTMF tones to be collected. + /// List of tones that will stop recognizing. + /// Keeps track of any properties unknown to the library. + internal DtmfOptionsInternal(int? interToneTimeoutInSeconds, int? maxTonesToCollect, IReadOnlyList stopTones, Dictionary serializedAdditionalRawData) + { + InterToneTimeoutInSeconds = interToneTimeoutInSeconds; + MaxTonesToCollect = maxTonesToCollect; + StopTones = stopTones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Time to wait between DTMF inputs to stop recognizing. public int? InterToneTimeoutInSeconds { get; set; } /// Maximum number of DTMF tones to be collected. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.Serialization.cs index c7762f0ebb25..3cd45641e1f6 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class FileSourceInternal : IUtf8JsonSerializable + internal partial class FileSourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("uri"u8); writer.WriteStringValue(Uri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static FileSourceInternal DeserializeFileSourceInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri"u8)) + { + uri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FileSourceInternal(uri, serializedAdditionalRawData); + } + + FileSourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileSourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileSourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileSourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileSourceInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileSourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileSourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.cs index 83740dd0f1c7..b9f6591c2d73 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/FileSourceInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallingServer @@ -13,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The FileSource. internal partial class FileSourceInternal { - /// Initializes a new instance of FileSourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Uri for the audio file to be played. /// is null. public FileSourceInternal(string uri) @@ -23,6 +27,20 @@ public FileSourceInternal(string uri) Uri = uri; } + /// Initializes a new instance of . + /// Uri for the audio file to be played. + /// Keeps track of any properties unknown to the library. + internal FileSourceInternal(string uri, Dictionary serializedAdditionalRawData) + { + Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FileSourceInternal() + { + } + /// Uri for the audio file to be played. public string Uri { get; } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs index 8b2ffca115c9..71f65ae48314 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class GetParticipantsResponseInternal + internal partial class GetParticipantsResponseInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GetParticipantsResponseInternal DeserializeGetParticipantsResponseInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GetParticipantsResponseInternal DeserializeGetParticipantsResponseInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> values = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("values"u8)) @@ -42,8 +92,61 @@ internal static GetParticipantsResponseInternal DeserializeGetParticipantsRespon nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GetParticipantsResponseInternal(Optional.ToList(values), nextLink.Value); + return new GetParticipantsResponseInternal(Optional.ToList(values), nextLink.Value, serializedAdditionalRawData); + } + + GetParticipantsResponseInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetParticipantsResponseInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetParticipantsResponseInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetParticipantsResponseInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetParticipantsResponseInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetParticipantsResponseInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetParticipantsResponseInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.cs index c771b1c8b3dd..92b80ca48b4b 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetParticipantsResponseInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.CallingServer /// The GetParticipantsResponse. internal partial class GetParticipantsResponseInternal { - /// Initializes a new instance of GetParticipantsResponseInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GetParticipantsResponseInternal() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of GetParticipantsResponseInternal. + /// Initializes a new instance of . /// /// - internal GetParticipantsResponseInternal(IReadOnlyList values, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GetParticipantsResponseInternal(IReadOnlyList values, string nextLink, Dictionary serializedAdditionalRawData) { Values = values; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the values. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs index 9bbcdae8e167..430caa6eb1d8 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class MediaStreamingOptionsInternal : IUtf8JsonSerializable + internal partial class MediaStreamingOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("transportUrl"u8); writer.WriteStringValue(TransportUrl); @@ -23,7 +31,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ContentType.ToString()); writer.WritePropertyName("audioChannelType"u8); writer.WriteStringValue(AudioChannelType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MediaStreamingOptionsInternal DeserializeMediaStreamingOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string transportUrl = default; + MediaStreamingTransport transportType = default; + MediaStreamingContent contentType = default; + MediaStreamingAudioChannel audioChannelType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("transportUrl"u8)) + { + transportUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("transportType"u8)) + { + transportType = new MediaStreamingTransport(property.Value.GetString()); + continue; + } + if (property.NameEquals("contentType"u8)) + { + contentType = new MediaStreamingContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("audioChannelType"u8)) + { + audioChannelType = new MediaStreamingAudioChannel(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MediaStreamingOptionsInternal(transportUrl, transportType, contentType, audioChannelType, serializedAdditionalRawData); + } + + MediaStreamingOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMediaStreamingOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaStreamingOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaStreamingOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MediaStreamingOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MediaStreamingOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMediaStreamingOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.cs index aacc27e8a607..84ed53c8f6fa 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MediaStreamingOptionsInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallingServer @@ -13,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The MediaStreamingConfiguration. internal partial class MediaStreamingOptionsInternal { - /// Initializes a new instance of MediaStreamingOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Transport URL for media streaming. /// The type of transport to be used for media streaming, eg. Websocket. /// Content type to stream, eg. audio, audio/video. @@ -29,6 +33,26 @@ public MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTranspor AudioChannelType = audioChannelType; } + /// Initializes a new instance of . + /// Transport URL for media streaming. + /// The type of transport to be used for media streaming, eg. Websocket. + /// Content type to stream, eg. audio, audio/video. + /// Audio channel type to stream, eg. unmixed audio, mixed audio. + /// Keeps track of any properties unknown to the library. + internal MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTransport transportType, MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType, Dictionary serializedAdditionalRawData) + { + TransportUrl = transportUrl; + TransportType = transportType; + ContentType = contentType; + AudioChannelType = audioChannelType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MediaStreamingOptionsInternal() + { + } + /// Transport URL for media streaming. public string TransportUrl { get; } /// The type of transport to be used for media streaming, eg. Websocket. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs index b84cac6e4d46..670616c6d8ce 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable + internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userId"u8); writer.WriteStringValue(UserId); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cloud"u8); writer.WriteStringValue(Cloud.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element) + internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI string userId = default; Optional isAnonymous = default; Optional cloud = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userId"u8)) @@ -64,8 +87,61 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud), serializedAdditionalRawData); + } + + MicrosoftTeamsUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftTeamsUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftTeamsUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftTeamsUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs index 99e6ca4150fc..7a07234340f5 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// The MicrosoftTeamsUserIdentifierModel. internal partial class MicrosoftTeamsUserIdentifierModel { - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. public MicrosoftTeamsUserIdentifierModel(string userId) @@ -23,15 +27,22 @@ public MicrosoftTeamsUserIdentifierModel(string userId) UserId = userId; } - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Initializes a new instance of . /// /// /// - internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud) + /// Keeps track of any properties unknown to the library. + internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud, Dictionary serializedAdditionalRawData) { UserId = userId; IsAnonymous = isAnonymous; Cloud = cloud; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MicrosoftTeamsUserIdentifierModel() + { } /// Gets or sets the user id. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs index 275e17fb800f..900de5b0c204 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs @@ -5,17 +5,44 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class ParticipantsUpdatedInternal + internal partial class ParticipantsUpdatedInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +56,7 @@ internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedIntern Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -89,8 +117,61 @@ internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedIntern publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ParticipantsUpdatedInternal(eventSource.Value, Optional.ToList(participants), version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new ParticipantsUpdatedInternal(eventSource.Value, Optional.ToList(participants), version.Value, operationContext.Value, resultInformation.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + ParticipantsUpdatedInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantsUpdatedInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantsUpdatedInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantsUpdatedInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantsUpdatedInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantsUpdatedInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantsUpdatedInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.cs index d6545b196b6e..d3c15c66deef 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ParticipantsUpdatedInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.Communication.CallingServer /// The ParticipantsUpdatedEvent. internal partial class ParticipantsUpdatedInternal { - /// Initializes a new instance of ParticipantsUpdatedInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ParticipantsUpdatedInternal() { Participants = new ChangeTrackingList(); } - /// Initializes a new instance of ParticipantsUpdatedInternal. + /// Initializes a new instance of . /// /// /// Used to determine the version of the event. @@ -30,7 +34,8 @@ internal ParticipantsUpdatedInternal() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal ParticipantsUpdatedInternal(string eventSource, IReadOnlyList participants, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal ParticipantsUpdatedInternal(string eventSource, IReadOnlyList participants, string version, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; Participants = participants; @@ -41,6 +46,7 @@ internal ParticipantsUpdatedInternal(string eventSource, IReadOnlyList Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs index dce7185be6bd..004f3f6df1a9 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable + internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element) + internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -34,8 +57,61 @@ internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberIdentifierModel(value, serializedAdditionalRawData); + } + + PhoneNumberIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberIdentifierModel model) + { + if (model is null) + { + return null; } - return new PhoneNumberIdentifierModel(value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.cs index 724646b50190..bb4ef5c668bc 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PhoneNumberIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// The PhoneNumberIdentifierModel. internal partial class PhoneNumberIdentifierModel { - /// Initializes a new instance of PhoneNumberIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. public PhoneNumberIdentifierModel(string value) @@ -23,6 +27,20 @@ public PhoneNumberIdentifierModel(string value) Value = value; } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal PhoneNumberIdentifierModel(string value, Dictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberIdentifierModel() + { + } + /// Gets or sets the value. public string Value { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.Serialization.cs index 669a583f4ef2..728355560f72 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class PlayCompleted + public partial class PlayCompleted : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PlayCompleted DeserializePlayCompleted(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PlayCompleted DeserializePlayCompleted(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +53,7 @@ internal static PlayCompleted DeserializePlayCompleted(JsonElement element) Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -66,8 +95,61 @@ internal static PlayCompleted DeserializePlayCompleted(JsonElement element) publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PlayCompleted(operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new PlayCompleted(operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + PlayCompleted IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayCompleted(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayCompleted IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayCompleted(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayCompleted model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayCompleted(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayCompleted(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.cs index 19f440e0cb6a..595e3c8ab4ef 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayCompleted.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The PlayCompleted. public partial class PlayCompleted { - /// Initializes a new instance of PlayCompleted. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PlayCompleted() { } - /// Initializes a new instance of PlayCompleted. + /// Initializes a new instance of . /// /// /// Used to determine the version of the event. @@ -23,7 +29,8 @@ internal PlayCompleted() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal PlayCompleted(string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal PlayCompleted(string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; ResultInformation = resultInformation; @@ -32,6 +39,7 @@ internal PlayCompleted(string operationContext, ResultInformation resultInformat ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the operation context. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.Serialization.cs index 4f755ca1a11d..6482d1f88c89 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class PlayFailed + public partial class PlayFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PlayFailed DeserializePlayFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PlayFailed DeserializePlayFailed(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +54,7 @@ internal static PlayFailed DeserializePlayFailed(JsonElement element) Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventSource"u8)) @@ -72,8 +101,61 @@ internal static PlayFailed DeserializePlayFailed(JsonElement element) publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PlayFailed(eventSource.Value, operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new PlayFailed(eventSource.Value, operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + PlayFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.cs index f1df35f7bbbb..5dffb64ba067 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayFailed.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The PlayFailed. public partial class PlayFailed { - /// Initializes a new instance of PlayFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PlayFailed() { } - /// Initializes a new instance of PlayFailed. + /// Initializes a new instance of . /// /// /// @@ -24,7 +30,8 @@ internal PlayFailed() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal PlayFailed(string eventSource, string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal PlayFailed(string eventSource, string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { EventSource = eventSource; OperationContext = operationContext; @@ -34,6 +41,7 @@ internal PlayFailed(string eventSource, string operationContext, ResultInformati ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the event source. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.Serialization.cs index 9aefd881caa9..4742bb77ea07 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class PlayOptionsInternal : IUtf8JsonSerializable + internal partial class PlayOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("loop"u8); writer.WriteBooleanValue(Loop); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PlayOptionsInternal DeserializePlayOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool loop = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loop"u8)) + { + loop = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlayOptionsInternal(loop, serializedAdditionalRawData); + } + + PlayOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.cs index 7fc4ad500f76..64dbcd0d8332 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayOptionsInternal.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The PlayOptions. internal partial class PlayOptionsInternal { - /// Initializes a new instance of PlayOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The option to play the provided audio source in loop when set to true. public PlayOptionsInternal(bool loop) { Loop = loop; } + /// Initializes a new instance of . + /// The option to play the provided audio source in loop when set to true. + /// Keeps track of any properties unknown to the library. + internal PlayOptionsInternal(bool loop, Dictionary serializedAdditionalRawData) + { + Loop = loop; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlayOptionsInternal() + { + } + /// The option to play the provided audio source in loop when set to true. public bool Loop { get; } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.Serialization.cs index 7dd3ad8acc3c..d2a069640121 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.Serialization.cs @@ -5,39 +5,186 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class PlayRequestInternal : IUtf8JsonSerializable + internal partial class PlayRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("playSourceInfo"u8); - writer.WriteObjectValue(PlaySourceInfo); + if (PlaySourceInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlaySourceInfo).Serialize(writer, options); + } if (Optional.IsCollectionDefined(PlayTo)) { writer.WritePropertyName("playTo"u8); writer.WriteStartArray(); foreach (var item in PlayTo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(PlayOptions)) { writer.WritePropertyName("playOptions"u8); - writer.WriteObjectValue(PlayOptions); + if (PlayOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlayOptions).Serialize(writer, options); + } } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PlayRequestInternal DeserializePlayRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaySourceInternal playSourceInfo = default; + Optional> playTo = default; + Optional playOptions = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("playSourceInfo"u8)) + { + playSourceInfo = PlaySourceInternal.DeserializePlaySourceInternal(property.Value); + continue; + } + if (property.NameEquals("playTo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + playTo = array; + continue; + } + if (property.NameEquals("playOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + playOptions = PlayOptionsInternal.DeserializePlayOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlayRequestInternal(playSourceInfo, Optional.ToList(playTo), playOptions.Value, operationContext.Value, serializedAdditionalRawData); + } + + PlayRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlayRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlayRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlayRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlayRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlayRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlayRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.cs index e25c9186ed23..fb6fbb5c5c40 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayRequestInternal.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.CallingServer /// The PlayRequest. internal partial class PlayRequestInternal { - /// Initializes a new instance of PlayRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The source of the audio to be played. /// is null. public PlayRequestInternal(PlaySourceInternal playSourceInfo) @@ -26,6 +29,29 @@ public PlayRequestInternal(PlaySourceInternal playSourceInfo) PlayTo = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The source of the audio to be played. + /// + /// The list of call participants play provided audio to. + /// Plays to everyone in the call when not provided. + /// + /// Defines options for playing the audio. + /// The value to identify context of the operation. + /// Keeps track of any properties unknown to the library. + internal PlayRequestInternal(PlaySourceInternal playSourceInfo, IList playTo, PlayOptionsInternal playOptions, string operationContext, Dictionary serializedAdditionalRawData) + { + PlaySourceInfo = playSourceInfo; + PlayTo = playTo; + PlayOptions = playOptions; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlayRequestInternal() + { + } + /// The source of the audio to be played. public PlaySourceInternal PlaySourceInfo { get; } /// Defines options for playing the audio. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.Serialization.cs index 3175690c45a8..197f75a2a912 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class PlaySourceInternal : IUtf8JsonSerializable + internal partial class PlaySourceInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceType"u8); writer.WriteStringValue(SourceType.ToString()); @@ -25,9 +33,118 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(FileSource)) { writer.WritePropertyName("fileSource"u8); - writer.WriteObjectValue(FileSource); + if (FileSource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FileSource).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static PlaySourceInternal DeserializePlaySourceInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaySourceTypeInternal sourceType = default; + Optional playSourceId = default; + Optional fileSource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceType"u8)) + { + sourceType = new PlaySourceTypeInternal(property.Value.GetString()); + continue; + } + if (property.NameEquals("playSourceId"u8)) + { + playSourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fileSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSource = FileSourceInternal.DeserializeFileSourceInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlaySourceInternal(sourceType, playSourceId.Value, fileSource.Value, serializedAdditionalRawData); + } + + PlaySourceInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlaySourceInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlaySourceInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlaySourceInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlaySourceInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlaySourceInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlaySourceInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.cs index 8eb16ceab445..77f255defb26 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlaySourceInternal.cs @@ -5,18 +5,42 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The PlaySource. internal partial class PlaySourceInternal { - /// Initializes a new instance of PlaySourceInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines the type of the play source. public PlaySourceInternal(PlaySourceTypeInternal sourceType) { SourceType = sourceType; } + /// Initializes a new instance of . + /// Defines the type of the play source. + /// Defines the identifier to be used for caching related media. + /// Defines the file source info to be used for play. + /// Keeps track of any properties unknown to the library. + internal PlaySourceInternal(PlaySourceTypeInternal sourceType, string playSourceId, FileSourceInternal fileSource, Dictionary serializedAdditionalRawData) + { + SourceType = sourceType; + PlaySourceId = playSourceId; + FileSource = fileSource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlaySourceInternal() + { + } + /// Defines the type of the play source. public PlaySourceTypeInternal SourceType { get; } /// Defines the identifier to be used for caching related media. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.Serialization.cs index 3509d9439d7e..14152808f00d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class RecognizeCompleted + public partial class RecognizeCompleted : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecognizeCompleted DeserializeRecognizeCompleted(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecognizeCompleted DeserializeRecognizeCompleted(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +55,7 @@ internal static RecognizeCompleted DeserializeRecognizeCompleted(JsonElement ele Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -86,8 +115,61 @@ internal static RecognizeCompleted DeserializeRecognizeCompleted(JsonElement ele publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecognizeCompleted(operationContext.Value, resultInformation.Value, recognitionType, collectTonesResult.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new RecognizeCompleted(operationContext.Value, resultInformation.Value, recognitionType, collectTonesResult.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + RecognizeCompleted IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeCompleted(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeCompleted IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeCompleted(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeCompleted model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeCompleted(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeCompleted(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.cs index 5dfc13cca7e5..b71ee5ccf658 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeCompleted.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The RecognizeCompleted. public partial class RecognizeCompleted { - /// Initializes a new instance of RecognizeCompleted. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecognizeCompleted() { } - /// Initializes a new instance of RecognizeCompleted. + /// Initializes a new instance of . /// /// Result information defines the code, subcode and message. /// @@ -28,7 +34,8 @@ internal RecognizeCompleted() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal RecognizeCompleted(string operationContext, ResultInformation resultInformation, CallMediaRecognitionType recognitionType, CollectTonesResult collectTonesResult, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal RecognizeCompleted(string operationContext, ResultInformation resultInformation, CallMediaRecognitionType recognitionType, CollectTonesResult collectTonesResult, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; ResultInformation = resultInformation; @@ -39,6 +46,7 @@ internal RecognizeCompleted(string operationContext, ResultInformation resultInf ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the operation context. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.Serialization.cs index 6f2113e594c5..2a28061c602c 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class RecognizeFailed + public partial class RecognizeFailed : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +53,7 @@ internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) Optional serverCallId = default; Optional correlationId = default; Optional publicEventType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -66,8 +95,61 @@ internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) publicEventType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecognizeFailed(operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value); + return new RecognizeFailed(operationContext.Value, resultInformation.Value, version.Value, callConnectionId.Value, serverCallId.Value, correlationId.Value, publicEventType.Value, serializedAdditionalRawData); + } + + RecognizeFailed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeFailed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeFailed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeFailed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeFailed model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeFailed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeFailed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.cs index e0bfc78bbcea..18c349aa63f7 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeFailed.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The RecognizeFailed. public partial class RecognizeFailed { - /// Initializes a new instance of RecognizeFailed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecognizeFailed() { } - /// Initializes a new instance of RecognizeFailed. + /// Initializes a new instance of . /// /// /// Used to determine the version of the event. @@ -23,7 +29,8 @@ internal RecognizeFailed() /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The public event namespace used as the "type" property in the CloudEvent. - internal RecognizeFailed(string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType) + /// Keeps track of any properties unknown to the library. + internal RecognizeFailed(string operationContext, ResultInformation resultInformation, string version, string callConnectionId, string serverCallId, string correlationId, string publicEventType, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; ResultInformation = resultInformation; @@ -32,6 +39,7 @@ internal RecognizeFailed(string operationContext, ResultInformation resultInform ServerCallId = serverCallId; CorrelationId = correlationId; PublicEventType = publicEventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the operation context. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs index 9b4613d0fdb0..bd808f6f87ea 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class RecognizeOptionsInternal : IUtf8JsonSerializable + internal partial class RecognizeOptionsInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InterruptPrompt)) { @@ -26,13 +35,143 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(InitialSilenceTimeoutInSeconds.Value); } writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + if (TargetParticipant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TargetParticipant).Serialize(writer, options); + } if (Optional.IsDefined(DtmfOptions)) { writer.WritePropertyName("dtmfOptions"u8); - writer.WriteObjectValue(DtmfOptions); + if (DtmfOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DtmfOptions).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static RecognizeOptionsInternal DeserializeRecognizeOptionsInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional interruptPrompt = default; + Optional initialSilenceTimeoutInSeconds = default; + CommunicationIdentifierModel targetParticipant = default; + Optional dtmfOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("interruptPrompt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interruptPrompt = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("initialSilenceTimeoutInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialSilenceTimeoutInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("targetParticipant"u8)) + { + targetParticipant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("dtmfOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dtmfOptions = DtmfOptionsInternal.DeserializeDtmfOptionsInternal(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecognizeOptionsInternal(Optional.ToNullable(interruptPrompt), Optional.ToNullable(initialSilenceTimeoutInSeconds), targetParticipant, dtmfOptions.Value, serializedAdditionalRawData); + } + + RecognizeOptionsInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeOptionsInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeOptionsInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeOptionsInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeOptionsInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeOptionsInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeOptionsInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.cs index 2d922818a061..5282e2b970a3 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeOptionsInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallingServer /// The RecognizeOptions. internal partial class RecognizeOptionsInternal { - /// Initializes a new instance of RecognizeOptionsInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Target participant of DTMF tone recognition. /// is null. public RecognizeOptionsInternal(CommunicationIdentifierModel targetParticipant) @@ -24,6 +28,26 @@ public RecognizeOptionsInternal(CommunicationIdentifierModel targetParticipant) TargetParticipant = targetParticipant; } + /// Initializes a new instance of . + /// Determines if we interrupt the prompt and start recognizing. + /// Time to wait for first input after prompt (if any). + /// Target participant of DTMF tone recognition. + /// Defines configurations for DTMF. + /// Keeps track of any properties unknown to the library. + internal RecognizeOptionsInternal(bool? interruptPrompt, int? initialSilenceTimeoutInSeconds, CommunicationIdentifierModel targetParticipant, DtmfOptionsInternal dtmfOptions, Dictionary serializedAdditionalRawData) + { + InterruptPrompt = interruptPrompt; + InitialSilenceTimeoutInSeconds = initialSilenceTimeoutInSeconds; + TargetParticipant = targetParticipant; + DtmfOptions = dtmfOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RecognizeOptionsInternal() + { + } + /// Determines if we interrupt the prompt and start recognizing. public bool? InterruptPrompt { get; set; } /// Time to wait for first input after prompt (if any). diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.Serialization.cs index 3a3fefcc79cb..277e9191fa14 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class RecognizeRequestInternal : IUtf8JsonSerializable + internal partial class RecognizeRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("recognizeInputType"u8); writer.WriteStringValue(RecognizeInputType.ToString()); if (Optional.IsDefined(PlayPrompt)) { writer.WritePropertyName("playPrompt"u8); - writer.WriteObjectValue(PlayPrompt); + if (PlayPrompt is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlayPrompt).Serialize(writer, options); + } } if (Optional.IsDefined(InterruptCallMediaOperation)) { @@ -28,13 +43,138 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(InterruptCallMediaOperation.Value); } writer.WritePropertyName("recognizeOptions"u8); - writer.WriteObjectValue(RecognizeOptions); + if (RecognizeOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RecognizeOptions).Serialize(writer, options); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RecognizeRequestInternal DeserializeRecognizeRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RecognizeInputType recognizeInputType = default; + Optional playPrompt = default; + Optional interruptCallMediaOperation = default; + RecognizeOptionsInternal recognizeOptions = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("recognizeInputType"u8)) + { + recognizeInputType = new RecognizeInputType(property.Value.GetString()); + continue; + } + if (property.NameEquals("playPrompt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + playPrompt = PlaySourceInternal.DeserializePlaySourceInternal(property.Value); + continue; + } + if (property.NameEquals("interruptCallMediaOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + interruptCallMediaOperation = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("recognizeOptions"u8)) + { + recognizeOptions = RecognizeOptionsInternal.DeserializeRecognizeOptionsInternal(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecognizeRequestInternal(recognizeInputType, playPrompt.Value, Optional.ToNullable(interruptCallMediaOperation), recognizeOptions, operationContext.Value, serializedAdditionalRawData); + } + + RecognizeRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecognizeRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecognizeRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecognizeRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecognizeRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecognizeRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecognizeRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.cs index 4b56d5408e7f..66d2407eed82 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecognizeRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallingServer @@ -13,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The RecognizeRequest. internal partial class RecognizeRequestInternal { - /// Initializes a new instance of RecognizeRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Determines the type of the recognition. /// Defines options for recognition. /// is null. @@ -25,6 +29,28 @@ public RecognizeRequestInternal(RecognizeInputType recognizeInputType, Recognize RecognizeOptions = recognizeOptions; } + /// Initializes a new instance of . + /// Determines the type of the recognition. + /// The source of the audio to be played for recognition. + /// If set recognize can barge into other existing queued-up/currently-processing requests. + /// Defines options for recognition. + /// The value to identify context of the operation. + /// Keeps track of any properties unknown to the library. + internal RecognizeRequestInternal(RecognizeInputType recognizeInputType, PlaySourceInternal playPrompt, bool? interruptCallMediaOperation, RecognizeOptionsInternal recognizeOptions, string operationContext, Dictionary serializedAdditionalRawData) + { + RecognizeInputType = recognizeInputType; + PlayPrompt = playPrompt; + InterruptCallMediaOperation = interruptCallMediaOperation; + RecognizeOptions = recognizeOptions; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RecognizeRequestInternal() + { + } + /// Determines the type of the recognition. public RecognizeInputType RecognizeInputType { get; } /// The source of the audio to be played for recognition. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.Serialization.cs index a67cd1361845..6d7983813286 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class RecordingStateResult + public partial class RecordingStateResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecordingStateResult DeserializeRecordingStateResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RecordingId)) + { + writer.WritePropertyName("recordingId"u8); + writer.WriteStringValue(RecordingId); + } + if (Optional.IsDefined(RecordingState)) + { + writer.WritePropertyName("recordingState"u8); + writer.WriteStringValue(RecordingState.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecordingStateResult DeserializeRecordingStateResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional recordingId = default; Optional recordingState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("recordingId"u8)) @@ -36,8 +75,61 @@ internal static RecordingStateResult DeserializeRecordingStateResult(JsonElement recordingState = new RecordingState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecordingStateResult(recordingId.Value, Optional.ToNullable(recordingState)); + return new RecordingStateResult(recordingId.Value, Optional.ToNullable(recordingState), serializedAdditionalRawData); + } + + RecordingStateResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecordingStateResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecordingStateResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecordingStateResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecordingStateResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecordingStateResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecordingStateResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.cs index b267f07df1cb..909a25a63fca 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RecordingStateResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The RecordingStateResponse. public partial class RecordingStateResult { - /// Initializes a new instance of RecordingStateResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecordingStateResult() { } - /// Initializes a new instance of RecordingStateResult. + /// Initializes a new instance of . /// /// - internal RecordingStateResult(string recordingId, RecordingState? recordingState) + /// Keeps track of any properties unknown to the library. + internal RecordingStateResult(string recordingId, RecordingState? recordingState, Dictionary serializedAdditionalRawData) { RecordingId = recordingId; RecordingState = recordingState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the recording id. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs index ffaab0500482..7705bfeabd56 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.Serialization.cs @@ -5,21 +5,129 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class RedirectCallRequestInternal : IUtf8JsonSerializable + internal partial class RedirectCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("incomingCallContext"u8); writer.WriteStringValue(IncomingCallContext); writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RedirectCallRequestInternal DeserializeRedirectCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string incomingCallContext = default; + CommunicationIdentifierModel target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("incomingCallContext"u8)) + { + incomingCallContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RedirectCallRequestInternal(incomingCallContext, target, serializedAdditionalRawData); + } + + RedirectCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRedirectCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RedirectCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRedirectCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RedirectCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RedirectCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRedirectCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.cs index 1e45984e60bb..76c26f46882c 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RedirectCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallingServer /// The request payload for redirecting the call. internal partial class RedirectCallRequestInternal { - /// Initializes a new instance of RedirectCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The context associated with the call. /// The target identity to redirect the call to. /// or is null. @@ -27,6 +31,22 @@ public RedirectCallRequestInternal(string incomingCallContext, CommunicationIden Target = target; } + /// Initializes a new instance of . + /// The context associated with the call. + /// The target identity to redirect the call to. + /// Keeps track of any properties unknown to the library. + internal RedirectCallRequestInternal(string incomingCallContext, CommunicationIdentifierModel target, Dictionary serializedAdditionalRawData) + { + IncomingCallContext = incomingCallContext; + Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedirectCallRequestInternal() + { + } + /// The context associated with the call. public string IncomingCallContext { get; } /// The target identity to redirect the call to. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.Serialization.cs index 3d5f2c8b4ae3..4be46dbecb7f 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class RejectCallRequestInternal : IUtf8JsonSerializable + internal partial class RejectCallRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("incomingCallContext"u8); writer.WriteStringValue(IncomingCallContext); @@ -22,7 +30,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("callRejectReason"u8); writer.WriteStringValue(CallRejectReason.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RejectCallRequestInternal DeserializeRejectCallRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string incomingCallContext = default; + Optional callRejectReason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("incomingCallContext"u8)) + { + incomingCallContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("callRejectReason"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callRejectReason = new CallRejectReason(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RejectCallRequestInternal(incomingCallContext, Optional.ToNullable(callRejectReason), serializedAdditionalRawData); + } + + RejectCallRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRejectCallRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RejectCallRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRejectCallRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RejectCallRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RejectCallRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRejectCallRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.cs index fdf74ba3dfda..ed02584e9599 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RejectCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallingServer @@ -13,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The request payload for rejecting the call. internal partial class RejectCallRequestInternal { - /// Initializes a new instance of RejectCallRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The context associated with the call. /// is null. public RejectCallRequestInternal(string incomingCallContext) @@ -23,6 +27,22 @@ public RejectCallRequestInternal(string incomingCallContext) IncomingCallContext = incomingCallContext; } + /// Initializes a new instance of . + /// The context associated with the call. + /// The rejection reason. + /// Keeps track of any properties unknown to the library. + internal RejectCallRequestInternal(string incomingCallContext, CallRejectReason? callRejectReason, Dictionary serializedAdditionalRawData) + { + IncomingCallContext = incomingCallContext; + CallRejectReason = callRejectReason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RejectCallRequestInternal() + { + } + /// The context associated with the call. public string IncomingCallContext { get; } /// The rejection reason. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs index d24465e940fb..1a7b72cdd64c 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs @@ -5,21 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class RemoveParticipantsRequestInternal : IUtf8JsonSerializable + internal partial class RemoveParticipantsRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("participantsToRemove"u8); writer.WriteStartArray(); foreach (var item in ParticipantsToRemove) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsDefined(OperationContext)) @@ -27,7 +43,104 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RemoveParticipantsRequestInternal DeserializeRemoveParticipantsRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList participantsToRemove = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("participantsToRemove"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(item)); + } + participantsToRemove = array; + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RemoveParticipantsRequestInternal(participantsToRemove, operationContext.Value, serializedAdditionalRawData); + } + + RemoveParticipantsRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantsRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveParticipantsRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveParticipantsRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveParticipantsRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveParticipantsRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveParticipantsRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.cs index bac496e4f418..a05ee4378329 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsRequestInternal.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.CallingServer /// The remove participant by identifier request. internal partial class RemoveParticipantsRequestInternal { - /// Initializes a new instance of RemoveParticipantsRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The participants to invite. /// is null. public RemoveParticipantsRequestInternal(IEnumerable participantsToRemove) @@ -26,6 +29,22 @@ public RemoveParticipantsRequestInternal(IEnumerable Initializes a new instance of . + /// The participants to invite. + /// The operation context. + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantsRequestInternal(IList participantsToRemove, string operationContext, Dictionary serializedAdditionalRawData) + { + ParticipantsToRemove = participantsToRemove; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RemoveParticipantsRequestInternal() + { + } + /// The participants to invite. public IList ParticipantsToRemove { get; } /// The operation context. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.Serialization.cs index a1e57b9f28aa..b955274b2b77 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class RemoveParticipantsResult + public partial class RemoveParticipantsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RemoveParticipantsResult DeserializeRemoveParticipantsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RemoveParticipantsResult DeserializeRemoveParticipantsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -26,8 +60,61 @@ internal static RemoveParticipantsResult DeserializeRemoveParticipantsResult(Jso operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RemoveParticipantsResult(operationContext.Value); + return new RemoveParticipantsResult(operationContext.Value, serializedAdditionalRawData); + } + + RemoveParticipantsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveParticipantsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveParticipantsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveParticipantsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveParticipantsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveParticipantsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.cs index 876d45412039..a8dfbd2d01d2 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/RemoveParticipantsResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The RemoveParticipantsResponse. public partial class RemoveParticipantsResult { - /// Initializes a new instance of RemoveParticipantsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RemoveParticipantsResult() { } - /// Initializes a new instance of RemoveParticipantsResult. + /// Initializes a new instance of . /// The operation context provided by client. - internal RemoveParticipantsResult(string operationContext) + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantsResult(string operationContext, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation context provided by client. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.Serialization.cs index 7f91de2d1a2d..b97f4eb2c213 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class ResultInformation + public partial class ResultInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResultInformation DeserializeResultInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteNumberValue(Code.Value); + } + if (Optional.IsDefined(SubCode)) + { + writer.WritePropertyName("subCode"u8); + writer.WriteNumberValue(SubCode.Value); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResultInformation DeserializeResultInformation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ResultInformation DeserializeResultInformation(JsonElement eleme Optional code = default; Optional subCode = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -46,8 +90,61 @@ internal static ResultInformation DeserializeResultInformation(JsonElement eleme message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResultInformation(Optional.ToNullable(code), Optional.ToNullable(subCode), message.Value); + return new ResultInformation(Optional.ToNullable(code), Optional.ToNullable(subCode), message.Value, serializedAdditionalRawData); + } + + ResultInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResultInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResultInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResultInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResultInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResultInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResultInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.cs index 780e5c7d5b4a..e8911f8dc040 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/ResultInformation.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The ResultInformation. public partial class ResultInformation { - /// Initializes a new instance of ResultInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResultInformation() { } - /// Initializes a new instance of ResultInformation. + /// Initializes a new instance of . /// /// /// - internal ResultInformation(int? code, int? subCode, string message) + /// Keeps track of any properties unknown to the library. + internal ResultInformation(int? code, int? subCode, string message, Dictionary serializedAdditionalRawData) { Code = code; SubCode = subCode; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the code. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs index 72b307df91df..d6e8024e683e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs @@ -5,18 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class StartCallRecordingRequestInternal : IUtf8JsonSerializable + internal partial class StartCallRecordingRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("callLocator"u8); - writer.WriteObjectValue(CallLocator); + if (CallLocator is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CallLocator).Serialize(writer, options); + } if (Optional.IsDefined(RecordingStateCallbackUri)) { writer.WritePropertyName("recordingStateCallbackUri"u8); @@ -43,11 +58,155 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ChannelAffinity) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StartCallRecordingRequestInternal DeserializeStartCallRecordingRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CallLocatorInternal callLocator = default; + Optional recordingStateCallbackUri = default; + Optional recordingContentType = default; + Optional recordingChannelType = default; + Optional recordingFormatType = default; + Optional> channelAffinity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("callLocator"u8)) + { + callLocator = CallLocatorInternal.DeserializeCallLocatorInternal(property.Value); + continue; + } + if (property.NameEquals("recordingStateCallbackUri"u8)) + { + recordingStateCallbackUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("recordingContentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recordingContentType = new RecordingContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("recordingChannelType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recordingChannelType = new RecordingChannel(property.Value.GetString()); + continue; + } + if (property.NameEquals("recordingFormatType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recordingFormatType = new RecordingFormat(property.Value.GetString()); + continue; + } + if (property.NameEquals("channelAffinity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ChannelAffinityInternal.DeserializeChannelAffinityInternal(item)); + } + channelAffinity = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StartCallRecordingRequestInternal(callLocator, recordingStateCallbackUri.Value, Optional.ToNullable(recordingContentType), Optional.ToNullable(recordingChannelType), Optional.ToNullable(recordingFormatType), Optional.ToList(channelAffinity), serializedAdditionalRawData); + } + + StartCallRecordingRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStartCallRecordingRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StartCallRecordingRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStartCallRecordingRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StartCallRecordingRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StartCallRecordingRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStartCallRecordingRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.cs index c3cb5f290e98..73a6bd6c2ad7 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingRequestInternal.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.CallingServer /// The request payload start for call recording operation with call locator. internal partial class StartCallRecordingRequestInternal { - /// Initializes a new instance of StartCallRecordingRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The call locator. /// is null. public StartCallRecordingRequestInternal(CallLocatorInternal callLocator) @@ -25,6 +28,30 @@ public StartCallRecordingRequestInternal(CallLocatorInternal callLocator) ChannelAffinity = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The call locator. + /// The uri to send notifications to. + /// The content type of call recording. + /// The channel type of call recording. + /// The format type of call recording. + /// The channel affinity of call recording. + /// Keeps track of any properties unknown to the library. + internal StartCallRecordingRequestInternal(CallLocatorInternal callLocator, string recordingStateCallbackUri, RecordingContent? recordingContentType, RecordingChannel? recordingChannelType, RecordingFormat? recordingFormatType, IList channelAffinity, Dictionary serializedAdditionalRawData) + { + CallLocator = callLocator; + RecordingStateCallbackUri = recordingStateCallbackUri; + RecordingContentType = recordingContentType; + RecordingChannelType = recordingChannelType; + RecordingFormatType = recordingFormatType; + ChannelAffinity = channelAffinity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StartCallRecordingRequestInternal() + { + } + /// The call locator. public CallLocatorInternal CallLocator { get; } /// The uri to send notifications to. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs index b2ed472ce4a5..a1fa89f724dd 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - public partial class TransferCallToParticipantResult + public partial class TransferCallToParticipantResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TransferCallToParticipantResult DeserializeTransferCallToParticipantResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TransferCallToParticipantResult DeserializeTransferCallToParticipantResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationContext"u8)) @@ -26,8 +60,61 @@ internal static TransferCallToParticipantResult DeserializeTransferCallToPartici operationContext = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TransferCallToParticipantResult(operationContext.Value); + return new TransferCallToParticipantResult(operationContext.Value, serializedAdditionalRawData); + } + + TransferCallToParticipantResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferCallToParticipantResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferCallToParticipantResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferCallToParticipantResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferCallToParticipantResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferCallToParticipantResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferCallToParticipantResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.cs index 837e56991f71..b6b1bb13053e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferCallToParticipantResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.CallingServer { /// The TransferCallResponse. public partial class TransferCallToParticipantResult { - /// Initializes a new instance of TransferCallToParticipantResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TransferCallToParticipantResult() { } - /// Initializes a new instance of TransferCallToParticipantResult. + /// Initializes a new instance of . /// The operation context provided by client. - internal TransferCallToParticipantResult(string operationContext) + /// Keeps track of any properties unknown to the library. + internal TransferCallToParticipantResult(string operationContext, Dictionary serializedAdditionalRawData) { OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The operation context provided by client. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs index 7b696a100653..6e51e67da64b 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs @@ -5,22 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.CallingServer { - internal partial class TransferToParticipantRequestInternal : IUtf8JsonSerializable + internal partial class TransferToParticipantRequestInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + if (TargetParticipant is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TargetParticipant).Serialize(writer, options); + } if (Optional.IsDefined(TransfereeCallerId)) { writer.WritePropertyName("transfereeCallerId"u8); - writer.WriteObjectValue(TransfereeCallerId); + if (TransfereeCallerId is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransfereeCallerId).Serialize(writer, options); + } } if (Optional.IsDefined(UserToUserInformation)) { @@ -32,7 +55,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TransferToParticipantRequestInternal DeserializeTransferToParticipantRequestInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationIdentifierModel targetParticipant = default; + Optional transfereeCallerId = default; + Optional userToUserInformation = default; + Optional operationContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetParticipant"u8)) + { + targetParticipant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("transfereeCallerId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transfereeCallerId = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("userToUserInformation"u8)) + { + userToUserInformation = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferToParticipantRequestInternal(targetParticipant, transfereeCallerId.Value, userToUserInformation.Value, operationContext.Value, serializedAdditionalRawData); + } + + TransferToParticipantRequestInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferToParticipantRequestInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferToParticipantRequestInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferToParticipantRequestInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferToParticipantRequestInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferToParticipantRequestInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferToParticipantRequestInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.cs index 996cf396e944..0af6df711e86 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/TransferToParticipantRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.CallingServer /// The transfer call to participant request. internal partial class TransferToParticipantRequestInternal { - /// Initializes a new instance of TransferToParticipantRequestInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The identity of the target where call should be transferred to. /// is null. public TransferToParticipantRequestInternal(CommunicationIdentifierModel targetParticipant) @@ -24,6 +28,26 @@ public TransferToParticipantRequestInternal(CommunicationIdentifierModel targetP TargetParticipant = targetParticipant; } + /// Initializes a new instance of . + /// The identity of the target where call should be transferred to. + /// The caller ID of the transferee when transferring to PSTN. + /// The user to user information. + /// The operation context. + /// Keeps track of any properties unknown to the library. + internal TransferToParticipantRequestInternal(CommunicationIdentifierModel targetParticipant, PhoneNumberIdentifierModel transfereeCallerId, string userToUserInformation, string operationContext, Dictionary serializedAdditionalRawData) + { + TargetParticipant = targetParticipant; + TransfereeCallerId = transfereeCallerId; + UserToUserInformation = userToUserInformation; + OperationContext = operationContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TransferToParticipantRequestInternal() + { + } + /// The identity of the target where call should be transferred to. public CommunicationIdentifierModel TargetParticipant { get; } /// The caller ID of the transferee when transferring to PSTN. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallingRestClient.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallingRestClient.cs index be7efbfe1ed7..1bc5b3225f3a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallingRestClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallingRestClient.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateCreateCallRequest(CreateCallRequestInternal createCal request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(createCallRequest); - request.Content = content; + request.Content = createCallRequest; return message; } @@ -126,9 +124,7 @@ internal HttpMessage CreateAnswerCallRequest(AnswerCallRequestInternal answerCal request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(answerCallRequest); - request.Content = content; + request.Content = answerCallRequest; return message; } @@ -201,9 +197,7 @@ internal HttpMessage CreateRedirectCallRequest(RedirectCallRequestInternal redir request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(redirectCallRequest); - request.Content = content; + request.Content = redirectCallRequest; return message; } @@ -264,9 +258,7 @@ internal HttpMessage CreateRejectCallRequest(RejectCallRequestInternal rejectCal request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(rejectCallRequest); - request.Content = content; + request.Content = rejectCallRequest; return message; } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/ChatModelFactory.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/ChatModelFactory.cs index 253da21771eb..9f2e67d0f744 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/ChatModelFactory.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/ChatModelFactory.cs @@ -14,7 +14,7 @@ namespace Azure.Communication.Chat /// Model factory for models. public static partial class ChatModelFactory { - /// Initializes a new instance of ChatError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. @@ -25,17 +25,17 @@ public static ChatError ChatError(string code = null, string message = null, str { details ??= new List(); - return new ChatError(code, message, target, details?.ToList(), innerError); + return new ChatError(code, message, target, details?.ToList(), innerError, default); } - /// Initializes a new instance of AddChatParticipantsResult. + /// Initializes a new instance of . /// The participants that failed to be added to the chat thread. /// A new instance for mocking. public static AddChatParticipantsResult AddChatParticipantsResult(IEnumerable invalidParticipants = null) { invalidParticipants ??= new List(); - return new AddChatParticipantsResult(invalidParticipants?.ToList()); + return new AddChatParticipantsResult(invalidParticipants?.ToList(), default); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/ChatThreadRestClient.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/ChatThreadRestClient.cs index a99a88d3e016..404dff0eadbf 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/ChatThreadRestClient.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/ChatThreadRestClient.cs @@ -138,9 +138,7 @@ internal HttpMessage CreateSendChatReadReceiptRequest(string chatThreadId, strin request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var model = new SendReadReceiptRequest(chatMessageId); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -225,9 +223,7 @@ internal HttpMessage CreateSendChatMessageRequest(string chatThreadId, string co } } var model = sendChatMessageRequest; - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(model); - request.Content = content0; + request.Content = model; return message; } @@ -491,9 +487,7 @@ internal HttpMessage CreateUpdateChatMessageRequest(string chatThreadId, string } } var model = updateChatMessageRequest; - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(model); - request.Content = content0; + request.Content = model; return message; } @@ -729,9 +723,7 @@ internal HttpMessage CreateRemoveChatParticipantRequest(string chatThreadId, str PhoneNumber = phoneNumber, MicrosoftTeamsUser = microsoftTeamsUser }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -802,9 +794,7 @@ internal HttpMessage CreateAddChatParticipantsRequest(string chatThreadId, IEnum request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var model = new AddChatParticipantsRequest(participants.ToList()); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -889,9 +879,7 @@ internal HttpMessage CreateUpdateChatThreadPropertiesRequest(string chatThreadId { Topic = topic }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -1028,9 +1016,7 @@ internal HttpMessage CreateSendTypingNotificationRequest(string chatThreadId, st { SenderDisplayName = senderDisplayName }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.Serialization.cs index 05a8b96f3938..898f1aeb4e1e 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.Serialization.cs @@ -5,24 +5,130 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class AddChatParticipantsRequest : IUtf8JsonSerializable + internal partial class AddChatParticipantsRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("participants"u8); writer.WriteStartArray(); foreach (var item in Participants) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AddChatParticipantsRequest DeserializeAddChatParticipantsRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList participants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("participants"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ChatParticipantInternal.DeserializeChatParticipantInternal(item)); + } + participants = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddChatParticipantsRequest(participants, serializedAdditionalRawData); + } + + AddChatParticipantsRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddChatParticipantsRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddChatParticipantsRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddChatParticipantsRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddChatParticipantsRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddChatParticipantsRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddChatParticipantsRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.cs index 0e360b4fde63..faf191f6f8a6 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsRequest.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Chat /// Participants to be added to the thread. internal partial class AddChatParticipantsRequest { - /// Initializes a new instance of AddChatParticipantsRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Participants to add to a chat thread. /// is null. public AddChatParticipantsRequest(IEnumerable participants) @@ -25,6 +28,20 @@ public AddChatParticipantsRequest(IEnumerable participa Participants = participants.ToList(); } + /// Initializes a new instance of . + /// Participants to add to a chat thread. + /// Keeps track of any properties unknown to the library. + internal AddChatParticipantsRequest(IList participants, Dictionary serializedAdditionalRawData) + { + Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AddChatParticipantsRequest() + { + } + /// Participants to add to a chat thread. public IList Participants { get; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.Serialization.cs index a49ddc1e733c..f28bd2f81282 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - public partial class AddChatParticipantsResult + public partial class AddChatParticipantsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddChatParticipantsResult DeserializeAddChatParticipantsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddChatParticipantsResult DeserializeAddChatParticipantsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> invalidParticipants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("invalidParticipants"u8)) @@ -36,8 +64,61 @@ internal static AddChatParticipantsResult DeserializeAddChatParticipantsResult(J invalidParticipants = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddChatParticipantsResult(Optional.ToList(invalidParticipants)); + return new AddChatParticipantsResult(Optional.ToList(invalidParticipants), serializedAdditionalRawData); + } + + AddChatParticipantsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddChatParticipantsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddChatParticipantsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddChatParticipantsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddChatParticipantsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddChatParticipantsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddChatParticipantsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.cs index 6d66c0fde3d9..eaa2ec3c6d8a 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/AddChatParticipantsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.Communication.Chat /// Result of the add chat participants operation. public partial class AddChatParticipantsResult { - /// Initializes a new instance of AddChatParticipantsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddChatParticipantsResult() { InvalidParticipants = new ChangeTrackingList(); } - /// Initializes a new instance of AddChatParticipantsResult. + /// Initializes a new instance of . /// The participants that failed to be added to the chat thread. - internal AddChatParticipantsResult(IReadOnlyList invalidParticipants) + /// Keeps track of any properties unknown to the library. + internal AddChatParticipantsResult(IReadOnlyList invalidParticipants, Dictionary serializedAdditionalRawData) { InvalidParticipants = invalidParticipants; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The participants that failed to be added to the chat thread. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.Serialization.cs index bfed4b489a2f..d0a993d4598b 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - public partial class ChatError + public partial class ChatError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatError DeserializeChatError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatError DeserializeChatError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static ChatError DeserializeChatError(JsonElement element) Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static ChatError DeserializeChatError(JsonElement element) innererror = DeserializeChatError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new ChatError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + ChatError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.cs index 519846246806..46e4c1a6b0cd 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.Chat /// The Communication Services error. public partial class ChatError { - /// Initializes a new instance of ChatError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal ChatError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of ChatError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal ChatError(string code, string message, string target, IReadOnlyList details, ChatError innerError) + /// Keeps track of any properties unknown to the library. + internal ChatError(string code, string message, string target, IReadOnlyList details, ChatError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.Serialization.cs index 2f5020dc0bab..fd7e1765bf06 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatErrorResponse + internal partial class ChatErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatErrorResponse DeserializeChatErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatErrorResponse DeserializeChatErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ChatError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static ChatErrorResponse DeserializeChatErrorResponse(JsonElement eleme error = ChatError.DeserializeChatError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatErrorResponse(error); + return new ChatErrorResponse(error, serializedAdditionalRawData); + } + + ChatErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.cs index 2bf302b8ac66..8734323d5990 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Chat @@ -13,7 +14,10 @@ namespace Azure.Communication.Chat /// The Communication Services error. internal partial class ChatErrorResponse { - /// Initializes a new instance of ChatErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal ChatErrorResponse(ChatError error) @@ -23,6 +27,20 @@ internal ChatErrorResponse(ChatError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal ChatErrorResponse(ChatError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatErrorResponse() + { + } + /// The Communication Services error. public ChatError Error { get; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.Serialization.cs index 9c2925c8225f..df603c2498d8 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.Serialization.cs @@ -5,17 +5,83 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatMessageContentInternal + internal partial class ChatMessageContentInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatMessageContentInternal DeserializeChatMessageContentInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(Topic)) + { + writer.WritePropertyName("topic"u8); + writer.WriteStringValue(Topic); + } + if (Optional.IsCollectionDefined(Participants)) + { + writer.WritePropertyName("participants"u8); + writer.WriteStartArray(); + foreach (var item in Participants) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(InitiatorCommunicationIdentifier)) + { + writer.WritePropertyName("initiatorCommunicationIdentifier"u8); + if (InitiatorCommunicationIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InitiatorCommunicationIdentifier).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatMessageContentInternal DeserializeChatMessageContentInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +90,7 @@ internal static ChatMessageContentInternal DeserializeChatMessageContentInternal Optional topic = default; Optional> participants = default; Optional initiatorCommunicationIdentifier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("message"u8)) @@ -59,8 +126,61 @@ internal static ChatMessageContentInternal DeserializeChatMessageContentInternal initiatorCommunicationIdentifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChatMessageContentInternal(message.Value, topic.Value, Optional.ToList(participants), initiatorCommunicationIdentifier.Value, serializedAdditionalRawData); + } + + ChatMessageContentInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatMessageContentInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatMessageContentInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatMessageContentInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatMessageContentInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatMessageContentInternal(Response response) + { + if (response is null) + { + return null; } - return new ChatMessageContentInternal(message.Value, topic.Value, Optional.ToList(participants), initiatorCommunicationIdentifier.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatMessageContentInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.cs index e474481ab1e2..bdad35a087a9 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageContentInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,23 +15,28 @@ namespace Azure.Communication.Chat /// Content of a chat message. internal partial class ChatMessageContentInternal { - /// Initializes a new instance of ChatMessageContentInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ChatMessageContentInternal() { Participants = new ChangeTrackingList(); } - /// Initializes a new instance of ChatMessageContentInternal. + /// Initializes a new instance of . /// Chat message content for messages of types text or html. /// Chat message content for messages of type topicUpdated. /// Chat message content for messages of types participantAdded or participantRemoved. /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. - internal ChatMessageContentInternal(string message, string topic, IReadOnlyList participants, CommunicationIdentifierModel initiatorCommunicationIdentifier) + /// Keeps track of any properties unknown to the library. + internal ChatMessageContentInternal(string message, string topic, IReadOnlyList participants, CommunicationIdentifierModel initiatorCommunicationIdentifier, Dictionary serializedAdditionalRawData) { Message = message; Topic = topic; Participants = participants; InitiatorCommunicationIdentifier = initiatorCommunicationIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Chat message content for messages of types text or html. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.Serialization.cs index 0ef18f11ade9..8399e453bfb6 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.Serialization.cs @@ -8,15 +8,101 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatMessageInternal + internal partial class ChatMessageInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatMessageInternal DeserializeChatMessageInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("sequenceId"u8); + writer.WriteStringValue(SequenceId); + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + if (Content is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Content).Serialize(writer, options); + } + } + if (Optional.IsDefined(SenderDisplayName)) + { + writer.WritePropertyName("senderDisplayName"u8); + writer.WriteStringValue(SenderDisplayName); + } + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn, "O"); + if (Optional.IsDefined(SenderCommunicationIdentifier)) + { + writer.WritePropertyName("senderCommunicationIdentifier"u8); + if (SenderCommunicationIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SenderCommunicationIdentifier).Serialize(writer, options); + } + } + if (Optional.IsDefined(DeletedOn)) + { + writer.WritePropertyName("deletedOn"u8); + writer.WriteStringValue(DeletedOn.Value, "O"); + } + if (Optional.IsDefined(EditedOn)) + { + writer.WritePropertyName("editedOn"u8); + writer.WriteStringValue(EditedOn.Value, "O"); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatMessageInternal DeserializeChatMessageInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +118,7 @@ internal static ChatMessageInternal DeserializeChatMessageInternal(JsonElement e Optional deletedOn = default; Optional editedOn = default; Optional> metadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -114,8 +201,61 @@ internal static ChatMessageInternal DeserializeChatMessageInternal(JsonElement e metadata = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChatMessageInternal(id, type, sequenceId, version, content.Value, senderDisplayName.Value, createdOn, senderCommunicationIdentifier.Value, Optional.ToNullable(deletedOn), Optional.ToNullable(editedOn), Optional.ToDictionary(metadata), serializedAdditionalRawData); + } + + ChatMessageInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatMessageInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatMessageInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatMessageInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatMessageInternal model) + { + if (model is null) + { + return null; } - return new ChatMessageInternal(id, type, sequenceId, version, content.Value, senderDisplayName.Value, createdOn, senderCommunicationIdentifier.Value, Optional.ToNullable(deletedOn), Optional.ToNullable(editedOn), Optional.ToDictionary(metadata)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatMessageInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatMessageInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.cs index 0db6fbd41e63..3f39b5155f4f 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageInternal.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Chat /// Chat message. internal partial class ChatMessageInternal { - /// Initializes a new instance of ChatMessageInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The id of the chat message. This id is server generated. /// The chat message type. /// Sequence of the chat message in the conversation. @@ -36,7 +39,7 @@ internal ChatMessageInternal(string id, ChatMessageType type, string sequenceId, Metadata = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ChatMessageInternal. + /// Initializes a new instance of . /// The id of the chat message. This id is server generated. /// The chat message type. /// Sequence of the chat message in the conversation. @@ -48,7 +51,8 @@ internal ChatMessageInternal(string id, ChatMessageType type, string sequenceId, /// The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// Message metadata. - internal ChatMessageInternal(string id, ChatMessageType type, string sequenceId, string version, ChatMessageContentInternal content, string senderDisplayName, DateTimeOffset createdOn, CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset? deletedOn, DateTimeOffset? editedOn, IReadOnlyDictionary metadata) + /// Keeps track of any properties unknown to the library. + internal ChatMessageInternal(string id, ChatMessageType type, string sequenceId, string version, ChatMessageContentInternal content, string senderDisplayName, DateTimeOffset createdOn, CommunicationIdentifierModel senderCommunicationIdentifier, DateTimeOffset? deletedOn, DateTimeOffset? editedOn, IReadOnlyDictionary metadata, Dictionary serializedAdditionalRawData) { Id = id; Type = type; @@ -61,6 +65,12 @@ internal ChatMessageInternal(string id, ChatMessageType type, string sequenceId, DeletedOn = deletedOn; EditedOn = editedOn; Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatMessageInternal() + { } /// The id of the chat message. This id is server generated. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.Serialization.cs index 70ba57175825..846bd1bf65ab 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.Serialization.cs @@ -6,16 +6,56 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatMessageReadReceiptInternal + internal partial class ChatMessageReadReceiptInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatMessageReadReceiptInternal DeserializeChatMessageReadReceiptInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("senderCommunicationIdentifier"u8); + if (SenderCommunicationIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SenderCommunicationIdentifier).Serialize(writer, options); + } + writer.WritePropertyName("chatMessageId"u8); + writer.WriteStringValue(ChatMessageId); + writer.WritePropertyName("readOn"u8); + writer.WriteStringValue(ReadOn, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatMessageReadReceiptInternal DeserializeChatMessageReadReceiptInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +63,7 @@ internal static ChatMessageReadReceiptInternal DeserializeChatMessageReadReceipt CommunicationIdentifierModel senderCommunicationIdentifier = default; string chatMessageId = default; DateTimeOffset readOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("senderCommunicationIdentifier"u8)) @@ -40,8 +81,61 @@ internal static ChatMessageReadReceiptInternal DeserializeChatMessageReadReceipt readOn = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatMessageReadReceiptInternal(senderCommunicationIdentifier, chatMessageId, readOn); + return new ChatMessageReadReceiptInternal(senderCommunicationIdentifier, chatMessageId, readOn, serializedAdditionalRawData); + } + + ChatMessageReadReceiptInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatMessageReadReceiptInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatMessageReadReceiptInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatMessageReadReceiptInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatMessageReadReceiptInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatMessageReadReceiptInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatMessageReadReceiptInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.cs index 2567cd1b7fb5..b787016d3fbf 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.Chat /// A chat message read receipt indicates the time a chat message was read by a recipient. internal partial class ChatMessageReadReceiptInternal { - /// Initializes a new instance of ChatMessageReadReceiptInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. /// Id of the chat message that has been read. This id is generated by the server. /// The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. @@ -29,6 +33,24 @@ internal ChatMessageReadReceiptInternal(CommunicationIdentifierModel senderCommu ReadOn = readOn; } + /// Initializes a new instance of . + /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. + /// Id of the chat message that has been read. This id is generated by the server. + /// The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. + /// Keeps track of any properties unknown to the library. + internal ChatMessageReadReceiptInternal(CommunicationIdentifierModel senderCommunicationIdentifier, string chatMessageId, DateTimeOffset readOn, Dictionary serializedAdditionalRawData) + { + SenderCommunicationIdentifier = senderCommunicationIdentifier; + ChatMessageId = chatMessageId; + ReadOn = readOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatMessageReadReceiptInternal() + { + } + /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. public CommunicationIdentifierModel SenderCommunicationIdentifier { get; } /// Id of the chat message that has been read. This id is generated by the server. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.Serialization.cs index d8f364279142..71bee44dd0aa 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatMessageReadReceiptsCollection + internal partial class ChatMessageReadReceiptsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatMessageReadReceiptsCollection DeserializeChatMessageReadReceiptsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatMessageReadReceiptsCollection DeserializeChatMessageReadReceiptsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ChatMessageReadReceiptsCollection DeserializeChatMessageReadRece nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatMessageReadReceiptsCollection(value, nextLink.Value); + return new ChatMessageReadReceiptsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ChatMessageReadReceiptsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatMessageReadReceiptsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatMessageReadReceiptsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatMessageReadReceiptsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatMessageReadReceiptsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatMessageReadReceiptsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatMessageReadReceiptsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.cs index 627f572160d9..0f7436219d99 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessageReadReceiptsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Chat /// A paged collection of chat message read receipts. internal partial class ChatMessageReadReceiptsCollection { - /// Initializes a new instance of ChatMessageReadReceiptsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of chat message read receipts. /// is null. internal ChatMessageReadReceiptsCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ChatMessageReadReceiptsCollection(IEnumerable Initializes a new instance of ChatMessageReadReceiptsCollection. + /// Initializes a new instance of . /// Collection of chat message read receipts. /// If there are more chat message read receipts that can be retrieved, the next link will be populated. - internal ChatMessageReadReceiptsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ChatMessageReadReceiptsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatMessageReadReceiptsCollection() + { } /// Collection of chat message read receipts. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.Serialization.cs index 8fde92892171..74dcf2bc90de 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatMessagesCollection + internal partial class ChatMessagesCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatMessagesCollection DeserializeChatMessagesCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatMessagesCollection DeserializeChatMessagesCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ChatMessagesCollection DeserializeChatMessagesCollection(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatMessagesCollection(value, nextLink.Value); + return new ChatMessagesCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ChatMessagesCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatMessagesCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatMessagesCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatMessagesCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatMessagesCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatMessagesCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatMessagesCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.cs index 837d27d690fd..4cde9cbf48c3 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatMessagesCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Chat /// Collection of chat messages for a particular chat thread. internal partial class ChatMessagesCollection { - /// Initializes a new instance of ChatMessagesCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of chat messages. /// is null. internal ChatMessagesCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ChatMessagesCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ChatMessagesCollection. + /// Initializes a new instance of . /// Collection of chat messages. /// If there are more chat messages that can be retrieved, the next link will be populated. - internal ChatMessagesCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ChatMessagesCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatMessagesCollection() + { } /// Collection of chat messages. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.Serialization.cs index f8e4526f6bde..2a5713fd76fb 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.Serialization.cs @@ -6,19 +6,33 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatParticipantInternal : IUtf8JsonSerializable + internal partial class ChatParticipantInternal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("communicationIdentifier"u8); - writer.WriteObjectValue(CommunicationIdentifier); + if (CommunicationIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommunicationIdentifier).Serialize(writer, options); + } if (Optional.IsDefined(DisplayName)) { writer.WritePropertyName("displayName"u8); @@ -29,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("shareHistoryTime"u8); writer.WriteStringValue(ShareHistoryTime.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ChatParticipantInternal DeserializeChatParticipantInternal(JsonElement element) + internal static ChatParticipantInternal DeserializeChatParticipantInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +69,7 @@ internal static ChatParticipantInternal DeserializeChatParticipantInternal(JsonE CommunicationIdentifierModel communicationIdentifier = default; Optional displayName = default; Optional shareHistoryTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("communicationIdentifier"u8)) @@ -62,8 +91,61 @@ internal static ChatParticipantInternal DeserializeChatParticipantInternal(JsonE shareHistoryTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChatParticipantInternal(communicationIdentifier, displayName.Value, Optional.ToNullable(shareHistoryTime), serializedAdditionalRawData); + } + + ChatParticipantInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatParticipantInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatParticipantInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatParticipantInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatParticipantInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatParticipantInternal(Response response) + { + if (response is null) + { + return null; } - return new ChatParticipantInternal(communicationIdentifier, displayName.Value, Optional.ToNullable(shareHistoryTime)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatParticipantInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.cs index 257843317d36..cfd6277dbf21 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.Chat /// A participant of the chat thread. internal partial class ChatParticipantInternal { - /// Initializes a new instance of ChatParticipantInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. /// is null. public ChatParticipantInternal(CommunicationIdentifierModel communicationIdentifier) @@ -24,15 +28,22 @@ public ChatParticipantInternal(CommunicationIdentifierModel communicationIdentif CommunicationIdentifier = communicationIdentifier; } - /// Initializes a new instance of ChatParticipantInternal. + /// Initializes a new instance of . /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. /// Display name for the chat participant. /// Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. - internal ChatParticipantInternal(CommunicationIdentifierModel communicationIdentifier, string displayName, DateTimeOffset? shareHistoryTime) + /// Keeps track of any properties unknown to the library. + internal ChatParticipantInternal(CommunicationIdentifierModel communicationIdentifier, string displayName, DateTimeOffset? shareHistoryTime, Dictionary serializedAdditionalRawData) { CommunicationIdentifier = communicationIdentifier; DisplayName = displayName; ShareHistoryTime = shareHistoryTime; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatParticipantInternal() + { } /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.Serialization.cs index cdf400ec5533..d38e6a744f67 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatParticipantsCollection + internal partial class ChatParticipantsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatParticipantsCollection DeserializeChatParticipantsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatParticipantsCollection DeserializeChatParticipantsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ChatParticipantsCollection DeserializeChatParticipantsCollection nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatParticipantsCollection(value, nextLink.Value); + return new ChatParticipantsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ChatParticipantsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatParticipantsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatParticipantsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatParticipantsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatParticipantsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatParticipantsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatParticipantsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.cs index 31e4c46f7d1a..e33767deca09 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatParticipantsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Chat /// Collection of participants belong to a particular thread. internal partial class ChatParticipantsCollection { - /// Initializes a new instance of ChatParticipantsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Chat participants. /// is null. internal ChatParticipantsCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ChatParticipantsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ChatParticipantsCollection. + /// Initializes a new instance of . /// Chat participants. /// If there are more chat participants that can be retrieved, the next link will be populated. - internal ChatParticipantsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ChatParticipantsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatParticipantsCollection() + { } /// Chat participants. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.Serialization.cs index 5051548786f5..7dff4b827d7b 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.Serialization.cs @@ -6,15 +6,51 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - public partial class ChatThreadItem + public partial class ChatThreadItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatThreadItem DeserializeChatThreadItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("topic"u8); + writer.WriteStringValue(Topic); + if (Optional.IsDefined(DeletedOn)) + { + writer.WritePropertyName("deletedOn"u8); + writer.WriteStringValue(DeletedOn.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatThreadItem DeserializeChatThreadItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +59,7 @@ internal static ChatThreadItem DeserializeChatThreadItem(JsonElement element) string topic = default; Optional deletedOn = default; Optional lastMessageReceivedOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -53,8 +90,61 @@ internal static ChatThreadItem DeserializeChatThreadItem(JsonElement element) lastMessageReceivedOn = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatThreadItem(id, topic, Optional.ToNullable(deletedOn), Optional.ToNullable(lastMessageReceivedOn)); + return new ChatThreadItem(id, topic, Optional.ToNullable(deletedOn), Optional.ToNullable(lastMessageReceivedOn), serializedAdditionalRawData); + } + + ChatThreadItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatThreadItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatThreadItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatThreadItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatThreadItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatThreadItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatThreadItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.cs index b63a9430f221..99e9101fdbbc 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadItem.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Chat @@ -13,7 +14,10 @@ namespace Azure.Communication.Chat /// Summary information of a chat thread. public partial class ChatThreadItem { - /// Initializes a new instance of ChatThreadItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Chat thread id. /// Chat thread topic. /// or is null. @@ -26,17 +30,24 @@ internal ChatThreadItem(string id, string topic) Topic = topic; } - /// Initializes a new instance of ChatThreadItem. + /// Initializes a new instance of . /// Chat thread id. /// Chat thread topic. /// The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// The timestamp when the last message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. - internal ChatThreadItem(string id, string topic, DateTimeOffset? deletedOn, DateTimeOffset? lastMessageReceivedOn) + /// Keeps track of any properties unknown to the library. + internal ChatThreadItem(string id, string topic, DateTimeOffset? deletedOn, DateTimeOffset? lastMessageReceivedOn, Dictionary serializedAdditionalRawData) { Id = id; Topic = topic; DeletedOn = deletedOn; LastMessageReceivedOn = lastMessageReceivedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatThreadItem() + { } /// Chat thread id. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.Serialization.cs index 45a3449864a0..3b25e0cdad78 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.Serialization.cs @@ -6,16 +6,63 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatThreadPropertiesInternal + internal partial class ChatThreadPropertiesInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatThreadPropertiesInternal DeserializeChatThreadPropertiesInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("topic"u8); + writer.WriteStringValue(Topic); + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn, "O"); + writer.WritePropertyName("createdByCommunicationIdentifier"u8); + if (CreatedByCommunicationIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreatedByCommunicationIdentifier).Serialize(writer, options); + } + if (Optional.IsDefined(DeletedOn)) + { + writer.WritePropertyName("deletedOn"u8); + writer.WriteStringValue(DeletedOn.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatThreadPropertiesInternal DeserializeChatThreadPropertiesInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +72,7 @@ internal static ChatThreadPropertiesInternal DeserializeChatThreadPropertiesInte DateTimeOffset createdOn = default; CommunicationIdentifierModel createdByCommunicationIdentifier = default; Optional deletedOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -56,8 +104,61 @@ internal static ChatThreadPropertiesInternal DeserializeChatThreadPropertiesInte deletedOn = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatThreadPropertiesInternal(id, topic, createdOn, createdByCommunicationIdentifier, Optional.ToNullable(deletedOn)); + return new ChatThreadPropertiesInternal(id, topic, createdOn, createdByCommunicationIdentifier, Optional.ToNullable(deletedOn), serializedAdditionalRawData); + } + + ChatThreadPropertiesInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatThreadPropertiesInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatThreadPropertiesInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatThreadPropertiesInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatThreadPropertiesInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatThreadPropertiesInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatThreadPropertiesInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.cs index 1e5fdcebf7f8..b671cf80ff3d 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadPropertiesInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.Chat /// Chat thread. internal partial class ChatThreadPropertiesInternal { - /// Initializes a new instance of ChatThreadPropertiesInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Chat thread id. /// Chat thread topic. /// The timestamp when the chat thread was created. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. @@ -32,19 +36,26 @@ internal ChatThreadPropertiesInternal(string id, string topic, DateTimeOffset cr CreatedByCommunicationIdentifier = createdByCommunicationIdentifier; } - /// Initializes a new instance of ChatThreadPropertiesInternal. + /// Initializes a new instance of . /// Chat thread id. /// Chat thread topic. /// The timestamp when the chat thread was created. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. /// The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. - internal ChatThreadPropertiesInternal(string id, string topic, DateTimeOffset createdOn, CommunicationIdentifierModel createdByCommunicationIdentifier, DateTimeOffset? deletedOn) + /// Keeps track of any properties unknown to the library. + internal ChatThreadPropertiesInternal(string id, string topic, DateTimeOffset createdOn, CommunicationIdentifierModel createdByCommunicationIdentifier, DateTimeOffset? deletedOn, Dictionary serializedAdditionalRawData) { Id = id; Topic = topic; CreatedOn = createdOn; CreatedByCommunicationIdentifier = createdByCommunicationIdentifier; DeletedOn = deletedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatThreadPropertiesInternal() + { } /// Chat thread id. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.Serialization.cs index f9d9116daca5..f32ea77ae574 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class ChatThreadsItemCollection + internal partial class ChatThreadsItemCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChatThreadsItemCollection DeserializeChatThreadsItemCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChatThreadsItemCollection DeserializeChatThreadsItemCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ChatThreadsItemCollection DeserializeChatThreadsItemCollection(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChatThreadsItemCollection(value, nextLink.Value); + return new ChatThreadsItemCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ChatThreadsItemCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChatThreadsItemCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChatThreadsItemCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChatThreadsItemCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChatThreadsItemCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChatThreadsItemCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChatThreadsItemCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.cs index a99ea02753c0..cc195a4beb53 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/ChatThreadsItemCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Chat /// Collection of chat threads. internal partial class ChatThreadsItemCollection { - /// Initializes a new instance of ChatThreadsItemCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of chat threads. /// is null. internal ChatThreadsItemCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ChatThreadsItemCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ChatThreadsItemCollection. + /// Initializes a new instance of . /// Collection of chat threads. /// If there are more chat threads that can be retrieved, the next link will be populated. - internal ChatThreadsItemCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ChatThreadsItemCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChatThreadsItemCollection() + { } /// Collection of chat threads. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs index f1ed91a83a0a..2f771c28df8e 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RawId)) { @@ -23,23 +31,58 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CommunicationUser)) { writer.WritePropertyName("communicationUser"u8); - writer.WriteObjectValue(CommunicationUser); + if (CommunicationUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommunicationUser).Serialize(writer, options); + } } if (Optional.IsDefined(PhoneNumber)) { writer.WritePropertyName("phoneNumber"u8); - writer.WriteObjectValue(PhoneNumber); + if (PhoneNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PhoneNumber).Serialize(writer, options); + } } if (Optional.IsDefined(MicrosoftTeamsUser)) { writer.WritePropertyName("microsoftTeamsUser"u8); - writer.WriteObjectValue(MicrosoftTeamsUser); + if (MicrosoftTeamsUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MicrosoftTeamsUser).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element) + internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +91,7 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM Optional communicationUser = default; Optional phoneNumber = default; Optional microsoftTeamsUser = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rawId"u8)) @@ -82,8 +126,61 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM microsoftTeamsUser = MicrosoftTeamsUserIdentifierModel.DeserializeMicrosoftTeamsUserIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIdentifierModel(rawId.Value, communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value, serializedAdditionalRawData); + } + + CommunicationIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentifierModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentifierModel(Response response) + { + if (response is null) + { + return null; } - return new CommunicationIdentifierModel(rawId.Value, communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.cs index 9d88d749c458..a1f82d49270b 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationIdentifierModel.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication { /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. internal partial class CommunicationIdentifierModel { - /// Initializes a new instance of CommunicationIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationIdentifierModel() { } - /// Initializes a new instance of CommunicationIdentifierModel. + /// Initializes a new instance of . /// Raw Id of the identifier. Optional in requests, required in responses. /// The communication user. /// The phone number. /// The Microsoft Teams user. - internal CommunicationIdentifierModel(string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser) + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentifierModel(string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, Dictionary serializedAdditionalRawData) { RawId = rawId; CommunicationUser = communicationUser; PhoneNumber = phoneNumber; MicrosoftTeamsUser = microsoftTeamsUser; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Raw Id of the identifier. Optional in requests, required in responses. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs index 606b9637a4ea..ed94ea13226d 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element) + internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -34,8 +57,61 @@ internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIde id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationUserIdentifierModel(id, serializedAdditionalRawData); + } + + CommunicationUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new CommunicationUserIdentifierModel(id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.cs index 1f90746ab01e..f4e6bdb9c80d 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CommunicationUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A user that got created with an Azure Communication Services resource. internal partial class CommunicationUserIdentifierModel { - /// Initializes a new instance of CommunicationUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the communication user. /// is null. public CommunicationUserIdentifierModel(string id) @@ -23,6 +27,20 @@ public CommunicationUserIdentifierModel(string id) Id = id; } + /// Initializes a new instance of . + /// The Id of the communication user. + /// Keeps track of any properties unknown to the library. + internal CommunicationUserIdentifierModel(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationUserIdentifierModel() + { + } + /// The Id of the communication user. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.Serialization.cs index da2ffff61006..e84800057cac 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class CreateChatThreadRequest : IUtf8JsonSerializable + internal partial class CreateChatThreadRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("topic"u8); writer.WriteStringValue(Topic); @@ -23,11 +31,119 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Participants) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CreateChatThreadRequest DeserializeCreateChatThreadRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string topic = default; + Optional> participants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("topic"u8)) + { + topic = property.Value.GetString(); + continue; + } + if (property.NameEquals("participants"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ChatParticipantInternal.DeserializeChatParticipantInternal(item)); + } + participants = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateChatThreadRequest(topic, Optional.ToList(participants), serializedAdditionalRawData); + } + + CreateChatThreadRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateChatThreadRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateChatThreadRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateChatThreadRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateChatThreadRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateChatThreadRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateChatThreadRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.cs index 3b4718df5fc0..e92da6b92f49 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadRequest.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.Chat /// Request payload for creating a chat thread. internal partial class CreateChatThreadRequest { - /// Initializes a new instance of CreateChatThreadRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The chat thread topic. /// is null. public CreateChatThreadRequest(string topic) @@ -25,6 +28,22 @@ public CreateChatThreadRequest(string topic) Participants = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The chat thread topic. + /// Participants to be added to the chat thread. + /// Keeps track of any properties unknown to the library. + internal CreateChatThreadRequest(string topic, IList participants, Dictionary serializedAdditionalRawData) + { + Topic = topic; + Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateChatThreadRequest() + { + } + /// The chat thread topic. public string Topic { get; } /// Participants to be added to the chat thread. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.Serialization.cs index d007e2caa6ac..76eddbada72e 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.Serialization.cs @@ -5,22 +5,62 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class CreateChatThreadResultInternal + internal partial class CreateChatThreadResultInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CreateChatThreadResultInternal DeserializeCreateChatThreadResultInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ChatThread)) + { + writer.WritePropertyName("chatThread"u8); + if (ChatThread is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ChatThread).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CreateChatThreadResultInternal DeserializeCreateChatThreadResultInternal(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional chatThread = default; Optional> invalidParticipants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("chatThread"u8)) @@ -46,8 +86,61 @@ internal static CreateChatThreadResultInternal DeserializeCreateChatThreadResult invalidParticipants = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CreateChatThreadResultInternal(chatThread.Value, Optional.ToList(invalidParticipants)); + return new CreateChatThreadResultInternal(chatThread.Value, Optional.ToList(invalidParticipants), serializedAdditionalRawData); + } + + CreateChatThreadResultInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateChatThreadResultInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateChatThreadResultInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateChatThreadResultInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateChatThreadResultInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateChatThreadResultInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateChatThreadResultInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.cs index aac23e39b7bf..7c3f98c380ea 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/CreateChatThreadResultInternal.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.Chat /// Result of the create chat thread operation. internal partial class CreateChatThreadResultInternal { - /// Initializes a new instance of CreateChatThreadResultInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CreateChatThreadResultInternal() { InvalidParticipants = new ChangeTrackingList(); } - /// Initializes a new instance of CreateChatThreadResultInternal. + /// Initializes a new instance of . /// Chat thread. /// The participants that failed to be added to the chat thread. - internal CreateChatThreadResultInternal(ChatThreadPropertiesInternal chatThread, IReadOnlyList invalidParticipants) + /// Keeps track of any properties unknown to the library. + internal CreateChatThreadResultInternal(ChatThreadPropertiesInternal chatThread, IReadOnlyList invalidParticipants, Dictionary serializedAdditionalRawData) { ChatThread = chatThread; InvalidParticipants = invalidParticipants; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Chat thread. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs index b84cac6e4d46..670616c6d8ce 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable + internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userId"u8); writer.WriteStringValue(UserId); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cloud"u8); writer.WriteStringValue(Cloud.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element) + internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI string userId = default; Optional isAnonymous = default; Optional cloud = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userId"u8)) @@ -64,8 +87,61 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud), serializedAdditionalRawData); + } + + MicrosoftTeamsUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftTeamsUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftTeamsUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftTeamsUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs index 20dfff30e6fe..3e8733d38ce9 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A Microsoft Teams user. internal partial class MicrosoftTeamsUserIdentifierModel { - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// is null. public MicrosoftTeamsUserIdentifierModel(string userId) @@ -23,15 +27,22 @@ public MicrosoftTeamsUserIdentifierModel(string userId) UserId = userId; } - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// True if the Microsoft Teams user is anonymous. By default false if missing. /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud) + /// Keeps track of any properties unknown to the library. + internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud, Dictionary serializedAdditionalRawData) { UserId = userId; IsAnonymous = isAnonymous; Cloud = cloud; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MicrosoftTeamsUserIdentifierModel() + { } /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs index dce7185be6bd..004f3f6df1a9 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable + internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element) + internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -34,8 +57,61 @@ internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberIdentifierModel(value, serializedAdditionalRawData); + } + + PhoneNumberIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberIdentifierModel model) + { + if (model is null) + { + return null; } - return new PhoneNumberIdentifierModel(value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.cs index d9416ecf4e45..0a9a484b4f83 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/PhoneNumberIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A phone number. internal partial class PhoneNumberIdentifierModel { - /// Initializes a new instance of PhoneNumberIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The phone number in E.164 format. /// is null. public PhoneNumberIdentifierModel(string value) @@ -23,6 +27,20 @@ public PhoneNumberIdentifierModel(string value) Value = value; } + /// Initializes a new instance of . + /// The phone number in E.164 format. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberIdentifierModel(string value, Dictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberIdentifierModel() + { + } + /// The phone number in E.164 format. public string Value { get; set; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.Serialization.cs index 9da86d681f07..44f538f3bb81 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class SendChatMessageRequest : IUtf8JsonSerializable + internal partial class SendChatMessageRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("content"u8); writer.WriteStringValue(Content); @@ -38,7 +46,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SendChatMessageRequest DeserializeSendChatMessageRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string content = default; + Optional senderDisplayName = default; + Optional type = default; + Optional> metadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("senderDisplayName"u8)) + { + senderDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ChatMessageType(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SendChatMessageRequest(content, senderDisplayName.Value, Optional.ToNullable(type), Optional.ToDictionary(metadata), serializedAdditionalRawData); + } + + SendChatMessageRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendChatMessageRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendChatMessageRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendChatMessageRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendChatMessageRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendChatMessageRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendChatMessageRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.cs index 0ee7fe5d2414..1cd22fa91fd6 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageRequest.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.Chat /// Details of the message to send. internal partial class SendChatMessageRequest { - /// Initializes a new instance of SendChatMessageRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Chat message content. /// is null. public SendChatMessageRequest(string content) @@ -25,6 +28,26 @@ public SendChatMessageRequest(string content) Metadata = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Chat message content. + /// The display name of the chat message sender. This property is used to populate sender name for push notifications. + /// The chat message type. + /// Message metadata. + /// Keeps track of any properties unknown to the library. + internal SendChatMessageRequest(string content, string senderDisplayName, ChatMessageType? type, IDictionary metadata, Dictionary serializedAdditionalRawData) + { + Content = content; + SenderDisplayName = senderDisplayName; + Type = type; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendChatMessageRequest() + { + } + /// Chat message content. public string Content { get; } /// The display name of the chat message sender. This property is used to populate sender name for push notifications. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.Serialization.cs index 71e478e4d93d..239d114da486 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.Serialization.cs @@ -5,20 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class SendChatMessageResultInternal + internal partial class SendChatMessageResultInternal : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SendChatMessageResultInternal DeserializeSendChatMessageResultInternal(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SendChatMessageResultInternal DeserializeSendChatMessageResultInternal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -26,8 +57,61 @@ internal static SendChatMessageResultInternal DeserializeSendChatMessageResultIn id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SendChatMessageResultInternal(id); + return new SendChatMessageResultInternal(id, serializedAdditionalRawData); + } + + SendChatMessageResultInternal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendChatMessageResultInternal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendChatMessageResultInternal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendChatMessageResultInternal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendChatMessageResultInternal model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendChatMessageResultInternal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendChatMessageResultInternal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.cs index ce640f60e00f..11a9d9ef103a 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendChatMessageResultInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Chat @@ -13,7 +14,10 @@ namespace Azure.Communication.Chat /// Result of the send message operation. internal partial class SendChatMessageResultInternal { - /// Initializes a new instance of SendChatMessageResultInternal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A server-generated message id. /// is null. internal SendChatMessageResultInternal(string id) @@ -23,6 +27,20 @@ internal SendChatMessageResultInternal(string id) Id = id; } + /// Initializes a new instance of . + /// A server-generated message id. + /// Keeps track of any properties unknown to the library. + internal SendChatMessageResultInternal(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendChatMessageResultInternal() + { + } + /// A server-generated message id. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.Serialization.cs index fa67a95d50ee..5f1e07f52264 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class SendReadReceiptRequest : IUtf8JsonSerializable + internal partial class SendReadReceiptRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("chatMessageId"u8); writer.WriteStringValue(ChatMessageId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SendReadReceiptRequest DeserializeSendReadReceiptRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string chatMessageId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("chatMessageId"u8)) + { + chatMessageId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SendReadReceiptRequest(chatMessageId, serializedAdditionalRawData); + } + + SendReadReceiptRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendReadReceiptRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendReadReceiptRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendReadReceiptRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendReadReceiptRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendReadReceiptRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendReadReceiptRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.cs index 6cd0c44024bb..fa3a30282c74 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendReadReceiptRequest.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Chat @@ -13,7 +14,10 @@ namespace Azure.Communication.Chat /// Request payload for sending a read receipt. internal partial class SendReadReceiptRequest { - /// Initializes a new instance of SendReadReceiptRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Id of the latest chat message read by the user. /// is null. public SendReadReceiptRequest(string chatMessageId) @@ -23,6 +27,20 @@ public SendReadReceiptRequest(string chatMessageId) ChatMessageId = chatMessageId; } + /// Initializes a new instance of . + /// Id of the latest chat message read by the user. + /// Keeps track of any properties unknown to the library. + internal SendReadReceiptRequest(string chatMessageId, Dictionary serializedAdditionalRawData) + { + ChatMessageId = chatMessageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendReadReceiptRequest() + { + } + /// Id of the latest chat message read by the user. public string ChatMessageId { get; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.Serialization.cs index 411f2e1e4d47..6c49d653b79e 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class SendTypingNotificationRequest : IUtf8JsonSerializable + internal partial class SendTypingNotificationRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SenderDisplayName)) { writer.WritePropertyName("senderDisplayName"u8); writer.WriteStringValue(SenderDisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SendTypingNotificationRequest DeserializeSendTypingNotificationRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional senderDisplayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("senderDisplayName"u8)) + { + senderDisplayName = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SendTypingNotificationRequest(senderDisplayName.Value, serializedAdditionalRawData); + } + + SendTypingNotificationRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendTypingNotificationRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendTypingNotificationRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendTypingNotificationRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendTypingNotificationRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendTypingNotificationRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendTypingNotificationRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.cs index 46f06b4e8b16..b71754e453fa 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/SendTypingNotificationRequest.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.Chat { /// Request payload for typing notifications. internal partial class SendTypingNotificationRequest { - /// Initializes a new instance of SendTypingNotificationRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SendTypingNotificationRequest() { } + /// Initializes a new instance of . + /// The display name of the typing notification sender. This property is used to populate sender name for push notifications. + /// Keeps track of any properties unknown to the library. + internal SendTypingNotificationRequest(string senderDisplayName, Dictionary serializedAdditionalRawData) + { + SenderDisplayName = senderDisplayName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The display name of the typing notification sender. This property is used to populate sender name for push notifications. public string SenderDisplayName { get; set; } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.Serialization.cs index 3ac23ce25b39..a8f444ec5a99 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class UpdateChatMessageRequest : IUtf8JsonSerializable + internal partial class UpdateChatMessageRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Content)) { @@ -31,7 +39,108 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UpdateChatMessageRequest DeserializeUpdateChatMessageRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional content = default; + Optional> metadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateChatMessageRequest(content.Value, Optional.ToDictionary(metadata), serializedAdditionalRawData); + } + + UpdateChatMessageRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateChatMessageRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateChatMessageRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateChatMessageRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateChatMessageRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateChatMessageRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateChatMessageRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.cs index 9354af34ccdf..f7dde165ab6b 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatMessageRequest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.Communication.Chat /// Request payload for updating a chat message. internal partial class UpdateChatMessageRequest { - /// Initializes a new instance of UpdateChatMessageRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateChatMessageRequest() { Metadata = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Chat message content. + /// Message metadata. + /// Keeps track of any properties unknown to the library. + internal UpdateChatMessageRequest(string content, IDictionary metadata, Dictionary serializedAdditionalRawData) + { + Content = content; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Chat message content. public string Content { get; set; } /// Message metadata. diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.Serialization.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.Serialization.cs index 70d651af78b3..35ca21e9c064 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Chat { - internal partial class UpdateChatThreadRequest : IUtf8JsonSerializable + internal partial class UpdateChatThreadRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Topic)) { writer.WritePropertyName("topic"u8); writer.WriteStringValue(Topic); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UpdateChatThreadRequest DeserializeUpdateChatThreadRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional topic = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("topic"u8)) + { + topic = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateChatThreadRequest(topic.Value, serializedAdditionalRawData); + } + + UpdateChatThreadRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateChatThreadRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateChatThreadRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateChatThreadRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateChatThreadRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateChatThreadRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateChatThreadRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.cs b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.cs index c62545d68de4..ab72a331d2dd 100644 --- a/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.cs +++ b/sdk/communication/Azure.Communication.Chat/src/Generated/Models/UpdateChatThreadRequest.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.Chat { /// Request payload for updating a chat thread. internal partial class UpdateChatThreadRequest { - /// Initializes a new instance of UpdateChatThreadRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateChatThreadRequest() { } + /// Initializes a new instance of . + /// Chat thread topic. + /// Keeps track of any properties unknown to the library. + internal UpdateChatThreadRequest(string topic, Dictionary serializedAdditionalRawData) + { + Topic = topic; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Chat thread topic. public string Topic { get; set; } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/CommunicationEmailModelFactory.cs b/sdk/communication/Azure.Communication.Email/src/Generated/CommunicationEmailModelFactory.cs new file mode 100644 index 000000000000..2733e97db764 --- /dev/null +++ b/sdk/communication/Azure.Communication.Email/src/Generated/CommunicationEmailModelFactory.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.Email +{ + /// Model factory for models. + public static partial class CommunicationEmailModelFactory + { + /// Initializes a new instance of . + /// Custom email headers to be passed. + /// Sender email address from a verified domain. + /// Email content to be sent. + /// Recipients for the email. + /// List of attachments. Please note that we limit the total size of an email request (which includes attachments) to 10MB. + /// Email addresses where recipients' replies will be sent to. + /// Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane. + /// A new instance for mocking. + public static EmailMessage EmailMessage(IDictionary headers = null, string senderAddress = null, EmailContent content = null, EmailRecipients recipients = null, IEnumerable attachments = null, IEnumerable replyTo = null, bool? userEngagementTrackingDisabled = null) + { + headers ??= new Dictionary(); + attachments ??= new List(); + replyTo ??= new List(); + + return new EmailMessage(headers, senderAddress, content, recipients, attachments?.ToList(), replyTo?.ToList(), userEngagementTrackingDisabled, default); + } + + /// Initializes a new instance of . + /// Subject of the email message. + /// Plain text version of the email message. + /// Html version of the email message. + /// A new instance for mocking. + public static EmailContent EmailContent(string subject = null, string plainText = null, string html = null) + { + return new EmailContent(subject, plainText, html, default); + } + } +} diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/EmailRestClient.cs b/sdk/communication/Azure.Communication.Email/src/Generated/EmailRestClient.cs index 3bdf910026dd..72a2ddc3250e 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/EmailRestClient.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/EmailRestClient.cs @@ -125,9 +125,7 @@ internal HttpMessage CreateSendRequest(EmailMessage message, Guid? operationId) } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(message); - request.Content = content; + request.Content = message; return message0; } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.Serialization.cs index 2f89d7eecbbb..fe9e79e38174 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.Serialization.cs @@ -5,15 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - public partial struct EmailAddress : IUtf8JsonSerializable + public partial struct EmailAddress : IUtf8JsonSerializable, IModelJsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("address"u8); + writer.WriteStringValue(Address); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("address"u8); writer.WriteStringValue(Address); @@ -22,7 +57,110 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EmailAddress DeserializeEmailAddress(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + string address = default; + Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("address"u8)) + { + address = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailAddress(address, displayName.Value, serializedAdditionalRawData); + } + + EmailAddress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailAddress(doc.RootElement, options); + } + + object IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailAddress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + object IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailAddress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailAddress model) + { + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailAddress(Response response) + { + Argument.AssertNotNull(response, nameof(response)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailAddress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.cs index 72c516d75687..704389f2f746 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAddress.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Email @@ -13,6 +14,20 @@ namespace Azure.Communication.Email /// An object representing the email address and its display name. public readonly partial struct EmailAddress { + /// Keeps track of any properties unknown to the library. + private readonly Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Email address. + /// Email display name. + /// Keeps track of any properties unknown to the library. + internal EmailAddress(string address, string displayName, Dictionary serializedAdditionalRawData) + { + Address = address; + DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Email address. public string Address { get; } /// Email display name. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.Serialization.cs index 8c3093663fa9..6cf85ed301d5 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - public partial class EmailAttachment : IUtf8JsonSerializable + public partial class EmailAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -21,7 +29,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ContentType); writer.WritePropertyName("contentInBase64"u8); writer.WriteBase64StringValue(Content.ToArray(), "D"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EmailAttachment DeserializeEmailAttachment(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string contentType = default; + BinaryData contentInBase64 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("contentType"u8)) + { + contentType = property.Value.GetString(); + continue; + } + if (property.NameEquals("contentInBase64"u8)) + { + contentInBase64 = BinaryData.FromBytes(property.Value.GetBytesFromBase64("D")); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailAttachment(name, contentType, contentInBase64, serializedAdditionalRawData); + } + + EmailAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.cs index 573f5a2d1706..8e4def0d4384 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Email @@ -13,6 +14,27 @@ namespace Azure.Communication.Email /// Attachment to the email. public partial class EmailAttachment { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the attachment. + /// MIME type of the content being attached. + /// Base64 encoded contents of the attachment. + /// Keeps track of any properties unknown to the library. + internal EmailAttachment(string name, string contentType, BinaryData content, Dictionary serializedAdditionalRawData) + { + Name = name; + ContentType = contentType; + Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmailAttachment() + { + } + /// Name of the attachment. public string Name { get; } /// MIME type of the content being attached. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.Serialization.cs index d6f39bc3929b..1083c58ebfd3 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - public partial class EmailContent : IUtf8JsonSerializable + public partial class EmailContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("subject"u8); writer.WriteStringValue(Subject); @@ -27,7 +35,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("html"u8); writer.WriteStringValue(Html); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EmailContent DeserializeEmailContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subject = default; + Optional plainText = default; + Optional html = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subject"u8)) + { + subject = property.Value.GetString(); + continue; + } + if (property.NameEquals("plainText"u8)) + { + plainText = property.Value.GetString(); + continue; + } + if (property.NameEquals("html"u8)) + { + html = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailContent(subject, plainText.Value, html.Value, serializedAdditionalRawData); + } + + EmailContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.cs index c159d2b8dbb7..2d8846b5bdd9 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Email @@ -13,7 +14,10 @@ namespace Azure.Communication.Email /// Content of the email. public partial class EmailContent { - /// Initializes a new instance of EmailContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Subject of the email message. /// is null. public EmailContent(string subject) @@ -23,6 +27,24 @@ public EmailContent(string subject) Subject = subject; } + /// Initializes a new instance of . + /// Subject of the email message. + /// Plain text version of the email message. + /// Html version of the email message. + /// Keeps track of any properties unknown to the library. + internal EmailContent(string subject, string plainText, string html, Dictionary serializedAdditionalRawData) + { + Subject = subject; + PlainText = plainText; + Html = html; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmailContent() + { + } + /// Subject of the email message. public string Subject { get; } /// Plain text version of the email message. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.Serialization.cs index e7ec2b021808..0af1eed80607 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - public partial class EmailMessage : IUtf8JsonSerializable + public partial class EmailMessage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Headers)) { @@ -29,16 +37,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("senderAddress"u8); writer.WriteStringValue(SenderAddress); writer.WritePropertyName("content"u8); - writer.WriteObjectValue(Content); + if (Content is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Content).Serialize(writer, options); + } writer.WritePropertyName("recipients"u8); - writer.WriteObjectValue(Recipients); + if (Recipients is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recipients).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Attachments)) { writer.WritePropertyName("attachments"u8); writer.WriteStartArray(); foreach (var item in Attachments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -48,7 +77,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ReplyTo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -57,7 +93,160 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("userEngagementTrackingDisabled"u8); writer.WriteBooleanValue(UserEngagementTrackingDisabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EmailMessage DeserializeEmailMessage(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> headers = default; + string senderAddress = default; + EmailContent content = default; + EmailRecipients recipients = default; + Optional> attachments = default; + Optional> replyTo = default; + Optional userEngagementTrackingDisabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + headers = dictionary; + continue; + } + if (property.NameEquals("senderAddress"u8)) + { + senderAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = EmailContent.DeserializeEmailContent(property.Value); + continue; + } + if (property.NameEquals("recipients"u8)) + { + recipients = EmailRecipients.DeserializeEmailRecipients(property.Value); + continue; + } + if (property.NameEquals("attachments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmailAttachment.DeserializeEmailAttachment(item)); + } + attachments = array; + continue; + } + if (property.NameEquals("replyTo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmailAddress.DeserializeEmailAddress(item)); + } + replyTo = array; + continue; + } + if (property.NameEquals("userEngagementTrackingDisabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userEngagementTrackingDisabled = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailMessage(Optional.ToDictionary(headers), senderAddress, content, recipients, Optional.ToList(attachments), Optional.ToList(replyTo), Optional.ToNullable(userEngagementTrackingDisabled), serializedAdditionalRawData); + } + + EmailMessage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailMessage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailMessage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailMessage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailMessage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailMessage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailMessage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.cs index 5718cff9bbcf..21b5afe98a8f 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailMessage.cs @@ -14,6 +14,35 @@ namespace Azure.Communication.Email /// Message payload for sending an email. public partial class EmailMessage { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Custom email headers to be passed. + /// Sender email address from a verified domain. + /// Email content to be sent. + /// Recipients for the email. + /// List of attachments. Please note that we limit the total size of an email request (which includes attachments) to 10MB. + /// Email addresses where recipients' replies will be sent to. + /// Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane. + /// Keeps track of any properties unknown to the library. + internal EmailMessage(IDictionary headers, string senderAddress, EmailContent content, EmailRecipients recipients, IList attachments, IList replyTo, bool? userEngagementTrackingDisabled, Dictionary serializedAdditionalRawData) + { + Headers = headers; + SenderAddress = senderAddress; + Content = content; + Recipients = recipients; + Attachments = attachments; + ReplyTo = replyTo; + UserEngagementTrackingDisabled = userEngagementTrackingDisabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmailMessage() + { + } + /// Custom email headers to be passed. public IDictionary Headers { get; } /// Sender email address from a verified domain. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.Serialization.cs index bcfbf6976905..74a5bf7c75d7 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - public partial class EmailRecipients : IUtf8JsonSerializable + public partial class EmailRecipients : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("to"u8); writer.WriteStartArray(); foreach (var item in To) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsCollectionDefined(CC)) @@ -28,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CC) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -38,11 +60,139 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in BCC) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EmailRecipients DeserializeEmailRecipients(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList to = default; + Optional> cc = default; + Optional> bcc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("to"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmailAddress.DeserializeEmailAddress(item)); + } + to = array; + continue; + } + if (property.NameEquals("cc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmailAddress.DeserializeEmailAddress(item)); + } + cc = array; + continue; + } + if (property.NameEquals("bcc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmailAddress.DeserializeEmailAddress(item)); + } + bcc = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailRecipients(to, Optional.ToList(cc), Optional.ToList(bcc), serializedAdditionalRawData); + } + + EmailRecipients IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailRecipients(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailRecipients IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailRecipients(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailRecipients model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailRecipients(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailRecipients(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.cs index d350ae4dfb6f..f34847907924 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailRecipients.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Email /// Recipients of the email. public partial class EmailRecipients { - /// Initializes a new instance of EmailRecipients. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Email To recipients. /// is null. public EmailRecipients(IEnumerable to) @@ -27,6 +30,24 @@ public EmailRecipients(IEnumerable to) BCC = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Email To recipients. + /// Email CC recipients. + /// Email BCC recipients. + /// Keeps track of any properties unknown to the library. + internal EmailRecipients(IList to, IList cc, IList bcc, Dictionary serializedAdditionalRawData) + { + To = to; + CC = cc; + BCC = bcc; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmailRecipients() + { + } + /// Email To recipients. public IList To { get; } /// Email CC recipients. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.Serialization.cs index 1f6427a76f6d..df2a7a4320e9 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.Serialization.cs @@ -5,12 +5,143 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - public partial class EmailSendResult + public partial class EmailSendResult : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EmailSendResult DeserializeEmailSendResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + EmailSendStatus status = default; + Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new EmailSendStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorDetail.DeserializeErrorDetail(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailSendResult(id, status, error.Value, serializedAdditionalRawData); + } + + EmailSendResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailSendResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailSendResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailSendResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailSendResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailSendResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailSendResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.cs index a248ceae83e6..441fc32066c6 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/EmailSendResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Email @@ -13,7 +14,10 @@ namespace Azure.Communication.Email /// Status of the long running operation. public partial class EmailSendResult { - /// Initializes a new instance of EmailSendResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The unique id of the operation. Use a UUID. /// Status of operation. /// is null. @@ -25,15 +29,22 @@ internal EmailSendResult(string id, EmailSendStatus status) Status = status; } - /// Initializes a new instance of EmailSendResult. + /// Initializes a new instance of . /// The unique id of the operation. Use a UUID. /// Status of operation. /// Error details when status is a non-success terminal state. - internal EmailSendResult(string id, EmailSendStatus status, ErrorDetail error) + /// Keeps track of any properties unknown to the library. + internal EmailSendResult(string id, EmailSendStatus status, ErrorDetail error, Dictionary serializedAdditionalRawData) { Id = id; Status = status; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmailSendResult() + { } /// Status of operation. public EmailSendStatus Status { get; } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs index 788490d91697..21e66470e08e 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - internal partial class ErrorAdditionalInfo + internal partial class ErrorAdditionalInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional info = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -36,8 +65,61 @@ internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement e info = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ErrorAdditionalInfo(type.Value, info.Value); + return new ErrorAdditionalInfo(type.Value, info.Value, serializedAdditionalRawData); + } + + ErrorAdditionalInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorAdditionalInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorAdditionalInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorAdditionalInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorAdditionalInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorAdditionalInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorAdditionalInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.cs index f3eae791886c..13b4b9fe1e6d 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorAdditionalInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.Email { /// The resource management error additional info. internal partial class ErrorAdditionalInfo { - /// Initializes a new instance of ErrorAdditionalInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ErrorAdditionalInfo() { } - /// Initializes a new instance of ErrorAdditionalInfo. + /// Initializes a new instance of . /// The additional info type. /// The additional info. - internal ErrorAdditionalInfo(string type, object info) + /// Keeps track of any properties unknown to the library. + internal ErrorAdditionalInfo(string type, object info, Dictionary serializedAdditionalRawData) { Type = type; Info = info; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The additional info type. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.Serialization.cs index a20546f00c7a..4fd8fa5accfd 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - internal partial class ErrorDetail + internal partial class ErrorDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ErrorDetail DeserializeErrorDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ErrorDetail DeserializeErrorDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static ErrorDetail DeserializeErrorDetail(JsonElement element) Optional target = default; Optional> details = default; Optional> additionalInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -69,8 +97,61 @@ internal static ErrorDetail DeserializeErrorDetail(JsonElement element) additionalInfo = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ErrorDetail(code.Value, message.Value, target.Value, Optional.ToList(details), Optional.ToList(additionalInfo)); + return new ErrorDetail(code.Value, message.Value, target.Value, Optional.ToList(details), Optional.ToList(additionalInfo), serializedAdditionalRawData); + } + + ErrorDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.cs index f5401ae97735..cedc53c83c58 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorDetail.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.Communication.Email /// The error detail. internal partial class ErrorDetail { - /// Initializes a new instance of ErrorDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ErrorDetail() { Details = new ChangeTrackingList(); AdditionalInfo = new ChangeTrackingList(); } - /// Initializes a new instance of ErrorDetail. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// The error details. /// The error additional info. - internal ErrorDetail(string code, string message, string target, IReadOnlyList details, IReadOnlyList additionalInfo) + /// Keeps track of any properties unknown to the library. + internal ErrorDetail(string code, string message, string target, IReadOnlyList details, IReadOnlyList additionalInfo, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; AdditionalInfo = additionalInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error code. diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.Serialization.cs index e82fef683eaf..164d31b1e38e 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Email { - internal partial class ErrorResponse + internal partial class ErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -30,8 +71,61 @@ internal static ErrorResponse DeserializeErrorResponse(JsonElement element) error = ErrorDetail.DeserializeErrorDetail(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ErrorResponse(error.Value); + return new ErrorResponse(error.Value, serializedAdditionalRawData); + } + + ErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.cs b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.cs index c2df226182ca..2b1399c45cc9 100644 --- a/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.cs +++ b/sdk/communication/Azure.Communication.Email/src/Generated/Models/ErrorResponse.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.Email { /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). internal partial class ErrorResponse { - /// Initializes a new instance of ErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ErrorResponse() { } - /// Initializes a new instance of ErrorResponse. + /// Initializes a new instance of . /// The error object. - internal ErrorResponse(ErrorDetail error) + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(ErrorDetail error, Dictionary serializedAdditionalRawData) { Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error object. diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/CommunicationIdentityRestClient.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/CommunicationIdentityRestClient.cs index 180b9449fa6a..6afd6b6b4fd2 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/CommunicationIdentityRestClient.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/CommunicationIdentityRestClient.cs @@ -65,9 +65,7 @@ internal HttpMessage CreateCreateRequest(IEnumerable cr } } var model = communicationIdentityCreateRequest; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -247,9 +245,7 @@ internal HttpMessage CreateExchangeTeamsUserAccessTokenRequest(string token, str request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var model = new TeamsUserExchangeTokenRequest(token, appId, userId); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -345,9 +341,7 @@ internal HttpMessage CreateIssueAccessTokenRequest(string id, IEnumerable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationError.cs index 6986c2eebb41..5684f5aa11a7 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.Identity.Models /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 6f2d9163b23f..51d9f0f08f4e 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity.Models { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.cs index 52f50acb2f53..8b4e24946f06 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Identity.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.Identity.Models /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.Serialization.cs index c512bd644a24..843f2a31663d 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.Serialization.cs @@ -5,20 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity.Models { - internal partial class CommunicationIdentity + internal partial class CommunicationIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationIdentity DeserializeCommunicationIdentity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationIdentity DeserializeCommunicationIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -26,8 +57,61 @@ internal static CommunicationIdentity DeserializeCommunicationIdentity(JsonEleme id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationIdentity(id); + return new CommunicationIdentity(id, serializedAdditionalRawData); + } + + CommunicationIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.cs index f2c8ebe3159b..1dfe3ae7745b 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentity.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Identity.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.Identity.Models /// A communication identity. internal partial class CommunicationIdentity { - /// Initializes a new instance of CommunicationIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Identifier of the identity. /// is null. internal CommunicationIdentity(string id) @@ -23,6 +27,20 @@ internal CommunicationIdentity(string id) Id = id; } + /// Initializes a new instance of . + /// Identifier of the identity. + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentity(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationIdentity() + { + } + /// Identifier of the identity. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.Serialization.cs index ea553e509204..0c79b9e98337 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.Serialization.cs @@ -6,21 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity { - internal partial class CommunicationIdentityAccessToken + internal partial class CommunicationIdentityAccessToken : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationIdentityAccessToken DeserializeCommunicationIdentityAccessToken(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + writer.WritePropertyName("expiresOn"u8); + writer.WriteStringValue(ExpiresOn, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationIdentityAccessToken DeserializeCommunicationIdentityAccessToken(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string token = default; DateTimeOffset expiresOn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("token"u8)) @@ -33,8 +65,61 @@ internal static CommunicationIdentityAccessToken DeserializeCommunicationIdentit expiresOn = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationIdentityAccessToken(token, expiresOn); + return new CommunicationIdentityAccessToken(token, expiresOn, serializedAdditionalRawData); + } + + CommunicationIdentityAccessToken IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentityAccessToken(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentityAccessToken IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentityAccessToken(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentityAccessToken model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentityAccessToken(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentityAccessToken(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.cs index a99a681e68ef..04097a606806 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessToken.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Identity @@ -13,7 +14,10 @@ namespace Azure.Communication.Identity /// An access token. internal partial class CommunicationIdentityAccessToken { - /// Initializes a new instance of CommunicationIdentityAccessToken. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The access token issued for the identity. /// The expiry time of the token. /// is null. @@ -25,6 +29,22 @@ internal CommunicationIdentityAccessToken(string token, DateTimeOffset expiresOn ExpiresOn = expiresOn; } + /// Initializes a new instance of . + /// The access token issued for the identity. + /// The expiry time of the token. + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentityAccessToken(string token, DateTimeOffset expiresOn, Dictionary serializedAdditionalRawData) + { + Token = token; + ExpiresOn = expiresOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationIdentityAccessToken() + { + } + /// The access token issued for the identity. public string Token { get; } /// The expiry time of the token. diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.Serialization.cs index 36c882c6e6eb..ce9d8eff433b 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication.Identity; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity.Models { - internal partial class CommunicationIdentityAccessTokenRequest : IUtf8JsonSerializable + internal partial class CommunicationIdentityAccessTokenRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("scopes"u8); writer.WriteStartArray(); @@ -27,7 +36,108 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expiresInMinutes"u8); writer.WriteNumberValue(ExpiresInMinutes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationIdentityAccessTokenRequest DeserializeCommunicationIdentityAccessTokenRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList scopes = default; + Optional expiresInMinutes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scopes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CommunicationTokenScope(item.GetString())); + } + scopes = array; + continue; + } + if (property.NameEquals("expiresInMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiresInMinutes = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIdentityAccessTokenRequest(scopes, Optional.ToNullable(expiresInMinutes), serializedAdditionalRawData); + } + + CommunicationIdentityAccessTokenRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentityAccessTokenRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentityAccessTokenRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentityAccessTokenRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentityAccessTokenRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentityAccessTokenRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentityAccessTokenRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.cs index 2126bc68f09e..272cc1b0a879 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityAccessTokenRequest.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.Identity.Models /// The CommunicationIdentityAccessTokenRequest. internal partial class CommunicationIdentityAccessTokenRequest { - /// Initializes a new instance of CommunicationIdentityAccessTokenRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of scopes attached to the token. /// is null. public CommunicationIdentityAccessTokenRequest(IEnumerable scopes) @@ -26,6 +29,22 @@ public CommunicationIdentityAccessTokenRequest(IEnumerable Initializes a new instance of . + /// List of scopes attached to the token. + /// Optional custom validity period of the token within [60,1440] minutes range. If not provided, the default value of 1440 minutes (24 hours) will be used. + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentityAccessTokenRequest(IList scopes, int? expiresInMinutes, Dictionary serializedAdditionalRawData) + { + Scopes = scopes; + ExpiresInMinutes = expiresInMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationIdentityAccessTokenRequest() + { + } + /// List of scopes attached to the token. public IList Scopes { get; } /// Optional custom validity period of the token within [60,1440] minutes range. If not provided, the default value of 1440 minutes (24 hours) will be used. diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.Serialization.cs index a55d5497b928..42d1963b661f 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication.Identity; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity.Models { - internal partial class CommunicationIdentityCreateRequest : IUtf8JsonSerializable + internal partial class CommunicationIdentityCreateRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(CreateTokenWithScopes)) { @@ -30,7 +39,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expiresInMinutes"u8); writer.WriteNumberValue(ExpiresInMinutes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationIdentityCreateRequest DeserializeCommunicationIdentityCreateRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> createTokenWithScopes = default; + Optional expiresInMinutes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("createTokenWithScopes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new CommunicationTokenScope(item.GetString())); + } + createTokenWithScopes = array; + continue; + } + if (property.NameEquals("expiresInMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiresInMinutes = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIdentityCreateRequest(Optional.ToList(createTokenWithScopes), Optional.ToNullable(expiresInMinutes), serializedAdditionalRawData); + } + + CommunicationIdentityCreateRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentityCreateRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentityCreateRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentityCreateRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentityCreateRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentityCreateRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentityCreateRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.cs index 0e7729537817..9c30f4f210ad 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationIdentityCreateRequest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.Identity; using Azure.Core; @@ -14,12 +15,26 @@ namespace Azure.Communication.Identity.Models /// The CommunicationIdentityCreateRequest. internal partial class CommunicationIdentityCreateRequest { - /// Initializes a new instance of CommunicationIdentityCreateRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationIdentityCreateRequest() { CreateTokenWithScopes = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Also create access token for the created identity. + /// Optional custom validity period of the token within [60,1440] minutes range. If not provided, the default value of 1440 minutes (24 hours) will be used. + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentityCreateRequest(IList createTokenWithScopes, int? expiresInMinutes, Dictionary serializedAdditionalRawData) + { + CreateTokenWithScopes = createTokenWithScopes; + ExpiresInMinutes = expiresInMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Also create access token for the created identity. public IList CreateTokenWithScopes { get; } /// Optional custom validity period of the token within [60,1440] minutes range. If not provided, the default value of 1440 minutes (24 hours) will be used. diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.Serialization.cs index 46ecbf109111..4d41be62d5b7 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.Identity.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity { - public partial class CommunicationUserIdentifierAndToken + public partial class CommunicationUserIdentifierAndToken : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationUserIdentifierAndToken DeserializeCommunicationUserIdentifierAndToken(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("identity"u8); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + if (Optional.IsDefined(InternalAccessToken)) + { + writer.WritePropertyName("accessToken"u8); + if (InternalAccessToken is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InternalAccessToken).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationUserIdentifierAndToken DeserializeCommunicationUserIdentifierAndToken(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationIdentity identity = default; Optional accessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -37,8 +87,61 @@ internal static CommunicationUserIdentifierAndToken DeserializeCommunicationUser accessToken = CommunicationIdentityAccessToken.DeserializeCommunicationIdentityAccessToken(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationUserIdentifierAndToken(identity, accessToken.Value); + return new CommunicationUserIdentifierAndToken(identity, accessToken.Value, serializedAdditionalRawData); + } + + CommunicationUserIdentifierAndToken IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationUserIdentifierAndToken(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationUserIdentifierAndToken IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationUserIdentifierAndToken(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationUserIdentifierAndToken model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationUserIdentifierAndToken(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationUserIdentifierAndToken(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.cs index 7a5d92aad5b3..422367b6818e 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/CommunicationUserIdentifierAndToken.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.Identity.Models; using Azure.Core; @@ -14,5 +15,23 @@ namespace Azure.Communication.Identity /// A communication identity with access token. public partial class CommunicationUserIdentifierAndToken { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A communication identity. + /// An access token. + /// Keeps track of any properties unknown to the library. + internal CommunicationUserIdentifierAndToken(CommunicationIdentity identity, CommunicationIdentityAccessToken internalAccessToken, Dictionary serializedAdditionalRawData) + { + Identity = identity; + InternalAccessToken = internalAccessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationUserIdentifierAndToken() + { + } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.Serialization.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.Serialization.cs index 8403b65d1133..e81fc6443962 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Identity.Models { - internal partial class TeamsUserExchangeTokenRequest : IUtf8JsonSerializable + internal partial class TeamsUserExchangeTokenRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("token"u8); writer.WriteStringValue(Token); @@ -21,7 +29,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AppId); writer.WritePropertyName("userId"u8); writer.WriteStringValue(UserId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TeamsUserExchangeTokenRequest DeserializeTeamsUserExchangeTokenRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string token = default; + string appId = default; + string userId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("token"u8)) + { + token = property.Value.GetString(); + continue; + } + if (property.NameEquals("appId"u8)) + { + appId = property.Value.GetString(); + continue; + } + if (property.NameEquals("userId"u8)) + { + userId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TeamsUserExchangeTokenRequest(token, appId, userId, serializedAdditionalRawData); + } + + TeamsUserExchangeTokenRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTeamsUserExchangeTokenRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TeamsUserExchangeTokenRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTeamsUserExchangeTokenRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TeamsUserExchangeTokenRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TeamsUserExchangeTokenRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTeamsUserExchangeTokenRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.cs b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.cs index a0fb45dabb9f..69da73917e69 100644 --- a/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.cs +++ b/sdk/communication/Azure.Communication.Identity/src/Generated/Models/TeamsUserExchangeTokenRequest.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Identity.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.Identity.Models /// The TeamsUserExchangeTokenRequest. internal partial class TeamsUserExchangeTokenRequest { - /// Initializes a new instance of TeamsUserExchangeTokenRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Azure AD access token of a Teams User to acquire a new Communication Identity access token. /// Client ID of an Azure AD application to be verified against the appid claim in the Azure AD access token. /// Object ID of an Azure AD user (Teams User) to be verified against the oid claim in the Azure AD access token. @@ -29,6 +33,24 @@ public TeamsUserExchangeTokenRequest(string token, string appId, string userId) UserId = userId; } + /// Initializes a new instance of . + /// Azure AD access token of a Teams User to acquire a new Communication Identity access token. + /// Client ID of an Azure AD application to be verified against the appid claim in the Azure AD access token. + /// Object ID of an Azure AD user (Teams User) to be verified against the oid claim in the Azure AD access token. + /// Keeps track of any properties unknown to the library. + internal TeamsUserExchangeTokenRequest(string token, string appId, string userId, Dictionary serializedAdditionalRawData) + { + Token = token; + AppId = appId; + UserId = userId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TeamsUserExchangeTokenRequest() + { + } + /// Azure AD access token of a Teams User to acquire a new Communication Identity access token. public string Token { get; } /// Client ID of an Azure AD application to be verified against the appid claim in the Azure AD access token. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs index fdde257d0563..b6d9742253c8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs @@ -13,7 +13,7 @@ namespace Azure.Communication.JobRouter.Models /// Model factory for models. public static partial class CommunicationJobRouterModelFactory { - /// Initializes a new instance of RouterJobAssignment. + /// Initializes a new instance of . /// The Id of the job assignment. /// The Id of the Worker assigned to the job. /// The assignment time of the job in UTC. @@ -22,49 +22,29 @@ public static partial class CommunicationJobRouterModelFactory /// A new instance for mocking. public static RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, DateTimeOffset assignedAt = default, DateTimeOffset? completedAt = null, DateTimeOffset? closedAt = null) { - return new RouterJobAssignment(assignmentId, workerId, assignedAt, completedAt, closedAt); + return new RouterJobAssignment(assignmentId, workerId, assignedAt, completedAt, closedAt, default); } - /// Initializes a new instance of UnassignJobResult. + /// Initializes a new instance of . /// The Id of the job unassigned. /// The number of times a job is unassigned. At a maximum 3. - /// is null. /// A new instance for mocking. public static UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = default) { - if (jobId == null) - { - throw new ArgumentNullException(nameof(jobId)); - } - - return new UnassignJobResult(jobId, unassignmentCount); + return new UnassignJobResult(jobId, unassignmentCount, default); } - /// Initializes a new instance of AcceptJobOfferResult. + /// Initializes a new instance of . /// The assignment Id that assigns a worker that has accepted an offer to a job. /// The Id of the job assigned. /// The Id of the worker that has been assigned this job. - /// , or is null. /// A new instance for mocking. public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - if (jobId == null) - { - throw new ArgumentNullException(nameof(jobId)); - } - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - return new AcceptJobOfferResult(assignmentId, jobId, workerId); + return new AcceptJobOfferResult(assignmentId, jobId, workerId, default); } - /// Initializes a new instance of RouterQueueStatistics. + /// Initializes a new instance of . /// Id of the queue these details are about. /// Length of the queue: total number of enqueued jobs. /// The estimated wait time of this queue rounded up to the nearest minute, grouped by job priority. @@ -74,10 +54,10 @@ public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, { estimatedWaitTimeMinutes ??= new Dictionary(); - return new RouterQueueStatistics(queueId, length, estimatedWaitTimeMinutes, longestJobWaitTimeMinutes); + return new RouterQueueStatistics(queueId, length, estimatedWaitTimeMinutes, longestJobWaitTimeMinutes, default); } - /// Initializes a new instance of RouterJobOffer. + /// Initializes a new instance of . /// The Id of the offer. /// The Id of the job. /// The capacity cost consumed by the job offer. @@ -86,28 +66,18 @@ public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, /// A new instance for mocking. public static RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = default, DateTimeOffset? offeredAt = null, DateTimeOffset? expiresAt = null) { - return new RouterJobOffer(offerId, jobId, capacityCost, offeredAt, expiresAt); + return new RouterJobOffer(offerId, jobId, capacityCost, offeredAt, expiresAt, default); } - /// Initializes a new instance of RouterWorkerAssignment. + /// Initializes a new instance of . /// The Id of the assignment. /// The Id of the Job assigned. /// The amount of capacity this assignment has consumed on the worker. /// The assignment time of the job in UTC. - /// or is null. /// A new instance for mocking. public static RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = default, DateTimeOffset assignedAt = default) { - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - if (jobId == null) - { - throw new ArgumentNullException(nameof(jobId)); - } - - return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt); + return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt, default); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs index c484f7d1c336..4313bc4a6fe4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, Classifi request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; return message; } @@ -414,9 +412,7 @@ internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, Distributi request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; return message; } @@ -776,9 +772,7 @@ internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, ExceptionPoli request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; return message; } @@ -1138,9 +1132,7 @@ internal HttpMessage CreateUpsertQueueRequest(string id, RouterQueue patch) request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; return message; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs index 15694ece3888..7b5b9ebdcdee 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateUpsertJobRequest(string id, RouterJob patch) request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; return message; } @@ -439,9 +437,7 @@ internal HttpMessage CreateCancelJobActionRequest(string id, string note, string Note = note, DispositionCode = dispositionCode }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -527,9 +523,7 @@ internal HttpMessage CreateCompleteJobActionRequest(string id, string assignment { Note = note }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -619,9 +613,7 @@ internal HttpMessage CreateCloseJobActionRequest(string id, string assignmentId, CloseAt = closeAt, Note = note }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -887,9 +879,7 @@ internal HttpMessage CreateUnassignJobActionRequest(string id, string assignment if (unassignJobRequest != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(unassignJobRequest); - request.Content = content; + request.Content = unassignJobRequest; } return message; } @@ -1060,9 +1050,7 @@ internal HttpMessage CreateDeclineJobActionRequest(string workerId, string offer if (declineJobOfferRequest != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(declineJobOfferRequest); - request.Content = content; + request.Content = declineJobOfferRequest; } return message; } @@ -1216,9 +1204,7 @@ internal HttpMessage CreateUpsertWorkerRequest(string workerId, RouterWorker pat request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; return message; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs index 2e4886be3368..855782f78e55 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs @@ -5,15 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class AcceptJobOfferResult + public partial class AcceptJobOfferResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcceptJobOfferResult DeserializeAcceptJobOfferResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("assignmentId"u8); + writer.WriteStringValue(AssignmentId); + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + writer.WritePropertyName("workerId"u8); + writer.WriteStringValue(WorkerId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcceptJobOfferResult DeserializeAcceptJobOfferResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +55,7 @@ internal static AcceptJobOfferResult DeserializeAcceptJobOfferResult(JsonElement string assignmentId = default; string jobId = default; string workerId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("assignmentId"u8)) @@ -38,8 +73,61 @@ internal static AcceptJobOfferResult DeserializeAcceptJobOfferResult(JsonElement workerId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcceptJobOfferResult(assignmentId, jobId, workerId); + return new AcceptJobOfferResult(assignmentId, jobId, workerId, serializedAdditionalRawData); + } + + AcceptJobOfferResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcceptJobOfferResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcceptJobOfferResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcceptJobOfferResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcceptJobOfferResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcceptJobOfferResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcceptJobOfferResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs index 04b884341c6f..763bb3b4eb29 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// Response containing Id's for the worker, job, and assignment from an accepted offer. public partial class AcceptJobOfferResult { - /// Initializes a new instance of AcceptJobOfferResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The assignment Id that assigns a worker that has accepted an offer to a job. /// The Id of the job assigned. /// The Id of the worker that has been assigned this job. @@ -29,6 +33,24 @@ internal AcceptJobOfferResult(string assignmentId, string jobId, string workerId WorkerId = workerId; } + /// Initializes a new instance of . + /// The assignment Id that assigns a worker that has accepted an offer to a job. + /// The Id of the job assigned. + /// The Id of the worker that has been assigned this job. + /// Keeps track of any properties unknown to the library. + internal AcceptJobOfferResult(string assignmentId, string jobId, string workerId, Dictionary serializedAdditionalRawData) + { + AssignmentId = assignmentId; + JobId = jobId; + WorkerId = workerId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AcceptJobOfferResult() + { + } + /// The assignment Id that assigns a worker that has accepted an offer to a job. public string AssignmentId { get; } /// The Id of the job assigned. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs index adc65b52b795..bcd6be5e3069 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class BestWorkerMode : IUtf8JsonSerializable + public partial class BestWorkerMode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ScoringRule)) { writer.WritePropertyName("scoringRule"u8); - writer.WriteObjectValue(ScoringRule); + if (ScoringRule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScoringRule).Serialize(writer, options); + } } if (Optional.IsDefined(ScoringRuleOptions)) { writer.WritePropertyName("scoringRuleOptions"u8); - writer.WriteObjectValue(ScoringRuleOptions); + if (ScoringRuleOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScoringRuleOptions).Serialize(writer, options); + } } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); @@ -43,11 +65,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassSelectors"u8); writer.WriteBooleanValue(BypassSelectors.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) + internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +94,7 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scoringRule"u8)) @@ -110,8 +147,61 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) bypassSelectors = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BestWorkerMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), scoringRule.Value, scoringRuleOptions.Value, serializedAdditionalRawData); + } + + BestWorkerMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBestWorkerMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BestWorkerMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBestWorkerMode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BestWorkerMode model) + { + if (model is null) + { + return null; } - return new BestWorkerMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), scoringRule.Value, scoringRuleOptions.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BestWorkerMode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBestWorkerMode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs index 3cb41b46f2a5..b49bb168aa79 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.JobRouter.Models; namespace Azure.Communication.JobRouter @@ -12,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Jobs are distributed to the worker with the strongest abilities available. public partial class BestWorkerMode : DistributionMode { - /// Initializes a new instance of BestWorkerMode. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Mode. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. @@ -35,7 +37,8 @@ public partial class BestWorkerMode : DistributionMode /// The available derived classes include , , , and . /// /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. - internal BestWorkerMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// Keeps track of any properties unknown to the library. + internal BestWorkerMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions, Dictionary serializedAdditionalRawData) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors, serializedAdditionalRawData) { ScoringRule = scoringRule; ScoringRuleOptions = scoringRuleOptions; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs index 44edd3617395..0e39c44f12c3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class CancelExceptionAction : IUtf8JsonSerializable + public partial class CancelExceptionAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Note)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonElement element) + internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonEleme Optional note = default; Optional dispositionCode = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("note"u8)) @@ -56,8 +79,61 @@ internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonEleme kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CancelExceptionAction(kind, note.Value, dispositionCode.Value, serializedAdditionalRawData); + } + + CancelExceptionAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCancelExceptionAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CancelExceptionAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCancelExceptionAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CancelExceptionAction model) + { + if (model is null) + { + return null; } - return new CancelExceptionAction(kind, note.Value, dispositionCode.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CancelExceptionAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCancelExceptionAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs index 42eb31dfe482..e46e667b53bb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// An action that marks a job as cancelled. public partial class CancelExceptionAction : ExceptionAction { - /// Initializes a new instance of CancelExceptionAction. + /// Initializes a new instance of . public CancelExceptionAction() { Kind = "cancel"; } - /// Initializes a new instance of CancelExceptionAction. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionAction. /// (Optional) A note that will be appended to the jobs' Notes collection with th current timestamp. /// (Optional) Indicates the outcome of the job, populate this field with your own custom values. - internal CancelExceptionAction(string kind, string note, string dispositionCode) : base(kind) + /// Keeps track of any properties unknown to the library. + internal CancelExceptionAction(string kind, string note, string dispositionCode, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Note = note; DispositionCode = dispositionCode; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs index d9e66366ab15..254d822f8596 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class CancelJobRequest : IUtf8JsonSerializable + internal partial class CancelJobRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Note)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dispositionCode"u8); writer.WriteStringValue(DispositionCode); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CancelJobRequest DeserializeCancelJobRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional note = default; + Optional dispositionCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("note"u8)) + { + note = property.Value.GetString(); + continue; + } + if (property.NameEquals("dispositionCode"u8)) + { + dispositionCode = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CancelJobRequest(note.Value, dispositionCode.Value, serializedAdditionalRawData); + } + + CancelJobRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCancelJobRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CancelJobRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCancelJobRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CancelJobRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CancelJobRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCancelJobRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs index 9b18b0cce910..7b0cae3e2b5d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs @@ -5,16 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Request payload for deleting a job. internal partial class CancelJobRequest { - /// Initializes a new instance of CancelJobRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CancelJobRequest() { } + /// Initializes a new instance of . + /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// + /// Indicates the outcome of the job, populate this field with your own custom values. + /// If not provided, default value of "Cancelled" is set. + /// + /// Keeps track of any properties unknown to the library. + internal CancelJobRequest(string note, string dispositionCode, Dictionary serializedAdditionalRawData) + { + Note = note; + DispositionCode = dispositionCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. public string Note { get; set; } /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs index 0f005a0aad59..5babd7339b94 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ChannelConfiguration : IUtf8JsonSerializable + public partial class ChannelConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("capacityCostPerJob"u8); writer.WriteNumberValue(CapacityCostPerJob); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxNumberOfJobs"u8); writer.WriteNumberValue(MaxNumberOfJobs.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement element) + internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int capacityCostPerJob = default; Optional maxNumberOfJobs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("capacityCostPerJob"u8)) @@ -49,8 +72,61 @@ internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement maxNumberOfJobs = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChannelConfiguration(capacityCostPerJob, Optional.ToNullable(maxNumberOfJobs), serializedAdditionalRawData); + } + + ChannelConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChannelConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChannelConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChannelConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChannelConfiguration model) + { + if (model is null) + { + return null; } - return new ChannelConfiguration(capacityCostPerJob, Optional.ToNullable(maxNumberOfJobs)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChannelConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChannelConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs index 37e35196027f..412df5cf49b0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Represents the capacity a job in this channel will consume from a worker. public partial class ChannelConfiguration { - /// Initializes a new instance of ChannelConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. public ChannelConfiguration(int capacityCostPerJob) { CapacityCostPerJob = capacityCostPerJob; } - /// Initializes a new instance of ChannelConfiguration. + /// Initializes a new instance of . /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. /// The maximum number of jobs that can be supported concurrently for this channel. - internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs) + /// Keeps track of any properties unknown to the library. + internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs, Dictionary serializedAdditionalRawData) { CapacityCostPerJob = capacityCostPerJob; MaxNumberOfJobs = maxNumberOfJobs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChannelConfiguration() + { } /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs index a9daab64bb03..5a6216ef1298 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class ClassificationPolicy : IUtf8JsonSerializable + public partial class ClassificationPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -33,14 +40,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in _queueSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(PrioritizationRule)) { writer.WritePropertyName("prioritizationRule"u8); - writer.WriteObjectValue(PrioritizationRule); + if (PrioritizationRule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrioritizationRule).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(_workerSelectors)) { @@ -48,15 +69,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in _workerSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement element) + internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +109,7 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement Optional> queueSelectors = default; Optional prioritizationRule = default; Optional> workerSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -121,8 +164,61 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement workerSelectors = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ClassificationPolicy(id.Value, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors), serializedAdditionalRawData); + } + + ClassificationPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClassificationPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClassificationPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClassificationPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClassificationPolicy(Response response) + { + if (response is null) + { + return null; } - return new ClassificationPolicy(id.Value, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClassificationPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs index cb984d54490a..28e7f086b0bf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.JobRouter; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A container for the rules that govern how jobs are classified. public partial class ClassificationPolicy { - /// Initializes a new instance of ClassificationPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Unique identifier of this policy. /// Friendly name of this policy. /// The fallback queue to select if the queue selector doesn't find a match. @@ -39,7 +43,8 @@ public partial class ClassificationPolicy /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// - internal ClassificationPolicy(string id, string name, string fallbackQueueId, IList queueSelectors, RouterRule prioritizationRule, IList workerSelectors) + /// Keeps track of any properties unknown to the library. + internal ClassificationPolicy(string id, string name, string fallbackQueueId, IList queueSelectors, RouterRule prioritizationRule, IList workerSelectors, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -47,6 +52,7 @@ internal ClassificationPolicy(string id, string name, string fallbackQueueId, IL _queueSelectors = queueSelectors; PrioritizationRule = prioritizationRule; _workerSelectors = workerSelectors; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique identifier of this policy. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs index 6652a5ef1178..dd661efbd050 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class ClassificationPolicyCollection + internal partial class ClassificationPolicyCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClassificationPolicyCollection DeserializeClassificationPolicyCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClassificationPolicyCollection DeserializeClassificationPolicyCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ClassificationPolicyCollection DeserializeClassificationPolicyCo nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClassificationPolicyCollection(value, nextLink.Value); + return new ClassificationPolicyCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ClassificationPolicyCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationPolicyCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClassificationPolicyCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClassificationPolicyCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClassificationPolicyCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClassificationPolicyCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClassificationPolicyCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs index 0a9c01641853..9dd445a2c575 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A paged collection of classification policies. internal partial class ClassificationPolicyCollection { - /// Initializes a new instance of ClassificationPolicyCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal ClassificationPolicyCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ClassificationPolicyCollection(IEnumerable va Value = value.ToList(); } - /// Initializes a new instance of ClassificationPolicyCollection. + /// Initializes a new instance of . /// /// - internal ClassificationPolicyCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ClassificationPolicyCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClassificationPolicyCollection() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs index 45d3876403fa..a10733af95a7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class ClassificationPolicyItem + public partial class ClassificationPolicyItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ClassificationPolicy)) + { + writer.WritePropertyName("classificationPolicy"u8); + if (ClassificationPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClassificationPolicy).Serialize(writer, options); + } + } + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(_etag); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional classificationPolicy = default; Optional etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("classificationPolicy"u8)) @@ -36,8 +82,61 @@ internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(Jso etag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClassificationPolicyItem(classificationPolicy.Value, etag.Value); + return new ClassificationPolicyItem(classificationPolicy.Value, etag.Value, serializedAdditionalRawData); + } + + ClassificationPolicyItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationPolicyItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClassificationPolicyItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClassificationPolicyItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClassificationPolicyItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClassificationPolicyItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClassificationPolicyItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs index 53d52d7f8dc0..1d26e41dfa6b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of ClassificationPolicy. public partial class ClassificationPolicyItem { - /// Initializes a new instance of ClassificationPolicyItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ClassificationPolicyItem() { } - /// Initializes a new instance of ClassificationPolicyItem. + /// Initializes a new instance of . /// A container for the rules that govern how jobs are classified. /// (Optional) The Concurrency Token. - internal ClassificationPolicyItem(ClassificationPolicy classificationPolicy, string etag) + /// Keeps track of any properties unknown to the library. + internal ClassificationPolicyItem(ClassificationPolicy classificationPolicy, string etag, Dictionary serializedAdditionalRawData) { ClassificationPolicy = classificationPolicy; _etag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A container for the rules that govern how jobs are classified. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs index 6b151616a3f0..51fc3cf34c1f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class CloseJobRequest : IUtf8JsonSerializable + internal partial class CloseJobRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("assignmentId"u8); writer.WriteStringValue(AssignmentId); @@ -32,7 +40,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("note"u8); writer.WriteStringValue(Note); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CloseJobRequest DeserializeCloseJobRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string assignmentId = default; + Optional dispositionCode = default; + Optional closeAt = default; + Optional note = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assignmentId"u8)) + { + assignmentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dispositionCode"u8)) + { + dispositionCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("closeAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + closeAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("note"u8)) + { + note = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloseJobRequest(assignmentId, dispositionCode.Value, Optional.ToNullable(closeAt), note.Value, serializedAdditionalRawData); + } + + CloseJobRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloseJobRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloseJobRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloseJobRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloseJobRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloseJobRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloseJobRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs index 7e98c345de30..8d4f795833b9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter /// Request payload for closing jobs. internal partial class CloseJobRequest { - /// Initializes a new instance of CloseJobRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The assignment within which the job is to be closed. /// is null. public CloseJobRequest(string assignmentId) @@ -23,6 +27,29 @@ public CloseJobRequest(string assignmentId) AssignmentId = assignmentId; } + /// Initializes a new instance of . + /// The assignment within which the job is to be closed. + /// Indicates the outcome of the job, populate this field with your own custom values. + /// + /// If not provided, worker capacity is released immediately along with a JobClosedEvent notification. + /// If provided, worker capacity is released along with a JobClosedEvent notification at a future time in UTC. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// Keeps track of any properties unknown to the library. + internal CloseJobRequest(string assignmentId, string dispositionCode, DateTimeOffset? closeAt, string note, Dictionary serializedAdditionalRawData) + { + AssignmentId = assignmentId; + DispositionCode = dispositionCode; + CloseAt = closeAt; + Note = note; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CloseJobRequest() + { + } + /// The assignment within which the job is to be closed. public string AssignmentId { get; } /// Indicates the outcome of the job, populate this field with your own custom values. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs index e25a471186de..540ea09ac95c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs index dc84a9b221a8..af4550ebb7ed 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 839a1bf90f4c..cf351f32d955 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,21 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -27,8 +65,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs index a36c24212d0c..a608b33793aa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.JobRouter.Models; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.JobRouter /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -24,6 +28,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs index f3b60b47d21a..e8f804dd9db6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class CompleteJobRequest : IUtf8JsonSerializable + internal partial class CompleteJobRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("assignmentId"u8); writer.WriteStringValue(AssignmentId); @@ -22,7 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("note"u8); writer.WriteStringValue(Note); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CompleteJobRequest DeserializeCompleteJobRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string assignmentId = default; + Optional note = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assignmentId"u8)) + { + assignmentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("note"u8)) + { + note = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CompleteJobRequest(assignmentId, note.Value, serializedAdditionalRawData); + } + + CompleteJobRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCompleteJobRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CompleteJobRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCompleteJobRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CompleteJobRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CompleteJobRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCompleteJobRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs index 5ccc3b36b8b7..efee54c3deec 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter /// Request payload for completing jobs. internal partial class CompleteJobRequest { - /// Initializes a new instance of CompleteJobRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The assignment within the job to complete. /// is null. public CompleteJobRequest(string assignmentId) @@ -23,6 +27,22 @@ public CompleteJobRequest(string assignmentId) AssignmentId = assignmentId; } + /// Initializes a new instance of . + /// The assignment within the job to complete. + /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. + /// Keeps track of any properties unknown to the library. + internal CompleteJobRequest(string assignmentId, string note, Dictionary serializedAdditionalRawData) + { + AssignmentId = assignmentId; + Note = note; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CompleteJobRequest() + { + } + /// The assignment within the job to complete. public string AssignmentId { get; } /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs index 72d1abc86558..644755371c84 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs @@ -5,33 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ConditionalQueueSelectorAttachment : IUtf8JsonSerializable + public partial class ConditionalQueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); + if (Condition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Condition).Serialize(writer, options); + } writer.WritePropertyName("queueSelectors"u8); writer.WriteStartArray(); foreach (var item in QueueSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSelectorAttachment(JsonElement element) + internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +74,7 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe RouterRule condition = default; IList queueSelectors = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("condition"u8)) @@ -61,8 +97,61 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConditionalQueueSelectorAttachment(kind, condition, queueSelectors, serializedAdditionalRawData); + } + + ConditionalQueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConditionalQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConditionalQueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConditionalQueueSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConditionalQueueSelectorAttachment model) + { + if (model is null) + { + return null; } - return new ConditionalQueueSelectorAttachment(kind, condition, queueSelectors); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConditionalQueueSelectorAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConditionalQueueSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs index b3f43c4218d3..a3f5e362719e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs @@ -15,7 +15,7 @@ namespace Azure.Communication.JobRouter /// Describes a set of queue selectors that will be attached if the given condition resolves to true. public partial class ConditionalQueueSelectorAttachment : QueueSelectorAttachment { - /// Initializes a new instance of ConditionalQueueSelectorAttachment. + /// Initializes a new instance of . /// /// A rule of one of the following types: /// @@ -39,7 +39,7 @@ public ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable Initializes a new instance of ConditionalQueueSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. /// /// A rule of one of the following types: @@ -53,13 +53,19 @@ public ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable, , , and . /// /// The queue selectors to attach. - internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IList queueSelectors) : base(kind) + /// Keeps track of any properties unknown to the library. + internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IList queueSelectors, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Condition = condition; QueueSelectors = queueSelectors; Kind = kind ?? "conditional"; } + /// Initializes a new instance of for deserialization. + internal ConditionalQueueSelectorAttachment() + { + } + /// /// A rule of one of the following types: /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs index 6feaaba94f2c..bd80ff79596c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs @@ -5,33 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ConditionalWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class ConditionalWorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); + if (Condition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Condition).Serialize(writer, options); + } writer.WritePropertyName("workerSelectors"u8); writer.WriteStartArray(); foreach (var item in WorkerSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorkerSelectorAttachment(JsonElement element) + internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +74,7 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker RouterRule condition = default; IList workerSelectors = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("condition"u8)) @@ -61,8 +97,61 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConditionalWorkerSelectorAttachment(kind, condition, workerSelectors, serializedAdditionalRawData); + } + + ConditionalWorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConditionalWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConditionalWorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConditionalWorkerSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConditionalWorkerSelectorAttachment model) + { + if (model is null) + { + return null; } - return new ConditionalWorkerSelectorAttachment(kind, condition, workerSelectors); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConditionalWorkerSelectorAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConditionalWorkerSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs index 74d82d55228a..b7e5f6a87e3f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs @@ -15,7 +15,7 @@ namespace Azure.Communication.JobRouter /// Describes a set of worker selectors that will be attached if the given condition resolves to true. public partial class ConditionalWorkerSelectorAttachment : WorkerSelectorAttachment { - /// Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// Initializes a new instance of . /// /// A rule of one of the following types: /// @@ -39,7 +39,7 @@ public ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. /// /// A rule of one of the following types: @@ -53,13 +53,19 @@ public ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable, , , and . /// /// The worker selectors to attach. - internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IList workerSelectors) : base(kind) + /// Keeps track of any properties unknown to the library. + internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IList workerSelectors, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Condition = condition; WorkerSelectors = workerSelectors; Kind = kind ?? "conditional"; } + /// Initializes a new instance of for deserialization. + internal ConditionalWorkerSelectorAttachment() + { + } + /// /// A rule of one of the following types: /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs index e865afcce73e..7a00199a8a10 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class DeclineJobOfferRequest : IUtf8JsonSerializable + public partial class DeclineJobOfferRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RetryOfferAt)) { writer.WritePropertyName("retryOfferAt"u8); writer.WriteStringValue(RetryOfferAt.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DeclineJobOfferRequest DeserializeDeclineJobOfferRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional retryOfferAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("retryOfferAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + retryOfferAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeclineJobOfferRequest(Optional.ToNullable(retryOfferAt), serializedAdditionalRawData); + } + + DeclineJobOfferRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeclineJobOfferRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeclineJobOfferRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeclineJobOfferRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeclineJobOfferRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeclineJobOfferRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeclineJobOfferRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs index fd876e060478..05dacd2e7bff 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs @@ -6,17 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.JobRouter { /// Request payload for declining offers. public partial class DeclineJobOfferRequest { - /// Initializes a new instance of DeclineJobOfferRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DeclineJobOfferRequest() { } + /// Initializes a new instance of . + /// + /// If the RetryOfferAt is not provided, then this job will not be offered again to the worker who declined this job unless + /// the worker is de-registered and re-registered. If a RetryOfferAt time is provided, then the job will be re-matched to + /// eligible workers at the retry time in UTC. The worker that declined the job will also be eligible for the job at that time. + /// + /// Keeps track of any properties unknown to the library. + internal DeclineJobOfferRequest(DateTimeOffset? retryOfferAt, Dictionary serializedAdditionalRawData) + { + RetryOfferAt = retryOfferAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// /// If the RetryOfferAt is not provided, then this job will not be offered again to the worker who declined this job unless /// the worker is de-registered and re-registered. If a RetryOfferAt time is provided, then the job will be re-matched to diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs index daef8caee0d2..a19888221676 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class DirectMapRouterRule : IUtf8JsonSerializable + public partial class DirectMapRouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement element) + internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -34,8 +57,61 @@ internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement e kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DirectMapRouterRule(kind, serializedAdditionalRawData); + } + + DirectMapRouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDirectMapRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DirectMapRouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDirectMapRouterRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DirectMapRouterRule model) + { + if (model is null) + { + return null; } - return new DirectMapRouterRule(kind); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DirectMapRouterRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDirectMapRouterRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs index 353584682545..8bc98227943c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// A rule that return the same labels as the input labels. public partial class DirectMapRouterRule : RouterRule { - /// Initializes a new instance of DirectMapRouterRule. + /// Initializes a new instance of . public DirectMapRouterRule() { Kind = "direct-map-rule"; } - /// Initializes a new instance of DirectMapRouterRule. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. - internal DirectMapRouterRule(string kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal DirectMapRouterRule(string kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind ?? "direct-map-rule"; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs index f393cfc3ad71..23280a963636 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class DistributionMode : IUtf8JsonSerializable + public partial class DistributionMode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassSelectors"u8); writer.WriteBooleanValue(BypassSelectors.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DistributionMode DeserializeDistributionMode(JsonElement element) + internal static DistributionMode DeserializeDistributionMode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,7 +72,102 @@ internal static DistributionMode DeserializeDistributionMode(JsonElement element case "round-robin": return RoundRobinMode.DeserializeRoundRobinMode(element); } } - return UnknownDistributionMode.DeserializeUnknownDistributionMode(element); + + // Unknown type found so we will deserialize the base properties only + string kind = default; + Optional minConcurrentOffers = default; + Optional maxConcurrentOffers = default; + Optional bypassSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("minConcurrentOffers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minConcurrentOffers = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxConcurrentOffers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxConcurrentOffers = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("bypassSelectors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bypassSelectors = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), serializedAdditionalRawData); + } + + DistributionMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDistributionMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DistributionMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDistributionMode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DistributionMode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DistributionMode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDistributionMode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs index 6267ec74677f..22a16bb60900 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.Communication.JobRouter { /// @@ -12,14 +16,18 @@ namespace Azure.Communication.JobRouter /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownDistributionMode))] public abstract partial class DistributionMode { - /// Initializes a new instance of DistributionMode. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DistributionMode() { } - /// Initializes a new instance of DistributionMode. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Mode. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. @@ -30,12 +38,14 @@ protected DistributionMode() /// variable to true. This flag is intended more for temporary usage. /// By default, set to false. /// - internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) + /// Keeps track of any properties unknown to the library. + internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, Dictionary serializedAdditionalRawData) { Kind = kind; MinConcurrentOffers = minConcurrentOffers; MaxConcurrentOffers = maxConcurrentOffers; BypassSelectors = bypassSelectors; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type discriminator describing a sub-type of Mode. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs index c1e9ce5b1a94..33115d53c4e6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class DistributionPolicy : IUtf8JsonSerializable + public partial class DistributionPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -29,13 +37,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Mode)) { writer.WritePropertyName("mode"u8); - writer.WriteObjectValue(Mode); + if (Mode is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Mode).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement element) + internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +73,7 @@ internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement ele Optional name = default; Optional offerExpiresAfterSeconds = default; Optional mode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -74,8 +104,61 @@ internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement ele mode = DistributionMode.DeserializeDistributionMode(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DistributionPolicy(id.Value, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value, serializedAdditionalRawData); + } + + DistributionPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDistributionPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DistributionPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDistributionPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DistributionPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DistributionPolicy(Response response) + { + if (response is null) + { + return null; } - return new DistributionPolicy(id.Value, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDistributionPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs index db3ac9175cdb..769d925f5944 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.JobRouter; namespace Azure.Communication.JobRouter.Models @@ -12,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// Policy governing how jobs are distributed to workers. public partial class DistributionPolicy { - /// Initializes a new instance of DistributionPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The unique identifier of the policy. /// The human readable name of the policy. /// The number of seconds after which any offers created under this policy will be expired. @@ -21,12 +26,14 @@ public partial class DistributionPolicy /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// - internal DistributionPolicy(string id, string name, double? offerExpiresAfterSeconds, DistributionMode mode) + /// Keeps track of any properties unknown to the library. + internal DistributionPolicy(string id, string name, double? offerExpiresAfterSeconds, DistributionMode mode, Dictionary serializedAdditionalRawData) { Id = id; Name = name; _offerExpiresAfterSeconds = offerExpiresAfterSeconds; Mode = mode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique identifier of the policy. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs index 839b2a80c35c..0d3b8fcf7db4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class DistributionPolicyCollection + internal partial class DistributionPolicyCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DistributionPolicyCollection DeserializeDistributionPolicyCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DistributionPolicyCollection DeserializeDistributionPolicyCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static DistributionPolicyCollection DeserializeDistributionPolicyCollec nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DistributionPolicyCollection(value, nextLink.Value); + return new DistributionPolicyCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + DistributionPolicyCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDistributionPolicyCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DistributionPolicyCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDistributionPolicyCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DistributionPolicyCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DistributionPolicyCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDistributionPolicyCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs index e7b8722ec798..0f1966539883 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A paged collection of distribution policies. internal partial class DistributionPolicyCollection { - /// Initializes a new instance of DistributionPolicyCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal DistributionPolicyCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal DistributionPolicyCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DistributionPolicyCollection. + /// Initializes a new instance of . /// /// - internal DistributionPolicyCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DistributionPolicyCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DistributionPolicyCollection() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs index 0a2b5a4f8eda..d73421f6b27e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class DistributionPolicyItem + public partial class DistributionPolicyItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DistributionPolicy)) + { + writer.WritePropertyName("distributionPolicy"u8); + if (DistributionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DistributionPolicy).Serialize(writer, options); + } + } + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(_etag); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional distributionPolicy = default; Optional etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("distributionPolicy"u8)) @@ -36,8 +82,61 @@ internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonEle etag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DistributionPolicyItem(distributionPolicy.Value, etag.Value); + return new DistributionPolicyItem(distributionPolicy.Value, etag.Value, serializedAdditionalRawData); + } + + DistributionPolicyItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDistributionPolicyItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DistributionPolicyItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDistributionPolicyItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DistributionPolicyItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DistributionPolicyItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDistributionPolicyItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs index bb862e636db2..62ad3c932b9c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of DistributionPolicy. public partial class DistributionPolicyItem { - /// Initializes a new instance of DistributionPolicyItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DistributionPolicyItem() { } - /// Initializes a new instance of DistributionPolicyItem. + /// Initializes a new instance of . /// Policy governing how jobs are distributed to workers. /// (Optional) The Concurrency Token. - internal DistributionPolicyItem(DistributionPolicy distributionPolicy, string etag) + /// Keeps track of any properties unknown to the library. + internal DistributionPolicyItem(DistributionPolicy distributionPolicy, string etag, Dictionary serializedAdditionalRawData) { DistributionPolicy = distributionPolicy; _etag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Policy governing how jobs are distributed to workers. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs index 58d63c875aa3..af597a49aa99 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ExceptionAction : IUtf8JsonSerializable + public partial class ExceptionAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExceptionAction DeserializeExceptionAction(JsonElement element) + internal static ExceptionAction DeserializeExceptionAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,7 +57,72 @@ internal static ExceptionAction DeserializeExceptionAction(JsonElement element) case "reclassify": return ReclassifyExceptionAction.DeserializeReclassifyExceptionAction(element); } } - return UnknownExceptionAction.DeserializeUnknownExceptionAction(element); + + // Unknown type found so we will deserialize the base properties only + string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownExceptionAction(kind, serializedAdditionalRawData); + } + + ExceptionAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExceptionAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExceptionAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExceptionAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExceptionAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs index 04f932639c9e..e5dcc05d9dfa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.Communication.JobRouter { /// @@ -12,13 +16,19 @@ namespace Azure.Communication.JobRouter /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownExceptionAction))] public abstract partial class ExceptionAction { - /// Initializes a new instance of ExceptionAction. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionAction. - internal ExceptionAction(string kind) + /// Keeps track of any properties unknown to the library. + internal ExceptionAction(string kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs index 53945af79ba5..5cd913594ea7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class ExceptionPolicy : IUtf8JsonSerializable + public partial class ExceptionPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -29,15 +36,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in _exceptionRules) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) + internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +73,7 @@ internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) Optional id = default; Optional name = default; Optional> exceptionRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +100,61 @@ internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) exceptionRules = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExceptionPolicy(id.Value, name.Value, Optional.ToDictionary(exceptionRules), serializedAdditionalRawData); + } + + ExceptionPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExceptionPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExceptionPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExceptionPolicy(Response response) + { + if (response is null) + { + return null; } - return new ExceptionPolicy(id.Value, name.Value, Optional.ToDictionary(exceptionRules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExceptionPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs index 7e5330581818..9692bf9e3c5e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.JobRouter; using Azure.Core; @@ -14,15 +15,20 @@ namespace Azure.Communication.JobRouter.Models /// A policy that defines actions to execute when exception are triggered. public partial class ExceptionPolicy { - /// Initializes a new instance of ExceptionPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the exception policy. /// (Optional) The name of the exception policy. /// (Optional) A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. - internal ExceptionPolicy(string id, string name, IDictionary exceptionRules) + /// Keeps track of any properties unknown to the library. + internal ExceptionPolicy(string id, string name, IDictionary exceptionRules, Dictionary serializedAdditionalRawData) { Id = id; Name = name; _exceptionRules = exceptionRules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Id of the exception policy. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs index b9241b4e8c6f..a7ef6e91ed71 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class ExceptionPolicyCollection + internal partial class ExceptionPolicyCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExceptionPolicyCollection DeserializeExceptionPolicyCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExceptionPolicyCollection DeserializeExceptionPolicyCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static ExceptionPolicyCollection DeserializeExceptionPolicyCollection(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExceptionPolicyCollection(value, nextLink.Value); + return new ExceptionPolicyCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ExceptionPolicyCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExceptionPolicyCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionPolicyCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionPolicyCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExceptionPolicyCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExceptionPolicyCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExceptionPolicyCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs index 3212f5c1a48b..b71ee0360051 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A paged collection of exception policies. internal partial class ExceptionPolicyCollection { - /// Initializes a new instance of ExceptionPolicyCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal ExceptionPolicyCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ExceptionPolicyCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ExceptionPolicyCollection. + /// Initializes a new instance of . /// /// - internal ExceptionPolicyCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ExceptionPolicyCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExceptionPolicyCollection() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs index 597ed20fa80e..12f3dc2da194 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class ExceptionPolicyItem + public partial class ExceptionPolicyItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ExceptionPolicy)) + { + writer.WritePropertyName("exceptionPolicy"u8); + if (ExceptionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExceptionPolicy).Serialize(writer, options); + } + } + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(_etag); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional exceptionPolicy = default; Optional etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("exceptionPolicy"u8)) @@ -36,8 +82,61 @@ internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement e etag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExceptionPolicyItem(exceptionPolicy.Value, etag.Value); + return new ExceptionPolicyItem(exceptionPolicy.Value, etag.Value, serializedAdditionalRawData); + } + + ExceptionPolicyItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExceptionPolicyItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionPolicyItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionPolicyItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExceptionPolicyItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExceptionPolicyItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExceptionPolicyItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs index eb0e17f4d974..1c4deb0bdcc3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of ExceptionPolicy. public partial class ExceptionPolicyItem { - /// Initializes a new instance of ExceptionPolicyItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExceptionPolicyItem() { } - /// Initializes a new instance of ExceptionPolicyItem. + /// Initializes a new instance of . /// A policy that defines actions to execute when exception are triggered. /// (Optional) The Concurrency Token. - internal ExceptionPolicyItem(ExceptionPolicy exceptionPolicy, string etag) + /// Keeps track of any properties unknown to the library. + internal ExceptionPolicyItem(ExceptionPolicy exceptionPolicy, string etag, Dictionary serializedAdditionalRawData) { ExceptionPolicy = exceptionPolicy; _etag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A policy that defines actions to execute when exception are triggered. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs index 0e02d1e33937..4edc41e3509d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs @@ -5,38 +5,74 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ExceptionRule : IUtf8JsonSerializable + public partial class ExceptionRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("trigger"u8); - writer.WriteObjectValue(Trigger); + if (Trigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Trigger).Serialize(writer, options); + } writer.WritePropertyName("actions"u8); writer.WriteStartObject(); foreach (var item in Actions) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExceptionRule DeserializeExceptionRule(JsonElement element) + internal static ExceptionRule DeserializeExceptionRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ExceptionTrigger trigger = default; IDictionary actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("trigger"u8)) @@ -54,8 +90,61 @@ internal static ExceptionRule DeserializeExceptionRule(JsonElement element) actions = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExceptionRule(trigger, actions, serializedAdditionalRawData); + } + + ExceptionRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExceptionRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExceptionRule model) + { + if (model is null) + { + return null; } - return new ExceptionRule(trigger, actions); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExceptionRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExceptionRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs index 5b2dd805d7a1..e88e9179e718 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs @@ -14,6 +14,33 @@ namespace Azure.Communication.JobRouter /// A rule that defines actions to execute upon a specific trigger. public partial class ExceptionRule { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The trigger for this exception rule + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// + /// A dictionary collection of actions to perform once the exception is triggered. Key is the Id of each exception action. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal ExceptionRule(ExceptionTrigger trigger, IDictionary actions, Dictionary serializedAdditionalRawData) + { + Trigger = trigger; + Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExceptionRule() + { + } + /// /// The trigger for this exception rule /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs index a722b95af3f8..902c062f4396 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ExceptionTrigger : IUtf8JsonSerializable + public partial class ExceptionTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element) + internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,7 +56,72 @@ internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element case "wait-time": return WaitTimeExceptionTrigger.DeserializeWaitTimeExceptionTrigger(element); } } - return UnknownExceptionTrigger.DeserializeUnknownExceptionTrigger(element); + + // Unknown type found so we will deserialize the base properties only + string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownExceptionTrigger(kind, serializedAdditionalRawData); + } + + ExceptionTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExceptionTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExceptionTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExceptionTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExceptionTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs index a4092743f281..ab4bddf01f5c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.Communication.JobRouter { /// @@ -12,18 +16,24 @@ namespace Azure.Communication.JobRouter /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownExceptionTrigger))] public abstract partial class ExceptionTrigger { - /// Initializes a new instance of ExceptionTrigger. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected ExceptionTrigger() { } - /// Initializes a new instance of ExceptionTrigger. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionTrigger. - internal ExceptionTrigger(string kind) + /// Keeps track of any properties unknown to the library. + internal ExceptionTrigger(string kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs index 512472b165cb..1edfce12d585 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ExpressionRouterRule : IUtf8JsonSerializable + public partial class ExpressionRouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Language)) { @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Expression); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement element) + internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement Optional language = default; string expression = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("language"u8)) @@ -53,8 +76,61 @@ internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExpressionRouterRule(kind, language.Value, expression, serializedAdditionalRawData); + } + + ExpressionRouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExpressionRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExpressionRouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExpressionRouterRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExpressionRouterRule model) + { + if (model is null) + { + return null; } - return new ExpressionRouterRule(kind, language.Value, expression); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExpressionRouterRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExpressionRouterRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs index 658f0c6a463f..8184cff51dcc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,16 +14,22 @@ namespace Azure.Communication.JobRouter /// A rule providing inline expression rules. public partial class ExpressionRouterRule : RouterRule { - /// Initializes a new instance of ExpressionRouterRule. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. /// The expression language to compile to and execute. /// The string containing the expression to evaluate. Should contain return statement with calculated values. - internal ExpressionRouterRule(string kind, string language, string expression) : base(kind) + /// Keeps track of any properties unknown to the library. + internal ExpressionRouterRule(string kind, string language, string expression, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Language = language; Expression = expression; Kind = kind ?? "expression-rule"; } + + /// Initializes a new instance of for deserialization. + internal ExpressionRouterRule() + { + } /// The string containing the expression to evaluate. Should contain return statement with calculated values. public string Expression { get; set; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs index 4e04e254b9c3..a43b4ab799e0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs @@ -6,30 +6,58 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class FunctionRouterRule : IUtf8JsonSerializable + public partial class FunctionRouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("functionUri"u8); writer.WriteStringValue(FunctionUri.AbsoluteUri); if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement element) + internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +65,7 @@ internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement ele Uri functionUri = default; Optional credential = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("functionUri"u8)) @@ -58,8 +87,61 @@ internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement ele kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FunctionRouterRule(kind, functionUri, credential.Value, serializedAdditionalRawData); + } + + FunctionRouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FunctionRouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFunctionRouterRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FunctionRouterRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FunctionRouterRule(Response response) + { + if (response is null) + { + return null; } - return new FunctionRouterRule(kind, functionUri, credential.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFunctionRouterRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs index 5d1750a5d34f..4f7b1b9115fb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,11 +14,12 @@ namespace Azure.Communication.JobRouter /// A rule providing a binding to an HTTP Triggered Azure Function. public partial class FunctionRouterRule : RouterRule { - /// Initializes a new instance of FunctionRouterRule. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. /// URL for Azure Function. /// Credentials used to access Azure function rule. - internal FunctionRouterRule(string kind, Uri functionUri, FunctionRouterRuleCredential credential) : base(kind) + /// Keeps track of any properties unknown to the library. + internal FunctionRouterRule(string kind, Uri functionUri, FunctionRouterRuleCredential credential, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { FunctionUri = functionUri; Credential = credential; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs index 7d7958ac9c54..cc7f4f303b0c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class FunctionRouterRuleCredential : IUtf8JsonSerializable + public partial class FunctionRouterRuleCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FunctionKey)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientId"u8); writer.WriteStringValue(ClientId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCredential(JsonElement element) + internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCreden Optional functionKey = default; Optional appKey = default; Optional clientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("functionKey"u8)) @@ -59,8 +82,61 @@ internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCreden clientId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FunctionRouterRuleCredential(functionKey.Value, appKey.Value, clientId.Value, serializedAdditionalRawData); + } + + FunctionRouterRuleCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionRouterRuleCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FunctionRouterRuleCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFunctionRouterRuleCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FunctionRouterRuleCredential model) + { + if (model is null) + { + return null; } - return new FunctionRouterRuleCredential(functionKey.Value, appKey.Value, clientId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FunctionRouterRuleCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFunctionRouterRuleCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs index 76b54979463b..8c7a42112999 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Credentials used to access Azure function rule. public partial class FunctionRouterRuleCredential { - /// Initializes a new instance of FunctionRouterRuleCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// (Optional) Access key scoped to a particular function. /// /// (Optional) Access key scoped to a Azure Function app. @@ -20,11 +26,13 @@ public partial class FunctionRouterRuleCredential /// (Optional) Client id, when AppKey is provided /// In context of Azure function, this is usually the name of the key /// - internal FunctionRouterRuleCredential(string functionKey, string appKey, string clientId) + /// Keeps track of any properties unknown to the library. + internal FunctionRouterRuleCredential(string functionKey, string appKey, string clientId, Dictionary serializedAdditionalRawData) { FunctionKey = functionKey; AppKey = appKey; ClientId = clientId; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs index 0717ffcb5c16..8f9b3a2f63c7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class JobMatchingMode : IUtf8JsonSerializable + public partial class JobMatchingMode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ModeType)) + { + writer.WritePropertyName("modeType"u8); + writer.WriteStringValue(ModeType.Value.ToString()); + } + if (Optional.IsDefined(_queueAndMatchMode)) + { + writer.WritePropertyName("queueAndMatchMode"u8); + writer.WriteObjectValue(_queueAndMatchMode); + } + if (Optional.IsDefined(ScheduleAndSuspendMode)) + { + writer.WritePropertyName("scheduleAndSuspendMode"u8); + if (ScheduleAndSuspendMode is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduleAndSuspendMode).Serialize(writer, options); + } + } + if (Optional.IsDefined(_suspendMode)) + { + writer.WritePropertyName("suspendMode"u8); + writer.WriteObjectValue(_suspendMode); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +75,7 @@ internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) Optional queueAndMatchMode = default; Optional scheduleAndSuspendMode = default; Optional suspendMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("modeType"u8)) @@ -60,8 +114,61 @@ internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) suspendMode = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JobMatchingMode(Optional.ToNullable(modeType), queueAndMatchMode.Value, scheduleAndSuspendMode.Value, suspendMode.Value, serializedAdditionalRawData); + } + + JobMatchingMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobMatchingMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobMatchingMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobMatchingMode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobMatchingMode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobMatchingMode(Response response) + { + if (response is null) + { + return null; } - return new JobMatchingMode(Optional.ToNullable(modeType), queueAndMatchMode.Value, scheduleAndSuspendMode.Value, suspendMode.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobMatchingMode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs index 84205d1b33a5..efd1b9dc1804 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs @@ -5,22 +5,30 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The JobMatchingMode. public partial class JobMatchingMode { - /// Initializes a new instance of JobMatchingMode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Any object. /// /// Any object. - internal JobMatchingMode(JobMatchModeType? modeType, object queueAndMatchMode, ScheduleAndSuspendMode scheduleAndSuspendMode, object suspendMode) + /// Keeps track of any properties unknown to the library. + internal JobMatchingMode(JobMatchModeType? modeType, object queueAndMatchMode, ScheduleAndSuspendMode scheduleAndSuspendMode, object suspendMode, Dictionary serializedAdditionalRawData) { ModeType = modeType; _queueAndMatchMode = queueAndMatchMode; ScheduleAndSuspendMode = scheduleAndSuspendMode; _suspendMode = suspendMode; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs index 2eead67d7af9..aee9dad2530b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class LongestIdleMode : IUtf8JsonSerializable + public partial class LongestIdleMode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassSelectors"u8); writer.WriteBooleanValue(BypassSelectors.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) + internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -79,8 +102,61 @@ internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) bypassSelectors = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LongestIdleMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), serializedAdditionalRawData); + } + + LongestIdleMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLongestIdleMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LongestIdleMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLongestIdleMode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LongestIdleMode model) + { + if (model is null) + { + return null; } - return new LongestIdleMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LongestIdleMode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLongestIdleMode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs index a1286abc7871..50b7891e3dcb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs @@ -5,12 +5,15 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Jobs are directed to the worker who has been idle longest. public partial class LongestIdleMode : DistributionMode { - /// Initializes a new instance of LongestIdleMode. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Mode. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. @@ -21,7 +24,8 @@ public partial class LongestIdleMode : DistributionMode /// variable to true. This flag is intended more for temporary usage. /// By default, set to false. /// - internal LongestIdleMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// Keeps track of any properties unknown to the library. + internal LongestIdleMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, Dictionary serializedAdditionalRawData) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors, serializedAdditionalRawData) { Kind = kind ?? "longest-idle"; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs index aa1024d136eb..659259f61bbf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ManualReclassifyExceptionAction : IUtf8JsonSerializable + public partial class ManualReclassifyExceptionAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QueueId)) { @@ -32,17 +39,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in WorkerSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExceptionAction(JsonElement element) + internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExceptionAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +79,7 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep Optional priority = default; Optional> workerSelectors = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queueId"u8)) @@ -86,8 +115,61 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManualReclassifyExceptionAction(kind, queueId.Value, Optional.ToNullable(priority), Optional.ToList(workerSelectors), serializedAdditionalRawData); + } + + ManualReclassifyExceptionAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManualReclassifyExceptionAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManualReclassifyExceptionAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManualReclassifyExceptionAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManualReclassifyExceptionAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManualReclassifyExceptionAction(Response response) + { + if (response is null) + { + return null; } - return new ManualReclassifyExceptionAction(kind, queueId.Value, Optional.ToNullable(priority), Optional.ToList(workerSelectors)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManualReclassifyExceptionAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs index d4cd4a08f106..51e8bb9d31db 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,13 @@ namespace Azure.Communication.JobRouter /// An action that manually reclassifies a job by providing the queue, priority and worker selectors. public partial class ManualReclassifyExceptionAction : ExceptionAction { - /// Initializes a new instance of ManualReclassifyExceptionAction. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionAction. /// Updated QueueId. /// Updated Priority. /// Updated WorkerSelectors. - internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IList workerSelectors) : base(kind) + /// Keeps track of any properties unknown to the library. + internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IList workerSelectors, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { QueueId = queueId; Priority = priority; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs index 55802736c7d0..b7092e6199e5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class Oauth2ClientCredential : IUtf8JsonSerializable + public partial class Oauth2ClientCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecret"u8); writer.WriteStringValue(ClientSecret); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonElement element) + internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clientId = default; Optional clientSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -48,8 +71,61 @@ internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonEle clientSecret = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Oauth2ClientCredential(clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + Oauth2ClientCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOauth2ClientCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Oauth2ClientCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOauth2ClientCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Oauth2ClientCredential model) + { + if (model is null) + { + return null; } - return new Oauth2ClientCredential(clientId.Value, clientSecret.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Oauth2ClientCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOauth2ClientCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs index 4721bad448df..95e4bb6a4636 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// @@ -13,18 +16,23 @@ namespace Azure.Communication.JobRouter /// public partial class Oauth2ClientCredential { - /// Initializes a new instance of Oauth2ClientCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Oauth2ClientCredential() { } - /// Initializes a new instance of Oauth2ClientCredential. + /// Initializes a new instance of . /// ClientId for Contoso Authorization server. /// Client secret for Contoso Authorization server. - internal Oauth2ClientCredential(string clientId, string clientSecret) + /// Keeps track of any properties unknown to the library. + internal Oauth2ClientCredential(string clientId, string clientSecret, Dictionary serializedAdditionalRawData) { ClientId = clientId; ClientSecret = clientSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// ClientId for Contoso Authorization server. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs index a9a92874e708..6b909d9adf8c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable + public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LabelOperator.ToString()); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSelectorAttachment(JsonElement element) + internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSe string key = default; LabelOperator labelOperator = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -50,8 +73,61 @@ internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSe kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PassThroughQueueSelectorAttachment(kind, key, labelOperator, serializedAdditionalRawData); + } + + PassThroughQueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePassThroughQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PassThroughQueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePassThroughQueueSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PassThroughQueueSelectorAttachment model) + { + if (model is null) + { + return null; } - return new PassThroughQueueSelectorAttachment(kind, key, labelOperator); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PassThroughQueueSelectorAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePassThroughQueueSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs index 39482420243a..3de4d47d97a3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Attaches a queue selector where the value is passed through from the job label with the same key. public partial class PassThroughQueueSelectorAttachment : QueueSelectorAttachment { - /// Initializes a new instance of PassThroughQueueSelectorAttachment. + /// Initializes a new instance of . /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// is null. @@ -26,17 +27,23 @@ public PassThroughQueueSelectorAttachment(string key, LabelOperator labelOperato Kind = "pass-through"; } - /// Initializes a new instance of PassThroughQueueSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. - internal PassThroughQueueSelectorAttachment(string kind, string key, LabelOperator labelOperator) : base(kind) + /// Keeps track of any properties unknown to the library. + internal PassThroughQueueSelectorAttachment(string kind, string key, LabelOperator labelOperator, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Key = key; LabelOperator = labelOperator; Kind = kind ?? "pass-through"; } + /// Initializes a new instance of for deserialization. + internal PassThroughQueueSelectorAttachment() + { + } + /// The label key to query against. public string Key { get; set; } /// Describes how the value of the label is compared to the value pass through. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs index 211f9d123e05..3aaebe579f5e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class PassThroughWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class PassThroughWorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorkerSelectorAttachment(JsonElement element) + internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorker LabelOperator labelOperator = default; Optional expiresAfterSeconds = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -65,8 +88,61 @@ internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorker kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PassThroughWorkerSelectorAttachment(kind, key, labelOperator, Optional.ToNullable(expiresAfterSeconds), serializedAdditionalRawData); + } + + PassThroughWorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePassThroughWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PassThroughWorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePassThroughWorkerSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PassThroughWorkerSelectorAttachment model) + { + if (model is null) + { + return null; } - return new PassThroughWorkerSelectorAttachment(kind, key, labelOperator, Optional.ToNullable(expiresAfterSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PassThroughWorkerSelectorAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePassThroughWorkerSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs index e964b31767f7..1634549c1d2a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Attaches a worker selector where the value is passed through from the job label with the same key. public partial class PassThroughWorkerSelectorAttachment : WorkerSelectorAttachment { - /// Initializes a new instance of PassThroughWorkerSelectorAttachment. + /// Initializes a new instance of . /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// is null. @@ -26,12 +27,13 @@ public PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperat Kind = "pass-through"; } - /// Initializes a new instance of PassThroughWorkerSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// Describes how long the attached label selector is valid in seconds. - internal PassThroughWorkerSelectorAttachment(string kind, string key, LabelOperator labelOperator, double? expiresAfterSeconds) : base(kind) + /// Keeps track of any properties unknown to the library. + internal PassThroughWorkerSelectorAttachment(string kind, string key, LabelOperator labelOperator, double? expiresAfterSeconds, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Key = key; LabelOperator = labelOperator; @@ -39,6 +41,11 @@ internal PassThroughWorkerSelectorAttachment(string kind, string key, LabelOpera Kind = kind ?? "pass-through"; } + /// Initializes a new instance of for deserialization. + internal PassThroughWorkerSelectorAttachment() + { + } + /// The label key to query against. public string Key { get; set; } /// Describes how the value of the label is compared to the value pass through. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs index 2dde905ad99a..8f27f00dad46 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class QueueLengthExceptionTrigger : IUtf8JsonSerializable + public partial class QueueLengthExceptionTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("threshold"u8); writer.WriteNumberValue(Threshold); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigger(JsonElement element) + internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int threshold = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("threshold"u8)) @@ -42,8 +65,61 @@ internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigg kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueueLengthExceptionTrigger(kind, threshold, serializedAdditionalRawData); + } + + QueueLengthExceptionTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueueLengthExceptionTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueueLengthExceptionTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueueLengthExceptionTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueueLengthExceptionTrigger model) + { + if (model is null) + { + return null; } - return new QueueLengthExceptionTrigger(kind, threshold); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueueLengthExceptionTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueueLengthExceptionTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs index 0ec31d1af709..eb54c7cfadca 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs @@ -5,20 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Trigger for an exception action on exceeding queue length. public partial class QueueLengthExceptionTrigger : ExceptionTrigger { - /// Initializes a new instance of QueueLengthExceptionTrigger. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionTrigger. /// Threshold of number of jobs ahead in the queue to for this trigger to fire. - internal QueueLengthExceptionTrigger(string kind, int threshold) : base(kind) + /// Keeps track of any properties unknown to the library. + internal QueueLengthExceptionTrigger(string kind, int threshold, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Threshold = threshold; Kind = kind ?? "queue-length"; } + /// Initializes a new instance of for deserialization. + internal QueueLengthExceptionTrigger() + { + } + /// Threshold of number of jobs ahead in the queue to for this trigger to fire. public int Threshold { get; set; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs index 0d715f56708e..b1d71dd57bb1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class QueueSelectorAttachment : IUtf8JsonSerializable + public partial class QueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonElement element) + internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,7 +59,72 @@ internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonE case "weighted-allocation-queue-selector": return WeightedAllocationQueueSelectorAttachment.DeserializeWeightedAllocationQueueSelectorAttachment(element); } } - return UnknownQueueSelectorAttachment.DeserializeUnknownQueueSelectorAttachment(element); + + // Unknown type found so we will deserialize the base properties only + string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownQueueSelectorAttachment(kind, serializedAdditionalRawData); + } + + QueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueueSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueueSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueueSelectorAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueueSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs index 6c7db5219912..e1b19a538645 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.Communication.JobRouter { /// @@ -12,13 +16,19 @@ namespace Azure.Communication.JobRouter /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// + [DeserializationProxy(typeof(UnknownQueueSelectorAttachment))] public abstract partial class QueueSelectorAttachment { - /// Initializes a new instance of QueueSelectorAttachment. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. - internal QueueSelectorAttachment(string kind) + /// Keeps track of any properties unknown to the library. + internal QueueSelectorAttachment(string kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs index c513707f2998..98502c73e076 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class QueueWeightedAllocation : IUtf8JsonSerializable + public partial class QueueWeightedAllocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("weight"u8); writer.WriteNumberValue(Weight); @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in QueueSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonElement element) + internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } double weight = default; IList queueSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weight"u8)) @@ -53,8 +82,61 @@ internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonE queueSelectors = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueueWeightedAllocation(weight, queueSelectors, serializedAdditionalRawData); + } + + QueueWeightedAllocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueueWeightedAllocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueueWeightedAllocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueueWeightedAllocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueueWeightedAllocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueueWeightedAllocation(Response response) + { + if (response is null) + { + return null; } - return new QueueWeightedAllocation(weight, queueSelectors); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueueWeightedAllocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs index bf55da81d188..81f37c1af828 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter /// Contains the weight percentage and queue selectors to be applied if selected for weighted distributions. public partial class QueueWeightedAllocation { - /// Initializes a new instance of QueueWeightedAllocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The percentage of this weight, expressed as a fraction of 1. /// A collection of queue selectors that will be applied if this allocation is selected. /// is null. @@ -27,13 +30,20 @@ public QueueWeightedAllocation(double weight, IEnumerable q QueueSelectors = queueSelectors.ToList(); } - /// Initializes a new instance of QueueWeightedAllocation. + /// Initializes a new instance of . /// The percentage of this weight, expressed as a fraction of 1. /// A collection of queue selectors that will be applied if this allocation is selected. - internal QueueWeightedAllocation(double weight, IList queueSelectors) + /// Keeps track of any properties unknown to the library. + internal QueueWeightedAllocation(double weight, IList queueSelectors, Dictionary serializedAdditionalRawData) { Weight = weight; QueueSelectors = queueSelectors; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueueWeightedAllocation() + { } /// The percentage of this weight, expressed as a fraction of 1. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs index 6d002947efcf..615270d18c4c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ReclassifyExceptionAction : IUtf8JsonSerializable + public partial class ReclassifyExceptionAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClassificationPolicyId)) { @@ -39,11 +46,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(JsonElement element) + internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +72,7 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J Optional classificationPolicyId = default; Optional> labelsToUpsert = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("classificationPolicyId"u8)) @@ -84,8 +106,61 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReclassifyExceptionAction(kind, classificationPolicyId.Value, Optional.ToDictionary(labelsToUpsert), serializedAdditionalRawData); + } + + ReclassifyExceptionAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReclassifyExceptionAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReclassifyExceptionAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReclassifyExceptionAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReclassifyExceptionAction model) + { + if (model is null) + { + return null; } - return new ReclassifyExceptionAction(kind, classificationPolicyId.Value, Optional.ToDictionary(labelsToUpsert)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReclassifyExceptionAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReclassifyExceptionAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs index 14036bed516f..973cb0574288 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,11 +14,12 @@ namespace Azure.Communication.JobRouter /// An action that modifies labels on a job and then reclassifies it. public partial class ReclassifyExceptionAction : ExceptionAction { - /// Initializes a new instance of ReclassifyExceptionAction. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionAction. /// (optional) The new classification policy that will determine queue, priority and worker selectors. /// (optional) Dictionary containing the labels to update (or add if not existing) in key-value pairs. - internal ReclassifyExceptionAction(string kind, string classificationPolicyId, IDictionary labelsToUpsert) : base(kind) + /// Keeps track of any properties unknown to the library. + internal ReclassifyExceptionAction(string kind, string classificationPolicyId, IDictionary labelsToUpsert, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { ClassificationPolicyId = classificationPolicyId; _labelsToUpsert = labelsToUpsert; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs index a678e2c74982..efe5ebdaca34 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class RoundRobinMode : IUtf8JsonSerializable + public partial class RoundRobinMode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassSelectors"u8); writer.WriteBooleanValue(BypassSelectors.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) + internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -79,8 +102,61 @@ internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) bypassSelectors = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoundRobinMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), serializedAdditionalRawData); + } + + RoundRobinMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoundRobinMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoundRobinMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoundRobinMode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoundRobinMode model) + { + if (model is null) + { + return null; } - return new RoundRobinMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoundRobinMode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoundRobinMode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs index eac5da7ef27d..0a0fcdd236aa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs @@ -5,12 +5,15 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job. public partial class RoundRobinMode : DistributionMode { - /// Initializes a new instance of RoundRobinMode. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Mode. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. @@ -21,7 +24,8 @@ public partial class RoundRobinMode : DistributionMode /// variable to true. This flag is intended more for temporary usage. /// By default, set to false. /// - internal RoundRobinMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// Keeps track of any properties unknown to the library. + internal RoundRobinMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, Dictionary serializedAdditionalRawData) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors, serializedAdditionalRawData) { Kind = kind ?? "round-robin"; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs index e2009385449a..af82bae15984 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterJob : IUtf8JsonSerializable + public partial class RouterJob : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ChannelReference)) { @@ -54,7 +60,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in _requestedWorkerSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -104,13 +117,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MatchingMode)) { writer.WritePropertyName("matchingMode"u8); - writer.WriteObjectValue(MatchingMode); + if (MatchingMode is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MatchingMode).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RouterJob DeserializeRouterJob(JsonElement element) + internal static RouterJob DeserializeRouterJob(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -132,6 +166,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) Optional> notes = default; Optional scheduledAt = default; Optional matchingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -307,8 +342,61 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) matchingMode = JobMatchingMode.DeserializeJobMatchingMode(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterJob(id.Value, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); + return new RouterJob(id.Value, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value, serializedAdditionalRawData); + } + + RouterJob IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterJob(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterJob IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterJob(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterJob model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterJob(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterJob(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs index 9f9f34901fe6..ed088239e990 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A unit of work to be routed. public partial class RouterJob { - /// Initializes a new instance of RouterJob. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The id of the job. /// Reference to an external parent context, eg. call ID. /// The status of the Job. @@ -36,7 +39,8 @@ public partial class RouterJob /// Notes attached to a job, sorted by timestamp. /// If set, job will be scheduled to be enqueued at a given time. /// - internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) + /// Keeps track of any properties unknown to the library. + internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode, Dictionary serializedAdditionalRawData) { Id = id; ChannelReference = channelReference; @@ -55,6 +59,7 @@ internal RouterJob(string id, string channelReference, RouterJobStatus? status, _notes = notes; ScheduledAt = scheduledAt; MatchingMode = matchingMode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the job. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs index ded886157399..45fbeef9e922 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs @@ -6,15 +6,61 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterJobAssignment + public partial class RouterJobAssignment : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterJobAssignment DeserializeRouterJobAssignment(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("assignmentId"u8); + writer.WriteStringValue(AssignmentId); + if (Optional.IsDefined(WorkerId)) + { + writer.WritePropertyName("workerId"u8); + writer.WriteStringValue(WorkerId); + } + writer.WritePropertyName("assignedAt"u8); + writer.WriteStringValue(AssignedAt, "O"); + if (Optional.IsDefined(CompletedAt)) + { + writer.WritePropertyName("completedAt"u8); + writer.WriteStringValue(CompletedAt.Value, "O"); + } + if (Optional.IsDefined(ClosedAt)) + { + writer.WritePropertyName("closedAt"u8); + writer.WriteStringValue(ClosedAt.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterJobAssignment DeserializeRouterJobAssignment(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +70,7 @@ internal static RouterJobAssignment DeserializeRouterJobAssignment(JsonElement e DateTimeOffset assignedAt = default; Optional completedAt = default; Optional closedAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("assignmentId"u8)) @@ -59,8 +106,61 @@ internal static RouterJobAssignment DeserializeRouterJobAssignment(JsonElement e closedAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterJobAssignment(assignmentId, workerId.Value, assignedAt, Optional.ToNullable(completedAt), Optional.ToNullable(closedAt)); + return new RouterJobAssignment(assignmentId, workerId.Value, assignedAt, Optional.ToNullable(completedAt), Optional.ToNullable(closedAt), serializedAdditionalRawData); + } + + RouterJobAssignment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterJobAssignment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterJobAssignment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterJobAssignment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterJobAssignment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterJobAssignment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterJobAssignment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs index 4c3f4fb5f8fe..cba00cce501c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// Assignment details of a job to a worker. public partial class RouterJobAssignment { - /// Initializes a new instance of RouterJobAssignment. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the job assignment. /// The assignment time of the job in UTC. /// is null. @@ -25,19 +29,26 @@ internal RouterJobAssignment(string assignmentId, DateTimeOffset assignedAt) AssignedAt = assignedAt; } - /// Initializes a new instance of RouterJobAssignment. + /// Initializes a new instance of . /// The Id of the job assignment. /// The Id of the Worker assigned to the job. /// The assignment time of the job in UTC. /// The time the job was marked as completed after being assigned in UTC. /// The time the job was marked as closed after being completed in UTC. - internal RouterJobAssignment(string assignmentId, string workerId, DateTimeOffset assignedAt, DateTimeOffset? completedAt, DateTimeOffset? closedAt) + /// Keeps track of any properties unknown to the library. + internal RouterJobAssignment(string assignmentId, string workerId, DateTimeOffset assignedAt, DateTimeOffset? completedAt, DateTimeOffset? closedAt, Dictionary serializedAdditionalRawData) { AssignmentId = assignmentId; WorkerId = workerId; AssignedAt = assignedAt; CompletedAt = completedAt; ClosedAt = closedAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterJobAssignment() + { } /// The Id of the job assignment. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs index e678674f3ba7..a98f6a498b56 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class RouterJobCollection + internal partial class RouterJobCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterJobCollection DeserializeRouterJobCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterJobCollection DeserializeRouterJobCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static RouterJobCollection DeserializeRouterJobCollection(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterJobCollection(value, nextLink.Value); + return new RouterJobCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + RouterJobCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterJobCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterJobCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterJobCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterJobCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterJobCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterJobCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs index 6328876bca3a..9c795caa83d5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A paged collection of jobs. internal partial class RouterJobCollection { - /// Initializes a new instance of RouterJobCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal RouterJobCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal RouterJobCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RouterJobCollection. + /// Initializes a new instance of . /// /// - internal RouterJobCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RouterJobCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterJobCollection() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs index f36b43a30ef5..a06f3677babd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterJobItem + public partial class RouterJobItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Job)) + { + writer.WritePropertyName("job"u8); + if (Job is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Job).Serialize(writer, options); + } + } + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(_etag); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterJobItem DeserializeRouterJobItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional job = default; Optional etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("job"u8)) @@ -36,8 +82,61 @@ internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) etag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterJobItem(job.Value, etag.Value); + return new RouterJobItem(job.Value, etag.Value, serializedAdditionalRawData); + } + + RouterJobItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterJobItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterJobItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterJobItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterJobItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterJobItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterJobItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs index 164f65bc9730..88e6bddb8130 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of RouterJob. public partial class RouterJobItem { - /// Initializes a new instance of RouterJobItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RouterJobItem() { } - /// Initializes a new instance of RouterJobItem. + /// Initializes a new instance of . /// A unit of work to be routed. /// (Optional) The Concurrency Token. - internal RouterJobItem(RouterJob job, string etag) + /// Keeps track of any properties unknown to the library. + internal RouterJobItem(RouterJob job, string etag, Dictionary serializedAdditionalRawData) { Job = job; _etag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A unit of work to be routed. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs index f361747e7be1..6c64831335c4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs @@ -6,15 +6,58 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterJobOffer + public partial class RouterJobOffer : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterJobOffer DeserializeRouterJobOffer(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("offerId"u8); + writer.WriteStringValue(OfferId); + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + writer.WritePropertyName("capacityCost"u8); + writer.WriteNumberValue(CapacityCost); + if (Optional.IsDefined(OfferedAt)) + { + writer.WritePropertyName("offeredAt"u8); + writer.WriteStringValue(OfferedAt.Value, "O"); + } + if (Optional.IsDefined(ExpiresAt)) + { + writer.WritePropertyName("expiresAt"u8); + writer.WriteStringValue(ExpiresAt.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterJobOffer DeserializeRouterJobOffer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RouterJobOffer DeserializeRouterJobOffer(JsonElement element) int capacityCost = default; Optional offeredAt = default; Optional expiresAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("offerId"u8)) @@ -59,8 +103,61 @@ internal static RouterJobOffer DeserializeRouterJobOffer(JsonElement element) expiresAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterJobOffer(offerId, jobId, capacityCost, Optional.ToNullable(offeredAt), Optional.ToNullable(expiresAt)); + return new RouterJobOffer(offerId, jobId, capacityCost, Optional.ToNullable(offeredAt), Optional.ToNullable(expiresAt), serializedAdditionalRawData); + } + + RouterJobOffer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterJobOffer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterJobOffer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterJobOffer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterJobOffer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterJobOffer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterJobOffer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs index 9ec25f951242..4053022fe7e1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// An offer of a job to a worker. public partial class RouterJobOffer { - /// Initializes a new instance of RouterJobOffer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the offer. /// The Id of the job. /// The capacity cost consumed by the job offer. @@ -28,19 +32,26 @@ internal RouterJobOffer(string offerId, string jobId, int capacityCost) CapacityCost = capacityCost; } - /// Initializes a new instance of RouterJobOffer. + /// Initializes a new instance of . /// The Id of the offer. /// The Id of the job. /// The capacity cost consumed by the job offer. /// The time the offer was created in UTC. /// The time that the offer will expire in UTC. - internal RouterJobOffer(string offerId, string jobId, int capacityCost, DateTimeOffset? offeredAt, DateTimeOffset? expiresAt) + /// Keeps track of any properties unknown to the library. + internal RouterJobOffer(string offerId, string jobId, int capacityCost, DateTimeOffset? offeredAt, DateTimeOffset? expiresAt, Dictionary serializedAdditionalRawData) { OfferId = offerId; JobId = jobId; CapacityCost = capacityCost; OfferedAt = offeredAt; ExpiresAt = expiresAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterJobOffer() + { } /// The Id of the offer. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs index d054449b6bcf..cbdd2ec39564 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs @@ -5,15 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterJobPositionDetails + public partial class RouterJobPositionDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterJobPositionDetails DeserializeRouterJobPositionDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + writer.WritePropertyName("position"u8); + writer.WriteNumberValue(Position); + writer.WritePropertyName("queueId"u8); + writer.WriteStringValue(QueueId); + writer.WritePropertyName("queueLength"u8); + writer.WriteNumberValue(QueueLength); + writer.WritePropertyName("estimatedWaitTimeMinutes"u8); + writer.WriteNumberValue(_estimatedWaitTimeMinutes); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterJobPositionDetails DeserializeRouterJobPositionDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +61,7 @@ internal static RouterJobPositionDetails DeserializeRouterJobPositionDetails(Jso string queueId = default; int queueLength = default; double estimatedWaitTimeMinutes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobId"u8)) @@ -50,8 +89,61 @@ internal static RouterJobPositionDetails DeserializeRouterJobPositionDetails(Jso estimatedWaitTimeMinutes = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterJobPositionDetails(jobId, position, queueId, queueLength, estimatedWaitTimeMinutes); + return new RouterJobPositionDetails(jobId, position, queueId, queueLength, estimatedWaitTimeMinutes, serializedAdditionalRawData); + } + + RouterJobPositionDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterJobPositionDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterJobPositionDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterJobPositionDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterJobPositionDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterJobPositionDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterJobPositionDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs index 4acc58846209..48ba1d44fc7b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// Position and estimated wait time for a job. public partial class RouterJobPositionDetails { - /// Initializes a new instance of RouterJobPositionDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Id of the job these details are about. /// Position of the job in question within that queue. /// Id of the queue this job is enqueued in. @@ -32,6 +36,28 @@ internal RouterJobPositionDetails(string jobId, int position, string queueId, in _estimatedWaitTimeMinutes = estimatedWaitTimeMinutes; } + /// Initializes a new instance of . + /// Id of the job these details are about. + /// Position of the job in question within that queue. + /// Id of the queue this job is enqueued in. + /// Length of the queue: total number of enqueued jobs. + /// Estimated wait time of the job rounded up to the nearest minute. + /// Keeps track of any properties unknown to the library. + internal RouterJobPositionDetails(string jobId, int position, string queueId, int queueLength, double estimatedWaitTimeMinutes, Dictionary serializedAdditionalRawData) + { + JobId = jobId; + Position = position; + QueueId = queueId; + QueueLength = queueLength; + _estimatedWaitTimeMinutes = estimatedWaitTimeMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterJobPositionDetails() + { + } + /// Id of the job these details are about. public string JobId { get; } /// Position of the job in question within that queue. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs index 942f13e0b1bb..f0d24c79cedd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterQueue : IUtf8JsonSerializable + public partial class RouterQueue : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -47,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("exceptionPolicyId"u8); writer.WriteStringValue(ExceptionPolicyId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RouterQueue DeserializeRouterQueue(JsonElement element) + internal static RouterQueue DeserializeRouterQueue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +82,7 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) Optional distributionPolicyId = default; Optional> labels = default; Optional exceptionPolicyId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -104,8 +126,61 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) exceptionPolicyId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RouterQueue(id.Value, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value, serializedAdditionalRawData); + } + + RouterQueue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterQueue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterQueue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterQueue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterQueue model) + { + if (model is null) + { + return null; } - return new RouterQueue(id.Value, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterQueue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterQueue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs index 0345ead4dbb1..ed10acd90237 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.JobRouter.Models /// A queue that can contain jobs to be routed. public partial class RouterQueue { - /// Initializes a new instance of RouterQueue. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of this queue. /// The name of this queue. /// The ID of the distribution policy that will determine how a job is distributed to workers. /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// (Optional) The ID of the exception policy that determines various job escalation rules. - internal RouterQueue(string id, string name, string distributionPolicyId, IDictionary labels, string exceptionPolicyId) + /// Keeps track of any properties unknown to the library. + internal RouterQueue(string id, string name, string distributionPolicyId, IDictionary labels, string exceptionPolicyId, Dictionary serializedAdditionalRawData) { Id = id; Name = name; DistributionPolicyId = distributionPolicyId; _labels = labels; ExceptionPolicyId = exceptionPolicyId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Id of this queue. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs index 560cee718b5a..92adfc7b5cff 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class RouterQueueCollection + internal partial class RouterQueueCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterQueueCollection DeserializeRouterQueueCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterQueueCollection DeserializeRouterQueueCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static RouterQueueCollection DeserializeRouterQueueCollection(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterQueueCollection(value, nextLink.Value); + return new RouterQueueCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + RouterQueueCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterQueueCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterQueueCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterQueueCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterQueueCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterQueueCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterQueueCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs index d6b977f711a0..9a60a5a8dfb6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A paged collection of queues. internal partial class RouterQueueCollection { - /// Initializes a new instance of RouterQueueCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal RouterQueueCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal RouterQueueCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RouterQueueCollection. + /// Initializes a new instance of . /// /// - internal RouterQueueCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RouterQueueCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterQueueCollection() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs index c83b801be6e9..1bfb75b3c021 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterQueueItem + public partial class RouterQueueItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Queue)) + { + writer.WritePropertyName("queue"u8); + if (Queue is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Queue).Serialize(writer, options); + } + } + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(_etag); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional queue = default; Optional etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queue"u8)) @@ -36,8 +82,61 @@ internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) etag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterQueueItem(queue.Value, etag.Value); + return new RouterQueueItem(queue.Value, etag.Value, serializedAdditionalRawData); + } + + RouterQueueItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterQueueItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterQueueItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterQueueItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterQueueItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterQueueItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterQueueItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs index 500f148cb411..111f23290e64 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of RouterQueue. public partial class RouterQueueItem { - /// Initializes a new instance of RouterQueueItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RouterQueueItem() { } - /// Initializes a new instance of RouterQueueItem. + /// Initializes a new instance of . /// A queue that can contain jobs to be routed. /// (Optional) The Concurrency Token. - internal RouterQueueItem(RouterQueue queue, string etag) + /// Keeps track of any properties unknown to the library. + internal RouterQueueItem(RouterQueue queue, string etag, Dictionary serializedAdditionalRawData) { Queue = queue; _etag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A queue that can contain jobs to be routed. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs index 3e7a657830bb..69c4be6664a7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class RouterQueueSelector : IUtf8JsonSerializable + public partial class RouterQueueSelector : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteObjectValue(_value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement element) + internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement e string key = default; LabelOperator labelOperator = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -57,8 +80,61 @@ internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement e value = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RouterQueueSelector(key, labelOperator, value.Value, serializedAdditionalRawData); + } + + RouterQueueSelector IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterQueueSelector(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterQueueSelector IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterQueueSelector(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterQueueSelector model) + { + if (model is null) + { + return null; } - return new RouterQueueSelector(key, labelOperator, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterQueueSelector(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterQueueSelector(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs index dc22889395e6..2cf53ade60e0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,15 +14,25 @@ namespace Azure.Communication.JobRouter /// Describes a condition that must be met against a set of labels for queue selection. public partial class RouterQueueSelector { - /// Initializes a new instance of RouterQueueSelector. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The label key to query against. /// Describes how the value of the label is compared to the value defined on the label selector. /// The value to compare against the actual label value with the given operator. - internal RouterQueueSelector(string key, LabelOperator labelOperator, object value) + /// Keeps track of any properties unknown to the library. + internal RouterQueueSelector(string key, LabelOperator labelOperator, object value, Dictionary serializedAdditionalRawData) { Key = key; LabelOperator = labelOperator; _value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterQueueSelector() + { } /// The label key to query against. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs index fcb2fe001737..bb3fdc6c0818 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs @@ -5,16 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterQueueStatistics + public partial class RouterQueueStatistics : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("queueId"u8); + writer.WriteStringValue(QueueId); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (Optional.IsCollectionDefined(EstimatedWaitTimeMinutes)) + { + writer.WritePropertyName("estimatedWaitTimeMinutes"u8); + writer.WriteStartObject(); + foreach (var item in EstimatedWaitTimeMinutes) + { + writer.WritePropertyName(item.Key); + writer.WriteNumberValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(LongestJobWaitTimeMinutes)) + { + writer.WritePropertyName("longestJobWaitTimeMinutes"u8); + writer.WriteNumberValue(LongestJobWaitTimeMinutes.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +70,7 @@ internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonEleme int length = default; Optional> estimatedWaitTimeMinutes = default; Optional longestJobWaitTimeMinutes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queueId"u8)) @@ -58,8 +106,61 @@ internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonEleme longestJobWaitTimeMinutes = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterQueueStatistics(queueId, length, Optional.ToDictionary(estimatedWaitTimeMinutes), Optional.ToNullable(longestJobWaitTimeMinutes)); + return new RouterQueueStatistics(queueId, length, Optional.ToDictionary(estimatedWaitTimeMinutes), Optional.ToNullable(longestJobWaitTimeMinutes), serializedAdditionalRawData); + } + + RouterQueueStatistics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterQueueStatistics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterQueueStatistics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterQueueStatistics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterQueueStatistics model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterQueueStatistics(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterQueueStatistics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs index c1ab84bb27d2..9118c75f189c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// Statistics for the queue. public partial class RouterQueueStatistics { - /// Initializes a new instance of RouterQueueStatistics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Id of the queue these details are about. /// Length of the queue: total number of enqueued jobs. /// is null. @@ -27,17 +30,24 @@ internal RouterQueueStatistics(string queueId, int length) EstimatedWaitTimeMinutes = new ChangeTrackingDictionary(); } - /// Initializes a new instance of RouterQueueStatistics. + /// Initializes a new instance of . /// Id of the queue these details are about. /// Length of the queue: total number of enqueued jobs. /// The estimated wait time of this queue rounded up to the nearest minute, grouped by job priority. /// The wait time of the job that has been enqueued in this queue for the longest. - internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary estimatedWaitTimeMinutes, double? longestJobWaitTimeMinutes) + /// Keeps track of any properties unknown to the library. + internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary estimatedWaitTimeMinutes, double? longestJobWaitTimeMinutes, Dictionary serializedAdditionalRawData) { QueueId = queueId; Length = length; EstimatedWaitTimeMinutes = estimatedWaitTimeMinutes; LongestJobWaitTimeMinutes = longestJobWaitTimeMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterQueueStatistics() + { } /// Id of the queue these details are about. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs index 23fc431e3c0c..6612dffde4f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class RouterRule : IUtf8JsonSerializable + public partial class RouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RouterRule DeserializeRouterRule(JsonElement element) + internal static RouterRule DeserializeRouterRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,7 +59,72 @@ internal static RouterRule DeserializeRouterRule(JsonElement element) case "webhook-rule": return WebhookRouterRule.DeserializeWebhookRouterRule(element); } } - return UnknownRouterRule.DeserializeUnknownRouterRule(element); + + // Unknown type found so we will deserialize the base properties only + string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownRouterRule(kind, serializedAdditionalRawData); + } + + RouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs index 23e1b33de56d..37716ae37d1f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.Communication.JobRouter { /// @@ -18,13 +22,19 @@ namespace Azure.Communication.JobRouter /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// + [DeserializationProxy(typeof(UnknownRouterRule))] public abstract partial class RouterRule { - /// Initializes a new instance of RouterRule. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. - internal RouterRule(string kind) + /// Keeps track of any properties unknown to the library. + internal RouterRule(string kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs index e6acdf529900..c523832706ea 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterWorker : IUtf8JsonSerializable + public partial class RouterWorker : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(_queueAssignments)) { @@ -77,7 +84,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in _channelConfigurations) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -86,11 +100,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("availableForOffers"u8); writer.WriteBooleanValue(AvailableForOffers.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RouterWorker DeserializeRouterWorker(JsonElement element) + internal static RouterWorker DeserializeRouterWorker(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -106,6 +134,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) Optional> assignedJobs = default; Optional loadRatio = default; Optional availableForOffers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -254,8 +283,61 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) availableForOffers = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RouterWorker(id.Value, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers), serializedAdditionalRawData); + } + + RouterWorker IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterWorker(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterWorker IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterWorker(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterWorker model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterWorker(Response response) + { + if (response is null) + { + return null; } - return new RouterWorker(id.Value, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterWorker(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs index 16667760d9e9..b1cdc7f392dd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.JobRouter; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// An entity for jobs to be routed to. public partial class RouterWorker { - /// Initializes a new instance of RouterWorker. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// The current state of the worker. /// The queue(s) that this worker can receive work from. @@ -26,7 +30,8 @@ public partial class RouterWorker /// A list of assigned jobs attached to this worker. /// A value indicating the workers capacity. A value of '1' means all capacity is consumed. A value of '0' means no capacity is currently consumed. /// A flag indicating this worker is open to receive offers or not. - internal RouterWorker(string id, RouterWorkerState? state, IDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) + /// Keeps track of any properties unknown to the library. + internal RouterWorker(string id, RouterWorkerState? state, IDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers, Dictionary serializedAdditionalRawData) { Id = id; State = state; @@ -39,6 +44,7 @@ internal RouterWorker(string id, RouterWorkerState? state, IDictionary Gets the id. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs index 1e6728c1de31..24729cffa1df 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs @@ -6,15 +6,50 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterWorkerAssignment + public partial class RouterWorkerAssignment : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterWorkerAssignment DeserializeRouterWorkerAssignment(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("assignmentId"u8); + writer.WriteStringValue(AssignmentId); + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + writer.WritePropertyName("capacityCost"u8); + writer.WriteNumberValue(CapacityCost); + writer.WritePropertyName("assignedAt"u8); + writer.WriteStringValue(AssignedAt, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterWorkerAssignment DeserializeRouterWorkerAssignment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +58,7 @@ internal static RouterWorkerAssignment DeserializeRouterWorkerAssignment(JsonEle string jobId = default; int capacityCost = default; DateTimeOffset assignedAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("assignmentId"u8)) @@ -45,8 +81,61 @@ internal static RouterWorkerAssignment DeserializeRouterWorkerAssignment(JsonEle assignedAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt); + return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt, serializedAdditionalRawData); + } + + RouterWorkerAssignment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterWorkerAssignment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterWorkerAssignment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterWorkerAssignment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterWorkerAssignment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterWorkerAssignment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterWorkerAssignment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs index d96459495c0d..fa22fb2e6758 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// The assignment for a worker to a job. public partial class RouterWorkerAssignment { - /// Initializes a new instance of RouterWorkerAssignment. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the assignment. /// The Id of the Job assigned. /// The amount of capacity this assignment has consumed on the worker. @@ -30,6 +34,26 @@ internal RouterWorkerAssignment(string assignmentId, string jobId, int capacityC AssignedAt = assignedAt; } + /// Initializes a new instance of . + /// The Id of the assignment. + /// The Id of the Job assigned. + /// The amount of capacity this assignment has consumed on the worker. + /// The assignment time of the job in UTC. + /// Keeps track of any properties unknown to the library. + internal RouterWorkerAssignment(string assignmentId, string jobId, int capacityCost, DateTimeOffset assignedAt, Dictionary serializedAdditionalRawData) + { + AssignmentId = assignmentId; + JobId = jobId; + CapacityCost = capacityCost; + AssignedAt = assignedAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterWorkerAssignment() + { + } + /// The Id of the assignment. public string AssignmentId { get; } /// The Id of the Job assigned. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs index 3735293d80d2..46448dda962d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - internal partial class RouterWorkerCollection + internal partial class RouterWorkerCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterWorkerCollection DeserializeRouterWorkerCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterWorkerCollection DeserializeRouterWorkerCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static RouterWorkerCollection DeserializeRouterWorkerCollection(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterWorkerCollection(value, nextLink.Value); + return new RouterWorkerCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + RouterWorkerCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterWorkerCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterWorkerCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterWorkerCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterWorkerCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterWorkerCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterWorkerCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs index e2c66e639b38..a79381b59406 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// A paged collection of workers. internal partial class RouterWorkerCollection { - /// Initializes a new instance of RouterWorkerCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal RouterWorkerCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal RouterWorkerCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RouterWorkerCollection. + /// Initializes a new instance of . /// /// - internal RouterWorkerCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RouterWorkerCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterWorkerCollection() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs index 2cb770535513..625036e54c40 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class RouterWorkerItem + public partial class RouterWorkerItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Worker)) + { + writer.WritePropertyName("worker"u8); + if (Worker is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Worker).Serialize(writer, options); + } + } + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(_etag); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional worker = default; Optional etag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("worker"u8)) @@ -36,8 +82,61 @@ internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element etag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RouterWorkerItem(worker.Value, etag.Value); + return new RouterWorkerItem(worker.Value, etag.Value, serializedAdditionalRawData); + } + + RouterWorkerItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterWorkerItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterWorkerItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterWorkerItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterWorkerItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterWorkerItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterWorkerItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs index 4dcce17c844b..d86d4e1750e7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter.Models { /// Paged instance of RouterWorker. public partial class RouterWorkerItem { - /// Initializes a new instance of RouterWorkerItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RouterWorkerItem() { } - /// Initializes a new instance of RouterWorkerItem. + /// Initializes a new instance of . /// An entity for jobs to be routed to. /// (Optional) The Concurrency Token. - internal RouterWorkerItem(RouterWorker worker, string etag) + /// Keeps track of any properties unknown to the library. + internal RouterWorkerItem(RouterWorker worker, string etag, Dictionary serializedAdditionalRawData) { Worker = worker; _etag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An entity for jobs to be routed to. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs index e9325552eff8..c6621b3f065d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class RouterWorkerSelector : IUtf8JsonSerializable + public partial class RouterWorkerSelector : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expedite"u8); writer.WriteBooleanValue(Expedite.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement element) + internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +73,7 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement Optional expedite = default; Optional status = default; Optional expiresAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -109,8 +131,61 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement expiresAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RouterWorkerSelector(key, labelOperator, value.Value, Optional.ToNullable(expiresAfterSeconds), Optional.ToNullable(expedite), Optional.ToNullable(status), Optional.ToNullable(expiresAt), serializedAdditionalRawData); + } + + RouterWorkerSelector IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRouterWorkerSelector(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterWorkerSelector IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterWorkerSelector(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RouterWorkerSelector model) + { + if (model is null) + { + return null; } - return new RouterWorkerSelector(key, labelOperator, value.Value, Optional.ToNullable(expiresAfterSeconds), Optional.ToNullable(expedite), Optional.ToNullable(status), Optional.ToNullable(expiresAt)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RouterWorkerSelector(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRouterWorkerSelector(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs index 05552a8b8051..b0fd20014fcb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.JobRouter.Models; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.JobRouter /// Describes a condition that must be met against a set of labels for worker selection. public partial class RouterWorkerSelector { - /// Initializes a new instance of RouterWorkerSelector. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The label key to query against. /// Describes how the value of the label is compared to the value defined on the label selector. /// The value to compare against the actual label value with the given operator. @@ -22,7 +26,8 @@ public partial class RouterWorkerSelector /// Pushes the job to the front of the queue as long as this selector is active. /// The status of the worker selector. /// The time at which this worker selector expires in UTC. - internal RouterWorkerSelector(string key, LabelOperator labelOperator, object value, double? expiresAfterSeconds, bool? expedite, RouterWorkerSelectorStatus? status, DateTimeOffset? expiresAt) + /// Keeps track of any properties unknown to the library. + internal RouterWorkerSelector(string key, LabelOperator labelOperator, object value, double? expiresAfterSeconds, bool? expedite, RouterWorkerSelectorStatus? status, DateTimeOffset? expiresAt, Dictionary serializedAdditionalRawData) { Key = key; LabelOperator = labelOperator; @@ -31,6 +36,12 @@ internal RouterWorkerSelector(string key, LabelOperator labelOperator, object va Expedite = expedite; Status = status; ExpiresAt = expiresAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RouterWorkerSelector() + { } /// The label key to query against. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs index 714d96bd0e8d..9de611f4a8e6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class RuleEngineQueueSelectorAttachment : IUtf8JsonSerializable + public partial class RuleEngineQueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("rule"u8); - writer.WriteObjectValue(Rule); + if (Rule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Rule).Serialize(writer, options); + } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSelectorAttachment(JsonElement element) + internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RouterRule rule = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rule"u8)) @@ -42,8 +72,61 @@ internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSele kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RuleEngineQueueSelectorAttachment(kind, rule, serializedAdditionalRawData); + } + + RuleEngineQueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRuleEngineQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RuleEngineQueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRuleEngineQueueSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RuleEngineQueueSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RuleEngineQueueSelectorAttachment(Response response) + { + if (response is null) + { + return null; } - return new RuleEngineQueueSelectorAttachment(kind, rule); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRuleEngineQueueSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs index fac53692e8a6..b941fbcfd061 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Attaches queue selectors to a job when the RouterRule is resolved. public partial class RuleEngineQueueSelectorAttachment : QueueSelectorAttachment { - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// Initializes a new instance of . /// /// A rule of one of the following types: /// @@ -34,7 +35,7 @@ public RuleEngineQueueSelectorAttachment(RouterRule rule) Kind = "rule-engine"; } - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. /// /// A rule of one of the following types: @@ -47,12 +48,18 @@ public RuleEngineQueueSelectorAttachment(RouterRule rule) /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// - internal RuleEngineQueueSelectorAttachment(string kind, RouterRule rule) : base(kind) + /// Keeps track of any properties unknown to the library. + internal RuleEngineQueueSelectorAttachment(string kind, RouterRule rule, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Rule = rule; Kind = kind ?? "rule-engine"; } + /// Initializes a new instance of for deserialization. + internal RuleEngineQueueSelectorAttachment() + { + } + /// /// A rule of one of the following types: /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs index 0b2db2ff0c89..619c2ef2b4d7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class RuleEngineWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class RuleEngineWorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("rule"u8); - writer.WriteObjectValue(Rule); + if (Rule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Rule).Serialize(writer, options); + } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSelectorAttachment(JsonElement element) + internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RouterRule rule = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rule"u8)) @@ -42,8 +72,61 @@ internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSe kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RuleEngineWorkerSelectorAttachment(kind, rule, serializedAdditionalRawData); + } + + RuleEngineWorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRuleEngineWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RuleEngineWorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRuleEngineWorkerSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RuleEngineWorkerSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RuleEngineWorkerSelectorAttachment(Response response) + { + if (response is null) + { + return null; } - return new RuleEngineWorkerSelectorAttachment(kind, rule); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRuleEngineWorkerSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs index f7d17afe7719..2d523ab2f4f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Attaches worker selectors to a job when a RouterRule is resolved. public partial class RuleEngineWorkerSelectorAttachment : WorkerSelectorAttachment { - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// Initializes a new instance of . /// /// A rule of one of the following types: /// @@ -34,7 +35,7 @@ public RuleEngineWorkerSelectorAttachment(RouterRule rule) Kind = "rule-engine"; } - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. /// /// A rule of one of the following types: @@ -47,12 +48,18 @@ public RuleEngineWorkerSelectorAttachment(RouterRule rule) /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// - internal RuleEngineWorkerSelectorAttachment(string kind, RouterRule rule) : base(kind) + /// Keeps track of any properties unknown to the library. + internal RuleEngineWorkerSelectorAttachment(string kind, RouterRule rule, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Rule = rule; Kind = kind ?? "rule-engine"; } + /// Initializes a new instance of for deserialization. + internal RuleEngineWorkerSelectorAttachment() + { + } + /// /// A rule of one of the following types: /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs index 96abdd31f9f3..4b9b4bcd5a80 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class ScheduleAndSuspendMode : IUtf8JsonSerializable + public partial class ScheduleAndSuspendMode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ScheduleAt)) { writer.WritePropertyName("scheduleAt"u8); writer.WriteStringValue(ScheduleAt, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScheduleAndSuspendMode DeserializeScheduleAndSuspendMode(JsonElement element) + internal static ScheduleAndSuspendMode DeserializeScheduleAndSuspendMode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional scheduleAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scheduleAt"u8)) @@ -42,8 +64,61 @@ internal static ScheduleAndSuspendMode DeserializeScheduleAndSuspendMode(JsonEle scheduleAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScheduleAndSuspendMode(scheduleAt, serializedAdditionalRawData); + } + + ScheduleAndSuspendMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleAndSuspendMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduleAndSuspendMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduleAndSuspendMode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduleAndSuspendMode model) + { + if (model is null) + { + return null; } - return new ScheduleAndSuspendMode(scheduleAt); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduleAndSuspendMode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduleAndSuspendMode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs index b4ab199fe3a0..4f42cac58350 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs @@ -6,11 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.JobRouter { /// The ScheduleAndSuspendMode. public partial class ScheduleAndSuspendMode { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal ScheduleAndSuspendMode(DateTimeOffset scheduleAt, Dictionary serializedAdditionalRawData) + { + ScheduleAt = scheduleAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs index 02012cc87f00..69c044c1d62d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.JobRouter; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class ScoringRuleOptions : IUtf8JsonSerializable + public partial class ScoringRuleOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BatchSize)) { @@ -42,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("descendingOrder"u8); writer.WriteBooleanValue(DescendingOrder.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement element) + internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele Optional> scoringParameters = default; Optional allowScoringBatchOfWorkers = default; Optional descendingOrder = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("batchSize"u8)) @@ -98,8 +120,61 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele descendingOrder = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScoringRuleOptions(Optional.ToNullable(batchSize), Optional.ToList(scoringParameters), Optional.ToNullable(allowScoringBatchOfWorkers), Optional.ToNullable(descendingOrder), serializedAdditionalRawData); + } + + ScoringRuleOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScoringRuleOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScoringRuleOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScoringRuleOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScoringRuleOptions model) + { + if (model is null) + { + return null; } - return new ScoringRuleOptions(Optional.ToNullable(batchSize), Optional.ToList(scoringParameters), Optional.ToNullable(allowScoringBatchOfWorkers), Optional.ToNullable(descendingOrder)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScoringRuleOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScoringRuleOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs index e92ce48766ad..07244d100dd1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.JobRouter; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.Communication.JobRouter.Models /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. public partial class ScoringRuleOptions { - /// Initializes a new instance of ScoringRuleOptions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. Defaults to 20 if not configured. /// /// (Optional) List of extra parameters from the job that will be sent as part of the payload to scoring rule. @@ -32,12 +36,14 @@ public partial class ScoringRuleOptions /// (Optional) /// If false, will sort scores by ascending order. By default, set to true. /// - internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? allowScoringBatchOfWorkers, bool? descendingOrder) + /// Keeps track of any properties unknown to the library. + internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? allowScoringBatchOfWorkers, bool? descendingOrder, Dictionary serializedAdditionalRawData) { BatchSize = batchSize; ScoringParameters = scoringParameters; AllowScoringBatchOfWorkers = allowScoringBatchOfWorkers; DescendingOrder = descendingOrder; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. Defaults to 20 if not configured. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs index 08c2ea517a42..04f6280ac2e6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class StaticQueueSelectorAttachment : IUtf8JsonSerializable + public partial class StaticQueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("queueSelector"u8); - writer.WriteObjectValue(QueueSelector); + if (QueueSelector is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)QueueSelector).Serialize(writer, options); + } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAttachment(JsonElement element) + internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RouterQueueSelector queueSelector = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queueSelector"u8)) @@ -42,8 +72,61 @@ internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAtta kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StaticQueueSelectorAttachment(kind, queueSelector, serializedAdditionalRawData); + } + + StaticQueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStaticQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StaticQueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStaticQueueSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StaticQueueSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StaticQueueSelectorAttachment(Response response) + { + if (response is null) + { + return null; } - return new StaticQueueSelectorAttachment(kind, queueSelector); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStaticQueueSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs index 278e5cc7c70d..218f2bb5e64b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Describes a queue selector that will be attached to the job. public partial class StaticQueueSelectorAttachment : QueueSelectorAttachment { - /// Initializes a new instance of StaticQueueSelectorAttachment. + /// Initializes a new instance of . /// Describes a condition that must be met against a set of labels for queue selection. /// is null. public StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) @@ -24,15 +25,21 @@ public StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) Kind = "static"; } - /// Initializes a new instance of StaticQueueSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. /// Describes a condition that must be met against a set of labels for queue selection. - internal StaticQueueSelectorAttachment(string kind, RouterQueueSelector queueSelector) : base(kind) + /// Keeps track of any properties unknown to the library. + internal StaticQueueSelectorAttachment(string kind, RouterQueueSelector queueSelector, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { QueueSelector = queueSelector; Kind = kind ?? "static"; } + /// Initializes a new instance of for deserialization. + internal StaticQueueSelectorAttachment() + { + } + /// Describes a condition that must be met against a set of labels for queue selection. public RouterQueueSelector QueueSelector { get; set; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs index cea28aad59aa..853e64edef41 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class StaticRouterRule : IUtf8JsonSerializable + public partial class StaticRouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(_value)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element) + internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -49,8 +72,61 @@ internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StaticRouterRule(kind, value.Value, serializedAdditionalRawData); + } + + StaticRouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStaticRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StaticRouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStaticRouterRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StaticRouterRule model) + { + if (model is null) + { + return null; } - return new StaticRouterRule(kind, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StaticRouterRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStaticRouterRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs index d5ad0339475d..9a50f4330cab 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs @@ -5,15 +5,19 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// A rule providing static rules that always return the same result, regardless of input. public partial class StaticRouterRule : RouterRule { - /// Initializes a new instance of StaticRouterRule. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. /// The static value this rule always returns. - internal StaticRouterRule(string kind, object value) : base(kind) + /// Keeps track of any properties unknown to the library. + internal StaticRouterRule(string kind, object value, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { _value = value; Kind = kind ?? "static-rule"; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs index 3d43861eae32..8b1ff801a710 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class StaticWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class StaticWorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("workerSelector"u8); - writer.WriteObjectValue(WorkerSelector); + if (WorkerSelector is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WorkerSelector).Serialize(writer, options); + } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAttachment(JsonElement element) + internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } RouterWorkerSelector workerSelector = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("workerSelector"u8)) @@ -42,8 +72,61 @@ internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAt kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StaticWorkerSelectorAttachment(kind, workerSelector, serializedAdditionalRawData); + } + + StaticWorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStaticWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StaticWorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStaticWorkerSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StaticWorkerSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StaticWorkerSelectorAttachment(Response response) + { + if (response is null) + { + return null; } - return new StaticWorkerSelectorAttachment(kind, workerSelector); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStaticWorkerSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs index e82a89e46132..4f0bf7b4a928 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +14,7 @@ namespace Azure.Communication.JobRouter /// Describes a worker selector that will be attached to the job. public partial class StaticWorkerSelectorAttachment : WorkerSelectorAttachment { - /// Initializes a new instance of StaticWorkerSelectorAttachment. + /// Initializes a new instance of . /// Describes a condition that must be met against a set of labels for worker selection. /// is null. public StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) @@ -24,15 +25,21 @@ public StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) Kind = "static"; } - /// Initializes a new instance of StaticWorkerSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. /// Describes a condition that must be met against a set of labels for worker selection. - internal StaticWorkerSelectorAttachment(string kind, RouterWorkerSelector workerSelector) : base(kind) + /// Keeps track of any properties unknown to the library. + internal StaticWorkerSelectorAttachment(string kind, RouterWorkerSelector workerSelector, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { WorkerSelector = workerSelector; Kind = kind ?? "static"; } + /// Initializes a new instance of for deserialization. + internal StaticWorkerSelectorAttachment() + { + } + /// Describes a condition that must be met against a set of labels for worker selection. public RouterWorkerSelector WorkerSelector { get; set; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs index 83225de58018..e3fa29b9a43d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnassignJobRequest : IUtf8JsonSerializable + internal partial class UnassignJobRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SuspendMatching)) { writer.WritePropertyName("suspendMatching"u8); writer.WriteBooleanValue(SuspendMatching.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UnassignJobRequest DeserializeUnassignJobRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional suspendMatching = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("suspendMatching"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + suspendMatching = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnassignJobRequest(Optional.ToNullable(suspendMatching), serializedAdditionalRawData); + } + + UnassignJobRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnassignJobRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnassignJobRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnassignJobRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnassignJobRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnassignJobRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnassignJobRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs index 5d16a85f8c18..4c10682950c4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Request payload for unassigning a job. internal partial class UnassignJobRequest { - /// Initializes a new instance of UnassignJobRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UnassignJobRequest() { } + /// Initializes a new instance of . + /// If WaitForActivation is true, then the job is not queued for re-matching with a worker. + /// Keeps track of any properties unknown to the library. + internal UnassignJobRequest(bool? suspendMatching, Dictionary serializedAdditionalRawData) + { + SuspendMatching = suspendMatching; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// If WaitForActivation is true, then the job is not queued for re-matching with a worker. public bool? SuspendMatching { get; set; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs index 7c56e903fee2..57ac4839c6d7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter.Models { - public partial class UnassignJobResult + public partial class UnassignJobResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnassignJobResult DeserializeUnassignJobResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + writer.WritePropertyName("unassignmentCount"u8); + writer.WriteNumberValue(UnassignmentCount); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnassignJobResult DeserializeUnassignJobResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string jobId = default; int unassignmentCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobId"u8)) @@ -32,8 +65,61 @@ internal static UnassignJobResult DeserializeUnassignJobResult(JsonElement eleme unassignmentCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UnassignJobResult(jobId, unassignmentCount); + return new UnassignJobResult(jobId, unassignmentCount, serializedAdditionalRawData); + } + + UnassignJobResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnassignJobResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnassignJobResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnassignJobResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnassignJobResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnassignJobResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnassignJobResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs index d0665686417a..01cab4b5064b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.JobRouter.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.JobRouter.Models /// Response payload after a job has been successfully unassigned. public partial class UnassignJobResult { - /// Initializes a new instance of UnassignJobResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the job unassigned. /// The number of times a job is unassigned. At a maximum 3. /// is null. @@ -25,6 +29,22 @@ internal UnassignJobResult(string jobId, int unassignmentCount) UnassignmentCount = unassignmentCount; } + /// Initializes a new instance of . + /// The Id of the job unassigned. + /// The number of times a job is unassigned. At a maximum 3. + /// Keeps track of any properties unknown to the library. + internal UnassignJobResult(string jobId, int unassignmentCount, Dictionary serializedAdditionalRawData) + { + JobId = jobId; + UnassignmentCount = unassignmentCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UnassignJobResult() + { + } + /// The Id of the job unassigned. public string JobId { get; } /// The number of times a job is unassigned. At a maximum 3. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs index 93c905cd442f..5c401dbf76cb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnknownDistributionMode : IUtf8JsonSerializable + internal partial class UnknownDistributionMode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); @@ -32,55 +38,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassSelectors"u8); writer.WriteBooleanValue(BypassSelectors.Value); } - writer.WriteEndObject(); - } - - internal static UnknownDistributionMode DeserializeUnknownDistributionMode(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string kind = "Unknown"; - Optional minConcurrentOffers = default; - Optional maxConcurrentOffers = default; - Optional bypassSelectors = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); - continue; - } - if (property.NameEquals("minConcurrentOffers"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minConcurrentOffers = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("maxConcurrentOffers"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxConcurrentOffers = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("bypassSelectors"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bypassSelectors = property.Value.GetBoolean(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); + writer.WriteEndObject(); + } + + internal static DistributionMode DeserializeUnknownDistributionMode(JsonElement element, ModelSerializerOptions options = default) => DeserializeDistributionMode(element, options); + + DistributionMode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownDistributionMode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DistributionMode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDistributionMode(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs index d981b091109f..bf0bd3ed249a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs @@ -5,12 +5,15 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The UnknownDistributionMode. internal partial class UnknownDistributionMode : DistributionMode { - /// Initializes a new instance of UnknownDistributionMode. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Mode. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. @@ -21,9 +24,15 @@ internal partial class UnknownDistributionMode : DistributionMode /// variable to true. This flag is intended more for temporary usage. /// By default, set to false. /// - internal UnknownDistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// Keeps track of any properties unknown to the library. + internal UnknownDistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, Dictionary serializedAdditionalRawData) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors, serializedAdditionalRawData) { Kind = kind ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownDistributionMode() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs index 1cd0e49c19ef..237543efe583 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnknownExceptionAction : IUtf8JsonSerializable + internal partial class UnknownExceptionAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - - internal static UnknownExceptionAction DeserializeUnknownExceptionAction(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string kind = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) + foreach (var property in _serializedAdditionalRawData) { - kind = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownExceptionAction(kind); + writer.WriteEndObject(); + } + + internal static ExceptionAction DeserializeUnknownExceptionAction(JsonElement element, ModelSerializerOptions options = default) => DeserializeExceptionAction(element, options); + + ExceptionAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownExceptionAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionAction(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs index 087f6eb8b9ec..3064c8c07964 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The UnknownExceptionAction. internal partial class UnknownExceptionAction : ExceptionAction { - /// Initializes a new instance of UnknownExceptionAction. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionAction. - internal UnknownExceptionAction(string kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal UnknownExceptionAction(string kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownExceptionAction() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs index 4298ee82cfc5..bc15f64c39d0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnknownExceptionTrigger : IUtf8JsonSerializable + internal partial class UnknownExceptionTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - - internal static UnknownExceptionTrigger DeserializeUnknownExceptionTrigger(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string kind = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) + foreach (var property in _serializedAdditionalRawData) { - kind = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownExceptionTrigger(kind); + writer.WriteEndObject(); + } + + internal static ExceptionTrigger DeserializeUnknownExceptionTrigger(JsonElement element, ModelSerializerOptions options = default) => DeserializeExceptionTrigger(element, options); + + ExceptionTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownExceptionTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExceptionTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExceptionTrigger(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs index 9640b811683f..c0dc0035ebb9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The UnknownExceptionTrigger. internal partial class UnknownExceptionTrigger : ExceptionTrigger { - /// Initializes a new instance of UnknownExceptionTrigger. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionTrigger. - internal UnknownExceptionTrigger(string kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal UnknownExceptionTrigger(string kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownExceptionTrigger() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs index 6ee8c8edd9fd..6f87678528f1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnknownQueueSelectorAttachment : IUtf8JsonSerializable + internal partial class UnknownQueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - - internal static UnknownQueueSelectorAttachment DeserializeUnknownQueueSelectorAttachment(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string kind = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) + foreach (var property in _serializedAdditionalRawData) { - kind = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownQueueSelectorAttachment(kind); + writer.WriteEndObject(); + } + + internal static QueueSelectorAttachment DeserializeUnknownQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) => DeserializeQueueSelectorAttachment(element, options); + + QueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueueSelectorAttachment(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs index f2b29cc725df..90e047812182 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The UnknownQueueSelectorAttachment. internal partial class UnknownQueueSelectorAttachment : QueueSelectorAttachment { - /// Initializes a new instance of UnknownQueueSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. - internal UnknownQueueSelectorAttachment(string kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal UnknownQueueSelectorAttachment(string kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownQueueSelectorAttachment() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs index 4ba98c5546c9..794cbd509d52 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnknownRouterRule : IUtf8JsonSerializable + internal partial class UnknownRouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - - internal static UnknownRouterRule DeserializeUnknownRouterRule(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string kind = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) + foreach (var property in _serializedAdditionalRawData) { - kind = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownRouterRule(kind); + writer.WriteEndObject(); + } + + internal static RouterRule DeserializeUnknownRouterRule(JsonElement element, ModelSerializerOptions options = default) => DeserializeRouterRule(element, options); + + RouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRouterRule(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs index 7800194d4c9c..4a8f54377377 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The UnknownRouterRule. internal partial class UnknownRouterRule : RouterRule { - /// Initializes a new instance of UnknownRouterRule. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. - internal UnknownRouterRule(string kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal UnknownRouterRule(string kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownRouterRule() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs index 85bf372c8d2c..daa5a60d36c0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - internal partial class UnknownWorkerSelectorAttachment : IUtf8JsonSerializable + internal partial class UnknownWorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - - internal static UnknownWorkerSelectorAttachment DeserializeUnknownWorkerSelectorAttachment(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - string kind = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) + foreach (var property in _serializedAdditionalRawData) { - kind = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownWorkerSelectorAttachment(kind); + writer.WriteEndObject(); + } + + internal static WorkerSelectorAttachment DeserializeUnknownWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) => DeserializeWorkerSelectorAttachment(element, options); + + WorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkerSelectorAttachment(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs index cd671a758fab..9743d8faf56d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// The UnknownWorkerSelectorAttachment. internal partial class UnknownWorkerSelectorAttachment : WorkerSelectorAttachment { - /// Initializes a new instance of UnknownWorkerSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. - internal UnknownWorkerSelectorAttachment(string kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal UnknownWorkerSelectorAttachment(string kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownWorkerSelectorAttachment() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs index 0cfa0a7227ed..702e980414ba 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class WaitTimeExceptionTrigger : IUtf8JsonSerializable + public partial class WaitTimeExceptionTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("thresholdSeconds"u8); writer.WriteNumberValue(_thresholdSeconds); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(JsonElement element) + internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } double thresholdSeconds = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("thresholdSeconds"u8)) @@ -42,8 +65,61 @@ internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(Jso kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WaitTimeExceptionTrigger(kind, thresholdSeconds, serializedAdditionalRawData); + } + + WaitTimeExceptionTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWaitTimeExceptionTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WaitTimeExceptionTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWaitTimeExceptionTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WaitTimeExceptionTrigger model) + { + if (model is null) + { + return null; } - return new WaitTimeExceptionTrigger(kind, thresholdSeconds); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WaitTimeExceptionTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWaitTimeExceptionTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs index 8442b67c6755..17dec02a6b80 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs @@ -5,18 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.JobRouter { /// Trigger for an exception action on exceeding wait time. public partial class WaitTimeExceptionTrigger : ExceptionTrigger { - /// Initializes a new instance of WaitTimeExceptionTrigger. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of ExceptionTrigger. /// Threshold for wait time for this trigger. - internal WaitTimeExceptionTrigger(string kind, double thresholdSeconds) : base(kind) + /// Keeps track of any properties unknown to the library. + internal WaitTimeExceptionTrigger(string kind, double thresholdSeconds, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { _thresholdSeconds = thresholdSeconds; Kind = kind ?? "wait-time"; } + + /// Initializes a new instance of for deserialization. + internal WaitTimeExceptionTrigger() + { + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs index 752d885c8323..debe822585d4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class WebhookRouterRule : IUtf8JsonSerializable + public partial class WebhookRouterRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AuthorizationServerUri)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ClientCredential)) { writer.WritePropertyName("clientCredential"u8); - writer.WriteObjectValue(ClientCredential); + if (ClientCredential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientCredential).Serialize(writer, options); + } } if (Optional.IsDefined(WebhookUri)) { @@ -33,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement element) + internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +74,7 @@ internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement eleme Optional clientCredential = default; Optional webhookUri = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authorizationServerUri"u8)) @@ -80,8 +109,61 @@ internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement eleme kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WebhookRouterRule(kind, authorizationServerUri.Value, clientCredential.Value, webhookUri.Value, serializedAdditionalRawData); + } + + WebhookRouterRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWebhookRouterRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WebhookRouterRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWebhookRouterRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WebhookRouterRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WebhookRouterRule(Response response) + { + if (response is null) + { + return null; } - return new WebhookRouterRule(kind, authorizationServerUri.Value, clientCredential.Value, webhookUri.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWebhookRouterRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs index 1a187ccf2eaa..b9b624b54547 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs @@ -6,19 +6,20 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.JobRouter { /// A rule providing a binding to an external web server. public partial class WebhookRouterRule : RouterRule { - /// Initializes a new instance of WebhookRouterRule. + /// Initializes a new instance of . public WebhookRouterRule() { Kind = "webhook-rule"; } - /// Initializes a new instance of WebhookRouterRule. + /// Initializes a new instance of . /// The type discriminator describing a sub-type of Rule. /// Uri for Authorization Server. /// @@ -26,7 +27,8 @@ public WebhookRouterRule() /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// /// Uri for Contoso's Web Server. - internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri) : base(kind) + /// Keeps track of any properties unknown to the library. + internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { AuthorizationServerUri = authorizationServerUri; ClientCredential = clientCredential; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs index 5fca27cd4c56..1087bd393821 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs @@ -5,37 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class WeightedAllocationQueueSelectorAttachment : IUtf8JsonSerializable + public partial class WeightedAllocationQueueSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("allocations"u8); writer.WriteStartArray(); foreach (var item in Allocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAllocationQueueSelectorAttachment(JsonElement element) + internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAllocationQueueSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList allocations = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allocations"u8)) @@ -53,8 +82,61 @@ internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAll kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WeightedAllocationQueueSelectorAttachment(kind, allocations, serializedAdditionalRawData); + } + + WeightedAllocationQueueSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWeightedAllocationQueueSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WeightedAllocationQueueSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWeightedAllocationQueueSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WeightedAllocationQueueSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WeightedAllocationQueueSelectorAttachment(Response response) + { + if (response is null) + { + return null; } - return new WeightedAllocationQueueSelectorAttachment(kind, allocations); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWeightedAllocationQueueSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs index 6f943be27048..516ee7f26c03 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs @@ -15,7 +15,7 @@ namespace Azure.Communication.JobRouter /// Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting. public partial class WeightedAllocationQueueSelectorAttachment : QueueSelectorAttachment { - /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. + /// Initializes a new instance of . /// A collection of percentage based weighted allocations. /// is null. public WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) @@ -26,15 +26,21 @@ public WeightedAllocationQueueSelectorAttachment(IEnumerable Initializes a new instance of WeightedAllocationQueueSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of queue selector attachment. /// A collection of percentage based weighted allocations. - internal WeightedAllocationQueueSelectorAttachment(string kind, IList allocations) : base(kind) + /// Keeps track of any properties unknown to the library. + internal WeightedAllocationQueueSelectorAttachment(string kind, IList allocations, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Allocations = allocations; Kind = kind ?? "weighted-allocation-queue-selector"; } + /// Initializes a new instance of for deserialization. + internal WeightedAllocationQueueSelectorAttachment() + { + } + /// A collection of percentage based weighted allocations. public IList Allocations { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs index f6850f96f9dd..2bf79bdb6061 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs @@ -5,37 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class WeightedAllocationWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class WeightedAllocationWorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("allocations"u8); writer.WriteStartArray(); foreach (var item in Allocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAllocationWorkerSelectorAttachment(JsonElement element) + internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAllocationWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList allocations = default; string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allocations"u8)) @@ -53,8 +82,61 @@ internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAl kind = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WeightedAllocationWorkerSelectorAttachment(kind, allocations, serializedAdditionalRawData); + } + + WeightedAllocationWorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWeightedAllocationWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WeightedAllocationWorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWeightedAllocationWorkerSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WeightedAllocationWorkerSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WeightedAllocationWorkerSelectorAttachment(Response response) + { + if (response is null) + { + return null; } - return new WeightedAllocationWorkerSelectorAttachment(kind, allocations); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWeightedAllocationWorkerSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs index ffc4e566a9ca..b48cede5eb0e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs @@ -15,7 +15,7 @@ namespace Azure.Communication.JobRouter /// Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting. public partial class WeightedAllocationWorkerSelectorAttachment : WorkerSelectorAttachment { - /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. + /// Initializes a new instance of . /// A collection of percentage based weighted allocations. /// is null. public WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) @@ -26,15 +26,21 @@ public WeightedAllocationWorkerSelectorAttachment(IEnumerable Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. /// A collection of percentage based weighted allocations. - internal WeightedAllocationWorkerSelectorAttachment(string kind, IList allocations) : base(kind) + /// Keeps track of any properties unknown to the library. + internal WeightedAllocationWorkerSelectorAttachment(string kind, IList allocations, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Allocations = allocations; Kind = kind ?? "weighted-allocation-worker-selector"; } + /// Initializes a new instance of for deserialization. + internal WeightedAllocationWorkerSelectorAttachment() + { + } + /// A collection of percentage based weighted allocations. public IList Allocations { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs index 5cb29f56a143..01753938a1af 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class WorkerSelectorAttachment : IUtf8JsonSerializable + public partial class WorkerSelectorAttachment : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(JsonElement element) + internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,7 +59,72 @@ internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(Jso case "weighted-allocation-worker-selector": return WeightedAllocationWorkerSelectorAttachment.DeserializeWeightedAllocationWorkerSelectorAttachment(element); } } - return UnknownWorkerSelectorAttachment.DeserializeUnknownWorkerSelectorAttachment(element); + + // Unknown type found so we will deserialize the base properties only + string kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownWorkerSelectorAttachment(kind, serializedAdditionalRawData); + } + + WorkerSelectorAttachment IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkerSelectorAttachment(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkerSelectorAttachment IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkerSelectorAttachment(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkerSelectorAttachment model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkerSelectorAttachment(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkerSelectorAttachment(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs index 9562cc3084fb..2a77ffbf6edb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.Communication.JobRouter { /// @@ -12,13 +16,19 @@ namespace Azure.Communication.JobRouter /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// + [DeserializationProxy(typeof(UnknownWorkerSelectorAttachment))] public abstract partial class WorkerSelectorAttachment { - /// Initializes a new instance of WorkerSelectorAttachment. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type discriminator describing the type of worker selector attachment. - internal WorkerSelectorAttachment(string kind) + /// Keeps track of any properties unknown to the library. + internal WorkerSelectorAttachment(string kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs index 640d4310c86e..6b46a4371665 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { - public partial class WorkerWeightedAllocation : IUtf8JsonSerializable + public partial class WorkerWeightedAllocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("weight"u8); writer.WriteNumberValue(Weight); @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in WorkerSelectors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(JsonElement element) + internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } double weight = default; IList workerSelectors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weight"u8)) @@ -53,8 +82,61 @@ internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(Jso workerSelectors = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WorkerWeightedAllocation(weight, workerSelectors, serializedAdditionalRawData); + } + + WorkerWeightedAllocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkerWeightedAllocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkerWeightedAllocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkerWeightedAllocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkerWeightedAllocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkerWeightedAllocation(Response response) + { + if (response is null) + { + return null; } - return new WorkerWeightedAllocation(weight, workerSelectors); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkerWeightedAllocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs index 6ca21f045df6..4026bf8517f0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.JobRouter /// Contains the weight percentage and worker selectors to be applied if selected for weighted distributions. public partial class WorkerWeightedAllocation { - /// Initializes a new instance of WorkerWeightedAllocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The percentage of this weight, expressed as a fraction of 1. /// A collection of worker selectors that will be applied if this allocation is selected. /// is null. @@ -27,13 +30,20 @@ public WorkerWeightedAllocation(double weight, IEnumerable WorkerSelectors = workerSelectors.ToList(); } - /// Initializes a new instance of WorkerWeightedAllocation. + /// Initializes a new instance of . /// The percentage of this weight, expressed as a fraction of 1. /// A collection of worker selectors that will be applied if this allocation is selected. - internal WorkerWeightedAllocation(double weight, IList workerSelectors) + /// Keeps track of any properties unknown to the library. + internal WorkerWeightedAllocation(double weight, IList workerSelectors, Dictionary serializedAdditionalRawData) { Weight = weight; WorkerSelectors = workerSelectors; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkerWeightedAllocation() + { } /// The percentage of this weight, expressed as a fraction of 1. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/MediaCompositionRestClient.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/MediaCompositionRestClient.cs index a2b5f231aa8c..d3bf7c023c6e 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/MediaCompositionRestClient.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/MediaCompositionRestClient.cs @@ -143,9 +143,7 @@ internal HttpMessage CreateCreateRequest(string mediaCompositionId, string id, M } } var model = mediaComposition; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -247,9 +245,7 @@ internal HttpMessage CreateUpdateRequest(string mediaCompositionId, string id, M } } var model = mediaComposition; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.Serialization.cs index a3dfe10e1035..ee62575821f2 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class ActivePresenter : IUtf8JsonSerializable + public partial class ActivePresenter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("call"u8); writer.WriteStringValue(Call); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ActivePresenter DeserializeActivePresenter(JsonElement element) + internal static ActivePresenter DeserializeActivePresenter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ActivePresenter DeserializeActivePresenter(JsonElement element) string call = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("call"u8)) @@ -53,8 +76,61 @@ internal static ActivePresenter DeserializeActivePresenter(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ActivePresenter(kind, placeholderImageUri.Value, call, serializedAdditionalRawData); + } + + ActivePresenter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeActivePresenter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ActivePresenter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeActivePresenter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ActivePresenter model) + { + if (model is null) + { + return null; } - return new ActivePresenter(kind, placeholderImageUri.Value, call); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ActivePresenter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeActivePresenter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.cs index 223c877cfe07..734e5b02faa8 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ActivePresenter.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// The ActivePresenter. public partial class ActivePresenter : MediaInput { - /// Initializes a new instance of ActivePresenter. + /// Initializes a new instance of . /// The id of the teams meeting or call. /// is null. public ActivePresenter(string call) @@ -25,16 +26,22 @@ public ActivePresenter(string call) Kind = MediaInputType.ActivePresenter; } - /// Initializes a new instance of ActivePresenter. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// The id of the teams meeting or call. - internal ActivePresenter(MediaInputType kind, string placeholderImageUri, string call) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal ActivePresenter(MediaInputType kind, string placeholderImageUri, string call, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Call = call; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal ActivePresenter() + { + } + /// The id of the teams meeting or call. public string Call { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.Serialization.cs index b3243a1e8504..6476caa5e554 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class AutoGridInputGroup : IUtf8JsonSerializable + public partial class AutoGridInputGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("inputIds"u8); writer.WriteStartArray(); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Position)) { writer.WritePropertyName("position"u8); - writer.WriteObjectValue(Position); + if (Position is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Position).Serialize(writer, options); + } } if (Optional.IsDefined(Width)) { @@ -51,11 +65,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutoGridInputGroup DeserializeAutoGridInputGroup(JsonElement element) + internal static AutoGridInputGroup DeserializeAutoGridInputGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +95,7 @@ internal static AutoGridInputGroup DeserializeAutoGridInputGroup(JsonElement ele Optional height = default; Optional layer = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inputIds"u8)) @@ -117,8 +146,61 @@ internal static AutoGridInputGroup DeserializeAutoGridInputGroup(JsonElement ele scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutoGridInputGroup(kind, position.Value, width.Value, height.Value, layer.Value, Optional.ToNullable(scalingMode), inputIds, serializedAdditionalRawData); + } + + AutoGridInputGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutoGridInputGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutoGridInputGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutoGridInputGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutoGridInputGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutoGridInputGroup(Response response) + { + if (response is null) + { + return null; } - return new AutoGridInputGroup(kind, position.Value, width.Value, height.Value, layer.Value, Optional.ToNullable(scalingMode), inputIds); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutoGridInputGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.cs index c90af668b67e..611f8226824b 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridInputGroup.cs @@ -16,7 +16,7 @@ namespace Azure.Communication.MediaComposition /// The AutoGridInputGroup. public partial class AutoGridInputGroup : InputGroup { - /// Initializes a new instance of AutoGridInputGroup. + /// Initializes a new instance of . /// Input and input group ids to be included in this input group. /// is null. public AutoGridInputGroup(IEnumerable inputIds) @@ -27,7 +27,7 @@ public AutoGridInputGroup(IEnumerable inputIds) Kind = InputGroupType.AutoGridBased; } - /// Initializes a new instance of AutoGridInputGroup. + /// Initializes a new instance of . /// Kind of input group. /// The (x,y) position on scene or input group. /// The width of the input group container. Can be defined as pixels or percentage. @@ -35,12 +35,18 @@ public AutoGridInputGroup(IEnumerable inputIds) /// The layer this input group should appear on. /// The scaling mode for the view of a video stream in a cell. /// Input and input group ids to be included in this input group. - internal AutoGridInputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode, IList inputIds) : base(kind, position, width, height, layer, scalingMode) + /// Keeps track of any properties unknown to the library. + internal AutoGridInputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode, IList inputIds, Dictionary serializedAdditionalRawData) : base(kind, position, width, height, layer, scalingMode, serializedAdditionalRawData) { InputIds = inputIds; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal AutoGridInputGroup() + { + } + /// Input and input group ids to be included in this input group. public IList InputIds { get; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.Serialization.cs index a20c449a70a8..ef7c8ffacc63 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class AutoGridLayout : IUtf8JsonSerializable + public partial class AutoGridLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("inputIds"u8); writer.WriteStartArray(); @@ -34,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -46,11 +60,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutoGridLayout DeserializeAutoGridLayout(JsonElement element) + internal static AutoGridLayout DeserializeAutoGridLayout(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +89,7 @@ internal static AutoGridLayout DeserializeAutoGridLayout(JsonElement element) Optional resolution = default; Optional placeholderImageUri = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inputIds"u8)) @@ -110,8 +139,61 @@ internal static AutoGridLayout DeserializeAutoGridLayout(JsonElement element) scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutoGridLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), inputIds, Optional.ToNullable(highlightDominantSpeaker), serializedAdditionalRawData); + } + + AutoGridLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutoGridLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutoGridLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutoGridLayout(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutoGridLayout model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutoGridLayout(Response response) + { + if (response is null) + { + return null; } - return new AutoGridLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), inputIds, Optional.ToNullable(highlightDominantSpeaker)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutoGridLayout(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.cs index 70444495f981..26311be3b674 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/AutoGridLayout.cs @@ -16,7 +16,7 @@ namespace Azure.Communication.MediaComposition /// Configure the autogrid layout. public partial class AutoGridLayout : MediaCompositionLayout { - /// Initializes a new instance of AutoGridLayout. + /// Initializes a new instance of . /// Input ids to be included in the layout. /// is null. public AutoGridLayout(IEnumerable inputIds) @@ -27,20 +27,26 @@ public AutoGridLayout(IEnumerable inputIds) Kind = LayoutType.AutoGrid; } - /// Initializes a new instance of AutoGridLayout. + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. /// The scaling mode for the view of a video stream in a cell. /// Input ids to be included in the layout. /// Toggle dominant speaker highlighting. - internal AutoGridLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, IList inputIds, bool? highlightDominantSpeaker) : base(kind, resolution, placeholderImageUri, scalingMode) + /// Keeps track of any properties unknown to the library. + internal AutoGridLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, IList inputIds, bool? highlightDominantSpeaker, Dictionary serializedAdditionalRawData) : base(kind, resolution, placeholderImageUri, scalingMode, serializedAdditionalRawData) { InputIds = inputIds; HighlightDominantSpeaker = highlightDominantSpeaker; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal AutoGridLayout() + { + } + /// Input ids to be included in the layout. public IList InputIds { get; } /// Toggle dominant speaker highlighting. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.Serialization.cs index e68bdcb01be8..7e1f0b6b2326 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - internal partial class CommunicationError : IUtf8JsonSerializable + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("code"u8); writer.WriteStringValue(Code); writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -74,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.cs index 935d6347bb61..61222a36f0b0 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.MediaComposition.Models /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ public CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 8a18208d6ac1..1a333309e2d3 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,28 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - internal partial class CommunicationErrorResponse : IUtf8JsonSerializable + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -34,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; } - return new CommunicationErrorResponse(error); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.cs index ea052b95d0bb..5efd24a4d070 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.MediaComposition.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.MediaComposition.Models /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. public CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ public CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs index b7fa28126211..fcf511637d5f 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -28,23 +36,58 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CommunicationUser)) { writer.WritePropertyName("communicationUser"u8); - writer.WriteObjectValue(CommunicationUser); + if (CommunicationUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommunicationUser).Serialize(writer, options); + } } if (Optional.IsDefined(PhoneNumber)) { writer.WritePropertyName("phoneNumber"u8); - writer.WriteObjectValue(PhoneNumber); + if (PhoneNumber is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PhoneNumber).Serialize(writer, options); + } } if (Optional.IsDefined(MicrosoftTeamsUser)) { writer.WritePropertyName("microsoftTeamsUser"u8); - writer.WriteObjectValue(MicrosoftTeamsUser); + if (MicrosoftTeamsUser is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MicrosoftTeamsUser).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element) + internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +97,7 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM Optional communicationUser = default; Optional phoneNumber = default; Optional microsoftTeamsUser = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -97,8 +141,61 @@ internal static CommunicationIdentifierModel DeserializeCommunicationIdentifierM microsoftTeamsUser = MicrosoftTeamsUserIdentifierModel.DeserializeMicrosoftTeamsUserIdentifierModel(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIdentifierModel(Optional.ToNullable(kind), rawId.Value, communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value, serializedAdditionalRawData); + } + + CommunicationIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIdentifierModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIdentifierModel(Response response) + { + if (response is null) + { + return null; } - return new CommunicationIdentifierModel(Optional.ToNullable(kind), rawId.Value, communicationUser.Value, phoneNumber.Value, microsoftTeamsUser.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.cs index 906d45583658..0ee509511296 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationIdentifierModel.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication { /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. internal partial class CommunicationIdentifierModel { - /// Initializes a new instance of CommunicationIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationIdentifierModel() { } - /// Initializes a new instance of CommunicationIdentifierModel. + /// Initializes a new instance of . /// The identifier kind. Only required in responses. /// Raw Id of the identifier. Optional in requests, required in responses. /// The communication user. /// The phone number. /// The Microsoft Teams user. - internal CommunicationIdentifierModel(CommunicationIdentifierModelKind? kind, string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser) + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentifierModel(CommunicationIdentifierModelKind? kind, string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, Dictionary serializedAdditionalRawData) { Kind = kind; RawId = rawId; CommunicationUser = communicationUser; PhoneNumber = phoneNumber; MicrosoftTeamsUser = microsoftTeamsUser; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The identifier kind. Only required in responses. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs index 606b9637a4ea..ed94ea13226d 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable + internal partial class CommunicationUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element) + internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -34,8 +57,61 @@ internal static CommunicationUserIdentifierModel DeserializeCommunicationUserIde id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationUserIdentifierModel(id, serializedAdditionalRawData); + } + + CommunicationUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new CommunicationUserIdentifierModel(id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.cs index 1f90746ab01e..f4e6bdb9c80d 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CommunicationUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A user that got created with an Azure Communication Services resource. internal partial class CommunicationUserIdentifierModel { - /// Initializes a new instance of CommunicationUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the communication user. /// is null. public CommunicationUserIdentifierModel(string id) @@ -23,6 +27,20 @@ public CommunicationUserIdentifierModel(string id) Id = id; } + /// Initializes a new instance of . + /// The Id of the communication user. + /// Keeps track of any properties unknown to the library. + internal CommunicationUserIdentifierModel(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationUserIdentifierModel() + { + } + /// The Id of the communication user. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.Serialization.cs index 38b300f319af..6978f3130ce5 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class CompositionStreamState : IUtf8JsonSerializable + public partial class CompositionStreamState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CompositionStreamState DeserializeCompositionStreamState(JsonElement element) + internal static CompositionStreamState DeserializeCompositionStreamState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -41,8 +64,61 @@ internal static CompositionStreamState DeserializeCompositionStreamState(JsonEle status = new StreamStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CompositionStreamState(Optional.ToNullable(status), serializedAdditionalRawData); + } + + CompositionStreamState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCompositionStreamState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CompositionStreamState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCompositionStreamState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CompositionStreamState model) + { + if (model is null) + { + return null; } - return new CompositionStreamState(Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CompositionStreamState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCompositionStreamState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.cs index 5d088c13c578..5801cd0a835d 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CompositionStreamState.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.MediaComposition { /// Provides the state of the media composition. public partial class CompositionStreamState { - /// Initializes a new instance of CompositionStreamState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CompositionStreamState() { } - /// Initializes a new instance of CompositionStreamState. + /// Initializes a new instance of . /// State of the composition stream. - internal CompositionStreamState(StreamStatus? status) + /// Keeps track of any properties unknown to the library. + internal CompositionStreamState(StreamStatus? status, Dictionary serializedAdditionalRawData) { Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// State of the composition stream. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.Serialization.cs index 02511958fc8c..895244aa7d8e 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class CustomLayout : IUtf8JsonSerializable + public partial class CustomLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Layers)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Layers) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -33,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in InputGroups) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); writer.WritePropertyName("kind"u8); @@ -41,7 +62,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -53,11 +81,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomLayout DeserializeCustomLayout(JsonElement element) + internal static CustomLayout DeserializeCustomLayout(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +110,7 @@ internal static CustomLayout DeserializeCustomLayout(JsonElement element) Optional resolution = default; Optional placeholderImageUri = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("layers"u8)) @@ -122,8 +165,61 @@ internal static CustomLayout DeserializeCustomLayout(JsonElement element) scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), Optional.ToDictionary(layers), inputGroups, serializedAdditionalRawData); + } + + CustomLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomLayout(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomLayout model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomLayout(Response response) + { + if (response is null) + { + return null; } - return new CustomLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), Optional.ToDictionary(layers), inputGroups); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomLayout(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.cs index dec9c03f30da..6b19cec59401 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/CustomLayout.cs @@ -15,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Configure custom layout. public partial class CustomLayout : MediaCompositionLayout { - /// Initializes a new instance of CustomLayout. + /// Initializes a new instance of . /// /// Configure input groups of the layout /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -31,7 +31,7 @@ public CustomLayout(IDictionary inputGroups) Kind = LayoutType.Custom; } - /// Initializes a new instance of CustomLayout. + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. @@ -42,13 +42,19 @@ public CustomLayout(IDictionary inputGroups) /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal CustomLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, IDictionary layers, IDictionary inputGroups) : base(kind, resolution, placeholderImageUri, scalingMode) + /// Keeps track of any properties unknown to the library. + internal CustomLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, IDictionary layers, IDictionary inputGroups, Dictionary serializedAdditionalRawData) : base(kind, resolution, placeholderImageUri, scalingMode, serializedAdditionalRawData) { Layers = layers; InputGroups = inputGroups; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal CustomLayout() + { + } + /// Configure layer to control the z-position of input groups. public IDictionary Layers { get; } /// diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.Serialization.cs index 81302ac3fb44..708227f3e8db 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class DominantSpeaker : IUtf8JsonSerializable + public partial class DominantSpeaker : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("call"u8); writer.WriteStringValue(Call); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DominantSpeaker DeserializeDominantSpeaker(JsonElement element) + internal static DominantSpeaker DeserializeDominantSpeaker(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static DominantSpeaker DeserializeDominantSpeaker(JsonElement element) string call = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("call"u8)) @@ -53,8 +76,61 @@ internal static DominantSpeaker DeserializeDominantSpeaker(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DominantSpeaker(kind, placeholderImageUri.Value, call, serializedAdditionalRawData); + } + + DominantSpeaker IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDominantSpeaker(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DominantSpeaker IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDominantSpeaker(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DominantSpeaker model) + { + if (model is null) + { + return null; } - return new DominantSpeaker(kind, placeholderImageUri.Value, call); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DominantSpeaker(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDominantSpeaker(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.cs index a2faa55693e8..24abd8a32b71 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/DominantSpeaker.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// The DominantSpeaker. public partial class DominantSpeaker : MediaInput { - /// Initializes a new instance of DominantSpeaker. + /// Initializes a new instance of . /// The id of the teams meeting or call. /// is null. public DominantSpeaker(string call) @@ -25,16 +26,22 @@ public DominantSpeaker(string call) Kind = MediaInputType.DominantSpeaker; } - /// Initializes a new instance of DominantSpeaker. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// The id of the teams meeting or call. - internal DominantSpeaker(MediaInputType kind, string placeholderImageUri, string call) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal DominantSpeaker(MediaInputType kind, string placeholderImageUri, string call, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Call = call; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal DominantSpeaker() + { + } + /// The id of the teams meeting or call. public string Call { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.Serialization.cs index f6c9763972aa..91c441e1bb87 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class GridInputGroup : IUtf8JsonSerializable + public partial class GridInputGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("inputIds"u8); writer.WriteStartArray(); @@ -43,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Position)) { writer.WritePropertyName("position"u8); - writer.WriteObjectValue(Position); + if (Position is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Position).Serialize(writer, options); + } } if (Optional.IsDefined(Width)) { @@ -65,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GridInputGroup DeserializeGridInputGroup(JsonElement element) + internal static GridInputGroup DeserializeGridInputGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,6 +111,7 @@ internal static GridInputGroup DeserializeGridInputGroup(JsonElement element) Optional height = default; Optional layer = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inputIds"u8)) @@ -155,8 +184,61 @@ internal static GridInputGroup DeserializeGridInputGroup(JsonElement element) scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GridInputGroup(kind, position.Value, width.Value, height.Value, layer.Value, Optional.ToNullable(scalingMode), inputIds, rows, columns); + return new GridInputGroup(kind, position.Value, width.Value, height.Value, layer.Value, Optional.ToNullable(scalingMode), inputIds, rows, columns, serializedAdditionalRawData); + } + + GridInputGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGridInputGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GridInputGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGridInputGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GridInputGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GridInputGroup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGridInputGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.cs index 0212f0b8fb88..618183ed7e6c 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridInputGroup.cs @@ -16,7 +16,7 @@ namespace Azure.Communication.MediaComposition /// Configure grid-based input group to be used in custom layouts. public partial class GridInputGroup : InputGroup { - /// Initializes a new instance of GridInputGroup. + /// Initializes a new instance of . /// Input and input group ids to be included in this input group. /// Number of rows. /// Number of columns. @@ -31,7 +31,7 @@ public GridInputGroup(IEnumerable> inputIds, int rows, int columns Kind = InputGroupType.GridBased; } - /// Initializes a new instance of GridInputGroup. + /// Initializes a new instance of . /// Kind of input group. /// The (x,y) position on scene or input group. /// The width of the input group container. Can be defined as pixels or percentage. @@ -41,7 +41,8 @@ public GridInputGroup(IEnumerable> inputIds, int rows, int columns /// Input and input group ids to be included in this input group. /// Number of rows. /// Number of columns. - internal GridInputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode, IList> inputIds, int rows, int columns) : base(kind, position, width, height, layer, scalingMode) + /// Keeps track of any properties unknown to the library. + internal GridInputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode, IList> inputIds, int rows, int columns, Dictionary serializedAdditionalRawData) : base(kind, position, width, height, layer, scalingMode, serializedAdditionalRawData) { InputIds = inputIds; Rows = rows; @@ -49,6 +50,11 @@ internal GridInputGroup(InputGroupType kind, InputPosition position, string widt Kind = kind; } + /// Initializes a new instance of for deserialization. + internal GridInputGroup() + { + } + /// Input and input group ids to be included in this input group. public IList> InputIds { get; } /// Number of rows. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.Serialization.cs index fbb518f209f3..c300be9be35c 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class GridLayout : IUtf8JsonSerializable + public partial class GridLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("rows"u8); writer.WriteNumberValue(Rows); @@ -43,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -55,11 +69,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GridLayout DeserializeGridLayout(JsonElement element) + internal static GridLayout DeserializeGridLayout(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +99,7 @@ internal static GridLayout DeserializeGridLayout(JsonElement element) Optional resolution = default; Optional placeholderImageUri = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rows"u8)) @@ -133,8 +162,61 @@ internal static GridLayout DeserializeGridLayout(JsonElement element) scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GridLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), rows, columns, inputIds); + return new GridLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), rows, columns, inputIds, serializedAdditionalRawData); + } + + GridLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGridLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GridLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGridLayout(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GridLayout model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GridLayout(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGridLayout(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.cs index 3fb6d95f0241..2ef9600905c0 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GridLayout.cs @@ -16,7 +16,7 @@ namespace Azure.Communication.MediaComposition /// Configure the grid layout. public partial class GridLayout : MediaCompositionLayout { - /// Initializes a new instance of GridLayout. + /// Initializes a new instance of . /// Number of rows. /// Number of columns. /// Input ids to be included in the layout. @@ -31,7 +31,7 @@ public GridLayout(int rows, int columns, IEnumerable> inputIds) Kind = LayoutType.Grid; } - /// Initializes a new instance of GridLayout. + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. @@ -39,7 +39,8 @@ public GridLayout(int rows, int columns, IEnumerable> inputIds) /// Number of rows. /// Number of columns. /// Input ids to be included in the layout. - internal GridLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, int rows, int columns, IList> inputIds) : base(kind, resolution, placeholderImageUri, scalingMode) + /// Keeps track of any properties unknown to the library. + internal GridLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, int rows, int columns, IList> inputIds, Dictionary serializedAdditionalRawData) : base(kind, resolution, placeholderImageUri, scalingMode, serializedAdditionalRawData) { Rows = rows; Columns = columns; @@ -47,6 +48,11 @@ internal GridLayout(LayoutType kind, LayoutResolution resolution, string placeho Kind = kind; } + /// Initializes a new instance of for deserialization. + internal GridLayout() + { + } + /// Number of rows. public int Rows { get; set; } /// Number of columns. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.Serialization.cs index e2136e8cce6e..6082fcaf06b6 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class GroupCallInput : IUtf8JsonSerializable + public partial class GroupCallInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GroupCallInput DeserializeGroupCallInput(JsonElement element) + internal static GroupCallInput DeserializeGroupCallInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static GroupCallInput DeserializeGroupCallInput(JsonElement element) string id = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -53,8 +76,61 @@ internal static GroupCallInput DeserializeGroupCallInput(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GroupCallInput(kind, placeholderImageUri.Value, id, serializedAdditionalRawData); + } + + GroupCallInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGroupCallInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GroupCallInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGroupCallInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GroupCallInput model) + { + if (model is null) + { + return null; } - return new GroupCallInput(kind, placeholderImageUri.Value, id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GroupCallInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGroupCallInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.cs index ae39f25510fa..8fc1e64456f4 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Group call to be used as an input. public partial class GroupCallInput : MediaInput { - /// Initializes a new instance of GroupCallInput. + /// Initializes a new instance of . /// Group call identifier. /// is null. public GroupCallInput(string id) @@ -25,16 +26,22 @@ public GroupCallInput(string id) Kind = MediaInputType.GroupCall; } - /// Initializes a new instance of GroupCallInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// Group call identifier. - internal GroupCallInput(MediaInputType kind, string placeholderImageUri, string id) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal GroupCallInput(MediaInputType kind, string placeholderImageUri, string id, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Id = id; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal GroupCallInput() + { + } + /// Group call identifier. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.Serialization.cs index 3f206623c2b5..1e69dfadeb8d 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class GroupCallOutput : IUtf8JsonSerializable + public partial class GroupCallOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GroupCallOutput DeserializeGroupCallOutput(JsonElement element) + internal static GroupCallOutput DeserializeGroupCallOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; MediaOutputType kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -42,8 +65,61 @@ internal static GroupCallOutput DeserializeGroupCallOutput(JsonElement element) kind = new MediaOutputType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GroupCallOutput(kind, id, serializedAdditionalRawData); + } + + GroupCallOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGroupCallOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GroupCallOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGroupCallOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GroupCallOutput model) + { + if (model is null) + { + return null; } - return new GroupCallOutput(kind, id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GroupCallOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGroupCallOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.cs index a842d4797428..e654b51ebcac 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/GroupCallOutput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Group call to be used as an output. public partial class GroupCallOutput : MediaOutput { - /// Initializes a new instance of GroupCallOutput. + /// Initializes a new instance of . /// Group call identifier. /// is null. public GroupCallOutput(string id) @@ -25,15 +26,21 @@ public GroupCallOutput(string id) Kind = MediaOutputType.GroupCall; } - /// Initializes a new instance of GroupCallOutput. + /// Initializes a new instance of . /// Kind of media output. /// Group call identifier. - internal GroupCallOutput(MediaOutputType kind, string id) : base(kind) + /// Keeps track of any properties unknown to the library. + internal GroupCallOutput(MediaOutputType kind, string id, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Id = id; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal GroupCallOutput() + { + } + /// Group call identifier. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.Serialization.cs index 9f158cfdf3cb..1440f22c6e60 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class ImageInput : IUtf8JsonSerializable + public partial class ImageInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("uri"u8); writer.WriteStringValue(Uri); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageInput DeserializeImageInput(JsonElement element) + internal static ImageInput DeserializeImageInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static ImageInput DeserializeImageInput(JsonElement element) string uri = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uri"u8)) @@ -54,8 +77,61 @@ internal static ImageInput DeserializeImageInput(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageInput(kind, placeholderImageUri.Value, uri, serializedAdditionalRawData); + } + + ImageInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageInput model) + { + if (model is null) + { + return null; } - return new ImageInput(kind, placeholderImageUri.Value, uri); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.cs index fb2df4d5b16c..55d471270548 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ImageInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition.Models /// An image input. public partial class ImageInput : MediaInput { - /// Initializes a new instance of ImageInput. + /// Initializes a new instance of . /// Url of the image file. /// is null. public ImageInput(string uri) @@ -25,16 +26,22 @@ public ImageInput(string uri) Kind = MediaInputType.Image; } - /// Initializes a new instance of ImageInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// Url of the image file. - internal ImageInput(MediaInputType kind, string placeholderImageUri, string uri) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal ImageInput(MediaInputType kind, string placeholderImageUri, string uri, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Uri = uri; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal ImageInput() + { + } + /// Url of the image file. public string Uri { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.Serialization.cs index b67c129480bf..c073b66b7a39 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.Serialization.cs @@ -5,22 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class InputGroup : IUtf8JsonSerializable + public partial class InputGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(Position)) { writer.WritePropertyName("position"u8); - writer.WriteObjectValue(Position); + if (Position is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Position).Serialize(writer, options); + } } if (Optional.IsDefined(Width)) { @@ -42,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InputGroup DeserializeInputGroup(JsonElement element) + internal static InputGroup DeserializeInputGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,7 +89,110 @@ internal static InputGroup DeserializeInputGroup(JsonElement element) case "gridBased": return GridInputGroup.DeserializeGridInputGroup(element); } } - return UnknownInputGroup.DeserializeUnknownInputGroup(element); + + // Unknown type found so we will deserialize the base properties only + InputGroupType kind = default; + Optional position = default; + Optional width = default; + Optional height = default; + Optional layer = default; + Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new InputGroupType(property.Value.GetString()); + continue; + } + if (property.NameEquals("position"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + position = InputPosition.DeserializeInputPosition(property.Value); + continue; + } + if (property.NameEquals("width"u8)) + { + width = property.Value.GetString(); + continue; + } + if (property.NameEquals("height"u8)) + { + height = property.Value.GetString(); + continue; + } + if (property.NameEquals("layer"u8)) + { + layer = property.Value.GetString(); + continue; + } + if (property.NameEquals("scalingMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalingMode = new ScalingMode(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownInputGroup(kind, position.Value, width.Value, height.Value, layer.Value, Optional.ToNullable(scalingMode), serializedAdditionalRawData); + } + + InputGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInputGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InputGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInputGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InputGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InputGroup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInputGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.cs index 878c9508c135..6d96794684c0 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputGroup.cs @@ -5,7 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { @@ -14,21 +17,26 @@ namespace Azure.Communication.MediaComposition /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownInputGroup))] public abstract partial class InputGroup { - /// Initializes a new instance of InputGroup. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected InputGroup() { } - /// Initializes a new instance of InputGroup. + /// Initializes a new instance of . /// Kind of input group. /// The (x,y) position on scene or input group. /// The width of the input group container. Can be defined as pixels or percentage. /// The height of the input group container. Can be defined as pixels or percentage. /// The layer this input group should appear on. /// The scaling mode for the view of a video stream in a cell. - internal InputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode) + /// Keeps track of any properties unknown to the library. + internal InputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode, Dictionary serializedAdditionalRawData) { Kind = kind; Position = position; @@ -36,6 +44,7 @@ internal InputGroup(InputGroupType kind, InputPosition position, string width, s Height = height; Layer = layer; ScalingMode = scalingMode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Kind of input group. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.Serialization.cs index edf8f6f4e11e..7d8e5bce31dd 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class InputPosition : IUtf8JsonSerializable + public partial class InputPosition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("x"u8); writer.WriteNumberValue(X); writer.WritePropertyName("y"u8); writer.WriteNumberValue(Y); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InputPosition DeserializeInputPosition(JsonElement element) + internal static InputPosition DeserializeInputPosition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int x = default; int y = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("x"u8)) @@ -42,8 +65,61 @@ internal static InputPosition DeserializeInputPosition(JsonElement element) y = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InputPosition(x, y, serializedAdditionalRawData); + } + + InputPosition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInputPosition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InputPosition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInputPosition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InputPosition model) + { + if (model is null) + { + return null; } - return new InputPosition(x, y); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InputPosition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInputPosition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.cs index 867e77eec991..ae57d44ccf56 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/InputPosition.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.MediaComposition.Models { /// The (x,y) position on scene or input group. public partial class InputPosition { - /// Initializes a new instance of InputPosition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The x-position. /// The y-position. public InputPosition(int x, int y) @@ -19,6 +25,22 @@ public InputPosition(int x, int y) Y = y; } + /// Initializes a new instance of . + /// The x-position. + /// The y-position. + /// Keeps track of any properties unknown to the library. + internal InputPosition(int x, int y, Dictionary serializedAdditionalRawData) + { + X = x; + Y = y; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InputPosition() + { + } + /// The x-position. public int X { get; set; } /// The y-position. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.Serialization.cs index 9b8ea72c8f4b..8aa7400dc9e3 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class LayoutLayer : IUtf8JsonSerializable + public partial class LayoutLayer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("zIndex"u8); writer.WriteNumberValue(ZIndex); @@ -23,17 +31,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("visibility"u8); writer.WriteStringValue(Visibility.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LayoutLayer DeserializeLayoutLayer(JsonElement element) + internal static LayoutLayer DeserializeLayoutLayer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int zIndex = default; Optional visibility = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zIndex"u8)) @@ -50,8 +73,61 @@ internal static LayoutLayer DeserializeLayoutLayer(JsonElement element) visibility = new LayerVisibility(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LayoutLayer(zIndex, Optional.ToNullable(visibility), serializedAdditionalRawData); + } + + LayoutLayer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLayoutLayer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LayoutLayer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLayoutLayer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LayoutLayer model) + { + if (model is null) + { + return null; } - return new LayoutLayer(zIndex, Optional.ToNullable(visibility)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LayoutLayer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLayoutLayer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.cs index 25790432d164..a7207bdd9c93 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutLayer.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition; namespace Azure.Communication.MediaComposition.Models @@ -12,20 +14,30 @@ namespace Azure.Communication.MediaComposition.Models /// Configure layer to control the z-position of input groups. public partial class LayoutLayer { - /// Initializes a new instance of LayoutLayer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The z position of the layer. public LayoutLayer(int zIndex) { ZIndex = zIndex; } - /// Initializes a new instance of LayoutLayer. + /// Initializes a new instance of . /// The z position of the layer. /// The visibility of the layer. - internal LayoutLayer(int zIndex, LayerVisibility? visibility) + /// Keeps track of any properties unknown to the library. + internal LayoutLayer(int zIndex, LayerVisibility? visibility, Dictionary serializedAdditionalRawData) { ZIndex = zIndex; Visibility = visibility; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LayoutLayer() + { } /// The z position of the layer. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.Serialization.cs index 99552641b089..d75e696205f8 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class LayoutResolution : IUtf8JsonSerializable + public partial class LayoutResolution : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("width"u8); writer.WriteNumberValue(Width); writer.WritePropertyName("height"u8); writer.WriteNumberValue(Height); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LayoutResolution DeserializeLayoutResolution(JsonElement element) + internal static LayoutResolution DeserializeLayoutResolution(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int width = default; int height = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("width"u8)) @@ -42,8 +65,61 @@ internal static LayoutResolution DeserializeLayoutResolution(JsonElement element height = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LayoutResolution(width, height, serializedAdditionalRawData); + } + + LayoutResolution IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLayoutResolution(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LayoutResolution IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLayoutResolution(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LayoutResolution model) + { + if (model is null) + { + return null; } - return new LayoutResolution(width, height); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LayoutResolution(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLayoutResolution(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.cs index 32523b6eb78e..9f4c414c5421 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/LayoutResolution.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.MediaComposition.Models { /// The dimensions of the scene or objects in the scene. public partial class LayoutResolution { - /// Initializes a new instance of LayoutResolution. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Width of the object. /// Height of the object. public LayoutResolution(int width, int height) @@ -19,6 +25,22 @@ public LayoutResolution(int width, int height) Height = height; } + /// Initializes a new instance of . + /// Width of the object. + /// Height of the object. + /// Keeps track of any properties unknown to the library. + internal LayoutResolution(int width, int height, Dictionary serializedAdditionalRawData) + { + Width = width; + Height = height; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LayoutResolution() + { + } + /// Width of the object. public int Width { get; set; } /// Height of the object. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.Serialization.cs index 7858cb164088..ccafe6a4c396 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class MediaComposition : IUtf8JsonSerializable + public partial class MediaComposition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -25,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Layout)) { writer.WritePropertyName("layout"u8); - writer.WriteObjectValue(Layout); + if (Layout is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Layout).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Inputs)) { @@ -34,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Inputs) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -45,20 +66,48 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Outputs) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } if (Optional.IsDefined(StreamState)) { writer.WritePropertyName("streamState"u8); - writer.WriteObjectValue(StreamState); + if (StreamState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StreamState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MediaComposition DeserializeMediaComposition(JsonElement element) + internal static MediaComposition DeserializeMediaComposition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +117,7 @@ internal static MediaComposition DeserializeMediaComposition(JsonElement element Optional> inputs = default; Optional> outputs = default; Optional streamState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -121,8 +171,61 @@ internal static MediaComposition DeserializeMediaComposition(JsonElement element streamState = CompositionStreamState.DeserializeCompositionStreamState(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MediaComposition(id.Value, layout.Value, Optional.ToDictionary(inputs), Optional.ToDictionary(outputs), streamState.Value); + return new MediaComposition(id.Value, layout.Value, Optional.ToDictionary(inputs), Optional.ToDictionary(outputs), streamState.Value, serializedAdditionalRawData); + } + + MediaComposition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMediaComposition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaComposition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaComposition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MediaComposition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MediaComposition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMediaComposition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.cs index d8a92530a4c0..0816e2d38a58 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaComposition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,14 +15,17 @@ namespace Azure.Communication.MediaComposition /// Body of a media composition. public partial class MediaComposition { - /// Initializes a new instance of MediaComposition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MediaComposition() { Inputs = new ChangeTrackingDictionary(); Outputs = new ChangeTrackingDictionary(); } - /// Initializes a new instance of MediaComposition. + /// Initializes a new instance of . /// Id of the media composition. /// /// Configure a layout @@ -39,13 +43,15 @@ public MediaComposition() /// The available derived classes include , , , and . /// /// Provides the state of the media composition. - internal MediaComposition(string id, MediaCompositionLayout layout, IDictionary inputs, IDictionary outputs, CompositionStreamState streamState) + /// Keeps track of any properties unknown to the library. + internal MediaComposition(string id, MediaCompositionLayout layout, IDictionary inputs, IDictionary outputs, CompositionStreamState streamState, Dictionary serializedAdditionalRawData) { Id = id; Layout = layout; Inputs = inputs; Outputs = outputs; StreamState = streamState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of the media composition. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.Serialization.cs index 187d0e0abb01..b89159d5a158 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.Serialization.cs @@ -5,23 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class MediaCompositionLayout : IUtf8JsonSerializable + public partial class MediaCompositionLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -33,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MediaCompositionLayout DeserializeMediaCompositionLayout(JsonElement element) + internal static MediaCompositionLayout DeserializeMediaCompositionLayout(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,7 +82,98 @@ internal static MediaCompositionLayout DeserializeMediaCompositionLayout(JsonEle case "presenter": return PresenterLayout.DeserializePresenterLayout(element); } } - return UnknownLayout.DeserializeUnknownLayout(element); + + // Unknown type found so we will deserialize the base properties only + LayoutType kind = default; + Optional resolution = default; + Optional placeholderImageUri = default; + Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new LayoutType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolution"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resolution = LayoutResolution.DeserializeLayoutResolution(property.Value); + continue; + } + if (property.NameEquals("placeholderImageUri"u8)) + { + placeholderImageUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("scalingMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalingMode = new ScalingMode(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), serializedAdditionalRawData); + } + + MediaCompositionLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMediaCompositionLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaCompositionLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaCompositionLayout(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MediaCompositionLayout model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MediaCompositionLayout(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMediaCompositionLayout(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.cs index 99975b401b72..53d463a88834 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaCompositionLayout.cs @@ -5,7 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { @@ -14,19 +17,25 @@ namespace Azure.Communication.MediaComposition.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// + [DeserializationProxy(typeof(UnknownLayout))] public abstract partial class MediaCompositionLayout { - /// Initializes a new instance of MediaCompositionLayout. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. /// The scaling mode for the view of a video stream in a cell. - internal MediaCompositionLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode) + /// Keeps track of any properties unknown to the library. + internal MediaCompositionLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, Dictionary serializedAdditionalRawData) { Kind = kind; Resolution = resolution; PlaceholderImageUri = placeholderImageUri; ScalingMode = scalingMode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Kind of layout. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.Serialization.cs index 0212ea314aae..af9acae0bd09 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class MediaInput : IUtf8JsonSerializable + public partial class MediaInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -23,11 +31,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MediaInput DeserializeMediaInput(JsonElement element) + internal static MediaInput DeserializeMediaInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,7 +70,78 @@ internal static MediaInput DeserializeMediaInput(JsonElement element) case "teamsMeeting": return TeamsMeetingInput.DeserializeTeamsMeetingInput(element); } } - return UnknownMediaInput.DeserializeUnknownMediaInput(element); + + // Unknown type found so we will deserialize the base properties only + MediaInputType kind = default; + Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new MediaInputType(property.Value.GetString()); + continue; + } + if (property.NameEquals("placeholderImageUri"u8)) + { + placeholderImageUri = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownMediaInput(kind, placeholderImageUri.Value, serializedAdditionalRawData); + } + + MediaInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMediaInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MediaInput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MediaInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMediaInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.cs index 84d2893ef2a5..15a52d31453d 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaInput.cs @@ -5,7 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { @@ -14,15 +17,21 @@ namespace Azure.Communication.MediaComposition.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , , , , , and . /// + [DeserializationProxy(typeof(UnknownMediaInput))] public abstract partial class MediaInput { - /// Initializes a new instance of MediaInput. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. - internal MediaInput(MediaInputType kind, string placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal MediaInput(MediaInputType kind, string placeholderImageUri, Dictionary serializedAdditionalRawData) { Kind = kind; PlaceholderImageUri = placeholderImageUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Kind of media input. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.Serialization.cs index e010333c4602..f37d0000d202 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.Serialization.cs @@ -5,24 +5,46 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class MediaOutput : IUtf8JsonSerializable + public partial class MediaOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MediaOutput DeserializeMediaOutput(JsonElement element) + internal static MediaOutput DeserializeMediaOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,7 +60,72 @@ internal static MediaOutput DeserializeMediaOutput(JsonElement element) case "teamsMeeting": return TeamsMeetingOutput.DeserializeTeamsMeetingOutput(element); } } - return UnknownMediaOutput.DeserializeUnknownMediaOutput(element); + + // Unknown type found so we will deserialize the base properties only + MediaOutputType kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new MediaOutputType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownMediaOutput(kind, serializedAdditionalRawData); + } + + MediaOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMediaOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MediaOutput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MediaOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMediaOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.cs index 834b5ed34670..d2955a20bdae 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MediaOutput.cs @@ -5,7 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { @@ -14,13 +17,19 @@ namespace Azure.Communication.MediaComposition.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , and . /// + [DeserializationProxy(typeof(UnknownMediaOutput))] public abstract partial class MediaOutput { - /// Initializes a new instance of MediaOutput. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Kind of media output. - internal MediaOutput(MediaOutputType kind) + /// Keeps track of any properties unknown to the library. + internal MediaOutput(MediaOutputType kind, Dictionary serializedAdditionalRawData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Kind of media output. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs index b84cac6e4d46..670616c6d8ce 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable + internal partial class MicrosoftTeamsUserIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userId"u8); writer.WriteStringValue(UserId); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cloud"u8); writer.WriteStringValue(Cloud.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element) + internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI string userId = default; Optional isAnonymous = default; Optional cloud = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userId"u8)) @@ -64,8 +87,61 @@ internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserI cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud), serializedAdditionalRawData); + } + + MicrosoftTeamsUserIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftTeamsUserIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftTeamsUserIdentifierModel model) + { + if (model is null) + { + return null; } - return new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftTeamsUserIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftTeamsUserIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs index 20dfff30e6fe..3e8733d38ce9 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A Microsoft Teams user. internal partial class MicrosoftTeamsUserIdentifierModel { - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// is null. public MicrosoftTeamsUserIdentifierModel(string userId) @@ -23,15 +27,22 @@ public MicrosoftTeamsUserIdentifierModel(string userId) UserId = userId; } - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// True if the Microsoft Teams user is anonymous. By default false if missing. /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. - internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud) + /// Keeps track of any properties unknown to the library. + internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud, Dictionary serializedAdditionalRawData) { UserId = userId; IsAnonymous = isAnonymous; Cloud = cloud; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MicrosoftTeamsUserIdentifierModel() + { } /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.Serialization.cs index cec6b8ad6e65..e0600b385e46 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication; using Azure.Communication.MediaComposition; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition.Models { - public partial class ParticipantInput : IUtf8JsonSerializable + public partial class ParticipantInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); - writer.WriteObjectValue(ServiceId); + if (ServiceId is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ServiceId).Serialize(writer, options); + } writer.WritePropertyName("call"u8); writer.WriteStringValue(Call); writer.WritePropertyName("kind"u8); @@ -28,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ParticipantInput DeserializeParticipantInput(JsonElement element) + internal static ParticipantInput DeserializeParticipantInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +70,7 @@ internal static ParticipantInput DeserializeParticipantInput(JsonElement element string call = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -63,8 +93,61 @@ internal static ParticipantInput DeserializeParticipantInput(JsonElement element placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ParticipantInput(kind, placeholderImageUri.Value, id, call, serializedAdditionalRawData); + } + + ParticipantInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantInput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantInput(Response response) + { + if (response is null) + { + return null; } - return new ParticipantInput(kind, placeholderImageUri.Value, id, call); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.cs index efa270e5f84e..fa266d47ac5f 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ParticipantInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication; using Azure.Communication.MediaComposition; using Azure.Core; @@ -15,6 +16,23 @@ namespace Azure.Communication.MediaComposition.Models /// The Participant. public partial class ParticipantInput : MediaInput { + /// Initializes a new instance of . + /// Kind of media input. + /// Image url to be used if participant has no video stream. + /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. + /// The id of the teams meeting or call. + /// Keeps track of any properties unknown to the library. + internal ParticipantInput(MediaInputType kind, string placeholderImageUri, CommunicationIdentifierModel serviceId, string call, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) + { + ServiceId = serviceId; + Call = call; + Kind = kind; + } + + /// Initializes a new instance of for deserialization. + internal ParticipantInput() + { + } /// The id of the teams meeting or call. public string Call { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs index dce7185be6bd..004f3f6df1a9 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication { - internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable + internal partial class PhoneNumberIdentifierModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element) + internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -34,8 +57,61 @@ internal static PhoneNumberIdentifierModel DeserializePhoneNumberIdentifierModel value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberIdentifierModel(value, serializedAdditionalRawData); + } + + PhoneNumberIdentifierModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberIdentifierModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberIdentifierModel model) + { + if (model is null) + { + return null; } - return new PhoneNumberIdentifierModel(value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberIdentifierModel(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberIdentifierModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.cs index d9416ecf4e45..0a9a484b4f83 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PhoneNumberIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication @@ -13,7 +14,10 @@ namespace Azure.Communication /// A phone number. internal partial class PhoneNumberIdentifierModel { - /// Initializes a new instance of PhoneNumberIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The phone number in E.164 format. /// is null. public PhoneNumberIdentifierModel(string value) @@ -23,6 +27,20 @@ public PhoneNumberIdentifierModel(string value) Value = value; } + /// Initializes a new instance of . + /// The phone number in E.164 format. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberIdentifierModel(string value, Dictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberIdentifierModel() + { + } + /// The phone number in E.164 format. public string Value { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.Serialization.cs index 0296570fc870..89fdb2119354 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class PresentationLayout : IUtf8JsonSerializable + public partial class PresentationLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("presenterId"u8); writer.WriteStringValue(PresenterId); @@ -36,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -48,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PresentationLayout DeserializePresentationLayout(JsonElement element) + internal static PresentationLayout DeserializePresentationLayout(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +92,7 @@ internal static PresentationLayout DeserializePresentationLayout(JsonElement ele Optional resolution = default; Optional placeholderImageUri = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("presenterId"u8)) @@ -118,8 +147,61 @@ internal static PresentationLayout DeserializePresentationLayout(JsonElement ele scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PresentationLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), presenterId, audienceIds, Optional.ToNullable(audiencePosition), serializedAdditionalRawData); + } + + PresentationLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePresentationLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PresentationLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePresentationLayout(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PresentationLayout model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PresentationLayout(Response response) + { + if (response is null) + { + return null; } - return new PresentationLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), presenterId, audienceIds, Optional.ToNullable(audiencePosition)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePresentationLayout(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.cs index c80a29fee339..f4768385876d 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresentationLayout.cs @@ -16,7 +16,7 @@ namespace Azure.Communication.MediaComposition /// Configure the presentation layout. public partial class PresentationLayout : MediaCompositionLayout { - /// Initializes a new instance of PresentationLayout. + /// Initializes a new instance of . /// Id of the presenter input. /// Input ids to be included in the audience of layout. /// or is null. @@ -30,7 +30,7 @@ public PresentationLayout(string presenterId, IEnumerable audienceIds) Kind = LayoutType.Presentation; } - /// Initializes a new instance of PresentationLayout. + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. @@ -38,7 +38,8 @@ public PresentationLayout(string presenterId, IEnumerable audienceIds) /// Id of the presenter input. /// Input ids to be included in the audience of layout. /// Position of the audience streams. - internal PresentationLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, string presenterId, IList audienceIds, AudiencePosition? audiencePosition) : base(kind, resolution, placeholderImageUri, scalingMode) + /// Keeps track of any properties unknown to the library. + internal PresentationLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, string presenterId, IList audienceIds, AudiencePosition? audiencePosition, Dictionary serializedAdditionalRawData) : base(kind, resolution, placeholderImageUri, scalingMode, serializedAdditionalRawData) { PresenterId = presenterId; AudienceIds = audienceIds; @@ -46,6 +47,11 @@ internal PresentationLayout(LayoutType kind, LayoutResolution resolution, string Kind = kind; } + /// Initializes a new instance of for deserialization. + internal PresentationLayout() + { + } + /// Id of the presenter input. public string PresenterId { get; set; } /// Input ids to be included in the audience of layout. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.Serialization.cs index 8b43ad74e8ba..928d7a30c261 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class PresenterLayout : IUtf8JsonSerializable + public partial class PresenterLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("presenterId"u8); writer.WriteStringValue(PresenterId); @@ -35,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -47,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PresenterLayout DeserializePresenterLayout(JsonElement element) + internal static PresenterLayout DeserializePresenterLayout(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +93,7 @@ internal static PresenterLayout DeserializePresenterLayout(JsonElement element) Optional resolution = default; Optional placeholderImageUri = default; Optional scalingMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("presenterId"u8)) @@ -122,8 +152,61 @@ internal static PresenterLayout DeserializePresenterLayout(JsonElement element) scalingMode = new ScalingMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PresenterLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), presenterId, supportId, Optional.ToNullable(supportPosition), Optional.ToNullable(supportAspectRatio), serializedAdditionalRawData); + } + + PresenterLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePresenterLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PresenterLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePresenterLayout(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PresenterLayout model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PresenterLayout(Response response) + { + if (response is null) + { + return null; } - return new PresenterLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode), presenterId, supportId, Optional.ToNullable(supportPosition), Optional.ToNullable(supportAspectRatio)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePresenterLayout(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.cs index ce38acf53809..a76ed9eca62c 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/PresenterLayout.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Configure the presenter layout. public partial class PresenterLayout : MediaCompositionLayout { - /// Initializes a new instance of PresenterLayout. + /// Initializes a new instance of . /// Id of the presenter input. /// Id of the support input. /// or is null. @@ -28,7 +29,7 @@ public PresenterLayout(string presenterId, string supportId) Kind = LayoutType.Presenter; } - /// Initializes a new instance of PresenterLayout. + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. @@ -37,7 +38,8 @@ public PresenterLayout(string presenterId, string supportId) /// Id of the support input. /// Position of the support stream. /// Aspect ratio of the support stream. - internal PresenterLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, string presenterId, string supportId, SupportPosition? supportPosition, double? supportAspectRatio) : base(kind, resolution, placeholderImageUri, scalingMode) + /// Keeps track of any properties unknown to the library. + internal PresenterLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, string presenterId, string supportId, SupportPosition? supportPosition, double? supportAspectRatio, Dictionary serializedAdditionalRawData) : base(kind, resolution, placeholderImageUri, scalingMode, serializedAdditionalRawData) { PresenterId = presenterId; SupportId = supportId; @@ -46,6 +48,11 @@ internal PresenterLayout(LayoutType kind, LayoutResolution resolution, string pl Kind = kind; } + /// Initializes a new instance of for deserialization. + internal PresenterLayout() + { + } + /// Id of the presenter input. public string PresenterId { get; set; } /// Id of the support input. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.Serialization.cs index 9db75fdf67d6..d078364b8300 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class RoomInput : IUtf8JsonSerializable + public partial class RoomInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoomInput DeserializeRoomInput(JsonElement element) + internal static RoomInput DeserializeRoomInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static RoomInput DeserializeRoomInput(JsonElement element) string id = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -53,8 +76,61 @@ internal static RoomInput DeserializeRoomInput(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoomInput(kind, placeholderImageUri.Value, id, serializedAdditionalRawData); + } + + RoomInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoomInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoomInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoomInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoomInput model) + { + if (model is null) + { + return null; } - return new RoomInput(kind, placeholderImageUri.Value, id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoomInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoomInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.cs index 7572b83c1957..4a012408c1b2 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// A Room to be used as an input. public partial class RoomInput : MediaInput { - /// Initializes a new instance of RoomInput. + /// Initializes a new instance of . /// Room identifier. /// is null. public RoomInput(string id) @@ -25,16 +26,22 @@ public RoomInput(string id) Kind = MediaInputType.Room; } - /// Initializes a new instance of RoomInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// Room identifier. - internal RoomInput(MediaInputType kind, string placeholderImageUri, string id) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal RoomInput(MediaInputType kind, string placeholderImageUri, string id, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Id = id; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal RoomInput() + { + } + /// Room identifier. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.Serialization.cs index 314eabe3c8fd..1e1927fccd9a 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class RoomOutput : IUtf8JsonSerializable + public partial class RoomOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoomOutput DeserializeRoomOutput(JsonElement element) + internal static RoomOutput DeserializeRoomOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; MediaOutputType kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -42,8 +65,61 @@ internal static RoomOutput DeserializeRoomOutput(JsonElement element) kind = new MediaOutputType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoomOutput(kind, id, serializedAdditionalRawData); + } + + RoomOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoomOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoomOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoomOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoomOutput model) + { + if (model is null) + { + return null; } - return new RoomOutput(kind, id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoomOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoomOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.cs index 8128c4bcb579..3460ca8cf541 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RoomOutput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// A Room to be used as an output. public partial class RoomOutput : MediaOutput { - /// Initializes a new instance of RoomOutput. + /// Initializes a new instance of . /// Room identifier. /// is null. public RoomOutput(string id) @@ -25,15 +26,21 @@ public RoomOutput(string id) Kind = MediaOutputType.Room; } - /// Initializes a new instance of RoomOutput. + /// Initializes a new instance of . /// Kind of media output. /// Room identifier. - internal RoomOutput(MediaOutputType kind, string id) : base(kind) + /// Keeps track of any properties unknown to the library. + internal RoomOutput(MediaOutputType kind, string id, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Id = id; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal RoomOutput() + { + } + /// Room identifier. public string Id { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.Serialization.cs index 5f799f05e9a9..9ac43d49336e 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class RtmpInput : IUtf8JsonSerializable + public partial class RtmpInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("streamKey"u8); writer.WriteStringValue(StreamKey); writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } writer.WritePropertyName("streamUrl"u8); writer.WriteStringValue(StreamUrl); if (Optional.IsDefined(Mode)) @@ -34,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RtmpInput DeserializeRtmpInput(JsonElement element) + internal static RtmpInput DeserializeRtmpInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +78,7 @@ internal static RtmpInput DeserializeRtmpInput(JsonElement element) Optional mode = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("streamKey"u8)) @@ -85,8 +115,61 @@ internal static RtmpInput DeserializeRtmpInput(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RtmpInput(kind, placeholderImageUri.Value, streamKey, resolution, streamUrl, Optional.ToNullable(mode), serializedAdditionalRawData); + } + + RtmpInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRtmpInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RtmpInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRtmpInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RtmpInput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RtmpInput(Response response) + { + if (response is null) + { + return null; } - return new RtmpInput(kind, placeholderImageUri.Value, streamKey, resolution, streamUrl, Optional.ToNullable(mode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRtmpInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.cs index 011844459433..2b91d1026108 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Rtmp stream to be used as an input. public partial class RtmpInput : MediaInput { - /// Initializes a new instance of RtmpInput. + /// Initializes a new instance of . /// Stream key of the stream. /// The dimensions of the scene or objects in the scene. /// The url of the stream. @@ -31,14 +32,15 @@ public RtmpInput(string streamKey, LayoutResolution resolution, string streamUrl Kind = MediaInputType.Rtmp; } - /// Initializes a new instance of RtmpInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// Stream key of the stream. /// The dimensions of the scene or objects in the scene. /// The url of the stream. /// Rtmp mode. - internal RtmpInput(MediaInputType kind, string placeholderImageUri, string streamKey, LayoutResolution resolution, string streamUrl, RtmpMode? mode) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal RtmpInput(MediaInputType kind, string placeholderImageUri, string streamKey, LayoutResolution resolution, string streamUrl, RtmpMode? mode, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { StreamKey = streamKey; Resolution = resolution; @@ -47,6 +49,11 @@ internal RtmpInput(MediaInputType kind, string placeholderImageUri, string strea Kind = kind; } + /// Initializes a new instance of for deserialization. + internal RtmpInput() + { + } + /// Stream key of the stream. public string StreamKey { get; set; } /// The dimensions of the scene or objects in the scene. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.Serialization.cs index ce65519ac2d2..0202196775f4 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.Serialization.cs @@ -5,21 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class RtmpOutput : IUtf8JsonSerializable + public partial class RtmpOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("streamKey"u8); writer.WriteStringValue(StreamKey); writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } writer.WritePropertyName("streamUrl"u8); writer.WriteStringValue(StreamUrl); if (Optional.IsDefined(Mode)) @@ -29,11 +44,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RtmpOutput DeserializeRtmpOutput(JsonElement element) + internal static RtmpOutput DeserializeRtmpOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +72,7 @@ internal static RtmpOutput DeserializeRtmpOutput(JsonElement element) string streamUrl = default; Optional mode = default; MediaOutputType kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("streamKey"u8)) @@ -74,8 +104,61 @@ internal static RtmpOutput DeserializeRtmpOutput(JsonElement element) kind = new MediaOutputType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RtmpOutput(kind, streamKey, resolution, streamUrl, Optional.ToNullable(mode), serializedAdditionalRawData); + } + + RtmpOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRtmpOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RtmpOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRtmpOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RtmpOutput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RtmpOutput(Response response) + { + if (response is null) + { + return null; } - return new RtmpOutput(kind, streamKey, resolution, streamUrl, Optional.ToNullable(mode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRtmpOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.cs index 19090c084995..4fe4b89ba2c3 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/RtmpOutput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Rtmp stream to be used as an output. public partial class RtmpOutput : MediaOutput { - /// Initializes a new instance of RtmpOutput. + /// Initializes a new instance of . /// Stream key of the stream. /// The dimensions of the scene or objects in the scene. /// The url of the stream. @@ -31,13 +32,14 @@ public RtmpOutput(string streamKey, LayoutResolution resolution, string streamUr Kind = MediaOutputType.Rtmp; } - /// Initializes a new instance of RtmpOutput. + /// Initializes a new instance of . /// Kind of media output. /// Stream key of the stream. /// The dimensions of the scene or objects in the scene. /// The url of the stream. /// Rtmp mode. - internal RtmpOutput(MediaOutputType kind, string streamKey, LayoutResolution resolution, string streamUrl, RtmpMode? mode) : base(kind) + /// Keeps track of any properties unknown to the library. + internal RtmpOutput(MediaOutputType kind, string streamKey, LayoutResolution resolution, string streamUrl, RtmpMode? mode, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { StreamKey = streamKey; Resolution = resolution; @@ -46,6 +48,11 @@ internal RtmpOutput(MediaOutputType kind, string streamKey, LayoutResolution res Kind = kind; } + /// Initializes a new instance of for deserialization. + internal RtmpOutput() + { + } + /// Stream key of the stream. public string StreamKey { get; set; } /// The dimensions of the scene or objects in the scene. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.Serialization.cs index f6f2cb4c1c32..60eb37a96f3f 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class ScreenShare : IUtf8JsonSerializable + public partial class ScreenShare : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("call"u8); writer.WriteStringValue(Call); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScreenShare DeserializeScreenShare(JsonElement element) + internal static ScreenShare DeserializeScreenShare(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ScreenShare DeserializeScreenShare(JsonElement element) string call = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("call"u8)) @@ -53,8 +76,61 @@ internal static ScreenShare DeserializeScreenShare(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScreenShare(kind, placeholderImageUri.Value, call, serializedAdditionalRawData); + } + + ScreenShare IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScreenShare(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScreenShare IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScreenShare(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScreenShare model) + { + if (model is null) + { + return null; } - return new ScreenShare(kind, placeholderImageUri.Value, call); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScreenShare(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScreenShare(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.cs index cb53a83cac44..ba87e6d0cd05 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/ScreenShare.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// The ScreenShare. public partial class ScreenShare : MediaInput { - /// Initializes a new instance of ScreenShare. + /// Initializes a new instance of . /// The id of the teams meeting or call. /// is null. public ScreenShare(string call) @@ -25,16 +26,22 @@ public ScreenShare(string call) Kind = MediaInputType.ScreenShare; } - /// Initializes a new instance of ScreenShare. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// The id of the teams meeting or call. - internal ScreenShare(MediaInputType kind, string placeholderImageUri, string call) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal ScreenShare(MediaInputType kind, string placeholderImageUri, string call, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Call = call; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal ScreenShare() + { + } + /// The id of the teams meeting or call. public string Call { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.Serialization.cs index 1ea93c7a794d..78de6c922536 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.Serialization.cs @@ -5,19 +5,34 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class SrtInput : IUtf8JsonSerializable + public partial class SrtInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } writer.WritePropertyName("streamUrl"u8); writer.WriteStringValue(StreamUrl); writer.WritePropertyName("kind"u8); @@ -27,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SrtInput DeserializeSrtInput(JsonElement element) + internal static SrtInput DeserializeSrtInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +69,7 @@ internal static SrtInput DeserializeSrtInput(JsonElement element) string streamUrl = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resolution"u8)) @@ -62,8 +92,61 @@ internal static SrtInput DeserializeSrtInput(JsonElement element) placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SrtInput(kind, placeholderImageUri.Value, resolution, streamUrl, serializedAdditionalRawData); + } + + SrtInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSrtInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SrtInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSrtInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SrtInput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SrtInput(Response response) + { + if (response is null) + { + return null; } - return new SrtInput(kind, placeholderImageUri.Value, resolution, streamUrl); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSrtInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.cs index a64e30f01fd3..064b26498b36 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Srt stream to be used as an input. public partial class SrtInput : MediaInput { - /// Initializes a new instance of SrtInput. + /// Initializes a new instance of . /// The dimensions of the scene or objects in the scene. /// The url of the stream. /// or is null. @@ -28,18 +29,24 @@ public SrtInput(LayoutResolution resolution, string streamUrl) Kind = MediaInputType.Srt; } - /// Initializes a new instance of SrtInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// The dimensions of the scene or objects in the scene. /// The url of the stream. - internal SrtInput(MediaInputType kind, string placeholderImageUri, LayoutResolution resolution, string streamUrl) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal SrtInput(MediaInputType kind, string placeholderImageUri, LayoutResolution resolution, string streamUrl, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Resolution = resolution; StreamUrl = streamUrl; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal SrtInput() + { + } + /// The dimensions of the scene or objects in the scene. public LayoutResolution Resolution { get; set; } /// The url of the stream. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.Serialization.cs index 9971daff747a..72aa4f2836b6 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class SrtOutput : IUtf8JsonSerializable + public partial class SrtOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } writer.WritePropertyName("streamUrl"u8); writer.WriteStringValue(StreamUrl); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SrtOutput DeserializeSrtOutput(JsonElement element) + internal static SrtOutput DeserializeSrtOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +63,7 @@ internal static SrtOutput DeserializeSrtOutput(JsonElement element) LayoutResolution resolution = default; string streamUrl = default; MediaOutputType kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resolution"u8)) @@ -51,8 +81,61 @@ internal static SrtOutput DeserializeSrtOutput(JsonElement element) kind = new MediaOutputType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SrtOutput(kind, resolution, streamUrl, serializedAdditionalRawData); + } + + SrtOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSrtOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SrtOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSrtOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SrtOutput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SrtOutput(Response response) + { + if (response is null) + { + return null; } - return new SrtOutput(kind, resolution, streamUrl); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSrtOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.cs index 711442b27c7c..906de80e219e 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/SrtOutput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// Srt stream to be used as an output. public partial class SrtOutput : MediaOutput { - /// Initializes a new instance of SrtOutput. + /// Initializes a new instance of . /// The dimensions of the scene or objects in the scene. /// The url of the stream. /// or is null. @@ -28,17 +29,23 @@ public SrtOutput(LayoutResolution resolution, string streamUrl) Kind = MediaOutputType.Srt; } - /// Initializes a new instance of SrtOutput. + /// Initializes a new instance of . /// Kind of media output. /// The dimensions of the scene or objects in the scene. /// The url of the stream. - internal SrtOutput(MediaOutputType kind, LayoutResolution resolution, string streamUrl) : base(kind) + /// Keeps track of any properties unknown to the library. + internal SrtOutput(MediaOutputType kind, LayoutResolution resolution, string streamUrl, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Resolution = resolution; StreamUrl = streamUrl; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal SrtOutput() + { + } + /// The dimensions of the scene or objects in the scene. public LayoutResolution Resolution { get; set; } /// The url of the stream. diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.Serialization.cs index 3084c5656b5c..014f9f746b0b 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class TeamsMeetingInput : IUtf8JsonSerializable + public partial class TeamsMeetingInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("teamsJoinUrl"u8); writer.WriteStringValue(TeamsJoinUrl); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TeamsMeetingInput DeserializeTeamsMeetingInput(JsonElement element) + internal static TeamsMeetingInput DeserializeTeamsMeetingInput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static TeamsMeetingInput DeserializeTeamsMeetingInput(JsonElement eleme string teamsJoinUrl = default; MediaInputType kind = default; Optional placeholderImageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("teamsJoinUrl"u8)) @@ -53,8 +76,61 @@ internal static TeamsMeetingInput DeserializeTeamsMeetingInput(JsonElement eleme placeholderImageUri = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TeamsMeetingInput(kind, placeholderImageUri.Value, teamsJoinUrl, serializedAdditionalRawData); + } + + TeamsMeetingInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTeamsMeetingInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TeamsMeetingInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTeamsMeetingInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TeamsMeetingInput model) + { + if (model is null) + { + return null; } - return new TeamsMeetingInput(kind, placeholderImageUri.Value, teamsJoinUrl); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TeamsMeetingInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTeamsMeetingInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.cs index e6f6c1f66ab3..2641d3b861d8 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingInput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// A Teams meeting to be used as an input. public partial class TeamsMeetingInput : MediaInput { - /// Initializes a new instance of TeamsMeetingInput. + /// Initializes a new instance of . /// The url from Teams to join the meeting. /// is null. public TeamsMeetingInput(string teamsJoinUrl) @@ -25,16 +26,22 @@ public TeamsMeetingInput(string teamsJoinUrl) Kind = MediaInputType.TeamsMeeting; } - /// Initializes a new instance of TeamsMeetingInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. /// The url from Teams to join the meeting. - internal TeamsMeetingInput(MediaInputType kind, string placeholderImageUri, string teamsJoinUrl) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal TeamsMeetingInput(MediaInputType kind, string placeholderImageUri, string teamsJoinUrl, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { TeamsJoinUrl = teamsJoinUrl; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal TeamsMeetingInput() + { + } + /// The url from Teams to join the meeting. public string TeamsJoinUrl { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.Serialization.cs index 066656b15ce8..c8f9be448a4f 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - public partial class TeamsMeetingOutput : IUtf8JsonSerializable + public partial class TeamsMeetingOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("teamsJoinUrl"u8); writer.WriteStringValue(TeamsJoinUrl); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TeamsMeetingOutput DeserializeTeamsMeetingOutput(JsonElement element) + internal static TeamsMeetingOutput DeserializeTeamsMeetingOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string teamsJoinUrl = default; MediaOutputType kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("teamsJoinUrl"u8)) @@ -42,8 +65,61 @@ internal static TeamsMeetingOutput DeserializeTeamsMeetingOutput(JsonElement ele kind = new MediaOutputType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TeamsMeetingOutput(kind, teamsJoinUrl, serializedAdditionalRawData); + } + + TeamsMeetingOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTeamsMeetingOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TeamsMeetingOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTeamsMeetingOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TeamsMeetingOutput model) + { + if (model is null) + { + return null; } - return new TeamsMeetingOutput(kind, teamsJoinUrl); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TeamsMeetingOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTeamsMeetingOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.cs index c1e505cb7a00..ca5c1d8038db 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/TeamsMeetingOutput.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.Communication.MediaComposition /// A Teams meeting to be used as an output. public partial class TeamsMeetingOutput : MediaOutput { - /// Initializes a new instance of TeamsMeetingOutput. + /// Initializes a new instance of . /// The url from Teams to join the meeting. /// is null. public TeamsMeetingOutput(string teamsJoinUrl) @@ -25,15 +26,21 @@ public TeamsMeetingOutput(string teamsJoinUrl) Kind = MediaOutputType.TeamsMeeting; } - /// Initializes a new instance of TeamsMeetingOutput. + /// Initializes a new instance of . /// Kind of media output. /// The url from Teams to join the meeting. - internal TeamsMeetingOutput(MediaOutputType kind, string teamsJoinUrl) : base(kind) + /// Keeps track of any properties unknown to the library. + internal TeamsMeetingOutput(MediaOutputType kind, string teamsJoinUrl, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { TeamsJoinUrl = teamsJoinUrl; Kind = kind; } + /// Initializes a new instance of for deserialization. + internal TeamsMeetingOutput() + { + } + /// The url from Teams to join the meeting. public string TeamsJoinUrl { get; set; } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.Serialization.cs index 4f08b8615154..94232a35d7d5 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.Serialization.cs @@ -5,23 +5,36 @@ #nullable disable +using System; using System.Text.Json; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - internal partial class UnknownInputGroup : IUtf8JsonSerializable + internal partial class UnknownInputGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(Position)) { writer.WritePropertyName("position"u8); - writer.WriteObjectValue(Position); + if (Position is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Position).Serialize(writer, options); + } } if (Optional.IsDefined(Width)) { @@ -43,63 +56,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } - writer.WriteEndObject(); - } - - internal static UnknownInputGroup DeserializeUnknownInputGroup(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - InputGroupType kind = "Unknown"; - Optional position = default; - Optional width = default; - Optional height = default; - Optional layer = default; - Optional scalingMode = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("kind"u8)) - { - kind = new InputGroupType(property.Value.GetString()); - continue; - } - if (property.NameEquals("position"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - position = InputPosition.DeserializeInputPosition(property.Value); - continue; - } - if (property.NameEquals("width"u8)) - { - width = property.Value.GetString(); - continue; - } - if (property.NameEquals("height"u8)) + foreach (var property in _serializedAdditionalRawData) { - height = property.Value.GetString(); - continue; - } - if (property.NameEquals("layer"u8)) - { - layer = property.Value.GetString(); - continue; - } - if (property.NameEquals("scalingMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scalingMode = new ScalingMode(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownInputGroup(kind, position.Value, width.Value, height.Value, layer.Value, Optional.ToNullable(scalingMode)); + writer.WriteEndObject(); + } + + internal static InputGroup DeserializeUnknownInputGroup(JsonElement element, ModelSerializerOptions options = default) => DeserializeInputGroup(element, options); + + InputGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownInputGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InputGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInputGroup(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.cs index 268a9cd7803d..fce20f6e78fc 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownInputGroup.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; namespace Azure.Communication.MediaComposition @@ -12,16 +14,22 @@ namespace Azure.Communication.MediaComposition /// The UnknownInputGroup. internal partial class UnknownInputGroup : InputGroup { - /// Initializes a new instance of UnknownInputGroup. + /// Initializes a new instance of . /// Kind of input group. /// The (x,y) position on scene or input group. /// The width of the input group container. Can be defined as pixels or percentage. /// The height of the input group container. Can be defined as pixels or percentage. /// The layer this input group should appear on. /// The scaling mode for the view of a video stream in a cell. - internal UnknownInputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode) : base(kind, position, width, height, layer, scalingMode) + /// Keeps track of any properties unknown to the library. + internal UnknownInputGroup(InputGroupType kind, InputPosition position, string width, string height, string layer, ScalingMode? scalingMode, Dictionary serializedAdditionalRawData) : base(kind, position, width, height, layer, scalingMode, serializedAdditionalRawData) { Kind = kind; } + + /// Initializes a new instance of for deserialization. + internal UnknownInputGroup() + { + } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.Serialization.cs index e38be3406697..d9107e723975 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.Serialization.cs @@ -5,23 +5,36 @@ #nullable disable +using System; using System.Text.Json; using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - internal partial class UnknownLayout : IUtf8JsonSerializable + internal partial class UnknownLayout : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(Resolution)) { writer.WritePropertyName("resolution"u8); - writer.WriteObjectValue(Resolution); + if (Resolution is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resolution).Serialize(writer, options); + } } if (Optional.IsDefined(PlaceholderImageUri)) { @@ -33,51 +46,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scalingMode"u8); writer.WriteStringValue(ScalingMode.Value.ToString()); } - writer.WriteEndObject(); - } - - internal static UnknownLayout DeserializeUnknownLayout(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - LayoutType kind = "Unknown"; - Optional resolution = default; - Optional placeholderImageUri = default; - Optional scalingMode = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("kind"u8)) - { - kind = new LayoutType(property.Value.GetString()); - continue; - } - if (property.NameEquals("resolution"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resolution = LayoutResolution.DeserializeLayoutResolution(property.Value); - continue; - } - if (property.NameEquals("placeholderImageUri"u8)) + foreach (var property in _serializedAdditionalRawData) { - placeholderImageUri = property.Value.GetString(); - continue; - } - if (property.NameEquals("scalingMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scalingMode = new ScalingMode(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownLayout(kind, resolution.Value, placeholderImageUri.Value, Optional.ToNullable(scalingMode)); + writer.WriteEndObject(); + } + + internal static MediaCompositionLayout DeserializeUnknownLayout(JsonElement element, ModelSerializerOptions options = default) => DeserializeMediaCompositionLayout(element, options); + + MediaCompositionLayout IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownLayout(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaCompositionLayout IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaCompositionLayout(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.cs index 04df819c2ef6..c265bcf7b19c 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownLayout.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; namespace Azure.Communication.MediaComposition @@ -12,14 +14,20 @@ namespace Azure.Communication.MediaComposition /// The UnknownLayout. internal partial class UnknownLayout : MediaCompositionLayout { - /// Initializes a new instance of UnknownLayout. + /// Initializes a new instance of . /// Kind of layout. /// The dimensions of the scene or objects in the scene. /// Set global placeholder image. /// The scaling mode for the view of a video stream in a cell. - internal UnknownLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode) : base(kind, resolution, placeholderImageUri, scalingMode) + /// Keeps track of any properties unknown to the library. + internal UnknownLayout(LayoutType kind, LayoutResolution resolution, string placeholderImageUri, ScalingMode? scalingMode, Dictionary serializedAdditionalRawData) : base(kind, resolution, placeholderImageUri, scalingMode, serializedAdditionalRawData) { Kind = kind; } + + /// Initializes a new instance of for deserialization. + internal UnknownLayout() + { + } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.Serialization.cs index 9d3ea51f199e..a7cf2cd31eb1 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.Serialization.cs @@ -5,15 +5,22 @@ #nullable disable +using System; using System.Text.Json; +using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - internal partial class UnknownMediaInput : IUtf8JsonSerializable + internal partial class UnknownMediaInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -22,31 +29,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placeholderImageUri"u8); writer.WriteStringValue(PlaceholderImageUri); } - writer.WriteEndObject(); - } - - internal static UnknownMediaInput DeserializeUnknownMediaInput(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MediaInputType kind = "Unknown"; - Optional placeholderImageUri = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("kind"u8)) - { - kind = new MediaInputType(property.Value.GetString()); - continue; - } - if (property.NameEquals("placeholderImageUri"u8)) + foreach (var property in _serializedAdditionalRawData) { - placeholderImageUri = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownMediaInput(kind, placeholderImageUri.Value); + writer.WriteEndObject(); + } + + internal static MediaInput DeserializeUnknownMediaInput(JsonElement element, ModelSerializerOptions options = default) => DeserializeMediaInput(element, options); + + MediaInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownMediaInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaInput(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.cs index 33f7e7c07a04..29e558aacd0e 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaInput.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; namespace Azure.Communication.MediaComposition @@ -12,12 +14,18 @@ namespace Azure.Communication.MediaComposition /// The UnknownMediaInput. internal partial class UnknownMediaInput : MediaInput { - /// Initializes a new instance of UnknownMediaInput. + /// Initializes a new instance of . /// Kind of media input. /// Image url to be used if participant has no video stream. - internal UnknownMediaInput(MediaInputType kind, string placeholderImageUri) : base(kind, placeholderImageUri) + /// Keeps track of any properties unknown to the library. + internal UnknownMediaInput(MediaInputType kind, string placeholderImageUri, Dictionary serializedAdditionalRawData) : base(kind, placeholderImageUri, serializedAdditionalRawData) { Kind = kind; } + + /// Initializes a new instance of for deserialization. + internal UnknownMediaInput() + { + } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.Serialization.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.Serialization.cs index fc16cb8ef290..49c5c05816c9 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.Serialization.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.Serialization.cs @@ -5,37 +5,63 @@ #nullable disable +using System; using System.Text.Json; +using Azure.Communication.MediaComposition.Models; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.MediaComposition { - internal partial class UnknownMediaOutput : IUtf8JsonSerializable + internal partial class UnknownMediaOutput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownMediaOutput DeserializeUnknownMediaOutput(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - MediaOutputType kind = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) + foreach (var property in _serializedAdditionalRawData) { - kind = new MediaOutputType(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownMediaOutput(kind); + writer.WriteEndObject(); + } + + internal static MediaOutput DeserializeUnknownMediaOutput(JsonElement element, ModelSerializerOptions options = default) => DeserializeMediaOutput(element, options); + + MediaOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownMediaOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MediaOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMediaOutput(doc.RootElement, options); } } } diff --git a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.cs b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.cs index c88482ef76aa..658a30d3b1c5 100644 --- a/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.cs +++ b/sdk/communication/Azure.Communication.MediaComposition/src/Generated/Models/UnknownMediaOutput.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Communication.MediaComposition.Models; namespace Azure.Communication.MediaComposition @@ -12,11 +14,17 @@ namespace Azure.Communication.MediaComposition /// The UnknownMediaOutput. internal partial class UnknownMediaOutput : MediaOutput { - /// Initializes a new instance of UnknownMediaOutput. + /// Initializes a new instance of . /// Kind of media output. - internal UnknownMediaOutput(MediaOutputType kind) : base(kind) + /// Keeps track of any properties unknown to the library. + internal UnknownMediaOutput(MediaOutputType kind, Dictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) { Kind = kind; } + + /// Initializes a new instance of for deserialization. + internal UnknownMediaOutput() + { + } } } diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/CommunicationNetworkTraversalRestClient.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/CommunicationNetworkTraversalRestClient.cs index 020043e6600f..b0723153ddd4 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/CommunicationNetworkTraversalRestClient.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/CommunicationNetworkTraversalRestClient.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateIssueRelayConfigurationRequest(string id, RouteType? RouteType = routeType, Ttl = ttl }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.Serialization.cs index 44a29eddb1ab..51ed5a96eed4 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.NetworkTraversal { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.cs index c1808741c1d5..be05172a9497 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.NetworkTraversal /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index a2a778e01d3d..1ae1d5d8d567 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.NetworkTraversal { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.cs index b7d129d0c365..a0bcf9136fb2 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.NetworkTraversal @@ -13,7 +14,10 @@ namespace Azure.Communication.NetworkTraversal /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.Serialization.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.Serialization.cs index d9b8088ef2e5..8bb41de8b118 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.Serialization.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.Serialization.cs @@ -9,15 +9,21 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.NetworkTraversal { [JsonConverter(typeof(CommunicationIceServerConverter))] - public partial class CommunicationIceServer : IUtf8JsonSerializable + public partial class CommunicationIceServer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("urls"u8); writer.WriteStartArray(); @@ -32,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Credential); writer.WritePropertyName("routeType"u8); writer.WriteStringValue(RouteType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationIceServer DeserializeCommunicationIceServer(JsonElement element) + internal static CommunicationIceServer DeserializeCommunicationIceServer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +65,7 @@ internal static CommunicationIceServer DeserializeCommunicationIceServer(JsonEle string username = default; string credential = default; RouteType routeType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("urls"u8)) @@ -72,8 +93,61 @@ internal static CommunicationIceServer DeserializeCommunicationIceServer(JsonEle routeType = new RouteType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationIceServer(urls, username, credential, routeType, serializedAdditionalRawData); + } + + CommunicationIceServer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationIceServer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationIceServer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationIceServer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationIceServer model) + { + if (model is null) + { + return null; } - return new CommunicationIceServer(urls, username, credential, routeType); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationIceServer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationIceServer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class CommunicationIceServerConverter : JsonConverter diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.cs index e434ba4ace4e..26fac91b46bf 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationIceServer.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.NetworkTraversal /// An instance of a STUN/TURN server with credentials to be used for ICE negotiation. public partial class CommunicationIceServer { - /// Initializes a new instance of CommunicationIceServer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of STUN/TURN server URLs. /// User account name which uniquely identifies the credentials. /// Credential for the server. @@ -33,17 +36,24 @@ public CommunicationIceServer(IEnumerable urls, string username, string RouteType = routeType; } - /// Initializes a new instance of CommunicationIceServer. + /// Initializes a new instance of . /// List of STUN/TURN server URLs. /// User account name which uniquely identifies the credentials. /// Credential for the server. /// The routing methodology to where the ICE server will be located from the client. "any" will have higher reliability while "nearest" will have lower latency. It is recommended to default to use the "any" routing method unless there are specific scenarios which minimizing latency is critical. - internal CommunicationIceServer(IList urls, string username, string credential, RouteType routeType) + /// Keeps track of any properties unknown to the library. + internal CommunicationIceServer(IList urls, string username, string credential, RouteType routeType, Dictionary serializedAdditionalRawData) { Urls = urls; Username = username; Credential = credential; RouteType = routeType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationIceServer() + { } /// List of STUN/TURN server URLs. diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.Serialization.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.Serialization.cs index 2c2e1174bdf1..bb4ea032aaea 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.Serialization.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.Serialization.cs @@ -9,15 +9,21 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.NetworkTraversal { [JsonConverter(typeof(CommunicationRelayConfigurationConverter))] - public partial class CommunicationRelayConfiguration : IUtf8JsonSerializable + public partial class CommunicationRelayConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("expiresOn"u8); writer.WriteStringValue(ExpiresOn, "O"); @@ -25,20 +31,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IceServers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationRelayConfiguration DeserializeCommunicationRelayConfiguration(JsonElement element) + internal static CommunicationRelayConfiguration DeserializeCommunicationRelayConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset expiresOn = default; IList iceServers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("expiresOn"u8)) @@ -56,8 +84,61 @@ internal static CommunicationRelayConfiguration DeserializeCommunicationRelayCon iceServers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationRelayConfiguration(expiresOn, iceServers, serializedAdditionalRawData); + } + + CommunicationRelayConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationRelayConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationRelayConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationRelayConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationRelayConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationRelayConfiguration(Response response) + { + if (response is null) + { + return null; } - return new CommunicationRelayConfiguration(expiresOn, iceServers); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationRelayConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class CommunicationRelayConfigurationConverter : JsonConverter diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.cs index 9e83e547151c..58623e7dae9b 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.NetworkTraversal /// A relay configuration containing the STUN/TURN URLs and credentials. public partial class CommunicationRelayConfiguration { - /// Initializes a new instance of CommunicationRelayConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The date for which the username and credentials are not longer valid. Will be 48 hours from request time. /// An array representing the credentials and the STUN/TURN server URLs for use in ICE negotiations. /// is null. @@ -27,13 +30,20 @@ public CommunicationRelayConfiguration(DateTimeOffset expiresOn, IEnumerable Initializes a new instance of CommunicationRelayConfiguration. + /// Initializes a new instance of . /// The date for which the username and credentials are not longer valid. Will be 48 hours from request time. /// An array representing the credentials and the STUN/TURN server URLs for use in ICE negotiations. - internal CommunicationRelayConfiguration(DateTimeOffset expiresOn, IList iceServers) + /// Keeps track of any properties unknown to the library. + internal CommunicationRelayConfiguration(DateTimeOffset expiresOn, IList iceServers, Dictionary serializedAdditionalRawData) { ExpiresOn = expiresOn; IceServers = iceServers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationRelayConfiguration() + { } /// The date for which the username and credentials are not longer valid. Will be 48 hours from request time. diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.Serialization.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.Serialization.cs index 7adb2e3153cf..8b3a501a8ff4 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.NetworkTraversal { - internal partial class CommunicationRelayConfigurationRequest : IUtf8JsonSerializable + internal partial class CommunicationRelayConfigurationRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -30,7 +38,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ttl"u8); writer.WriteNumberValue(Ttl.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationRelayConfigurationRequest DeserializeCommunicationRelayConfigurationRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional routeType = default; + Optional ttl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("routeType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + routeType = new RouteType(property.Value.GetString()); + continue; + } + if (property.NameEquals("ttl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ttl = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationRelayConfigurationRequest(id.Value, Optional.ToNullable(routeType), Optional.ToNullable(ttl), serializedAdditionalRawData); + } + + CommunicationRelayConfigurationRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationRelayConfigurationRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationRelayConfigurationRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationRelayConfigurationRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationRelayConfigurationRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationRelayConfigurationRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationRelayConfigurationRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.cs b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.cs index 026331e35f55..bb1cdff8e16e 100644 --- a/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.cs +++ b/sdk/communication/Azure.Communication.NetworkTraversal/src/Generated/Models/CommunicationRelayConfigurationRequest.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.NetworkTraversal { /// Request for a CommunicationRelayConfiguration. internal partial class CommunicationRelayConfigurationRequest { - /// Initializes a new instance of CommunicationRelayConfigurationRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationRelayConfigurationRequest() { } + /// Initializes a new instance of . + /// An identity to be associated with telemetry for data relayed using the returned credentials. Must be an existing ACS user identity. If not provided, the telemetry will not contain an associated identity value. + /// Filter the routing methodology returned. If not provided, will return all route types in separate ICE servers. + /// The credential Time-To-Live (TTL), in seconds. The default value will be used if given value exceeds it. + /// Keeps track of any properties unknown to the library. + internal CommunicationRelayConfigurationRequest(string id, RouteType? routeType, int? ttl, Dictionary serializedAdditionalRawData) + { + Id = id; + RouteType = routeType; + Ttl = ttl; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// An identity to be associated with telemetry for data relayed using the returned credentials. Must be an existing ACS user identity. If not provided, the telemetry will not contain an associated identity value. public string Id { get; set; } /// Filter the routing methodology returned. If not provided, will return all route types in separate ICE servers. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs index bd0b67a16813..d190a80e98b4 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs @@ -187,9 +187,7 @@ internal HttpMessage CreateSearchAvailablePhoneNumbersRequest(string twoLetterIs request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; return message; } @@ -334,9 +332,7 @@ internal HttpMessage CreatePurchasePhoneNumbersRequest(string searchId) { SearchId = searchId }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -393,9 +389,7 @@ internal HttpMessage CreateUpdateCapabilitiesRequest(string phoneNumber, PhoneNu Calling = calling, Sms = sms }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.Serialization.cs index 2f93e1737fe6..6d6eb79b8519 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.cs index 1c3df16a382c..090245c66820 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 6770997f62f9..e2e35c0c9789 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,12 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error"u8)) + { + error = CommunicationError.DeserializeCommunicationError(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.cs index a127abaa7a46..79b5ddac05c2 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,5 +14,21 @@ namespace Azure.Communication.PhoneNumbers /// The Communication Services error. internal partial class CommunicationErrorResponse { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.Serialization.cs index 9157d6862673..1da6cd507b68 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.Serialization.cs @@ -5,13 +5,148 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class OfferingsResponse + internal partial class OfferingsResponse : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(PhoneNumberOfferings)) + { + writer.WritePropertyName("phoneNumberOfferings"u8); + writer.WriteStartArray(); + foreach (var item in PhoneNumberOfferings) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OfferingsResponse DeserializeOfferingsResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> phoneNumberOfferings = default; + Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phoneNumberOfferings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PhoneNumberOffering.DeserializePhoneNumberOffering(item)); + } + phoneNumberOfferings = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OfferingsResponse(Optional.ToList(phoneNumberOfferings), nextLink.Value, serializedAdditionalRawData); + } + + OfferingsResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOfferingsResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OfferingsResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOfferingsResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OfferingsResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OfferingsResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOfferingsResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.cs index 2909edd4a814..b47940b6e7d0 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/OfferingsResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,5 +14,18 @@ namespace Azure.Communication.PhoneNumbers /// Represents a wrapper around a list of offerings. internal partial class OfferingsResponse { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Represents the underlying list of offerings. + /// Represents the URL link to the next page. + /// Keeps track of any properties unknown to the library. + internal OfferingsResponse(IReadOnlyList phoneNumberOfferings, string nextLink, Dictionary serializedAdditionalRawData) + { + PhoneNumberOfferings = phoneNumberOfferings; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.Serialization.cs index e5de7fa0248b..0fcd54211e3c 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberAdministrativeDivision + public partial class PhoneNumberAdministrativeDivision : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberAdministrativeDivision DeserializePhoneNumberAdministrativeDivision(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("localizedName"u8); + writer.WriteStringValue(LocalizedName); + writer.WritePropertyName("abbreviatedName"u8); + writer.WriteStringValue(AbbreviatedName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberAdministrativeDivision DeserializePhoneNumberAdministrativeDivision(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string localizedName = default; string abbreviatedName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("localizedName"u8)) @@ -32,8 +65,61 @@ internal static PhoneNumberAdministrativeDivision DeserializePhoneNumberAdminist abbreviatedName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberAdministrativeDivision(localizedName, abbreviatedName); + return new PhoneNumberAdministrativeDivision(localizedName, abbreviatedName, serializedAdditionalRawData); + } + + PhoneNumberAdministrativeDivision IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberAdministrativeDivision(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberAdministrativeDivision IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberAdministrativeDivision(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberAdministrativeDivision model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberAdministrativeDivision(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberAdministrativeDivision(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.cs index f5707c854cc8..fb19d7d151c2 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAdministrativeDivision.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// Represents an administrative division. e.g. state or province. public partial class PhoneNumberAdministrativeDivision { - /// Initializes a new instance of PhoneNumberAdministrativeDivision. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Represents the localized name of the administrative division of the locality. e.g. state or province localized name. /// Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). /// or is null. @@ -26,6 +30,22 @@ internal PhoneNumberAdministrativeDivision(string localizedName, string abbrevia AbbreviatedName = abbreviatedName; } + /// Initializes a new instance of . + /// Represents the localized name of the administrative division of the locality. e.g. state or province localized name. + /// Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). + /// Keeps track of any properties unknown to the library. + internal PhoneNumberAdministrativeDivision(string localizedName, string abbreviatedName, Dictionary serializedAdditionalRawData) + { + LocalizedName = localizedName; + AbbreviatedName = abbreviatedName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberAdministrativeDivision() + { + } + /// Represents the localized name of the administrative division of the locality. e.g. state or province localized name. public string LocalizedName { get; } /// Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.Serialization.cs index 7d351e26390d..97421436322a 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberAreaCode + public partial class PhoneNumberAreaCode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberAreaCode DeserializePhoneNumberAreaCode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AreaCode)) + { + writer.WritePropertyName("areaCode"u8); + writer.WriteStringValue(AreaCode); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberAreaCode DeserializePhoneNumberAreaCode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional areaCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("areaCode"u8)) @@ -26,8 +60,61 @@ internal static PhoneNumberAreaCode DeserializePhoneNumberAreaCode(JsonElement e areaCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberAreaCode(areaCode.Value); + return new PhoneNumberAreaCode(areaCode.Value, serializedAdditionalRawData); + } + + PhoneNumberAreaCode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberAreaCode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberAreaCode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberAreaCode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberAreaCode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberAreaCode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberAreaCode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.cs index bc377cb16c9e..e049b6c1e7dc 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCode.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.PhoneNumbers { /// Represents an Area Code. public partial class PhoneNumberAreaCode { - /// Initializes a new instance of PhoneNumberAreaCode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PhoneNumberAreaCode() { } - /// Initializes a new instance of PhoneNumberAreaCode. + /// Initializes a new instance of . /// An area code. - internal PhoneNumberAreaCode(string areaCode) + /// Keeps track of any properties unknown to the library. + internal PhoneNumberAreaCode(string areaCode, Dictionary serializedAdditionalRawData) { AreaCode = areaCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An area code. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.Serialization.cs index 3fdf99741e69..7380807df3da 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.Serialization.cs @@ -5,13 +5,141 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberAreaCodes + internal partial class PhoneNumberAreaCodes : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("areaCodes"u8); + writer.WriteStartArray(); + foreach (var item in AreaCodes) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberAreaCodes DeserializePhoneNumberAreaCodes(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList areaCodes = default; + Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("areaCodes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PhoneNumberAreaCode.DeserializePhoneNumberAreaCode(item)); + } + areaCodes = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberAreaCodes(areaCodes, nextLink.Value, serializedAdditionalRawData); + } + + PhoneNumberAreaCodes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberAreaCodes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberAreaCodes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberAreaCodes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberAreaCodes model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberAreaCodes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberAreaCodes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.cs index f0970bda7417..d6144028e81f 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberAreaCodes.cs @@ -15,5 +15,23 @@ namespace Azure.Communication.PhoneNumbers /// The list of available area codes. internal partial class PhoneNumberAreaCodes { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Represents a list of available toll-free area codes. + /// Represents the URL link to the next page. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberAreaCodes(IReadOnlyList areaCodes, string nextLink, Dictionary serializedAdditionalRawData) + { + AreaCodes = areaCodes; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberAreaCodes() + { + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.Serialization.cs index f3aa6ee51118..847fb83840be 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberCapabilities : IUtf8JsonSerializable + public partial class PhoneNumberCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("calling"u8); writer.WriteStringValue(Calling.ToString()); writer.WritePropertyName("sms"u8); writer.WriteStringValue(Sms.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhoneNumberCapabilities DeserializePhoneNumberCapabilities(JsonElement element) + internal static PhoneNumberCapabilities DeserializePhoneNumberCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } PhoneNumberCapabilityType calling = default; PhoneNumberCapabilityType sms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("calling"u8)) @@ -42,8 +65,61 @@ internal static PhoneNumberCapabilities DeserializePhoneNumberCapabilities(JsonE sms = new PhoneNumberCapabilityType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberCapabilities(calling, sms, serializedAdditionalRawData); + } + + PhoneNumberCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberCapabilities model) + { + if (model is null) + { + return null; } - return new PhoneNumberCapabilities(calling, sms); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.cs index eae738a305b8..08ad11ecb299 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilities.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.PhoneNumbers { /// Capabilities of a phone number. public partial class PhoneNumberCapabilities { - /// Initializes a new instance of PhoneNumberCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Capability value for calling. /// Capability value for SMS. public PhoneNumberCapabilities(PhoneNumberCapabilityType calling, PhoneNumberCapabilityType sms) @@ -19,6 +25,22 @@ public PhoneNumberCapabilities(PhoneNumberCapabilityType calling, PhoneNumberCap Sms = sms; } + /// Initializes a new instance of . + /// Capability value for calling. + /// Capability value for SMS. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberCapabilities(PhoneNumberCapabilityType calling, PhoneNumberCapabilityType sms, Dictionary serializedAdditionalRawData) + { + Calling = calling; + Sms = sms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberCapabilities() + { + } + /// Capability value for calling. public PhoneNumberCapabilityType Calling { get; set; } /// Capability value for SMS. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.Serialization.cs index 9759fc057032..f34380dc39f8 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberCapabilitiesRequest : IUtf8JsonSerializable + internal partial class PhoneNumberCapabilitiesRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Calling)) { @@ -25,7 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sms"u8); writer.WriteStringValue(Sms.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PhoneNumberCapabilitiesRequest DeserializePhoneNumberCapabilitiesRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional calling = default; + Optional sms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("calling"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + calling = new PhoneNumberCapabilityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("sms"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sms = new PhoneNumberCapabilityType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberCapabilitiesRequest(Optional.ToNullable(calling), Optional.ToNullable(sms), serializedAdditionalRawData); + } + + PhoneNumberCapabilitiesRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberCapabilitiesRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberCapabilitiesRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberCapabilitiesRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberCapabilitiesRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberCapabilitiesRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberCapabilitiesRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.cs index be31848dda9f..a42dfb74c78a 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCapabilitiesRequest.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.PhoneNumbers { /// Capabilities of a phone number. internal partial class PhoneNumberCapabilitiesRequest { - /// Initializes a new instance of PhoneNumberCapabilitiesRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PhoneNumberCapabilitiesRequest() { } + /// Initializes a new instance of . + /// Capability value for calling. + /// Capability value for SMS. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberCapabilitiesRequest(PhoneNumberCapabilityType? calling, PhoneNumberCapabilityType? sms, Dictionary serializedAdditionalRawData) + { + Calling = calling; + Sms = sms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Capability value for calling. public PhoneNumberCapabilityType? Calling { get; set; } /// Capability value for SMS. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.Serialization.cs index f213efbd7fe1..53e2ed3e62fb 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.Serialization.cs @@ -5,15 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberCost + public partial class PhoneNumberCost : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberCost DeserializePhoneNumberCost(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("amount"u8); + writer.WriteNumberValue(Amount); + writer.WritePropertyName("currencyCode"u8); + writer.WriteStringValue(IsoCurrencySymbol); + writer.WritePropertyName("billingFrequency"u8); + writer.WriteStringValue(BillingFrequency.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberCost DeserializePhoneNumberCost(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +55,7 @@ internal static PhoneNumberCost DeserializePhoneNumberCost(JsonElement element) double amount = default; string currencyCode = default; BillingFrequency billingFrequency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("amount"u8)) @@ -38,8 +73,61 @@ internal static PhoneNumberCost DeserializePhoneNumberCost(JsonElement element) billingFrequency = new BillingFrequency(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberCost(amount, currencyCode, billingFrequency); + return new PhoneNumberCost(amount, currencyCode, billingFrequency, serializedAdditionalRawData); + } + + PhoneNumberCost IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberCost(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberCost IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberCost(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberCost model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberCost(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberCost(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.cs index 0ca469d8659c..c2d569672874 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCost.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// The incurred cost for a single phone number. public partial class PhoneNumberCost { - /// Initializes a new instance of PhoneNumberCost. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The cost amount. /// The ISO 4217 currency code for the cost amount, e.g. USD. /// The frequency with which the cost gets billed. @@ -27,6 +31,24 @@ internal PhoneNumberCost(double amount, string isoCurrencySymbol, BillingFrequen BillingFrequency = billingFrequency; } + /// Initializes a new instance of . + /// The cost amount. + /// The ISO 4217 currency code for the cost amount, e.g. USD. + /// The frequency with which the cost gets billed. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberCost(double amount, string isoCurrencySymbol, BillingFrequency billingFrequency, Dictionary serializedAdditionalRawData) + { + Amount = amount; + IsoCurrencySymbol = isoCurrencySymbol; + BillingFrequency = billingFrequency; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberCost() + { + } + /// The cost amount. public double Amount { get; } /// The frequency with which the cost gets billed. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.Serialization.cs index d8a96fba2fce..c1ab06156658 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.Serialization.cs @@ -5,13 +5,148 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberCountries + internal partial class PhoneNumberCountries : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Countries)) + { + writer.WritePropertyName("countries"u8); + writer.WriteStartArray(); + foreach (var item in Countries) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberCountries DeserializePhoneNumberCountries(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> countries = default; + Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("countries"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PhoneNumberCountry.DeserializePhoneNumberCountry(item)); + } + countries = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberCountries(Optional.ToList(countries), nextLink.Value, serializedAdditionalRawData); + } + + PhoneNumberCountries IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberCountries(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberCountries IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberCountries(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberCountries model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberCountries(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberCountries(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.cs index b067fc6095a1..3bfbf79e9f08 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountries.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,5 +14,18 @@ namespace Azure.Communication.PhoneNumbers /// Represents a wrapper around a list of countries. internal partial class PhoneNumberCountries { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Represents the underlying list of countries. + /// Represents the URL link to the next page. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberCountries(IReadOnlyList countries, string nextLink, Dictionary serializedAdditionalRawData) + { + Countries = countries; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.Serialization.cs index 5bb5f4ef6df9..007bffdd2b45 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberCountry + public partial class PhoneNumberCountry : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberCountry DeserializePhoneNumberCountry(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("localizedName"u8); + writer.WriteStringValue(LocalizedName); + writer.WritePropertyName("countryCode"u8); + writer.WriteStringValue(CountryCode); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberCountry DeserializePhoneNumberCountry(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string localizedName = default; string countryCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("localizedName"u8)) @@ -32,8 +65,61 @@ internal static PhoneNumberCountry DeserializePhoneNumberCountry(JsonElement ele countryCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberCountry(localizedName, countryCode); + return new PhoneNumberCountry(localizedName, countryCode, serializedAdditionalRawData); + } + + PhoneNumberCountry IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberCountry(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberCountry IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberCountry(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberCountry model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberCountry(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberCountry(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.cs index 316e4d8b5f35..820529d2b3e0 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberCountry.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// Represents a country. public partial class PhoneNumberCountry { - /// Initializes a new instance of PhoneNumberCountry. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Represents the name of the country. /// Represents the abbreviated name of the country. /// or is null. @@ -26,6 +30,22 @@ internal PhoneNumberCountry(string localizedName, string countryCode) CountryCode = countryCode; } + /// Initializes a new instance of . + /// Represents the name of the country. + /// Represents the abbreviated name of the country. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberCountry(string localizedName, string countryCode, Dictionary serializedAdditionalRawData) + { + LocalizedName = localizedName; + CountryCode = countryCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberCountry() + { + } + /// Represents the name of the country. public string LocalizedName { get; } /// Represents the abbreviated name of the country. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.Serialization.cs index 2cf74d35e6ee..422e8665bbfa 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.Serialization.cs @@ -5,13 +5,148 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberLocalities + internal partial class PhoneNumberLocalities : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(PhoneNumberLocalitiesValue)) + { + writer.WritePropertyName("phoneNumberLocalities"u8); + writer.WriteStartArray(); + foreach (var item in PhoneNumberLocalitiesValue) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberLocalities DeserializePhoneNumberLocalities(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> phoneNumberLocalities = default; + Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phoneNumberLocalities"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PhoneNumberLocality.DeserializePhoneNumberLocality(item)); + } + phoneNumberLocalities = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberLocalities(Optional.ToList(phoneNumberLocalities), nextLink.Value, serializedAdditionalRawData); + } + + PhoneNumberLocalities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberLocalities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberLocalities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberLocalities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberLocalities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberLocalities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberLocalities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.cs index d47e359970b7..1be81a40e2c6 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocalities.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,5 +14,18 @@ namespace Azure.Communication.PhoneNumbers /// Represents a wrapper around a list of cities or towns. internal partial class PhoneNumberLocalities { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Represents the underlying list of localities, e.g. cities or town. + /// Represents the URL link to the next page. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberLocalities(IReadOnlyList phoneNumberLocalitiesValue, string nextLink, Dictionary serializedAdditionalRawData) + { + PhoneNumberLocalitiesValue = phoneNumberLocalitiesValue; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.Serialization.cs index 6aae7c0fa98c..276c507bdf91 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.Serialization.cs @@ -5,21 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberLocality + public partial class PhoneNumberLocality : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberLocality DeserializePhoneNumberLocality(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("localizedName"u8); + writer.WriteStringValue(LocalizedName); + if (Optional.IsDefined(AdministrativeDivision)) + { + writer.WritePropertyName("administrativeDivision"u8); + if (AdministrativeDivision is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdministrativeDivision).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberLocality DeserializePhoneNumberLocality(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string localizedName = default; Optional administrativeDivision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("localizedName"u8)) @@ -36,8 +79,61 @@ internal static PhoneNumberLocality DeserializePhoneNumberLocality(JsonElement e administrativeDivision = PhoneNumberAdministrativeDivision.DeserializePhoneNumberAdministrativeDivision(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberLocality(localizedName, administrativeDivision.Value); + return new PhoneNumberLocality(localizedName, administrativeDivision.Value, serializedAdditionalRawData); + } + + PhoneNumberLocality IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberLocality(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberLocality IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberLocality(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberLocality model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberLocality(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberLocality(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.cs index 51c5052452b6..d6b788e843e7 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberLocality.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// Represents a locality. public partial class PhoneNumberLocality { - /// Initializes a new instance of PhoneNumberLocality. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Represents the localized name of the locality. /// is null. internal PhoneNumberLocality(string localizedName) @@ -23,13 +27,20 @@ internal PhoneNumberLocality(string localizedName) LocalizedName = localizedName; } - /// Initializes a new instance of PhoneNumberLocality. + /// Initializes a new instance of . /// Represents the localized name of the locality. /// Represents an administrative division. e.g. state or province. - internal PhoneNumberLocality(string localizedName, PhoneNumberAdministrativeDivision administrativeDivision) + /// Keeps track of any properties unknown to the library. + internal PhoneNumberLocality(string localizedName, PhoneNumberAdministrativeDivision administrativeDivision, Dictionary serializedAdditionalRawData) { LocalizedName = localizedName; AdministrativeDivision = administrativeDivision; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberLocality() + { } /// Represents the localized name of the locality. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.Serialization.cs index 9522ef96e5ea..bcd94e882eac 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.Serialization.cs @@ -5,15 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberOffering + public partial class PhoneNumberOffering : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberOffering DeserializePhoneNumberOffering(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PhoneNumberType)) + { + writer.WritePropertyName("phoneNumberType"u8); + writer.WriteStringValue(PhoneNumberType.Value.ToString()); + } + if (Optional.IsDefined(AssignmentType)) + { + writer.WritePropertyName("assignmentType"u8); + writer.WriteStringValue(AssignmentType.Value.ToString()); + } + if (Optional.IsDefined(AvailableCapabilities)) + { + writer.WritePropertyName("availableCapabilities"u8); + if (AvailableCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AvailableCapabilities).Serialize(writer, options); + } + } + writer.WritePropertyName("cost"u8); + if (Cost is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Cost).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberOffering DeserializePhoneNumberOffering(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +81,7 @@ internal static PhoneNumberOffering DeserializePhoneNumberOffering(JsonElement e Optional assignmentType = default; Optional availableCapabilities = default; PhoneNumberCost cost = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("phoneNumberType"u8)) @@ -56,8 +116,61 @@ internal static PhoneNumberOffering DeserializePhoneNumberOffering(JsonElement e cost = PhoneNumberCost.DeserializePhoneNumberCost(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberOffering(Optional.ToNullable(phoneNumberType), Optional.ToNullable(assignmentType), availableCapabilities.Value, cost); + return new PhoneNumberOffering(Optional.ToNullable(phoneNumberType), Optional.ToNullable(assignmentType), availableCapabilities.Value, cost, serializedAdditionalRawData); + } + + PhoneNumberOffering IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberOffering(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberOffering IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberOffering(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberOffering model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberOffering(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberOffering(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.cs index 45d516a222d4..0cefc468b0b7 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOffering.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// Represents a phone number capability offering. public partial class PhoneNumberOffering { - /// Initializes a new instance of PhoneNumberOffering. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The incurred cost for a single phone number. /// is null. internal PhoneNumberOffering(PhoneNumberCost cost) @@ -23,17 +27,24 @@ internal PhoneNumberOffering(PhoneNumberCost cost) Cost = cost; } - /// Initializes a new instance of PhoneNumberOffering. + /// Initializes a new instance of . /// Represents the number type of the offering. /// Represents the assignment type of the offering. /// Capabilities of a phone number. /// The incurred cost for a single phone number. - internal PhoneNumberOffering(PhoneNumberType? phoneNumberType, PhoneNumberAssignmentType? assignmentType, PhoneNumberCapabilities availableCapabilities, PhoneNumberCost cost) + /// Keeps track of any properties unknown to the library. + internal PhoneNumberOffering(PhoneNumberType? phoneNumberType, PhoneNumberAssignmentType? assignmentType, PhoneNumberCapabilities availableCapabilities, PhoneNumberCost cost, Dictionary serializedAdditionalRawData) { PhoneNumberType = phoneNumberType; AssignmentType = assignmentType; AvailableCapabilities = availableCapabilities; Cost = cost; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberOffering() + { } /// Represents the number type of the offering. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.Serialization.cs index 1fbf34bafb1a..fdc4eb90470b 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.Serialization.cs @@ -6,12 +6,179 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberOperation + internal partial class PhoneNumberOperation : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("operationType"u8); + writer.WriteStringValue(OperationType.ToString()); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(ResourceLocation)) + { + writer.WritePropertyName("resourceLocation"u8); + writer.WriteStringValue(ResourceLocation); + } + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime, "O"); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberOperation DeserializePhoneNumberOperation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PhoneNumberOperationType operationType = default; + PhoneNumberOperationStatus status = default; + Optional resourceLocation = default; + DateTimeOffset createdDateTime = default; + Optional error = default; + string id = default; + Optional lastActionDateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operationType"u8)) + { + operationType = new PhoneNumberOperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new PhoneNumberOperationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceLocation"u8)) + { + resourceLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = CommunicationError.DeserializeCommunicationError(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastActionDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastActionDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberOperation(operationType, status, resourceLocation.Value, createdDateTime, error.Value, id, Optional.ToNullable(lastActionDateTime), serializedAdditionalRawData); + } + + PhoneNumberOperation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberOperation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberOperation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberOperation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberOperation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberOperation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberOperation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.cs index f728623a7b49..dfdaa09d40e5 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberOperation.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,5 +14,28 @@ namespace Azure.Communication.PhoneNumbers /// The PhoneNumberOperation. internal partial class PhoneNumberOperation { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The type of operation, e.g. Search. + /// Status of operation. + /// URL for retrieving the result of the operation, if any. + /// The date that the operation was created. + /// The Communication Services error. + /// Id of operation. + /// The most recent date that the operation was changed. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberOperation(PhoneNumberOperationType operationType, PhoneNumberOperationStatus status, string resourceLocation, DateTimeOffset createdDateTime, CommunicationError error, string id, DateTimeOffset? lastActionDateTime, Dictionary serializedAdditionalRawData) + { + OperationType = operationType; + Status = status; + ResourceLocation = resourceLocation; + CreatedDateTime = createdDateTime; + Error = error; + Id = id; + LastActionDateTime = lastActionDateTime; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.Serialization.cs index 464bd6bee35d..008e89be8183 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberPurchaseRequest : IUtf8JsonSerializable + internal partial class PhoneNumberPurchaseRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SearchId)) { writer.WritePropertyName("searchId"u8); writer.WriteStringValue(SearchId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PhoneNumberPurchaseRequest DeserializePhoneNumberPurchaseRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional searchId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("searchId"u8)) + { + searchId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberPurchaseRequest(searchId.Value, serializedAdditionalRawData); + } + + PhoneNumberPurchaseRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberPurchaseRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberPurchaseRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberPurchaseRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberPurchaseRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberPurchaseRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberPurchaseRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.cs index daa860248281..dbc6eab5674a 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberPurchaseRequest.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.PhoneNumbers { /// The phone number search purchase request. internal partial class PhoneNumberPurchaseRequest { - /// Initializes a new instance of PhoneNumberPurchaseRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PhoneNumberPurchaseRequest() { } + /// Initializes a new instance of . + /// The search id. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberPurchaseRequest(string searchId, Dictionary serializedAdditionalRawData) + { + SearchId = searchId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The search id. public string SearchId { get; set; } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.Serialization.cs index 50b216a7f11b..b3990fd66c2b 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PhoneNumberSearchRequest : IUtf8JsonSerializable + internal partial class PhoneNumberSearchRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("phoneNumberType"u8); writer.WriteStringValue(PhoneNumberType.ToString()); writer.WritePropertyName("assignmentType"u8); writer.WriteStringValue(AssignmentType.ToString()); writer.WritePropertyName("capabilities"u8); - writer.WriteObjectValue(Capabilities); + if (Capabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capabilities).Serialize(writer, options); + } if (Optional.IsDefined(AreaCode)) { writer.WritePropertyName("areaCode"u8); @@ -31,7 +46,121 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("quantity"u8); writer.WriteNumberValue(Quantity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PhoneNumberSearchRequest DeserializePhoneNumberSearchRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PhoneNumberType phoneNumberType = default; + PhoneNumberAssignmentType assignmentType = default; + PhoneNumberCapabilities capabilities = default; + Optional areaCode = default; + Optional quantity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phoneNumberType"u8)) + { + phoneNumberType = new PhoneNumberType(property.Value.GetString()); + continue; + } + if (property.NameEquals("assignmentType"u8)) + { + assignmentType = new PhoneNumberAssignmentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("capabilities"u8)) + { + capabilities = PhoneNumberCapabilities.DeserializePhoneNumberCapabilities(property.Value); + continue; + } + if (property.NameEquals("areaCode"u8)) + { + areaCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("quantity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quantity = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhoneNumberSearchRequest(phoneNumberType, assignmentType, capabilities, areaCode.Value, Optional.ToNullable(quantity), serializedAdditionalRawData); + } + + PhoneNumberSearchRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberSearchRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberSearchRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberSearchRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberSearchRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberSearchRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberSearchRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs index de6278dcaa40..03fc4c480e72 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// Represents a phone number search request to find phone numbers. Found phone numbers are temporarily held for a following purchase. internal partial class PhoneNumberSearchRequest { - /// Initializes a new instance of PhoneNumberSearchRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of phone numbers to search for, e.g. geographic, or tollFree. /// The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. /// Capabilities of a phone number. @@ -27,6 +31,28 @@ public PhoneNumberSearchRequest(PhoneNumberType phoneNumberType, PhoneNumberAssi Capabilities = capabilities; } + /// Initializes a new instance of . + /// The type of phone numbers to search for, e.g. geographic, or tollFree. + /// The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. + /// Capabilities of a phone number. + /// The area code of the desired phone number, e.g. 425. + /// The quantity of desired phone numbers. The default value is 1. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberSearchRequest(PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities, string areaCode, int? quantity, Dictionary serializedAdditionalRawData) + { + PhoneNumberType = phoneNumberType; + AssignmentType = assignmentType; + Capabilities = capabilities; + AreaCode = areaCode; + Quantity = quantity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberSearchRequest() + { + } + /// The type of phone numbers to search for, e.g. geographic, or tollFree. public PhoneNumberType PhoneNumberType { get; } /// The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.Serialization.cs index f0174e0580f1..88db68bdbe26 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.Serialization.cs @@ -8,14 +8,78 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PhoneNumberSearchResult + public partial class PhoneNumberSearchResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhoneNumberSearchResult DeserializePhoneNumberSearchResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("searchId"u8); + writer.WriteStringValue(SearchId); + writer.WritePropertyName("phoneNumbers"u8); + writer.WriteStartArray(); + foreach (var item in PhoneNumbers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("phoneNumberType"u8); + writer.WriteStringValue(PhoneNumberType.ToString()); + writer.WritePropertyName("assignmentType"u8); + writer.WriteStringValue(AssignmentType.ToString()); + writer.WritePropertyName("capabilities"u8); + if (Capabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capabilities).Serialize(writer, options); + } + writer.WritePropertyName("cost"u8); + if (Cost is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Cost).Serialize(writer, options); + } + writer.WritePropertyName("searchExpiresBy"u8); + writer.WriteStringValue(SearchExpiresOn, "O"); + if (Optional.IsDefined(ErrorCode)) + { + writer.WritePropertyName("errorCode"u8); + writer.WriteNumberValue(ErrorCode.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhoneNumberSearchResult DeserializePhoneNumberSearchResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +93,7 @@ internal static PhoneNumberSearchResult DeserializePhoneNumberSearchResult(JsonE DateTimeOffset searchExpiresBy = default; Optional errorCode = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("searchId"u8)) @@ -89,8 +154,61 @@ internal static PhoneNumberSearchResult DeserializePhoneNumberSearchResult(JsonE error = new PhoneNumberSearchResultError(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhoneNumberSearchResult(searchId, phoneNumbers, phoneNumberType, assignmentType, capabilities, cost, searchExpiresBy, Optional.ToNullable(errorCode), Optional.ToNullable(error)); + return new PhoneNumberSearchResult(searchId, phoneNumbers, phoneNumberType, assignmentType, capabilities, cost, searchExpiresBy, Optional.ToNullable(errorCode), Optional.ToNullable(error), serializedAdditionalRawData); + } + + PhoneNumberSearchResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoneNumberSearchResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoneNumberSearchResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoneNumberSearchResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoneNumberSearchResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoneNumberSearchResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoneNumberSearchResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs index 51e7b701a890..1e2628e17f0a 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.PhoneNumbers /// The result of a phone number search operation. public partial class PhoneNumberSearchResult { - /// Initializes a new instance of PhoneNumberSearchResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The search id. /// The phone numbers that are available. Can be fewer than the desired search quantity. /// The phone number's type, e.g. geographic, or tollFree. @@ -40,7 +43,7 @@ internal PhoneNumberSearchResult(string searchId, IEnumerable phoneNumbe SearchExpiresOn = searchExpiresOn; } - /// Initializes a new instance of PhoneNumberSearchResult. + /// Initializes a new instance of . /// The search id. /// The phone numbers that are available. Can be fewer than the desired search quantity. /// The phone number's type, e.g. geographic, or tollFree. @@ -50,7 +53,8 @@ internal PhoneNumberSearchResult(string searchId, IEnumerable phoneNumbe /// The date that this search result expires and phone numbers are no longer on hold. A search result expires in less than 15min, e.g. 2020-11-19T16:31:49.048Z. /// The error code of the search. /// Mapping Error Messages to Codes. - internal PhoneNumberSearchResult(string searchId, IReadOnlyList phoneNumbers, PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities, PhoneNumberCost cost, DateTimeOffset searchExpiresOn, int? errorCode, PhoneNumberSearchResultError? error) + /// Keeps track of any properties unknown to the library. + internal PhoneNumberSearchResult(string searchId, IReadOnlyList phoneNumbers, PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities, PhoneNumberCost cost, DateTimeOffset searchExpiresOn, int? errorCode, PhoneNumberSearchResultError? error, Dictionary serializedAdditionalRawData) { SearchId = searchId; PhoneNumbers = phoneNumbers; @@ -61,6 +65,12 @@ internal PhoneNumberSearchResult(string searchId, IReadOnlyList phoneNum SearchExpiresOn = searchExpiresOn; ErrorCode = errorCode; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberSearchResult() + { } /// The search id. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.Serialization.cs index 121ad6858388..30bbe3c2421b 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.Serialization.cs @@ -6,15 +6,72 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - public partial class PurchasedPhoneNumber + public partial class PurchasedPhoneNumber : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PurchasedPhoneNumber DeserializePurchasedPhoneNumber(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + writer.WritePropertyName("countryCode"u8); + writer.WriteStringValue(CountryCode); + writer.WritePropertyName("phoneNumberType"u8); + writer.WriteStringValue(PhoneNumberType.ToString()); + writer.WritePropertyName("capabilities"u8); + if (Capabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capabilities).Serialize(writer, options); + } + writer.WritePropertyName("assignmentType"u8); + writer.WriteStringValue(AssignmentType.ToString()); + writer.WritePropertyName("purchaseDate"u8); + writer.WriteStringValue(PurchaseDate, "O"); + writer.WritePropertyName("cost"u8); + if (Cost is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Cost).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PurchasedPhoneNumber DeserializePurchasedPhoneNumber(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +84,7 @@ internal static PurchasedPhoneNumber DeserializePurchasedPhoneNumber(JsonElement PhoneNumberAssignmentType assignmentType = default; DateTimeOffset purchaseDate = default; PhoneNumberCost cost = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -69,8 +127,61 @@ internal static PurchasedPhoneNumber DeserializePurchasedPhoneNumber(JsonElement cost = PhoneNumberCost.DeserializePhoneNumberCost(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PurchasedPhoneNumber(id, phoneNumber, countryCode, phoneNumberType, capabilities, assignmentType, purchaseDate, cost); + return new PurchasedPhoneNumber(id, phoneNumber, countryCode, phoneNumberType, capabilities, assignmentType, purchaseDate, cost, serializedAdditionalRawData); + } + + PurchasedPhoneNumber IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePurchasedPhoneNumber(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PurchasedPhoneNumber IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePurchasedPhoneNumber(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PurchasedPhoneNumber model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PurchasedPhoneNumber(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePurchasedPhoneNumber(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs index 7956b202c46e..0d4e98ed6bcd 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.PhoneNumbers @@ -13,7 +14,10 @@ namespace Azure.Communication.PhoneNumbers /// Represents a purchased phone number. public partial class PurchasedPhoneNumber { - /// Initializes a new instance of PurchasedPhoneNumber. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The id of the phone number, e.g. 11234567890. /// String of the E.164 format of the phone number, e.g. +11234567890. /// The ISO 3166-2 code of the phone number's country, e.g. US. @@ -41,6 +45,34 @@ internal PurchasedPhoneNumber(string id, string phoneNumber, string countryCode, Cost = cost; } + /// Initializes a new instance of . + /// The id of the phone number, e.g. 11234567890. + /// String of the E.164 format of the phone number, e.g. +11234567890. + /// The ISO 3166-2 code of the phone number's country, e.g. US. + /// The phone number's type, e.g. geographic, tollFree. + /// Capabilities of a phone number. + /// The assignment type of the phone number. A phone number can be assigned to a person, or to an application. + /// The date and time that the phone number was purchased. + /// The incurred cost for a single phone number. + /// Keeps track of any properties unknown to the library. + internal PurchasedPhoneNumber(string id, string phoneNumber, string countryCode, PhoneNumberType phoneNumberType, PhoneNumberCapabilities capabilities, PhoneNumberAssignmentType assignmentType, DateTimeOffset purchaseDate, PhoneNumberCost cost, Dictionary serializedAdditionalRawData) + { + Id = id; + PhoneNumber = phoneNumber; + CountryCode = countryCode; + PhoneNumberType = phoneNumberType; + Capabilities = capabilities; + AssignmentType = assignmentType; + PurchaseDate = purchaseDate; + Cost = cost; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PurchasedPhoneNumber() + { + } + /// The id of the phone number, e.g. 11234567890. public string Id { get; } /// String of the E.164 format of the phone number, e.g. +11234567890. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.Serialization.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.Serialization.cs index 651a113277fb..b1ebd3e8a305 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.Serialization.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.Serialization.cs @@ -5,13 +5,141 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.PhoneNumbers { - internal partial class PurchasedPhoneNumbers + internal partial class PurchasedPhoneNumbers : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("phoneNumbers"u8); + writer.WriteStartArray(); + foreach (var item in PhoneNumbers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PurchasedPhoneNumbers DeserializePurchasedPhoneNumbers(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList phoneNumbers = default; + Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phoneNumbers"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PurchasedPhoneNumber.DeserializePurchasedPhoneNumber(item)); + } + phoneNumbers = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PurchasedPhoneNumbers(phoneNumbers, nextLink.Value, serializedAdditionalRawData); + } + + PurchasedPhoneNumbers IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePurchasedPhoneNumbers(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PurchasedPhoneNumbers IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePurchasedPhoneNumbers(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PurchasedPhoneNumbers model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PurchasedPhoneNumbers(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePurchasedPhoneNumbers(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.cs index aef96e4aeb89..a3c85402c792 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumbers.cs @@ -15,5 +15,23 @@ namespace Azure.Communication.PhoneNumbers /// The list of purchased phone numbers. internal partial class PurchasedPhoneNumbers { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Represents a list of phone numbers. + /// Represents the URL link to the next page of phone number results. + /// Keeps track of any properties unknown to the library. + internal PurchasedPhoneNumbers(IReadOnlyList phoneNumbers, string nextLink, Dictionary serializedAdditionalRawData) + { + PhoneNumbers = phoneNumbers; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PurchasedPhoneNumbers() + { + } } } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs index 6704e4ec780d..6e896a548048 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs @@ -14,62 +14,42 @@ namespace Azure.Communication.PhoneNumbers /// Model factory for models. public static partial class PhoneNumbersModelFactory { - /// Initializes a new instance of PhoneNumberAreaCode. + /// Initializes a new instance of . /// An area code. /// A new instance for mocking. public static PhoneNumberAreaCode PhoneNumberAreaCode(string areaCode = null) { - return new PhoneNumberAreaCode(areaCode); + return new PhoneNumberAreaCode(areaCode, default); } - /// Initializes a new instance of PhoneNumberCountry. + /// Initializes a new instance of . /// Represents the name of the country. /// Represents the abbreviated name of the country. - /// or is null. /// A new instance for mocking. public static PhoneNumberCountry PhoneNumberCountry(string localizedName = null, string countryCode = null) { - if (localizedName == null) - { - throw new ArgumentNullException(nameof(localizedName)); - } - if (countryCode == null) - { - throw new ArgumentNullException(nameof(countryCode)); - } - - return new PhoneNumberCountry(localizedName, countryCode); + return new PhoneNumberCountry(localizedName, countryCode, default); } - /// Initializes a new instance of PhoneNumberLocality. + /// Initializes a new instance of . /// Represents the localized name of the locality. /// Represents an administrative division. e.g. state or province. /// A new instance for mocking. public static PhoneNumberLocality PhoneNumberLocality(string localizedName = null, PhoneNumberAdministrativeDivision administrativeDivision = null) { - return new PhoneNumberLocality(localizedName, administrativeDivision); + return new PhoneNumberLocality(localizedName, administrativeDivision, default); } - /// Initializes a new instance of PhoneNumberAdministrativeDivision. + /// Initializes a new instance of . /// Represents the localized name of the administrative division of the locality. e.g. state or province localized name. /// Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). - /// or is null. /// A new instance for mocking. public static PhoneNumberAdministrativeDivision PhoneNumberAdministrativeDivision(string localizedName = null, string abbreviatedName = null) { - if (localizedName == null) - { - throw new ArgumentNullException(nameof(localizedName)); - } - if (abbreviatedName == null) - { - throw new ArgumentNullException(nameof(abbreviatedName)); - } - - return new PhoneNumberAdministrativeDivision(localizedName, abbreviatedName); + return new PhoneNumberAdministrativeDivision(localizedName, abbreviatedName, default); } - /// Initializes a new instance of PhoneNumberOffering. + /// Initializes a new instance of . /// Represents the number type of the offering. /// Represents the assignment type of the offering. /// Capabilities of a phone number. @@ -77,26 +57,20 @@ public static PhoneNumberAdministrativeDivision PhoneNumberAdministrativeDivisio /// A new instance for mocking. public static PhoneNumberOffering PhoneNumberOffering(PhoneNumberType? phoneNumberType = null, PhoneNumberAssignmentType? assignmentType = null, PhoneNumberCapabilities availableCapabilities = null, PhoneNumberCost cost = null) { - return new PhoneNumberOffering(phoneNumberType, assignmentType, availableCapabilities, cost); + return new PhoneNumberOffering(phoneNumberType, assignmentType, availableCapabilities, cost, default); } - /// Initializes a new instance of PhoneNumberCost. + /// Initializes a new instance of . /// The cost amount. /// The ISO 4217 currency code for the cost amount, e.g. USD. /// The frequency with which the cost gets billed. - /// is null. /// A new instance for mocking. public static PhoneNumberCost PhoneNumberCost(double amount = default, string isoCurrencySymbol = null, BillingFrequency billingFrequency = default) { - if (isoCurrencySymbol == null) - { - throw new ArgumentNullException(nameof(isoCurrencySymbol)); - } - - return new PhoneNumberCost(amount, isoCurrencySymbol, billingFrequency); + return new PhoneNumberCost(amount, isoCurrencySymbol, billingFrequency, default); } - /// Initializes a new instance of PhoneNumberSearchResult. + /// Initializes a new instance of . /// The search id. /// The phone numbers that are available. Can be fewer than the desired search quantity. /// The phone number's type, e.g. geographic, or tollFree. @@ -111,7 +85,7 @@ public static PhoneNumberSearchResult PhoneNumberSearchResult(string searchId = { phoneNumbers ??= new List(); - return new PhoneNumberSearchResult(searchId, phoneNumbers?.ToList(), phoneNumberType, assignmentType, capabilities, cost, searchExpiresOn, errorCode, error); + return new PhoneNumberSearchResult(searchId, phoneNumbers?.ToList(), phoneNumberType, assignmentType, capabilities, cost, searchExpiresOn, errorCode, error, default); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.Serialization.cs index c9a5c4faf051..fc69dab42858 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.cs index dcced68254c8..1b319ecc9d4e 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.Rooms /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index a2904c49f4c9..3beaae3a082d 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.cs index e95bb9bd1f60..0428e3aa1c75 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Rooms @@ -13,7 +14,10 @@ namespace Azure.Communication.Rooms /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.Serialization.cs index b9fd5bb03c94..df3a25a21dda 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.Serialization.cs @@ -6,15 +6,50 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - public partial class CommunicationRoom + public partial class CommunicationRoom : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationRoom DeserializeCommunicationRoom(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedAt, "O"); + writer.WritePropertyName("validFrom"u8); + writer.WriteStringValue(ValidFrom, "O"); + writer.WritePropertyName("validUntil"u8); + writer.WriteStringValue(ValidUntil, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationRoom DeserializeCommunicationRoom(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +58,7 @@ internal static CommunicationRoom DeserializeCommunicationRoom(JsonElement eleme DateTimeOffset createdAt = default; DateTimeOffset validFrom = default; DateTimeOffset validUntil = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -45,8 +81,61 @@ internal static CommunicationRoom DeserializeCommunicationRoom(JsonElement eleme validUntil = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationRoom(id, createdAt, validFrom, validUntil); + return new CommunicationRoom(id, createdAt, validFrom, validUntil, serializedAdditionalRawData); + } + + CommunicationRoom IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationRoom(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationRoom IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationRoom(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationRoom model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationRoom(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationRoom(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.cs index 6152ccef763f..70255465364e 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CommunicationRoom.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Rooms @@ -13,7 +14,10 @@ namespace Azure.Communication.Rooms /// The meeting room. public partial class CommunicationRoom { - /// Initializes a new instance of CommunicationRoom. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Unique identifier of a room. This id is server generated. /// The timestamp when the room was created at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. @@ -29,6 +33,26 @@ internal CommunicationRoom(string id, DateTimeOffset createdAt, DateTimeOffset v ValidUntil = validUntil; } + /// Initializes a new instance of . + /// Unique identifier of a room. This id is server generated. + /// The timestamp when the room was created at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. + /// The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. + /// The timestamp from when the room can no longer be joined. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. + /// Keeps track of any properties unknown to the library. + internal CommunicationRoom(string id, DateTimeOffset createdAt, DateTimeOffset validFrom, DateTimeOffset validUntil, Dictionary serializedAdditionalRawData) + { + Id = id; + CreatedAt = createdAt; + ValidFrom = validFrom; + ValidUntil = validUntil; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationRoom() + { + } + /// Unique identifier of a room. This id is server generated. public string Id { get; } /// The timestamp when the room was created at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.Serialization.cs index 5c6152f90fbf..b1506f5fb1c1 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class CreateRoomRequest : IUtf8JsonSerializable + internal partial class CreateRoomRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ValidFrom)) { @@ -32,11 +40,133 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Participants) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CreateRoomRequest DeserializeCreateRoomRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional validFrom = default; + Optional validUntil = default; + Optional> participants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validFrom"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validFrom = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("validUntil"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validUntil = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("participants"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ParticipantProperties.DeserializeParticipantProperties(property0.Value)); + } + participants = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateRoomRequest(Optional.ToNullable(validFrom), Optional.ToNullable(validUntil), Optional.ToDictionary(participants), serializedAdditionalRawData); + } + + CreateRoomRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateRoomRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateRoomRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateRoomRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateRoomRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateRoomRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateRoomRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.cs index 7351b76ce871..ee71532c618e 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/CreateRoomRequest.cs @@ -14,12 +14,28 @@ namespace Azure.Communication.Rooms /// Request payload for creating new room. internal partial class CreateRoomRequest { - /// Initializes a new instance of CreateRoomRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CreateRoomRequest() { Participants = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. The default value is the current date time. + /// The timestamp from when the room can no longer be joined. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. The default value is the current date time plus 180 days. + /// (Optional) Participants to be invited to the room. + /// Keeps track of any properties unknown to the library. + internal CreateRoomRequest(DateTimeOffset? validFrom, DateTimeOffset? validUntil, IDictionary participants, Dictionary serializedAdditionalRawData) + { + ValidFrom = validFrom; + ValidUntil = validUntil; + Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. The default value is the current date time. public DateTimeOffset? ValidFrom { get; set; } /// The timestamp from when the room can no longer be joined. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. The default value is the current date time plus 180 days. diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.Serialization.cs index 71da1a89db76..34a87f35b036 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class ParticipantProperties : IUtf8JsonSerializable + internal partial class ParticipantProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Role != null) { @@ -24,7 +32,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteNull("role"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ParticipantProperties DeserializeParticipantProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ParticipantRole? role = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("role"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + role = null; + continue; + } + role = new ParticipantRole(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ParticipantProperties(role, serializedAdditionalRawData); + } + + ParticipantProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.cs index ca88606c7aec..5aa9e792c37c 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantProperties.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.Rooms { /// The ParticipantProperties. internal partial class ParticipantProperties { - /// Initializes a new instance of ParticipantProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The role of a room participant. The default value is Attendee. public ParticipantProperties(ParticipantRole? role) { Role = role; } + + /// Initializes a new instance of . + /// The role of a room participant. The default value is Attendee. + /// Keeps track of any properties unknown to the library. + internal ParticipantProperties(ParticipantRole? role, Dictionary serializedAdditionalRawData) + { + Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; + } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.Serialization.cs index 722ae4ebc70d..4f79aeadc0b8 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class ParticipantsCollection + internal partial class ParticipantsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ParticipantsCollection DeserializeParticipantsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ParticipantsCollection DeserializeParticipantsCollection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static ParticipantsCollection DeserializeParticipantsCollection(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ParticipantsCollection(value, nextLink.Value); + return new ParticipantsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ParticipantsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.cs index f9fd6d12f738..513df6849812 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/ParticipantsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Rooms /// A collection of participants in a room. internal partial class ParticipantsCollection { - /// Initializes a new instance of ParticipantsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A collection of participants. /// is null. internal ParticipantsCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal ParticipantsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ParticipantsCollection. + /// Initializes a new instance of . /// A collection of participants. /// If there are more participants that can be retrieved, the next link will be populated. - internal ParticipantsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ParticipantsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ParticipantsCollection() + { } /// A collection of participants. diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.Serialization.cs index a52b7a0990d2..76b89006fdc6 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - public partial class RoomParticipant + public partial class RoomParticipant : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoomParticipant DeserializeRoomParticipant(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("rawId"u8); + writer.WriteStringValue(RawId); + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoomParticipant DeserializeRoomParticipant(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string rawId = default; ParticipantRole role = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rawId"u8)) @@ -32,8 +65,61 @@ internal static RoomParticipant DeserializeRoomParticipant(JsonElement element) role = new ParticipantRole(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoomParticipant(rawId, role); + return new RoomParticipant(rawId, role, serializedAdditionalRawData); + } + + RoomParticipant IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoomParticipant(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoomParticipant IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoomParticipant(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoomParticipant model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoomParticipant(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoomParticipant(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.cs index b5b301eb12b2..a52ac9f44ef0 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomParticipant.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Rooms @@ -13,5 +14,23 @@ namespace Azure.Communication.Rooms /// A participant of the room. public partial class RoomParticipant { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Raw ID representation of the communication identifier. Please refer to the following document for additional information on Raw ID. <br> https://learn.microsoft.com/azure/communication-services/concepts/identifiers?pivots=programming-language-rest#raw-id-representation. + /// The role of a room participant. The default value is Attendee. + /// Keeps track of any properties unknown to the library. + internal RoomParticipant(string rawId, ParticipantRole role, Dictionary serializedAdditionalRawData) + { + RawId = rawId; + Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RoomParticipant() + { + } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.Serialization.cs index cbd29c77aabd..625538a11320 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class RoomsCollection + internal partial class RoomsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoomsCollection DeserializeRoomsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoomsCollection DeserializeRoomsCollection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static RoomsCollection DeserializeRoomsCollection(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoomsCollection(value, nextLink.Value); + return new RoomsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + RoomsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoomsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoomsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoomsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoomsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoomsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoomsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.cs index 99edb8412bbd..6eb66d966262 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/RoomsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.Communication.Rooms /// A collection of rooms. internal partial class RoomsCollection { - /// Initializes a new instance of RoomsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A collection of rooms. /// is null. internal RoomsCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal RoomsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RoomsCollection. + /// Initializes a new instance of . /// A collection of rooms. /// If there are more rooms that can be retrieved, the next link will be populated. - internal RoomsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoomsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RoomsCollection() + { } /// A collection of rooms. diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.Serialization.cs index 46e9fb66f09c..ae5f2a55cc1d 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class UpdateParticipantsRequest : IUtf8JsonSerializable + internal partial class UpdateParticipantsRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Participants)) { @@ -22,11 +30,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Participants) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UpdateParticipantsRequest DeserializeUpdateParticipantsRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> participants = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("participants"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ParticipantProperties.DeserializeParticipantProperties(property0.Value)); + } + participants = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateParticipantsRequest(Optional.ToDictionary(participants), serializedAdditionalRawData); + } + + UpdateParticipantsRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateParticipantsRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateParticipantsRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateParticipantsRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateParticipantsRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateParticipantsRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateParticipantsRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.cs index 32ca40fe7704..68b7105174ac 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateParticipantsRequest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.Communication.Rooms /// Participants to be updated in the room. internal partial class UpdateParticipantsRequest { - /// Initializes a new instance of UpdateParticipantsRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateParticipantsRequest() { Participants = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Participants to be updated. + /// Keeps track of any properties unknown to the library. + internal UpdateParticipantsRequest(IDictionary participants, Dictionary serializedAdditionalRawData) + { + Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Participants to be updated. public IDictionary Participants { get; } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.Serialization.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.Serialization.cs index d80ade67f726..a8264118ba12 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Rooms { - internal partial class UpdateRoomRequest : IUtf8JsonSerializable + internal partial class UpdateRoomRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ValidFrom)) { @@ -25,7 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("validUntil"u8); writer.WriteStringValue(ValidUntil.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UpdateRoomRequest DeserializeUpdateRoomRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional validFrom = default; + Optional validUntil = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validFrom"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validFrom = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("validUntil"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validUntil = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateRoomRequest(Optional.ToNullable(validFrom), Optional.ToNullable(validUntil), serializedAdditionalRawData); + } + + UpdateRoomRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateRoomRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateRoomRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateRoomRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateRoomRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateRoomRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateRoomRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.cs index 4320b21cf4aa..55986017a549 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/Models/UpdateRoomRequest.cs @@ -6,17 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.Rooms { /// Request payload for updating a room. internal partial class UpdateRoomRequest { - /// Initializes a new instance of UpdateRoomRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateRoomRequest() { } + /// Initializes a new instance of . + /// (Optional) The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. + /// (Optional) The timestamp from when the room can no longer be joined. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. + /// Keeps track of any properties unknown to the library. + internal UpdateRoomRequest(DateTimeOffset? validFrom, DateTimeOffset? validUntil, Dictionary serializedAdditionalRawData) + { + ValidFrom = validFrom; + ValidUntil = validUntil; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// (Optional) The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. public DateTimeOffset? ValidFrom { get; set; } /// (Optional) The timestamp from when the room can no longer be joined. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/ParticipantsRestClient.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/ParticipantsRestClient.cs index eff40ff8144d..5c730f691d1d 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/ParticipantsRestClient.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/ParticipantsRestClient.cs @@ -132,9 +132,7 @@ internal HttpMessage CreateUpdateRequest(string roomId, IDictionary Model factory for models. public static partial class RoomsModelFactory { - /// Initializes a new instance of CommunicationRoom. + /// Initializes a new instance of . /// Unique identifier of a room. This id is server generated. /// The timestamp when the room was created at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// The timestamp from when the room is open for joining. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. /// The timestamp from when the room can no longer be joined. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. - /// is null. /// A new instance for mocking. public static CommunicationRoom CommunicationRoom(string id = null, DateTimeOffset createdAt = default, DateTimeOffset validFrom = default, DateTimeOffset validUntil = default) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - return new CommunicationRoom(id, createdAt, validFrom, validUntil); + return new CommunicationRoom(id, createdAt, validFrom, validUntil, default); } } } diff --git a/sdk/communication/Azure.Communication.Rooms/src/Generated/RoomsRestClient.cs b/sdk/communication/Azure.Communication.Rooms/src/Generated/RoomsRestClient.cs index a2a04f329880..88f7b64df248 100644 --- a/sdk/communication/Azure.Communication.Rooms/src/Generated/RoomsRestClient.cs +++ b/sdk/communication/Azure.Communication.Rooms/src/Generated/RoomsRestClient.cs @@ -66,9 +66,7 @@ internal HttpMessage CreateCreateRequest(DateTimeOffset? validFrom, DateTimeOffs } } var model = createRoomRequest; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } @@ -259,9 +257,7 @@ internal HttpMessage CreateUpdateRequest(string roomId, DateTimeOffset? validFro ValidFrom = validFrom, ValidUntil = validUntil }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message; } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/CommunicationShortCodesModelFactory.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/CommunicationShortCodesModelFactory.cs index 21c8ea9b71e9..2ca328323c96 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/CommunicationShortCodesModelFactory.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/CommunicationShortCodesModelFactory.cs @@ -14,7 +14,7 @@ namespace Azure.Communication.ShortCodes.Models /// Model factory for models. public static partial class CommunicationShortCodesModelFactory { - /// Initializes a new instance of ShortCode. + /// Initializes a new instance of . /// The value of the ShortCode or the alpha numeric e.g. '555555', 'CONTOSO', etc. /// The type of number e.g. 'ShortCode', 'AlphaId'. /// ISO 3166 2-char code representing the country e.g. 'US'. @@ -25,7 +25,7 @@ public static ShortCode ShortCode(string number = null, NumberType? numberType = { programBriefIds ??= new List(); - return new ShortCode(number, numberType, countryCode, programBriefIds?.ToList(), purchaseDate); + return new ShortCode(number, numberType, countryCode, programBriefIds?.ToList(), purchaseDate, default); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.Serialization.cs index 60f871f9d7c1..719d0de2b151 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - internal partial class CommunicationError + internal partial class CommunicationError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationError DeserializeCommunicationError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +55,7 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele Optional target = default; Optional> details = default; Optional innererror = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -64,8 +96,61 @@ internal static CommunicationError DeserializeCommunicationError(JsonElement ele innererror = DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); + return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value, serializedAdditionalRawData); + } + + CommunicationError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.cs index 25d9dd0c74f8..337a1d97b528 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationError.cs @@ -14,7 +14,10 @@ namespace Azure.Communication.ShortCodes.Models /// The Communication Services error. internal partial class CommunicationError { - /// Initializes a new instance of CommunicationError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error code. /// The error message. /// or is null. @@ -28,19 +31,26 @@ internal CommunicationError(string code, string message) Details = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationError. + /// Initializes a new instance of . /// The error code. /// The error message. /// The error target. /// Further details about specific errors that led to this error. /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) + /// Keeps track of any properties unknown to the library. + internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; InnerError = innerError; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationError() + { } /// The error code. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.Serialization.cs index 02ddc310229e..b8ca2e502a39 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.Serialization.cs @@ -5,20 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - internal partial class CommunicationErrorResponse + internal partial class CommunicationErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CommunicationError error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -26,8 +64,61 @@ internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse error = CommunicationError.DeserializeCommunicationError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationErrorResponse(error); + return new CommunicationErrorResponse(error, serializedAdditionalRawData); + } + + CommunicationErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.cs index c44b4587e098..a589aa21c1ee 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationErrorResponse.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.ShortCodes.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.ShortCodes.Models /// The Communication Services error. internal partial class CommunicationErrorResponse { - /// Initializes a new instance of CommunicationErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Communication Services error. /// is null. internal CommunicationErrorResponse(CommunicationError error) @@ -23,6 +27,20 @@ internal CommunicationErrorResponse(CommunicationError error) Error = error; } + /// Initializes a new instance of . + /// The Communication Services error. + /// Keeps track of any properties unknown to the library. + internal CommunicationErrorResponse(CommunicationError error, Dictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationErrorResponse() + { + } + /// The Communication Services error. public CommunicationError Error { get; } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationIdentifierModel.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationIdentifierModel.cs index 2464b55e0600..888b215b53f0 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationIdentifierModel.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.ShortCodes.Models { /// Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. internal partial class CommunicationIdentifierModel { - /// Initializes a new instance of CommunicationIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommunicationIdentifierModel() { } + /// Initializes a new instance of . + /// Raw Id of the identifier. Optional in requests, required in responses. + /// The communication user. + /// The phone number. + /// The Microsoft Teams user. + /// Keeps track of any properties unknown to the library. + internal CommunicationIdentifierModel(string rawId, CommunicationUserIdentifierModel communicationUser, PhoneNumberIdentifierModel phoneNumber, MicrosoftTeamsUserIdentifierModel microsoftTeamsUser, Dictionary serializedAdditionalRawData) + { + RawId = rawId; + CommunicationUser = communicationUser; + PhoneNumber = phoneNumber; + MicrosoftTeamsUser = microsoftTeamsUser; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Raw Id of the identifier. Optional in requests, required in responses. public string RawId { get; } /// The communication user. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationUserIdentifierModel.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationUserIdentifierModel.cs index 1c16d3f46cbc..5b37a0914829 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CommunicationUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.ShortCodes.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.ShortCodes.Models /// A user that got created with an Azure Communication Services resource. internal partial class CommunicationUserIdentifierModel { - /// Initializes a new instance of CommunicationUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the communication user. /// is null. internal CommunicationUserIdentifierModel(string id) @@ -23,6 +27,20 @@ internal CommunicationUserIdentifierModel(string id) Id = id; } + /// Initializes a new instance of . + /// The Id of the communication user. + /// Keeps track of any properties unknown to the library. + internal CommunicationUserIdentifierModel(string id, Dictionary serializedAdditionalRawData) + { + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationUserIdentifierModel() + { + } + /// The Id of the communication user. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.Serialization.cs index 9aef73f0ee62..0bc56705aed3 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class CompanyInformation : IUtf8JsonSerializable + public partial class CompanyInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -34,18 +41,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ContactInformation)) { writer.WritePropertyName("contactInformation"u8); - writer.WriteObjectValue(ContactInformation); + if (ContactInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactInformation).Serialize(writer, options); + } } if (Optional.IsDefined(CustomerCareInformation)) { writer.WritePropertyName("customerCareInformation"u8); - writer.WriteObjectValue(CustomerCareInformation); + if (CustomerCareInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomerCareInformation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CompanyInformation DeserializeCompanyInformation(JsonElement element) + internal static CompanyInformation DeserializeCompanyInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +90,7 @@ internal static CompanyInformation DeserializeCompanyInformation(JsonElement ele Optional address = default; Optional contactInformation = default; Optional customerCareInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -94,8 +130,61 @@ internal static CompanyInformation DeserializeCompanyInformation(JsonElement ele customerCareInformation = CustomerCareInformation.DeserializeCustomerCareInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CompanyInformation(name.Value, url.Value, address.Value, contactInformation.Value, customerCareInformation.Value, serializedAdditionalRawData); + } + + CompanyInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCompanyInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CompanyInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCompanyInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CompanyInformation model) + { + if (model is null) + { + return null; } - return new CompanyInformation(name.Value, url.Value, address.Value, contactInformation.Value, customerCareInformation.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CompanyInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCompanyInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.cs index 6ea649501240..593334342883 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CompanyInformation.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.ShortCodes.Models { /// The CompanyInformation. public partial class CompanyInformation { - /// Initializes a new instance of CompanyInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CompanyInformation() { } - /// Initializes a new instance of CompanyInformation. + /// Initializes a new instance of . /// Legal entity name for customer submitting Program Brief. /// Company URL for customer submitting Program Brief. /// Company's address for the customer submitting the Program Brief. /// Contact Information. /// Customer Care Information. - internal CompanyInformation(string name, Uri url, string address, ContactInformation contactInformation, CustomerCareInformation customerCareInformation) + /// Keeps track of any properties unknown to the library. + internal CompanyInformation(string name, Uri url, string address, ContactInformation contactInformation, CustomerCareInformation customerCareInformation, Dictionary serializedAdditionalRawData) { Name = name; Url = url; Address = address; ContactInformation = contactInformation; CustomerCareInformation = customerCareInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Legal entity name for customer submitting Program Brief. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.Serialization.cs index 1a1c877ad0ee..a71747dea6dd 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class ContactInformation : IUtf8JsonSerializable + public partial class ContactInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("email"u8); writer.WriteStringValue(Email); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContactInformation DeserializeContactInformation(JsonElement element) + internal static ContactInformation DeserializeContactInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContactInformation DeserializeContactInformation(JsonElement ele Optional name = default; Optional phone = default; Optional email = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +82,61 @@ internal static ContactInformation DeserializeContactInformation(JsonElement ele email = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContactInformation(name.Value, phone.Value, email.Value, serializedAdditionalRawData); + } + + ContactInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContactInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContactInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContactInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContactInformation model) + { + if (model is null) + { + return null; } - return new ContactInformation(name.Value, phone.Value, email.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContactInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContactInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.cs index 2d097a9af7e0..ae8e3aaf6231 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ContactInformation.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.ShortCodes.Models { /// Contact Information. public partial class ContactInformation { - /// Initializes a new instance of ContactInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContactInformation() { } - /// Initializes a new instance of ContactInformation. + /// Initializes a new instance of . /// Name of authorized user for purposes of submitting the Program Brief. /// Contact phone number for the authorized user for the customer. Use E164 format. e.g. +14086111111. /// Contact email address number for the authorized user for the customer. - internal ContactInformation(string name, string phone, string email) + /// Keeps track of any properties unknown to the library. + internal ContactInformation(string name, string phone, string email, Dictionary serializedAdditionalRawData) { Name = name; Phone = phone; Email = email; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of authorized user for purposes of submitting the Program Brief. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.Serialization.cs index 7ba1c6a4fc48..d27e2a587f93 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class CustomerCareInformation : IUtf8JsonSerializable + public partial class CustomerCareInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TollFreeNumber)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("email"u8); writer.WriteStringValue(Email); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomerCareInformation DeserializeCustomerCareInformation(JsonElement element) + internal static CustomerCareInformation DeserializeCustomerCareInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional tollFreeNumber = default; Optional email = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tollFreeNumber"u8)) @@ -48,8 +71,61 @@ internal static CustomerCareInformation DeserializeCustomerCareInformation(JsonE email = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomerCareInformation(tollFreeNumber.Value, email.Value, serializedAdditionalRawData); + } + + CustomerCareInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomerCareInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomerCareInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomerCareInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomerCareInformation model) + { + if (model is null) + { + return null; } - return new CustomerCareInformation(tollFreeNumber.Value, email.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomerCareInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomerCareInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.cs index eabb13d69d89..c826df3b69ff 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/CustomerCareInformation.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.ShortCodes.Models { /// Customer Care Information. public partial class CustomerCareInformation { - /// Initializes a new instance of CustomerCareInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomerCareInformation() { } - /// Initializes a new instance of CustomerCareInformation. + /// Initializes a new instance of . /// Customer support phone number for the customer submitting the Program Brief. Use E164 format. e.g. +18005551212. /// Customer support email address for the customer submitting the Program Brief. - internal CustomerCareInformation(string tollFreeNumber, string email) + /// Keeps track of any properties unknown to the library. + internal CustomerCareInformation(string tollFreeNumber, string email, Dictionary serializedAdditionalRawData) { TollFreeNumber = tollFreeNumber; Email = email; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Customer support phone number for the customer submitting the Program Brief. Use E164 format. e.g. +18005551212. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.Serialization.cs index d49b4116f02c..dd63f4e85c1a 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class MessageDetails : IUtf8JsonSerializable + public partial class MessageDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(SupportedProtocols)) { @@ -67,15 +74,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UseCases) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MessageDetails DeserializeMessageDetails(JsonElement element) + internal static MessageDetails DeserializeMessageDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +117,7 @@ internal static MessageDetails DeserializeMessageDetails(JsonElement element) Optional confirmationMessage = default; Optional directionality = default; Optional> useCases = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("supportedProtocols"u8)) @@ -162,8 +191,61 @@ internal static MessageDetails DeserializeMessageDetails(JsonElement element) useCases = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MessageDetails(Optional.ToList(supportedProtocols), Optional.ToNullable(recurrence), helpMessage.Value, optOutMessage.Value, optInMessage.Value, optInReply.Value, confirmationMessage.Value, Optional.ToNullable(directionality), Optional.ToList(useCases), serializedAdditionalRawData); + } + + MessageDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMessageDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MessageDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMessageDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MessageDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MessageDetails(Response response) + { + if (response is null) + { + return null; } - return new MessageDetails(Optional.ToList(supportedProtocols), Optional.ToNullable(recurrence), helpMessage.Value, optOutMessage.Value, optInMessage.Value, optInReply.Value, confirmationMessage.Value, Optional.ToNullable(directionality), Optional.ToList(useCases)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMessageDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.cs index 21664540a43c..aedf5f346ba9 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.Communication.ShortCodes.Models /// The MessageDetails. public partial class MessageDetails { - /// Initializes a new instance of MessageDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MessageDetails() { SupportedProtocols = new ChangeTrackingList(); UseCases = new ChangeTrackingList(); } - /// Initializes a new instance of MessageDetails. + /// Initializes a new instance of . /// Applicable message protocols used in the program e.g. SMS, MMS. /// Indicates the nature of the messaging associated with the program e.g. 'subscription', 'transaction'. /// @@ -36,7 +40,8 @@ public MessageDetails() /// ConfirmationMessage. /// Describes directionality e.g. oneWay or twoWay. /// Provides message exchange examples from and to end user for each supported message content type. - internal MessageDetails(IList supportedProtocols, MessageRecurrence? recurrence, string helpMessage, string optOutMessage, string optInMessage, string optInReply, string confirmationMessage, MessageDirectionality? directionality, IList useCases) + /// Keeps track of any properties unknown to the library. + internal MessageDetails(IList supportedProtocols, MessageRecurrence? recurrence, string helpMessage, string optOutMessage, string optInMessage, string optInReply, string confirmationMessage, MessageDirectionality? directionality, IList useCases, Dictionary serializedAdditionalRawData) { SupportedProtocols = supportedProtocols; Recurrence = recurrence; @@ -47,6 +52,7 @@ internal MessageDetails(IList supportedProtocols, MessageRecurr ConfirmationMessage = confirmationMessage; Directionality = directionality; UseCases = useCases; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Applicable message protocols used in the program e.g. SMS, MMS. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.Serialization.cs index 216af4840487..70b529ebc422 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class MessageExample : IUtf8JsonSerializable + public partial class MessageExample : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Direction)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MessageExample DeserializeMessageExample(JsonElement element) + internal static MessageExample DeserializeMessageExample(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional direction = default; Optional text = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("direction"u8)) @@ -52,8 +75,61 @@ internal static MessageExample DeserializeMessageExample(JsonElement element) text = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MessageExample(Optional.ToNullable(direction), text.Value, serializedAdditionalRawData); + } + + MessageExample IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMessageExample(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MessageExample IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMessageExample(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MessageExample model) + { + if (model is null) + { + return null; } - return new MessageExample(Optional.ToNullable(direction), text.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MessageExample(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMessageExample(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.cs index 2501472e7966..06aa19287729 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExample.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.ShortCodes.Models { /// Represents a message example to be sent from or to the end user. public partial class MessageExample { - /// Initializes a new instance of MessageExample. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MessageExample() { } - /// Initializes a new instance of MessageExample. + /// Initializes a new instance of . /// Indicates whether the message example is supposed to be sent to or from the end user e.g. toUser. /// Actual example text for the message e.g. 'Want me to notify you when package in the way?'. - internal MessageExample(MessageDirection? direction, string text) + /// Keeps track of any properties unknown to the library. + internal MessageExample(MessageDirection? direction, string text, Dictionary serializedAdditionalRawData) { Direction = direction; Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the message example is supposed to be sent to or from the end user e.g. toUser. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.Serialization.cs index 2959e9267a0a..b5ae6873ea6d 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class MessageExampleSequence : IUtf8JsonSerializable + public partial class MessageExampleSequence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Messages)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Messages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MessageExampleSequence DeserializeMessageExampleSequence(JsonElement element) + internal static MessageExampleSequence DeserializeMessageExampleSequence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> messages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("messages"u8)) @@ -52,8 +81,61 @@ internal static MessageExampleSequence DeserializeMessageExampleSequence(JsonEle messages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MessageExampleSequence(Optional.ToList(messages), serializedAdditionalRawData); + } + + MessageExampleSequence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMessageExampleSequence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MessageExampleSequence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMessageExampleSequence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MessageExampleSequence model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MessageExampleSequence(Response response) + { + if (response is null) + { + return null; } - return new MessageExampleSequence(Optional.ToList(messages)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMessageExampleSequence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.cs index 2196e14982bd..4ea779f0ec95 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MessageExampleSequence.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.Communication.ShortCodes.Models /// A sequence of example messages to and from the end user. public partial class MessageExampleSequence { - /// Initializes a new instance of MessageExampleSequence. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MessageExampleSequence() { Messages = new ChangeTrackingList(); } - /// Initializes a new instance of MessageExampleSequence. + /// Initializes a new instance of . /// Example messages to be sent to and from the end user. - internal MessageExampleSequence(IList messages) + /// Keeps track of any properties unknown to the library. + internal MessageExampleSequence(IList messages, Dictionary serializedAdditionalRawData) { Messages = messages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Example messages to be sent to and from the end user. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs index 651ed5a95053..148590092f5f 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/MicrosoftTeamsUserIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.ShortCodes.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.ShortCodes.Models /// A Microsoft Teams user. internal partial class MicrosoftTeamsUserIdentifierModel { - /// Initializes a new instance of MicrosoftTeamsUserIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. /// is null. internal MicrosoftTeamsUserIdentifierModel(string userId) @@ -23,6 +27,24 @@ internal MicrosoftTeamsUserIdentifierModel(string userId) UserId = userId; } + /// Initializes a new instance of . + /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. + /// True if the Microsoft Teams user is anonymous. By default false if missing. + /// The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. + /// Keeps track of any properties unknown to the library. + internal MicrosoftTeamsUserIdentifierModel(string userId, bool? isAnonymous, CommunicationCloudEnvironmentModel? cloud, Dictionary serializedAdditionalRawData) + { + UserId = userId; + IsAnonymous = isAnonymous; + Cloud = cloud; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MicrosoftTeamsUserIdentifierModel() + { + } + /// The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. public string UserId { get; } /// True if the Microsoft Teams user is anonymous. By default false if missing. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/PhoneNumberIdentifierModel.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/PhoneNumberIdentifierModel.cs index ad12f3f4c429..7a96b8f44ab2 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/PhoneNumberIdentifierModel.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/PhoneNumberIdentifierModel.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.ShortCodes.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.ShortCodes.Models /// A phone number. internal partial class PhoneNumberIdentifierModel { - /// Initializes a new instance of PhoneNumberIdentifierModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The phone number in E.164 format. /// is null. internal PhoneNumberIdentifierModel(string value) @@ -23,6 +27,20 @@ internal PhoneNumberIdentifierModel(string value) Value = value; } + /// Initializes a new instance of . + /// The phone number in E.164 format. + /// Keeps track of any properties unknown to the library. + internal PhoneNumberIdentifierModel(string value, Dictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhoneNumberIdentifierModel() + { + } + /// The phone number in E.164 format. public string Value { get; } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.Serialization.cs index efe7b57ccea1..16cd52316ceb 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class ProgramDetails : IUtf8JsonSerializable + public partial class ProgramDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsVanity)) { @@ -87,11 +93,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expectedDateOfService"u8); writer.WriteStringValue(ExpectedDateOfService.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProgramDetails DeserializeProgramDetails(JsonElement element) + internal static ProgramDetails DeserializeProgramDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -108,6 +128,7 @@ internal static ProgramDetails DeserializeProgramDetails(JsonElement element) Optional termsOfServiceUrl = default; Optional privacyPolicyUrl = default; Optional expectedDateOfService = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isVanity"u8)) @@ -220,8 +241,61 @@ internal static ProgramDetails DeserializeProgramDetails(JsonElement element) expectedDateOfService = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProgramDetails(Optional.ToNullable(isVanity), Optional.ToList(preferredVanityNumbers), Optional.ToNullable(numberType), Optional.ToNullable(isPoliticalCampaign), name.Value, description.Value, url.Value, Optional.ToList(signUpTypes), signUpUrl.Value, termsOfServiceUrl.Value, privacyPolicyUrl.Value, Optional.ToNullable(expectedDateOfService), serializedAdditionalRawData); + } + + ProgramDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProgramDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProgramDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProgramDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProgramDetails model) + { + if (model is null) + { + return null; } - return new ProgramDetails(Optional.ToNullable(isVanity), Optional.ToList(preferredVanityNumbers), Optional.ToNullable(numberType), Optional.ToNullable(isPoliticalCampaign), name.Value, description.Value, url.Value, Optional.ToList(signUpTypes), signUpUrl.Value, termsOfServiceUrl.Value, privacyPolicyUrl.Value, Optional.ToNullable(expectedDateOfService)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProgramDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProgramDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.cs index 5cc60b447a3d..938cf3676388 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ProgramDetails.cs @@ -14,14 +14,17 @@ namespace Azure.Communication.ShortCodes.Models /// The ProgramDetails. public partial class ProgramDetails { - /// Initializes a new instance of ProgramDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProgramDetails() { PreferredVanityNumbers = new ChangeTrackingList(); SignUpTypes = new ChangeTrackingList(); } - /// Initializes a new instance of ProgramDetails. + /// Initializes a new instance of . /// Set to true if the request is for a vanity number. /// /// Priority ordered list of preferred vanity numbers. @@ -45,7 +48,8 @@ public ProgramDetails() /// Should follow ISO 8601 internet format for datetimes. /// e.g. 2021-08-17T22:02:51.316Z, 2021-08-17T16:39:57-08:00, etc. /// - internal ProgramDetails(bool? isVanity, IList preferredVanityNumbers, NumberType? numberType, bool? isPoliticalCampaign, string name, string description, Uri url, IList signUpTypes, Uri signUpUrl, Uri termsOfServiceUrl, Uri privacyPolicyUrl, DateTimeOffset? expectedDateOfService) + /// Keeps track of any properties unknown to the library. + internal ProgramDetails(bool? isVanity, IList preferredVanityNumbers, NumberType? numberType, bool? isPoliticalCampaign, string name, string description, Uri url, IList signUpTypes, Uri signUpUrl, Uri termsOfServiceUrl, Uri privacyPolicyUrl, DateTimeOffset? expectedDateOfService, Dictionary serializedAdditionalRawData) { IsVanity = isVanity; PreferredVanityNumbers = preferredVanityNumbers; @@ -59,6 +63,7 @@ internal ProgramDetails(bool? isVanity, IList preferredVanityNumbers, Nu TermsOfServiceUrl = termsOfServiceUrl; PrivacyPolicyUrl = privacyPolicyUrl; ExpectedDateOfService = expectedDateOfService; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Set to true if the request is for a vanity number. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.Serialization.cs index 35023bf8663e..832403a87377 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class ReviewNote : IUtf8JsonSerializable + public partial class ReviewNote : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Message)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("date"u8); writer.WriteStringValue(Date.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReviewNote DeserializeReviewNote(JsonElement element) + internal static ReviewNote DeserializeReviewNote(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional message = default; Optional date = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("message"u8)) @@ -53,8 +75,61 @@ internal static ReviewNote DeserializeReviewNote(JsonElement element) date = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReviewNote(message.Value, Optional.ToNullable(date), serializedAdditionalRawData); + } + + ReviewNote IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReviewNote(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReviewNote IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReviewNote(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReviewNote model) + { + if (model is null) + { + return null; } - return new ReviewNote(message.Value, Optional.ToNullable(date)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReviewNote(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReviewNote(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.cs index 1fc237ff567d..d21e0402ae9d 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ReviewNote.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.Communication.ShortCodes.Models { /// Holds a note about a Program Brief that has gone thru stages of review process. public partial class ReviewNote { - /// Initializes a new instance of ReviewNote. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReviewNote() { } - /// Initializes a new instance of ReviewNote. + /// Initializes a new instance of . /// Note related to a Program Brief that may imply changes needed from the client. /// Date and time when the note was added to the Program Brief. - internal ReviewNote(string message, DateTimeOffset? date) + /// Keeps track of any properties unknown to the library. + internal ReviewNote(string message, DateTimeOffset? date, Dictionary serializedAdditionalRawData) { Message = message; Date = date; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Note related to a Program Brief that may imply changes needed from the client. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.Serialization.cs index 96926b0dd6d0..ef7e4cfcb935 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.Serialization.cs @@ -8,14 +8,70 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class ShortCode + public partial class ShortCode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ShortCode DeserializeShortCode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Number)) + { + writer.WritePropertyName("number"u8); + writer.WriteStringValue(Number); + } + if (Optional.IsDefined(NumberType)) + { + writer.WritePropertyName("numberType"u8); + writer.WriteStringValue(NumberType.Value.ToString()); + } + if (Optional.IsDefined(CountryCode)) + { + writer.WritePropertyName("countryCode"u8); + writer.WriteStringValue(CountryCode); + } + if (Optional.IsCollectionDefined(ProgramBriefIds)) + { + writer.WritePropertyName("programBriefIds"u8); + writer.WriteStartArray(); + foreach (var item in ProgramBriefIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PurchaseDate)) + { + writer.WritePropertyName("purchaseDate"u8); + writer.WriteStringValue(PurchaseDate.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ShortCode DeserializeShortCode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +81,7 @@ internal static ShortCode DeserializeShortCode(JsonElement element) Optional countryCode = default; Optional> programBriefIds = default; Optional purchaseDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("number"u8)) @@ -69,8 +126,61 @@ internal static ShortCode DeserializeShortCode(JsonElement element) purchaseDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ShortCode(number.Value, Optional.ToNullable(numberType), countryCode.Value, Optional.ToList(programBriefIds), Optional.ToNullable(purchaseDate)); + return new ShortCode(number.Value, Optional.ToNullable(numberType), countryCode.Value, Optional.ToList(programBriefIds), Optional.ToNullable(purchaseDate), serializedAdditionalRawData); + } + + ShortCode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShortCode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShortCode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShortCode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShortCode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShortCode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShortCode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.cs index 098235905922..f5dc24411799 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCode.cs @@ -14,25 +14,30 @@ namespace Azure.Communication.ShortCodes.Models /// Represents a number, ShortCode or AlphaId, acquired in a given country. public partial class ShortCode { - /// Initializes a new instance of ShortCode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ShortCode() { ProgramBriefIds = new ChangeTrackingList(); } - /// Initializes a new instance of ShortCode. + /// Initializes a new instance of . /// The value of the ShortCode or the alpha numeric e.g. '555555', 'CONTOSO', etc. /// The type of number e.g. 'ShortCode', 'AlphaId'. /// ISO 3166 2-char code representing the country e.g. 'US'. /// Program Brief Name. /// Date in which number was purchased. - internal ShortCode(string number, NumberType? numberType, string countryCode, IReadOnlyList programBriefIds, DateTimeOffset? purchaseDate) + /// Keeps track of any properties unknown to the library. + internal ShortCode(string number, NumberType? numberType, string countryCode, IReadOnlyList programBriefIds, DateTimeOffset? purchaseDate, Dictionary serializedAdditionalRawData) { Number = number; NumberType = numberType; CountryCode = countryCode; ProgramBriefIds = programBriefIds; PurchaseDate = purchaseDate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value of the ShortCode or the alpha numeric e.g. '555555', 'CONTOSO', etc. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.Serialization.cs index 39528ea552f1..2c6380c4bea3 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class ShortCodeCost : IUtf8JsonSerializable + public partial class ShortCodeCost : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("amount"u8); writer.WriteNumberValue(Amount); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(CurrencyCode); writer.WritePropertyName("billingFrequency"u8); writer.WriteStringValue(BillingFrequency.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ShortCodeCost DeserializeShortCodeCost(JsonElement element) + internal static ShortCodeCost DeserializeShortCodeCost(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static ShortCodeCost DeserializeShortCodeCost(JsonElement element) double amount = default; string currencyCode = default; BillingFrequency billingFrequency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("amount"u8)) @@ -50,8 +73,61 @@ internal static ShortCodeCost DeserializeShortCodeCost(JsonElement element) billingFrequency = new BillingFrequency(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ShortCodeCost(amount, currencyCode, billingFrequency, serializedAdditionalRawData); + } + + ShortCodeCost IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShortCodeCost(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShortCodeCost IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShortCodeCost(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShortCodeCost model) + { + if (model is null) + { + return null; } - return new ShortCodeCost(amount, currencyCode, billingFrequency); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShortCodeCost(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShortCodeCost(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.cs index eeb3cb7b6a43..f315035578d1 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodeCost.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.ShortCodes.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.ShortCodes.Models /// The incurred cost for a single short code. public partial class ShortCodeCost { - /// Initializes a new instance of ShortCodeCost. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The cost amount. /// The ISO 4217 currency code for the cost amount, e.g. USD. /// The frequency with which the cost gets billed. @@ -27,6 +31,24 @@ public ShortCodeCost(double amount, string currencyCode, BillingFrequency billin BillingFrequency = billingFrequency; } + /// Initializes a new instance of . + /// The cost amount. + /// The ISO 4217 currency code for the cost amount, e.g. USD. + /// The frequency with which the cost gets billed. + /// Keeps track of any properties unknown to the library. + internal ShortCodeCost(double amount, string currencyCode, BillingFrequency billingFrequency, Dictionary serializedAdditionalRawData) + { + Amount = amount; + CurrencyCode = currencyCode; + BillingFrequency = billingFrequency; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ShortCodeCost() + { + } + /// The cost amount. public double Amount { get; set; } /// The ISO 4217 currency code for the cost amount, e.g. USD. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.Serialization.cs index ffceaddd56e8..8b10c6ca9b19 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - internal partial class ShortCodes + internal partial class ShortCodes : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ShortCodes DeserializeShortCodes(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ShortCodesValue)) + { + writer.WritePropertyName("shortCodes"u8); + writer.WriteStartArray(); + foreach (var item in ShortCodesValue) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ShortCodes DeserializeShortCodes(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> shortCodes = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shortCodes"u8)) @@ -42,8 +92,61 @@ internal static ShortCodes DeserializeShortCodes(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ShortCodes(Optional.ToList(shortCodes), nextLink.Value); + return new ShortCodes(Optional.ToList(shortCodes), nextLink.Value, serializedAdditionalRawData); + } + + ShortCodes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShortCodes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShortCodes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShortCodes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShortCodes model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShortCodes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShortCodes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.cs index 3230a98a1a0e..b91676e3c1aa 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/ShortCodes.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.ShortCodes.Models /// A wrapper for a list of short code entities. internal partial class ShortCodes { - /// Initializes a new instance of ShortCodes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ShortCodes() { ShortCodesValue = new ChangeTrackingList(); } - /// Initializes a new instance of ShortCodes. + /// Initializes a new instance of . /// List of short codes. /// Represents the URL link to the next page. - internal ShortCodes(IReadOnlyList shortCodesValue, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ShortCodes(IReadOnlyList shortCodesValue, string nextLink, Dictionary serializedAdditionalRawData) { ShortCodesValue = shortCodesValue; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of short codes. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.Serialization.cs index 8366feee2d21..1e0e69c31bd6 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class TrafficDetails : IUtf8JsonSerializable + public partial class TrafficDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TotalMonthlyVolume)) { @@ -45,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("estimatedRampUpTimeInDays"u8); writer.WriteNumberValue(EstimatedRampUpTimeInDays.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TrafficDetails DeserializeTrafficDetails(JsonElement element) + internal static TrafficDetails DeserializeTrafficDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +82,7 @@ internal static TrafficDetails DeserializeTrafficDetails(JsonElement element) Optional isSpiky = default; Optional spikeDetails = default; Optional estimatedRampUpTimeInDays = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("totalMonthlyVolume"u8)) @@ -112,8 +135,61 @@ internal static TrafficDetails DeserializeTrafficDetails(JsonElement element) estimatedRampUpTimeInDays = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TrafficDetails(Optional.ToNullable(totalMonthlyVolume), Optional.ToNullable(monthlyAverageMessagesFromUser), Optional.ToNullable(monthlyAverageMessagesToUser), Optional.ToNullable(isSpiky), spikeDetails.Value, Optional.ToNullable(estimatedRampUpTimeInDays), serializedAdditionalRawData); + } + + TrafficDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTrafficDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TrafficDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTrafficDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TrafficDetails model) + { + if (model is null) + { + return null; } - return new TrafficDetails(Optional.ToNullable(totalMonthlyVolume), Optional.ToNullable(monthlyAverageMessagesFromUser), Optional.ToNullable(monthlyAverageMessagesToUser), Optional.ToNullable(isSpiky), spikeDetails.Value, Optional.ToNullable(estimatedRampUpTimeInDays)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TrafficDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTrafficDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.cs index fa816ba78281..1c50e2eb73d5 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/TrafficDetails.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.ShortCodes.Models { /// The TrafficDetails. public partial class TrafficDetails { - /// Initializes a new instance of TrafficDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TrafficDetails() { } - /// Initializes a new instance of TrafficDetails. + /// Initializes a new instance of . /// Estimated total messages per month. /// Estimated number of Mobile-Originated messages likely to be received from a user per month. /// Estimated number of Mobile-Terminated messages likely to be sent per user per month. @@ -25,7 +31,8 @@ public TrafficDetails() /// e.g. 'Higher traffic expected during holiday season and Black Friday.'. /// /// Numbers of days in which is expected to start sending messages from the short code. - internal TrafficDetails(int? totalMonthlyVolume, int? monthlyAverageMessagesFromUser, int? monthlyAverageMessagesToUser, bool? isSpiky, string spikeDetails, int? estimatedRampUpTimeInDays) + /// Keeps track of any properties unknown to the library. + internal TrafficDetails(int? totalMonthlyVolume, int? monthlyAverageMessagesFromUser, int? monthlyAverageMessagesToUser, bool? isSpiky, string spikeDetails, int? estimatedRampUpTimeInDays, Dictionary serializedAdditionalRawData) { TotalMonthlyVolume = totalMonthlyVolume; MonthlyAverageMessagesFromUser = monthlyAverageMessagesFromUser; @@ -33,6 +40,7 @@ internal TrafficDetails(int? totalMonthlyVolume, int? monthlyAverageMessagesFrom IsSpiky = isSpiky; SpikeDetails = spikeDetails; EstimatedRampUpTimeInDays = estimatedRampUpTimeInDays; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Estimated total messages per month. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.Serialization.cs index c417f40cc50b..4ad118cbdc2b 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class USProgramBrief : IUtf8JsonSerializable + public partial class USProgramBrief : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -35,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ReviewNotes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -45,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Costs) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -62,28 +82,70 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProgramDetails)) { writer.WritePropertyName("programDetails"u8); - writer.WriteObjectValue(ProgramDetails); + if (ProgramDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProgramDetails).Serialize(writer, options); + } } if (Optional.IsDefined(CompanyInformation)) { writer.WritePropertyName("companyInformation"u8); - writer.WriteObjectValue(CompanyInformation); + if (CompanyInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CompanyInformation).Serialize(writer, options); + } } if (Optional.IsDefined(MessageDetails)) { writer.WritePropertyName("messageDetails"u8); - writer.WriteObjectValue(MessageDetails); + if (MessageDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MessageDetails).Serialize(writer, options); + } } if (Optional.IsDefined(TrafficDetails)) { writer.WritePropertyName("trafficDetails"u8); - writer.WriteObjectValue(TrafficDetails); + if (TrafficDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TrafficDetails).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static USProgramBrief DeserializeUSProgramBrief(JsonElement element) + internal static USProgramBrief DeserializeUSProgramBrief(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -99,6 +161,7 @@ internal static USProgramBrief DeserializeUSProgramBrief(JsonElement element) Optional companyInformation = default; Optional messageDetails = default; Optional trafficDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -202,8 +265,61 @@ internal static USProgramBrief DeserializeUSProgramBrief(JsonElement element) trafficDetails = TrafficDetails.DeserializeTrafficDetails(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new USProgramBrief(id, Optional.ToNullable(status), number.Value, Optional.ToList(reviewNotes), Optional.ToList(costs), Optional.ToNullable(submissionDate), Optional.ToNullable(statusUpdatedDate), programDetails.Value, companyInformation.Value, messageDetails.Value, trafficDetails.Value, serializedAdditionalRawData); + } + + USProgramBrief IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUSProgramBrief(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + USProgramBrief IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUSProgramBrief(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(USProgramBrief model) + { + if (model is null) + { + return null; } - return new USProgramBrief(id, Optional.ToNullable(status), number.Value, Optional.ToList(reviewNotes), Optional.ToList(costs), Optional.ToNullable(submissionDate), Optional.ToNullable(statusUpdatedDate), programDetails.Value, companyInformation.Value, messageDetails.Value, trafficDetails.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator USProgramBrief(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUSProgramBrief(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.cs index e66b520c9ffe..6fc0fe4f0773 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBrief.cs @@ -18,7 +18,10 @@ namespace Azure.Communication.ShortCodes.Models /// public partial class USProgramBrief { - /// Initializes a new instance of USProgramBrief. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Program Brief Id. public USProgramBrief(Guid id) { @@ -27,7 +30,7 @@ public USProgramBrief(Guid id) Costs = new ChangeTrackingList(); } - /// Initializes a new instance of USProgramBrief. + /// Initializes a new instance of . /// Program Brief Id. /// Program Brief status e.g. 'submitted', 'approved', etc. /// Number provisioned for the Program Brief e.g. 555555, 'CONTOSO'. @@ -42,7 +45,8 @@ public USProgramBrief(Guid id) /// CompanyInformation. /// MessageDetails. /// TrafficDetails. - internal USProgramBrief(Guid id, ProgramBriefStatus? status, string number, IList reviewNotes, IList costs, DateTimeOffset? submissionDate, DateTimeOffset? statusUpdatedDate, ProgramDetails programDetails, CompanyInformation companyInformation, MessageDetails messageDetails, TrafficDetails trafficDetails) + /// Keeps track of any properties unknown to the library. + internal USProgramBrief(Guid id, ProgramBriefStatus? status, string number, IList reviewNotes, IList costs, DateTimeOffset? submissionDate, DateTimeOffset? statusUpdatedDate, ProgramDetails programDetails, CompanyInformation companyInformation, MessageDetails messageDetails, TrafficDetails trafficDetails, Dictionary serializedAdditionalRawData) { Id = id; Status = status; @@ -55,6 +59,12 @@ internal USProgramBrief(Guid id, ProgramBriefStatus? status, string number, ILis CompanyInformation = companyInformation; MessageDetails = messageDetails; TrafficDetails = trafficDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal USProgramBrief() + { } /// Program Brief Id. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.Serialization.cs index 373424997f0f..2859f0073211 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - internal partial class USProgramBriefs + internal partial class USProgramBriefs : IUtf8JsonSerializable, IModelJsonSerializable { - internal static USProgramBriefs DeserializeUSProgramBriefs(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ProgramBriefs)) + { + writer.WritePropertyName("programBriefs"u8); + writer.WriteStartArray(); + foreach (var item in ProgramBriefs) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static USProgramBriefs DeserializeUSProgramBriefs(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> programBriefs = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("programBriefs"u8)) @@ -42,8 +92,61 @@ internal static USProgramBriefs DeserializeUSProgramBriefs(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new USProgramBriefs(Optional.ToList(programBriefs), nextLink.Value); + return new USProgramBriefs(Optional.ToList(programBriefs), nextLink.Value, serializedAdditionalRawData); + } + + USProgramBriefs IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUSProgramBriefs(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + USProgramBriefs IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUSProgramBriefs(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(USProgramBriefs model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator USProgramBriefs(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUSProgramBriefs(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.cs index ebdf57e70bcd..8334d214916f 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/USProgramBriefs.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.ShortCodes.Models /// A wrapper for a list of USProgramBrief entities. internal partial class USProgramBriefs { - /// Initializes a new instance of USProgramBriefs. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal USProgramBriefs() { ProgramBriefs = new ChangeTrackingList(); } - /// Initializes a new instance of USProgramBriefs. + /// Initializes a new instance of . /// List of Program Briefs. /// Represents the URL link to the next page. - internal USProgramBriefs(IReadOnlyList programBriefs, string nextLink) + /// Keeps track of any properties unknown to the library. + internal USProgramBriefs(IReadOnlyList programBriefs, string nextLink, Dictionary serializedAdditionalRawData) { ProgramBriefs = programBriefs; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Program Briefs. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.Serialization.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.Serialization.cs index e7a19616c339..8c420e09a0ea 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.Serialization.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.ShortCodes.Models { - public partial class UseCase : IUtf8JsonSerializable + public partial class UseCase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContentCategory)) { @@ -27,21 +34,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Examples) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UseCase DeserializeUseCase(JsonElement element) + internal static UseCase DeserializeUseCase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional contentCategory = default; Optional> examples = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contentCategory"u8)) @@ -67,8 +96,61 @@ internal static UseCase DeserializeUseCase(JsonElement element) examples = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UseCase(Optional.ToNullable(contentCategory), Optional.ToList(examples), serializedAdditionalRawData); + } + + UseCase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUseCase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UseCase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUseCase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UseCase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UseCase(Response response) + { + if (response is null) + { + return null; } - return new UseCase(Optional.ToNullable(contentCategory), Optional.ToList(examples)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUseCase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.cs index 3859be266c61..b7efd4b408e7 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/Models/UseCase.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Communication.ShortCodes.Models /// Describes a messaging use case for a given content type by providing example messages. public partial class UseCase { - /// Initializes a new instance of UseCase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UseCase() { Examples = new ChangeTrackingList(); } - /// Initializes a new instance of UseCase. + /// Initializes a new instance of . /// Indicates the messaging content category used in the program e.g. 'ringTones', 'smsChat', 'video', 'loyaltyProgramPointsPrizes', 'gifting', 'inApplicationBilling', 'textToScreen'. /// Example messages to be sent to and from the end user for the indicated content type. - internal UseCase(MessageContentCategory? contentCategory, IList examples) + /// Keeps track of any properties unknown to the library. + internal UseCase(MessageContentCategory? contentCategory, IList examples, Dictionary serializedAdditionalRawData) { ContentCategory = contentCategory; Examples = examples; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates the messaging content category used in the program e.g. 'ringTones', 'smsChat', 'video', 'loyaltyProgramPointsPrizes', 'gifting', 'inApplicationBilling', 'textToScreen'. diff --git a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/ShortCodesRestClient.cs b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/ShortCodesRestClient.cs index 3d7be36d4671..ec0070330445 100644 --- a/sdk/communication/Azure.Communication.ShortCodes/src/Generated/ShortCodesRestClient.cs +++ b/sdk/communication/Azure.Communication.ShortCodes/src/Generated/ShortCodesRestClient.cs @@ -120,9 +120,7 @@ internal HttpMessage CreateUpsertUSProgramBriefRequest(Guid programBriefId, USPr if (body != null) { request.Headers.Add("Content-Type", "application/merge-patch+json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } return message; } diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/CommunicationSmsModelFactory.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/CommunicationSmsModelFactory.cs new file mode 100644 index 000000000000..5541e45e7be2 --- /dev/null +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/CommunicationSmsModelFactory.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.Sms +{ + /// Model factory for models. + public static partial class CommunicationSmsModelFactory + { + /// Initializes a new instance of . + /// Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid. + /// Use this field to provide metadata that will then be sent back in the corresponding Delivery Report. + /// A new instance for mocking. + public static SmsSendOptions SmsSendOptions(bool enableDeliveryReport = default, string tag = null) + { + return new SmsSendOptions(enableDeliveryReport, tag, default); + } + } +} diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.Serialization.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.Serialization.cs index 2d2c3625f904..082b9985b3ae 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Communication.Sms; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Sms.Models { - internal partial class SendMessageRequest : IUtf8JsonSerializable + internal partial class SendMessageRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("from"u8); writer.WriteStringValue(From); @@ -21,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SmsRecipients) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("message"u8); @@ -29,9 +45,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SmsSendOptions)) { writer.WritePropertyName("smsSendOptions"u8); - writer.WriteObjectValue(SmsSendOptions); + if (SmsSendOptions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SmsSendOptions).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static SendMessageRequest DeserializeSendMessageRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @from = default; + IList smsRecipients = default; + string message = default; + Optional smsSendOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("from"u8)) + { + @from = property.Value.GetString(); + continue; + } + if (property.NameEquals("smsRecipients"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SmsRecipient.DeserializeSmsRecipient(item)); + } + smsRecipients = array; + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("smsSendOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smsSendOptions = SmsSendOptions.DeserializeSmsSendOptions(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SendMessageRequest(@from, smsRecipients, message, smsSendOptions.Value, serializedAdditionalRawData); + } + + SendMessageRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSendMessageRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SendMessageRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSendMessageRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SendMessageRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SendMessageRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSendMessageRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.cs index f2a06440592e..b46a2a4ff501 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SendMessageRequest.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.Sms.Models /// Represents the properties of a send message request. internal partial class SendMessageRequest { - /// Initializes a new instance of SendMessageRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The sender's phone number in E.164 format that is owned by the authenticated account. /// The recipient's phone number in E.164 format. In this version, a minimum of 1 and upto 100 recipients in the list are supported. /// The contents of the message that will be sent to the recipient. The allowable content is defined by RFC 5724. @@ -32,6 +35,26 @@ public SendMessageRequest(string @from, IEnumerable smsRecipients, Message = message; } + /// Initializes a new instance of . + /// The sender's phone number in E.164 format that is owned by the authenticated account. + /// The recipient's phone number in E.164 format. In this version, a minimum of 1 and upto 100 recipients in the list are supported. + /// The contents of the message that will be sent to the recipient. The allowable content is defined by RFC 5724. + /// Optional configuration for sending SMS messages. + /// Keeps track of any properties unknown to the library. + internal SendMessageRequest(string @from, IList smsRecipients, string message, SmsSendOptions smsSendOptions, Dictionary serializedAdditionalRawData) + { + From = @from; + SmsRecipients = smsRecipients; + Message = message; + SmsSendOptions = smsSendOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendMessageRequest() + { + } + /// The sender's phone number in E.164 format that is owned by the authenticated account. public string From { get; } /// The recipient's phone number in E.164 format. In this version, a minimum of 1 and upto 100 recipients in the list are supported. diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.Serialization.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.Serialization.cs index 4cd5548aa2b3..d551db2c6721 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.Serialization.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Sms.Models { - internal partial class SmsRecipient : IUtf8JsonSerializable + internal partial class SmsRecipient : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("to"u8); writer.WriteStringValue(To); @@ -27,7 +35,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("repeatabilityFirstSent"u8); writer.WriteStringValue(RepeatabilityFirstSent); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SmsRecipient DeserializeSmsRecipient(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string to = default; + Optional repeatabilityRequestId = default; + Optional repeatabilityFirstSent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("to"u8)) + { + to = property.Value.GetString(); + continue; + } + if (property.NameEquals("repeatabilityRequestId"u8)) + { + repeatabilityRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("repeatabilityFirstSent"u8)) + { + repeatabilityFirstSent = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmsRecipient(to, repeatabilityRequestId.Value, repeatabilityFirstSent.Value, serializedAdditionalRawData); + } + + SmsRecipient IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmsRecipient(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmsRecipient IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmsRecipient(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmsRecipient model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmsRecipient(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmsRecipient(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.cs index fd92adfb4bd5..ad68f5b65b1d 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsRecipient.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Sms.Models @@ -13,7 +14,10 @@ namespace Azure.Communication.Sms.Models /// Recipient details for sending SMS messages. internal partial class SmsRecipient { - /// Initializes a new instance of SmsRecipient. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The recipient's phone number in E.164 format. /// is null. public SmsRecipient(string to) @@ -23,6 +27,24 @@ public SmsRecipient(string to) To = to; } + /// Initializes a new instance of . + /// The recipient's phone number in E.164 format. + /// If specified, the client directs that the request is repeatable; that is, the client can make the request multiple times with the same Repeatability-Request-ID and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-ID is an opaque string representing a client-generated, 36-character hexadecimal case-insensitive encoding of a UUID (GUID), identifier for the request. + /// MUST be sent by clients to specify that a request is repeatable. Repeatability-First-Sent is used to specify the date and time at which the request was first created.eg- Tue, 26 Mar 2019 16:06:51 GMT. + /// Keeps track of any properties unknown to the library. + internal SmsRecipient(string to, string repeatabilityRequestId, string repeatabilityFirstSent, Dictionary serializedAdditionalRawData) + { + To = to; + RepeatabilityRequestId = repeatabilityRequestId; + RepeatabilityFirstSent = repeatabilityFirstSent; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SmsRecipient() + { + } + /// The recipient's phone number in E.164 format. public string To { get; } /// If specified, the client directs that the request is repeatable; that is, the client can make the request multiple times with the same Repeatability-Request-ID and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-ID is an opaque string representing a client-generated, 36-character hexadecimal case-insensitive encoding of a UUID (GUID), identifier for the request. diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.Serialization.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.Serialization.cs index 00db485723f8..81a0d15595e8 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.Serialization.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Sms { - public partial class SmsSendOptions : IUtf8JsonSerializable + public partial class SmsSendOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enableDeliveryReport"u8); writer.WriteBooleanValue(EnableDeliveryReport); @@ -22,7 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tag"u8); writer.WriteStringValue(Tag); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SmsSendOptions DeserializeSmsSendOptions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool enableDeliveryReport = default; + Optional tag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enableDeliveryReport"u8)) + { + enableDeliveryReport = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("tag"u8)) + { + tag = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SmsSendOptions(enableDeliveryReport, tag.Value, serializedAdditionalRawData); + } + + SmsSendOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmsSendOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmsSendOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmsSendOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmsSendOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmsSendOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmsSendOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.cs index 864e7b37e083..dc3b40107d41 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendOptions.cs @@ -5,18 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Communication.Sms { /// Optional configuration for sending SMS messages. public partial class SmsSendOptions { - /// Initializes a new instance of SmsSendOptions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid. public SmsSendOptions(bool enableDeliveryReport) { EnableDeliveryReport = enableDeliveryReport; } + /// Initializes a new instance of . + /// Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid. + /// Use this field to provide metadata that will then be sent back in the corresponding Delivery Report. + /// Keeps track of any properties unknown to the library. + internal SmsSendOptions(bool enableDeliveryReport, string tag, Dictionary serializedAdditionalRawData) + { + EnableDeliveryReport = enableDeliveryReport; + Tag = tag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SmsSendOptions() + { + } + /// Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid. public bool EnableDeliveryReport { get; } /// Use this field to provide metadata that will then be sent back in the corresponding Delivery Report. diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.Serialization.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.Serialization.cs index 3375a08a9116..c019b9acc48b 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Communication.Sms; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Sms.Models { - internal partial class SmsSendResponse + internal partial class SmsSendResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SmsSendResponse DeserializeSmsSendResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SmsSendResponse DeserializeSmsSendResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -33,8 +75,61 @@ internal static SmsSendResponse DeserializeSmsSendResponse(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SmsSendResponse(value); + return new SmsSendResponse(value, serializedAdditionalRawData); + } + + SmsSendResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmsSendResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmsSendResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmsSendResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmsSendResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmsSendResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmsSendResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.cs index c3da8bcef1b1..c8ef57740f0b 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResponse.cs @@ -16,7 +16,10 @@ namespace Azure.Communication.Sms.Models /// Response for a successful or multi status send Sms request. internal partial class SmsSendResponse { - /// Initializes a new instance of SmsSendResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal SmsSendResponse(IEnumerable value) @@ -26,11 +29,18 @@ internal SmsSendResponse(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SmsSendResponse. + /// Initializes a new instance of . /// - internal SmsSendResponse(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal SmsSendResponse(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SmsSendResponse() + { } /// Gets the value. diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.Serialization.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.Serialization.cs index 0fe75cb6775f..63dfe2c05ade 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.Serialization.cs @@ -5,15 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.Sms { - public partial class SmsSendResult + public partial class SmsSendResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SmsSendResult DeserializeSmsSendResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("to"u8); + writer.WriteStringValue(To); + if (Optional.IsDefined(MessageId)) + { + writer.WritePropertyName("messageId"u8); + writer.WriteStringValue(MessageId); + } + writer.WritePropertyName("httpStatusCode"u8); + writer.WriteNumberValue(HttpStatusCode); + if (Optional.IsDefined(RepeatabilityResult)) + { + writer.WritePropertyName("repeatabilityResult"u8); + writer.WriteStringValue(RepeatabilityResult.Value.ToString()); + } + writer.WritePropertyName("successful"u8); + writer.WriteBooleanValue(Successful); + if (Optional.IsDefined(ErrorMessage)) + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SmsSendResult DeserializeSmsSendResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +73,7 @@ internal static SmsSendResult DeserializeSmsSendResult(JsonElement element) Optional repeatabilityResult = default; bool successful = default; Optional errorMessage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("to"u8)) @@ -60,8 +110,61 @@ internal static SmsSendResult DeserializeSmsSendResult(JsonElement element) errorMessage = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SmsSendResult(to, messageId.Value, httpStatusCode, Optional.ToNullable(repeatabilityResult), successful, errorMessage.Value); + return new SmsSendResult(to, messageId.Value, httpStatusCode, Optional.ToNullable(repeatabilityResult), successful, errorMessage.Value, serializedAdditionalRawData); + } + + SmsSendResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSmsSendResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SmsSendResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSmsSendResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SmsSendResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SmsSendResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSmsSendResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.cs index 6c856c8ee2ab..2e729dc79e90 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/Models/SmsSendResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.Sms @@ -13,7 +14,10 @@ namespace Azure.Communication.Sms /// Response for a single recipient. public partial class SmsSendResult { - /// Initializes a new instance of SmsSendResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The recipient's phone number in E.164 format. /// HTTP Status code. /// Indicates if the message is processed successfully or not. @@ -27,14 +31,15 @@ internal SmsSendResult(string to, int httpStatusCode, bool successful) Successful = successful; } - /// Initializes a new instance of SmsSendResult. + /// Initializes a new instance of . /// The recipient's phone number in E.164 format. /// The identifier of the outgoing Sms message. Only present if message processed. /// HTTP Status code. /// The result of a repeatable request with one of the case-insensitive values accepted or rejected. /// Indicates if the message is processed successfully or not. /// Optional error message in case of 4xx/5xx/repeatable errors. - internal SmsSendResult(string to, string messageId, int httpStatusCode, SmsSendResponseItemRepeatabilityResult? repeatabilityResult, bool successful, string errorMessage) + /// Keeps track of any properties unknown to the library. + internal SmsSendResult(string to, string messageId, int httpStatusCode, SmsSendResponseItemRepeatabilityResult? repeatabilityResult, bool successful, string errorMessage, Dictionary serializedAdditionalRawData) { To = to; MessageId = messageId; @@ -42,6 +47,12 @@ internal SmsSendResult(string to, string messageId, int httpStatusCode, SmsSendR RepeatabilityResult = repeatabilityResult; Successful = successful; ErrorMessage = errorMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SmsSendResult() + { } /// The recipient's phone number in E.164 format. diff --git a/sdk/communication/Azure.Communication.Sms/src/Generated/SmsRestClient.cs b/sdk/communication/Azure.Communication.Sms/src/Generated/SmsRestClient.cs index aa6e876f31e7..bbc37758577a 100644 --- a/sdk/communication/Azure.Communication.Sms/src/Generated/SmsRestClient.cs +++ b/sdk/communication/Azure.Communication.Sms/src/Generated/SmsRestClient.cs @@ -57,9 +57,7 @@ internal HttpMessage CreateSendRequest(string @from, IEnumerable s { SmsSendOptions = smsSendOptions }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; + request.Content = model; return message0; } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs index 790a2a160020..3392b2190199 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs @@ -17,25 +17,25 @@ namespace Azure.ResourceManager.Communication.Models /// Model factory for models. public static partial class ArmCommunicationModelFactory { - /// Initializes a new instance of CommunicationNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. /// A new instance for mocking. public static CommunicationNameAvailabilityResult CommunicationNameAvailabilityResult(bool? isNameAvailable = null, CommunicationNameAvailabilityReason? reason = null, string message = null) { - return new CommunicationNameAvailabilityResult(isNameAvailable, reason, message); + return new CommunicationNameAvailabilityResult(isNameAvailable, reason, message, default); } - /// Initializes a new instance of LinkedNotificationHub. + /// Initializes a new instance of . /// The resource ID of the notification hub. /// A new instance for mocking. public static LinkedNotificationHub LinkedNotificationHub(ResourceIdentifier resourceId = null) { - return new LinkedNotificationHub(resourceId); + return new LinkedNotificationHub(resourceId, default); } - /// Initializes a new instance of CommunicationServiceResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -55,10 +55,10 @@ public static CommunicationServiceResourceData CommunicationServiceResourceData( tags ??= new Dictionary(); linkedDomains ??= new List(); - return new CommunicationServiceResourceData(id, name, resourceType, systemData, tags, location, provisioningState, hostName, dataLocation, notificationHubId, version, immutableResourceId, linkedDomains?.ToList()); + return new CommunicationServiceResourceData(id, name, resourceType, systemData, tags, location, provisioningState, hostName, dataLocation, notificationHubId, version, immutableResourceId, linkedDomains?.ToList(), default); } - /// Initializes a new instance of CommunicationServiceKeys. + /// Initializes a new instance of . /// The primary access key. /// The secondary access key. /// CommunicationService connection string constructed via the primaryKey. @@ -66,10 +66,10 @@ public static CommunicationServiceResourceData CommunicationServiceResourceData( /// A new instance for mocking. public static CommunicationServiceKeys CommunicationServiceKeys(string primaryKey = null, string secondaryKey = null, string primaryConnectionString = null, string secondaryConnectionString = null) { - return new CommunicationServiceKeys(primaryKey, secondaryKey, primaryConnectionString, secondaryConnectionString); + return new CommunicationServiceKeys(primaryKey, secondaryKey, primaryConnectionString, secondaryConnectionString, default); } - /// Initializes a new instance of CommunicationDomainResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -89,10 +89,10 @@ public static CommunicationDomainResourceData CommunicationDomainResourceData(Re { tags ??= new Dictionary(); - return new CommunicationDomainResourceData(id, name, resourceType, systemData, tags, location, provisioningState, dataLocation, fromSenderDomain, mailFromSenderDomain, domainManagement, verificationStates, verificationRecords, userEngagementTracking); + return new CommunicationDomainResourceData(id, name, resourceType, systemData, tags, location, provisioningState, dataLocation, fromSenderDomain, mailFromSenderDomain, domainManagement, verificationStates, verificationRecords, userEngagementTracking, default); } - /// Initializes a new instance of DomainPropertiesVerificationStates. + /// Initializes a new instance of . /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. @@ -101,19 +101,19 @@ public static CommunicationDomainResourceData CommunicationDomainResourceData(Re /// A new instance for mocking. public static DomainPropertiesVerificationStates DomainPropertiesVerificationStates(DomainVerificationStatusRecord domain = null, DomainVerificationStatusRecord spf = null, DomainVerificationStatusRecord dkim = null, DomainVerificationStatusRecord dkim2 = null, DomainVerificationStatusRecord dmarc = null) { - return new DomainPropertiesVerificationStates(domain, spf, dkim, dkim2, dmarc); + return new DomainPropertiesVerificationStates(domain, spf, dkim, dkim2, dmarc, default); } - /// Initializes a new instance of DomainVerificationStatusRecord. + /// Initializes a new instance of . /// Status of the verification operation. /// Error code. This property will only be present if the status is UnableToVerify. /// A new instance for mocking. public static DomainVerificationStatusRecord DomainVerificationStatusRecord(DomainRecordVerificationStatus? status = null, string errorCode = null) { - return new DomainVerificationStatusRecord(status, errorCode); + return new DomainVerificationStatusRecord(status, errorCode, default); } - /// Initializes a new instance of DomainPropertiesVerificationRecords. + /// Initializes a new instance of . /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. @@ -122,10 +122,10 @@ public static DomainVerificationStatusRecord DomainVerificationStatusRecord(Doma /// A new instance for mocking. public static DomainPropertiesVerificationRecords DomainPropertiesVerificationRecords(VerificationDnsRecord domain = null, VerificationDnsRecord spf = null, VerificationDnsRecord dkim = null, VerificationDnsRecord dkim2 = null, VerificationDnsRecord dmarc = null) { - return new DomainPropertiesVerificationRecords(domain, spf, dkim, dkim2, dmarc); + return new DomainPropertiesVerificationRecords(domain, spf, dkim, dkim2, dmarc, default); } - /// Initializes a new instance of VerificationDnsRecord. + /// Initializes a new instance of . /// Type of the DNS record. Example: TXT. /// Name of the DNS record. /// Value of the DNS record. @@ -133,10 +133,10 @@ public static DomainPropertiesVerificationRecords DomainPropertiesVerificationRe /// A new instance for mocking. public static VerificationDnsRecord VerificationDnsRecord(string dnsRecordType = null, string name = null, string value = null, int? timeToLiveInSeconds = null) { - return new VerificationDnsRecord(dnsRecordType, name, value, timeToLiveInSeconds); + return new VerificationDnsRecord(dnsRecordType, name, value, timeToLiveInSeconds, default); } - /// Initializes a new instance of EmailServiceResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -150,10 +150,10 @@ public static EmailServiceResourceData EmailServiceResourceData(ResourceIdentifi { tags ??= new Dictionary(); - return new EmailServiceResourceData(id, name, resourceType, systemData, tags, location, provisioningState, dataLocation); + return new EmailServiceResourceData(id, name, resourceType, systemData, tags, location, provisioningState, dataLocation, default); } - /// Initializes a new instance of SenderUsernameResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -165,7 +165,7 @@ public static EmailServiceResourceData EmailServiceResourceData(ResourceIdentifi /// A new instance for mocking. public static SenderUsernameResourceData SenderUsernameResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string dataLocation = null, string username = null, string displayName = null, CommunicationServiceProvisioningState? provisioningState = null) { - return new SenderUsernameResourceData(id, name, resourceType, systemData, dataLocation, username, displayName, provisioningState); + return new SenderUsernameResourceData(id, name, resourceType, systemData, dataLocation, username, displayName, provisioningState, default); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs index 1a09aeeebd1e..3eb57efe4f5c 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _communicationDomainResourceDomainsRestClient.CreateListByEmailServiceResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communicationDomainResourceDomainsRestClient.CreateListByEmailServiceResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunicationDomainResource(Client, CommunicationDomainResourceData.DeserializeCommunicationDomainResourceData(e)), _communicationDomainResourceDomainsClientDiagnostics, Pipeline, "CommunicationDomainResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunicationDomainResource(Client, CommunicationDomainResourceData.DeserializeCommunicationDomainResourceData(e)), _communicationDomainResourceDomainsClientDiagnostics, Pipeline, "CommunicationDomainResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _communicationDomainResourceDomainsRestClient.CreateListByEmailServiceResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communicationDomainResourceDomainsRestClient.CreateListByEmailServiceResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunicationDomainResource(Client, CommunicationDomainResourceData.DeserializeCommunicationDomainResourceData(e)), _communicationDomainResourceDomainsClientDiagnostics, Pipeline, "CommunicationDomainResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunicationDomainResource(Client, CommunicationDomainResourceData.DeserializeCommunicationDomainResourceData(e)), _communicationDomainResourceDomainsClientDiagnostics, Pipeline, "CommunicationDomainResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceData.cs index 210365230b97..07d8345db1be 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceData.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Communication /// public partial class CommunicationDomainResourceData : TrackedResourceData { - /// Initializes a new instance of CommunicationDomainResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CommunicationDomainResourceData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CommunicationDomainResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public CommunicationDomainResourceData(AzureLocation location) : base(location) /// List of VerificationStatusRecord. /// List of DnsRecord. /// Describes whether user engagement tracking is enabled or disabled. - internal CommunicationDomainResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DomainProvisioningState? provisioningState, string dataLocation, string fromSenderDomain, string mailFromSenderDomain, DomainManagement? domainManagement, DomainPropertiesVerificationStates verificationStates, DomainPropertiesVerificationRecords verificationRecords, UserEngagementTracking? userEngagementTracking) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CommunicationDomainResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DomainProvisioningState? provisioningState, string dataLocation, string fromSenderDomain, string mailFromSenderDomain, DomainManagement? domainManagement, DomainPropertiesVerificationStates verificationStates, DomainPropertiesVerificationRecords verificationRecords, UserEngagementTracking? userEngagementTracking, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; DataLocation = dataLocation; @@ -49,6 +54,12 @@ internal CommunicationDomainResourceData(ResourceIdentifier id, string name, Res VerificationStates = verificationStates; VerificationRecords = verificationRecords; UserEngagementTracking = userEngagementTracking; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationDomainResourceData() + { } /// Provisioning state of the resource. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs index 370944213d87..f1e91e21e538 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _communicationServiceResourceCommunicationServicesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communicationServiceResourceCommunicationServicesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), _communicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "CommunicationServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), _communicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "CommunicationServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _communicationServiceResourceCommunicationServicesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communicationServiceResourceCommunicationServicesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), _communicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "CommunicationServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), _communicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "CommunicationServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs index 752a80fd7ea2..8e21b9917181 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Communication /// public partial class CommunicationServiceResourceData : TrackedResourceData { - /// Initializes a new instance of CommunicationServiceResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CommunicationServiceResourceData(AzureLocation location) : base(location) { LinkedDomains = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationServiceResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +43,8 @@ public CommunicationServiceResourceData(AzureLocation location) : base(location) /// Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs. /// The immutable resource Id of the communication service. /// List of email Domain resource Ids. - internal CommunicationServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CommunicationServicesProvisioningState? provisioningState, string hostName, string dataLocation, ResourceIdentifier notificationHubId, string version, Guid? immutableResourceId, IList linkedDomains) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CommunicationServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CommunicationServicesProvisioningState? provisioningState, string hostName, string dataLocation, ResourceIdentifier notificationHubId, string version, Guid? immutableResourceId, IList linkedDomains, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; HostName = hostName; @@ -49,6 +53,12 @@ internal CommunicationServiceResourceData(ResourceIdentifier id, string name, Re Version = version; ImmutableResourceId = immutableResourceId; LinkedDomains = linkedDomains; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunicationServiceResourceData() + { } /// Provisioning state of the resource. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs index 61b8d2452680..c69278c89726 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _emailServiceResourceEmailServicesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _emailServiceResourceEmailServicesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), _emailServiceResourceEmailServicesClientDiagnostics, Pipeline, "EmailServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), _emailServiceResourceEmailServicesClientDiagnostics, Pipeline, "EmailServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _emailServiceResourceEmailServicesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _emailServiceResourceEmailServicesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), _emailServiceResourceEmailServicesClientDiagnostics, Pipeline, "EmailServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), _emailServiceResourceEmailServicesClientDiagnostics, Pipeline, "EmailServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceData.cs index 5f2fa7d81b84..b742c55628b6 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceData.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Communication /// public partial class EmailServiceResourceData : TrackedResourceData { - /// Initializes a new instance of EmailServiceResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public EmailServiceResourceData(AzureLocation location) : base(location) { } - /// Initializes a new instance of EmailServiceResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public EmailServiceResourceData(AzureLocation location) : base(location) /// The location. /// Provisioning state of the resource. /// The location where the email service stores its data at rest. - internal EmailServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, EmailServicesProvisioningState? provisioningState, string dataLocation) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal EmailServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, EmailServicesProvisioningState? provisioningState, string dataLocation, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; DataLocation = dataLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmailServiceResourceData() + { } /// Provisioning state of the resource. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 00e0cd5492fc..75cc6ba24fe1 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -129,7 +129,7 @@ public virtual AsyncPageable GetCommunicationServi { HttpMessage FirstPageRequest(int? pageSizeHint) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); } /// @@ -151,7 +151,7 @@ public virtual Pageable GetCommunicationServiceRes { HttpMessage FirstPageRequest(int? pageSizeHint) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); } /// @@ -173,7 +173,7 @@ public virtual AsyncPageable GetEmailServiceResourcesAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEmailServiceResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEmailServiceResources", "value", "nextLink", cancellationToken); } /// @@ -195,7 +195,7 @@ public virtual Pageable GetEmailServiceResources(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEmailServiceResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEmailServiceResources", "value", "nextLink", cancellationToken); } /// @@ -216,7 +216,7 @@ public virtual Pageable GetEmailServiceResources(Cancellat public virtual AsyncPageable GetVerifiedExchangeOnlineDomainsEmailServicesAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListVerifiedExchangeOnlineDomainsRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); } /// @@ -237,7 +237,7 @@ public virtual AsyncPageable GetVerifiedExchangeOnlineDomainsEmailServic public virtual Pageable GetVerifiedExchangeOnlineDomainsEmailServices(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListVerifiedExchangeOnlineDomainsRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.Serialization.cs index 5c2386e80280..310639b6b4f8 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationAcceptTags : IUtf8JsonSerializable + public partial class CommunicationAcceptTags : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationAcceptTags DeserializeCommunicationAcceptTags(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationAcceptTags(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + CommunicationAcceptTags IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationAcceptTags(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationAcceptTags IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationAcceptTags(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationAcceptTags model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationAcceptTags(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationAcceptTags(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.cs index 853cd04972af..6db964434cf3 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationAcceptTags.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Communication.Models /// An ARM resource with that can accept tags. public partial class CommunicationAcceptTags { - /// Initializes a new instance of CommunicationAcceptTags. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationAcceptTags() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Tags of the service which is a list of key value pairs that describe the resource. + /// Keeps track of any properties unknown to the library. + internal CommunicationAcceptTags(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Tags of the service which is a list of key value pairs that describe the resource. public IDictionary Tags { get; } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourceData.Serialization.cs index 81afe8f123e0..5f7296383216 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourceData.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourceData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Communication { - public partial class CommunicationDomainResourceData : IUtf8JsonSerializable + public partial class CommunicationDomainResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -44,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserEngagementTracking.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationDomainResourceData DeserializeCommunicationDomainResourceData(JsonElement element) + internal static CommunicationDomainResourceData DeserializeCommunicationDomainResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +88,7 @@ internal static CommunicationDomainResourceData DeserializeCommunicationDomainRe Optional verificationStates = default; Optional verificationRecords = default; Optional userEngagementTracking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -184,8 +206,61 @@ internal static CommunicationDomainResourceData DeserializeCommunicationDomainRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationDomainResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), dataLocation.Value, fromSenderDomain.Value, mailFromSenderDomain.Value, Optional.ToNullable(domainManagement), verificationStates.Value, verificationRecords.Value, Optional.ToNullable(userEngagementTracking), serializedAdditionalRawData); + } + + CommunicationDomainResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationDomainResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationDomainResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationDomainResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationDomainResourceData model) + { + if (model is null) + { + return null; } - return new CommunicationDomainResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), dataLocation.Value, fromSenderDomain.Value, mailFromSenderDomain.Value, Optional.ToNullable(domainManagement), verificationStates.Value, verificationRecords.Value, Optional.ToNullable(userEngagementTracking)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationDomainResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationDomainResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.Serialization.cs index 9d88622c425e..d73f29255a12 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationDomainResourcePatch : IUtf8JsonSerializable + public partial class CommunicationDomainResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserEngagementTracking.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationDomainResourcePatch DeserializeCommunicationDomainResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional userEngagementTracking = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("userEngagementTracking"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userEngagementTracking = new UserEngagementTracking(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationDomainResourcePatch(Optional.ToDictionary(tags), Optional.ToNullable(userEngagementTracking), serializedAdditionalRawData); + } + + CommunicationDomainResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationDomainResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationDomainResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationDomainResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationDomainResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationDomainResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationDomainResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.cs index cda7fbe1bc91..21d79aaac27a 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationDomainResourcePatch.cs @@ -5,16 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// A class that describes the PATCH request parameters of a Domains resource. public partial class CommunicationDomainResourcePatch : CommunicationAcceptTags { - /// Initializes a new instance of CommunicationDomainResourcePatch. + /// Initializes a new instance of . public CommunicationDomainResourcePatch() { } + /// Initializes a new instance of . + /// Tags of the service which is a list of key value pairs that describe the resource. + /// Describes whether user engagement tracking is enabled or disabled. + /// Keeps track of any properties unknown to the library. + internal CommunicationDomainResourcePatch(IDictionary tags, UserEngagementTracking? userEngagementTracking, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + UserEngagementTracking = userEngagementTracking; + } + /// Describes whether user engagement tracking is enabled or disabled. public UserEngagementTracking? UserEngagementTracking { get; set; } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.Serialization.cs index c98102d610d5..3885e5cebd9f 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationNameAvailabilityContent : IUtf8JsonSerializable + public partial class CommunicationNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationNameAvailabilityContent DeserializeCommunicationNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationNameAvailabilityContent(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + CommunicationNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.cs index 1322fbb2712a..ce9759cef265 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Communication.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.Communication.Models /// The check availability request body. public partial class CommunicationNameAvailabilityContent { - /// Initializes a new instance of CommunicationNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunicationNameAvailabilityContent() { } + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal CommunicationNameAvailabilityContent(string name, ResourceType? resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the resource for which availability needs to be checked. public string Name { get; set; } /// The resource type. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.Serialization.cs index 830ce8b54a44..6d52957e8801 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationNameAvailabilityResult + public partial class CommunicationNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationNameAvailabilityResult DeserializeCommunicationNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationNameAvailabilityResult DeserializeCommunicationNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static CommunicationNameAvailabilityResult DeserializeCommunicationName Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +90,61 @@ internal static CommunicationNameAvailabilityResult DeserializeCommunicationName message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new CommunicationNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + CommunicationNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.cs index 4e6c4679ff4c..e47fb6321cf0 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// The check availability result. public partial class CommunicationNameAvailabilityResult { - /// Initializes a new instance of CommunicationNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommunicationNameAvailabilityResult() { } - /// Initializes a new instance of CommunicationNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. - internal CommunicationNameAvailabilityResult(bool? isNameAvailable, CommunicationNameAvailabilityReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal CommunicationNameAvailabilityResult(bool? isNameAvailable, CommunicationNameAvailabilityReason? reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the resource name is available. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.Serialization.cs index 352519842cd1..4b9b6d362a53 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationServiceKeys + public partial class CommunicationServiceKeys : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationServiceKeys DeserializeCommunicationServiceKeys(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PrimaryKey)) + { + writer.WritePropertyName("primaryKey"u8); + writer.WriteStringValue(PrimaryKey); + } + if (Optional.IsDefined(SecondaryKey)) + { + writer.WritePropertyName("secondaryKey"u8); + writer.WriteStringValue(SecondaryKey); + } + if (Optional.IsDefined(PrimaryConnectionString)) + { + writer.WritePropertyName("primaryConnectionString"u8); + writer.WriteStringValue(PrimaryConnectionString); + } + if (Optional.IsDefined(SecondaryConnectionString)) + { + writer.WritePropertyName("secondaryConnectionString"u8); + writer.WriteStringValue(SecondaryConnectionString); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationServiceKeys DeserializeCommunicationServiceKeys(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static CommunicationServiceKeys DeserializeCommunicationServiceKeys(Jso Optional secondaryKey = default; Optional primaryConnectionString = default; Optional secondaryConnectionString = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryKey"u8)) @@ -44,8 +93,61 @@ internal static CommunicationServiceKeys DeserializeCommunicationServiceKeys(Jso secondaryConnectionString = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationServiceKeys(primaryKey.Value, secondaryKey.Value, primaryConnectionString.Value, secondaryConnectionString.Value); + return new CommunicationServiceKeys(primaryKey.Value, secondaryKey.Value, primaryConnectionString.Value, secondaryConnectionString.Value, serializedAdditionalRawData); + } + + CommunicationServiceKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationServiceKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationServiceKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationServiceKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationServiceKeys model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationServiceKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationServiceKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.cs index 66975e1644b9..227c6653783b 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceKeys.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// A class representing the access keys of a CommunicationService. public partial class CommunicationServiceKeys { - /// Initializes a new instance of CommunicationServiceKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommunicationServiceKeys() { } - /// Initializes a new instance of CommunicationServiceKeys. + /// Initializes a new instance of . /// The primary access key. /// The secondary access key. /// CommunicationService connection string constructed via the primaryKey. /// CommunicationService connection string constructed via the secondaryKey. - internal CommunicationServiceKeys(string primaryKey, string secondaryKey, string primaryConnectionString, string secondaryConnectionString) + /// Keeps track of any properties unknown to the library. + internal CommunicationServiceKeys(string primaryKey, string secondaryKey, string primaryConnectionString, string secondaryConnectionString, Dictionary serializedAdditionalRawData) { PrimaryKey = primaryKey; SecondaryKey = secondaryKey; PrimaryConnectionString = primaryConnectionString; SecondaryConnectionString = secondaryConnectionString; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The primary access key. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.Serialization.cs index c0745655fc40..6dd0fd5b3cad 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationServiceNameAvailabilityContent : IUtf8JsonSerializable + public partial class CommunicationServiceNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationServiceNameAvailabilityContent DeserializeCommunicationServiceNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationServiceNameAvailabilityContent(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + CommunicationServiceNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationServiceNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationServiceNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationServiceNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationServiceNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationServiceNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationServiceNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.cs index f019236a7ec4..337356aaca5b 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceNameAvailabilityContent.cs @@ -5,14 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.Communication.Models { /// Data POST-ed to the nameAvailability action. public partial class CommunicationServiceNameAvailabilityContent : CommunicationNameAvailabilityContent { - /// Initializes a new instance of CommunicationServiceNameAvailabilityContent. + /// Initializes a new instance of . public CommunicationServiceNameAvailabilityContent() { } + + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal CommunicationServiceNameAvailabilityContent(string name, ResourceType? resourceType, Dictionary serializedAdditionalRawData) : base(name, resourceType, serializedAdditionalRawData) + { + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs index 7f1efde6d685..b1e2804c9509 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Communication { - public partial class CommunicationServiceResourceData : IUtf8JsonSerializable + public partial class CommunicationServiceResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -50,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunicationServiceResourceData DeserializeCommunicationServiceResourceData(JsonElement element) + internal static CommunicationServiceResourceData DeserializeCommunicationServiceResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +92,7 @@ internal static CommunicationServiceResourceData DeserializeCommunicationService Optional version = default; Optional immutableResourceId = default; Optional> linkedDomains = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -185,8 +206,61 @@ internal static CommunicationServiceResourceData DeserializeCommunicationService } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationServiceResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), hostName.Value, dataLocation.Value, notificationHubId.Value, version.Value, Optional.ToNullable(immutableResourceId), Optional.ToList(linkedDomains), serializedAdditionalRawData); + } + + CommunicationServiceResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationServiceResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationServiceResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationServiceResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationServiceResourceData model) + { + if (model is null) + { + return null; } - return new CommunicationServiceResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), hostName.Value, dataLocation.Value, notificationHubId.Value, version.Value, Optional.ToNullable(immutableResourceId), Optional.ToList(linkedDomains)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationServiceResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationServiceResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.Serialization.cs index 3e83df02ac12..281d5eb0b87c 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication; namespace Azure.ResourceManager.Communication.Models { - internal partial class CommunicationServiceResourceList + internal partial class CommunicationServiceResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunicationServiceResourceList DeserializeCommunicationServiceResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunicationServiceResourceList DeserializeCommunicationServiceResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static CommunicationServiceResourceList DeserializeCommunicationService nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunicationServiceResourceList(Optional.ToList(value), nextLink.Value); + return new CommunicationServiceResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CommunicationServiceResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationServiceResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationServiceResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationServiceResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationServiceResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationServiceResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationServiceResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.cs index 836afda02c59..1d296d701f1a 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.Communication.Models /// Object that includes an array of CommunicationServices and a possible link for next set. internal partial class CommunicationServiceResourceList { - /// Initializes a new instance of CommunicationServiceResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommunicationServiceResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CommunicationServiceResourceList. + /// Initializes a new instance of . /// List of CommunicationService. /// /// The URL the client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal CommunicationServiceResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CommunicationServiceResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of CommunicationService. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs index 6a191267a994..0c717939e1cd 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class CommunicationServiceResourcePatch : IUtf8JsonSerializable + public partial class CommunicationServiceResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -39,7 +47,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CommunicationServiceResourcePatch DeserializeCommunicationServiceResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional> linkedDomains = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("linkedDomains"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + linkedDomains = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunicationServiceResourcePatch(Optional.ToDictionary(tags), Optional.ToList(linkedDomains), serializedAdditionalRawData); + } + + CommunicationServiceResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationServiceResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunicationServiceResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunicationServiceResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunicationServiceResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunicationServiceResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunicationServiceResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs index b1f1657a6da4..3463bc1b0445 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,21 @@ namespace Azure.ResourceManager.Communication.Models /// A class representing update parameters for CommunicationService resource. public partial class CommunicationServiceResourcePatch : CommunicationAcceptTags { - /// Initializes a new instance of CommunicationServiceResourcePatch. + /// Initializes a new instance of . public CommunicationServiceResourcePatch() { LinkedDomains = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Tags of the service which is a list of key value pairs that describe the resource. + /// List of email Domain resource Ids. + /// Keeps track of any properties unknown to the library. + internal CommunicationServiceResourcePatch(IDictionary tags, IList linkedDomains, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + LinkedDomains = linkedDomains; + } + /// List of email Domain resource Ids. public IList LinkedDomains { get; } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.Serialization.cs index 5d0ff204d5e5..cc4bcfc91d41 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.Serialization.cs @@ -5,15 +5,103 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class DomainPropertiesVerificationRecords + public partial class DomainPropertiesVerificationRecords : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DomainPropertiesVerificationRecords DeserializeDomainPropertiesVerificationRecords(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("Domain"u8); + if (Domain is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Domain).Serialize(writer, options); + } + } + if (Optional.IsDefined(Spf)) + { + writer.WritePropertyName("SPF"u8); + if (Spf is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Spf).Serialize(writer, options); + } + } + if (Optional.IsDefined(Dkim)) + { + writer.WritePropertyName("DKIM"u8); + if (Dkim is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dkim).Serialize(writer, options); + } + } + if (Optional.IsDefined(Dkim2)) + { + writer.WritePropertyName("DKIM2"u8); + if (Dkim2 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dkim2).Serialize(writer, options); + } + } + if (Optional.IsDefined(Dmarc)) + { + writer.WritePropertyName("DMARC"u8); + if (Dmarc is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dmarc).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DomainPropertiesVerificationRecords DeserializeDomainPropertiesVerificationRecords(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +111,7 @@ internal static DomainPropertiesVerificationRecords DeserializeDomainPropertiesV Optional dkim = default; Optional dkiM2 = default; Optional dmarc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Domain"u8)) @@ -70,8 +159,61 @@ internal static DomainPropertiesVerificationRecords DeserializeDomainPropertiesV dmarc = VerificationDnsRecord.DeserializeVerificationDnsRecord(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DomainPropertiesVerificationRecords(domain.Value, spf.Value, dkim.Value, dkiM2.Value, dmarc.Value, serializedAdditionalRawData); + } + + DomainPropertiesVerificationRecords IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDomainPropertiesVerificationRecords(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DomainPropertiesVerificationRecords IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDomainPropertiesVerificationRecords(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DomainPropertiesVerificationRecords model) + { + if (model is null) + { + return null; } - return new DomainPropertiesVerificationRecords(domain.Value, spf.Value, dkim.Value, dkiM2.Value, dmarc.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DomainPropertiesVerificationRecords(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDomainPropertiesVerificationRecords(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.cs index a7c6e693d581..579939959af5 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationRecords.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// List of DnsRecord. public partial class DomainPropertiesVerificationRecords { - /// Initializes a new instance of DomainPropertiesVerificationRecords. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DomainPropertiesVerificationRecords() { } - /// Initializes a new instance of DomainPropertiesVerificationRecords. + /// Initializes a new instance of . /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. - internal DomainPropertiesVerificationRecords(VerificationDnsRecord domain, VerificationDnsRecord spf, VerificationDnsRecord dkim, VerificationDnsRecord dkim2, VerificationDnsRecord dmarc) + /// Keeps track of any properties unknown to the library. + internal DomainPropertiesVerificationRecords(VerificationDnsRecord domain, VerificationDnsRecord spf, VerificationDnsRecord dkim, VerificationDnsRecord dkim2, VerificationDnsRecord dmarc, Dictionary serializedAdditionalRawData) { Domain = domain; Spf = spf; Dkim = dkim; Dkim2 = dkim2; Dmarc = dmarc; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A class that represents a VerificationStatus record. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.Serialization.cs index 05fd779b7a22..027842f63d1f 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.Serialization.cs @@ -5,15 +5,103 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class DomainPropertiesVerificationStates + public partial class DomainPropertiesVerificationStates : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DomainPropertiesVerificationStates DeserializeDomainPropertiesVerificationStates(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("Domain"u8); + if (Domain is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Domain).Serialize(writer, options); + } + } + if (Optional.IsDefined(Spf)) + { + writer.WritePropertyName("SPF"u8); + if (Spf is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Spf).Serialize(writer, options); + } + } + if (Optional.IsDefined(Dkim)) + { + writer.WritePropertyName("DKIM"u8); + if (Dkim is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dkim).Serialize(writer, options); + } + } + if (Optional.IsDefined(Dkim2)) + { + writer.WritePropertyName("DKIM2"u8); + if (Dkim2 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dkim2).Serialize(writer, options); + } + } + if (Optional.IsDefined(Dmarc)) + { + writer.WritePropertyName("DMARC"u8); + if (Dmarc is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dmarc).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DomainPropertiesVerificationStates DeserializeDomainPropertiesVerificationStates(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +111,7 @@ internal static DomainPropertiesVerificationStates DeserializeDomainPropertiesVe Optional dkim = default; Optional dkiM2 = default; Optional dmarc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("Domain"u8)) @@ -70,8 +159,61 @@ internal static DomainPropertiesVerificationStates DeserializeDomainPropertiesVe dmarc = DomainVerificationStatusRecord.DeserializeDomainVerificationStatusRecord(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DomainPropertiesVerificationStates(domain.Value, spf.Value, dkim.Value, dkiM2.Value, dmarc.Value, serializedAdditionalRawData); + } + + DomainPropertiesVerificationStates IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDomainPropertiesVerificationStates(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DomainPropertiesVerificationStates IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDomainPropertiesVerificationStates(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DomainPropertiesVerificationStates model) + { + if (model is null) + { + return null; } - return new DomainPropertiesVerificationStates(domain.Value, spf.Value, dkim.Value, dkiM2.Value, dmarc.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DomainPropertiesVerificationStates(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDomainPropertiesVerificationStates(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.cs index 01d97ac1d5d1..40d1bb9b0574 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainPropertiesVerificationStates.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// List of VerificationStatusRecord. public partial class DomainPropertiesVerificationStates { - /// Initializes a new instance of DomainPropertiesVerificationStates. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DomainPropertiesVerificationStates() { } - /// Initializes a new instance of DomainPropertiesVerificationStates. + /// Initializes a new instance of . /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. /// A class that represents a VerificationStatus record. - internal DomainPropertiesVerificationStates(DomainVerificationStatusRecord domain, DomainVerificationStatusRecord spf, DomainVerificationStatusRecord dkim, DomainVerificationStatusRecord dkim2, DomainVerificationStatusRecord dmarc) + /// Keeps track of any properties unknown to the library. + internal DomainPropertiesVerificationStates(DomainVerificationStatusRecord domain, DomainVerificationStatusRecord spf, DomainVerificationStatusRecord dkim, DomainVerificationStatusRecord dkim2, DomainVerificationStatusRecord dmarc, Dictionary serializedAdditionalRawData) { Domain = domain; Spf = spf; Dkim = dkim; Dkim2 = dkim2; Dmarc = dmarc; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A class that represents a VerificationStatus record. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.Serialization.cs index ecf3d8eeccaf..fab395fd35b5 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication; namespace Azure.ResourceManager.Communication.Models { - internal partial class DomainResourceList + internal partial class DomainResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DomainResourceList DeserializeDomainResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DomainResourceList DeserializeDomainResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DomainResourceList DeserializeDomainResourceList(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DomainResourceList(Optional.ToList(value), nextLink.Value); + return new DomainResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DomainResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDomainResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DomainResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDomainResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DomainResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DomainResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDomainResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.cs index ed58ed964dec..613670ab1213 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.Communication.Models /// Object that includes an array of Domains resource and a possible link for next set. internal partial class DomainResourceList { - /// Initializes a new instance of DomainResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DomainResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DomainResourceList. + /// Initializes a new instance of . /// List of Domains resource. /// /// The URL the client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal DomainResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DomainResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Domains resource. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.Serialization.cs index 53c394a01cc1..788dadbe45c0 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class DomainVerificationStatusRecord + public partial class DomainVerificationStatusRecord : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DomainVerificationStatusRecord DeserializeDomainVerificationStatusRecord(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DomainVerificationStatusRecord DeserializeDomainVerificationStatusRecord(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional errorCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -36,8 +65,61 @@ internal static DomainVerificationStatusRecord DeserializeDomainVerificationStat errorCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DomainVerificationStatusRecord(Optional.ToNullable(status), errorCode.Value); + return new DomainVerificationStatusRecord(Optional.ToNullable(status), errorCode.Value, serializedAdditionalRawData); + } + + DomainVerificationStatusRecord IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDomainVerificationStatusRecord(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DomainVerificationStatusRecord IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDomainVerificationStatusRecord(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DomainVerificationStatusRecord model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DomainVerificationStatusRecord(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDomainVerificationStatusRecord(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.cs index e1abb55fcd22..0ef544795c96 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainVerificationStatusRecord.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// A class that represents a VerificationStatus record. public partial class DomainVerificationStatusRecord { - /// Initializes a new instance of DomainVerificationStatusRecord. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DomainVerificationStatusRecord() { } - /// Initializes a new instance of DomainVerificationStatusRecord. + /// Initializes a new instance of . /// Status of the verification operation. /// Error code. This property will only be present if the status is UnableToVerify. - internal DomainVerificationStatusRecord(DomainRecordVerificationStatus? status, string errorCode) + /// Keeps track of any properties unknown to the library. + internal DomainVerificationStatusRecord(DomainRecordVerificationStatus? status, string errorCode, Dictionary serializedAdditionalRawData) { Status = status; ErrorCode = errorCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of the verification operation. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.Serialization.cs index d3ba7ed789b4..0598e07975ca 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class DomainsRecordVerificationContent : IUtf8JsonSerializable + public partial class DomainsRecordVerificationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("verificationType"u8); writer.WriteStringValue(VerificationType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DomainsRecordVerificationContent DeserializeDomainsRecordVerificationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DomainRecordVerificationType verificationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verificationType"u8)) + { + verificationType = new DomainRecordVerificationType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DomainsRecordVerificationContent(verificationType, serializedAdditionalRawData); + } + + DomainsRecordVerificationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDomainsRecordVerificationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DomainsRecordVerificationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDomainsRecordVerificationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DomainsRecordVerificationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DomainsRecordVerificationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDomainsRecordVerificationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.cs index c8359f27497c..2adab50f7dd8 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/DomainsRecordVerificationContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// Input parameter for verification APIs. public partial class DomainsRecordVerificationContent { - /// Initializes a new instance of DomainsRecordVerificationContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of verification. public DomainsRecordVerificationContent(DomainRecordVerificationType verificationType) { VerificationType = verificationType; } + /// Initializes a new instance of . + /// Type of verification. + /// Keeps track of any properties unknown to the library. + internal DomainsRecordVerificationContent(DomainRecordVerificationType verificationType, Dictionary serializedAdditionalRawData) + { + VerificationType = verificationType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DomainsRecordVerificationContent() + { + } + /// Type of verification. public DomainRecordVerificationType VerificationType { get; } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceData.Serialization.cs index 60b307ea33fd..477275251d56 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceData.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Communication { - public partial class EmailServiceResourceData : IUtf8JsonSerializable + public partial class EmailServiceResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -39,11 +46,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DataLocation); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EmailServiceResourceData DeserializeEmailServiceResourceData(JsonElement element) + internal static EmailServiceResourceData DeserializeEmailServiceResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +77,7 @@ internal static EmailServiceResourceData DeserializeEmailServiceResourceData(Jso Optional systemData = default; Optional provisioningState = default; Optional dataLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -127,8 +149,61 @@ internal static EmailServiceResourceData DeserializeEmailServiceResourceData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailServiceResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), dataLocation.Value, serializedAdditionalRawData); + } + + EmailServiceResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailServiceResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailServiceResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailServiceResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailServiceResourceData model) + { + if (model is null) + { + return null; } - return new EmailServiceResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), dataLocation.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailServiceResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailServiceResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.Serialization.cs index 00626f4ef832..daf1fb313c5f 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication; namespace Azure.ResourceManager.Communication.Models { - internal partial class EmailServiceResourceList + internal partial class EmailServiceResourceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EmailServiceResourceList DeserializeEmailServiceResourceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EmailServiceResourceList DeserializeEmailServiceResourceList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static EmailServiceResourceList DeserializeEmailServiceResourceList(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EmailServiceResourceList(Optional.ToList(value), nextLink.Value); + return new EmailServiceResourceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + EmailServiceResourceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailServiceResourceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailServiceResourceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailServiceResourceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailServiceResourceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailServiceResourceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailServiceResourceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.cs index ac28d6a50b48..8cc1a9507c2b 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication; @@ -14,22 +15,27 @@ namespace Azure.ResourceManager.Communication.Models /// Object that includes an array of EmailServices and a possible link for next set. internal partial class EmailServiceResourceList { - /// Initializes a new instance of EmailServiceResourceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EmailServiceResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of EmailServiceResourceList. + /// Initializes a new instance of . /// List of EmailService. /// /// The URL the client should use to fetch the next page (per server side paging). /// It's null for now, added for future use. /// - internal EmailServiceResourceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal EmailServiceResourceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of EmailService. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.Serialization.cs index a53b07a2c95f..f00e09afd7cf 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class EmailServiceResourcePatch : IUtf8JsonSerializable + public partial class EmailServiceResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EmailServiceResourcePatch DeserializeEmailServiceResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EmailServiceResourcePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + EmailServiceResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEmailServiceResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EmailServiceResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEmailServiceResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EmailServiceResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EmailServiceResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEmailServiceResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.cs index f16f2c61cb32..46c2b552e587 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/EmailServiceResourcePatch.cs @@ -5,14 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// A class representing update parameters for EmailService resource. public partial class EmailServiceResourcePatch : CommunicationAcceptTags { - /// Initializes a new instance of EmailServiceResourcePatch. + /// Initializes a new instance of . public EmailServiceResourcePatch() { } + + /// Initializes a new instance of . + /// Tags of the service which is a list of key value pairs that describe the resource. + /// Keeps track of any properties unknown to the library. + internal EmailServiceResourcePatch(IDictionary tags, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.Serialization.cs index e02fa104b031..be13e5b0205d 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class LinkNotificationHubContent : IUtf8JsonSerializable + public partial class LinkNotificationHubContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); writer.WritePropertyName("connectionString"u8); writer.WriteStringValue(ConnectionString); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static LinkNotificationHubContent DeserializeLinkNotificationHubContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + string connectionString = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectionString"u8)) + { + connectionString = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinkNotificationHubContent(resourceId, connectionString, serializedAdditionalRawData); + } + + LinkNotificationHubContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkNotificationHubContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkNotificationHubContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkNotificationHubContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkNotificationHubContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkNotificationHubContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkNotificationHubContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.cs index fe09f4b7f319..ea6636239cb1 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkNotificationHubContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Communication.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Communication.Models /// Description of an Azure Notification Hub to link to the communication service. public partial class LinkNotificationHubContent { - /// Initializes a new instance of LinkNotificationHubContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource ID of the notification hub. /// Connection string for the notification hub. /// or is null. @@ -26,6 +30,22 @@ public LinkNotificationHubContent(ResourceIdentifier resourceId, string connecti ConnectionString = connectionString; } + /// Initializes a new instance of . + /// The resource ID of the notification hub. + /// Connection string for the notification hub. + /// Keeps track of any properties unknown to the library. + internal LinkNotificationHubContent(ResourceIdentifier resourceId, string connectionString, Dictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + ConnectionString = connectionString; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LinkNotificationHubContent() + { + } + /// The resource ID of the notification hub. public ResourceIdentifier ResourceId { get; } /// Connection string for the notification hub. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.Serialization.cs index 3ffb93a3cfcf..e5915ba3d9a7 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class LinkedNotificationHub + public partial class LinkedNotificationHub : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LinkedNotificationHub DeserializeLinkedNotificationHub(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LinkedNotificationHub DeserializeLinkedNotificationHub(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -30,8 +64,61 @@ internal static LinkedNotificationHub DeserializeLinkedNotificationHub(JsonEleme resourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LinkedNotificationHub(resourceId.Value); + return new LinkedNotificationHub(resourceId.Value, serializedAdditionalRawData); + } + + LinkedNotificationHub IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedNotificationHub(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedNotificationHub IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedNotificationHub(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedNotificationHub model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedNotificationHub(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedNotificationHub(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.cs index 56428f5caaac..7ee9dbce06db 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/LinkedNotificationHub.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Communication.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Communication.Models /// A notification hub that has been linked to the communication service. public partial class LinkedNotificationHub { - /// Initializes a new instance of LinkedNotificationHub. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LinkedNotificationHub() { } - /// Initializes a new instance of LinkedNotificationHub. + /// Initializes a new instance of . /// The resource ID of the notification hub. - internal LinkedNotificationHub(ResourceIdentifier resourceId) + /// Keeps track of any properties unknown to the library. + internal LinkedNotificationHub(ResourceIdentifier resourceId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource ID of the notification hub. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.Serialization.cs index 983e6ae84568..782a3b9b0018 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class RegenerateCommunicationServiceKeyContent : IUtf8JsonSerializable + public partial class RegenerateCommunicationServiceKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyType)) { writer.WritePropertyName("keyType"u8); writer.WriteStringValue(KeyType.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RegenerateCommunicationServiceKeyContent DeserializeRegenerateCommunicationServiceKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional keyType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyType = property.Value.GetString().ToCommunicationServiceKeyType(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RegenerateCommunicationServiceKeyContent(Optional.ToNullable(keyType), serializedAdditionalRawData); + } + + RegenerateCommunicationServiceKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegenerateCommunicationServiceKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegenerateCommunicationServiceKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegenerateCommunicationServiceKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegenerateCommunicationServiceKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegenerateCommunicationServiceKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegenerateCommunicationServiceKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.cs index 09d5442002af..a3d29e1daf47 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/RegenerateCommunicationServiceKeyContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// Parameters describes the request to regenerate access keys. public partial class RegenerateCommunicationServiceKeyContent { - /// Initializes a new instance of RegenerateCommunicationServiceKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RegenerateCommunicationServiceKeyContent() { } + /// Initializes a new instance of . + /// The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). + /// Keeps track of any properties unknown to the library. + internal RegenerateCommunicationServiceKeyContent(CommunicationServiceKeyType? keyType, Dictionary serializedAdditionalRawData) + { + KeyType = keyType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). public CommunicationServiceKeyType? KeyType { get; set; } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.Serialization.cs index dbf57d9abf8b..80552e9b83ac 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication; namespace Azure.ResourceManager.Communication.Models { - internal partial class SenderUsernameResourceCollection + internal partial class SenderUsernameResourceCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SenderUsernameResourceCollection DeserializeSenderUsernameResourceCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SenderUsernameResourceCollection DeserializeSenderUsernameResourceCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static SenderUsernameResourceCollection DeserializeSenderUsernameResour nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SenderUsernameResourceCollection(Optional.ToList(value), nextLink.Value); + return new SenderUsernameResourceCollection(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + SenderUsernameResourceCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSenderUsernameResourceCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SenderUsernameResourceCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSenderUsernameResourceCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SenderUsernameResourceCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SenderUsernameResourceCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSenderUsernameResourceCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.cs index d2b010571894..00ce855f66ba 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceCollection.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Communication.Models /// A class representing a Domains SenderUsernames collection. internal partial class SenderUsernameResourceCollection { - /// Initializes a new instance of SenderUsernameResourceCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SenderUsernameResourceCollection() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of SenderUsernameResourceCollection. + /// Initializes a new instance of . /// List of SenderUsernames. /// The URL the client should use to fetch the next page (per server side paging). - internal SenderUsernameResourceCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SenderUsernameResourceCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of SenderUsernames. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceData.Serialization.cs index 520adf055197..74641151d227 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceData.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SenderUsernameResourceData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Communication.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Communication { - public partial class SenderUsernameResourceData : IUtf8JsonSerializable + public partial class SenderUsernameResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DisplayName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SenderUsernameResourceData DeserializeSenderUsernameResourceData(JsonElement element) + internal static SenderUsernameResourceData DeserializeSenderUsernameResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +69,7 @@ internal static SenderUsernameResourceData DeserializeSenderUsernameResourceData Optional username = default; Optional displayName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -109,8 +132,61 @@ internal static SenderUsernameResourceData DeserializeSenderUsernameResourceData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SenderUsernameResourceData(id, name, type, systemData.Value, dataLocation.Value, username.Value, displayName.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + SenderUsernameResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSenderUsernameResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SenderUsernameResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSenderUsernameResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SenderUsernameResourceData model) + { + if (model is null) + { + return null; } - return new SenderUsernameResourceData(id, name, type, systemData.Value, dataLocation.Value, username.Value, displayName.Value, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SenderUsernameResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSenderUsernameResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.Serialization.cs index b38c23ebb5c7..2bab377217cc 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Communication.Models { - public partial class VerificationDnsRecord + public partial class VerificationDnsRecord : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VerificationDnsRecord DeserializeVerificationDnsRecord(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VerificationDnsRecord DeserializeVerificationDnsRecord(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static VerificationDnsRecord DeserializeVerificationDnsRecord(JsonEleme Optional name = default; Optional value = default; Optional ttl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -48,8 +77,61 @@ internal static VerificationDnsRecord DeserializeVerificationDnsRecord(JsonEleme ttl = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VerificationDnsRecord(type.Value, name.Value, value.Value, Optional.ToNullable(ttl)); + return new VerificationDnsRecord(type.Value, name.Value, value.Value, Optional.ToNullable(ttl), serializedAdditionalRawData); + } + + VerificationDnsRecord IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVerificationDnsRecord(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VerificationDnsRecord IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVerificationDnsRecord(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VerificationDnsRecord model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VerificationDnsRecord(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVerificationDnsRecord(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.cs index d62a19a55d48..366e71e8acd9 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/VerificationDnsRecord.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Communication.Models { /// A class that represents a VerificationStatus record. public partial class VerificationDnsRecord { - /// Initializes a new instance of VerificationDnsRecord. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VerificationDnsRecord() { } - /// Initializes a new instance of VerificationDnsRecord. + /// Initializes a new instance of . /// Type of the DNS record. Example: TXT. /// Name of the DNS record. /// Value of the DNS record. /// Represents an expiry time in seconds to represent how long this entry can be cached by the resolver, default = 3600sec. - internal VerificationDnsRecord(string dnsRecordType, string name, string value, int? timeToLiveInSeconds) + /// Keeps track of any properties unknown to the library. + internal VerificationDnsRecord(string dnsRecordType, string name, string value, int? timeToLiveInSeconds, Dictionary serializedAdditionalRawData) { DnsRecordType = dnsRecordType; Name = name; Value = value; TimeToLiveInSeconds = timeToLiveInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of the DNS record. Example: TXT. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs index 3e7ccde21997..ff29adddf120 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs @@ -51,9 +51,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateLinkNotificationHubRequest(string subscriptionId, str if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; @@ -357,9 +353,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -525,9 +519,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -755,9 +747,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs index cca2058e6d5e..df9a95bb1ab8 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -306,9 +304,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -470,9 +466,7 @@ internal HttpMessage CreateInitiateVerificationRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -553,9 +547,7 @@ internal HttpMessage CreateCancelVerificationRequest(string subscriptionId, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs index 35fe8414d47a..3ffe53e7b4d1 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs @@ -137,9 +137,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -287,9 +285,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs index 9914a7d7b5cd..f507900b128e 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs index b797c08a6c75..7f5f29796399 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _senderUsernameResourceSenderUsernamesRestClient.CreateListByDomainsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _senderUsernameResourceSenderUsernamesRestClient.CreateListByDomainsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SenderUsernameResource(Client, SenderUsernameResourceData.DeserializeSenderUsernameResourceData(e)), _senderUsernameResourceSenderUsernamesClientDiagnostics, Pipeline, "SenderUsernameResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SenderUsernameResource(Client, SenderUsernameResourceData.DeserializeSenderUsernameResourceData(e)), _senderUsernameResourceSenderUsernamesClientDiagnostics, Pipeline, "SenderUsernameResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _senderUsernameResourceSenderUsernamesRestClient.CreateListByDomainsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _senderUsernameResourceSenderUsernamesRestClient.CreateListByDomainsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SenderUsernameResource(Client, SenderUsernameResourceData.DeserializeSenderUsernameResourceData(e)), _senderUsernameResourceSenderUsernamesClientDiagnostics, Pipeline, "SenderUsernameResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SenderUsernameResource(Client, SenderUsernameResourceData.DeserializeSenderUsernameResourceData(e)), _senderUsernameResourceSenderUsernamesClientDiagnostics, Pipeline, "SenderUsernameResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceData.cs index 84829e1f3947..e05f0f014f84 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceData.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Communication.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Communication /// public partial class SenderUsernameResourceData : ResourceData { - /// Initializes a new instance of SenderUsernameResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SenderUsernameResourceData() { } - /// Initializes a new instance of SenderUsernameResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +36,14 @@ public SenderUsernameResourceData() /// A sender senderUsername to be used when sending emails. /// The display name for the senderUsername. /// Provisioning state of the resource. Unknown is the default state for Communication Services. - internal SenderUsernameResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string dataLocation, string username, string displayName, CommunicationServiceProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal SenderUsernameResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string dataLocation, string username, string displayName, CommunicationServiceProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DataLocation = dataLocation; Username = username; DisplayName = displayName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The location where the SenderUsername resource data is stored at rest. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs index abac298be04c..29c104e88d90 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Compute.Models /// Model factory for models. public static partial class ArmComputeModelFactory { - /// Initializes a new instance of ComputeApiError. + /// Initializes a new instance of . /// The Api error details. /// The Api inner error. /// The error code. @@ -29,29 +29,29 @@ public static ComputeApiError ComputeApiError(IEnumerable d { details ??= new List(); - return new ComputeApiError(details?.ToList(), innererror, code, target, message); + return new ComputeApiError(details?.ToList(), innererror, code, target, message, default); } - /// Initializes a new instance of ComputeApiErrorBase. + /// Initializes a new instance of . /// The error code. /// The target of the particular error. /// The error message. /// A new instance for mocking. public static ComputeApiErrorBase ComputeApiErrorBase(string code = null, string target = null, string message = null) { - return new ComputeApiErrorBase(code, target, message); + return new ComputeApiErrorBase(code, target, message, default); } - /// Initializes a new instance of InnerError. + /// Initializes a new instance of . /// The exception type. /// The internal error message or exception dump. /// A new instance for mocking. public static InnerError InnerError(string exceptiontype = null, string errordetail = null) { - return new InnerError(exceptiontype, errordetail); + return new InnerError(exceptiontype, errordetail, default); } - /// Initializes a new instance of ComputeUsage. + /// Initializes a new instance of . /// An enum describing the unit of usage measurement. /// The current usage of the resource. /// The maximum permitted usage of the resource. @@ -59,19 +59,19 @@ public static InnerError InnerError(string exceptiontype = null, string errordet /// A new instance for mocking. public static ComputeUsage ComputeUsage(ComputeUsageUnit unit = default, int currentValue = default, long limit = default, ComputeUsageName name = null) { - return new ComputeUsage(unit, currentValue, limit, name); + return new ComputeUsage(unit, currentValue, limit, name, default); } - /// Initializes a new instance of ComputeUsageName. + /// Initializes a new instance of . /// The name of the resource. /// The localized name of the resource. /// A new instance for mocking. public static ComputeUsageName ComputeUsageName(string value = null, string localizedValue = null) { - return new ComputeUsageName(value, localizedValue); + return new ComputeUsageName(value, localizedValue, default); } - /// Initializes a new instance of VirtualMachineSize. + /// Initializes a new instance of . /// The name of the virtual machine size. /// The number of cores supported by the virtual machine size. For Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or https://docs.microsoft.com/rest/api/compute/resourceskus/list. /// The OS disk size, in MB, allowed by the virtual machine size. @@ -81,10 +81,10 @@ public static ComputeUsageName ComputeUsageName(string value = null, string loca /// A new instance for mocking. public static VirtualMachineSize VirtualMachineSize(string name = null, int? numberOfCores = null, int? osDiskSizeInMB = null, int? resourceDiskSizeInMB = null, int? memoryInMB = null, int? maxDataDiskCount = null) { - return new VirtualMachineSize(name, numberOfCores, osDiskSizeInMB, resourceDiskSizeInMB, memoryInMB, maxDataDiskCount); + return new VirtualMachineSize(name, numberOfCores, osDiskSizeInMB, resourceDiskSizeInMB, memoryInMB, maxDataDiskCount, default); } - /// Initializes a new instance of VirtualMachineScaleSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -121,10 +121,10 @@ public static VirtualMachineScaleSetData VirtualMachineScaleSetData(ResourceIden tags ??= new Dictionary(); zones ??= new List(); - return new VirtualMachineScaleSetData(id, name, resourceType, systemData, tags, location, sku, plan, identity, zones?.ToList(), extendedLocation, upgradePolicy, automaticRepairsPolicy, virtualMachineProfile, provisioningState, overprovision, doNotRunExtensionsOnOverprovisionedVms, uniqueId, singlePlacementGroup, zoneBalance, platformFaultDomainCount, proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, hostGroupId != null ? ResourceManagerModelFactory.WritableSubResource(hostGroupId) : null, additionalCapabilities, scaleInPolicy, orchestrationMode, spotRestorePolicy, priorityMixPolicy, timeCreated, isMaximumCapacityConstrained); + return new VirtualMachineScaleSetData(id, name, resourceType, systemData, tags, location, sku, plan, identity, zones?.ToList(), extendedLocation, upgradePolicy, automaticRepairsPolicy, virtualMachineProfile, provisioningState, overprovision, doNotRunExtensionsOnOverprovisionedVms, uniqueId, singlePlacementGroup, zoneBalance, platformFaultDomainCount, proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, hostGroupId != null ? ResourceManagerModelFactory.WritableSubResource(hostGroupId) : null, additionalCapabilities, scaleInPolicy, orchestrationMode, spotRestorePolicy, priorityMixPolicy, timeCreated, isMaximumCapacityConstrained, default); } - /// Initializes a new instance of ImageReference. + /// Initializes a new instance of . /// Resource Id. /// The image publisher. /// Specifies the offer of the platform image or marketplace image used to create the virtual machine. @@ -136,10 +136,10 @@ public static VirtualMachineScaleSetData VirtualMachineScaleSetData(ResourceIden /// A new instance for mocking. public static ImageReference ImageReference(ResourceIdentifier id = null, string publisher = null, string offer = null, string sku = null, string version = null, string exactVersion = null, string sharedGalleryImageUniqueId = null, string communityGalleryImageId = null) { - return new ImageReference(id, publisher, offer, sku, version, exactVersion, sharedGalleryImageUniqueId, communityGalleryImageId); + return new ImageReference(id, publisher, offer, sku, version, exactVersion, sharedGalleryImageUniqueId, communityGalleryImageId, default); } - /// Initializes a new instance of VirtualMachineScaleSetExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -161,18 +161,18 @@ public static VirtualMachineScaleSetExtensionData VirtualMachineScaleSetExtensio { provisionAfterExtensions ??= new List(); - return new VirtualMachineScaleSetExtensionData(id, name, resourceType, systemData, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, provisionAfterExtensions?.ToList(), suppressFailures, keyVaultProtectedSettings); + return new VirtualMachineScaleSetExtensionData(id, name, resourceType, systemData, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, provisionAfterExtensions?.ToList(), suppressFailures, keyVaultProtectedSettings, default); } - /// Initializes a new instance of ComputeSubResourceData. + /// Initializes a new instance of . /// Resource Id. /// A new instance for mocking. public static ComputeSubResourceData ComputeSubResourceData(ResourceIdentifier id = null) { - return new ComputeSubResourceData(id); + return new ComputeSubResourceData(id, default); } - /// Initializes a new instance of VirtualMachineExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -198,10 +198,10 @@ public static VirtualMachineExtensionData VirtualMachineExtensionData(ResourceId tags ??= new Dictionary(); provisionAfterExtensions ??= new List(); - return new VirtualMachineExtensionData(id, name, resourceType, systemData, tags, location, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, instanceView, suppressFailures, keyVaultProtectedSettings, provisionAfterExtensions?.ToList()); + return new VirtualMachineExtensionData(id, name, resourceType, systemData, tags, location, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, instanceView, suppressFailures, keyVaultProtectedSettings, provisionAfterExtensions?.ToList(), default); } - /// Initializes a new instance of VirtualMachineScaleSetInstanceView. + /// Initializes a new instance of . /// The instance view status summary for the virtual machine scale set. /// The extensions information. /// The resource status information. @@ -214,19 +214,19 @@ public static VirtualMachineScaleSetInstanceView VirtualMachineScaleSetInstanceV statuses ??= new List(); orchestrationServices ??= new List(); - return new VirtualMachineScaleSetInstanceView(virtualMachineStatusesSummary != null ? new VirtualMachineScaleSetInstanceViewStatusesSummary(virtualMachineStatusesSummary?.ToList()) : null, extensions?.ToList(), statuses?.ToList(), orchestrationServices?.ToList()); + return new VirtualMachineScaleSetInstanceView(virtualMachineStatusesSummary != null ? new VirtualMachineScaleSetInstanceViewStatusesSummary(virtualMachineStatusesSummary?.ToList(), new Dictionary()) : null, extensions?.ToList(), statuses?.ToList(), orchestrationServices?.ToList(), default); } - /// Initializes a new instance of VirtualMachineStatusCodeCount. + /// Initializes a new instance of . /// The instance view status code. /// The number of instances having a particular status code. /// A new instance for mocking. public static VirtualMachineStatusCodeCount VirtualMachineStatusCodeCount(string code = null, int? count = null) { - return new VirtualMachineStatusCodeCount(code, count); + return new VirtualMachineStatusCodeCount(code, count, default); } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionsSummary. + /// Initializes a new instance of . /// The extension name. /// The extensions information. /// A new instance for mocking. @@ -234,19 +234,19 @@ public static VirtualMachineScaleSetVmExtensionsSummary VirtualMachineScaleSetVm { statusesSummary ??= new List(); - return new VirtualMachineScaleSetVmExtensionsSummary(name, statusesSummary?.ToList()); + return new VirtualMachineScaleSetVmExtensionsSummary(name, statusesSummary?.ToList(), default); } - /// Initializes a new instance of OrchestrationServiceSummary. + /// Initializes a new instance of . /// The name of the service. /// The current state of the service. /// A new instance for mocking. public static OrchestrationServiceSummary OrchestrationServiceSummary(OrchestrationServiceName? serviceName = null, OrchestrationServiceState? serviceState = null) { - return new OrchestrationServiceSummary(serviceName, serviceState); + return new OrchestrationServiceSummary(serviceName, serviceState, default); } - /// Initializes a new instance of VirtualMachineScaleSetExtensionPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -268,20 +268,20 @@ public static VirtualMachineScaleSetExtensionPatch VirtualMachineScaleSetExtensi { provisionAfterExtensions ??= new List(); - return new VirtualMachineScaleSetExtensionPatch(id, name, resourceType, systemData, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, provisionAfterExtensions?.ToList(), suppressFailures, keyVaultProtectedSettings); + return new VirtualMachineScaleSetExtensionPatch(id, name, resourceType, systemData, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, provisionAfterExtensions?.ToList(), suppressFailures, keyVaultProtectedSettings, default); } - /// Initializes a new instance of VirtualMachineScaleSetSku. + /// Initializes a new instance of . /// The type of resource the sku applies to. /// The Sku. /// Specifies the number of virtual machines in the scale set. /// A new instance for mocking. public static VirtualMachineScaleSetSku VirtualMachineScaleSetSku(ResourceType? resourceType = null, ComputeSku sku = null, VirtualMachineScaleSetSkuCapacity capacity = null) { - return new VirtualMachineScaleSetSku(resourceType, sku, capacity); + return new VirtualMachineScaleSetSku(resourceType, sku, capacity, default); } - /// Initializes a new instance of VirtualMachineScaleSetSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. @@ -289,20 +289,20 @@ public static VirtualMachineScaleSetSku VirtualMachineScaleSetSku(ResourceType? /// A new instance for mocking. public static VirtualMachineScaleSetSkuCapacity VirtualMachineScaleSetSkuCapacity(long? minimum = null, long? maximum = null, long? defaultCapacity = null, VirtualMachineScaleSetSkuScaleType? scaleType = null) { - return new VirtualMachineScaleSetSkuCapacity(minimum, maximum, defaultCapacity, scaleType); + return new VirtualMachineScaleSetSkuCapacity(minimum, maximum, defaultCapacity, scaleType, default); } - /// Initializes a new instance of UpgradeOperationHistoricalStatusInfo. + /// Initializes a new instance of . /// Information about the properties of the upgrade operation. /// Resource type. /// Resource location. /// A new instance for mocking. public static UpgradeOperationHistoricalStatusInfo UpgradeOperationHistoricalStatusInfo(UpgradeOperationHistoricalStatusInfoProperties properties = null, string upgradeOperationHistoricalStatusInfoType = null, AzureLocation? location = null) { - return new UpgradeOperationHistoricalStatusInfo(properties, upgradeOperationHistoricalStatusInfoType, location); + return new UpgradeOperationHistoricalStatusInfo(properties, upgradeOperationHistoricalStatusInfoType, location, default); } - /// Initializes a new instance of UpgradeOperationHistoricalStatusInfoProperties. + /// Initializes a new instance of . /// Information about the overall status of the upgrade operation. /// Counts of the VMs in each state. /// Error Details for this upgrade if there are any. @@ -312,20 +312,20 @@ public static UpgradeOperationHistoricalStatusInfo UpgradeOperationHistoricalSta /// A new instance for mocking. public static UpgradeOperationHistoricalStatusInfoProperties UpgradeOperationHistoricalStatusInfoProperties(UpgradeOperationHistoryStatus runningStatus = null, RollingUpgradeProgressInfo progress = null, ComputeApiError error = null, UpgradeOperationInvoker? startedBy = null, ImageReference targetImageReference = null, RollbackStatusInfo rollbackInfo = null) { - return new UpgradeOperationHistoricalStatusInfoProperties(runningStatus, progress, error, startedBy, targetImageReference, rollbackInfo); + return new UpgradeOperationHistoricalStatusInfoProperties(runningStatus, progress, error, startedBy, targetImageReference, rollbackInfo, default); } - /// Initializes a new instance of UpgradeOperationHistoryStatus. + /// Initializes a new instance of . /// Code indicating the current status of the upgrade. /// Start time of the upgrade. /// End time of the upgrade. /// A new instance for mocking. public static UpgradeOperationHistoryStatus UpgradeOperationHistoryStatus(UpgradeState? code = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null) { - return new UpgradeOperationHistoryStatus(code, startOn, endOn); + return new UpgradeOperationHistoryStatus(code, startOn, endOn, default); } - /// Initializes a new instance of RollingUpgradeProgressInfo. + /// Initializes a new instance of . /// The number of instances that have been successfully upgraded. /// The number of instances that have failed to be upgraded successfully. /// The number of instances that are currently being upgraded. @@ -333,20 +333,20 @@ public static UpgradeOperationHistoryStatus UpgradeOperationHistoryStatus(Upgrad /// A new instance for mocking. public static RollingUpgradeProgressInfo RollingUpgradeProgressInfo(int? successfulInstanceCount = null, int? failedInstanceCount = null, int? inProgressInstanceCount = null, int? pendingInstanceCount = null) { - return new RollingUpgradeProgressInfo(successfulInstanceCount, failedInstanceCount, inProgressInstanceCount, pendingInstanceCount); + return new RollingUpgradeProgressInfo(successfulInstanceCount, failedInstanceCount, inProgressInstanceCount, pendingInstanceCount, default); } - /// Initializes a new instance of RollbackStatusInfo. + /// Initializes a new instance of . /// The number of instances which have been successfully rolled back. /// The number of instances which failed to rollback. /// Error details if OS rollback failed. /// A new instance for mocking. public static RollbackStatusInfo RollbackStatusInfo(int? successfullyRolledbackInstanceCount = null, int? failedRolledbackInstanceCount = null, ComputeApiError rollbackError = null) { - return new RollbackStatusInfo(successfullyRolledbackInstanceCount, failedRolledbackInstanceCount, rollbackError); + return new RollbackStatusInfo(successfullyRolledbackInstanceCount, failedRolledbackInstanceCount, rollbackError, default); } - /// Initializes a new instance of VirtualMachineScaleSetRollingUpgradeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -362,10 +362,10 @@ public static VirtualMachineScaleSetRollingUpgradeData VirtualMachineScaleSetRol { tags ??= new Dictionary(); - return new VirtualMachineScaleSetRollingUpgradeData(id, name, resourceType, systemData, tags, location, policy, runningStatus, progress, error); + return new VirtualMachineScaleSetRollingUpgradeData(id, name, resourceType, systemData, tags, location, policy, runningStatus, progress, error, default); } - /// Initializes a new instance of RollingUpgradeRunningStatus. + /// Initializes a new instance of . /// Code indicating the current status of the upgrade. /// Start time of the upgrade. /// The last action performed on the rolling upgrade. @@ -373,19 +373,19 @@ public static VirtualMachineScaleSetRollingUpgradeData VirtualMachineScaleSetRol /// A new instance for mocking. public static RollingUpgradeRunningStatus RollingUpgradeRunningStatus(RollingUpgradeStatusCode? code = null, DateTimeOffset? startOn = null, RollingUpgradeActionType? lastAction = null, DateTimeOffset? lastActionOn = null) { - return new RollingUpgradeRunningStatus(code, startOn, lastAction, lastActionOn); + return new RollingUpgradeRunningStatus(code, startOn, lastAction, lastActionOn, default); } - /// Initializes a new instance of RecoveryWalkResponse. + /// Initializes a new instance of . /// Whether the recovery walk was performed. /// The next update domain that needs to be walked. Null means walk spanning all update domains has been completed. /// A new instance for mocking. public static RecoveryWalkResponse RecoveryWalkResponse(bool? walkPerformed = null, int? nextPlatformUpdateDomain = null) { - return new RecoveryWalkResponse(walkPerformed, nextPlatformUpdateDomain); + return new RecoveryWalkResponse(walkPerformed, nextPlatformUpdateDomain, default); } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -409,10 +409,10 @@ public static VirtualMachineScaleSetVmExtensionData VirtualMachineScaleSetVmExte { provisionAfterExtensions ??= new List(); - return new VirtualMachineScaleSetVmExtensionData(id, name, resourceType, systemData, location, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, instanceView, suppressFailures, keyVaultProtectedSettings, provisionAfterExtensions?.ToList()); + return new VirtualMachineScaleSetVmExtensionData(id, name, resourceType, systemData, location, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, provisioningState, instanceView, suppressFailures, keyVaultProtectedSettings, provisionAfterExtensions?.ToList(), default); } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -430,10 +430,10 @@ public static VirtualMachineScaleSetVmExtensionData VirtualMachineScaleSetVmExte /// A new instance for mocking. public static VirtualMachineScaleSetVmExtensionPatch VirtualMachineScaleSetVmExtensionPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string forceUpdateTag = null, string publisher = null, string extensionType = null, string typeHandlerVersion = null, bool? autoUpgradeMinorVersion = null, bool? enableAutomaticUpgrade = null, BinaryData settings = null, BinaryData protectedSettings = null, bool? suppressFailures = null, KeyVaultSecretReference keyVaultProtectedSettings = null) { - return new VirtualMachineScaleSetVmExtensionPatch(id, name, resourceType, systemData, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, suppressFailures, keyVaultProtectedSettings); + return new VirtualMachineScaleSetVmExtensionPatch(id, name, resourceType, systemData, forceUpdateTag, publisher, extensionType, typeHandlerVersion, autoUpgradeMinorVersion, enableAutomaticUpgrade, settings, protectedSettings, suppressFailures, keyVaultProtectedSettings, default); } - /// Initializes a new instance of VirtualMachineScaleSetVmData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -472,10 +472,10 @@ public static VirtualMachineScaleSetVmData VirtualMachineScaleSetVmData(Resource zones ??= new List(); networkInterfaceConfigurations ??= new List(); - return new VirtualMachineScaleSetVmData(id, name, resourceType, systemData, tags, location, instanceId, sku, plan, resources?.ToList(), zones?.ToList(), identity, latestModelApplied, vmId, instanceView, hardwareProfile, storageProfile, additionalCapabilities, osProfile, securityProfile, networkProfile, networkInterfaceConfigurations != null ? new VirtualMachineScaleSetVmNetworkProfileConfiguration(networkInterfaceConfigurations?.ToList()) : null, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics) : null, availabilitySetId != null ? ResourceManagerModelFactory.WritableSubResource(availabilitySetId) : null, provisioningState, licenseType, modelDefinitionApplied, protectionPolicy, userData, timeCreated); + return new VirtualMachineScaleSetVmData(id, name, resourceType, systemData, tags, location, instanceId, sku, plan, resources?.ToList(), zones?.ToList(), identity, latestModelApplied, vmId, instanceView, hardwareProfile, storageProfile, additionalCapabilities, osProfile, securityProfile, networkProfile, networkInterfaceConfigurations != null ? new VirtualMachineScaleSetVmNetworkProfileConfiguration(networkInterfaceConfigurations?.ToList(), new Dictionary()) : null, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics, new Dictionary()) : null, availabilitySetId != null ? ResourceManagerModelFactory.WritableSubResource(availabilitySetId) : null, provisioningState, licenseType, modelDefinitionApplied, protectionPolicy, userData, timeCreated, default); } - /// Initializes a new instance of VirtualMachineScaleSetVmInstanceView. + /// Initializes a new instance of . /// The Update Domain count. /// The Fault Domain count. /// The Remote desktop certificate thumbprint. @@ -499,10 +499,10 @@ public static VirtualMachineScaleSetVmInstanceView VirtualMachineScaleSetVmInsta extensions ??= new List(); statuses ??= new List(); - return new VirtualMachineScaleSetVmInstanceView(platformUpdateDomain, platformFaultDomain, rdpThumbPrint, vmAgent, maintenanceRedeployStatus, disks?.ToList(), extensions?.ToList(), vmHealthStatus != null ? new VirtualMachineHealthStatus(vmHealthStatus) : null, bootDiagnostics, statuses?.ToList(), assignedHost, placementGroupId, computerName, osName, osVersion, hyperVGeneration); + return new VirtualMachineScaleSetVmInstanceView(platformUpdateDomain, platformFaultDomain, rdpThumbPrint, vmAgent, maintenanceRedeployStatus, disks?.ToList(), extensions?.ToList(), vmHealthStatus != null ? new VirtualMachineHealthStatus(vmHealthStatus, new Dictionary()) : null, bootDiagnostics, statuses?.ToList(), assignedHost, placementGroupId, computerName, osName, osVersion, hyperVGeneration, default); } - /// Initializes a new instance of VirtualMachineAgentInstanceView. + /// Initializes a new instance of . /// The VM Agent full version. /// The virtual machine extension handler instance view. /// The resource status information. @@ -512,20 +512,20 @@ public static VirtualMachineAgentInstanceView VirtualMachineAgentInstanceView(st extensionHandlers ??= new List(); statuses ??= new List(); - return new VirtualMachineAgentInstanceView(vmAgentVersion, extensionHandlers?.ToList(), statuses?.ToList()); + return new VirtualMachineAgentInstanceView(vmAgentVersion, extensionHandlers?.ToList(), statuses?.ToList(), default); } - /// Initializes a new instance of VirtualMachineExtensionHandlerInstanceView. + /// Initializes a new instance of . /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. /// The extension handler status. /// A new instance for mocking. public static VirtualMachineExtensionHandlerInstanceView VirtualMachineExtensionHandlerInstanceView(string virtualMachineExtensionHandlerInstanceViewType = null, string typeHandlerVersion = null, InstanceViewStatus status = null) { - return new VirtualMachineExtensionHandlerInstanceView(virtualMachineExtensionHandlerInstanceViewType, typeHandlerVersion, status); + return new VirtualMachineExtensionHandlerInstanceView(virtualMachineExtensionHandlerInstanceViewType, typeHandlerVersion, status, default); } - /// Initializes a new instance of MaintenanceRedeployStatus. + /// Initializes a new instance of . /// True, if customer is allowed to perform Maintenance. /// Start Time for the Pre Maintenance Window. /// End Time for the Pre Maintenance Window. @@ -536,10 +536,10 @@ public static VirtualMachineExtensionHandlerInstanceView VirtualMachineExtension /// A new instance for mocking. public static MaintenanceRedeployStatus MaintenanceRedeployStatus(bool? isCustomerInitiatedMaintenanceAllowed = null, DateTimeOffset? preMaintenanceWindowStartOn = null, DateTimeOffset? preMaintenanceWindowEndOn = null, DateTimeOffset? maintenanceWindowStartOn = null, DateTimeOffset? maintenanceWindowEndOn = null, MaintenanceOperationResultCodeType? lastOperationResultCode = null, string lastOperationMessage = null) { - return new MaintenanceRedeployStatus(isCustomerInitiatedMaintenanceAllowed, preMaintenanceWindowStartOn, preMaintenanceWindowEndOn, maintenanceWindowStartOn, maintenanceWindowEndOn, lastOperationResultCode, lastOperationMessage); + return new MaintenanceRedeployStatus(isCustomerInitiatedMaintenanceAllowed, preMaintenanceWindowStartOn, preMaintenanceWindowEndOn, maintenanceWindowStartOn, maintenanceWindowEndOn, lastOperationResultCode, lastOperationMessage, default); } - /// Initializes a new instance of DiskInstanceView. + /// Initializes a new instance of . /// The disk name. /// Specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15. /// The resource status information. @@ -549,20 +549,20 @@ public static DiskInstanceView DiskInstanceView(string name = null, IEnumerable< encryptionSettings ??= new List(); statuses ??= new List(); - return new DiskInstanceView(name, encryptionSettings?.ToList(), statuses?.ToList()); + return new DiskInstanceView(name, encryptionSettings?.ToList(), statuses?.ToList(), default); } - /// Initializes a new instance of BootDiagnosticsInstanceView. + /// Initializes a new instance of . /// The console screenshot blob URI. **Note:** This will **not** be set if boot diagnostics is currently enabled with managed storage. /// The serial console log blob Uri. **Note:** This will **not** be set if boot diagnostics is currently enabled with managed storage. /// The boot diagnostics status information for the VM. **Note:** It will be set only if there are errors encountered in enabling boot diagnostics. /// A new instance for mocking. public static BootDiagnosticsInstanceView BootDiagnosticsInstanceView(Uri consoleScreenshotBlobUri = null, Uri serialConsoleLogBlobUri = null, InstanceViewStatus status = null) { - return new BootDiagnosticsInstanceView(consoleScreenshotBlobUri, serialConsoleLogBlobUri, status); + return new BootDiagnosticsInstanceView(consoleScreenshotBlobUri, serialConsoleLogBlobUri, status, default); } - /// Initializes a new instance of VirtualMachineDataDisk. + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. /// The disk name. /// The virtual hard disk. @@ -580,19 +580,19 @@ public static BootDiagnosticsInstanceView BootDiagnosticsInstanceView(Uri consol /// A new instance for mocking. public static VirtualMachineDataDisk VirtualMachineDataDisk(int lun = default, string name = null, Uri vhdUri = null, Uri imageUri = null, CachingType? caching = null, bool? writeAcceleratorEnabled = null, DiskCreateOptionType createOption = default, int? diskSizeGB = null, VirtualMachineManagedDisk managedDisk = null, bool? toBeDetached = null, long? diskIopsReadWrite = null, long? diskMBpsReadWrite = null, DiskDetachOptionType? detachOption = null, DiskDeleteOptionType? deleteOption = null) { - return new VirtualMachineDataDisk(lun, name, vhdUri != null ? new VirtualHardDisk(vhdUri) : null, imageUri != null ? new VirtualHardDisk(imageUri) : null, caching, writeAcceleratorEnabled, createOption, diskSizeGB, managedDisk, toBeDetached, diskIopsReadWrite, diskMBpsReadWrite, detachOption, deleteOption); + return new VirtualMachineDataDisk(lun, name, vhdUri != null ? new VirtualHardDisk(vhdUri, new Dictionary()) : null, imageUri != null ? new VirtualHardDisk(imageUri, new Dictionary()) : null, caching, writeAcceleratorEnabled, createOption, diskSizeGB, managedDisk, toBeDetached, diskIopsReadWrite, diskMBpsReadWrite, detachOption, deleteOption, default); } - /// Initializes a new instance of RetrieveBootDiagnosticsDataResult. + /// Initializes a new instance of . /// The console screenshot blob URI. /// The serial console log blob URI. /// A new instance for mocking. public static RetrieveBootDiagnosticsDataResult RetrieveBootDiagnosticsDataResult(Uri consoleScreenshotBlobUri = null, Uri serialConsoleLogBlobUri = null) { - return new RetrieveBootDiagnosticsDataResult(consoleScreenshotBlobUri, serialConsoleLogBlobUri); + return new RetrieveBootDiagnosticsDataResult(consoleScreenshotBlobUri, serialConsoleLogBlobUri, default); } - /// Initializes a new instance of VirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -638,10 +638,10 @@ public static VirtualMachineData VirtualMachineData(ResourceIdentifier id = null zones ??= new List(); galleryApplications ??= new List(); - return new VirtualMachineData(id, name, resourceType, systemData, tags, location, plan, resources?.ToList(), identity, zones?.ToList(), extendedLocation, hardwareProfile, storageProfile, additionalCapabilities, osProfile, networkProfile, securityProfile, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics) : null, availabilitySetId != null ? ResourceManagerModelFactory.WritableSubResource(availabilitySetId) : null, virtualMachineScaleSetId != null ? ResourceManagerModelFactory.WritableSubResource(virtualMachineScaleSetId) : null, proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, priority, evictionPolicy, billingMaxPrice != null ? new BillingProfile(billingMaxPrice) : null, hostId != null ? ResourceManagerModelFactory.WritableSubResource(hostId) : null, hostGroupId != null ? ResourceManagerModelFactory.WritableSubResource(hostGroupId) : null, provisioningState, instanceView, licenseType, vmId, extensionsTimeBudget, platformFaultDomain, scheduledEventsProfile, userData, capacityReservationGroupId != null ? new CapacityReservationProfile(ResourceManagerModelFactory.WritableSubResource(capacityReservationGroupId)) : null, galleryApplications != null ? new ApplicationProfile(galleryApplications?.ToList()) : null, timeCreated); + return new VirtualMachineData(id, name, resourceType, systemData, tags, location, plan, resources?.ToList(), identity, zones?.ToList(), extendedLocation, hardwareProfile, storageProfile, additionalCapabilities, osProfile, networkProfile, securityProfile, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics, new Dictionary()) : null, availabilitySetId != null ? ResourceManagerModelFactory.WritableSubResource(availabilitySetId) : null, virtualMachineScaleSetId != null ? ResourceManagerModelFactory.WritableSubResource(virtualMachineScaleSetId) : null, proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, priority, evictionPolicy, billingMaxPrice != null ? new BillingProfile(billingMaxPrice, new Dictionary()) : null, hostId != null ? ResourceManagerModelFactory.WritableSubResource(hostId) : null, hostGroupId != null ? ResourceManagerModelFactory.WritableSubResource(hostGroupId) : null, provisioningState, instanceView, licenseType, vmId, extensionsTimeBudget, platformFaultDomain, scheduledEventsProfile, userData, capacityReservationGroupId != null ? new CapacityReservationProfile(ResourceManagerModelFactory.WritableSubResource(capacityReservationGroupId), new Dictionary()) : null, galleryApplications != null ? new ApplicationProfile(galleryApplications?.ToList(), new Dictionary()) : null, timeCreated, default); } - /// Initializes a new instance of VirtualMachineInstanceView. + /// Initializes a new instance of . /// Specifies the update domain of the virtual machine. /// Specifies the fault domain of the virtual machine. /// The computer name assigned to the virtual machine. @@ -665,10 +665,10 @@ public static VirtualMachineInstanceView VirtualMachineInstanceView(int? platfor extensions ??= new List(); statuses ??= new List(); - return new VirtualMachineInstanceView(platformUpdateDomain, platformFaultDomain, computerName, osName, osVersion, hyperVGeneration, rdpThumbPrint, vmAgent, maintenanceRedeployStatus, disks?.ToList(), extensions?.ToList(), vmHealthStatus != null ? new VirtualMachineHealthStatus(vmHealthStatus) : null, bootDiagnostics, assignedHost, statuses?.ToList(), patchStatus); + return new VirtualMachineInstanceView(platformUpdateDomain, platformFaultDomain, computerName, osName, osVersion, hyperVGeneration, rdpThumbPrint, vmAgent, maintenanceRedeployStatus, disks?.ToList(), extensions?.ToList(), vmHealthStatus != null ? new VirtualMachineHealthStatus(vmHealthStatus, new Dictionary()) : null, bootDiagnostics, assignedHost, statuses?.ToList(), patchStatus, default); } - /// Initializes a new instance of VirtualMachinePatchStatus. + /// Initializes a new instance of . /// The available patch summary of the latest assessment operation for the virtual machine. /// The installation summary of the latest installation operation for the virtual machine. /// The enablement status of the specified patchMode. @@ -677,10 +677,10 @@ public static VirtualMachinePatchStatus VirtualMachinePatchStatus(AvailablePatch { configurationStatuses ??= new List(); - return new VirtualMachinePatchStatus(availablePatchSummary, lastPatchInstallationSummary, configurationStatuses?.ToList()); + return new VirtualMachinePatchStatus(availablePatchSummary, lastPatchInstallationSummary, configurationStatuses?.ToList(), default); } - /// Initializes a new instance of AvailablePatchSummary. + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred. @@ -692,10 +692,10 @@ public static VirtualMachinePatchStatus VirtualMachinePatchStatus(AvailablePatch /// A new instance for mocking. public static AvailablePatchSummary AvailablePatchSummary(PatchOperationStatus? status = null, string assessmentActivityId = null, bool? rebootPending = null, int? criticalAndSecurityPatchCount = null, int? otherPatchCount = null, DateTimeOffset? startOn = null, DateTimeOffset? lastModifiedOn = null, ComputeApiError error = null) { - return new AvailablePatchSummary(status, assessmentActivityId, rebootPending, criticalAndSecurityPatchCount, otherPatchCount, startOn, lastModifiedOn, error); + return new AvailablePatchSummary(status, assessmentActivityId, rebootPending, criticalAndSecurityPatchCount, otherPatchCount, startOn, lastModifiedOn, error, default); } - /// Initializes a new instance of LastPatchInstallationSummary. + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// Describes whether the operation ran out of time before it completed all its intended actions. @@ -710,10 +710,10 @@ public static AvailablePatchSummary AvailablePatchSummary(PatchOperationStatus? /// A new instance for mocking. public static LastPatchInstallationSummary LastPatchInstallationSummary(PatchOperationStatus? status = null, string installationActivityId = null, bool? maintenanceWindowExceeded = null, int? notSelectedPatchCount = null, int? excludedPatchCount = null, int? pendingPatchCount = null, int? installedPatchCount = null, int? failedPatchCount = null, DateTimeOffset? startOn = null, DateTimeOffset? lastModifiedOn = null, ComputeApiError error = null) { - return new LastPatchInstallationSummary(status, installationActivityId, maintenanceWindowExceeded, notSelectedPatchCount, excludedPatchCount, pendingPatchCount, installedPatchCount, failedPatchCount, startOn, lastModifiedOn, error); + return new LastPatchInstallationSummary(status, installationActivityId, maintenanceWindowExceeded, notSelectedPatchCount, excludedPatchCount, pendingPatchCount, installedPatchCount, failedPatchCount, startOn, lastModifiedOn, error, default); } - /// Initializes a new instance of VirtualMachineCaptureResult. + /// Initializes a new instance of . /// Resource Id. /// the schema of the captured virtual machine. /// the version of the content. @@ -724,10 +724,51 @@ public static VirtualMachineCaptureResult VirtualMachineCaptureResult(ResourceId { resources ??= new List(); - return new VirtualMachineCaptureResult(id, schema, contentVersion, parameters, resources?.ToList()); + return new VirtualMachineCaptureResult(id, schema, contentVersion, parameters, resources?.ToList(), default); } - /// Initializes a new instance of VirtualMachineAssessPatchesResult. + /// Initializes a new instance of . + /// Resource tags. + /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + /// The identity of the virtual machine, if configured. + /// The virtual machine zones. + /// Specifies the hardware settings for the virtual machine. + /// Specifies the storage settings for the virtual machine disks. + /// Specifies additional capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. + /// Specifies the network interfaces of the virtual machine. + /// Specifies the Security related profile settings for the virtual machine. + /// Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + /// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + /// Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. This property cannot exist along with a non-null properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. + /// Specifies information about the proximity placement group that the virtual machine should be assigned to. Minimum api-version: 2018-04-01. + /// Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. + /// Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + /// Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. + /// Specifies information about the dedicated host that the virtual machine resides in. Minimum api-version: 2018-10-01. + /// Specifies information about the dedicated host group that the virtual machine resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum api-version: 2020-06-01. + /// The provisioning state, which only appears in the response. + /// The virtual machine instance view. + /// Specifies that the image or disk that is being used was licensed on-premises. <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) <br><br> [Azure Hybrid Use Benefit for Linux Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> Minimum api-version: 2015-06-15. + /// Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + /// Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. + /// Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01. + /// Specifies Scheduled Event related configurations. + /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. Minimum api-version: 2021-03-01. + /// Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. + /// Specifies the gallery applications that should be made available to the VM/VMSS. + /// Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. + /// A new instance for mocking. + public static VirtualMachinePatch VirtualMachinePatch(IDictionary tags = null, ComputePlan plan = null, ManagedServiceIdentity identity = null, IEnumerable zones = null, VirtualMachineHardwareProfile hardwareProfile = null, VirtualMachineStorageProfile storageProfile = null, AdditionalCapabilities additionalCapabilities = null, VirtualMachineOSProfile osProfile = null, VirtualMachineNetworkProfile networkProfile = null, SecurityProfile securityProfile = null, BootDiagnostics bootDiagnostics = null, ResourceIdentifier availabilitySetId = null, ResourceIdentifier virtualMachineScaleSetId = null, ResourceIdentifier proximityPlacementGroupId = null, VirtualMachinePriorityType? priority = null, VirtualMachineEvictionPolicyType? evictionPolicy = null, double? billingMaxPrice = null, ResourceIdentifier hostId = null, ResourceIdentifier hostGroupId = null, string provisioningState = null, VirtualMachineInstanceView instanceView = null, string licenseType = null, string vmId = null, string extensionsTimeBudget = null, int? platformFaultDomain = null, ComputeScheduledEventsProfile scheduledEventsProfile = null, string userData = null, ResourceIdentifier capacityReservationGroupId = null, IEnumerable galleryApplications = null, DateTimeOffset? timeCreated = null) + { + tags ??= new Dictionary(); + zones ??= new List(); + galleryApplications ??= new List(); + + return new VirtualMachinePatch(tags, plan, identity, zones?.ToList(), hardwareProfile, storageProfile, additionalCapabilities, osProfile, networkProfile, securityProfile, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics, new Dictionary()) : null, availabilitySetId != null ? ResourceManagerModelFactory.WritableSubResource(availabilitySetId) : null, virtualMachineScaleSetId != null ? ResourceManagerModelFactory.WritableSubResource(virtualMachineScaleSetId) : null, proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, priority, evictionPolicy, billingMaxPrice != null ? new BillingProfile(billingMaxPrice, new Dictionary()) : null, hostId != null ? ResourceManagerModelFactory.WritableSubResource(hostId) : null, hostGroupId != null ? ResourceManagerModelFactory.WritableSubResource(hostGroupId) : null, provisioningState, instanceView, licenseType, vmId, extensionsTimeBudget, platformFaultDomain, scheduledEventsProfile, userData, capacityReservationGroupId != null ? new CapacityReservationProfile(ResourceManagerModelFactory.WritableSubResource(capacityReservationGroupId), new Dictionary()) : null, galleryApplications != null ? new ApplicationProfile(galleryApplications?.ToList(), new Dictionary()) : null, timeCreated, default); + } + + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred. @@ -741,10 +782,10 @@ public static VirtualMachineAssessPatchesResult VirtualMachineAssessPatchesResul { availablePatches ??= new List(); - return new VirtualMachineAssessPatchesResult(status, assessmentActivityId, rebootPending, criticalAndSecurityPatchCount, otherPatchCount, startOn, availablePatches?.ToList(), error); + return new VirtualMachineAssessPatchesResult(status, assessmentActivityId, rebootPending, criticalAndSecurityPatchCount, otherPatchCount, startOn, availablePatches?.ToList(), error, default); } - /// Initializes a new instance of VirtualMachineSoftwarePatchProperties. + /// Initializes a new instance of . /// A unique identifier for the patch. /// The friendly name of the patch. /// The version number of the patch. This property applies only to Linux patches. @@ -760,10 +801,21 @@ public static VirtualMachineSoftwarePatchProperties VirtualMachineSoftwarePatchP { classifications ??= new List(); - return new VirtualMachineSoftwarePatchProperties(patchId, name, version, kbId, classifications?.ToList(), rebootBehavior, activityId, publishedOn, lastModifiedOn, assessmentState); + return new VirtualMachineSoftwarePatchProperties(patchId, name, version, kbId, classifications?.ToList(), rebootBehavior, activityId, publishedOn, lastModifiedOn, assessmentState, default); } - /// Initializes a new instance of VirtualMachineInstallPatchesResult. + /// Initializes a new instance of . + /// Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). + /// Defines when it is acceptable to reboot a VM during a software update operation. + /// Input for InstallPatches on a Windows VM, as directly received by the API. + /// Input for InstallPatches on a Linux VM, as directly received by the API. + /// A new instance for mocking. + public static VirtualMachineInstallPatchesContent VirtualMachineInstallPatchesContent(TimeSpan? maximumDuration = null, VmGuestPatchRebootSetting rebootSetting = default, WindowsParameters windowsParameters = null, LinuxParameters linuxParameters = null) + { + return new VirtualMachineInstallPatchesContent(maximumDuration, rebootSetting, windowsParameters, linuxParameters, default); + } + + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// The reboot state of the VM following completion of the operation. @@ -781,10 +833,10 @@ public static VirtualMachineInstallPatchesResult VirtualMachineInstallPatchesRes { patches ??= new List(); - return new VirtualMachineInstallPatchesResult(status, installationActivityId, rebootStatus, maintenanceWindowExceeded, excludedPatchCount, notSelectedPatchCount, pendingPatchCount, installedPatchCount, failedPatchCount, patches?.ToList(), startOn, error); + return new VirtualMachineInstallPatchesResult(status, installationActivityId, rebootStatus, maintenanceWindowExceeded, excludedPatchCount, notSelectedPatchCount, pendingPatchCount, installedPatchCount, failedPatchCount, patches?.ToList(), startOn, error, default); } - /// Initializes a new instance of PatchInstallationDetail. + /// Initializes a new instance of . /// A unique identifier for the patch. /// The friendly name of the patch. /// The version string of the package. It may conform to Semantic Versioning. Only applies to Linux. @@ -796,18 +848,18 @@ public static PatchInstallationDetail PatchInstallationDetail(string patchId = n { classifications ??= new List(); - return new PatchInstallationDetail(patchId, name, version, kbId, classifications?.ToList(), installationState); + return new PatchInstallationDetail(patchId, name, version, kbId, classifications?.ToList(), installationState, default); } - /// Initializes a new instance of DataDiskImage. + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. /// A new instance for mocking. public static DataDiskImage DataDiskImage(int? lun = null) { - return new DataDiskImage(lun); + return new DataDiskImage(lun, default); } - /// Initializes a new instance of VirtualMachineExtensionImageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -824,10 +876,10 @@ public static VirtualMachineExtensionImageData VirtualMachineExtensionImageData( { tags ??= new Dictionary(); - return new VirtualMachineExtensionImageData(id, name, resourceType, systemData, tags, location, operatingSystem, computeRole, handlerSchema, virtualMachineScaleSetEnabled, supportsMultipleExtensions); + return new VirtualMachineExtensionImageData(id, name, resourceType, systemData, tags, location, operatingSystem, computeRole, handlerSchema, virtualMachineScaleSetEnabled, supportsMultipleExtensions, default); } - /// Initializes a new instance of AvailabilitySetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -847,10 +899,28 @@ public static AvailabilitySetData AvailabilitySetData(ResourceIdentifier id = nu virtualMachines ??= new List(); statuses ??= new List(); - return new AvailabilitySetData(id, name, resourceType, systemData, tags, location, sku, platformUpdateDomainCount, platformFaultDomainCount, virtualMachines?.ToList(), proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, statuses?.ToList()); + return new AvailabilitySetData(id, name, resourceType, systemData, tags, location, sku, platformUpdateDomainCount, platformFaultDomainCount, virtualMachines?.ToList(), proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, statuses?.ToList(), default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Sku of the availability set. + /// Update Domain count. + /// Fault Domain count. + /// A list of references to all virtual machines in the availability set. + /// Specifies information about the proximity placement group that the availability set should be assigned to. Minimum api-version: 2018-04-01. + /// The resource status information. + /// A new instance for mocking. + public static AvailabilitySetPatch AvailabilitySetPatch(IDictionary tags = null, ComputeSku sku = null, int? platformUpdateDomainCount = null, int? platformFaultDomainCount = null, IEnumerable virtualMachines = null, ResourceIdentifier proximityPlacementGroupId = null, IEnumerable statuses = null) + { + tags ??= new Dictionary(); + virtualMachines ??= new List(); + statuses ??= new List(); + + return new AvailabilitySetPatch(tags, sku, platformUpdateDomainCount, platformFaultDomainCount, virtualMachines?.ToList(), proximityPlacementGroupId != null ? ResourceManagerModelFactory.WritableSubResource(proximityPlacementGroupId) : null, statuses?.ToList(), default); } - /// Initializes a new instance of ProximityPlacementGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -874,10 +944,10 @@ public static ProximityPlacementGroupData ProximityPlacementGroupData(ResourceId availabilitySets ??= new List(); intentVmSizes ??= new List(); - return new ProximityPlacementGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), proximityPlacementGroupType, virtualMachines?.ToList(), virtualMachineScaleSets?.ToList(), availabilitySets?.ToList(), colocationStatus, intentVmSizes != null ? new ProximityPlacementGroupPropertiesIntent(intentVmSizes?.ToList()) : null); + return new ProximityPlacementGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), proximityPlacementGroupType, virtualMachines?.ToList(), virtualMachineScaleSets?.ToList(), availabilitySets?.ToList(), colocationStatus, intentVmSizes != null ? new ProximityPlacementGroupPropertiesIntent(intentVmSizes?.ToList(), new Dictionary()) : null, default); } - /// Initializes a new instance of DedicatedHostGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -898,10 +968,10 @@ public static DedicatedHostGroupData DedicatedHostGroupData(ResourceIdentifier i dedicatedHosts ??= new List(); instanceViewHosts ??= new List(); - return new DedicatedHostGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), platformFaultDomainCount, dedicatedHosts?.ToList(), instanceViewHosts != null ? new DedicatedHostGroupInstanceView(instanceViewHosts?.ToList()) : null, supportAutomaticPlacement, ultraSsdEnabled != null ? new DedicatedHostGroupPropertiesAdditionalCapabilities(ultraSsdEnabled) : null); + return new DedicatedHostGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), platformFaultDomainCount, dedicatedHosts?.ToList(), instanceViewHosts != null ? new DedicatedHostGroupInstanceView(instanceViewHosts?.ToList(), new Dictionary()) : null, supportAutomaticPlacement, ultraSsdEnabled != null ? new DedicatedHostGroupPropertiesAdditionalCapabilities(ultraSsdEnabled, new Dictionary()) : null, default); } - /// Initializes a new instance of DedicatedHostInstanceViewWithName. + /// Initializes a new instance of . /// Specifies the unique id of the dedicated physical machine on which the dedicated host resides. /// Unutilized capacity of the dedicated host. /// The resource status information. @@ -912,10 +982,10 @@ public static DedicatedHostInstanceViewWithName DedicatedHostInstanceViewWithNam availableCapacityAllocatableVms ??= new List(); statuses ??= new List(); - return new DedicatedHostInstanceViewWithName(assetId, availableCapacityAllocatableVms != null ? new DedicatedHostAvailableCapacity(availableCapacityAllocatableVms?.ToList()) : null, statuses?.ToList(), name); + return new DedicatedHostInstanceViewWithName(assetId, availableCapacityAllocatableVms != null ? new DedicatedHostAvailableCapacity(availableCapacityAllocatableVms?.ToList(), new Dictionary()) : null, statuses?.ToList(), name, default); } - /// Initializes a new instance of DedicatedHostInstanceView. + /// Initializes a new instance of . /// Specifies the unique id of the dedicated physical machine on which the dedicated host resides. /// Unutilized capacity of the dedicated host. /// The resource status information. @@ -925,19 +995,38 @@ public static DedicatedHostInstanceView DedicatedHostInstanceView(string assetId availableCapacityAllocatableVms ??= new List(); statuses ??= new List(); - return new DedicatedHostInstanceView(assetId, availableCapacityAllocatableVms != null ? new DedicatedHostAvailableCapacity(availableCapacityAllocatableVms?.ToList()) : null, statuses?.ToList()); + return new DedicatedHostInstanceView(assetId, availableCapacityAllocatableVms != null ? new DedicatedHostAvailableCapacity(availableCapacityAllocatableVms?.ToList(), new Dictionary()) : null, statuses?.ToList(), default); } - /// Initializes a new instance of DedicatedHostAllocatableVm. + /// Initializes a new instance of . /// VM size in terms of which the unutilized capacity is represented. /// Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. /// A new instance for mocking. public static DedicatedHostAllocatableVm DedicatedHostAllocatableVm(string vmSize = null, double? count = null) { - return new DedicatedHostAllocatableVm(vmSize, count); + return new DedicatedHostAllocatableVm(vmSize, count, default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. + /// Number of fault domains that the host group can span. + /// A list of references to all dedicated hosts in the dedicated host group. + /// The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. + /// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. Minimum api-version: 2020-06-01. + /// Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01. + /// A new instance for mocking. + public static DedicatedHostGroupPatch DedicatedHostGroupPatch(IDictionary tags = null, IEnumerable zones = null, int? platformFaultDomainCount = null, IEnumerable hosts = null, IEnumerable instanceViewHosts = null, bool? supportAutomaticPlacement = null, bool? ultraSsdEnabled = null) + { + tags ??= new Dictionary(); + zones ??= new List(); + hosts ??= new List(); + instanceViewHosts ??= new List(); + + return new DedicatedHostGroupPatch(tags, zones?.ToList(), platformFaultDomainCount, hosts?.ToList(), instanceViewHosts != null ? new DedicatedHostGroupInstanceView(instanceViewHosts?.ToList(), new Dictionary()) : null, supportAutomaticPlacement, ultraSsdEnabled != null ? new DedicatedHostGroupPropertiesAdditionalCapabilities(ultraSsdEnabled, new Dictionary()) : null, default); } - /// Initializes a new instance of DedicatedHostData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -960,10 +1049,31 @@ public static DedicatedHostData DedicatedHostData(ResourceIdentifier id = null, tags ??= new Dictionary(); virtualMachines ??= new List(); - return new DedicatedHostData(id, name, resourceType, systemData, tags, location, sku, platformFaultDomain, autoReplaceOnFailure, hostId, virtualMachines?.ToList(), licenseType, provisioningOn, provisioningState, instanceView, timeCreated); + return new DedicatedHostData(id, name, resourceType, systemData, tags, location, sku, platformFaultDomain, autoReplaceOnFailure, hostId, virtualMachines?.ToList(), licenseType, provisioningOn, provisioningState, instanceView, timeCreated, default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// [List all available dedicated host sizes for resizing] (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). Resizing can be only used to scale up DedicatedHost. Only name is required to be set. + /// Fault domain of the dedicated host within a dedicated host group. + /// Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true' when not provided. + /// A unique id generated and assigned to the dedicated host by the platform. Does not change throughout the lifetime of the host. + /// A list of references to all virtual machines in the Dedicated Host. + /// Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** The default value is: **None.**. + /// The date when the host was first provisioned. + /// The provisioning state, which only appears in the response. + /// The dedicated host instance view. + /// Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01. + /// A new instance for mocking. + public static DedicatedHostPatch DedicatedHostPatch(IDictionary tags = null, ComputeSku sku = null, int? platformFaultDomain = null, bool? autoReplaceOnFailure = null, string hostId = null, IEnumerable virtualMachines = null, DedicatedHostLicenseType? licenseType = null, DateTimeOffset? provisioningOn = null, string provisioningState = null, DedicatedHostInstanceView instanceView = null, DateTimeOffset? timeCreated = null) + { + tags ??= new Dictionary(); + virtualMachines ??= new List(); + + return new DedicatedHostPatch(tags, sku, platformFaultDomain, autoReplaceOnFailure, hostId, virtualMachines?.ToList(), licenseType, provisioningOn, provisioningState, instanceView, timeCreated, default); } - /// Initializes a new instance of SshPublicKeyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -976,34 +1086,20 @@ public static SshPublicKeyData SshPublicKeyData(ResourceIdentifier id = null, st { tags ??= new Dictionary(); - return new SshPublicKeyData(id, name, resourceType, systemData, tags, location, publicKey); + return new SshPublicKeyData(id, name, resourceType, systemData, tags, location, publicKey, default); } - /// Initializes a new instance of SshPublicKeyGenerateKeyPairResult. + /// Initializes a new instance of . /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. - /// , or is null. /// A new instance for mocking. public static SshPublicKeyGenerateKeyPairResult SshPublicKeyGenerateKeyPairResult(string privateKey = null, string publicKey = null, ResourceIdentifier id = null) { - if (privateKey == null) - { - throw new ArgumentNullException(nameof(privateKey)); - } - if (publicKey == null) - { - throw new ArgumentNullException(nameof(publicKey)); - } - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - return new SshPublicKeyGenerateKeyPairResult(privateKey, publicKey, id); + return new SshPublicKeyGenerateKeyPairResult(privateKey, publicKey, id, default); } - /// Initializes a new instance of DiskImageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1020,10 +1116,24 @@ public static DiskImageData DiskImageData(ResourceIdentifier id = null, string n { tags ??= new Dictionary(); - return new DiskImageData(id, name, resourceType, systemData, tags, location, extendedLocation, sourceVirtualMachineId != null ? ResourceManagerModelFactory.WritableSubResource(sourceVirtualMachineId) : null, storageProfile, provisioningState, hyperVGeneration); + return new DiskImageData(id, name, resourceType, systemData, tags, location, extendedLocation, sourceVirtualMachineId != null ? ResourceManagerModelFactory.WritableSubResource(sourceVirtualMachineId) : null, storageProfile, provisioningState, hyperVGeneration, default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The source virtual machine from which Image is created. + /// Specifies the storage settings for the virtual machine disks. + /// The provisioning state. + /// Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. + /// A new instance for mocking. + public static DiskImagePatch DiskImagePatch(IDictionary tags = null, ResourceIdentifier sourceVirtualMachineId = null, ImageStorageProfile storageProfile = null, string provisioningState = null, HyperVGeneration? hyperVGeneration = null) + { + tags ??= new Dictionary(); + + return new DiskImagePatch(tags, sourceVirtualMachineId != null ? ResourceManagerModelFactory.WritableSubResource(sourceVirtualMachineId) : null, storageProfile, provisioningState, hyperVGeneration, default); } - /// Initializes a new instance of RestorePointGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1040,19 +1150,19 @@ public static RestorePointGroupData RestorePointGroupData(ResourceIdentifier id tags ??= new Dictionary(); restorePoints ??= new List(); - return new RestorePointGroupData(id, name, resourceType, systemData, tags, location, source, provisioningState, restorePointGroupId, restorePoints?.ToList()); + return new RestorePointGroupData(id, name, resourceType, systemData, tags, location, source, provisioningState, restorePointGroupId, restorePoints?.ToList(), default); } - /// Initializes a new instance of RestorePointGroupSource. + /// Initializes a new instance of . /// Location of the source resource used to create this restore point collection. /// Resource Id of the source resource used to create this restore point collection. /// A new instance for mocking. public static RestorePointGroupSource RestorePointGroupSource(AzureLocation? location = null, ResourceIdentifier id = null) { - return new RestorePointGroupSource(location, id); + return new RestorePointGroupSource(location, id, default); } - /// Initializes a new instance of RestorePointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1069,10 +1179,10 @@ public static RestorePointData RestorePointData(ResourceIdentifier id = null, st { excludeDisks ??= new List(); - return new RestorePointData(id, name, resourceType, systemData, excludeDisks?.ToList(), sourceMetadata, provisioningState, consistencyMode, timeCreated, sourceRestorePointId != null ? ResourceManagerModelFactory.WritableSubResource(sourceRestorePointId) : null, instanceView); + return new RestorePointData(id, name, resourceType, systemData, excludeDisks?.ToList(), sourceMetadata, provisioningState, consistencyMode, timeCreated, sourceRestorePointId != null ? ResourceManagerModelFactory.WritableSubResource(sourceRestorePointId) : null, instanceView, default); } - /// Initializes a new instance of RestorePointSourceMetadata. + /// Initializes a new instance of . /// Gets the hardware profile. /// Gets the storage profile. /// Gets the OS profile. @@ -1086,10 +1196,10 @@ public static RestorePointData RestorePointData(ResourceIdentifier id = null, st /// A new instance for mocking. public static RestorePointSourceMetadata RestorePointSourceMetadata(VirtualMachineHardwareProfile hardwareProfile = null, RestorePointSourceVmStorageProfile storageProfile = null, VirtualMachineOSProfile osProfile = null, BootDiagnostics bootDiagnostics = null, string licenseType = null, string vmId = null, SecurityProfile securityProfile = null, AzureLocation? location = null, string userData = null, HyperVGeneration? hyperVGeneration = null) { - return new RestorePointSourceMetadata(hardwareProfile, storageProfile, osProfile, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics) : null, licenseType, vmId, securityProfile, location, userData, hyperVGeneration); + return new RestorePointSourceMetadata(hardwareProfile, storageProfile, osProfile, bootDiagnostics != null ? new DiagnosticsProfile(bootDiagnostics, new Dictionary()) : null, licenseType, vmId, securityProfile, location, userData, hyperVGeneration, default); } - /// Initializes a new instance of RestorePointSourceVmOSDisk. + /// Initializes a new instance of . /// Gets the Operating System type. /// Gets the disk encryption settings. /// Gets the disk name. @@ -1101,20 +1211,20 @@ public static RestorePointSourceMetadata RestorePointSourceMetadata(VirtualMachi /// A new instance for mocking. public static RestorePointSourceVmOSDisk RestorePointSourceVmOSDisk(OperatingSystemType? osType = null, DiskEncryptionSettings encryptionSettings = null, string name = null, CachingType? caching = null, int? diskSizeGB = null, VirtualMachineManagedDisk managedDisk = null, DiskRestorePointAttributes diskRestorePoint = null, bool? writeAcceleratorEnabled = null) { - return new RestorePointSourceVmOSDisk(osType, encryptionSettings, name, caching, diskSizeGB, managedDisk, diskRestorePoint, writeAcceleratorEnabled); + return new RestorePointSourceVmOSDisk(osType, encryptionSettings, name, caching, diskSizeGB, managedDisk, diskRestorePoint, writeAcceleratorEnabled, default); } - /// Initializes a new instance of DiskRestorePointAttributes. + /// Initializes a new instance of . /// Resource Id. /// Encryption at rest settings for disk restore point. It is an optional property that can be specified in the input while creating a restore point. /// Resource Id of the source disk restore point. /// A new instance for mocking. public static DiskRestorePointAttributes DiskRestorePointAttributes(ResourceIdentifier id = null, RestorePointEncryption encryption = null, ResourceIdentifier sourceDiskRestorePointId = null) { - return new DiskRestorePointAttributes(id, encryption, sourceDiskRestorePointId != null ? ResourceManagerModelFactory.WritableSubResource(sourceDiskRestorePointId) : null); + return new DiskRestorePointAttributes(id, encryption, sourceDiskRestorePointId != null ? ResourceManagerModelFactory.WritableSubResource(sourceDiskRestorePointId) : null, default); } - /// Initializes a new instance of RestorePointSourceVmDataDisk. + /// Initializes a new instance of . /// Gets the logical unit number. /// Gets the disk name. /// Gets the caching type. @@ -1125,10 +1235,10 @@ public static DiskRestorePointAttributes DiskRestorePointAttributes(ResourceIden /// A new instance for mocking. public static RestorePointSourceVmDataDisk RestorePointSourceVmDataDisk(int? lun = null, string name = null, CachingType? caching = null, int? diskSizeGB = null, VirtualMachineManagedDisk managedDisk = null, DiskRestorePointAttributes diskRestorePoint = null, bool? writeAcceleratorEnabled = null) { - return new RestorePointSourceVmDataDisk(lun, name, caching, diskSizeGB, managedDisk, diskRestorePoint, writeAcceleratorEnabled); + return new RestorePointSourceVmDataDisk(lun, name, caching, diskSizeGB, managedDisk, diskRestorePoint, writeAcceleratorEnabled, default); } - /// Initializes a new instance of RestorePointInstanceView. + /// Initializes a new instance of . /// The disk restore points information. /// The resource status information. /// A new instance for mocking. @@ -1137,28 +1247,43 @@ public static RestorePointInstanceView RestorePointInstanceView(IEnumerable(); statuses ??= new List(); - return new RestorePointInstanceView(diskRestorePoints?.ToList(), statuses?.ToList()); + return new RestorePointInstanceView(diskRestorePoints?.ToList(), statuses?.ToList(), default); } - /// Initializes a new instance of DiskRestorePointInstanceView. + /// Initializes a new instance of . /// Disk restore point Id. /// The disk restore point replication status information. /// A new instance for mocking. public static DiskRestorePointInstanceView DiskRestorePointInstanceView(string id = null, DiskRestorePointReplicationStatus replicationStatus = null) { - return new DiskRestorePointInstanceView(id, replicationStatus); + return new DiskRestorePointInstanceView(id, replicationStatus, default); } - /// Initializes a new instance of DiskRestorePointReplicationStatus. + /// Initializes a new instance of . /// The resource status information. /// Replication completion percentage. /// A new instance for mocking. public static DiskRestorePointReplicationStatus DiskRestorePointReplicationStatus(InstanceViewStatus status = null, int? completionPercent = null) { - return new DiskRestorePointReplicationStatus(status, completionPercent); + return new DiskRestorePointReplicationStatus(status, completionPercent, default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The properties of the source resource that this restore point collection is created from. + /// The provisioning state of the restore point collection. + /// The unique id of the restore point collection. + /// A list containing all restore points created under this restore point collection. + /// A new instance for mocking. + public static RestorePointGroupPatch RestorePointGroupPatch(IDictionary tags = null, RestorePointGroupSource source = null, string provisioningState = null, string restorePointGroupId = null, IEnumerable restorePoints = null) + { + tags ??= new Dictionary(); + restorePoints ??= new List(); + + return new RestorePointGroupPatch(tags, source, provisioningState, restorePointGroupId, restorePoints?.ToList(), default); } - /// Initializes a new instance of CapacityReservationGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1178,10 +1303,10 @@ public static CapacityReservationGroupData CapacityReservationGroupData(Resource virtualMachinesAssociated ??= new List(); instanceViewCapacityReservations ??= new List(); - return new CapacityReservationGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), capacityReservations?.ToList(), virtualMachinesAssociated?.ToList(), instanceViewCapacityReservations != null ? new CapacityReservationGroupInstanceView(instanceViewCapacityReservations?.ToList()) : null); + return new CapacityReservationGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), capacityReservations?.ToList(), virtualMachinesAssociated?.ToList(), instanceViewCapacityReservations != null ? new CapacityReservationGroupInstanceView(instanceViewCapacityReservations?.ToList(), new Dictionary()) : null, default); } - /// Initializes a new instance of CapacityReservationInstanceViewWithName. + /// Initializes a new instance of . /// Unutilized capacity of the capacity reservation. /// The resource status information. /// The name of the capacity reservation. @@ -1190,10 +1315,10 @@ public static CapacityReservationInstanceViewWithName CapacityReservationInstanc { statuses ??= new List(); - return new CapacityReservationInstanceViewWithName(utilizationInfo, statuses?.ToList(), name); + return new CapacityReservationInstanceViewWithName(utilizationInfo, statuses?.ToList(), name, default); } - /// Initializes a new instance of CapacityReservationInstanceView. + /// Initializes a new instance of . /// Unutilized capacity of the capacity reservation. /// The resource status information. /// A new instance for mocking. @@ -1201,10 +1326,10 @@ public static CapacityReservationInstanceView CapacityReservationInstanceView(Ca { statuses ??= new List(); - return new CapacityReservationInstanceView(utilizationInfo, statuses?.ToList()); + return new CapacityReservationInstanceView(utilizationInfo, statuses?.ToList(), default); } - /// Initializes a new instance of CapacityReservationUtilization. + /// Initializes a new instance of . /// The value provides the current capacity of the VM size which was reserved successfully and for which the customer is getting billed. Minimum api-version: 2022-08-01. /// A list of all virtual machines resource ids allocated against the capacity reservation. /// A new instance for mocking. @@ -1212,10 +1337,26 @@ public static CapacityReservationUtilization CapacityReservationUtilization(int? { virtualMachinesAllocated ??= new List(); - return new CapacityReservationUtilization(currentCapacity, virtualMachinesAllocated?.ToList()); + return new CapacityReservationUtilization(currentCapacity, virtualMachinesAllocated?.ToList(), default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// A list of all capacity reservation resource ids that belong to capacity reservation group. + /// A list of references to all virtual machines associated to the capacity reservation group. + /// The capacity reservation group instance view which has the list of instance views for all the capacity reservations that belong to the capacity reservation group. + /// A new instance for mocking. + public static CapacityReservationGroupPatch CapacityReservationGroupPatch(IDictionary tags = null, IEnumerable capacityReservations = null, IEnumerable virtualMachinesAssociated = null, IEnumerable instanceViewCapacityReservations = null) + { + tags ??= new Dictionary(); + capacityReservations ??= new List(); + virtualMachinesAssociated ??= new List(); + instanceViewCapacityReservations ??= new List(); + + return new CapacityReservationGroupPatch(tags, capacityReservations?.ToList(), virtualMachinesAssociated?.ToList(), instanceViewCapacityReservations != null ? new CapacityReservationGroupInstanceView(instanceViewCapacityReservations?.ToList(), new Dictionary()) : null, default); } - /// Initializes a new instance of CapacityReservationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1238,48 +1379,95 @@ public static CapacityReservationData CapacityReservationData(ResourceIdentifier zones ??= new List(); virtualMachinesAssociated ??= new List(); - return new CapacityReservationData(id, name, resourceType, systemData, tags, location, sku, zones?.ToList(), reservationId, platformFaultDomainCount, virtualMachinesAssociated?.ToList(), provisioningOn, provisioningState, instanceView, timeCreated); + return new CapacityReservationData(id, name, resourceType, systemData, tags, location, sku, zones?.ToList(), reservationId, platformFaultDomainCount, virtualMachinesAssociated?.ToList(), provisioningOn, provisioningState, instanceView, timeCreated, default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + /// A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. + /// Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. **Note:** The fault domain count specified for a resource (like virtual machines scale set) must be less than or equal to this value if it deploys using capacity reservation. Minimum api-version: 2022-08-01. + /// A list of all virtual machine resource ids that are associated with the capacity reservation. + /// The date time when the capacity reservation was last updated. + /// The provisioning state, which only appears in the response. + /// The Capacity reservation instance view. + /// Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. + /// A new instance for mocking. + public static CapacityReservationPatch CapacityReservationPatch(IDictionary tags = null, ComputeSku sku = null, string reservationId = null, int? platformFaultDomainCount = null, IEnumerable virtualMachinesAssociated = null, DateTimeOffset? provisioningOn = null, string provisioningState = null, CapacityReservationInstanceView instanceView = null, DateTimeOffset? timeCreated = null) + { + tags ??= new Dictionary(); + virtualMachinesAssociated ??= new List(); + + return new CapacityReservationPatch(tags, sku, reservationId, platformFaultDomainCount, virtualMachinesAssociated?.ToList(), provisioningOn, provisioningState, instanceView, timeCreated, default); + } + + /// Initializes a new instance of . + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + /// From time of the query. + /// To time of the query. + /// Group query result by Throttle Policy applied. + /// Group query result by Operation Name. + /// Group query result by Resource Name. + /// Group query result by Client Application ID. + /// Group query result by User Agent. + /// Interval value in minutes used to create LogAnalytics call rate logs. + /// A new instance for mocking. + public static RequestRateByIntervalContent RequestRateByIntervalContent(Uri blobContainerSasUri = null, DateTimeOffset fromTime = default, DateTimeOffset toTime = default, bool? groupByThrottlePolicy = null, bool? groupByOperationName = null, bool? groupByResourceName = null, bool? groupByClientApplicationId = null, bool? groupByUserAgent = null, IntervalInMins intervalLength = default) + { + return new RequestRateByIntervalContent(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent, intervalLength, default); + } + + /// Initializes a new instance of . + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + /// From time of the query. + /// To time of the query. + /// Group query result by Throttle Policy applied. + /// Group query result by Operation Name. + /// Group query result by Resource Name. + /// Group query result by Client Application ID. + /// Group query result by User Agent. + /// A new instance for mocking. + public static LogAnalyticsInputBase LogAnalyticsInputBase(Uri blobContainerSasUri = null, DateTimeOffset fromTime = default, DateTimeOffset toTime = default, bool? groupByThrottlePolicy = null, bool? groupByOperationName = null, bool? groupByResourceName = null, bool? groupByClientApplicationId = null, bool? groupByUserAgent = null) + { + return new LogAnalyticsInputBase(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent, default); } - /// Initializes a new instance of LogAnalytics. + /// Initializes a new instance of . /// LogAnalyticsOutput. /// A new instance for mocking. public static LogAnalytics LogAnalytics(string logAnalyticsOutput = null) { - return new LogAnalytics(logAnalyticsOutput != null ? new LogAnalyticsOutput(logAnalyticsOutput) : null); + return new LogAnalytics(logAnalyticsOutput != null ? new LogAnalyticsOutput(logAnalyticsOutput, new Dictionary()) : null, default); + } + + /// Initializes a new instance of . + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + /// From time of the query. + /// To time of the query. + /// Group query result by Throttle Policy applied. + /// Group query result by Operation Name. + /// Group query result by Resource Name. + /// Group query result by Client Application ID. + /// Group query result by User Agent. + /// A new instance for mocking. + public static ThrottledRequestsContent ThrottledRequestsContent(Uri blobContainerSasUri = null, DateTimeOffset fromTime = default, DateTimeOffset toTime = default, bool? groupByThrottlePolicy = null, bool? groupByOperationName = null, bool? groupByResourceName = null, bool? groupByClientApplicationId = null, bool? groupByUserAgent = null) + { + return new ThrottledRequestsContent(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent, default); } - /// Initializes a new instance of RunCommandDocumentBase. + /// Initializes a new instance of . /// The VM run command schema. /// The VM run command id. /// The Operating System type. /// The VM run command label. /// The VM run command description. - /// , , or is null. /// A new instance for mocking. public static RunCommandDocumentBase RunCommandDocumentBase(string schema = null, string id = null, SupportedOperatingSystemType osType = default, string label = null, string description = null) { - if (schema == null) - { - throw new ArgumentNullException(nameof(schema)); - } - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (label == null) - { - throw new ArgumentNullException(nameof(label)); - } - if (description == null) - { - throw new ArgumentNullException(nameof(description)); - } - - return new RunCommandDocumentBase(schema, id, osType, label, description); - } - - /// Initializes a new instance of RunCommandDocument. + return new RunCommandDocumentBase(schema, id, osType, label, description, default); + } + + /// Initializes a new instance of . /// The VM run command schema. /// The VM run command id. /// The Operating System type. @@ -1287,33 +1475,16 @@ public static RunCommandDocumentBase RunCommandDocumentBase(string schema = null /// The VM run command description. /// The script to be executed. /// The parameters used by the script. - /// , , or is null. /// A new instance for mocking. public static RunCommandDocument RunCommandDocument(string schema = null, string id = null, SupportedOperatingSystemType osType = default, string label = null, string description = null, IEnumerable script = null, IEnumerable parameters = null) { - if (schema == null) - { - throw new ArgumentNullException(nameof(schema)); - } - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (label == null) - { - throw new ArgumentNullException(nameof(label)); - } - if (description == null) - { - throw new ArgumentNullException(nameof(description)); - } script ??= new List(); parameters ??= new List(); - return new RunCommandDocument(schema, id, osType, label, description, script?.ToList(), parameters?.ToList()); + return new RunCommandDocument(schema, id, osType, label, description, script?.ToList(), parameters?.ToList(), default); } - /// Initializes a new instance of RunCommandParameterDefinition. + /// Initializes a new instance of . /// The run command parameter name. /// The run command parameter type. /// The run command parameter default value. @@ -1321,20 +1492,33 @@ public static RunCommandDocument RunCommandDocument(string schema = null, string /// A new instance for mocking. public static RunCommandParameterDefinition RunCommandParameterDefinition(string name = null, string runCommandParameterDefinitionType = null, string defaultValue = null, bool? required = null) { - return new RunCommandParameterDefinition(name, runCommandParameterDefinitionType, defaultValue, required); + return new RunCommandParameterDefinition(name, runCommandParameterDefinitionType, defaultValue, required, default); } - /// Initializes a new instance of VirtualMachineRunCommandResult. + /// Initializes a new instance of . + /// The run command id. + /// Optional. The script to be executed. When this value is given, the given script will override the default script of the command. + /// The run command parameters. + /// A new instance for mocking. + public static RunCommandInput RunCommandInput(string commandId = null, IEnumerable script = null, IEnumerable parameters = null) + { + script ??= new List(); + parameters ??= new List(); + + return new RunCommandInput(commandId, script?.ToList(), parameters?.ToList(), default); + } + + /// Initializes a new instance of . /// Run command operation response. /// A new instance for mocking. public static VirtualMachineRunCommandResult VirtualMachineRunCommandResult(IEnumerable value = null) { value ??= new List(); - return new VirtualMachineRunCommandResult(value?.ToList()); + return new VirtualMachineRunCommandResult(value?.ToList(), default); } - /// Initializes a new instance of VirtualMachineRunCommandData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1362,10 +1546,10 @@ public static VirtualMachineRunCommandData VirtualMachineRunCommandData(Resource parameters ??= new List(); protectedParameters ??= new List(); - return new VirtualMachineRunCommandData(id, name, resourceType, systemData, tags, location, source, parameters?.ToList(), protectedParameters?.ToList(), asyncExecution, runAsUser, runAsPassword, timeoutInSeconds, outputBlobUri, errorBlobUri, outputBlobManagedIdentity, errorBlobManagedIdentity, provisioningState, instanceView, treatFailureAsDeploymentFailure); + return new VirtualMachineRunCommandData(id, name, resourceType, systemData, tags, location, source, parameters?.ToList(), protectedParameters?.ToList(), asyncExecution, runAsUser, runAsPassword, timeoutInSeconds, outputBlobUri, errorBlobUri, outputBlobManagedIdentity, errorBlobManagedIdentity, provisioningState, instanceView, treatFailureAsDeploymentFailure, default); } - /// Initializes a new instance of VirtualMachineRunCommandInstanceView. + /// Initializes a new instance of . /// Script execution status. /// Communicate script configuration errors or execution messages. /// Exit code returned from script execution. @@ -1379,10 +1563,36 @@ public static VirtualMachineRunCommandInstanceView VirtualMachineRunCommandInsta { statuses ??= new List(); - return new VirtualMachineRunCommandInstanceView(executionState, executionMessage, exitCode, output, error, startOn, endOn, statuses?.ToList()); + return new VirtualMachineRunCommandInstanceView(executionState, executionMessage, exitCode, output, error, startOn, endOn, statuses?.ToList(), default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The source of the run command script. + /// The parameters used by the script. + /// The parameters used by the script. + /// Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + /// Specifies the user account on the VM when executing the run command. + /// Specifies the user account password on the VM when executing the run command. + /// The timeout in seconds to execute the run command. + /// Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. + /// Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. + /// User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + /// User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + /// The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. + /// The virtual machine run command instance view. + /// Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. + /// A new instance for mocking. + public static VirtualMachineRunCommandUpdate VirtualMachineRunCommandUpdate(IDictionary tags = null, VirtualMachineRunCommandScriptSource source = null, IEnumerable parameters = null, IEnumerable protectedParameters = null, bool? asyncExecution = null, string runAsUser = null, string runAsPassword = null, int? timeoutInSeconds = null, Uri outputBlobUri = null, Uri errorBlobUri = null, RunCommandManagedIdentity outputBlobManagedIdentity = null, RunCommandManagedIdentity errorBlobManagedIdentity = null, string provisioningState = null, VirtualMachineRunCommandInstanceView instanceView = null, bool? treatFailureAsDeploymentFailure = null) + { + tags ??= new Dictionary(); + parameters ??= new List(); + protectedParameters ??= new List(); + + return new VirtualMachineRunCommandUpdate(tags, source, parameters?.ToList(), protectedParameters?.ToList(), asyncExecution, runAsUser, runAsPassword, timeoutInSeconds, outputBlobUri, errorBlobUri, outputBlobManagedIdentity, errorBlobManagedIdentity, provisioningState, instanceView, treatFailureAsDeploymentFailure, default); } - /// Initializes a new instance of ManagedDiskData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1434,19 +1644,19 @@ public static ManagedDiskData ManagedDiskData(ResourceIdentifier id = null, stri zones ??= new List(); shareInfo ??= new List(); - return new ManagedDiskData(id, name, resourceType, systemData, tags, location, managedBy, managedByExtended?.ToList(), sku, zones?.ToList(), extendedLocation, timeCreated, osType, hyperVGeneration, purchasePlan, supportedCapabilities, creationData, diskSizeGB, diskSizeBytes, uniqueId, encryptionSettingsGroup, provisioningState, diskIopsReadWrite, diskMBpsReadWrite, diskIopsReadOnly, diskMBpsReadOnly, diskState, encryption, maxShares, shareInfo?.ToList(), networkAccessPolicy, diskAccessId, burstingEnabledOn, tier, burstingEnabled, propertyUpdatesInProgressTargetTier != null ? new PropertyUpdatesInProgress(propertyUpdatesInProgressTargetTier) : null, supportsHibernation, securityProfile, completionPercent, publicNetworkAccess, dataAccessAuthMode, isOptimizedForFrequentAttach, lastOwnershipUpdateOn); + return new ManagedDiskData(id, name, resourceType, systemData, tags, location, managedBy, managedByExtended?.ToList(), sku, zones?.ToList(), extendedLocation, timeCreated, osType, hyperVGeneration, purchasePlan, supportedCapabilities, creationData, diskSizeGB, diskSizeBytes, uniqueId, encryptionSettingsGroup, provisioningState, diskIopsReadWrite, diskMBpsReadWrite, diskIopsReadOnly, diskMBpsReadOnly, diskState, encryption, maxShares, shareInfo?.ToList(), networkAccessPolicy, diskAccessId, burstingEnabledOn, tier, burstingEnabled, propertyUpdatesInProgressTargetTier != null ? new PropertyUpdatesInProgress(propertyUpdatesInProgressTargetTier, new Dictionary()) : null, supportsHibernation, securityProfile, completionPercent, publicNetworkAccess, dataAccessAuthMode, isOptimizedForFrequentAttach, lastOwnershipUpdateOn, default); } - /// Initializes a new instance of DiskSku. + /// Initializes a new instance of . /// The sku name. /// The sku tier. /// A new instance for mocking. public static DiskSku DiskSku(DiskStorageAccountType? name = null, string tier = null) { - return new DiskSku(name, tier); + return new DiskSku(name, tier, default); } - /// Initializes a new instance of DiskCreationData. + /// Initializes a new instance of . /// This enumerates the possible sources of a disk's creation. /// Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. /// Disk source information for PIR or user images. @@ -1462,27 +1672,69 @@ public static DiskSku DiskSku(DiskStorageAccountType? name = null, string tier = /// A new instance for mocking. public static DiskCreationData DiskCreationData(DiskCreateOption createOption = default, ResourceIdentifier storageAccountId = null, ImageDiskReference imageReference = null, ImageDiskReference galleryImageReference = null, Uri sourceUri = null, ResourceIdentifier sourceResourceId = null, string sourceUniqueId = null, long? uploadSizeBytes = null, int? logicalSectorSize = null, Uri securityDataUri = null, bool? isPerformancePlusEnabled = null, ResourceIdentifier elasticSanResourceId = null) { - return new DiskCreationData(createOption, storageAccountId, imageReference, galleryImageReference, sourceUri, sourceResourceId, sourceUniqueId, uploadSizeBytes, logicalSectorSize, securityDataUri, isPerformancePlusEnabled, elasticSanResourceId); + return new DiskCreationData(createOption, storageAccountId, imageReference, galleryImageReference, sourceUri, sourceResourceId, sourceUniqueId, uploadSizeBytes, logicalSectorSize, securityDataUri, isPerformancePlusEnabled, elasticSanResourceId, default); } - /// Initializes a new instance of ShareInfoElement. + /// Initializes a new instance of . /// A relative URI containing the ID of the VM that has the disk attached. /// A new instance for mocking. public static ShareInfoElement ShareInfoElement(Uri vmUri = null) { - return new ShareInfoElement(vmUri); + return new ShareInfoElement(vmUri, default); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. + /// the Operating System type. + /// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + /// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + /// The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. + /// The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + /// The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + /// The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + /// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + /// Policy for accessing the disk via network. + /// ARM id of the DiskAccess resource for using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + /// Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + /// Purchase plan information to be added on the OS disk. + /// List of supported capabilities to be added on the OS disk. + /// Properties of the disk for which update is pending. + /// Indicates the OS on a disk supports hibernation. + /// Policy for controlling export on the disk. + /// Additional authentication requirements when exporting or uploading to a disk or snapshot. + /// Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. + /// A new instance for mocking. + public static ManagedDiskPatch ManagedDiskPatch(IDictionary tags = null, DiskSku sku = null, SupportedOperatingSystemType? osType = null, int? diskSizeGB = null, EncryptionSettingsGroup encryptionSettingsGroup = null, long? diskIopsReadWrite = null, long? diskMBpsReadWrite = null, long? diskIopsReadOnly = null, long? diskMBpsReadOnly = null, int? maxShares = null, DiskEncryption encryption = null, NetworkAccessPolicy? networkAccessPolicy = null, ResourceIdentifier diskAccessId = null, string tier = null, bool? burstingEnabled = null, DiskPurchasePlan purchasePlan = null, SupportedCapabilities supportedCapabilities = null, string propertyUpdatesInProgressTargetTier = null, bool? supportsHibernation = null, DiskPublicNetworkAccess? publicNetworkAccess = null, DataAccessAuthMode? dataAccessAuthMode = null, bool? isOptimizedForFrequentAttach = null) + { + tags ??= new Dictionary(); + + return new ManagedDiskPatch(tags, sku, osType, diskSizeGB, encryptionSettingsGroup, diskIopsReadWrite, diskMBpsReadWrite, diskIopsReadOnly, diskMBpsReadOnly, maxShares, encryption, networkAccessPolicy, diskAccessId, tier, burstingEnabled, purchasePlan, supportedCapabilities, propertyUpdatesInProgressTargetTier != null ? new PropertyUpdatesInProgress(propertyUpdatesInProgressTargetTier, new Dictionary()) : null, supportsHibernation, publicNetworkAccess, dataAccessAuthMode, isOptimizedForFrequentAttach, default); } - /// Initializes a new instance of AccessUri. + /// Initializes a new instance of . + /// The Access Level, accepted values include None, Read, Write. + /// Time duration in seconds until the SAS access expires. + /// Set this flag to true to get additional SAS for VM guest state. + /// Used to specify the file format when making request for SAS on a VHDX file format snapshot. + /// A new instance for mocking. + public static GrantAccessData GrantAccessData(AccessLevel access = default, int durationInSeconds = default, bool? getSecureVmGuestStateSas = null, DiskImageFileFormat? fileFormat = null) + { + return new GrantAccessData(access, durationInSeconds, getSecureVmGuestStateSas, fileFormat, default); + } + + /// Initializes a new instance of . /// A SAS uri for accessing a disk. /// A SAS uri for accessing a VM guest state. /// A new instance for mocking. public static AccessUri AccessUri(string accessSas = null, string securityDataAccessSas = null) { - return new AccessUri(accessSas, securityDataAccessSas); + return new AccessUri(accessSas, securityDataAccessSas, default); } - /// Initializes a new instance of DiskAccessData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1499,10 +1751,10 @@ public static DiskAccessData DiskAccessData(ResourceIdentifier id = null, string tags ??= new Dictionary(); privateEndpointConnections ??= new List(); - return new DiskAccessData(id, name, resourceType, systemData, tags, location, extendedLocation, privateEndpointConnections?.ToList(), provisioningState, timeCreated); + return new DiskAccessData(id, name, resourceType, systemData, tags, location, extendedLocation, privateEndpointConnections?.ToList(), provisioningState, timeCreated, default); } - /// Initializes a new instance of ComputePrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1513,10 +1765,10 @@ public static DiskAccessData DiskAccessData(ResourceIdentifier id = null, string /// A new instance for mocking. public static ComputePrivateEndpointConnectionData ComputePrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, ComputePrivateLinkServiceConnectionState connectionState = null, ComputePrivateEndpointConnectionProvisioningState? provisioningState = null) { - return new ComputePrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState); + return new ComputePrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, default); } - /// Initializes a new instance of ComputePrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1530,10 +1782,10 @@ public static ComputePrivateLinkResourceData ComputePrivateLinkResourceData(Reso requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new ComputePrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new ComputePrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } - /// Initializes a new instance of DiskEncryptionSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1555,10 +1807,10 @@ public static DiskEncryptionSetData DiskEncryptionSetData(ResourceIdentifier id tags ??= new Dictionary(); previousKeys ??= new List(); - return new DiskEncryptionSetData(id, name, resourceType, systemData, tags, location, identity, encryptionType, activeKey, previousKeys?.ToList(), provisioningState, rotationToLatestKeyVersionEnabled, lastKeyRotationTimestamp, autoKeyRotationError, federatedClientId); + return new DiskEncryptionSetData(id, name, resourceType, systemData, tags, location, identity, encryptionType, activeKey, previousKeys?.ToList(), provisioningState, rotationToLatestKeyVersionEnabled, lastKeyRotationTimestamp, autoKeyRotationError, federatedClientId, default); } - /// Initializes a new instance of DiskRestorePointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1583,10 +1835,10 @@ public static DiskEncryptionSetData DiskEncryptionSetData(ResourceIdentifier id /// A new instance for mocking. public static DiskRestorePointData DiskRestorePointData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? timeCreated = null, ResourceIdentifier sourceResourceId = null, SupportedOperatingSystemType? osType = null, HyperVGeneration? hyperVGeneration = null, DiskPurchasePlan purchasePlan = null, SupportedCapabilities supportedCapabilities = null, string familyId = null, string sourceUniqueId = null, DiskEncryption encryption = null, bool? supportsHibernation = null, NetworkAccessPolicy? networkAccessPolicy = null, DiskPublicNetworkAccess? publicNetworkAccess = null, ResourceIdentifier diskAccessId = null, float? completionPercent = null, string replicationState = null, AzureLocation? sourceResourceLocation = null, DiskSecurityProfile securityProfile = null) { - return new DiskRestorePointData(id, name, resourceType, systemData, timeCreated, sourceResourceId, osType, hyperVGeneration, purchasePlan, supportedCapabilities, familyId, sourceUniqueId, encryption, supportsHibernation, networkAccessPolicy, publicNetworkAccess, diskAccessId, completionPercent, replicationState, sourceResourceLocation, securityProfile); + return new DiskRestorePointData(id, name, resourceType, systemData, timeCreated, sourceResourceId, osType, hyperVGeneration, purchasePlan, supportedCapabilities, familyId, sourceUniqueId, encryption, supportsHibernation, networkAccessPolicy, publicNetworkAccess, diskAccessId, completionPercent, replicationState, sourceResourceLocation, securityProfile, default); } - /// Initializes a new instance of SnapshotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1624,19 +1876,19 @@ public static SnapshotData SnapshotData(ResourceIdentifier id = null, string nam { tags ??= new Dictionary(); - return new SnapshotData(id, name, resourceType, systemData, tags, location, managedBy, sku, extendedLocation, timeCreated, osType, hyperVGeneration, purchasePlan, supportedCapabilities, creationData, diskSizeGB, diskSizeBytes, diskState, uniqueId, encryptionSettingsGroup, provisioningState, incremental, incrementalSnapshotFamilyId, encryption, networkAccessPolicy, diskAccessId, securityProfile, supportsHibernation, publicNetworkAccess, completionPercent, copyCompletionError, dataAccessAuthMode); + return new SnapshotData(id, name, resourceType, systemData, tags, location, managedBy, sku, extendedLocation, timeCreated, osType, hyperVGeneration, purchasePlan, supportedCapabilities, creationData, diskSizeGB, diskSizeBytes, diskState, uniqueId, encryptionSettingsGroup, provisioningState, incremental, incrementalSnapshotFamilyId, encryption, networkAccessPolicy, diskAccessId, securityProfile, supportsHibernation, publicNetworkAccess, completionPercent, copyCompletionError, dataAccessAuthMode, default); } - /// Initializes a new instance of SnapshotSku. + /// Initializes a new instance of . /// The sku name. /// The sku tier. /// A new instance for mocking. public static SnapshotSku SnapshotSku(SnapshotStorageAccountType? name = null, string tier = null) { - return new SnapshotSku(name, tier); + return new SnapshotSku(name, tier, default); } - /// Initializes a new instance of ComputeResourceSku. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// The name of SKU. /// Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. @@ -1660,10 +1912,10 @@ public static ComputeResourceSku ComputeResourceSku(string resourceType = null, capabilities ??= new List(); restrictions ??= new List(); - return new ComputeResourceSku(resourceType, name, tier, size, family, kind, capacity, locations?.ToList(), locationInfo?.ToList(), apiVersions?.ToList(), costs?.ToList(), capabilities?.ToList(), restrictions?.ToList()); + return new ComputeResourceSku(resourceType, name, tier, size, family, kind, capacity, locations?.ToList(), locationInfo?.ToList(), apiVersions?.ToList(), costs?.ToList(), capabilities?.ToList(), restrictions?.ToList(), default); } - /// Initializes a new instance of ComputeResourceSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. @@ -1671,10 +1923,10 @@ public static ComputeResourceSku ComputeResourceSku(string resourceType = null, /// A new instance for mocking. public static ComputeResourceSkuCapacity ComputeResourceSkuCapacity(long? minimum = null, long? maximum = null, long? @default = null, ComputeResourceSkuCapacityScaleType? scaleType = null) { - return new ComputeResourceSkuCapacity(minimum, maximum, @default, scaleType); + return new ComputeResourceSkuCapacity(minimum, maximum, @default, scaleType, default); } - /// Initializes a new instance of ComputeResourceSkuLocationInfo. + /// Initializes a new instance of . /// Location of the SKU. /// List of availability zones where the SKU is supported. /// Details of capabilities available to a SKU in specific zones. @@ -1687,10 +1939,10 @@ public static ComputeResourceSkuLocationInfo ComputeResourceSkuLocationInfo(Azur zoneDetails ??= new List(); extendedLocations ??= new List(); - return new ComputeResourceSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList(), extendedLocations?.ToList(), extendedLocationType); + return new ComputeResourceSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList(), extendedLocations?.ToList(), extendedLocationType, default); } - /// Initializes a new instance of ComputeResourceSkuZoneDetails. + /// Initializes a new instance of . /// The set of zones that the SKU is available in with the specified capabilities. /// A list of capabilities that are available for the SKU in the specified list of zones. /// A new instance for mocking. @@ -1699,29 +1951,29 @@ public static ComputeResourceSkuZoneDetails ComputeResourceSkuZoneDetails(IEnume name ??= new List(); capabilities ??= new List(); - return new ComputeResourceSkuZoneDetails(name?.ToList(), capabilities?.ToList()); + return new ComputeResourceSkuZoneDetails(name?.ToList(), capabilities?.ToList(), default); } - /// Initializes a new instance of ComputeResourceSkuCapabilities. + /// Initializes a new instance of . /// An invariant to describe the feature. /// An invariant if the feature is measured by quantity. /// A new instance for mocking. public static ComputeResourceSkuCapabilities ComputeResourceSkuCapabilities(string name = null, string value = null) { - return new ComputeResourceSkuCapabilities(name, value); + return new ComputeResourceSkuCapabilities(name, value, default); } - /// Initializes a new instance of ResourceSkuCosts. + /// Initializes a new instance of . /// Used for querying price from commerce. /// The multiplier is needed to extend the base metered cost. /// An invariant to show the extended unit. /// A new instance for mocking. public static ResourceSkuCosts ResourceSkuCosts(string meterId = null, long? quantity = null, string extendedUnit = null) { - return new ResourceSkuCosts(meterId, quantity, extendedUnit); + return new ResourceSkuCosts(meterId, quantity, extendedUnit, default); } - /// Initializes a new instance of ComputeResourceSkuRestrictions. + /// Initializes a new instance of . /// The type of restrictions. /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. /// The information about the restriction where the SKU cannot be used. @@ -1731,10 +1983,10 @@ public static ComputeResourceSkuRestrictions ComputeResourceSkuRestrictions(Comp { values ??= new List(); - return new ComputeResourceSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode); + return new ComputeResourceSkuRestrictions(restrictionsType, values?.ToList(), restrictionInfo, reasonCode, default); } - /// Initializes a new instance of ComputeResourceSkuRestrictionInfo. + /// Initializes a new instance of . /// Locations where the SKU is restricted. /// List of availability zones where the SKU is restricted. /// A new instance for mocking. @@ -1743,10 +1995,10 @@ public static ComputeResourceSkuRestrictionInfo ComputeResourceSkuRestrictionInf locations ??= new List(); zones ??= new List(); - return new ComputeResourceSkuRestrictionInfo(locations?.ToList(), zones?.ToList()); + return new ComputeResourceSkuRestrictionInfo(locations?.ToList(), zones?.ToList(), default); } - /// Initializes a new instance of GalleryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1764,10 +2016,10 @@ public static GalleryData GalleryData(ResourceIdentifier id = null, string name { tags ??= new Dictionary(); - return new GalleryData(id, name, resourceType, systemData, tags, location, description, identifierUniqueName != null ? new GalleryIdentifier(identifierUniqueName) : null, provisioningState, sharingProfile, isSoftDeleteEnabled != null ? new SoftDeletePolicy(isSoftDeleteEnabled) : null, sharingStatus); + return new GalleryData(id, name, resourceType, systemData, tags, location, description, identifierUniqueName != null ? new GalleryIdentifier(identifierUniqueName, new Dictionary()) : null, provisioningState, sharingProfile, isSoftDeleteEnabled != null ? new SoftDeletePolicy(isSoftDeleteEnabled, new Dictionary()) : null, sharingStatus, default); } - /// Initializes a new instance of SharingProfile. + /// Initializes a new instance of . /// This property allows you to specify the permission of sharing gallery. <br><br> Possible values are: <br><br> **Private** <br><br> **Groups** <br><br> **Community**. /// A list of sharing profile groups. /// Information of community gallery if current gallery is shared to community. @@ -1776,10 +2028,10 @@ public static SharingProfile SharingProfile(GallerySharingPermissionType? permis { groups ??= new List(); - return new SharingProfile(permission, groups?.ToList(), communityGalleryInfo); + return new SharingProfile(permission, groups?.ToList(), communityGalleryInfo, default); } - /// Initializes a new instance of CommunityGalleryInfo. + /// Initializes a new instance of . /// The link to the publisher website. Visible to all users. /// Community gallery publisher support email. The email address of the publisher. Visible to all users. /// End-user license agreement for community gallery image. @@ -1791,10 +2043,10 @@ public static CommunityGalleryInfo CommunityGalleryInfo(Uri publisherUri = null, { publicNames ??= new List(); - return new CommunityGalleryInfo(publisherUri, publisherContact, eula, publicNamePrefix, communityGalleryEnabled, publicNames?.ToList()); + return new CommunityGalleryInfo(publisherUri, publisherContact, eula, publicNamePrefix, communityGalleryEnabled, publicNames?.ToList(), default); } - /// Initializes a new instance of SharingStatus. + /// Initializes a new instance of . /// Aggregated sharing state of current gallery. /// Summary of all regional sharing status. /// A new instance for mocking. @@ -1802,20 +2054,40 @@ public static SharingStatus SharingStatus(SharingState? aggregatedState = null, { summary ??= new List(); - return new SharingStatus(aggregatedState, summary?.ToList()); + return new SharingStatus(aggregatedState, summary?.ToList(), default); } - /// Initializes a new instance of RegionalSharingStatus. + /// Initializes a new instance of . /// Region name. /// Gallery sharing state in current region. /// Details of gallery regional sharing failure. /// A new instance for mocking. public static RegionalSharingStatus RegionalSharingStatus(string region = null, SharingState? state = null, string details = null) { - return new RegionalSharingStatus(region, state, details); + return new RegionalSharingStatus(region, state, details, default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of this Shared Image Gallery resource. This property is updatable. + /// Describes the gallery unique name. + /// The provisioning state, which only appears in the response. + /// Profile for gallery sharing to subscription or tenant. + /// Contains information about the soft deletion policy of the gallery. + /// Sharing status of current gallery. + /// Resource tags. + /// A new instance for mocking. + public static GalleryPatch GalleryPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string identifierUniqueName = null, GalleryProvisioningState? provisioningState = null, SharingProfile sharingProfile = null, bool? isSoftDeleteEnabled = null, SharingStatus sharingStatus = null, IDictionary tags = null) + { + tags ??= new Dictionary(); + + return new GalleryPatch(id, name, resourceType, systemData, description, identifierUniqueName != null ? new GalleryIdentifier(identifierUniqueName, new Dictionary()) : null, provisioningState, sharingProfile, isSoftDeleteEnabled != null ? new SoftDeletePolicy(isSoftDeleteEnabled, new Dictionary()) : null, sharingStatus, tags, default); } - /// Initializes a new instance of GalleryImageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1844,10 +2116,41 @@ public static GalleryImageData GalleryImageData(ResourceIdentifier id = null, st disallowedDiskTypes ??= new List(); features ??= new List(); - return new GalleryImageData(id, name, resourceType, systemData, tags, location, description, eula, privacyStatementUri, releaseNoteUri, osType, osState, hyperVGeneration, endOfLifeOn, identifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList()) : null, purchasePlan, provisioningState, features?.ToList(), architecture); + return new GalleryImageData(id, name, resourceType, systemData, tags, location, description, eula, privacyStatementUri, releaseNoteUri, osType, osState, hyperVGeneration, endOfLifeOn, identifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList(), new Dictionary()) : null, purchasePlan, provisioningState, features?.ToList(), architecture, default); } - /// Initializes a new instance of GalleryImageVersionData. + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of this gallery image definition resource. This property is updatable. + /// The Eula agreement for the gallery image definition. + /// The privacy statement uri. + /// The release note uri. + /// This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. + /// This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. + /// The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + /// The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable. + /// This is the gallery image definition identifier. + /// The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + /// Describes the disallowed disk types. + /// Describes the gallery image definition purchase plan. This is used by marketplace images. + /// The provisioning state, which only appears in the response. + /// A list of gallery image features. + /// The architecture of the image. Applicable to OS disks only. + /// Resource tags. + /// A new instance for mocking. + public static GalleryImagePatch GalleryImagePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string eula = null, Uri privacyStatementUri = null, Uri releaseNoteUri = null, SupportedOperatingSystemType? osType = null, OperatingSystemStateType? osState = null, HyperVGeneration? hyperVGeneration = null, DateTimeOffset? endOfLifeOn = null, GalleryImageIdentifier identifier = null, RecommendedMachineConfiguration recommended = null, IEnumerable disallowedDiskTypes = null, ImagePurchasePlan purchasePlan = null, GalleryProvisioningState? provisioningState = null, IEnumerable features = null, ArchitectureType? architecture = null, IDictionary tags = null) + { + disallowedDiskTypes ??= new List(); + features ??= new List(); + tags ??= new Dictionary(); + + return new GalleryImagePatch(id, name, resourceType, systemData, description, eula, privacyStatementUri, releaseNoteUri, osType, osState, hyperVGeneration, endOfLifeOn, identifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList(), new Dictionary()) : null, purchasePlan, provisioningState, features?.ToList(), architecture, tags, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1864,10 +2167,10 @@ public static GalleryImageVersionData GalleryImageVersionData(ResourceIdentifier { tags ??= new Dictionary(); - return new GalleryImageVersionData(id, name, resourceType, systemData, tags, location, publishingProfile, provisioningState, storageProfile, safetyProfile, replicationStatus); + return new GalleryImageVersionData(id, name, resourceType, systemData, tags, location, publishingProfile, provisioningState, storageProfile, safetyProfile, replicationStatus, default); } - /// Initializes a new instance of GalleryImageVersionPublishingProfile. + /// Initializes a new instance of . /// The target regions where the Image Version is going to be replicated to. This property is updatable. /// The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. @@ -1882,10 +2185,10 @@ public static GalleryImageVersionPublishingProfile GalleryImageVersionPublishing targetRegions ??= new List(); targetExtendedLocations ??= new List(); - return new GalleryImageVersionPublishingProfile(targetRegions?.ToList(), replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations?.ToList()); + return new GalleryImageVersionPublishingProfile(targetRegions?.ToList(), replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations?.ToList(), default); } - /// Initializes a new instance of GalleryArtifactPublishingProfileBase. + /// Initializes a new instance of . /// The target regions where the Image Version is going to be replicated to. This property is updatable. /// The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. @@ -1900,30 +2203,30 @@ public static GalleryArtifactPublishingProfileBase GalleryArtifactPublishingProf targetRegions ??= new List(); targetExtendedLocations ??= new List(); - return new GalleryArtifactPublishingProfileBase(targetRegions?.ToList(), replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations?.ToList()); + return new GalleryArtifactPublishingProfileBase(targetRegions?.ToList(), replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations?.ToList(), default); } - /// Initializes a new instance of GalleryOSDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// The source for the disk image. /// A new instance for mocking. public static GalleryOSDiskImage GalleryOSDiskImage(int? sizeInGB = null, HostCaching? hostCaching = null, GalleryDiskImageSource gallerySource = null) { - return new GalleryOSDiskImage(sizeInGB, hostCaching, gallerySource); + return new GalleryOSDiskImage(sizeInGB, hostCaching, gallerySource, default); } - /// Initializes a new instance of GalleryDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// The source for the disk image. /// A new instance for mocking. public static GalleryDiskImage GalleryDiskImage(int? sizeInGB = null, HostCaching? hostCaching = null, GalleryDiskImageSource gallerySource = null) { - return new GalleryDiskImage(sizeInGB, hostCaching, gallerySource); + return new GalleryDiskImage(sizeInGB, hostCaching, gallerySource, default); } - /// Initializes a new instance of GalleryDataDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// The source for the disk image. @@ -1931,10 +2234,10 @@ public static GalleryDiskImage GalleryDiskImage(int? sizeInGB = null, HostCachin /// A new instance for mocking. public static GalleryDataDiskImage GalleryDataDiskImage(int? sizeInGB = null, HostCaching? hostCaching = null, GalleryDiskImageSource gallerySource = null, int lun = default) { - return new GalleryDataDiskImage(sizeInGB, hostCaching, gallerySource, lun); + return new GalleryDataDiskImage(sizeInGB, hostCaching, gallerySource, lun, default); } - /// Initializes a new instance of GalleryImageVersionSafetyProfile. + /// Initializes a new instance of . /// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. /// Indicates whether this image has been reported as violating Microsoft's policies. /// A list of Policy Violations that have been reported for this Gallery Image Version. @@ -1943,19 +2246,19 @@ public static GalleryImageVersionSafetyProfile GalleryImageVersionSafetyProfile( { policyViolations ??= new List(); - return new GalleryImageVersionSafetyProfile(allowDeletionOfReplicatedLocations, isReportedForPolicyViolation, policyViolations?.ToList()); + return new GalleryImageVersionSafetyProfile(allowDeletionOfReplicatedLocations, isReportedForPolicyViolation, policyViolations?.ToList(), default); } - /// Initializes a new instance of GalleryImageVersionPolicyViolation. + /// Initializes a new instance of . /// Describes the nature of the policy violation. /// Describes specific details about why this policy violation was reported. /// A new instance for mocking. public static GalleryImageVersionPolicyViolation GalleryImageVersionPolicyViolation(GalleryImageVersionPolicyViolationCategory? category = null, string details = null) { - return new GalleryImageVersionPolicyViolation(category, details); + return new GalleryImageVersionPolicyViolation(category, details, default); } - /// Initializes a new instance of ReplicationStatus. + /// Initializes a new instance of . /// This is the aggregated replication status based on all the regional replication status flags. /// This is a summary of replication status for each region. /// A new instance for mocking. @@ -1963,10 +2266,10 @@ public static ReplicationStatus ReplicationStatus(AggregatedReplicationState? ag { summary ??= new List(); - return new ReplicationStatus(aggregatedState, summary?.ToList()); + return new ReplicationStatus(aggregatedState, summary?.ToList(), default); } - /// Initializes a new instance of RegionalReplicationStatus. + /// Initializes a new instance of . /// The region to which the gallery image version is being replicated to. /// This is the regional replication state. /// The details of the replication status. @@ -1974,10 +2277,29 @@ public static ReplicationStatus ReplicationStatus(AggregatedReplicationState? ag /// A new instance for mocking. public static RegionalReplicationStatus RegionalReplicationStatus(string region = null, RegionalReplicationState? state = null, string details = null, int? progress = null) { - return new RegionalReplicationStatus(region, state, details, progress); + return new RegionalReplicationStatus(region, state, details, progress, default); } - /// Initializes a new instance of GalleryApplicationData. + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The publishing profile of a gallery image Version. + /// The provisioning state, which only appears in the response. + /// This is the storage profile of a Gallery Image Version. + /// This is the safety profile of the Gallery Image Version. + /// This is the replication status of the gallery image version. + /// Resource tags. + /// A new instance for mocking. + public static GalleryImageVersionPatch GalleryImageVersionPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GalleryImageVersionPublishingProfile publishingProfile = null, GalleryProvisioningState? provisioningState = null, GalleryImageVersionStorageProfile storageProfile = null, GalleryImageVersionSafetyProfile safetyProfile = null, ReplicationStatus replicationStatus = null, IDictionary tags = null) + { + tags ??= new Dictionary(); + + return new GalleryImageVersionPatch(id, name, resourceType, systemData, publishingProfile, provisioningState, storageProfile, safetyProfile, replicationStatus, tags, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1997,10 +2319,32 @@ public static GalleryApplicationData GalleryApplicationData(ResourceIdentifier i tags ??= new Dictionary(); customActions ??= new List(); - return new GalleryApplicationData(id, name, resourceType, systemData, tags, location, description, eula, privacyStatementUri, releaseNoteUri, endOfLifeOn, supportedOSType, customActions?.ToList()); + return new GalleryApplicationData(id, name, resourceType, systemData, tags, location, description, eula, privacyStatementUri, releaseNoteUri, endOfLifeOn, supportedOSType, customActions?.ToList(), default); } - /// Initializes a new instance of GalleryApplicationVersionData. + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of this gallery Application Definition resource. This property is updatable. + /// The Eula agreement for the gallery Application Definition. + /// The privacy statement uri. + /// The release note uri. + /// The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. + /// This property allows you to specify the supported type of the OS that application is built for. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. + /// A list of custom actions that can be performed with all of the Gallery Application Versions within this Gallery Application. + /// Resource tags. + /// A new instance for mocking. + public static GalleryApplicationPatch GalleryApplicationPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string eula = null, Uri privacyStatementUri = null, Uri releaseNoteUri = null, DateTimeOffset? endOfLifeOn = null, SupportedOperatingSystemType? supportedOSType = null, IEnumerable customActions = null, IDictionary tags = null) + { + customActions ??= new List(); + tags ??= new Dictionary(); + + return new GalleryApplicationPatch(id, name, resourceType, systemData, description, eula, privacyStatementUri, releaseNoteUri, endOfLifeOn, supportedOSType, customActions?.ToList(), tags, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2016,10 +2360,10 @@ public static GalleryApplicationVersionData GalleryApplicationVersionData(Resour { tags ??= new Dictionary(); - return new GalleryApplicationVersionData(id, name, resourceType, systemData, tags, location, publishingProfile, allowDeletionOfReplicatedLocations != null ? new GalleryApplicationVersionSafetyProfile(allowDeletionOfReplicatedLocations) : null, provisioningState, replicationStatus); + return new GalleryApplicationVersionData(id, name, resourceType, systemData, tags, location, publishingProfile, allowDeletionOfReplicatedLocations != null ? new GalleryApplicationVersionSafetyProfile(allowDeletionOfReplicatedLocations, new Dictionary()) : null, provisioningState, replicationStatus, default); } - /// Initializes a new instance of GalleryApplicationVersionPublishingProfile. + /// Initializes a new instance of . /// The target regions where the Image Version is going to be replicated to. This property is updatable. /// The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. @@ -2042,39 +2386,57 @@ public static GalleryApplicationVersionPublishingProfile GalleryApplicationVersi advancedSettings ??= new Dictionary(); customActions ??= new List(); - return new GalleryApplicationVersionPublishingProfile(targetRegions?.ToList(), replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations?.ToList(), source, manageActions, settings, advancedSettings, enableHealthCheck, customActions?.ToList()); + return new GalleryApplicationVersionPublishingProfile(targetRegions?.ToList(), replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations?.ToList(), source, manageActions, settings, advancedSettings, enableHealthCheck, customActions?.ToList(), default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The publishing profile of a gallery image version. + /// The safety profile of the Gallery Application Version. + /// The provisioning state, which only appears in the response. + /// This is the replication status of the gallery image version. + /// Resource tags. + /// A new instance for mocking. + public static GalleryApplicationVersionPatch GalleryApplicationVersionPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GalleryApplicationVersionPublishingProfile publishingProfile = null, bool? allowDeletionOfReplicatedLocations = null, GalleryProvisioningState? provisioningState = null, ReplicationStatus replicationStatus = null, IDictionary tags = null) + { + tags ??= new Dictionary(); + + return new GalleryApplicationVersionPatch(id, name, resourceType, systemData, publishingProfile, allowDeletionOfReplicatedLocations != null ? new GalleryApplicationVersionSafetyProfile(allowDeletionOfReplicatedLocations, new Dictionary()) : null, provisioningState, replicationStatus, tags, default); } - /// Initializes a new instance of SharedGalleryData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. /// A new instance for mocking. public static SharedGalleryData SharedGalleryData(string name = null, AzureLocation? location = null, string uniqueId = null) { - return new SharedGalleryData(name, location, uniqueId); + return new SharedGalleryData(name, location, uniqueId, default); } - /// Initializes a new instance of PirSharedGalleryResourceData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. /// A new instance for mocking. public static PirSharedGalleryResourceData PirSharedGalleryResourceData(string name = null, AzureLocation? location = null, string uniqueId = null) { - return new PirSharedGalleryResourceData(name, location, uniqueId); + return new PirSharedGalleryResourceData(name, location, uniqueId, default); } - /// Initializes a new instance of PirResourceData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// A new instance for mocking. public static PirResourceData PirResourceData(string name = null, AzureLocation? location = null) { - return new PirResourceData(name, location); + return new PirResourceData(name, location, default); } - /// Initializes a new instance of SharedGalleryImageData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. @@ -2096,10 +2458,10 @@ public static SharedGalleryImageData SharedGalleryImageData(string name = null, disallowedDiskTypes ??= new List(); features ??= new List(); - return new SharedGalleryImageData(name, location, uniqueId, osType, osState, endOfLifeOn, identifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList()) : null, hyperVGeneration, features?.ToList(), purchasePlan, architecture, privacyStatementUri, eula); + return new SharedGalleryImageData(name, location, uniqueId, osType, osState, endOfLifeOn, identifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList(), new Dictionary()) : null, hyperVGeneration, features?.ToList(), purchasePlan, architecture, privacyStatementUri, eula, default); } - /// Initializes a new instance of SharedGalleryImageVersionData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. @@ -2110,10 +2472,10 @@ public static SharedGalleryImageData SharedGalleryImageData(string name = null, /// A new instance for mocking. public static SharedGalleryImageVersionData SharedGalleryImageVersionData(string name = null, AzureLocation? location = null, string uniqueId = null, DateTimeOffset? publishedOn = null, DateTimeOffset? endOfLifeOn = null, bool? isExcludedFromLatest = null, SharedGalleryImageVersionStorageProfile storageProfile = null) { - return new SharedGalleryImageVersionData(name, location, uniqueId, publishedOn, endOfLifeOn, isExcludedFromLatest, storageProfile); + return new SharedGalleryImageVersionData(name, location, uniqueId, publishedOn, endOfLifeOn, isExcludedFromLatest, storageProfile, default); } - /// Initializes a new instance of SharedGalleryImageVersionStorageProfile. + /// Initializes a new instance of . /// This is the OS disk image. /// A list of data disk images. /// A new instance for mocking. @@ -2121,38 +2483,38 @@ public static SharedGalleryImageVersionStorageProfile SharedGalleryImageVersionS { dataDiskImages ??= new List(); - return new SharedGalleryImageVersionStorageProfile(osDiskImage, dataDiskImages?.ToList()); + return new SharedGalleryImageVersionStorageProfile(osDiskImage, dataDiskImages?.ToList(), default); } - /// Initializes a new instance of SharedGalleryOSDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// A new instance for mocking. public static SharedGalleryOSDiskImage SharedGalleryOSDiskImage(int? diskSizeGB = null, SharedGalleryHostCaching? hostCaching = null) { - return new SharedGalleryOSDiskImage(diskSizeGB, hostCaching); + return new SharedGalleryOSDiskImage(diskSizeGB, hostCaching, default); } - /// Initializes a new instance of SharedGalleryDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// A new instance for mocking. public static SharedGalleryDiskImage SharedGalleryDiskImage(int? diskSizeGB = null, SharedGalleryHostCaching? hostCaching = null) { - return new SharedGalleryDiskImage(diskSizeGB, hostCaching); + return new SharedGalleryDiskImage(diskSizeGB, hostCaching, default); } - /// Initializes a new instance of SharedGalleryDataDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. /// A new instance for mocking. public static SharedGalleryDataDiskImage SharedGalleryDataDiskImage(int? diskSizeGB = null, SharedGalleryHostCaching? hostCaching = null, int lun = default) { - return new SharedGalleryDataDiskImage(diskSizeGB, hostCaching, lun); + return new SharedGalleryDataDiskImage(diskSizeGB, hostCaching, lun, default); } - /// Initializes a new instance of CommunityGalleryData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. @@ -2160,10 +2522,10 @@ public static SharedGalleryDataDiskImage SharedGalleryDataDiskImage(int? diskSiz /// A new instance for mocking. public static CommunityGalleryData CommunityGalleryData(string name = null, AzureLocation? location = null, ResourceType? resourceType = null, string uniqueId = null) { - return new CommunityGalleryData(name, location, resourceType, uniqueId); + return new CommunityGalleryData(name, location, resourceType, uniqueId, default); } - /// Initializes a new instance of PirCommunityGalleryResourceData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. @@ -2171,10 +2533,10 @@ public static CommunityGalleryData CommunityGalleryData(string name = null, Azur /// A new instance for mocking. public static PirCommunityGalleryResourceData PirCommunityGalleryResourceData(string name = null, AzureLocation? location = null, ResourceType? resourceType = null, string uniqueId = null) { - return new PirCommunityGalleryResourceData(name, location, resourceType, uniqueId); + return new PirCommunityGalleryResourceData(name, location, resourceType, uniqueId, default); } - /// Initializes a new instance of CommunityGalleryImageData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. @@ -2197,20 +2559,20 @@ public static CommunityGalleryImageData CommunityGalleryImageData(string name = disallowedDiskTypes ??= new List(); features ??= new List(); - return new CommunityGalleryImageData(name, location, resourceType, uniqueId, osType, osState, endOfLifeOn, imageIdentifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList()) : null, hyperVGeneration, features?.ToList(), purchasePlan, architecture, privacyStatementUri, eula); + return new CommunityGalleryImageData(name, location, resourceType, uniqueId, osType, osState, endOfLifeOn, imageIdentifier, recommended, disallowedDiskTypes != null ? new Disallowed(disallowedDiskTypes?.ToList(), new Dictionary()) : null, hyperVGeneration, features?.ToList(), purchasePlan, architecture, privacyStatementUri, eula, default); } - /// Initializes a new instance of CommunityGalleryImageIdentifier. + /// Initializes a new instance of . /// The name of the gallery image definition publisher. /// The name of the gallery image definition offer. /// The name of the gallery image definition SKU. /// A new instance for mocking. public static CommunityGalleryImageIdentifier CommunityGalleryImageIdentifier(string publisher = null, string offer = null, string sku = null) { - return new CommunityGalleryImageIdentifier(publisher, offer, sku); + return new CommunityGalleryImageIdentifier(publisher, offer, sku, default); } - /// Initializes a new instance of CommunityGalleryImageVersionData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. @@ -2222,10 +2584,10 @@ public static CommunityGalleryImageIdentifier CommunityGalleryImageIdentifier(st /// A new instance for mocking. public static CommunityGalleryImageVersionData CommunityGalleryImageVersionData(string name = null, AzureLocation? location = null, ResourceType? resourceType = null, string uniqueId = null, DateTimeOffset? publishedOn = null, DateTimeOffset? endOfLifeOn = null, bool? isExcludedFromLatest = null, SharedGalleryImageVersionStorageProfile storageProfile = null) { - return new CommunityGalleryImageVersionData(name, location, resourceType, uniqueId, publishedOn, endOfLifeOn, isExcludedFromLatest, storageProfile); + return new CommunityGalleryImageVersionData(name, location, resourceType, uniqueId, publishedOn, endOfLifeOn, isExcludedFromLatest, storageProfile, default); } - /// Initializes a new instance of CloudServiceRoleInstanceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2241,19 +2603,19 @@ public static CloudServiceRoleInstanceData CloudServiceRoleInstanceData(Resource tags ??= new Dictionary(); networkInterfaces ??= new List(); - return new CloudServiceRoleInstanceData(id, name, resourceType, systemData, location, tags, sku, networkInterfaces != null ? new RoleInstanceNetworkProfile(networkInterfaces?.ToList()) : null, instanceView); + return new CloudServiceRoleInstanceData(id, name, resourceType, systemData, location, tags, sku, networkInterfaces != null ? new RoleInstanceNetworkProfile(networkInterfaces?.ToList(), new Dictionary()) : null, instanceView, default); } - /// Initializes a new instance of InstanceSku. + /// Initializes a new instance of . /// The sku name. /// The tier of the cloud service role instance. /// A new instance for mocking. public static InstanceSku InstanceSku(string name = null, string tier = null) { - return new InstanceSku(name, tier); + return new InstanceSku(name, tier, default); } - /// Initializes a new instance of RoleInstanceView. + /// Initializes a new instance of . /// The Update Domain. /// The Fault Domain. /// Specifies a unique identifier generated internally for the cloud service associated with this role instance. <br /><br /> NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. @@ -2263,10 +2625,10 @@ public static RoleInstanceView RoleInstanceView(int? platformUpdateDomain = null { statuses ??= new List(); - return new RoleInstanceView(platformUpdateDomain, platformFaultDomain, privateId, statuses?.ToList()); + return new RoleInstanceView(platformUpdateDomain, platformFaultDomain, privateId, statuses?.ToList(), default); } - /// Initializes a new instance of ResourceInstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The short localizable label for the status. /// The detailed status message, including for alerts and error messages. @@ -2275,10 +2637,10 @@ public static RoleInstanceView RoleInstanceView(int? platformUpdateDomain = null /// A new instance for mocking. public static ResourceInstanceViewStatus ResourceInstanceViewStatus(string code = null, string displayStatus = null, string message = null, DateTimeOffset? time = null, ComputeStatusLevelType? level = null) { - return new ResourceInstanceViewStatus(code, displayStatus, message, time, level); + return new ResourceInstanceViewStatus(code, displayStatus, message, time, level, default); } - /// Initializes a new instance of CloudServiceRoleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2289,10 +2651,10 @@ public static ResourceInstanceViewStatus ResourceInstanceViewStatus(string code /// A new instance for mocking. public static CloudServiceRoleData CloudServiceRoleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, CloudServiceRoleSku sku = null, string uniqueId = null) { - return new CloudServiceRoleData(id, name, resourceType, systemData, location, sku, uniqueId); + return new CloudServiceRoleData(id, name, resourceType, systemData, location, sku, uniqueId, default); } - /// Initializes a new instance of CloudServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2337,10 +2699,10 @@ public static CloudServiceData CloudServiceData(ResourceIdentifier id = null, st osSecrets ??= new List(); extensions ??= new List(); - return new CloudServiceData(id, name, resourceType, systemData, tags, location, zones?.ToList(), packageUri, configuration, configurationUri, startCloudService, allowModelOverride, upgradeMode, roles != null ? new CloudServiceRoleProfile(roles?.ToList()) : null, osSecrets != null ? new CloudServiceOSProfile(osSecrets?.ToList()) : null, networkProfile, extensions != null ? new CloudServiceExtensionProfile(extensions?.ToList()) : null, provisioningState, uniqueId); + return new CloudServiceData(id, name, resourceType, systemData, tags, location, zones?.ToList(), packageUri, configuration, configurationUri, startCloudService, allowModelOverride, upgradeMode, roles != null ? new CloudServiceRoleProfile(roles?.ToList(), new Dictionary()) : null, osSecrets != null ? new CloudServiceOSProfile(osSecrets?.ToList(), new Dictionary()) : null, networkProfile, extensions != null ? new CloudServiceExtensionProfile(extensions?.ToList(), new Dictionary()) : null, provisioningState, uniqueId, default); } - /// Initializes a new instance of CloudServiceExtension. + /// Initializes a new instance of . /// The name of the extension. /// The name of the extension handler publisher. /// Specifies the type of the extension. @@ -2363,10 +2725,10 @@ public static CloudServiceExtension CloudServiceExtension(string name = null, st { rolesAppliedTo ??= new List(); - return new CloudServiceExtension(name, publisher, cloudServiceExtensionPropertiesType, typeHandlerVersion, autoUpgradeMinorVersion, settings, protectedSettings, protectedSettingsFromKeyVault, forceUpdateTag, provisioningState, rolesAppliedTo?.ToList()); + return new CloudServiceExtension(name, publisher, cloudServiceExtensionPropertiesType, typeHandlerVersion, autoUpgradeMinorVersion, settings, protectedSettings, protectedSettingsFromKeyVault, forceUpdateTag, provisioningState, rolesAppliedTo?.ToList(), default); } - /// Initializes a new instance of CloudServiceInstanceView. + /// Initializes a new instance of . /// Instance view statuses. /// The version of the SDK that was used to generate the package for the cloud service. /// Specifies a list of unique identifiers generated internally for the cloud service. <br /><br /> NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. @@ -2378,28 +2740,28 @@ public static CloudServiceInstanceView CloudServiceInstanceView(IEnumerable(); statuses ??= new List(); - return new CloudServiceInstanceView(roleInstanceStatusesSummary != null ? new InstanceViewStatusesSummary(roleInstanceStatusesSummary?.ToList()) : null, sdkVersion, privateIds?.ToList(), statuses?.ToList()); + return new CloudServiceInstanceView(roleInstanceStatusesSummary != null ? new InstanceViewStatusesSummary(roleInstanceStatusesSummary?.ToList(), new Dictionary()) : null, sdkVersion, privateIds?.ToList(), statuses?.ToList(), default); } - /// Initializes a new instance of StatusCodeCount. + /// Initializes a new instance of . /// The instance view status code. /// Number of instances having this status code. /// A new instance for mocking. public static StatusCodeCount StatusCodeCount(string code = null, int? count = null) { - return new StatusCodeCount(code, count); + return new StatusCodeCount(code, count, default); } - /// Initializes a new instance of UpdateDomainIdentifier. + /// Initializes a new instance of . /// Resource Id. /// Resource Name. /// A new instance for mocking. public static UpdateDomainIdentifier UpdateDomainIdentifier(ResourceIdentifier id = null, string name = null) { - return new UpdateDomainIdentifier(id, name); + return new UpdateDomainIdentifier(id, name, default); } - /// Initializes a new instance of CloudServiceOSVersionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2414,10 +2776,10 @@ public static UpdateDomainIdentifier UpdateDomainIdentifier(ResourceIdentifier i /// A new instance for mocking. public static CloudServiceOSVersionData CloudServiceOSVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, string family = null, string familyLabel = null, string version = null, string label = null, bool? isDefault = null, bool? isActive = null) { - return new CloudServiceOSVersionData(id, name, resourceType, systemData, location, family, familyLabel, version, label, isDefault, isActive); + return new CloudServiceOSVersionData(id, name, resourceType, systemData, location, family, familyLabel, version, label, isDefault, isActive, default); } - /// Initializes a new instance of CloudServiceOSFamilyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2432,10 +2794,10 @@ public static CloudServiceOSFamilyData CloudServiceOSFamilyData(ResourceIdentifi { versions ??= new List(); - return new CloudServiceOSFamilyData(id, name, resourceType, systemData, resourceName, location, osFamilyName, label, versions?.ToList()); + return new CloudServiceOSFamilyData(id, name, resourceType, systemData, resourceName, location, osFamilyName, label, versions?.ToList(), default); } - /// Initializes a new instance of OSVersionPropertiesBase. + /// Initializes a new instance of . /// The OS version. /// The OS version label. /// Specifies whether this is the default OS version for its family. @@ -2443,7 +2805,7 @@ public static CloudServiceOSFamilyData CloudServiceOSFamilyData(ResourceIdentifi /// A new instance for mocking. public static OSVersionPropertiesBase OSVersionPropertiesBase(string version = null, string label = null, bool? isDefault = null, bool? isActive = null) { - return new OSVersionPropertiesBase(version, label, isDefault, isActive); + return new OSVersionPropertiesBase(version, label, isDefault, isActive, default); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs index 10613d9dc531..6a8170ab3135 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _availabilitySetRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _availabilitySetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), _availabilitySetClientDiagnostics, Pipeline, "AvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), _availabilitySetClientDiagnostics, Pipeline, "AvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _availabilitySetRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _availabilitySetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), _availabilitySetClientDiagnostics, Pipeline, "AvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), _availabilitySetClientDiagnostics, Pipeline, "AvailabilitySetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs index 728556f08aae..59d58f6c1080 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class AvailabilitySetData : TrackedResourceData { - /// Initializes a new instance of AvailabilitySetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AvailabilitySetData(AzureLocation location) : base(location) { @@ -27,7 +31,7 @@ public AvailabilitySetData(AzureLocation location) : base(location) Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of AvailabilitySetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +44,8 @@ public AvailabilitySetData(AzureLocation location) : base(location) /// A list of references to all virtual machines in the availability set. /// Specifies information about the proximity placement group that the availability set should be assigned to. Minimum api-version: 2018-04-01. /// The resource status information. - internal AvailabilitySetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, int? platformUpdateDomainCount, int? platformFaultDomainCount, IList virtualMachines, WritableSubResource proximityPlacementGroup, IReadOnlyList statuses) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AvailabilitySetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, int? platformUpdateDomainCount, int? platformFaultDomainCount, IList virtualMachines, WritableSubResource proximityPlacementGroup, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; PlatformUpdateDomainCount = platformUpdateDomainCount; @@ -48,6 +53,12 @@ internal AvailabilitySetData(ResourceIdentifier id, string name, ResourceType re VirtualMachines = virtualMachines; ProximityPlacementGroup = proximityPlacementGroup; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailabilitySetData() + { } /// Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs index 43387b870a11..94b28a8a5569 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _capacityReservationRestClient.CreateListByCapacityReservationGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capacityReservationRestClient.CreateListByCapacityReservationGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationResource(Client, CapacityReservationData.DeserializeCapacityReservationData(e)), _capacityReservationClientDiagnostics, Pipeline, "CapacityReservationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CapacityReservationResource(Client, CapacityReservationData.DeserializeCapacityReservationData(e)), _capacityReservationClientDiagnostics, Pipeline, "CapacityReservationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _capacityReservationRestClient.CreateListByCapacityReservationGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capacityReservationRestClient.CreateListByCapacityReservationGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationResource(Client, CapacityReservationData.DeserializeCapacityReservationData(e)), _capacityReservationClientDiagnostics, Pipeline, "CapacityReservationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CapacityReservationResource(Client, CapacityReservationData.DeserializeCapacityReservationData(e)), _capacityReservationClientDiagnostics, Pipeline, "CapacityReservationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationData.cs index 3c89fc7e9dcc..5068cae70bc5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class CapacityReservationData : TrackedResourceData { - /// Initializes a new instance of CapacityReservationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. /// is null. @@ -33,7 +36,7 @@ public CapacityReservationData(AzureLocation location, ComputeSku sku) : base(lo VirtualMachinesAssociated = new ChangeTrackingList(); } - /// Initializes a new instance of CapacityReservationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public CapacityReservationData(AzureLocation location, ComputeSku sku) : base(lo /// The provisioning state, which only appears in the response. /// The Capacity reservation instance view. /// Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. - internal CapacityReservationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, IList zones, string reservationId, int? platformFaultDomainCount, IReadOnlyList virtualMachinesAssociated, DateTimeOffset? provisioningOn, string provisioningState, CapacityReservationInstanceView instanceView, DateTimeOffset? timeCreated) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, IList zones, string reservationId, int? platformFaultDomainCount, IReadOnlyList virtualMachinesAssociated, DateTimeOffset? provisioningOn, string provisioningState, CapacityReservationInstanceView instanceView, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Zones = zones; @@ -60,6 +64,12 @@ internal CapacityReservationData(ResourceIdentifier id, string name, ResourceTyp ProvisioningState = provisioningState; InstanceView = instanceView; TimeCreated = timeCreated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CapacityReservationData() + { } /// SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs index 8a1d83c5082d..125424509ccb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(Capac { HttpMessage FirstPageRequest(int? pageSizeHint) => _capacityReservationGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capacityReservationGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), _capacityReservationGroupClientDiagnostics, Pipeline, "CapacityReservationGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), _capacityReservationGroupClientDiagnostics, Pipeline, "CapacityReservationGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,7 +256,7 @@ public virtual Pageable GetAll(CapacityReserva { HttpMessage FirstPageRequest(int? pageSizeHint) => _capacityReservationGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capacityReservationGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), _capacityReservationGroupClientDiagnostics, Pipeline, "CapacityReservationGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), _capacityReservationGroupClientDiagnostics, Pipeline, "CapacityReservationGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupData.cs index cf31a59536df..8cb4d831312b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class CapacityReservationGroupData : TrackedResourceData { - /// Initializes a new instance of CapacityReservationGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CapacityReservationGroupData(AzureLocation location) : base(location) { @@ -28,7 +32,7 @@ public CapacityReservationGroupData(AzureLocation location) : base(location) VirtualMachinesAssociated = new ChangeTrackingList(); } - /// Initializes a new instance of CapacityReservationGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,12 +43,19 @@ public CapacityReservationGroupData(AzureLocation location) : base(location) /// A list of all capacity reservation resource ids that belong to capacity reservation group. /// A list of references to all virtual machines associated to the capacity reservation group. /// The capacity reservation group instance view which has the list of instance views for all the capacity reservations that belong to the capacity reservation group. - internal CapacityReservationGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, IReadOnlyList capacityReservations, IReadOnlyList virtualMachinesAssociated, CapacityReservationGroupInstanceView instanceView) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, IReadOnlyList capacityReservations, IReadOnlyList virtualMachinesAssociated, CapacityReservationGroupInstanceView instanceView, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; CapacityReservations = capacityReservations; VirtualMachinesAssociated = virtualMachinesAssociated; InstanceView = instanceView; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CapacityReservationGroupData() + { } /// Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs index 8874b2fef025..6b0fc1948a79 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), _cloudServiceClientDiagnostics, Pipeline, "CloudServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), _cloudServiceClientDiagnostics, Pipeline, "CloudServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), _cloudServiceClientDiagnostics, Pipeline, "CloudServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), _cloudServiceClientDiagnostics, Pipeline, "CloudServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceData.cs index b9c4cae0185d..5afc53db5ba5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class CloudServiceData : TrackedResourceData { - /// Initializes a new instance of CloudServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CloudServiceData(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -62,7 +65,8 @@ public CloudServiceData(AzureLocation location) : base(location) /// Describes a cloud service extension profile. /// The provisioning state, which only appears in the response. /// The unique identifier for the cloud service. - internal CloudServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, Uri packageUri, string configuration, Uri configurationUri, bool? startCloudService, bool? allowModelOverride, CloudServiceUpgradeMode? upgradeMode, CloudServiceRoleProfile roleProfile, CloudServiceOSProfile osProfile, CloudServiceNetworkProfile networkProfile, CloudServiceExtensionProfile extensionProfile, string provisioningState, string uniqueId) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CloudServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, Uri packageUri, string configuration, Uri configurationUri, bool? startCloudService, bool? allowModelOverride, CloudServiceUpgradeMode? upgradeMode, CloudServiceRoleProfile roleProfile, CloudServiceOSProfile osProfile, CloudServiceNetworkProfile networkProfile, CloudServiceExtensionProfile extensionProfile, string provisioningState, string uniqueId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; PackageUri = packageUri; @@ -77,6 +81,12 @@ internal CloudServiceData(ResourceIdentifier id, string name, ResourceType resou ExtensionProfile = extensionProfile; ProvisioningState = provisioningState; UniqueId = uniqueId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CloudServiceData() + { } /// List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned. This field is optional. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs index c55b08c4c299..56e8d06e736d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyCollection.cs @@ -150,7 +150,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceOSFamilyCloudServiceOperatingSystemsRestClient.CreateListOSFamiliesRequest(Id.SubscriptionId, new AzureLocation(_location)); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceOSFamilyCloudServiceOperatingSystemsRestClient.CreateListOSFamiliesNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceOSFamilyResource(Client, CloudServiceOSFamilyData.DeserializeCloudServiceOSFamilyData(e)), _cloudServiceOSFamilyCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSFamilyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceOSFamilyResource(Client, CloudServiceOSFamilyData.DeserializeCloudServiceOSFamilyData(e)), _cloudServiceOSFamilyCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSFamilyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -172,7 +172,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceOSFamilyCloudServiceOperatingSystemsRestClient.CreateListOSFamiliesRequest(Id.SubscriptionId, new AzureLocation(_location)); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceOSFamilyCloudServiceOperatingSystemsRestClient.CreateListOSFamiliesNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceOSFamilyResource(Client, CloudServiceOSFamilyData.DeserializeCloudServiceOSFamilyData(e)), _cloudServiceOSFamilyCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSFamilyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceOSFamilyResource(Client, CloudServiceOSFamilyData.DeserializeCloudServiceOSFamilyData(e)), _cloudServiceOSFamilyCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSFamilyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyData.cs index 679dabf777d2..de9de4cc8bec 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class CloudServiceOSFamilyData : ResourceData { - /// Initializes a new instance of CloudServiceOSFamilyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudServiceOSFamilyData() { Versions = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceOSFamilyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,13 +38,15 @@ internal CloudServiceOSFamilyData() /// The OS family name. /// The OS family label. /// List of OS versions belonging to this family. - internal CloudServiceOSFamilyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string resourceName, AzureLocation? location, string osFamilyName, string label, IReadOnlyList versions) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CloudServiceOSFamilyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string resourceName, AzureLocation? location, string osFamilyName, string label, IReadOnlyList versions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ResourceName = resourceName; Location = location; OSFamilyName = osFamilyName; Label = label; Versions = versions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs index a32a62152c1b..6f67b06f4383 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionCollection.cs @@ -150,7 +150,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.CreateListOSVersionsRequest(Id.SubscriptionId, new AzureLocation(_location)); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.CreateListOSVersionsNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceOSVersionResource(Client, CloudServiceOSVersionData.DeserializeCloudServiceOSVersionData(e)), _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceOSVersionResource(Client, CloudServiceOSVersionData.DeserializeCloudServiceOSVersionData(e)), _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -172,7 +172,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.CreateListOSVersionsRequest(Id.SubscriptionId, new AzureLocation(_location)); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceOSVersionCloudServiceOperatingSystemsRestClient.CreateListOSVersionsNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceOSVersionResource(Client, CloudServiceOSVersionData.DeserializeCloudServiceOSVersionData(e)), _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceOSVersionResource(Client, CloudServiceOSVersionData.DeserializeCloudServiceOSVersionData(e)), _cloudServiceOSVersionCloudServiceOperatingSystemsClientDiagnostics, Pipeline, "CloudServiceOSVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionData.cs index 9b2ae0190595..b56ad76e94b0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.Compute /// public partial class CloudServiceOSVersionData : ResourceData { - /// Initializes a new instance of CloudServiceOSVersionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudServiceOSVersionData() { } - /// Initializes a new instance of CloudServiceOSVersionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +38,8 @@ internal CloudServiceOSVersionData() /// The OS version label. /// Specifies whether this is the default OS version for its family. /// Specifies whether this OS version is active. - internal CloudServiceOSVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string family, string familyLabel, string version, string label, bool? isDefault, bool? isActive) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CloudServiceOSVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string family, string familyLabel, string version, string label, bool? isDefault, bool? isActive, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Family = family; @@ -42,6 +48,7 @@ internal CloudServiceOSVersionData(ResourceIdentifier id, string name, ResourceT Label = label; IsDefault = isDefault; IsActive = isActive; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource location. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs index b6030e8ffde0..041ce70e78c3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceRoleRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceRoleRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceRoleResource(Client, CloudServiceRoleData.DeserializeCloudServiceRoleData(e)), _cloudServiceRoleClientDiagnostics, Pipeline, "CloudServiceRoleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceRoleResource(Client, CloudServiceRoleData.DeserializeCloudServiceRoleData(e)), _cloudServiceRoleClientDiagnostics, Pipeline, "CloudServiceRoleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceRoleRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceRoleRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceRoleResource(Client, CloudServiceRoleData.DeserializeCloudServiceRoleData(e)), _cloudServiceRoleClientDiagnostics, Pipeline, "CloudServiceRoleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceRoleResource(Client, CloudServiceRoleData.DeserializeCloudServiceRoleData(e)), _cloudServiceRoleClientDiagnostics, Pipeline, "CloudServiceRoleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleData.cs index cbcd8f8eb1fe..047bab1620e9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.Compute /// public partial class CloudServiceRoleData : ResourceData { - /// Initializes a new instance of CloudServiceRoleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudServiceRoleData() { } - /// Initializes a new instance of CloudServiceRoleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +35,13 @@ internal CloudServiceRoleData() /// Resource location. /// Describes the cloud service role sku. /// Specifies the ID which uniquely identifies a cloud service role. - internal CloudServiceRoleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, CloudServiceRoleSku sku, string uniqueId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CloudServiceRoleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, CloudServiceRoleSku sku, string uniqueId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Sku = sku; UniqueId = uniqueId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource location. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs index 02114cebbbe3..9002254d9426 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceCollection.cs @@ -150,7 +150,7 @@ public virtual AsyncPageable GetAllAsync(Insta { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceRoleInstanceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceRoleInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceRoleInstanceResource(Client, CloudServiceRoleInstanceData.DeserializeCloudServiceRoleInstanceData(e)), _cloudServiceRoleInstanceClientDiagnostics, Pipeline, "CloudServiceRoleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceRoleInstanceResource(Client, CloudServiceRoleInstanceData.DeserializeCloudServiceRoleInstanceData(e)), _cloudServiceRoleInstanceClientDiagnostics, Pipeline, "CloudServiceRoleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -173,7 +173,7 @@ public virtual Pageable GetAll(InstanceViewTyp { HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudServiceRoleInstanceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudServiceRoleInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceRoleInstanceResource(Client, CloudServiceRoleInstanceData.DeserializeCloudServiceRoleInstanceData(e)), _cloudServiceRoleInstanceClientDiagnostics, Pipeline, "CloudServiceRoleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceRoleInstanceResource(Client, CloudServiceRoleInstanceData.DeserializeCloudServiceRoleInstanceData(e)), _cloudServiceRoleInstanceClientDiagnostics, Pipeline, "CloudServiceRoleInstanceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceData.cs index 9d8bdd572308..4a4700fa84d8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Compute /// public partial class CloudServiceRoleInstanceData : ResourceData { - /// Initializes a new instance of CloudServiceRoleInstanceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudServiceRoleInstanceData() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CloudServiceRoleInstanceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +39,15 @@ internal CloudServiceRoleInstanceData() /// The role instance SKU. /// Describes the network profile for the role instance. /// The instance view of the role instance. - internal CloudServiceRoleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IReadOnlyDictionary tags, InstanceSku sku, RoleInstanceNetworkProfile networkProfile, RoleInstanceView instanceView) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CloudServiceRoleInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IReadOnlyDictionary tags, InstanceSku sku, RoleInstanceNetworkProfile networkProfile, RoleInstanceView instanceView, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Tags = tags; Sku = sku; NetworkProfile = networkProfile; InstanceView = instanceView; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Location. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryData.cs index 6190038592ec..5c1a88a0e1ee 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -16,17 +18,18 @@ namespace Azure.ResourceManager.Compute /// public partial class CommunityGalleryData : PirCommunityGalleryResourceData { - /// Initializes a new instance of CommunityGalleryData. + /// Initializes a new instance of . internal CommunityGalleryData() { } - /// Initializes a new instance of CommunityGalleryData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. /// The unique id of this community gallery. - internal CommunityGalleryData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId) : base(name, location, resourceType, uniqueId) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId, Dictionary serializedAdditionalRawData) : base(name, location, resourceType, uniqueId, serializedAdditionalRawData) { } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs index 2ae3eaa1ae55..bd933548357d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageCollection.cs @@ -148,7 +148,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _communityGalleryImageRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communityGalleryImageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunityGalleryImageResource(Client, CommunityGalleryImageData.DeserializeCommunityGalleryImageData(e)), _communityGalleryImageClientDiagnostics, Pipeline, "CommunityGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunityGalleryImageResource(Client, CommunityGalleryImageData.DeserializeCommunityGalleryImageData(e)), _communityGalleryImageClientDiagnostics, Pipeline, "CommunityGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _communityGalleryImageRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communityGalleryImageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunityGalleryImageResource(Client, CommunityGalleryImageData.DeserializeCommunityGalleryImageData(e)), _communityGalleryImageClientDiagnostics, Pipeline, "CommunityGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunityGalleryImageResource(Client, CommunityGalleryImageData.DeserializeCommunityGalleryImageData(e)), _communityGalleryImageClientDiagnostics, Pipeline, "CommunityGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageData.cs index 9debf25c34a6..3a647889b318 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageData.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.Compute /// public partial class CommunityGalleryImageData : PirCommunityGalleryResourceData { - /// Initializes a new instance of CommunityGalleryImageData. + /// Initializes a new instance of . internal CommunityGalleryImageData() { Features = new ChangeTrackingList(); } - /// Initializes a new instance of CommunityGalleryImageData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. @@ -41,7 +41,8 @@ internal CommunityGalleryImageData() /// The architecture of the image. Applicable to OS disks only. /// Privacy statement uri for the current community gallery image. /// End-user license agreement for the current community gallery image. - internal CommunityGalleryImageData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, DateTimeOffset? endOfLifeOn, CommunityGalleryImageIdentifier imageIdentifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, HyperVGeneration? hyperVGeneration, IReadOnlyList features, ImagePurchasePlan purchasePlan, ArchitectureType? architecture, Uri privacyStatementUri, string eula) : base(name, location, resourceType, uniqueId) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryImageData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, DateTimeOffset? endOfLifeOn, CommunityGalleryImageIdentifier imageIdentifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, HyperVGeneration? hyperVGeneration, IReadOnlyList features, ImagePurchasePlan purchasePlan, ArchitectureType? architecture, Uri privacyStatementUri, string eula, Dictionary serializedAdditionalRawData) : base(name, location, resourceType, uniqueId, serializedAdditionalRawData) { OSType = osType; OSState = osState; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs index f1f8c9f04391..f4c4aec067c3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionCollection.cs @@ -148,7 +148,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _communityGalleryImageVersionRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communityGalleryImageVersionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunityGalleryImageVersionResource(Client, CommunityGalleryImageVersionData.DeserializeCommunityGalleryImageVersionData(e)), _communityGalleryImageVersionClientDiagnostics, Pipeline, "CommunityGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunityGalleryImageVersionResource(Client, CommunityGalleryImageVersionData.DeserializeCommunityGalleryImageVersionData(e)), _communityGalleryImageVersionClientDiagnostics, Pipeline, "CommunityGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _communityGalleryImageVersionRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _communityGalleryImageVersionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunityGalleryImageVersionResource(Client, CommunityGalleryImageVersionData.DeserializeCommunityGalleryImageVersionData(e)), _communityGalleryImageVersionClientDiagnostics, Pipeline, "CommunityGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CommunityGalleryImageVersionResource(Client, CommunityGalleryImageVersionData.DeserializeCommunityGalleryImageVersionData(e)), _communityGalleryImageVersionClientDiagnostics, Pipeline, "CommunityGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionData.cs index 09f380d230c9..a1c45e878764 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -17,12 +18,12 @@ namespace Azure.ResourceManager.Compute /// public partial class CommunityGalleryImageVersionData : PirCommunityGalleryResourceData { - /// Initializes a new instance of CommunityGalleryImageVersionData. + /// Initializes a new instance of . internal CommunityGalleryImageVersionData() { } - /// Initializes a new instance of CommunityGalleryImageVersionData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. @@ -31,7 +32,8 @@ internal CommunityGalleryImageVersionData() /// The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. /// Describes the storage profile of the image version. - internal CommunityGalleryImageVersionData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, bool? isExcludedFromLatest, SharedGalleryImageVersionStorageProfile storageProfile) : base(name, location, resourceType, uniqueId) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryImageVersionData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, bool? isExcludedFromLatest, SharedGalleryImageVersionStorageProfile storageProfile, Dictionary serializedAdditionalRawData) : base(name, location, resourceType, uniqueId, serializedAdditionalRawData) { PublishedOn = publishedOn; EndOfLifeOn = endOfLifeOn; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs index fc35fcbe7008..8b02ff2a2abf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _computePrivateEndpointConnectionDiskAccessesRestClient.CreateListPrivateEndpointConnectionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _computePrivateEndpointConnectionDiskAccessesRestClient.CreateListPrivateEndpointConnectionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ComputePrivateEndpointConnectionResource(Client, ComputePrivateEndpointConnectionData.DeserializeComputePrivateEndpointConnectionData(e)), _computePrivateEndpointConnectionDiskAccessesClientDiagnostics, Pipeline, "ComputePrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ComputePrivateEndpointConnectionResource(Client, ComputePrivateEndpointConnectionData.DeserializeComputePrivateEndpointConnectionData(e)), _computePrivateEndpointConnectionDiskAccessesClientDiagnostics, Pipeline, "ComputePrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _computePrivateEndpointConnectionDiskAccessesRestClient.CreateListPrivateEndpointConnectionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _computePrivateEndpointConnectionDiskAccessesRestClient.CreateListPrivateEndpointConnectionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ComputePrivateEndpointConnectionResource(Client, ComputePrivateEndpointConnectionData.DeserializeComputePrivateEndpointConnectionData(e)), _computePrivateEndpointConnectionDiskAccessesClientDiagnostics, Pipeline, "ComputePrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ComputePrivateEndpointConnectionResource(Client, ComputePrivateEndpointConnectionData.DeserializeComputePrivateEndpointConnectionData(e)), _computePrivateEndpointConnectionDiskAccessesClientDiagnostics, Pipeline, "ComputePrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionData.cs index 4f33e4108022..501e65ac4705 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.Compute /// public partial class ComputePrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of ComputePrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputePrivateEndpointConnectionData() { } - /// Initializes a new instance of ComputePrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public ComputePrivateEndpointConnectionData() /// The resource of private end point. /// A collection of information about the state of the connection between DiskAccess and Virtual Network. /// The provisioning state of the private endpoint connection resource. - internal ComputePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, ComputePrivateLinkServiceConnectionState connectionState, ComputePrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ComputePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, ComputePrivateLinkServiceConnectionState connectionState, ComputePrivateEndpointConnectionProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of private end point. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs index da720f00283a..c7554167512e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHostRestClient.CreateListByHostGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHostRestClient.CreateListByHostGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostResource(Client, DedicatedHostData.DeserializeDedicatedHostData(e)), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DedicatedHostResource(Client, DedicatedHostData.DeserializeDedicatedHostData(e)), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHostRestClient.CreateListByHostGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHostRestClient.CreateListByHostGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostResource(Client, DedicatedHostData.DeserializeDedicatedHostData(e)), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DedicatedHostResource(Client, DedicatedHostData.DeserializeDedicatedHostData(e)), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs index 1039d00f0dad..1f6f61d0fad3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class DedicatedHostData : TrackedResourceData { - /// Initializes a new instance of DedicatedHostData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. /// is null. @@ -32,7 +35,7 @@ public DedicatedHostData(AzureLocation location, ComputeSku sku) : base(location VirtualMachines = new ChangeTrackingList(); } - /// Initializes a new instance of DedicatedHostData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public DedicatedHostData(AzureLocation location, ComputeSku sku) : base(location /// The provisioning state, which only appears in the response. /// The dedicated host instance view. /// Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01. - internal DedicatedHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, int? platformFaultDomain, bool? autoReplaceOnFailure, string hostId, IReadOnlyList virtualMachines, DedicatedHostLicenseType? licenseType, DateTimeOffset? provisioningOn, string provisioningState, DedicatedHostInstanceView instanceView, DateTimeOffset? timeCreated) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, int? platformFaultDomain, bool? autoReplaceOnFailure, string hostId, IReadOnlyList virtualMachines, DedicatedHostLicenseType? licenseType, DateTimeOffset? provisioningOn, string provisioningState, DedicatedHostInstanceView instanceView, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; PlatformFaultDomain = platformFaultDomain; @@ -61,6 +65,12 @@ internal DedicatedHostData(ResourceIdentifier id, string name, ResourceType reso ProvisioningState = provisioningState; InstanceView = instanceView; TimeCreated = timeCreated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DedicatedHostData() + { } /// SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs index 8b03b4bae58a..9a05b73f20cd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHostGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHostGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), _dedicatedHostGroupClientDiagnostics, Pipeline, "DedicatedHostGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), _dedicatedHostGroupClientDiagnostics, Pipeline, "DedicatedHostGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHostGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHostGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), _dedicatedHostGroupClientDiagnostics, Pipeline, "DedicatedHostGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), _dedicatedHostGroupClientDiagnostics, Pipeline, "DedicatedHostGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs index 2ba029a6a23e..2c21948d04d0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class DedicatedHostGroupData : TrackedResourceData { - /// Initializes a new instance of DedicatedHostGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DedicatedHostGroupData(AzureLocation location) : base(location) { @@ -27,7 +31,7 @@ public DedicatedHostGroupData(AzureLocation location) : base(location) DedicatedHosts = new ChangeTrackingList(); } - /// Initializes a new instance of DedicatedHostGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +44,8 @@ public DedicatedHostGroupData(AzureLocation location) : base(location) /// The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. /// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. Minimum api-version: 2020-06-01. /// Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01. - internal DedicatedHostGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, int? platformFaultDomainCount, IReadOnlyList dedicatedHosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement, DedicatedHostGroupPropertiesAdditionalCapabilities additionalCapabilities) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, int? platformFaultDomainCount, IReadOnlyList dedicatedHosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement, DedicatedHostGroupPropertiesAdditionalCapabilities additionalCapabilities, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; PlatformFaultDomainCount = platformFaultDomainCount; @@ -48,6 +53,12 @@ internal DedicatedHostGroupData(ResourceIdentifier id, string name, ResourceType InstanceView = instanceView; SupportAutomaticPlacement = supportAutomaticPlacement; AdditionalCapabilities = additionalCapabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DedicatedHostGroupData() + { } /// Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs index bd8b1f8535bd..d744887b03a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs @@ -385,7 +385,7 @@ public virtual ArmOperation Restart(WaitUntil waitUntil, CancellationToken cance public virtual AsyncPageable GetAvailableSizesAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHostRestClient.CreateListAvailableSizesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostResource.GetAvailableSizes", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => e.GetString(), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostResource.GetAvailableSizes", "value", null, cancellationToken); } /// @@ -406,7 +406,7 @@ public virtual AsyncPageable GetAvailableSizesAsync(CancellationToken ca public virtual Pageable GetAvailableSizes(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHostRestClient.CreateListAvailableSizesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostResource.GetAvailableSizes", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => e.GetString(), _dedicatedHostClientDiagnostics, Pipeline, "DedicatedHostResource.GetAvailableSizes", "value", null, cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs index b5fc9351df6b..23b1ac2e1aec 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskAccessRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskAccessRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), _diskAccessClientDiagnostics, Pipeline, "DiskAccessCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), _diskAccessClientDiagnostics, Pipeline, "DiskAccessCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskAccessRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskAccessRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), _diskAccessClientDiagnostics, Pipeline, "DiskAccessCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), _diskAccessClientDiagnostics, Pipeline, "DiskAccessCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessData.cs index 89b343c7d94a..0d3989da0056 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class DiskAccessData : TrackedResourceData { - /// Initializes a new instance of DiskAccessData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DiskAccessData(AzureLocation location) : base(location) { PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of DiskAccessData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,12 +40,19 @@ public DiskAccessData(AzureLocation location) : base(location) /// A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. /// The disk access resource provisioning state. /// The time when the disk access was created. - internal DiskAccessData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, IReadOnlyList privateEndpointConnections, string provisioningState, DateTimeOffset? timeCreated) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DiskAccessData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, IReadOnlyList privateEndpointConnections, string provisioningState, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; PrivateEndpointConnections = privateEndpointConnections; ProvisioningState = provisioningState; TimeCreated = timeCreated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskAccessData() + { } /// The extended location where the disk access will be created. Extended location cannot be changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs index 22e7b030e0cf..20dd75d395a2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskEncryptionSetRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskEncryptionSetRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskEncryptionSetRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskEncryptionSetRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetData.cs index 2b24088a6791..fa6e8d0ccbf9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class DiskEncryptionSetData : TrackedResourceData { - /// Initializes a new instance of DiskEncryptionSetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DiskEncryptionSetData(AzureLocation location) : base(location) { PreviousKeys = new ChangeTrackingList(); } - /// Initializes a new instance of DiskEncryptionSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +45,8 @@ public DiskEncryptionSetData(AzureLocation location) : base(location) /// The time when the active key of this disk encryption set was updated. /// The error that was encountered during auto-key rotation. If an error is present, then auto-key rotation will not be attempted until the error on this disk encryption set is fixed. /// Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the property. - internal DiskEncryptionSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, DiskEncryptionSetType? encryptionType, KeyForDiskEncryptionSet activeKey, IReadOnlyList previousKeys, string provisioningState, bool? rotationToLatestKeyVersionEnabled, DateTimeOffset? lastKeyRotationTimestamp, ComputeApiError autoKeyRotationError, string federatedClientId) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DiskEncryptionSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, DiskEncryptionSetType? encryptionType, KeyForDiskEncryptionSet activeKey, IReadOnlyList previousKeys, string provisioningState, bool? rotationToLatestKeyVersionEnabled, DateTimeOffset? lastKeyRotationTimestamp, ComputeApiError autoKeyRotationError, string federatedClientId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; EncryptionType = encryptionType; @@ -53,6 +57,12 @@ internal DiskEncryptionSetData(ResourceIdentifier id, string name, ResourceType LastKeyRotationTimestamp = lastKeyRotationTimestamp; AutoKeyRotationError = autoKeyRotationError; FederatedClientId = federatedClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskEncryptionSetData() + { } /// The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs index 2dc14cd3ab92..7663535771c1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs @@ -317,7 +317,7 @@ public virtual AsyncPageable GetAssociatedResourcesAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskEncryptionSetRestClient.CreateListAssociatedResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskEncryptionSetRestClient.CreateListAssociatedResourcesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => e.GetString(), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetResource.GetAssociatedResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => e.GetString(), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetResource.GetAssociatedResources", "value", "nextLink", cancellationToken); } /// @@ -339,7 +339,7 @@ public virtual Pageable GetAssociatedResources(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskEncryptionSetRestClient.CreateListAssociatedResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskEncryptionSetRestClient.CreateListAssociatedResourcesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => e.GetString(), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetResource.GetAssociatedResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => e.GetString(), _diskEncryptionSetClientDiagnostics, Pipeline, "DiskEncryptionSetResource.GetAssociatedResources", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs index bd0511cd1c3f..7d750d875554 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskImageImagesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskImageImagesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), _diskImageImagesClientDiagnostics, Pipeline, "DiskImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), _diskImageImagesClientDiagnostics, Pipeline, "DiskImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(CancellationToken cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskImageImagesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskImageImagesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), _diskImageImagesClientDiagnostics, Pipeline, "DiskImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), _diskImageImagesClientDiagnostics, Pipeline, "DiskImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageData.cs index e8f350801931..233da34a0b22 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Compute /// public partial class DiskImageData : TrackedResourceData { - /// Initializes a new instance of DiskImageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DiskImageData(AzureLocation location) : base(location) { } - /// Initializes a new instance of DiskImageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,13 +41,20 @@ public DiskImageData(AzureLocation location) : base(location) /// Specifies the storage settings for the virtual machine disks. /// The provisioning state. /// Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. - internal DiskImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, WritableSubResource sourceVirtualMachine, ImageStorageProfile storageProfile, string provisioningState, HyperVGeneration? hyperVGeneration) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DiskImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, WritableSubResource sourceVirtualMachine, ImageStorageProfile storageProfile, string provisioningState, HyperVGeneration? hyperVGeneration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; SourceVirtualMachine = sourceVirtualMachine; StorageProfile = storageProfile; ProvisioningState = provisioningState; HyperVGeneration = hyperVGeneration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskImageData() + { } /// The extended location of the Image. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs index dadf53ca3297..6d050d055a27 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskRestorePointRestClient.CreateListByRestorePointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskRestorePointRestClient.CreateListByRestorePointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskRestorePointResource(Client, DiskRestorePointData.DeserializeDiskRestorePointData(e)), _diskRestorePointClientDiagnostics, Pipeline, "DiskRestorePointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskRestorePointResource(Client, DiskRestorePointData.DeserializeDiskRestorePointData(e)), _diskRestorePointClientDiagnostics, Pipeline, "DiskRestorePointCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _diskRestorePointRestClient.CreateListByRestorePointRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _diskRestorePointRestClient.CreateListByRestorePointNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskRestorePointResource(Client, DiskRestorePointData.DeserializeDiskRestorePointData(e)), _diskRestorePointClientDiagnostics, Pipeline, "DiskRestorePointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskRestorePointResource(Client, DiskRestorePointData.DeserializeDiskRestorePointData(e)), _diskRestorePointClientDiagnostics, Pipeline, "DiskRestorePointCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointData.cs index a2220741b0c4..1546ca4daa04 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.Compute /// public partial class DiskRestorePointData : ResourceData { - /// Initializes a new instance of DiskRestorePointData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DiskRestorePointData() { } - /// Initializes a new instance of DiskRestorePointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ internal DiskRestorePointData() /// Replication state of disk restore point when source resource is from a different region. /// Location of source disk or source disk restore point when source resource is from a different region. /// Contains the security related information for the resource. - internal DiskRestorePointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? timeCreated, ResourceIdentifier sourceResourceId, SupportedOperatingSystemType? osType, HyperVGeneration? hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, string familyId, string sourceUniqueId, DiskEncryption encryption, bool? supportsHibernation, NetworkAccessPolicy? networkAccessPolicy, DiskPublicNetworkAccess? publicNetworkAccess, ResourceIdentifier diskAccessId, float? completionPercent, string replicationState, AzureLocation? sourceResourceLocation, DiskSecurityProfile securityProfile) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DiskRestorePointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? timeCreated, ResourceIdentifier sourceResourceId, SupportedOperatingSystemType? osType, HyperVGeneration? hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, string familyId, string sourceUniqueId, DiskEncryption encryption, bool? supportsHibernation, NetworkAccessPolicy? networkAccessPolicy, DiskPublicNetworkAccess? publicNetworkAccess, ResourceIdentifier diskAccessId, float? completionPercent, string replicationState, AzureLocation? sourceResourceLocation, DiskSecurityProfile securityProfile, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TimeCreated = timeCreated; SourceResourceId = sourceResourceId; @@ -64,6 +69,7 @@ internal DiskRestorePointData(ResourceIdentifier id, string name, ResourceType r ReplicationState = replicationState; SourceResourceLocation = sourceResourceLocation; SecurityProfile = securityProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The timestamp of restorePoint creation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index e4547c00bc68..3de28e2ee911 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -278,7 +278,7 @@ public virtual AsyncPageable GetVirtualMachineSc { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); } /// @@ -301,7 +301,7 @@ public virtual Pageable GetVirtualMachineScaleSe { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); } /// @@ -323,7 +323,7 @@ public virtual AsyncPageable GetVirtualMachineSc { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListAllRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); } /// @@ -345,7 +345,7 @@ public virtual Pageable GetVirtualMachineScaleSe { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListAllRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); } /// @@ -368,7 +368,7 @@ public virtual AsyncPageable GetVirtualMachinesByLocatio { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); } /// @@ -391,7 +391,7 @@ public virtual Pageable GetVirtualMachinesByLocation(Azu { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); } /// @@ -416,7 +416,7 @@ public virtual AsyncPageable GetVirtualMachinesAsync(str { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListAllRequest(Id.SubscriptionId, statusOnly, filter, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, statusOnly, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); } /// @@ -441,7 +441,7 @@ public virtual Pageable GetVirtualMachines(string status { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListAllRequest(Id.SubscriptionId, statusOnly, filter, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, statusOnly, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); } /// @@ -1012,7 +1012,7 @@ public virtual AsyncPageable GetAvailabilitySetsAsync(s { HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilitySetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilitySetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilitySets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilitySets", "value", "nextLink", cancellationToken); } /// @@ -1035,7 +1035,7 @@ public virtual Pageable GetAvailabilitySets(string expa { HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilitySetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilitySetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilitySets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilitySets", "value", "nextLink", cancellationToken); } /// @@ -1057,7 +1057,7 @@ public virtual AsyncPageable GetProximityPlacem { HttpMessage FirstPageRequest(int? pageSizeHint) => ProximityPlacementGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProximityPlacementGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); } /// @@ -1079,7 +1079,7 @@ public virtual Pageable GetProximityPlacementGr { HttpMessage FirstPageRequest(int? pageSizeHint) => ProximityPlacementGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProximityPlacementGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); } /// @@ -1101,7 +1101,7 @@ public virtual AsyncPageable GetDedicatedHostGroupsA { HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHostGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHostGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); } /// @@ -1123,7 +1123,7 @@ public virtual Pageable GetDedicatedHostGroups(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHostGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHostGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); } /// @@ -1145,7 +1145,7 @@ public virtual AsyncPageable GetSshPublicKeysAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => SshPublicKeyRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SshPublicKeyRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSshPublicKeys", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSshPublicKeys", "value", "nextLink", cancellationToken); } /// @@ -1167,7 +1167,7 @@ public virtual Pageable GetSshPublicKeys(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => SshPublicKeyRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SshPublicKeyRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSshPublicKeys", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSshPublicKeys", "value", "nextLink", cancellationToken); } /// @@ -1189,7 +1189,7 @@ public virtual AsyncPageable GetDiskImagesAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => DiskImageImagesRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskImageImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskImages", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskImages", "value", "nextLink", cancellationToken); } /// @@ -1211,7 +1211,7 @@ public virtual Pageable GetDiskImages(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => DiskImageImagesRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskImageImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskImages", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskImages", "value", "nextLink", cancellationToken); } /// @@ -1233,7 +1233,7 @@ public virtual AsyncPageable GetRestorePointGroupsAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorePointGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorePointGroups", "value", "nextLink", cancellationToken); } /// @@ -1255,7 +1255,7 @@ public virtual Pageable GetRestorePointGroups(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorePointGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorePointGroups", "value", "nextLink", cancellationToken); } /// @@ -1278,7 +1278,7 @@ public virtual AsyncPageable GetCapacityReserv { HttpMessage FirstPageRequest(int? pageSizeHint) => CapacityReservationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CapacityReservationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); } /// @@ -1301,7 +1301,7 @@ public virtual Pageable GetCapacityReservation { HttpMessage FirstPageRequest(int? pageSizeHint) => CapacityReservationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CapacityReservationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); } /// @@ -1577,7 +1577,7 @@ public virtual AsyncPageable GetManagedDisksAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedDiskDisksRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedDisks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedDisks", "value", "nextLink", cancellationToken); } /// @@ -1599,7 +1599,7 @@ public virtual Pageable GetManagedDisks(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedDiskDisksRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedDisks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedDisks", "value", "nextLink", cancellationToken); } /// @@ -1621,7 +1621,7 @@ public virtual AsyncPageable GetDiskAccessesAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => DiskAccessRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskAccessRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskAccesses", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskAccesses", "value", "nextLink", cancellationToken); } /// @@ -1643,7 +1643,7 @@ public virtual Pageable GetDiskAccesses(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => DiskAccessRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskAccessRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskAccesses", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskAccesses", "value", "nextLink", cancellationToken); } /// @@ -1665,7 +1665,7 @@ public virtual AsyncPageable GetDiskEncryptionSetsAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => DiskEncryptionSetRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskEncryptionSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); } /// @@ -1687,7 +1687,7 @@ public virtual Pageable GetDiskEncryptionSets(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => DiskEncryptionSetRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskEncryptionSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); } /// @@ -1709,7 +1709,7 @@ public virtual AsyncPageable GetSnapshotsAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => SnapshotRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSnapshots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSnapshots", "value", "nextLink", cancellationToken); } /// @@ -1731,7 +1731,7 @@ public virtual Pageable GetSnapshots(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => SnapshotRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSnapshots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSnapshots", "value", "nextLink", cancellationToken); } /// @@ -1801,7 +1801,7 @@ public virtual AsyncPageable GetGalleriesAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => GalleryRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGalleries", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGalleries", "value", "nextLink", cancellationToken); } /// @@ -1823,7 +1823,7 @@ public virtual Pageable GetGalleries(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => GalleryRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGalleries", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGalleries", "value", "nextLink", cancellationToken); } /// @@ -1845,7 +1845,7 @@ public virtual AsyncPageable GetCloudServicesAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => CloudServiceRestClient.CreateListAllRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudServiceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudServices", "value", "nextLink", cancellationToken); } /// @@ -1867,7 +1867,7 @@ public virtual Pageable GetCloudServices(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => CloudServiceRestClient.CreateListAllRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudServiceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudServices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudServices", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs index 449a98c298b3..0227676f306e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryApplicationRestClient.CreateListByGalleryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryApplicationRestClient.CreateListByGalleryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryApplicationResource(Client, GalleryApplicationData.DeserializeGalleryApplicationData(e)), _galleryApplicationClientDiagnostics, Pipeline, "GalleryApplicationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryApplicationResource(Client, GalleryApplicationData.DeserializeGalleryApplicationData(e)), _galleryApplicationClientDiagnostics, Pipeline, "GalleryApplicationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryApplicationRestClient.CreateListByGalleryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryApplicationRestClient.CreateListByGalleryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryApplicationResource(Client, GalleryApplicationData.DeserializeGalleryApplicationData(e)), _galleryApplicationClientDiagnostics, Pipeline, "GalleryApplicationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryApplicationResource(Client, GalleryApplicationData.DeserializeGalleryApplicationData(e)), _galleryApplicationClientDiagnostics, Pipeline, "GalleryApplicationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationData.cs index 9a2bc8669b48..0d8498ec2198 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class GalleryApplicationData : TrackedResourceData { - /// Initializes a new instance of GalleryApplicationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GalleryApplicationData(AzureLocation location) : base(location) { CustomActions = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryApplicationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +43,8 @@ public GalleryApplicationData(AzureLocation location) : base(location) /// The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. /// This property allows you to specify the supported type of the OS that application is built for. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. /// A list of custom actions that can be performed with all of the Gallery Application Versions within this Gallery Application. - internal GalleryApplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, DateTimeOffset? endOfLifeOn, SupportedOperatingSystemType? supportedOSType, IList customActions) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, DateTimeOffset? endOfLifeOn, SupportedOperatingSystemType? supportedOSType, IList customActions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Description = description; Eula = eula; @@ -49,6 +53,12 @@ internal GalleryApplicationData(ResourceIdentifier id, string name, ResourceType EndOfLifeOn = endOfLifeOn; SupportedOSType = supportedOSType; CustomActions = customActions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryApplicationData() + { } /// The description of this gallery Application Definition resource. This property is updatable. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs index 21722cf4d462..cc4bd633a189 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryApplicationVersionRestClient.CreateListByGalleryApplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryApplicationVersionRestClient.CreateListByGalleryApplicationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryApplicationVersionResource(Client, GalleryApplicationVersionData.DeserializeGalleryApplicationVersionData(e)), _galleryApplicationVersionClientDiagnostics, Pipeline, "GalleryApplicationVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryApplicationVersionResource(Client, GalleryApplicationVersionData.DeserializeGalleryApplicationVersionData(e)), _galleryApplicationVersionClientDiagnostics, Pipeline, "GalleryApplicationVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryApplicationVersionRestClient.CreateListByGalleryApplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryApplicationVersionRestClient.CreateListByGalleryApplicationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryApplicationVersionResource(Client, GalleryApplicationVersionData.DeserializeGalleryApplicationVersionData(e)), _galleryApplicationVersionClientDiagnostics, Pipeline, "GalleryApplicationVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryApplicationVersionResource(Client, GalleryApplicationVersionData.DeserializeGalleryApplicationVersionData(e)), _galleryApplicationVersionClientDiagnostics, Pipeline, "GalleryApplicationVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionData.cs index 20270d1b168a..d699d04868c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class GalleryApplicationVersionData : TrackedResourceData { - /// Initializes a new instance of GalleryApplicationVersionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GalleryApplicationVersionData(AzureLocation location) : base(location) { } - /// Initializes a new instance of GalleryApplicationVersionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +39,19 @@ public GalleryApplicationVersionData(AzureLocation location) : base(location) /// The safety profile of the Gallery Application Version. /// The provisioning state, which only appears in the response. /// This is the replication status of the gallery image version. - internal GalleryApplicationVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GalleryApplicationVersionPublishingProfile publishingProfile, GalleryApplicationVersionSafetyProfile safetyProfile, GalleryProvisioningState? provisioningState, ReplicationStatus replicationStatus) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GalleryApplicationVersionPublishingProfile publishingProfile, GalleryApplicationVersionSafetyProfile safetyProfile, GalleryProvisioningState? provisioningState, ReplicationStatus replicationStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { PublishingProfile = publishingProfile; SafetyProfile = safetyProfile; ProvisioningState = provisioningState; ReplicationStatus = replicationStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryApplicationVersionData() + { } /// The publishing profile of a gallery image version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs index 183a1d6e9ac2..aca3e180c24e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), _galleryClientDiagnostics, Pipeline, "GalleryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), _galleryClientDiagnostics, Pipeline, "GalleryCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,7 +256,7 @@ public virtual Pageable GetAll(CancellationToken cancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), _galleryClientDiagnostics, Pipeline, "GalleryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), _galleryClientDiagnostics, Pipeline, "GalleryCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryData.cs index 0d899cc8cd22..0f357cc4cb98 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class GalleryData : TrackedResourceData { - /// Initializes a new instance of GalleryData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GalleryData(AzureLocation location) : base(location) { } - /// Initializes a new instance of GalleryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public GalleryData(AzureLocation location) : base(location) /// Profile for gallery sharing to subscription or tenant. /// Contains information about the soft deletion policy of the gallery. /// Sharing status of current gallery. - internal GalleryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, GalleryIdentifier identifier, GalleryProvisioningState? provisioningState, SharingProfile sharingProfile, SoftDeletePolicy softDeletePolicy, SharingStatus sharingStatus) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GalleryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, GalleryIdentifier identifier, GalleryProvisioningState? provisioningState, SharingProfile sharingProfile, SoftDeletePolicy softDeletePolicy, SharingStatus sharingStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Description = description; Identifier = identifier; @@ -45,6 +50,12 @@ internal GalleryData(ResourceIdentifier id, string name, ResourceType resourceTy SharingProfile = sharingProfile; SoftDeletePolicy = softDeletePolicy; SharingStatus = sharingStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryData() + { } /// The description of this Shared Image Gallery resource. This property is updatable. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs index 52ddd23de450..cd646b4fcd9e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryImageRestClient.CreateListByGalleryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryImageRestClient.CreateListByGalleryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryImageResource(Client, GalleryImageData.DeserializeGalleryImageData(e)), _galleryImageClientDiagnostics, Pipeline, "GalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryImageResource(Client, GalleryImageData.DeserializeGalleryImageData(e)), _galleryImageClientDiagnostics, Pipeline, "GalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryImageRestClient.CreateListByGalleryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryImageRestClient.CreateListByGalleryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryImageResource(Client, GalleryImageData.DeserializeGalleryImageData(e)), _galleryImageClientDiagnostics, Pipeline, "GalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryImageResource(Client, GalleryImageData.DeserializeGalleryImageData(e)), _galleryImageClientDiagnostics, Pipeline, "GalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageData.cs index a804f059690a..f09578fc2f46 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class GalleryImageData : TrackedResourceData { - /// Initializes a new instance of GalleryImageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GalleryImageData(AzureLocation location) : base(location) { Features = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryImageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +51,8 @@ public GalleryImageData(AzureLocation location) : base(location) /// The provisioning state, which only appears in the response. /// A list of gallery image features. /// The architecture of the image. Applicable to OS disks only. - internal GalleryImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, HyperVGeneration? hyperVGeneration, DateTimeOffset? endOfLifeOn, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, ImagePurchasePlan purchasePlan, GalleryProvisioningState? provisioningState, IList features, ArchitectureType? architecture) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GalleryImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, HyperVGeneration? hyperVGeneration, DateTimeOffset? endOfLifeOn, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, ImagePurchasePlan purchasePlan, GalleryProvisioningState? provisioningState, IList features, ArchitectureType? architecture, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Description = description; Eula = eula; @@ -65,6 +69,12 @@ internal GalleryImageData(ResourceIdentifier id, string name, ResourceType resou ProvisioningState = provisioningState; Features = features; Architecture = architecture; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryImageData() + { } /// The description of this gallery image definition resource. This property is updatable. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs index 8faf5344b6ad..84d9dbd66e05 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryImageVersionRestClient.CreateListByGalleryImageRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryImageVersionRestClient.CreateListByGalleryImageNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryImageVersionResource(Client, GalleryImageVersionData.DeserializeGalleryImageVersionData(e)), _galleryImageVersionClientDiagnostics, Pipeline, "GalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryImageVersionResource(Client, GalleryImageVersionData.DeserializeGalleryImageVersionData(e)), _galleryImageVersionClientDiagnostics, Pipeline, "GalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryImageVersionRestClient.CreateListByGalleryImageRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryImageVersionRestClient.CreateListByGalleryImageNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryImageVersionResource(Client, GalleryImageVersionData.DeserializeGalleryImageVersionData(e)), _galleryImageVersionClientDiagnostics, Pipeline, "GalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GalleryImageVersionResource(Client, GalleryImageVersionData.DeserializeGalleryImageVersionData(e)), _galleryImageVersionClientDiagnostics, Pipeline, "GalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionData.cs index 1412d63800b6..53a6caf53693 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class GalleryImageVersionData : TrackedResourceData { - /// Initializes a new instance of GalleryImageVersionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GalleryImageVersionData(AzureLocation location) : base(location) { } - /// Initializes a new instance of GalleryImageVersionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,13 +40,20 @@ public GalleryImageVersionData(AzureLocation location) : base(location) /// This is the storage profile of a Gallery Image Version. /// This is the safety profile of the Gallery Image Version. /// This is the replication status of the gallery image version. - internal GalleryImageVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GalleryImageVersionPublishingProfile publishingProfile, GalleryProvisioningState? provisioningState, GalleryImageVersionStorageProfile storageProfile, GalleryImageVersionSafetyProfile safetyProfile, ReplicationStatus replicationStatus) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GalleryImageVersionPublishingProfile publishingProfile, GalleryProvisioningState? provisioningState, GalleryImageVersionStorageProfile storageProfile, GalleryImageVersionSafetyProfile safetyProfile, ReplicationStatus replicationStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { PublishingProfile = publishingProfile; ProvisioningState = provisioningState; StorageProfile = storageProfile; SafetyProfile = safetyProfile; ReplicationStatus = replicationStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryImageVersionData() + { } /// The publishing profile of a gallery image Version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs index 7e5f6e5d54ca..c9363e364fd3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _managedDiskDisksRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedDiskDisksRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), _managedDiskDisksClientDiagnostics, Pipeline, "ManagedDiskCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), _managedDiskDisksClientDiagnostics, Pipeline, "ManagedDiskCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _managedDiskDisksRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedDiskDisksRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), _managedDiskDisksClientDiagnostics, Pipeline, "ManagedDiskCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), _managedDiskDisksClientDiagnostics, Pipeline, "ManagedDiskCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskData.cs index 71d01666e368..9239d4d3dd83 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class ManagedDiskData : TrackedResourceData { - /// Initializes a new instance of ManagedDiskData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ManagedDiskData(AzureLocation location) : base(location) { @@ -29,7 +32,7 @@ public ManagedDiskData(AzureLocation location) : base(location) ShareInfo = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedDiskData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -73,7 +76,8 @@ public ManagedDiskData(AzureLocation location) : base(location) /// Additional authentication requirements when exporting or uploading to a disk or snapshot. /// Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. /// The UTC time when the ownership state of the disk was last changed i.e., the time the disk was last attached or detached from a VM or the time when the VM to which the disk was attached was deallocated or started. - internal ManagedDiskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceIdentifier managedBy, IReadOnlyList managedByExtended, DiskSku sku, IList zones, ExtendedLocation extendedLocation, DateTimeOffset? timeCreated, SupportedOperatingSystemType? osType, HyperVGeneration? hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, DiskCreationData creationData, int? diskSizeGB, long? diskSizeBytes, string uniqueId, EncryptionSettingsGroup encryptionSettingsGroup, string provisioningState, long? diskIopsReadWrite, long? diskMBpsReadWrite, long? diskIopsReadOnly, long? diskMBpsReadOnly, DiskState? diskState, DiskEncryption encryption, int? maxShares, IReadOnlyList shareInfo, NetworkAccessPolicy? networkAccessPolicy, ResourceIdentifier diskAccessId, DateTimeOffset? burstingEnabledOn, string tier, bool? burstingEnabled, PropertyUpdatesInProgress propertyUpdatesInProgress, bool? supportsHibernation, DiskSecurityProfile securityProfile, float? completionPercent, DiskPublicNetworkAccess? publicNetworkAccess, DataAccessAuthMode? dataAccessAuthMode, bool? isOptimizedForFrequentAttach, DateTimeOffset? lastOwnershipUpdateOn) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ManagedDiskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceIdentifier managedBy, IReadOnlyList managedByExtended, DiskSku sku, IList zones, ExtendedLocation extendedLocation, DateTimeOffset? timeCreated, SupportedOperatingSystemType? osType, HyperVGeneration? hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, DiskCreationData creationData, int? diskSizeGB, long? diskSizeBytes, string uniqueId, EncryptionSettingsGroup encryptionSettingsGroup, string provisioningState, long? diskIopsReadWrite, long? diskMBpsReadWrite, long? diskIopsReadOnly, long? diskMBpsReadOnly, DiskState? diskState, DiskEncryption encryption, int? maxShares, IReadOnlyList shareInfo, NetworkAccessPolicy? networkAccessPolicy, ResourceIdentifier diskAccessId, DateTimeOffset? burstingEnabledOn, string tier, bool? burstingEnabled, PropertyUpdatesInProgress propertyUpdatesInProgress, bool? supportsHibernation, DiskSecurityProfile securityProfile, float? completionPercent, DiskPublicNetworkAccess? publicNetworkAccess, DataAccessAuthMode? dataAccessAuthMode, bool? isOptimizedForFrequentAttach, DateTimeOffset? lastOwnershipUpdateOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ManagedBy = managedBy; ManagedByExtended = managedByExtended; @@ -112,6 +116,12 @@ internal ManagedDiskData(ResourceIdentifier id, string name, ResourceType resour DataAccessAuthMode = dataAccessAuthMode; IsOptimizedForFrequentAttach = isOptimizedForFrequentAttach; LastOwnershipUpdateOn = lastOwnershipUpdateOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedDiskData() + { } /// A relative URI containing the ID of the VM that has the disk attached. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.Serialization.cs index 4478239ad876..832abd59fa98 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class AccessUri + public partial class AccessUri : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AccessUri DeserializeAccessUri(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AccessUri DeserializeAccessUri(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional accessSas = default; Optional securityDataAccessSas = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accessSAS"u8)) @@ -32,8 +61,61 @@ internal static AccessUri DeserializeAccessUri(JsonElement element) securityDataAccessSas = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AccessUri(accessSas.Value, securityDataAccessSas.Value); + return new AccessUri(accessSas.Value, securityDataAccessSas.Value, serializedAdditionalRawData); + } + + AccessUri IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAccessUri(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AccessUri IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAccessUri(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AccessUri model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AccessUri(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAccessUri(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.cs index 12f8ed145a46..1ae2409115b5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AccessUri.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// A disk access SAS uri. public partial class AccessUri { - /// Initializes a new instance of AccessUri. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AccessUri() { } - /// Initializes a new instance of AccessUri. + /// Initializes a new instance of . /// A SAS uri for accessing a disk. /// A SAS uri for accessing a VM guest state. - internal AccessUri(string accessSas, string securityDataAccessSas) + /// Keeps track of any properties unknown to the library. + internal AccessUri(string accessSas, string securityDataAccessSas, Dictionary serializedAdditionalRawData) { AccessSas = accessSas; SecurityDataAccessSas = securityDataAccessSas; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A SAS uri for accessing a disk. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.Serialization.cs index 331c5eb2a1c6..beaf2d8ba77a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class AdditionalCapabilities : IUtf8JsonSerializable + public partial class AdditionalCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UltraSsdEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("hibernationEnabled"u8); writer.WriteBooleanValue(HibernationEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AdditionalCapabilities DeserializeAdditionalCapabilities(JsonElement element) + internal static AdditionalCapabilities DeserializeAdditionalCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ultraSsdEnabled = default; Optional hibernationEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ultraSSDEnabled"u8)) @@ -56,8 +79,61 @@ internal static AdditionalCapabilities DeserializeAdditionalCapabilities(JsonEle hibernationEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AdditionalCapabilities(Optional.ToNullable(ultraSsdEnabled), Optional.ToNullable(hibernationEnabled), serializedAdditionalRawData); + } + + AdditionalCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAdditionalCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AdditionalCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAdditionalCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AdditionalCapabilities model) + { + if (model is null) + { + return null; } - return new AdditionalCapabilities(Optional.ToNullable(ultraSsdEnabled), Optional.ToNullable(hibernationEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AdditionalCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAdditionalCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.cs index 19ae1bd9316d..9e3cdda73609 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalCapabilities.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Enables or disables a capability on the virtual machine or virtual machine scale set. public partial class AdditionalCapabilities { - /// Initializes a new instance of AdditionalCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AdditionalCapabilities() { } - /// Initializes a new instance of AdditionalCapabilities. + /// Initializes a new instance of . /// The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. /// The flag that enables or disables hibernation capability on the VM. - internal AdditionalCapabilities(bool? ultraSsdEnabled, bool? hibernationEnabled) + /// Keeps track of any properties unknown to the library. + internal AdditionalCapabilities(bool? ultraSsdEnabled, bool? hibernationEnabled, Dictionary serializedAdditionalRawData) { UltraSsdEnabled = ultraSsdEnabled; HibernationEnabled = hibernationEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.Serialization.cs index 52b9b5b332af..fa0df9aab5d8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class AdditionalUnattendContent : IUtf8JsonSerializable + public partial class AdditionalUnattendContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PassName)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("content"u8); writer.WriteStringValue(Content); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AdditionalUnattendContent DeserializeAdditionalUnattendContent(JsonElement element) + internal static AdditionalUnattendContent DeserializeAdditionalUnattendContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static AdditionalUnattendContent DeserializeAdditionalUnattendContent(J Optional componentName = default; Optional settingName = default; Optional content = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("passName"u8)) @@ -82,8 +105,61 @@ internal static AdditionalUnattendContent DeserializeAdditionalUnattendContent(J content = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AdditionalUnattendContent(Optional.ToNullable(passName), Optional.ToNullable(componentName), Optional.ToNullable(settingName), content.Value, serializedAdditionalRawData); + } + + AdditionalUnattendContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAdditionalUnattendContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AdditionalUnattendContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAdditionalUnattendContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AdditionalUnattendContent model) + { + if (model is null) + { + return null; } - return new AdditionalUnattendContent(Optional.ToNullable(passName), Optional.ToNullable(componentName), Optional.ToNullable(settingName), content.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AdditionalUnattendContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAdditionalUnattendContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.cs index 10f81643e98a..4d8ef82377bc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AdditionalUnattendContent.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies additional XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, and the pass in which the content is applied. public partial class AdditionalUnattendContent { - /// Initializes a new instance of AdditionalUnattendContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AdditionalUnattendContent() { } - /// Initializes a new instance of AdditionalUnattendContent. + /// Initializes a new instance of . /// The pass name. Currently, the only allowable value is OobeSystem. /// The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. /// Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. /// Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted. - internal AdditionalUnattendContent(PassName? passName, ComponentName? componentName, SettingName? settingName, string content) + /// Keeps track of any properties unknown to the library. + internal AdditionalUnattendContent(PassName? passName, ComponentName? componentName, SettingName? settingName, string content, Dictionary serializedAdditionalRawData) { PassName = passName; ComponentName = componentName; SettingName = settingName; Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The pass name. Currently, the only allowable value is OobeSystem. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.Serialization.cs index 8af59d67468f..690424b7ce78 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class ApplicationProfile : IUtf8JsonSerializable + internal partial class ApplicationProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(GalleryApplications)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in GalleryApplications) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApplicationProfile DeserializeApplicationProfile(JsonElement element) + internal static ApplicationProfile DeserializeApplicationProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> galleryApplications = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("galleryApplications"u8)) @@ -52,8 +81,61 @@ internal static ApplicationProfile DeserializeApplicationProfile(JsonElement ele galleryApplications = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApplicationProfile(Optional.ToList(galleryApplications), serializedAdditionalRawData); + } + + ApplicationProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplicationProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplicationProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplicationProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplicationProfile(Response response) + { + if (response is null) + { + return null; } - return new ApplicationProfile(Optional.ToList(galleryApplications)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplicationProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.cs index 495dadd0d66e..6689780999da 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApplicationProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Contains the list of gallery applications that should be made available to the VM/VMSS. internal partial class ApplicationProfile { - /// Initializes a new instance of ApplicationProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApplicationProfile() { GalleryApplications = new ChangeTrackingList(); } - /// Initializes a new instance of ApplicationProfile. + /// Initializes a new instance of . /// Specifies the gallery applications that should be made available to the VM/VMSS. - internal ApplicationProfile(IList galleryApplications) + /// Keeps track of any properties unknown to the library. + internal ApplicationProfile(IList galleryApplications, Dictionary serializedAdditionalRawData) { GalleryApplications = galleryApplications; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the gallery applications that should be made available to the VM/VMSS. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.Serialization.cs index 8fc0efa88bd0..d93ef8cb40a5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class AutomaticOSUpgradePolicy : IUtf8JsonSerializable + public partial class AutomaticOSUpgradePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EnableAutomaticOSUpgrade)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("useRollingUpgradePolicy"u8); writer.WriteBooleanValue(UseRollingUpgradePolicy.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomaticOSUpgradePolicy DeserializeAutomaticOSUpgradePolicy(JsonElement element) + internal static AutomaticOSUpgradePolicy DeserializeAutomaticOSUpgradePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AutomaticOSUpgradePolicy DeserializeAutomaticOSUpgradePolicy(Jso Optional enableAutomaticOSUpgrade = default; Optional disableAutomaticRollback = default; Optional useRollingUpgradePolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enableAutomaticOSUpgrade"u8)) @@ -71,8 +94,61 @@ internal static AutomaticOSUpgradePolicy DeserializeAutomaticOSUpgradePolicy(Jso useRollingUpgradePolicy = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomaticOSUpgradePolicy(Optional.ToNullable(enableAutomaticOSUpgrade), Optional.ToNullable(disableAutomaticRollback), Optional.ToNullable(useRollingUpgradePolicy), serializedAdditionalRawData); + } + + AutomaticOSUpgradePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomaticOSUpgradePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomaticOSUpgradePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomaticOSUpgradePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomaticOSUpgradePolicy model) + { + if (model is null) + { + return null; } - return new AutomaticOSUpgradePolicy(Optional.ToNullable(enableAutomaticOSUpgrade), Optional.ToNullable(disableAutomaticRollback), Optional.ToNullable(useRollingUpgradePolicy)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomaticOSUpgradePolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomaticOSUpgradePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs index 7ab7ec525f72..c0a4633727e0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradePolicy.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The configuration parameters used for performing automatic OS upgrade. public partial class AutomaticOSUpgradePolicy { - /// Initializes a new instance of AutomaticOSUpgradePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomaticOSUpgradePolicy() { } - /// Initializes a new instance of AutomaticOSUpgradePolicy. + /// Initializes a new instance of . /// Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) is automatically set to false and cannot be set to true. /// Whether OS image rollback feature should be disabled. Default value is false. /// Indicates whether rolling upgrade policy should be used during Auto OS Upgrade. Default value is false. Auto OS Upgrade will fallback to the default policy if no policy is defined on the VMSS. - internal AutomaticOSUpgradePolicy(bool? enableAutomaticOSUpgrade, bool? disableAutomaticRollback, bool? useRollingUpgradePolicy) + /// Keeps track of any properties unknown to the library. + internal AutomaticOSUpgradePolicy(bool? enableAutomaticOSUpgrade, bool? disableAutomaticRollback, bool? useRollingUpgradePolicy, Dictionary serializedAdditionalRawData) { EnableAutomaticOSUpgrade = enableAutomaticOSUpgrade; DisableAutomaticRollback = disableAutomaticRollback; UseRollingUpgradePolicy = useRollingUpgradePolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) is automatically set to false and cannot be set to true. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.Serialization.cs index 0e639f991984..dcf05e351aa2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class AutomaticOSUpgradeProperties : IUtf8JsonSerializable + internal partial class AutomaticOSUpgradeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("automaticOSUpgradeSupported"u8); writer.WriteBooleanValue(AutomaticOSUpgradeSupported); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomaticOSUpgradeProperties DeserializeAutomaticOSUpgradeProperties(JsonElement element) + internal static AutomaticOSUpgradeProperties DeserializeAutomaticOSUpgradeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } bool automaticOSUpgradeSupported = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("automaticOSUpgradeSupported"u8)) @@ -34,8 +57,61 @@ internal static AutomaticOSUpgradeProperties DeserializeAutomaticOSUpgradeProper automaticOSUpgradeSupported = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomaticOSUpgradeProperties(automaticOSUpgradeSupported, serializedAdditionalRawData); + } + + AutomaticOSUpgradeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomaticOSUpgradeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomaticOSUpgradeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomaticOSUpgradeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomaticOSUpgradeProperties model) + { + if (model is null) + { + return null; } - return new AutomaticOSUpgradeProperties(automaticOSUpgradeSupported); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomaticOSUpgradeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomaticOSUpgradeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs index 6239c2750121..390de44fa304 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticOSUpgradeProperties.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes automatic OS upgrade properties on the image. internal partial class AutomaticOSUpgradeProperties { - /// Initializes a new instance of AutomaticOSUpgradeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies whether automatic OS upgrade is supported on the image. public AutomaticOSUpgradeProperties(bool automaticOSUpgradeSupported) { AutomaticOSUpgradeSupported = automaticOSUpgradeSupported; } + /// Initializes a new instance of . + /// Specifies whether automatic OS upgrade is supported on the image. + /// Keeps track of any properties unknown to the library. + internal AutomaticOSUpgradeProperties(bool automaticOSUpgradeSupported, Dictionary serializedAdditionalRawData) + { + AutomaticOSUpgradeSupported = automaticOSUpgradeSupported; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutomaticOSUpgradeProperties() + { + } + /// Specifies whether automatic OS upgrade is supported on the image. public bool AutomaticOSUpgradeSupported { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.Serialization.cs index de0f7d32ee61..8f5acc452228 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class AutomaticRepairsPolicy : IUtf8JsonSerializable + public partial class AutomaticRepairsPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Enabled)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("repairAction"u8); writer.WriteStringValue(RepairAction.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutomaticRepairsPolicy DeserializeAutomaticRepairsPolicy(JsonElement element) + internal static AutomaticRepairsPolicy DeserializeAutomaticRepairsPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AutomaticRepairsPolicy DeserializeAutomaticRepairsPolicy(JsonEle Optional enabled = default; Optional gracePeriod = default; Optional repairAction = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -67,8 +90,61 @@ internal static AutomaticRepairsPolicy DeserializeAutomaticRepairsPolicy(JsonEle repairAction = new RepairAction(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutomaticRepairsPolicy(Optional.ToNullable(enabled), gracePeriod.Value, Optional.ToNullable(repairAction), serializedAdditionalRawData); + } + + AutomaticRepairsPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutomaticRepairsPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutomaticRepairsPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutomaticRepairsPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutomaticRepairsPolicy model) + { + if (model is null) + { + return null; } - return new AutomaticRepairsPolicy(Optional.ToNullable(enabled), gracePeriod.Value, Optional.ToNullable(repairAction)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutomaticRepairsPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutomaticRepairsPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs index 017692b2c1ef..334c698dc0ef 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the configuration parameters for automatic repairs on the virtual machine scale set. public partial class AutomaticRepairsPolicy { - /// Initializes a new instance of AutomaticRepairsPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutomaticRepairsPolicy() { } - /// Initializes a new instance of AutomaticRepairsPolicy. + /// Initializes a new instance of . /// Specifies whether automatic repairs should be enabled on the virtual machine scale set. The default value is false. /// The amount of time for which automatic repairs are suspended due to a state change on VM. The grace time starts after the state change has completed. This helps avoid premature or accidental repairs. The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 10 minutes (PT10M), which is also the default value. The maximum allowed grace period is 90 minutes (PT90M). /// Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy virtual machines in the scale set. Default value is replace. - internal AutomaticRepairsPolicy(bool? enabled, string gracePeriod, RepairAction? repairAction) + /// Keeps track of any properties unknown to the library. + internal AutomaticRepairsPolicy(bool? enabled, string gracePeriod, RepairAction? repairAction, Dictionary serializedAdditionalRawData) { Enabled = enabled; GracePeriod = gracePeriod; RepairAction = repairAction; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies whether automatic repairs should be enabled on the virtual machine scale set. The default value is false. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs index 701031610bbe..f577e3cb1222 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs @@ -5,24 +5,38 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class AvailabilitySetData : IUtf8JsonSerializable + public partial class AvailabilitySetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -65,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, ProximityPlacementGroup); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement element) + internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -86,6 +114,7 @@ internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement e Optional> virtualMachines = default; Optional proximityPlacementGroup = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -207,8 +236,61 @@ internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvailabilitySetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, Optional.ToNullable(platformUpdateDomainCount), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachines), proximityPlacementGroup, Optional.ToList(statuses), serializedAdditionalRawData); + } + + AvailabilitySetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailabilitySetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailabilitySetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailabilitySetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailabilitySetData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailabilitySetData(Response response) + { + if (response is null) + { + return null; } - return new AvailabilitySetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, Optional.ToNullable(platformUpdateDomainCount), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachines), proximityPlacementGroup, Optional.ToList(statuses)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailabilitySetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.Serialization.cs index 0e1655eed4a7..c14516fbb61a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class AvailabilitySetListResult + internal partial class AvailabilitySetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailabilitySetListResult DeserializeAvailabilitySetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailabilitySetListResult DeserializeAvailabilitySetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static AvailabilitySetListResult DeserializeAvailabilitySetListResult(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailabilitySetListResult(value, nextLink.Value); + return new AvailabilitySetListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + AvailabilitySetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailabilitySetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailabilitySetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailabilitySetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailabilitySetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailabilitySetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailabilitySetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.cs index cab7010b67ab..09463716e53a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Availability Set operation response. internal partial class AvailabilitySetListResult { - /// Initializes a new instance of AvailabilitySetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of availability sets. /// is null. internal AvailabilitySetListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal AvailabilitySetListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of AvailabilitySetListResult. + /// Initializes a new instance of . /// The list of availability sets. /// The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. - internal AvailabilitySetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AvailabilitySetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailabilitySetListResult() + { } /// The list of availability sets. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.Serialization.cs index 7c536ea8fddf..6f42d09a7dad 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.Serialization.cs @@ -5,20 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class AvailabilitySetPatch : IUtf8JsonSerializable + public partial class AvailabilitySetPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -59,7 +75,184 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, ProximityPlacementGroup); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AvailabilitySetPatch DeserializeAvailabilitySetPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional> tags = default; + Optional platformUpdateDomainCount = default; + Optional platformFaultDomainCount = default; + Optional> virtualMachines = default; + Optional proximityPlacementGroup = default; + Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ComputeSku.DeserializeComputeSku(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("platformUpdateDomainCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platformUpdateDomainCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("platformFaultDomainCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platformFaultDomainCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("virtualMachines"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + virtualMachines = array; + continue; + } + if (property0.NameEquals("proximityPlacementGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + proximityPlacementGroup = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("statuses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item)); + } + statuses = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvailabilitySetPatch(Optional.ToDictionary(tags), sku.Value, Optional.ToNullable(platformUpdateDomainCount), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachines), proximityPlacementGroup, Optional.ToList(statuses), serializedAdditionalRawData); + } + + AvailabilitySetPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailabilitySetPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailabilitySetPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailabilitySetPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailabilitySetPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailabilitySetPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailabilitySetPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.cs index 0bfa16191e3d..965ec0b5d17a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,32 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the availability set that the virtual machine should be assigned to. Only tags may be updated. public partial class AvailabilitySetPatch : ComputeResourcePatch { - /// Initializes a new instance of AvailabilitySetPatch. + /// Initializes a new instance of . public AvailabilitySetPatch() { VirtualMachines = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// Sku of the availability set. + /// Update Domain count. + /// Fault Domain count. + /// A list of references to all virtual machines in the availability set. + /// Specifies information about the proximity placement group that the availability set should be assigned to. Minimum api-version: 2018-04-01. + /// The resource status information. + /// Keeps track of any properties unknown to the library. + internal AvailabilitySetPatch(IDictionary tags, ComputeSku sku, int? platformUpdateDomainCount, int? platformFaultDomainCount, IList virtualMachines, WritableSubResource proximityPlacementGroup, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Sku = sku; + PlatformUpdateDomainCount = platformUpdateDomainCount; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachines = virtualMachines; + ProximityPlacementGroup = proximityPlacementGroup; + Statuses = statuses; + } + /// Sku of the availability set. public ComputeSku Sku { get; set; } /// Update Domain count. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.Serialization.cs index 9fd82f2b2e1a..0a81c51c767a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class AvailablePatchSummary + public partial class AvailablePatchSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailablePatchSummary DeserializeAvailablePatchSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailablePatchSummary DeserializeAvailablePatchSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +54,7 @@ internal static AvailablePatchSummary DeserializeAvailablePatchSummary(JsonEleme Optional startTime = default; Optional lastModifiedTime = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -97,8 +125,61 @@ internal static AvailablePatchSummary DeserializeAvailablePatchSummary(JsonEleme error = ComputeApiError.DeserializeComputeApiError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailablePatchSummary(Optional.ToNullable(status), assessmentActivityId.Value, Optional.ToNullable(rebootPending), Optional.ToNullable(criticalAndSecurityPatchCount), Optional.ToNullable(otherPatchCount), Optional.ToNullable(startTime), Optional.ToNullable(lastModifiedTime), error.Value); + return new AvailablePatchSummary(Optional.ToNullable(status), assessmentActivityId.Value, Optional.ToNullable(rebootPending), Optional.ToNullable(criticalAndSecurityPatchCount), Optional.ToNullable(otherPatchCount), Optional.ToNullable(startTime), Optional.ToNullable(lastModifiedTime), error.Value, serializedAdditionalRawData); + } + + AvailablePatchSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailablePatchSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailablePatchSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailablePatchSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailablePatchSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailablePatchSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailablePatchSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.cs index 137975371627..1ac8d4bc2f01 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailablePatchSummary.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes the properties of an virtual machine instance view for available patch summary. public partial class AvailablePatchSummary { - /// Initializes a new instance of AvailablePatchSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailablePatchSummary() { } - /// Initializes a new instance of AvailablePatchSummary. + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred. @@ -26,7 +30,8 @@ internal AvailablePatchSummary() /// The UTC timestamp when the operation began. /// The UTC timestamp when the operation began. /// The errors that were encountered during execution of the operation. The details array contains the list of them. - internal AvailablePatchSummary(PatchOperationStatus? status, string assessmentActivityId, bool? rebootPending, int? criticalAndSecurityPatchCount, int? otherPatchCount, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, ComputeApiError error) + /// Keeps track of any properties unknown to the library. + internal AvailablePatchSummary(PatchOperationStatus? status, string assessmentActivityId, bool? rebootPending, int? criticalAndSecurityPatchCount, int? otherPatchCount, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, ComputeApiError error, Dictionary serializedAdditionalRawData) { Status = status; AssessmentActivityId = assessmentActivityId; @@ -36,6 +41,7 @@ internal AvailablePatchSummary(PatchOperationStatus? status, string assessmentAc StartOn = startOn; LastModifiedOn = lastModifiedOn; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.Serialization.cs index b00ea487f266..ba1a4d5ba75f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class BillingProfile : IUtf8JsonSerializable + internal partial class BillingProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaxPrice)) { writer.WritePropertyName("maxPrice"u8); writer.WriteNumberValue(MaxPrice.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BillingProfile DeserializeBillingProfile(JsonElement element) + internal static BillingProfile DeserializeBillingProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional maxPrice = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("maxPrice"u8)) @@ -41,8 +64,61 @@ internal static BillingProfile DeserializeBillingProfile(JsonElement element) maxPrice = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BillingProfile(Optional.ToNullable(maxPrice), serializedAdditionalRawData); + } + + BillingProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingProfile model) + { + if (model is null) + { + return null; } - return new BillingProfile(Optional.ToNullable(maxPrice)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.cs index f3f1995346a0..4db152ddd25a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BillingProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the billing related details of a Azure Spot VM or VMSS. Minimum api-version: 2019-03-01. internal partial class BillingProfile { - /// Initializes a new instance of BillingProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BillingProfile() { } - /// Initializes a new instance of BillingProfile. + /// Initializes a new instance of . /// Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars. <br><br> This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is greater than the current Azure Spot price. <br><br> The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice after creation of VM/VMSS. <br><br> Possible values are: <br><br> - Any decimal value greater than zero. Example: 0.01538 <br><br> -1 – indicates default price to be up-to on-demand. <br><br> You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you. <br><br>Minimum api-version: 2019-03-01. - internal BillingProfile(double? maxPrice) + /// Keeps track of any properties unknown to the library. + internal BillingProfile(double? maxPrice, Dictionary serializedAdditionalRawData) { MaxPrice = maxPrice; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars. <br><br> This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is greater than the current Azure Spot price. <br><br> The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice after creation of VM/VMSS. <br><br> Possible values are: <br><br> - Any decimal value greater than zero. Example: 0.01538 <br><br> -1 – indicates default price to be up-to on-demand. <br><br> You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you. <br><br>Minimum api-version: 2019-03-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.Serialization.cs index 42046aeb2ee8..2a29b963799c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class BootDiagnostics : IUtf8JsonSerializable + public partial class BootDiagnostics : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Enabled)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("storageUri"u8); writer.WriteStringValue(StorageUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BootDiagnostics DeserializeBootDiagnostics(JsonElement element) + internal static BootDiagnostics DeserializeBootDiagnostics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional storageUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -57,8 +79,61 @@ internal static BootDiagnostics DeserializeBootDiagnostics(JsonElement element) storageUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BootDiagnostics(Optional.ToNullable(enabled), storageUri.Value, serializedAdditionalRawData); + } + + BootDiagnostics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBootDiagnostics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BootDiagnostics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBootDiagnostics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BootDiagnostics model) + { + if (model is null) + { + return null; } - return new BootDiagnostics(Optional.ToNullable(enabled), storageUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BootDiagnostics(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBootDiagnostics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.cs index 3fdd96a072b7..4d6d935c843d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnostics.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor. public partial class BootDiagnostics { - /// Initializes a new instance of BootDiagnostics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BootDiagnostics() { } - /// Initializes a new instance of BootDiagnostics. + /// Initializes a new instance of . /// Whether boot diagnostics should be enabled on the Virtual Machine. /// Uri of the storage account to use for placing the console output and screenshot. If storageUri is not specified while enabling boot diagnostics, managed storage will be used. - internal BootDiagnostics(bool? enabled, Uri storageUri) + /// Keeps track of any properties unknown to the library. + internal BootDiagnostics(bool? enabled, Uri storageUri, Dictionary serializedAdditionalRawData) { Enabled = enabled; StorageUri = storageUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether boot diagnostics should be enabled on the Virtual Machine. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.Serialization.cs index adfc2ecd5433..d43d47430a76 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class BootDiagnosticsInstanceView + public partial class BootDiagnosticsInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BootDiagnosticsInstanceView DeserializeBootDiagnosticsInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BootDiagnosticsInstanceView DeserializeBootDiagnosticsInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static BootDiagnosticsInstanceView DeserializeBootDiagnosticsInstanceVi Optional consoleScreenshotBlobUri = default; Optional serialConsoleLogBlobUri = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("consoleScreenshotBlobUri"u8)) @@ -51,8 +79,61 @@ internal static BootDiagnosticsInstanceView DeserializeBootDiagnosticsInstanceVi status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BootDiagnosticsInstanceView(consoleScreenshotBlobUri.Value, serialConsoleLogBlobUri.Value, status.Value); + return new BootDiagnosticsInstanceView(consoleScreenshotBlobUri.Value, serialConsoleLogBlobUri.Value, status.Value, serializedAdditionalRawData); + } + + BootDiagnosticsInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBootDiagnosticsInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BootDiagnosticsInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBootDiagnosticsInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BootDiagnosticsInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BootDiagnosticsInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBootDiagnosticsInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs index be4525b972d2..1a27d52dc661 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/BootDiagnosticsInstanceView.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// The instance view of a virtual machine boot diagnostics. public partial class BootDiagnosticsInstanceView { - /// Initializes a new instance of BootDiagnosticsInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BootDiagnosticsInstanceView() { } - /// Initializes a new instance of BootDiagnosticsInstanceView. + /// Initializes a new instance of . /// The console screenshot blob URI. **Note:** This will **not** be set if boot diagnostics is currently enabled with managed storage. /// The serial console log blob Uri. **Note:** This will **not** be set if boot diagnostics is currently enabled with managed storage. /// The boot diagnostics status information for the VM. **Note:** It will be set only if there are errors encountered in enabling boot diagnostics. - internal BootDiagnosticsInstanceView(Uri consoleScreenshotBlobUri, Uri serialConsoleLogBlobUri, InstanceViewStatus status) + /// Keeps track of any properties unknown to the library. + internal BootDiagnosticsInstanceView(Uri consoleScreenshotBlobUri, Uri serialConsoleLogBlobUri, InstanceViewStatus status, Dictionary serializedAdditionalRawData) { ConsoleScreenshotBlobUri = consoleScreenshotBlobUri; SerialConsoleLogBlobUri = serialConsoleLogBlobUri; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The console screenshot blob URI. **Note:** This will **not** be set if boot diagnostics is currently enabled with managed storage. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationData.Serialization.cs index 54cc2f9fdbc3..c24513296b9c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationData.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class CapacityReservationData : IUtf8JsonSerializable + public partial class CapacityReservationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Zones)) { writer.WritePropertyName("zones"u8); @@ -48,11 +61,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CapacityReservationData DeserializeCapacityReservationData(JsonElement element) + internal static CapacityReservationData DeserializeCapacityReservationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +99,7 @@ internal static CapacityReservationData DeserializeCapacityReservationData(JsonE Optional provisioningState = default; Optional instanceView = default; Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -208,8 +236,61 @@ internal static CapacityReservationData DeserializeCapacityReservationData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapacityReservationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, Optional.ToList(zones), reservationId.Value, Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachinesAssociated), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + CapacityReservationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationData(Response response) + { + if (response is null) + { + return null; } - return new CapacityReservationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, Optional.ToList(zones), reservationId.Value, Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachinesAssociated), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value, Optional.ToNullable(timeCreated)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupData.Serialization.cs index 2488ba835f7e..90fdf4cf0783 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class CapacityReservationGroupData : IUtf8JsonSerializable + public partial class CapacityReservationGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -45,11 +52,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CapacityReservationGroupData DeserializeCapacityReservationGroupData(JsonElement element) + internal static CapacityReservationGroupData DeserializeCapacityReservationGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +85,7 @@ internal static CapacityReservationGroupData DeserializeCapacityReservationGroup Optional> capacityReservations = default; Optional> virtualMachinesAssociated = default; Optional instanceView = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -172,8 +194,61 @@ internal static CapacityReservationGroupData DeserializeCapacityReservationGroup } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapacityReservationGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), Optional.ToList(capacityReservations), Optional.ToList(virtualMachinesAssociated), instanceView.Value, serializedAdditionalRawData); + } + + CapacityReservationGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationGroupData model) + { + if (model is null) + { + return null; } - return new CapacityReservationGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), Optional.ToList(capacityReservations), Optional.ToList(virtualMachinesAssociated), instanceView.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.Serialization.cs index 10a0370dfb73..9b344e57e7ee 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class CapacityReservationGroupInstanceView + internal partial class CapacityReservationGroupInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapacityReservationGroupInstanceView DeserializeCapacityReservationGroupInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapacityReservationGroupInstanceView DeserializeCapacityReservationGroupInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> capacityReservations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("capacityReservations"u8)) @@ -36,8 +64,61 @@ internal static CapacityReservationGroupInstanceView DeserializeCapacityReservat capacityReservations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapacityReservationGroupInstanceView(Optional.ToList(capacityReservations)); + return new CapacityReservationGroupInstanceView(Optional.ToList(capacityReservations), serializedAdditionalRawData); + } + + CapacityReservationGroupInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationGroupInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationGroupInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationGroupInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationGroupInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationGroupInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationGroupInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.cs index 5f2e527bdba0..cfc9e1e7fb70 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// The CapacityReservationGroupInstanceView. internal partial class CapacityReservationGroupInstanceView { - /// Initializes a new instance of CapacityReservationGroupInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CapacityReservationGroupInstanceView() { CapacityReservations = new ChangeTrackingList(); } - /// Initializes a new instance of CapacityReservationGroupInstanceView. + /// Initializes a new instance of . /// List of instance view of the capacity reservations under the capacity reservation group. - internal CapacityReservationGroupInstanceView(IReadOnlyList capacityReservations) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationGroupInstanceView(IReadOnlyList capacityReservations, Dictionary serializedAdditionalRawData) { CapacityReservations = capacityReservations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of instance view of the capacity reservations under the capacity reservation group. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.Serialization.cs index 3061324fb7e1..147c031a538d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class CapacityReservationGroupListResult + internal partial class CapacityReservationGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapacityReservationGroupListResult DeserializeCapacityReservationGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapacityReservationGroupListResult DeserializeCapacityReservationGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static CapacityReservationGroupListResult DeserializeCapacityReservatio nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapacityReservationGroupListResult(value, nextLink.Value); + return new CapacityReservationGroupListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + CapacityReservationGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.cs index 6e7fa02a6f30..b7a7e43ad6fe 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List capacity reservation group with resource group response. internal partial class CapacityReservationGroupListResult { - /// Initializes a new instance of CapacityReservationGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of capacity reservation groups. /// is null. internal CapacityReservationGroupListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal CapacityReservationGroupListResult(IEnumerable Initializes a new instance of CapacityReservationGroupListResult. + /// Initializes a new instance of . /// The list of capacity reservation groups. /// The URI to fetch the next page of capacity reservation groups. Call ListNext() with this URI to fetch the next page of capacity reservation groups. - internal CapacityReservationGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CapacityReservationGroupListResult() + { } /// The list of capacity reservation groups. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.Serialization.cs index 3f79eed42686..960b2d9d9deb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class CapacityReservationGroupPatch : IUtf8JsonSerializable + public partial class CapacityReservationGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -29,7 +38,154 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CapacityReservationGroupPatch DeserializeCapacityReservationGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional> capacityReservations = default; + Optional> virtualMachinesAssociated = default; + Optional instanceView = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("capacityReservations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + capacityReservations = array; + continue; + } + if (property0.NameEquals("virtualMachinesAssociated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + virtualMachinesAssociated = array; + continue; + } + if (property0.NameEquals("instanceView"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceView = CapacityReservationGroupInstanceView.DeserializeCapacityReservationGroupInstanceView(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapacityReservationGroupPatch(Optional.ToDictionary(tags), Optional.ToList(capacityReservations), Optional.ToList(virtualMachinesAssociated), instanceView.Value, serializedAdditionalRawData); + } + + CapacityReservationGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.cs index b9d1053a46c7..b621311fb538 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationGroupPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,26 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the capacity reservation group. Only tags can be updated. public partial class CapacityReservationGroupPatch : ComputeResourcePatch { - /// Initializes a new instance of CapacityReservationGroupPatch. + /// Initializes a new instance of . public CapacityReservationGroupPatch() { CapacityReservations = new ChangeTrackingList(); VirtualMachinesAssociated = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// A list of all capacity reservation resource ids that belong to capacity reservation group. + /// A list of references to all virtual machines associated to the capacity reservation group. + /// The capacity reservation group instance view which has the list of instance views for all the capacity reservations that belong to the capacity reservation group. + /// Keeps track of any properties unknown to the library. + internal CapacityReservationGroupPatch(IDictionary tags, IReadOnlyList capacityReservations, IReadOnlyList virtualMachinesAssociated, CapacityReservationGroupInstanceView instanceView, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + CapacityReservations = capacityReservations; + VirtualMachinesAssociated = virtualMachinesAssociated; + InstanceView = instanceView; + } + /// A list of all capacity reservation resource ids that belong to capacity reservation group. public IReadOnlyList CapacityReservations { get; } /// A list of references to all virtual machines associated to the capacity reservation group. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.Serialization.cs index cdc89b09b236..e45ba3eceb65 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.Serialization.cs @@ -5,22 +5,79 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CapacityReservationInstanceView + public partial class CapacityReservationInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapacityReservationInstanceView DeserializeCapacityReservationInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(UtilizationInfo)) + { + writer.WritePropertyName("utilizationInfo"u8); + if (UtilizationInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UtilizationInfo).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapacityReservationInstanceView DeserializeCapacityReservationInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional utilizationInfo = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("utilizationInfo"u8)) @@ -46,8 +103,61 @@ internal static CapacityReservationInstanceView DeserializeCapacityReservationIn statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapacityReservationInstanceView(utilizationInfo.Value, Optional.ToList(statuses)); + return new CapacityReservationInstanceView(utilizationInfo.Value, Optional.ToList(statuses), serializedAdditionalRawData); + } + + CapacityReservationInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.cs index 384898d80b99..ab2498f3f3ac 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. public partial class CapacityReservationInstanceView { - /// Initializes a new instance of CapacityReservationInstanceView. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CapacityReservationInstanceView() { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of CapacityReservationInstanceView. + /// Initializes a new instance of . /// Unutilized capacity of the capacity reservation. /// The resource status information. - internal CapacityReservationInstanceView(CapacityReservationUtilization utilizationInfo, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationInstanceView(CapacityReservationUtilization utilizationInfo, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { UtilizationInfo = utilizationInfo; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unutilized capacity of the capacity reservation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.Serialization.cs index 4dc8006a29ee..79f795d27812 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.Serialization.cs @@ -5,16 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CapacityReservationInstanceViewWithName + public partial class CapacityReservationInstanceViewWithName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapacityReservationInstanceViewWithName DeserializeCapacityReservationInstanceViewWithName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(UtilizationInfo)) + { + writer.WritePropertyName("utilizationInfo"u8); + if (UtilizationInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UtilizationInfo).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapacityReservationInstanceViewWithName DeserializeCapacityReservationInstanceViewWithName(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +78,7 @@ internal static CapacityReservationInstanceViewWithName DeserializeCapacityReser Optional name = default; Optional utilizationInfo = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +109,61 @@ internal static CapacityReservationInstanceViewWithName DeserializeCapacityReser statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapacityReservationInstanceViewWithName(utilizationInfo.Value, Optional.ToList(statuses), name.Value); + return new CapacityReservationInstanceViewWithName(utilizationInfo.Value, Optional.ToList(statuses), name.Value, serializedAdditionalRawData); + } + + CapacityReservationInstanceViewWithName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationInstanceViewWithName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationInstanceViewWithName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationInstanceViewWithName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationInstanceViewWithName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationInstanceViewWithName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationInstanceViewWithName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.cs index a799841096ee..236d6f780760 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationInstanceViewWithName.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +13,17 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a capacity reservation that includes the name of the capacity reservation. It is used for the response to the instance view of a capacity reservation group. public partial class CapacityReservationInstanceViewWithName : CapacityReservationInstanceView { - /// Initializes a new instance of CapacityReservationInstanceViewWithName. + /// Initializes a new instance of . internal CapacityReservationInstanceViewWithName() { } - /// Initializes a new instance of CapacityReservationInstanceViewWithName. + /// Initializes a new instance of . /// Unutilized capacity of the capacity reservation. /// The resource status information. /// The name of the capacity reservation. - internal CapacityReservationInstanceViewWithName(CapacityReservationUtilization utilizationInfo, IReadOnlyList statuses, string name) : base(utilizationInfo, statuses) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationInstanceViewWithName(CapacityReservationUtilization utilizationInfo, IReadOnlyList statuses, string name, Dictionary serializedAdditionalRawData) : base(utilizationInfo, statuses, serializedAdditionalRawData) { Name = name; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.Serialization.cs index 84b00b2a9496..03b13c81812d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class CapacityReservationListResult + internal partial class CapacityReservationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapacityReservationListResult DeserializeCapacityReservationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapacityReservationListResult DeserializeCapacityReservationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static CapacityReservationListResult DeserializeCapacityReservationList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapacityReservationListResult(value, nextLink.Value); + return new CapacityReservationListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + CapacityReservationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.cs index b753bff17387..5a39f83f8cd8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list capacity reservation operation response. internal partial class CapacityReservationListResult { - /// Initializes a new instance of CapacityReservationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of capacity reservations. /// is null. internal CapacityReservationListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal CapacityReservationListResult(IEnumerable valu Value = value.ToList(); } - /// Initializes a new instance of CapacityReservationListResult. + /// Initializes a new instance of . /// The list of capacity reservations. /// The URI to fetch the next page of capacity reservations. Call ListNext() with this URI to fetch the next page of capacity reservations. - internal CapacityReservationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CapacityReservationListResult() + { } /// The list of capacity reservations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.Serialization.cs index a3ca83c8acdd..c38f4758cbcf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.Serialization.cs @@ -5,20 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class CapacityReservationPatch : IUtf8JsonSerializable + public partial class CapacityReservationPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +50,191 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CapacityReservationPatch DeserializeCapacityReservationPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional> tags = default; + Optional reservationId = default; + Optional platformFaultDomainCount = default; + Optional> virtualMachinesAssociated = default; + Optional provisioningTime = default; + Optional provisioningState = default; + Optional instanceView = default; + Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ComputeSku.DeserializeComputeSku(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("reservationId"u8)) + { + reservationId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("platformFaultDomainCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platformFaultDomainCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("virtualMachinesAssociated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + virtualMachinesAssociated = array; + continue; + } + if (property0.NameEquals("provisioningTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("instanceView"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceView = CapacityReservationInstanceView.DeserializeCapacityReservationInstanceView(property0.Value); + continue; + } + if (property0.NameEquals("timeCreated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeCreated = property0.Value.GetDateTimeOffset("O"); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapacityReservationPatch(Optional.ToDictionary(tags), sku.Value, reservationId.Value, Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachinesAssociated), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + CapacityReservationPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.cs index 504868536b41..d42c841cf2fb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationPatch.cs @@ -15,12 +15,35 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the capacity reservation. Only tags and sku.capacity can be updated. public partial class CapacityReservationPatch : ComputeResourcePatch { - /// Initializes a new instance of CapacityReservationPatch. + /// Initializes a new instance of . public CapacityReservationPatch() { VirtualMachinesAssociated = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + /// A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. + /// Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. **Note:** The fault domain count specified for a resource (like virtual machines scale set) must be less than or equal to this value if it deploys using capacity reservation. Minimum api-version: 2022-08-01. + /// A list of all virtual machine resource ids that are associated with the capacity reservation. + /// The date time when the capacity reservation was last updated. + /// The provisioning state, which only appears in the response. + /// The Capacity reservation instance view. + /// Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01. + /// Keeps track of any properties unknown to the library. + internal CapacityReservationPatch(IDictionary tags, ComputeSku sku, string reservationId, int? platformFaultDomainCount, IReadOnlyList virtualMachinesAssociated, DateTimeOffset? provisioningOn, string provisioningState, CapacityReservationInstanceView instanceView, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Sku = sku; + ReservationId = reservationId; + PlatformFaultDomainCount = platformFaultDomainCount; + VirtualMachinesAssociated = virtualMachinesAssociated; + ProvisioningOn = provisioningOn; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + } + /// SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. public ComputeSku Sku { get; set; } /// A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.Serialization.cs index f4d25b5b07cc..7cc54053a5f7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - internal partial class CapacityReservationProfile : IUtf8JsonSerializable + internal partial class CapacityReservationProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CapacityReservationGroup)) { writer.WritePropertyName("capacityReservationGroup"u8); JsonSerializer.Serialize(writer, CapacityReservationGroup); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CapacityReservationProfile DeserializeCapacityReservationProfile(JsonElement element) + internal static CapacityReservationProfile DeserializeCapacityReservationProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional capacityReservationGroup = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("capacityReservationGroup"u8)) @@ -42,8 +65,61 @@ internal static CapacityReservationProfile DeserializeCapacityReservationProfile capacityReservationGroup = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CapacityReservationProfile(capacityReservationGroup, serializedAdditionalRawData); + } + + CapacityReservationProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationProfile model) + { + if (model is null) + { + return null; } - return new CapacityReservationProfile(capacityReservationGroup); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.cs index 0884c7789ba3..34df57cf2edb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationProfile.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,16 +15,21 @@ namespace Azure.ResourceManager.Compute.Models /// The parameters of a capacity reservation Profile. internal partial class CapacityReservationProfile { - /// Initializes a new instance of CapacityReservationProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CapacityReservationProfile() { } - /// Initializes a new instance of CapacityReservationProfile. + /// Initializes a new instance of . /// Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset vm instances provided enough capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more details. - internal CapacityReservationProfile(WritableSubResource capacityReservationGroup) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationProfile(WritableSubResource capacityReservationGroup, Dictionary serializedAdditionalRawData) { CapacityReservationGroup = capacityReservationGroup; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset vm instances provided enough capacity has been reserved. Please refer to https://aka.ms/CapacityReservation for more details. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.Serialization.cs index d691cc05b269..7feb5fb8df4d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class CapacityReservationUtilization + public partial class CapacityReservationUtilization : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CapacityReservationUtilization DeserializeCapacityReservationUtilization(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CapacityReservationUtilization DeserializeCapacityReservationUtilization(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional currentCapacity = default; Optional> virtualMachinesAllocated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("currentCapacity"u8)) @@ -47,8 +75,61 @@ internal static CapacityReservationUtilization DeserializeCapacityReservationUti virtualMachinesAllocated = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CapacityReservationUtilization(Optional.ToNullable(currentCapacity), Optional.ToList(virtualMachinesAllocated)); + return new CapacityReservationUtilization(Optional.ToNullable(currentCapacity), Optional.ToList(virtualMachinesAllocated), serializedAdditionalRawData); + } + + CapacityReservationUtilization IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCapacityReservationUtilization(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CapacityReservationUtilization IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCapacityReservationUtilization(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CapacityReservationUtilization model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CapacityReservationUtilization(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCapacityReservationUtilization(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.cs index 6fd1ffb01789..072d8fe285e5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CapacityReservationUtilization.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// Represents the capacity reservation utilization in terms of resources allocated. public partial class CapacityReservationUtilization { - /// Initializes a new instance of CapacityReservationUtilization. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CapacityReservationUtilization() { VirtualMachinesAllocated = new ChangeTrackingList(); } - /// Initializes a new instance of CapacityReservationUtilization. + /// Initializes a new instance of . /// The value provides the current capacity of the VM size which was reserved successfully and for which the customer is getting billed. Minimum api-version: 2022-08-01. /// A list of all virtual machines resource ids allocated against the capacity reservation. - internal CapacityReservationUtilization(int? currentCapacity, IReadOnlyList virtualMachinesAllocated) + /// Keeps track of any properties unknown to the library. + internal CapacityReservationUtilization(int? currentCapacity, IReadOnlyList virtualMachinesAllocated, Dictionary serializedAdditionalRawData) { CurrentCapacity = currentCapacity; VirtualMachinesAllocated = virtualMachinesAllocated; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value provides the current capacity of the VM size which was reserved successfully and for which the customer is getting billed. Minimum api-version: 2022-08-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceData.Serialization.cs index b7a90d1efbb4..595a07654866 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class CloudServiceData : IUtf8JsonSerializable + public partial class CloudServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -77,29 +83,71 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RoleProfile)) { writer.WritePropertyName("roleProfile"u8); - writer.WriteObjectValue(RoleProfile); + if (RoleProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RoleProfile).Serialize(writer, options); + } } if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ExtensionProfile)) { writer.WritePropertyName("extensionProfile"u8); - writer.WriteObjectValue(ExtensionProfile); + if (ExtensionProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExtensionProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceData DeserializeCloudServiceData(JsonElement element) + internal static CloudServiceData DeserializeCloudServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -123,6 +171,7 @@ internal static CloudServiceData DeserializeCloudServiceData(JsonElement element Optional extensionProfile = default; Optional provisioningState = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -290,8 +339,61 @@ internal static CloudServiceData DeserializeCloudServiceData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), packageUrl.Value, configuration.Value, configurationUrl.Value, Optional.ToNullable(startCloudService), Optional.ToNullable(allowModelOverride), Optional.ToNullable(upgradeMode), roleProfile.Value, osProfile.Value, networkProfile.Value, extensionProfile.Value, provisioningState.Value, uniqueId.Value); + return new CloudServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), packageUrl.Value, configuration.Value, configurationUrl.Value, Optional.ToNullable(startCloudService), Optional.ToNullable(allowModelOverride), Optional.ToNullable(upgradeMode), roleProfile.Value, osProfile.Value, networkProfile.Value, extensionProfile.Value, provisioningState.Value, uniqueId.Value, serializedAdditionalRawData); + } + + CloudServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.Serialization.cs index 9517f50d8a7f..ccdcfdf7ced4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceExtension : IUtf8JsonSerializable + public partial class CloudServiceExtension : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -65,7 +71,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProtectedSettingsFromKeyVault)) { writer.WritePropertyName("protectedSettingsFromKeyVault"u8); - writer.WriteObjectValue(ProtectedSettingsFromKeyVault); + if (ProtectedSettingsFromKeyVault is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProtectedSettingsFromKeyVault).Serialize(writer, options); + } } if (Optional.IsDefined(ForceUpdateTag)) { @@ -83,11 +96,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceExtension DeserializeCloudServiceExtension(JsonElement element) + internal static CloudServiceExtension DeserializeCloudServiceExtension(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -103,6 +130,7 @@ internal static CloudServiceExtension DeserializeCloudServiceExtension(JsonEleme Optional forceUpdateTag = default; Optional provisioningState = default; Optional> rolesAppliedTo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -197,8 +225,61 @@ internal static CloudServiceExtension DeserializeCloudServiceExtension(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceExtension(name.Value, publisher.Value, type.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, protectedSettingsFromKeyVault.Value, forceUpdateTag.Value, provisioningState.Value, Optional.ToList(rolesAppliedTo)); + return new CloudServiceExtension(name.Value, publisher.Value, type.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, protectedSettingsFromKeyVault.Value, forceUpdateTag.Value, provisioningState.Value, Optional.ToList(rolesAppliedTo), serializedAdditionalRawData); + } + + CloudServiceExtension IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceExtension(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceExtension IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceExtension(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceExtension model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceExtension(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceExtension(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.cs index 3e4d827a181f..3b21c2a0c9c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtension.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a cloud service Extension. public partial class CloudServiceExtension { - /// Initializes a new instance of CloudServiceExtension. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceExtension() { RolesAppliedTo = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceExtension. + /// Initializes a new instance of . /// The name of the extension. /// The name of the extension handler publisher. /// Specifies the type of the extension. @@ -38,7 +41,8 @@ public CloudServiceExtension() /// /// The provisioning state, which only appears in the response. /// Optional list of roles to apply this extension. If property is not specified or '*' is specified, extension is applied to all roles in the cloud service. - internal CloudServiceExtension(string name, string publisher, string cloudServiceExtensionPropertiesType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault, string forceUpdateTag, string provisioningState, IList rolesAppliedTo) + /// Keeps track of any properties unknown to the library. + internal CloudServiceExtension(string name, string publisher, string cloudServiceExtensionPropertiesType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, CloudServiceVaultAndSecretReference protectedSettingsFromKeyVault, string forceUpdateTag, string provisioningState, IList rolesAppliedTo, Dictionary serializedAdditionalRawData) { Name = name; Publisher = publisher; @@ -51,6 +55,7 @@ internal CloudServiceExtension(string name, string publisher, string cloudServic ForceUpdateTag = forceUpdateTag; ProvisioningState = provisioningState; RolesAppliedTo = rolesAppliedTo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the extension. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.Serialization.cs index 5beecb9eea4b..2b720e005397 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class CloudServiceExtensionProfile : IUtf8JsonSerializable + internal partial class CloudServiceExtensionProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Extensions)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Extensions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceExtensionProfile DeserializeCloudServiceExtensionProfile(JsonElement element) + internal static CloudServiceExtensionProfile DeserializeCloudServiceExtensionProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> extensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extensions"u8)) @@ -52,8 +81,61 @@ internal static CloudServiceExtensionProfile DeserializeCloudServiceExtensionPro extensions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceExtensionProfile(Optional.ToList(extensions), serializedAdditionalRawData); + } + + CloudServiceExtensionProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceExtensionProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceExtensionProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceExtensionProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceExtensionProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceExtensionProfile(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceExtensionProfile(Optional.ToList(extensions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceExtensionProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs index c2b4a0bdcaac..48469497d41d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceExtensionProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a cloud service extension profile. internal partial class CloudServiceExtensionProfile { - /// Initializes a new instance of CloudServiceExtensionProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceExtensionProfile() { Extensions = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceExtensionProfile. + /// Initializes a new instance of . /// List of extensions for the cloud service. - internal CloudServiceExtensionProfile(IList extensions) + /// Keeps track of any properties unknown to the library. + internal CloudServiceExtensionProfile(IList extensions, Dictionary serializedAdditionalRawData) { Extensions = extensions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of extensions for the cloud service. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.Serialization.cs index 1e79dd47e457..64e5d074f88b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.Serialization.cs @@ -5,16 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceInstanceView + public partial class CloudServiceInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceInstanceView DeserializeCloudServiceInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RoleInstance)) + { + writer.WritePropertyName("roleInstance"u8); + if (RoleInstance is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RoleInstance).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceInstanceView DeserializeCloudServiceInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +62,7 @@ internal static CloudServiceInstanceView DeserializeCloudServiceInstanceView(Jso Optional sdkVersion = default; Optional> privateIds = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("roleInstance"u8)) @@ -67,8 +107,61 @@ internal static CloudServiceInstanceView DeserializeCloudServiceInstanceView(Jso statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceInstanceView(roleInstance.Value, sdkVersion.Value, Optional.ToList(privateIds), Optional.ToList(statuses)); + return new CloudServiceInstanceView(roleInstance.Value, sdkVersion.Value, Optional.ToList(privateIds), Optional.ToList(statuses), serializedAdditionalRawData); + } + + CloudServiceInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.cs index 8a12cd8c9812..906bb3d980c0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Compute.Models /// InstanceView of CloudService as a whole. public partial class CloudServiceInstanceView { - /// Initializes a new instance of CloudServiceInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CloudServiceInstanceView() { PrivateIds = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceInstanceView. + /// Initializes a new instance of . /// Instance view statuses. /// The version of the SDK that was used to generate the package for the cloud service. /// Specifies a list of unique identifiers generated internally for the cloud service. <br /><br /> NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. /// - internal CloudServiceInstanceView(InstanceViewStatusesSummary roleInstance, string sdkVersion, IReadOnlyList privateIds, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal CloudServiceInstanceView(InstanceViewStatusesSummary roleInstance, string sdkVersion, IReadOnlyList privateIds, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { RoleInstance = roleInstance; SdkVersion = sdkVersion; PrivateIds = privateIds; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Instance view statuses. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.Serialization.cs index eedf6b9aa8fe..4d60e1512e81 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class CloudServiceListResult + internal partial class CloudServiceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceListResult DeserializeCloudServiceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceListResult DeserializeCloudServiceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static CloudServiceListResult DeserializeCloudServiceListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceListResult(value, nextLink.Value); + return new CloudServiceListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + CloudServiceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.cs index 7aa7f1f76472..2cf29021fab8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list operation result. internal partial class CloudServiceListResult { - /// Initializes a new instance of CloudServiceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of resources. /// is null. internal CloudServiceListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal CloudServiceListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of CloudServiceListResult. + /// Initializes a new instance of . /// The list of resources. /// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null to fetch all the resources. - internal CloudServiceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CloudServiceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CloudServiceListResult() + { } /// The list of resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.Serialization.cs index e1d1e639d6cd..81a1e43b6ad0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceLoadBalancerConfiguration : IUtf8JsonSerializable + public partial class CloudServiceLoadBalancerConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -29,15 +36,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FrontendIPConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceLoadBalancerConfiguration DeserializeCloudServiceLoadBalancerConfiguration(JsonElement element) + internal static CloudServiceLoadBalancerConfiguration DeserializeCloudServiceLoadBalancerConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +73,7 @@ internal static CloudServiceLoadBalancerConfiguration DeserializeCloudServiceLoa Optional id = default; string name = default; IList frontendIPConfigurations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -83,8 +112,61 @@ internal static CloudServiceLoadBalancerConfiguration DeserializeCloudServiceLoa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceLoadBalancerConfiguration(id.Value, name, frontendIPConfigurations, serializedAdditionalRawData); + } + + CloudServiceLoadBalancerConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceLoadBalancerConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceLoadBalancerConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceLoadBalancerConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceLoadBalancerConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceLoadBalancerConfiguration(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceLoadBalancerConfiguration(id.Value, name, frontendIPConfigurations); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceLoadBalancerConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.cs index 5efd7d2501f3..5b2c209564d5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceLoadBalancerConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the load balancer configuration. public partial class CloudServiceLoadBalancerConfiguration { - /// Initializes a new instance of CloudServiceLoadBalancerConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the Load balancer. /// Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP configuration. /// or is null. @@ -28,15 +31,22 @@ public CloudServiceLoadBalancerConfiguration(string name, IEnumerable Initializes a new instance of CloudServiceLoadBalancerConfiguration. + /// Initializes a new instance of . /// Resource Id. /// The name of the Load balancer. /// Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP configuration. - internal CloudServiceLoadBalancerConfiguration(ResourceIdentifier id, string name, IList frontendIPConfigurations) + /// Keeps track of any properties unknown to the library. + internal CloudServiceLoadBalancerConfiguration(ResourceIdentifier id, string name, IList frontendIPConfigurations, Dictionary serializedAdditionalRawData) { Id = id; Name = name; FrontendIPConfigurations = frontendIPConfigurations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CloudServiceLoadBalancerConfiguration() + { } /// Resource Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs index 29287bd75b0b..9cb75c3306f2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceNetworkProfile : IUtf8JsonSerializable + public partial class CloudServiceNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(LoadBalancerConfigurations)) { @@ -23,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadBalancerConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("swappableCloudService"u8); JsonSerializer.Serialize(writer, SwappableCloudService); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceNetworkProfile DeserializeCloudServiceNetworkProfile(JsonElement element) + internal static CloudServiceNetworkProfile DeserializeCloudServiceNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static CloudServiceNetworkProfile DeserializeCloudServiceNetworkProfile Optional> loadBalancerConfigurations = default; Optional slotType = default; Optional swappableCloudService = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("loadBalancerConfigurations"u8)) @@ -83,8 +112,61 @@ internal static CloudServiceNetworkProfile DeserializeCloudServiceNetworkProfile swappableCloudService = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceNetworkProfile(Optional.ToList(loadBalancerConfigurations), Optional.ToNullable(slotType), swappableCloudService, serializedAdditionalRawData); + } + + CloudServiceNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceNetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceNetworkProfile(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceNetworkProfile(Optional.ToList(loadBalancerConfigurations), Optional.ToNullable(slotType), swappableCloudService); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs index 6d59146e699a..78163d4be0f3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.Compute.Models /// Network Profile for the cloud service. public partial class CloudServiceNetworkProfile { - /// Initializes a new instance of CloudServiceNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceNetworkProfile() { LoadBalancerConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceNetworkProfile. + /// Initializes a new instance of . /// List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer. /// /// Slot type for the cloud service. @@ -28,11 +32,13 @@ public CloudServiceNetworkProfile() /// If not specified, the default value is Production. /// /// The id reference of the cloud service containing the target IP with which the subject cloud service can perform a swap. This property cannot be updated once it is set. The swappable cloud service referred by this id must be present otherwise an error will be thrown. - internal CloudServiceNetworkProfile(IList loadBalancerConfigurations, CloudServiceSlotType? slotType, WritableSubResource swappableCloudService) + /// Keeps track of any properties unknown to the library. + internal CloudServiceNetworkProfile(IList loadBalancerConfigurations, CloudServiceSlotType? slotType, WritableSubResource swappableCloudService, Dictionary serializedAdditionalRawData) { LoadBalancerConfigurations = loadBalancerConfigurations; SlotType = slotType; SwappableCloudService = swappableCloudService; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSFamilyData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSFamilyData.Serialization.cs index fb310409a7d6..e29db2b8dfa5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSFamilyData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSFamilyData.Serialization.cs @@ -5,18 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class CloudServiceOSFamilyData + public partial class CloudServiceOSFamilyData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceOSFamilyData DeserializeCloudServiceOSFamilyData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceOSFamilyData DeserializeCloudServiceOSFamilyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +60,7 @@ internal static CloudServiceOSFamilyData DeserializeCloudServiceOSFamilyData(Jso Optional name1 = default; Optional label = default; Optional> versions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -106,8 +137,61 @@ internal static CloudServiceOSFamilyData DeserializeCloudServiceOSFamilyData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceOSFamilyData(id, name0, type, systemData.Value, name.Value, Optional.ToNullable(location), name1.Value, label.Value, Optional.ToList(versions)); + return new CloudServiceOSFamilyData(id, name0, type, systemData.Value, name.Value, Optional.ToNullable(location), name1.Value, label.Value, Optional.ToList(versions), serializedAdditionalRawData); + } + + CloudServiceOSFamilyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceOSFamilyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceOSFamilyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceOSFamilyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceOSFamilyData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceOSFamilyData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceOSFamilyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.Serialization.cs index a74c72e6f6d6..63ac3f4b6a61 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class CloudServiceOSProfile : IUtf8JsonSerializable + internal partial class CloudServiceOSProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Secrets)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceOSProfile DeserializeCloudServiceOSProfile(JsonElement element) + internal static CloudServiceOSProfile DeserializeCloudServiceOSProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> secrets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secrets"u8)) @@ -52,8 +81,61 @@ internal static CloudServiceOSProfile DeserializeCloudServiceOSProfile(JsonEleme secrets = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceOSProfile(Optional.ToList(secrets), serializedAdditionalRawData); + } + + CloudServiceOSProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceOSProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceOSProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceOSProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceOSProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceOSProfile(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceOSProfile(Optional.ToList(secrets)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceOSProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.cs index d7ea1c8d0a91..aec551a24ad4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the OS profile for the cloud service. internal partial class CloudServiceOSProfile { - /// Initializes a new instance of CloudServiceOSProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceOSProfile() { Secrets = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceOSProfile. + /// Initializes a new instance of . /// Specifies set of certificates that should be installed onto the role instances. - internal CloudServiceOSProfile(IList secrets) + /// Keeps track of any properties unknown to the library. + internal CloudServiceOSProfile(IList secrets, Dictionary serializedAdditionalRawData) { Secrets = secrets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies set of certificates that should be installed onto the role instances. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSVersionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSVersionData.Serialization.cs index 4b0f59c14d11..32b82d5fcc1e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSVersionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceOSVersionData.Serialization.cs @@ -5,16 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class CloudServiceOSVersionData + public partial class CloudServiceOSVersionData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceOSVersionData DeserializeCloudServiceOSVersionData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceOSVersionData DeserializeCloudServiceOSVersionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +61,7 @@ internal static CloudServiceOSVersionData DeserializeCloudServiceOSVersionData(J Optional label = default; Optional isDefault = default; Optional isActive = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -115,8 +147,61 @@ internal static CloudServiceOSVersionData DeserializeCloudServiceOSVersionData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceOSVersionData(id, name, type, systemData.Value, Optional.ToNullable(location), family.Value, familyLabel.Value, version.Value, label.Value, Optional.ToNullable(isDefault), Optional.ToNullable(isActive)); + return new CloudServiceOSVersionData(id, name, type, systemData.Value, Optional.ToNullable(location), family.Value, familyLabel.Value, version.Value, label.Value, Optional.ToNullable(isDefault), Optional.ToNullable(isActive), serializedAdditionalRawData); + } + + CloudServiceOSVersionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceOSVersionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceOSVersionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceOSVersionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceOSVersionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceOSVersionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceOSVersionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.Serialization.cs index ae12da952215..7d407d7cc1e8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServicePatch : IUtf8JsonSerializable + public partial class CloudServicePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CloudServicePatch DeserializeCloudServicePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServicePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + CloudServicePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServicePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServicePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServicePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServicePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServicePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServicePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.cs index 7526c620fbe3..fea4c1c5b669 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServicePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// The CloudServicePatch. public partial class CloudServicePatch { - /// Initializes a new instance of CloudServicePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServicePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal CloudServicePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleData.Serialization.cs index 67e66739ec12..3dbb4854ac3e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleData.Serialization.cs @@ -5,17 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class CloudServiceRoleData + public partial class CloudServiceRoleData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceRoleData DeserializeCloudServiceRoleData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceRoleData DeserializeCloudServiceRoleData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +70,7 @@ internal static CloudServiceRoleData DeserializeCloudServiceRoleData(JsonElement ResourceType type = default; Optional systemData = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -88,8 +132,61 @@ internal static CloudServiceRoleData DeserializeCloudServiceRoleData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceRoleData(id, name, type, systemData.Value, Optional.ToNullable(location), sku.Value, uniqueId.Value); + return new CloudServiceRoleData(id, name, type, systemData.Value, Optional.ToNullable(location), sku.Value, uniqueId.Value, serializedAdditionalRawData); + } + + CloudServiceRoleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceRoleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceRoleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceRoleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceRoleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceRoleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceRoleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleInstanceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleInstanceData.Serialization.cs index b6deb4b121b2..3c3bfdf0a98f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleInstanceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleInstanceData.Serialization.cs @@ -5,18 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class CloudServiceRoleInstanceData + public partial class CloudServiceRoleInstanceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceRoleInstanceData DeserializeCloudServiceRoleInstanceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkProfile)) + { + writer.WritePropertyName("networkProfile"u8); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } + } + if (Optional.IsDefined(InstanceView)) + { + writer.WritePropertyName("instanceView"u8); + if (InstanceView is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InstanceView).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceRoleInstanceData DeserializeCloudServiceRoleInstanceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +96,7 @@ internal static CloudServiceRoleInstanceData DeserializeCloudServiceRoleInstance Optional systemData = default; Optional networkProfile = default; Optional instanceView = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -118,8 +185,61 @@ internal static CloudServiceRoleInstanceData DeserializeCloudServiceRoleInstance } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceRoleInstanceData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), sku.Value, networkProfile.Value, instanceView.Value, serializedAdditionalRawData); + } + + CloudServiceRoleInstanceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceRoleInstanceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceRoleInstanceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceRoleInstanceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceRoleInstanceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceRoleInstanceData(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceRoleInstanceData(id, name, type, systemData.Value, Optional.ToNullable(location), Optional.ToDictionary(tags), sku.Value, networkProfile.Value, instanceView.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceRoleInstanceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.Serialization.cs index aefb8382caff..7601bee4d707 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class CloudServiceRoleListResult + internal partial class CloudServiceRoleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CloudServiceRoleListResult DeserializeCloudServiceRoleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CloudServiceRoleListResult DeserializeCloudServiceRoleListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static CloudServiceRoleListResult DeserializeCloudServiceRoleListResult nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CloudServiceRoleListResult(value, nextLink.Value); + return new CloudServiceRoleListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + CloudServiceRoleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceRoleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceRoleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceRoleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceRoleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceRoleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceRoleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.cs index 653a7bdaa533..15ae3bbf95a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list operation result. internal partial class CloudServiceRoleListResult { - /// Initializes a new instance of CloudServiceRoleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of resources. /// is null. internal CloudServiceRoleListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal CloudServiceRoleListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of CloudServiceRoleListResult. + /// Initializes a new instance of . /// The list of resources. /// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null to fetch all the resources. - internal CloudServiceRoleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CloudServiceRoleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CloudServiceRoleListResult() + { } /// The list of resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.Serialization.cs index 2ccca6892bd9..52a0045526cf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class CloudServiceRoleProfile : IUtf8JsonSerializable + internal partial class CloudServiceRoleProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Roles)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Roles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceRoleProfile DeserializeCloudServiceRoleProfile(JsonElement element) + internal static CloudServiceRoleProfile DeserializeCloudServiceRoleProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> roles = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("roles"u8)) @@ -52,8 +81,61 @@ internal static CloudServiceRoleProfile DeserializeCloudServiceRoleProfile(JsonE roles = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceRoleProfile(Optional.ToList(roles), serializedAdditionalRawData); + } + + CloudServiceRoleProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceRoleProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceRoleProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceRoleProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceRoleProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceRoleProfile(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceRoleProfile(Optional.ToList(roles)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceRoleProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.cs index a5f6c3263165..83638d2cbee9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the role profile for the cloud service. internal partial class CloudServiceRoleProfile { - /// Initializes a new instance of CloudServiceRoleProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceRoleProfile() { Roles = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceRoleProfile. + /// Initializes a new instance of . /// List of roles for the cloud service. - internal CloudServiceRoleProfile(IList roles) + /// Keeps track of any properties unknown to the library. + internal CloudServiceRoleProfile(IList roles, Dictionary serializedAdditionalRawData) { Roles = roles; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of roles for the cloud service. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.Serialization.cs index 23d589e3b2b5..b86840ecf004 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceRoleProfileProperties : IUtf8JsonSerializable + public partial class CloudServiceRoleProfileProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CloudServiceRoleProfileProperties DeserializeCloudServiceRoleProfileProperties(JsonElement element) + internal static CloudServiceRoleProfileProperties DeserializeCloudServiceRoleProfileProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional sku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +82,61 @@ internal static CloudServiceRoleProfileProperties DeserializeCloudServiceRolePro sku = CloudServiceRoleSku.DeserializeCloudServiceRoleSku(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceRoleProfileProperties(name.Value, sku.Value, serializedAdditionalRawData); + } + + CloudServiceRoleProfileProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceRoleProfileProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceRoleProfileProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceRoleProfileProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceRoleProfileProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceRoleProfileProperties(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceRoleProfileProperties(name.Value, sku.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceRoleProfileProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs index 3afec8e95068..187ef81616a3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleProfileProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the role properties. public partial class CloudServiceRoleProfileProperties { - /// Initializes a new instance of CloudServiceRoleProfileProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceRoleProfileProperties() { } - /// Initializes a new instance of CloudServiceRoleProfileProperties. + /// Initializes a new instance of . /// Resource name. /// Describes the cloud service role sku. - internal CloudServiceRoleProfileProperties(string name, CloudServiceRoleSku sku) + /// Keeps track of any properties unknown to the library. + internal CloudServiceRoleProfileProperties(string name, CloudServiceRoleSku sku, Dictionary serializedAdditionalRawData) { Name = name; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.Serialization.cs index 4a5739b39e04..499120ec81be 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceRoleSku : IUtf8JsonSerializable + public partial class CloudServiceRoleSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceRoleSku DeserializeCloudServiceRoleSku(JsonElement element) + internal static CloudServiceRoleSku DeserializeCloudServiceRoleSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static CloudServiceRoleSku DeserializeCloudServiceRoleSku(JsonElement e Optional name = default; Optional tier = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +86,61 @@ internal static CloudServiceRoleSku DeserializeCloudServiceRoleSku(JsonElement e capacity = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceRoleSku(name.Value, tier.Value, Optional.ToNullable(capacity), serializedAdditionalRawData); + } + + CloudServiceRoleSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceRoleSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceRoleSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceRoleSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceRoleSku model) + { + if (model is null) + { + return null; } - return new CloudServiceRoleSku(name.Value, tier.Value, Optional.ToNullable(capacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceRoleSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceRoleSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.cs index 964a04025250..dc492973e32e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceRoleSku.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the cloud service role sku. public partial class CloudServiceRoleSku { - /// Initializes a new instance of CloudServiceRoleSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceRoleSku() { } - /// Initializes a new instance of CloudServiceRoleSku. + /// Initializes a new instance of . /// The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is currently on, you need to delete and recreate the cloud service or move back to the old sku. /// Specifies the tier of the cloud service. Possible Values are <br /><br /> **Standard** <br /><br /> **Basic**. /// Specifies the number of role instances in the cloud service. - internal CloudServiceRoleSku(string name, string tier, long? capacity) + /// Keeps track of any properties unknown to the library. + internal CloudServiceRoleSku(string name, string tier, long? capacity, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is currently on, you need to delete and recreate the cloud service or move back to the old sku. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs index 510290fb4e3f..bf26bafc85ff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceVaultAndSecretReference : IUtf8JsonSerializable + public partial class CloudServiceVaultAndSecretReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceVault)) { @@ -27,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secretUrl"u8); writer.WriteStringValue(SecretUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceVaultAndSecretReference DeserializeCloudServiceVaultAndSecretReference(JsonElement element) + internal static CloudServiceVaultAndSecretReference DeserializeCloudServiceVaultAndSecretReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sourceVault = default; Optional secretUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault"u8)) @@ -58,8 +80,61 @@ internal static CloudServiceVaultAndSecretReference DeserializeCloudServiceVault secretUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceVaultAndSecretReference(sourceVault, secretUrl.Value, serializedAdditionalRawData); + } + + CloudServiceVaultAndSecretReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceVaultAndSecretReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceVaultAndSecretReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceVaultAndSecretReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceVaultAndSecretReference model) + { + if (model is null) + { + return null; } - return new CloudServiceVaultAndSecretReference(sourceVault, secretUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceVaultAndSecretReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceVaultAndSecretReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs index 17ced88930b9..537b997fcaee 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,18 +15,23 @@ namespace Azure.ResourceManager.Compute.Models /// Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance. public partial class CloudServiceVaultAndSecretReference { - /// Initializes a new instance of CloudServiceVaultAndSecretReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceVaultAndSecretReference() { } - /// Initializes a new instance of CloudServiceVaultAndSecretReference. + /// Initializes a new instance of . /// The ARM Resource ID of the Key Vault. /// Secret URL which contains the protected settings of the extension. - internal CloudServiceVaultAndSecretReference(WritableSubResource sourceVault, Uri secretUri) + /// Keeps track of any properties unknown to the library. + internal CloudServiceVaultAndSecretReference(WritableSubResource sourceVault, Uri secretUri, Dictionary serializedAdditionalRawData) { SourceVault = sourceVault; SecretUri = secretUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ARM Resource ID of the Key Vault. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.Serialization.cs index a3bea4921520..d4d80cc24e9c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceVaultCertificate : IUtf8JsonSerializable + public partial class CloudServiceVaultCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CertificateUri)) { writer.WritePropertyName("certificateUrl"u8); writer.WriteStringValue(CertificateUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceVaultCertificate DeserializeCloudServiceVaultCertificate(JsonElement element) + internal static CloudServiceVaultCertificate DeserializeCloudServiceVaultCertificate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional certificateUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificateUrl"u8)) @@ -42,8 +64,61 @@ internal static CloudServiceVaultCertificate DeserializeCloudServiceVaultCertifi certificateUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceVaultCertificate(certificateUrl.Value, serializedAdditionalRawData); + } + + CloudServiceVaultCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceVaultCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceVaultCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceVaultCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceVaultCertificate model) + { + if (model is null) + { + return null; } - return new CloudServiceVaultCertificate(certificateUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceVaultCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceVaultCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs index 86ed412dddb3..a9b71d7e9177 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultCertificate.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance. public partial class CloudServiceVaultCertificate { - /// Initializes a new instance of CloudServiceVaultCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceVaultCertificate() { } - /// Initializes a new instance of CloudServiceVaultCertificate. + /// Initializes a new instance of . /// This is the URL of a certificate that has been uploaded to Key Vault as a secret. - internal CloudServiceVaultCertificate(Uri certificateUri) + /// Keeps track of any properties unknown to the library. + internal CloudServiceVaultCertificate(Uri certificateUri, Dictionary serializedAdditionalRawData) { CertificateUri = certificateUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the URL of a certificate that has been uploaded to Key Vault as a secret. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs index 5bac0a479e35..044e9ccdc0f5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class CloudServiceVaultSecretGroup : IUtf8JsonSerializable + public partial class CloudServiceVaultSecretGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceVault)) { @@ -28,21 +35,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VaultCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudServiceVaultSecretGroup DeserializeCloudServiceVaultSecretGroup(JsonElement element) + internal static CloudServiceVaultSecretGroup DeserializeCloudServiceVaultSecretGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sourceVault = default; Optional> vaultCertificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault"u8)) @@ -68,8 +97,61 @@ internal static CloudServiceVaultSecretGroup DeserializeCloudServiceVaultSecretG vaultCertificates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudServiceVaultSecretGroup(sourceVault, Optional.ToList(vaultCertificates), serializedAdditionalRawData); + } + + CloudServiceVaultSecretGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudServiceVaultSecretGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudServiceVaultSecretGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudServiceVaultSecretGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudServiceVaultSecretGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudServiceVaultSecretGroup(Response response) + { + if (response is null) + { + return null; } - return new CloudServiceVaultSecretGroup(sourceVault, Optional.ToList(vaultCertificates)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudServiceVaultSecretGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs index 5fef3b67892e..93e0408f92fc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a set of certificates which are all in the same Key Vault. public partial class CloudServiceVaultSecretGroup { - /// Initializes a new instance of CloudServiceVaultSecretGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CloudServiceVaultSecretGroup() { VaultCertificates = new ChangeTrackingList(); } - /// Initializes a new instance of CloudServiceVaultSecretGroup. + /// Initializes a new instance of . /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. /// The list of key vault references in SourceVault which contain certificates. - internal CloudServiceVaultSecretGroup(WritableSubResource sourceVault, IList vaultCertificates) + /// Keeps track of any properties unknown to the library. + internal CloudServiceVaultSecretGroup(WritableSubResource sourceVault, IList vaultCertificates, Dictionary serializedAdditionalRawData) { SourceVault = sourceVault; VaultCertificates = vaultCertificates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryData.Serialization.cs index bb79f2de5be1..b2ea0e859b35 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryData.Serialization.cs @@ -5,15 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute { - public partial class CommunityGalleryData + public partial class CommunityGalleryData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunityGalleryData DeserializeCommunityGalleryData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunityGalleryData DeserializeCommunityGalleryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +58,7 @@ internal static CommunityGalleryData DeserializeCommunityGalleryData(JsonElement Optional location = default; Optional type = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -64,8 +101,61 @@ internal static CommunityGalleryData DeserializeCommunityGalleryData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunityGalleryData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value); + return new CommunityGalleryData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, serializedAdditionalRawData); + } + + CommunityGalleryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageData.Serialization.cs index 200b3dfa595c..4f8a6495ce42 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageData.Serialization.cs @@ -8,15 +8,152 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; namespace Azure.ResourceManager.Compute { - public partial class CommunityGalleryImageData + public partial class CommunityGalleryImageData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunityGalleryImageData DeserializeCommunityGalleryImageData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(OSType)) + { + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.Value.ToSerialString()); + } + if (Optional.IsDefined(OSState)) + { + writer.WritePropertyName("osState"u8); + writer.WriteStringValue(OSState.Value.ToSerialString()); + } + if (Optional.IsDefined(EndOfLifeOn)) + { + writer.WritePropertyName("endOfLifeDate"u8); + writer.WriteStringValue(EndOfLifeOn.Value, "O"); + } + if (Optional.IsDefined(ImageIdentifier)) + { + writer.WritePropertyName("identifier"u8); + if (ImageIdentifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageIdentifier).Serialize(writer, options); + } + } + if (Optional.IsDefined(Recommended)) + { + writer.WritePropertyName("recommended"u8); + if (Recommended is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recommended).Serialize(writer, options); + } + } + if (Optional.IsDefined(Disallowed)) + { + writer.WritePropertyName("disallowed"u8); + if (Disallowed is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Disallowed).Serialize(writer, options); + } + } + if (Optional.IsDefined(HyperVGeneration)) + { + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration.Value.ToString()); + } + if (Optional.IsCollectionDefined(Features)) + { + writer.WritePropertyName("features"u8); + writer.WriteStartArray(); + foreach (var item in Features) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PurchasePlan)) + { + writer.WritePropertyName("purchasePlan"u8); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } + } + if (Optional.IsDefined(Architecture)) + { + writer.WritePropertyName("architecture"u8); + writer.WriteStringValue(Architecture.Value.ToString()); + } + if (Optional.IsDefined(PrivacyStatementUri)) + { + writer.WritePropertyName("privacyStatementUri"u8); + writer.WriteStringValue(PrivacyStatementUri.AbsoluteUri); + } + if (Optional.IsDefined(Eula)) + { + writer.WritePropertyName("eula"u8); + writer.WriteStringValue(Eula); + } + writer.WriteEndObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunityGalleryImageData DeserializeCommunityGalleryImageData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +174,7 @@ internal static CommunityGalleryImageData DeserializeCommunityGalleryImageData(J Optional privacyStatementUri = default; Optional eula = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -200,8 +338,61 @@ internal static CommunityGalleryImageData DeserializeCommunityGalleryImageData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunityGalleryImageData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, Optional.ToNullable(hyperVGeneration), Optional.ToList(features), purchasePlan.Value, Optional.ToNullable(architecture), privacyStatementUri.Value, eula.Value); + return new CommunityGalleryImageData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, Optional.ToNullable(hyperVGeneration), Optional.ToList(features), purchasePlan.Value, Optional.ToNullable(architecture), privacyStatementUri.Value, eula.Value, serializedAdditionalRawData); + } + + CommunityGalleryImageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryImageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryImageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryImageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryImageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryImageData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryImageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.Serialization.cs index 65e28e58fa14..adfc18e7e1ea 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CommunityGalleryImageIdentifier + public partial class CommunityGalleryImageIdentifier : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunityGalleryImageIdentifier DeserializeCommunityGalleryImageIdentifier(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Publisher)) + { + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + } + if (Optional.IsDefined(Offer)) + { + writer.WritePropertyName("offer"u8); + writer.WriteStringValue(Offer); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunityGalleryImageIdentifier DeserializeCommunityGalleryImageIdentifier(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static CommunityGalleryImageIdentifier DeserializeCommunityGalleryImage Optional publisher = default; Optional offer = default; Optional sku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher"u8)) @@ -38,8 +82,61 @@ internal static CommunityGalleryImageIdentifier DeserializeCommunityGalleryImage sku = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunityGalleryImageIdentifier(publisher.Value, offer.Value, sku.Value); + return new CommunityGalleryImageIdentifier(publisher.Value, offer.Value, sku.Value, serializedAdditionalRawData); + } + + CommunityGalleryImageIdentifier IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryImageIdentifier(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryImageIdentifier IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryImageIdentifier(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryImageIdentifier model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryImageIdentifier(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryImageIdentifier(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.cs index c17286c5c0b5..1d56a2046125 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageIdentifier.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the community gallery image definition identifier. public partial class CommunityGalleryImageIdentifier { - /// Initializes a new instance of CommunityGalleryImageIdentifier. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CommunityGalleryImageIdentifier() { } - /// Initializes a new instance of CommunityGalleryImageIdentifier. + /// Initializes a new instance of . /// The name of the gallery image definition publisher. /// The name of the gallery image definition offer. /// The name of the gallery image definition SKU. - internal CommunityGalleryImageIdentifier(string publisher, string offer, string sku) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryImageIdentifier(string publisher, string offer, string sku, Dictionary serializedAdditionalRawData) { Publisher = publisher; Offer = offer; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the gallery image definition publisher. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.Serialization.cs index 197dd6085692..2003c60d8780 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class CommunityGalleryImageList + internal partial class CommunityGalleryImageList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunityGalleryImageList DeserializeCommunityGalleryImageList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunityGalleryImageList DeserializeCommunityGalleryImageList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static CommunityGalleryImageList DeserializeCommunityGalleryImageList(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunityGalleryImageList(value, nextLink.Value); + return new CommunityGalleryImageList(value, nextLink.Value, serializedAdditionalRawData); + } + + CommunityGalleryImageList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryImageList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryImageList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryImageList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryImageList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryImageList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryImageList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.cs index b0f3e11c392c..56b338f375f3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Community Gallery Images operation response. internal partial class CommunityGalleryImageList { - /// Initializes a new instance of CommunityGalleryImageList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of community gallery images. /// is null. internal CommunityGalleryImageList(IEnumerable value) @@ -26,13 +29,20 @@ internal CommunityGalleryImageList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of CommunityGalleryImageList. + /// Initializes a new instance of . /// A list of community gallery images. /// The uri to fetch the next page of community gallery images. Call ListNext() with this to fetch the next page of community gallery images. - internal CommunityGalleryImageList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryImageList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunityGalleryImageList() + { } /// A list of community gallery images. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionData.Serialization.cs index 8674dd521440..b6e8519454c6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionData.Serialization.cs @@ -6,16 +6,81 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; namespace Azure.ResourceManager.Compute { - public partial class CommunityGalleryImageVersionData + public partial class CommunityGalleryImageVersionData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunityGalleryImageVersionData DeserializeCommunityGalleryImageVersionData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PublishedOn)) + { + writer.WritePropertyName("publishedDate"u8); + writer.WriteStringValue(PublishedOn.Value, "O"); + } + if (Optional.IsDefined(EndOfLifeOn)) + { + writer.WritePropertyName("endOfLifeDate"u8); + writer.WriteStringValue(EndOfLifeOn.Value, "O"); + } + if (Optional.IsDefined(IsExcludedFromLatest)) + { + writer.WritePropertyName("excludeFromLatest"u8); + writer.WriteBooleanValue(IsExcludedFromLatest.Value); + } + if (Optional.IsDefined(StorageProfile)) + { + writer.WritePropertyName("storageProfile"u8); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } + } + writer.WriteEndObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunityGalleryImageVersionData DeserializeCommunityGalleryImageVersionData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +93,7 @@ internal static CommunityGalleryImageVersionData DeserializeCommunityGalleryImag Optional excludeFromLatest = default; Optional storageProfile = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -118,8 +184,61 @@ internal static CommunityGalleryImageVersionData DeserializeCommunityGalleryImag } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunityGalleryImageVersionData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(excludeFromLatest), storageProfile.Value); + return new CommunityGalleryImageVersionData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(excludeFromLatest), storageProfile.Value, serializedAdditionalRawData); + } + + CommunityGalleryImageVersionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryImageVersionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryImageVersionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryImageVersionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryImageVersionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryImageVersionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryImageVersionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.Serialization.cs index 036b27674452..ce90548755d8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class CommunityGalleryImageVersionList + internal partial class CommunityGalleryImageVersionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CommunityGalleryImageVersionList DeserializeCommunityGalleryImageVersionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CommunityGalleryImageVersionList DeserializeCommunityGalleryImageVersionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static CommunityGalleryImageVersionList DeserializeCommunityGalleryImag nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CommunityGalleryImageVersionList(value, nextLink.Value); + return new CommunityGalleryImageVersionList(value, nextLink.Value, serializedAdditionalRawData); + } + + CommunityGalleryImageVersionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryImageVersionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryImageVersionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryImageVersionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryImageVersionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryImageVersionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryImageVersionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.cs index 8b6b7dbd9433..92632ee9d3cb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryImageVersionList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Community Gallery Image versions operation response. internal partial class CommunityGalleryImageVersionList { - /// Initializes a new instance of CommunityGalleryImageVersionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of community gallery image versions. /// is null. internal CommunityGalleryImageVersionList(IEnumerable value) @@ -26,13 +29,20 @@ internal CommunityGalleryImageVersionList(IEnumerable Initializes a new instance of CommunityGalleryImageVersionList. + /// Initializes a new instance of . /// A list of community gallery image versions. /// The uri to fetch the next page of community gallery image versions. Call ListNext() with this to fetch the next page of community gallery image versions. - internal CommunityGalleryImageVersionList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryImageVersionList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommunityGalleryImageVersionList() + { } /// A list of community gallery image versions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.Serialization.cs index aa24af364643..ac861f08e712 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CommunityGalleryInfo : IUtf8JsonSerializable + public partial class CommunityGalleryInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PublisherUri)) { @@ -37,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNamePrefix"u8); writer.WriteStringValue(PublicNamePrefix); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommunityGalleryInfo DeserializeCommunityGalleryInfo(JsonElement element) + internal static CommunityGalleryInfo DeserializeCommunityGalleryInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +72,7 @@ internal static CommunityGalleryInfo DeserializeCommunityGalleryInfo(JsonElement Optional publicNamePrefix = default; Optional communityGalleryEnabled = default; Optional> publicNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisherUri"u8)) @@ -101,8 +122,61 @@ internal static CommunityGalleryInfo DeserializeCommunityGalleryInfo(JsonElement publicNames = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommunityGalleryInfo(publisherUri.Value, publisherContact.Value, eula.Value, publicNamePrefix.Value, Optional.ToNullable(communityGalleryEnabled), Optional.ToList(publicNames), serializedAdditionalRawData); + } + + CommunityGalleryInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommunityGalleryInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommunityGalleryInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommunityGalleryInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommunityGalleryInfo model) + { + if (model is null) + { + return null; } - return new CommunityGalleryInfo(publisherUri.Value, publisherContact.Value, eula.Value, publicNamePrefix.Value, Optional.ToNullable(communityGalleryEnabled), Optional.ToList(publicNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommunityGalleryInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommunityGalleryInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.cs index 411922656385..31d31577411b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CommunityGalleryInfo.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Information of community gallery if current gallery is shared to community. public partial class CommunityGalleryInfo { - /// Initializes a new instance of CommunityGalleryInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CommunityGalleryInfo() { PublicNames = new ChangeTrackingList(); } - /// Initializes a new instance of CommunityGalleryInfo. + /// Initializes a new instance of . /// The link to the publisher website. Visible to all users. /// Community gallery publisher support email. The email address of the publisher. Visible to all users. /// End-user license agreement for community gallery image. /// The prefix of the gallery name that will be displayed publicly. Visible to all users. /// Contains info about whether community gallery sharing is enabled. /// Community gallery public name list. - internal CommunityGalleryInfo(Uri publisherUri, string publisherContact, string eula, string publicNamePrefix, bool? communityGalleryEnabled, IReadOnlyList publicNames) + /// Keeps track of any properties unknown to the library. + internal CommunityGalleryInfo(Uri publisherUri, string publisherContact, string eula, string publicNamePrefix, bool? communityGalleryEnabled, IReadOnlyList publicNames, Dictionary serializedAdditionalRawData) { PublisherUri = publisherUri; PublisherContact = publisherContact; @@ -35,6 +39,7 @@ internal CommunityGalleryInfo(Uri publisherUri, string publisherContact, string PublicNamePrefix = publicNamePrefix; CommunityGalleryEnabled = communityGalleryEnabled; PublicNames = publicNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link to the publisher website. Visible to all users. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.Serialization.cs index bbf5db083376..52bb0d8370d4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.Serialization.cs @@ -5,16 +5,87 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeApiError + public partial class ComputeApiError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeApiError DeserializeComputeApiError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Innererror)) + { + writer.WritePropertyName("innererror"u8); + if (Innererror is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Innererror).Serialize(writer, options); + } + } + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeApiError DeserializeComputeApiError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +95,7 @@ internal static ComputeApiError DeserializeComputeApiError(JsonElement element) Optional code = default; Optional target = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("details"u8)) @@ -64,8 +136,61 @@ internal static ComputeApiError DeserializeComputeApiError(JsonElement element) message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeApiError(Optional.ToList(details), innererror.Value, code.Value, target.Value, message.Value); + return new ComputeApiError(Optional.ToList(details), innererror.Value, code.Value, target.Value, message.Value, serializedAdditionalRawData); + } + + ComputeApiError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeApiError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeApiError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeApiError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeApiError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeApiError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeApiError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.cs index 816ccca97877..1cc0416eac01 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiError.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.Compute.Models /// Api error. public partial class ComputeApiError { - /// Initializes a new instance of ComputeApiError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeApiError() { Details = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeApiError. + /// Initializes a new instance of . /// The Api error details. /// The Api inner error. /// The error code. /// The target of the particular error. /// The error message. - internal ComputeApiError(IReadOnlyList details, InnerError innererror, string code, string target, string message) + /// Keeps track of any properties unknown to the library. + internal ComputeApiError(IReadOnlyList details, InnerError innererror, string code, string target, string message, Dictionary serializedAdditionalRawData) { Details = details; Innererror = innererror; Code = code; Target = target; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Api error details. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.Serialization.cs index 36f104a6ca36..764bd20d83fb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeApiErrorBase + public partial class ComputeApiErrorBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeApiErrorBase DeserializeComputeApiErrorBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeApiErrorBase DeserializeComputeApiErrorBase(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ComputeApiErrorBase DeserializeComputeApiErrorBase(JsonElement e Optional code = default; Optional target = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -38,8 +82,61 @@ internal static ComputeApiErrorBase DeserializeComputeApiErrorBase(JsonElement e message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeApiErrorBase(code.Value, target.Value, message.Value); + return new ComputeApiErrorBase(code.Value, target.Value, message.Value, serializedAdditionalRawData); + } + + ComputeApiErrorBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeApiErrorBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeApiErrorBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeApiErrorBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeApiErrorBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeApiErrorBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeApiErrorBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.cs index 820aaa07c5a6..7894f21a8978 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeApiErrorBase.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Api error base. public partial class ComputeApiErrorBase { - /// Initializes a new instance of ComputeApiErrorBase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeApiErrorBase() { } - /// Initializes a new instance of ComputeApiErrorBase. + /// Initializes a new instance of . /// The error code. /// The target of the particular error. /// The error message. - internal ComputeApiErrorBase(string code, string target, string message) + /// Keeps track of any properties unknown to the library. + internal ComputeApiErrorBase(string code, string target, string message, Dictionary serializedAdditionalRawData) { Code = code; Target = target; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error code. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.Serialization.cs index 5b56fa008327..abf286c0bc85 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputePlan : IUtf8JsonSerializable + public partial class ComputePlan : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("promotionCode"u8); writer.WriteStringValue(PromotionCode); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputePlan DeserializeComputePlan(JsonElement element) + internal static ComputePlan DeserializeComputePlan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ComputePlan DeserializeComputePlan(JsonElement element) Optional publisher = default; Optional product = default; Optional promotionCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -70,8 +93,61 @@ internal static ComputePlan DeserializeComputePlan(JsonElement element) promotionCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputePlan(name.Value, publisher.Value, product.Value, promotionCode.Value, serializedAdditionalRawData); + } + + ComputePlan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePlan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePlan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePlan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePlan model) + { + if (model is null) + { + return null; } - return new ComputePlan(name.Value, publisher.Value, product.Value, promotionCode.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePlan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePlan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.cs index 9408e0e355bc..4fe70941f2c3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePlan.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. public partial class ComputePlan { - /// Initializes a new instance of ComputePlan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputePlan() { } - /// Initializes a new instance of ComputePlan. + /// Initializes a new instance of . /// The plan ID. /// The publisher ID. /// Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. /// The promotion code. - internal ComputePlan(string name, string publisher, string product, string promotionCode) + /// Keeps track of any properties unknown to the library. + internal ComputePlan(string name, string publisher, string product, string promotionCode, Dictionary serializedAdditionalRawData) { Name = name; Publisher = publisher; Product = product; PromotionCode = promotionCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The plan ID. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionData.Serialization.cs index 98b54c55a424..0fa233f021eb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionData.Serialization.cs @@ -5,32 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class ComputePrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class ComputePrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputePrivateEndpointConnectionData DeserializeComputePrivateEndpointConnectionData(JsonElement element) + internal static ComputePrivateEndpointConnectionData DeserializeComputePrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static ComputePrivateEndpointConnectionData DeserializeComputePrivateEn Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -107,8 +137,61 @@ internal static ComputePrivateEndpointConnectionData DeserializeComputePrivateEn } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputePrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ComputePrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new ComputePrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.Serialization.cs index eb520839672a..cf6e49e7ac04 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class ComputePrivateEndpointConnectionListResult + internal partial class ComputePrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputePrivateEndpointConnectionListResult DeserializeComputePrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputePrivateEndpointConnectionListResult DeserializeComputePrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ComputePrivateEndpointConnectionListResult DeserializeComputePri nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputePrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value); + return new ComputePrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ComputePrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.cs index ecfc519ee1af..dcdfe90a5c00 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// A list of private link resources. internal partial class ComputePrivateEndpointConnectionListResult { - /// Initializes a new instance of ComputePrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputePrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ComputePrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. /// The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - internal ComputePrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ComputePrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.Serialization.cs index c7d72f94d770..7f9b3970a3a5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.Serialization.cs @@ -5,17 +5,57 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputePrivateLinkResourceData + public partial class ComputePrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputePrivateLinkResourceData DeserializeComputePrivateLinkResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (var item in RequiredZoneNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputePrivateLinkResourceData DeserializeComputePrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +67,7 @@ internal static ComputePrivateLinkResourceData DeserializeComputePrivateLinkReso Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -102,8 +143,61 @@ internal static ComputePrivateLinkResourceData DeserializeComputePrivateLinkReso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputePrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + return new ComputePrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + ComputePrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePrivateLinkResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.cs index 860a181dc411..2ae92e164a79 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,14 +15,17 @@ namespace Azure.ResourceManager.Compute.Models /// A private link resource. public partial class ComputePrivateLinkResourceData : ResourceData { - /// Initializes a new instance of ComputePrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputePrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of ComputePrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,11 +33,13 @@ internal ComputePrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource DNS zone name. - internal ComputePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ComputePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.Serialization.cs index f6c5556b513e..187900c61fa8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class ComputePrivateLinkResourceListResult + internal partial class ComputePrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputePrivateLinkResourceListResult DeserializeComputePrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputePrivateLinkResourceListResult DeserializeComputePrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static ComputePrivateLinkResourceListResult DeserializeComputePrivateLi value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputePrivateLinkResourceListResult(Optional.ToList(value)); + return new ComputePrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ComputePrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.cs index b4e632a4bb21..793935c8f918 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// A list of private link resources. internal partial class ComputePrivateLinkResourceListResult { - /// Initializes a new instance of ComputePrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputePrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ComputePrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal ComputePrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ComputePrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.Serialization.cs index 437945ab9c70..e67dac7953cb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputePrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class ComputePrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputePrivateLinkServiceConnectionState DeserializeComputePrivateLinkServiceConnectionState(JsonElement element) + internal static ComputePrivateLinkServiceConnectionState DeserializeComputePrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ComputePrivateLinkServiceConnectionState DeserializeComputePriva Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static ComputePrivateLinkServiceConnectionState DeserializeComputePriva actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + ComputePrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new ComputePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.cs index efb2fccd5a8f..4fd9b0457b01 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class ComputePrivateLinkServiceConnectionState { - /// Initializes a new instance of ComputePrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputePrivateLinkServiceConnectionState() { } - /// Initializes a new instance of ComputePrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal ComputePrivateLinkServiceConnectionState(ComputePrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal ComputePrivateLinkServiceConnectionState(ComputePrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.Serialization.cs index 8b25fcf891bf..64d8cd34b868 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputePublicIPAddressSku : IUtf8JsonSerializable + public partial class ComputePublicIPAddressSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tier"u8); writer.WriteStringValue(Tier.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputePublicIPAddressSku DeserializeComputePublicIPAddressSku(JsonElement element) + internal static ComputePublicIPAddressSku DeserializeComputePublicIPAddressSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -56,8 +79,61 @@ internal static ComputePublicIPAddressSku DeserializeComputePublicIPAddressSku(J tier = new ComputePublicIPAddressSkuTier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputePublicIPAddressSku(Optional.ToNullable(name), Optional.ToNullable(tier), serializedAdditionalRawData); + } + + ComputePublicIPAddressSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputePublicIPAddressSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputePublicIPAddressSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputePublicIPAddressSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputePublicIPAddressSku model) + { + if (model is null) + { + return null; } - return new ComputePublicIPAddressSku(Optional.ToNullable(name), Optional.ToNullable(tier)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputePublicIPAddressSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputePublicIPAddressSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.cs index a2cf4b12120d..221c2f71cf5b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputePublicIPAddressSku.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. public partial class ComputePublicIPAddressSku { - /// Initializes a new instance of ComputePublicIPAddressSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputePublicIPAddressSku() { } - /// Initializes a new instance of ComputePublicIPAddressSku. + /// Initializes a new instance of . /// Specify public IP sku name. /// Specify public IP sku tier. - internal ComputePublicIPAddressSku(ComputePublicIPAddressSkuName? name, ComputePublicIPAddressSkuTier? tier) + /// Keeps track of any properties unknown to the library. + internal ComputePublicIPAddressSku(ComputePublicIPAddressSkuName? name, ComputePublicIPAddressSkuTier? tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specify public IP sku name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.Serialization.cs index a10809520cf7..f734c307b72c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourcePatch : IUtf8JsonSerializable + public partial class ComputeResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ComputeResourcePatch DeserializeComputeResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeResourcePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ComputeResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.cs index 9a98caaaca93..991df050b366 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourcePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// The Update Resource model definition. public partial class ComputeResourcePatch { - /// Initializes a new instance of ComputeResourcePatch. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeResourcePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal ComputeResourcePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.Serialization.cs index 71a570a565ff..ad32d0ae220f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSku + public partial class ComputeResourceSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeResourceSku DeserializeComputeResourceSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSku DeserializeComputeResourceSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +59,7 @@ internal static ComputeResourceSku DeserializeComputeResourceSku(JsonElement ele Optional> costs = default; Optional> capabilities = default; Optional> restrictions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -157,8 +185,61 @@ internal static ComputeResourceSku DeserializeComputeResourceSku(JsonElement ele restrictions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeResourceSku(resourceType.Value, name.Value, tier.Value, size.Value, family.Value, kind.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(apiVersions), Optional.ToList(costs), Optional.ToList(capabilities), Optional.ToList(restrictions)); + return new ComputeResourceSku(resourceType.Value, name.Value, tier.Value, size.Value, family.Value, kind.Value, capacity.Value, Optional.ToList(locations), Optional.ToList(locationInfo), Optional.ToList(apiVersions), Optional.ToList(costs), Optional.ToList(capabilities), Optional.ToList(restrictions), serializedAdditionalRawData); + } + + ComputeResourceSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.cs index eb582295b095..ae1d516f109e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSku.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes an available Compute SKU. public partial class ComputeResourceSku { - /// Initializes a new instance of ComputeResourceSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSku() { Locations = new ChangeTrackingList(); @@ -24,7 +28,7 @@ internal ComputeResourceSku() Restrictions = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeResourceSku. + /// Initializes a new instance of . /// The type of resource the SKU applies to. /// The name of SKU. /// Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. @@ -38,7 +42,8 @@ internal ComputeResourceSku() /// Metadata for retrieving price info. /// A name value pair to describe the capability. /// The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - internal ComputeResourceSku(string resourceType, string name, string tier, string size, string family, string kind, ComputeResourceSkuCapacity capacity, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList apiVersions, IReadOnlyList costs, IReadOnlyList capabilities, IReadOnlyList restrictions) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSku(string resourceType, string name, string tier, string size, string family, string kind, ComputeResourceSkuCapacity capacity, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList apiVersions, IReadOnlyList costs, IReadOnlyList capabilities, IReadOnlyList restrictions, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Name = name; @@ -53,6 +58,7 @@ internal ComputeResourceSku(string resourceType, string name, string tier, strin Costs = costs; Capabilities = capabilities; Restrictions = restrictions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of resource the SKU applies to. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.Serialization.cs index df96fbb50daf..45c2790f594a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSkuCapabilities + public partial class ComputeResourceSkuCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeResourceSkuCapabilities DeserializeComputeResourceSkuCapabilities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSkuCapabilities DeserializeComputeResourceSkuCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ComputeResourceSkuCapabilities DeserializeComputeResourceSkuCapa value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeResourceSkuCapabilities(name.Value, value.Value); + return new ComputeResourceSkuCapabilities(name.Value, value.Value, serializedAdditionalRawData); + } + + ComputeResourceSkuCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSkuCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSkuCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSkuCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSkuCapabilities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSkuCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSkuCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.cs index f7e234702271..9fc5371e7133 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapabilities.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes The SKU capabilities object. public partial class ComputeResourceSkuCapabilities { - /// Initializes a new instance of ComputeResourceSkuCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSkuCapabilities() { } - /// Initializes a new instance of ComputeResourceSkuCapabilities. + /// Initializes a new instance of . /// An invariant to describe the feature. /// An invariant if the feature is measured by quantity. - internal ComputeResourceSkuCapabilities(string name, string value) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSkuCapabilities(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An invariant to describe the feature. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.Serialization.cs index a3d7d47c442e..c6921641fc32 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSkuCapacity + public partial class ComputeResourceSkuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeResourceSkuCapacity DeserializeComputeResourceSkuCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSkuCapacity DeserializeComputeResourceSkuCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static ComputeResourceSkuCapacity DeserializeComputeResourceSkuCapacity Optional maximum = default; Optional @default = default; Optional scaleType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -60,8 +89,61 @@ internal static ComputeResourceSkuCapacity DeserializeComputeResourceSkuCapacity scaleType = property.Value.GetString().ToComputeResourceSkuCapacityScaleType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeResourceSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType)); + return new ComputeResourceSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(@default), Optional.ToNullable(scaleType), serializedAdditionalRawData); + } + + ComputeResourceSkuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSkuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSkuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSkuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSkuCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSkuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSkuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.cs index cb49a5299d2a..5f7a88d657f0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuCapacity.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes scaling information of a SKU. public partial class ComputeResourceSkuCapacity { - /// Initializes a new instance of ComputeResourceSkuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSkuCapacity() { } - /// Initializes a new instance of ComputeResourceSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. /// The scale type applicable to the sku. - internal ComputeResourceSkuCapacity(long? minimum, long? maximum, long? @default, ComputeResourceSkuCapacityScaleType? scaleType) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSkuCapacity(long? minimum, long? maximum, long? @default, ComputeResourceSkuCapacityScaleType? scaleType, Dictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; Default = @default; ScaleType = scaleType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum capacity. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.Serialization.cs index b7f5597e530a..497e4c8c0feb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.Serialization.cs @@ -5,14 +5,171 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSkuLocationInfo + public partial class ComputeResourceSkuLocationInfo : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSkuLocationInfo DeserializeComputeResourceSkuLocationInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional> zones = default; + Optional> zoneDetails = default; + Optional> extendedLocations = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("zoneDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComputeResourceSkuZoneDetails.DeserializeComputeResourceSkuZoneDetails(item)); + } + zoneDetails = array; + continue; + } + if (property.NameEquals("extendedLocations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + extendedLocations = array; + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ExtendedLocationType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeResourceSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(zoneDetails), Optional.ToList(extendedLocations), Optional.ToNullable(type), serializedAdditionalRawData); + } + + ComputeResourceSkuLocationInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSkuLocationInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSkuLocationInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSkuLocationInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSkuLocationInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSkuLocationInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSkuLocationInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.cs index b019aa35291b..2a07b36f1a5b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuLocationInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes an available Compute SKU Location Information. public partial class ComputeResourceSkuLocationInfo { - /// Initializes a new instance of ComputeResourceSkuLocationInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSkuLocationInfo() { Zones = new ChangeTrackingList(); @@ -22,19 +26,21 @@ internal ComputeResourceSkuLocationInfo() ExtendedLocations = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeResourceSkuLocationInfo. + /// Initializes a new instance of . /// Location of the SKU. /// List of availability zones where the SKU is supported. /// Details of capabilities available to a SKU in specific zones. /// The names of extended locations. /// The type of the extended location. - internal ComputeResourceSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList zoneDetails, IReadOnlyList extendedLocations, ExtendedLocationType? extendedLocationType) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList zoneDetails, IReadOnlyList extendedLocations, ExtendedLocationType? extendedLocationType, Dictionary serializedAdditionalRawData) { Location = location; Zones = zones; ZoneDetails = zoneDetails; ExtendedLocations = extendedLocations; ExtendedLocationType = extendedLocationType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of the SKU. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.Serialization.cs index 968fe337c177..15baaa4d0b58 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSkuRestrictionInfo + public partial class ComputeResourceSkuRestrictionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeResourceSkuRestrictionInfo DeserializeComputeResourceSkuRestrictionInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSkuRestrictionInfo DeserializeComputeResourceSkuRestrictionInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> locations = default; Optional> zones = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("locations"u8)) @@ -51,8 +79,61 @@ internal static ComputeResourceSkuRestrictionInfo DeserializeComputeResourceSkuR zones = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeResourceSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones)); + return new ComputeResourceSkuRestrictionInfo(Optional.ToList(locations), Optional.ToList(zones), serializedAdditionalRawData); + } + + ComputeResourceSkuRestrictionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSkuRestrictionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSkuRestrictionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSkuRestrictionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSkuRestrictionInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSkuRestrictionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSkuRestrictionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.cs index 77400a91ff7a..7e004978f0a2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictionInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Compute.Models /// Describes an available Compute SKU Restriction Information. public partial class ComputeResourceSkuRestrictionInfo { - /// Initializes a new instance of ComputeResourceSkuRestrictionInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSkuRestrictionInfo() { Locations = new ChangeTrackingList(); Zones = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeResourceSkuRestrictionInfo. + /// Initializes a new instance of . /// Locations where the SKU is restricted. /// List of availability zones where the SKU is restricted. - internal ComputeResourceSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones, Dictionary serializedAdditionalRawData) { Locations = locations; Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Locations where the SKU is restricted. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.Serialization.cs index eb9cc4203042..5b443304a3bb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSkuRestrictions + public partial class ComputeResourceSkuRestrictions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeResourceSkuRestrictions DeserializeComputeResourceSkuRestrictions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSkuRestrictions DeserializeComputeResourceSkuRestrictions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static ComputeResourceSkuRestrictions DeserializeComputeResourceSkuRest Optional> values = default; Optional restrictionInfo = default; Optional reasonCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -66,8 +94,61 @@ internal static ComputeResourceSkuRestrictions DeserializeComputeResourceSkuRest reasonCode = property.Value.GetString().ToComputeResourceSkuRestrictionsReasonCode(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeResourceSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode)); + return new ComputeResourceSkuRestrictions(Optional.ToNullable(type), Optional.ToList(values), restrictionInfo.Value, Optional.ToNullable(reasonCode), serializedAdditionalRawData); + } + + ComputeResourceSkuRestrictions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSkuRestrictions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSkuRestrictions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSkuRestrictions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSkuRestrictions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSkuRestrictions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSkuRestrictions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.cs index af172308e0cb..2ebb555158ca 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuRestrictions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Compute.Models /// Describes scaling information of a SKU. public partial class ComputeResourceSkuRestrictions { - /// Initializes a new instance of ComputeResourceSkuRestrictions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSkuRestrictions() { Values = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeResourceSkuRestrictions. + /// Initializes a new instance of . /// The type of restrictions. /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. /// The information about the restriction where the SKU cannot be used. /// The reason for restriction. - internal ComputeResourceSkuRestrictions(ComputeResourceSkuRestrictionsType? restrictionsType, IReadOnlyList values, ComputeResourceSkuRestrictionInfo restrictionInfo, ComputeResourceSkuRestrictionsReasonCode? reasonCode) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSkuRestrictions(ComputeResourceSkuRestrictionsType? restrictionsType, IReadOnlyList values, ComputeResourceSkuRestrictionInfo restrictionInfo, ComputeResourceSkuRestrictionsReasonCode? reasonCode, Dictionary serializedAdditionalRawData) { RestrictionsType = restrictionsType; Values = values; RestrictionInfo = restrictionInfo; ReasonCode = reasonCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of restrictions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.Serialization.cs index 3fb45746e4ed..c4f15f54284c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeResourceSkuZoneDetails + public partial class ComputeResourceSkuZoneDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeResourceSkuZoneDetails DeserializeComputeResourceSkuZoneDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeResourceSkuZoneDetails DeserializeComputeResourceSkuZoneDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> name = default; Optional> capabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -51,8 +79,61 @@ internal static ComputeResourceSkuZoneDetails DeserializeComputeResourceSkuZoneD capabilities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeResourceSkuZoneDetails(Optional.ToList(name), Optional.ToList(capabilities)); + return new ComputeResourceSkuZoneDetails(Optional.ToList(name), Optional.ToList(capabilities), serializedAdditionalRawData); + } + + ComputeResourceSkuZoneDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeResourceSkuZoneDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeResourceSkuZoneDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeResourceSkuZoneDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeResourceSkuZoneDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeResourceSkuZoneDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeResourceSkuZoneDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.cs index 4fe24a5796f4..9be788f68a40 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeResourceSkuZoneDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Compute.Models /// Describes The zonal capabilities of a SKU. public partial class ComputeResourceSkuZoneDetails { - /// Initializes a new instance of ComputeResourceSkuZoneDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeResourceSkuZoneDetails() { Name = new ChangeTrackingList(); Capabilities = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeResourceSkuZoneDetails. + /// Initializes a new instance of . /// The set of zones that the SKU is available in with the specified capabilities. /// A list of capabilities that are available for the SKU in the specified list of zones. - internal ComputeResourceSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities) + /// Keeps track of any properties unknown to the library. + internal ComputeResourceSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities, Dictionary serializedAdditionalRawData) { Name = name; Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The set of zones that the SKU is available in with the specified capabilities. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.Serialization.cs index fccc66d252c8..af15b3d09616 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeScheduledEventsProfile : IUtf8JsonSerializable + public partial class ComputeScheduledEventsProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TerminateNotificationProfile)) { writer.WritePropertyName("terminateNotificationProfile"u8); - writer.WriteObjectValue(TerminateNotificationProfile); + if (TerminateNotificationProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TerminateNotificationProfile).Serialize(writer, options); + } } if (Optional.IsDefined(OSImageNotificationProfile)) { writer.WritePropertyName("osImageNotificationProfile"u8); - writer.WriteObjectValue(OSImageNotificationProfile); + if (OSImageNotificationProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSImageNotificationProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ComputeScheduledEventsProfile DeserializeComputeScheduledEventsProfile(JsonElement element) + internal static ComputeScheduledEventsProfile DeserializeComputeScheduledEventsProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional terminateNotificationProfile = default; Optional osImageNotificationProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("terminateNotificationProfile"u8)) @@ -56,8 +93,61 @@ internal static ComputeScheduledEventsProfile DeserializeComputeScheduledEventsP osImageNotificationProfile = OSImageNotificationProfile.DeserializeOSImageNotificationProfile(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeScheduledEventsProfile(terminateNotificationProfile.Value, osImageNotificationProfile.Value, serializedAdditionalRawData); + } + + ComputeScheduledEventsProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeScheduledEventsProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeScheduledEventsProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeScheduledEventsProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeScheduledEventsProfile model) + { + if (model is null) + { + return null; } - return new ComputeScheduledEventsProfile(terminateNotificationProfile.Value, osImageNotificationProfile.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeScheduledEventsProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeScheduledEventsProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.cs index 8b290b245739..440ee781ea32 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeScheduledEventsProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The ComputeScheduledEventsProfile. public partial class ComputeScheduledEventsProfile { - /// Initializes a new instance of ComputeScheduledEventsProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeScheduledEventsProfile() { } - /// Initializes a new instance of ComputeScheduledEventsProfile. + /// Initializes a new instance of . /// Specifies Terminate Scheduled Event related configurations. /// Specifies OS Image Scheduled Event related configurations. - internal ComputeScheduledEventsProfile(TerminateNotificationProfile terminateNotificationProfile, OSImageNotificationProfile osImageNotificationProfile) + /// Keeps track of any properties unknown to the library. + internal ComputeScheduledEventsProfile(TerminateNotificationProfile terminateNotificationProfile, OSImageNotificationProfile osImageNotificationProfile, Dictionary serializedAdditionalRawData) { TerminateNotificationProfile = terminateNotificationProfile; OSImageNotificationProfile = osImageNotificationProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies Terminate Scheduled Event related configurations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs index 5703a699f7c4..508fa9dc7918 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeSecurityPostureReference : IUtf8JsonSerializable + public partial class ComputeSecurityPostureReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -28,21 +35,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExcludeExtensions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputeSecurityPostureReference DeserializeComputeSecurityPostureReference(JsonElement element) + internal static ComputeSecurityPostureReference DeserializeComputeSecurityPostureReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional> excludeExtensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -68,8 +97,61 @@ internal static ComputeSecurityPostureReference DeserializeComputeSecurityPostur excludeExtensions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeSecurityPostureReference(id.Value, Optional.ToList(excludeExtensions), serializedAdditionalRawData); + } + + ComputeSecurityPostureReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeSecurityPostureReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeSecurityPostureReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeSecurityPostureReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeSecurityPostureReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeSecurityPostureReference(Response response) + { + if (response is null) + { + return null; } - return new ComputeSecurityPostureReference(id.Value, Optional.ToList(excludeExtensions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeSecurityPostureReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs index f3bf3605f15b..91834e0d0ab9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01. public partial class ComputeSecurityPostureReference { - /// Initializes a new instance of ComputeSecurityPostureReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeSecurityPostureReference() { ExcludeExtensions = new ChangeTrackingList(); } - /// Initializes a new instance of ComputeSecurityPostureReference. + /// Initializes a new instance of . /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest. /// List of virtual machine extensions to exclude when applying the Security Posture. - internal ComputeSecurityPostureReference(ResourceIdentifier id, IList excludeExtensions) + /// Keeps track of any properties unknown to the library. + internal ComputeSecurityPostureReference(ResourceIdentifier id, IList excludeExtensions, Dictionary serializedAdditionalRawData) { Id = id; ExcludeExtensions = excludeExtensions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.Serialization.cs index 5e5a75f78a3e..6a7108a81224 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeSku : IUtf8JsonSerializable + public partial class ComputeSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("capacity"u8); writer.WriteNumberValue(Capacity.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputeSku DeserializeComputeSku(JsonElement element) + internal static ComputeSku DeserializeComputeSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ComputeSku DeserializeComputeSku(JsonElement element) Optional name = default; Optional tier = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +86,61 @@ internal static ComputeSku DeserializeComputeSku(JsonElement element) capacity = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeSku(name.Value, tier.Value, Optional.ToNullable(capacity), serializedAdditionalRawData); + } + + ComputeSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeSku model) + { + if (model is null) + { + return null; } - return new ComputeSku(name.Value, tier.Value, Optional.ToNullable(capacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.cs index b4dc0c4f00ec..935806430af8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSku.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set is currently on, you need to deallocate the VMs in the scale set before you modify the SKU name. public partial class ComputeSku { - /// Initializes a new instance of ComputeSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeSku() { } - /// Initializes a new instance of ComputeSku. + /// Initializes a new instance of . /// The sku name. /// Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. /// Specifies the number of virtual machines in the scale set. - internal ComputeSku(string name, string tier, long? capacity) + /// Keeps track of any properties unknown to the library. + internal ComputeSku(string name, string tier, long? capacity, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The sku name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.Serialization.cs index ebf8cec4de14..e29db34a013e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeSubResourceData : IUtf8JsonSerializable + public partial class ComputeSubResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputeSubResourceData DeserializeComputeSubResourceData(JsonElement element) + internal static ComputeSubResourceData DeserializeComputeSubResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -36,8 +59,61 @@ internal static ComputeSubResourceData DeserializeComputeSubResourceData(JsonEle id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeSubResourceData(id.Value, serializedAdditionalRawData); + } + + ComputeSubResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeSubResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeSubResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeSubResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeSubResourceData model) + { + if (model is null) + { + return null; } - return new ComputeSubResourceData(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeSubResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeSubResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.cs index 25e6d201f1a7..8313a1f97273 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Compute.Models /// The ComputeSubResourceData. public partial class ComputeSubResourceData { - /// Initializes a new instance of ComputeSubResourceData. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeSubResourceData() { } - /// Initializes a new instance of ComputeSubResourceData. + /// Initializes a new instance of . /// Resource Id. - internal ComputeSubResourceData(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal ComputeSubResourceData(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.Serialization.cs index 891db829a988..26df87d5325a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.Serialization.cs @@ -5,37 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeSubResourceDataWithColocationStatus : IUtf8JsonSerializable + public partial class ComputeSubResourceDataWithColocationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ColocationStatus)) { writer.WritePropertyName("colocationStatus"u8); - writer.WriteObjectValue(ColocationStatus); + if (ColocationStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ColocationStatus).Serialize(writer, options); + } } if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputeSubResourceDataWithColocationStatus DeserializeComputeSubResourceDataWithColocationStatus(JsonElement element) + internal static ComputeSubResourceDataWithColocationStatus DeserializeComputeSubResourceDataWithColocationStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional colocationStatus = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("colocationStatus"u8)) @@ -56,8 +86,61 @@ internal static ComputeSubResourceDataWithColocationStatus DeserializeComputeSub id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeSubResourceDataWithColocationStatus(id.Value, colocationStatus.Value, serializedAdditionalRawData); + } + + ComputeSubResourceDataWithColocationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeSubResourceDataWithColocationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeSubResourceDataWithColocationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeSubResourceDataWithColocationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeSubResourceDataWithColocationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeSubResourceDataWithColocationStatus(Response response) + { + if (response is null) + { + return null; } - return new ComputeSubResourceDataWithColocationStatus(id.Value, colocationStatus.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeSubResourceDataWithColocationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.cs index 75cd793032bd..c2e77b745804 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSubResourceDataWithColocationStatus.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,15 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// The ComputeSubResourceDataWithColocationStatus. public partial class ComputeSubResourceDataWithColocationStatus : ComputeWriteableSubResourceData { - /// Initializes a new instance of ComputeSubResourceDataWithColocationStatus. + /// Initializes a new instance of . public ComputeSubResourceDataWithColocationStatus() { } - /// Initializes a new instance of ComputeSubResourceDataWithColocationStatus. + /// Initializes a new instance of . /// Resource Id. /// Describes colocation status of a resource in the Proximity Placement Group. - internal ComputeSubResourceDataWithColocationStatus(ResourceIdentifier id, InstanceViewStatus colocationStatus) : base(id) + /// Keeps track of any properties unknown to the library. + internal ComputeSubResourceDataWithColocationStatus(ResourceIdentifier id, InstanceViewStatus colocationStatus, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { ColocationStatus = colocationStatus; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.Serialization.cs index a175a81c61e9..0ad4d8ba5d09 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeUsage + public partial class ComputeUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeUsage DeserializeComputeUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue); + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit); + writer.WritePropertyName("name"u8); + if (Name is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Name).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeUsage DeserializeComputeUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +65,7 @@ internal static ComputeUsage DeserializeComputeUsage(JsonElement element) int currentValue = default; long limit = default; ComputeUsageName name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("unit"u8)) @@ -44,8 +88,61 @@ internal static ComputeUsage DeserializeComputeUsage(JsonElement element) name = ComputeUsageName.DeserializeComputeUsageName(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeUsage(unit, currentValue, limit, name); + return new ComputeUsage(unit, currentValue, limit, name, serializedAdditionalRawData); + } + + ComputeUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.cs index 95e55dcb73a4..5a353dcf3794 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsage.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes Compute Resource Usage. public partial class ComputeUsage { - /// Initializes a new instance of ComputeUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The current usage of the resource. /// The maximum permitted usage of the resource. /// The name of the type of usage. @@ -28,17 +32,24 @@ internal ComputeUsage(int currentValue, long limit, ComputeUsageName name) Name = name; } - /// Initializes a new instance of ComputeUsage. + /// Initializes a new instance of . /// An enum describing the unit of usage measurement. /// The current usage of the resource. /// The maximum permitted usage of the resource. /// The name of the type of usage. - internal ComputeUsage(ComputeUsageUnit unit, int currentValue, long limit, ComputeUsageName name) + /// Keeps track of any properties unknown to the library. + internal ComputeUsage(ComputeUsageUnit unit, int currentValue, long limit, ComputeUsageName name, Dictionary serializedAdditionalRawData) { Unit = unit; CurrentValue = currentValue; Limit = limit; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ComputeUsage() + { } /// An enum describing the unit of usage measurement. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.Serialization.cs index 9c4750a5a0e4..f7404f067ee3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeUsageName + public partial class ComputeUsageName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ComputeUsageName DeserializeComputeUsageName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ComputeUsageName DeserializeComputeUsageName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional localizedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +71,61 @@ internal static ComputeUsageName DeserializeComputeUsageName(JsonElement element localizedValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ComputeUsageName(value.Value, localizedValue.Value); + return new ComputeUsageName(value.Value, localizedValue.Value, serializedAdditionalRawData); + } + + ComputeUsageName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeUsageName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeUsageName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeUsageName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeUsageName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeUsageName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeUsageName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.cs index c5a27ebae598..787b4b97c71a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeUsageName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The Usage Names. public partial class ComputeUsageName { - /// Initializes a new instance of ComputeUsageName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ComputeUsageName() { } - /// Initializes a new instance of ComputeUsageName. + /// Initializes a new instance of . /// The name of the resource. /// The localized name of the resource. - internal ComputeUsageName(string value, string localizedValue) + /// Keeps track of any properties unknown to the library. + internal ComputeUsageName(string value, string localizedValue, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.Serialization.cs index d932d05e51d1..36e298e0c0a7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ComputeWriteableSubResourceData : IUtf8JsonSerializable + public partial class ComputeWriteableSubResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComputeWriteableSubResourceData DeserializeComputeWriteableSubResourceData(JsonElement element) + internal static ComputeWriteableSubResourceData DeserializeComputeWriteableSubResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static ComputeWriteableSubResourceData DeserializeComputeWriteableSubRe id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComputeWriteableSubResourceData(id.Value, serializedAdditionalRawData); + } + + ComputeWriteableSubResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComputeWriteableSubResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComputeWriteableSubResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComputeWriteableSubResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComputeWriteableSubResourceData model) + { + if (model is null) + { + return null; } - return new ComputeWriteableSubResourceData(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComputeWriteableSubResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComputeWriteableSubResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.cs index 54bccafef584..bfc3314e4234 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeWriteableSubResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Compute.Models /// The ComputeWriteableSubResourceData. public partial class ComputeWriteableSubResourceData { - /// Initializes a new instance of ComputeWriteableSubResourceData. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ComputeWriteableSubResourceData() { } - /// Initializes a new instance of ComputeWriteableSubResourceData. + /// Initializes a new instance of . /// Resource Id. - internal ComputeWriteableSubResourceData(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal ComputeWriteableSubResourceData(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.Serialization.cs index 1ad58d720e8f..629e50f48bee 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class CopyCompletionError : IUtf8JsonSerializable + public partial class CopyCompletionError : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("errorCode"u8); writer.WriteStringValue(ErrorCode.ToString()); writer.WritePropertyName("errorMessage"u8); writer.WriteStringValue(ErrorMessage); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CopyCompletionError DeserializeCopyCompletionError(JsonElement element) + internal static CopyCompletionError DeserializeCopyCompletionError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } CopyCompletionErrorReason errorCode = default; string errorMessage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errorCode"u8)) @@ -42,8 +65,61 @@ internal static CopyCompletionError DeserializeCopyCompletionError(JsonElement e errorMessage = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CopyCompletionError(errorCode, errorMessage, serializedAdditionalRawData); + } + + CopyCompletionError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopyCompletionError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyCompletionError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyCompletionError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopyCompletionError model) + { + if (model is null) + { + return null; } - return new CopyCompletionError(errorCode, errorMessage); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopyCompletionError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopyCompletionError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.cs index 03d91ef070d4..66e531e9ee4b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CopyCompletionError.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Indicates the error details if the background copy of a resource created via the CopyStart operation fails. public partial class CopyCompletionError { - /// Initializes a new instance of CopyCompletionError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicates the error code if the background copy of a resource created via the CopyStart operation fails. /// Indicates the error message if the background copy of a resource created via the CopyStart operation fails. /// is null. @@ -25,6 +29,22 @@ public CopyCompletionError(CopyCompletionErrorReason errorCode, string errorMess ErrorMessage = errorMessage; } + /// Initializes a new instance of . + /// Indicates the error code if the background copy of a resource created via the CopyStart operation fails. + /// Indicates the error message if the background copy of a resource created via the CopyStart operation fails. + /// Keeps track of any properties unknown to the library. + internal CopyCompletionError(CopyCompletionErrorReason errorCode, string errorMessage, Dictionary serializedAdditionalRawData) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CopyCompletionError() + { + } + /// Indicates the error code if the background copy of a resource created via the CopyStart operation fails. public CopyCompletionErrorReason ErrorCode { get; set; } /// Indicates the error message if the background copy of a resource created via the CopyStart operation fails. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.Serialization.cs index 793cb42227d5..faf99221f423 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DataDiskImage : IUtf8JsonSerializable + public partial class DataDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataDiskImage DeserializeDataDiskImage(JsonElement element) + internal static DataDiskImage DeserializeDataDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional lun = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -36,8 +59,61 @@ internal static DataDiskImage DeserializeDataDiskImage(JsonElement element) lun = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataDiskImage(Optional.ToNullable(lun), serializedAdditionalRawData); + } + + DataDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataDiskImage model) + { + if (model is null) + { + return null; } - return new DataDiskImage(Optional.ToNullable(lun)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataDiskImage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.cs index 187b314c5371..44dee663b9fe 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImage.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains the data disk images information. public partial class DataDiskImage { - /// Initializes a new instance of DataDiskImage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataDiskImage() { } - /// Initializes a new instance of DataDiskImage. + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. - internal DataDiskImage(int? lun) + /// Keeps track of any properties unknown to the library. + internal DataDiskImage(int? lun, Dictionary serializedAdditionalRawData) { Lun = lun; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.Serialization.cs index 7dbb74b8d63e..4f3cc8ee38f9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DataDiskImageEncryption : IUtf8JsonSerializable + public partial class DataDiskImageEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lun"u8); writer.WriteNumberValue(Lun); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskEncryptionSetId"u8); writer.WriteStringValue(DiskEncryptionSetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataDiskImageEncryption DeserializeDataDiskImageEncryption(JsonElement element) + internal static DataDiskImageEncryption DeserializeDataDiskImageEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int lun = default; Optional diskEncryptionSetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -49,8 +72,61 @@ internal static DataDiskImageEncryption DeserializeDataDiskImageEncryption(JsonE diskEncryptionSetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataDiskImageEncryption(diskEncryptionSetId.Value, lun, serializedAdditionalRawData); + } + + DataDiskImageEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataDiskImageEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataDiskImageEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataDiskImageEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataDiskImageEncryption model) + { + if (model is null) + { + return null; } - return new DataDiskImageEncryption(diskEncryptionSetId.Value, lun); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataDiskImageEncryption(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataDiskImageEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.cs index 58c76064ca22..67ed89f11978 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DataDiskImageEncryption.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,21 +14,27 @@ namespace Azure.ResourceManager.Compute.Models /// Contains encryption settings for a data disk image. public partial class DataDiskImageEncryption : DiskImageEncryption { - /// Initializes a new instance of DataDiskImageEncryption. + /// Initializes a new instance of . /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. public DataDiskImageEncryption(int lun) { Lun = lun; } - /// Initializes a new instance of DataDiskImageEncryption. + /// Initializes a new instance of . /// A relative URI containing the resource ID of the disk encryption set. /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - internal DataDiskImageEncryption(ResourceIdentifier diskEncryptionSetId, int lun) : base(diskEncryptionSetId) + /// Keeps track of any properties unknown to the library. + internal DataDiskImageEncryption(ResourceIdentifier diskEncryptionSetId, int lun, Dictionary serializedAdditionalRawData) : base(diskEncryptionSetId, serializedAdditionalRawData) { Lun = lun; } + /// Initializes a new instance of for deserialization. + internal DataDiskImageEncryption() + { + } + /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. public int Lun { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.Serialization.cs index f4d37c0b6b00..637c7a947e63 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DedicatedHostAllocatableVm + public partial class DedicatedHostAllocatableVm : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostAllocatableVm DeserializeDedicatedHostAllocatableVm(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(VmSize)) + { + writer.WritePropertyName("vmSize"u8); + writer.WriteStringValue(VmSize); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostAllocatableVm DeserializeDedicatedHostAllocatableVm(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vmSize = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmSize"u8)) @@ -36,8 +75,61 @@ internal static DedicatedHostAllocatableVm DeserializeDedicatedHostAllocatableVm count = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostAllocatableVm(vmSize.Value, Optional.ToNullable(count)); + return new DedicatedHostAllocatableVm(vmSize.Value, Optional.ToNullable(count), serializedAdditionalRawData); + } + + DedicatedHostAllocatableVm IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostAllocatableVm(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostAllocatableVm IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostAllocatableVm(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostAllocatableVm model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostAllocatableVm(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostAllocatableVm(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.cs index 58862bd3f278..74fb78fe5e52 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAllocatableVm.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Represents the dedicated host unutilized capacity in terms of a specific VM size. public partial class DedicatedHostAllocatableVm { - /// Initializes a new instance of DedicatedHostAllocatableVm. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DedicatedHostAllocatableVm() { } - /// Initializes a new instance of DedicatedHostAllocatableVm. + /// Initializes a new instance of . /// VM size in terms of which the unutilized capacity is represented. /// Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. - internal DedicatedHostAllocatableVm(string vmSize, double? count) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostAllocatableVm(string vmSize, double? count, Dictionary serializedAdditionalRawData) { VmSize = vmSize; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// VM size in terms of which the unutilized capacity is represented. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.Serialization.cs index 5f87fca44235..fac82eff1cd3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class DedicatedHostAvailableCapacity + internal partial class DedicatedHostAvailableCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostAvailableCapacity DeserializeDedicatedHostAvailableCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AllocatableVms)) + { + writer.WritePropertyName("allocatableVMs"u8); + writer.WriteStartArray(); + foreach (var item in AllocatableVms) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostAvailableCapacity DeserializeDedicatedHostAvailableCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> allocatableVms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allocatableVMs"u8)) @@ -36,8 +81,61 @@ internal static DedicatedHostAvailableCapacity DeserializeDedicatedHostAvailable allocatableVms = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostAvailableCapacity(Optional.ToList(allocatableVms)); + return new DedicatedHostAvailableCapacity(Optional.ToList(allocatableVms), serializedAdditionalRawData); + } + + DedicatedHostAvailableCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostAvailableCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostAvailableCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostAvailableCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostAvailableCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostAvailableCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostAvailableCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.cs index cd660e7aa908..5d4d4dfb2e20 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostAvailableCapacity.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Dedicated host unutilized capacity. internal partial class DedicatedHostAvailableCapacity { - /// Initializes a new instance of DedicatedHostAvailableCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DedicatedHostAvailableCapacity() { AllocatableVms = new ChangeTrackingList(); } - /// Initializes a new instance of DedicatedHostAvailableCapacity. + /// Initializes a new instance of . /// The unutilized capacity of the dedicated host represented in terms of each VM size that is allowed to be deployed to the dedicated host. - internal DedicatedHostAvailableCapacity(IReadOnlyList allocatableVms) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostAvailableCapacity(IReadOnlyList allocatableVms, Dictionary serializedAdditionalRawData) { AllocatableVms = allocatableVms; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unutilized capacity of the dedicated host represented in terms of each VM size that is allowed to be deployed to the dedicated host. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs index b7c24ee643f6..9de7fdbabf60 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class DedicatedHostData : IUtf8JsonSerializable + public partial class DedicatedHostData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -53,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LicenseType.Value.ToSerialString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DedicatedHostData DeserializeDedicatedHostData(JsonElement element) + internal static DedicatedHostData DeserializeDedicatedHostData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +105,7 @@ internal static DedicatedHostData DeserializeDedicatedHostData(JsonElement eleme Optional provisioningState = default; Optional instanceView = default; Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -218,8 +246,61 @@ internal static DedicatedHostData DeserializeDedicatedHostData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DedicatedHostData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, Optional.ToNullable(platformFaultDomain), Optional.ToNullable(autoReplaceOnFailure), hostId.Value, Optional.ToList(virtualMachines), Optional.ToNullable(licenseType), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + DedicatedHostData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostData(Response response) + { + if (response is null) + { + return null; } - return new DedicatedHostData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, Optional.ToNullable(platformFaultDomain), Optional.ToNullable(autoReplaceOnFailure), hostId.Value, Optional.ToList(virtualMachines), Optional.ToNullable(licenseType), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value, Optional.ToNullable(timeCreated)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs index 5be183b34b08..73f4f5d7a3be 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class DedicatedHostGroupData : IUtf8JsonSerializable + public partial class DedicatedHostGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -57,14 +64,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DedicatedHostGroupData DeserializeDedicatedHostGroupData(JsonElement element) + internal static DedicatedHostGroupData DeserializeDedicatedHostGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +109,7 @@ internal static DedicatedHostGroupData DeserializeDedicatedHostGroupData(JsonEle Optional instanceView = default; Optional supportAutomaticPlacement = default; Optional additionalCapabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -202,8 +231,61 @@ internal static DedicatedHostGroupData DeserializeDedicatedHostGroupData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DedicatedHostGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(hosts), instanceView.Value, Optional.ToNullable(supportAutomaticPlacement), additionalCapabilities.Value, serializedAdditionalRawData); + } + + DedicatedHostGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostGroupData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostGroupData(Response response) + { + if (response is null) + { + return null; } - return new DedicatedHostGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(hosts), instanceView.Value, Optional.ToNullable(supportAutomaticPlacement), additionalCapabilities.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.Serialization.cs index 818705b2ca28..72d9ef959a25 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class DedicatedHostGroupInstanceView + internal partial class DedicatedHostGroupInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostGroupInstanceView DeserializeDedicatedHostGroupInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"u8); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostGroupInstanceView DeserializeDedicatedHostGroupInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> hosts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hosts"u8)) @@ -36,8 +81,61 @@ internal static DedicatedHostGroupInstanceView DeserializeDedicatedHostGroupInst hosts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostGroupInstanceView(Optional.ToList(hosts)); + return new DedicatedHostGroupInstanceView(Optional.ToList(hosts), serializedAdditionalRawData); + } + + DedicatedHostGroupInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostGroupInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostGroupInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostGroupInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostGroupInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostGroupInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostGroupInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.cs index ec31a8578838..bf2177da71f5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// The DedicatedHostGroupInstanceView. internal partial class DedicatedHostGroupInstanceView { - /// Initializes a new instance of DedicatedHostGroupInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DedicatedHostGroupInstanceView() { Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of DedicatedHostGroupInstanceView. + /// Initializes a new instance of . /// List of instance view of the dedicated hosts under the dedicated host group. - internal DedicatedHostGroupInstanceView(IReadOnlyList hosts) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostGroupInstanceView(IReadOnlyList hosts, Dictionary serializedAdditionalRawData) { Hosts = hosts; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of instance view of the dedicated hosts under the dedicated host group. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.Serialization.cs index d456516396b7..2c714c60669e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class DedicatedHostGroupListResult + internal partial class DedicatedHostGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostGroupListResult DeserializeDedicatedHostGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostGroupListResult DeserializeDedicatedHostGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DedicatedHostGroupListResult DeserializeDedicatedHostGroupListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostGroupListResult(value, nextLink.Value); + return new DedicatedHostGroupListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DedicatedHostGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.cs index a2fc2b0a596c..a954764b6d50 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Dedicated Host Group with resource group response. internal partial class DedicatedHostGroupListResult { - /// Initializes a new instance of DedicatedHostGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of dedicated host groups. /// is null. internal DedicatedHostGroupListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DedicatedHostGroupListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DedicatedHostGroupListResult. + /// Initializes a new instance of . /// The list of dedicated host groups. /// The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI to fetch the next page of Dedicated Host Groups. - internal DedicatedHostGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DedicatedHostGroupListResult() + { } /// The list of dedicated host groups. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.Serialization.cs index a487ae383a35..0b69f0ee24e9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class DedicatedHostGroupPatch : IUtf8JsonSerializable + public partial class DedicatedHostGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -51,10 +60,194 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DedicatedHostGroupPatch DeserializeDedicatedHostGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> zones = default; + Optional> tags = default; + Optional platformFaultDomainCount = default; + Optional> hosts = default; + Optional instanceView = default; + Optional supportAutomaticPlacement = default; + Optional additionalCapabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("platformFaultDomainCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platformFaultDomainCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("hosts"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + hosts = array; + continue; + } + if (property0.NameEquals("instanceView"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceView = DedicatedHostGroupInstanceView.DeserializeDedicatedHostGroupInstanceView(property0.Value); + continue; + } + if (property0.NameEquals("supportAutomaticPlacement"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportAutomaticPlacement = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("additionalCapabilities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalCapabilities = DedicatedHostGroupPropertiesAdditionalCapabilities.DeserializeDedicatedHostGroupPropertiesAdditionalCapabilities(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DedicatedHostGroupPatch(Optional.ToDictionary(tags), Optional.ToList(zones), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(hosts), instanceView.Value, Optional.ToNullable(supportAutomaticPlacement), additionalCapabilities.Value, serializedAdditionalRawData); + } + + DedicatedHostGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.cs index ef69860a6271..4a4a7051260b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,32 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be updated. public partial class DedicatedHostGroupPatch : ComputeResourcePatch { - /// Initializes a new instance of DedicatedHostGroupPatch. + /// Initializes a new instance of . public DedicatedHostGroupPatch() { Zones = new ChangeTrackingList(); Hosts = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. + /// Number of fault domains that the host group can span. + /// A list of references to all dedicated hosts in the dedicated host group. + /// The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. + /// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. Minimum api-version: 2020-06-01. + /// Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01. + /// Keeps track of any properties unknown to the library. + internal DedicatedHostGroupPatch(IDictionary tags, IList zones, int? platformFaultDomainCount, IReadOnlyList hosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement, DedicatedHostGroupPropertiesAdditionalCapabilities additionalCapabilities, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Zones = zones; + PlatformFaultDomainCount = platformFaultDomainCount; + Hosts = hosts; + InstanceView = instanceView; + SupportAutomaticPlacement = supportAutomaticPlacement; + AdditionalCapabilities = additionalCapabilities; + } + /// Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. public IList Zones { get; } /// Number of fault domains that the host group can span. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.Serialization.cs index d4a92c42d040..4cf2ba9d4db6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class DedicatedHostGroupPropertiesAdditionalCapabilities : IUtf8JsonSerializable + internal partial class DedicatedHostGroupPropertiesAdditionalCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UltraSsdEnabled)) { writer.WritePropertyName("ultraSSDEnabled"u8); writer.WriteBooleanValue(UltraSsdEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DedicatedHostGroupPropertiesAdditionalCapabilities DeserializeDedicatedHostGroupPropertiesAdditionalCapabilities(JsonElement element) + internal static DedicatedHostGroupPropertiesAdditionalCapabilities DeserializeDedicatedHostGroupPropertiesAdditionalCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ultraSsdEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ultraSSDEnabled"u8)) @@ -41,8 +64,61 @@ internal static DedicatedHostGroupPropertiesAdditionalCapabilities DeserializeDe ultraSsdEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DedicatedHostGroupPropertiesAdditionalCapabilities(Optional.ToNullable(ultraSsdEnabled), serializedAdditionalRawData); + } + + DedicatedHostGroupPropertiesAdditionalCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostGroupPropertiesAdditionalCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostGroupPropertiesAdditionalCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostGroupPropertiesAdditionalCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostGroupPropertiesAdditionalCapabilities model) + { + if (model is null) + { + return null; } - return new DedicatedHostGroupPropertiesAdditionalCapabilities(Optional.ToNullable(ultraSsdEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostGroupPropertiesAdditionalCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostGroupPropertiesAdditionalCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs index 4c9cc269a0b9..d5710832b9ec 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupPropertiesAdditionalCapabilities.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Enables or disables a capability on the dedicated host group. Minimum api-version: 2022-03-01. internal partial class DedicatedHostGroupPropertiesAdditionalCapabilities { - /// Initializes a new instance of DedicatedHostGroupPropertiesAdditionalCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DedicatedHostGroupPropertiesAdditionalCapabilities() { } - /// Initializes a new instance of DedicatedHostGroupPropertiesAdditionalCapabilities. + /// Initializes a new instance of . /// The flag that enables or disables a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated Host Group. For the Virtual Machines to be UltraSSD Enabled, UltraSSDEnabled flag for the resource needs to be set true as well. The value is defaulted to 'false' when not provided. Please refer to https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. **Note:** The ultraSSDEnabled setting can only be enabled for Host Groups that are created as zonal. Minimum api-version: 2022-03-01. - internal DedicatedHostGroupPropertiesAdditionalCapabilities(bool? ultraSsdEnabled) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostGroupPropertiesAdditionalCapabilities(bool? ultraSsdEnabled, Dictionary serializedAdditionalRawData) { UltraSsdEnabled = ultraSsdEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The flag that enables or disables a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated Host Group. For the Virtual Machines to be UltraSSD Enabled, UltraSSDEnabled flag for the resource needs to be set true as well. The value is defaulted to 'false' when not provided. Please refer to https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details on Ultra SSD feature. **Note:** The ultraSSDEnabled setting can only be enabled for Host Groups that are created as zonal. Minimum api-version: 2022-03-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.Serialization.cs index 05b96f420e30..67f4a79ced79 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.Serialization.cs @@ -5,16 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DedicatedHostInstanceView + public partial class DedicatedHostInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostInstanceView DeserializeDedicatedHostInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AvailableCapacity)) + { + writer.WritePropertyName("availableCapacity"u8); + if (AvailableCapacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AvailableCapacity).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostInstanceView DeserializeDedicatedHostInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +78,7 @@ internal static DedicatedHostInstanceView DeserializeDedicatedHostInstanceView(J Optional assetId = default; Optional availableCapacity = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("assetId"u8)) @@ -52,8 +109,61 @@ internal static DedicatedHostInstanceView DeserializeDedicatedHostInstanceView(J statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostInstanceView(assetId.Value, availableCapacity.Value, Optional.ToList(statuses)); + return new DedicatedHostInstanceView(assetId.Value, availableCapacity.Value, Optional.ToList(statuses), serializedAdditionalRawData); + } + + DedicatedHostInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.cs index c08f80a440ad..e7a0771b5d67 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a dedicated host. public partial class DedicatedHostInstanceView { - /// Initializes a new instance of DedicatedHostInstanceView. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DedicatedHostInstanceView() { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of DedicatedHostInstanceView. + /// Initializes a new instance of . /// Specifies the unique id of the dedicated physical machine on which the dedicated host resides. /// Unutilized capacity of the dedicated host. /// The resource status information. - internal DedicatedHostInstanceView(string assetId, DedicatedHostAvailableCapacity availableCapacity, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostInstanceView(string assetId, DedicatedHostAvailableCapacity availableCapacity, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { AssetId = assetId; AvailableCapacity = availableCapacity; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the unique id of the dedicated physical machine on which the dedicated host resides. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.Serialization.cs index e66de51e5015..0ff5065f661c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.Serialization.cs @@ -5,16 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DedicatedHostInstanceViewWithName + public partial class DedicatedHostInstanceViewWithName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostInstanceViewWithName DeserializeDedicatedHostInstanceViewWithName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AvailableCapacity)) + { + writer.WritePropertyName("availableCapacity"u8); + if (AvailableCapacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AvailableCapacity).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostInstanceViewWithName DeserializeDedicatedHostInstanceViewWithName(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +79,7 @@ internal static DedicatedHostInstanceViewWithName DeserializeDedicatedHostInstan Optional assetId = default; Optional availableCapacity = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -58,8 +115,61 @@ internal static DedicatedHostInstanceViewWithName DeserializeDedicatedHostInstan statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostInstanceViewWithName(assetId.Value, availableCapacity.Value, Optional.ToList(statuses), name.Value); + return new DedicatedHostInstanceViewWithName(assetId.Value, availableCapacity.Value, Optional.ToList(statuses), name.Value, serializedAdditionalRawData); + } + + DedicatedHostInstanceViewWithName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostInstanceViewWithName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostInstanceViewWithName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostInstanceViewWithName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostInstanceViewWithName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostInstanceViewWithName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostInstanceViewWithName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs index 2b3fddceb993..a963d00b7e1d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostInstanceViewWithName.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models @@ -12,17 +13,18 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group. public partial class DedicatedHostInstanceViewWithName : DedicatedHostInstanceView { - /// Initializes a new instance of DedicatedHostInstanceViewWithName. + /// Initializes a new instance of . internal DedicatedHostInstanceViewWithName() { } - /// Initializes a new instance of DedicatedHostInstanceViewWithName. + /// Initializes a new instance of . /// Specifies the unique id of the dedicated physical machine on which the dedicated host resides. /// Unutilized capacity of the dedicated host. /// The resource status information. /// The name of the dedicated host. - internal DedicatedHostInstanceViewWithName(string assetId, DedicatedHostAvailableCapacity availableCapacity, IReadOnlyList statuses, string name) : base(assetId, availableCapacity, statuses) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostInstanceViewWithName(string assetId, DedicatedHostAvailableCapacity availableCapacity, IReadOnlyList statuses, string name, Dictionary serializedAdditionalRawData) : base(assetId, availableCapacity, statuses, serializedAdditionalRawData) { Name = name; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.Serialization.cs index f1c321d8fc8b..cbb84120021d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class DedicatedHostListResult + internal partial class DedicatedHostListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostListResult DeserializeDedicatedHostListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostListResult DeserializeDedicatedHostListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DedicatedHostListResult DeserializeDedicatedHostListResult(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostListResult(value, nextLink.Value); + return new DedicatedHostListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DedicatedHostListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.cs index aa646d5ba49b..eff4e86006d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list dedicated host operation response. internal partial class DedicatedHostListResult { - /// Initializes a new instance of DedicatedHostListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of dedicated hosts. /// is null. internal DedicatedHostListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DedicatedHostListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DedicatedHostListResult. + /// Initializes a new instance of . /// The list of dedicated hosts. /// The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to fetch the next page of dedicated hosts. - internal DedicatedHostListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DedicatedHostListResult() + { } /// The list of dedicated hosts. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.Serialization.cs index 1b83fbb5ffb0..242d3a949903 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.Serialization.cs @@ -5,20 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class DedicatedHostPatch : IUtf8JsonSerializable + public partial class DedicatedHostPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -49,7 +65,211 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LicenseType.Value.ToSerialString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DedicatedHostPatch DeserializeDedicatedHostPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional> tags = default; + Optional platformFaultDomain = default; + Optional autoReplaceOnFailure = default; + Optional hostId = default; + Optional> virtualMachines = default; + Optional licenseType = default; + Optional provisioningTime = default; + Optional provisioningState = default; + Optional instanceView = default; + Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ComputeSku.DeserializeComputeSku(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("platformFaultDomain"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platformFaultDomain = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("autoReplaceOnFailure"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoReplaceOnFailure = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("hostId"u8)) + { + hostId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("virtualMachines"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + virtualMachines = array; + continue; + } + if (property0.NameEquals("licenseType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + licenseType = property0.Value.GetString().ToDedicatedHostLicenseType(); + continue; + } + if (property0.NameEquals("provisioningTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("instanceView"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceView = DedicatedHostInstanceView.DeserializeDedicatedHostInstanceView(property0.Value); + continue; + } + if (property0.NameEquals("timeCreated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeCreated = property0.Value.GetDateTimeOffset("O"); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DedicatedHostPatch(Optional.ToDictionary(tags), sku.Value, Optional.ToNullable(platformFaultDomain), Optional.ToNullable(autoReplaceOnFailure), hostId.Value, Optional.ToList(virtualMachines), Optional.ToNullable(licenseType), Optional.ToNullable(provisioningTime), provisioningState.Value, instanceView.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + DedicatedHostPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.cs index a59816ec5997..5ca643e39b41 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostPatch.cs @@ -15,12 +15,39 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may be updated. public partial class DedicatedHostPatch : ComputeResourcePatch { - /// Initializes a new instance of DedicatedHostPatch. + /// Initializes a new instance of . public DedicatedHostPatch() { VirtualMachines = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// [List all available dedicated host sizes for resizing] (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). Resizing can be only used to scale up DedicatedHost. Only name is required to be set. + /// Fault domain of the dedicated host within a dedicated host group. + /// Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true' when not provided. + /// A unique id generated and assigned to the dedicated host by the platform. Does not change throughout the lifetime of the host. + /// A list of references to all virtual machines in the Dedicated Host. + /// Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** The default value is: **None.**. + /// The date when the host was first provisioned. + /// The provisioning state, which only appears in the response. + /// The dedicated host instance view. + /// Specifies the time at which the Dedicated Host resource was created. Minimum api-version: 2021-11-01. + /// Keeps track of any properties unknown to the library. + internal DedicatedHostPatch(IDictionary tags, ComputeSku sku, int? platformFaultDomain, bool? autoReplaceOnFailure, string hostId, IReadOnlyList virtualMachines, DedicatedHostLicenseType? licenseType, DateTimeOffset? provisioningOn, string provisioningState, DedicatedHostInstanceView instanceView, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Sku = sku; + PlatformFaultDomain = platformFaultDomain; + AutoReplaceOnFailure = autoReplaceOnFailure; + HostId = hostId; + VirtualMachines = virtualMachines; + LicenseType = licenseType; + ProvisioningOn = provisioningOn; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TimeCreated = timeCreated; + } + /// [List all available dedicated host sizes for resizing] (https://docs.microsoft.com/rest/api/compute/dedicated-hosts/listavailablesizes). Resizing can be only used to scale up DedicatedHost. Only name is required to be set. public ComputeSku Sku { get; set; } /// Fault domain of the dedicated host within a dedicated host group. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.Serialization.cs index 78c25b617514..c63987b5dd2c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.Serialization.cs @@ -5,21 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class DedicatedHostSizeListResult + internal partial class DedicatedHostSizeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DedicatedHostSizeListResult DeserializeDedicatedHostSizeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DedicatedHostSizeListResult DeserializeDedicatedHostSizeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +74,61 @@ internal static DedicatedHostSizeListResult DeserializeDedicatedHostSizeListResu value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DedicatedHostSizeListResult(Optional.ToList(value)); + return new DedicatedHostSizeListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + DedicatedHostSizeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDedicatedHostSizeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DedicatedHostSizeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDedicatedHostSizeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DedicatedHostSizeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DedicatedHostSizeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDedicatedHostSizeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.cs index 0bed461c0292..fcc7503b51eb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostSizeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// The List Dedicated Host sizes operation response. internal partial class DedicatedHostSizeListResult { - /// Initializes a new instance of DedicatedHostSizeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DedicatedHostSizeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DedicatedHostSizeListResult. + /// Initializes a new instance of . /// The list of dedicated host sizes. - internal DedicatedHostSizeListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal DedicatedHostSizeListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of dedicated host sizes. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.Serialization.cs index 5e7cfb131de9..ed48b9f86db0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class DiagnosticsProfile : IUtf8JsonSerializable + internal partial class DiagnosticsProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BootDiagnostics)) { writer.WritePropertyName("bootDiagnostics"u8); - writer.WriteObjectValue(BootDiagnostics); + if (BootDiagnostics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BootDiagnostics).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DiagnosticsProfile DeserializeDiagnosticsProfile(JsonElement element) + internal static DiagnosticsProfile DeserializeDiagnosticsProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional bootDiagnostics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("bootDiagnostics"u8)) @@ -41,8 +71,61 @@ internal static DiagnosticsProfile DeserializeDiagnosticsProfile(JsonElement ele bootDiagnostics = BootDiagnostics.DeserializeBootDiagnostics(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiagnosticsProfile(bootDiagnostics.Value, serializedAdditionalRawData); + } + + DiagnosticsProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticsProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticsProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticsProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticsProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticsProfile(Response response) + { + if (response is null) + { + return null; } - return new DiagnosticsProfile(bootDiagnostics.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticsProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.cs index 1b5ddc760d36..844806c4ce39 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiagnosticsProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. internal partial class DiagnosticsProfile { - /// Initializes a new instance of DiagnosticsProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiagnosticsProfile() { } - /// Initializes a new instance of DiagnosticsProfile. + /// Initializes a new instance of . /// Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. **NOTE**: If storageUri is being specified then ensure that the storage account is in the same region and subscription as the VM. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor. - internal DiagnosticsProfile(BootDiagnostics bootDiagnostics) + /// Keeps track of any properties unknown to the library. + internal DiagnosticsProfile(BootDiagnostics bootDiagnostics, Dictionary serializedAdditionalRawData) { BootDiagnostics = bootDiagnostics; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. **NOTE**: If storageUri is being specified then ensure that the storage account is in the same region and subscription as the VM. You can easily view the output of your console log. Azure also enables you to see a screenshot of the VM from the hypervisor. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.Serialization.cs index 65b58ac94d84..ebbc1b0fe80c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiffDiskSettings : IUtf8JsonSerializable + public partial class DiffDiskSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Option)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("placement"u8); writer.WriteStringValue(Placement.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element) + internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional option = default; Optional placement = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("option"u8)) @@ -56,8 +79,61 @@ internal static DiffDiskSettings DeserializeDiffDiskSettings(JsonElement element placement = new DiffDiskPlacement(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiffDiskSettings(Optional.ToNullable(option), Optional.ToNullable(placement), serializedAdditionalRawData); + } + + DiffDiskSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiffDiskSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiffDiskSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiffDiskSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiffDiskSettings model) + { + if (model is null) + { + return null; } - return new DiffDiskSettings(Optional.ToNullable(option), Optional.ToNullable(placement)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiffDiskSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiffDiskSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.cs index a506af564aaa..7383265dc73f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiffDiskSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the parameters of ephemeral disk settings that can be specified for operating system disk. **Note:** The ephemeral disk settings can only be specified for managed disk. public partial class DiffDiskSettings { - /// Initializes a new instance of DiffDiskSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiffDiskSettings() { } - /// Initializes a new instance of DiffDiskSettings. + /// Initializes a new instance of . /// Specifies the ephemeral disk settings for operating system disk. /// Specifies the ephemeral disk placement for operating system disk. Possible values are: **CacheDisk,** **ResourceDisk.** The defaulting behavior is: **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. - internal DiffDiskSettings(DiffDiskOption? option, DiffDiskPlacement? placement) + /// Keeps track of any properties unknown to the library. + internal DiffDiskSettings(DiffDiskOption? option, DiffDiskPlacement? placement, Dictionary serializedAdditionalRawData) { Option = option; Placement = placement; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the ephemeral disk settings for operating system disk. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.Serialization.cs index 7907b34af925..9ea905723731 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class Disallowed : IUtf8JsonSerializable + internal partial class Disallowed : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DiskTypes)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Disallowed DeserializeDisallowed(JsonElement element) + internal static Disallowed DeserializeDisallowed(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> diskTypes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskTypes"u8)) @@ -52,8 +74,61 @@ internal static Disallowed DeserializeDisallowed(JsonElement element) diskTypes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Disallowed(Optional.ToList(diskTypes), serializedAdditionalRawData); + } + + Disallowed IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDisallowed(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Disallowed IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDisallowed(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Disallowed model) + { + if (model is null) + { + return null; } - return new Disallowed(Optional.ToList(diskTypes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Disallowed(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDisallowed(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.cs index 167a3d9d3675..d904cc5ca885 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/Disallowed.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the disallowed disk types. internal partial class Disallowed { - /// Initializes a new instance of Disallowed. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Disallowed() { DiskTypes = new ChangeTrackingList(); } - /// Initializes a new instance of Disallowed. + /// Initializes a new instance of . /// A list of disk types. - internal Disallowed(IList diskTypes) + /// Keeps track of any properties unknown to the library. + internal Disallowed(IList diskTypes, Dictionary serializedAdditionalRawData) { DiskTypes = diskTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of disk types. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.Serialization.cs index fa2eb02c0561..ad8e81738cdf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class DisallowedConfiguration : IUtf8JsonSerializable + internal partial class DisallowedConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VmDiskType)) { writer.WritePropertyName("vmDiskType"u8); writer.WriteStringValue(VmDiskType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DisallowedConfiguration DeserializeDisallowedConfiguration(JsonElement element) + internal static DisallowedConfiguration DeserializeDisallowedConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vmDiskType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmDiskType"u8)) @@ -41,8 +64,61 @@ internal static DisallowedConfiguration DeserializeDisallowedConfiguration(JsonE vmDiskType = new VirtualMachineDiskType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DisallowedConfiguration(Optional.ToNullable(vmDiskType), serializedAdditionalRawData); + } + + DisallowedConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDisallowedConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DisallowedConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDisallowedConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DisallowedConfiguration model) + { + if (model is null) + { + return null; } - return new DisallowedConfiguration(Optional.ToNullable(vmDiskType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DisallowedConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDisallowedConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.cs index 69419332eb9f..10098a6b2a8c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DisallowedConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the disallowed configuration for a virtual machine image. internal partial class DisallowedConfiguration { - /// Initializes a new instance of DisallowedConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DisallowedConfiguration() { } - /// Initializes a new instance of DisallowedConfiguration. + /// Initializes a new instance of . /// VM disk types which are disallowed. - internal DisallowedConfiguration(VirtualMachineDiskType? vmDiskType) + /// Keeps track of any properties unknown to the library. + internal DisallowedConfiguration(VirtualMachineDiskType? vmDiskType, Dictionary serializedAdditionalRawData) { VmDiskType = vmDiskType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// VM disk types which are disallowed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessData.Serialization.cs index 78cb6f44cb29..73206e4b63f8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class DiskAccessData : IUtf8JsonSerializable + public partial class DiskAccessData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -40,11 +46,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskAccessData DeserializeDiskAccessData(JsonElement element) + internal static DiskAccessData DeserializeDiskAccessData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +79,7 @@ internal static DiskAccessData DeserializeDiskAccessData(JsonElement element) Optional> privateEndpointConnections = default; Optional provisioningState = default; Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -153,8 +174,61 @@ internal static DiskAccessData DeserializeDiskAccessData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskAccessData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, Optional.ToList(privateEndpointConnections), provisioningState.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + DiskAccessData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskAccessData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskAccessData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskAccessData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskAccessData model) + { + if (model is null) + { + return null; } - return new DiskAccessData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, Optional.ToList(privateEndpointConnections), provisioningState.Value, Optional.ToNullable(timeCreated)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskAccessData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskAccessData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.Serialization.cs index 9dead9d0adc1..c8674ef441dc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class DiskAccessList + internal partial class DiskAccessList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskAccessList DeserializeDiskAccessList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskAccessList DeserializeDiskAccessList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DiskAccessList DeserializeDiskAccessList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiskAccessList(value, nextLink.Value); + return new DiskAccessList(value, nextLink.Value, serializedAdditionalRawData); + } + + DiskAccessList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskAccessList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskAccessList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskAccessList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskAccessList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskAccessList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskAccessList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.cs index 3cd7a68ef3b3..1d57c4d885f8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List disk access operation response. internal partial class DiskAccessList { - /// Initializes a new instance of DiskAccessList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of disk access resources. /// is null. internal DiskAccessList(IEnumerable value) @@ -26,13 +29,20 @@ internal DiskAccessList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DiskAccessList. + /// Initializes a new instance of . /// A list of disk access resources. /// The uri to fetch the next page of disk access resources. Call ListNext() with this to fetch the next page of disk access resources. - internal DiskAccessList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DiskAccessList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskAccessList() + { } /// A list of disk access resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.Serialization.cs index a054b9d34e5b..6fd6dc1ea9d5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskAccessPatch : IUtf8JsonSerializable + public partial class DiskAccessPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DiskAccessPatch DeserializeDiskAccessPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskAccessPatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + DiskAccessPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskAccessPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskAccessPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskAccessPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskAccessPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskAccessPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskAccessPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.cs index 33b375383753..9c0a9913d5c0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskAccessPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Used for updating a disk access resource. public partial class DiskAccessPatch { - /// Initializes a new instance of DiskAccessPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskAccessPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal DiskAccessPatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.Serialization.cs index 092a0d8163a2..cf3fc5f130a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskCreationData : IUtf8JsonSerializable + public partial class DiskCreationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("createOption"u8); writer.WriteStringValue(CreateOption.ToString()); @@ -26,12 +33,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ImageReference)) { writer.WritePropertyName("imageReference"u8); - writer.WriteObjectValue(ImageReference); + if (ImageReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageReference).Serialize(writer, options); + } } if (Optional.IsDefined(GalleryImageReference)) { writer.WritePropertyName("galleryImageReference"u8); - writer.WriteObjectValue(GalleryImageReference); + if (GalleryImageReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GalleryImageReference).Serialize(writer, options); + } } if (Optional.IsDefined(SourceUri)) { @@ -68,11 +89,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("elasticSanResourceId"u8); writer.WriteStringValue(ElasticSanResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskCreationData DeserializeDiskCreationData(JsonElement element) + internal static DiskCreationData DeserializeDiskCreationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +124,7 @@ internal static DiskCreationData DeserializeDiskCreationData(JsonElement element Optional securityDataUri = default; Optional performancePlus = default; Optional elasticSanResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("createOption"u8)) @@ -191,8 +227,61 @@ internal static DiskCreationData DeserializeDiskCreationData(JsonElement element elasticSanResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskCreationData(createOption, storageAccountId.Value, imageReference.Value, galleryImageReference.Value, sourceUri.Value, sourceResourceId.Value, sourceUniqueId.Value, Optional.ToNullable(uploadSizeBytes), Optional.ToNullable(logicalSectorSize), securityDataUri.Value, Optional.ToNullable(performancePlus), elasticSanResourceId.Value, serializedAdditionalRawData); + } + + DiskCreationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskCreationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskCreationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskCreationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskCreationData model) + { + if (model is null) + { + return null; } - return new DiskCreationData(createOption, storageAccountId.Value, imageReference.Value, galleryImageReference.Value, sourceUri.Value, sourceResourceId.Value, sourceUniqueId.Value, Optional.ToNullable(uploadSizeBytes), Optional.ToNullable(logicalSectorSize), securityDataUri.Value, Optional.ToNullable(performancePlus), elasticSanResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskCreationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskCreationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.cs index e05054905376..740e5ea43dde 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskCreationData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.Compute.Models /// Data used when creating a disk. public partial class DiskCreationData { - /// Initializes a new instance of DiskCreationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// This enumerates the possible sources of a disk's creation. public DiskCreationData(DiskCreateOption createOption) { CreateOption = createOption; } - /// Initializes a new instance of DiskCreationData. + /// Initializes a new instance of . /// This enumerates the possible sources of a disk's creation. /// Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. /// Disk source information for PIR or user images. @@ -33,7 +37,8 @@ public DiskCreationData(DiskCreateOption createOption) /// If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state. /// Set this flag to true to get a boost on the performance target of the disk deployed, see here on the respective performance target. This flag can only be set on disk creation time and cannot be disabled after enabled. /// Required if createOption is CopyFromSanSnapshot. This is the ARM id of the source elastic san volume snapshot. - internal DiskCreationData(DiskCreateOption createOption, ResourceIdentifier storageAccountId, ImageDiskReference imageReference, ImageDiskReference galleryImageReference, Uri sourceUri, ResourceIdentifier sourceResourceId, string sourceUniqueId, long? uploadSizeBytes, int? logicalSectorSize, Uri securityDataUri, bool? isPerformancePlusEnabled, ResourceIdentifier elasticSanResourceId) + /// Keeps track of any properties unknown to the library. + internal DiskCreationData(DiskCreateOption createOption, ResourceIdentifier storageAccountId, ImageDiskReference imageReference, ImageDiskReference galleryImageReference, Uri sourceUri, ResourceIdentifier sourceResourceId, string sourceUniqueId, long? uploadSizeBytes, int? logicalSectorSize, Uri securityDataUri, bool? isPerformancePlusEnabled, ResourceIdentifier elasticSanResourceId, Dictionary serializedAdditionalRawData) { CreateOption = createOption; StorageAccountId = storageAccountId; @@ -47,6 +52,12 @@ internal DiskCreationData(DiskCreateOption createOption, ResourceIdentifier stor SecurityDataUri = securityDataUri; IsPerformancePlusEnabled = isPerformancePlusEnabled; ElasticSanResourceId = elasticSanResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskCreationData() + { } /// This enumerates the possible sources of a disk's creation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.Serialization.cs index d517545215ac..7ee8cd5d07e6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskEncryption : IUtf8JsonSerializable + public partial class DiskEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskEncryptionSetId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(EncryptionType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskEncryption DeserializeDiskEncryption(JsonElement element) + internal static DiskEncryption DeserializeDiskEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskEncryptionSetId = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskEncryptionSetId"u8)) @@ -56,8 +79,61 @@ internal static DiskEncryption DeserializeDiskEncryption(JsonElement element) type = new ComputeEncryptionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskEncryption(diskEncryptionSetId.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + DiskEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskEncryption model) + { + if (model is null) + { + return null; } - return new DiskEncryption(diskEncryptionSetId.Value, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskEncryption(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.cs index 98a1780503fc..e8885065270c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryption.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Compute.Models /// Encryption at rest settings for disk or snapshot. public partial class DiskEncryption { - /// Initializes a new instance of DiskEncryption. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskEncryption() { } - /// Initializes a new instance of DiskEncryption. + /// Initializes a new instance of . /// ResourceId of the disk encryption set to use for enabling encryption at rest. /// The type of key used to encrypt the data of the disk. - internal DiskEncryption(ResourceIdentifier diskEncryptionSetId, ComputeEncryptionType? encryptionType) + /// Keeps track of any properties unknown to the library. + internal DiskEncryption(ResourceIdentifier diskEncryptionSetId, ComputeEncryptionType? encryptionType, Dictionary serializedAdditionalRawData) { DiskEncryptionSetId = diskEncryptionSetId; EncryptionType = encryptionType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// ResourceId of the disk encryption set to use for enabling encryption at rest. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetData.Serialization.cs index 51f46aee7636..0d14f0881af6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class DiskEncryptionSetData : IUtf8JsonSerializable + public partial class DiskEncryptionSetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -47,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ActiveKey)) { writer.WritePropertyName("activeKey"u8); - writer.WriteObjectValue(ActiveKey); + if (ActiveKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ActiveKey).Serialize(writer, options); + } } if (Optional.IsDefined(RotationToLatestKeyVersionEnabled)) { @@ -60,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(FederatedClientId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskEncryptionSetData DeserializeDiskEncryptionSetData(JsonElement element) + internal static DiskEncryptionSetData DeserializeDiskEncryptionSetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +111,7 @@ internal static DiskEncryptionSetData DeserializeDiskEncryptionSetData(JsonEleme Optional lastKeyRotationTimestamp = default; Optional autoKeyRotationError = default; Optional federatedClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -219,8 +247,61 @@ internal static DiskEncryptionSetData DeserializeDiskEncryptionSetData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskEncryptionSetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(encryptionType), activeKey.Value, Optional.ToList(previousKeys), provisioningState.Value, Optional.ToNullable(rotationToLatestKeyVersionEnabled), Optional.ToNullable(lastKeyRotationTimestamp), autoKeyRotationError.Value, federatedClientId.Value, serializedAdditionalRawData); + } + + DiskEncryptionSetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskEncryptionSetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskEncryptionSetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskEncryptionSetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskEncryptionSetData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskEncryptionSetData(Response response) + { + if (response is null) + { + return null; } - return new DiskEncryptionSetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(encryptionType), activeKey.Value, Optional.ToList(previousKeys), provisioningState.Value, Optional.ToNullable(rotationToLatestKeyVersionEnabled), Optional.ToNullable(lastKeyRotationTimestamp), autoKeyRotationError.Value, federatedClientId.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskEncryptionSetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.Serialization.cs index d84564b7775e..5bf85f77d2b5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class DiskEncryptionSetList + internal partial class DiskEncryptionSetList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskEncryptionSetList DeserializeDiskEncryptionSetList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskEncryptionSetList DeserializeDiskEncryptionSetList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DiskEncryptionSetList DeserializeDiskEncryptionSetList(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiskEncryptionSetList(value, nextLink.Value); + return new DiskEncryptionSetList(value, nextLink.Value, serializedAdditionalRawData); + } + + DiskEncryptionSetList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskEncryptionSetList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskEncryptionSetList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskEncryptionSetList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskEncryptionSetList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskEncryptionSetList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskEncryptionSetList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.cs index 161fb006ea89..34e2ad151bd5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List disk encryption set operation response. internal partial class DiskEncryptionSetList { - /// Initializes a new instance of DiskEncryptionSetList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of disk encryption sets. /// is null. internal DiskEncryptionSetList(IEnumerable value) @@ -26,13 +29,20 @@ internal DiskEncryptionSetList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DiskEncryptionSetList. + /// Initializes a new instance of . /// A list of disk encryption sets. /// The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. - internal DiskEncryptionSetList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DiskEncryptionSetList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskEncryptionSetList() + { } /// A list of disk encryption sets. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.Serialization.cs index f1d278ab00cf..ff9aa9cfc105 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskEncryptionSetPatch : IUtf8JsonSerializable + public partial class DiskEncryptionSetPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -41,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ActiveKey)) { writer.WritePropertyName("activeKey"u8); - writer.WriteObjectValue(ActiveKey); + if (ActiveKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ActiveKey).Serialize(writer, options); + } } if (Optional.IsDefined(RotationToLatestKeyVersionEnabled)) { @@ -54,7 +70,160 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(FederatedClientId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DiskEncryptionSetPatch DeserializeDiskEncryptionSetPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional encryptionType = default; + Optional activeKey = default; + Optional rotationToLatestKeyVersionEnabled = default; + Optional federatedClientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("encryptionType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryptionType = new DiskEncryptionSetType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("activeKey"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeKey = KeyForDiskEncryptionSet.DeserializeKeyForDiskEncryptionSet(property0.Value); + continue; + } + if (property0.NameEquals("rotationToLatestKeyVersionEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rotationToLatestKeyVersionEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("federatedClientId"u8)) + { + federatedClientId = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskEncryptionSetPatch(Optional.ToDictionary(tags), identity, Optional.ToNullable(encryptionType), activeKey.Value, Optional.ToNullable(rotationToLatestKeyVersionEnabled), federatedClientId.Value, serializedAdditionalRawData); + } + + DiskEncryptionSetPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskEncryptionSetPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskEncryptionSetPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskEncryptionSetPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskEncryptionSetPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskEncryptionSetPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskEncryptionSetPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.cs index 7a376b44da07..e70c258c5d39 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,34 @@ namespace Azure.ResourceManager.Compute.Models /// disk encryption set update resource. public partial class DiskEncryptionSetPatch { - /// Initializes a new instance of DiskEncryptionSetPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskEncryptionSetPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. + /// The type of key used to encrypt the data of the disk. + /// Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. + /// Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. + /// Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the property. + /// Keeps track of any properties unknown to the library. + internal DiskEncryptionSetPatch(IDictionary tags, ManagedServiceIdentity identity, DiskEncryptionSetType? encryptionType, KeyForDiskEncryptionSet activeKey, bool? rotationToLatestKeyVersionEnabled, string federatedClientId, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + EncryptionType = encryptionType; + ActiveKey = activeKey; + RotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + FederatedClientId = federatedClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.Serialization.cs index da208c85b545..ac4470782845 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.Serialization.cs @@ -5,36 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskEncryptionSettings : IUtf8JsonSerializable + public partial class DiskEncryptionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskEncryptionKey)) { writer.WritePropertyName("diskEncryptionKey"u8); - writer.WriteObjectValue(DiskEncryptionKey); + if (DiskEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(Enabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(Enabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskEncryptionSettings DeserializeDiskEncryptionSettings(JsonElement element) + internal static DiskEncryptionSettings DeserializeDiskEncryptionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static DiskEncryptionSettings DeserializeDiskEncryptionSettings(JsonEle Optional diskEncryptionKey = default; Optional keyEncryptionKey = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskEncryptionKey"u8)) @@ -71,8 +108,61 @@ internal static DiskEncryptionSettings DeserializeDiskEncryptionSettings(JsonEle enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskEncryptionSettings(diskEncryptionKey.Value, keyEncryptionKey.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + DiskEncryptionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskEncryptionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskEncryptionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskEncryptionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskEncryptionSettings model) + { + if (model is null) + { + return null; } - return new DiskEncryptionSettings(diskEncryptionKey.Value, keyEncryptionKey.Value, Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskEncryptionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskEncryptionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.cs index b8b87f39f3aa..285054ad6fc1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSettings.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes a Encryption Settings for a Disk. public partial class DiskEncryptionSettings { - /// Initializes a new instance of DiskEncryptionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskEncryptionSettings() { } - /// Initializes a new instance of DiskEncryptionSettings. + /// Initializes a new instance of . /// Specifies the location of the disk encryption key, which is a Key Vault Secret. /// Specifies the location of the key encryption key in Key Vault. /// Specifies whether disk encryption should be enabled on the virtual machine. - internal DiskEncryptionSettings(KeyVaultSecretReference diskEncryptionKey, KeyVaultKeyReference keyEncryptionKey, bool? enabled) + /// Keeps track of any properties unknown to the library. + internal DiskEncryptionSettings(KeyVaultSecretReference diskEncryptionKey, KeyVaultKeyReference keyEncryptionKey, bool? enabled, Dictionary serializedAdditionalRawData) { DiskEncryptionKey = diskEncryptionKey; KeyEncryptionKey = keyEncryptionKey; Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the location of the disk encryption key, which is a Key Vault Secret. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageData.Serialization.cs index 290fda38e8c7..7bc50276d044 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class DiskImageData : IUtf8JsonSerializable + public partial class DiskImageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -47,7 +54,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(HyperVGeneration)) { @@ -55,11 +69,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(HyperVGeneration.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskImageData DeserializeDiskImageData(JsonElement element) + internal static DiskImageData DeserializeDiskImageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +103,7 @@ internal static DiskImageData DeserializeDiskImageData(JsonElement element) Optional storageProfile = default; Optional provisioningState = default; Optional hyperVGeneration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -173,8 +202,61 @@ internal static DiskImageData DeserializeDiskImageData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskImageData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, sourceVirtualMachine, storageProfile.Value, provisioningState.Value, Optional.ToNullable(hyperVGeneration), serializedAdditionalRawData); + } + + DiskImageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskImageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskImageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskImageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskImageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskImageData(Response response) + { + if (response is null) + { + return null; } - return new DiskImageData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, sourceVirtualMachine, storageProfile.Value, provisioningState.Value, Optional.ToNullable(hyperVGeneration)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskImageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.Serialization.cs index dd66b7e7190e..8982e013f5a7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskImageEncryption : IUtf8JsonSerializable + public partial class DiskImageEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskEncryptionSetId)) { writer.WritePropertyName("diskEncryptionSetId"u8); writer.WriteStringValue(DiskEncryptionSetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskImageEncryption DeserializeDiskImageEncryption(JsonElement element) + internal static DiskImageEncryption DeserializeDiskImageEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskEncryptionSetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskEncryptionSetId"u8)) @@ -41,8 +64,61 @@ internal static DiskImageEncryption DeserializeDiskImageEncryption(JsonElement e diskEncryptionSetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskImageEncryption(diskEncryptionSetId.Value, serializedAdditionalRawData); + } + + DiskImageEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskImageEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskImageEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskImageEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskImageEncryption model) + { + if (model is null) + { + return null; } - return new DiskImageEncryption(diskEncryptionSetId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskImageEncryption(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskImageEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.cs index 96972a90bbea..139e47c79276 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImageEncryption.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Compute.Models /// This is the disk image encryption base class. public partial class DiskImageEncryption { - /// Initializes a new instance of DiskImageEncryption. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskImageEncryption() { } - /// Initializes a new instance of DiskImageEncryption. + /// Initializes a new instance of . /// A relative URI containing the resource ID of the disk encryption set. - internal DiskImageEncryption(ResourceIdentifier diskEncryptionSetId) + /// Keeps track of any properties unknown to the library. + internal DiskImageEncryption(ResourceIdentifier diskEncryptionSetId, Dictionary serializedAdditionalRawData) { DiskEncryptionSetId = diskEncryptionSetId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A relative URI containing the resource ID of the disk encryption set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.Serialization.cs index ef5538059f01..42402c3e2c21 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskImagePatch : IUtf8JsonSerializable + public partial class DiskImagePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,7 +45,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(HyperVGeneration)) { @@ -44,7 +60,150 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(HyperVGeneration.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DiskImagePatch DeserializeDiskImagePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional sourceVirtualMachine = default; + Optional storageProfile = default; + Optional provisioningState = default; + Optional hyperVGeneration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("sourceVirtualMachine"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceVirtualMachine = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("storageProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = ImageStorageProfile.DeserializeImageStorageProfile(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("hyperVGeneration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskImagePatch(Optional.ToDictionary(tags), sourceVirtualMachine, storageProfile.Value, provisioningState.Value, Optional.ToNullable(hyperVGeneration), serializedAdditionalRawData); + } + + DiskImagePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskImagePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskImagePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskImagePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskImagePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskImagePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskImagePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.cs index 66bb5cb80ccc..dbec14baff71 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskImagePatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,11 +15,26 @@ namespace Azure.ResourceManager.Compute.Models /// The source user image virtual hard disk. Only tags may be updated. public partial class DiskImagePatch : ComputeResourcePatch { - /// Initializes a new instance of DiskImagePatch. + /// Initializes a new instance of . public DiskImagePatch() { } + /// Initializes a new instance of . + /// Resource tags. + /// The source virtual machine from which Image is created. + /// Specifies the storage settings for the virtual machine disks. + /// The provisioning state. + /// Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. + /// Keeps track of any properties unknown to the library. + internal DiskImagePatch(IDictionary tags, WritableSubResource sourceVirtualMachine, ImageStorageProfile storageProfile, string provisioningState, HyperVGeneration? hyperVGeneration, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + SourceVirtualMachine = sourceVirtualMachine; + StorageProfile = storageProfile; + ProvisioningState = provisioningState; + HyperVGeneration = hyperVGeneration; + } + /// The source virtual machine from which Image is created. internal WritableSubResource SourceVirtualMachine { get; set; } /// Gets or sets Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.Serialization.cs index 9d8a80b9f514..1d0fc1d9c04c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.Serialization.cs @@ -5,16 +5,82 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskInstanceView + public partial class DiskInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(EncryptionSettings)) + { + writer.WritePropertyName("encryptionSettings"u8); + writer.WriteStartArray(); + foreach (var item in EncryptionSettings) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +88,7 @@ internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element Optional name = default; Optional> encryptionSettings = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +124,61 @@ internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskInstanceView(name.Value, Optional.ToList(encryptionSettings), Optional.ToList(statuses), serializedAdditionalRawData); + } + + DiskInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskInstanceView(Response response) + { + if (response is null) + { + return null; } - return new DiskInstanceView(name.Value, Optional.ToList(encryptionSettings), Optional.ToList(statuses)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.cs index 850ee1298275..81cada386ab7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of the disk. public partial class DiskInstanceView { - /// Initializes a new instance of DiskInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DiskInstanceView() { EncryptionSettings = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of DiskInstanceView. + /// Initializes a new instance of . /// The disk name. /// Specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15. /// The resource status information. - internal DiskInstanceView(string name, IReadOnlyList encryptionSettings, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal DiskInstanceView(string name, IReadOnlyList encryptionSettings, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { Name = name; EncryptionSettings = encryptionSettings; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The disk name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.Serialization.cs index d12ee264dd26..a1fa7c39418d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class DiskList + internal partial class DiskList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskList DeserializeDiskList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskList DeserializeDiskList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DiskList DeserializeDiskList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiskList(value, nextLink.Value); + return new DiskList(value, nextLink.Value, serializedAdditionalRawData); + } + + DiskList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.cs index 25ea5103e82c..ad2eae8f3ea7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Disks operation response. internal partial class DiskList { - /// Initializes a new instance of DiskList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of disks. /// is null. internal DiskList(IEnumerable value) @@ -26,13 +29,20 @@ internal DiskList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DiskList. + /// Initializes a new instance of . /// A list of disks. /// The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. - internal DiskList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DiskList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskList() + { } /// A list of disks. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.Serialization.cs index 03ee375d697b..9d2a4d3f699c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskPurchasePlan : IUtf8JsonSerializable + public partial class DiskPurchasePlan : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("promotionCode"u8); writer.WriteStringValue(PromotionCode); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskPurchasePlan DeserializeDiskPurchasePlan(JsonElement element) + internal static DiskPurchasePlan DeserializeDiskPurchasePlan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static DiskPurchasePlan DeserializeDiskPurchasePlan(JsonElement element string publisher = default; string product = default; Optional promotionCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -61,8 +84,61 @@ internal static DiskPurchasePlan DeserializeDiskPurchasePlan(JsonElement element promotionCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskPurchasePlan(name, publisher, product, promotionCode.Value, serializedAdditionalRawData); + } + + DiskPurchasePlan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskPurchasePlan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskPurchasePlan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskPurchasePlan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskPurchasePlan model) + { + if (model is null) + { + return null; } - return new DiskPurchasePlan(name, publisher, product, promotionCode.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskPurchasePlan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskPurchasePlan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.cs index a97512ab844a..953ba7af234a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskPurchasePlan.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. public partial class DiskPurchasePlan { - /// Initializes a new instance of DiskPurchasePlan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The plan ID. /// The publisher ID. /// Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. @@ -29,17 +33,24 @@ public DiskPurchasePlan(string name, string publisher, string product) Product = product; } - /// Initializes a new instance of DiskPurchasePlan. + /// Initializes a new instance of . /// The plan ID. /// The publisher ID. /// Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. /// The Offer Promotion Code. - internal DiskPurchasePlan(string name, string publisher, string product, string promotionCode) + /// Keeps track of any properties unknown to the library. + internal DiskPurchasePlan(string name, string publisher, string product, string promotionCode, Dictionary serializedAdditionalRawData) { Name = name; Publisher = publisher; Product = product; PromotionCode = promotionCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskPurchasePlan() + { } /// The plan ID. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.Serialization.cs index eaba34ad767f..17f943768f2f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.Serialization.cs @@ -5,32 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskRestorePointAttributes : IUtf8JsonSerializable + public partial class DiskRestorePointAttributes : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(SourceDiskRestorePoint)) { writer.WritePropertyName("sourceDiskRestorePoint"u8); JsonSerializer.Serialize(writer, SourceDiskRestorePoint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskRestorePointAttributes DeserializeDiskRestorePointAttributes(JsonElement element) + internal static DiskRestorePointAttributes DeserializeDiskRestorePointAttributes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +67,7 @@ internal static DiskRestorePointAttributes DeserializeDiskRestorePointAttributes Optional encryption = default; Optional sourceDiskRestorePoint = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("encryption"u8)) @@ -67,8 +97,61 @@ internal static DiskRestorePointAttributes DeserializeDiskRestorePointAttributes id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskRestorePointAttributes(id.Value, encryption.Value, sourceDiskRestorePoint, serializedAdditionalRawData); + } + + DiskRestorePointAttributes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskRestorePointAttributes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskRestorePointAttributes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskRestorePointAttributes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskRestorePointAttributes model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskRestorePointAttributes(Response response) + { + if (response is null) + { + return null; } - return new DiskRestorePointAttributes(id.Value, encryption.Value, sourceDiskRestorePoint); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskRestorePointAttributes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.cs index 4b793e97e73f..6631116ec9ac 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointAttributes.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,16 +15,17 @@ namespace Azure.ResourceManager.Compute.Models /// Disk Restore Point details. public partial class DiskRestorePointAttributes : ComputeSubResourceData { - /// Initializes a new instance of DiskRestorePointAttributes. + /// Initializes a new instance of . public DiskRestorePointAttributes() { } - /// Initializes a new instance of DiskRestorePointAttributes. + /// Initializes a new instance of . /// Resource Id. /// Encryption at rest settings for disk restore point. It is an optional property that can be specified in the input while creating a restore point. /// Resource Id of the source disk restore point. - internal DiskRestorePointAttributes(ResourceIdentifier id, RestorePointEncryption encryption, WritableSubResource sourceDiskRestorePoint) : base(id) + /// Keeps track of any properties unknown to the library. + internal DiskRestorePointAttributes(ResourceIdentifier id, RestorePointEncryption encryption, WritableSubResource sourceDiskRestorePoint, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Encryption = encryption; SourceDiskRestorePoint = sourceDiskRestorePoint; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointData.Serialization.cs index 7b9469124462..0d0b517dcc73 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointData.Serialization.cs @@ -6,17 +6,113 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class DiskRestorePointData + public partial class DiskRestorePointData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskRestorePointData DeserializeDiskRestorePointData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(HyperVGeneration)) + { + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration.Value.ToString()); + } + if (Optional.IsDefined(PurchasePlan)) + { + writer.WritePropertyName("purchasePlan"u8); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } + } + if (Optional.IsDefined(SupportedCapabilities)) + { + writer.WritePropertyName("supportedCapabilities"u8); + if (SupportedCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SupportedCapabilities).Serialize(writer, options); + } + } + if (Optional.IsDefined(SupportsHibernation)) + { + writer.WritePropertyName("supportsHibernation"u8); + writer.WriteBooleanValue(SupportsHibernation.Value); + } + if (Optional.IsDefined(NetworkAccessPolicy)) + { + writer.WritePropertyName("networkAccessPolicy"u8); + writer.WriteStringValue(NetworkAccessPolicy.Value.ToString()); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsDefined(DiskAccessId)) + { + writer.WritePropertyName("diskAccessId"u8); + writer.WriteStringValue(DiskAccessId); + } + if (Optional.IsDefined(CompletionPercent)) + { + writer.WritePropertyName("completionPercent"u8); + writer.WriteNumberValue(CompletionPercent.Value); + } + if (Optional.IsDefined(SecurityProfile)) + { + writer.WritePropertyName("securityProfile"u8); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskRestorePointData DeserializeDiskRestorePointData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +138,7 @@ internal static DiskRestorePointData DeserializeDiskRestorePointData(JsonElement Optional replicationState = default; Optional sourceResourceLocation = default; Optional securityProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -221,8 +318,61 @@ internal static DiskRestorePointData DeserializeDiskRestorePointData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskRestorePointData(id, name, type, systemData.Value, Optional.ToNullable(timeCreated), sourceResourceId.Value, Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, familyId.Value, sourceUniqueId.Value, encryption.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(networkAccessPolicy), Optional.ToNullable(publicNetworkAccess), diskAccessId.Value, Optional.ToNullable(completionPercent), replicationState.Value, Optional.ToNullable(sourceResourceLocation), securityProfile.Value, serializedAdditionalRawData); + } + + DiskRestorePointData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskRestorePointData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskRestorePointData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskRestorePointData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskRestorePointData model) + { + if (model is null) + { + return null; } - return new DiskRestorePointData(id, name, type, systemData.Value, Optional.ToNullable(timeCreated), sourceResourceId.Value, Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, familyId.Value, sourceUniqueId.Value, encryption.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(networkAccessPolicy), Optional.ToNullable(publicNetworkAccess), diskAccessId.Value, Optional.ToNullable(completionPercent), replicationState.Value, Optional.ToNullable(sourceResourceLocation), securityProfile.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskRestorePointData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskRestorePointData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.Serialization.cs index 0805ee5cddab..f714ec877794 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskRestorePointInstanceView + public partial class DiskRestorePointInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskRestorePointInstanceView DeserializeDiskRestorePointInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ReplicationStatus)) + { + writer.WritePropertyName("replicationStatus"u8); + if (ReplicationStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReplicationStatus).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskRestorePointInstanceView DeserializeDiskRestorePointInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional replicationStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -36,8 +82,61 @@ internal static DiskRestorePointInstanceView DeserializeDiskRestorePointInstance replicationStatus = DiskRestorePointReplicationStatus.DeserializeDiskRestorePointReplicationStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiskRestorePointInstanceView(id.Value, replicationStatus.Value); + return new DiskRestorePointInstanceView(id.Value, replicationStatus.Value, serializedAdditionalRawData); + } + + DiskRestorePointInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskRestorePointInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskRestorePointInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskRestorePointInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskRestorePointInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskRestorePointInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskRestorePointInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.cs index e02e531c0f6d..ed5bf0d7b41b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointInstanceView.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The instance view of a disk restore point. public partial class DiskRestorePointInstanceView { - /// Initializes a new instance of DiskRestorePointInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DiskRestorePointInstanceView() { } - /// Initializes a new instance of DiskRestorePointInstanceView. + /// Initializes a new instance of . /// Disk restore point Id. /// The disk restore point replication status information. - internal DiskRestorePointInstanceView(string id, DiskRestorePointReplicationStatus replicationStatus) + /// Keeps track of any properties unknown to the library. + internal DiskRestorePointInstanceView(string id, DiskRestorePointReplicationStatus replicationStatus, Dictionary serializedAdditionalRawData) { Id = id; ReplicationStatus = replicationStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Disk restore point Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.Serialization.cs index 891b69ab201b..298ba868a381 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class DiskRestorePointList + internal partial class DiskRestorePointList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskRestorePointList DeserializeDiskRestorePointList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskRestorePointList DeserializeDiskRestorePointList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DiskRestorePointList DeserializeDiskRestorePointList(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiskRestorePointList(value, nextLink.Value); + return new DiskRestorePointList(value, nextLink.Value, serializedAdditionalRawData); + } + + DiskRestorePointList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskRestorePointList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskRestorePointList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskRestorePointList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskRestorePointList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskRestorePointList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskRestorePointList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.cs index 2c6d299fbcc6..5d3b9253a83d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Disk Restore Points operation response. internal partial class DiskRestorePointList { - /// Initializes a new instance of DiskRestorePointList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of disk restore points. /// is null. internal DiskRestorePointList(IEnumerable value) @@ -26,13 +29,20 @@ internal DiskRestorePointList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DiskRestorePointList. + /// Initializes a new instance of . /// A list of disk restore points. /// The uri to fetch the next page of disk restore points. Call ListNext() with this to fetch the next page of disk restore points. - internal DiskRestorePointList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DiskRestorePointList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskRestorePointList() + { } /// A list of disk restore points. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.Serialization.cs index 191b3c6b9857..6e18bba2dc3d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskRestorePointReplicationStatus + public partial class DiskRestorePointReplicationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiskRestorePointReplicationStatus DeserializeDiskRestorePointReplicationStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + if (Status is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Status).Serialize(writer, options); + } + } + if (Optional.IsDefined(CompletionPercent)) + { + writer.WritePropertyName("completionPercent"u8); + writer.WriteNumberValue(CompletionPercent.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiskRestorePointReplicationStatus DeserializeDiskRestorePointReplicationStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional completionPercent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -40,8 +86,61 @@ internal static DiskRestorePointReplicationStatus DeserializeDiskRestorePointRep completionPercent = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiskRestorePointReplicationStatus(status.Value, Optional.ToNullable(completionPercent)); + return new DiskRestorePointReplicationStatus(status.Value, Optional.ToNullable(completionPercent), serializedAdditionalRawData); + } + + DiskRestorePointReplicationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskRestorePointReplicationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskRestorePointReplicationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskRestorePointReplicationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskRestorePointReplicationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskRestorePointReplicationStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskRestorePointReplicationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.cs index 983fb6f0d531..099d2b3e8ac3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskRestorePointReplicationStatus.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The instance view of a disk restore point. public partial class DiskRestorePointReplicationStatus { - /// Initializes a new instance of DiskRestorePointReplicationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DiskRestorePointReplicationStatus() { } - /// Initializes a new instance of DiskRestorePointReplicationStatus. + /// Initializes a new instance of . /// The resource status information. /// Replication completion percentage. - internal DiskRestorePointReplicationStatus(InstanceViewStatus status, int? completionPercent) + /// Keeps track of any properties unknown to the library. + internal DiskRestorePointReplicationStatus(InstanceViewStatus status, int? completionPercent, Dictionary serializedAdditionalRawData) { Status = status; CompletionPercent = completionPercent; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource status information. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.Serialization.cs index f104b091a510..cdeb0fdee8d0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskSecurityProfile : IUtf8JsonSerializable + public partial class DiskSecurityProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecurityType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secureVMDiskEncryptionSetId"u8); writer.WriteStringValue(SecureVmDiskEncryptionSetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskSecurityProfile DeserializeDiskSecurityProfile(JsonElement element) + internal static DiskSecurityProfile DeserializeDiskSecurityProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional securityType = default; Optional secureVmDiskEncryptionSetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("securityType"u8)) @@ -56,8 +79,61 @@ internal static DiskSecurityProfile DeserializeDiskSecurityProfile(JsonElement e secureVmDiskEncryptionSetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskSecurityProfile(Optional.ToNullable(securityType), secureVmDiskEncryptionSetId.Value, serializedAdditionalRawData); + } + + DiskSecurityProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskSecurityProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskSecurityProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskSecurityProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskSecurityProfile model) + { + if (model is null) + { + return null; } - return new DiskSecurityProfile(Optional.ToNullable(securityType), secureVmDiskEncryptionSetId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskSecurityProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskSecurityProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.cs index 44c1aa4461f0..248b22033a8c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSecurityProfile.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Compute.Models /// Contains the security related information for the resource. public partial class DiskSecurityProfile { - /// Initializes a new instance of DiskSecurityProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskSecurityProfile() { } - /// Initializes a new instance of DiskSecurityProfile. + /// Initializes a new instance of . /// Specifies the SecurityType of the VM. Applicable for OS disks only. /// ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted with customer managed key. - internal DiskSecurityProfile(DiskSecurityType? securityType, ResourceIdentifier secureVmDiskEncryptionSetId) + /// Keeps track of any properties unknown to the library. + internal DiskSecurityProfile(DiskSecurityType? securityType, ResourceIdentifier secureVmDiskEncryptionSetId, Dictionary serializedAdditionalRawData) { SecurityType = securityType; SecureVmDiskEncryptionSetId = secureVmDiskEncryptionSetId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the SecurityType of the VM. Applicable for OS disks only. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.Serialization.cs index 0d53873a7db1..12b05ceb76cc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class DiskSku : IUtf8JsonSerializable + public partial class DiskSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiskSku DeserializeDiskSku(JsonElement element) + internal static DiskSku DeserializeDiskSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -47,8 +70,61 @@ internal static DiskSku DeserializeDiskSku(JsonElement element) tier = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskSku(Optional.ToNullable(name), tier.Value, serializedAdditionalRawData); + } + + DiskSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskSku model) + { + if (model is null) + { + return null; } - return new DiskSku(Optional.ToNullable(name), tier.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.cs index d144406256ca..317abd56ed8e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskSku.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. public partial class DiskSku { - /// Initializes a new instance of DiskSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiskSku() { } - /// Initializes a new instance of DiskSku. + /// Initializes a new instance of . /// The sku name. /// The sku tier. - internal DiskSku(DiskStorageAccountType? name, string tier) + /// Keeps track of any properties unknown to the library. + internal DiskSku(DiskStorageAccountType? name, string tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The sku name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.Serialization.cs index 4705241f0549..76db019934d0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class EncryptionImages : IUtf8JsonSerializable + public partial class EncryptionImages : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OSDiskImage)) { writer.WritePropertyName("osDiskImage"u8); - writer.WriteObjectValue(OSDiskImage); + if (OSDiskImage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDiskImage).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDiskImages)) { @@ -27,21 +41,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDiskImages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EncryptionImages DeserializeEncryptionImages(JsonElement element) + internal static EncryptionImages DeserializeEncryptionImages(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional osDiskImage = default; Optional> dataDiskImages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osDiskImage"u8)) @@ -67,8 +103,61 @@ internal static EncryptionImages DeserializeEncryptionImages(JsonElement element dataDiskImages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EncryptionImages(osDiskImage.Value, Optional.ToList(dataDiskImages), serializedAdditionalRawData); + } + + EncryptionImages IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionImages(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EncryptionImages IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEncryptionImages(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EncryptionImages model) + { + if (model is null) + { + return null; } - return new EncryptionImages(osDiskImage.Value, Optional.ToList(dataDiskImages)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EncryptionImages(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEncryptionImages(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.cs index 53cd847aa2b1..341da25b3ce5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionImages.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. public partial class EncryptionImages { - /// Initializes a new instance of EncryptionImages. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EncryptionImages() { DataDiskImages = new ChangeTrackingList(); } - /// Initializes a new instance of EncryptionImages. + /// Initializes a new instance of . /// Contains encryption settings for an OS disk image. /// A list of encryption specifications for data disk images. - internal EncryptionImages(OSDiskImageEncryption osDiskImage, IList dataDiskImages) + /// Keeps track of any properties unknown to the library. + internal EncryptionImages(OSDiskImageEncryption osDiskImage, IList dataDiskImages, Dictionary serializedAdditionalRawData) { OSDiskImage = osDiskImage; DataDiskImages = dataDiskImages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Contains encryption settings for an OS disk image. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.Serialization.cs index 415bcc1ffc9a..191b51c4b44a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class EncryptionSettingsElement : IUtf8JsonSerializable + public partial class EncryptionSettingsElement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskEncryptionKey)) { writer.WritePropertyName("diskEncryptionKey"u8); - writer.WriteObjectValue(DiskEncryptionKey); + if (DiskEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static EncryptionSettingsElement DeserializeEncryptionSettingsElement(JsonElement element) + internal static EncryptionSettingsElement DeserializeEncryptionSettingsElement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskEncryptionKey = default; Optional keyEncryptionKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskEncryptionKey"u8)) @@ -56,8 +93,61 @@ internal static EncryptionSettingsElement DeserializeEncryptionSettingsElement(J keyEncryptionKey = KeyVaultAndKeyReference.DeserializeKeyVaultAndKeyReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EncryptionSettingsElement(diskEncryptionKey.Value, keyEncryptionKey.Value, serializedAdditionalRawData); + } + + EncryptionSettingsElement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionSettingsElement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EncryptionSettingsElement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEncryptionSettingsElement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EncryptionSettingsElement model) + { + if (model is null) + { + return null; } - return new EncryptionSettingsElement(diskEncryptionKey.Value, keyEncryptionKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EncryptionSettingsElement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEncryptionSettingsElement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.cs index 7cc98711a4e4..f5d9cb1f7025 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsElement.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Encryption settings for one disk volume. public partial class EncryptionSettingsElement { - /// Initializes a new instance of EncryptionSettingsElement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EncryptionSettingsElement() { } - /// Initializes a new instance of EncryptionSettingsElement. + /// Initializes a new instance of . /// Key Vault Secret Url and vault id of the disk encryption key. /// Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. - internal EncryptionSettingsElement(KeyVaultAndSecretReference diskEncryptionKey, KeyVaultAndKeyReference keyEncryptionKey) + /// Keeps track of any properties unknown to the library. + internal EncryptionSettingsElement(KeyVaultAndSecretReference diskEncryptionKey, KeyVaultAndKeyReference keyEncryptionKey, Dictionary serializedAdditionalRawData) { DiskEncryptionKey = diskEncryptionKey; KeyEncryptionKey = keyEncryptionKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key Vault Secret Url and vault id of the disk encryption key. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.Serialization.cs index d665265d6d67..8333e0cdea25 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class EncryptionSettingsGroup : IUtf8JsonSerializable + public partial class EncryptionSettingsGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(Enabled); @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EncryptionSettings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -33,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("encryptionSettingsVersion"u8); writer.WriteStringValue(EncryptionSettingsVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EncryptionSettingsGroup DeserializeEncryptionSettingsGroup(JsonElement element) + internal static EncryptionSettingsGroup DeserializeEncryptionSettingsGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +73,7 @@ internal static EncryptionSettingsGroup DeserializeEncryptionSettingsGroup(JsonE bool enabled = default; Optional> encryptionSettings = default; Optional encryptionSettingsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -71,8 +100,61 @@ internal static EncryptionSettingsGroup DeserializeEncryptionSettingsGroup(JsonE encryptionSettingsVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EncryptionSettingsGroup(enabled, Optional.ToList(encryptionSettings), encryptionSettingsVersion.Value, serializedAdditionalRawData); + } + + EncryptionSettingsGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionSettingsGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EncryptionSettingsGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEncryptionSettingsGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EncryptionSettingsGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EncryptionSettingsGroup(Response response) + { + if (response is null) + { + return null; } - return new EncryptionSettingsGroup(enabled, Optional.ToList(encryptionSettings), encryptionSettingsVersion.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEncryptionSettingsGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.cs index f7059c06b3b0..8b74f83119e4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/EncryptionSettingsGroup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Encryption settings for disk or snapshot. public partial class EncryptionSettingsGroup { - /// Initializes a new instance of EncryptionSettingsGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. public EncryptionSettingsGroup(bool enabled) { @@ -21,15 +25,22 @@ public EncryptionSettingsGroup(bool enabled) EncryptionSettings = new ChangeTrackingList(); } - /// Initializes a new instance of EncryptionSettingsGroup. + /// Initializes a new instance of . /// Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. /// A collection of encryption settings, one for each disk volume. /// Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. - internal EncryptionSettingsGroup(bool enabled, IList encryptionSettings, string encryptionSettingsVersion) + /// Keeps track of any properties unknown to the library. + internal EncryptionSettingsGroup(bool enabled, IList encryptionSettings, string encryptionSettingsVersion, Dictionary serializedAdditionalRawData) { Enabled = enabled; EncryptionSettings = encryptionSettings; EncryptionSettingsVersion = encryptionSettingsVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EncryptionSettingsGroup() + { } /// Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.Serialization.cs index 60601114d11a..c94f325d9550 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryApplicationCustomAction : IUtf8JsonSerializable + public partial class GalleryApplicationCustomAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -31,15 +38,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryApplicationCustomAction DeserializeGalleryApplicationCustomAction(JsonElement element) + internal static GalleryApplicationCustomAction DeserializeGalleryApplicationCustomAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static GalleryApplicationCustomAction DeserializeGalleryApplicationCust string script = default; Optional description = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -79,8 +108,61 @@ internal static GalleryApplicationCustomAction DeserializeGalleryApplicationCust parameters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationCustomAction(name, script, description.Value, Optional.ToList(parameters), serializedAdditionalRawData); + } + + GalleryApplicationCustomAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationCustomAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationCustomAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationCustomAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationCustomAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationCustomAction(Response response) + { + if (response is null) + { + return null; } - return new GalleryApplicationCustomAction(name, script, description.Value, Optional.ToList(parameters)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationCustomAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.cs index 2cf9b3991705..189f4a4b7879 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomAction.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// A custom action that can be performed with a Gallery Application Version. public partial class GalleryApplicationCustomAction { - /// Initializes a new instance of GalleryApplicationCustomAction. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the custom action. Must be unique within the Gallery Application Version. /// The script to run when executing this custom action. /// or is null. @@ -28,17 +31,24 @@ public GalleryApplicationCustomAction(string name, string script) Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryApplicationCustomAction. + /// Initializes a new instance of . /// The name of the custom action. Must be unique within the Gallery Application Version. /// The script to run when executing this custom action. /// Description to help the users understand what this custom action does. /// The parameters that this custom action uses. - internal GalleryApplicationCustomAction(string name, string script, string description, IList parameters) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationCustomAction(string name, string script, string description, IList parameters, Dictionary serializedAdditionalRawData) { Name = name; Script = script; Description = description; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryApplicationCustomAction() + { } /// The name of the custom action. Must be unique within the Gallery Application Version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.Serialization.cs index f853b852f0d9..76b87b367445 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryApplicationCustomActionParameter : IUtf8JsonSerializable + public partial class GalleryApplicationCustomActionParameter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryApplicationCustomActionParameter DeserializeGalleryApplicationCustomActionParameter(JsonElement element) + internal static GalleryApplicationCustomActionParameter DeserializeGalleryApplicationCustomActionParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static GalleryApplicationCustomActionParameter DeserializeGalleryApplic Optional type = default; Optional defaultValue = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -86,8 +109,61 @@ internal static GalleryApplicationCustomActionParameter DeserializeGalleryApplic description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationCustomActionParameter(name, Optional.ToNullable(required), Optional.ToNullable(type), defaultValue.Value, description.Value, serializedAdditionalRawData); + } + + GalleryApplicationCustomActionParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationCustomActionParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationCustomActionParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationCustomActionParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationCustomActionParameter model) + { + if (model is null) + { + return null; } - return new GalleryApplicationCustomActionParameter(name, Optional.ToNullable(required), Optional.ToNullable(type), defaultValue.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationCustomActionParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationCustomActionParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.cs index fd12df9b5c3b..3474885696d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationCustomActionParameter.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// The definition of a parameter that can be passed to a custom action of a Gallery Application Version. public partial class GalleryApplicationCustomActionParameter { - /// Initializes a new instance of GalleryApplicationCustomActionParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the custom action. Must be unique within the Gallery Application Version. /// is null. public GalleryApplicationCustomActionParameter(string name) @@ -23,19 +27,26 @@ public GalleryApplicationCustomActionParameter(string name) Name = name; } - /// Initializes a new instance of GalleryApplicationCustomActionParameter. + /// Initializes a new instance of . /// The name of the custom action. Must be unique within the Gallery Application Version. /// Indicates whether this parameter must be passed when running the custom action. /// Specifies the type of the custom action parameter. Possible values are: String, ConfigurationDataBlob or LogOutputBlob. /// The default value of the parameter. Only applies to string types. /// A description to help users understand what this parameter means. - internal GalleryApplicationCustomActionParameter(string name, bool? isRequired, GalleryApplicationCustomActionParameterType? parameterType, string defaultValue, string description) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationCustomActionParameter(string name, bool? isRequired, GalleryApplicationCustomActionParameterType? parameterType, string defaultValue, string description, Dictionary serializedAdditionalRawData) { Name = name; IsRequired = isRequired; ParameterType = parameterType; DefaultValue = defaultValue; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryApplicationCustomActionParameter() + { } /// The name of the custom action. Must be unique within the Gallery Application Version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationData.Serialization.cs index 3991dbcd405f..803a8c60cc76 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class GalleryApplicationData : IUtf8JsonSerializable + public partial class GalleryApplicationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -70,16 +76,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomActions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryApplicationData DeserializeGalleryApplicationData(JsonElement element) + internal static GalleryApplicationData DeserializeGalleryApplicationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -97,6 +124,7 @@ internal static GalleryApplicationData DeserializeGalleryApplicationData(JsonEle Optional endOfLifeDate = default; Optional supportedOSType = default; Optional> customActions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -214,8 +242,61 @@ internal static GalleryApplicationData DeserializeGalleryApplicationData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(endOfLifeDate), Optional.ToNullable(supportedOSType), Optional.ToList(customActions), serializedAdditionalRawData); + } + + GalleryApplicationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationData(Response response) + { + if (response is null) + { + return null; } - return new GalleryApplicationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(endOfLifeDate), Optional.ToNullable(supportedOSType), Optional.ToList(customActions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.Serialization.cs index f341d7759442..1a1d56ad4724 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryApplicationList + internal partial class GalleryApplicationList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GalleryApplicationList DeserializeGalleryApplicationList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GalleryApplicationList DeserializeGalleryApplicationList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static GalleryApplicationList DeserializeGalleryApplicationList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GalleryApplicationList(value, nextLink.Value); + return new GalleryApplicationList(value, nextLink.Value, serializedAdditionalRawData); + } + + GalleryApplicationList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.cs index a1409aed4418..a430597123c9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Gallery Applications operation response. internal partial class GalleryApplicationList { - /// Initializes a new instance of GalleryApplicationList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of Gallery Applications. /// is null. internal GalleryApplicationList(IEnumerable value) @@ -26,13 +29,20 @@ internal GalleryApplicationList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of GalleryApplicationList. + /// Initializes a new instance of . /// A list of Gallery Applications. /// The uri to fetch the next page of Application Definitions in the Application Gallery. Call ListNext() with this to fetch the next page of gallery Application Definitions. - internal GalleryApplicationList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryApplicationList() + { } /// A list of Gallery Applications. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.Serialization.cs index 8270ad7f9e97..58fc3a952a3c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryApplicationPatch : IUtf8JsonSerializable + public partial class GalleryApplicationPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -64,12 +73,221 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomActions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GalleryApplicationPatch DeserializeGalleryApplicationPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional eula = default; + Optional privacyStatementUri = default; + Optional releaseNoteUri = default; + Optional endOfLifeDate = default; + Optional supportedOSType = default; + Optional> customActions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("eula"u8)) + { + eula = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privacyStatementUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privacyStatementUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("releaseNoteUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + releaseNoteUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("endOfLifeDate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endOfLifeDate = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("supportedOSType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportedOSType = property0.Value.GetString().ToSupportedOperatingSystemType(); + continue; + } + if (property0.NameEquals("customActions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(GalleryApplicationCustomAction.DeserializeGalleryApplicationCustomAction(item)); + } + customActions = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationPatch(id, name, type, systemData.Value, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(endOfLifeDate), Optional.ToNullable(supportedOSType), Optional.ToList(customActions), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + GalleryApplicationPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.cs index 247a5fbae051..a7962cad482a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationPatch.cs @@ -15,13 +15,43 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the gallery Application Definition that you want to update. public partial class GalleryApplicationPatch : ResourceData { - /// Initializes a new instance of GalleryApplicationPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryApplicationPatch() { CustomActions = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of this gallery Application Definition resource. This property is updatable. + /// The Eula agreement for the gallery Application Definition. + /// The privacy statement uri. + /// The release note uri. + /// The end of life date of the gallery Application Definition. This property can be used for decommissioning purposes. This property is updatable. + /// This property allows you to specify the supported type of the OS that application is built for. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. + /// A list of custom actions that can be performed with all of the Gallery Application Versions within this Gallery Application. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, DateTimeOffset? endOfLifeOn, SupportedOperatingSystemType? supportedOSType, IList customActions, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + EndOfLifeOn = endOfLifeOn; + SupportedOSType = supportedOSType; + CustomActions = customActions; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The description of this gallery Application Definition resource. This property is updatable. public string Description { get; set; } /// The Eula agreement for the gallery Application Definition. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionData.Serialization.cs index fa5fdcdaffcc..24735f7dbec7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class GalleryApplicationVersionData : IUtf8JsonSerializable + public partial class GalleryApplicationVersionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,19 +43,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublishingProfile)) { writer.WritePropertyName("publishingProfile"u8); - writer.WriteObjectValue(PublishingProfile); + if (PublishingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublishingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SafetyProfile)) { writer.WritePropertyName("safetyProfile"u8); - writer.WriteObjectValue(SafetyProfile); + if (SafetyProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SafetyProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryApplicationVersionData DeserializeGalleryApplicationVersionData(JsonElement element) + internal static GalleryApplicationVersionData DeserializeGalleryApplicationVersionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +98,7 @@ internal static GalleryApplicationVersionData DeserializeGalleryApplicationVersi Optional safetyProfile = default; Optional provisioningState = default; Optional replicationStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -156,8 +192,61 @@ internal static GalleryApplicationVersionData DeserializeGalleryApplicationVersi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, publishingProfile.Value, safetyProfile.Value, Optional.ToNullable(provisioningState), replicationStatus.Value, serializedAdditionalRawData); + } + + GalleryApplicationVersionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationVersionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationVersionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationVersionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationVersionData model) + { + if (model is null) + { + return null; } - return new GalleryApplicationVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, publishingProfile.Value, safetyProfile.Value, Optional.ToNullable(provisioningState), replicationStatus.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationVersionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationVersionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.Serialization.cs index c13763e3ed9d..be3822473fb7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryApplicationVersionList + internal partial class GalleryApplicationVersionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GalleryApplicationVersionList DeserializeGalleryApplicationVersionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GalleryApplicationVersionList DeserializeGalleryApplicationVersionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static GalleryApplicationVersionList DeserializeGalleryApplicationVersi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GalleryApplicationVersionList(value, nextLink.Value); + return new GalleryApplicationVersionList(value, nextLink.Value, serializedAdditionalRawData); + } + + GalleryApplicationVersionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationVersionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationVersionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationVersionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationVersionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationVersionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationVersionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.cs index df68a68c8c19..169b5ce8fda3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Gallery Application version operation response. internal partial class GalleryApplicationVersionList { - /// Initializes a new instance of GalleryApplicationVersionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of gallery Application Versions. /// is null. internal GalleryApplicationVersionList(IEnumerable value) @@ -26,13 +29,20 @@ internal GalleryApplicationVersionList(IEnumerable Initializes a new instance of GalleryApplicationVersionList. + /// Initializes a new instance of . /// A list of gallery Application Versions. /// The uri to fetch the next page of gallery Application Versions. Call ListNext() with this to fetch the next page of gallery Application Versions. - internal GalleryApplicationVersionList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationVersionList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryApplicationVersionList() + { } /// A list of gallery Application Versions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.Serialization.cs index 397dff5b8813..70805469ee39 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryApplicationVersionPatch : IUtf8JsonSerializable + public partial class GalleryApplicationVersionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -31,15 +40,204 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublishingProfile)) { writer.WritePropertyName("publishingProfile"u8); - writer.WriteObjectValue(PublishingProfile); + if (PublishingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublishingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SafetyProfile)) { writer.WritePropertyName("safetyProfile"u8); - writer.WriteObjectValue(SafetyProfile); + if (SafetyProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SafetyProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GalleryApplicationVersionPatch DeserializeGalleryApplicationVersionPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional publishingProfile = default; + Optional safetyProfile = default; + Optional provisioningState = default; + Optional replicationStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("publishingProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publishingProfile = GalleryApplicationVersionPublishingProfile.DeserializeGalleryApplicationVersionPublishingProfile(property0.Value); + continue; + } + if (property0.NameEquals("safetyProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + safetyProfile = GalleryApplicationVersionSafetyProfile.DeserializeGalleryApplicationVersionSafetyProfile(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new GalleryProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("replicationStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationStatus = ReplicationStatus.DeserializeReplicationStatus(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationVersionPatch(id, name, type, systemData.Value, publishingProfile.Value, safetyProfile.Value, Optional.ToNullable(provisioningState), replicationStatus.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + GalleryApplicationVersionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationVersionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationVersionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationVersionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationVersionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationVersionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationVersionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.cs index f9c4ed70e71e..f507552dafb4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,36 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the gallery Application Version that you want to update. public partial class GalleryApplicationVersionPatch : ResourceData { - /// Initializes a new instance of GalleryApplicationVersionPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryApplicationVersionPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The publishing profile of a gallery image version. + /// The safety profile of the Gallery Application Version. + /// The provisioning state, which only appears in the response. + /// This is the replication status of the gallery image version. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationVersionPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GalleryApplicationVersionPublishingProfile publishingProfile, GalleryApplicationVersionSafetyProfile safetyProfile, GalleryProvisioningState? provisioningState, ReplicationStatus replicationStatus, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + PublishingProfile = publishingProfile; + SafetyProfile = safetyProfile; + ProvisioningState = provisioningState; + ReplicationStatus = replicationStatus; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The publishing profile of a gallery image version. public GalleryApplicationVersionPublishingProfile PublishingProfile { get; set; } /// The safety profile of the Gallery Application Version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.Serialization.cs index 2444d652c535..9491dc3a0e27 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.Serialization.cs @@ -8,26 +8,53 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryApplicationVersionPublishingProfile : IUtf8JsonSerializable + public partial class GalleryApplicationVersionPublishingProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } if (Optional.IsDefined(ManageActions)) { writer.WritePropertyName("manageActions"u8); - writer.WriteObjectValue(ManageActions); + if (ManageActions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManageActions).Serialize(writer, options); + } } if (Optional.IsDefined(Settings)) { writer.WritePropertyName("settings"u8); - writer.WriteObjectValue(Settings); + if (Settings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Settings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AdvancedSettings)) { @@ -51,7 +78,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomActions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -61,7 +95,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetRegions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,15 +137,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetExtendedLocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApplicationVersionPublishingProfile(JsonElement element) + internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApplicationVersionPublishingProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -123,6 +185,7 @@ internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApp Optional storageAccountType = default; Optional replicationMode = default; Optional> targetExtendedLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("source"u8)) @@ -267,8 +330,61 @@ internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApp targetExtendedLocations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations), source, manageActions.Value, settings.Value, Optional.ToDictionary(advancedSettings), Optional.ToNullable(enableHealthCheck), Optional.ToList(customActions), serializedAdditionalRawData); + } + + GalleryApplicationVersionPublishingProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationVersionPublishingProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationVersionPublishingProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationVersionPublishingProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationVersionPublishingProfile model) + { + if (model is null) + { + return null; } - return new GalleryApplicationVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations), source, manageActions.Value, settings.Value, Optional.ToDictionary(advancedSettings), Optional.ToNullable(enableHealthCheck), Optional.ToList(customActions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationVersionPublishingProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationVersionPublishingProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs index c8940225e4c6..95fae46e861e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionPublishingProfile.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.Compute.Models /// The publishing profile of a gallery image version. public partial class GalleryApplicationVersionPublishingProfile : GalleryArtifactPublishingProfileBase { - /// Initializes a new instance of GalleryApplicationVersionPublishingProfile. + /// Initializes a new instance of . /// The source image from which the Image Version is going to be created. /// is null. public GalleryApplicationVersionPublishingProfile(UserArtifactSource source) @@ -26,7 +26,7 @@ public GalleryApplicationVersionPublishingProfile(UserArtifactSource source) CustomActions = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryApplicationVersionPublishingProfile. + /// Initializes a new instance of . /// The target regions where the Image Version is going to be replicated to. This property is updatable. /// The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. @@ -41,7 +41,8 @@ public GalleryApplicationVersionPublishingProfile(UserArtifactSource source) /// Optional. Additional settings to pass to the vm-application-manager extension. For advanced use only. /// Optional. Whether or not this application reports health. /// A list of custom actions that can be performed with this Gallery Application Version. - internal GalleryApplicationVersionPublishingProfile(IList targetRegions, int? replicaCount, bool? isExcludedFromLatest, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, ImageStorageAccountType? storageAccountType, GalleryReplicationMode? replicationMode, IList targetExtendedLocations, UserArtifactSource source, UserArtifactManagement manageActions, UserArtifactSettings settings, IDictionary advancedSettings, bool? enableHealthCheck, IList customActions) : base(targetRegions, replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationVersionPublishingProfile(IList targetRegions, int? replicaCount, bool? isExcludedFromLatest, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, ImageStorageAccountType? storageAccountType, GalleryReplicationMode? replicationMode, IList targetExtendedLocations, UserArtifactSource source, UserArtifactManagement manageActions, UserArtifactSettings settings, IDictionary advancedSettings, bool? enableHealthCheck, IList customActions, Dictionary serializedAdditionalRawData) : base(targetRegions, replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations, serializedAdditionalRawData) { Source = source; ManageActions = manageActions; @@ -51,6 +52,11 @@ internal GalleryApplicationVersionPublishingProfile(IList targetRe CustomActions = customActions; } + /// Initializes a new instance of for deserialization. + internal GalleryApplicationVersionPublishingProfile() + { + } + /// The source image from which the Image Version is going to be created. public UserArtifactSource Source { get; set; } /// Gets or sets the manage actions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.Serialization.cs index 14ebb53b9e56..60f657f1bd21 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryApplicationVersionSafetyProfile : IUtf8JsonSerializable + internal partial class GalleryApplicationVersionSafetyProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllowDeletionOfReplicatedLocations)) { writer.WritePropertyName("allowDeletionOfReplicatedLocations"u8); writer.WriteBooleanValue(AllowDeletionOfReplicatedLocations.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryApplicationVersionSafetyProfile DeserializeGalleryApplicationVersionSafetyProfile(JsonElement element) + internal static GalleryApplicationVersionSafetyProfile DeserializeGalleryApplicationVersionSafetyProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional allowDeletionOfReplicatedLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowDeletionOfReplicatedLocations"u8)) @@ -41,8 +64,61 @@ internal static GalleryApplicationVersionSafetyProfile DeserializeGalleryApplica allowDeletionOfReplicatedLocations = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryApplicationVersionSafetyProfile(Optional.ToNullable(allowDeletionOfReplicatedLocations), serializedAdditionalRawData); + } + + GalleryApplicationVersionSafetyProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryApplicationVersionSafetyProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryApplicationVersionSafetyProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryApplicationVersionSafetyProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryApplicationVersionSafetyProfile model) + { + if (model is null) + { + return null; } - return new GalleryApplicationVersionSafetyProfile(Optional.ToNullable(allowDeletionOfReplicatedLocations)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryApplicationVersionSafetyProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryApplicationVersionSafetyProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.cs index bd37fd829443..38402a4a379d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryApplicationVersionSafetyProfile.cs @@ -5,19 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The safety profile of the Gallery Application Version. internal partial class GalleryApplicationVersionSafetyProfile : GalleryArtifactSafetyProfileBase { - /// Initializes a new instance of GalleryApplicationVersionSafetyProfile. + /// Initializes a new instance of . public GalleryApplicationVersionSafetyProfile() { } - /// Initializes a new instance of GalleryApplicationVersionSafetyProfile. + /// Initializes a new instance of . /// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. - internal GalleryApplicationVersionSafetyProfile(bool? allowDeletionOfReplicatedLocations) : base(allowDeletionOfReplicatedLocations) + /// Keeps track of any properties unknown to the library. + internal GalleryApplicationVersionSafetyProfile(bool? allowDeletionOfReplicatedLocations, Dictionary serializedAdditionalRawData) : base(allowDeletionOfReplicatedLocations, serializedAdditionalRawData) { } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.Serialization.cs index d17e0d2d0db0..e0194f136a2d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryArtifactPublishingProfileBase : IUtf8JsonSerializable + public partial class GalleryArtifactPublishingProfileBase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(TargetRegions)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetRegions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -58,15 +71,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetExtendedLocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryArtifactPublishingProfileBase DeserializeGalleryArtifactPublishingProfileBase(JsonElement element) + internal static GalleryArtifactPublishingProfileBase DeserializeGalleryArtifactPublishingProfileBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +113,7 @@ internal static GalleryArtifactPublishingProfileBase DeserializeGalleryArtifactP Optional storageAccountType = default; Optional replicationMode = default; Optional> targetExtendedLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetRegions"u8)) @@ -163,8 +198,61 @@ internal static GalleryArtifactPublishingProfileBase DeserializeGalleryArtifactP targetExtendedLocations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryArtifactPublishingProfileBase(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations), serializedAdditionalRawData); + } + + GalleryArtifactPublishingProfileBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryArtifactPublishingProfileBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryArtifactPublishingProfileBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryArtifactPublishingProfileBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryArtifactPublishingProfileBase model) + { + if (model is null) + { + return null; } - return new GalleryArtifactPublishingProfileBase(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryArtifactPublishingProfileBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryArtifactPublishingProfileBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs index 3fe32aac2490..0bfc722712ae 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactPublishingProfileBase.cs @@ -14,14 +14,17 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the basic gallery artifact publishing profile. public partial class GalleryArtifactPublishingProfileBase { - /// Initializes a new instance of GalleryArtifactPublishingProfileBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryArtifactPublishingProfileBase() { TargetRegions = new ChangeTrackingList(); TargetExtendedLocations = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryArtifactPublishingProfileBase. + /// Initializes a new instance of . /// The target regions where the Image Version is going to be replicated to. This property is updatable. /// The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. @@ -30,7 +33,8 @@ public GalleryArtifactPublishingProfileBase() /// Specifies the storage account type to be used to store the image. This property is not updatable. /// Optional parameter which specifies the mode to be used for replication. This property is not updatable. /// The target extended locations where the Image Version is going to be replicated to. This property is updatable. - internal GalleryArtifactPublishingProfileBase(IList targetRegions, int? replicaCount, bool? isExcludedFromLatest, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, ImageStorageAccountType? storageAccountType, GalleryReplicationMode? replicationMode, IList targetExtendedLocations) + /// Keeps track of any properties unknown to the library. + internal GalleryArtifactPublishingProfileBase(IList targetRegions, int? replicaCount, bool? isExcludedFromLatest, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, ImageStorageAccountType? storageAccountType, GalleryReplicationMode? replicationMode, IList targetExtendedLocations, Dictionary serializedAdditionalRawData) { TargetRegions = targetRegions; ReplicaCount = replicaCount; @@ -40,6 +44,7 @@ internal GalleryArtifactPublishingProfileBase(IList targetRegions, StorageAccountType = storageAccountType; ReplicationMode = replicationMode; TargetExtendedLocations = targetExtendedLocations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The target regions where the Image Version is going to be replicated to. This property is updatable. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.Serialization.cs index 8c246337a6e6..06494f9dfd8f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryArtifactSafetyProfileBase : IUtf8JsonSerializable + public partial class GalleryArtifactSafetyProfileBase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllowDeletionOfReplicatedLocations)) { writer.WritePropertyName("allowDeletionOfReplicatedLocations"u8); writer.WriteBooleanValue(AllowDeletionOfReplicatedLocations.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryArtifactSafetyProfileBase DeserializeGalleryArtifactSafetyProfileBase(JsonElement element) + internal static GalleryArtifactSafetyProfileBase DeserializeGalleryArtifactSafetyProfileBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional allowDeletionOfReplicatedLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowDeletionOfReplicatedLocations"u8)) @@ -41,8 +64,61 @@ internal static GalleryArtifactSafetyProfileBase DeserializeGalleryArtifactSafet allowDeletionOfReplicatedLocations = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryArtifactSafetyProfileBase(Optional.ToNullable(allowDeletionOfReplicatedLocations), serializedAdditionalRawData); + } + + GalleryArtifactSafetyProfileBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryArtifactSafetyProfileBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryArtifactSafetyProfileBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryArtifactSafetyProfileBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryArtifactSafetyProfileBase model) + { + if (model is null) + { + return null; } - return new GalleryArtifactSafetyProfileBase(Optional.ToNullable(allowDeletionOfReplicatedLocations)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryArtifactSafetyProfileBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryArtifactSafetyProfileBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.cs index 1e30d22fd95b..3c0b1a0898ff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSafetyProfileBase.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the safety profile of the Gallery Artifact Version. public partial class GalleryArtifactSafetyProfileBase { - /// Initializes a new instance of GalleryArtifactSafetyProfileBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryArtifactSafetyProfileBase() { } - /// Initializes a new instance of GalleryArtifactSafetyProfileBase. + /// Initializes a new instance of . /// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. - internal GalleryArtifactSafetyProfileBase(bool? allowDeletionOfReplicatedLocations) + /// Keeps track of any properties unknown to the library. + internal GalleryArtifactSafetyProfileBase(bool? allowDeletionOfReplicatedLocations, Dictionary serializedAdditionalRawData) { AllowDeletionOfReplicatedLocations = allowDeletionOfReplicatedLocations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.Serialization.cs index 37c289200a21..9bd369e32813 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryArtifactVersionFullSource : IUtf8JsonSerializable + public partial class GalleryArtifactVersionFullSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CommunityGalleryImageId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryArtifactVersionFullSource DeserializeGalleryArtifactVersionFullSource(JsonElement element) + internal static GalleryArtifactVersionFullSource DeserializeGalleryArtifactVersionFullSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional communityGalleryImageId = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("communityGalleryImageId"u8)) @@ -52,8 +75,61 @@ internal static GalleryArtifactVersionFullSource DeserializeGalleryArtifactVersi id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryArtifactVersionFullSource(id.Value, communityGalleryImageId.Value, serializedAdditionalRawData); + } + + GalleryArtifactVersionFullSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryArtifactVersionFullSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryArtifactVersionFullSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryArtifactVersionFullSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryArtifactVersionFullSource model) + { + if (model is null) + { + return null; } - return new GalleryArtifactVersionFullSource(id.Value, communityGalleryImageId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryArtifactVersionFullSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryArtifactVersionFullSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.cs index dd5cbf7c898c..ceedee38a464 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionFullSource.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,15 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// The source of the gallery artifact version. public partial class GalleryArtifactVersionFullSource : GalleryArtifactVersionSource { - /// Initializes a new instance of GalleryArtifactVersionFullSource. + /// Initializes a new instance of . public GalleryArtifactVersionFullSource() { } - /// Initializes a new instance of GalleryArtifactVersionFullSource. + /// Initializes a new instance of . /// The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. /// The resource Id of the source Community Gallery Image. Only required when using Community Gallery Image as a source. - internal GalleryArtifactVersionFullSource(ResourceIdentifier id, string communityGalleryImageId) : base(id) + /// Keeps track of any properties unknown to the library. + internal GalleryArtifactVersionFullSource(ResourceIdentifier id, string communityGalleryImageId, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { CommunityGalleryImageId = communityGalleryImageId; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs index 53d2d7b72b22..ef5a8ce8a8a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryArtifactVersionSource : IUtf8JsonSerializable + public partial class GalleryArtifactVersionSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryArtifactVersionSource DeserializeGalleryArtifactVersionSource(JsonElement element) + internal static GalleryArtifactVersionSource DeserializeGalleryArtifactVersionSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static GalleryArtifactVersionSource DeserializeGalleryArtifactVersionSo id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryArtifactVersionSource(id.Value, serializedAdditionalRawData); + } + + GalleryArtifactVersionSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryArtifactVersionSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryArtifactVersionSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryArtifactVersionSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryArtifactVersionSource model) + { + if (model is null) + { + return null; } - return new GalleryArtifactVersionSource(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryArtifactVersionSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryArtifactVersionSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs index aff7e1d3e7a0..c1eff27e16d1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.Compute.Models /// The gallery artifact version source. public partial class GalleryArtifactVersionSource { - /// Initializes a new instance of GalleryArtifactVersionSource. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryArtifactVersionSource() { } - /// Initializes a new instance of GalleryArtifactVersionSource. + /// Initializes a new instance of . /// The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. - internal GalleryArtifactVersionSource(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal GalleryArtifactVersionSource(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryData.Serialization.cs index b67127f29ac9..5cd16f788aa8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class GalleryData : IUtf8JsonSerializable + public partial class GalleryData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -41,24 +48,59 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identifier)) { writer.WritePropertyName("identifier"u8); - writer.WriteObjectValue(Identifier); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } } if (Optional.IsDefined(SharingProfile)) { writer.WritePropertyName("sharingProfile"u8); - writer.WriteObjectValue(SharingProfile); + if (SharingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SharingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SoftDeletePolicy)) { writer.WritePropertyName("softDeletePolicy"u8); - writer.WriteObjectValue(SoftDeletePolicy); + if (SoftDeletePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SoftDeletePolicy).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryData DeserializeGalleryData(JsonElement element) + internal static GalleryData DeserializeGalleryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +117,7 @@ internal static GalleryData DeserializeGalleryData(JsonElement element) Optional sharingProfile = default; Optional softDeletePolicy = default; Optional sharingStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -182,8 +225,61 @@ internal static GalleryData DeserializeGalleryData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, description.Value, identifier.Value, Optional.ToNullable(provisioningState), sharingProfile.Value, softDeletePolicy.Value, sharingStatus.Value, serializedAdditionalRawData); + } + + GalleryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryData(Response response) + { + if (response is null) + { + return null; } - return new GalleryData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, description.Value, identifier.Value, Optional.ToNullable(provisioningState), sharingProfile.Value, softDeletePolicy.Value, sharingStatus.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.Serialization.cs index 90506fe15e70..e86c42757750 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryDataDiskImage : IUtf8JsonSerializable + public partial class GalleryDataDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lun"u8); writer.WriteNumberValue(Lun); @@ -25,13 +33,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GallerySource)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(GallerySource); + if (GallerySource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GallerySource).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GalleryDataDiskImage DeserializeGalleryDataDiskImage(JsonElement element) + internal static GalleryDataDiskImage DeserializeGalleryDataDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +69,7 @@ internal static GalleryDataDiskImage DeserializeGalleryDataDiskImage(JsonElement Optional sizeInGB = default; Optional hostCaching = default; Optional source = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -74,8 +104,61 @@ internal static GalleryDataDiskImage DeserializeGalleryDataDiskImage(JsonElement source = GalleryDiskImageSource.DeserializeGalleryDiskImageSource(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryDataDiskImage(Optional.ToNullable(sizeInGB), Optional.ToNullable(hostCaching), source.Value, lun, serializedAdditionalRawData); + } + + GalleryDataDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryDataDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryDataDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryDataDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryDataDiskImage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryDataDiskImage(Response response) + { + if (response is null) + { + return null; } - return new GalleryDataDiskImage(Optional.ToNullable(sizeInGB), Optional.ToNullable(hostCaching), source.Value, lun); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryDataDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.cs index 8d2f7cd7bf1a..9b3974272f3b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDataDiskImage.cs @@ -5,28 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the data disk image. public partial class GalleryDataDiskImage : GalleryDiskImage { - /// Initializes a new instance of GalleryDataDiskImage. + /// Initializes a new instance of . /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. public GalleryDataDiskImage(int lun) { Lun = lun; } - /// Initializes a new instance of GalleryDataDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// The source for the disk image. /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - internal GalleryDataDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryDiskImageSource gallerySource, int lun) : base(sizeInGB, hostCaching, gallerySource) + /// Keeps track of any properties unknown to the library. + internal GalleryDataDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryDiskImageSource gallerySource, int lun, Dictionary serializedAdditionalRawData) : base(sizeInGB, hostCaching, gallerySource, serializedAdditionalRawData) { Lun = lun; } + /// Initializes a new instance of for deserialization. + internal GalleryDataDiskImage() + { + } + /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. public int Lun { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.Serialization.cs index 4e58c0e42f19..4c7855128c52 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryDiskImage : IUtf8JsonSerializable + public partial class GalleryDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HostCaching)) { @@ -23,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GallerySource)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(GallerySource); + if (GallerySource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GallerySource).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GalleryDiskImage DeserializeGalleryDiskImage(JsonElement element) + internal static GalleryDiskImage DeserializeGalleryDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +66,7 @@ internal static GalleryDiskImage DeserializeGalleryDiskImage(JsonElement element Optional sizeInGB = default; Optional hostCaching = default; Optional source = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sizeInGB"u8)) @@ -66,8 +96,61 @@ internal static GalleryDiskImage DeserializeGalleryDiskImage(JsonElement element source = GalleryDiskImageSource.DeserializeGalleryDiskImageSource(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryDiskImage(Optional.ToNullable(sizeInGB), Optional.ToNullable(hostCaching), source.Value, serializedAdditionalRawData); + } + + GalleryDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryDiskImage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryDiskImage(Response response) + { + if (response is null) + { + return null; } - return new GalleryDiskImage(Optional.ToNullable(sizeInGB), Optional.ToNullable(hostCaching), source.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.cs index 26cb48bc0ba3..22a41c24fe57 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImage.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the disk image base class. public partial class GalleryDiskImage { - /// Initializes a new instance of GalleryDiskImage. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryDiskImage() { } - /// Initializes a new instance of GalleryDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// The source for the disk image. - internal GalleryDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryDiskImageSource gallerySource) + /// Keeps track of any properties unknown to the library. + internal GalleryDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryDiskImageSource gallerySource, Dictionary serializedAdditionalRawData) { SizeInGB = sizeInGB; HostCaching = hostCaching; GallerySource = gallerySource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property indicates the size of the VHD to be created. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.Serialization.cs index 2437f6f5cd51..20a6b3466ed9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryDiskImageSource : IUtf8JsonSerializable + public partial class GalleryDiskImageSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Uri)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryDiskImageSource DeserializeGalleryDiskImageSource(JsonElement element) + internal static GalleryDiskImageSource DeserializeGalleryDiskImageSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static GalleryDiskImageSource DeserializeGalleryDiskImageSource(JsonEle Optional uri = default; Optional storageAccountId = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uri"u8)) @@ -72,8 +94,61 @@ internal static GalleryDiskImageSource DeserializeGalleryDiskImageSource(JsonEle id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryDiskImageSource(id.Value, uri.Value, storageAccountId.Value, serializedAdditionalRawData); + } + + GalleryDiskImageSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryDiskImageSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryDiskImageSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryDiskImageSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryDiskImageSource model) + { + if (model is null) + { + return null; } - return new GalleryDiskImageSource(id.Value, uri.Value, storageAccountId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryDiskImageSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryDiskImageSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.cs index b4f249e0dbec..c3810528a70e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryDiskImageSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,16 +14,17 @@ namespace Azure.ResourceManager.Compute.Models /// The source for the disk image. public partial class GalleryDiskImageSource : GalleryArtifactVersionSource { - /// Initializes a new instance of GalleryDiskImageSource. + /// Initializes a new instance of . public GalleryDiskImageSource() { } - /// Initializes a new instance of GalleryDiskImageSource. + /// Initializes a new instance of . /// The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. /// The uri of the gallery artifact version source. Currently used to specify vhd/blob source. /// The Storage Account Id that contains the vhd blob being used as a source for this artifact version. - internal GalleryDiskImageSource(ResourceIdentifier id, Uri uri, ResourceIdentifier storageAccountId) : base(id) + /// Keeps track of any properties unknown to the library. + internal GalleryDiskImageSource(ResourceIdentifier id, Uri uri, ResourceIdentifier storageAccountId, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Uri = uri; StorageAccountId = storageAccountId; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.Serialization.cs index 8b2513b8b992..205becdb47e1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryExtendedLocation : IUtf8JsonSerializable + public partial class GalleryExtendedLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ExtendedLocationType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryExtendedLocation DeserializeGalleryExtendedLocation(JsonElement element) + internal static GalleryExtendedLocation DeserializeGalleryExtendedLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +75,61 @@ internal static GalleryExtendedLocation DeserializeGalleryExtendedLocation(JsonE type = new GalleryExtendedLocationType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryExtendedLocation(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + GalleryExtendedLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryExtendedLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryExtendedLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryExtendedLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryExtendedLocation model) + { + if (model is null) + { + return null; } - return new GalleryExtendedLocation(name.Value, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryExtendedLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryExtendedLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.cs index 22ff1e3ae0a8..bdbcfb7b758f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryExtendedLocation.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The name of the extended location. public partial class GalleryExtendedLocation { - /// Initializes a new instance of GalleryExtendedLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryExtendedLocation() { } - /// Initializes a new instance of GalleryExtendedLocation. + /// Initializes a new instance of . /// /// It is type of the extended location. - internal GalleryExtendedLocation(string name, GalleryExtendedLocationType? extendedLocationType) + /// Keeps track of any properties unknown to the library. + internal GalleryExtendedLocation(string name, GalleryExtendedLocationType? extendedLocationType, Dictionary serializedAdditionalRawData) { Name = name; ExtendedLocationType = extendedLocationType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.Serialization.cs index aacc7bdf780e..9ee544a44189 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryIdentifier : IUtf8JsonSerializable + internal partial class GalleryIdentifier : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryIdentifier DeserializeGalleryIdentifier(JsonElement element) + internal static GalleryIdentifier DeserializeGalleryIdentifier(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional uniqueName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uniqueName"u8)) @@ -32,8 +55,61 @@ internal static GalleryIdentifier DeserializeGalleryIdentifier(JsonElement eleme uniqueName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryIdentifier(uniqueName.Value, serializedAdditionalRawData); + } + + GalleryIdentifier IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryIdentifier(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryIdentifier IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryIdentifier(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryIdentifier model) + { + if (model is null) + { + return null; } - return new GalleryIdentifier(uniqueName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryIdentifier(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryIdentifier(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.cs index 5e9f7db24f44..e6aaf65624a3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryIdentifier.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the gallery unique name. internal partial class GalleryIdentifier { - /// Initializes a new instance of GalleryIdentifier. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryIdentifier() { } - /// Initializes a new instance of GalleryIdentifier. + /// Initializes a new instance of . /// The unique name of the Shared Image Gallery. This name is generated automatically by Azure. - internal GalleryIdentifier(string uniqueName) + /// Keeps track of any properties unknown to the library. + internal GalleryIdentifier(string uniqueName, Dictionary serializedAdditionalRawData) { UniqueName = uniqueName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique name of the Shared Image Gallery. This name is generated automatically by Azure. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageData.Serialization.cs index b3cf9e9b3c0b..7ff24eb57e78 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class GalleryImageData : IUtf8JsonSerializable + public partial class GalleryImageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -77,22 +83,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identifier)) { writer.WritePropertyName("identifier"u8); - writer.WriteObjectValue(Identifier); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } } if (Optional.IsDefined(Recommended)) { writer.WritePropertyName("recommended"u8); - writer.WriteObjectValue(Recommended); + if (Recommended is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recommended).Serialize(writer, options); + } } if (Optional.IsDefined(Disallowed)) { writer.WritePropertyName("disallowed"u8); - writer.WriteObjectValue(Disallowed); + if (Disallowed is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Disallowed).Serialize(writer, options); + } } if (Optional.IsDefined(PurchasePlan)) { writer.WritePropertyName("purchasePlan"u8); - writer.WriteObjectValue(PurchasePlan); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Features)) { @@ -100,7 +134,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Features) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -110,11 +151,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Architecture.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageData DeserializeGalleryImageData(JsonElement element) + internal static GalleryImageData DeserializeGalleryImageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -140,6 +195,7 @@ internal static GalleryImageData DeserializeGalleryImageData(JsonElement element Optional provisioningState = default; Optional> features = default; Optional architecture = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -329,8 +385,61 @@ internal static GalleryImageData DeserializeGalleryImageData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(hyperVGeneration), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, purchasePlan.Value, Optional.ToNullable(provisioningState), Optional.ToList(features), Optional.ToNullable(architecture), serializedAdditionalRawData); + } + + GalleryImageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageData(Response response) + { + if (response is null) + { + return null; } - return new GalleryImageData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(hyperVGeneration), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, purchasePlan.Value, Optional.ToNullable(provisioningState), Optional.ToList(features), Optional.ToNullable(architecture)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.Serialization.cs index af1d214aeed7..43c02c1c73f5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageFeature : IUtf8JsonSerializable + public partial class GalleryImageFeature : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageFeature DeserializeGalleryImageFeature(JsonElement element) + internal static GalleryImageFeature DeserializeGalleryImageFeature(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static GalleryImageFeature DeserializeGalleryImageFeature(JsonElement e value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageFeature(name.Value, value.Value, serializedAdditionalRawData); + } + + GalleryImageFeature IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageFeature(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageFeature IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageFeature(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageFeature model) + { + if (model is null) + { + return null; } - return new GalleryImageFeature(name.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageFeature(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageFeature(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.cs index a96b63921efe..27049706aea8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageFeature.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// A feature for gallery image. public partial class GalleryImageFeature { - /// Initializes a new instance of GalleryImageFeature. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryImageFeature() { } - /// Initializes a new instance of GalleryImageFeature. + /// Initializes a new instance of . /// The name of the gallery image feature. /// The value of the gallery image feature. - internal GalleryImageFeature(string name, string value) + /// Keeps track of any properties unknown to the library. + internal GalleryImageFeature(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the gallery image feature. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.Serialization.cs index 80eed46adda3..434d4c690b11 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageIdentifier : IUtf8JsonSerializable + public partial class GalleryImageIdentifier : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("publisher"u8); writer.WriteStringValue(Publisher); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Offer); writer.WritePropertyName("sku"u8); writer.WriteStringValue(Sku); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageIdentifier DeserializeGalleryImageIdentifier(JsonElement element) + internal static GalleryImageIdentifier DeserializeGalleryImageIdentifier(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static GalleryImageIdentifier DeserializeGalleryImageIdentifier(JsonEle string publisher = default; string offer = default; string sku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher"u8)) @@ -50,8 +73,61 @@ internal static GalleryImageIdentifier DeserializeGalleryImageIdentifier(JsonEle sku = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageIdentifier(publisher, offer, sku, serializedAdditionalRawData); + } + + GalleryImageIdentifier IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageIdentifier(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageIdentifier IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageIdentifier(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageIdentifier model) + { + if (model is null) + { + return null; } - return new GalleryImageIdentifier(publisher, offer, sku); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageIdentifier(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageIdentifier(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.cs index a27f651331ee..5b6ddbe16339 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageIdentifier.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// This is the gallery image definition identifier. public partial class GalleryImageIdentifier { - /// Initializes a new instance of GalleryImageIdentifier. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the gallery image definition publisher. /// The name of the gallery image definition offer. /// The name of the gallery image definition SKU. @@ -29,6 +33,19 @@ public GalleryImageIdentifier(string publisher, string offer, string sku) Sku = sku; } + /// Initializes a new instance of . + /// The name of the gallery image definition publisher. + /// The name of the gallery image definition offer. + /// The name of the gallery image definition SKU. + /// Keeps track of any properties unknown to the library. + internal GalleryImageIdentifier(string publisher, string offer, string sku, Dictionary serializedAdditionalRawData) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the gallery image definition publisher. public string Publisher { get; set; } /// The name of the gallery image definition offer. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.Serialization.cs index fed41560bd42..ca18886f84be 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryImageList + internal partial class GalleryImageList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GalleryImageList DeserializeGalleryImageList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GalleryImageList DeserializeGalleryImageList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static GalleryImageList DeserializeGalleryImageList(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GalleryImageList(value, nextLink.Value); + return new GalleryImageList(value, nextLink.Value, serializedAdditionalRawData); + } + + GalleryImageList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.cs index 781d402f2e89..b5ce60d4b0fc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Gallery Images operation response. internal partial class GalleryImageList { - /// Initializes a new instance of GalleryImageList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of Shared Image Gallery images. /// is null. internal GalleryImageList(IEnumerable value) @@ -26,13 +29,20 @@ internal GalleryImageList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of GalleryImageList. + /// Initializes a new instance of . /// A list of Shared Image Gallery images. /// The uri to fetch the next page of Image Definitions in the Shared Image Gallery. Call ListNext() with this to fetch the next page of gallery image definitions. - internal GalleryImageList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GalleryImageList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryImageList() + { } /// A list of Shared Image Gallery images. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.Serialization.cs index ac3a4975d6c3..48d8d4a9693f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImagePatch : IUtf8JsonSerializable + public partial class GalleryImagePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -71,22 +80,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identifier)) { writer.WritePropertyName("identifier"u8); - writer.WriteObjectValue(Identifier); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } } if (Optional.IsDefined(Recommended)) { writer.WritePropertyName("recommended"u8); - writer.WriteObjectValue(Recommended); + if (Recommended is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recommended).Serialize(writer, options); + } } if (Optional.IsDefined(Disallowed)) { writer.WritePropertyName("disallowed"u8); - writer.WriteObjectValue(Disallowed); + if (Disallowed is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Disallowed).Serialize(writer, options); + } } if (Optional.IsDefined(PurchasePlan)) { writer.WritePropertyName("purchasePlan"u8); - writer.WriteObjectValue(PurchasePlan); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Features)) { @@ -94,7 +131,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Features) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -104,7 +148,289 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Architecture.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GalleryImagePatch DeserializeGalleryImagePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional eula = default; + Optional privacyStatementUri = default; + Optional releaseNoteUri = default; + Optional osType = default; + Optional osState = default; + Optional hyperVGeneration = default; + Optional endOfLifeDate = default; + Optional identifier = default; + Optional recommended = default; + Optional disallowed = default; + Optional purchasePlan = default; + Optional provisioningState = default; + Optional> features = default; + Optional architecture = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("eula"u8)) + { + eula = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privacyStatementUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privacyStatementUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("releaseNoteUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + releaseNoteUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("osType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osType = property0.Value.GetString().ToSupportedOperatingSystemType(); + continue; + } + if (property0.NameEquals("osState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osState = property0.Value.GetString().ToOperatingSystemStateType(); + continue; + } + if (property0.NameEquals("hyperVGeneration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hyperVGeneration = new HyperVGeneration(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("endOfLifeDate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endOfLifeDate = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("identifier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifier = GalleryImageIdentifier.DeserializeGalleryImageIdentifier(property0.Value); + continue; + } + if (property0.NameEquals("recommended"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recommended = RecommendedMachineConfiguration.DeserializeRecommendedMachineConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("disallowed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disallowed = Disallowed.DeserializeDisallowed(property0.Value); + continue; + } + if (property0.NameEquals("purchasePlan"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + purchasePlan = ImagePurchasePlan.DeserializeImagePurchasePlan(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new GalleryProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("features"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(GalleryImageFeature.DeserializeGalleryImageFeature(item)); + } + features = array; + continue; + } + if (property0.NameEquals("architecture"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + architecture = new ArchitectureType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImagePatch(id, name, type, systemData.Value, description.Value, eula.Value, privacyStatementUri.Value, releaseNoteUri.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(hyperVGeneration), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, purchasePlan.Value, Optional.ToNullable(provisioningState), Optional.ToList(features), Optional.ToNullable(architecture), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + GalleryImagePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImagePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImagePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImagePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImagePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImagePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImagePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.cs index dfd879ff37dd..71da6530e2af 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImagePatch.cs @@ -15,13 +15,59 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the gallery image definition that you want to update. public partial class GalleryImagePatch : ResourceData { - /// Initializes a new instance of GalleryImagePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryImagePatch() { Features = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of this gallery image definition resource. This property is updatable. + /// The Eula agreement for the gallery image definition. + /// The privacy statement uri. + /// The release note uri. + /// This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. + /// This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. + /// The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + /// The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable. + /// This is the gallery image definition identifier. + /// The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + /// Describes the disallowed disk types. + /// Describes the gallery image definition purchase plan. This is used by marketplace images. + /// The provisioning state, which only appears in the response. + /// A list of gallery image features. + /// The architecture of the image. Applicable to OS disks only. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal GalleryImagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string eula, Uri privacyStatementUri, Uri releaseNoteUri, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, HyperVGeneration? hyperVGeneration, DateTimeOffset? endOfLifeOn, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, ImagePurchasePlan purchasePlan, GalleryProvisioningState? provisioningState, IList features, ArchitectureType? architecture, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Description = description; + Eula = eula; + PrivacyStatementUri = privacyStatementUri; + ReleaseNoteUri = releaseNoteUri; + OSType = osType; + OSState = osState; + HyperVGeneration = hyperVGeneration; + EndOfLifeOn = endOfLifeOn; + Identifier = identifier; + Recommended = recommended; + Disallowed = disallowed; + PurchasePlan = purchasePlan; + ProvisioningState = provisioningState; + Features = features; + Architecture = architecture; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The description of this gallery image definition resource. This property is updatable. public string Description { get; set; } /// The Eula agreement for the gallery image definition. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionData.Serialization.cs index 6462a1abd55f..c44f13c4ab90 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class GalleryImageVersionData : IUtf8JsonSerializable + public partial class GalleryImageVersionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,24 +43,59 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublishingProfile)) { writer.WritePropertyName("publishingProfile"u8); - writer.WriteObjectValue(PublishingProfile); + if (PublishingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublishingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SafetyProfile)) { writer.WritePropertyName("safetyProfile"u8); - writer.WriteObjectValue(SafetyProfile); + if (SafetyProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SafetyProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageVersionData DeserializeGalleryImageVersionData(JsonElement element) + internal static GalleryImageVersionData DeserializeGalleryImageVersionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +111,7 @@ internal static GalleryImageVersionData DeserializeGalleryImageVersionData(JsonE Optional storageProfile = default; Optional safetyProfile = default; Optional replicationStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -171,8 +214,61 @@ internal static GalleryImageVersionData DeserializeGalleryImageVersionData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, publishingProfile.Value, Optional.ToNullable(provisioningState), storageProfile.Value, safetyProfile.Value, replicationStatus.Value, serializedAdditionalRawData); + } + + GalleryImageVersionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionData(Response response) + { + if (response is null) + { + return null; } - return new GalleryImageVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, publishingProfile.Value, Optional.ToNullable(provisioningState), storageProfile.Value, safetyProfile.Value, replicationStatus.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.Serialization.cs index 4758e5fb63f6..257a0ecf4c05 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryImageVersionList + internal partial class GalleryImageVersionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GalleryImageVersionList DeserializeGalleryImageVersionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GalleryImageVersionList DeserializeGalleryImageVersionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static GalleryImageVersionList DeserializeGalleryImageVersionList(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GalleryImageVersionList(value, nextLink.Value); + return new GalleryImageVersionList(value, nextLink.Value, serializedAdditionalRawData); + } + + GalleryImageVersionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.cs index a282ade38c65..5b331c28d719 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Gallery Image version operation response. internal partial class GalleryImageVersionList { - /// Initializes a new instance of GalleryImageVersionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of gallery image versions. /// is null. internal GalleryImageVersionList(IEnumerable value) @@ -26,13 +29,20 @@ internal GalleryImageVersionList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of GalleryImageVersionList. + /// Initializes a new instance of . /// A list of gallery image versions. /// The uri to fetch the next page of gallery image versions. Call ListNext() with this to fetch the next page of gallery image versions. - internal GalleryImageVersionList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryImageVersionList() + { } /// A list of gallery image versions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.Serialization.cs index f34c8d01d785..81151450c7c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageVersionPatch : IUtf8JsonSerializable + public partial class GalleryImageVersionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -31,20 +40,226 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublishingProfile)) { writer.WritePropertyName("publishingProfile"u8); - writer.WriteObjectValue(PublishingProfile); + if (PublishingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublishingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SafetyProfile)) { writer.WritePropertyName("safetyProfile"u8); - writer.WriteObjectValue(SafetyProfile); + if (SafetyProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SafetyProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GalleryImageVersionPatch DeserializeGalleryImageVersionPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional publishingProfile = default; + Optional provisioningState = default; + Optional storageProfile = default; + Optional safetyProfile = default; + Optional replicationStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("publishingProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publishingProfile = GalleryImageVersionPublishingProfile.DeserializeGalleryImageVersionPublishingProfile(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new GalleryProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("storageProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = GalleryImageVersionStorageProfile.DeserializeGalleryImageVersionStorageProfile(property0.Value); + continue; + } + if (property0.NameEquals("safetyProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + safetyProfile = GalleryImageVersionSafetyProfile.DeserializeGalleryImageVersionSafetyProfile(property0.Value); + continue; + } + if (property0.NameEquals("replicationStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationStatus = ReplicationStatus.DeserializeReplicationStatus(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageVersionPatch(id, name, type, systemData.Value, publishingProfile.Value, Optional.ToNullable(provisioningState), storageProfile.Value, safetyProfile.Value, replicationStatus.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + GalleryImageVersionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.cs index 836f8ea9db02..aad348ec5c82 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,38 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the gallery image version that you want to update. public partial class GalleryImageVersionPatch : ResourceData { - /// Initializes a new instance of GalleryImageVersionPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryImageVersionPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The publishing profile of a gallery image Version. + /// The provisioning state, which only appears in the response. + /// This is the storage profile of a Gallery Image Version. + /// This is the safety profile of the Gallery Image Version. + /// This is the replication status of the gallery image version. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GalleryImageVersionPublishingProfile publishingProfile, GalleryProvisioningState? provisioningState, GalleryImageVersionStorageProfile storageProfile, GalleryImageVersionSafetyProfile safetyProfile, ReplicationStatus replicationStatus, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + PublishingProfile = publishingProfile; + ProvisioningState = provisioningState; + StorageProfile = storageProfile; + SafetyProfile = safetyProfile; + ReplicationStatus = replicationStatus; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The publishing profile of a gallery image Version. public GalleryImageVersionPublishingProfile PublishingProfile { get; set; } /// The provisioning state, which only appears in the response. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.Serialization.cs index 4ea79fbd58c9..543d8ed6f12c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageVersionPolicyViolation + public partial class GalleryImageVersionPolicyViolation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GalleryImageVersionPolicyViolation DeserializeGalleryImageVersionPolicyViolation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.Value.ToString()); + } + if (Optional.IsDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStringValue(Details); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GalleryImageVersionPolicyViolation DeserializeGalleryImageVersionPolicyViolation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional category = default; Optional details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -36,8 +75,61 @@ internal static GalleryImageVersionPolicyViolation DeserializeGalleryImageVersio details = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GalleryImageVersionPolicyViolation(Optional.ToNullable(category), details.Value); + return new GalleryImageVersionPolicyViolation(Optional.ToNullable(category), details.Value, serializedAdditionalRawData); + } + + GalleryImageVersionPolicyViolation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionPolicyViolation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionPolicyViolation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionPolicyViolation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionPolicyViolation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionPolicyViolation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionPolicyViolation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.cs index 3e2839d83d59..f3d2650f2cc1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPolicyViolation.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// A policy violation reported against a gallery artifact. public partial class GalleryImageVersionPolicyViolation { - /// Initializes a new instance of GalleryImageVersionPolicyViolation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GalleryImageVersionPolicyViolation() { } - /// Initializes a new instance of GalleryImageVersionPolicyViolation. + /// Initializes a new instance of . /// Describes the nature of the policy violation. /// Describes specific details about why this policy violation was reported. - internal GalleryImageVersionPolicyViolation(GalleryImageVersionPolicyViolationCategory? category, string details) + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionPolicyViolation(GalleryImageVersionPolicyViolationCategory? category, string details, Dictionary serializedAdditionalRawData) { Category = category; Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the nature of the policy violation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.Serialization.cs index 10143dfdee11..c04e6e75d603 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageVersionPublishingProfile : IUtf8JsonSerializable + public partial class GalleryImageVersionPublishingProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(TargetRegions)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetRegions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -58,15 +71,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetExtendedLocations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVersionPublishingProfile(JsonElement element) + internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVersionPublishingProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +113,7 @@ internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVers Optional storageAccountType = default; Optional replicationMode = default; Optional> targetExtendedLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetRegions"u8)) @@ -163,8 +198,61 @@ internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVers targetExtendedLocations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations), serializedAdditionalRawData); + } + + GalleryImageVersionPublishingProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionPublishingProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionPublishingProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionPublishingProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionPublishingProfile model) + { + if (model is null) + { + return null; } - return new GalleryImageVersionPublishingProfile(Optional.ToList(targetRegions), Optional.ToNullable(replicaCount), Optional.ToNullable(excludeFromLatest), Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(storageAccountType), Optional.ToNullable(replicationMode), Optional.ToList(targetExtendedLocations)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionPublishingProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionPublishingProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs index 357e8dcf3308..82b0bcfa8fc8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionPublishingProfile.cs @@ -13,12 +13,12 @@ namespace Azure.ResourceManager.Compute.Models /// The publishing profile of a gallery image Version. public partial class GalleryImageVersionPublishingProfile : GalleryArtifactPublishingProfileBase { - /// Initializes a new instance of GalleryImageVersionPublishingProfile. + /// Initializes a new instance of . public GalleryImageVersionPublishingProfile() { } - /// Initializes a new instance of GalleryImageVersionPublishingProfile. + /// Initializes a new instance of . /// The target regions where the Image Version is going to be replicated to. This property is updatable. /// The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. @@ -27,7 +27,8 @@ public GalleryImageVersionPublishingProfile() /// Specifies the storage account type to be used to store the image. This property is not updatable. /// Optional parameter which specifies the mode to be used for replication. This property is not updatable. /// The target extended locations where the Image Version is going to be replicated to. This property is updatable. - internal GalleryImageVersionPublishingProfile(IList targetRegions, int? replicaCount, bool? isExcludedFromLatest, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, ImageStorageAccountType? storageAccountType, GalleryReplicationMode? replicationMode, IList targetExtendedLocations) : base(targetRegions, replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations) + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionPublishingProfile(IList targetRegions, int? replicaCount, bool? isExcludedFromLatest, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, ImageStorageAccountType? storageAccountType, GalleryReplicationMode? replicationMode, IList targetExtendedLocations, Dictionary serializedAdditionalRawData) : base(targetRegions, replicaCount, isExcludedFromLatest, publishedOn, endOfLifeOn, storageAccountType, replicationMode, targetExtendedLocations, serializedAdditionalRawData) { } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.Serialization.cs index e7c6c374a6f3..5544ac23900c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.Serialization.cs @@ -5,27 +5,48 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageVersionSafetyProfile : IUtf8JsonSerializable + public partial class GalleryImageVersionSafetyProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllowDeletionOfReplicatedLocations)) { writer.WritePropertyName("allowDeletionOfReplicatedLocations"u8); writer.WriteBooleanValue(AllowDeletionOfReplicatedLocations.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageVersionSafetyProfile DeserializeGalleryImageVersionSafetyProfile(JsonElement element) + internal static GalleryImageVersionSafetyProfile DeserializeGalleryImageVersionSafetyProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +54,7 @@ internal static GalleryImageVersionSafetyProfile DeserializeGalleryImageVersionS Optional reportedForPolicyViolation = default; Optional> policyViolations = default; Optional allowDeletionOfReplicatedLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("reportedForPolicyViolation"u8)) @@ -67,8 +89,61 @@ internal static GalleryImageVersionSafetyProfile DeserializeGalleryImageVersionS allowDeletionOfReplicatedLocations = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageVersionSafetyProfile(Optional.ToNullable(allowDeletionOfReplicatedLocations), Optional.ToNullable(reportedForPolicyViolation), Optional.ToList(policyViolations), serializedAdditionalRawData); + } + + GalleryImageVersionSafetyProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionSafetyProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionSafetyProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionSafetyProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionSafetyProfile model) + { + if (model is null) + { + return null; } - return new GalleryImageVersionSafetyProfile(Optional.ToNullable(allowDeletionOfReplicatedLocations), Optional.ToNullable(reportedForPolicyViolation), Optional.ToList(policyViolations)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionSafetyProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionSafetyProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.cs index 40e409e21a6a..53ddd466a543 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionSafetyProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,18 @@ namespace Azure.ResourceManager.Compute.Models /// This is the safety profile of the Gallery Image Version. public partial class GalleryImageVersionSafetyProfile : GalleryArtifactSafetyProfileBase { - /// Initializes a new instance of GalleryImageVersionSafetyProfile. + /// Initializes a new instance of . public GalleryImageVersionSafetyProfile() { PolicyViolations = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryImageVersionSafetyProfile. + /// Initializes a new instance of . /// Indicates whether or not removing this Gallery Image Version from replicated regions is allowed. /// Indicates whether this image has been reported as violating Microsoft's policies. /// A list of Policy Violations that have been reported for this Gallery Image Version. - internal GalleryImageVersionSafetyProfile(bool? allowDeletionOfReplicatedLocations, bool? isReportedForPolicyViolation, IReadOnlyList policyViolations) : base(allowDeletionOfReplicatedLocations) + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionSafetyProfile(bool? allowDeletionOfReplicatedLocations, bool? isReportedForPolicyViolation, IReadOnlyList policyViolations, Dictionary serializedAdditionalRawData) : base(allowDeletionOfReplicatedLocations, serializedAdditionalRawData) { IsReportedForPolicyViolation = isReportedForPolicyViolation; PolicyViolations = policyViolations; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.Serialization.cs index aeef5c6bc4b9..05bc11de0488 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryImageVersionStorageProfile : IUtf8JsonSerializable + public partial class GalleryImageVersionStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GallerySource)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(GallerySource); + if (GallerySource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GallerySource).Serialize(writer, options); + } } if (Optional.IsDefined(OSDiskImage)) { writer.WritePropertyName("osDiskImage"u8); - writer.WriteObjectValue(OSDiskImage); + if (OSDiskImage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDiskImage).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDiskImages)) { @@ -32,15 +53,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDiskImages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersionStorageProfile(JsonElement element) + internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersionStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +90,7 @@ internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersion Optional source = default; Optional osDiskImage = default; Optional> dataDiskImages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("source"u8)) @@ -82,8 +125,61 @@ internal static GalleryImageVersionStorageProfile DeserializeGalleryImageVersion dataDiskImages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryImageVersionStorageProfile(source.Value, osDiskImage.Value, Optional.ToList(dataDiskImages), serializedAdditionalRawData); + } + + GalleryImageVersionStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageVersionStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryImageVersionStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryImageVersionStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryImageVersionStorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryImageVersionStorageProfile(Response response) + { + if (response is null) + { + return null; } - return new GalleryImageVersionStorageProfile(source.Value, osDiskImage.Value, Optional.ToList(dataDiskImages)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryImageVersionStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.cs index 61f97b5b13ac..08a886e63cbe 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryImageVersionStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Compute.Models /// This is the storage profile of a Gallery Image Version. public partial class GalleryImageVersionStorageProfile { - /// Initializes a new instance of GalleryImageVersionStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryImageVersionStorageProfile() { DataDiskImages = new ChangeTrackingList(); } - /// Initializes a new instance of GalleryImageVersionStorageProfile. + /// Initializes a new instance of . /// The source of the gallery artifact version. /// This is the OS disk image. /// A list of data disk images. - internal GalleryImageVersionStorageProfile(GalleryArtifactVersionFullSource gallerySource, GalleryOSDiskImage osDiskImage, IList dataDiskImages) + /// Keeps track of any properties unknown to the library. + internal GalleryImageVersionStorageProfile(GalleryArtifactVersionFullSource gallerySource, GalleryOSDiskImage osDiskImage, IList dataDiskImages, Dictionary serializedAdditionalRawData) { GallerySource = gallerySource; OSDiskImage = osDiskImage; DataDiskImages = dataDiskImages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the OS disk image. public GalleryOSDiskImage OSDiskImage { get; set; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.Serialization.cs index e71537351f33..4640f5229f44 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class GalleryList + internal partial class GalleryList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GalleryList DeserializeGalleryList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GalleryList DeserializeGalleryList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static GalleryList DeserializeGalleryList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GalleryList(value, nextLink.Value); + return new GalleryList(value, nextLink.Value, serializedAdditionalRawData); + } + + GalleryList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.cs index d88d1d886c61..3e13f3ed1bb7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Galleries operation response. internal partial class GalleryList { - /// Initializes a new instance of GalleryList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of galleries. /// is null. internal GalleryList(IEnumerable value) @@ -26,13 +29,20 @@ internal GalleryList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of GalleryList. + /// Initializes a new instance of . /// A list of galleries. /// The uri to fetch the next page of galleries. Call ListNext() with this to fetch the next page of galleries. - internal GalleryList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal GalleryList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GalleryList() + { } /// A list of galleries. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.Serialization.cs index fe39f71f4dfc..4257599310a5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryOSDiskImage : IUtf8JsonSerializable + public partial class GalleryOSDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HostCaching)) { @@ -23,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GallerySource)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(GallerySource); + if (GallerySource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GallerySource).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GalleryOSDiskImage DeserializeGalleryOSDiskImage(JsonElement element) + internal static GalleryOSDiskImage DeserializeGalleryOSDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +66,7 @@ internal static GalleryOSDiskImage DeserializeGalleryOSDiskImage(JsonElement ele Optional sizeInGB = default; Optional hostCaching = default; Optional source = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sizeInGB"u8)) @@ -66,8 +96,61 @@ internal static GalleryOSDiskImage DeserializeGalleryOSDiskImage(JsonElement ele source = GalleryDiskImageSource.DeserializeGalleryDiskImageSource(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryOSDiskImage(Optional.ToNullable(sizeInGB), Optional.ToNullable(hostCaching), source.Value, serializedAdditionalRawData); + } + + GalleryOSDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryOSDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryOSDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryOSDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryOSDiskImage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryOSDiskImage(Response response) + { + if (response is null) + { + return null; } - return new GalleryOSDiskImage(Optional.ToNullable(sizeInGB), Optional.ToNullable(hostCaching), source.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryOSDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.cs index ae83a44e1f1e..3bcce8b739f2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryOSDiskImage.cs @@ -5,21 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the OS disk image. public partial class GalleryOSDiskImage : GalleryDiskImage { - /// Initializes a new instance of GalleryOSDiskImage. + /// Initializes a new instance of . public GalleryOSDiskImage() { } - /// Initializes a new instance of GalleryOSDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// The source for the disk image. - internal GalleryOSDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryDiskImageSource gallerySource) : base(sizeInGB, hostCaching, gallerySource) + /// Keeps track of any properties unknown to the library. + internal GalleryOSDiskImage(int? sizeInGB, HostCaching? hostCaching, GalleryDiskImageSource gallerySource, Dictionary serializedAdditionalRawData) : base(sizeInGB, hostCaching, gallerySource, serializedAdditionalRawData) { } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.Serialization.cs index d3099aa4bb79..984763b6766e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryPatch : IUtf8JsonSerializable + public partial class GalleryPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,20 +45,232 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identifier)) { writer.WritePropertyName("identifier"u8); - writer.WriteObjectValue(Identifier); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } } if (Optional.IsDefined(SharingProfile)) { writer.WritePropertyName("sharingProfile"u8); - writer.WriteObjectValue(SharingProfile); + if (SharingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SharingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SoftDeletePolicy)) { writer.WritePropertyName("softDeletePolicy"u8); - writer.WriteObjectValue(SoftDeletePolicy); + if (SoftDeletePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SoftDeletePolicy).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GalleryPatch DeserializeGalleryPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional identifier = default; + Optional provisioningState = default; + Optional sharingProfile = default; + Optional softDeletePolicy = default; + Optional sharingStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identifier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifier = GalleryIdentifier.DeserializeGalleryIdentifier(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new GalleryProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("sharingProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sharingProfile = SharingProfile.DeserializeSharingProfile(property0.Value); + continue; + } + if (property0.NameEquals("softDeletePolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + softDeletePolicy = SoftDeletePolicy.DeserializeSoftDeletePolicy(property0.Value); + continue; + } + if (property0.NameEquals("sharingStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sharingStatus = SharingStatus.DeserializeSharingStatus(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryPatch(id, name, type, systemData.Value, description.Value, identifier.Value, Optional.ToNullable(provisioningState), sharingProfile.Value, softDeletePolicy.Value, sharingStatus.Value, Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + GalleryPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.cs index 180b9257cf46..e6c2ec376269 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,40 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the Shared Image Gallery that you want to update. public partial class GalleryPatch : ResourceData { - /// Initializes a new instance of GalleryPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of this Shared Image Gallery resource. This property is updatable. + /// Describes the gallery unique name. + /// The provisioning state, which only appears in the response. + /// Profile for gallery sharing to subscription or tenant. + /// Contains information about the soft deletion policy of the gallery. + /// Sharing status of current gallery. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal GalleryPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, GalleryIdentifier identifier, GalleryProvisioningState? provisioningState, SharingProfile sharingProfile, SoftDeletePolicy softDeletePolicy, SharingStatus sharingStatus, IDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Description = description; + Identifier = identifier; + ProvisioningState = provisioningState; + SharingProfile = sharingProfile; + SoftDeletePolicy = softDeletePolicy; + SharingStatus = sharingStatus; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The description of this Shared Image Gallery resource. This property is updatable. public string Description { get; set; } /// Describes the gallery unique name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.Serialization.cs index 55d97afc9f4a..1a8c7ff23544 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GalleryTargetExtendedLocation : IUtf8JsonSerializable + public partial class GalleryTargetExtendedLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ExtendedLocation)) { writer.WritePropertyName("extendedLocation"u8); - writer.WriteObjectValue(ExtendedLocation); + if (ExtendedLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExtendedLocation).Serialize(writer, options); + } } if (Optional.IsDefined(ExtendedLocationReplicaCount)) { @@ -38,13 +53,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GalleryTargetExtendedLocation DeserializeGalleryTargetExtendedLocation(JsonElement element) + internal static GalleryTargetExtendedLocation DeserializeGalleryTargetExtendedLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +90,7 @@ internal static GalleryTargetExtendedLocation DeserializeGalleryTargetExtendedLo Optional extendedLocationReplicaCount = default; Optional storageAccountType = default; Optional encryption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -97,8 +134,61 @@ internal static GalleryTargetExtendedLocation DeserializeGalleryTargetExtendedLo encryption = EncryptionImages.DeserializeEncryptionImages(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GalleryTargetExtendedLocation(name.Value, extendedLocation.Value, Optional.ToNullable(extendedLocationReplicaCount), Optional.ToNullable(storageAccountType), encryption.Value, serializedAdditionalRawData); + } + + GalleryTargetExtendedLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryTargetExtendedLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GalleryTargetExtendedLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGalleryTargetExtendedLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GalleryTargetExtendedLocation model) + { + if (model is null) + { + return null; } - return new GalleryTargetExtendedLocation(name.Value, extendedLocation.Value, Optional.ToNullable(extendedLocationReplicaCount), Optional.ToNullable(storageAccountType), encryption.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GalleryTargetExtendedLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGalleryTargetExtendedLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.cs index dbfb93ebfb37..a188d2d65514 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryTargetExtendedLocation.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The GalleryTargetExtendedLocation. public partial class GalleryTargetExtendedLocation { - /// Initializes a new instance of GalleryTargetExtendedLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GalleryTargetExtendedLocation() { } - /// Initializes a new instance of GalleryTargetExtendedLocation. + /// Initializes a new instance of . /// The name of the region. /// The name of the extended location. /// The number of replicas of the Image Version to be created per extended location. This property is updatable. /// Specifies the storage account type to be used to store the image. This property is not updatable. /// Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. - internal GalleryTargetExtendedLocation(string name, GalleryExtendedLocation extendedLocation, int? extendedLocationReplicaCount, EdgeZoneStorageAccountType? galleryStorageAccountType, EncryptionImages encryption) + /// Keeps track of any properties unknown to the library. + internal GalleryTargetExtendedLocation(string name, GalleryExtendedLocation extendedLocation, int? extendedLocationReplicaCount, EdgeZoneStorageAccountType? galleryStorageAccountType, EncryptionImages encryption, Dictionary serializedAdditionalRawData) { Name = name; ExtendedLocation = extendedLocation; ExtendedLocationReplicaCount = extendedLocationReplicaCount; GalleryStorageAccountType = galleryStorageAccountType; Encryption = encryption; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the region. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.Serialization.cs index 2a3c26f4d4c1..8c01fc661f7a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class GrantAccessData : IUtf8JsonSerializable + public partial class GrantAccessData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("access"u8); writer.WriteStringValue(Access.ToString()); @@ -29,7 +37,119 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("fileFormat"u8); writer.WriteStringValue(FileFormat.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GrantAccessData DeserializeGrantAccessData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AccessLevel access = default; + int durationInSeconds = default; + Optional getSecureVmGuestStateSas = default; + Optional fileFormat = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("access"u8)) + { + access = new AccessLevel(property.Value.GetString()); + continue; + } + if (property.NameEquals("durationInSeconds"u8)) + { + durationInSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("getSecureVMGuestStateSAS"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + getSecureVmGuestStateSas = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("fileFormat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileFormat = new DiskImageFileFormat(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GrantAccessData(access, durationInSeconds, Optional.ToNullable(getSecureVmGuestStateSas), Optional.ToNullable(fileFormat), serializedAdditionalRawData); + } + + GrantAccessData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGrantAccessData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GrantAccessData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGrantAccessData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GrantAccessData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GrantAccessData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGrantAccessData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.cs index 4dca441b5aee..49761c519826 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GrantAccessData.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Data used for requesting a SAS. public partial class GrantAccessData { - /// Initializes a new instance of GrantAccessData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Access Level, accepted values include None, Read, Write. /// Time duration in seconds until the SAS access expires. public GrantAccessData(AccessLevel access, int durationInSeconds) @@ -19,6 +25,26 @@ public GrantAccessData(AccessLevel access, int durationInSeconds) DurationInSeconds = durationInSeconds; } + /// Initializes a new instance of . + /// The Access Level, accepted values include None, Read, Write. + /// Time duration in seconds until the SAS access expires. + /// Set this flag to true to get additional SAS for VM guest state. + /// Used to specify the file format when making request for SAS on a VHDX file format snapshot. + /// Keeps track of any properties unknown to the library. + internal GrantAccessData(AccessLevel access, int durationInSeconds, bool? getSecureVmGuestStateSas, DiskImageFileFormat? fileFormat, Dictionary serializedAdditionalRawData) + { + Access = access; + DurationInSeconds = durationInSeconds; + GetSecureVmGuestStateSas = getSecureVmGuestStateSas; + FileFormat = fileFormat; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GrantAccessData() + { + } + /// The Access Level, accepted values include None, Read, Write. public AccessLevel Access { get; } /// Time duration in seconds until the SAS access expires. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.Serialization.cs index 7428af517e32..8df328459432 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageAlternativeOption : IUtf8JsonSerializable + public partial class ImageAlternativeOption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AlternativeType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageAlternativeOption DeserializeImageAlternativeOption(JsonElement element) + internal static ImageAlternativeOption DeserializeImageAlternativeOption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -52,8 +75,61 @@ internal static ImageAlternativeOption DeserializeImageAlternativeOption(JsonEle value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageAlternativeOption(Optional.ToNullable(type), value.Value, serializedAdditionalRawData); + } + + ImageAlternativeOption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageAlternativeOption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageAlternativeOption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageAlternativeOption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageAlternativeOption model) + { + if (model is null) + { + return null; } - return new ImageAlternativeOption(Optional.ToNullable(type), value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageAlternativeOption(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageAlternativeOption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.cs index 6efb4ec53f5a..a751f46f6f88 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageAlternativeOption.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the alternative option specified by the Publisher for this image when this image is deprecated. public partial class ImageAlternativeOption { - /// Initializes a new instance of ImageAlternativeOption. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ImageAlternativeOption() { } - /// Initializes a new instance of ImageAlternativeOption. + /// Initializes a new instance of . /// Describes the type of the alternative option. /// Indicates the alternative option value specified by the Publisher. This is the Offer name when the type is Offer or the Plan name when the type is Plan. - internal ImageAlternativeOption(ImageAlternativeType? alternativeType, string value) + /// Keeps track of any properties unknown to the library. + internal ImageAlternativeOption(ImageAlternativeType? alternativeType, string value, Dictionary serializedAdditionalRawData) { AlternativeType = alternativeType; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the type of the alternative option. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs index 24861c26fc07..8678672f3b5a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageDataDisk : IUtf8JsonSerializable + public partial class ImageDataDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lun"u8); writer.WriteNumberValue(Lun); @@ -54,11 +61,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskEncryptionSet"u8); JsonSerializer.Serialize(writer, DiskEncryptionSet); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) + internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +92,7 @@ internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) Optional diskSizeGB = default; Optional storageAccountType = default; Optional diskEncryptionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -141,8 +163,61 @@ internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) diskEncryptionSet = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageDataDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, lun, serializedAdditionalRawData); + } + + ImageDataDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageDataDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageDataDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageDataDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageDataDisk model) + { + if (model is null) + { + return null; } - return new ImageDataDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, lun); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageDataDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageDataDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs index 33c6083df015..1ece49006ada 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models @@ -13,14 +14,14 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a data disk. public partial class ImageDataDisk : ImageDisk { - /// Initializes a new instance of ImageDataDisk. + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. public ImageDataDisk(int lun) { Lun = lun; } - /// Initializes a new instance of ImageDataDisk. + /// Initializes a new instance of . /// The snapshot. /// The managedDisk. /// The Virtual Hard Disk. @@ -29,11 +30,17 @@ public ImageDataDisk(int lun) /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed image disk. /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. - internal ImageDataDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingType? caching, int? diskSizeGB, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, int lun) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + /// Keeps track of any properties unknown to the library. + internal ImageDataDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingType? caching, int? diskSizeGB, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, int lun, Dictionary serializedAdditionalRawData) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet, serializedAdditionalRawData) { Lun = lun; } + /// Initializes a new instance of for deserialization. + internal ImageDataDisk() + { + } + /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. public int Lun { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.Serialization.cs index d6720221d3df..f3af271e2c0c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageDeprecationStatus : IUtf8JsonSerializable + public partial class ImageDeprecationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ImageState)) { @@ -29,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AlternativeOption)) { writer.WritePropertyName("alternativeOption"u8); - writer.WriteObjectValue(AlternativeOption); + if (AlternativeOption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AlternativeOption).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ImageDeprecationStatus DeserializeImageDeprecationStatus(JsonElement element) + internal static ImageDeprecationStatus DeserializeImageDeprecationStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static ImageDeprecationStatus DeserializeImageDeprecationStatus(JsonEle Optional imageState = default; Optional scheduledDeprecationTime = default; Optional alternativeOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageState"u8)) @@ -72,8 +101,61 @@ internal static ImageDeprecationStatus DeserializeImageDeprecationStatus(JsonEle alternativeOption = ImageAlternativeOption.DeserializeImageAlternativeOption(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageDeprecationStatus(Optional.ToNullable(imageState), Optional.ToNullable(scheduledDeprecationTime), alternativeOption.Value, serializedAdditionalRawData); + } + + ImageDeprecationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageDeprecationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageDeprecationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageDeprecationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageDeprecationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageDeprecationStatus(Response response) + { + if (response is null) + { + return null; } - return new ImageDeprecationStatus(Optional.ToNullable(imageState), Optional.ToNullable(scheduledDeprecationTime), alternativeOption.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageDeprecationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.cs index 734c2dd87d3d..ce3ebf2b3fdb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDeprecationStatus.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes image deprecation status properties on the image. public partial class ImageDeprecationStatus { - /// Initializes a new instance of ImageDeprecationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ImageDeprecationStatus() { } - /// Initializes a new instance of ImageDeprecationStatus. + /// Initializes a new instance of . /// Describes the state of the image. /// The time, in future, at which this image will be marked as deprecated. This scheduled time is chosen by the Publisher. /// Describes the alternative option specified by the Publisher for this image when this image is deprecated. - internal ImageDeprecationStatus(ImageState? imageState, DateTimeOffset? scheduledDeprecationOn, ImageAlternativeOption alternativeOption) + /// Keeps track of any properties unknown to the library. + internal ImageDeprecationStatus(ImageState? imageState, DateTimeOffset? scheduledDeprecationOn, ImageAlternativeOption alternativeOption, Dictionary serializedAdditionalRawData) { ImageState = imageState; ScheduledDeprecationOn = scheduledDeprecationOn; AlternativeOption = alternativeOption; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the state of the image. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs index 2fadd55befb8..ba2cb35b5506 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageDisk : IUtf8JsonSerializable + public partial class ImageDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Snapshot)) { @@ -52,11 +59,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskEncryptionSet"u8); JsonSerializer.Serialize(writer, DiskEncryptionSet); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageDisk DeserializeImageDisk(JsonElement element) + internal static ImageDisk DeserializeImageDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +89,7 @@ internal static ImageDisk DeserializeImageDisk(JsonElement element) Optional diskSizeGB = default; Optional storageAccountType = default; Optional diskEncryptionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("snapshot"u8)) @@ -133,8 +155,61 @@ internal static ImageDisk DeserializeImageDisk(JsonElement element) diskEncryptionSet = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, serializedAdditionalRawData); + } + + ImageDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageDisk model) + { + if (model is null) + { + return null; } - return new ImageDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs index 37e9c513e46f..15549d0d3221 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a image disk. public partial class ImageDisk { - /// Initializes a new instance of ImageDisk. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ImageDisk() { } - /// Initializes a new instance of ImageDisk. + /// Initializes a new instance of . /// The snapshot. /// The managedDisk. /// The Virtual Hard Disk. @@ -27,7 +31,8 @@ public ImageDisk() /// Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed image disk. - internal ImageDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingType? caching, int? diskSizeGB, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet) + /// Keeps track of any properties unknown to the library. + internal ImageDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingType? caching, int? diskSizeGB, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, Dictionary serializedAdditionalRawData) { Snapshot = snapshot; ManagedDisk = managedDisk; @@ -36,6 +41,7 @@ internal ImageDisk(WritableSubResource snapshot, WritableSubResource managedDisk DiskSizeGB = diskSizeGB; StorageAccountType = storageAccountType; DiskEncryptionSet = diskEncryptionSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The snapshot. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs index ca61631e5661..a790059bf1f7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageDiskReference : IUtf8JsonSerializable + public partial class ImageDiskReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("lun"u8); writer.WriteNumberValue(Lun.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageDiskReference DeserializeImageDiskReference(JsonElement element) + internal static ImageDiskReference DeserializeImageDiskReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ImageDiskReference DeserializeImageDiskReference(JsonElement ele Optional sharedGalleryImageId = default; Optional communityGalleryImageId = default; Optional lun = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -78,8 +101,61 @@ internal static ImageDiskReference DeserializeImageDiskReference(JsonElement ele lun = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageDiskReference(id.Value, sharedGalleryImageId.Value, communityGalleryImageId.Value, Optional.ToNullable(lun), serializedAdditionalRawData); + } + + ImageDiskReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageDiskReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageDiskReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageDiskReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageDiskReference model) + { + if (model is null) + { + return null; } - return new ImageDiskReference(id.Value, sharedGalleryImageId.Value, communityGalleryImageId.Value, Optional.ToNullable(lun)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageDiskReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageDiskReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs index 2acb5952e8fb..8a527b29aee6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.Compute.Models /// The source image used for creating the disk. public partial class ImageDiskReference { - /// Initializes a new instance of ImageDiskReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ImageDiskReference() { } - /// Initializes a new instance of ImageDiskReference. + /// Initializes a new instance of . /// A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference. /// A relative uri containing a direct shared Azure Compute Gallery image reference. /// A relative uri containing a community Azure Compute Gallery image reference. /// If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - internal ImageDiskReference(ResourceIdentifier id, string sharedGalleryImageId, string communityGalleryImageId, int? lun) + /// Keeps track of any properties unknown to the library. + internal ImageDiskReference(ResourceIdentifier id, string sharedGalleryImageId, string communityGalleryImageId, int? lun, Dictionary serializedAdditionalRawData) { Id = id; SharedGalleryImageId = sharedGalleryImageId; CommunityGalleryImageId = communityGalleryImageId; Lun = lun; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.Serialization.cs index 3e0273336ee9..2ae9ecc0e943 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class ImageListResult + internal partial class ImageListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ImageListResult DeserializeImageListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ImageListResult DeserializeImageListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static ImageListResult DeserializeImageListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ImageListResult(value, nextLink.Value); + return new ImageListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ImageListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.cs index 6e34cf86ec17..9ebc0149c9ae 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Image operation response. internal partial class ImageListResult { - /// Initializes a new instance of ImageListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of Images. /// is null. internal ImageListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal ImageListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ImageListResult. + /// Initializes a new instance of . /// The list of Images. /// The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images. - internal ImageListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ImageListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImageListResult() + { } /// The list of Images. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs index 4d52917fbad3..707c7981d5ce 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageOSDisk : IUtf8JsonSerializable + public partial class ImageOSDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("osType"u8); writer.WriteStringValue(OSType.ToSerialString()); @@ -56,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskEncryptionSet"u8); JsonSerializer.Serialize(writer, DiskEncryptionSet); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) + internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +95,7 @@ internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) Optional diskSizeGB = default; Optional storageAccountType = default; Optional diskEncryptionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType"u8)) @@ -149,8 +171,61 @@ internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) diskEncryptionSet = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageOSDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, osType, osState, serializedAdditionalRawData); + } + + ImageOSDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageOSDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageOSDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageOSDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageOSDisk model) + { + if (model is null) + { + return null; } - return new ImageOSDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, osType, osState); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageOSDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageOSDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs index 5b8de26bf148..bb3a8b7fbc45 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Compute.Models /// Describes an Operating System disk. public partial class ImageOSDisk : ImageDisk { - /// Initializes a new instance of ImageOSDisk. + /// Initializes a new instance of . /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. Possible values are: **Windows,** **Linux.**. /// The OS State. For managed images, use Generalized. public ImageOSDisk(SupportedOperatingSystemType osType, OperatingSystemStateType osState) @@ -22,7 +23,7 @@ public ImageOSDisk(SupportedOperatingSystemType osType, OperatingSystemStateType OSState = osState; } - /// Initializes a new instance of ImageOSDisk. + /// Initializes a new instance of . /// The snapshot. /// The managedDisk. /// The Virtual Hard Disk. @@ -32,12 +33,18 @@ public ImageOSDisk(SupportedOperatingSystemType osType, OperatingSystemStateType /// Specifies the customer managed disk encryption set resource id for the managed image disk. /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. Possible values are: **Windows,** **Linux.**. /// The OS State. For managed images, use Generalized. - internal ImageOSDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingType? caching, int? diskSizeGB, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, SupportedOperatingSystemType osType, OperatingSystemStateType osState) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + /// Keeps track of any properties unknown to the library. + internal ImageOSDisk(WritableSubResource snapshot, WritableSubResource managedDisk, Uri blobUri, CachingType? caching, int? diskSizeGB, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, SupportedOperatingSystemType osType, OperatingSystemStateType osState, Dictionary serializedAdditionalRawData) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet, serializedAdditionalRawData) { OSType = osType; OSState = osState; } + /// Initializes a new instance of for deserialization. + internal ImageOSDisk() + { + } + /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. Possible values are: **Windows,** **Linux.**. public SupportedOperatingSystemType OSType { get; set; } /// The OS State. For managed images, use Generalized. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.Serialization.cs index 8a129a3b4687..eb69e26a65ac 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ImagePurchasePlan : IUtf8JsonSerializable + public partial class ImagePurchasePlan : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("product"u8); writer.WriteStringValue(Product); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImagePurchasePlan DeserializeImagePurchasePlan(JsonElement element) + internal static ImagePurchasePlan DeserializeImagePurchasePlan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ImagePurchasePlan DeserializeImagePurchasePlan(JsonElement eleme Optional name = default; Optional publisher = default; Optional product = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +82,61 @@ internal static ImagePurchasePlan DeserializeImagePurchasePlan(JsonElement eleme product = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImagePurchasePlan(name.Value, publisher.Value, product.Value, serializedAdditionalRawData); + } + + ImagePurchasePlan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImagePurchasePlan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImagePurchasePlan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImagePurchasePlan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImagePurchasePlan model) + { + if (model is null) + { + return null; } - return new ImagePurchasePlan(name.Value, publisher.Value, product.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImagePurchasePlan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImagePurchasePlan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.cs index 8fd236adad4b..8a18eb5cf3c1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImagePurchasePlan.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the gallery image definition purchase plan. This is used by marketplace images. public partial class ImagePurchasePlan { - /// Initializes a new instance of ImagePurchasePlan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ImagePurchasePlan() { } - /// Initializes a new instance of ImagePurchasePlan. + /// Initializes a new instance of . /// The plan ID. /// The publisher ID. /// The product ID. - internal ImagePurchasePlan(string name, string publisher, string product) + /// Keeps track of any properties unknown to the library. + internal ImagePurchasePlan(string name, string publisher, string product, Dictionary serializedAdditionalRawData) { Name = name; Publisher = publisher; Product = product; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The plan ID. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs index 3e5a988a5f44..b738d89ea14c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageReference : IUtf8JsonSerializable + public partial class ImageReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Publisher)) { @@ -50,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageReference DeserializeImageReference(JsonElement element) + internal static ImageReference DeserializeImageReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +89,7 @@ internal static ImageReference DeserializeImageReference(JsonElement element) Optional sharedGalleryImageId = default; Optional communityGalleryImageId = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher"u8)) @@ -113,8 +136,61 @@ internal static ImageReference DeserializeImageReference(JsonElement element) id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageReference(id.Value, publisher.Value, offer.Value, sku.Value, version.Value, exactVersion.Value, sharedGalleryImageId.Value, communityGalleryImageId.Value, serializedAdditionalRawData); + } + + ImageReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageReference model) + { + if (model is null) + { + return null; } - return new ImageReference(id.Value, publisher.Value, offer.Value, sku.Value, version.Value, exactVersion.Value, sharedGalleryImageId.Value, communityGalleryImageId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs index 2abef5b2540a..43ae5de6a831 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,12 +14,12 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. public partial class ImageReference : ComputeWriteableSubResourceData { - /// Initializes a new instance of ImageReference. + /// Initializes a new instance of . public ImageReference() { } - /// Initializes a new instance of ImageReference. + /// Initializes a new instance of . /// Resource Id. /// The image publisher. /// Specifies the offer of the platform image or marketplace image used to create the virtual machine. @@ -26,7 +28,8 @@ public ImageReference() /// Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual machine. This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'. /// Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call. /// Specified the community gallery image unique id for vm deployment. This can be fetched from community gallery image GET call. - internal ImageReference(ResourceIdentifier id, string publisher, string offer, string sku, string version, string exactVersion, string sharedGalleryImageUniqueId, string communityGalleryImageId) : base(id) + /// Keeps track of any properties unknown to the library. + internal ImageReference(ResourceIdentifier id, string publisher, string offer, string sku, string version, string exactVersion, string sharedGalleryImageUniqueId, string communityGalleryImageId, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Publisher = publisher; Offer = offer; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.Serialization.cs index a8880bca4edf..2ee7618ed8a8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ImageStorageProfile : IUtf8JsonSerializable + public partial class ImageStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OSDisk)) { writer.WritePropertyName("osDisk"u8); - writer.WriteObjectValue(OSDisk); + if (OSDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDisk).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDisks)) { @@ -27,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDisks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -36,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("zoneResilient"u8); writer.WriteBooleanValue(ZoneResilient.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement element) + internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +83,7 @@ internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement e Optional osDisk = default; Optional> dataDisks = default; Optional zoneResilient = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osDisk"u8)) @@ -82,8 +118,61 @@ internal static ImageStorageProfile DeserializeImageStorageProfile(JsonElement e zoneResilient = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageStorageProfile(osDisk.Value, Optional.ToList(dataDisks), Optional.ToNullable(zoneResilient), serializedAdditionalRawData); + } + + ImageStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageStorageProfile model) + { + if (model is null) + { + return null; } - return new ImageStorageProfile(osDisk.Value, Optional.ToList(dataDisks), Optional.ToNullable(zoneResilient)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageStorageProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.cs index 628a9334fd50..7b4a9994acf4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a storage profile. public partial class ImageStorageProfile { - /// Initializes a new instance of ImageStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ImageStorageProfile() { DataDisks = new ChangeTrackingList(); } - /// Initializes a new instance of ImageStorageProfile. + /// Initializes a new instance of . /// Specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). /// Specifies the parameters that are used to add a data disk to a virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). /// Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). - internal ImageStorageProfile(ImageOSDisk osDisk, IList dataDisks, bool? zoneResilient) + /// Keeps track of any properties unknown to the library. + internal ImageStorageProfile(ImageOSDisk osDisk, IList dataDisks, bool? zoneResilient, Dictionary serializedAdditionalRawData) { OSDisk = osDisk; DataDisks = dataDisks; ZoneResilient = zoneResilient; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.Serialization.cs index 7087d6c1d216..109edbf3ae80 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class InnerError + public partial class InnerError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InnerError DeserializeInnerError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Exceptiontype)) + { + writer.WritePropertyName("exceptiontype"u8); + writer.WriteStringValue(Exceptiontype); + } + if (Optional.IsDefined(Errordetail)) + { + writer.WritePropertyName("errordetail"u8); + writer.WriteStringValue(Errordetail); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InnerError DeserializeInnerError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional exceptiontype = default; Optional errordetail = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("exceptiontype"u8)) @@ -32,8 +71,61 @@ internal static InnerError DeserializeInnerError(JsonElement element) errordetail = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InnerError(exceptiontype.Value, errordetail.Value); + return new InnerError(exceptiontype.Value, errordetail.Value, serializedAdditionalRawData); + } + + InnerError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInnerError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InnerError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInnerError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InnerError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InnerError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInnerError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.cs index 9b806c3554a6..0c2efe415b1e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InnerError.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Inner error details. public partial class InnerError { - /// Initializes a new instance of InnerError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal InnerError() { } - /// Initializes a new instance of InnerError. + /// Initializes a new instance of . /// The exception type. /// The internal error message or exception dump. - internal InnerError(string exceptiontype, string errordetail) + /// Keeps track of any properties unknown to the library. + internal InnerError(string exceptiontype, string errordetail, Dictionary serializedAdditionalRawData) { Exceptiontype = exceptiontype; Errordetail = errordetail; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The exception type. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.Serialization.cs index 0501f9d0c4ca..47479a6d5ff4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class InstanceSku + public partial class InstanceSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InstanceSku DeserializeInstanceSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InstanceSku DeserializeInstanceSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static InstanceSku DeserializeInstanceSku(JsonElement element) tier = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InstanceSku(name.Value, tier.Value); + return new InstanceSku(name.Value, tier.Value, serializedAdditionalRawData); + } + + InstanceSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InstanceSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInstanceSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InstanceSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InstanceSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInstanceSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.cs index d11f313e58d5..cd730409db1d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceSku.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The role instance SKU. public partial class InstanceSku { - /// Initializes a new instance of InstanceSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal InstanceSku() { } - /// Initializes a new instance of InstanceSku. + /// Initializes a new instance of . /// The sku name. /// The tier of the cloud service role instance. - internal InstanceSku(string name, string tier) + /// Keeps track of any properties unknown to the library. + internal InstanceSku(string name, string tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The sku name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.Serialization.cs index c3366d53d5e8..4f58c100dbe4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class InstanceViewStatus : IUtf8JsonSerializable + public partial class InstanceViewStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("time"u8); writer.WriteStringValue(Time.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InstanceViewStatus DeserializeInstanceViewStatus(JsonElement element) + internal static InstanceViewStatus DeserializeInstanceViewStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static InstanceViewStatus DeserializeInstanceViewStatus(JsonElement ele Optional displayStatus = default; Optional message = default; Optional time = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -90,8 +112,61 @@ internal static InstanceViewStatus DeserializeInstanceViewStatus(JsonElement ele time = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InstanceViewStatus(code.Value, Optional.ToNullable(level), displayStatus.Value, message.Value, Optional.ToNullable(time), serializedAdditionalRawData); + } + + InstanceViewStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceViewStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InstanceViewStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInstanceViewStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InstanceViewStatus model) + { + if (model is null) + { + return null; } - return new InstanceViewStatus(code.Value, Optional.ToNullable(level), displayStatus.Value, message.Value, Optional.ToNullable(time)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InstanceViewStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInstanceViewStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.cs index e3b972c1eb63..6534bef361f2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatus.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Instance view status. public partial class InstanceViewStatus { - /// Initializes a new instance of InstanceViewStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public InstanceViewStatus() { } - /// Initializes a new instance of InstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The level code. /// The short localizable label for the status. /// The detailed status message, including for alerts and error messages. /// The time of the status. - internal InstanceViewStatus(string code, ComputeStatusLevelType? level, string displayStatus, string message, DateTimeOffset? time) + /// Keeps track of any properties unknown to the library. + internal InstanceViewStatus(string code, ComputeStatusLevelType? level, string displayStatus, string message, DateTimeOffset? time, Dictionary serializedAdditionalRawData) { Code = code; Level = level; DisplayStatus = displayStatus; Message = message; Time = time; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status code. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.Serialization.cs index 79058767908a..ac77c057e6b8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class InstanceViewStatusesSummary + internal partial class InstanceViewStatusesSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InstanceViewStatusesSummary DeserializeInstanceViewStatusesSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InstanceViewStatusesSummary DeserializeInstanceViewStatusesSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> statusesSummary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("statusesSummary"u8)) @@ -36,8 +64,61 @@ internal static InstanceViewStatusesSummary DeserializeInstanceViewStatusesSumma statusesSummary = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InstanceViewStatusesSummary(Optional.ToList(statusesSummary)); + return new InstanceViewStatusesSummary(Optional.ToList(statusesSummary), serializedAdditionalRawData); + } + + InstanceViewStatusesSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceViewStatusesSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InstanceViewStatusesSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInstanceViewStatusesSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InstanceViewStatusesSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InstanceViewStatusesSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInstanceViewStatusesSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs index 451c6669fadb..0bc1ed07e9d0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/InstanceViewStatusesSummary.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Instance view statuses. internal partial class InstanceViewStatusesSummary { - /// Initializes a new instance of InstanceViewStatusesSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal InstanceViewStatusesSummary() { StatusesSummary = new ChangeTrackingList(); } - /// Initializes a new instance of InstanceViewStatusesSummary. + /// Initializes a new instance of . /// The summary. - internal InstanceViewStatusesSummary(IReadOnlyList statusesSummary) + /// Keeps track of any properties unknown to the library. + internal InstanceViewStatusesSummary(IReadOnlyList statusesSummary, Dictionary serializedAdditionalRawData) { StatusesSummary = statusesSummary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The summary. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs index 051dd68b9522..127eea8eaafb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class KeyForDiskEncryptionSet : IUtf8JsonSerializable + public partial class KeyForDiskEncryptionSet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceVault)) { @@ -24,17 +31,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("keyUrl"u8); writer.WriteStringValue(KeyUri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyForDiskEncryptionSet DeserializeKeyForDiskEncryptionSet(JsonElement element) + internal static KeyForDiskEncryptionSet DeserializeKeyForDiskEncryptionSet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sourceVault = default; Uri keyUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault"u8)) @@ -51,8 +73,61 @@ internal static KeyForDiskEncryptionSet DeserializeKeyForDiskEncryptionSet(JsonE keyUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyForDiskEncryptionSet(sourceVault, keyUrl, serializedAdditionalRawData); + } + + KeyForDiskEncryptionSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyForDiskEncryptionSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyForDiskEncryptionSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyForDiskEncryptionSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyForDiskEncryptionSet model) + { + if (model is null) + { + return null; } - return new KeyForDiskEncryptionSet(sourceVault, keyUrl); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyForDiskEncryptionSet(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyForDiskEncryptionSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs index eb2f5259f260..41f32c8543a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. public partial class KeyForDiskEncryptionSet { - /// Initializes a new instance of KeyForDiskEncryptionSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. /// is null. public KeyForDiskEncryptionSet(Uri keyUri) @@ -24,13 +28,20 @@ public KeyForDiskEncryptionSet(Uri keyUri) KeyUri = keyUri; } - /// Initializes a new instance of KeyForDiskEncryptionSet. + /// Initializes a new instance of . /// Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. /// Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. - internal KeyForDiskEncryptionSet(WritableSubResource sourceVault, Uri keyUri) + /// Keeps track of any properties unknown to the library. + internal KeyForDiskEncryptionSet(WritableSubResource sourceVault, Uri keyUri, Dictionary serializedAdditionalRawData) { SourceVault = sourceVault; KeyUri = keyUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyForDiskEncryptionSet() + { } /// Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs index dbd7c7f99b29..1b32600d2b28 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class KeyVaultAndKeyReference : IUtf8JsonSerializable + public partial class KeyVaultAndKeyReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceVault"u8); JsonSerializer.Serialize(writer, SourceVault); writer.WritePropertyName("keyUrl"u8); writer.WriteStringValue(KeyUri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultAndKeyReference DeserializeKeyVaultAndKeyReference(JsonElement element) + internal static KeyVaultAndKeyReference DeserializeKeyVaultAndKeyReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } WritableSubResource sourceVault = default; Uri keyUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault"u8)) @@ -43,8 +65,61 @@ internal static KeyVaultAndKeyReference DeserializeKeyVaultAndKeyReference(JsonE keyUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultAndKeyReference(sourceVault, keyUrl, serializedAdditionalRawData); + } + + KeyVaultAndKeyReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultAndKeyReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultAndKeyReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultAndKeyReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultAndKeyReference model) + { + if (model is null) + { + return null; } - return new KeyVaultAndKeyReference(sourceVault, keyUrl); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultAndKeyReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultAndKeyReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs index f3e6fa137c74..ae798568141f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey. public partial class KeyVaultAndKeyReference { - /// Initializes a new instance of KeyVaultAndKeyReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Resource id of the KeyVault containing the key or secret. /// Url pointing to a key or secret in KeyVault. /// or is null. @@ -27,6 +31,22 @@ public KeyVaultAndKeyReference(WritableSubResource sourceVault, Uri keyUri) KeyUri = keyUri; } + /// Initializes a new instance of . + /// Resource id of the KeyVault containing the key or secret. + /// Url pointing to a key or secret in KeyVault. + /// Keeps track of any properties unknown to the library. + internal KeyVaultAndKeyReference(WritableSubResource sourceVault, Uri keyUri, Dictionary serializedAdditionalRawData) + { + SourceVault = sourceVault; + KeyUri = keyUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultAndKeyReference() + { + } + /// Resource id of the KeyVault containing the key or secret. internal WritableSubResource SourceVault { get; set; } /// Gets or sets Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs index 4bcb10bbb9ea..541c48864ea4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class KeyVaultAndSecretReference : IUtf8JsonSerializable + public partial class KeyVaultAndSecretReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceVault"u8); JsonSerializer.Serialize(writer, SourceVault); writer.WritePropertyName("secretUrl"u8); writer.WriteStringValue(SecretUri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KeyVaultAndSecretReference DeserializeKeyVaultAndSecretReference(JsonElement element) + internal static KeyVaultAndSecretReference DeserializeKeyVaultAndSecretReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } WritableSubResource sourceVault = default; Uri secretUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault"u8)) @@ -43,8 +65,61 @@ internal static KeyVaultAndSecretReference DeserializeKeyVaultAndSecretReference secretUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultAndSecretReference(sourceVault, secretUrl, serializedAdditionalRawData); + } + + KeyVaultAndSecretReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultAndSecretReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultAndSecretReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultAndSecretReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultAndSecretReference model) + { + if (model is null) + { + return null; } - return new KeyVaultAndSecretReference(sourceVault, secretUrl); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultAndSecretReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultAndSecretReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs index 5df75a2ef895..2861f90bef3d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Key Vault Secret Url and vault id of the encryption key. public partial class KeyVaultAndSecretReference { - /// Initializes a new instance of KeyVaultAndSecretReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Resource id of the KeyVault containing the key or secret. /// Url pointing to a key or secret in KeyVault. /// or is null. @@ -27,6 +31,22 @@ public KeyVaultAndSecretReference(WritableSubResource sourceVault, Uri secretUri SecretUri = secretUri; } + /// Initializes a new instance of . + /// Resource id of the KeyVault containing the key or secret. + /// Url pointing to a key or secret in KeyVault. + /// Keeps track of any properties unknown to the library. + internal KeyVaultAndSecretReference(WritableSubResource sourceVault, Uri secretUri, Dictionary serializedAdditionalRawData) + { + SourceVault = sourceVault; + SecretUri = secretUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultAndSecretReference() + { + } + /// Resource id of the KeyVault containing the key or secret. internal WritableSubResource SourceVault { get; set; } /// Gets or sets Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs index 30854f5eae41..ac990e34d931 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class KeyVaultKeyReference : IUtf8JsonSerializable + public partial class KeyVaultKeyReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyUrl"u8); writer.WriteStringValue(KeyUri.AbsoluteUri); writer.WritePropertyName("sourceVault"u8); - JsonSerializer.Serialize(writer, SourceVault); writer.WriteEndObject(); + JsonSerializer.Serialize(writer, SourceVault); if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); } - internal static KeyVaultKeyReference DeserializeKeyVaultKeyReference(JsonElement element) + internal static KeyVaultKeyReference DeserializeKeyVaultKeyReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Uri keyUrl = default; WritableSubResource sourceVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyUrl"u8)) @@ -43,8 +65,61 @@ internal static KeyVaultKeyReference DeserializeKeyVaultKeyReference(JsonElement sourceVault = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultKeyReference(keyUrl, sourceVault, serializedAdditionalRawData); + } + + KeyVaultKeyReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultKeyReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultKeyReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultKeyReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultKeyReference model) + { + if (model is null) + { + return null; } - return new KeyVaultKeyReference(keyUrl, sourceVault); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultKeyReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultKeyReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs index 4e1180d5d500..49c8bf91c6df 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a reference to Key Vault Key. public partial class KeyVaultKeyReference { - /// Initializes a new instance of KeyVaultKeyReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The URL referencing a key encryption key in Key Vault. /// The relative URL of the Key Vault containing the key. /// or is null. @@ -27,6 +31,22 @@ public KeyVaultKeyReference(Uri keyUri, WritableSubResource sourceVault) SourceVault = sourceVault; } + /// Initializes a new instance of . + /// The URL referencing a key encryption key in Key Vault. + /// The relative URL of the Key Vault containing the key. + /// Keeps track of any properties unknown to the library. + internal KeyVaultKeyReference(Uri keyUri, WritableSubResource sourceVault, Dictionary serializedAdditionalRawData) + { + KeyUri = keyUri; + SourceVault = sourceVault; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultKeyReference() + { + } + /// The URL referencing a key encryption key in Key Vault. public Uri KeyUri { get; set; } /// The relative URL of the Key Vault containing the key. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs index 89e48044449b..37b4f013489f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs @@ -6,33 +6,55 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { [JsonConverter(typeof(KeyVaultSecretReferenceConverter))] - public partial class KeyVaultSecretReference : IUtf8JsonSerializable + public partial class KeyVaultSecretReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("secretUrl"u8); writer.WriteStringValue(SecretUri.AbsoluteUri); writer.WritePropertyName("sourceVault"u8); - JsonSerializer.Serialize(writer, SourceVault); writer.WriteEndObject(); + JsonSerializer.Serialize(writer, SourceVault); if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); } - internal static KeyVaultSecretReference DeserializeKeyVaultSecretReference(JsonElement element) + internal static KeyVaultSecretReference DeserializeKeyVaultSecretReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Uri secretUrl = default; WritableSubResource sourceVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretUrl"u8)) @@ -45,8 +67,61 @@ internal static KeyVaultSecretReference DeserializeKeyVaultSecretReference(JsonE sourceVault = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KeyVaultSecretReference(secretUrl, sourceVault, serializedAdditionalRawData); + } + + KeyVaultSecretReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultSecretReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KeyVaultSecretReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKeyVaultSecretReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KeyVaultSecretReference model) + { + if (model is null) + { + return null; } - return new KeyVaultSecretReference(secretUrl, sourceVault); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KeyVaultSecretReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKeyVaultSecretReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class KeyVaultSecretReferenceConverter : JsonConverter diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs index 91583a75783b..f6471c256fd8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a reference to Key Vault Secret. public partial class KeyVaultSecretReference { - /// Initializes a new instance of KeyVaultSecretReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The URL referencing a secret in a Key Vault. /// The relative URL of the Key Vault containing the secret. /// or is null. @@ -27,6 +31,22 @@ public KeyVaultSecretReference(Uri secretUri, WritableSubResource sourceVault) SourceVault = sourceVault; } + /// Initializes a new instance of . + /// The URL referencing a secret in a Key Vault. + /// The relative URL of the Key Vault containing the secret. + /// Keeps track of any properties unknown to the library. + internal KeyVaultSecretReference(Uri secretUri, WritableSubResource sourceVault, Dictionary serializedAdditionalRawData) + { + SecretUri = secretUri; + SourceVault = sourceVault; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultSecretReference() + { + } + /// The URL referencing a secret in a Key Vault. public Uri SecretUri { get; set; } /// The relative URL of the Key Vault containing the secret. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.Serialization.cs index cff59a662cc3..8de8a4b51f2e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LastPatchInstallationSummary + public partial class LastPatchInstallationSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LastPatchInstallationSummary DeserializeLastPatchInstallationSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LastPatchInstallationSummary DeserializeLastPatchInstallationSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +57,7 @@ internal static LastPatchInstallationSummary DeserializeLastPatchInstallationSum Optional startTime = default; Optional lastModifiedTime = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -127,8 +155,61 @@ internal static LastPatchInstallationSummary DeserializeLastPatchInstallationSum error = ComputeApiError.DeserializeComputeApiError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LastPatchInstallationSummary(Optional.ToNullable(status), installationActivityId.Value, Optional.ToNullable(maintenanceWindowExceeded), Optional.ToNullable(notSelectedPatchCount), Optional.ToNullable(excludedPatchCount), Optional.ToNullable(pendingPatchCount), Optional.ToNullable(installedPatchCount), Optional.ToNullable(failedPatchCount), Optional.ToNullable(startTime), Optional.ToNullable(lastModifiedTime), error.Value); + return new LastPatchInstallationSummary(Optional.ToNullable(status), installationActivityId.Value, Optional.ToNullable(maintenanceWindowExceeded), Optional.ToNullable(notSelectedPatchCount), Optional.ToNullable(excludedPatchCount), Optional.ToNullable(pendingPatchCount), Optional.ToNullable(installedPatchCount), Optional.ToNullable(failedPatchCount), Optional.ToNullable(startTime), Optional.ToNullable(lastModifiedTime), error.Value, serializedAdditionalRawData); + } + + LastPatchInstallationSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLastPatchInstallationSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LastPatchInstallationSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLastPatchInstallationSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LastPatchInstallationSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LastPatchInstallationSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLastPatchInstallationSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.cs index 07e56f63acde..beb8cf0c957a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LastPatchInstallationSummary.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes the properties of the last installed patch summary. public partial class LastPatchInstallationSummary { - /// Initializes a new instance of LastPatchInstallationSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LastPatchInstallationSummary() { } - /// Initializes a new instance of LastPatchInstallationSummary. + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// Describes whether the operation ran out of time before it completed all its intended actions. @@ -29,7 +33,8 @@ internal LastPatchInstallationSummary() /// The UTC timestamp when the operation began. /// The UTC timestamp when the operation began. /// The errors that were encountered during execution of the operation. The details array contains the list of them. - internal LastPatchInstallationSummary(PatchOperationStatus? status, string installationActivityId, bool? maintenanceWindowExceeded, int? notSelectedPatchCount, int? excludedPatchCount, int? pendingPatchCount, int? installedPatchCount, int? failedPatchCount, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, ComputeApiError error) + /// Keeps track of any properties unknown to the library. + internal LastPatchInstallationSummary(PatchOperationStatus? status, string installationActivityId, bool? maintenanceWindowExceeded, int? notSelectedPatchCount, int? excludedPatchCount, int? pendingPatchCount, int? installedPatchCount, int? failedPatchCount, DateTimeOffset? startOn, DateTimeOffset? lastModifiedOn, ComputeApiError error, Dictionary serializedAdditionalRawData) { Status = status; InstallationActivityId = installationActivityId; @@ -42,6 +47,7 @@ internal LastPatchInstallationSummary(PatchOperationStatus? status, string insta StartOn = startOn; LastModifiedOn = lastModifiedOn; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.Serialization.cs index f903930ba834..3125ddef756c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LinuxConfiguration : IUtf8JsonSerializable + public partial class LinuxConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsPasswordAuthenticationDisabled)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Ssh)) { writer.WritePropertyName("ssh"u8); - writer.WriteObjectValue(Ssh); + if (Ssh is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Ssh).Serialize(writer, options); + } } if (Optional.IsDefined(ProvisionVmAgent)) { @@ -33,18 +48,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PatchSettings)) { writer.WritePropertyName("patchSettings"u8); - writer.WriteObjectValue(PatchSettings); + if (PatchSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PatchSettings).Serialize(writer, options); + } } if (Optional.IsDefined(IsVmAgentPlatformUpdatesEnabled)) { writer.WritePropertyName("enableVMAgentPlatformUpdates"u8); writer.WriteBooleanValue(IsVmAgentPlatformUpdatesEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement element) + internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +90,7 @@ internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement ele Optional provisionVmAgent = default; Optional patchSettings = default; Optional enableVmAgentPlatformUpdates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("disablePasswordAuthentication"u8)) @@ -101,8 +138,61 @@ internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement ele enableVmAgentPlatformUpdates = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinuxConfiguration(Optional.ToNullable(disablePasswordAuthentication), ssh.Value, Optional.ToNullable(provisionVmAgent), patchSettings.Value, Optional.ToNullable(enableVmAgentPlatformUpdates), serializedAdditionalRawData); + } + + LinuxConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinuxConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinuxConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinuxConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinuxConfiguration model) + { + if (model is null) + { + return null; } - return new LinuxConfiguration(Optional.ToNullable(disablePasswordAuthentication), ssh.Value, Optional.ToNullable(provisionVmAgent), patchSettings.Value, Optional.ToNullable(enableVmAgentPlatformUpdates)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinuxConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinuxConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.cs index d32a4f4d2f70..b0ee9a66e412 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models @@ -12,24 +13,29 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the Linux operating system settings on the virtual machine. For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). public partial class LinuxConfiguration { - /// Initializes a new instance of LinuxConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinuxConfiguration() { } - /// Initializes a new instance of LinuxConfiguration. + /// Initializes a new instance of . /// Specifies whether password authentication should be disabled. /// Specifies the ssh key configuration for a Linux OS. /// Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. /// [Preview Feature] Specifies settings related to VM Guest Patching on Linux. /// Indicates whether VMAgent Platform Updates is enabled for the Linux virtual machine. Default value is false. - internal LinuxConfiguration(bool? isPasswordAuthenticationDisabled, SshConfiguration ssh, bool? provisionVmAgent, LinuxPatchSettings patchSettings, bool? isVmAgentPlatformUpdatesEnabled) + /// Keeps track of any properties unknown to the library. + internal LinuxConfiguration(bool? isPasswordAuthenticationDisabled, SshConfiguration ssh, bool? provisionVmAgent, LinuxPatchSettings patchSettings, bool? isVmAgentPlatformUpdatesEnabled, Dictionary serializedAdditionalRawData) { IsPasswordAuthenticationDisabled = isPasswordAuthenticationDisabled; Ssh = ssh; ProvisionVmAgent = provisionVmAgent; PatchSettings = patchSettings; IsVmAgentPlatformUpdatesEnabled = isVmAgentPlatformUpdatesEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies whether password authentication should be disabled. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.Serialization.cs index f65744df248e..d7fcb70de2ec 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LinuxParameters : IUtf8JsonSerializable + public partial class LinuxParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ClassificationsToInclude)) { @@ -50,7 +58,138 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maintenanceRunId"u8); writer.WriteStringValue(MaintenanceRunId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static LinuxParameters DeserializeLinuxParameters(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> classificationsToInclude = default; + Optional> packageNameMasksToInclude = default; + Optional> packageNameMasksToExclude = default; + Optional maintenanceRunId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("classificationsToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new VmGuestPatchClassificationForLinux(item.GetString())); + } + classificationsToInclude = array; + continue; + } + if (property.NameEquals("packageNameMasksToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + packageNameMasksToInclude = array; + continue; + } + if (property.NameEquals("packageNameMasksToExclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + packageNameMasksToExclude = array; + continue; + } + if (property.NameEquals("maintenanceRunId"u8)) + { + maintenanceRunId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinuxParameters(Optional.ToList(classificationsToInclude), Optional.ToList(packageNameMasksToInclude), Optional.ToList(packageNameMasksToExclude), maintenanceRunId.Value, serializedAdditionalRawData); + } + + LinuxParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinuxParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinuxParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinuxParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinuxParameters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinuxParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinuxParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.cs index 67835ff6bdc3..88bbc0fa4952 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxParameters.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Input for InstallPatches on a Linux VM, as directly received by the API. public partial class LinuxParameters { - /// Initializes a new instance of LinuxParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinuxParameters() { ClassificationsToInclude = new ChangeTrackingList(); @@ -21,6 +25,21 @@ public LinuxParameters() PackageNameMasksToExclude = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The update classifications to select when installing patches for Linux. + /// packages to include in the patch operation. Format: packageName_packageVersion. + /// packages to exclude in the patch operation. Format: packageName_packageVersion. + /// This is used as a maintenance run identifier for Auto VM Guest Patching in Linux. + /// Keeps track of any properties unknown to the library. + internal LinuxParameters(IList classificationsToInclude, IList packageNameMasksToInclude, IList packageNameMasksToExclude, string maintenanceRunId, Dictionary serializedAdditionalRawData) + { + ClassificationsToInclude = classificationsToInclude; + PackageNameMasksToInclude = packageNameMasksToInclude; + PackageNameMasksToExclude = packageNameMasksToExclude; + MaintenanceRunId = maintenanceRunId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The update classifications to select when installing patches for Linux. public IList ClassificationsToInclude { get; } /// packages to include in the patch operation. Format: packageName_packageVersion. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.Serialization.cs index e5a520294ce4..0a737a949c86 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LinuxPatchSettings : IUtf8JsonSerializable + public partial class LinuxPatchSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PatchMode)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutomaticByPlatformSettings)) { writer.WritePropertyName("automaticByPlatformSettings"u8); - writer.WriteObjectValue(AutomaticByPlatformSettings); + if (AutomaticByPlatformSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutomaticByPlatformSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static LinuxPatchSettings DeserializeLinuxPatchSettings(JsonElement element) + internal static LinuxPatchSettings DeserializeLinuxPatchSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static LinuxPatchSettings DeserializeLinuxPatchSettings(JsonElement ele Optional patchMode = default; Optional assessmentMode = default; Optional automaticByPlatformSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("patchMode"u8)) @@ -71,8 +101,61 @@ internal static LinuxPatchSettings DeserializeLinuxPatchSettings(JsonElement ele automaticByPlatformSettings = LinuxVmGuestPatchAutomaticByPlatformSettings.DeserializeLinuxVmGuestPatchAutomaticByPlatformSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinuxPatchSettings(Optional.ToNullable(patchMode), Optional.ToNullable(assessmentMode), automaticByPlatformSettings.Value, serializedAdditionalRawData); + } + + LinuxPatchSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinuxPatchSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinuxPatchSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinuxPatchSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinuxPatchSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinuxPatchSettings(Response response) + { + if (response is null) + { + return null; } - return new LinuxPatchSettings(Optional.ToNullable(patchMode), Optional.ToNullable(assessmentMode), automaticByPlatformSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinuxPatchSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.cs index 6a273246f8ba..85a14b32c04b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxPatchSettings.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies settings related to VM Guest Patching on Linux. public partial class LinuxPatchSettings { - /// Initializes a new instance of LinuxPatchSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinuxPatchSettings() { } - /// Initializes a new instance of LinuxPatchSettings. + /// Initializes a new instance of . /// Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - The virtual machine's default patching configuration is used. <br /><br /> **AutomaticByPlatform** - The virtual machine will be automatically updated by the platform. The property provisionVMAgent must be true. /// Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the timing of patch assessments on a virtual machine. <br /><br /> **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. /// Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux. - internal LinuxPatchSettings(LinuxVmGuestPatchMode? patchMode, LinuxPatchAssessmentMode? assessmentMode, LinuxVmGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings) + /// Keeps track of any properties unknown to the library. + internal LinuxPatchSettings(LinuxVmGuestPatchMode? patchMode, LinuxPatchAssessmentMode? assessmentMode, LinuxVmGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings, Dictionary serializedAdditionalRawData) { PatchMode = patchMode; AssessmentMode = assessmentMode; AutomaticByPlatformSettings = automaticByPlatformSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - The virtual machine's default patching configuration is used. <br /><br /> **AutomaticByPlatform** - The virtual machine will be automatically updated by the platform. The property provisionVMAgent must be true. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.Serialization.cs index 7bbfbc99b4a4..4fd7c0b8d0b7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LinuxVmGuestPatchAutomaticByPlatformSettings : IUtf8JsonSerializable + public partial class LinuxVmGuestPatchAutomaticByPlatformSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RebootSetting)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassPlatformSafetyChecksOnUserSchedule"u8); writer.WriteBooleanValue(BypassPlatformSafetyChecksOnUserSchedule.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinuxVmGuestPatchAutomaticByPlatformSettings DeserializeLinuxVmGuestPatchAutomaticByPlatformSettings(JsonElement element) + internal static LinuxVmGuestPatchAutomaticByPlatformSettings DeserializeLinuxVmGuestPatchAutomaticByPlatformSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional rebootSetting = default; Optional bypassPlatformSafetyChecksOnUserSchedule = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rebootSetting"u8)) @@ -56,8 +79,61 @@ internal static LinuxVmGuestPatchAutomaticByPlatformSettings DeserializeLinuxVmG bypassPlatformSafetyChecksOnUserSchedule = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinuxVmGuestPatchAutomaticByPlatformSettings(Optional.ToNullable(rebootSetting), Optional.ToNullable(bypassPlatformSafetyChecksOnUserSchedule), serializedAdditionalRawData); + } + + LinuxVmGuestPatchAutomaticByPlatformSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinuxVmGuestPatchAutomaticByPlatformSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinuxVmGuestPatchAutomaticByPlatformSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinuxVmGuestPatchAutomaticByPlatformSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinuxVmGuestPatchAutomaticByPlatformSettings model) + { + if (model is null) + { + return null; } - return new LinuxVmGuestPatchAutomaticByPlatformSettings(Optional.ToNullable(rebootSetting), Optional.ToNullable(bypassPlatformSafetyChecksOnUserSchedule)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinuxVmGuestPatchAutomaticByPlatformSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinuxVmGuestPatchAutomaticByPlatformSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.cs index 84174fd86e31..4e874b875d65 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LinuxVmGuestPatchAutomaticByPlatformSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies additional settings to be applied when patch mode AutomaticByPlatform is selected in Linux patch settings. public partial class LinuxVmGuestPatchAutomaticByPlatformSettings { - /// Initializes a new instance of LinuxVmGuestPatchAutomaticByPlatformSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinuxVmGuestPatchAutomaticByPlatformSettings() { } - /// Initializes a new instance of LinuxVmGuestPatchAutomaticByPlatformSettings. + /// Initializes a new instance of . /// Specifies the reboot setting for all AutomaticByPlatform patch installation operations. /// Enables customer to schedule patching without accidental upgrades. - internal LinuxVmGuestPatchAutomaticByPlatformSettings(LinuxVmGuestPatchAutomaticByPlatformRebootSetting? rebootSetting, bool? bypassPlatformSafetyChecksOnUserSchedule) + /// Keeps track of any properties unknown to the library. + internal LinuxVmGuestPatchAutomaticByPlatformSettings(LinuxVmGuestPatchAutomaticByPlatformRebootSetting? rebootSetting, bool? bypassPlatformSafetyChecksOnUserSchedule, Dictionary serializedAdditionalRawData) { RebootSetting = rebootSetting; BypassPlatformSafetyChecksOnUserSchedule = bypassPlatformSafetyChecksOnUserSchedule; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the reboot setting for all AutomaticByPlatform patch installation operations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.Serialization.cs index 3f1904672174..9e52ed9b1429 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class ListUsagesResult + internal partial class ListUsagesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListUsagesResult DeserializeListUsagesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListUsagesResult DeserializeListUsagesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static ListUsagesResult DeserializeListUsagesResult(JsonElement element nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListUsagesResult(value, nextLink.Value); + return new ListUsagesResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ListUsagesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListUsagesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListUsagesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListUsagesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListUsagesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListUsagesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListUsagesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.cs index 32111fd195cd..e3bfba19680c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ListUsagesResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Usages operation response. internal partial class ListUsagesResult { - /// Initializes a new instance of ListUsagesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of compute resource usages. /// is null. internal ListUsagesResult(IEnumerable value) @@ -25,13 +28,20 @@ internal ListUsagesResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ListUsagesResult. + /// Initializes a new instance of . /// The list of compute resource usages. /// The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page of compute resource usage information. - internal ListUsagesResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ListUsagesResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ListUsagesResult() + { } /// The list of compute resource usages. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.Serialization.cs index 5aad95a427db..fe3ac8cb0b3f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class LoadBalancerFrontendIPConfiguration : IUtf8JsonSerializable + public partial class LoadBalancerFrontendIPConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -36,11 +44,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrivateIPAddress); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LoadBalancerFrontendIPConfiguration DeserializeLoadBalancerFrontendIPConfiguration(JsonElement element) + internal static LoadBalancerFrontendIPConfiguration DeserializeLoadBalancerFrontendIPConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +71,7 @@ internal static LoadBalancerFrontendIPConfiguration DeserializeLoadBalancerFront Optional publicIPAddress = default; Optional subnet = default; Optional privateIPAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -91,8 +114,61 @@ internal static LoadBalancerFrontendIPConfiguration DeserializeLoadBalancerFront } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LoadBalancerFrontendIPConfiguration(name, publicIPAddress, subnet, privateIPAddress.Value, serializedAdditionalRawData); + } + + LoadBalancerFrontendIPConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLoadBalancerFrontendIPConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LoadBalancerFrontendIPConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLoadBalancerFrontendIPConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LoadBalancerFrontendIPConfiguration model) + { + if (model is null) + { + return null; } - return new LoadBalancerFrontendIPConfiguration(name, publicIPAddress, subnet, privateIPAddress.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LoadBalancerFrontendIPConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLoadBalancerFrontendIPConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs index def6d5edaf4c..bc48f40bbf4e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP configuration. public partial class LoadBalancerFrontendIPConfiguration { - /// Initializes a new instance of LoadBalancerFrontendIPConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource. /// is null. public LoadBalancerFrontendIPConfiguration(string name) @@ -24,17 +28,24 @@ public LoadBalancerFrontendIPConfiguration(string name) Name = name; } - /// Initializes a new instance of LoadBalancerFrontendIPConfiguration. + /// Initializes a new instance of . /// The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource. /// The reference to the public ip address resource. /// The reference to the virtual network subnet resource. /// The virtual network private IP address of the IP configuration. - internal LoadBalancerFrontendIPConfiguration(string name, WritableSubResource publicIPAddress, WritableSubResource subnet, string privateIPAddress) + /// Keeps track of any properties unknown to the library. + internal LoadBalancerFrontendIPConfiguration(string name, WritableSubResource publicIPAddress, WritableSubResource subnet, string privateIPAddress, Dictionary serializedAdditionalRawData) { Name = name; PublicIPAddress = publicIPAddress; Subnet = subnet; PrivateIPAddress = privateIPAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LoadBalancerFrontendIPConfiguration() + { } /// The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.Serialization.cs index a54cecbce1df..1d3bd757dc43 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LogAnalytics + public partial class LogAnalytics : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LogAnalytics DeserializeLogAnalytics(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LogAnalytics DeserializeLogAnalytics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -30,8 +59,61 @@ internal static LogAnalytics DeserializeLogAnalytics(JsonElement element) properties = Models.LogAnalyticsOutput.DeserializeLogAnalyticsOutput(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LogAnalytics(properties.Value); + return new LogAnalytics(properties.Value, serializedAdditionalRawData); + } + + LogAnalytics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLogAnalytics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LogAnalytics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLogAnalytics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LogAnalytics model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LogAnalytics(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLogAnalytics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.cs index f4d9f2a70095..32b5c1b09329 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalytics.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// LogAnalytics operation status response. public partial class LogAnalytics { - /// Initializes a new instance of LogAnalytics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LogAnalytics() { } - /// Initializes a new instance of LogAnalytics. + /// Initializes a new instance of . /// LogAnalyticsOutput. - internal LogAnalytics(LogAnalyticsOutput properties) + /// Keeps track of any properties unknown to the library. + internal LogAnalytics(LogAnalyticsOutput properties, Dictionary serializedAdditionalRawData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// LogAnalyticsOutput. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.Serialization.cs index 0460e6b77ed6..ec156920281b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class LogAnalyticsInputBase : IUtf8JsonSerializable + public partial class LogAnalyticsInputBase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("blobContainerSasUri"u8); writer.WriteStringValue(BlobContainerSasUri.AbsoluteUri); @@ -46,7 +54,155 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("groupByUserAgent"u8); writer.WriteBooleanValue(GroupByUserAgent.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static LogAnalyticsInputBase DeserializeLogAnalyticsInputBase(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri blobContainerSasUri = default; + DateTimeOffset fromTime = default; + DateTimeOffset toTime = default; + Optional groupByThrottlePolicy = default; + Optional groupByOperationName = default; + Optional groupByResourceName = default; + Optional groupByClientApplicationId = default; + Optional groupByUserAgent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("blobContainerSasUri"u8)) + { + blobContainerSasUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("fromTime"u8)) + { + fromTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("toTime"u8)) + { + toTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("groupByThrottlePolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByThrottlePolicy = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByOperationName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByOperationName = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByResourceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByResourceName = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByClientApplicationId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByClientApplicationId = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByUserAgent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByUserAgent = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LogAnalyticsInputBase(blobContainerSasUri, fromTime, toTime, Optional.ToNullable(groupByThrottlePolicy), Optional.ToNullable(groupByOperationName), Optional.ToNullable(groupByResourceName), Optional.ToNullable(groupByClientApplicationId), Optional.ToNullable(groupByUserAgent), serializedAdditionalRawData); + } + + LogAnalyticsInputBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLogAnalyticsInputBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LogAnalyticsInputBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLogAnalyticsInputBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LogAnalyticsInputBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LogAnalyticsInputBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLogAnalyticsInputBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.cs index 10cd2a9da4b3..7171adc8e963 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsInputBase.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Api input base class for LogAnalytics Api. public partial class LogAnalyticsInputBase { - /// Initializes a new instance of LogAnalyticsInputBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. /// From time of the query. /// To time of the query. @@ -27,6 +31,34 @@ public LogAnalyticsInputBase(Uri blobContainerSasUri, DateTimeOffset fromTime, D ToTime = toTime; } + /// Initializes a new instance of . + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + /// From time of the query. + /// To time of the query. + /// Group query result by Throttle Policy applied. + /// Group query result by Operation Name. + /// Group query result by Resource Name. + /// Group query result by Client Application ID. + /// Group query result by User Agent. + /// Keeps track of any properties unknown to the library. + internal LogAnalyticsInputBase(Uri blobContainerSasUri, DateTimeOffset fromTime, DateTimeOffset toTime, bool? groupByThrottlePolicy, bool? groupByOperationName, bool? groupByResourceName, bool? groupByClientApplicationId, bool? groupByUserAgent, Dictionary serializedAdditionalRawData) + { + BlobContainerSasUri = blobContainerSasUri; + FromTime = fromTime; + ToTime = toTime; + GroupByThrottlePolicy = groupByThrottlePolicy; + GroupByOperationName = groupByOperationName; + GroupByResourceName = groupByResourceName; + GroupByClientApplicationId = groupByClientApplicationId; + GroupByUserAgent = groupByUserAgent; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LogAnalyticsInputBase() + { + } + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. public Uri BlobContainerSasUri { get; } /// From time of the query. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.Serialization.cs index 61ab3f57b77d..1eb297b6e9cb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class LogAnalyticsOutput + internal partial class LogAnalyticsOutput : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LogAnalyticsOutput DeserializeLogAnalyticsOutput(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LogAnalyticsOutput DeserializeLogAnalyticsOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional output = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("output"u8)) @@ -26,8 +55,61 @@ internal static LogAnalyticsOutput DeserializeLogAnalyticsOutput(JsonElement ele output = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LogAnalyticsOutput(output.Value); + return new LogAnalyticsOutput(output.Value, serializedAdditionalRawData); + } + + LogAnalyticsOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLogAnalyticsOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LogAnalyticsOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLogAnalyticsOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LogAnalyticsOutput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LogAnalyticsOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLogAnalyticsOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.cs index 7fd4239700bf..55ee53b6ca27 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LogAnalyticsOutput.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// LogAnalytics output properties. internal partial class LogAnalyticsOutput { - /// Initializes a new instance of LogAnalyticsOutput. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LogAnalyticsOutput() { } - /// Initializes a new instance of LogAnalyticsOutput. + /// Initializes a new instance of . /// Output file Uri path to blob container. - internal LogAnalyticsOutput(string output) + /// Keeps track of any properties unknown to the library. + internal LogAnalyticsOutput(string output, Dictionary serializedAdditionalRawData) { Output = output; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Output file Uri path to blob container. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.Serialization.cs index 5b03fcc4409a..ecbfa1eedfc4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.Serialization.cs @@ -6,15 +6,77 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class MaintenanceRedeployStatus + public partial class MaintenanceRedeployStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MaintenanceRedeployStatus DeserializeMaintenanceRedeployStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsCustomerInitiatedMaintenanceAllowed)) + { + writer.WritePropertyName("isCustomerInitiatedMaintenanceAllowed"u8); + writer.WriteBooleanValue(IsCustomerInitiatedMaintenanceAllowed.Value); + } + if (Optional.IsDefined(PreMaintenanceWindowStartOn)) + { + writer.WritePropertyName("preMaintenanceWindowStartTime"u8); + writer.WriteStringValue(PreMaintenanceWindowStartOn.Value, "O"); + } + if (Optional.IsDefined(PreMaintenanceWindowEndOn)) + { + writer.WritePropertyName("preMaintenanceWindowEndTime"u8); + writer.WriteStringValue(PreMaintenanceWindowEndOn.Value, "O"); + } + if (Optional.IsDefined(MaintenanceWindowStartOn)) + { + writer.WritePropertyName("maintenanceWindowStartTime"u8); + writer.WriteStringValue(MaintenanceWindowStartOn.Value, "O"); + } + if (Optional.IsDefined(MaintenanceWindowEndOn)) + { + writer.WritePropertyName("maintenanceWindowEndTime"u8); + writer.WriteStringValue(MaintenanceWindowEndOn.Value, "O"); + } + if (Optional.IsDefined(LastOperationResultCode)) + { + writer.WritePropertyName("lastOperationResultCode"u8); + writer.WriteStringValue(LastOperationResultCode.Value.ToSerialString()); + } + if (Optional.IsDefined(LastOperationMessage)) + { + writer.WritePropertyName("lastOperationMessage"u8); + writer.WriteStringValue(LastOperationMessage); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MaintenanceRedeployStatus DeserializeMaintenanceRedeployStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +88,7 @@ internal static MaintenanceRedeployStatus DeserializeMaintenanceRedeployStatus(J Optional maintenanceWindowEndTime = default; Optional lastOperationResultCode = default; Optional lastOperationMessage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isCustomerInitiatedMaintenanceAllowed"u8)) @@ -87,8 +150,61 @@ internal static MaintenanceRedeployStatus DeserializeMaintenanceRedeployStatus(J lastOperationMessage = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MaintenanceRedeployStatus(Optional.ToNullable(isCustomerInitiatedMaintenanceAllowed), Optional.ToNullable(preMaintenanceWindowStartTime), Optional.ToNullable(preMaintenanceWindowEndTime), Optional.ToNullable(maintenanceWindowStartTime), Optional.ToNullable(maintenanceWindowEndTime), Optional.ToNullable(lastOperationResultCode), lastOperationMessage.Value); + return new MaintenanceRedeployStatus(Optional.ToNullable(isCustomerInitiatedMaintenanceAllowed), Optional.ToNullable(preMaintenanceWindowStartTime), Optional.ToNullable(preMaintenanceWindowEndTime), Optional.ToNullable(maintenanceWindowStartTime), Optional.ToNullable(maintenanceWindowEndTime), Optional.ToNullable(lastOperationResultCode), lastOperationMessage.Value, serializedAdditionalRawData); + } + + MaintenanceRedeployStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMaintenanceRedeployStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MaintenanceRedeployStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMaintenanceRedeployStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MaintenanceRedeployStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MaintenanceRedeployStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMaintenanceRedeployStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs index c8794e782823..23806cb03457 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/MaintenanceRedeployStatus.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Maintenance Operation Status. public partial class MaintenanceRedeployStatus { - /// Initializes a new instance of MaintenanceRedeployStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MaintenanceRedeployStatus() { } - /// Initializes a new instance of MaintenanceRedeployStatus. + /// Initializes a new instance of . /// True, if customer is allowed to perform Maintenance. /// Start Time for the Pre Maintenance Window. /// End Time for the Pre Maintenance Window. @@ -25,7 +29,8 @@ internal MaintenanceRedeployStatus() /// End Time for the Maintenance Window. /// The Last Maintenance Operation Result Code. /// Message returned for the last Maintenance Operation. - internal MaintenanceRedeployStatus(bool? isCustomerInitiatedMaintenanceAllowed, DateTimeOffset? preMaintenanceWindowStartOn, DateTimeOffset? preMaintenanceWindowEndOn, DateTimeOffset? maintenanceWindowStartOn, DateTimeOffset? maintenanceWindowEndOn, MaintenanceOperationResultCodeType? lastOperationResultCode, string lastOperationMessage) + /// Keeps track of any properties unknown to the library. + internal MaintenanceRedeployStatus(bool? isCustomerInitiatedMaintenanceAllowed, DateTimeOffset? preMaintenanceWindowStartOn, DateTimeOffset? preMaintenanceWindowEndOn, DateTimeOffset? maintenanceWindowStartOn, DateTimeOffset? maintenanceWindowEndOn, MaintenanceOperationResultCodeType? lastOperationResultCode, string lastOperationMessage, Dictionary serializedAdditionalRawData) { IsCustomerInitiatedMaintenanceAllowed = isCustomerInitiatedMaintenanceAllowed; PreMaintenanceWindowStartOn = preMaintenanceWindowStartOn; @@ -34,6 +39,7 @@ internal MaintenanceRedeployStatus(bool? isCustomerInitiatedMaintenanceAllowed, MaintenanceWindowEndOn = maintenanceWindowEndOn; LastOperationResultCode = lastOperationResultCode; LastOperationMessage = lastOperationMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// True, if customer is allowed to perform Maintenance. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskData.Serialization.cs index fb038a691e24..d5e5c2279fc2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskData.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class ManagedDiskData : IUtf8JsonSerializable + public partial class ManagedDiskData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Zones)) { @@ -68,17 +81,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PurchasePlan)) { writer.WritePropertyName("purchasePlan"u8); - writer.WriteObjectValue(PurchasePlan); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } } if (Optional.IsDefined(SupportedCapabilities)) { writer.WritePropertyName("supportedCapabilities"u8); - writer.WriteObjectValue(SupportedCapabilities); + if (SupportedCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SupportedCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(DiskSizeGB)) { @@ -88,7 +122,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EncryptionSettingsGroup)) { writer.WritePropertyName("encryptionSettingsCollection"u8); - writer.WriteObjectValue(EncryptionSettingsGroup); + if (EncryptionSettingsGroup is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionSettingsGroup).Serialize(writer, options); + } } if (Optional.IsDefined(DiskIopsReadWrite)) { @@ -113,7 +154,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(MaxShares)) { @@ -148,7 +196,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(CompletionPercent)) { @@ -171,11 +226,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsOptimizedForFrequentAttach.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedDiskData DeserializeManagedDiskData(JsonElement element) + internal static ManagedDiskData DeserializeManagedDiskData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -223,6 +292,7 @@ internal static ManagedDiskData DeserializeManagedDiskData(JsonElement element) Optional dataAccessAuthMode = default; Optional optimizedForFrequentAttach = default; Optional lastOwnershipUpdateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy"u8)) @@ -623,8 +693,61 @@ internal static ManagedDiskData DeserializeManagedDiskData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedDiskData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, managedBy.Value, Optional.ToList(managedByExtended), sku.Value, Optional.ToList(zones), extendedLocation, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), uniqueId.Value, encryptionSettingsGroup.Value, provisioningState.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(diskIOPSReadOnly), Optional.ToNullable(diskMBpsReadOnly), Optional.ToNullable(diskState), encryption.Value, Optional.ToNullable(maxShares), Optional.ToList(shareInfo), Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, Optional.ToNullable(burstingEnabledTime), tier.Value, Optional.ToNullable(burstingEnabled), propertyUpdatesInProgress.Value, Optional.ToNullable(supportsHibernation), securityProfile.Value, Optional.ToNullable(completionPercent), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(dataAccessAuthMode), Optional.ToNullable(optimizedForFrequentAttach), Optional.ToNullable(lastOwnershipUpdateTime), serializedAdditionalRawData); + } + + ManagedDiskData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedDiskData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedDiskData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedDiskData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedDiskData model) + { + if (model is null) + { + return null; } - return new ManagedDiskData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, managedBy.Value, Optional.ToList(managedByExtended), sku.Value, Optional.ToList(zones), extendedLocation, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), uniqueId.Value, encryptionSettingsGroup.Value, provisioningState.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(diskIOPSReadOnly), Optional.ToNullable(diskMBpsReadOnly), Optional.ToNullable(diskState), encryption.Value, Optional.ToNullable(maxShares), Optional.ToList(shareInfo), Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, Optional.ToNullable(burstingEnabledTime), tier.Value, Optional.ToNullable(burstingEnabled), propertyUpdatesInProgress.Value, Optional.ToNullable(supportsHibernation), securityProfile.Value, Optional.ToNullable(completionPercent), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(dataAccessAuthMode), Optional.ToNullable(optimizedForFrequentAttach), Optional.ToNullable(lastOwnershipUpdateTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedDiskData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedDiskData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.Serialization.cs index fe88970b73cf..252effd739f6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ManagedDiskPatch : IUtf8JsonSerializable + public partial class ManagedDiskPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -29,7 +37,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EncryptionSettingsGroup)) { writer.WritePropertyName("encryptionSettingsCollection"u8); - writer.WriteObjectValue(EncryptionSettingsGroup); + if (EncryptionSettingsGroup is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionSettingsGroup).Serialize(writer, options); + } } if (Optional.IsDefined(DiskIopsReadWrite)) { @@ -76,7 +98,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkAccessPolicy)) { @@ -101,12 +130,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PurchasePlan)) { writer.WritePropertyName("purchasePlan"u8); - writer.WriteObjectValue(PurchasePlan); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } } if (Optional.IsDefined(SupportedCapabilities)) { writer.WritePropertyName("supportedCapabilities"u8); - writer.WriteObjectValue(SupportedCapabilities); + if (SupportedCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SupportedCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(SupportsHibernation)) { @@ -129,7 +172,320 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsOptimizedForFrequentAttach.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ManagedDiskPatch DeserializeManagedDiskPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional sku = default; + Optional osType = default; + Optional diskSizeGB = default; + Optional encryptionSettingsGroup = default; + Optional diskIOPSReadWrite = default; + Optional diskMBpsReadWrite = default; + Optional diskIOPSReadOnly = default; + Optional diskMBpsReadOnly = default; + Optional maxShares = default; + Optional encryption = default; + Optional networkAccessPolicy = default; + Optional diskAccessId = default; + Optional tier = default; + Optional burstingEnabled = default; + Optional purchasePlan = default; + Optional supportedCapabilities = default; + Optional propertyUpdatesInProgress = default; + Optional supportsHibernation = default; + Optional publicNetworkAccess = default; + Optional dataAccessAuthMode = default; + Optional optimizedForFrequentAttach = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = DiskSku.DeserializeDiskSku(property.Value); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("osType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osType = property0.Value.GetString().ToSupportedOperatingSystemType(); + continue; + } + if (property0.NameEquals("diskSizeGB"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGB = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("encryptionSettingsCollection"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryptionSettingsGroup = EncryptionSettingsGroup.DeserializeEncryptionSettingsGroup(property0.Value); + continue; + } + if (property0.NameEquals("diskIOPSReadWrite"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskIOPSReadWrite = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("diskMBpsReadWrite"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskMBpsReadWrite = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("diskIOPSReadOnly"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskIOPSReadOnly = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("diskMBpsReadOnly"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskMBpsReadOnly = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("maxShares"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxShares = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = DiskEncryption.DeserializeDiskEncryption(property0.Value); + continue; + } + if (property0.NameEquals("networkAccessPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkAccessPolicy = new NetworkAccessPolicy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("diskAccessId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskAccessId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("tier"u8)) + { + tier = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("burstingEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + burstingEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("purchasePlan"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + purchasePlan = DiskPurchasePlan.DeserializeDiskPurchasePlan(property0.Value); + continue; + } + if (property0.NameEquals("supportedCapabilities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportedCapabilities = SupportedCapabilities.DeserializeSupportedCapabilities(property0.Value); + continue; + } + if (property0.NameEquals("propertyUpdatesInProgress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + propertyUpdatesInProgress = PropertyUpdatesInProgress.DeserializePropertyUpdatesInProgress(property0.Value); + continue; + } + if (property0.NameEquals("supportsHibernation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportsHibernation = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new DiskPublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("dataAccessAuthMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataAccessAuthMode = new DataAccessAuthMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("optimizedForFrequentAttach"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + optimizedForFrequentAttach = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedDiskPatch(Optional.ToDictionary(tags), sku.Value, Optional.ToNullable(osType), Optional.ToNullable(diskSizeGB), encryptionSettingsGroup.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(diskIOPSReadOnly), Optional.ToNullable(diskMBpsReadOnly), Optional.ToNullable(maxShares), encryption.Value, Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, tier.Value, Optional.ToNullable(burstingEnabled), purchasePlan.Value, supportedCapabilities.Value, propertyUpdatesInProgress.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(dataAccessAuthMode), Optional.ToNullable(optimizedForFrequentAttach), serializedAdditionalRawData); + } + + ManagedDiskPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedDiskPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedDiskPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedDiskPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedDiskPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedDiskPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedDiskPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.cs index 8c370ad4942d..02a45fd78e99 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,66 @@ namespace Azure.ResourceManager.Compute.Models /// Disk update resource. public partial class ManagedDiskPatch { - /// Initializes a new instance of ManagedDiskPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedDiskPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. + /// the Operating System type. + /// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + /// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + /// The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. + /// The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + /// The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. + /// The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + /// The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. + /// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + /// Policy for accessing the disk via network. + /// ARM id of the DiskAccess resource for using private endpoints on disks. + /// Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. + /// Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. + /// Purchase plan information to be added on the OS disk. + /// List of supported capabilities to be added on the OS disk. + /// Properties of the disk for which update is pending. + /// Indicates the OS on a disk supports hibernation. + /// Policy for controlling export on the disk. + /// Additional authentication requirements when exporting or uploading to a disk or snapshot. + /// Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. + /// Keeps track of any properties unknown to the library. + internal ManagedDiskPatch(IDictionary tags, DiskSku sku, SupportedOperatingSystemType? osType, int? diskSizeGB, EncryptionSettingsGroup encryptionSettingsGroup, long? diskIopsReadWrite, long? diskMBpsReadWrite, long? diskIopsReadOnly, long? diskMBpsReadOnly, int? maxShares, DiskEncryption encryption, NetworkAccessPolicy? networkAccessPolicy, ResourceIdentifier diskAccessId, string tier, bool? burstingEnabled, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, PropertyUpdatesInProgress propertyUpdatesInProgress, bool? supportsHibernation, DiskPublicNetworkAccess? publicNetworkAccess, DataAccessAuthMode? dataAccessAuthMode, bool? isOptimizedForFrequentAttach, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Sku = sku; + OSType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsGroup = encryptionSettingsGroup; + DiskIopsReadWrite = diskIopsReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskIopsReadOnly = diskIopsReadOnly; + DiskMBpsReadOnly = diskMBpsReadOnly; + MaxShares = maxShares; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + Tier = tier; + BurstingEnabled = burstingEnabled; + PurchasePlan = purchasePlan; + SupportedCapabilities = supportedCapabilities; + PropertyUpdatesInProgress = propertyUpdatesInProgress; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + IsOptimizedForFrequentAttach = isOptimizedForFrequentAttach; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.Serialization.cs index e9d2cc438c23..491cb58c7794 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class OSDiskImage : IUtf8JsonSerializable + internal partial class OSDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("operatingSystem"u8); writer.WriteStringValue(OperatingSystem.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OSDiskImage DeserializeOSDiskImage(JsonElement element) + internal static OSDiskImage DeserializeOSDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } SupportedOperatingSystemType operatingSystem = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operatingSystem"u8)) @@ -34,8 +57,61 @@ internal static OSDiskImage DeserializeOSDiskImage(JsonElement element) operatingSystem = property.Value.GetString().ToSupportedOperatingSystemType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSDiskImage(operatingSystem, serializedAdditionalRawData); + } + + OSDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSDiskImage model) + { + if (model is null) + { + return null; } - return new OSDiskImage(operatingSystem); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSDiskImage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.cs index 62b60d7a5aca..8a0955cc14e3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImage.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains the os disk image information. internal partial class OSDiskImage { - /// Initializes a new instance of OSDiskImage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The operating system of the osDiskImage. public OSDiskImage(SupportedOperatingSystemType operatingSystem) { OperatingSystem = operatingSystem; } + /// Initializes a new instance of . + /// The operating system of the osDiskImage. + /// Keeps track of any properties unknown to the library. + internal OSDiskImage(SupportedOperatingSystemType operatingSystem, Dictionary serializedAdditionalRawData) + { + OperatingSystem = operatingSystem; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OSDiskImage() + { + } + /// The operating system of the osDiskImage. public SupportedOperatingSystemType OperatingSystem { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.Serialization.cs index 10ad05292886..4a4c6ace0d31 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.Serialization.cs @@ -5,37 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OSDiskImageEncryption : IUtf8JsonSerializable + public partial class OSDiskImageEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(DiskEncryptionSetId)) { writer.WritePropertyName("diskEncryptionSetId"u8); writer.WriteStringValue(DiskEncryptionSetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OSDiskImageEncryption DeserializeOSDiskImageEncryption(JsonElement element) + internal static OSDiskImageEncryption DeserializeOSDiskImageEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional securityProfile = default; Optional diskEncryptionSetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("securityProfile"u8)) @@ -56,8 +86,61 @@ internal static OSDiskImageEncryption DeserializeOSDiskImageEncryption(JsonEleme diskEncryptionSetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSDiskImageEncryption(diskEncryptionSetId.Value, securityProfile.Value, serializedAdditionalRawData); + } + + OSDiskImageEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSDiskImageEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSDiskImageEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSDiskImageEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSDiskImageEncryption model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSDiskImageEncryption(Response response) + { + if (response is null) + { + return null; } - return new OSDiskImageEncryption(diskEncryptionSetId.Value, securityProfile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSDiskImageEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.cs index 34f79b93471f..8cdf1e7561fb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageEncryption.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,15 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Contains encryption settings for an OS disk image. public partial class OSDiskImageEncryption : DiskImageEncryption { - /// Initializes a new instance of OSDiskImageEncryption. + /// Initializes a new instance of . public OSDiskImageEncryption() { } - /// Initializes a new instance of OSDiskImageEncryption. + /// Initializes a new instance of . /// A relative URI containing the resource ID of the disk encryption set. /// This property specifies the security profile of an OS disk image. - internal OSDiskImageEncryption(ResourceIdentifier diskEncryptionSetId, OSDiskImageSecurityProfile securityProfile) : base(diskEncryptionSetId) + /// Keeps track of any properties unknown to the library. + internal OSDiskImageEncryption(ResourceIdentifier diskEncryptionSetId, OSDiskImageSecurityProfile securityProfile, Dictionary serializedAdditionalRawData) : base(diskEncryptionSetId, serializedAdditionalRawData) { SecurityProfile = securityProfile; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.Serialization.cs index a9ebd520866f..bcea08ce4e3c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OSDiskImageSecurityProfile : IUtf8JsonSerializable + public partial class OSDiskImageSecurityProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConfidentialVmEncryptionType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secureVMDiskEncryptionSetId"u8); writer.WriteStringValue(SecureVmDiskEncryptionSetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OSDiskImageSecurityProfile DeserializeOSDiskImageSecurityProfile(JsonElement element) + internal static OSDiskImageSecurityProfile DeserializeOSDiskImageSecurityProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional confidentialVmEncryptionType = default; Optional secureVmDiskEncryptionSetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("confidentialVMEncryptionType"u8)) @@ -52,8 +75,61 @@ internal static OSDiskImageSecurityProfile DeserializeOSDiskImageSecurityProfile secureVmDiskEncryptionSetId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSDiskImageSecurityProfile(Optional.ToNullable(confidentialVmEncryptionType), secureVmDiskEncryptionSetId.Value, serializedAdditionalRawData); + } + + OSDiskImageSecurityProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSDiskImageSecurityProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSDiskImageSecurityProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSDiskImageSecurityProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSDiskImageSecurityProfile model) + { + if (model is null) + { + return null; } - return new OSDiskImageSecurityProfile(Optional.ToNullable(confidentialVmEncryptionType), secureVmDiskEncryptionSetId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSDiskImageSecurityProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSDiskImageSecurityProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.cs index fecdbdbf3184..08045fa65123 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSDiskImageSecurityProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains security profile for an OS disk image. public partial class OSDiskImageSecurityProfile { - /// Initializes a new instance of OSDiskImageSecurityProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OSDiskImageSecurityProfile() { } - /// Initializes a new instance of OSDiskImageSecurityProfile. + /// Initializes a new instance of . /// confidential VM encryption types. /// secure VM disk encryption set id. - internal OSDiskImageSecurityProfile(ConfidentialVmEncryptionType? confidentialVmEncryptionType, string secureVmDiskEncryptionSetId) + /// Keeps track of any properties unknown to the library. + internal OSDiskImageSecurityProfile(ConfidentialVmEncryptionType? confidentialVmEncryptionType, string secureVmDiskEncryptionSetId, Dictionary serializedAdditionalRawData) { ConfidentialVmEncryptionType = confidentialVmEncryptionType; SecureVmDiskEncryptionSetId = secureVmDiskEncryptionSetId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// confidential VM encryption types. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.Serialization.cs index a23e5cf02d9d..19ff7d236eef 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class OSFamilyListResult + internal partial class OSFamilyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OSFamilyListResult DeserializeOSFamilyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OSFamilyListResult DeserializeOSFamilyListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static OSFamilyListResult DeserializeOSFamilyListResult(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OSFamilyListResult(value, nextLink.Value); + return new OSFamilyListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + OSFamilyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSFamilyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSFamilyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSFamilyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSFamilyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSFamilyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSFamilyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.cs index 9b65cae1bc36..26b0de8e3a83 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSFamilyListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list operation result. internal partial class OSFamilyListResult { - /// Initializes a new instance of OSFamilyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of resources. /// is null. internal OSFamilyListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal OSFamilyListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of OSFamilyListResult. + /// Initializes a new instance of . /// The list of resources. /// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null to fetch all the resources. - internal OSFamilyListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OSFamilyListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OSFamilyListResult() + { } /// The list of resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.Serialization.cs index 4085bf76a541..84a77f19cb3e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OSImageNotificationProfile : IUtf8JsonSerializable + public partial class OSImageNotificationProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NotBeforeTimeout)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enable"u8); writer.WriteBooleanValue(Enable.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OSImageNotificationProfile DeserializeOSImageNotificationProfile(JsonElement element) + internal static OSImageNotificationProfile DeserializeOSImageNotificationProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional notBeforeTimeout = default; Optional enable = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("notBeforeTimeout"u8)) @@ -52,8 +75,61 @@ internal static OSImageNotificationProfile DeserializeOSImageNotificationProfile enable = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSImageNotificationProfile(notBeforeTimeout.Value, Optional.ToNullable(enable), serializedAdditionalRawData); + } + + OSImageNotificationProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSImageNotificationProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSImageNotificationProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSImageNotificationProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSImageNotificationProfile model) + { + if (model is null) + { + return null; } - return new OSImageNotificationProfile(notBeforeTimeout.Value, Optional.ToNullable(enable)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSImageNotificationProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSImageNotificationProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.cs index 9479d167f19e..8469b91bf6d1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSImageNotificationProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The OSImageNotificationProfile. public partial class OSImageNotificationProfile { - /// Initializes a new instance of OSImageNotificationProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OSImageNotificationProfile() { } - /// Initializes a new instance of OSImageNotificationProfile. + /// Initializes a new instance of . /// Length of time a Virtual Machine being reimaged or having its OS upgraded will have to potentially approve the OS Image Scheduled Event before the event is auto approved (timed out). The configuration is specified in ISO 8601 format, and the value must be 15 minutes (PT15M). /// Specifies whether the OS Image Scheduled event is enabled or disabled. - internal OSImageNotificationProfile(string notBeforeTimeout, bool? enable) + /// Keeps track of any properties unknown to the library. + internal OSImageNotificationProfile(string notBeforeTimeout, bool? enable, Dictionary serializedAdditionalRawData) { NotBeforeTimeout = notBeforeTimeout; Enable = enable; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Length of time a Virtual Machine being reimaged or having its OS upgraded will have to potentially approve the OS Image Scheduled Event before the event is auto approved (timed out). The configuration is specified in ISO 8601 format, and the value must be 15 minutes (PT15M). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.Serialization.cs index 104aec568a15..8de30657ddf6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OSProfileProvisioningData : IUtf8JsonSerializable + public partial class OSProfileProvisioningData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AdminPassword)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("customData"u8); writer.WriteStringValue(CustomData); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static OSProfileProvisioningData DeserializeOSProfileProvisioningData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional adminPassword = default; + Optional customData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("adminPassword"u8)) + { + adminPassword = property.Value.GetString(); + continue; + } + if (property.NameEquals("customData"u8)) + { + customData = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSProfileProvisioningData(adminPassword.Value, customData.Value, serializedAdditionalRawData); + } + + OSProfileProvisioningData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSProfileProvisioningData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSProfileProvisioningData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSProfileProvisioningData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSProfileProvisioningData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSProfileProvisioningData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSProfileProvisioningData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.cs index 88b387bb259d..22508326712e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSProfileProvisioningData.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Additional parameters for Reimaging Non-Ephemeral Virtual Machine. public partial class OSProfileProvisioningData { - /// Initializes a new instance of OSProfileProvisioningData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OSProfileProvisioningData() { } + /// Initializes a new instance of . + /// Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + /// Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. **Note: Do not pass any secrets or passwords in customData property.** This property cannot be updated after the VM is created. The property customData is passed to the VM to be saved as a file, for more information see [Custom Data on Azure VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/). If using cloud-init for your Linux VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + /// Keeps track of any properties unknown to the library. + internal OSProfileProvisioningData(string adminPassword, string customData, Dictionary serializedAdditionalRawData) + { + AdminPassword = adminPassword; + CustomData = customData; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). public string AdminPassword { get; set; } /// Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. **Note: Do not pass any secrets or passwords in customData property.** This property cannot be updated after the VM is created. The property customData is passed to the VM to be saved as a file, for more information see [Custom Data on Azure VMs](https://azure.microsoft.com/blog/custom-data-and-cloud-init-on-windows-azure/). If using cloud-init for your Linux VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.Serialization.cs index 5d56e364d859..474381106fe5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class OSVersionListResult + internal partial class OSVersionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OSVersionListResult DeserializeOSVersionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OSVersionListResult DeserializeOSVersionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static OSVersionListResult DeserializeOSVersionListResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OSVersionListResult(value, nextLink.Value); + return new OSVersionListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + OSVersionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSVersionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSVersionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSVersionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSVersionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSVersionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSVersionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.cs index 0cc03826743f..60be44d88912 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list operation result. internal partial class OSVersionListResult { - /// Initializes a new instance of OSVersionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of resources. /// is null. internal OSVersionListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal OSVersionListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of OSVersionListResult. + /// Initializes a new instance of . /// The list of resources. /// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null to fetch all the resources. - internal OSVersionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OSVersionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OSVersionListResult() + { } /// The list of resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.Serialization.cs index a0b44b90b79e..1f6d51429444 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OSVersionPropertiesBase + public partial class OSVersionPropertiesBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OSVersionPropertiesBase DeserializeOSVersionPropertiesBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OSVersionPropertiesBase DeserializeOSVersionPropertiesBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static OSVersionPropertiesBase DeserializeOSVersionPropertiesBase(JsonE Optional label = default; Optional isDefault = default; Optional isActive = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("version"u8)) @@ -52,8 +81,61 @@ internal static OSVersionPropertiesBase DeserializeOSVersionPropertiesBase(JsonE isActive = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OSVersionPropertiesBase(version.Value, label.Value, Optional.ToNullable(isDefault), Optional.ToNullable(isActive)); + return new OSVersionPropertiesBase(version.Value, label.Value, Optional.ToNullable(isDefault), Optional.ToNullable(isActive), serializedAdditionalRawData); + } + + OSVersionPropertiesBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSVersionPropertiesBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSVersionPropertiesBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSVersionPropertiesBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSVersionPropertiesBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSVersionPropertiesBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSVersionPropertiesBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.cs index 1ffc00c5c856..a1754a80770e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OSVersionPropertiesBase.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Configuration view of an OS version. public partial class OSVersionPropertiesBase { - /// Initializes a new instance of OSVersionPropertiesBase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OSVersionPropertiesBase() { } - /// Initializes a new instance of OSVersionPropertiesBase. + /// Initializes a new instance of . /// The OS version. /// The OS version label. /// Specifies whether this is the default OS version for its family. /// Specifies whether this OS version is active. - internal OSVersionPropertiesBase(string version, string label, bool? isDefault, bool? isActive) + /// Keeps track of any properties unknown to the library. + internal OSVersionPropertiesBase(string version, string label, bool? isDefault, bool? isActive, Dictionary serializedAdditionalRawData) { Version = version; Label = label; IsDefault = isDefault; IsActive = isActive; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The OS version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.Serialization.cs index 6b14f67df3e7..fff615d2c903 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OrchestrationServiceStateContent : IUtf8JsonSerializable + public partial class OrchestrationServiceStateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("serviceName"u8); writer.WriteStringValue(ServiceName.ToString()); writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static OrchestrationServiceStateContent DeserializeOrchestrationServiceStateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OrchestrationServiceName serviceName = default; + OrchestrationServiceStateAction action = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serviceName"u8)) + { + serviceName = new OrchestrationServiceName(property.Value.GetString()); + continue; + } + if (property.NameEquals("action"u8)) + { + action = new OrchestrationServiceStateAction(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OrchestrationServiceStateContent(serviceName, action, serializedAdditionalRawData); + } + + OrchestrationServiceStateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrchestrationServiceStateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrchestrationServiceStateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrchestrationServiceStateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrchestrationServiceStateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrchestrationServiceStateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrchestrationServiceStateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.cs index 63ea907bd3ae..1b1edadb4f27 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceStateContent.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The input for OrchestrationServiceState. public partial class OrchestrationServiceStateContent { - /// Initializes a new instance of OrchestrationServiceStateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the service. /// The action to be performed. public OrchestrationServiceStateContent(OrchestrationServiceName serviceName, OrchestrationServiceStateAction action) @@ -19,6 +25,22 @@ public OrchestrationServiceStateContent(OrchestrationServiceName serviceName, Or Action = action; } + /// Initializes a new instance of . + /// The name of the service. + /// The action to be performed. + /// Keeps track of any properties unknown to the library. + internal OrchestrationServiceStateContent(OrchestrationServiceName serviceName, OrchestrationServiceStateAction action, Dictionary serializedAdditionalRawData) + { + ServiceName = serviceName; + Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OrchestrationServiceStateContent() + { + } + /// The name of the service. public OrchestrationServiceName ServiceName { get; } /// The action to be performed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.Serialization.cs index 392ee30b9a7b..0729ed32cc1e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class OrchestrationServiceSummary + public partial class OrchestrationServiceSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OrchestrationServiceSummary DeserializeOrchestrationServiceSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OrchestrationServiceSummary DeserializeOrchestrationServiceSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional serviceName = default; Optional serviceState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serviceName"u8)) @@ -40,8 +69,61 @@ internal static OrchestrationServiceSummary DeserializeOrchestrationServiceSumma serviceState = new OrchestrationServiceState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OrchestrationServiceSummary(Optional.ToNullable(serviceName), Optional.ToNullable(serviceState)); + return new OrchestrationServiceSummary(Optional.ToNullable(serviceName), Optional.ToNullable(serviceState), serializedAdditionalRawData); + } + + OrchestrationServiceSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrchestrationServiceSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrchestrationServiceSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrchestrationServiceSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrchestrationServiceSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrchestrationServiceSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrchestrationServiceSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.cs index c8bf41f9a54f..c66050f3ebe2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/OrchestrationServiceSummary.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Summary for an orchestration service of a virtual machine scale set. public partial class OrchestrationServiceSummary { - /// Initializes a new instance of OrchestrationServiceSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OrchestrationServiceSummary() { } - /// Initializes a new instance of OrchestrationServiceSummary. + /// Initializes a new instance of . /// The name of the service. /// The current state of the service. - internal OrchestrationServiceSummary(OrchestrationServiceName? serviceName, OrchestrationServiceState? serviceState) + /// Keeps track of any properties unknown to the library. + internal OrchestrationServiceSummary(OrchestrationServiceName? serviceName, OrchestrationServiceState? serviceState, Dictionary serializedAdditionalRawData) { ServiceName = serviceName; ServiceState = serviceState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the service. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.Serialization.cs index c14cb175a72e..f9c43cf6a879 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class PatchInstallationDetail + public partial class PatchInstallationDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PatchInstallationDetail DeserializePatchInstallationDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PatchInstallationDetail DeserializePatchInstallationDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static PatchInstallationDetail DeserializePatchInstallationDetail(JsonE Optional kbId = default; Optional> classifications = default; Optional installationState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("patchId"u8)) @@ -70,8 +98,61 @@ internal static PatchInstallationDetail DeserializePatchInstallationDetail(JsonE installationState = new PatchInstallationState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PatchInstallationDetail(patchId.Value, name.Value, version.Value, kbId.Value, Optional.ToList(classifications), Optional.ToNullable(installationState)); + return new PatchInstallationDetail(patchId.Value, name.Value, version.Value, kbId.Value, Optional.ToList(classifications), Optional.ToNullable(installationState), serializedAdditionalRawData); + } + + PatchInstallationDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePatchInstallationDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PatchInstallationDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePatchInstallationDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PatchInstallationDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PatchInstallationDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePatchInstallationDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.cs index a671c821252c..abcf286975e9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchInstallationDetail.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Information about a specific patch that was encountered during an installation action. public partial class PatchInstallationDetail { - /// Initializes a new instance of PatchInstallationDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PatchInstallationDetail() { Classifications = new ChangeTrackingList(); } - /// Initializes a new instance of PatchInstallationDetail. + /// Initializes a new instance of . /// A unique identifier for the patch. /// The friendly name of the patch. /// The version string of the package. It may conform to Semantic Versioning. Only applies to Linux. /// The KBID of the patch. Only applies to Windows patches. /// The classification(s) of the patch as provided by the patch publisher. /// The state of the patch after the installation operation completed. - internal PatchInstallationDetail(string patchId, string name, string version, string kbId, IReadOnlyList classifications, PatchInstallationState? installationState) + /// Keeps track of any properties unknown to the library. + internal PatchInstallationDetail(string patchId, string name, string version, string kbId, IReadOnlyList classifications, PatchInstallationState? installationState, Dictionary serializedAdditionalRawData) { PatchId = patchId; Name = name; @@ -34,6 +39,7 @@ internal PatchInstallationDetail(string patchId, string name, string version, st KbId = kbId; Classifications = classifications; InstallationState = installationState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A unique identifier for the patch. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.Serialization.cs index 17d2c97de901..aaf551184223 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class PatchSettings : IUtf8JsonSerializable + public partial class PatchSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PatchMode)) { @@ -33,13 +41,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutomaticByPlatformSettings)) { writer.WritePropertyName("automaticByPlatformSettings"u8); - writer.WriteObjectValue(AutomaticByPlatformSettings); + if (AutomaticByPlatformSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutomaticByPlatformSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PatchSettings DeserializePatchSettings(JsonElement element) + internal static PatchSettings DeserializePatchSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +77,7 @@ internal static PatchSettings DeserializePatchSettings(JsonElement element) Optional enableHotpatching = default; Optional assessmentMode = default; Optional automaticByPlatformSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("patchMode"u8)) @@ -86,8 +116,61 @@ internal static PatchSettings DeserializePatchSettings(JsonElement element) automaticByPlatformSettings = WindowsVmGuestPatchAutomaticByPlatformSettings.DeserializeWindowsVmGuestPatchAutomaticByPlatformSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PatchSettings(Optional.ToNullable(patchMode), Optional.ToNullable(enableHotpatching), Optional.ToNullable(assessmentMode), automaticByPlatformSettings.Value, serializedAdditionalRawData); + } + + PatchSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePatchSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PatchSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePatchSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PatchSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PatchSettings(Response response) + { + if (response is null) + { + return null; } - return new PatchSettings(Optional.ToNullable(patchMode), Optional.ToNullable(enableHotpatching), Optional.ToNullable(assessmentMode), automaticByPlatformSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePatchSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.cs index c7c1340b0f93..c4858aaf9d42 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PatchSettings.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies settings related to VM Guest Patching on Windows. public partial class PatchSettings { - /// Initializes a new instance of PatchSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PatchSettings() { } - /// Initializes a new instance of PatchSettings. + /// Initializes a new instance of . /// Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates must be false<br /><br /> **AutomaticByOS** - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be true. <br /><br /> **AutomaticByPlatform** - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. /// Enables customers to patch their Azure VMs without requiring a reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must be set to 'AutomaticByPlatform'. /// Specifies the mode of VM Guest patch assessment for the IaaS virtual machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the timing of patch assessments on a virtual machine.<br /><br /> **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent must be true. /// Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Windows. - internal PatchSettings(WindowsVmGuestPatchMode? patchMode, bool? enableHotpatching, WindowsPatchAssessmentMode? assessmentMode, WindowsVmGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings) + /// Keeps track of any properties unknown to the library. + internal PatchSettings(WindowsVmGuestPatchMode? patchMode, bool? enableHotpatching, WindowsPatchAssessmentMode? assessmentMode, WindowsVmGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings, Dictionary serializedAdditionalRawData) { PatchMode = patchMode; EnableHotpatching = enableHotpatching; AssessmentMode = assessmentMode; AutomaticByPlatformSettings = automaticByPlatformSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates must be false<br /><br /> **AutomaticByOS** - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be true. <br /><br /> **AutomaticByPlatform** - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.Serialization.cs index 5874a4b42c30..96f697348f56 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.Serialization.cs @@ -5,15 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class PirCommunityGalleryResourceData + public partial class PirCommunityGalleryResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PirCommunityGalleryResourceData DeserializePirCommunityGalleryResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PirCommunityGalleryResourceData DeserializePirCommunityGalleryResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +58,7 @@ internal static PirCommunityGalleryResourceData DeserializePirCommunityGalleryRe Optional location = default; Optional type = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -64,8 +101,61 @@ internal static PirCommunityGalleryResourceData DeserializePirCommunityGalleryRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PirCommunityGalleryResourceData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value); + return new PirCommunityGalleryResourceData(name.Value, Optional.ToNullable(location), Optional.ToNullable(type), uniqueId.Value, serializedAdditionalRawData); + } + + PirCommunityGalleryResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePirCommunityGalleryResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PirCommunityGalleryResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePirCommunityGalleryResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PirCommunityGalleryResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PirCommunityGalleryResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePirCommunityGalleryResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.cs index 249300445c3c..77798a629496 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirCommunityGalleryResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.Compute.Models /// Base information about the community gallery resource in pir. public partial class PirCommunityGalleryResourceData { - /// Initializes a new instance of PirCommunityGalleryResourceData. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PirCommunityGalleryResourceData() { } - /// Initializes a new instance of PirCommunityGalleryResourceData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// Resource type. /// The unique id of this community gallery. - internal PirCommunityGalleryResourceData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId) + /// Keeps track of any properties unknown to the library. + internal PirCommunityGalleryResourceData(string name, AzureLocation? location, ResourceType? resourceType, string uniqueId, Dictionary serializedAdditionalRawData) { Name = name; Location = location; ResourceType = resourceType; UniqueId = uniqueId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.Serialization.cs index c323ec4389ec..2b5f7a4bbd06 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class PirResourceData + public partial class PirResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PirResourceData DeserializePirResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PirResourceData DeserializePirResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +65,61 @@ internal static PirResourceData DeserializePirResourceData(JsonElement element) location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PirResourceData(name.Value, Optional.ToNullable(location)); + return new PirResourceData(name.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + PirResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePirResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PirResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePirResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PirResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PirResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePirResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.cs index 19eac84542af..6f1fe8080dd6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Compute.Models /// The Resource model definition. public partial class PirResourceData { - /// Initializes a new instance of PirResourceData. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PirResourceData() { } - /// Initializes a new instance of PirResourceData. + /// Initializes a new instance of . /// Resource name. /// Resource location. - internal PirResourceData(string name, AzureLocation? location) + /// Keeps track of any properties unknown to the library. + internal PirResourceData(string name, AzureLocation? location, Dictionary serializedAdditionalRawData) { Name = name; Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.Serialization.cs index 6623fd14b030..b685ae5a64dc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.Serialization.cs @@ -5,15 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class PirSharedGalleryResourceData + public partial class PirSharedGalleryResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PirSharedGalleryResourceData DeserializePirSharedGalleryResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PirSharedGalleryResourceData DeserializePirSharedGalleryResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +57,7 @@ internal static PirSharedGalleryResourceData DeserializePirSharedGalleryResource Optional name = default; Optional location = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -54,8 +91,61 @@ internal static PirSharedGalleryResourceData DeserializePirSharedGalleryResource } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PirSharedGalleryResourceData(name.Value, Optional.ToNullable(location), uniqueId.Value); + return new PirSharedGalleryResourceData(name.Value, Optional.ToNullable(location), uniqueId.Value, serializedAdditionalRawData); + } + + PirSharedGalleryResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePirSharedGalleryResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PirSharedGalleryResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePirSharedGalleryResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PirSharedGalleryResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PirSharedGalleryResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePirSharedGalleryResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.cs index b11f1a59c4be..823246aaef0a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PirSharedGalleryResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +14,17 @@ namespace Azure.ResourceManager.Compute.Models /// Base information about the shared gallery resource in pir. public partial class PirSharedGalleryResourceData : PirResourceData { - /// Initializes a new instance of PirSharedGalleryResourceData. + /// Initializes a new instance of . internal PirSharedGalleryResourceData() { } - /// Initializes a new instance of PirSharedGalleryResourceData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. - internal PirSharedGalleryResourceData(string name, AzureLocation? location, string uniqueId) : base(name, location) + /// Keeps track of any properties unknown to the library. + internal PirSharedGalleryResourceData(string name, AzureLocation? location, string uniqueId, Dictionary serializedAdditionalRawData) : base(name, location, serializedAdditionalRawData) { UniqueId = uniqueId; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.Serialization.cs index 79f676e5f5e9..6642b09a9ce6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class PropertyUpdatesInProgress + internal partial class PropertyUpdatesInProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PropertyUpdatesInProgress DeserializePropertyUpdatesInProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(TargetTier)) + { + writer.WritePropertyName("targetTier"u8); + writer.WriteStringValue(TargetTier); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PropertyUpdatesInProgress DeserializePropertyUpdatesInProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional targetTier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetTier"u8)) @@ -26,8 +60,61 @@ internal static PropertyUpdatesInProgress DeserializePropertyUpdatesInProgress(J targetTier = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PropertyUpdatesInProgress(targetTier.Value); + return new PropertyUpdatesInProgress(targetTier.Value, serializedAdditionalRawData); + } + + PropertyUpdatesInProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePropertyUpdatesInProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PropertyUpdatesInProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePropertyUpdatesInProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PropertyUpdatesInProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PropertyUpdatesInProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePropertyUpdatesInProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.cs index d4b7cf14962e..e74832872faa 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PropertyUpdatesInProgress.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Properties of the disk for which update is pending. internal partial class PropertyUpdatesInProgress { - /// Initializes a new instance of PropertyUpdatesInProgress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PropertyUpdatesInProgress() { } - /// Initializes a new instance of PropertyUpdatesInProgress. + /// Initializes a new instance of . /// The target performance tier of the disk if a tier change operation is in progress. - internal PropertyUpdatesInProgress(string targetTier) + /// Keeps track of any properties unknown to the library. + internal PropertyUpdatesInProgress(string targetTier, Dictionary serializedAdditionalRawData) { TargetTier = targetTier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The target performance tier of the disk if a tier change operation is in progress. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupData.Serialization.cs index edcaf616e6e7..f6c7f83c0d0d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class ProximityPlacementGroupData : IUtf8JsonSerializable + public partial class ProximityPlacementGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -51,19 +58,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ColocationStatus)) { writer.WritePropertyName("colocationStatus"u8); - writer.WriteObjectValue(ColocationStatus); + if (ColocationStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ColocationStatus).Serialize(writer, options); + } } if (Optional.IsDefined(Intent)) { writer.WritePropertyName("intent"u8); - writer.WriteObjectValue(Intent); + if (Intent is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Intent).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProximityPlacementGroupData DeserializeProximityPlacementGroupData(JsonElement element) + internal static ProximityPlacementGroupData DeserializeProximityPlacementGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +116,7 @@ internal static ProximityPlacementGroupData DeserializeProximityPlacementGroupDa Optional> availabilitySets = default; Optional colocationStatus = default; Optional intent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -221,8 +257,61 @@ internal static ProximityPlacementGroupData DeserializeProximityPlacementGroupDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProximityPlacementGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), Optional.ToNullable(proximityPlacementGroupType), Optional.ToList(virtualMachines), Optional.ToList(virtualMachineScaleSets), Optional.ToList(availabilitySets), colocationStatus.Value, intent.Value, serializedAdditionalRawData); + } + + ProximityPlacementGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProximityPlacementGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProximityPlacementGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProximityPlacementGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProximityPlacementGroupData model) + { + if (model is null) + { + return null; } - return new ProximityPlacementGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), Optional.ToNullable(proximityPlacementGroupType), Optional.ToList(virtualMachines), Optional.ToList(virtualMachineScaleSets), Optional.ToList(availabilitySets), colocationStatus.Value, intent.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProximityPlacementGroupData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProximityPlacementGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.Serialization.cs index b29613521f36..03ed575196b6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class ProximityPlacementGroupListResult + internal partial class ProximityPlacementGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ProximityPlacementGroupListResult DeserializeProximityPlacementGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ProximityPlacementGroupListResult DeserializeProximityPlacementGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static ProximityPlacementGroupListResult DeserializeProximityPlacementG nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ProximityPlacementGroupListResult(value, nextLink.Value); + return new ProximityPlacementGroupListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ProximityPlacementGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProximityPlacementGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProximityPlacementGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProximityPlacementGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProximityPlacementGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProximityPlacementGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProximityPlacementGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.cs index 9760b701a204..43a6ff69dfc2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Proximity Placement Group operation response. internal partial class ProximityPlacementGroupListResult { - /// Initializes a new instance of ProximityPlacementGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of proximity placement groups. /// is null. internal ProximityPlacementGroupListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal ProximityPlacementGroupListResult(IEnumerable Initializes a new instance of ProximityPlacementGroupListResult. + /// Initializes a new instance of . /// The list of proximity placement groups. /// The URI to fetch the next page of proximity placement groups. - internal ProximityPlacementGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ProximityPlacementGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ProximityPlacementGroupListResult() + { } /// The list of proximity placement groups. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.Serialization.cs index ddd3956ee8b7..37afd1266621 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ProximityPlacementGroupPatch : IUtf8JsonSerializable + public partial class ProximityPlacementGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ProximityPlacementGroupPatch DeserializeProximityPlacementGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProximityPlacementGroupPatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ProximityPlacementGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProximityPlacementGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProximityPlacementGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProximityPlacementGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProximityPlacementGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProximityPlacementGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProximityPlacementGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.cs index 978baf49fbd4..120b373a7b93 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPatch.cs @@ -5,14 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies information about the proximity placement group. public partial class ProximityPlacementGroupPatch : ComputeResourcePatch { - /// Initializes a new instance of ProximityPlacementGroupPatch. + /// Initializes a new instance of . public ProximityPlacementGroupPatch() { } + + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal ProximityPlacementGroupPatch(IDictionary tags, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.Serialization.cs index 5cdaa37a27ad..f3afe8b038dc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class ProximityPlacementGroupPropertiesIntent : IUtf8JsonSerializable + internal partial class ProximityPlacementGroupPropertiesIntent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(VmSizes)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProximityPlacementGroupPropertiesIntent DeserializeProximityPlacementGroupPropertiesIntent(JsonElement element) + internal static ProximityPlacementGroupPropertiesIntent DeserializeProximityPlacementGroupPropertiesIntent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> vmSizes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmSizes"u8)) @@ -52,8 +74,61 @@ internal static ProximityPlacementGroupPropertiesIntent DeserializeProximityPlac vmSizes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProximityPlacementGroupPropertiesIntent(Optional.ToList(vmSizes), serializedAdditionalRawData); + } + + ProximityPlacementGroupPropertiesIntent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProximityPlacementGroupPropertiesIntent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProximityPlacementGroupPropertiesIntent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProximityPlacementGroupPropertiesIntent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProximityPlacementGroupPropertiesIntent model) + { + if (model is null) + { + return null; } - return new ProximityPlacementGroupPropertiesIntent(Optional.ToList(vmSizes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProximityPlacementGroupPropertiesIntent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProximityPlacementGroupPropertiesIntent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs index e31f4a2a0175..4ea89c9bf9be 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ProximityPlacementGroupPropertiesIntent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the user intent of the proximity placement group. internal partial class ProximityPlacementGroupPropertiesIntent { - /// Initializes a new instance of ProximityPlacementGroupPropertiesIntent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProximityPlacementGroupPropertiesIntent() { VmSizes = new ChangeTrackingList(); } - /// Initializes a new instance of ProximityPlacementGroupPropertiesIntent. + /// Initializes a new instance of . /// Specifies possible sizes of virtual machines that can be created in the proximity placement group. - internal ProximityPlacementGroupPropertiesIntent(IList vmSizes) + /// Keeps track of any properties unknown to the library. + internal ProximityPlacementGroupPropertiesIntent(IList vmSizes, Dictionary serializedAdditionalRawData) { VmSizes = vmSizes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies possible sizes of virtual machines that can be created in the proximity placement group. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.Serialization.cs index d12ff2b3c6b8..506ffd5b74c3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class PurchasePlan : IUtf8JsonSerializable + public partial class PurchasePlan : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("publisher"u8); writer.WriteStringValue(Publisher); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Name); writer.WritePropertyName("product"u8); writer.WriteStringValue(Product); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PurchasePlan DeserializePurchasePlan(JsonElement element) + internal static PurchasePlan DeserializePurchasePlan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static PurchasePlan DeserializePurchasePlan(JsonElement element) string publisher = default; string name = default; string product = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher"u8)) @@ -50,8 +73,61 @@ internal static PurchasePlan DeserializePurchasePlan(JsonElement element) product = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PurchasePlan(publisher, name, product, serializedAdditionalRawData); + } + + PurchasePlan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePurchasePlan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PurchasePlan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePurchasePlan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PurchasePlan model) + { + if (model is null) + { + return null; } - return new PurchasePlan(publisher, name, product); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PurchasePlan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePurchasePlan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.cs index 8be3af48ffa5..efa8b0b2e3a2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PurchasePlan.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. public partial class PurchasePlan { - /// Initializes a new instance of PurchasePlan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The publisher ID. /// The plan ID. /// Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. @@ -29,6 +33,24 @@ public PurchasePlan(string publisher, string name, string product) Product = product; } + /// Initializes a new instance of . + /// The publisher ID. + /// The plan ID. + /// Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + /// Keeps track of any properties unknown to the library. + internal PurchasePlan(string publisher, string name, string product, Dictionary serializedAdditionalRawData) + { + Publisher = publisher; + Name = name; + Product = product; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PurchasePlan() + { + } + /// The publisher ID. public string Publisher { get; set; } /// The plan ID. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.Serialization.cs index 80a4d72a1e31..a68b65b45d60 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RecommendedMachineConfiguration : IUtf8JsonSerializable + public partial class RecommendedMachineConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VCpus)) { writer.WritePropertyName("vCPUs"u8); - writer.WriteObjectValue(VCpus); + if (VCpus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VCpus).Serialize(writer, options); + } } if (Optional.IsDefined(Memory)) { writer.WritePropertyName("memory"u8); - writer.WriteObjectValue(Memory); + if (Memory is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Memory).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RecommendedMachineConfiguration DeserializeRecommendedMachineConfiguration(JsonElement element) + internal static RecommendedMachineConfiguration DeserializeRecommendedMachineConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vCpus = default; Optional memory = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vCPUs"u8)) @@ -56,8 +93,61 @@ internal static RecommendedMachineConfiguration DeserializeRecommendedMachineCon memory = ResourceRange.DeserializeResourceRange(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecommendedMachineConfiguration(vCpus.Value, memory.Value, serializedAdditionalRawData); + } + + RecommendedMachineConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecommendedMachineConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecommendedMachineConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecommendedMachineConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecommendedMachineConfiguration model) + { + if (model is null) + { + return null; } - return new RecommendedMachineConfiguration(vCpus.Value, memory.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecommendedMachineConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecommendedMachineConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.cs index e39584b49760..3fd9021e2527 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecommendedMachineConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. public partial class RecommendedMachineConfiguration { - /// Initializes a new instance of RecommendedMachineConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RecommendedMachineConfiguration() { } - /// Initializes a new instance of RecommendedMachineConfiguration. + /// Initializes a new instance of . /// Describes the resource range. /// Describes the resource range. - internal RecommendedMachineConfiguration(ResourceRange vCpus, ResourceRange memory) + /// Keeps track of any properties unknown to the library. + internal RecommendedMachineConfiguration(ResourceRange vCpus, ResourceRange memory, Dictionary serializedAdditionalRawData) { VCpus = vCpus; Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the resource range. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.Serialization.cs index fade2a034279..d9a6b73b224f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RecoveryWalkResponse + public partial class RecoveryWalkResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RecoveryWalkResponse DeserializeRecoveryWalkResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RecoveryWalkResponse DeserializeRecoveryWalkResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional walkPerformed = default; Optional nextPlatformUpdateDomain = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("walkPerformed"u8)) @@ -40,8 +69,61 @@ internal static RecoveryWalkResponse DeserializeRecoveryWalkResponse(JsonElement nextPlatformUpdateDomain = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RecoveryWalkResponse(Optional.ToNullable(walkPerformed), Optional.ToNullable(nextPlatformUpdateDomain)); + return new RecoveryWalkResponse(Optional.ToNullable(walkPerformed), Optional.ToNullable(nextPlatformUpdateDomain), serializedAdditionalRawData); + } + + RecoveryWalkResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecoveryWalkResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecoveryWalkResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecoveryWalkResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecoveryWalkResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecoveryWalkResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecoveryWalkResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.cs index aa363de9d8e3..fb1bc3950bc9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RecoveryWalkResponse.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Response after calling a manual recovery walk. public partial class RecoveryWalkResponse { - /// Initializes a new instance of RecoveryWalkResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RecoveryWalkResponse() { } - /// Initializes a new instance of RecoveryWalkResponse. + /// Initializes a new instance of . /// Whether the recovery walk was performed. /// The next update domain that needs to be walked. Null means walk spanning all update domains has been completed. - internal RecoveryWalkResponse(bool? walkPerformed, int? nextPlatformUpdateDomain) + /// Keeps track of any properties unknown to the library. + internal RecoveryWalkResponse(bool? walkPerformed, int? nextPlatformUpdateDomain, Dictionary serializedAdditionalRawData) { WalkPerformed = walkPerformed; NextPlatformUpdateDomain = nextPlatformUpdateDomain; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether the recovery walk was performed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.Serialization.cs index 4da38d0de31d..4dbcf16a6239 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RegionalReplicationStatus + public partial class RegionalReplicationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RegionalReplicationStatus DeserializeRegionalReplicationStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RegionalReplicationStatus DeserializeRegionalReplicationStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static RegionalReplicationStatus DeserializeRegionalReplicationStatus(J Optional state = default; Optional details = default; Optional progress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("region"u8)) @@ -52,8 +81,61 @@ internal static RegionalReplicationStatus DeserializeRegionalReplicationStatus(J progress = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RegionalReplicationStatus(region.Value, Optional.ToNullable(state), details.Value, Optional.ToNullable(progress)); + return new RegionalReplicationStatus(region.Value, Optional.ToNullable(state), details.Value, Optional.ToNullable(progress), serializedAdditionalRawData); + } + + RegionalReplicationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionalReplicationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionalReplicationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionalReplicationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionalReplicationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionalReplicationStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionalReplicationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.cs index 2fc3e3d7062f..1881e8afe68c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalReplicationStatus.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the regional replication status. public partial class RegionalReplicationStatus { - /// Initializes a new instance of RegionalReplicationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RegionalReplicationStatus() { } - /// Initializes a new instance of RegionalReplicationStatus. + /// Initializes a new instance of . /// The region to which the gallery image version is being replicated to. /// This is the regional replication state. /// The details of the replication status. /// It indicates progress of the replication job. - internal RegionalReplicationStatus(string region, RegionalReplicationState? state, string details, int? progress) + /// Keeps track of any properties unknown to the library. + internal RegionalReplicationStatus(string region, RegionalReplicationState? state, string details, int? progress, Dictionary serializedAdditionalRawData) { Region = region; State = state; Details = details; Progress = progress; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The region to which the gallery image version is being replicated to. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.Serialization.cs index 843552a02d77..9e9acbb29c99 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.Serialization.cs @@ -5,15 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RegionalSharingStatus + public partial class RegionalSharingStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RegionalSharingStatus DeserializeRegionalSharingStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStringValue(Details); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RegionalSharingStatus DeserializeRegionalSharingStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +59,7 @@ internal static RegionalSharingStatus DeserializeRegionalSharingStatus(JsonEleme Optional region = default; Optional state = default; Optional details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("region"u8)) @@ -42,8 +81,61 @@ internal static RegionalSharingStatus DeserializeRegionalSharingStatus(JsonEleme details = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RegionalSharingStatus(region.Value, Optional.ToNullable(state), details.Value); + return new RegionalSharingStatus(region.Value, Optional.ToNullable(state), details.Value, serializedAdditionalRawData); + } + + RegionalSharingStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionalSharingStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionalSharingStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionalSharingStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionalSharingStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionalSharingStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionalSharingStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.cs index 97012a88d49a..c0b84b9ee928 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RegionalSharingStatus.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Gallery regional sharing status. public partial class RegionalSharingStatus { - /// Initializes a new instance of RegionalSharingStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RegionalSharingStatus() { } - /// Initializes a new instance of RegionalSharingStatus. + /// Initializes a new instance of . /// Region name. /// Gallery sharing state in current region. /// Details of gallery regional sharing failure. - internal RegionalSharingStatus(string region, SharingState? state, string details) + /// Keeps track of any properties unknown to the library. + internal RegionalSharingStatus(string region, SharingState? state, string details, Dictionary serializedAdditionalRawData) { Region = region; State = state; Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Region name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.Serialization.cs index 4f61a26d6ee6..6c0d1ddd40c4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ReplicationStatus + public partial class ReplicationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReplicationStatus DeserializeReplicationStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReplicationStatus DeserializeReplicationStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional aggregatedState = default; Optional> summary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("aggregatedState"u8)) @@ -46,8 +74,61 @@ internal static ReplicationStatus DeserializeReplicationStatus(JsonElement eleme summary = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReplicationStatus(Optional.ToNullable(aggregatedState), Optional.ToList(summary)); + return new ReplicationStatus(Optional.ToNullable(aggregatedState), Optional.ToList(summary), serializedAdditionalRawData); + } + + ReplicationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReplicationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReplicationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReplicationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReplicationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReplicationStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReplicationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.cs index 3dabd9b19670..f76c14fd5c87 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ReplicationStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// This is the replication status of the gallery image version. public partial class ReplicationStatus { - /// Initializes a new instance of ReplicationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReplicationStatus() { Summary = new ChangeTrackingList(); } - /// Initializes a new instance of ReplicationStatus. + /// Initializes a new instance of . /// This is the aggregated replication status based on all the regional replication status flags. /// This is a summary of replication status for each region. - internal ReplicationStatus(AggregatedReplicationState? aggregatedState, IReadOnlyList summary) + /// Keeps track of any properties unknown to the library. + internal ReplicationStatus(AggregatedReplicationState? aggregatedState, IReadOnlyList summary, Dictionary serializedAdditionalRawData) { AggregatedState = aggregatedState; Summary = summary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the aggregated replication status based on all the regional replication status flags. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.Serialization.cs index 6731e0febc49..f9574be7b9d0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RequestRateByIntervalContent : IUtf8JsonSerializable + public partial class RequestRateByIntervalContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("intervalLength"u8); writer.WriteStringValue(IntervalLength.ToSerialString()); @@ -48,7 +56,161 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("groupByUserAgent"u8); writer.WriteBooleanValue(GroupByUserAgent.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RequestRateByIntervalContent DeserializeRequestRateByIntervalContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IntervalInMins intervalLength = default; + Uri blobContainerSasUri = default; + DateTimeOffset fromTime = default; + DateTimeOffset toTime = default; + Optional groupByThrottlePolicy = default; + Optional groupByOperationName = default; + Optional groupByResourceName = default; + Optional groupByClientApplicationId = default; + Optional groupByUserAgent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("intervalLength"u8)) + { + intervalLength = property.Value.GetString().ToIntervalInMins(); + continue; + } + if (property.NameEquals("blobContainerSasUri"u8)) + { + blobContainerSasUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("fromTime"u8)) + { + fromTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("toTime"u8)) + { + toTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("groupByThrottlePolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByThrottlePolicy = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByOperationName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByOperationName = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByResourceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByResourceName = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByClientApplicationId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByClientApplicationId = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByUserAgent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByUserAgent = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RequestRateByIntervalContent(blobContainerSasUri, fromTime, toTime, Optional.ToNullable(groupByThrottlePolicy), Optional.ToNullable(groupByOperationName), Optional.ToNullable(groupByResourceName), Optional.ToNullable(groupByClientApplicationId), Optional.ToNullable(groupByUserAgent), intervalLength, serializedAdditionalRawData); + } + + RequestRateByIntervalContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRequestRateByIntervalContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RequestRateByIntervalContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRequestRateByIntervalContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RequestRateByIntervalContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RequestRateByIntervalContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRequestRateByIntervalContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.cs index b645e89a3ecf..adbb267a4cd3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RequestRateByIntervalContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Compute.Models /// Api request input for LogAnalytics getRequestRateByInterval Api. public partial class RequestRateByIntervalContent : LogAnalyticsInputBase { - /// Initializes a new instance of RequestRateByIntervalContent. + /// Initializes a new instance of . /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. /// From time of the query. /// To time of the query. @@ -26,6 +27,27 @@ public RequestRateByIntervalContent(Uri blobContainerSasUri, DateTimeOffset from IntervalLength = intervalLength; } + /// Initializes a new instance of . + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + /// From time of the query. + /// To time of the query. + /// Group query result by Throttle Policy applied. + /// Group query result by Operation Name. + /// Group query result by Resource Name. + /// Group query result by Client Application ID. + /// Group query result by User Agent. + /// Interval value in minutes used to create LogAnalytics call rate logs. + /// Keeps track of any properties unknown to the library. + internal RequestRateByIntervalContent(Uri blobContainerSasUri, DateTimeOffset fromTime, DateTimeOffset toTime, bool? groupByThrottlePolicy, bool? groupByOperationName, bool? groupByResourceName, bool? groupByClientApplicationId, bool? groupByUserAgent, IntervalInMins intervalLength, Dictionary serializedAdditionalRawData) : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent, serializedAdditionalRawData) + { + IntervalLength = intervalLength; + } + + /// Initializes a new instance of for deserialization. + internal RequestRateByIntervalContent() + { + } + /// Interval value in minutes used to create LogAnalytics call rate logs. public IntervalInMins IntervalLength { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.Serialization.cs index d97e2f758818..4bb7be78cd38 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.Serialization.cs @@ -6,15 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ResourceInstanceViewStatus + public partial class ResourceInstanceViewStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceInstanceViewStatus DeserializeResourceInstanceViewStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Level)) + { + writer.WritePropertyName("level"u8); + writer.WriteStringValue(Level.Value.ToSerialString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceInstanceViewStatus DeserializeResourceInstanceViewStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +56,7 @@ internal static ResourceInstanceViewStatus DeserializeResourceInstanceViewStatus Optional message = default; Optional time = default; Optional level = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -59,8 +92,61 @@ internal static ResourceInstanceViewStatus DeserializeResourceInstanceViewStatus level = property.Value.GetString().ToComputeStatusLevelType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceInstanceViewStatus(code.Value, displayStatus.Value, message.Value, Optional.ToNullable(time), Optional.ToNullable(level)); + return new ResourceInstanceViewStatus(code.Value, displayStatus.Value, message.Value, Optional.ToNullable(time), Optional.ToNullable(level), serializedAdditionalRawData); + } + + ResourceInstanceViewStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceInstanceViewStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceInstanceViewStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceInstanceViewStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceInstanceViewStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceInstanceViewStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceInstanceViewStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs index 1a8d20c7c59d..c828a2d91fc3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceInstanceViewStatus.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Instance view status. public partial class ResourceInstanceViewStatus { - /// Initializes a new instance of ResourceInstanceViewStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceInstanceViewStatus() { } - /// Initializes a new instance of ResourceInstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The short localizable label for the status. /// The detailed status message, including for alerts and error messages. /// The time of the status. /// The level code. - internal ResourceInstanceViewStatus(string code, string displayStatus, string message, DateTimeOffset? time, ComputeStatusLevelType? level) + /// Keeps track of any properties unknown to the library. + internal ResourceInstanceViewStatus(string code, string displayStatus, string message, DateTimeOffset? time, ComputeStatusLevelType? level, Dictionary serializedAdditionalRawData) { Code = code; DisplayStatus = displayStatus; Message = message; Time = time; Level = level; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status code. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.Serialization.cs index fda934edd0e9..ff46ec6889dd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ResourceRange : IUtf8JsonSerializable + public partial class ResourceRange : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Min)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("max"u8); writer.WriteNumberValue(Max.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceRange DeserializeResourceRange(JsonElement element) + internal static ResourceRange DeserializeResourceRange(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional min = default; Optional max = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("min"u8)) @@ -56,8 +79,61 @@ internal static ResourceRange DeserializeResourceRange(JsonElement element) max = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceRange(Optional.ToNullable(min), Optional.ToNullable(max), serializedAdditionalRawData); + } + + ResourceRange IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceRange(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceRange IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceRange(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceRange model) + { + if (model is null) + { + return null; } - return new ResourceRange(Optional.ToNullable(min), Optional.ToNullable(max)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceRange(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceRange(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.cs index 5f6778077b69..448df63c165c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceRange.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the resource range. public partial class ResourceRange { - /// Initializes a new instance of ResourceRange. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourceRange() { } - /// Initializes a new instance of ResourceRange. + /// Initializes a new instance of . /// The minimum number of the resource. /// The maximum number of the resource. - internal ResourceRange(int? min, int? max) + /// Keeps track of any properties unknown to the library. + internal ResourceRange(int? min, int? max, Dictionary serializedAdditionalRawData) { Min = min; Max = max; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum number of the resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.Serialization.cs index 1ecb088f67fa..e6a1b0fd5d02 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ResourceSkuCosts + public partial class ResourceSkuCosts : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceSkuCosts DeserializeResourceSkuCosts(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceSkuCosts DeserializeResourceSkuCosts(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ResourceSkuCosts DeserializeResourceSkuCosts(JsonElement element Optional meterId = default; Optional quantity = default; Optional extendedUnit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterID"u8)) @@ -42,8 +71,61 @@ internal static ResourceSkuCosts DeserializeResourceSkuCosts(JsonElement element extendedUnit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceSkuCosts(meterId.Value, Optional.ToNullable(quantity), extendedUnit.Value); + return new ResourceSkuCosts(meterId.Value, Optional.ToNullable(quantity), extendedUnit.Value, serializedAdditionalRawData); + } + + ResourceSkuCosts IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuCosts(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSkuCosts IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSkuCosts(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSkuCosts model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSkuCosts(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSkuCosts(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.cs index 2d87fb2feb90..dc95e50b7f8b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkuCosts.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes metadata for retrieving price info. public partial class ResourceSkuCosts { - /// Initializes a new instance of ResourceSkuCosts. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceSkuCosts() { } - /// Initializes a new instance of ResourceSkuCosts. + /// Initializes a new instance of . /// Used for querying price from commerce. /// The multiplier is needed to extend the base metered cost. /// An invariant to show the extended unit. - internal ResourceSkuCosts(string meterId, long? quantity, string extendedUnit) + /// Keeps track of any properties unknown to the library. + internal ResourceSkuCosts(string meterId, long? quantity, string extendedUnit, Dictionary serializedAdditionalRawData) { MeterId = meterId; Quantity = quantity; ExtendedUnit = extendedUnit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Used for querying price from commerce. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.Serialization.cs index 86b01f672870..52040ab56292 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class ResourceSkusResult + internal partial class ResourceSkusResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceSkusResult DeserializeResourceSkusResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceSkusResult DeserializeResourceSkusResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static ResourceSkusResult DeserializeResourceSkusResult(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceSkusResult(value, nextLink.Value); + return new ResourceSkusResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ResourceSkusResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkusResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSkusResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSkusResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSkusResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSkusResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSkusResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.cs index d38bf465b773..2781346aafb6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceSkusResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Resource Skus operation response. internal partial class ResourceSkusResult { - /// Initializes a new instance of ResourceSkusResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of skus available for the subscription. /// is null. internal ResourceSkusResult(IEnumerable value) @@ -25,13 +28,20 @@ internal ResourceSkusResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ResourceSkusResult. + /// Initializes a new instance of . /// The list of skus available for the subscription. /// The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus. - internal ResourceSkusResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ResourceSkusResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSkusResult() + { } /// The list of skus available for the subscription. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.Serialization.cs index 5ba969ba91ba..7d405b21d988 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.Serialization.cs @@ -5,22 +5,62 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class ResourceUriList + internal partial class ResourceUriList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceUriList DeserializeResourceUriList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceUriList DeserializeResourceUriList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +78,61 @@ internal static ResourceUriList DeserializeResourceUriList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceUriList(value, nextLink.Value); + return new ResourceUriList(value, nextLink.Value, serializedAdditionalRawData); + } + + ResourceUriList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceUriList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceUriList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceUriList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceUriList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceUriList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceUriList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.cs index a11388857c81..99e713e5ba7b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ResourceUriList.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List resources which are encrypted with the disk encryption set. internal partial class ResourceUriList { - /// Initializes a new instance of ResourceUriList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. /// is null. internal ResourceUriList(IEnumerable value) @@ -25,13 +28,20 @@ internal ResourceUriList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ResourceUriList. + /// Initializes a new instance of . /// A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. /// The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. - internal ResourceUriList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ResourceUriList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceUriList() + { } /// A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs index 8f36e2c87083..8f47035f8420 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs @@ -8,17 +8,23 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class RestorePointData : IUtf8JsonSerializable + public partial class RestorePointData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceMetadata)) { writer.WritePropertyName("sourceMetadata"u8); - writer.WriteObjectValue(SourceMetadata); + if (SourceMetadata is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceMetadata).Serialize(writer, options); + } } if (Optional.IsDefined(ConsistencyMode)) { @@ -53,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, SourceRestorePoint); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestorePointData DeserializeRestorePointData(JsonElement element) + internal static RestorePointData DeserializeRestorePointData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +100,7 @@ internal static RestorePointData DeserializeRestorePointData(JsonElement element Optional timeCreated = default; Optional sourceRestorePoint = default; Optional instanceView = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -175,8 +203,61 @@ internal static RestorePointData DeserializeRestorePointData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointData(id, name, type, systemData.Value, Optional.ToList(excludeDisks), sourceMetadata.Value, provisioningState.Value, Optional.ToNullable(consistencyMode), Optional.ToNullable(timeCreated), sourceRestorePoint, instanceView.Value, serializedAdditionalRawData); + } + + RestorePointData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointData(Response response) + { + if (response is null) + { + return null; } - return new RestorePointData(id, name, type, systemData.Value, Optional.ToList(excludeDisks), sourceMetadata.Value, provisioningState.Value, Optional.ToNullable(consistencyMode), Optional.ToNullable(timeCreated), sourceRestorePoint, instanceView.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.Serialization.cs index d5bcbd70592c..a856ae5cb090 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointEncryption : IUtf8JsonSerializable + public partial class RestorePointEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskEncryptionSet)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(EncryptionType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestorePointEncryption DeserializeRestorePointEncryption(JsonElement element) + internal static RestorePointEncryption DeserializeRestorePointEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskEncryptionSet = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskEncryptionSet"u8)) @@ -57,8 +80,61 @@ internal static RestorePointEncryption DeserializeRestorePointEncryption(JsonEle type = new RestorePointEncryptionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointEncryption(diskEncryptionSet, Optional.ToNullable(type), serializedAdditionalRawData); + } + + RestorePointEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointEncryption model) + { + if (model is null) + { + return null; } - return new RestorePointEncryption(diskEncryptionSet, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointEncryption(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.cs index 81b6213a65db..1fa0a0b46146 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointEncryption.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,18 +15,23 @@ namespace Azure.ResourceManager.Compute.Models /// Encryption at rest settings for disk restore point. It is an optional property that can be specified in the input while creating a restore point. public partial class RestorePointEncryption { - /// Initializes a new instance of RestorePointEncryption. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointEncryption() { } - /// Initializes a new instance of RestorePointEncryption. + /// Initializes a new instance of . /// Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. **Note:** The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. /// The type of key used to encrypt the data of the disk restore point. - internal RestorePointEncryption(WritableSubResource diskEncryptionSet, RestorePointEncryptionType? encryptionType) + /// Keeps track of any properties unknown to the library. + internal RestorePointEncryption(WritableSubResource diskEncryptionSet, RestorePointEncryptionType? encryptionType, Dictionary serializedAdditionalRawData) { DiskEncryptionSet = diskEncryptionSet; EncryptionType = encryptionType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. **Note:** The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupData.Serialization.cs index 8045ae7c8593..bef6a1f9b7da 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class RestorePointGroupData : IUtf8JsonSerializable + public partial class RestorePointGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,14 +43,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestorePointGroupData DeserializeRestorePointGroupData(JsonElement element) + internal static RestorePointGroupData DeserializeRestorePointGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static RestorePointGroupData DeserializeRestorePointGroupData(JsonEleme Optional provisioningState = default; Optional restorePointGroupId = default; Optional> restorePoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -148,8 +177,61 @@ internal static RestorePointGroupData DeserializeRestorePointGroupData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, source.Value, provisioningState.Value, restorePointGroupId.Value, Optional.ToList(restorePoints), serializedAdditionalRawData); + } + + RestorePointGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointGroupData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointGroupData(Response response) + { + if (response is null) + { + return null; } - return new RestorePointGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, source.Value, provisioningState.Value, restorePointGroupId.Value, Optional.ToList(restorePoints)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.Serialization.cs index a4ddc0cbcda3..b2d6f77149da 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class RestorePointGroupListResult + internal partial class RestorePointGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorePointGroupListResult DeserializeRestorePointGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorePointGroupListResult DeserializeRestorePointGroupListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RestorePointGroupListResult DeserializeRestorePointGroupListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorePointGroupListResult(Optional.ToList(value), nextLink.Value); + return new RestorePointGroupListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RestorePointGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.cs index ad0c8d444381..0276a157a19a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// The List restore point collection operation response. internal partial class RestorePointGroupListResult { - /// Initializes a new instance of RestorePointGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorePointGroupListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorePointGroupListResult. + /// Initializes a new instance of . /// Gets the list of restore point collections. /// The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections. - internal RestorePointGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RestorePointGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the list of restore point collections. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.Serialization.cs index fddf8429a06e..12f5d82cda91 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointGroupPatch : IUtf8JsonSerializable + public partial class RestorePointGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -31,10 +40,161 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RestorePointGroupPatch DeserializeRestorePointGroupPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional source = default; + Optional provisioningState = default; + Optional restorePointGroupId = default; + Optional> restorePoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("source"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = RestorePointGroupSource.DeserializeRestorePointGroupSource(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("restorePointCollectionId"u8)) + { + restorePointGroupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("restorePoints"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RestorePointData.DeserializeRestorePointData(item)); + } + restorePoints = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointGroupPatch(Optional.ToDictionary(tags), source.Value, provisioningState.Value, restorePointGroupId.Value, Optional.ToList(restorePoints), serializedAdditionalRawData); + } + + RestorePointGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointGroupPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.cs index 029c094460f3..c65b9ce25a4a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,12 +15,27 @@ namespace Azure.ResourceManager.Compute.Models /// Update Restore Point collection parameters. public partial class RestorePointGroupPatch : ComputeResourcePatch { - /// Initializes a new instance of RestorePointGroupPatch. + /// Initializes a new instance of . public RestorePointGroupPatch() { RestorePoints = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// The properties of the source resource that this restore point collection is created from. + /// The provisioning state of the restore point collection. + /// The unique id of the restore point collection. + /// A list containing all restore points created under this restore point collection. + /// Keeps track of any properties unknown to the library. + internal RestorePointGroupPatch(IDictionary tags, RestorePointGroupSource source, string provisioningState, string restorePointGroupId, IReadOnlyList restorePoints, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Source = source; + ProvisioningState = provisioningState; + RestorePointGroupId = restorePointGroupId; + RestorePoints = restorePoints; + } + /// The properties of the source resource that this restore point collection is created from. public RestorePointGroupSource Source { get; set; } /// The provisioning state of the restore point collection. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.Serialization.cs index d5784380a043..1ee5106c990f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointGroupSource : IUtf8JsonSerializable + public partial class RestorePointGroupSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestorePointGroupSource DeserializeRestorePointGroupSource(JsonElement element) + internal static RestorePointGroupSource DeserializeRestorePointGroupSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional location = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -51,8 +74,61 @@ internal static RestorePointGroupSource DeserializeRestorePointGroupSource(JsonE id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointGroupSource(Optional.ToNullable(location), id.Value, serializedAdditionalRawData); + } + + RestorePointGroupSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointGroupSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointGroupSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointGroupSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointGroupSource model) + { + if (model is null) + { + return null; } - return new RestorePointGroupSource(Optional.ToNullable(location), id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointGroupSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointGroupSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.cs index 1971dcba6162..3df8dd90b211 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointGroupSource.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Compute.Models /// The properties of the source resource that this restore point collection is created from. public partial class RestorePointGroupSource { - /// Initializes a new instance of RestorePointGroupSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointGroupSource() { } - /// Initializes a new instance of RestorePointGroupSource. + /// Initializes a new instance of . /// Location of the source resource used to create this restore point collection. /// Resource Id of the source resource used to create this restore point collection. - internal RestorePointGroupSource(AzureLocation? location, ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal RestorePointGroupSource(AzureLocation? location, ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Location = location; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of the source resource used to create this restore point collection. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.Serialization.cs index 5a65ad73c5dc..669fc69e87c8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.Serialization.cs @@ -5,22 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointInstanceView + public partial class RestorePointInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorePointInstanceView DeserializeRestorePointInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(DiskRestorePoints)) + { + writer.WritePropertyName("diskRestorePoints"u8); + writer.WriteStartArray(); + foreach (var item in DiskRestorePoints) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorePointInstanceView DeserializeRestorePointInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> diskRestorePoints = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskRestorePoints"u8)) @@ -51,8 +113,61 @@ internal static RestorePointInstanceView DeserializeRestorePointInstanceView(Jso statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorePointInstanceView(Optional.ToList(diskRestorePoints), Optional.ToList(statuses)); + return new RestorePointInstanceView(Optional.ToList(diskRestorePoints), Optional.ToList(statuses), serializedAdditionalRawData); + } + + RestorePointInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.cs index b93f6e63f1ec..e39b426e148e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a restore point. public partial class RestorePointInstanceView { - /// Initializes a new instance of RestorePointInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorePointInstanceView() { DiskRestorePoints = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of RestorePointInstanceView. + /// Initializes a new instance of . /// The disk restore points information. /// The resource status information. - internal RestorePointInstanceView(IReadOnlyList diskRestorePoints, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal RestorePointInstanceView(IReadOnlyList diskRestorePoints, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { DiskRestorePoints = diskRestorePoints; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The disk restore points information. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.Serialization.cs index ed709e0b9ff8..b0b881492c41 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.Serialization.cs @@ -5,26 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointSourceMetadata : IUtf8JsonSerializable + public partial class RestorePointSourceMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RestorePointSourceMetadata DeserializeRestorePointSourceMetadata(JsonElement element) + internal static RestorePointSourceMetadata DeserializeRestorePointSourceMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static RestorePointSourceMetadata DeserializeRestorePointSourceMetadata Optional location = default; Optional userData = default; Optional hyperVGeneration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hardwareProfile"u8)) @@ -119,8 +149,61 @@ internal static RestorePointSourceMetadata DeserializeRestorePointSourceMetadata hyperVGeneration = new HyperVGeneration(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointSourceMetadata(hardwareProfile.Value, storageProfile.Value, osProfile.Value, diagnosticsProfile.Value, licenseType.Value, vmId.Value, securityProfile.Value, Optional.ToNullable(location), userData.Value, Optional.ToNullable(hyperVGeneration), serializedAdditionalRawData); + } + + RestorePointSourceMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointSourceMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointSourceMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointSourceMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointSourceMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointSourceMetadata(Response response) + { + if (response is null) + { + return null; } - return new RestorePointSourceMetadata(hardwareProfile.Value, storageProfile.Value, osProfile.Value, diagnosticsProfile.Value, licenseType.Value, vmId.Value, securityProfile.Value, Optional.ToNullable(location), userData.Value, Optional.ToNullable(hyperVGeneration)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointSourceMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.cs index d613f3a06181..49e9fb0cbddf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceMetadata.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,12 +14,15 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of the Virtual Machine for which the restore point was created. The properties provided are a subset and the snapshot of the overall Virtual Machine properties captured at the time of the restore point creation. public partial class RestorePointSourceMetadata { - /// Initializes a new instance of RestorePointSourceMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointSourceMetadata() { } - /// Initializes a new instance of RestorePointSourceMetadata. + /// Initializes a new instance of . /// Gets the hardware profile. /// Gets the storage profile. /// Gets the OS profile. @@ -28,7 +33,8 @@ public RestorePointSourceMetadata() /// Location of the VM from which the restore point was created. /// UserData associated with the source VM for which restore point is captured, which is a base-64 encoded value. /// HyperVGeneration of the source VM for which restore point is captured. - internal RestorePointSourceMetadata(VirtualMachineHardwareProfile hardwareProfile, RestorePointSourceVmStorageProfile storageProfile, VirtualMachineOSProfile osProfile, DiagnosticsProfile diagnosticsProfile, string licenseType, string vmId, SecurityProfile securityProfile, AzureLocation? location, string userData, HyperVGeneration? hyperVGeneration) + /// Keeps track of any properties unknown to the library. + internal RestorePointSourceMetadata(VirtualMachineHardwareProfile hardwareProfile, RestorePointSourceVmStorageProfile storageProfile, VirtualMachineOSProfile osProfile, DiagnosticsProfile diagnosticsProfile, string licenseType, string vmId, SecurityProfile securityProfile, AzureLocation? location, string userData, HyperVGeneration? hyperVGeneration, Dictionary serializedAdditionalRawData) { HardwareProfile = hardwareProfile; StorageProfile = storageProfile; @@ -40,6 +46,7 @@ internal RestorePointSourceMetadata(VirtualMachineHardwareProfile hardwareProfil Location = location; UserData = userData; HyperVGeneration = hyperVGeneration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the hardware profile. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.Serialization.cs index 376e3b375f4c..c84f99366c7b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.Serialization.cs @@ -5,31 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointSourceVmDataDisk : IUtf8JsonSerializable + public partial class RestorePointSourceVmDataDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(DiskRestorePoint)) { writer.WritePropertyName("diskRestorePoint"u8); - writer.WriteObjectValue(DiskRestorePoint); + if (DiskRestorePoint is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskRestorePoint).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RestorePointSourceVmDataDisk DeserializeRestorePointSourceVmDataDisk(JsonElement element) + internal static RestorePointSourceVmDataDisk DeserializeRestorePointSourceVmDataDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +77,7 @@ internal static RestorePointSourceVmDataDisk DeserializeRestorePointSourceVmData Optional managedDisk = default; Optional diskRestorePoint = default; Optional writeAcceleratorEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -102,8 +139,61 @@ internal static RestorePointSourceVmDataDisk DeserializeRestorePointSourceVmData writeAcceleratorEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointSourceVmDataDisk(Optional.ToNullable(lun), name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value, Optional.ToNullable(writeAcceleratorEnabled), serializedAdditionalRawData); + } + + RestorePointSourceVmDataDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointSourceVmDataDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointSourceVmDataDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointSourceVmDataDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointSourceVmDataDisk model) + { + if (model is null) + { + return null; } - return new RestorePointSourceVmDataDisk(Optional.ToNullable(lun), name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value, Optional.ToNullable(writeAcceleratorEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointSourceVmDataDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointSourceVmDataDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.cs index 6d503f430fe5..2d698e967445 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmDataDisk.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes a data disk. public partial class RestorePointSourceVmDataDisk { - /// Initializes a new instance of RestorePointSourceVmDataDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointSourceVmDataDisk() { } - /// Initializes a new instance of RestorePointSourceVmDataDisk. + /// Initializes a new instance of . /// Gets the logical unit number. /// Gets the disk name. /// Gets the caching type. @@ -23,7 +29,8 @@ public RestorePointSourceVmDataDisk() /// Contains the managed disk details. /// Contains Disk Restore Point properties. /// Shows true if the disk is write-accelerator enabled. - internal RestorePointSourceVmDataDisk(int? lun, string name, CachingType? caching, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, DiskRestorePointAttributes diskRestorePoint, bool? writeAcceleratorEnabled) + /// Keeps track of any properties unknown to the library. + internal RestorePointSourceVmDataDisk(int? lun, string name, CachingType? caching, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, DiskRestorePointAttributes diskRestorePoint, bool? writeAcceleratorEnabled, Dictionary serializedAdditionalRawData) { Lun = lun; Name = name; @@ -32,6 +39,7 @@ internal RestorePointSourceVmDataDisk(int? lun, string name, CachingType? cachin ManagedDisk = managedDisk; DiskRestorePoint = diskRestorePoint; WriteAcceleratorEnabled = writeAcceleratorEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the logical unit number. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.Serialization.cs index 56b5e0eec073..2a7ba1418f2a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.Serialization.cs @@ -5,31 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointSourceVmOSDisk : IUtf8JsonSerializable + public partial class RestorePointSourceVmOSDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(DiskRestorePoint)) { writer.WritePropertyName("diskRestorePoint"u8); - writer.WriteObjectValue(DiskRestorePoint); + if (DiskRestorePoint is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskRestorePoint).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RestorePointSourceVmOSDisk DeserializeRestorePointSourceVmOSDisk(JsonElement element) + internal static RestorePointSourceVmOSDisk DeserializeRestorePointSourceVmOSDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static RestorePointSourceVmOSDisk DeserializeRestorePointSourceVmOSDisk Optional managedDisk = default; Optional diskRestorePoint = default; Optional writeAcceleratorEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType"u8)) @@ -112,8 +149,61 @@ internal static RestorePointSourceVmOSDisk DeserializeRestorePointSourceVmOSDisk writeAcceleratorEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointSourceVmOSDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value, Optional.ToNullable(writeAcceleratorEnabled), serializedAdditionalRawData); + } + + RestorePointSourceVmOSDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointSourceVmOSDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointSourceVmOSDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointSourceVmOSDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointSourceVmOSDisk model) + { + if (model is null) + { + return null; } - return new RestorePointSourceVmOSDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value, Optional.ToNullable(writeAcceleratorEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointSourceVmOSDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointSourceVmOSDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.cs index 46a3be19c237..e25b742dc09b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmOSDisk.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes an Operating System disk. public partial class RestorePointSourceVmOSDisk { - /// Initializes a new instance of RestorePointSourceVmOSDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointSourceVmOSDisk() { } - /// Initializes a new instance of RestorePointSourceVmOSDisk. + /// Initializes a new instance of . /// Gets the Operating System type. /// Gets the disk encryption settings. /// Gets the disk name. @@ -24,7 +30,8 @@ public RestorePointSourceVmOSDisk() /// Gets the managed disk details. /// Contains Disk Restore Point properties. /// Shows true if the disk is write-accelerator enabled. - internal RestorePointSourceVmOSDisk(OperatingSystemType? osType, DiskEncryptionSettings encryptionSettings, string name, CachingType? caching, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, DiskRestorePointAttributes diskRestorePoint, bool? writeAcceleratorEnabled) + /// Keeps track of any properties unknown to the library. + internal RestorePointSourceVmOSDisk(OperatingSystemType? osType, DiskEncryptionSettings encryptionSettings, string name, CachingType? caching, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, DiskRestorePointAttributes diskRestorePoint, bool? writeAcceleratorEnabled, Dictionary serializedAdditionalRawData) { OSType = osType; EncryptionSettings = encryptionSettings; @@ -34,6 +41,7 @@ internal RestorePointSourceVmOSDisk(OperatingSystemType? osType, DiskEncryptionS ManagedDisk = managedDisk; DiskRestorePoint = diskRestorePoint; WriteAcceleratorEnabled = writeAcceleratorEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the Operating System type. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.Serialization.cs index ea3c288fbbbc..6bcd3e587f2b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RestorePointSourceVmStorageProfile : IUtf8JsonSerializable + public partial class RestorePointSourceVmStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OSDisk)) { writer.WritePropertyName("osDisk"u8); - writer.WriteObjectValue(OSDisk); + if (OSDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDisk).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDiskList)) { @@ -27,21 +41,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDiskList) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestorePointSourceVmStorageProfile DeserializeRestorePointSourceVmStorageProfile(JsonElement element) + internal static RestorePointSourceVmStorageProfile DeserializeRestorePointSourceVmStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional osDisk = default; Optional> dataDisks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osDisk"u8)) @@ -67,8 +103,61 @@ internal static RestorePointSourceVmStorageProfile DeserializeRestorePointSource dataDisks = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorePointSourceVmStorageProfile(osDisk.Value, Optional.ToList(dataDisks), serializedAdditionalRawData); + } + + RestorePointSourceVmStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorePointSourceVmStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorePointSourceVmStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorePointSourceVmStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorePointSourceVmStorageProfile model) + { + if (model is null) + { + return null; } - return new RestorePointSourceVmStorageProfile(osDisk.Value, Optional.ToList(dataDisks)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorePointSourceVmStorageProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorePointSourceVmStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.cs index e1445a702a4a..070d33577cd3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the storage profile. public partial class RestorePointSourceVmStorageProfile { - /// Initializes a new instance of RestorePointSourceVmStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointSourceVmStorageProfile() { DataDiskList = new ChangeTrackingList(); } - /// Initializes a new instance of RestorePointSourceVmStorageProfile. + /// Initializes a new instance of . /// Gets the OS disk of the VM captured at the time of the restore point creation. /// Gets the data disks of the VM captured at the time of the restore point creation. - internal RestorePointSourceVmStorageProfile(RestorePointSourceVmOSDisk osDisk, IList dataDiskList) + /// Keeps track of any properties unknown to the library. + internal RestorePointSourceVmStorageProfile(RestorePointSourceVmOSDisk osDisk, IList dataDiskList, Dictionary serializedAdditionalRawData) { OSDisk = osDisk; DataDiskList = dataDiskList; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the OS disk of the VM captured at the time of the restore point creation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.Serialization.cs index 84ca60278d0a..932f775bf9d1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RetrieveBootDiagnosticsDataResult + public partial class RetrieveBootDiagnosticsDataResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RetrieveBootDiagnosticsDataResult DeserializeRetrieveBootDiagnosticsDataResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RetrieveBootDiagnosticsDataResult DeserializeRetrieveBootDiagnosticsDataResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional consoleScreenshotBlobUri = default; Optional serialConsoleLogBlobUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("consoleScreenshotBlobUri"u8)) @@ -41,8 +69,61 @@ internal static RetrieveBootDiagnosticsDataResult DeserializeRetrieveBootDiagnos serialConsoleLogBlobUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RetrieveBootDiagnosticsDataResult(consoleScreenshotBlobUri.Value, serialConsoleLogBlobUri.Value); + return new RetrieveBootDiagnosticsDataResult(consoleScreenshotBlobUri.Value, serialConsoleLogBlobUri.Value, serializedAdditionalRawData); + } + + RetrieveBootDiagnosticsDataResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRetrieveBootDiagnosticsDataResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RetrieveBootDiagnosticsDataResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRetrieveBootDiagnosticsDataResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RetrieveBootDiagnosticsDataResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RetrieveBootDiagnosticsDataResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRetrieveBootDiagnosticsDataResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs index 45d2a64a195d..1fe591bb0c5b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RetrieveBootDiagnosticsDataResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// The SAS URIs of the console screenshot and serial log blobs. public partial class RetrieveBootDiagnosticsDataResult { - /// Initializes a new instance of RetrieveBootDiagnosticsDataResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RetrieveBootDiagnosticsDataResult() { } - /// Initializes a new instance of RetrieveBootDiagnosticsDataResult. + /// Initializes a new instance of . /// The console screenshot blob URI. /// The serial console log blob URI. - internal RetrieveBootDiagnosticsDataResult(Uri consoleScreenshotBlobUri, Uri serialConsoleLogBlobUri) + /// Keeps track of any properties unknown to the library. + internal RetrieveBootDiagnosticsDataResult(Uri consoleScreenshotBlobUri, Uri serialConsoleLogBlobUri, Dictionary serializedAdditionalRawData) { ConsoleScreenshotBlobUri = consoleScreenshotBlobUri; SerialConsoleLogBlobUri = serialConsoleLogBlobUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The console screenshot blob URI. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.Serialization.cs index adbda3772b2c..812fcfe45bc2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class RoleInstanceListResult + internal partial class RoleInstanceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleInstanceListResult DeserializeRoleInstanceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleInstanceListResult DeserializeRoleInstanceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static RoleInstanceListResult DeserializeRoleInstanceListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleInstanceListResult(value, nextLink.Value); + return new RoleInstanceListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + RoleInstanceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleInstanceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleInstanceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleInstanceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleInstanceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleInstanceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleInstanceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.cs index bacbf5167ae7..8e9fa42139ed 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list operation result. internal partial class RoleInstanceListResult { - /// Initializes a new instance of RoleInstanceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of resources. /// is null. internal RoleInstanceListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal RoleInstanceListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RoleInstanceListResult. + /// Initializes a new instance of . /// The list of resources. /// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null to fetch all the resources. - internal RoleInstanceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleInstanceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RoleInstanceListResult() + { } /// The list of resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs index 03d5a1096cfd..e516a444139e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - internal partial class RoleInstanceNetworkProfile + internal partial class RoleInstanceNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleInstanceNetworkProfile DeserializeRoleInstanceNetworkProfile(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleInstanceNetworkProfile DeserializeRoleInstanceNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> networkInterfaces = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces"u8)) @@ -37,8 +65,61 @@ internal static RoleInstanceNetworkProfile DeserializeRoleInstanceNetworkProfile networkInterfaces = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleInstanceNetworkProfile(Optional.ToList(networkInterfaces)); + return new RoleInstanceNetworkProfile(Optional.ToList(networkInterfaces), serializedAdditionalRawData); + } + + RoleInstanceNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleInstanceNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleInstanceNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleInstanceNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleInstanceNetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleInstanceNetworkProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleInstanceNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs index b4376dece93b..1bf6096f14db 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the network profile for the role instance. internal partial class RoleInstanceNetworkProfile { - /// Initializes a new instance of RoleInstanceNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleInstanceNetworkProfile() { NetworkInterfaces = new ChangeTrackingList(); } - /// Initializes a new instance of RoleInstanceNetworkProfile. + /// Initializes a new instance of . /// Specifies the list of resource Ids for the network interfaces associated with the role instance. - internal RoleInstanceNetworkProfile(IReadOnlyList networkInterfaces) + /// Keeps track of any properties unknown to the library. + internal RoleInstanceNetworkProfile(IReadOnlyList networkInterfaces, Dictionary serializedAdditionalRawData) { NetworkInterfaces = networkInterfaces; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the list of resource Ids for the network interfaces associated with the role instance. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.Serialization.cs index d94ad549d9e0..f56f047eec26 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RoleInstanceView + public partial class RoleInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleInstanceView DeserializeRoleInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleInstanceView DeserializeRoleInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static RoleInstanceView DeserializeRoleInstanceView(JsonElement element Optional platformFaultDomain = default; Optional privateId = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("platformUpdateDomain"u8)) @@ -62,8 +90,61 @@ internal static RoleInstanceView DeserializeRoleInstanceView(JsonElement element statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), privateId.Value, Optional.ToList(statuses)); + return new RoleInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), privateId.Value, Optional.ToList(statuses), serializedAdditionalRawData); + } + + RoleInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.cs index 17d846e28abc..40b24940e663 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of the role instance. public partial class RoleInstanceView { - /// Initializes a new instance of RoleInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleInstanceView() { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of RoleInstanceView. + /// Initializes a new instance of . /// The Update Domain. /// The Fault Domain. /// Specifies a unique identifier generated internally for the cloud service associated with this role instance. <br /><br /> NOTE: If you are using Azure Diagnostics extension, this property can be used as 'DeploymentId' for querying details. /// - internal RoleInstanceView(int? platformUpdateDomain, int? platformFaultDomain, string privateId, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal RoleInstanceView(int? platformUpdateDomain, int? platformFaultDomain, string privateId, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { PlatformUpdateDomain = platformUpdateDomain; PlatformFaultDomain = platformFaultDomain; PrivateId = privateId; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Update Domain. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.Serialization.cs index 0317b755fbb8..3f4995a9bf41 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RoleInstances : IUtf8JsonSerializable + public partial class RoleInstances : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("roleInstances"u8); writer.WriteStartArray(); @@ -22,7 +30,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RoleInstances DeserializeRoleInstances(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList roleInstances = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("roleInstances"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleInstances = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleInstances(roleInstances, serializedAdditionalRawData); + } + + RoleInstances IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleInstances(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleInstances IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleInstances(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleInstances model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleInstances(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleInstances(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.cs index 1d909a024a44..673ea857f34d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstances.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies a list of role instances from the cloud service. public partial class RoleInstances { - /// Initializes a new instance of RoleInstances. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of cloud service role instance names. Value of '*' will signify all role instances of the cloud service. /// is null. public RoleInstances(IEnumerable roleInstancesValue) @@ -25,6 +28,20 @@ public RoleInstances(IEnumerable roleInstancesValue) RoleInstancesValue = roleInstancesValue.ToList(); } + /// Initializes a new instance of . + /// List of cloud service role instance names. Value of '*' will signify all role instances of the cloud service. + /// Keeps track of any properties unknown to the library. + internal RoleInstances(IList roleInstancesValue, Dictionary serializedAdditionalRawData) + { + RoleInstancesValue = roleInstancesValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RoleInstances() + { + } + /// List of cloud service role instance names. Value of '*' will signify all role instances of the cloud service. public IList RoleInstancesValue { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.Serialization.cs index 9e9e8540ab40..07c4522f1577 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RollbackStatusInfo + public partial class RollbackStatusInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RollbackStatusInfo DeserializeRollbackStatusInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RollbackStatusInfo DeserializeRollbackStatusInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static RollbackStatusInfo DeserializeRollbackStatusInfo(JsonElement ele Optional successfullyRolledbackInstanceCount = default; Optional failedRolledbackInstanceCount = default; Optional rollbackError = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("successfullyRolledbackInstanceCount"u8)) @@ -50,8 +79,61 @@ internal static RollbackStatusInfo DeserializeRollbackStatusInfo(JsonElement ele rollbackError = ComputeApiError.DeserializeComputeApiError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RollbackStatusInfo(Optional.ToNullable(successfullyRolledbackInstanceCount), Optional.ToNullable(failedRolledbackInstanceCount), rollbackError.Value); + return new RollbackStatusInfo(Optional.ToNullable(successfullyRolledbackInstanceCount), Optional.ToNullable(failedRolledbackInstanceCount), rollbackError.Value, serializedAdditionalRawData); + } + + RollbackStatusInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRollbackStatusInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RollbackStatusInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRollbackStatusInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RollbackStatusInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RollbackStatusInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRollbackStatusInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.cs index a0bc2c538ad4..0f1e45eccdcc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollbackStatusInfo.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Information about rollback on failed VM instances after a OS Upgrade operation. public partial class RollbackStatusInfo { - /// Initializes a new instance of RollbackStatusInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RollbackStatusInfo() { } - /// Initializes a new instance of RollbackStatusInfo. + /// Initializes a new instance of . /// The number of instances which have been successfully rolled back. /// The number of instances which failed to rollback. /// Error details if OS rollback failed. - internal RollbackStatusInfo(int? successfullyRolledbackInstanceCount, int? failedRolledbackInstanceCount, ComputeApiError rollbackError) + /// Keeps track of any properties unknown to the library. + internal RollbackStatusInfo(int? successfullyRolledbackInstanceCount, int? failedRolledbackInstanceCount, ComputeApiError rollbackError, Dictionary serializedAdditionalRawData) { SuccessfullyRolledbackInstanceCount = successfullyRolledbackInstanceCount; FailedRolledbackInstanceCount = failedRolledbackInstanceCount; RollbackError = rollbackError; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of instances which have been successfully rolled back. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.Serialization.cs index 2b0d20ba3e0a..2538bf1323a6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RollingUpgradePolicy : IUtf8JsonSerializable + public partial class RollingUpgradePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaxBatchInstancePercent)) { @@ -55,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxSurge"u8); writer.WriteBooleanValue(IsMaxSurgeEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RollingUpgradePolicy DeserializeRollingUpgradePolicy(JsonElement element) + internal static RollingUpgradePolicy DeserializeRollingUpgradePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +94,7 @@ internal static RollingUpgradePolicy DeserializeRollingUpgradePolicy(JsonElement Optional prioritizeUnhealthyInstances = default; Optional rollbackFailedInstancesOnPolicyBreach = default; Optional maxSurge = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("maxBatchInstancePercent"u8)) @@ -142,8 +165,61 @@ internal static RollingUpgradePolicy DeserializeRollingUpgradePolicy(JsonElement maxSurge = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RollingUpgradePolicy(Optional.ToNullable(maxBatchInstancePercent), Optional.ToNullable(maxUnhealthyInstancePercent), Optional.ToNullable(maxUnhealthyUpgradedInstancePercent), pauseTimeBetweenBatches.Value, Optional.ToNullable(enableCrossZoneUpgrade), Optional.ToNullable(prioritizeUnhealthyInstances), Optional.ToNullable(rollbackFailedInstancesOnPolicyBreach), Optional.ToNullable(maxSurge), serializedAdditionalRawData); + } + + RollingUpgradePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRollingUpgradePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RollingUpgradePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRollingUpgradePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RollingUpgradePolicy model) + { + if (model is null) + { + return null; } - return new RollingUpgradePolicy(Optional.ToNullable(maxBatchInstancePercent), Optional.ToNullable(maxUnhealthyInstancePercent), Optional.ToNullable(maxUnhealthyUpgradedInstancePercent), pauseTimeBetweenBatches.Value, Optional.ToNullable(enableCrossZoneUpgrade), Optional.ToNullable(prioritizeUnhealthyInstances), Optional.ToNullable(rollbackFailedInstancesOnPolicyBreach), Optional.ToNullable(maxSurge)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RollingUpgradePolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRollingUpgradePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.cs index 30475d6bbb08..0d5917b7ddfa 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradePolicy.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The configuration parameters used while performing a rolling upgrade. public partial class RollingUpgradePolicy { - /// Initializes a new instance of RollingUpgradePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RollingUpgradePolicy() { } - /// Initializes a new instance of RollingUpgradePolicy. + /// Initializes a new instance of . /// The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%. /// The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The default value for this parameter is 20%. /// The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. @@ -24,7 +30,8 @@ public RollingUpgradePolicy() /// Upgrade all unhealthy instances in a scale set before any healthy instances. /// Rollback failed instances to previous model if the Rolling Upgrade policy is violated. /// Create new virtual machines to upgrade the scale set, rather than updating the existing virtual machines. Existing virtual machines will be deleted once the new virtual machines are created for each batch. - internal RollingUpgradePolicy(int? maxBatchInstancePercent, int? maxUnhealthyInstancePercent, int? maxUnhealthyUpgradedInstancePercent, string pauseTimeBetweenBatches, bool? enableCrossZoneUpgrade, bool? prioritizeUnhealthyInstances, bool? rollbackFailedInstancesOnPolicyBreach, bool? isMaxSurgeEnabled) + /// Keeps track of any properties unknown to the library. + internal RollingUpgradePolicy(int? maxBatchInstancePercent, int? maxUnhealthyInstancePercent, int? maxUnhealthyUpgradedInstancePercent, string pauseTimeBetweenBatches, bool? enableCrossZoneUpgrade, bool? prioritizeUnhealthyInstances, bool? rollbackFailedInstancesOnPolicyBreach, bool? isMaxSurgeEnabled, Dictionary serializedAdditionalRawData) { MaxBatchInstancePercent = maxBatchInstancePercent; MaxUnhealthyInstancePercent = maxUnhealthyInstancePercent; @@ -34,6 +41,7 @@ internal RollingUpgradePolicy(int? maxBatchInstancePercent, int? maxUnhealthyIns PrioritizeUnhealthyInstances = prioritizeUnhealthyInstances; RollbackFailedInstancesOnPolicyBreach = rollbackFailedInstancesOnPolicyBreach; IsMaxSurgeEnabled = isMaxSurgeEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.Serialization.cs index 3f72497dd5ae..48869e387766 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RollingUpgradeProgressInfo + public partial class RollingUpgradeProgressInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RollingUpgradeProgressInfo DeserializeRollingUpgradeProgressInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RollingUpgradeProgressInfo DeserializeRollingUpgradeProgressInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static RollingUpgradeProgressInfo DeserializeRollingUpgradeProgressInfo Optional failedInstanceCount = default; Optional inProgressInstanceCount = default; Optional pendingInstanceCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("successfulInstanceCount"u8)) @@ -60,8 +89,61 @@ internal static RollingUpgradeProgressInfo DeserializeRollingUpgradeProgressInfo pendingInstanceCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RollingUpgradeProgressInfo(Optional.ToNullable(successfulInstanceCount), Optional.ToNullable(failedInstanceCount), Optional.ToNullable(inProgressInstanceCount), Optional.ToNullable(pendingInstanceCount)); + return new RollingUpgradeProgressInfo(Optional.ToNullable(successfulInstanceCount), Optional.ToNullable(failedInstanceCount), Optional.ToNullable(inProgressInstanceCount), Optional.ToNullable(pendingInstanceCount), serializedAdditionalRawData); + } + + RollingUpgradeProgressInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRollingUpgradeProgressInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RollingUpgradeProgressInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRollingUpgradeProgressInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RollingUpgradeProgressInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RollingUpgradeProgressInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRollingUpgradeProgressInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs index 620918b86a28..9892fb328d45 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeProgressInfo.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Information about the number of virtual machine instances in each upgrade state. public partial class RollingUpgradeProgressInfo { - /// Initializes a new instance of RollingUpgradeProgressInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RollingUpgradeProgressInfo() { } - /// Initializes a new instance of RollingUpgradeProgressInfo. + /// Initializes a new instance of . /// The number of instances that have been successfully upgraded. /// The number of instances that have failed to be upgraded successfully. /// The number of instances that are currently being upgraded. /// The number of instances that have not yet begun to be upgraded. - internal RollingUpgradeProgressInfo(int? successfulInstanceCount, int? failedInstanceCount, int? inProgressInstanceCount, int? pendingInstanceCount) + /// Keeps track of any properties unknown to the library. + internal RollingUpgradeProgressInfo(int? successfulInstanceCount, int? failedInstanceCount, int? inProgressInstanceCount, int? pendingInstanceCount, Dictionary serializedAdditionalRawData) { SuccessfulInstanceCount = successfulInstanceCount; FailedInstanceCount = failedInstanceCount; InProgressInstanceCount = inProgressInstanceCount; PendingInstanceCount = pendingInstanceCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of instances that have been successfully upgraded. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.Serialization.cs index 63282df72ba7..78f795702f62 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RollingUpgradeRunningStatus + public partial class RollingUpgradeRunningStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RollingUpgradeRunningStatus DeserializeRollingUpgradeRunningStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RollingUpgradeRunningStatus DeserializeRollingUpgradeRunningStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static RollingUpgradeRunningStatus DeserializeRollingUpgradeRunningStat Optional startTime = default; Optional lastAction = default; Optional lastActionTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -61,8 +89,61 @@ internal static RollingUpgradeRunningStatus DeserializeRollingUpgradeRunningStat lastActionTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RollingUpgradeRunningStatus(Optional.ToNullable(code), Optional.ToNullable(startTime), Optional.ToNullable(lastAction), Optional.ToNullable(lastActionTime)); + return new RollingUpgradeRunningStatus(Optional.ToNullable(code), Optional.ToNullable(startTime), Optional.ToNullable(lastAction), Optional.ToNullable(lastActionTime), serializedAdditionalRawData); + } + + RollingUpgradeRunningStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRollingUpgradeRunningStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RollingUpgradeRunningStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRollingUpgradeRunningStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RollingUpgradeRunningStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RollingUpgradeRunningStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRollingUpgradeRunningStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs index aca9a5a702be..7e52b981ed05 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RollingUpgradeRunningStatus.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Information about the current running state of the overall upgrade. public partial class RollingUpgradeRunningStatus { - /// Initializes a new instance of RollingUpgradeRunningStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RollingUpgradeRunningStatus() { } - /// Initializes a new instance of RollingUpgradeRunningStatus. + /// Initializes a new instance of . /// Code indicating the current status of the upgrade. /// Start time of the upgrade. /// The last action performed on the rolling upgrade. /// Last action time of the upgrade. - internal RollingUpgradeRunningStatus(RollingUpgradeStatusCode? code, DateTimeOffset? startOn, RollingUpgradeActionType? lastAction, DateTimeOffset? lastActionOn) + /// Keeps track of any properties unknown to the library. + internal RollingUpgradeRunningStatus(RollingUpgradeStatusCode? code, DateTimeOffset? startOn, RollingUpgradeActionType? lastAction, DateTimeOffset? lastActionOn, Dictionary serializedAdditionalRawData) { Code = code; StartOn = startOn; LastAction = lastAction; LastActionOn = lastActionOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Code indicating the current status of the upgrade. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs index 5182f07a774c..c7cdc2939916 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs @@ -5,16 +5,77 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RunCommandDocument + public partial class RunCommandDocument : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("script"u8); + writer.WriteStartArray(); + foreach (var item in Script) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WritePropertyName("$schema"u8); + writer.WriteStringValue(Schema); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.ToSerialString()); + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +87,7 @@ internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement ele SupportedOperatingSystemType osType = default; string label = default; string description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("script"u8)) @@ -77,8 +139,61 @@ internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement ele description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RunCommandDocument(schema, id, osType, label, description, script, Optional.ToList(parameters)); + return new RunCommandDocument(schema, id, osType, label, description, script, Optional.ToList(parameters), serializedAdditionalRawData); + } + + RunCommandDocument IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandDocument(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandDocument IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandDocument(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandDocument model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandDocument(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandDocument(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs index 49381bfe1fd3..1082986084dd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of a Run Command. public partial class RunCommandDocument : RunCommandDocumentBase { - /// Initializes a new instance of RunCommandDocument. + /// Initializes a new instance of . /// The VM run command schema. /// The VM run command id. /// The Operating System type. @@ -35,7 +35,7 @@ internal RunCommandDocument(string schema, string id, SupportedOperatingSystemTy Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of RunCommandDocument. + /// Initializes a new instance of . /// The VM run command schema. /// The VM run command id. /// The Operating System type. @@ -43,18 +43,18 @@ internal RunCommandDocument(string schema, string id, SupportedOperatingSystemTy /// The VM run command description. /// The script to be executed. /// The parameters used by the script. - /// , , or is null. - internal RunCommandDocument(string schema, string id, SupportedOperatingSystemType osType, string label, string description, IReadOnlyList script, IReadOnlyList parameters) : base(schema, id, osType, label, description) + /// Keeps track of any properties unknown to the library. + internal RunCommandDocument(string schema, string id, SupportedOperatingSystemType osType, string label, string description, IReadOnlyList script, IReadOnlyList parameters, Dictionary serializedAdditionalRawData) : base(schema, id, osType, label, description, serializedAdditionalRawData) { - Argument.AssertNotNull(schema, nameof(schema)); - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(label, nameof(label)); - Argument.AssertNotNull(description, nameof(description)); - Script = script; Parameters = parameters; } + /// Initializes a new instance of for deserialization. + internal RunCommandDocument() + { + } + /// The script to be executed. public IReadOnlyList Script { get; } /// The parameters used by the script. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs index a227685196c3..77ac9988dcff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs @@ -5,15 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RunCommandDocumentBase + public partial class RunCommandDocumentBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("$schema"u8); + writer.WriteStringValue(Schema); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.ToSerialString()); + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +61,7 @@ internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonEle SupportedOperatingSystemType osType = default; string label = default; string description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("$schema"u8)) @@ -50,8 +89,61 @@ internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonEle description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RunCommandDocumentBase(schema, id, osType, label, description); + return new RunCommandDocumentBase(schema, id, osType, label, description, serializedAdditionalRawData); + } + + RunCommandDocumentBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandDocumentBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandDocumentBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandDocumentBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandDocumentBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandDocumentBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandDocumentBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs index ce7e41081ea5..48844e771edb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of a Run Command metadata. public partial class RunCommandDocumentBase { - /// Initializes a new instance of RunCommandDocumentBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The VM run command schema. /// The VM run command id. /// The Operating System type. @@ -34,6 +38,28 @@ internal RunCommandDocumentBase(string schema, string id, SupportedOperatingSyst Description = description; } + /// Initializes a new instance of . + /// The VM run command schema. + /// The VM run command id. + /// The Operating System type. + /// The VM run command label. + /// The VM run command description. + /// Keeps track of any properties unknown to the library. + internal RunCommandDocumentBase(string schema, string id, SupportedOperatingSystemType osType, string label, string description, Dictionary serializedAdditionalRawData) + { + Schema = schema; + Id = id; + OSType = osType; + Label = label; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunCommandDocumentBase() + { + } + /// The VM run command schema. public string Schema { get; } /// The VM run command id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.Serialization.cs index 54cfa1dcdb87..27080cf4f79b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RunCommandInput : IUtf8JsonSerializable + public partial class RunCommandInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("commandId"u8); writer.WriteStringValue(CommandId); @@ -33,11 +41,134 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RunCommandInput DeserializeRunCommandInput(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string commandId = default; + Optional> script = default; + Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("commandId"u8)) + { + commandId = property.Value.GetString(); + continue; + } + if (property.NameEquals("script"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + script = array; + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunCommandInputParameter.DeserializeRunCommandInputParameter(item)); + } + parameters = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunCommandInput(commandId, Optional.ToList(script), Optional.ToList(parameters), serializedAdditionalRawData); + } + + RunCommandInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandInput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.cs index 57daad17b0bd..bc978dd0f135 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInput.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Capture Virtual Machine parameters. public partial class RunCommandInput { - /// Initializes a new instance of RunCommandInput. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The run command id. /// is null. public RunCommandInput(string commandId) @@ -26,6 +29,24 @@ public RunCommandInput(string commandId) Parameters = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The run command id. + /// Optional. The script to be executed. When this value is given, the given script will override the default script of the command. + /// The run command parameters. + /// Keeps track of any properties unknown to the library. + internal RunCommandInput(string commandId, IList script, IList parameters, Dictionary serializedAdditionalRawData) + { + CommandId = commandId; + Script = script; + Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunCommandInput() + { + } + /// The run command id. public string CommandId { get; } /// Optional. The script to be executed. When this value is given, the given script will override the default script of the command. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.Serialization.cs index 42a6e74036b8..44c5a879d6c5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RunCommandInputParameter : IUtf8JsonSerializable + public partial class RunCommandInputParameter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RunCommandInputParameter DeserializeRunCommandInputParameter(JsonElement element) + internal static RunCommandInputParameter DeserializeRunCommandInputParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +65,61 @@ internal static RunCommandInputParameter DeserializeRunCommandInputParameter(Jso value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunCommandInputParameter(name, value, serializedAdditionalRawData); + } + + RunCommandInputParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandInputParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandInputParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandInputParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandInputParameter model) + { + if (model is null) + { + return null; } - return new RunCommandInputParameter(name, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandInputParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandInputParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.cs index 8fc0610a4e03..1f9f502c0de9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandInputParameter.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of a run command parameter. public partial class RunCommandInputParameter { - /// Initializes a new instance of RunCommandInputParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The run command parameter name. /// The run command parameter value. /// or is null. @@ -26,6 +30,22 @@ public RunCommandInputParameter(string name, string value) Value = value; } + /// Initializes a new instance of . + /// The run command parameter name. + /// The run command parameter value. + /// Keeps track of any properties unknown to the library. + internal RunCommandInputParameter(string name, string value, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunCommandInputParameter() + { + } + /// The run command parameter name. public string Name { get; set; } /// The run command parameter value. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.Serialization.cs index 44e5aabb8b18..dbbab5326f74 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class RunCommandListResult + internal partial class RunCommandListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RunCommandListResult DeserializeRunCommandListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RunCommandListResult DeserializeRunCommandListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static RunCommandListResult DeserializeRunCommandListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RunCommandListResult(value, nextLink.Value); + return new RunCommandListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + RunCommandListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.cs index a91bf2dc04a4..ee2ce0464a94 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandListResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Virtual Machine operation response. internal partial class RunCommandListResult { - /// Initializes a new instance of RunCommandListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of virtual machine run commands. /// is null. internal RunCommandListResult(IEnumerable value) @@ -25,13 +28,20 @@ internal RunCommandListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RunCommandListResult. + /// Initializes a new instance of . /// The list of virtual machine run commands. /// The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands. - internal RunCommandListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RunCommandListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunCommandListResult() + { } /// The list of virtual machine run commands. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.Serialization.cs index a09c8450a0a0..81f2159ba5ea 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RunCommandManagedIdentity : IUtf8JsonSerializable + public partial class RunCommandManagedIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("objectId"u8); writer.WriteStringValue(ObjectId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RunCommandManagedIdentity DeserializeRunCommandManagedIdentity(JsonElement element) + internal static RunCommandManagedIdentity DeserializeRunCommandManagedIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clientId = default; Optional objectId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -48,8 +71,61 @@ internal static RunCommandManagedIdentity DeserializeRunCommandManagedIdentity(J objectId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunCommandManagedIdentity(clientId.Value, objectId.Value, serializedAdditionalRawData); + } + + RunCommandManagedIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandManagedIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandManagedIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandManagedIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandManagedIdentity model) + { + if (model is null) + { + return null; } - return new RunCommandManagedIdentity(clientId.Value, objectId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandManagedIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandManagedIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.cs index cf32fd770258..ebc1f6ac653d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandManagedIdentity.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. public partial class RunCommandManagedIdentity { - /// Initializes a new instance of RunCommandManagedIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RunCommandManagedIdentity() { } - /// Initializes a new instance of RunCommandManagedIdentity. + /// Initializes a new instance of . /// Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. /// Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. - internal RunCommandManagedIdentity(string clientId, string objectId) + /// Keeps track of any properties unknown to the library. + internal RunCommandManagedIdentity(string clientId, string objectId, Dictionary serializedAdditionalRawData) { ClientId = clientId; ObjectId = objectId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.Serialization.cs index 228c45e50b5f..38d652d83dff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.Serialization.cs @@ -5,15 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class RunCommandParameterDefinition + public partial class RunCommandParameterDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RunCommandParameterDefinition DeserializeRunCommandParameterDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RunCommandParameterDefinitionType); + if (Optional.IsDefined(DefaultValue)) + { + writer.WritePropertyName("defaultValue"u8); + writer.WriteStringValue(DefaultValue); + } + if (Optional.IsDefined(Required)) + { + writer.WritePropertyName("required"u8); + writer.WriteBooleanValue(Required.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RunCommandParameterDefinition DeserializeRunCommandParameterDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static RunCommandParameterDefinition DeserializeRunCommandParameterDefi string type = default; Optional defaultValue = default; Optional required = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +91,61 @@ internal static RunCommandParameterDefinition DeserializeRunCommandParameterDefi required = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RunCommandParameterDefinition(name, type, defaultValue.Value, Optional.ToNullable(required)); + return new RunCommandParameterDefinition(name, type, defaultValue.Value, Optional.ToNullable(required), serializedAdditionalRawData); + } + + RunCommandParameterDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunCommandParameterDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunCommandParameterDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunCommandParameterDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunCommandParameterDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunCommandParameterDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunCommandParameterDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.cs index 31d983f2d52f..ede1594aed98 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandParameterDefinition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of a run command parameter. public partial class RunCommandParameterDefinition { - /// Initializes a new instance of RunCommandParameterDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The run command parameter name. /// The run command parameter type. /// or is null. @@ -26,17 +30,24 @@ internal RunCommandParameterDefinition(string name, string runCommandParameterDe RunCommandParameterDefinitionType = runCommandParameterDefinitionType; } - /// Initializes a new instance of RunCommandParameterDefinition. + /// Initializes a new instance of . /// The run command parameter name. /// The run command parameter type. /// The run command parameter default value. /// The run command parameter required. - internal RunCommandParameterDefinition(string name, string runCommandParameterDefinitionType, string defaultValue, bool? required) + /// Keeps track of any properties unknown to the library. + internal RunCommandParameterDefinition(string name, string runCommandParameterDefinitionType, string defaultValue, bool? required, Dictionary serializedAdditionalRawData) { Name = name; RunCommandParameterDefinitionType = runCommandParameterDefinitionType; DefaultValue = defaultValue; Required = required; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunCommandParameterDefinition() + { } /// The run command parameter name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.Serialization.cs index 6f758bff5dd0..8d4c24152eae 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ScaleInPolicy : IUtf8JsonSerializable + public partial class ScaleInPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Rules)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("forceDeletion"u8); writer.WriteBooleanValue(ForceDeletion.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScaleInPolicy DeserializeScaleInPolicy(JsonElement element) + internal static ScaleInPolicy DeserializeScaleInPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> rules = default; Optional forceDeletion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rules"u8)) @@ -67,8 +89,61 @@ internal static ScaleInPolicy DeserializeScaleInPolicy(JsonElement element) forceDeletion = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScaleInPolicy(Optional.ToList(rules), Optional.ToNullable(forceDeletion), serializedAdditionalRawData); + } + + ScaleInPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScaleInPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScaleInPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScaleInPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScaleInPolicy model) + { + if (model is null) + { + return null; } - return new ScaleInPolicy(Optional.ToList(rules), Optional.ToNullable(forceDeletion)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScaleInPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScaleInPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.cs index 3d105588a020..b413ddacbf9f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ScaleInPolicy.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a scale-in policy for a virtual machine scale set. public partial class ScaleInPolicy { - /// Initializes a new instance of ScaleInPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScaleInPolicy() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ScaleInPolicy. + /// Initializes a new instance of . /// The rules to be followed when scaling-in a virtual machine scale set. <br><br> Possible values are: <br><br> **Default** When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. <br><br> **OldestVM** When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. <br><br> **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal. <br><br>. /// This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature in Preview). - internal ScaleInPolicy(IList rules, bool? forceDeletion) + /// Keeps track of any properties unknown to the library. + internal ScaleInPolicy(IList rules, bool? forceDeletion, Dictionary serializedAdditionalRawData) { Rules = rules; ForceDeletion = forceDeletion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The rules to be followed when scaling-in a virtual machine scale set. <br><br> Possible values are: <br><br> **Default** When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in. <br><br> **OldestVM** When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal. <br><br> **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal. <br><br>. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.Serialization.cs index 908c590fdc22..d1ca2c2d3082 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SecurityProfile : IUtf8JsonSerializable + public partial class SecurityProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UefiSettings)) { writer.WritePropertyName("uefiSettings"u8); - writer.WriteObjectValue(UefiSettings); + if (UefiSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UefiSettings).Serialize(writer, options); + } } if (Optional.IsDefined(EncryptionAtHost)) { @@ -30,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("securityType"u8); writer.WriteStringValue(SecurityType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecurityProfile DeserializeSecurityProfile(JsonElement element) + internal static SecurityProfile DeserializeSecurityProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static SecurityProfile DeserializeSecurityProfile(JsonElement element) Optional uefiSettings = default; Optional encryptionAtHost = default; Optional securityType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uefiSettings"u8)) @@ -71,8 +101,61 @@ internal static SecurityProfile DeserializeSecurityProfile(JsonElement element) securityType = new SecurityType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SecurityProfile(uefiSettings.Value, Optional.ToNullable(encryptionAtHost), Optional.ToNullable(securityType), serializedAdditionalRawData); + } + + SecurityProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecurityProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecurityProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecurityProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecurityProfile(Response response) + { + if (response is null) + { + return null; } - return new SecurityProfile(uefiSettings.Value, Optional.ToNullable(encryptionAtHost), Optional.ToNullable(securityType)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecurityProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.cs index 502be4b788c1..97c88e5af7b7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityProfile.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the Security profile settings for the virtual machine or virtual machine scale set. public partial class SecurityProfile { - /// Initializes a new instance of SecurityProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SecurityProfile() { } - /// Initializes a new instance of SecurityProfile. + /// Initializes a new instance of . /// Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum api-version: 2020-12-01. /// This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual machine scale set. This will enable the encryption for all the disks including Resource/Temp disk at host itself. The default behavior is: The Encryption at host will be disabled unless this property is set to true for the resource. /// Specifies the SecurityType of the virtual machine. It has to be set to any specified value to enable UefiSettings. The default behavior is: UefiSettings will not be enabled unless this property is set. - internal SecurityProfile(UefiSettings uefiSettings, bool? encryptionAtHost, SecurityType? securityType) + /// Keeps track of any properties unknown to the library. + internal SecurityProfile(UefiSettings uefiSettings, bool? encryptionAtHost, SecurityType? securityType, Dictionary serializedAdditionalRawData) { UefiSettings = uefiSettings; EncryptionAtHost = encryptionAtHost; SecurityType = securityType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum api-version: 2020-12-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.Serialization.cs index 326f0b4a96f6..03a45916b0a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.Serialization.cs @@ -6,20 +6,48 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ShareInfoElement + public partial class ShareInfoElement : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ShareInfoElement DeserializeShareInfoElement(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ShareInfoElement DeserializeShareInfoElement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vmUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmUri"u8)) @@ -31,8 +59,61 @@ internal static ShareInfoElement DeserializeShareInfoElement(JsonElement element vmUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ShareInfoElement(vmUri.Value); + return new ShareInfoElement(vmUri.Value, serializedAdditionalRawData); + } + + ShareInfoElement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShareInfoElement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShareInfoElement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShareInfoElement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShareInfoElement model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShareInfoElement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShareInfoElement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.cs index 3204a90413cf..7291816f9961 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ShareInfoElement.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// The ShareInfoElement. public partial class ShareInfoElement { - /// Initializes a new instance of ShareInfoElement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ShareInfoElement() { } - /// Initializes a new instance of ShareInfoElement. + /// Initializes a new instance of . /// A relative URI containing the ID of the VM that has the disk attached. - internal ShareInfoElement(Uri vmUri) + /// Keeps track of any properties unknown to the library. + internal ShareInfoElement(Uri vmUri, Dictionary serializedAdditionalRawData) { VmUri = vmUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A relative URI containing the ID of the VM that has the disk attached. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryData.Serialization.cs index d0d6cf0422a7..7ce76e71511c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryData.Serialization.cs @@ -5,15 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute { - public partial class SharedGalleryData + public partial class SharedGalleryData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryData DeserializeSharedGalleryData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryData DeserializeSharedGalleryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +57,7 @@ internal static SharedGalleryData DeserializeSharedGalleryData(JsonElement eleme Optional name = default; Optional location = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -54,8 +91,61 @@ internal static SharedGalleryData DeserializeSharedGalleryData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryData(name.Value, Optional.ToNullable(location), uniqueId.Value); + return new SharedGalleryData(name.Value, Optional.ToNullable(location), uniqueId.Value, serializedAdditionalRawData); + } + + SharedGalleryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.Serialization.cs index e84905269ccd..9c338762d0db 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.Serialization.cs @@ -5,15 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharedGalleryDataDiskImage + public partial class SharedGalleryDataDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryDataDiskImage DeserializeSharedGalleryDataDiskImage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("lun"u8); + writer.WriteNumberValue(Lun); + if (Optional.IsDefined(HostCaching)) + { + writer.WritePropertyName("hostCaching"u8); + writer.WriteStringValue(HostCaching.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryDataDiskImage DeserializeSharedGalleryDataDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +56,7 @@ internal static SharedGalleryDataDiskImage DeserializeSharedGalleryDataDiskImage int lun = default; Optional diskSizeGB = default; Optional hostCaching = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -46,8 +82,61 @@ internal static SharedGalleryDataDiskImage DeserializeSharedGalleryDataDiskImage hostCaching = new SharedGalleryHostCaching(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryDataDiskImage(Optional.ToNullable(diskSizeGB), Optional.ToNullable(hostCaching), lun); + return new SharedGalleryDataDiskImage(Optional.ToNullable(diskSizeGB), Optional.ToNullable(hostCaching), lun, serializedAdditionalRawData); + } + + SharedGalleryDataDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryDataDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryDataDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryDataDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryDataDiskImage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryDataDiskImage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryDataDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.cs index 3c52370804c5..68945665647a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDataDiskImage.cs @@ -5,27 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the data disk image. public partial class SharedGalleryDataDiskImage : SharedGalleryDiskImage { - /// Initializes a new instance of SharedGalleryDataDiskImage. + /// Initializes a new instance of . /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. internal SharedGalleryDataDiskImage(int lun) { Lun = lun; } - /// Initializes a new instance of SharedGalleryDataDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. - internal SharedGalleryDataDiskImage(int? diskSizeGB, SharedGalleryHostCaching? hostCaching, int lun) : base(diskSizeGB, hostCaching) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryDataDiskImage(int? diskSizeGB, SharedGalleryHostCaching? hostCaching, int lun, Dictionary serializedAdditionalRawData) : base(diskSizeGB, hostCaching, serializedAdditionalRawData) { Lun = lun; } + /// Initializes a new instance of for deserialization. + internal SharedGalleryDataDiskImage() + { + } + /// This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine. public int Lun { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.Serialization.cs index 564ceb5c5345..0d091c5c456e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.Serialization.cs @@ -5,21 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharedGalleryDiskImage + public partial class SharedGalleryDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryDiskImage DeserializeSharedGalleryDiskImage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(HostCaching)) + { + writer.WritePropertyName("hostCaching"u8); + writer.WriteStringValue(HostCaching.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryDiskImage DeserializeSharedGalleryDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskSizeGB = default; Optional hostCaching = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskSizeGB"u8)) @@ -40,8 +74,61 @@ internal static SharedGalleryDiskImage DeserializeSharedGalleryDiskImage(JsonEle hostCaching = new SharedGalleryHostCaching(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryDiskImage(Optional.ToNullable(diskSizeGB), Optional.ToNullable(hostCaching)); + return new SharedGalleryDiskImage(Optional.ToNullable(diskSizeGB), Optional.ToNullable(hostCaching), serializedAdditionalRawData); + } + + SharedGalleryDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryDiskImage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryDiskImage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.cs index adcdb833fa25..c4472107e218 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryDiskImage.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the disk image base class. public partial class SharedGalleryDiskImage { - /// Initializes a new instance of SharedGalleryDiskImage. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SharedGalleryDiskImage() { } - /// Initializes a new instance of SharedGalleryDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. - internal SharedGalleryDiskImage(int? diskSizeGB, SharedGalleryHostCaching? hostCaching) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryDiskImage(int? diskSizeGB, SharedGalleryHostCaching? hostCaching, Dictionary serializedAdditionalRawData) { DiskSizeGB = diskSizeGB; HostCaching = hostCaching; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property indicates the size of the VHD to be created. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageData.Serialization.cs index b963e0fbe9f4..250bf73ebdf2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageData.Serialization.cs @@ -8,15 +8,152 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; namespace Azure.ResourceManager.Compute { - public partial class SharedGalleryImageData + public partial class SharedGalleryImageData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryImageData DeserializeSharedGalleryImageData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(OSType)) + { + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.Value.ToSerialString()); + } + if (Optional.IsDefined(OSState)) + { + writer.WritePropertyName("osState"u8); + writer.WriteStringValue(OSState.Value.ToSerialString()); + } + if (Optional.IsDefined(EndOfLifeOn)) + { + writer.WritePropertyName("endOfLifeDate"u8); + writer.WriteStringValue(EndOfLifeOn.Value, "O"); + } + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + if (Identifier is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identifier).Serialize(writer, options); + } + } + if (Optional.IsDefined(Recommended)) + { + writer.WritePropertyName("recommended"u8); + if (Recommended is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recommended).Serialize(writer, options); + } + } + if (Optional.IsDefined(Disallowed)) + { + writer.WritePropertyName("disallowed"u8); + if (Disallowed is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Disallowed).Serialize(writer, options); + } + } + if (Optional.IsDefined(HyperVGeneration)) + { + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration.Value.ToString()); + } + if (Optional.IsCollectionDefined(Features)) + { + writer.WritePropertyName("features"u8); + writer.WriteStartArray(); + foreach (var item in Features) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PurchasePlan)) + { + writer.WritePropertyName("purchasePlan"u8); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } + } + if (Optional.IsDefined(Architecture)) + { + writer.WritePropertyName("architecture"u8); + writer.WriteStringValue(Architecture.Value.ToString()); + } + if (Optional.IsDefined(PrivacyStatementUri)) + { + writer.WritePropertyName("privacyStatementUri"u8); + writer.WriteStringValue(PrivacyStatementUri.AbsoluteUri); + } + if (Optional.IsDefined(Eula)) + { + writer.WritePropertyName("eula"u8); + writer.WriteStringValue(Eula); + } + writer.WriteEndObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryImageData DeserializeSharedGalleryImageData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +173,7 @@ internal static SharedGalleryImageData DeserializeSharedGalleryImageData(JsonEle Optional privacyStatementUri = default; Optional eula = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -190,8 +328,61 @@ internal static SharedGalleryImageData DeserializeSharedGalleryImageData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryImageData(name.Value, Optional.ToNullable(location), uniqueId.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, Optional.ToNullable(hyperVGeneration), Optional.ToList(features), purchasePlan.Value, Optional.ToNullable(architecture), privacyStatementUri.Value, eula.Value); + return new SharedGalleryImageData(name.Value, Optional.ToNullable(location), uniqueId.Value, Optional.ToNullable(osType), Optional.ToNullable(osState), Optional.ToNullable(endOfLifeDate), identifier.Value, recommended.Value, disallowed.Value, Optional.ToNullable(hyperVGeneration), Optional.ToList(features), purchasePlan.Value, Optional.ToNullable(architecture), privacyStatementUri.Value, eula.Value, serializedAdditionalRawData); + } + + SharedGalleryImageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryImageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryImageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryImageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryImageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryImageData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryImageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.Serialization.cs index 6f4a294e0a87..0b735ea2b25a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class SharedGalleryImageList + internal partial class SharedGalleryImageList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryImageList DeserializeSharedGalleryImageList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryImageList DeserializeSharedGalleryImageList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static SharedGalleryImageList DeserializeSharedGalleryImageList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryImageList(value, nextLink.Value); + return new SharedGalleryImageList(value, nextLink.Value, serializedAdditionalRawData); + } + + SharedGalleryImageList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryImageList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryImageList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryImageList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryImageList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryImageList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryImageList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.cs index c2c95b814c36..bb30d27b0260 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Shared Gallery Images operation response. internal partial class SharedGalleryImageList { - /// Initializes a new instance of SharedGalleryImageList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of shared gallery images. /// is null. internal SharedGalleryImageList(IEnumerable value) @@ -26,13 +29,20 @@ internal SharedGalleryImageList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SharedGalleryImageList. + /// Initializes a new instance of . /// A list of shared gallery images. /// The uri to fetch the next page of shared gallery images. Call ListNext() with this to fetch the next page of shared gallery images. - internal SharedGalleryImageList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryImageList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SharedGalleryImageList() + { } /// A list of shared gallery images. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionData.Serialization.cs index 01cb0e9aef82..c1546900b8c8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionData.Serialization.cs @@ -6,16 +6,81 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; namespace Azure.ResourceManager.Compute { - public partial class SharedGalleryImageVersionData + public partial class SharedGalleryImageVersionData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryImageVersionData DeserializeSharedGalleryImageVersionData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PublishedOn)) + { + writer.WritePropertyName("publishedDate"u8); + writer.WriteStringValue(PublishedOn.Value, "O"); + } + if (Optional.IsDefined(EndOfLifeOn)) + { + writer.WritePropertyName("endOfLifeDate"u8); + writer.WriteStringValue(EndOfLifeOn.Value, "O"); + } + if (Optional.IsDefined(IsExcludedFromLatest)) + { + writer.WritePropertyName("excludeFromLatest"u8); + writer.WriteBooleanValue(IsExcludedFromLatest.Value); + } + if (Optional.IsDefined(StorageProfile)) + { + writer.WritePropertyName("storageProfile"u8); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } + } + writer.WriteEndObject(); + writer.WritePropertyName("identifier"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryImageVersionData DeserializeSharedGalleryImageVersionData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +92,7 @@ internal static SharedGalleryImageVersionData DeserializeSharedGalleryImageVersi Optional excludeFromLatest = default; Optional storageProfile = default; Optional uniqueId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -108,8 +174,61 @@ internal static SharedGalleryImageVersionData DeserializeSharedGalleryImageVersi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryImageVersionData(name.Value, Optional.ToNullable(location), uniqueId.Value, Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(excludeFromLatest), storageProfile.Value); + return new SharedGalleryImageVersionData(name.Value, Optional.ToNullable(location), uniqueId.Value, Optional.ToNullable(publishedDate), Optional.ToNullable(endOfLifeDate), Optional.ToNullable(excludeFromLatest), storageProfile.Value, serializedAdditionalRawData); + } + + SharedGalleryImageVersionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryImageVersionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryImageVersionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryImageVersionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryImageVersionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryImageVersionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryImageVersionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.Serialization.cs index 1af154197947..4d2651a23d60 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class SharedGalleryImageVersionList + internal partial class SharedGalleryImageVersionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryImageVersionList DeserializeSharedGalleryImageVersionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryImageVersionList DeserializeSharedGalleryImageVersionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static SharedGalleryImageVersionList DeserializeSharedGalleryImageVersi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryImageVersionList(value, nextLink.Value); + return new SharedGalleryImageVersionList(value, nextLink.Value, serializedAdditionalRawData); + } + + SharedGalleryImageVersionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryImageVersionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryImageVersionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryImageVersionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryImageVersionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryImageVersionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryImageVersionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.cs index a462ca751fdb..8c7ee16156e4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Shared Gallery Image versions operation response. internal partial class SharedGalleryImageVersionList { - /// Initializes a new instance of SharedGalleryImageVersionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of shared gallery images versions. /// is null. internal SharedGalleryImageVersionList(IEnumerable value) @@ -26,13 +29,20 @@ internal SharedGalleryImageVersionList(IEnumerable Initializes a new instance of SharedGalleryImageVersionList. + /// Initializes a new instance of . /// A list of shared gallery images versions. /// The uri to fetch the next page of shared gallery image versions. Call ListNext() with this to fetch the next page of shared gallery image versions. - internal SharedGalleryImageVersionList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryImageVersionList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SharedGalleryImageVersionList() + { } /// A list of shared gallery images versions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.Serialization.cs index 717015bc233d..53cda7ab2ebd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.Serialization.cs @@ -5,22 +5,79 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharedGalleryImageVersionStorageProfile + public partial class SharedGalleryImageVersionStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryImageVersionStorageProfile DeserializeSharedGalleryImageVersionStorageProfile(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OSDiskImage)) + { + writer.WritePropertyName("osDiskImage"u8); + if (OSDiskImage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDiskImage).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(DataDiskImages)) + { + writer.WritePropertyName("dataDiskImages"u8); + writer.WriteStartArray(); + foreach (var item in DataDiskImages) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryImageVersionStorageProfile DeserializeSharedGalleryImageVersionStorageProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional osDiskImage = default; Optional> dataDiskImages = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osDiskImage"u8)) @@ -46,8 +103,61 @@ internal static SharedGalleryImageVersionStorageProfile DeserializeSharedGallery dataDiskImages = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryImageVersionStorageProfile(osDiskImage.Value, Optional.ToList(dataDiskImages)); + return new SharedGalleryImageVersionStorageProfile(osDiskImage.Value, Optional.ToList(dataDiskImages), serializedAdditionalRawData); + } + + SharedGalleryImageVersionStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryImageVersionStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryImageVersionStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryImageVersionStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryImageVersionStorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryImageVersionStorageProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryImageVersionStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.cs index c772a2d92946..b62c8297eb67 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryImageVersionStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// This is the storage profile of a Gallery Image Version. public partial class SharedGalleryImageVersionStorageProfile { - /// Initializes a new instance of SharedGalleryImageVersionStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SharedGalleryImageVersionStorageProfile() { DataDiskImages = new ChangeTrackingList(); } - /// Initializes a new instance of SharedGalleryImageVersionStorageProfile. + /// Initializes a new instance of . /// This is the OS disk image. /// A list of data disk images. - internal SharedGalleryImageVersionStorageProfile(SharedGalleryOSDiskImage osDiskImage, IReadOnlyList dataDiskImages) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryImageVersionStorageProfile(SharedGalleryOSDiskImage osDiskImage, IReadOnlyList dataDiskImages, Dictionary serializedAdditionalRawData) { OSDiskImage = osDiskImage; DataDiskImages = dataDiskImages; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the OS disk image. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.Serialization.cs index f64b3d94a0a5..e33760857ff3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class SharedGalleryList + internal partial class SharedGalleryList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryList DeserializeSharedGalleryList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryList DeserializeSharedGalleryList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static SharedGalleryList DeserializeSharedGalleryList(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryList(value, nextLink.Value); + return new SharedGalleryList(value, nextLink.Value, serializedAdditionalRawData); + } + + SharedGalleryList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.cs index 2f3a73b3be7c..70edf376826c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Shared Galleries operation response. internal partial class SharedGalleryList { - /// Initializes a new instance of SharedGalleryList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of shared galleries. /// is null. internal SharedGalleryList(IEnumerable value) @@ -26,13 +29,20 @@ internal SharedGalleryList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SharedGalleryList. + /// Initializes a new instance of . /// A list of shared galleries. /// The uri to fetch the next page of shared galleries. Call ListNext() with this to fetch the next page of shared galleries. - internal SharedGalleryList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SharedGalleryList() + { } /// A list of shared galleries. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.Serialization.cs index 9938b5d32549..d9ae2b6fc4be 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.Serialization.cs @@ -5,21 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharedGalleryOSDiskImage + public partial class SharedGalleryOSDiskImage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharedGalleryOSDiskImage DeserializeSharedGalleryOSDiskImage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(HostCaching)) + { + writer.WritePropertyName("hostCaching"u8); + writer.WriteStringValue(HostCaching.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharedGalleryOSDiskImage DeserializeSharedGalleryOSDiskImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskSizeGB = default; Optional hostCaching = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskSizeGB"u8)) @@ -40,8 +74,61 @@ internal static SharedGalleryOSDiskImage DeserializeSharedGalleryOSDiskImage(Jso hostCaching = new SharedGalleryHostCaching(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharedGalleryOSDiskImage(Optional.ToNullable(diskSizeGB), Optional.ToNullable(hostCaching)); + return new SharedGalleryOSDiskImage(Optional.ToNullable(diskSizeGB), Optional.ToNullable(hostCaching), serializedAdditionalRawData); + } + + SharedGalleryOSDiskImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedGalleryOSDiskImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedGalleryOSDiskImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedGalleryOSDiskImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedGalleryOSDiskImage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedGalleryOSDiskImage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedGalleryOSDiskImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.cs index e0ccf0d886f5..b00d1deb2728 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharedGalleryOSDiskImage.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// This is the OS disk image. public partial class SharedGalleryOSDiskImage : SharedGalleryDiskImage { - /// Initializes a new instance of SharedGalleryOSDiskImage. + /// Initializes a new instance of . internal SharedGalleryOSDiskImage() { } - /// Initializes a new instance of SharedGalleryOSDiskImage. + /// Initializes a new instance of . /// This property indicates the size of the VHD to be created. /// The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'. - internal SharedGalleryOSDiskImage(int? diskSizeGB, SharedGalleryHostCaching? hostCaching) : base(diskSizeGB, hostCaching) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryOSDiskImage(int? diskSizeGB, SharedGalleryHostCaching? hostCaching, Dictionary serializedAdditionalRawData) : base(diskSizeGB, hostCaching, serializedAdditionalRawData) { } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.Serialization.cs index 5429682061a6..1dfaf309e8fc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharingProfile : IUtf8JsonSerializable + public partial class SharingProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Permission)) { @@ -24,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CommunityGalleryInfo)) { writer.WritePropertyName("communityGalleryInfo"u8); - writer.WriteObjectValue(CommunityGalleryInfo); + if (CommunityGalleryInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommunityGalleryInfo).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static SharingProfile DeserializeSharingProfile(JsonElement element) + internal static SharingProfile DeserializeSharingProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +66,7 @@ internal static SharingProfile DeserializeSharingProfile(JsonElement element) Optional permissions = default; Optional> groups = default; Optional communityGalleryInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("permissions"u8)) @@ -72,8 +101,61 @@ internal static SharingProfile DeserializeSharingProfile(JsonElement element) communityGalleryInfo = CommunityGalleryInfo.DeserializeCommunityGalleryInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SharingProfile(Optional.ToNullable(permissions), Optional.ToList(groups), communityGalleryInfo.Value, serializedAdditionalRawData); + } + + SharingProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharingProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharingProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharingProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharingProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharingProfile(Response response) + { + if (response is null) + { + return null; } - return new SharingProfile(Optional.ToNullable(permissions), Optional.ToList(groups), communityGalleryInfo.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharingProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.cs index 3c9bd5db87b3..5240cf10b3b7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Compute.Models /// Profile for gallery sharing to subscription or tenant. public partial class SharingProfile { - /// Initializes a new instance of SharingProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SharingProfile() { Groups = new ChangeTrackingList(); } - /// Initializes a new instance of SharingProfile. + /// Initializes a new instance of . /// This property allows you to specify the permission of sharing gallery. <br><br> Possible values are: <br><br> **Private** <br><br> **Groups** <br><br> **Community**. /// A list of sharing profile groups. /// Information of community gallery if current gallery is shared to community. - internal SharingProfile(GallerySharingPermissionType? permission, IReadOnlyList groups, CommunityGalleryInfo communityGalleryInfo) + /// Keeps track of any properties unknown to the library. + internal SharingProfile(GallerySharingPermissionType? permission, IReadOnlyList groups, CommunityGalleryInfo communityGalleryInfo, Dictionary serializedAdditionalRawData) { Permission = permission; Groups = groups; CommunityGalleryInfo = communityGalleryInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property allows you to specify the permission of sharing gallery. <br><br> Possible values are: <br><br> **Private** <br><br> **Groups** <br><br> **Community**. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.Serialization.cs index cde651f2766c..6ffd8f328589 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharingProfileGroup : IUtf8JsonSerializable + public partial class SharingProfileGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GroupType)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SharingProfileGroup DeserializeSharingProfileGroup(JsonElement element) + internal static SharingProfileGroup DeserializeSharingProfileGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional> ids = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -67,8 +89,61 @@ internal static SharingProfileGroup DeserializeSharingProfileGroup(JsonElement e ids = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SharingProfileGroup(Optional.ToNullable(type), Optional.ToList(ids), serializedAdditionalRawData); + } + + SharingProfileGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharingProfileGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharingProfileGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharingProfileGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharingProfileGroup model) + { + if (model is null) + { + return null; } - return new SharingProfileGroup(Optional.ToNullable(type), Optional.ToList(ids)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharingProfileGroup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharingProfileGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.cs index cfb3ed43c9b2..6cf158084554 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingProfileGroup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Group of the gallery sharing profile. public partial class SharingProfileGroup { - /// Initializes a new instance of SharingProfileGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SharingProfileGroup() { Ids = new ChangeTrackingList(); } - /// Initializes a new instance of SharingProfileGroup. + /// Initializes a new instance of . /// This property allows you to specify the type of sharing group. <br><br> Possible values are: <br><br> **Subscriptions** <br><br> **AADTenants**. /// A list of subscription/tenant ids the gallery is aimed to be shared to. - internal SharingProfileGroup(SharingProfileGroupType? groupType, IList ids) + /// Keeps track of any properties unknown to the library. + internal SharingProfileGroup(SharingProfileGroupType? groupType, IList ids, Dictionary serializedAdditionalRawData) { GroupType = groupType; Ids = ids; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This property allows you to specify the type of sharing group. <br><br> Possible values are: <br><br> **Subscriptions** <br><br> **AADTenants**. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.Serialization.cs index 533da9949d56..42d7978b5efb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharingStatus + public partial class SharingStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SharingStatus DeserializeSharingStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Summary)) + { + writer.WritePropertyName("summary"u8); + writer.WriteStartArray(); + foreach (var item in Summary) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SharingStatus DeserializeSharingStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional aggregatedState = default; Optional> summary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("aggregatedState"u8)) @@ -46,8 +91,61 @@ internal static SharingStatus DeserializeSharingStatus(JsonElement element) summary = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SharingStatus(Optional.ToNullable(aggregatedState), Optional.ToList(summary)); + return new SharingStatus(Optional.ToNullable(aggregatedState), Optional.ToList(summary), serializedAdditionalRawData); + } + + SharingStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharingStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharingStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharingStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharingStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharingStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharingStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.cs index fc08eeda21a3..2694beb34f3d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Sharing status of current gallery. public partial class SharingStatus { - /// Initializes a new instance of SharingStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SharingStatus() { Summary = new ChangeTrackingList(); } - /// Initializes a new instance of SharingStatus. + /// Initializes a new instance of . /// Aggregated sharing state of current gallery. /// Summary of all regional sharing status. - internal SharingStatus(SharingState? aggregatedState, IReadOnlyList summary) + /// Keeps track of any properties unknown to the library. + internal SharingStatus(SharingState? aggregatedState, IReadOnlyList summary, Dictionary serializedAdditionalRawData) { AggregatedState = aggregatedState; Summary = summary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Aggregated sharing state of current gallery. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.Serialization.cs index 4ed43836081e..0980dbd14bf6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SharingUpdate : IUtf8JsonSerializable + public partial class SharingUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("operationType"u8); writer.WriteStringValue(OperationType.ToString()); @@ -24,21 +31,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Groups) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SharingUpdate DeserializeSharingUpdate(JsonElement element) + internal static SharingUpdate DeserializeSharingUpdate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } SharingUpdateOperationType operationType = default; Optional> groups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationType"u8)) @@ -60,8 +89,61 @@ internal static SharingUpdate DeserializeSharingUpdate(JsonElement element) groups = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SharingUpdate(operationType, Optional.ToList(groups), serializedAdditionalRawData); + } + + SharingUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharingUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharingUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharingUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharingUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharingUpdate(Response response) + { + if (response is null) + { + return null; } - return new SharingUpdate(operationType, Optional.ToList(groups)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharingUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.cs index a20229b5daa2..41da288c6673 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SharingUpdate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies information about the gallery sharing profile update. public partial class SharingUpdate { - /// Initializes a new instance of SharingUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// This property allows you to specify the operation type of gallery sharing update. <br><br> Possible values are: <br><br> **Add** <br><br> **Remove** <br><br> **Reset**. public SharingUpdate(SharingUpdateOperationType operationType) { @@ -21,13 +25,20 @@ public SharingUpdate(SharingUpdateOperationType operationType) Groups = new ChangeTrackingList(); } - /// Initializes a new instance of SharingUpdate. + /// Initializes a new instance of . /// This property allows you to specify the operation type of gallery sharing update. <br><br> Possible values are: <br><br> **Add** <br><br> **Remove** <br><br> **Reset**. /// A list of sharing profile groups. - internal SharingUpdate(SharingUpdateOperationType operationType, IList groups) + /// Keeps track of any properties unknown to the library. + internal SharingUpdate(SharingUpdateOperationType operationType, IList groups, Dictionary serializedAdditionalRawData) { OperationType = operationType; Groups = groups; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SharingUpdate() + { } /// This property allows you to specify the operation type of gallery sharing update. <br><br> Possible values are: <br><br> **Add** <br><br> **Remove** <br><br> **Reset**. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotData.Serialization.cs index c4db067cc7ca..16028f5f252e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotData.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class SnapshotData : IUtf8JsonSerializable + public partial class SnapshotData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(ExtendedLocation)) { @@ -58,17 +71,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PurchasePlan)) { writer.WritePropertyName("purchasePlan"u8); - writer.WriteObjectValue(PurchasePlan); + if (PurchasePlan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurchasePlan).Serialize(writer, options); + } } if (Optional.IsDefined(SupportedCapabilities)) { writer.WritePropertyName("supportedCapabilities"u8); - writer.WriteObjectValue(SupportedCapabilities); + if (SupportedCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SupportedCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(DiskSizeGB)) { @@ -78,7 +112,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EncryptionSettingsGroup)) { writer.WritePropertyName("encryptionSettingsCollection"u8); - writer.WriteObjectValue(EncryptionSettingsGroup); + if (EncryptionSettingsGroup is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionSettingsGroup).Serialize(writer, options); + } } if (Optional.IsDefined(Incremental)) { @@ -88,7 +129,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkAccessPolicy)) { @@ -103,7 +151,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SupportsHibernation)) { @@ -123,7 +178,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CopyCompletionError)) { writer.WritePropertyName("copyCompletionError"u8); - writer.WriteObjectValue(CopyCompletionError); + if (CopyCompletionError is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CopyCompletionError).Serialize(writer, options); + } } if (Optional.IsDefined(DataAccessAuthMode)) { @@ -131,11 +193,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DataAccessAuthMode.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SnapshotData DeserializeSnapshotData(JsonElement element) + internal static SnapshotData DeserializeSnapshotData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -172,6 +248,7 @@ internal static SnapshotData DeserializeSnapshotData(JsonElement element) Optional completionPercent = default; Optional copyCompletionError = default; Optional dataAccessAuthMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedBy"u8)) @@ -447,8 +524,61 @@ internal static SnapshotData DeserializeSnapshotData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SnapshotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, managedBy.Value, sku.Value, extendedLocation, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), Optional.ToNullable(diskState), uniqueId.Value, encryptionSettingsGroup.Value, provisioningState.Value, Optional.ToNullable(incremental), incrementalSnapshotFamilyId.Value, encryption.Value, Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, securityProfile.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(completionPercent), copyCompletionError.Value, Optional.ToNullable(dataAccessAuthMode), serializedAdditionalRawData); + } + + SnapshotData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotData model) + { + if (model is null) + { + return null; } - return new SnapshotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, managedBy.Value, sku.Value, extendedLocation, Optional.ToNullable(timeCreated), Optional.ToNullable(osType), Optional.ToNullable(hyperVGeneration), purchasePlan.Value, supportedCapabilities.Value, creationData.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(diskSizeBytes), Optional.ToNullable(diskState), uniqueId.Value, encryptionSettingsGroup.Value, provisioningState.Value, Optional.ToNullable(incremental), incrementalSnapshotFamilyId.Value, encryption.Value, Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, securityProfile.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(completionPercent), copyCompletionError.Value, Optional.ToNullable(dataAccessAuthMode)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.Serialization.cs index eb772ac74d7e..fc009c3466c8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class SnapshotList + internal partial class SnapshotList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SnapshotList DeserializeSnapshotList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SnapshotList DeserializeSnapshotList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static SnapshotList DeserializeSnapshotList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SnapshotList(value, nextLink.Value); + return new SnapshotList(value, nextLink.Value, serializedAdditionalRawData); + } + + SnapshotList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.cs index 592dd3d502e3..a30701b289fc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Snapshots operation response. internal partial class SnapshotList { - /// Initializes a new instance of SnapshotList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// A list of snapshots. /// is null. internal SnapshotList(IEnumerable value) @@ -26,13 +29,20 @@ internal SnapshotList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SnapshotList. + /// Initializes a new instance of . /// A list of snapshots. /// The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. - internal SnapshotList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SnapshotList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SnapshotList() + { } /// A list of snapshots. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.Serialization.cs index e725a0df3ef1..10cfa36fa51c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SnapshotPatch : IUtf8JsonSerializable + public partial class SnapshotPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -29,7 +37,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,12 +61,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EncryptionSettingsGroup)) { writer.WritePropertyName("encryptionSettingsCollection"u8); - writer.WriteObjectValue(EncryptionSettingsGroup); + if (EncryptionSettingsGroup is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionSettingsGroup).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkAccessPolicy)) { @@ -81,10 +110,234 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SupportedCapabilities)) { writer.WritePropertyName("supportedCapabilities"u8); - writer.WriteObjectValue(SupportedCapabilities); + if (SupportedCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SupportedCapabilities).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SnapshotPatch DeserializeSnapshotPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional sku = default; + Optional osType = default; + Optional diskSizeGB = default; + Optional encryptionSettingsGroup = default; + Optional encryption = default; + Optional networkAccessPolicy = default; + Optional diskAccessId = default; + Optional supportsHibernation = default; + Optional publicNetworkAccess = default; + Optional dataAccessAuthMode = default; + Optional supportedCapabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = SnapshotSku.DeserializeSnapshotSku(property.Value); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("osType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osType = property0.Value.GetString().ToSupportedOperatingSystemType(); + continue; + } + if (property0.NameEquals("diskSizeGB"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGB = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("encryptionSettingsCollection"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryptionSettingsGroup = EncryptionSettingsGroup.DeserializeEncryptionSettingsGroup(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = DiskEncryption.DeserializeDiskEncryption(property0.Value); + continue; + } + if (property0.NameEquals("networkAccessPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkAccessPolicy = new NetworkAccessPolicy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("diskAccessId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskAccessId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("supportsHibernation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportsHibernation = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new DiskPublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("dataAccessAuthMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataAccessAuthMode = new DataAccessAuthMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("supportedCapabilities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportedCapabilities = SupportedCapabilities.DeserializeSupportedCapabilities(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SnapshotPatch(Optional.ToDictionary(tags), sku.Value, Optional.ToNullable(osType), Optional.ToNullable(diskSizeGB), encryptionSettingsGroup.Value, encryption.Value, Optional.ToNullable(networkAccessPolicy), diskAccessId.Value, Optional.ToNullable(supportsHibernation), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(dataAccessAuthMode), supportedCapabilities.Value, serializedAdditionalRawData); + } + + SnapshotPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.cs index 0dd8ab2d4bec..719d6166897c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,46 @@ namespace Azure.ResourceManager.Compute.Models /// Snapshot update resource. public partial class SnapshotPatch { - /// Initializes a new instance of SnapshotPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SnapshotPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. + /// the Operating System type. + /// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + /// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + /// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + /// Policy for accessing the disk via network. + /// ARM id of the DiskAccess resource for using private endpoints on disks. + /// Indicates the OS on a snapshot supports hibernation. + /// Policy for controlling export on the disk. + /// Additional authentication requirements when exporting or uploading to a disk or snapshot. + /// List of supported capabilities for the image from which the OS disk was created. + /// Keeps track of any properties unknown to the library. + internal SnapshotPatch(IDictionary tags, SnapshotSku sku, SupportedOperatingSystemType? osType, int? diskSizeGB, EncryptionSettingsGroup encryptionSettingsGroup, DiskEncryption encryption, NetworkAccessPolicy? networkAccessPolicy, ResourceIdentifier diskAccessId, bool? supportsHibernation, DiskPublicNetworkAccess? publicNetworkAccess, DataAccessAuthMode? dataAccessAuthMode, SupportedCapabilities supportedCapabilities, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Sku = sku; + OSType = osType; + DiskSizeGB = diskSizeGB; + EncryptionSettingsGroup = encryptionSettingsGroup; + Encryption = encryption; + NetworkAccessPolicy = networkAccessPolicy; + DiskAccessId = diskAccessId; + SupportsHibernation = supportsHibernation; + PublicNetworkAccess = publicNetworkAccess; + DataAccessAuthMode = dataAccessAuthMode; + SupportedCapabilities = supportedCapabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } /// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.Serialization.cs index 4cb4343e5c16..4bccad9a06a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SnapshotSku : IUtf8JsonSerializable + public partial class SnapshotSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SnapshotSku DeserializeSnapshotSku(JsonElement element) + internal static SnapshotSku DeserializeSnapshotSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -47,8 +70,61 @@ internal static SnapshotSku DeserializeSnapshotSku(JsonElement element) tier = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SnapshotSku(Optional.ToNullable(name), tier.Value, serializedAdditionalRawData); + } + + SnapshotSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SnapshotSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSnapshotSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SnapshotSku model) + { + if (model is null) + { + return null; } - return new SnapshotSku(Optional.ToNullable(name), tier.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SnapshotSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSnapshotSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.cs index f5ead87303af..99c2e7617a20 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SnapshotSku.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. public partial class SnapshotSku { - /// Initializes a new instance of SnapshotSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SnapshotSku() { } - /// Initializes a new instance of SnapshotSku. + /// Initializes a new instance of . /// The sku name. /// The sku tier. - internal SnapshotSku(SnapshotStorageAccountType? name, string tier) + /// Keeps track of any properties unknown to the library. + internal SnapshotSku(SnapshotStorageAccountType? name, string tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The sku name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.Serialization.cs index 7690fcdcf4a6..211af5a8b41d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class SoftDeletePolicy : IUtf8JsonSerializable + internal partial class SoftDeletePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSoftDeleteEnabled)) { writer.WritePropertyName("isSoftDeleteEnabled"u8); writer.WriteBooleanValue(IsSoftDeleteEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SoftDeletePolicy DeserializeSoftDeletePolicy(JsonElement element) + internal static SoftDeletePolicy DeserializeSoftDeletePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isSoftDeleteEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isSoftDeleteEnabled"u8)) @@ -41,8 +64,61 @@ internal static SoftDeletePolicy DeserializeSoftDeletePolicy(JsonElement element isSoftDeleteEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SoftDeletePolicy(Optional.ToNullable(isSoftDeleteEnabled), serializedAdditionalRawData); + } + + SoftDeletePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSoftDeletePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SoftDeletePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSoftDeletePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SoftDeletePolicy model) + { + if (model is null) + { + return null; } - return new SoftDeletePolicy(Optional.ToNullable(isSoftDeleteEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SoftDeletePolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSoftDeletePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.cs index d8cdc9fb0d15..5233b1936762 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SoftDeletePolicy.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains information about the soft deletion policy of the gallery. internal partial class SoftDeletePolicy { - /// Initializes a new instance of SoftDeletePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SoftDeletePolicy() { } - /// Initializes a new instance of SoftDeletePolicy. + /// Initializes a new instance of . /// Enables soft-deletion for resources in this gallery, allowing them to be recovered within retention time. - internal SoftDeletePolicy(bool? isSoftDeleteEnabled) + /// Keeps track of any properties unknown to the library. + internal SoftDeletePolicy(bool? isSoftDeleteEnabled, Dictionary serializedAdditionalRawData) { IsSoftDeleteEnabled = isSoftDeleteEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Enables soft-deletion for resources in this gallery, allowing them to be recovered within retention time. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.Serialization.cs index 3f910529962d..6f6c43092225 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SpotRestorePolicy : IUtf8JsonSerializable + public partial class SpotRestorePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Enabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("restoreTimeout"u8); writer.WriteStringValue(RestoreTimeout); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SpotRestorePolicy DeserializeSpotRestorePolicy(JsonElement element) + internal static SpotRestorePolicy DeserializeSpotRestorePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional restoreTimeout = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -52,8 +75,61 @@ internal static SpotRestorePolicy DeserializeSpotRestorePolicy(JsonElement eleme restoreTimeout = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SpotRestorePolicy(Optional.ToNullable(enabled), restoreTimeout.Value, serializedAdditionalRawData); + } + + SpotRestorePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSpotRestorePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SpotRestorePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSpotRestorePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SpotRestorePolicy model) + { + if (model is null) + { + return null; } - return new SpotRestorePolicy(Optional.ToNullable(enabled), restoreTimeout.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SpotRestorePolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSpotRestorePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.cs index c03c7af1bcd6..0df9e89f13f0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SpotRestorePolicy.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the Spot-Try-Restore properties for the virtual machine scale set. With this property customer can enable or disable automatic restore of the evicted Spot VMSS VM instances opportunistically based on capacity availability and pricing constraint. public partial class SpotRestorePolicy { - /// Initializes a new instance of SpotRestorePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SpotRestorePolicy() { } - /// Initializes a new instance of SpotRestorePolicy. + /// Initializes a new instance of . /// Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints. /// Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances. - internal SpotRestorePolicy(bool? enabled, string restoreTimeout) + /// Keeps track of any properties unknown to the library. + internal SpotRestorePolicy(bool? enabled, string restoreTimeout, Dictionary serializedAdditionalRawData) { Enabled = enabled; RestoreTimeout = restoreTimeout; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Enables the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.Serialization.cs index c75333691b2d..6c725e60596e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class SshConfiguration : IUtf8JsonSerializable + internal partial class SshConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PublicKeys)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PublicKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SshConfiguration DeserializeSshConfiguration(JsonElement element) + internal static SshConfiguration DeserializeSshConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> publicKeys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicKeys"u8)) @@ -52,8 +81,61 @@ internal static SshConfiguration DeserializeSshConfiguration(JsonElement element publicKeys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SshConfiguration(Optional.ToList(publicKeys), serializedAdditionalRawData); + } + + SshConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSshConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SshConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSshConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SshConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SshConfiguration(Response response) + { + if (response is null) + { + return null; } - return new SshConfiguration(Optional.ToList(publicKeys)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSshConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.cs index 8f8fa81dbbc8..2f86be5025d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// SSH configuration for Linux based VMs running on Azure. internal partial class SshConfiguration { - /// Initializes a new instance of SshConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SshConfiguration() { PublicKeys = new ChangeTrackingList(); } - /// Initializes a new instance of SshConfiguration. + /// Initializes a new instance of . /// The list of SSH public keys used to authenticate with linux based VMs. - internal SshConfiguration(IList publicKeys) + /// Keeps track of any properties unknown to the library. + internal SshConfiguration(IList publicKeys, Dictionary serializedAdditionalRawData) { PublicKeys = publicKeys; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of SSH public keys used to authenticate with linux based VMs. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.Serialization.cs index 18e7af2303bf..245960d6e652 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SshPublicKeyConfiguration : IUtf8JsonSerializable + public partial class SshPublicKeyConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyData"u8); writer.WriteStringValue(KeyData); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SshPublicKeyConfiguration DeserializeSshPublicKeyConfiguration(JsonElement element) + internal static SshPublicKeyConfiguration DeserializeSshPublicKeyConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional path = default; Optional keyData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -48,8 +71,61 @@ internal static SshPublicKeyConfiguration DeserializeSshPublicKeyConfiguration(J keyData = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SshPublicKeyConfiguration(path.Value, keyData.Value, serializedAdditionalRawData); + } + + SshPublicKeyConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSshPublicKeyConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SshPublicKeyConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSshPublicKeyConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SshPublicKeyConfiguration model) + { + if (model is null) + { + return null; } - return new SshPublicKeyConfiguration(path.Value, keyData.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SshPublicKeyConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSshPublicKeyConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.cs index 9c1a5711b216..54289d63cbb4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. public partial class SshPublicKeyConfiguration { - /// Initializes a new instance of SshPublicKeyConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SshPublicKeyConfiguration() { } - /// Initializes a new instance of SshPublicKeyConfiguration. + /// Initializes a new instance of . /// Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys. /// SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure]https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). - internal SshPublicKeyConfiguration(string path, string keyData) + /// Keeps track of any properties unknown to the library. + internal SshPublicKeyConfiguration(string path, string keyData, Dictionary serializedAdditionalRawData) { Path = path; KeyData = keyData; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyData.Serialization.cs index 1ae73e62d0a9..b48dded49f2c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class SshPublicKeyData : IUtf8JsonSerializable + public partial class SshPublicKeyData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -38,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicKey); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SshPublicKeyData DeserializeSshPublicKeyData(JsonElement element) + internal static SshPublicKeyData DeserializeSshPublicKeyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +75,7 @@ internal static SshPublicKeyData DeserializeSshPublicKeyData(JsonElement element ResourceType type = default; Optional systemData = default; Optional publicKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -116,8 +138,61 @@ internal static SshPublicKeyData DeserializeSshPublicKeyData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SshPublicKeyData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, publicKey.Value, serializedAdditionalRawData); + } + + SshPublicKeyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSshPublicKeyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SshPublicKeyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSshPublicKeyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SshPublicKeyData model) + { + if (model is null) + { + return null; } - return new SshPublicKeyData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, publicKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SshPublicKeyData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSshPublicKeyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs index 6a1d1cbbbe21..9d7ba8d4ee38 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs @@ -5,15 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SshPublicKeyGenerateKeyPairResult + public partial class SshPublicKeyGenerateKeyPairResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SshPublicKeyGenerateKeyPairResult DeserializeSshPublicKeyGenerateKeyPairResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("privateKey"u8); + writer.WriteStringValue(PrivateKey); + writer.WritePropertyName("publicKey"u8); + writer.WriteStringValue(PublicKey); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SshPublicKeyGenerateKeyPairResult DeserializeSshPublicKeyGenerateKeyPairResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +55,7 @@ internal static SshPublicKeyGenerateKeyPairResult DeserializeSshPublicKeyGenerat string privateKey = default; string publicKey = default; ResourceIdentifier id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("privateKey"u8)) @@ -38,8 +73,61 @@ internal static SshPublicKeyGenerateKeyPairResult DeserializeSshPublicKeyGenerat id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SshPublicKeyGenerateKeyPairResult(privateKey, publicKey, id); + return new SshPublicKeyGenerateKeyPairResult(privateKey, publicKey, id, serializedAdditionalRawData); + } + + SshPublicKeyGenerateKeyPairResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSshPublicKeyGenerateKeyPairResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SshPublicKeyGenerateKeyPairResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSshPublicKeyGenerateKeyPairResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SshPublicKeyGenerateKeyPairResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SshPublicKeyGenerateKeyPairResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSshPublicKeyGenerateKeyPairResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs index 6722fa8b59ba..ffb494c4bad1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Response from generation of an SSH key pair. public partial class SshPublicKeyGenerateKeyPairResult { - /// Initializes a new instance of SshPublicKeyGenerateKeyPairResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. @@ -29,6 +33,24 @@ internal SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey, Id = id; } + /// Initializes a new instance of . + /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. + /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. + /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + /// Keeps track of any properties unknown to the library. + internal SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey, ResourceIdentifier id, Dictionary serializedAdditionalRawData) + { + PrivateKey = privateKey; + PublicKey = publicKey; + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SshPublicKeyGenerateKeyPairResult() + { + } + /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. public string PrivateKey { get; } /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.Serialization.cs index 0d37f6f67e16..46bbd75de6a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SshPublicKeyPatch : IUtf8JsonSerializable + public partial class SshPublicKeyPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,120 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicKey); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SshPublicKeyPatch DeserializeSshPublicKeyPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional publicKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("publicKey"u8)) + { + publicKey = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SshPublicKeyPatch(Optional.ToDictionary(tags), publicKey.Value, serializedAdditionalRawData); + } + + SshPublicKeyPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSshPublicKeyPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SshPublicKeyPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSshPublicKeyPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SshPublicKeyPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SshPublicKeyPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSshPublicKeyPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.cs index 13866956903a..21f8fdafab4f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyPatch.cs @@ -5,16 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies information about the SSH public key. public partial class SshPublicKeyPatch : ComputeResourcePatch { - /// Initializes a new instance of SshPublicKeyPatch. + /// Initializes a new instance of . public SshPublicKeyPatch() { } + /// Initializes a new instance of . + /// Resource tags. + /// SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. + /// Keeps track of any properties unknown to the library. + internal SshPublicKeyPatch(IDictionary tags, string publicKey, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + PublicKey = publicKey; + } + /// SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. public string PublicKey { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.Serialization.cs index ec844d661202..dca4357d3ac4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class SshPublicKeysGroupListResult + internal partial class SshPublicKeysGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SshPublicKeysGroupListResult DeserializeSshPublicKeysGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SshPublicKeysGroupListResult DeserializeSshPublicKeysGroupListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static SshPublicKeysGroupListResult DeserializeSshPublicKeysGroupListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SshPublicKeysGroupListResult(value, nextLink.Value); + return new SshPublicKeysGroupListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + SshPublicKeysGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSshPublicKeysGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SshPublicKeysGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSshPublicKeysGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SshPublicKeysGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SshPublicKeysGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSshPublicKeysGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.cs index 74bee2f18bdf..70430376e940 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeysGroupListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list SSH public keys operation response. internal partial class SshPublicKeysGroupListResult { - /// Initializes a new instance of SshPublicKeysGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of SSH public keys. /// is null. internal SshPublicKeysGroupListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal SshPublicKeysGroupListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SshPublicKeysGroupListResult. + /// Initializes a new instance of . /// The list of SSH public keys. /// The URI to fetch the next page of SSH public keys. Call ListNext() with this URI to fetch the next page of SSH public keys. - internal SshPublicKeysGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SshPublicKeysGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SshPublicKeysGroupListResult() + { } /// The list of SSH public keys. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.Serialization.cs index ab9782acb800..1da2c2121914 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class StatusCodeCount + public partial class StatusCodeCount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static StatusCodeCount DeserializeStatusCodeCount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static StatusCodeCount DeserializeStatusCodeCount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -36,8 +65,61 @@ internal static StatusCodeCount DeserializeStatusCodeCount(JsonElement element) count = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new StatusCodeCount(code.Value, Optional.ToNullable(count)); + return new StatusCodeCount(code.Value, Optional.ToNullable(count), serializedAdditionalRawData); + } + + StatusCodeCount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStatusCodeCount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StatusCodeCount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStatusCodeCount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StatusCodeCount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StatusCodeCount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStatusCodeCount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.cs index 551b97cff009..e1ed20be0885 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/StatusCodeCount.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The status code and count of the cloud service instance view statuses. public partial class StatusCodeCount { - /// Initializes a new instance of StatusCodeCount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal StatusCodeCount() { } - /// Initializes a new instance of StatusCodeCount. + /// Initializes a new instance of . /// The instance view status code. /// Number of instances having this status code. - internal StatusCodeCount(string code, int? count) + /// Keeps track of any properties unknown to the library. + internal StatusCodeCount(string code, int? count, Dictionary serializedAdditionalRawData) { Code = code; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The instance view status code. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions.cs index e981509e1e41..058e4615bf45 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions.cs @@ -37,6 +37,11 @@ public SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions(AzureLocation Version = version; } + /// Initializes a new instance of for deserialization. + internal SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions() + { + } + /// The name of a supported Azure region. public AzureLocation Location { get; } /// The name of the edge zone. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions.cs index 626c60518ad5..0229162727e0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions.cs @@ -34,6 +34,11 @@ public SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions(AzureLocation Skus = skus; } + /// Initializes a new instance of for deserialization. + internal SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions() + { + } + /// The name of a supported Azure region. public AzureLocation Location { get; } /// The name of the edge zone. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesOptions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesOptions.cs index 41a134da49f8..f7fd6dd4a9d8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesOptions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubscriptionResourceGetVirtualMachineImagesOptions.cs @@ -31,6 +31,11 @@ public SubscriptionResourceGetVirtualMachineImagesOptions(AzureLocation location Skus = skus; } + /// Initializes a new instance of for deserialization. + internal SubscriptionResourceGetVirtualMachineImagesOptions() + { + } + /// The name of a supported Azure region. public AzureLocation Location { get; } /// A valid image publisher. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.Serialization.cs index 60a4f5209eb1..5e694ae0d6bb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class SupportedCapabilities : IUtf8JsonSerializable + public partial class SupportedCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskControllerTypes)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("architecture"u8); writer.WriteStringValue(Architecture.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SupportedCapabilities DeserializeSupportedCapabilities(JsonElement element) + internal static SupportedCapabilities DeserializeSupportedCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static SupportedCapabilities DeserializeSupportedCapabilities(JsonEleme Optional diskControllerTypes = default; Optional acceleratedNetwork = default; Optional architecture = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskControllerTypes"u8)) @@ -67,8 +90,61 @@ internal static SupportedCapabilities DeserializeSupportedCapabilities(JsonEleme architecture = new ArchitectureType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SupportedCapabilities(diskControllerTypes.Value, Optional.ToNullable(acceleratedNetwork), Optional.ToNullable(architecture), serializedAdditionalRawData); + } + + SupportedCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSupportedCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SupportedCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSupportedCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SupportedCapabilities model) + { + if (model is null) + { + return null; } - return new SupportedCapabilities(diskControllerTypes.Value, Optional.ToNullable(acceleratedNetwork), Optional.ToNullable(architecture)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SupportedCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSupportedCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.cs index 94ae5e0c9e93..ee8e8c8e6dc9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SupportedCapabilities.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// List of supported capabilities persisted on the disk resource for VM use. public partial class SupportedCapabilities { - /// Initializes a new instance of SupportedCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SupportedCapabilities() { } - /// Initializes a new instance of SupportedCapabilities. + /// Initializes a new instance of . /// The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI. /// True if the image from which the OS disk is created supports accelerated networking. /// CPU architecture supported by an OS disk. - internal SupportedCapabilities(string diskControllerTypes, bool? acceleratedNetwork, ArchitectureType? architecture) + /// Keeps track of any properties unknown to the library. + internal SupportedCapabilities(string diskControllerTypes, bool? acceleratedNetwork, ArchitectureType? architecture, Dictionary serializedAdditionalRawData) { DiskControllerTypes = diskControllerTypes; AcceleratedNetwork = acceleratedNetwork; Architecture = architecture; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.Serialization.cs index c8802a029736..d0ea0da5d81d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class TargetRegion : IUtf8JsonSerializable + public partial class TargetRegion : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -30,18 +38,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(IsExcludedFromLatest)) { writer.WritePropertyName("excludeFromLatest"u8); writer.WriteBooleanValue(IsExcludedFromLatest.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TargetRegion DeserializeTargetRegion(JsonElement element) + internal static TargetRegion DeserializeTargetRegion(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +80,7 @@ internal static TargetRegion DeserializeTargetRegion(JsonElement element) Optional storageAccountType = default; Optional encryption = default; Optional excludeFromLatest = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -94,8 +124,61 @@ internal static TargetRegion DeserializeTargetRegion(JsonElement element) excludeFromLatest = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TargetRegion(name, Optional.ToNullable(regionalReplicaCount), Optional.ToNullable(storageAccountType), encryption.Value, Optional.ToNullable(excludeFromLatest), serializedAdditionalRawData); + } + + TargetRegion IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTargetRegion(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TargetRegion IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTargetRegion(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TargetRegion model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TargetRegion(Response response) + { + if (response is null) + { + return null; } - return new TargetRegion(name, Optional.ToNullable(regionalReplicaCount), Optional.ToNullable(storageAccountType), encryption.Value, Optional.ToNullable(excludeFromLatest)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTargetRegion(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.cs index d729f8d2d746..b90501c09763 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TargetRegion.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the target region information. public partial class TargetRegion { - /// Initializes a new instance of TargetRegion. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the region. /// is null. public TargetRegion(string name) @@ -23,19 +27,26 @@ public TargetRegion(string name) Name = name; } - /// Initializes a new instance of TargetRegion. + /// Initializes a new instance of . /// The name of the region. /// The number of replicas of the Image Version to be created per region. This property is updatable. /// Specifies the storage account type to be used to store the image. This property is not updatable. /// Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact. /// Contains the flag setting to hide an image when users specify version='latest'. - internal TargetRegion(string name, int? regionalReplicaCount, ImageStorageAccountType? storageAccountType, EncryptionImages encryption, bool? isExcludedFromLatest) + /// Keeps track of any properties unknown to the library. + internal TargetRegion(string name, int? regionalReplicaCount, ImageStorageAccountType? storageAccountType, EncryptionImages encryption, bool? isExcludedFromLatest, Dictionary serializedAdditionalRawData) { Name = name; RegionalReplicaCount = regionalReplicaCount; StorageAccountType = storageAccountType; Encryption = encryption; IsExcludedFromLatest = isExcludedFromLatest; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetRegion() + { } /// The name of the region. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.Serialization.cs index c9a34ef87d1c..a5edf1a952f4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class TerminateNotificationProfile : IUtf8JsonSerializable + public partial class TerminateNotificationProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NotBeforeTimeout)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enable"u8); writer.WriteBooleanValue(Enable.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TerminateNotificationProfile DeserializeTerminateNotificationProfile(JsonElement element) + internal static TerminateNotificationProfile DeserializeTerminateNotificationProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional notBeforeTimeout = default; Optional enable = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("notBeforeTimeout"u8)) @@ -52,8 +75,61 @@ internal static TerminateNotificationProfile DeserializeTerminateNotificationPro enable = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TerminateNotificationProfile(notBeforeTimeout.Value, Optional.ToNullable(enable), serializedAdditionalRawData); + } + + TerminateNotificationProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTerminateNotificationProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TerminateNotificationProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTerminateNotificationProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TerminateNotificationProfile model) + { + if (model is null) + { + return null; } - return new TerminateNotificationProfile(notBeforeTimeout.Value, Optional.ToNullable(enable)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TerminateNotificationProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTerminateNotificationProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.cs index 497675b258ee..1c21955e5d78 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/TerminateNotificationProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The TerminateNotificationProfile. public partial class TerminateNotificationProfile { - /// Initializes a new instance of TerminateNotificationProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TerminateNotificationProfile() { } - /// Initializes a new instance of TerminateNotificationProfile. + /// Initializes a new instance of . /// Configurable length of time a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event before the event is auto approved (timed out). The configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M). /// Specifies whether the Terminate Scheduled event is enabled or disabled. - internal TerminateNotificationProfile(string notBeforeTimeout, bool? enable) + /// Keeps track of any properties unknown to the library. + internal TerminateNotificationProfile(string notBeforeTimeout, bool? enable, Dictionary serializedAdditionalRawData) { NotBeforeTimeout = notBeforeTimeout; Enable = enable; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Configurable length of time a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event before the event is auto approved (timed out). The configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.Serialization.cs index b6cdca16c6af..18e599de5d2e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class ThrottledRequestsContent : IUtf8JsonSerializable + public partial class ThrottledRequestsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("blobContainerSasUri"u8); writer.WriteStringValue(BlobContainerSasUri.AbsoluteUri); @@ -46,7 +54,155 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("groupByUserAgent"u8); writer.WriteBooleanValue(GroupByUserAgent.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ThrottledRequestsContent DeserializeThrottledRequestsContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri blobContainerSasUri = default; + DateTimeOffset fromTime = default; + DateTimeOffset toTime = default; + Optional groupByThrottlePolicy = default; + Optional groupByOperationName = default; + Optional groupByResourceName = default; + Optional groupByClientApplicationId = default; + Optional groupByUserAgent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("blobContainerSasUri"u8)) + { + blobContainerSasUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("fromTime"u8)) + { + fromTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("toTime"u8)) + { + toTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("groupByThrottlePolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByThrottlePolicy = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByOperationName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByOperationName = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByResourceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByResourceName = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByClientApplicationId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByClientApplicationId = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("groupByUserAgent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupByUserAgent = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ThrottledRequestsContent(blobContainerSasUri, fromTime, toTime, Optional.ToNullable(groupByThrottlePolicy), Optional.ToNullable(groupByOperationName), Optional.ToNullable(groupByResourceName), Optional.ToNullable(groupByClientApplicationId), Optional.ToNullable(groupByUserAgent), serializedAdditionalRawData); + } + + ThrottledRequestsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeThrottledRequestsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ThrottledRequestsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeThrottledRequestsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ThrottledRequestsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ThrottledRequestsContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeThrottledRequestsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.cs index dfa34df9d477..e12fce58bb2e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ThrottledRequestsContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.Compute.Models /// Api request input for LogAnalytics getThrottledRequests Api. public partial class ThrottledRequestsContent : LogAnalyticsInputBase { - /// Initializes a new instance of ThrottledRequestsContent. + /// Initializes a new instance of . /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. /// From time of the query. /// To time of the query. @@ -22,5 +23,24 @@ public ThrottledRequestsContent(Uri blobContainerSasUri, DateTimeOffset fromTime { Argument.AssertNotNull(blobContainerSasUri, nameof(blobContainerSasUri)); } + + /// Initializes a new instance of . + /// SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + /// From time of the query. + /// To time of the query. + /// Group query result by Throttle Policy applied. + /// Group query result by Operation Name. + /// Group query result by Resource Name. + /// Group query result by Client Application ID. + /// Group query result by User Agent. + /// Keeps track of any properties unknown to the library. + internal ThrottledRequestsContent(Uri blobContainerSasUri, DateTimeOffset fromTime, DateTimeOffset toTime, bool? groupByThrottlePolicy, bool? groupByOperationName, bool? groupByResourceName, bool? groupByClientApplicationId, bool? groupByUserAgent, Dictionary serializedAdditionalRawData) : base(blobContainerSasUri, fromTime, toTime, groupByThrottlePolicy, groupByOperationName, groupByResourceName, groupByClientApplicationId, groupByUserAgent, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal ThrottledRequestsContent() + { + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.Serialization.cs index ae043c06315f..7bb188bdbc16 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UefiSettings : IUtf8JsonSerializable + public partial class UefiSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSecureBootEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("vTpmEnabled"u8); writer.WriteBooleanValue(IsVirtualTpmEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UefiSettings DeserializeUefiSettings(JsonElement element) + internal static UefiSettings DeserializeUefiSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional secureBootEnabled = default; Optional vTpmEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secureBootEnabled"u8)) @@ -56,8 +79,61 @@ internal static UefiSettings DeserializeUefiSettings(JsonElement element) vTpmEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UefiSettings(Optional.ToNullable(secureBootEnabled), Optional.ToNullable(vTpmEnabled), serializedAdditionalRawData); + } + + UefiSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUefiSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UefiSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUefiSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UefiSettings model) + { + if (model is null) + { + return null; } - return new UefiSettings(Optional.ToNullable(secureBootEnabled), Optional.ToNullable(vTpmEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UefiSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUefiSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.cs index 6db4d949be2f..f9e1e9a98bbc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UefiSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the security settings like secure boot and vTPM used while creating the virtual machine. Minimum api-version: 2020-12-01. public partial class UefiSettings { - /// Initializes a new instance of UefiSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UefiSettings() { } - /// Initializes a new instance of UefiSettings. + /// Initializes a new instance of . /// Specifies whether secure boot should be enabled on the virtual machine. Minimum api-version: 2020-12-01. /// Specifies whether vTPM should be enabled on the virtual machine. Minimum api-version: 2020-12-01. - internal UefiSettings(bool? isSecureBootEnabled, bool? isVirtualTpmEnabled) + /// Keeps track of any properties unknown to the library. + internal UefiSettings(bool? isSecureBootEnabled, bool? isVirtualTpmEnabled, Dictionary serializedAdditionalRawData) { IsSecureBootEnabled = isSecureBootEnabled; IsVirtualTpmEnabled = isVirtualTpmEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies whether secure boot should be enabled on the virtual machine. Minimum api-version: 2020-12-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.Serialization.cs index 20625442c9e9..676b9b1c3b0f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.Serialization.cs @@ -5,27 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UpdateDomainIdentifier : IUtf8JsonSerializable + public partial class UpdateDomainIdentifier : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UpdateDomainIdentifier DeserializeUpdateDomainIdentifier(JsonElement element) + internal static UpdateDomainIdentifier DeserializeUpdateDomainIdentifier(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -42,8 +65,61 @@ internal static UpdateDomainIdentifier DeserializeUpdateDomainIdentifier(JsonEle name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateDomainIdentifier(id.Value, name.Value, serializedAdditionalRawData); + } + + UpdateDomainIdentifier IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateDomainIdentifier(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateDomainIdentifier IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateDomainIdentifier(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateDomainIdentifier model) + { + if (model is null) + { + return null; } - return new UpdateDomainIdentifier(id.Value, name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateDomainIdentifier(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateDomainIdentifier(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.cs index ef04f15875de..7c3399f7c6ba 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainIdentifier.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Compute.Models /// Defines an update domain for the cloud service. public partial class UpdateDomainIdentifier { - /// Initializes a new instance of UpdateDomainIdentifier. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateDomainIdentifier() { } - /// Initializes a new instance of UpdateDomainIdentifier. + /// Initializes a new instance of . /// Resource Id. /// Resource Name. - internal UpdateDomainIdentifier(ResourceIdentifier id, string name) + /// Keeps track of any properties unknown to the library. + internal UpdateDomainIdentifier(ResourceIdentifier id, string name, Dictionary serializedAdditionalRawData) { Id = id; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.Serialization.cs index efc9c3180510..3f3e72f177b3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class UpdateDomainListResult + internal partial class UpdateDomainListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpdateDomainListResult DeserializeUpdateDomainListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpdateDomainListResult DeserializeUpdateDomainListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static UpdateDomainListResult DeserializeUpdateDomainListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpdateDomainListResult(value, nextLink.Value); + return new UpdateDomainListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + UpdateDomainListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateDomainListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateDomainListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateDomainListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateDomainListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateDomainListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateDomainListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.cs index 461b331ce5c6..9084f6a63600 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainListResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// The list operation result. internal partial class UpdateDomainListResult { - /// Initializes a new instance of UpdateDomainListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of resources. /// is null. internal UpdateDomainListResult(IEnumerable value) @@ -25,13 +28,20 @@ internal UpdateDomainListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of UpdateDomainListResult. + /// Initializes a new instance of . /// The list of resources. /// The URI to fetch the next page of resources. Use this to get the next page of resources. Do this till nextLink is null to fetch all the resources. - internal UpdateDomainListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UpdateDomainListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UpdateDomainListResult() + { } /// The list of resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.Serialization.cs index 2c09a083f08a..d606e2f83fdb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UpgradeOperationHistoricalStatusInfo + public partial class UpgradeOperationHistoricalStatusInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpgradeOperationHistoricalStatusInfo DeserializeUpgradeOperationHistoricalStatusInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpgradeOperationHistoricalStatusInfo DeserializeUpgradeOperationHistoricalStatusInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static UpgradeOperationHistoricalStatusInfo DeserializeUpgradeOperation Optional properties = default; Optional type = default; Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -46,8 +75,61 @@ internal static UpgradeOperationHistoricalStatusInfo DeserializeUpgradeOperation location = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpgradeOperationHistoricalStatusInfo(properties.Value, type.Value, Optional.ToNullable(location)); + return new UpgradeOperationHistoricalStatusInfo(properties.Value, type.Value, Optional.ToNullable(location), serializedAdditionalRawData); + } + + UpgradeOperationHistoricalStatusInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpgradeOperationHistoricalStatusInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpgradeOperationHistoricalStatusInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpgradeOperationHistoricalStatusInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpgradeOperationHistoricalStatusInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpgradeOperationHistoricalStatusInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpgradeOperationHistoricalStatusInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs index 9c97c40037fe..5769695a71f7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfo.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.Compute.Models /// Virtual Machine Scale Set OS Upgrade History operation response. public partial class UpgradeOperationHistoricalStatusInfo { - /// Initializes a new instance of UpgradeOperationHistoricalStatusInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpgradeOperationHistoricalStatusInfo() { } - /// Initializes a new instance of UpgradeOperationHistoricalStatusInfo. + /// Initializes a new instance of . /// Information about the properties of the upgrade operation. /// Resource type. /// Resource location. - internal UpgradeOperationHistoricalStatusInfo(UpgradeOperationHistoricalStatusInfoProperties properties, string upgradeOperationHistoricalStatusInfoType, AzureLocation? location) + /// Keeps track of any properties unknown to the library. + internal UpgradeOperationHistoricalStatusInfo(UpgradeOperationHistoricalStatusInfoProperties properties, string upgradeOperationHistoricalStatusInfoType, AzureLocation? location, Dictionary serializedAdditionalRawData) { Properties = properties; UpgradeOperationHistoricalStatusInfoType = upgradeOperationHistoricalStatusInfoType; Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Information about the properties of the upgrade operation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.Serialization.cs index dedf8dcf6d41..a5b4e226c13c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UpgradeOperationHistoricalStatusInfoProperties + public partial class UpgradeOperationHistoricalStatusInfoProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpgradeOperationHistoricalStatusInfoProperties DeserializeUpgradeOperationHistoricalStatusInfoProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpgradeOperationHistoricalStatusInfoProperties DeserializeUpgradeOperationHistoricalStatusInfoProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +52,7 @@ internal static UpgradeOperationHistoricalStatusInfoProperties DeserializeUpgrad Optional startedBy = default; Optional targetImageReference = default; Optional rollbackInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("runningStatus"u8)) @@ -80,8 +109,61 @@ internal static UpgradeOperationHistoricalStatusInfoProperties DeserializeUpgrad rollbackInfo = RollbackStatusInfo.DeserializeRollbackStatusInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpgradeOperationHistoricalStatusInfoProperties(runningStatus.Value, progress.Value, error.Value, Optional.ToNullable(startedBy), targetImageReference.Value, rollbackInfo.Value); + return new UpgradeOperationHistoricalStatusInfoProperties(runningStatus.Value, progress.Value, error.Value, Optional.ToNullable(startedBy), targetImageReference.Value, rollbackInfo.Value, serializedAdditionalRawData); + } + + UpgradeOperationHistoricalStatusInfoProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpgradeOperationHistoricalStatusInfoProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpgradeOperationHistoricalStatusInfoProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpgradeOperationHistoricalStatusInfoProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpgradeOperationHistoricalStatusInfoProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpgradeOperationHistoricalStatusInfoProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpgradeOperationHistoricalStatusInfoProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs index e9f434838d14..d295034bed04 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoricalStatusInfoProperties.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes each OS upgrade on the Virtual Machine Scale Set. public partial class UpgradeOperationHistoricalStatusInfoProperties { - /// Initializes a new instance of UpgradeOperationHistoricalStatusInfoProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpgradeOperationHistoricalStatusInfoProperties() { } - /// Initializes a new instance of UpgradeOperationHistoricalStatusInfoProperties. + /// Initializes a new instance of . /// Information about the overall status of the upgrade operation. /// Counts of the VMs in each state. /// Error Details for this upgrade if there are any. /// Invoker of the Upgrade Operation. /// Image Reference details. /// Information about OS rollback if performed. - internal UpgradeOperationHistoricalStatusInfoProperties(UpgradeOperationHistoryStatus runningStatus, RollingUpgradeProgressInfo progress, ComputeApiError error, UpgradeOperationInvoker? startedBy, ImageReference targetImageReference, RollbackStatusInfo rollbackInfo) + /// Keeps track of any properties unknown to the library. + internal UpgradeOperationHistoricalStatusInfoProperties(UpgradeOperationHistoryStatus runningStatus, RollingUpgradeProgressInfo progress, ComputeApiError error, UpgradeOperationInvoker? startedBy, ImageReference targetImageReference, RollbackStatusInfo rollbackInfo, Dictionary serializedAdditionalRawData) { RunningStatus = runningStatus; Progress = progress; @@ -30,6 +37,7 @@ internal UpgradeOperationHistoricalStatusInfoProperties(UpgradeOperationHistoryS StartedBy = startedBy; TargetImageReference = targetImageReference; RollbackInfo = rollbackInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Information about the overall status of the upgrade operation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.Serialization.cs index 695a673373ee..cdbc1192e5c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UpgradeOperationHistoryStatus + public partial class UpgradeOperationHistoryStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpgradeOperationHistoryStatus DeserializeUpgradeOperationHistoryStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpgradeOperationHistoryStatus DeserializeUpgradeOperationHistoryStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static UpgradeOperationHistoryStatus DeserializeUpgradeOperationHistory Optional code = default; Optional startTime = default; Optional endTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -51,8 +79,61 @@ internal static UpgradeOperationHistoryStatus DeserializeUpgradeOperationHistory endTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpgradeOperationHistoryStatus(Optional.ToNullable(code), Optional.ToNullable(startTime), Optional.ToNullable(endTime)); + return new UpgradeOperationHistoryStatus(Optional.ToNullable(code), Optional.ToNullable(startTime), Optional.ToNullable(endTime), serializedAdditionalRawData); + } + + UpgradeOperationHistoryStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpgradeOperationHistoryStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpgradeOperationHistoryStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpgradeOperationHistoryStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpgradeOperationHistoryStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpgradeOperationHistoryStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpgradeOperationHistoryStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs index 9f37a1731d30..2b04abf75096 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpgradeOperationHistoryStatus.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Information about the current running state of the overall upgrade. public partial class UpgradeOperationHistoryStatus { - /// Initializes a new instance of UpgradeOperationHistoryStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpgradeOperationHistoryStatus() { } - /// Initializes a new instance of UpgradeOperationHistoryStatus. + /// Initializes a new instance of . /// Code indicating the current status of the upgrade. /// Start time of the upgrade. /// End time of the upgrade. - internal UpgradeOperationHistoryStatus(UpgradeState? code, DateTimeOffset? startOn, DateTimeOffset? endOn) + /// Keeps track of any properties unknown to the library. + internal UpgradeOperationHistoryStatus(UpgradeState? code, DateTimeOffset? startOn, DateTimeOffset? endOn, Dictionary serializedAdditionalRawData) { Code = code; StartOn = startOn; EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Code indicating the current status of the upgrade. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.Serialization.cs index 37d15b5ba4e1..3179045b7c21 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UserArtifactManagement : IUtf8JsonSerializable + public partial class UserArtifactManagement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("install"u8); writer.WriteStringValue(Install); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("update"u8); writer.WriteStringValue(Update); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserArtifactManagement DeserializeUserArtifactManagement(JsonElement element) + internal static UserArtifactManagement DeserializeUserArtifactManagement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static UserArtifactManagement DeserializeUserArtifactManagement(JsonEle string install = default; string @remove = default; Optional update = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("install"u8)) @@ -53,8 +76,61 @@ internal static UserArtifactManagement DeserializeUserArtifactManagement(JsonEle update = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserArtifactManagement(install, @remove, update.Value, serializedAdditionalRawData); + } + + UserArtifactManagement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserArtifactManagement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserArtifactManagement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserArtifactManagement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserArtifactManagement model) + { + if (model is null) + { + return null; } - return new UserArtifactManagement(install, @remove, update.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserArtifactManagement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserArtifactManagement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.cs index 8188830a6cfa..ed6c4ece7351 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactManagement.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// The UserArtifactManagement. public partial class UserArtifactManagement { - /// Initializes a new instance of UserArtifactManagement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Required. The path and arguments to install the gallery application. This is limited to 4096 characters. /// Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. /// or is null. @@ -26,15 +30,22 @@ public UserArtifactManagement(string install, string @remove) Remove = @remove; } - /// Initializes a new instance of UserArtifactManagement. + /// Initializes a new instance of . /// Required. The path and arguments to install the gallery application. This is limited to 4096 characters. /// Required. The path and arguments to remove the gallery application. This is limited to 4096 characters. /// Optional. The path and arguments to update the gallery application. If not present, then update operation will invoke remove command on the previous version and install command on the current version of the gallery application. This is limited to 4096 characters. - internal UserArtifactManagement(string install, string @remove, string update) + /// Keeps track of any properties unknown to the library. + internal UserArtifactManagement(string install, string @remove, string update, Dictionary serializedAdditionalRawData) { Install = install; Remove = @remove; Update = update; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UserArtifactManagement() + { } /// Required. The path and arguments to install the gallery application. This is limited to 4096 characters. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.Serialization.cs index 6e964c08f384..28396ce2874c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UserArtifactSettings : IUtf8JsonSerializable + public partial class UserArtifactSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PackageFileName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("configFileName"u8); writer.WriteStringValue(ConfigFileName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserArtifactSettings DeserializeUserArtifactSettings(JsonElement element) + internal static UserArtifactSettings DeserializeUserArtifactSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional packageFileName = default; Optional configFileName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("packageFileName"u8)) @@ -48,8 +71,61 @@ internal static UserArtifactSettings DeserializeUserArtifactSettings(JsonElement configFileName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserArtifactSettings(packageFileName.Value, configFileName.Value, serializedAdditionalRawData); + } + + UserArtifactSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserArtifactSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserArtifactSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserArtifactSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserArtifactSettings model) + { + if (model is null) + { + return null; } - return new UserArtifactSettings(packageFileName.Value, configFileName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserArtifactSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserArtifactSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.cs index e2b7f48baa4b..7791e193f4b9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Additional settings for the VM app that contains the target package and config file name when it is deployed to target VM or VM scale set. public partial class UserArtifactSettings { - /// Initializes a new instance of UserArtifactSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UserArtifactSettings() { } - /// Initializes a new instance of UserArtifactSettings. + /// Initializes a new instance of . /// Optional. The name to assign the downloaded package file on the VM. This is limited to 4096 characters. If not specified, the package file will be named the same as the Gallery Application name. /// Optional. The name to assign the downloaded config file on the VM. This is limited to 4096 characters. If not specified, the config file will be named the Gallery Application name appended with "_config". - internal UserArtifactSettings(string packageFileName, string configFileName) + /// Keeps track of any properties unknown to the library. + internal UserArtifactSettings(string packageFileName, string configFileName, Dictionary serializedAdditionalRawData) { PackageFileName = packageFileName; ConfigFileName = configFileName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Optional. The name to assign the downloaded package file on the VM. This is limited to 4096 characters. If not specified, the package file will be named the same as the Gallery Application name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.Serialization.cs index 82079166b086..b3c4cb631cfc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class UserArtifactSource : IUtf8JsonSerializable + public partial class UserArtifactSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("mediaLink"u8); writer.WriteStringValue(MediaLink); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("defaultConfigurationLink"u8); writer.WriteStringValue(DefaultConfigurationLink); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserArtifactSource DeserializeUserArtifactSource(JsonElement element) + internal static UserArtifactSource DeserializeUserArtifactSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string mediaLink = default; Optional defaultConfigurationLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaLink"u8)) @@ -45,8 +68,61 @@ internal static UserArtifactSource DeserializeUserArtifactSource(JsonElement ele defaultConfigurationLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserArtifactSource(mediaLink, defaultConfigurationLink.Value, serializedAdditionalRawData); + } + + UserArtifactSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserArtifactSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserArtifactSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserArtifactSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserArtifactSource model) + { + if (model is null) + { + return null; } - return new UserArtifactSource(mediaLink, defaultConfigurationLink.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserArtifactSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserArtifactSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.cs index 559556251157..876f105e4995 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UserArtifactSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// The source image from which the Image Version is going to be created. public partial class UserArtifactSource { - /// Initializes a new instance of UserArtifactSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Required. The mediaLink of the artifact, must be a readable storage page blob. /// is null. public UserArtifactSource(string mediaLink) @@ -23,13 +27,20 @@ public UserArtifactSource(string mediaLink) MediaLink = mediaLink; } - /// Initializes a new instance of UserArtifactSource. + /// Initializes a new instance of . /// Required. The mediaLink of the artifact, must be a readable storage page blob. /// Optional. The defaultConfigurationLink of the artifact, must be a readable storage page blob. - internal UserArtifactSource(string mediaLink, string defaultConfigurationLink) + /// Keeps track of any properties unknown to the library. + internal UserArtifactSource(string mediaLink, string defaultConfigurationLink, Dictionary serializedAdditionalRawData) { MediaLink = mediaLink; DefaultConfigurationLink = defaultConfigurationLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UserArtifactSource() + { } /// Required. The mediaLink of the artifact, must be a readable storage page blob. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.Serialization.cs index 4d96b6e32ad4..d85f4ce84090 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VaultCertificate : IUtf8JsonSerializable + public partial class VaultCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CertificateUri)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certificateStore"u8); writer.WriteStringValue(CertificateStore); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VaultCertificate DeserializeVaultCertificate(JsonElement element) + internal static VaultCertificate DeserializeVaultCertificate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional certificateUrl = default; Optional certificateStore = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificateUrl"u8)) @@ -53,8 +75,61 @@ internal static VaultCertificate DeserializeVaultCertificate(JsonElement element certificateStore = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VaultCertificate(certificateUrl.Value, certificateStore.Value, serializedAdditionalRawData); + } + + VaultCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVaultCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VaultCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVaultCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VaultCertificate model) + { + if (model is null) + { + return null; } - return new VaultCertificate(certificateUrl.Value, certificateStore.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VaultCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVaultCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.cs index ec9f0213faa0..dad429f58f3d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultCertificate.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. public partial class VaultCertificate { - /// Initializes a new instance of VaultCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VaultCertificate() { } - /// Initializes a new instance of VaultCertificate. + /// Initializes a new instance of . /// This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault virtual machine extension for Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). /// For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of these files are .pem formatted. - internal VaultCertificate(Uri certificateUri, string certificateStore) + /// Keeps track of any properties unknown to the library. + internal VaultCertificate(Uri certificateUri, string certificateStore, Dictionary serializedAdditionalRawData) { CertificateUri = certificateUri; CertificateStore = certificateStore; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault virtual machine extension for Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs index e6982c38aabf..aeb71d283fbe 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VaultSecretGroup : IUtf8JsonSerializable + public partial class VaultSecretGroup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceVault)) { @@ -28,21 +35,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VaultCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element) + internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sourceVault = default; Optional> vaultCertificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault"u8)) @@ -68,8 +97,61 @@ internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element vaultCertificates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VaultSecretGroup(sourceVault, Optional.ToList(vaultCertificates), serializedAdditionalRawData); + } + + VaultSecretGroup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVaultSecretGroup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VaultSecretGroup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVaultSecretGroup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VaultSecretGroup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VaultSecretGroup(Response response) + { + if (response is null) + { + return null; } - return new VaultSecretGroup(sourceVault, Optional.ToList(vaultCertificates)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVaultSecretGroup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs index 24a02fa2e89c..2e587b5fd4cc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a set of certificates which are all in the same Key Vault. public partial class VaultSecretGroup { - /// Initializes a new instance of VaultSecretGroup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VaultSecretGroup() { VaultCertificates = new ChangeTrackingList(); } - /// Initializes a new instance of VaultSecretGroup. + /// Initializes a new instance of . /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. /// The list of key vault references in SourceVault which contain certificates. - internal VaultSecretGroup(WritableSubResource sourceVault, IList vaultCertificates) + /// Keeps track of any properties unknown to the library. + internal VaultSecretGroup(WritableSubResource sourceVault, IList vaultCertificates, Dictionary serializedAdditionalRawData) { SourceVault = sourceVault; VaultCertificates = vaultCertificates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.Serialization.cs index c703785f619b..5a22506d177d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualHardDisk : IUtf8JsonSerializable + internal partial class VirtualHardDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Uri)) { writer.WritePropertyName("uri"u8); writer.WriteStringValue(Uri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualHardDisk DeserializeVirtualHardDisk(JsonElement element) + internal static VirtualHardDisk DeserializeVirtualHardDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional uri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uri"u8)) @@ -42,8 +64,61 @@ internal static VirtualHardDisk DeserializeVirtualHardDisk(JsonElement element) uri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualHardDisk(uri.Value, serializedAdditionalRawData); + } + + VirtualHardDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualHardDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualHardDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualHardDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualHardDisk model) + { + if (model is null) + { + return null; } - return new VirtualHardDisk(uri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualHardDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualHardDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.cs index 428284ff4bfe..b97b45467bdd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualHardDisk.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes the uri of a disk. internal partial class VirtualHardDisk { - /// Initializes a new instance of VirtualHardDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualHardDisk() { } - /// Initializes a new instance of VirtualHardDisk. + /// Initializes a new instance of . /// Specifies the virtual hard disk's uri. - internal VirtualHardDisk(Uri uri) + /// Keeps track of any properties unknown to the library. + internal VirtualHardDisk(Uri uri, Dictionary serializedAdditionalRawData) { Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the virtual hard disk's uri. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.Serialization.cs index 4b812d38e2de..83a7fd45047a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.Serialization.cs @@ -5,16 +5,82 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineAgentInstanceView + public partial class VirtualMachineAgentInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(VmAgentVersion)) + { + writer.WritePropertyName("vmAgentVersion"u8); + writer.WriteStringValue(VmAgentVersion); + } + if (Optional.IsCollectionDefined(ExtensionHandlers)) + { + writer.WritePropertyName("extensionHandlers"u8); + writer.WriteStartArray(); + foreach (var item in ExtensionHandlers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +88,7 @@ internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentIn Optional vmAgentVersion = default; Optional> extensionHandlers = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmAgentVersion"u8)) @@ -57,8 +124,61 @@ internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentIn statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineAgentInstanceView(vmAgentVersion.Value, Optional.ToList(extensionHandlers), Optional.ToList(statuses), serializedAdditionalRawData); + } + + VirtualMachineAgentInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineAgentInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineAgentInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineAgentInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineAgentInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineAgentInstanceView(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineAgentInstanceView(vmAgentVersion.Value, Optional.ToList(extensionHandlers), Optional.ToList(statuses)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineAgentInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs index d7afe668bdbc..0b62697993e0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAgentInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of the VM Agent running on the virtual machine. public partial class VirtualMachineAgentInstanceView { - /// Initializes a new instance of VirtualMachineAgentInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineAgentInstanceView() { ExtensionHandlers = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineAgentInstanceView. + /// Initializes a new instance of . /// The VM Agent full version. /// The virtual machine extension handler instance view. /// The resource status information. - internal VirtualMachineAgentInstanceView(string vmAgentVersion, IReadOnlyList extensionHandlers, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineAgentInstanceView(string vmAgentVersion, IReadOnlyList extensionHandlers, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { VmAgentVersion = vmAgentVersion; ExtensionHandlers = extensionHandlers; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The VM Agent full version. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.Serialization.cs index c46c63abef51..6445a70987f1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineAssessPatchesResult + public partial class VirtualMachineAssessPatchesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineAssessPatchesResult DeserializeVirtualMachineAssessPatchesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineAssessPatchesResult DeserializeVirtualMachineAssessPatchesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +54,7 @@ internal static VirtualMachineAssessPatchesResult DeserializeVirtualMachineAsses Optional startDateTime = default; Optional> availablePatches = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -103,8 +130,61 @@ internal static VirtualMachineAssessPatchesResult DeserializeVirtualMachineAsses error = ComputeApiError.DeserializeComputeApiError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineAssessPatchesResult(Optional.ToNullable(status), assessmentActivityId.Value, Optional.ToNullable(rebootPending), Optional.ToNullable(criticalAndSecurityPatchCount), Optional.ToNullable(otherPatchCount), Optional.ToNullable(startDateTime), Optional.ToList(availablePatches), error.Value); + return new VirtualMachineAssessPatchesResult(Optional.ToNullable(status), assessmentActivityId.Value, Optional.ToNullable(rebootPending), Optional.ToNullable(criticalAndSecurityPatchCount), Optional.ToNullable(otherPatchCount), Optional.ToNullable(startDateTime), Optional.ToList(availablePatches), error.Value, serializedAdditionalRawData); + } + + VirtualMachineAssessPatchesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineAssessPatchesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineAssessPatchesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineAssessPatchesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineAssessPatchesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineAssessPatchesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineAssessPatchesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs index 15447581a955..6a7bd0faa365 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineAssessPatchesResult.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of an AssessPatches result. public partial class VirtualMachineAssessPatchesResult { - /// Initializes a new instance of VirtualMachineAssessPatchesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineAssessPatchesResult() { AvailablePatches = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineAssessPatchesResult. + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred. @@ -29,7 +32,8 @@ internal VirtualMachineAssessPatchesResult() /// The UTC timestamp when the operation began. /// The list of patches that have been detected as available for installation. /// The errors that were encountered during execution of the operation. The details array contains the list of them. - internal VirtualMachineAssessPatchesResult(PatchOperationStatus? status, string assessmentActivityId, bool? rebootPending, int? criticalAndSecurityPatchCount, int? otherPatchCount, DateTimeOffset? startOn, IReadOnlyList availablePatches, ComputeApiError error) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineAssessPatchesResult(PatchOperationStatus? status, string assessmentActivityId, bool? rebootPending, int? criticalAndSecurityPatchCount, int? otherPatchCount, DateTimeOffset? startOn, IReadOnlyList availablePatches, ComputeApiError error, Dictionary serializedAdditionalRawData) { Status = status; AssessmentActivityId = assessmentActivityId; @@ -39,6 +43,7 @@ internal VirtualMachineAssessPatchesResult(PatchOperationStatus? status, string StartOn = startOn; AvailablePatches = availablePatches; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or "CompletedWithWarnings.". diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.Serialization.cs index d24676b563a5..76f9045b63a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineCaptureContent : IUtf8JsonSerializable + public partial class VirtualMachineCaptureContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vhdPrefix"u8); writer.WriteStringValue(VhdPrefix); @@ -21,7 +29,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DestinationContainerName); writer.WritePropertyName("overwriteVhds"u8); writer.WriteBooleanValue(OverwriteVhds); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineCaptureContent DeserializeVirtualMachineCaptureContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string vhdPrefix = default; + string destinationContainerName = default; + bool overwriteVhds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdPrefix"u8)) + { + vhdPrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("destinationContainerName"u8)) + { + destinationContainerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("overwriteVhds"u8)) + { + overwriteVhds = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineCaptureContent(vhdPrefix, destinationContainerName, overwriteVhds, serializedAdditionalRawData); + } + + VirtualMachineCaptureContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineCaptureContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineCaptureContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineCaptureContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineCaptureContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineCaptureContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineCaptureContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.cs index b238646ef50e..2bda6a6a7bf5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Capture Virtual Machine parameters. public partial class VirtualMachineCaptureContent { - /// Initializes a new instance of VirtualMachineCaptureContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The captured virtual hard disk's name prefix. /// The destination container name. /// Specifies whether to overwrite the destination virtual hard disk, in case of conflict. @@ -28,6 +32,24 @@ public VirtualMachineCaptureContent(string vhdPrefix, string destinationContaine OverwriteVhds = overwriteVhds; } + /// Initializes a new instance of . + /// The captured virtual hard disk's name prefix. + /// The destination container name. + /// Specifies whether to overwrite the destination virtual hard disk, in case of conflict. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineCaptureContent(string vhdPrefix, string destinationContainerName, bool overwriteVhds, Dictionary serializedAdditionalRawData) + { + VhdPrefix = vhdPrefix; + DestinationContainerName = destinationContainerName; + OverwriteVhds = overwriteVhds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineCaptureContent() + { + } + /// The captured virtual hard disk's name prefix. public string VhdPrefix { get; } /// The destination container name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs index be29755ff4a4..2e0509768793 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineCaptureResult : IUtf8JsonSerializable + public partial class VirtualMachineCaptureResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineCaptureResult DeserializeVirtualMachineCaptureResult(JsonElement element) + internal static VirtualMachineCaptureResult DeserializeVirtualMachineCaptureResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +56,7 @@ internal static VirtualMachineCaptureResult DeserializeVirtualMachineCaptureResu Optional parameters = default; Optional> resources = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("$schema"u8)) @@ -87,8 +108,61 @@ internal static VirtualMachineCaptureResult DeserializeVirtualMachineCaptureResu id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineCaptureResult(id.Value, schema.Value, contentVersion.Value, parameters.Value, Optional.ToList(resources), serializedAdditionalRawData); + } + + VirtualMachineCaptureResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineCaptureResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineCaptureResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineCaptureResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineCaptureResult model) + { + if (model is null) + { + return null; } - return new VirtualMachineCaptureResult(id.Value, schema.Value, contentVersion.Value, parameters.Value, Optional.ToList(resources)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineCaptureResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineCaptureResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs index 94c39d98794e..8667904b3bb8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs @@ -14,19 +14,20 @@ namespace Azure.ResourceManager.Compute.Models /// Output of virtual machine capture operation. public partial class VirtualMachineCaptureResult : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineCaptureResult. + /// Initializes a new instance of . public VirtualMachineCaptureResult() { Resources = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineCaptureResult. + /// Initializes a new instance of . /// Resource Id. /// the schema of the captured virtual machine. /// the version of the content. /// parameters of the captured virtual machine. /// a list of resource items of the captured virtual machine. - internal VirtualMachineCaptureResult(ResourceIdentifier id, string schema, string contentVersion, BinaryData parameters, IReadOnlyList resources) : base(id) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineCaptureResult(ResourceIdentifier id, string schema, string contentVersion, BinaryData parameters, IReadOnlyList resources, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Schema = schema; ContentVersion = contentVersion; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs index 4fac90c07220..ca7311394339 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineData : IUtf8JsonSerializable + public partial class VirtualMachineData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); - writer.WriteObjectValue(Plan); + if (Plan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Plan).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -63,37 +76,86 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(DiagnosticsProfile)) { writer.WritePropertyName("diagnosticsProfile"u8); - writer.WriteObjectValue(DiagnosticsProfile); + if (DiagnosticsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AvailabilitySet)) { @@ -123,7 +185,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BillingProfile)) { writer.WritePropertyName("billingProfile"u8); - writer.WriteObjectValue(BillingProfile); + if (BillingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BillingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(Host)) { @@ -153,7 +222,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ScheduledEventsProfile)) { writer.WritePropertyName("scheduledEventsProfile"u8); - writer.WriteObjectValue(ScheduledEventsProfile); + if (ScheduledEventsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduledEventsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(UserData)) { @@ -163,19 +239,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CapacityReservation)) { writer.WritePropertyName("capacityReservation"u8); - writer.WriteObjectValue(CapacityReservation); + if (CapacityReservation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CapacityReservation).Serialize(writer, options); + } } if (Optional.IsDefined(ApplicationProfile)) { writer.WritePropertyName("applicationProfile"u8); - writer.WriteObjectValue(ApplicationProfile); + if (ApplicationProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApplicationProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element) + internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -217,6 +321,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele Optional capacityReservation = default; Optional applicationProfile = default; Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("plan"u8)) @@ -543,8 +648,61 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, plan.Value, Optional.ToList(resources), identity, Optional.ToList(zones), extendedLocation, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet, virtualMachineScaleSet, proximityPlacementGroup, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host, hostGroup, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + VirtualMachineData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineData(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, plan.Value, Optional.ToList(resources), identity, Optional.ToList(zones), extendedLocation, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet, virtualMachineScaleSet, proximityPlacementGroup, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host, hostGroup, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value, Optional.ToNullable(timeCreated)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.Serialization.cs index 106fec66c193..f06bfcb15b33 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineDataDisk : IUtf8JsonSerializable + public partial class VirtualMachineDataDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lun"u8); writer.WriteNumberValue(Lun); @@ -25,12 +33,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Vhd)) { writer.WritePropertyName("vhd"u8); - writer.WriteObjectValue(Vhd); + if (Vhd is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Vhd).Serialize(writer, options); + } } if (Optional.IsDefined(Image)) { writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image); + if (Image is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Image).Serialize(writer, options); + } } if (Optional.IsDefined(Caching)) { @@ -52,7 +74,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(ToBeDetached)) { @@ -69,11 +98,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("deleteOption"u8); writer.WriteStringValue(DeleteOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineDataDisk DeserializeVirtualMachineDataDisk(JsonElement element) + internal static VirtualMachineDataDisk DeserializeVirtualMachineDataDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -92,6 +135,7 @@ internal static VirtualMachineDataDisk DeserializeVirtualMachineDataDisk(JsonEle Optional diskMBpsReadWrite = default; Optional detachOption = default; Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun"u8)) @@ -208,8 +252,61 @@ internal static VirtualMachineDataDisk DeserializeVirtualMachineDataDisk(JsonEle deleteOption = new DiskDeleteOptionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineDataDisk(lun, name.Value, vhd.Value, image.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(toBeDetached), Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(detachOption), Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineDataDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineDataDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineDataDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineDataDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineDataDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineDataDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineDataDisk(lun, name.Value, vhd.Value, image.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(toBeDetached), Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(detachOption), Optional.ToNullable(deleteOption)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineDataDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.cs index 5cd16c3acd76..741a24555926 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDataDisk.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes a data disk. public partial class VirtualMachineDataDisk { - /// Initializes a new instance of VirtualMachineDataDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. /// Specifies how the virtual machine should be created. Possible values are: **Attach.** This value is used when you are using a specialized disk to create the virtual machine. **FromImage.** This value is used when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described. public VirtualMachineDataDisk(int lun, DiskCreateOptionType createOption) @@ -21,7 +25,7 @@ public VirtualMachineDataDisk(int lun, DiskCreateOptionType createOption) CreateOption = createOption; } - /// Initializes a new instance of VirtualMachineDataDisk. + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. /// The disk name. /// The virtual hard disk. @@ -36,7 +40,8 @@ public VirtualMachineDataDisk(int lun, DiskCreateOptionType createOption) /// Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine Scale Set. /// Specifies the detach behavior to be used while detaching a disk or which is already in the process of detachment from the virtual machine. Supported values: **ForceDetach.** detachOption: **ForceDetach** is applicable only for managed data disks. If a previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when using this detach behavior. **This feature is still in preview** mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. /// Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when VM is deleted. **Detach.** If this value is used, the data disk is retained after VM is deleted. The default value is set to **Detach**. - internal VirtualMachineDataDisk(int lun, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingType? caching, bool? writeAcceleratorEnabled, DiskCreateOptionType createOption, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, bool? toBeDetached, long? diskIopsReadWrite, long? diskMBpsReadWrite, DiskDetachOptionType? detachOption, DiskDeleteOptionType? deleteOption) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineDataDisk(int lun, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingType? caching, bool? writeAcceleratorEnabled, DiskCreateOptionType createOption, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, bool? toBeDetached, long? diskIopsReadWrite, long? diskMBpsReadWrite, DiskDetachOptionType? detachOption, DiskDeleteOptionType? deleteOption, Dictionary serializedAdditionalRawData) { Lun = lun; Name = name; @@ -52,6 +57,12 @@ internal VirtualMachineDataDisk(int lun, string name, VirtualHardDisk vhd, Virtu DiskMBpsReadWrite = diskMBpsReadWrite; DetachOption = detachOption; DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineDataDisk() + { } /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.Serialization.cs index 2af6d897b6c9..4d8fdd482b8e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineDiskSecurityProfile : IUtf8JsonSerializable + public partial class VirtualMachineDiskSecurityProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecurityEncryptionType)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskEncryptionSet"u8); JsonSerializer.Serialize(writer, DiskEncryptionSet); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineDiskSecurityProfile DeserializeVirtualMachineDiskSecurityProfile(JsonElement element) + internal static VirtualMachineDiskSecurityProfile DeserializeVirtualMachineDiskSecurityProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional securityEncryptionType = default; Optional diskEncryptionSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("securityEncryptionType"u8)) @@ -57,8 +80,61 @@ internal static VirtualMachineDiskSecurityProfile DeserializeVirtualMachineDiskS diskEncryptionSet = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineDiskSecurityProfile(Optional.ToNullable(securityEncryptionType), diskEncryptionSet, serializedAdditionalRawData); + } + + VirtualMachineDiskSecurityProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineDiskSecurityProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineDiskSecurityProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineDiskSecurityProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineDiskSecurityProfile model) + { + if (model is null) + { + return null; } - return new VirtualMachineDiskSecurityProfile(Optional.ToNullable(securityEncryptionType), diskEncryptionSet); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineDiskSecurityProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineDiskSecurityProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.cs index 957152d7ba5e..2b6c0938890a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineDiskSecurityProfile.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,18 +15,23 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the security profile settings for the managed disk. **Note:** It can only be set for Confidential VMs. public partial class VirtualMachineDiskSecurityProfile { - /// Initializes a new instance of VirtualMachineDiskSecurityProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineDiskSecurityProfile() { } - /// Initializes a new instance of VirtualMachineDiskSecurityProfile. + /// Initializes a new instance of . /// Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly for encryption of just the VMGuestState blob. **Note:** It can be set for only Confidential VMs. /// Specifies the customer managed disk encryption set resource id for the managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and VMGuest blob. - internal VirtualMachineDiskSecurityProfile(SecurityEncryptionType? securityEncryptionType, WritableSubResource diskEncryptionSet) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineDiskSecurityProfile(SecurityEncryptionType? securityEncryptionType, WritableSubResource diskEncryptionSet, Dictionary serializedAdditionalRawData) { SecurityEncryptionType = securityEncryptionType; DiskEncryptionSet = diskEncryptionSet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and VMGuestStateOnly for encryption of just the VMGuestState blob. **Note:** It can be set for only Confidential VMs. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionData.Serialization.cs index 38a37e1e7fd2..e710ddc344f6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineExtensionData : IUtf8JsonSerializable + public partial class VirtualMachineExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -85,7 +91,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(InstanceView)) { writer.WritePropertyName("instanceView"u8); - writer.WriteObjectValue(InstanceView); + if (InstanceView is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InstanceView).Serialize(writer, options); + } } if (Optional.IsDefined(SuppressFailures)) { @@ -95,7 +108,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProtectedSettings)) { writer.WritePropertyName("protectedSettingsFromKeyVault"u8); - writer.WriteObjectValue(KeyVaultProtectedSettings); + if (KeyVaultProtectedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProtectedSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(ProvisionAfterExtensions)) { @@ -108,11 +128,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineExtensionData DeserializeVirtualMachineExtensionData(JsonElement element) + internal static VirtualMachineExtensionData DeserializeVirtualMachineExtensionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -136,6 +170,7 @@ internal static VirtualMachineExtensionData DeserializeVirtualMachineExtensionDa Optional suppressFailures = default; Optional protectedSettingsFromKeyVault = default; Optional> provisionAfterExtensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -295,8 +330,61 @@ internal static VirtualMachineExtensionData DeserializeVirtualMachineExtensionDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineExtensionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, Optional.ToList(provisionAfterExtensions)); + return new VirtualMachineExtensionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, Optional.ToList(provisionAfterExtensions), serializedAdditionalRawData); + } + + VirtualMachineExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineExtensionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.Serialization.cs index cf359d40220a..31ec6dd5c38c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.Serialization.cs @@ -5,15 +5,65 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineExtensionHandlerInstanceView + public partial class VirtualMachineExtensionHandlerInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineExtensionHandlerInstanceView DeserializeVirtualMachineExtensionHandlerInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(VirtualMachineExtensionHandlerInstanceViewType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(VirtualMachineExtensionHandlerInstanceViewType); + } + if (Optional.IsDefined(TypeHandlerVersion)) + { + writer.WritePropertyName("typeHandlerVersion"u8); + writer.WriteStringValue(TypeHandlerVersion); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + if (Status is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Status).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineExtensionHandlerInstanceView DeserializeVirtualMachineExtensionHandlerInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +71,7 @@ internal static VirtualMachineExtensionHandlerInstanceView DeserializeVirtualMac Optional type = default; Optional typeHandlerVersion = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -42,8 +93,61 @@ internal static VirtualMachineExtensionHandlerInstanceView DeserializeVirtualMac status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineExtensionHandlerInstanceView(type.Value, typeHandlerVersion.Value, status.Value); + return new VirtualMachineExtensionHandlerInstanceView(type.Value, typeHandlerVersion.Value, status.Value, serializedAdditionalRawData); + } + + VirtualMachineExtensionHandlerInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineExtensionHandlerInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineExtensionHandlerInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineExtensionHandlerInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineExtensionHandlerInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineExtensionHandlerInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineExtensionHandlerInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs index f50722576118..444c7aadbe8f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionHandlerInstanceView.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The instance view of a virtual machine extension handler. public partial class VirtualMachineExtensionHandlerInstanceView { - /// Initializes a new instance of VirtualMachineExtensionHandlerInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineExtensionHandlerInstanceView() { } - /// Initializes a new instance of VirtualMachineExtensionHandlerInstanceView. + /// Initializes a new instance of . /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. /// The extension handler status. - internal VirtualMachineExtensionHandlerInstanceView(string virtualMachineExtensionHandlerInstanceViewType, string typeHandlerVersion, InstanceViewStatus status) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineExtensionHandlerInstanceView(string virtualMachineExtensionHandlerInstanceViewType, string typeHandlerVersion, InstanceViewStatus status, Dictionary serializedAdditionalRawData) { VirtualMachineExtensionHandlerInstanceViewType = virtualMachineExtensionHandlerInstanceViewType; TypeHandlerVersion = typeHandlerVersion; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the type of the extension; an example is "CustomScriptExtension". diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionImageData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionImageData.Serialization.cs index 5cc9ea30050e..0b071d895d12 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionImageData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionImageData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineExtensionImageData : IUtf8JsonSerializable + public partial class VirtualMachineExtensionImageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -58,11 +65,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(SupportsMultipleExtensions.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineExtensionImageData DeserializeVirtualMachineExtensionImageData(JsonElement element) + internal static VirtualMachineExtensionImageData DeserializeVirtualMachineExtensionImageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +99,7 @@ internal static VirtualMachineExtensionImageData DeserializeVirtualMachineExtens Optional handlerSchema = default; Optional virtualMachineScaleSetEnabled = default; Optional supportsMultipleExtensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -168,8 +190,61 @@ internal static VirtualMachineExtensionImageData DeserializeVirtualMachineExtens } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineExtensionImageData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, operatingSystem.Value, computeRole.Value, handlerSchema.Value, Optional.ToNullable(virtualMachineScaleSetEnabled), Optional.ToNullable(supportsMultipleExtensions), serializedAdditionalRawData); + } + + VirtualMachineExtensionImageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineExtensionImageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineExtensionImageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineExtensionImageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineExtensionImageData model) + { + if (model is null) + { + return null; } - return new VirtualMachineExtensionImageData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, operatingSystem.Value, computeRole.Value, handlerSchema.Value, Optional.ToNullable(virtualMachineScaleSetEnabled), Optional.ToNullable(supportsMultipleExtensions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineExtensionImageData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineExtensionImageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.Serialization.cs index 22b6a16d114e..f4972849a222 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineExtensionInstanceView : IUtf8JsonSerializable + public partial class VirtualMachineExtensionInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -37,7 +44,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Substatuses) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,15 +61,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Statuses) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExtensionInstanceView(JsonElement element) + internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExtensionInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +100,7 @@ internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExt Optional typeHandlerVersion = default; Optional> substatuses = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -110,8 +146,61 @@ internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExt statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, Optional.ToList(substatuses), Optional.ToList(statuses), serializedAdditionalRawData); + } + + VirtualMachineExtensionInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineExtensionInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineExtensionInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineExtensionInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineExtensionInstanceView model) + { + if (model is null) + { + return null; } - return new VirtualMachineExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, Optional.ToList(substatuses), Optional.ToList(statuses)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineExtensionInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineExtensionInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs index f1f4fdd4a670..6d8b5d231231 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a virtual machine extension. public partial class VirtualMachineExtensionInstanceView { - /// Initializes a new instance of VirtualMachineExtensionInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineExtensionInstanceView() { Substatuses = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineExtensionInstanceView. + /// Initializes a new instance of . /// The virtual machine extension name. /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. /// The resource status information. /// The resource status information. - internal VirtualMachineExtensionInstanceView(string name, string virtualMachineExtensionInstanceViewType, string typeHandlerVersion, IList substatuses, IList statuses) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineExtensionInstanceView(string name, string virtualMachineExtensionInstanceViewType, string typeHandlerVersion, IList substatuses, IList statuses, Dictionary serializedAdditionalRawData) { Name = name; VirtualMachineExtensionInstanceViewType = virtualMachineExtensionInstanceViewType; TypeHandlerVersion = typeHandlerVersion; Substatuses = substatuses; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The virtual machine extension name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.Serialization.cs index 8779b888d173..142a00411007 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineExtensionPatch : IUtf8JsonSerializable + public partial class VirtualMachineExtensionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -84,10 +92,208 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProtectedSettings)) { writer.WritePropertyName("protectedSettingsFromKeyVault"u8); - writer.WriteObjectValue(KeyVaultProtectedSettings); + if (KeyVaultProtectedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProtectedSettings).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineExtensionPatch DeserializeVirtualMachineExtensionPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional forceUpdateTag = default; + Optional publisher = default; + Optional type = default; + Optional typeHandlerVersion = default; + Optional autoUpgradeMinorVersion = default; + Optional enableAutomaticUpgrade = default; + Optional settings = default; + Optional protectedSettings = default; + Optional suppressFailures = default; + Optional protectedSettingsFromKeyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("forceUpdateTag"u8)) + { + forceUpdateTag = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("publisher"u8)) + { + publisher = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + type = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("typeHandlerVersion"u8)) + { + typeHandlerVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("autoUpgradeMinorVersion"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoUpgradeMinorVersion = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableAutomaticUpgrade"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableAutomaticUpgrade = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("settings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + settings = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("protectedSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protectedSettings = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("suppressFailures"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + suppressFailures = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("protectedSettingsFromKeyVault"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protectedSettingsFromKeyVault = KeyVaultSecretReference.DeserializeKeyVaultSecretReference(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineExtensionPatch(Optional.ToDictionary(tags), forceUpdateTag.Value, publisher.Value, type.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, serializedAdditionalRawData); + } + + VirtualMachineExtensionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineExtensionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineExtensionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineExtensionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineExtensionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineExtensionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineExtensionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.cs index fde8884550ed..2cb062afd671 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionPatch.cs @@ -6,17 +6,45 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes a Virtual Machine Extension. public partial class VirtualMachineExtensionPatch : ComputeResourcePatch { - /// Initializes a new instance of VirtualMachineExtensionPatch. + /// Initializes a new instance of . public VirtualMachineExtensionPatch() { } + /// Initializes a new instance of . + /// Resource tags. + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// The name of the extension handler publisher. + /// Specifies the type of the extension; an example is "CustomScriptExtension". + /// Specifies the version of the script handler. + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. + /// Json formatted public settings for the extension. + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. + /// The extensions protected settings that are passed by reference, and consumed from key vault. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineExtensionPatch(IDictionary tags, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + ExtensionType = extensionType; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + EnableAutomaticUpgrade = enableAutomaticUpgrade; + Settings = settings; + ProtectedSettings = protectedSettings; + SuppressFailures = suppressFailures; + KeyVaultProtectedSettings = keyVaultProtectedSettings; + } + /// How the extension handler should be forced to update even if the extension configuration has not changed. public string ForceUpdateTag { get; set; } /// The name of the extension handler publisher. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.Serialization.cs index 70e22521cbf1..95358242f5f0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineExtensionsListResult + internal partial class VirtualMachineExtensionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineExtensionsListResult DeserializeVirtualMachineExtensionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineExtensionsListResult DeserializeVirtualMachineExtensionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static VirtualMachineExtensionsListResult DeserializeVirtualMachineExte value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineExtensionsListResult(Optional.ToList(value)); + return new VirtualMachineExtensionsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + VirtualMachineExtensionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineExtensionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineExtensionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineExtensionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineExtensionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineExtensionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineExtensionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.cs index 2191cc86613e..d97f31254c0b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineExtensionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Compute.Models /// The List Extension operation response. internal partial class VirtualMachineExtensionsListResult { - /// Initializes a new instance of VirtualMachineExtensionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineExtensionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineExtensionsListResult. + /// Initializes a new instance of . /// The list of extensions. - internal VirtualMachineExtensionsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineExtensionsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of extensions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.Serialization.cs index 9781cc77045c..addeb475ef4d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineGalleryApplication : IUtf8JsonSerializable + public partial class VirtualMachineGalleryApplication : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Tags)) { @@ -42,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableAutomaticUpgrade"u8); writer.WriteBooleanValue(EnableAutomaticUpgrade.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineGalleryApplication DeserializeVirtualMachineGalleryApplication(JsonElement element) + internal static VirtualMachineGalleryApplication DeserializeVirtualMachineGalleryApplication(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +79,7 @@ internal static VirtualMachineGalleryApplication DeserializeVirtualMachineGaller Optional configurationReference = default; Optional treatFailureAsDeploymentFailure = default; Optional enableAutomaticUpgrade = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -101,8 +124,61 @@ internal static VirtualMachineGalleryApplication DeserializeVirtualMachineGaller enableAutomaticUpgrade = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineGalleryApplication(tags.Value, Optional.ToNullable(order), packageReferenceId, configurationReference.Value, Optional.ToNullable(treatFailureAsDeploymentFailure), Optional.ToNullable(enableAutomaticUpgrade), serializedAdditionalRawData); + } + + VirtualMachineGalleryApplication IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineGalleryApplication(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineGalleryApplication IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineGalleryApplication(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineGalleryApplication model) + { + if (model is null) + { + return null; } - return new VirtualMachineGalleryApplication(tags.Value, Optional.ToNullable(order), packageReferenceId, configurationReference.Value, Optional.ToNullable(treatFailureAsDeploymentFailure), Optional.ToNullable(enableAutomaticUpgrade)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineGalleryApplication(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineGalleryApplication(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.cs index 2724cad63558..43fcf5c1e11f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineGalleryApplication.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the required information to reference a compute gallery application version. public partial class VirtualMachineGalleryApplication { - /// Initializes a new instance of VirtualMachineGalleryApplication. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the GalleryApplicationVersion resource id on the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. /// is null. public VirtualMachineGalleryApplication(string packageReferenceId) @@ -23,14 +27,15 @@ public VirtualMachineGalleryApplication(string packageReferenceId) PackageReferenceId = packageReferenceId; } - /// Initializes a new instance of VirtualMachineGalleryApplication. + /// Initializes a new instance of . /// Optional, Specifies a passthrough value for more generic context. /// Optional, Specifies the order in which the packages have to be installed. /// Specifies the GalleryApplicationVersion resource id on the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. /// Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided. /// Optional, If true, any failure for any operation in the VmApplication will fail the deployment. /// If set to true, when a new Gallery Application version is available in PIR/SIG, it will be automatically updated for the VM/VMSS. - internal VirtualMachineGalleryApplication(string tags, int? order, string packageReferenceId, string configurationReference, bool? treatFailureAsDeploymentFailure, bool? enableAutomaticUpgrade) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineGalleryApplication(string tags, int? order, string packageReferenceId, string configurationReference, bool? treatFailureAsDeploymentFailure, bool? enableAutomaticUpgrade, Dictionary serializedAdditionalRawData) { Tags = tags; Order = order; @@ -38,6 +43,12 @@ internal VirtualMachineGalleryApplication(string tags, int? order, string packag ConfigurationReference = configurationReference; TreatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; EnableAutomaticUpgrade = enableAutomaticUpgrade; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineGalleryApplication() + { } /// Optional, Specifies a passthrough value for more generic context. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.Serialization.cs index aad2c7310b5e..7a7f00ccbb8d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineHardwareProfile : IUtf8JsonSerializable + public partial class VirtualMachineHardwareProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VmSize)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VmSizeProperties)) { writer.WritePropertyName("vmSizeProperties"u8); - writer.WriteObjectValue(VmSizeProperties); + if (VmSizeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VmSizeProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static VirtualMachineHardwareProfile DeserializeVirtualMachineHardwareProfile(JsonElement element) + internal static VirtualMachineHardwareProfile DeserializeVirtualMachineHardwareProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vmSize = default; Optional vmSizeProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmSize"u8)) @@ -56,8 +86,61 @@ internal static VirtualMachineHardwareProfile DeserializeVirtualMachineHardwareP vmSizeProperties = VirtualMachineSizeProperties.DeserializeVirtualMachineSizeProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineHardwareProfile(Optional.ToNullable(vmSize), vmSizeProperties.Value, serializedAdditionalRawData); + } + + VirtualMachineHardwareProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineHardwareProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineHardwareProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineHardwareProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineHardwareProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineHardwareProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineHardwareProfile(Optional.ToNullable(vmSize), vmSizeProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineHardwareProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.cs index ceeaab6a3f1f..98d42351727f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHardwareProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the hardware settings for the virtual machine. public partial class VirtualMachineHardwareProfile { - /// Initializes a new instance of VirtualMachineHardwareProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineHardwareProfile() { } - /// Initializes a new instance of VirtualMachineHardwareProfile. + /// Initializes a new instance of . /// Specifies the size of the virtual machine. The enum data type is currently deprecated and will be removed by December 23rd 2023. The recommended way to get the list of available sizes is using these APIs: [List all available virtual machine sizes in an availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes), [List all available virtual machine sizes in a region]( https://docs.microsoft.com/rest/api/compute/resourceskus/list), [List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/azure/virtual-machines/sizes). The available VM sizes depend on region and availability set. /// Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-07-01. This feature is still in preview mode and is not supported for VirtualMachineScaleSet. Please follow the instructions in [VM Customization](https://aka.ms/vmcustomization) for more details. - internal VirtualMachineHardwareProfile(VirtualMachineSizeType? vmSize, VirtualMachineSizeProperties vmSizeProperties) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineHardwareProfile(VirtualMachineSizeType? vmSize, VirtualMachineSizeProperties vmSizeProperties, Dictionary serializedAdditionalRawData) { VmSize = vmSize; VmSizeProperties = vmSizeProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the size of the virtual machine. The enum data type is currently deprecated and will be removed by December 23rd 2023. The recommended way to get the list of available sizes is using these APIs: [List all available virtual machine sizes in an availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes), [List all available virtual machine sizes in a region]( https://docs.microsoft.com/rest/api/compute/resourceskus/list), [List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/azure/virtual-machines/sizes). The available VM sizes depend on region and availability set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.Serialization.cs index 8b3e383b9d27..7249d80e5b5a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineHealthStatus + internal partial class VirtualMachineHealthStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineHealthStatus DeserializeVirtualMachineHealthStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineHealthStatus DeserializeVirtualMachineHealthStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -30,8 +59,61 @@ internal static VirtualMachineHealthStatus DeserializeVirtualMachineHealthStatus status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineHealthStatus(status.Value); + return new VirtualMachineHealthStatus(status.Value, serializedAdditionalRawData); + } + + VirtualMachineHealthStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineHealthStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineHealthStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineHealthStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineHealthStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineHealthStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineHealthStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.cs index 56fbf080e899..34bf1476af5c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineHealthStatus.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The health status of the VM. internal partial class VirtualMachineHealthStatus { - /// Initializes a new instance of VirtualMachineHealthStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineHealthStatus() { } - /// Initializes a new instance of VirtualMachineHealthStatus. + /// Initializes a new instance of . /// The health status information for the VM. - internal VirtualMachineHealthStatus(InstanceViewStatus status) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineHealthStatus(InstanceViewStatus status, Dictionary serializedAdditionalRawData) { Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The health status information for the VM. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.Serialization.cs index da48c4009860..d6fbc34d92d4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineIPTag : IUtf8JsonSerializable + public partial class VirtualMachineIPTag : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IPTagType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tag"u8); writer.WriteStringValue(Tag); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineIPTag DeserializeVirtualMachineIPTag(JsonElement element) + internal static VirtualMachineIPTag DeserializeVirtualMachineIPTag(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ipTagType = default; Optional tag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipTagType"u8)) @@ -48,8 +71,61 @@ internal static VirtualMachineIPTag DeserializeVirtualMachineIPTag(JsonElement e tag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineIPTag(ipTagType.Value, tag.Value, serializedAdditionalRawData); + } + + VirtualMachineIPTag IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineIPTag(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineIPTag IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineIPTag(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineIPTag model) + { + if (model is null) + { + return null; } - return new VirtualMachineIPTag(ipTagType.Value, tag.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineIPTag(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineIPTag(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.cs index 6996a33cf0ce..8fb92f89b995 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineIPTag.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains the IP tag associated with the public IP address. public partial class VirtualMachineIPTag { - /// Initializes a new instance of VirtualMachineIPTag. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineIPTag() { } - /// Initializes a new instance of VirtualMachineIPTag. + /// Initializes a new instance of . /// IP tag type. Example: FirstPartyUsage. /// IP tag associated with the public IP. Example: SQL, Storage etc. - internal VirtualMachineIPTag(string ipTagType, string tag) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineIPTag(string ipTagType, string tag, Dictionary serializedAdditionalRawData) { IPTagType = ipTagType; Tag = tag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// IP tag type. Example: FirstPartyUsage. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs index 34efaf422226..8843beacf3a8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineImage : IUtf8JsonSerializable + public partial class VirtualMachineImage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -47,12 +54,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); - writer.WriteObjectValue(Plan); + if (Plan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Plan).Serialize(writer, options); + } } if (Optional.IsDefined(OSDiskImage)) { writer.WritePropertyName("osDiskImage"u8); - writer.WriteObjectValue(OSDiskImage); + if (OSDiskImage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDiskImage).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDiskImages)) { @@ -60,14 +81,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDiskImages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(AutomaticOSUpgradeProperties)) { writer.WritePropertyName("automaticOSUpgradeProperties"u8); - writer.WriteObjectValue(AutomaticOSUpgradeProperties); + if (AutomaticOSUpgradeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutomaticOSUpgradeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(HyperVGeneration)) { @@ -77,7 +112,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Disallowed)) { writer.WritePropertyName("disallowed"u8); - writer.WriteObjectValue(Disallowed); + if (Disallowed is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Disallowed).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Features)) { @@ -85,7 +127,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Features) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -97,14 +146,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ImageDeprecationStatus)) { writer.WritePropertyName("imageDeprecationStatus"u8); - writer.WriteObjectValue(ImageDeprecationStatus); + if (ImageDeprecationStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageDeprecationStatus).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement element) + internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -123,6 +193,7 @@ internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement e Optional> features = default; Optional architecture = default; Optional imageDeprecationStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -270,8 +341,61 @@ internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineImage(id.Value, name, location, Optional.ToDictionary(tags), extendedLocation, plan.Value, osDiskImage.Value, Optional.ToList(dataDiskImages), automaticOSUpgradeProperties.Value, Optional.ToNullable(hyperVGeneration), disallowed.Value, Optional.ToList(features), Optional.ToNullable(architecture), imageDeprecationStatus.Value, serializedAdditionalRawData); + } + + VirtualMachineImage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineImage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineImage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineImage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineImage model) + { + if (model is null) + { + return null; } - return new VirtualMachineImage(id.Value, name, location, Optional.ToDictionary(tags), extendedLocation, plan.Value, osDiskImage.Value, Optional.ToList(dataDiskImages), automaticOSUpgradeProperties.Value, Optional.ToNullable(hyperVGeneration), disallowed.Value, Optional.ToList(features), Optional.ToNullable(architecture), imageDeprecationStatus.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineImage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineImage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs index f8ccbc6cb539..6b4cd28aad81 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a Virtual Machine Image. public partial class VirtualMachineImage : VirtualMachineImageBase { - /// Initializes a new instance of VirtualMachineImage. + /// Initializes a new instance of . /// The name of the resource. /// The supported Azure location of the resource. /// is null. @@ -27,7 +27,7 @@ public VirtualMachineImage(string name, AzureLocation location) : base(name, loc Features = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineImage. + /// Initializes a new instance of . /// Resource Id. /// The name of the resource. /// The supported Azure location of the resource. @@ -42,7 +42,8 @@ public VirtualMachineImage(string name, AzureLocation location) : base(name, loc /// /// Specifies the Architecture Type. /// Describes image deprecation status properties on the image. - internal VirtualMachineImage(ResourceIdentifier id, string name, AzureLocation location, IDictionary tags, ExtendedLocation extendedLocation, PurchasePlan plan, OSDiskImage osDiskImage, IList dataDiskImages, AutomaticOSUpgradeProperties automaticOSUpgradeProperties, HyperVGeneration? hyperVGeneration, DisallowedConfiguration disallowed, IList features, ArchitectureType? architecture, ImageDeprecationStatus imageDeprecationStatus) : base(id, name, location, tags, extendedLocation) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineImage(ResourceIdentifier id, string name, AzureLocation location, IDictionary tags, ExtendedLocation extendedLocation, PurchasePlan plan, OSDiskImage osDiskImage, IList dataDiskImages, AutomaticOSUpgradeProperties automaticOSUpgradeProperties, HyperVGeneration? hyperVGeneration, DisallowedConfiguration disallowed, IList features, ArchitectureType? architecture, ImageDeprecationStatus imageDeprecationStatus, Dictionary serializedAdditionalRawData) : base(id, name, location, tags, extendedLocation, serializedAdditionalRawData) { Plan = plan; OSDiskImage = osDiskImage; @@ -55,6 +56,11 @@ internal VirtualMachineImage(ResourceIdentifier id, string name, AzureLocation l ImageDeprecationStatus = imageDeprecationStatus; } + /// Initializes a new instance of for deserialization. + internal VirtualMachineImage() + { + } + /// Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. public PurchasePlan Plan { get; set; } /// Contains the os disk image information. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.Serialization.cs index 6eea0db50a99..95556c716e56 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineImageBase : IUtf8JsonSerializable + public partial class VirtualMachineImageBase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -42,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineImageBase DeserializeVirtualMachineImageBase(JsonElement element) + internal static VirtualMachineImageBase DeserializeVirtualMachineImageBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +77,7 @@ internal static VirtualMachineImageBase DeserializeVirtualMachineImageBase(JsonE Optional> tags = default; Optional extendedLocation = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -100,8 +122,61 @@ internal static VirtualMachineImageBase DeserializeVirtualMachineImageBase(JsonE id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineImageBase(id.Value, name, location, Optional.ToDictionary(tags), extendedLocation, serializedAdditionalRawData); + } + + VirtualMachineImageBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineImageBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineImageBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineImageBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineImageBase model) + { + if (model is null) + { + return null; } - return new VirtualMachineImageBase(id.Value, name, location, Optional.ToDictionary(tags), extendedLocation); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineImageBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineImageBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.cs index 695085cbbd1e..a591e78259d5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageBase.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Compute.Models /// Virtual machine image resource information. public partial class VirtualMachineImageBase : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineImageBase. + /// Initializes a new instance of . /// The name of the resource. /// The supported Azure location of the resource. /// is null. @@ -28,13 +28,14 @@ public VirtualMachineImageBase(string name, AzureLocation location) Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of VirtualMachineImageBase. + /// Initializes a new instance of . /// Resource Id. /// The name of the resource. /// The supported Azure location of the resource. /// Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). /// The extended location of the Virtual Machine. - internal VirtualMachineImageBase(ResourceIdentifier id, string name, AzureLocation location, IDictionary tags, ExtendedLocation extendedLocation) : base(id) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineImageBase(ResourceIdentifier id, string name, AzureLocation location, IDictionary tags, ExtendedLocation extendedLocation, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Name = name; Location = location; @@ -42,6 +43,11 @@ internal VirtualMachineImageBase(ResourceIdentifier id, string name, AzureLocati ExtendedLocation = extendedLocation; } + /// Initializes a new instance of for deserialization. + internal VirtualMachineImageBase() + { + } + /// The name of the resource. public string Name { get; set; } /// The supported Azure location of the resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.Serialization.cs index 3253921845c3..8acb48e3b152 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineImageFeature : IUtf8JsonSerializable + public partial class VirtualMachineImageFeature : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineImageFeature DeserializeVirtualMachineImageFeature(JsonElement element) + internal static VirtualMachineImageFeature DeserializeVirtualMachineImageFeature(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static VirtualMachineImageFeature DeserializeVirtualMachineImageFeature value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineImageFeature(name.Value, value.Value, serializedAdditionalRawData); + } + + VirtualMachineImageFeature IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineImageFeature(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineImageFeature IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineImageFeature(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineImageFeature model) + { + if (model is null) + { + return null; } - return new VirtualMachineImageFeature(name.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineImageFeature(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineImageFeature(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.cs index 9d248a5179a8..9241f60e8467 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageFeature.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies additional capabilities supported by the image. public partial class VirtualMachineImageFeature { - /// Initializes a new instance of VirtualMachineImageFeature. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineImageFeature() { } - /// Initializes a new instance of VirtualMachineImageFeature. + /// Initializes a new instance of . /// The name of the feature. /// The corresponding value for the feature. - internal VirtualMachineImageFeature(string name, string value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineImageFeature(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the feature. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.Serialization.cs index dfefc6e2cf55..0c13ff637cff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineInstallPatchesContent : IUtf8JsonSerializable + public partial class VirtualMachineInstallPatchesContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaximumDuration)) { @@ -25,14 +33,144 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsParameters)) { writer.WritePropertyName("windowsParameters"u8); - writer.WriteObjectValue(WindowsParameters); + if (WindowsParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsParameters).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxParameters)) { writer.WritePropertyName("linuxParameters"u8); - writer.WriteObjectValue(LinuxParameters); + if (LinuxParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxParameters).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static VirtualMachineInstallPatchesContent DeserializeVirtualMachineInstallPatchesContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional maximumDuration = default; + VmGuestPatchRebootSetting rebootSetting = default; + Optional windowsParameters = default; + Optional linuxParameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("maximumDuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumDuration = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("rebootSetting"u8)) + { + rebootSetting = new VmGuestPatchRebootSetting(property.Value.GetString()); + continue; + } + if (property.NameEquals("windowsParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsParameters = WindowsParameters.DeserializeWindowsParameters(property.Value); + continue; + } + if (property.NameEquals("linuxParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + linuxParameters = LinuxParameters.DeserializeLinuxParameters(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineInstallPatchesContent(Optional.ToNullable(maximumDuration), rebootSetting, windowsParameters.Value, linuxParameters.Value, serializedAdditionalRawData); + } + + VirtualMachineInstallPatchesContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineInstallPatchesContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineInstallPatchesContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineInstallPatchesContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineInstallPatchesContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineInstallPatchesContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineInstallPatchesContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.cs index d152f897b121..861ec104a0f9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesContent.cs @@ -6,19 +6,43 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Input for InstallPatches as directly received by the API. public partial class VirtualMachineInstallPatchesContent { - /// Initializes a new instance of VirtualMachineInstallPatchesContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Defines when it is acceptable to reboot a VM during a software update operation. public VirtualMachineInstallPatchesContent(VmGuestPatchRebootSetting rebootSetting) { RebootSetting = rebootSetting; } + /// Initializes a new instance of . + /// Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). + /// Defines when it is acceptable to reboot a VM during a software update operation. + /// Input for InstallPatches on a Windows VM, as directly received by the API. + /// Input for InstallPatches on a Linux VM, as directly received by the API. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineInstallPatchesContent(TimeSpan? maximumDuration, VmGuestPatchRebootSetting rebootSetting, WindowsParameters windowsParameters, LinuxParameters linuxParameters, Dictionary serializedAdditionalRawData) + { + MaximumDuration = maximumDuration; + RebootSetting = rebootSetting; + WindowsParameters = windowsParameters; + LinuxParameters = linuxParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineInstallPatchesContent() + { + } + /// Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). public TimeSpan? MaximumDuration { get; set; } /// Defines when it is acceptable to reboot a VM during a software update operation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.Serialization.cs index 22402dd8153e..81f496dab0a9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineInstallPatchesResult + public partial class VirtualMachineInstallPatchesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineInstallPatchesResult DeserializeVirtualMachineInstallPatchesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineInstallPatchesResult DeserializeVirtualMachineInstallPatchesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +58,7 @@ internal static VirtualMachineInstallPatchesResult DeserializeVirtualMachineInst Optional> patches = default; Optional startDateTime = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -143,8 +170,61 @@ internal static VirtualMachineInstallPatchesResult DeserializeVirtualMachineInst error = ComputeApiError.DeserializeComputeApiError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineInstallPatchesResult(Optional.ToNullable(status), installationActivityId.Value, Optional.ToNullable(rebootStatus), Optional.ToNullable(maintenanceWindowExceeded), Optional.ToNullable(excludedPatchCount), Optional.ToNullable(notSelectedPatchCount), Optional.ToNullable(pendingPatchCount), Optional.ToNullable(installedPatchCount), Optional.ToNullable(failedPatchCount), Optional.ToList(patches), Optional.ToNullable(startDateTime), error.Value); + return new VirtualMachineInstallPatchesResult(Optional.ToNullable(status), installationActivityId.Value, Optional.ToNullable(rebootStatus), Optional.ToNullable(maintenanceWindowExceeded), Optional.ToNullable(excludedPatchCount), Optional.ToNullable(notSelectedPatchCount), Optional.ToNullable(pendingPatchCount), Optional.ToNullable(installedPatchCount), Optional.ToNullable(failedPatchCount), Optional.ToList(patches), Optional.ToNullable(startDateTime), error.Value, serializedAdditionalRawData); + } + + VirtualMachineInstallPatchesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineInstallPatchesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineInstallPatchesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineInstallPatchesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineInstallPatchesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineInstallPatchesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineInstallPatchesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs index a7277cd4aabb..71db33a9b294 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstallPatchesResult.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// The result summary of an installation operation. public partial class VirtualMachineInstallPatchesResult { - /// Initializes a new instance of VirtualMachineInstallPatchesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineInstallPatchesResult() { Patches = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineInstallPatchesResult. + /// Initializes a new instance of . /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings.". /// The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. /// The reboot state of the VM following completion of the operation. @@ -33,7 +36,8 @@ internal VirtualMachineInstallPatchesResult() /// The patches that were installed during the operation. /// The UTC timestamp when the operation began. /// The errors that were encountered during execution of the operation. The details array contains the list of them. - internal VirtualMachineInstallPatchesResult(PatchOperationStatus? status, string installationActivityId, VmGuestPatchRebootStatus? rebootStatus, bool? maintenanceWindowExceeded, int? excludedPatchCount, int? notSelectedPatchCount, int? pendingPatchCount, int? installedPatchCount, int? failedPatchCount, IReadOnlyList patches, DateTimeOffset? startOn, ComputeApiError error) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineInstallPatchesResult(PatchOperationStatus? status, string installationActivityId, VmGuestPatchRebootStatus? rebootStatus, bool? maintenanceWindowExceeded, int? excludedPatchCount, int? notSelectedPatchCount, int? pendingPatchCount, int? installedPatchCount, int? failedPatchCount, IReadOnlyList patches, DateTimeOffset? startOn, ComputeApiError error, Dictionary serializedAdditionalRawData) { Status = status; InstallationActivityId = installationActivityId; @@ -47,6 +51,7 @@ internal VirtualMachineInstallPatchesResult(PatchOperationStatus? status, string Patches = patches; StartOn = startOn; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings.". diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.Serialization.cs index d9adc69c11a5..5267333e6d0e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.Serialization.cs @@ -5,16 +5,177 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineInstanceView + public partial class VirtualMachineInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineInstanceView DeserializeVirtualMachineInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PlatformUpdateDomain)) + { + writer.WritePropertyName("platformUpdateDomain"u8); + writer.WriteNumberValue(PlatformUpdateDomain.Value); + } + if (Optional.IsDefined(PlatformFaultDomain)) + { + writer.WritePropertyName("platformFaultDomain"u8); + writer.WriteNumberValue(PlatformFaultDomain.Value); + } + if (Optional.IsDefined(ComputerName)) + { + writer.WritePropertyName("computerName"u8); + writer.WriteStringValue(ComputerName); + } + if (Optional.IsDefined(OSName)) + { + writer.WritePropertyName("osName"u8); + writer.WriteStringValue(OSName); + } + if (Optional.IsDefined(OSVersion)) + { + writer.WritePropertyName("osVersion"u8); + writer.WriteStringValue(OSVersion); + } + if (Optional.IsDefined(HyperVGeneration)) + { + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration.Value.ToString()); + } + if (Optional.IsDefined(RdpThumbPrint)) + { + writer.WritePropertyName("rdpThumbPrint"u8); + writer.WriteStringValue(RdpThumbPrint); + } + if (Optional.IsDefined(VmAgent)) + { + writer.WritePropertyName("vmAgent"u8); + if (VmAgent is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VmAgent).Serialize(writer, options); + } + } + if (Optional.IsDefined(MaintenanceRedeployStatus)) + { + writer.WritePropertyName("maintenanceRedeployStatus"u8); + if (MaintenanceRedeployStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaintenanceRedeployStatus).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Disks)) + { + writer.WritePropertyName("disks"u8); + writer.WriteStartArray(); + foreach (var item in Disks) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Extensions)) + { + writer.WritePropertyName("extensions"u8); + writer.WriteStartArray(); + foreach (var item in Extensions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(BootDiagnostics)) + { + writer.WritePropertyName("bootDiagnostics"u8); + if (BootDiagnostics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BootDiagnostics).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PatchStatus)) + { + writer.WritePropertyName("patchStatus"u8); + if (PatchStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PatchStatus).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineInstanceView DeserializeVirtualMachineInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +196,7 @@ internal static VirtualMachineInstanceView DeserializeVirtualMachineInstanceView Optional assignedHost = default; Optional> statuses = default; Optional patchStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("platformUpdateDomain"u8)) @@ -176,8 +338,61 @@ internal static VirtualMachineInstanceView DeserializeVirtualMachineInstanceView patchStatus = VirtualMachinePatchStatus.DeserializeVirtualMachinePatchStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), computerName.Value, osName.Value, osVersion.Value, Optional.ToNullable(hyperVGeneration), rdpThumbPrint.Value, vmAgent.Value, maintenanceRedeployStatus.Value, Optional.ToList(disks), Optional.ToList(extensions), vmHealth.Value, bootDiagnostics.Value, assignedHost.Value, Optional.ToList(statuses), patchStatus.Value, serializedAdditionalRawData); + } + + VirtualMachineInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineInstanceView(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), computerName.Value, osName.Value, osVersion.Value, Optional.ToNullable(hyperVGeneration), rdpThumbPrint.Value, vmAgent.Value, maintenanceRedeployStatus.Value, Optional.ToList(disks), Optional.ToList(extensions), vmHealth.Value, bootDiagnostics.Value, assignedHost.Value, Optional.ToList(statuses), patchStatus.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.cs index bcd628260790..efb3f00789c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a virtual machine. public partial class VirtualMachineInstanceView { - /// Initializes a new instance of VirtualMachineInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineInstanceView() { Disks = new ChangeTrackingList(); @@ -21,7 +25,7 @@ internal VirtualMachineInstanceView() Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineInstanceView. + /// Initializes a new instance of . /// Specifies the update domain of the virtual machine. /// Specifies the fault domain of the virtual machine. /// The computer name assigned to the virtual machine. @@ -38,7 +42,8 @@ internal VirtualMachineInstanceView() /// Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when the virtual machine is associated with a dedicated host group that has automatic placement enabled. Minimum api-version: 2020-06-01. /// The resource status information. /// [Preview Feature] The status of virtual machine patch operations. - internal VirtualMachineInstanceView(int? platformUpdateDomain, int? platformFaultDomain, string computerName, string osName, string osVersion, HyperVGeneration? hyperVGeneration, string rdpThumbPrint, VirtualMachineAgentInstanceView vmAgent, MaintenanceRedeployStatus maintenanceRedeployStatus, IReadOnlyList disks, IReadOnlyList extensions, VirtualMachineHealthStatus vmHealth, BootDiagnosticsInstanceView bootDiagnostics, string assignedHost, IReadOnlyList statuses, VirtualMachinePatchStatus patchStatus) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineInstanceView(int? platformUpdateDomain, int? platformFaultDomain, string computerName, string osName, string osVersion, HyperVGeneration? hyperVGeneration, string rdpThumbPrint, VirtualMachineAgentInstanceView vmAgent, MaintenanceRedeployStatus maintenanceRedeployStatus, IReadOnlyList disks, IReadOnlyList extensions, VirtualMachineHealthStatus vmHealth, BootDiagnosticsInstanceView bootDiagnostics, string assignedHost, IReadOnlyList statuses, VirtualMachinePatchStatus patchStatus, Dictionary serializedAdditionalRawData) { PlatformUpdateDomain = platformUpdateDomain; PlatformFaultDomain = platformFaultDomain; @@ -56,6 +61,7 @@ internal VirtualMachineInstanceView(int? platformUpdateDomain, int? platformFaul AssignedHost = assignedHost; Statuses = statuses; PatchStatus = patchStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the update domain of the virtual machine. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.Serialization.cs index 5b412537aa73..147f348489dc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineListResult + internal partial class VirtualMachineListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineListResult DeserializeVirtualMachineListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineListResult DeserializeVirtualMachineListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineListResult DeserializeVirtualMachineListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineListResult(value, nextLink.Value); + return new VirtualMachineListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.cs index 12383baa934c..d5a8683a029a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Virtual Machine operation response. internal partial class VirtualMachineListResult { - /// Initializes a new instance of VirtualMachineListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of virtual machines. /// is null. internal VirtualMachineListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of VirtualMachineListResult. + /// Initializes a new instance of . /// The list of virtual machines. /// The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. - internal VirtualMachineListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineListResult() + { } /// The list of virtual machines. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.Serialization.cs index 9b920bff2890..9fecc0acef40 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineManagedDisk : IUtf8JsonSerializable + public partial class VirtualMachineManagedDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StorageAccountType)) { @@ -29,18 +37,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineManagedDisk DeserializeVirtualMachineManagedDisk(JsonElement element) + internal static VirtualMachineManagedDisk DeserializeVirtualMachineManagedDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +78,7 @@ internal static VirtualMachineManagedDisk DeserializeVirtualMachineManagedDisk(J Optional diskEncryptionSet = default; Optional securityProfile = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountType"u8)) @@ -87,8 +117,61 @@ internal static VirtualMachineManagedDisk DeserializeVirtualMachineManagedDisk(J id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineManagedDisk(id.Value, Optional.ToNullable(storageAccountType), diskEncryptionSet, securityProfile.Value, serializedAdditionalRawData); + } + + VirtualMachineManagedDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineManagedDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineManagedDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineManagedDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineManagedDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineManagedDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineManagedDisk(id.Value, Optional.ToNullable(storageAccountType), diskEncryptionSet, securityProfile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineManagedDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.cs index 06d401baed1f..18c031365122 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineManagedDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,17 +15,18 @@ namespace Azure.ResourceManager.Compute.Models /// The parameters of a managed disk. public partial class VirtualMachineManagedDisk : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineManagedDisk. + /// Initializes a new instance of . public VirtualMachineManagedDisk() { } - /// Initializes a new instance of VirtualMachineManagedDisk. + /// Initializes a new instance of . /// Resource Id. /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed disk. /// Specifies the security profile for the managed disk. - internal VirtualMachineManagedDisk(ResourceIdentifier id, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, VirtualMachineDiskSecurityProfile securityProfile) : base(id) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineManagedDisk(ResourceIdentifier id, StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, VirtualMachineDiskSecurityProfile securityProfile, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { StorageAccountType = storageAccountType; DiskEncryptionSet = diskEncryptionSet; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs index 9137082e3f44..d375a6bd0571 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineNetworkInterfaceConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineNetworkInterfaceConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -59,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DnsSettings)) { writer.WritePropertyName("dnsSettings"u8); - writer.WriteObjectValue(DnsSettings); + if (DnsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(IPConfigurations)) { @@ -67,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,11 +108,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AuxiliarySku.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMachineNetworkInterfaceConfiguration(JsonElement element) + internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMachineNetworkInterfaceConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,6 +144,7 @@ internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMa Optional dscpConfiguration = default; Optional auxiliaryMode = default; Optional auxiliarySku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -241,8 +277,61 @@ internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineNetworkInterfaceConfiguration(name, Optional.ToNullable(primary), Optional.ToNullable(deleteOption), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(disableTcpStateTracking), Optional.ToNullable(enableFpga), Optional.ToNullable(enableIPForwarding), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), dscpConfiguration, Optional.ToNullable(auxiliaryMode), Optional.ToNullable(auxiliarySku), serializedAdditionalRawData); + } + + VirtualMachineNetworkInterfaceConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineNetworkInterfaceConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineNetworkInterfaceConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineNetworkInterfaceConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineNetworkInterfaceConfiguration model) + { + if (model is null) + { + return null; } - return new VirtualMachineNetworkInterfaceConfiguration(name, Optional.ToNullable(primary), Optional.ToNullable(deleteOption), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(disableTcpStateTracking), Optional.ToNullable(enableFpga), Optional.ToNullable(enableIPForwarding), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), dscpConfiguration, Optional.ToNullable(auxiliaryMode), Optional.ToNullable(auxiliarySku)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineNetworkInterfaceConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineNetworkInterfaceConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs index 19439c52d567..12df0ed54d89 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine network interface configurations. public partial class VirtualMachineNetworkInterfaceConfiguration { - /// Initializes a new instance of VirtualMachineNetworkInterfaceConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The network interface configuration name. /// is null. public VirtualMachineNetworkInterfaceConfiguration(string name) @@ -26,7 +29,7 @@ public VirtualMachineNetworkInterfaceConfiguration(string name) IPConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineNetworkInterfaceConfiguration. + /// Initializes a new instance of . /// The network interface configuration name. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. /// Specify what happens to the network interface when the VM is deleted. @@ -40,7 +43,8 @@ public VirtualMachineNetworkInterfaceConfiguration(string name) /// Gets or sets the dscp configuration. /// Specifies whether the Auxiliary mode is enabled for the Network Interface resource. /// Specifies whether the Auxiliary sku is enabled for the Network Interface resource. - internal VirtualMachineNetworkInterfaceConfiguration(string name, bool? primary, ComputeDeleteOption? deleteOption, bool? enableAcceleratedNetworking, bool? isTcpStateTrackingDisabled, bool? enableFpga, bool? enableIPForwarding, WritableSubResource networkSecurityGroup, VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings, IList ipConfigurations, WritableSubResource dscpConfiguration, ComputeNetworkInterfaceAuxiliaryMode? auxiliaryMode, ComputeNetworkInterfaceAuxiliarySku? auxiliarySku) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineNetworkInterfaceConfiguration(string name, bool? primary, ComputeDeleteOption? deleteOption, bool? enableAcceleratedNetworking, bool? isTcpStateTrackingDisabled, bool? enableFpga, bool? enableIPForwarding, WritableSubResource networkSecurityGroup, VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings, IList ipConfigurations, WritableSubResource dscpConfiguration, ComputeNetworkInterfaceAuxiliaryMode? auxiliaryMode, ComputeNetworkInterfaceAuxiliarySku? auxiliarySku, Dictionary serializedAdditionalRawData) { Name = name; Primary = primary; @@ -55,6 +59,12 @@ internal VirtualMachineNetworkInterfaceConfiguration(string name, bool? primary, DscpConfiguration = dscpConfiguration; AuxiliaryMode = auxiliaryMode; AuxiliarySku = auxiliarySku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineNetworkInterfaceConfiguration() + { } /// The network interface configuration name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.Serialization.cs index 1b336382b5e0..45813ccd79e6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineNetworkInterfaceDnsSettingsConfiguration : IUtf8JsonSerializable + internal partial class VirtualMachineNetworkInterfaceDnsSettingsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DnsServers)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineNetworkInterfaceDnsSettingsConfiguration DeserializeVirtualMachineNetworkInterfaceDnsSettingsConfiguration(JsonElement element) + internal static VirtualMachineNetworkInterfaceDnsSettingsConfiguration DeserializeVirtualMachineNetworkInterfaceDnsSettingsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> dnsServers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dnsServers"u8)) @@ -52,8 +74,61 @@ internal static VirtualMachineNetworkInterfaceDnsSettingsConfiguration Deseriali dnsServers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineNetworkInterfaceDnsSettingsConfiguration(Optional.ToList(dnsServers), serializedAdditionalRawData); + } + + VirtualMachineNetworkInterfaceDnsSettingsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineNetworkInterfaceDnsSettingsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineNetworkInterfaceDnsSettingsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineNetworkInterfaceDnsSettingsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineNetworkInterfaceDnsSettingsConfiguration model) + { + if (model is null) + { + return null; } - return new VirtualMachineNetworkInterfaceDnsSettingsConfiguration(Optional.ToList(dnsServers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineNetworkInterfaceDnsSettingsConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineNetworkInterfaceDnsSettingsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs index 6b6427727a9e..baf6935e58fe 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceDnsSettingsConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines network configuration's DNS settings. internal partial class VirtualMachineNetworkInterfaceDnsSettingsConfiguration { - /// Initializes a new instance of VirtualMachineNetworkInterfaceDnsSettingsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineNetworkInterfaceDnsSettingsConfiguration() { DnsServers = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineNetworkInterfaceDnsSettingsConfiguration. + /// Initializes a new instance of . /// List of DNS servers IP addresses. - internal VirtualMachineNetworkInterfaceDnsSettingsConfiguration(IList dnsServers) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineNetworkInterfaceDnsSettingsConfiguration(IList dnsServers, Dictionary serializedAdditionalRawData) { DnsServers = dnsServers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of DNS servers IP addresses. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs index e70aac2e95f2..2b12bd354e3d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineNetworkInterfaceIPConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineNetworkInterfaceIPConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -34,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPAddressConfiguration)) { writer.WritePropertyName("publicIPAddressConfiguration"u8); - writer.WriteObjectValue(PublicIPAddressConfiguration); + if (PublicIPAddressConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublicIPAddressConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(PrivateIPAddressVersion)) { @@ -72,11 +86,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtualMachineNetworkInterfaceIPConfiguration(JsonElement element) + internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtualMachineNetworkInterfaceIPConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +117,7 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual Optional> applicationSecurityGroups = default; Optional> applicationGatewayBackendAddressPools = default; Optional> loadBalancerBackendAddressPools = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -186,8 +215,61 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineNetworkInterfaceIPConfiguration(name, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationSecurityGroups), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools), serializedAdditionalRawData); + } + + VirtualMachineNetworkInterfaceIPConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineNetworkInterfaceIPConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineNetworkInterfaceIPConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineNetworkInterfaceIPConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineNetworkInterfaceIPConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineNetworkInterfaceIPConfiguration(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineNetworkInterfaceIPConfiguration(name, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationSecurityGroups), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineNetworkInterfaceIPConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs index 094bd9424856..da6a207409f0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine network profile's IP configuration. public partial class VirtualMachineNetworkInterfaceIPConfiguration { - /// Initializes a new instance of VirtualMachineNetworkInterfaceIPConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The IP configuration name. /// is null. public VirtualMachineNetworkInterfaceIPConfiguration(string name) @@ -28,7 +31,7 @@ public VirtualMachineNetworkInterfaceIPConfiguration(string name) LoadBalancerBackendAddressPools = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineNetworkInterfaceIPConfiguration. + /// Initializes a new instance of . /// The IP configuration name. /// Specifies the identifier of the subnet. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. @@ -37,7 +40,8 @@ public VirtualMachineNetworkInterfaceIPConfiguration(string name) /// Specifies an array of references to application security group. /// Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same application gateway. /// Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. - internal VirtualMachineNetworkInterfaceIPConfiguration(string name, WritableSubResource subnet, bool? primary, VirtualMachinePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationSecurityGroups, IList applicationGatewayBackendAddressPools, IList loadBalancerBackendAddressPools) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineNetworkInterfaceIPConfiguration(string name, WritableSubResource subnet, bool? primary, VirtualMachinePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationSecurityGroups, IList applicationGatewayBackendAddressPools, IList loadBalancerBackendAddressPools, Dictionary serializedAdditionalRawData) { Name = name; Subnet = subnet; @@ -47,6 +51,12 @@ internal VirtualMachineNetworkInterfaceIPConfiguration(string name, WritableSubR ApplicationSecurityGroups = applicationSecurityGroups; ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineNetworkInterfaceIPConfiguration() + { } /// The IP configuration name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.Serialization.cs index 0a2dd611c51b..312cf9a6cffb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineNetworkInterfaceReference : IUtf8JsonSerializable + public partial class VirtualMachineNetworkInterfaceReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -33,11 +41,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DeleteOption.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineNetworkInterfaceReference DeserializeVirtualMachineNetworkInterfaceReference(JsonElement element) + internal static VirtualMachineNetworkInterfaceReference DeserializeVirtualMachineNetworkInterfaceReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static VirtualMachineNetworkInterfaceReference DeserializeVirtualMachin Optional id = default; Optional primary = default; Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +109,61 @@ internal static VirtualMachineNetworkInterfaceReference DeserializeVirtualMachin } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineNetworkInterfaceReference(id.Value, Optional.ToNullable(primary), Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineNetworkInterfaceReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineNetworkInterfaceReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineNetworkInterfaceReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineNetworkInterfaceReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineNetworkInterfaceReference model) + { + if (model is null) + { + return null; } - return new VirtualMachineNetworkInterfaceReference(id.Value, Optional.ToNullable(primary), Optional.ToNullable(deleteOption)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineNetworkInterfaceReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineNetworkInterfaceReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.cs index d031f7449279..a551f664bdab 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceReference.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,16 +14,17 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a network interface reference. public partial class VirtualMachineNetworkInterfaceReference : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineNetworkInterfaceReference. + /// Initializes a new instance of . public VirtualMachineNetworkInterfaceReference() { } - /// Initializes a new instance of VirtualMachineNetworkInterfaceReference. + /// Initializes a new instance of . /// Resource Id. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. /// Specify what happens to the network interface when the VM is deleted. - internal VirtualMachineNetworkInterfaceReference(ResourceIdentifier id, bool? primary, ComputeDeleteOption? deleteOption) : base(id) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineNetworkInterfaceReference(ResourceIdentifier id, bool? primary, ComputeDeleteOption? deleteOption, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Primary = primary; DeleteOption = deleteOption; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.Serialization.cs index b5cfaf435bf1..c21adc25a482 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineNetworkProfile : IUtf8JsonSerializable + public partial class VirtualMachineNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NetworkInterfaces)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaces) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,15 +51,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaceConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineNetworkProfile DeserializeVirtualMachineNetworkProfile(JsonElement element) + internal static VirtualMachineNetworkProfile DeserializeVirtualMachineNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +88,7 @@ internal static VirtualMachineNetworkProfile DeserializeVirtualMachineNetworkPro Optional> networkInterfaces = default; Optional networkApiVersion = default; Optional> networkInterfaceConfigurations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces"u8)) @@ -92,8 +128,61 @@ internal static VirtualMachineNetworkProfile DeserializeVirtualMachineNetworkPro networkInterfaceConfigurations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineNetworkProfile(Optional.ToList(networkInterfaces), Optional.ToNullable(networkApiVersion), Optional.ToList(networkInterfaceConfigurations), serializedAdditionalRawData); + } + + VirtualMachineNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineNetworkProfile model) + { + if (model is null) + { + return null; } - return new VirtualMachineNetworkProfile(Optional.ToList(networkInterfaces), Optional.ToNullable(networkApiVersion), Optional.ToList(networkInterfaceConfigurations)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineNetworkProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.cs index 07bbab5deb89..fff28f9d9689 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the network interfaces or the networking configuration of the virtual machine. public partial class VirtualMachineNetworkProfile { - /// Initializes a new instance of VirtualMachineNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineNetworkProfile() { NetworkInterfaces = new ChangeTrackingList(); NetworkInterfaceConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineNetworkProfile. + /// Initializes a new instance of . /// Specifies the list of resource Ids for the network interfaces associated with the virtual machine. /// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations. /// Specifies the networking configurations that will be used to create the virtual machine networking resources. - internal VirtualMachineNetworkProfile(IList networkInterfaces, NetworkApiVersion? networkApiVersion, IList networkInterfaceConfigurations) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineNetworkProfile(IList networkInterfaces, NetworkApiVersion? networkApiVersion, IList networkInterfaceConfigurations, Dictionary serializedAdditionalRawData) { NetworkInterfaces = networkInterfaces; NetworkApiVersion = networkApiVersion; NetworkInterfaceConfigurations = networkInterfaceConfigurations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the list of resource Ids for the network interfaces associated with the virtual machine. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.Serialization.cs index e0240aa95f93..97df031bd177 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineOSDisk : IUtf8JsonSerializable + public partial class VirtualMachineOSDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OSType)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EncryptionSettings)) { writer.WritePropertyName("encryptionSettings"u8); - writer.WriteObjectValue(EncryptionSettings); + if (EncryptionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(Name)) { @@ -33,12 +48,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Vhd)) { writer.WritePropertyName("vhd"u8); - writer.WriteObjectValue(Vhd); + if (Vhd is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Vhd).Serialize(writer, options); + } } if (Optional.IsDefined(Image)) { writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image); + if (Image is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Image).Serialize(writer, options); + } } if (Optional.IsDefined(Caching)) { @@ -53,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiffDiskSettings)) { writer.WritePropertyName("diffDiskSettings"u8); - writer.WriteObjectValue(DiffDiskSettings); + if (DiffDiskSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiffDiskSettings).Serialize(writer, options); + } } writer.WritePropertyName("createOption"u8); writer.WriteStringValue(CreateOption.ToString()); @@ -65,18 +101,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(DeleteOption)) { writer.WritePropertyName("deleteOption"u8); writer.WriteStringValue(DeleteOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineOSDisk DeserializeVirtualMachineOSDisk(JsonElement element) + internal static VirtualMachineOSDisk DeserializeVirtualMachineOSDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,6 +150,7 @@ internal static VirtualMachineOSDisk DeserializeVirtualMachineOSDisk(JsonElement Optional diskSizeGB = default; Optional managedDisk = default; Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType"u8)) @@ -195,8 +253,61 @@ internal static VirtualMachineOSDisk DeserializeVirtualMachineOSDisk(JsonElement deleteOption = new DiskDeleteOptionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineOSDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, vhd.Value, image.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), diffDiskSettings.Value, createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineOSDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineOSDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineOSDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineOSDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineOSDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineOSDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineOSDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, vhd.Value, image.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), diffDiskSettings.Value, createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(deleteOption)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineOSDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.cs index ff5107117de1..e03ba1620db7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSDisk.cs @@ -6,20 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Specifies information about the operating system disk used by the virtual machine. For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). public partial class VirtualMachineOSDisk { - /// Initializes a new instance of VirtualMachineOSDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies how the virtual machine should be created. Possible values are: **Attach.** This value is used when you are using a specialized disk to create the virtual machine. **FromImage.** This value is used when you are using an image to create the virtual machine. If you are using a platform image, you should also use the imageReference element described above. If you are using a marketplace image, you should also use the plan element previously described. public VirtualMachineOSDisk(DiskCreateOptionType createOption) { CreateOption = createOption; } - /// Initializes a new instance of VirtualMachineOSDisk. + /// Initializes a new instance of . /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**. /// Specifies the encryption settings for the OS Disk. Minimum api-version: 2015-06-15. /// The disk name. @@ -32,7 +36,8 @@ public VirtualMachineOSDisk(DiskCreateOptionType createOption) /// Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. The property 'diskSizeGB' is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. /// The managed disk parameters. /// Specifies whether OS Disk should be deleted or detached upon VM deletion. Possible values are: **Delete.** If this value is used, the OS disk is deleted when VM is deleted. **Detach.** If this value is used, the os disk is retained after VM is deleted. The default value is set to **Detach**. For an ephemeral OS Disk, the default value is set to **Delete**. The user cannot change the delete option for an ephemeral OS Disk. - internal VirtualMachineOSDisk(SupportedOperatingSystemType? osType, DiskEncryptionSettings encryptionSettings, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingType? caching, bool? writeAcceleratorEnabled, DiffDiskSettings diffDiskSettings, DiskCreateOptionType createOption, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, DiskDeleteOptionType? deleteOption) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineOSDisk(SupportedOperatingSystemType? osType, DiskEncryptionSettings encryptionSettings, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingType? caching, bool? writeAcceleratorEnabled, DiffDiskSettings diffDiskSettings, DiskCreateOptionType createOption, int? diskSizeGB, VirtualMachineManagedDisk managedDisk, DiskDeleteOptionType? deleteOption, Dictionary serializedAdditionalRawData) { OSType = osType; EncryptionSettings = encryptionSettings; @@ -46,6 +51,12 @@ internal VirtualMachineOSDisk(SupportedOperatingSystemType? osType, DiskEncrypti DiskSizeGB = diskSizeGB; ManagedDisk = managedDisk; DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineOSDisk() + { } /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. Possible values are: **Windows,** **Linux.**. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.Serialization.cs index 7ea5885507ad..0b45c51617e1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineOSProfile : IUtf8JsonSerializable + public partial class VirtualMachineOSProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ComputerName)) { @@ -39,12 +46,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsConfiguration)) { writer.WritePropertyName("windowsConfiguration"u8); - writer.WriteObjectValue(WindowsConfiguration); + if (WindowsConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxConfiguration)) { writer.WritePropertyName("linuxConfiguration"u8); - writer.WriteObjectValue(LinuxConfiguration); + if (LinuxConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Secrets)) { @@ -52,7 +73,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -66,11 +94,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("requireGuestProvisionSignal"u8); writer.WriteBooleanValue(RequireGuestProvisionSignal.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineOSProfile DeserializeVirtualMachineOSProfile(JsonElement element) + internal static VirtualMachineOSProfile DeserializeVirtualMachineOSProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +126,7 @@ internal static VirtualMachineOSProfile DeserializeVirtualMachineOSProfile(JsonE Optional> secrets = default; Optional allowExtensionOperations = default; Optional requireGuestProvisionSignal = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("computerName"u8)) @@ -156,8 +199,61 @@ internal static VirtualMachineOSProfile DeserializeVirtualMachineOSProfile(JsonE requireGuestProvisionSignal = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineOSProfile(computerName.Value, adminUsername.Value, adminPassword.Value, customData.Value, windowsConfiguration.Value, linuxConfiguration.Value, Optional.ToList(secrets), Optional.ToNullable(allowExtensionOperations), Optional.ToNullable(requireGuestProvisionSignal), serializedAdditionalRawData); + } + + VirtualMachineOSProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineOSProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineOSProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineOSProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineOSProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineOSProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineOSProfile(computerName.Value, adminUsername.Value, adminPassword.Value, customData.Value, windowsConfiguration.Value, linuxConfiguration.Value, Optional.ToList(secrets), Optional.ToNullable(allowExtensionOperations), Optional.ToNullable(requireGuestProvisionSignal)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineOSProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.cs index 46872fd5b0ab..c0245a909834 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineOSProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned. public partial class VirtualMachineOSProfile { - /// Initializes a new instance of VirtualMachineOSProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineOSProfile() { Secrets = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineOSProfile. + /// Initializes a new instance of . /// Specifies the host OS name of the virtual machine. This name cannot be updated after the VM is created. **Max-length (Windows):** 15 characters. **Max-length (Linux):** 64 characters. For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). /// Specifies the name of the administrator account. <br><br> This property cannot be updated after the VM is created. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters. /// Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). @@ -29,7 +33,8 @@ public VirtualMachineOSProfile() /// Specifies set of certificates that should be installed onto the virtual machine. To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault virtual machine extension for Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). /// Specifies whether extension operations should be allowed on the virtual machine. This may only be set to False when no extensions are present on the virtual machine. /// Optional property which must either be set to True or omitted. - internal VirtualMachineOSProfile(string computerName, string adminUsername, string adminPassword, string customData, WindowsConfiguration windowsConfiguration, LinuxConfiguration linuxConfiguration, IList secrets, bool? allowExtensionOperations, bool? requireGuestProvisionSignal) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineOSProfile(string computerName, string adminUsername, string adminPassword, string customData, WindowsConfiguration windowsConfiguration, LinuxConfiguration linuxConfiguration, IList secrets, bool? allowExtensionOperations, bool? requireGuestProvisionSignal, Dictionary serializedAdditionalRawData) { ComputerName = computerName; AdminUsername = adminUsername; @@ -40,6 +45,7 @@ internal VirtualMachineOSProfile(string computerName, string adminUsername, stri Secrets = secrets; AllowExtensionOperations = allowExtensionOperations; RequireGuestProvisionSignal = requireGuestProvisionSignal; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the host OS name of the virtual machine. This name cannot be updated after the VM is created. **Max-length (Windows):** 15 characters. **Max-length (Linux):** 64 characters. For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/azure-resource-manager/management/resource-name-rules). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.Serialization.cs index 085ff5b4c068..93580d0b285e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.Serialization.cs @@ -5,20 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachinePatch : IUtf8JsonSerializable + public partial class VirtualMachinePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); - writer.WriteObjectValue(Plan); + if (Plan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Plan).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -51,37 +68,86 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(DiagnosticsProfile)) { writer.WritePropertyName("diagnosticsProfile"u8); - writer.WriteObjectValue(DiagnosticsProfile); + if (DiagnosticsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AvailabilitySet)) { @@ -111,7 +177,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BillingProfile)) { writer.WritePropertyName("billingProfile"u8); - writer.WriteObjectValue(BillingProfile); + if (BillingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BillingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(Host)) { @@ -141,7 +214,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ScheduledEventsProfile)) { writer.WritePropertyName("scheduledEventsProfile"u8); - writer.WriteObjectValue(ScheduledEventsProfile); + if (ScheduledEventsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduledEventsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(UserData)) { @@ -151,15 +231,411 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CapacityReservation)) { writer.WritePropertyName("capacityReservation"u8); - writer.WriteObjectValue(CapacityReservation); + if (CapacityReservation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CapacityReservation).Serialize(writer, options); + } } if (Optional.IsDefined(ApplicationProfile)) { writer.WritePropertyName("applicationProfile"u8); - writer.WriteObjectValue(ApplicationProfile); + if (ApplicationProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApplicationProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachinePatch DeserializeVirtualMachinePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional plan = default; + Optional identity = default; + Optional> zones = default; + Optional> tags = default; + Optional hardwareProfile = default; + Optional storageProfile = default; + Optional additionalCapabilities = default; + Optional osProfile = default; + Optional networkProfile = default; + Optional securityProfile = default; + Optional diagnosticsProfile = default; + Optional availabilitySet = default; + Optional virtualMachineScaleSet = default; + Optional proximityPlacementGroup = default; + Optional priority = default; + Optional evictionPolicy = default; + Optional billingProfile = default; + Optional host = default; + Optional hostGroup = default; + Optional provisioningState = default; + Optional instanceView = default; + Optional licenseType = default; + Optional vmId = default; + Optional extensionsTimeBudget = default; + Optional platformFaultDomain = default; + Optional scheduledEventsProfile = default; + Optional userData = default; + Optional capacityReservation = default; + Optional applicationProfile = default; + Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("plan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + plan = ComputePlan.DeserializeComputePlan(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("hardwareProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hardwareProfile = VirtualMachineHardwareProfile.DeserializeVirtualMachineHardwareProfile(property0.Value); + continue; + } + if (property0.NameEquals("storageProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = VirtualMachineStorageProfile.DeserializeVirtualMachineStorageProfile(property0.Value); + continue; + } + if (property0.NameEquals("additionalCapabilities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.Value); + continue; + } + if (property0.NameEquals("osProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osProfile = VirtualMachineOSProfile.DeserializeVirtualMachineOSProfile(property0.Value); + continue; + } + if (property0.NameEquals("networkProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = VirtualMachineNetworkProfile.DeserializeVirtualMachineNetworkProfile(property0.Value); + continue; + } + if (property0.NameEquals("securityProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = SecurityProfile.DeserializeSecurityProfile(property0.Value); + continue; + } + if (property0.NameEquals("diagnosticsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property0.Value); + continue; + } + if (property0.NameEquals("availabilitySet"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availabilitySet = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("virtualMachineScaleSet"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualMachineScaleSet = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("proximityPlacementGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + proximityPlacementGroup = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("priority"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priority = new VirtualMachinePriorityType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("evictionPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + evictionPolicy = new VirtualMachineEvictionPolicyType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("billingProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + billingProfile = BillingProfile.DeserializeBillingProfile(property0.Value); + continue; + } + if (property0.NameEquals("host"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + host = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("hostGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostGroup = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("instanceView"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceView = VirtualMachineInstanceView.DeserializeVirtualMachineInstanceView(property0.Value); + continue; + } + if (property0.NameEquals("licenseType"u8)) + { + licenseType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmId"u8)) + { + vmId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("extensionsTimeBudget"u8)) + { + extensionsTimeBudget = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("platformFaultDomain"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platformFaultDomain = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("scheduledEventsProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduledEventsProfile = ComputeScheduledEventsProfile.DeserializeComputeScheduledEventsProfile(property0.Value); + continue; + } + if (property0.NameEquals("userData"u8)) + { + userData = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("capacityReservation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacityReservation = CapacityReservationProfile.DeserializeCapacityReservationProfile(property0.Value); + continue; + } + if (property0.NameEquals("applicationProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationProfile = ApplicationProfile.DeserializeApplicationProfile(property0.Value); + continue; + } + if (property0.NameEquals("timeCreated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeCreated = property0.Value.GetDateTimeOffset("O"); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachinePatch(Optional.ToDictionary(tags), plan.Value, identity, Optional.ToList(zones), hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet, virtualMachineScaleSet, proximityPlacementGroup, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host, hostGroup, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + VirtualMachinePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.cs index 5be481cc7e45..d65fb163e60f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatch.cs @@ -16,12 +16,77 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a Virtual Machine Update. public partial class VirtualMachinePatch : ComputeResourcePatch { - /// Initializes a new instance of VirtualMachinePatch. + /// Initializes a new instance of . public VirtualMachinePatch() { Zones = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + /// The identity of the virtual machine, if configured. + /// The virtual machine zones. + /// Specifies the hardware settings for the virtual machine. + /// Specifies the storage settings for the virtual machine disks. + /// Specifies additional capabilities enabled or disabled on the virtual machine. + /// Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. + /// Specifies the network interfaces of the virtual machine. + /// Specifies the Security related profile settings for the virtual machine. + /// Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + /// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). For more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates). Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + /// Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. This property cannot exist along with a non-null properties.availabilitySet reference. Minimum api‐version: 2019‐03‐01. + /// Specifies information about the proximity placement group that the virtual machine should be assigned to. Minimum api-version: 2018-04-01. + /// Specifies the priority for the virtual machine. Minimum api-version: 2019-03-01. + /// Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. + /// Specifies the billing related details of a Azure Spot virtual machine. Minimum api-version: 2019-03-01. + /// Specifies information about the dedicated host that the virtual machine resides in. Minimum api-version: 2018-10-01. + /// Specifies information about the dedicated host group that the virtual machine resides in. **Note:** User cannot specify both host and hostGroup properties. Minimum api-version: 2020-06-01. + /// The provisioning state, which only appears in the response. + /// The virtual machine instance view. + /// Specifies that the image or disk that is being used was licensed on-premises. <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) <br><br> [Azure Hybrid Use Benefit for Linux Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> Minimum api-version: 2015-06-15. + /// Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + /// Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. + /// Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set. The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' greater than 1. This property cannot be updated once the Virtual Machine is created. Fault domain assignment can be viewed in the Virtual Machine Instance View. Minimum api‐version: 2020‐12‐01. + /// Specifies Scheduled Event related configurations. + /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. Minimum api-version: 2021-03-01. + /// Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. + /// Specifies the gallery applications that should be made available to the VM/VMSS. + /// Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. + /// Keeps track of any properties unknown to the library. + internal VirtualMachinePatch(IDictionary tags, ComputePlan plan, ManagedServiceIdentity identity, IList zones, VirtualMachineHardwareProfile hardwareProfile, VirtualMachineStorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, VirtualMachineOSProfile osProfile, VirtualMachineNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, WritableSubResource virtualMachineScaleSet, WritableSubResource proximityPlacementGroup, VirtualMachinePriorityType? priority, VirtualMachineEvictionPolicyType? evictionPolicy, BillingProfile billingProfile, WritableSubResource host, WritableSubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Plan = plan; + Identity = identity; + Zones = zones; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + AdditionalCapabilities = additionalCapabilities; + OSProfile = osProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + AvailabilitySet = availabilitySet; + VirtualMachineScaleSet = virtualMachineScaleSet; + ProximityPlacementGroup = proximityPlacementGroup; + Priority = priority; + EvictionPolicy = evictionPolicy; + BillingProfile = billingProfile; + Host = host; + HostGroup = hostGroup; + ProvisioningState = provisioningState; + InstanceView = instanceView; + LicenseType = licenseType; + VmId = vmId; + ExtensionsTimeBudget = extensionsTimeBudget; + PlatformFaultDomain = platformFaultDomain; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + CapacityReservation = capacityReservation; + ApplicationProfile = applicationProfile; + TimeCreated = timeCreated; + } + /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. public ComputePlan Plan { get; set; } /// The identity of the virtual machine, if configured. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.Serialization.cs index 8ce6425615c5..67a26c9d0545 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.Serialization.cs @@ -5,16 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachinePatchStatus + public partial class VirtualMachinePatchStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachinePatchStatus DeserializeVirtualMachinePatchStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AvailablePatchSummary)) + { + writer.WritePropertyName("availablePatchSummary"u8); + if (AvailablePatchSummary is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AvailablePatchSummary).Serialize(writer, options); + } + } + if (Optional.IsDefined(LastPatchInstallationSummary)) + { + writer.WritePropertyName("lastPatchInstallationSummary"u8); + if (LastPatchInstallationSummary is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LastPatchInstallationSummary).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachinePatchStatus DeserializeVirtualMachinePatchStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +73,7 @@ internal static VirtualMachinePatchStatus DeserializeVirtualMachinePatchStatus(J Optional availablePatchSummary = default; Optional lastPatchInstallationSummary = default; Optional> configurationStatuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("availablePatchSummary"u8)) @@ -56,8 +108,61 @@ internal static VirtualMachinePatchStatus DeserializeVirtualMachinePatchStatus(J configurationStatuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachinePatchStatus(availablePatchSummary.Value, lastPatchInstallationSummary.Value, Optional.ToList(configurationStatuses)); + return new VirtualMachinePatchStatus(availablePatchSummary.Value, lastPatchInstallationSummary.Value, Optional.ToList(configurationStatuses), serializedAdditionalRawData); + } + + VirtualMachinePatchStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinePatchStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinePatchStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinePatchStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinePatchStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinePatchStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinePatchStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs index 783e9734a1ea..6c16d352c4d6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePatchStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Compute.Models /// The status of virtual machine patch operations. public partial class VirtualMachinePatchStatus { - /// Initializes a new instance of VirtualMachinePatchStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachinePatchStatus() { ConfigurationStatuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachinePatchStatus. + /// Initializes a new instance of . /// The available patch summary of the latest assessment operation for the virtual machine. /// The installation summary of the latest installation operation for the virtual machine. /// The enablement status of the specified patchMode. - internal VirtualMachinePatchStatus(AvailablePatchSummary availablePatchSummary, LastPatchInstallationSummary lastPatchInstallationSummary, IReadOnlyList configurationStatuses) + /// Keeps track of any properties unknown to the library. + internal VirtualMachinePatchStatus(AvailablePatchSummary availablePatchSummary, LastPatchInstallationSummary lastPatchInstallationSummary, IReadOnlyList configurationStatuses, Dictionary serializedAdditionalRawData) { AvailablePatchSummary = availablePatchSummary; LastPatchInstallationSummary = lastPatchInstallationSummary; ConfigurationStatuses = configurationStatuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The available patch summary of the latest assessment operation for the virtual machine. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs index 66cba4f774d3..660263e02bf6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs @@ -5,24 +5,38 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachinePublicIPAddressConfiguration : IUtf8JsonSerializable + public partial class VirtualMachinePublicIPAddressConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -39,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DnsSettings)) { writer.WritePropertyName("dnsSettings"u8); - writer.WriteObjectValue(DnsSettings); + if (DnsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(IPTags)) { @@ -47,7 +68,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPTags) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -67,11 +95,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicIPAllocationMethod.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMachinePublicIPAddressConfiguration(JsonElement element) + internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMachinePublicIPAddressConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +127,7 @@ internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMac Optional publicIPPrefix = default; Optional publicIPAddressVersion = default; Optional publicIPAllocationMethod = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -181,8 +224,61 @@ internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMac } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachinePublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(deleteOption), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(publicIPAllocationMethod), serializedAdditionalRawData); + } + + VirtualMachinePublicIPAddressConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinePublicIPAddressConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinePublicIPAddressConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinePublicIPAddressConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinePublicIPAddressConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinePublicIPAddressConfiguration(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachinePublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(deleteOption), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(publicIPAllocationMethod)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinePublicIPAddressConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs index a1c07d228c5b..49e0ecd4f7ea 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines IP Configuration's PublicIPAddress configuration. public partial class VirtualMachinePublicIPAddressConfiguration { - /// Initializes a new instance of VirtualMachinePublicIPAddressConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The publicIP address configuration name. /// is null. public VirtualMachinePublicIPAddressConfiguration(string name) @@ -26,7 +29,7 @@ public VirtualMachinePublicIPAddressConfiguration(string name) IPTags = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachinePublicIPAddressConfiguration. + /// Initializes a new instance of . /// The publicIP address configuration name. /// Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. /// The idle timeout of the public IP address. @@ -36,7 +39,8 @@ public VirtualMachinePublicIPAddressConfiguration(string name) /// The PublicIPPrefix from which to allocate publicIP addresses. /// Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. /// Specify the public IP allocation type. - internal VirtualMachinePublicIPAddressConfiguration(string name, ComputePublicIPAddressSku sku, int? idleTimeoutInMinutes, ComputeDeleteOption? deleteOption, VirtualMachinePublicIPAddressDnsSettingsConfiguration dnsSettings, IList ipTags, WritableSubResource publicIPPrefix, IPVersion? publicIPAddressVersion, PublicIPAllocationMethod? publicIPAllocationMethod) + /// Keeps track of any properties unknown to the library. + internal VirtualMachinePublicIPAddressConfiguration(string name, ComputePublicIPAddressSku sku, int? idleTimeoutInMinutes, ComputeDeleteOption? deleteOption, VirtualMachinePublicIPAddressDnsSettingsConfiguration dnsSettings, IList ipTags, WritableSubResource publicIPPrefix, IPVersion? publicIPAddressVersion, PublicIPAllocationMethod? publicIPAllocationMethod, Dictionary serializedAdditionalRawData) { Name = name; Sku = sku; @@ -47,6 +51,12 @@ internal VirtualMachinePublicIPAddressConfiguration(string name, ComputePublicIP PublicIPPrefix = publicIPPrefix; PublicIPAddressVersion = publicIPAddressVersion; PublicIPAllocationMethod = publicIPAllocationMethod; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachinePublicIPAddressConfiguration() + { } /// The publicIP address configuration name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.Serialization.cs index b3f0b95576cb..280cf103d04d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachinePublicIPAddressDnsSettingsConfiguration : IUtf8JsonSerializable + public partial class VirtualMachinePublicIPAddressDnsSettingsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("domainNameLabel"u8); writer.WriteStringValue(DomainNameLabel); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("domainNameLabelScope"u8); writer.WriteStringValue(DomainNameLabelScope.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachinePublicIPAddressDnsSettingsConfiguration DeserializeVirtualMachinePublicIPAddressDnsSettingsConfiguration(JsonElement element) + internal static VirtualMachinePublicIPAddressDnsSettingsConfiguration DeserializeVirtualMachinePublicIPAddressDnsSettingsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string domainNameLabel = default; Optional domainNameLabelScope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainNameLabel"u8)) @@ -49,8 +72,61 @@ internal static VirtualMachinePublicIPAddressDnsSettingsConfiguration Deserializ domainNameLabelScope = new DomainNameLabelScopeType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachinePublicIPAddressDnsSettingsConfiguration(domainNameLabel, Optional.ToNullable(domainNameLabelScope), serializedAdditionalRawData); + } + + VirtualMachinePublicIPAddressDnsSettingsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinePublicIPAddressDnsSettingsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinePublicIPAddressDnsSettingsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinePublicIPAddressDnsSettingsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinePublicIPAddressDnsSettingsConfiguration model) + { + if (model is null) + { + return null; } - return new VirtualMachinePublicIPAddressDnsSettingsConfiguration(domainNameLabel, Optional.ToNullable(domainNameLabelScope)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinePublicIPAddressDnsSettingsConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinePublicIPAddressDnsSettingsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs index 7e4a80370c07..471b3e0165c0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressDnsSettingsConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines network configuration's DNS settings. public partial class VirtualMachinePublicIPAddressDnsSettingsConfiguration { - /// Initializes a new instance of VirtualMachinePublicIPAddressDnsSettingsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. /// is null. public VirtualMachinePublicIPAddressDnsSettingsConfiguration(string domainNameLabel) @@ -23,13 +27,20 @@ public VirtualMachinePublicIPAddressDnsSettingsConfiguration(string domainNameLa DomainNameLabel = domainNameLabel; } - /// Initializes a new instance of VirtualMachinePublicIPAddressDnsSettingsConfiguration. + /// Initializes a new instance of . /// The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. /// The Domain name label scope of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the hashed domain name label with policy according to the domain name label scope and vm network profile unique ID. - internal VirtualMachinePublicIPAddressDnsSettingsConfiguration(string domainNameLabel, DomainNameLabelScopeType? domainNameLabelScope) + /// Keeps track of any properties unknown to the library. + internal VirtualMachinePublicIPAddressDnsSettingsConfiguration(string domainNameLabel, DomainNameLabelScopeType? domainNameLabelScope, Dictionary serializedAdditionalRawData) { DomainNameLabel = domainNameLabel; DomainNameLabelScope = domainNameLabelScope; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachinePublicIPAddressDnsSettingsConfiguration() + { } /// The Domain name label prefix of the PublicIPAddress resources that will be created. The generated name label is the concatenation of the domain name label and vm network profile unique ID. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.Serialization.cs index 5ea27b66f5d6..d2b82c0e23f0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineReimageContent : IUtf8JsonSerializable + public partial class VirtualMachineReimageContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TempDisk)) { @@ -28,9 +36,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static VirtualMachineReimageContent DeserializeVirtualMachineReimageContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional tempDisk = default; + Optional exactVersion = default; + Optional osProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tempDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tempDisk = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("exactVersion"u8)) + { + exactVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("osProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osProfile = OSProfileProvisioningData.DeserializeOSProfileProvisioningData(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineReimageContent(Optional.ToNullable(tempDisk), exactVersion.Value, osProfile.Value, serializedAdditionalRawData); + } + + VirtualMachineReimageContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineReimageContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineReimageContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineReimageContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineReimageContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineReimageContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineReimageContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.cs index 0667dc78689e..4c704f68695b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineReimageContent.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be reimaged. public partial class VirtualMachineReimageContent { - /// Initializes a new instance of VirtualMachineReimageContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineReimageContent() { } + /// Initializes a new instance of . + /// Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + /// Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk is reimaged to the existing version of OS Disk. + /// Specifies information required for reimaging the non-ephemeral OS disk. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineReimageContent(bool? tempDisk, string exactVersion, OSProfileProvisioningData osProfile, Dictionary serializedAdditionalRawData) + { + TempDisk = tempDisk; + ExactVersion = exactVersion; + OSProfile = osProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. public bool? TempDisk { get; set; } /// Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk is reimaged to the existing version of OS Disk. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandData.Serialization.cs index 4a5c0f16d947..9bcb94740110 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineRunCommandData : IUtf8JsonSerializable + public partial class VirtualMachineRunCommandData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -37,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Parameters)) { @@ -45,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -55,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ProtectedParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -92,12 +119,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(OutputBlobManagedIdentity)) { writer.WritePropertyName("outputBlobManagedIdentity"u8); - writer.WriteObjectValue(OutputBlobManagedIdentity); + if (OutputBlobManagedIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OutputBlobManagedIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(ErrorBlobManagedIdentity)) { writer.WritePropertyName("errorBlobManagedIdentity"u8); - writer.WriteObjectValue(ErrorBlobManagedIdentity); + if (ErrorBlobManagedIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ErrorBlobManagedIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(TreatFailureAsDeploymentFailure)) { @@ -105,11 +146,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(TreatFailureAsDeploymentFailure.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineRunCommandData DeserializeVirtualMachineRunCommandData(JsonElement element) + internal static VirtualMachineRunCommandData DeserializeVirtualMachineRunCommandData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -134,6 +189,7 @@ internal static VirtualMachineRunCommandData DeserializeVirtualMachineRunCommand Optional provisioningState = default; Optional instanceView = default; Optional treatFailureAsDeploymentFailure = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -315,8 +371,61 @@ internal static VirtualMachineRunCommandData DeserializeVirtualMachineRunCommand } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineRunCommandData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, source.Value, Optional.ToList(parameters), Optional.ToList(protectedParameters), Optional.ToNullable(asyncExecution), runAsUser.Value, runAsPassword.Value, Optional.ToNullable(timeoutInSeconds), outputBlobUri.Value, errorBlobUri.Value, outputBlobManagedIdentity.Value, errorBlobManagedIdentity.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(treatFailureAsDeploymentFailure), serializedAdditionalRawData); + } + + VirtualMachineRunCommandData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRunCommandData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRunCommandData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRunCommandData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRunCommandData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRunCommandData(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineRunCommandData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, source.Value, Optional.ToList(parameters), Optional.ToList(protectedParameters), Optional.ToNullable(asyncExecution), runAsUser.Value, runAsPassword.Value, Optional.ToNullable(timeoutInSeconds), outputBlobUri.Value, errorBlobUri.Value, outputBlobManagedIdentity.Value, errorBlobManagedIdentity.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(treatFailureAsDeploymentFailure)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRunCommandData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.Serialization.cs index 2a48dadc1650..cd27db13766d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.Serialization.cs @@ -8,14 +8,92 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineRunCommandInstanceView + public partial class VirtualMachineRunCommandInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineRunCommandInstanceView DeserializeVirtualMachineRunCommandInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ExecutionState)) + { + writer.WritePropertyName("executionState"u8); + writer.WriteStringValue(ExecutionState.Value.ToString()); + } + if (Optional.IsDefined(ExecutionMessage)) + { + writer.WritePropertyName("executionMessage"u8); + writer.WriteStringValue(ExecutionMessage); + } + if (Optional.IsDefined(ExitCode)) + { + writer.WritePropertyName("exitCode"u8); + writer.WriteNumberValue(ExitCode.Value); + } + if (Optional.IsDefined(Output)) + { + writer.WritePropertyName("output"u8); + writer.WriteStringValue(Output); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteStringValue(Error); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineRunCommandInstanceView DeserializeVirtualMachineRunCommandInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +106,7 @@ internal static VirtualMachineRunCommandInstanceView DeserializeVirtualMachineRu Optional startTime = default; Optional endTime = default; Optional> statuses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("executionState"u8)) @@ -95,8 +174,61 @@ internal static VirtualMachineRunCommandInstanceView DeserializeVirtualMachineRu statuses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineRunCommandInstanceView(Optional.ToNullable(executionState), executionMessage.Value, Optional.ToNullable(exitCode), output.Value, error.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(statuses), serializedAdditionalRawData); + } + + VirtualMachineRunCommandInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRunCommandInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRunCommandInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRunCommandInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRunCommandInstanceView model) + { + if (model is null) + { + return null; } - return new VirtualMachineRunCommandInstanceView(Optional.ToNullable(executionState), executionMessage.Value, Optional.ToNullable(exitCode), output.Value, error.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(statuses)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRunCommandInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRunCommandInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.cs index 66cc1298e099..9e1b66c950a3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandInstanceView.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a virtual machine run command. public partial class VirtualMachineRunCommandInstanceView { - /// Initializes a new instance of VirtualMachineRunCommandInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineRunCommandInstanceView() { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineRunCommandInstanceView. + /// Initializes a new instance of . /// Script execution status. /// Communicate script configuration errors or execution messages. /// Exit code returned from script execution. @@ -29,7 +32,8 @@ internal VirtualMachineRunCommandInstanceView() /// Script start time. /// Script end time. /// The resource status information. - internal VirtualMachineRunCommandInstanceView(ExecutionState? executionState, string executionMessage, int? exitCode, string output, string error, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList statuses) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRunCommandInstanceView(ExecutionState? executionState, string executionMessage, int? exitCode, string output, string error, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList statuses, Dictionary serializedAdditionalRawData) { ExecutionState = executionState; ExecutionMessage = executionMessage; @@ -39,6 +43,7 @@ internal VirtualMachineRunCommandInstanceView(ExecutionState? executionState, st StartOn = startOn; EndOn = endOn; Statuses = statuses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Script execution status. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.Serialization.cs index 48280c18f2ad..28fba5b6ebb6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineRunCommandResult + public partial class VirtualMachineRunCommandResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineRunCommandResult DeserializeVirtualMachineRunCommandResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineRunCommandResult DeserializeVirtualMachineRunCommandResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static VirtualMachineRunCommandResult DeserializeVirtualMachineRunComma value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineRunCommandResult(Optional.ToList(value)); + return new VirtualMachineRunCommandResult(Optional.ToList(value), serializedAdditionalRawData); + } + + VirtualMachineRunCommandResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRunCommandResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRunCommandResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRunCommandResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRunCommandResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRunCommandResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRunCommandResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.cs index 7a9fdb039a09..867401978a44 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// The VirtualMachineRunCommandResult. public partial class VirtualMachineRunCommandResult { - /// Initializes a new instance of VirtualMachineRunCommandResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineRunCommandResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineRunCommandResult. + /// Initializes a new instance of . /// Run command operation response. - internal VirtualMachineRunCommandResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRunCommandResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Run command operation response. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.Serialization.cs index 7cb070009f27..7dcb8ea9e4b2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineRunCommandScriptSource : IUtf8JsonSerializable + public partial class VirtualMachineRunCommandScriptSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Script)) { @@ -34,13 +41,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ScriptUriManagedIdentity)) { writer.WritePropertyName("scriptUriManagedIdentity"u8); - writer.WriteObjectValue(ScriptUriManagedIdentity); + if (ScriptUriManagedIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScriptUriManagedIdentity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static VirtualMachineRunCommandScriptSource DeserializeVirtualMachineRunCommandScriptSource(JsonElement element) + internal static VirtualMachineRunCommandScriptSource DeserializeVirtualMachineRunCommandScriptSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static VirtualMachineRunCommandScriptSource DeserializeVirtualMachineRu Optional scriptUri = default; Optional commandId = default; Optional scriptUriManagedIdentity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("script"u8)) @@ -79,8 +108,61 @@ internal static VirtualMachineRunCommandScriptSource DeserializeVirtualMachineRu scriptUriManagedIdentity = RunCommandManagedIdentity.DeserializeRunCommandManagedIdentity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineRunCommandScriptSource(script.Value, scriptUri.Value, commandId.Value, scriptUriManagedIdentity.Value, serializedAdditionalRawData); + } + + VirtualMachineRunCommandScriptSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRunCommandScriptSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRunCommandScriptSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRunCommandScriptSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRunCommandScriptSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRunCommandScriptSource(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineRunCommandScriptSource(script.Value, scriptUri.Value, commandId.Value, scriptUriManagedIdentity.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRunCommandScriptSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.cs index c9ca9ad579a0..f055faf46a7f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandScriptSource.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes the script sources for run command. Use only one of script, scriptUri, commandId. public partial class VirtualMachineRunCommandScriptSource { - /// Initializes a new instance of VirtualMachineRunCommandScriptSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineRunCommandScriptSource() { } - /// Initializes a new instance of VirtualMachineRunCommandScriptSource. + /// Initializes a new instance of . /// Specifies the script content to be executed on the VM. /// Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. /// Specifies a commandId of predefined built-in script. /// User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, and managed identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - internal VirtualMachineRunCommandScriptSource(string script, Uri scriptUri, string commandId, RunCommandManagedIdentity scriptUriManagedIdentity) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRunCommandScriptSource(string script, Uri scriptUri, string commandId, RunCommandManagedIdentity scriptUriManagedIdentity, Dictionary serializedAdditionalRawData) { Script = script; ScriptUri = scriptUri; CommandId = commandId; ScriptUriManagedIdentity = scriptUriManagedIdentity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the script content to be executed on the VM. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.Serialization.cs index 652752723d3a..4c3c6e540ef4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineRunCommandUpdate : IUtf8JsonSerializable + public partial class VirtualMachineRunCommandUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -31,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Parameters)) { @@ -39,7 +54,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -49,7 +71,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ProtectedParameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -86,12 +115,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(OutputBlobManagedIdentity)) { writer.WritePropertyName("outputBlobManagedIdentity"u8); - writer.WriteObjectValue(OutputBlobManagedIdentity); + if (OutputBlobManagedIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OutputBlobManagedIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(ErrorBlobManagedIdentity)) { writer.WritePropertyName("errorBlobManagedIdentity"u8); - writer.WriteObjectValue(ErrorBlobManagedIdentity); + if (ErrorBlobManagedIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ErrorBlobManagedIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(TreatFailureAsDeploymentFailure)) { @@ -99,7 +142,252 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(TreatFailureAsDeploymentFailure.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineRunCommandUpdate DeserializeVirtualMachineRunCommandUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional source = default; + Optional> parameters = default; + Optional> protectedParameters = default; + Optional asyncExecution = default; + Optional runAsUser = default; + Optional runAsPassword = default; + Optional timeoutInSeconds = default; + Optional outputBlobUri = default; + Optional errorBlobUri = default; + Optional outputBlobManagedIdentity = default; + Optional errorBlobManagedIdentity = default; + Optional provisioningState = default; + Optional instanceView = default; + Optional treatFailureAsDeploymentFailure = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("source"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = VirtualMachineRunCommandScriptSource.DeserializeVirtualMachineRunCommandScriptSource(property0.Value); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RunCommandInputParameter.DeserializeRunCommandInputParameter(item)); + } + parameters = array; + continue; + } + if (property0.NameEquals("protectedParameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RunCommandInputParameter.DeserializeRunCommandInputParameter(item)); + } + protectedParameters = array; + continue; + } + if (property0.NameEquals("asyncExecution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + asyncExecution = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("runAsUser"u8)) + { + runAsUser = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("runAsPassword"u8)) + { + runAsPassword = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("timeoutInSeconds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeoutInSeconds = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("outputBlobUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputBlobUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("errorBlobUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorBlobUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("outputBlobManagedIdentity"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputBlobManagedIdentity = RunCommandManagedIdentity.DeserializeRunCommandManagedIdentity(property0.Value); + continue; + } + if (property0.NameEquals("errorBlobManagedIdentity"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorBlobManagedIdentity = RunCommandManagedIdentity.DeserializeRunCommandManagedIdentity(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("instanceView"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceView = VirtualMachineRunCommandInstanceView.DeserializeVirtualMachineRunCommandInstanceView(property0.Value); + continue; + } + if (property0.NameEquals("treatFailureAsDeploymentFailure"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + treatFailureAsDeploymentFailure = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineRunCommandUpdate(Optional.ToDictionary(tags), source.Value, Optional.ToList(parameters), Optional.ToList(protectedParameters), Optional.ToNullable(asyncExecution), runAsUser.Value, runAsPassword.Value, Optional.ToNullable(timeoutInSeconds), outputBlobUri.Value, errorBlobUri.Value, outputBlobManagedIdentity.Value, errorBlobManagedIdentity.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(treatFailureAsDeploymentFailure), serializedAdditionalRawData); + } + + VirtualMachineRunCommandUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRunCommandUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRunCommandUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRunCommandUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRunCommandUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRunCommandUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRunCommandUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.cs index 27206aca960a..442b7138a3cd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandUpdate.cs @@ -14,13 +14,48 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a Virtual Machine run command. public partial class VirtualMachineRunCommandUpdate : ComputeResourcePatch { - /// Initializes a new instance of VirtualMachineRunCommandUpdate. + /// Initializes a new instance of . public VirtualMachineRunCommandUpdate() { Parameters = new ChangeTrackingList(); ProtectedParameters = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource tags. + /// The source of the run command script. + /// The parameters used by the script. + /// The parameters used by the script. + /// Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + /// Specifies the user account on the VM when executing the run command. + /// Specifies the user account password on the VM when executing the run command. + /// The timeout in seconds to execute the run command. + /// Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. + /// Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. + /// User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + /// User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + /// The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. + /// The virtual machine run command instance view. + /// Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRunCommandUpdate(IDictionary tags, VirtualMachineRunCommandScriptSource source, IList parameters, IList protectedParameters, bool? asyncExecution, string runAsUser, string runAsPassword, int? timeoutInSeconds, Uri outputBlobUri, Uri errorBlobUri, RunCommandManagedIdentity outputBlobManagedIdentity, RunCommandManagedIdentity errorBlobManagedIdentity, string provisioningState, VirtualMachineRunCommandInstanceView instanceView, bool? treatFailureAsDeploymentFailure, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Source = source; + Parameters = parameters; + ProtectedParameters = protectedParameters; + AsyncExecution = asyncExecution; + RunAsUser = runAsUser; + RunAsPassword = runAsPassword; + TimeoutInSeconds = timeoutInSeconds; + OutputBlobUri = outputBlobUri; + ErrorBlobUri = errorBlobUri; + OutputBlobManagedIdentity = outputBlobManagedIdentity; + ErrorBlobManagedIdentity = errorBlobManagedIdentity; + ProvisioningState = provisioningState; + InstanceView = instanceView; + TreatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; + } + /// The source of the run command script. public VirtualMachineRunCommandScriptSource Source { get; set; } /// The parameters used by the script. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.Serialization.cs index 6353e84151a1..5e7d17812e2f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineRunCommandsListResult + internal partial class VirtualMachineRunCommandsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineRunCommandsListResult DeserializeVirtualMachineRunCommandsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineRunCommandsListResult DeserializeVirtualMachineRunCommandsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineRunCommandsListResult DeserializeVirtualMachineRun nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineRunCommandsListResult(value, nextLink.Value); + return new VirtualMachineRunCommandsListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineRunCommandsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineRunCommandsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineRunCommandsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineRunCommandsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineRunCommandsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineRunCommandsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineRunCommandsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.cs index 6398cac146c0..ffcf8563c7c8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineRunCommandsListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List run command operation response. internal partial class VirtualMachineRunCommandsListResult { - /// Initializes a new instance of VirtualMachineRunCommandsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of run commands. /// is null. internal VirtualMachineRunCommandsListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineRunCommandsListResult(IEnumerable Initializes a new instance of VirtualMachineRunCommandsListResult. + /// Initializes a new instance of . /// The list of run commands. /// The uri to fetch the next page of run commands. - internal VirtualMachineRunCommandsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRunCommandsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineRunCommandsListResult() + { } /// The list of run commands. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.Serialization.cs index 5f117faab9bb..0395f14b8ee2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetConvertToSinglePlacementGroupContent : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetConvertToSinglePlacementGroupContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ActivePlacementGroupId)) { writer.WritePropertyName("activePlacementGroupId"u8); writer.WriteStringValue(ActivePlacementGroupId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetConvertToSinglePlacementGroupContent DeserializeVirtualMachineScaleSetConvertToSinglePlacementGroupContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional activePlacementGroupId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("activePlacementGroupId"u8)) + { + activePlacementGroupId = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetConvertToSinglePlacementGroupContent(activePlacementGroupId.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetConvertToSinglePlacementGroupContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetConvertToSinglePlacementGroupContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetConvertToSinglePlacementGroupContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetConvertToSinglePlacementGroupContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetConvertToSinglePlacementGroupContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetConvertToSinglePlacementGroupContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetConvertToSinglePlacementGroupContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.cs index b52d39c8f05f..c8ce3cf6d47d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetConvertToSinglePlacementGroupContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The VirtualMachineScaleSetConvertToSinglePlacementGroupContent. public partial class VirtualMachineScaleSetConvertToSinglePlacementGroupContent { - /// Initializes a new instance of VirtualMachineScaleSetConvertToSinglePlacementGroupContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetConvertToSinglePlacementGroupContent() { } + /// Initializes a new instance of . + /// Id of the placement group in which you want future virtual machine instances to be placed. To query placement group Id, please use Virtual Machine Scale Set VMs - Get API. If not provided, the platform will choose one with maximum number of virtual machine instances. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetConvertToSinglePlacementGroupContent(string activePlacementGroupId, Dictionary serializedAdditionalRawData) + { + ActivePlacementGroupId = activePlacementGroupId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Id of the placement group in which you want future virtual machine instances to be placed. To query placement group Id, please use Virtual Machine Scale Set VMs - Get API. If not provided, the platform will choose one with maximum number of virtual machine instances. public string ActivePlacementGroupId { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs index 690236969f1a..a1c52027bced 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs @@ -8,27 +8,47 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineScaleSetData : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); - writer.WriteObjectValue(Plan); + if (Plan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Plan).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -68,17 +88,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UpgradePolicy)) { writer.WritePropertyName("upgradePolicy"u8); - writer.WriteObjectValue(UpgradePolicy); + if (UpgradePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpgradePolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AutomaticRepairsPolicy)) { writer.WritePropertyName("automaticRepairsPolicy"u8); - writer.WriteObjectValue(AutomaticRepairsPolicy); + if (AutomaticRepairsPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutomaticRepairsPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(VirtualMachineProfile)) { writer.WritePropertyName("virtualMachineProfile"u8); - writer.WriteObjectValue(VirtualMachineProfile); + if (VirtualMachineProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VirtualMachineProfile).Serialize(writer, options); + } } if (Optional.IsDefined(Overprovision)) { @@ -118,12 +159,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(ScaleInPolicy)) { writer.WritePropertyName("scaleInPolicy"u8); - writer.WriteObjectValue(ScaleInPolicy); + if (ScaleInPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScaleInPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(OrchestrationMode)) { @@ -133,12 +188,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SpotRestorePolicy)) { writer.WritePropertyName("spotRestorePolicy"u8); - writer.WriteObjectValue(SpotRestorePolicy); + if (SpotRestorePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SpotRestorePolicy).Serialize(writer, options); + } } if (Optional.IsDefined(PriorityMixPolicy)) { writer.WritePropertyName("priorityMixPolicy"u8); - writer.WriteObjectValue(PriorityMixPolicy); + if (PriorityMixPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PriorityMixPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(IsMaximumCapacityConstrained)) { @@ -146,11 +215,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsMaximumCapacityConstrained.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData(JsonElement element) + internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -185,6 +268,7 @@ internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData Optional priorityMixPolicy = default; Optional timeCreated = default; Optional constrainedMaximumCapacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -455,8 +539,61 @@ internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, plan.Value, identity, Optional.ToList(zones), extendedLocation, upgradePolicy.Value, automaticRepairsPolicy.Value, virtualMachineProfile.Value, provisioningState.Value, Optional.ToNullable(overprovision), Optional.ToNullable(doNotRunExtensionsOnOverprovisionedVms), uniqueId.Value, Optional.ToNullable(singlePlacementGroup), Optional.ToNullable(zoneBalance), Optional.ToNullable(platformFaultDomainCount), proximityPlacementGroup, hostGroup, additionalCapabilities.Value, scaleInPolicy.Value, Optional.ToNullable(orchestrationMode), spotRestorePolicy.Value, priorityMixPolicy.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(constrainedMaximumCapacity), serializedAdditionalRawData); + } + + VirtualMachineScaleSetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetData model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, plan.Value, identity, Optional.ToList(zones), extendedLocation, upgradePolicy.Value, automaticRepairsPolicy.Value, virtualMachineProfile.Value, provisioningState.Value, Optional.ToNullable(overprovision), Optional.ToNullable(doNotRunExtensionsOnOverprovisionedVms), uniqueId.Value, Optional.ToNullable(singlePlacementGroup), Optional.ToNullable(zoneBalance), Optional.ToNullable(platformFaultDomainCount), proximityPlacementGroup, hostGroup, additionalCapabilities.Value, scaleInPolicy.Value, Optional.ToNullable(orchestrationMode), spotRestorePolicy.Value, priorityMixPolicy.Value, Optional.ToNullable(timeCreated), Optional.ToNullable(constrainedMaximumCapacity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.Serialization.cs index 6624acddbf41..c36b94a7b571 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetDataDisk : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetDataDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -42,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(DiskIopsReadWrite)) { @@ -59,11 +74,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("deleteOption"u8); writer.WriteStringValue(DeleteOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetDataDisk DeserializeVirtualMachineScaleSetDataDisk(JsonElement element) + internal static VirtualMachineScaleSetDataDisk DeserializeVirtualMachineScaleSetDataDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +107,7 @@ internal static VirtualMachineScaleSetDataDisk DeserializeVirtualMachineScaleSet Optional diskIOPSReadWrite = default; Optional diskMBpsReadWrite = default; Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -158,8 +188,61 @@ internal static VirtualMachineScaleSetDataDisk DeserializeVirtualMachineScaleSet deleteOption = new DiskDeleteOptionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetDataDisk(name.Value, lun, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineScaleSetDataDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetDataDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetDataDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetDataDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetDataDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetDataDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetDataDisk(name.Value, lun, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, Optional.ToNullable(diskSizeGB), managedDisk.Value, Optional.ToNullable(diskIOPSReadWrite), Optional.ToNullable(diskMBpsReadWrite), Optional.ToNullable(deleteOption)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetDataDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs index 801337496bed..c95a30516e96 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set data disk. public partial class VirtualMachineScaleSetDataDisk { - /// Initializes a new instance of VirtualMachineScaleSetDataDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. /// The create option. public VirtualMachineScaleSetDataDisk(int lun, DiskCreateOptionType createOption) @@ -19,7 +25,7 @@ public VirtualMachineScaleSetDataDisk(int lun, DiskCreateOptionType createOption CreateOption = createOption; } - /// Initializes a new instance of VirtualMachineScaleSetDataDisk. + /// Initializes a new instance of . /// The disk name. /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. /// Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium storage.**. @@ -30,7 +36,8 @@ public VirtualMachineScaleSetDataDisk(int lun, DiskCreateOptionType createOption /// Specifies the Read-Write IOPS for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB. /// Specifies the bandwidth in MB per second for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB. /// Specifies whether data disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with Flexible OrchestrationMode only).<br><br> Possible values: <br><br> **Delete** If this value is used, the data disk is deleted when the VMSS Flex VM is deleted.<br><br> **Detach** If this value is used, the data disk is retained after VMSS Flex VM is deleted.<br><br> The default value is set to **Delete**. - internal VirtualMachineScaleSetDataDisk(string name, int lun, CachingType? caching, bool? writeAcceleratorEnabled, DiskCreateOptionType createOption, int? diskSizeGB, VirtualMachineScaleSetManagedDisk managedDisk, long? diskIopsReadWrite, long? diskMBpsReadWrite, DiskDeleteOptionType? deleteOption) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetDataDisk(string name, int lun, CachingType? caching, bool? writeAcceleratorEnabled, DiskCreateOptionType createOption, int? diskSizeGB, VirtualMachineScaleSetManagedDisk managedDisk, long? diskIopsReadWrite, long? diskMBpsReadWrite, DiskDeleteOptionType? deleteOption, Dictionary serializedAdditionalRawData) { Name = name; Lun = lun; @@ -42,6 +49,12 @@ internal VirtualMachineScaleSetDataDisk(string name, int lun, CachingType? cachi DiskIopsReadWrite = diskIopsReadWrite; DiskMBpsReadWrite = diskMBpsReadWrite; DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetDataDisk() + { } /// The disk name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs index 262baf280ff5..7a4728d9a13f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs @@ -8,16 +8,118 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineScaleSetExtensionData : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetExtensionData DeserializeVirtualMachineScaleSetExtensionData(JsonElement element) + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ForceUpdateTag)) + { + writer.WritePropertyName("forceUpdateTag"u8); + writer.WriteStringValue(ForceUpdateTag); + } + if (Optional.IsDefined(Publisher)) + { + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + } + if (Optional.IsDefined(ExtensionType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ExtensionType); + } + if (Optional.IsDefined(TypeHandlerVersion)) + { + writer.WritePropertyName("typeHandlerVersion"u8); + writer.WriteStringValue(TypeHandlerVersion); + } + if (Optional.IsDefined(AutoUpgradeMinorVersion)) + { + writer.WritePropertyName("autoUpgradeMinorVersion"u8); + writer.WriteBooleanValue(AutoUpgradeMinorVersion.Value); + } + if (Optional.IsDefined(EnableAutomaticUpgrade)) + { + writer.WritePropertyName("enableAutomaticUpgrade"u8); + writer.WriteBooleanValue(EnableAutomaticUpgrade.Value); + } + if (Optional.IsDefined(Settings)) + { + writer.WritePropertyName("settings"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Settings); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(Settings.ToString()).RootElement); +#endif + } + if (Optional.IsDefined(ProtectedSettings)) + { + writer.WritePropertyName("protectedSettings"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(ProtectedSettings); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(ProtectedSettings.ToString()).RootElement); +#endif + } + if (Optional.IsCollectionDefined(ProvisionAfterExtensions)) + { + writer.WritePropertyName("provisionAfterExtensions"u8); + writer.WriteStartArray(); + foreach (var item in ProvisionAfterExtensions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SuppressFailures)) + { + writer.WritePropertyName("suppressFailures"u8); + writer.WriteBooleanValue(SuppressFailures.Value); + } + if (Optional.IsDefined(KeyVaultProtectedSettings)) + { + writer.WritePropertyName("protectedSettingsFromKeyVault"u8); + if (KeyVaultProtectedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProtectedSettings).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetExtensionData DeserializeVirtualMachineScaleSetExtensionData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +140,7 @@ internal static VirtualMachineScaleSetExtensionData DeserializeVirtualMachineSca Optional> provisionAfterExtensions = default; Optional suppressFailures = default; Optional protectedSettingsFromKeyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -169,8 +272,61 @@ internal static VirtualMachineScaleSetExtensionData DeserializeVirtualMachineSca } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetExtensionData(id, name, type, systemData.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions), Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value); + return new VirtualMachineScaleSetExtensionData(id, name, type, systemData.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions), Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetExtensionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.Serialization.cs index e98f7660ea48..2cece9744d3b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetExtensionListResult + internal partial class VirtualMachineScaleSetExtensionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetExtensionListResult DeserializeVirtualMachineScaleSetExtensionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetExtensionListResult DeserializeVirtualMachineScaleSetExtensionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineScaleSetExtensionListResult DeserializeVirtualMach nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetExtensionListResult(value, nextLink.Value); + return new VirtualMachineScaleSetExtensionListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetExtensionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetExtensionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetExtensionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetExtensionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetExtensionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetExtensionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetExtensionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.cs index 306210496cb1..de504af08b20 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List VM scale set extension operation response. internal partial class VirtualMachineScaleSetExtensionListResult { - /// Initializes a new instance of VirtualMachineScaleSetExtensionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of VM scale set extensions. /// is null. internal VirtualMachineScaleSetExtensionListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineScaleSetExtensionListResult(IEnumerable Initializes a new instance of VirtualMachineScaleSetExtensionListResult. + /// Initializes a new instance of . /// The list of VM scale set extensions. /// The uri to fetch the next page of VM scale set extensions. Call ListNext() with this to fetch the next page of VM scale set extensions. - internal VirtualMachineScaleSetExtensionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetExtensionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetExtensionListResult() + { } /// The list of VM scale set extensions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.Serialization.cs index d08f81ec33bb..3f0381fd5efd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetExtensionPatch : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetExtensionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -86,14 +92,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProtectedSettings)) { writer.WritePropertyName("protectedSettingsFromKeyVault"u8); - writer.WriteObjectValue(KeyVaultProtectedSettings); + if (KeyVaultProtectedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProtectedSettings).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetExtensionPatch DeserializeVirtualMachineScaleSetExtensionPatch(JsonElement element) + internal static VirtualMachineScaleSetExtensionPatch DeserializeVirtualMachineScaleSetExtensionPatch(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -114,6 +141,7 @@ internal static VirtualMachineScaleSetExtensionPatch DeserializeVirtualMachineSc Optional> provisionAfterExtensions = default; Optional suppressFailures = default; Optional protectedSettingsFromKeyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -245,8 +273,61 @@ internal static VirtualMachineScaleSetExtensionPatch DeserializeVirtualMachineSc } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetExtensionPatch(id, name, type, systemData.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions), Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value); + return new VirtualMachineScaleSetExtensionPatch(id, name, type, systemData.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions), Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetExtensionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetExtensionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetExtensionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetExtensionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetExtensionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetExtensionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetExtensionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.cs index 9802b2ee5787..d0e37d25e440 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionPatch.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a Virtual Machine Scale Set Extension. public partial class VirtualMachineScaleSetExtensionPatch : ResourceData { - /// Initializes a new instance of VirtualMachineScaleSetExtensionPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetExtensionPatch() { ProvisionAfterExtensions = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetExtensionPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +41,8 @@ public VirtualMachineScaleSetExtensionPatch() /// Collection of extension names after which this extension needs to be provisioned. /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. /// The extensions protected settings that are passed by reference, and consumed from key vault. - internal VirtualMachineScaleSetExtensionPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, IList provisionAfterExtensions, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetExtensionPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, IList provisionAfterExtensions, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ForceUpdateTag = forceUpdateTag; Publisher = publisher; @@ -52,6 +56,7 @@ internal VirtualMachineScaleSetExtensionPatch(ResourceIdentifier id, string name ProvisionAfterExtensions = provisionAfterExtensions; SuppressFailures = suppressFailures; KeyVaultProtectedSettings = keyVaultProtectedSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.Serialization.cs index 39c9d580ab57..cfbdcfc51334 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetExtensionProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetExtensionProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Extensions)) { @@ -23,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Extensions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,17 +46,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extensionsTimeBudget"u8); writer.WriteStringValue(ExtensionsTimeBudget); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetExtensionProfile DeserializeVirtualMachineScaleSetExtensionProfile(JsonElement element) + internal static VirtualMachineScaleSetExtensionProfile DeserializeVirtualMachineScaleSetExtensionProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> extensions = default; Optional extensionsTimeBudget = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extensions"u8)) @@ -64,8 +93,61 @@ internal static VirtualMachineScaleSetExtensionProfile DeserializeVirtualMachine extensionsTimeBudget = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetExtensionProfile(Optional.ToList(extensions), extensionsTimeBudget.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetExtensionProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetExtensionProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetExtensionProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetExtensionProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetExtensionProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetExtensionProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetExtensionProfile(Optional.ToList(extensions), extensionsTimeBudget.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetExtensionProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs index 9416132775ac..7e4632a827d6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set extension profile. public partial class VirtualMachineScaleSetExtensionProfile { - /// Initializes a new instance of VirtualMachineScaleSetExtensionProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetExtensionProfile() { Extensions = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetExtensionProfile. + /// Initializes a new instance of . /// The virtual machine scale set child extension resources. /// Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). Minimum api-version: 2020-06-01. - internal VirtualMachineScaleSetExtensionProfile(IList extensions, string extensionsTimeBudget) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetExtensionProfile(IList extensions, string extensionsTimeBudget, Dictionary serializedAdditionalRawData) { Extensions = extensions; ExtensionsTimeBudget = extensionsTimeBudget; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The virtual machine scale set child extension resources. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.Serialization.cs index 09f25d096a81..bc049d55732c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetHardwareProfile : IUtf8JsonSerializable + internal partial class VirtualMachineScaleSetHardwareProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VmSizeProperties)) { writer.WritePropertyName("vmSizeProperties"u8); - writer.WriteObjectValue(VmSizeProperties); + if (VmSizeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VmSizeProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetHardwareProfile DeserializeVirtualMachineScaleSetHardwareProfile(JsonElement element) + internal static VirtualMachineScaleSetHardwareProfile DeserializeVirtualMachineScaleSetHardwareProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vmSizeProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmSizeProperties"u8)) @@ -41,8 +71,61 @@ internal static VirtualMachineScaleSetHardwareProfile DeserializeVirtualMachineS vmSizeProperties = VirtualMachineSizeProperties.DeserializeVirtualMachineSizeProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetHardwareProfile(vmSizeProperties.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetHardwareProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetHardwareProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetHardwareProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetHardwareProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetHardwareProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetHardwareProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetHardwareProfile(vmSizeProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetHardwareProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs index 4bff084823ee..db47a395954d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetHardwareProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the hardware settings for the virtual machine scale set. internal partial class VirtualMachineScaleSetHardwareProfile { - /// Initializes a new instance of VirtualMachineScaleSetHardwareProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetHardwareProfile() { } - /// Initializes a new instance of VirtualMachineScaleSetHardwareProfile. + /// Initializes a new instance of . /// Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-11-01. Please follow the instructions in [VM Customization](https://aka.ms/vmcustomization) for more details. - internal VirtualMachineScaleSetHardwareProfile(VirtualMachineSizeProperties vmSizeProperties) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetHardwareProfile(VirtualMachineSizeProperties vmSizeProperties, Dictionary serializedAdditionalRawData) { VmSizeProperties = vmSizeProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the properties for customizing the size of the virtual machine. Minimum api-version: 2021-11-01. Please follow the instructions in [VM Customization](https://aka.ms/vmcustomization) for more details. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs index 8cca54b6ed2e..14b1f6c73b60 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetIPConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetIPConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -39,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPAddressConfiguration)) { writer.WritePropertyName("publicIPAddressConfiguration"u8); - writer.WriteObjectValue(PublicIPAddressConfiguration); + if (PublicIPAddressConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublicIPAddressConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(PrivateIPAddressVersion)) { @@ -87,11 +101,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineScaleSetIPConfiguration(JsonElement element) + internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineScaleSetIPConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -106,6 +134,7 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS Optional> applicationSecurityGroups = default; Optional> loadBalancerBackendAddressPools = default; Optional> loadBalancerInboundNatPools = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -226,8 +255,61 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetIPConfiguration(id.Value, name, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools), serializedAdditionalRawData); + } + + VirtualMachineScaleSetIPConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetIPConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetIPConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetIPConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetIPConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetIPConfiguration(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetIPConfiguration(id.Value, name, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetIPConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs index a9e6a2bbde7d..c53107b34df2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set network profile's IP configuration. public partial class VirtualMachineScaleSetIPConfiguration : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineScaleSetIPConfiguration. + /// Initializes a new instance of . /// The IP configuration name. /// is null. public VirtualMachineScaleSetIPConfiguration(string name) @@ -29,7 +29,7 @@ public VirtualMachineScaleSetIPConfiguration(string name) LoadBalancerInboundNatPools = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetIPConfiguration. + /// Initializes a new instance of . /// Resource Id. /// The IP configuration name. /// Specifies the identifier of the subnet. @@ -40,7 +40,8 @@ public VirtualMachineScaleSetIPConfiguration(string name) /// Specifies an array of references to application security group. /// Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. /// Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. - internal VirtualMachineScaleSetIPConfiguration(ResourceIdentifier id, string name, WritableSubResource subnet, bool? primary, VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools) : base(id) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetIPConfiguration(ResourceIdentifier id, string name, WritableSubResource subnet, bool? primary, VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Name = name; Subnet = subnet; @@ -53,6 +54,11 @@ internal VirtualMachineScaleSetIPConfiguration(ResourceIdentifier id, string nam LoadBalancerInboundNatPools = loadBalancerInboundNatPools; } + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetIPConfiguration() + { + } + /// The IP configuration name. public string Name { get; set; } /// Specifies the identifier of the subnet. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.Serialization.cs index b1635ca4674e..5b9cff0d4fa1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetIPTag : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetIPTag : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IPTagType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tag"u8); writer.WriteStringValue(Tag); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetIPTag DeserializeVirtualMachineScaleSetIPTag(JsonElement element) + internal static VirtualMachineScaleSetIPTag DeserializeVirtualMachineScaleSetIPTag(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ipTagType = default; Optional tag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipTagType"u8)) @@ -48,8 +71,61 @@ internal static VirtualMachineScaleSetIPTag DeserializeVirtualMachineScaleSetIPT tag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetIPTag(ipTagType.Value, tag.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetIPTag IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetIPTag(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetIPTag IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetIPTag(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetIPTag model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetIPTag(ipTagType.Value, tag.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetIPTag(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetIPTag(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.cs index e03381020b88..fc2d71aba36e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPTag.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Contains the IP tag associated with the public IP address. public partial class VirtualMachineScaleSetIPTag { - /// Initializes a new instance of VirtualMachineScaleSetIPTag. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetIPTag() { } - /// Initializes a new instance of VirtualMachineScaleSetIPTag. + /// Initializes a new instance of . /// IP tag type. Example: FirstPartyUsage. /// IP tag associated with the public IP. Example: SQL, Storage etc. - internal VirtualMachineScaleSetIPTag(string ipTagType, string tag) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetIPTag(string ipTagType, string tag, Dictionary serializedAdditionalRawData) { IPTagType = ipTagType; Tag = tag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// IP tag type. Example: FirstPartyUsage. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.Serialization.cs index 7d744bdd3de8..4fa68929af8f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.Serialization.cs @@ -5,16 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetInstanceView + public partial class VirtualMachineScaleSetInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetInstanceView DeserializeVirtualMachineScaleSetInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetInstanceView DeserializeVirtualMachineScaleSetInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +67,7 @@ internal static VirtualMachineScaleSetInstanceView DeserializeVirtualMachineScal Optional> extensions = default; Optional> statuses = default; Optional> orchestrationServices = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("virtualMachine"u8)) @@ -76,8 +121,61 @@ internal static VirtualMachineScaleSetInstanceView DeserializeVirtualMachineScal orchestrationServices = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetInstanceView(virtualMachine.Value, Optional.ToList(extensions), Optional.ToList(statuses), Optional.ToList(orchestrationServices)); + return new VirtualMachineScaleSetInstanceView(virtualMachine.Value, Optional.ToList(extensions), Optional.ToList(statuses), Optional.ToList(orchestrationServices), serializedAdditionalRawData); + } + + VirtualMachineScaleSetInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs index 4f75183944ff..7d6dc38470c4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a virtual machine scale set. public partial class VirtualMachineScaleSetInstanceView { - /// Initializes a new instance of VirtualMachineScaleSetInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetInstanceView() { Extensions = new ChangeTrackingList(); @@ -21,17 +25,19 @@ internal VirtualMachineScaleSetInstanceView() OrchestrationServices = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetInstanceView. + /// Initializes a new instance of . /// The instance view status summary for the virtual machine scale set. /// The extensions information. /// The resource status information. /// The orchestration services information. - internal VirtualMachineScaleSetInstanceView(VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine, IReadOnlyList extensions, IReadOnlyList statuses, IReadOnlyList orchestrationServices) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetInstanceView(VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine, IReadOnlyList extensions, IReadOnlyList statuses, IReadOnlyList orchestrationServices, Dictionary serializedAdditionalRawData) { VirtualMachine = virtualMachine; Extensions = extensions; Statuses = statuses; OrchestrationServices = orchestrationServices; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The instance view status summary for the virtual machine scale set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.Serialization.cs index b9832bf4b4a4..31a5dafc5148 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetInstanceViewStatusesSummary + internal partial class VirtualMachineScaleSetInstanceViewStatusesSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetInstanceViewStatusesSummary DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetInstanceViewStatusesSummary DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> statusesSummary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("statusesSummary"u8)) @@ -36,8 +64,61 @@ internal static VirtualMachineScaleSetInstanceViewStatusesSummary DeserializeVir statusesSummary = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetInstanceViewStatusesSummary(Optional.ToList(statusesSummary)); + return new VirtualMachineScaleSetInstanceViewStatusesSummary(Optional.ToList(statusesSummary), serializedAdditionalRawData); + } + + VirtualMachineScaleSetInstanceViewStatusesSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetInstanceViewStatusesSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetInstanceViewStatusesSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetInstanceViewStatusesSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs index f01de0112e2d..ef61b9841aba 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetInstanceViewStatusesSummary.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Instance view statuses summary for virtual machines of a virtual machine scale set. internal partial class VirtualMachineScaleSetInstanceViewStatusesSummary { - /// Initializes a new instance of VirtualMachineScaleSetInstanceViewStatusesSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetInstanceViewStatusesSummary() { StatusesSummary = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetInstanceViewStatusesSummary. + /// Initializes a new instance of . /// The extensions information. - internal VirtualMachineScaleSetInstanceViewStatusesSummary(IReadOnlyList statusesSummary) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetInstanceViewStatusesSummary(IReadOnlyList statusesSummary, Dictionary serializedAdditionalRawData) { StatusesSummary = statusesSummary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The extensions information. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.Serialization.cs index 1b4fa312dc6b..9711dced556a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetListOSUpgradeHistory + internal partial class VirtualMachineScaleSetListOSUpgradeHistory : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetListOSUpgradeHistory DeserializeVirtualMachineScaleSetListOSUpgradeHistory(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetListOSUpgradeHistory DeserializeVirtualMachineScaleSetListOSUpgradeHistory(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static VirtualMachineScaleSetListOSUpgradeHistory DeserializeVirtualMac nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetListOSUpgradeHistory(value, nextLink.Value); + return new VirtualMachineScaleSetListOSUpgradeHistory(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetListOSUpgradeHistory IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetListOSUpgradeHistory(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetListOSUpgradeHistory IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetListOSUpgradeHistory(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetListOSUpgradeHistory model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetListOSUpgradeHistory(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetListOSUpgradeHistory(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.cs index d0f65b8c09d7..f743ce4f0e27 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListOSUpgradeHistory.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// List of Virtual Machine Scale Set OS Upgrade History operation response. internal partial class VirtualMachineScaleSetListOSUpgradeHistory { - /// Initializes a new instance of VirtualMachineScaleSetListOSUpgradeHistory. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of OS upgrades performed on the virtual machine scale set. /// is null. internal VirtualMachineScaleSetListOSUpgradeHistory(IEnumerable value) @@ -25,13 +28,20 @@ internal VirtualMachineScaleSetListOSUpgradeHistory(IEnumerable Initializes a new instance of VirtualMachineScaleSetListOSUpgradeHistory. + /// Initializes a new instance of . /// The list of OS upgrades performed on the virtual machine scale set. /// The uri to fetch the next page of OS Upgrade History. Call ListNext() with this to fetch the next page of history of upgrades. - internal VirtualMachineScaleSetListOSUpgradeHistory(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetListOSUpgradeHistory(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetListOSUpgradeHistory() + { } /// The list of OS upgrades performed on the virtual machine scale set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.Serialization.cs index 815e2f0f1d4f..d6901119dcd3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetListResult + internal partial class VirtualMachineScaleSetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetListResult DeserializeVirtualMachineScaleSetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetListResult DeserializeVirtualMachineScaleSetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineScaleSetListResult DeserializeVirtualMachineScaleS nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetListResult(value, nextLink.Value); + return new VirtualMachineScaleSetListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.cs index 4fbb2e6313df..5616ab459e9f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Virtual Machine operation response. internal partial class VirtualMachineScaleSetListResult { - /// Initializes a new instance of VirtualMachineScaleSetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of virtual machine scale sets. /// is null. internal VirtualMachineScaleSetListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineScaleSetListResult(IEnumerable Initializes a new instance of VirtualMachineScaleSetListResult. + /// Initializes a new instance of . /// The list of virtual machine scale sets. /// The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of VMSS. - internal VirtualMachineScaleSetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetListResult() + { } /// The list of virtual machine scale sets. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.Serialization.cs index e2ba21e25c1e..0039a17cd059 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetListSkusResult + internal partial class VirtualMachineScaleSetListSkusResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetListSkusResult DeserializeVirtualMachineScaleSetListSkusResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetListSkusResult DeserializeVirtualMachineScaleSetListSkusResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static VirtualMachineScaleSetListSkusResult DeserializeVirtualMachineSc nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetListSkusResult(value, nextLink.Value); + return new VirtualMachineScaleSetListSkusResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetListSkusResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetListSkusResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetListSkusResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetListSkusResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetListSkusResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetListSkusResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetListSkusResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.cs index d0c8d57623a8..b378a3252dfe 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListSkusResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// The Virtual Machine Scale Set List Skus operation response. internal partial class VirtualMachineScaleSetListSkusResult { - /// Initializes a new instance of VirtualMachineScaleSetListSkusResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of skus available for the virtual machine scale set. /// is null. internal VirtualMachineScaleSetListSkusResult(IEnumerable value) @@ -25,13 +28,20 @@ internal VirtualMachineScaleSetListSkusResult(IEnumerable Initializes a new instance of VirtualMachineScaleSetListSkusResult. + /// Initializes a new instance of . /// The list of skus available for the virtual machine scale set. /// The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with this to fetch the next page of VMSS Skus. - internal VirtualMachineScaleSetListSkusResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetListSkusResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetListSkusResult() + { } /// The list of skus available for the virtual machine scale set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.Serialization.cs index f722104748fd..d8edaa08f5a9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetListWithLinkResult + internal partial class VirtualMachineScaleSetListWithLinkResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetListWithLinkResult DeserializeVirtualMachineScaleSetListWithLinkResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetListWithLinkResult DeserializeVirtualMachineScaleSetListWithLinkResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineScaleSetListWithLinkResult DeserializeVirtualMachi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetListWithLinkResult(value, nextLink.Value); + return new VirtualMachineScaleSetListWithLinkResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetListWithLinkResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetListWithLinkResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetListWithLinkResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetListWithLinkResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetListWithLinkResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetListWithLinkResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetListWithLinkResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.cs index 27ffa1cc6169..5c0d481c5c8a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetListWithLinkResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Virtual Machine operation response. internal partial class VirtualMachineScaleSetListWithLinkResult { - /// Initializes a new instance of VirtualMachineScaleSetListWithLinkResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of virtual machine scale sets. /// is null. internal VirtualMachineScaleSetListWithLinkResult(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineScaleSetListWithLinkResult(IEnumerable Initializes a new instance of VirtualMachineScaleSetListWithLinkResult. + /// Initializes a new instance of . /// The list of virtual machine scale sets. /// The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of Virtual Machine Scale Sets. - internal VirtualMachineScaleSetListWithLinkResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetListWithLinkResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetListWithLinkResult() + { } /// The list of virtual machine scale sets. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.Serialization.cs index 3f8af90fa633..93b575a6cd7e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetManagedDisk : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetManagedDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StorageAccountType)) { @@ -29,13 +37,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetManagedDisk DeserializeVirtualMachineScaleSetManagedDisk(JsonElement element) + internal static VirtualMachineScaleSetManagedDisk DeserializeVirtualMachineScaleSetManagedDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +72,7 @@ internal static VirtualMachineScaleSetManagedDisk DeserializeVirtualMachineScale Optional storageAccountType = default; Optional diskEncryptionSet = default; Optional securityProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountType"u8)) @@ -72,8 +102,61 @@ internal static VirtualMachineScaleSetManagedDisk DeserializeVirtualMachineScale securityProfile = VirtualMachineDiskSecurityProfile.DeserializeVirtualMachineDiskSecurityProfile(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetManagedDisk(Optional.ToNullable(storageAccountType), diskEncryptionSet, securityProfile.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetManagedDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetManagedDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetManagedDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetManagedDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetManagedDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetManagedDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetManagedDisk(Optional.ToNullable(storageAccountType), diskEncryptionSet, securityProfile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetManagedDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.cs index 201e395323df..67f513ee3a5b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the parameters of a ScaleSet managed disk. public partial class VirtualMachineScaleSetManagedDisk { - /// Initializes a new instance of VirtualMachineScaleSetManagedDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetManagedDisk() { } - /// Initializes a new instance of VirtualMachineScaleSetManagedDisk. + /// Initializes a new instance of . /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed disk. /// Specifies the security profile for the managed disk. - internal VirtualMachineScaleSetManagedDisk(StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, VirtualMachineDiskSecurityProfile securityProfile) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetManagedDisk(StorageAccountType? storageAccountType, WritableSubResource diskEncryptionSet, VirtualMachineDiskSecurityProfile securityProfile, Dictionary serializedAdditionalRawData) { StorageAccountType = storageAccountType; DiskEncryptionSet = diskEncryptionSet; SecurityProfile = securityProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs index e08817d1aba8..23d8a8059a64 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetNetworkConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetNetworkConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -54,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DnsSettings)) { writer.WritePropertyName("dnsSettings"u8); - writer.WriteObjectValue(DnsSettings); + if (DnsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(IPConfigurations)) { @@ -62,7 +76,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,11 +108,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AuxiliarySku.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMachineScaleSetNetworkConfiguration(JsonElement element) + internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMachineScaleSetNetworkConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,6 +144,7 @@ internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMac Optional deleteOption = default; Optional auxiliaryMode = default; Optional auxiliarySku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -241,8 +277,61 @@ internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMac } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetNetworkConfiguration(id.Value, name, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(disableTcpStateTracking), Optional.ToNullable(enableFpga), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption), Optional.ToNullable(auxiliaryMode), Optional.ToNullable(auxiliarySku), serializedAdditionalRawData); + } + + VirtualMachineScaleSetNetworkConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetNetworkConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetNetworkConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetNetworkConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetNetworkConfiguration model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetNetworkConfiguration(id.Value, name, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(disableTcpStateTracking), Optional.ToNullable(enableFpga), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption), Optional.ToNullable(auxiliaryMode), Optional.ToNullable(auxiliarySku)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetNetworkConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetNetworkConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs index a74dd80f04b7..c1abdba41f51 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set network profile's network configurations. public partial class VirtualMachineScaleSetNetworkConfiguration : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineScaleSetNetworkConfiguration. + /// Initializes a new instance of . /// The network configuration name. /// is null. public VirtualMachineScaleSetNetworkConfiguration(string name) @@ -26,7 +26,7 @@ public VirtualMachineScaleSetNetworkConfiguration(string name) IPConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetNetworkConfiguration. + /// Initializes a new instance of . /// Resource Id. /// The network configuration name. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. @@ -40,7 +40,8 @@ public VirtualMachineScaleSetNetworkConfiguration(string name) /// Specify what happens to the network interface when the VM is deleted. /// Specifies whether the Auxiliary mode is enabled for the Network Interface resource. /// Specifies whether the Auxiliary sku is enabled for the Network Interface resource. - internal VirtualMachineScaleSetNetworkConfiguration(ResourceIdentifier id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? isTcpStateTrackingDisabled, bool? enableFpga, WritableSubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, ComputeDeleteOption? deleteOption, ComputeNetworkInterfaceAuxiliaryMode? auxiliaryMode, ComputeNetworkInterfaceAuxiliarySku? auxiliarySku) : base(id) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetNetworkConfiguration(ResourceIdentifier id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? isTcpStateTrackingDisabled, bool? enableFpga, WritableSubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, ComputeDeleteOption? deleteOption, ComputeNetworkInterfaceAuxiliaryMode? auxiliaryMode, ComputeNetworkInterfaceAuxiliarySku? auxiliarySku, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { Name = name; Primary = primary; @@ -56,6 +57,11 @@ internal VirtualMachineScaleSetNetworkConfiguration(ResourceIdentifier id, strin AuxiliarySku = auxiliarySku; } + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetNetworkConfiguration() + { + } + /// The network configuration name. public string Name { get; set; } /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.Serialization.cs index f22893485e0f..0090548c2150 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetNetworkConfigurationDnsSettings : IUtf8JsonSerializable + internal partial class VirtualMachineScaleSetNetworkConfigurationDnsSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DnsServers)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetNetworkConfigurationDnsSettings DeserializeVirtualMachineScaleSetNetworkConfigurationDnsSettings(JsonElement element) + internal static VirtualMachineScaleSetNetworkConfigurationDnsSettings DeserializeVirtualMachineScaleSetNetworkConfigurationDnsSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> dnsServers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dnsServers"u8)) @@ -52,8 +74,61 @@ internal static VirtualMachineScaleSetNetworkConfigurationDnsSettings Deserializ dnsServers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetNetworkConfigurationDnsSettings(Optional.ToList(dnsServers), serializedAdditionalRawData); + } + + VirtualMachineScaleSetNetworkConfigurationDnsSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetNetworkConfigurationDnsSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetNetworkConfigurationDnsSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetNetworkConfigurationDnsSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetNetworkConfigurationDnsSettings model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetNetworkConfigurationDnsSettings(Optional.ToList(dnsServers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetNetworkConfigurationDnsSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetNetworkConfigurationDnsSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs index e9dda6ea1ffe..20c30b8bb51b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines scale sets network configuration's DNS settings. internal partial class VirtualMachineScaleSetNetworkConfigurationDnsSettings { - /// Initializes a new instance of VirtualMachineScaleSetNetworkConfigurationDnsSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetNetworkConfigurationDnsSettings() { DnsServers = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetNetworkConfigurationDnsSettings. + /// Initializes a new instance of . /// List of DNS servers IP addresses. - internal VirtualMachineScaleSetNetworkConfigurationDnsSettings(IList dnsServers) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetNetworkConfigurationDnsSettings(IList dnsServers, Dictionary serializedAdditionalRawData) { DnsServers = dnsServers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of DNS servers IP addresses. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs index db0e7f1d80b3..1d0ee17adb73 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetNetworkProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HealthProbe)) { @@ -28,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaceConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("networkApiVersion"u8); writer.WriteStringValue(NetworkApiVersion.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineScaleSetNetworkProfile(JsonElement element) + internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineScaleSetNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineSc Optional healthProbe = default; Optional> networkInterfaceConfigurations = default; Optional networkApiVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("healthProbe"u8)) @@ -83,8 +112,61 @@ internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineSc networkApiVersion = new NetworkApiVersion(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetNetworkProfile(healthProbe, Optional.ToList(networkInterfaceConfigurations), Optional.ToNullable(networkApiVersion), serializedAdditionalRawData); + } + + VirtualMachineScaleSetNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetNetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetNetworkProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetNetworkProfile(healthProbe, Optional.ToList(networkInterfaceConfigurations), Optional.ToNullable(networkApiVersion)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs index c90e04864e16..478cdd8da1c2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set network profile. public partial class VirtualMachineScaleSetNetworkProfile { - /// Initializes a new instance of VirtualMachineScaleSetNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetNetworkProfile() { NetworkInterfaceConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetNetworkProfile. + /// Initializes a new instance of . /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. /// The list of network configurations. /// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. - internal VirtualMachineScaleSetNetworkProfile(WritableSubResource healthProbe, IList networkInterfaceConfigurations, NetworkApiVersion? networkApiVersion) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetNetworkProfile(WritableSubResource healthProbe, IList networkInterfaceConfigurations, NetworkApiVersion? networkApiVersion, Dictionary serializedAdditionalRawData) { HealthProbe = healthProbe; NetworkInterfaceConfigurations = networkInterfaceConfigurations; NetworkApiVersion = networkApiVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.Serialization.cs index 0c35fe3a0b5e..55e28a05865b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetOSDisk : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetOSDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -36,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiffDiskSettings)) { writer.WritePropertyName("diffDiskSettings"u8); - writer.WriteObjectValue(DiffDiskSettings); + if (DiffDiskSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiffDiskSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DiskSizeGB)) { @@ -51,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Image)) { writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image); + if (Image is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Image).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(VhdContainers)) { @@ -66,18 +87,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(DeleteOption)) { writer.WritePropertyName("deleteOption"u8); writer.WriteStringValue(DeleteOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOSDisk(JsonElement element) + internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOSDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,6 +135,7 @@ internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOS Optional> vhdContainers = default; Optional managedDisk = default; Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -191,8 +234,61 @@ internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOS deleteOption = new DiskDeleteOptionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetOSDisk(name.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, diffDiskSettings.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(osType), image.Value, Optional.ToList(vhdContainers), managedDisk.Value, Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineScaleSetOSDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetOSDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetOSDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetOSDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetOSDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetOSDisk(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetOSDisk(name.Value, Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), createOption, diffDiskSettings.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(osType), image.Value, Optional.ToList(vhdContainers), managedDisk.Value, Optional.ToNullable(deleteOption)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetOSDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs index 5ffa0cfedd4e..89ac58717b32 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSDisk.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set operating system disk. public partial class VirtualMachineScaleSetOSDisk { - /// Initializes a new instance of VirtualMachineScaleSetOSDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies how the virtual machines in the scale set should be created. The only allowed value is: **FromImage.** This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. public VirtualMachineScaleSetOSDisk(DiskCreateOptionType createOption) { @@ -22,7 +25,7 @@ public VirtualMachineScaleSetOSDisk(DiskCreateOptionType createOption) VhdContainers = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetOSDisk. + /// Initializes a new instance of . /// The disk name. /// Specifies the caching requirements. Possible values are: **None,** **ReadOnly,** **ReadWrite.** The default values are: **None for Standard storage. ReadOnly for Premium storage.**. /// Specifies whether writeAccelerator should be enabled or disabled on the disk. @@ -34,7 +37,8 @@ public VirtualMachineScaleSetOSDisk(DiskCreateOptionType createOption) /// Specifies the container urls that are used to store operating system disks for the scale set. /// The managed disk parameters. /// Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with Flexible OrchestrationMode only). <br><br> Possible values: <br><br> **Delete** If this value is used, the OS disk is deleted when VMSS Flex VM is deleted.<br><br> **Detach** If this value is used, the OS disk is retained after VMSS Flex VM is deleted. <br><br> The default value is set to **Delete**. For an Ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for Ephemeral OS Disk. - internal VirtualMachineScaleSetOSDisk(string name, CachingType? caching, bool? writeAcceleratorEnabled, DiskCreateOptionType createOption, DiffDiskSettings diffDiskSettings, int? diskSizeGB, SupportedOperatingSystemType? osType, VirtualHardDisk image, IList vhdContainers, VirtualMachineScaleSetManagedDisk managedDisk, DiskDeleteOptionType? deleteOption) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetOSDisk(string name, CachingType? caching, bool? writeAcceleratorEnabled, DiskCreateOptionType createOption, DiffDiskSettings diffDiskSettings, int? diskSizeGB, SupportedOperatingSystemType? osType, VirtualHardDisk image, IList vhdContainers, VirtualMachineScaleSetManagedDisk managedDisk, DiskDeleteOptionType? deleteOption, Dictionary serializedAdditionalRawData) { Name = name; Caching = caching; @@ -47,6 +51,12 @@ internal VirtualMachineScaleSetOSDisk(string name, CachingType? caching, bool? w VhdContainers = vhdContainers; ManagedDisk = managedDisk; DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetOSDisk() + { } /// The disk name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.Serialization.cs index 134c2122a0ff..90157286f728 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetOSProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetOSProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ComputerNamePrefix)) { @@ -39,12 +46,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsConfiguration)) { writer.WritePropertyName("windowsConfiguration"u8); - writer.WriteObjectValue(WindowsConfiguration); + if (WindowsConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxConfiguration)) { writer.WritePropertyName("linuxConfiguration"u8); - writer.WriteObjectValue(LinuxConfiguration); + if (LinuxConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Secrets)) { @@ -52,7 +73,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -66,11 +94,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("requireGuestProvisionSignal"u8); writer.WriteBooleanValue(RequireGuestProvisionSignal.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetOSProfile DeserializeVirtualMachineScaleSetOSProfile(JsonElement element) + internal static VirtualMachineScaleSetOSProfile DeserializeVirtualMachineScaleSetOSProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +126,7 @@ internal static VirtualMachineScaleSetOSProfile DeserializeVirtualMachineScaleSe Optional> secrets = default; Optional allowExtensionOperations = default; Optional requireGuestProvisionSignal = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("computerNamePrefix"u8)) @@ -156,8 +199,61 @@ internal static VirtualMachineScaleSetOSProfile DeserializeVirtualMachineScaleSe requireGuestProvisionSignal = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetOSProfile(computerNamePrefix.Value, adminUsername.Value, adminPassword.Value, customData.Value, windowsConfiguration.Value, linuxConfiguration.Value, Optional.ToList(secrets), Optional.ToNullable(allowExtensionOperations), Optional.ToNullable(requireGuestProvisionSignal), serializedAdditionalRawData); + } + + VirtualMachineScaleSetOSProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetOSProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetOSProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetOSProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetOSProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetOSProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetOSProfile(computerNamePrefix.Value, adminUsername.Value, adminPassword.Value, customData.Value, windowsConfiguration.Value, linuxConfiguration.Value, Optional.ToList(secrets), Optional.ToNullable(allowExtensionOperations), Optional.ToNullable(requireGuestProvisionSignal)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetOSProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs index d5ca286b96f7..062a3e2e55ae 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetOSProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set OS profile. public partial class VirtualMachineScaleSetOSProfile { - /// Initializes a new instance of VirtualMachineScaleSetOSProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetOSProfile() { Secrets = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetOSProfile. + /// Initializes a new instance of . /// Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long. /// Specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters. /// Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). @@ -29,7 +33,8 @@ public VirtualMachineScaleSetOSProfile() /// Specifies set of certificates that should be installed onto the virtual machines in the scale set. To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault virtual machine extension for Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). /// Specifies whether extension operations should be allowed on the virtual machine scale set. This may only be set to False when no extensions are present on the virtual machine scale set. /// Optional property which must either be set to True or omitted. - internal VirtualMachineScaleSetOSProfile(string computerNamePrefix, string adminUsername, string adminPassword, string customData, WindowsConfiguration windowsConfiguration, LinuxConfiguration linuxConfiguration, IList secrets, bool? allowExtensionOperations, bool? requireGuestProvisionSignal) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetOSProfile(string computerNamePrefix, string adminUsername, string adminPassword, string customData, WindowsConfiguration windowsConfiguration, LinuxConfiguration linuxConfiguration, IList secrets, bool? allowExtensionOperations, bool? requireGuestProvisionSignal, Dictionary serializedAdditionalRawData) { ComputerNamePrefix = computerNamePrefix; AdminUsername = adminUsername; @@ -40,6 +45,7 @@ internal VirtualMachineScaleSetOSProfile(string computerNamePrefix, string admin Secrets = secrets; AllowExtensionOperations = allowExtensionOperations; RequireGuestProvisionSignal = requireGuestProvisionSignal; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.Serialization.cs index 00579e178717..4a5abb422270 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.Serialization.cs @@ -5,25 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetPatch : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); - writer.WriteObjectValue(Plan); + if (Plan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Plan).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -46,17 +70,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UpgradePolicy)) { writer.WritePropertyName("upgradePolicy"u8); - writer.WriteObjectValue(UpgradePolicy); + if (UpgradePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpgradePolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AutomaticRepairsPolicy)) { writer.WritePropertyName("automaticRepairsPolicy"u8); - writer.WriteObjectValue(AutomaticRepairsPolicy); + if (AutomaticRepairsPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutomaticRepairsPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(VirtualMachineProfile)) { writer.WritePropertyName("virtualMachineProfile"u8); - writer.WriteObjectValue(VirtualMachineProfile); + if (VirtualMachineProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VirtualMachineProfile).Serialize(writer, options); + } } if (Optional.IsDefined(Overprovision)) { @@ -76,12 +121,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(ScaleInPolicy)) { writer.WritePropertyName("scaleInPolicy"u8); - writer.WriteObjectValue(ScaleInPolicy); + if (ScaleInPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScaleInPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ProximityPlacementGroup)) { @@ -91,15 +150,276 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PriorityMixPolicy)) { writer.WritePropertyName("priorityMixPolicy"u8); - writer.WriteObjectValue(PriorityMixPolicy); + if (PriorityMixPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PriorityMixPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(SpotRestorePolicy)) { writer.WritePropertyName("spotRestorePolicy"u8); - writer.WriteObjectValue(SpotRestorePolicy); + if (SpotRestorePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SpotRestorePolicy).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetPatch DeserializeVirtualMachineScaleSetPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional plan = default; + Optional identity = default; + Optional> tags = default; + Optional upgradePolicy = default; + Optional automaticRepairsPolicy = default; + Optional virtualMachineProfile = default; + Optional overprovision = default; + Optional doNotRunExtensionsOnOverprovisionedVms = default; + Optional singlePlacementGroup = default; + Optional additionalCapabilities = default; + Optional scaleInPolicy = default; + Optional proximityPlacementGroup = default; + Optional priorityMixPolicy = default; + Optional spotRestorePolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ComputeSku.DeserializeComputeSku(property.Value); + continue; + } + if (property.NameEquals("plan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + plan = ComputePlan.DeserializeComputePlan(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("upgradePolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradePolicy = VirtualMachineScaleSetUpgradePolicy.DeserializeVirtualMachineScaleSetUpgradePolicy(property0.Value); + continue; + } + if (property0.NameEquals("automaticRepairsPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + automaticRepairsPolicy = AutomaticRepairsPolicy.DeserializeAutomaticRepairsPolicy(property0.Value); + continue; + } + if (property0.NameEquals("virtualMachineProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualMachineProfile = VirtualMachineScaleSetUpdateVmProfile.DeserializeVirtualMachineScaleSetUpdateVmProfile(property0.Value); + continue; + } + if (property0.NameEquals("overprovision"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + overprovision = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("doNotRunExtensionsOnOverprovisionedVMs"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + doNotRunExtensionsOnOverprovisionedVms = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("singlePlacementGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + singlePlacementGroup = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("additionalCapabilities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.Value); + continue; + } + if (property0.NameEquals("scaleInPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scaleInPolicy = ScaleInPolicy.DeserializeScaleInPolicy(property0.Value); + continue; + } + if (property0.NameEquals("proximityPlacementGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + proximityPlacementGroup = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("priorityMixPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priorityMixPolicy = VirtualMachineScaleSetPriorityMixPolicy.DeserializeVirtualMachineScaleSetPriorityMixPolicy(property0.Value); + continue; + } + if (property0.NameEquals("spotRestorePolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spotRestorePolicy = SpotRestorePolicy.DeserializeSpotRestorePolicy(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetPatch(Optional.ToDictionary(tags), sku.Value, plan.Value, identity, upgradePolicy.Value, automaticRepairsPolicy.Value, virtualMachineProfile.Value, Optional.ToNullable(overprovision), Optional.ToNullable(doNotRunExtensionsOnOverprovisionedVms), Optional.ToNullable(singlePlacementGroup), additionalCapabilities.Value, scaleInPolicy.Value, proximityPlacementGroup, priorityMixPolicy.Value, spotRestorePolicy.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.cs index e313da27a306..0c10b7d82ffb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; @@ -14,11 +16,46 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a Virtual Machine Scale Set. public partial class VirtualMachineScaleSetPatch : ComputeResourcePatch { - /// Initializes a new instance of VirtualMachineScaleSetPatch. + /// Initializes a new instance of . public VirtualMachineScaleSetPatch() { } + /// Initializes a new instance of . + /// Resource tags. + /// The virtual machine scale set sku. + /// The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + /// The identity of the virtual machine scale set, if configured. + /// The upgrade policy. + /// Policy for automatic repairs. + /// The virtual machine profile. + /// Specifies whether the Virtual Machine Scale Set should be overprovisioned. + /// When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs. + /// When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true. + /// Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + /// Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. + /// Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. + /// Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. + /// Specifies the Spot Restore properties for the virtual machine scale set. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetPatch(IDictionary tags, ComputeSku sku, ComputePlan plan, ManagedServiceIdentity identity, VirtualMachineScaleSetUpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetUpdateVmProfile virtualMachineProfile, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVms, bool? singlePlacementGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, WritableSubResource proximityPlacementGroup, VirtualMachineScaleSetPriorityMixPolicy priorityMixPolicy, SpotRestorePolicy spotRestorePolicy, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + Sku = sku; + Plan = plan; + Identity = identity; + UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; + VirtualMachineProfile = virtualMachineProfile; + Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVms = doNotRunExtensionsOnOverprovisionedVms; + SinglePlacementGroup = singlePlacementGroup; + AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; + ProximityPlacementGroup = proximityPlacementGroup; + PriorityMixPolicy = priorityMixPolicy; + SpotRestorePolicy = spotRestorePolicy; + } + /// The virtual machine scale set sku. public ComputeSku Sku { get; set; } /// The purchase plan when deploying a virtual machine scale set from VM Marketplace images. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.Serialization.cs index 208564e2465b..c1581a87f2fd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetPriorityMixPolicy : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetPriorityMixPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BaseRegularPriorityCount)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("regularPriorityPercentageAboveBase"u8); writer.WriteNumberValue(RegularPriorityPercentageAboveBase.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetPriorityMixPolicy DeserializeVirtualMachineScaleSetPriorityMixPolicy(JsonElement element) + internal static VirtualMachineScaleSetPriorityMixPolicy DeserializeVirtualMachineScaleSetPriorityMixPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional baseRegularPriorityCount = default; Optional regularPriorityPercentageAboveBase = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("baseRegularPriorityCount"u8)) @@ -56,8 +79,61 @@ internal static VirtualMachineScaleSetPriorityMixPolicy DeserializeVirtualMachin regularPriorityPercentageAboveBase = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetPriorityMixPolicy(Optional.ToNullable(baseRegularPriorityCount), Optional.ToNullable(regularPriorityPercentageAboveBase), serializedAdditionalRawData); + } + + VirtualMachineScaleSetPriorityMixPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetPriorityMixPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetPriorityMixPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetPriorityMixPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetPriorityMixPolicy model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetPriorityMixPolicy(Optional.ToNullable(baseRegularPriorityCount), Optional.ToNullable(regularPriorityPercentageAboveBase)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetPriorityMixPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetPriorityMixPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.cs index 4f945243a74f..405d99347d71 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPriorityMixPolicy.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies the target splits for Spot and Regular priority VMs within a scale set with flexible orchestration mode. With this property the customer is able to specify the base number of regular priority VMs created as the VMSS flex instance scales out and the split between Spot and Regular priority VMs after this base target has been reached. public partial class VirtualMachineScaleSetPriorityMixPolicy { - /// Initializes a new instance of VirtualMachineScaleSetPriorityMixPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetPriorityMixPolicy() { } - /// Initializes a new instance of VirtualMachineScaleSetPriorityMixPolicy. + /// Initializes a new instance of . /// The base number of regular priority VMs that will be created in this scale set as it scales out. /// The percentage of VM instances, after the base regular priority count has been reached, that are expected to use regular priority. - internal VirtualMachineScaleSetPriorityMixPolicy(int? baseRegularPriorityCount, int? regularPriorityPercentageAboveBase) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetPriorityMixPolicy(int? baseRegularPriorityCount, int? regularPriorityPercentageAboveBase, Dictionary serializedAdditionalRawData) { BaseRegularPriorityCount = baseRegularPriorityCount; RegularPriorityPercentageAboveBase = regularPriorityPercentageAboveBase; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The base number of regular priority VMs that will be created in this scale set as it scales out. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs index 829ce02317f7..7f938d674b9c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs @@ -5,24 +5,38 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetPublicIPAddressConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetPublicIPAddressConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -34,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DnsSettings)) { writer.WritePropertyName("dnsSettings"u8); - writer.WriteObjectValue(DnsSettings); + if (DnsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(IPTags)) { @@ -42,7 +63,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPTags) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -62,11 +90,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DeleteOption.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVirtualMachineScaleSetPublicIPAddressConfiguration(JsonElement element) + internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVirtualMachineScaleSetPublicIPAddressConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +121,7 @@ internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVi Optional publicIPPrefix = default; Optional publicIPAddressVersion = default; Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -166,8 +209,61 @@ internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetPublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineScaleSetPublicIPAddressConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetPublicIPAddressConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetPublicIPAddressConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetPublicIPAddressConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetPublicIPAddressConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetPublicIPAddressConfiguration(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetPublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(deleteOption)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetPublicIPAddressConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs index 4c1e956ee3be..e944f43ed600 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. public partial class VirtualMachineScaleSetPublicIPAddressConfiguration { - /// Initializes a new instance of VirtualMachineScaleSetPublicIPAddressConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The publicIP address configuration name. /// is null. public VirtualMachineScaleSetPublicIPAddressConfiguration(string name) @@ -26,7 +29,7 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration(string name) IPTags = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetPublicIPAddressConfiguration. + /// Initializes a new instance of . /// The publicIP address configuration name. /// Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. /// The idle timeout of the public IP address. @@ -35,7 +38,8 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration(string name) /// The PublicIPPrefix from which to allocate publicIP addresses. /// Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. /// Specify what happens to the public IP when the VM is deleted. - internal VirtualMachineScaleSetPublicIPAddressConfiguration(string name, ComputePublicIPAddressSku sku, int? idleTimeoutInMinutes, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings, IList ipTags, WritableSubResource publicIPPrefix, IPVersion? publicIPAddressVersion, ComputeDeleteOption? deleteOption) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetPublicIPAddressConfiguration(string name, ComputePublicIPAddressSku sku, int? idleTimeoutInMinutes, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings, IList ipTags, WritableSubResource publicIPPrefix, IPVersion? publicIPAddressVersion, ComputeDeleteOption? deleteOption, Dictionary serializedAdditionalRawData) { Name = name; Sku = sku; @@ -45,6 +49,12 @@ internal VirtualMachineScaleSetPublicIPAddressConfiguration(string name, Compute PublicIPPrefix = publicIPPrefix; PublicIPAddressVersion = publicIPAddressVersion; DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetPublicIPAddressConfiguration() + { } /// The publicIP address configuration name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.Serialization.cs index 07f4454750f1..e709e823b2a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("domainNameLabel"u8); writer.WriteStringValue(DomainNameLabel); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("domainNameLabelScope"u8); writer.WriteStringValue(DomainNameLabelScope.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings DeserializeVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(JsonElement element) + internal static VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings DeserializeVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string domainNameLabel = default; Optional domainNameLabelScope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainNameLabel"u8)) @@ -49,8 +72,61 @@ internal static VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings De domainNameLabelScope = new DomainNameLabelScopeType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(domainNameLabel, Optional.ToNullable(domainNameLabelScope), serializedAdditionalRawData); + } + + VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(domainNameLabel, Optional.ToNullable(domainNameLabelScope)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs index 8737f7bf93bb..2e826a0ad9ef 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines scale sets network configuration's DNS settings. public partial class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings { - /// Initializes a new instance of VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created. /// is null. public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(string domainNameLabel) @@ -23,13 +27,20 @@ public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(string doma DomainNameLabel = domainNameLabel; } - /// Initializes a new instance of VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings. + /// Initializes a new instance of . /// The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created. /// The Domain name label scope.The concatenation of the hashed domain name label that generated according to the policy from domain name label scope and vm index will be the domain name labels of the PublicIPAddress resources that will be created. - internal VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(string domainNameLabel, DomainNameLabelScopeType? domainNameLabelScope) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(string domainNameLabel, DomainNameLabelScopeType? domainNameLabelScope, Dictionary serializedAdditionalRawData) { DomainNameLabel = domainNameLabel; DomainNameLabelScope = domainNameLabelScope; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings() + { } /// The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.Serialization.cs index 5261fdcae067..58fb75dcf340 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetReimageContent : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetReimageContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(InstanceIds)) { @@ -38,9 +46,137 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetReimageContent DeserializeVirtualMachineScaleSetReimageContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> instanceIds = default; + Optional tempDisk = default; + Optional exactVersion = default; + Optional osProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + instanceIds = array; + continue; + } + if (property.NameEquals("tempDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tempDisk = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("exactVersion"u8)) + { + exactVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("osProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osProfile = OSProfileProvisioningData.DeserializeOSProfileProvisioningData(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetReimageContent(Optional.ToNullable(tempDisk), exactVersion.Value, osProfile.Value, Optional.ToList(instanceIds), serializedAdditionalRawData); + } + + VirtualMachineScaleSetReimageContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetReimageContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetReimageContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetReimageContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetReimageContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetReimageContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetReimageContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.cs index 54b8ab1e7af1..fd9e087f25cf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetReimageContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,23 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a Virtual Machine Scale Set VM Reimage Parameters. public partial class VirtualMachineScaleSetReimageContent : VirtualMachineScaleSetVmReimageContent { - /// Initializes a new instance of VirtualMachineScaleSetReimageContent. + /// Initializes a new instance of . public VirtualMachineScaleSetReimageContent() { InstanceIds = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + /// Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk is reimaged to the existing version of OS Disk. + /// Specifies information required for reimaging the non-ephemeral OS disk. + /// The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetReimageContent(bool? tempDisk, string exactVersion, OSProfileProvisioningData osProfile, IList instanceIds, Dictionary serializedAdditionalRawData) : base(tempDisk, exactVersion, osProfile, serializedAdditionalRawData) + { + InstanceIds = instanceIds; + } + /// The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. public IList InstanceIds { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetRollingUpgradeData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetRollingUpgradeData.Serialization.cs index a8a3e299e755..4953585d4eea 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetRollingUpgradeData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetRollingUpgradeData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineScaleSetRollingUpgradeData : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetRollingUpgradeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,11 +41,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetRollingUpgradeData DeserializeVirtualMachineScaleSetRollingUpgradeData(JsonElement element) + internal static VirtualMachineScaleSetRollingUpgradeData DeserializeVirtualMachineScaleSetRollingUpgradeData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +74,7 @@ internal static VirtualMachineScaleSetRollingUpgradeData DeserializeVirtualMachi Optional runningStatus = default; Optional progress = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -146,8 +168,61 @@ internal static VirtualMachineScaleSetRollingUpgradeData DeserializeVirtualMachi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetRollingUpgradeData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, policy.Value, runningStatus.Value, progress.Value, error.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetRollingUpgradeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetRollingUpgradeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetRollingUpgradeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetRollingUpgradeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetRollingUpgradeData model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetRollingUpgradeData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, policy.Value, runningStatus.Value, progress.Value, error.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetRollingUpgradeData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetRollingUpgradeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.Serialization.cs index 670bedca8d63..73046003842f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetSku + public partial class VirtualMachineScaleSetSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetSku DeserializeVirtualMachineScaleSetSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetSku DeserializeVirtualMachineScaleSetSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static VirtualMachineScaleSetSku DeserializeVirtualMachineScaleSetSku(J Optional resourceType = default; Optional sku = default; Optional capacity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -50,8 +79,61 @@ internal static VirtualMachineScaleSetSku DeserializeVirtualMachineScaleSetSku(J capacity = VirtualMachineScaleSetSkuCapacity.DeserializeVirtualMachineScaleSetSkuCapacity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetSku(Optional.ToNullable(resourceType), sku.Value, capacity.Value); + return new VirtualMachineScaleSetSku(Optional.ToNullable(resourceType), sku.Value, capacity.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs index f7f9a1a5f8ab..1c2438bc76f6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSku.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Compute.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.Compute.Models /// Describes an available virtual machine scale set sku. public partial class VirtualMachineScaleSetSku { - /// Initializes a new instance of VirtualMachineScaleSetSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetSku() { } - /// Initializes a new instance of VirtualMachineScaleSetSku. + /// Initializes a new instance of . /// The type of resource the sku applies to. /// The Sku. /// Specifies the number of virtual machines in the scale set. - internal VirtualMachineScaleSetSku(ResourceType? resourceType, ComputeSku sku, VirtualMachineScaleSetSkuCapacity capacity) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetSku(ResourceType? resourceType, ComputeSku sku, VirtualMachineScaleSetSkuCapacity capacity, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Sku = sku; Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of resource the sku applies to. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.Serialization.cs index 241da389e76d..9ce8342a76aa 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetSkuCapacity + public partial class VirtualMachineScaleSetSkuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetSkuCapacity DeserializeVirtualMachineScaleSetSkuCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetSkuCapacity DeserializeVirtualMachineScaleSetSkuCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static VirtualMachineScaleSetSkuCapacity DeserializeVirtualMachineScale Optional maximum = default; Optional defaultCapacity = default; Optional scaleType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -60,8 +89,61 @@ internal static VirtualMachineScaleSetSkuCapacity DeserializeVirtualMachineScale scaleType = property.Value.GetString().ToVirtualMachineScaleSetSkuScaleType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(defaultCapacity), Optional.ToNullable(scaleType)); + return new VirtualMachineScaleSetSkuCapacity(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(defaultCapacity), Optional.ToNullable(scaleType), serializedAdditionalRawData); + } + + VirtualMachineScaleSetSkuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetSkuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetSkuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetSkuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetSkuCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetSkuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetSkuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs index 6f93c829019f..e2603947e2c9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetSkuCapacity.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes scaling information of a sku. public partial class VirtualMachineScaleSetSkuCapacity { - /// Initializes a new instance of VirtualMachineScaleSetSkuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetSkuCapacity() { } - /// Initializes a new instance of VirtualMachineScaleSetSkuCapacity. + /// Initializes a new instance of . /// The minimum capacity. /// The maximum capacity that can be set. /// The default capacity. /// The scale type applicable to the sku. - internal VirtualMachineScaleSetSkuCapacity(long? minimum, long? maximum, long? defaultCapacity, VirtualMachineScaleSetSkuScaleType? scaleType) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetSkuCapacity(long? minimum, long? maximum, long? defaultCapacity, VirtualMachineScaleSetSkuScaleType? scaleType, Dictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; DefaultCapacity = defaultCapacity; ScaleType = scaleType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum capacity. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.Serialization.cs index 70bb0a100a8c..5d46650e67c0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetStorageProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ImageReference)) { writer.WritePropertyName("imageReference"u8); - writer.WriteObjectValue(ImageReference); + if (ImageReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageReference).Serialize(writer, options); + } } if (Optional.IsDefined(OSDisk)) { writer.WritePropertyName("osDisk"u8); - writer.WriteObjectValue(OSDisk); + if (OSDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDisk).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDisks)) { @@ -32,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDisks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,11 +69,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskControllerType"u8); writer.WriteStringValue(DiskControllerType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetStorageProfile DeserializeVirtualMachineScaleSetStorageProfile(JsonElement element) + internal static VirtualMachineScaleSetStorageProfile DeserializeVirtualMachineScaleSetStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +96,7 @@ internal static VirtualMachineScaleSetStorageProfile DeserializeVirtualMachineSc Optional osDisk = default; Optional> dataDisks = default; Optional diskControllerType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageReference"u8)) @@ -93,8 +136,61 @@ internal static VirtualMachineScaleSetStorageProfile DeserializeVirtualMachineSc diskControllerType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetStorageProfile(imageReference.Value, osDisk.Value, Optional.ToList(dataDisks), diskControllerType.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetStorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetStorageProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetStorageProfile(imageReference.Value, osDisk.Value, Optional.ToList(dataDisks), diskControllerType.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs index afd3bcb31389..f88cf299a7a4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set storage profile. public partial class VirtualMachineScaleSetStorageProfile { - /// Initializes a new instance of VirtualMachineScaleSetStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetStorageProfile() { DataDisks = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetStorageProfile. + /// Initializes a new instance of . /// Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. /// Specifies information about the operating system disk used by the virtual machines in the scale set. For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). /// Specifies the parameters that are used to add data disks to the virtual machines in the scale set. For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). /// - internal VirtualMachineScaleSetStorageProfile(ImageReference imageReference, VirtualMachineScaleSetOSDisk osDisk, IList dataDisks, string diskControllerType) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetStorageProfile(ImageReference imageReference, VirtualMachineScaleSetOSDisk osDisk, IList dataDisks, string diskControllerType, Dictionary serializedAdditionalRawData) { ImageReference = imageReference; OSDisk = osDisk; DataDisks = dataDisks; DiskControllerType = diskControllerType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs index 33412281a3ad..7474d6554be4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateIPConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateIPConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -40,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPAddressConfiguration)) { writer.WritePropertyName("publicIPAddressConfiguration"u8); - writer.WriteObjectValue(PublicIPAddressConfiguration); + if (PublicIPAddressConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PublicIPAddressConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(PrivateIPAddressVersion)) { @@ -88,7 +104,215 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMachineScaleSetUpdateIPConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional id = default; + Optional subnet = default; + Optional primary = default; + Optional publicIPAddressConfiguration = default; + Optional privateIPAddressVersion = default; + Optional> applicationGatewayBackendAddressPools = default; + Optional> applicationSecurityGroups = default; + Optional> loadBalancerBackendAddressPools = default; + Optional> loadBalancerInboundNatPools = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("subnet"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subnet = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("primary"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primary = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publicIPAddressConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicIPAddressConfiguration = VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.DeserializeVirtualMachineScaleSetUpdatePublicIPAddressConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("privateIPAddressVersion"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateIPAddressVersion = new IPVersion(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("applicationGatewayBackendAddressPools"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + applicationGatewayBackendAddressPools = array; + continue; + } + if (property0.NameEquals("applicationSecurityGroups"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + applicationSecurityGroups = array; + continue; + } + if (property0.NameEquals("loadBalancerBackendAddressPools"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + loadBalancerBackendAddressPools = array; + continue; + } + if (property0.NameEquals("loadBalancerInboundNatPools"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + loadBalancerInboundNatPools = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateIPConfiguration(id.Value, name.Value, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools), serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateIPConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateIPConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateIPConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateIPConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateIPConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateIPConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateIPConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs index 9f6ee3740636..3a85fc84eb83 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual network. public partial class VirtualMachineScaleSetUpdateIPConfiguration : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineScaleSetUpdateIPConfiguration. + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateIPConfiguration() { ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); @@ -23,6 +24,31 @@ public VirtualMachineScaleSetUpdateIPConfiguration() LoadBalancerInboundNatPools = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource Id. + /// The IP configuration name. + /// The subnet. + /// Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. + /// The publicIPAddressConfiguration. + /// Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// The application gateway backend address pools. + /// Specifies an array of references to application security group. + /// The load balancer backend address pools. + /// The load balancer inbound nat pools. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateIPConfiguration(ResourceIdentifier id, string name, WritableSubResource subnet, bool? primary, VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) + { + Name = name; + Subnet = subnet; + Primary = primary; + PublicIPAddressConfiguration = publicIPAddressConfiguration; + PrivateIPAddressVersion = privateIPAddressVersion; + ApplicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + ApplicationSecurityGroups = applicationSecurityGroups; + LoadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + LoadBalancerInboundNatPools = loadBalancerInboundNatPools; + } + /// The IP configuration name. public string Name { get; set; } /// The subnet. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs index bbfb4c581e2f..cef06eafe055 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -55,7 +64,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DnsSettings)) { writer.WritePropertyName("dnsSettings"u8); - writer.WriteObjectValue(DnsSettings); + if (DnsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(IPConfigurations)) { @@ -63,7 +79,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -88,7 +111,230 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AuxiliarySku.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateNetworkConfiguration DeserializeVirtualMachineScaleSetUpdateNetworkConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional id = default; + Optional primary = default; + Optional enableAcceleratedNetworking = default; + Optional disableTcpStateTracking = default; + Optional enableFpga = default; + Optional networkSecurityGroup = default; + Optional dnsSettings = default; + Optional> ipConfigurations = default; + Optional enableIPForwarding = default; + Optional deleteOption = default; + Optional auxiliaryMode = default; + Optional auxiliarySku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("primary"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + primary = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableAcceleratedNetworking"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableAcceleratedNetworking = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("disableTcpStateTracking"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableTcpStateTracking = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableFpga"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableFpga = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("networkSecurityGroup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkSecurityGroup = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("dnsSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsSettings = VirtualMachineScaleSetNetworkConfigurationDnsSettings.DeserializeVirtualMachineScaleSetNetworkConfigurationDnsSettings(property0.Value); + continue; + } + if (property0.NameEquals("ipConfigurations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(VirtualMachineScaleSetUpdateIPConfiguration.DeserializeVirtualMachineScaleSetUpdateIPConfiguration(item)); + } + ipConfigurations = array; + continue; + } + if (property0.NameEquals("enableIPForwarding"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableIPForwarding = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("deleteOption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOption = new ComputeDeleteOption(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("auxiliaryMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + auxiliaryMode = new ComputeNetworkInterfaceAuxiliaryMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("auxiliarySku"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + auxiliarySku = new ComputeNetworkInterfaceAuxiliarySku(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateNetworkConfiguration(id.Value, name.Value, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(disableTcpStateTracking), Optional.ToNullable(enableFpga), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption), Optional.ToNullable(auxiliaryMode), Optional.ToNullable(auxiliarySku), serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateNetworkConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateNetworkConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateNetworkConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateNetworkConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateNetworkConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateNetworkConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateNetworkConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs index 2218c90d437b..57e90beaf9e9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,12 +15,43 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set network profile's network configurations. public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : ComputeWriteableSubResourceData { - /// Initializes a new instance of VirtualMachineScaleSetUpdateNetworkConfiguration. + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateNetworkConfiguration() { IPConfigurations = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource Id. + /// The network configuration name. + /// Whether this is a primary NIC on a virtual machine. + /// Specifies whether the network interface is accelerated networking-enabled. + /// Specifies whether the network interface is disabled for tcp state tracking. + /// Specifies whether the network interface is FPGA networking-enabled. + /// The network security group. + /// The dns settings to be applied on the network interfaces. + /// The virtual machine scale set IP Configuration. + /// Whether IP forwarding enabled on this NIC. + /// Specify what happens to the network interface when the VM is deleted. + /// Specifies whether the Auxiliary mode is enabled for the Network Interface resource. + /// Specifies whether the Auxiliary sku is enabled for the Network Interface resource. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateNetworkConfiguration(ResourceIdentifier id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? isTcpStateTrackingDisabled, bool? enableFpga, WritableSubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, ComputeDeleteOption? deleteOption, ComputeNetworkInterfaceAuxiliaryMode? auxiliaryMode, ComputeNetworkInterfaceAuxiliarySku? auxiliarySku, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) + { + Name = name; + Primary = primary; + EnableAcceleratedNetworking = enableAcceleratedNetworking; + IsTcpStateTrackingDisabled = isTcpStateTrackingDisabled; + EnableFpga = enableFpga; + NetworkSecurityGroup = networkSecurityGroup; + DnsSettings = dnsSettings; + IPConfigurations = ipConfigurations; + EnableIPForwarding = enableIPForwarding; + DeleteOption = deleteOption; + AuxiliaryMode = auxiliaryMode; + AuxiliarySku = auxiliarySku; + } + /// The network configuration name. public string Name { get; set; } /// Whether this is a primary NIC on a virtual machine. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs index eec595e16224..0cca447e171e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateNetworkProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HealthProbe)) { @@ -26,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaceConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -35,7 +51,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("networkApiVersion"u8); writer.WriteStringValue(NetworkApiVersion.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateNetworkProfile DeserializeVirtualMachineScaleSetUpdateNetworkProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional healthProbe = default; + Optional> networkInterfaceConfigurations = default; + Optional networkApiVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("healthProbe"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + healthProbe = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("networkInterfaceConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualMachineScaleSetUpdateNetworkConfiguration.DeserializeVirtualMachineScaleSetUpdateNetworkConfiguration(item)); + } + networkInterfaceConfigurations = array; + continue; + } + if (property.NameEquals("networkApiVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkApiVersion = new NetworkApiVersion(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateNetworkProfile(healthProbe, Optional.ToList(networkInterfaceConfigurations), Optional.ToNullable(networkApiVersion), serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateNetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateNetworkProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs index e3333240d9f1..497642db1a5b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,12 +15,28 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set network profile. public partial class VirtualMachineScaleSetUpdateNetworkProfile { - /// Initializes a new instance of VirtualMachineScaleSetUpdateNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateNetworkProfile() { NetworkInterfaceConfigurations = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// The list of network configurations. + /// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateNetworkProfile(WritableSubResource healthProbe, IList networkInterfaceConfigurations, NetworkApiVersion? networkApiVersion, Dictionary serializedAdditionalRawData) + { + HealthProbe = healthProbe; + NetworkInterfaceConfigurations = networkInterfaceConfigurations; + NetworkApiVersion = networkApiVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. internal WritableSubResource HealthProbe { get; set; } /// Gets or sets Id. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.Serialization.cs index fba807e2ce56..738e1b0fafa0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateOSDisk : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateOSDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Caching)) { @@ -33,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Image)) { writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image); + if (Image is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Image).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(VhdContainers)) { @@ -48,14 +63,176 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"u8); - writer.WriteObjectValue(ManagedDisk); + if (ManagedDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedDisk).Serialize(writer, options); + } } if (Optional.IsDefined(DeleteOption)) { writer.WritePropertyName("deleteOption"u8); writer.WriteStringValue(DeleteOption.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateOSDisk DeserializeVirtualMachineScaleSetUpdateOSDisk(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional caching = default; + Optional writeAcceleratorEnabled = default; + Optional diskSizeGB = default; + Optional image = default; + Optional> vhdContainers = default; + Optional managedDisk = default; + Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("caching"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + caching = property.Value.GetString().ToCachingType(); + continue; + } + if (property.NameEquals("writeAcceleratorEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeAcceleratorEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("diskSizeGB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("image"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value); + continue; + } + if (property.NameEquals("vhdContainers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + vhdContainers = array; + continue; + } + if (property.NameEquals("managedDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedDisk = VirtualMachineScaleSetManagedDisk.DeserializeVirtualMachineScaleSetManagedDisk(property.Value); + continue; + } + if (property.NameEquals("deleteOption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOption = new DiskDeleteOptionType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateOSDisk(Optional.ToNullable(caching), Optional.ToNullable(writeAcceleratorEnabled), Optional.ToNullable(diskSizeGB), image.Value, Optional.ToList(vhdContainers), managedDisk.Value, Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateOSDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateOSDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateOSDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateOSDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateOSDisk model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateOSDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateOSDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs index 66cb8a7adbd1..25ac9449d5d7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSDisk.cs @@ -14,12 +14,36 @@ namespace Azure.ResourceManager.Compute.Models /// Describes virtual machine scale set operating system disk Update Object. This should be used for Updating VMSS OS Disk. public partial class VirtualMachineScaleSetUpdateOSDisk { - /// Initializes a new instance of VirtualMachineScaleSetUpdateOSDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateOSDisk() { VhdContainers = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The caching type. + /// Specifies whether writeAccelerator should be enabled or disabled on the disk. + /// Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be larger than 1023. + /// The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not exist. + /// The list of virtual hard disk container uris. + /// The managed disk parameters. + /// Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with Flexible OrchestrationMode only). <br><br> Possible values: <br><br> **Delete** If this value is used, the OS disk is deleted when VMSS Flex VM is deleted.<br><br> **Detach** If this value is used, the OS disk is retained after VMSS Flex VM is deleted. <br><br> The default value is set to **Delete**. For an Ephemeral OS Disk, the default value is set to **Delete**. User cannot change the delete option for Ephemeral OS Disk. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateOSDisk(CachingType? caching, bool? writeAcceleratorEnabled, int? diskSizeGB, VirtualHardDisk image, IList vhdContainers, VirtualMachineScaleSetManagedDisk managedDisk, DiskDeleteOptionType? deleteOption, Dictionary serializedAdditionalRawData) + { + Caching = caching; + WriteAcceleratorEnabled = writeAcceleratorEnabled; + DiskSizeGB = diskSizeGB; + Image = image; + VhdContainers = vhdContainers; + ManagedDisk = managedDisk; + DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The caching type. public CachingType? Caching { get; set; } /// Specifies whether writeAccelerator should be enabled or disabled on the disk. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.Serialization.cs index acd2e0bbc2ea..b4ac16edaacf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateOSProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateOSProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CustomData)) { @@ -23,12 +31,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsConfiguration)) { writer.WritePropertyName("windowsConfiguration"u8); - writer.WriteObjectValue(WindowsConfiguration); + if (WindowsConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxConfiguration)) { writer.WritePropertyName("linuxConfiguration"u8); - writer.WriteObjectValue(LinuxConfiguration); + if (LinuxConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Secrets)) { @@ -36,11 +58,139 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateOSProfile DeserializeVirtualMachineScaleSetUpdateOSProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional customData = default; + Optional windowsConfiguration = default; + Optional linuxConfiguration = default; + Optional> secrets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customData"u8)) + { + customData = property.Value.GetString(); + continue; + } + if (property.NameEquals("windowsConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsConfiguration = WindowsConfiguration.DeserializeWindowsConfiguration(property.Value); + continue; + } + if (property.NameEquals("linuxConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + linuxConfiguration = LinuxConfiguration.DeserializeLinuxConfiguration(property.Value); + continue; + } + if (property.NameEquals("secrets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VaultSecretGroup.DeserializeVaultSecretGroup(item)); + } + secrets = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateOSProfile(customData.Value, windowsConfiguration.Value, linuxConfiguration.Value, Optional.ToList(secrets), serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateOSProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateOSProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateOSProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateOSProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateOSProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateOSProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateOSProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs index 79e24afd6ae0..73907afedd67 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateOSProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set OS profile. public partial class VirtualMachineScaleSetUpdateOSProfile { - /// Initializes a new instance of VirtualMachineScaleSetUpdateOSProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateOSProfile() { Secrets = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// A base-64 encoded string of custom data. + /// The Windows Configuration of the OS profile. + /// The Linux Configuration of the OS profile. + /// The List of certificates for addition to the VM. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateOSProfile(string customData, WindowsConfiguration windowsConfiguration, LinuxConfiguration linuxConfiguration, IList secrets, Dictionary serializedAdditionalRawData) + { + CustomData = customData; + WindowsConfiguration = windowsConfiguration; + LinuxConfiguration = linuxConfiguration; + Secrets = secrets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// A base-64 encoded string of custom data. public string CustomData { get; set; } /// The Windows Configuration of the OS profile. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.Serialization.cs index bbe4ec8e1820..bb202e7d2c65 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DnsSettings)) { writer.WritePropertyName("dnsSettings"u8); - writer.WriteObjectValue(DnsSettings); + if (DnsSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsSettings).Serialize(writer, options); + } } if (Optional.IsDefined(PublicIPPrefix)) { @@ -43,7 +59,145 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DeleteOption.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdatePublicIPAddressConfiguration DeserializeVirtualMachineScaleSetUpdatePublicIPAddressConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional idleTimeoutInMinutes = default; + Optional dnsSettings = default; + Optional publicIPPrefix = default; + Optional deleteOption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("idleTimeoutInMinutes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + idleTimeoutInMinutes = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("dnsSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsSettings = VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.DeserializeVirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(property0.Value); + continue; + } + if (property0.NameEquals("publicIPPrefix"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicIPPrefix = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("deleteOption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOption = new ComputeDeleteOption(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(name.Value, Optional.ToNullable(idleTimeoutInMinutes), dnsSettings.Value, publicIPPrefix, Optional.ToNullable(deleteOption), serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdatePublicIPAddressConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdatePublicIPAddressConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdatePublicIPAddressConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdatePublicIPAddressConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdatePublicIPAddressConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs index c4bcb6ce6561..5b55d4fbec9a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,11 +15,31 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. public partial class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration { - /// Initializes a new instance of VirtualMachineScaleSetUpdatePublicIPAddressConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration() { } + /// Initializes a new instance of . + /// The publicIP address configuration name. + /// The idle timeout of the public IP address. + /// The dns settings to be applied on the publicIP addresses . + /// The PublicIPPrefix from which to allocate publicIP addresses. + /// Specify what happens to the public IP when the VM is deleted. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings, WritableSubResource publicIPPrefix, ComputeDeleteOption? deleteOption, Dictionary serializedAdditionalRawData) + { + Name = name; + IdleTimeoutInMinutes = idleTimeoutInMinutes; + DnsSettings = dnsSettings; + PublicIPPrefix = publicIPPrefix; + DeleteOption = deleteOption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The publicIP address configuration name. public string Name { get; set; } /// The idle timeout of the public IP address. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.Serialization.cs index 5aa18105d092..c9337897e9d0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateStorageProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ImageReference)) { writer.WritePropertyName("imageReference"u8); - writer.WriteObjectValue(ImageReference); + if (ImageReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageReference).Serialize(writer, options); + } } if (Optional.IsDefined(OSDisk)) { writer.WritePropertyName("osDisk"u8); - writer.WriteObjectValue(OSDisk); + if (OSDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDisk).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDisks)) { @@ -31,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDisks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -40,7 +69,128 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskControllerType"u8); writer.WriteStringValue(DiskControllerType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateStorageProfile DeserializeVirtualMachineScaleSetUpdateStorageProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageReference = default; + Optional osDisk = default; + Optional> dataDisks = default; + Optional diskControllerType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageReference = ImageReference.DeserializeImageReference(property.Value); + continue; + } + if (property.NameEquals("osDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osDisk = VirtualMachineScaleSetUpdateOSDisk.DeserializeVirtualMachineScaleSetUpdateOSDisk(property.Value); + continue; + } + if (property.NameEquals("dataDisks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualMachineScaleSetDataDisk.DeserializeVirtualMachineScaleSetDataDisk(item)); + } + dataDisks = array; + continue; + } + if (property.NameEquals("diskControllerType"u8)) + { + diskControllerType = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateStorageProfile(imageReference.Value, osDisk.Value, Optional.ToList(dataDisks), diskControllerType.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateStorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateStorageProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs index 156afe528051..e488441e63f5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set storage profile. public partial class VirtualMachineScaleSetUpdateStorageProfile { - /// Initializes a new instance of VirtualMachineScaleSetUpdateStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateStorageProfile() { DataDisks = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The image reference. + /// The OS disk. + /// The data disks. + /// + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateStorageProfile(ImageReference imageReference, VirtualMachineScaleSetUpdateOSDisk osDisk, IList dataDisks, string diskControllerType, Dictionary serializedAdditionalRawData) + { + ImageReference = imageReference; + OSDisk = osDisk; + DataDisks = dataDisks; + DiskControllerType = diskControllerType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The image reference. public ImageReference ImageReference { get; set; } /// The OS disk. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs index 0ec183ad2c20..24896662df4f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs @@ -5,45 +5,95 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpdateVmProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpdateVmProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(DiagnosticsProfile)) { writer.WritePropertyName("diagnosticsProfile"u8); - writer.WriteObjectValue(DiagnosticsProfile); + if (DiagnosticsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ExtensionProfile)) { writer.WritePropertyName("extensionProfile"u8); - writer.WriteObjectValue(ExtensionProfile); + if (ExtensionProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExtensionProfile).Serialize(writer, options); + } } if (Optional.IsDefined(LicenseType)) { @@ -53,12 +103,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BillingProfile)) { writer.WritePropertyName("billingProfile"u8); - writer.WriteObjectValue(BillingProfile); + if (BillingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BillingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ScheduledEventsProfile)) { writer.WritePropertyName("scheduledEventsProfile"u8); - writer.WriteObjectValue(ScheduledEventsProfile); + if (ScheduledEventsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduledEventsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(UserData)) { @@ -68,9 +132,198 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetUpdateVmProfile DeserializeVirtualMachineScaleSetUpdateVmProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional osProfile = default; + Optional storageProfile = default; + Optional networkProfile = default; + Optional securityProfile = default; + Optional diagnosticsProfile = default; + Optional extensionProfile = default; + Optional licenseType = default; + Optional billingProfile = default; + Optional scheduledEventsProfile = default; + Optional userData = default; + Optional hardwareProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("osProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osProfile = VirtualMachineScaleSetUpdateOSProfile.DeserializeVirtualMachineScaleSetUpdateOSProfile(property.Value); + continue; + } + if (property.NameEquals("storageProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = VirtualMachineScaleSetUpdateStorageProfile.DeserializeVirtualMachineScaleSetUpdateStorageProfile(property.Value); + continue; + } + if (property.NameEquals("networkProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = VirtualMachineScaleSetUpdateNetworkProfile.DeserializeVirtualMachineScaleSetUpdateNetworkProfile(property.Value); + continue; + } + if (property.NameEquals("securityProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = SecurityProfile.DeserializeSecurityProfile(property.Value); + continue; + } + if (property.NameEquals("diagnosticsProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property.Value); + continue; + } + if (property.NameEquals("extensionProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extensionProfile = VirtualMachineScaleSetExtensionProfile.DeserializeVirtualMachineScaleSetExtensionProfile(property.Value); + continue; + } + if (property.NameEquals("licenseType"u8)) + { + licenseType = property.Value.GetString(); + continue; + } + if (property.NameEquals("billingProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + billingProfile = BillingProfile.DeserializeBillingProfile(property.Value); + continue; + } + if (property.NameEquals("scheduledEventsProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduledEventsProfile = ComputeScheduledEventsProfile.DeserializeComputeScheduledEventsProfile(property.Value); + continue; + } + if (property.NameEquals("userData"u8)) + { + userData = property.Value.GetString(); + continue; + } + if (property.NameEquals("hardwareProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hardwareProfile = VirtualMachineScaleSetHardwareProfile.DeserializeVirtualMachineScaleSetHardwareProfile(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpdateVmProfile(osProfile.Value, storageProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, extensionProfile.Value, licenseType.Value, billingProfile.Value, scheduledEventsProfile.Value, userData.Value, hardwareProfile.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpdateVmProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpdateVmProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpdateVmProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpdateVmProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpdateVmProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpdateVmProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpdateVmProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs index 65949bbe8247..af117c15262e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs @@ -5,16 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set virtual machine profile. public partial class VirtualMachineScaleSetUpdateVmProfile { - /// Initializes a new instance of VirtualMachineScaleSetUpdateVmProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpdateVmProfile() { } + /// Initializes a new instance of . + /// The virtual machine scale set OS profile. + /// The virtual machine scale set storage profile. + /// The virtual machine scale set network profile. + /// The virtual machine scale set Security profile. + /// The virtual machine scale set diagnostics profile. + /// The virtual machine scale set extension profile. + /// The license type, which is for bring your own license scenario. + /// Specifies the billing related details of a Azure Spot VMSS. Minimum api-version: 2019-03-01. + /// Specifies Scheduled Event related configurations. + /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. + /// Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpdateVmProfile(VirtualMachineScaleSetUpdateOSProfile osProfile, VirtualMachineScaleSetUpdateStorageProfile storageProfile, VirtualMachineScaleSetUpdateNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, VirtualMachineScaleSetExtensionProfile extensionProfile, string licenseType, BillingProfile billingProfile, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, VirtualMachineScaleSetHardwareProfile hardwareProfile, Dictionary serializedAdditionalRawData) + { + OSProfile = osProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + SecurityProfile = securityProfile; + DiagnosticsProfile = diagnosticsProfile; + ExtensionProfile = extensionProfile; + LicenseType = licenseType; + BillingProfile = billingProfile; + ScheduledEventsProfile = scheduledEventsProfile; + UserData = userData; + HardwareProfile = hardwareProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The virtual machine scale set OS profile. public VirtualMachineScaleSetUpdateOSProfile OSProfile { get; set; } /// The virtual machine scale set storage profile. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.Serialization.cs index 8f58d632373f..c77df767f2d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetUpgradePolicy : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetUpgradePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Mode)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RollingUpgradePolicy)) { writer.WritePropertyName("rollingUpgradePolicy"u8); - writer.WriteObjectValue(RollingUpgradePolicy); + if (RollingUpgradePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RollingUpgradePolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AutomaticOSUpgradePolicy)) { writer.WritePropertyName("automaticOSUpgradePolicy"u8); - writer.WriteObjectValue(AutomaticOSUpgradePolicy); + if (AutomaticOSUpgradePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutomaticOSUpgradePolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetUpgradePolicy DeserializeVirtualMachineScaleSetUpgradePolicy(JsonElement element) + internal static VirtualMachineScaleSetUpgradePolicy DeserializeVirtualMachineScaleSetUpgradePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static VirtualMachineScaleSetUpgradePolicy DeserializeVirtualMachineSca Optional mode = default; Optional rollingUpgradePolicy = default; Optional automaticOSUpgradePolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mode"u8)) @@ -71,8 +108,61 @@ internal static VirtualMachineScaleSetUpgradePolicy DeserializeVirtualMachineSca automaticOSUpgradePolicy = AutomaticOSUpgradePolicy.DeserializeAutomaticOSUpgradePolicy(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetUpgradePolicy(Optional.ToNullable(mode), rollingUpgradePolicy.Value, automaticOSUpgradePolicy.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetUpgradePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetUpgradePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetUpgradePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetUpgradePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetUpgradePolicy model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetUpgradePolicy(Optional.ToNullable(mode), rollingUpgradePolicy.Value, automaticOSUpgradePolicy.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetUpgradePolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetUpgradePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.cs index 74c4b9a75921..56e6f76cd2be 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpgradePolicy.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes an upgrade policy - automatic, manual, or rolling. public partial class VirtualMachineScaleSetUpgradePolicy { - /// Initializes a new instance of VirtualMachineScaleSetUpgradePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetUpgradePolicy() { } - /// Initializes a new instance of VirtualMachineScaleSetUpgradePolicy. + /// Initializes a new instance of . /// Specifies the mode of an upgrade to virtual machines in the scale set.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - All virtual machines in the scale set are automatically updated at the same time. /// The configuration parameters used while performing a rolling upgrade. /// Configuration parameters used for performing automatic OS Upgrade. - internal VirtualMachineScaleSetUpgradePolicy(VirtualMachineScaleSetUpgradeMode? mode, RollingUpgradePolicy rollingUpgradePolicy, AutomaticOSUpgradePolicy automaticOSUpgradePolicy) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetUpgradePolicy(VirtualMachineScaleSetUpgradeMode? mode, RollingUpgradePolicy rollingUpgradePolicy, AutomaticOSUpgradePolicy automaticOSUpgradePolicy, Dictionary serializedAdditionalRawData) { Mode = mode; RollingUpgradePolicy = rollingUpgradePolicy; AutomaticOSUpgradePolicy = automaticOSUpgradePolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the mode of an upgrade to virtual machines in the scale set.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - All virtual machines in the scale set are automatically updated at the same time. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmData.Serialization.cs index b5a158b95864..58ac0e8bd3ea 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmData.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineScaleSetVmData : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); - writer.WriteObjectValue(Plan); + if (Plan is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Plan).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -48,42 +61,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalCapabilities)) { writer.WritePropertyName("additionalCapabilities"u8); - writer.WriteObjectValue(AdditionalCapabilities); + if (AdditionalCapabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AdditionalCapabilities).Serialize(writer, options); + } } if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfileConfiguration)) { writer.WritePropertyName("networkProfileConfiguration"u8); - writer.WriteObjectValue(NetworkProfileConfiguration); + if (NetworkProfileConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfileConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(DiagnosticsProfile)) { writer.WritePropertyName("diagnosticsProfile"u8); - writer.WriteObjectValue(DiagnosticsProfile); + if (DiagnosticsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AvailabilitySet)) { @@ -98,7 +167,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProtectionPolicy)) { writer.WritePropertyName("protectionPolicy"u8); - writer.WriteObjectValue(ProtectionPolicy); + if (ProtectionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProtectionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(UserData)) { @@ -106,11 +182,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(UserData); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetVmData DeserializeVirtualMachineScaleSetVmData(JsonElement element) + internal static VirtualMachineScaleSetVmData DeserializeVirtualMachineScaleSetVmData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -145,6 +235,7 @@ internal static VirtualMachineScaleSetVmData DeserializeVirtualMachineScaleSetVm Optional protectionPolicy = default; Optional userData = default; Optional timeCreated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("instanceId"u8)) @@ -404,8 +495,61 @@ internal static VirtualMachineScaleSetVmData DeserializeVirtualMachineScaleSetVm } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, instanceId.Value, sku.Value, plan.Value, Optional.ToList(resources), Optional.ToList(zones), identity, Optional.ToNullable(latestModelApplied), vmId.Value, instanceView.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, securityProfile.Value, networkProfile.Value, networkProfileConfiguration.Value, diagnosticsProfile.Value, availabilitySet, provisioningState.Value, licenseType.Value, modelDefinitionApplied.Value, protectionPolicy.Value, userData.Value, Optional.ToNullable(timeCreated), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmData model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetVmData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, instanceId.Value, sku.Value, plan.Value, Optional.ToList(resources), Optional.ToList(zones), identity, Optional.ToNullable(latestModelApplied), vmId.Value, instanceView.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, securityProfile.Value, networkProfile.Value, networkProfileConfiguration.Value, diagnosticsProfile.Value, availabilitySet, provisioningState.Value, licenseType.Value, modelDefinitionApplied.Value, protectionPolicy.Value, userData.Value, Optional.ToNullable(timeCreated)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionData.Serialization.cs index a8b11b849053..b6eda4de427e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute { - public partial class VirtualMachineScaleSetVmExtensionData : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -77,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(InstanceView)) { writer.WritePropertyName("instanceView"u8); - writer.WriteObjectValue(InstanceView); + if (InstanceView is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InstanceView).Serialize(writer, options); + } } if (Optional.IsDefined(SuppressFailures)) { @@ -87,7 +100,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProtectedSettings)) { writer.WritePropertyName("protectedSettingsFromKeyVault"u8); - writer.WriteObjectValue(KeyVaultProtectedSettings); + if (KeyVaultProtectedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProtectedSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(ProvisionAfterExtensions)) { @@ -100,11 +120,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetVmExtensionData DeserializeVirtualMachineScaleSetVmExtensionData(JsonElement element) + internal static VirtualMachineScaleSetVmExtensionData DeserializeVirtualMachineScaleSetVmExtensionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,6 +161,7 @@ internal static VirtualMachineScaleSetVmExtensionData DeserializeVirtualMachineS Optional suppressFailures = default; Optional protectedSettingsFromKeyVault = default; Optional> provisionAfterExtensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -276,8 +311,61 @@ internal static VirtualMachineScaleSetVmExtensionData DeserializeVirtualMachineS } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetVmExtensionData(id, name, type, systemData.Value, Optional.ToNullable(location), forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, Optional.ToList(provisionAfterExtensions)); + return new VirtualMachineScaleSetVmExtensionData(id, name, type, systemData.Value, Optional.ToNullable(location), forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, Optional.ToList(provisionAfterExtensions), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmExtensionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.Serialization.cs index 5771edb0b84a..17ec1b18bc37 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmExtensionPatch : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmExtensionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -75,14 +82,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProtectedSettings)) { writer.WritePropertyName("protectedSettingsFromKeyVault"u8); - writer.WriteObjectValue(KeyVaultProtectedSettings); + if (KeyVaultProtectedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProtectedSettings).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetVmExtensionPatch DeserializeVirtualMachineScaleSetVmExtensionPatch(JsonElement element) + internal static VirtualMachineScaleSetVmExtensionPatch DeserializeVirtualMachineScaleSetVmExtensionPatch(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,6 +129,7 @@ internal static VirtualMachineScaleSetVmExtensionPatch DeserializeVirtualMachine Optional protectedSettings = default; Optional suppressFailures = default; Optional protectedSettingsFromKeyVault = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -213,8 +242,61 @@ internal static VirtualMachineScaleSetVmExtensionPatch DeserializeVirtualMachine } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetVmExtensionPatch(id, name, type, systemData.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value); + return new VirtualMachineScaleSetVmExtensionPatch(id, name, type, systemData.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, Optional.ToNullable(suppressFailures), protectedSettingsFromKeyVault.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmExtensionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmExtensionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmExtensionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmExtensionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmExtensionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmExtensionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmExtensionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.cs index d2543c5b90c3..88cf89c9542c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionPatch.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a VMSS VM Extension. public partial class VirtualMachineScaleSetVmExtensionPatch : ResourceData { - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetVmExtensionPatch() { } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +38,8 @@ public VirtualMachineScaleSetVmExtensionPatch() /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. /// The extensions protected settings that are passed by reference, and consumed from key vault. - internal VirtualMachineScaleSetVmExtensionPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmExtensionPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ForceUpdateTag = forceUpdateTag; Publisher = publisher; @@ -46,6 +51,7 @@ internal VirtualMachineScaleSetVmExtensionPatch(ResourceIdentifier id, string na ProtectedSettings = protectedSettings; SuppressFailures = suppressFailures; KeyVaultProtectedSettings = keyVaultProtectedSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// How the extension handler should be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.Serialization.cs index 83d7537cf89e..160d1038ab29 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetVmExtensionsListResult + internal partial class VirtualMachineScaleSetVmExtensionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetVmExtensionsListResult DeserializeVirtualMachineScaleSetVmExtensionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetVmExtensionsListResult DeserializeVirtualMachineScaleSetVmExtensionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static VirtualMachineScaleSetVmExtensionsListResult DeserializeVirtualM value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetVmExtensionsListResult(Optional.ToList(value)); + return new VirtualMachineScaleSetVmExtensionsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmExtensionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmExtensionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmExtensionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmExtensionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmExtensionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmExtensionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmExtensionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.cs index 8552cb0712f4..bbd90179574f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.Compute.Models /// The List VMSS VM Extension operation response. internal partial class VirtualMachineScaleSetVmExtensionsListResult { - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetVmExtensionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionsListResult. + /// Initializes a new instance of . /// The list of VMSS VM extensions. - internal VirtualMachineScaleSetVmExtensionsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmExtensionsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of VMSS VM extensions. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.Serialization.cs index a526bad8e6fc..2ca8cedf74f2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmExtensionsSummary + public partial class VirtualMachineScaleSetVmExtensionsSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetVmExtensionsSummary DeserializeVirtualMachineScaleSetVmExtensionsSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetVmExtensionsSummary DeserializeVirtualMachineScaleSetVmExtensionsSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional> statusesSummary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +70,61 @@ internal static VirtualMachineScaleSetVmExtensionsSummary DeserializeVirtualMach statusesSummary = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetVmExtensionsSummary(name.Value, Optional.ToList(statusesSummary)); + return new VirtualMachineScaleSetVmExtensionsSummary(name.Value, Optional.ToList(statusesSummary), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmExtensionsSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmExtensionsSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmExtensionsSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmExtensionsSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmExtensionsSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmExtensionsSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmExtensionsSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.cs index 1b763e2d6877..ff36f2263c50 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmExtensionsSummary.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Extensions summary for virtual machines of a virtual machine scale set. public partial class VirtualMachineScaleSetVmExtensionsSummary { - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionsSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetVmExtensionsSummary() { StatusesSummary = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionsSummary. + /// Initializes a new instance of . /// The extension name. /// The extensions information. - internal VirtualMachineScaleSetVmExtensionsSummary(string name, IReadOnlyList statusesSummary) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmExtensionsSummary(string name, IReadOnlyList statusesSummary, Dictionary serializedAdditionalRawData) { Name = name; StatusesSummary = statusesSummary; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The extension name. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.Serialization.cs index 293c483fe1d0..f9ec53d9e164 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmInstanceIds : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmInstanceIds : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(InstanceIds)) { @@ -25,7 +33,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetVmInstanceIds DeserializeVirtualMachineScaleSetVmInstanceIds(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> instanceIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + instanceIds = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmInstanceIds(Optional.ToList(instanceIds), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmInstanceIds IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmInstanceIds(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmInstanceIds IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmInstanceIds(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmInstanceIds model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmInstanceIds(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmInstanceIds(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.cs index 29d1d92ee1c4..aac23f98c070 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceIds.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies a list of virtual machine instance IDs from the VM scale set. public partial class VirtualMachineScaleSetVmInstanceIds { - /// Initializes a new instance of VirtualMachineScaleSetVmInstanceIds. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetVmInstanceIds() { InstanceIds = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmInstanceIds(IList instanceIds, Dictionary serializedAdditionalRawData) + { + InstanceIds = instanceIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. public IList InstanceIds { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.Serialization.cs index 2e9feaa2a30b..51c67c644672 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmInstanceRequiredIds : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmInstanceRequiredIds : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("instanceIds"u8); writer.WriteStartArray(); @@ -22,7 +30,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetVmInstanceRequiredIds DeserializeVirtualMachineScaleSetVmInstanceRequiredIds(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList instanceIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceIds"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + instanceIds = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmInstanceRequiredIds(instanceIds, serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmInstanceRequiredIds IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmInstanceRequiredIds(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmInstanceRequiredIds IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmInstanceRequiredIds(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmInstanceRequiredIds model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmInstanceRequiredIds(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmInstanceRequiredIds(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.cs index 108e7d636459..467d97882765 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceRequiredIds.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies a list of virtual machine instance IDs from the VM scale set. public partial class VirtualMachineScaleSetVmInstanceRequiredIds { - /// Initializes a new instance of VirtualMachineScaleSetVmInstanceRequiredIds. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The virtual machine scale set instance ids. /// is null. public VirtualMachineScaleSetVmInstanceRequiredIds(IEnumerable instanceIds) @@ -25,6 +28,20 @@ public VirtualMachineScaleSetVmInstanceRequiredIds(IEnumerable instanceI InstanceIds = instanceIds.ToList(); } + /// Initializes a new instance of . + /// The virtual machine scale set instance ids. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmInstanceRequiredIds(IList instanceIds, Dictionary serializedAdditionalRawData) + { + InstanceIds = instanceIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetVmInstanceRequiredIds() + { + } + /// The virtual machine scale set instance ids. public IList InstanceIds { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.Serialization.cs index 7400573b0025..cc9d9c5b61c9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.Serialization.cs @@ -5,16 +5,170 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmInstanceView + public partial class VirtualMachineScaleSetVmInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetVmInstanceView DeserializeVirtualMachineScaleSetVmInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PlatformUpdateDomain)) + { + writer.WritePropertyName("platformUpdateDomain"u8); + writer.WriteNumberValue(PlatformUpdateDomain.Value); + } + if (Optional.IsDefined(PlatformFaultDomain)) + { + writer.WritePropertyName("platformFaultDomain"u8); + writer.WriteNumberValue(PlatformFaultDomain.Value); + } + if (Optional.IsDefined(RdpThumbPrint)) + { + writer.WritePropertyName("rdpThumbPrint"u8); + writer.WriteStringValue(RdpThumbPrint); + } + if (Optional.IsDefined(VmAgent)) + { + writer.WritePropertyName("vmAgent"u8); + if (VmAgent is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VmAgent).Serialize(writer, options); + } + } + if (Optional.IsDefined(MaintenanceRedeployStatus)) + { + writer.WritePropertyName("maintenanceRedeployStatus"u8); + if (MaintenanceRedeployStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaintenanceRedeployStatus).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Disks)) + { + writer.WritePropertyName("disks"u8); + writer.WriteStartArray(); + foreach (var item in Disks) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Extensions)) + { + writer.WritePropertyName("extensions"u8); + writer.WriteStartArray(); + foreach (var item in Extensions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(BootDiagnostics)) + { + writer.WritePropertyName("bootDiagnostics"u8); + if (BootDiagnostics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BootDiagnostics).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Statuses)) + { + writer.WritePropertyName("statuses"u8); + writer.WriteStartArray(); + foreach (var item in Statuses) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PlacementGroupId)) + { + writer.WritePropertyName("placementGroupId"u8); + writer.WriteStringValue(PlacementGroupId); + } + if (Optional.IsDefined(ComputerName)) + { + writer.WritePropertyName("computerName"u8); + writer.WriteStringValue(ComputerName); + } + if (Optional.IsDefined(OSName)) + { + writer.WritePropertyName("osName"u8); + writer.WriteStringValue(OSName); + } + if (Optional.IsDefined(OSVersion)) + { + writer.WritePropertyName("osVersion"u8); + writer.WriteStringValue(OSVersion); + } + if (Optional.IsDefined(HyperVGeneration)) + { + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetVmInstanceView DeserializeVirtualMachineScaleSetVmInstanceView(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +189,7 @@ internal static VirtualMachineScaleSetVmInstanceView DeserializeVirtualMachineSc Optional osName = default; Optional osVersion = default; Optional hyperVGeneration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("platformUpdateDomain"u8)) @@ -176,8 +331,61 @@ internal static VirtualMachineScaleSetVmInstanceView DeserializeVirtualMachineSc hyperVGeneration = new HyperVGeneration(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), rdpThumbPrint.Value, vmAgent.Value, maintenanceRedeployStatus.Value, Optional.ToList(disks), Optional.ToList(extensions), vmHealth.Value, bootDiagnostics.Value, Optional.ToList(statuses), assignedHost.Value, placementGroupId.Value, computerName.Value, osName.Value, osVersion.Value, Optional.ToNullable(hyperVGeneration), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmInstanceView(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetVmInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), rdpThumbPrint.Value, vmAgent.Value, maintenanceRedeployStatus.Value, Optional.ToList(disks), Optional.ToList(extensions), vmHealth.Value, bootDiagnostics.Value, Optional.ToList(statuses), assignedHost.Value, placementGroupId.Value, computerName.Value, osName.Value, osVersion.Value, Optional.ToNullable(hyperVGeneration)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.cs index 0795caafcdae..109936e6e10b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// The instance view of a virtual machine scale set VM. public partial class VirtualMachineScaleSetVmInstanceView { - /// Initializes a new instance of VirtualMachineScaleSetVmInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineScaleSetVmInstanceView() { Disks = new ChangeTrackingList(); @@ -21,7 +25,7 @@ internal VirtualMachineScaleSetVmInstanceView() Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetVmInstanceView. + /// Initializes a new instance of . /// The Update Domain count. /// The Fault Domain count. /// The Remote desktop certificate thumbprint. @@ -38,7 +42,8 @@ internal VirtualMachineScaleSetVmInstanceView() /// The Operating System running on the hybrid machine. /// The version of Operating System running on the hybrid machine. /// The hypervisor generation of the Virtual Machine [V1, V2]. - internal VirtualMachineScaleSetVmInstanceView(int? platformUpdateDomain, int? platformFaultDomain, string rdpThumbPrint, VirtualMachineAgentInstanceView vmAgent, MaintenanceRedeployStatus maintenanceRedeployStatus, IReadOnlyList disks, IReadOnlyList extensions, VirtualMachineHealthStatus vmHealth, BootDiagnosticsInstanceView bootDiagnostics, IReadOnlyList statuses, ResourceIdentifier assignedHost, string placementGroupId, string computerName, string osName, string osVersion, HyperVGeneration? hyperVGeneration) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmInstanceView(int? platformUpdateDomain, int? platformFaultDomain, string rdpThumbPrint, VirtualMachineAgentInstanceView vmAgent, MaintenanceRedeployStatus maintenanceRedeployStatus, IReadOnlyList disks, IReadOnlyList extensions, VirtualMachineHealthStatus vmHealth, BootDiagnosticsInstanceView bootDiagnostics, IReadOnlyList statuses, ResourceIdentifier assignedHost, string placementGroupId, string computerName, string osName, string osVersion, HyperVGeneration? hyperVGeneration, Dictionary serializedAdditionalRawData) { PlatformUpdateDomain = platformUpdateDomain; PlatformFaultDomain = platformFaultDomain; @@ -56,6 +61,7 @@ internal VirtualMachineScaleSetVmInstanceView(int? platformUpdateDomain, int? pl OSName = osName; OSVersion = osVersion; HyperVGeneration = hyperVGeneration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Update Domain count. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.Serialization.cs index 1e70b7ea45d5..edbceaa03592 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Compute; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetVmListResult + internal partial class VirtualMachineScaleSetVmListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineScaleSetVmListResult DeserializeVirtualMachineScaleSetVmListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineScaleSetVmListResult DeserializeVirtualMachineScaleSetVmListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineScaleSetVmListResult DeserializeVirtualMachineScal nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineScaleSetVmListResult(value, nextLink.Value); + return new VirtualMachineScaleSetVmListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.cs index 2646cb72fd2c..4a0475eb1903 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Compute.Models /// The List Virtual Machine Scale Set VMs operation response. internal partial class VirtualMachineScaleSetVmListResult { - /// Initializes a new instance of VirtualMachineScaleSetVmListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of virtual machine scale sets VMs. /// is null. internal VirtualMachineScaleSetVmListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineScaleSetVmListResult(IEnumerable Initializes a new instance of VirtualMachineScaleSetVmListResult. + /// Initializes a new instance of . /// The list of virtual machine scale sets VMs. /// The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with this to fetch the next page of VMSS VMs. - internal VirtualMachineScaleSetVmListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetVmListResult() + { } /// The list of virtual machine scale sets VMs. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.Serialization.cs index 0ba86754718f..3f2bb359d6bc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineScaleSetVmNetworkProfileConfiguration : IUtf8JsonSerializable + internal partial class VirtualMachineScaleSetVmNetworkProfileConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NetworkInterfaceConfigurations)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaceConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetVmNetworkProfileConfiguration DeserializeVirtualMachineScaleSetVmNetworkProfileConfiguration(JsonElement element) + internal static VirtualMachineScaleSetVmNetworkProfileConfiguration DeserializeVirtualMachineScaleSetVmNetworkProfileConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> networkInterfaceConfigurations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaceConfigurations"u8)) @@ -52,8 +81,61 @@ internal static VirtualMachineScaleSetVmNetworkProfileConfiguration DeserializeV networkInterfaceConfigurations = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmNetworkProfileConfiguration(Optional.ToList(networkInterfaceConfigurations), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmNetworkProfileConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmNetworkProfileConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmNetworkProfileConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmNetworkProfileConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmNetworkProfileConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmNetworkProfileConfiguration(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetVmNetworkProfileConfiguration(Optional.ToList(networkInterfaceConfigurations)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmNetworkProfileConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.cs index 0ef5c07c25fe..d1a880f8a9ce 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmNetworkProfileConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set VM network profile. internal partial class VirtualMachineScaleSetVmNetworkProfileConfiguration { - /// Initializes a new instance of VirtualMachineScaleSetVmNetworkProfileConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetVmNetworkProfileConfiguration() { NetworkInterfaceConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetVmNetworkProfileConfiguration. + /// Initializes a new instance of . /// The list of network configurations. - internal VirtualMachineScaleSetVmNetworkProfileConfiguration(IList networkInterfaceConfigurations) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmNetworkProfileConfiguration(IList networkInterfaceConfigurations, Dictionary serializedAdditionalRawData) { NetworkInterfaceConfigurations = networkInterfaceConfigurations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of network configurations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.Serialization.cs index 0b0c7eb03ac5..2cde2058d9a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.Serialization.cs @@ -5,46 +5,96 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmProfile : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(DiagnosticsProfile)) { writer.WritePropertyName("diagnosticsProfile"u8); - writer.WriteObjectValue(DiagnosticsProfile); + if (DiagnosticsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ExtensionProfile)) { writer.WritePropertyName("extensionProfile"u8); - writer.WriteObjectValue(ExtensionProfile); + if (ExtensionProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExtensionProfile).Serialize(writer, options); + } } if (Optional.IsDefined(LicenseType)) { @@ -64,12 +114,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BillingProfile)) { writer.WritePropertyName("billingProfile"u8); - writer.WriteObjectValue(BillingProfile); + if (BillingProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BillingProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ScheduledEventsProfile)) { writer.WritePropertyName("scheduledEventsProfile"u8); - writer.WriteObjectValue(ScheduledEventsProfile); + if (ScheduledEventsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduledEventsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(UserData)) { @@ -79,17 +143,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CapacityReservation)) { writer.WritePropertyName("capacityReservation"u8); - writer.WriteObjectValue(CapacityReservation); + if (CapacityReservation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CapacityReservation).Serialize(writer, options); + } } if (Optional.IsDefined(ApplicationProfile)) { writer.WritePropertyName("applicationProfile"u8); - writer.WriteObjectValue(ApplicationProfile); + if (ApplicationProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApplicationProfile).Serialize(writer, options); + } } if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ServiceArtifactReference)) { @@ -99,13 +184,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityPostureReference)) { writer.WritePropertyName("securityPostureReference"u8); - writer.WriteObjectValue(SecurityPostureReference); + if (SecurityPostureReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityPostureReference).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetVmProfile DeserializeVirtualMachineScaleSetVmProfile(JsonElement element) + internal static VirtualMachineScaleSetVmProfile DeserializeVirtualMachineScaleSetVmProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,6 +233,7 @@ internal static VirtualMachineScaleSetVmProfile DeserializeVirtualMachineScaleSe Optional hardwareProfile = default; Optional serviceArtifactReference = default; Optional securityPostureReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osProfile"u8)) @@ -274,8 +381,61 @@ internal static VirtualMachineScaleSetVmProfile DeserializeVirtualMachineScaleSe securityPostureReference = ComputeSecurityPostureReference.DeserializeComputeSecurityPostureReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmProfile(osProfile.Value, storageProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, extensionProfile.Value, licenseType.Value, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value, hardwareProfile.Value, serviceArtifactReference, securityPostureReference.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineScaleSetVmProfile(osProfile.Value, storageProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, extensionProfile.Value, licenseType.Value, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value, hardwareProfile.Value, serviceArtifactReference, securityPostureReference.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs index 1bbec3b683a6..09a34658257b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Compute.Models /// Describes a virtual machine scale set virtual machine profile. public partial class VirtualMachineScaleSetVmProfile { - /// Initializes a new instance of VirtualMachineScaleSetVmProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetVmProfile() { } - /// Initializes a new instance of VirtualMachineScaleSetVmProfile. + /// Initializes a new instance of . /// Specifies the operating system settings for the virtual machines in the scale set. /// Specifies the storage settings for the virtual machine disks. /// Specifies properties of the network interfaces of the virtual machines in the scale set. @@ -37,7 +41,8 @@ public VirtualMachineScaleSetVmProfile() /// Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. /// Specifies the service artifact reference id used to set same image version for all virtual machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01. /// Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01. - internal VirtualMachineScaleSetVmProfile(VirtualMachineScaleSetOSProfile osProfile, VirtualMachineScaleSetStorageProfile storageProfile, VirtualMachineScaleSetNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, VirtualMachineScaleSetExtensionProfile extensionProfile, string licenseType, VirtualMachinePriorityType? priority, VirtualMachineEvictionPolicyType? evictionPolicy, BillingProfile billingProfile, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, VirtualMachineScaleSetHardwareProfile hardwareProfile, WritableSubResource serviceArtifactReference, ComputeSecurityPostureReference securityPostureReference) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmProfile(VirtualMachineScaleSetOSProfile osProfile, VirtualMachineScaleSetStorageProfile storageProfile, VirtualMachineScaleSetNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, VirtualMachineScaleSetExtensionProfile extensionProfile, string licenseType, VirtualMachinePriorityType? priority, VirtualMachineEvictionPolicyType? evictionPolicy, BillingProfile billingProfile, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, VirtualMachineScaleSetHardwareProfile hardwareProfile, WritableSubResource serviceArtifactReference, ComputeSecurityPostureReference securityPostureReference, Dictionary serializedAdditionalRawData) { OSProfile = osProfile; StorageProfile = storageProfile; @@ -56,6 +61,7 @@ internal VirtualMachineScaleSetVmProfile(VirtualMachineScaleSetOSProfile osProfi HardwareProfile = hardwareProfile; ServiceArtifactReference = serviceArtifactReference; SecurityPostureReference = securityPostureReference; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the operating system settings for the virtual machines in the scale set. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.Serialization.cs index 8a4216bb032d..255e40997c98 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmProtectionPolicy : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmProtectionPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProtectFromScaleIn)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("protectFromScaleSetActions"u8); writer.WriteBooleanValue(ProtectFromScaleSetActions.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineScaleSetVmProtectionPolicy DeserializeVirtualMachineScaleSetVmProtectionPolicy(JsonElement element) + internal static VirtualMachineScaleSetVmProtectionPolicy DeserializeVirtualMachineScaleSetVmProtectionPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional protectFromScaleIn = default; Optional protectFromScaleSetActions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("protectFromScaleIn"u8)) @@ -56,8 +79,61 @@ internal static VirtualMachineScaleSetVmProtectionPolicy DeserializeVirtualMachi protectFromScaleSetActions = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmProtectionPolicy(Optional.ToNullable(protectFromScaleIn), Optional.ToNullable(protectFromScaleSetActions), serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmProtectionPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmProtectionPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmProtectionPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmProtectionPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmProtectionPolicy model) + { + if (model is null) + { + return null; } - return new VirtualMachineScaleSetVmProtectionPolicy(Optional.ToNullable(protectFromScaleIn), Optional.ToNullable(protectFromScaleSetActions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmProtectionPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmProtectionPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.cs index b42bb2f346df..1fbf47d91d25 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProtectionPolicy.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The protection policy of a virtual machine scale set VM. public partial class VirtualMachineScaleSetVmProtectionPolicy { - /// Initializes a new instance of VirtualMachineScaleSetVmProtectionPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetVmProtectionPolicy() { } - /// Initializes a new instance of VirtualMachineScaleSetVmProtectionPolicy. + /// Initializes a new instance of . /// Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a scale-in operation. /// Indicates that model updates or actions (including scale-in) initiated on the virtual machine scale set should not be applied to the virtual machine scale set VM. - internal VirtualMachineScaleSetVmProtectionPolicy(bool? protectFromScaleIn, bool? protectFromScaleSetActions) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmProtectionPolicy(bool? protectFromScaleIn, bool? protectFromScaleSetActions, Dictionary serializedAdditionalRawData) { ProtectFromScaleIn = protectFromScaleIn; ProtectFromScaleSetActions = protectFromScaleSetActions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a scale-in operation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.Serialization.cs index f71888cf8bae..7016f4555096 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineScaleSetVmReimageContent : IUtf8JsonSerializable + public partial class VirtualMachineScaleSetVmReimageContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TempDisk)) { @@ -28,9 +36,122 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static VirtualMachineScaleSetVmReimageContent DeserializeVirtualMachineScaleSetVmReimageContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional tempDisk = default; + Optional exactVersion = default; + Optional osProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tempDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tempDisk = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("exactVersion"u8)) + { + exactVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("osProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osProfile = OSProfileProvisioningData.DeserializeOSProfileProvisioningData(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineScaleSetVmReimageContent(Optional.ToNullable(tempDisk), exactVersion.Value, osProfile.Value, serializedAdditionalRawData); + } + + VirtualMachineScaleSetVmReimageContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineScaleSetVmReimageContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineScaleSetVmReimageContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineScaleSetVmReimageContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineScaleSetVmReimageContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineScaleSetVmReimageContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineScaleSetVmReimageContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.cs index d417292813be..0587369d4591 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmReimageContent.cs @@ -5,14 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes a Virtual Machine Scale Set VM Reimage Parameters. public partial class VirtualMachineScaleSetVmReimageContent : VirtualMachineReimageContent { - /// Initializes a new instance of VirtualMachineScaleSetVmReimageContent. + /// Initializes a new instance of . public VirtualMachineScaleSetVmReimageContent() { } + + /// Initializes a new instance of . + /// Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + /// Specifies in decimal number, the version the OS disk should be reimaged to. If exact version is not provided, the OS disk is reimaged to the existing version of OS Disk. + /// Specifies information required for reimaging the non-ephemeral OS disk. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmReimageContent(bool? tempDisk, string exactVersion, OSProfileProvisioningData osProfile, Dictionary serializedAdditionalRawData) : base(tempDisk, exactVersion, osProfile, serializedAdditionalRawData) + { + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.Serialization.cs index c8cc59e00bda..911f6c4a5083 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.Serialization.cs @@ -5,15 +5,73 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineSize + public partial class VirtualMachineSize : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineSize DeserializeVirtualMachineSize(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(NumberOfCores)) + { + writer.WritePropertyName("numberOfCores"u8); + writer.WriteNumberValue(NumberOfCores.Value); + } + if (Optional.IsDefined(OSDiskSizeInMB)) + { + writer.WritePropertyName("osDiskSizeInMB"u8); + writer.WriteNumberValue(OSDiskSizeInMB.Value); + } + if (Optional.IsDefined(ResourceDiskSizeInMB)) + { + writer.WritePropertyName("resourceDiskSizeInMB"u8); + writer.WriteNumberValue(ResourceDiskSizeInMB.Value); + } + if (Optional.IsDefined(MemoryInMB)) + { + writer.WritePropertyName("memoryInMB"u8); + writer.WriteNumberValue(MemoryInMB.Value); + } + if (Optional.IsDefined(MaxDataDiskCount)) + { + writer.WritePropertyName("maxDataDiskCount"u8); + writer.WriteNumberValue(MaxDataDiskCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineSize DeserializeVirtualMachineSize(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static VirtualMachineSize DeserializeVirtualMachineSize(JsonElement ele Optional resourceDiskSizeInMB = default; Optional memoryInMB = default; Optional maxDataDiskCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -76,8 +135,61 @@ internal static VirtualMachineSize DeserializeVirtualMachineSize(JsonElement ele maxDataDiskCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineSize(name.Value, Optional.ToNullable(numberOfCores), Optional.ToNullable(osDiskSizeInMB), Optional.ToNullable(resourceDiskSizeInMB), Optional.ToNullable(memoryInMB), Optional.ToNullable(maxDataDiskCount)); + return new VirtualMachineSize(name.Value, Optional.ToNullable(numberOfCores), Optional.ToNullable(osDiskSizeInMB), Optional.ToNullable(resourceDiskSizeInMB), Optional.ToNullable(memoryInMB), Optional.ToNullable(maxDataDiskCount), serializedAdditionalRawData); + } + + VirtualMachineSize IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineSize(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineSize IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineSize(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineSize model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineSize(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineSize(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.cs index 266fd4a813e4..53b810fb79b6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSize.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Describes the properties of a VM size. public partial class VirtualMachineSize { - /// Initializes a new instance of VirtualMachineSize. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineSize() { } - /// Initializes a new instance of VirtualMachineSize. + /// Initializes a new instance of . /// The name of the virtual machine size. /// The number of cores supported by the virtual machine size. For Constrained vCPU capable VM sizes, this number represents the total vCPUs of quota that the VM uses. For accurate vCPU count, please refer to https://docs.microsoft.com/azure/virtual-machines/constrained-vcpu or https://docs.microsoft.com/rest/api/compute/resourceskus/list. /// The OS disk size, in MB, allowed by the virtual machine size. /// The resource disk size, in MB, allowed by the virtual machine size. /// The amount of memory, in MB, supported by the virtual machine size. /// The maximum number of data disks that can be attached to the virtual machine size. - internal VirtualMachineSize(string name, int? numberOfCores, int? osDiskSizeInMB, int? resourceDiskSizeInMB, int? memoryInMB, int? maxDataDiskCount) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineSize(string name, int? numberOfCores, int? osDiskSizeInMB, int? resourceDiskSizeInMB, int? memoryInMB, int? maxDataDiskCount, Dictionary serializedAdditionalRawData) { Name = name; NumberOfCores = numberOfCores; @@ -30,6 +37,7 @@ internal VirtualMachineSize(string name, int? numberOfCores, int? osDiskSizeInMB ResourceDiskSizeInMB = resourceDiskSizeInMB; MemoryInMB = memoryInMB; MaxDataDiskCount = maxDataDiskCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the virtual machine size. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.Serialization.cs index bf5ed6d44603..a39fc46b93f4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VirtualMachineSizeListResult + internal partial class VirtualMachineSizeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineSizeListResult DeserializeVirtualMachineSizeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineSizeListResult DeserializeVirtualMachineSizeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static VirtualMachineSizeListResult DeserializeVirtualMachineSizeListRe value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineSizeListResult(Optional.ToList(value)); + return new VirtualMachineSizeListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + VirtualMachineSizeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineSizeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineSizeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineSizeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineSizeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineSizeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineSizeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.cs index 9887f079ce39..c3ccbcde28f3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// The List Virtual Machine operation response. internal partial class VirtualMachineSizeListResult { - /// Initializes a new instance of VirtualMachineSizeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineSizeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineSizeListResult. + /// Initializes a new instance of . /// The list of virtual machine sizes. - internal VirtualMachineSizeListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineSizeListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of virtual machine sizes. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.Serialization.cs index bd8ed642fcdb..53a737b4f4c5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineSizeProperties : IUtf8JsonSerializable + public partial class VirtualMachineSizeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VCpusAvailable)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("vCPUsPerCore"u8); writer.WriteNumberValue(VCpusPerCore.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineSizeProperties DeserializeVirtualMachineSizeProperties(JsonElement element) + internal static VirtualMachineSizeProperties DeserializeVirtualMachineSizeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional vCpusAvailable = default; Optional vCpusPerCore = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vCPUsAvailable"u8)) @@ -56,8 +79,61 @@ internal static VirtualMachineSizeProperties DeserializeVirtualMachineSizeProper vCpusPerCore = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineSizeProperties(Optional.ToNullable(vCpusAvailable), Optional.ToNullable(vCpusPerCore), serializedAdditionalRawData); + } + + VirtualMachineSizeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineSizeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineSizeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineSizeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineSizeProperties model) + { + if (model is null) + { + return null; } - return new VirtualMachineSizeProperties(Optional.ToNullable(vCpusAvailable), Optional.ToNullable(vCpusPerCore)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineSizeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineSizeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.cs index 69280f8d22fb..010e75c4d5c4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSizeProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies VM Size Property settings on the virtual machine. public partial class VirtualMachineSizeProperties { - /// Initializes a new instance of VirtualMachineSizeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineSizeProperties() { } - /// Initializes a new instance of VirtualMachineSizeProperties. + /// Initializes a new instance of . /// Specifies the number of vCPUs available for the VM. When this property is not specified in the request body the default behavior is to set it to the value of vCPUs available for that VM size exposed in api response of [List all available virtual machine sizes in a region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). /// Specifies the vCPU to physical core ratio. When this property is not specified in the request body the default behavior is set to the value of vCPUsPerCore for the VM Size exposed in api response of [List all available virtual machine sizes in a region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). **Setting this property to 1 also means that hyper-threading is disabled.**. - internal VirtualMachineSizeProperties(int? vCpusAvailable, int? vCpusPerCore) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineSizeProperties(int? vCpusAvailable, int? vCpusPerCore, Dictionary serializedAdditionalRawData) { VCpusAvailable = vCpusAvailable; VCpusPerCore = vCpusPerCore; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the number of vCPUs available for the VM. When this property is not specified in the request body the default behavior is to set it to the value of vCPUs available for that VM size exposed in api response of [List all available virtual machine sizes in a region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.Serialization.cs index 0e85e220955d..2ae8e75e1360 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineSoftwarePatchProperties + public partial class VirtualMachineSoftwarePatchProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineSoftwarePatchProperties DeserializeVirtualMachineSoftwarePatchProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineSoftwarePatchProperties DeserializeVirtualMachineSoftwarePatchProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +56,7 @@ internal static VirtualMachineSoftwarePatchProperties DeserializeVirtualMachineS Optional publishedDate = default; Optional lastModifiedDateTime = default; Optional assessmentState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("patchId"u8)) @@ -107,8 +134,61 @@ internal static VirtualMachineSoftwarePatchProperties DeserializeVirtualMachineS assessmentState = new PatchAssessmentState(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineSoftwarePatchProperties(patchId.Value, name.Value, version.Value, kbId.Value, Optional.ToList(classifications), Optional.ToNullable(rebootBehavior), activityId.Value, Optional.ToNullable(publishedDate), Optional.ToNullable(lastModifiedDateTime), Optional.ToNullable(assessmentState)); + return new VirtualMachineSoftwarePatchProperties(patchId.Value, name.Value, version.Value, kbId.Value, Optional.ToList(classifications), Optional.ToNullable(rebootBehavior), activityId.Value, Optional.ToNullable(publishedDate), Optional.ToNullable(lastModifiedDateTime), Optional.ToNullable(assessmentState), serializedAdditionalRawData); + } + + VirtualMachineSoftwarePatchProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineSoftwarePatchProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineSoftwarePatchProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineSoftwarePatchProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineSoftwarePatchProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineSoftwarePatchProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineSoftwarePatchProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs index 46e083d4a969..5b19a40bbcaa 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineSoftwarePatchProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Describes the properties of a Virtual Machine software patch. public partial class VirtualMachineSoftwarePatchProperties { - /// Initializes a new instance of VirtualMachineSoftwarePatchProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineSoftwarePatchProperties() { Classifications = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineSoftwarePatchProperties. + /// Initializes a new instance of . /// A unique identifier for the patch. /// The friendly name of the patch. /// The version number of the patch. This property applies only to Linux patches. @@ -31,7 +34,8 @@ internal VirtualMachineSoftwarePatchProperties() /// The UTC timestamp when the repository published this patch. /// The UTC timestamp of the last update to this patch record. /// Describes the availability of a given patch. - internal VirtualMachineSoftwarePatchProperties(string patchId, string name, string version, string kbId, IReadOnlyList classifications, VmGuestPatchRebootBehavior? rebootBehavior, string activityId, DateTimeOffset? publishedOn, DateTimeOffset? lastModifiedOn, PatchAssessmentState? assessmentState) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineSoftwarePatchProperties(string patchId, string name, string version, string kbId, IReadOnlyList classifications, VmGuestPatchRebootBehavior? rebootBehavior, string activityId, DateTimeOffset? publishedOn, DateTimeOffset? lastModifiedOn, PatchAssessmentState? assessmentState, Dictionary serializedAdditionalRawData) { PatchId = patchId; Name = name; @@ -43,6 +47,7 @@ internal VirtualMachineSoftwarePatchProperties(string patchId, string name, stri PublishedOn = publishedOn; LastModifiedOn = lastModifiedOn; AssessmentState = assessmentState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A unique identifier for the patch. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.Serialization.cs index b223c600969b..a3d47b72b416 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineStatusCodeCount + public partial class VirtualMachineStatusCodeCount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineStatusCodeCount DeserializeVirtualMachineStatusCodeCount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineStatusCodeCount DeserializeVirtualMachineStatusCodeCount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -36,8 +65,61 @@ internal static VirtualMachineStatusCodeCount DeserializeVirtualMachineStatusCod count = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineStatusCodeCount(code.Value, Optional.ToNullable(count)); + return new VirtualMachineStatusCodeCount(code.Value, Optional.ToNullable(count), serializedAdditionalRawData); + } + + VirtualMachineStatusCodeCount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineStatusCodeCount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineStatusCodeCount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineStatusCodeCount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineStatusCodeCount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineStatusCodeCount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineStatusCodeCount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs index f3a5833239e4..2c1a8db87ceb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStatusCodeCount.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// The status code and count of the virtual machine scale set instance view status summary. public partial class VirtualMachineStatusCodeCount { - /// Initializes a new instance of VirtualMachineStatusCodeCount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualMachineStatusCodeCount() { } - /// Initializes a new instance of VirtualMachineStatusCodeCount. + /// Initializes a new instance of . /// The instance view status code. /// The number of instances having a particular status code. - internal VirtualMachineStatusCodeCount(string code, int? count) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineStatusCodeCount(string code, int? count, Dictionary serializedAdditionalRawData) { Code = code; Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The instance view status code. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.Serialization.cs index 603fec46d8a5..80b503a6226a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class VirtualMachineStorageProfile : IUtf8JsonSerializable + public partial class VirtualMachineStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ImageReference)) { writer.WritePropertyName("imageReference"u8); - writer.WriteObjectValue(ImageReference); + if (ImageReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageReference).Serialize(writer, options); + } } if (Optional.IsDefined(OSDisk)) { writer.WritePropertyName("osDisk"u8); - writer.WriteObjectValue(OSDisk); + if (OSDisk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSDisk).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataDisks)) { @@ -32,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataDisks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,11 +69,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskControllerType"u8); writer.WriteStringValue(DiskControllerType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineStorageProfile DeserializeVirtualMachineStorageProfile(JsonElement element) + internal static VirtualMachineStorageProfile DeserializeVirtualMachineStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +96,7 @@ internal static VirtualMachineStorageProfile DeserializeVirtualMachineStoragePro Optional osDisk = default; Optional> dataDisks = default; Optional diskControllerType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageReference"u8)) @@ -97,8 +140,61 @@ internal static VirtualMachineStorageProfile DeserializeVirtualMachineStoragePro diskControllerType = new DiskControllerType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineStorageProfile(imageReference.Value, osDisk.Value, Optional.ToList(dataDisks), Optional.ToNullable(diskControllerType), serializedAdditionalRawData); + } + + VirtualMachineStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineStorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineStorageProfile(Response response) + { + if (response is null) + { + return null; } - return new VirtualMachineStorageProfile(imageReference.Value, osDisk.Value, Optional.ToList(dataDisks), Optional.ToNullable(diskControllerType)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.cs index 0763778db7f4..fbcb6c99a955 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineStorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies the storage settings for the virtual machine disks. public partial class VirtualMachineStorageProfile { - /// Initializes a new instance of VirtualMachineStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineStorageProfile() { DataDisks = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineStorageProfile. + /// Initializes a new instance of . /// Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. /// Specifies information about the operating system disk used by the virtual machine. For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). /// Specifies the parameters that are used to add a data disk to a virtual machine. For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). /// Specifies the disk controller type configured for the VM. **Note:** This property will be set to the default disk controller type if not specified provided virtual machine is being created with 'hyperVGeneration' set to V2 based on the capabilities of the operating system disk and VM size from the the specified minimum api version. You need to deallocate the VM before updating its disk controller type unless you are updating the VM size in the VM configuration which implicitly deallocates and reallocates the VM. Minimum api-version: 2022-08-01. - internal VirtualMachineStorageProfile(ImageReference imageReference, VirtualMachineOSDisk osDisk, IList dataDisks, DiskControllerType? diskControllerType) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineStorageProfile(ImageReference imageReference, VirtualMachineOSDisk osDisk, IList dataDisks, DiskControllerType? diskControllerType, Dictionary serializedAdditionalRawData) { ImageReference = imageReference; OSDisk = osDisk; DataDisks = dataDisks; DiskControllerType = diskControllerType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.Serialization.cs index 477f1e7dd2ac..9807c7a9c24d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class VmImagesInEdgeZoneListResult + internal partial class VmImagesInEdgeZoneListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VmImagesInEdgeZoneListResult DeserializeVmImagesInEdgeZoneListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VmImagesInEdgeZoneListResult DeserializeVmImagesInEdgeZoneListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static VmImagesInEdgeZoneListResult DeserializeVmImagesInEdgeZoneListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VmImagesInEdgeZoneListResult(Optional.ToList(value), nextLink.Value); + return new VmImagesInEdgeZoneListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + VmImagesInEdgeZoneListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVmImagesInEdgeZoneListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VmImagesInEdgeZoneListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVmImagesInEdgeZoneListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VmImagesInEdgeZoneListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VmImagesInEdgeZoneListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVmImagesInEdgeZoneListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.cs index f7e18a9cddbd..69a1feb38d0d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VmImagesInEdgeZoneListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Compute.Models /// The List VmImages in EdgeZone operation response. internal partial class VmImagesInEdgeZoneListResult { - /// Initializes a new instance of VmImagesInEdgeZoneListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VmImagesInEdgeZoneListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of VmImagesInEdgeZoneListResult. + /// Initializes a new instance of . /// The list of VMImages in EdgeZone. /// The URI to fetch the next page of VMImages in EdgeZone. Call ListNext() with this URI to fetch the next page of VmImages. - internal VmImagesInEdgeZoneListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal VmImagesInEdgeZoneListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of VMImages in EdgeZone. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.Serialization.cs index 8f408bfc7e74..b906d5b7cb8b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - internal partial class WinRMConfiguration : IUtf8JsonSerializable + internal partial class WinRMConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Listeners)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Listeners) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WinRMConfiguration DeserializeWinRMConfiguration(JsonElement element) + internal static WinRMConfiguration DeserializeWinRMConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> listeners = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("listeners"u8)) @@ -52,8 +81,61 @@ internal static WinRMConfiguration DeserializeWinRMConfiguration(JsonElement ele listeners = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WinRMConfiguration(Optional.ToList(listeners), serializedAdditionalRawData); + } + + WinRMConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWinRMConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WinRMConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWinRMConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WinRMConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WinRMConfiguration(Response response) + { + if (response is null) + { + return null; } - return new WinRMConfiguration(Optional.ToList(listeners)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWinRMConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.cs index f254dafb3fb5..5ddcd1d47385 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Compute.Models /// Describes Windows Remote Management configuration of the VM. internal partial class WinRMConfiguration { - /// Initializes a new instance of WinRMConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WinRMConfiguration() { Listeners = new ChangeTrackingList(); } - /// Initializes a new instance of WinRMConfiguration. + /// Initializes a new instance of . /// The list of Windows Remote Management listeners. - internal WinRMConfiguration(IList listeners) + /// Keeps track of any properties unknown to the library. + internal WinRMConfiguration(IList listeners, Dictionary serializedAdditionalRawData) { Listeners = listeners; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of Windows Remote Management listeners. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.Serialization.cs index a7002db55b09..68cf596fbacf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class WinRMListener : IUtf8JsonSerializable + public partial class WinRMListener : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Protocol)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certificateUrl"u8); writer.WriteStringValue(CertificateUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WinRMListener DeserializeWinRMListener(JsonElement element) + internal static WinRMListener DeserializeWinRMListener(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional protocol = default; Optional certificateUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("protocol"u8)) @@ -57,8 +79,61 @@ internal static WinRMListener DeserializeWinRMListener(JsonElement element) certificateUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WinRMListener(Optional.ToNullable(protocol), certificateUrl.Value, serializedAdditionalRawData); + } + + WinRMListener IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWinRMListener(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WinRMListener IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWinRMListener(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WinRMListener model) + { + if (model is null) + { + return null; } - return new WinRMListener(Optional.ToNullable(protocol), certificateUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WinRMListener(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWinRMListener(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.cs index a33ff8ccbe6b..32ecccf0b621 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WinRMListener.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Compute.Models { /// Describes Protocol and thumbprint of Windows Remote Management listener. public partial class WinRMListener { - /// Initializes a new instance of WinRMListener. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WinRMListener() { } - /// Initializes a new instance of WinRMListener. + /// Initializes a new instance of . /// Specifies the protocol of WinRM listener. Possible values are: **http,** **https.**. /// This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual machine it is recommended to use the [Azure Key Vault virtual machine extension for Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) or the [Azure Key Vault virtual machine extension for Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). - internal WinRMListener(WinRMListenerProtocolType? protocol, Uri certificateUri) + /// Keeps track of any properties unknown to the library. + internal WinRMListener(WinRMListenerProtocolType? protocol, Uri certificateUri, Dictionary serializedAdditionalRawData) { Protocol = protocol; CertificateUri = certificateUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the protocol of WinRM listener. Possible values are: **http,** **https.**. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.Serialization.cs index 5e75f552595d..65930081777d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class WindowsConfiguration : IUtf8JsonSerializable + public partial class WindowsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProvisionVmAgent)) { @@ -37,30 +44,65 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AdditionalUnattendContent) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(PatchSettings)) { writer.WritePropertyName("patchSettings"u8); - writer.WriteObjectValue(PatchSettings); + if (PatchSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PatchSettings).Serialize(writer, options); + } } if (Optional.IsDefined(WinRM)) { writer.WritePropertyName("winRM"u8); - writer.WriteObjectValue(WinRM); + if (WinRM is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WinRM).Serialize(writer, options); + } } if (Optional.IsDefined(IsVmAgentPlatformUpdatesEnabled)) { writer.WritePropertyName("enableVMAgentPlatformUpdates"u8); writer.WriteBooleanValue(IsVmAgentPlatformUpdatesEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement element) + internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +114,7 @@ internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement Optional patchSettings = default; Optional winRM = default; Optional enableVmAgentPlatformUpdates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisionVMAgent"u8)) @@ -138,8 +181,61 @@ internal static WindowsConfiguration DeserializeWindowsConfiguration(JsonElement enableVmAgentPlatformUpdates = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WindowsConfiguration(Optional.ToNullable(provisionVmAgent), Optional.ToNullable(enableAutomaticUpdates), timeZone.Value, Optional.ToList(additionalUnattendContent), patchSettings.Value, winRM.Value, Optional.ToNullable(enableVmAgentPlatformUpdates), serializedAdditionalRawData); + } + + WindowsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWindowsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WindowsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWindowsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WindowsConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WindowsConfiguration(Response response) + { + if (response is null) + { + return null; } - return new WindowsConfiguration(Optional.ToNullable(provisionVmAgent), Optional.ToNullable(enableAutomaticUpdates), timeZone.Value, Optional.ToList(additionalUnattendContent), patchSettings.Value, winRM.Value, Optional.ToNullable(enableVmAgentPlatformUpdates)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWindowsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.cs index 2a58d1f18ca9..019516bda587 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.Compute.Models /// Specifies Windows operating system settings on the virtual machine. public partial class WindowsConfiguration { - /// Initializes a new instance of WindowsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WindowsConfiguration() { AdditionalUnattendContent = new ChangeTrackingList(); } - /// Initializes a new instance of WindowsConfiguration. + /// Initializes a new instance of . /// Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified in the request body, it is set to true by default. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. /// Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. /// Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible values can be [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value from time zones returned by [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). @@ -27,7 +31,8 @@ public WindowsConfiguration() /// [Preview Feature] Specifies settings related to VM Guest Patching on Windows. /// Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. /// Indicates whether VMAgent Platform Updates is enabled for the Windows virtual machine. Default value is false. - internal WindowsConfiguration(bool? provisionVmAgent, bool? isAutomaticUpdatesEnabled, string timeZone, IList additionalUnattendContent, PatchSettings patchSettings, WinRMConfiguration winRM, bool? isVmAgentPlatformUpdatesEnabled) + /// Keeps track of any properties unknown to the library. + internal WindowsConfiguration(bool? provisionVmAgent, bool? isAutomaticUpdatesEnabled, string timeZone, IList additionalUnattendContent, PatchSettings patchSettings, WinRMConfiguration winRM, bool? isVmAgentPlatformUpdatesEnabled, Dictionary serializedAdditionalRawData) { ProvisionVmAgent = provisionVmAgent; IsAutomaticUpdatesEnabled = isAutomaticUpdatesEnabled; @@ -36,6 +41,7 @@ internal WindowsConfiguration(bool? provisionVmAgent, bool? isAutomaticUpdatesEn PatchSettings = patchSettings; WinRM = winRM; IsVmAgentPlatformUpdatesEnabled = isVmAgentPlatformUpdatesEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified in the request body, it is set to true by default. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.Serialization.cs index c1d7fd521d4d..0f3e7169bdd3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class WindowsParameters : IUtf8JsonSerializable + public partial class WindowsParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ClassificationsToInclude)) { @@ -55,7 +63,152 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxPatchPublishDate"u8); writer.WriteStringValue(MaxPatchPublishOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static WindowsParameters DeserializeWindowsParameters(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> classificationsToInclude = default; + Optional> kbNumbersToInclude = default; + Optional> kbNumbersToExclude = default; + Optional excludeKbsRequiringReboot = default; + Optional maxPatchPublishDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("classificationsToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new VmGuestPatchClassificationForWindows(item.GetString())); + } + classificationsToInclude = array; + continue; + } + if (property.NameEquals("kbNumbersToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + kbNumbersToInclude = array; + continue; + } + if (property.NameEquals("kbNumbersToExclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + kbNumbersToExclude = array; + continue; + } + if (property.NameEquals("excludeKbsRequiringReboot"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + excludeKbsRequiringReboot = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("maxPatchPublishDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxPatchPublishDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WindowsParameters(Optional.ToList(classificationsToInclude), Optional.ToList(kbNumbersToInclude), Optional.ToList(kbNumbersToExclude), Optional.ToNullable(excludeKbsRequiringReboot), Optional.ToNullable(maxPatchPublishDate), serializedAdditionalRawData); + } + + WindowsParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWindowsParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WindowsParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWindowsParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WindowsParameters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WindowsParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWindowsParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.cs index 9cf700154321..491b37d83101 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsParameters.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.Compute.Models /// Input for InstallPatches on a Windows VM, as directly received by the API. public partial class WindowsParameters { - /// Initializes a new instance of WindowsParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WindowsParameters() { ClassificationsToInclude = new ChangeTrackingList(); @@ -22,6 +25,23 @@ public WindowsParameters() KbNumbersToExclude = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The update classifications to select when installing patches for Windows. + /// Kbs to include in the patch operation. + /// Kbs to exclude in the patch operation. + /// Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. + /// This is used to install patches that were published on or before this given max published date. + /// Keeps track of any properties unknown to the library. + internal WindowsParameters(IList classificationsToInclude, IList kbNumbersToInclude, IList kbNumbersToExclude, bool? excludeKbsRequiringReboot, DateTimeOffset? maxPatchPublishOn, Dictionary serializedAdditionalRawData) + { + ClassificationsToInclude = classificationsToInclude; + KbNumbersToInclude = kbNumbersToInclude; + KbNumbersToExclude = kbNumbersToExclude; + ExcludeKbsRequiringReboot = excludeKbsRequiringReboot; + MaxPatchPublishOn = maxPatchPublishOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The update classifications to select when installing patches for Windows. public IList ClassificationsToInclude { get; } /// Kbs to include in the patch operation. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.Serialization.cs index 14d59e12a1ec..28ab5f3df3d9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Compute.Models { - public partial class WindowsVmGuestPatchAutomaticByPlatformSettings : IUtf8JsonSerializable + public partial class WindowsVmGuestPatchAutomaticByPlatformSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RebootSetting)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("bypassPlatformSafetyChecksOnUserSchedule"u8); writer.WriteBooleanValue(BypassPlatformSafetyChecksOnUserSchedule.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WindowsVmGuestPatchAutomaticByPlatformSettings DeserializeWindowsVmGuestPatchAutomaticByPlatformSettings(JsonElement element) + internal static WindowsVmGuestPatchAutomaticByPlatformSettings DeserializeWindowsVmGuestPatchAutomaticByPlatformSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional rebootSetting = default; Optional bypassPlatformSafetyChecksOnUserSchedule = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rebootSetting"u8)) @@ -56,8 +79,61 @@ internal static WindowsVmGuestPatchAutomaticByPlatformSettings DeserializeWindow bypassPlatformSafetyChecksOnUserSchedule = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WindowsVmGuestPatchAutomaticByPlatformSettings(Optional.ToNullable(rebootSetting), Optional.ToNullable(bypassPlatformSafetyChecksOnUserSchedule), serializedAdditionalRawData); + } + + WindowsVmGuestPatchAutomaticByPlatformSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWindowsVmGuestPatchAutomaticByPlatformSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WindowsVmGuestPatchAutomaticByPlatformSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWindowsVmGuestPatchAutomaticByPlatformSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WindowsVmGuestPatchAutomaticByPlatformSettings model) + { + if (model is null) + { + return null; } - return new WindowsVmGuestPatchAutomaticByPlatformSettings(Optional.ToNullable(rebootSetting), Optional.ToNullable(bypassPlatformSafetyChecksOnUserSchedule)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WindowsVmGuestPatchAutomaticByPlatformSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWindowsVmGuestPatchAutomaticByPlatformSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.cs index 7178dbc1374c..dc6b39dbfee9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/WindowsVmGuestPatchAutomaticByPlatformSettings.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Compute.Models { /// Specifies additional settings to be applied when patch mode AutomaticByPlatform is selected in Windows patch settings. public partial class WindowsVmGuestPatchAutomaticByPlatformSettings { - /// Initializes a new instance of WindowsVmGuestPatchAutomaticByPlatformSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WindowsVmGuestPatchAutomaticByPlatformSettings() { } - /// Initializes a new instance of WindowsVmGuestPatchAutomaticByPlatformSettings. + /// Initializes a new instance of . /// Specifies the reboot setting for all AutomaticByPlatform patch installation operations. /// Enables customer to schedule patching without accidental upgrades. - internal WindowsVmGuestPatchAutomaticByPlatformSettings(WindowsVmGuestPatchAutomaticByPlatformRebootSetting? rebootSetting, bool? bypassPlatformSafetyChecksOnUserSchedule) + /// Keeps track of any properties unknown to the library. + internal WindowsVmGuestPatchAutomaticByPlatformSettings(WindowsVmGuestPatchAutomaticByPlatformRebootSetting? rebootSetting, bool? bypassPlatformSafetyChecksOnUserSchedule, Dictionary serializedAdditionalRawData) { RebootSetting = rebootSetting; BypassPlatformSafetyChecksOnUserSchedule = bypassPlatformSafetyChecksOnUserSchedule; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the reboot setting for all AutomaticByPlatform patch installation operations. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs index ee02b74fd7c3..6220b1589918 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _proximityPlacementGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proximityPlacementGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), _proximityPlacementGroupClientDiagnostics, Pipeline, "ProximityPlacementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), _proximityPlacementGroupClientDiagnostics, Pipeline, "ProximityPlacementGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _proximityPlacementGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proximityPlacementGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), _proximityPlacementGroupClientDiagnostics, Pipeline, "ProximityPlacementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), _proximityPlacementGroupClientDiagnostics, Pipeline, "ProximityPlacementGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupData.cs index 81a282f10370..c5eae2f2c53b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.Compute /// public partial class ProximityPlacementGroupData : TrackedResourceData { - /// Initializes a new instance of ProximityPlacementGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ProximityPlacementGroupData(AzureLocation location) : base(location) { @@ -28,7 +32,7 @@ public ProximityPlacementGroupData(AzureLocation location) : base(location) AvailabilitySets = new ChangeTrackingList(); } - /// Initializes a new instance of ProximityPlacementGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +46,8 @@ public ProximityPlacementGroupData(AzureLocation location) : base(location) /// A list of references to all availability sets in the proximity placement group. /// Describes colocation status of the Proximity Placement Group. /// Specifies the user intent of the proximity placement group. - internal ProximityPlacementGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ProximityPlacementGroupType? proximityPlacementGroupType, IReadOnlyList virtualMachines, IReadOnlyList virtualMachineScaleSets, IReadOnlyList availabilitySets, InstanceViewStatus colocationStatus, ProximityPlacementGroupPropertiesIntent intent) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ProximityPlacementGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ProximityPlacementGroupType? proximityPlacementGroupType, IReadOnlyList virtualMachines, IReadOnlyList virtualMachineScaleSets, IReadOnlyList availabilitySets, InstanceViewStatus colocationStatus, ProximityPlacementGroupPropertiesIntent intent, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; ProximityPlacementGroupType = proximityPlacementGroupType; @@ -51,6 +56,12 @@ internal ProximityPlacementGroupData(ResourceIdentifier id, string name, Resourc AvailabilitySets = availabilitySets; ColocationStatus = colocationStatus; Intent = intent; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ProximityPlacementGroupData() + { } /// Specifies the Availability Zone where virtual machine, virtual machine scale set or availability set associated with the proximity placement group can be created. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs index 07ecdd56fc26..a19cf738ecdb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/AvailabilitySetsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationGroupsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationGroupsRestOperations.cs index 0633b9c9ba0b..c072d0dd5ebd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationGroupsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationGroupsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationsRestOperations.cs index 16f9610625a8..5ffe2d87e1a9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CapacityReservationsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesRestOperations.cs index b0f762775832..bc1a5c56436a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -726,9 +722,7 @@ internal HttpMessage CreateRestartRequest(string subscriptionId, string resource if (roleInstances != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(roleInstances); - request.Content = content; + request.Content = roleInstances; } _userAgent.Apply(message); return message; @@ -806,9 +800,7 @@ internal HttpMessage CreateReimageRequest(string subscriptionId, string resource if (roleInstances != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(roleInstances); - request.Content = content; + request.Content = roleInstances; } _userAgent.Apply(message); return message; @@ -886,9 +878,7 @@ internal HttpMessage CreateRebuildRequest(string subscriptionId, string resource if (roleInstances != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(roleInstances); - request.Content = content; + request.Content = roleInstances; } _userAgent.Apply(message); return message; @@ -966,9 +956,7 @@ internal HttpMessage CreateDeleteInstancesRequest(string subscriptionId, string if (roleInstances != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(roleInstances); - request.Content = content; + request.Content = roleInstances; } _userAgent.Apply(message); return message; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesUpdateDomainRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesUpdateDomainRestOperations.cs index 41c08e580f8f..18cbe9a65dd8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesUpdateDomainRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/CloudServicesUpdateDomainRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateWalkUpdateDomainRequest(string subscriptionId, string if (updateDomainIdentifier != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(updateDomainIdentifier); - request.Content = content; + request.Content = updateDomainIdentifier; } _userAgent.Apply(message); return message; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostGroupsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostGroupsRestOperations.cs index dbd305890f65..16df48fc71f2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostGroupsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostGroupsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostsRestOperations.cs index 40da6054bc81..fdecc143efb4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DedicatedHostsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskAccessesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskAccessesRestOperations.cs index 28b6dc7b6359..916706667376 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskAccessesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskAccessesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -585,9 +581,7 @@ internal HttpMessage CreateUpdateAPrivateEndpointConnectionRequest(string subscr request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskEncryptionSetsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskEncryptionSetsRestOperations.cs index 5aff445d19a8..b899fa96f85e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskEncryptionSetsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskEncryptionSetsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskRestorePointRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskRestorePointRestOperations.cs index aa8433fe2be5..88e4fedaff0d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskRestorePointRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DiskRestorePointRestOperations.cs @@ -238,9 +238,7 @@ internal HttpMessage CreateGrantAccessRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DisksRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DisksRestOperations.cs index aec775c85151..7f7aefff109d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DisksRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/DisksRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -504,9 +500,7 @@ internal HttpMessage CreateGrantAccessRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleriesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleriesRestOperations.cs index 72e0720cc9c6..6f33bace500a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleriesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleriesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -134,9 +132,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationVersionsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationVersionsRestOperations.cs index 921a082f3e45..57a5dacac6d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationVersionsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationVersionsRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -150,9 +148,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationsRestOperations.cs index f9138010cee5..8c5b6f8b283b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryApplicationsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImageVersionsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImageVersionsRestOperations.cs index b795a30ec815..099e06e5461d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImageVersionsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImageVersionsRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -150,9 +148,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImagesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImagesRestOperations.cs index a925633fbe46..21b435c4bbed 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImagesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GalleryImagesRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GallerySharingProfileRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GallerySharingProfileRestOperations.cs index 1bf4fcfbabde..0663e3f4cab3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GallerySharingProfileRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/GallerySharingProfileRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sharingUpdate); - request.Content = content; + request.Content = sharingUpdate; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ImagesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ImagesRestOperations.cs index 12d302d983ea..9ec4e3866da4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ImagesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ImagesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/LogAnalyticsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/LogAnalyticsRestOperations.cs index 27a708fd5d9a..35f76ca21ff9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/LogAnalyticsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/LogAnalyticsRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateExportRequestRateByIntervalRequest(string subscriptio request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -123,9 +121,7 @@ internal HttpMessage CreateExportThrottledRequestsRequest(string subscriptionId, request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ProximityPlacementGroupsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ProximityPlacementGroupsRestOperations.cs index 8a1b8b54d451..196b2c1ed875 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ProximityPlacementGroupsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/ProximityPlacementGroupsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointCollectionsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointCollectionsRestOperations.cs index dafd6a71bd8b..dee23f9ca1c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointCollectionsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointCollectionsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointsRestOperations.cs index a7b4ea8d8e27..608ee16abb60 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/RestorePointsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SnapshotsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SnapshotsRestOperations.cs index 84df50ab2369..6b288debc0a1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SnapshotsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SnapshotsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -132,9 +130,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -504,9 +500,7 @@ internal HttpMessage CreateGrantAccessRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SshPublicKeysRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SshPublicKeysRestOperations.cs index a0975be980ae..ff0619359859 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SshPublicKeysRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/SshPublicKeysRestOperations.cs @@ -194,9 +194,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -282,9 +280,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineExtensionsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineExtensionsRestOperations.cs index 28f9f6aa1367..184405c00c1b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineExtensionsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineExtensionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineRunCommandsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineRunCommandsRestOperations.cs index da33c93eb620..97b07645367b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineRunCommandsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineRunCommandsRestOperations.cs @@ -203,9 +203,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -287,9 +285,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(runCommand); - request.Content = content; + request.Content = runCommand; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetExtensionsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetExtensionsRestOperations.cs index becae04840b4..5ee90405a3ea 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetExtensionsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetExtensionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMExtensionsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMExtensionsRestOperations.cs index b8696b3f35c3..3ebcd0ae8bd9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMExtensionsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMExtensionsRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -148,9 +146,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMRunCommandsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMRunCommandsRestOperations.cs index 87abb77c7154..c81ed35c9a1e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMRunCommandsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMRunCommandsRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -148,9 +146,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(runCommand); - request.Content = content; + request.Content = runCommand; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMsRestOperations.cs index 21e038f7473d..2d5273b749b3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetVMsRestOperations.cs @@ -59,9 +59,7 @@ internal HttpMessage CreateReimageRequest(string subscriptionId, string resource if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; @@ -296,9 +294,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1298,9 +1294,7 @@ internal HttpMessage CreateRunCommandRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(input); - request.Content = content; + request.Content = input; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetsRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetsRestOperations.cs index 9f337bc394fe..f64b0fcdb022 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetsRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachineScaleSetsRestOperations.cs @@ -125,9 +125,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -203,9 +201,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -452,9 +448,7 @@ internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resou if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -536,9 +530,7 @@ internal HttpMessage CreateDeleteInstancesRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; _userAgent.Apply(message); return message; } @@ -1000,9 +992,7 @@ internal HttpMessage CreatePowerOffRequest(string subscriptionId, string resourc if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -1082,9 +1072,7 @@ internal HttpMessage CreateRestartRequest(string subscriptionId, string resource if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -1162,9 +1150,7 @@ internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGr if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -1313,9 +1299,7 @@ internal HttpMessage CreateRedeployRequest(string subscriptionId, string resourc if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -1393,9 +1377,7 @@ internal HttpMessage CreatePerformMaintenanceRequest(string subscriptionId, stri if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -1471,9 +1453,7 @@ internal HttpMessage CreateUpdateInstancesRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; _userAgent.Apply(message); return message; } @@ -1552,9 +1532,7 @@ internal HttpMessage CreateReimageRequest(string subscriptionId, string resource if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; @@ -1632,9 +1610,7 @@ internal HttpMessage CreateReimageAllRequest(string subscriptionId, string resou if (vmInstanceIds != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(vmInstanceIds); - request.Content = content; + request.Content = vmInstanceIds; } _userAgent.Apply(message); return message; @@ -1804,9 +1780,7 @@ internal HttpMessage CreateConvertToSinglePlacementGroupRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1881,9 +1855,7 @@ internal HttpMessage CreateSetOrchestrationServiceStateRequest(string subscripti request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index f78bbbf2feac..b8b2eab5c93e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -126,9 +126,7 @@ internal HttpMessage CreateCaptureRequest(string subscriptionId, string resource request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -204,9 +202,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -282,9 +278,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -1433,9 +1427,7 @@ internal HttpMessage CreateReimageRequest(string subscriptionId, string resource if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; @@ -1807,9 +1799,7 @@ internal HttpMessage CreateInstallPatchesRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1886,9 +1876,7 @@ internal HttpMessage CreateRunCommandRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(input); - request.Content = content; + request.Content = input; _userAgent.Apply(message); return message; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs index bec195acaa9e..db35b510c401 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.Compute /// public partial class RestorePointData : ResourceData { - /// Initializes a new instance of RestorePointData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestorePointData() { ExcludeDisks = new ChangeTrackingList(); } - /// Initializes a new instance of RestorePointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +41,8 @@ public RestorePointData() /// Gets the creation time of the restore point. /// Resource Id of the source restore point from which a copy needs to be created. /// The restore point instance view. - internal RestorePointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList excludeDisks, RestorePointSourceMetadata sourceMetadata, string provisioningState, ConsistencyModeType? consistencyMode, DateTimeOffset? timeCreated, WritableSubResource sourceRestorePoint, RestorePointInstanceView instanceView) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorePointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList excludeDisks, RestorePointSourceMetadata sourceMetadata, string provisioningState, ConsistencyModeType? consistencyMode, DateTimeOffset? timeCreated, WritableSubResource sourceRestorePoint, RestorePointInstanceView instanceView, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ExcludeDisks = excludeDisks; SourceMetadata = sourceMetadata; @@ -47,6 +51,7 @@ internal RestorePointData(ResourceIdentifier id, string name, ResourceType resou TimeCreated = timeCreated; SourceRestorePoint = sourceRestorePoint; InstanceView = instanceView; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs index 904a8f46de44..154827439c16 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _restorePointGroupRestorePointCollectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _restorePointGroupRestorePointCollectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), _restorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "RestorePointGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), _restorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "RestorePointGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _restorePointGroupRestorePointCollectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _restorePointGroupRestorePointCollectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), _restorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "RestorePointGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), _restorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "RestorePointGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupData.cs index c9a1b93ed288..7f4a8bd64c89 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class RestorePointGroupData : TrackedResourceData { - /// Initializes a new instance of RestorePointGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public RestorePointGroupData(AzureLocation location) : base(location) { RestorePoints = new ChangeTrackingList(); } - /// Initializes a new instance of RestorePointGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,12 +40,19 @@ public RestorePointGroupData(AzureLocation location) : base(location) /// The provisioning state of the restore point collection. /// The unique id of the restore point collection. /// A list containing all restore points created under this restore point collection. - internal RestorePointGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RestorePointGroupSource source, string provisioningState, string restorePointGroupId, IReadOnlyList restorePoints) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal RestorePointGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RestorePointGroupSource source, string provisioningState, string restorePointGroupId, IReadOnlyList restorePoints, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Source = source; ProvisioningState = provisioningState; RestorePointGroupId = restorePointGroupId; RestorePoints = restorePoints; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RestorePointGroupData() + { } /// The properties of the source resource that this restore point collection is created from. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs index 90d1cd836ef8..b12aebe4e7a9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryCollection.cs @@ -154,7 +154,7 @@ public virtual AsyncPageable GetAllAsync(SharedToValue? s { HttpMessage FirstPageRequest(int? pageSizeHint) => _sharedGalleryRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_location), sharedTo); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedGalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location), sharedTo); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SharedGalleryResource(Client, SharedGalleryData.DeserializeSharedGalleryData(e)), _sharedGalleryClientDiagnostics, Pipeline, "SharedGalleryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SharedGalleryResource(Client, SharedGalleryData.DeserializeSharedGalleryData(e)), _sharedGalleryClientDiagnostics, Pipeline, "SharedGalleryCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -177,7 +177,7 @@ public virtual Pageable GetAll(SharedToValue? sharedTo = { HttpMessage FirstPageRequest(int? pageSizeHint) => _sharedGalleryRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_location), sharedTo); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedGalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location), sharedTo); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SharedGalleryResource(Client, SharedGalleryData.DeserializeSharedGalleryData(e)), _sharedGalleryClientDiagnostics, Pipeline, "SharedGalleryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SharedGalleryResource(Client, SharedGalleryData.DeserializeSharedGalleryData(e)), _sharedGalleryClientDiagnostics, Pipeline, "SharedGalleryCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryData.cs index e3c6c7644910..465c4771ab82 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -16,16 +18,17 @@ namespace Azure.ResourceManager.Compute /// public partial class SharedGalleryData : PirSharedGalleryResourceData { - /// Initializes a new instance of SharedGalleryData. + /// Initializes a new instance of . internal SharedGalleryData() { } - /// Initializes a new instance of SharedGalleryData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. - internal SharedGalleryData(string name, AzureLocation? location, string uniqueId) : base(name, location, uniqueId) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryData(string name, AzureLocation? location, string uniqueId, Dictionary serializedAdditionalRawData) : base(name, location, uniqueId, serializedAdditionalRawData) { } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs index 22f3fe0af5b3..88875f4b14af 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageCollection.cs @@ -150,7 +150,7 @@ public virtual AsyncPageable GetAllAsync(SharedToVal { HttpMessage FirstPageRequest(int? pageSizeHint) => _sharedGalleryImageRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, sharedTo); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedGalleryImageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, sharedTo); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SharedGalleryImageResource(Client, SharedGalleryImageData.DeserializeSharedGalleryImageData(e)), _sharedGalleryImageClientDiagnostics, Pipeline, "SharedGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SharedGalleryImageResource(Client, SharedGalleryImageData.DeserializeSharedGalleryImageData(e)), _sharedGalleryImageClientDiagnostics, Pipeline, "SharedGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -173,7 +173,7 @@ public virtual Pageable GetAll(SharedToValue? shared { HttpMessage FirstPageRequest(int? pageSizeHint) => _sharedGalleryImageRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, sharedTo); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedGalleryImageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, sharedTo); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SharedGalleryImageResource(Client, SharedGalleryImageData.DeserializeSharedGalleryImageData(e)), _sharedGalleryImageClientDiagnostics, Pipeline, "SharedGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SharedGalleryImageResource(Client, SharedGalleryImageData.DeserializeSharedGalleryImageData(e)), _sharedGalleryImageClientDiagnostics, Pipeline, "SharedGalleryImageCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageData.cs index 53cbb39080d7..0abb3e9f1714 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageData.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.Compute /// public partial class SharedGalleryImageData : PirSharedGalleryResourceData { - /// Initializes a new instance of SharedGalleryImageData. + /// Initializes a new instance of . internal SharedGalleryImageData() { Features = new ChangeTrackingList(); } - /// Initializes a new instance of SharedGalleryImageData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. @@ -40,7 +40,8 @@ internal SharedGalleryImageData() /// The architecture of the image. Applicable to OS disks only. /// Privacy statement uri for the current community gallery image. /// End-user license agreement for the current community gallery image. - internal SharedGalleryImageData(string name, AzureLocation? location, string uniqueId, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, DateTimeOffset? endOfLifeOn, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, HyperVGeneration? hyperVGeneration, IReadOnlyList features, ImagePurchasePlan purchasePlan, ArchitectureType? architecture, Uri privacyStatementUri, string eula) : base(name, location, uniqueId) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryImageData(string name, AzureLocation? location, string uniqueId, SupportedOperatingSystemType? osType, OperatingSystemStateType? osState, DateTimeOffset? endOfLifeOn, GalleryImageIdentifier identifier, RecommendedMachineConfiguration recommended, Disallowed disallowed, HyperVGeneration? hyperVGeneration, IReadOnlyList features, ImagePurchasePlan purchasePlan, ArchitectureType? architecture, Uri privacyStatementUri, string eula, Dictionary serializedAdditionalRawData) : base(name, location, uniqueId, serializedAdditionalRawData) { OSType = osType; OSState = osState; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs index 301ee2211140..5f7f0d9cbefd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionCollection.cs @@ -150,7 +150,7 @@ public virtual AsyncPageable GetAllAsync(Shar { HttpMessage FirstPageRequest(int? pageSizeHint) => _sharedGalleryImageVersionRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, sharedTo); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedGalleryImageVersionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, sharedTo); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SharedGalleryImageVersionResource(Client, SharedGalleryImageVersionData.DeserializeSharedGalleryImageVersionData(e)), _sharedGalleryImageVersionClientDiagnostics, Pipeline, "SharedGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SharedGalleryImageVersionResource(Client, SharedGalleryImageVersionData.DeserializeSharedGalleryImageVersionData(e)), _sharedGalleryImageVersionClientDiagnostics, Pipeline, "SharedGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -173,7 +173,7 @@ public virtual Pageable GetAll(SharedToValue? { HttpMessage FirstPageRequest(int? pageSizeHint) => _sharedGalleryImageVersionRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, sharedTo); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedGalleryImageVersionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, sharedTo); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SharedGalleryImageVersionResource(Client, SharedGalleryImageVersionData.DeserializeSharedGalleryImageVersionData(e)), _sharedGalleryImageVersionClientDiagnostics, Pipeline, "SharedGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SharedGalleryImageVersionResource(Client, SharedGalleryImageVersionData.DeserializeSharedGalleryImageVersionData(e)), _sharedGalleryImageVersionClientDiagnostics, Pipeline, "SharedGalleryImageVersionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionData.cs index c7ac85b4cfad..952c94c8b63b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -17,12 +18,12 @@ namespace Azure.ResourceManager.Compute /// public partial class SharedGalleryImageVersionData : PirSharedGalleryResourceData { - /// Initializes a new instance of SharedGalleryImageVersionData. + /// Initializes a new instance of . internal SharedGalleryImageVersionData() { } - /// Initializes a new instance of SharedGalleryImageVersionData. + /// Initializes a new instance of . /// Resource name. /// Resource location. /// The unique id of this shared gallery. @@ -30,7 +31,8 @@ internal SharedGalleryImageVersionData() /// The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. /// If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version. /// Describes the storage profile of the image version. - internal SharedGalleryImageVersionData(string name, AzureLocation? location, string uniqueId, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, bool? isExcludedFromLatest, SharedGalleryImageVersionStorageProfile storageProfile) : base(name, location, uniqueId) + /// Keeps track of any properties unknown to the library. + internal SharedGalleryImageVersionData(string name, AzureLocation? location, string uniqueId, DateTimeOffset? publishedOn, DateTimeOffset? endOfLifeOn, bool? isExcludedFromLatest, SharedGalleryImageVersionStorageProfile storageProfile, Dictionary serializedAdditionalRawData) : base(name, location, uniqueId, serializedAdditionalRawData) { PublishedOn = publishedOn; EndOfLifeOn = endOfLifeOn; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs index 02611566556a..06f2a04c2729 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotClientDiagnostics, Pipeline, "SnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotClientDiagnostics, Pipeline, "SnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotClientDiagnostics, Pipeline, "SnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotClientDiagnostics, Pipeline, "SnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotData.cs index 44c93211fdc9..0faeb55e5702 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.Compute /// public partial class SnapshotData : TrackedResourceData { - /// Initializes a new instance of SnapshotData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public SnapshotData(AzureLocation location) : base(location) { } - /// Initializes a new instance of SnapshotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -59,7 +62,8 @@ public SnapshotData(AzureLocation location) : base(location) /// Percentage complete for the background copy when a resource is created via the CopyStart operation. /// Indicates the error details if the background copy of a resource created via the CopyStart operation fails. /// Additional authentication requirements when exporting or uploading to a disk or snapshot. - internal SnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, DateTimeOffset? timeCreated, SupportedOperatingSystemType? osType, HyperVGeneration? hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, DiskCreationData creationData, int? diskSizeGB, long? diskSizeBytes, DiskState? diskState, string uniqueId, EncryptionSettingsGroup encryptionSettingsGroup, string provisioningState, bool? incremental, string incrementalSnapshotFamilyId, DiskEncryption encryption, NetworkAccessPolicy? networkAccessPolicy, ResourceIdentifier diskAccessId, DiskSecurityProfile securityProfile, bool? supportsHibernation, DiskPublicNetworkAccess? publicNetworkAccess, float? completionPercent, CopyCompletionError copyCompletionError, DataAccessAuthMode? dataAccessAuthMode) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal SnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, DateTimeOffset? timeCreated, SupportedOperatingSystemType? osType, HyperVGeneration? hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, DiskCreationData creationData, int? diskSizeGB, long? diskSizeBytes, DiskState? diskState, string uniqueId, EncryptionSettingsGroup encryptionSettingsGroup, string provisioningState, bool? incremental, string incrementalSnapshotFamilyId, DiskEncryption encryption, NetworkAccessPolicy? networkAccessPolicy, ResourceIdentifier diskAccessId, DiskSecurityProfile securityProfile, bool? supportsHibernation, DiskPublicNetworkAccess? publicNetworkAccess, float? completionPercent, CopyCompletionError copyCompletionError, DataAccessAuthMode? dataAccessAuthMode, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ManagedBy = managedBy; Sku = sku; @@ -87,6 +91,12 @@ internal SnapshotData(ResourceIdentifier id, string name, ResourceType resourceT CompletionPercent = completionPercent; CopyCompletionError = copyCompletionError; DataAccessAuthMode = dataAccessAuthMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SnapshotData() + { } /// Unused. Always Null. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs index a90b47e2bae5..42c13ce41f76 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _sshPublicKeyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sshPublicKeyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), _sshPublicKeyClientDiagnostics, Pipeline, "SshPublicKeyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), _sshPublicKeyClientDiagnostics, Pipeline, "SshPublicKeyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _sshPublicKeyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sshPublicKeyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), _sshPublicKeyClientDiagnostics, Pipeline, "SshPublicKeyCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), _sshPublicKeyClientDiagnostics, Pipeline, "SshPublicKeyCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyData.cs index 924728b5436f..29b8421b0e8f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,13 +18,16 @@ namespace Azure.ResourceManager.Compute /// public partial class SshPublicKeyData : TrackedResourceData { - /// Initializes a new instance of SshPublicKeyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public SshPublicKeyData(AzureLocation location) : base(location) { } - /// Initializes a new instance of SshPublicKeyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,9 +35,16 @@ public SshPublicKeyData(AzureLocation location) : base(location) /// The tags. /// The location. /// SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. - internal SshPublicKeyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string publicKey) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal SshPublicKeyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string publicKey, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { PublicKey = publicKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SshPublicKeyData() + { } /// SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs index f092e33ca4a7..7cd6703bb037 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -258,7 +258,7 @@ public virtual Pageable GetAll(string filter = null, Get { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs index 753e6b88cad7..45909ae607d2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineData(AzureLocation location) : base(location) { @@ -28,7 +31,7 @@ public VirtualMachineData(AzureLocation location) : base(location) Zones = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -66,7 +69,8 @@ public VirtualMachineData(AzureLocation location) : base(location) /// Specifies information about the capacity reservation that is used to allocate virtual machine. Minimum api-version: 2021-04-01. /// Specifies the gallery applications that should be made available to the VM/VMSS. /// Specifies the time at which the Virtual Machine resource was created. Minimum api-version: 2021-11-01. - internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputePlan plan, IReadOnlyList resources, ManagedServiceIdentity identity, IList zones, ExtendedLocation extendedLocation, VirtualMachineHardwareProfile hardwareProfile, VirtualMachineStorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, VirtualMachineOSProfile osProfile, VirtualMachineNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, WritableSubResource virtualMachineScaleSet, WritableSubResource proximityPlacementGroup, VirtualMachinePriorityType? priority, VirtualMachineEvictionPolicyType? evictionPolicy, BillingProfile billingProfile, WritableSubResource host, WritableSubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, DateTimeOffset? timeCreated) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputePlan plan, IReadOnlyList resources, ManagedServiceIdentity identity, IList zones, ExtendedLocation extendedLocation, VirtualMachineHardwareProfile hardwareProfile, VirtualMachineStorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, VirtualMachineOSProfile osProfile, VirtualMachineNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, WritableSubResource virtualMachineScaleSet, WritableSubResource proximityPlacementGroup, VirtualMachinePriorityType? priority, VirtualMachineEvictionPolicyType? evictionPolicy, BillingProfile billingProfile, WritableSubResource host, WritableSubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Plan = plan; Resources = resources; @@ -99,6 +103,12 @@ internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType res CapacityReservation = capacityReservation; ApplicationProfile = applicationProfile; TimeCreated = timeCreated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineData() + { } /// Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs index 46408e00bf74..ebea672856cb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionCollection.cs @@ -230,7 +230,7 @@ public virtual Response Get(string vmExtensionN public virtual AsyncPageable GetAllAsync(string expand = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new VirtualMachineExtensionResource(Client, VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(e)), _virtualMachineExtensionClientDiagnostics, Pipeline, "VirtualMachineExtensionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new VirtualMachineExtensionResource(Client, VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(e)), _virtualMachineExtensionClientDiagnostics, Pipeline, "VirtualMachineExtensionCollection.GetAll", "value", null, cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual AsyncPageable GetAllAsync(string public virtual Pageable GetAll(string expand = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new VirtualMachineExtensionResource(Client, VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(e)), _virtualMachineExtensionClientDiagnostics, Pipeline, "VirtualMachineExtensionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new VirtualMachineExtensionResource(Client, VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(e)), _virtualMachineExtensionClientDiagnostics, Pipeline, "VirtualMachineExtensionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionData.cs index d120332eb34b..4072dcb5e094 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineExtensionData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineExtensionData(AzureLocation location) : base(location) { ProvisionAfterExtensions = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -46,7 +49,8 @@ public VirtualMachineExtensionData(AzureLocation location) : base(location) /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. /// The extensions protected settings that are passed by reference, and consumed from key vault. /// Collection of extension names after which this extension needs to be provisioned. - internal VirtualMachineExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, VirtualMachineExtensionInstanceView instanceView, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, IList provisionAfterExtensions) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, VirtualMachineExtensionInstanceView instanceView, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, IList provisionAfterExtensions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ForceUpdateTag = forceUpdateTag; Publisher = publisher; @@ -61,6 +65,12 @@ internal VirtualMachineExtensionData(ResourceIdentifier id, string name, Resourc SuppressFailures = suppressFailures; KeyVaultProtectedSettings = keyVaultProtectedSettings; ProvisionAfterExtensions = provisionAfterExtensions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineExtensionData() + { } /// How the extension handler should be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs index 073b32a79fc0..4ad22dadf258 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageCollection.cs @@ -158,7 +158,7 @@ public virtual Response Get(string type, s public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineExtensionImageRestClient.CreateListTypesRequest(Id.SubscriptionId, new AzureLocation(_location), _publisherName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); } /// @@ -179,7 +179,7 @@ public virtual AsyncPageable GetAllAsync(C public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineExtensionImageRestClient.CreateListTypesRequest(Id.SubscriptionId, new AzureLocation(_location), _publisherName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); } /// @@ -208,7 +208,7 @@ public virtual AsyncPageable GetAllAsync(s Argument.AssertNotNullOrEmpty(type, nameof(type)); HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineExtensionImageRestClient.CreateListVersionsRequest(Id.SubscriptionId, new AzureLocation(_location), _publisherName, type, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); } /// @@ -237,7 +237,7 @@ public virtual Pageable GetAll(string type Argument.AssertNotNullOrEmpty(type, nameof(type)); HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineExtensionImageRestClient.CreateListVersionsRequest(Id.SubscriptionId, new AzureLocation(_location), _publisherName, type, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new VirtualMachineExtensionImageResource(Client, VirtualMachineExtensionImageData.DeserializeVirtualMachineExtensionImageData(e)), _virtualMachineExtensionImageClientDiagnostics, Pipeline, "VirtualMachineExtensionImageCollection.GetAll", "", null, cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageData.cs index f47753b99d06..728d690e0949 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,13 +18,16 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineExtensionImageData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineExtensionImageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineExtensionImageData(AzureLocation location) : base(location) { } - /// Initializes a new instance of VirtualMachineExtensionImageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +39,20 @@ public VirtualMachineExtensionImageData(AzureLocation location) : base(location) /// The schema defined by publisher, where extension consumers should provide settings in a matching schema. /// Whether the extension can be used on xRP VMScaleSets. By default existing extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the extension is only enabled for CRP VMs but not VMSS. /// Whether the handler can support multiple extensions. - internal VirtualMachineExtensionImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string operatingSystem, string computeRole, string handlerSchema, bool? virtualMachineScaleSetEnabled, bool? supportsMultipleExtensions) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineExtensionImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string operatingSystem, string computeRole, string handlerSchema, bool? virtualMachineScaleSetEnabled, bool? supportsMultipleExtensions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { OperatingSystem = operatingSystem; ComputeRole = computeRole; HandlerSchema = handlerSchema; VirtualMachineScaleSetEnabled = virtualMachineScaleSetEnabled; SupportsMultipleExtensions = supportsMultipleExtensions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineExtensionImageData() + { } /// The operating system this extension supports. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs index f0385126d80e..0078210a488b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRunCommandRestClient.CreateListByVirtualMachineRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRunCommandRestClient.CreateListByVirtualMachineNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineRunCommandClientDiagnostics, Pipeline, "VirtualMachineRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineRunCommandClientDiagnostics, Pipeline, "VirtualMachineRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(string expand = { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRunCommandRestClient.CreateListByVirtualMachineRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRunCommandRestClient.CreateListByVirtualMachineNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineRunCommandClientDiagnostics, Pipeline, "VirtualMachineRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineRunCommandClientDiagnostics, Pipeline, "VirtualMachineRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandData.cs index 9c8f5e2a1430..812b348c23a6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineRunCommandData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineRunCommandData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineRunCommandData(AzureLocation location) : base(location) { @@ -27,7 +30,7 @@ public VirtualMachineRunCommandData(AzureLocation location) : base(location) ProtectedParameters = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineRunCommandData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +51,8 @@ public VirtualMachineRunCommandData(AzureLocation location) : base(location) /// The provisioning state, which only appears in the response. If treatFailureAsDeploymentFailure set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If treatFailureAsDeploymentFailure set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. /// The virtual machine run command instance view. /// Optional. If set to true, any failure in the script will fail the deployment and ProvisioningState will be marked as Failed. If set to false, ProvisioningState would only reflect whether the run command was run or not by the extensions platform, it would not indicate whether script failed in case of script failures. See instance view of run command in case of script failures to see executionMessage, output, error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. - internal VirtualMachineRunCommandData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, VirtualMachineRunCommandScriptSource source, IList parameters, IList protectedParameters, bool? asyncExecution, string runAsUser, string runAsPassword, int? timeoutInSeconds, Uri outputBlobUri, Uri errorBlobUri, RunCommandManagedIdentity outputBlobManagedIdentity, RunCommandManagedIdentity errorBlobManagedIdentity, string provisioningState, VirtualMachineRunCommandInstanceView instanceView, bool? treatFailureAsDeploymentFailure) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineRunCommandData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, VirtualMachineRunCommandScriptSource source, IList parameters, IList protectedParameters, bool? asyncExecution, string runAsUser, string runAsPassword, int? timeoutInSeconds, Uri outputBlobUri, Uri errorBlobUri, RunCommandManagedIdentity outputBlobManagedIdentity, RunCommandManagedIdentity errorBlobManagedIdentity, string provisioningState, VirtualMachineRunCommandInstanceView instanceView, bool? treatFailureAsDeploymentFailure, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Source = source; Parameters = parameters; @@ -64,6 +68,12 @@ internal VirtualMachineRunCommandData(ResourceIdentifier id, string name, Resour ProvisioningState = provisioningState; InstanceView = instanceView; TreatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineRunCommandData() + { } /// The source of the run command script. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs index a7f284973557..bc5e844fe45c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), _virtualMachineScaleSetClientDiagnostics, Pipeline, "VirtualMachineScaleSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), _virtualMachineScaleSetClientDiagnostics, Pipeline, "VirtualMachineScaleSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), _virtualMachineScaleSetClientDiagnostics, Pipeline, "VirtualMachineScaleSetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), _virtualMachineScaleSetClientDiagnostics, Pipeline, "VirtualMachineScaleSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs index 0e05585a6146..09df5a52e96c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs @@ -20,14 +20,17 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineScaleSetData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineScaleSetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineScaleSetData(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -58,7 +61,8 @@ public VirtualMachineScaleSetData(AzureLocation location) : base(location) /// Specifies the desired targets for mixing Spot and Regular priority VMs within the same VMSS Flex instance. /// Specifies the time at which the Virtual Machine Scale Set resource was created. Minimum api-version: 2021-11-01. /// Optional property which must either be set to True or omitted. - internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, ComputePlan plan, ManagedServiceIdentity identity, IList zones, ExtendedLocation extendedLocation, VirtualMachineScaleSetUpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVmProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVms, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, WritableSubResource proximityPlacementGroup, WritableSubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, OrchestrationMode? orchestrationMode, SpotRestorePolicy spotRestorePolicy, VirtualMachineScaleSetPriorityMixPolicy priorityMixPolicy, DateTimeOffset? timeCreated, bool? isMaximumCapacityConstrained) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ComputeSku sku, ComputePlan plan, ManagedServiceIdentity identity, IList zones, ExtendedLocation extendedLocation, VirtualMachineScaleSetUpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVmProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVms, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, WritableSubResource proximityPlacementGroup, WritableSubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, OrchestrationMode? orchestrationMode, SpotRestorePolicy spotRestorePolicy, VirtualMachineScaleSetPriorityMixPolicy priorityMixPolicy, DateTimeOffset? timeCreated, bool? isMaximumCapacityConstrained, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Plan = plan; @@ -84,6 +88,12 @@ internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, Resource PriorityMixPolicy = priorityMixPolicy; TimeCreated = timeCreated; IsMaximumCapacityConstrained = isMaximumCapacityConstrained; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetData() + { } /// The virtual machine scale set sku. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs index dd9cdc3f88aa..283a1d9513bc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetExtensionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetExtensionResource(Client, VirtualMachineScaleSetExtensionData.DeserializeVirtualMachineScaleSetExtensionData(e)), _virtualMachineScaleSetExtensionClientDiagnostics, Pipeline, "VirtualMachineScaleSetExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetExtensionResource(Client, VirtualMachineScaleSetExtensionData.DeserializeVirtualMachineScaleSetExtensionData(e)), _virtualMachineScaleSetExtensionClientDiagnostics, Pipeline, "VirtualMachineScaleSetExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetExtensionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetExtensionResource(Client, VirtualMachineScaleSetExtensionData.DeserializeVirtualMachineScaleSetExtensionData(e)), _virtualMachineScaleSetExtensionClientDiagnostics, Pipeline, "VirtualMachineScaleSetExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetExtensionResource(Client, VirtualMachineScaleSetExtensionData.DeserializeVirtualMachineScaleSetExtensionData(e)), _virtualMachineScaleSetExtensionClientDiagnostics, Pipeline, "VirtualMachineScaleSetExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs index 11c78bd6adba..e63b374fa272 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineScaleSetExtensionData : ResourceData { - /// Initializes a new instance of VirtualMachineScaleSetExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetExtensionData() { ProvisionAfterExtensions = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +45,8 @@ public VirtualMachineScaleSetExtensionData() /// Collection of extension names after which this extension needs to be provisioned. /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. /// The extensions protected settings that are passed by reference, and consumed from key vault. - internal VirtualMachineScaleSetExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, IList provisionAfterExtensions, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, IList provisionAfterExtensions, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ForceUpdateTag = forceUpdateTag; Publisher = publisher; @@ -56,6 +60,7 @@ internal VirtualMachineScaleSetExtensionData(ResourceIdentifier id, string name, ProvisionAfterExtensions = provisionAfterExtensions; SuppressFailures = suppressFailures; KeyVaultProtectedSettings = keyVaultProtectedSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeData.cs index 6f331752fc17..4603b3989366 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Compute.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineScaleSetRollingUpgradeData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineScaleSetRollingUpgradeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineScaleSetRollingUpgradeData(AzureLocation location) : base(location) { } - /// Initializes a new instance of VirtualMachineScaleSetRollingUpgradeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +39,19 @@ public VirtualMachineScaleSetRollingUpgradeData(AzureLocation location) : base(l /// Information about the current running state of the overall upgrade. /// Information about the number of virtual machine instances in each upgrade state. /// Error details for this upgrade, if there are any. - internal VirtualMachineScaleSetRollingUpgradeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RollingUpgradePolicy policy, RollingUpgradeRunningStatus runningStatus, RollingUpgradeProgressInfo progress, ComputeApiError error) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetRollingUpgradeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RollingUpgradePolicy policy, RollingUpgradeRunningStatus runningStatus, RollingUpgradeProgressInfo progress, ComputeApiError error, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Policy = policy; RunningStatus = runningStatus; Progress = progress; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetRollingUpgradeData() + { } /// The rolling upgrade policies applied for this upgrade. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs index cd77146ea202..5bd94acb60a0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetVmVirtualMachineScaleSetVmsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, select, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetVmVirtualMachineScaleSetVmsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, select, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetVmResource(Client, VirtualMachineScaleSetVmData.DeserializeVirtualMachineScaleSetVmData(e)), _virtualMachineScaleSetVmVirtualMachineScaleSetVmsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetVmResource(Client, VirtualMachineScaleSetVmData.DeserializeVirtualMachineScaleSetVmData(e)), _virtualMachineScaleSetVmVirtualMachineScaleSetVmsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -259,7 +259,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetVmVirtualMachineScaleSetVmsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, select, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetVmVirtualMachineScaleSetVmsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, select, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetVmResource(Client, VirtualMachineScaleSetVmData.DeserializeVirtualMachineScaleSetVmData(e)), _virtualMachineScaleSetVmVirtualMachineScaleSetVmsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetVmResource(Client, VirtualMachineScaleSetVmData.DeserializeVirtualMachineScaleSetVmData(e)), _virtualMachineScaleSetVmVirtualMachineScaleSetVmsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmData.cs index 4ff2d03ae1d2..9e769d2fddb3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineScaleSetVmData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineScaleSetVmData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineScaleSetVmData(AzureLocation location) : base(location) { @@ -28,7 +31,7 @@ public VirtualMachineScaleSetVmData(AzureLocation location) : base(location) Zones = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetVmData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -59,7 +62,8 @@ public VirtualMachineScaleSetVmData(AzureLocation location) : base(location) /// Specifies the protection policy of the virtual machine. /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. /// Specifies the time at which the Virtual Machine resource was created.<br><br>Minimum api-version: 2021-11-01. - internal VirtualMachineScaleSetVmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string instanceId, ComputeSku sku, ComputePlan plan, IReadOnlyList resources, IReadOnlyList zones, ManagedServiceIdentity identity, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVmInstanceView instanceView, VirtualMachineHardwareProfile hardwareProfile, VirtualMachineStorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, VirtualMachineOSProfile osProfile, SecurityProfile securityProfile, VirtualMachineNetworkProfile networkProfile, VirtualMachineScaleSetVmNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVmProtectionPolicy protectionPolicy, string userData, DateTimeOffset? timeCreated) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string instanceId, ComputeSku sku, ComputePlan plan, IReadOnlyList resources, IReadOnlyList zones, ManagedServiceIdentity identity, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVmInstanceView instanceView, VirtualMachineHardwareProfile hardwareProfile, VirtualMachineStorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, VirtualMachineOSProfile osProfile, SecurityProfile securityProfile, VirtualMachineNetworkProfile networkProfile, VirtualMachineScaleSetVmNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVmProtectionPolicy protectionPolicy, string userData, DateTimeOffset? timeCreated, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { InstanceId = instanceId; Sku = sku; @@ -85,6 +89,12 @@ internal VirtualMachineScaleSetVmData(ResourceIdentifier id, string name, Resour ProtectionPolicy = protectionPolicy; UserData = userData; TimeCreated = timeCreated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineScaleSetVmData() + { } /// The virtual machine instance ID. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs index f822c5bfea62..0cb289502cb8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionCollection.cs @@ -230,7 +230,7 @@ public virtual Response Get(string vm public virtual AsyncPageable GetAllAsync(string expand = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new VirtualMachineScaleSetVmExtensionResource(Client, VirtualMachineScaleSetVmExtensionData.DeserializeVirtualMachineScaleSetVmExtensionData(e)), _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmExtensionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new VirtualMachineScaleSetVmExtensionResource(Client, VirtualMachineScaleSetVmExtensionData.DeserializeVirtualMachineScaleSetVmExtensionData(e)), _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmExtensionCollection.GetAll", "value", null, cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual AsyncPageable GetAllAs public virtual Pageable GetAll(string expand = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new VirtualMachineScaleSetVmExtensionResource(Client, VirtualMachineScaleSetVmExtensionData.DeserializeVirtualMachineScaleSetVmExtensionData(e)), _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmExtensionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new VirtualMachineScaleSetVmExtensionResource(Client, VirtualMachineScaleSetVmExtensionData.DeserializeVirtualMachineScaleSetVmExtensionData(e)), _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVmExtensionsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmExtensionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionData.cs index d481b35d67b6..74cfe2d0d88f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.Compute /// public partial class VirtualMachineScaleSetVmExtensionData : ResourceData { - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachineScaleSetVmExtensionData() { ProvisionAfterExtensions = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineScaleSetVmExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +47,8 @@ public VirtualMachineScaleSetVmExtensionData() /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. /// The extensions protected settings that are passed by reference, and consumed from key vault. /// Collection of extension names after which this extension needs to be provisioned. - internal VirtualMachineScaleSetVmExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, VirtualMachineExtensionInstanceView instanceView, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, IList provisionAfterExtensions) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineScaleSetVmExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string forceUpdateTag, string publisher, string extensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, bool? enableAutomaticUpgrade, BinaryData settings, BinaryData protectedSettings, string provisioningState, VirtualMachineExtensionInstanceView instanceView, bool? suppressFailures, KeyVaultSecretReference keyVaultProtectedSettings, IList provisionAfterExtensions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; ForceUpdateTag = forceUpdateTag; @@ -60,6 +64,7 @@ internal VirtualMachineScaleSetVmExtensionData(ResourceIdentifier id, string nam SuppressFailures = suppressFailures; KeyVaultProtectedSettings = keyVaultProtectedSettings; ProvisionAfterExtensions = provisionAfterExtensions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The location of the extension. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs index a26155befefe..ace2fa893ee2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllA { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetVmRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetVmRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetVmRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineScaleSetVmRunCommandResource(Client, VirtualMachineRunCommandData.DeserializeVirtualMachineRunCommandData(e)), _virtualMachineScaleSetVmRunCommandVirtualMachineScaleSetVmRunCommandsClientDiagnostics, Pipeline, "VirtualMachineScaleSetVmRunCommandCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ArmConfidentialLedgerModelFactory.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ArmConfidentialLedgerModelFactory.cs index 8337780345b5..345396923c7c 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ArmConfidentialLedgerModelFactory.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ArmConfidentialLedgerModelFactory.cs @@ -17,17 +17,17 @@ namespace Azure.ResourceManager.ConfidentialLedger.Models /// Model factory for models. public static partial class ArmConfidentialLedgerModelFactory { - /// Initializes a new instance of ConfidentialLedgerNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. /// A new instance for mocking. public static ConfidentialLedgerNameAvailabilityResult ConfidentialLedgerNameAvailabilityResult(bool? isNameAvailable = null, ConfidentialLedgerNameUnavailableReason? reason = null, string message = null) { - return new ConfidentialLedgerNameAvailabilityResult(isNameAvailable, reason, message); + return new ConfidentialLedgerNameAvailabilityResult(isNameAvailable, reason, message, default); } - /// Initializes a new instance of ConfidentialLedgerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,10 +40,10 @@ public static ConfidentialLedgerData ConfidentialLedgerData(ResourceIdentifier i { tags ??= new Dictionary(); - return new ConfidentialLedgerData(id, name, resourceType, systemData, tags, location, properties); + return new ConfidentialLedgerData(id, name, resourceType, systemData, tags, location, properties, default); } - /// Initializes a new instance of ConfidentialLedgerProperties. + /// Initializes a new instance of . /// Unique name for the Confidential Ledger. /// Endpoint for calling Ledger Service. /// Endpoint for accessing network identity. @@ -59,10 +59,10 @@ public static ConfidentialLedgerProperties ConfidentialLedgerProperties(string l aadBasedSecurityPrincipals ??= new List(); certBasedSecurityPrincipals ??= new List(); - return new ConfidentialLedgerProperties(ledgerName, ledgerUri, identityServiceUri, ledgerInternalNamespace, runningState, ledgerType, provisioningState, aadBasedSecurityPrincipals?.ToList(), certBasedSecurityPrincipals?.ToList()); + return new ConfidentialLedgerProperties(ledgerName, ledgerUri, identityServiceUri, ledgerInternalNamespace, runningState, ledgerType, provisioningState, aadBasedSecurityPrincipals?.ToList(), certBasedSecurityPrincipals?.ToList(), default); } - /// Initializes a new instance of ManagedCcfData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -75,10 +75,10 @@ public static ManagedCcfData ManagedCcfData(ResourceIdentifier id = null, string { tags ??= new Dictionary(); - return new ManagedCcfData(id, name, resourceType, systemData, tags, location, properties); + return new ManagedCcfData(id, name, resourceType, systemData, tags, location, properties, default); } - /// Initializes a new instance of ManagedCcfProperties. + /// Initializes a new instance of . /// Unique name for the Managed CCF. /// Endpoint for calling Managed CCF Service. /// Endpoint for accessing network identity. @@ -91,7 +91,7 @@ public static ManagedCcfProperties ManagedCcfProperties(string appName = null, U { memberIdentityCertificates ??= new List(); - return new ManagedCcfProperties(appName, appUri, identityServiceUri, memberIdentityCertificates?.ToList(), deploymentType, provisioningState, nodeCount); + return new ManagedCcfProperties(appName, appUri, identityServiceUri, memberIdentityCertificates?.ToList(), deploymentType, provisioningState, nodeCount, default); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs index ecff56c897ee..f2241f41f2aa 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _confidentialLedgerLedgerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _confidentialLedgerLedgerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), _confidentialLedgerLedgerClientDiagnostics, Pipeline, "ConfidentialLedgerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), _confidentialLedgerLedgerClientDiagnostics, Pipeline, "ConfidentialLedgerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _confidentialLedgerLedgerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _confidentialLedgerLedgerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), _confidentialLedgerLedgerClientDiagnostics, Pipeline, "ConfidentialLedgerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), _confidentialLedgerLedgerClientDiagnostics, Pipeline, "ConfidentialLedgerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs index 377a37e5417a..d31a8fe16a0c 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConfidentialLedger.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ConfidentialLedger /// public partial class ConfidentialLedgerData : TrackedResourceData { - /// Initializes a new instance of ConfidentialLedgerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ConfidentialLedgerData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ConfidentialLedgerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +36,16 @@ public ConfidentialLedgerData(AzureLocation location) : base(location) /// The tags. /// The location. /// Properties of Confidential Ledger Resource. - internal ConfidentialLedgerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfidentialLedgerProperties properties) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfidentialLedgerProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConfidentialLedgerData() + { } /// Properties of Confidential Ledger Resource. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index d0c451dbd52c..1d9b738225f6 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -134,7 +134,7 @@ public virtual AsyncPageable GetConfidentialLedgersA { HttpMessage FirstPageRequest(int? pageSizeHint) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); } /// @@ -157,7 +157,7 @@ public virtual Pageable GetConfidentialLedgers(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); } /// @@ -180,7 +180,7 @@ public virtual AsyncPageable GetManagedCcfsAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCcfs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCcfs", "value", "nextLink", cancellationToken); } /// @@ -203,7 +203,7 @@ public virtual Pageable GetManagedCcfs(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCcfs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCcfs", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs index b6e6008c9cfc..a04dfd040889 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _managedCcfManagedCcfRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedCcfManagedCcfRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), _managedCcfManagedCcfClientDiagnostics, Pipeline, "ManagedCcfCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), _managedCcfManagedCcfClientDiagnostics, Pipeline, "ManagedCcfCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string filter = null, Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _managedCcfManagedCcfRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedCcfManagedCcfRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), _managedCcfManagedCcfClientDiagnostics, Pipeline, "ManagedCcfCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), _managedCcfManagedCcfClientDiagnostics, Pipeline, "ManagedCcfCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfData.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfData.cs index 1de163775fb0..ed5414891369 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfData.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConfidentialLedger.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ConfidentialLedger /// public partial class ManagedCcfData : TrackedResourceData { - /// Initializes a new instance of ManagedCcfData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ManagedCcfData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ManagedCcfData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +36,16 @@ public ManagedCcfData(AzureLocation location) : base(location) /// The tags. /// The location. /// Properties of Managed CCF Resource. - internal ManagedCcfData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedCcfProperties properties) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ManagedCcfData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedCcfProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedCcfData() + { } /// Properties of Managed CCF Resource. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.Serialization.cs index 02ea7a7bc662..cd116b7bbe82 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class AadBasedSecurityPrincipal : IUtf8JsonSerializable + public partial class AadBasedSecurityPrincipal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PrincipalId)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ledgerRoleName"u8); writer.WriteStringValue(LedgerRoleName.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AadBasedSecurityPrincipal DeserializeAadBasedSecurityPrincipal(JsonElement element) + internal static AadBasedSecurityPrincipal DeserializeAadBasedSecurityPrincipal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static AadBasedSecurityPrincipal DeserializeAadBasedSecurityPrincipal(J Optional principalId = default; Optional tenantId = default; Optional ledgerRoleName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("principalId"u8)) @@ -72,8 +94,61 @@ internal static AadBasedSecurityPrincipal DeserializeAadBasedSecurityPrincipal(J ledgerRoleName = new ConfidentialLedgerRoleName(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AadBasedSecurityPrincipal(Optional.ToNullable(principalId), Optional.ToNullable(tenantId), Optional.ToNullable(ledgerRoleName), serializedAdditionalRawData); + } + + AadBasedSecurityPrincipal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAadBasedSecurityPrincipal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AadBasedSecurityPrincipal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAadBasedSecurityPrincipal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AadBasedSecurityPrincipal model) + { + if (model is null) + { + return null; } - return new AadBasedSecurityPrincipal(Optional.ToNullable(principalId), Optional.ToNullable(tenantId), Optional.ToNullable(ledgerRoleName)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AadBasedSecurityPrincipal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAadBasedSecurityPrincipal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.cs index 48313246ee97..1faf56cad5a0 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/AadBasedSecurityPrincipal.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ConfidentialLedger.Models { /// AAD based security principal with associated Ledger RoleName. public partial class AadBasedSecurityPrincipal { - /// Initializes a new instance of AadBasedSecurityPrincipal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AadBasedSecurityPrincipal() { } - /// Initializes a new instance of AadBasedSecurityPrincipal. + /// Initializes a new instance of . /// UUID/GUID based Principal Id of the Security Principal. /// UUID/GUID based Tenant Id of the Security Principal. /// LedgerRole associated with the Security Principal of Ledger. - internal AadBasedSecurityPrincipal(Guid? principalId, Guid? tenantId, ConfidentialLedgerRoleName? ledgerRoleName) + /// Keeps track of any properties unknown to the library. + internal AadBasedSecurityPrincipal(Guid? principalId, Guid? tenantId, ConfidentialLedgerRoleName? ledgerRoleName, Dictionary serializedAdditionalRawData) { PrincipalId = principalId; TenantId = tenantId; LedgerRoleName = ledgerRoleName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// UUID/GUID based Principal Id of the Security Principal. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.Serialization.cs index 56991586f9d6..35b527eac748 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class CertBasedSecurityPrincipal : IUtf8JsonSerializable + public partial class CertBasedSecurityPrincipal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cert)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ledgerRoleName"u8); writer.WriteStringValue(LedgerRoleName.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CertBasedSecurityPrincipal DeserializeCertBasedSecurityPrincipal(JsonElement element) + internal static CertBasedSecurityPrincipal DeserializeCertBasedSecurityPrincipal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cert = default; Optional ledgerRoleName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cert"u8)) @@ -52,8 +75,61 @@ internal static CertBasedSecurityPrincipal DeserializeCertBasedSecurityPrincipal ledgerRoleName = new ConfidentialLedgerRoleName(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CertBasedSecurityPrincipal(cert.Value, Optional.ToNullable(ledgerRoleName), serializedAdditionalRawData); + } + + CertBasedSecurityPrincipal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCertBasedSecurityPrincipal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CertBasedSecurityPrincipal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCertBasedSecurityPrincipal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CertBasedSecurityPrincipal model) + { + if (model is null) + { + return null; } - return new CertBasedSecurityPrincipal(cert.Value, Optional.ToNullable(ledgerRoleName)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CertBasedSecurityPrincipal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCertBasedSecurityPrincipal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.cs index 3a6c45395c57..10b905b01300 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/CertBasedSecurityPrincipal.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConfidentialLedger.Models { /// Cert based security principal with Ledger RoleName. public partial class CertBasedSecurityPrincipal { - /// Initializes a new instance of CertBasedSecurityPrincipal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CertBasedSecurityPrincipal() { } - /// Initializes a new instance of CertBasedSecurityPrincipal. + /// Initializes a new instance of . /// Public key of the user cert (.pem or .cer). /// LedgerRole associated with the Security Principal of Ledger. - internal CertBasedSecurityPrincipal(string cert, ConfidentialLedgerRoleName? ledgerRoleName) + /// Keeps track of any properties unknown to the library. + internal CertBasedSecurityPrincipal(string cert, ConfidentialLedgerRoleName? ledgerRoleName, Dictionary serializedAdditionalRawData) { Cert = cert; LedgerRoleName = ledgerRoleName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Public key of the user cert (.pem or .cer). diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs index ddc24dc6a2ee..943dba215506 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConfidentialLedger.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConfidentialLedger { - public partial class ConfidentialLedgerData : IUtf8JsonSerializable + public partial class ConfidentialLedgerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonElement element) + internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -106,8 +135,61 @@ internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfidentialLedgerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, serializedAdditionalRawData); + } + + ConfidentialLedgerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerData(Response response) + { + if (response is null) + { + return null; } - return new ConfidentialLedgerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.Serialization.cs index 3f86d4dcc585..4eaf706cc6a3 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class ConfidentialLedgerDeploymentType : IUtf8JsonSerializable + public partial class ConfidentialLedgerDeploymentType : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LanguageRuntime)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("appSourceUri"u8); writer.WriteStringValue(AppSourceUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfidentialLedgerDeploymentType DeserializeConfidentialLedgerDeploymentType(JsonElement element) + internal static ConfidentialLedgerDeploymentType DeserializeConfidentialLedgerDeploymentType(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional languageRuntime = default; Optional appSourceUri = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("languageRuntime"u8)) @@ -57,8 +79,61 @@ internal static ConfidentialLedgerDeploymentType DeserializeConfidentialLedgerDe appSourceUri = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfidentialLedgerDeploymentType(Optional.ToNullable(languageRuntime), appSourceUri.Value, serializedAdditionalRawData); + } + + ConfidentialLedgerDeploymentType IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerDeploymentType(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerDeploymentType IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerDeploymentType(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerDeploymentType model) + { + if (model is null) + { + return null; } - return new ConfidentialLedgerDeploymentType(Optional.ToNullable(languageRuntime), appSourceUri.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerDeploymentType(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerDeploymentType(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.cs index 6ab0c2b78658..1031c934a4f4 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerDeploymentType.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ConfidentialLedger.Models { /// Object representing DeploymentType for Managed CCF. public partial class ConfidentialLedgerDeploymentType { - /// Initializes a new instance of ConfidentialLedgerDeploymentType. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfidentialLedgerDeploymentType() { } - /// Initializes a new instance of ConfidentialLedgerDeploymentType. + /// Initializes a new instance of . /// Unique name for the Managed CCF. /// Source Uri containing ManagedCCF code. - internal ConfidentialLedgerDeploymentType(ConfidentialLedgerLanguageRuntime? languageRuntime, Uri appSourceUri) + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerDeploymentType(ConfidentialLedgerLanguageRuntime? languageRuntime, Uri appSourceUri, Dictionary serializedAdditionalRawData) { LanguageRuntime = languageRuntime; AppSourceUri = appSourceUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique name for the Managed CCF. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.Serialization.cs index d5d4cb337142..77c5aa7e7cec 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConfidentialLedger; namespace Azure.ResourceManager.ConfidentialLedger.Models { - internal partial class ConfidentialLedgerList + internal partial class ConfidentialLedgerList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfidentialLedgerList DeserializeConfidentialLedgerList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfidentialLedgerList DeserializeConfidentialLedgerList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ConfidentialLedgerList DeserializeConfidentialLedgerList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfidentialLedgerList(Optional.ToList(value), nextLink.Value); + return new ConfidentialLedgerList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConfidentialLedgerList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.cs index 445e0a3fb752..52128720790f 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConfidentialLedger; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ConfidentialLedger.Models /// Object that includes an array of Confidential Ledgers and a possible link for next set. internal partial class ConfidentialLedgerList { - /// Initializes a new instance of ConfidentialLedgerList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfidentialLedgerList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfidentialLedgerList. + /// Initializes a new instance of . /// List of Confidential Ledgers. /// The URL the client should use to fetch the next page (per server side paging). - internal ConfidentialLedgerList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Confidential Ledgers. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.Serialization.cs index e1786952884f..e4f81f1dc41c 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class ConfidentialLedgerMemberIdentityCertificate : IUtf8JsonSerializable + public partial class ConfidentialLedgerMemberIdentityCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Certificate)) { @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(Tags.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfidentialLedgerMemberIdentityCertificate DeserializeConfidentialLedgerMemberIdentityCertificate(JsonElement element) + internal static ConfidentialLedgerMemberIdentityCertificate DeserializeConfidentialLedgerMemberIdentityCertificate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +68,7 @@ internal static ConfidentialLedgerMemberIdentityCertificate DeserializeConfident Optional certificate = default; Optional encryptionkey = default; Optional tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificate"u8)) @@ -68,8 +90,61 @@ internal static ConfidentialLedgerMemberIdentityCertificate DeserializeConfident tags = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfidentialLedgerMemberIdentityCertificate(certificate.Value, encryptionkey.Value, tags.Value); + return new ConfidentialLedgerMemberIdentityCertificate(certificate.Value, encryptionkey.Value, tags.Value, serializedAdditionalRawData); + } + + ConfidentialLedgerMemberIdentityCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerMemberIdentityCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerMemberIdentityCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerMemberIdentityCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerMemberIdentityCertificate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerMemberIdentityCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerMemberIdentityCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.cs index 5a85f8c3338f..d869f7a74145 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerMemberIdentityCertificate.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ConfidentialLedger.Models { /// Object representing MemberIdentityCertificate for Managed CCF. public partial class ConfidentialLedgerMemberIdentityCertificate { - /// Initializes a new instance of ConfidentialLedgerMemberIdentityCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfidentialLedgerMemberIdentityCertificate() { } - /// Initializes a new instance of ConfidentialLedgerMemberIdentityCertificate. + /// Initializes a new instance of . /// Member Identity Certificate. /// Member Identity Certificate Encryption Key. /// Anything. - internal ConfidentialLedgerMemberIdentityCertificate(string certificate, string encryptionkey, BinaryData tags) + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerMemberIdentityCertificate(string certificate, string encryptionkey, BinaryData tags, Dictionary serializedAdditionalRawData) { Certificate = certificate; Encryptionkey = encryptionkey; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Member Identity Certificate. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.Serialization.cs index cd4708b59917..fc160f7e4b75 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class ConfidentialLedgerNameAvailabilityContent : IUtf8JsonSerializable + public partial class ConfidentialLedgerNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConfidentialLedgerNameAvailabilityContent DeserializeConfidentialLedgerNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfidentialLedgerNameAvailabilityContent(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + ConfidentialLedgerNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.cs index 0f1b682c45ce..eb09d7f80779 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ConfidentialLedger.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.ConfidentialLedger.Models /// The check availability request body. public partial class ConfidentialLedgerNameAvailabilityContent { - /// Initializes a new instance of ConfidentialLedgerNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfidentialLedgerNameAvailabilityContent() { } + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerNameAvailabilityContent(string name, ResourceType? resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the resource for which availability needs to be checked. public string Name { get; set; } /// The resource type. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.Serialization.cs index e793f42e4514..13ce896ff293 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class ConfidentialLedgerNameAvailabilityResult + public partial class ConfidentialLedgerNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfidentialLedgerNameAvailabilityResult DeserializeConfidentialLedgerNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfidentialLedgerNameAvailabilityResult DeserializeConfidentialLedgerNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ConfidentialLedgerNameAvailabilityResult DeserializeConfidential Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +90,61 @@ internal static ConfidentialLedgerNameAvailabilityResult DeserializeConfidential message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfidentialLedgerNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new ConfidentialLedgerNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + ConfidentialLedgerNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.cs index b558863da708..d0f7a32b3d21 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConfidentialLedger.Models { /// The check availability result. public partial class ConfidentialLedgerNameAvailabilityResult { - /// Initializes a new instance of ConfidentialLedgerNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfidentialLedgerNameAvailabilityResult() { } - /// Initializes a new instance of ConfidentialLedgerNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. - internal ConfidentialLedgerNameAvailabilityResult(bool? isNameAvailable, ConfidentialLedgerNameUnavailableReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerNameAvailabilityResult(bool? isNameAvailable, ConfidentialLedgerNameUnavailableReason? reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the resource name is available. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.Serialization.cs index e00d854f7963..7504cb5045b0 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class ConfidentialLedgerProperties : IUtf8JsonSerializable + public partial class ConfidentialLedgerProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RunningState)) { @@ -33,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AadBasedSecurityPrincipals) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -43,15 +56,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CertBasedSecurityPrincipals) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfidentialLedgerProperties DeserializeConfidentialLedgerProperties(JsonElement element) + internal static ConfidentialLedgerProperties DeserializeConfidentialLedgerProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +99,7 @@ internal static ConfidentialLedgerProperties DeserializeConfidentialLedgerProper Optional provisioningState = default; Optional> aadBasedSecurityPrincipals = default; Optional> certBasedSecurityPrincipals = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ledgerName"u8)) @@ -150,8 +185,61 @@ internal static ConfidentialLedgerProperties DeserializeConfidentialLedgerProper certBasedSecurityPrincipals = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfidentialLedgerProperties(ledgerName.Value, ledgerUri.Value, identityServiceUri.Value, ledgerInternalNamespace.Value, Optional.ToNullable(runningState), Optional.ToNullable(ledgerType), Optional.ToNullable(provisioningState), Optional.ToList(aadBasedSecurityPrincipals), Optional.ToList(certBasedSecurityPrincipals), serializedAdditionalRawData); + } + + ConfidentialLedgerProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialLedgerProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialLedgerProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialLedgerProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialLedgerProperties model) + { + if (model is null) + { + return null; } - return new ConfidentialLedgerProperties(ledgerName.Value, ledgerUri.Value, identityServiceUri.Value, ledgerInternalNamespace.Value, Optional.ToNullable(runningState), Optional.ToNullable(ledgerType), Optional.ToNullable(provisioningState), Optional.ToList(aadBasedSecurityPrincipals), Optional.ToList(certBasedSecurityPrincipals)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialLedgerProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialLedgerProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.cs index 4634f36242c5..41d2c528fd2a 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerProperties.cs @@ -14,14 +14,17 @@ namespace Azure.ResourceManager.ConfidentialLedger.Models /// Additional Confidential Ledger properties. public partial class ConfidentialLedgerProperties { - /// Initializes a new instance of ConfidentialLedgerProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfidentialLedgerProperties() { AadBasedSecurityPrincipals = new ChangeTrackingList(); CertBasedSecurityPrincipals = new ChangeTrackingList(); } - /// Initializes a new instance of ConfidentialLedgerProperties. + /// Initializes a new instance of . /// Unique name for the Confidential Ledger. /// Endpoint for calling Ledger Service. /// Endpoint for accessing network identity. @@ -31,7 +34,8 @@ public ConfidentialLedgerProperties() /// Provisioning state of Ledger Resource. /// Array of all AAD based Security Principals. /// Array of all cert based Security Principals. - internal ConfidentialLedgerProperties(string ledgerName, Uri ledgerUri, Uri identityServiceUri, string ledgerInternalNamespace, ConfidentialLedgerRunningState? runningState, ConfidentialLedgerType? ledgerType, ConfidentialLedgerProvisioningState? provisioningState, IList aadBasedSecurityPrincipals, IList certBasedSecurityPrincipals) + /// Keeps track of any properties unknown to the library. + internal ConfidentialLedgerProperties(string ledgerName, Uri ledgerUri, Uri identityServiceUri, string ledgerInternalNamespace, ConfidentialLedgerRunningState? runningState, ConfidentialLedgerType? ledgerType, ConfidentialLedgerProvisioningState? provisioningState, IList aadBasedSecurityPrincipals, IList certBasedSecurityPrincipals, Dictionary serializedAdditionalRawData) { LedgerName = ledgerName; LedgerUri = ledgerUri; @@ -42,6 +46,7 @@ internal ConfidentialLedgerProperties(string ledgerName, Uri ledgerUri, Uri iden ProvisioningState = provisioningState; AadBasedSecurityPrincipals = aadBasedSecurityPrincipals; CertBasedSecurityPrincipals = certBasedSecurityPrincipals; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique name for the Confidential Ledger. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfData.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfData.Serialization.cs index e147ac2b5162..75d8c06ce034 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfData.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConfidentialLedger.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConfidentialLedger { - public partial class ManagedCcfData : IUtf8JsonSerializable + public partial class ManagedCcfData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedCcfData DeserializeManagedCcfData(JsonElement element) + internal static ManagedCcfData DeserializeManagedCcfData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static ManagedCcfData DeserializeManagedCcfData(JsonElement element) string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -106,8 +135,61 @@ internal static ManagedCcfData DeserializeManagedCcfData(JsonElement element) systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedCcfData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, serializedAdditionalRawData); + } + + ManagedCcfData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedCcfData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedCcfData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedCcfData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedCcfData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedCcfData(Response response) + { + if (response is null) + { + return null; } - return new ManagedCcfData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedCcfData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.Serialization.cs index 52d72a5bd6d6..aa76cdacec73 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConfidentialLedger; namespace Azure.ResourceManager.ConfidentialLedger.Models { - internal partial class ManagedCcfList + internal partial class ManagedCcfList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedCcfList DeserializeManagedCcfList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedCcfList DeserializeManagedCcfList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ManagedCcfList DeserializeManagedCcfList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedCcfList(Optional.ToList(value), nextLink.Value); + return new ManagedCcfList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ManagedCcfList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedCcfList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedCcfList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedCcfList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedCcfList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedCcfList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedCcfList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.cs index f3af8a4001fe..0c4c32eccd84 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConfidentialLedger; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ConfidentialLedger.Models /// Object that includes an array of Managed CCF and a possible link for next set. internal partial class ManagedCcfList { - /// Initializes a new instance of ManagedCcfList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedCcfList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedCcfList. + /// Initializes a new instance of . /// List of Managed CCF. /// The URL the client should use to fetch the next page (per server side paging). - internal ManagedCcfList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ManagedCcfList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Managed CCF. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.Serialization.cs index 5fa2af177922..66369270a99d 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConfidentialLedger.Models { - public partial class ManagedCcfProperties : IUtf8JsonSerializable + public partial class ManagedCcfProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(MemberIdentityCertificates)) { @@ -23,25 +29,53 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MemberIdentityCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(DeploymentType)) { writer.WritePropertyName("deploymentType"u8); - writer.WriteObjectValue(DeploymentType); + if (DeploymentType is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeploymentType).Serialize(writer, options); + } } if (Optional.IsDefined(NodeCount)) { writer.WritePropertyName("nodeCount"u8); writer.WriteNumberValue(NodeCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedCcfProperties DeserializeManagedCcfProperties(JsonElement element) + internal static ManagedCcfProperties DeserializeManagedCcfProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +87,7 @@ internal static ManagedCcfProperties DeserializeManagedCcfProperties(JsonElement Optional deploymentType = default; Optional provisioningState = default; Optional nodeCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("appName"u8)) @@ -119,8 +154,61 @@ internal static ManagedCcfProperties DeserializeManagedCcfProperties(JsonElement nodeCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedCcfProperties(appName.Value, appUri.Value, identityServiceUri.Value, Optional.ToList(memberIdentityCertificates), deploymentType.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(nodeCount), serializedAdditionalRawData); + } + + ManagedCcfProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedCcfProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedCcfProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedCcfProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedCcfProperties model) + { + if (model is null) + { + return null; } - return new ManagedCcfProperties(appName.Value, appUri.Value, identityServiceUri.Value, Optional.ToList(memberIdentityCertificates), deploymentType.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(nodeCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedCcfProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedCcfProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.cs index a66449a03903..f9e74a33a263 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCcfProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.ConfidentialLedger.Models /// Additional Managed CCF properties. public partial class ManagedCcfProperties { - /// Initializes a new instance of ManagedCcfProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedCcfProperties() { MemberIdentityCertificates = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedCcfProperties. + /// Initializes a new instance of . /// Unique name for the Managed CCF. /// Endpoint for calling Managed CCF Service. /// Endpoint for accessing network identity. @@ -28,7 +31,8 @@ public ManagedCcfProperties() /// Deployment Type of Managed CCF. /// Provisioning state of Ledger Resource. /// Number of CCF nodes in the Managed CCF. - internal ManagedCcfProperties(string appName, Uri appUri, Uri identityServiceUri, IList memberIdentityCertificates, ConfidentialLedgerDeploymentType deploymentType, ConfidentialLedgerProvisioningState? provisioningState, int? nodeCount) + /// Keeps track of any properties unknown to the library. + internal ManagedCcfProperties(string appName, Uri appUri, Uri identityServiceUri, IList memberIdentityCertificates, ConfidentialLedgerDeploymentType deploymentType, ConfidentialLedgerProvisioningState? provisioningState, int? nodeCount, Dictionary serializedAdditionalRawData) { AppName = appName; AppUri = appUri; @@ -37,6 +41,7 @@ internal ManagedCcfProperties(string appName, Uri appUri, Uri identityServiceUri DeploymentType = deploymentType; ProvisioningState = provisioningState; NodeCount = nodeCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique name for the Managed CCF. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs index 41ff9253e8a4..bb4ead7a1e80 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs @@ -51,9 +51,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs index 5a3ec9c0d990..a6ce48bf6428 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs @@ -208,9 +208,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -286,9 +284,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs index 1c786c3c4986..13bc60ac92ec 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs @@ -208,9 +208,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -286,9 +284,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs index 06d54ff5e489..ce6473b58169 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs @@ -725,7 +725,7 @@ public virtual AsyncPageable GetConsortiumMembersAsync(RequestContex { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConsortiumMembersRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConsortiumMembersNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetConsortiumMembers", "members", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetConsortiumMembers", "members", "nextLink", context); } /// @@ -746,7 +746,7 @@ public virtual Pageable GetConsortiumMembers(RequestContext context { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConsortiumMembersRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConsortiumMembersNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetConsortiumMembers", "members", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetConsortiumMembers", "members", "nextLink", context); } /// @@ -767,7 +767,7 @@ public virtual AsyncPageable GetCollectionsAsync(RequestContext cont { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCollectionsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCollectionsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetCollections", "collections", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetCollections", "collections", "nextLink", context); } /// @@ -788,7 +788,7 @@ public virtual Pageable GetCollections(RequestContext context = null { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCollectionsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCollectionsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetCollections", "collections", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetCollections", "collections", "nextLink", context); } /// @@ -812,7 +812,7 @@ public virtual AsyncPageable GetLedgerEntriesAsync(string collection { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLedgerEntriesRequest(collectionId, fromTransactionId, toTransactionId, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLedgerEntriesNextPageRequest(nextLink, collectionId, fromTransactionId, toTransactionId, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetLedgerEntries", "entries", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetLedgerEntries", "entries", "nextLink", context); } /// @@ -836,7 +836,7 @@ public virtual Pageable GetLedgerEntries(string collectionId = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetLedgerEntriesRequest(collectionId, fromTransactionId, toTransactionId, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetLedgerEntriesNextPageRequest(nextLink, collectionId, fromTransactionId, toTransactionId, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetLedgerEntries", "entries", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConfidentialLedgerClient.GetLedgerEntries", "entries", "nextLink", context); } internal HttpMessage CreateGetConstitutionRequest(RequestContext context) diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ArmConfluentModelFactory.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ArmConfluentModelFactory.cs index 1cb837fd266d..06f163950681 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ArmConfluentModelFactory.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ArmConfluentModelFactory.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Confluent.Models /// Model factory for models. public static partial class ArmConfluentModelFactory { - /// Initializes a new instance of ConfluentAgreement. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,10 +32,10 @@ public static partial class ArmConfluentModelFactory /// A new instance for mocking. public static ConfluentAgreement ConfluentAgreement(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string publisher = null, string product = null, string plan = null, string licenseTextLink = null, string privacyPolicyLink = null, DateTimeOffset? retrieveOn = null, string signature = null, bool? isAccepted = null) { - return new ConfluentAgreement(id, name, resourceType, systemData, publisher, product, plan, licenseTextLink, privacyPolicyLink, retrieveOn, signature, isAccepted); + return new ConfluentAgreement(id, name, resourceType, systemData, publisher, product, plan, licenseTextLink, privacyPolicyLink, retrieveOn, signature, isAccepted, default); } - /// Initializes a new instance of ConfluentOrganizationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -53,10 +53,10 @@ public static ConfluentOrganizationData ConfluentOrganizationData(ResourceIdenti { tags ??= new Dictionary(); - return new ConfluentOrganizationData(id, name, resourceType, systemData, tags, location, createdOn, provisioningState, organizationId, ssoUri, offerDetail, userDetail); + return new ConfluentOrganizationData(id, name, resourceType, systemData, tags, location, createdOn, provisioningState, organizationId, ssoUri, offerDetail, userDetail, default); } - /// Initializes a new instance of ConfluentOfferDetail. + /// Initializes a new instance of . /// Publisher Id. /// Offer Id. /// Offer Plan Id. @@ -66,7 +66,7 @@ public static ConfluentOrganizationData ConfluentOrganizationData(ResourceIdenti /// A new instance for mocking. public static ConfluentOfferDetail ConfluentOfferDetail(string publisherId = null, string id = null, string planId = null, string planName = null, string termUnit = null, ConfluentSaaSOfferStatus? status = null) { - return new ConfluentOfferDetail(publisherId, id, planId, planName, termUnit, status); + return new ConfluentOfferDetail(publisherId, id, planId, planName, termUnit, status, default); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs index e5d9a0f49857..1afe597b8c94 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _confluentOrganizationOrganizationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _confluentOrganizationOrganizationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), _confluentOrganizationOrganizationClientDiagnostics, Pipeline, "ConfluentOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), _confluentOrganizationOrganizationClientDiagnostics, Pipeline, "ConfluentOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _confluentOrganizationOrganizationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _confluentOrganizationOrganizationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), _confluentOrganizationOrganizationClientDiagnostics, Pipeline, "ConfluentOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), _confluentOrganizationOrganizationClientDiagnostics, Pipeline, "ConfluentOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationData.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationData.cs index bd5d8c240016..8ed46af289b5 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationData.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.Confluent /// public partial class ConfluentOrganizationData : TrackedResourceData { - /// Initializes a new instance of ConfluentOrganizationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// Confluent offer detail. /// Subscriber detail. @@ -33,7 +36,7 @@ public ConfluentOrganizationData(AzureLocation location, ConfluentOfferDetail of UserDetail = userDetail; } - /// Initializes a new instance of ConfluentOrganizationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -46,7 +49,8 @@ public ConfluentOrganizationData(AzureLocation location, ConfluentOfferDetail of /// SSO url for the Confluent organization. /// Confluent offer detail. /// Subscriber detail. - internal ConfluentOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DateTimeOffset? createdOn, ConfluentProvisionState? provisioningState, Guid? organizationId, Uri ssoUri, ConfluentOfferDetail offerDetail, ConfluentUserDetail userDetail) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ConfluentOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DateTimeOffset? createdOn, ConfluentProvisionState? provisioningState, Guid? organizationId, Uri ssoUri, ConfluentOfferDetail offerDetail, ConfluentUserDetail userDetail, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { CreatedOn = createdOn; ProvisioningState = provisioningState; @@ -54,6 +58,12 @@ internal ConfluentOrganizationData(ResourceIdentifier id, string name, ResourceT SsoUri = ssoUri; OfferDetail = offerDetail; UserDetail = userDetail; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConfluentOrganizationData() + { } /// The creation time of the resource. diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index d4cb9560bd9c..748d8b62ba03 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -173,7 +173,7 @@ public virtual AsyncPageable GetConfluentOrganiza { HttpMessage FirstPageRequest(int? pageSizeHint) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfluentOrganizations", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfluentOrganizations", "value", "nextLink", cancellationToken); } /// @@ -195,7 +195,7 @@ public virtual Pageable GetConfluentOrganizations { HttpMessage FirstPageRequest(int? pageSizeHint) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfluentOrganizations", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfluentOrganizations", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.Serialization.cs index 0992064353b9..55865e60972e 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Confluent.Models { - public partial class ConfluentAgreement : IUtf8JsonSerializable + public partial class ConfluentAgreement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsAccepted.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfluentAgreement DeserializeConfluentAgreement(JsonElement element) + internal static ConfluentAgreement DeserializeConfluentAgreement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +102,7 @@ internal static ConfluentAgreement DeserializeConfluentAgreement(JsonElement ele Optional retrieveDatetime = default; Optional signature = default; Optional accepted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -167,8 +189,61 @@ internal static ConfluentAgreement DeserializeConfluentAgreement(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfluentAgreement(id, name, type, systemData.Value, publisher.Value, product.Value, plan.Value, licenseTextLink.Value, privacyPolicyLink.Value, Optional.ToNullable(retrieveDatetime), signature.Value, Optional.ToNullable(accepted), serializedAdditionalRawData); + } + + ConfluentAgreement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentAgreement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentAgreement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentAgreement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentAgreement model) + { + if (model is null) + { + return null; } - return new ConfluentAgreement(id, name, type, systemData.Value, publisher.Value, product.Value, plan.Value, licenseTextLink.Value, privacyPolicyLink.Value, Optional.ToNullable(retrieveDatetime), signature.Value, Optional.ToNullable(accepted)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentAgreement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentAgreement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.cs index 5769520de71f..0dcf25cc1e09 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreement.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.Confluent.Models /// Agreement Terms definition. public partial class ConfluentAgreement : ResourceData { - /// Initializes a new instance of ConfluentAgreement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfluentAgreement() { } - /// Initializes a new instance of ConfluentAgreement. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,7 +36,8 @@ public ConfluentAgreement() /// Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. /// Terms signature. /// If any version of the terms have been accepted, otherwise false. - internal ConfluentAgreement(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string publisher, string product, string plan, string licenseTextLink, string privacyPolicyLink, DateTimeOffset? retrieveOn, string signature, bool? isAccepted) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConfluentAgreement(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string publisher, string product, string plan, string licenseTextLink, string privacyPolicyLink, DateTimeOffset? retrieveOn, string signature, bool? isAccepted, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Publisher = publisher; Product = product; @@ -42,6 +47,7 @@ internal ConfluentAgreement(ResourceIdentifier id, string name, ResourceType res RetrieveOn = retrieveOn; Signature = signature; IsAccepted = isAccepted; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Publisher identifier string. diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.Serialization.cs index cc588dc189e0..7fee8f43fdfa 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Confluent.Models { - internal partial class ConfluentAgreementListResult + internal partial class ConfluentAgreementListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfluentAgreementListResult DeserializeConfluentAgreementListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfluentAgreementListResult DeserializeConfluentAgreementListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static ConfluentAgreementListResult DeserializeConfluentAgreementListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfluentAgreementListResult(Optional.ToList(value), nextLink.Value); + return new ConfluentAgreementListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConfluentAgreementListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentAgreementListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentAgreementListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentAgreementListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentAgreementListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentAgreementListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentAgreementListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.cs index 5ae6e63f37e1..6f887e40857a 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentAgreementListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Confluent.Models /// Response of a list operation. internal partial class ConfluentAgreementListResult { - /// Initializes a new instance of ConfluentAgreementListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfluentAgreementListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfluentAgreementListResult. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal ConfluentAgreementListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConfluentAgreementListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.Serialization.cs index 875f619d77b4..df941b7e46c7 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Confluent.Models { - public partial class ConfluentOfferDetail : IUtf8JsonSerializable + public partial class ConfluentOfferDetail : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("publisherId"u8); writer.WriteStringValue(PublisherId); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PlanName); writer.WritePropertyName("termUnit"u8); writer.WriteStringValue(TermUnit); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfluentOfferDetail DeserializeConfluentOfferDetail(JsonElement element) + internal static ConfluentOfferDetail DeserializeConfluentOfferDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +62,7 @@ internal static ConfluentOfferDetail DeserializeConfluentOfferDetail(JsonElement string planName = default; string termUnit = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisherId"u8)) @@ -76,8 +99,61 @@ internal static ConfluentOfferDetail DeserializeConfluentOfferDetail(JsonElement status = new ConfluentSaaSOfferStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfluentOfferDetail(publisherId, id, planId, planName, termUnit, Optional.ToNullable(status), serializedAdditionalRawData); + } + + ConfluentOfferDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentOfferDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentOfferDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentOfferDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentOfferDetail model) + { + if (model is null) + { + return null; } - return new ConfluentOfferDetail(publisherId, id, planId, planName, termUnit, Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentOfferDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentOfferDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.cs index c3869215afb9..a10221ff8951 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOfferDetail.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Confluent.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Confluent.Models /// Confluent Offer detail. public partial class ConfluentOfferDetail { - /// Initializes a new instance of ConfluentOfferDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Publisher Id. /// Offer Id. /// Offer Plan Id. @@ -35,14 +39,15 @@ public ConfluentOfferDetail(string publisherId, string id, string planId, string TermUnit = termUnit; } - /// Initializes a new instance of ConfluentOfferDetail. + /// Initializes a new instance of . /// Publisher Id. /// Offer Id. /// Offer Plan Id. /// Offer Plan Name. /// Offer Plan Term unit. /// SaaS Offer Status. - internal ConfluentOfferDetail(string publisherId, string id, string planId, string planName, string termUnit, ConfluentSaaSOfferStatus? status) + /// Keeps track of any properties unknown to the library. + internal ConfluentOfferDetail(string publisherId, string id, string planId, string planName, string termUnit, ConfluentSaaSOfferStatus? status, Dictionary serializedAdditionalRawData) { PublisherId = publisherId; Id = id; @@ -50,6 +55,12 @@ internal ConfluentOfferDetail(string publisherId, string id, string planId, stri PlanName = planName; TermUnit = termUnit; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConfluentOfferDetail() + { } /// Publisher Id. diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationData.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationData.Serialization.cs index f5b73c180c68..8f03df0a8c1d 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationData.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Confluent.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Confluent { - public partial class ConfluentOrganizationData : IUtf8JsonSerializable + public partial class ConfluentOrganizationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -35,15 +41,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("offerDetail"u8); - writer.WriteObjectValue(OfferDetail); + if (OfferDetail is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OfferDetail).Serialize(writer, options); + } writer.WritePropertyName("userDetail"u8); - writer.WriteObjectValue(UserDetail); + if (UserDetail is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserDetail).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfluentOrganizationData DeserializeConfluentOrganizationData(JsonElement element) + internal static ConfluentOrganizationData DeserializeConfluentOrganizationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +94,7 @@ internal static ConfluentOrganizationData DeserializeConfluentOrganizationData(J Optional ssoUrl = default; ConfluentOfferDetail offerDetail = default; ConfluentUserDetail userDetail = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -163,8 +198,61 @@ internal static ConfluentOrganizationData DeserializeConfluentOrganizationData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfluentOrganizationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(createdTime), Optional.ToNullable(provisioningState), Optional.ToNullable(organizationId), ssoUrl.Value, offerDetail, userDetail, serializedAdditionalRawData); + } + + ConfluentOrganizationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentOrganizationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentOrganizationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentOrganizationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentOrganizationData model) + { + if (model is null) + { + return null; } - return new ConfluentOrganizationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(createdTime), Optional.ToNullable(provisioningState), Optional.ToNullable(organizationId), ssoUrl.Value, offerDetail, userDetail); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentOrganizationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentOrganizationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.Serialization.cs index d54db9a6ceab..42f6fc530c54 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Confluent; namespace Azure.ResourceManager.Confluent.Models { - internal partial class ConfluentOrganizationListResult + internal partial class ConfluentOrganizationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConfluentOrganizationListResult DeserializeConfluentOrganizationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConfluentOrganizationListResult DeserializeConfluentOrganizationListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ConfluentOrganizationListResult DeserializeConfluentOrganization nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConfluentOrganizationListResult(Optional.ToList(value), nextLink.Value); + return new ConfluentOrganizationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConfluentOrganizationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentOrganizationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentOrganizationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentOrganizationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentOrganizationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentOrganizationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentOrganizationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.cs index a8d23fcfa245..4fbe7ed8aae2 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Confluent; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Confluent.Models /// The response of a list operation. internal partial class ConfluentOrganizationListResult { - /// Initializes a new instance of ConfluentOrganizationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConfluentOrganizationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConfluentOrganizationListResult. + /// Initializes a new instance of . /// Result of a list operation. /// Link to the next set of results, if any. - internal ConfluentOrganizationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConfluentOrganizationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Result of a list operation. diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.Serialization.cs index 4282b2566383..cf7d6adfe3ae 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Confluent.Models { - public partial class ConfluentOrganizationPatch : IUtf8JsonSerializable + public partial class ConfluentOrganizationPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ConfluentOrganizationPatch DeserializeConfluentOrganizationPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfluentOrganizationPatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConfluentOrganizationPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentOrganizationPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentOrganizationPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentOrganizationPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentOrganizationPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentOrganizationPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentOrganizationPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.cs index 646c6203b379..2ce92292fb96 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentOrganizationPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.Confluent.Models /// Organization Resource update. public partial class ConfluentOrganizationPatch { - /// Initializes a new instance of ConfluentOrganizationPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfluentOrganizationPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// ARM resource tags. + /// Keeps track of any properties unknown to the library. + internal ConfluentOrganizationPatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// ARM resource tags. public IDictionary Tags { get; } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.Serialization.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.Serialization.cs index 73e99682bb78..ad85f701686b 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.Serialization.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Confluent.Models { - public partial class ConfluentUserDetail : IUtf8JsonSerializable + public partial class ConfluentUserDetail : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FirstName)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("emailAddress"u8); writer.WriteStringValue(EmailAddress); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfluentUserDetail DeserializeConfluentUserDetail(JsonElement element) + internal static ConfluentUserDetail DeserializeConfluentUserDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ConfluentUserDetail DeserializeConfluentUserDetail(JsonElement e Optional firstName = default; Optional lastName = default; string emailAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("firstName"u8)) @@ -56,8 +79,61 @@ internal static ConfluentUserDetail DeserializeConfluentUserDetail(JsonElement e emailAddress = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfluentUserDetail(firstName.Value, lastName.Value, emailAddress, serializedAdditionalRawData); + } + + ConfluentUserDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfluentUserDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfluentUserDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfluentUserDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfluentUserDetail model) + { + if (model is null) + { + return null; } - return new ConfluentUserDetail(firstName.Value, lastName.Value, emailAddress); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfluentUserDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfluentUserDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.cs index abe49db92525..d25531d1f312 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Models/ConfluentUserDetail.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Confluent.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Confluent.Models /// Subscriber detail. public partial class ConfluentUserDetail { - /// Initializes a new instance of ConfluentUserDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Email address. /// is null. public ConfluentUserDetail(string emailAddress) @@ -23,15 +27,22 @@ public ConfluentUserDetail(string emailAddress) EmailAddress = emailAddress; } - /// Initializes a new instance of ConfluentUserDetail. + /// Initializes a new instance of . /// First name. /// Last name. /// Email address. - internal ConfluentUserDetail(string firstName, string lastName, string emailAddress) + /// Keeps track of any properties unknown to the library. + internal ConfluentUserDetail(string firstName, string lastName, string emailAddress, Dictionary serializedAdditionalRawData) { FirstName = firstName; LastName = lastName; EmailAddress = emailAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConfluentUserDetail() + { } /// First name. diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs index f59bc6bb26cf..02130e8bb75e 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs @@ -120,9 +120,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, ConfluentAgreeme if (body != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } _userAgent.Apply(message); return message; diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/OrganizationRestOperations.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/OrganizationRestOperations.cs index 5fe7772548a3..67c877898659 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/OrganizationRestOperations.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/OrganizationRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -354,9 +352,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/ValidationsRestOperations.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/ValidationsRestOperations.cs index 3c93595e753c..51363aed9ff8 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/ValidationsRestOperations.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/RestOperations/ValidationsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateValidateOrganizationRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ArmConnectedVMwarevSphereModelFactory.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ArmConnectedVMwarevSphereModelFactory.cs index 41b557438061..76ea0ea0f4b1 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ArmConnectedVMwarevSphereModelFactory.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ArmConnectedVMwarevSphereModelFactory.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Model factory for models. public static partial class ArmConnectedVMwarevSphereModelFactory { - /// Initializes a new instance of ResourcePoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -66,10 +66,10 @@ public static ResourcePoolData ResourcePoolData(ResourceIdentifier id = null, st tags ??= new Dictionary(); statuses ??= new List(); - return new ResourcePoolData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, cpuSharesLevel, cpuReservationMHz, cpuLimitMHz, memSharesLevel, memReservationMB, memLimitMB, customResourceName, statuses?.ToList(), provisioningState); + return new ResourcePoolData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, cpuSharesLevel, cpuReservationMHz, cpuLimitMHz, memSharesLevel, memReservationMB, memLimitMB, customResourceName, statuses?.ToList(), provisioningState, default); } - /// Initializes a new instance of ResourceStatus. + /// Initializes a new instance of . /// The type of the condition. /// Status of the condition. /// The reason for the condition's status. @@ -79,10 +79,10 @@ public static ResourcePoolData ResourcePoolData(ResourceIdentifier id = null, st /// A new instance for mocking. public static ResourceStatus ResourceStatus(string resourceStatusType = null, string status = null, string reason = null, string message = null, string severity = null, DateTimeOffset? lastUpdatedOn = null) { - return new ResourceStatus(resourceStatusType, status, reason, message, severity, lastUpdatedOn); + return new ResourceStatus(resourceStatusType, status, reason, message, severity, lastUpdatedOn, default); } - /// Initializes a new instance of VMwareClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -109,10 +109,10 @@ public static VMwareClusterData VMwareClusterData(ResourceIdentifier id = null, datastoreIds ??= new List(); networkIds ??= new List(); - return new VMwareClusterData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, statuses?.ToList(), customResourceName, datastoreIds?.ToList(), networkIds?.ToList(), provisioningState); + return new VMwareClusterData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, statuses?.ToList(), customResourceName, datastoreIds?.ToList(), networkIds?.ToList(), provisioningState, default); } - /// Initializes a new instance of VMwareHostData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -135,10 +135,10 @@ public static VMwareHostData VMwareHostData(ResourceIdentifier id = null, string tags ??= new Dictionary(); statuses ??= new List(); - return new VMwareHostData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, statuses?.ToList(), customResourceName, provisioningState); + return new VMwareHostData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, statuses?.ToList(), customResourceName, provisioningState, default); } - /// Initializes a new instance of VMwareDatastoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -161,10 +161,10 @@ public static VMwareDatastoreData VMwareDatastoreData(ResourceIdentifier id = nu tags ??= new Dictionary(); statuses ??= new List(); - return new VMwareDatastoreData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, statuses?.ToList(), customResourceName, provisioningState); + return new VMwareDatastoreData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, statuses?.ToList(), customResourceName, provisioningState, default); } - /// Initializes a new instance of VCenterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -189,10 +189,10 @@ public static VCenterData VCenterData(ResourceIdentifier id = null, string name tags ??= new Dictionary(); statuses ??= new List(); - return new VCenterData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, fqdn, port, version, instanceUuid, connectionStatus, customResourceName, credentials, statuses?.ToList(), provisioningState); + return new VCenterData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, fqdn, port, version, instanceUuid, connectionStatus, customResourceName, credentials, statuses?.ToList(), provisioningState, default); } - /// Initializes a new instance of VirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -234,10 +234,10 @@ public static VirtualMachineData VirtualMachineData(ResourceIdentifier id = null networkInterfaces ??= new List(); statuses ??= new List(); - return new VirtualMachineData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, identity, resourcePoolId, templateId, vCenterId, placementProfile, osProfile, hardwareProfile, networkInterfaces != null ? new NetworkProfile(networkInterfaces?.ToList()) : null, storageProfile, guestAgentProfile, moRefId, inventoryItemId, moName, folderPath, instanceUuid, smbiosUuid, firmwareType, powerState, customResourceName, uuid, statuses?.ToList(), provisioningState, vmId); + return new VirtualMachineData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, identity, resourcePoolId, templateId, vCenterId, placementProfile, osProfile, hardwareProfile, networkInterfaces != null ? new NetworkProfile(networkInterfaces?.ToList(), new Dictionary()) : null, storageProfile, guestAgentProfile, moRefId, inventoryItemId, moName, folderPath, instanceUuid, smbiosUuid, firmwareType, powerState, customResourceName, uuid, statuses?.ToList(), provisioningState, vmId, default); } - /// Initializes a new instance of OSProfile. + /// Initializes a new instance of . /// Gets or sets computer name. /// Gets or sets administrator username. /// Gets or sets administrator password. @@ -249,10 +249,10 @@ public static VirtualMachineData VirtualMachineData(ResourceIdentifier id = null /// A new instance for mocking. public static OSProfile OSProfile(string computerName = null, string adminUsername = null, string adminPassword = null, OSType? osType = null, string osName = null, string toolsRunningStatus = null, string toolsVersionStatus = null, string toolsVersion = null) { - return new OSProfile(computerName, adminUsername, adminPassword, osType, osName, toolsRunningStatus, toolsVersionStatus, toolsVersion); + return new OSProfile(computerName, adminUsername, adminPassword, osType, osName, toolsRunningStatus, toolsVersionStatus, toolsVersion, default); } - /// Initializes a new instance of HardwareProfile. + /// Initializes a new instance of . /// Gets or sets memory size in MBs for the vm. /// Gets or sets the number of vCPUs for the vm. /// Gets or sets the number of cores per socket for the vm. Defaults to 1 if unspecified. @@ -262,10 +262,10 @@ public static OSProfile OSProfile(string computerName = null, string adminUserna /// A new instance for mocking. public static HardwareProfile HardwareProfile(int? memorySizeMB = null, int? numCpus = null, int? numCoresPerSocket = null, bool? cpuHotAddEnabled = null, bool? cpuHotRemoveEnabled = null, bool? memoryHotAddEnabled = null) { - return new HardwareProfile(memorySizeMB, numCpus, numCoresPerSocket, cpuHotAddEnabled, cpuHotRemoveEnabled, memoryHotAddEnabled); + return new HardwareProfile(memorySizeMB, numCpus, numCoresPerSocket, cpuHotAddEnabled, cpuHotRemoveEnabled, memoryHotAddEnabled, default); } - /// Initializes a new instance of NetworkInterface. + /// Initializes a new instance of . /// Gets or sets the name of the network interface. /// Gets or sets the label of the virtual network in vCenter that the nic is connected to. /// Gets or sets the nic ip addresses. @@ -285,10 +285,10 @@ public static NetworkInterface NetworkInterface(string name = null, string label { ipAddresses ??= new List(); - return new NetworkInterface(name, label, ipAddresses?.ToList(), macAddress, networkId, nicType, powerOnBoot, networkMoRefId, networkMoName, deviceKey, ipSettings); + return new NetworkInterface(name, label, ipAddresses?.ToList(), macAddress, networkId, nicType, powerOnBoot, networkMoRefId, networkMoName, deviceKey, ipSettings, default); } - /// Initializes a new instance of NicIPSettings. + /// Initializes a new instance of . /// Gets or sets the nic allocation method. /// Gets or sets the dns servers. /// Gets or sets the gateway. @@ -304,20 +304,20 @@ public static NicIPSettings NicIPSettings(IPAddressAllocationMethod? allocationM gateway ??= new List(); ipAddressInfo ??= new List(); - return new NicIPSettings(allocationMethod, dnsServers?.ToList(), gateway?.ToList(), ipAddress, subnetMask, primaryWinsServer, secondaryWinsServer, ipAddressInfo?.ToList()); + return new NicIPSettings(allocationMethod, dnsServers?.ToList(), gateway?.ToList(), ipAddress, subnetMask, primaryWinsServer, secondaryWinsServer, ipAddressInfo?.ToList(), default); } - /// Initializes a new instance of NicIPAddressSettings. + /// Initializes a new instance of . /// Gets the ip address allocation method. /// Gets the ip address for the nic. /// Gets the mask. /// A new instance for mocking. public static NicIPAddressSettings NicIPAddressSettings(string allocationMethod = null, string ipAddress = null, string subnetMask = null) { - return new NicIPAddressSettings(allocationMethod, ipAddress, subnetMask); + return new NicIPAddressSettings(allocationMethod, ipAddress, subnetMask, default); } - /// Initializes a new instance of StorageProfile. + /// Initializes a new instance of . /// Gets or sets the list of virtual disks associated with the virtual machine. /// Gets or sets the list of virtual SCSI controllers associated with the virtual machine. /// A new instance for mocking. @@ -326,10 +326,10 @@ public static StorageProfile StorageProfile(IEnumerable disks = nul disks ??= new List(); scsiControllers ??= new List(); - return new StorageProfile(disks?.ToList(), scsiControllers?.ToList()); + return new StorageProfile(disks?.ToList(), scsiControllers?.ToList(), default); } - /// Initializes a new instance of VirtualDisk. + /// Initializes a new instance of . /// Gets or sets the name of the virtual disk. /// Gets or sets the label of the virtual disk in vCenter. /// Gets or sets the disk object id. @@ -343,10 +343,10 @@ public static StorageProfile StorageProfile(IEnumerable disks = nul /// A new instance for mocking. public static VirtualDisk VirtualDisk(string name = null, string label = null, string diskObjectId = null, int? diskSizeGB = null, int? deviceKey = null, DiskMode? diskMode = null, int? controllerKey = null, int? unitNumber = null, string deviceName = null, DiskType? diskType = null) { - return new VirtualDisk(name, label, diskObjectId, diskSizeGB, deviceKey, diskMode, controllerKey, unitNumber, deviceName, diskType); + return new VirtualDisk(name, label, diskObjectId, diskSizeGB, deviceKey, diskMode, controllerKey, unitNumber, deviceName, diskType, default); } - /// Initializes a new instance of VirtualScsiController. + /// Initializes a new instance of . /// Gets or sets the controller type. /// Gets or sets the key of the controller. /// Gets or sets the bus number of the controller. @@ -355,10 +355,10 @@ public static VirtualDisk VirtualDisk(string name = null, string label = null, s /// A new instance for mocking. public static VirtualScsiController VirtualScsiController(ScsiControllerType? scsiControllerType = null, int? controllerKey = null, int? busNumber = null, int? scsiCtlrUnitNumber = null, VirtualScsiSharing? sharing = null) { - return new VirtualScsiController(scsiControllerType, controllerKey, busNumber, scsiCtlrUnitNumber, sharing); + return new VirtualScsiController(scsiControllerType, controllerKey, busNumber, scsiCtlrUnitNumber, sharing, default); } - /// Initializes a new instance of GuestAgentProfile. + /// Initializes a new instance of . /// Specifies the VM's unique SMBIOS ID. /// The status of the hybrid machine agent. /// The time of the last status change. @@ -369,10 +369,10 @@ public static GuestAgentProfile GuestAgentProfile(string vmUuid = null, StatusTy { errorDetails ??= new List(); - return new GuestAgentProfile(vmUuid, status, lastStatusChange, agentVersion, errorDetails?.ToList()); + return new GuestAgentProfile(vmUuid, status, lastStatusChange, agentVersion, errorDetails?.ToList(), default); } - /// Initializes a new instance of VirtualMachineTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -414,10 +414,10 @@ public static VirtualMachineTemplateData VirtualMachineTemplateData(ResourceIden disks ??= new List(); statuses ??= new List(); - return new VirtualMachineTemplateData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, memorySizeMB, numCpus, numCoresPerSocket, osType, osName, folderPath, networkInterfaces?.ToList(), disks?.ToList(), customResourceName, toolsVersionStatus, toolsVersion, firmwareType, statuses?.ToList(), provisioningState); + return new VirtualMachineTemplateData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, memorySizeMB, numCpus, numCoresPerSocket, osType, osName, folderPath, networkInterfaces?.ToList(), disks?.ToList(), customResourceName, toolsVersionStatus, toolsVersion, firmwareType, statuses?.ToList(), provisioningState, default); } - /// Initializes a new instance of VirtualNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -440,10 +440,10 @@ public static VirtualNetworkData VirtualNetworkData(ResourceIdentifier id = null tags ??= new Dictionary(); statuses ??= new List(); - return new VirtualNetworkData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, customResourceName, statuses?.ToList(), provisioningState); + return new VirtualNetworkData(id, name, resourceType, systemData, tags, location, extendedLocation, kind, uuid, vCenterId, moRefId, inventoryItemId, moName, customResourceName, statuses?.ToList(), provisioningState, default); } - /// Initializes a new instance of HybridIdentityMetadataData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -455,10 +455,10 @@ public static VirtualNetworkData VirtualNetworkData(ResourceIdentifier id = null /// A new instance for mocking. public static HybridIdentityMetadataData HybridIdentityMetadataData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string vmId = null, string publicKey = null, ManagedServiceIdentity identity = null, string provisioningState = null) { - return new HybridIdentityMetadataData(id, name, resourceType, systemData, vmId, publicKey, identity, provisioningState); + return new HybridIdentityMetadataData(id, name, resourceType, systemData, vmId, publicKey, identity, provisioningState, default); } - /// Initializes a new instance of MachineExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -479,10 +479,10 @@ public static MachineExtensionData MachineExtensionData(ResourceIdentifier id = { tags ??= new Dictionary(); - return new MachineExtensionData(id, name, resourceType, systemData, tags, location, forceUpdateTag, publisher, machineExtensionType, typeHandlerVersion, autoUpgradeMinorVersion, settings, protectedSettings, provisioningState, instanceView); + return new MachineExtensionData(id, name, resourceType, systemData, tags, location, forceUpdateTag, publisher, machineExtensionType, typeHandlerVersion, autoUpgradeMinorVersion, settings, protectedSettings, provisioningState, instanceView, default); } - /// Initializes a new instance of MachineExtensionPropertiesInstanceView. + /// Initializes a new instance of . /// The machine extension name. /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. @@ -490,10 +490,10 @@ public static MachineExtensionData MachineExtensionData(ResourceIdentifier id = /// A new instance for mocking. public static MachineExtensionPropertiesInstanceView MachineExtensionPropertiesInstanceView(string name = null, string machineExtensionInstanceViewType = null, string typeHandlerVersion = null, MachineExtensionInstanceViewStatus status = null) { - return new MachineExtensionPropertiesInstanceView(name, machineExtensionInstanceViewType, typeHandlerVersion, status); + return new MachineExtensionPropertiesInstanceView(name, machineExtensionInstanceViewType, typeHandlerVersion, status, default); } - /// Initializes a new instance of MachineExtensionInstanceView. + /// Initializes a new instance of . /// The machine extension name. /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. @@ -501,10 +501,10 @@ public static MachineExtensionPropertiesInstanceView MachineExtensionPropertiesI /// A new instance for mocking. public static MachineExtensionInstanceView MachineExtensionInstanceView(string name = null, string machineExtensionInstanceViewType = null, string typeHandlerVersion = null, MachineExtensionInstanceViewStatus status = null) { - return new MachineExtensionInstanceView(name, machineExtensionInstanceViewType, typeHandlerVersion, status); + return new MachineExtensionInstanceView(name, machineExtensionInstanceViewType, typeHandlerVersion, status, default); } - /// Initializes a new instance of MachineExtensionInstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The level code. /// The short localizable label for the status. @@ -513,10 +513,10 @@ public static MachineExtensionInstanceView MachineExtensionInstanceView(string n /// A new instance for mocking. public static MachineExtensionInstanceViewStatus MachineExtensionInstanceViewStatus(string code = null, MachineExtensionStatusLevelType? level = null, string displayStatus = null, string message = null, DateTimeOffset? time = null) { - return new MachineExtensionInstanceViewStatus(code, level, displayStatus, message, time); + return new MachineExtensionInstanceViewStatus(code, level, displayStatus, message, time, default); } - /// Initializes a new instance of GuestAgentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -534,7 +534,7 @@ public static GuestAgentData GuestAgentData(ResourceIdentifier id = null, string { statuses ??= new List(); - return new GuestAgentData(id, name, resourceType, systemData, uuid, credentials, httpsProxy != null ? new HttpProxyConfiguration(httpsProxy) : null, provisioningAction, status, customResourceName, statuses?.ToList(), provisioningState); + return new GuestAgentData(id, name, resourceType, systemData, uuid, credentials, httpsProxy != null ? new HttpProxyConfiguration(httpsProxy, new Dictionary()) : null, provisioningAction, status, customResourceName, statuses?.ToList(), provisioningState, default); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index d530956dd13c..a80e96fa2e7a 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -88,7 +88,7 @@ public virtual AsyncPageable GetResourcePoolsAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => ResourcePoolRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourcePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourcePools", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourcePools", "value", "nextLink", cancellationToken); } /// @@ -110,7 +110,7 @@ public virtual Pageable GetResourcePools(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => ResourcePoolRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourcePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourcePools", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourcePools", "value", "nextLink", cancellationToken); } /// @@ -132,7 +132,7 @@ public virtual AsyncPageable GetVMwareClustersAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareClusters", "value", "nextLink", cancellationToken); } /// @@ -154,7 +154,7 @@ public virtual Pageable GetVMwareClusters(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareClusters", "value", "nextLink", cancellationToken); } /// @@ -176,7 +176,7 @@ public virtual AsyncPageable GetVMwareHostsAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareHostHostsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareHostHostsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareHosts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareHosts", "value", "nextLink", cancellationToken); } /// @@ -198,7 +198,7 @@ public virtual Pageable GetVMwareHosts(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareHostHostsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareHostHostsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareHosts", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareHosts", "value", "nextLink", cancellationToken); } /// @@ -220,7 +220,7 @@ public virtual AsyncPageable GetVMwareDatastoresAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareDatastores", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareDatastores", "value", "nextLink", cancellationToken); } /// @@ -242,7 +242,7 @@ public virtual Pageable GetVMwareDatastores(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareDatastores", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareDatastores", "value", "nextLink", cancellationToken); } /// @@ -264,7 +264,7 @@ public virtual AsyncPageable GetVCentersAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => VCenterRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VCenterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVCenters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVCenters", "value", "nextLink", cancellationToken); } /// @@ -286,7 +286,7 @@ public virtual Pageable GetVCenters(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => VCenterRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VCenterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVCenters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVCenters", "value", "nextLink", cancellationToken); } /// @@ -308,7 +308,7 @@ public virtual AsyncPageable GetVirtualMachinesAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); } /// @@ -330,7 +330,7 @@ public virtual Pageable GetVirtualMachines(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); } /// @@ -352,7 +352,7 @@ public virtual AsyncPageable GetVirtualMachineTe { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineTemplateRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineTemplateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); } /// @@ -374,7 +374,7 @@ public virtual Pageable GetVirtualMachineTemplat { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineTemplateRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineTemplateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); } /// @@ -396,7 +396,7 @@ public virtual AsyncPageable GetVirtualNetworksAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); } /// @@ -418,7 +418,7 @@ public virtual Pageable GetVirtualNetworks(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs index 604610eff0fb..9db95658bf44 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _guestAgentRestClient.CreateListByVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _guestAgentRestClient.CreateListByVmNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GuestAgentResource(Client, GuestAgentData.DeserializeGuestAgentData(e)), _guestAgentClientDiagnostics, Pipeline, "GuestAgentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new GuestAgentResource(Client, GuestAgentData.DeserializeGuestAgentData(e)), _guestAgentClientDiagnostics, Pipeline, "GuestAgentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _guestAgentRestClient.CreateListByVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _guestAgentRestClient.CreateListByVmNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GuestAgentResource(Client, GuestAgentData.DeserializeGuestAgentData(e)), _guestAgentClientDiagnostics, Pipeline, "GuestAgentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new GuestAgentResource(Client, GuestAgentData.DeserializeGuestAgentData(e)), _guestAgentClientDiagnostics, Pipeline, "GuestAgentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentData.cs index 5693b665d37a..5a2c9de7e300 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class GuestAgentData : ResourceData { - /// Initializes a new instance of GuestAgentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GuestAgentData() { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of GuestAgentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +41,8 @@ public GuestAgentData() /// Gets the name of the corresponding resource in Kubernetes. /// The resource status information. /// Gets or sets the provisioning state. - internal GuestAgentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string uuid, GuestCredential credentials, HttpProxyConfiguration httpProxyConfig, ProvisioningAction? provisioningAction, string status, string customResourceName, IReadOnlyList statuses, string provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal GuestAgentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string uuid, GuestCredential credentials, HttpProxyConfiguration httpProxyConfig, ProvisioningAction? provisioningAction, string status, string customResourceName, IReadOnlyList statuses, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Uuid = uuid; Credentials = credentials; @@ -47,6 +52,7 @@ internal GuestAgentData(ResourceIdentifier id, string name, ResourceType resourc CustomResourceName = customResourceName; Statuses = statuses; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets a unique identifier for this resource. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs index 946576aec880..c83ac358f4e0 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _hybridIdentityMetadataHybridIdentityMetadataRestClient.CreateListByVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hybridIdentityMetadataHybridIdentityMetadataRestClient.CreateListByVmNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridIdentityMetadataResource(Client, HybridIdentityMetadataData.DeserializeHybridIdentityMetadataData(e)), _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics, Pipeline, "HybridIdentityMetadataCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HybridIdentityMetadataResource(Client, HybridIdentityMetadataData.DeserializeHybridIdentityMetadataData(e)), _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics, Pipeline, "HybridIdentityMetadataCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _hybridIdentityMetadataHybridIdentityMetadataRestClient.CreateListByVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hybridIdentityMetadataHybridIdentityMetadataRestClient.CreateListByVmNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridIdentityMetadataResource(Client, HybridIdentityMetadataData.DeserializeHybridIdentityMetadataData(e)), _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics, Pipeline, "HybridIdentityMetadataCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HybridIdentityMetadataResource(Client, HybridIdentityMetadataData.DeserializeHybridIdentityMetadataData(e)), _hybridIdentityMetadataHybridIdentityMetadataClientDiagnostics, Pipeline, "HybridIdentityMetadataCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataData.cs index a04e6c875e79..bd5d97201e98 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,12 +18,15 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class HybridIdentityMetadataData : ResourceData { - /// Initializes a new instance of HybridIdentityMetadataData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HybridIdentityMetadataData() { } - /// Initializes a new instance of HybridIdentityMetadataData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,12 +35,14 @@ public HybridIdentityMetadataData() /// Gets or sets the Public Key. /// The identity of the resource. Current supported identity types: None, SystemAssigned. /// Gets or sets the provisioning state. - internal HybridIdentityMetadataData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string vmId, string publicKey, ManagedServiceIdentity identity, string provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal HybridIdentityMetadataData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string vmId, string publicKey, ManagedServiceIdentity identity, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { VmId = vmId; PublicKey = publicKey; Identity = identity; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the Vm Id. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs index 454e83bebc98..6cb6d7a42e8c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _inventoryItemRestClient.CreateListByVCenterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _inventoryItemRestClient.CreateListByVCenterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _inventoryItemRestClient.CreateListByVCenterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _inventoryItemRestClient.CreateListByVCenterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new InventoryItemResource(Client, InventoryItemData.DeserializeInventoryItemData(e)), _inventoryItemClientDiagnostics, Pipeline, "InventoryItemCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemData.cs index 2e5bf2190aeb..f2231247cee1 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; @@ -17,14 +19,17 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class InventoryItemData : ResourceData { - /// Initializes a new instance of InventoryItemData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// They inventory type. public InventoryItemData(InventoryType inventoryType) { InventoryType = inventoryType; } - /// Initializes a new instance of InventoryItemData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +40,8 @@ public InventoryItemData(InventoryType inventoryType) /// Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. /// Gets or sets the vCenter Managed Object name for the inventory item. /// Gets or sets the provisioning state. - internal InventoryItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, InventoryType inventoryType, string managedResourceId, string moRefId, string moName, string provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal InventoryItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, InventoryType inventoryType, string managedResourceId, string moRefId, string moName, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; InventoryType = inventoryType; @@ -43,6 +49,12 @@ internal InventoryItemData(ResourceIdentifier id, string name, ResourceType reso MoRefId = moRefId; MoName = moName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InventoryItemData() + { } /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs index 3f163c0e1cf9..f69295a4795d 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(string expand { HttpMessage FirstPageRequest(int? pageSizeHint) => _machineExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _machineExtensionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineExtensionResource(Client, MachineExtensionData.DeserializeMachineExtensionData(e)), _machineExtensionClientDiagnostics, Pipeline, "MachineExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MachineExtensionResource(Client, MachineExtensionData.DeserializeMachineExtensionData(e)), _machineExtensionClientDiagnostics, Pipeline, "MachineExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string expand = null, C { HttpMessage FirstPageRequest(int? pageSizeHint) => _machineExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _machineExtensionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineExtensionResource(Client, MachineExtensionData.DeserializeMachineExtensionData(e)), _machineExtensionClientDiagnostics, Pipeline, "MachineExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MachineExtensionResource(Client, MachineExtensionData.DeserializeMachineExtensionData(e)), _machineExtensionClientDiagnostics, Pipeline, "MachineExtensionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionData.cs index 97b4eb986b10..d3d99e5c13d2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class MachineExtensionData : TrackedResourceData { - /// Initializes a new instance of MachineExtensionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public MachineExtensionData(AzureLocation location) : base(location) { } - /// Initializes a new instance of MachineExtensionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public MachineExtensionData(AzureLocation location) : base(location) /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. /// The provisioning state, which only appears in the response. /// The machine extension instance view. - internal MachineExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string forceUpdateTag, string publisher, string machineExtensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, string provisioningState, MachineExtensionPropertiesInstanceView instanceView) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal MachineExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string forceUpdateTag, string publisher, string machineExtensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, string provisioningState, MachineExtensionPropertiesInstanceView instanceView, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ForceUpdateTag = forceUpdateTag; Publisher = publisher; @@ -52,6 +56,12 @@ internal MachineExtensionData(ResourceIdentifier id, string name, ResourceType r ProtectedSettings = protectedSettings; ProvisioningState = provisioningState; InstanceView = instanceView; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MachineExtensionData() + { } /// How the extension handler should be forced to update even if the extension configuration has not changed. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.Serialization.cs index 8101d44259ce..58a076e4d2c6 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class ClustersList + internal partial class ClustersList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClustersList DeserializeClustersList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClustersList DeserializeClustersList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static ClustersList DeserializeClustersList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClustersList(nextLink.Value, value); + return new ClustersList(nextLink.Value, value, serializedAdditionalRawData); + } + + ClustersList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClustersList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClustersList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClustersList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClustersList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClustersList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClustersList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.cs index ae24f17690f4..7f4df495de1f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ClustersList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of Clusters. internal partial class ClustersList { - /// Initializes a new instance of ClustersList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of Clusters. /// is null. internal ClustersList(IEnumerable value) @@ -26,13 +29,20 @@ internal ClustersList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ClustersList. + /// Initializes a new instance of . /// Url to follow for getting next page of Clusters. /// Array of Clusters. - internal ClustersList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ClustersList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClustersList() + { } /// Url to follow for getting next page of Clusters. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.Serialization.cs index f522fbbb4962..f83530b1a315 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class DatastoresList + internal partial class DatastoresList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatastoresList DeserializeDatastoresList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatastoresList DeserializeDatastoresList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static DatastoresList DeserializeDatastoresList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatastoresList(nextLink.Value, value); + return new DatastoresList(nextLink.Value, value, serializedAdditionalRawData); + } + + DatastoresList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatastoresList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatastoresList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatastoresList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatastoresList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatastoresList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatastoresList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.cs index b8ce57200095..1081bfcf55d2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/DatastoresList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of Datastores. internal partial class DatastoresList { - /// Initializes a new instance of DatastoresList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of Datastores. /// is null. internal DatastoresList(IEnumerable value) @@ -26,13 +29,20 @@ internal DatastoresList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DatastoresList. + /// Initializes a new instance of . /// Url to follow for getting next page of Datastores. /// Array of Datastores. - internal DatastoresList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal DatastoresList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatastoresList() + { } /// Url to follow for getting next page of Datastores. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentData.Serialization.cs index 453be517c5df..b9af9614b1b2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentData.Serialization.cs @@ -5,30 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class GuestAgentData : IUtf8JsonSerializable + public partial class GuestAgentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } if (Optional.IsDefined(HttpProxyConfig)) { writer.WritePropertyName("httpProxyConfig"u8); - writer.WriteObjectValue(HttpProxyConfig); + if (HttpProxyConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HttpProxyConfig).Serialize(writer, options); + } } if (Optional.IsDefined(ProvisioningAction)) { @@ -36,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ProvisioningAction.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GuestAgentData DeserializeGuestAgentData(JsonElement element) + internal static GuestAgentData DeserializeGuestAgentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +92,7 @@ internal static GuestAgentData DeserializeGuestAgentData(JsonElement element) Optional customResourceName = default; Optional> statuses = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -156,8 +192,61 @@ internal static GuestAgentData DeserializeGuestAgentData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GuestAgentData(id, name, type, systemData.Value, uuid.Value, credentials.Value, httpProxyConfig.Value, Optional.ToNullable(provisioningAction), status.Value, customResourceName.Value, Optional.ToList(statuses), provisioningState.Value, serializedAdditionalRawData); + } + + GuestAgentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGuestAgentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GuestAgentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGuestAgentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GuestAgentData model) + { + if (model is null) + { + return null; } - return new GuestAgentData(id, name, type, systemData.Value, uuid.Value, credentials.Value, httpProxyConfig.Value, Optional.ToNullable(provisioningAction), status.Value, customResourceName.Value, Optional.ToList(statuses), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GuestAgentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGuestAgentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.Serialization.cs index 7b0af6aeb6c0..a9c7787c4d6c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class GuestAgentList + internal partial class GuestAgentList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GuestAgentList DeserializeGuestAgentList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GuestAgentList DeserializeGuestAgentList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static GuestAgentList DeserializeGuestAgentList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GuestAgentList(nextLink.Value, value); + return new GuestAgentList(nextLink.Value, value, serializedAdditionalRawData); + } + + GuestAgentList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGuestAgentList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GuestAgentList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGuestAgentList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GuestAgentList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GuestAgentList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGuestAgentList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.cs index 599188fae1dc..0534809ddd98 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of GuestAgent. internal partial class GuestAgentList { - /// Initializes a new instance of GuestAgentList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of GuestAgent. /// is null. internal GuestAgentList(IEnumerable value) @@ -26,13 +29,20 @@ internal GuestAgentList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of GuestAgentList. + /// Initializes a new instance of . /// Url to follow for getting next page of GuestAgent. /// Array of GuestAgent. - internal GuestAgentList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal GuestAgentList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GuestAgentList() + { } /// Url to follow for getting next page of GuestAgent. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.Serialization.cs index e1f88127a0e8..8568790c6a6a 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.Serialization.cs @@ -10,19 +10,38 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class GuestAgentProfile : IUtf8JsonSerializable + public partial class GuestAgentProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GuestAgentProfile DeserializeGuestAgentProfile(JsonElement element) + internal static GuestAgentProfile DeserializeGuestAgentProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +51,7 @@ internal static GuestAgentProfile DeserializeGuestAgentProfile(JsonElement eleme Optional lastStatusChange = default; Optional agentVersion = default; Optional> errorDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmUuid"u8)) @@ -76,8 +96,61 @@ internal static GuestAgentProfile DeserializeGuestAgentProfile(JsonElement eleme errorDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GuestAgentProfile(vmUuid.Value, Optional.ToNullable(status), Optional.ToNullable(lastStatusChange), agentVersion.Value, Optional.ToList(errorDetails), serializedAdditionalRawData); + } + + GuestAgentProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGuestAgentProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GuestAgentProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGuestAgentProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GuestAgentProfile model) + { + if (model is null) + { + return null; } - return new GuestAgentProfile(vmUuid.Value, Optional.ToNullable(status), Optional.ToNullable(lastStatusChange), agentVersion.Value, Optional.ToList(errorDetails)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GuestAgentProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGuestAgentProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.cs index 903932fc71f4..e978d29f416f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestAgentProfile.cs @@ -15,25 +15,30 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the resource properties. public partial class GuestAgentProfile { - /// Initializes a new instance of GuestAgentProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GuestAgentProfile() { ErrorDetails = new ChangeTrackingList(); } - /// Initializes a new instance of GuestAgentProfile. + /// Initializes a new instance of . /// Specifies the VM's unique SMBIOS ID. /// The status of the hybrid machine agent. /// The time of the last status change. /// The hybrid machine agent full version. /// Details about the error state. - internal GuestAgentProfile(string vmUuid, StatusType? status, DateTimeOffset? lastStatusChange, string agentVersion, IReadOnlyList errorDetails) + /// Keeps track of any properties unknown to the library. + internal GuestAgentProfile(string vmUuid, StatusType? status, DateTimeOffset? lastStatusChange, string agentVersion, IReadOnlyList errorDetails, Dictionary serializedAdditionalRawData) { VmUuid = vmUuid; Status = status; LastStatusChange = lastStatusChange; AgentVersion = agentVersion; ErrorDetails = errorDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the VM's unique SMBIOS ID. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.Serialization.cs index a17923fffc99..b788f28b4d1d 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class GuestCredential : IUtf8JsonSerializable + public partial class GuestCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Username)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GuestCredential DeserializeGuestCredential(JsonElement element) + internal static GuestCredential DeserializeGuestCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional username = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -48,8 +71,61 @@ internal static GuestCredential DeserializeGuestCredential(JsonElement element) password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GuestCredential(username.Value, password.Value, serializedAdditionalRawData); + } + + GuestCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGuestCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GuestCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGuestCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GuestCredential model) + { + if (model is null) + { + return null; } - return new GuestCredential(username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GuestCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGuestCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.cs index 762da5f77192..1ef6450b60e6 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/GuestCredential.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Username / Password Credentials to connect to guest. public partial class GuestCredential { - /// Initializes a new instance of GuestCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GuestCredential() { } - /// Initializes a new instance of GuestCredential. + /// Initializes a new instance of . /// Gets or sets username to connect with the guest. /// Gets or sets the password to connect with the guest. - internal GuestCredential(string username, string password) + /// Keeps track of any properties unknown to the library. + internal GuestCredential(string username, string password, Dictionary serializedAdditionalRawData) { Username = username; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets username to connect with the guest. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.Serialization.cs index 414a9613bbf3..be3542452a0e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class HardwareProfile : IUtf8JsonSerializable + public partial class HardwareProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MemorySizeMB)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("numCoresPerSocket"u8); writer.WriteNumberValue(NumCoresPerSocket.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HardwareProfile DeserializeHardwareProfile(JsonElement element) + internal static HardwareProfile DeserializeHardwareProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static HardwareProfile DeserializeHardwareProfile(JsonElement element) Optional cpuHotAddEnabled = default; Optional cpuHotRemoveEnabled = default; Optional memoryHotAddEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("memorySizeMB"u8)) @@ -101,8 +124,61 @@ internal static HardwareProfile DeserializeHardwareProfile(JsonElement element) memoryHotAddEnabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HardwareProfile(Optional.ToNullable(memorySizeMB), Optional.ToNullable(numCpus), Optional.ToNullable(numCoresPerSocket), Optional.ToNullable(cpuHotAddEnabled), Optional.ToNullable(cpuHotRemoveEnabled), Optional.ToNullable(memoryHotAddEnabled), serializedAdditionalRawData); + } + + HardwareProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHardwareProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HardwareProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHardwareProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HardwareProfile model) + { + if (model is null) + { + return null; } - return new HardwareProfile(Optional.ToNullable(memorySizeMB), Optional.ToNullable(numCpus), Optional.ToNullable(numCoresPerSocket), Optional.ToNullable(cpuHotAddEnabled), Optional.ToNullable(cpuHotRemoveEnabled), Optional.ToNullable(memoryHotAddEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HardwareProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHardwareProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.cs index bf7291edad8c..64fe42fa48c3 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HardwareProfile.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Defines the resource properties. public partial class HardwareProfile { - /// Initializes a new instance of HardwareProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HardwareProfile() { } - /// Initializes a new instance of HardwareProfile. + /// Initializes a new instance of . /// Gets or sets memory size in MBs for the vm. /// Gets or sets the number of vCPUs for the vm. /// Gets or sets the number of cores per socket for the vm. Defaults to 1 if unspecified. /// Gets or sets a value indicating whether virtual processors can be added while this virtual machine is running. /// Gets or sets a value indicating whether virtual processors can be removed while this virtual machine is running. /// Gets or sets a value indicating whether memory can be added while this virtual machine is running. - internal HardwareProfile(int? memorySizeMB, int? numCpus, int? numCoresPerSocket, bool? cpuHotAddEnabled, bool? cpuHotRemoveEnabled, bool? memoryHotAddEnabled) + /// Keeps track of any properties unknown to the library. + internal HardwareProfile(int? memorySizeMB, int? numCpus, int? numCoresPerSocket, bool? cpuHotAddEnabled, bool? cpuHotRemoveEnabled, bool? memoryHotAddEnabled, Dictionary serializedAdditionalRawData) { MemorySizeMB = memorySizeMB; NumCpus = numCpus; @@ -30,6 +37,7 @@ internal HardwareProfile(int? memorySizeMB, int? numCpus, int? numCoresPerSocket CpuHotAddEnabled = cpuHotAddEnabled; CpuHotRemoveEnabled = cpuHotRemoveEnabled; MemoryHotAddEnabled = memoryHotAddEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets memory size in MBs for the vm. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.Serialization.cs index 55060073c161..6ea360274c0b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class HostsList + internal partial class HostsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HostsList DeserializeHostsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HostsList DeserializeHostsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static HostsList DeserializeHostsList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HostsList(nextLink.Value, value); + return new HostsList(nextLink.Value, value, serializedAdditionalRawData); + } + + HostsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHostsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HostsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHostsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HostsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HostsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHostsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.cs index 8792b0a5e78a..b8577b3645ef 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HostsList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of Hosts. internal partial class HostsList { - /// Initializes a new instance of HostsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of Hosts. /// is null. internal HostsList(IEnumerable value) @@ -26,13 +29,20 @@ internal HostsList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of HostsList. + /// Initializes a new instance of . /// Url to follow for getting next page of Hosts. /// Array of Hosts. - internal HostsList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal HostsList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostsList() + { } /// Url to follow for getting next page of Hosts. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.Serialization.cs index 6cc6bd30805e..52690c8c081a 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class HttpProxyConfiguration : IUtf8JsonSerializable + internal partial class HttpProxyConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HttpsProxy)) { writer.WritePropertyName("httpsProxy"u8); writer.WriteStringValue(HttpsProxy); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HttpProxyConfiguration DeserializeHttpProxyConfiguration(JsonElement element) + internal static HttpProxyConfiguration DeserializeHttpProxyConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional httpsProxy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("httpsProxy"u8)) @@ -37,8 +60,61 @@ internal static HttpProxyConfiguration DeserializeHttpProxyConfiguration(JsonEle httpsProxy = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HttpProxyConfiguration(httpsProxy.Value, serializedAdditionalRawData); + } + + HttpProxyConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpProxyConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpProxyConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpProxyConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpProxyConfiguration model) + { + if (model is null) + { + return null; } - return new HttpProxyConfiguration(httpsProxy.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpProxyConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpProxyConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.cs index d1266ce25d8a..fc3760cc0143 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HttpProxyConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// HTTP Proxy configuration for the VM. internal partial class HttpProxyConfiguration { - /// Initializes a new instance of HttpProxyConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HttpProxyConfiguration() { } - /// Initializes a new instance of HttpProxyConfiguration. + /// Initializes a new instance of . /// Gets or sets httpsProxy url. - internal HttpProxyConfiguration(string httpsProxy) + /// Keeps track of any properties unknown to the library. + internal HttpProxyConfiguration(string httpsProxy, Dictionary serializedAdditionalRawData) { HttpsProxy = httpsProxy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets httpsProxy url. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataData.Serialization.cs index 73eeabfc3a71..cf64e4a592ce 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataData.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class HybridIdentityMetadataData : IUtf8JsonSerializable + public partial class HybridIdentityMetadataData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicKey); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HybridIdentityMetadataData DeserializeHybridIdentityMetadataData(JsonElement element) + internal static HybridIdentityMetadataData DeserializeHybridIdentityMetadataData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +68,7 @@ internal static HybridIdentityMetadataData DeserializeHybridIdentityMetadataData Optional publicKey = default; Optional identity = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -108,8 +131,61 @@ internal static HybridIdentityMetadataData DeserializeHybridIdentityMetadataData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HybridIdentityMetadataData(id, name, type, systemData.Value, vmId.Value, publicKey.Value, identity, provisioningState.Value, serializedAdditionalRawData); + } + + HybridIdentityMetadataData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridIdentityMetadataData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridIdentityMetadataData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridIdentityMetadataData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridIdentityMetadataData model) + { + if (model is null) + { + return null; } - return new HybridIdentityMetadataData(id, name, type, systemData.Value, vmId.Value, publicKey.Value, identity, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridIdentityMetadataData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridIdentityMetadataData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.Serialization.cs index 2aa1027fa410..82158b8ea168 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class HybridIdentityMetadataList + internal partial class HybridIdentityMetadataList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HybridIdentityMetadataList DeserializeHybridIdentityMetadataList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HybridIdentityMetadataList DeserializeHybridIdentityMetadataList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static HybridIdentityMetadataList DeserializeHybridIdentityMetadataList value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HybridIdentityMetadataList(nextLink.Value, value); + return new HybridIdentityMetadataList(nextLink.Value, value, serializedAdditionalRawData); + } + + HybridIdentityMetadataList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHybridIdentityMetadataList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HybridIdentityMetadataList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHybridIdentityMetadataList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HybridIdentityMetadataList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HybridIdentityMetadataList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHybridIdentityMetadataList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.cs index 2c718ae45870..9121aabef109 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/HybridIdentityMetadataList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of HybridIdentityMetadata. internal partial class HybridIdentityMetadataList { - /// Initializes a new instance of HybridIdentityMetadataList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of HybridIdentityMetadata. /// is null. internal HybridIdentityMetadataList(IEnumerable value) @@ -26,13 +29,20 @@ internal HybridIdentityMetadataList(IEnumerable valu Value = value.ToList(); } - /// Initializes a new instance of HybridIdentityMetadataList. + /// Initializes a new instance of . /// Url to follow for getting next page of HybridIdentityMetadata. /// Array of HybridIdentityMetadata. - internal HybridIdentityMetadataList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal HybridIdentityMetadataList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HybridIdentityMetadataList() + { } /// Url to follow for getting next page of HybridIdentityMetadata. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemData.Serialization.cs index 809c081d2c19..58761bec44c1 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class InventoryItemData : IUtf8JsonSerializable + public partial class InventoryItemData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -42,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(MoName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InventoryItemData DeserializeInventoryItemData(JsonElement element) + internal static InventoryItemData DeserializeInventoryItemData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +83,7 @@ internal static InventoryItemData DeserializeInventoryItemData(JsonElement eleme Optional moRefId = default; Optional moName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -129,8 +152,61 @@ internal static InventoryItemData DeserializeInventoryItemData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InventoryItemData(id, name, type, systemData.Value, kind.Value, inventoryType, managedResourceId.Value, moRefId.Value, moName.Value, provisioningState.Value, serializedAdditionalRawData); + } + + InventoryItemData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryItemData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InventoryItemData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInventoryItemData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InventoryItemData model) + { + if (model is null) + { + return null; } - return new InventoryItemData(id, name, type, systemData.Value, kind.Value, inventoryType, managedResourceId.Value, moRefId.Value, moName.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InventoryItemData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInventoryItemData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.Serialization.cs index 561648489af0..76f2d0582c7b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class InventoryItemsList + internal partial class InventoryItemsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InventoryItemsList DeserializeInventoryItemsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InventoryItemsList DeserializeInventoryItemsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static InventoryItemsList DeserializeInventoryItemsList(JsonElement ele value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InventoryItemsList(nextLink.Value, value); + return new InventoryItemsList(nextLink.Value, value, serializedAdditionalRawData); + } + + InventoryItemsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryItemsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InventoryItemsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInventoryItemsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InventoryItemsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InventoryItemsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInventoryItemsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.cs index b16ae8ec8a90..035ab431909f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/InventoryItemsList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of InventoryItems. internal partial class InventoryItemsList { - /// Initializes a new instance of InventoryItemsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of InventoryItems. /// is null. internal InventoryItemsList(IEnumerable value) @@ -26,13 +29,20 @@ internal InventoryItemsList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of InventoryItemsList. + /// Initializes a new instance of . /// Url to follow for getting next page of InventoryItems. /// Array of InventoryItems. - internal InventoryItemsList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal InventoryItemsList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InventoryItemsList() + { } /// Url to follow for getting next page of InventoryItems. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionData.Serialization.cs index fa3b9f437586..46160300e9e0 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class MachineExtensionData : IUtf8JsonSerializable + public partial class MachineExtensionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -80,14 +86,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(InstanceView)) { writer.WritePropertyName("instanceView"u8); - writer.WriteObjectValue(InstanceView); + if (InstanceView is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InstanceView).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MachineExtensionData DeserializeMachineExtensionData(JsonElement element) + internal static MachineExtensionData DeserializeMachineExtensionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,6 +134,7 @@ internal static MachineExtensionData DeserializeMachineExtensionData(JsonElement Optional protectedSettings = default; Optional provisioningState = default; Optional instanceView = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -225,8 +253,61 @@ internal static MachineExtensionData DeserializeMachineExtensionData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MachineExtensionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value); + return new MachineExtensionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value, serializedAdditionalRawData); + } + + MachineExtensionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMachineExtensionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MachineExtensionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMachineExtensionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MachineExtensionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MachineExtensionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMachineExtensionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.Serialization.cs index 8b47223bb809..83bb59c79b65 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.Serialization.cs @@ -5,26 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class MachineExtensionInstanceView : IUtf8JsonSerializable + public partial class MachineExtensionInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); - writer.WriteObjectValue(Status); + if (Status is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Status).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MachineExtensionInstanceView DeserializeMachineExtensionInstanceView(JsonElement element) + internal static MachineExtensionInstanceView DeserializeMachineExtensionInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +62,7 @@ internal static MachineExtensionInstanceView DeserializeMachineExtensionInstance Optional type = default; Optional typeHandlerVersion = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +89,61 @@ internal static MachineExtensionInstanceView DeserializeMachineExtensionInstance status = MachineExtensionInstanceViewStatus.DeserializeMachineExtensionInstanceViewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MachineExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, status.Value, serializedAdditionalRawData); + } + + MachineExtensionInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMachineExtensionInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MachineExtensionInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMachineExtensionInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MachineExtensionInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MachineExtensionInstanceView(Response response) + { + if (response is null) + { + return null; } - return new MachineExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, status.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMachineExtensionInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.cs index abc59f40a0e7..e4908d99f8d7 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceView.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Describes the Machine Extension Instance View. public partial class MachineExtensionInstanceView { - /// Initializes a new instance of MachineExtensionInstanceView. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MachineExtensionInstanceView() { } - /// Initializes a new instance of MachineExtensionInstanceView. + /// Initializes a new instance of . /// The machine extension name. /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. /// Instance view status. - internal MachineExtensionInstanceView(string name, string machineExtensionInstanceViewType, string typeHandlerVersion, MachineExtensionInstanceViewStatus status) + /// Keeps track of any properties unknown to the library. + internal MachineExtensionInstanceView(string name, string machineExtensionInstanceViewType, string typeHandlerVersion, MachineExtensionInstanceViewStatus status, Dictionary serializedAdditionalRawData) { Name = name; MachineExtensionInstanceViewType = machineExtensionInstanceViewType; TypeHandlerVersion = typeHandlerVersion; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The machine extension name. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.Serialization.cs index 6007223d00ef..a6f8cf371534 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.Serialization.cs @@ -6,21 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class MachineExtensionInstanceViewStatus : IUtf8JsonSerializable + public partial class MachineExtensionInstanceViewStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MachineExtensionInstanceViewStatus DeserializeMachineExtensionInstanceViewStatus(JsonElement element) + internal static MachineExtensionInstanceViewStatus DeserializeMachineExtensionInstanceViewStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +51,7 @@ internal static MachineExtensionInstanceViewStatus DeserializeMachineExtensionIn Optional displayStatus = default; Optional message = default; Optional time = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -65,8 +87,61 @@ internal static MachineExtensionInstanceViewStatus DeserializeMachineExtensionIn time = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MachineExtensionInstanceViewStatus(code.Value, Optional.ToNullable(level), displayStatus.Value, message.Value, Optional.ToNullable(time), serializedAdditionalRawData); + } + + MachineExtensionInstanceViewStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMachineExtensionInstanceViewStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MachineExtensionInstanceViewStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMachineExtensionInstanceViewStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MachineExtensionInstanceViewStatus model) + { + if (model is null) + { + return null; } - return new MachineExtensionInstanceViewStatus(code.Value, Optional.ToNullable(level), displayStatus.Value, message.Value, Optional.ToNullable(time)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MachineExtensionInstanceViewStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMachineExtensionInstanceViewStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.cs index 2780b60c82ae..1267402bb281 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionInstanceViewStatus.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Instance view status. public partial class MachineExtensionInstanceViewStatus { - /// Initializes a new instance of MachineExtensionInstanceViewStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MachineExtensionInstanceViewStatus() { } - /// Initializes a new instance of MachineExtensionInstanceViewStatus. + /// Initializes a new instance of . /// The status code. /// The level code. /// The short localizable label for the status. /// The detailed status message, including for alerts and error messages. /// The time of the status. - internal MachineExtensionInstanceViewStatus(string code, MachineExtensionStatusLevelType? level, string displayStatus, string message, DateTimeOffset? time) + /// Keeps track of any properties unknown to the library. + internal MachineExtensionInstanceViewStatus(string code, MachineExtensionStatusLevelType? level, string displayStatus, string message, DateTimeOffset? time, Dictionary serializedAdditionalRawData) { Code = code; Level = level; DisplayStatus = displayStatus; Message = message; Time = time; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status code. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.Serialization.cs index 2a2ec8677982..878757e0a0d3 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class MachineExtensionPatch : IUtf8JsonSerializable + public partial class MachineExtensionPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -72,7 +80,168 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MachineExtensionPatch DeserializeMachineExtensionPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional forceUpdateTag = default; + Optional publisher = default; + Optional type = default; + Optional typeHandlerVersion = default; + Optional autoUpgradeMinorVersion = default; + Optional settings = default; + Optional protectedSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("forceUpdateTag"u8)) + { + forceUpdateTag = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("publisher"u8)) + { + publisher = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + type = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("typeHandlerVersion"u8)) + { + typeHandlerVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("autoUpgradeMinorVersion"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoUpgradeMinorVersion = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("settings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + settings = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("protectedSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protectedSettings = BinaryData.FromString(property0.Value.GetRawText()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MachineExtensionPatch(Optional.ToDictionary(tags), forceUpdateTag.Value, publisher.Value, type.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), settings.Value, protectedSettings.Value, serializedAdditionalRawData); + } + + MachineExtensionPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMachineExtensionPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MachineExtensionPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMachineExtensionPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MachineExtensionPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MachineExtensionPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMachineExtensionPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.cs index 73514a9dfc03..841ed6f19f47 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPatch.cs @@ -6,17 +6,39 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Describes a Machine Extension Update. public partial class MachineExtensionPatch : ResourcePatch { - /// Initializes a new instance of MachineExtensionPatch. + /// Initializes a new instance of . public MachineExtensionPatch() { } + /// Initializes a new instance of . + /// Resource tags. + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// The name of the extension handler publisher. + /// Specifies the type of the extension; an example is "CustomScriptExtension". + /// Specifies the version of the script handler. + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// Json formatted public settings for the extension. + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// Keeps track of any properties unknown to the library. + internal MachineExtensionPatch(IDictionary tags, string forceUpdateTag, string publisher, string machineExtensionType, string typeHandlerVersion, bool? autoUpgradeMinorVersion, BinaryData settings, BinaryData protectedSettings, Dictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + { + ForceUpdateTag = forceUpdateTag; + Publisher = publisher; + MachineExtensionType = machineExtensionType; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + Settings = settings; + ProtectedSettings = protectedSettings; + } + /// How the extension handler should be forced to update even if the extension configuration has not changed. public string ForceUpdateTag { get; set; } /// The name of the extension handler publisher. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.Serialization.cs index 491dcf32e8d4..81eeaa865f39 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.Serialization.cs @@ -5,26 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class MachineExtensionPropertiesInstanceView : IUtf8JsonSerializable + public partial class MachineExtensionPropertiesInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); - writer.WriteObjectValue(Status); + if (Status is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Status).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MachineExtensionPropertiesInstanceView DeserializeMachineExtensionPropertiesInstanceView(JsonElement element) + internal static MachineExtensionPropertiesInstanceView DeserializeMachineExtensionPropertiesInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +62,7 @@ internal static MachineExtensionPropertiesInstanceView DeserializeMachineExtensi Optional type = default; Optional typeHandlerVersion = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +89,61 @@ internal static MachineExtensionPropertiesInstanceView DeserializeMachineExtensi status = MachineExtensionInstanceViewStatus.DeserializeMachineExtensionInstanceViewStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MachineExtensionPropertiesInstanceView(name.Value, type.Value, typeHandlerVersion.Value, status.Value, serializedAdditionalRawData); + } + + MachineExtensionPropertiesInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMachineExtensionPropertiesInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MachineExtensionPropertiesInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMachineExtensionPropertiesInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MachineExtensionPropertiesInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MachineExtensionPropertiesInstanceView(Response response) + { + if (response is null) + { + return null; } - return new MachineExtensionPropertiesInstanceView(name.Value, type.Value, typeHandlerVersion.Value, status.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMachineExtensionPropertiesInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.cs index 4c6fd46e2f43..556a7e2aa0e4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionPropertiesInstanceView.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// The machine extension instance view. public partial class MachineExtensionPropertiesInstanceView : MachineExtensionInstanceView { - /// Initializes a new instance of MachineExtensionPropertiesInstanceView. + /// Initializes a new instance of . public MachineExtensionPropertiesInstanceView() { } - /// Initializes a new instance of MachineExtensionPropertiesInstanceView. + /// Initializes a new instance of . /// The machine extension name. /// Specifies the type of the extension; an example is "CustomScriptExtension". /// Specifies the version of the script handler. /// Instance view status. - internal MachineExtensionPropertiesInstanceView(string name, string machineExtensionInstanceViewType, string typeHandlerVersion, MachineExtensionInstanceViewStatus status) : base(name, machineExtensionInstanceViewType, typeHandlerVersion, status) + /// Keeps track of any properties unknown to the library. + internal MachineExtensionPropertiesInstanceView(string name, string machineExtensionInstanceViewType, string typeHandlerVersion, MachineExtensionInstanceViewStatus status, Dictionary serializedAdditionalRawData) : base(name, machineExtensionInstanceViewType, typeHandlerVersion, status, serializedAdditionalRawData) { } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.Serialization.cs index c92c576fc9bf..6e3253a0dc5c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class MachineExtensionsListResult + internal partial class MachineExtensionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MachineExtensionsListResult DeserializeMachineExtensionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MachineExtensionsListResult DeserializeMachineExtensionsListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static MachineExtensionsListResult DeserializeMachineExtensionsListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MachineExtensionsListResult(Optional.ToList(value), nextLink.Value); + return new MachineExtensionsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MachineExtensionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMachineExtensionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MachineExtensionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMachineExtensionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MachineExtensionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MachineExtensionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMachineExtensionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.cs index d11cce463b89..f0c4bce15d17 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/MachineExtensionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Describes the Machine Extensions List Result. internal partial class MachineExtensionsListResult { - /// Initializes a new instance of MachineExtensionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MachineExtensionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MachineExtensionsListResult. + /// Initializes a new instance of . /// The list of extensions. /// The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. - internal MachineExtensionsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MachineExtensionsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of extensions. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.Serialization.cs index 1c81bc465362..bfd408c6c0b2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class NetworkInterface : IUtf8JsonSerializable + public partial class NetworkInterface : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -44,13 +51,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IPSettings)) { writer.WritePropertyName("ipSettings"u8); - writer.WriteObjectValue(IPSettings); + if (IPSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IPSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static NetworkInterface DeserializeNetworkInterface(JsonElement element) + internal static NetworkInterface DeserializeNetworkInterface(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +94,7 @@ internal static NetworkInterface DeserializeNetworkInterface(JsonElement element Optional networkMoName = default; Optional deviceKey = default; Optional ipSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -148,8 +177,61 @@ internal static NetworkInterface DeserializeNetworkInterface(JsonElement element ipSettings = NicIPSettings.DeserializeNicIPSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkInterface(name.Value, label.Value, Optional.ToList(ipAddresses), macAddress.Value, networkId.Value, Optional.ToNullable(nicType), Optional.ToNullable(powerOnBoot), networkMoRefId.Value, networkMoName.Value, Optional.ToNullable(deviceKey), ipSettings.Value, serializedAdditionalRawData); + } + + NetworkInterface IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkInterface(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkInterface IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkInterface(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkInterface model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkInterface(Response response) + { + if (response is null) + { + return null; } - return new NetworkInterface(name.Value, label.Value, Optional.ToList(ipAddresses), macAddress.Value, networkId.Value, Optional.ToNullable(nicType), Optional.ToNullable(powerOnBoot), networkMoRefId.Value, networkMoName.Value, Optional.ToNullable(deviceKey), ipSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkInterface(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.cs index d35ffbc23d99..c08b57b72ef6 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterface.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Network Interface model. public partial class NetworkInterface { - /// Initializes a new instance of NetworkInterface. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkInterface() { IPAddresses = new ChangeTrackingList(); } - /// Initializes a new instance of NetworkInterface. + /// Initializes a new instance of . /// Gets or sets the name of the network interface. /// Gets or sets the label of the virtual network in vCenter that the nic is connected to. /// Gets or sets the nic ip addresses. @@ -34,7 +38,8 @@ public NetworkInterface() /// Gets or sets the name of the virtual network in vCenter that the nic is connected to. /// Gets or sets the device key value. /// Gets or sets the ipsettings. - internal NetworkInterface(string name, string label, IReadOnlyList ipAddresses, string macAddress, string networkId, NICType? nicType, PowerOnBootOption? powerOnBoot, string networkMoRefId, string networkMoName, int? deviceKey, NicIPSettings ipSettings) + /// Keeps track of any properties unknown to the library. + internal NetworkInterface(string name, string label, IReadOnlyList ipAddresses, string macAddress, string networkId, NICType? nicType, PowerOnBootOption? powerOnBoot, string networkMoRefId, string networkMoName, int? deviceKey, NicIPSettings ipSettings, Dictionary serializedAdditionalRawData) { Name = name; Label = label; @@ -47,6 +52,7 @@ internal NetworkInterface(string name, string label, IReadOnlyList ipAdd NetworkMoName = networkMoName; DeviceKey = deviceKey; IPSettings = ipSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the network interface. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.Serialization.cs index 0b8414eb47be..9927e608cb25 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class NetworkInterfaceUpdate : IUtf8JsonSerializable + public partial class NetworkInterfaceUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -40,7 +48,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("deviceKey"u8); writer.WriteNumberValue(DeviceKey.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static NetworkInterfaceUpdate DeserializeNetworkInterfaceUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional networkId = default; + Optional nicType = default; + Optional powerOnBoot = default; + Optional deviceKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkId"u8)) + { + networkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("nicType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nicType = new NICType(property.Value.GetString()); + continue; + } + if (property.NameEquals("powerOnBoot"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + powerOnBoot = new PowerOnBootOption(property.Value.GetString()); + continue; + } + if (property.NameEquals("deviceKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deviceKey = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkInterfaceUpdate(name.Value, networkId.Value, Optional.ToNullable(nicType), Optional.ToNullable(powerOnBoot), Optional.ToNullable(deviceKey), serializedAdditionalRawData); + } + + NetworkInterfaceUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkInterfaceUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkInterfaceUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkInterfaceUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkInterfaceUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkInterfaceUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkInterfaceUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.cs index 3993299d88c9..1fdf995ab3fc 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkInterfaceUpdate.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Defines the network interface update. public partial class NetworkInterfaceUpdate { - /// Initializes a new instance of NetworkInterfaceUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkInterfaceUpdate() { } + /// Initializes a new instance of . + /// Gets or sets the name of the network interface. + /// Gets or sets the ARM Id of the network resource to connect the virtual machine. + /// NIC type. + /// Gets or sets the power on boot. + /// Gets or sets the device key value. + /// Keeps track of any properties unknown to the library. + internal NetworkInterfaceUpdate(string name, string networkId, NICType? nicType, PowerOnBootOption? powerOnBoot, int? deviceKey, Dictionary serializedAdditionalRawData) + { + Name = name; + NetworkId = networkId; + NicType = nicType; + PowerOnBoot = powerOnBoot; + DeviceKey = deviceKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the network interface. public string Name { get; set; } /// Gets or sets the ARM Id of the network resource to connect the virtual machine. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.Serialization.cs index 26be78e103f8..bd2d5a339471 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class NetworkProfile : IUtf8JsonSerializable + internal partial class NetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NetworkInterfaces)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaces) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) + internal static NetworkProfile DeserializeNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> networkInterfaces = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces"u8)) @@ -52,8 +81,61 @@ internal static NetworkProfile DeserializeNetworkProfile(JsonElement element) networkInterfaces = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkProfile(Optional.ToList(networkInterfaces), serializedAdditionalRawData); + } + + NetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkProfile(Response response) + { + if (response is null) + { + return null; } - return new NetworkProfile(Optional.ToList(networkInterfaces)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.cs index 5c1fd254b522..2d300bae8fcc 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the resource properties. internal partial class NetworkProfile { - /// Initializes a new instance of NetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkProfile() { NetworkInterfaces = new ChangeTrackingList(); } - /// Initializes a new instance of NetworkProfile. + /// Initializes a new instance of . /// Gets or sets the list of network interfaces associated with the virtual machine. - internal NetworkProfile(IList networkInterfaces) + /// Keeps track of any properties unknown to the library. + internal NetworkProfile(IList networkInterfaces, Dictionary serializedAdditionalRawData) { NetworkInterfaces = networkInterfaces; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the list of network interfaces associated with the virtual machine. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.Serialization.cs index 55b44e8d0317..ea7348c06d22 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class NetworkProfileUpdate : IUtf8JsonSerializable + internal partial class NetworkProfileUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NetworkInterfaces)) { @@ -21,11 +29,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NetworkInterfaces) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static NetworkProfileUpdate DeserializeNetworkProfileUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkInterfaces = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkInterfaces"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkInterfaceUpdate.DeserializeNetworkInterfaceUpdate(item)); + } + networkInterfaces = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetworkProfileUpdate(Optional.ToList(networkInterfaces), serializedAdditionalRawData); + } + + NetworkProfileUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkProfileUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetworkProfileUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetworkProfileUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetworkProfileUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetworkProfileUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetworkProfileUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.cs index 16856626b803..1690b0882c25 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NetworkProfileUpdate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the update resource properties. internal partial class NetworkProfileUpdate { - /// Initializes a new instance of NetworkProfileUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetworkProfileUpdate() { NetworkInterfaces = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Gets or sets the list of network interfaces associated with the virtual machine. + /// Keeps track of any properties unknown to the library. + internal NetworkProfileUpdate(IList networkInterfaces, Dictionary serializedAdditionalRawData) + { + NetworkInterfaces = networkInterfaces; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the list of network interfaces associated with the virtual machine. public IList NetworkInterfaces { get; } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.Serialization.cs index dfa1f95ff472..c3a393e26b19 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class NicIPAddressSettings + public partial class NicIPAddressSettings : IUtf8JsonSerializable, IModelJsonSerializable { - internal static NicIPAddressSettings DeserializeNicIPAddressSettings(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static NicIPAddressSettings DeserializeNicIPAddressSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static NicIPAddressSettings DeserializeNicIPAddressSettings(JsonElement Optional allocationMethod = default; Optional ipAddress = default; Optional subnetMask = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allocationMethod"u8)) @@ -38,8 +67,61 @@ internal static NicIPAddressSettings DeserializeNicIPAddressSettings(JsonElement subnetMask = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new NicIPAddressSettings(allocationMethod.Value, ipAddress.Value, subnetMask.Value); + return new NicIPAddressSettings(allocationMethod.Value, ipAddress.Value, subnetMask.Value, serializedAdditionalRawData); + } + + NicIPAddressSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNicIPAddressSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NicIPAddressSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNicIPAddressSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NicIPAddressSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NicIPAddressSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNicIPAddressSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.cs index 2825842f7127..b4b8f3c68cb2 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPAddressSettings.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// IP address information for a virtual network adapter reported by the fabric. public partial class NicIPAddressSettings { - /// Initializes a new instance of NicIPAddressSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal NicIPAddressSettings() { } - /// Initializes a new instance of NicIPAddressSettings. + /// Initializes a new instance of . /// Gets the ip address allocation method. /// Gets the ip address for the nic. /// Gets the mask. - internal NicIPAddressSettings(string allocationMethod, string ipAddress, string subnetMask) + /// Keeps track of any properties unknown to the library. + internal NicIPAddressSettings(string allocationMethod, string ipAddress, string subnetMask, Dictionary serializedAdditionalRawData) { AllocationMethod = allocationMethod; IPAddress = ipAddress; SubnetMask = subnetMask; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the ip address allocation method. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.Serialization.cs index 71b987bf8b9e..2fd9017a5b30 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class NicIPSettings : IUtf8JsonSerializable + public partial class NicIPSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllocationMethod)) { @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("subnetMask"u8); writer.WriteStringValue(SubnetMask); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NicIPSettings DeserializeNicIPSettings(JsonElement element) + internal static NicIPSettings DeserializeNicIPSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +89,7 @@ internal static NicIPSettings DeserializeNicIPSettings(JsonElement element) Optional primaryWinsServer = default; Optional secondaryWinsServer = default; Optional> ipAddressInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allocationMethod"u8)) @@ -141,8 +163,61 @@ internal static NicIPSettings DeserializeNicIPSettings(JsonElement element) ipAddressInfo = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NicIPSettings(Optional.ToNullable(allocationMethod), Optional.ToList(dnsServers), Optional.ToList(gateway), ipAddress.Value, subnetMask.Value, primaryWinsServer.Value, secondaryWinsServer.Value, Optional.ToList(ipAddressInfo), serializedAdditionalRawData); + } + + NicIPSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNicIPSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NicIPSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNicIPSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NicIPSettings model) + { + if (model is null) + { + return null; } - return new NicIPSettings(Optional.ToNullable(allocationMethod), Optional.ToList(dnsServers), Optional.ToList(gateway), ipAddress.Value, subnetMask.Value, primaryWinsServer.Value, secondaryWinsServer.Value, Optional.ToList(ipAddressInfo)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NicIPSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNicIPSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.cs index 0644d027db02..47dc1d14f319 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/NicIPSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the network interface ip settings. public partial class NicIPSettings { - /// Initializes a new instance of NicIPSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NicIPSettings() { DnsServers = new ChangeTrackingList(); @@ -21,7 +25,7 @@ public NicIPSettings() IPAddressInfo = new ChangeTrackingList(); } - /// Initializes a new instance of NicIPSettings. + /// Initializes a new instance of . /// Gets or sets the nic allocation method. /// Gets or sets the dns servers. /// Gets or sets the gateway. @@ -30,7 +34,8 @@ public NicIPSettings() /// Gets or sets the primary server. /// Gets or sets the secondary server. /// Gets or sets the IP address information being reported for this NIC. This contains the same IPv4 information above plus IPV6 information. - internal NicIPSettings(IPAddressAllocationMethod? allocationMethod, IList dnsServers, IList gateway, string ipAddress, string subnetMask, string primaryWinsServer, string secondaryWinsServer, IReadOnlyList ipAddressInfo) + /// Keeps track of any properties unknown to the library. + internal NicIPSettings(IPAddressAllocationMethod? allocationMethod, IList dnsServers, IList gateway, string ipAddress, string subnetMask, string primaryWinsServer, string secondaryWinsServer, IReadOnlyList ipAddressInfo, Dictionary serializedAdditionalRawData) { AllocationMethod = allocationMethod; DnsServers = dnsServers; @@ -40,6 +45,7 @@ internal NicIPSettings(IPAddressAllocationMethod? allocationMethod, IList Gets or sets the nic allocation method. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.Serialization.cs index 4af39731e489..869159460a3b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class OSProfile : IUtf8JsonSerializable + public partial class OSProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ComputerName)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("osType"u8); writer.WriteStringValue(OSType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OSProfile DeserializeOSProfile(JsonElement element) + internal static OSProfile DeserializeOSProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +74,7 @@ internal static OSProfile DeserializeOSProfile(JsonElement element) Optional toolsRunningStatus = default; Optional toolsVersionStatus = default; Optional toolsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("computerName"u8)) @@ -98,8 +121,61 @@ internal static OSProfile DeserializeOSProfile(JsonElement element) toolsVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new OSProfile(computerName.Value, adminUsername.Value, adminPassword.Value, Optional.ToNullable(osType), osName.Value, toolsRunningStatus.Value, toolsVersionStatus.Value, toolsVersion.Value, serializedAdditionalRawData); + } + + OSProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSProfile model) + { + if (model is null) + { + return null; } - return new OSProfile(computerName.Value, adminUsername.Value, adminPassword.Value, Optional.ToNullable(osType), osName.Value, toolsRunningStatus.Value, toolsVersionStatus.Value, toolsVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.cs index 4f2fc4ae04b7..bb7329addfe3 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/OSProfile.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Defines the resource properties. public partial class OSProfile { - /// Initializes a new instance of OSProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OSProfile() { } - /// Initializes a new instance of OSProfile. + /// Initializes a new instance of . /// Gets or sets computer name. /// Gets or sets administrator username. /// Gets or sets administrator password. @@ -24,7 +30,8 @@ public OSProfile() /// Gets or sets the current running status of VMware Tools running in the guest operating system. /// Gets or sets the current version status of VMware Tools installed in the guest operating system. /// Gets or sets the current version of VMware Tools. - internal OSProfile(string computerName, string adminUsername, string adminPassword, OSType? osType, string osName, string toolsRunningStatus, string toolsVersionStatus, string toolsVersion) + /// Keeps track of any properties unknown to the library. + internal OSProfile(string computerName, string adminUsername, string adminPassword, OSType? osType, string osName, string toolsRunningStatus, string toolsVersionStatus, string toolsVersion, Dictionary serializedAdditionalRawData) { ComputerName = computerName; AdminUsername = adminUsername; @@ -34,6 +41,7 @@ internal OSProfile(string computerName, string adminUsername, string adminPasswo ToolsRunningStatus = toolsRunningStatus; ToolsVersionStatus = toolsVersionStatus; ToolsVersion = toolsVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets computer name. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.Serialization.cs index 9bad55ba258e..41f44fb01d92 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class PlacementProfile : IUtf8JsonSerializable + public partial class PlacementProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourcePoolId)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("datastoreId"u8); writer.WriteStringValue(DatastoreId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PlacementProfile DeserializePlacementProfile(JsonElement element) + internal static PlacementProfile DeserializePlacementProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static PlacementProfile DeserializePlacementProfile(JsonElement element Optional clusterId = default; Optional hostId = default; Optional datastoreId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourcePoolId"u8)) @@ -70,8 +93,61 @@ internal static PlacementProfile DeserializePlacementProfile(JsonElement element datastoreId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PlacementProfile(resourcePoolId.Value, clusterId.Value, hostId.Value, datastoreId.Value, serializedAdditionalRawData); + } + + PlacementProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlacementProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PlacementProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlacementProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PlacementProfile model) + { + if (model is null) + { + return null; } - return new PlacementProfile(resourcePoolId.Value, clusterId.Value, hostId.Value, datastoreId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PlacementProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlacementProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.cs index 580d56a70b9e..fbb38fcfcda8 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/PlacementProfile.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Defines the resource properties. public partial class PlacementProfile { - /// Initializes a new instance of PlacementProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PlacementProfile() { } - /// Initializes a new instance of PlacementProfile. + /// Initializes a new instance of . /// Gets or sets the ARM Id of the resourcePool resource on which this virtual machine will deploy. /// Gets or sets the ARM Id of the cluster resource on which this virtual machine will deploy. /// Gets or sets the ARM Id of the host resource on which this virtual machine will deploy. /// Gets or sets the ARM Id of the datastore resource on which the data for the virtual machine will be kept. - internal PlacementProfile(string resourcePoolId, string clusterId, string hostId, string datastoreId) + /// Keeps track of any properties unknown to the library. + internal PlacementProfile(string resourcePoolId, string clusterId, string hostId, string datastoreId, Dictionary serializedAdditionalRawData) { ResourcePoolId = resourcePoolId; ClusterId = clusterId; HostId = hostId; DatastoreId = datastoreId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the ARM Id of the resourcePool resource on which this virtual machine will deploy. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.Serialization.cs index d9b051a8b158..74ef36023341 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class ResourcePatch : IUtf8JsonSerializable + public partial class ResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ResourcePatch DeserializeResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourcePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.cs index 57a295ecde96..4f7c4b4869df 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Object containing updates for patch operations. public partial class ResourcePatch { - /// Initializes a new instance of ResourcePatch. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourcePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal ResourcePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolData.Serialization.cs index d24fca7c77e1..c16178d93a3c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class ResourcePoolData : IUtf8JsonSerializable + public partial class ResourcePoolData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(InventoryItemId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourcePoolData DeserializeResourcePoolData(JsonElement element) + internal static ResourcePoolData DeserializeResourcePoolData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +112,7 @@ internal static ResourcePoolData DeserializeResourcePoolData(JsonElement element Optional customResourceName = default; Optional> statuses = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -257,8 +279,61 @@ internal static ResourcePoolData DeserializeResourcePoolData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourcePoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, cpuSharesLevel.Value, Optional.ToNullable(cpuReservationMHz), Optional.ToNullable(cpuLimitMHz), memSharesLevel.Value, Optional.ToNullable(memReservationMB), Optional.ToNullable(memLimitMB), customResourceName.Value, Optional.ToList(statuses), provisioningState.Value, serializedAdditionalRawData); + } + + ResourcePoolData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcePoolData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcePoolData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcePoolData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcePoolData model) + { + if (model is null) + { + return null; } - return new ResourcePoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, cpuSharesLevel.Value, Optional.ToNullable(cpuReservationMHz), Optional.ToNullable(cpuLimitMHz), memSharesLevel.Value, Optional.ToNullable(memReservationMB), Optional.ToNullable(memLimitMB), customResourceName.Value, Optional.ToList(statuses), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcePoolData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcePoolData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.Serialization.cs index bd40002c7526..7b39ea87b9e4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class ResourcePoolsList + internal partial class ResourcePoolsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourcePoolsList DeserializeResourcePoolsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourcePoolsList DeserializeResourcePoolsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static ResourcePoolsList DeserializeResourcePoolsList(JsonElement eleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourcePoolsList(nextLink.Value, value); + return new ResourcePoolsList(nextLink.Value, value, serializedAdditionalRawData); + } + + ResourcePoolsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourcePoolsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourcePoolsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourcePoolsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourcePoolsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourcePoolsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourcePoolsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.cs index 78872e6da918..6fdc2f56b5a4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourcePoolsList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of ResourcePools. internal partial class ResourcePoolsList { - /// Initializes a new instance of ResourcePoolsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of ResourcePools. /// is null. internal ResourcePoolsList(IEnumerable value) @@ -26,13 +29,20 @@ internal ResourcePoolsList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ResourcePoolsList. + /// Initializes a new instance of . /// Url to follow for getting next page of ResourcePools. /// Array of ResourcePools. - internal ResourcePoolsList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ResourcePoolsList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourcePoolsList() + { } /// Url to follow for getting next page of ResourcePools. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.Serialization.cs index bf4943cbe75d..dee12150184e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class ResourceStatus + public partial class ResourceStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ResourceStatus DeserializeResourceStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ResourceStatus DeserializeResourceStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static ResourceStatus DeserializeResourceStatus(JsonElement element) Optional message = default; Optional severity = default; Optional lastUpdatedAt = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -61,8 +89,61 @@ internal static ResourceStatus DeserializeResourceStatus(JsonElement element) lastUpdatedAt = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ResourceStatus(type.Value, status.Value, reason.Value, message.Value, severity.Value, Optional.ToNullable(lastUpdatedAt)); + return new ResourceStatus(type.Value, status.Value, reason.Value, message.Value, severity.Value, Optional.ToNullable(lastUpdatedAt), serializedAdditionalRawData); + } + + ResourceStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.cs index 581ac0bea5a5..48a5484d8d70 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/ResourceStatus.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// The resource status information. public partial class ResourceStatus { - /// Initializes a new instance of ResourceStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ResourceStatus() { } - /// Initializes a new instance of ResourceStatus. + /// Initializes a new instance of . /// The type of the condition. /// Status of the condition. /// The reason for the condition's status. /// A human readable message indicating details about the status. /// Severity with which to treat failures of this type of condition. /// The last update time for this condition. - internal ResourceStatus(string resourceStatusType, string status, string reason, string message, string severity, DateTimeOffset? lastUpdatedOn) + /// Keeps track of any properties unknown to the library. + internal ResourceStatus(string resourceStatusType, string status, string reason, string message, string severity, DateTimeOffset? lastUpdatedOn, Dictionary serializedAdditionalRawData) { ResourceStatusType = resourceStatusType; Status = status; @@ -32,6 +37,7 @@ internal ResourceStatus(string resourceStatusType, string status, string reason, Message = message; Severity = severity; LastUpdatedOn = lastUpdatedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the condition. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.Serialization.cs index 1e823fdf272e..850f08e16e74 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class StopVirtualMachineContent : IUtf8JsonSerializable + public partial class StopVirtualMachineContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SkipShutdown)) { writer.WritePropertyName("skipShutdown"u8); writer.WriteBooleanValue(SkipShutdown.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StopVirtualMachineContent DeserializeStopVirtualMachineContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional skipShutdown = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("skipShutdown"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + skipShutdown = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StopVirtualMachineContent(Optional.ToNullable(skipShutdown), serializedAdditionalRawData); + } + + StopVirtualMachineContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStopVirtualMachineContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StopVirtualMachineContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStopVirtualMachineContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StopVirtualMachineContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StopVirtualMachineContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStopVirtualMachineContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.cs index ecb2e522460e..e883d8eb5e24 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StopVirtualMachineContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Defines the stop action properties. public partial class StopVirtualMachineContent { - /// Initializes a new instance of StopVirtualMachineContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StopVirtualMachineContent() { } + /// Initializes a new instance of . + /// Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. + /// Keeps track of any properties unknown to the library. + internal StopVirtualMachineContent(bool? skipShutdown, Dictionary serializedAdditionalRawData) + { + SkipShutdown = skipShutdown; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. public bool? SkipShutdown { get; set; } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.Serialization.cs index e23166514991..613f583506cd 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class StorageProfile : IUtf8JsonSerializable + public partial class StorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Disks)) { @@ -22,21 +29,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Disks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StorageProfile DeserializeStorageProfile(JsonElement element) + internal static StorageProfile DeserializeStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> disks = default; Optional> scsiControllers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("disks"u8)) @@ -67,8 +96,61 @@ internal static StorageProfile DeserializeStorageProfile(JsonElement element) scsiControllers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StorageProfile(Optional.ToList(disks), Optional.ToList(scsiControllers), serializedAdditionalRawData); + } + + StorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageProfile(Response response) + { + if (response is null) + { + return null; } - return new StorageProfile(Optional.ToList(disks), Optional.ToList(scsiControllers)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.cs index 0507d619a97f..ca644dce7f1d 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the resource properties. public partial class StorageProfile { - /// Initializes a new instance of StorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StorageProfile() { Disks = new ChangeTrackingList(); ScsiControllers = new ChangeTrackingList(); } - /// Initializes a new instance of StorageProfile. + /// Initializes a new instance of . /// Gets or sets the list of virtual disks associated with the virtual machine. /// Gets or sets the list of virtual SCSI controllers associated with the virtual machine. - internal StorageProfile(IList disks, IReadOnlyList scsiControllers) + /// Keeps track of any properties unknown to the library. + internal StorageProfile(IList disks, IReadOnlyList scsiControllers, Dictionary serializedAdditionalRawData) { Disks = disks; ScsiControllers = scsiControllers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the list of virtual disks associated with the virtual machine. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.Serialization.cs index b979858df115..eed0931d8d0c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class StorageProfileUpdate : IUtf8JsonSerializable + internal partial class StorageProfileUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Disks)) { @@ -21,11 +29,113 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Disks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StorageProfileUpdate DeserializeStorageProfileUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> disks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("disks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualDiskUpdate.DeserializeVirtualDiskUpdate(item)); + } + disks = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StorageProfileUpdate(Optional.ToList(disks), serializedAdditionalRawData); + } + + StorageProfileUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageProfileUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageProfileUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageProfileUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageProfileUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageProfileUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageProfileUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.cs index c3a87548efc4..28c1f13871d4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/StorageProfileUpdate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the resource update properties. internal partial class StorageProfileUpdate { - /// Initializes a new instance of StorageProfileUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public StorageProfileUpdate() { Disks = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Gets or sets the list of virtual disks associated with the virtual machine. + /// Keeps track of any properties unknown to the library. + internal StorageProfileUpdate(IList disks, Dictionary serializedAdditionalRawData) + { + Disks = disks; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the list of virtual disks associated with the virtual machine. public IList Disks { get; } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCenterData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCenterData.Serialization.cs index 6bcebf04f6ff..151ea51d713f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCenterData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCenterData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VCenterData : IUtf8JsonSerializable + public partial class VCenterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -54,14 +61,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VCenterData DeserializeVCenterData(JsonElement element) + internal static VCenterData DeserializeVCenterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +112,7 @@ internal static VCenterData DeserializeVCenterData(JsonElement element) Optional credentials = default; Optional> statuses = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -222,8 +251,61 @@ internal static VCenterData DeserializeVCenterData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VCenterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, fqdn, Optional.ToNullable(port), version.Value, instanceUuid.Value, connectionStatus.Value, customResourceName.Value, credentials.Value, Optional.ToList(statuses), provisioningState.Value, serializedAdditionalRawData); + } + + VCenterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVCenterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VCenterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVCenterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VCenterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VCenterData(Response response) + { + if (response is null) + { + return null; } - return new VCenterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, fqdn, Optional.ToNullable(port), version.Value, instanceUuid.Value, connectionStatus.Value, customResourceName.Value, credentials.Value, Optional.ToList(statuses), provisioningState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVCenterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.Serialization.cs index e5519ee39f7d..96d48114d271 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class VCentersList + internal partial class VCentersList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VCentersList DeserializeVCentersList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VCentersList DeserializeVCentersList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static VCentersList DeserializeVCentersList(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VCentersList(nextLink.Value, value); + return new VCentersList(nextLink.Value, value, serializedAdditionalRawData); + } + + VCentersList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVCentersList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VCentersList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVCentersList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VCentersList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VCentersList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVCentersList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.cs index eadd0ad48a0c..4e292c4fb40a 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VCentersList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of VCenters. internal partial class VCentersList { - /// Initializes a new instance of VCentersList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of VCenters. /// is null. internal VCentersList(IEnumerable value) @@ -26,13 +29,20 @@ internal VCentersList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of VCentersList. + /// Initializes a new instance of . /// Url to follow for getting next page of VCenters. /// Array of VCenters. - internal VCentersList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VCentersList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VCentersList() + { } /// Url to follow for getting next page of VCenters. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.Serialization.cs index 8462e6dd4ca3..57ca75429096 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class VICredential : IUtf8JsonSerializable + public partial class VICredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Username)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VICredential DeserializeVICredential(JsonElement element) + internal static VICredential DeserializeVICredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional username = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -48,8 +71,61 @@ internal static VICredential DeserializeVICredential(JsonElement element) password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VICredential(username.Value, password.Value, serializedAdditionalRawData); + } + + VICredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVICredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VICredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVICredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VICredential model) + { + if (model is null) + { + return null; } - return new VICredential(username.Value, password.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VICredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVICredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.cs index 50b4b9f3db27..3050347713c4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VICredential.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Username / Password Credentials to connect to vcenter. public partial class VICredential { - /// Initializes a new instance of VICredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VICredential() { } - /// Initializes a new instance of VICredential. + /// Initializes a new instance of . /// Gets or sets username to connect with the vCenter. /// Gets or sets the password to connect with the vCenter. - internal VICredential(string username, string password) + /// Keeps track of any properties unknown to the library. + internal VICredential(string username, string password, Dictionary serializedAdditionalRawData) { Username = username; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets username to connect with the vCenter. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareClusterData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareClusterData.Serialization.cs index 9340a94b84bc..27179ee69d9d 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareClusterData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareClusterData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VMwareClusterData : IUtf8JsonSerializable + public partial class VMwareClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(InventoryItemId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VMwareClusterData DeserializeVMwareClusterData(JsonElement element) + internal static VMwareClusterData DeserializeVMwareClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +108,7 @@ internal static VMwareClusterData DeserializeVMwareClusterData(JsonElement eleme Optional> datastoreIds = default; Optional> networkIds = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -235,8 +257,61 @@ internal static VMwareClusterData DeserializeVMwareClusterData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VMwareClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, Optional.ToList(datastoreIds), Optional.ToList(networkIds), provisioningState.Value, serializedAdditionalRawData); + } + + VMwareClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVMwareClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VMwareClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVMwareClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VMwareClusterData model) + { + if (model is null) + { + return null; } - return new VMwareClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, Optional.ToList(datastoreIds), Optional.ToList(networkIds), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VMwareClusterData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVMwareClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareDatastoreData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareDatastoreData.Serialization.cs index 44ffb6a67205..dd6fb2760e6e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareDatastoreData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareDatastoreData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VMwareDatastoreData : IUtf8JsonSerializable + public partial class VMwareDatastoreData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(InventoryItemId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VMwareDatastoreData DeserializeVMwareDatastoreData(JsonElement element) + internal static VMwareDatastoreData DeserializeVMwareDatastoreData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +106,7 @@ internal static VMwareDatastoreData DeserializeVMwareDatastoreData(JsonElement e Optional> statuses = default; Optional customResourceName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -209,8 +231,61 @@ internal static VMwareDatastoreData DeserializeVMwareDatastoreData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VMwareDatastoreData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + VMwareDatastoreData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVMwareDatastoreData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VMwareDatastoreData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVMwareDatastoreData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VMwareDatastoreData model) + { + if (model is null) + { + return null; } - return new VMwareDatastoreData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VMwareDatastoreData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVMwareDatastoreData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareHostData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareHostData.Serialization.cs index eb6027a49402..e736c6f95dfd 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareHostData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VMwareHostData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VMwareHostData : IUtf8JsonSerializable + public partial class VMwareHostData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(InventoryItemId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VMwareHostData DeserializeVMwareHostData(JsonElement element) + internal static VMwareHostData DeserializeVMwareHostData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +106,7 @@ internal static VMwareHostData DeserializeVMwareHostData(JsonElement element) Optional> statuses = default; Optional customResourceName = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -205,8 +227,61 @@ internal static VMwareHostData DeserializeVMwareHostData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VMwareHostData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, provisioningState.Value, serializedAdditionalRawData); + } + + VMwareHostData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVMwareHostData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VMwareHostData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVMwareHostData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VMwareHostData model) + { + if (model is null) + { + return null; } - return new VMwareHostData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VMwareHostData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVMwareHostData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.Serialization.cs index dd31b550d76d..91fb176e33e9 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class VirtualDisk : IUtf8JsonSerializable + public partial class VirtualDisk : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -55,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskType"u8); writer.WriteStringValue(DiskType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualDisk DeserializeVirtualDisk(JsonElement element) + internal static VirtualDisk DeserializeVirtualDisk(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +96,7 @@ internal static VirtualDisk DeserializeVirtualDisk(JsonElement element) Optional unitNumber = default; Optional deviceName = default; Optional diskType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -150,8 +173,61 @@ internal static VirtualDisk DeserializeVirtualDisk(JsonElement element) diskType = new DiskType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualDisk(name.Value, label.Value, diskObjectId.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(deviceKey), Optional.ToNullable(diskMode), Optional.ToNullable(controllerKey), Optional.ToNullable(unitNumber), deviceName.Value, Optional.ToNullable(diskType), serializedAdditionalRawData); + } + + VirtualDisk IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualDisk(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualDisk IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualDisk(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualDisk model) + { + if (model is null) + { + return null; } - return new VirtualDisk(name.Value, label.Value, diskObjectId.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(deviceKey), Optional.ToNullable(diskMode), Optional.ToNullable(controllerKey), Optional.ToNullable(unitNumber), deviceName.Value, Optional.ToNullable(diskType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualDisk(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualDisk(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.cs index 9b39a9750793..92000f451ff4 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDisk.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Virtual disk model. public partial class VirtualDisk { - /// Initializes a new instance of VirtualDisk. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualDisk() { } - /// Initializes a new instance of VirtualDisk. + /// Initializes a new instance of . /// Gets or sets the name of the virtual disk. /// Gets or sets the label of the virtual disk in vCenter. /// Gets or sets the disk object id. @@ -26,7 +32,8 @@ public VirtualDisk() /// Gets or sets the unit number of the disk on the controller. /// Gets or sets the device name. /// Gets or sets the disk backing type. - internal VirtualDisk(string name, string label, string diskObjectId, int? diskSizeGB, int? deviceKey, DiskMode? diskMode, int? controllerKey, int? unitNumber, string deviceName, DiskType? diskType) + /// Keeps track of any properties unknown to the library. + internal VirtualDisk(string name, string label, string diskObjectId, int? diskSizeGB, int? deviceKey, DiskMode? diskMode, int? controllerKey, int? unitNumber, string deviceName, DiskType? diskType, Dictionary serializedAdditionalRawData) { Name = name; Label = label; @@ -38,6 +45,7 @@ internal VirtualDisk(string name, string label, string diskObjectId, int? diskSi UnitNumber = unitNumber; DeviceName = deviceName; DiskType = diskType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name of the virtual disk. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.Serialization.cs index 9bdfff29104e..b35b8dc8d1ce 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class VirtualDiskUpdate : IUtf8JsonSerializable + public partial class VirtualDiskUpdate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -55,7 +63,159 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diskType"u8); writer.WriteStringValue(DiskType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualDiskUpdate DeserializeVirtualDiskUpdate(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional diskSizeGB = default; + Optional deviceKey = default; + Optional diskMode = default; + Optional controllerKey = default; + Optional unitNumber = default; + Optional deviceName = default; + Optional diskType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("diskSizeGB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGB = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("deviceKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deviceKey = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("diskMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskMode = new DiskMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("controllerKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + controllerKey = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("unitNumber"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unitNumber = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("deviceName"u8)) + { + deviceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("diskType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskType = new DiskType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualDiskUpdate(name.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(deviceKey), Optional.ToNullable(diskMode), Optional.ToNullable(controllerKey), Optional.ToNullable(unitNumber), deviceName.Value, Optional.ToNullable(diskType), serializedAdditionalRawData); + } + + VirtualDiskUpdate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualDiskUpdate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualDiskUpdate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualDiskUpdate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualDiskUpdate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualDiskUpdate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualDiskUpdate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.cs index 4fef87642891..1facc97e4ee9 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualDiskUpdate.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// Defines the virtual disk update. public partial class VirtualDiskUpdate { - /// Initializes a new instance of VirtualDiskUpdate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualDiskUpdate() { } + /// Initializes a new instance of . + /// Gets or sets the name of the virtual disk. + /// Gets or sets the disk total size. + /// Gets or sets the device key value. + /// Gets or sets the disk mode. + /// Gets or sets the controller id. + /// Gets or sets the unit number of the disk on the controller. + /// Gets or sets the device name. + /// Gets or sets the disk backing type. + /// Keeps track of any properties unknown to the library. + internal VirtualDiskUpdate(string name, int? diskSizeGB, int? deviceKey, DiskMode? diskMode, int? controllerKey, int? unitNumber, string deviceName, DiskType? diskType, Dictionary serializedAdditionalRawData) + { + Name = name; + DiskSizeGB = diskSizeGB; + DeviceKey = deviceKey; + DiskMode = diskMode; + ControllerKey = controllerKey; + UnitNumber = unitNumber; + DeviceName = deviceName; + DiskType = diskType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the name of the virtual disk. public string Name { get; set; } /// Gets or sets the disk total size. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineData.Serialization.cs index 606b66d61224..42d889488f00 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VirtualMachineData : IUtf8JsonSerializable + public partial class VirtualMachineData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -67,32 +74,74 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PlacementProfile)) { writer.WritePropertyName("placementProfile"u8); - writer.WriteObjectValue(PlacementProfile); + if (PlacementProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PlacementProfile).Serialize(writer, options); + } } if (Optional.IsDefined(OSProfile)) { writer.WritePropertyName("osProfile"u8); - writer.WriteObjectValue(OSProfile); + if (OSProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OSProfile).Serialize(writer, options); + } } if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(GuestAgentProfile)) { writer.WritePropertyName("guestAgentProfile"u8); - writer.WriteObjectValue(GuestAgentProfile); + if (GuestAgentProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GuestAgentProfile).Serialize(writer, options); + } } if (Optional.IsDefined(MoRefId)) { @@ -115,11 +164,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(FirmwareType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element) + internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -155,6 +218,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele Optional> statuses = default; Optional provisioningState = default; Optional vmId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -382,8 +446,61 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, identity, resourcePoolId.Value, templateId.Value, vCenterId.Value, placementProfile.Value, osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, guestAgentProfile.Value, moRefId.Value, inventoryItemId.Value, moName.Value, folderPath.Value, instanceUuid.Value, smbiosUuid.Value, Optional.ToNullable(firmwareType), powerState.Value, customResourceName.Value, uuid.Value, Optional.ToList(statuses), provisioningState.Value, vmId.Value, serializedAdditionalRawData); + } + + VirtualMachineData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineData model) + { + if (model is null) + { + return null; } - return new VirtualMachineData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, identity, resourcePoolId.Value, templateId.Value, vCenterId.Value, placementProfile.Value, osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, guestAgentProfile.Value, moRefId.Value, inventoryItemId.Value, moName.Value, folderPath.Value, instanceUuid.Value, smbiosUuid.Value, Optional.ToNullable(firmwareType), powerState.Value, customResourceName.Value, uuid.Value, Optional.ToList(statuses), provisioningState.Value, vmId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.Serialization.cs index 13ae37811e1a..b5d99a84d6b3 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class VirtualMachinePatch : IUtf8JsonSerializable + public partial class VirtualMachinePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,20 +45,188 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HardwareProfile)) { writer.WritePropertyName("hardwareProfile"u8); - writer.WriteObjectValue(HardwareProfile); + if (HardwareProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HardwareProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VirtualMachinePatch DeserializeVirtualMachinePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional hardwareProfile = default; + Optional storageProfile = default; + Optional networkProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("hardwareProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property0.Value); + continue; + } + if (property0.NameEquals("storageProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = StorageProfileUpdate.DeserializeStorageProfileUpdate(property0.Value); + continue; + } + if (property0.NameEquals("networkProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkProfile = NetworkProfileUpdate.DeserializeNetworkProfileUpdate(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachinePatch(Optional.ToDictionary(tags), identity, hardwareProfile.Value, storageProfile.Value, networkProfile.Value, serializedAdditionalRawData); + } + + VirtualMachinePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.cs index 10a89ab6d71b..c1bca30a9679 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,32 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// Defines the virtualMachineUpdate. public partial class VirtualMachinePatch { - /// Initializes a new instance of VirtualMachinePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VirtualMachinePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Gets or sets the Resource tags. + /// The identity of the resource. Current supported identity types: None, SystemAssigned. + /// Defines the resource properties. + /// Defines the resource update properties. + /// Defines the update resource properties. + /// Keeps track of any properties unknown to the library. + internal VirtualMachinePatch(IDictionary tags, ManagedServiceIdentity identity, HardwareProfile hardwareProfile, StorageProfileUpdate storageProfile, NetworkProfileUpdate networkProfile, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + NetworkProfile = networkProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the Resource tags. public IDictionary Tags { get; } /// The identity of the resource. Current supported identity types: None, SystemAssigned. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplateData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplateData.Serialization.cs index 80818848b8bb..fca6fec7da36 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplateData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplateData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VirtualMachineTemplateData : IUtf8JsonSerializable + public partial class VirtualMachineTemplateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(InventoryItemId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualMachineTemplateData DeserializeVirtualMachineTemplateData(JsonElement element) + internal static VirtualMachineTemplateData DeserializeVirtualMachineTemplateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -96,6 +117,7 @@ internal static VirtualMachineTemplateData DeserializeVirtualMachineTemplateData Optional firmwareType = default; Optional> statuses = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -309,8 +331,61 @@ internal static VirtualMachineTemplateData DeserializeVirtualMachineTemplateData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualMachineTemplateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToNullable(memorySizeMB), Optional.ToNullable(numCpus), Optional.ToNullable(numCoresPerSocket), Optional.ToNullable(osType), osName.Value, folderPath.Value, Optional.ToList(networkInterfaces), Optional.ToList(disks), customResourceName.Value, toolsVersionStatus.Value, toolsVersion.Value, Optional.ToNullable(firmwareType), Optional.ToList(statuses), provisioningState.Value, serializedAdditionalRawData); + } + + VirtualMachineTemplateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineTemplateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineTemplateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineTemplateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineTemplateData model) + { + if (model is null) + { + return null; } - return new VirtualMachineTemplateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToNullable(memorySizeMB), Optional.ToNullable(numCpus), Optional.ToNullable(numCoresPerSocket), Optional.ToNullable(osType), osName.Value, folderPath.Value, Optional.ToList(networkInterfaces), Optional.ToList(disks), customResourceName.Value, toolsVersionStatus.Value, toolsVersion.Value, Optional.ToNullable(firmwareType), Optional.ToList(statuses), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineTemplateData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineTemplateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.Serialization.cs index 168ac472fac9..a799f752167e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class VirtualMachineTemplatesList + internal partial class VirtualMachineTemplatesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachineTemplatesList DeserializeVirtualMachineTemplatesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachineTemplatesList DeserializeVirtualMachineTemplatesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachineTemplatesList DeserializeVirtualMachineTemplatesLi value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachineTemplatesList(nextLink.Value, value); + return new VirtualMachineTemplatesList(nextLink.Value, value, serializedAdditionalRawData); + } + + VirtualMachineTemplatesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineTemplatesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachineTemplatesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachineTemplatesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachineTemplatesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachineTemplatesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachineTemplatesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.cs index 4971c662baf8..7d85cd01a28a 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachineTemplatesList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of VirtualMachineTemplates. internal partial class VirtualMachineTemplatesList { - /// Initializes a new instance of VirtualMachineTemplatesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of VirtualMachineTemplates. /// is null. internal VirtualMachineTemplatesList(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachineTemplatesList(IEnumerable val Value = value.ToList(); } - /// Initializes a new instance of VirtualMachineTemplatesList. + /// Initializes a new instance of . /// Url to follow for getting next page of VirtualMachineTemplates. /// Array of VirtualMachineTemplates. - internal VirtualMachineTemplatesList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineTemplatesList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineTemplatesList() + { } /// Url to follow for getting next page of VirtualMachineTemplates. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.Serialization.cs index 2955f38e5988..06e679bcf264 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class VirtualMachinesList + internal partial class VirtualMachinesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement e value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualMachinesList(nextLink.Value, value); + return new VirtualMachinesList(nextLink.Value, value, serializedAdditionalRawData); + } + + VirtualMachinesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachinesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualMachinesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualMachinesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualMachinesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualMachinesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualMachinesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.cs index 50c022007a08..6f5f4779cace 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualMachinesList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of VirtualMachines. internal partial class VirtualMachinesList { - /// Initializes a new instance of VirtualMachinesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of VirtualMachines. /// is null. internal VirtualMachinesList(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualMachinesList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of VirtualMachinesList. + /// Initializes a new instance of . /// Url to follow for getting next page of VirtualMachines. /// Array of VirtualMachines. - internal VirtualMachinesList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualMachinesList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachinesList() + { } /// Url to follow for getting next page of VirtualMachines. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworkData.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworkData.Serialization.cs index 8facdfc28a76..cb580536e54f 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworkData.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworkData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ConnectedVMwarevSphere { - public partial class VirtualNetworkData : IUtf8JsonSerializable + public partial class VirtualNetworkData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { @@ -60,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(InventoryItemId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement element) + internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +106,7 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele Optional customResourceName = default; Optional> statuses = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -205,8 +227,61 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VirtualNetworkData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, customResourceName.Value, Optional.ToList(statuses), provisioningState.Value, serializedAdditionalRawData); + } + + VirtualNetworkData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualNetworkData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualNetworkData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualNetworkData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualNetworkData model) + { + if (model is null) + { + return null; } - return new VirtualNetworkData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, customResourceName.Value, Optional.ToList(statuses), provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualNetworkData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualNetworkData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.Serialization.cs index c4f701f34dd3..13a8cdc65851 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ConnectedVMwarevSphere; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - internal partial class VirtualNetworksList + internal partial class VirtualNetworksList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualNetworksList DeserializeVirtualNetworksList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualNetworksList DeserializeVirtualNetworksList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nextLink = default; IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nextLink"u8)) @@ -39,8 +86,61 @@ internal static VirtualNetworksList DeserializeVirtualNetworksList(JsonElement e value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualNetworksList(nextLink.Value, value); + return new VirtualNetworksList(nextLink.Value, value, serializedAdditionalRawData); + } + + VirtualNetworksList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualNetworksList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualNetworksList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualNetworksList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualNetworksList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualNetworksList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualNetworksList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.cs index 158f1eefd087..123518757223 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualNetworksList.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models /// List of VirtualNetworks. internal partial class VirtualNetworksList { - /// Initializes a new instance of VirtualNetworksList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of VirtualNetworks. /// is null. internal VirtualNetworksList(IEnumerable value) @@ -26,13 +29,20 @@ internal VirtualNetworksList(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of VirtualNetworksList. + /// Initializes a new instance of . /// Url to follow for getting next page of VirtualNetworks. /// Array of VirtualNetworks. - internal VirtualNetworksList(string nextLink, IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal VirtualNetworksList(string nextLink, IReadOnlyList value, Dictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualNetworksList() + { } /// Url to follow for getting next page of VirtualNetworks. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.Serialization.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.Serialization.cs index 77df4841c9fd..96bf8914c535 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.Serialization.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { - public partial class VirtualScsiController + public partial class VirtualScsiController : IUtf8JsonSerializable, IModelJsonSerializable { - internal static VirtualScsiController DeserializeVirtualScsiController(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ScsiControllerType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ScsiControllerType.Value.ToString()); + } + if (Optional.IsDefined(ControllerKey)) + { + writer.WritePropertyName("controllerKey"u8); + writer.WriteNumberValue(ControllerKey.Value); + } + if (Optional.IsDefined(BusNumber)) + { + writer.WritePropertyName("busNumber"u8); + writer.WriteNumberValue(BusNumber.Value); + } + if (Optional.IsDefined(ScsiCtlrUnitNumber)) + { + writer.WritePropertyName("scsiCtlrUnitNumber"u8); + writer.WriteNumberValue(ScsiCtlrUnitNumber.Value); + } + if (Optional.IsDefined(Sharing)) + { + writer.WritePropertyName("sharing"u8); + writer.WriteStringValue(Sharing.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static VirtualScsiController DeserializeVirtualScsiController(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static VirtualScsiController DeserializeVirtualScsiController(JsonEleme Optional busNumber = default; Optional scsiCtlrUnitNumber = default; Optional sharing = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -70,8 +124,61 @@ internal static VirtualScsiController DeserializeVirtualScsiController(JsonEleme sharing = new VirtualScsiSharing(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new VirtualScsiController(Optional.ToNullable(type), Optional.ToNullable(controllerKey), Optional.ToNullable(busNumber), Optional.ToNullable(scsiCtlrUnitNumber), Optional.ToNullable(sharing)); + return new VirtualScsiController(Optional.ToNullable(type), Optional.ToNullable(controllerKey), Optional.ToNullable(busNumber), Optional.ToNullable(scsiCtlrUnitNumber), Optional.ToNullable(sharing), serializedAdditionalRawData); + } + + VirtualScsiController IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualScsiController(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VirtualScsiController IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVirtualScsiController(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VirtualScsiController model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VirtualScsiController(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVirtualScsiController(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.cs index f18f24524524..0ee415295b9b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Models/VirtualScsiController.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { /// This data object type contains the properties of a SCSI controller device attached to a virtual machine that is reported by the controller. public partial class VirtualScsiController { - /// Initializes a new instance of VirtualScsiController. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal VirtualScsiController() { } - /// Initializes a new instance of VirtualScsiController. + /// Initializes a new instance of . /// Gets or sets the controller type. /// Gets or sets the key of the controller. /// Gets or sets the bus number of the controller. /// Gets or sets the SCSI controller unit number. /// Gets or sets the sharing mode. - internal VirtualScsiController(ScsiControllerType? scsiControllerType, int? controllerKey, int? busNumber, int? scsiCtlrUnitNumber, VirtualScsiSharing? sharing) + /// Keeps track of any properties unknown to the library. + internal VirtualScsiController(ScsiControllerType? scsiControllerType, int? controllerKey, int? busNumber, int? scsiCtlrUnitNumber, VirtualScsiSharing? sharing, Dictionary serializedAdditionalRawData) { ScsiControllerType = scsiControllerType; ControllerKey = controllerKey; BusNumber = busNumber; ScsiCtlrUnitNumber = scsiCtlrUnitNumber; Sharing = sharing; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the controller type. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs index 1c828c4af08e..82e3f9c0d6e9 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _resourcePoolRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resourcePoolRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), _resourcePoolClientDiagnostics, Pipeline, "ResourcePoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), _resourcePoolClientDiagnostics, Pipeline, "ResourcePoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _resourcePoolRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resourcePoolRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), _resourcePoolClientDiagnostics, Pipeline, "ResourcePoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), _resourcePoolClientDiagnostics, Pipeline, "ResourcePoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolData.cs index baac38667c47..dfc4c90e6663 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class ResourcePoolData : TrackedResourceData { - /// Initializes a new instance of ResourcePoolData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ResourcePoolData(AzureLocation location) : base(location) { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of ResourcePoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -67,7 +71,8 @@ public ResourcePoolData(AzureLocation location) : base(location) /// Gets the name of the corresponding resource in Kubernetes. /// The resource status information. /// Gets or sets the provisioning state. - internal ResourcePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, string cpuSharesLevel, long? cpuReservationMHz, long? cpuLimitMHz, string memSharesLevel, long? memReservationMB, long? memLimitMB, string customResourceName, IReadOnlyList statuses, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ResourcePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, string cpuSharesLevel, long? cpuReservationMHz, long? cpuLimitMHz, string memSharesLevel, long? memReservationMB, long? memLimitMB, string customResourceName, IReadOnlyList statuses, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -85,6 +90,12 @@ internal ResourcePoolData(ResourceIdentifier id, string name, ResourceType resou CustomResourceName = customResourceName; Statuses = statuses; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourcePoolData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ClustersRestOperations.cs index b2761ae8e3fd..a30995cd5fca 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ClustersRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ClustersRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/DatastoresRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/DatastoresRestOperations.cs index 7c12f49da3db..460e811383ee 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/DatastoresRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/DatastoresRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/GuestAgentsRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/GuestAgentsRestOperations.cs index c9b23786d295..c73151d09aa0 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/GuestAgentsRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/GuestAgentsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HostsRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HostsRestOperations.cs index c63accb4ca8c..48c915d1bc11 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HostsRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HostsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HybridIdentityMetadataRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HybridIdentityMetadataRestOperations.cs index 14eaabed7701..35d0ff6ce9fe 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HybridIdentityMetadataRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/HybridIdentityMetadataRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/InventoryItemsRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/InventoryItemsRestOperations.cs index 80a6c15df4dd..ff5aed297b1b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/InventoryItemsRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/InventoryItemsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/MachineExtensionsRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/MachineExtensionsRestOperations.cs index 3fcc7a88ab55..ac967326080c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/MachineExtensionsRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/MachineExtensionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ResourcePoolsRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ResourcePoolsRestOperations.cs index f8e9dd5e51d7..5c49da106556 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ResourcePoolsRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/ResourcePoolsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VCentersRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VCentersRestOperations.cs index b40ec568d2ff..88d1ab98eef5 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VCentersRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VCentersRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs index 041303b51df2..0ff043b91a6b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachineTemplatesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index fc7662582716..ccb65a0e11a1 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -373,9 +369,7 @@ internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGro if (content != null) { request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; } _userAgent.Apply(message); return message; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualNetworksRestOperations.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualNetworksRestOperations.cs index 91329c84f982..41f650143251 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualNetworksRestOperations.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/RestOperations/VirtualNetworksRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -214,9 +212,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs index b62cc7848a64..eba9e4b50b79 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _vCenterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vCenterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), _vCenterClientDiagnostics, Pipeline, "VCenterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), _vCenterClientDiagnostics, Pipeline, "VCenterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _vCenterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vCenterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), _vCenterClientDiagnostics, Pipeline, "VCenterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), _vCenterClientDiagnostics, Pipeline, "VCenterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterData.cs index b802e9ca4fc7..42b80cd9072c 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VCenterData : TrackedResourceData { - /// Initializes a new instance of VCenterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// Gets or sets the FQDN/IPAddress of the vCenter. /// is null. @@ -32,7 +35,7 @@ public VCenterData(AzureLocation location, string fqdn) : base(location) Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VCenterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -51,7 +54,8 @@ public VCenterData(AzureLocation location, string fqdn) : base(location) /// Username / Password Credentials to connect to vcenter. /// The resource status information. /// Gets or sets the provisioning state. - internal VCenterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string fqdn, int? port, string version, string instanceUuid, string connectionStatus, string customResourceName, VICredential credentials, IReadOnlyList statuses, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VCenterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string fqdn, int? port, string version, string instanceUuid, string connectionStatus, string customResourceName, VICredential credentials, IReadOnlyList statuses, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -65,6 +69,12 @@ internal VCenterData(ResourceIdentifier id, string name, ResourceType resourceTy Credentials = credentials; Statuses = statuses; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VCenterData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs index 233c53f3cce0..bba7f32ee087 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _vMwareClusterClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vMwareClusterClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), _vMwareClusterClustersClientDiagnostics, Pipeline, "VMwareClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), _vMwareClusterClustersClientDiagnostics, Pipeline, "VMwareClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _vMwareClusterClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vMwareClusterClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), _vMwareClusterClustersClientDiagnostics, Pipeline, "VMwareClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), _vMwareClusterClustersClientDiagnostics, Pipeline, "VMwareClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterData.cs index 7953dfa4b2a0..33d70114cc1b 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VMwareClusterData : TrackedResourceData { - /// Initializes a new instance of VMwareClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VMwareClusterData(AzureLocation location) : base(location) { @@ -28,7 +32,7 @@ public VMwareClusterData(AzureLocation location) : base(location) NetworkIds = new ChangeTrackingList(); } - /// Initializes a new instance of VMwareClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +51,8 @@ public VMwareClusterData(AzureLocation location) : base(location) /// Gets or sets the datastore ARM ids. /// Gets or sets the network ARM ids. /// Gets or sets the provisioning state. - internal VMwareClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList statuses, string customResourceName, IReadOnlyList datastoreIds, IReadOnlyList networkIds, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VMwareClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList statuses, string customResourceName, IReadOnlyList datastoreIds, IReadOnlyList networkIds, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -61,6 +66,12 @@ internal VMwareClusterData(ResourceIdentifier id, string name, ResourceType reso DatastoreIds = datastoreIds; NetworkIds = networkIds; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VMwareClusterData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs index fa1cec8c9734..41dbadc57d91 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _vMwareDatastoreDatastoresRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vMwareDatastoreDatastoresRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), _vMwareDatastoreDatastoresClientDiagnostics, Pipeline, "VMwareDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), _vMwareDatastoreDatastoresClientDiagnostics, Pipeline, "VMwareDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _vMwareDatastoreDatastoresRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vMwareDatastoreDatastoresRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), _vMwareDatastoreDatastoresClientDiagnostics, Pipeline, "VMwareDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), _vMwareDatastoreDatastoresClientDiagnostics, Pipeline, "VMwareDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreData.cs index a1454100310e..2d8290d30cb0 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VMwareDatastoreData : TrackedResourceData { - /// Initializes a new instance of VMwareDatastoreData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VMwareDatastoreData(AzureLocation location) : base(location) { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VMwareDatastoreData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +47,8 @@ public VMwareDatastoreData(AzureLocation location) : base(location) /// The resource status information. /// Gets the name of the corresponding resource in Kubernetes. /// Provisioning state of the resource. - internal VMwareDatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList statuses, string customResourceName, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VMwareDatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList statuses, string customResourceName, ProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -55,6 +60,12 @@ internal VMwareDatastoreData(ResourceIdentifier id, string name, ResourceType re Statuses = statuses; CustomResourceName = customResourceName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VMwareDatastoreData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs index 0186116c29a1..e9f7ac78bbb3 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _vMwareHostHostsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vMwareHostHostsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), _vMwareHostHostsClientDiagnostics, Pipeline, "VMwareHostCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), _vMwareHostHostsClientDiagnostics, Pipeline, "VMwareHostCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _vMwareHostHostsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vMwareHostHostsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), _vMwareHostHostsClientDiagnostics, Pipeline, "VMwareHostCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), _vMwareHostHostsClientDiagnostics, Pipeline, "VMwareHostCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostData.cs index fc070ba365cb..3704193bbcb8 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VMwareHostData : TrackedResourceData { - /// Initializes a new instance of VMwareHostData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VMwareHostData(AzureLocation location) : base(location) { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VMwareHostData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +47,8 @@ public VMwareHostData(AzureLocation location) : base(location) /// The resource status information. /// Gets the name of the corresponding resource in Kubernetes. /// Gets or sets the provisioning state. - internal VMwareHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList statuses, string customResourceName, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VMwareHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList statuses, string customResourceName, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -55,6 +60,12 @@ internal VMwareHostData(ResourceIdentifier id, string name, ResourceType resourc Statuses = statuses; CustomResourceName = customResourceName; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VMwareHostData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs index d01f896fb970..4dbae8b7b373 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineData.cs index 3c6af6fcab5a..fa2699c2d660 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VirtualMachineData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineData(AzureLocation location) : base(location) { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -61,7 +65,8 @@ public VirtualMachineData(AzureLocation location) : base(location) /// The resource status information. /// Gets or sets the provisioning state. /// Gets or sets a unique identifier for the vm resource. - internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, ManagedServiceIdentity identity, string resourcePoolId, string templateId, string vCenterId, PlacementProfile placementProfile, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, GuestAgentProfile guestAgentProfile, string moRefId, string inventoryItemId, string moName, string folderPath, string instanceUuid, string smbiosUuid, FirmwareType? firmwareType, string powerState, string customResourceName, string uuid, IReadOnlyList statuses, string provisioningState, string vmId) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, ManagedServiceIdentity identity, string resourcePoolId, string templateId, string vCenterId, PlacementProfile placementProfile, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, GuestAgentProfile guestAgentProfile, string moRefId, string inventoryItemId, string moName, string folderPath, string instanceUuid, string smbiosUuid, FirmwareType? firmwareType, string powerState, string customResourceName, string uuid, IReadOnlyList statuses, string provisioningState, string vmId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -88,6 +93,12 @@ internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType res Statuses = statuses; ProvisioningState = provisioningState; VmId = vmId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs index 67ca65fef900..c2cd324a1f5e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineTemplateRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineTemplateRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), _virtualMachineTemplateClientDiagnostics, Pipeline, "VirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), _virtualMachineTemplateClientDiagnostics, Pipeline, "VirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineTemplateRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineTemplateRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), _virtualMachineTemplateClientDiagnostics, Pipeline, "VirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), _virtualMachineTemplateClientDiagnostics, Pipeline, "VirtualMachineTemplateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateData.cs index 78713fb64b7e..9cb04fb606d7 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VirtualMachineTemplateData : TrackedResourceData { - /// Initializes a new instance of VirtualMachineTemplateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualMachineTemplateData(AzureLocation location) : base(location) { @@ -28,7 +32,7 @@ public VirtualMachineTemplateData(AzureLocation location) : base(location) Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualMachineTemplateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -62,7 +66,8 @@ public VirtualMachineTemplateData(AzureLocation location) : base(location) /// Firmware type. /// The resource status information. /// Gets or sets the provisioning state. - internal VirtualMachineTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, int? memorySizeMB, int? numCpus, int? numCoresPerSocket, OSType? osType, string osName, string folderPath, IReadOnlyList networkInterfaces, IReadOnlyList disks, string customResourceName, string toolsVersionStatus, string toolsVersion, FirmwareType? firmwareType, IReadOnlyList statuses, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualMachineTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, int? memorySizeMB, int? numCpus, int? numCoresPerSocket, OSType? osType, string osName, string folderPath, IReadOnlyList networkInterfaces, IReadOnlyList disks, string customResourceName, string toolsVersionStatus, string toolsVersion, FirmwareType? firmwareType, IReadOnlyList statuses, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -85,6 +90,12 @@ internal VirtualMachineTemplateData(ResourceIdentifier id, string name, Resource FirmwareType = firmwareType; Statuses = statuses; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualMachineTemplateData() + { } /// Gets or sets the extended location. diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs index 7cf5533335be..98c0a83ec379 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualNetworkRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualNetworkRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), _virtualNetworkClientDiagnostics, Pipeline, "VirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), _virtualNetworkClientDiagnostics, Pipeline, "VirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualNetworkRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualNetworkRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), _virtualNetworkClientDiagnostics, Pipeline, "VirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), _virtualNetworkClientDiagnostics, Pipeline, "VirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkData.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkData.cs index 2d1bbc0f427a..478b6791db02 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkData.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ConnectedVMwarevSphere.Models; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// public partial class VirtualNetworkData : TrackedResourceData { - /// Initializes a new instance of VirtualNetworkData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public VirtualNetworkData(AzureLocation location) : base(location) { Statuses = new ChangeTrackingList(); } - /// Initializes a new instance of VirtualNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +47,8 @@ public VirtualNetworkData(AzureLocation location) : base(location) /// Gets the name of the corresponding resource in Kubernetes. /// The resource status information. /// Gets or sets the provisioning state. - internal VirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, string customResourceName, IReadOnlyList statuses, string provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, string customResourceName, IReadOnlyList statuses, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Kind = kind; @@ -55,6 +60,12 @@ internal VirtualNetworkData(ResourceIdentifier id, string name, ResourceType res CustomResourceName = customResourceName; Statuses = statuses; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VirtualNetworkData() + { } /// Gets or sets the extended location. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ArmConsumptionModelFactory.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ArmConsumptionModelFactory.cs index 1f934a50404d..04e0c53ff3fc 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ArmConsumptionModelFactory.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ArmConsumptionModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Consumption.Models /// Model factory for models. public static partial class ArmConsumptionModelFactory { - /// Initializes a new instance of ConsumptionUsageDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,10 +31,10 @@ public static ConsumptionUsageDetail ConsumptionUsageDetail(ResourceIdentifier i { tags ??= new Dictionary(); - return new ConsumptionUsageDetail(id, name, resourceType, systemData, kind, etag, tags); + return new ConsumptionUsageDetail(id, name, resourceType, systemData, kind, etag, tags, default); } - /// Initializes a new instance of ConsumptionMarketplace. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -72,10 +72,10 @@ public static ConsumptionMarketplace ConsumptionMarketplace(ResourceIdentifier i { tags ??= new Dictionary(); - return new ConsumptionMarketplace(id, name, resourceType, systemData, billingPeriodId, usageStartOn, usageEndOn, resourceRate, offerName, resourceGroup, additionalInfo, orderNumber, instanceName, instanceId, currency, consumedQuantity, unitOfMeasure, pretaxCost, isEstimated, meterId, subscriptionGuid, subscriptionName, accountName, departmentName, consumedService, costCenter, additionalProperties, publisherName, planName, isRecurringCharge, etag, tags); + return new ConsumptionMarketplace(id, name, resourceType, systemData, billingPeriodId, usageStartOn, usageEndOn, resourceRate, offerName, resourceGroup, additionalInfo, orderNumber, instanceName, instanceId, currency, consumedQuantity, unitOfMeasure, pretaxCost, isEstimated, meterId, subscriptionGuid, subscriptionName, accountName, departmentName, consumedService, costCenter, additionalProperties, publisherName, planName, isRecurringCharge, etag, tags, default); } - /// Initializes a new instance of ConsumptionBudgetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -94,28 +94,28 @@ public static ConsumptionBudgetData ConsumptionBudgetData(ResourceIdentifier id { notifications ??= new Dictionary(); - return new ConsumptionBudgetData(id, name, resourceType, systemData, category, amount, timeGrain, timePeriod, filter, currentSpend, notifications, forecastSpend, etag); + return new ConsumptionBudgetData(id, name, resourceType, systemData, category, amount, timeGrain, timePeriod, filter, currentSpend, notifications, forecastSpend, etag, default); } - /// Initializes a new instance of BudgetCurrentSpend. + /// Initializes a new instance of . /// The total amount of cost which is being tracked by the budget. /// The unit of measure for the budget amount. /// A new instance for mocking. public static BudgetCurrentSpend BudgetCurrentSpend(decimal? amount = null, string unit = null) { - return new BudgetCurrentSpend(amount, unit); + return new BudgetCurrentSpend(amount, unit, default); } - /// Initializes a new instance of BudgetForecastSpend. + /// Initializes a new instance of . /// The forecasted cost for the total time period which is being tracked by the budget. This value is only provided if the budget contains a forecast alert type. /// The unit of measure for the budget amount. /// A new instance for mocking. public static BudgetForecastSpend BudgetForecastSpend(decimal? amount = null, string unit = null) { - return new BudgetForecastSpend(amount, unit); + return new BudgetForecastSpend(amount, unit, default); } - /// Initializes a new instance of ConsumptionTagsResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -129,10 +129,10 @@ public static ConsumptionTagsResult ConsumptionTagsResult(ResourceIdentifier id { tags ??= new List(); - return new ConsumptionTagsResult(id, name, resourceType, systemData, tags?.ToList(), nextLink, previousLink, etag); + return new ConsumptionTagsResult(id, name, resourceType, systemData, tags?.ToList(), nextLink, previousLink, etag, default); } - /// Initializes a new instance of ConsumptionChargeSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -142,10 +142,10 @@ public static ConsumptionTagsResult ConsumptionTagsResult(ResourceIdentifier id /// A new instance for mocking. public static ConsumptionChargeSummary ConsumptionChargeSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = "Unknown", ETag? etag = null) { - return new ConsumptionChargeSummary(id, name, resourceType, systemData, kind, etag); + return new ConsumptionChargeSummary(id, name, resourceType, systemData, kind, etag, default); } - /// Initializes a new instance of ConsumptionBalanceResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -174,28 +174,28 @@ public static ConsumptionBalanceResult ConsumptionBalanceResult(ResourceIdentifi adjustmentDetails ??= new List(); tags ??= new Dictionary(); - return new ConsumptionBalanceResult(id, name, resourceType, systemData, currency, beginningBalance, endingBalance, newPurchases, adjustments, utilized, serviceOverage, chargesBilledSeparately, totalOverage, totalUsage, azureMarketplaceServiceCharges, billingFrequency, isPriceHidden, newPurchasesDetails?.ToList(), adjustmentDetails?.ToList(), etag, tags); + return new ConsumptionBalanceResult(id, name, resourceType, systemData, currency, beginningBalance, endingBalance, newPurchases, adjustments, utilized, serviceOverage, chargesBilledSeparately, totalOverage, totalUsage, azureMarketplaceServiceCharges, billingFrequency, isPriceHidden, newPurchasesDetails?.ToList(), adjustmentDetails?.ToList(), etag, tags, default); } - /// Initializes a new instance of ConsumptionBalanceNewPurchasesDetail. + /// Initializes a new instance of . /// the name of new purchase. /// the value of new purchase. /// A new instance for mocking. public static ConsumptionBalanceNewPurchasesDetail ConsumptionBalanceNewPurchasesDetail(string name = null, decimal? value = null) { - return new ConsumptionBalanceNewPurchasesDetail(name, value); + return new ConsumptionBalanceNewPurchasesDetail(name, value, default); } - /// Initializes a new instance of ConsumptionBalanceAdjustmentDetail. + /// Initializes a new instance of . /// the name of new adjustment. /// the value of new adjustment. /// A new instance for mocking. public static ConsumptionBalanceAdjustmentDetail ConsumptionBalanceAdjustmentDetail(string name = null, decimal? value = null) { - return new ConsumptionBalanceAdjustmentDetail(name, value); + return new ConsumptionBalanceAdjustmentDetail(name, value, default); } - /// Initializes a new instance of ConsumptionReservationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -222,10 +222,10 @@ public static ConsumptionReservationSummary ConsumptionReservationSummary(Resour { tags ??= new Dictionary(); - return new ConsumptionReservationSummary(id, name, resourceType, systemData, reservationOrderId, reservationId, skuName, reservedHours, useOn, usedHours, minUtilizationPercentage, avgUtilizationPercentage, maxUtilizationPercentage, kind, purchasedQuantity, remainingQuantity, totalReservedQuantity, usedQuantity, utilizedPercentage, etag, tags); + return new ConsumptionReservationSummary(id, name, resourceType, systemData, reservationOrderId, reservationId, skuName, reservedHours, useOn, usedHours, minUtilizationPercentage, avgUtilizationPercentage, maxUtilizationPercentage, kind, purchasedQuantity, remainingQuantity, totalReservedQuantity, usedQuantity, utilizedPercentage, etag, tags, default); } - /// Initializes a new instance of ConsumptionReservationDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -248,10 +248,10 @@ public static ConsumptionReservationDetail ConsumptionReservationDetail(Resource { tags ??= new Dictionary(); - return new ConsumptionReservationDetail(id, name, resourceType, systemData, reservationOrderId, instanceFlexibilityRatio, instanceFlexibilityGroup, reservationId, skuName, reservedHours, consumptionOccurredOn, usedHours, instanceId, totalReservedQuantity, kind, etag, tags); + return new ConsumptionReservationDetail(id, name, resourceType, systemData, reservationOrderId, instanceFlexibilityRatio, instanceFlexibilityGroup, reservationId, skuName, reservedHours, consumptionOccurredOn, usedHours, instanceId, totalReservedQuantity, kind, etag, tags, default); } - /// Initializes a new instance of ConsumptionReservationRecommendation. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -266,10 +266,10 @@ public static ConsumptionReservationRecommendation ConsumptionReservationRecomme { tags ??= new Dictionary(); - return new ConsumptionReservationRecommendation(id, name, resourceType, systemData, kind, etag, tags, location, sku); + return new ConsumptionReservationRecommendation(id, name, resourceType, systemData, kind, etag, tags, location, sku, default); } - /// Initializes a new instance of ConsumptionReservationRecommendationDetails. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -289,10 +289,10 @@ public static ConsumptionReservationRecommendationDetails ConsumptionReservation { tags ??= new Dictionary(); - return new ConsumptionReservationRecommendationDetails(id, name, resourceType, systemData, location, sku, currency, properties, resourceGroup, savings, scope, usage, etag, tags); + return new ConsumptionReservationRecommendationDetails(id, name, resourceType, systemData, location, sku, currency, properties, resourceGroup, savings, scope, usage, etag, tags, default); } - /// Initializes a new instance of ConsumptionResourceProperties. + /// Initializes a new instance of . /// List of subscriptions for which the reservation is applied. /// On demand rate of the resource. /// Azure product ex: Standard_E8s_v3 etc. @@ -304,10 +304,10 @@ public static ConsumptionResourceProperties ConsumptionResourceProperties(IEnume { appliedScopes ??= new List(); - return new ConsumptionResourceProperties(appliedScopes?.ToList(), onDemandRate, product, region, reservationRate, resourceType); + return new ConsumptionResourceProperties(appliedScopes?.ToList(), onDemandRate, product, region, reservationRate, resourceType, default); } - /// Initializes a new instance of ConsumptionSavingsProperties. + /// Initializes a new instance of . /// List of calculated savings. /// Number of days of usage to look back used for computing the recommendation. /// Number of recommended units of the resource. @@ -319,10 +319,10 @@ public static ConsumptionSavingsProperties ConsumptionSavingsProperties(IEnumera { calculatedSavings ??= new List(); - return new ConsumptionSavingsProperties(calculatedSavings?.ToList(), lookBackPeriod, recommendedQuantity, reservationOrderTerm, savingsType, unitOfMeasure); + return new ConsumptionSavingsProperties(calculatedSavings?.ToList(), lookBackPeriod, recommendedQuantity, reservationOrderTerm, savingsType, unitOfMeasure, default); } - /// Initializes a new instance of ConsumptionCalculatedSavingsProperties. + /// Initializes a new instance of . /// The cost without reservation. /// The difference between total reservation cost and reservation cost. /// The quantity for calculated savings. @@ -333,10 +333,10 @@ public static ConsumptionSavingsProperties ConsumptionSavingsProperties(IEnumera /// A new instance for mocking. public static ConsumptionCalculatedSavingsProperties ConsumptionCalculatedSavingsProperties(float? onDemandCost = null, float? overageCost = null, float? quantity = null, float? reservationCost = null, float? totalReservationCost = null, float? reservedUnitCount = null, float? savings = null) { - return new ConsumptionCalculatedSavingsProperties(onDemandCost, overageCost, quantity, reservationCost, totalReservationCost, reservedUnitCount, savings); + return new ConsumptionCalculatedSavingsProperties(onDemandCost, overageCost, quantity, reservationCost, totalReservationCost, reservedUnitCount, savings, default); } - /// Initializes a new instance of ConsumptionUsageProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendation. /// The last usage date used for looking back for computing the recommendation. /// What the usage data values represent ex: virtual machine instance. @@ -347,10 +347,10 @@ public static ConsumptionUsageProperties ConsumptionUsageProperties(string first { usageData ??= new List(); - return new ConsumptionUsageProperties(firstConsumptionDate, lastConsumptionDate, lookBackUnitType, usageData?.ToList(), usageGrain); + return new ConsumptionUsageProperties(firstConsumptionDate, lastConsumptionDate, lookBackUnitType, usageData?.ToList(), usageGrain, default); } - /// Initializes a new instance of ConsumptionReservationTransaction. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -384,10 +384,10 @@ public static ConsumptionReservationTransaction ConsumptionReservationTransactio { tags ??= new List(); - return new ConsumptionReservationTransaction(id, name, resourceType, systemData, transactOn, reservationOrderId, description, eventType, quantity, amount, currency, reservationOrderName, purchasingEnrollment, purchasingSubscriptionGuid, purchasingSubscriptionName, armSkuName, term, region, accountName, accountOwnerEmail, departmentName, costCenter, currentEnrollment, billingFrequency, billingMonth, monetaryCommitment, overage, tags?.ToList()); + return new ConsumptionReservationTransaction(id, name, resourceType, systemData, transactOn, reservationOrderId, description, eventType, quantity, amount, currency, reservationOrderName, purchasingEnrollment, purchasingSubscriptionGuid, purchasingSubscriptionName, armSkuName, term, region, accountName, accountOwnerEmail, departmentName, costCenter, currentEnrollment, billingFrequency, billingMonth, monetaryCommitment, overage, tags?.ToList(), default); } - /// Initializes a new instance of ConsumptionModernReservationTransaction. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -418,10 +418,10 @@ public static ConsumptionModernReservationTransaction ConsumptionModernReservati { tags ??= new List(); - return new ConsumptionModernReservationTransaction(id, name, resourceType, systemData, amount, armSkuName, billingFrequency, billingProfileId, billingProfileName, currency, description, transactOn, eventType, invoice, invoiceId, invoiceSectionId, invoiceSectionName, purchasingSubscriptionGuid, purchasingSubscriptionName, quantity, region, reservationOrderId, reservationOrderName, term, tags?.ToList()); + return new ConsumptionModernReservationTransaction(id, name, resourceType, systemData, amount, armSkuName, billingFrequency, billingProfileId, billingProfileName, currency, description, transactOn, eventType, invoice, invoiceId, invoiceSectionId, invoiceSectionName, purchasingSubscriptionGuid, purchasingSubscriptionName, quantity, region, reservationOrderId, reservationOrderName, term, tags?.ToList(), default); } - /// Initializes a new instance of PriceSheetResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -437,10 +437,10 @@ public static PriceSheetResult PriceSheetResult(ResourceIdentifier id = null, st pricesheets ??= new List(); tags ??= new Dictionary(); - return new PriceSheetResult(id, name, resourceType, systemData, pricesheets?.ToList(), nextLink, download, etag, tags); + return new PriceSheetResult(id, name, resourceType, systemData, pricesheets?.ToList(), nextLink, download, etag, tags, default); } - /// Initializes a new instance of PriceSheetProperties. + /// Initializes a new instance of . /// The id of the billing period resource that the usage belongs to. /// The meter id (GUID). /// The details about the meter. By default this is not populated, unless it's specified in $expand. @@ -453,10 +453,10 @@ public static PriceSheetResult PriceSheetResult(ResourceIdentifier id = null, st /// A new instance for mocking. public static PriceSheetProperties PriceSheetProperties(ResourceIdentifier billingPeriodId = null, Guid? meterId = null, ConsumptionMeterDetails meterDetails = null, string unitOfMeasure = null, decimal? includedQuantity = null, string partNumber = null, decimal? unitPrice = null, string currencyCode = null, string offerId = null) { - return new PriceSheetProperties(billingPeriodId, meterId, meterDetails, unitOfMeasure, includedQuantity, partNumber, unitPrice, currencyCode, offerId); + return new PriceSheetProperties(billingPeriodId, meterId, meterDetails, unitOfMeasure, includedQuantity, partNumber, unitPrice, currencyCode, offerId, default); } - /// Initializes a new instance of ConsumptionMeterDetails. + /// Initializes a new instance of . /// The name of the meter, within the given meter category. /// The category of the meter, for example, 'Cloud services', 'Networking', etc.. /// The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. @@ -469,10 +469,10 @@ public static PriceSheetProperties PriceSheetProperties(ResourceIdentifier billi /// A new instance for mocking. public static ConsumptionMeterDetails ConsumptionMeterDetails(string meterName = null, string meterCategory = null, string meterSubCategory = null, string unit = null, string meterLocation = null, decimal? totalIncludedQuantity = null, decimal? pretaxStandardRate = null, string serviceName = null, string serviceTier = null) { - return new ConsumptionMeterDetails(meterName, meterCategory, meterSubCategory, unit, meterLocation, totalIncludedQuantity, pretaxStandardRate, serviceName, serviceTier); + return new ConsumptionMeterDetails(meterName, meterCategory, meterSubCategory, unit, meterLocation, totalIncludedQuantity, pretaxStandardRate, serviceName, serviceTier, default); } - /// Initializes a new instance of ConsumptionAggregatedCostResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -497,10 +497,10 @@ public static ConsumptionAggregatedCostResult ConsumptionAggregatedCostResult(Re excludedSubscriptions ??= new List(); tags ??= new Dictionary(); - return new ConsumptionAggregatedCostResult(id, name, resourceType, systemData, billingPeriodId, usageStartOn, usageEndOn, azureCharges, marketplaceCharges, chargesBilledSeparately, currency, children?.ToList(), includedSubscriptions?.ToList(), excludedSubscriptions?.ToList(), etag, tags); + return new ConsumptionAggregatedCostResult(id, name, resourceType, systemData, billingPeriodId, usageStartOn, usageEndOn, azureCharges, marketplaceCharges, chargesBilledSeparately, currency, children?.ToList(), includedSubscriptions?.ToList(), excludedSubscriptions?.ToList(), etag, tags, default); } - /// Initializes a new instance of ConsumptionEventSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -531,28 +531,28 @@ public static ConsumptionAggregatedCostResult ConsumptionAggregatedCostResult(Re /// A new instance for mocking. public static ConsumptionEventSummary ConsumptionEventSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? transactOn = null, string description = null, ConsumptionAmount newCredit = null, ConsumptionAmount adjustments = null, ConsumptionAmount creditExpired = null, ConsumptionAmount charges = null, ConsumptionAmount closedBalance = null, ConsumptionEventType? eventType = null, string invoiceNumber = null, ResourceIdentifier billingProfileId = null, string billingProfileDisplayName = null, ResourceIdentifier lotId = null, string lotSource = null, ConsumptionAmount canceledCredit = null, string creditCurrency = null, string billingCurrency = null, ConsumptionReseller reseller = null, ConsumptionAmountWithExchangeRate creditExpiredInBillingCurrency = null, ConsumptionAmountWithExchangeRate newCreditInBillingCurrency = null, ConsumptionAmountWithExchangeRate adjustmentsInBillingCurrency = null, ConsumptionAmountWithExchangeRate chargesInBillingCurrency = null, ConsumptionAmountWithExchangeRate closedBalanceInBillingCurrency = null, ETag? etag = null) { - return new ConsumptionEventSummary(id, name, resourceType, systemData, transactOn, description, newCredit, adjustments, creditExpired, charges, closedBalance, eventType, invoiceNumber, billingProfileId, billingProfileDisplayName, lotId, lotSource, canceledCredit, creditCurrency, billingCurrency, reseller, creditExpiredInBillingCurrency, newCreditInBillingCurrency, adjustmentsInBillingCurrency, chargesInBillingCurrency, closedBalanceInBillingCurrency, etag); + return new ConsumptionEventSummary(id, name, resourceType, systemData, transactOn, description, newCredit, adjustments, creditExpired, charges, closedBalance, eventType, invoiceNumber, billingProfileId, billingProfileDisplayName, lotId, lotSource, canceledCredit, creditCurrency, billingCurrency, reseller, creditExpiredInBillingCurrency, newCreditInBillingCurrency, adjustmentsInBillingCurrency, chargesInBillingCurrency, closedBalanceInBillingCurrency, etag, default); } - /// Initializes a new instance of ConsumptionAmount. + /// Initializes a new instance of . /// Amount currency. /// Amount. /// A new instance for mocking. public static ConsumptionAmount ConsumptionAmount(string currency = null, decimal? value = null) { - return new ConsumptionAmount(currency, value); + return new ConsumptionAmount(currency, value, default); } - /// Initializes a new instance of ConsumptionReseller. + /// Initializes a new instance of . /// The reseller property ID. /// The reseller property description. /// A new instance for mocking. public static ConsumptionReseller ConsumptionReseller(ResourceIdentifier resellerId = null, string resellerDescription = null) { - return new ConsumptionReseller(resellerId, resellerDescription); + return new ConsumptionReseller(resellerId, resellerDescription, default); } - /// Initializes a new instance of ConsumptionAmountWithExchangeRate. + /// Initializes a new instance of . /// Amount currency. /// Amount. /// The exchange rate. @@ -560,10 +560,10 @@ public static ConsumptionReseller ConsumptionReseller(ResourceIdentifier reselle /// A new instance for mocking. public static ConsumptionAmountWithExchangeRate ConsumptionAmountWithExchangeRate(string currency = null, decimal? value = null, decimal? exchangeRate = null, int? exchangeRateMonth = null) { - return new ConsumptionAmountWithExchangeRate(currency, value, exchangeRate, exchangeRateMonth); + return new ConsumptionAmountWithExchangeRate(currency, value, exchangeRate, exchangeRateMonth, default); } - /// Initializes a new instance of ConsumptionLotSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -585,10 +585,10 @@ public static ConsumptionAmountWithExchangeRate ConsumptionAmountWithExchangeRat /// A new instance for mocking. public static ConsumptionLotSummary ConsumptionLotSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ConsumptionAmount originalAmount = null, ConsumptionAmount closedBalance = null, ConsumptionLotSource? source = null, DateTimeOffset? startOn = null, DateTimeOffset? expireOn = null, string poNumber = null, DateTimeOffset? purchasedOn = null, ConsumptionLotStatus? status = null, string creditCurrency = null, string billingCurrency = null, ConsumptionAmountWithExchangeRate originalAmountInBillingCurrency = null, ConsumptionAmountWithExchangeRate closedBalanceInBillingCurrency = null, ConsumptionReseller reseller = null, ETag? etag = null) { - return new ConsumptionLotSummary(id, name, resourceType, systemData, originalAmount, closedBalance, source, startOn, expireOn, poNumber, purchasedOn, status, creditCurrency, billingCurrency, originalAmountInBillingCurrency, closedBalanceInBillingCurrency, reseller, etag); + return new ConsumptionLotSummary(id, name, resourceType, systemData, originalAmount, closedBalance, source, startOn, expireOn, poNumber, purchasedOn, status, creditCurrency, billingCurrency, originalAmountInBillingCurrency, closedBalanceInBillingCurrency, reseller, etag, default); } - /// Initializes a new instance of ConsumptionCreditSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -604,20 +604,20 @@ public static ConsumptionLotSummary ConsumptionLotSummary(ResourceIdentifier id /// A new instance for mocking. public static ConsumptionCreditSummary ConsumptionCreditSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CreditBalanceSummary balanceSummary = null, ConsumptionAmount pendingCreditAdjustments = null, ConsumptionAmount expiredCredit = null, ConsumptionAmount pendingEligibleCharges = null, string creditCurrency = null, string billingCurrency = null, ConsumptionReseller reseller = null, ETag? etag = null) { - return new ConsumptionCreditSummary(id, name, resourceType, systemData, balanceSummary, pendingCreditAdjustments, expiredCredit, pendingEligibleCharges, creditCurrency, billingCurrency, reseller, etag); + return new ConsumptionCreditSummary(id, name, resourceType, systemData, balanceSummary, pendingCreditAdjustments, expiredCredit, pendingEligibleCharges, creditCurrency, billingCurrency, reseller, etag, default); } - /// Initializes a new instance of CreditBalanceSummary. + /// Initializes a new instance of . /// Estimated balance. /// Current balance. /// Estimated balance in billing currency. /// A new instance for mocking. public static CreditBalanceSummary CreditBalanceSummary(ConsumptionAmount estimatedBalance = null, ConsumptionAmount currentBalance = null, ConsumptionAmountWithExchangeRate estimatedBalanceInBillingCurrency = null) { - return new CreditBalanceSummary(estimatedBalance, currentBalance, estimatedBalanceInBillingCurrency); + return new CreditBalanceSummary(estimatedBalance, currentBalance, estimatedBalanceInBillingCurrency, default); } - /// Initializes a new instance of ConsumptionLegacyUsageDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -675,10 +675,10 @@ public static ConsumptionLegacyUsageDetail ConsumptionLegacyUsageDetail(Resource { tags ??= new Dictionary(); - return new ConsumptionLegacyUsageDetail(id, name, resourceType, systemData, UsageDetailsKind.Legacy, etag, tags, billingAccountId, billingAccountName, billingPeriodStartOn, billingPeriodEndOn, billingProfileId, billingProfileName, accountOwnerId, accountName, subscriptionId, subscriptionName, @on, product, partNumber, meterId, meterDetails, quantity, effectivePrice, cost, unitPrice, billingCurrency, resourceLocation, consumedService, resourceId, resourceName, serviceInfo1, serviceInfo2, additionalInfo, invoiceSection, costCenter, resourceGroup, reservationId, reservationName, productOrderId, productOrderName, offerId, isAzureCreditEligible, term, publisherName, publisherType, planName, chargeType, frequency, payGPrice, benefitId, benefitName, pricingModel); + return new ConsumptionLegacyUsageDetail(id, name, resourceType, systemData, UsageDetailsKind.Legacy, etag, tags, billingAccountId, billingAccountName, billingPeriodStartOn, billingPeriodEndOn, billingProfileId, billingProfileName, accountOwnerId, accountName, subscriptionId, subscriptionName, @on, product, partNumber, meterId, meterDetails, quantity, effectivePrice, cost, unitPrice, billingCurrency, resourceLocation, consumedService, resourceId, resourceName, serviceInfo1, serviceInfo2, additionalInfo, invoiceSection, costCenter, resourceGroup, reservationId, reservationName, productOrderId, productOrderName, offerId, isAzureCreditEligible, term, publisherName, publisherType, planName, chargeType, frequency, payGPrice, benefitId, benefitName, pricingModel, default); } - /// Initializes a new instance of ConsumptionMeterDetailsInfo. + /// Initializes a new instance of . /// The name of the meter, within the given meter category. /// The category of the meter, for example, 'Cloud services', 'Networking', etc.. /// The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. @@ -687,10 +687,10 @@ public static ConsumptionLegacyUsageDetail ConsumptionLegacyUsageDetail(Resource /// A new instance for mocking. public static ConsumptionMeterDetailsInfo ConsumptionMeterDetailsInfo(string meterName = null, string meterCategory = null, string meterSubCategory = null, string unitOfMeasure = null, string serviceFamily = null) { - return new ConsumptionMeterDetailsInfo(meterName, meterCategory, meterSubCategory, unitOfMeasure, serviceFamily); + return new ConsumptionMeterDetailsInfo(meterName, meterCategory, meterSubCategory, unitOfMeasure, serviceFamily, default); } - /// Initializes a new instance of ConsumptionModernUsageDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -774,19 +774,19 @@ public static ConsumptionModernUsageDetail ConsumptionModernUsageDetail(Resource { tags ??= new Dictionary(); - return new ConsumptionModernUsageDetail(id, name, resourceType, systemData, UsageDetailsKind.Modern, etag, tags, billingAccountId, effectivePrice, pricingModel, billingAccountName, billingPeriodStartOn, billingPeriodEndOn, billingProfileId, billingProfileName, subscriptionGuid, subscriptionName, @on, product, meterId, meterName, meterRegion, meterCategory, meterSubCategory, serviceFamily, quantity, unitOfMeasure, instanceName, costInUSD, unitPrice, billingCurrencyCode, resourceLocation, consumedService, serviceInfo1, serviceInfo2, additionalInfo, invoiceSectionId, invoiceSectionName, costCenter, resourceGroup, reservationId, reservationName, productOrderId, productOrderName, isAzureCreditEligible, term, publisherName, publisherType, chargeType, frequency, costInBillingCurrency, costInPricingCurrency, exchangeRate, exchangeRateOn, invoiceId, previousInvoiceId, pricingCurrencyCode, productIdentifier, resourceLocationNormalized, servicePeriodStartOn, servicePeriodEndOn, customerTenantId, customerName, partnerTenantId, partnerName, resellerMpnId, resellerName, publisherId, marketPrice, exchangeRatePricingToBilling, paygCostInBillingCurrency, paygCostInUSD, partnerEarnedCreditRate, partnerEarnedCreditApplied, payGPrice, benefitId, benefitName, provider, costAllocationRuleName); + return new ConsumptionModernUsageDetail(id, name, resourceType, systemData, UsageDetailsKind.Modern, etag, tags, billingAccountId, effectivePrice, pricingModel, billingAccountName, billingPeriodStartOn, billingPeriodEndOn, billingProfileId, billingProfileName, subscriptionGuid, subscriptionName, @on, product, meterId, meterName, meterRegion, meterCategory, meterSubCategory, serviceFamily, quantity, unitOfMeasure, instanceName, costInUSD, unitPrice, billingCurrencyCode, resourceLocation, consumedService, serviceInfo1, serviceInfo2, additionalInfo, invoiceSectionId, invoiceSectionName, costCenter, resourceGroup, reservationId, reservationName, productOrderId, productOrderName, isAzureCreditEligible, term, publisherName, publisherType, chargeType, frequency, costInBillingCurrency, costInPricingCurrency, exchangeRate, exchangeRateOn, invoiceId, previousInvoiceId, pricingCurrencyCode, productIdentifier, resourceLocationNormalized, servicePeriodStartOn, servicePeriodEndOn, customerTenantId, customerName, partnerTenantId, partnerName, resellerMpnId, resellerName, publisherId, marketPrice, exchangeRatePricingToBilling, paygCostInBillingCurrency, paygCostInUSD, partnerEarnedCreditRate, partnerEarnedCreditApplied, payGPrice, benefitId, benefitName, provider, costAllocationRuleName, default); } - /// Initializes a new instance of ConsumptionSkuProperty. + /// Initializes a new instance of . /// The name of sku property. /// The value of sku property. /// A new instance for mocking. public static ConsumptionSkuProperty ConsumptionSkuProperty(string name = null, string value = null) { - return new ConsumptionSkuProperty(name, value); + return new ConsumptionSkuProperty(name, value, default); } - /// Initializes a new instance of ConsumptionModernReservationRecommendation. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -817,10 +817,10 @@ public static ConsumptionModernReservationRecommendation ConsumptionModernReserv tags ??= new Dictionary(); skuProperties ??= new List(); - return new ConsumptionModernReservationRecommendation(id, name, resourceType, systemData, ReservationRecommendationKind.Modern, etag, tags, location, sku, locationPropertiesLocation, lookBackPeriod, instanceFlexibilityRatio, instanceFlexibilityGroup, normalizedSize, recommendedQuantityNormalized, meterId, term, costWithNoReservedInstances, recommendedQuantity, totalCostWithReservedInstances, netSavings, firstUsageOn, scope, skuProperties?.ToList(), skuName); + return new ConsumptionModernReservationRecommendation(id, name, resourceType, systemData, ReservationRecommendationKind.Modern, etag, tags, location, sku, locationPropertiesLocation, lookBackPeriod, instanceFlexibilityRatio, instanceFlexibilityGroup, normalizedSize, recommendedQuantityNormalized, meterId, term, costWithNoReservedInstances, recommendedQuantity, totalCostWithReservedInstances, netSavings, firstUsageOn, scope, skuProperties?.ToList(), skuName, default); } - /// Initializes a new instance of ConsumptionLegacyChargeSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -836,10 +836,10 @@ public static ConsumptionModernReservationRecommendation ConsumptionModernReserv /// A new instance for mocking. public static ConsumptionLegacyChargeSummary ConsumptionLegacyChargeSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, string billingPeriodId = null, string usageStart = null, string usageEnd = null, decimal? azureCharges = null, decimal? chargesBilledSeparately = null, decimal? marketplaceCharges = null, string currency = null) { - return new ConsumptionLegacyChargeSummary(id, name, resourceType, systemData, ChargeSummaryKind.Legacy, etag, billingPeriodId, usageStart, usageEnd, azureCharges, chargesBilledSeparately, marketplaceCharges, currency); + return new ConsumptionLegacyChargeSummary(id, name, resourceType, systemData, ChargeSummaryKind.Legacy, etag, billingPeriodId, usageStart, usageEnd, azureCharges, chargesBilledSeparately, marketplaceCharges, currency, default); } - /// Initializes a new instance of ConsumptionModernChargeSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -859,7 +859,7 @@ public static ConsumptionLegacyChargeSummary ConsumptionLegacyChargeSummary(Reso /// A new instance for mocking. public static ConsumptionModernChargeSummary ConsumptionModernChargeSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, string billingPeriodId = null, string usageStart = null, string usageEnd = null, ConsumptionAmount azureCharges = null, ConsumptionAmount chargesBilledSeparately = null, ConsumptionAmount marketplaceCharges = null, string billingAccountId = null, string billingProfileId = null, string invoiceSectionId = null, string customerId = null, bool? isInvoiced = null) { - return new ConsumptionModernChargeSummary(id, name, resourceType, systemData, ChargeSummaryKind.Modern, etag, billingPeriodId, usageStart, usageEnd, azureCharges, chargesBilledSeparately, marketplaceCharges, billingAccountId, billingProfileId, invoiceSectionId, customerId, isInvoiced); + return new ConsumptionModernChargeSummary(id, name, resourceType, systemData, ChargeSummaryKind.Modern, etag, billingPeriodId, usageStart, usageEnd, azureCharges, chargesBilledSeparately, marketplaceCharges, billingAccountId, billingProfileId, invoiceSectionId, customerId, isInvoiced, default); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs index 6654fa441e03..49147de61d52 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetCollection.cs @@ -218,7 +218,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _consumptionBudgetBudgetsRestClient.CreateListRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _consumptionBudgetBudgetsRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConsumptionBudgetResource(Client, ConsumptionBudgetData.DeserializeConsumptionBudgetData(e)), _consumptionBudgetBudgetsClientDiagnostics, Pipeline, "ConsumptionBudgetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConsumptionBudgetResource(Client, ConsumptionBudgetData.DeserializeConsumptionBudgetData(e)), _consumptionBudgetBudgetsClientDiagnostics, Pipeline, "ConsumptionBudgetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -240,7 +240,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _consumptionBudgetBudgetsRestClient.CreateListRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _consumptionBudgetBudgetsRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConsumptionBudgetResource(Client, ConsumptionBudgetData.DeserializeConsumptionBudgetData(e)), _consumptionBudgetBudgetsClientDiagnostics, Pipeline, "ConsumptionBudgetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConsumptionBudgetResource(Client, ConsumptionBudgetData.DeserializeConsumptionBudgetData(e)), _consumptionBudgetBudgetsClientDiagnostics, Pipeline, "ConsumptionBudgetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetData.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetData.cs index 39ef6c41f159..34389adaebff 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetData.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Consumption /// public partial class ConsumptionBudgetData : ResourceData { - /// Initializes a new instance of ConsumptionBudgetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionBudgetData() { Notifications = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionBudgetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public ConsumptionBudgetData() /// Dictionary of notifications associated with the budget. Budget can have up to five notifications. /// The forecasted cost which is being tracked for a budget. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ConsumptionBudgetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BudgetCategory? category, decimal? amount, BudgetTimeGrainType? timeGrain, BudgetTimePeriod timePeriod, ConsumptionBudgetFilter filter, BudgetCurrentSpend currentSpend, IDictionary notifications, BudgetForecastSpend forecastSpend, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionBudgetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BudgetCategory? category, decimal? amount, BudgetTimeGrainType? timeGrain, BudgetTimePeriod timePeriod, ConsumptionBudgetFilter filter, BudgetCurrentSpend currentSpend, IDictionary notifications, BudgetForecastSpend forecastSpend, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Category = category; Amount = amount; @@ -50,6 +55,7 @@ internal ConsumptionBudgetData(ResourceIdentifier id, string name, ResourceType Notifications = notifications; ForecastSpend = forecastSpend; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The category of the budget, whether the budget tracks cost or usage. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ArmResourceGetConsumptionReservationsSummariesOptions.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ArmResourceGetConsumptionReservationsSummariesOptions.cs index 3b0be70054bc..71d7e463fbc1 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ArmResourceGetConsumptionReservationsSummariesOptions.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ArmResourceGetConsumptionReservationsSummariesOptions.cs @@ -17,6 +17,11 @@ public ArmResourceGetConsumptionReservationsSummariesOptions(ReservationSummaryD Grain = grain; } + /// Initializes a new instance of for deserialization. + internal ArmResourceGetConsumptionReservationsSummariesOptions() + { + } + /// Can be daily or monthly. public ReservationSummaryDataGrain Grain { get; } /// Start date. Only applicable when querying with billing profile. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.Serialization.cs index a521c8440a96..581e69fc2844 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class BudgetAssociatedNotification : IUtf8JsonSerializable + public partial class BudgetAssociatedNotification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled); @@ -59,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("locale"u8); writer.WriteStringValue(Locale.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BudgetAssociatedNotification DeserializeBudgetAssociatedNotification(JsonElement element) + internal static BudgetAssociatedNotification DeserializeBudgetAssociatedNotification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -76,6 +97,7 @@ internal static BudgetAssociatedNotification DeserializeBudgetAssociatedNotifica Optional> contactGroups = default; Optional thresholdType = default; Optional locale = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -149,8 +171,61 @@ internal static BudgetAssociatedNotification DeserializeBudgetAssociatedNotifica locale = new RecipientNotificationLanguageCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BudgetAssociatedNotification(enabled, @operator, threshold, contactEmails, Optional.ToList(contactRoles), Optional.ToList(contactGroups), Optional.ToNullable(thresholdType), Optional.ToNullable(locale), serializedAdditionalRawData); + } + + BudgetAssociatedNotification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetAssociatedNotification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetAssociatedNotification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetAssociatedNotification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetAssociatedNotification model) + { + if (model is null) + { + return null; } - return new BudgetAssociatedNotification(enabled, @operator, threshold, contactEmails, Optional.ToList(contactRoles), Optional.ToList(contactGroups), Optional.ToNullable(thresholdType), Optional.ToNullable(locale)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetAssociatedNotification(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetAssociatedNotification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.cs index 6bad29fd95a4..9a4a5fc45635 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetAssociatedNotification.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Consumption.Models /// The notification associated with a budget. public partial class BudgetAssociatedNotification { - /// Initializes a new instance of BudgetAssociatedNotification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The notification is enabled or not. /// The comparison operator. /// Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000. @@ -33,7 +36,7 @@ public BudgetAssociatedNotification(bool isEnabled, NotificationAlertTriggerType ContactGroups = new ChangeTrackingList(); } - /// Initializes a new instance of BudgetAssociatedNotification. + /// Initializes a new instance of . /// The notification is enabled or not. /// The comparison operator. /// Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000. @@ -42,7 +45,8 @@ public BudgetAssociatedNotification(bool isEnabled, NotificationAlertTriggerType /// Action groups to send the budget notification to when the threshold is exceeded. Must be provided as a fully qualified Azure resource id. Only supported at Subscription or Resource Group scopes. /// The type of threshold. /// Language in which the recipient will receive the notification. - internal BudgetAssociatedNotification(bool isEnabled, NotificationAlertTriggerType @operator, decimal threshold, IList contactEmails, IList contactRoles, IList contactGroups, NotificationThresholdType? thresholdType, RecipientNotificationLanguageCode? locale) + /// Keeps track of any properties unknown to the library. + internal BudgetAssociatedNotification(bool isEnabled, NotificationAlertTriggerType @operator, decimal threshold, IList contactEmails, IList contactRoles, IList contactGroups, NotificationThresholdType? thresholdType, RecipientNotificationLanguageCode? locale, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Operator = @operator; @@ -52,6 +56,12 @@ internal BudgetAssociatedNotification(bool isEnabled, NotificationAlertTriggerTy ContactGroups = contactGroups; ThresholdType = thresholdType; Locale = locale; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BudgetAssociatedNotification() + { } /// The notification is enabled or not. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.Serialization.cs index 3eafb219c84b..7d974581dbb1 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class BudgetComparisonExpression : IUtf8JsonSerializable + public partial class BudgetComparisonExpression : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BudgetComparisonExpression DeserializeBudgetComparisonExpression(JsonElement element) + internal static BudgetComparisonExpression DeserializeBudgetComparisonExpression(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static BudgetComparisonExpression DeserializeBudgetComparisonExpression string name = default; BudgetOperatorType @operator = default; IList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -61,8 +83,61 @@ internal static BudgetComparisonExpression DeserializeBudgetComparisonExpression values = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BudgetComparisonExpression(name, @operator, values, serializedAdditionalRawData); + } + + BudgetComparisonExpression IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetComparisonExpression(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetComparisonExpression IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetComparisonExpression(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetComparisonExpression model) + { + if (model is null) + { + return null; } - return new BudgetComparisonExpression(name, @operator, values); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetComparisonExpression(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetComparisonExpression(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.cs index 672b47f87d57..394de2ada3c8 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetComparisonExpression.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.Consumption.Models /// The comparison expression to be used in the budgets. public partial class BudgetComparisonExpression { - /// Initializes a new instance of BudgetComparisonExpression. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to use in comparison. /// The operator to use for comparison. /// Array of values to use for comparison. @@ -30,15 +33,22 @@ public BudgetComparisonExpression(string name, BudgetOperatorType @operator, IEn Values = values.ToList(); } - /// Initializes a new instance of BudgetComparisonExpression. + /// Initializes a new instance of . /// The name of the column to use in comparison. /// The operator to use for comparison. /// Array of values to use for comparison. - internal BudgetComparisonExpression(string name, BudgetOperatorType @operator, IList values) + /// Keeps track of any properties unknown to the library. + internal BudgetComparisonExpression(string name, BudgetOperatorType @operator, IList values, Dictionary serializedAdditionalRawData) { Name = name; Operator = @operator; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BudgetComparisonExpression() + { } /// The name of the column to use in comparison. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.Serialization.cs index a79bdefda0c6..60503da10701 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class BudgetCurrentSpend + public partial class BudgetCurrentSpend : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BudgetCurrentSpend DeserializeBudgetCurrentSpend(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BudgetCurrentSpend DeserializeBudgetCurrentSpend(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional amount = default; Optional unit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("amount"u8)) @@ -36,8 +65,61 @@ internal static BudgetCurrentSpend DeserializeBudgetCurrentSpend(JsonElement ele unit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BudgetCurrentSpend(Optional.ToNullable(amount), unit.Value); + return new BudgetCurrentSpend(Optional.ToNullable(amount), unit.Value, serializedAdditionalRawData); + } + + BudgetCurrentSpend IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetCurrentSpend(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetCurrentSpend IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetCurrentSpend(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetCurrentSpend model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetCurrentSpend(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetCurrentSpend(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.cs index d284c9ad0233..e6c8b5f5cdac 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetCurrentSpend.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The current amount of cost which is being tracked for a budget. public partial class BudgetCurrentSpend { - /// Initializes a new instance of BudgetCurrentSpend. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BudgetCurrentSpend() { } - /// Initializes a new instance of BudgetCurrentSpend. + /// Initializes a new instance of . /// The total amount of cost which is being tracked by the budget. /// The unit of measure for the budget amount. - internal BudgetCurrentSpend(decimal? amount, string unit) + /// Keeps track of any properties unknown to the library. + internal BudgetCurrentSpend(decimal? amount, string unit, Dictionary serializedAdditionalRawData) { Amount = amount; Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The total amount of cost which is being tracked by the budget. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.Serialization.cs index dbfa8d60c9ca..187e46dc775f 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class BudgetFilterProperties : IUtf8JsonSerializable + public partial class BudgetFilterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Dimensions)) { writer.WritePropertyName("dimensions"u8); - writer.WriteObjectValue(Dimensions); + if (Dimensions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dimensions).Serialize(writer, options); + } } if (Optional.IsDefined(Tags)) { writer.WritePropertyName("tags"u8); - writer.WriteObjectValue(Tags); + if (Tags is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tags).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static BudgetFilterProperties DeserializeBudgetFilterProperties(JsonElement element) + internal static BudgetFilterProperties DeserializeBudgetFilterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional dimensions = default; Optional tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dimensions"u8)) @@ -56,8 +93,61 @@ internal static BudgetFilterProperties DeserializeBudgetFilterProperties(JsonEle tags = BudgetComparisonExpression.DeserializeBudgetComparisonExpression(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BudgetFilterProperties(dimensions.Value, tags.Value, serializedAdditionalRawData); + } + + BudgetFilterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetFilterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetFilterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetFilterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetFilterProperties model) + { + if (model is null) + { + return null; } - return new BudgetFilterProperties(dimensions.Value, tags.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetFilterProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetFilterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.cs index e8fd81518e2f..8e629087e037 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetFilterProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The Dimensions or Tags to filter a budget by. public partial class BudgetFilterProperties { - /// Initializes a new instance of BudgetFilterProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BudgetFilterProperties() { } - /// Initializes a new instance of BudgetFilterProperties. + /// Initializes a new instance of . /// Has comparison expression for a dimension. /// Has comparison expression for a tag. - internal BudgetFilterProperties(BudgetComparisonExpression dimensions, BudgetComparisonExpression tags) + /// Keeps track of any properties unknown to the library. + internal BudgetFilterProperties(BudgetComparisonExpression dimensions, BudgetComparisonExpression tags, Dictionary serializedAdditionalRawData) { Dimensions = dimensions; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Has comparison expression for a dimension. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.Serialization.cs index da32dd82d766..cb6ce48ce809 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class BudgetForecastSpend + public partial class BudgetForecastSpend : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BudgetForecastSpend DeserializeBudgetForecastSpend(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BudgetForecastSpend DeserializeBudgetForecastSpend(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional amount = default; Optional unit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("amount"u8)) @@ -36,8 +65,61 @@ internal static BudgetForecastSpend DeserializeBudgetForecastSpend(JsonElement e unit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BudgetForecastSpend(Optional.ToNullable(amount), unit.Value); + return new BudgetForecastSpend(Optional.ToNullable(amount), unit.Value, serializedAdditionalRawData); + } + + BudgetForecastSpend IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetForecastSpend(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetForecastSpend IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetForecastSpend(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetForecastSpend model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetForecastSpend(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetForecastSpend(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.cs index ce4439c5642f..824975ea5b68 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetForecastSpend.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The forecasted cost which is being tracked for a budget. public partial class BudgetForecastSpend { - /// Initializes a new instance of BudgetForecastSpend. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BudgetForecastSpend() { } - /// Initializes a new instance of BudgetForecastSpend. + /// Initializes a new instance of . /// The forecasted cost for the total time period which is being tracked by the budget. This value is only provided if the budget contains a forecast alert type. /// The unit of measure for the budget amount. - internal BudgetForecastSpend(decimal? amount, string unit) + /// Keeps track of any properties unknown to the library. + internal BudgetForecastSpend(decimal? amount, string unit, Dictionary serializedAdditionalRawData) { Amount = amount; Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The forecasted cost for the total time period which is being tracked by the budget. This value is only provided if the budget contains a forecast alert type. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.Serialization.cs index d601c6e13fb5..4c6bb156ee67 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class BudgetTimePeriod : IUtf8JsonSerializable + public partial class BudgetTimePeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("startDate"u8); writer.WriteStringValue(StartOn, "O"); @@ -23,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endDate"u8); writer.WriteStringValue(EndOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BudgetTimePeriod DeserializeBudgetTimePeriod(JsonElement element) + internal static BudgetTimePeriod DeserializeBudgetTimePeriod(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset startDate = default; Optional endDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("startDate"u8)) @@ -50,8 +72,61 @@ internal static BudgetTimePeriod DeserializeBudgetTimePeriod(JsonElement element endDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BudgetTimePeriod(startDate, Optional.ToNullable(endDate), serializedAdditionalRawData); + } + + BudgetTimePeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetTimePeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetTimePeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetTimePeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetTimePeriod model) + { + if (model is null) + { + return null; } - return new BudgetTimePeriod(startDate, Optional.ToNullable(endDate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetTimePeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetTimePeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.cs index e8e92461a696..11e27cb87201 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetTimePeriod.cs @@ -6,26 +6,37 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Consumption.Models { /// The start and end date for a budget. public partial class BudgetTimePeriod { - /// Initializes a new instance of BudgetTimePeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date for the budget. public BudgetTimePeriod(DateTimeOffset startOn) { StartOn = startOn; } - /// Initializes a new instance of BudgetTimePeriod. + /// Initializes a new instance of . /// The start date for the budget. /// The end date for the budget. If not provided, we default this to 10 years from the start date. - internal BudgetTimePeriod(DateTimeOffset startOn, DateTimeOffset? endOn) + /// Keeps track of any properties unknown to the library. + internal BudgetTimePeriod(DateTimeOffset startOn, DateTimeOffset? endOn, Dictionary serializedAdditionalRawData) { StartOn = startOn; EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BudgetTimePeriod() + { } /// The start date for the budget. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.Serialization.cs index 3369a11540ae..1e437a79d4a4 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Consumption; namespace Azure.ResourceManager.Consumption.Models { - internal partial class BudgetsListResult + internal partial class BudgetsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BudgetsListResult DeserializeBudgetsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BudgetsListResult DeserializeBudgetsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static BudgetsListResult DeserializeBudgetsListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BudgetsListResult(Optional.ToList(value), nextLink.Value); + return new BudgetsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BudgetsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BudgetsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBudgetsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BudgetsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BudgetsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBudgetsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.cs index 3d11414a3f47..28faf35b1161 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/BudgetsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Consumption; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing budgets. It contains a list of available budgets in the scope provided. internal partial class BudgetsListResult { - /// Initializes a new instance of BudgetsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BudgetsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BudgetsListResult. + /// Initializes a new instance of . /// The list of budgets. /// The link (url) to the next page of results. - internal BudgetsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BudgetsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of budgets. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.Serialization.cs index b37466ae4a2d..994a884ad7fa 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class ChargesListResult + internal partial class ChargesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChargesListResult DeserializeChargesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChargesListResult DeserializeChargesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static ChargesListResult DeserializeChargesListResult(JsonElement eleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChargesListResult(Optional.ToList(value)); + return new ChargesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ChargesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChargesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChargesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChargesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChargesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChargesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChargesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.cs index 48a26a053999..f124e5a9e4cf 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ChargesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing charge summary. internal partial class ChargesListResult { - /// Initializes a new instance of ChargesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ChargesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ChargesListResult. + /// Initializes a new instance of . /// /// The list of charge summary /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal ChargesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ChargesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.Serialization.cs index dc3049aca22c..0a9549210147 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.Serialization.cs @@ -10,14 +10,79 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionAggregatedCostResult + public partial class ConsumptionAggregatedCostResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionAggregatedCostResult DeserializeConsumptionAggregatedCostResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Children)) + { + writer.WritePropertyName("children"u8); + writer.WriteStartArray(); + foreach (var item in Children) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IncludedSubscriptions)) + { + writer.WritePropertyName("includedSubscriptions"u8); + writer.WriteStartArray(); + foreach (var item in IncludedSubscriptions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExcludedSubscriptions)) + { + writer.WritePropertyName("excludedSubscriptions"u8); + writer.WriteStartArray(); + foreach (var item in ExcludedSubscriptions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionAggregatedCostResult DeserializeConsumptionAggregatedCostResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +103,7 @@ internal static ConsumptionAggregatedCostResult DeserializeConsumptionAggregated Optional> children = default; Optional> includedSubscriptions = default; Optional> excludedSubscriptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -196,8 +262,61 @@ internal static ConsumptionAggregatedCostResult DeserializeConsumptionAggregated } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionAggregatedCostResult(id, name, type, systemData.Value, billingPeriodId.Value, Optional.ToNullable(usageStart), Optional.ToNullable(usageEnd), Optional.ToNullable(azureCharges), Optional.ToNullable(marketplaceCharges), Optional.ToNullable(chargesBilledSeparately), currency.Value, Optional.ToList(children), Optional.ToList(includedSubscriptions), Optional.ToList(excludedSubscriptions), Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new ConsumptionAggregatedCostResult(id, name, type, systemData.Value, billingPeriodId.Value, Optional.ToNullable(usageStart), Optional.ToNullable(usageEnd), Optional.ToNullable(azureCharges), Optional.ToNullable(marketplaceCharges), Optional.ToNullable(chargesBilledSeparately), currency.Value, Optional.ToList(children), Optional.ToList(includedSubscriptions), Optional.ToList(excludedSubscriptions), Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionAggregatedCostResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionAggregatedCostResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionAggregatedCostResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionAggregatedCostResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionAggregatedCostResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionAggregatedCostResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionAggregatedCostResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.cs index 7af803a15366..d2675bc2a66e 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAggregatedCostResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.Consumption.Models /// A management group aggregated cost resource. public partial class ConsumptionAggregatedCostResult : ResourceData { - /// Initializes a new instance of ConsumptionAggregatedCostResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionAggregatedCostResult() { Children = new ChangeTrackingList(); @@ -25,7 +28,7 @@ internal ConsumptionAggregatedCostResult() Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionAggregatedCostResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +45,8 @@ internal ConsumptionAggregatedCostResult() /// List of subscription Guids excluded from the calculation of aggregated cost. /// The etag for the resource. /// Resource tags. - internal ConsumptionAggregatedCostResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string billingPeriodId, DateTimeOffset? usageStartOn, DateTimeOffset? usageEndOn, decimal? azureCharges, decimal? marketplaceCharges, decimal? chargesBilledSeparately, string currency, IReadOnlyList children, IReadOnlyList includedSubscriptions, IReadOnlyList excludedSubscriptions, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionAggregatedCostResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string billingPeriodId, DateTimeOffset? usageStartOn, DateTimeOffset? usageEndOn, decimal? azureCharges, decimal? marketplaceCharges, decimal? chargesBilledSeparately, string currency, IReadOnlyList children, IReadOnlyList includedSubscriptions, IReadOnlyList excludedSubscriptions, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { BillingPeriodId = billingPeriodId; UsageStartOn = usageStartOn; @@ -56,6 +60,7 @@ internal ConsumptionAggregatedCostResult(ResourceIdentifier id, string name, Res ExcludedSubscriptions = excludedSubscriptions; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the billing period resource that the aggregated cost belongs to. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.Serialization.cs index 2b3166146449..fac81498b929 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionAmount + public partial class ConsumptionAmount : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionAmount DeserializeConsumptionAmount(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionAmount DeserializeConsumptionAmount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional currency = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("currency"u8)) @@ -36,8 +65,61 @@ internal static ConsumptionAmount DeserializeConsumptionAmount(JsonElement eleme value = property.Value.GetDecimal(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionAmount(currency.Value, Optional.ToNullable(value)); + return new ConsumptionAmount(currency.Value, Optional.ToNullable(value), serializedAdditionalRawData); + } + + ConsumptionAmount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionAmount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionAmount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionAmount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionAmount model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionAmount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionAmount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.cs index b0960cb43df9..8a90579c75e3 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmount.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The amount plus currency . public partial class ConsumptionAmount { - /// Initializes a new instance of ConsumptionAmount. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionAmount() { } - /// Initializes a new instance of ConsumptionAmount. + /// Initializes a new instance of . /// Amount currency. /// Amount. - internal ConsumptionAmount(string currency, decimal? value) + /// Keeps track of any properties unknown to the library. + internal ConsumptionAmount(string currency, decimal? value, Dictionary serializedAdditionalRawData) { Currency = currency; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Amount currency. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.Serialization.cs index eebceb97597b..0f8e750c39fa 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionAmountWithExchangeRate + public partial class ConsumptionAmountWithExchangeRate : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionAmountWithExchangeRate DeserializeConsumptionAmountWithExchangeRate(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionAmountWithExchangeRate DeserializeConsumptionAmountWithExchangeRate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static ConsumptionAmountWithExchangeRate DeserializeConsumptionAmountWi Optional exchangeRateMonth = default; Optional currency = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("exchangeRate"u8)) @@ -56,8 +85,61 @@ internal static ConsumptionAmountWithExchangeRate DeserializeConsumptionAmountWi value = property.Value.GetDecimal(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionAmountWithExchangeRate(currency.Value, Optional.ToNullable(value), Optional.ToNullable(exchangeRate), Optional.ToNullable(exchangeRateMonth)); + return new ConsumptionAmountWithExchangeRate(currency.Value, Optional.ToNullable(value), Optional.ToNullable(exchangeRate), Optional.ToNullable(exchangeRateMonth), serializedAdditionalRawData); + } + + ConsumptionAmountWithExchangeRate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionAmountWithExchangeRate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionAmountWithExchangeRate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionAmountWithExchangeRate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionAmountWithExchangeRate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionAmountWithExchangeRate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionAmountWithExchangeRate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.cs index 25738ef5b9b5..702cbc9852d3 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionAmountWithExchangeRate.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The amount with exchange rate. public partial class ConsumptionAmountWithExchangeRate : ConsumptionAmount { - /// Initializes a new instance of ConsumptionAmountWithExchangeRate. + /// Initializes a new instance of . internal ConsumptionAmountWithExchangeRate() { } - /// Initializes a new instance of ConsumptionAmountWithExchangeRate. + /// Initializes a new instance of . /// Amount currency. /// Amount. /// The exchange rate. /// The exchange rate month. - internal ConsumptionAmountWithExchangeRate(string currency, decimal? value, decimal? exchangeRate, int? exchangeRateMonth) : base(currency, value) + /// Keeps track of any properties unknown to the library. + internal ConsumptionAmountWithExchangeRate(string currency, decimal? value, decimal? exchangeRate, int? exchangeRateMonth, Dictionary serializedAdditionalRawData) : base(currency, value, serializedAdditionalRawData) { ExchangeRate = exchangeRate; ExchangeRateMonth = exchangeRateMonth; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.Serialization.cs index a246b6fcdcb6..973e42e3b625 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionBalanceAdjustmentDetail + public partial class ConsumptionBalanceAdjustmentDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionBalanceAdjustmentDetail DeserializeConsumptionBalanceAdjustmentDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionBalanceAdjustmentDetail DeserializeConsumptionBalanceAdjustmentDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +65,61 @@ internal static ConsumptionBalanceAdjustmentDetail DeserializeConsumptionBalance value = property.Value.GetDecimal(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionBalanceAdjustmentDetail(name.Value, Optional.ToNullable(value)); + return new ConsumptionBalanceAdjustmentDetail(name.Value, Optional.ToNullable(value), serializedAdditionalRawData); + } + + ConsumptionBalanceAdjustmentDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionBalanceAdjustmentDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionBalanceAdjustmentDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionBalanceAdjustmentDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionBalanceAdjustmentDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionBalanceAdjustmentDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionBalanceAdjustmentDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.cs index 54b27708d861..4cbec585323b 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceAdjustmentDetail.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The ConsumptionBalanceAdjustmentDetail. public partial class ConsumptionBalanceAdjustmentDetail { - /// Initializes a new instance of ConsumptionBalanceAdjustmentDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionBalanceAdjustmentDetail() { } - /// Initializes a new instance of ConsumptionBalanceAdjustmentDetail. + /// Initializes a new instance of . /// the name of new adjustment. /// the value of new adjustment. - internal ConsumptionBalanceAdjustmentDetail(string name, decimal? value) + /// Keeps track of any properties unknown to the library. + internal ConsumptionBalanceAdjustmentDetail(string name, decimal? value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// the name of new adjustment. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.Serialization.cs index a56ef0cd5093..b7577c67f979 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionBalanceNewPurchasesDetail + public partial class ConsumptionBalanceNewPurchasesDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionBalanceNewPurchasesDetail DeserializeConsumptionBalanceNewPurchasesDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionBalanceNewPurchasesDetail DeserializeConsumptionBalanceNewPurchasesDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +65,61 @@ internal static ConsumptionBalanceNewPurchasesDetail DeserializeConsumptionBalan value = property.Value.GetDecimal(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionBalanceNewPurchasesDetail(name.Value, Optional.ToNullable(value)); + return new ConsumptionBalanceNewPurchasesDetail(name.Value, Optional.ToNullable(value), serializedAdditionalRawData); + } + + ConsumptionBalanceNewPurchasesDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionBalanceNewPurchasesDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionBalanceNewPurchasesDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionBalanceNewPurchasesDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionBalanceNewPurchasesDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionBalanceNewPurchasesDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionBalanceNewPurchasesDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.cs index fd4c08c175eb..be90f8788e38 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceNewPurchasesDetail.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The ConsumptionBalanceNewPurchasesDetail. public partial class ConsumptionBalanceNewPurchasesDetail { - /// Initializes a new instance of ConsumptionBalanceNewPurchasesDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionBalanceNewPurchasesDetail() { } - /// Initializes a new instance of ConsumptionBalanceNewPurchasesDetail. + /// Initializes a new instance of . /// the name of new purchase. /// the value of new purchase. - internal ConsumptionBalanceNewPurchasesDetail(string name, decimal? value) + /// Keeps track of any properties unknown to the library. + internal ConsumptionBalanceNewPurchasesDetail(string name, decimal? value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// the name of new purchase. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.Serialization.cs index 21c1f6151d37..b14cdd868d2c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.Serialization.cs @@ -5,18 +5,52 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionBalanceResult + public partial class ConsumptionBalanceResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionBalanceResult DeserializeConsumptionBalanceResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(BillingFrequency)) + { + writer.WritePropertyName("billingFrequency"u8); + writer.WriteStringValue(BillingFrequency.Value.ToString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionBalanceResult DeserializeConsumptionBalanceResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +76,7 @@ internal static ConsumptionBalanceResult DeserializeConsumptionBalanceResult(Jso Optional priceHidden = default; Optional> newPurchasesDetails = default; Optional> adjustmentDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -244,8 +279,61 @@ internal static ConsumptionBalanceResult DeserializeConsumptionBalanceResult(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionBalanceResult(id, name, type, systemData.Value, currency.Value, Optional.ToNullable(beginningBalance), Optional.ToNullable(endingBalance), Optional.ToNullable(newPurchases), Optional.ToNullable(adjustments), Optional.ToNullable(utilized), Optional.ToNullable(serviceOverage), Optional.ToNullable(chargesBilledSeparately), Optional.ToNullable(totalOverage), Optional.ToNullable(totalUsage), Optional.ToNullable(azureMarketplaceServiceCharges), Optional.ToNullable(billingFrequency), Optional.ToNullable(priceHidden), Optional.ToList(newPurchasesDetails), Optional.ToList(adjustmentDetails), Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new ConsumptionBalanceResult(id, name, type, systemData.Value, currency.Value, Optional.ToNullable(beginningBalance), Optional.ToNullable(endingBalance), Optional.ToNullable(newPurchases), Optional.ToNullable(adjustments), Optional.ToNullable(utilized), Optional.ToNullable(serviceOverage), Optional.ToNullable(chargesBilledSeparately), Optional.ToNullable(totalOverage), Optional.ToNullable(totalUsage), Optional.ToNullable(azureMarketplaceServiceCharges), Optional.ToNullable(billingFrequency), Optional.ToNullable(priceHidden), Optional.ToList(newPurchasesDetails), Optional.ToList(adjustmentDetails), Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionBalanceResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionBalanceResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionBalanceResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionBalanceResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionBalanceResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionBalanceResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionBalanceResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.cs index 9247a0df93f7..7b41d2b8554e 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBalanceResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -15,7 +16,10 @@ namespace Azure.ResourceManager.Consumption.Models /// A balance resource. public partial class ConsumptionBalanceResult : ResourceData { - /// Initializes a new instance of ConsumptionBalanceResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionBalanceResult() { NewPurchasesDetails = new ChangeTrackingList(); @@ -23,7 +27,7 @@ internal ConsumptionBalanceResult() Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionBalanceResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ internal ConsumptionBalanceResult() /// List of Adjustments (Promo credit, SIE credit etc.). /// The etag for the resource. /// Resource tags. - internal ConsumptionBalanceResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string currency, decimal? beginningBalance, decimal? endingBalance, decimal? newPurchases, decimal? adjustments, decimal? utilized, decimal? serviceOverage, decimal? chargesBilledSeparately, decimal? totalOverage, decimal? totalUsage, decimal? azureMarketplaceServiceCharges, ConsumptionBillingFrequency? billingFrequency, bool? isPriceHidden, IReadOnlyList newPurchasesDetails, IReadOnlyList adjustmentDetails, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionBalanceResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string currency, decimal? beginningBalance, decimal? endingBalance, decimal? newPurchases, decimal? adjustments, decimal? utilized, decimal? serviceOverage, decimal? chargesBilledSeparately, decimal? totalOverage, decimal? totalUsage, decimal? azureMarketplaceServiceCharges, ConsumptionBillingFrequency? billingFrequency, bool? isPriceHidden, IReadOnlyList newPurchasesDetails, IReadOnlyList adjustmentDetails, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Currency = currency; BeginningBalance = beginningBalance; @@ -64,6 +69,7 @@ internal ConsumptionBalanceResult(ResourceIdentifier id, string name, ResourceTy AdjustmentDetails = adjustmentDetails; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ISO currency in which the meter is charged, for example, USD. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetData.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetData.Serialization.cs index f80fad14609a..301b718ff657 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetData.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetData.Serialization.cs @@ -5,19 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Consumption.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption { - public partial class ConsumptionBudgetData : IUtf8JsonSerializable + public partial class ConsumptionBudgetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -44,12 +50,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TimePeriod)) { writer.WritePropertyName("timePeriod"u8); - writer.WriteObjectValue(TimePeriod); + if (TimePeriod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TimePeriod).Serialize(writer, options); + } } if (Optional.IsDefined(Filter)) { writer.WritePropertyName("filter"u8); - writer.WriteObjectValue(Filter); + if (Filter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Filter).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Notifications)) { @@ -58,16 +78,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Notifications) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionBudgetData DeserializeConsumptionBudgetData(JsonElement element) + internal static ConsumptionBudgetData DeserializeConsumptionBudgetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -85,6 +126,7 @@ internal static ConsumptionBudgetData DeserializeConsumptionBudgetData(JsonEleme Optional currentSpend = default; Optional> notifications = default; Optional forecastSpend = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -209,8 +251,61 @@ internal static ConsumptionBudgetData DeserializeConsumptionBudgetData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionBudgetData(id, name, type, systemData.Value, Optional.ToNullable(category), Optional.ToNullable(amount), Optional.ToNullable(timeGrain), timePeriod.Value, filter.Value, currentSpend.Value, Optional.ToDictionary(notifications), forecastSpend.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ConsumptionBudgetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionBudgetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionBudgetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionBudgetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionBudgetData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionBudgetData(Response response) + { + if (response is null) + { + return null; } - return new ConsumptionBudgetData(id, name, type, systemData.Value, Optional.ToNullable(category), Optional.ToNullable(amount), Optional.ToNullable(timeGrain), timePeriod.Value, filter.Value, currentSpend.Value, Optional.ToDictionary(notifications), forecastSpend.Value, Optional.ToNullable(eTag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionBudgetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.Serialization.cs index 309e2f461475..b4d3c009df19 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionBudgetFilter : IUtf8JsonSerializable + public partial class ConsumptionBudgetFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(And)) { @@ -22,25 +29,60 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in And) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Dimensions)) { writer.WritePropertyName("dimensions"u8); - writer.WriteObjectValue(Dimensions); + if (Dimensions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dimensions).Serialize(writer, options); + } } if (Optional.IsDefined(Tags)) { writer.WritePropertyName("tags"u8); - writer.WriteObjectValue(Tags); + if (Tags is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tags).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ConsumptionBudgetFilter DeserializeConsumptionBudgetFilter(JsonElement element) + internal static ConsumptionBudgetFilter DeserializeConsumptionBudgetFilter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +90,7 @@ internal static ConsumptionBudgetFilter DeserializeConsumptionBudgetFilter(JsonE Optional> and = default; Optional dimensions = default; Optional tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("and"u8)) @@ -82,8 +125,61 @@ internal static ConsumptionBudgetFilter DeserializeConsumptionBudgetFilter(JsonE tags = BudgetComparisonExpression.DeserializeBudgetComparisonExpression(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionBudgetFilter(Optional.ToList(and), dimensions.Value, tags.Value, serializedAdditionalRawData); + } + + ConsumptionBudgetFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionBudgetFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionBudgetFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionBudgetFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionBudgetFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionBudgetFilter(Response response) + { + if (response is null) + { + return null; } - return new ConsumptionBudgetFilter(Optional.ToList(and), dimensions.Value, tags.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionBudgetFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.cs index 416f6e9c0b0e..7a2d06a2445a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionBudgetFilter.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.Consumption.Models /// May be used to filter budgets by resource group, resource, or meter. public partial class ConsumptionBudgetFilter { - /// Initializes a new instance of ConsumptionBudgetFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionBudgetFilter() { And = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionBudgetFilter. + /// Initializes a new instance of . /// The logical "AND" expression. Must have at least 2 items. /// Has comparison expression for a dimension. /// Has comparison expression for a tag. - internal ConsumptionBudgetFilter(IList and, BudgetComparisonExpression dimensions, BudgetComparisonExpression tags) + /// Keeps track of any properties unknown to the library. + internal ConsumptionBudgetFilter(IList and, BudgetComparisonExpression dimensions, BudgetComparisonExpression tags, Dictionary serializedAdditionalRawData) { And = and; Dimensions = dimensions; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The logical "AND" expression. Must have at least 2 items. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.Serialization.cs index e32a87054d40..3d9566b9b052 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.Serialization.cs @@ -5,15 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionCalculatedSavingsProperties + public partial class ConsumptionCalculatedSavingsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionCalculatedSavingsProperties DeserializeConsumptionCalculatedSavingsProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ReservedUnitCount)) + { + writer.WritePropertyName("reservedUnitCount"u8); + writer.WriteNumberValue(ReservedUnitCount.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionCalculatedSavingsProperties DeserializeConsumptionCalculatedSavingsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +58,7 @@ internal static ConsumptionCalculatedSavingsProperties DeserializeConsumptionCal Optional totalReservationCost = default; Optional reservedUnitCount = default; Optional savings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("onDemandCost"u8)) @@ -90,8 +124,61 @@ internal static ConsumptionCalculatedSavingsProperties DeserializeConsumptionCal savings = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionCalculatedSavingsProperties(Optional.ToNullable(onDemandCost), Optional.ToNullable(overageCost), Optional.ToNullable(quantity), Optional.ToNullable(reservationCost), Optional.ToNullable(totalReservationCost), Optional.ToNullable(reservedUnitCount), Optional.ToNullable(savings)); + return new ConsumptionCalculatedSavingsProperties(Optional.ToNullable(onDemandCost), Optional.ToNullable(overageCost), Optional.ToNullable(quantity), Optional.ToNullable(reservationCost), Optional.ToNullable(totalReservationCost), Optional.ToNullable(reservedUnitCount), Optional.ToNullable(savings), serializedAdditionalRawData); + } + + ConsumptionCalculatedSavingsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionCalculatedSavingsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionCalculatedSavingsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionCalculatedSavingsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionCalculatedSavingsProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionCalculatedSavingsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionCalculatedSavingsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.cs index 5b271040f919..62463ac9fded 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCalculatedSavingsProperties.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// Details of estimated savings. public partial class ConsumptionCalculatedSavingsProperties { - /// Initializes a new instance of ConsumptionCalculatedSavingsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionCalculatedSavingsProperties() { } - /// Initializes a new instance of ConsumptionCalculatedSavingsProperties. + /// Initializes a new instance of . /// The cost without reservation. /// The difference between total reservation cost and reservation cost. /// The quantity for calculated savings. @@ -23,7 +29,8 @@ internal ConsumptionCalculatedSavingsProperties() /// The cost of the suggested quantity. /// The number of reserved units used to calculate savings. Always 1 for virtual machines. /// The amount saved by purchasing the recommended quantity of reservation. - internal ConsumptionCalculatedSavingsProperties(float? onDemandCost, float? overageCost, float? quantity, float? reservationCost, float? totalReservationCost, float? reservedUnitCount, float? savings) + /// Keeps track of any properties unknown to the library. + internal ConsumptionCalculatedSavingsProperties(float? onDemandCost, float? overageCost, float? quantity, float? reservationCost, float? totalReservationCost, float? reservedUnitCount, float? savings, Dictionary serializedAdditionalRawData) { OnDemandCost = onDemandCost; OverageCost = overageCost; @@ -32,6 +39,7 @@ internal ConsumptionCalculatedSavingsProperties(float? onDemandCost, float? over TotalReservationCost = totalReservationCost; ReservedUnitCount = reservedUnitCount; Savings = savings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The cost without reservation. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.Serialization.cs index fad6fae41212..451d7f11031e 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionChargeSummary : IUtf8JsonSerializable + public partial class ConsumptionChargeSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -24,11 +31,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("eTag"u8); writer.WriteStringValue(ETag.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionChargeSummary DeserializeConsumptionChargeSummary(JsonElement element) + internal static ConsumptionChargeSummary DeserializeConsumptionChargeSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,12 +62,15 @@ internal static ConsumptionChargeSummary DeserializeConsumptionChargeSummary(Jso case "modern": return ConsumptionModernChargeSummary.DeserializeConsumptionModernChargeSummary(element); } } + + // Unknown type found so we will deserialize the base properties only ChargeSummaryKind kind = default; Optional eTag = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -87,8 +111,61 @@ internal static ConsumptionChargeSummary DeserializeConsumptionChargeSummary(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionChargeSummary(id, name, type, systemData.Value, kind, Optional.ToNullable(eTag)); + return new ConsumptionChargeSummary(id, name, type, systemData.Value, kind, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ConsumptionChargeSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionChargeSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionChargeSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionChargeSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionChargeSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionChargeSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionChargeSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.cs index 1aecfdca1c56..661c84640de1 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionChargeSummary.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -18,22 +20,27 @@ namespace Azure.ResourceManager.Consumption.Models /// public partial class ConsumptionChargeSummary : ResourceData { - /// Initializes a new instance of ConsumptionChargeSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionChargeSummary() { } - /// Initializes a new instance of ConsumptionChargeSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Specifies the kind of charge summary. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ConsumptionChargeSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChargeSummaryKind kind, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionChargeSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChargeSummaryKind kind, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the kind of charge summary. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.Serialization.cs index 3cd0553b18ab..608c8b838493 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionCreditSummary : IUtf8JsonSerializable + public partial class ConsumptionCreditSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionCreditSummary DeserializeConsumptionCreditSummary(JsonElement element) + internal static ConsumptionCreditSummary DeserializeConsumptionCreditSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static ConsumptionCreditSummary DeserializeConsumptionCreditSummary(Jso Optional creditCurrency = default; Optional billingCurrency = default; Optional reseller = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -148,8 +170,61 @@ internal static ConsumptionCreditSummary DeserializeConsumptionCreditSummary(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionCreditSummary(id, name, type, systemData.Value, balanceSummary.Value, pendingCreditAdjustments.Value, expiredCredit.Value, pendingEligibleCharges.Value, creditCurrency.Value, billingCurrency.Value, reseller.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ConsumptionCreditSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionCreditSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionCreditSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionCreditSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionCreditSummary model) + { + if (model is null) + { + return null; } - return new ConsumptionCreditSummary(id, name, type, systemData.Value, balanceSummary.Value, pendingCreditAdjustments.Value, expiredCredit.Value, pendingEligibleCharges.Value, creditCurrency.Value, billingCurrency.Value, reseller.Value, Optional.ToNullable(eTag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionCreditSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionCreditSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.cs index aa640f084900..09008be522d5 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionCreditSummary.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +16,15 @@ namespace Azure.ResourceManager.Consumption.Models /// A credit summary resource. public partial class ConsumptionCreditSummary : ResourceData { - /// Initializes a new instance of ConsumptionCreditSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionCreditSummary() { } - /// Initializes a new instance of ConsumptionCreditSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,7 +37,8 @@ public ConsumptionCreditSummary() /// The billing currency. /// Credit's reseller. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ConsumptionCreditSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CreditBalanceSummary balanceSummary, ConsumptionAmount pendingCreditAdjustments, ConsumptionAmount expiredCredit, ConsumptionAmount pendingEligibleCharges, string creditCurrency, string billingCurrency, ConsumptionReseller reseller, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionCreditSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CreditBalanceSummary balanceSummary, ConsumptionAmount pendingCreditAdjustments, ConsumptionAmount expiredCredit, ConsumptionAmount pendingEligibleCharges, string creditCurrency, string billingCurrency, ConsumptionReseller reseller, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { BalanceSummary = balanceSummary; PendingCreditAdjustments = pendingCreditAdjustments; @@ -42,6 +48,7 @@ internal ConsumptionCreditSummary(ResourceIdentifier id, string name, ResourceTy BillingCurrency = billingCurrency; Reseller = reseller; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Summary of balances associated with this credit summary. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.Serialization.cs index f5aa801a419b..b2c10a6cd802 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.Serialization.cs @@ -6,17 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionEventSummary : IUtf8JsonSerializable + public partial class ConsumptionEventSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -31,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EventType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionEventSummary DeserializeConsumptionEventSummary(JsonElement element) + internal static ConsumptionEventSummary DeserializeConsumptionEventSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +87,7 @@ internal static ConsumptionEventSummary DeserializeConsumptionEventSummary(JsonE Optional adjustmentsInBillingCurrency = default; Optional chargesInBillingCurrency = default; Optional closedBalanceInBillingCurrency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -288,8 +309,61 @@ internal static ConsumptionEventSummary DeserializeConsumptionEventSummary(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionEventSummary(id, name, type, systemData.Value, Optional.ToNullable(transactionDate), description.Value, newCredit.Value, adjustments.Value, creditExpired.Value, charges.Value, closedBalance.Value, Optional.ToNullable(eventType), invoiceNumber.Value, billingProfileId.Value, billingProfileDisplayName.Value, lotId.Value, lotSource.Value, canceledCredit.Value, creditCurrency.Value, billingCurrency.Value, reseller.Value, creditExpiredInBillingCurrency.Value, newCreditInBillingCurrency.Value, adjustmentsInBillingCurrency.Value, chargesInBillingCurrency.Value, closedBalanceInBillingCurrency.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ConsumptionEventSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionEventSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionEventSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionEventSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionEventSummary model) + { + if (model is null) + { + return null; } - return new ConsumptionEventSummary(id, name, type, systemData.Value, Optional.ToNullable(transactionDate), description.Value, newCredit.Value, adjustments.Value, creditExpired.Value, charges.Value, closedBalance.Value, Optional.ToNullable(eventType), invoiceNumber.Value, billingProfileId.Value, billingProfileDisplayName.Value, lotId.Value, lotSource.Value, canceledCredit.Value, creditCurrency.Value, billingCurrency.Value, reseller.Value, creditExpiredInBillingCurrency.Value, newCreditInBillingCurrency.Value, adjustmentsInBillingCurrency.Value, chargesInBillingCurrency.Value, closedBalanceInBillingCurrency.Value, Optional.ToNullable(eTag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionEventSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionEventSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.cs index 31119eaa9669..689eed8004e7 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionEventSummary.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,12 +16,15 @@ namespace Azure.ResourceManager.Consumption.Models /// An event summary resource. public partial class ConsumptionEventSummary : ResourceData { - /// Initializes a new instance of ConsumptionEventSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionEventSummary() { } - /// Initializes a new instance of ConsumptionEventSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +52,8 @@ public ConsumptionEventSummary() /// The amount of charges for events of type SettleCharges and PendingEligibleCharges in billing currency. /// The balance in billing currency after the event. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ConsumptionEventSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? transactOn, string description, ConsumptionAmount newCredit, ConsumptionAmount adjustments, ConsumptionAmount creditExpired, ConsumptionAmount charges, ConsumptionAmount closedBalance, ConsumptionEventType? eventType, string invoiceNumber, ResourceIdentifier billingProfileId, string billingProfileDisplayName, ResourceIdentifier lotId, string lotSource, ConsumptionAmount canceledCredit, string creditCurrency, string billingCurrency, ConsumptionReseller reseller, ConsumptionAmountWithExchangeRate creditExpiredInBillingCurrency, ConsumptionAmountWithExchangeRate newCreditInBillingCurrency, ConsumptionAmountWithExchangeRate adjustmentsInBillingCurrency, ConsumptionAmountWithExchangeRate chargesInBillingCurrency, ConsumptionAmountWithExchangeRate closedBalanceInBillingCurrency, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionEventSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? transactOn, string description, ConsumptionAmount newCredit, ConsumptionAmount adjustments, ConsumptionAmount creditExpired, ConsumptionAmount charges, ConsumptionAmount closedBalance, ConsumptionEventType? eventType, string invoiceNumber, ResourceIdentifier billingProfileId, string billingProfileDisplayName, ResourceIdentifier lotId, string lotSource, ConsumptionAmount canceledCredit, string creditCurrency, string billingCurrency, ConsumptionReseller reseller, ConsumptionAmountWithExchangeRate creditExpiredInBillingCurrency, ConsumptionAmountWithExchangeRate newCreditInBillingCurrency, ConsumptionAmountWithExchangeRate adjustmentsInBillingCurrency, ConsumptionAmountWithExchangeRate chargesInBillingCurrency, ConsumptionAmountWithExchangeRate closedBalanceInBillingCurrency, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TransactOn = transactOn; Description = description; @@ -73,6 +78,7 @@ internal ConsumptionEventSummary(ResourceIdentifier id, string name, ResourceTyp ChargesInBillingCurrency = chargesInBillingCurrency; ClosedBalanceInBillingCurrency = closedBalanceInBillingCurrency; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The date of the event. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.Serialization.cs index 74d69df3787e..d176d597a04d 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionLegacyChargeSummary : IUtf8JsonSerializable + public partial class ConsumptionLegacyChargeSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionLegacyChargeSummary DeserializeConsumptionLegacyChargeSummary(JsonElement element) + internal static ConsumptionLegacyChargeSummary DeserializeConsumptionLegacyChargeSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static ConsumptionLegacyChargeSummary DeserializeConsumptionLegacyCharg Optional chargesBilledSeparately = default; Optional marketplaceCharges = default; Optional currency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -148,8 +170,61 @@ internal static ConsumptionLegacyChargeSummary DeserializeConsumptionLegacyCharg } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionLegacyChargeSummary(id, name, type, systemData.Value, kind, Optional.ToNullable(eTag), billingPeriodId.Value, usageStart.Value, usageEnd.Value, Optional.ToNullable(azureCharges), Optional.ToNullable(chargesBilledSeparately), Optional.ToNullable(marketplaceCharges), currency.Value, serializedAdditionalRawData); + } + + ConsumptionLegacyChargeSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionLegacyChargeSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionLegacyChargeSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionLegacyChargeSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionLegacyChargeSummary model) + { + if (model is null) + { + return null; } - return new ConsumptionLegacyChargeSummary(id, name, type, systemData.Value, kind, Optional.ToNullable(eTag), billingPeriodId.Value, usageStart.Value, usageEnd.Value, Optional.ToNullable(azureCharges), Optional.ToNullable(chargesBilledSeparately), Optional.ToNullable(marketplaceCharges), currency.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionLegacyChargeSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionLegacyChargeSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.cs index 6d56f34432fe..1cbb1ea0eb24 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyChargeSummary.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +16,13 @@ namespace Azure.ResourceManager.Consumption.Models /// Legacy charge summary. public partial class ConsumptionLegacyChargeSummary : ConsumptionChargeSummary { - /// Initializes a new instance of ConsumptionLegacyChargeSummary. + /// Initializes a new instance of . public ConsumptionLegacyChargeSummary() { Kind = ChargeSummaryKind.Legacy; } - /// Initializes a new instance of ConsumptionLegacyChargeSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +36,8 @@ public ConsumptionLegacyChargeSummary() /// Charges Billed separately. /// Marketplace Charges. /// Currency Code. - internal ConsumptionLegacyChargeSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChargeSummaryKind kind, ETag? etag, string billingPeriodId, string usageStart, string usageEnd, decimal? azureCharges, decimal? chargesBilledSeparately, decimal? marketplaceCharges, string currency) : base(id, name, resourceType, systemData, kind, etag) + /// Keeps track of any properties unknown to the library. + internal ConsumptionLegacyChargeSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChargeSummaryKind kind, ETag? etag, string billingPeriodId, string usageStart, string usageEnd, decimal? azureCharges, decimal? chargesBilledSeparately, decimal? marketplaceCharges, string currency, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, etag, serializedAdditionalRawData) { BillingPeriodId = billingPeriodId; UsageStart = usageStart; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.Serialization.cs index f8d8f5c8c3ed..d1214359e17e 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.Serialization.cs @@ -10,14 +10,46 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionLegacyReservationRecommendation + public partial class ConsumptionLegacyReservationRecommendation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionLegacyReservationRecommendation DeserializeConsumptionLegacyReservationRecommendation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionLegacyReservationRecommendation DeserializeConsumptionLegacyReservationRecommendation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +77,7 @@ internal static ConsumptionLegacyReservationRecommendation DeserializeConsumptio Optional firstUsageDate = default; string scope = default; Optional> skuProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -236,8 +269,61 @@ internal static ConsumptionLegacyReservationRecommendation DeserializeConsumptio } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionLegacyReservationRecommendation(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), Optional.ToNullable(location), sku.Value, lookBackPeriod.Value, Optional.ToNullable(instanceFlexibilityRatio), instanceFlexibilityGroup.Value, normalizedSize.Value, Optional.ToNullable(recommendedQuantityNormalized), Optional.ToNullable(meterId), term.Value, Optional.ToNullable(costWithNoReservedInstances), Optional.ToNullable(recommendedQuantity), Optional.ToNullable(totalCostWithReservedInstances), Optional.ToNullable(netSavings), Optional.ToNullable(firstUsageDate), scope, Optional.ToList(skuProperties)); + return new ConsumptionLegacyReservationRecommendation(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), Optional.ToNullable(location), sku.Value, lookBackPeriod.Value, Optional.ToNullable(instanceFlexibilityRatio), instanceFlexibilityGroup.Value, normalizedSize.Value, Optional.ToNullable(recommendedQuantityNormalized), Optional.ToNullable(meterId), term.Value, Optional.ToNullable(costWithNoReservedInstances), Optional.ToNullable(recommendedQuantity), Optional.ToNullable(totalCostWithReservedInstances), Optional.ToNullable(netSavings), Optional.ToNullable(firstUsageDate), scope, Optional.ToList(skuProperties), serializedAdditionalRawData); + } + + ConsumptionLegacyReservationRecommendation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionLegacyReservationRecommendation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionLegacyReservationRecommendation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionLegacyReservationRecommendation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionLegacyReservationRecommendation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionLegacyReservationRecommendation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionLegacyReservationRecommendation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.cs index 9f363dfbcaae..00076cc08c2e 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyReservationRecommendation.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Consumption.Models /// Legacy reservation recommendation. public partial class ConsumptionLegacyReservationRecommendation : ConsumptionReservationRecommendation { - /// Initializes a new instance of ConsumptionLegacyReservationRecommendation. + /// Initializes a new instance of . /// Shared or single recommendation. /// is null. internal ConsumptionLegacyReservationRecommendation(string scope) @@ -28,7 +28,7 @@ internal ConsumptionLegacyReservationRecommendation(string scope) Kind = ReservationRecommendationKind.Legacy; } - /// Initializes a new instance of ConsumptionLegacyReservationRecommendation. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -52,7 +52,8 @@ internal ConsumptionLegacyReservationRecommendation(string scope) /// The usage date for looking back. /// Shared or single recommendation. /// List of sku properties. - internal ConsumptionLegacyReservationRecommendation(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReservationRecommendationKind kind, ETag? etag, IReadOnlyDictionary tags, AzureLocation? location, string sku, string lookBackPeriod, float? instanceFlexibilityRatio, string instanceFlexibilityGroup, string normalizedSize, float? recommendedQuantityNormalized, Guid? meterId, string term, decimal? costWithNoReservedInstances, decimal? recommendedQuantity, decimal? totalCostWithReservedInstances, decimal? netSavings, DateTimeOffset? firstUsageOn, string scope, IReadOnlyList skuProperties) : base(id, name, resourceType, systemData, kind, etag, tags, location, sku) + /// Keeps track of any properties unknown to the library. + internal ConsumptionLegacyReservationRecommendation(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReservationRecommendationKind kind, ETag? etag, IReadOnlyDictionary tags, AzureLocation? location, string sku, string lookBackPeriod, float? instanceFlexibilityRatio, string instanceFlexibilityGroup, string normalizedSize, float? recommendedQuantityNormalized, Guid? meterId, string term, decimal? costWithNoReservedInstances, decimal? recommendedQuantity, decimal? totalCostWithReservedInstances, decimal? netSavings, DateTimeOffset? firstUsageOn, string scope, IReadOnlyList skuProperties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, etag, tags, location, sku, serializedAdditionalRawData) { LookBackPeriod = lookBackPeriod; InstanceFlexibilityRatio = instanceFlexibilityRatio; @@ -71,6 +72,11 @@ internal ConsumptionLegacyReservationRecommendation(ResourceIdentifier id, strin Kind = kind; } + /// Initializes a new instance of for deserialization. + internal ConsumptionLegacyReservationRecommendation() + { + } + /// The number of days of usage to look back for recommendation. public string LookBackPeriod { get; } /// The instance Flexibility Ratio. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.Serialization.cs index 19428894a971..04e07d05afd2 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.Serialization.cs @@ -10,14 +10,44 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionLegacyUsageDetail + public partial class ConsumptionLegacyUsageDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionLegacyUsageDetail DeserializeConsumptionLegacyUsageDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionLegacyUsageDetail DeserializeConsumptionLegacyUsageDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +105,7 @@ internal static ConsumptionLegacyUsageDetail DeserializeConsumptionLegacyUsageDe Optional benefitId = default; Optional benefitName = default; Optional pricingModel = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -419,8 +450,61 @@ internal static ConsumptionLegacyUsageDetail DeserializeConsumptionLegacyUsageDe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionLegacyUsageDetail(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), billingAccountId.Value, billingAccountName.Value, Optional.ToNullable(billingPeriodStartDate), Optional.ToNullable(billingPeriodEndDate), billingProfileId.Value, billingProfileName.Value, accountOwnerId.Value, accountName.Value, subscriptionId.Value, subscriptionName.Value, Optional.ToNullable(date), product.Value, partNumber.Value, Optional.ToNullable(meterId), meterDetails.Value, Optional.ToNullable(quantity), Optional.ToNullable(effectivePrice), Optional.ToNullable(cost), Optional.ToNullable(unitPrice), billingCurrency.Value, resourceLocation.Value, consumedService.Value, resourceId.Value, resourceName.Value, serviceInfo1.Value, serviceInfo2.Value, additionalInfo.Value, invoiceSection.Value, costCenter.Value, resourceGroup.Value, reservationId.Value, reservationName.Value, productOrderId.Value, productOrderName.Value, offerId.Value, Optional.ToNullable(isAzureCreditEligible), term.Value, publisherName.Value, publisherType.Value, planName.Value, chargeType.Value, frequency.Value, Optional.ToNullable(payGPrice), benefitId.Value, benefitName.Value, Optional.ToNullable(pricingModel)); + return new ConsumptionLegacyUsageDetail(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), billingAccountId.Value, billingAccountName.Value, Optional.ToNullable(billingPeriodStartDate), Optional.ToNullable(billingPeriodEndDate), billingProfileId.Value, billingProfileName.Value, accountOwnerId.Value, accountName.Value, subscriptionId.Value, subscriptionName.Value, Optional.ToNullable(date), product.Value, partNumber.Value, Optional.ToNullable(meterId), meterDetails.Value, Optional.ToNullable(quantity), Optional.ToNullable(effectivePrice), Optional.ToNullable(cost), Optional.ToNullable(unitPrice), billingCurrency.Value, resourceLocation.Value, consumedService.Value, resourceId.Value, resourceName.Value, serviceInfo1.Value, serviceInfo2.Value, additionalInfo.Value, invoiceSection.Value, costCenter.Value, resourceGroup.Value, reservationId.Value, reservationName.Value, productOrderId.Value, productOrderName.Value, offerId.Value, Optional.ToNullable(isAzureCreditEligible), term.Value, publisherName.Value, publisherType.Value, planName.Value, chargeType.Value, frequency.Value, Optional.ToNullable(payGPrice), benefitId.Value, benefitName.Value, Optional.ToNullable(pricingModel), serializedAdditionalRawData); + } + + ConsumptionLegacyUsageDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionLegacyUsageDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionLegacyUsageDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionLegacyUsageDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionLegacyUsageDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionLegacyUsageDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionLegacyUsageDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.cs index d4a537b43b1c..500f75f61a9c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLegacyUsageDetail.cs @@ -16,13 +16,13 @@ namespace Azure.ResourceManager.Consumption.Models /// Legacy usage detail. public partial class ConsumptionLegacyUsageDetail : ConsumptionUsageDetail { - /// Initializes a new instance of ConsumptionLegacyUsageDetail. + /// Initializes a new instance of . internal ConsumptionLegacyUsageDetail() { Kind = UsageDetailsKind.Legacy; } - /// Initializes a new instance of ConsumptionLegacyUsageDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -76,7 +76,8 @@ internal ConsumptionLegacyUsageDetail() /// Unique identifier for the applicable benefit. /// Name of the applicable benefit. /// Identifier that indicates how the meter is priced. - internal ConsumptionLegacyUsageDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UsageDetailsKind kind, ETag? etag, IReadOnlyDictionary tags, string billingAccountId, string billingAccountName, DateTimeOffset? billingPeriodStartOn, DateTimeOffset? billingPeriodEndOn, string billingProfileId, string billingProfileName, string accountOwnerId, string accountName, string subscriptionId, string subscriptionName, DateTimeOffset? @on, string product, string partNumber, Guid? meterId, ConsumptionMeterDetailsInfo meterDetails, decimal? quantity, decimal? effectivePrice, decimal? cost, decimal? unitPrice, string billingCurrency, string resourceLocation, string consumedService, string resourceId, string resourceName, string serviceInfo1, string serviceInfo2, string additionalInfo, string invoiceSection, string costCenter, string resourceGroup, string reservationId, string reservationName, string productOrderId, string productOrderName, string offerId, bool? isAzureCreditEligible, string term, string publisherName, string publisherType, string planName, string chargeType, string frequency, decimal? payGPrice, string benefitId, string benefitName, ConsumptionPricingModelType? pricingModel) : base(id, name, resourceType, systemData, kind, etag, tags) + /// Keeps track of any properties unknown to the library. + internal ConsumptionLegacyUsageDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UsageDetailsKind kind, ETag? etag, IReadOnlyDictionary tags, string billingAccountId, string billingAccountName, DateTimeOffset? billingPeriodStartOn, DateTimeOffset? billingPeriodEndOn, string billingProfileId, string billingProfileName, string accountOwnerId, string accountName, string subscriptionId, string subscriptionName, DateTimeOffset? @on, string product, string partNumber, Guid? meterId, ConsumptionMeterDetailsInfo meterDetails, decimal? quantity, decimal? effectivePrice, decimal? cost, decimal? unitPrice, string billingCurrency, string resourceLocation, string consumedService, string resourceId, string resourceName, string serviceInfo1, string serviceInfo2, string additionalInfo, string invoiceSection, string costCenter, string resourceGroup, string reservationId, string reservationName, string productOrderId, string productOrderName, string offerId, bool? isAzureCreditEligible, string term, string publisherName, string publisherType, string planName, string chargeType, string frequency, decimal? payGPrice, string benefitId, string benefitName, ConsumptionPricingModelType? pricingModel, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, etag, tags, serializedAdditionalRawData) { BillingAccountId = billingAccountId; BillingAccountName = billingAccountName; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.Serialization.cs index f5c2948f609c..bd47f2fe7368 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.Serialization.cs @@ -6,17 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionLotSummary : IUtf8JsonSerializable + public partial class ConsumptionLotSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -26,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionLotSummary DeserializeConsumptionLotSummary(JsonElement element) + internal static ConsumptionLotSummary DeserializeConsumptionLotSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +73,7 @@ internal static ConsumptionLotSummary DeserializeConsumptionLotSummary(JsonEleme Optional originalAmountInBillingCurrency = default; Optional closedBalanceInBillingCurrency = default; Optional reseller = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -205,8 +226,61 @@ internal static ConsumptionLotSummary DeserializeConsumptionLotSummary(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionLotSummary(id, name, type, systemData.Value, originalAmount.Value, closedBalance.Value, Optional.ToNullable(source), Optional.ToNullable(startDate), Optional.ToNullable(expirationDate), poNumber.Value, Optional.ToNullable(purchasedDate), Optional.ToNullable(status), creditCurrency.Value, billingCurrency.Value, originalAmountInBillingCurrency.Value, closedBalanceInBillingCurrency.Value, reseller.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ConsumptionLotSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionLotSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionLotSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionLotSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionLotSummary model) + { + if (model is null) + { + return null; } - return new ConsumptionLotSummary(id, name, type, systemData.Value, originalAmount.Value, closedBalance.Value, Optional.ToNullable(source), Optional.ToNullable(startDate), Optional.ToNullable(expirationDate), poNumber.Value, Optional.ToNullable(purchasedDate), Optional.ToNullable(status), creditCurrency.Value, billingCurrency.Value, originalAmountInBillingCurrency.Value, closedBalanceInBillingCurrency.Value, reseller.Value, Optional.ToNullable(eTag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionLotSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionLotSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.cs index 02de5bb3a660..e6ea47511c73 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionLotSummary.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,12 +16,15 @@ namespace Azure.ResourceManager.Consumption.Models /// A lot summary resource. public partial class ConsumptionLotSummary : ResourceData { - /// Initializes a new instance of ConsumptionLotSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionLotSummary() { } - /// Initializes a new instance of ConsumptionLotSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public ConsumptionLotSummary() /// The balance as of the last invoice in billing currency. /// The reseller of the lot. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ConsumptionLotSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConsumptionAmount originalAmount, ConsumptionAmount closedBalance, ConsumptionLotSource? source, DateTimeOffset? startOn, DateTimeOffset? expireOn, string poNumber, DateTimeOffset? purchasedOn, ConsumptionLotStatus? status, string creditCurrency, string billingCurrency, ConsumptionAmountWithExchangeRate originalAmountInBillingCurrency, ConsumptionAmountWithExchangeRate closedBalanceInBillingCurrency, ConsumptionReseller reseller, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionLotSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConsumptionAmount originalAmount, ConsumptionAmount closedBalance, ConsumptionLotSource? source, DateTimeOffset? startOn, DateTimeOffset? expireOn, string poNumber, DateTimeOffset? purchasedOn, ConsumptionLotStatus? status, string creditCurrency, string billingCurrency, ConsumptionAmountWithExchangeRate originalAmountInBillingCurrency, ConsumptionAmountWithExchangeRate closedBalanceInBillingCurrency, ConsumptionReseller reseller, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OriginalAmount = originalAmount; ClosedBalance = closedBalance; @@ -55,6 +60,7 @@ internal ConsumptionLotSummary(ResourceIdentifier id, string name, ResourceType ClosedBalanceInBillingCurrency = closedBalanceInBillingCurrency; Reseller = reseller; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The original amount of a lot. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.Serialization.cs index 9c2f3d86b4b3..3724b8822901 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.Serialization.cs @@ -10,14 +10,42 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionMarketplace + public partial class ConsumptionMarketplace : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionMarketplace DeserializeConsumptionMarketplace(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionMarketplace DeserializeConsumptionMarketplace(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static ConsumptionMarketplace DeserializeConsumptionMarketplace(JsonEle Optional publisherName = default; Optional planName = default; Optional isRecurringCharge = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -281,8 +310,61 @@ internal static ConsumptionMarketplace DeserializeConsumptionMarketplace(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionMarketplace(id, name, type, systemData.Value, billingPeriodId.Value, Optional.ToNullable(usageStart), Optional.ToNullable(usageEnd), Optional.ToNullable(resourceRate), offerName.Value, resourceGroup.Value, additionalInfo.Value, orderNumber.Value, instanceName.Value, instanceId.Value, currency.Value, Optional.ToNullable(consumedQuantity), unitOfMeasure.Value, Optional.ToNullable(pretaxCost), Optional.ToNullable(isEstimated), Optional.ToNullable(meterId), Optional.ToNullable(subscriptionGuid), subscriptionName.Value, accountName.Value, departmentName.Value, consumedService.Value, costCenter.Value, additionalProperties.Value, publisherName.Value, planName.Value, Optional.ToNullable(isRecurringCharge), Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new ConsumptionMarketplace(id, name, type, systemData.Value, billingPeriodId.Value, Optional.ToNullable(usageStart), Optional.ToNullable(usageEnd), Optional.ToNullable(resourceRate), offerName.Value, resourceGroup.Value, additionalInfo.Value, orderNumber.Value, instanceName.Value, instanceId.Value, currency.Value, Optional.ToNullable(consumedQuantity), unitOfMeasure.Value, Optional.ToNullable(pretaxCost), Optional.ToNullable(isEstimated), Optional.ToNullable(meterId), Optional.ToNullable(subscriptionGuid), subscriptionName.Value, accountName.Value, departmentName.Value, consumedService.Value, costCenter.Value, additionalProperties.Value, publisherName.Value, planName.Value, Optional.ToNullable(isRecurringCharge), Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionMarketplace IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionMarketplace(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionMarketplace IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionMarketplace(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionMarketplace model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionMarketplace(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionMarketplace(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.cs index 766b1bbd61db..aba13e1afd15 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMarketplace.cs @@ -16,13 +16,16 @@ namespace Azure.ResourceManager.Consumption.Models /// A marketplace resource. public partial class ConsumptionMarketplace : ResourceData { - /// Initializes a new instance of ConsumptionMarketplace. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionMarketplace() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionMarketplace. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -55,7 +58,8 @@ internal ConsumptionMarketplace() /// Flag indicating whether this is a recurring charge or not. /// The etag for the resource. /// Resource tags. - internal ConsumptionMarketplace(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string billingPeriodId, DateTimeOffset? usageStartOn, DateTimeOffset? usageEndOn, decimal? resourceRate, string offerName, string resourceGroup, string additionalInfo, string orderNumber, string instanceName, string instanceId, string currency, decimal? consumedQuantity, string unitOfMeasure, decimal? pretaxCost, bool? isEstimated, Guid? meterId, Guid? subscriptionGuid, string subscriptionName, string accountName, string departmentName, string consumedService, string costCenter, string additionalProperties, string publisherName, string planName, bool? isRecurringCharge, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionMarketplace(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string billingPeriodId, DateTimeOffset? usageStartOn, DateTimeOffset? usageEndOn, decimal? resourceRate, string offerName, string resourceGroup, string additionalInfo, string orderNumber, string instanceName, string instanceId, string currency, decimal? consumedQuantity, string unitOfMeasure, decimal? pretaxCost, bool? isEstimated, Guid? meterId, Guid? subscriptionGuid, string subscriptionName, string accountName, string departmentName, string consumedService, string costCenter, string additionalProperties, string publisherName, string planName, bool? isRecurringCharge, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { BillingPeriodId = billingPeriodId; UsageStartOn = usageStartOn; @@ -85,6 +89,7 @@ internal ConsumptionMarketplace(ResourceIdentifier id, string name, ResourceType IsRecurringCharge = isRecurringCharge; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the billing period resource that the usage belongs to. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.Serialization.cs index 3983f2655e0f..302f3ef10a80 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionMeterDetails + public partial class ConsumptionMeterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionMeterDetails DeserializeConsumptionMeterDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionMeterDetails DeserializeConsumptionMeterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +55,7 @@ internal static ConsumptionMeterDetails DeserializeConsumptionMeterDetails(JsonE Optional pretaxStandardRate = default; Optional serviceName = default; Optional serviceTier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterName"u8)) @@ -82,8 +111,61 @@ internal static ConsumptionMeterDetails DeserializeConsumptionMeterDetails(JsonE serviceTier = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionMeterDetails(meterName.Value, meterCategory.Value, meterSubCategory.Value, unit.Value, meterLocation.Value, Optional.ToNullable(totalIncludedQuantity), Optional.ToNullable(pretaxStandardRate), serviceName.Value, serviceTier.Value); + return new ConsumptionMeterDetails(meterName.Value, meterCategory.Value, meterSubCategory.Value, unit.Value, meterLocation.Value, Optional.ToNullable(totalIncludedQuantity), Optional.ToNullable(pretaxStandardRate), serviceName.Value, serviceTier.Value, serializedAdditionalRawData); + } + + ConsumptionMeterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionMeterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionMeterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionMeterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionMeterDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionMeterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionMeterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.cs index ecb71ad06fe8..07504a1a9f0a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetails.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The properties of the meter detail. public partial class ConsumptionMeterDetails { - /// Initializes a new instance of ConsumptionMeterDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionMeterDetails() { } - /// Initializes a new instance of ConsumptionMeterDetails. + /// Initializes a new instance of . /// The name of the meter, within the given meter category. /// The category of the meter, for example, 'Cloud services', 'Networking', etc.. /// The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. @@ -25,7 +31,8 @@ internal ConsumptionMeterDetails() /// The pretax listing price. /// The name of the service. /// The service tier. - internal ConsumptionMeterDetails(string meterName, string meterCategory, string meterSubCategory, string unit, string meterLocation, decimal? totalIncludedQuantity, decimal? pretaxStandardRate, string serviceName, string serviceTier) + /// Keeps track of any properties unknown to the library. + internal ConsumptionMeterDetails(string meterName, string meterCategory, string meterSubCategory, string unit, string meterLocation, decimal? totalIncludedQuantity, decimal? pretaxStandardRate, string serviceName, string serviceTier, Dictionary serializedAdditionalRawData) { MeterName = meterName; MeterCategory = meterCategory; @@ -36,6 +43,7 @@ internal ConsumptionMeterDetails(string meterName, string meterCategory, string PretaxStandardRate = pretaxStandardRate; ServiceName = serviceName; ServiceTier = serviceTier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the meter, within the given meter category. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.Serialization.cs index c377ad55f041..9ae406118435 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionMeterDetailsInfo + public partial class ConsumptionMeterDetailsInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionMeterDetailsInfo DeserializeConsumptionMeterDetailsInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionMeterDetailsInfo DeserializeConsumptionMeterDetailsInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ConsumptionMeterDetailsInfo DeserializeConsumptionMeterDetailsIn Optional meterSubCategory = default; Optional unitOfMeasure = default; Optional serviceFamily = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterName"u8)) @@ -50,8 +79,61 @@ internal static ConsumptionMeterDetailsInfo DeserializeConsumptionMeterDetailsIn serviceFamily = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionMeterDetailsInfo(meterName.Value, meterCategory.Value, meterSubCategory.Value, unitOfMeasure.Value, serviceFamily.Value); + return new ConsumptionMeterDetailsInfo(meterName.Value, meterCategory.Value, meterSubCategory.Value, unitOfMeasure.Value, serviceFamily.Value, serializedAdditionalRawData); + } + + ConsumptionMeterDetailsInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionMeterDetailsInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionMeterDetailsInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionMeterDetailsInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionMeterDetailsInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionMeterDetailsInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionMeterDetailsInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.cs index e3891d5d216d..b90fcf978d16 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionMeterDetailsInfo.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The properties of the meter detail. public partial class ConsumptionMeterDetailsInfo { - /// Initializes a new instance of ConsumptionMeterDetailsInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionMeterDetailsInfo() { } - /// Initializes a new instance of ConsumptionMeterDetailsInfo. + /// Initializes a new instance of . /// The name of the meter, within the given meter category. /// The category of the meter, for example, 'Cloud services', 'Networking', etc.. /// The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. /// The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. /// The service family. - internal ConsumptionMeterDetailsInfo(string meterName, string meterCategory, string meterSubCategory, string unitOfMeasure, string serviceFamily) + /// Keeps track of any properties unknown to the library. + internal ConsumptionMeterDetailsInfo(string meterName, string meterCategory, string meterSubCategory, string unitOfMeasure, string serviceFamily, Dictionary serializedAdditionalRawData) { MeterName = meterName; MeterCategory = meterCategory; MeterSubCategory = meterSubCategory; UnitOfMeasure = unitOfMeasure; ServiceFamily = serviceFamily; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the meter, within the given meter category. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.Serialization.cs index ec2400722d94..091ea3d0846b 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionModernChargeSummary : IUtf8JsonSerializable + public partial class ConsumptionModernChargeSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionModernChargeSummary DeserializeConsumptionModernChargeSummary(JsonElement element) + internal static ConsumptionModernChargeSummary DeserializeConsumptionModernChargeSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +74,7 @@ internal static ConsumptionModernChargeSummary DeserializeConsumptionModernCharg Optional invoiceSectionId = default; Optional customerId = default; Optional isInvoiced = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -176,8 +198,61 @@ internal static ConsumptionModernChargeSummary DeserializeConsumptionModernCharg } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionModernChargeSummary(id, name, type, systemData.Value, kind, Optional.ToNullable(eTag), billingPeriodId.Value, usageStart.Value, usageEnd.Value, azureCharges.Value, chargesBilledSeparately.Value, marketplaceCharges.Value, billingAccountId.Value, billingProfileId.Value, invoiceSectionId.Value, customerId.Value, Optional.ToNullable(isInvoiced), serializedAdditionalRawData); + } + + ConsumptionModernChargeSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionModernChargeSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionModernChargeSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionModernChargeSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionModernChargeSummary model) + { + if (model is null) + { + return null; } - return new ConsumptionModernChargeSummary(id, name, type, systemData.Value, kind, Optional.ToNullable(eTag), billingPeriodId.Value, usageStart.Value, usageEnd.Value, azureCharges.Value, chargesBilledSeparately.Value, marketplaceCharges.Value, billingAccountId.Value, billingProfileId.Value, invoiceSectionId.Value, customerId.Value, Optional.ToNullable(isInvoiced)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionModernChargeSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionModernChargeSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.cs index 2fbc83231c3f..9216537f56bd 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernChargeSummary.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +16,13 @@ namespace Azure.ResourceManager.Consumption.Models /// Modern charge summary. public partial class ConsumptionModernChargeSummary : ConsumptionChargeSummary { - /// Initializes a new instance of ConsumptionModernChargeSummary. + /// Initializes a new instance of . public ConsumptionModernChargeSummary() { Kind = ChargeSummaryKind.Modern; } - /// Initializes a new instance of ConsumptionModernChargeSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +40,8 @@ public ConsumptionModernChargeSummary() /// Invoice Section Id. /// Customer Id. /// Is charge Invoiced. - internal ConsumptionModernChargeSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChargeSummaryKind kind, ETag? etag, string billingPeriodId, string usageStart, string usageEnd, ConsumptionAmount azureCharges, ConsumptionAmount chargesBilledSeparately, ConsumptionAmount marketplaceCharges, string billingAccountId, string billingProfileId, string invoiceSectionId, string customerId, bool? isInvoiced) : base(id, name, resourceType, systemData, kind, etag) + /// Keeps track of any properties unknown to the library. + internal ConsumptionModernChargeSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ChargeSummaryKind kind, ETag? etag, string billingPeriodId, string usageStart, string usageEnd, ConsumptionAmount azureCharges, ConsumptionAmount chargesBilledSeparately, ConsumptionAmount marketplaceCharges, string billingAccountId, string billingProfileId, string invoiceSectionId, string customerId, bool? isInvoiced, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, etag, serializedAdditionalRawData) { BillingPeriodId = billingPeriodId; UsageStart = usageStart; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.Serialization.cs index 8163d11cac3c..236a293e10d7 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.Serialization.cs @@ -10,14 +10,44 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionModernReservationRecommendation + public partial class ConsumptionModernReservationRecommendation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionModernReservationRecommendation DeserializeConsumptionModernReservationRecommendation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionModernReservationRecommendation DeserializeConsumptionModernReservationRecommendation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +77,7 @@ internal static ConsumptionModernReservationRecommendation DeserializeConsumptio Optional scope = default; Optional> skuProperties = default; Optional skuName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -252,8 +283,61 @@ internal static ConsumptionModernReservationRecommendation DeserializeConsumptio } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionModernReservationRecommendation(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), Optional.ToNullable(location), sku.Value, location0.Value, Optional.ToNullable(lookBackPeriod), Optional.ToNullable(instanceFlexibilityRatio), instanceFlexibilityGroup.Value, normalizedSize.Value, Optional.ToNullable(recommendedQuantityNormalized), Optional.ToNullable(meterId), term.Value, costWithNoReservedInstances.Value, Optional.ToNullable(recommendedQuantity), totalCostWithReservedInstances.Value, netSavings.Value, Optional.ToNullable(firstUsageDate), scope.Value, Optional.ToList(skuProperties), skuName.Value); + return new ConsumptionModernReservationRecommendation(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), Optional.ToNullable(location), sku.Value, location0.Value, Optional.ToNullable(lookBackPeriod), Optional.ToNullable(instanceFlexibilityRatio), instanceFlexibilityGroup.Value, normalizedSize.Value, Optional.ToNullable(recommendedQuantityNormalized), Optional.ToNullable(meterId), term.Value, costWithNoReservedInstances.Value, Optional.ToNullable(recommendedQuantity), totalCostWithReservedInstances.Value, netSavings.Value, Optional.ToNullable(firstUsageDate), scope.Value, Optional.ToList(skuProperties), skuName.Value, serializedAdditionalRawData); + } + + ConsumptionModernReservationRecommendation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionModernReservationRecommendation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionModernReservationRecommendation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionModernReservationRecommendation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionModernReservationRecommendation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionModernReservationRecommendation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionModernReservationRecommendation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.cs index cd8e43421a38..2748df4593df 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationRecommendation.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.Consumption.Models /// Modern reservation recommendation. public partial class ConsumptionModernReservationRecommendation : ConsumptionReservationRecommendation { - /// Initializes a new instance of ConsumptionModernReservationRecommendation. + /// Initializes a new instance of . internal ConsumptionModernReservationRecommendation() { SkuProperties = new ChangeTrackingList(); Kind = ReservationRecommendationKind.Modern; } - /// Initializes a new instance of ConsumptionModernReservationRecommendation. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +49,8 @@ internal ConsumptionModernReservationRecommendation() /// Shared or single recommendation. /// List of sku properties. /// This is the ARM Sku name. - internal ConsumptionModernReservationRecommendation(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReservationRecommendationKind kind, ETag? etag, IReadOnlyDictionary tags, AzureLocation? location, string sku, string locationPropertiesLocation, int? lookBackPeriod, float? instanceFlexibilityRatio, string instanceFlexibilityGroup, string normalizedSize, float? recommendedQuantityNormalized, Guid? meterId, string term, ConsumptionAmount costWithNoReservedInstances, decimal? recommendedQuantity, ConsumptionAmount totalCostWithReservedInstances, ConsumptionAmount netSavings, DateTimeOffset? firstUsageOn, string scope, IReadOnlyList skuProperties, string skuName) : base(id, name, resourceType, systemData, kind, etag, tags, location, sku) + /// Keeps track of any properties unknown to the library. + internal ConsumptionModernReservationRecommendation(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReservationRecommendationKind kind, ETag? etag, IReadOnlyDictionary tags, AzureLocation? location, string sku, string locationPropertiesLocation, int? lookBackPeriod, float? instanceFlexibilityRatio, string instanceFlexibilityGroup, string normalizedSize, float? recommendedQuantityNormalized, Guid? meterId, string term, ConsumptionAmount costWithNoReservedInstances, decimal? recommendedQuantity, ConsumptionAmount totalCostWithReservedInstances, ConsumptionAmount netSavings, DateTimeOffset? firstUsageOn, string scope, IReadOnlyList skuProperties, string skuName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, etag, tags, location, sku, serializedAdditionalRawData) { LocationPropertiesLocation = locationPropertiesLocation; LookBackPeriod = lookBackPeriod; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.Serialization.cs index d402e0e14d74..f142b684aaca 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.Serialization.cs @@ -8,15 +8,44 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionModernReservationTransaction + public partial class ConsumptionModernReservationTransaction : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionModernReservationTransaction DeserializeConsumptionModernReservationTransaction(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionModernReservationTransaction DeserializeConsumptionModernReservationTransaction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +75,7 @@ internal static ConsumptionModernReservationTransaction DeserializeConsumptionMo Optional reservationOrderId = default; Optional reservationOrderName = default; Optional term = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -226,8 +256,61 @@ internal static ConsumptionModernReservationTransaction DeserializeConsumptionMo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionModernReservationTransaction(id, name, type, systemData.Value, Optional.ToNullable(amount), armSkuName.Value, billingFrequency.Value, billingProfileId.Value, billingProfileName.Value, currency.Value, description.Value, Optional.ToNullable(eventDate), eventType.Value, invoice.Value, invoiceId.Value, invoiceSectionId.Value, invoiceSectionName.Value, Optional.ToNullable(purchasingSubscriptionGuid), purchasingSubscriptionName.Value, Optional.ToNullable(quantity), region.Value, reservationOrderId.Value, reservationOrderName.Value, term.Value, Optional.ToList(tags)); + return new ConsumptionModernReservationTransaction(id, name, type, systemData.Value, Optional.ToNullable(amount), armSkuName.Value, billingFrequency.Value, billingProfileId.Value, billingProfileName.Value, currency.Value, description.Value, Optional.ToNullable(eventDate), eventType.Value, invoice.Value, invoiceId.Value, invoiceSectionId.Value, invoiceSectionName.Value, Optional.ToNullable(purchasingSubscriptionGuid), purchasingSubscriptionName.Value, Optional.ToNullable(quantity), region.Value, reservationOrderId.Value, reservationOrderName.Value, term.Value, Optional.ToList(tags), serializedAdditionalRawData); + } + + ConsumptionModernReservationTransaction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionModernReservationTransaction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionModernReservationTransaction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionModernReservationTransaction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionModernReservationTransaction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionModernReservationTransaction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionModernReservationTransaction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.cs index 62ace96d641a..5a6430fcd3c2 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernReservationTransaction.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.Consumption.Models /// Modern Reservation transaction resource. public partial class ConsumptionModernReservationTransaction : ResourceData { - /// Initializes a new instance of ConsumptionModernReservationTransaction. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionModernReservationTransaction() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionModernReservationTransaction. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +50,8 @@ internal ConsumptionModernReservationTransaction() /// The name of the reservation order. /// This is the term of the transaction. /// Resource tags. - internal ConsumptionModernReservationTransaction(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, decimal? amount, string armSkuName, string billingFrequency, ResourceIdentifier billingProfileId, string billingProfileName, string currency, string description, DateTimeOffset? transactOn, string eventType, string invoice, ResourceIdentifier invoiceId, ResourceIdentifier invoiceSectionId, string invoiceSectionName, Guid? purchasingSubscriptionGuid, string purchasingSubscriptionName, decimal? quantity, string region, string reservationOrderId, string reservationOrderName, string term, IReadOnlyList tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionModernReservationTransaction(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, decimal? amount, string armSkuName, string billingFrequency, ResourceIdentifier billingProfileId, string billingProfileName, string currency, string description, DateTimeOffset? transactOn, string eventType, string invoice, ResourceIdentifier invoiceId, ResourceIdentifier invoiceSectionId, string invoiceSectionName, Guid? purchasingSubscriptionGuid, string purchasingSubscriptionName, decimal? quantity, string region, string reservationOrderId, string reservationOrderName, string term, IReadOnlyList tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Amount = amount; ArmSkuName = armSkuName; @@ -70,6 +74,7 @@ internal ConsumptionModernReservationTransaction(ResourceIdentifier id, string n ReservationOrderName = reservationOrderName; Term = term; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The charge of the transaction. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.Serialization.cs index 184756ffc1ef..6087f92998ab 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.Serialization.cs @@ -10,14 +10,44 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionModernUsageDetail + public partial class ConsumptionModernUsageDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionModernUsageDetail DeserializeConsumptionModernUsageDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionModernUsageDetail DeserializeConsumptionModernUsageDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,6 +131,7 @@ internal static ConsumptionModernUsageDetail DeserializeConsumptionModernUsageDe Optional benefitName = default; Optional provider = default; Optional costAllocationRuleName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -611,8 +642,61 @@ internal static ConsumptionModernUsageDetail DeserializeConsumptionModernUsageDe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionModernUsageDetail(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), billingAccountId.Value, Optional.ToNullable(effectivePrice), Optional.ToNullable(pricingModel), billingAccountName.Value, Optional.ToNullable(billingPeriodStartDate), Optional.ToNullable(billingPeriodEndDate), billingProfileId.Value, billingProfileName.Value, subscriptionGuid.Value, subscriptionName.Value, Optional.ToNullable(date), product.Value, Optional.ToNullable(meterId), meterName.Value, meterRegion.Value, meterCategory.Value, meterSubCategory.Value, serviceFamily.Value, Optional.ToNullable(quantity), unitOfMeasure.Value, instanceName.Value, Optional.ToNullable(costInUSD), Optional.ToNullable(unitPrice), billingCurrencyCode.Value, resourceLocation.Value, consumedService.Value, serviceInfo1.Value, serviceInfo2.Value, additionalInfo.Value, invoiceSectionId.Value, invoiceSectionName.Value, costCenter.Value, resourceGroup.Value, reservationId.Value, reservationName.Value, productOrderId.Value, productOrderName.Value, Optional.ToNullable(isAzureCreditEligible), term.Value, publisherName.Value, publisherType.Value, chargeType.Value, frequency.Value, Optional.ToNullable(costInBillingCurrency), Optional.ToNullable(costInPricingCurrency), exchangeRate.Value, Optional.ToNullable(exchangeRateDate), invoiceId.Value, previousInvoiceId.Value, pricingCurrencyCode.Value, productIdentifier.Value, resourceLocationNormalized.Value, Optional.ToNullable(servicePeriodStartDate), Optional.ToNullable(servicePeriodEndDate), customerTenantId.Value, customerName.Value, partnerTenantId.Value, partnerName.Value, resellerMpnId.Value, resellerName.Value, publisherId.Value, Optional.ToNullable(marketPrice), Optional.ToNullable(exchangeRatePricingToBilling), Optional.ToNullable(paygCostInBillingCurrency), Optional.ToNullable(paygCostInUSD), Optional.ToNullable(partnerEarnedCreditRate), partnerEarnedCreditApplied.Value, Optional.ToNullable(payGPrice), benefitId.Value, benefitName.Value, provider.Value, costAllocationRuleName.Value); + return new ConsumptionModernUsageDetail(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), billingAccountId.Value, Optional.ToNullable(effectivePrice), Optional.ToNullable(pricingModel), billingAccountName.Value, Optional.ToNullable(billingPeriodStartDate), Optional.ToNullable(billingPeriodEndDate), billingProfileId.Value, billingProfileName.Value, subscriptionGuid.Value, subscriptionName.Value, Optional.ToNullable(date), product.Value, Optional.ToNullable(meterId), meterName.Value, meterRegion.Value, meterCategory.Value, meterSubCategory.Value, serviceFamily.Value, Optional.ToNullable(quantity), unitOfMeasure.Value, instanceName.Value, Optional.ToNullable(costInUSD), Optional.ToNullable(unitPrice), billingCurrencyCode.Value, resourceLocation.Value, consumedService.Value, serviceInfo1.Value, serviceInfo2.Value, additionalInfo.Value, invoiceSectionId.Value, invoiceSectionName.Value, costCenter.Value, resourceGroup.Value, reservationId.Value, reservationName.Value, productOrderId.Value, productOrderName.Value, Optional.ToNullable(isAzureCreditEligible), term.Value, publisherName.Value, publisherType.Value, chargeType.Value, frequency.Value, Optional.ToNullable(costInBillingCurrency), Optional.ToNullable(costInPricingCurrency), exchangeRate.Value, Optional.ToNullable(exchangeRateDate), invoiceId.Value, previousInvoiceId.Value, pricingCurrencyCode.Value, productIdentifier.Value, resourceLocationNormalized.Value, Optional.ToNullable(servicePeriodStartDate), Optional.ToNullable(servicePeriodEndDate), customerTenantId.Value, customerName.Value, partnerTenantId.Value, partnerName.Value, resellerMpnId.Value, resellerName.Value, publisherId.Value, Optional.ToNullable(marketPrice), Optional.ToNullable(exchangeRatePricingToBilling), Optional.ToNullable(paygCostInBillingCurrency), Optional.ToNullable(paygCostInUSD), Optional.ToNullable(partnerEarnedCreditRate), partnerEarnedCreditApplied.Value, Optional.ToNullable(payGPrice), benefitId.Value, benefitName.Value, provider.Value, costAllocationRuleName.Value, serializedAdditionalRawData); + } + + ConsumptionModernUsageDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionModernUsageDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionModernUsageDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionModernUsageDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionModernUsageDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionModernUsageDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionModernUsageDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.cs index 9aabfce577cc..f902ca1ba5dc 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionModernUsageDetail.cs @@ -16,13 +16,13 @@ namespace Azure.ResourceManager.Consumption.Models /// Modern usage detail. public partial class ConsumptionModernUsageDetail : ConsumptionUsageDetail { - /// Initializes a new instance of ConsumptionModernUsageDetail. + /// Initializes a new instance of . internal ConsumptionModernUsageDetail() { Kind = UsageDetailsKind.Modern; } - /// Initializes a new instance of ConsumptionModernUsageDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -102,7 +102,8 @@ internal ConsumptionModernUsageDetail() /// Name of the applicable benefit. /// Identifier for Product Category or Line Of Business, Ex - Azure, Microsoft 365, AWS e.t.c. /// Name for Cost Allocation Rule. - internal ConsumptionModernUsageDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UsageDetailsKind kind, ETag? etag, IReadOnlyDictionary tags, string billingAccountId, decimal? effectivePrice, ConsumptionPricingModelType? pricingModel, string billingAccountName, DateTimeOffset? billingPeriodStartOn, DateTimeOffset? billingPeriodEndOn, string billingProfileId, string billingProfileName, string subscriptionGuid, string subscriptionName, DateTimeOffset? @on, string product, Guid? meterId, string meterName, string meterRegion, string meterCategory, string meterSubCategory, string serviceFamily, decimal? quantity, string unitOfMeasure, string instanceName, decimal? costInUSD, decimal? unitPrice, string billingCurrencyCode, string resourceLocation, string consumedService, string serviceInfo1, string serviceInfo2, string additionalInfo, string invoiceSectionId, string invoiceSectionName, string costCenter, string resourceGroup, string reservationId, string reservationName, string productOrderId, string productOrderName, bool? isAzureCreditEligible, string term, string publisherName, string publisherType, string chargeType, string frequency, decimal? costInBillingCurrency, decimal? costInPricingCurrency, string exchangeRate, DateTimeOffset? exchangeRateOn, string invoiceId, string previousInvoiceId, string pricingCurrencyCode, string productIdentifier, string resourceLocationNormalized, DateTimeOffset? servicePeriodStartOn, DateTimeOffset? servicePeriodEndOn, string customerTenantId, string customerName, string partnerTenantId, string partnerName, string resellerMpnId, string resellerName, string publisherId, decimal? marketPrice, decimal? exchangeRatePricingToBilling, decimal? paygCostInBillingCurrency, decimal? paygCostInUSD, decimal? partnerEarnedCreditRate, string partnerEarnedCreditApplied, decimal? payGPrice, string benefitId, string benefitName, string provider, string costAllocationRuleName) : base(id, name, resourceType, systemData, kind, etag, tags) + /// Keeps track of any properties unknown to the library. + internal ConsumptionModernUsageDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UsageDetailsKind kind, ETag? etag, IReadOnlyDictionary tags, string billingAccountId, decimal? effectivePrice, ConsumptionPricingModelType? pricingModel, string billingAccountName, DateTimeOffset? billingPeriodStartOn, DateTimeOffset? billingPeriodEndOn, string billingProfileId, string billingProfileName, string subscriptionGuid, string subscriptionName, DateTimeOffset? @on, string product, Guid? meterId, string meterName, string meterRegion, string meterCategory, string meterSubCategory, string serviceFamily, decimal? quantity, string unitOfMeasure, string instanceName, decimal? costInUSD, decimal? unitPrice, string billingCurrencyCode, string resourceLocation, string consumedService, string serviceInfo1, string serviceInfo2, string additionalInfo, string invoiceSectionId, string invoiceSectionName, string costCenter, string resourceGroup, string reservationId, string reservationName, string productOrderId, string productOrderName, bool? isAzureCreditEligible, string term, string publisherName, string publisherType, string chargeType, string frequency, decimal? costInBillingCurrency, decimal? costInPricingCurrency, string exchangeRate, DateTimeOffset? exchangeRateOn, string invoiceId, string previousInvoiceId, string pricingCurrencyCode, string productIdentifier, string resourceLocationNormalized, DateTimeOffset? servicePeriodStartOn, DateTimeOffset? servicePeriodEndOn, string customerTenantId, string customerName, string partnerTenantId, string partnerName, string resellerMpnId, string resellerName, string publisherId, decimal? marketPrice, decimal? exchangeRatePricingToBilling, decimal? paygCostInBillingCurrency, decimal? paygCostInUSD, decimal? partnerEarnedCreditRate, string partnerEarnedCreditApplied, decimal? payGPrice, string benefitId, string benefitName, string provider, string costAllocationRuleName, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, etag, tags, serializedAdditionalRawData) { BillingAccountId = billingAccountId; EffectivePrice = effectivePrice; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.Serialization.cs index eac992928647..57c5dd95dd7c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionReseller + public partial class ConsumptionReseller : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionReseller DeserializeConsumptionReseller(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionReseller DeserializeConsumptionReseller(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resellerId = default; Optional resellerDescription = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resellerId"u8)) @@ -36,8 +65,61 @@ internal static ConsumptionReseller DeserializeConsumptionReseller(JsonElement e resellerDescription = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionReseller(resellerId.Value, resellerDescription.Value); + return new ConsumptionReseller(resellerId.Value, resellerDescription.Value, serializedAdditionalRawData); + } + + ConsumptionReseller IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionReseller(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionReseller IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionReseller(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionReseller model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionReseller(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionReseller(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.cs index a4ad85e828b2..8c3adb8ec23c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReseller.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Consumption.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.Consumption.Models /// The reseller properties. public partial class ConsumptionReseller { - /// Initializes a new instance of ConsumptionReseller. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionReseller() { } - /// Initializes a new instance of ConsumptionReseller. + /// Initializes a new instance of . /// The reseller property ID. /// The reseller property description. - internal ConsumptionReseller(ResourceIdentifier resellerId, string resellerDescription) + /// Keeps track of any properties unknown to the library. + internal ConsumptionReseller(ResourceIdentifier resellerId, string resellerDescription, Dictionary serializedAdditionalRawData) { ResellerId = resellerId; ResellerDescription = resellerDescription; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The reseller property ID. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.Serialization.cs index 4d77c8b73e33..d0bbb683290d 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.Serialization.cs @@ -10,14 +10,42 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionReservationDetail + public partial class ConsumptionReservationDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionReservationDetail DeserializeConsumptionReservationDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionReservationDetail DeserializeConsumptionReservationDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +67,7 @@ internal static ConsumptionReservationDetail DeserializeConsumptionReservationDe Optional instanceId = default; Optional totalReservedQuantity = default; Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -175,8 +204,61 @@ internal static ConsumptionReservationDetail DeserializeConsumptionReservationDe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionReservationDetail(id, name, type, systemData.Value, reservationOrderId.Value, instanceFlexibilityRatio.Value, instanceFlexibilityGroup.Value, reservationId.Value, skuName.Value, Optional.ToNullable(reservedHours), Optional.ToNullable(usageDate), Optional.ToNullable(usedHours), instanceId.Value, Optional.ToNullable(totalReservedQuantity), kind.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new ConsumptionReservationDetail(id, name, type, systemData.Value, reservationOrderId.Value, instanceFlexibilityRatio.Value, instanceFlexibilityGroup.Value, reservationId.Value, skuName.Value, Optional.ToNullable(reservedHours), Optional.ToNullable(usageDate), Optional.ToNullable(usedHours), instanceId.Value, Optional.ToNullable(totalReservedQuantity), kind.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionReservationDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionReservationDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionReservationDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionReservationDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionReservationDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionReservationDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionReservationDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.cs index 8437a4db4051..e5c7ee1c1daa 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationDetail.cs @@ -16,13 +16,16 @@ namespace Azure.ResourceManager.Consumption.Models /// reservation detail resource. public partial class ConsumptionReservationDetail : ResourceData { - /// Initializes a new instance of ConsumptionReservationDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionReservationDetail() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionReservationDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +43,8 @@ internal ConsumptionReservationDetail() /// The reservation kind. /// The etag for the resource. /// Resource tags. - internal ConsumptionReservationDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string reservationOrderId, string instanceFlexibilityRatio, string instanceFlexibilityGroup, string reservationId, string skuName, decimal? reservedHours, DateTimeOffset? consumptionOccurredOn, decimal? usedHours, ResourceIdentifier instanceId, decimal? totalReservedQuantity, string kind, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionReservationDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string reservationOrderId, string instanceFlexibilityRatio, string instanceFlexibilityGroup, string reservationId, string skuName, decimal? reservedHours, DateTimeOffset? consumptionOccurredOn, decimal? usedHours, ResourceIdentifier instanceId, decimal? totalReservedQuantity, string kind, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ReservationOrderId = reservationOrderId; InstanceFlexibilityRatio = instanceFlexibilityRatio; @@ -55,6 +59,7 @@ internal ConsumptionReservationDetail(ResourceIdentifier id, string name, Resour Kind = kind; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.Serialization.cs index 7da5c11c4c20..43c27c0fd765 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.Serialization.cs @@ -5,18 +5,46 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionReservationRecommendation + public partial class ConsumptionReservationRecommendation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionReservationRecommendation DeserializeConsumptionReservationRecommendation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionReservationRecommendation DeserializeConsumptionReservationRecommendation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +57,8 @@ internal static ConsumptionReservationRecommendation DeserializeConsumptionReser case "modern": return ConsumptionModernReservationRecommendation.DeserializeConsumptionModernReservationRecommendation(element); } } + + // Unknown type found so we will deserialize the base properties only ReservationRecommendationKind kind = default; Optional etag = default; Optional> tags = default; @@ -38,6 +68,7 @@ internal static ConsumptionReservationRecommendation DeserializeConsumptionReser string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -106,8 +137,61 @@ internal static ConsumptionReservationRecommendation DeserializeConsumptionReser systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionReservationRecommendation(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), Optional.ToNullable(location), sku.Value, serializedAdditionalRawData); + } + + ConsumptionReservationRecommendation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionReservationRecommendation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionReservationRecommendation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionReservationRecommendation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionReservationRecommendation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionReservationRecommendation(Response response) + { + if (response is null) + { + return null; } - return new ConsumptionReservationRecommendation(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), Optional.ToNullable(location), sku.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionReservationRecommendation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.cs index 57bf3c051266..7c9342d48fbe 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Consumption.Models /// public partial class ConsumptionReservationRecommendation : ResourceData { - /// Initializes a new instance of ConsumptionReservationRecommendation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionReservationRecommendation() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionReservationRecommendation. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +39,15 @@ internal ConsumptionReservationRecommendation() /// Resource tags. /// Resource location. /// Resource sku. - internal ConsumptionReservationRecommendation(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReservationRecommendationKind kind, ETag? etag, IReadOnlyDictionary tags, AzureLocation? location, string sku) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionReservationRecommendation(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ReservationRecommendationKind kind, ETag? etag, IReadOnlyDictionary tags, AzureLocation? location, string sku, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; ETag = etag; Tags = tags; Location = location; Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the kind of reservation recommendation. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.Serialization.cs index 8e63edb51ff6..62db26b040af 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.Serialization.cs @@ -5,18 +5,57 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionReservationRecommendationDetails + public partial class ConsumptionReservationRecommendationDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionReservationRecommendationDetails DeserializeConsumptionReservationRecommendationDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionReservationRecommendationDetails DeserializeConsumptionReservationRecommendationDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +74,7 @@ internal static ConsumptionReservationRecommendationDetails DeserializeConsumpti Optional savings = default; Optional scope = default; Optional usage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -152,8 +192,61 @@ internal static ConsumptionReservationRecommendationDetails DeserializeConsumpti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionReservationRecommendationDetails(id, name, type, systemData.Value, Optional.ToNullable(location), sku.Value, currency.Value, resource.Value, resourceGroup.Value, savings.Value, scope.Value, usage.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new ConsumptionReservationRecommendationDetails(id, name, type, systemData.Value, Optional.ToNullable(location), sku.Value, currency.Value, resource.Value, resourceGroup.Value, savings.Value, scope.Value, usage.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionReservationRecommendationDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionReservationRecommendationDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionReservationRecommendationDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionReservationRecommendationDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionReservationRecommendationDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionReservationRecommendationDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionReservationRecommendationDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.cs index 75adb0dc5652..af3f93876c55 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationRecommendationDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -15,13 +16,16 @@ namespace Azure.ResourceManager.Consumption.Models /// Reservation recommendation details. public partial class ConsumptionReservationRecommendationDetails : ResourceData { - /// Initializes a new instance of ConsumptionReservationRecommendationDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionReservationRecommendationDetails() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionReservationRecommendationDetails. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +40,8 @@ internal ConsumptionReservationRecommendationDetails() /// Historical usage details used to calculate the estimated savings. /// The etag for the resource. /// Resource tags. - internal ConsumptionReservationRecommendationDetails(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string sku, string currency, ConsumptionResourceProperties properties, string resourceGroup, ConsumptionSavingsProperties savings, string scope, ConsumptionUsageProperties usage, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionReservationRecommendationDetails(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string sku, string currency, ConsumptionResourceProperties properties, string resourceGroup, ConsumptionSavingsProperties savings, string scope, ConsumptionUsageProperties usage, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Sku = sku; @@ -48,6 +53,7 @@ internal ConsumptionReservationRecommendationDetails(ResourceIdentifier id, stri Usage = usage; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource Location. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.Serialization.cs index 70a520ede816..a334c8482595 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.Serialization.cs @@ -10,14 +10,42 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionReservationSummary + public partial class ConsumptionReservationSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionReservationSummary DeserializeConsumptionReservationSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionReservationSummary DeserializeConsumptionReservationSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static ConsumptionReservationSummary DeserializeConsumptionReservationS Optional totalReservedQuantity = default; Optional usedQuantity = default; Optional utilizedPercentage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -223,8 +252,61 @@ internal static ConsumptionReservationSummary DeserializeConsumptionReservationS } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionReservationSummary(id, name, type, systemData.Value, reservationOrderId.Value, reservationId.Value, skuName.Value, Optional.ToNullable(reservedHours), Optional.ToNullable(usageDate), Optional.ToNullable(usedHours), Optional.ToNullable(minUtilizationPercentage), Optional.ToNullable(avgUtilizationPercentage), Optional.ToNullable(maxUtilizationPercentage), kind.Value, Optional.ToNullable(purchasedQuantity), Optional.ToNullable(remainingQuantity), Optional.ToNullable(totalReservedQuantity), Optional.ToNullable(usedQuantity), Optional.ToNullable(utilizedPercentage), Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new ConsumptionReservationSummary(id, name, type, systemData.Value, reservationOrderId.Value, reservationId.Value, skuName.Value, Optional.ToNullable(reservedHours), Optional.ToNullable(usageDate), Optional.ToNullable(usedHours), Optional.ToNullable(minUtilizationPercentage), Optional.ToNullable(avgUtilizationPercentage), Optional.ToNullable(maxUtilizationPercentage), kind.Value, Optional.ToNullable(purchasedQuantity), Optional.ToNullable(remainingQuantity), Optional.ToNullable(totalReservedQuantity), Optional.ToNullable(usedQuantity), Optional.ToNullable(utilizedPercentage), Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionReservationSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionReservationSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionReservationSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionReservationSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionReservationSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionReservationSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionReservationSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.cs index 8304ddce9644..9f1cf713b9be 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationSummary.cs @@ -16,13 +16,16 @@ namespace Azure.ResourceManager.Consumption.Models /// reservation summary resource. public partial class ConsumptionReservationSummary : ResourceData { - /// Initializes a new instance of ConsumptionReservationSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionReservationSummary() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionReservationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,7 +47,8 @@ internal ConsumptionReservationSummary() /// This is the utilized percentage for the reservation Id. /// The etag for the resource. /// Resource tags. - internal ConsumptionReservationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string reservationOrderId, string reservationId, string skuName, decimal? reservedHours, DateTimeOffset? useOn, decimal? usedHours, decimal? minUtilizationPercentage, decimal? avgUtilizationPercentage, decimal? maxUtilizationPercentage, string kind, decimal? purchasedQuantity, decimal? remainingQuantity, decimal? totalReservedQuantity, decimal? usedQuantity, decimal? utilizedPercentage, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionReservationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string reservationOrderId, string reservationId, string skuName, decimal? reservedHours, DateTimeOffset? useOn, decimal? usedHours, decimal? minUtilizationPercentage, decimal? avgUtilizationPercentage, decimal? maxUtilizationPercentage, string kind, decimal? purchasedQuantity, decimal? remainingQuantity, decimal? totalReservedQuantity, decimal? usedQuantity, decimal? utilizedPercentage, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ReservationOrderId = reservationOrderId; ReservationId = reservationId; @@ -63,6 +67,7 @@ internal ConsumptionReservationSummary(ResourceIdentifier id, string name, Resou UtilizedPercentage = utilizedPercentage; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.Serialization.cs index ad2c4c8fce5a..20efe8707160 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.Serialization.cs @@ -8,15 +8,44 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionReservationTransaction + public partial class ConsumptionReservationTransaction : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionReservationTransaction DeserializeConsumptionReservationTransaction(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionReservationTransaction DeserializeConsumptionReservationTransaction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +78,7 @@ internal static ConsumptionReservationTransaction DeserializeConsumptionReservat Optional billingMonth = default; Optional monetaryCommitment = default; Optional overage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -244,8 +274,61 @@ internal static ConsumptionReservationTransaction DeserializeConsumptionReservat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionReservationTransaction(id, name, type, systemData.Value, Optional.ToNullable(eventDate), reservationOrderId.Value, description.Value, eventType.Value, Optional.ToNullable(quantity), Optional.ToNullable(amount), currency.Value, reservationOrderName.Value, purchasingEnrollment.Value, Optional.ToNullable(purchasingSubscriptionGuid), purchasingSubscriptionName.Value, armSkuName.Value, term.Value, region.Value, accountName.Value, accountOwnerEmail.Value, departmentName.Value, costCenter.Value, currentEnrollment.Value, billingFrequency.Value, Optional.ToNullable(billingMonth), Optional.ToNullable(monetaryCommitment), Optional.ToNullable(overage), Optional.ToList(tags)); + return new ConsumptionReservationTransaction(id, name, type, systemData.Value, Optional.ToNullable(eventDate), reservationOrderId.Value, description.Value, eventType.Value, Optional.ToNullable(quantity), Optional.ToNullable(amount), currency.Value, reservationOrderName.Value, purchasingEnrollment.Value, Optional.ToNullable(purchasingSubscriptionGuid), purchasingSubscriptionName.Value, armSkuName.Value, term.Value, region.Value, accountName.Value, accountOwnerEmail.Value, departmentName.Value, costCenter.Value, currentEnrollment.Value, billingFrequency.Value, Optional.ToNullable(billingMonth), Optional.ToNullable(monetaryCommitment), Optional.ToNullable(overage), Optional.ToList(tags), serializedAdditionalRawData); + } + + ConsumptionReservationTransaction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionReservationTransaction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionReservationTransaction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionReservationTransaction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionReservationTransaction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionReservationTransaction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionReservationTransaction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.cs index 0e45accbcf73..2d8af46050a8 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionReservationTransaction.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.Consumption.Models /// Reservation transaction resource. public partial class ConsumptionReservationTransaction : ResourceData { - /// Initializes a new instance of ConsumptionReservationTransaction. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionReservationTransaction() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionReservationTransaction. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,7 +53,8 @@ internal ConsumptionReservationTransaction() /// The monetary commitment amount at the enrollment scope. /// The overage amount at the enrollment scope. /// Resource tags. - internal ConsumptionReservationTransaction(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? transactOn, string reservationOrderId, string description, string eventType, decimal? quantity, decimal? amount, string currency, string reservationOrderName, string purchasingEnrollment, Guid? purchasingSubscriptionGuid, string purchasingSubscriptionName, string armSkuName, string term, string region, string accountName, string accountOwnerEmail, string departmentName, string costCenter, string currentEnrollment, string billingFrequency, int? billingMonth, decimal? monetaryCommitment, decimal? overage, IReadOnlyList tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionReservationTransaction(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? transactOn, string reservationOrderId, string description, string eventType, decimal? quantity, decimal? amount, string currency, string reservationOrderName, string purchasingEnrollment, Guid? purchasingSubscriptionGuid, string purchasingSubscriptionName, string armSkuName, string term, string region, string accountName, string accountOwnerEmail, string departmentName, string costCenter, string currentEnrollment, string billingFrequency, int? billingMonth, decimal? monetaryCommitment, decimal? overage, IReadOnlyList tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TransactOn = transactOn; ReservationOrderId = reservationOrderId; @@ -76,6 +80,7 @@ internal ConsumptionReservationTransaction(ResourceIdentifier id, string name, R MonetaryCommitment = monetaryCommitment; Overage = overage; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The date of the transaction. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.Serialization.cs index a8072476f20c..03cbd1e6054a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionResourceProperties + public partial class ConsumptionResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionResourceProperties DeserializeConsumptionResourceProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionResourceProperties DeserializeConsumptionResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static ConsumptionResourceProperties DeserializeConsumptionResourceProp Optional region = default; Optional reservationRate = default; Optional resourceType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("appliedScopes"u8)) @@ -74,8 +102,61 @@ internal static ConsumptionResourceProperties DeserializeConsumptionResourceProp resourceType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionResourceProperties(Optional.ToList(appliedScopes), Optional.ToNullable(onDemandRate), product.Value, region.Value, Optional.ToNullable(reservationRate), resourceType.Value); + return new ConsumptionResourceProperties(Optional.ToList(appliedScopes), Optional.ToNullable(onDemandRate), product.Value, region.Value, Optional.ToNullable(reservationRate), resourceType.Value, serializedAdditionalRawData); + } + + ConsumptionResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionResourceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.cs index 9c593d9d357b..f9656d4bb36c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionResourceProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Details of the resource. public partial class ConsumptionResourceProperties { - /// Initializes a new instance of ConsumptionResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionResourceProperties() { AppliedScopes = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionResourceProperties. + /// Initializes a new instance of . /// List of subscriptions for which the reservation is applied. /// On demand rate of the resource. /// Azure product ex: Standard_E8s_v3 etc. /// Azure resource region ex:EastUS, WestUS etc. /// Reservation rate of the resource. /// The azure resource type. - internal ConsumptionResourceProperties(IReadOnlyList appliedScopes, float? onDemandRate, string product, string region, float? reservationRate, string resourceType) + /// Keeps track of any properties unknown to the library. + internal ConsumptionResourceProperties(IReadOnlyList appliedScopes, float? onDemandRate, string product, string region, float? reservationRate, string resourceType, Dictionary serializedAdditionalRawData) { AppliedScopes = appliedScopes; OnDemandRate = onDemandRate; @@ -34,6 +39,7 @@ internal ConsumptionResourceProperties(IReadOnlyList appliedScopes, floa Region = region; ReservationRate = reservationRate; ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of subscriptions for which the reservation is applied. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.Serialization.cs index 81926f991594..ed8ee4a9c075 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.Serialization.cs @@ -5,16 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionSavingsProperties + public partial class ConsumptionSavingsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionSavingsProperties DeserializeConsumptionSavingsProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(CalculatedSavings)) + { + writer.WritePropertyName("calculatedSavings"u8); + writer.WriteStartArray(); + foreach (var item in CalculatedSavings) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionSavingsProperties DeserializeConsumptionSavingsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +69,7 @@ internal static ConsumptionSavingsProperties DeserializeConsumptionSavingsProper Optional reservationOrderTerm = default; Optional savingsType = default; Optional unitOfMeasure = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("calculatedSavings"u8)) @@ -74,8 +119,61 @@ internal static ConsumptionSavingsProperties DeserializeConsumptionSavingsProper unitOfMeasure = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionSavingsProperties(Optional.ToList(calculatedSavings), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(recommendedQuantity), reservationOrderTerm.Value, savingsType.Value, unitOfMeasure.Value); + return new ConsumptionSavingsProperties(Optional.ToList(calculatedSavings), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(recommendedQuantity), reservationOrderTerm.Value, savingsType.Value, unitOfMeasure.Value, serializedAdditionalRawData); + } + + ConsumptionSavingsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionSavingsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionSavingsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionSavingsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionSavingsProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionSavingsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionSavingsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.cs index b07aaac68b02..be74cf878c9a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSavingsProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Details of the estimated savings. public partial class ConsumptionSavingsProperties { - /// Initializes a new instance of ConsumptionSavingsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionSavingsProperties() { CalculatedSavings = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionSavingsProperties. + /// Initializes a new instance of . /// List of calculated savings. /// Number of days of usage to look back used for computing the recommendation. /// Number of recommended units of the resource. /// Term period of the reservation, ex: P1Y or P3Y. /// Type of savings, ex: instance. /// Measurement unit ex: hour etc. - internal ConsumptionSavingsProperties(IReadOnlyList calculatedSavings, int? lookBackPeriod, float? recommendedQuantity, string reservationOrderTerm, string savingsType, string unitOfMeasure) + /// Keeps track of any properties unknown to the library. + internal ConsumptionSavingsProperties(IReadOnlyList calculatedSavings, int? lookBackPeriod, float? recommendedQuantity, string reservationOrderTerm, string savingsType, string unitOfMeasure, Dictionary serializedAdditionalRawData) { CalculatedSavings = calculatedSavings; LookBackPeriod = lookBackPeriod; @@ -34,6 +39,7 @@ internal ConsumptionSavingsProperties(IReadOnlyList List of calculated savings. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.Serialization.cs index 976a9d6f3a08..2d8431835878 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionSkuProperty + public partial class ConsumptionSkuProperty : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionSkuProperty DeserializeConsumptionSkuProperty(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionSkuProperty DeserializeConsumptionSkuProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ConsumptionSkuProperty DeserializeConsumptionSkuProperty(JsonEle value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionSkuProperty(name.Value, value.Value); + return new ConsumptionSkuProperty(name.Value, value.Value, serializedAdditionalRawData); + } + + ConsumptionSkuProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionSkuProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionSkuProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionSkuProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionSkuProperty model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionSkuProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionSkuProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.cs index 4f6e03a78909..c98b503f7e3c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionSkuProperty.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// The Sku property. public partial class ConsumptionSkuProperty { - /// Initializes a new instance of ConsumptionSkuProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionSkuProperty() { } - /// Initializes a new instance of ConsumptionSkuProperty. + /// Initializes a new instance of . /// The name of sku property. /// The value of sku property. - internal ConsumptionSkuProperty(string name, string value) + /// Keeps track of any properties unknown to the library. + internal ConsumptionSkuProperty(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of sku property. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.Serialization.cs index 2e695bcd94ff..c6ef6ba9ddeb 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionTag : IUtf8JsonSerializable + public partial class ConsumptionTag : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Key)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionTag DeserializeConsumptionTag(JsonElement element) + internal static ConsumptionTag DeserializeConsumptionTag(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional key = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -63,8 +85,61 @@ internal static ConsumptionTag DeserializeConsumptionTag(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionTag(key.Value, Optional.ToList(value), serializedAdditionalRawData); + } + + ConsumptionTag IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionTag(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionTag IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionTag(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionTag model) + { + if (model is null) + { + return null; } - return new ConsumptionTag(key.Value, Optional.ToList(value)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionTag(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionTag(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.cs index 686977026cad..53066a512ad8 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTag.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// The tag resource. public partial class ConsumptionTag { - /// Initializes a new instance of ConsumptionTag. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionTag() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionTag. + /// Initializes a new instance of . /// Tag key. /// Tag values. - internal ConsumptionTag(string key, IList value) + /// Keeps track of any properties unknown to the library. + internal ConsumptionTag(string key, IList value, Dictionary serializedAdditionalRawData) { Key = key; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Tag key. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.Serialization.cs index c0e047c0837c..4d153df4644c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.Serialization.cs @@ -5,18 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionTagsResult : IUtf8JsonSerializable + public partial class ConsumptionTagsResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -31,16 +37,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Tags) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsumptionTagsResult DeserializeConsumptionTagsResult(JsonElement element) + internal static ConsumptionTagsResult DeserializeConsumptionTagsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +80,7 @@ internal static ConsumptionTagsResult DeserializeConsumptionTagsResult(JsonEleme Optional> tags = default; Optional nextLink = default; Optional previousLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -124,8 +152,61 @@ internal static ConsumptionTagsResult DeserializeConsumptionTagsResult(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionTagsResult(id, name, type, systemData.Value, Optional.ToList(tags), nextLink.Value, previousLink.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ConsumptionTagsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionTagsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionTagsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionTagsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionTagsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionTagsResult(Response response) + { + if (response is null) + { + return null; } - return new ConsumptionTagsResult(id, name, type, systemData.Value, Optional.ToList(tags), nextLink.Value, previousLink.Value, Optional.ToNullable(eTag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionTagsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.cs index e204093ae73f..0311b69b42c5 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionTagsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -15,13 +16,16 @@ namespace Azure.ResourceManager.Consumption.Models /// A resource listing all tags. public partial class ConsumptionTagsResult : ResourceData { - /// Initializes a new instance of ConsumptionTagsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConsumptionTagsResult() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionTagsResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,12 +34,14 @@ public ConsumptionTagsResult() /// The link (url) to the next page of results. /// The link (url) to the previous page of results. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ConsumptionTagsResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, string nextLink, string previousLink, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionTagsResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, string nextLink, string previousLink, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Tags = tags; NextLink = nextLink; PreviousLink = previousLink; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of Tag. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.Serialization.cs index c0ccc5bf603a..ebd0e9c65a3c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.Serialization.cs @@ -5,18 +5,46 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionUsageDetail + public partial class ConsumptionUsageDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionUsageDetail DeserializeConsumptionUsageDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionUsageDetail DeserializeConsumptionUsageDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +57,8 @@ internal static ConsumptionUsageDetail DeserializeConsumptionUsageDetail(JsonEle case "modern": return ConsumptionModernUsageDetail.DeserializeConsumptionModernUsageDetail(element); } } + + // Unknown type found so we will deserialize the base properties only UsageDetailsKind kind = default; Optional etag = default; Optional> tags = default; @@ -36,6 +66,7 @@ internal static ConsumptionUsageDetail DeserializeConsumptionUsageDetail(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -90,8 +121,61 @@ internal static ConsumptionUsageDetail DeserializeConsumptionUsageDetail(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsumptionUsageDetail(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ConsumptionUsageDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionUsageDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionUsageDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionUsageDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionUsageDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionUsageDetail(Response response) + { + if (response is null) + { + return null; } - return new ConsumptionUsageDetail(id, name, type, systemData.Value, kind, Optional.ToNullable(etag), Optional.ToDictionary(tags)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionUsageDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.cs index ee24e4ebf9fc..67f22626b97a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageDetail.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.Consumption.Models /// public partial class ConsumptionUsageDetail : ResourceData { - /// Initializes a new instance of ConsumptionUsageDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionUsageDetail() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConsumptionUsageDetail. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,11 +37,13 @@ internal ConsumptionUsageDetail() /// Specifies the kind of usage details. /// The etag for the resource. /// Resource tags. - internal ConsumptionUsageDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UsageDetailsKind kind, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConsumptionUsageDetail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UsageDetailsKind kind, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the kind of usage details. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.Serialization.cs index 25bd0124021e..022ca7a46937 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class ConsumptionUsageProperties + public partial class ConsumptionUsageProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConsumptionUsageProperties DeserializeConsumptionUsageProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConsumptionUsageProperties DeserializeConsumptionUsageProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static ConsumptionUsageProperties DeserializeConsumptionUsageProperties Optional lookBackUnitType = default; Optional> usageData = default; Optional usageGrain = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("firstConsumptionDate"u8)) @@ -60,8 +88,61 @@ internal static ConsumptionUsageProperties DeserializeConsumptionUsageProperties usageGrain = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConsumptionUsageProperties(firstConsumptionDate.Value, lastConsumptionDate.Value, lookBackUnitType.Value, Optional.ToList(usageData), usageGrain.Value); + return new ConsumptionUsageProperties(firstConsumptionDate.Value, lastConsumptionDate.Value, lookBackUnitType.Value, Optional.ToList(usageData), usageGrain.Value, serializedAdditionalRawData); + } + + ConsumptionUsageProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsumptionUsageProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsumptionUsageProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsumptionUsageProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsumptionUsageProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsumptionUsageProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsumptionUsageProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.cs index 08c5e2ab5a4d..f6bc3e0bb4d4 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ConsumptionUsageProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.Consumption.Models /// Details about historical usage data that has been used for computing the recommendation. public partial class ConsumptionUsageProperties { - /// Initializes a new instance of ConsumptionUsageProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConsumptionUsageProperties() { UsageData = new ChangeTrackingList(); } - /// Initializes a new instance of ConsumptionUsageProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendation. /// The last usage date used for looking back for computing the recommendation. /// What the usage data values represent ex: virtual machine instance. /// The breakdown of historical resource usage. The values are in the order of usage between the firstConsumptionDate and the lastConsumptionDate. /// The grain of the values represented in the usage data ex: hourly. - internal ConsumptionUsageProperties(string firstConsumptionDate, string lastConsumptionDate, string lookBackUnitType, IReadOnlyList usageData, string usageGrain) + /// Keeps track of any properties unknown to the library. + internal ConsumptionUsageProperties(string firstConsumptionDate, string lastConsumptionDate, string lookBackUnitType, IReadOnlyList usageData, string usageGrain, Dictionary serializedAdditionalRawData) { FirstConsumptionDate = firstConsumptionDate; LastConsumptionDate = lastConsumptionDate; LookBackUnitType = lookBackUnitType; UsageData = usageData; UsageGrain = usageGrain; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The first usage date used for looking back for computing the recommendation. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.Serialization.cs index de64732cd7fa..4c14c7f13d74 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class CreditBalanceSummary + public partial class CreditBalanceSummary : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CreditBalanceSummary DeserializeCreditBalanceSummary(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CreditBalanceSummary DeserializeCreditBalanceSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static CreditBalanceSummary DeserializeCreditBalanceSummary(JsonElement Optional estimatedBalance = default; Optional currentBalance = default; Optional estimatedBalanceInBillingCurrency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("estimatedBalance"u8)) @@ -50,8 +79,61 @@ internal static CreditBalanceSummary DeserializeCreditBalanceSummary(JsonElement estimatedBalanceInBillingCurrency = ConsumptionAmountWithExchangeRate.DeserializeConsumptionAmountWithExchangeRate(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CreditBalanceSummary(estimatedBalance.Value, currentBalance.Value, estimatedBalanceInBillingCurrency.Value); + return new CreditBalanceSummary(estimatedBalance.Value, currentBalance.Value, estimatedBalanceInBillingCurrency.Value, serializedAdditionalRawData); + } + + CreditBalanceSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreditBalanceSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreditBalanceSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreditBalanceSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreditBalanceSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreditBalanceSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreditBalanceSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.cs index 05c7e7d37d63..d8cdc6b4c1e8 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/CreditBalanceSummary.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Consumption.Models { /// Summary of credit balances. public partial class CreditBalanceSummary { - /// Initializes a new instance of CreditBalanceSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CreditBalanceSummary() { } - /// Initializes a new instance of CreditBalanceSummary. + /// Initializes a new instance of . /// Estimated balance. /// Current balance. /// Estimated balance in billing currency. - internal CreditBalanceSummary(ConsumptionAmount estimatedBalance, ConsumptionAmount currentBalance, ConsumptionAmountWithExchangeRate estimatedBalanceInBillingCurrency) + /// Keeps track of any properties unknown to the library. + internal CreditBalanceSummary(ConsumptionAmount estimatedBalance, ConsumptionAmount currentBalance, ConsumptionAmountWithExchangeRate estimatedBalanceInBillingCurrency, Dictionary serializedAdditionalRawData) { EstimatedBalance = estimatedBalance; CurrentBalance = currentBalance; EstimatedBalanceInBillingCurrency = estimatedBalanceInBillingCurrency; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Estimated balance. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.Serialization.cs index 4f80e0a9fb09..5342e3714aad 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class Events + internal partial class Events : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Events DeserializeEvents(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Events DeserializeEvents(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static Events DeserializeEvents(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Events(Optional.ToList(value), nextLink.Value); + return new Events(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + Events IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEvents(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Events IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEvents(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Events model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Events(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEvents(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.cs index 0de6fa7b98f9..b64a1d1334a7 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Events.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing event summary. internal partial class Events { - /// Initializes a new instance of Events. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Events() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of Events. + /// Initializes a new instance of . /// The list of event summary. /// The link (url) to the next page of results. - internal Events(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal Events(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of event summary. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.Serialization.cs index 071f983d0b72..afdf66170f57 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class Lots + internal partial class Lots : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Lots DeserializeLots(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Lots DeserializeLots(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static Lots DeserializeLots(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Lots(Optional.ToList(value), nextLink.Value); + return new Lots(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + Lots IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLots(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Lots IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLots(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Lots model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Lots(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLots(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.cs index 9dd3fa81b3ef..2efd96231cd9 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/Lots.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing lot summary. internal partial class Lots { - /// Initializes a new instance of Lots. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Lots() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of Lots. + /// Initializes a new instance of . /// The list of lot summary. /// The link (url) to the next page of results. - internal Lots(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal Lots(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of lot summary. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.Serialization.cs index 460ad6bb2731..60105d6cc43a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class MarketplacesListResult + internal partial class MarketplacesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MarketplacesListResult DeserializeMarketplacesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MarketplacesListResult DeserializeMarketplacesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static MarketplacesListResult DeserializeMarketplacesListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MarketplacesListResult(Optional.ToList(value), nextLink.Value); + return new MarketplacesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MarketplacesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMarketplacesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MarketplacesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMarketplacesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MarketplacesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MarketplacesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMarketplacesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.cs index 46830670442c..6eca3237dcc1 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/MarketplacesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing marketplaces. It contains a list of available marketplaces in reverse chronological order by billing period. internal partial class MarketplacesListResult { - /// Initializes a new instance of MarketplacesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MarketplacesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MarketplacesListResult. + /// Initializes a new instance of . /// The list of marketplaces. /// The link (url) to the next page of results. - internal MarketplacesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MarketplacesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of marketplaces. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.Serialization.cs index da414ad5f185..d78d0bca2a78 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class ModernReservationTransactionsListResult + internal partial class ModernReservationTransactionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ModernReservationTransactionsListResult DeserializeModernReservationTransactionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ModernReservationTransactionsListResult DeserializeModernReservationTransactionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static ModernReservationTransactionsListResult DeserializeModernReserva nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ModernReservationTransactionsListResult(Optional.ToList(value), nextLink.Value); + return new ModernReservationTransactionsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ModernReservationTransactionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeModernReservationTransactionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ModernReservationTransactionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeModernReservationTransactionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ModernReservationTransactionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ModernReservationTransactionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeModernReservationTransactionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.cs index 97185f947e1e..300dea4460ed 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ModernReservationTransactionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing reservation recommendations. internal partial class ModernReservationTransactionsListResult { - /// Initializes a new instance of ModernReservationTransactionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ModernReservationTransactionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ModernReservationTransactionsListResult. + /// Initializes a new instance of . /// The list of reservation recommendations. /// The link (url) to the next page of results. - internal ModernReservationTransactionsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ModernReservationTransactionsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of reservation recommendations. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.Serialization.cs index 1e2a8a22cb7a..53222e62d538 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - public partial class PriceSheetProperties + public partial class PriceSheetProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PriceSheetProperties DeserializePriceSheetProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PriceSheetProperties DeserializePriceSheetProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +55,7 @@ internal static PriceSheetProperties DeserializePriceSheetProperties(JsonElement Optional unitPrice = default; Optional currencyCode = default; Optional offerId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("billingPeriodId"u8)) @@ -95,8 +123,61 @@ internal static PriceSheetProperties DeserializePriceSheetProperties(JsonElement offerId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PriceSheetProperties(billingPeriodId.Value, Optional.ToNullable(meterId), meterDetails.Value, unitOfMeasure.Value, Optional.ToNullable(includedQuantity), partNumber.Value, Optional.ToNullable(unitPrice), currencyCode.Value, offerId.Value); + return new PriceSheetProperties(billingPeriodId.Value, Optional.ToNullable(meterId), meterDetails.Value, unitOfMeasure.Value, Optional.ToNullable(includedQuantity), partNumber.Value, Optional.ToNullable(unitPrice), currencyCode.Value, offerId.Value, serializedAdditionalRawData); + } + + PriceSheetProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePriceSheetProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PriceSheetProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePriceSheetProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PriceSheetProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PriceSheetProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePriceSheetProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.cs index a5bfc2f4af8e..ff6a039d91e0 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Consumption.Models @@ -13,12 +14,15 @@ namespace Azure.ResourceManager.Consumption.Models /// The properties of the price sheet. public partial class PriceSheetProperties { - /// Initializes a new instance of PriceSheetProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PriceSheetProperties() { } - /// Initializes a new instance of PriceSheetProperties. + /// Initializes a new instance of . /// The id of the billing period resource that the usage belongs to. /// The meter id (GUID). /// The details about the meter. By default this is not populated, unless it's specified in $expand. @@ -28,7 +32,8 @@ internal PriceSheetProperties() /// Unit Price. /// Currency Code. /// Offer Id. - internal PriceSheetProperties(ResourceIdentifier billingPeriodId, Guid? meterId, ConsumptionMeterDetails meterDetails, string unitOfMeasure, decimal? includedQuantity, string partNumber, decimal? unitPrice, string currencyCode, string offerId) + /// Keeps track of any properties unknown to the library. + internal PriceSheetProperties(ResourceIdentifier billingPeriodId, Guid? meterId, ConsumptionMeterDetails meterDetails, string unitOfMeasure, decimal? includedQuantity, string partNumber, decimal? unitPrice, string currencyCode, string offerId, Dictionary serializedAdditionalRawData) { BillingPeriodId = billingPeriodId; MeterId = meterId; @@ -39,6 +44,7 @@ internal PriceSheetProperties(ResourceIdentifier billingPeriodId, Guid? meterId, UnitPrice = unitPrice; CurrencyCode = currencyCode; OfferId = offerId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the billing period resource that the usage belongs to. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.Serialization.cs index 72eeae201554..7ae35cd6f2b4 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.Serialization.cs @@ -5,18 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Consumption.Models { - public partial class PriceSheetResult + public partial class PriceSheetResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PriceSheetResult DeserializePriceSheetResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PriceSheetResult DeserializePriceSheetResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +59,7 @@ internal static PriceSheetResult DeserializePriceSheetResult(JsonElement element Optional> pricesheets = default; Optional nextLink = default; Optional download = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -119,8 +149,61 @@ internal static PriceSheetResult DeserializePriceSheetResult(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PriceSheetResult(id, name, type, systemData.Value, Optional.ToList(pricesheets), nextLink.Value, download.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags)); + return new PriceSheetResult(id, name, type, systemData.Value, Optional.ToList(pricesheets), nextLink.Value, download.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + PriceSheetResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePriceSheetResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PriceSheetResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePriceSheetResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PriceSheetResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PriceSheetResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePriceSheetResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.cs index 52a4272262d8..3cb2568dd10f 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/PriceSheetResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -15,14 +16,17 @@ namespace Azure.ResourceManager.Consumption.Models /// An pricesheet resource. public partial class PriceSheetResult : ResourceData { - /// Initializes a new instance of PriceSheetResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PriceSheetResult() { Pricesheets = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PriceSheetResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,13 +36,15 @@ internal PriceSheetResult() /// Pricesheet download details. /// The etag for the resource. /// Resource tags. - internal PriceSheetResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList pricesheets, string nextLink, ConsumptionMeterDetails download, ETag? etag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PriceSheetResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList pricesheets, string nextLink, ConsumptionMeterDetails download, ETag? etag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Pricesheets = pricesheets; NextLink = nextLink; Download = download; ETag = etag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Price sheet. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.Serialization.cs index fab4d156396f..ff5cd6b4b1bf 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class ReservationDetailsListResult + internal partial class ReservationDetailsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReservationDetailsListResult DeserializeReservationDetailsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReservationDetailsListResult DeserializeReservationDetailsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static ReservationDetailsListResult DeserializeReservationDetailsListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReservationDetailsListResult(Optional.ToList(value), nextLink.Value); + return new ReservationDetailsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ReservationDetailsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReservationDetailsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReservationDetailsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReservationDetailsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReservationDetailsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReservationDetailsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReservationDetailsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.cs index 2c1e8dea07f4..485dcf726714 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationDetailsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing reservation details. internal partial class ReservationDetailsListResult { - /// Initializes a new instance of ReservationDetailsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReservationDetailsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReservationDetailsListResult. + /// Initializes a new instance of . /// The list of reservation details. /// The link (url) to the next page of results. - internal ReservationDetailsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ReservationDetailsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of reservation details. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.Serialization.cs index 8189c15acaed..5e08ba888fa7 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class ReservationRecommendationsListResult + internal partial class ReservationRecommendationsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReservationRecommendationsListResult DeserializeReservationRecommendationsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReservationRecommendationsListResult DeserializeReservationRecommendationsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static ReservationRecommendationsListResult DeserializeReservationRecom Optional> value = default; Optional nextLink = default; Optional previousLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -48,8 +76,61 @@ internal static ReservationRecommendationsListResult DeserializeReservationRecom previousLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReservationRecommendationsListResult(Optional.ToList(value), nextLink.Value, previousLink.Value); + return new ReservationRecommendationsListResult(Optional.ToList(value), nextLink.Value, previousLink.Value, serializedAdditionalRawData); + } + + ReservationRecommendationsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReservationRecommendationsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReservationRecommendationsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReservationRecommendationsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReservationRecommendationsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReservationRecommendationsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReservationRecommendationsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.cs index 5f8193746c12..2946b32a4678 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationRecommendationsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing reservation recommendations. internal partial class ReservationRecommendationsListResult { - /// Initializes a new instance of ReservationRecommendationsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReservationRecommendationsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReservationRecommendationsListResult. + /// Initializes a new instance of . /// /// The list of reservation recommendations. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,11 +31,13 @@ internal ReservationRecommendationsListResult() /// /// The link (url) to the next page of results. /// The link (url) to the previous page of results. - internal ReservationRecommendationsListResult(IReadOnlyList value, string nextLink, string previousLink) + /// Keeps track of any properties unknown to the library. + internal ReservationRecommendationsListResult(IReadOnlyList value, string nextLink, string previousLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; PreviousLink = previousLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.Serialization.cs index d17d77d2f6dd..a1a2075f27a2 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class ReservationSummariesListResult + internal partial class ReservationSummariesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReservationSummariesListResult DeserializeReservationSummariesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReservationSummariesListResult DeserializeReservationSummariesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static ReservationSummariesListResult DeserializeReservationSummariesLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReservationSummariesListResult(Optional.ToList(value), nextLink.Value); + return new ReservationSummariesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ReservationSummariesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReservationSummariesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReservationSummariesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReservationSummariesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReservationSummariesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReservationSummariesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReservationSummariesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.cs index f8b91536ec71..e4530a992045 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationSummariesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing reservation summaries. internal partial class ReservationSummariesListResult { - /// Initializes a new instance of ReservationSummariesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReservationSummariesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReservationSummariesListResult. + /// Initializes a new instance of . /// The list of reservation summaries. /// The link (url) to the next page of results. - internal ReservationSummariesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ReservationSummariesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of reservation summaries. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.Serialization.cs index 2f390c897c2c..7d109efbbc6e 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class ReservationTransactionsListResult + internal partial class ReservationTransactionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReservationTransactionsListResult DeserializeReservationTransactionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReservationTransactionsListResult DeserializeReservationTransactionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static ReservationTransactionsListResult DeserializeReservationTransact nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReservationTransactionsListResult(Optional.ToList(value), nextLink.Value); + return new ReservationTransactionsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ReservationTransactionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReservationTransactionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReservationTransactionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReservationTransactionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReservationTransactionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReservationTransactionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReservationTransactionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.cs index 1b2bcc6427b7..ac84ab880d17 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/ReservationTransactionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing reservation recommendations. internal partial class ReservationTransactionsListResult { - /// Initializes a new instance of ReservationTransactionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ReservationTransactionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ReservationTransactionsListResult. + /// Initializes a new instance of . /// The list of reservation recommendations. /// The link (url) to the next page of results. - internal ReservationTransactionsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ReservationTransactionsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of reservation recommendations. diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.Serialization.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.Serialization.cs index 1d9221e22778..5a8f96b1c2d1 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.Serialization.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Consumption.Models { - internal partial class UsageDetailsListResult + internal partial class UsageDetailsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UsageDetailsListResult DeserializeUsageDetailsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UsageDetailsListResult DeserializeUsageDetailsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static UsageDetailsListResult DeserializeUsageDetailsListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UsageDetailsListResult(Optional.ToList(value), nextLink.Value); + return new UsageDetailsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + UsageDetailsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUsageDetailsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UsageDetailsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUsageDetailsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UsageDetailsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UsageDetailsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUsageDetailsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.cs index 37622d1c301d..87f4b4eab04c 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Models/UsageDetailsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Consumption.Models /// Result of listing usage details. It contains a list of available usage details in reverse chronological order by billing period. internal partial class UsageDetailsListResult { - /// Initializes a new instance of UsageDetailsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UsageDetailsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UsageDetailsListResult. + /// Initializes a new instance of . /// /// The list of usage details. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// /// The link (url) to the next page of results. - internal UsageDetailsListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UsageDetailsListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/RestOperations/BudgetsRestOperations.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/RestOperations/BudgetsRestOperations.cs index a2aa21b572ac..574462398c5d 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/RestOperations/BudgetsRestOperations.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/RestOperations/BudgetsRestOperations.cs @@ -193,9 +193,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string scope, string budgetName request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ArmAppContainersModelFactory.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ArmAppContainersModelFactory.cs index 53396b6b2a3c..ea116fef5690 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ArmAppContainersModelFactory.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ArmAppContainersModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.AppContainers.Models /// Model factory for models. public static partial class ArmAppContainersModelFactory { - /// Initializes a new instance of ContainerAppAuthConfigData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,10 +31,10 @@ public static partial class ArmAppContainersModelFactory /// A new instance for mocking. public static ContainerAppAuthConfigData ContainerAppAuthConfigData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerAppAuthPlatform platform = null, ContainerAppGlobalValidation globalValidation = null, ContainerAppIdentityProvidersConfiguration identityProviders = null, ContainerAppLogin login = null, ContainerAppHttpSettings httpSettings = null) { - return new ContainerAppAuthConfigData(id, name, resourceType, systemData, platform, globalValidation, identityProviders, login, httpSettings); + return new ContainerAppAuthConfigData(id, name, resourceType, systemData, platform, globalValidation, identityProviders, login, httpSettings, default); } - /// Initializes a new instance of ContainerAppAvailableWorkloadProfile. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,10 +44,10 @@ public static ContainerAppAuthConfigData ContainerAppAuthConfigData(ResourceIden /// A new instance for mocking. public static ContainerAppAvailableWorkloadProfile ContainerAppAvailableWorkloadProfile(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ContainerAppAvailableWorkloadProfileProperties properties = null) { - return new ContainerAppAvailableWorkloadProfile(id, name, resourceType, systemData, location, properties); + return new ContainerAppAvailableWorkloadProfile(id, name, resourceType, systemData, location, properties, default); } - /// Initializes a new instance of ContainerAppBillingMeter. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -57,10 +57,10 @@ public static ContainerAppAvailableWorkloadProfile ContainerAppAvailableWorkload /// A new instance for mocking. public static ContainerAppBillingMeter ContainerAppBillingMeter(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ContainerAppBillingMeterProperties properties = null) { - return new ContainerAppBillingMeter(id, name, resourceType, systemData, location, properties); + return new ContainerAppBillingMeter(id, name, resourceType, systemData, location, properties, default); } - /// Initializes a new instance of ContainerAppConnectedEnvironmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -79,10 +79,10 @@ public static ContainerAppConnectedEnvironmentData ContainerAppConnectedEnvironm { tags ??= new Dictionary(); - return new ContainerAppConnectedEnvironmentData(id, name, resourceType, systemData, tags, location, extendedLocation, provisioningState, deploymentErrors, defaultDomain, staticIP, daprAIConnectionString, customDomainConfiguration); + return new ContainerAppConnectedEnvironmentData(id, name, resourceType, systemData, tags, location, extendedLocation, provisioningState, deploymentErrors, defaultDomain, staticIP, daprAIConnectionString, customDomainConfiguration, default); } - /// Initializes a new instance of ContainerAppCustomDomainConfiguration. + /// Initializes a new instance of . /// Id used to verify domain name ownership. /// Dns suffix for the environment domain. /// PFX or PEM blob. @@ -93,20 +93,20 @@ public static ContainerAppConnectedEnvironmentData ContainerAppConnectedEnvironm /// A new instance for mocking. public static ContainerAppCustomDomainConfiguration ContainerAppCustomDomainConfiguration(string customDomainVerificationId = null, string dnsSuffix = null, byte[] certificateValue = null, string certificatePassword = null, DateTimeOffset? expireOn = null, string thumbprint = null, string subjectName = null) { - return new ContainerAppCustomDomainConfiguration(customDomainVerificationId, dnsSuffix, certificateValue, certificatePassword, expireOn, thumbprint, subjectName); + return new ContainerAppCustomDomainConfiguration(customDomainVerificationId, dnsSuffix, certificateValue, certificatePassword, expireOn, thumbprint, subjectName, default); } - /// Initializes a new instance of ContainerAppNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. /// A new instance for mocking. public static ContainerAppNameAvailabilityResult ContainerAppNameAvailabilityResult(bool? isNameAvailable = null, ContainerAppNameUnavailableReason? reason = null, string message = null) { - return new ContainerAppNameAvailabilityResult(isNameAvailable, reason, message); + return new ContainerAppNameAvailabilityResult(isNameAvailable, reason, message, default); } - /// Initializes a new instance of ContainerAppCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -119,10 +119,10 @@ public static ContainerAppCertificateData ContainerAppCertificateData(ResourceId { tags ??= new Dictionary(); - return new ContainerAppCertificateData(id, name, resourceType, systemData, tags, location, properties); + return new ContainerAppCertificateData(id, name, resourceType, systemData, tags, location, properties, default); } - /// Initializes a new instance of ContainerAppCertificateProperties. + /// Initializes a new instance of . /// Provisioning state of the certificate. /// Certificate password. /// Subject name of the certificate. @@ -139,10 +139,10 @@ public static ContainerAppCertificateProperties ContainerAppCertificatePropertie { subjectAlternativeNames ??= new List(); - return new ContainerAppCertificateProperties(provisioningState, password, subjectName, subjectAlternativeNames?.ToList(), value, issuer, issueOn, expireOn, thumbprint, isValid, publicKeyHash); + return new ContainerAppCertificateProperties(provisioningState, password, subjectName, subjectAlternativeNames?.ToList(), value, issuer, issueOn, expireOn, thumbprint, isValid, publicKeyHash, default); } - /// Initializes a new instance of ContainerAppDaprComponentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -162,19 +162,19 @@ public static ContainerAppDaprComponentData ContainerAppDaprComponentData(Resour metadata ??= new List(); scopes ??= new List(); - return new ContainerAppDaprComponentData(id, name, resourceType, systemData, componentType, version, ignoreErrors, initTimeout, secrets?.ToList(), secretStoreComponent, metadata?.ToList(), scopes?.ToList()); + return new ContainerAppDaprComponentData(id, name, resourceType, systemData, componentType, version, ignoreErrors, initTimeout, secrets?.ToList(), secretStoreComponent, metadata?.ToList(), scopes?.ToList(), default); } - /// Initializes a new instance of ContainerAppDaprSecret. + /// Initializes a new instance of . /// Secret Name. /// Secret Value. /// A new instance for mocking. public static ContainerAppDaprSecret ContainerAppDaprSecret(string name = null, string value = null) { - return new ContainerAppDaprSecret(name, value); + return new ContainerAppDaprSecret(name, value, default); } - /// Initializes a new instance of ContainerAppConnectedEnvironmentStorageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -183,10 +183,10 @@ public static ContainerAppDaprSecret ContainerAppDaprSecret(string name = null, /// A new instance for mocking. public static ContainerAppConnectedEnvironmentStorageData ContainerAppConnectedEnvironmentStorageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerAppAzureFileProperties connectedEnvironmentStorageAzureFile = null) { - return new ContainerAppConnectedEnvironmentStorageData(id, name, resourceType, systemData, connectedEnvironmentStorageAzureFile != null ? new ConnectedEnvironmentStorageProperties(connectedEnvironmentStorageAzureFile) : null); + return new ContainerAppConnectedEnvironmentStorageData(id, name, resourceType, systemData, connectedEnvironmentStorageAzureFile != null ? new ConnectedEnvironmentStorageProperties(connectedEnvironmentStorageAzureFile, new Dictionary()) : null, default); } - /// Initializes a new instance of ContainerAppData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -214,10 +214,10 @@ public static ContainerAppData ContainerAppData(ResourceIdentifier id = null, st tags ??= new Dictionary(); outboundIPAddressList ??= new List(); - return new ContainerAppData(id, name, resourceType, systemData, tags, location, extendedLocation, identity, managedBy, provisioningState, managedEnvironmentId, environmentId, workloadProfileName, latestRevisionName, latestReadyRevisionName, latestRevisionFqdn, customDomainVerificationId, configuration, template, outboundIPAddressList?.ToList(), eventStreamEndpoint); + return new ContainerAppData(id, name, resourceType, systemData, tags, location, extendedLocation, identity, managedBy, provisioningState, managedEnvironmentId, environmentId, workloadProfileName, latestRevisionName, latestReadyRevisionName, latestRevisionFqdn, customDomainVerificationId, configuration, template, outboundIPAddressList?.ToList(), eventStreamEndpoint, default); } - /// Initializes a new instance of ContainerAppIngressConfiguration. + /// Initializes a new instance of . /// Hostname. /// Bool indicating if app exposes an external http endpoint. /// Target Port in containers for traffic from ingress. @@ -237,20 +237,20 @@ public static ContainerAppIngressConfiguration ContainerAppIngressConfiguration( customDomains ??= new List(); ipSecurityRestrictions ??= new List(); - return new ContainerAppIngressConfiguration(fqdn, external, targetPort, exposedPort, transport, traffic?.ToList(), customDomains?.ToList(), allowInsecure, ipSecurityRestrictions?.ToList(), stickySessionsAffinity != null ? new IngressStickySessions(stickySessionsAffinity) : null, clientCertificateMode, corsPolicy); + return new ContainerAppIngressConfiguration(fqdn, external, targetPort, exposedPort, transport, traffic?.ToList(), customDomains?.ToList(), allowInsecure, ipSecurityRestrictions?.ToList(), stickySessionsAffinity != null ? new IngressStickySessions(stickySessionsAffinity, new Dictionary()) : null, clientCertificateMode, corsPolicy, default); } - /// Initializes a new instance of AppContainerResources. + /// Initializes a new instance of . /// Required CPU in cores, e.g. 0.5. /// Required memory, e.g. "250Mb". /// Ephemeral Storage, e.g. "1Gi". /// A new instance for mocking. public static AppContainerResources AppContainerResources(double? cpu = null, string memory = null, string ephemeralStorage = null) { - return new AppContainerResources(cpu, memory, ephemeralStorage); + return new AppContainerResources(cpu, memory, ephemeralStorage, default); } - /// Initializes a new instance of ContainerAppCustomHostnameAnalysisResult. + /// Initializes a new instance of . /// Host name that was analyzed. /// <code>true</code> if hostname is already verified; otherwise, <code>false</code>. /// DNS verification test result. @@ -272,10 +272,10 @@ public static ContainerAppCustomHostnameAnalysisResult ContainerAppCustomHostnam alternateCNameRecords ??= new List(); alternateTxtRecords ??= new List(); - return new ContainerAppCustomHostnameAnalysisResult(hostName, isHostnameAlreadyVerified, customDomainVerificationTest, customDomainVerificationFailureInfo, hasConflictOnManagedEnvironment, conflictWithEnvironmentCustomDomain, conflictingContainerAppResourceId, cNameRecords?.ToList(), txtRecords?.ToList(), aRecords?.ToList(), alternateCNameRecords?.ToList(), alternateTxtRecords?.ToList()); + return new ContainerAppCustomHostnameAnalysisResult(hostName, isHostnameAlreadyVerified, customDomainVerificationTest, customDomainVerificationFailureInfo, hasConflictOnManagedEnvironment, conflictWithEnvironmentCustomDomain, conflictingContainerAppResourceId, cNameRecords?.ToList(), txtRecords?.ToList(), aRecords?.ToList(), alternateCNameRecords?.ToList(), alternateTxtRecords?.ToList(), default); } - /// Initializes a new instance of ContainerAppCustomDomainVerificationFailureInfo. + /// Initializes a new instance of . /// Standardized string to programmatically identify the error. /// Detailed error description and debugging information. /// Detailed error description and debugging information. @@ -285,20 +285,20 @@ public static ContainerAppCustomDomainVerificationFailureInfo ContainerAppCustom { details ??= new List(); - return new ContainerAppCustomDomainVerificationFailureInfo(code, message, target, details?.ToList()); + return new ContainerAppCustomDomainVerificationFailureInfo(code, message, target, details?.ToList(), default); } - /// Initializes a new instance of ContainerAppCustomDomainVerificationFailureInfoDetailsItem. + /// Initializes a new instance of . /// Standardized string to programmatically identify the error. /// Detailed error description and debugging information. /// Detailed error description and debugging information. /// A new instance for mocking. public static ContainerAppCustomDomainVerificationFailureInfoDetailsItem ContainerAppCustomDomainVerificationFailureInfoDetailsItem(string code = null, string message = null, string target = null) { - return new ContainerAppCustomDomainVerificationFailureInfoDetailsItem(code, message, target); + return new ContainerAppCustomDomainVerificationFailureInfoDetailsItem(code, message, target, default); } - /// Initializes a new instance of ContainerAppSecret. + /// Initializes a new instance of . /// Secret Name. /// Secret Value. /// Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. @@ -306,10 +306,10 @@ public static ContainerAppCustomDomainVerificationFailureInfoDetailsItem Contain /// A new instance for mocking. public static ContainerAppSecret ContainerAppSecret(string name = null, string value = null, string identity = null, Uri keyVaultUri = null) { - return new ContainerAppSecret(name, value, identity, keyVaultUri); + return new ContainerAppSecret(name, value, identity, keyVaultUri, default); } - /// Initializes a new instance of ContainerAppAuthToken. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -323,10 +323,10 @@ public static ContainerAppAuthToken ContainerAppAuthToken(ResourceIdentifier id { tags ??= new Dictionary(); - return new ContainerAppAuthToken(id, name, resourceType, systemData, tags, location, token, expireOn); + return new ContainerAppAuthToken(id, name, resourceType, systemData, tags, location, token, expireOn, default); } - /// Initializes a new instance of ContainerAppRevisionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -352,10 +352,10 @@ public static ContainerAppAuthToken ContainerAppAuthToken(ResourceIdentifier id /// A new instance for mocking. public static ContainerAppRevisionData ContainerAppRevisionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastActiveOn = null, string fqdn = null, ContainerAppTemplate template = null, bool? isActive = null, int? replicas = null, int? trafficWeight = null, string provisioningError = null, ContainerAppRevisionHealthState? healthState = null, ContainerAppRevisionProvisioningState? provisioningState = null, RevisionRunningState? runningState = null) { - return new ContainerAppRevisionData(id, name, resourceType, systemData, createdOn, lastActiveOn, fqdn, template, isActive, replicas, trafficWeight, provisioningError, healthState, provisioningState, runningState); + return new ContainerAppRevisionData(id, name, resourceType, systemData, createdOn, lastActiveOn, fqdn, template, isActive, replicas, trafficWeight, provisioningError, healthState, provisioningState, runningState, default); } - /// Initializes a new instance of ContainerAppReplicaData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -371,10 +371,10 @@ public static ContainerAppReplicaData ContainerAppReplicaData(ResourceIdentifier containers ??= new List(); initContainers ??= new List(); - return new ContainerAppReplicaData(id, name, resourceType, systemData, createdOn, runningState, runningStateDetails, containers?.ToList(), initContainers?.ToList()); + return new ContainerAppReplicaData(id, name, resourceType, systemData, createdOn, runningState, runningStateDetails, containers?.ToList(), initContainers?.ToList(), default); } - /// Initializes a new instance of ContainerAppReplicaContainer. + /// Initializes a new instance of . /// The Name of the Container. /// The Id of the Container. /// The container ready status. @@ -387,10 +387,10 @@ public static ContainerAppReplicaData ContainerAppReplicaData(ResourceIdentifier /// A new instance for mocking. public static ContainerAppReplicaContainer ContainerAppReplicaContainer(string name = null, string containerId = null, bool? isReady = null, bool? isStarted = null, int? restartCount = null, ContainerAppContainerRunningState? runningState = null, string runningStateDetails = null, string logStreamEndpoint = null, string execEndpoint = null) { - return new ContainerAppReplicaContainer(name, containerId, isReady, isStarted, restartCount, runningState, runningStateDetails, logStreamEndpoint, execEndpoint); + return new ContainerAppReplicaContainer(name, containerId, isReady, isStarted, restartCount, runningState, runningStateDetails, logStreamEndpoint, execEndpoint, default); } - /// Initializes a new instance of ContainerAppDiagnosticData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -399,10 +399,10 @@ public static ContainerAppReplicaContainer ContainerAppReplicaContainer(string n /// A new instance for mocking. public static ContainerAppDiagnosticData ContainerAppDiagnosticData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerAppDiagnosticsProperties properties = null) { - return new ContainerAppDiagnosticData(id, name, resourceType, systemData, properties); + return new ContainerAppDiagnosticData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of ContainerAppDiagnosticsMetadata. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -419,19 +419,19 @@ public static ContainerAppDiagnosticsMetadata ContainerAppDiagnosticsMetadata(Re supportTopicList ??= new List(); analysisTypes ??= new List(); - return new ContainerAppDiagnosticsMetadata(id, name, resourceType, systemData, description, author, category, supportTopicList?.ToList(), analysisTypes?.ToList(), score); + return new ContainerAppDiagnosticsMetadata(id, name, resourceType, systemData, description, author, category, supportTopicList?.ToList(), analysisTypes?.ToList(), score, default); } - /// Initializes a new instance of ContainerAppDiagnosticSupportTopic. + /// Initializes a new instance of . /// Unique topic identifier. /// PES identifier. /// A new instance for mocking. public static ContainerAppDiagnosticSupportTopic ContainerAppDiagnosticSupportTopic(string id = null, string pesId = null) { - return new ContainerAppDiagnosticSupportTopic(id, pesId); + return new ContainerAppDiagnosticSupportTopic(id, pesId, default); } - /// Initializes a new instance of ContainerAppManagedEnvironmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -465,10 +465,10 @@ public static ContainerAppManagedEnvironmentData ContainerAppManagedEnvironmentD tags ??= new Dictionary(); workloadProfiles ??= new List(); - return new ContainerAppManagedEnvironmentData(id, name, resourceType, systemData, tags, location, kind, provisioningState, daprAIInstrumentationKey, daprAIConnectionString, vnetConfiguration, deploymentErrors, defaultDomain, staticIP, appLogsConfiguration, isZoneRedundant, customDomainConfiguration, eventStreamEndpoint, workloadProfiles?.ToList(), kedaVersion != null ? new KedaConfiguration(kedaVersion) : null, daprVersion != null ? new DaprConfiguration(daprVersion) : null, infrastructureResourceGroup, isMtlsEnabled != null ? new ManagedEnvironmentPropertiesPeerAuthentication(new Mtls(isMtlsEnabled)) : null); + return new ContainerAppManagedEnvironmentData(id, name, resourceType, systemData, tags, location, kind, provisioningState, daprAIInstrumentationKey, daprAIConnectionString, vnetConfiguration, deploymentErrors, defaultDomain, staticIP, appLogsConfiguration, isZoneRedundant, customDomainConfiguration, eventStreamEndpoint, workloadProfiles?.ToList(), kedaVersion != null ? new KedaConfiguration(kedaVersion, new Dictionary()) : null, daprVersion != null ? new DaprConfiguration(daprVersion, new Dictionary()) : null, infrastructureResourceGroup, isMtlsEnabled != null ? new ManagedEnvironmentPropertiesPeerAuthentication(new Mtls(isMtlsEnabled, new Dictionary()), new Dictionary()) : null, default); } - /// Initializes a new instance of ContainerAppJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -489,19 +489,19 @@ public static ContainerAppJobData ContainerAppJobData(ResourceIdentifier id = nu tags ??= new Dictionary(); outboundIPAddresses ??= new List(); - return new ContainerAppJobData(id, name, resourceType, systemData, tags, location, identity, provisioningState, environmentId, workloadProfileName, configuration, template, outboundIPAddresses?.ToList(), eventStreamEndpoint); + return new ContainerAppJobData(id, name, resourceType, systemData, tags, location, identity, provisioningState, environmentId, workloadProfileName, configuration, template, outboundIPAddresses?.ToList(), eventStreamEndpoint, default); } - /// Initializes a new instance of ContainerAppJobExecutionBase. + /// Initializes a new instance of . /// Job execution name. /// Job execution Id. /// A new instance for mocking. public static ContainerAppJobExecutionBase ContainerAppJobExecutionBase(string name = null, string id = null) { - return new ContainerAppJobExecutionBase(name, id); + return new ContainerAppJobExecutionBase(name, id, default); } - /// Initializes a new instance of ContainerAppJobExecutions. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. /// A new instance for mocking. @@ -509,10 +509,10 @@ public static ContainerAppJobExecutions ContainerAppJobExecutions(IEnumerable(); - return new ContainerAppJobExecutions(value?.ToList(), nextLink); + return new ContainerAppJobExecutions(value?.ToList(), nextLink, default); } - /// Initializes a new instance of ContainerAppJobExecutionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -524,10 +524,10 @@ public static ContainerAppJobExecutions ContainerAppJobExecutions(IEnumerable A new instance for mocking. public static ContainerAppJobExecutionData ContainerAppJobExecutionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, JobExecutionRunningState? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, ContainerAppJobExecutionTemplate template = null) { - return new ContainerAppJobExecutionData(id, name, resourceType, systemData, status, startOn, endOn, template); + return new ContainerAppJobExecutionData(id, name, resourceType, systemData, status, startOn, endOn, template, default); } - /// Initializes a new instance of ContainerAppManagedCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -540,10 +540,10 @@ public static ContainerAppManagedCertificateData ContainerAppManagedCertificateD { tags ??= new Dictionary(); - return new ContainerAppManagedCertificateData(id, name, resourceType, systemData, tags, location, properties); + return new ContainerAppManagedCertificateData(id, name, resourceType, systemData, tags, location, properties, default); } - /// Initializes a new instance of ManagedCertificateProperties. + /// Initializes a new instance of . /// Provisioning state of the certificate. /// Subject name of the certificate. /// Any error occurred during the certificate provision. @@ -552,10 +552,10 @@ public static ContainerAppManagedCertificateData ContainerAppManagedCertificateD /// A new instance for mocking. public static ManagedCertificateProperties ManagedCertificateProperties(ContainerAppCertificateProvisioningState? provisioningState = null, string subjectName = null, string error = null, ManagedCertificateDomainControlValidation? domainControlValidation = null, string validationToken = null) { - return new ManagedCertificateProperties(provisioningState, subjectName, error, domainControlValidation, validationToken); + return new ManagedCertificateProperties(provisioningState, subjectName, error, domainControlValidation, validationToken, default); } - /// Initializes a new instance of ContainerAppEnvironmentAuthToken. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -569,10 +569,10 @@ public static ContainerAppEnvironmentAuthToken ContainerAppEnvironmentAuthToken( { tags ??= new Dictionary(); - return new ContainerAppEnvironmentAuthToken(id, name, resourceType, systemData, tags, location, token, expireOn); + return new ContainerAppEnvironmentAuthToken(id, name, resourceType, systemData, tags, location, token, expireOn, default); } - /// Initializes a new instance of ContainerAppWorkloadProfileState. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -581,10 +581,10 @@ public static ContainerAppEnvironmentAuthToken ContainerAppEnvironmentAuthToken( /// A new instance for mocking. public static ContainerAppWorkloadProfileState ContainerAppWorkloadProfileState(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerAppWorkloadProfileStateProperties properties = null) { - return new ContainerAppWorkloadProfileState(id, name, resourceType, systemData, properties); + return new ContainerAppWorkloadProfileState(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of ContainerAppManagedEnvironmentStorageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -593,10 +593,10 @@ public static ContainerAppWorkloadProfileState ContainerAppWorkloadProfileState( /// A new instance for mocking. public static ContainerAppManagedEnvironmentStorageData ContainerAppManagedEnvironmentStorageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerAppAzureFileProperties managedEnvironmentStorageAzureFile = null) { - return new ContainerAppManagedEnvironmentStorageData(id, name, resourceType, systemData, managedEnvironmentStorageAzureFile != null ? new ManagedEnvironmentStorageProperties(managedEnvironmentStorageAzureFile) : null); + return new ContainerAppManagedEnvironmentStorageData(id, name, resourceType, systemData, managedEnvironmentStorageAzureFile != null ? new ManagedEnvironmentStorageProperties(managedEnvironmentStorageAzureFile, new Dictionary()) : null, default); } - /// Initializes a new instance of ContainerAppSourceControlData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -612,7 +612,7 @@ public static ContainerAppManagedEnvironmentStorageData ContainerAppManagedEnvir /// A new instance for mocking. public static ContainerAppSourceControlData ContainerAppSourceControlData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerAppSourceControlOperationState? operationState = null, Uri repoUri = null, string branch = null, ContainerAppGitHubActionConfiguration gitHubActionConfiguration = null) { - return new ContainerAppSourceControlData(id, name, resourceType, systemData, operationState, repoUri, branch, gitHubActionConfiguration); + return new ContainerAppSourceControlData(id, name, resourceType, systemData, operationState, repoUri, branch, gitHubActionConfiguration, default); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs index 5f7b61113226..d3faeedc7934 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppAuthConfigContainerAppsAuthConfigsRestClient.CreateListByContainerAppRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppAuthConfigContainerAppsAuthConfigsRestClient.CreateListByContainerAppNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppAuthConfigResource(Client, ContainerAppAuthConfigData.DeserializeContainerAppAuthConfigData(e)), _containerAppAuthConfigContainerAppsAuthConfigsClientDiagnostics, Pipeline, "ContainerAppAuthConfigCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppAuthConfigResource(Client, ContainerAppAuthConfigData.DeserializeContainerAppAuthConfigData(e)), _containerAppAuthConfigContainerAppsAuthConfigsClientDiagnostics, Pipeline, "ContainerAppAuthConfigCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppAuthConfigContainerAppsAuthConfigsRestClient.CreateListByContainerAppRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppAuthConfigContainerAppsAuthConfigsRestClient.CreateListByContainerAppNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppAuthConfigResource(Client, ContainerAppAuthConfigData.DeserializeContainerAppAuthConfigData(e)), _containerAppAuthConfigContainerAppsAuthConfigsClientDiagnostics, Pipeline, "ContainerAppAuthConfigCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppAuthConfigResource(Client, ContainerAppAuthConfigData.DeserializeContainerAppAuthConfigData(e)), _containerAppAuthConfigContainerAppsAuthConfigsClientDiagnostics, Pipeline, "ContainerAppAuthConfigCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigData.cs index ad597cbbac8f..d08a77ef3add 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppAuthConfigData : ResourceData { - /// Initializes a new instance of ContainerAppAuthConfigData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAuthConfigData() { } - /// Initializes a new instance of ContainerAppAuthConfigData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,13 +37,15 @@ public ContainerAppAuthConfigData() /// The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. /// The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. /// The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. - internal ContainerAppAuthConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppAuthPlatform platform, ContainerAppGlobalValidation globalValidation, ContainerAppIdentityProvidersConfiguration identityProviders, ContainerAppLogin login, ContainerAppHttpSettings httpSettings) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAuthConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppAuthPlatform platform, ContainerAppGlobalValidation globalValidation, ContainerAppIdentityProvidersConfiguration identityProviders, ContainerAppLogin login, ContainerAppHttpSettings httpSettings, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Platform = platform; GlobalValidation = globalValidation; IdentityProviders = identityProviders; Login = login; HttpSettings = httpSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The configuration settings of the platform of ContainerApp Service Authentication/Authorization. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCertificateData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCertificateData.cs index f56d8ec7be6e..dc86ce2d28bb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCertificateData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCertificateData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppCertificateData : TrackedResourceData { - /// Initializes a new instance of ContainerAppCertificateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppCertificateData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerAppCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +36,16 @@ public ContainerAppCertificateData(AzureLocation location) : base(location) /// The tags. /// The location. /// Certificate resource specific properties. - internal ContainerAppCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppCertificateProperties properties) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppCertificateProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppCertificateData() + { } /// Certificate resource specific properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs index c208350140ff..498d1eb2665d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), _containerAppClientDiagnostics, Pipeline, "ContainerAppCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), _containerAppClientDiagnostics, Pipeline, "ContainerAppCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), _containerAppClientDiagnostics, Pipeline, "ContainerAppCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), _containerAppClientDiagnostics, Pipeline, "ContainerAppCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs index 0a314916b288..686eac9d68e6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable Get { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppConnectedEnvironmentCertificateConnectedEnvironmentsCertificatesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs index 6541be59ccf6..cb91aeebe148 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs index bc0a20a3e25f..a9564ddee09c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable G { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppConnectedEnvironmentDaprComponentConnectedEnvironmentsDaprComponentsClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentData.cs index 935cc754702e..f5bd2408b09e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppConnectedEnvironmentData : TrackedResourceData { - /// Initializes a new instance of ContainerAppConnectedEnvironmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppConnectedEnvironmentData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerAppConnectedEnvironmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public ContainerAppConnectedEnvironmentData(AzureLocation location) : base(locat /// Static IP of the connectedEnvironment. /// Application Insights connection string used by Dapr to export Service to Service communication telemetry. /// Custom domain configuration for the environment. - internal ContainerAppConnectedEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppExtendedLocation extendedLocation, ContainerAppConnectedEnvironmentProvisioningState? provisioningState, string deploymentErrors, string defaultDomain, IPAddress staticIP, string daprAIConnectionString, ContainerAppCustomDomainConfiguration customDomainConfiguration) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppConnectedEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppExtendedLocation extendedLocation, ContainerAppConnectedEnvironmentProvisioningState? provisioningState, string deploymentErrors, string defaultDomain, IPAddress staticIP, string daprAIConnectionString, ContainerAppCustomDomainConfiguration customDomainConfiguration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; ProvisioningState = provisioningState; @@ -48,6 +53,12 @@ internal ContainerAppConnectedEnvironmentData(ResourceIdentifier id, string name StaticIP = staticIP; DaprAIConnectionString = daprAIConnectionString; CustomDomainConfiguration = customDomainConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppConnectedEnvironmentData() + { } /// The complex type of the extended location. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs index 7bad16892817..0516b33eb078 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(str public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ContainerAppConnectedEnvironmentStorageResource(Client, ContainerAppConnectedEnvironmentStorageData.DeserializeContainerAppConnectedEnvironmentStorageData(e)), _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ContainerAppConnectedEnvironmentStorageResource(Client, ContainerAppConnectedEnvironmentStorageData.DeserializeContainerAppConnectedEnvironmentStorageData(e)), _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable Ge public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ContainerAppConnectedEnvironmentStorageResource(Client, ContainerAppConnectedEnvironmentStorageData.DeserializeContainerAppConnectedEnvironmentStorageData(e)), _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ContainerAppConnectedEnvironmentStorageResource(Client, ContainerAppConnectedEnvironmentStorageData.DeserializeContainerAppConnectedEnvironmentStorageData(e)), _containerAppConnectedEnvironmentStorageConnectedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppConnectedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageData.cs index 4d6f9762f4a9..e657359e2094 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppConnectedEnvironmentStorageData : ResourceData { - /// Initializes a new instance of ContainerAppConnectedEnvironmentStorageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppConnectedEnvironmentStorageData() { } - /// Initializes a new instance of ContainerAppConnectedEnvironmentStorageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Storage properties. - internal ContainerAppConnectedEnvironmentStorageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConnectedEnvironmentStorageProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppConnectedEnvironmentStorageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConnectedEnvironmentStorageProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Storage properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDaprComponentData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDaprComponentData.cs index 6eb5eccad501..253ec2824950 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDaprComponentData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDaprComponentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppDaprComponentData : ResourceData { - /// Initializes a new instance of ContainerAppDaprComponentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDaprComponentData() { Secrets = new ChangeTrackingList(); @@ -26,7 +30,7 @@ public ContainerAppDaprComponentData() Scopes = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppDaprComponentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public ContainerAppDaprComponentData() /// Name of a Dapr component to retrieve component secrets from. /// Component metadata. /// Names of container apps that can use this Dapr component. - internal ContainerAppDaprComponentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string componentType, string version, bool? ignoreErrors, string initTimeout, IList secrets, string secretStoreComponent, IList metadata, IList scopes) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDaprComponentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string componentType, string version, bool? ignoreErrors, string initTimeout, IList secrets, string secretStoreComponent, IList metadata, IList scopes, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ComponentType = componentType; Version = version; @@ -49,6 +54,7 @@ internal ContainerAppDaprComponentData(ResourceIdentifier id, string name, Resou SecretStoreComponent = secretStoreComponent; Metadata = metadata; Scopes = scopes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Component type. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppData.cs index b66cb0ea68a8..1fd2ff4b4d54 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppData.cs @@ -20,14 +20,17 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppData : TrackedResourceData { - /// Initializes a new instance of ContainerAppData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppData(AzureLocation location) : base(location) { OutboundIPAddressList = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public ContainerAppData(AzureLocation location) : base(location) /// Container App versioned application definition. /// Outbound IP Addresses for container app. /// The endpoint of the eventstream of the container app. - internal ContainerAppData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppExtendedLocation extendedLocation, ManagedServiceIdentity identity, string managedBy, ContainerAppProvisioningState? provisioningState, ResourceIdentifier managedEnvironmentId, ResourceIdentifier environmentId, string workloadProfileName, string latestRevisionName, string latestReadyRevisionName, string latestRevisionFqdn, string customDomainVerificationId, ContainerAppConfiguration configuration, ContainerAppTemplate template, IReadOnlyList outboundIPAddressList, Uri eventStreamEndpoint) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppExtendedLocation extendedLocation, ManagedServiceIdentity identity, string managedBy, ContainerAppProvisioningState? provisioningState, ResourceIdentifier managedEnvironmentId, ResourceIdentifier environmentId, string workloadProfileName, string latestRevisionName, string latestReadyRevisionName, string latestRevisionFqdn, string customDomainVerificationId, ContainerAppConfiguration configuration, ContainerAppTemplate template, IReadOnlyList outboundIPAddressList, Uri eventStreamEndpoint, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; Identity = identity; @@ -66,6 +70,12 @@ internal ContainerAppData(ResourceIdentifier id, string name, ResourceType resou Template = template; OutboundIPAddressList = outboundIPAddressList; EventStreamEndpoint = eventStreamEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppData() + { } /// The complex type of the extended location. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs index 885aed111a13..17f0114d30e0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppDetectorContainerAppsDiagnosticsRestClient.CreateListDetectorsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppDetectorContainerAppsDiagnosticsRestClient.CreateListDetectorsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppDetectorContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppDetectorContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppDetectorContainerAppsDiagnosticsRestClient.CreateListDetectorsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppDetectorContainerAppsDiagnosticsRestClient.CreateListDetectorsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppDetectorContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppDetectorContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs index 1d280002260d..4aebd670a45e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsRestClient.CreateListRevisionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsRestClient.CreateListRevisionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppDetectorPropertyRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorPropertyRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppDetectorPropertyRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorPropertyRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(str { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsRestClient.CreateListRevisionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsRestClient.CreateListRevisionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppDetectorPropertyRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorPropertyRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppDetectorPropertyRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppDetectorPropertyRevisionContainerAppsDiagnosticsClientDiagnostics, Pipeline, "ContainerAppDetectorPropertyRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDiagnosticData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDiagnosticData.cs index 9b2e712f3781..f1d7c9c203a9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDiagnosticData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDiagnosticData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppDiagnosticData : ResourceData { - /// Initializes a new instance of ContainerAppDiagnosticData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticData() { } - /// Initializes a new instance of ContainerAppDiagnosticData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Diagnostics resource specific properties. - internal ContainerAppDiagnosticData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppDiagnosticsProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppDiagnosticsProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Diagnostics resource specific properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs index 854523d5f69e..ce91838cf008 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppJobJobsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppJobJobsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), _containerAppJobJobsClientDiagnostics, Pipeline, "ContainerAppJobCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), _containerAppJobJobsClientDiagnostics, Pipeline, "ContainerAppJobCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppJobJobsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppJobJobsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), _containerAppJobJobsClientDiagnostics, Pipeline, "ContainerAppJobCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), _containerAppJobJobsClientDiagnostics, Pipeline, "ContainerAppJobCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobData.cs index 5d1f77a270f6..5248c52422c3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppJobData : TrackedResourceData { - /// Initializes a new instance of ContainerAppJobData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppJobData(AzureLocation location) : base(location) { OutboundIPAddresses = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -40,7 +44,8 @@ public ContainerAppJobData(AzureLocation location) : base(location) /// Container Apps job definition. /// Outbound IP Addresses of a container apps job. /// The endpoint of the eventstream of the container apps job. - internal ContainerAppJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ContainerAppJobProvisioningState? provisioningState, string environmentId, string workloadProfileName, ContainerAppJobConfiguration configuration, ContainerAppJobTemplate template, IReadOnlyList outboundIPAddresses, string eventStreamEndpoint) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ContainerAppJobProvisioningState? provisioningState, string environmentId, string workloadProfileName, ContainerAppJobConfiguration configuration, ContainerAppJobTemplate template, IReadOnlyList outboundIPAddresses, string eventStreamEndpoint, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; ProvisioningState = provisioningState; @@ -50,6 +55,12 @@ internal ContainerAppJobData(ResourceIdentifier id, string name, ResourceType re Template = template; OutboundIPAddresses = outboundIPAddresses; EventStreamEndpoint = eventStreamEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppJobData() + { } /// Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs index fc8654dc85cb..13b86c5bd99d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionCollection.cs @@ -152,7 +152,7 @@ public virtual AsyncPageable GetAllAsync(strin { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppJobExecutionJobsExecutionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppJobExecutionJobsExecutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobExecutionResource(Client, ContainerAppJobExecutionData.DeserializeContainerAppJobExecutionData(e)), _containerAppJobExecutionJobsExecutionsClientDiagnostics, Pipeline, "ContainerAppJobExecutionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppJobExecutionResource(Client, ContainerAppJobExecutionData.DeserializeContainerAppJobExecutionData(e)), _containerAppJobExecutionJobsExecutionsClientDiagnostics, Pipeline, "ContainerAppJobExecutionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -175,7 +175,7 @@ public virtual Pageable GetAll(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppJobExecutionJobsExecutionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppJobExecutionJobsExecutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobExecutionResource(Client, ContainerAppJobExecutionData.DeserializeContainerAppJobExecutionData(e)), _containerAppJobExecutionJobsExecutionsClientDiagnostics, Pipeline, "ContainerAppJobExecutionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppJobExecutionResource(Client, ContainerAppJobExecutionData.DeserializeContainerAppJobExecutionData(e)), _containerAppJobExecutionJobsExecutionsClientDiagnostics, Pipeline, "ContainerAppJobExecutionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionData.cs index 0f6a9c40389b..134293f4ad15 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppJobExecutionData : ResourceData { - /// Initializes a new instance of ContainerAppJobExecutionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppJobExecutionData() { } - /// Initializes a new instance of ContainerAppJobExecutionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,12 +36,14 @@ internal ContainerAppJobExecutionData() /// Job execution start time. /// Job execution end time. /// Job's execution container. - internal ContainerAppJobExecutionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, JobExecutionRunningState? status, DateTimeOffset? startOn, DateTimeOffset? endOn, ContainerAppJobExecutionTemplate template) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobExecutionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, JobExecutionRunningState? status, DateTimeOffset? startOn, DateTimeOffset? endOn, ContainerAppJobExecutionTemplate template, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Status = status; StartOn = startOn; EndOn = endOn; Template = template; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Current running State of the job. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs index bbbcae3ff0cd..15ad54ba25fd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedCertificateManagedCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedCertificateManagedCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedCertificateResource(Client, ContainerAppManagedCertificateData.DeserializeContainerAppManagedCertificateData(e)), _containerAppManagedCertificateManagedCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedCertificateResource(Client, ContainerAppManagedCertificateData.DeserializeContainerAppManagedCertificateData(e)), _containerAppManagedCertificateManagedCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedCertificateManagedCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedCertificateManagedCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedCertificateResource(Client, ContainerAppManagedCertificateData.DeserializeContainerAppManagedCertificateData(e)), _containerAppManagedCertificateManagedCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedCertificateResource(Client, ContainerAppManagedCertificateData.DeserializeContainerAppManagedCertificateData(e)), _containerAppManagedCertificateManagedCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateData.cs index 96b8e1e7edcc..c3cf38a4fc58 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppManagedCertificateData : TrackedResourceData { - /// Initializes a new instance of ContainerAppManagedCertificateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppManagedCertificateData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerAppManagedCertificateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +36,16 @@ public ContainerAppManagedCertificateData(AzureLocation location) : base(locatio /// The tags. /// The location. /// Certificate resource specific properties. - internal ContainerAppManagedCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedCertificateProperties properties) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppManagedCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedCertificateProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppManagedCertificateData() + { } /// Certificate resource specific properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs index 0d616e7927ee..9e45f3fa5bfc 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedEnvironmentCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppManagedEnvironmentCertificateCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppManagedEnvironmentCertificateCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedEnvironmentCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppManagedEnvironmentCertificateCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentCertificateResource(Client, ContainerAppCertificateData.DeserializeContainerAppCertificateData(e)), _containerAppManagedEnvironmentCertificateCertificatesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCertificateCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs index 51e77ed38be9..dfba62710c34 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs index 09887cc336f8..6664553320d7 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable _containerAppManagedEnvironmentDaprComponentDaprComponentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedEnvironmentDaprComponentDaprComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppManagedEnvironmentDaprComponentDaprComponentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppManagedEnvironmentDaprComponentDaprComponentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable Get { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentDaprComponentDaprComponentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppManagedEnvironmentDaprComponentDaprComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppManagedEnvironmentDaprComponentDaprComponentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentDaprComponentResource(Client, ContainerAppDaprComponentData.DeserializeContainerAppDaprComponentData(e)), _containerAppManagedEnvironmentDaprComponentDaprComponentsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDaprComponentCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentData.cs index 9230f149f70e..60ddd14706ea 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using Azure.Core; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppManagedEnvironmentData : TrackedResourceData { - /// Initializes a new instance of ContainerAppManagedEnvironmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppManagedEnvironmentData(AzureLocation location) : base(location) { WorkloadProfiles = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppManagedEnvironmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -54,7 +58,8 @@ public ContainerAppManagedEnvironmentData(AzureLocation location) : base(locatio /// The configuration of Dapr component. /// Name of the platform-managed resource group created for the Managed Environment to host infrastructure resources. If a subnet ID is provided, this resource group will be created in the same subscription as the subnet. /// Peer authentication settings for the Managed Environment. - internal ContainerAppManagedEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string kind, ContainerAppEnvironmentProvisioningState? provisioningState, string daprAIInstrumentationKey, string daprAIConnectionString, ContainerAppVnetConfiguration vnetConfiguration, string deploymentErrors, string defaultDomain, IPAddress staticIP, ContainerAppLogsConfiguration appLogsConfiguration, bool? isZoneRedundant, ContainerAppCustomDomainConfiguration customDomainConfiguration, string eventStreamEndpoint, IList workloadProfiles, KedaConfiguration kedaConfiguration, DaprConfiguration daprConfiguration, string infrastructureResourceGroup, ManagedEnvironmentPropertiesPeerAuthentication peerAuthentication) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppManagedEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string kind, ContainerAppEnvironmentProvisioningState? provisioningState, string daprAIInstrumentationKey, string daprAIConnectionString, ContainerAppVnetConfiguration vnetConfiguration, string deploymentErrors, string defaultDomain, IPAddress staticIP, ContainerAppLogsConfiguration appLogsConfiguration, bool? isZoneRedundant, ContainerAppCustomDomainConfiguration customDomainConfiguration, string eventStreamEndpoint, IList workloadProfiles, KedaConfiguration kedaConfiguration, DaprConfiguration daprConfiguration, string infrastructureResourceGroup, ManagedEnvironmentPropertiesPeerAuthentication peerAuthentication, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ProvisioningState = provisioningState; @@ -73,6 +78,12 @@ internal ContainerAppManagedEnvironmentData(ResourceIdentifier id, string name, DaprConfiguration = daprConfiguration; InfrastructureResourceGroup = infrastructureResourceGroup; PeerAuthentication = peerAuthentication; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppManagedEnvironmentData() + { } /// Kind of the Environment. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs index a1bc5cd345ae..6ab145cbddaf 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(stri public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsRestClient.CreateListDetectorsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ContainerAppManagedEnvironmentDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDetectorCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ContainerAppManagedEnvironmentDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDetectorCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable Get public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsRestClient.CreateListDetectorsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ContainerAppManagedEnvironmentDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDetectorCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ContainerAppManagedEnvironmentDetectorResource(Client, ContainerAppDiagnosticData.DeserializeContainerAppDiagnosticData(e)), _containerAppManagedEnvironmentDetectorManagedEnvironmentDiagnosticsClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentDetectorCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs index 73e80e002973..5ae0908788ce 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(strin public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ContainerAppManagedEnvironmentStorageResource(Client, ContainerAppManagedEnvironmentStorageData.DeserializeContainerAppManagedEnvironmentStorageData(e)), _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ContainerAppManagedEnvironmentStorageResource(Client, ContainerAppManagedEnvironmentStorageData.DeserializeContainerAppManagedEnvironmentStorageData(e)), _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetA public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ContainerAppManagedEnvironmentStorageResource(Client, ContainerAppManagedEnvironmentStorageData.DeserializeContainerAppManagedEnvironmentStorageData(e)), _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ContainerAppManagedEnvironmentStorageResource(Client, ContainerAppManagedEnvironmentStorageData.DeserializeContainerAppManagedEnvironmentStorageData(e)), _containerAppManagedEnvironmentStorageManagedEnvironmentsStoragesClientDiagnostics, Pipeline, "ContainerAppManagedEnvironmentStorageCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageData.cs index acbcb876e4c1..1060ed645545 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppManagedEnvironmentStorageData : ResourceData { - /// Initializes a new instance of ContainerAppManagedEnvironmentStorageData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppManagedEnvironmentStorageData() { } - /// Initializes a new instance of ContainerAppManagedEnvironmentStorageData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Storage properties. - internal ContainerAppManagedEnvironmentStorageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedEnvironmentStorageProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppManagedEnvironmentStorageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedEnvironmentStorageProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Storage properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs index 3fec0954cccb..98e5db5bceed 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string replicaName, Can public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppReplicaContainerAppsRevisionReplicasRestClient.CreateListReplicasRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ContainerAppReplicaResource(Client, ContainerAppReplicaData.DeserializeContainerAppReplicaData(e)), _containerAppReplicaContainerAppsRevisionReplicasClientDiagnostics, Pipeline, "ContainerAppReplicaCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ContainerAppReplicaResource(Client, ContainerAppReplicaData.DeserializeContainerAppReplicaData(e)), _containerAppReplicaContainerAppsRevisionReplicasClientDiagnostics, Pipeline, "ContainerAppReplicaCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppReplicaContainerAppsRevisionReplicasRestClient.CreateListReplicasRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ContainerAppReplicaResource(Client, ContainerAppReplicaData.DeserializeContainerAppReplicaData(e)), _containerAppReplicaContainerAppsRevisionReplicasClientDiagnostics, Pipeline, "ContainerAppReplicaCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ContainerAppReplicaResource(Client, ContainerAppReplicaData.DeserializeContainerAppReplicaData(e)), _containerAppReplicaContainerAppsRevisionReplicasClientDiagnostics, Pipeline, "ContainerAppReplicaCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaData.cs index 46c1ac891475..94023caa1cb6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppReplicaData : ResourceData { - /// Initializes a new instance of ContainerAppReplicaData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppReplicaData() { Containers = new ChangeTrackingList(); InitContainers = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppReplicaData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,13 +39,15 @@ public ContainerAppReplicaData() /// The details of replica current running state. /// The containers collection under a replica. /// The init containers collection under a replica. - internal ContainerAppReplicaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, ContainerAppReplicaRunningState? runningState, string runningStateDetails, IList containers, IList initContainers) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppReplicaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, ContainerAppReplicaRunningState? runningState, string runningStateDetails, IList containers, IList initContainers, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { CreatedOn = createdOn; RunningState = runningState; RunningStateDetails = runningStateDetails; Containers = containers; InitContainers = initContainers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Timestamp describing when the pod was created by controller. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs index 8607ee3e46ec..813e55a3d133 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionCollection.cs @@ -147,7 +147,7 @@ public virtual AsyncPageable GetAllAsync(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppRevisionContainerAppsRevisionsRestClient.CreateListRevisionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppRevisionContainerAppsRevisionsRestClient.CreateListRevisionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppRevisionContainerAppsRevisionsClientDiagnostics, Pipeline, "ContainerAppRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppRevisionContainerAppsRevisionsClientDiagnostics, Pipeline, "ContainerAppRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -170,7 +170,7 @@ public virtual Pageable GetAll(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppRevisionContainerAppsRevisionsRestClient.CreateListRevisionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppRevisionContainerAppsRevisionsRestClient.CreateListRevisionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppRevisionContainerAppsRevisionsClientDiagnostics, Pipeline, "ContainerAppRevisionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppRevisionResource(Client, ContainerAppRevisionData.DeserializeContainerAppRevisionData(e)), _containerAppRevisionContainerAppsRevisionsClientDiagnostics, Pipeline, "ContainerAppRevisionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionData.cs index e178af9231f2..da4e2fef76ce 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppRevisionData : ResourceData { - /// Initializes a new instance of ContainerAppRevisionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppRevisionData() { } - /// Initializes a new instance of ContainerAppRevisionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -46,7 +50,8 @@ public ContainerAppRevisionData() /// Current health State of the revision. /// Current provisioning State of the revision. /// Current running state of the revision. - internal ContainerAppRevisionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, DateTimeOffset? lastActiveOn, string fqdn, ContainerAppTemplate template, bool? isActive, int? replicas, int? trafficWeight, string provisioningError, ContainerAppRevisionHealthState? healthState, ContainerAppRevisionProvisioningState? provisioningState, RevisionRunningState? runningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppRevisionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, DateTimeOffset? lastActiveOn, string fqdn, ContainerAppTemplate template, bool? isActive, int? replicas, int? trafficWeight, string provisioningError, ContainerAppRevisionHealthState? healthState, ContainerAppRevisionProvisioningState? provisioningState, RevisionRunningState? runningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { CreatedOn = createdOn; LastActiveOn = lastActiveOn; @@ -59,6 +64,7 @@ internal ContainerAppRevisionData(ResourceIdentifier id, string name, ResourceTy HealthState = healthState; ProvisioningState = provisioningState; RunningState = runningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs index 079292385cda..206cdfec60ce 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppSourceControlContainerAppsSourceControlsRestClient.CreateListByContainerAppRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppSourceControlContainerAppsSourceControlsRestClient.CreateListByContainerAppNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppSourceControlResource(Client, ContainerAppSourceControlData.DeserializeContainerAppSourceControlData(e)), _containerAppSourceControlContainerAppsSourceControlsClientDiagnostics, Pipeline, "ContainerAppSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppSourceControlResource(Client, ContainerAppSourceControlData.DeserializeContainerAppSourceControlData(e)), _containerAppSourceControlContainerAppsSourceControlsClientDiagnostics, Pipeline, "ContainerAppSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppSourceControlContainerAppsSourceControlsRestClient.CreateListByContainerAppRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppSourceControlContainerAppsSourceControlsRestClient.CreateListByContainerAppNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppSourceControlResource(Client, ContainerAppSourceControlData.DeserializeContainerAppSourceControlData(e)), _containerAppSourceControlContainerAppsSourceControlsClientDiagnostics, Pipeline, "ContainerAppSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppSourceControlResource(Client, ContainerAppSourceControlData.DeserializeContainerAppSourceControlData(e)), _containerAppSourceControlContainerAppsSourceControlsClientDiagnostics, Pipeline, "ContainerAppSourceControlCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlData.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlData.cs index faf3ded0983e..2cada5353eb9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlData.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.AppContainers /// public partial class ContainerAppSourceControlData : ResourceData { - /// Initializes a new instance of ContainerAppSourceControlData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppSourceControlData() { } - /// Initializes a new instance of ContainerAppSourceControlData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,12 +40,14 @@ public ContainerAppSourceControlData() /// defaults if user did not provide them. The defaults are populated /// as they were at the creation time /// - internal ContainerAppSourceControlData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppSourceControlOperationState? operationState, Uri repoUri, string branch, ContainerAppGitHubActionConfiguration gitHubActionConfiguration) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppSourceControlData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppSourceControlOperationState? operationState, Uri repoUri, string branch, ContainerAppGitHubActionConfiguration gitHubActionConfiguration, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OperationState = operationState; RepoUri = repoUri; Branch = branch; GitHubActionConfiguration = gitHubActionConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Current provisioning State of the operation. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index e81ae64ffb41..bb2a373422fa 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -171,7 +171,7 @@ public virtual AsyncPageable GetContai { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); } /// @@ -193,7 +193,7 @@ public virtual Pageable GetContainerAp { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); } /// @@ -215,7 +215,7 @@ public virtual AsyncPageable GetContainerAppsAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerApps", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerApps", "value", "nextLink", cancellationToken); } /// @@ -237,7 +237,7 @@ public virtual Pageable GetContainerApps(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerApps", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerApps", "value", "nextLink", cancellationToken); } /// @@ -259,7 +259,7 @@ public virtual AsyncPageable GetContainerAppJobsAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppJobJobsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppJobJobsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppJobs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppJobs", "value", "nextLink", cancellationToken); } /// @@ -281,7 +281,7 @@ public virtual Pageable GetContainerAppJobs(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppJobJobsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppJobJobsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppJobs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppJobs", "value", "nextLink", cancellationToken); } /// @@ -303,7 +303,7 @@ public virtual AsyncPageable GetContaine { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); } /// @@ -325,7 +325,7 @@ public virtual Pageable GetContainerAppM { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.Serialization.cs index 93bb741de89a..0de9b3e653a5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class AllowedAudiencesValidation : IUtf8JsonSerializable + internal partial class AllowedAudiencesValidation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AllowedAudiences)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AllowedAudiencesValidation DeserializeAllowedAudiencesValidation(JsonElement element) + internal static AllowedAudiencesValidation DeserializeAllowedAudiencesValidation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> allowedAudiences = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowedAudiences"u8)) @@ -52,8 +74,61 @@ internal static AllowedAudiencesValidation DeserializeAllowedAudiencesValidation allowedAudiences = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AllowedAudiencesValidation(Optional.ToList(allowedAudiences), serializedAdditionalRawData); + } + + AllowedAudiencesValidation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAllowedAudiencesValidation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AllowedAudiencesValidation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAllowedAudiencesValidation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AllowedAudiencesValidation model) + { + if (model is null) + { + return null; } - return new AllowedAudiencesValidation(Optional.ToList(allowedAudiences)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AllowedAudiencesValidation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAllowedAudiencesValidation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.cs index 360b1d699650..cd95a08ed287 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AllowedAudiencesValidation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Allowed Audiences validation flow. internal partial class AllowedAudiencesValidation { - /// Initializes a new instance of AllowedAudiencesValidation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AllowedAudiencesValidation() { AllowedAudiences = new ChangeTrackingList(); } - /// Initializes a new instance of AllowedAudiencesValidation. + /// Initializes a new instance of . /// The configuration settings of the allowed list of audiences from which to validate the JWT token. - internal AllowedAudiencesValidation(IList allowedAudiences) + /// Keeps track of any properties unknown to the library. + internal AllowedAudiencesValidation(IList allowedAudiences, Dictionary serializedAdditionalRawData) { AllowedAudiences = allowedAudiences; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The configuration settings of the allowed list of audiences from which to validate the JWT token. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.Serialization.cs index 4a7887cd34e3..5c17acb7f28d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class AppContainerResources : IUtf8JsonSerializable + public partial class AppContainerResources : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cpu)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("memory"u8); writer.WriteStringValue(Memory); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AppContainerResources DeserializeAppContainerResources(JsonElement element) + internal static AppContainerResources DeserializeAppContainerResources(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static AppContainerResources DeserializeAppContainerResources(JsonEleme Optional cpu = default; Optional memory = default; Optional ephemeralStorage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -58,8 +81,61 @@ internal static AppContainerResources DeserializeAppContainerResources(JsonEleme ephemeralStorage = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AppContainerResources(Optional.ToNullable(cpu), memory.Value, ephemeralStorage.Value, serializedAdditionalRawData); + } + + AppContainerResources IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppContainerResources(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppContainerResources IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppContainerResources(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppContainerResources model) + { + if (model is null) + { + return null; } - return new AppContainerResources(Optional.ToNullable(cpu), memory.Value, ephemeralStorage.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppContainerResources(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppContainerResources(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.cs index 612e71b6bc10..2368b60c4d15 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AppContainerResources.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App container resource requirements. public partial class AppContainerResources { - /// Initializes a new instance of AppContainerResources. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AppContainerResources() { } - /// Initializes a new instance of AppContainerResources. + /// Initializes a new instance of . /// Required CPU in cores, e.g. 0.5. /// Required memory, e.g. "250Mb". /// Ephemeral Storage, e.g. "1Gi". - internal AppContainerResources(double? cpu, string memory, string ephemeralStorage) + /// Keeps track of any properties unknown to the library. + internal AppContainerResources(double? cpu, string memory, string ephemeralStorage, Dictionary serializedAdditionalRawData) { Cpu = cpu; Memory = memory; EphemeralStorage = ephemeralStorage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Required CPU in cores, e.g. 0.5. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.Serialization.cs index 5fa3e7b89ddb..b2540701d7bf 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class AuthConfigCollection + internal partial class AuthConfigCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthConfigCollection DeserializeAuthConfigCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthConfigCollection DeserializeAuthConfigCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static AuthConfigCollection DeserializeAuthConfigCollection(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthConfigCollection(value, nextLink.Value); + return new AuthConfigCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + AuthConfigCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthConfigCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthConfigCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthConfigCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthConfigCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthConfigCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthConfigCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.cs index 70ef0f5b90cb..ea47595ea2eb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AuthConfigCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// AuthConfig collection ARM resource. internal partial class AuthConfigCollection { - /// Initializes a new instance of AuthConfigCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal AuthConfigCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal AuthConfigCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of AuthConfigCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal AuthConfigCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AuthConfigCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AuthConfigCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.Serialization.cs index 60641e65512d..f9dffe2cd5ce 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class AvailableWorkloadProfilesCollection + internal partial class AvailableWorkloadProfilesCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableWorkloadProfilesCollection DeserializeAvailableWorkloadProfilesCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableWorkloadProfilesCollection DeserializeAvailableWorkloadProfilesCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static AvailableWorkloadProfilesCollection DeserializeAvailableWorkload nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableWorkloadProfilesCollection(value, nextLink.Value); + return new AvailableWorkloadProfilesCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + AvailableWorkloadProfilesCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableWorkloadProfilesCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableWorkloadProfilesCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableWorkloadProfilesCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableWorkloadProfilesCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableWorkloadProfilesCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableWorkloadProfilesCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.cs index 4464204d9de6..a8852919bb90 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AvailableWorkloadProfilesCollection.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of available workload profiles in the location. internal partial class AvailableWorkloadProfilesCollection { - /// Initializes a new instance of AvailableWorkloadProfilesCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of workload profiles. /// is null. internal AvailableWorkloadProfilesCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal AvailableWorkloadProfilesCollection(IEnumerable Initializes a new instance of AvailableWorkloadProfilesCollection. + /// Initializes a new instance of . /// Collection of workload profiles. /// Link to next page of resources. - internal AvailableWorkloadProfilesCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AvailableWorkloadProfilesCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailableWorkloadProfilesCollection() + { } /// Collection of workload profiles. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.Serialization.cs index 3667bf8d9d1b..f131f2b650cc 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class AzureStaticWebAppsRegistration : IUtf8JsonSerializable + internal partial class AzureStaticWebAppsRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); writer.WriteStringValue(ClientId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AzureStaticWebAppsRegistration DeserializeAzureStaticWebAppsRegistration(JsonElement element) + internal static AzureStaticWebAppsRegistration DeserializeAzureStaticWebAppsRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clientId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -37,8 +60,61 @@ internal static AzureStaticWebAppsRegistration DeserializeAzureStaticWebAppsRegi clientId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureStaticWebAppsRegistration(clientId.Value, serializedAdditionalRawData); + } + + AzureStaticWebAppsRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureStaticWebAppsRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureStaticWebAppsRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureStaticWebAppsRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureStaticWebAppsRegistration model) + { + if (model is null) + { + return null; } - return new AzureStaticWebAppsRegistration(clientId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureStaticWebAppsRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureStaticWebAppsRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.cs index dd146ddf5eac..f33a71c70d37 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/AzureStaticWebAppsRegistration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the registration for the Azure Static Web Apps provider. internal partial class AzureStaticWebAppsRegistration { - /// Initializes a new instance of AzureStaticWebAppsRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AzureStaticWebAppsRegistration() { } - /// Initializes a new instance of AzureStaticWebAppsRegistration. + /// Initializes a new instance of . /// The Client ID of the app used for login. - internal AzureStaticWebAppsRegistration(string clientId) + /// Keeps track of any properties unknown to the library. + internal AzureStaticWebAppsRegistration(string clientId, Dictionary serializedAdditionalRawData) { ClientId = clientId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Client ID of the app used for login. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.Serialization.cs index c51dbbce5395..9787f876a387 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class BillingMeterCollection + internal partial class BillingMeterCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BillingMeterCollection DeserializeBillingMeterCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BillingMeterCollection DeserializeBillingMeterCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +74,61 @@ internal static BillingMeterCollection DeserializeBillingMeterCollection(JsonEle value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BillingMeterCollection(value); + return new BillingMeterCollection(value, serializedAdditionalRawData); + } + + BillingMeterCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBillingMeterCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BillingMeterCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBillingMeterCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BillingMeterCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BillingMeterCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBillingMeterCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.cs index 06af4afd0286..09675968d00a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/BillingMeterCollection.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of billing meters. internal partial class BillingMeterCollection { - /// Initializes a new instance of BillingMeterCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of billing meters. /// is null. internal BillingMeterCollection(IEnumerable value) @@ -25,11 +28,18 @@ internal BillingMeterCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of BillingMeterCollection. + /// Initializes a new instance of . /// Collection of billing meters. - internal BillingMeterCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal BillingMeterCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BillingMeterCollection() + { } /// Collection of billing meters. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.Serialization.cs index 5ad4321fdfb1..4bf5bcee5785 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class CertificateCollection + internal partial class CertificateCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CertificateCollection DeserializeCertificateCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CertificateCollection DeserializeCertificateCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static CertificateCollection DeserializeCertificateCollection(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CertificateCollection(value, nextLink.Value); + return new CertificateCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + CertificateCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCertificateCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CertificateCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCertificateCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CertificateCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CertificateCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCertificateCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.cs index 5366a842ed58..707b7e9ea710 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/CertificateCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of Certificates. internal partial class CertificateCollection { - /// Initializes a new instance of CertificateCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal CertificateCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal CertificateCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of CertificateCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal CertificateCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CertificateCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertificateCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.Serialization.cs index c9f90540b420..d307a37967be 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ConnectedEnvironmentCollection + internal partial class ConnectedEnvironmentCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectedEnvironmentCollection DeserializeConnectedEnvironmentCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectedEnvironmentCollection DeserializeConnectedEnvironmentCollection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ConnectedEnvironmentCollection DeserializeConnectedEnvironmentCo nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectedEnvironmentCollection(Optional.ToList(value), nextLink.Value); + return new ConnectedEnvironmentCollection(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConnectedEnvironmentCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectedEnvironmentCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectedEnvironmentCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectedEnvironmentCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectedEnvironmentCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectedEnvironmentCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectedEnvironmentCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.cs index 16adfaa20b46..4aa41ac9a2bc 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentCollection.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.AppContainers; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of connectedEnvironments. internal partial class ConnectedEnvironmentCollection { - /// Initializes a new instance of ConnectedEnvironmentCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectedEnvironmentCollection() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConnectedEnvironmentCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal ConnectedEnvironmentCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConnectedEnvironmentCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.Serialization.cs index baf1a0958f07..ab94fe06227e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ConnectedEnvironmentStorageProperties : IUtf8JsonSerializable + internal partial class ConnectedEnvironmentStorageProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AzureFile)) { writer.WritePropertyName("azureFile"u8); - writer.WriteObjectValue(AzureFile); + if (AzureFile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureFile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ConnectedEnvironmentStorageProperties DeserializeConnectedEnvironmentStorageProperties(JsonElement element) + internal static ConnectedEnvironmentStorageProperties DeserializeConnectedEnvironmentStorageProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional azureFile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("azureFile"u8)) @@ -41,8 +71,61 @@ internal static ConnectedEnvironmentStorageProperties DeserializeConnectedEnviro azureFile = ContainerAppAzureFileProperties.DeserializeContainerAppAzureFileProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectedEnvironmentStorageProperties(azureFile.Value, serializedAdditionalRawData); + } + + ConnectedEnvironmentStorageProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectedEnvironmentStorageProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectedEnvironmentStorageProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectedEnvironmentStorageProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectedEnvironmentStorageProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectedEnvironmentStorageProperties(Response response) + { + if (response is null) + { + return null; } - return new ConnectedEnvironmentStorageProperties(azureFile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectedEnvironmentStorageProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.cs index 7d39739e9ad8..27d31c639de8 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStorageProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Storage properties. internal partial class ConnectedEnvironmentStorageProperties { - /// Initializes a new instance of ConnectedEnvironmentStorageProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectedEnvironmentStorageProperties() { } - /// Initializes a new instance of ConnectedEnvironmentStorageProperties. + /// Initializes a new instance of . /// Azure file properties. - internal ConnectedEnvironmentStorageProperties(ContainerAppAzureFileProperties azureFile) + /// Keeps track of any properties unknown to the library. + internal ConnectedEnvironmentStorageProperties(ContainerAppAzureFileProperties azureFile, Dictionary serializedAdditionalRawData) { AzureFile = azureFile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Azure file properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.Serialization.cs index 60dbe2eb02b0..6c10038ef491 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ConnectedEnvironmentStoragesCollection + internal partial class ConnectedEnvironmentStoragesCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectedEnvironmentStoragesCollection DeserializeConnectedEnvironmentStoragesCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectedEnvironmentStoragesCollection DeserializeConnectedEnvironmentStoragesCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -33,8 +75,61 @@ internal static ConnectedEnvironmentStoragesCollection DeserializeConnectedEnvir value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectedEnvironmentStoragesCollection(value); + return new ConnectedEnvironmentStoragesCollection(value, serializedAdditionalRawData); + } + + ConnectedEnvironmentStoragesCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectedEnvironmentStoragesCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectedEnvironmentStoragesCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectedEnvironmentStoragesCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectedEnvironmentStoragesCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectedEnvironmentStoragesCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectedEnvironmentStoragesCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.cs index 54bbcebdcff6..f6abcff957a6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ConnectedEnvironmentStoragesCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of Storage for Environments. internal partial class ConnectedEnvironmentStoragesCollection { - /// Initializes a new instance of ConnectedEnvironmentStoragesCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of storage resources. /// is null. internal ConnectedEnvironmentStoragesCollection(IEnumerable value) @@ -26,11 +29,18 @@ internal ConnectedEnvironmentStoragesCollection(IEnumerable Initializes a new instance of ConnectedEnvironmentStoragesCollection. + /// Initializes a new instance of . /// Collection of storage resources. - internal ConnectedEnvironmentStoragesCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ConnectedEnvironmentStoragesCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectedEnvironmentStoragesCollection() + { } /// Collection of storage resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.Serialization.cs index 83b062d974db..671a1ab7e0d4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAllowedPrincipals : IUtf8JsonSerializable + public partial class ContainerAppAllowedPrincipals : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Groups)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAllowedPrincipals DeserializeContainerAppAllowedPrincipals(JsonElement element) + internal static ContainerAppAllowedPrincipals DeserializeContainerAppAllowedPrincipals(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> groups = default; Optional> identities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("groups"u8)) @@ -77,8 +99,61 @@ internal static ContainerAppAllowedPrincipals DeserializeContainerAppAllowedPrin identities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAllowedPrincipals(Optional.ToList(groups), Optional.ToList(identities), serializedAdditionalRawData); + } + + ContainerAppAllowedPrincipals IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAllowedPrincipals(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAllowedPrincipals IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAllowedPrincipals(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAllowedPrincipals model) + { + if (model is null) + { + return null; } - return new ContainerAppAllowedPrincipals(Optional.ToList(groups), Optional.ToList(identities)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAllowedPrincipals(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAllowedPrincipals(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.cs index 3242ebc2bc94..1c830a43177c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAllowedPrincipals.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Azure Active Directory allowed principals. public partial class ContainerAppAllowedPrincipals { - /// Initializes a new instance of ContainerAppAllowedPrincipals. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAllowedPrincipals() { Groups = new ChangeTrackingList(); Identities = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppAllowedPrincipals. + /// Initializes a new instance of . /// The list of the allowed groups. /// The list of the allowed identities. - internal ContainerAppAllowedPrincipals(IList groups, IList identities) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAllowedPrincipals(IList groups, IList identities, Dictionary serializedAdditionalRawData) { Groups = groups; Identities = identities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of the allowed groups. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.Serialization.cs index cee590686037..153060dbfb97 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAppleConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAppleConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } } if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppAppleConfiguration DeserializeContainerAppAppleConfiguration(JsonElement element) + internal static ContainerAppAppleConfiguration DeserializeContainerAppAppleConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static ContainerAppAppleConfiguration DeserializeContainerAppAppleConfi Optional enabled = default; Optional registration = default; Optional login = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -71,8 +108,61 @@ internal static ContainerAppAppleConfiguration DeserializeContainerAppAppleConfi login = Models.LoginScopes.DeserializeLoginScopes(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAppleConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, serializedAdditionalRawData); + } + + ContainerAppAppleConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAppleConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAppleConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAppleConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAppleConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppAppleConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAppleConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAppleConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.cs index 2f3a44c3d2d4..fc1197bfa16d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models @@ -12,20 +13,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Apple provider. public partial class ContainerAppAppleConfiguration { - /// Initializes a new instance of ContainerAppAppleConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAppleConfiguration() { } - /// Initializes a new instance of ContainerAppAppleConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the Apple provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the Apple registration. /// The configuration settings of the login flow. - internal ContainerAppAppleConfiguration(bool? isEnabled, ContainerAppAppleRegistrationConfiguration registration, LoginScopes login) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAppleConfiguration(bool? isEnabled, ContainerAppAppleRegistrationConfiguration registration, LoginScopes login, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; Login = login; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the Apple provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.Serialization.cs index 33b6a13ca157..c2cefd9f5e2f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAppleRegistrationConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAppleRegistrationConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecretSettingName"u8); writer.WriteStringValue(ClientSecretSettingName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAppleRegistrationConfiguration DeserializeContainerAppAppleRegistrationConfiguration(JsonElement element) + internal static ContainerAppAppleRegistrationConfiguration DeserializeContainerAppAppleRegistrationConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clientId = default; Optional clientSecretSettingName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppAppleRegistrationConfiguration DeserializeContainerA clientSecretSettingName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAppleRegistrationConfiguration(clientId.Value, clientSecretSettingName.Value, serializedAdditionalRawData); + } + + ContainerAppAppleRegistrationConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAppleRegistrationConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAppleRegistrationConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAppleRegistrationConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAppleRegistrationConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppAppleRegistrationConfiguration(clientId.Value, clientSecretSettingName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAppleRegistrationConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAppleRegistrationConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.cs index 586fe03c9bee..388c9a43c512 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAppleRegistrationConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the registration for the Apple provider. public partial class ContainerAppAppleRegistrationConfiguration { - /// Initializes a new instance of ContainerAppAppleRegistrationConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAppleRegistrationConfiguration() { } - /// Initializes a new instance of ContainerAppAppleRegistrationConfiguration. + /// Initializes a new instance of . /// The Client ID of the app used for login. /// The app setting name that contains the client secret. - internal ContainerAppAppleRegistrationConfiguration(string clientId, string clientSecretSettingName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAppleRegistrationConfiguration(string clientId, string clientSecretSettingName, Dictionary serializedAdditionalRawData) { ClientId = clientId; ClientSecretSettingName = clientSecretSettingName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Client ID of the app used for login. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthConfigData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthConfigData.Serialization.cs index 6aff058f6caf..b4acd832dcac 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthConfigData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthConfigData.Serialization.cs @@ -5,51 +5,108 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppAuthConfigData : IUtf8JsonSerializable + public partial class ContainerAppAuthConfigData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Platform)) { writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } } if (Optional.IsDefined(GlobalValidation)) { writer.WritePropertyName("globalValidation"u8); - writer.WriteObjectValue(GlobalValidation); + if (GlobalValidation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GlobalValidation).Serialize(writer, options); + } } if (Optional.IsDefined(IdentityProviders)) { writer.WritePropertyName("identityProviders"u8); - writer.WriteObjectValue(IdentityProviders); + if (IdentityProviders is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IdentityProviders).Serialize(writer, options); + } } if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } } if (Optional.IsDefined(HttpSettings)) { writer.WritePropertyName("httpSettings"u8); - writer.WriteObjectValue(HttpSettings); + if (HttpSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HttpSettings).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAuthConfigData DeserializeContainerAppAuthConfigData(JsonElement element) + internal static ContainerAppAuthConfigData DeserializeContainerAppAuthConfigData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +120,7 @@ internal static ContainerAppAuthConfigData DeserializeContainerAppAuthConfigData Optional identityProviders = default; Optional login = default; Optional httpSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -146,8 +204,61 @@ internal static ContainerAppAuthConfigData DeserializeContainerAppAuthConfigData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAuthConfigData(id, name, type, systemData.Value, platform.Value, globalValidation.Value, identityProviders.Value, login.Value, httpSettings.Value, serializedAdditionalRawData); + } + + ContainerAppAuthConfigData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAuthConfigData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAuthConfigData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAuthConfigData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAuthConfigData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAuthConfigData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppAuthConfigData(id, name, type, systemData.Value, platform.Value, globalValidation.Value, identityProviders.Value, login.Value, httpSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAuthConfigData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.Serialization.cs index 9b590d81f050..bb2b06945b35 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAuthPlatform : IUtf8JsonSerializable + public partial class ContainerAppAuthPlatform : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("runtimeVersion"u8); writer.WriteStringValue(RuntimeVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAuthPlatform DeserializeContainerAppAuthPlatform(JsonElement element) + internal static ContainerAppAuthPlatform DeserializeContainerAppAuthPlatform(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional runtimeVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppAuthPlatform DeserializeContainerAppAuthPlatform(Jso runtimeVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAuthPlatform(Optional.ToNullable(enabled), runtimeVersion.Value, serializedAdditionalRawData); + } + + ContainerAppAuthPlatform IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAuthPlatform(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAuthPlatform IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAuthPlatform(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAuthPlatform model) + { + if (model is null) + { + return null; } - return new ContainerAppAuthPlatform(Optional.ToNullable(enabled), runtimeVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAuthPlatform(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAuthPlatform(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.cs index 4e5cf5700e56..d38554bd4bf7 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthPlatform.cs @@ -5,26 +5,34 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the platform of ContainerApp Service Authentication/Authorization. public partial class ContainerAppAuthPlatform { - /// Initializes a new instance of ContainerAppAuthPlatform. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAuthPlatform() { } - /// Initializes a new instance of ContainerAppAuthPlatform. + /// Initializes a new instance of . /// <code>true</code> if the Authentication / Authorization feature is enabled for the current app; otherwise, <code>false</code>. /// /// The RuntimeVersion of the Authentication / Authorization feature in use for the current app. /// The setting in this value can control the behavior of certain features in the Authentication / Authorization module. /// - internal ContainerAppAuthPlatform(bool? isEnabled, string runtimeVersion) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAuthPlatform(bool? isEnabled, string runtimeVersion, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; RuntimeVersion = runtimeVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>true</code> if the Authentication / Authorization feature is enabled for the current app; otherwise, <code>false</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.Serialization.cs index de6a313cfe43..3016c8423d38 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAuthToken : IUtf8JsonSerializable + public partial class ContainerAppAuthToken : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAuthToken DeserializeContainerAppAuthToken(JsonElement element) + internal static ContainerAppAuthToken DeserializeContainerAppAuthToken(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +71,7 @@ internal static ContainerAppAuthToken DeserializeContainerAppAuthToken(JsonEleme Optional systemData = default; Optional token = default; Optional expires = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -122,8 +143,61 @@ internal static ContainerAppAuthToken DeserializeContainerAppAuthToken(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAuthToken(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, token.Value, Optional.ToNullable(expires), serializedAdditionalRawData); + } + + ContainerAppAuthToken IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAuthToken(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAuthToken IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAuthToken(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAuthToken model) + { + if (model is null) + { + return null; } - return new ContainerAppAuthToken(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, token.Value, Optional.ToNullable(expires)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAuthToken(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAuthToken(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.cs index fef53f16a479..76292f429d53 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAuthToken.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App Auth Token. public partial class ContainerAppAuthToken : TrackedResourceData { - /// Initializes a new instance of ContainerAppAuthToken. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppAuthToken(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerAppAuthToken. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,10 +33,17 @@ public ContainerAppAuthToken(AzureLocation location) : base(location) /// The location. /// Auth token value. /// Token expiration date. - internal ContainerAppAuthToken(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string token, DateTimeOffset? expireOn) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAuthToken(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string token, DateTimeOffset? expireOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Token = token; ExpireOn = expireOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppAuthToken() + { } /// Auth token value. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.Serialization.cs index f2b0f0b819a2..33afbf450588 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAvailableWorkloadProfile : IUtf8JsonSerializable + public partial class ContainerAppAvailableWorkloadProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -24,13 +32,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppAvailableWorkloadProfile DeserializeContainerAppAvailableWorkloadProfile(JsonElement element) + internal static ContainerAppAvailableWorkloadProfile DeserializeContainerAppAvailableWorkloadProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +70,7 @@ internal static ContainerAppAvailableWorkloadProfile DeserializeContainerAppAvai string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -85,8 +115,61 @@ internal static ContainerAppAvailableWorkloadProfile DeserializeContainerAppAvai systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAvailableWorkloadProfile(id, name, type, systemData.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + ContainerAppAvailableWorkloadProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAvailableWorkloadProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAvailableWorkloadProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAvailableWorkloadProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAvailableWorkloadProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAvailableWorkloadProfile(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppAvailableWorkloadProfile(id, name, type, systemData.Value, Optional.ToNullable(location), properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAvailableWorkloadProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.cs index b9c41af213c8..c6609370cc14 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfile.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,22 +15,27 @@ namespace Azure.ResourceManager.AppContainers.Models /// A workload profile with specific hardware configure to run container apps. public partial class ContainerAppAvailableWorkloadProfile : ResourceData { - /// Initializes a new instance of ContainerAppAvailableWorkloadProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAvailableWorkloadProfile() { } - /// Initializes a new instance of ContainerAppAvailableWorkloadProfile. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Region of the workload profile. /// Revision resource specific properties. - internal ContainerAppAvailableWorkloadProfile(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ContainerAppAvailableWorkloadProfileProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAvailableWorkloadProfile(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ContainerAppAvailableWorkloadProfileProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Region of the workload profile. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.Serialization.cs index b641d2ff2e23..bebe1421cc9a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAvailableWorkloadProfileProperties : IUtf8JsonSerializable + public partial class ContainerAppAvailableWorkloadProfileProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Category)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAvailableWorkloadProfileProperties DeserializeContainerAppAvailableWorkloadProfileProperties(JsonElement element) + internal static ContainerAppAvailableWorkloadProfileProperties DeserializeContainerAppAvailableWorkloadProfileProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static ContainerAppAvailableWorkloadProfileProperties DeserializeContai Optional cores = default; Optional memoryGiB = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -93,8 +116,61 @@ internal static ContainerAppAvailableWorkloadProfileProperties DeserializeContai displayName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAvailableWorkloadProfileProperties(category.Value, Optional.ToNullable(applicability), Optional.ToNullable(cores), Optional.ToNullable(memoryGiB), displayName.Value, serializedAdditionalRawData); + } + + ContainerAppAvailableWorkloadProfileProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAvailableWorkloadProfileProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAvailableWorkloadProfileProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAvailableWorkloadProfileProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAvailableWorkloadProfileProperties model) + { + if (model is null) + { + return null; } - return new ContainerAppAvailableWorkloadProfileProperties(category.Value, Optional.ToNullable(applicability), Optional.ToNullable(cores), Optional.ToNullable(memoryGiB), displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAvailableWorkloadProfileProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAvailableWorkloadProfileProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.cs index b3a58ebf7399..33aa6eaad88c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAvailableWorkloadProfileProperties.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Revision resource specific properties. public partial class ContainerAppAvailableWorkloadProfileProperties { - /// Initializes a new instance of ContainerAppAvailableWorkloadProfileProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAvailableWorkloadProfileProperties() { } - /// Initializes a new instance of ContainerAppAvailableWorkloadProfileProperties. + /// Initializes a new instance of . /// Used to categorize workload profiles. /// indicates whether the profile is default for the location. /// Number of cores in CPU. /// Memory in GiB. /// The everyday name of the workload profile. - internal ContainerAppAvailableWorkloadProfileProperties(string category, ContainerAppAvailableWorkloadProfileApplicability? applicability, int? cores, int? memoryInGiB, string displayName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAvailableWorkloadProfileProperties(string category, ContainerAppAvailableWorkloadProfileApplicability? applicability, int? cores, int? memoryInGiB, string displayName, Dictionary serializedAdditionalRawData) { Category = category; Applicability = applicability; Cores = cores; MemoryInGiB = memoryInGiB; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Used to categorize workload profiles. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.Serialization.cs index f8be8e929c13..4e3ed83ba07b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAzureActiveDirectoryConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAzureActiveDirectoryConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,28 +31,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } } if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } } if (Optional.IsDefined(Validation)) { writer.WritePropertyName("validation"u8); - writer.WriteObjectValue(Validation); + if (Validation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Validation).Serialize(writer, options); + } } if (Optional.IsDefined(IsAutoProvisioned)) { writer.WritePropertyName("isAutoProvisioned"u8); writer.WriteBooleanValue(IsAutoProvisioned.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAzureActiveDirectoryConfiguration DeserializeContainerAppAzureActiveDirectoryConfiguration(JsonElement element) + internal static ContainerAppAzureActiveDirectoryConfiguration DeserializeContainerAppAzureActiveDirectoryConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +97,7 @@ internal static ContainerAppAzureActiveDirectoryConfiguration DeserializeContain Optional login = default; Optional validation = default; Optional isAutoProvisioned = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -101,8 +145,61 @@ internal static ContainerAppAzureActiveDirectoryConfiguration DeserializeContain isAutoProvisioned = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAzureActiveDirectoryConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, validation.Value, Optional.ToNullable(isAutoProvisioned), serializedAdditionalRawData); + } + + ContainerAppAzureActiveDirectoryConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAzureActiveDirectoryConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAzureActiveDirectoryConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAzureActiveDirectoryConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAzureActiveDirectoryConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAzureActiveDirectoryConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppAzureActiveDirectoryConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, validation.Value, Optional.ToNullable(isAutoProvisioned)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAzureActiveDirectoryConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.cs index 857f372a2b06..bc87286d0d27 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryConfiguration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the Azure Active directory provider. public partial class ContainerAppAzureActiveDirectoryConfiguration { - /// Initializes a new instance of ContainerAppAzureActiveDirectoryConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAzureActiveDirectoryConfiguration() { } - /// Initializes a new instance of ContainerAppAzureActiveDirectoryConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the Azure Active Directory provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the Azure Active Directory app registration. /// The configuration settings of the Azure Active Directory login flow. @@ -25,13 +31,15 @@ public ContainerAppAzureActiveDirectoryConfiguration() /// This is an internal flag primarily intended to support the Azure Management Portal. Users should not /// read or write to this property. /// - internal ContainerAppAzureActiveDirectoryConfiguration(bool? isEnabled, ContainerAppAzureActiveDirectoryRegistrationConfiguration registration, ContainerAppAzureActiveDirectoryLoginConfiguration login, ContainerAppAzureActiveDirectoryValidationConfiguration validation, bool? isAutoProvisioned) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAzureActiveDirectoryConfiguration(bool? isEnabled, ContainerAppAzureActiveDirectoryRegistrationConfiguration registration, ContainerAppAzureActiveDirectoryLoginConfiguration login, ContainerAppAzureActiveDirectoryValidationConfiguration validation, bool? isAutoProvisioned, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; Login = login; Validation = validation; IsAutoProvisioned = isAutoProvisioned; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the Azure Active Directory provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.Serialization.cs index 2bbf01232017..b0cd22b8f071 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAzureActiveDirectoryLoginConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAzureActiveDirectoryLoginConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(LoginParameters)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("disableWWWAuthenticate"u8); writer.WriteBooleanValue(IsWwwAuthenticationDisabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAzureActiveDirectoryLoginConfiguration DeserializeContainerAppAzureActiveDirectoryLoginConfiguration(JsonElement element) + internal static ContainerAppAzureActiveDirectoryLoginConfiguration DeserializeContainerAppAzureActiveDirectoryLoginConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> loginParameters = default; Optional disableWWWAuthenticate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("loginParameters"u8)) @@ -67,8 +89,61 @@ internal static ContainerAppAzureActiveDirectoryLoginConfiguration DeserializeCo disableWWWAuthenticate = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAzureActiveDirectoryLoginConfiguration(Optional.ToList(loginParameters), Optional.ToNullable(disableWWWAuthenticate), serializedAdditionalRawData); + } + + ContainerAppAzureActiveDirectoryLoginConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAzureActiveDirectoryLoginConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAzureActiveDirectoryLoginConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAzureActiveDirectoryLoginConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAzureActiveDirectoryLoginConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppAzureActiveDirectoryLoginConfiguration(Optional.ToList(loginParameters), Optional.ToNullable(disableWWWAuthenticate)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAzureActiveDirectoryLoginConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAzureActiveDirectoryLoginConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.cs index 46f0e5a5aacd..09b0f45b4661 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryLoginConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Azure Active Directory login flow. public partial class ContainerAppAzureActiveDirectoryLoginConfiguration { - /// Initializes a new instance of ContainerAppAzureActiveDirectoryLoginConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAzureActiveDirectoryLoginConfiguration() { LoginParameters = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppAzureActiveDirectoryLoginConfiguration. + /// Initializes a new instance of . /// /// Login parameters to send to the OpenID Connect authorization endpoint when /// a user logs in. Each parameter must be in the form "key=value". /// /// <code>true</code> if the www-authenticate provider should be omitted from the request; otherwise, <code>false</code>. - internal ContainerAppAzureActiveDirectoryLoginConfiguration(IList loginParameters, bool? isWwwAuthenticationDisabled) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAzureActiveDirectoryLoginConfiguration(IList loginParameters, bool? isWwwAuthenticationDisabled, Dictionary serializedAdditionalRawData) { LoginParameters = loginParameters; IsWwwAuthenticationDisabled = isWwwAuthenticationDisabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.Serialization.cs index 7f40cfe0ab70..f8c39b440a02 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAzureActiveDirectoryRegistrationConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAzureActiveDirectoryRegistrationConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OpenIdIssuer)) { @@ -45,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecretCertificateIssuer"u8); writer.WriteStringValue(ClientSecretCertificateIssuer); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAzureActiveDirectoryRegistrationConfiguration DeserializeContainerAppAzureActiveDirectoryRegistrationConfiguration(JsonElement element) + internal static ContainerAppAzureActiveDirectoryRegistrationConfiguration DeserializeContainerAppAzureActiveDirectoryRegistrationConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +82,7 @@ internal static ContainerAppAzureActiveDirectoryRegistrationConfiguration Deseri Optional clientSecretCertificateThumbprint = default; Optional clientSecretCertificateSubjectAlternativeName = default; Optional clientSecretCertificateIssuer = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("openIdIssuer"u8)) @@ -92,8 +115,61 @@ internal static ContainerAppAzureActiveDirectoryRegistrationConfiguration Deseri clientSecretCertificateIssuer = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAzureActiveDirectoryRegistrationConfiguration(openIdIssuer.Value, clientId.Value, clientSecretSettingName.Value, clientSecretCertificateThumbprint.Value, clientSecretCertificateSubjectAlternativeName.Value, clientSecretCertificateIssuer.Value, serializedAdditionalRawData); + } + + ContainerAppAzureActiveDirectoryRegistrationConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAzureActiveDirectoryRegistrationConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAzureActiveDirectoryRegistrationConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAzureActiveDirectoryRegistrationConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAzureActiveDirectoryRegistrationConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppAzureActiveDirectoryRegistrationConfiguration(openIdIssuer.Value, clientId.Value, clientSecretSettingName.Value, clientSecretCertificateThumbprint.Value, clientSecretCertificateSubjectAlternativeName.Value, clientSecretCertificateIssuer.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAzureActiveDirectoryRegistrationConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAzureActiveDirectoryRegistrationConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.cs index 5ff1b8e6d97c..d8e45a546530 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryRegistrationConfiguration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the Azure Active Directory app registration. public partial class ContainerAppAzureActiveDirectoryRegistrationConfiguration { - /// Initializes a new instance of ContainerAppAzureActiveDirectoryRegistrationConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAzureActiveDirectoryRegistrationConfiguration() { } - /// Initializes a new instance of ContainerAppAzureActiveDirectoryRegistrationConfiguration. + /// Initializes a new instance of . /// /// The OpenID Connect Issuer URI that represents the entity which issues access tokens for this application. /// When using Azure Active Directory, this value is the URI of the directory tenant, e.g. https://login.microsoftonline.com/v2.0/{tenant-guid}/. @@ -41,7 +47,8 @@ public ContainerAppAzureActiveDirectoryRegistrationConfiguration() /// An alternative to the client secret thumbprint, that is the issuer of a certificate used for signing purposes. This property acts as /// a replacement for the Client Secret Certificate Thumbprint. It is also optional. /// - internal ContainerAppAzureActiveDirectoryRegistrationConfiguration(string openIdIssuer, string clientId, string clientSecretSettingName, string clientSecretCertificateThumbprint, string clientSecretCertificateSubjectAlternativeName, string clientSecretCertificateIssuer) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAzureActiveDirectoryRegistrationConfiguration(string openIdIssuer, string clientId, string clientSecretSettingName, string clientSecretCertificateThumbprint, string clientSecretCertificateSubjectAlternativeName, string clientSecretCertificateIssuer, Dictionary serializedAdditionalRawData) { OpenIdIssuer = openIdIssuer; ClientId = clientId; @@ -49,6 +56,7 @@ internal ContainerAppAzureActiveDirectoryRegistrationConfiguration(string openId ClientSecretCertificateThumbprint = clientSecretCertificateThumbprint; ClientSecretCertificateSubjectAlternativeName = clientSecretCertificateSubjectAlternativeName; ClientSecretCertificateIssuer = clientSecretCertificateIssuer; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.Serialization.cs index 06235429418a..2d036c1a1b30 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAzureActiveDirectoryValidationConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAzureActiveDirectoryValidationConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(JwtClaimChecks)) { writer.WritePropertyName("jwtClaimChecks"u8); - writer.WriteObjectValue(JwtClaimChecks); + if (JwtClaimChecks is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)JwtClaimChecks).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AllowedAudiences)) { @@ -34,13 +48,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DefaultAuthorizationPolicy)) { writer.WritePropertyName("defaultAuthorizationPolicy"u8); - writer.WriteObjectValue(DefaultAuthorizationPolicy); + if (DefaultAuthorizationPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DefaultAuthorizationPolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppAzureActiveDirectoryValidationConfiguration DeserializeContainerAppAzureActiveDirectoryValidationConfiguration(JsonElement element) + internal static ContainerAppAzureActiveDirectoryValidationConfiguration DeserializeContainerAppAzureActiveDirectoryValidationConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +83,7 @@ internal static ContainerAppAzureActiveDirectoryValidationConfiguration Deserial Optional jwtClaimChecks = default; Optional> allowedAudiences = default; Optional defaultAuthorizationPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jwtClaimChecks"u8)) @@ -82,8 +118,61 @@ internal static ContainerAppAzureActiveDirectoryValidationConfiguration Deserial defaultAuthorizationPolicy = ContainerAppDefaultAuthorizationPolicy.DeserializeContainerAppDefaultAuthorizationPolicy(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAzureActiveDirectoryValidationConfiguration(jwtClaimChecks.Value, Optional.ToList(allowedAudiences), defaultAuthorizationPolicy.Value, serializedAdditionalRawData); + } + + ContainerAppAzureActiveDirectoryValidationConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAzureActiveDirectoryValidationConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAzureActiveDirectoryValidationConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAzureActiveDirectoryValidationConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAzureActiveDirectoryValidationConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppAzureActiveDirectoryValidationConfiguration(jwtClaimChecks.Value, Optional.ToList(allowedAudiences), defaultAuthorizationPolicy.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAzureActiveDirectoryValidationConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAzureActiveDirectoryValidationConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.cs index 2b3c9db6490f..bed2fb00dff5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureActiveDirectoryValidationConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Azure Active Directory token validation flow. public partial class ContainerAppAzureActiveDirectoryValidationConfiguration { - /// Initializes a new instance of ContainerAppAzureActiveDirectoryValidationConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAzureActiveDirectoryValidationConfiguration() { AllowedAudiences = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppAzureActiveDirectoryValidationConfiguration. + /// Initializes a new instance of . /// The configuration settings of the checks that should be made while validating the JWT Claims. /// The list of audiences that can make successful authentication/authorization requests. /// The configuration settings of the default authorization policy. - internal ContainerAppAzureActiveDirectoryValidationConfiguration(ContainerAppJwtClaimChecks jwtClaimChecks, IList allowedAudiences, ContainerAppDefaultAuthorizationPolicy defaultAuthorizationPolicy) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAzureActiveDirectoryValidationConfiguration(ContainerAppJwtClaimChecks jwtClaimChecks, IList allowedAudiences, ContainerAppDefaultAuthorizationPolicy defaultAuthorizationPolicy, Dictionary serializedAdditionalRawData) { JwtClaimChecks = jwtClaimChecks; AllowedAudiences = allowedAudiences; DefaultAuthorizationPolicy = defaultAuthorizationPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The configuration settings of the checks that should be made while validating the JWT Claims. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.Serialization.cs index 39260a1134a0..90e8dbe31741 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAzureFileProperties : IUtf8JsonSerializable + public partial class ContainerAppAzureFileProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AccountName)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("shareName"u8); writer.WriteStringValue(ShareName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppAzureFileProperties DeserializeContainerAppAzureFileProperties(JsonElement element) + internal static ContainerAppAzureFileProperties DeserializeContainerAppAzureFileProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerAppAzureFileProperties DeserializeContainerAppAzureFile Optional accountKey = default; Optional accessMode = default; Optional shareName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -74,8 +97,61 @@ internal static ContainerAppAzureFileProperties DeserializeContainerAppAzureFile shareName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAzureFileProperties(accountName.Value, accountKey.Value, Optional.ToNullable(accessMode), shareName.Value, serializedAdditionalRawData); + } + + ContainerAppAzureFileProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAzureFileProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAzureFileProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAzureFileProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAzureFileProperties model) + { + if (model is null) + { + return null; } - return new ContainerAppAzureFileProperties(accountName.Value, accountKey.Value, Optional.ToNullable(accessMode), shareName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAzureFileProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAzureFileProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.cs index a5b362267c17..fb272aeddd1b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureFileProperties.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Azure File Properties. public partial class ContainerAppAzureFileProperties { - /// Initializes a new instance of ContainerAppAzureFileProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAzureFileProperties() { } - /// Initializes a new instance of ContainerAppAzureFileProperties. + /// Initializes a new instance of . /// Storage account name for azure file. /// Storage account key for azure file. /// Access mode for storage. /// Azure file share name. - internal ContainerAppAzureFileProperties(string accountName, string accountKey, ContainerAppAccessMode? accessMode, string shareName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAzureFileProperties(string accountName, string accountKey, ContainerAppAccessMode? accessMode, string shareName, Dictionary serializedAdditionalRawData) { AccountName = accountName; AccountKey = accountKey; AccessMode = accessMode; ShareName = shareName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Storage account name for azure file. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.Serialization.cs index 1303bd0954d2..01d6967d0f0c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppAzureStaticWebAppsConfiguration : IUtf8JsonSerializable + public partial class ContainerAppAzureStaticWebAppsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppAzureStaticWebAppsConfiguration DeserializeContainerAppAzureStaticWebAppsConfiguration(JsonElement element) + internal static ContainerAppAzureStaticWebAppsConfiguration DeserializeContainerAppAzureStaticWebAppsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional registration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -56,8 +86,61 @@ internal static ContainerAppAzureStaticWebAppsConfiguration DeserializeContainer registration = AzureStaticWebAppsRegistration.DeserializeAzureStaticWebAppsRegistration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppAzureStaticWebAppsConfiguration(Optional.ToNullable(enabled), registration.Value, serializedAdditionalRawData); + } + + ContainerAppAzureStaticWebAppsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppAzureStaticWebAppsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppAzureStaticWebAppsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppAzureStaticWebAppsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppAzureStaticWebAppsConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppAzureStaticWebAppsConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppAzureStaticWebAppsConfiguration(Optional.ToNullable(enabled), registration.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppAzureStaticWebAppsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.cs index 1d01df0efd32..98b01d1461ca 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppAzureStaticWebAppsConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the Azure Static Web Apps provider. public partial class ContainerAppAzureStaticWebAppsConfiguration { - /// Initializes a new instance of ContainerAppAzureStaticWebAppsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppAzureStaticWebAppsConfiguration() { } - /// Initializes a new instance of ContainerAppAzureStaticWebAppsConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the Azure Static Web Apps provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the Azure Static Web Apps registration. - internal ContainerAppAzureStaticWebAppsConfiguration(bool? isEnabled, AzureStaticWebAppsRegistration registration) + /// Keeps track of any properties unknown to the library. + internal ContainerAppAzureStaticWebAppsConfiguration(bool? isEnabled, AzureStaticWebAppsRegistration registration, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the Azure Static Web Apps provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.Serialization.cs index c210ed5be266..46e7d63fd93a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppBaseContainer : IUtf8JsonSerializable + public partial class ContainerAppBaseContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Image)) { @@ -52,14 +59,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Env) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Resources)) { writer.WritePropertyName("resources"u8); - writer.WriteObjectValue(Resources); + if (Resources is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resources).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(VolumeMounts)) { @@ -67,15 +88,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VolumeMounts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppBaseContainer DeserializeContainerAppBaseContainer(JsonElement element) + internal static ContainerAppBaseContainer DeserializeContainerAppBaseContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +129,7 @@ internal static ContainerAppBaseContainer DeserializeContainerAppBaseContainer(J Optional> env = default; Optional resources = default; Optional> volumeMounts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("image"u8)) @@ -164,8 +207,61 @@ internal static ContainerAppBaseContainer DeserializeContainerAppBaseContainer(J volumeMounts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppBaseContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, Optional.ToList(volumeMounts), serializedAdditionalRawData); + } + + ContainerAppBaseContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppBaseContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppBaseContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppBaseContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppBaseContainer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppBaseContainer(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppBaseContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, Optional.ToList(volumeMounts)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppBaseContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.cs index 7adea88f6011..2c744dd07c0d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBaseContainer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App base container definition. public partial class ContainerAppBaseContainer { - /// Initializes a new instance of ContainerAppBaseContainer. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppBaseContainer() { Command = new ChangeTrackingList(); @@ -22,7 +26,7 @@ public ContainerAppBaseContainer() VolumeMounts = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppBaseContainer. + /// Initializes a new instance of . /// Container image tag. /// Custom container name. /// Container start command. @@ -30,7 +34,8 @@ public ContainerAppBaseContainer() /// Container environment variables. /// Container resource requirements. /// Container volume mounts. - internal ContainerAppBaseContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, IList volumeMounts) + /// Keeps track of any properties unknown to the library. + internal ContainerAppBaseContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, IList volumeMounts, Dictionary serializedAdditionalRawData) { Image = image; Name = name; @@ -39,6 +44,7 @@ internal ContainerAppBaseContainer(string image, string name, IList comm Env = env; Resources = resources; VolumeMounts = volumeMounts; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container image tag. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.Serialization.cs index d55e2189b192..573bec1818ff 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppBillingMeter : IUtf8JsonSerializable + public partial class ContainerAppBillingMeter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -24,13 +32,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppBillingMeter DeserializeContainerAppBillingMeter(JsonElement element) + internal static ContainerAppBillingMeter DeserializeContainerAppBillingMeter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +70,7 @@ internal static ContainerAppBillingMeter DeserializeContainerAppBillingMeter(Jso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -85,8 +115,61 @@ internal static ContainerAppBillingMeter DeserializeContainerAppBillingMeter(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppBillingMeter(id, name, type, systemData.Value, Optional.ToNullable(location), properties.Value, serializedAdditionalRawData); + } + + ContainerAppBillingMeter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppBillingMeter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppBillingMeter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppBillingMeter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppBillingMeter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppBillingMeter(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppBillingMeter(id, name, type, systemData.Value, Optional.ToNullable(location), properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppBillingMeter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.cs index a903e72a6fd6..9e2555f5d49d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeter.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,22 +15,27 @@ namespace Azure.ResourceManager.AppContainers.Models /// Billing meter. public partial class ContainerAppBillingMeter : ResourceData { - /// Initializes a new instance of ContainerAppBillingMeter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppBillingMeter() { } - /// Initializes a new instance of ContainerAppBillingMeter. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Region for the billing meter. /// Revision resource specific properties. - internal ContainerAppBillingMeter(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ContainerAppBillingMeterProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppBillingMeter(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ContainerAppBillingMeterProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Region for the billing meter. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.Serialization.cs index 19567e9bfa68..08589b6f4246 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppBillingMeterProperties : IUtf8JsonSerializable + public partial class ContainerAppBillingMeterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WorkloadProfileCategory)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppBillingMeterProperties DeserializeContainerAppBillingMeterProperties(JsonElement element) + internal static ContainerAppBillingMeterProperties DeserializeContainerAppBillingMeterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppBillingMeterProperties DeserializeContainerAppBillin Optional category = default; Optional meterType = default; Optional displayName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -59,8 +82,61 @@ internal static ContainerAppBillingMeterProperties DeserializeContainerAppBillin displayName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppBillingMeterProperties(category.Value, meterType.Value, displayName.Value, serializedAdditionalRawData); + } + + ContainerAppBillingMeterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppBillingMeterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppBillingMeterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppBillingMeterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppBillingMeterProperties model) + { + if (model is null) + { + return null; } - return new ContainerAppBillingMeterProperties(category.Value, meterType.Value, displayName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppBillingMeterProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppBillingMeterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.cs index d52369d4fabd..8ee1e751baeb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppBillingMeterProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Revision resource specific properties. public partial class ContainerAppBillingMeterProperties { - /// Initializes a new instance of ContainerAppBillingMeterProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppBillingMeterProperties() { } - /// Initializes a new instance of ContainerAppBillingMeterProperties. + /// Initializes a new instance of . /// Used to categorize billing meters. /// Billing meter type. /// The everyday name of the billing meter. - internal ContainerAppBillingMeterProperties(string workloadProfileCategory, string meterType, string displayName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppBillingMeterProperties(string workloadProfileCategory, string meterType, string displayName, Dictionary serializedAdditionalRawData) { WorkloadProfileCategory = workloadProfileCategory; MeterType = meterType; DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Used to categorize billing meters. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateData.Serialization.cs index 722a7fe782f0..c677fb35ce96 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppCertificateData : IUtf8JsonSerializable + public partial class ContainerAppCertificateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCertificateData DeserializeContainerAppCertificateData(JsonElement element) + internal static ContainerAppCertificateData DeserializeContainerAppCertificateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static ContainerAppCertificateData DeserializeContainerAppCertificateDa string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -106,8 +135,61 @@ internal static ContainerAppCertificateData DeserializeContainerAppCertificateDa systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCertificateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, serializedAdditionalRawData); + } + + ContainerAppCertificateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCertificateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCertificateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCertificateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCertificateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCertificateData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppCertificateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCertificateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.Serialization.cs index d322d494f4aa..b61407b3e118 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCertificatePatch : IUtf8JsonSerializable + public partial class ContainerAppCertificatePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerAppCertificatePatch DeserializeContainerAppCertificatePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCertificatePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ContainerAppCertificatePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCertificatePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCertificatePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCertificatePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCertificatePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCertificatePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCertificatePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.cs index c9550d89149b..a0349657224b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificatePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.AppContainers.Models /// A certificate to update. public partial class ContainerAppCertificatePatch { - /// Initializes a new instance of ContainerAppCertificatePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCertificatePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Application-specific metadata in the form of key-value pairs. + /// Keeps track of any properties unknown to the library. + internal ContainerAppCertificatePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Application-specific metadata in the form of key-value pairs. public IDictionary Tags { get; } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.Serialization.cs index fba302f0aeea..1a8e2f7f1ee6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCertificateProperties : IUtf8JsonSerializable + public partial class ContainerAppCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Password)) { @@ -27,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteBase64StringValue(Value, "D"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCertificateProperties DeserializeContainerAppCertificateProperties(JsonElement element) + internal static ContainerAppCertificateProperties DeserializeContainerAppCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +67,7 @@ internal static ContainerAppCertificateProperties DeserializeContainerAppCertifi Optional thumbprint = default; Optional valid = default; Optional publicKeyHash = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -133,8 +154,61 @@ internal static ContainerAppCertificateProperties DeserializeContainerAppCertifi publicKeyHash = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCertificateProperties(Optional.ToNullable(provisioningState), password.Value, subjectName.Value, Optional.ToList(subjectAlternativeNames), value.Value, issuer.Value, Optional.ToNullable(issueDate), Optional.ToNullable(expirationDate), thumbprint.Value, Optional.ToNullable(valid), publicKeyHash.Value, serializedAdditionalRawData); + } + + ContainerAppCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCertificateProperties model) + { + if (model is null) + { + return null; } - return new ContainerAppCertificateProperties(Optional.ToNullable(provisioningState), password.Value, subjectName.Value, Optional.ToList(subjectAlternativeNames), value.Value, issuer.Value, Optional.ToNullable(issueDate), Optional.ToNullable(expirationDate), thumbprint.Value, Optional.ToNullable(valid), publicKeyHash.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.cs index a7d26a2d2649..c3a0c2a19469 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCertificateProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// Certificate resource specific properties. public partial class ContainerAppCertificateProperties { - /// Initializes a new instance of ContainerAppCertificateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCertificateProperties() { SubjectAlternativeNames = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppCertificateProperties. + /// Initializes a new instance of . /// Provisioning state of the certificate. /// Certificate password. /// Subject name of the certificate. @@ -32,7 +35,8 @@ public ContainerAppCertificateProperties() /// Certificate thumbprint. /// Is the certificate valid?. /// Public key hash. - internal ContainerAppCertificateProperties(ContainerAppCertificateProvisioningState? provisioningState, string password, string subjectName, IReadOnlyList subjectAlternativeNames, byte[] value, string issuer, DateTimeOffset? issueOn, DateTimeOffset? expireOn, string thumbprint, bool? isValid, string publicKeyHash) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCertificateProperties(ContainerAppCertificateProvisioningState? provisioningState, string password, string subjectName, IReadOnlyList subjectAlternativeNames, byte[] value, string issuer, DateTimeOffset? issueOn, DateTimeOffset? expireOn, string thumbprint, bool? isValid, string publicKeyHash, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Password = password; @@ -45,6 +49,7 @@ internal ContainerAppCertificateProperties(ContainerAppCertificateProvisioningSt Thumbprint = thumbprint; IsValid = isValid; PublicKeyHash = publicKeyHash; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the certificate. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.Serialization.cs index d82e69bf14c4..6bad26a29f9f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppClientRegistration : IUtf8JsonSerializable + public partial class ContainerAppClientRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecretSettingName"u8); writer.WriteStringValue(ClientSecretSettingName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppClientRegistration DeserializeContainerAppClientRegistration(JsonElement element) + internal static ContainerAppClientRegistration DeserializeContainerAppClientRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clientId = default; Optional clientSecretSettingName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppClientRegistration DeserializeContainerAppClientRegi clientSecretSettingName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppClientRegistration(clientId.Value, clientSecretSettingName.Value, serializedAdditionalRawData); + } + + ContainerAppClientRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppClientRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppClientRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppClientRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppClientRegistration model) + { + if (model is null) + { + return null; } - return new ContainerAppClientRegistration(clientId.Value, clientSecretSettingName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppClientRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppClientRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.cs index d12bd9e66462..3013a9241407 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppClientRegistration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the app registration for providers that have client ids and client secrets. public partial class ContainerAppClientRegistration { - /// Initializes a new instance of ContainerAppClientRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppClientRegistration() { } - /// Initializes a new instance of ContainerAppClientRegistration. + /// Initializes a new instance of . /// The Client ID of the app used for login. /// The app setting name that contains the client secret. - internal ContainerAppClientRegistration(string clientId, string clientSecretSettingName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppClientRegistration(string clientId, string clientSecretSettingName, Dictionary serializedAdditionalRawData) { ClientId = clientId; ClientSecretSettingName = clientSecretSettingName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Client ID of the app used for login. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.Serialization.cs index 97f54ec6d808..78346a12d004 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ContainerAppCollection + internal partial class ContainerAppCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppCollection DeserializeContainerAppCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppCollection DeserializeContainerAppCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static ContainerAppCollection DeserializeContainerAppCollection(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppCollection(value, nextLink.Value); + return new ContainerAppCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ContainerAppCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.cs index d3ceb4c75c11..4c5389b1cacf 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App collection ARM resource. internal partial class ContainerAppCollection { - /// Initializes a new instance of ContainerAppCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal ContainerAppCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal ContainerAppCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ContainerAppCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal ContainerAppCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.Serialization.cs index d114dc9bb794..bc652e970ac9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppConfiguration : IUtf8JsonSerializable + public partial class ContainerAppConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Secrets)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -34,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Ingress)) { writer.WritePropertyName("ingress"u8); - writer.WriteObjectValue(Ingress); + if (Ingress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Ingress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Registries)) { @@ -42,14 +63,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Registries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Dapr)) { writer.WritePropertyName("dapr"u8); - writer.WriteObjectValue(Dapr); + if (Dapr is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dapr).Serialize(writer, options); + } } if (Optional.IsDefined(MaxInactiveRevisions)) { @@ -59,13 +94,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Service)) { writer.WritePropertyName("service"u8); - writer.WriteObjectValue(Service); + if (Service is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Service).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppConfiguration DeserializeContainerAppConfiguration(JsonElement element) + internal static ContainerAppConfiguration DeserializeContainerAppConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +133,7 @@ internal static ContainerAppConfiguration DeserializeContainerAppConfiguration(J Optional dapr = default; Optional maxInactiveRevisions = default; Optional service = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secrets"u8)) @@ -152,8 +209,61 @@ internal static ContainerAppConfiguration DeserializeContainerAppConfiguration(J service = Service.DeserializeService(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppConfiguration(Optional.ToList(secrets), Optional.ToNullable(activeRevisionsMode), ingress.Value, Optional.ToList(registries), dapr.Value, Optional.ToNullable(maxInactiveRevisions), service.Value, serializedAdditionalRawData); + } + + ContainerAppConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppConfiguration(Optional.ToList(secrets), Optional.ToNullable(activeRevisionsMode), ingress.Value, Optional.ToList(registries), dapr.Value, Optional.ToNullable(maxInactiveRevisions), service.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.cs index dfb76aed9b36..734ba5c62e8b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.AppContainers.Models /// Non versioned Container App configuration properties that define the mutable settings of a Container app. public partial class ContainerAppConfiguration { - /// Initializes a new instance of ContainerAppConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppConfiguration() { Secrets = new ChangeTrackingList(); Registries = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppConfiguration. + /// Initializes a new instance of . /// Collection of secrets used by a Container app. /// /// ActiveRevisionsMode controls how active revisions are handled for the Container app: @@ -31,7 +35,8 @@ public ContainerAppConfiguration() /// Dapr configuration for the Container App. /// Optional. Max inactive revisions a Container App can have. /// Container App to be a dev Container App Service. - internal ContainerAppConfiguration(IList secrets, ContainerAppActiveRevisionsMode? activeRevisionsMode, ContainerAppIngressConfiguration ingress, IList registries, ContainerAppDaprConfiguration dapr, int? maxInactiveRevisions, Service service) + /// Keeps track of any properties unknown to the library. + internal ContainerAppConfiguration(IList secrets, ContainerAppActiveRevisionsMode? activeRevisionsMode, ContainerAppIngressConfiguration ingress, IList registries, ContainerAppDaprConfiguration dapr, int? maxInactiveRevisions, Service service, Dictionary serializedAdditionalRawData) { Secrets = secrets; ActiveRevisionsMode = activeRevisionsMode; @@ -40,6 +45,7 @@ internal ContainerAppConfiguration(IList secrets, Co Dapr = dapr; MaxInactiveRevisions = maxInactiveRevisions; Service = service; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Collection of secrets used by a Container app. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentData.Serialization.cs index df6332426ca8..b9f773f3c855 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentData.Serialization.cs @@ -5,24 +5,38 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppConnectedEnvironmentData : IUtf8JsonSerializable + public partial class ContainerAppConnectedEnvironmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { writer.WritePropertyName("extendedLocation"u8); - writer.WriteObjectValue(ExtendedLocation); + if (ExtendedLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExtendedLocation).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -52,14 +66,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CustomDomainConfiguration)) { writer.WritePropertyName("customDomainConfiguration"u8); - writer.WriteObjectValue(CustomDomainConfiguration); + if (CustomDomainConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomDomainConfiguration).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppConnectedEnvironmentData DeserializeContainerAppConnectedEnvironmentData(JsonElement element) + internal static ContainerAppConnectedEnvironmentData DeserializeContainerAppConnectedEnvironmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +112,7 @@ internal static ContainerAppConnectedEnvironmentData DeserializeContainerAppConn Optional staticIP = default; Optional daprAIConnectionString = default; Optional customDomainConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -185,8 +221,61 @@ internal static ContainerAppConnectedEnvironmentData DeserializeContainerAppConn } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppConnectedEnvironmentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation.Value, Optional.ToNullable(provisioningState), deploymentErrors.Value, defaultDomain.Value, staticIP.Value, daprAIConnectionString.Value, customDomainConfiguration.Value, serializedAdditionalRawData); + } + + ContainerAppConnectedEnvironmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppConnectedEnvironmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppConnectedEnvironmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppConnectedEnvironmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppConnectedEnvironmentData model) + { + if (model is null) + { + return null; } - return new ContainerAppConnectedEnvironmentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation.Value, Optional.ToNullable(provisioningState), deploymentErrors.Value, defaultDomain.Value, staticIP.Value, daprAIConnectionString.Value, customDomainConfiguration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppConnectedEnvironmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppConnectedEnvironmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentStorageData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentStorageData.Serialization.cs index f96e2cb10b3c..0628efec094b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentStorageData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppConnectedEnvironmentStorageData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppConnectedEnvironmentStorageData : IUtf8JsonSerializable + public partial class ContainerAppConnectedEnvironmentStorageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppConnectedEnvironmentStorageData DeserializeContainerAppConnectedEnvironmentStorageData(JsonElement element) + internal static ContainerAppConnectedEnvironmentStorageData DeserializeContainerAppConnectedEnvironmentStorageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static ContainerAppConnectedEnvironmentStorageData DeserializeContainer string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static ContainerAppConnectedEnvironmentStorageData DeserializeContainer systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppConnectedEnvironmentStorageData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ContainerAppConnectedEnvironmentStorageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppConnectedEnvironmentStorageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppConnectedEnvironmentStorageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppConnectedEnvironmentStorageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppConnectedEnvironmentStorageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppConnectedEnvironmentStorageData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppConnectedEnvironmentStorageData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppConnectedEnvironmentStorageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.Serialization.cs index 4e77d0aad8aa..907ab9fe70df 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppContainer : IUtf8JsonSerializable + public partial class ContainerAppContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Probes)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Probes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -62,14 +76,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Env) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Resources)) { writer.WritePropertyName("resources"u8); - writer.WriteObjectValue(Resources); + if (Resources is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resources).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(VolumeMounts)) { @@ -77,15 +105,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VolumeMounts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppContainer DeserializeContainerAppContainer(JsonElement element) + internal static ContainerAppContainer DeserializeContainerAppContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,6 +147,7 @@ internal static ContainerAppContainer DeserializeContainerAppContainer(JsonEleme Optional> env = default; Optional resources = default; Optional> volumeMounts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("probes"u8)) @@ -189,8 +239,61 @@ internal static ContainerAppContainer DeserializeContainerAppContainer(JsonEleme volumeMounts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, Optional.ToList(volumeMounts), Optional.ToList(probes)); + return new ContainerAppContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, Optional.ToList(volumeMounts), Optional.ToList(probes), serializedAdditionalRawData); + } + + ContainerAppContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppContainer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppContainer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.cs index 04dab728c619..a583c1bf0e2d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppContainer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,13 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App container definition. public partial class ContainerAppContainer : ContainerAppBaseContainer { - /// Initializes a new instance of ContainerAppContainer. + /// Initializes a new instance of . public ContainerAppContainer() { Probes = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppContainer. + /// Initializes a new instance of . /// Container image tag. /// Custom container name. /// Container start command. @@ -28,7 +29,8 @@ public ContainerAppContainer() /// Container resource requirements. /// Container volume mounts. /// List of probes for the container. - internal ContainerAppContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, IList volumeMounts, IList probes) : base(image, name, command, args, env, resources, volumeMounts) + /// Keeps track of any properties unknown to the library. + internal ContainerAppContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, IList volumeMounts, IList probes, Dictionary serializedAdditionalRawData) : base(image, name, command, args, env, resources, volumeMounts, serializedAdditionalRawData) { Probes = probes; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.Serialization.cs index dcf465bed981..1e30d31da00d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCookieExpiration : IUtf8JsonSerializable + public partial class ContainerAppCookieExpiration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Convention)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("timeToExpiration"u8); writer.WriteStringValue(TimeToExpiration); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCookieExpiration DeserializeContainerAppCookieExpiration(JsonElement element) + internal static ContainerAppCookieExpiration DeserializeContainerAppCookieExpiration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional convention = default; Optional timeToExpiration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("convention"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppCookieExpiration DeserializeContainerAppCookieExpira timeToExpiration = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCookieExpiration(Optional.ToNullable(convention), timeToExpiration.Value, serializedAdditionalRawData); + } + + ContainerAppCookieExpiration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCookieExpiration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCookieExpiration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCookieExpiration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCookieExpiration model) + { + if (model is null) + { + return null; } - return new ContainerAppCookieExpiration(Optional.ToNullable(convention), timeToExpiration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCookieExpiration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCookieExpiration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.cs index 418757fb732f..5b5346473212 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCookieExpiration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the session cookie's expiration. public partial class ContainerAppCookieExpiration { - /// Initializes a new instance of ContainerAppCookieExpiration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCookieExpiration() { } - /// Initializes a new instance of ContainerAppCookieExpiration. + /// Initializes a new instance of . /// The convention used when determining the session cookie's expiration. /// The time after the request is made when the session cookie should expire. - internal ContainerAppCookieExpiration(ContainerAppCookieExpirationConvention? convention, string timeToExpiration) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCookieExpiration(ContainerAppCookieExpirationConvention? convention, string timeToExpiration, Dictionary serializedAdditionalRawData) { Convention = convention; TimeToExpiration = timeToExpiration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The convention used when determining the session cookie's expiration. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.Serialization.cs index 508f6c6991cf..adf9aebf9f89 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCorsPolicy : IUtf8JsonSerializable + public partial class ContainerAppCorsPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("allowedOrigins"u8); writer.WriteStartArray(); @@ -63,11 +70,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("allowCredentials"u8); writer.WriteBooleanValue(AllowCredentials.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCorsPolicy DeserializeContainerAppCorsPolicy(JsonElement element) + internal static ContainerAppCorsPolicy DeserializeContainerAppCorsPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +99,7 @@ internal static ContainerAppCorsPolicy DeserializeContainerAppCorsPolicy(JsonEle Optional> exposeHeaders = default; Optional maxAge = default; Optional allowCredentials = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowedOrigins"u8)) @@ -150,8 +172,61 @@ internal static ContainerAppCorsPolicy DeserializeContainerAppCorsPolicy(JsonEle allowCredentials = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCorsPolicy(allowedOrigins, Optional.ToList(allowedMethods), Optional.ToList(allowedHeaders), Optional.ToList(exposeHeaders), Optional.ToNullable(maxAge), Optional.ToNullable(allowCredentials), serializedAdditionalRawData); + } + + ContainerAppCorsPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCorsPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCorsPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCorsPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCorsPolicy model) + { + if (model is null) + { + return null; } - return new ContainerAppCorsPolicy(allowedOrigins, Optional.ToList(allowedMethods), Optional.ToList(allowedHeaders), Optional.ToList(exposeHeaders), Optional.ToNullable(maxAge), Optional.ToNullable(allowCredentials)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCorsPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCorsPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.cs index cdfb0b2e4ae0..697a4933e94a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCorsPolicy.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Cross-Origin-Resource-Sharing policy. public partial class ContainerAppCorsPolicy { - /// Initializes a new instance of ContainerAppCorsPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the content for the access-control-allow-origins header. /// is null. public ContainerAppCorsPolicy(IEnumerable allowedOrigins) @@ -28,14 +31,15 @@ public ContainerAppCorsPolicy(IEnumerable allowedOrigins) ExposeHeaders = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppCorsPolicy. + /// Initializes a new instance of . /// Specifies the content for the access-control-allow-origins header. /// Specifies the content for the access-control-allow-methods header. /// Specifies the content for the access-control-allow-headers header. /// Specifies the content for the access-control-expose-headers header. /// Specifies the content for the access-control-max-age header. /// Specifies whether the resource allows credentials. - internal ContainerAppCorsPolicy(IList allowedOrigins, IList allowedMethods, IList allowedHeaders, IList exposeHeaders, int? maxAge, bool? allowCredentials) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCorsPolicy(IList allowedOrigins, IList allowedMethods, IList allowedHeaders, IList exposeHeaders, int? maxAge, bool? allowCredentials, Dictionary serializedAdditionalRawData) { AllowedOrigins = allowedOrigins; AllowedMethods = allowedMethods; @@ -43,6 +47,12 @@ internal ContainerAppCorsPolicy(IList allowedOrigins, IList allo ExposeHeaders = exposeHeaders; MaxAge = maxAge; AllowCredentials = allowCredentials; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppCorsPolicy() + { } /// Specifies the content for the access-control-allow-origins header. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.Serialization.cs index 555a64a56418..f27a6d555d0a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCredentials : IUtf8JsonSerializable + public partial class ContainerAppCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("subscriptionId"u8); writer.WriteStringValue(SubscriptionId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCredentials DeserializeContainerAppCredentials(JsonElement element) + internal static ContainerAppCredentials DeserializeContainerAppCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static ContainerAppCredentials DeserializeContainerAppCredentials(JsonE Optional tenantId = default; Optional kind = default; Optional subscriptionId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -86,8 +108,61 @@ internal static ContainerAppCredentials DeserializeContainerAppCredentials(JsonE subscriptionId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCredentials(clientId.Value, clientSecret.Value, Optional.ToNullable(tenantId), kind.Value, subscriptionId.Value, serializedAdditionalRawData); + } + + ContainerAppCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCredentials model) + { + if (model is null) + { + return null; } - return new ContainerAppCredentials(clientId.Value, clientSecret.Value, Optional.ToNullable(tenantId), kind.Value, subscriptionId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.cs index 5d9e4c11257f..b0f90320c8bb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCredentials.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models { /// Container App credentials. public partial class ContainerAppCredentials { - /// Initializes a new instance of ContainerAppCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCredentials() { } - /// Initializes a new instance of ContainerAppCredentials. + /// Initializes a new instance of . /// Client Id. /// Client Secret. /// Tenant Id. /// Kind of auth github does for deploying the template. /// Subscription Id. - internal ContainerAppCredentials(string clientId, string clientSecret, Guid? tenantId, string kind, string subscriptionId) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCredentials(string clientId, string clientSecret, Guid? tenantId, string kind, string subscriptionId, Dictionary serializedAdditionalRawData) { ClientId = clientId; ClientSecret = clientSecret; TenantId = tenantId; Kind = kind; SubscriptionId = subscriptionId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Client Id. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.Serialization.cs index fcd5a6ad9626..478122adbf33 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomDomain : IUtf8JsonSerializable + public partial class ContainerAppCustomDomain : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certificateId"u8); writer.WriteStringValue(CertificateId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCustomDomain DeserializeContainerAppCustomDomain(JsonElement element) + internal static ContainerAppCustomDomain DeserializeContainerAppCustomDomain(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ContainerAppCustomDomain DeserializeContainerAppCustomDomain(Jso string name = default; Optional bindingType = default; Optional certificateId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -64,8 +87,61 @@ internal static ContainerAppCustomDomain DeserializeContainerAppCustomDomain(Jso certificateId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCustomDomain(name, Optional.ToNullable(bindingType), certificateId.Value, serializedAdditionalRawData); + } + + ContainerAppCustomDomain IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomDomain(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomDomain IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomDomain(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomDomain model) + { + if (model is null) + { + return null; } - return new ContainerAppCustomDomain(name, Optional.ToNullable(bindingType), certificateId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomDomain(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomDomain(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.cs index 656c32d18604..3323932d4ab6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomain.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Custom Domain of a Container App. public partial class ContainerAppCustomDomain { - /// Initializes a new instance of ContainerAppCustomDomain. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Hostname. /// is null. public ContainerAppCustomDomain(string name) @@ -23,15 +27,22 @@ public ContainerAppCustomDomain(string name) Name = name; } - /// Initializes a new instance of ContainerAppCustomDomain. + /// Initializes a new instance of . /// Hostname. /// Custom Domain binding type. /// Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. - internal ContainerAppCustomDomain(string name, ContainerAppCustomDomainBindingType? bindingType, ResourceIdentifier certificateId) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomDomain(string name, ContainerAppCustomDomainBindingType? bindingType, ResourceIdentifier certificateId, Dictionary serializedAdditionalRawData) { Name = name; BindingType = bindingType; CertificateId = certificateId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppCustomDomain() + { } /// Hostname. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.Serialization.cs index ed1272d4c878..f73020bc2af6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomDomainConfiguration : IUtf8JsonSerializable + public partial class ContainerAppCustomDomainConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DnsSuffix)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certificatePassword"u8); writer.WriteStringValue(CertificatePassword); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCustomDomainConfiguration DeserializeContainerAppCustomDomainConfiguration(JsonElement element) + internal static ContainerAppCustomDomainConfiguration DeserializeContainerAppCustomDomainConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +68,7 @@ internal static ContainerAppCustomDomainConfiguration DeserializeContainerAppCus Optional expirationDate = default; Optional thumbprint = default; Optional subjectName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("customDomainVerificationId"u8)) @@ -92,8 +114,61 @@ internal static ContainerAppCustomDomainConfiguration DeserializeContainerAppCus subjectName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCustomDomainConfiguration(customDomainVerificationId.Value, dnsSuffix.Value, certificateValue.Value, certificatePassword.Value, Optional.ToNullable(expirationDate), thumbprint.Value, subjectName.Value, serializedAdditionalRawData); + } + + ContainerAppCustomDomainConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomDomainConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomDomainConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomDomainConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomDomainConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppCustomDomainConfiguration(customDomainVerificationId.Value, dnsSuffix.Value, certificateValue.Value, certificatePassword.Value, Optional.ToNullable(expirationDate), thumbprint.Value, subjectName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomDomainConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomDomainConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.cs index 08a9f665d089..018c5c82dfd0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models { /// Configuration properties for apps environment custom domain. public partial class ContainerAppCustomDomainConfiguration { - /// Initializes a new instance of ContainerAppCustomDomainConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCustomDomainConfiguration() { } - /// Initializes a new instance of ContainerAppCustomDomainConfiguration. + /// Initializes a new instance of . /// Id used to verify domain name ownership. /// Dns suffix for the environment domain. /// PFX or PEM blob. @@ -25,7 +29,8 @@ public ContainerAppCustomDomainConfiguration() /// Certificate expiration date. /// Certificate thumbprint. /// Subject name of the certificate. - internal ContainerAppCustomDomainConfiguration(string customDomainVerificationId, string dnsSuffix, byte[] certificateValue, string certificatePassword, DateTimeOffset? expireOn, string thumbprint, string subjectName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomDomainConfiguration(string customDomainVerificationId, string dnsSuffix, byte[] certificateValue, string certificatePassword, DateTimeOffset? expireOn, string thumbprint, string subjectName, Dictionary serializedAdditionalRawData) { CustomDomainVerificationId = customDomainVerificationId; DnsSuffix = dnsSuffix; @@ -34,6 +39,7 @@ internal ContainerAppCustomDomainConfiguration(string customDomainVerificationId ExpireOn = expireOn; Thumbprint = thumbprint; SubjectName = subjectName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id used to verify domain name ownership. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.Serialization.cs index dc702ee44f3e..77f0221f71cb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.Serialization.cs @@ -5,16 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomDomainVerificationFailureInfo + public partial class ContainerAppCustomDomainVerificationFailureInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppCustomDomainVerificationFailureInfo DeserializeContainerAppCustomDomainVerificationFailureInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppCustomDomainVerificationFailureInfo DeserializeContainerAppCustomDomainVerificationFailureInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +67,7 @@ internal static ContainerAppCustomDomainVerificationFailureInfo DeserializeConta Optional message = default; Optional target = default; Optional> details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -54,8 +99,61 @@ internal static ContainerAppCustomDomainVerificationFailureInfo DeserializeConta details = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppCustomDomainVerificationFailureInfo(code.Value, message.Value, target.Value, Optional.ToList(details)); + return new ContainerAppCustomDomainVerificationFailureInfo(code.Value, message.Value, target.Value, Optional.ToList(details), serializedAdditionalRawData); + } + + ContainerAppCustomDomainVerificationFailureInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomDomainVerificationFailureInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomDomainVerificationFailureInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomDomainVerificationFailureInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomDomainVerificationFailureInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomDomainVerificationFailureInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomDomainVerificationFailureInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.cs index a9d4589d046b..2139aba1df92 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppContainers.Models /// Raw failure information if DNS verification fails. public partial class ContainerAppCustomDomainVerificationFailureInfo { - /// Initializes a new instance of ContainerAppCustomDomainVerificationFailureInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppCustomDomainVerificationFailureInfo() { Details = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppCustomDomainVerificationFailureInfo. + /// Initializes a new instance of . /// Standardized string to programmatically identify the error. /// Detailed error description and debugging information. /// Detailed error description and debugging information. /// Details or the error. - internal ContainerAppCustomDomainVerificationFailureInfo(string code, string message, string target, IReadOnlyList details) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomDomainVerificationFailureInfo(string code, string message, string target, IReadOnlyList details, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Standardized string to programmatically identify the error. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.Serialization.cs index cebd0ef882ef..96ca5eb01bfd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomDomainVerificationFailureInfoDetailsItem + public partial class ContainerAppCustomDomainVerificationFailureInfoDetailsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppCustomDomainVerificationFailureInfoDetailsItem DeserializeContainerAppCustomDomainVerificationFailureInfoDetailsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppCustomDomainVerificationFailureInfoDetailsItem DeserializeContainerAppCustomDomainVerificationFailureInfoDetailsItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ContainerAppCustomDomainVerificationFailureInfoDetailsItem Deser Optional code = default; Optional message = default; Optional target = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -38,8 +67,61 @@ internal static ContainerAppCustomDomainVerificationFailureInfoDetailsItem Deser target = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppCustomDomainVerificationFailureInfoDetailsItem(code.Value, message.Value, target.Value); + return new ContainerAppCustomDomainVerificationFailureInfoDetailsItem(code.Value, message.Value, target.Value, serializedAdditionalRawData); + } + + ContainerAppCustomDomainVerificationFailureInfoDetailsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomDomainVerificationFailureInfoDetailsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomDomainVerificationFailureInfoDetailsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomDomainVerificationFailureInfoDetailsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomDomainVerificationFailureInfoDetailsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomDomainVerificationFailureInfoDetailsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomDomainVerificationFailureInfoDetailsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.cs index ef9a341db1ee..dfc1e5ede410 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainVerificationFailureInfoDetailsItem.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Detailed errors. public partial class ContainerAppCustomDomainVerificationFailureInfoDetailsItem { - /// Initializes a new instance of ContainerAppCustomDomainVerificationFailureInfoDetailsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppCustomDomainVerificationFailureInfoDetailsItem() { } - /// Initializes a new instance of ContainerAppCustomDomainVerificationFailureInfoDetailsItem. + /// Initializes a new instance of . /// Standardized string to programmatically identify the error. /// Detailed error description and debugging information. /// Detailed error description and debugging information. - internal ContainerAppCustomDomainVerificationFailureInfoDetailsItem(string code, string message, string target) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomDomainVerificationFailureInfoDetailsItem(string code, string message, string target, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Standardized string to programmatically identify the error. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.Serialization.cs index cc498de66782..c2fe1a7e7e89 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.Serialization.cs @@ -5,16 +5,93 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomHostnameAnalysisResult + public partial class ContainerAppCustomHostnameAnalysisResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppCustomHostnameAnalysisResult DeserializeContainerAppCustomHostnameAnalysisResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(CNameRecords)) + { + writer.WritePropertyName("cNameRecords"u8); + writer.WriteStartArray(); + foreach (var item in CNameRecords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TxtRecords)) + { + writer.WritePropertyName("txtRecords"u8); + writer.WriteStartArray(); + foreach (var item in TxtRecords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ARecords)) + { + writer.WritePropertyName("aRecords"u8); + writer.WriteStartArray(); + foreach (var item in ARecords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AlternateCNameRecords)) + { + writer.WritePropertyName("alternateCNameRecords"u8); + writer.WriteStartArray(); + foreach (var item in AlternateCNameRecords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AlternateTxtRecords)) + { + writer.WritePropertyName("alternateTxtRecords"u8); + writer.WriteStartArray(); + foreach (var item in AlternateTxtRecords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppCustomHostnameAnalysisResult DeserializeContainerAppCustomHostnameAnalysisResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +108,7 @@ internal static ContainerAppCustomHostnameAnalysisResult DeserializeContainerApp Optional> aRecords = default; Optional> alternateCNameRecords = default; Optional> alternateTxtRecords = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hostName"u8)) @@ -158,8 +236,61 @@ internal static ContainerAppCustomHostnameAnalysisResult DeserializeContainerApp alternateTxtRecords = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppCustomHostnameAnalysisResult(hostName.Value, Optional.ToNullable(isHostnameAlreadyVerified), Optional.ToNullable(customDomainVerificationTest), customDomainVerificationFailureInfo.Value, Optional.ToNullable(hasConflictOnManagedEnvironment), Optional.ToNullable(conflictWithEnvironmentCustomDomain), conflictingContainerAppResourceId.Value, Optional.ToList(cNameRecords), Optional.ToList(txtRecords), Optional.ToList(aRecords), Optional.ToList(alternateCNameRecords), Optional.ToList(alternateTxtRecords)); + return new ContainerAppCustomHostnameAnalysisResult(hostName.Value, Optional.ToNullable(isHostnameAlreadyVerified), Optional.ToNullable(customDomainVerificationTest), customDomainVerificationFailureInfo.Value, Optional.ToNullable(hasConflictOnManagedEnvironment), Optional.ToNullable(conflictWithEnvironmentCustomDomain), conflictingContainerAppResourceId.Value, Optional.ToList(cNameRecords), Optional.ToList(txtRecords), Optional.ToList(aRecords), Optional.ToList(alternateCNameRecords), Optional.ToList(alternateTxtRecords), serializedAdditionalRawData); + } + + ContainerAppCustomHostnameAnalysisResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomHostnameAnalysisResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomHostnameAnalysisResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomHostnameAnalysisResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomHostnameAnalysisResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomHostnameAnalysisResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomHostnameAnalysisResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.cs index a13e6fa70a1d..1c61e153bc94 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomHostnameAnalysisResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Custom domain analysis. public partial class ContainerAppCustomHostnameAnalysisResult { - /// Initializes a new instance of ContainerAppCustomHostnameAnalysisResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppCustomHostnameAnalysisResult() { CNameRecords = new ChangeTrackingList(); @@ -23,7 +27,7 @@ internal ContainerAppCustomHostnameAnalysisResult() AlternateTxtRecords = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppCustomHostnameAnalysisResult. + /// Initializes a new instance of . /// Host name that was analyzed. /// <code>true</code> if hostname is already verified; otherwise, <code>false</code>. /// DNS verification test result. @@ -36,7 +40,8 @@ internal ContainerAppCustomHostnameAnalysisResult() /// A records visible for this hostname. /// Alternate CName records visible for this hostname. /// Alternate TXT records visible for this hostname. - internal ContainerAppCustomHostnameAnalysisResult(string hostName, bool? isHostnameAlreadyVerified, ContainerAppDnsVerificationTestResult? customDomainVerificationTest, ContainerAppCustomDomainVerificationFailureInfo customDomainVerificationFailureInfo, bool? hasConflictOnManagedEnvironment, bool? conflictWithEnvironmentCustomDomain, string conflictingContainerAppResourceId, IReadOnlyList cNameRecords, IReadOnlyList txtRecords, IReadOnlyList aRecords, IReadOnlyList alternateCNameRecords, IReadOnlyList alternateTxtRecords) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomHostnameAnalysisResult(string hostName, bool? isHostnameAlreadyVerified, ContainerAppDnsVerificationTestResult? customDomainVerificationTest, ContainerAppCustomDomainVerificationFailureInfo customDomainVerificationFailureInfo, bool? hasConflictOnManagedEnvironment, bool? conflictWithEnvironmentCustomDomain, string conflictingContainerAppResourceId, IReadOnlyList cNameRecords, IReadOnlyList txtRecords, IReadOnlyList aRecords, IReadOnlyList alternateCNameRecords, IReadOnlyList alternateTxtRecords, Dictionary serializedAdditionalRawData) { HostName = hostName; IsHostnameAlreadyVerified = isHostnameAlreadyVerified; @@ -50,6 +55,7 @@ internal ContainerAppCustomHostnameAnalysisResult(string hostName, bool? isHostn ARecords = aRecords; AlternateCNameRecords = alternateCNameRecords; AlternateTxtRecords = alternateTxtRecords; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Host name that was analyzed. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.Serialization.cs index 997a1db81739..46d630fac9e1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomOpenIdConnectProviderConfiguration : IUtf8JsonSerializable + public partial class ContainerAppCustomOpenIdConnectProviderConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } } if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppCustomOpenIdConnectProviderConfiguration DeserializeContainerAppCustomOpenIdConnectProviderConfiguration(JsonElement element) + internal static ContainerAppCustomOpenIdConnectProviderConfiguration DeserializeContainerAppCustomOpenIdConnectProviderConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static ContainerAppCustomOpenIdConnectProviderConfiguration Deserialize Optional enabled = default; Optional registration = default; Optional login = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -71,8 +108,61 @@ internal static ContainerAppCustomOpenIdConnectProviderConfiguration Deserialize login = ContainerAppOpenIdConnectLogin.DeserializeContainerAppOpenIdConnectLogin(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCustomOpenIdConnectProviderConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, serializedAdditionalRawData); + } + + ContainerAppCustomOpenIdConnectProviderConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomOpenIdConnectProviderConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomOpenIdConnectProviderConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomOpenIdConnectProviderConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomOpenIdConnectProviderConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppCustomOpenIdConnectProviderConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomOpenIdConnectProviderConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomOpenIdConnectProviderConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.cs index 66f2ad6dadb5..8cfde3e3ed00 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomOpenIdConnectProviderConfiguration.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the custom Open ID Connect provider. public partial class ContainerAppCustomOpenIdConnectProviderConfiguration { - /// Initializes a new instance of ContainerAppCustomOpenIdConnectProviderConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCustomOpenIdConnectProviderConfiguration() { } - /// Initializes a new instance of ContainerAppCustomOpenIdConnectProviderConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the custom Open ID provider provider should not be enabled; otherwise, <code>true</code>. /// The configuration settings of the app registration for the custom Open ID Connect provider. /// The configuration settings of the login flow of the custom Open ID Connect provider. - internal ContainerAppCustomOpenIdConnectProviderConfiguration(bool? isEnabled, ContainerAppOpenIdConnectRegistration registration, ContainerAppOpenIdConnectLogin login) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomOpenIdConnectProviderConfiguration(bool? isEnabled, ContainerAppOpenIdConnectRegistration registration, ContainerAppOpenIdConnectLogin login, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; Login = login; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the custom Open ID provider provider should not be enabled; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.Serialization.cs index 399f7d48fbbe..52ed09f3ceda 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppCustomScaleRule : IUtf8JsonSerializable + public partial class ContainerAppCustomScaleRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CustomScaleRuleType)) { @@ -38,15 +45,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Auth) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppCustomScaleRule DeserializeContainerAppCustomScaleRule(JsonElement element) + internal static ContainerAppCustomScaleRule DeserializeContainerAppCustomScaleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static ContainerAppCustomScaleRule DeserializeContainerAppCustomScaleRu Optional type = default; Optional> metadata = default; Optional> auth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -89,8 +118,61 @@ internal static ContainerAppCustomScaleRule DeserializeContainerAppCustomScaleRu auth = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppCustomScaleRule(type.Value, Optional.ToDictionary(metadata), Optional.ToList(auth), serializedAdditionalRawData); + } + + ContainerAppCustomScaleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCustomScaleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppCustomScaleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppCustomScaleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppCustomScaleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppCustomScaleRule(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppCustomScaleRule(type.Value, Optional.ToDictionary(metadata), Optional.ToList(auth)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppCustomScaleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.cs index 47716b92b24a..7b5f5b09468b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomScaleRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App container Custom scaling rule. public partial class ContainerAppCustomScaleRule { - /// Initializes a new instance of ContainerAppCustomScaleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppCustomScaleRule() { Metadata = new ChangeTrackingDictionary(); Auth = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppCustomScaleRule. + /// Initializes a new instance of . /// /// Type of the custom scale rule /// eg: azure-servicebus, redis etc. /// /// Metadata properties to describe custom scale rule. /// Authentication secrets for the custom scale rule. - internal ContainerAppCustomScaleRule(string customScaleRuleType, IDictionary metadata, IList auth) + /// Keeps track of any properties unknown to the library. + internal ContainerAppCustomScaleRule(string customScaleRuleType, IDictionary metadata, IList auth, Dictionary serializedAdditionalRawData) { CustomScaleRuleType = customScaleRuleType; Metadata = metadata; Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprComponentData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprComponentData.Serialization.cs index 765686a31128..84556e3f6a1f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprComponentData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprComponentData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppDaprComponentData : IUtf8JsonSerializable + public partial class ContainerAppDaprComponentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -61,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Metadata) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,11 +97,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDaprComponentData DeserializeContainerAppDaprComponentData(JsonElement element) + internal static ContainerAppDaprComponentData DeserializeContainerAppDaprComponentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -97,6 +132,7 @@ internal static ContainerAppDaprComponentData DeserializeContainerAppDaprCompone Optional secretStoreComponent = default; Optional> metadata = default; Optional> scopes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -206,8 +242,61 @@ internal static ContainerAppDaprComponentData DeserializeContainerAppDaprCompone } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDaprComponentData(id, name, type, systemData.Value, componentType.Value, version.Value, Optional.ToNullable(ignoreErrors), initTimeout.Value, Optional.ToList(secrets), secretStoreComponent.Value, Optional.ToList(metadata), Optional.ToList(scopes), serializedAdditionalRawData); + } + + ContainerAppDaprComponentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDaprComponentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDaprComponentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDaprComponentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDaprComponentData model) + { + if (model is null) + { + return null; } - return new ContainerAppDaprComponentData(id, name, type, systemData.Value, componentType.Value, version.Value, Optional.ToNullable(ignoreErrors), initTimeout.Value, Optional.ToList(secrets), secretStoreComponent.Value, Optional.ToList(metadata), Optional.ToList(scopes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDaprComponentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDaprComponentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.Serialization.cs index edc13c1a0e9a..bd3752db1150 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDaprConfiguration : IUtf8JsonSerializable + public partial class ContainerAppDaprConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -55,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableApiLogging"u8); writer.WriteBooleanValue(IsApiLoggingEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDaprConfiguration DeserializeContainerAppDaprConfiguration(JsonElement element) + internal static ContainerAppDaprConfiguration DeserializeContainerAppDaprConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +94,7 @@ internal static ContainerAppDaprConfiguration DeserializeContainerAppDaprConfigu Optional httpMaxRequestSize = default; Optional logLevel = default; Optional enableApiLogging = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -142,8 +165,61 @@ internal static ContainerAppDaprConfiguration DeserializeContainerAppDaprConfigu enableApiLogging = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDaprConfiguration(Optional.ToNullable(enabled), appId.Value, Optional.ToNullable(appProtocol), Optional.ToNullable(appPort), Optional.ToNullable(httpReadBufferSize), Optional.ToNullable(httpMaxRequestSize), Optional.ToNullable(logLevel), Optional.ToNullable(enableApiLogging), serializedAdditionalRawData); + } + + ContainerAppDaprConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDaprConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDaprConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDaprConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDaprConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppDaprConfiguration(Optional.ToNullable(enabled), appId.Value, Optional.ToNullable(appProtocol), Optional.ToNullable(appPort), Optional.ToNullable(httpReadBufferSize), Optional.ToNullable(httpMaxRequestSize), Optional.ToNullable(logLevel), Optional.ToNullable(enableApiLogging)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDaprConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDaprConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.cs index 46e4838c7b74..aa35f80dee47 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprConfiguration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App Dapr configuration. public partial class ContainerAppDaprConfiguration { - /// Initializes a new instance of ContainerAppDaprConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDaprConfiguration() { } - /// Initializes a new instance of ContainerAppDaprConfiguration. + /// Initializes a new instance of . /// Boolean indicating if the Dapr side car is enabled. /// Dapr application identifier. /// Tells Dapr which protocol your application is using. Valid options are http and grpc. Default is http. @@ -24,7 +30,8 @@ public ContainerAppDaprConfiguration() /// Increasing max size of request body http and grpc servers parameter in MB to handle uploading of big files. Default is 4 MB. /// Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. /// Enables API logging for the Dapr sidecar. - internal ContainerAppDaprConfiguration(bool? isEnabled, string appId, ContainerAppProtocol? appProtocol, int? appPort, int? httpReadBufferSize, int? httpMaxRequestSize, ContainerAppDaprLogLevel? logLevel, bool? isApiLoggingEnabled) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDaprConfiguration(bool? isEnabled, string appId, ContainerAppProtocol? appProtocol, int? appPort, int? httpReadBufferSize, int? httpMaxRequestSize, ContainerAppDaprLogLevel? logLevel, bool? isApiLoggingEnabled, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; AppId = appId; @@ -34,6 +41,7 @@ internal ContainerAppDaprConfiguration(bool? isEnabled, string appId, ContainerA HttpMaxRequestSize = httpMaxRequestSize; LogLevel = logLevel; IsApiLoggingEnabled = isApiLoggingEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Boolean indicating if the Dapr side car is enabled. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.Serialization.cs index f312271e1fab..0adc23c637de 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDaprMetadata : IUtf8JsonSerializable + public partial class ContainerAppDaprMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secretRef"u8); writer.WriteStringValue(SecretRef); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDaprMetadata DeserializeContainerAppDaprMetadata(JsonElement element) + internal static ContainerAppDaprMetadata DeserializeContainerAppDaprMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppDaprMetadata DeserializeContainerAppDaprMetadata(Jso Optional name = default; Optional value = default; Optional secretRef = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +82,61 @@ internal static ContainerAppDaprMetadata DeserializeContainerAppDaprMetadata(Jso secretRef = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDaprMetadata(name.Value, value.Value, secretRef.Value, serializedAdditionalRawData); + } + + ContainerAppDaprMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDaprMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDaprMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDaprMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDaprMetadata model) + { + if (model is null) + { + return null; } - return new ContainerAppDaprMetadata(name.Value, value.Value, secretRef.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDaprMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDaprMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.cs index 78619ec35eb0..42ef3aef6422 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprMetadata.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Dapr component metadata. public partial class ContainerAppDaprMetadata { - /// Initializes a new instance of ContainerAppDaprMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDaprMetadata() { } - /// Initializes a new instance of ContainerAppDaprMetadata. + /// Initializes a new instance of . /// Metadata property name. /// Metadata property value. /// Name of the Dapr Component secret from which to pull the metadata property value. - internal ContainerAppDaprMetadata(string name, string value, string secretRef) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDaprMetadata(string name, string value, string secretRef, Dictionary serializedAdditionalRawData) { Name = name; Value = value; SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Metadata property name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.Serialization.cs index a38a768c3224..fbc02a79e12b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDaprSecret + public partial class ContainerAppDaprSecret : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppDaprSecret DeserializeContainerAppDaprSecret(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppDaprSecret DeserializeContainerAppDaprSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ContainerAppDaprSecret DeserializeContainerAppDaprSecret(JsonEle value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppDaprSecret(name.Value, value.Value); + return new ContainerAppDaprSecret(name.Value, value.Value, serializedAdditionalRawData); + } + + ContainerAppDaprSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDaprSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDaprSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDaprSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDaprSecret model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDaprSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDaprSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.cs index 8370685d2fa2..2af71c999180 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDaprSecret.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Dapr component Secret for ListSecrets Action. public partial class ContainerAppDaprSecret { - /// Initializes a new instance of ContainerAppDaprSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppDaprSecret() { } - /// Initializes a new instance of ContainerAppDaprSecret. + /// Initializes a new instance of . /// Secret Name. /// Secret Value. - internal ContainerAppDaprSecret(string name, string value) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDaprSecret(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Secret Name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppData.Serialization.cs index 5cc1f26833c6..3e7cfdd22458 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppData.Serialization.cs @@ -9,21 +9,34 @@ using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppData : IUtf8JsonSerializable + public partial class ContainerAppData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtendedLocation)) { writer.WritePropertyName("extendedLocation"u8); - writer.WriteObjectValue(ExtendedLocation); + if (ExtendedLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExtendedLocation).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -69,19 +82,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(Template)) { writer.WritePropertyName("template"u8); - writer.WriteObjectValue(Template); + if (Template is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Template).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppData DeserializeContainerAppData(JsonElement element) + internal static ContainerAppData DeserializeContainerAppData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,6 +148,7 @@ internal static ContainerAppData DeserializeContainerAppData(JsonElement element Optional template = default; Optional> outboundIPAddresses = default; Optional eventStreamEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation"u8)) @@ -288,8 +330,61 @@ internal static ContainerAppData DeserializeContainerAppData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation.Value, identity, managedBy.Value, Optional.ToNullable(provisioningState), managedEnvironmentId.Value, environmentId.Value, workloadProfileName.Value, latestRevisionName.Value, latestReadyRevisionName.Value, latestRevisionFqdn.Value, customDomainVerificationId.Value, configuration.Value, template.Value, Optional.ToList(outboundIPAddresses), eventStreamEndpoint.Value, serializedAdditionalRawData); + } + + ContainerAppData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, extendedLocation.Value, identity, managedBy.Value, Optional.ToNullable(provisioningState), managedEnvironmentId.Value, environmentId.Value, workloadProfileName.Value, latestRevisionName.Value, latestReadyRevisionName.Value, latestRevisionFqdn.Value, customDomainVerificationId.Value, configuration.Value, template.Value, Optional.ToList(outboundIPAddresses), eventStreamEndpoint.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.Serialization.cs index 6078181ba0c1..68d23893b012 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDefaultAuthorizationPolicy : IUtf8JsonSerializable + public partial class ContainerAppDefaultAuthorizationPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllowedPrincipals)) { writer.WritePropertyName("allowedPrincipals"u8); - writer.WriteObjectValue(AllowedPrincipals); + if (AllowedPrincipals is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AllowedPrincipals).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AllowedApplications)) { @@ -31,17 +45,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDefaultAuthorizationPolicy DeserializeContainerAppDefaultAuthorizationPolicy(JsonElement element) + internal static ContainerAppDefaultAuthorizationPolicy DeserializeContainerAppDefaultAuthorizationPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional allowedPrincipals = default; Optional> allowedApplications = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowedPrincipals"u8)) @@ -67,8 +96,61 @@ internal static ContainerAppDefaultAuthorizationPolicy DeserializeContainerAppDe allowedApplications = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDefaultAuthorizationPolicy(allowedPrincipals.Value, Optional.ToList(allowedApplications), serializedAdditionalRawData); + } + + ContainerAppDefaultAuthorizationPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDefaultAuthorizationPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDefaultAuthorizationPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDefaultAuthorizationPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDefaultAuthorizationPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDefaultAuthorizationPolicy(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppDefaultAuthorizationPolicy(allowedPrincipals.Value, Optional.ToList(allowedApplications)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDefaultAuthorizationPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.cs index f3e5b3381690..1a58b42ab68c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDefaultAuthorizationPolicy.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Azure Active Directory default authorization policy. public partial class ContainerAppDefaultAuthorizationPolicy { - /// Initializes a new instance of ContainerAppDefaultAuthorizationPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDefaultAuthorizationPolicy() { AllowedApplications = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppDefaultAuthorizationPolicy. + /// Initializes a new instance of . /// The configuration settings of the Azure Active Directory allowed principals. /// The configuration settings of the Azure Active Directory allowed applications. - internal ContainerAppDefaultAuthorizationPolicy(ContainerAppAllowedPrincipals allowedPrincipals, IList allowedApplications) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDefaultAuthorizationPolicy(ContainerAppAllowedPrincipals allowedPrincipals, IList allowedApplications, Dictionary serializedAdditionalRawData) { AllowedPrincipals = allowedPrincipals; AllowedApplications = allowedApplications; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The configuration settings of the Azure Active Directory allowed principals. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticData.Serialization.cs index a7bedea604e0..57d2fdb72217 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppDiagnosticData : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticData DeserializeContainerAppDiagnosticData(JsonElement element) + internal static ContainerAppDiagnosticData DeserializeContainerAppDiagnosticData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static ContainerAppDiagnosticData DeserializeContainerAppDiagnosticData string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static ContainerAppDiagnosticData DeserializeContainerAppDiagnosticData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ContainerAppDiagnosticData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppDiagnosticData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.Serialization.cs index c5ad2ab12b57..260b4f3f78f3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticDataColumn : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticDataColumn : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ColumnName)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("columnType"u8); writer.WriteStringValue(ColumnType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticDataColumn DeserializeContainerAppDiagnosticDataColumn(JsonElement element) + internal static ContainerAppDiagnosticDataColumn DeserializeContainerAppDiagnosticDataColumn(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppDiagnosticDataColumn DeserializeContainerAppDiagnost Optional columnName = default; Optional dataType = default; Optional columnType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("columnName"u8)) @@ -59,8 +82,61 @@ internal static ContainerAppDiagnosticDataColumn DeserializeContainerAppDiagnost columnType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticDataColumn(columnName.Value, dataType.Value, columnType.Value, serializedAdditionalRawData); + } + + ContainerAppDiagnosticDataColumn IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticDataColumn(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticDataColumn IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticDataColumn(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticDataColumn model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticDataColumn(columnName.Value, dataType.Value, columnType.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticDataColumn(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticDataColumn(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.cs index 64771151ebd4..e8e13f72b890 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataColumn.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Diagnostics data column. public partial class ContainerAppDiagnosticDataColumn { - /// Initializes a new instance of ContainerAppDiagnosticDataColumn. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticDataColumn() { } - /// Initializes a new instance of ContainerAppDiagnosticDataColumn. + /// Initializes a new instance of . /// Column name. /// Data type of the column. /// Column type. - internal ContainerAppDiagnosticDataColumn(string columnName, string dataType, string columnType) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticDataColumn(string columnName, string dataType, string columnType, Dictionary serializedAdditionalRawData) { ColumnName = columnName; DataType = dataType; ColumnType = columnType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Column name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.Serialization.cs index aa9a2a16bdf1..2e3b40877c73 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticDataProviderMetadata : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticDataProviderMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProviderName)) { @@ -27,21 +34,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PropertyBag) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticDataProviderMetadata DeserializeContainerAppDiagnosticDataProviderMetadata(JsonElement element) + internal static ContainerAppDiagnosticDataProviderMetadata DeserializeContainerAppDiagnosticDataProviderMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional providerName = default; Optional> propertyBag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("providerName"u8)) @@ -63,8 +92,61 @@ internal static ContainerAppDiagnosticDataProviderMetadata DeserializeContainerA propertyBag = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticDataProviderMetadata(providerName.Value, Optional.ToList(propertyBag), serializedAdditionalRawData); + } + + ContainerAppDiagnosticDataProviderMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticDataProviderMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticDataProviderMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticDataProviderMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticDataProviderMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticDataProviderMetadata(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppDiagnosticDataProviderMetadata(providerName.Value, Optional.ToList(propertyBag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticDataProviderMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.cs index 4c2543814f94..94519f42987f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadata.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppContainers.Models /// Details of a diagnostics data provider. public partial class ContainerAppDiagnosticDataProviderMetadata { - /// Initializes a new instance of ContainerAppDiagnosticDataProviderMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticDataProviderMetadata() { PropertyBag = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppDiagnosticDataProviderMetadata. + /// Initializes a new instance of . /// Name of data provider. /// Collection of properties. - internal ContainerAppDiagnosticDataProviderMetadata(string providerName, IList propertyBag) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticDataProviderMetadata(string providerName, IList propertyBag, Dictionary serializedAdditionalRawData) { ProviderName = providerName; PropertyBag = propertyBag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of data provider. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.Serialization.cs index c9bba8e8d325..a02c8b02974a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticDataProviderMetadataPropertyBagItem : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticDataProviderMetadataPropertyBagItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticDataProviderMetadataPropertyBagItem DeserializeContainerAppDiagnosticDataProviderMetadataPropertyBagItem(JsonElement element) + internal static ContainerAppDiagnosticDataProviderMetadataPropertyBagItem DeserializeContainerAppDiagnosticDataProviderMetadataPropertyBagItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppDiagnosticDataProviderMetadataPropertyBagItem Deseri value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticDataProviderMetadataPropertyBagItem(name.Value, value.Value, serializedAdditionalRawData); + } + + ContainerAppDiagnosticDataProviderMetadataPropertyBagItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticDataProviderMetadataPropertyBagItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticDataProviderMetadataPropertyBagItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticDataProviderMetadataPropertyBagItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticDataProviderMetadataPropertyBagItem model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticDataProviderMetadataPropertyBagItem(name.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticDataProviderMetadataPropertyBagItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticDataProviderMetadataPropertyBagItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.cs index bab5506e567e..02a9090a0840 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataProviderMetadataPropertyBagItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Property details. public partial class ContainerAppDiagnosticDataProviderMetadataPropertyBagItem { - /// Initializes a new instance of ContainerAppDiagnosticDataProviderMetadataPropertyBagItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticDataProviderMetadataPropertyBagItem() { } - /// Initializes a new instance of ContainerAppDiagnosticDataProviderMetadataPropertyBagItem. + /// Initializes a new instance of . /// Property name. /// Property value. - internal ContainerAppDiagnosticDataProviderMetadataPropertyBagItem(string name, string value) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticDataProviderMetadataPropertyBagItem(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Property name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.Serialization.cs index 3011ddb2ebc5..6362ae6033bb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticDataTableResult : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticDataTableResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TableName)) { @@ -28,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Columns) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -51,11 +64,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticDataTableResult DeserializeContainerAppDiagnosticDataTableResult(JsonElement element) + internal static ContainerAppDiagnosticDataTableResult DeserializeContainerAppDiagnosticDataTableResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +90,7 @@ internal static ContainerAppDiagnosticDataTableResult DeserializeContainerAppDia Optional tableName = default; Optional> columns = default; Optional> rows = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tableName"u8)) @@ -105,8 +133,61 @@ internal static ContainerAppDiagnosticDataTableResult DeserializeContainerAppDia rows = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticDataTableResult(tableName.Value, Optional.ToList(columns), Optional.ToList(rows), serializedAdditionalRawData); + } + + ContainerAppDiagnosticDataTableResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticDataTableResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticDataTableResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticDataTableResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticDataTableResult model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticDataTableResult(tableName.Value, Optional.ToList(columns), Optional.ToList(rows)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticDataTableResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticDataTableResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.cs index 9145c5e9b41f..6b725cf7506d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticDataTableResult.cs @@ -14,22 +14,27 @@ namespace Azure.ResourceManager.AppContainers.Models /// Diagnostics data table. public partial class ContainerAppDiagnosticDataTableResult { - /// Initializes a new instance of ContainerAppDiagnosticDataTableResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticDataTableResult() { Columns = new ChangeTrackingList(); Rows = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppDiagnosticDataTableResult. + /// Initializes a new instance of . /// Table name. /// Columns in the table. /// Rows in the table. - internal ContainerAppDiagnosticDataTableResult(string tableName, IList columns, IList rows) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticDataTableResult(string tableName, IList columns, IList rows, Dictionary serializedAdditionalRawData) { TableName = tableName; Columns = columns; Rows = rows; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Table name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.Serialization.cs index a8e9a89b139f..db3128bbc49b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticRendering : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticRendering : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiagnosticRenderingType)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isVisible"u8); writer.WriteBooleanValue(IsVisible.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticRendering DeserializeContainerAppDiagnosticRendering(JsonElement element) + internal static ContainerAppDiagnosticRendering DeserializeContainerAppDiagnosticRendering(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerAppDiagnosticRendering DeserializeContainerAppDiagnosti Optional title = default; Optional description = default; Optional isVisible = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -78,8 +101,61 @@ internal static ContainerAppDiagnosticRendering DeserializeContainerAppDiagnosti isVisible = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticRendering(Optional.ToNullable(type), title.Value, description.Value, Optional.ToNullable(isVisible), serializedAdditionalRawData); + } + + ContainerAppDiagnosticRendering IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticRendering(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticRendering IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticRendering(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticRendering model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticRendering(Optional.ToNullable(type), title.Value, description.Value, Optional.ToNullable(isVisible)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticRendering(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticRendering(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.cs index c349d4a67764..14a1f4b4b296 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticRendering.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Rendering details of a diagnostics table. public partial class ContainerAppDiagnosticRendering { - /// Initializes a new instance of ContainerAppDiagnosticRendering. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticRendering() { } - /// Initializes a new instance of ContainerAppDiagnosticRendering. + /// Initializes a new instance of . /// Rendering type. /// Title of the table. /// Description of the table. /// Flag if the table should be rendered. - internal ContainerAppDiagnosticRendering(int? diagnosticRenderingType, string title, string description, bool? isVisible) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticRendering(int? diagnosticRenderingType, string title, string description, bool? isVisible, Dictionary serializedAdditionalRawData) { DiagnosticRenderingType = diagnosticRenderingType; Title = title; Description = description; IsVisible = isVisible; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Rendering type. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.Serialization.cs index 19c9b789f34c..3cac44099316 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.Serialization.cs @@ -5,27 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticSupportTopic : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticSupportTopic : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticSupportTopic DeserializeContainerAppDiagnosticSupportTopic(JsonElement element) + internal static ContainerAppDiagnosticSupportTopic DeserializeContainerAppDiagnosticSupportTopic(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional pesId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -38,8 +61,61 @@ internal static ContainerAppDiagnosticSupportTopic DeserializeContainerAppDiagno pesId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticSupportTopic(id.Value, pesId.Value, serializedAdditionalRawData); + } + + ContainerAppDiagnosticSupportTopic IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticSupportTopic(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticSupportTopic IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticSupportTopic(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticSupportTopic model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticSupportTopic(id.Value, pesId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticSupportTopic(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticSupportTopic(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.cs index eba5997720b7..8579e2077290 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticSupportTopic.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Support topic information. public partial class ContainerAppDiagnosticSupportTopic { - /// Initializes a new instance of ContainerAppDiagnosticSupportTopic. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticSupportTopic() { } - /// Initializes a new instance of ContainerAppDiagnosticSupportTopic. + /// Initializes a new instance of . /// Unique topic identifier. /// PES identifier. - internal ContainerAppDiagnosticSupportTopic(string id, string pesId) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticSupportTopic(string id, string pesId, Dictionary serializedAdditionalRawData) { Id = id; PesId = pesId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Unique topic identifier. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.Serialization.cs index b0f92a48d58d..24a03cd103c1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticsDataApiResult : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticsDataApiResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Table)) { writer.WritePropertyName("table"u8); - writer.WriteObjectValue(Table); + if (Table is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Table).Serialize(writer, options); + } } if (Optional.IsDefined(RenderingProperties)) { writer.WritePropertyName("renderingProperties"u8); - writer.WriteObjectValue(RenderingProperties); + if (RenderingProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RenderingProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticsDataApiResult DeserializeContainerAppDiagnosticsDataApiResult(JsonElement element) + internal static ContainerAppDiagnosticsDataApiResult DeserializeContainerAppDiagnosticsDataApiResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional table = default; Optional renderingProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("table"u8)) @@ -56,8 +93,61 @@ internal static ContainerAppDiagnosticsDataApiResult DeserializeContainerAppDiag renderingProperties = ContainerAppDiagnosticRendering.DeserializeContainerAppDiagnosticRendering(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticsDataApiResult(table.Value, renderingProperties.Value, serializedAdditionalRawData); + } + + ContainerAppDiagnosticsDataApiResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticsDataApiResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticsDataApiResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticsDataApiResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticsDataApiResult model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticsDataApiResult(table.Value, renderingProperties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticsDataApiResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticsDataApiResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.cs index 03ce1bfea073..5d65fb50b6c8 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsDataApiResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Diagnostics data returned from a detector. public partial class ContainerAppDiagnosticsDataApiResult { - /// Initializes a new instance of ContainerAppDiagnosticsDataApiResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticsDataApiResult() { } - /// Initializes a new instance of ContainerAppDiagnosticsDataApiResult. + /// Initializes a new instance of . /// Table response. /// Details of the table response. - internal ContainerAppDiagnosticsDataApiResult(ContainerAppDiagnosticDataTableResult table, ContainerAppDiagnosticRendering renderingProperties) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticsDataApiResult(ContainerAppDiagnosticDataTableResult table, ContainerAppDiagnosticRendering renderingProperties, Dictionary serializedAdditionalRawData) { Table = table; RenderingProperties = renderingProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Table response. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.Serialization.cs index 8b009a3b3ea8..df7830682d14 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticsMetadata : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticsMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(SupportTopicList)) { @@ -23,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SupportTopicList) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticsMetadata DeserializeContainerAppDiagnosticsMetadata(JsonElement element) + internal static ContainerAppDiagnosticsMetadata DeserializeContainerAppDiagnosticsMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +84,7 @@ internal static ContainerAppDiagnosticsMetadata DeserializeContainerAppDiagnosti string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description"u8)) @@ -134,8 +163,61 @@ internal static ContainerAppDiagnosticsMetadata DeserializeContainerAppDiagnosti systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticsMetadata(id, name, type, systemData.Value, description.Value, author.Value, category.Value, Optional.ToList(supportTopicList), Optional.ToList(analysisTypes), Optional.ToNullable(score), serializedAdditionalRawData); + } + + ContainerAppDiagnosticsMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticsMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticsMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticsMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticsMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticsMetadata(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppDiagnosticsMetadata(id, name, type, systemData.Value, description.Value, author.Value, category.Value, Optional.ToList(supportTopicList), Optional.ToList(analysisTypes), Optional.ToNullable(score)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticsMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.cs index 3f07620309cf..01ca2c61c329 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsMetadata.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,14 +15,17 @@ namespace Azure.ResourceManager.AppContainers.Models /// Metadata of the diagnostics response. public partial class ContainerAppDiagnosticsMetadata : ResourceData { - /// Initializes a new instance of ContainerAppDiagnosticsMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticsMetadata() { SupportTopicList = new ChangeTrackingList(); AnalysisTypes = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppDiagnosticsMetadata. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,7 +36,8 @@ public ContainerAppDiagnosticsMetadata() /// List of support topics. /// List of analysis types. /// Authors' names of the detector. - internal ContainerAppDiagnosticsMetadata(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string author, string category, IList supportTopicList, IList analysisTypes, float? score) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticsMetadata(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string author, string category, IList supportTopicList, IList analysisTypes, float? score, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; Author = author; @@ -40,6 +45,7 @@ internal ContainerAppDiagnosticsMetadata(ResourceIdentifier id, string name, Res SupportTopicList = supportTopicList; AnalysisTypes = analysisTypes; Score = score; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Details of the diagnostics info. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.Serialization.cs index bfe5771fa9d8..8e4321577b47 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticsProperties : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Metadata)) { writer.WritePropertyName("metadata"u8); - writer.WriteObjectValue(Metadata); + if (Metadata is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Metadata).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Dataset)) { @@ -27,25 +41,60 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Dataset) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); - writer.WriteObjectValue(Status); + if (Status is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Status).Serialize(writer, options); + } } if (Optional.IsDefined(DataProviderMetadata)) { writer.WritePropertyName("dataProviderMetadata"u8); - writer.WriteObjectValue(DataProviderMetadata); + if (DataProviderMetadata is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataProviderMetadata).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticsProperties DeserializeContainerAppDiagnosticsProperties(JsonElement element) + internal static ContainerAppDiagnosticsProperties DeserializeContainerAppDiagnosticsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +103,7 @@ internal static ContainerAppDiagnosticsProperties DeserializeContainerAppDiagnos Optional> dataset = default; Optional status = default; Optional dataProviderMetadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metadata"u8)) @@ -97,8 +147,61 @@ internal static ContainerAppDiagnosticsProperties DeserializeContainerAppDiagnos dataProviderMetadata = ContainerAppDiagnosticDataProviderMetadata.DeserializeContainerAppDiagnosticDataProviderMetadata(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppDiagnosticsProperties(metadata.Value, Optional.ToList(dataset), status.Value, dataProviderMetadata.Value); + return new ContainerAppDiagnosticsProperties(metadata.Value, Optional.ToList(dataset), status.Value, dataProviderMetadata.Value, serializedAdditionalRawData); + } + + ContainerAppDiagnosticsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticsProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.cs index 30815e61c98a..d6131f70d491 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppContainers.Models /// Diagnostics resource specific properties. public partial class ContainerAppDiagnosticsProperties { - /// Initializes a new instance of ContainerAppDiagnosticsProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticsProperties() { Dataset = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppDiagnosticsProperties. + /// Initializes a new instance of . /// Metadata of the diagnostics response. /// Set of data collections associated with the response. /// Status of the diagnostics response. /// List of data providers' metadata. - internal ContainerAppDiagnosticsProperties(ContainerAppDiagnosticsMetadata metadata, IList dataset, ContainerAppDiagnosticsStatus status, ContainerAppDiagnosticDataProviderMetadata dataProviderMetadata) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticsProperties(ContainerAppDiagnosticsMetadata metadata, IList dataset, ContainerAppDiagnosticsStatus status, ContainerAppDiagnosticDataProviderMetadata dataProviderMetadata, Dictionary serializedAdditionalRawData) { Metadata = metadata; Dataset = dataset; Status = status; DataProviderMetadata = dataProviderMetadata; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Metadata of the diagnostics response. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.Serialization.cs index a5fdb6c276ba..665c1a703574 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppDiagnosticsStatus : IUtf8JsonSerializable + public partial class ContainerAppDiagnosticsStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Message)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("statusId"u8); writer.WriteNumberValue(StatusId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppDiagnosticsStatus DeserializeContainerAppDiagnosticsStatus(JsonElement element) + internal static ContainerAppDiagnosticsStatus DeserializeContainerAppDiagnosticsStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional message = default; Optional statusId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("message"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppDiagnosticsStatus DeserializeContainerAppDiagnostics statusId = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppDiagnosticsStatus(message.Value, Optional.ToNullable(statusId), serializedAdditionalRawData); + } + + ContainerAppDiagnosticsStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppDiagnosticsStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppDiagnosticsStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppDiagnosticsStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppDiagnosticsStatus model) + { + if (model is null) + { + return null; } - return new ContainerAppDiagnosticsStatus(message.Value, Optional.ToNullable(statusId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppDiagnosticsStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppDiagnosticsStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.cs index 596dd6e6c203..a6033a6a0e08 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppDiagnosticsStatus.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Rendering details of a diagnostics table. public partial class ContainerAppDiagnosticsStatus { - /// Initializes a new instance of ContainerAppDiagnosticsStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppDiagnosticsStatus() { } - /// Initializes a new instance of ContainerAppDiagnosticsStatus. + /// Initializes a new instance of . /// Diagnostic message. /// Status. - internal ContainerAppDiagnosticsStatus(string message, int? statusId) + /// Keeps track of any properties unknown to the library. + internal ContainerAppDiagnosticsStatus(string message, int? statusId, Dictionary serializedAdditionalRawData) { Message = message; StatusId = statusId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Diagnostic message. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.Serialization.cs index c46e4cea26e2..014eead558e0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppEnvironmentAuthToken : IUtf8JsonSerializable + public partial class ContainerAppEnvironmentAuthToken : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppEnvironmentAuthToken DeserializeContainerAppEnvironmentAuthToken(JsonElement element) + internal static ContainerAppEnvironmentAuthToken DeserializeContainerAppEnvironmentAuthToken(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +71,7 @@ internal static ContainerAppEnvironmentAuthToken DeserializeContainerAppEnvironm Optional systemData = default; Optional token = default; Optional expires = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -122,8 +143,61 @@ internal static ContainerAppEnvironmentAuthToken DeserializeContainerAppEnvironm } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppEnvironmentAuthToken(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, token.Value, Optional.ToNullable(expires), serializedAdditionalRawData); + } + + ContainerAppEnvironmentAuthToken IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppEnvironmentAuthToken(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppEnvironmentAuthToken IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppEnvironmentAuthToken(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppEnvironmentAuthToken model) + { + if (model is null) + { + return null; } - return new ContainerAppEnvironmentAuthToken(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, token.Value, Optional.ToNullable(expires)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppEnvironmentAuthToken(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppEnvironmentAuthToken(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.cs index 323e735e5bd6..a6cf41a00439 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentAuthToken.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// Environment Auth Token. public partial class ContainerAppEnvironmentAuthToken : TrackedResourceData { - /// Initializes a new instance of ContainerAppEnvironmentAuthToken. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerAppEnvironmentAuthToken(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerAppEnvironmentAuthToken. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,10 +33,17 @@ public ContainerAppEnvironmentAuthToken(AzureLocation location) : base(location) /// The location. /// Auth token value. /// Token expiration date. - internal ContainerAppEnvironmentAuthToken(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string token, DateTimeOffset? expireOn) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerAppEnvironmentAuthToken(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string token, DateTimeOffset? expireOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Token = token; ExpireOn = expireOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppEnvironmentAuthToken() + { } /// Auth token value. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.Serialization.cs index ebcb870835b7..13f6f59ae4b1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppEnvironmentVariable : IUtf8JsonSerializable + public partial class ContainerAppEnvironmentVariable : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secretRef"u8); writer.WriteStringValue(SecretRef); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppEnvironmentVariable DeserializeContainerAppEnvironmentVariable(JsonElement element) + internal static ContainerAppEnvironmentVariable DeserializeContainerAppEnvironmentVariable(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppEnvironmentVariable DeserializeContainerAppEnvironme Optional name = default; Optional value = default; Optional secretRef = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +82,61 @@ internal static ContainerAppEnvironmentVariable DeserializeContainerAppEnvironme secretRef = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppEnvironmentVariable(name.Value, value.Value, secretRef.Value, serializedAdditionalRawData); + } + + ContainerAppEnvironmentVariable IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppEnvironmentVariable(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppEnvironmentVariable IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppEnvironmentVariable(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppEnvironmentVariable model) + { + if (model is null) + { + return null; } - return new ContainerAppEnvironmentVariable(name.Value, value.Value, secretRef.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppEnvironmentVariable(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppEnvironmentVariable(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.cs index fa5f769a8416..e4756f538043 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppEnvironmentVariable.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App container environment variable. public partial class ContainerAppEnvironmentVariable { - /// Initializes a new instance of ContainerAppEnvironmentVariable. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppEnvironmentVariable() { } - /// Initializes a new instance of ContainerAppEnvironmentVariable. + /// Initializes a new instance of . /// Environment variable name. /// Non-secret environment variable value. /// Name of the Container App secret from which to pull the environment variable value. - internal ContainerAppEnvironmentVariable(string name, string value, string secretRef) + /// Keeps track of any properties unknown to the library. + internal ContainerAppEnvironmentVariable(string name, string value, string secretRef, Dictionary serializedAdditionalRawData) { Name = name; Value = value; SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Environment variable name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.Serialization.cs index 7392ef83f1bf..166714144e91 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppExtendedLocation : IUtf8JsonSerializable + public partial class ContainerAppExtendedLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ExtendedLocationType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppExtendedLocation DeserializeContainerAppExtendedLocation(JsonElement element) + internal static ContainerAppExtendedLocation DeserializeContainerAppExtendedLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppExtendedLocation DeserializeContainerAppExtendedLoca type = new ContainerAppExtendedLocationType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppExtendedLocation(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + ContainerAppExtendedLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppExtendedLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppExtendedLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppExtendedLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppExtendedLocation model) + { + if (model is null) + { + return null; } - return new ContainerAppExtendedLocation(name.Value, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppExtendedLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppExtendedLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.cs index 713ed1e00127..5d86d08ba303 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppExtendedLocation.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The complex type of the extended location. public partial class ContainerAppExtendedLocation { - /// Initializes a new instance of ContainerAppExtendedLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppExtendedLocation() { } - /// Initializes a new instance of ContainerAppExtendedLocation. + /// Initializes a new instance of . /// The name of the extended location. /// The type of the extended location. - internal ContainerAppExtendedLocation(string name, ContainerAppExtendedLocationType? extendedLocationType) + /// Keeps track of any properties unknown to the library. + internal ContainerAppExtendedLocation(string name, ContainerAppExtendedLocationType? extendedLocationType, Dictionary serializedAdditionalRawData) { Name = name; ExtendedLocationType = extendedLocationType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the extended location. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.Serialization.cs index c8841bf34631..644a11960b1c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppFacebookConfiguration : IUtf8JsonSerializable + public partial class ContainerAppFacebookConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } } if (Optional.IsDefined(GraphApiVersion)) { @@ -33,13 +48,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppFacebookConfiguration DeserializeContainerAppFacebookConfiguration(JsonElement element) + internal static ContainerAppFacebookConfiguration DeserializeContainerAppFacebookConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +84,7 @@ internal static ContainerAppFacebookConfiguration DeserializeContainerAppFaceboo Optional registration = default; Optional graphApiVersion = default; Optional login = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -82,8 +119,61 @@ internal static ContainerAppFacebookConfiguration DeserializeContainerAppFaceboo login = Models.LoginScopes.DeserializeLoginScopes(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppFacebookConfiguration(Optional.ToNullable(enabled), registration.Value, graphApiVersion.Value, login.Value, serializedAdditionalRawData); + } + + ContainerAppFacebookConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppFacebookConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppFacebookConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppFacebookConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppFacebookConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppFacebookConfiguration(Optional.ToNullable(enabled), registration.Value, graphApiVersion.Value, login.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppFacebookConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppFacebookConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.cs index 916194c5763e..6d3f7c4d5b6a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppFacebookConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models @@ -12,22 +13,27 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Facebook provider. public partial class ContainerAppFacebookConfiguration { - /// Initializes a new instance of ContainerAppFacebookConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppFacebookConfiguration() { } - /// Initializes a new instance of ContainerAppFacebookConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the Facebook provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the app registration for the Facebook provider. /// The version of the Facebook api to be used while logging in. /// The configuration settings of the login flow. - internal ContainerAppFacebookConfiguration(bool? isEnabled, ContainerAppRegistration registration, string graphApiVersion, LoginScopes login) + /// Keeps track of any properties unknown to the library. + internal ContainerAppFacebookConfiguration(bool? isEnabled, ContainerAppRegistration registration, string graphApiVersion, LoginScopes login, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; GraphApiVersion = graphApiVersion; Login = login; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the Facebook provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.Serialization.cs index d6359a21ef68..baa6de9c75c0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppForwardProxy : IUtf8JsonSerializable + public partial class ContainerAppForwardProxy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Convention)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("customProtoHeaderName"u8); writer.WriteStringValue(CustomProtoHeaderName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppForwardProxy DeserializeContainerAppForwardProxy(JsonElement element) + internal static ContainerAppForwardProxy DeserializeContainerAppForwardProxy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppForwardProxy DeserializeContainerAppForwardProxy(Jso Optional convention = default; Optional customHostHeaderName = default; Optional customProtoHeaderName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("convention"u8)) @@ -63,8 +86,61 @@ internal static ContainerAppForwardProxy DeserializeContainerAppForwardProxy(Jso customProtoHeaderName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppForwardProxy(Optional.ToNullable(convention), customHostHeaderName.Value, customProtoHeaderName.Value, serializedAdditionalRawData); + } + + ContainerAppForwardProxy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppForwardProxy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppForwardProxy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppForwardProxy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppForwardProxy model) + { + if (model is null) + { + return null; } - return new ContainerAppForwardProxy(Optional.ToNullable(convention), customHostHeaderName.Value, customProtoHeaderName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppForwardProxy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppForwardProxy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.cs index 8d36d1caa70b..3c4c89426bdd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppForwardProxy.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of a forward proxy used to make the requests. public partial class ContainerAppForwardProxy { - /// Initializes a new instance of ContainerAppForwardProxy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppForwardProxy() { } - /// Initializes a new instance of ContainerAppForwardProxy. + /// Initializes a new instance of . /// The convention used to determine the url of the request made. /// The name of the header containing the host of the request. /// The name of the header containing the scheme of the request. - internal ContainerAppForwardProxy(ContainerAppForwardProxyConvention? convention, string customHostHeaderName, string customProtoHeaderName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppForwardProxy(ContainerAppForwardProxyConvention? convention, string customHostHeaderName, string customProtoHeaderName, Dictionary serializedAdditionalRawData) { Convention = convention; CustomHostHeaderName = customHostHeaderName; CustomProtoHeaderName = customProtoHeaderName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The convention used to determine the url of the request made. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.Serialization.cs index 9c943b2bde27..3443b834249d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppGitHubActionConfiguration : IUtf8JsonSerializable + public partial class ContainerAppGitHubActionConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RegistryInfo)) { writer.WritePropertyName("registryInfo"u8); - writer.WriteObjectValue(RegistryInfo); + if (RegistryInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RegistryInfo).Serialize(writer, options); + } } if (Optional.IsDefined(AzureCredentials)) { writer.WritePropertyName("azureCredentials"u8); - writer.WriteObjectValue(AzureCredentials); + if (AzureCredentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureCredentials).Serialize(writer, options); + } } if (Optional.IsDefined(ContextPath)) { @@ -60,11 +82,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("runtimeVersion"u8); writer.WriteStringValue(RuntimeVersion); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppGitHubActionConfiguration DeserializeContainerAppGitHubActionConfiguration(JsonElement element) + internal static ContainerAppGitHubActionConfiguration DeserializeContainerAppGitHubActionConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +114,7 @@ internal static ContainerAppGitHubActionConfiguration DeserializeContainerAppGit Optional os = default; Optional runtimeStack = default; Optional runtimeVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registryInfo"u8)) @@ -133,8 +170,61 @@ internal static ContainerAppGitHubActionConfiguration DeserializeContainerAppGit runtimeVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppGitHubActionConfiguration(registryInfo.Value, azureCredentials.Value, contextPath.Value, gitHubPersonalAccessToken.Value, image.Value, publishType.Value, os.Value, runtimeStack.Value, runtimeVersion.Value, serializedAdditionalRawData); + } + + ContainerAppGitHubActionConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppGitHubActionConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppGitHubActionConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppGitHubActionConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppGitHubActionConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppGitHubActionConfiguration(registryInfo.Value, azureCredentials.Value, contextPath.Value, gitHubPersonalAccessToken.Value, image.Value, publishType.Value, os.Value, runtimeStack.Value, runtimeVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppGitHubActionConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppGitHubActionConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.cs index cfee2f7f44d6..1336a8e35183 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubActionConfiguration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Configuration properties that define the mutable settings of a Container App SourceControl. public partial class ContainerAppGitHubActionConfiguration { - /// Initializes a new instance of ContainerAppGitHubActionConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppGitHubActionConfiguration() { } - /// Initializes a new instance of ContainerAppGitHubActionConfiguration. + /// Initializes a new instance of . /// Registry configurations. /// AzureCredentials configurations. /// Context path. @@ -25,7 +31,8 @@ public ContainerAppGitHubActionConfiguration() /// Operation system. /// Runtime stack. /// Runtime version. - internal ContainerAppGitHubActionConfiguration(ContainerAppRegistryInfo registryInfo, ContainerAppCredentials azureCredentials, string contextPath, string gitHubPersonalAccessToken, string image, string publishType, string os, string runtimeStack, string runtimeVersion) + /// Keeps track of any properties unknown to the library. + internal ContainerAppGitHubActionConfiguration(ContainerAppRegistryInfo registryInfo, ContainerAppCredentials azureCredentials, string contextPath, string gitHubPersonalAccessToken, string image, string publishType, string os, string runtimeStack, string runtimeVersion, Dictionary serializedAdditionalRawData) { RegistryInfo = registryInfo; AzureCredentials = azureCredentials; @@ -36,6 +43,7 @@ internal ContainerAppGitHubActionConfiguration(ContainerAppRegistryInfo registry OS = os; RuntimeStack = runtimeStack; RuntimeVersion = runtimeVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Registry configurations. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.Serialization.cs index 3ecc06043fbc..e5ac9b6ad446 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppGitHubConfiguration : IUtf8JsonSerializable + public partial class ContainerAppGitHubConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } } if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppGitHubConfiguration DeserializeContainerAppGitHubConfiguration(JsonElement element) + internal static ContainerAppGitHubConfiguration DeserializeContainerAppGitHubConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static ContainerAppGitHubConfiguration DeserializeContainerAppGitHubCon Optional enabled = default; Optional registration = default; Optional login = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -71,8 +108,61 @@ internal static ContainerAppGitHubConfiguration DeserializeContainerAppGitHubCon login = Models.LoginScopes.DeserializeLoginScopes(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppGitHubConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, serializedAdditionalRawData); + } + + ContainerAppGitHubConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppGitHubConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppGitHubConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppGitHubConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppGitHubConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppGitHubConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppGitHubConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppGitHubConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.cs index e7c9c246c8c9..49187d0035d2 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGitHubConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models @@ -12,20 +13,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the GitHub provider. public partial class ContainerAppGitHubConfiguration { - /// Initializes a new instance of ContainerAppGitHubConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppGitHubConfiguration() { } - /// Initializes a new instance of ContainerAppGitHubConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the GitHub provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the app registration for the GitHub provider. /// The configuration settings of the login flow. - internal ContainerAppGitHubConfiguration(bool? isEnabled, ContainerAppClientRegistration registration, LoginScopes login) + /// Keeps track of any properties unknown to the library. + internal ContainerAppGitHubConfiguration(bool? isEnabled, ContainerAppClientRegistration registration, LoginScopes login, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; Login = login; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the GitHub provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.Serialization.cs index a4986826dcee..3d26eacd3c04 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppGlobalValidation : IUtf8JsonSerializable + public partial class ContainerAppGlobalValidation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UnauthenticatedClientAction)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppGlobalValidation DeserializeContainerAppGlobalValidation(JsonElement element) + internal static ContainerAppGlobalValidation DeserializeContainerAppGlobalValidation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static ContainerAppGlobalValidation DeserializeContainerAppGlobalValida Optional unauthenticatedClientAction = default; Optional redirectToProvider = default; Optional> excludedPaths = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("unauthenticatedClientAction"u8)) @@ -78,8 +100,61 @@ internal static ContainerAppGlobalValidation DeserializeContainerAppGlobalValida excludedPaths = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppGlobalValidation(Optional.ToNullable(unauthenticatedClientAction), redirectToProvider.Value, Optional.ToList(excludedPaths), serializedAdditionalRawData); + } + + ContainerAppGlobalValidation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppGlobalValidation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppGlobalValidation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppGlobalValidation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppGlobalValidation model) + { + if (model is null) + { + return null; } - return new ContainerAppGlobalValidation(Optional.ToNullable(unauthenticatedClientAction), redirectToProvider.Value, Optional.ToList(excludedPaths)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppGlobalValidation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppGlobalValidation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.cs index a9458957d368..2b02915ec0ad 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGlobalValidation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings that determines the validation flow of users using ContainerApp Service Authentication/Authorization. public partial class ContainerAppGlobalValidation { - /// Initializes a new instance of ContainerAppGlobalValidation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppGlobalValidation() { ExcludedPaths = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppGlobalValidation. + /// Initializes a new instance of . /// The action to take when an unauthenticated client attempts to access the app. /// /// The default authentication provider to use when multiple providers are configured. @@ -27,11 +31,13 @@ public ContainerAppGlobalValidation() /// action is set to "RedirectToLoginPage". /// /// The paths for which unauthenticated flow would not be redirected to the login page. - internal ContainerAppGlobalValidation(ContainerAppUnauthenticatedClientActionV2? unauthenticatedClientAction, string redirectToProvider, IList excludedPaths) + /// Keeps track of any properties unknown to the library. + internal ContainerAppGlobalValidation(ContainerAppUnauthenticatedClientActionV2? unauthenticatedClientAction, string redirectToProvider, IList excludedPaths, Dictionary serializedAdditionalRawData) { UnauthenticatedClientAction = unauthenticatedClientAction; RedirectToProvider = redirectToProvider; ExcludedPaths = excludedPaths; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The action to take when an unauthenticated client attempts to access the app. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.Serialization.cs index 65398b9e9252..66f31306206f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppGoogleConfiguration : IUtf8JsonSerializable + public partial class ContainerAppGoogleConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,23 +31,58 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } } if (Optional.IsDefined(Login)) { writer.WritePropertyName("login"u8); - writer.WriteObjectValue(Login); + if (Login is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Login).Serialize(writer, options); + } } if (Optional.IsDefined(Validation)) { writer.WritePropertyName("validation"u8); - writer.WriteObjectValue(Validation); + if (Validation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Validation).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppGoogleConfiguration DeserializeContainerAppGoogleConfiguration(JsonElement element) + internal static ContainerAppGoogleConfiguration DeserializeContainerAppGoogleConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +91,7 @@ internal static ContainerAppGoogleConfiguration DeserializeContainerAppGoogleCon Optional registration = default; Optional login = default; Optional validation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -86,8 +130,61 @@ internal static ContainerAppGoogleConfiguration DeserializeContainerAppGoogleCon validation = AllowedAudiencesValidation.DeserializeAllowedAudiencesValidation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppGoogleConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, validation.Value, serializedAdditionalRawData); + } + + ContainerAppGoogleConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppGoogleConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppGoogleConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppGoogleConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppGoogleConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppGoogleConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppGoogleConfiguration(Optional.ToNullable(enabled), registration.Value, login.Value, validation.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppGoogleConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.cs index 6532c364ad00..26c044705567 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppGoogleConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models @@ -12,22 +13,27 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the Google provider. public partial class ContainerAppGoogleConfiguration { - /// Initializes a new instance of ContainerAppGoogleConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppGoogleConfiguration() { } - /// Initializes a new instance of ContainerAppGoogleConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the Google provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the app registration for the Google provider. /// The configuration settings of the login flow. /// The configuration settings of the Azure Active Directory token validation flow. - internal ContainerAppGoogleConfiguration(bool? isEnabled, ContainerAppClientRegistration registration, LoginScopes login, AllowedAudiencesValidation validation) + /// Keeps track of any properties unknown to the library. + internal ContainerAppGoogleConfiguration(bool? isEnabled, ContainerAppClientRegistration registration, LoginScopes login, AllowedAudiencesValidation validation, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; Login = login; Validation = validation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the Google provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.Serialization.cs index 46a0ea69aefa..6002023b5722 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppHttpHeaderInfo : IUtf8JsonSerializable + public partial class ContainerAppHttpHeaderInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppHttpHeaderInfo DeserializeContainerAppHttpHeaderInfo(JsonElement element) + internal static ContainerAppHttpHeaderInfo DeserializeContainerAppHttpHeaderInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +65,61 @@ internal static ContainerAppHttpHeaderInfo DeserializeContainerAppHttpHeaderInfo value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppHttpHeaderInfo(name, value, serializedAdditionalRawData); + } + + ContainerAppHttpHeaderInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppHttpHeaderInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppHttpHeaderInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppHttpHeaderInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppHttpHeaderInfo model) + { + if (model is null) + { + return null; } - return new ContainerAppHttpHeaderInfo(name, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppHttpHeaderInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppHttpHeaderInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.cs index 303ea8a6d3ad..bba1eb86076b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpHeaderInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// HTTPHeader describes a custom header to be used in HTTP probes. public partial class ContainerAppHttpHeaderInfo { - /// Initializes a new instance of ContainerAppHttpHeaderInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The header field name. /// The header field value. /// or is null. @@ -26,6 +30,22 @@ public ContainerAppHttpHeaderInfo(string name, string value) Value = value; } + /// Initializes a new instance of . + /// The header field name. + /// The header field value. + /// Keeps track of any properties unknown to the library. + internal ContainerAppHttpHeaderInfo(string name, string value, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppHttpHeaderInfo() + { + } + /// The header field name. public string Name { get; set; } /// The header field value. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.Serialization.cs index 506d54614d95..681ae6c1efae 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppHttpRequestInfo : IUtf8JsonSerializable + public partial class ContainerAppHttpRequestInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Host)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HttpHeaders) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -43,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scheme"u8); writer.WriteStringValue(Scheme.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppHttpRequestInfo DeserializeContainerAppHttpRequestInfo(JsonElement element) + internal static ContainerAppHttpRequestInfo DeserializeContainerAppHttpRequestInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +85,7 @@ internal static ContainerAppHttpRequestInfo DeserializeContainerAppHttpRequestIn Optional path = default; int port = default; Optional scheme = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("host"u8)) @@ -97,8 +126,61 @@ internal static ContainerAppHttpRequestInfo DeserializeContainerAppHttpRequestIn scheme = new ContainerAppHttpScheme(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppHttpRequestInfo(host.Value, Optional.ToList(httpHeaders), path.Value, port, Optional.ToNullable(scheme), serializedAdditionalRawData); + } + + ContainerAppHttpRequestInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppHttpRequestInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppHttpRequestInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppHttpRequestInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppHttpRequestInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppHttpRequestInfo(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppHttpRequestInfo(host.Value, Optional.ToList(httpHeaders), path.Value, port, Optional.ToNullable(scheme)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppHttpRequestInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.cs index 09f48f2b262f..580bf22c0cf5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpRequestInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// HTTPGet specifies the http request to perform. public partial class ContainerAppHttpRequestInfo { - /// Initializes a new instance of ContainerAppHttpRequestInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. public ContainerAppHttpRequestInfo(int port) { @@ -21,19 +25,26 @@ public ContainerAppHttpRequestInfo(int port) Port = port; } - /// Initializes a new instance of ContainerAppHttpRequestInfo. + /// Initializes a new instance of . /// Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. /// Custom headers to set in the request. HTTP allows repeated headers. /// Path to access on the HTTP server. /// Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. /// Scheme to use for connecting to the host. Defaults to HTTP. - internal ContainerAppHttpRequestInfo(string host, IList httpHeaders, string path, int port, ContainerAppHttpScheme? scheme) + /// Keeps track of any properties unknown to the library. + internal ContainerAppHttpRequestInfo(string host, IList httpHeaders, string path, int port, ContainerAppHttpScheme? scheme, Dictionary serializedAdditionalRawData) { Host = host; HttpHeaders = httpHeaders; Path = path; Port = port; Scheme = scheme; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppHttpRequestInfo() + { } /// Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.Serialization.cs index 9e387a1b7200..b65bb8cd4297 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppHttpScaleRule : IUtf8JsonSerializable + public partial class ContainerAppHttpScaleRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Metadata)) { @@ -33,21 +40,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Auth) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppHttpScaleRule DeserializeContainerAppHttpScaleRule(JsonElement element) + internal static ContainerAppHttpScaleRule DeserializeContainerAppHttpScaleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> metadata = default; Optional> auth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metadata"u8)) @@ -78,8 +107,61 @@ internal static ContainerAppHttpScaleRule DeserializeContainerAppHttpScaleRule(J auth = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppHttpScaleRule(Optional.ToDictionary(metadata), Optional.ToList(auth), serializedAdditionalRawData); + } + + ContainerAppHttpScaleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppHttpScaleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppHttpScaleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppHttpScaleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppHttpScaleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppHttpScaleRule(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppHttpScaleRule(Optional.ToDictionary(metadata), Optional.ToList(auth)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppHttpScaleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.cs index 6de5cc809d11..dca4b8f13e02 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpScaleRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App container Http scaling rule. public partial class ContainerAppHttpScaleRule { - /// Initializes a new instance of ContainerAppHttpScaleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppHttpScaleRule() { Metadata = new ChangeTrackingDictionary(); Auth = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppHttpScaleRule. + /// Initializes a new instance of . /// Metadata properties to describe http scale rule. /// Authentication secrets for the custom scale rule. - internal ContainerAppHttpScaleRule(IDictionary metadata, IList auth) + /// Keeps track of any properties unknown to the library. + internal ContainerAppHttpScaleRule(IDictionary metadata, IList auth, Dictionary serializedAdditionalRawData) { Metadata = metadata; Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Metadata properties to describe http scale rule. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.Serialization.cs index 5875f8f75d15..44ddca1be532 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppHttpSettings : IUtf8JsonSerializable + public partial class ContainerAppHttpSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RequireHttps)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Routes)) { writer.WritePropertyName("routes"u8); - writer.WriteObjectValue(Routes); + if (Routes is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Routes).Serialize(writer, options); + } } if (Optional.IsDefined(ForwardProxy)) { writer.WritePropertyName("forwardProxy"u8); - writer.WriteObjectValue(ForwardProxy); + if (ForwardProxy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ForwardProxy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppHttpSettings DeserializeContainerAppHttpSettings(JsonElement element) + internal static ContainerAppHttpSettings DeserializeContainerAppHttpSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static ContainerAppHttpSettings DeserializeContainerAppHttpSettings(Jso Optional requireHttps = default; Optional routes = default; Optional forwardProxy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("requireHttps"u8)) @@ -71,8 +108,61 @@ internal static ContainerAppHttpSettings DeserializeContainerAppHttpSettings(Jso forwardProxy = ContainerAppForwardProxy.DeserializeContainerAppForwardProxy(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppHttpSettings(Optional.ToNullable(requireHttps), routes.Value, forwardProxy.Value, serializedAdditionalRawData); + } + + ContainerAppHttpSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppHttpSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppHttpSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppHttpSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppHttpSettings model) + { + if (model is null) + { + return null; } - return new ContainerAppHttpSettings(Optional.ToNullable(requireHttps), routes.Value, forwardProxy.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppHttpSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppHttpSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.cs index 2bae045b8394..ea59907ce0d1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppHttpSettings.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. public partial class ContainerAppHttpSettings { - /// Initializes a new instance of ContainerAppHttpSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppHttpSettings() { } - /// Initializes a new instance of ContainerAppHttpSettings. + /// Initializes a new instance of . /// <code>false</code> if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, <code>true</code>. /// The configuration settings of the paths HTTP requests. /// The configuration settings of a forward proxy used to make the requests. - internal ContainerAppHttpSettings(bool? requireHttps, HttpSettingsRoutes routes, ContainerAppForwardProxy forwardProxy) + /// Keeps track of any properties unknown to the library. + internal ContainerAppHttpSettings(bool? requireHttps, HttpSettingsRoutes routes, ContainerAppForwardProxy forwardProxy, Dictionary serializedAdditionalRawData) { RequireHttps = requireHttps; Routes = routes; ForwardProxy = forwardProxy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the authentication/authorization responses not having the HTTPS scheme are permissible; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.Serialization.cs index 685a43550552..a1254c4a1528 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppIPSecurityRestrictionRule : IUtf8JsonSerializable + public partial class ContainerAppIPSecurityRestrictionRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(IPAddressRange); writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppIPSecurityRestrictionRule DeserializeContainerAppIPSecurityRestrictionRule(JsonElement element) + internal static ContainerAppIPSecurityRestrictionRule DeserializeContainerAppIPSecurityRestrictionRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ContainerAppIPSecurityRestrictionRule DeserializeContainerAppIPS Optional description = default; string ipAddressRange = default; ContainerAppIPRuleAction action = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -61,8 +84,61 @@ internal static ContainerAppIPSecurityRestrictionRule DeserializeContainerAppIPS action = new ContainerAppIPRuleAction(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppIPSecurityRestrictionRule(name, description.Value, ipAddressRange, action, serializedAdditionalRawData); + } + + ContainerAppIPSecurityRestrictionRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppIPSecurityRestrictionRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppIPSecurityRestrictionRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppIPSecurityRestrictionRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppIPSecurityRestrictionRule model) + { + if (model is null) + { + return null; } - return new ContainerAppIPSecurityRestrictionRule(name, description.Value, ipAddressRange, action); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppIPSecurityRestrictionRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppIPSecurityRestrictionRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.cs index 9a86bd4410b6..80828aacdc96 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIPSecurityRestrictionRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Rule to restrict incoming IP address. public partial class ContainerAppIPSecurityRestrictionRule { - /// Initializes a new instance of ContainerAppIPSecurityRestrictionRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name for the IP restriction rule. /// CIDR notation to match incoming IP address. /// Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny. @@ -28,17 +32,24 @@ public ContainerAppIPSecurityRestrictionRule(string name, string ipAddressRange, Action = action; } - /// Initializes a new instance of ContainerAppIPSecurityRestrictionRule. + /// Initializes a new instance of . /// Name for the IP restriction rule. /// Describe the IP restriction rule that is being sent to the container-app. This is an optional field. /// CIDR notation to match incoming IP address. /// Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of ALL Allow or ALL Deny. - internal ContainerAppIPSecurityRestrictionRule(string name, string description, string ipAddressRange, ContainerAppIPRuleAction action) + /// Keeps track of any properties unknown to the library. + internal ContainerAppIPSecurityRestrictionRule(string name, string description, string ipAddressRange, ContainerAppIPRuleAction action, Dictionary serializedAdditionalRawData) { Name = name; Description = description; IPAddressRange = ipAddressRange; Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppIPSecurityRestrictionRule() + { } /// Name for the IP restriction rule. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.Serialization.cs index 85e3c85e56c6..af928464b4a6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.Serialization.cs @@ -5,51 +5,107 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppIdentityProvidersConfiguration : IUtf8JsonSerializable + public partial class ContainerAppIdentityProvidersConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AzureActiveDirectory)) { writer.WritePropertyName("azureActiveDirectory"u8); - writer.WriteObjectValue(AzureActiveDirectory); + if (AzureActiveDirectory is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureActiveDirectory).Serialize(writer, options); + } } if (Optional.IsDefined(Facebook)) { writer.WritePropertyName("facebook"u8); - writer.WriteObjectValue(Facebook); + if (Facebook is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Facebook).Serialize(writer, options); + } } if (Optional.IsDefined(GitHub)) { writer.WritePropertyName("gitHub"u8); - writer.WriteObjectValue(GitHub); + if (GitHub is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitHub).Serialize(writer, options); + } } if (Optional.IsDefined(Google)) { writer.WritePropertyName("google"u8); - writer.WriteObjectValue(Google); + if (Google is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Google).Serialize(writer, options); + } } if (Optional.IsDefined(Twitter)) { writer.WritePropertyName("twitter"u8); - writer.WriteObjectValue(Twitter); + if (Twitter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Twitter).Serialize(writer, options); + } } if (Optional.IsDefined(Apple)) { writer.WritePropertyName("apple"u8); - writer.WriteObjectValue(Apple); + if (Apple is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Apple).Serialize(writer, options); + } } if (Optional.IsDefined(AzureStaticWebApps)) { writer.WritePropertyName("azureStaticWebApps"u8); - writer.WriteObjectValue(AzureStaticWebApps); + if (AzureStaticWebApps is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureStaticWebApps).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(CustomOpenIdConnectProviders)) { @@ -58,15 +114,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in CustomOpenIdConnectProviders) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppIdentityProvidersConfiguration DeserializeContainerAppIdentityProvidersConfiguration(JsonElement element) + internal static ContainerAppIdentityProvidersConfiguration DeserializeContainerAppIdentityProvidersConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +156,7 @@ internal static ContainerAppIdentityProvidersConfiguration DeserializeContainerA Optional apple = default; Optional azureStaticWebApps = default; Optional> customOpenIdConnectProviders = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("azureActiveDirectory"u8)) @@ -158,8 +236,61 @@ internal static ContainerAppIdentityProvidersConfiguration DeserializeContainerA customOpenIdConnectProviders = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppIdentityProvidersConfiguration(azureActiveDirectory.Value, facebook.Value, gitHub.Value, google.Value, twitter.Value, apple.Value, azureStaticWebApps.Value, Optional.ToDictionary(customOpenIdConnectProviders), serializedAdditionalRawData); + } + + ContainerAppIdentityProvidersConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppIdentityProvidersConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppIdentityProvidersConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppIdentityProvidersConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppIdentityProvidersConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppIdentityProvidersConfiguration(azureActiveDirectory.Value, facebook.Value, gitHub.Value, google.Value, twitter.Value, apple.Value, azureStaticWebApps.Value, Optional.ToDictionary(customOpenIdConnectProviders)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppIdentityProvidersConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppIdentityProvidersConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.cs index cf1b8d659d91..927c1444386b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIdentityProvidersConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. public partial class ContainerAppIdentityProvidersConfiguration { - /// Initializes a new instance of ContainerAppIdentityProvidersConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppIdentityProvidersConfiguration() { CustomOpenIdConnectProviders = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerAppIdentityProvidersConfiguration. + /// Initializes a new instance of . /// The configuration settings of the Azure Active directory provider. /// The configuration settings of the Facebook provider. /// The configuration settings of the GitHub provider. @@ -31,7 +35,8 @@ public ContainerAppIdentityProvidersConfiguration() /// The map of the name of the alias of each custom Open ID Connect provider to the /// configuration settings of the custom Open ID Connect provider. /// - internal ContainerAppIdentityProvidersConfiguration(ContainerAppAzureActiveDirectoryConfiguration azureActiveDirectory, ContainerAppFacebookConfiguration facebook, ContainerAppGitHubConfiguration gitHub, ContainerAppGoogleConfiguration google, ContainerAppTwitterConfiguration twitter, ContainerAppAppleConfiguration apple, ContainerAppAzureStaticWebAppsConfiguration azureStaticWebApps, IDictionary customOpenIdConnectProviders) + /// Keeps track of any properties unknown to the library. + internal ContainerAppIdentityProvidersConfiguration(ContainerAppAzureActiveDirectoryConfiguration azureActiveDirectory, ContainerAppFacebookConfiguration facebook, ContainerAppGitHubConfiguration gitHub, ContainerAppGoogleConfiguration google, ContainerAppTwitterConfiguration twitter, ContainerAppAppleConfiguration apple, ContainerAppAzureStaticWebAppsConfiguration azureStaticWebApps, IDictionary customOpenIdConnectProviders, Dictionary serializedAdditionalRawData) { AzureActiveDirectory = azureActiveDirectory; Facebook = facebook; @@ -41,6 +46,7 @@ internal ContainerAppIdentityProvidersConfiguration(ContainerAppAzureActiveDirec Apple = apple; AzureStaticWebApps = azureStaticWebApps; CustomOpenIdConnectProviders = customOpenIdConnectProviders; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The configuration settings of the Azure Active directory provider. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.Serialization.cs index 5290c6acc49c..897f1ccf49db 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppIngressConfiguration : IUtf8JsonSerializable + public partial class ContainerAppIngressConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(External)) { @@ -42,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Traffic) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomDomains) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -67,14 +88,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPSecurityRestrictions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(StickySessions)) { writer.WritePropertyName("stickySessions"u8); - writer.WriteObjectValue(StickySessions); + if (StickySessions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StickySessions).Serialize(writer, options); + } } if (Optional.IsDefined(ClientCertificateMode)) { @@ -84,13 +119,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CorsPolicy)) { writer.WritePropertyName("corsPolicy"u8); - writer.WriteObjectValue(CorsPolicy); + if (CorsPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CorsPolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppIngressConfiguration DeserializeContainerAppIngressConfiguration(JsonElement element) + internal static ContainerAppIngressConfiguration DeserializeContainerAppIngressConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,6 +163,7 @@ internal static ContainerAppIngressConfiguration DeserializeContainerAppIngressC Optional stickySessions = default; Optional clientCertificateMode = default; Optional corsPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("fqdn"u8)) @@ -228,8 +285,61 @@ internal static ContainerAppIngressConfiguration DeserializeContainerAppIngressC corsPolicy = ContainerAppCorsPolicy.DeserializeContainerAppCorsPolicy(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppIngressConfiguration(fqdn.Value, Optional.ToNullable(external), Optional.ToNullable(targetPort), Optional.ToNullable(exposedPort), Optional.ToNullable(transport), Optional.ToList(traffic), Optional.ToList(customDomains), Optional.ToNullable(allowInsecure), Optional.ToList(ipSecurityRestrictions), stickySessions.Value, Optional.ToNullable(clientCertificateMode), corsPolicy.Value, serializedAdditionalRawData); + } + + ContainerAppIngressConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppIngressConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppIngressConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppIngressConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppIngressConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppIngressConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppIngressConfiguration(fqdn.Value, Optional.ToNullable(external), Optional.ToNullable(targetPort), Optional.ToNullable(exposedPort), Optional.ToNullable(transport), Optional.ToList(traffic), Optional.ToList(customDomains), Optional.ToNullable(allowInsecure), Optional.ToList(ipSecurityRestrictions), stickySessions.Value, Optional.ToNullable(clientCertificateMode), corsPolicy.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppIngressConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.cs index 07b3141eedce..c4c585febb33 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppIngressConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App Ingress configuration. public partial class ContainerAppIngressConfiguration { - /// Initializes a new instance of ContainerAppIngressConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppIngressConfiguration() { Traffic = new ChangeTrackingList(); @@ -21,7 +25,7 @@ public ContainerAppIngressConfiguration() IPSecurityRestrictions = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppIngressConfiguration. + /// Initializes a new instance of . /// Hostname. /// Bool indicating if app exposes an external http endpoint. /// Target Port in containers for traffic from ingress. @@ -34,7 +38,8 @@ public ContainerAppIngressConfiguration() /// Sticky Sessions for Single Revision Mode. /// Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate on forwarding. Accept indicates server forwards client certificate but does not require a client certificate. Require indicates server requires a client certificate. /// CORS policy for container app. - internal ContainerAppIngressConfiguration(string fqdn, bool? external, int? targetPort, int? exposedPort, ContainerAppIngressTransportMethod? transport, IList traffic, IList customDomains, bool? allowInsecure, IList ipSecurityRestrictions, IngressStickySessions stickySessions, ContainerAppIngressClientCertificateMode? clientCertificateMode, ContainerAppCorsPolicy corsPolicy) + /// Keeps track of any properties unknown to the library. + internal ContainerAppIngressConfiguration(string fqdn, bool? external, int? targetPort, int? exposedPort, ContainerAppIngressTransportMethod? transport, IList traffic, IList customDomains, bool? allowInsecure, IList ipSecurityRestrictions, IngressStickySessions stickySessions, ContainerAppIngressClientCertificateMode? clientCertificateMode, ContainerAppCorsPolicy corsPolicy, Dictionary serializedAdditionalRawData) { Fqdn = fqdn; External = external; @@ -48,6 +53,7 @@ internal ContainerAppIngressConfiguration(string fqdn, bool? external, int? targ StickySessions = stickySessions; ClientCertificateMode = clientCertificateMode; CorsPolicy = corsPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Hostname. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.Serialization.cs index b170e8234a6d..637ffa4f990b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppInitContainer : IUtf8JsonSerializable + public partial class ContainerAppInitContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Image)) { @@ -52,14 +59,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Env) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Resources)) { writer.WritePropertyName("resources"u8); - writer.WriteObjectValue(Resources); + if (Resources is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resources).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(VolumeMounts)) { @@ -67,15 +88,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VolumeMounts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppInitContainer DeserializeContainerAppInitContainer(JsonElement element) + internal static ContainerAppInitContainer DeserializeContainerAppInitContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +129,7 @@ internal static ContainerAppInitContainer DeserializeContainerAppInitContainer(J Optional> env = default; Optional resources = default; Optional> volumeMounts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("image"u8)) @@ -164,8 +207,61 @@ internal static ContainerAppInitContainer DeserializeContainerAppInitContainer(J volumeMounts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppInitContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, Optional.ToList(volumeMounts), serializedAdditionalRawData); + } + + ContainerAppInitContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppInitContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppInitContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppInitContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppInitContainer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppInitContainer(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppInitContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, Optional.ToList(volumeMounts)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppInitContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.cs index 1ea860b6f97b..e7b15edc36e8 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppInitContainer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models @@ -12,12 +13,12 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App init container definition. public partial class ContainerAppInitContainer : ContainerAppBaseContainer { - /// Initializes a new instance of ContainerAppInitContainer. + /// Initializes a new instance of . public ContainerAppInitContainer() { } - /// Initializes a new instance of ContainerAppInitContainer. + /// Initializes a new instance of . /// Container image tag. /// Custom container name. /// Container start command. @@ -25,7 +26,8 @@ public ContainerAppInitContainer() /// Container environment variables. /// Container resource requirements. /// Container volume mounts. - internal ContainerAppInitContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, IList volumeMounts) : base(image, name, command, args, env, resources, volumeMounts) + /// Keeps track of any properties unknown to the library. + internal ContainerAppInitContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, IList volumeMounts, Dictionary serializedAdditionalRawData) : base(image, name, command, args, env, resources, volumeMounts, serializedAdditionalRawData) { } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.Serialization.cs index 146e23a98b5e..2b6ec2c27dec 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobConfiguration : IUtf8JsonSerializable + public partial class ContainerAppJobConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Secrets)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -38,17 +52,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ManualTriggerConfig)) { writer.WritePropertyName("manualTriggerConfig"u8); - writer.WriteObjectValue(ManualTriggerConfig); + if (ManualTriggerConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManualTriggerConfig).Serialize(writer, options); + } } if (Optional.IsDefined(ScheduleTriggerConfig)) { writer.WritePropertyName("scheduleTriggerConfig"u8); - writer.WriteObjectValue(ScheduleTriggerConfig); + if (ScheduleTriggerConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduleTriggerConfig).Serialize(writer, options); + } } if (Optional.IsDefined(EventTriggerConfig)) { writer.WritePropertyName("eventTriggerConfig"u8); - writer.WriteObjectValue(EventTriggerConfig); + if (EventTriggerConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EventTriggerConfig).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Registries)) { @@ -56,15 +91,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Registries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJobConfiguration DeserializeContainerAppJobConfiguration(JsonElement element) + internal static ContainerAppJobConfiguration DeserializeContainerAppJobConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +133,7 @@ internal static ContainerAppJobConfiguration DeserializeContainerAppJobConfigura Optional scheduleTriggerConfig = default; Optional eventTriggerConfig = default; Optional> registries = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secrets"u8)) @@ -153,8 +210,61 @@ internal static ContainerAppJobConfiguration DeserializeContainerAppJobConfigura registries = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobConfiguration(Optional.ToList(secrets), triggerType, replicaTimeout, Optional.ToNullable(replicaRetryLimit), manualTriggerConfig.Value, scheduleTriggerConfig.Value, eventTriggerConfig.Value, Optional.ToList(registries), serializedAdditionalRawData); + } + + ContainerAppJobConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppJobConfiguration(Optional.ToList(secrets), triggerType, replicaTimeout, Optional.ToNullable(replicaRetryLimit), manualTriggerConfig.Value, scheduleTriggerConfig.Value, eventTriggerConfig.Value, Optional.ToList(registries)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.cs index 1087b3707a74..e26fe015c583 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Non versioned Container Apps Job configuration properties. public partial class ContainerAppJobConfiguration { - /// Initializes a new instance of ContainerAppJobConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Trigger type of the job. /// Maximum number of seconds a replica is allowed to run. public ContainerAppJobConfiguration(ContainerAppJobTriggerType triggerType, int replicaTimeout) @@ -24,7 +28,7 @@ public ContainerAppJobConfiguration(ContainerAppJobTriggerType triggerType, int Registries = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJobConfiguration. + /// Initializes a new instance of . /// Collection of secrets used by a Container Apps Job. /// Trigger type of the job. /// Maximum number of seconds a replica is allowed to run. @@ -33,7 +37,8 @@ public ContainerAppJobConfiguration(ContainerAppJobTriggerType triggerType, int /// Cron formatted repeating trigger schedule ("* * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. /// Trigger configuration of an event driven job. /// Collection of private container registry credentials used by a Container apps job. - internal ContainerAppJobConfiguration(IList secrets, ContainerAppJobTriggerType triggerType, int replicaTimeout, int? replicaRetryLimit, JobConfigurationManualTriggerConfig manualTriggerConfig, JobConfigurationScheduleTriggerConfig scheduleTriggerConfig, EventTriggerConfiguration eventTriggerConfig, IList registries) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobConfiguration(IList secrets, ContainerAppJobTriggerType triggerType, int replicaTimeout, int? replicaRetryLimit, JobConfigurationManualTriggerConfig manualTriggerConfig, JobConfigurationScheduleTriggerConfig scheduleTriggerConfig, EventTriggerConfiguration eventTriggerConfig, IList registries, Dictionary serializedAdditionalRawData) { Secrets = secrets; TriggerType = triggerType; @@ -43,6 +48,12 @@ internal ContainerAppJobConfiguration(IList secrets, ScheduleTriggerConfig = scheduleTriggerConfig; EventTriggerConfig = eventTriggerConfig; Registries = registries; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppJobConfiguration() + { } /// Collection of secrets used by a Container Apps Job. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobData.Serialization.cs index 36c1ada0c6fe..84de1103a9b6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppJobData : IUtf8JsonSerializable + public partial class ContainerAppJobData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -52,19 +59,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(Template)) { writer.WritePropertyName("template"u8); - writer.WriteObjectValue(Template); + if (Template is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Template).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJobData DeserializeContainerAppJobData(JsonElement element) + internal static ContainerAppJobData DeserializeContainerAppJobData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,6 +118,7 @@ internal static ContainerAppJobData DeserializeContainerAppJobData(JsonElement e Optional template = default; Optional> outboundIPAddresses = default; Optional eventStreamEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -206,8 +242,61 @@ internal static ContainerAppJobData DeserializeContainerAppJobData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(provisioningState), environmentId.Value, workloadProfileName.Value, configuration.Value, template.Value, Optional.ToList(outboundIPAddresses), eventStreamEndpoint.Value, serializedAdditionalRawData); + } + + ContainerAppJobData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobData model) + { + if (model is null) + { + return null; } - return new ContainerAppJobData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(provisioningState), environmentId.Value, workloadProfileName.Value, configuration.Value, template.Value, Optional.ToList(outboundIPAddresses), eventStreamEndpoint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.Serialization.cs index a2dc8e963063..a5663b1e123f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobExecutionBase + public partial class ContainerAppJobExecutionBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppJobExecutionBase DeserializeContainerAppJobExecutionBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppJobExecutionBase DeserializeContainerAppJobExecutionBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static ContainerAppJobExecutionBase DeserializeContainerAppJobExecution id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppJobExecutionBase(name.Value, id.Value); + return new ContainerAppJobExecutionBase(name.Value, id.Value, serializedAdditionalRawData); + } + + ContainerAppJobExecutionBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobExecutionBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobExecutionBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobExecutionBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobExecutionBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobExecutionBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobExecutionBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.cs index 7ee237cd42b6..74bf6163b2bd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionBase.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App's Job execution name. public partial class ContainerAppJobExecutionBase { - /// Initializes a new instance of ContainerAppJobExecutionBase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppJobExecutionBase() { } - /// Initializes a new instance of ContainerAppJobExecutionBase. + /// Initializes a new instance of . /// Job execution name. /// Job execution Id. - internal ContainerAppJobExecutionBase(string name, string id) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobExecutionBase(string name, string id, Dictionary serializedAdditionalRawData) { Name = name; Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Job execution name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionData.Serialization.cs index 04032dab973c..adac4ccf8dc5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionData.Serialization.cs @@ -6,17 +6,66 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppJobExecutionData + public partial class ContainerAppJobExecutionData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppJobExecutionData DeserializeContainerAppJobExecutionData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Template)) + { + writer.WritePropertyName("template"u8); + if (Template is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Template).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppJobExecutionData DeserializeContainerAppJobExecutionData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +78,7 @@ internal static ContainerAppJobExecutionData DeserializeContainerAppJobExecution string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -91,8 +141,61 @@ internal static ContainerAppJobExecutionData DeserializeContainerAppJobExecution systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppJobExecutionData(id, name, type, systemData.Value, Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), template.Value); + return new ContainerAppJobExecutionData(id, name, type, systemData.Value, Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), template.Value, serializedAdditionalRawData); + } + + ContainerAppJobExecutionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobExecutionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobExecutionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobExecutionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobExecutionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobExecutionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobExecutionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.Serialization.cs index 810dd90a5f59..01b8adac9937 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobExecutionTemplate : IUtf8JsonSerializable + public partial class ContainerAppJobExecutionTemplate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Containers)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Containers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,21 +46,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in InitContainers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJobExecutionTemplate DeserializeContainerAppJobExecutionTemplate(JsonElement element) + internal static ContainerAppJobExecutionTemplate DeserializeContainerAppJobExecutionTemplate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> containers = default; Optional> initContainers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("containers"u8)) @@ -77,8 +113,61 @@ internal static ContainerAppJobExecutionTemplate DeserializeContainerAppJobExecu initContainers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobExecutionTemplate(Optional.ToList(containers), Optional.ToList(initContainers), serializedAdditionalRawData); + } + + ContainerAppJobExecutionTemplate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobExecutionTemplate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobExecutionTemplate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobExecutionTemplate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobExecutionTemplate model) + { + if (model is null) + { + return null; } - return new ContainerAppJobExecutionTemplate(Optional.ToList(containers), Optional.ToList(initContainers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobExecutionTemplate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobExecutionTemplate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.cs index 14e13d2198ce..0962bfca9654 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutionTemplate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// Job's execution template, containing container configuration for a job's execution. public partial class ContainerAppJobExecutionTemplate { - /// Initializes a new instance of ContainerAppJobExecutionTemplate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJobExecutionTemplate() { Containers = new ChangeTrackingList(); InitContainers = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJobExecutionTemplate. + /// Initializes a new instance of . /// List of container definitions for the Container Apps Job. /// List of specialized containers that run before job containers. - internal ContainerAppJobExecutionTemplate(IList containers, IList initContainers) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobExecutionTemplate(IList containers, IList initContainers, Dictionary serializedAdditionalRawData) { Containers = containers; InitContainers = initContainers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of container definitions for the Container Apps Job. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.Serialization.cs index 16d4867f7074..68d8c9946cf0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobExecutions + public partial class ContainerAppJobExecutions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppJobExecutions DeserializeContainerAppJobExecutions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppJobExecutions DeserializeContainerAppJobExecutions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static ContainerAppJobExecutions DeserializeContainerAppJobExecutions(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppJobExecutions(value, nextLink.Value); + return new ContainerAppJobExecutions(value, nextLink.Value, serializedAdditionalRawData); + } + + ContainerAppJobExecutions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobExecutions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobExecutions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobExecutions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobExecutions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobExecutions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobExecutions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.cs index 6aacdf4a2337..80a613965f98 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobExecutions.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App executions collection ARM resource. public partial class ContainerAppJobExecutions { - /// Initializes a new instance of ContainerAppJobExecutions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal ContainerAppJobExecutions(IEnumerable value) @@ -26,13 +29,20 @@ internal ContainerAppJobExecutions(IEnumerable val Value = value.ToList(); } - /// Initializes a new instance of ContainerAppJobExecutions. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal ContainerAppJobExecutions(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobExecutions(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppJobExecutions() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.Serialization.cs index 0a1157b75d48..0c34037afe4a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobPatch : IUtf8JsonSerializable + public partial class ContainerAppJobPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -36,9 +44,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ContainerAppJobPatch DeserializeContainerAppJobPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional identity = default; + Optional> tags = default; + Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ContainerAppJobPatchProperties.DeserializeContainerAppJobPatchProperties(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobPatch(identity, Optional.ToDictionary(tags), properties.Value, serializedAdditionalRawData); + } + + ContainerAppJobPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.cs index 4854e0af2493..531c9d70f2b4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,28 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container Apps Job resource specific properties. public partial class ContainerAppJobPatch { - /// Initializes a new instance of ContainerAppJobPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJobPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. + /// Resource tags. + /// + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobPatch(ManagedServiceIdentity identity, IDictionary tags, ContainerAppJobPatchProperties properties, Dictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. public ManagedServiceIdentity Identity { get; set; } /// Resource tags. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.Serialization.cs index 8a5e1d6a352a..c9123aa2fa5d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobPatchProperties : IUtf8JsonSerializable + public partial class ContainerAppJobPatchProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EnvironmentId)) { @@ -23,12 +31,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsDefined(Template)) { writer.WritePropertyName("template"u8); - writer.WriteObjectValue(Template); + if (Template is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Template).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(OutboundIPAddresses)) { @@ -45,7 +67,134 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("eventStreamEndpoint"u8); writer.WriteStringValue(EventStreamEndpoint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerAppJobPatchProperties DeserializeContainerAppJobPatchProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional environmentId = default; + Optional configuration = default; + Optional template = default; + Optional> outboundIPAddresses = default; + Optional eventStreamEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("environmentId"u8)) + { + environmentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = ContainerAppJobConfiguration.DeserializeContainerAppJobConfiguration(property.Value); + continue; + } + if (property.NameEquals("template"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = ContainerAppJobTemplate.DeserializeContainerAppJobTemplate(property.Value); + continue; + } + if (property.NameEquals("outboundIpAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundIPAddresses = array; + continue; + } + if (property.NameEquals("eventStreamEndpoint"u8)) + { + eventStreamEndpoint = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobPatchProperties(environmentId.Value, configuration.Value, template.Value, Optional.ToList(outboundIPAddresses), eventStreamEndpoint.Value, serializedAdditionalRawData); + } + + ContainerAppJobPatchProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobPatchProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobPatchProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobPatchProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobPatchProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobPatchProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobPatchProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.cs index 143200f42fe2..aee0c2dba76f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobPatchProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,32 @@ namespace Azure.ResourceManager.AppContainers.Models /// The ContainerAppJobPatchProperties. public partial class ContainerAppJobPatchProperties { - /// Initializes a new instance of ContainerAppJobPatchProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJobPatchProperties() { OutboundIPAddresses = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Resource ID of environment. + /// Container Apps Job configuration properties. + /// Container Apps job definition. + /// Outbound IP Addresses of a container apps job. + /// The endpoint of the eventstream of the container apps job. + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobPatchProperties(string environmentId, ContainerAppJobConfiguration configuration, ContainerAppJobTemplate template, IList outboundIPAddresses, string eventStreamEndpoint, Dictionary serializedAdditionalRawData) + { + EnvironmentId = environmentId; + Configuration = configuration; + Template = template; + OutboundIPAddresses = outboundIPAddresses; + EventStreamEndpoint = eventStreamEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource ID of environment. public string EnvironmentId { get; set; } /// Container Apps Job configuration properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.Serialization.cs index 1a100b2f14b4..8eabfe1810e5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobScale : IUtf8JsonSerializable + public partial class ContainerAppJobScale : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PollingIntervalInSeconds)) { @@ -37,15 +44,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJobScale DeserializeContainerAppJobScale(JsonElement element) + internal static ContainerAppJobScale DeserializeContainerAppJobScale(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static ContainerAppJobScale DeserializeContainerAppJobScale(JsonElement Optional minExecutions = default; Optional maxExecutions = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("pollingInterval"u8)) @@ -97,8 +126,61 @@ internal static ContainerAppJobScale DeserializeContainerAppJobScale(JsonElement rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobScale(Optional.ToNullable(pollingInterval), Optional.ToNullable(minExecutions), Optional.ToNullable(maxExecutions), Optional.ToList(rules), serializedAdditionalRawData); + } + + ContainerAppJobScale IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobScale(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobScale IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobScale(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobScale model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobScale(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppJobScale(Optional.ToNullable(pollingInterval), Optional.ToNullable(minExecutions), Optional.ToNullable(maxExecutions), Optional.ToList(rules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobScale(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.cs index 2638146b384d..aa6cc7db4d03 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScale.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.AppContainers.Models /// Scaling configurations for event driven jobs. public partial class ContainerAppJobScale { - /// Initializes a new instance of ContainerAppJobScale. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJobScale() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJobScale. + /// Initializes a new instance of . /// Interval to check each event source in seconds. Defaults to 30s. /// Minimum number of job executions that are created for a trigger, default 0. /// Maximum number of job executions that are created for a trigger, default 100. /// Scaling rules. - internal ContainerAppJobScale(int? pollingIntervalInSeconds, int? minExecutions, int? maxExecutions, IList rules) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobScale(int? pollingIntervalInSeconds, int? minExecutions, int? maxExecutions, IList rules, Dictionary serializedAdditionalRawData) { PollingIntervalInSeconds = pollingIntervalInSeconds; MinExecutions = minExecutions; MaxExecutions = maxExecutions; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Interval to check each event source in seconds. Defaults to 30s. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.Serialization.cs index de405bfe34ab..b400d5a6a7bf 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobScaleRule : IUtf8JsonSerializable + public partial class ContainerAppJobScaleRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -42,15 +48,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Auth) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJobScaleRule DeserializeContainerAppJobScaleRule(JsonElement element) + internal static ContainerAppJobScaleRule DeserializeContainerAppJobScaleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +86,7 @@ internal static ContainerAppJobScaleRule DeserializeContainerAppJobScaleRule(Jso Optional type = default; Optional metadata = default; Optional> auth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -94,8 +122,61 @@ internal static ContainerAppJobScaleRule DeserializeContainerAppJobScaleRule(Jso auth = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppJobScaleRule(name.Value, type.Value, metadata.Value, Optional.ToList(auth)); + return new ContainerAppJobScaleRule(name.Value, type.Value, metadata.Value, Optional.ToList(auth), serializedAdditionalRawData); + } + + ContainerAppJobScaleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobScaleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobScaleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobScaleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobScaleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobScaleRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobScaleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.cs index 966637e816bc..aa616d0186fe 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobScaleRule.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// Scaling rule. public partial class ContainerAppJobScaleRule { - /// Initializes a new instance of ContainerAppJobScaleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJobScaleRule() { Auth = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJobScaleRule. + /// Initializes a new instance of . /// Scale Rule Name. /// /// Type of the scale rule @@ -28,12 +31,14 @@ public ContainerAppJobScaleRule() /// /// Metadata properties to describe the scale rule. /// Authentication secrets for the scale rule. - internal ContainerAppJobScaleRule(string name, string jobScaleRuleType, BinaryData metadata, IList auth) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobScaleRule(string name, string jobScaleRuleType, BinaryData metadata, IList auth, Dictionary serializedAdditionalRawData) { Name = name; JobScaleRuleType = jobScaleRuleType; Metadata = metadata; Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scale Rule Name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.Serialization.cs index 4b33137a2baa..c647f872471b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJobTemplate : IUtf8JsonSerializable + public partial class ContainerAppJobTemplate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(InitContainers)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in InitContainers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Containers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,15 +63,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Volumes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJobTemplate DeserializeContainerAppJobTemplate(JsonElement element) + internal static ContainerAppJobTemplate DeserializeContainerAppJobTemplate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +100,7 @@ internal static ContainerAppJobTemplate DeserializeContainerAppJobTemplate(JsonE Optional> initContainers = default; Optional> containers = default; Optional> volumes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("initContainers"u8)) @@ -102,8 +145,61 @@ internal static ContainerAppJobTemplate DeserializeContainerAppJobTemplate(JsonE volumes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJobTemplate(Optional.ToList(initContainers), Optional.ToList(containers), Optional.ToList(volumes), serializedAdditionalRawData); + } + + ContainerAppJobTemplate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobTemplate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobTemplate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobTemplate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobTemplate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobTemplate(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppJobTemplate(Optional.ToList(initContainers), Optional.ToList(containers), Optional.ToList(volumes)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobTemplate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.cs index 8b8c7b59c417..83bde9517eb6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobTemplate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container Apps Job versioned application definition. Defines the desired state of an immutable revision. Any changes to this section Will result in a new revision being created. public partial class ContainerAppJobTemplate { - /// Initializes a new instance of ContainerAppJobTemplate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJobTemplate() { InitContainers = new ChangeTrackingList(); @@ -21,15 +25,17 @@ public ContainerAppJobTemplate() Volumes = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJobTemplate. + /// Initializes a new instance of . /// List of specialized containers that run before app containers. /// List of container definitions for the Container App. /// List of volume definitions for the Container App. - internal ContainerAppJobTemplate(IList initContainers, IList containers, IList volumes) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobTemplate(IList initContainers, IList containers, IList volumes, Dictionary serializedAdditionalRawData) { InitContainers = initContainers; Containers = containers; Volumes = volumes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of specialized containers that run before app containers. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.Serialization.cs index d2fd732efd9b..d6ef30e11c82 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ContainerAppJobsCollection + internal partial class ContainerAppJobsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppJobsCollection DeserializeContainerAppJobsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppJobsCollection DeserializeContainerAppJobsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static ContainerAppJobsCollection DeserializeContainerAppJobsCollection nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppJobsCollection(value, nextLink.Value); + return new ContainerAppJobsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ContainerAppJobsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJobsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJobsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJobsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJobsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJobsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJobsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.cs index 56d95140e7bf..e87ad4b57ba7 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJobsCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container Apps Jobs collection ARM resource. internal partial class ContainerAppJobsCollection { - /// Initializes a new instance of ContainerAppJobsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal ContainerAppJobsCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal ContainerAppJobsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ContainerAppJobsCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal ContainerAppJobsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJobsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppJobsCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.Serialization.cs index ead0d88728cd..230c2a0a973b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppJwtClaimChecks : IUtf8JsonSerializable + public partial class ContainerAppJwtClaimChecks : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AllowedGroups)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppJwtClaimChecks DeserializeContainerAppJwtClaimChecks(JsonElement element) + internal static ContainerAppJwtClaimChecks DeserializeContainerAppJwtClaimChecks(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> allowedGroups = default; Optional> allowedClientApplications = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowedGroups"u8)) @@ -77,8 +99,61 @@ internal static ContainerAppJwtClaimChecks DeserializeContainerAppJwtClaimChecks allowedClientApplications = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppJwtClaimChecks(Optional.ToList(allowedGroups), Optional.ToList(allowedClientApplications), serializedAdditionalRawData); + } + + ContainerAppJwtClaimChecks IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppJwtClaimChecks(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppJwtClaimChecks IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppJwtClaimChecks(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppJwtClaimChecks model) + { + if (model is null) + { + return null; } - return new ContainerAppJwtClaimChecks(Optional.ToList(allowedGroups), Optional.ToList(allowedClientApplications)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppJwtClaimChecks(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppJwtClaimChecks(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.cs index 3f6492406029..7af3f23073b4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppJwtClaimChecks.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the checks that should be made while validating the JWT Claims. public partial class ContainerAppJwtClaimChecks { - /// Initializes a new instance of ContainerAppJwtClaimChecks. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppJwtClaimChecks() { AllowedGroups = new ChangeTrackingList(); AllowedClientApplications = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppJwtClaimChecks. + /// Initializes a new instance of . /// The list of the allowed groups. /// The list of the allowed client applications. - internal ContainerAppJwtClaimChecks(IList allowedGroups, IList allowedClientApplications) + /// Keeps track of any properties unknown to the library. + internal ContainerAppJwtClaimChecks(IList allowedGroups, IList allowedClientApplications, Dictionary serializedAdditionalRawData) { AllowedGroups = allowedGroups; AllowedClientApplications = allowedClientApplications; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of the allowed groups. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.Serialization.cs index f3f8ba339a95..55818f1c6c60 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppLogAnalyticsConfiguration : IUtf8JsonSerializable + public partial class ContainerAppLogAnalyticsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CustomerId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sharedKey"u8); writer.WriteStringValue(SharedKey); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppLogAnalyticsConfiguration DeserializeContainerAppLogAnalyticsConfiguration(JsonElement element) + internal static ContainerAppLogAnalyticsConfiguration DeserializeContainerAppLogAnalyticsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional customerId = default; Optional sharedKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("customerId"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppLogAnalyticsConfiguration DeserializeContainerAppLog sharedKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppLogAnalyticsConfiguration(customerId.Value, sharedKey.Value, serializedAdditionalRawData); + } + + ContainerAppLogAnalyticsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppLogAnalyticsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppLogAnalyticsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppLogAnalyticsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppLogAnalyticsConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppLogAnalyticsConfiguration(customerId.Value, sharedKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppLogAnalyticsConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppLogAnalyticsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.cs index c60645e3d931..41e77e988ea6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogAnalyticsConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Log Analytics configuration, must only be provided when destination is configured as 'log-analytics'. public partial class ContainerAppLogAnalyticsConfiguration { - /// Initializes a new instance of ContainerAppLogAnalyticsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppLogAnalyticsConfiguration() { } - /// Initializes a new instance of ContainerAppLogAnalyticsConfiguration. + /// Initializes a new instance of . /// Log analytics customer id. /// Log analytics customer key. - internal ContainerAppLogAnalyticsConfiguration(string customerId, string sharedKey) + /// Keeps track of any properties unknown to the library. + internal ContainerAppLogAnalyticsConfiguration(string customerId, string sharedKey, Dictionary serializedAdditionalRawData) { CustomerId = customerId; SharedKey = sharedKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Log analytics customer id. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.Serialization.cs index 97d5e6b9bb52..2fc9234294f6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppLogin : IUtf8JsonSerializable + public partial class ContainerAppLogin : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Routes)) { writer.WritePropertyName("routes"u8); - writer.WriteObjectValue(Routes); + if (Routes is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Routes).Serialize(writer, options); + } } if (Optional.IsDefined(PreserveUrlFragmentsForLogins)) { @@ -39,18 +53,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CookieExpiration)) { writer.WritePropertyName("cookieExpiration"u8); - writer.WriteObjectValue(CookieExpiration); + if (CookieExpiration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CookieExpiration).Serialize(writer, options); + } } if (Optional.IsDefined(Nonce)) { writer.WritePropertyName("nonce"u8); - writer.WriteObjectValue(Nonce); + if (Nonce is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Nonce).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppLogin DeserializeContainerAppLogin(JsonElement element) + internal static ContainerAppLogin DeserializeContainerAppLogin(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +102,7 @@ internal static ContainerAppLogin DeserializeContainerAppLogin(JsonElement eleme Optional> allowedExternalRedirectUrls = default; Optional cookieExpiration = default; Optional nonce = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("routes"u8)) @@ -112,8 +155,61 @@ internal static ContainerAppLogin DeserializeContainerAppLogin(JsonElement eleme nonce = ContainerAppLoginNonce.DeserializeContainerAppLoginNonce(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppLogin(routes.Value, Optional.ToNullable(preserveUrlFragmentsForLogins), Optional.ToList(allowedExternalRedirectUrls), cookieExpiration.Value, nonce.Value, serializedAdditionalRawData); + } + + ContainerAppLogin IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppLogin(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppLogin IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppLogin(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppLogin model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppLogin(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppLogin(routes.Value, Optional.ToNullable(preserveUrlFragmentsForLogins), Optional.ToList(allowedExternalRedirectUrls), cookieExpiration.Value, nonce.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppLogin(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.cs index 81c0b6c10ca4..d569e24c3549 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogin.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. public partial class ContainerAppLogin { - /// Initializes a new instance of ContainerAppLogin. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppLogin() { AllowedExternalRedirectUrls = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppLogin. + /// Initializes a new instance of . /// The routes that specify the endpoints used for login and logout requests. /// <code>true</code> if the fragments from the request are preserved after the login request is made; otherwise, <code>false</code>. /// @@ -29,13 +33,15 @@ public ContainerAppLogin() /// /// The configuration settings of the session cookie's expiration. /// The configuration settings of the nonce used in the login flow. - internal ContainerAppLogin(LoginRoutes routes, bool? preserveUrlFragmentsForLogins, IList allowedExternalRedirectUrls, ContainerAppCookieExpiration cookieExpiration, ContainerAppLoginNonce nonce) + /// Keeps track of any properties unknown to the library. + internal ContainerAppLogin(LoginRoutes routes, bool? preserveUrlFragmentsForLogins, IList allowedExternalRedirectUrls, ContainerAppCookieExpiration cookieExpiration, ContainerAppLoginNonce nonce, Dictionary serializedAdditionalRawData) { Routes = routes; PreserveUrlFragmentsForLogins = preserveUrlFragmentsForLogins; AllowedExternalRedirectUrls = allowedExternalRedirectUrls; CookieExpiration = cookieExpiration; Nonce = nonce; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The routes that specify the endpoints used for login and logout requests. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.Serialization.cs index 6b4a06701cae..55a246de88f4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppLoginNonce : IUtf8JsonSerializable + public partial class ContainerAppLoginNonce : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ValidateNonce)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("nonceExpirationInterval"u8); writer.WriteStringValue(NonceExpirationInterval); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppLoginNonce DeserializeContainerAppLoginNonce(JsonElement element) + internal static ContainerAppLoginNonce DeserializeContainerAppLoginNonce(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional validateNonce = default; Optional nonceExpirationInterval = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("validateNonce"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppLoginNonce DeserializeContainerAppLoginNonce(JsonEle nonceExpirationInterval = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppLoginNonce(Optional.ToNullable(validateNonce), nonceExpirationInterval.Value, serializedAdditionalRawData); + } + + ContainerAppLoginNonce IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppLoginNonce(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppLoginNonce IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppLoginNonce(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppLoginNonce model) + { + if (model is null) + { + return null; } - return new ContainerAppLoginNonce(Optional.ToNullable(validateNonce), nonceExpirationInterval.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppLoginNonce(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppLoginNonce(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.cs index 361cee375181..b7ae36114950 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLoginNonce.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the nonce used in the login flow. public partial class ContainerAppLoginNonce { - /// Initializes a new instance of ContainerAppLoginNonce. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppLoginNonce() { } - /// Initializes a new instance of ContainerAppLoginNonce. + /// Initializes a new instance of . /// <code>false</code> if the nonce should not be validated while completing the login flow; otherwise, <code>true</code>. /// The time after the request is made when the nonce should expire. - internal ContainerAppLoginNonce(bool? validateNonce, string nonceExpirationInterval) + /// Keeps track of any properties unknown to the library. + internal ContainerAppLoginNonce(bool? validateNonce, string nonceExpirationInterval, Dictionary serializedAdditionalRawData) { ValidateNonce = validateNonce; NonceExpirationInterval = nonceExpirationInterval; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the nonce should not be validated while completing the login flow; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.Serialization.cs index b4f253a31190..4f59d72a15cc 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppLogsConfiguration : IUtf8JsonSerializable + public partial class ContainerAppLogsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Destination)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LogAnalyticsConfiguration)) { writer.WritePropertyName("logAnalyticsConfiguration"u8); - writer.WriteObjectValue(LogAnalyticsConfiguration); + if (LogAnalyticsConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogAnalyticsConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppLogsConfiguration DeserializeContainerAppLogsConfiguration(JsonElement element) + internal static ContainerAppLogsConfiguration DeserializeContainerAppLogsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional destination = default; Optional logAnalyticsConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("destination"u8)) @@ -52,8 +82,61 @@ internal static ContainerAppLogsConfiguration DeserializeContainerAppLogsConfigu logAnalyticsConfiguration = ContainerAppLogAnalyticsConfiguration.DeserializeContainerAppLogAnalyticsConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppLogsConfiguration(destination.Value, logAnalyticsConfiguration.Value, serializedAdditionalRawData); + } + + ContainerAppLogsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppLogsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppLogsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppLogsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppLogsConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppLogsConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppLogsConfiguration(destination.Value, logAnalyticsConfiguration.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppLogsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.cs index 8d1d08f85df3..fc085ccc42ae 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppLogsConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Configuration of application logs. public partial class ContainerAppLogsConfiguration { - /// Initializes a new instance of ContainerAppLogsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppLogsConfiguration() { } - /// Initializes a new instance of ContainerAppLogsConfiguration. + /// Initializes a new instance of . /// Logs destination, can be 'log-analytics', 'azure-monitor' or 'none'. /// Log Analytics configuration, must only be provided when destination is configured as 'log-analytics'. - internal ContainerAppLogsConfiguration(string destination, ContainerAppLogAnalyticsConfiguration logAnalyticsConfiguration) + /// Keeps track of any properties unknown to the library. + internal ContainerAppLogsConfiguration(string destination, ContainerAppLogAnalyticsConfiguration logAnalyticsConfiguration, Dictionary serializedAdditionalRawData) { Destination = destination; LogAnalyticsConfiguration = logAnalyticsConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Logs destination, can be 'log-analytics', 'azure-monitor' or 'none'. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificateData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificateData.Serialization.cs index ccedfec1af21..d23265fde247 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificateData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificateData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppManagedCertificateData : IUtf8JsonSerializable + public partial class ContainerAppManagedCertificateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppManagedCertificateData DeserializeContainerAppManagedCertificateData(JsonElement element) + internal static ContainerAppManagedCertificateData DeserializeContainerAppManagedCertificateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +80,7 @@ internal static ContainerAppManagedCertificateData DeserializeContainerAppManage string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -106,8 +135,61 @@ internal static ContainerAppManagedCertificateData DeserializeContainerAppManage systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppManagedCertificateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, serializedAdditionalRawData); + } + + ContainerAppManagedCertificateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppManagedCertificateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppManagedCertificateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppManagedCertificateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppManagedCertificateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppManagedCertificateData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppManagedCertificateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppManagedCertificateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.Serialization.cs index 10259dece6a1..3e8854d9dad0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppManagedCertificatePatch : IUtf8JsonSerializable + public partial class ContainerAppManagedCertificatePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerAppManagedCertificatePatch DeserializeContainerAppManagedCertificatePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppManagedCertificatePatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ContainerAppManagedCertificatePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppManagedCertificatePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppManagedCertificatePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppManagedCertificatePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppManagedCertificatePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppManagedCertificatePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppManagedCertificatePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.cs index 09118a579498..471f9d217ff4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedCertificatePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.AppContainers.Models /// A managed certificate to update. public partial class ContainerAppManagedCertificatePatch { - /// Initializes a new instance of ContainerAppManagedCertificatePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppManagedCertificatePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Application-specific metadata in the form of key-value pairs. + /// Keeps track of any properties unknown to the library. + internal ContainerAppManagedCertificatePatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Application-specific metadata in the form of key-value pairs. public IDictionary Tags { get; } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentData.Serialization.cs index e3283cae239c..c4fd43546244 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppManagedEnvironmentData : IUtf8JsonSerializable + public partial class ContainerAppManagedEnvironmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -52,12 +59,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VnetConfiguration)) { writer.WritePropertyName("vnetConfiguration"u8); - writer.WriteObjectValue(VnetConfiguration); + if (VnetConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VnetConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(AppLogsConfiguration)) { writer.WritePropertyName("appLogsConfiguration"u8); - writer.WriteObjectValue(AppLogsConfiguration); + if (AppLogsConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AppLogsConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(IsZoneRedundant)) { @@ -67,7 +88,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CustomDomainConfiguration)) { writer.WritePropertyName("customDomainConfiguration"u8); - writer.WriteObjectValue(CustomDomainConfiguration); + if (CustomDomainConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomDomainConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(WorkloadProfiles)) { @@ -75,19 +103,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in WorkloadProfiles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(KedaConfiguration)) { writer.WritePropertyName("kedaConfiguration"u8); - writer.WriteObjectValue(KedaConfiguration); + if (KedaConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KedaConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(DaprConfiguration)) { writer.WritePropertyName("daprConfiguration"u8); - writer.WriteObjectValue(DaprConfiguration); + if (DaprConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DaprConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(InfrastructureResourceGroup)) { @@ -97,14 +146,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PeerAuthentication)) { writer.WritePropertyName("peerAuthentication"u8); - writer.WriteObjectValue(PeerAuthentication); + if (PeerAuthentication is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PeerAuthentication).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppManagedEnvironmentData DeserializeContainerAppManagedEnvironmentData(JsonElement element) + internal static ContainerAppManagedEnvironmentData DeserializeContainerAppManagedEnvironmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -132,6 +202,7 @@ internal static ContainerAppManagedEnvironmentData DeserializeContainerAppManage Optional daprConfiguration = default; Optional infrastructureResourceGroup = default; Optional peerAuthentication = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -319,8 +390,61 @@ internal static ContainerAppManagedEnvironmentData DeserializeContainerAppManage } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppManagedEnvironmentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kind.Value, Optional.ToNullable(provisioningState), daprAIInstrumentationKey.Value, daprAIConnectionString.Value, vnetConfiguration.Value, deploymentErrors.Value, defaultDomain.Value, staticIP.Value, appLogsConfiguration.Value, Optional.ToNullable(zoneRedundant), customDomainConfiguration.Value, eventStreamEndpoint.Value, Optional.ToList(workloadProfiles), kedaConfiguration.Value, daprConfiguration.Value, infrastructureResourceGroup.Value, peerAuthentication.Value, serializedAdditionalRawData); + } + + ContainerAppManagedEnvironmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppManagedEnvironmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppManagedEnvironmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppManagedEnvironmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppManagedEnvironmentData model) + { + if (model is null) + { + return null; } - return new ContainerAppManagedEnvironmentData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kind.Value, Optional.ToNullable(provisioningState), daprAIInstrumentationKey.Value, daprAIConnectionString.Value, vnetConfiguration.Value, deploymentErrors.Value, defaultDomain.Value, staticIP.Value, appLogsConfiguration.Value, Optional.ToNullable(zoneRedundant), customDomainConfiguration.Value, eventStreamEndpoint.Value, Optional.ToList(workloadProfiles), kedaConfiguration.Value, daprConfiguration.Value, infrastructureResourceGroup.Value, peerAuthentication.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppManagedEnvironmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppManagedEnvironmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentStorageData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentStorageData.Serialization.cs index 097bf7a6959a..67dc5fa39f13 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentStorageData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppManagedEnvironmentStorageData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppManagedEnvironmentStorageData : IUtf8JsonSerializable + public partial class ContainerAppManagedEnvironmentStorageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppManagedEnvironmentStorageData DeserializeContainerAppManagedEnvironmentStorageData(JsonElement element) + internal static ContainerAppManagedEnvironmentStorageData DeserializeContainerAppManagedEnvironmentStorageData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static ContainerAppManagedEnvironmentStorageData DeserializeContainerAp string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static ContainerAppManagedEnvironmentStorageData DeserializeContainerAp systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppManagedEnvironmentStorageData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ContainerAppManagedEnvironmentStorageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppManagedEnvironmentStorageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppManagedEnvironmentStorageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppManagedEnvironmentStorageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppManagedEnvironmentStorageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppManagedEnvironmentStorageData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppManagedEnvironmentStorageData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppManagedEnvironmentStorageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.Serialization.cs index a73afd967fce..c56898a22a42 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppNameAvailabilityContent : IUtf8JsonSerializable + public partial class ContainerAppNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,103 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerAppNameAvailabilityContent DeserializeContainerAppNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppNameAvailabilityContent(name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + ContainerAppNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.cs index c77dd1812e41..3abf36daa6b9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -12,11 +14,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// The check availability request body. public partial class ContainerAppNameAvailabilityContent { - /// Initializes a new instance of ContainerAppNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppNameAvailabilityContent() { } + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal ContainerAppNameAvailabilityContent(string name, ResourceType? resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the resource for which availability needs to be checked. public string Name { get; set; } /// The resource type. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.Serialization.cs index 949cbd25ec66..6aa2ee544a1c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppNameAvailabilityResult + public partial class ContainerAppNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppNameAvailabilityResult DeserializeContainerAppNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppNameAvailabilityResult DeserializeContainerAppNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ContainerAppNameAvailabilityResult DeserializeContainerAppNameAv Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +90,61 @@ internal static ContainerAppNameAvailabilityResult DeserializeContainerAppNameAv message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new ContainerAppNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + ContainerAppNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.cs index ec64855ba841..f9ebf159485d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The check availability result. public partial class ContainerAppNameAvailabilityResult { - /// Initializes a new instance of ContainerAppNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppNameAvailabilityResult() { } - /// Initializes a new instance of ContainerAppNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. - internal ContainerAppNameAvailabilityResult(bool? isNameAvailable, ContainerAppNameUnavailableReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal ContainerAppNameAvailabilityResult(bool? isNameAvailable, ContainerAppNameUnavailableReason? reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the resource name is available. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.Serialization.cs index d606a8a94659..903b9b2787b7 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppOpenIdConnectClientCredential : IUtf8JsonSerializable + public partial class ContainerAppOpenIdConnectClientCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Method)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecretSettingName"u8); writer.WriteStringValue(ClientSecretSettingName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppOpenIdConnectClientCredential DeserializeContainerAppOpenIdConnectClientCredential(JsonElement element) + internal static ContainerAppOpenIdConnectClientCredential DeserializeContainerAppOpenIdConnectClientCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional method = default; Optional clientSecretSettingName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("method"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppOpenIdConnectClientCredential DeserializeContainerAp clientSecretSettingName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppOpenIdConnectClientCredential(Optional.ToNullable(method), clientSecretSettingName.Value, serializedAdditionalRawData); + } + + ContainerAppOpenIdConnectClientCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppOpenIdConnectClientCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppOpenIdConnectClientCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppOpenIdConnectClientCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppOpenIdConnectClientCredential model) + { + if (model is null) + { + return null; } - return new ContainerAppOpenIdConnectClientCredential(Optional.ToNullable(method), clientSecretSettingName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppOpenIdConnectClientCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppOpenIdConnectClientCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.cs index c341421e7b82..30f24881713a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectClientCredential.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The authentication client credentials of the custom Open ID Connect provider. public partial class ContainerAppOpenIdConnectClientCredential { - /// Initializes a new instance of ContainerAppOpenIdConnectClientCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppOpenIdConnectClientCredential() { } - /// Initializes a new instance of ContainerAppOpenIdConnectClientCredential. + /// Initializes a new instance of . /// The method that should be used to authenticate the user. /// The app setting that contains the client secret for the custom Open ID Connect provider. - internal ContainerAppOpenIdConnectClientCredential(ContainerAppOpenIdConnectClientCredentialMethod? method, string clientSecretSettingName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppOpenIdConnectClientCredential(ContainerAppOpenIdConnectClientCredentialMethod? method, string clientSecretSettingName, Dictionary serializedAdditionalRawData) { Method = method; ClientSecretSettingName = clientSecretSettingName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The method that should be used to authenticate the user. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.Serialization.cs index d8fc7967b988..2177952ab4ef 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppOpenIdConnectConfig : IUtf8JsonSerializable + public partial class ContainerAppOpenIdConnectConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AuthorizationEndpoint)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("wellKnownOpenIdConfiguration"u8); writer.WriteStringValue(WellKnownOpenIdConfiguration); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppOpenIdConnectConfig DeserializeContainerAppOpenIdConnectConfig(JsonElement element) + internal static ContainerAppOpenIdConnectConfig DeserializeContainerAppOpenIdConnectConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static ContainerAppOpenIdConnectConfig DeserializeContainerAppOpenIdCon Optional issuer = default; Optional certificationUri = default; Optional wellKnownOpenIdConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authorizationEndpoint"u8)) @@ -86,8 +108,61 @@ internal static ContainerAppOpenIdConnectConfig DeserializeContainerAppOpenIdCon wellKnownOpenIdConfiguration = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppOpenIdConnectConfig(authorizationEndpoint.Value, tokenEndpoint.Value, issuer.Value, certificationUri.Value, wellKnownOpenIdConfiguration.Value, serializedAdditionalRawData); + } + + ContainerAppOpenIdConnectConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppOpenIdConnectConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppOpenIdConnectConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppOpenIdConnectConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppOpenIdConnectConfig model) + { + if (model is null) + { + return null; } - return new ContainerAppOpenIdConnectConfig(authorizationEndpoint.Value, tokenEndpoint.Value, issuer.Value, certificationUri.Value, wellKnownOpenIdConfiguration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppOpenIdConnectConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppOpenIdConnectConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.cs index dcee99c1cd91..82366eb46430 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectConfig.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the endpoints used for the custom Open ID Connect provider. public partial class ContainerAppOpenIdConnectConfig { - /// Initializes a new instance of ContainerAppOpenIdConnectConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppOpenIdConnectConfig() { } - /// Initializes a new instance of ContainerAppOpenIdConnectConfig. + /// Initializes a new instance of . /// The endpoint to be used to make an authorization request. /// The endpoint to be used to request a token. /// The endpoint that issues the token. /// The endpoint that provides the keys necessary to validate the token. /// The endpoint that contains all the configuration endpoints for the provider. - internal ContainerAppOpenIdConnectConfig(string authorizationEndpoint, string tokenEndpoint, string issuer, Uri certificationUri, string wellKnownOpenIdConfiguration) + /// Keeps track of any properties unknown to the library. + internal ContainerAppOpenIdConnectConfig(string authorizationEndpoint, string tokenEndpoint, string issuer, Uri certificationUri, string wellKnownOpenIdConfiguration, Dictionary serializedAdditionalRawData) { AuthorizationEndpoint = authorizationEndpoint; TokenEndpoint = tokenEndpoint; Issuer = issuer; CertificationUri = certificationUri; WellKnownOpenIdConfiguration = wellKnownOpenIdConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The endpoint to be used to make an authorization request. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.Serialization.cs index f001e4828149..edd2925c7616 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppOpenIdConnectLogin : IUtf8JsonSerializable + public partial class ContainerAppOpenIdConnectLogin : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NameClaimType)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppOpenIdConnectLogin DeserializeContainerAppOpenIdConnectLogin(JsonElement element) + internal static ContainerAppOpenIdConnectLogin DeserializeContainerAppOpenIdConnectLogin(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional nameClaimType = default; Optional> scopes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameClaimType"u8)) @@ -63,8 +85,61 @@ internal static ContainerAppOpenIdConnectLogin DeserializeContainerAppOpenIdConn scopes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppOpenIdConnectLogin(nameClaimType.Value, Optional.ToList(scopes), serializedAdditionalRawData); + } + + ContainerAppOpenIdConnectLogin IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppOpenIdConnectLogin(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppOpenIdConnectLogin IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppOpenIdConnectLogin(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppOpenIdConnectLogin model) + { + if (model is null) + { + return null; } - return new ContainerAppOpenIdConnectLogin(nameClaimType.Value, Optional.ToList(scopes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppOpenIdConnectLogin(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppOpenIdConnectLogin(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.cs index bbb8a128ab96..e73939c71675 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectLogin.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the login flow of the custom Open ID Connect provider. public partial class ContainerAppOpenIdConnectLogin { - /// Initializes a new instance of ContainerAppOpenIdConnectLogin. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppOpenIdConnectLogin() { Scopes = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppOpenIdConnectLogin. + /// Initializes a new instance of . /// The name of the claim that contains the users name. /// A list of the scopes that should be requested while authenticating. - internal ContainerAppOpenIdConnectLogin(string nameClaimType, IList scopes) + /// Keeps track of any properties unknown to the library. + internal ContainerAppOpenIdConnectLogin(string nameClaimType, IList scopes, Dictionary serializedAdditionalRawData) { NameClaimType = nameClaimType; Scopes = scopes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the claim that contains the users name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.Serialization.cs index b2d02a920027..4db8810afdc5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppOpenIdConnectRegistration : IUtf8JsonSerializable + public partial class ContainerAppOpenIdConnectRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientId)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ClientCredential)) { writer.WritePropertyName("clientCredential"u8); - writer.WriteObjectValue(ClientCredential); + if (ClientCredential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientCredential).Serialize(writer, options); + } } if (Optional.IsDefined(OpenIdConnectConfiguration)) { writer.WritePropertyName("openIdConnectConfiguration"u8); - writer.WriteObjectValue(OpenIdConnectConfiguration); + if (OpenIdConnectConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OpenIdConnectConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppOpenIdConnectRegistration DeserializeContainerAppOpenIdConnectRegistration(JsonElement element) + internal static ContainerAppOpenIdConnectRegistration DeserializeContainerAppOpenIdConnectRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static ContainerAppOpenIdConnectRegistration DeserializeContainerAppOpe Optional clientId = default; Optional clientCredential = default; Optional openIdConnectConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -67,8 +104,61 @@ internal static ContainerAppOpenIdConnectRegistration DeserializeContainerAppOpe openIdConnectConfiguration = ContainerAppOpenIdConnectConfig.DeserializeContainerAppOpenIdConnectConfig(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppOpenIdConnectRegistration(clientId.Value, clientCredential.Value, openIdConnectConfiguration.Value, serializedAdditionalRawData); + } + + ContainerAppOpenIdConnectRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppOpenIdConnectRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppOpenIdConnectRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppOpenIdConnectRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppOpenIdConnectRegistration model) + { + if (model is null) + { + return null; } - return new ContainerAppOpenIdConnectRegistration(clientId.Value, clientCredential.Value, openIdConnectConfiguration.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppOpenIdConnectRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppOpenIdConnectRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.cs index b551da1e2b0b..84f6bd2edf13 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppOpenIdConnectRegistration.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the app registration for the custom Open ID Connect provider. public partial class ContainerAppOpenIdConnectRegistration { - /// Initializes a new instance of ContainerAppOpenIdConnectRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppOpenIdConnectRegistration() { } - /// Initializes a new instance of ContainerAppOpenIdConnectRegistration. + /// Initializes a new instance of . /// The client id of the custom Open ID Connect provider. /// The authentication credentials of the custom Open ID Connect provider. /// The configuration settings of the endpoints used for the custom Open ID Connect provider. - internal ContainerAppOpenIdConnectRegistration(string clientId, ContainerAppOpenIdConnectClientCredential clientCredential, ContainerAppOpenIdConnectConfig openIdConnectConfiguration) + /// Keeps track of any properties unknown to the library. + internal ContainerAppOpenIdConnectRegistration(string clientId, ContainerAppOpenIdConnectClientCredential clientCredential, ContainerAppOpenIdConnectConfig openIdConnectConfiguration, Dictionary serializedAdditionalRawData) { ClientId = clientId; ClientCredential = clientCredential; OpenIdConnectConfiguration = openIdConnectConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The client id of the custom Open ID Connect provider. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.Serialization.cs index 329ae9f9b927..ac24b0a01a87 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppProbe : IUtf8JsonSerializable + public partial class ContainerAppProbe : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FailureThreshold)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HttpGet)) { writer.WritePropertyName("httpGet"u8); - writer.WriteObjectValue(HttpGet); + if (HttpGet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HttpGet).Serialize(writer, options); + } } if (Optional.IsDefined(InitialDelaySeconds)) { @@ -43,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TcpSocket)) { writer.WritePropertyName("tcpSocket"u8); - writer.WriteObjectValue(TcpSocket); + if (TcpSocket is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TcpSocket).Serialize(writer, options); + } } if (Optional.IsDefined(TerminationGracePeriodSeconds)) { @@ -60,11 +82,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ProbeType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppProbe DeserializeContainerAppProbe(JsonElement element) + internal static ContainerAppProbe DeserializeContainerAppProbe(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +114,7 @@ internal static ContainerAppProbe DeserializeContainerAppProbe(JsonElement eleme Optional terminationGracePeriodSeconds = default; Optional timeoutSeconds = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("failureThreshold"u8)) @@ -161,8 +198,61 @@ internal static ContainerAppProbe DeserializeContainerAppProbe(JsonElement eleme type = new ContainerAppProbeType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppProbe(Optional.ToNullable(failureThreshold), httpGet.Value, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(successThreshold), tcpSocket.Value, Optional.ToNullable(terminationGracePeriodSeconds), Optional.ToNullable(timeoutSeconds), Optional.ToNullable(type), serializedAdditionalRawData); + } + + ContainerAppProbe IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppProbe(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppProbe IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppProbe(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppProbe model) + { + if (model is null) + { + return null; } - return new ContainerAppProbe(Optional.ToNullable(failureThreshold), httpGet.Value, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(successThreshold), tcpSocket.Value, Optional.ToNullable(terminationGracePeriodSeconds), Optional.ToNullable(timeoutSeconds), Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppProbe(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppProbe(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.cs index e1559925486c..0decd642e663 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppProbe.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. public partial class ContainerAppProbe { - /// Initializes a new instance of ContainerAppProbe. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppProbe() { } - /// Initializes a new instance of ContainerAppProbe. + /// Initializes a new instance of . /// Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. /// HTTPGet specifies the http request to perform. /// Number of seconds after the container has started before liveness probes are initiated. Minimum value is 1. Maximum value is 60. @@ -25,7 +31,8 @@ public ContainerAppProbe() /// Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. Maximum value is 3600 seconds (1 hour). /// Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 240. /// The type of probe. - internal ContainerAppProbe(int? failureThreshold, ContainerAppHttpRequestInfo httpGet, int? initialDelaySeconds, int? periodSeconds, int? successThreshold, ContainerAppTcpSocketRequestInfo tcpSocket, long? terminationGracePeriodSeconds, int? timeoutSeconds, ContainerAppProbeType? probeType) + /// Keeps track of any properties unknown to the library. + internal ContainerAppProbe(int? failureThreshold, ContainerAppHttpRequestInfo httpGet, int? initialDelaySeconds, int? periodSeconds, int? successThreshold, ContainerAppTcpSocketRequestInfo tcpSocket, long? terminationGracePeriodSeconds, int? timeoutSeconds, ContainerAppProbeType? probeType, Dictionary serializedAdditionalRawData) { FailureThreshold = failureThreshold; HttpGet = httpGet; @@ -36,6 +43,7 @@ internal ContainerAppProbe(int? failureThreshold, ContainerAppHttpRequestInfo ht TerminationGracePeriodSeconds = terminationGracePeriodSeconds; TimeoutSeconds = timeoutSeconds; ProbeType = probeType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.Serialization.cs index 51c063aab5e6..fd05fe672482 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppQueueScaleRule : IUtf8JsonSerializable + public partial class ContainerAppQueueScaleRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QueueName)) { @@ -32,15 +39,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Auth) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppQueueScaleRule DeserializeContainerAppQueueScaleRule(JsonElement element) + internal static ContainerAppQueueScaleRule DeserializeContainerAppQueueScaleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static ContainerAppQueueScaleRule DeserializeContainerAppQueueScaleRule Optional queueName = default; Optional queueLength = default; Optional> auth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queueName"u8)) @@ -78,8 +107,61 @@ internal static ContainerAppQueueScaleRule DeserializeContainerAppQueueScaleRule auth = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppQueueScaleRule(queueName.Value, Optional.ToNullable(queueLength), Optional.ToList(auth), serializedAdditionalRawData); + } + + ContainerAppQueueScaleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppQueueScaleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppQueueScaleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppQueueScaleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppQueueScaleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppQueueScaleRule(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppQueueScaleRule(queueName.Value, Optional.ToNullable(queueLength), Optional.ToList(auth)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppQueueScaleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.cs index 075ada299d7d..d10afcb6d95d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppQueueScaleRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App container Azure Queue based scaling rule. public partial class ContainerAppQueueScaleRule { - /// Initializes a new instance of ContainerAppQueueScaleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppQueueScaleRule() { Auth = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppQueueScaleRule. + /// Initializes a new instance of . /// Queue name. /// Queue length. /// Authentication secrets for the queue scale rule. - internal ContainerAppQueueScaleRule(string queueName, int? queueLength, IList auth) + /// Keeps track of any properties unknown to the library. + internal ContainerAppQueueScaleRule(string queueName, int? queueLength, IList auth, Dictionary serializedAdditionalRawData) { QueueName = queueName; QueueLength = queueLength; Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Queue name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.Serialization.cs index 3085acc6ba64..f106a6a4801f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppRegistration : IUtf8JsonSerializable + public partial class ContainerAppRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AppId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("appSecretSettingName"u8); writer.WriteStringValue(AppSecretSettingName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppRegistration DeserializeContainerAppRegistration(JsonElement element) + internal static ContainerAppRegistration DeserializeContainerAppRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional appId = default; Optional appSecretSettingName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("appId"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppRegistration DeserializeContainerAppRegistration(Jso appSecretSettingName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppRegistration(appId.Value, appSecretSettingName.Value, serializedAdditionalRawData); + } + + ContainerAppRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppRegistration model) + { + if (model is null) + { + return null; } - return new ContainerAppRegistration(appId.Value, appSecretSettingName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.cs index a1802d1fe096..f06a70cd9a2c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the app registration for providers that have app ids and app secrets. public partial class ContainerAppRegistration { - /// Initializes a new instance of ContainerAppRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppRegistration() { } - /// Initializes a new instance of ContainerAppRegistration. + /// Initializes a new instance of . /// The App ID of the app used for login. /// The app setting name that contains the app secret. - internal ContainerAppRegistration(string appId, string appSecretSettingName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppRegistration(string appId, string appSecretSettingName, Dictionary serializedAdditionalRawData) { AppId = appId; AppSecretSettingName = appSecretSettingName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The App ID of the app used for login. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.Serialization.cs index 905851e67336..c5a4516f3d55 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppRegistryCredentials : IUtf8JsonSerializable + public partial class ContainerAppRegistryCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Server)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"u8); writer.WriteStringValue(Identity); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppRegistryCredentials DeserializeContainerAppRegistryCredentials(JsonElement element) + internal static ContainerAppRegistryCredentials DeserializeContainerAppRegistryCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerAppRegistryCredentials DeserializeContainerAppRegistryC Optional username = default; Optional passwordSecretRef = default; Optional identity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("server"u8)) @@ -70,8 +93,61 @@ internal static ContainerAppRegistryCredentials DeserializeContainerAppRegistryC identity = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppRegistryCredentials(server.Value, username.Value, passwordSecretRef.Value, identity.Value, serializedAdditionalRawData); + } + + ContainerAppRegistryCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppRegistryCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppRegistryCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppRegistryCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppRegistryCredentials model) + { + if (model is null) + { + return null; } - return new ContainerAppRegistryCredentials(server.Value, username.Value, passwordSecretRef.Value, identity.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppRegistryCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppRegistryCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.cs index 1a01a3ecf6ec..189bd34b1cee 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryCredentials.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App Private Registry. public partial class ContainerAppRegistryCredentials { - /// Initializes a new instance of ContainerAppRegistryCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppRegistryCredentials() { } - /// Initializes a new instance of ContainerAppRegistryCredentials. + /// Initializes a new instance of . /// Container Registry Server. /// Container Registry Username. /// The name of the Secret that contains the registry login password. /// A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned identities, use 'system'. - internal ContainerAppRegistryCredentials(string server, string username, string passwordSecretRef, string identity) + /// Keeps track of any properties unknown to the library. + internal ContainerAppRegistryCredentials(string server, string username, string passwordSecretRef, string identity, Dictionary serializedAdditionalRawData) { Server = server; Username = username; PasswordSecretRef = passwordSecretRef; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container Registry Server. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.Serialization.cs index 613680ecd96b..bec5d07d8869 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppRegistryInfo : IUtf8JsonSerializable + public partial class ContainerAppRegistryInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RegistryServer)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("registryPassword"u8); writer.WriteStringValue(RegistryPassword); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppRegistryInfo DeserializeContainerAppRegistryInfo(JsonElement element) + internal static ContainerAppRegistryInfo DeserializeContainerAppRegistryInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppRegistryInfo DeserializeContainerAppRegistryInfo(Jso Optional registryUrl = default; Optional registryUserName = default; Optional registryPassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registryUrl"u8)) @@ -59,8 +82,61 @@ internal static ContainerAppRegistryInfo DeserializeContainerAppRegistryInfo(Jso registryPassword = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppRegistryInfo(registryUrl.Value, registryUserName.Value, registryPassword.Value, serializedAdditionalRawData); + } + + ContainerAppRegistryInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppRegistryInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppRegistryInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppRegistryInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppRegistryInfo model) + { + if (model is null) + { + return null; } - return new ContainerAppRegistryInfo(registryUrl.Value, registryUserName.Value, registryPassword.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppRegistryInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppRegistryInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.cs index b3ab202920b7..92ea807050c1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRegistryInfo.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App registry information. public partial class ContainerAppRegistryInfo { - /// Initializes a new instance of ContainerAppRegistryInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppRegistryInfo() { } - /// Initializes a new instance of ContainerAppRegistryInfo. + /// Initializes a new instance of . /// registry server Url. /// registry username. /// registry secret. - internal ContainerAppRegistryInfo(string registryServer, string registryUserName, string registryPassword) + /// Keeps track of any properties unknown to the library. + internal ContainerAppRegistryInfo(string registryServer, string registryUserName, string registryPassword, Dictionary serializedAdditionalRawData) { RegistryServer = registryServer; RegistryUserName = registryUserName; RegistryPassword = registryPassword; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// registry server Url. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.Serialization.cs index a18bc071060c..066f7a017119 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppReplicaContainer : IUtf8JsonSerializable + public partial class ContainerAppReplicaContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("restartCount"u8); writer.WriteNumberValue(RestartCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppReplicaContainer DeserializeContainerAppReplicaContainer(JsonElement element) + internal static ContainerAppReplicaContainer DeserializeContainerAppReplicaContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +80,7 @@ internal static ContainerAppReplicaContainer DeserializeContainerAppReplicaConta Optional runningStateDetails = default; Optional logStreamEndpoint = default; Optional execEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -121,8 +144,61 @@ internal static ContainerAppReplicaContainer DeserializeContainerAppReplicaConta execEndpoint = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppReplicaContainer(name.Value, containerId.Value, Optional.ToNullable(ready), Optional.ToNullable(started), Optional.ToNullable(restartCount), Optional.ToNullable(runningState), runningStateDetails.Value, logStreamEndpoint.Value, execEndpoint.Value, serializedAdditionalRawData); + } + + ContainerAppReplicaContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppReplicaContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppReplicaContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppReplicaContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppReplicaContainer model) + { + if (model is null) + { + return null; } - return new ContainerAppReplicaContainer(name.Value, containerId.Value, Optional.ToNullable(ready), Optional.ToNullable(started), Optional.ToNullable(restartCount), Optional.ToNullable(runningState), runningStateDetails.Value, logStreamEndpoint.Value, execEndpoint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppReplicaContainer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppReplicaContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.cs index 7ad01e82c03f..b9a528b5f163 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaContainer.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container object under Container App Revision Replica. public partial class ContainerAppReplicaContainer { - /// Initializes a new instance of ContainerAppReplicaContainer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppReplicaContainer() { } - /// Initializes a new instance of ContainerAppReplicaContainer. + /// Initializes a new instance of . /// The Name of the Container. /// The Id of the Container. /// The container ready status. @@ -25,7 +31,8 @@ public ContainerAppReplicaContainer() /// The details of container current running state. /// Log Stream endpoint. /// Container exec endpoint. - internal ContainerAppReplicaContainer(string name, string containerId, bool? isReady, bool? isStarted, int? restartCount, ContainerAppContainerRunningState? runningState, string runningStateDetails, string logStreamEndpoint, string execEndpoint) + /// Keeps track of any properties unknown to the library. + internal ContainerAppReplicaContainer(string name, string containerId, bool? isReady, bool? isStarted, int? restartCount, ContainerAppContainerRunningState? runningState, string runningStateDetails, string logStreamEndpoint, string execEndpoint, Dictionary serializedAdditionalRawData) { Name = name; ContainerId = containerId; @@ -36,6 +43,7 @@ internal ContainerAppReplicaContainer(string name, string containerId, bool? isR RunningStateDetails = runningStateDetails; LogStreamEndpoint = logStreamEndpoint; ExecEndpoint = execEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Name of the Container. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaData.Serialization.cs index d5ac6c17498d..c9b00d920458 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppReplicaData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppReplicaData : IUtf8JsonSerializable + public partial class ContainerAppReplicaData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -27,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Containers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,16 +50,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in InitContainers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppReplicaData DeserializeContainerAppReplicaData(JsonElement element) + internal static ContainerAppReplicaData DeserializeContainerAppReplicaData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +94,7 @@ internal static ContainerAppReplicaData DeserializeContainerAppReplicaData(JsonE Optional runningStateDetails = default; Optional> containers = default; Optional> initContainers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -149,8 +184,61 @@ internal static ContainerAppReplicaData DeserializeContainerAppReplicaData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppReplicaData(id, name, type, systemData.Value, Optional.ToNullable(createdTime), Optional.ToNullable(runningState), runningStateDetails.Value, Optional.ToList(containers), Optional.ToList(initContainers), serializedAdditionalRawData); + } + + ContainerAppReplicaData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppReplicaData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppReplicaData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppReplicaData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppReplicaData model) + { + if (model is null) + { + return null; } - return new ContainerAppReplicaData(id, name, type, systemData.Value, Optional.ToNullable(createdTime), Optional.ToNullable(runningState), runningStateDetails.Value, Optional.ToList(containers), Optional.ToList(initContainers)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppReplicaData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppReplicaData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionData.Serialization.cs index 92ac2b06bc92..719cb573f2bd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionData.Serialization.cs @@ -6,26 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppRevisionData : IUtf8JsonSerializable + public partial class ContainerAppRevisionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppRevisionData DeserializeContainerAppRevisionData(JsonElement element) + internal static ContainerAppRevisionData DeserializeContainerAppRevisionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +66,7 @@ internal static ContainerAppRevisionData DeserializeContainerAppRevisionData(Jso Optional healthState = default; Optional provisioningState = default; Optional runningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -174,8 +196,61 @@ internal static ContainerAppRevisionData DeserializeContainerAppRevisionData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppRevisionData(id, name, type, systemData.Value, Optional.ToNullable(createdTime), Optional.ToNullable(lastActiveTime), fqdn.Value, template.Value, Optional.ToNullable(active), Optional.ToNullable(replicas), Optional.ToNullable(trafficWeight), provisioningError.Value, Optional.ToNullable(healthState), Optional.ToNullable(provisioningState), Optional.ToNullable(runningState), serializedAdditionalRawData); + } + + ContainerAppRevisionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppRevisionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppRevisionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppRevisionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppRevisionData model) + { + if (model is null) + { + return null; } - return new ContainerAppRevisionData(id, name, type, systemData.Value, Optional.ToNullable(createdTime), Optional.ToNullable(lastActiveTime), fqdn.Value, template.Value, Optional.ToNullable(active), Optional.ToNullable(replicas), Optional.ToNullable(trafficWeight), provisioningError.Value, Optional.ToNullable(healthState), Optional.ToNullable(provisioningState), Optional.ToNullable(runningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppRevisionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppRevisionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.Serialization.cs index 3a22e5abdd79..d6ef2dfda164 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppRevisionTrafficWeight : IUtf8JsonSerializable + public partial class ContainerAppRevisionTrafficWeight : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RevisionName)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("label"u8); writer.WriteStringValue(Label); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppRevisionTrafficWeight DeserializeContainerAppRevisionTrafficWeight(JsonElement element) + internal static ContainerAppRevisionTrafficWeight DeserializeContainerAppRevisionTrafficWeight(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerAppRevisionTrafficWeight DeserializeContainerAppRevisio Optional weight = default; Optional latestRevision = default; Optional label = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("revisionName"u8)) @@ -78,8 +101,61 @@ internal static ContainerAppRevisionTrafficWeight DeserializeContainerAppRevisio label = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppRevisionTrafficWeight(revisionName.Value, Optional.ToNullable(weight), Optional.ToNullable(latestRevision), label.Value, serializedAdditionalRawData); + } + + ContainerAppRevisionTrafficWeight IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppRevisionTrafficWeight(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppRevisionTrafficWeight IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppRevisionTrafficWeight(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppRevisionTrafficWeight model) + { + if (model is null) + { + return null; } - return new ContainerAppRevisionTrafficWeight(revisionName.Value, Optional.ToNullable(weight), Optional.ToNullable(latestRevision), label.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppRevisionTrafficWeight(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppRevisionTrafficWeight(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.cs index 73f1dab88049..bbe402365bf4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppRevisionTrafficWeight.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Traffic weight assigned to a revision. public partial class ContainerAppRevisionTrafficWeight { - /// Initializes a new instance of ContainerAppRevisionTrafficWeight. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppRevisionTrafficWeight() { } - /// Initializes a new instance of ContainerAppRevisionTrafficWeight. + /// Initializes a new instance of . /// Name of a revision. /// Traffic weight assigned to a revision. /// Indicates that the traffic weight belongs to a latest stable revision. /// Associates a traffic label with a revision. - internal ContainerAppRevisionTrafficWeight(string revisionName, int? weight, bool? isLatestRevision, string label) + /// Keeps track of any properties unknown to the library. + internal ContainerAppRevisionTrafficWeight(string revisionName, int? weight, bool? isLatestRevision, string label, Dictionary serializedAdditionalRawData) { RevisionName = revisionName; Weight = weight; IsLatestRevision = isLatestRevision; Label = label; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of a revision. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.Serialization.cs index 417e256b5d9f..24486e4fdc1e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppScale : IUtf8JsonSerializable + public partial class ContainerAppScale : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MinReplicas)) { @@ -32,15 +39,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Rules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppScale DeserializeContainerAppScale(JsonElement element) + internal static ContainerAppScale DeserializeContainerAppScale(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static ContainerAppScale DeserializeContainerAppScale(JsonElement eleme Optional minReplicas = default; Optional maxReplicas = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minReplicas"u8)) @@ -82,8 +111,61 @@ internal static ContainerAppScale DeserializeContainerAppScale(JsonElement eleme rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppScale(Optional.ToNullable(minReplicas), Optional.ToNullable(maxReplicas), Optional.ToList(rules), serializedAdditionalRawData); + } + + ContainerAppScale IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppScale(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppScale IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppScale(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppScale model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppScale(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppScale(Optional.ToNullable(minReplicas), Optional.ToNullable(maxReplicas), Optional.ToList(rules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppScale(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.cs index ba30ec41f3d2..6d4368d791f0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScale.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App scaling configurations. public partial class ContainerAppScale { - /// Initializes a new instance of ContainerAppScale. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppScale() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppScale. + /// Initializes a new instance of . /// Optional. Minimum number of container replicas. /// Optional. Maximum number of container replicas. Defaults to 10 if not set. /// Scaling rules. - internal ContainerAppScale(int? minReplicas, int? maxReplicas, IList rules) + /// Keeps track of any properties unknown to the library. + internal ContainerAppScale(int? minReplicas, int? maxReplicas, IList rules, Dictionary serializedAdditionalRawData) { MinReplicas = minReplicas; MaxReplicas = maxReplicas; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Optional. Minimum number of container replicas. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.Serialization.cs index 844b92002f00..2e37c2d8c47f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppScaleRule : IUtf8JsonSerializable + public partial class ContainerAppScaleRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -23,28 +31,70 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AzureQueue)) { writer.WritePropertyName("azureQueue"u8); - writer.WriteObjectValue(AzureQueue); + if (AzureQueue is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureQueue).Serialize(writer, options); + } } if (Optional.IsDefined(Custom)) { writer.WritePropertyName("custom"u8); - writer.WriteObjectValue(Custom); + if (Custom is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Custom).Serialize(writer, options); + } } if (Optional.IsDefined(Http)) { writer.WritePropertyName("http"u8); - writer.WriteObjectValue(Http); + if (Http is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Http).Serialize(writer, options); + } } if (Optional.IsDefined(Tcp)) { writer.WritePropertyName("tcp"u8); - writer.WriteObjectValue(Tcp); + if (Tcp is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tcp).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppScaleRule DeserializeContainerAppScaleRule(JsonElement element) + internal static ContainerAppScaleRule DeserializeContainerAppScaleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +104,7 @@ internal static ContainerAppScaleRule DeserializeContainerAppScaleRule(JsonEleme Optional custom = default; Optional http = default; Optional tcp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -97,8 +148,61 @@ internal static ContainerAppScaleRule DeserializeContainerAppScaleRule(JsonEleme tcp = ContainerAppTcpScaleRule.DeserializeContainerAppTcpScaleRule(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppScaleRule(name.Value, azureQueue.Value, custom.Value, http.Value, tcp.Value); + return new ContainerAppScaleRule(name.Value, azureQueue.Value, custom.Value, http.Value, tcp.Value, serializedAdditionalRawData); + } + + ContainerAppScaleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppScaleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppScaleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppScaleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppScaleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppScaleRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppScaleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.cs index 5020a80df01f..bfb9b2456f76 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRule.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Container App container scaling rule. public partial class ContainerAppScaleRule { - /// Initializes a new instance of ContainerAppScaleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppScaleRule() { } - /// Initializes a new instance of ContainerAppScaleRule. + /// Initializes a new instance of . /// Scale Rule Name. /// Azure Queue based scaling. /// Custom scale rule. /// HTTP requests based scaling. /// Tcp requests based scaling. - internal ContainerAppScaleRule(string name, ContainerAppQueueScaleRule azureQueue, ContainerAppCustomScaleRule custom, ContainerAppHttpScaleRule http, ContainerAppTcpScaleRule tcp) + /// Keeps track of any properties unknown to the library. + internal ContainerAppScaleRule(string name, ContainerAppQueueScaleRule azureQueue, ContainerAppCustomScaleRule custom, ContainerAppHttpScaleRule http, ContainerAppTcpScaleRule tcp, Dictionary serializedAdditionalRawData) { Name = name; AzureQueue = azureQueue; Custom = custom; Http = http; Tcp = tcp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scale Rule Name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.Serialization.cs index 802bd25a56b0..9da92f797dbe 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppScaleRuleAuth : IUtf8JsonSerializable + public partial class ContainerAppScaleRuleAuth : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecretRef)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("triggerParameter"u8); writer.WriteStringValue(TriggerParameter); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppScaleRuleAuth DeserializeContainerAppScaleRuleAuth(JsonElement element) + internal static ContainerAppScaleRuleAuth DeserializeContainerAppScaleRuleAuth(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional secretRef = default; Optional triggerParameter = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretRef"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppScaleRuleAuth DeserializeContainerAppScaleRuleAuth(J triggerParameter = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppScaleRuleAuth(secretRef.Value, triggerParameter.Value, serializedAdditionalRawData); + } + + ContainerAppScaleRuleAuth IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppScaleRuleAuth(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppScaleRuleAuth IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppScaleRuleAuth(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppScaleRuleAuth model) + { + if (model is null) + { + return null; } - return new ContainerAppScaleRuleAuth(secretRef.Value, triggerParameter.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppScaleRuleAuth(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppScaleRuleAuth(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.cs index 9c7c05a20fe5..a7058395523f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppScaleRuleAuth.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Auth Secrets for Scale Rule. public partial class ContainerAppScaleRuleAuth { - /// Initializes a new instance of ContainerAppScaleRuleAuth. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppScaleRuleAuth() { } - /// Initializes a new instance of ContainerAppScaleRuleAuth. + /// Initializes a new instance of . /// Name of the secret from which to pull the auth params. /// Trigger Parameter that uses the secret. - internal ContainerAppScaleRuleAuth(string secretRef, string triggerParameter) + /// Keeps track of any properties unknown to the library. + internal ContainerAppScaleRuleAuth(string secretRef, string triggerParameter, Dictionary serializedAdditionalRawData) { SecretRef = secretRef; TriggerParameter = triggerParameter; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the secret from which to pull the auth params. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.Serialization.cs index 2918b06c6210..853f6f717f25 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppSecret + public partial class ContainerAppSecret : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAppSecret DeserializeContainerAppSecret(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAppSecret DeserializeContainerAppSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static ContainerAppSecret DeserializeContainerAppSecret(JsonElement ele Optional value = default; Optional identity = default; Optional keyVaultUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -49,8 +77,61 @@ internal static ContainerAppSecret DeserializeContainerAppSecret(JsonElement ele keyVaultUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAppSecret(name.Value, value.Value, identity.Value, keyVaultUrl.Value); + return new ContainerAppSecret(name.Value, value.Value, identity.Value, keyVaultUrl.Value, serializedAdditionalRawData); + } + + ContainerAppSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppSecret model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.cs index 1a326c03a39b..6c2a2d174366 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSecret.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models { /// Container App Secret. public partial class ContainerAppSecret { - /// Initializes a new instance of ContainerAppSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAppSecret() { } - /// Initializes a new instance of ContainerAppSecret. + /// Initializes a new instance of . /// Secret Name. /// Secret Value. /// Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. /// Azure Key Vault URL pointing to the secret referenced by the container app. - internal ContainerAppSecret(string name, string value, string identity, Uri keyVaultUri) + /// Keeps track of any properties unknown to the library. + internal ContainerAppSecret(string name, string value, string identity, Uri keyVaultUri, Dictionary serializedAdditionalRawData) { Name = name; Value = value; Identity = identity; KeyVaultUri = keyVaultUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Secret Name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.Serialization.cs index 785026d00f02..41d68791c091 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppServiceBind : IUtf8JsonSerializable + public partial class ContainerAppServiceBind : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ServiceId)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppServiceBind DeserializeContainerAppServiceBind(JsonElement element) + internal static ContainerAppServiceBind DeserializeContainerAppServiceBind(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional serviceId = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serviceId"u8)) @@ -52,8 +75,61 @@ internal static ContainerAppServiceBind DeserializeContainerAppServiceBind(JsonE name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppServiceBind(serviceId.Value, name.Value, serializedAdditionalRawData); + } + + ContainerAppServiceBind IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppServiceBind(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppServiceBind IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppServiceBind(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppServiceBind model) + { + if (model is null) + { + return null; } - return new ContainerAppServiceBind(serviceId.Value, name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppServiceBind(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppServiceBind(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.cs index e797bbdd27bb..dd325249a055 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppServiceBind.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.AppContainers.Models /// Configuration to bind a ContainerApp to a dev ContainerApp Service. public partial class ContainerAppServiceBind { - /// Initializes a new instance of ContainerAppServiceBind. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppServiceBind() { } - /// Initializes a new instance of ContainerAppServiceBind. + /// Initializes a new instance of . /// Resource id of the target service. /// Name of the service bind. - internal ContainerAppServiceBind(ResourceIdentifier serviceId, string name) + /// Keeps track of any properties unknown to the library. + internal ContainerAppServiceBind(ResourceIdentifier serviceId, string name, Dictionary serializedAdditionalRawData) { ServiceId = serviceId; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource id of the target service. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSourceControlData.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSourceControlData.Serialization.cs index 7bbb424ccb71..593d118523ba 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSourceControlData.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppSourceControlData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers { - public partial class ContainerAppSourceControlData : IUtf8JsonSerializable + public partial class ContainerAppSourceControlData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,14 +40,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GitHubActionConfiguration)) { writer.WritePropertyName("githubActionConfiguration"u8); - writer.WriteObjectValue(GitHubActionConfiguration); + if (GitHubActionConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitHubActionConfiguration).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppSourceControlData DeserializeContainerAppSourceControlData(JsonElement element) + internal static ContainerAppSourceControlData DeserializeContainerAppSourceControlData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +81,7 @@ internal static ContainerAppSourceControlData DeserializeContainerAppSourceContr Optional repoUrl = default; Optional branch = default; Optional gitHubActionConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -123,8 +152,61 @@ internal static ContainerAppSourceControlData DeserializeContainerAppSourceContr } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppSourceControlData(id, name, type, systemData.Value, Optional.ToNullable(operationState), repoUrl.Value, branch.Value, gitHubActionConfiguration.Value, serializedAdditionalRawData); + } + + ContainerAppSourceControlData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppSourceControlData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppSourceControlData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppSourceControlData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppSourceControlData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppSourceControlData(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppSourceControlData(id, name, type, systemData.Value, Optional.ToNullable(operationState), repoUrl.Value, branch.Value, gitHubActionConfiguration.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppSourceControlData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.Serialization.cs index b3b69f78eab4..d6162298ba42 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppTcpScaleRule : IUtf8JsonSerializable + public partial class ContainerAppTcpScaleRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Metadata)) { @@ -33,21 +40,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Auth) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppTcpScaleRule DeserializeContainerAppTcpScaleRule(JsonElement element) + internal static ContainerAppTcpScaleRule DeserializeContainerAppTcpScaleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> metadata = default; Optional> auth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metadata"u8)) @@ -78,8 +107,61 @@ internal static ContainerAppTcpScaleRule DeserializeContainerAppTcpScaleRule(Jso auth = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppTcpScaleRule(Optional.ToDictionary(metadata), Optional.ToList(auth), serializedAdditionalRawData); + } + + ContainerAppTcpScaleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppTcpScaleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppTcpScaleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppTcpScaleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppTcpScaleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppTcpScaleRule(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppTcpScaleRule(Optional.ToDictionary(metadata), Optional.ToList(auth)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppTcpScaleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.cs index c43a887eefe2..32a610bf6979 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpScaleRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App container Tcp scaling rule. public partial class ContainerAppTcpScaleRule { - /// Initializes a new instance of ContainerAppTcpScaleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppTcpScaleRule() { Metadata = new ChangeTrackingDictionary(); Auth = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppTcpScaleRule. + /// Initializes a new instance of . /// Metadata properties to describe tcp scale rule. /// Authentication secrets for the tcp scale rule. - internal ContainerAppTcpScaleRule(IDictionary metadata, IList auth) + /// Keeps track of any properties unknown to the library. + internal ContainerAppTcpScaleRule(IDictionary metadata, IList auth, Dictionary serializedAdditionalRawData) { Metadata = metadata; Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Metadata properties to describe tcp scale rule. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.Serialization.cs index d836ed7bea37..e1369af55952 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppTcpSocketRequestInfo : IUtf8JsonSerializable + public partial class ContainerAppTcpSocketRequestInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Host)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("port"u8); writer.WriteNumberValue(Port); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppTcpSocketRequestInfo DeserializeContainerAppTcpSocketRequestInfo(JsonElement element) + internal static ContainerAppTcpSocketRequestInfo DeserializeContainerAppTcpSocketRequestInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional host = default; int port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("host"u8)) @@ -45,8 +68,61 @@ internal static ContainerAppTcpSocketRequestInfo DeserializeContainerAppTcpSocke port = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppTcpSocketRequestInfo(host.Value, port, serializedAdditionalRawData); + } + + ContainerAppTcpSocketRequestInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppTcpSocketRequestInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppTcpSocketRequestInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppTcpSocketRequestInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppTcpSocketRequestInfo model) + { + if (model is null) + { + return null; } - return new ContainerAppTcpSocketRequestInfo(host.Value, port); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppTcpSocketRequestInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppTcpSocketRequestInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.cs index 820af9afab2d..74774c5b6df7 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTcpSocketRequestInfo.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. public partial class ContainerAppTcpSocketRequestInfo { - /// Initializes a new instance of ContainerAppTcpSocketRequestInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. public ContainerAppTcpSocketRequestInfo(int port) { Port = port; } - /// Initializes a new instance of ContainerAppTcpSocketRequestInfo. + /// Initializes a new instance of . /// Optional: Host name to connect to, defaults to the pod IP. /// Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. - internal ContainerAppTcpSocketRequestInfo(string host, int port) + /// Keeps track of any properties unknown to the library. + internal ContainerAppTcpSocketRequestInfo(string host, int port, Dictionary serializedAdditionalRawData) { Host = host; Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppTcpSocketRequestInfo() + { } /// Optional: Host name to connect to, defaults to the pod IP. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.Serialization.cs index b526fcbaeb98..0c1bb531f831 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppTemplate : IUtf8JsonSerializable + public partial class ContainerAppTemplate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RevisionSuffix)) { @@ -32,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in InitContainers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,14 +56,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Containers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Scale)) { writer.WritePropertyName("scale"u8); - writer.WriteObjectValue(Scale); + if (Scale is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Scale).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Volumes)) { @@ -57,7 +85,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Volumes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -67,15 +102,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ServiceBinds) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppTemplate DeserializeContainerAppTemplate(JsonElement element) + internal static ContainerAppTemplate DeserializeContainerAppTemplate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +143,7 @@ internal static ContainerAppTemplate DeserializeContainerAppTemplate(JsonElement Optional scale = default; Optional> volumes = default; Optional> serviceBinds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("revisionSuffix"u8)) @@ -168,8 +225,61 @@ internal static ContainerAppTemplate DeserializeContainerAppTemplate(JsonElement serviceBinds = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppTemplate(revisionSuffix.Value, Optional.ToNullable(terminationGracePeriodSeconds), Optional.ToList(initContainers), Optional.ToList(containers), scale.Value, Optional.ToList(volumes), Optional.ToList(serviceBinds), serializedAdditionalRawData); + } + + ContainerAppTemplate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppTemplate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppTemplate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppTemplate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppTemplate model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppTemplate(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppTemplate(revisionSuffix.Value, Optional.ToNullable(terminationGracePeriodSeconds), Optional.ToList(initContainers), Optional.ToList(containers), scale.Value, Optional.ToList(volumes), Optional.ToList(serviceBinds)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppTemplate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.cs index 61021bb91358..eb96c029ce7d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTemplate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -17,7 +18,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// public partial class ContainerAppTemplate { - /// Initializes a new instance of ContainerAppTemplate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppTemplate() { InitContainers = new ChangeTrackingList(); @@ -26,7 +30,7 @@ public ContainerAppTemplate() ServiceBinds = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppTemplate. + /// Initializes a new instance of . /// User friendly suffix that is appended to the revision name. /// Optional duration in seconds the Container App Instance needs to terminate gracefully. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds. /// List of specialized containers that run before app containers. @@ -34,7 +38,8 @@ public ContainerAppTemplate() /// Scaling properties for the Container App. /// List of volume definitions for the Container App. /// List of container app services bound to the app. - internal ContainerAppTemplate(string revisionSuffix, long? terminationGracePeriodSeconds, IList initContainers, IList containers, ContainerAppScale scale, IList volumes, IList serviceBinds) + /// Keeps track of any properties unknown to the library. + internal ContainerAppTemplate(string revisionSuffix, long? terminationGracePeriodSeconds, IList initContainers, IList containers, ContainerAppScale scale, IList volumes, IList serviceBinds, Dictionary serializedAdditionalRawData) { RevisionSuffix = revisionSuffix; TerminationGracePeriodSeconds = terminationGracePeriodSeconds; @@ -43,6 +48,7 @@ internal ContainerAppTemplate(string revisionSuffix, long? terminationGracePerio Scale = scale; Volumes = volumes; ServiceBinds = serviceBinds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// User friendly suffix that is appended to the revision name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.Serialization.cs index 96da64874c11..84726d508c11 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppTwitterConfiguration : IUtf8JsonSerializable + public partial class ContainerAppTwitterConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Registration)) { writer.WritePropertyName("registration"u8); - writer.WriteObjectValue(Registration); + if (Registration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Registration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppTwitterConfiguration DeserializeContainerAppTwitterConfiguration(JsonElement element) + internal static ContainerAppTwitterConfiguration DeserializeContainerAppTwitterConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional registration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -56,8 +86,61 @@ internal static ContainerAppTwitterConfiguration DeserializeContainerAppTwitterC registration = ContainerAppTwitterRegistration.DeserializeContainerAppTwitterRegistration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppTwitterConfiguration(Optional.ToNullable(enabled), registration.Value, serializedAdditionalRawData); + } + + ContainerAppTwitterConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppTwitterConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppTwitterConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppTwitterConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppTwitterConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppTwitterConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppTwitterConfiguration(Optional.ToNullable(enabled), registration.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppTwitterConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.cs index fc881fbe1a82..943b80432d71 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the Twitter provider. public partial class ContainerAppTwitterConfiguration { - /// Initializes a new instance of ContainerAppTwitterConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppTwitterConfiguration() { } - /// Initializes a new instance of ContainerAppTwitterConfiguration. + /// Initializes a new instance of . /// <code>false</code> if the Twitter provider should not be enabled despite the set registration; otherwise, <code>true</code>. /// The configuration settings of the app registration for the Twitter provider. - internal ContainerAppTwitterConfiguration(bool? isEnabled, ContainerAppTwitterRegistration registration) + /// Keeps track of any properties unknown to the library. + internal ContainerAppTwitterConfiguration(bool? isEnabled, ContainerAppTwitterRegistration registration, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Registration = registration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// <code>false</code> if the Twitter provider should not be enabled despite the set registration; otherwise, <code>true</code>. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.Serialization.cs index 30f274f61c57..f3aefef0c199 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppTwitterRegistration : IUtf8JsonSerializable + public partial class ContainerAppTwitterRegistration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConsumerKey)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("consumerSecretSettingName"u8); writer.WriteStringValue(ConsumerSecretSettingName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppTwitterRegistration DeserializeContainerAppTwitterRegistration(JsonElement element) + internal static ContainerAppTwitterRegistration DeserializeContainerAppTwitterRegistration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional consumerKey = default; Optional consumerSecretSettingName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("consumerKey"u8)) @@ -48,8 +71,61 @@ internal static ContainerAppTwitterRegistration DeserializeContainerAppTwitterRe consumerSecretSettingName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppTwitterRegistration(consumerKey.Value, consumerSecretSettingName.Value, serializedAdditionalRawData); + } + + ContainerAppTwitterRegistration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppTwitterRegistration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppTwitterRegistration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppTwitterRegistration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppTwitterRegistration model) + { + if (model is null) + { + return null; } - return new ContainerAppTwitterRegistration(consumerKey.Value, consumerSecretSettingName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppTwitterRegistration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppTwitterRegistration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.cs index 85275a7353a8..0e4b30a985f4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppTwitterRegistration.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the app registration for the Twitter provider. public partial class ContainerAppTwitterRegistration { - /// Initializes a new instance of ContainerAppTwitterRegistration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppTwitterRegistration() { } - /// Initializes a new instance of ContainerAppTwitterRegistration. + /// Initializes a new instance of . /// /// The OAuth 1.0a consumer key of the Twitter application used for sign-in. /// This setting is required for enabling Twitter Sign-In. @@ -25,10 +31,12 @@ public ContainerAppTwitterRegistration() /// The app setting name that contains the OAuth 1.0a consumer secret of the Twitter /// application used for sign-in. /// - internal ContainerAppTwitterRegistration(string consumerKey, string consumerSecretSettingName) + /// Keeps track of any properties unknown to the library. + internal ContainerAppTwitterRegistration(string consumerKey, string consumerSecretSettingName, Dictionary serializedAdditionalRawData) { ConsumerKey = consumerKey; ConsumerSecretSettingName = consumerSecretSettingName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.Serialization.cs index ccd651e62c46..3ba8e4ff7f8a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppVnetConfiguration : IUtf8JsonSerializable + public partial class ContainerAppVnetConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsInternal)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("platformReservedDnsIP"u8); writer.WriteStringValue(PlatformReservedDnsIP); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppVnetConfiguration DeserializeContainerAppVnetConfiguration(JsonElement element) + internal static ContainerAppVnetConfiguration DeserializeContainerAppVnetConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static ContainerAppVnetConfiguration DeserializeContainerAppVnetConfigu Optional dockerBridgeCidr = default; Optional platformReservedCidr = default; Optional platformReservedDnsIP = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("internal"u8)) @@ -89,8 +112,61 @@ internal static ContainerAppVnetConfiguration DeserializeContainerAppVnetConfigu platformReservedDnsIP = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppVnetConfiguration(Optional.ToNullable(@internal), infrastructureSubnetId.Value, dockerBridgeCidr.Value, platformReservedCidr.Value, platformReservedDnsIP.Value, serializedAdditionalRawData); + } + + ContainerAppVnetConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppVnetConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppVnetConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppVnetConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppVnetConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerAppVnetConfiguration(Optional.ToNullable(@internal), infrastructureSubnetId.Value, dockerBridgeCidr.Value, platformReservedCidr.Value, platformReservedDnsIP.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppVnetConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppVnetConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.cs index d51b7f617dd8..18bc5fb2b9cc 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVnetConfiguration.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -12,24 +14,29 @@ namespace Azure.ResourceManager.AppContainers.Models /// Configuration properties for apps environment to join a Virtual Network. public partial class ContainerAppVnetConfiguration { - /// Initializes a new instance of ContainerAppVnetConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppVnetConfiguration() { } - /// Initializes a new instance of ContainerAppVnetConfiguration. + /// Initializes a new instance of . /// Boolean indicating the environment only has an internal load balancer. These environments do not have a public static IP resource. They must provide infrastructureSubnetId if enabling this property. /// Resource ID of a subnet for infrastructure components. Must not overlap with any other provided IP ranges. /// CIDR notation IP range assigned to the Docker bridge, network. Must not overlap with any other provided IP ranges. /// IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. Must not overlap with any other provided IP ranges. /// An IP address from the IP range defined by platformReservedCidr that will be reserved for the internal DNS server. - internal ContainerAppVnetConfiguration(bool? isInternal, ResourceIdentifier infrastructureSubnetId, string dockerBridgeCidr, string platformReservedCidr, string platformReservedDnsIP) + /// Keeps track of any properties unknown to the library. + internal ContainerAppVnetConfiguration(bool? isInternal, ResourceIdentifier infrastructureSubnetId, string dockerBridgeCidr, string platformReservedCidr, string platformReservedDnsIP, Dictionary serializedAdditionalRawData) { IsInternal = isInternal; InfrastructureSubnetId = infrastructureSubnetId; DockerBridgeCidr = dockerBridgeCidr; PlatformReservedCidr = platformReservedCidr; PlatformReservedDnsIP = platformReservedDnsIP; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Boolean indicating the environment only has an internal load balancer. These environments do not have a public static IP resource. They must provide infrastructureSubnetId if enabling this property. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.Serialization.cs index 0fdb9d2438a9..07fb8d4c576e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppVolume : IUtf8JsonSerializable + public partial class ContainerAppVolume : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -37,7 +44,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Secrets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -46,11 +60,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mountOptions"u8); writer.WriteStringValue(MountOptions); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppVolume DeserializeContainerAppVolume(JsonElement element) + internal static ContainerAppVolume DeserializeContainerAppVolume(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +88,7 @@ internal static ContainerAppVolume DeserializeContainerAppVolume(JsonElement ele Optional storageName = default; Optional> secrets = default; Optional mountOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -100,8 +129,61 @@ internal static ContainerAppVolume DeserializeContainerAppVolume(JsonElement ele mountOptions = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppVolume(name.Value, Optional.ToNullable(storageType), storageName.Value, Optional.ToList(secrets), mountOptions.Value, serializedAdditionalRawData); + } + + ContainerAppVolume IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppVolume(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppVolume IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppVolume(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppVolume model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppVolume(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppVolume(name.Value, Optional.ToNullable(storageType), storageName.Value, Optional.ToList(secrets), mountOptions.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppVolume(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.cs index 5b74a7943fb6..0c8ca743a9ad 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolume.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.AppContainers.Models /// Volume definitions for the Container App. public partial class ContainerAppVolume { - /// Initializes a new instance of ContainerAppVolume. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppVolume() { Secrets = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerAppVolume. + /// Initializes a new instance of . /// Volume name. /// Storage type for the volume. If not provided, use EmptyDir. /// Name of storage resource. No need to provide for EmptyDir and Secret. /// List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. /// Mount options used while mounting the AzureFile. Must be a comma-separated string. - internal ContainerAppVolume(string name, ContainerAppStorageType? storageType, string storageName, IList secrets, string mountOptions) + /// Keeps track of any properties unknown to the library. + internal ContainerAppVolume(string name, ContainerAppStorageType? storageType, string storageName, IList secrets, string mountOptions, Dictionary serializedAdditionalRawData) { Name = name; StorageType = storageType; StorageName = storageName; Secrets = secrets; MountOptions = mountOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Volume name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.Serialization.cs index 8de3f38dbbcc..4ee788fccff1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppVolumeMount : IUtf8JsonSerializable + public partial class ContainerAppVolumeMount : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VolumeName)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("subPath"u8); writer.WriteStringValue(SubPath); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppVolumeMount DeserializeContainerAppVolumeMount(JsonElement element) + internal static ContainerAppVolumeMount DeserializeContainerAppVolumeMount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppVolumeMount DeserializeContainerAppVolumeMount(JsonE Optional volumeName = default; Optional mountPath = default; Optional subPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("volumeName"u8)) @@ -59,8 +82,61 @@ internal static ContainerAppVolumeMount DeserializeContainerAppVolumeMount(JsonE subPath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppVolumeMount(volumeName.Value, mountPath.Value, subPath.Value, serializedAdditionalRawData); + } + + ContainerAppVolumeMount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppVolumeMount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppVolumeMount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppVolumeMount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppVolumeMount model) + { + if (model is null) + { + return null; } - return new ContainerAppVolumeMount(volumeName.Value, mountPath.Value, subPath.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppVolumeMount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppVolumeMount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.cs index e893573a3bfd..53c184514cc8 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppVolumeMount.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Volume mount for the Container App. public partial class ContainerAppVolumeMount { - /// Initializes a new instance of ContainerAppVolumeMount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppVolumeMount() { } - /// Initializes a new instance of ContainerAppVolumeMount. + /// Initializes a new instance of . /// This must match the Name of a Volume. /// Path within the container at which the volume should be mounted.Must not contain ':'. /// Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root). - internal ContainerAppVolumeMount(string volumeName, string mountPath, string subPath) + /// Keeps track of any properties unknown to the library. + internal ContainerAppVolumeMount(string volumeName, string mountPath, string subPath, Dictionary serializedAdditionalRawData) { VolumeName = volumeName; MountPath = mountPath; SubPath = subPath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This must match the Name of a Volume. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.Serialization.cs index 2e8fca66caf1..6da5ab109ec9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppWorkloadProfile : IUtf8JsonSerializable + public partial class ContainerAppWorkloadProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maximumCount"u8); writer.WriteNumberValue(MaximumNodeCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppWorkloadProfile DeserializeContainerAppWorkloadProfile(JsonElement element) + internal static ContainerAppWorkloadProfile DeserializeContainerAppWorkloadProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppWorkloadProfile DeserializeContainerAppWorkloadProfi string workloadProfileType = default; Optional minimumCount = default; Optional maximumCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -72,8 +95,61 @@ internal static ContainerAppWorkloadProfile DeserializeContainerAppWorkloadProfi maximumCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppWorkloadProfile(name, workloadProfileType, Optional.ToNullable(minimumCount), Optional.ToNullable(maximumCount), serializedAdditionalRawData); + } + + ContainerAppWorkloadProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppWorkloadProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppWorkloadProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppWorkloadProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppWorkloadProfile model) + { + if (model is null) + { + return null; } - return new ContainerAppWorkloadProfile(name, workloadProfileType, Optional.ToNullable(minimumCount), Optional.ToNullable(maximumCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppWorkloadProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppWorkloadProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.cs index 2ad57d2b2e2a..1f4c50918e9b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfile.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Workload profile to scope container app execution. public partial class ContainerAppWorkloadProfile { - /// Initializes a new instance of ContainerAppWorkloadProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Workload profile type for the workloads to run on. /// Workload profile type for the workloads to run on. /// or is null. @@ -26,17 +30,24 @@ public ContainerAppWorkloadProfile(string name, string workloadProfileType) WorkloadProfileType = workloadProfileType; } - /// Initializes a new instance of ContainerAppWorkloadProfile. + /// Initializes a new instance of . /// Workload profile type for the workloads to run on. /// Workload profile type for the workloads to run on. /// The minimum capacity. /// The maximum capacity. - internal ContainerAppWorkloadProfile(string name, string workloadProfileType, int? minimumNodeCount, int? maximumNodeCount) + /// Keeps track of any properties unknown to the library. + internal ContainerAppWorkloadProfile(string name, string workloadProfileType, int? minimumNodeCount, int? maximumNodeCount, Dictionary serializedAdditionalRawData) { Name = name; WorkloadProfileType = workloadProfileType; MinimumNodeCount = minimumNodeCount; MaximumNodeCount = maximumNodeCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppWorkloadProfile() + { } /// Workload profile type for the workloads to run on. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.Serialization.cs index f9648c15affa..dd798edc909c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppWorkloadProfileState : IUtf8JsonSerializable + public partial class ContainerAppWorkloadProfileState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerAppWorkloadProfileState DeserializeContainerAppWorkloadProfileState(JsonElement element) + internal static ContainerAppWorkloadProfileState DeserializeContainerAppWorkloadProfileState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static ContainerAppWorkloadProfileState DeserializeContainerAppWorkload string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -70,8 +100,61 @@ internal static ContainerAppWorkloadProfileState DeserializeContainerAppWorkload systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppWorkloadProfileState(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + ContainerAppWorkloadProfileState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppWorkloadProfileState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppWorkloadProfileState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppWorkloadProfileState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppWorkloadProfileState model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppWorkloadProfileState(Response response) + { + if (response is null) + { + return null; } - return new ContainerAppWorkloadProfileState(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppWorkloadProfileState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.cs index 80d825d08940..04327a9b0393 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileState.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of all the workload Profile States for a Managed Environment.. public partial class ContainerAppWorkloadProfileState : ResourceData { - /// Initializes a new instance of ContainerAppWorkloadProfileState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppWorkloadProfileState() { } - /// Initializes a new instance of ContainerAppWorkloadProfileState. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Workload Profile resource specific properties. - internal ContainerAppWorkloadProfileState(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppWorkloadProfileStateProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerAppWorkloadProfileState(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerAppWorkloadProfileStateProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Workload Profile resource specific properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.Serialization.cs index 372c10ec3016..6b7585ac07cb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppWorkloadProfileStateProperties : IUtf8JsonSerializable + public partial class ContainerAppWorkloadProfileStateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MinimumCount)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("currentCount"u8); writer.WriteNumberValue(CurrentCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppWorkloadProfileStateProperties DeserializeContainerAppWorkloadProfileStateProperties(JsonElement element) + internal static ContainerAppWorkloadProfileStateProperties DeserializeContainerAppWorkloadProfileStateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerAppWorkloadProfileStateProperties DeserializeContainerA Optional minimumCount = default; Optional maximumCount = default; Optional currentCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimumCount"u8)) @@ -71,8 +94,61 @@ internal static ContainerAppWorkloadProfileStateProperties DeserializeContainerA currentCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppWorkloadProfileStateProperties(Optional.ToNullable(minimumCount), Optional.ToNullable(maximumCount), Optional.ToNullable(currentCount), serializedAdditionalRawData); + } + + ContainerAppWorkloadProfileStateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppWorkloadProfileStateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppWorkloadProfileStateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppWorkloadProfileStateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppWorkloadProfileStateProperties model) + { + if (model is null) + { + return null; } - return new ContainerAppWorkloadProfileStateProperties(Optional.ToNullable(minimumCount), Optional.ToNullable(maximumCount), Optional.ToNullable(currentCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppWorkloadProfileStateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppWorkloadProfileStateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.cs index 43d9d0d8cbbc..b37b2dccde69 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWorkloadProfileStateProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Workload Profile resource specific properties. public partial class ContainerAppWorkloadProfileStateProperties { - /// Initializes a new instance of ContainerAppWorkloadProfileStateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppWorkloadProfileStateProperties() { } - /// Initializes a new instance of ContainerAppWorkloadProfileStateProperties. + /// Initializes a new instance of . /// Minimum count of instances. /// Maximum count of nodes. /// Current count of nodes. - internal ContainerAppWorkloadProfileStateProperties(int? minimumCount, int? maximumCount, int? currentCount) + /// Keeps track of any properties unknown to the library. + internal ContainerAppWorkloadProfileStateProperties(int? minimumCount, int? maximumCount, int? currentCount, Dictionary serializedAdditionalRawData) { MinimumCount = minimumCount; MaximumCount = maximumCount; CurrentCount = currentCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Minimum count of instances. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.Serialization.cs index 53731af9e017..adfd23474b2a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ContainerAppWritableSecret : IUtf8JsonSerializable + public partial class ContainerAppWritableSecret : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVaultUrl"u8); writer.WriteStringValue(KeyVaultUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerAppWritableSecret DeserializeContainerAppWritableSecret(JsonElement element) + internal static ContainerAppWritableSecret DeserializeContainerAppWritableSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static ContainerAppWritableSecret DeserializeContainerAppWritableSecret Optional value = default; Optional identity = default; Optional keyVaultUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -75,8 +97,61 @@ internal static ContainerAppWritableSecret DeserializeContainerAppWritableSecret keyVaultUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerAppWritableSecret(name.Value, value.Value, identity.Value, keyVaultUrl.Value, serializedAdditionalRawData); + } + + ContainerAppWritableSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppWritableSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAppWritableSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAppWritableSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAppWritableSecret model) + { + if (model is null) + { + return null; } - return new ContainerAppWritableSecret(name.Value, value.Value, identity.Value, keyVaultUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAppWritableSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAppWritableSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.cs index a6e4f0ac8466..e01513b1b11a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppWritableSecret.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.AppContainers.Models { /// Secret definition. public partial class ContainerAppWritableSecret { - /// Initializes a new instance of ContainerAppWritableSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerAppWritableSecret() { } - /// Initializes a new instance of ContainerAppWritableSecret. + /// Initializes a new instance of . /// Secret Name. /// Secret Value. /// Resource ID of a managed identity to authenticate with Azure Key Vault, or System to use a system-assigned identity. /// Azure Key Vault URL pointing to the secret referenced by the container app. - internal ContainerAppWritableSecret(string name, string value, string identity, Uri keyVaultUri) + /// Keeps track of any properties unknown to the library. + internal ContainerAppWritableSecret(string name, string value, string identity, Uri keyVaultUri, Dictionary serializedAdditionalRawData) { Name = name; Value = value; Identity = identity; KeyVaultUri = keyVaultUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Secret Name. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.Serialization.cs index 4edae82fade2..391d07d7fbd1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class DaprComponentsCollection + internal partial class DaprComponentsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DaprComponentsCollection DeserializeDaprComponentsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DaprComponentsCollection DeserializeDaprComponentsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static DaprComponentsCollection DeserializeDaprComponentsCollection(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DaprComponentsCollection(value, nextLink.Value); + return new DaprComponentsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + DaprComponentsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDaprComponentsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DaprComponentsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDaprComponentsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DaprComponentsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DaprComponentsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDaprComponentsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.cs index f30b9c1a720a..cc4f9e6816ad 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprComponentsCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Dapr Components ARM resource. internal partial class DaprComponentsCollection { - /// Initializes a new instance of DaprComponentsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal DaprComponentsCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal DaprComponentsCollection(IEnumerable val Value = value.ToList(); } - /// Initializes a new instance of DaprComponentsCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal DaprComponentsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DaprComponentsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DaprComponentsCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.Serialization.cs index 220d1e487bbd..0c0b6f282a1e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class DaprConfiguration : IUtf8JsonSerializable + internal partial class DaprConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DaprConfiguration DeserializeDaprConfiguration(JsonElement element) + internal static DaprConfiguration DeserializeDaprConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("version"u8)) @@ -32,8 +55,61 @@ internal static DaprConfiguration DeserializeDaprConfiguration(JsonElement eleme version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DaprConfiguration(version.Value, serializedAdditionalRawData); + } + + DaprConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDaprConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DaprConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDaprConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DaprConfiguration model) + { + if (model is null) + { + return null; } - return new DaprConfiguration(version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DaprConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDaprConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.cs index d1ea8fc2fc1a..1499c8868c14 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Configuration properties Dapr component. internal partial class DaprConfiguration { - /// Initializes a new instance of DaprConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DaprConfiguration() { } - /// Initializes a new instance of DaprConfiguration. + /// Initializes a new instance of . /// The version of Dapr. - internal DaprConfiguration(string version) + /// Keeps track of any properties unknown to the library. + internal DaprConfiguration(string version, Dictionary serializedAdditionalRawData) { Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The version of Dapr. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.Serialization.cs index 914747d8fdf3..ea90a3ae5dee 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class DaprSecretsCollection + internal partial class DaprSecretsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DaprSecretsCollection DeserializeDaprSecretsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DaprSecretsCollection DeserializeDaprSecretsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +74,61 @@ internal static DaprSecretsCollection DeserializeDaprSecretsCollection(JsonEleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DaprSecretsCollection(value); + return new DaprSecretsCollection(value, serializedAdditionalRawData); + } + + DaprSecretsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDaprSecretsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DaprSecretsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDaprSecretsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DaprSecretsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DaprSecretsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDaprSecretsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.cs index f53e99b88faf..68170468244e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DaprSecretsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Dapr component Secrets Collection for ListSecrets Action. internal partial class DaprSecretsCollection { - /// Initializes a new instance of DaprSecretsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of secrets used by a Dapr component. /// is null. internal DaprSecretsCollection(IEnumerable value) @@ -25,11 +28,18 @@ internal DaprSecretsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DaprSecretsCollection. + /// Initializes a new instance of . /// Collection of secrets used by a Dapr component. - internal DaprSecretsCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal DaprSecretsCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DaprSecretsCollection() + { } /// Collection of secrets used by a Dapr component. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.Serialization.cs index 029e4cb1a745..bcf3657f71e3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class DiagnosticsCollection + internal partial class DiagnosticsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DiagnosticsCollection DeserializeDiagnosticsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DiagnosticsCollection DeserializeDiagnosticsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static DiagnosticsCollection DeserializeDiagnosticsCollection(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DiagnosticsCollection(value, nextLink.Value); + return new DiagnosticsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + DiagnosticsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.cs index e27d7d8c5bd7..bfb83bc6f0be 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/DiagnosticsCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Diagnostics data collection for a resource. internal partial class DiagnosticsCollection { - /// Initializes a new instance of DiagnosticsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of diagnostic data. /// is null. internal DiagnosticsCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal DiagnosticsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DiagnosticsCollection. + /// Initializes a new instance of . /// Collection of diagnostic data. /// Link to next page of resources. - internal DiagnosticsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DiagnosticsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiagnosticsCollection() + { } /// Collection of diagnostic data. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.Serialization.cs index 748fedb6271b..4184659852c9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class EventTriggerConfiguration : IUtf8JsonSerializable + public partial class EventTriggerConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ReplicaCompletionCount)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Scale)) { writer.WritePropertyName("scale"u8); - writer.WriteObjectValue(Scale); + if (Scale is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Scale).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static EventTriggerConfiguration DeserializeEventTriggerConfiguration(JsonElement element) + internal static EventTriggerConfiguration DeserializeEventTriggerConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static EventTriggerConfiguration DeserializeEventTriggerConfiguration(J Optional replicaCompletionCount = default; Optional parallelism = default; Optional scale = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("replicaCompletionCount"u8)) @@ -71,8 +101,61 @@ internal static EventTriggerConfiguration DeserializeEventTriggerConfiguration(J scale = ContainerAppJobScale.DeserializeContainerAppJobScale(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EventTriggerConfiguration(Optional.ToNullable(replicaCompletionCount), Optional.ToNullable(parallelism), scale.Value, serializedAdditionalRawData); + } + + EventTriggerConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEventTriggerConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EventTriggerConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEventTriggerConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EventTriggerConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EventTriggerConfiguration(Response response) + { + if (response is null) + { + return null; } - return new EventTriggerConfiguration(Optional.ToNullable(replicaCompletionCount), Optional.ToNullable(parallelism), scale.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEventTriggerConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.cs index f639f8a14377..1e6686c02208 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/EventTriggerConfiguration.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Trigger configuration of an event driven job. public partial class EventTriggerConfiguration { - /// Initializes a new instance of EventTriggerConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EventTriggerConfiguration() { } - /// Initializes a new instance of EventTriggerConfiguration. + /// Initializes a new instance of . /// Minimum number of successful replica completions before overall job completion. /// Number of parallel replicas of a job that can run at a given time. /// Scaling configurations for event driven jobs. - internal EventTriggerConfiguration(int? replicaCompletionCount, int? parallelism, ContainerAppJobScale scale) + /// Keeps track of any properties unknown to the library. + internal EventTriggerConfiguration(int? replicaCompletionCount, int? parallelism, ContainerAppJobScale scale, Dictionary serializedAdditionalRawData) { ReplicaCompletionCount = replicaCompletionCount; Parallelism = parallelism; Scale = scale; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Minimum number of successful replica completions before overall job completion. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.Serialization.cs index f53621593327..b7b7926f3cd0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class HttpSettingsRoutes : IUtf8JsonSerializable + internal partial class HttpSettingsRoutes : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ApiPrefix)) { writer.WritePropertyName("apiPrefix"u8); writer.WriteStringValue(ApiPrefix); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HttpSettingsRoutes DeserializeHttpSettingsRoutes(JsonElement element) + internal static HttpSettingsRoutes DeserializeHttpSettingsRoutes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional apiPrefix = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("apiPrefix"u8)) @@ -37,8 +60,61 @@ internal static HttpSettingsRoutes DeserializeHttpSettingsRoutes(JsonElement ele apiPrefix = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HttpSettingsRoutes(apiPrefix.Value, serializedAdditionalRawData); + } + + HttpSettingsRoutes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpSettingsRoutes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpSettingsRoutes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpSettingsRoutes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpSettingsRoutes model) + { + if (model is null) + { + return null; } - return new HttpSettingsRoutes(apiPrefix.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpSettingsRoutes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpSettingsRoutes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.cs index 016915e4450f..bfbafbbdf665 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/HttpSettingsRoutes.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The configuration settings of the paths HTTP requests. internal partial class HttpSettingsRoutes { - /// Initializes a new instance of HttpSettingsRoutes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HttpSettingsRoutes() { } - /// Initializes a new instance of HttpSettingsRoutes. + /// Initializes a new instance of . /// The prefix that should precede all the authentication/authorization paths. - internal HttpSettingsRoutes(string apiPrefix) + /// Keeps track of any properties unknown to the library. + internal HttpSettingsRoutes(string apiPrefix, Dictionary serializedAdditionalRawData) { ApiPrefix = apiPrefix; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The prefix that should precede all the authentication/authorization paths. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.Serialization.cs index 5b9df6a3f0f8..7e7dcf693b9f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class IngressStickySessions : IUtf8JsonSerializable + internal partial class IngressStickySessions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Affinity)) { writer.WritePropertyName("affinity"u8); writer.WriteStringValue(Affinity.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IngressStickySessions DeserializeIngressStickySessions(JsonElement element) + internal static IngressStickySessions DeserializeIngressStickySessions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional affinity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("affinity"u8)) @@ -41,8 +64,61 @@ internal static IngressStickySessions DeserializeIngressStickySessions(JsonEleme affinity = new Affinity(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IngressStickySessions(Optional.ToNullable(affinity), serializedAdditionalRawData); + } + + IngressStickySessions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIngressStickySessions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IngressStickySessions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIngressStickySessions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IngressStickySessions model) + { + if (model is null) + { + return null; } - return new IngressStickySessions(Optional.ToNullable(affinity)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IngressStickySessions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIngressStickySessions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.cs index 01020e49a7ec..7b34c9ee746d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/IngressStickySessions.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Sticky Sessions for Single Revision Mode. internal partial class IngressStickySessions { - /// Initializes a new instance of IngressStickySessions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IngressStickySessions() { } - /// Initializes a new instance of IngressStickySessions. + /// Initializes a new instance of . /// Sticky Session Affinity. - internal IngressStickySessions(Affinity? affinity) + /// Keeps track of any properties unknown to the library. + internal IngressStickySessions(Affinity? affinity, Dictionary serializedAdditionalRawData) { Affinity = affinity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sticky Session Affinity. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.Serialization.cs index cf8392c29b75..bcffc15446bb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class JobConfigurationManualTriggerConfig : IUtf8JsonSerializable + public partial class JobConfigurationManualTriggerConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ReplicaCompletionCount)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parallelism"u8); writer.WriteNumberValue(Parallelism.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static JobConfigurationManualTriggerConfig DeserializeJobConfigurationManualTriggerConfig(JsonElement element) + internal static JobConfigurationManualTriggerConfig DeserializeJobConfigurationManualTriggerConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional replicaCompletionCount = default; Optional parallelism = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("replicaCompletionCount"u8)) @@ -56,8 +79,61 @@ internal static JobConfigurationManualTriggerConfig DeserializeJobConfigurationM parallelism = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JobConfigurationManualTriggerConfig(Optional.ToNullable(replicaCompletionCount), Optional.ToNullable(parallelism), serializedAdditionalRawData); + } + + JobConfigurationManualTriggerConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobConfigurationManualTriggerConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobConfigurationManualTriggerConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobConfigurationManualTriggerConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobConfigurationManualTriggerConfig model) + { + if (model is null) + { + return null; } - return new JobConfigurationManualTriggerConfig(Optional.ToNullable(replicaCompletionCount), Optional.ToNullable(parallelism)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobConfigurationManualTriggerConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobConfigurationManualTriggerConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.cs index 011f93dcd379..e64f9e601878 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationManualTriggerConfig.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Manual trigger configuration for a single execution job. Properties replicaCompletionCount and parallelism would be set to 1 by default. public partial class JobConfigurationManualTriggerConfig { - /// Initializes a new instance of JobConfigurationManualTriggerConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public JobConfigurationManualTriggerConfig() { } - /// Initializes a new instance of JobConfigurationManualTriggerConfig. + /// Initializes a new instance of . /// Minimum number of successful replica completions before overall job completion. /// Number of parallel replicas of a job that can run at a given time. - internal JobConfigurationManualTriggerConfig(int? replicaCompletionCount, int? parallelism) + /// Keeps track of any properties unknown to the library. + internal JobConfigurationManualTriggerConfig(int? replicaCompletionCount, int? parallelism, Dictionary serializedAdditionalRawData) { ReplicaCompletionCount = replicaCompletionCount; Parallelism = parallelism; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Minimum number of successful replica completions before overall job completion. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.Serialization.cs index 74f07e8244b0..700e11baaffd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class JobConfigurationScheduleTriggerConfig : IUtf8JsonSerializable + public partial class JobConfigurationScheduleTriggerConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ReplicaCompletionCount)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parallelism"u8); writer.WriteNumberValue(Parallelism.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static JobConfigurationScheduleTriggerConfig DeserializeJobConfigurationScheduleTriggerConfig(JsonElement element) + internal static JobConfigurationScheduleTriggerConfig DeserializeJobConfigurationScheduleTriggerConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static JobConfigurationScheduleTriggerConfig DeserializeJobConfiguratio Optional replicaCompletionCount = default; string cronExpression = default; Optional parallelism = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("replicaCompletionCount"u8)) @@ -64,8 +87,61 @@ internal static JobConfigurationScheduleTriggerConfig DeserializeJobConfiguratio parallelism = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JobConfigurationScheduleTriggerConfig(Optional.ToNullable(replicaCompletionCount), cronExpression, Optional.ToNullable(parallelism), serializedAdditionalRawData); + } + + JobConfigurationScheduleTriggerConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobConfigurationScheduleTriggerConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobConfigurationScheduleTriggerConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobConfigurationScheduleTriggerConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobConfigurationScheduleTriggerConfig model) + { + if (model is null) + { + return null; } - return new JobConfigurationScheduleTriggerConfig(Optional.ToNullable(replicaCompletionCount), cronExpression, Optional.ToNullable(parallelism)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobConfigurationScheduleTriggerConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobConfigurationScheduleTriggerConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.cs index 008f3a4f8000..8312ebbb0299 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobConfigurationScheduleTriggerConfig.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Cron formatted repeating trigger schedule ("* * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. public partial class JobConfigurationScheduleTriggerConfig { - /// Initializes a new instance of JobConfigurationScheduleTriggerConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Cron formatted repeating schedule ("* * * * *") of a Cron Job. /// is null. public JobConfigurationScheduleTriggerConfig(string cronExpression) @@ -23,15 +27,22 @@ public JobConfigurationScheduleTriggerConfig(string cronExpression) CronExpression = cronExpression; } - /// Initializes a new instance of JobConfigurationScheduleTriggerConfig. + /// Initializes a new instance of . /// Minimum number of successful replica completions before overall job completion. /// Cron formatted repeating schedule ("* * * * *") of a Cron Job. /// Number of parallel replicas of a job that can run at a given time. - internal JobConfigurationScheduleTriggerConfig(int? replicaCompletionCount, string cronExpression, int? parallelism) + /// Keeps track of any properties unknown to the library. + internal JobConfigurationScheduleTriggerConfig(int? replicaCompletionCount, string cronExpression, int? parallelism, Dictionary serializedAdditionalRawData) { ReplicaCompletionCount = replicaCompletionCount; CronExpression = cronExpression; Parallelism = parallelism; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal JobConfigurationScheduleTriggerConfig() + { } /// Minimum number of successful replica completions before overall job completion. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.Serialization.cs index 49858a56b042..94175a0016c0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class JobExecutionContainer : IUtf8JsonSerializable + public partial class JobExecutionContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Image)) { @@ -52,20 +59,48 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Env) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Resources)) { writer.WritePropertyName("resources"u8); - writer.WriteObjectValue(Resources); + if (Resources is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resources).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static JobExecutionContainer DeserializeJobExecutionContainer(JsonElement element) + internal static JobExecutionContainer DeserializeJobExecutionContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -76,6 +111,7 @@ internal static JobExecutionContainer DeserializeJobExecutionContainer(JsonEleme Optional> args = default; Optional> env = default; Optional resources = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("image"u8)) @@ -139,8 +175,61 @@ internal static JobExecutionContainer DeserializeJobExecutionContainer(JsonEleme resources = AppContainerResources.DeserializeAppContainerResources(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JobExecutionContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value, serializedAdditionalRawData); + } + + JobExecutionContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobExecutionContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobExecutionContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobExecutionContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobExecutionContainer model) + { + if (model is null) + { + return null; } - return new JobExecutionContainer(image.Value, name.Value, Optional.ToList(command), Optional.ToList(args), Optional.ToList(env), resources.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobExecutionContainer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobExecutionContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.cs index c0ee98203a66..017c5e7c2ff5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobExecutionContainer.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container Apps Jobs execution container definition. public partial class JobExecutionContainer { - /// Initializes a new instance of JobExecutionContainer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public JobExecutionContainer() { Command = new ChangeTrackingList(); @@ -21,14 +25,15 @@ public JobExecutionContainer() Env = new ChangeTrackingList(); } - /// Initializes a new instance of JobExecutionContainer. + /// Initializes a new instance of . /// Container image tag. /// Custom container name. /// Container start command. /// Container start command arguments. /// Container environment variables. /// Container resource requirements. - internal JobExecutionContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources) + /// Keeps track of any properties unknown to the library. + internal JobExecutionContainer(string image, string name, IList command, IList args, IList env, AppContainerResources resources, Dictionary serializedAdditionalRawData) { Image = image; Name = name; @@ -36,6 +41,7 @@ internal JobExecutionContainer(string image, string name, IList command, Args = args; Env = env; Resources = resources; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container image tag. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.Serialization.cs index c249f668ca09..e30d4925bf8c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class JobSecretsCollection + internal partial class JobSecretsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JobSecretsCollection DeserializeJobSecretsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JobSecretsCollection DeserializeJobSecretsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +74,61 @@ internal static JobSecretsCollection DeserializeJobSecretsCollection(JsonElement value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new JobSecretsCollection(value); + return new JobSecretsCollection(value, serializedAdditionalRawData); + } + + JobSecretsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobSecretsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobSecretsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobSecretsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobSecretsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobSecretsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobSecretsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.cs index 9801901eabcd..ae21c1f37613 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/JobSecretsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container Apps Job Secrets Collection ARM resource. internal partial class JobSecretsCollection { - /// Initializes a new instance of JobSecretsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal JobSecretsCollection(IEnumerable value) @@ -25,11 +28,18 @@ internal JobSecretsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of JobSecretsCollection. + /// Initializes a new instance of . /// Collection of resources. - internal JobSecretsCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal JobSecretsCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal JobSecretsCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.Serialization.cs index af805830d873..28e20f9913c3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.Serialization.cs @@ -5,26 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class KedaConfiguration : IUtf8JsonSerializable + internal partial class KedaConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KedaConfiguration DeserializeKedaConfiguration(JsonElement element) + internal static KedaConfiguration DeserializeKedaConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("version"u8)) @@ -32,8 +55,61 @@ internal static KedaConfiguration DeserializeKedaConfiguration(JsonElement eleme version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KedaConfiguration(version.Value, serializedAdditionalRawData); + } + + KedaConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKedaConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KedaConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKedaConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KedaConfiguration model) + { + if (model is null) + { + return null; } - return new KedaConfiguration(version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KedaConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKedaConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.cs index bbd75aca76ee..17dec4480be1 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/KedaConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Configuration properties Keda component. internal partial class KedaConfiguration { - /// Initializes a new instance of KedaConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public KedaConfiguration() { } - /// Initializes a new instance of KedaConfiguration. + /// Initializes a new instance of . /// The version of Keda. - internal KedaConfiguration(string version) + /// Keeps track of any properties unknown to the library. + internal KedaConfiguration(string version, Dictionary serializedAdditionalRawData) { Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The version of Keda. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.Serialization.cs index 9804c3320144..0c7acc75772e 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class LoginRoutes : IUtf8JsonSerializable + internal partial class LoginRoutes : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LogoutEndpoint)) { writer.WritePropertyName("logoutEndpoint"u8); writer.WriteStringValue(LogoutEndpoint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LoginRoutes DeserializeLoginRoutes(JsonElement element) + internal static LoginRoutes DeserializeLoginRoutes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional logoutEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logoutEndpoint"u8)) @@ -37,8 +60,61 @@ internal static LoginRoutes DeserializeLoginRoutes(JsonElement element) logoutEndpoint = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LoginRoutes(logoutEndpoint.Value, serializedAdditionalRawData); + } + + LoginRoutes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLoginRoutes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LoginRoutes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLoginRoutes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LoginRoutes model) + { + if (model is null) + { + return null; } - return new LoginRoutes(logoutEndpoint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LoginRoutes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLoginRoutes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.cs index be443c0c01c2..b555691da88f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginRoutes.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// The routes that specify the endpoints used for login and logout requests. internal partial class LoginRoutes { - /// Initializes a new instance of LoginRoutes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LoginRoutes() { } - /// Initializes a new instance of LoginRoutes. + /// Initializes a new instance of . /// The endpoint at which a logout request should be made. - internal LoginRoutes(string logoutEndpoint) + /// Keeps track of any properties unknown to the library. + internal LoginRoutes(string logoutEndpoint, Dictionary serializedAdditionalRawData) { LogoutEndpoint = logoutEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The endpoint at which a logout request should be made. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.Serialization.cs index ab70ee88e57c..91bdc2081d14 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class LoginScopes : IUtf8JsonSerializable + internal partial class LoginScopes : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Scopes)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LoginScopes DeserializeLoginScopes(JsonElement element) + internal static LoginScopes DeserializeLoginScopes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> scopes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scopes"u8)) @@ -52,8 +74,61 @@ internal static LoginScopes DeserializeLoginScopes(JsonElement element) scopes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LoginScopes(Optional.ToList(scopes), serializedAdditionalRawData); + } + + LoginScopes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLoginScopes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LoginScopes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLoginScopes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LoginScopes model) + { + if (model is null) + { + return null; } - return new LoginScopes(Optional.ToList(scopes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LoginScopes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLoginScopes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.cs index 782e4ebfcfc7..dbdd65dad5a9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/LoginScopes.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.AppContainers.Models /// The configuration settings of the login flow, including the scopes that should be requested. internal partial class LoginScopes { - /// Initializes a new instance of LoginScopes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LoginScopes() { Scopes = new ChangeTrackingList(); } - /// Initializes a new instance of LoginScopes. + /// Initializes a new instance of . /// A list of the scopes that should be requested while authenticating. - internal LoginScopes(IList scopes) + /// Keeps track of any properties unknown to the library. + internal LoginScopes(IList scopes, Dictionary serializedAdditionalRawData) { Scopes = scopes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of the scopes that should be requested while authenticating. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.Serialization.cs index 8c2b86649f77..81c989831908 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ManagedCertificateCollection + internal partial class ManagedCertificateCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedCertificateCollection DeserializeManagedCertificateCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedCertificateCollection DeserializeManagedCertificateCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static ManagedCertificateCollection DeserializeManagedCertificateCollec nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedCertificateCollection(value, nextLink.Value); + return new ManagedCertificateCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ManagedCertificateCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedCertificateCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedCertificateCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedCertificateCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedCertificateCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedCertificateCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedCertificateCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.cs index 889fbdfaf35d..38a0752198a4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of Managed Certificates. internal partial class ManagedCertificateCollection { - /// Initializes a new instance of ManagedCertificateCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal ManagedCertificateCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal ManagedCertificateCollection(IEnumerable Initializes a new instance of ManagedCertificateCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal ManagedCertificateCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ManagedCertificateCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedCertificateCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.Serialization.cs index d061c4533b79..fb7de537ad38 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class ManagedCertificateProperties : IUtf8JsonSerializable + public partial class ManagedCertificateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SubjectName)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("domainControlValidation"u8); writer.WriteStringValue(DomainControlValidation.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedCertificateProperties DeserializeManagedCertificateProperties(JsonElement element) + internal static ManagedCertificateProperties DeserializeManagedCertificateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ManagedCertificateProperties DeserializeManagedCertificateProper Optional error = default; Optional domainControlValidation = default; Optional validationToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -74,8 +97,61 @@ internal static ManagedCertificateProperties DeserializeManagedCertificateProper validationToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedCertificateProperties(Optional.ToNullable(provisioningState), subjectName.Value, error.Value, Optional.ToNullable(domainControlValidation), validationToken.Value, serializedAdditionalRawData); + } + + ManagedCertificateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedCertificateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedCertificateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedCertificateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedCertificateProperties model) + { + if (model is null) + { + return null; } - return new ManagedCertificateProperties(Optional.ToNullable(provisioningState), subjectName.Value, error.Value, Optional.ToNullable(domainControlValidation), validationToken.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedCertificateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedCertificateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.cs index a5262d02ef60..39afc061eb40 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedCertificateProperties.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Certificate resource specific properties. public partial class ManagedCertificateProperties { - /// Initializes a new instance of ManagedCertificateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedCertificateProperties() { } - /// Initializes a new instance of ManagedCertificateProperties. + /// Initializes a new instance of . /// Provisioning state of the certificate. /// Subject name of the certificate. /// Any error occurred during the certificate provision. /// Selected type of domain control validation for managed certificates. /// A TXT token used for DNS TXT domain control validation when issuing this type of managed certificates. - internal ManagedCertificateProperties(ContainerAppCertificateProvisioningState? provisioningState, string subjectName, string error, ManagedCertificateDomainControlValidation? domainControlValidation, string validationToken) + /// Keeps track of any properties unknown to the library. + internal ManagedCertificateProperties(ContainerAppCertificateProvisioningState? provisioningState, string subjectName, string error, ManagedCertificateDomainControlValidation? domainControlValidation, string validationToken, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; SubjectName = subjectName; Error = error; DomainControlValidation = domainControlValidation; ValidationToken = validationToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the certificate. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.Serialization.cs index 3c77dadd019c..67f791cf30f6 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ManagedEnvironmentPropertiesPeerAuthentication : IUtf8JsonSerializable + internal partial class ManagedEnvironmentPropertiesPeerAuthentication : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Mtls)) { writer.WritePropertyName("mtls"u8); - writer.WriteObjectValue(Mtls); + if (Mtls is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Mtls).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedEnvironmentPropertiesPeerAuthentication DeserializeManagedEnvironmentPropertiesPeerAuthentication(JsonElement element) + internal static ManagedEnvironmentPropertiesPeerAuthentication DeserializeManagedEnvironmentPropertiesPeerAuthentication(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional mtls = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mtls"u8)) @@ -41,8 +71,61 @@ internal static ManagedEnvironmentPropertiesPeerAuthentication DeserializeManage mtls = Mtls.DeserializeMtls(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedEnvironmentPropertiesPeerAuthentication(mtls.Value, serializedAdditionalRawData); + } + + ManagedEnvironmentPropertiesPeerAuthentication IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedEnvironmentPropertiesPeerAuthentication(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedEnvironmentPropertiesPeerAuthentication IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedEnvironmentPropertiesPeerAuthentication(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedEnvironmentPropertiesPeerAuthentication model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedEnvironmentPropertiesPeerAuthentication(Response response) + { + if (response is null) + { + return null; } - return new ManagedEnvironmentPropertiesPeerAuthentication(mtls.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedEnvironmentPropertiesPeerAuthentication(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.cs index 16b52fb8fd42..ec7225a4be3f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentPropertiesPeerAuthentication.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Peer authentication settings for the Managed Environment. internal partial class ManagedEnvironmentPropertiesPeerAuthentication { - /// Initializes a new instance of ManagedEnvironmentPropertiesPeerAuthentication. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedEnvironmentPropertiesPeerAuthentication() { } - /// Initializes a new instance of ManagedEnvironmentPropertiesPeerAuthentication. + /// Initializes a new instance of . /// Mutual TLS authentication settings for the Managed Environment. - internal ManagedEnvironmentPropertiesPeerAuthentication(Mtls mtls) + /// Keeps track of any properties unknown to the library. + internal ManagedEnvironmentPropertiesPeerAuthentication(Mtls mtls, Dictionary serializedAdditionalRawData) { Mtls = mtls; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Mutual TLS authentication settings for the Managed Environment. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.Serialization.cs index 2c945b34b723..377bf2b80c5b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ManagedEnvironmentStorageProperties : IUtf8JsonSerializable + internal partial class ManagedEnvironmentStorageProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AzureFile)) { writer.WritePropertyName("azureFile"u8); - writer.WriteObjectValue(AzureFile); + if (AzureFile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureFile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedEnvironmentStorageProperties DeserializeManagedEnvironmentStorageProperties(JsonElement element) + internal static ManagedEnvironmentStorageProperties DeserializeManagedEnvironmentStorageProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional azureFile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("azureFile"u8)) @@ -41,8 +71,61 @@ internal static ManagedEnvironmentStorageProperties DeserializeManagedEnvironmen azureFile = ContainerAppAzureFileProperties.DeserializeContainerAppAzureFileProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedEnvironmentStorageProperties(azureFile.Value, serializedAdditionalRawData); + } + + ManagedEnvironmentStorageProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedEnvironmentStorageProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedEnvironmentStorageProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedEnvironmentStorageProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedEnvironmentStorageProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedEnvironmentStorageProperties(Response response) + { + if (response is null) + { + return null; } - return new ManagedEnvironmentStorageProperties(azureFile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedEnvironmentStorageProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.cs index 9894648cc8b8..23f0ece40d88 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStorageProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Storage properties. internal partial class ManagedEnvironmentStorageProperties { - /// Initializes a new instance of ManagedEnvironmentStorageProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedEnvironmentStorageProperties() { } - /// Initializes a new instance of ManagedEnvironmentStorageProperties. + /// Initializes a new instance of . /// Azure file properties. - internal ManagedEnvironmentStorageProperties(ContainerAppAzureFileProperties azureFile) + /// Keeps track of any properties unknown to the library. + internal ManagedEnvironmentStorageProperties(ContainerAppAzureFileProperties azureFile, Dictionary serializedAdditionalRawData) { AzureFile = azureFile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Azure file properties. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.Serialization.cs index 37980654b7cf..3a9fe204eeba 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ManagedEnvironmentStoragesCollection + internal partial class ManagedEnvironmentStoragesCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedEnvironmentStoragesCollection DeserializeManagedEnvironmentStoragesCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedEnvironmentStoragesCollection DeserializeManagedEnvironmentStoragesCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -33,8 +75,61 @@ internal static ManagedEnvironmentStoragesCollection DeserializeManagedEnvironme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedEnvironmentStoragesCollection(value); + return new ManagedEnvironmentStoragesCollection(value, serializedAdditionalRawData); + } + + ManagedEnvironmentStoragesCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedEnvironmentStoragesCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedEnvironmentStoragesCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedEnvironmentStoragesCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedEnvironmentStoragesCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedEnvironmentStoragesCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedEnvironmentStoragesCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.cs index e2fb6d2317e2..f3fa7e8d438d 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentStoragesCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of Storage for Environments. internal partial class ManagedEnvironmentStoragesCollection { - /// Initializes a new instance of ManagedEnvironmentStoragesCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of storage resources. /// is null. internal ManagedEnvironmentStoragesCollection(IEnumerable value) @@ -26,11 +29,18 @@ internal ManagedEnvironmentStoragesCollection(IEnumerable Initializes a new instance of ManagedEnvironmentStoragesCollection. + /// Initializes a new instance of . /// Collection of storage resources. - internal ManagedEnvironmentStoragesCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ManagedEnvironmentStoragesCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedEnvironmentStoragesCollection() + { } /// Collection of storage resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.Serialization.cs index 93401b943c43..3bdba2d945c9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ManagedEnvironmentsCollection + internal partial class ManagedEnvironmentsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedEnvironmentsCollection DeserializeManagedEnvironmentsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedEnvironmentsCollection DeserializeManagedEnvironmentsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static ManagedEnvironmentsCollection DeserializeManagedEnvironmentsColl nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedEnvironmentsCollection(value, nextLink.Value); + return new ManagedEnvironmentsCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + ManagedEnvironmentsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedEnvironmentsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedEnvironmentsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedEnvironmentsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedEnvironmentsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedEnvironmentsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedEnvironmentsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.cs index c5ecd4f2d555..64e1f55100ca 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ManagedEnvironmentsCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of Environments. internal partial class ManagedEnvironmentsCollection { - /// Initializes a new instance of ManagedEnvironmentsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal ManagedEnvironmentsCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal ManagedEnvironmentsCollection(IEnumerable Initializes a new instance of ManagedEnvironmentsCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal ManagedEnvironmentsCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ManagedEnvironmentsCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedEnvironmentsCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.Serialization.cs index b91b8cb401a5..90da4d35b694 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class Mtls : IUtf8JsonSerializable + internal partial class Mtls : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsMtlsEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsMtlsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Mtls DeserializeMtls(JsonElement element) + internal static Mtls DeserializeMtls(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static Mtls DeserializeMtls(JsonElement element) enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Mtls(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + Mtls IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMtls(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Mtls IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMtls(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Mtls model) + { + if (model is null) + { + return null; } - return new Mtls(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Mtls(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMtls(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.cs index 1bedc483f137..02db4bb26010 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Mtls.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Configuration properties for mutual TLS authentication. internal partial class Mtls { - /// Initializes a new instance of Mtls. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Mtls() { } - /// Initializes a new instance of Mtls. + /// Initializes a new instance of . /// Boolean indicating whether the mutual TLS authentication is enabled. - internal Mtls(bool? isMtlsEnabled) + /// Keeps track of any properties unknown to the library. + internal Mtls(bool? isMtlsEnabled, Dictionary serializedAdditionalRawData) { IsMtlsEnabled = isMtlsEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Boolean indicating whether the mutual TLS authentication is enabled. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.Serialization.cs index a3cd64f4fd63..1288dbff82ab 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class ReplicaCollection + internal partial class ReplicaCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ReplicaCollection DeserializeReplicaCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ReplicaCollection DeserializeReplicaCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -33,8 +75,61 @@ internal static ReplicaCollection DeserializeReplicaCollection(JsonElement eleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReplicaCollection(value); + return new ReplicaCollection(value, serializedAdditionalRawData); + } + + ReplicaCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReplicaCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReplicaCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReplicaCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReplicaCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReplicaCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReplicaCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.cs index 39a69390a4b9..8866ac7413de 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ReplicaCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App Revision Replicas collection ARM resource. internal partial class ReplicaCollection { - /// Initializes a new instance of ReplicaCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal ReplicaCollection(IEnumerable value) @@ -26,11 +29,18 @@ internal ReplicaCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of ReplicaCollection. + /// Initializes a new instance of . /// Collection of resources. - internal ReplicaCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ReplicaCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReplicaCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.Serialization.cs index fabb0981be9f..e087860927e5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class RevisionCollection + internal partial class RevisionCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RevisionCollection DeserializeRevisionCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RevisionCollection DeserializeRevisionCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static RevisionCollection DeserializeRevisionCollection(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RevisionCollection(value, nextLink.Value); + return new RevisionCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + RevisionCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRevisionCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RevisionCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRevisionCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RevisionCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RevisionCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRevisionCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.cs index 6cf146b5bb52..8740da4a1b16 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/RevisionCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App Revisions collection ARM resource. internal partial class RevisionCollection { - /// Initializes a new instance of RevisionCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal RevisionCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal RevisionCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of RevisionCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal RevisionCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RevisionCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RevisionCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.Serialization.cs index 6ac37893bc2e..b52c71fb98f0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - public partial class SecretVolumeItem : IUtf8JsonSerializable + public partial class SecretVolumeItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SecretRef)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("path"u8); writer.WriteStringValue(Path); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecretVolumeItem DeserializeSecretVolumeItem(JsonElement element) + internal static SecretVolumeItem DeserializeSecretVolumeItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional secretRef = default; Optional path = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretRef"u8)) @@ -48,8 +71,61 @@ internal static SecretVolumeItem DeserializeSecretVolumeItem(JsonElement element path = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SecretVolumeItem(secretRef.Value, path.Value, serializedAdditionalRawData); + } + + SecretVolumeItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecretVolumeItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecretVolumeItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecretVolumeItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecretVolumeItem model) + { + if (model is null) + { + return null; } - return new SecretVolumeItem(secretRef.Value, path.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecretVolumeItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecretVolumeItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.cs index 07dd6afe7d3f..d959fb5802ad 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretVolumeItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.AppContainers.Models { /// Secret to be added to volume. public partial class SecretVolumeItem { - /// Initializes a new instance of SecretVolumeItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SecretVolumeItem() { } - /// Initializes a new instance of SecretVolumeItem. + /// Initializes a new instance of . /// Name of the Container App secret from which to pull the secret value. /// Path to project secret to. If no path is provided, path defaults to name of secret listed in secretRef. - internal SecretVolumeItem(string secretRef, string path) + /// Keeps track of any properties unknown to the library. + internal SecretVolumeItem(string secretRef, string path, Dictionary serializedAdditionalRawData) { SecretRef = secretRef; Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Container App secret from which to pull the secret value. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.Serialization.cs index f43cd2391043..b0d47a8953de 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class SecretsCollection + internal partial class SecretsCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SecretsCollection DeserializeSecretsCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SecretsCollection DeserializeSecretsCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +74,61 @@ internal static SecretsCollection DeserializeSecretsCollection(JsonElement eleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SecretsCollection(value); + return new SecretsCollection(value, serializedAdditionalRawData); + } + + SecretsCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecretsCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecretsCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecretsCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecretsCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecretsCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecretsCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.cs index ded708920a1a..a58f8d8bec0a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SecretsCollection.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App Secrets Collection ARM resource. internal partial class SecretsCollection { - /// Initializes a new instance of SecretsCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal SecretsCollection(IEnumerable value) @@ -25,11 +28,18 @@ internal SecretsCollection(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of SecretsCollection. + /// Initializes a new instance of . /// Collection of resources. - internal SecretsCollection(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal SecretsCollection(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretsCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.Serialization.cs index ff025e3b058b..edf2ae97bf7c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class Service : IUtf8JsonSerializable + internal partial class Service : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ServiceType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Service DeserializeService(JsonElement element) + internal static Service DeserializeService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -34,8 +57,61 @@ internal static Service DeserializeService(JsonElement element) type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Service(type, serializedAdditionalRawData); + } + + Service IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Service IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Service model) + { + if (model is null) + { + return null; } - return new Service(type); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Service(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.cs index 0fcba3493801..97212193c274 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/Service.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.AppContainers.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Container App to be a dev service. internal partial class Service { - /// Initializes a new instance of Service. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Dev ContainerApp service type. /// is null. public Service(string serviceType) @@ -23,6 +27,20 @@ public Service(string serviceType) ServiceType = serviceType; } + /// Initializes a new instance of . + /// Dev ContainerApp service type. + /// Keeps track of any properties unknown to the library. + internal Service(string serviceType, Dictionary serializedAdditionalRawData) + { + ServiceType = serviceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Service() + { + } + /// Dev ContainerApp service type. public string ServiceType { get; set; } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.Serialization.cs index 9ff0a0afef51..ddba8d4ff291 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.Serialization.cs @@ -5,23 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.AppContainers; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class SourceControlCollection + internal partial class SourceControlCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceControlCollection DeserializeSourceControlCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceControlCollection DeserializeSourceControlCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +81,61 @@ internal static SourceControlCollection DeserializeSourceControlCollection(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceControlCollection(value, nextLink.Value); + return new SourceControlCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + SourceControlCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceControlCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceControlCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceControlCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceControlCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceControlCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceControlCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.cs index b93d9cf302a0..8a3d203c29cf 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/SourceControlCollection.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// SourceControl collection ARM resource. internal partial class SourceControlCollection { - /// Initializes a new instance of SourceControlCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal SourceControlCollection(IEnumerable value) @@ -26,13 +29,20 @@ internal SourceControlCollection(IEnumerable valu Value = value.ToList(); } - /// Initializes a new instance of SourceControlCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal SourceControlCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal SourceControlCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SourceControlCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.Serialization.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.Serialization.cs index a6056a06605c..248b219100eb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.Serialization.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.AppContainers.Models { - internal partial class WorkloadProfileStatesCollection + internal partial class WorkloadProfileStatesCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WorkloadProfileStatesCollection DeserializeWorkloadProfileStatesCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WorkloadProfileStatesCollection DeserializeWorkloadProfileStatesCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static WorkloadProfileStatesCollection DeserializeWorkloadProfileStates nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WorkloadProfileStatesCollection(value, nextLink.Value); + return new WorkloadProfileStatesCollection(value, nextLink.Value, serializedAdditionalRawData); + } + + WorkloadProfileStatesCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadProfileStatesCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WorkloadProfileStatesCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWorkloadProfileStatesCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WorkloadProfileStatesCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WorkloadProfileStatesCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWorkloadProfileStatesCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.cs index e37548559854..c3f742486414 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/WorkloadProfileStatesCollection.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.AppContainers.Models /// Collection of workloadProfileStates. internal partial class WorkloadProfileStatesCollection { - /// Initializes a new instance of WorkloadProfileStatesCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal WorkloadProfileStatesCollection(IEnumerable value) @@ -25,13 +28,20 @@ internal WorkloadProfileStatesCollection(IEnumerable Initializes a new instance of WorkloadProfileStatesCollection. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal WorkloadProfileStatesCollection(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WorkloadProfileStatesCollection(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkloadProfileStatesCollection() + { } /// Collection of resources. diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/CertificatesRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/CertificatesRestOperations.cs index e86971ec4a29..a5179e59501f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/CertificatesRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/CertificatesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -391,9 +389,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsCertificatesRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsCertificatesRestOperations.cs index 663ae2164d2b..7034690db14c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsCertificatesRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsCertificatesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -391,9 +389,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsDaprComponentsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsDaprComponentsRestOperations.cs index 500be90c33bd..3054aa81f4de 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsDaprComponentsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsDaprComponentsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsRestOperations.cs index 44986f2136ff..dd09a41478bd 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -505,9 +503,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsStoragesRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsStoragesRestOperations.cs index 930a7c8dd99d..d1c0634c3a99 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsStoragesRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ConnectedEnvironmentsStoragesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsAuthConfigsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsAuthConfigsRestOperations.cs index 82e501d5868d..3e084e971274 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsAuthConfigsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsAuthConfigsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsRestOperations.cs index 89b0b5b8abeb..9cd5f564b27b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -426,9 +424,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsSourceControlsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsSourceControlsRestOperations.cs index d908cf817ede..92970d12a9ef 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsSourceControlsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ContainerAppsSourceControlsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/DaprComponentsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/DaprComponentsRestOperations.cs index 4dc10ca5dafd..d70bc5ae5b62 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/DaprComponentsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/DaprComponentsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/JobsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/JobsRestOperations.cs index 7e266b191f0b..b5fbdcc132c5 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/JobsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/JobsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -426,9 +424,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -507,9 +503,7 @@ internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGr if (template != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(template); - request.Content = content; + request.Content = template; } _userAgent.Apply(message); return message; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedCertificatesRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedCertificatesRestOperations.cs index 838cfe9e69bf..fe946d9cfbfa 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedCertificatesRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedCertificatesRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -304,9 +302,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsRestOperations.cs index f9a5f61153b2..32f96f698c90 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -426,9 +424,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsStoragesRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsStoragesRestOperations.cs index a2cc6236cca5..3f6e1c800975 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsStoragesRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/ManagedEnvironmentsStoragesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/NamespacesRestOperations.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/NamespacesRestOperations.cs index a1ea94abd4b3..8414929bddfe 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/NamespacesRestOperations.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/RestOperations/NamespacesRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ArmContainerInstanceModelFactory.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ArmContainerInstanceModelFactory.cs index 69a6204486c3..ff35a5bc1c4b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ArmContainerInstanceModelFactory.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ArmContainerInstanceModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// Model factory for models. public static partial class ArmContainerInstanceModelFactory { - /// Initializes a new instance of ContainerGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -62,10 +62,10 @@ public static ContainerGroupData ContainerGroupData(ResourceIdentifier id = null initContainers ??= new List(); extensions ??= new List(); - return new ContainerGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), identity, provisioningState, containers?.ToList(), imageRegistryCredentials?.ToList(), restartPolicy, ipAddress, osType, volumes?.ToList(), instanceView, diagnosticsLogAnalytics != null ? new ContainerGroupDiagnostics(diagnosticsLogAnalytics) : null, subnetIds?.ToList(), dnsConfig, sku, encryptionProperties, initContainers?.ToList(), extensions?.ToList(), confidentialComputeCcePolicy != null ? new ConfidentialComputeProperties(confidentialComputeCcePolicy) : null, priority); + return new ContainerGroupData(id, name, resourceType, systemData, tags, location, zones?.ToList(), identity, provisioningState, containers?.ToList(), imageRegistryCredentials?.ToList(), restartPolicy, ipAddress, osType, volumes?.ToList(), instanceView, diagnosticsLogAnalytics != null ? new ContainerGroupDiagnostics(diagnosticsLogAnalytics, new Dictionary()) : null, subnetIds?.ToList(), dnsConfig, sku, encryptionProperties, initContainers?.ToList(), extensions?.ToList(), confidentialComputeCcePolicy != null ? new ConfidentialComputeProperties(confidentialComputeCcePolicy, new Dictionary()) : null, priority, default); } - /// Initializes a new instance of ContainerGroupPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -79,10 +79,10 @@ public static ContainerGroupPatch ContainerGroupPatch(ResourceIdentifier id = nu tags ??= new Dictionary(); zones ??= new List(); - return new ContainerGroupPatch(id, name, resourceType, systemData, tags, location, zones?.ToList()); + return new ContainerGroupPatch(id, name, resourceType, systemData, tags, location, zones?.ToList(), default); } - /// Initializes a new instance of ContainerInstanceContainer. + /// Initializes a new instance of . /// The user-provided name of the container instance. /// The name of the image used to create the container instance. /// The commands to execute within the container instance in exec form. @@ -102,10 +102,10 @@ public static ContainerInstanceContainer ContainerInstanceContainer(string name environmentVariables ??= new List(); volumeMounts ??= new List(); - return new ContainerInstanceContainer(name, image, command?.ToList(), ports?.ToList(), environmentVariables?.ToList(), instanceView, resources, volumeMounts?.ToList(), livenessProbe, readinessProbe, securityContext); + return new ContainerInstanceContainer(name, image, command?.ToList(), ports?.ToList(), environmentVariables?.ToList(), instanceView, resources, volumeMounts?.ToList(), livenessProbe, readinessProbe, securityContext, default); } - /// Initializes a new instance of ContainerInstanceView. + /// Initializes a new instance of . /// The number of times that the container instance has been restarted. /// Current container instance state. /// Previous container instance state. @@ -115,10 +115,10 @@ public static ContainerInstanceView ContainerInstanceView(int? restartCount = nu { events ??= new List(); - return new ContainerInstanceView(restartCount, currentState, previousState, events?.ToList()); + return new ContainerInstanceView(restartCount, currentState, previousState, events?.ToList(), default); } - /// Initializes a new instance of ContainerState. + /// Initializes a new instance of . /// The state of the container instance. /// The date-time when the container instance state started. /// The container instance exit codes correspond to those from the `docker run` command. @@ -127,10 +127,10 @@ public static ContainerInstanceView ContainerInstanceView(int? restartCount = nu /// A new instance for mocking. public static ContainerState ContainerState(string state = null, DateTimeOffset? startOn = null, int? exitCode = null, DateTimeOffset? finishOn = null, string detailStatus = null) { - return new ContainerState(state, startOn, exitCode, finishOn, detailStatus); + return new ContainerState(state, startOn, exitCode, finishOn, detailStatus, default); } - /// Initializes a new instance of ContainerEvent. + /// Initializes a new instance of . /// The count of the event. /// The date-time of the earliest logged event. /// The date-time of the latest logged event. @@ -140,10 +140,10 @@ public static ContainerState ContainerState(string state = null, DateTimeOffset? /// A new instance for mocking. public static ContainerEvent ContainerEvent(int? count = null, DateTimeOffset? firstTimestamp = null, DateTimeOffset? lastTimestamp = null, string name = null, string message = null, string eventType = null) { - return new ContainerEvent(count, firstTimestamp, lastTimestamp, name, message, eventType); + return new ContainerEvent(count, firstTimestamp, lastTimestamp, name, message, eventType, default); } - /// Initializes a new instance of ContainerGroupIPAddress. + /// Initializes a new instance of . /// The list of ports exposed on the container group. /// Specifies if the IP is exposed to the public internet or private VNET. /// The IP exposed to the public internet. @@ -155,10 +155,10 @@ public static ContainerGroupIPAddress ContainerGroupIPAddress(IEnumerable(); - return new ContainerGroupIPAddress(ports?.ToList(), addressType, ip, dnsNameLabel, autoGeneratedDomainNameLabelScope, fqdn); + return new ContainerGroupIPAddress(ports?.ToList(), addressType, ip, dnsNameLabel, autoGeneratedDomainNameLabelScope, fqdn, default); } - /// Initializes a new instance of ContainerGroupInstanceView. + /// Initializes a new instance of . /// The events of this container group. /// The state of the container group. Only valid in response. /// A new instance for mocking. @@ -166,10 +166,10 @@ public static ContainerGroupInstanceView ContainerGroupInstanceView(IEnumerable< { events ??= new List(); - return new ContainerGroupInstanceView(events?.ToList(), state); + return new ContainerGroupInstanceView(events?.ToList(), state, default); } - /// Initializes a new instance of InitContainerDefinitionContent. + /// Initializes a new instance of . /// The name for the init container. /// The image of the init container. /// The command to execute within the init container in exec form. @@ -184,10 +184,10 @@ public static InitContainerDefinitionContent InitContainerDefinitionContent(stri environmentVariables ??= new List(); volumeMounts ??= new List(); - return new InitContainerDefinitionContent(name, image, command?.ToList(), environmentVariables?.ToList(), instanceView, volumeMounts?.ToList(), securityContext); + return new InitContainerDefinitionContent(name, image, command?.ToList(), environmentVariables?.ToList(), instanceView, volumeMounts?.ToList(), securityContext, default); } - /// Initializes a new instance of InitContainerPropertiesDefinitionInstanceView. + /// Initializes a new instance of . /// The number of times that the init container has been restarted. /// The current state of the init container. /// The previous state of the init container. @@ -197,10 +197,10 @@ public static InitContainerPropertiesDefinitionInstanceView InitContainerPropert { events ??= new List(); - return new InitContainerPropertiesDefinitionInstanceView(restartCount, currentState, previousState, events?.ToList()); + return new InitContainerPropertiesDefinitionInstanceView(restartCount, currentState, previousState, events?.ToList(), default); } - /// Initializes a new instance of ContainerInstanceUsage. + /// Initializes a new instance of . /// Id of the usage result. /// Unit of the usage result. /// The current usage of the resource. @@ -209,64 +209,54 @@ public static InitContainerPropertiesDefinitionInstanceView InitContainerPropert /// A new instance for mocking. public static ContainerInstanceUsage ContainerInstanceUsage(string id = null, string unit = null, int? currentValue = null, int? limit = null, ContainerInstanceUsageName name = null) { - return new ContainerInstanceUsage(id, unit, currentValue, limit, name); + return new ContainerInstanceUsage(id, unit, currentValue, limit, name, default); } - /// Initializes a new instance of ContainerInstanceUsageName. + /// Initializes a new instance of . /// The name of the resource. /// The localized name of the resource. /// A new instance for mocking. public static ContainerInstanceUsageName ContainerInstanceUsageName(string value = null, string localizedValue = null) { - return new ContainerInstanceUsageName(value, localizedValue); + return new ContainerInstanceUsageName(value, localizedValue, default); } - /// Initializes a new instance of ContainerLogs. + /// Initializes a new instance of . /// The content of the log. /// A new instance for mocking. public static ContainerLogs ContainerLogs(string content = null) { - return new ContainerLogs(content); + return new ContainerLogs(content, default); } - /// Initializes a new instance of ContainerExecResult. + /// Initializes a new instance of . /// The uri for the exec websocket. /// The password to start the exec command. /// A new instance for mocking. public static ContainerExecResult ContainerExecResult(Uri webSocketUri = null, string password = null) { - return new ContainerExecResult(webSocketUri, password); + return new ContainerExecResult(webSocketUri, password, default); } - /// Initializes a new instance of ContainerAttachResult. + /// Initializes a new instance of . /// The uri for the output stream from the attach. /// The password to the output stream from the attach. Send as an Authorization header value when connecting to the websocketUri. /// A new instance for mocking. public static ContainerAttachResult ContainerAttachResult(Uri webSocketUri = null, string password = null) { - return new ContainerAttachResult(webSocketUri, password); + return new ContainerAttachResult(webSocketUri, password, default); } - /// Initializes a new instance of CachedImages. + /// Initializes a new instance of . /// The OS type of the cached image. /// The cached image name. - /// or is null. /// A new instance for mocking. public static CachedImages CachedImages(string osType = null, string image = null) { - if (osType == null) - { - throw new ArgumentNullException(nameof(osType)); - } - if (image == null) - { - throw new ArgumentNullException(nameof(image)); - } - - return new CachedImages(osType, image); + return new CachedImages(osType, image, default); } - /// Initializes a new instance of ContainerCapabilities. + /// Initializes a new instance of . /// The resource type that this capability describes. /// The OS type that this capability describes. /// The resource location. @@ -276,17 +266,17 @@ public static CachedImages CachedImages(string osType = null, string image = nul /// A new instance for mocking. public static ContainerCapabilities ContainerCapabilities(string resourceType = null, string osType = null, AzureLocation? location = null, string ipAddressType = null, string gpu = null, ContainerSupportedCapabilities capabilities = null) { - return new ContainerCapabilities(resourceType, osType, location, ipAddressType, gpu, capabilities); + return new ContainerCapabilities(resourceType, osType, location, ipAddressType, gpu, capabilities, default); } - /// Initializes a new instance of ContainerSupportedCapabilities. + /// Initializes a new instance of . /// The maximum allowed memory request in GB. /// The maximum allowed CPU request in cores. /// The maximum allowed GPU count. /// A new instance for mocking. public static ContainerSupportedCapabilities ContainerSupportedCapabilities(float? maxMemoryInGB = null, float? maxCpu = null, float? maxGpuCount = null) { - return new ContainerSupportedCapabilities(maxMemoryInGB, maxCpu, maxGpuCount); + return new ContainerSupportedCapabilities(maxMemoryInGB, maxCpu, maxGpuCount, default); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs index b5139c08041f..d5f75f5d3fe3 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerGroupRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerGroupRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs index 2569a9ee6c3f..b763a2e0be63 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ContainerInstance /// public partial class ContainerGroupData : TrackedResourceData { - /// Initializes a new instance of ContainerGroupData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The containers within the container group. /// The operating system type required by the containers in the container group. @@ -39,7 +42,7 @@ public ContainerGroupData(AzureLocation location, IEnumerable(); } - /// Initializes a new instance of ContainerGroupData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -71,7 +74,8 @@ public ContainerGroupData(AzureLocation location, IEnumerable extensions used by virtual kubelet. /// The properties for confidential container group. /// The priority of the container group. - internal ContainerGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ManagedServiceIdentity identity, string provisioningState, IList containers, IList imageRegistryCredentials, ContainerGroupRestartPolicy? restartPolicy, ContainerGroupIPAddress ipAddress, ContainerInstanceOperatingSystemType osType, IList volumes, ContainerGroupInstanceView instanceView, ContainerGroupDiagnostics diagnostics, IList subnetIds, ContainerGroupDnsConfiguration dnsConfig, ContainerGroupSku? sku, ContainerGroupEncryptionProperties encryptionProperties, IList initContainers, IList extensions, ConfidentialComputeProperties confidentialComputeProperties, ContainerGroupPriority? priority) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ManagedServiceIdentity identity, string provisioningState, IList containers, IList imageRegistryCredentials, ContainerGroupRestartPolicy? restartPolicy, ContainerGroupIPAddress ipAddress, ContainerInstanceOperatingSystemType osType, IList volumes, ContainerGroupInstanceView instanceView, ContainerGroupDiagnostics diagnostics, IList subnetIds, ContainerGroupDnsConfiguration dnsConfig, ContainerGroupSku? sku, ContainerGroupEncryptionProperties encryptionProperties, IList initContainers, IList extensions, ConfidentialComputeProperties confidentialComputeProperties, ContainerGroupPriority? priority, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; Identity = identity; @@ -92,6 +96,12 @@ internal ContainerGroupData(ResourceIdentifier id, string name, ResourceType res Extensions = extensions; ConfidentialComputeProperties = confidentialComputeProperties; Priority = priority; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupData() + { } /// The zones for the container group. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs index 62d140d64286..21b4974c917b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs @@ -508,7 +508,7 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell public virtual AsyncPageable GetOutboundNetworkDependenciesEndpointsAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerGroupRestClient.CreateGetOutboundNetworkDependenciesEndpointsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupResource.GetOutboundNetworkDependenciesEndpoints", "", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => e.GetString(), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupResource.GetOutboundNetworkDependenciesEndpoints", "", null, cancellationToken); } /// @@ -529,7 +529,7 @@ public virtual AsyncPageable GetOutboundNetworkDependenciesEndpointsAsyn public virtual Pageable GetOutboundNetworkDependenciesEndpoints(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerGroupRestClient.CreateGetOutboundNetworkDependenciesEndpointsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupResource.GetOutboundNetworkDependenciesEndpoints", "", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => e.GetString(), _containerGroupClientDiagnostics, Pipeline, "ContainerGroupResource.GetOutboundNetworkDependenciesEndpoints", "", null, cancellationToken); } /// diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 7f606abe1019..ec691af96d22 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -65,7 +65,7 @@ public virtual AsyncPageable GetContainerGroupsAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerGroupRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerGroups", "value", "nextLink", cancellationToken); } /// @@ -87,7 +87,7 @@ public virtual Pageable GetContainerGroups(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerGroupRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerGroups", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerGroups", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.Serialization.cs index 19396ba7ba5e..c76a3153454b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class CachedImages + public partial class CachedImages : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CachedImages DeserializeCachedImages(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType); + writer.WritePropertyName("image"u8); + writer.WriteStringValue(Image); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CachedImages DeserializeCachedImages(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string osType = default; string image = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType"u8)) @@ -32,8 +65,61 @@ internal static CachedImages DeserializeCachedImages(JsonElement element) image = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CachedImages(osType, image); + return new CachedImages(osType, image, serializedAdditionalRawData); + } + + CachedImages IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCachedImages(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CachedImages IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCachedImages(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CachedImages model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CachedImages(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCachedImages(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.cs index f134014271d4..88488f99c7ae 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImages.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The cached image and OS type. public partial class CachedImages { - /// Initializes a new instance of CachedImages. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The OS type of the cached image. /// The cached image name. /// or is null. @@ -26,6 +30,22 @@ internal CachedImages(string osType, string image) Image = image; } + /// Initializes a new instance of . + /// The OS type of the cached image. + /// The cached image name. + /// Keeps track of any properties unknown to the library. + internal CachedImages(string osType, string image, Dictionary serializedAdditionalRawData) + { + OSType = osType; + Image = image; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CachedImages() + { + } + /// The OS type of the cached image. public string OSType { get; } /// The cached image name. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.Serialization.cs index 93896493f3eb..6db7cc744f78 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class CachedImagesListResult + internal partial class CachedImagesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CachedImagesListResult DeserializeCachedImagesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CachedImagesListResult DeserializeCachedImagesListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static CachedImagesListResult DeserializeCachedImagesListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CachedImagesListResult(Optional.ToList(value), nextLink.Value); + return new CachedImagesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CachedImagesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCachedImagesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CachedImagesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCachedImagesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CachedImagesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CachedImagesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCachedImagesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.cs index bdca55ecb53a..cc000f819880 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/CachedImagesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The response containing cached images. internal partial class CachedImagesListResult { - /// Initializes a new instance of CachedImagesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CachedImagesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CachedImagesListResult. + /// Initializes a new instance of . /// The list of cached images. /// The URI to fetch the next page of cached images. - internal CachedImagesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CachedImagesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of cached images. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.Serialization.cs index d4751997d0d9..012030aaaba8 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class ConfidentialComputeProperties : IUtf8JsonSerializable + internal partial class ConfidentialComputeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CcePolicy)) { writer.WritePropertyName("ccePolicy"u8); writer.WriteStringValue(CcePolicy); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConfidentialComputeProperties DeserializeConfidentialComputeProperties(JsonElement element) + internal static ConfidentialComputeProperties DeserializeConfidentialComputeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ccePolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ccePolicy"u8)) @@ -37,8 +60,61 @@ internal static ConfidentialComputeProperties DeserializeConfidentialComputeProp ccePolicy = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConfidentialComputeProperties(ccePolicy.Value, serializedAdditionalRawData); + } + + ConfidentialComputeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConfidentialComputeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConfidentialComputeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConfidentialComputeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConfidentialComputeProperties model) + { + if (model is null) + { + return null; } - return new ConfidentialComputeProperties(ccePolicy.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConfidentialComputeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConfidentialComputeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.cs index cd4f97d4685d..e2678430157a 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ConfidentialComputeProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The properties for confidential container group. internal partial class ConfidentialComputeProperties { - /// Initializes a new instance of ConfidentialComputeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConfidentialComputeProperties() { } - /// Initializes a new instance of ConfidentialComputeProperties. + /// Initializes a new instance of . /// The base64 encoded confidential compute enforcement policy. - internal ConfidentialComputeProperties(string ccePolicy) + /// Keeps track of any properties unknown to the library. + internal ConfidentialComputeProperties(string ccePolicy, Dictionary serializedAdditionalRawData) { CcePolicy = ccePolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The base64 encoded confidential compute enforcement policy. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.Serialization.cs index fe3a2aa0552a..b44de7867081 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerAttachResult + public partial class ContainerAttachResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerAttachResult DeserializeContainerAttachResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(WebSocketUri)) + { + writer.WritePropertyName("webSocketUri"u8); + writer.WriteStringValue(WebSocketUri.AbsoluteUri); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"u8); + writer.WriteStringValue(Password); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerAttachResult DeserializeContainerAttachResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional webSocketUri = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("webSocketUri"u8)) @@ -37,8 +75,61 @@ internal static ContainerAttachResult DeserializeContainerAttachResult(JsonEleme password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerAttachResult(webSocketUri.Value, password.Value); + return new ContainerAttachResult(webSocketUri.Value, password.Value, serializedAdditionalRawData); + } + + ContainerAttachResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAttachResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerAttachResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerAttachResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerAttachResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerAttachResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerAttachResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.cs index 9387f4a0d9f2..d7131048fc18 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerAttachResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerInstance.Models { /// The information for the output stream from container attach. public partial class ContainerAttachResult { - /// Initializes a new instance of ContainerAttachResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerAttachResult() { } - /// Initializes a new instance of ContainerAttachResult. + /// Initializes a new instance of . /// The uri for the output stream from the attach. /// The password to the output stream from the attach. Send as an Authorization header value when connecting to the websocketUri. - internal ContainerAttachResult(Uri webSocketUri, string password) + /// Keeps track of any properties unknown to the library. + internal ContainerAttachResult(Uri webSocketUri, string password, Dictionary serializedAdditionalRawData) { WebSocketUri = webSocketUri; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The uri for the output stream from the attach. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.Serialization.cs index 77eb89d0874f..d07577fde5a4 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerCapabilities + public partial class ContainerCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerCapabilities DeserializeContainerCapabilities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerCapabilities DeserializeContainerCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +52,7 @@ internal static ContainerCapabilities DeserializeContainerCapabilities(JsonEleme Optional ipAddressType = default; Optional gpu = default; Optional capabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -64,8 +93,61 @@ internal static ContainerCapabilities DeserializeContainerCapabilities(JsonEleme capabilities = ContainerSupportedCapabilities.DeserializeContainerSupportedCapabilities(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerCapabilities(resourceType.Value, osType.Value, Optional.ToNullable(location), ipAddressType.Value, gpu.Value, capabilities.Value); + return new ContainerCapabilities(resourceType.Value, osType.Value, Optional.ToNullable(location), ipAddressType.Value, gpu.Value, capabilities.Value, serializedAdditionalRawData); + } + + ContainerCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerCapabilities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.cs index 3f95b8cf6182..f338e7e6a74c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilities.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -12,19 +14,23 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The regional capabilities. public partial class ContainerCapabilities { - /// Initializes a new instance of ContainerCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerCapabilities() { } - /// Initializes a new instance of ContainerCapabilities. + /// Initializes a new instance of . /// The resource type that this capability describes. /// The OS type that this capability describes. /// The resource location. /// The ip address type that this capability describes. /// The GPU sku that this capability describes. /// The supported capabilities. - internal ContainerCapabilities(string resourceType, string osType, AzureLocation? location, string ipAddressType, string gpu, ContainerSupportedCapabilities capabilities) + /// Keeps track of any properties unknown to the library. + internal ContainerCapabilities(string resourceType, string osType, AzureLocation? location, string ipAddressType, string gpu, ContainerSupportedCapabilities capabilities, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; OSType = osType; @@ -32,6 +38,7 @@ internal ContainerCapabilities(string resourceType, string osType, AzureLocation IPAddressType = ipAddressType; Gpu = gpu; Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource type that this capability describes. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.Serialization.cs index 1b027994704d..8b0836d9d68e 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class ContainerCapabilitiesListResult + internal partial class ContainerCapabilitiesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerCapabilitiesListResult DeserializeContainerCapabilitiesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerCapabilitiesListResult DeserializeContainerCapabilitiesListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static ContainerCapabilitiesListResult DeserializeContainerCapabilities nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerCapabilitiesListResult(Optional.ToList(value), nextLink.Value); + return new ContainerCapabilitiesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerCapabilitiesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerCapabilitiesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerCapabilitiesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerCapabilitiesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerCapabilitiesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerCapabilitiesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerCapabilitiesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.cs index b09c0cbdd372..91872a355d66 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerCapabilitiesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The response containing list of capabilities. internal partial class ContainerCapabilitiesListResult { - /// Initializes a new instance of ContainerCapabilitiesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerCapabilitiesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerCapabilitiesListResult. + /// Initializes a new instance of . /// The list of capabilities. /// The URI to fetch the next page of capabilities. - internal ContainerCapabilitiesListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerCapabilitiesListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of capabilities. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.Serialization.cs index 0c0b3973819e..5feec4268db2 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerEnvironmentVariable : IUtf8JsonSerializable + public partial class ContainerEnvironmentVariable : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secureValue"u8); writer.WriteStringValue(SecureValue); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerEnvironmentVariable DeserializeContainerEnvironmentVariable(JsonElement element) + internal static ContainerEnvironmentVariable DeserializeContainerEnvironmentVariable(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ContainerEnvironmentVariable DeserializeContainerEnvironmentVari string name = default; Optional value = default; Optional secureValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -56,8 +79,61 @@ internal static ContainerEnvironmentVariable DeserializeContainerEnvironmentVari secureValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerEnvironmentVariable(name, value.Value, secureValue.Value, serializedAdditionalRawData); + } + + ContainerEnvironmentVariable IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerEnvironmentVariable(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerEnvironmentVariable IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerEnvironmentVariable(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerEnvironmentVariable model) + { + if (model is null) + { + return null; } - return new ContainerEnvironmentVariable(name, value.Value, secureValue.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerEnvironmentVariable(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerEnvironmentVariable(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.cs index 2ff154bc3beb..4f955505410b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEnvironmentVariable.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The environment variable to set within the container instance. public partial class ContainerEnvironmentVariable { - /// Initializes a new instance of ContainerEnvironmentVariable. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the environment variable. /// is null. public ContainerEnvironmentVariable(string name) @@ -23,15 +27,22 @@ public ContainerEnvironmentVariable(string name) Name = name; } - /// Initializes a new instance of ContainerEnvironmentVariable. + /// Initializes a new instance of . /// The name of the environment variable. /// The value of the environment variable. /// The value of the secure environment variable. - internal ContainerEnvironmentVariable(string name, string value, string secureValue) + /// Keeps track of any properties unknown to the library. + internal ContainerEnvironmentVariable(string name, string value, string secureValue, Dictionary serializedAdditionalRawData) { Name = name; Value = value; SecureValue = secureValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerEnvironmentVariable() + { } /// The name of the environment variable. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.Serialization.cs index 6917fb590bdf..33ea2b11de68 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerEvent + public partial class ContainerEvent : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerEvent DeserializeContainerEvent(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerEvent DeserializeContainerEvent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static ContainerEvent DeserializeContainerEvent(JsonElement element) Optional name = default; Optional message = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -69,8 +97,61 @@ internal static ContainerEvent DeserializeContainerEvent(JsonElement element) type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerEvent(Optional.ToNullable(count), Optional.ToNullable(firstTimestamp), Optional.ToNullable(lastTimestamp), name.Value, message.Value, type.Value); + return new ContainerEvent(Optional.ToNullable(count), Optional.ToNullable(firstTimestamp), Optional.ToNullable(lastTimestamp), name.Value, message.Value, type.Value, serializedAdditionalRawData); + } + + ContainerEvent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerEvent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerEvent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerEvent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerEvent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerEvent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerEvent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.cs index c5500c872592..0d8c6c6a0bce 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerEvent.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerInstance.Models { /// A container group or container instance event. public partial class ContainerEvent { - /// Initializes a new instance of ContainerEvent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerEvent() { } - /// Initializes a new instance of ContainerEvent. + /// Initializes a new instance of . /// The count of the event. /// The date-time of the earliest logged event. /// The date-time of the latest logged event. /// The event name. /// The event message. /// The event type. - internal ContainerEvent(int? count, DateTimeOffset? firstTimestamp, DateTimeOffset? lastTimestamp, string name, string message, string eventType) + /// Keeps track of any properties unknown to the library. + internal ContainerEvent(int? count, DateTimeOffset? firstTimestamp, DateTimeOffset? lastTimestamp, string name, string message, string eventType, Dictionary serializedAdditionalRawData) { Count = count; FirstTimestamp = firstTimestamp; @@ -32,6 +37,7 @@ internal ContainerEvent(int? count, DateTimeOffset? firstTimestamp, DateTimeOffs Name = name; Message = message; EventType = eventType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The count of the event. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.Serialization.cs index 55db5f4c6111..893e11675959 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class ContainerExec : IUtf8JsonSerializable + internal partial class ContainerExec : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Command)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerExec DeserializeContainerExec(JsonElement element) + internal static ContainerExec DeserializeContainerExec(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> command = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("command"u8)) @@ -52,8 +74,61 @@ internal static ContainerExec DeserializeContainerExec(JsonElement element) command = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerExec(Optional.ToList(command), serializedAdditionalRawData); + } + + ContainerExec IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerExec(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerExec IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerExec(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerExec model) + { + if (model is null) + { + return null; } - return new ContainerExec(Optional.ToList(command)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerExec(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerExec(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.cs index 0a2745d57191..602af7173c83 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExec.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The container execution command, for liveness or readiness probe. internal partial class ContainerExec { - /// Initializes a new instance of ContainerExec. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerExec() { Command = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerExec. + /// Initializes a new instance of . /// The commands to execute within the container. - internal ContainerExec(IList command) + /// Keeps track of any properties unknown to the library. + internal ContainerExec(IList command, Dictionary serializedAdditionalRawData) { Command = command; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The commands to execute within the container. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.Serialization.cs index 5d5f0dc5b43f..09a58cd3d08e 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerExecContent : IUtf8JsonSerializable + public partial class ContainerExecContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Command)) { @@ -23,9 +31,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TerminalSize)) { writer.WritePropertyName("terminalSize"u8); - writer.WriteObjectValue(TerminalSize); + if (TerminalSize is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TerminalSize).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ContainerExecContent DeserializeContainerExecContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional command = default; + Optional terminalSize = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("command"u8)) + { + command = property.Value.GetString(); + continue; + } + if (property.NameEquals("terminalSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + terminalSize = ContainerExecRequestTerminalSize.DeserializeContainerExecRequestTerminalSize(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerExecContent(command.Value, terminalSize.Value, serializedAdditionalRawData); + } + + ContainerExecContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerExecContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerExecContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerExecContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerExecContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerExecContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerExecContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.cs index 6e145e49e796..29f9b4bf862b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The container exec request. public partial class ContainerExecContent { - /// Initializes a new instance of ContainerExecContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerExecContent() { } + /// Initializes a new instance of . + /// The command to be executed. + /// The size of the terminal. + /// Keeps track of any properties unknown to the library. + internal ContainerExecContent(string command, ContainerExecRequestTerminalSize terminalSize, Dictionary serializedAdditionalRawData) + { + Command = command; + TerminalSize = terminalSize; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The command to be executed. public string Command { get; set; } /// The size of the terminal. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.Serialization.cs index cd447b7f7be8..804757a96383 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerExecRequestTerminalSize : IUtf8JsonSerializable + public partial class ContainerExecRequestTerminalSize : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Rows)) { @@ -25,7 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cols"u8); writer.WriteNumberValue(Cols.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerExecRequestTerminalSize DeserializeContainerExecRequestTerminalSize(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional rows = default; + Optional cols = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rows"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rows = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("cols"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cols = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerExecRequestTerminalSize(Optional.ToNullable(rows), Optional.ToNullable(cols), serializedAdditionalRawData); + } + + ContainerExecRequestTerminalSize IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerExecRequestTerminalSize(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerExecRequestTerminalSize IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerExecRequestTerminalSize(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerExecRequestTerminalSize model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerExecRequestTerminalSize(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerExecRequestTerminalSize(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.cs index b5cdac3efb34..392c48272c4a 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecRequestTerminalSize.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The size of the terminal. public partial class ContainerExecRequestTerminalSize { - /// Initializes a new instance of ContainerExecRequestTerminalSize. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerExecRequestTerminalSize() { } + /// Initializes a new instance of . + /// The row size of the terminal. + /// The column size of the terminal. + /// Keeps track of any properties unknown to the library. + internal ContainerExecRequestTerminalSize(int? rows, int? cols, Dictionary serializedAdditionalRawData) + { + Rows = rows; + Cols = cols; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The row size of the terminal. public int? Rows { get; set; } /// The column size of the terminal. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.Serialization.cs index dd63e1d6abdd..ff85d039229b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerExecResult + public partial class ContainerExecResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerExecResult DeserializeContainerExecResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(WebSocketUri)) + { + writer.WritePropertyName("webSocketUri"u8); + writer.WriteStringValue(WebSocketUri.AbsoluteUri); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"u8); + writer.WriteStringValue(Password); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerExecResult DeserializeContainerExecResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional webSocketUri = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("webSocketUri"u8)) @@ -37,8 +75,61 @@ internal static ContainerExecResult DeserializeContainerExecResult(JsonElement e password = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerExecResult(webSocketUri.Value, password.Value); + return new ContainerExecResult(webSocketUri.Value, password.Value, serializedAdditionalRawData); + } + + ContainerExecResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerExecResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerExecResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerExecResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerExecResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerExecResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerExecResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.cs index bf943281f74e..89fae58601b9 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerExecResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerInstance.Models { /// The information for the container exec command. public partial class ContainerExecResult { - /// Initializes a new instance of ContainerExecResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerExecResult() { } - /// Initializes a new instance of ContainerExecResult. + /// Initializes a new instance of . /// The uri for the exec websocket. /// The password to start the exec command. - internal ContainerExecResult(Uri webSocketUri, string password) + /// Keeps track of any properties unknown to the library. + internal ContainerExecResult(Uri webSocketUri, string password, Dictionary serializedAdditionalRawData) { WebSocketUri = webSocketUri; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The uri for the exec websocket. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.Serialization.cs index 2d3beb0a60ba..94fcb3209f6d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGpuResourceInfo : IUtf8JsonSerializable + public partial class ContainerGpuResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("count"u8); writer.WriteNumberValue(Count); writer.WritePropertyName("sku"u8); writer.WriteStringValue(Sku.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGpuResourceInfo DeserializeContainerGpuResourceInfo(JsonElement element) + internal static ContainerGpuResourceInfo DeserializeContainerGpuResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int count = default; ContainerGpuSku sku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -42,8 +65,61 @@ internal static ContainerGpuResourceInfo DeserializeContainerGpuResourceInfo(Jso sku = new ContainerGpuSku(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGpuResourceInfo(count, sku, serializedAdditionalRawData); + } + + ContainerGpuResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGpuResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGpuResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGpuResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGpuResourceInfo model) + { + if (model is null) + { + return null; } - return new ContainerGpuResourceInfo(count, sku); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGpuResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGpuResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.cs index 6c111bd2e378..09020c3e8840 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGpuResourceInfo.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The GPU resource. public partial class ContainerGpuResourceInfo { - /// Initializes a new instance of ContainerGpuResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The count of the GPU resource. /// The SKU of the GPU resource. public ContainerGpuResourceInfo(int count, ContainerGpuSku sku) @@ -19,6 +25,22 @@ public ContainerGpuResourceInfo(int count, ContainerGpuSku sku) Sku = sku; } + /// Initializes a new instance of . + /// The count of the GPU resource. + /// The SKU of the GPU resource. + /// Keeps track of any properties unknown to the library. + internal ContainerGpuResourceInfo(int count, ContainerGpuSku sku, Dictionary serializedAdditionalRawData) + { + Count = count; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGpuResourceInfo() + { + } + /// The count of the GPU resource. public int Count { get; set; } /// The SKU of the GPU resource. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs index 8e0ff37586a6..c153a6e3b4cb 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerInstance.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerInstance { - public partial class ContainerGroupData : IUtf8JsonSerializable + public partial class ContainerGroupData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -52,7 +59,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Containers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); if (Optional.IsCollectionDefined(ImageRegistryCredentials)) @@ -61,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ImageRegistryCredentials) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -73,7 +94,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IPAddress)) { writer.WritePropertyName("ipAddress"u8); - writer.WriteObjectValue(IPAddress); + if (IPAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IPAddress).Serialize(writer, options); + } } writer.WritePropertyName("osType"u8); writer.WriteStringValue(OSType.ToString()); @@ -83,14 +111,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Volumes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Diagnostics)) { writer.WritePropertyName("diagnostics"u8); - writer.WriteObjectValue(Diagnostics); + if (Diagnostics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Diagnostics).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(SubnetIds)) { @@ -98,14 +140,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SubnetIds) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(DnsConfig)) { writer.WritePropertyName("dnsConfig"u8); - writer.WriteObjectValue(DnsConfig); + if (DnsConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DnsConfig).Serialize(writer, options); + } } if (Optional.IsDefined(Sku)) { @@ -115,7 +171,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EncryptionProperties)) { writer.WritePropertyName("encryptionProperties"u8); - writer.WriteObjectValue(EncryptionProperties); + if (EncryptionProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionProperties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(InitContainers)) { @@ -123,7 +186,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in InitContainers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -133,14 +203,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Extensions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(ConfidentialComputeProperties)) { writer.WritePropertyName("confidentialComputeProperties"u8); - writer.WriteObjectValue(ConfidentialComputeProperties); + if (ConfidentialComputeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConfidentialComputeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Priority)) { @@ -148,11 +232,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Priority.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupData DeserializeContainerGroupData(JsonElement element) + internal static ContainerGroupData DeserializeContainerGroupData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -182,6 +280,7 @@ internal static ContainerGroupData DeserializeContainerGroupData(JsonElement ele Optional> extensions = default; Optional confidentialComputeProperties = default; Optional priority = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -433,8 +532,61 @@ internal static ContainerGroupData DeserializeContainerGroupData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), identity, provisioningState.Value, containers, Optional.ToList(imageRegistryCredentials), Optional.ToNullable(restartPolicy), ipAddress.Value, osType, Optional.ToList(volumes), instanceView.Value, diagnostics.Value, Optional.ToList(subnetIds), dnsConfig.Value, Optional.ToNullable(sku), encryptionProperties.Value, Optional.ToList(initContainers), Optional.ToList(extensions), confidentialComputeProperties.Value, Optional.ToNullable(priority), serializedAdditionalRawData); + } + + ContainerGroupData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupData(Response response) + { + if (response is null) + { + return null; } - return new ContainerGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), identity, provisioningState.Value, containers, Optional.ToList(imageRegistryCredentials), Optional.ToNullable(restartPolicy), ipAddress.Value, osType, Optional.ToList(volumes), instanceView.Value, diagnostics.Value, Optional.ToList(subnetIds), dnsConfig.Value, Optional.ToNullable(sku), encryptionProperties.Value, Optional.ToList(initContainers), Optional.ToList(extensions), confidentialComputeProperties.Value, Optional.ToNullable(priority)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.Serialization.cs index 32f15db85444..f136f7f1887b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class ContainerGroupDiagnostics : IUtf8JsonSerializable + internal partial class ContainerGroupDiagnostics : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LogAnalytics)) { writer.WritePropertyName("logAnalytics"u8); - writer.WriteObjectValue(LogAnalytics); + if (LogAnalytics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogAnalytics).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerGroupDiagnostics DeserializeContainerGroupDiagnostics(JsonElement element) + internal static ContainerGroupDiagnostics DeserializeContainerGroupDiagnostics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional logAnalytics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logAnalytics"u8)) @@ -41,8 +71,61 @@ internal static ContainerGroupDiagnostics DeserializeContainerGroupDiagnostics(J logAnalytics = ContainerGroupLogAnalytics.DeserializeContainerGroupLogAnalytics(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupDiagnostics(logAnalytics.Value, serializedAdditionalRawData); + } + + ContainerGroupDiagnostics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupDiagnostics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupDiagnostics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupDiagnostics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupDiagnostics model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupDiagnostics(Response response) + { + if (response is null) + { + return null; } - return new ContainerGroupDiagnostics(logAnalytics.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupDiagnostics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.cs index 042c4baa0766..2072bf2e4e0d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDiagnostics.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// Container group diagnostic information. internal partial class ContainerGroupDiagnostics { - /// Initializes a new instance of ContainerGroupDiagnostics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerGroupDiagnostics() { } - /// Initializes a new instance of ContainerGroupDiagnostics. + /// Initializes a new instance of . /// Container group log analytics information. - internal ContainerGroupDiagnostics(ContainerGroupLogAnalytics logAnalytics) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupDiagnostics(ContainerGroupLogAnalytics logAnalytics, Dictionary serializedAdditionalRawData) { LogAnalytics = logAnalytics; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container group log analytics information. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.Serialization.cs index 626ea02ad1f2..609a9a4ec64e 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupDnsConfiguration : IUtf8JsonSerializable + public partial class ContainerGroupDnsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("nameServers"u8); writer.WriteStartArray(); @@ -33,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("options"u8); writer.WriteStringValue(Options); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupDnsConfiguration DeserializeContainerGroupDnsConfiguration(JsonElement element) + internal static ContainerGroupDnsConfiguration DeserializeContainerGroupDnsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +66,7 @@ internal static ContainerGroupDnsConfiguration DeserializeContainerGroupDnsConfi IList nameServers = default; Optional searchDomains = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameServers"u8)) @@ -67,8 +89,61 @@ internal static ContainerGroupDnsConfiguration DeserializeContainerGroupDnsConfi options = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupDnsConfiguration(nameServers, searchDomains.Value, options.Value, serializedAdditionalRawData); + } + + ContainerGroupDnsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupDnsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupDnsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupDnsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupDnsConfiguration model) + { + if (model is null) + { + return null; } - return new ContainerGroupDnsConfiguration(nameServers, searchDomains.Value, options.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupDnsConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupDnsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.cs index 5f7984b527fa..c90362389627 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupDnsConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// DNS configuration for the container group. public partial class ContainerGroupDnsConfiguration { - /// Initializes a new instance of ContainerGroupDnsConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The DNS servers for the container group. /// is null. public ContainerGroupDnsConfiguration(IEnumerable nameServers) @@ -25,15 +28,22 @@ public ContainerGroupDnsConfiguration(IEnumerable nameServers) NameServers = nameServers.ToList(); } - /// Initializes a new instance of ContainerGroupDnsConfiguration. + /// Initializes a new instance of . /// The DNS servers for the container group. /// The DNS search domains for hostname lookup in the container group. /// The DNS options for the container group. - internal ContainerGroupDnsConfiguration(IList nameServers, string searchDomains, string options) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupDnsConfiguration(IList nameServers, string searchDomains, string options, Dictionary serializedAdditionalRawData) { NameServers = nameServers; SearchDomains = searchDomains; Options = options; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupDnsConfiguration() + { } /// The DNS servers for the container group. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.Serialization.cs index dc07a8efc597..cb57ef2fd2db 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupEncryptionProperties : IUtf8JsonSerializable + public partial class ContainerGroupEncryptionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vaultBaseUrl"u8); writer.WriteStringValue(VaultBaseUri.AbsoluteUri); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"u8); writer.WriteStringValue(Identity); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupEncryptionProperties DeserializeContainerGroupEncryptionProperties(JsonElement element) + internal static ContainerGroupEncryptionProperties DeserializeContainerGroupEncryptionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static ContainerGroupEncryptionProperties DeserializeContainerGroupEncr string keyName = default; string keyVersion = default; Optional identity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vaultBaseUrl"u8)) @@ -62,8 +84,61 @@ internal static ContainerGroupEncryptionProperties DeserializeContainerGroupEncr identity = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupEncryptionProperties(vaultBaseUrl, keyName, keyVersion, identity.Value, serializedAdditionalRawData); + } + + ContainerGroupEncryptionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupEncryptionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupEncryptionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupEncryptionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupEncryptionProperties model) + { + if (model is null) + { + return null; } - return new ContainerGroupEncryptionProperties(vaultBaseUrl, keyName, keyVersion, identity.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupEncryptionProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupEncryptionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.cs index a3750abc92ef..b37f67532a4c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupEncryptionProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The container group encryption properties. public partial class ContainerGroupEncryptionProperties { - /// Initializes a new instance of ContainerGroupEncryptionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The keyvault base url. /// The encryption key name. /// The encryption key version. @@ -29,17 +33,24 @@ public ContainerGroupEncryptionProperties(Uri vaultBaseUri, string keyName, stri KeyVersion = keyVersion; } - /// Initializes a new instance of ContainerGroupEncryptionProperties. + /// Initializes a new instance of . /// The keyvault base url. /// The encryption key name. /// The encryption key version. /// The keyvault managed identity. - internal ContainerGroupEncryptionProperties(Uri vaultBaseUri, string keyName, string keyVersion, string identity) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupEncryptionProperties(Uri vaultBaseUri, string keyName, string keyVersion, string identity, Dictionary serializedAdditionalRawData) { VaultBaseUri = vaultBaseUri; KeyName = keyName; KeyVersion = keyVersion; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupEncryptionProperties() + { } /// The keyvault base url. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs index ac28eb70b06a..ca3ce31e6954 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupIPAddress : IUtf8JsonSerializable + public partial class ContainerGroupIPAddress : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("ports"u8); writer.WriteStartArray(); foreach (var item in Ports) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("type"u8); @@ -41,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("autoGeneratedDomainNameLabelScope"u8); writer.WriteStringValue(AutoGeneratedDomainNameLabelScope.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonElement element) + internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +84,7 @@ internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonE Optional dnsNameLabel = default; Optional autoGeneratedDomainNameLabelScope = default; Optional fqdn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ports"u8)) @@ -101,8 +130,61 @@ internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonE fqdn = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupIPAddress(ports, type, ip.Value, dnsNameLabel.Value, Optional.ToNullable(autoGeneratedDomainNameLabelScope), fqdn.Value, serializedAdditionalRawData); + } + + ContainerGroupIPAddress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupIPAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupIPAddress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupIPAddress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupIPAddress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupIPAddress(Response response) + { + if (response is null) + { + return null; } - return new ContainerGroupIPAddress(ports, type, ip.Value, dnsNameLabel.Value, Optional.ToNullable(autoGeneratedDomainNameLabelScope), fqdn.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupIPAddress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs index 6ec9c02cb6b6..6fe5e81abd01 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// IP address for the container group. public partial class ContainerGroupIPAddress { - /// Initializes a new instance of ContainerGroupIPAddress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of ports exposed on the container group. /// Specifies if the IP is exposed to the public internet or private VNET. /// is null. @@ -28,14 +31,15 @@ public ContainerGroupIPAddress(IEnumerable ports, ContainerG AddressType = addressType; } - /// Initializes a new instance of ContainerGroupIPAddress. + /// Initializes a new instance of . /// The list of ports exposed on the container group. /// Specifies if the IP is exposed to the public internet or private VNET. /// The IP exposed to the public internet. /// The Dns name label for the IP. /// The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover. The 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the same tenant. The 'SubscriptionReuse' value means the object's domain name label can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be reused within the same resource group. The 'NoReuse' value means the object's domain name label cannot be reused within the same resource group, subscription, or tenant. /// The FQDN for the IP. - internal ContainerGroupIPAddress(IList ports, ContainerGroupIPAddressType addressType, IPAddress ip, string dnsNameLabel, DnsNameLabelReusePolicy? autoGeneratedDomainNameLabelScope, string fqdn) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupIPAddress(IList ports, ContainerGroupIPAddressType addressType, IPAddress ip, string dnsNameLabel, DnsNameLabelReusePolicy? autoGeneratedDomainNameLabelScope, string fqdn, Dictionary serializedAdditionalRawData) { Ports = ports; AddressType = addressType; @@ -43,6 +47,12 @@ internal ContainerGroupIPAddress(IList ports, ContainerGroup DnsNameLabel = dnsNameLabel; AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; Fqdn = fqdn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupIPAddress() + { } /// The list of ports exposed on the container group. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs index 633c40931ad2..f095f4adf86b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupImageRegistryCredential : IUtf8JsonSerializable + public partial class ContainerGroupImageRegistryCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("server"u8); writer.WriteStringValue(Server); @@ -38,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identityUrl"u8); writer.WriteStringValue(IdentityUri.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupImageRegistryCredential DeserializeContainerGroupImageRegistryCredential(JsonElement element) + internal static ContainerGroupImageRegistryCredential DeserializeContainerGroupImageRegistryCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +73,7 @@ internal static ContainerGroupImageRegistryCredential DeserializeContainerGroupI Optional password = default; Optional identity = default; Optional identityUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("server"u8)) @@ -83,8 +105,61 @@ internal static ContainerGroupImageRegistryCredential DeserializeContainerGroupI identityUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupImageRegistryCredential(server, username.Value, password.Value, identity.Value, identityUrl.Value, serializedAdditionalRawData); + } + + ContainerGroupImageRegistryCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupImageRegistryCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupImageRegistryCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupImageRegistryCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupImageRegistryCredential model) + { + if (model is null) + { + return null; } - return new ContainerGroupImageRegistryCredential(server, username.Value, password.Value, identity.Value, identityUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupImageRegistryCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupImageRegistryCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs index 4de48bca60f4..9652113cc1c3 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// Image registry credential. public partial class ContainerGroupImageRegistryCredential { - /// Initializes a new instance of ContainerGroupImageRegistryCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Docker image registry server without a protocol such as "http" and "https". /// is null. public ContainerGroupImageRegistryCredential(string server) @@ -23,19 +27,26 @@ public ContainerGroupImageRegistryCredential(string server) Server = server; } - /// Initializes a new instance of ContainerGroupImageRegistryCredential. + /// Initializes a new instance of . /// The Docker image registry server without a protocol such as "http" and "https". /// The username for the private registry. /// The password for the private registry. /// The identity for the private registry. /// The identity URL for the private registry. - internal ContainerGroupImageRegistryCredential(string server, string username, string password, string identity, Uri identityUri) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupImageRegistryCredential(string server, string username, string password, string identity, Uri identityUri, Dictionary serializedAdditionalRawData) { Server = server; Username = username; Password = password; Identity = identity; IdentityUri = identityUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupImageRegistryCredential() + { } /// The Docker image registry server without a protocol such as "http" and "https". diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.Serialization.cs index 0d4ec4bfc13c..5eeec56c9657 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupInstanceView + public partial class ContainerGroupInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerGroupInstanceView DeserializeContainerGroupInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerGroupInstanceView DeserializeContainerGroupInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> events = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("events"u8)) @@ -42,8 +70,61 @@ internal static ContainerGroupInstanceView DeserializeContainerGroupInstanceView state = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerGroupInstanceView(Optional.ToList(events), state.Value); + return new ContainerGroupInstanceView(Optional.ToList(events), state.Value, serializedAdditionalRawData); + } + + ContainerGroupInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.cs index c2dc4abe3fc1..14356e5a9f03 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The instance view of the container group. Only valid in response. public partial class ContainerGroupInstanceView { - /// Initializes a new instance of ContainerGroupInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerGroupInstanceView() { Events = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerGroupInstanceView. + /// Initializes a new instance of . /// The events of this container group. /// The state of the container group. Only valid in response. - internal ContainerGroupInstanceView(IReadOnlyList events, string state) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupInstanceView(IReadOnlyList events, string state, Dictionary serializedAdditionalRawData) { Events = events; State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The events of this container group. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.Serialization.cs index 95d53815e670..f97bfca0d17c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerInstance; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class ContainerGroupListResult + internal partial class ContainerGroupListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerGroupListResult DeserializeContainerGroupListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerGroupListResult DeserializeContainerGroupListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerGroupListResult DeserializeContainerGroupListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerGroupListResult(Optional.ToList(value), nextLink.Value); + return new ContainerGroupListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerGroupListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.cs index 7753a5f32c93..c190dc78084e 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerInstance; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The container group list response that contains the container group properties. internal partial class ContainerGroupListResult { - /// Initializes a new instance of ContainerGroupListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerGroupListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerGroupListResult. + /// Initializes a new instance of . /// The list of container groups. /// The URI to fetch the next page of container groups. - internal ContainerGroupListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of container groups. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.Serialization.cs index 712f54768922..9731a0735825 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupLogAnalytics : IUtf8JsonSerializable + public partial class ContainerGroupLogAnalytics : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("workspaceId"u8); writer.WriteStringValue(WorkspaceId); @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("workspaceResourceId"u8); writer.WriteStringValue(WorkspaceResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupLogAnalytics DeserializeContainerGroupLogAnalytics(JsonElement element) + internal static ContainerGroupLogAnalytics DeserializeContainerGroupLogAnalytics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static ContainerGroupLogAnalytics DeserializeContainerGroupLogAnalytics Optional logType = default; Optional> metadata = default; Optional workspaceResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("workspaceId"u8)) @@ -99,8 +121,61 @@ internal static ContainerGroupLogAnalytics DeserializeContainerGroupLogAnalytics workspaceResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupLogAnalytics(workspaceId, workspaceKey, Optional.ToNullable(logType), Optional.ToDictionary(metadata), workspaceResourceId.Value, serializedAdditionalRawData); + } + + ContainerGroupLogAnalytics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupLogAnalytics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupLogAnalytics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupLogAnalytics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupLogAnalytics model) + { + if (model is null) + { + return null; } - return new ContainerGroupLogAnalytics(workspaceId, workspaceKey, Optional.ToNullable(logType), Optional.ToDictionary(metadata), workspaceResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupLogAnalytics(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupLogAnalytics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.cs index 6db9a505c614..0af94b9f7a94 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupLogAnalytics.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// Container group log analytics information. public partial class ContainerGroupLogAnalytics { - /// Initializes a new instance of ContainerGroupLogAnalytics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The workspace id for log analytics. /// The workspace key for log analytics. /// or is null. @@ -28,19 +31,26 @@ public ContainerGroupLogAnalytics(string workspaceId, string workspaceKey) Metadata = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerGroupLogAnalytics. + /// Initializes a new instance of . /// The workspace id for log analytics. /// The workspace key for log analytics. /// The log type to be used. /// Metadata for log analytics. /// The workspace resource id for log analytics. - internal ContainerGroupLogAnalytics(string workspaceId, string workspaceKey, ContainerGroupLogAnalyticsLogType? logType, IDictionary metadata, ResourceIdentifier workspaceResourceId) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupLogAnalytics(string workspaceId, string workspaceKey, ContainerGroupLogAnalyticsLogType? logType, IDictionary metadata, ResourceIdentifier workspaceResourceId, Dictionary serializedAdditionalRawData) { WorkspaceId = workspaceId; WorkspaceKey = workspaceKey; LogType = logType; Metadata = metadata; WorkspaceResourceId = workspaceResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupLogAnalytics() + { } /// The workspace id for log analytics. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.Serialization.cs index 951d62d16654..350442721aef 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupPatch : IUtf8JsonSerializable + public partial class ContainerGroupPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Zones)) { @@ -40,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupPatch DeserializeContainerGroupPatch(JsonElement element) + internal static ContainerGroupPatch DeserializeContainerGroupPatch(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +77,7 @@ internal static ContainerGroupPatch DeserializeContainerGroupPatch(JsonElement e string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("zones"u8)) @@ -115,8 +137,61 @@ internal static ContainerGroupPatch DeserializeContainerGroupPatch(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupPatch(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), serializedAdditionalRawData); + } + + ContainerGroupPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupPatch model) + { + if (model is null) + { + return null; } - return new ContainerGroupPatch(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.cs index 67ea30a6f5af..8324ebb531fb 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,14 +15,17 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The Resource model definition. public partial class ContainerGroupPatch : TrackedResourceData { - /// Initializes a new instance of ContainerGroupPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerGroupPatch(AzureLocation location) : base(location) { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerGroupPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,9 +33,16 @@ public ContainerGroupPatch(AzureLocation location) : base(location) /// The tags. /// The location. /// The zones for the container group. - internal ContainerGroupPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupPatch() + { } /// The zones for the container group. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.Serialization.cs index 9dffed8bce18..7d7ab62a9cb8 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupPort : IUtf8JsonSerializable + public partial class ContainerGroupPort : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Protocol)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("port"u8); writer.WriteNumberValue(Port); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupPort DeserializeContainerGroupPort(JsonElement element) + internal static ContainerGroupPort DeserializeContainerGroupPort(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional protocol = default; int port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("protocol"u8)) @@ -49,8 +72,61 @@ internal static ContainerGroupPort DeserializeContainerGroupPort(JsonElement ele port = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupPort(Optional.ToNullable(protocol), port, serializedAdditionalRawData); + } + + ContainerGroupPort IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupPort(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupPort IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupPort(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupPort model) + { + if (model is null) + { + return null; } - return new ContainerGroupPort(Optional.ToNullable(protocol), port); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupPort(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupPort(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.cs index 700562c0ca88..17a65950808f 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupPort.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The port exposed on the container group. public partial class ContainerGroupPort { - /// Initializes a new instance of ContainerGroupPort. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The port number. public ContainerGroupPort(int port) { Port = port; } - /// Initializes a new instance of ContainerGroupPort. + /// Initializes a new instance of . /// The protocol associated with the port. /// The port number. - internal ContainerGroupPort(ContainerGroupNetworkProtocol? protocol, int port) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupPort(ContainerGroupNetworkProtocol? protocol, int port, Dictionary serializedAdditionalRawData) { Protocol = protocol; Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupPort() + { } /// The protocol associated with the port. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.Serialization.cs index 8a094acda038..9033bc6f9e7d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerGroupSubnetId : IUtf8JsonSerializable + public partial class ContainerGroupSubnetId : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerGroupSubnetId DeserializeContainerGroupSubnetId(JsonElement element) + internal static ContainerGroupSubnetId DeserializeContainerGroupSubnetId(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -45,8 +68,61 @@ internal static ContainerGroupSubnetId DeserializeContainerGroupSubnetId(JsonEle name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerGroupSubnetId(id, name.Value, serializedAdditionalRawData); + } + + ContainerGroupSubnetId IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerGroupSubnetId(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerGroupSubnetId IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerGroupSubnetId(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerGroupSubnetId model) + { + if (model is null) + { + return null; } - return new ContainerGroupSubnetId(id, name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerGroupSubnetId(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerGroupSubnetId(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.cs index cb0bfde70587..89d69fcbdcdc 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupSubnetId.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// Container group subnet information. public partial class ContainerGroupSubnetId { - /// Initializes a new instance of ContainerGroupSubnetId. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Resource ID of virtual network and subnet. /// is null. public ContainerGroupSubnetId(ResourceIdentifier id) @@ -23,13 +27,20 @@ public ContainerGroupSubnetId(ResourceIdentifier id) Id = id; } - /// Initializes a new instance of ContainerGroupSubnetId. + /// Initializes a new instance of . /// Resource ID of virtual network and subnet. /// Friendly name for the subnet. - internal ContainerGroupSubnetId(ResourceIdentifier id, string name) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupSubnetId(ResourceIdentifier id, string name, Dictionary serializedAdditionalRawData) { Id = id; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerGroupSubnetId() + { } /// Resource ID of virtual network and subnet. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.Serialization.cs index 7496072a6810..edddb01ffab7 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerHttpGet : IUtf8JsonSerializable + public partial class ContainerHttpGet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { @@ -34,15 +41,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in HttpHeaders) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerHttpGet DeserializeContainerHttpGet(JsonElement element) + internal static ContainerHttpGet DeserializeContainerHttpGet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +79,7 @@ internal static ContainerHttpGet DeserializeContainerHttpGet(JsonElement element int port = default; Optional scheme = default; Optional> httpHeaders = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -86,8 +115,61 @@ internal static ContainerHttpGet DeserializeContainerHttpGet(JsonElement element httpHeaders = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerHttpGet(path.Value, port, Optional.ToNullable(scheme), Optional.ToList(httpHeaders), serializedAdditionalRawData); + } + + ContainerHttpGet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerHttpGet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerHttpGet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerHttpGet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerHttpGet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerHttpGet(Response response) + { + if (response is null) + { + return null; } - return new ContainerHttpGet(path.Value, port, Optional.ToNullable(scheme), Optional.ToList(httpHeaders)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerHttpGet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.cs index 2bbeea0140c3..36327f8aa24d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpGet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The container Http Get settings, for liveness or readiness probe. public partial class ContainerHttpGet { - /// Initializes a new instance of ContainerHttpGet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The port number to probe. public ContainerHttpGet(int port) { @@ -21,17 +25,24 @@ public ContainerHttpGet(int port) HttpHeaders = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerHttpGet. + /// Initializes a new instance of . /// The path to probe. /// The port number to probe. /// The scheme. /// The HTTP headers. - internal ContainerHttpGet(string path, int port, ContainerHttpGetScheme? scheme, IList httpHeaders) + /// Keeps track of any properties unknown to the library. + internal ContainerHttpGet(string path, int port, ContainerHttpGetScheme? scheme, IList httpHeaders, Dictionary serializedAdditionalRawData) { Path = path; Port = port; Scheme = scheme; HttpHeaders = httpHeaders; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerHttpGet() + { } /// The path to probe. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.Serialization.cs index 8783cef66675..8ad45b6e39d8 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerHttpHeader : IUtf8JsonSerializable + public partial class ContainerHttpHeader : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerHttpHeader DeserializeContainerHttpHeader(JsonElement element) + internal static ContainerHttpHeader DeserializeContainerHttpHeader(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static ContainerHttpHeader DeserializeContainerHttpHeader(JsonElement e value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerHttpHeader(name.Value, value.Value, serializedAdditionalRawData); + } + + ContainerHttpHeader IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerHttpHeader(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerHttpHeader IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerHttpHeader(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerHttpHeader model) + { + if (model is null) + { + return null; } - return new ContainerHttpHeader(name.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerHttpHeader(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerHttpHeader(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.cs index b9a97f483ed3..2fbe466ff9dd 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerHttpHeader.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The HTTP header. public partial class ContainerHttpHeader { - /// Initializes a new instance of ContainerHttpHeader. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerHttpHeader() { } - /// Initializes a new instance of ContainerHttpHeader. + /// Initializes a new instance of . /// The header name. /// The header value. - internal ContainerHttpHeader(string name, string value) + /// Keeps track of any properties unknown to the library. + internal ContainerHttpHeader(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The header name. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.Serialization.cs index be80cfa7bf58..1e532e64f47c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerInstanceAzureFileVolume : IUtf8JsonSerializable + public partial class ContainerInstanceAzureFileVolume : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("shareName"u8); writer.WriteStringValue(ShareName); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("storageAccountKey"u8); writer.WriteStringValue(StorageAccountKey); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerInstanceAzureFileVolume DeserializeContainerInstanceAzureFileVolume(JsonElement element) + internal static ContainerInstanceAzureFileVolume DeserializeContainerInstanceAzureFileVolume(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerInstanceAzureFileVolume DeserializeContainerInstanceAzu Optional readOnly = default; string storageAccountName = default; Optional storageAccountKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shareName"u8)) @@ -68,8 +91,61 @@ internal static ContainerInstanceAzureFileVolume DeserializeContainerInstanceAzu storageAccountKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerInstanceAzureFileVolume(shareName, Optional.ToNullable(readOnly), storageAccountName, storageAccountKey.Value, serializedAdditionalRawData); + } + + ContainerInstanceAzureFileVolume IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceAzureFileVolume(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceAzureFileVolume IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceAzureFileVolume(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceAzureFileVolume model) + { + if (model is null) + { + return null; } - return new ContainerInstanceAzureFileVolume(shareName, Optional.ToNullable(readOnly), storageAccountName, storageAccountKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceAzureFileVolume(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceAzureFileVolume(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.cs index a2427544fdac..fdc82c9ee021 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceAzureFileVolume.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The properties of the Azure File volume. Azure File shares are mounted as volumes. public partial class ContainerInstanceAzureFileVolume { - /// Initializes a new instance of ContainerInstanceAzureFileVolume. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the Azure File share to be mounted as a volume. /// The name of the storage account that contains the Azure File share. /// or is null. @@ -26,17 +30,24 @@ public ContainerInstanceAzureFileVolume(string shareName, string storageAccountN StorageAccountName = storageAccountName; } - /// Initializes a new instance of ContainerInstanceAzureFileVolume. + /// Initializes a new instance of . /// The name of the Azure File share to be mounted as a volume. /// The flag indicating whether the Azure File shared mounted as a volume is read-only. /// The name of the storage account that contains the Azure File share. /// The storage account access key used to access the Azure File share. - internal ContainerInstanceAzureFileVolume(string shareName, bool? isReadOnly, string storageAccountName, string storageAccountKey) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceAzureFileVolume(string shareName, bool? isReadOnly, string storageAccountName, string storageAccountKey, Dictionary serializedAdditionalRawData) { ShareName = shareName; IsReadOnly = isReadOnly; StorageAccountName = storageAccountName; StorageAccountKey = storageAccountKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerInstanceAzureFileVolume() + { } /// The name of the Azure File share to be mounted as a volume. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.Serialization.cs index 6fd8ac7444fc..29b934f6ad2a 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerInstanceContainer : IUtf8JsonSerializable + public partial class ContainerInstanceContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -38,7 +45,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Ports) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -48,43 +62,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EnvironmentVariables) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("resources"u8); - writer.WriteObjectValue(Resources); + if (Resources is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resources).Serialize(writer, options); + } if (Optional.IsCollectionDefined(VolumeMounts)) { writer.WritePropertyName("volumeMounts"u8); writer.WriteStartArray(); foreach (var item in VolumeMounts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(LivenessProbe)) { writer.WritePropertyName("livenessProbe"u8); - writer.WriteObjectValue(LivenessProbe); + if (LivenessProbe is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LivenessProbe).Serialize(writer, options); + } } if (Optional.IsDefined(ReadinessProbe)) { writer.WritePropertyName("readinessProbe"u8); - writer.WriteObjectValue(ReadinessProbe); + if (ReadinessProbe is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReadinessProbe).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityContext)) { writer.WritePropertyName("securityContext"u8); - writer.WriteObjectValue(SecurityContext); + if (SecurityContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityContext).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerInstanceContainer DeserializeContainerInstanceContainer(JsonElement element) + internal static ContainerInstanceContainer DeserializeContainerInstanceContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -100,6 +170,7 @@ internal static ContainerInstanceContainer DeserializeContainerInstanceContainer Optional livenessProbe = default; Optional readinessProbe = default; Optional securityContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -221,8 +292,61 @@ internal static ContainerInstanceContainer DeserializeContainerInstanceContainer } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerInstanceContainer(name, image, Optional.ToList(command), Optional.ToList(ports), Optional.ToList(environmentVariables), instanceView.Value, resources, Optional.ToList(volumeMounts), livenessProbe.Value, readinessProbe.Value, securityContext.Value, serializedAdditionalRawData); + } + + ContainerInstanceContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceContainer model) + { + if (model is null) + { + return null; } - return new ContainerInstanceContainer(name, image, Optional.ToList(command), Optional.ToList(ports), Optional.ToList(environmentVariables), instanceView.Value, resources, Optional.ToList(volumeMounts), livenessProbe.Value, readinessProbe.Value, securityContext.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceContainer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.cs index f3c61de40384..36f9fec8e622 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceContainer.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// A container instance. public partial class ContainerInstanceContainer { - /// Initializes a new instance of ContainerInstanceContainer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The user-provided name of the container instance. /// The name of the image used to create the container instance. /// The resource requirements of the container instance. @@ -34,7 +37,7 @@ public ContainerInstanceContainer(string name, string image, ContainerResourceRe VolumeMounts = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerInstanceContainer. + /// Initializes a new instance of . /// The user-provided name of the container instance. /// The name of the image used to create the container instance. /// The commands to execute within the container instance in exec form. @@ -46,7 +49,8 @@ public ContainerInstanceContainer(string name, string image, ContainerResourceRe /// The liveness probe. /// The readiness probe. /// The container security properties. - internal ContainerInstanceContainer(string name, string image, IList command, IList ports, IList environmentVariables, ContainerInstanceView instanceView, ContainerResourceRequirements resources, IList volumeMounts, ContainerProbe livenessProbe, ContainerProbe readinessProbe, ContainerSecurityContextDefinition securityContext) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceContainer(string name, string image, IList command, IList ports, IList environmentVariables, ContainerInstanceView instanceView, ContainerResourceRequirements resources, IList volumeMounts, ContainerProbe livenessProbe, ContainerProbe readinessProbe, ContainerSecurityContextDefinition securityContext, Dictionary serializedAdditionalRawData) { Name = name; Image = image; @@ -59,6 +63,12 @@ internal ContainerInstanceContainer(string name, string image, IList com LivenessProbe = livenessProbe; ReadinessProbe = readinessProbe; SecurityContext = securityContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerInstanceContainer() + { } /// The user-provided name of the container instance. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.Serialization.cs index 1576e1368293..de98f7a29a53 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerInstanceGitRepoVolume : IUtf8JsonSerializable + public partial class ContainerInstanceGitRepoVolume : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Directory)) { @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("revision"u8); writer.WriteStringValue(Revision); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerInstanceGitRepoVolume DeserializeContainerInstanceGitRepoVolume(JsonElement element) + internal static ContainerInstanceGitRepoVolume DeserializeContainerInstanceGitRepoVolume(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ContainerInstanceGitRepoVolume DeserializeContainerInstanceGitRe Optional directory = default; string repository = default; Optional revision = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("directory"u8)) @@ -56,8 +79,61 @@ internal static ContainerInstanceGitRepoVolume DeserializeContainerInstanceGitRe revision = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerInstanceGitRepoVolume(directory.Value, repository, revision.Value, serializedAdditionalRawData); + } + + ContainerInstanceGitRepoVolume IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceGitRepoVolume(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceGitRepoVolume IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceGitRepoVolume(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceGitRepoVolume model) + { + if (model is null) + { + return null; } - return new ContainerInstanceGitRepoVolume(directory.Value, repository, revision.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceGitRepoVolume(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceGitRepoVolume(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.cs index b33a2ac6bb77..e64965349956 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceGitRepoVolume.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// Represents a volume that is populated with the contents of a git repository. public partial class ContainerInstanceGitRepoVolume { - /// Initializes a new instance of ContainerInstanceGitRepoVolume. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Repository URL. /// is null. public ContainerInstanceGitRepoVolume(string repository) @@ -23,15 +27,22 @@ public ContainerInstanceGitRepoVolume(string repository) Repository = repository; } - /// Initializes a new instance of ContainerInstanceGitRepoVolume. + /// Initializes a new instance of . /// Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. /// Repository URL. /// Commit hash for the specified revision. - internal ContainerInstanceGitRepoVolume(string directory, string repository, string revision) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceGitRepoVolume(string directory, string repository, string revision, Dictionary serializedAdditionalRawData) { Directory = directory; Repository = repository; Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerInstanceGitRepoVolume() + { } /// Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs index 90799c36e4b7..8c78187850be 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerInstanceUsage + public partial class ContainerInstanceUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerInstanceUsage DeserializeContainerInstanceUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerInstanceUsage DeserializeContainerInstanceUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ContainerInstanceUsage DeserializeContainerInstanceUsage(JsonEle Optional currentValue = default; Optional limit = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -62,8 +91,61 @@ internal static ContainerInstanceUsage DeserializeContainerInstanceUsage(JsonEle name = ContainerInstanceUsageName.DeserializeContainerInstanceUsageName(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerInstanceUsage(id.Value, unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), name.Value); + return new ContainerInstanceUsage(id.Value, unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), name.Value, serializedAdditionalRawData); + } + + ContainerInstanceUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs index 7c071c284840..65d432934739 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// A single usage result. public partial class ContainerInstanceUsage { - /// Initializes a new instance of ContainerInstanceUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerInstanceUsage() { } - /// Initializes a new instance of ContainerInstanceUsage. + /// Initializes a new instance of . /// Id of the usage result. /// Unit of the usage result. /// The current usage of the resource. /// The maximum permitted usage of the resource. /// The name object of the resource. - internal ContainerInstanceUsage(string id, string unit, int? currentValue, int? limit, ContainerInstanceUsageName name) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceUsage(string id, string unit, int? currentValue, int? limit, ContainerInstanceUsageName name, Dictionary serializedAdditionalRawData) { Id = id; Unit = unit; CurrentValue = currentValue; Limit = limit; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Id of the usage result. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.Serialization.cs index 2d838c0c7512..5107615b2afd 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - internal partial class ContainerInstanceUsageListResult + internal partial class ContainerInstanceUsageListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerInstanceUsageListResult DeserializeContainerInstanceUsageListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerInstanceUsageListResult DeserializeContainerInstanceUsageListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static ContainerInstanceUsageListResult DeserializeContainerInstanceUsa value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerInstanceUsageListResult(Optional.ToList(value)); + return new ContainerInstanceUsageListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ContainerInstanceUsageListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceUsageListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceUsageListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceUsageListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceUsageListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceUsageListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceUsageListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.cs index ac7c4695f452..578a063916b5 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The response containing the usage data. internal partial class ContainerInstanceUsageListResult { - /// Initializes a new instance of ContainerInstanceUsageListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerInstanceUsageListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerInstanceUsageListResult. + /// Initializes a new instance of . /// The usage data. - internal ContainerInstanceUsageListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceUsageListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The usage data. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.Serialization.cs index 0c594f16d7d0..d7350175af89 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerInstanceUsageName + public partial class ContainerInstanceUsageName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerInstanceUsageName DeserializeContainerInstanceUsageName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerInstanceUsageName DeserializeContainerInstanceUsageName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional localizedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +61,61 @@ internal static ContainerInstanceUsageName DeserializeContainerInstanceUsageName localizedValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerInstanceUsageName(value.Value, localizedValue.Value); + return new ContainerInstanceUsageName(value.Value, localizedValue.Value, serializedAdditionalRawData); + } + + ContainerInstanceUsageName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceUsageName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceUsageName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceUsageName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceUsageName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceUsageName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceUsageName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.cs index 08092dc897fd..8335e152b070 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsageName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The name object of the resource. public partial class ContainerInstanceUsageName { - /// Initializes a new instance of ContainerInstanceUsageName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerInstanceUsageName() { } - /// Initializes a new instance of ContainerInstanceUsageName. + /// Initializes a new instance of . /// The name of the resource. /// The localized name of the resource. - internal ContainerInstanceUsageName(string value, string localizedValue) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceUsageName(string value, string localizedValue, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the resource. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.Serialization.cs index 0105680639be..1d82b149f47f 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerInstanceView + public partial class ContainerInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerInstanceView DeserializeContainerInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerInstanceView DeserializeContainerInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static ContainerInstanceView DeserializeContainerInstanceView(JsonEleme Optional currentState = default; Optional previousState = default; Optional> events = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("restartCount"u8)) @@ -66,8 +94,61 @@ internal static ContainerInstanceView DeserializeContainerInstanceView(JsonEleme events = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerInstanceView(Optional.ToNullable(restartCount), currentState.Value, previousState.Value, Optional.ToList(events)); + return new ContainerInstanceView(Optional.ToNullable(restartCount), currentState.Value, previousState.Value, Optional.ToList(events), serializedAdditionalRawData); + } + + ContainerInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.cs index 7b31d7d758c6..93c39a9c820a 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The instance view of the container instance. Only valid in response. public partial class ContainerInstanceView { - /// Initializes a new instance of ContainerInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerInstanceView() { Events = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerInstanceView. + /// Initializes a new instance of . /// The number of times that the container instance has been restarted. /// Current container instance state. /// Previous container instance state. /// The events of the container instance. - internal ContainerInstanceView(int? restartCount, ContainerState currentState, ContainerState previousState, IReadOnlyList events) + /// Keeps track of any properties unknown to the library. + internal ContainerInstanceView(int? restartCount, ContainerState currentState, ContainerState previousState, IReadOnlyList events, Dictionary serializedAdditionalRawData) { RestartCount = restartCount; CurrentState = currentState; PreviousState = previousState; Events = events; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of times that the container instance has been restarted. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.Serialization.cs index 7f2b3729af88..3d9cc3359fa5 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerLogs + public partial class ContainerLogs : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerLogs DeserializeContainerLogs(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerLogs DeserializeContainerLogs(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional content = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("content"u8)) @@ -26,8 +60,61 @@ internal static ContainerLogs DeserializeContainerLogs(JsonElement element) content = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerLogs(content.Value); + return new ContainerLogs(content.Value, serializedAdditionalRawData); + } + + ContainerLogs IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerLogs(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerLogs IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerLogs(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerLogs model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerLogs(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerLogs(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.cs index 0296804279e4..fa6e23b8b2fb 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerLogs.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The logs. public partial class ContainerLogs { - /// Initializes a new instance of ContainerLogs. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerLogs() { } - /// Initializes a new instance of ContainerLogs. + /// Initializes a new instance of . /// The content of the log. - internal ContainerLogs(string content) + /// Keeps track of any properties unknown to the library. + internal ContainerLogs(string content, Dictionary serializedAdditionalRawData) { Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The content of the log. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.Serialization.cs index 2f5866c3a467..54c433dac2a6 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerPort : IUtf8JsonSerializable + public partial class ContainerPort : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Protocol)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("port"u8); writer.WriteNumberValue(Port); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerPort DeserializeContainerPort(JsonElement element) + internal static ContainerPort DeserializeContainerPort(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional protocol = default; int port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("protocol"u8)) @@ -49,8 +72,61 @@ internal static ContainerPort DeserializeContainerPort(JsonElement element) port = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerPort(Optional.ToNullable(protocol), port, serializedAdditionalRawData); + } + + ContainerPort IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerPort(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerPort IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerPort(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerPort model) + { + if (model is null) + { + return null; } - return new ContainerPort(Optional.ToNullable(protocol), port); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerPort(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerPort(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.cs index af421d4850fd..17a3d31cf769 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerPort.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The port exposed on the container instance. public partial class ContainerPort { - /// Initializes a new instance of ContainerPort. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The port number exposed within the container group. public ContainerPort(int port) { Port = port; } - /// Initializes a new instance of ContainerPort. + /// Initializes a new instance of . /// The protocol associated with the port. /// The port number exposed within the container group. - internal ContainerPort(ContainerNetworkProtocol? protocol, int port) + /// Keeps track of any properties unknown to the library. + internal ContainerPort(ContainerNetworkProtocol? protocol, int port, Dictionary serializedAdditionalRawData) { Protocol = protocol; Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerPort() + { } /// The protocol associated with the port. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.Serialization.cs index c7000294dd27..56427e7450fb 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerProbe : IUtf8JsonSerializable + public partial class ContainerProbe : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Exec)) { writer.WritePropertyName("exec"u8); - writer.WriteObjectValue(Exec); + if (Exec is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Exec).Serialize(writer, options); + } } if (Optional.IsDefined(HttpGet)) { writer.WritePropertyName("httpGet"u8); - writer.WriteObjectValue(HttpGet); + if (HttpGet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HttpGet).Serialize(writer, options); + } } if (Optional.IsDefined(InitialDelayInSeconds)) { @@ -50,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("timeoutSeconds"u8); writer.WriteNumberValue(TimeoutInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerProbe DeserializeContainerProbe(JsonElement element) + internal static ContainerProbe DeserializeContainerProbe(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +102,7 @@ internal static ContainerProbe DeserializeContainerProbe(JsonElement element) Optional failureThreshold = default; Optional successThreshold = default; Optional timeoutSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("exec"u8)) @@ -131,8 +168,61 @@ internal static ContainerProbe DeserializeContainerProbe(JsonElement element) timeoutSeconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerProbe(exec.Value, httpGet.Value, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(failureThreshold), Optional.ToNullable(successThreshold), Optional.ToNullable(timeoutSeconds), serializedAdditionalRawData); + } + + ContainerProbe IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerProbe(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerProbe IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerProbe(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerProbe model) + { + if (model is null) + { + return null; } - return new ContainerProbe(exec.Value, httpGet.Value, Optional.ToNullable(initialDelaySeconds), Optional.ToNullable(periodSeconds), Optional.ToNullable(failureThreshold), Optional.ToNullable(successThreshold), Optional.ToNullable(timeoutSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerProbe(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerProbe(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.cs index daa6aa21b824..c7a0a8a94421 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerProbe.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.ContainerInstance.Models @@ -12,12 +13,15 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The container probe, for liveness or readiness. public partial class ContainerProbe { - /// Initializes a new instance of ContainerProbe. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerProbe() { } - /// Initializes a new instance of ContainerProbe. + /// Initializes a new instance of . /// The execution command to probe. /// The Http Get settings to probe. /// The initial delay seconds. @@ -25,7 +29,8 @@ public ContainerProbe() /// The failure threshold. /// The success threshold. /// The timeout seconds. - internal ContainerProbe(ContainerExec exec, ContainerHttpGet httpGet, int? initialDelayInSeconds, int? periodInSeconds, int? failureThreshold, int? successThreshold, int? timeoutInSeconds) + /// Keeps track of any properties unknown to the library. + internal ContainerProbe(ContainerExec exec, ContainerHttpGet httpGet, int? initialDelayInSeconds, int? periodInSeconds, int? failureThreshold, int? successThreshold, int? timeoutInSeconds, Dictionary serializedAdditionalRawData) { Exec = exec; HttpGet = httpGet; @@ -34,6 +39,7 @@ internal ContainerProbe(ContainerExec exec, ContainerHttpGet httpGet, int? initi FailureThreshold = failureThreshold; SuccessThreshold = successThreshold; TimeoutInSeconds = timeoutInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The execution command to probe. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.Serialization.cs index fc1ca1ce52ac..80bba637ea19 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerResourceLimits : IUtf8JsonSerializable + public partial class ContainerResourceLimits : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MemoryInGB)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Gpu)) { writer.WritePropertyName("gpu"u8); - writer.WriteObjectValue(Gpu); + if (Gpu is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Gpu).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerResourceLimits DeserializeContainerResourceLimits(JsonElement element) + internal static ContainerResourceLimits DeserializeContainerResourceLimits(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static ContainerResourceLimits DeserializeContainerResourceLimits(JsonE Optional memoryInGB = default; Optional cpu = default; Optional gpu = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("memoryInGB"u8)) @@ -71,8 +101,61 @@ internal static ContainerResourceLimits DeserializeContainerResourceLimits(JsonE gpu = ContainerGpuResourceInfo.DeserializeContainerGpuResourceInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerResourceLimits(Optional.ToNullable(memoryInGB), Optional.ToNullable(cpu), gpu.Value, serializedAdditionalRawData); + } + + ContainerResourceLimits IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerResourceLimits(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerResourceLimits IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerResourceLimits(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerResourceLimits model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerResourceLimits(Response response) + { + if (response is null) + { + return null; } - return new ContainerResourceLimits(Optional.ToNullable(memoryInGB), Optional.ToNullable(cpu), gpu.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerResourceLimits(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.cs index 338a5cc0c45a..18fd4f581f0d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceLimits.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The resource limits. public partial class ContainerResourceLimits { - /// Initializes a new instance of ContainerResourceLimits. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerResourceLimits() { } - /// Initializes a new instance of ContainerResourceLimits. + /// Initializes a new instance of . /// The memory limit in GB of this container instance. /// The CPU limit of this container instance. /// The GPU limit of this container instance. - internal ContainerResourceLimits(double? memoryInGB, double? cpu, ContainerGpuResourceInfo gpu) + /// Keeps track of any properties unknown to the library. + internal ContainerResourceLimits(double? memoryInGB, double? cpu, ContainerGpuResourceInfo gpu, Dictionary serializedAdditionalRawData) { MemoryInGB = memoryInGB; Cpu = cpu; Gpu = gpu; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The memory limit in GB of this container instance. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.Serialization.cs index e11fcabe177e..3188f2a57fb4 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerResourceRequestsContent : IUtf8JsonSerializable + public partial class ContainerResourceRequestsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("memoryInGB"u8); writer.WriteNumberValue(MemoryInGB); @@ -22,13 +30,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Gpu)) { writer.WritePropertyName("gpu"u8); - writer.WriteObjectValue(Gpu); + if (Gpu is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Gpu).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerResourceRequestsContent DeserializeContainerResourceRequestsContent(JsonElement element) + internal static ContainerResourceRequestsContent DeserializeContainerResourceRequestsContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static ContainerResourceRequestsContent DeserializeContainerResourceReq double memoryInGB = default; double cpu = default; Optional gpu = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("memoryInGB"u8)) @@ -57,8 +87,61 @@ internal static ContainerResourceRequestsContent DeserializeContainerResourceReq gpu = ContainerGpuResourceInfo.DeserializeContainerGpuResourceInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerResourceRequestsContent(memoryInGB, cpu, gpu.Value, serializedAdditionalRawData); + } + + ContainerResourceRequestsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerResourceRequestsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerResourceRequestsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerResourceRequestsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerResourceRequestsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerResourceRequestsContent(Response response) + { + if (response is null) + { + return null; } - return new ContainerResourceRequestsContent(memoryInGB, cpu, gpu.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerResourceRequestsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.cs index afeff1e305bf..c2389eebc623 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequestsContent.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The resource requests. public partial class ContainerResourceRequestsContent { - /// Initializes a new instance of ContainerResourceRequestsContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The memory request in GB of this container instance. /// The CPU request of this container instance. public ContainerResourceRequestsContent(double memoryInGB, double cpu) @@ -19,15 +25,22 @@ public ContainerResourceRequestsContent(double memoryInGB, double cpu) Cpu = cpu; } - /// Initializes a new instance of ContainerResourceRequestsContent. + /// Initializes a new instance of . /// The memory request in GB of this container instance. /// The CPU request of this container instance. /// The GPU request of this container instance. - internal ContainerResourceRequestsContent(double memoryInGB, double cpu, ContainerGpuResourceInfo gpu) + /// Keeps track of any properties unknown to the library. + internal ContainerResourceRequestsContent(double memoryInGB, double cpu, ContainerGpuResourceInfo gpu, Dictionary serializedAdditionalRawData) { MemoryInGB = memoryInGB; Cpu = cpu; Gpu = gpu; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerResourceRequestsContent() + { } /// The memory request in GB of this container instance. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.Serialization.cs index 6dc07947f136..ca4bf8f64fe2 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.Serialization.cs @@ -5,34 +5,71 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerResourceRequirements : IUtf8JsonSerializable + public partial class ContainerResourceRequirements : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("requests"u8); - writer.WriteObjectValue(Requests); + if (Requests is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Requests).Serialize(writer, options); + } if (Optional.IsDefined(Limits)) { writer.WritePropertyName("limits"u8); - writer.WriteObjectValue(Limits); + if (Limits is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Limits).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerResourceRequirements DeserializeContainerResourceRequirements(JsonElement element) + internal static ContainerResourceRequirements DeserializeContainerResourceRequirements(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ContainerResourceRequestsContent requests = default; Optional limits = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("requests"u8)) @@ -49,8 +86,61 @@ internal static ContainerResourceRequirements DeserializeContainerResourceRequir limits = ContainerResourceLimits.DeserializeContainerResourceLimits(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerResourceRequirements(requests, limits.Value, serializedAdditionalRawData); + } + + ContainerResourceRequirements IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerResourceRequirements(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerResourceRequirements IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerResourceRequirements(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerResourceRequirements model) + { + if (model is null) + { + return null; } - return new ContainerResourceRequirements(requests, limits.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerResourceRequirements(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerResourceRequirements(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.cs index fd7acca0ddc0..237fd455ea3c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerResourceRequirements.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The resource requirements. public partial class ContainerResourceRequirements { - /// Initializes a new instance of ContainerResourceRequirements. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The resource requests of this container instance. /// is null. public ContainerResourceRequirements(ContainerResourceRequestsContent requests) @@ -23,13 +27,20 @@ public ContainerResourceRequirements(ContainerResourceRequestsContent requests) Requests = requests; } - /// Initializes a new instance of ContainerResourceRequirements. + /// Initializes a new instance of . /// The resource requests of this container instance. /// The resource limits of this container instance. - internal ContainerResourceRequirements(ContainerResourceRequestsContent requests, ContainerResourceLimits limits) + /// Keeps track of any properties unknown to the library. + internal ContainerResourceRequirements(ContainerResourceRequestsContent requests, ContainerResourceLimits limits, Dictionary serializedAdditionalRawData) { Requests = requests; Limits = limits; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerResourceRequirements() + { } /// The resource requests of this container instance. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.Serialization.cs index 21591f6f08e4..dcc9b8b84633 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerSecurityContextCapabilitiesDefinition : IUtf8JsonSerializable + public partial class ContainerSecurityContextCapabilitiesDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Add)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerSecurityContextCapabilitiesDefinition DeserializeContainerSecurityContextCapabilitiesDefinition(JsonElement element) + internal static ContainerSecurityContextCapabilitiesDefinition DeserializeContainerSecurityContextCapabilitiesDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> @add = default; Optional> drop = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("add"u8)) @@ -77,8 +99,61 @@ internal static ContainerSecurityContextCapabilitiesDefinition DeserializeContai drop = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerSecurityContextCapabilitiesDefinition(Optional.ToList(@add), Optional.ToList(drop), serializedAdditionalRawData); + } + + ContainerSecurityContextCapabilitiesDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerSecurityContextCapabilitiesDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerSecurityContextCapabilitiesDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerSecurityContextCapabilitiesDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerSecurityContextCapabilitiesDefinition model) + { + if (model is null) + { + return null; } - return new ContainerSecurityContextCapabilitiesDefinition(Optional.ToList(@add), Optional.ToList(drop)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerSecurityContextCapabilitiesDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerSecurityContextCapabilitiesDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.cs index a59b376eac22..f746e20944d3 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextCapabilitiesDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The capabilities to add or drop from a container. public partial class ContainerSecurityContextCapabilitiesDefinition { - /// Initializes a new instance of ContainerSecurityContextCapabilitiesDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerSecurityContextCapabilitiesDefinition() { Add = new ChangeTrackingList(); Drop = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerSecurityContextCapabilitiesDefinition. + /// Initializes a new instance of . /// The capabilities to add to the container. /// The capabilities to drop from the container. - internal ContainerSecurityContextCapabilitiesDefinition(IList @add, IList drop) + /// Keeps track of any properties unknown to the library. + internal ContainerSecurityContextCapabilitiesDefinition(IList @add, IList drop, Dictionary serializedAdditionalRawData) { Add = @add; Drop = drop; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The capabilities to add to the container. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.Serialization.cs index c30660081959..2325c24d4d1d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerSecurityContextDefinition : IUtf8JsonSerializable + public partial class ContainerSecurityContextDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsPrivileged)) { @@ -28,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Capabilities)) { writer.WritePropertyName("capabilities"u8); - writer.WriteObjectValue(Capabilities); + if (Capabilities is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capabilities).Serialize(writer, options); + } } if (Optional.IsDefined(RunAsGroup)) { @@ -45,11 +60,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("seccompProfile"u8); writer.WriteStringValue(SeccompProfile); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerSecurityContextDefinition DeserializeContainerSecurityContextDefinition(JsonElement element) + internal static ContainerSecurityContextDefinition DeserializeContainerSecurityContextDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +89,7 @@ internal static ContainerSecurityContextDefinition DeserializeContainerSecurityC Optional runAsGroup = default; Optional runAsUser = default; Optional seccompProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("privileged"u8)) @@ -112,8 +142,61 @@ internal static ContainerSecurityContextDefinition DeserializeContainerSecurityC seccompProfile = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerSecurityContextDefinition(Optional.ToNullable(privileged), Optional.ToNullable(allowPrivilegeEscalation), capabilities.Value, Optional.ToNullable(runAsGroup), Optional.ToNullable(runAsUser), seccompProfile.Value, serializedAdditionalRawData); + } + + ContainerSecurityContextDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerSecurityContextDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerSecurityContextDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerSecurityContextDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerSecurityContextDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerSecurityContextDefinition(Response response) + { + if (response is null) + { + return null; } - return new ContainerSecurityContextDefinition(Optional.ToNullable(privileged), Optional.ToNullable(allowPrivilegeEscalation), capabilities.Value, Optional.ToNullable(runAsGroup), Optional.ToNullable(runAsUser), seccompProfile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerSecurityContextDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.cs index 1e0ffb8dd49a..72ae002247d1 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSecurityContextDefinition.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The security context for the container. public partial class ContainerSecurityContextDefinition { - /// Initializes a new instance of ContainerSecurityContextDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerSecurityContextDefinition() { } - /// Initializes a new instance of ContainerSecurityContextDefinition. + /// Initializes a new instance of . /// The flag to determine if the container permissions is elevated to Privileged. /// A boolean value indicating whether the init process can elevate its privileges. /// The capabilities to add or drop from a container. /// Sets the User GID for the container. /// Sets the User UID for the container. /// a base64 encoded string containing the contents of the JSON in the seccomp profile. - internal ContainerSecurityContextDefinition(bool? isPrivileged, bool? allowPrivilegeEscalation, ContainerSecurityContextCapabilitiesDefinition capabilities, int? runAsGroup, int? runAsUser, string seccompProfile) + /// Keeps track of any properties unknown to the library. + internal ContainerSecurityContextDefinition(bool? isPrivileged, bool? allowPrivilegeEscalation, ContainerSecurityContextCapabilitiesDefinition capabilities, int? runAsGroup, int? runAsUser, string seccompProfile, Dictionary serializedAdditionalRawData) { IsPrivileged = isPrivileged; AllowPrivilegeEscalation = allowPrivilegeEscalation; @@ -30,6 +37,7 @@ internal ContainerSecurityContextDefinition(bool? isPrivileged, bool? allowPrivi RunAsGroup = runAsGroup; RunAsUser = runAsUser; SeccompProfile = seccompProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The flag to determine if the container permissions is elevated to Privileged. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.Serialization.cs index 628f2b53e4c0..edd6f8f9a79f 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerState + public partial class ContainerState : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerState DeserializeContainerState(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerState DeserializeContainerState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static ContainerState DeserializeContainerState(JsonElement element) Optional exitCode = default; Optional finishTime = default; Optional detailStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("state"u8)) @@ -63,8 +91,61 @@ internal static ContainerState DeserializeContainerState(JsonElement element) detailStatus = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerState(state.Value, Optional.ToNullable(startTime), Optional.ToNullable(exitCode), Optional.ToNullable(finishTime), detailStatus.Value); + return new ContainerState(state.Value, Optional.ToNullable(startTime), Optional.ToNullable(exitCode), Optional.ToNullable(finishTime), detailStatus.Value, serializedAdditionalRawData); + } + + ContainerState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerState model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.cs index 64216100a8cd..4aaacdeef68d 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerState.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerInstance.Models { /// The container instance state. public partial class ContainerState { - /// Initializes a new instance of ContainerState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerState() { } - /// Initializes a new instance of ContainerState. + /// Initializes a new instance of . /// The state of the container instance. /// The date-time when the container instance state started. /// The container instance exit codes correspond to those from the `docker run` command. /// The date-time when the container instance state finished. /// The human-readable status of the container instance state. - internal ContainerState(string state, DateTimeOffset? startOn, int? exitCode, DateTimeOffset? finishOn, string detailStatus) + /// Keeps track of any properties unknown to the library. + internal ContainerState(string state, DateTimeOffset? startOn, int? exitCode, DateTimeOffset? finishOn, string detailStatus, Dictionary serializedAdditionalRawData) { State = state; StartOn = startOn; ExitCode = exitCode; FinishOn = finishOn; DetailStatus = detailStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the container instance. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.Serialization.cs index 100fb4b0fcf2..8a0d7db77c01 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerSupportedCapabilities + public partial class ContainerSupportedCapabilities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerSupportedCapabilities DeserializeContainerSupportedCapabilities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerSupportedCapabilities DeserializeContainerSupportedCapabilities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ContainerSupportedCapabilities DeserializeContainerSupportedCapa Optional maxMemoryInGB = default; Optional maxCpu = default; Optional maxGpuCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("maxMemoryInGB"u8)) @@ -50,8 +79,61 @@ internal static ContainerSupportedCapabilities DeserializeContainerSupportedCapa maxGpuCount = property.Value.GetSingle(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerSupportedCapabilities(Optional.ToNullable(maxMemoryInGB), Optional.ToNullable(maxCpu), Optional.ToNullable(maxGpuCount)); + return new ContainerSupportedCapabilities(Optional.ToNullable(maxMemoryInGB), Optional.ToNullable(maxCpu), Optional.ToNullable(maxGpuCount), serializedAdditionalRawData); + } + + ContainerSupportedCapabilities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerSupportedCapabilities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerSupportedCapabilities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerSupportedCapabilities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerSupportedCapabilities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerSupportedCapabilities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerSupportedCapabilities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.cs index 91b13713d240..84cb0439ba84 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerSupportedCapabilities.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerInstance.Models { /// The supported capabilities. public partial class ContainerSupportedCapabilities { - /// Initializes a new instance of ContainerSupportedCapabilities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerSupportedCapabilities() { } - /// Initializes a new instance of ContainerSupportedCapabilities. + /// Initializes a new instance of . /// The maximum allowed memory request in GB. /// The maximum allowed CPU request in cores. /// The maximum allowed GPU count. - internal ContainerSupportedCapabilities(float? maxMemoryInGB, float? maxCpu, float? maxGpuCount) + /// Keeps track of any properties unknown to the library. + internal ContainerSupportedCapabilities(float? maxMemoryInGB, float? maxCpu, float? maxGpuCount, Dictionary serializedAdditionalRawData) { MaxMemoryInGB = maxMemoryInGB; MaxCpu = maxCpu; MaxGpuCount = maxGpuCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The maximum allowed memory request in GB. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.Serialization.cs index 42d07b503dd7..c4ea558a729e 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.Serialization.cs @@ -8,21 +8,34 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerVolume : IUtf8JsonSerializable + public partial class ContainerVolume : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); if (Optional.IsDefined(AzureFile)) { writer.WritePropertyName("azureFile"u8); - writer.WriteObjectValue(AzureFile); + if (AzureFile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureFile).Serialize(writer, options); + } } if (Optional.IsDefined(EmptyDir)) { @@ -47,13 +60,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GitRepo)) { writer.WritePropertyName("gitRepo"u8); - writer.WriteObjectValue(GitRepo); + if (GitRepo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitRepo).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerVolume DeserializeContainerVolume(JsonElement element) + internal static ContainerVolume DeserializeContainerVolume(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +97,7 @@ internal static ContainerVolume DeserializeContainerVolume(JsonElement element) Optional emptyDir = default; Optional> secret = default; Optional gitRepo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -111,8 +146,61 @@ internal static ContainerVolume DeserializeContainerVolume(JsonElement element) gitRepo = ContainerInstanceGitRepoVolume.DeserializeContainerInstanceGitRepoVolume(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerVolume(name, azureFile.Value, emptyDir.Value, Optional.ToDictionary(secret), gitRepo.Value); + return new ContainerVolume(name, azureFile.Value, emptyDir.Value, Optional.ToDictionary(secret), gitRepo.Value, serializedAdditionalRawData); + } + + ContainerVolume IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerVolume(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerVolume IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerVolume(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerVolume model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerVolume(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerVolume(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.cs index dcc441792534..c61ba60b3ce9 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolume.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The properties of the volume. public partial class ContainerVolume { - /// Initializes a new instance of ContainerVolume. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the volume. /// is null. public ContainerVolume(string name) @@ -25,19 +28,26 @@ public ContainerVolume(string name) Secret = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerVolume. + /// Initializes a new instance of . /// The name of the volume. /// The Azure File volume. /// The empty directory volume. /// The secret volume. /// The git repo volume. - internal ContainerVolume(string name, ContainerInstanceAzureFileVolume azureFile, BinaryData emptyDir, IDictionary secret, ContainerInstanceGitRepoVolume gitRepo) + /// Keeps track of any properties unknown to the library. + internal ContainerVolume(string name, ContainerInstanceAzureFileVolume azureFile, BinaryData emptyDir, IDictionary secret, ContainerInstanceGitRepoVolume gitRepo, Dictionary serializedAdditionalRawData) { Name = name; AzureFile = azureFile; EmptyDir = emptyDir; Secret = secret; GitRepo = gitRepo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerVolume() + { } /// The name of the volume. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.Serialization.cs index bb1b47dc9fae..ab9efb7475b8 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class ContainerVolumeMount : IUtf8JsonSerializable + public partial class ContainerVolumeMount : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readOnly"u8); writer.WriteBooleanValue(IsReadOnly.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerVolumeMount DeserializeContainerVolumeMount(JsonElement element) + internal static ContainerVolumeMount DeserializeContainerVolumeMount(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ContainerVolumeMount DeserializeContainerVolumeMount(JsonElement string name = default; string mountPath = default; Optional readOnly = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +80,61 @@ internal static ContainerVolumeMount DeserializeContainerVolumeMount(JsonElement readOnly = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerVolumeMount(name, mountPath, Optional.ToNullable(readOnly), serializedAdditionalRawData); + } + + ContainerVolumeMount IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerVolumeMount(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerVolumeMount IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerVolumeMount(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerVolumeMount model) + { + if (model is null) + { + return null; } - return new ContainerVolumeMount(name, mountPath, Optional.ToNullable(readOnly)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerVolumeMount(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerVolumeMount(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.cs index 8b44024ace12..8001fdd667fd 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerVolumeMount.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The properties of the volume mount. public partial class ContainerVolumeMount { - /// Initializes a new instance of ContainerVolumeMount. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the volume mount. /// The path within the container where the volume should be mounted. Must not contain colon (:). /// or is null. @@ -26,15 +30,22 @@ public ContainerVolumeMount(string name, string mountPath) MountPath = mountPath; } - /// Initializes a new instance of ContainerVolumeMount. + /// Initializes a new instance of . /// The name of the volume mount. /// The path within the container where the volume should be mounted. Must not contain colon (:). /// The flag indicating whether the volume mount is read-only. - internal ContainerVolumeMount(string name, string mountPath, bool? isReadOnly) + /// Keeps track of any properties unknown to the library. + internal ContainerVolumeMount(string name, string mountPath, bool? isReadOnly, Dictionary serializedAdditionalRawData) { Name = name; MountPath = mountPath; IsReadOnly = isReadOnly; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerVolumeMount() + { } /// The name of the volume mount. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.Serialization.cs index 35fae300d425..d6f974432ea3 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class DeploymentExtensionSpec : IUtf8JsonSerializable + public partial class DeploymentExtensionSpec : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -49,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DeploymentExtensionSpec DeserializeDeploymentExtensionSpec(JsonElement element) + internal static DeploymentExtensionSpec DeserializeDeploymentExtensionSpec(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +84,7 @@ internal static DeploymentExtensionSpec DeserializeDeploymentExtensionSpec(JsonE Optional version = default; Optional settings = default; Optional protectedSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -110,8 +132,61 @@ internal static DeploymentExtensionSpec DeserializeDeploymentExtensionSpec(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeploymentExtensionSpec(name, extensionType.Value, version.Value, settings.Value, protectedSettings.Value); + return new DeploymentExtensionSpec(name, extensionType.Value, version.Value, settings.Value, protectedSettings.Value, serializedAdditionalRawData); + } + + DeploymentExtensionSpec IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentExtensionSpec(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeploymentExtensionSpec IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeploymentExtensionSpec(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeploymentExtensionSpec model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeploymentExtensionSpec(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeploymentExtensionSpec(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.cs index 21f5dba6ed1e..b222f0c8dc9f 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DeploymentExtensionSpec.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerInstance.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// Extension sidecars to be added to the deployment. public partial class DeploymentExtensionSpec { - /// Initializes a new instance of DeploymentExtensionSpec. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the extension. /// is null. public DeploymentExtensionSpec(string name) @@ -23,19 +27,26 @@ public DeploymentExtensionSpec(string name) Name = name; } - /// Initializes a new instance of DeploymentExtensionSpec. + /// Initializes a new instance of . /// Name of the extension. /// Type of extension to be added. /// Version of the extension being used. /// Settings for the extension. /// Protected settings for the extension. - internal DeploymentExtensionSpec(string name, string extensionType, string version, BinaryData settings, BinaryData protectedSettings) + /// Keeps track of any properties unknown to the library. + internal DeploymentExtensionSpec(string name, string extensionType, string version, BinaryData settings, BinaryData protectedSettings, Dictionary serializedAdditionalRawData) { Name = name; ExtensionType = extensionType; Version = version; Settings = settings; ProtectedSettings = protectedSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeploymentExtensionSpec() + { } /// Name of the extension. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.Serialization.cs index 27a811a8bb3e..51807a80f354 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class InitContainerDefinitionContent : IUtf8JsonSerializable + public partial class InitContainerDefinitionContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -41,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EnvironmentVariables) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -51,21 +65,49 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VolumeMounts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(SecurityContext)) { writer.WritePropertyName("securityContext"u8); - writer.WriteObjectValue(SecurityContext); + if (SecurityContext is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityContext).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InitContainerDefinitionContent DeserializeInitContainerDefinitionContent(JsonElement element) + internal static InitContainerDefinitionContent DeserializeInitContainerDefinitionContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +119,7 @@ internal static InitContainerDefinitionContent DeserializeInitContainerDefinitio Optional instanceView = default; Optional> volumeMounts = default; Optional securityContext = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -161,8 +204,61 @@ internal static InitContainerDefinitionContent DeserializeInitContainerDefinitio } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InitContainerDefinitionContent(name, image.Value, Optional.ToList(command), Optional.ToList(environmentVariables), instanceView.Value, Optional.ToList(volumeMounts), securityContext.Value, serializedAdditionalRawData); + } + + InitContainerDefinitionContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInitContainerDefinitionContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InitContainerDefinitionContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInitContainerDefinitionContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InitContainerDefinitionContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InitContainerDefinitionContent(Response response) + { + if (response is null) + { + return null; } - return new InitContainerDefinitionContent(name, image.Value, Optional.ToList(command), Optional.ToList(environmentVariables), instanceView.Value, Optional.ToList(volumeMounts), securityContext.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInitContainerDefinitionContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.cs index 21d60dcb2fcb..ae4381fff321 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerDefinitionContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The init container definition. public partial class InitContainerDefinitionContent { - /// Initializes a new instance of InitContainerDefinitionContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name for the init container. /// is null. public InitContainerDefinitionContent(string name) @@ -27,7 +30,7 @@ public InitContainerDefinitionContent(string name) VolumeMounts = new ChangeTrackingList(); } - /// Initializes a new instance of InitContainerDefinitionContent. + /// Initializes a new instance of . /// The name for the init container. /// The image of the init container. /// The command to execute within the init container in exec form. @@ -35,7 +38,8 @@ public InitContainerDefinitionContent(string name) /// The instance view of the init container. Only valid in response. /// The volume mounts available to the init container. /// The container security properties. - internal InitContainerDefinitionContent(string name, string image, IList command, IList environmentVariables, InitContainerPropertiesDefinitionInstanceView instanceView, IList volumeMounts, ContainerSecurityContextDefinition securityContext) + /// Keeps track of any properties unknown to the library. + internal InitContainerDefinitionContent(string name, string image, IList command, IList environmentVariables, InitContainerPropertiesDefinitionInstanceView instanceView, IList volumeMounts, ContainerSecurityContextDefinition securityContext, Dictionary serializedAdditionalRawData) { Name = name; Image = image; @@ -44,6 +48,12 @@ internal InitContainerDefinitionContent(string name, string image, IList InstanceView = instanceView; VolumeMounts = volumeMounts; SecurityContext = securityContext; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InitContainerDefinitionContent() + { } /// The name for the init container. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.Serialization.cs index 2ee565a5b4fd..7f665cc03c88 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerInstance.Models { - public partial class InitContainerPropertiesDefinitionInstanceView + public partial class InitContainerPropertiesDefinitionInstanceView : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InitContainerPropertiesDefinitionInstanceView DeserializeInitContainerPropertiesDefinitionInstanceView(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InitContainerPropertiesDefinitionInstanceView DeserializeInitContainerPropertiesDefinitionInstanceView(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static InitContainerPropertiesDefinitionInstanceView DeserializeInitCon Optional currentState = default; Optional previousState = default; Optional> events = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("restartCount"u8)) @@ -66,8 +94,61 @@ internal static InitContainerPropertiesDefinitionInstanceView DeserializeInitCon events = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InitContainerPropertiesDefinitionInstanceView(Optional.ToNullable(restartCount), currentState.Value, previousState.Value, Optional.ToList(events)); + return new InitContainerPropertiesDefinitionInstanceView(Optional.ToNullable(restartCount), currentState.Value, previousState.Value, Optional.ToList(events), serializedAdditionalRawData); + } + + InitContainerPropertiesDefinitionInstanceView IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInitContainerPropertiesDefinitionInstanceView(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InitContainerPropertiesDefinitionInstanceView IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInitContainerPropertiesDefinitionInstanceView(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InitContainerPropertiesDefinitionInstanceView model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InitContainerPropertiesDefinitionInstanceView(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInitContainerPropertiesDefinitionInstanceView(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.cs index 3664ca64e76c..092f58c2cfa2 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/InitContainerPropertiesDefinitionInstanceView.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.ContainerInstance.Models /// The instance view of the init container. Only valid in response. public partial class InitContainerPropertiesDefinitionInstanceView { - /// Initializes a new instance of InitContainerPropertiesDefinitionInstanceView. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal InitContainerPropertiesDefinitionInstanceView() { Events = new ChangeTrackingList(); } - /// Initializes a new instance of InitContainerPropertiesDefinitionInstanceView. + /// Initializes a new instance of . /// The number of times that the init container has been restarted. /// The current state of the init container. /// The previous state of the init container. /// The events of the init container. - internal InitContainerPropertiesDefinitionInstanceView(int? restartCount, ContainerState currentState, ContainerState previousState, IReadOnlyList events) + /// Keeps track of any properties unknown to the library. + internal InitContainerPropertiesDefinitionInstanceView(int? restartCount, ContainerState currentState, ContainerState previousState, IReadOnlyList events, Dictionary serializedAdditionalRawData) { RestartCount = restartCount; CurrentState = currentState; PreviousState = previousState; Events = events; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of times that the init container has been restarted. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs index 3e9e209089d1..5069015ad7cb 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs @@ -277,9 +277,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -355,9 +353,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainersRestOperations.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainersRestOperations.cs index cc777c7c63d6..6d228ee96a5a 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainersRestOperations.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainersRestOperations.cs @@ -154,9 +154,7 @@ internal HttpMessage CreateExecuteCommandRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryModelFactory.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryModelFactory.cs index 926ae43c500e..663128687cc8 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryModelFactory.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryModelFactory.cs @@ -14,7 +14,7 @@ namespace Azure.Containers.ContainerRegistry /// Model factory for models. public static partial class ContainerRegistryModelFactory { - /// Initializes a new instance of ContainerRepositoryProperties. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// Image created time. @@ -28,10 +28,10 @@ public static partial class ContainerRegistryModelFactory /// A new instance for mocking. public static ContainerRepositoryProperties ContainerRepositoryProperties(string registryLoginServer = null, string name = null, DateTimeOffset createdOn = default, DateTimeOffset lastUpdatedOn = default, int manifestCount = default, int tagCount = default, bool? canDelete = null, bool? canWrite = null, bool? canList = null, bool? canRead = null) { - return new ContainerRepositoryProperties(registryLoginServer, name, createdOn, lastUpdatedOn, manifestCount, tagCount, canDelete, canWrite, canList, canRead); + return new ContainerRepositoryProperties(registryLoginServer, name, createdOn, lastUpdatedOn, manifestCount, tagCount, canDelete, canWrite, canList, canRead, default); } - /// Initializes a new instance of ArtifactTagProperties. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// Tag name. @@ -45,20 +45,20 @@ public static ContainerRepositoryProperties ContainerRepositoryProperties(string /// A new instance for mocking. public static ArtifactTagProperties ArtifactTagProperties(string registryLoginServer = null, string repositoryName = null, string name = null, string digest = null, DateTimeOffset createdOn = default, DateTimeOffset lastUpdatedOn = default, bool? canDelete = null, bool? canWrite = null, bool? canList = null, bool? canRead = null) { - return new ArtifactTagProperties(registryLoginServer, repositoryName, name, digest, createdOn, lastUpdatedOn, canDelete, canWrite, canList, canRead); + return new ArtifactTagProperties(registryLoginServer, repositoryName, name, digest, createdOn, lastUpdatedOn, canDelete, canWrite, canList, canRead, default); } - /// Initializes a new instance of ArtifactManifestPlatform. + /// Initializes a new instance of . /// Manifest digest. /// CPU architecture. /// Operating system. /// A new instance for mocking. public static ArtifactManifestPlatform ArtifactManifestPlatform(string digest = null, ArtifactArchitecture? architecture = null, ArtifactOperatingSystem? operatingSystem = null) { - return new ArtifactManifestPlatform(digest, architecture, operatingSystem); + return new ArtifactManifestPlatform(digest, architecture, operatingSystem, default); } - /// Initializes a new instance of ArtifactManifestProperties. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Repository name. /// Manifest. @@ -79,7 +79,7 @@ public static ArtifactManifestProperties ArtifactManifestProperties(string regis relatedArtifacts ??= new List(); tags ??= new List(); - return new ArtifactManifestProperties(registryLoginServer, repositoryName, digest, sizeInBytes, createdOn, lastUpdatedOn, architecture, operatingSystem, relatedArtifacts?.ToList(), tags?.ToList(), canDelete, canWrite, canList, canRead); + return new ArtifactManifestProperties(registryLoginServer, repositoryName, digest, sizeInBytes, createdOn, lastUpdatedOn, architecture, operatingSystem, relatedArtifacts?.ToList(), tags?.ToList(), canDelete, canWrite, canList, canRead, default); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryRestClient.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryRestClient.cs index ecbb69d94ab9..6cf971d8eed0 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryRestClient.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/ContainerRegistryRestClient.cs @@ -542,9 +542,7 @@ internal HttpMessage CreateUpdatePropertiesRequest(string name, RepositoryWritea if (value != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(value); - request.Content = content; + request.Content = value; } return message; } @@ -799,9 +797,7 @@ internal HttpMessage CreateUpdateTagAttributesRequest(string name, string refere if (value != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(value); - request.Content = content; + request.Content = value; } return message; } @@ -1133,9 +1129,7 @@ internal HttpMessage CreateUpdateManifestPropertiesRequest(string name, string d if (value != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(value); - request.Content = content; + request.Content = value; } return message; } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.Serialization.cs index a4458151d619..4d57304538bc 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class AcrAccessToken + internal partial class AcrAccessToken : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcrAccessToken DeserializeAcrAccessToken(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AccessToken)) + { + writer.WritePropertyName("access_token"u8); + writer.WriteStringValue(AccessToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcrAccessToken DeserializeAcrAccessToken(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional accessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("access_token"u8)) @@ -26,8 +60,61 @@ internal static AcrAccessToken DeserializeAcrAccessToken(JsonElement element) accessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcrAccessToken(accessToken.Value); + return new AcrAccessToken(accessToken.Value, serializedAdditionalRawData); + } + + AcrAccessToken IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcrAccessToken(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcrAccessToken IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcrAccessToken(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcrAccessToken model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcrAccessToken(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcrAccessToken(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.cs index a5aa45e4a8a1..f56db338e7a0 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrAccessToken.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// The AcrAccessToken. internal partial class AcrAccessToken { - /// Initializes a new instance of AcrAccessToken. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AcrAccessToken() { } - /// Initializes a new instance of AcrAccessToken. + /// Initializes a new instance of . /// The access token for performing authenticated requests. - internal AcrAccessToken(string accessToken) + /// Keeps track of any properties unknown to the library. + internal AcrAccessToken(string accessToken, Dictionary serializedAdditionalRawData) { AccessToken = accessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The access token for performing authenticated requests. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.Serialization.cs index a6085d544fec..8b852e259175 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class AcrErrorInfo + internal partial class AcrErrorInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcrErrorInfo DeserializeAcrErrorInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(Detail)) + { + writer.WritePropertyName("detail"u8); + writer.WriteObjectValue(Detail); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcrErrorInfo DeserializeAcrErrorInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static AcrErrorInfo DeserializeAcrErrorInfo(JsonElement element) Optional code = default; Optional message = default; Optional detail = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -42,8 +86,61 @@ internal static AcrErrorInfo DeserializeAcrErrorInfo(JsonElement element) detail = property.Value.GetObject(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcrErrorInfo(code.Value, message.Value, detail.Value); + return new AcrErrorInfo(code.Value, message.Value, detail.Value, serializedAdditionalRawData); + } + + AcrErrorInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcrErrorInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcrErrorInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcrErrorInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcrErrorInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcrErrorInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcrErrorInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.cs index dc879fee2cec..497f19db0f79 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrorInfo.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Error information. internal partial class AcrErrorInfo { - /// Initializes a new instance of AcrErrorInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AcrErrorInfo() { } - /// Initializes a new instance of AcrErrorInfo. + /// Initializes a new instance of . /// Error code. /// Error message. /// Error details. - internal AcrErrorInfo(string code, string message, object detail) + /// Keeps track of any properties unknown to the library. + internal AcrErrorInfo(string code, string message, object detail, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Detail = detail; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.Serialization.cs index ae957972b445..dde749c33d3a 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class AcrErrors + internal partial class AcrErrors : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcrErrors DeserializeAcrErrors(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcrErrors DeserializeAcrErrors(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> errors = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errors"u8)) @@ -36,8 +81,61 @@ internal static AcrErrors DeserializeAcrErrors(JsonElement element) errors = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcrErrors(Optional.ToList(errors)); + return new AcrErrors(Optional.ToList(errors), serializedAdditionalRawData); + } + + AcrErrors IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcrErrors(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcrErrors IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcrErrors(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcrErrors model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcrErrors(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcrErrors(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.cs index 9e5f27914a6b..d05bde387d6f 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrErrors.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.Containers.ContainerRegistry /// Acr error response describing why the operation failed. internal partial class AcrErrors { - /// Initializes a new instance of AcrErrors. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AcrErrors() { Errors = new ChangeTrackingList(); } - /// Initializes a new instance of AcrErrors. + /// Initializes a new instance of . /// Array of detailed error. - internal AcrErrors(IReadOnlyList errors) + /// Keeps track of any properties unknown to the library. + internal AcrErrors(IReadOnlyList errors, Dictionary serializedAdditionalRawData) { Errors = errors; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of detailed error. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.Serialization.cs index ab44dd12947d..f4cd5976d961 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class AcrManifests + internal partial class AcrManifests : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcrManifests DeserializeAcrManifests(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RegistryLoginServer)) + { + writer.WritePropertyName("registry"u8); + writer.WriteStringValue(RegistryLoginServer); + } + if (Optional.IsDefined(Repository)) + { + writer.WritePropertyName("imageName"u8); + writer.WriteStringValue(Repository); + } + if (Optional.IsCollectionDefined(Manifests)) + { + writer.WritePropertyName("manifests"u8); + writer.WriteStartArray(); + foreach (var item in Manifests) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Link)) + { + writer.WritePropertyName("link"u8); + writer.WriteStringValue(Link); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcrManifests DeserializeAcrManifests(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +82,7 @@ internal static AcrManifests DeserializeAcrManifests(JsonElement element) Optional imageName = default; Optional> manifests = default; Optional link = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry"u8)) @@ -54,8 +114,61 @@ internal static AcrManifests DeserializeAcrManifests(JsonElement element) link = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcrManifests(registry.Value, imageName.Value, Optional.ToList(manifests), link.Value); + return new AcrManifests(registry.Value, imageName.Value, Optional.ToList(manifests), link.Value, serializedAdditionalRawData); + } + + AcrManifests IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcrManifests(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcrManifests IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcrManifests(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcrManifests model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcrManifests(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcrManifests(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.cs index 23c6b54afead..079567b23a41 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrManifests.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.Containers.ContainerRegistry /// Manifest attributes. internal partial class AcrManifests { - /// Initializes a new instance of AcrManifests. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AcrManifests() { Manifests = new ChangeTrackingList(); } - /// Initializes a new instance of AcrManifests. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// List of manifests. /// - internal AcrManifests(string registryLoginServer, string repository, IReadOnlyList manifests, string link) + /// Keeps track of any properties unknown to the library. + internal AcrManifests(string registryLoginServer, string repository, IReadOnlyList manifests, string link, Dictionary serializedAdditionalRawData) { RegistryLoginServer = registryLoginServer; Repository = repository; Manifests = manifests; Link = link; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.Serialization.cs index de754b890230..67aab87fb4bb 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class AcrRefreshToken + internal partial class AcrRefreshToken : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AcrRefreshToken DeserializeAcrRefreshToken(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RefreshToken)) + { + writer.WritePropertyName("refresh_token"u8); + writer.WriteStringValue(RefreshToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AcrRefreshToken DeserializeAcrRefreshToken(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional refreshToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("refresh_token"u8)) @@ -26,8 +60,61 @@ internal static AcrRefreshToken DeserializeAcrRefreshToken(JsonElement element) refreshToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AcrRefreshToken(refreshToken.Value); + return new AcrRefreshToken(refreshToken.Value, serializedAdditionalRawData); + } + + AcrRefreshToken IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAcrRefreshToken(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AcrRefreshToken IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAcrRefreshToken(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AcrRefreshToken model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AcrRefreshToken(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAcrRefreshToken(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.cs index 74e16f149836..465b79200019 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/AcrRefreshToken.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// The AcrRefreshToken. internal partial class AcrRefreshToken { - /// Initializes a new instance of AcrRefreshToken. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AcrRefreshToken() { } - /// Initializes a new instance of AcrRefreshToken. + /// Initializes a new instance of . /// The refresh token to be used for generating access tokens. - internal AcrRefreshToken(string refreshToken) + /// Keeps track of any properties unknown to the library. + internal AcrRefreshToken(string refreshToken, Dictionary serializedAdditionalRawData) { RefreshToken = refreshToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The refresh token to be used for generating access tokens. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.Serialization.cs index 40eae5483fc8..f63ea3d67b77 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - public partial class ArtifactManifestPlatform + public partial class ArtifactManifestPlatform : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArtifactManifestPlatform DeserializeArtifactManifestPlatform(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArtifactManifestPlatform DeserializeArtifactManifestPlatform(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ArtifactManifestPlatform DeserializeArtifactManifestPlatform(Jso string digest = default; Optional architecture = default; Optional os = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("digest"u8)) @@ -46,8 +75,61 @@ internal static ArtifactManifestPlatform DeserializeArtifactManifestPlatform(Jso os = new ArtifactOperatingSystem(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArtifactManifestPlatform(digest, Optional.ToNullable(architecture), Optional.ToNullable(os)); + return new ArtifactManifestPlatform(digest, Optional.ToNullable(architecture), Optional.ToNullable(os), serializedAdditionalRawData); + } + + ArtifactManifestPlatform IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactManifestPlatform(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArtifactManifestPlatform IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArtifactManifestPlatform(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArtifactManifestPlatform model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArtifactManifestPlatform(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArtifactManifestPlatform(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.cs index aa17c1384a71..8dd1fdc2b6ec 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestPlatform.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Containers.ContainerRegistry @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// The artifact's platform, consisting of operating system and architecture. public partial class ArtifactManifestPlatform { - /// Initializes a new instance of ArtifactManifestPlatform. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Manifest digest. /// is null. internal ArtifactManifestPlatform(string digest) @@ -23,15 +27,22 @@ internal ArtifactManifestPlatform(string digest) Digest = digest; } - /// Initializes a new instance of ArtifactManifestPlatform. + /// Initializes a new instance of . /// Manifest digest. /// CPU architecture. /// Operating system. - internal ArtifactManifestPlatform(string digest, ArtifactArchitecture? architecture, ArtifactOperatingSystem? operatingSystem) + /// Keeps track of any properties unknown to the library. + internal ArtifactManifestPlatform(string digest, ArtifactArchitecture? architecture, ArtifactOperatingSystem? operatingSystem, Dictionary serializedAdditionalRawData) { Digest = digest; Architecture = architecture; OperatingSystem = operatingSystem; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArtifactManifestPlatform() + { } /// Manifest digest. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.Serialization.cs index fed685dfab91..e8c9a5e3aae5 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.Serialization.cs @@ -8,14 +8,66 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - public partial class ArtifactManifestProperties + public partial class ArtifactManifestProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArtifactManifestProperties DeserializeArtifactManifestProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("manifest"u8); + writer.WriteStartObject(); + writer.WritePropertyName("changeableAttributes"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CanDelete)) + { + writer.WritePropertyName("deleteEnabled"u8); + writer.WriteBooleanValue(CanDelete.Value); + } + if (Optional.IsDefined(CanWrite)) + { + writer.WritePropertyName("writeEnabled"u8); + writer.WriteBooleanValue(CanWrite.Value); + } + if (Optional.IsDefined(CanList)) + { + writer.WritePropertyName("listEnabled"u8); + writer.WriteBooleanValue(CanList.Value); + } + if (Optional.IsDefined(CanRead)) + { + writer.WritePropertyName("readEnabled"u8); + writer.WriteBooleanValue(CanRead.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArtifactManifestProperties DeserializeArtifactManifestProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +86,7 @@ internal static ArtifactManifestProperties DeserializeArtifactManifestProperties Optional writeEnabled = default; Optional listEnabled = default; Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry"u8)) @@ -178,8 +231,61 @@ internal static ArtifactManifestProperties DeserializeArtifactManifestProperties } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArtifactManifestProperties(registry.Value, imageName.Value, digest, Optional.ToNullable(imageSize), createdTime, lastUpdateTime, Optional.ToNullable(architecture), Optional.ToNullable(os), Optional.ToList(references), Optional.ToList(tags), Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled)); + return new ArtifactManifestProperties(registry.Value, imageName.Value, digest, Optional.ToNullable(imageSize), createdTime, lastUpdateTime, Optional.ToNullable(architecture), Optional.ToNullable(os), Optional.ToList(references), Optional.ToList(tags), Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + ArtifactManifestProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactManifestProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArtifactManifestProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArtifactManifestProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArtifactManifestProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArtifactManifestProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArtifactManifestProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.cs index b4b5e66116f9..8ad168d0d53a 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactManifestProperties.cs @@ -14,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// Manifest attributes details. public partial class ArtifactManifestProperties { - /// Initializes a new instance of ArtifactManifestProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Manifest. /// Created time. /// Last update time. @@ -30,7 +33,7 @@ internal ArtifactManifestProperties(string digest, DateTimeOffset createdOn, Dat Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ArtifactManifestProperties. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Repository name. /// Manifest. @@ -45,7 +48,8 @@ internal ArtifactManifestProperties(string digest, DateTimeOffset createdOn, Dat /// Write enabled. /// List enabled. /// Read enabled. - internal ArtifactManifestProperties(string registryLoginServer, string repositoryName, string digest, long? sizeInBytes, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ArtifactArchitecture? architecture, ArtifactOperatingSystem? operatingSystem, IReadOnlyList relatedArtifacts, IReadOnlyList tags, bool? canDelete, bool? canWrite, bool? canList, bool? canRead) + /// Keeps track of any properties unknown to the library. + internal ArtifactManifestProperties(string registryLoginServer, string repositoryName, string digest, long? sizeInBytes, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ArtifactArchitecture? architecture, ArtifactOperatingSystem? operatingSystem, IReadOnlyList relatedArtifacts, IReadOnlyList tags, bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) { RegistryLoginServer = registryLoginServer; RepositoryName = repositoryName; @@ -61,6 +65,7 @@ internal ArtifactManifestProperties(string registryLoginServer, string repositor CanWrite = canWrite; CanList = canList; CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.Serialization.cs index eba6d90e05ad..96dec57c2e60 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.Serialization.cs @@ -6,15 +6,68 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - public partial class ArtifactTagProperties + public partial class ArtifactTagProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ArtifactTagProperties DeserializeArtifactTagProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("tag"u8); + writer.WriteStartObject(); + writer.WritePropertyName("changeableAttributes"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CanDelete)) + { + writer.WritePropertyName("deleteEnabled"u8); + writer.WriteBooleanValue(CanDelete.Value); + } + if (Optional.IsDefined(CanWrite)) + { + writer.WritePropertyName("writeEnabled"u8); + writer.WriteBooleanValue(CanWrite.Value); + } + if (Optional.IsDefined(CanList)) + { + writer.WritePropertyName("listEnabled"u8); + writer.WriteBooleanValue(CanList.Value); + } + if (Optional.IsDefined(CanRead)) + { + writer.WritePropertyName("readEnabled"u8); + writer.WriteBooleanValue(CanRead.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ArtifactTagProperties DeserializeArtifactTagProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +82,7 @@ internal static ArtifactTagProperties DeserializeArtifactTagProperties(JsonEleme Optional writeEnabled = default; Optional listEnabled = default; Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry"u8)) @@ -121,8 +175,61 @@ internal static ArtifactTagProperties DeserializeArtifactTagProperties(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ArtifactTagProperties(registry, imageName, name, digest, createdTime, lastUpdateTime, Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled)); + return new ArtifactTagProperties(registry, imageName, name, digest, createdTime, lastUpdateTime, Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + ArtifactTagProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactTagProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ArtifactTagProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeArtifactTagProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ArtifactTagProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ArtifactTagProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeArtifactTagProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.cs index d5db632ec103..1965fd609e9a 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ArtifactTagProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Containers.ContainerRegistry @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// Tag attributes. public partial class ArtifactTagProperties { - /// Initializes a new instance of ArtifactTagProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// Tag name. @@ -36,7 +40,7 @@ internal ArtifactTagProperties(string registryLoginServer, string repositoryName LastUpdatedOn = lastUpdatedOn; } - /// Initializes a new instance of ArtifactTagProperties. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// Tag name. @@ -47,7 +51,8 @@ internal ArtifactTagProperties(string registryLoginServer, string repositoryName /// Write enabled. /// List enabled. /// Read enabled. - internal ArtifactTagProperties(string registryLoginServer, string repositoryName, string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, bool? canDelete, bool? canWrite, bool? canList, bool? canRead) + /// Keeps track of any properties unknown to the library. + internal ArtifactTagProperties(string registryLoginServer, string repositoryName, string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) { RegistryLoginServer = registryLoginServer; RepositoryName = repositoryName; @@ -59,6 +64,7 @@ internal ArtifactTagProperties(string registryLoginServer, string repositoryName CanWrite = canWrite; CanList = canList; CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.Serialization.cs index b65de1de81ee..8450035c6b8f 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.Serialization.cs @@ -6,15 +6,65 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - public partial class ContainerRepositoryProperties + public partial class ContainerRepositoryProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRepositoryProperties DeserializeContainerRepositoryProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("changeableAttributes"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CanDelete)) + { + writer.WritePropertyName("deleteEnabled"u8); + writer.WriteBooleanValue(CanDelete.Value); + } + if (Optional.IsDefined(CanWrite)) + { + writer.WritePropertyName("writeEnabled"u8); + writer.WriteBooleanValue(CanWrite.Value); + } + if (Optional.IsDefined(CanList)) + { + writer.WritePropertyName("listEnabled"u8); + writer.WriteBooleanValue(CanList.Value); + } + if (Optional.IsDefined(CanRead)) + { + writer.WritePropertyName("readEnabled"u8); + writer.WriteBooleanValue(CanRead.Value); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRepositoryProperties DeserializeContainerRepositoryProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +79,7 @@ internal static ContainerRepositoryProperties DeserializeContainerRepositoryProp Optional writeEnabled = default; Optional listEnabled = default; Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry"u8)) @@ -109,8 +160,61 @@ internal static ContainerRepositoryProperties DeserializeContainerRepositoryProp } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRepositoryProperties(registry, imageName, createdTime, lastUpdateTime, manifestCount, tagCount, Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled)); + return new ContainerRepositoryProperties(registry, imageName, createdTime, lastUpdateTime, manifestCount, tagCount, Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + ContainerRepositoryProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRepositoryProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRepositoryProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRepositoryProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRepositoryProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRepositoryProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRepositoryProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.cs index 2624dcbbc7f8..ceaa4bb71479 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ContainerRepositoryProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Containers.ContainerRegistry @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// Properties of this repository. public partial class ContainerRepositoryProperties { - /// Initializes a new instance of ContainerRepositoryProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// Image created time. @@ -34,7 +38,7 @@ internal ContainerRepositoryProperties(string registryLoginServer, string name, TagCount = tagCount; } - /// Initializes a new instance of ContainerRepositoryProperties. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// Image created time. @@ -45,7 +49,8 @@ internal ContainerRepositoryProperties(string registryLoginServer, string name, /// Write enabled. /// List enabled. /// Read enabled. - internal ContainerRepositoryProperties(string registryLoginServer, string name, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, int manifestCount, int tagCount, bool? canDelete, bool? canWrite, bool? canList, bool? canRead) + /// Keeps track of any properties unknown to the library. + internal ContainerRepositoryProperties(string registryLoginServer, string name, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, int manifestCount, int tagCount, bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) { RegistryLoginServer = registryLoginServer; Name = name; @@ -57,6 +62,7 @@ internal ContainerRepositoryProperties(string registryLoginServer, string name, CanWrite = canWrite; CanList = canList; CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/DeleteRepositoryResult.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/DeleteRepositoryResult.cs index c9830bfeb279..0fe71d88e85b 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/DeleteRepositoryResult.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/DeleteRepositoryResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,27 @@ namespace Azure.Containers.ContainerRegistry /// Deleted repository. internal partial class DeleteRepositoryResult { - /// Initializes a new instance of DeleteRepositoryResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeleteRepositoryResult() { DeletedManifests = new ChangeTrackingList(); DeletedTags = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// SHA of the deleted image. + /// Tag of the deleted image. + /// Keeps track of any properties unknown to the library. + internal DeleteRepositoryResult(IReadOnlyList deletedManifests, IReadOnlyList deletedTags, Dictionary serializedAdditionalRawData) + { + DeletedManifests = deletedManifests; + DeletedTags = deletedTags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// SHA of the deleted image. public IReadOnlyList DeletedManifests { get; } /// Tag of the deleted image. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.Serialization.cs index 087a88d89bc2..932515a65887 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class FsLayer + internal partial class FsLayer : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FsLayer DeserializeFsLayer(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(BlobSum)) + { + writer.WritePropertyName("blobSum"u8); + writer.WriteStringValue(BlobSum); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FsLayer DeserializeFsLayer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional blobSum = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blobSum"u8)) @@ -26,8 +60,61 @@ internal static FsLayer DeserializeFsLayer(JsonElement element) blobSum = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FsLayer(blobSum.Value); + return new FsLayer(blobSum.Value, serializedAdditionalRawData); + } + + FsLayer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFsLayer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FsLayer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFsLayer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FsLayer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FsLayer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFsLayer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.cs index e68a7ce23057..8e5ff2f16b96 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/FsLayer.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Image layer information. internal partial class FsLayer { - /// Initializes a new instance of FsLayer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FsLayer() { } - /// Initializes a new instance of FsLayer. + /// Initializes a new instance of . /// SHA of an image layer. - internal FsLayer(string blobSum) + /// Keeps track of any properties unknown to the library. + internal FsLayer(string blobSum, Dictionary serializedAdditionalRawData) { BlobSum = blobSum; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// SHA of an image layer. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.Serialization.cs index 1e6f5b9f2626..a596356092f6 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class History + internal partial class History : IUtf8JsonSerializable, IModelJsonSerializable { - internal static History DeserializeHistory(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(V1Compatibility)) + { + writer.WritePropertyName("v1Compatibility"u8); + writer.WriteStringValue(V1Compatibility); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static History DeserializeHistory(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional v1Compatibility = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("v1Compatibility"u8)) @@ -26,8 +60,61 @@ internal static History DeserializeHistory(JsonElement element) v1Compatibility = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new History(v1Compatibility.Value); + return new History(v1Compatibility.Value, serializedAdditionalRawData); + } + + History IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHistory(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + History IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHistory(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(History model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator History(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHistory(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.cs index 85dc513a2c83..8327642ecfe6 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/History.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// A list of unstructured historical data for v1 compatibility. internal partial class History { - /// Initializes a new instance of History. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal History() { } - /// Initializes a new instance of History. + /// Initializes a new instance of . /// The raw v1 compatibility information. - internal History(string v1Compatibility) + /// Keeps track of any properties unknown to the library. + internal History(string v1Compatibility, Dictionary serializedAdditionalRawData) { V1Compatibility = v1Compatibility; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The raw v1 compatibility information. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.Serialization.cs index 77b00ba0ac2c..706982b0f52d 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.Serialization.cs @@ -5,15 +5,65 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class ImageSignature + internal partial class ImageSignature : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ImageSignature DeserializeImageSignature(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Header)) + { + writer.WritePropertyName("header"u8); + if (Header is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Header).Serialize(writer, options); + } + } + if (Optional.IsDefined(Signature)) + { + writer.WritePropertyName("signature"u8); + writer.WriteStringValue(Signature); + } + if (Optional.IsDefined(Protected)) + { + writer.WritePropertyName("protected"u8); + writer.WriteStringValue(Protected); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ImageSignature DeserializeImageSignature(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +71,7 @@ internal static ImageSignature DeserializeImageSignature(JsonElement element) Optional header = default; Optional signature = default; Optional @protected = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("header"u8)) @@ -42,8 +93,61 @@ internal static ImageSignature DeserializeImageSignature(JsonElement element) @protected = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ImageSignature(header.Value, signature.Value, @protected.Value); + return new ImageSignature(header.Value, signature.Value, @protected.Value, serializedAdditionalRawData); + } + + ImageSignature IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageSignature(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageSignature IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageSignature(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageSignature model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageSignature(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageSignature(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.cs index 923b68e06acf..7e710e912273 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ImageSignature.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Signature of a signed manifest. internal partial class ImageSignature { - /// Initializes a new instance of ImageSignature. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ImageSignature() { } - /// Initializes a new instance of ImageSignature. + /// Initializes a new instance of . /// A JSON web signature. /// A signature for the image manifest, signed by a libtrust private key. /// The signed protected header. - internal ImageSignature(JWK header, string signature, string @protected) + /// Keeps track of any properties unknown to the library. + internal ImageSignature(JWK header, string signature, string @protected, Dictionary serializedAdditionalRawData) { Header = header; Signature = signature; Protected = @protected; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A JSON web signature. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.Serialization.cs index a85728268706..32abd136ed2a 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class JWK + internal partial class JWK : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JWK DeserializeJWK(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Jwk)) + { + writer.WritePropertyName("jwk"u8); + if (Jwk is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Jwk).Serialize(writer, options); + } + } + if (Optional.IsDefined(Alg)) + { + writer.WritePropertyName("alg"u8); + writer.WriteStringValue(Alg); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JWK DeserializeJWK(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional jwk = default; Optional alg = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jwk"u8)) @@ -36,8 +82,61 @@ internal static JWK DeserializeJWK(JsonElement element) alg = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new JWK(jwk.Value, alg.Value); + return new JWK(jwk.Value, alg.Value, serializedAdditionalRawData); + } + + JWK IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJWK(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JWK IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJWK(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JWK model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JWK(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJWK(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.cs index f0b30848f12f..155d1fd66798 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWK.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// A JSON web signature. internal partial class JWK { - /// Initializes a new instance of JWK. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal JWK() { } - /// Initializes a new instance of JWK. + /// Initializes a new instance of . /// JSON web key parameter. /// The algorithm used to sign or encrypt the JWT. - internal JWK(JWKHeader jwk, string alg) + /// Keeps track of any properties unknown to the library. + internal JWK(JWKHeader jwk, string alg, Dictionary serializedAdditionalRawData) { Jwk = jwk; Alg = alg; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// JSON web key parameter. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.Serialization.cs index 0b248fbd8169..48f61dc43c8b 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class JWKHeader + internal partial class JWKHeader : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JWKHeader DeserializeJWKHeader(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Crv)) + { + writer.WritePropertyName("crv"u8); + writer.WriteStringValue(Crv); + } + if (Optional.IsDefined(Kid)) + { + writer.WritePropertyName("kid"u8); + writer.WriteStringValue(Kid); + } + if (Optional.IsDefined(Kty)) + { + writer.WritePropertyName("kty"u8); + writer.WriteStringValue(Kty); + } + if (Optional.IsDefined(X)) + { + writer.WritePropertyName("x"u8); + writer.WriteStringValue(X); + } + if (Optional.IsDefined(Y)) + { + writer.WritePropertyName("y"u8); + writer.WriteStringValue(Y); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JWKHeader DeserializeJWKHeader(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static JWKHeader DeserializeJWKHeader(JsonElement element) Optional kty = default; Optional x = default; Optional y = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("crv"u8)) @@ -50,8 +104,61 @@ internal static JWKHeader DeserializeJWKHeader(JsonElement element) y = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new JWKHeader(crv.Value, kid.Value, kty.Value, x.Value, y.Value); + return new JWKHeader(crv.Value, kid.Value, kty.Value, x.Value, y.Value, serializedAdditionalRawData); + } + + JWKHeader IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJWKHeader(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JWKHeader IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJWKHeader(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JWKHeader model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JWKHeader(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJWKHeader(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.cs index 8c15893b2315..0a2866ba9a02 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/JWKHeader.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// JSON web key parameter. internal partial class JWKHeader { - /// Initializes a new instance of JWKHeader. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal JWKHeader() { } - /// Initializes a new instance of JWKHeader. + /// Initializes a new instance of . /// crv value. /// kid value. /// kty value. /// x value. /// y value. - internal JWKHeader(string crv, string kid, string kty, string x, string y) + /// Keeps track of any properties unknown to the library. + internal JWKHeader(string crv, string kid, string kty, string x, string y, Dictionary serializedAdditionalRawData) { Crv = crv; Kid = kid; Kty = kty; X = x; Y = y; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// crv value. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.Serialization.cs index daa72f70964b..11893f35e256 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class Manifest + internal partial class Manifest : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Manifest DeserializeManifest(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(SchemaVersion)) + { + writer.WritePropertyName("schemaVersion"u8); + writer.WriteNumberValue(SchemaVersion.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Manifest DeserializeManifest(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schemaVersion"u8)) @@ -30,8 +64,61 @@ internal static Manifest DeserializeManifest(JsonElement element) schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Manifest(Optional.ToNullable(schemaVersion)); + return new Manifest(Optional.ToNullable(schemaVersion), serializedAdditionalRawData); + } + + Manifest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManifest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Manifest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManifest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Manifest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Manifest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManifest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.cs index fd7049cef26b..83d8f9516c97 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Manifest.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Returns the requested manifest file. internal partial class Manifest { - /// Initializes a new instance of Manifest. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Manifest() { } - /// Initializes a new instance of Manifest. + /// Initializes a new instance of . /// Schema version. - internal Manifest(int? schemaVersion) + /// Keeps track of any properties unknown to the library. + internal Manifest(int? schemaVersion, Dictionary serializedAdditionalRawData) { SchemaVersion = schemaVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Schema version. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.Serialization.cs index d27e9d786c18..c05358f8d2e3 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.Serialization.cs @@ -8,14 +8,63 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class ManifestAttributesBase + internal partial class ManifestAttributesBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManifestAttributesBase DeserializeManifestAttributesBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("changeableAttributes"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CanDelete)) + { + writer.WritePropertyName("deleteEnabled"u8); + writer.WriteBooleanValue(CanDelete.Value); + } + if (Optional.IsDefined(CanWrite)) + { + writer.WritePropertyName("writeEnabled"u8); + writer.WriteBooleanValue(CanWrite.Value); + } + if (Optional.IsDefined(CanList)) + { + writer.WritePropertyName("listEnabled"u8); + writer.WriteBooleanValue(CanList.Value); + } + if (Optional.IsDefined(CanRead)) + { + writer.WritePropertyName("readEnabled"u8); + writer.WriteBooleanValue(CanRead.Value); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManifestAttributesBase DeserializeManifestAttributesBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +81,7 @@ internal static ManifestAttributesBase DeserializeManifestAttributesBase(JsonEle Optional writeEnabled = default; Optional listEnabled = default; Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("digest"u8)) @@ -154,8 +204,61 @@ internal static ManifestAttributesBase DeserializeManifestAttributesBase(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManifestAttributesBase(digest, Optional.ToNullable(imageSize), createdTime, lastUpdateTime, Optional.ToNullable(architecture), Optional.ToNullable(os), Optional.ToList(references), Optional.ToList(tags), Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled)); + return new ManifestAttributesBase(digest, Optional.ToNullable(imageSize), createdTime, lastUpdateTime, Optional.ToNullable(architecture), Optional.ToNullable(os), Optional.ToList(references), Optional.ToList(tags), Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + ManifestAttributesBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManifestAttributesBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManifestAttributesBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManifestAttributesBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManifestAttributesBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManifestAttributesBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManifestAttributesBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.cs index 70546754e9e1..d5ef0af3758d 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesBase.cs @@ -14,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// Manifest details. internal partial class ManifestAttributesBase { - /// Initializes a new instance of ManifestAttributesBase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Manifest. /// Created time. /// Last update time. @@ -30,7 +33,7 @@ internal ManifestAttributesBase(string digest, DateTimeOffset createdOn, DateTim Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ManifestAttributesBase. + /// Initializes a new instance of . /// Manifest. /// Image size. /// Created time. @@ -43,7 +46,8 @@ internal ManifestAttributesBase(string digest, DateTimeOffset createdOn, DateTim /// Write enabled. /// List enabled. /// Read enabled. - internal ManifestAttributesBase(string digest, long? size, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ArtifactArchitecture? architecture, ArtifactOperatingSystem? operatingSystem, IReadOnlyList relatedArtifacts, IReadOnlyList tags, bool? canDelete, bool? canWrite, bool? canList, bool? canRead) + /// Keeps track of any properties unknown to the library. + internal ManifestAttributesBase(string digest, long? size, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, ArtifactArchitecture? architecture, ArtifactOperatingSystem? operatingSystem, IReadOnlyList relatedArtifacts, IReadOnlyList tags, bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) { Digest = digest; Size = size; @@ -57,6 +61,12 @@ internal ManifestAttributesBase(string digest, long? size, DateTimeOffset create CanWrite = canWrite; CanList = canList; CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManifestAttributesBase() + { } /// Manifest. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesManifest.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesManifest.cs index a440cfe1173b..20650855a067 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesManifest.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestAttributesManifest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.Containers.ContainerRegistry /// List of manifest attributes. internal partial class ManifestAttributesManifest { - /// Initializes a new instance of ManifestAttributesManifest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManifestAttributesManifest() { References = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// List of manifest attributes details. + /// Keeps track of any properties unknown to the library. + internal ManifestAttributesManifest(IReadOnlyList references, Dictionary serializedAdditionalRawData) + { + References = references; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// List of manifest attributes details. public IReadOnlyList References { get; } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.Serialization.cs index 94bb14e02a3a..51c920ed7b32 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class ManifestList + internal partial class ManifestList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManifestList DeserializeManifestList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(MediaType)) + { + writer.WritePropertyName("mediaType"u8); + writer.WriteStringValue(MediaType); + } + if (Optional.IsCollectionDefined(Manifests)) + { + writer.WritePropertyName("manifests"u8); + writer.WriteStartArray(); + foreach (var item in Manifests) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SchemaVersion)) + { + writer.WritePropertyName("schemaVersion"u8); + writer.WriteNumberValue(SchemaVersion.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManifestList DeserializeManifestList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static ManifestList DeserializeManifestList(JsonElement element) Optional mediaType = default; Optional> manifests = default; Optional schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaType"u8)) @@ -52,8 +107,61 @@ internal static ManifestList DeserializeManifestList(JsonElement element) schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManifestList(Optional.ToNullable(schemaVersion), mediaType.Value, Optional.ToList(manifests)); + return new ManifestList(Optional.ToNullable(schemaVersion), mediaType.Value, Optional.ToList(manifests), serializedAdditionalRawData); + } + + ManifestList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManifestList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManifestList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManifestList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManifestList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManifestList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManifestList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.cs index 6228c3e4a899..92535dfb2a5f 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,18 @@ namespace Azure.Containers.ContainerRegistry /// Returns the requested Docker multi-arch-manifest file. internal partial class ManifestList : Manifest { - /// Initializes a new instance of ManifestList. + /// Initializes a new instance of . internal ManifestList() { Manifests = new ChangeTrackingList(); } - /// Initializes a new instance of ManifestList. + /// Initializes a new instance of . /// Schema version. /// Media type for this Manifest. /// List of V2 image layer information. - internal ManifestList(int? schemaVersion, string mediaType, IReadOnlyList manifests) : base(schemaVersion) + /// Keeps track of any properties unknown to the library. + internal ManifestList(int? schemaVersion, string mediaType, IReadOnlyList manifests, Dictionary serializedAdditionalRawData) : base(schemaVersion, serializedAdditionalRawData) { MediaType = mediaType; Manifests = manifests; diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.Serialization.cs index 2e74002192bb..1bb5cef42650 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.Serialization.cs @@ -5,15 +5,70 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class ManifestListAttributes + internal partial class ManifestListAttributes : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManifestListAttributes DeserializeManifestListAttributes(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(MediaType)) + { + writer.WritePropertyName("mediaType"u8); + writer.WriteStringValue(MediaType); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Digest)) + { + writer.WritePropertyName("digest"u8); + writer.WriteStringValue(Digest); + } + if (Optional.IsDefined(Platform)) + { + writer.WritePropertyName("platform"u8); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManifestListAttributes DeserializeManifestListAttributes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +77,7 @@ internal static ManifestListAttributes DeserializeManifestListAttributes(JsonEle Optional size = default; Optional digest = default; Optional platform = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaType"u8)) @@ -52,8 +108,61 @@ internal static ManifestListAttributes DeserializeManifestListAttributes(JsonEle platform = Platform.DeserializePlatform(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManifestListAttributes(mediaType.Value, Optional.ToNullable(size), digest.Value, platform.Value); + return new ManifestListAttributes(mediaType.Value, Optional.ToNullable(size), digest.Value, platform.Value, serializedAdditionalRawData); + } + + ManifestListAttributes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManifestListAttributes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManifestListAttributes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManifestListAttributes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManifestListAttributes model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManifestListAttributes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManifestListAttributes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.cs index 4c56d72504b2..aa5edd478b94 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestListAttributes.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// The ManifestListAttributes. internal partial class ManifestListAttributes { - /// Initializes a new instance of ManifestListAttributes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManifestListAttributes() { } - /// Initializes a new instance of ManifestListAttributes. + /// Initializes a new instance of . /// The MIME type of the referenced object. This will generally be application/vnd.docker.image.manifest.v2+json, but it could also be application/vnd.docker.image.manifest.v1+json. /// The size in bytes of the object. /// The digest of the content, as defined by the Registry V2 HTTP API Specification. /// The platform object describes the platform which the image in the manifest runs on. A full list of valid operating system and architecture values are listed in the Go language documentation for $GOOS and $GOARCH. - internal ManifestListAttributes(string mediaType, long? size, string digest, Platform platform) + /// Keeps track of any properties unknown to the library. + internal ManifestListAttributes(string mediaType, long? size, string digest, Platform platform, Dictionary serializedAdditionalRawData) { MediaType = mediaType; Size = size; Digest = digest; Platform = platform; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The MIME type of the referenced object. This will generally be application/vnd.docker.image.manifest.v2+json, but it could also be application/vnd.docker.image.manifest.v1+json. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.Serialization.cs index f06031b5c10b..34d95454bbec 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.Serialization.cs @@ -5,16 +5,184 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class ManifestWrapper + internal partial class ManifestWrapper : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManifestWrapper DeserializeManifestWrapper(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(MediaType)) + { + writer.WritePropertyName("mediaType"u8); + writer.WriteStringValue(MediaType); + } + if (Optional.IsCollectionDefined(Manifests)) + { + writer.WritePropertyName("manifests"u8); + writer.WriteStartArray(); + foreach (var item in Manifests) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); + if (Config is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Config).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Layers)) + { + writer.WritePropertyName("layers"u8); + writer.WriteStartArray(); + foreach (var item in Layers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Annotations)) + { + if (Annotations != null) + { + writer.WritePropertyName("annotations"u8); + if (Annotations is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Annotations).Serialize(writer, options); + } + } + else + { + writer.WriteNull("annotations"); + } + } + if (Optional.IsDefined(Architecture)) + { + writer.WritePropertyName("architecture"u8); + writer.WriteStringValue(Architecture); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Tag)) + { + writer.WritePropertyName("tag"u8); + writer.WriteStringValue(Tag); + } + if (Optional.IsCollectionDefined(FsLayers)) + { + writer.WritePropertyName("fsLayers"u8); + writer.WriteStartArray(); + foreach (var item in FsLayers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(History)) + { + writer.WritePropertyName("history"u8); + writer.WriteStartArray(); + foreach (var item in History) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Signatures)) + { + writer.WritePropertyName("signatures"u8); + writer.WriteStartArray(); + foreach (var item in Signatures) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SchemaVersion)) + { + writer.WritePropertyName("schemaVersion"u8); + writer.WriteNumberValue(SchemaVersion.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManifestWrapper DeserializeManifestWrapper(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +199,7 @@ internal static ManifestWrapper DeserializeManifestWrapper(JsonElement element) Optional> history = default; Optional> signatures = default; Optional schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaType"u8)) @@ -151,8 +320,61 @@ internal static ManifestWrapper DeserializeManifestWrapper(JsonElement element) schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManifestWrapper(Optional.ToNullable(schemaVersion), mediaType.Value, Optional.ToList(manifests), config.Value, Optional.ToList(layers), annotations.Value, architecture.Value, name.Value, tag.Value, Optional.ToList(fsLayers), Optional.ToList(history), Optional.ToList(signatures)); + return new ManifestWrapper(Optional.ToNullable(schemaVersion), mediaType.Value, Optional.ToList(manifests), config.Value, Optional.ToList(layers), annotations.Value, architecture.Value, name.Value, tag.Value, Optional.ToList(fsLayers), Optional.ToList(history), Optional.ToList(signatures), serializedAdditionalRawData); + } + + ManifestWrapper IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManifestWrapper(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManifestWrapper IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManifestWrapper(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManifestWrapper model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManifestWrapper(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManifestWrapper(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.cs index dc16eae1a24f..86e5971c0c98 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWrapper.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,7 @@ namespace Azure.Containers.ContainerRegistry /// Returns the requested manifest file. internal partial class ManifestWrapper : Manifest { - /// Initializes a new instance of ManifestWrapper. + /// Initializes a new instance of . internal ManifestWrapper() { Manifests = new ChangeTrackingList(); @@ -23,7 +24,7 @@ internal ManifestWrapper() Signatures = new ChangeTrackingList(); } - /// Initializes a new instance of ManifestWrapper. + /// Initializes a new instance of . /// Schema version. /// Media type for this Manifest. /// (ManifestList, OCIIndex) List of V2 image layer information. @@ -36,7 +37,8 @@ internal ManifestWrapper() /// (V1) List of layer information. /// (V1) Image history. /// (V1) Image signature. - internal ManifestWrapper(int? schemaVersion, string mediaType, IReadOnlyList manifests, OciDescriptor config, IReadOnlyList layers, OciAnnotations annotations, string architecture, string name, string tag, IReadOnlyList fsLayers, IReadOnlyList history, IReadOnlyList signatures) : base(schemaVersion) + /// Keeps track of any properties unknown to the library. + internal ManifestWrapper(int? schemaVersion, string mediaType, IReadOnlyList manifests, OciDescriptor config, IReadOnlyList layers, OciAnnotations annotations, string architecture, string name, string tag, IReadOnlyList fsLayers, IReadOnlyList history, IReadOnlyList signatures, Dictionary serializedAdditionalRawData) : base(schemaVersion, serializedAdditionalRawData) { MediaType = mediaType; Manifests = manifests; diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.Serialization.cs index e9b2344d249f..339da71aca22 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class ManifestWriteableProperties : IUtf8JsonSerializable + internal partial class ManifestWriteableProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CanDelete)) { @@ -35,7 +43,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readEnabled"u8); writer.WriteBooleanValue(CanRead.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ManifestWriteableProperties DeserializeManifestWriteableProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deleteEnabled = default; + Optional writeEnabled = default; + Optional listEnabled = default; + Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("writeEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("listEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + listEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("readEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManifestWriteableProperties(Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + ManifestWriteableProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManifestWriteableProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManifestWriteableProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManifestWriteableProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManifestWriteableProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManifestWriteableProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManifestWriteableProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.cs index 986b0bc6d8aa..d50004f42f3f 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/ManifestWriteableProperties.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Changeable attributes. internal partial class ManifestWriteableProperties { - /// Initializes a new instance of ManifestWriteableProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManifestWriteableProperties() { } + /// Initializes a new instance of . + /// Delete enabled. + /// Write enabled. + /// List enabled. + /// Read enabled. + /// Keeps track of any properties unknown to the library. + internal ManifestWriteableProperties(bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) + { + CanDelete = canDelete; + CanWrite = canWrite; + CanList = canList; + CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Delete enabled. public bool? CanDelete { get; set; } /// Write enabled. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.Serialization.cs index 60a2712326c9..dbf294a0176e 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.Serialization.cs @@ -5,16 +5,84 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class OCIIndex + internal partial class OCIIndex : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OCIIndex DeserializeOCIIndex(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Manifests)) + { + writer.WritePropertyName("manifests"u8); + writer.WriteStartArray(); + foreach (var item in Manifests) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Annotations)) + { + if (Annotations != null) + { + writer.WritePropertyName("annotations"u8); + if (Annotations is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Annotations).Serialize(writer, options); + } + } + else + { + writer.WriteNull("annotations"); + } + } + if (Optional.IsDefined(SchemaVersion)) + { + writer.WritePropertyName("schemaVersion"u8); + writer.WriteNumberValue(SchemaVersion.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OCIIndex DeserializeOCIIndex(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +90,7 @@ internal static OCIIndex DeserializeOCIIndex(JsonElement element) Optional> manifests = default; Optional annotations = default; Optional schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("manifests"u8)) @@ -57,8 +126,61 @@ internal static OCIIndex DeserializeOCIIndex(JsonElement element) schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OCIIndex(Optional.ToNullable(schemaVersion), Optional.ToList(manifests), annotations.Value); + return new OCIIndex(Optional.ToNullable(schemaVersion), Optional.ToList(manifests), annotations.Value, serializedAdditionalRawData); + } + + OCIIndex IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOCIIndex(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OCIIndex IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOCIIndex(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OCIIndex model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OCIIndex(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOCIIndex(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.cs index 10352eb5f4b8..b168e365bd97 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OCIIndex.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,18 @@ namespace Azure.Containers.ContainerRegistry /// Returns the requested OCI index file. internal partial class OCIIndex : Manifest { - /// Initializes a new instance of OCIIndex. + /// Initializes a new instance of . internal OCIIndex() { Manifests = new ChangeTrackingList(); } - /// Initializes a new instance of OCIIndex. + /// Initializes a new instance of . /// Schema version. /// List of OCI image layer information. /// Additional information provided through arbitrary metadata. - internal OCIIndex(int? schemaVersion, IReadOnlyList manifests, OciAnnotations annotations) : base(schemaVersion) + /// Keeps track of any properties unknown to the library. + internal OCIIndex(int? schemaVersion, IReadOnlyList manifests, OciAnnotations annotations, Dictionary serializedAdditionalRawData) : base(schemaVersion, serializedAdditionalRawData) { Manifests = manifests; Annotations = annotations; diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.Serialization.cs index ee2b5b3d86c5..31762708eba2 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - public partial class OciAnnotations : IUtf8JsonSerializable + public partial class OciAnnotations : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CreatedOn)) { @@ -85,8 +91,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OciAnnotations DeserializeOciAnnotations(JsonElement element) + internal static OciAnnotations DeserializeOciAnnotations(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -188,5 +196,53 @@ internal static OciAnnotations DeserializeOciAnnotations(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OciAnnotations(Optional.ToNullable(orgOpencontainersImageCreated), orgOpencontainersImageAuthors.Value, orgOpencontainersImageUrl.Value, orgOpencontainersImageDocumentation.Value, orgOpencontainersImageSource.Value, orgOpencontainersImageVersion.Value, orgOpencontainersImageRevision.Value, orgOpencontainersImageVendor.Value, orgOpencontainersImageLicenses.Value, orgOpencontainersImageRefName.Value, orgOpencontainersImageTitle.Value, orgOpencontainersImageDescription.Value, additionalProperties); } + + OciAnnotations IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOciAnnotations(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OciAnnotations IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOciAnnotations(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OciAnnotations model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OciAnnotations(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOciAnnotations(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.cs index 11de35ce84c0..d54025a5386c 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciAnnotations.cs @@ -14,13 +14,13 @@ namespace Azure.Containers.ContainerRegistry /// Additional information provided through arbitrary metadata. public partial class OciAnnotations { - /// Initializes a new instance of OciAnnotations. + /// Initializes a new instance of . public OciAnnotations() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of OciAnnotations. + /// Initializes a new instance of . /// Date and time on which the image was built (string, date-time as defined by https://tools.ietf.org/html/rfc3339#section-5.6). /// Contact details of the people or organization responsible for the image. /// URL to find more information on the image. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.Serialization.cs index 9e683233a53c..06293b63c144 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - public partial class OciDescriptor : IUtf8JsonSerializable + public partial class OciDescriptor : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MediaType)) { @@ -52,18 +58,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Annotations != null) { writer.WritePropertyName("annotations"u8); - writer.WriteObjectValue(Annotations); + if (Annotations is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Annotations).Serialize(writer, options); + } } else { writer.WriteNull("annotations"); } } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OciDescriptor DeserializeOciDescriptor(JsonElement element) + internal static OciDescriptor DeserializeOciDescriptor(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +100,7 @@ internal static OciDescriptor DeserializeOciDescriptor(JsonElement element) Optional digest = default; Optional> urls = default; Optional annotations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaType"u8)) @@ -125,8 +153,61 @@ internal static OciDescriptor DeserializeOciDescriptor(JsonElement element) annotations = OciAnnotations.DeserializeOciAnnotations(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OciDescriptor(mediaType.Value, Optional.ToNullable(size), digest.Value, Optional.ToList(urls), annotations.Value); + return new OciDescriptor(mediaType.Value, Optional.ToNullable(size), digest.Value, Optional.ToList(urls), annotations.Value, serializedAdditionalRawData); + } + + OciDescriptor IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOciDescriptor(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OciDescriptor IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOciDescriptor(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OciDescriptor model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OciDescriptor(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOciDescriptor(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.cs index e27fb46b6aec..3b19f277e83a 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciDescriptor.cs @@ -14,25 +14,30 @@ namespace Azure.Containers.ContainerRegistry /// Docker V2 image layer descriptor including config and layers. public partial class OciDescriptor { - /// Initializes a new instance of OciDescriptor. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OciDescriptor() { Urls = new ChangeTrackingList(); } - /// Initializes a new instance of OciDescriptor. + /// Initializes a new instance of . /// Layer media type. /// Layer size. /// Layer digest. /// Specifies a list of URIs from which this object may be downloaded. /// Additional information provided through arbitrary metadata. - internal OciDescriptor(string mediaType, long? sizeInBytes, string digest, IList urls, OciAnnotations annotations) + /// Keeps track of any properties unknown to the library. + internal OciDescriptor(string mediaType, long? sizeInBytes, string digest, IList urls, OciAnnotations annotations, Dictionary serializedAdditionalRawData) { MediaType = mediaType; SizeInBytes = sizeInBytes; Digest = digest; Urls = urls; Annotations = annotations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Layer media type. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.Serialization.cs index 4912f7aad6c0..653675c8d7f4 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.Serialization.cs @@ -9,20 +9,33 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { [JsonConverter(typeof(OciImageManifestConverter))] - public partial class OciImageManifest : IUtf8JsonSerializable + public partial class OciImageManifest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("config"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Layers)) { @@ -30,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Layers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,7 +59,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Annotations != null) { writer.WritePropertyName("annotations"u8); - writer.WriteObjectValue(Annotations); + if (Annotations is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Annotations).Serialize(writer, options); + } } else { @@ -48,11 +75,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("schemaVersion"u8); writer.WriteNumberValue(SchemaVersion); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OciImageManifest DeserializeOciImageManifest(JsonElement element) + internal static OciImageManifest DeserializeOciImageManifest(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +102,7 @@ internal static OciImageManifest DeserializeOciImageManifest(JsonElement element Optional> layers = default; Optional annotations = default; int schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("config"u8)) @@ -101,8 +143,61 @@ internal static OciImageManifest DeserializeOciImageManifest(JsonElement element schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OciImageManifest(config.Value, Optional.ToList(layers), annotations.Value, schemaVersion); + return new OciImageManifest(config.Value, Optional.ToList(layers), annotations.Value, schemaVersion, serializedAdditionalRawData); + } + + OciImageManifest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOciImageManifest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OciImageManifest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOciImageManifest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OciImageManifest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OciImageManifest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOciImageManifest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class OciImageManifestConverter : JsonConverter diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.cs index 71dbfe26d8b1..8e0d5d850182 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/OciImageManifest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// Returns the requested OCI Manifest file. public partial class OciImageManifest { - /// Initializes a new instance of OciImageManifest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Schema version. public OciImageManifest(int schemaVersion) { @@ -21,17 +25,24 @@ public OciImageManifest(int schemaVersion) SchemaVersion = schemaVersion; } - /// Initializes a new instance of OciImageManifest. + /// Initializes a new instance of . /// V2 image config descriptor. /// List of V2 image layer information. /// Additional information provided through arbitrary metadata. /// Schema version. - internal OciImageManifest(OciDescriptor configuration, IList layers, OciAnnotations annotations, int schemaVersion) + /// Keeps track of any properties unknown to the library. + internal OciImageManifest(OciDescriptor configuration, IList layers, OciAnnotations annotations, int schemaVersion, Dictionary serializedAdditionalRawData) { Configuration = configuration; Layers = layers; Annotations = annotations; SchemaVersion = schemaVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OciImageManifest() + { } /// V2 image config descriptor. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs index c1f2b82e0990..c62570183366 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Containers.ContainerRegistry @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// The Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema. internal partial class Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema { - /// Initializes a new instance of Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Can take a value of access_token_refresh_token, or access_token, or refresh_token. /// Indicates the name of your Azure container registry. /// is null. @@ -25,6 +29,28 @@ internal Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrle Service = service; } + /// Initializes a new instance of . + /// Can take a value of access_token_refresh_token, or access_token, or refresh_token. + /// Indicates the name of your Azure container registry. + /// AAD tenant associated to the AAD credentials. + /// AAD refresh token, mandatory when grant_type is access_token_refresh_token or refresh_token. + /// AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. + /// Keeps track of any properties unknown to the library. + internal Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema(PostContentSchemaGrantType grantType, string service, string tenant, string refreshToken, string aadAccessToken, Dictionary serializedAdditionalRawData) + { + GrantType = grantType; + Service = service; + Tenant = tenant; + RefreshToken = refreshToken; + AadAccessToken = aadAccessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Paths108HwamOauth2ExchangePostRequestbodyContentApplicationXWwwFormUrlencodedSchema() + { + } + /// Can take a value of access_token_refresh_token, or access_token, or refresh_token. public PostContentSchemaGrantType GrantType { get; } /// Indicates the name of your Azure container registry. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs index 0c8511214558..c05877fcff00 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Containers.ContainerRegistry @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// The PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. internal partial class PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema { - /// Initializes a new instance of PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicates the name of your Azure container registry. /// Which is expected to be a valid scope, and can be specified more than once for multiple scope requests. You obtained this from the Www-Authenticate response header from the challenge. /// Must be a valid ACR refresh token. @@ -31,6 +35,26 @@ internal PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencod GrantType = grantType; } + /// Initializes a new instance of . + /// Indicates the name of your Azure container registry. + /// Which is expected to be a valid scope, and can be specified more than once for multiple scope requests. You obtained this from the Www-Authenticate response header from the challenge. + /// Must be a valid ACR refresh token. + /// Grant type is expected to be refresh_token. + /// Keeps track of any properties unknown to the library. + internal PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema(string service, string scope, string acrRefreshToken, TokenGrantType grantType, Dictionary serializedAdditionalRawData) + { + Service = service; + Scope = scope; + AcrRefreshToken = acrRefreshToken; + GrantType = grantType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PathsV3R3RxOauth2TokenPostRequestbodyContentApplicationXWwwFormUrlencodedSchema() + { + } + /// Indicates the name of your Azure container registry. public string Service { get; } /// Which is expected to be a valid scope, and can be specified more than once for multiple scope requests. You obtained this from the Www-Authenticate response header from the challenge. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.Serialization.cs index e9cb154f2bb7..92b969b04e54 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.Serialization.cs @@ -5,16 +5,83 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class Platform + internal partial class Platform : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Platform DeserializePlatform(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Architecture)) + { + writer.WritePropertyName("architecture"u8); + writer.WriteStringValue(Architecture); + } + if (Optional.IsDefined(Os)) + { + writer.WritePropertyName("os"u8); + writer.WriteStringValue(Os); + } + if (Optional.IsDefined(OsVersion)) + { + writer.WritePropertyName("os.version"u8); + writer.WriteStringValue(OsVersion); + } + if (Optional.IsCollectionDefined(OsFeatures)) + { + writer.WritePropertyName("os.features"u8); + writer.WriteStartArray(); + foreach (var item in OsFeatures) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Variant)) + { + writer.WritePropertyName("variant"u8); + writer.WriteStringValue(Variant); + } + if (Optional.IsCollectionDefined(Features)) + { + writer.WritePropertyName("features"u8); + writer.WriteStartArray(); + foreach (var item in Features) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Platform DeserializePlatform(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +92,7 @@ internal static Platform DeserializePlatform(JsonElement element) Optional> osFeatures = default; Optional variant = default; Optional> features = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("architecture"u8)) @@ -75,8 +143,61 @@ internal static Platform DeserializePlatform(JsonElement element) features = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Platform(architecture.Value, os.Value, osVersion.Value, Optional.ToList(osFeatures), variant.Value, Optional.ToList(features)); + return new Platform(architecture.Value, os.Value, osVersion.Value, Optional.ToList(osFeatures), variant.Value, Optional.ToList(features), serializedAdditionalRawData); + } + + Platform IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePlatform(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Platform IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePlatform(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Platform model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Platform(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePlatform(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.cs index 4aadf41587fa..29bbf9f42687 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Platform.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,25 @@ namespace Azure.Containers.ContainerRegistry /// The platform object describes the platform which the image in the manifest runs on. A full list of valid operating system and architecture values are listed in the Go language documentation for $GOOS and $GOARCH. internal partial class Platform { - /// Initializes a new instance of Platform. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Platform() { OsFeatures = new ChangeTrackingList(); Features = new ChangeTrackingList(); } - /// Initializes a new instance of Platform. + /// Initializes a new instance of . /// Specifies the CPU architecture, for example amd64 or ppc64le. /// The os field specifies the operating system, for example linux or windows. /// The optional os.version field specifies the operating system version, for example 10.0.10586. /// The optional os.features field specifies an array of strings, each listing a required OS feature (for example on Windows win32k. /// The optional variant field specifies a variant of the CPU, for example armv6l to specify a particular CPU variant of the ARM CPU. /// The optional features field specifies an array of strings, each listing a required CPU feature (for example sse4 or aes. - internal Platform(string architecture, string os, string osVersion, IReadOnlyList osFeatures, string variant, IReadOnlyList features) + /// Keeps track of any properties unknown to the library. + internal Platform(string architecture, string os, string osVersion, IReadOnlyList osFeatures, string variant, IReadOnlyList features, Dictionary serializedAdditionalRawData) { Architecture = architecture; Os = os; @@ -35,6 +40,7 @@ internal Platform(string architecture, string os, string osVersion, IReadOnlyLis OsFeatures = osFeatures; Variant = variant; Features = features; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the CPU architecture, for example amd64 or ppc64le. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.Serialization.cs index 98f20d669d72..3ece336b515b 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.Serialization.cs @@ -5,22 +5,65 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class Repositories + internal partial class Repositories : IUtf8JsonSerializable, IModelJsonSerializable { - internal static Repositories DeserializeRepositories(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(RepositoriesValue)) + { + writer.WritePropertyName("repositories"u8); + writer.WriteStartArray(); + foreach (var item in RepositoriesValue) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Link)) + { + writer.WritePropertyName("link"u8); + writer.WriteStringValue(Link); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static Repositories DeserializeRepositories(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> repositories = default; Optional link = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("repositories"u8)) @@ -42,8 +85,61 @@ internal static Repositories DeserializeRepositories(JsonElement element) link = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new Repositories(Optional.ToList(repositories), link.Value); + return new Repositories(Optional.ToList(repositories), link.Value, serializedAdditionalRawData); + } + + Repositories IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRepositories(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Repositories IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRepositories(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Repositories model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Repositories(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRepositories(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.cs index ced193fa3e54..839c3e15ebda 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/Repositories.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.Containers.ContainerRegistry /// List of repositories. internal partial class Repositories { - /// Initializes a new instance of Repositories. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal Repositories() { RepositoriesValue = new ChangeTrackingList(); } - /// Initializes a new instance of Repositories. + /// Initializes a new instance of . /// Repository names. /// - internal Repositories(IReadOnlyList repositoriesValue, string link) + /// Keeps track of any properties unknown to the library. + internal Repositories(IReadOnlyList repositoriesValue, string link, Dictionary serializedAdditionalRawData) { RepositoriesValue = repositoriesValue; Link = link; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Repository names. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryTags.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryTags.cs index aa0b8063d158..34b3d5a4c081 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryTags.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryTags.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.Containers.ContainerRegistry /// Result of the request to list tags of the image. internal partial class RepositoryTags { - /// Initializes a new instance of RepositoryTags. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RepositoryTags() { Tags = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Name of the image. + /// List of tags. + /// Keeps track of any properties unknown to the library. + internal RepositoryTags(string name, IReadOnlyList tags, Dictionary serializedAdditionalRawData) + { + Name = name; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Name of the image. public string Name { get; } /// List of tags. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.Serialization.cs index 402cb729a7a5..246d46947491 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class RepositoryWriteableProperties : IUtf8JsonSerializable + internal partial class RepositoryWriteableProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CanDelete)) { @@ -35,7 +43,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readEnabled"u8); writer.WriteBooleanValue(CanRead.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RepositoryWriteableProperties DeserializeRepositoryWriteableProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deleteEnabled = default; + Optional writeEnabled = default; + Optional listEnabled = default; + Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("writeEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("listEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + listEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("readEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RepositoryWriteableProperties(Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + RepositoryWriteableProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRepositoryWriteableProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RepositoryWriteableProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRepositoryWriteableProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RepositoryWriteableProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RepositoryWriteableProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRepositoryWriteableProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.cs index 29c258886a4d..7111c81a9fcc 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/RepositoryWriteableProperties.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Changeable attributes for Repository. internal partial class RepositoryWriteableProperties { - /// Initializes a new instance of RepositoryWriteableProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RepositoryWriteableProperties() { } + /// Initializes a new instance of . + /// Delete enabled. + /// Write enabled. + /// List enabled. + /// Read enabled. + /// Keeps track of any properties unknown to the library. + internal RepositoryWriteableProperties(bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) + { + CanDelete = canDelete; + CanWrite = canWrite; + CanList = canList; + CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Delete enabled. public bool? CanDelete { get; set; } /// Write enabled. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.Serialization.cs index f04a55b71381..82320731e0c2 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.Serialization.cs @@ -6,15 +6,65 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class TagAttributesBase + internal partial class TagAttributesBase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("changeableAttributes"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CanDelete)) + { + writer.WritePropertyName("deleteEnabled"u8); + writer.WriteBooleanValue(CanDelete.Value); + } + if (Optional.IsDefined(CanWrite)) + { + writer.WritePropertyName("writeEnabled"u8); + writer.WriteBooleanValue(CanWrite.Value); + } + if (Optional.IsDefined(CanList)) + { + writer.WritePropertyName("listEnabled"u8); + writer.WriteBooleanValue(CanList.Value); + } + if (Optional.IsDefined(CanRead)) + { + writer.WritePropertyName("readEnabled"u8); + writer.WriteBooleanValue(CanRead.Value); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +77,7 @@ internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement eleme Optional writeEnabled = default; Optional listEnabled = default; Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -97,8 +148,61 @@ internal static TagAttributesBase DeserializeTagAttributesBase(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TagAttributesBase(name, digest, createdTime, lastUpdateTime, Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled)); + return new TagAttributesBase(name, digest, createdTime, lastUpdateTime, Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + TagAttributesBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagAttributesBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagAttributesBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagAttributesBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagAttributesBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagAttributesBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagAttributesBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.cs index 6f5c0e10561c..2f319e07de2f 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesBase.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Containers.ContainerRegistry @@ -13,7 +14,10 @@ namespace Azure.Containers.ContainerRegistry /// Tag attribute details. internal partial class TagAttributesBase { - /// Initializes a new instance of TagAttributesBase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Tag name. /// Tag digest. /// Tag created time. @@ -30,7 +34,7 @@ internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, LastUpdatedOn = lastUpdatedOn; } - /// Initializes a new instance of TagAttributesBase. + /// Initializes a new instance of . /// Tag name. /// Tag digest. /// Tag created time. @@ -39,7 +43,8 @@ internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, /// Write enabled. /// List enabled. /// Read enabled. - internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, bool? canDelete, bool? canWrite, bool? canList, bool? canRead) + /// Keeps track of any properties unknown to the library. + internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) { Name = name; Digest = digest; @@ -49,6 +54,12 @@ internal TagAttributesBase(string name, string digest, DateTimeOffset createdOn, CanWrite = canWrite; CanList = canList; CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TagAttributesBase() + { } /// Tag name. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesTag.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesTag.cs index a8541600903c..0b6f2f7a6a68 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesTag.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagAttributesTag.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Tag. internal partial class TagAttributesTag { - /// Initializes a new instance of TagAttributesTag. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TagAttributesTag() { } + /// Initializes a new instance of . + /// SignatureRecord value. + /// Keeps track of any properties unknown to the library. + internal TagAttributesTag(string signatureRecord, Dictionary serializedAdditionalRawData) + { + SignatureRecord = signatureRecord; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// SignatureRecord value. public string SignatureRecord { get; } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.Serialization.cs index c8348fc64292..3bf30c20e18d 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.Serialization.cs @@ -5,16 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class TagList + internal partial class TagList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TagList DeserializeTagList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("registry"u8); + writer.WriteStringValue(RegistryLoginServer); + writer.WritePropertyName("imageName"u8); + writer.WriteStringValue(Repository); + writer.WritePropertyName("tags"u8); + writer.WriteStartArray(); + foreach (var item in TagAttributeBases) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(Link)) + { + writer.WritePropertyName("link"u8); + writer.WriteStringValue(Link); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TagList DeserializeTagList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +73,7 @@ internal static TagList DeserializeTagList(JsonElement element) string imageName = default; IReadOnlyList tags = default; Optional link = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry"u8)) @@ -50,8 +101,61 @@ internal static TagList DeserializeTagList(JsonElement element) link = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TagList(registry, imageName, tags, link.Value); + return new TagList(registry, imageName, tags, link.Value, serializedAdditionalRawData); + } + + TagList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.cs index b9939f11f86e..e8693aac3093 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagList.cs @@ -15,7 +15,10 @@ namespace Azure.Containers.ContainerRegistry /// List of tag details. internal partial class TagList { - /// Initializes a new instance of TagList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// List of tag attribute details. @@ -31,17 +34,24 @@ internal TagList(string registryLoginServer, string repository, IEnumerable Initializes a new instance of TagList. + /// Initializes a new instance of . /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. /// Image name. /// List of tag attribute details. /// - internal TagList(string registryLoginServer, string repository, IReadOnlyList tagAttributeBases, string link) + /// Keeps track of any properties unknown to the library. + internal TagList(string registryLoginServer, string repository, IReadOnlyList tagAttributeBases, string link, Dictionary serializedAdditionalRawData) { RegistryLoginServer = registryLoginServer; Repository = repository; TagAttributeBases = tagAttributeBases; Link = link; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TagList() + { } /// Registry login server name. This is likely to be similar to {registry-name}.azurecr.io. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.Serialization.cs index 8596a8793138..349740745e81 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class TagWriteableProperties : IUtf8JsonSerializable + internal partial class TagWriteableProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CanDelete)) { @@ -35,7 +43,127 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readEnabled"u8); writer.WriteBooleanValue(CanRead.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TagWriteableProperties DeserializeTagWriteableProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deleteEnabled = default; + Optional writeEnabled = default; + Optional listEnabled = default; + Optional readEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("writeEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("listEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + listEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("readEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TagWriteableProperties(Optional.ToNullable(deleteEnabled), Optional.ToNullable(writeEnabled), Optional.ToNullable(listEnabled), Optional.ToNullable(readEnabled), serializedAdditionalRawData); + } + + TagWriteableProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTagWriteableProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TagWriteableProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTagWriteableProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TagWriteableProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TagWriteableProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTagWriteableProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.cs index b5da981619e3..0f2313d44868 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/TagWriteableProperties.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Containers.ContainerRegistry { /// Changeable attributes. internal partial class TagWriteableProperties { - /// Initializes a new instance of TagWriteableProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TagWriteableProperties() { } + /// Initializes a new instance of . + /// Delete enabled. + /// Write enabled. + /// List enabled. + /// Read enabled. + /// Keeps track of any properties unknown to the library. + internal TagWriteableProperties(bool? canDelete, bool? canWrite, bool? canList, bool? canRead, Dictionary serializedAdditionalRawData) + { + CanDelete = canDelete; + CanWrite = canWrite; + CanList = canList; + CanRead = canRead; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Delete enabled. public bool? CanDelete { get; set; } /// Write enabled. diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.Serialization.cs index 780e87305ebd..3d39d2222e39 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.Serialization.cs @@ -5,16 +5,114 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class V1Manifest + internal partial class V1Manifest : IUtf8JsonSerializable, IModelJsonSerializable { - internal static V1Manifest DeserializeV1Manifest(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Architecture)) + { + writer.WritePropertyName("architecture"u8); + writer.WriteStringValue(Architecture); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Tag)) + { + writer.WritePropertyName("tag"u8); + writer.WriteStringValue(Tag); + } + if (Optional.IsCollectionDefined(FsLayers)) + { + writer.WritePropertyName("fsLayers"u8); + writer.WriteStartArray(); + foreach (var item in FsLayers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(History)) + { + writer.WritePropertyName("history"u8); + writer.WriteStartArray(); + foreach (var item in History) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Signatures)) + { + writer.WritePropertyName("signatures"u8); + writer.WriteStartArray(); + foreach (var item in Signatures) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SchemaVersion)) + { + writer.WritePropertyName("schemaVersion"u8); + writer.WriteNumberValue(SchemaVersion.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static V1Manifest DeserializeV1Manifest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +124,7 @@ internal static V1Manifest DeserializeV1Manifest(JsonElement element) Optional> history = default; Optional> signatures = default; Optional schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("architecture"u8)) @@ -94,8 +193,61 @@ internal static V1Manifest DeserializeV1Manifest(JsonElement element) schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new V1Manifest(Optional.ToNullable(schemaVersion), architecture.Value, name.Value, tag.Value, Optional.ToList(fsLayers), Optional.ToList(history), Optional.ToList(signatures)); + return new V1Manifest(Optional.ToNullable(schemaVersion), architecture.Value, name.Value, tag.Value, Optional.ToList(fsLayers), Optional.ToList(history), Optional.ToList(signatures), serializedAdditionalRawData); + } + + V1Manifest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeV1Manifest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + V1Manifest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeV1Manifest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(V1Manifest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator V1Manifest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeV1Manifest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.cs index 2beee2df8199..f6de1a3aee41 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V1Manifest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,7 @@ namespace Azure.Containers.ContainerRegistry /// Returns the requested V1 manifest file. internal partial class V1Manifest : Manifest { - /// Initializes a new instance of V1Manifest. + /// Initializes a new instance of . internal V1Manifest() { FsLayers = new ChangeTrackingList(); @@ -21,7 +22,7 @@ internal V1Manifest() Signatures = new ChangeTrackingList(); } - /// Initializes a new instance of V1Manifest. + /// Initializes a new instance of . /// Schema version. /// CPU architecture. /// Image name. @@ -29,7 +30,8 @@ internal V1Manifest() /// List of layer information. /// Image history. /// Image signature. - internal V1Manifest(int? schemaVersion, string architecture, string name, string tag, IReadOnlyList fsLayers, IReadOnlyList history, IReadOnlyList signatures) : base(schemaVersion) + /// Keeps track of any properties unknown to the library. + internal V1Manifest(int? schemaVersion, string architecture, string name, string tag, IReadOnlyList fsLayers, IReadOnlyList history, IReadOnlyList signatures, Dictionary serializedAdditionalRawData) : base(schemaVersion, serializedAdditionalRawData) { Architecture = architecture; Name = name; diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.Serialization.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.Serialization.cs index d26309d48e9f..9a56750f515b 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.Serialization.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.Serialization.cs @@ -5,16 +5,82 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Containers.ContainerRegistry { - internal partial class V2Manifest + internal partial class V2Manifest : IUtf8JsonSerializable, IModelJsonSerializable { - internal static V2Manifest DeserializeV2Manifest(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(MediaType)) + { + writer.WritePropertyName("mediaType"u8); + writer.WriteStringValue(MediaType); + } + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); + if (Config is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Config).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Layers)) + { + writer.WritePropertyName("layers"u8); + writer.WriteStartArray(); + foreach (var item in Layers) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SchemaVersion)) + { + writer.WritePropertyName("schemaVersion"u8); + writer.WriteNumberValue(SchemaVersion.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static V2Manifest DeserializeV2Manifest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +89,7 @@ internal static V2Manifest DeserializeV2Manifest(JsonElement element) Optional config = default; Optional> layers = default; Optional schemaVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaType"u8)) @@ -62,8 +129,61 @@ internal static V2Manifest DeserializeV2Manifest(JsonElement element) schemaVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new V2Manifest(Optional.ToNullable(schemaVersion), mediaType.Value, config.Value, Optional.ToList(layers), serializedAdditionalRawData); + } + + V2Manifest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeV2Manifest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + V2Manifest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeV2Manifest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(V2Manifest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator V2Manifest(Response response) + { + if (response is null) + { + return null; } - return new V2Manifest(Optional.ToNullable(schemaVersion), mediaType.Value, config.Value, Optional.ToList(layers)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeV2Manifest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.cs b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.cs index b073356982d4..9384f1bd2208 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.cs +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/Generated/Models/V2Manifest.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,18 +14,19 @@ namespace Azure.Containers.ContainerRegistry /// Returns the requested Docker V2 Manifest file. internal partial class V2Manifest : Manifest { - /// Initializes a new instance of V2Manifest. + /// Initializes a new instance of . internal V2Manifest() { Layers = new ChangeTrackingList(); } - /// Initializes a new instance of V2Manifest. + /// Initializes a new instance of . /// Schema version. /// Media type for this Manifest. /// V2 image config descriptor. /// List of V2 image layer information. - internal V2Manifest(int? schemaVersion, string mediaType, OciDescriptor config, IReadOnlyList layers) : base(schemaVersion) + /// Keeps track of any properties unknown to the library. + internal V2Manifest(int? schemaVersion, string mediaType, OciDescriptor config, IReadOnlyList layers, Dictionary serializedAdditionalRawData) : base(schemaVersion, serializedAdditionalRawData) { MediaType = mediaType; Config = config; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ArmContainerRegistryModelFactory.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ArmContainerRegistryModelFactory.cs index c00ea30236fc..54d289d6b2c2 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ArmContainerRegistryModelFactory.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ArmContainerRegistryModelFactory.cs @@ -17,17 +17,65 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// Model factory for models. public static partial class ArmContainerRegistryModelFactory { - /// Initializes a new instance of ContainerRegistryNameAvailableResult. + /// Initializes a new instance of . + /// The source of the image. + /// List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). + /// List of strings of repository names to do a manifest only copy. No tag will be created. + /// When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. + /// A new instance for mocking. + public static ContainerRegistryImportImageContent ContainerRegistryImportImageContent(ContainerRegistryImportSource source = null, IEnumerable targetTags = null, IEnumerable untaggedTargetRepositories = null, ContainerRegistryImportMode? mode = null) + { + targetTags ??= new List(); + untaggedTargetRepositories ??= new List(); + + return new ContainerRegistryImportImageContent(source, targetTags?.ToList(), untaggedTargetRepositories?.ToList(), mode, default); + } + + /// Initializes a new instance of . + /// The resource identifier of the source Azure Container Registry. + /// The address of the source registry (e.g. 'mcr.microsoft.com'). + /// Credentials used when importing from a registry uri. + /// + /// Repository name of the source image. + /// Specify an image by repository ('hello-world'). This will use the 'latest' tag. + /// Specify an image by tag ('hello-world:latest'). + /// Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + /// + /// A new instance for mocking. + public static ContainerRegistryImportSource ContainerRegistryImportSource(ResourceIdentifier resourceId = null, string registryAddress = null, ContainerRegistryImportSourceCredentials credentials = null, string sourceImage = null) + { + return new ContainerRegistryImportSource(resourceId, registryAddress, credentials, sourceImage, default); + } + + /// Initializes a new instance of . + /// The username to authenticate with the source registry. + /// The password used to authenticate with the source registry. + /// A new instance for mocking. + public static ContainerRegistryImportSourceCredentials ContainerRegistryImportSourceCredentials(string username = null, string password = null) + { + return new ContainerRegistryImportSourceCredentials(username, password, default); + } + + /// Initializes a new instance of . + /// The name of the container registry. + /// The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + /// A new instance for mocking. + public static ContainerRegistryNameAvailabilityContent ContainerRegistryNameAvailabilityContent(string name = null, ContainerRegistryResourceType resourceType = default) + { + return new ContainerRegistryNameAvailabilityContent(name, resourceType, default); + } + + /// Initializes a new instance of . /// The value that indicates whether the name is available. /// If any, the reason that the name is not available. /// If any, the error message that provides more detail for the reason that the name is not available. /// A new instance for mocking. public static ContainerRegistryNameAvailableResult ContainerRegistryNameAvailableResult(bool? isNameAvailable = null, string reason = null, string message = null) { - return new ContainerRegistryNameAvailableResult(isNameAvailable, reason, message); + return new ContainerRegistryNameAvailableResult(isNameAvailable, reason, message, default); } - /// Initializes a new instance of ContainerRegistryPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,10 +86,10 @@ public static ContainerRegistryNameAvailableResult ContainerRegistryNameAvailabl /// A new instance for mocking. public static ContainerRegistryPrivateEndpointConnectionData ContainerRegistryPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, ContainerRegistryPrivateLinkServiceConnectionState connectionState = null, ContainerRegistryProvisioningState? provisioningState = null) { - return new ContainerRegistryPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState, provisioningState); + return new ContainerRegistryPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState, provisioningState, default); } - /// Initializes a new instance of ContainerRegistryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -71,39 +119,39 @@ public static ContainerRegistryData ContainerRegistryData(ResourceIdentifier id dataEndpointHostNames ??= new List(); privateEndpointConnections ??= new List(); - return new ContainerRegistryData(id, name, resourceType, systemData, tags, location, sku, identity, loginServer, createdOn, provisioningState, status, isAdminUserEnabled, networkRuleSet, policies, encryption, isDataEndpointEnabled, dataEndpointHostNames?.ToList(), privateEndpointConnections?.ToList(), publicNetworkAccess, networkRuleBypassOptions, zoneRedundancy); + return new ContainerRegistryData(id, name, resourceType, systemData, tags, location, sku, identity, loginServer, createdOn, provisioningState, status, isAdminUserEnabled, networkRuleSet, policies, encryption, isDataEndpointEnabled, dataEndpointHostNames?.ToList(), privateEndpointConnections?.ToList(), publicNetworkAccess, networkRuleBypassOptions, zoneRedundancy, default); } - /// Initializes a new instance of ContainerRegistrySku. + /// Initializes a new instance of . /// The SKU name of the container registry. Required for registry creation. /// The SKU tier based on the SKU name. /// A new instance for mocking. public static ContainerRegistrySku ContainerRegistrySku(ContainerRegistrySkuName name = default, ContainerRegistrySkuTier? tier = null) { - return new ContainerRegistrySku(name, tier); + return new ContainerRegistrySku(name, tier, default); } - /// Initializes a new instance of ContainerRegistryResourceStatus. + /// Initializes a new instance of . /// The short label for the status. /// The detailed message for the status, including alerts and error messages. /// The timestamp when the status was changed to the current value. /// A new instance for mocking. public static ContainerRegistryResourceStatus ContainerRegistryResourceStatus(string displayStatus = null, string message = null, DateTimeOffset? timestamp = null) { - return new ContainerRegistryResourceStatus(displayStatus, message, timestamp); + return new ContainerRegistryResourceStatus(displayStatus, message, timestamp, default); } - /// Initializes a new instance of ContainerRegistryRetentionPolicy. + /// Initializes a new instance of . /// The number of days to retain an untagged manifest after which it gets purged. /// The timestamp when the policy was last updated. /// The value that indicates whether the policy is enabled or not. /// A new instance for mocking. public static ContainerRegistryRetentionPolicy ContainerRegistryRetentionPolicy(int? days = null, DateTimeOffset? lastUpdatedOn = null, ContainerRegistryPolicyStatus? status = null) { - return new ContainerRegistryRetentionPolicy(days, lastUpdatedOn, status); + return new ContainerRegistryRetentionPolicy(days, lastUpdatedOn, status, default); } - /// Initializes a new instance of ContainerRegistryKeyVaultProperties. + /// Initializes a new instance of . /// Key vault uri to access the encryption key. /// The fully qualified key identifier that includes the version of the key that is actually used for encryption. /// The client id of the identity which will be used to access key vault. @@ -112,10 +160,10 @@ public static ContainerRegistryRetentionPolicy ContainerRegistryRetentionPolicy( /// A new instance for mocking. public static ContainerRegistryKeyVaultProperties ContainerRegistryKeyVaultProperties(string keyIdentifier = null, string versionedKeyIdentifier = null, string identity = null, bool? isKeyRotationEnabled = null, DateTimeOffset? lastKeyRotationTimestamp = null) { - return new ContainerRegistryKeyVaultProperties(keyIdentifier, versionedKeyIdentifier, identity, isKeyRotationEnabled, lastKeyRotationTimestamp); + return new ContainerRegistryKeyVaultProperties(keyIdentifier, versionedKeyIdentifier, identity, isKeyRotationEnabled, lastKeyRotationTimestamp, default); } - /// Initializes a new instance of ContainerRegistryUsage. + /// Initializes a new instance of . /// The name of the usage. /// The limit of the usage. /// The current value of the usage. @@ -123,10 +171,10 @@ public static ContainerRegistryKeyVaultProperties ContainerRegistryKeyVaultPrope /// A new instance for mocking. public static ContainerRegistryUsage ContainerRegistryUsage(string name = null, long? limit = null, long? currentValue = null, ContainerRegistryUsageUnit? unit = null) { - return new ContainerRegistryUsage(name, limit, currentValue, unit); + return new ContainerRegistryUsage(name, limit, currentValue, unit, default); } - /// Initializes a new instance of ContainerRegistryPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -140,10 +188,10 @@ public static ContainerRegistryPrivateLinkResourceData ContainerRegistryPrivateL requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new ContainerRegistryPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new ContainerRegistryPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryListCredentialsResult. + /// Initializes a new instance of . /// The username for a container registry. /// The list of passwords for a container registry. /// A new instance for mocking. @@ -151,19 +199,19 @@ public static ContainerRegistryListCredentialsResult ContainerRegistryListCreden { passwords ??= new List(); - return new ContainerRegistryListCredentialsResult(username, passwords?.ToList()); + return new ContainerRegistryListCredentialsResult(username, passwords?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryPassword. + /// Initializes a new instance of . /// The password name. /// The password value. /// A new instance for mocking. public static ContainerRegistryPassword ContainerRegistryPassword(ContainerRegistryPasswordName? name = null, string value = null) { - return new ContainerRegistryPassword(name, value); + return new ContainerRegistryPassword(name, value, default); } - /// Initializes a new instance of ContainerRegistryReplicationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -179,10 +227,10 @@ public static ContainerRegistryReplicationData ContainerRegistryReplicationData( { tags ??= new Dictionary(); - return new ContainerRegistryReplicationData(id, name, resourceType, systemData, tags, location, provisioningState, status, isRegionEndpointEnabled, zoneRedundancy); + return new ContainerRegistryReplicationData(id, name, resourceType, systemData, tags, location, provisioningState, status, isRegionEndpointEnabled, zoneRedundancy, default); } - /// Initializes a new instance of ScopeMapData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -201,10 +249,10 @@ public static ScopeMapData ScopeMapData(ResourceIdentifier id = null, string nam { actions ??= new List(); - return new ScopeMapData(id, name, resourceType, systemData, description, scopeMapType, createdOn, provisioningState, actions?.ToList()); + return new ScopeMapData(id, name, resourceType, systemData, description, scopeMapType, createdOn, provisioningState, actions?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryTokenData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -217,10 +265,10 @@ public static ScopeMapData ScopeMapData(ResourceIdentifier id = null, string nam /// A new instance for mocking. public static ContainerRegistryTokenData ContainerRegistryTokenData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? createdOn = null, ContainerRegistryProvisioningState? provisioningState = null, ResourceIdentifier scopeMapId = null, ContainerRegistryTokenCredentials credentials = null, ContainerRegistryTokenStatus? status = null) { - return new ContainerRegistryTokenData(id, name, resourceType, systemData, createdOn, provisioningState, scopeMapId, credentials, status); + return new ContainerRegistryTokenData(id, name, resourceType, systemData, createdOn, provisioningState, scopeMapId, credentials, status, default); } - /// Initializes a new instance of ContainerRegistryTokenPassword. + /// Initializes a new instance of . /// The creation datetime of the password. /// The expiry datetime of the password. /// The password name "password1" or "password2". @@ -228,10 +276,10 @@ public static ContainerRegistryTokenData ContainerRegistryTokenData(ResourceIden /// A new instance for mocking. public static ContainerRegistryTokenPassword ContainerRegistryTokenPassword(DateTimeOffset? createdOn = null, DateTimeOffset? expireOn = null, ContainerRegistryTokenPasswordName? name = null, string value = null) { - return new ContainerRegistryTokenPassword(createdOn, expireOn, name, value); + return new ContainerRegistryTokenPassword(createdOn, expireOn, name, value, default); } - /// Initializes a new instance of ContainerRegistryGenerateCredentialsResult. + /// Initializes a new instance of . /// The username for a container registry. /// The list of passwords for a container registry. /// A new instance for mocking. @@ -239,10 +287,10 @@ public static ContainerRegistryGenerateCredentialsResult ContainerRegistryGenera { passwords ??= new List(); - return new ContainerRegistryGenerateCredentialsResult(username, passwords?.ToList()); + return new ContainerRegistryGenerateCredentialsResult(username, passwords?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryWebhookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -259,28 +307,46 @@ public static ContainerRegistryWebhookData ContainerRegistryWebhookData(Resource tags ??= new Dictionary(); actions ??= new List(); - return new ContainerRegistryWebhookData(id, name, resourceType, systemData, tags, location, status, scope, actions?.ToList(), provisioningState); + return new ContainerRegistryWebhookData(id, name, resourceType, systemData, tags, location, status, scope, actions?.ToList(), provisioningState, default); + } + + /// Initializes a new instance of . + /// The tags for the webhook. + /// The location of the webhook. This cannot be changed after the resource is created. + /// The service URI for the webhook to post notifications. + /// Custom headers that will be added to the webhook notifications. + /// The status of the webhook at the time the operation was called. + /// The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + /// The list of actions that trigger the webhook to post notifications. + /// A new instance for mocking. + public static ContainerRegistryWebhookCreateOrUpdateContent ContainerRegistryWebhookCreateOrUpdateContent(IDictionary tags = null, AzureLocation location = default, Uri serviceUri = null, IDictionary customHeaders = null, ContainerRegistryWebhookStatus? status = null, string scope = null, IEnumerable actions = null) + { + tags ??= new Dictionary(); + customHeaders ??= new Dictionary(); + actions ??= new List(); + + return new ContainerRegistryWebhookCreateOrUpdateContent(tags, location, serviceUri, customHeaders, status, scope, actions?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryWebhookEventInfo. + /// Initializes a new instance of . /// The event ID. /// A new instance for mocking. public static ContainerRegistryWebhookEventInfo ContainerRegistryWebhookEventInfo(Guid? id = null) { - return new ContainerRegistryWebhookEventInfo(id); + return new ContainerRegistryWebhookEventInfo(id, default); } - /// Initializes a new instance of ContainerRegistryWebhookEvent. + /// Initializes a new instance of . /// The event ID. /// The event request message sent to the service URI. /// The event response message received from the service URI. /// A new instance for mocking. public static ContainerRegistryWebhookEvent ContainerRegistryWebhookEvent(Guid? id = null, ContainerRegistryWebhookEventRequestMessage eventRequestMessage = null, ContainerRegistryWebhookEventResponseMessage eventResponseMessage = null) { - return new ContainerRegistryWebhookEvent(id, eventRequestMessage, eventResponseMessage); + return new ContainerRegistryWebhookEvent(id, eventRequestMessage, eventResponseMessage, default); } - /// Initializes a new instance of ContainerRegistryWebhookEventRequestMessage. + /// Initializes a new instance of . /// The content of the event request message. /// The headers of the event request message. /// The HTTP method used to send the event request message. @@ -291,10 +357,10 @@ public static ContainerRegistryWebhookEventRequestMessage ContainerRegistryWebho { headers ??= new Dictionary(); - return new ContainerRegistryWebhookEventRequestMessage(content, headers, method, requestUri, version); + return new ContainerRegistryWebhookEventRequestMessage(content, headers, method, requestUri, version, default); } - /// Initializes a new instance of ContainerRegistryWebhookEventContent. + /// Initializes a new instance of . /// The event ID. /// The time at which the event occurred. /// The action that encompasses the provided event. @@ -305,10 +371,10 @@ public static ContainerRegistryWebhookEventRequestMessage ContainerRegistryWebho /// A new instance for mocking. public static ContainerRegistryWebhookEventContent ContainerRegistryWebhookEventContent(Guid? id = null, DateTimeOffset? timestamp = null, string action = null, ContainerRegistryWebhookEventTarget target = null, ContainerRegistryWebhookEventRequestContent request = null, string actorName = null, ContainerRegistryWebhookEventSource source = null) { - return new ContainerRegistryWebhookEventContent(id, timestamp, action, target, request, actorName != null ? new ContainerRegistryWebhookEventActor(actorName) : null, source); + return new ContainerRegistryWebhookEventContent(id, timestamp, action, target, request, actorName != null ? new ContainerRegistryWebhookEventActor(actorName, new Dictionary()) : null, source, default); } - /// Initializes a new instance of ContainerRegistryWebhookEventTarget. + /// Initializes a new instance of . /// The MIME type of the referenced object. /// The number of bytes of the content. Same as Length field. /// The digest of the content, as defined by the Registry V2 HTTP API Specification. @@ -321,10 +387,10 @@ public static ContainerRegistryWebhookEventContent ContainerRegistryWebhookEvent /// A new instance for mocking. public static ContainerRegistryWebhookEventTarget ContainerRegistryWebhookEventTarget(string mediaType = null, long? size = null, string digest = null, long? length = null, string repository = null, Uri uri = null, string tag = null, string name = null, string version = null) { - return new ContainerRegistryWebhookEventTarget(mediaType, size, digest, length, repository, uri, tag, name, version); + return new ContainerRegistryWebhookEventTarget(mediaType, size, digest, length, repository, uri, tag, name, version, default); } - /// Initializes a new instance of ContainerRegistryWebhookEventRequestContent. + /// Initializes a new instance of . /// The ID of the request that initiated the event. /// The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. /// The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. @@ -333,19 +399,19 @@ public static ContainerRegistryWebhookEventTarget ContainerRegistryWebhookEventT /// A new instance for mocking. public static ContainerRegistryWebhookEventRequestContent ContainerRegistryWebhookEventRequestContent(Guid? id = null, string addr = null, string host = null, string method = null, string userAgent = null) { - return new ContainerRegistryWebhookEventRequestContent(id, addr, host, method, userAgent); + return new ContainerRegistryWebhookEventRequestContent(id, addr, host, method, userAgent, default); } - /// Initializes a new instance of ContainerRegistryWebhookEventSource. + /// Initializes a new instance of . /// The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. /// The running instance of an application. Changes after each restart. /// A new instance for mocking. public static ContainerRegistryWebhookEventSource ContainerRegistryWebhookEventSource(string addr = null, string instanceId = null) { - return new ContainerRegistryWebhookEventSource(addr, instanceId); + return new ContainerRegistryWebhookEventSource(addr, instanceId, default); } - /// Initializes a new instance of ContainerRegistryWebhookEventResponseMessage. + /// Initializes a new instance of . /// The content of the event response message. /// The headers of the event response message. /// The reason phrase of the event response message. @@ -356,10 +422,10 @@ public static ContainerRegistryWebhookEventResponseMessage ContainerRegistryWebh { headers ??= new Dictionary(); - return new ContainerRegistryWebhookEventResponseMessage(content, headers, reasonPhrase, statusCode, version); + return new ContainerRegistryWebhookEventResponseMessage(content, headers, reasonPhrase, statusCode, version, default); } - /// Initializes a new instance of ContainerRegistryWebhookCallbackConfig. + /// Initializes a new instance of . /// The service URI for the webhook to post notifications. /// Custom headers that will be added to the webhook notifications. /// A new instance for mocking. @@ -367,10 +433,10 @@ public static ContainerRegistryWebhookCallbackConfig ContainerRegistryWebhookCal { customHeaders ??= new Dictionary(); - return new ContainerRegistryWebhookCallbackConfig(serviceUri, customHeaders); + return new ContainerRegistryWebhookCallbackConfig(serviceUri, customHeaders, default); } - /// Initializes a new instance of ContainerRegistryAgentPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -387,18 +453,18 @@ public static ContainerRegistryAgentPoolData ContainerRegistryAgentPoolData(Reso { tags ??= new Dictionary(); - return new ContainerRegistryAgentPoolData(id, name, resourceType, systemData, tags, location, count, tier, os, virtualNetworkSubnetResourceId, provisioningState); + return new ContainerRegistryAgentPoolData(id, name, resourceType, systemData, tags, location, count, tier, os, virtualNetworkSubnetResourceId, provisioningState, default); } - /// Initializes a new instance of ContainerRegistryAgentPoolQueueStatus. + /// Initializes a new instance of . /// The number of pending runs in the queue. /// A new instance for mocking. public static ContainerRegistryAgentPoolQueueStatus ContainerRegistryAgentPoolQueueStatus(int? count = null) { - return new ContainerRegistryAgentPoolQueueStatus(count); + return new ContainerRegistryAgentPoolQueueStatus(count, default); } - /// Initializes a new instance of ContainerRegistryRunData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -431,28 +497,28 @@ public static ContainerRegistryRunData ContainerRegistryRunData(ResourceIdentifi outputImages ??= new List(); customRegistries ??= new List(); - return new ContainerRegistryRunData(id, name, resourceType, systemData, runId, status, lastUpdatedOn, runType, agentPoolName, createdOn, startOn, finishOn, outputImages?.ToList(), task, imageUpdateTrigger, sourceTrigger, timerTrigger, platform, agentCpu != null ? new ContainerRegistryAgentProperties(agentCpu) : null, sourceRegistryAuth, customRegistries?.ToList(), runErrorMessage, updateTriggerToken, logArtifact, provisioningState, isArchiveEnabled); + return new ContainerRegistryRunData(id, name, resourceType, systemData, runId, status, lastUpdatedOn, runType, agentPoolName, createdOn, startOn, finishOn, outputImages?.ToList(), task, imageUpdateTrigger, sourceTrigger, timerTrigger, platform, agentCpu != null ? new ContainerRegistryAgentProperties(agentCpu, new Dictionary()) : null, sourceRegistryAuth, customRegistries?.ToList(), runErrorMessage, updateTriggerToken, logArtifact, provisioningState, isArchiveEnabled, default); } - /// Initializes a new instance of SourceUploadDefinition. + /// Initializes a new instance of . /// The URL where the client can upload the source. /// The relative path to the source. This is used to submit the subsequent queue build request. /// A new instance for mocking. public static SourceUploadDefinition SourceUploadDefinition(Uri uploadUri = null, string relativePath = null) { - return new SourceUploadDefinition(uploadUri, relativePath); + return new SourceUploadDefinition(uploadUri, relativePath, default); } - /// Initializes a new instance of ContainerRegistryRunGetLogResult. + /// Initializes a new instance of . /// The link to logs for a run on a azure container registry. /// The link to logs in registry for a run on a azure container registry. /// A new instance for mocking. public static ContainerRegistryRunGetLogResult ContainerRegistryRunGetLogResult(string logLink = null, string logArtifactLink = null) { - return new ContainerRegistryRunGetLogResult(logLink, logArtifactLink); + return new ContainerRegistryRunGetLogResult(logLink, logArtifactLink, default); } - /// Initializes a new instance of ContainerRegistryTaskRunData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -470,10 +536,10 @@ public static ContainerRegistryRunGetLogResult ContainerRegistryRunGetLogResult( /// A new instance for mocking. public static ContainerRegistryTaskRunData ContainerRegistryTaskRunData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, AzureLocation? location = null, ContainerRegistryProvisioningState? provisioningState = null, ContainerRegistryRunContent runRequest = null, ContainerRegistryRunData runResult = null, string forceUpdateTag = null) { - return new ContainerRegistryTaskRunData(id, name, resourceType, systemData, identity, location, provisioningState, runRequest, runResult, forceUpdateTag); + return new ContainerRegistryTaskRunData(id, name, resourceType, systemData, identity, location, provisioningState, runRequest, runResult, forceUpdateTag, default); } - /// Initializes a new instance of ContainerRegistryTaskData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -502,10 +568,10 @@ public static ContainerRegistryTaskData ContainerRegistryTaskData(ResourceIdenti { tags ??= new Dictionary(); - return new ContainerRegistryTaskData(id, name, resourceType, systemData, tags, location, identity, provisioningState, createdOn, status, platform, agentCpu != null ? new ContainerRegistryAgentProperties(agentCpu) : null, agentPoolName, timeoutInSeconds, step, trigger, credentials, logTemplate, isSystemTask); + return new ContainerRegistryTaskData(id, name, resourceType, systemData, tags, location, identity, provisioningState, createdOn, status, platform, agentCpu != null ? new ContainerRegistryAgentProperties(agentCpu, new Dictionary()) : null, agentPoolName, timeoutInSeconds, step, trigger, credentials, logTemplate, isSystemTask, default); } - /// Initializes a new instance of ContainerRegistryTaskStepProperties. + /// Initializes a new instance of . /// The type of the step. /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. @@ -515,10 +581,10 @@ public static ContainerRegistryTaskStepProperties ContainerRegistryTaskStepPrope { baseImageDependencies ??= new List(); - return new UnknownTaskStepProperties(containerRegistryTaskStepType, baseImageDependencies?.ToList(), contextPath, contextAccessToken); + return new UnknownTaskStepProperties(containerRegistryTaskStepType, baseImageDependencies?.ToList(), contextPath, contextAccessToken, default); } - /// Initializes a new instance of ContainerRegistryBaseImageDependency. + /// Initializes a new instance of . /// The type of the base image dependency. /// The registry login server. /// The repository name. @@ -527,10 +593,45 @@ public static ContainerRegistryTaskStepProperties ContainerRegistryTaskStepPrope /// A new instance for mocking. public static ContainerRegistryBaseImageDependency ContainerRegistryBaseImageDependency(ContainerRegistryBaseImageDependencyType? dependencyType = null, string registry = null, string repository = null, string tag = null, string digest = null) { - return new ContainerRegistryBaseImageDependency(dependencyType, registry, repository, tag, digest); + return new ContainerRegistryBaseImageDependency(dependencyType, registry, repository, tag, digest, default); + } + + /// Initializes a new instance of . + /// The CRON expression for the task schedule. + /// The current status of trigger. + /// The name of the trigger. + /// A new instance for mocking. + public static ContainerRegistryTimerTriggerUpdateContent ContainerRegistryTimerTriggerUpdateContent(string schedule = null, ContainerRegistryTriggerStatus? status = null, string name = null) + { + return new ContainerRegistryTimerTriggerUpdateContent(schedule, status, name, default); + } + + /// Initializes a new instance of . + /// The properties that describes the source(code) for the task. + /// The source event corresponding to the trigger. + /// The current status of trigger. + /// The name of the trigger. + /// A new instance for mocking. + public static ContainerRegistrySourceTriggerUpdateContent ContainerRegistrySourceTriggerUpdateContent(SourceCodeRepoUpdateContent sourceRepository = null, IEnumerable sourceTriggerEvents = null, ContainerRegistryTriggerStatus? status = null, string name = null) + { + sourceTriggerEvents ??= new List(); + + return new ContainerRegistrySourceTriggerUpdateContent(sourceRepository, sourceTriggerEvents?.ToList(), status, name, default); + } + + /// Initializes a new instance of . + /// The type of the auto trigger for base image dependency updates. + /// The endpoint URL for receiving update triggers. + /// Type of Payload body for Base image update triggers. + /// The current status of trigger. + /// The name of the trigger. + /// A new instance for mocking. + public static ContainerRegistryBaseImageTriggerUpdateContent ContainerRegistryBaseImageTriggerUpdateContent(ContainerRegistryBaseImageTriggerType? baseImageTriggerType = null, string updateTriggerEndpoint = null, ContainerRegistryUpdateTriggerPayloadType? updateTriggerPayloadType = null, ContainerRegistryTriggerStatus? status = null, string name = null) + { + return new ContainerRegistryBaseImageTriggerUpdateContent(baseImageTriggerType, updateTriggerEndpoint, updateTriggerPayloadType, status, name, default); } - /// Initializes a new instance of ContainerRegistryDockerBuildStep. + /// Initializes a new instance of . /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. @@ -547,10 +648,10 @@ public static ContainerRegistryDockerBuildStep ContainerRegistryDockerBuildStep( imageNames ??= new List(); arguments ??= new List(); - return new ContainerRegistryDockerBuildStep(ContainerRegistryTaskStepType.Docker, baseImageDependencies?.ToList(), contextPath, contextAccessToken, imageNames?.ToList(), isPushEnabled, noCache, dockerFilePath, target, arguments?.ToList()); + return new ContainerRegistryDockerBuildStep(ContainerRegistryTaskStepType.Docker, baseImageDependencies?.ToList(), contextPath, contextAccessToken, imageNames?.ToList(), isPushEnabled, noCache, dockerFilePath, target, arguments?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryFileTaskStep. + /// Initializes a new instance of . /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. @@ -563,10 +664,10 @@ public static ContainerRegistryFileTaskStep ContainerRegistryFileTaskStep(IEnume baseImageDependencies ??= new List(); values ??= new List(); - return new ContainerRegistryFileTaskStep(ContainerRegistryTaskStepType.FileTask, baseImageDependencies?.ToList(), contextPath, contextAccessToken, taskFilePath, valuesFilePath, values?.ToList()); + return new ContainerRegistryFileTaskStep(ContainerRegistryTaskStepType.FileTask, baseImageDependencies?.ToList(), contextPath, contextAccessToken, taskFilePath, valuesFilePath, values?.ToList(), default); } - /// Initializes a new instance of ContainerRegistryEncodedTaskStep. + /// Initializes a new instance of . /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. @@ -579,7 +680,7 @@ public static ContainerRegistryEncodedTaskStep ContainerRegistryEncodedTaskStep( baseImageDependencies ??= new List(); values ??= new List(); - return new ContainerRegistryEncodedTaskStep(ContainerRegistryTaskStepType.EncodedTask, baseImageDependencies?.ToList(), contextPath, contextAccessToken, encodedTaskContent, encodedValuesContent, values?.ToList()); + return new ContainerRegistryEncodedTaskStep(ContainerRegistryTaskStepType.EncodedTask, baseImageDependencies?.ToList(), contextPath, contextAccessToken, encodedTaskContent, encodedValuesContent, values?.ToList(), default); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs index 165345a49522..85736b8f0cf8 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryAgentPoolAgentPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryAgentPoolAgentPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryAgentPoolResource(Client, ContainerRegistryAgentPoolData.DeserializeContainerRegistryAgentPoolData(e)), _containerRegistryAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerRegistryAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryAgentPoolResource(Client, ContainerRegistryAgentPoolData.DeserializeContainerRegistryAgentPoolData(e)), _containerRegistryAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerRegistryAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryAgentPoolAgentPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryAgentPoolAgentPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryAgentPoolResource(Client, ContainerRegistryAgentPoolData.DeserializeContainerRegistryAgentPoolData(e)), _containerRegistryAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerRegistryAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryAgentPoolResource(Client, ContainerRegistryAgentPoolData.DeserializeContainerRegistryAgentPoolData(e)), _containerRegistryAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerRegistryAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolData.cs index 4e4a50d78bf2..972d9b7e039b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryAgentPoolData : TrackedResourceData { - /// Initializes a new instance of ContainerRegistryAgentPoolData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerRegistryAgentPoolData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerRegistryAgentPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,13 +41,20 @@ public ContainerRegistryAgentPoolData(AzureLocation location) : base(location) /// The OS of agent machine. /// The Virtual Network Subnet Resource Id of the agent machine. /// The provisioning state of this agent pool. - internal ContainerRegistryAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, int? count, string tier, ContainerRegistryOS? os, ResourceIdentifier virtualNetworkSubnetResourceId, ContainerRegistryProvisioningState? provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, int? count, string tier, ContainerRegistryOS? os, ResourceIdentifier virtualNetworkSubnetResourceId, ContainerRegistryProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Count = count; Tier = tier; OS = os; VirtualNetworkSubnetResourceId = virtualNetworkSubnetResourceId; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryAgentPoolData() + { } /// The count of agent machine. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs index 2e4b2eaf324a..09c8b500c33d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryRegistriesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryRegistriesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), _containerRegistryRegistriesClientDiagnostics, Pipeline, "ContainerRegistryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), _containerRegistryRegistriesClientDiagnostics, Pipeline, "ContainerRegistryCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryRegistriesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryRegistriesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), _containerRegistryRegistriesClientDiagnostics, Pipeline, "ContainerRegistryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), _containerRegistryRegistriesClientDiagnostics, Pipeline, "ContainerRegistryCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryData.cs index 9afa956e6d1f..5791e7ce0438 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryData : TrackedResourceData { - /// Initializes a new instance of ContainerRegistryData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The SKU of the container registry. /// is null. @@ -32,7 +35,7 @@ public ContainerRegistryData(AzureLocation location, ContainerRegistrySku sku) : PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -55,7 +58,8 @@ public ContainerRegistryData(AzureLocation location, ContainerRegistrySku sku) : /// Whether or not public network access is allowed for the container registry. /// Whether to allow trusted Azure services to access a network restricted registry. /// Whether or not zone redundancy is enabled for this container registry. - internal ContainerRegistryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerRegistrySku sku, ManagedServiceIdentity identity, string loginServer, DateTimeOffset? createdOn, ContainerRegistryProvisioningState? provisioningState, ContainerRegistryResourceStatus status, bool? isAdminUserEnabled, ContainerRegistryNetworkRuleSet networkRuleSet, ContainerRegistryPolicies policies, ContainerRegistryEncryption encryption, bool? isDataEndpointEnabled, IReadOnlyList dataEndpointHostNames, IReadOnlyList privateEndpointConnections, ContainerRegistryPublicNetworkAccess? publicNetworkAccess, ContainerRegistryNetworkRuleBypassOption? networkRuleBypassOptions, ContainerRegistryZoneRedundancy? zoneRedundancy) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerRegistrySku sku, ManagedServiceIdentity identity, string loginServer, DateTimeOffset? createdOn, ContainerRegistryProvisioningState? provisioningState, ContainerRegistryResourceStatus status, bool? isAdminUserEnabled, ContainerRegistryNetworkRuleSet networkRuleSet, ContainerRegistryPolicies policies, ContainerRegistryEncryption encryption, bool? isDataEndpointEnabled, IReadOnlyList dataEndpointHostNames, IReadOnlyList privateEndpointConnections, ContainerRegistryPublicNetworkAccess? publicNetworkAccess, ContainerRegistryNetworkRuleBypassOption? networkRuleBypassOptions, ContainerRegistryZoneRedundancy? zoneRedundancy, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -73,6 +77,12 @@ internal ContainerRegistryData(ResourceIdentifier id, string name, ResourceType PublicNetworkAccess = publicNetworkAccess; NetworkRuleBypassOptions = networkRuleBypassOptions; ZoneRedundancy = zoneRedundancy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryData() + { } /// The SKU of the container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs index 212a66e5c67a..5f3f668508f6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryPrivateEndpointConnectionResource(Client, ContainerRegistryPrivateEndpointConnectionData.DeserializeContainerRegistryPrivateEndpointConnectionData(e)), _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerRegistryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryPrivateEndpointConnectionResource(Client, ContainerRegistryPrivateEndpointConnectionData.DeserializeContainerRegistryPrivateEndpointConnectionData(e)), _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerRegistryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetA { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryPrivateEndpointConnectionResource(Client, ContainerRegistryPrivateEndpointConnectionData.DeserializeContainerRegistryPrivateEndpointConnectionData(e)), _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerRegistryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryPrivateEndpointConnectionResource(Client, ContainerRegistryPrivateEndpointConnectionData.DeserializeContainerRegistryPrivateEndpointConnectionData(e)), _containerRegistryPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerRegistryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionData.cs index 69dcdc754cd7..4c7cec1a77aa 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of ContainerRegistryPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryPrivateEndpointConnectionData() { } - /// Initializes a new instance of ContainerRegistryPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public ContainerRegistryPrivateEndpointConnectionData() /// The resource of private endpoint. /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of private endpoint connection resource. - internal ContainerRegistryPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WritableSubResource privateEndpoint, ContainerRegistryPrivateLinkServiceConnectionState connectionState, ContainerRegistryProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WritableSubResource privateEndpoint, ContainerRegistryPrivateLinkServiceConnectionState connectionState, ContainerRegistryProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of private endpoint. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs index 2341c87b7fea..05f296f3ffb7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryPrivateLinkResourceRegistriesRestClient.CreateListPrivateLinkResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryPrivateLinkResourceRegistriesRestClient.CreateListPrivateLinkResourcesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryPrivateLinkResource(Client, ContainerRegistryPrivateLinkResourceData.DeserializeContainerRegistryPrivateLinkResourceData(e)), _containerRegistryPrivateLinkResourceRegistriesClientDiagnostics, Pipeline, "ContainerRegistryPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryPrivateLinkResource(Client, ContainerRegistryPrivateLinkResourceData.DeserializeContainerRegistryPrivateLinkResourceData(e)), _containerRegistryPrivateLinkResourceRegistriesClientDiagnostics, Pipeline, "ContainerRegistryPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryPrivateLinkResourceRegistriesRestClient.CreateListPrivateLinkResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryPrivateLinkResourceRegistriesRestClient.CreateListPrivateLinkResourcesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryPrivateLinkResource(Client, ContainerRegistryPrivateLinkResourceData.DeserializeContainerRegistryPrivateLinkResourceData(e)), _containerRegistryPrivateLinkResourceRegistriesClientDiagnostics, Pipeline, "ContainerRegistryPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryPrivateLinkResource(Client, ContainerRegistryPrivateLinkResourceData.DeserializeContainerRegistryPrivateLinkResourceData(e)), _containerRegistryPrivateLinkResourceRegistriesClientDiagnostics, Pipeline, "ContainerRegistryPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceData.cs index c74d9dc7f387..3ef3a4bd0a93 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,14 +18,17 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of ContainerRegistryPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,11 +36,13 @@ internal ContainerRegistryPrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource Private link DNS zone name. - internal ContainerRegistryPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs index 036a81a0c474..e7fdbfb66aed 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryReplicationReplicationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryReplicationReplicationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryReplicationResource(Client, ContainerRegistryReplicationData.DeserializeContainerRegistryReplicationData(e)), _containerRegistryReplicationReplicationsClientDiagnostics, Pipeline, "ContainerRegistryReplicationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryReplicationResource(Client, ContainerRegistryReplicationData.DeserializeContainerRegistryReplicationData(e)), _containerRegistryReplicationReplicationsClientDiagnostics, Pipeline, "ContainerRegistryReplicationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryReplicationReplicationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryReplicationReplicationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryReplicationResource(Client, ContainerRegistryReplicationData.DeserializeContainerRegistryReplicationData(e)), _containerRegistryReplicationReplicationsClientDiagnostics, Pipeline, "ContainerRegistryReplicationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryReplicationResource(Client, ContainerRegistryReplicationData.DeserializeContainerRegistryReplicationData(e)), _containerRegistryReplicationReplicationsClientDiagnostics, Pipeline, "ContainerRegistryReplicationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationData.cs index 97ffc0e887ab..d6e4ca5db002 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryReplicationData : TrackedResourceData { - /// Initializes a new instance of ContainerRegistryReplicationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerRegistryReplicationData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerRegistryReplicationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,12 +39,19 @@ public ContainerRegistryReplicationData(AzureLocation location) : base(location) /// The status of the replication at the time the operation was called. /// Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. /// Whether or not zone redundancy is enabled for this container registry replication. - internal ContainerRegistryReplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerRegistryProvisioningState? provisioningState, ContainerRegistryResourceStatus status, bool? isRegionEndpointEnabled, ContainerRegistryZoneRedundancy? zoneRedundancy) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryReplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerRegistryProvisioningState? provisioningState, ContainerRegistryResourceStatus status, bool? isRegionEndpointEnabled, ContainerRegistryZoneRedundancy? zoneRedundancy, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; Status = status; IsRegionEndpointEnabled = isRegionEndpointEnabled; ZoneRedundancy = zoneRedundancy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryReplicationData() + { } /// The provisioning state of the replication at the time the operation was called. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs index caac8d960c3b..98af38ad18e0 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunCollection.cs @@ -148,7 +148,7 @@ public virtual AsyncPageable GetAllAsync(string fi { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryRunRunsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryRunRunsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryRunResource(Client, ContainerRegistryRunData.DeserializeContainerRegistryRunData(e)), _containerRegistryRunRunsClientDiagnostics, Pipeline, "ContainerRegistryRunCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryRunResource(Client, ContainerRegistryRunData.DeserializeContainerRegistryRunData(e)), _containerRegistryRunRunsClientDiagnostics, Pipeline, "ContainerRegistryRunCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -172,7 +172,7 @@ public virtual Pageable GetAll(string filter = nul { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryRunRunsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryRunRunsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryRunResource(Client, ContainerRegistryRunData.DeserializeContainerRegistryRunData(e)), _containerRegistryRunRunsClientDiagnostics, Pipeline, "ContainerRegistryRunCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryRunResource(Client, ContainerRegistryRunData.DeserializeContainerRegistryRunData(e)), _containerRegistryRunRunsClientDiagnostics, Pipeline, "ContainerRegistryRunCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunData.cs index cfe2684770dd..77a8ea49f828 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunData.cs @@ -19,14 +19,17 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryRunData : ResourceData { - /// Initializes a new instance of ContainerRegistryRunData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryRunData() { OutputImages = new ChangeTrackingList(); CustomRegistries = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryRunData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -53,7 +56,8 @@ public ContainerRegistryRunData() /// The image description for the log artifact. /// The provisioning state of a run. /// The value that indicates whether archiving is enabled or not. - internal ContainerRegistryRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string runId, ContainerRegistryRunStatus? status, DateTimeOffset? lastUpdatedOn, ContainerRegistryRunType? runType, string agentPoolName, DateTimeOffset? createdOn, DateTimeOffset? startOn, DateTimeOffset? finishOn, IList outputImages, string task, ContainerRegistryImageUpdateTrigger imageUpdateTrigger, ContainerRegistrySourceTriggerDescriptor sourceTrigger, ContainerRegistryTimerTriggerDescriptor timerTrigger, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceRegistryAuth, IList customRegistries, string runErrorMessage, string updateTriggerToken, ContainerRegistryImageDescriptor logArtifact, ContainerRegistryProvisioningState? provisioningState, bool? isArchiveEnabled) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string runId, ContainerRegistryRunStatus? status, DateTimeOffset? lastUpdatedOn, ContainerRegistryRunType? runType, string agentPoolName, DateTimeOffset? createdOn, DateTimeOffset? startOn, DateTimeOffset? finishOn, IList outputImages, string task, ContainerRegistryImageUpdateTrigger imageUpdateTrigger, ContainerRegistrySourceTriggerDescriptor sourceTrigger, ContainerRegistryTimerTriggerDescriptor timerTrigger, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceRegistryAuth, IList customRegistries, string runErrorMessage, string updateTriggerToken, ContainerRegistryImageDescriptor logArtifact, ContainerRegistryProvisioningState? provisioningState, bool? isArchiveEnabled, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RunId = runId; Status = status; @@ -77,6 +81,7 @@ internal ContainerRegistryRunData(ResourceIdentifier id, string name, ResourceTy LogArtifact = logArtifact; ProvisioningState = provisioningState; IsArchiveEnabled = isArchiveEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique identifier for the run. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs index 8573f89a160d..052ce888276c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryTaskTasksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryTaskTasksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryTaskResource(Client, ContainerRegistryTaskData.DeserializeContainerRegistryTaskData(e)), _containerRegistryTaskTasksClientDiagnostics, Pipeline, "ContainerRegistryTaskCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryTaskResource(Client, ContainerRegistryTaskData.DeserializeContainerRegistryTaskData(e)), _containerRegistryTaskTasksClientDiagnostics, Pipeline, "ContainerRegistryTaskCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryTaskTasksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryTaskTasksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryTaskResource(Client, ContainerRegistryTaskData.DeserializeContainerRegistryTaskData(e)), _containerRegistryTaskTasksClientDiagnostics, Pipeline, "ContainerRegistryTaskCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryTaskResource(Client, ContainerRegistryTaskData.DeserializeContainerRegistryTaskData(e)), _containerRegistryTaskTasksClientDiagnostics, Pipeline, "ContainerRegistryTaskCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskData.cs index 6878b0e88ea2..36950caa9fb1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskData.cs @@ -20,13 +20,16 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryTaskData : TrackedResourceData { - /// Initializes a new instance of ContainerRegistryTaskData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerRegistryTaskData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerRegistryTaskData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -50,7 +53,8 @@ public ContainerRegistryTaskData(AzureLocation location) : base(location) /// The properties that describes a set of credentials that will be used when this run is invoked. /// The template that describes the repository and tag information for run log artifact. /// The value of this property indicates whether the task resource is system task or not. - internal ContainerRegistryTaskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ContainerRegistryProvisioningState? provisioningState, DateTimeOffset? createdOn, ContainerRegistryTaskStatus? status, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string agentPoolName, int? timeoutInSeconds, ContainerRegistryTaskStepProperties step, ContainerRegistryTriggerProperties trigger, ContainerRegistryCredentials credentials, string logTemplate, bool? isSystemTask) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ContainerRegistryProvisioningState? provisioningState, DateTimeOffset? createdOn, ContainerRegistryTaskStatus? status, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string agentPoolName, int? timeoutInSeconds, ContainerRegistryTaskStepProperties step, ContainerRegistryTriggerProperties trigger, ContainerRegistryCredentials credentials, string logTemplate, bool? isSystemTask, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; ProvisioningState = provisioningState; @@ -65,6 +69,12 @@ internal ContainerRegistryTaskData(ResourceIdentifier id, string name, ResourceT Credentials = credentials; LogTemplate = logTemplate; IsSystemTask = isSystemTask; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryTaskData() + { } /// Identity for the resource. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs index 8be4f842350e..11a0ff1d531a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryTaskRunTaskRunsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryTaskRunTaskRunsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryTaskRunResource(Client, ContainerRegistryTaskRunData.DeserializeContainerRegistryTaskRunData(e)), _containerRegistryTaskRunTaskRunsClientDiagnostics, Pipeline, "ContainerRegistryTaskRunCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryTaskRunResource(Client, ContainerRegistryTaskRunData.DeserializeContainerRegistryTaskRunData(e)), _containerRegistryTaskRunTaskRunsClientDiagnostics, Pipeline, "ContainerRegistryTaskRunCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryTaskRunTaskRunsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryTaskRunTaskRunsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryTaskRunResource(Client, ContainerRegistryTaskRunData.DeserializeContainerRegistryTaskRunData(e)), _containerRegistryTaskRunTaskRunsClientDiagnostics, Pipeline, "ContainerRegistryTaskRunCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryTaskRunResource(Client, ContainerRegistryTaskRunData.DeserializeContainerRegistryTaskRunData(e)), _containerRegistryTaskRunTaskRunsClientDiagnostics, Pipeline, "ContainerRegistryTaskRunCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunData.cs index 87976502b57d..360a01b4bf1f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryTaskRunData : ResourceData { - /// Initializes a new instance of ContainerRegistryTaskRunData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTaskRunData() { } - /// Initializes a new instance of ContainerRegistryTaskRunData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +43,8 @@ public ContainerRegistryTaskRunData() /// /// The result of this task run. /// How the run should be forced to rerun even if the run request configuration has not changed. - internal ContainerRegistryTaskRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, AzureLocation? location, ContainerRegistryProvisioningState? provisioningState, ContainerRegistryRunContent runRequest, ContainerRegistryRunData runResult, string forceUpdateTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, AzureLocation? location, ContainerRegistryProvisioningState? provisioningState, ContainerRegistryRunContent runRequest, ContainerRegistryRunData runResult, string forceUpdateTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Identity = identity; Location = location; @@ -46,6 +52,7 @@ internal ContainerRegistryTaskRunData(ResourceIdentifier id, string name, Resour RunRequest = runRequest; RunResult = runResult; ForceUpdateTag = forceUpdateTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identity for the resource. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs index 90f07020fe4f..74252edfd0ec 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryTokenTokensRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryTokenTokensRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryTokenResource(Client, ContainerRegistryTokenData.DeserializeContainerRegistryTokenData(e)), _containerRegistryTokenTokensClientDiagnostics, Pipeline, "ContainerRegistryTokenCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryTokenResource(Client, ContainerRegistryTokenData.DeserializeContainerRegistryTokenData(e)), _containerRegistryTokenTokensClientDiagnostics, Pipeline, "ContainerRegistryTokenCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryTokenTokensRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryTokenTokensRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryTokenResource(Client, ContainerRegistryTokenData.DeserializeContainerRegistryTokenData(e)), _containerRegistryTokenTokensClientDiagnostics, Pipeline, "ContainerRegistryTokenCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryTokenResource(Client, ContainerRegistryTokenData.DeserializeContainerRegistryTokenData(e)), _containerRegistryTokenTokensClientDiagnostics, Pipeline, "ContainerRegistryTokenCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenData.cs index 2abb030dc7b6..63f74a43431a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryTokenData : ResourceData { - /// Initializes a new instance of ContainerRegistryTokenData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTokenData() { } - /// Initializes a new instance of ContainerRegistryTokenData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,13 +37,15 @@ public ContainerRegistryTokenData() /// The resource ID of the scope map to which the token will be associated with. /// The credentials that can be used for authenticating the token. /// The status of the token example enabled or disabled. - internal ContainerRegistryTokenData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, ContainerRegistryProvisioningState? provisioningState, ResourceIdentifier scopeMapId, ContainerRegistryTokenCredentials credentials, ContainerRegistryTokenStatus? status) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTokenData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? createdOn, ContainerRegistryProvisioningState? provisioningState, ResourceIdentifier scopeMapId, ContainerRegistryTokenCredentials credentials, ContainerRegistryTokenStatus? status, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { CreatedOn = createdOn; ProvisioningState = provisioningState; ScopeMapId = scopeMapId; Credentials = credentials; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The creation date of scope map. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs index de1d4741862f..89c1a9f00c19 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryWebhookWebhooksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryWebhookWebhooksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryWebhookResource(Client, ContainerRegistryWebhookData.DeserializeContainerRegistryWebhookData(e)), _containerRegistryWebhookWebhooksClientDiagnostics, Pipeline, "ContainerRegistryWebhookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryWebhookResource(Client, ContainerRegistryWebhookData.DeserializeContainerRegistryWebhookData(e)), _containerRegistryWebhookWebhooksClientDiagnostics, Pipeline, "ContainerRegistryWebhookCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerRegistryWebhookWebhooksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerRegistryWebhookWebhooksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryWebhookResource(Client, ContainerRegistryWebhookData.DeserializeContainerRegistryWebhookData(e)), _containerRegistryWebhookWebhooksClientDiagnostics, Pipeline, "ContainerRegistryWebhookCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryWebhookResource(Client, ContainerRegistryWebhookData.DeserializeContainerRegistryWebhookData(e)), _containerRegistryWebhookWebhooksClientDiagnostics, Pipeline, "ContainerRegistryWebhookCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookData.cs index 71f9727f318f..b8a9aa64cf38 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ContainerRegistryWebhookData : TrackedResourceData { - /// Initializes a new instance of ContainerRegistryWebhookData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerRegistryWebhookData(AzureLocation location) : base(location) { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryWebhookData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,12 +40,19 @@ public ContainerRegistryWebhookData(AzureLocation location) : base(location) /// The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. /// The list of actions that trigger the webhook to post notifications. /// The provisioning state of the webhook at the time the operation was called. - internal ContainerRegistryWebhookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerRegistryWebhookStatus? status, string scope, IList actions, ContainerRegistryProvisioningState? provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerRegistryWebhookStatus? status, string scope, IList actions, ContainerRegistryProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Status = status; Scope = scope; Actions = actions; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryWebhookData() + { } /// The status of the webhook at the time the operation was called. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 027fb12f1d78..040bf8f0b2b1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -125,7 +125,7 @@ public virtual AsyncPageable GetContainerRegistriesAs { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerRegistryRegistriesRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerRegistryRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerRegistries", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerRegistries", "value", "nextLink", cancellationToken); } /// @@ -147,7 +147,7 @@ public virtual Pageable GetContainerRegistries(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerRegistryRegistriesRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerRegistryRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerRegistries", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerRegistries", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolData.Serialization.cs index 97917a79d239..7fe042f11890 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryAgentPoolData : IUtf8JsonSerializable + public partial class ContainerRegistryAgentPoolData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -54,11 +61,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(VirtualNetworkSubnetResourceId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryAgentPoolData DeserializeContainerRegistryAgentPoolData(JsonElement element) + internal static ContainerRegistryAgentPoolData DeserializeContainerRegistryAgentPoolData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +95,7 @@ internal static ContainerRegistryAgentPoolData DeserializeContainerRegistryAgent Optional os = default; Optional virtualNetworkSubnetResourceId = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -172,8 +194,61 @@ internal static ContainerRegistryAgentPoolData DeserializeContainerRegistryAgent } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryAgentPoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(count), tier.Value, Optional.ToNullable(os), virtualNetworkSubnetResourceId.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ContainerRegistryAgentPoolData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryAgentPoolData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryAgentPoolData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryAgentPoolData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryAgentPoolData model) + { + if (model is null) + { + return null; } - return new ContainerRegistryAgentPoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(count), tier.Value, Optional.ToNullable(os), virtualNetworkSubnetResourceId.Value, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryAgentPoolData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryAgentPoolData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.Serialization.cs index 8d72f6f2cfca..c76a7ac07f9b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryAgentPoolListResult + internal partial class ContainerRegistryAgentPoolListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryAgentPoolListResult DeserializeContainerRegistryAgentPoolListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryAgentPoolListResult DeserializeContainerRegistryAgentPoolListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryAgentPoolListResult DeserializeContainerRegistr nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryAgentPoolListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryAgentPoolListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryAgentPoolListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryAgentPoolListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryAgentPoolListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryAgentPoolListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryAgentPoolListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryAgentPoolListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryAgentPoolListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.cs index 76f6c130c25e..305a44b2131d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The collection of agent pools. internal partial class ContainerRegistryAgentPoolListResult { - /// Initializes a new instance of ContainerRegistryAgentPoolListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryAgentPoolListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryAgentPoolListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal ContainerRegistryAgentPoolListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryAgentPoolListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.Serialization.cs index cc37983ed38a..616fd516c571 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryAgentPoolPatch : IUtf8JsonSerializable + public partial class ContainerRegistryAgentPoolPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(Count.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryAgentPoolPatch DeserializeContainerRegistryAgentPoolPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("count"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property0.Value.GetInt32(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryAgentPoolPatch(Optional.ToDictionary(tags), Optional.ToNullable(count), serializedAdditionalRawData); + } + + ContainerRegistryAgentPoolPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryAgentPoolPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryAgentPoolPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryAgentPoolPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryAgentPoolPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryAgentPoolPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryAgentPoolPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.cs index bc3923564684..c89991f0d5b8 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating an agent pool. public partial class ContainerRegistryAgentPoolPatch { - /// Initializes a new instance of ContainerRegistryAgentPoolPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryAgentPoolPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The ARM resource tags. + /// The count of agent machine. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryAgentPoolPatch(IDictionary tags, int? count, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The ARM resource tags. public IDictionary Tags { get; } /// The count of agent machine. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.Serialization.cs index 83140b7e2927..eff71f62d40c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryAgentPoolQueueStatus + public partial class ContainerRegistryAgentPoolQueueStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryAgentPoolQueueStatus DeserializeContainerRegistryAgentPoolQueueStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryAgentPoolQueueStatus DeserializeContainerRegistryAgentPoolQueueStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -30,8 +64,61 @@ internal static ContainerRegistryAgentPoolQueueStatus DeserializeContainerRegist count = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryAgentPoolQueueStatus(Optional.ToNullable(count)); + return new ContainerRegistryAgentPoolQueueStatus(Optional.ToNullable(count), serializedAdditionalRawData); + } + + ContainerRegistryAgentPoolQueueStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryAgentPoolQueueStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryAgentPoolQueueStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryAgentPoolQueueStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryAgentPoolQueueStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryAgentPoolQueueStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryAgentPoolQueueStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.cs index 3076520ffd5c..f9b9c4eccb47 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentPoolQueueStatus.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The QueueStatus of Agent Pool. public partial class ContainerRegistryAgentPoolQueueStatus { - /// Initializes a new instance of ContainerRegistryAgentPoolQueueStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryAgentPoolQueueStatus() { } - /// Initializes a new instance of ContainerRegistryAgentPoolQueueStatus. + /// Initializes a new instance of . /// The number of pending runs in the queue. - internal ContainerRegistryAgentPoolQueueStatus(int? count) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryAgentPoolQueueStatus(int? count, Dictionary serializedAdditionalRawData) { Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of pending runs in the queue. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.Serialization.cs index ccaa85e56b2a..af45b0f19573 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryAgentProperties : IUtf8JsonSerializable + internal partial class ContainerRegistryAgentProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Cpu)) { writer.WritePropertyName("cpu"u8); writer.WriteNumberValue(Cpu.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryAgentProperties DeserializeContainerRegistryAgentProperties(JsonElement element) + internal static ContainerRegistryAgentProperties DeserializeContainerRegistryAgentProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cpu = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpu"u8)) @@ -41,8 +64,61 @@ internal static ContainerRegistryAgentProperties DeserializeContainerRegistryAge cpu = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryAgentProperties(Optional.ToNullable(cpu), serializedAdditionalRawData); + } + + ContainerRegistryAgentProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryAgentProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryAgentProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryAgentProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryAgentProperties model) + { + if (model is null) + { + return null; } - return new ContainerRegistryAgentProperties(Optional.ToNullable(cpu)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryAgentProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryAgentProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.cs index e0a76889aeaa..4d878cbf1f4b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryAgentProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The properties that determine the run agent configuration. internal partial class ContainerRegistryAgentProperties { - /// Initializes a new instance of ContainerRegistryAgentProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryAgentProperties() { } - /// Initializes a new instance of ContainerRegistryAgentProperties. + /// Initializes a new instance of . /// The CPU configuration in terms of number of cores required for the run. - internal ContainerRegistryAgentProperties(int? cpu) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryAgentProperties(int? cpu, Dictionary serializedAdditionalRawData) { Cpu = cpu; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The CPU configuration in terms of number of cores required for the run. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.Serialization.cs index d1da8c07d518..1f1d6c21c037 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryBaseImageDependency + public partial class ContainerRegistryBaseImageDependency : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryBaseImageDependency DeserializeContainerRegistryBaseImageDependency(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DependencyType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DependencyType.Value.ToString()); + } + if (Optional.IsDefined(Registry)) + { + writer.WritePropertyName("registry"u8); + writer.WriteStringValue(Registry); + } + if (Optional.IsDefined(Repository)) + { + writer.WritePropertyName("repository"u8); + writer.WriteStringValue(Repository); + } + if (Optional.IsDefined(Tag)) + { + writer.WritePropertyName("tag"u8); + writer.WriteStringValue(Tag); + } + if (Optional.IsDefined(Digest)) + { + writer.WritePropertyName("digest"u8); + writer.WriteStringValue(Digest); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryBaseImageDependency DeserializeContainerRegistryBaseImageDependency(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static ContainerRegistryBaseImageDependency DeserializeContainerRegistr Optional repository = default; Optional tag = default; Optional digest = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -54,8 +108,61 @@ internal static ContainerRegistryBaseImageDependency DeserializeContainerRegistr digest = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryBaseImageDependency(Optional.ToNullable(type), registry.Value, repository.Value, tag.Value, digest.Value); + return new ContainerRegistryBaseImageDependency(Optional.ToNullable(type), registry.Value, repository.Value, tag.Value, digest.Value, serializedAdditionalRawData); + } + + ContainerRegistryBaseImageDependency IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryBaseImageDependency(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryBaseImageDependency IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryBaseImageDependency(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryBaseImageDependency model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryBaseImageDependency(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryBaseImageDependency(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.cs index 7d66be7a4fa2..3e9c3bfa8820 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageDependency.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// Properties that describe a base image dependency. public partial class ContainerRegistryBaseImageDependency { - /// Initializes a new instance of ContainerRegistryBaseImageDependency. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryBaseImageDependency() { } - /// Initializes a new instance of ContainerRegistryBaseImageDependency. + /// Initializes a new instance of . /// The type of the base image dependency. /// The registry login server. /// The repository name. /// The tag name. /// The sha256-based digest of the image manifest. - internal ContainerRegistryBaseImageDependency(ContainerRegistryBaseImageDependencyType? dependencyType, string registry, string repository, string tag, string digest) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryBaseImageDependency(ContainerRegistryBaseImageDependencyType? dependencyType, string registry, string repository, string tag, string digest, Dictionary serializedAdditionalRawData) { DependencyType = dependencyType; Registry = registry; Repository = repository; Tag = tag; Digest = digest; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the base image dependency. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.Serialization.cs index 8667c723d3a7..d5323e018396 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryBaseImageTrigger : IUtf8JsonSerializable + public partial class ContainerRegistryBaseImageTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("baseImageTriggerType"u8); writer.WriteStringValue(BaseImageTriggerType.ToString()); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryBaseImageTrigger DeserializeContainerRegistryBaseImageTrigger(JsonElement element) + internal static ContainerRegistryBaseImageTrigger DeserializeContainerRegistryBaseImageTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerRegistryBaseImageTrigger DeserializeContainerRegistryBa Optional updateTriggerPayloadType = default; Optional status = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("baseImageTriggerType"u8)) @@ -83,8 +106,61 @@ internal static ContainerRegistryBaseImageTrigger DeserializeContainerRegistryBa name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryBaseImageTrigger(baseImageTriggerType, updateTriggerEndpoint.Value, Optional.ToNullable(updateTriggerPayloadType), Optional.ToNullable(status), name, serializedAdditionalRawData); + } + + ContainerRegistryBaseImageTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryBaseImageTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryBaseImageTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryBaseImageTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryBaseImageTrigger model) + { + if (model is null) + { + return null; } - return new ContainerRegistryBaseImageTrigger(baseImageTriggerType, updateTriggerEndpoint.Value, Optional.ToNullable(updateTriggerPayloadType), Optional.ToNullable(status), name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryBaseImageTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryBaseImageTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.cs index 0b9188c383b0..7123fc8cf7da 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTrigger.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The trigger based on base image dependency. public partial class ContainerRegistryBaseImageTrigger { - /// Initializes a new instance of ContainerRegistryBaseImageTrigger. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of the auto trigger for base image dependency updates. /// The name of the trigger. /// is null. @@ -25,19 +29,26 @@ public ContainerRegistryBaseImageTrigger(ContainerRegistryBaseImageTriggerType b Name = name; } - /// Initializes a new instance of ContainerRegistryBaseImageTrigger. + /// Initializes a new instance of . /// The type of the auto trigger for base image dependency updates. /// The endpoint URL for receiving update triggers. /// Type of Payload body for Base image update triggers. /// The current status of trigger. /// The name of the trigger. - internal ContainerRegistryBaseImageTrigger(ContainerRegistryBaseImageTriggerType baseImageTriggerType, string updateTriggerEndpoint, ContainerRegistryUpdateTriggerPayloadType? updateTriggerPayloadType, ContainerRegistryTriggerStatus? status, string name) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryBaseImageTrigger(ContainerRegistryBaseImageTriggerType baseImageTriggerType, string updateTriggerEndpoint, ContainerRegistryUpdateTriggerPayloadType? updateTriggerPayloadType, ContainerRegistryTriggerStatus? status, string name, Dictionary serializedAdditionalRawData) { BaseImageTriggerType = baseImageTriggerType; UpdateTriggerEndpoint = updateTriggerEndpoint; UpdateTriggerPayloadType = updateTriggerPayloadType; Status = status; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryBaseImageTrigger() + { } /// The type of the auto trigger for base image dependency updates. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.Serialization.cs index 2641aa160830..b2b47134009f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryBaseImageTriggerUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryBaseImageTriggerUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BaseImageTriggerType)) { @@ -37,7 +45,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryBaseImageTriggerUpdateContent DeserializeContainerRegistryBaseImageTriggerUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional baseImageTriggerType = default; + Optional updateTriggerEndpoint = default; + Optional updateTriggerPayloadType = default; + Optional status = default; + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("baseImageTriggerType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baseImageTriggerType = new ContainerRegistryBaseImageTriggerType(property.Value.GetString()); + continue; + } + if (property.NameEquals("updateTriggerEndpoint"u8)) + { + updateTriggerEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("updateTriggerPayloadType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updateTriggerPayloadType = new ContainerRegistryUpdateTriggerPayloadType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryTriggerStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryBaseImageTriggerUpdateContent(Optional.ToNullable(baseImageTriggerType), updateTriggerEndpoint.Value, Optional.ToNullable(updateTriggerPayloadType), Optional.ToNullable(status), name, serializedAdditionalRawData); + } + + ContainerRegistryBaseImageTriggerUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryBaseImageTriggerUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryBaseImageTriggerUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryBaseImageTriggerUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryBaseImageTriggerUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryBaseImageTriggerUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryBaseImageTriggerUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.cs index 86d23fe63399..3686d568aec1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryBaseImageTriggerUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating base image dependency trigger. public partial class ContainerRegistryBaseImageTriggerUpdateContent { - /// Initializes a new instance of ContainerRegistryBaseImageTriggerUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the trigger. /// is null. public ContainerRegistryBaseImageTriggerUpdateContent(string name) @@ -23,6 +27,28 @@ public ContainerRegistryBaseImageTriggerUpdateContent(string name) Name = name; } + /// Initializes a new instance of . + /// The type of the auto trigger for base image dependency updates. + /// The endpoint URL for receiving update triggers. + /// Type of Payload body for Base image update triggers. + /// The current status of trigger. + /// The name of the trigger. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryBaseImageTriggerUpdateContent(ContainerRegistryBaseImageTriggerType? baseImageTriggerType, string updateTriggerEndpoint, ContainerRegistryUpdateTriggerPayloadType? updateTriggerPayloadType, ContainerRegistryTriggerStatus? status, string name, Dictionary serializedAdditionalRawData) + { + BaseImageTriggerType = baseImageTriggerType; + UpdateTriggerEndpoint = updateTriggerEndpoint; + UpdateTriggerPayloadType = updateTriggerPayloadType; + Status = status; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryBaseImageTriggerUpdateContent() + { + } + /// The type of the auto trigger for base image dependency updates. public ContainerRegistryBaseImageTriggerType? BaseImageTriggerType { get; set; } /// The endpoint URL for receiving update triggers. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.Serialization.cs index 2eb67986570c..8151a7f941b1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryCredentialRegenerateContent : IUtf8JsonSerializable + public partial class ContainerRegistryCredentialRegenerateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryCredentialRegenerateContent DeserializeContainerRegistryCredentialRegenerateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContainerRegistryPasswordName name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString().ToContainerRegistryPasswordName(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryCredentialRegenerateContent(name, serializedAdditionalRawData); + } + + ContainerRegistryCredentialRegenerateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryCredentialRegenerateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryCredentialRegenerateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryCredentialRegenerateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryCredentialRegenerateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryCredentialRegenerateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryCredentialRegenerateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.cs index bc1c9fd058f6..e4ff1c3ecbd9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentialRegenerateContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The parameters used to regenerate the login credential. public partial class ContainerRegistryCredentialRegenerateContent { - /// Initializes a new instance of ContainerRegistryCredentialRegenerateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies name of the password which should be regenerated -- password or password2. public ContainerRegistryCredentialRegenerateContent(ContainerRegistryPasswordName name) { Name = name; } + /// Initializes a new instance of . + /// Specifies name of the password which should be regenerated -- password or password2. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryCredentialRegenerateContent(ContainerRegistryPasswordName name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryCredentialRegenerateContent() + { + } + /// Specifies name of the password which should be regenerated -- password or password2. public ContainerRegistryPasswordName Name { get; } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.Serialization.cs index fe19235dadc2..bb118e69d4ed 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryCredentials : IUtf8JsonSerializable + public partial class ContainerRegistryCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceRegistry)) { writer.WritePropertyName("sourceRegistry"u8); - writer.WriteObjectValue(SourceRegistry); + if (SourceRegistry is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceRegistry).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(CustomRegistries)) { @@ -28,21 +42,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in CustomRegistries) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryCredentials DeserializeContainerRegistryCredentials(JsonElement element) + internal static ContainerRegistryCredentials DeserializeContainerRegistryCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sourceRegistry = default; Optional> customRegistries = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceRegistry"u8)) @@ -68,8 +104,61 @@ internal static ContainerRegistryCredentials DeserializeContainerRegistryCredent customRegistries = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryCredentials(sourceRegistry.Value, Optional.ToDictionary(customRegistries), serializedAdditionalRawData); + } + + ContainerRegistryCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryCredentials model) + { + if (model is null) + { + return null; } - return new ContainerRegistryCredentials(sourceRegistry.Value, Optional.ToDictionary(customRegistries)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.cs index 1d0139d9a837..fd901dc30694 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryCredentials.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters that describes a set of credentials that will be used when a run is invoked. public partial class ContainerRegistryCredentials { - /// Initializes a new instance of ContainerRegistryCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryCredentials() { CustomRegistries = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerRegistryCredentials. + /// Initializes a new instance of . /// Describes the credential parameters for accessing the source registry. /// /// Describes the credential parameters for accessing other custom registries. The key /// for the dictionary item will be the registry login server (myregistry.azurecr.io) and /// the value of the item will be the registry credentials for accessing the registry. /// - internal ContainerRegistryCredentials(SourceRegistryCredentials sourceRegistry, IDictionary customRegistries) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryCredentials(SourceRegistryCredentials sourceRegistry, IDictionary customRegistries, Dictionary serializedAdditionalRawData) { SourceRegistry = sourceRegistry; CustomRegistries = customRegistries; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the credential parameters for accessing the source registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryData.Serialization.cs index 2b780e7c156b..a681f9797dff 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryData.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryData : IUtf8JsonSerializable + public partial class ContainerRegistryData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -49,17 +62,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkRuleSet)) { writer.WritePropertyName("networkRuleSet"u8); - writer.WriteObjectValue(NetworkRuleSet); + if (NetworkRuleSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkRuleSet).Serialize(writer, options); + } } if (Optional.IsDefined(Policies)) { writer.WritePropertyName("policies"u8); - writer.WriteObjectValue(Policies); + if (Policies is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policies).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(IsDataEndpointEnabled)) { @@ -82,11 +116,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ZoneRedundancy.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryData DeserializeContainerRegistryData(JsonElement element) + internal static ContainerRegistryData DeserializeContainerRegistryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,6 +161,7 @@ internal static ContainerRegistryData DeserializeContainerRegistryData(JsonEleme Optional publicNetworkAccess = default; Optional networkRuleBypassOptions = default; Optional zoneRedundancy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -316,8 +365,61 @@ internal static ContainerRegistryData DeserializeContainerRegistryData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, loginServer.Value, Optional.ToNullable(creationDate), Optional.ToNullable(provisioningState), status.Value, Optional.ToNullable(adminUserEnabled), networkRuleSet.Value, policies.Value, encryption.Value, Optional.ToNullable(dataEndpointEnabled), Optional.ToList(dataEndpointHostNames), Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(networkRuleBypassOptions), Optional.ToNullable(zoneRedundancy)); + return new ContainerRegistryData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, loginServer.Value, Optional.ToNullable(creationDate), Optional.ToNullable(provisioningState), status.Value, Optional.ToNullable(adminUserEnabled), networkRuleSet.Value, policies.Value, encryption.Value, Optional.ToNullable(dataEndpointEnabled), Optional.ToList(dataEndpointHostNames), Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(networkRuleBypassOptions), Optional.ToNullable(zoneRedundancy), serializedAdditionalRawData); + } + + ContainerRegistryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.Serialization.cs index 842585fc8d53..57cf0b919d4b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryDockerBuildContent : IUtf8JsonSerializable + public partial class ContainerRegistryDockerBuildContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ImageNames)) { @@ -49,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Arguments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -59,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(TimeoutInSeconds.Value); } writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } if (Optional.IsDefined(AgentConfiguration)) { writer.WritePropertyName("agentConfiguration"u8); - writer.WriteObjectValue(AgentConfiguration); + if (AgentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AgentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(SourceLocation)) { @@ -73,7 +101,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(RunRequestType); @@ -92,11 +127,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logTemplate"u8); writer.WriteStringValue(LogTemplate); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryDockerBuildContent DeserializeContainerRegistryDockerBuildContent(JsonElement element) + internal static ContainerRegistryDockerBuildContent DeserializeContainerRegistryDockerBuildContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -116,6 +165,7 @@ internal static ContainerRegistryDockerBuildContent DeserializeContainerRegistry Optional isArchiveEnabled = default; Optional agentPoolName = default; Optional logTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageNames"u8)) @@ -235,8 +285,61 @@ internal static ContainerRegistryDockerBuildContent DeserializeContainerRegistry logTemplate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryDockerBuildContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, Optional.ToList(imageNames), Optional.ToNullable(isPushEnabled), Optional.ToNullable(noCache), dockerFilePath, target.Value, Optional.ToList(arguments), Optional.ToNullable(timeout), platform, agentConfiguration.Value, sourceLocation.Value, credentials.Value); + return new ContainerRegistryDockerBuildContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, Optional.ToList(imageNames), Optional.ToNullable(isPushEnabled), Optional.ToNullable(noCache), dockerFilePath, target.Value, Optional.ToList(arguments), Optional.ToNullable(timeout), platform, agentConfiguration.Value, sourceLocation.Value, credentials.Value, serializedAdditionalRawData); + } + + ContainerRegistryDockerBuildContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryDockerBuildContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryDockerBuildContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryDockerBuildContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryDockerBuildContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryDockerBuildContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryDockerBuildContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.cs index 2c0d7bca1bf5..771ad24ad235 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildContent.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for a docker quick build. public partial class ContainerRegistryDockerBuildContent : ContainerRegistryRunContent { - /// Initializes a new instance of ContainerRegistryDockerBuildContent. + /// Initializes a new instance of . /// The Docker file path relative to the source location. /// The platform properties against which the run has to happen. /// or is null. @@ -30,7 +30,7 @@ public ContainerRegistryDockerBuildContent(string dockerFilePath, ContainerRegis RunRequestType = "DockerBuildRequest"; } - /// Initializes a new instance of ContainerRegistryDockerBuildContent. + /// Initializes a new instance of . /// The type of the run request. /// The value that indicates whether archiving is enabled for the run or not. /// The dedicated agent pool for the run. @@ -49,7 +49,8 @@ public ContainerRegistryDockerBuildContent(string dockerFilePath, ContainerRegis /// If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. /// /// The properties that describes a set of credentials that will be used when this run is invoked. - internal ContainerRegistryDockerBuildContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, IList imageNames, bool? isPushEnabled, bool? noCache, string dockerFilePath, string target, IList arguments, int? timeoutInSeconds, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceLocation, ContainerRegistryCredentials credentials) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryDockerBuildContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, IList imageNames, bool? isPushEnabled, bool? noCache, string dockerFilePath, string target, IList arguments, int? timeoutInSeconds, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceLocation, ContainerRegistryCredentials credentials, Dictionary serializedAdditionalRawData) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate, serializedAdditionalRawData) { ImageNames = imageNames; IsPushEnabled = isPushEnabled; @@ -65,6 +66,11 @@ internal ContainerRegistryDockerBuildContent(string runRequestType, bool? isArch RunRequestType = runRequestType ?? "DockerBuildRequest"; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryDockerBuildContent() + { + } + /// The fully qualified image names including the repository and tag. public IList ImageNames { get; } /// The value of this property indicates whether the image built should be pushed to the registry or not. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.Serialization.cs index 38efa6af98ff..621e591a5404 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryDockerBuildStep : IUtf8JsonSerializable + public partial class ContainerRegistryDockerBuildStep : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ImageNames)) { @@ -49,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Arguments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -65,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryDockerBuildStep DeserializeContainerRegistryDockerBuildStep(JsonElement element) + internal static ContainerRegistryDockerBuildStep DeserializeContainerRegistryDockerBuildStep(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +112,7 @@ internal static ContainerRegistryDockerBuildStep DeserializeContainerRegistryDoc Optional> baseImageDependencies = default; Optional contextPath = default; Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageNames"u8)) @@ -171,8 +200,61 @@ internal static ContainerRegistryDockerBuildStep DeserializeContainerRegistryDoc contextAccessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryDockerBuildStep(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, Optional.ToList(imageNames), Optional.ToNullable(isPushEnabled), Optional.ToNullable(noCache), dockerFilePath, target.Value, Optional.ToList(arguments), serializedAdditionalRawData); + } + + ContainerRegistryDockerBuildStep IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryDockerBuildStep(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryDockerBuildStep IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryDockerBuildStep(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryDockerBuildStep model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryDockerBuildStep(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryDockerBuildStep(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, Optional.ToList(imageNames), Optional.ToNullable(isPushEnabled), Optional.ToNullable(noCache), dockerFilePath, target.Value, Optional.ToList(arguments)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryDockerBuildStep(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.cs index 3477c9975420..7ce9fbc7a2b4 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStep.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The Docker build step. public partial class ContainerRegistryDockerBuildStep : ContainerRegistryTaskStepProperties { - /// Initializes a new instance of ContainerRegistryDockerBuildStep. + /// Initializes a new instance of . /// The Docker file path relative to the source context. /// is null. public ContainerRegistryDockerBuildStep(string dockerFilePath) @@ -27,7 +27,7 @@ public ContainerRegistryDockerBuildStep(string dockerFilePath) ContainerRegistryTaskStepType = ContainerRegistryTaskStepType.Docker; } - /// Initializes a new instance of ContainerRegistryDockerBuildStep. + /// Initializes a new instance of . /// The type of the step. /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. @@ -38,7 +38,8 @@ public ContainerRegistryDockerBuildStep(string dockerFilePath) /// The Docker file path relative to the source context. /// The name of the target build stage for the docker build. /// The collection of override arguments to be used when executing this build step. - internal ContainerRegistryDockerBuildStep(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, IList imageNames, bool? isPushEnabled, bool? noCache, string dockerFilePath, string target, IList arguments) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryDockerBuildStep(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, IList imageNames, bool? isPushEnabled, bool? noCache, string dockerFilePath, string target, IList arguments, Dictionary serializedAdditionalRawData) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken, serializedAdditionalRawData) { ImageNames = imageNames; IsPushEnabled = isPushEnabled; @@ -49,6 +50,11 @@ internal ContainerRegistryDockerBuildStep(ContainerRegistryTaskStepType containe ContainerRegistryTaskStepType = containerRegistryTaskStepType; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryDockerBuildStep() + { + } + /// The fully qualified image names including the repository and tag. public IList ImageNames { get; } /// The value of this property indicates whether the image built should be pushed to the registry or not. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.Serialization.cs index c28e1cb85d5b..c6882110214a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryDockerBuildStepUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryDockerBuildStepUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ImageNames)) { @@ -46,7 +54,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Arguments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -67,7 +82,167 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryDockerBuildStepUpdateContent DeserializeContainerRegistryDockerBuildStepUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> imageNames = default; + Optional isPushEnabled = default; + Optional noCache = default; + Optional dockerFilePath = default; + Optional> arguments = default; + Optional target = default; + ContainerRegistryTaskStepType type = default; + Optional contextPath = default; + Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + imageNames = array; + continue; + } + if (property.NameEquals("isPushEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isPushEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("noCache"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + noCache = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("dockerFilePath"u8)) + { + dockerFilePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerRegistryRunArgument.DeserializeContainerRegistryRunArgument(item)); + } + arguments = array; + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ContainerRegistryTaskStepType(property.Value.GetString()); + continue; + } + if (property.NameEquals("contextPath"u8)) + { + contextPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("contextAccessToken"u8)) + { + contextAccessToken = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryDockerBuildStepUpdateContent(type, contextPath.Value, contextAccessToken.Value, Optional.ToList(imageNames), Optional.ToNullable(isPushEnabled), Optional.ToNullable(noCache), dockerFilePath.Value, Optional.ToList(arguments), target.Value, serializedAdditionalRawData); + } + + ContainerRegistryDockerBuildStepUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryDockerBuildStepUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryDockerBuildStepUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryDockerBuildStepUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryDockerBuildStepUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryDockerBuildStepUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryDockerBuildStepUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.cs index 2ed9863cd8f7..2b7474e50506 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryDockerBuildStepUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating a docker build step. public partial class ContainerRegistryDockerBuildStepUpdateContent : ContainerRegistryTaskStepUpdateContent { - /// Initializes a new instance of ContainerRegistryDockerBuildStepUpdateContent. + /// Initializes a new instance of . public ContainerRegistryDockerBuildStepUpdateContent() { ImageNames = new ChangeTrackingList(); @@ -21,6 +22,28 @@ public ContainerRegistryDockerBuildStepUpdateContent() StepType = ContainerRegistryTaskStepType.Docker; } + /// Initializes a new instance of . + /// The type of the step. + /// The URL(absolute or relative) of the source context for the task step. + /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. + /// The fully qualified image names including the repository and tag. + /// The value of this property indicates whether the image built should be pushed to the registry or not. + /// The value of this property indicates whether the image cache is enabled or not. + /// The Docker file path relative to the source context. + /// The collection of override arguments to be used when executing this build step. + /// The name of the target build stage for the docker build. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryDockerBuildStepUpdateContent(ContainerRegistryTaskStepType stepType, string contextPath, string contextAccessToken, IList imageNames, bool? isPushEnabled, bool? noCache, string dockerFilePath, IList arguments, string target, Dictionary serializedAdditionalRawData) : base(stepType, contextPath, contextAccessToken, serializedAdditionalRawData) + { + ImageNames = imageNames; + IsPushEnabled = isPushEnabled; + NoCache = noCache; + DockerFilePath = dockerFilePath; + Arguments = arguments; + Target = target; + StepType = stepType; + } + /// The fully qualified image names including the repository and tag. public IList ImageNames { get; } /// The value of this property indicates whether the image built should be pushed to the registry or not. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.Serialization.cs index 3fa6442d8a25..fe8bd7a3bcc2 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryEncodedTaskRunContent : IUtf8JsonSerializable + public partial class ContainerRegistryEncodedTaskRunContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("encodedTaskContent"u8); writer.WriteStringValue(EncodedTaskContent); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(TimeoutInSeconds.Value); } writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } if (Optional.IsDefined(AgentConfiguration)) { writer.WritePropertyName("agentConfiguration"u8); - writer.WriteObjectValue(AgentConfiguration); + if (AgentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AgentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(SourceLocation)) { @@ -53,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(RunRequestType); @@ -72,11 +107,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logTemplate"u8); writer.WriteStringValue(LogTemplate); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryEncodedTaskRunContent DeserializeContainerRegistryEncodedTaskRunContent(JsonElement element) + internal static ContainerRegistryEncodedTaskRunContent DeserializeContainerRegistryEncodedTaskRunContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,6 +142,7 @@ internal static ContainerRegistryEncodedTaskRunContent DeserializeContainerRegis Optional isArchiveEnabled = default; Optional agentPoolName = default; Optional logTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("encodedTaskContent"u8)) @@ -180,8 +230,61 @@ internal static ContainerRegistryEncodedTaskRunContent DeserializeContainerRegis logTemplate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryEncodedTaskRunContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, encodedTaskContent, encodedValuesContent.Value, Optional.ToList(values), Optional.ToNullable(timeout), platform, agentConfiguration.Value, sourceLocation.Value, credentials.Value); + return new ContainerRegistryEncodedTaskRunContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, encodedTaskContent, encodedValuesContent.Value, Optional.ToList(values), Optional.ToNullable(timeout), platform, agentConfiguration.Value, sourceLocation.Value, credentials.Value, serializedAdditionalRawData); + } + + ContainerRegistryEncodedTaskRunContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryEncodedTaskRunContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryEncodedTaskRunContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryEncodedTaskRunContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryEncodedTaskRunContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryEncodedTaskRunContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryEncodedTaskRunContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.cs index 61b5d9db0e0b..c5dca6914d1e 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskRunContent.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for a quick task run request. public partial class ContainerRegistryEncodedTaskRunContent : ContainerRegistryRunContent { - /// Initializes a new instance of ContainerRegistryEncodedTaskRunContent. + /// Initializes a new instance of . /// Base64 encoded value of the template/definition file content. /// The platform properties against which the run has to happen. /// or is null. @@ -29,7 +29,7 @@ public ContainerRegistryEncodedTaskRunContent(string encodedTaskContent, Contain RunRequestType = "EncodedTaskRunRequest"; } - /// Initializes a new instance of ContainerRegistryEncodedTaskRunContent. + /// Initializes a new instance of . /// The type of the run request. /// The value that indicates whether archiving is enabled for the run or not. /// The dedicated agent pool for the run. @@ -45,7 +45,8 @@ public ContainerRegistryEncodedTaskRunContent(string encodedTaskContent, Contain /// If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. /// /// The properties that describes a set of credentials that will be used when this run is invoked. - internal ContainerRegistryEncodedTaskRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, string encodedTaskContent, string encodedValuesContent, IList values, int? timeoutInSeconds, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceLocation, ContainerRegistryCredentials credentials) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryEncodedTaskRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, string encodedTaskContent, string encodedValuesContent, IList values, int? timeoutInSeconds, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceLocation, ContainerRegistryCredentials credentials, Dictionary serializedAdditionalRawData) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate, serializedAdditionalRawData) { EncodedTaskContent = encodedTaskContent; EncodedValuesContent = encodedValuesContent; @@ -58,6 +59,11 @@ internal ContainerRegistryEncodedTaskRunContent(string runRequestType, bool? isA RunRequestType = runRequestType ?? "EncodedTaskRunRequest"; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryEncodedTaskRunContent() + { + } + /// Base64 encoded value of the template/definition file content. public string EncodedTaskContent { get; set; } /// Base64 encoded value of the parameters/values file content. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.Serialization.cs index e9133875d22c..d34d70dc23c7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryEncodedTaskStep : IUtf8JsonSerializable + public partial class ContainerRegistryEncodedTaskStep : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("encodedTaskContent"u8); writer.WriteStringValue(EncodedTaskContent); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -45,11 +59,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryEncodedTaskStep DeserializeContainerRegistryEncodedTaskStep(JsonElement element) + internal static ContainerRegistryEncodedTaskStep DeserializeContainerRegistryEncodedTaskStep(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +89,7 @@ internal static ContainerRegistryEncodedTaskStep DeserializeContainerRegistryEnc Optional> baseImageDependencies = default; Optional contextPath = default; Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("encodedTaskContent"u8)) @@ -116,8 +145,61 @@ internal static ContainerRegistryEncodedTaskStep DeserializeContainerRegistryEnc contextAccessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryEncodedTaskStep(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, encodedTaskContent, encodedValuesContent.Value, Optional.ToList(values), serializedAdditionalRawData); + } + + ContainerRegistryEncodedTaskStep IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryEncodedTaskStep(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryEncodedTaskStep IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryEncodedTaskStep(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryEncodedTaskStep model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryEncodedTaskStep(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryEncodedTaskStep(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, encodedTaskContent, encodedValuesContent.Value, Optional.ToList(values)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryEncodedTaskStep(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.cs index 4742ec16d89e..acbee4e3142a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStep.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a encoded task step. public partial class ContainerRegistryEncodedTaskStep : ContainerRegistryTaskStepProperties { - /// Initializes a new instance of ContainerRegistryEncodedTaskStep. + /// Initializes a new instance of . /// Base64 encoded value of the template/definition file content. /// is null. public ContainerRegistryEncodedTaskStep(string encodedTaskContent) @@ -26,7 +26,7 @@ public ContainerRegistryEncodedTaskStep(string encodedTaskContent) ContainerRegistryTaskStepType = ContainerRegistryTaskStepType.EncodedTask; } - /// Initializes a new instance of ContainerRegistryEncodedTaskStep. + /// Initializes a new instance of . /// The type of the step. /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. @@ -34,7 +34,8 @@ public ContainerRegistryEncodedTaskStep(string encodedTaskContent) /// Base64 encoded value of the template/definition file content. /// Base64 encoded value of the parameters/values file content. /// The collection of overridable values that can be passed when running a task. - internal ContainerRegistryEncodedTaskStep(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, string encodedTaskContent, string encodedValuesContent, IList values) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryEncodedTaskStep(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, string encodedTaskContent, string encodedValuesContent, IList values, Dictionary serializedAdditionalRawData) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken, serializedAdditionalRawData) { EncodedTaskContent = encodedTaskContent; EncodedValuesContent = encodedValuesContent; @@ -42,6 +43,11 @@ internal ContainerRegistryEncodedTaskStep(ContainerRegistryTaskStepType containe ContainerRegistryTaskStepType = containerRegistryTaskStepType; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryEncodedTaskStep() + { + } + /// Base64 encoded value of the template/definition file content. public string EncodedTaskContent { get; set; } /// Base64 encoded value of the parameters/values file content. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.Serialization.cs index 35ed8958eb40..f26b37ce5ea6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryEncodedTaskStepUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryEncodedTaskStepUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EncodedTaskContent)) { @@ -31,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,7 +62,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryEncodedTaskStepUpdateContent DeserializeContainerRegistryEncodedTaskStepUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional encodedTaskContent = default; + Optional encodedValuesContent = default; + Optional> values = default; + ContainerRegistryTaskStepType type = default; + Optional contextPath = default; + Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("encodedTaskContent"u8)) + { + encodedTaskContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("encodedValuesContent"u8)) + { + encodedValuesContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerRegistryTaskOverridableValue.DeserializeContainerRegistryTaskOverridableValue(item)); + } + values = array; + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ContainerRegistryTaskStepType(property.Value.GetString()); + continue; + } + if (property.NameEquals("contextPath"u8)) + { + contextPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("contextAccessToken"u8)) + { + contextAccessToken = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryEncodedTaskStepUpdateContent(type, contextPath.Value, contextAccessToken.Value, encodedTaskContent.Value, encodedValuesContent.Value, Optional.ToList(values), serializedAdditionalRawData); + } + + ContainerRegistryEncodedTaskStepUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryEncodedTaskStepUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryEncodedTaskStepUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryEncodedTaskStepUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryEncodedTaskStepUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryEncodedTaskStepUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryEncodedTaskStepUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.cs index 01e9da1e8cb5..30eb7a96b043 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncodedTaskStepUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,29 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating encoded task step. public partial class ContainerRegistryEncodedTaskStepUpdateContent : ContainerRegistryTaskStepUpdateContent { - /// Initializes a new instance of ContainerRegistryEncodedTaskStepUpdateContent. + /// Initializes a new instance of . public ContainerRegistryEncodedTaskStepUpdateContent() { Values = new ChangeTrackingList(); StepType = ContainerRegistryTaskStepType.EncodedTask; } + /// Initializes a new instance of . + /// The type of the step. + /// The URL(absolute or relative) of the source context for the task step. + /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. + /// Base64 encoded value of the template/definition file content. + /// Base64 encoded value of the parameters/values file content. + /// The collection of overridable values that can be passed when running a task. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryEncodedTaskStepUpdateContent(ContainerRegistryTaskStepType stepType, string contextPath, string contextAccessToken, string encodedTaskContent, string encodedValuesContent, IList values, Dictionary serializedAdditionalRawData) : base(stepType, contextPath, contextAccessToken, serializedAdditionalRawData) + { + EncodedTaskContent = encodedTaskContent; + EncodedValuesContent = encodedValuesContent; + Values = values; + StepType = stepType; + } + /// Base64 encoded value of the template/definition file content. public string EncodedTaskContent { get; set; } /// Base64 encoded value of the parameters/values file content. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.Serialization.cs index 9b89ede409fb..615ed6880f20 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryEncryption : IUtf8JsonSerializable + public partial class ContainerRegistryEncryption : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyVaultProperties)) { writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties); + if (KeyVaultProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyVaultProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerRegistryEncryption DeserializeContainerRegistryEncryption(JsonElement element) + internal static ContainerRegistryEncryption DeserializeContainerRegistryEncryption(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional keyVaultProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -56,8 +86,61 @@ internal static ContainerRegistryEncryption DeserializeContainerRegistryEncrypti keyVaultProperties = ContainerRegistryKeyVaultProperties.DeserializeContainerRegistryKeyVaultProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryEncryption(Optional.ToNullable(status), keyVaultProperties.Value, serializedAdditionalRawData); + } + + ContainerRegistryEncryption IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryEncryption(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryEncryption IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryEncryption(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryEncryption model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryEncryption(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryEncryption(Optional.ToNullable(status), keyVaultProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryEncryption(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.cs index f47db478d208..ed65b7ba45e6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryEncryption.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The ContainerRegistryEncryption. public partial class ContainerRegistryEncryption { - /// Initializes a new instance of ContainerRegistryEncryption. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryEncryption() { } - /// Initializes a new instance of ContainerRegistryEncryption. + /// Initializes a new instance of . /// Indicates whether or not the encryption is enabled for container registry. /// Key vault properties. - internal ContainerRegistryEncryption(ContainerRegistryEncryptionStatus? status, ContainerRegistryKeyVaultProperties keyVaultProperties) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryEncryption(ContainerRegistryEncryptionStatus? status, ContainerRegistryKeyVaultProperties keyVaultProperties, Dictionary serializedAdditionalRawData) { Status = status; KeyVaultProperties = keyVaultProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether or not the encryption is enabled for container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.Serialization.cs index bbf78339f72e..11c60fb6b129 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryExportPolicy : IUtf8JsonSerializable + internal partial class ContainerRegistryExportPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryExportPolicy DeserializeContainerRegistryExportPolicy(JsonElement element) + internal static ContainerRegistryExportPolicy DeserializeContainerRegistryExportPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -41,8 +64,61 @@ internal static ContainerRegistryExportPolicy DeserializeContainerRegistryExport status = new ContainerRegistryExportPolicyStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryExportPolicy(Optional.ToNullable(status), serializedAdditionalRawData); + } + + ContainerRegistryExportPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryExportPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryExportPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryExportPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryExportPolicy model) + { + if (model is null) + { + return null; } - return new ContainerRegistryExportPolicy(Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryExportPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryExportPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.cs index 9512150e525c..0c729eb25eee 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryExportPolicy.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The export policy for a container registry. internal partial class ContainerRegistryExportPolicy { - /// Initializes a new instance of ContainerRegistryExportPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryExportPolicy() { } - /// Initializes a new instance of ContainerRegistryExportPolicy. + /// Initializes a new instance of . /// The value that indicates whether the policy is enabled or not. - internal ContainerRegistryExportPolicy(ContainerRegistryExportPolicyStatus? status) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryExportPolicy(ContainerRegistryExportPolicyStatus? status, Dictionary serializedAdditionalRawData) { Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value that indicates whether the policy is enabled or not. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.Serialization.cs index 72f84d94d872..2ffc08678494 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryFileTaskRunContent : IUtf8JsonSerializable + public partial class ContainerRegistryFileTaskRunContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("taskFilePath"u8); writer.WriteStringValue(TaskFilePath); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(TimeoutInSeconds.Value); } writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } if (Optional.IsDefined(AgentConfiguration)) { writer.WritePropertyName("agentConfiguration"u8); - writer.WriteObjectValue(AgentConfiguration); + if (AgentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AgentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(SourceLocation)) { @@ -53,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(RunRequestType); @@ -72,11 +107,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logTemplate"u8); writer.WriteStringValue(LogTemplate); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryFileTaskRunContent DeserializeContainerRegistryFileTaskRunContent(JsonElement element) + internal static ContainerRegistryFileTaskRunContent DeserializeContainerRegistryFileTaskRunContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,6 +142,7 @@ internal static ContainerRegistryFileTaskRunContent DeserializeContainerRegistry Optional isArchiveEnabled = default; Optional agentPoolName = default; Optional logTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("taskFilePath"u8)) @@ -180,8 +230,61 @@ internal static ContainerRegistryFileTaskRunContent DeserializeContainerRegistry logTemplate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryFileTaskRunContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, taskFilePath, valuesFilePath.Value, Optional.ToList(values), Optional.ToNullable(timeout), platform, agentConfiguration.Value, sourceLocation.Value, credentials.Value); + return new ContainerRegistryFileTaskRunContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, taskFilePath, valuesFilePath.Value, Optional.ToList(values), Optional.ToNullable(timeout), platform, agentConfiguration.Value, sourceLocation.Value, credentials.Value, serializedAdditionalRawData); + } + + ContainerRegistryFileTaskRunContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryFileTaskRunContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryFileTaskRunContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryFileTaskRunContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryFileTaskRunContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryFileTaskRunContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryFileTaskRunContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.cs index b4abd39b402d..b5f11618e514 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskRunContent.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The request parameters for a scheduling run against a task file. public partial class ContainerRegistryFileTaskRunContent : ContainerRegistryRunContent { - /// Initializes a new instance of ContainerRegistryFileTaskRunContent. + /// Initializes a new instance of . /// The template/definition file path relative to the source. /// The platform properties against which the run has to happen. /// or is null. @@ -29,7 +29,7 @@ public ContainerRegistryFileTaskRunContent(string taskFilePath, ContainerRegistr RunRequestType = "FileTaskRunRequest"; } - /// Initializes a new instance of ContainerRegistryFileTaskRunContent. + /// Initializes a new instance of . /// The type of the run request. /// The value that indicates whether archiving is enabled for the run or not. /// The dedicated agent pool for the run. @@ -45,7 +45,8 @@ public ContainerRegistryFileTaskRunContent(string taskFilePath, ContainerRegistr /// If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. /// /// The properties that describes a set of credentials that will be used when this run is invoked. - internal ContainerRegistryFileTaskRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, string taskFilePath, string valuesFilePath, IList values, int? timeoutInSeconds, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceLocation, ContainerRegistryCredentials credentials) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryFileTaskRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, string taskFilePath, string valuesFilePath, IList values, int? timeoutInSeconds, ContainerRegistryPlatformProperties platform, ContainerRegistryAgentProperties agentConfiguration, string sourceLocation, ContainerRegistryCredentials credentials, Dictionary serializedAdditionalRawData) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate, serializedAdditionalRawData) { TaskFilePath = taskFilePath; ValuesFilePath = valuesFilePath; @@ -58,6 +59,11 @@ internal ContainerRegistryFileTaskRunContent(string runRequestType, bool? isArch RunRequestType = runRequestType ?? "FileTaskRunRequest"; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryFileTaskRunContent() + { + } + /// The template/definition file path relative to the source. public string TaskFilePath { get; set; } /// The values/parameters file path relative to the source. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.Serialization.cs index 335cfbb425cc..3f61263e998b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryFileTaskStep : IUtf8JsonSerializable + public partial class ContainerRegistryFileTaskStep : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("taskFilePath"u8); writer.WriteStringValue(TaskFilePath); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -45,11 +59,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryFileTaskStep DeserializeContainerRegistryFileTaskStep(JsonElement element) + internal static ContainerRegistryFileTaskStep DeserializeContainerRegistryFileTaskStep(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +89,7 @@ internal static ContainerRegistryFileTaskStep DeserializeContainerRegistryFileTa Optional> baseImageDependencies = default; Optional contextPath = default; Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("taskFilePath"u8)) @@ -116,8 +145,61 @@ internal static ContainerRegistryFileTaskStep DeserializeContainerRegistryFileTa contextAccessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryFileTaskStep(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, taskFilePath, valuesFilePath.Value, Optional.ToList(values), serializedAdditionalRawData); + } + + ContainerRegistryFileTaskStep IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryFileTaskStep(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryFileTaskStep IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryFileTaskStep(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryFileTaskStep model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryFileTaskStep(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryFileTaskStep(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, taskFilePath, valuesFilePath.Value, Optional.ToList(values)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryFileTaskStep(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.cs index 72782ede2d17..6750bd0455bb 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStep.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a task step. public partial class ContainerRegistryFileTaskStep : ContainerRegistryTaskStepProperties { - /// Initializes a new instance of ContainerRegistryFileTaskStep. + /// Initializes a new instance of . /// The task template/definition file path relative to the source context. /// is null. public ContainerRegistryFileTaskStep(string taskFilePath) @@ -26,7 +26,7 @@ public ContainerRegistryFileTaskStep(string taskFilePath) ContainerRegistryTaskStepType = ContainerRegistryTaskStepType.FileTask; } - /// Initializes a new instance of ContainerRegistryFileTaskStep. + /// Initializes a new instance of . /// The type of the step. /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. @@ -34,7 +34,8 @@ public ContainerRegistryFileTaskStep(string taskFilePath) /// The task template/definition file path relative to the source context. /// The task values/parameters file path relative to the source context. /// The collection of overridable values that can be passed when running a task. - internal ContainerRegistryFileTaskStep(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, string taskFilePath, string valuesFilePath, IList values) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryFileTaskStep(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, string taskFilePath, string valuesFilePath, IList values, Dictionary serializedAdditionalRawData) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken, serializedAdditionalRawData) { TaskFilePath = taskFilePath; ValuesFilePath = valuesFilePath; @@ -42,6 +43,11 @@ internal ContainerRegistryFileTaskStep(ContainerRegistryTaskStepType containerRe ContainerRegistryTaskStepType = containerRegistryTaskStepType; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryFileTaskStep() + { + } + /// The task template/definition file path relative to the source context. public string TaskFilePath { get; set; } /// The task values/parameters file path relative to the source context. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.Serialization.cs index c182fbaf8f36..d69c79690363 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryFileTaskStepUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryFileTaskStepUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TaskFilePath)) { @@ -31,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,7 +62,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryFileTaskStepUpdateContent DeserializeContainerRegistryFileTaskStepUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional taskFilePath = default; + Optional valuesFilePath = default; + Optional> values = default; + ContainerRegistryTaskStepType type = default; + Optional contextPath = default; + Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskFilePath"u8)) + { + taskFilePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("valuesFilePath"u8)) + { + valuesFilePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerRegistryTaskOverridableValue.DeserializeContainerRegistryTaskOverridableValue(item)); + } + values = array; + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ContainerRegistryTaskStepType(property.Value.GetString()); + continue; + } + if (property.NameEquals("contextPath"u8)) + { + contextPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("contextAccessToken"u8)) + { + contextAccessToken = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryFileTaskStepUpdateContent(type, contextPath.Value, contextAccessToken.Value, taskFilePath.Value, valuesFilePath.Value, Optional.ToList(values), serializedAdditionalRawData); + } + + ContainerRegistryFileTaskStepUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryFileTaskStepUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryFileTaskStepUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryFileTaskStepUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryFileTaskStepUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryFileTaskStepUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryFileTaskStepUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.cs index c48e5c2c6e2d..90db19cab10d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryFileTaskStepUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,29 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of updating a task step. public partial class ContainerRegistryFileTaskStepUpdateContent : ContainerRegistryTaskStepUpdateContent { - /// Initializes a new instance of ContainerRegistryFileTaskStepUpdateContent. + /// Initializes a new instance of . public ContainerRegistryFileTaskStepUpdateContent() { Values = new ChangeTrackingList(); StepType = ContainerRegistryTaskStepType.FileTask; } + /// Initializes a new instance of . + /// The type of the step. + /// The URL(absolute or relative) of the source context for the task step. + /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. + /// The task template/definition file path relative to the source context. + /// The values/parameters file path relative to the source context. + /// The collection of overridable values that can be passed when running a task. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryFileTaskStepUpdateContent(ContainerRegistryTaskStepType stepType, string contextPath, string contextAccessToken, string taskFilePath, string valuesFilePath, IList values, Dictionary serializedAdditionalRawData) : base(stepType, contextPath, contextAccessToken, serializedAdditionalRawData) + { + TaskFilePath = taskFilePath; + ValuesFilePath = valuesFilePath; + Values = values; + StepType = stepType; + } + /// The task template/definition file path relative to the source context. public string TaskFilePath { get; set; } /// The values/parameters file path relative to the source context. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.Serialization.cs index 94edc9daefc8..31ba371202e4 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryGenerateCredentialsContent : IUtf8JsonSerializable + public partial class ContainerRegistryGenerateCredentialsContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TokenId)) { @@ -30,7 +38,117 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryGenerateCredentialsContent DeserializeContainerRegistryGenerateCredentialsContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional tokenId = default; + Optional expiry = default; + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tokenId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tokenId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("expiry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = new ContainerRegistryTokenPasswordName(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryGenerateCredentialsContent(tokenId.Value, Optional.ToNullable(expiry), Optional.ToNullable(name), serializedAdditionalRawData); + } + + ContainerRegistryGenerateCredentialsContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryGenerateCredentialsContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryGenerateCredentialsContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryGenerateCredentialsContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryGenerateCredentialsContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryGenerateCredentialsContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryGenerateCredentialsContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.cs index 68c4fa288c64..52faf4e4066b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,11 +14,27 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters used to generate credentials for a specified token or user of a container registry. public partial class ContainerRegistryGenerateCredentialsContent { - /// Initializes a new instance of ContainerRegistryGenerateCredentialsContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryGenerateCredentialsContent() { } + /// Initializes a new instance of . + /// The resource ID of the token for which credentials have to be generated. + /// The expiry date of the generated credentials after which the credentials become invalid. + /// Specifies name of the password which should be regenerated if any -- password1 or password2. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryGenerateCredentialsContent(ResourceIdentifier tokenId, DateTimeOffset? expireOn, ContainerRegistryTokenPasswordName? name, Dictionary serializedAdditionalRawData) + { + TokenId = tokenId; + ExpireOn = expireOn; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The resource ID of the token for which credentials have to be generated. public ResourceIdentifier TokenId { get; set; } /// The expiry date of the generated credentials after which the credentials become invalid. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.Serialization.cs index 03e170f5e3b5..408c28da3c1c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryGenerateCredentialsResult + public partial class ContainerRegistryGenerateCredentialsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryGenerateCredentialsResult DeserializeContainerRegistryGenerateCredentialsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Username)) + { + writer.WritePropertyName("username"u8); + writer.WriteStringValue(Username); + } + if (Optional.IsCollectionDefined(Passwords)) + { + writer.WritePropertyName("passwords"u8); + writer.WriteStartArray(); + foreach (var item in Passwords) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryGenerateCredentialsResult DeserializeContainerRegistryGenerateCredentialsResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional username = default; Optional> passwords = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -42,8 +92,61 @@ internal static ContainerRegistryGenerateCredentialsResult DeserializeContainerR passwords = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryGenerateCredentialsResult(username.Value, Optional.ToList(passwords)); + return new ContainerRegistryGenerateCredentialsResult(username.Value, Optional.ToList(passwords), serializedAdditionalRawData); + } + + ContainerRegistryGenerateCredentialsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryGenerateCredentialsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryGenerateCredentialsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryGenerateCredentialsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryGenerateCredentialsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryGenerateCredentialsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryGenerateCredentialsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.cs index 403c41c6b590..91af90bf040d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryGenerateCredentialsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The response from the GenerateCredentials operation. public partial class ContainerRegistryGenerateCredentialsResult { - /// Initializes a new instance of ContainerRegistryGenerateCredentialsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryGenerateCredentialsResult() { Passwords = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryGenerateCredentialsResult. + /// Initializes a new instance of . /// The username for a container registry. /// The list of passwords for a container registry. - internal ContainerRegistryGenerateCredentialsResult(string username, IReadOnlyList passwords) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryGenerateCredentialsResult(string username, IReadOnlyList passwords, Dictionary serializedAdditionalRawData) { Username = username; Passwords = passwords; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The username for a container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.Serialization.cs index 59fd6e1e8788..7b487cbdb56f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryIPRule : IUtf8JsonSerializable + public partial class ContainerRegistryIPRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Action)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("value"u8); writer.WriteStringValue(IPAddressOrRange); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryIPRule DeserializeContainerRegistryIPRule(JsonElement element) + internal static ContainerRegistryIPRule DeserializeContainerRegistryIPRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional action = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("action"u8)) @@ -49,8 +72,61 @@ internal static ContainerRegistryIPRule DeserializeContainerRegistryIPRule(JsonE value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryIPRule(Optional.ToNullable(action), value, serializedAdditionalRawData); + } + + ContainerRegistryIPRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryIPRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryIPRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryIPRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryIPRule model) + { + if (model is null) + { + return null; } - return new ContainerRegistryIPRule(Optional.ToNullable(action), value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryIPRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryIPRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.cs index 6b33bd9395a5..a2622366998a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryIPRule.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// IP rule with specific IP or IP range in CIDR format. public partial class ContainerRegistryIPRule { - /// Initializes a new instance of ContainerRegistryIPRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. /// is null. public ContainerRegistryIPRule(string ipAddressOrRange) @@ -23,13 +27,20 @@ public ContainerRegistryIPRule(string ipAddressOrRange) IPAddressOrRange = ipAddressOrRange; } - /// Initializes a new instance of ContainerRegistryIPRule. + /// Initializes a new instance of . /// The action of IP ACL rule. /// Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - internal ContainerRegistryIPRule(ContainerRegistryIPRuleAction? action, string ipAddressOrRange) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryIPRule(ContainerRegistryIPRuleAction? action, string ipAddressOrRange, Dictionary serializedAdditionalRawData) { Action = action; IPAddressOrRange = ipAddressOrRange; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryIPRule() + { } /// The action of IP ACL rule. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.Serialization.cs index 2231fcaf1789..9f2bab01d5bc 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryImageDescriptor : IUtf8JsonSerializable + public partial class ContainerRegistryImageDescriptor : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Registry)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("digest"u8); writer.WriteStringValue(Digest); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryImageDescriptor DeserializeContainerRegistryImageDescriptor(JsonElement element) + internal static ContainerRegistryImageDescriptor DeserializeContainerRegistryImageDescriptor(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerRegistryImageDescriptor DeserializeContainerRegistryIma Optional repository = default; Optional tag = default; Optional digest = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registry"u8)) @@ -70,8 +93,61 @@ internal static ContainerRegistryImageDescriptor DeserializeContainerRegistryIma digest = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryImageDescriptor(registry.Value, repository.Value, tag.Value, digest.Value, serializedAdditionalRawData); + } + + ContainerRegistryImageDescriptor IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryImageDescriptor(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryImageDescriptor IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryImageDescriptor(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryImageDescriptor model) + { + if (model is null) + { + return null; } - return new ContainerRegistryImageDescriptor(registry.Value, repository.Value, tag.Value, digest.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryImageDescriptor(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryImageDescriptor(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.cs index 920ff09a8c3a..67d3247262aa 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageDescriptor.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// Properties for a registry image. public partial class ContainerRegistryImageDescriptor { - /// Initializes a new instance of ContainerRegistryImageDescriptor. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryImageDescriptor() { } - /// Initializes a new instance of ContainerRegistryImageDescriptor. + /// Initializes a new instance of . /// The registry login server. /// The repository name. /// The tag name. /// The sha256-based digest of the image manifest. - internal ContainerRegistryImageDescriptor(string registry, string repository, string tag, string digest) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryImageDescriptor(string registry, string repository, string tag, string digest, Dictionary serializedAdditionalRawData) { Registry = registry; Repository = repository; Tag = tag; Digest = digest; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The registry login server. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.Serialization.cs index 4095300ef280..685aa8fcd2cd 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryImageUpdateTrigger : IUtf8JsonSerializable + public partial class ContainerRegistryImageUpdateTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -33,15 +39,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Images) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryImageUpdateTrigger DeserializeContainerRegistryImageUpdateTrigger(JsonElement element) + internal static ContainerRegistryImageUpdateTrigger DeserializeContainerRegistryImageUpdateTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +76,7 @@ internal static ContainerRegistryImageUpdateTrigger DeserializeContainerRegistry Optional id = default; Optional timestamp = default; Optional> images = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -83,8 +111,61 @@ internal static ContainerRegistryImageUpdateTrigger DeserializeContainerRegistry images = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryImageUpdateTrigger(Optional.ToNullable(id), Optional.ToNullable(timestamp), Optional.ToList(images), serializedAdditionalRawData); + } + + ContainerRegistryImageUpdateTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryImageUpdateTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryImageUpdateTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryImageUpdateTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryImageUpdateTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryImageUpdateTrigger(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryImageUpdateTrigger(Optional.ToNullable(id), Optional.ToNullable(timestamp), Optional.ToList(images)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryImageUpdateTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.cs index 00f4d6faf225..8e0f44f2c32c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImageUpdateTrigger.cs @@ -14,21 +14,26 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The image update trigger that caused a build. public partial class ContainerRegistryImageUpdateTrigger { - /// Initializes a new instance of ContainerRegistryImageUpdateTrigger. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryImageUpdateTrigger() { Images = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryImageUpdateTrigger. + /// Initializes a new instance of . /// The unique ID of the trigger. /// The timestamp when the image update happened. /// The list of image updates that caused the build. - internal ContainerRegistryImageUpdateTrigger(Guid? id, DateTimeOffset? timestamp, IList images) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryImageUpdateTrigger(Guid? id, DateTimeOffset? timestamp, IList images, Dictionary serializedAdditionalRawData) { Id = id; Timestamp = timestamp; Images = images; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique ID of the trigger. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.Serialization.cs index b1202db56740..bcc23b87ff70 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.Serialization.cs @@ -5,18 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryImportImageContent : IUtf8JsonSerializable + public partial class ContainerRegistryImportImageContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } if (Optional.IsCollectionDefined(TargetTags)) { writer.WritePropertyName("targetTags"u8); @@ -42,7 +57,133 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mode"u8); writer.WriteStringValue(Mode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryImportImageContent DeserializeContainerRegistryImportImageContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContainerRegistryImportSource source = default; + Optional> targetTags = default; + Optional> untaggedTargetRepositories = default; + Optional mode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("source"u8)) + { + source = ContainerRegistryImportSource.DeserializeContainerRegistryImportSource(property.Value); + continue; + } + if (property.NameEquals("targetTags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + targetTags = array; + continue; + } + if (property.NameEquals("untaggedTargetRepositories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + untaggedTargetRepositories = array; + continue; + } + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new ContainerRegistryImportMode(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryImportImageContent(source, Optional.ToList(targetTags), Optional.ToList(untaggedTargetRepositories), Optional.ToNullable(mode), serializedAdditionalRawData); + } + + ContainerRegistryImportImageContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryImportImageContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryImportImageContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryImportImageContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryImportImageContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryImportImageContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryImportImageContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.cs index 2adec5d50361..229f88d952cf 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportImageContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The ContainerRegistryImportImageContent. public partial class ContainerRegistryImportImageContent { - /// Initializes a new instance of ContainerRegistryImportImageContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The source of the image. /// is null. public ContainerRegistryImportImageContent(ContainerRegistryImportSource source) @@ -26,6 +29,26 @@ public ContainerRegistryImportImageContent(ContainerRegistryImportSource source) UntaggedTargetRepositories = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The source of the image. + /// List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). + /// List of strings of repository names to do a manifest only copy. No tag will be created. + /// When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryImportImageContent(ContainerRegistryImportSource source, IList targetTags, IList untaggedTargetRepositories, ContainerRegistryImportMode? mode, Dictionary serializedAdditionalRawData) + { + Source = source; + TargetTags = targetTags; + UntaggedTargetRepositories = untaggedTargetRepositories; + Mode = mode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryImportImageContent() + { + } + /// The source of the image. public ContainerRegistryImportSource Source { get; } /// List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.Serialization.cs index e436579eb422..e42a9e3684c7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryImportSource : IUtf8JsonSerializable + public partial class ContainerRegistryImportSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -28,11 +36,130 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WritePropertyName("sourceImage"u8); writer.WriteStringValue(SourceImage); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryImportSource DeserializeContainerRegistryImportSource(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceId = default; + Optional registryUri = default; + Optional credentials = default; + string sourceImage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("registryUri"u8)) + { + registryUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("credentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + credentials = ContainerRegistryImportSourceCredentials.DeserializeContainerRegistryImportSourceCredentials(property.Value); + continue; + } + if (property.NameEquals("sourceImage"u8)) + { + sourceImage = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryImportSource(resourceId.Value, registryUri.Value, credentials.Value, sourceImage, serializedAdditionalRawData); + } + + ContainerRegistryImportSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryImportSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryImportSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryImportSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryImportSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryImportSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryImportSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.cs index 05756d725e63..932da4f083d9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The ContainerRegistryImportSource. public partial class ContainerRegistryImportSource { - /// Initializes a new instance of ContainerRegistryImportSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Repository name of the source image. /// Specify an image by repository ('hello-world'). This will use the 'latest' tag. @@ -28,6 +32,31 @@ public ContainerRegistryImportSource(string sourceImage) SourceImage = sourceImage; } + /// Initializes a new instance of . + /// The resource identifier of the source Azure Container Registry. + /// The address of the source registry (e.g. 'mcr.microsoft.com'). + /// Credentials used when importing from a registry uri. + /// + /// Repository name of the source image. + /// Specify an image by repository ('hello-world'). This will use the 'latest' tag. + /// Specify an image by tag ('hello-world:latest'). + /// Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + /// + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryImportSource(ResourceIdentifier resourceId, string registryAddress, ContainerRegistryImportSourceCredentials credentials, string sourceImage, Dictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + RegistryAddress = registryAddress; + Credentials = credentials; + SourceImage = sourceImage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryImportSource() + { + } + /// The resource identifier of the source Azure Container Registry. public ResourceIdentifier ResourceId { get; set; } /// The address of the source registry (e.g. 'mcr.microsoft.com'). diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.Serialization.cs index c117b9d1e6be..e0c98f063db1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryImportSourceCredentials : IUtf8JsonSerializable + public partial class ContainerRegistryImportSourceCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Username)) { @@ -22,7 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryImportSourceCredentials DeserializeContainerRegistryImportSourceCredentials(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional username = default; + string password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("username"u8)) + { + username = property.Value.GetString(); + continue; + } + if (property.NameEquals("password"u8)) + { + password = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryImportSourceCredentials(username.Value, password, serializedAdditionalRawData); + } + + ContainerRegistryImportSourceCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryImportSourceCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryImportSourceCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryImportSourceCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryImportSourceCredentials model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryImportSourceCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryImportSourceCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.cs index 48d096e0ffea..1efe7310c8e1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryImportSourceCredentials.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The ContainerRegistryImportSourceCredentials. public partial class ContainerRegistryImportSourceCredentials { - /// Initializes a new instance of ContainerRegistryImportSourceCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The password used to authenticate with the source registry. /// is null. public ContainerRegistryImportSourceCredentials(string password) @@ -23,6 +27,22 @@ public ContainerRegistryImportSourceCredentials(string password) Password = password; } + /// Initializes a new instance of . + /// The username to authenticate with the source registry. + /// The password used to authenticate with the source registry. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryImportSourceCredentials(string username, string password, Dictionary serializedAdditionalRawData) + { + Username = username; + Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryImportSourceCredentials() + { + } + /// The username to authenticate with the source registry. public string Username { get; set; } /// The password used to authenticate with the source registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.Serialization.cs index d7c9a1dd989b..8b1cfdc1bd02 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryKeyVaultProperties : IUtf8JsonSerializable + public partial class ContainerRegistryKeyVaultProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyIdentifier)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"u8); writer.WriteStringValue(Identity); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryKeyVaultProperties DeserializeContainerRegistryKeyVaultProperties(JsonElement element) + internal static ContainerRegistryKeyVaultProperties DeserializeContainerRegistryKeyVaultProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static ContainerRegistryKeyVaultProperties DeserializeContainerRegistry Optional identity = default; Optional keyRotationEnabled = default; Optional lastKeyRotationTimestamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyIdentifier"u8)) @@ -75,8 +97,61 @@ internal static ContainerRegistryKeyVaultProperties DeserializeContainerRegistry lastKeyRotationTimestamp = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryKeyVaultProperties(keyIdentifier.Value, versionedKeyIdentifier.Value, identity.Value, Optional.ToNullable(keyRotationEnabled), Optional.ToNullable(lastKeyRotationTimestamp), serializedAdditionalRawData); + } + + ContainerRegistryKeyVaultProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryKeyVaultProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryKeyVaultProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryKeyVaultProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryKeyVaultProperties model) + { + if (model is null) + { + return null; } - return new ContainerRegistryKeyVaultProperties(keyIdentifier.Value, versionedKeyIdentifier.Value, identity.Value, Optional.ToNullable(keyRotationEnabled), Optional.ToNullable(lastKeyRotationTimestamp)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryKeyVaultProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryKeyVaultProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.cs index 3626b8c4bdb3..0eff19ad2d7e 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryKeyVaultProperties.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The ContainerRegistryKeyVaultProperties. public partial class ContainerRegistryKeyVaultProperties { - /// Initializes a new instance of ContainerRegistryKeyVaultProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryKeyVaultProperties() { } - /// Initializes a new instance of ContainerRegistryKeyVaultProperties. + /// Initializes a new instance of . /// Key vault uri to access the encryption key. /// The fully qualified key identifier that includes the version of the key that is actually used for encryption. /// The client id of the identity which will be used to access key vault. /// Auto key rotation status for a CMK enabled registry. /// Timestamp of the last successful key rotation. - internal ContainerRegistryKeyVaultProperties(string keyIdentifier, string versionedKeyIdentifier, string identity, bool? isKeyRotationEnabled, DateTimeOffset? lastKeyRotationTimestamp) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryKeyVaultProperties(string keyIdentifier, string versionedKeyIdentifier, string identity, bool? isKeyRotationEnabled, DateTimeOffset? lastKeyRotationTimestamp, Dictionary serializedAdditionalRawData) { KeyIdentifier = keyIdentifier; VersionedKeyIdentifier = versionedKeyIdentifier; Identity = identity; IsKeyRotationEnabled = isKeyRotationEnabled; LastKeyRotationTimestamp = lastKeyRotationTimestamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Key vault uri to access the encryption key. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.Serialization.cs index 35ba7c2ffe1c..a14d700c15c2 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryListCredentialsResult + public partial class ContainerRegistryListCredentialsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryListCredentialsResult DeserializeContainerRegistryListCredentialsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Username)) + { + writer.WritePropertyName("username"u8); + writer.WriteStringValue(Username); + } + if (Optional.IsCollectionDefined(Passwords)) + { + writer.WritePropertyName("passwords"u8); + writer.WriteStartArray(); + foreach (var item in Passwords) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryListCredentialsResult DeserializeContainerRegistryListCredentialsResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional username = default; Optional> passwords = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("username"u8)) @@ -42,8 +92,61 @@ internal static ContainerRegistryListCredentialsResult DeserializeContainerRegis passwords = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryListCredentialsResult(username.Value, Optional.ToList(passwords)); + return new ContainerRegistryListCredentialsResult(username.Value, Optional.ToList(passwords), serializedAdditionalRawData); + } + + ContainerRegistryListCredentialsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryListCredentialsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryListCredentialsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryListCredentialsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryListCredentialsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryListCredentialsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryListCredentialsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.cs index e30f4678ad29..e058b9c22e69 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListCredentialsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The response from the ListCredentials operation. public partial class ContainerRegistryListCredentialsResult { - /// Initializes a new instance of ContainerRegistryListCredentialsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryListCredentialsResult() { Passwords = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryListCredentialsResult. + /// Initializes a new instance of . /// The username for a container registry. /// The list of passwords for a container registry. - internal ContainerRegistryListCredentialsResult(string username, IReadOnlyList passwords) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryListCredentialsResult(string username, IReadOnlyList passwords, Dictionary serializedAdditionalRawData) { Username = username; Passwords = passwords; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The username for a container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.Serialization.cs index 99dd0a846d55..65868c16be00 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryListResult + internal partial class ContainerRegistryListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryListResult DeserializeContainerRegistryListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryListResult DeserializeContainerRegistryListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryListResult DeserializeContainerRegistryListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.cs index 156349274424..4c46b717c43d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list container registries. internal partial class ContainerRegistryListResult { - /// Initializes a new instance of ContainerRegistryListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryListResult. + /// Initializes a new instance of . /// The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. /// The URI that can be used to request the next list of container registries. - internal ContainerRegistryListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.Serialization.cs index 4c494c0b1c42..afd3b3af412c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryNameAvailabilityContent : IUtf8JsonSerializable + public partial class ContainerRegistryNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryNameAvailabilityContent DeserializeContainerRegistryNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ContainerRegistryResourceType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ContainerRegistryResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + ContainerRegistryNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.cs index ce2b9aa0d0a1..ba05158fc3c5 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// A request to check whether a container registry name is available. public partial class ContainerRegistryNameAvailabilityContent { - /// Initializes a new instance of ContainerRegistryNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the container registry. /// is null. public ContainerRegistryNameAvailabilityContent(string name) @@ -24,6 +28,22 @@ public ContainerRegistryNameAvailabilityContent(string name) ResourceType = ContainerRegistryResourceType.MicrosoftContainerRegistryRegistries; } + /// Initializes a new instance of . + /// The name of the container registry. + /// The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryNameAvailabilityContent(string name, ContainerRegistryResourceType resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryNameAvailabilityContent() + { + } + /// The name of the container registry. public string Name { get; } /// The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.Serialization.cs index c926a0e092c0..d0faf78a2a2c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryNameAvailableResult + public partial class ContainerRegistryNameAvailableResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryNameAvailableResult DeserializeContainerRegistryNameAvailableResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryNameAvailableResult DeserializeContainerRegistryNameAvailableResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static ContainerRegistryNameAvailableResult DeserializeContainerRegistr Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -42,8 +86,61 @@ internal static ContainerRegistryNameAvailableResult DeserializeContainerRegistr message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryNameAvailableResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value); + return new ContainerRegistryNameAvailableResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value, serializedAdditionalRawData); + } + + ContainerRegistryNameAvailableResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryNameAvailableResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryNameAvailableResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryNameAvailableResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryNameAvailableResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryNameAvailableResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryNameAvailableResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.cs index 7a2578034a67..3f7058f7e7be 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNameAvailableResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The result of a request to check the availability of a container registry name. public partial class ContainerRegistryNameAvailableResult { - /// Initializes a new instance of ContainerRegistryNameAvailableResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryNameAvailableResult() { } - /// Initializes a new instance of ContainerRegistryNameAvailableResult. + /// Initializes a new instance of . /// The value that indicates whether the name is available. /// If any, the reason that the name is not available. /// If any, the error message that provides more detail for the reason that the name is not available. - internal ContainerRegistryNameAvailableResult(bool? isNameAvailable, string reason, string message) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryNameAvailableResult(bool? isNameAvailable, string reason, string message, Dictionary serializedAdditionalRawData) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value that indicates whether the name is available. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.Serialization.cs index a0dd6dac852a..0e8ce2575b4a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryNetworkRuleSet : IUtf8JsonSerializable + public partial class ContainerRegistryNetworkRuleSet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("defaultAction"u8); writer.WriteStringValue(DefaultAction.ToString()); @@ -24,21 +31,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryNetworkRuleSet DeserializeContainerRegistryNetworkRuleSet(JsonElement element) + internal static ContainerRegistryNetworkRuleSet DeserializeContainerRegistryNetworkRuleSet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ContainerRegistryNetworkRuleDefaultAction defaultAction = default; Optional> ipRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defaultAction"u8)) @@ -60,8 +89,61 @@ internal static ContainerRegistryNetworkRuleSet DeserializeContainerRegistryNetw ipRules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryNetworkRuleSet(defaultAction, Optional.ToList(ipRules), serializedAdditionalRawData); + } + + ContainerRegistryNetworkRuleSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryNetworkRuleSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryNetworkRuleSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryNetworkRuleSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryNetworkRuleSet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryNetworkRuleSet(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryNetworkRuleSet(defaultAction, Optional.ToList(ipRules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryNetworkRuleSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.cs index 915a5f33d094..e68f71cf323a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryNetworkRuleSet.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The network rule set for a container registry. public partial class ContainerRegistryNetworkRuleSet { - /// Initializes a new instance of ContainerRegistryNetworkRuleSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The default action of allow or deny when no other rules match. public ContainerRegistryNetworkRuleSet(ContainerRegistryNetworkRuleDefaultAction defaultAction) { @@ -21,13 +25,20 @@ public ContainerRegistryNetworkRuleSet(ContainerRegistryNetworkRuleDefaultAction IPRules = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryNetworkRuleSet. + /// Initializes a new instance of . /// The default action of allow or deny when no other rules match. /// The IP ACL rules. - internal ContainerRegistryNetworkRuleSet(ContainerRegistryNetworkRuleDefaultAction defaultAction, IList ipRules) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryNetworkRuleSet(ContainerRegistryNetworkRuleDefaultAction defaultAction, IList ipRules, Dictionary serializedAdditionalRawData) { DefaultAction = defaultAction; IPRules = ipRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryNetworkRuleSet() + { } /// The default action of allow or deny when no other rules match. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.Serialization.cs index 57c105e0a354..e7145474cc14 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryOverrideTaskStepProperties : IUtf8JsonSerializable + public partial class ContainerRegistryOverrideTaskStepProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContextPath)) { @@ -32,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Arguments) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Values) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -56,11 +77,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("updateTriggerToken"u8); writer.WriteStringValue(UpdateTriggerToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryOverrideTaskStepProperties DeserializeContainerRegistryOverrideTaskStepProperties(JsonElement element) + internal static ContainerRegistryOverrideTaskStepProperties DeserializeContainerRegistryOverrideTaskStepProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,6 +106,7 @@ internal static ContainerRegistryOverrideTaskStepProperties DeserializeContainer Optional target = default; Optional> values = default; Optional updateTriggerToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contextPath"u8)) @@ -121,8 +157,61 @@ internal static ContainerRegistryOverrideTaskStepProperties DeserializeContainer updateTriggerToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryOverrideTaskStepProperties(contextPath.Value, file.Value, Optional.ToList(arguments), target.Value, Optional.ToList(values), updateTriggerToken.Value, serializedAdditionalRawData); + } + + ContainerRegistryOverrideTaskStepProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryOverrideTaskStepProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryOverrideTaskStepProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryOverrideTaskStepProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryOverrideTaskStepProperties model) + { + if (model is null) + { + return null; } - return new ContainerRegistryOverrideTaskStepProperties(contextPath.Value, file.Value, Optional.ToList(arguments), target.Value, Optional.ToList(values), updateTriggerToken.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryOverrideTaskStepProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryOverrideTaskStepProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.cs index f919afb1d53a..1d0758e60442 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryOverrideTaskStepProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,14 +14,17 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The ContainerRegistryOverrideTaskStepProperties. public partial class ContainerRegistryOverrideTaskStepProperties { - /// Initializes a new instance of ContainerRegistryOverrideTaskStepProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryOverrideTaskStepProperties() { Arguments = new ChangeTrackingList(); Values = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryOverrideTaskStepProperties. + /// Initializes a new instance of . /// The source context against which run has to be queued. /// The file against which run has to be queued. /// @@ -30,7 +34,8 @@ public ContainerRegistryOverrideTaskStepProperties() /// The name of the target build stage for the docker build. /// The collection of overridable values that can be passed when running a Task. /// Base64 encoded update trigger token that will be attached with the base image trigger webhook. - internal ContainerRegistryOverrideTaskStepProperties(string contextPath, string file, IList arguments, string target, IList values, string updateTriggerToken) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryOverrideTaskStepProperties(string contextPath, string file, IList arguments, string target, IList values, string updateTriggerToken, Dictionary serializedAdditionalRawData) { ContextPath = contextPath; File = file; @@ -38,6 +43,7 @@ internal ContainerRegistryOverrideTaskStepProperties(string contextPath, string Target = target; Values = values; UpdateTriggerToken = updateTriggerToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The source context against which run has to be queued. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.Serialization.cs index 9d0b7be88384..8dc4c54036d2 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryPassword + public partial class ContainerRegistryPassword : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryPassword DeserializeContainerRegistryPassword(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToSerialString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryPassword DeserializeContainerRegistryPassword(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -36,8 +75,61 @@ internal static ContainerRegistryPassword DeserializeContainerRegistryPassword(J value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryPassword(Optional.ToNullable(name), value.Value); + return new ContainerRegistryPassword(Optional.ToNullable(name), value.Value, serializedAdditionalRawData); + } + + ContainerRegistryPassword IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPassword(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPassword IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPassword(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPassword model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPassword(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPassword(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.cs index 49f942c94f3c..afdc4c5248c7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPassword.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The login password for the container registry. public partial class ContainerRegistryPassword { - /// Initializes a new instance of ContainerRegistryPassword. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryPassword() { } - /// Initializes a new instance of ContainerRegistryPassword. + /// Initializes a new instance of . /// The password name. /// The password value. - internal ContainerRegistryPassword(ContainerRegistryPasswordName? name, string value) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPassword(ContainerRegistryPasswordName? name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The password name. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.Serialization.cs index ac11854fd65c..d1b5d6f8d3b7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryPatch : IUtf8JsonSerializable + public partial class ContainerRegistryPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -34,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,17 +62,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkRuleSet)) { writer.WritePropertyName("networkRuleSet"u8); - writer.WriteObjectValue(NetworkRuleSet); + if (NetworkRuleSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkRuleSet).Serialize(writer, options); + } } if (Optional.IsDefined(Policies)) { writer.WritePropertyName("policies"u8); - writer.WriteObjectValue(Policies); + if (Policies is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policies).Serialize(writer, options); + } } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(IsDataEndpointEnabled)) { @@ -74,7 +111,204 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(NetworkRuleBypassOptions.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryPatch DeserializeContainerRegistryPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional identity = default; + Optional> tags = default; + Optional sku = default; + Optional adminUserEnabled = default; + Optional networkRuleSet = default; + Optional policies = default; + Optional encryption = default; + Optional dataEndpointEnabled = default; + Optional publicNetworkAccess = default; + Optional networkRuleBypassOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ContainerRegistrySku.DeserializeContainerRegistrySku(property.Value); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("adminUserEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + adminUserEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("networkRuleSet"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkRuleSet = ContainerRegistryNetworkRuleSet.DeserializeContainerRegistryNetworkRuleSet(property0.Value); + continue; + } + if (property0.NameEquals("policies"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policies = ContainerRegistryPolicies.DeserializeContainerRegistryPolicies(property0.Value); + continue; + } + if (property0.NameEquals("encryption"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ContainerRegistryEncryption.DeserializeContainerRegistryEncryption(property0.Value); + continue; + } + if (property0.NameEquals("dataEndpointEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataEndpointEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new ContainerRegistryPublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("networkRuleBypassOptions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkRuleBypassOptions = new ContainerRegistryNetworkRuleBypassOption(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryPatch(identity, Optional.ToDictionary(tags), sku.Value, Optional.ToNullable(adminUserEnabled), networkRuleSet.Value, policies.Value, encryption.Value, Optional.ToNullable(dataEndpointEnabled), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(networkRuleBypassOptions), serializedAdditionalRawData); + } + + ContainerRegistryPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.cs index 8a7e2d3e7a98..46bcc3584b7b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,42 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating a container registry. public partial class ContainerRegistryPatch { - /// Initializes a new instance of ContainerRegistryPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The identity of the container registry. + /// The tags for the container registry. + /// The SKU of the container registry. + /// The value that indicates whether the admin user is enabled. + /// The network rule set for a container registry. + /// The policies for a container registry. + /// The encryption settings of container registry. + /// Enable a single data endpoint per region for serving data. + /// Whether or not public network access is allowed for the container registry. + /// Whether to allow trusted Azure services to access a network restricted registry. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPatch(ManagedServiceIdentity identity, IDictionary tags, ContainerRegistrySku sku, bool? isAdminUserEnabled, ContainerRegistryNetworkRuleSet networkRuleSet, ContainerRegistryPolicies policies, ContainerRegistryEncryption encryption, bool? isDataEndpointEnabled, ContainerRegistryPublicNetworkAccess? publicNetworkAccess, ContainerRegistryNetworkRuleBypassOption? networkRuleBypassOptions, Dictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Sku = sku; + IsAdminUserEnabled = isAdminUserEnabled; + NetworkRuleSet = networkRuleSet; + Policies = policies; + Encryption = encryption; + IsDataEndpointEnabled = isDataEndpointEnabled; + PublicNetworkAccess = publicNetworkAccess; + NetworkRuleBypassOptions = networkRuleBypassOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The identity of the container registry. public ManagedServiceIdentity Identity { get; set; } /// The tags for the container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.Serialization.cs index 25c3c30f8d55..ce10fdc4d8dc 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryPlatformProperties : IUtf8JsonSerializable + public partial class ContainerRegistryPlatformProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("os"u8); writer.WriteStringValue(OS.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("variant"u8); writer.WriteStringValue(Variant.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryPlatformProperties DeserializeContainerRegistryPlatformProperties(JsonElement element) + internal static ContainerRegistryPlatformProperties DeserializeContainerRegistryPlatformProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ContainerRegistryPlatformProperties DeserializeContainerRegistry ContainerRegistryOS os = default; Optional architecture = default; Optional variant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("os"u8)) @@ -64,8 +87,61 @@ internal static ContainerRegistryPlatformProperties DeserializeContainerRegistry variant = new ContainerRegistryCpuVariant(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryPlatformProperties(os, Optional.ToNullable(architecture), Optional.ToNullable(variant), serializedAdditionalRawData); + } + + ContainerRegistryPlatformProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPlatformProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPlatformProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPlatformProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPlatformProperties model) + { + if (model is null) + { + return null; } - return new ContainerRegistryPlatformProperties(os, Optional.ToNullable(architecture), Optional.ToNullable(variant)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPlatformProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPlatformProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.cs index f8cef6412751..4d0100afc608 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformProperties.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The platform properties against which the run has to happen. public partial class ContainerRegistryPlatformProperties { - /// Initializes a new instance of ContainerRegistryPlatformProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The operating system type required for the run. public ContainerRegistryPlatformProperties(ContainerRegistryOS os) { OS = os; } - /// Initializes a new instance of ContainerRegistryPlatformProperties. + /// Initializes a new instance of . /// The operating system type required for the run. /// The OS architecture. /// Variant of the CPU. - internal ContainerRegistryPlatformProperties(ContainerRegistryOS os, ContainerRegistryOSArchitecture? architecture, ContainerRegistryCpuVariant? variant) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPlatformProperties(ContainerRegistryOS os, ContainerRegistryOSArchitecture? architecture, ContainerRegistryCpuVariant? variant, Dictionary serializedAdditionalRawData) { OS = os; Architecture = architecture; Variant = variant; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryPlatformProperties() + { } /// The operating system type required for the run. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.Serialization.cs index 5542328991fc..d5bb5bf80bda 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryPlatformUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryPlatformUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OS)) { @@ -30,7 +38,117 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("variant"u8); writer.WriteStringValue(Variant.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryPlatformUpdateContent DeserializeContainerRegistryPlatformUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional os = default; + Optional architecture = default; + Optional variant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("os"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + os = new ContainerRegistryOS(property.Value.GetString()); + continue; + } + if (property.NameEquals("architecture"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + architecture = new ContainerRegistryOSArchitecture(property.Value.GetString()); + continue; + } + if (property.NameEquals("variant"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + variant = new ContainerRegistryCpuVariant(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryPlatformUpdateContent(Optional.ToNullable(os), Optional.ToNullable(architecture), Optional.ToNullable(variant), serializedAdditionalRawData); + } + + ContainerRegistryPlatformUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPlatformUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPlatformUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPlatformUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPlatformUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPlatformUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPlatformUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.cs index 410deb41efd8..eabe6cd5406b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPlatformUpdateContent.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The properties for updating the platform configuration. public partial class ContainerRegistryPlatformUpdateContent { - /// Initializes a new instance of ContainerRegistryPlatformUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryPlatformUpdateContent() { } + /// Initializes a new instance of . + /// The operating system type required for the run. + /// The OS architecture. + /// Variant of the CPU. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPlatformUpdateContent(ContainerRegistryOS? os, ContainerRegistryOSArchitecture? architecture, ContainerRegistryCpuVariant? variant, Dictionary serializedAdditionalRawData) + { + OS = os; + Architecture = architecture; + Variant = variant; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The operating system type required for the run. public ContainerRegistryOS? OS { get; set; } /// The OS architecture. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.Serialization.cs index 2683a1c9c6c0..7b03758c8ad5 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.Serialization.cs @@ -5,41 +5,91 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryPolicies : IUtf8JsonSerializable + public partial class ContainerRegistryPolicies : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QuarantinePolicy)) { writer.WritePropertyName("quarantinePolicy"u8); - writer.WriteObjectValue(QuarantinePolicy); + if (QuarantinePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)QuarantinePolicy).Serialize(writer, options); + } } if (Optional.IsDefined(TrustPolicy)) { writer.WritePropertyName("trustPolicy"u8); - writer.WriteObjectValue(TrustPolicy); + if (TrustPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TrustPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(RetentionPolicy)) { writer.WritePropertyName("retentionPolicy"u8); - writer.WriteObjectValue(RetentionPolicy); + if (RetentionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RetentionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ExportPolicy)) { writer.WritePropertyName("exportPolicy"u8); - writer.WriteObjectValue(ExportPolicy); + if (ExportPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExportPolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerRegistryPolicies DeserializeContainerRegistryPolicies(JsonElement element) + internal static ContainerRegistryPolicies DeserializeContainerRegistryPolicies(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +98,7 @@ internal static ContainerRegistryPolicies DeserializeContainerRegistryPolicies(J Optional trustPolicy = default; Optional retentionPolicy = default; Optional exportPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("quarantinePolicy"u8)) @@ -86,8 +137,61 @@ internal static ContainerRegistryPolicies DeserializeContainerRegistryPolicies(J exportPolicy = ContainerRegistryExportPolicy.DeserializeContainerRegistryExportPolicy(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryPolicies(quarantinePolicy.Value, trustPolicy.Value, retentionPolicy.Value, exportPolicy.Value); + return new ContainerRegistryPolicies(quarantinePolicy.Value, trustPolicy.Value, retentionPolicy.Value, exportPolicy.Value, serializedAdditionalRawData); + } + + ContainerRegistryPolicies IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPolicies(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPolicies IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPolicies(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPolicies model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPolicies(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPolicies(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.cs index 6352fa0dfffd..700d02603273 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPolicies.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The policies for a container registry. public partial class ContainerRegistryPolicies { - /// Initializes a new instance of ContainerRegistryPolicies. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryPolicies() { } - /// Initializes a new instance of ContainerRegistryPolicies. + /// Initializes a new instance of . /// The quarantine policy for a container registry. /// The content trust policy for a container registry. /// The retention policy for a container registry. /// The export policy for a container registry. - internal ContainerRegistryPolicies(ContainerRegistryQuarantinePolicy quarantinePolicy, ContainerRegistryTrustPolicy trustPolicy, ContainerRegistryRetentionPolicy retentionPolicy, ContainerRegistryExportPolicy exportPolicy) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPolicies(ContainerRegistryQuarantinePolicy quarantinePolicy, ContainerRegistryTrustPolicy trustPolicy, ContainerRegistryRetentionPolicy retentionPolicy, ContainerRegistryExportPolicy exportPolicy, Dictionary serializedAdditionalRawData) { QuarantinePolicy = quarantinePolicy; TrustPolicy = trustPolicy; RetentionPolicy = retentionPolicy; ExportPolicy = exportPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The quarantine policy for a container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionData.Serialization.cs index 215f73263967..b4d3d6907bcb 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class ContainerRegistryPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryPrivateEndpointConnectionData DeserializeContainerRegistryPrivateEndpointConnectionData(JsonElement element) + internal static ContainerRegistryPrivateEndpointConnectionData DeserializeContainerRegistryPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +76,7 @@ internal static ContainerRegistryPrivateEndpointConnectionData DeserializeContai Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static ContainerRegistryPrivateEndpointConnectionData DeserializeContai } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ContainerRegistryPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.Serialization.cs index 0a28dfe5a448..4815a2758faa 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryPrivateEndpointConnectionListResult + internal partial class ContainerRegistryPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryPrivateEndpointConnectionListResult DeserializeContainerRegistryPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryPrivateEndpointConnectionListResult DeserializeContainerRegistryPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryPrivateEndpointConnectionListResult Deserialize nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryPrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryPrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.cs index bf1dc7243373..e8c0b97acdf9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list private endpoint connections for a container registry. internal partial class ContainerRegistryPrivateEndpointConnectionListResult { - /// Initializes a new instance of ContainerRegistryPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. /// The URI that can be used to request the next list of private endpoint connections. - internal ContainerRegistryPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceData.Serialization.cs index a9e971696a4a..b1290aa9f0b9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceData.Serialization.cs @@ -5,17 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryPrivateLinkResourceData + public partial class ContainerRegistryPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryPrivateLinkResourceData DeserializeContainerRegistryPrivateLinkResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (var item in RequiredMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (var item in RequiredZoneNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryPrivateLinkResourceData DeserializeContainerRegistryPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +82,7 @@ internal static ContainerRegistryPrivateLinkResourceData DeserializeContainerReg Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -98,8 +154,61 @@ internal static ContainerRegistryPrivateLinkResourceData DeserializeContainerReg } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + return new ContainerRegistryPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + ContainerRegistryPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPrivateLinkResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.Serialization.cs index 8c7dbf7489c1..b438cc2daed1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryPrivateLinkResourceListResult + internal partial class ContainerRegistryPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryPrivateLinkResourceListResult DeserializeContainerRegistryPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryPrivateLinkResourceListResult DeserializeContainerRegistryPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryPrivateLinkResourceListResult DeserializeContai nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryPrivateLinkResourceListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryPrivateLinkResourceListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.cs index 9d4b0a55a0b8..309d26cd293d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list private link resources for a container registry. internal partial class ContainerRegistryPrivateLinkResourceListResult { - /// Initializes a new instance of ContainerRegistryPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryPrivateLinkResourceListResult. + /// Initializes a new instance of . /// The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. /// The URI that can be used to request the next list of private link resources. - internal ContainerRegistryPrivateLinkResourceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPrivateLinkResourceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.Serialization.cs index 474396dc3d92..8dcb6bc27527 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class ContainerRegistryPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryPrivateLinkServiceConnectionState DeserializeContainerRegistryPrivateLinkServiceConnectionState(JsonElement element) + internal static ContainerRegistryPrivateLinkServiceConnectionState DeserializeContainerRegistryPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContainerRegistryPrivateLinkServiceConnectionState DeserializeCo Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -67,8 +90,61 @@ internal static ContainerRegistryPrivateLinkServiceConnectionState DeserializeCo actionsRequired = new ActionsRequiredForPrivateLinkServiceConsumer(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, Optional.ToNullable(actionsRequired), serializedAdditionalRawData); + } + + ContainerRegistryPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new ContainerRegistryPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, Optional.ToNullable(actionsRequired)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.cs index f3c300055198..9ed489faf187 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The state of a private link service connection. public partial class ContainerRegistryPrivateLinkServiceConnectionState { - /// Initializes a new instance of ContainerRegistryPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of ContainerRegistryPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// The private link service connection status. /// The description for connection status. For example if connection is rejected it can indicate reason for rejection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal ContainerRegistryPrivateLinkServiceConnectionState(ContainerRegistryPrivateLinkServiceConnectionStatus? status, string description, ActionsRequiredForPrivateLinkServiceConsumer? actionsRequired) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryPrivateLinkServiceConnectionState(ContainerRegistryPrivateLinkServiceConnectionStatus? status, string description, ActionsRequiredForPrivateLinkServiceConsumer? actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link service connection status. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.Serialization.cs index 6450b99b8a52..440a13a8f1e1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryQuarantinePolicy : IUtf8JsonSerializable + internal partial class ContainerRegistryQuarantinePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryQuarantinePolicy DeserializeContainerRegistryQuarantinePolicy(JsonElement element) + internal static ContainerRegistryQuarantinePolicy DeserializeContainerRegistryQuarantinePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -41,8 +64,61 @@ internal static ContainerRegistryQuarantinePolicy DeserializeContainerRegistryQu status = new ContainerRegistryPolicyStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryQuarantinePolicy(Optional.ToNullable(status), serializedAdditionalRawData); + } + + ContainerRegistryQuarantinePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryQuarantinePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryQuarantinePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryQuarantinePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryQuarantinePolicy model) + { + if (model is null) + { + return null; } - return new ContainerRegistryQuarantinePolicy(Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryQuarantinePolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryQuarantinePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.cs index b7f934f449ca..4cbd98cfb853 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryQuarantinePolicy.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The quarantine policy for a container registry. internal partial class ContainerRegistryQuarantinePolicy { - /// Initializes a new instance of ContainerRegistryQuarantinePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryQuarantinePolicy() { } - /// Initializes a new instance of ContainerRegistryQuarantinePolicy. + /// Initializes a new instance of . /// The value that indicates whether the policy is enabled or not. - internal ContainerRegistryQuarantinePolicy(ContainerRegistryPolicyStatus? status) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryQuarantinePolicy(ContainerRegistryPolicyStatus? status, Dictionary serializedAdditionalRawData) { Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value that indicates whether the policy is enabled or not. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationData.Serialization.cs index 4139e62f9d72..e752c8af293d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryReplicationData : IUtf8JsonSerializable + public partial class ContainerRegistryReplicationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -44,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ZoneRedundancy.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryReplicationData DeserializeContainerRegistryReplicationData(JsonElement element) + internal static ContainerRegistryReplicationData DeserializeContainerRegistryReplicationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +84,7 @@ internal static ContainerRegistryReplicationData DeserializeContainerRegistryRep Optional status = default; Optional regionEndpointEnabled = default; Optional zoneRedundancy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -156,8 +178,61 @@ internal static ContainerRegistryReplicationData DeserializeContainerRegistryRep } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryReplicationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), status.Value, Optional.ToNullable(regionEndpointEnabled), Optional.ToNullable(zoneRedundancy), serializedAdditionalRawData); + } + + ContainerRegistryReplicationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryReplicationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryReplicationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryReplicationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryReplicationData model) + { + if (model is null) + { + return null; } - return new ContainerRegistryReplicationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), status.Value, Optional.ToNullable(regionEndpointEnabled), Optional.ToNullable(zoneRedundancy)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryReplicationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryReplicationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.Serialization.cs index fec20a1c211f..22c45b0d3534 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryReplicationListResult + internal partial class ContainerRegistryReplicationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryReplicationListResult DeserializeContainerRegistryReplicationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryReplicationListResult DeserializeContainerRegistryReplicationListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryReplicationListResult DeserializeContainerRegis nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryReplicationListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryReplicationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryReplicationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryReplicationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryReplicationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryReplicationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryReplicationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryReplicationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryReplicationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.cs index f89e4dd86b56..bfce5418f79a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list replications for a container registry. internal partial class ContainerRegistryReplicationListResult { - /// Initializes a new instance of ContainerRegistryReplicationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryReplicationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryReplicationListResult. + /// Initializes a new instance of . /// The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. /// The URI that can be used to request the next list of replications. - internal ContainerRegistryReplicationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryReplicationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.Serialization.cs index bf527c1fd71f..0bfa734c5e43 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryReplicationPatch : IUtf8JsonSerializable + public partial class ContainerRegistryReplicationPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -34,7 +42,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsRegionEndpointEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryReplicationPatch DeserializeContainerRegistryReplicationPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional regionEndpointEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("regionEndpointEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionEndpointEnabled = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryReplicationPatch(Optional.ToDictionary(tags), Optional.ToNullable(regionEndpointEnabled), serializedAdditionalRawData); + } + + ContainerRegistryReplicationPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryReplicationPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryReplicationPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryReplicationPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryReplicationPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryReplicationPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryReplicationPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.cs index edd8669a0df5..455f3a278df7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryReplicationPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,26 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating a replication. public partial class ContainerRegistryReplicationPatch { - /// Initializes a new instance of ContainerRegistryReplicationPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryReplicationPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The tags for the replication. + /// Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryReplicationPatch(IDictionary tags, bool? isRegionEndpointEnabled, Dictionary serializedAdditionalRawData) + { + Tags = tags; + IsRegionEndpointEnabled = isRegionEndpointEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The tags for the replication. public IDictionary Tags { get; } /// Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.Serialization.cs index 86c2b9384882..e0e39fd50139 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryResourceStatus + public partial class ContainerRegistryResourceStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryResourceStatus DeserializeContainerRegistryResourceStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryResourceStatus DeserializeContainerRegistryResourceStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static ContainerRegistryResourceStatus DeserializeContainerRegistryReso Optional displayStatus = default; Optional message = default; Optional timestamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayStatus"u8)) @@ -43,8 +71,61 @@ internal static ContainerRegistryResourceStatus DeserializeContainerRegistryReso timestamp = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryResourceStatus(displayStatus.Value, message.Value, Optional.ToNullable(timestamp)); + return new ContainerRegistryResourceStatus(displayStatus.Value, message.Value, Optional.ToNullable(timestamp), serializedAdditionalRawData); + } + + ContainerRegistryResourceStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryResourceStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryResourceStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryResourceStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryResourceStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryResourceStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryResourceStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.cs index a01b0bde4630..3bff6fbddfe9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryResourceStatus.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The status of an Azure resource at the time the operation was called. public partial class ContainerRegistryResourceStatus { - /// Initializes a new instance of ContainerRegistryResourceStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryResourceStatus() { } - /// Initializes a new instance of ContainerRegistryResourceStatus. + /// Initializes a new instance of . /// The short label for the status. /// The detailed message for the status, including alerts and error messages. /// The timestamp when the status was changed to the current value. - internal ContainerRegistryResourceStatus(string displayStatus, string message, DateTimeOffset? timestamp) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryResourceStatus(string displayStatus, string message, DateTimeOffset? timestamp, Dictionary serializedAdditionalRawData) { DisplayStatus = displayStatus; Message = message; Timestamp = timestamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The short label for the status. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.Serialization.cs index 99782ed424aa..25ea11121bbf 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryRetentionPolicy : IUtf8JsonSerializable + public partial class ContainerRegistryRetentionPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Days)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryRetentionPolicy DeserializeContainerRegistryRetentionPolicy(JsonElement element) + internal static ContainerRegistryRetentionPolicy DeserializeContainerRegistryRetentionPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +59,7 @@ internal static ContainerRegistryRetentionPolicy DeserializeContainerRegistryRet Optional days = default; Optional lastUpdatedTime = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("days"u8)) @@ -67,8 +89,61 @@ internal static ContainerRegistryRetentionPolicy DeserializeContainerRegistryRet status = new ContainerRegistryPolicyStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryRetentionPolicy(Optional.ToNullable(days), Optional.ToNullable(lastUpdatedTime), Optional.ToNullable(status), serializedAdditionalRawData); + } + + ContainerRegistryRetentionPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRetentionPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRetentionPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRetentionPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRetentionPolicy model) + { + if (model is null) + { + return null; } - return new ContainerRegistryRetentionPolicy(Optional.ToNullable(days), Optional.ToNullable(lastUpdatedTime), Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRetentionPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRetentionPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.cs index 528c7548f7ef..01c854c4f9c6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRetentionPolicy.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The retention policy for a container registry. public partial class ContainerRegistryRetentionPolicy { - /// Initializes a new instance of ContainerRegistryRetentionPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryRetentionPolicy() { } - /// Initializes a new instance of ContainerRegistryRetentionPolicy. + /// Initializes a new instance of . /// The number of days to retain an untagged manifest after which it gets purged. /// The timestamp when the policy was last updated. /// The value that indicates whether the policy is enabled or not. - internal ContainerRegistryRetentionPolicy(int? days, DateTimeOffset? lastUpdatedOn, ContainerRegistryPolicyStatus? status) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRetentionPolicy(int? days, DateTimeOffset? lastUpdatedOn, ContainerRegistryPolicyStatus? status, Dictionary serializedAdditionalRawData) { Days = days; LastUpdatedOn = lastUpdatedOn; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of days to retain an untagged manifest after which it gets purged. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.Serialization.cs index fce2808c3f7a..6cd584c13293 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryRunArgument : IUtf8JsonSerializable + public partial class ContainerRegistryRunArgument : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isSecret"u8); writer.WriteBooleanValue(IsSecret.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryRunArgument DeserializeContainerRegistryRunArgument(JsonElement element) + internal static ContainerRegistryRunArgument DeserializeContainerRegistryRunArgument(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ContainerRegistryRunArgument DeserializeContainerRegistryRunArgu string name = default; string value = default; Optional isSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +80,61 @@ internal static ContainerRegistryRunArgument DeserializeContainerRegistryRunArgu isSecret = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryRunArgument(name, value, Optional.ToNullable(isSecret), serializedAdditionalRawData); + } + + ContainerRegistryRunArgument IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRunArgument(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunArgument IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunArgument(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRunArgument model) + { + if (model is null) + { + return null; } - return new ContainerRegistryRunArgument(name, value, Optional.ToNullable(isSecret)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRunArgument(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRunArgument(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.cs index c19de6bfdc26..4aa02a9d9c06 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunArgument.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a run argument. public partial class ContainerRegistryRunArgument { - /// Initializes a new instance of ContainerRegistryRunArgument. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the argument. /// The value of the argument. /// or is null. @@ -26,15 +30,22 @@ public ContainerRegistryRunArgument(string name, string value) Value = value; } - /// Initializes a new instance of ContainerRegistryRunArgument. + /// Initializes a new instance of . /// The name of the argument. /// The value of the argument. /// Flag to indicate whether the argument represents a secret and want to be removed from build logs. - internal ContainerRegistryRunArgument(string name, string value, bool? isSecret) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRunArgument(string name, string value, bool? isSecret, Dictionary serializedAdditionalRawData) { Name = name; Value = value; IsSecret = isSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryRunArgument() + { } /// The name of the argument. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.Serialization.cs index 1752dd2d4af1..68dffd943322 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryRunContent : IUtf8JsonSerializable + public partial class ContainerRegistryRunContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(RunRequestType); @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logTemplate"u8); writer.WriteStringValue(LogTemplate); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryRunContent DeserializeContainerRegistryRunContent(JsonElement element) + internal static ContainerRegistryRunContent DeserializeContainerRegistryRunContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,7 +73,94 @@ internal static ContainerRegistryRunContent DeserializeContainerRegistryRunConte case "TaskRunRequest": return ContainerRegistryTaskRunContent.DeserializeContainerRegistryTaskRunContent(element); } } - return UnknownRunRequest.DeserializeUnknownRunRequest(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional isArchiveEnabled = default; + Optional agentPoolName = default; + Optional logTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("isArchiveEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isArchiveEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("agentPoolName"u8)) + { + agentPoolName = property.Value.GetString(); + continue; + } + if (property.NameEquals("logTemplate"u8)) + { + logTemplate = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownRunRequest(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, serializedAdditionalRawData); + } + + ContainerRegistryRunContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRunContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRunContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRunContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRunContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.cs index dfe1595d3970..c8ccb85a9cf1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunContent.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// @@ -12,24 +16,30 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownRunRequest))] public abstract partial class ContainerRegistryRunContent { - /// Initializes a new instance of ContainerRegistryRunContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected ContainerRegistryRunContent() { } - /// Initializes a new instance of ContainerRegistryRunContent. + /// Initializes a new instance of . /// The type of the run request. /// The value that indicates whether archiving is enabled for the run or not. /// The dedicated agent pool for the run. /// The template that describes the repository and tag information for run log artifact. - internal ContainerRegistryRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, Dictionary serializedAdditionalRawData) { RunRequestType = runRequestType; IsArchiveEnabled = isArchiveEnabled; AgentPoolName = agentPoolName; LogTemplate = logTemplate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the run request. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunData.Serialization.cs index 0c33f4686b71..6ba107f76e4f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryRunData : IUtf8JsonSerializable + public partial class ContainerRegistryRunData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -67,7 +73,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in OutputImages) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -79,27 +92,62 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ImageUpdateTrigger)) { writer.WritePropertyName("imageUpdateTrigger"u8); - writer.WriteObjectValue(ImageUpdateTrigger); + if (ImageUpdateTrigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageUpdateTrigger).Serialize(writer, options); + } } if (Optional.IsDefined(SourceTrigger)) { writer.WritePropertyName("sourceTrigger"u8); - writer.WriteObjectValue(SourceTrigger); + if (SourceTrigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceTrigger).Serialize(writer, options); + } } if (Optional.IsDefined(TimerTrigger)) { writer.WritePropertyName("timerTrigger"u8); - writer.WriteObjectValue(TimerTrigger); + if (TimerTrigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TimerTrigger).Serialize(writer, options); + } } if (Optional.IsDefined(Platform)) { writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } } if (Optional.IsDefined(AgentConfiguration)) { writer.WritePropertyName("agentConfiguration"u8); - writer.WriteObjectValue(AgentConfiguration); + if (AgentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AgentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(SourceRegistryAuth)) { @@ -132,11 +180,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsArchiveEnabled.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryRunData DeserializeContainerRegistryRunData(JsonElement element) + internal static ContainerRegistryRunData DeserializeContainerRegistryRunData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -167,6 +229,7 @@ internal static ContainerRegistryRunData DeserializeContainerRegistryRunData(Jso Optional logArtifact = default; Optional provisioningState = default; Optional isArchiveEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -389,8 +452,61 @@ internal static ContainerRegistryRunData DeserializeContainerRegistryRunData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryRunData(id, name, type, systemData.Value, runId.Value, Optional.ToNullable(status), Optional.ToNullable(lastUpdatedTime), Optional.ToNullable(runType), agentPoolName.Value, Optional.ToNullable(createTime), Optional.ToNullable(startTime), Optional.ToNullable(finishTime), Optional.ToList(outputImages), task.Value, imageUpdateTrigger.Value, sourceTrigger.Value, timerTrigger.Value, platform.Value, agentConfiguration.Value, sourceRegistryAuth.Value, Optional.ToList(customRegistries), runErrorMessage.Value, updateTriggerToken.Value, logArtifact.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(isArchiveEnabled), serializedAdditionalRawData); + } + + ContainerRegistryRunData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRunData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRunData model) + { + if (model is null) + { + return null; } - return new ContainerRegistryRunData(id, name, type, systemData.Value, runId.Value, Optional.ToNullable(status), Optional.ToNullable(lastUpdatedTime), Optional.ToNullable(runType), agentPoolName.Value, Optional.ToNullable(createTime), Optional.ToNullable(startTime), Optional.ToNullable(finishTime), Optional.ToList(outputImages), task.Value, imageUpdateTrigger.Value, sourceTrigger.Value, timerTrigger.Value, platform.Value, agentConfiguration.Value, sourceRegistryAuth.Value, Optional.ToList(customRegistries), runErrorMessage.Value, updateTriggerToken.Value, logArtifact.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(isArchiveEnabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRunData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRunData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.Serialization.cs index 50aeacd78e58..4e37b3144736 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryRunGetLogResult + public partial class ContainerRegistryRunGetLogResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryRunGetLogResult DeserializeContainerRegistryRunGetLogResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(LogLink)) + { + writer.WritePropertyName("logLink"u8); + writer.WriteStringValue(LogLink); + } + if (Optional.IsDefined(LogArtifactLink)) + { + writer.WritePropertyName("logArtifactLink"u8); + writer.WriteStringValue(LogArtifactLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryRunGetLogResult DeserializeContainerRegistryRunGetLogResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional logLink = default; Optional logArtifactLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logLink"u8)) @@ -32,8 +71,61 @@ internal static ContainerRegistryRunGetLogResult DeserializeContainerRegistryRun logArtifactLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryRunGetLogResult(logLink.Value, logArtifactLink.Value); + return new ContainerRegistryRunGetLogResult(logLink.Value, logArtifactLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryRunGetLogResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRunGetLogResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunGetLogResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunGetLogResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRunGetLogResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRunGetLogResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRunGetLogResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.cs index 7d6fa49f9475..08489be4bf85 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunGetLogResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The result of get log link operation. public partial class ContainerRegistryRunGetLogResult { - /// Initializes a new instance of ContainerRegistryRunGetLogResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryRunGetLogResult() { } - /// Initializes a new instance of ContainerRegistryRunGetLogResult. + /// Initializes a new instance of . /// The link to logs for a run on a azure container registry. /// The link to logs in registry for a run on a azure container registry. - internal ContainerRegistryRunGetLogResult(string logLink, string logArtifactLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRunGetLogResult(string logLink, string logArtifactLink, Dictionary serializedAdditionalRawData) { LogLink = logLink; LogArtifactLink = logArtifactLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link to logs for a run on a azure container registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.Serialization.cs index da220563c6a1..b815c9ea18ee 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryRunListResult + internal partial class ContainerRegistryRunListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryRunListResult DeserializeContainerRegistryRunListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryRunListResult DeserializeContainerRegistryRunListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryRunListResult DeserializeContainerRegistryRunLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryRunListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryRunListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryRunListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRunListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRunListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRunListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRunListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.cs index 8fe6d5d734f8..035b0c79b91e 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// Collection of runs. internal partial class ContainerRegistryRunListResult { - /// Initializes a new instance of ContainerRegistryRunListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryRunListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryRunListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal ContainerRegistryRunListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRunListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.Serialization.cs index 4d58d341ab0c..ee5ea214b664 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryRunPatch : IUtf8JsonSerializable + public partial class ContainerRegistryRunPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsArchiveEnabled)) { writer.WritePropertyName("isArchiveEnabled"u8); writer.WriteBooleanValue(IsArchiveEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryRunPatch DeserializeContainerRegistryRunPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional isArchiveEnabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isArchiveEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isArchiveEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryRunPatch(Optional.ToNullable(isArchiveEnabled), serializedAdditionalRawData); + } + + ContainerRegistryRunPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryRunPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryRunPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryRunPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryRunPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.cs index 91d103700b3d..f2f0712e8803 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryRunPatch.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The set of run properties that can be updated. public partial class ContainerRegistryRunPatch { - /// Initializes a new instance of ContainerRegistryRunPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryRunPatch() { } + /// Initializes a new instance of . + /// The value that indicates whether archiving is enabled or not. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryRunPatch(bool? isArchiveEnabled, Dictionary serializedAdditionalRawData) + { + IsArchiveEnabled = isArchiveEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The value that indicates whether archiving is enabled or not. public bool? IsArchiveEnabled { get; set; } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.Serialization.cs index 99ed6351358e..2b8f27b5d443 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistrySecretObject : IUtf8JsonSerializable + public partial class ContainerRegistrySecretObject : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Value)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ObjectType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistrySecretObject DeserializeContainerRegistrySecretObject(JsonElement element) + internal static ContainerRegistrySecretObject DeserializeContainerRegistrySecretObject(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -52,8 +75,61 @@ internal static ContainerRegistrySecretObject DeserializeContainerRegistrySecret type = new ContainerRegistrySecretObjectType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistrySecretObject(value.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + ContainerRegistrySecretObject IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistrySecretObject(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistrySecretObject IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistrySecretObject(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistrySecretObject model) + { + if (model is null) + { + return null; } - return new ContainerRegistrySecretObject(value.Value, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistrySecretObject(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistrySecretObject(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.cs index 42e77b0664b5..124fc85f60ed 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySecretObject.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// Describes the properties of a secret object value. public partial class ContainerRegistrySecretObject { - /// Initializes a new instance of ContainerRegistrySecretObject. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistrySecretObject() { } - /// Initializes a new instance of ContainerRegistrySecretObject. + /// Initializes a new instance of . /// /// The value of the secret. The format of this value will be determined /// based on the type of the secret object. If the type is Opaque, the value will be @@ -25,10 +31,12 @@ public ContainerRegistrySecretObject() /// The type of the secret object which determines how the value of the secret object has to be /// interpreted. /// - internal ContainerRegistrySecretObject(string value, ContainerRegistrySecretObjectType? objectType) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistrySecretObject(string value, ContainerRegistrySecretObjectType? objectType, Dictionary serializedAdditionalRawData) { Value = value; ObjectType = objectType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.Serialization.cs index 836a08c2827c..3f0d5a46c00f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.Serialization.cs @@ -5,29 +5,52 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistrySku : IUtf8JsonSerializable + public partial class ContainerRegistrySku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistrySku DeserializeContainerRegistrySku(JsonElement element) + internal static ContainerRegistrySku DeserializeContainerRegistrySku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ContainerRegistrySkuName name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -44,8 +67,61 @@ internal static ContainerRegistrySku DeserializeContainerRegistrySku(JsonElement tier = new ContainerRegistrySkuTier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistrySku(name, Optional.ToNullable(tier), serializedAdditionalRawData); + } + + ContainerRegistrySku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistrySku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistrySku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistrySku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistrySku model) + { + if (model is null) + { + return null; } - return new ContainerRegistrySku(name, Optional.ToNullable(tier)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistrySku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistrySku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.cs index d1f634e40c8c..9d1e62729e34 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySku.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The SKU of a container registry. public partial class ContainerRegistrySku { - /// Initializes a new instance of ContainerRegistrySku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The SKU name of the container registry. Required for registry creation. public ContainerRegistrySku(ContainerRegistrySkuName name) { Name = name; } - /// Initializes a new instance of ContainerRegistrySku. + /// Initializes a new instance of . /// The SKU name of the container registry. Required for registry creation. /// The SKU tier based on the SKU name. - internal ContainerRegistrySku(ContainerRegistrySkuName name, ContainerRegistrySkuTier? tier) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistrySku(ContainerRegistrySkuName name, ContainerRegistrySkuTier? tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistrySku() + { } /// The SKU name of the container registry. Required for registry creation. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.Serialization.cs index 44871b188a17..b85e930d7401 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.Serialization.cs @@ -5,19 +5,33 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistrySourceTrigger : IUtf8JsonSerializable + public partial class ContainerRegistrySourceTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceRepository"u8); - writer.WriteObjectValue(SourceRepository); + if (SourceRepository is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceRepository).Serialize(writer, options); + } writer.WritePropertyName("sourceTriggerEvents"u8); writer.WriteStartArray(); foreach (var item in SourceTriggerEvents) @@ -32,11 +46,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistrySourceTrigger DeserializeContainerRegistrySourceTrigger(JsonElement element) + internal static ContainerRegistrySourceTrigger DeserializeContainerRegistrySourceTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +73,7 @@ internal static ContainerRegistrySourceTrigger DeserializeContainerRegistrySourc IList sourceTriggerEvents = default; Optional status = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceRepository"u8)) @@ -76,8 +105,61 @@ internal static ContainerRegistrySourceTrigger DeserializeContainerRegistrySourc name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistrySourceTrigger(sourceRepository, sourceTriggerEvents, Optional.ToNullable(status), name, serializedAdditionalRawData); + } + + ContainerRegistrySourceTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistrySourceTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistrySourceTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistrySourceTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistrySourceTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistrySourceTrigger(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistrySourceTrigger(sourceRepository, sourceTriggerEvents, Optional.ToNullable(status), name); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistrySourceTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.cs index 6b0bfcd1cbf5..6a7fe58a8023 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTrigger.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a source based trigger. public partial class ContainerRegistrySourceTrigger { - /// Initializes a new instance of ContainerRegistrySourceTrigger. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The properties that describes the source(code) for the task. /// The source event corresponding to the trigger. /// The name of the trigger. @@ -31,17 +34,24 @@ public ContainerRegistrySourceTrigger(SourceCodeRepoProperties sourceRepository, Name = name; } - /// Initializes a new instance of ContainerRegistrySourceTrigger. + /// Initializes a new instance of . /// The properties that describes the source(code) for the task. /// The source event corresponding to the trigger. /// The current status of trigger. /// The name of the trigger. - internal ContainerRegistrySourceTrigger(SourceCodeRepoProperties sourceRepository, IList sourceTriggerEvents, ContainerRegistryTriggerStatus? status, string name) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistrySourceTrigger(SourceCodeRepoProperties sourceRepository, IList sourceTriggerEvents, ContainerRegistryTriggerStatus? status, string name, Dictionary serializedAdditionalRawData) { SourceRepository = sourceRepository; SourceTriggerEvents = sourceTriggerEvents; Status = status; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistrySourceTrigger() + { } /// The properties that describes the source(code) for the task. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.Serialization.cs index ce6f74a9c66e..40d9be0801e2 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistrySourceTriggerDescriptor : IUtf8JsonSerializable + public partial class ContainerRegistrySourceTriggerDescriptor : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -51,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("providerType"u8); writer.WriteStringValue(ProviderType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistrySourceTriggerDescriptor DeserializeContainerRegistrySourceTriggerDescriptor(JsonElement element) + internal static ContainerRegistrySourceTriggerDescriptor DeserializeContainerRegistrySourceTriggerDescriptor(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +88,7 @@ internal static ContainerRegistrySourceTriggerDescriptor DeserializeContainerReg Optional repositoryUrl = default; Optional branchName = default; Optional providerType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +134,61 @@ internal static ContainerRegistrySourceTriggerDescriptor DeserializeContainerReg providerType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistrySourceTriggerDescriptor(Optional.ToNullable(id), eventType.Value, commitId.Value, pullRequestId.Value, repositoryUrl.Value, branchName.Value, providerType.Value, serializedAdditionalRawData); + } + + ContainerRegistrySourceTriggerDescriptor IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistrySourceTriggerDescriptor(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistrySourceTriggerDescriptor IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistrySourceTriggerDescriptor(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistrySourceTriggerDescriptor model) + { + if (model is null) + { + return null; } - return new ContainerRegistrySourceTriggerDescriptor(Optional.ToNullable(id), eventType.Value, commitId.Value, pullRequestId.Value, repositoryUrl.Value, branchName.Value, providerType.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistrySourceTriggerDescriptor(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistrySourceTriggerDescriptor(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.cs index 0530a4f3024c..9a0dbc147de4 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerDescriptor.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The source trigger that caused a run. public partial class ContainerRegistrySourceTriggerDescriptor { - /// Initializes a new instance of ContainerRegistrySourceTriggerDescriptor. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistrySourceTriggerDescriptor() { } - /// Initializes a new instance of ContainerRegistrySourceTriggerDescriptor. + /// Initializes a new instance of . /// The unique ID of the trigger. /// The event type of the trigger. /// The unique ID that identifies a commit. @@ -25,7 +29,8 @@ public ContainerRegistrySourceTriggerDescriptor() /// The repository URL. /// The branch name in the repository. /// The source control provider type. - internal ContainerRegistrySourceTriggerDescriptor(Guid? id, string eventType, string commitId, string pullRequestId, Uri repositoryUri, string branchName, string providerType) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistrySourceTriggerDescriptor(Guid? id, string eventType, string commitId, string pullRequestId, Uri repositoryUri, string branchName, string providerType, Dictionary serializedAdditionalRawData) { Id = id; EventType = eventType; @@ -34,6 +39,7 @@ internal ContainerRegistrySourceTriggerDescriptor(Guid? id, string eventType, st RepositoryUri = repositoryUri; BranchName = branchName; ProviderType = providerType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique ID of the trigger. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.Serialization.cs index 56f14a21fa89..3bc5b9be9fe3 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistrySourceTriggerUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistrySourceTriggerUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceRepository)) { writer.WritePropertyName("sourceRepository"u8); - writer.WriteObjectValue(SourceRepository); + if (SourceRepository is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceRepository).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(SourceTriggerEvents)) { @@ -37,7 +52,128 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistrySourceTriggerUpdateContent DeserializeContainerRegistrySourceTriggerUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sourceRepository = default; + Optional> sourceTriggerEvents = default; + Optional status = default; + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceRepository"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceRepository = SourceCodeRepoUpdateContent.DeserializeSourceCodeRepoUpdateContent(property.Value); + continue; + } + if (property.NameEquals("sourceTriggerEvents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ContainerRegistrySourceTriggerEvent(item.GetString())); + } + sourceTriggerEvents = array; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryTriggerStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistrySourceTriggerUpdateContent(sourceRepository.Value, Optional.ToList(sourceTriggerEvents), Optional.ToNullable(status), name, serializedAdditionalRawData); + } + + ContainerRegistrySourceTriggerUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistrySourceTriggerUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistrySourceTriggerUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistrySourceTriggerUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistrySourceTriggerUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistrySourceTriggerUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistrySourceTriggerUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.cs index 10f0d476be53..72a3a0b2f186 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistrySourceTriggerUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating a source based trigger. public partial class ContainerRegistrySourceTriggerUpdateContent { - /// Initializes a new instance of ContainerRegistrySourceTriggerUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the trigger. /// is null. public ContainerRegistrySourceTriggerUpdateContent(string name) @@ -25,6 +28,26 @@ public ContainerRegistrySourceTriggerUpdateContent(string name) Name = name; } + /// Initializes a new instance of . + /// The properties that describes the source(code) for the task. + /// The source event corresponding to the trigger. + /// The current status of trigger. + /// The name of the trigger. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistrySourceTriggerUpdateContent(SourceCodeRepoUpdateContent sourceRepository, IList sourceTriggerEvents, ContainerRegistryTriggerStatus? status, string name, Dictionary serializedAdditionalRawData) + { + SourceRepository = sourceRepository; + SourceTriggerEvents = sourceTriggerEvents; + Status = status; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistrySourceTriggerUpdateContent() + { + } + /// The properties that describes the source(code) for the task. public SourceCodeRepoUpdateContent SourceRepository { get; set; } /// The source event corresponding to the trigger. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskData.Serialization.cs index f458cc13cd89..c77786c6ae27 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryTaskData : IUtf8JsonSerializable + public partial class ContainerRegistryTaskData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -47,12 +53,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Platform)) { writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } } if (Optional.IsDefined(AgentConfiguration)) { writer.WritePropertyName("agentConfiguration"u8); - writer.WriteObjectValue(AgentConfiguration); + if (AgentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AgentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(AgentPoolName)) { @@ -67,17 +87,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Step)) { writer.WritePropertyName("step"u8); - writer.WriteObjectValue(Step); + if (Step is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Step).Serialize(writer, options); + } } if (Optional.IsDefined(Trigger)) { writer.WritePropertyName("trigger"u8); - writer.WriteObjectValue(Trigger); + if (Trigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Trigger).Serialize(writer, options); + } } if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } if (Optional.IsDefined(LogTemplate)) { @@ -90,11 +131,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsSystemTask.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTaskData DeserializeContainerRegistryTaskData(JsonElement element) + internal static ContainerRegistryTaskData DeserializeContainerRegistryTaskData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -118,6 +173,7 @@ internal static ContainerRegistryTaskData DeserializeContainerRegistryTaskData(J Optional credentials = default; Optional logTemplate = default; Optional isSystemTask = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -284,8 +340,61 @@ internal static ContainerRegistryTaskData DeserializeContainerRegistryTaskData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTaskData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), Optional.ToNullable(status), platform.Value, agentConfiguration.Value, agentPoolName.Value, Optional.ToNullable(timeout), step.Value, trigger.Value, credentials.Value, logTemplate.Value, Optional.ToNullable(isSystemTask), serializedAdditionalRawData); + } + + ContainerRegistryTaskData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskData(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryTaskData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), Optional.ToNullable(status), platform.Value, agentConfiguration.Value, agentPoolName.Value, Optional.ToNullable(timeout), step.Value, trigger.Value, credentials.Value, logTemplate.Value, Optional.ToNullable(isSystemTask)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.Serialization.cs index 7dc1c4e7df80..5878b23ab222 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryTaskListResult + internal partial class ContainerRegistryTaskListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryTaskListResult DeserializeContainerRegistryTaskListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryTaskListResult DeserializeContainerRegistryTaskListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryTaskListResult DeserializeContainerRegistryTask nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryTaskListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryTaskListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.cs index 50364c54b2fe..7f0fdba419df 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The collection of tasks. internal partial class ContainerRegistryTaskListResult { - /// Initializes a new instance of ContainerRegistryTaskListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryTaskListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryTaskListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal ContainerRegistryTaskListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.Serialization.cs index fda30a50695f..b91fe5a9a4af 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTaskOverridableValue : IUtf8JsonSerializable + public partial class ContainerRegistryTaskOverridableValue : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isSecret"u8); writer.WriteBooleanValue(IsSecret.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTaskOverridableValue DeserializeContainerRegistryTaskOverridableValue(JsonElement element) + internal static ContainerRegistryTaskOverridableValue DeserializeContainerRegistryTaskOverridableValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ContainerRegistryTaskOverridableValue DeserializeContainerRegist string name = default; string value = default; Optional isSecret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +80,61 @@ internal static ContainerRegistryTaskOverridableValue DeserializeContainerRegist isSecret = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTaskOverridableValue(name, value, Optional.ToNullable(isSecret), serializedAdditionalRawData); + } + + ContainerRegistryTaskOverridableValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskOverridableValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskOverridableValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskOverridableValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskOverridableValue model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTaskOverridableValue(name, value, Optional.ToNullable(isSecret)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskOverridableValue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskOverridableValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.cs index bb907dde3a52..b10a8ad424c9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskOverridableValue.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a overridable value that can be passed to a task template. public partial class ContainerRegistryTaskOverridableValue { - /// Initializes a new instance of ContainerRegistryTaskOverridableValue. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the overridable value. /// The overridable value. /// or is null. @@ -26,15 +30,22 @@ public ContainerRegistryTaskOverridableValue(string name, string value) Value = value; } - /// Initializes a new instance of ContainerRegistryTaskOverridableValue. + /// Initializes a new instance of . /// The name of the overridable value. /// The overridable value. /// Flag to indicate whether the value represents a secret or not. - internal ContainerRegistryTaskOverridableValue(string name, string value, bool? isSecret) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskOverridableValue(string name, string value, bool? isSecret, Dictionary serializedAdditionalRawData) { Name = name; Value = value; IsSecret = isSecret; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryTaskOverridableValue() + { } /// The name of the overridable value. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.Serialization.cs index 56fdce0856bf..07612495bec9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTaskPatch : IUtf8JsonSerializable + public partial class ContainerRegistryTaskPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -41,12 +50,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Platform)) { writer.WritePropertyName("platform"u8); - writer.WriteObjectValue(Platform); + if (Platform is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Platform).Serialize(writer, options); + } } if (Optional.IsDefined(AgentConfiguration)) { writer.WritePropertyName("agentConfiguration"u8); - writer.WriteObjectValue(AgentConfiguration); + if (AgentConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AgentConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(AgentPoolName)) { @@ -61,17 +84,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Step)) { writer.WritePropertyName("step"u8); - writer.WriteObjectValue(Step); + if (Step is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Step).Serialize(writer, options); + } } if (Optional.IsDefined(Trigger)) { writer.WritePropertyName("trigger"u8); - writer.WriteObjectValue(Trigger); + if (Trigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Trigger).Serialize(writer, options); + } } if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } if (Optional.IsDefined(LogTemplate)) { @@ -79,7 +123,206 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LogTemplate); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryTaskPatch DeserializeContainerRegistryTaskPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional identity = default; + Optional> tags = default; + Optional status = default; + Optional platform = default; + Optional agentConfiguration = default; + Optional agentPoolName = default; + Optional timeout = default; + Optional step = default; + Optional trigger = default; + Optional credentials = default; + Optional logTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryTaskStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("platform"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + platform = ContainerRegistryPlatformUpdateContent.DeserializeContainerRegistryPlatformUpdateContent(property0.Value); + continue; + } + if (property0.NameEquals("agentConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + agentConfiguration = ContainerRegistryAgentProperties.DeserializeContainerRegistryAgentProperties(property0.Value); + continue; + } + if (property0.NameEquals("agentPoolName"u8)) + { + agentPoolName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("timeout"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeout = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("step"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + step = ContainerRegistryTaskStepUpdateContent.DeserializeContainerRegistryTaskStepUpdateContent(property0.Value); + continue; + } + if (property0.NameEquals("trigger"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + trigger = ContainerRegistryTriggerUpdateContent.DeserializeContainerRegistryTriggerUpdateContent(property0.Value); + continue; + } + if (property0.NameEquals("credentials"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + credentials = ContainerRegistryCredentials.DeserializeContainerRegistryCredentials(property0.Value); + continue; + } + if (property0.NameEquals("logTemplate"u8)) + { + logTemplate = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTaskPatch(identity, Optional.ToDictionary(tags), Optional.ToNullable(status), platform.Value, agentConfiguration.Value, agentPoolName.Value, Optional.ToNullable(timeout), step.Value, trigger.Value, credentials.Value, logTemplate.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.cs index 4e875d96aa68..818f626e405b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,48 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating a task. public partial class ContainerRegistryTaskPatch { - /// Initializes a new instance of ContainerRegistryTaskPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTaskPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Identity for the resource. + /// The ARM resource tags. + /// The current status of task. + /// The platform properties against which the run has to happen. + /// The machine configuration of the run agent. + /// The dedicated agent pool for the task. + /// Run timeout in seconds. + /// + /// The properties for updating a task step. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// The properties for updating trigger properties. + /// The parameters that describes a set of credentials that will be used when this run is invoked. + /// The template that describes the repository and tag information for run log artifact. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskPatch(ManagedServiceIdentity identity, IDictionary tags, ContainerRegistryTaskStatus? status, ContainerRegistryPlatformUpdateContent platform, ContainerRegistryAgentProperties agentConfiguration, string agentPoolName, int? timeoutInSeconds, ContainerRegistryTaskStepUpdateContent step, ContainerRegistryTriggerUpdateContent trigger, ContainerRegistryCredentials credentials, string logTemplate, Dictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Status = status; + Platform = platform; + AgentConfiguration = agentConfiguration; + AgentPoolName = agentPoolName; + TimeoutInSeconds = timeoutInSeconds; + Step = step; + Trigger = trigger; + Credentials = credentials; + LogTemplate = logTemplate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Identity for the resource. public ManagedServiceIdentity Identity { get; set; } /// The ARM resource tags. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.Serialization.cs index 7ccc3985af46..d3d696eecd93 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTaskRunContent : IUtf8JsonSerializable + public partial class ContainerRegistryTaskRunContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("taskId"u8); writer.WriteStringValue(TaskId); if (Optional.IsDefined(OverrideTaskStepProperties)) { writer.WritePropertyName("overrideTaskStepProperties"u8); - writer.WriteObjectValue(OverrideTaskStepProperties); + if (OverrideTaskStepProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OverrideTaskStepProperties).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(RunRequestType); @@ -39,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logTemplate"u8); writer.WriteStringValue(LogTemplate); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTaskRunContent DeserializeContainerRegistryTaskRunContent(JsonElement element) + internal static ContainerRegistryTaskRunContent DeserializeContainerRegistryTaskRunContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +83,7 @@ internal static ContainerRegistryTaskRunContent DeserializeContainerRegistryTask Optional isArchiveEnabled = default; Optional agentPoolName = default; Optional logTemplate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("taskId"u8)) @@ -94,8 +124,61 @@ internal static ContainerRegistryTaskRunContent DeserializeContainerRegistryTask logTemplate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTaskRunContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, taskId, overrideTaskStepProperties.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskRunContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskRunContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskRunContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskRunContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskRunContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskRunContent(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryTaskRunContent(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value, taskId, overrideTaskStepProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskRunContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.cs index bd88ce8ee4a6..f4adb5a3a50f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for a task run request. public partial class ContainerRegistryTaskRunContent : ContainerRegistryRunContent { - /// Initializes a new instance of ContainerRegistryTaskRunContent. + /// Initializes a new instance of . /// The resource ID of task against which run has to be queued. /// is null. public ContainerRegistryTaskRunContent(ResourceIdentifier taskId) @@ -24,20 +25,26 @@ public ContainerRegistryTaskRunContent(ResourceIdentifier taskId) RunRequestType = "TaskRunRequest"; } - /// Initializes a new instance of ContainerRegistryTaskRunContent. + /// Initializes a new instance of . /// The type of the run request. /// The value that indicates whether archiving is enabled for the run or not. /// The dedicated agent pool for the run. /// The template that describes the repository and tag information for run log artifact. /// The resource ID of task against which run has to be queued. /// Set of overridable parameters that can be passed when running a Task. - internal ContainerRegistryTaskRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, ResourceIdentifier taskId, ContainerRegistryOverrideTaskStepProperties overrideTaskStepProperties) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskRunContent(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, ResourceIdentifier taskId, ContainerRegistryOverrideTaskStepProperties overrideTaskStepProperties, Dictionary serializedAdditionalRawData) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate, serializedAdditionalRawData) { TaskId = taskId; OverrideTaskStepProperties = overrideTaskStepProperties; RunRequestType = runRequestType ?? "TaskRunRequest"; } + /// Initializes a new instance of for deserialization. + internal ContainerRegistryTaskRunContent() + { + } + /// The resource ID of task against which run has to be queued. public ResourceIdentifier TaskId { get; set; } /// Set of overridable parameters that can be passed when running a Task. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunData.Serialization.cs index 27bad8ed0428..24faea01da8e 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryTaskRunData : IUtf8JsonSerializable + public partial class ContainerRegistryTaskRunData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -32,7 +40,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RunRequest)) { writer.WritePropertyName("runRequest"u8); - writer.WriteObjectValue(RunRequest); + if (RunRequest is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RunRequest).Serialize(writer, options); + } } if (Optional.IsDefined(ForceUpdateTag)) { @@ -40,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ForceUpdateTag); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTaskRunData DeserializeContainerRegistryTaskRunData(JsonElement element) + internal static ContainerRegistryTaskRunData DeserializeContainerRegistryTaskRunData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +88,7 @@ internal static ContainerRegistryTaskRunData DeserializeContainerRegistryTaskRun Optional runRequest = default; Optional runResult = default; Optional forceUpdateTag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -147,8 +177,61 @@ internal static ContainerRegistryTaskRunData DeserializeContainerRegistryTaskRun } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTaskRunData(id, name, type, systemData.Value, identity, Optional.ToNullable(location), Optional.ToNullable(provisioningState), runRequest.Value, runResult.Value, forceUpdateTag.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskRunData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskRunData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskRunData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskRunData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskRunData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskRunData(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryTaskRunData(id, name, type, systemData.Value, identity, Optional.ToNullable(location), Optional.ToNullable(provisioningState), runRequest.Value, runResult.Value, forceUpdateTag.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskRunData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.Serialization.cs index 2c6efe60861a..f8c4dde7aba6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryTaskRunListResult + internal partial class ContainerRegistryTaskRunListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryTaskRunListResult DeserializeContainerRegistryTaskRunListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryTaskRunListResult DeserializeContainerRegistryTaskRunListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryTaskRunListResult DeserializeContainerRegistryT nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryTaskRunListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryTaskRunListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskRunListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskRunListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskRunListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskRunListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskRunListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskRunListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskRunListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.cs index e41935d4b6c8..cf00f7737499 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The collection of task runs. internal partial class ContainerRegistryTaskRunListResult { - /// Initializes a new instance of ContainerRegistryTaskRunListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryTaskRunListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryTaskRunListResult. + /// Initializes a new instance of . /// The collection value. /// The URI that can be used to request the next set of paged results. - internal ContainerRegistryTaskRunListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskRunListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.Serialization.cs index ba4bdf522933..7a15e76cba65 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTaskRunPatch : IUtf8JsonSerializable + public partial class ContainerRegistryTaskRunPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -41,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RunRequest)) { writer.WritePropertyName("runRequest"u8); - writer.WriteObjectValue(RunRequest); + if (RunRequest is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RunRequest).Serialize(writer, options); + } } if (Optional.IsDefined(ForceUpdateTag)) { @@ -49,7 +65,150 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ForceUpdateTag); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryTaskRunPatch DeserializeContainerRegistryTaskRunPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional identity = default; + Optional location = default; + Optional> tags = default; + Optional runRequest = default; + Optional forceUpdateTag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("runRequest"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runRequest = ContainerRegistryRunContent.DeserializeContainerRegistryRunContent(property0.Value); + continue; + } + if (property0.NameEquals("forceUpdateTag"u8)) + { + forceUpdateTag = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTaskRunPatch(identity, Optional.ToNullable(location), Optional.ToDictionary(tags), runRequest.Value, forceUpdateTag.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskRunPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskRunPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskRunPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskRunPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskRunPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskRunPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskRunPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.cs index 70f4af869bb4..ec67f72bb1c7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskRunPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,36 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating a task run. public partial class ContainerRegistryTaskRunPatch { - /// Initializes a new instance of ContainerRegistryTaskRunPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTaskRunPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Identity for the resource. + /// The location of the resource. + /// The ARM resource tags. + /// + /// The request (parameters) for the new run + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + /// How the run should be forced to rerun even if the run request configuration has not changed. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskRunPatch(ManagedServiceIdentity identity, AzureLocation? location, IDictionary tags, ContainerRegistryRunContent runRequest, string forceUpdateTag, Dictionary serializedAdditionalRawData) + { + Identity = identity; + Location = location; + Tags = tags; + RunRequest = runRequest; + ForceUpdateTag = forceUpdateTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Identity for the resource. public ManagedServiceIdentity Identity { get; set; } /// The location of the resource. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.Serialization.cs index 56cb75ecdf2b..8ffb9f1bb7df 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTaskStepProperties : IUtf8JsonSerializable + public partial class ContainerRegistryTaskStepProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ContainerRegistryTaskStepType.ToString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTaskStepProperties DeserializeContainerRegistryTaskStepProperties(JsonElement element) + internal static ContainerRegistryTaskStepProperties DeserializeContainerRegistryTaskStepProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,7 +67,99 @@ internal static ContainerRegistryTaskStepProperties DeserializeContainerRegistry case "FileTask": return ContainerRegistryFileTaskStep.DeserializeContainerRegistryFileTaskStep(element); } } - return UnknownTaskStepProperties.DeserializeUnknownTaskStepProperties(element); + + // Unknown type found so we will deserialize the base properties only + ContainerRegistryTaskStepType type = default; + Optional> baseImageDependencies = default; + Optional contextPath = default; + Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ContainerRegistryTaskStepType(property.Value.GetString()); + continue; + } + if (property.NameEquals("baseImageDependencies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerRegistryBaseImageDependency.DeserializeContainerRegistryBaseImageDependency(item)); + } + baseImageDependencies = array; + continue; + } + if (property.NameEquals("contextPath"u8)) + { + contextPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("contextAccessToken"u8)) + { + contextAccessToken = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownTaskStepProperties(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskStepProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskStepProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskStepProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskStepProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskStepProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskStepProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskStepProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.cs index c4fe4e4334f7..754c0770b4ed 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepProperties.cs @@ -5,8 +5,10 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { @@ -15,25 +17,31 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownTaskStepProperties))] public abstract partial class ContainerRegistryTaskStepProperties { - /// Initializes a new instance of ContainerRegistryTaskStepProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected ContainerRegistryTaskStepProperties() { BaseImageDependencies = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryTaskStepProperties. + /// Initializes a new instance of . /// The type of the step. /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. - internal ContainerRegistryTaskStepProperties(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskStepProperties(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, Dictionary serializedAdditionalRawData) { ContainerRegistryTaskStepType = containerRegistryTaskStepType; BaseImageDependencies = baseImageDependencies; ContextPath = contextPath; ContextAccessToken = contextAccessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the step. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.Serialization.cs index d2e3bec12299..4b70b0d87557 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTaskStepUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryTaskStepUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(StepType.ToString()); @@ -27,7 +35,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryTaskStepUpdateContent DeserializeContainerRegistryTaskStepUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Docker": return ContainerRegistryDockerBuildStepUpdateContent.DeserializeContainerRegistryDockerBuildStepUpdateContent(element); + case "EncodedTask": return ContainerRegistryEncodedTaskStepUpdateContent.DeserializeContainerRegistryEncodedTaskStepUpdateContent(element); + case "FileTask": return ContainerRegistryFileTaskStepUpdateContent.DeserializeContainerRegistryFileTaskStepUpdateContent(element); + } + } + + // Unknown type found so we will deserialize the base properties only + ContainerRegistryTaskStepType type = default; + Optional contextPath = default; + Optional contextAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ContainerRegistryTaskStepType(property.Value.GetString()); + continue; + } + if (property.NameEquals("contextPath"u8)) + { + contextPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("contextAccessToken"u8)) + { + contextAccessToken = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Models.ContainerRegistryTaskStepUpdateContent(type, contextPath.Value, contextAccessToken.Value, serializedAdditionalRawData); + } + + ContainerRegistryTaskStepUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTaskStepUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskStepUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskStepUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTaskStepUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTaskStepUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTaskStepUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.cs index 98dea950ae8b..0edd406f9e48 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTaskStepUpdateContent.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// @@ -14,11 +17,27 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// public abstract partial class ContainerRegistryTaskStepUpdateContent { - /// Initializes a new instance of ContainerRegistryTaskStepUpdateContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected ContainerRegistryTaskStepUpdateContent() { } + /// Initializes a new instance of . + /// The type of the step. + /// The URL(absolute or relative) of the source context for the task step. + /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTaskStepUpdateContent(ContainerRegistryTaskStepType stepType, string contextPath, string contextAccessToken, Dictionary serializedAdditionalRawData) + { + StepType = stepType; + ContextPath = contextPath; + ContextAccessToken = contextAccessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The type of the step. internal ContainerRegistryTaskStepType StepType { get; set; } /// The URL(absolute or relative) of the source context for the task step. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.Serialization.cs index 393091fbeb01..1562f7546688 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTimerTrigger : IUtf8JsonSerializable + public partial class ContainerRegistryTimerTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("schedule"u8); writer.WriteStringValue(Schedule); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTimerTrigger DeserializeContainerRegistryTimerTrigger(JsonElement element) + internal static ContainerRegistryTimerTrigger DeserializeContainerRegistryTimerTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static ContainerRegistryTimerTrigger DeserializeContainerRegistryTimerT string schedule = default; Optional status = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schedule"u8)) @@ -57,8 +80,61 @@ internal static ContainerRegistryTimerTrigger DeserializeContainerRegistryTimerT name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTimerTrigger(schedule, Optional.ToNullable(status), name, serializedAdditionalRawData); + } + + ContainerRegistryTimerTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTimerTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTimerTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTimerTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTimerTrigger model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTimerTrigger(schedule, Optional.ToNullable(status), name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTimerTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTimerTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.cs index 323d8c5c5d93..6af61ca34f87 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTrigger.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a timer trigger. public partial class ContainerRegistryTimerTrigger { - /// Initializes a new instance of ContainerRegistryTimerTrigger. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The CRON expression for the task schedule. /// The name of the trigger. /// or is null. @@ -26,15 +30,22 @@ public ContainerRegistryTimerTrigger(string schedule, string name) Name = name; } - /// Initializes a new instance of ContainerRegistryTimerTrigger. + /// Initializes a new instance of . /// The CRON expression for the task schedule. /// The current status of trigger. /// The name of the trigger. - internal ContainerRegistryTimerTrigger(string schedule, ContainerRegistryTriggerStatus? status, string name) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTimerTrigger(string schedule, ContainerRegistryTriggerStatus? status, string name, Dictionary serializedAdditionalRawData) { Schedule = schedule; Status = status; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryTimerTrigger() + { } /// The CRON expression for the task schedule. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.Serialization.cs index 7b062956253e..fb8f1bc1c16f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTimerTriggerDescriptor : IUtf8JsonSerializable + public partial class ContainerRegistryTimerTriggerDescriptor : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TimerTriggerName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("scheduleOccurrence"u8); writer.WriteStringValue(ScheduleOccurrence); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTimerTriggerDescriptor DeserializeContainerRegistryTimerTriggerDescriptor(JsonElement element) + internal static ContainerRegistryTimerTriggerDescriptor DeserializeContainerRegistryTimerTriggerDescriptor(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional timerTriggerName = default; Optional scheduleOccurrence = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timerTriggerName"u8)) @@ -48,8 +71,61 @@ internal static ContainerRegistryTimerTriggerDescriptor DeserializeContainerRegi scheduleOccurrence = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTimerTriggerDescriptor(timerTriggerName.Value, scheduleOccurrence.Value, serializedAdditionalRawData); + } + + ContainerRegistryTimerTriggerDescriptor IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTimerTriggerDescriptor(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTimerTriggerDescriptor IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTimerTriggerDescriptor(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTimerTriggerDescriptor model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTimerTriggerDescriptor(timerTriggerName.Value, scheduleOccurrence.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTimerTriggerDescriptor(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTimerTriggerDescriptor(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.cs index 27a27f7690b9..c0d0fb069b66 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerDescriptor.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The ContainerRegistryTimerTriggerDescriptor. public partial class ContainerRegistryTimerTriggerDescriptor { - /// Initializes a new instance of ContainerRegistryTimerTriggerDescriptor. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTimerTriggerDescriptor() { } - /// Initializes a new instance of ContainerRegistryTimerTriggerDescriptor. + /// Initializes a new instance of . /// The timer trigger name that caused the run. /// The occurrence that triggered the run. - internal ContainerRegistryTimerTriggerDescriptor(string timerTriggerName, string scheduleOccurrence) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTimerTriggerDescriptor(string timerTriggerName, string scheduleOccurrence, Dictionary serializedAdditionalRawData) { TimerTriggerName = timerTriggerName; ScheduleOccurrence = scheduleOccurrence; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The timer trigger name that caused the run. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.Serialization.cs index d50a48d6e88b..b0109593030f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTimerTriggerUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryTimerTriggerUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Schedule)) { @@ -27,7 +35,109 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryTimerTriggerUpdateContent DeserializeContainerRegistryTimerTriggerUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional schedule = default; + Optional status = default; + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("schedule"u8)) + { + schedule = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryTriggerStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTimerTriggerUpdateContent(schedule.Value, Optional.ToNullable(status), name, serializedAdditionalRawData); + } + + ContainerRegistryTimerTriggerUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTimerTriggerUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTimerTriggerUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTimerTriggerUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTimerTriggerUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTimerTriggerUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTimerTriggerUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.cs index 569514e5b3b4..e16d7629c679 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTimerTriggerUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating a timer trigger. public partial class ContainerRegistryTimerTriggerUpdateContent { - /// Initializes a new instance of ContainerRegistryTimerTriggerUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the trigger. /// is null. public ContainerRegistryTimerTriggerUpdateContent(string name) @@ -23,6 +27,24 @@ public ContainerRegistryTimerTriggerUpdateContent(string name) Name = name; } + /// Initializes a new instance of . + /// The CRON expression for the task schedule. + /// The current status of trigger. + /// The name of the trigger. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTimerTriggerUpdateContent(string schedule, ContainerRegistryTriggerStatus? status, string name, Dictionary serializedAdditionalRawData) + { + Schedule = schedule; + Status = status; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryTimerTriggerUpdateContent() + { + } + /// The CRON expression for the task schedule. public string Schedule { get; set; } /// The current status of trigger. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.Serialization.cs index 355ac1dad26f..63f23a52bd6a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTokenCertificate : IUtf8JsonSerializable + public partial class ContainerRegistryTokenCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("encodedPemCertificate"u8); writer.WriteStringValue(EncodedPemCertificate); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTokenCertificate DeserializeContainerRegistryTokenCertificate(JsonElement element) + internal static ContainerRegistryTokenCertificate DeserializeContainerRegistryTokenCertificate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static ContainerRegistryTokenCertificate DeserializeContainerRegistryTo Optional expiry = default; Optional thumbprint = default; Optional encodedPemCertificate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -79,8 +101,61 @@ internal static ContainerRegistryTokenCertificate DeserializeContainerRegistryTo encodedPemCertificate = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTokenCertificate(Optional.ToNullable(name), Optional.ToNullable(expiry), thumbprint.Value, encodedPemCertificate.Value, serializedAdditionalRawData); + } + + ContainerRegistryTokenCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTokenCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTokenCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTokenCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTokenCertificate model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTokenCertificate(Optional.ToNullable(name), Optional.ToNullable(expiry), thumbprint.Value, encodedPemCertificate.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTokenCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTokenCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.cs index 19a21fb17c90..e56d42ccc6a0 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCertificate.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The properties of a certificate used for authenticating a token. public partial class ContainerRegistryTokenCertificate { - /// Initializes a new instance of ContainerRegistryTokenCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTokenCertificate() { } - /// Initializes a new instance of ContainerRegistryTokenCertificate. + /// Initializes a new instance of . /// /// The expiry datetime of the certificate. /// The thumbprint of the certificate. /// Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. - internal ContainerRegistryTokenCertificate(ContainerRegistryTokenCertificateName? name, DateTimeOffset? expireOn, string thumbprint, string encodedPemCertificate) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTokenCertificate(ContainerRegistryTokenCertificateName? name, DateTimeOffset? expireOn, string thumbprint, string encodedPemCertificate, Dictionary serializedAdditionalRawData) { Name = name; ExpireOn = expireOn; Thumbprint = thumbprint; EncodedPemCertificate = encodedPemCertificate; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the name. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.Serialization.cs index 7254c5ec48ef..c27f455da5d9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTokenCredentials : IUtf8JsonSerializable + public partial class ContainerRegistryTokenCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Certificates)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Certificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,21 +46,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Passwords) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTokenCredentials DeserializeContainerRegistryTokenCredentials(JsonElement element) + internal static ContainerRegistryTokenCredentials DeserializeContainerRegistryTokenCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> certificates = default; Optional> passwords = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("certificates"u8)) @@ -77,8 +113,61 @@ internal static ContainerRegistryTokenCredentials DeserializeContainerRegistryTo passwords = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTokenCredentials(Optional.ToList(certificates), Optional.ToList(passwords), serializedAdditionalRawData); + } + + ContainerRegistryTokenCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTokenCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTokenCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTokenCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTokenCredentials model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTokenCredentials(Optional.ToList(certificates), Optional.ToList(passwords)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTokenCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTokenCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.cs index 1e5d90471c64..223e271753ce 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenCredentials.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of the credentials that can be used for authenticating the token. public partial class ContainerRegistryTokenCredentials { - /// Initializes a new instance of ContainerRegistryTokenCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTokenCredentials() { Certificates = new ChangeTrackingList(); Passwords = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryTokenCredentials. + /// Initializes a new instance of . /// /// - internal ContainerRegistryTokenCredentials(IList certificates, IList passwords) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTokenCredentials(IList certificates, IList passwords, Dictionary serializedAdditionalRawData) { Certificates = certificates; Passwords = passwords; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the certificates. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenData.Serialization.cs index 7e05d7829eaa..433ad0124bf6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryTokenData : IUtf8JsonSerializable + public partial class ContainerRegistryTokenData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } if (Optional.IsDefined(Status)) { @@ -36,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Status.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTokenData DeserializeContainerRegistryTokenData(JsonElement element) + internal static ContainerRegistryTokenData DeserializeContainerRegistryTokenData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static ContainerRegistryTokenData DeserializeContainerRegistryTokenData Optional scopeMapId = default; Optional credentials = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -137,8 +166,61 @@ internal static ContainerRegistryTokenData DeserializeContainerRegistryTokenData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTokenData(id, name, type, systemData.Value, Optional.ToNullable(creationDate), Optional.ToNullable(provisioningState), scopeMapId.Value, credentials.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + ContainerRegistryTokenData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTokenData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTokenData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTokenData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTokenData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTokenData(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryTokenData(id, name, type, systemData.Value, Optional.ToNullable(creationDate), Optional.ToNullable(provisioningState), scopeMapId.Value, credentials.Value, Optional.ToNullable(status)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTokenData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.Serialization.cs index fb5d3d540e45..b9a1e3c09f12 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryTokenListResult + internal partial class ContainerRegistryTokenListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryTokenListResult DeserializeContainerRegistryTokenListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryTokenListResult DeserializeContainerRegistryTokenListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryTokenListResult DeserializeContainerRegistryTok nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryTokenListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryTokenListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryTokenListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTokenListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTokenListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTokenListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTokenListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTokenListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTokenListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.cs index 706f8a25703c..9fe9facbded7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list tokens for a container registry. internal partial class ContainerRegistryTokenListResult { - /// Initializes a new instance of ContainerRegistryTokenListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryTokenListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryTokenListResult. + /// Initializes a new instance of . /// The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. /// The URI that can be used to request the next list of tokens. - internal ContainerRegistryTokenListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTokenListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.Serialization.cs index c2307886ec39..06a30f3efa69 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTokenPassword : IUtf8JsonSerializable + public partial class ContainerRegistryTokenPassword : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CreatedOn)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTokenPassword DeserializeContainerRegistryTokenPassword(JsonElement element) + internal static ContainerRegistryTokenPassword DeserializeContainerRegistryTokenPassword(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +65,7 @@ internal static ContainerRegistryTokenPassword DeserializeContainerRegistryToken Optional expiry = default; Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("creationTime"u8)) @@ -78,8 +100,61 @@ internal static ContainerRegistryTokenPassword DeserializeContainerRegistryToken value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTokenPassword(Optional.ToNullable(creationTime), Optional.ToNullable(expiry), Optional.ToNullable(name), value.Value, serializedAdditionalRawData); + } + + ContainerRegistryTokenPassword IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTokenPassword(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTokenPassword IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTokenPassword(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTokenPassword model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTokenPassword(Optional.ToNullable(creationTime), Optional.ToNullable(expiry), Optional.ToNullable(name), value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTokenPassword(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTokenPassword(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.cs index 121a041fdf41..87fa1bb2fcd9 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPassword.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The password that will be used for authenticating the token of a container registry. public partial class ContainerRegistryTokenPassword { - /// Initializes a new instance of ContainerRegistryTokenPassword. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTokenPassword() { } - /// Initializes a new instance of ContainerRegistryTokenPassword. + /// Initializes a new instance of . /// The creation datetime of the password. /// The expiry datetime of the password. /// The password name "password1" or "password2". /// The password value. - internal ContainerRegistryTokenPassword(DateTimeOffset? createdOn, DateTimeOffset? expireOn, ContainerRegistryTokenPasswordName? name, string value) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTokenPassword(DateTimeOffset? createdOn, DateTimeOffset? expireOn, ContainerRegistryTokenPasswordName? name, string value, Dictionary serializedAdditionalRawData) { CreatedOn = createdOn; ExpireOn = expireOn; Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The creation datetime of the password. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.Serialization.cs index 490c59237b1b..94018b774eda 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTokenPatch : IUtf8JsonSerializable + public partial class ContainerRegistryTokenPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,10 +38,139 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credentials)) { writer.WritePropertyName("credentials"u8); - writer.WriteObjectValue(Credentials); + if (Credentials is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credentials).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryTokenPatch DeserializeContainerRegistryTokenPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scopeMapId = default; + Optional status = default; + Optional credentials = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("scopeMapId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scopeMapId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryTokenStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("credentials"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + credentials = ContainerRegistryTokenCredentials.DeserializeContainerRegistryTokenCredentials(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTokenPatch(scopeMapId.Value, Optional.ToNullable(status), credentials.Value, serializedAdditionalRawData); + } + + ContainerRegistryTokenPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTokenPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTokenPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTokenPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTokenPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTokenPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTokenPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.cs index 60fe187ca089..16c2e7b01a80 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTokenPatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -12,11 +14,27 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating a token. public partial class ContainerRegistryTokenPatch { - /// Initializes a new instance of ContainerRegistryTokenPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTokenPatch() { } + /// Initializes a new instance of . + /// The resource ID of the scope map to which the token will be associated with. + /// The status of the token example enabled or disabled. + /// The credentials that can be used for authenticating the token. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTokenPatch(ResourceIdentifier scopeMapId, ContainerRegistryTokenStatus? status, ContainerRegistryTokenCredentials credentials, Dictionary serializedAdditionalRawData) + { + ScopeMapId = scopeMapId; + Status = status; + Credentials = credentials; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The resource ID of the scope map to which the token will be associated with. public ResourceIdentifier ScopeMapId { get; set; } /// The status of the token example enabled or disabled. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.Serialization.cs index 7280b65c791e..09ce1053f9df 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTriggerProperties : IUtf8JsonSerializable + public partial class ContainerRegistryTriggerProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(TimerTriggers)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TimerTriggers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,20 +46,48 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SourceTriggers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(BaseImageTrigger)) { writer.WritePropertyName("baseImageTrigger"u8); - writer.WriteObjectValue(BaseImageTrigger); + if (BaseImageTrigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BaseImageTrigger).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerRegistryTriggerProperties DeserializeContainerRegistryTriggerProperties(JsonElement element) + internal static ContainerRegistryTriggerProperties DeserializeContainerRegistryTriggerProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +95,7 @@ internal static ContainerRegistryTriggerProperties DeserializeContainerRegistryT Optional> timerTriggers = default; Optional> sourceTriggers = default; Optional baseImageTrigger = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timerTriggers"u8)) @@ -92,8 +135,61 @@ internal static ContainerRegistryTriggerProperties DeserializeContainerRegistryT baseImageTrigger = ContainerRegistryBaseImageTrigger.DeserializeContainerRegistryBaseImageTrigger(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTriggerProperties(Optional.ToList(timerTriggers), Optional.ToList(sourceTriggers), baseImageTrigger.Value, serializedAdditionalRawData); + } + + ContainerRegistryTriggerProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTriggerProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTriggerProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTriggerProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTriggerProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTriggerProperties(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryTriggerProperties(Optional.ToList(timerTriggers), Optional.ToList(sourceTriggers), baseImageTrigger.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTriggerProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.cs index 7880608a81a1..49bec1b3b3d6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of a trigger. public partial class ContainerRegistryTriggerProperties { - /// Initializes a new instance of ContainerRegistryTriggerProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTriggerProperties() { TimerTriggers = new ChangeTrackingList(); SourceTriggers = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryTriggerProperties. + /// Initializes a new instance of . /// The collection of timer triggers. /// The collection of triggers based on source code repository. /// The trigger based on base image dependencies. - internal ContainerRegistryTriggerProperties(IList timerTriggers, IList sourceTriggers, ContainerRegistryBaseImageTrigger baseImageTrigger) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTriggerProperties(IList timerTriggers, IList sourceTriggers, ContainerRegistryBaseImageTrigger baseImageTrigger, Dictionary serializedAdditionalRawData) { TimerTriggers = timerTriggers; SourceTriggers = sourceTriggers; BaseImageTrigger = baseImageTrigger; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection of timer triggers. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.Serialization.cs index a3f2d8824f57..3d19d9b255af 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTriggerUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryTriggerUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(TimerTriggers)) { @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TimerTriggers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -31,16 +46,150 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SourceTriggers) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(BaseImageTrigger)) { writer.WritePropertyName("baseImageTrigger"u8); - writer.WriteObjectValue(BaseImageTrigger); + if (BaseImageTrigger is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BaseImageTrigger).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ContainerRegistryTriggerUpdateContent DeserializeContainerRegistryTriggerUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> timerTriggers = default; + Optional> sourceTriggers = default; + Optional baseImageTrigger = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timerTriggers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerRegistryTimerTriggerUpdateContent.DeserializeContainerRegistryTimerTriggerUpdateContent(item)); + } + timerTriggers = array; + continue; + } + if (property.NameEquals("sourceTriggers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerRegistrySourceTriggerUpdateContent.DeserializeContainerRegistrySourceTriggerUpdateContent(item)); + } + sourceTriggers = array; + continue; + } + if (property.NameEquals("baseImageTrigger"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baseImageTrigger = ContainerRegistryBaseImageTriggerUpdateContent.DeserializeContainerRegistryBaseImageTriggerUpdateContent(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTriggerUpdateContent(Optional.ToList(timerTriggers), Optional.ToList(sourceTriggers), baseImageTrigger.Value, serializedAdditionalRawData); + } + + ContainerRegistryTriggerUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTriggerUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTriggerUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTriggerUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTriggerUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTriggerUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTriggerUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.cs index 5e3d5bc10e31..d1c1d3abb9ba 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTriggerUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,29 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating triggers. public partial class ContainerRegistryTriggerUpdateContent { - /// Initializes a new instance of ContainerRegistryTriggerUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTriggerUpdateContent() { TimerTriggers = new ChangeTrackingList(); SourceTriggers = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The collection of timer triggers. + /// The collection of triggers based on source code repository. + /// The trigger based on base image dependencies. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTriggerUpdateContent(IList timerTriggers, IList sourceTriggers, ContainerRegistryBaseImageTriggerUpdateContent baseImageTrigger, Dictionary serializedAdditionalRawData) + { + TimerTriggers = timerTriggers; + SourceTriggers = sourceTriggers; + BaseImageTrigger = baseImageTrigger; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The collection of timer triggers. public IList TimerTriggers { get; } /// The collection of triggers based on source code repository. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.Serialization.cs index 0515bcd519b4..bd537446fbaf 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryTrustPolicy : IUtf8JsonSerializable + public partial class ContainerRegistryTrustPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PolicyType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryTrustPolicy DeserializeContainerRegistryTrustPolicy(JsonElement element) + internal static ContainerRegistryTrustPolicy DeserializeContainerRegistryTrustPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -56,8 +79,61 @@ internal static ContainerRegistryTrustPolicy DeserializeContainerRegistryTrustPo status = new ContainerRegistryPolicyStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryTrustPolicy(Optional.ToNullable(type), Optional.ToNullable(status), serializedAdditionalRawData); + } + + ContainerRegistryTrustPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryTrustPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTrustPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTrustPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryTrustPolicy model) + { + if (model is null) + { + return null; } - return new ContainerRegistryTrustPolicy(Optional.ToNullable(type), Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryTrustPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryTrustPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.cs index 1ffa9208dacb..cd340c192dc0 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryTrustPolicy.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The content trust policy for a container registry. public partial class ContainerRegistryTrustPolicy { - /// Initializes a new instance of ContainerRegistryTrustPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryTrustPolicy() { } - /// Initializes a new instance of ContainerRegistryTrustPolicy. + /// Initializes a new instance of . /// The type of trust policy. /// The value that indicates whether the policy is enabled or not. - internal ContainerRegistryTrustPolicy(ContainerRegistryTrustPolicyType? policyType, ContainerRegistryPolicyStatus? status) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryTrustPolicy(ContainerRegistryTrustPolicyType? policyType, ContainerRegistryPolicyStatus? status, Dictionary serializedAdditionalRawData) { PolicyType = policyType; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of trust policy. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.Serialization.cs index 4b3f74effe4e..5cbaef1aaed4 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryUsage + public partial class ContainerRegistryUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryUsage DeserializeContainerRegistryUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (Optional.IsDefined(CurrentValue)) + { + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue.Value); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryUsage DeserializeContainerRegistryUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static ContainerRegistryUsage DeserializeContainerRegistryUsage(JsonEle Optional limit = default; Optional currentValue = default; Optional unit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -56,8 +105,61 @@ internal static ContainerRegistryUsage DeserializeContainerRegistryUsage(JsonEle unit = new ContainerRegistryUsageUnit(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryUsage(name.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), Optional.ToNullable(unit)); + return new ContainerRegistryUsage(name.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), Optional.ToNullable(unit), serializedAdditionalRawData); + } + + ContainerRegistryUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.cs index dfe8471739b0..8ca2786faa2d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsage.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The quota usage for a container registry. public partial class ContainerRegistryUsage { - /// Initializes a new instance of ContainerRegistryUsage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryUsage() { } - /// Initializes a new instance of ContainerRegistryUsage. + /// Initializes a new instance of . /// The name of the usage. /// The limit of the usage. /// The current value of the usage. /// The unit of measurement. - internal ContainerRegistryUsage(string name, long? limit, long? currentValue, ContainerRegistryUsageUnit? unit) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryUsage(string name, long? limit, long? currentValue, ContainerRegistryUsageUnit? unit, Dictionary serializedAdditionalRawData) { Name = name; Limit = limit; CurrentValue = currentValue; Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the usage. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.Serialization.cs index ad335b6869e3..87bdaf56136f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryUsageListResult + internal partial class ContainerRegistryUsageListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryUsageListResult DeserializeContainerRegistryUsageListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryUsageListResult DeserializeContainerRegistryUsageListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static ContainerRegistryUsageListResult DeserializeContainerRegistryUsa value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryUsageListResult(Optional.ToList(value)); + return new ContainerRegistryUsageListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ContainerRegistryUsageListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryUsageListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryUsageListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryUsageListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryUsageListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryUsageListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryUsageListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.cs index 18f27c66f6f9..51fdad16335f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryUsageListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to get container registry quota usages. internal partial class ContainerRegistryUsageListResult { - /// Initializes a new instance of ContainerRegistryUsageListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryUsageListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryUsageListResult. + /// Initializes a new instance of . /// The list of container registry quota usages. - internal ContainerRegistryUsageListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryUsageListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of container registry quota usages. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.Serialization.cs index b69668264c2b..d7be53f328b7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.Serialization.cs @@ -8,20 +8,60 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookCallbackConfig + public partial class ContainerRegistryWebhookCallbackConfig : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookCallbackConfig DeserializeContainerRegistryWebhookCallbackConfig(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("serviceUri"u8); + writer.WriteStringValue(ServiceUri.AbsoluteUri); + if (Optional.IsCollectionDefined(CustomHeaders)) + { + writer.WritePropertyName("customHeaders"u8); + writer.WriteStartObject(); + foreach (var item in CustomHeaders) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookCallbackConfig DeserializeContainerRegistryWebhookCallbackConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Uri serviceUri = default; Optional> customHeaders = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serviceUri"u8)) @@ -43,8 +83,61 @@ internal static ContainerRegistryWebhookCallbackConfig DeserializeContainerRegis customHeaders = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookCallbackConfig(serviceUri, Optional.ToDictionary(customHeaders)); + return new ContainerRegistryWebhookCallbackConfig(serviceUri, Optional.ToDictionary(customHeaders), serializedAdditionalRawData); + } + + ContainerRegistryWebhookCallbackConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookCallbackConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookCallbackConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookCallbackConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookCallbackConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookCallbackConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookCallbackConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.cs index 8202a0570efc..2ce795af028f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCallbackConfig.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The configuration of service URI and custom headers for the webhook. public partial class ContainerRegistryWebhookCallbackConfig { - /// Initializes a new instance of ContainerRegistryWebhookCallbackConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The service URI for the webhook to post notifications. /// is null. internal ContainerRegistryWebhookCallbackConfig(Uri serviceUri) @@ -25,13 +28,20 @@ internal ContainerRegistryWebhookCallbackConfig(Uri serviceUri) CustomHeaders = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerRegistryWebhookCallbackConfig. + /// Initializes a new instance of . /// The service URI for the webhook to post notifications. /// Custom headers that will be added to the webhook notifications. - internal ContainerRegistryWebhookCallbackConfig(Uri serviceUri, IReadOnlyDictionary customHeaders) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookCallbackConfig(Uri serviceUri, IReadOnlyDictionary customHeaders, Dictionary serializedAdditionalRawData) { ServiceUri = serviceUri; CustomHeaders = customHeaders; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryWebhookCallbackConfig() + { } /// The service URI for the webhook to post notifications. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.Serialization.cs index d5e9bb54ce12..fd5f0a6d61b0 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ContainerRegistryWebhookCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -67,7 +75,176 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryWebhookCreateOrUpdateContent DeserializeContainerRegistryWebhookCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + AzureLocation location = default; + Optional serviceUri = default; + Optional> customHeaders = default; + Optional status = default; + Optional scope = default; + Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("serviceUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("customHeaders"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + customHeaders = dictionary; + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryWebhookStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("actions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new ContainerRegistryWebhookAction(item.GetString())); + } + actions = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryWebhookCreateOrUpdateContent(Optional.ToDictionary(tags), location, serviceUri.Value, Optional.ToDictionary(customHeaders), Optional.ToNullable(status), scope.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + ContainerRegistryWebhookCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.cs index e029583aa401..d8579e181471 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookCreateOrUpdateContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for creating a webhook. public partial class ContainerRegistryWebhookCreateOrUpdateContent { - /// Initializes a new instance of ContainerRegistryWebhookCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location of the webhook. This cannot be changed after the resource is created. public ContainerRegistryWebhookCreateOrUpdateContent(AzureLocation location) { @@ -24,6 +27,32 @@ public ContainerRegistryWebhookCreateOrUpdateContent(AzureLocation location) Actions = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The tags for the webhook. + /// The location of the webhook. This cannot be changed after the resource is created. + /// The service URI for the webhook to post notifications. + /// Custom headers that will be added to the webhook notifications. + /// The status of the webhook at the time the operation was called. + /// The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + /// The list of actions that trigger the webhook to post notifications. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookCreateOrUpdateContent(IDictionary tags, AzureLocation location, Uri serviceUri, IDictionary customHeaders, ContainerRegistryWebhookStatus? status, string scope, IList actions, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Location = location; + ServiceUri = serviceUri; + CustomHeaders = customHeaders; + Status = status; + Scope = scope; + Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerRegistryWebhookCreateOrUpdateContent() + { + } + /// The tags for the webhook. public IDictionary Tags { get; } /// The location of the webhook. This cannot be changed after the resource is created. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookData.Serialization.cs index 846cb0431594..27f63a1567fa 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ContainerRegistryWebhookData : IUtf8JsonSerializable + public partial class ContainerRegistryWebhookData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -54,11 +61,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerRegistryWebhookData DeserializeContainerRegistryWebhookData(JsonElement element) + internal static ContainerRegistryWebhookData DeserializeContainerRegistryWebhookData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +94,7 @@ internal static ContainerRegistryWebhookData DeserializeContainerRegistryWebhook Optional scope = default; Optional> actions = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -167,8 +189,61 @@ internal static ContainerRegistryWebhookData DeserializeContainerRegistryWebhook } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryWebhookData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(status), scope.Value, Optional.ToList(actions), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ContainerRegistryWebhookData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookData model) + { + if (model is null) + { + return null; } - return new ContainerRegistryWebhookData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(status), scope.Value, Optional.ToList(actions), Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.Serialization.cs index e22e81e5317f..e63cadd90e24 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.Serialization.cs @@ -6,15 +6,71 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEvent + public partial class ContainerRegistryWebhookEvent : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEvent DeserializeContainerRegistryWebhookEvent(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(EventRequestMessage)) + { + writer.WritePropertyName("eventRequestMessage"u8); + if (EventRequestMessage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EventRequestMessage).Serialize(writer, options); + } + } + if (Optional.IsDefined(EventResponseMessage)) + { + writer.WritePropertyName("eventResponseMessage"u8); + if (EventResponseMessage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EventResponseMessage).Serialize(writer, options); + } + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEvent DeserializeContainerRegistryWebhookEvent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +78,7 @@ internal static ContainerRegistryWebhookEvent DeserializeContainerRegistryWebhoo Optional eventRequestMessage = default; Optional eventResponseMessage = default; Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eventRequestMessage"u8)) @@ -51,8 +108,61 @@ internal static ContainerRegistryWebhookEvent DeserializeContainerRegistryWebhoo id = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEvent(Optional.ToNullable(id), eventRequestMessage.Value, eventResponseMessage.Value); + return new ContainerRegistryWebhookEvent(Optional.ToNullable(id), eventRequestMessage.Value, eventResponseMessage.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEvent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEvent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEvent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEvent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEvent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEvent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEvent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.cs index 8755565b845f..c68a477bf217 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEvent.cs @@ -6,22 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The event for a webhook. public partial class ContainerRegistryWebhookEvent : ContainerRegistryWebhookEventInfo { - /// Initializes a new instance of ContainerRegistryWebhookEvent. + /// Initializes a new instance of . internal ContainerRegistryWebhookEvent() { } - /// Initializes a new instance of ContainerRegistryWebhookEvent. + /// Initializes a new instance of . /// The event ID. /// The event request message sent to the service URI. /// The event response message received from the service URI. - internal ContainerRegistryWebhookEvent(Guid? id, ContainerRegistryWebhookEventRequestMessage eventRequestMessage, ContainerRegistryWebhookEventResponseMessage eventResponseMessage) : base(id) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEvent(Guid? id, ContainerRegistryWebhookEventRequestMessage eventRequestMessage, ContainerRegistryWebhookEventResponseMessage eventResponseMessage, Dictionary serializedAdditionalRawData) : base(id, serializedAdditionalRawData) { EventRequestMessage = eventRequestMessage; EventResponseMessage = eventResponseMessage; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.Serialization.cs index 65ce25ce9123..9dd1e6e40bab 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryWebhookEventActor + internal partial class ContainerRegistryWebhookEventActor : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventActor DeserializeContainerRegistryWebhookEventActor(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventActor DeserializeContainerRegistryWebhookEventActor(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -26,8 +60,61 @@ internal static ContainerRegistryWebhookEventActor DeserializeContainerRegistryW name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventActor(name.Value); + return new ContainerRegistryWebhookEventActor(name.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventActor IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventActor(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventActor IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventActor(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventActor model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventActor(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventActor(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.cs index 126bf1f10e95..19f9ad210156 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventActor.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. internal partial class ContainerRegistryWebhookEventActor { - /// Initializes a new instance of ContainerRegistryWebhookEventActor. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventActor() { } - /// Initializes a new instance of ContainerRegistryWebhookEventActor. + /// Initializes a new instance of . /// The subject or username associated with the request context that generated the event. - internal ContainerRegistryWebhookEventActor(string name) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventActor(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The subject or username associated with the request context that generated the event. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.Serialization.cs index d7ac07d2659f..85c4bcc1ef82 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.Serialization.cs @@ -6,15 +6,105 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventContent + public partial class ContainerRegistryWebhookEventContent : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventContent DeserializeContainerRegistryWebhookEventContent(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id.Value); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + if (Target is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Target).Serialize(writer, options); + } + } + if (Optional.IsDefined(Request)) + { + writer.WritePropertyName("request"u8); + if (Request is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Request).Serialize(writer, options); + } + } + if (Optional.IsDefined(Actor)) + { + writer.WritePropertyName("actor"u8); + if (Actor is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Actor).Serialize(writer, options); + } + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventContent DeserializeContainerRegistryWebhookEventContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +116,7 @@ internal static ContainerRegistryWebhookEventContent DeserializeContainerRegistr Optional request = default; Optional actor = default; Optional source = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -87,8 +178,61 @@ internal static ContainerRegistryWebhookEventContent DeserializeContainerRegistr source = ContainerRegistryWebhookEventSource.DeserializeContainerRegistryWebhookEventSource(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryWebhookEventContent(Optional.ToNullable(id), Optional.ToNullable(timestamp), action.Value, target.Value, request.Value, actor.Value, source.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventContent model) + { + if (model is null) + { + return null; } - return new ContainerRegistryWebhookEventContent(Optional.ToNullable(id), Optional.ToNullable(timestamp), action.Value, target.Value, request.Value, actor.Value, source.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.cs index eb2d0d2b71c0..241e2fa7e49c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventContent.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The content of the event request message. public partial class ContainerRegistryWebhookEventContent { - /// Initializes a new instance of ContainerRegistryWebhookEventContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventContent() { } - /// Initializes a new instance of ContainerRegistryWebhookEventContent. + /// Initializes a new instance of . /// The event ID. /// The time at which the event occurred. /// The action that encompasses the provided event. @@ -25,7 +29,8 @@ internal ContainerRegistryWebhookEventContent() /// The request that generated the event. /// The agent that initiated the event. For most situations, this could be from the authorization context of the request. /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. - internal ContainerRegistryWebhookEventContent(Guid? id, DateTimeOffset? timestamp, string action, ContainerRegistryWebhookEventTarget target, ContainerRegistryWebhookEventRequestContent request, ContainerRegistryWebhookEventActor actor, ContainerRegistryWebhookEventSource source) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventContent(Guid? id, DateTimeOffset? timestamp, string action, ContainerRegistryWebhookEventTarget target, ContainerRegistryWebhookEventRequestContent request, ContainerRegistryWebhookEventActor actor, ContainerRegistryWebhookEventSource source, Dictionary serializedAdditionalRawData) { Id = id; Timestamp = timestamp; @@ -34,6 +39,7 @@ internal ContainerRegistryWebhookEventContent(Guid? id, DateTimeOffset? timestam Request = request; Actor = actor; Source = source; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The event ID. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.Serialization.cs index c3a81f7a9399..7c24c9ae92cf 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.Serialization.cs @@ -6,20 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventInfo + public partial class ContainerRegistryWebhookEventInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventInfo DeserializeContainerRegistryWebhookEventInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventInfo DeserializeContainerRegistryWebhookEventInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -31,8 +64,61 @@ internal static ContainerRegistryWebhookEventInfo DeserializeContainerRegistryWe id = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventInfo(Optional.ToNullable(id)); + return new ContainerRegistryWebhookEventInfo(Optional.ToNullable(id), serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.cs index 13d24195c9e9..935598b4a88f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventInfo.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The basic information of an event. public partial class ContainerRegistryWebhookEventInfo { - /// Initializes a new instance of ContainerRegistryWebhookEventInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventInfo() { } - /// Initializes a new instance of ContainerRegistryWebhookEventInfo. + /// Initializes a new instance of . /// The event ID. - internal ContainerRegistryWebhookEventInfo(Guid? id) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventInfo(Guid? id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The event ID. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.Serialization.cs index 28f51131e02a..de7a5ccaafa6 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryWebhookEventListResult + internal partial class ContainerRegistryWebhookEventListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventListResult DeserializeContainerRegistryWebhookEventListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventListResult DeserializeContainerRegistryWebhookEventListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static ContainerRegistryWebhookEventListResult DeserializeContainerRegi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryWebhookEventListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.cs index c2dcd9c10b4d..e32c370d9a88 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list events for a webhook. internal partial class ContainerRegistryWebhookEventListResult { - /// Initializes a new instance of ContainerRegistryWebhookEventListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryWebhookEventListResult. + /// Initializes a new instance of . /// The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. /// The URI that can be used to request the next list of events. - internal ContainerRegistryWebhookEventListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.Serialization.cs index 89bc9b02d57b..ad7d6bca1692 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.Serialization.cs @@ -6,15 +6,67 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventRequestContent + public partial class ContainerRegistryWebhookEventRequestContent : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventRequestContent DeserializeContainerRegistryWebhookEventRequestContent(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id.Value); + } + if (Optional.IsDefined(Addr)) + { + writer.WritePropertyName("addr"u8); + writer.WriteStringValue(Addr); + } + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(Method)) + { + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method); + } + if (Optional.IsDefined(UserAgent)) + { + writer.WritePropertyName("useragent"u8); + writer.WriteStringValue(UserAgent); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventRequestContent DeserializeContainerRegistryWebhookEventRequestContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +76,7 @@ internal static ContainerRegistryWebhookEventRequestContent DeserializeContainer Optional host = default; Optional method = default; Optional userAgent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -55,8 +108,61 @@ internal static ContainerRegistryWebhookEventRequestContent DeserializeContainer userAgent = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventRequestContent(Optional.ToNullable(id), addr.Value, host.Value, method.Value, userAgent.Value); + return new ContainerRegistryWebhookEventRequestContent(Optional.ToNullable(id), addr.Value, host.Value, method.Value, userAgent.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventRequestContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventRequestContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventRequestContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventRequestContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventRequestContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventRequestContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventRequestContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.cs index 75a84178776c..7aee344000d3 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestContent.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The request that generated the event. public partial class ContainerRegistryWebhookEventRequestContent { - /// Initializes a new instance of ContainerRegistryWebhookEventRequestContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventRequestContent() { } - /// Initializes a new instance of ContainerRegistryWebhookEventRequestContent. + /// Initializes a new instance of . /// The ID of the request that initiated the event. /// The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. /// The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. /// The request method that generated the event. /// The user agent header of the request. - internal ContainerRegistryWebhookEventRequestContent(Guid? id, string addr, string host, string method, string userAgent) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventRequestContent(Guid? id, string addr, string host, string method, string userAgent, Dictionary serializedAdditionalRawData) { Id = id; Addr = addr; Host = host; Method = method; UserAgent = userAgent; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ID of the request that initiated the event. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.Serialization.cs index 6cf954dd1cb5..cf1cce78ab5f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.Serialization.cs @@ -8,14 +8,78 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventRequestMessage + public partial class ContainerRegistryWebhookEventRequestMessage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventRequestMessage DeserializeContainerRegistryWebhookEventRequestMessage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + if (Content is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Content).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Headers)) + { + writer.WritePropertyName("headers"u8); + writer.WriteStartObject(); + foreach (var item in Headers) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Method)) + { + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method); + } + if (Optional.IsDefined(RequestUri)) + { + writer.WritePropertyName("requestUri"u8); + writer.WriteStringValue(RequestUri.AbsoluteUri); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventRequestMessage DeserializeContainerRegistryWebhookEventRequestMessage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +89,7 @@ internal static ContainerRegistryWebhookEventRequestMessage DeserializeContainer Optional method = default; Optional requestUri = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("content"u8)) @@ -69,8 +134,61 @@ internal static ContainerRegistryWebhookEventRequestMessage DeserializeContainer version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventRequestMessage(content.Value, Optional.ToDictionary(headers), method.Value, requestUri.Value, version.Value); + return new ContainerRegistryWebhookEventRequestMessage(content.Value, Optional.ToDictionary(headers), method.Value, requestUri.Value, version.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventRequestMessage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventRequestMessage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventRequestMessage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventRequestMessage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventRequestMessage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventRequestMessage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventRequestMessage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.cs index 1c473926e615..a285491e3f88 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventRequestMessage.cs @@ -14,25 +14,30 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The event request message sent to the service URI. public partial class ContainerRegistryWebhookEventRequestMessage { - /// Initializes a new instance of ContainerRegistryWebhookEventRequestMessage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventRequestMessage() { Headers = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerRegistryWebhookEventRequestMessage. + /// Initializes a new instance of . /// The content of the event request message. /// The headers of the event request message. /// The HTTP method used to send the event request message. /// The URI used to send the event request message. /// The HTTP message version. - internal ContainerRegistryWebhookEventRequestMessage(ContainerRegistryWebhookEventContent content, IReadOnlyDictionary headers, string method, Uri requestUri, string version) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventRequestMessage(ContainerRegistryWebhookEventContent content, IReadOnlyDictionary headers, string method, Uri requestUri, string version, Dictionary serializedAdditionalRawData) { Content = content; Headers = headers; Method = method; RequestUri = requestUri; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The content of the event request message. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.Serialization.cs index a0f372bef376..2c51685fced7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.Serialization.cs @@ -5,16 +5,74 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventResponseMessage + public partial class ContainerRegistryWebhookEventResponseMessage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventResponseMessage DeserializeContainerRegistryWebhookEventResponseMessage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + if (Optional.IsCollectionDefined(Headers)) + { + writer.WritePropertyName("headers"u8); + writer.WriteStartObject(); + foreach (var item in Headers) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(ReasonPhrase)) + { + writer.WritePropertyName("reasonPhrase"u8); + writer.WriteStringValue(ReasonPhrase); + } + if (Optional.IsDefined(StatusCode)) + { + writer.WritePropertyName("statusCode"u8); + writer.WriteStringValue(StatusCode); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventResponseMessage DeserializeContainerRegistryWebhookEventResponseMessage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +82,7 @@ internal static ContainerRegistryWebhookEventResponseMessage DeserializeContaine Optional reasonPhrase = default; Optional statusCode = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("content"u8)) @@ -60,8 +119,61 @@ internal static ContainerRegistryWebhookEventResponseMessage DeserializeContaine version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventResponseMessage(content.Value, Optional.ToDictionary(headers), reasonPhrase.Value, statusCode.Value, version.Value); + return new ContainerRegistryWebhookEventResponseMessage(content.Value, Optional.ToDictionary(headers), reasonPhrase.Value, statusCode.Value, version.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventResponseMessage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventResponseMessage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventResponseMessage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventResponseMessage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventResponseMessage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventResponseMessage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventResponseMessage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.cs index ac92c3982759..9c85bab102a7 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventResponseMessage.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The event response message received from the service URI. public partial class ContainerRegistryWebhookEventResponseMessage { - /// Initializes a new instance of ContainerRegistryWebhookEventResponseMessage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventResponseMessage() { Headers = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ContainerRegistryWebhookEventResponseMessage. + /// Initializes a new instance of . /// The content of the event response message. /// The headers of the event response message. /// The reason phrase of the event response message. /// The status code of the event response message. /// The HTTP message version. - internal ContainerRegistryWebhookEventResponseMessage(string content, IReadOnlyDictionary headers, string reasonPhrase, string statusCode, string version) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventResponseMessage(string content, IReadOnlyDictionary headers, string reasonPhrase, string statusCode, string version, Dictionary serializedAdditionalRawData) { Content = content; Headers = headers; ReasonPhrase = reasonPhrase; StatusCode = statusCode; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The content of the event response message. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.Serialization.cs index aedfcacc3ab1..adae1b3c678d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventSource + public partial class ContainerRegistryWebhookEventSource : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventSource DeserializeContainerRegistryWebhookEventSource(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Addr)) + { + writer.WritePropertyName("addr"u8); + writer.WriteStringValue(Addr); + } + if (Optional.IsDefined(InstanceId)) + { + writer.WritePropertyName("instanceID"u8); + writer.WriteStringValue(InstanceId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventSource DeserializeContainerRegistryWebhookEventSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional addr = default; Optional instanceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("addr"u8)) @@ -32,8 +71,61 @@ internal static ContainerRegistryWebhookEventSource DeserializeContainerRegistry instanceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookEventSource(addr.Value, instanceId.Value); + return new ContainerRegistryWebhookEventSource(addr.Value, instanceId.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.cs index b67383860cf9..308d863a7e49 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventSource.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. public partial class ContainerRegistryWebhookEventSource { - /// Initializes a new instance of ContainerRegistryWebhookEventSource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventSource() { } - /// Initializes a new instance of ContainerRegistryWebhookEventSource. + /// Initializes a new instance of . /// The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. /// The running instance of an application. Changes after each restart. - internal ContainerRegistryWebhookEventSource(string addr, string instanceId) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventSource(string addr, string instanceId, Dictionary serializedAdditionalRawData) { Addr = addr; InstanceId = instanceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.Serialization.cs index 07739218f914..e89fc614da3c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.Serialization.cs @@ -6,15 +6,87 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookEventTarget + public partial class ContainerRegistryWebhookEventTarget : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookEventTarget DeserializeContainerRegistryWebhookEventTarget(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(MediaType)) + { + writer.WritePropertyName("mediaType"u8); + writer.WriteStringValue(MediaType); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Digest)) + { + writer.WritePropertyName("digest"u8); + writer.WriteStringValue(Digest); + } + if (Optional.IsDefined(Length)) + { + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length.Value); + } + if (Optional.IsDefined(Repository)) + { + writer.WritePropertyName("repository"u8); + writer.WriteStringValue(Repository); + } + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsDefined(Tag)) + { + writer.WritePropertyName("tag"u8); + writer.WriteStringValue(Tag); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookEventTarget DeserializeContainerRegistryWebhookEventTarget(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +100,7 @@ internal static ContainerRegistryWebhookEventTarget DeserializeContainerRegistry Optional tag = default; Optional name = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mediaType"u8)) @@ -87,8 +160,61 @@ internal static ContainerRegistryWebhookEventTarget DeserializeContainerRegistry version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryWebhookEventTarget(mediaType.Value, Optional.ToNullable(size), digest.Value, Optional.ToNullable(length), repository.Value, url.Value, tag.Value, name.Value, version.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookEventTarget IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookEventTarget(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookEventTarget IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookEventTarget(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookEventTarget model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookEventTarget(Response response) + { + if (response is null) + { + return null; } - return new ContainerRegistryWebhookEventTarget(mediaType.Value, Optional.ToNullable(size), digest.Value, Optional.ToNullable(length), repository.Value, url.Value, tag.Value, name.Value, version.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookEventTarget(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.cs index 11de60be3080..fc5b7cb840dd 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookEventTarget.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The target of the event. public partial class ContainerRegistryWebhookEventTarget { - /// Initializes a new instance of ContainerRegistryWebhookEventTarget. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookEventTarget() { } - /// Initializes a new instance of ContainerRegistryWebhookEventTarget. + /// Initializes a new instance of . /// The MIME type of the referenced object. /// The number of bytes of the content. Same as Length field. /// The digest of the content, as defined by the Registry V2 HTTP API Specification. @@ -27,7 +31,8 @@ internal ContainerRegistryWebhookEventTarget() /// The tag name. /// The name of the artifact. /// The version of the artifact. - internal ContainerRegistryWebhookEventTarget(string mediaType, long? size, string digest, long? length, string repository, Uri uri, string tag, string name, string version) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookEventTarget(string mediaType, long? size, string digest, long? length, string repository, Uri uri, string tag, string name, string version, Dictionary serializedAdditionalRawData) { MediaType = mediaType; Size = size; @@ -38,6 +43,7 @@ internal ContainerRegistryWebhookEventTarget(string mediaType, long? size, strin Tag = tag; Name = name; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The MIME type of the referenced object. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.Serialization.cs index 8f48cd9e90a0..448f300ba8fa 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ContainerRegistryWebhookListResult + internal partial class ContainerRegistryWebhookListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerRegistryWebhookListResult DeserializeContainerRegistryWebhookListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerRegistryWebhookListResult DeserializeContainerRegistryWebhookListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ContainerRegistryWebhookListResult DeserializeContainerRegistryW nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerRegistryWebhookListResult(Optional.ToList(value), nextLink.Value); + return new ContainerRegistryWebhookListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerRegistryWebhookListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.cs index ae91c48510e6..38dbade478d8 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list webhooks for a container registry. internal partial class ContainerRegistryWebhookListResult { - /// Initializes a new instance of ContainerRegistryWebhookListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerRegistryWebhookListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerRegistryWebhookListResult. + /// Initializes a new instance of . /// The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. /// The URI that can be used to request the next list of webhooks. - internal ContainerRegistryWebhookListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.Serialization.cs index 2dea11e3c1b2..9e404cf30d74 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ContainerRegistryWebhookPatch : IUtf8JsonSerializable + public partial class ContainerRegistryWebhookPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -65,7 +73,170 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerRegistryWebhookPatch DeserializeContainerRegistryWebhookPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional serviceUri = default; + Optional> customHeaders = default; + Optional status = default; + Optional scope = default; + Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("serviceUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("customHeaders"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + customHeaders = dictionary; + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ContainerRegistryWebhookStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("actions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new ContainerRegistryWebhookAction(item.GetString())); + } + actions = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerRegistryWebhookPatch(Optional.ToDictionary(tags), serviceUri.Value, Optional.ToDictionary(customHeaders), Optional.ToNullable(status), scope.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + ContainerRegistryWebhookPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerRegistryWebhookPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryWebhookPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryWebhookPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerRegistryWebhookPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerRegistryWebhookPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerRegistryWebhookPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.cs index 4343d55bdede..b3cbb93e0476 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ContainerRegistryWebhookPatch.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The parameters for updating a webhook. public partial class ContainerRegistryWebhookPatch { - /// Initializes a new instance of ContainerRegistryWebhookPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerRegistryWebhookPatch() { Tags = new ChangeTrackingDictionary(); @@ -22,6 +25,25 @@ public ContainerRegistryWebhookPatch() Actions = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The tags for the webhook. + /// The service URI for the webhook to post notifications. + /// Custom headers that will be added to the webhook notifications. + /// The status of the webhook at the time the operation was called. + /// The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + /// The list of actions that trigger the webhook to post notifications. + /// Keeps track of any properties unknown to the library. + internal ContainerRegistryWebhookPatch(IDictionary tags, Uri serviceUri, IDictionary customHeaders, ContainerRegistryWebhookStatus? status, string scope, IList actions, Dictionary serializedAdditionalRawData) + { + Tags = tags; + ServiceUri = serviceUri; + CustomHeaders = customHeaders; + Status = status; + Scope = scope; + Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The tags for the webhook. public IDictionary Tags { get; } /// The service URI for the webhook to post notifications. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.Serialization.cs index ee1e77ea3f1e..c491136ab865 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.Serialization.cs @@ -5,36 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class CustomRegistryCredentials : IUtf8JsonSerializable + public partial class CustomRegistryCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserName)) { writer.WritePropertyName("userName"u8); - writer.WriteObjectValue(UserName); + if (UserName is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserName).Serialize(writer, options); + } } if (Optional.IsDefined(Password)) { writer.WritePropertyName("password"u8); - writer.WriteObjectValue(Password); + if (Password is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Password).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); writer.WriteStringValue(Identity); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomRegistryCredentials DeserializeCustomRegistryCredentials(JsonElement element) + internal static CustomRegistryCredentials DeserializeCustomRegistryCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static CustomRegistryCredentials DeserializeCustomRegistryCredentials(J Optional userName = default; Optional password = default; Optional identity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userName"u8)) @@ -67,8 +104,61 @@ internal static CustomRegistryCredentials DeserializeCustomRegistryCredentials(J identity = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomRegistryCredentials(userName.Value, password.Value, identity.Value, serializedAdditionalRawData); + } + + CustomRegistryCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomRegistryCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomRegistryCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomRegistryCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomRegistryCredentials model) + { + if (model is null) + { + return null; } - return new CustomRegistryCredentials(userName.Value, password.Value, identity.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomRegistryCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomRegistryCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.cs index 613aa491d65b..ef6294b77320 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/CustomRegistryCredentials.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// Describes the credentials that will be used to access a custom registry during a run. public partial class CustomRegistryCredentials { - /// Initializes a new instance of CustomRegistryCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomRegistryCredentials() { } - /// Initializes a new instance of CustomRegistryCredentials. + /// Initializes a new instance of . /// The username for logging into the custom registry. /// /// The password for logging into the custom registry. The password is a secret @@ -28,11 +34,13 @@ public CustomRegistryCredentials() /// identity may be used to authenticate to key vault to retrieve credentials or it may be the only /// source of authentication used for accessing the registry. /// - internal CustomRegistryCredentials(ContainerRegistrySecretObject userName, ContainerRegistrySecretObject password, string identity) + /// Keeps track of any properties unknown to the library. + internal CustomRegistryCredentials(ContainerRegistrySecretObject userName, ContainerRegistrySecretObject password, string identity, Dictionary serializedAdditionalRawData) { UserName = userName; Password = password; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The username for logging into the custom registry. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapData.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapData.Serialization.cs index 4787c1e7b69e..78ca2755821a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapData.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerRegistry { - public partial class ScopeMapData : IUtf8JsonSerializable + public partial class ScopeMapData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -37,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScopeMapData DeserializeScopeMapData(JsonElement element) + internal static ScopeMapData DeserializeScopeMapData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +75,7 @@ internal static ScopeMapData DeserializeScopeMapData(JsonElement element) Optional creationDate = default; Optional provisioningState = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -135,8 +156,61 @@ internal static ScopeMapData DeserializeScopeMapData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScopeMapData(id, name, type, systemData.Value, description.Value, type0.Value, Optional.ToNullable(creationDate), Optional.ToNullable(provisioningState), Optional.ToList(actions), serializedAdditionalRawData); + } + + ScopeMapData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScopeMapData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScopeMapData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScopeMapData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScopeMapData model) + { + if (model is null) + { + return null; } - return new ScopeMapData(id, name, type, systemData.Value, description.Value, type0.Value, Optional.ToNullable(creationDate), Optional.ToNullable(provisioningState), Optional.ToList(actions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScopeMapData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScopeMapData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.Serialization.cs index fc5b6d2cfd97..912a96ef3672 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerRegistry; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class ScopeMapListResult + internal partial class ScopeMapListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScopeMapListResult DeserializeScopeMapListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScopeMapListResult DeserializeScopeMapListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ScopeMapListResult DeserializeScopeMapListResult(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScopeMapListResult(Optional.ToList(value), nextLink.Value); + return new ScopeMapListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ScopeMapListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScopeMapListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScopeMapListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScopeMapListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScopeMapListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScopeMapListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScopeMapListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.cs index c37eb7e198bc..9ac9a653cf5b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerRegistry; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The result of a request to list scope maps for a container registry. internal partial class ScopeMapListResult { - /// Initializes a new instance of ScopeMapListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScopeMapListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ScopeMapListResult. + /// Initializes a new instance of . /// The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. /// The URI that can be used to request the next list of scope maps. - internal ScopeMapListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ScopeMapListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.Serialization.cs index 4f90881f0ff3..dbb51682c295 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class ScopeMapPatch : IUtf8JsonSerializable + public partial class ScopeMapPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,120 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ScopeMapPatch DeserializeScopeMapPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("actions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + actions = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScopeMapPatch(description.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + ScopeMapPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScopeMapPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScopeMapPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScopeMapPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScopeMapPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScopeMapPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScopeMapPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.cs index 4ee3130ba908..5b4a9b149ffe 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/ScopeMapPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties for updating the scope map. public partial class ScopeMapPatch { - /// Initializes a new instance of ScopeMapPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScopeMapPatch() { Actions = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The user friendly description of the scope map. + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// Keeps track of any properties unknown to the library. + internal ScopeMapPatch(string description, IList actions, Dictionary serializedAdditionalRawData) + { + Description = description; + Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The user friendly description of the scope map. public string Description { get; set; } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.Serialization.cs index 783fe15ae3e3..658c019e5182 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class SourceCodeRepoAuthInfo : IUtf8JsonSerializable + public partial class SourceCodeRepoAuthInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("tokenType"u8); writer.WriteStringValue(TokenType.ToString()); @@ -34,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expiresIn"u8); writer.WriteNumberValue(ExpireInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SourceCodeRepoAuthInfo DeserializeSourceCodeRepoAuthInfo(JsonElement element) + internal static SourceCodeRepoAuthInfo DeserializeSourceCodeRepoAuthInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static SourceCodeRepoAuthInfo DeserializeSourceCodeRepoAuthInfo(JsonEle Optional refreshToken = default; Optional scope = default; Optional expiresIn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tokenType"u8)) @@ -79,8 +102,61 @@ internal static SourceCodeRepoAuthInfo DeserializeSourceCodeRepoAuthInfo(JsonEle expiresIn = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceCodeRepoAuthInfo(tokenType, token, refreshToken.Value, scope.Value, Optional.ToNullable(expiresIn), serializedAdditionalRawData); + } + + SourceCodeRepoAuthInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceCodeRepoAuthInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceCodeRepoAuthInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceCodeRepoAuthInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceCodeRepoAuthInfo model) + { + if (model is null) + { + return null; } - return new SourceCodeRepoAuthInfo(tokenType, token, refreshToken.Value, scope.Value, Optional.ToNullable(expiresIn)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceCodeRepoAuthInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceCodeRepoAuthInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.cs index 89fbd10ec4cb..f8dcb4fce300 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The authorization properties for accessing the source code repository. public partial class SourceCodeRepoAuthInfo { - /// Initializes a new instance of SourceCodeRepoAuthInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of Auth token. /// The access token used to access the source control provider. /// is null. @@ -25,19 +29,26 @@ public SourceCodeRepoAuthInfo(SourceCodeRepoAuthTokenType tokenType, string toke Token = token; } - /// Initializes a new instance of SourceCodeRepoAuthInfo. + /// Initializes a new instance of . /// The type of Auth token. /// The access token used to access the source control provider. /// The refresh token used to refresh the access token. /// The scope of the access token. /// Time in seconds that the token remains valid. - internal SourceCodeRepoAuthInfo(SourceCodeRepoAuthTokenType tokenType, string token, string refreshToken, string scope, int? expireInSeconds) + /// Keeps track of any properties unknown to the library. + internal SourceCodeRepoAuthInfo(SourceCodeRepoAuthTokenType tokenType, string token, string refreshToken, string scope, int? expireInSeconds, Dictionary serializedAdditionalRawData) { TokenType = tokenType; Token = token; RefreshToken = refreshToken; Scope = scope; ExpireInSeconds = expireInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SourceCodeRepoAuthInfo() + { } /// The type of Auth token. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.Serialization.cs index 29bc8e1d9ea9..ddb841c341aa 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class SourceCodeRepoAuthInfoUpdateContent : IUtf8JsonSerializable + public partial class SourceCodeRepoAuthInfoUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TokenType)) { @@ -40,7 +48,125 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expiresIn"u8); writer.WriteNumberValue(ExpiresIn.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SourceCodeRepoAuthInfoUpdateContent DeserializeSourceCodeRepoAuthInfoUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional tokenType = default; + Optional token = default; + Optional refreshToken = default; + Optional scope = default; + Optional expiresIn = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tokenType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tokenType = new SourceCodeRepoAuthTokenType(property.Value.GetString()); + continue; + } + if (property.NameEquals("token"u8)) + { + token = property.Value.GetString(); + continue; + } + if (property.NameEquals("refreshToken"u8)) + { + refreshToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("scope"u8)) + { + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("expiresIn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiresIn = property.Value.GetInt32(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceCodeRepoAuthInfoUpdateContent(Optional.ToNullable(tokenType), token.Value, refreshToken.Value, scope.Value, Optional.ToNullable(expiresIn), serializedAdditionalRawData); + } + + SourceCodeRepoAuthInfoUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceCodeRepoAuthInfoUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceCodeRepoAuthInfoUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceCodeRepoAuthInfoUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceCodeRepoAuthInfoUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceCodeRepoAuthInfoUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceCodeRepoAuthInfoUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.cs index d42b285ef95b..4a0ba9217726 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoAuthInfoUpdateContent.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The authorization properties for accessing the source code repository. public partial class SourceCodeRepoAuthInfoUpdateContent { - /// Initializes a new instance of SourceCodeRepoAuthInfoUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SourceCodeRepoAuthInfoUpdateContent() { } + /// Initializes a new instance of . + /// The type of Auth token. + /// The access token used to access the source control provider. + /// The refresh token used to refresh the access token. + /// The scope of the access token. + /// Time in seconds that the token remains valid. + /// Keeps track of any properties unknown to the library. + internal SourceCodeRepoAuthInfoUpdateContent(SourceCodeRepoAuthTokenType? tokenType, string token, string refreshToken, string scope, int? expiresIn, Dictionary serializedAdditionalRawData) + { + TokenType = tokenType; + Token = token; + RefreshToken = refreshToken; + Scope = scope; + ExpiresIn = expiresIn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The type of Auth token. public SourceCodeRepoAuthTokenType? TokenType { get; set; } /// The access token used to access the source control provider. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.Serialization.cs index 34e2ed1c8e49..175371702a5c 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class SourceCodeRepoProperties : IUtf8JsonSerializable + public partial class SourceCodeRepoProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceControlType"u8); writer.WriteStringValue(SourceControlType.ToString()); @@ -28,13 +35,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceControlAuthProperties)) { writer.WritePropertyName("sourceControlAuthProperties"u8); - writer.WriteObjectValue(SourceControlAuthProperties); + if (SourceControlAuthProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceControlAuthProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static SourceCodeRepoProperties DeserializeSourceCodeRepoProperties(JsonElement element) + internal static SourceCodeRepoProperties DeserializeSourceCodeRepoProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static SourceCodeRepoProperties DeserializeSourceCodeRepoProperties(Jso Uri repositoryUrl = default; Optional branch = default; Optional sourceControlAuthProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceControlType"u8)) @@ -69,8 +98,61 @@ internal static SourceCodeRepoProperties DeserializeSourceCodeRepoProperties(Jso sourceControlAuthProperties = SourceCodeRepoAuthInfo.DeserializeSourceCodeRepoAuthInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceCodeRepoProperties(sourceControlType, repositoryUrl, branch.Value, sourceControlAuthProperties.Value, serializedAdditionalRawData); + } + + SourceCodeRepoProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceCodeRepoProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceCodeRepoProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceCodeRepoProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceCodeRepoProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceCodeRepoProperties(Response response) + { + if (response is null) + { + return null; } - return new SourceCodeRepoProperties(sourceControlType, repositoryUrl, branch.Value, sourceControlAuthProperties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceCodeRepoProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.cs index ba12ac45acc4..5c41a60f6926 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The properties of the source code repository. public partial class SourceCodeRepoProperties { - /// Initializes a new instance of SourceCodeRepoProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of source control service. /// The full URL to the source code repository. /// is null. @@ -25,7 +29,7 @@ public SourceCodeRepoProperties(SourceControlType sourceControlType, Uri reposit RepositoryUri = repositoryUri; } - /// Initializes a new instance of SourceCodeRepoProperties. + /// Initializes a new instance of . /// The type of source control service. /// The full URL to the source code repository. /// The branch name of the source code. @@ -33,12 +37,19 @@ public SourceCodeRepoProperties(SourceControlType sourceControlType, Uri reposit /// The authorization properties for accessing the source code repository and to set up /// webhooks for notifications. /// - internal SourceCodeRepoProperties(SourceControlType sourceControlType, Uri repositoryUri, string branch, SourceCodeRepoAuthInfo sourceControlAuthProperties) + /// Keeps track of any properties unknown to the library. + internal SourceCodeRepoProperties(SourceControlType sourceControlType, Uri repositoryUri, string branch, SourceCodeRepoAuthInfo sourceControlAuthProperties, Dictionary serializedAdditionalRawData) { SourceControlType = sourceControlType; RepositoryUri = repositoryUri; Branch = branch; SourceControlAuthProperties = sourceControlAuthProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SourceCodeRepoProperties() + { } /// The type of source control service. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.Serialization.cs index 5ea158f031de..a6cc468d1f3d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class SourceCodeRepoUpdateContent : IUtf8JsonSerializable + public partial class SourceCodeRepoUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceControlType)) { @@ -33,9 +41,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceControlAuthProperties)) { writer.WritePropertyName("sourceControlAuthProperties"u8); - writer.WriteObjectValue(SourceControlAuthProperties); + if (SourceControlAuthProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceControlAuthProperties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static SourceCodeRepoUpdateContent DeserializeSourceCodeRepoUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sourceControlType = default; + Optional repositoryUrl = default; + Optional branch = default; + Optional sourceControlAuthProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceControlType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceControlType = new SourceControlType(property.Value.GetString()); + continue; + } + if (property.NameEquals("repositoryUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + repositoryUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("branch"u8)) + { + branch = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceControlAuthProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceControlAuthProperties = SourceCodeRepoAuthInfoUpdateContent.DeserializeSourceCodeRepoAuthInfoUpdateContent(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceCodeRepoUpdateContent(Optional.ToNullable(sourceControlType), repositoryUrl.Value, branch.Value, sourceControlAuthProperties.Value, serializedAdditionalRawData); + } + + SourceCodeRepoUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceCodeRepoUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceCodeRepoUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceCodeRepoUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceCodeRepoUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceCodeRepoUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceCodeRepoUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.cs index b87294b8176b..906948186d1b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceCodeRepoUpdateContent.cs @@ -6,17 +6,39 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The properties for updating the source code repository. public partial class SourceCodeRepoUpdateContent { - /// Initializes a new instance of SourceCodeRepoUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SourceCodeRepoUpdateContent() { } + /// Initializes a new instance of . + /// The type of source control service. + /// The full URL to the source code repository. + /// The branch name of the source code. + /// + /// The authorization properties for accessing the source code repository and to set up + /// webhooks for notifications. + /// + /// Keeps track of any properties unknown to the library. + internal SourceCodeRepoUpdateContent(SourceControlType? sourceControlType, Uri repositoryUri, string branch, SourceCodeRepoAuthInfoUpdateContent sourceControlAuthProperties, Dictionary serializedAdditionalRawData) + { + SourceControlType = sourceControlType; + RepositoryUri = repositoryUri; + Branch = branch; + SourceControlAuthProperties = sourceControlAuthProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The type of source control service. public SourceControlType? SourceControlType { get; set; } /// The full URL to the source code repository. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.Serialization.cs index 4f490c4138a4..bf52a505ff3f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class SourceRegistryCredentials : IUtf8JsonSerializable + internal partial class SourceRegistryCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LoginMode)) { writer.WritePropertyName("loginMode"u8); writer.WriteStringValue(LoginMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SourceRegistryCredentials DeserializeSourceRegistryCredentials(JsonElement element) + internal static SourceRegistryCredentials DeserializeSourceRegistryCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional loginMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("loginMode"u8)) @@ -41,8 +64,61 @@ internal static SourceRegistryCredentials DeserializeSourceRegistryCredentials(J loginMode = new SourceRegistryLoginMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SourceRegistryCredentials(Optional.ToNullable(loginMode), serializedAdditionalRawData); + } + + SourceRegistryCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceRegistryCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceRegistryCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceRegistryCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceRegistryCredentials model) + { + if (model is null) + { + return null; } - return new SourceRegistryCredentials(Optional.ToNullable(loginMode)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceRegistryCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceRegistryCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.cs index 14020532477f..815b42d82f66 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceRegistryCredentials.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// Describes the credential parameters for accessing the source registry. internal partial class SourceRegistryCredentials { - /// Initializes a new instance of SourceRegistryCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SourceRegistryCredentials() { } - /// Initializes a new instance of SourceRegistryCredentials. + /// Initializes a new instance of . /// /// The authentication mode which determines the source registry login scope. The credentials for the source registry /// will be generated using the given scope. These credentials will be used to login to /// the source registry during the run. /// - internal SourceRegistryCredentials(SourceRegistryLoginMode? loginMode) + /// Keeps track of any properties unknown to the library. + internal SourceRegistryCredentials(SourceRegistryLoginMode? loginMode, Dictionary serializedAdditionalRawData) { LoginMode = loginMode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.Serialization.cs index 875f6f071922..bff0c423c448 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - public partial class SourceUploadDefinition + public partial class SourceUploadDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SourceUploadDefinition DeserializeSourceUploadDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(UploadUri)) + { + writer.WritePropertyName("uploadUrl"u8); + writer.WriteStringValue(UploadUri.AbsoluteUri); + } + if (Optional.IsDefined(RelativePath)) + { + writer.WritePropertyName("relativePath"u8); + writer.WriteStringValue(RelativePath); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SourceUploadDefinition DeserializeSourceUploadDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional uploadUrl = default; Optional relativePath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uploadUrl"u8)) @@ -37,8 +75,61 @@ internal static SourceUploadDefinition DeserializeSourceUploadDefinition(JsonEle relativePath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SourceUploadDefinition(uploadUrl.Value, relativePath.Value); + return new SourceUploadDefinition(uploadUrl.Value, relativePath.Value, serializedAdditionalRawData); + } + + SourceUploadDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSourceUploadDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SourceUploadDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSourceUploadDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SourceUploadDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SourceUploadDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSourceUploadDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.cs index e013583453ac..752decfdcc00 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/SourceUploadDefinition.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models { /// The properties of a response to source upload request. public partial class SourceUploadDefinition { - /// Initializes a new instance of SourceUploadDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SourceUploadDefinition() { } - /// Initializes a new instance of SourceUploadDefinition. + /// Initializes a new instance of . /// The URL where the client can upload the source. /// The relative path to the source. This is used to submit the subsequent queue build request. - internal SourceUploadDefinition(Uri uploadUri, string relativePath) + /// Keeps track of any properties unknown to the library. + internal SourceUploadDefinition(Uri uploadUri, string relativePath, Dictionary serializedAdditionalRawData) { UploadUri = uploadUri; RelativePath = relativePath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The URL where the client can upload the source. diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.Serialization.cs index e6815b99c793..603533cdf609 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class UnknownRunRequest : IUtf8JsonSerializable + internal partial class UnknownRunRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(RunRequestType); @@ -32,47 +38,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("logTemplate"u8); writer.WriteStringValue(LogTemplate); } - writer.WriteEndObject(); - } - - internal static UnknownRunRequest DeserializeUnknownRunRequest(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string type = "Unknown"; - Optional isArchiveEnabled = default; - Optional agentPoolName = default; - Optional logTemplate = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("type"u8)) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("isArchiveEnabled"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isArchiveEnabled = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("agentPoolName"u8)) - { - agentPoolName = property.Value.GetString(); - continue; - } - if (property.NameEquals("logTemplate"u8)) + foreach (var property in _serializedAdditionalRawData) { - logTemplate = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownRunRequest(type, Optional.ToNullable(isArchiveEnabled), agentPoolName.Value, logTemplate.Value); + writer.WriteEndObject(); + } + + internal static ContainerRegistryRunContent DeserializeUnknownRunRequest(JsonElement element, ModelSerializerOptions options = default) => DeserializeContainerRegistryRunContent(element, options); + + ContainerRegistryRunContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownRunRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryRunContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryRunContent(doc.RootElement, options); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.cs index f06fd6572133..f2c42c032cf1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownRunRequest.cs @@ -5,19 +5,28 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerRegistry.Models { /// The UnknownRunRequest. internal partial class UnknownRunRequest : ContainerRegistryRunContent { - /// Initializes a new instance of UnknownRunRequest. + /// Initializes a new instance of . /// The type of the run request. /// The value that indicates whether archiving is enabled for the run or not. /// The dedicated agent pool for the run. /// The template that describes the repository and tag information for run log artifact. - internal UnknownRunRequest(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate) + /// Keeps track of any properties unknown to the library. + internal UnknownRunRequest(string runRequestType, bool? isArchiveEnabled, string agentPoolName, string logTemplate, Dictionary serializedAdditionalRawData) : base(runRequestType, isArchiveEnabled, agentPoolName, logTemplate, serializedAdditionalRawData) { RunRequestType = runRequestType ?? "Unknown"; } + + /// Initializes a new instance of for deserialization. + internal UnknownRunRequest() + { + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.Serialization.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.Serialization.cs index 57edfd40d77a..b143df56aa15 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.Serialization.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.Serialization.cs @@ -5,16 +5,21 @@ #nullable disable -using System.Collections.Generic; +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerRegistry.Models { - internal partial class UnknownTaskStepProperties : IUtf8JsonSerializable + internal partial class UnknownTaskStepProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ContainerRegistryTaskStepType.ToString()); @@ -28,52 +33,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("contextAccessToken"u8); writer.WriteStringValue(ContextAccessToken); } - writer.WriteEndObject(); - } - - internal static UnknownTaskStepProperties DeserializeUnknownTaskStepProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ContainerRegistryTaskStepType type = "Unknown"; - Optional> baseImageDependencies = default; - Optional contextPath = default; - Optional contextAccessToken = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("type"u8)) - { - type = new ContainerRegistryTaskStepType(property.Value.GetString()); - continue; - } - if (property.NameEquals("baseImageDependencies"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ContainerRegistryBaseImageDependency.DeserializeContainerRegistryBaseImageDependency(item)); - } - baseImageDependencies = array; - continue; - } - if (property.NameEquals("contextPath"u8)) - { - contextPath = property.Value.GetString(); - continue; - } - if (property.NameEquals("contextAccessToken"u8)) + foreach (var property in _serializedAdditionalRawData) { - contextAccessToken = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownTaskStepProperties(type, Optional.ToList(baseImageDependencies), contextPath.Value, contextAccessToken.Value); + writer.WriteEndObject(); + } + + internal static ContainerRegistryTaskStepProperties DeserializeUnknownTaskStepProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeContainerRegistryTaskStepProperties(element, options); + + ContainerRegistryTaskStepProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownTaskStepProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerRegistryTaskStepProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerRegistryTaskStepProperties(doc.RootElement, options); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.cs index 46b586f76874..f3833dbdd0ba 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Models/UnknownTaskStepProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.ContainerRegistry.Models @@ -12,14 +13,20 @@ namespace Azure.ResourceManager.ContainerRegistry.Models /// The UnknownTaskStepProperties. internal partial class UnknownTaskStepProperties : ContainerRegistryTaskStepProperties { - /// Initializes a new instance of UnknownTaskStepProperties. + /// Initializes a new instance of . /// The type of the step. /// List of base image dependencies for a step. /// The URL(absolute or relative) of the source context for the task step. /// The token (git PAT or SAS token of storage account blob) associated with the context for a step. - internal UnknownTaskStepProperties(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken) + /// Keeps track of any properties unknown to the library. + internal UnknownTaskStepProperties(ContainerRegistryTaskStepType containerRegistryTaskStepType, IReadOnlyList baseImageDependencies, string contextPath, string contextAccessToken, Dictionary serializedAdditionalRawData) : base(containerRegistryTaskStepType, baseImageDependencies, contextPath, contextAccessToken, serializedAdditionalRawData) { ContainerRegistryTaskStepType = containerRegistryTaskStepType; } + + /// Initializes a new instance of for deserialization. + internal UnknownTaskStepProperties() + { + } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/AgentPoolsRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/AgentPoolsRestOperations.cs index fa03cdd87421..a2b7891ee69b 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/AgentPoolsRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/AgentPoolsRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -306,9 +304,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 194a8a250cf5..3947b2bd05ca 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RegistriesRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RegistriesRestOperations.cs index 68e85070f5b2..684c866dd222 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RegistriesRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RegistriesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateImportImageRequest(string subscriptionId, string reso uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -129,9 +127,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -429,9 +425,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -578,9 +572,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -982,9 +974,7 @@ internal HttpMessage CreateRegenerateCredentialRequest(string subscriptionId, st request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1069,9 +1059,7 @@ internal HttpMessage CreateGenerateCredentialsRequest(string subscriptionId, str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ReplicationsRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ReplicationsRestOperations.cs index be53b11a41da..3b278e032331 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ReplicationsRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ReplicationsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -384,9 +382,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RunsRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RunsRestOperations.cs index e0ab68dd0a62..e8ac822f6ce1 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RunsRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/RunsRestOperations.cs @@ -235,9 +235,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/SchedulesRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/SchedulesRestOperations.cs index 685253badde6..3307a9575f11 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/SchedulesRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/SchedulesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateScheduleRunRequest(string subscriptionId, string reso request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ScopeMapsRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ScopeMapsRestOperations.cs index 2cf83f6ee096..8fe0828e1e62 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ScopeMapsRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/ScopeMapsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -385,9 +383,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TaskRunsRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TaskRunsRestOperations.cs index 8ce42023880a..037307135581 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TaskRunsRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TaskRunsRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -306,9 +304,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TasksRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TasksRestOperations.cs index e2c6d37766ce..bce45cf21cf8 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TasksRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TasksRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -385,9 +383,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TokensRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TokensRestOperations.cs index 7d5ba5267cf9..0bf21c4cfc7d 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TokensRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/TokensRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -385,9 +383,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/WebhooksRestOperations.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/WebhooksRestOperations.cs index ddc9e020a398..17383975e2f5 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/WebhooksRestOperations.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/RestOperations/WebhooksRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -384,9 +382,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs index bda7463a9574..69a08c0c9de8 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _scopeMapRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scopeMapRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScopeMapResource(Client, ScopeMapData.DeserializeScopeMapData(e)), _scopeMapClientDiagnostics, Pipeline, "ScopeMapCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScopeMapResource(Client, ScopeMapData.DeserializeScopeMapData(e)), _scopeMapClientDiagnostics, Pipeline, "ScopeMapCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _scopeMapRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scopeMapRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScopeMapResource(Client, ScopeMapData.DeserializeScopeMapData(e)), _scopeMapClientDiagnostics, Pipeline, "ScopeMapCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScopeMapResource(Client, ScopeMapData.DeserializeScopeMapData(e)), _scopeMapClientDiagnostics, Pipeline, "ScopeMapCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapData.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapData.cs index bf967843e852..24bb4d40dc23 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapData.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.ContainerRegistry /// public partial class ScopeMapData : ResourceData { - /// Initializes a new instance of ScopeMapData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScopeMapData() { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of ScopeMapData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,13 +42,15 @@ public ScopeMapData() /// E.g. repositories/repository-name/content/read, /// repositories/repository-name/metadata/write /// - internal ScopeMapData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string scopeMapType, DateTimeOffset? createdOn, ContainerRegistryProvisioningState? provisioningState, IList actions) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ScopeMapData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string scopeMapType, DateTimeOffset? createdOn, ContainerRegistryProvisioningState? provisioningState, IList actions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; ScopeMapType = scopeMapType; CreatedOn = createdOn; ProvisioningState = provisioningState; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The user friendly description of the scope map. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs index 229c4ac39e58..8f56940663b8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), _agentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "AgentPoolSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), _agentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "AgentPoolSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), _agentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "AgentPoolSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), _agentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "AgentPoolSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs index 0236d59626f8..b1c5abbb2789 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ContainerService /// public partial class AgentPoolSnapshotData : TrackedResourceData { - /// Initializes a new instance of AgentPoolSnapshotData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public AgentPoolSnapshotData(AzureLocation location) : base(location) { } - /// Initializes a new instance of AgentPoolSnapshotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public AgentPoolSnapshotData(AzureLocation location) : base(location) /// Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. /// The size of the VM. /// Whether to use a FIPS-enabled OS. - internal AgentPoolSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerServiceCreationData creationData, SnapshotType? snapshotType, string kubernetesVersion, string nodeImageVersion, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, string vmSize, bool? enableFips) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal AgentPoolSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerServiceCreationData creationData, SnapshotType? snapshotType, string kubernetesVersion, string nodeImageVersion, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, string vmSize, bool? enableFips, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { CreationData = creationData; SnapshotType = snapshotType; @@ -49,6 +54,12 @@ internal AgentPoolSnapshotData(ResourceIdentifier id, string name, ResourceType OSSku = osSku; VmSize = vmSize; EnableFips = enableFips; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgentPoolSnapshotData() + { } /// CreationData to be used to specify the source agent pool resource ID to create this snapshot. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs index 835cdff26bff..2a564ba8ccb4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.ContainerService /// public partial class AgentPoolUpgradeProfileData : ResourceData { - /// Initializes a new instance of AgentPoolUpgradeProfileData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// The operating system type. The default is Linux. /// is null. @@ -32,7 +35,7 @@ internal AgentPoolUpgradeProfileData(string kubernetesVersion, ContainerServiceO Upgrades = new ChangeTrackingList(); } - /// Initializes a new instance of AgentPoolUpgradeProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,12 +44,19 @@ internal AgentPoolUpgradeProfileData(string kubernetesVersion, ContainerServiceO /// The operating system type. The default is Linux. /// List of orchestrator types and versions available for upgrade. /// The latest AKS supported node image version. - internal AgentPoolUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kubernetesVersion, ContainerServiceOSType osType, IReadOnlyList upgrades, string latestNodeImageVersion) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AgentPoolUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kubernetesVersion, ContainerServiceOSType osType, IReadOnlyList upgrades, string latestNodeImageVersion, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { KubernetesVersion = kubernetesVersion; OSType = osType; Upgrades = upgrades; LatestNodeImageVersion = latestNodeImageVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgentPoolUpgradeProfileData() + { } /// The Kubernetes version (major.minor.patch). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs index cab1d5447352..2e0952fcd375 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ContainerService.Models /// Model factory for models. public static partial class ArmContainerServiceModelFactory { - /// Initializes a new instance of OSOptionProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,25 +31,19 @@ public static OSOptionProfileData OSOptionProfileData(ResourceIdentifier id = nu { osOptionPropertyList ??= new List(); - return new OSOptionProfileData(id, name, resourceType, systemData, osOptionPropertyList?.ToList()); + return new OSOptionProfileData(id, name, resourceType, systemData, osOptionPropertyList?.ToList(), default); } - /// Initializes a new instance of ContainerServiceOSOptionProperty. + /// Initializes a new instance of . /// The OS type. /// Whether the image is FIPS-enabled. - /// is null. /// A new instance for mocking. public static ContainerServiceOSOptionProperty ContainerServiceOSOptionProperty(string osType = null, bool enableFipsImage = default) { - if (osType == null) - { - throw new ArgumentNullException(nameof(osType)); - } - - return new ContainerServiceOSOptionProperty(osType, enableFipsImage); + return new ContainerServiceOSOptionProperty(osType, enableFipsImage, default); } - /// Initializes a new instance of ContainerServiceManagedClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -108,10 +102,10 @@ public static ContainerServiceManagedClusterData ContainerServiceManagedClusterD identityProfile ??= new Dictionary(); privateLinkResources ??= new List(); - return new ContainerServiceManagedClusterData(id, name, resourceType, systemData, tags, location, sku, extendedLocation, identity, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode) : null, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId) : null, maxAgentPools, kubernetesVersion, currentKubernetesVersion, dnsPrefix, fqdnSubdomain, fqdn, privateFqdn, azurePortalFqdn, agentPoolProfiles?.ToList(), linuxProfile, windowsProfile, servicePrincipalProfile, addonProfiles, podIdentityProfile, oidcIssuerProfile, nodeResourceGroup, nodeResourceGroupRestrictionLevel != null ? new ManagedClusterNodeResourceGroupProfile(nodeResourceGroupRestrictionLevel) : null, enableRbac, enablePodSecurityPolicy, enableNamespaceResources, networkProfile, aadProfile, autoUpgradeProfile, autoScalerProfile, apiServerAccessProfile, diskEncryptionSetId, identityProfile, privateLinkResources?.ToList(), disableLocalAccounts, httpProxyConfig, securityProfile, storageProfile, ingressWebAppRouting != null ? new ManagedClusterIngressProfile(ingressWebAppRouting) : null, publicNetworkAccess, workloadAutoScalerProfile, azureMonitorMetrics != null ? new ManagedClusterAzureMonitorProfile(azureMonitorMetrics) : null, guardrailsProfile); + return new ContainerServiceManagedClusterData(id, name, resourceType, systemData, tags, location, sku, extendedLocation, identity, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode, new Dictionary()) : null, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, new Dictionary()) : null, maxAgentPools, kubernetesVersion, currentKubernetesVersion, dnsPrefix, fqdnSubdomain, fqdn, privateFqdn, azurePortalFqdn, agentPoolProfiles?.ToList(), linuxProfile, windowsProfile, servicePrincipalProfile, addonProfiles, podIdentityProfile, oidcIssuerProfile, nodeResourceGroup, nodeResourceGroupRestrictionLevel != null ? new ManagedClusterNodeResourceGroupProfile(nodeResourceGroupRestrictionLevel, new Dictionary()) : null, enableRbac, enablePodSecurityPolicy, enableNamespaceResources, networkProfile, aadProfile, autoUpgradeProfile, autoScalerProfile, apiServerAccessProfile, diskEncryptionSetId, identityProfile, privateLinkResources?.ToList(), disableLocalAccounts, httpProxyConfig, securityProfile, storageProfile, ingressWebAppRouting != null ? new ManagedClusterIngressProfile(ingressWebAppRouting, new Dictionary()) : null, publicNetworkAccess, workloadAutoScalerProfile, azureMonitorMetrics != null ? new ManagedClusterAzureMonitorProfile(azureMonitorMetrics, new Dictionary()) : null, guardrailsProfile, default); } - /// Initializes a new instance of ManagedClusterAgentPoolProfile. + /// Initializes a new instance of . /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. @@ -167,10 +161,10 @@ public static ManagedClusterAgentPoolProfile ManagedClusterAgentPoolProfile(int? nodeLabels ??= new Dictionary(); nodeTaints ??= new List(); - return new ManagedClusterAgentPoolProfile(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeMaxSurge != null ? new AgentPoolUpgradeSettings(upgradeMaxSurge) : null, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode) : null, availabilityZones?.ToList(), enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId) : null, capacityReservationGroupId, hostGroupId, disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat) : null, networkProfile, name); + return new ManagedClusterAgentPoolProfile(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeMaxSurge != null ? new AgentPoolUpgradeSettings(upgradeMaxSurge, new Dictionary()) : null, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode, new Dictionary()) : null, availabilityZones?.ToList(), enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, new Dictionary()) : null, capacityReservationGroupId, hostGroupId, disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, new Dictionary()) : null, networkProfile, name, default); } - /// Initializes a new instance of ManagedClusterAgentPoolProfileProperties. + /// Initializes a new instance of . /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. @@ -225,10 +219,10 @@ public static ManagedClusterAgentPoolProfileProperties ManagedClusterAgentPoolPr nodeLabels ??= new Dictionary(); nodeTaints ??= new List(); - return new ManagedClusterAgentPoolProfileProperties(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeMaxSurge != null ? new AgentPoolUpgradeSettings(upgradeMaxSurge) : null, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode) : null, availabilityZones?.ToList(), enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId) : null, capacityReservationGroupId, hostGroupId, disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat) : null, networkProfile); + return new ManagedClusterAgentPoolProfileProperties(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeMaxSurge != null ? new AgentPoolUpgradeSettings(upgradeMaxSurge, new Dictionary()) : null, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode, new Dictionary()) : null, availabilityZones?.ToList(), enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, new Dictionary()) : null, capacityReservationGroupId, hostGroupId, disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, new Dictionary()) : null, networkProfile, default); } - /// Initializes a new instance of ManagedClusterAddonProfile. + /// Initializes a new instance of . /// Whether the add-on is enabled or not. /// Key-value pairs for configuring an add-on. /// Information of user assigned identity used by this add-on. @@ -237,10 +231,10 @@ public static ManagedClusterAddonProfile ManagedClusterAddonProfile(bool isEnabl { config ??= new Dictionary(); - return new ManagedClusterAddonProfile(isEnabled, config, identity); + return new ManagedClusterAddonProfile(isEnabled, config, identity, default); } - /// Initializes a new instance of ManagedClusterPodIdentity. + /// Initializes a new instance of . /// The name of the pod identity. /// The namespace of the pod identity. /// The binding selector to use for the AzureIdentityBinding resource. @@ -250,19 +244,19 @@ public static ManagedClusterAddonProfile ManagedClusterAddonProfile(bool isEnabl /// A new instance for mocking. public static ManagedClusterPodIdentity ManagedClusterPodIdentity(string name = null, string @namespace = null, string bindingSelector = null, ContainerServiceUserAssignedIdentity identity = null, ManagedClusterPodIdentityProvisioningState? provisioningState = null, ResponseError errorDetail = null) { - return new ManagedClusterPodIdentity(name, @namespace, bindingSelector, identity, provisioningState, errorDetail != null ? new ManagedClusterPodIdentityProvisioningInfo(new ManagedClusterPodIdentityProvisioningError(errorDetail)) : null); + return new ManagedClusterPodIdentity(name, @namespace, bindingSelector, identity, provisioningState, errorDetail != null ? new ManagedClusterPodIdentityProvisioningInfo(new ManagedClusterPodIdentityProvisioningError(errorDetail, new Dictionary()), new Dictionary()) : null, default); } - /// Initializes a new instance of ManagedClusterOidcIssuerProfile. + /// Initializes a new instance of . /// The OIDC issuer url of the Managed Cluster. /// Whether the OIDC issuer is enabled. /// A new instance for mocking. public static ManagedClusterOidcIssuerProfile ManagedClusterOidcIssuerProfile(string issuerUriInfo = null, bool? isEnabled = null) { - return new ManagedClusterOidcIssuerProfile(issuerUriInfo, isEnabled); + return new ManagedClusterOidcIssuerProfile(issuerUriInfo, isEnabled, default); } - /// Initializes a new instance of ContainerServicePrivateLinkResourceData. + /// Initializes a new instance of . /// The ID of the private link resource. /// The name of the private link resource. /// The resource type. @@ -274,10 +268,10 @@ public static ContainerServicePrivateLinkResourceData ContainerServicePrivateLin { requiredMembers ??= new List(); - return new ContainerServicePrivateLinkResourceData(id, name, resourceType, groupId, requiredMembers?.ToList(), privateLinkServiceId); + return new ContainerServicePrivateLinkResourceData(id, name, resourceType, groupId, requiredMembers?.ToList(), privateLinkServiceId, default); } - /// Initializes a new instance of ManagedClusterHttpProxyConfig. + /// Initializes a new instance of . /// The HTTP proxy server endpoint to use. /// The HTTPS proxy server endpoint to use. /// The endpoints that should not go through proxy. @@ -289,10 +283,10 @@ public static ManagedClusterHttpProxyConfig ManagedClusterHttpProxyConfig(string noProxy ??= new List(); effectiveNoProxy ??= new List(); - return new ManagedClusterHttpProxyConfig(httpProxy, httpsProxy, noProxy?.ToList(), effectiveNoProxy?.ToList(), trustedCA); + return new ManagedClusterHttpProxyConfig(httpProxy, httpsProxy, noProxy?.ToList(), effectiveNoProxy?.ToList(), trustedCA, default); } - /// Initializes a new instance of ManagedClusterGuardrailsProfile. + /// Initializes a new instance of . /// List of namespaces specified by AKS to be excluded from Guardrails. /// The version of constraints to use. /// The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. @@ -303,10 +297,10 @@ public static ManagedClusterGuardrailsProfile ManagedClusterGuardrailsProfile(IE systemExcludedNamespaces ??= new List(); excludedNamespaces ??= new List(); - return new ManagedClusterGuardrailsProfile(systemExcludedNamespaces?.ToList(), version, level, excludedNamespaces?.ToList()); + return new ManagedClusterGuardrailsProfile(systemExcludedNamespaces?.ToList(), version, level, excludedNamespaces?.ToList(), default); } - /// Initializes a new instance of ManagedClusterUpgradeProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -318,10 +312,10 @@ public static ManagedClusterUpgradeProfileData ManagedClusterUpgradeProfileData( { agentPoolProfiles ??= new List(); - return new ManagedClusterUpgradeProfileData(id, name, resourceType, systemData, controlPlaneProfile, agentPoolProfiles?.ToList()); + return new ManagedClusterUpgradeProfileData(id, name, resourceType, systemData, controlPlaneProfile, agentPoolProfiles?.ToList(), default); } - /// Initializes a new instance of ManagedClusterPoolUpgradeProfile. + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// The Agent Pool name. /// The operating system type. The default is Linux. @@ -331,19 +325,19 @@ public static ManagedClusterPoolUpgradeProfile ManagedClusterPoolUpgradeProfile( { upgrades ??= new List(); - return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name, osType, upgrades?.ToList()); + return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name, osType, upgrades?.ToList(), default); } - /// Initializes a new instance of ManagedClusterPoolUpgradeProfileUpgradesItem. + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. /// A new instance for mocking. public static ManagedClusterPoolUpgradeProfileUpgradesItem ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion = null, bool? isPreview = null) { - return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview); + return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, default); } - /// Initializes a new instance of ManagedClusterAccessProfile. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -356,29 +350,29 @@ public static ManagedClusterAccessProfile ManagedClusterAccessProfile(ResourceId { tags ??= new Dictionary(); - return new ManagedClusterAccessProfile(id, name, resourceType, systemData, tags, location, kubeConfig); + return new ManagedClusterAccessProfile(id, name, resourceType, systemData, tags, location, kubeConfig, default); } - /// Initializes a new instance of ManagedClusterCredentials. + /// Initializes a new instance of . /// Base64-encoded Kubernetes configuration file. /// A new instance for mocking. public static ManagedClusterCredentials ManagedClusterCredentials(IEnumerable kubeconfigs = null) { kubeconfigs ??= new List(); - return new ManagedClusterCredentials(kubeconfigs?.ToList()); + return new ManagedClusterCredentials(kubeconfigs?.ToList(), default); } - /// Initializes a new instance of ManagedClusterCredential. + /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. /// A new instance for mocking. public static ManagedClusterCredential ManagedClusterCredential(string name = null, byte[] value = null) { - return new ManagedClusterCredential(name, value); + return new ManagedClusterCredential(name, value, default); } - /// Initializes a new instance of ContainerServiceMaintenanceConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -392,10 +386,10 @@ public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaint timesInWeek ??= new List(); notAllowedTimes ??= new List(); - return new ContainerServiceMaintenanceConfigurationData(id, name, resourceType, systemData, timesInWeek?.ToList(), notAllowedTimes?.ToList(), maintenanceWindow); + return new ContainerServiceMaintenanceConfigurationData(id, name, resourceType, systemData, timesInWeek?.ToList(), notAllowedTimes?.ToList(), maintenanceWindow, default); } - /// Initializes a new instance of ContainerServiceAgentPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -454,10 +448,10 @@ public static ContainerServiceAgentPoolData ContainerServiceAgentPoolData(Resour nodeLabels ??= new Dictionary(); nodeTaints ??= new List(); - return new ContainerServiceAgentPoolData(id, name, resourceType, systemData, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, typePropertiesType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeMaxSurge != null ? new AgentPoolUpgradeSettings(upgradeMaxSurge) : null, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode) : null, availabilityZones?.ToList(), enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId) : null, capacityReservationGroupId, hostGroupId, disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat) : null, networkProfile); + return new ContainerServiceAgentPoolData(id, name, resourceType, systemData, count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, typePropertiesType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeMaxSurge != null ? new AgentPoolUpgradeSettings(upgradeMaxSurge, new Dictionary()) : null, provisioningState, powerStateCode != null ? new ContainerServicePowerState(powerStateCode, new Dictionary()) : null, availabilityZones?.ToList(), enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints?.ToList(), proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, new Dictionary()) : null, capacityReservationGroupId, hostGroupId, disableOutboundNat != null ? new AgentPoolWindowsProfile(disableOutboundNat, new Dictionary()) : null, networkProfile, default); } - /// Initializes a new instance of AgentPoolUpgradeProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -471,19 +465,19 @@ public static AgentPoolUpgradeProfileData AgentPoolUpgradeProfileData(ResourceId { upgrades ??= new List(); - return new AgentPoolUpgradeProfileData(id, name, resourceType, systemData, kubernetesVersion, osType, upgrades?.ToList(), latestNodeImageVersion); + return new AgentPoolUpgradeProfileData(id, name, resourceType, systemData, kubernetesVersion, osType, upgrades?.ToList(), latestNodeImageVersion, default); } - /// Initializes a new instance of AgentPoolUpgradeProfilePropertiesUpgradesItem. + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. /// A new instance for mocking. public static AgentPoolUpgradeProfilePropertiesUpgradesItem AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = null, bool? isPreview = null) { - return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview); + return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview, default); } - /// Initializes a new instance of AgentPoolAvailableVersions. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -494,20 +488,20 @@ public static AgentPoolAvailableVersions AgentPoolAvailableVersions(ResourceIden { agentPoolVersions ??= new List(); - return new AgentPoolAvailableVersions(id, name, resourceType, systemData, agentPoolVersions?.ToList()); + return new AgentPoolAvailableVersions(id, name, resourceType, systemData, agentPoolVersions?.ToList(), default); } - /// Initializes a new instance of AgentPoolAvailableVersion. + /// Initializes a new instance of . /// Whether this version is the default agent pool version. /// The Kubernetes version (major.minor.patch). /// Whether Kubernetes version is currently in preview. /// A new instance for mocking. public static AgentPoolAvailableVersion AgentPoolAvailableVersion(bool? isDefault = null, string kubernetesVersion = null, bool? isPreview = null) { - return new AgentPoolAvailableVersion(isDefault, kubernetesVersion, isPreview); + return new AgentPoolAvailableVersion(isDefault, kubernetesVersion, isPreview, default); } - /// Initializes a new instance of ContainerServicePrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -518,10 +512,20 @@ public static AgentPoolAvailableVersion AgentPoolAvailableVersion(bool? isDefaul /// A new instance for mocking. public static ContainerServicePrivateEndpointConnectionData ContainerServicePrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerServicePrivateEndpointConnectionProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, ContainerServicePrivateLinkServiceConnectionState connectionState = null) { - return new ContainerServicePrivateEndpointConnectionData(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState); + return new ContainerServicePrivateEndpointConnectionData(id, name, resourceType, systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, connectionState, default); + } + + /// Initializes a new instance of . + /// The command to run. + /// A base64 encoded zip file containing the files required by the command. + /// AuthToken issued for AKS AAD Server App. + /// A new instance for mocking. + public static ManagedClusterRunCommandContent ManagedClusterRunCommandContent(string command = null, string context = null, string clusterToken = null) + { + return new ManagedClusterRunCommandContent(command, context, clusterToken, default); } - /// Initializes a new instance of ManagedClusterRunCommandResult. + /// Initializes a new instance of . /// The command id. /// provisioning State. /// The exit code of the command. @@ -532,10 +536,10 @@ public static ContainerServicePrivateEndpointConnectionData ContainerServicePriv /// A new instance for mocking. public static ManagedClusterRunCommandResult ManagedClusterRunCommandResult(string id = null, string provisioningState = null, int? exitCode = null, DateTimeOffset? startedOn = null, DateTimeOffset? finishedOn = null, string logs = null, string reason = null) { - return new ManagedClusterRunCommandResult(id, provisioningState, exitCode, startedOn, finishedOn, logs, reason); + return new ManagedClusterRunCommandResult(id, provisioningState, exitCode, startedOn, finishedOn, logs, reason, default); } - /// Initializes a new instance of ContainerServiceOutboundEnvironmentEndpoint. + /// Initializes a new instance of . /// The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. /// The endpoints that AKS agent nodes connect to. /// A new instance for mocking. @@ -543,10 +547,10 @@ public static ContainerServiceOutboundEnvironmentEndpoint ContainerServiceOutbou { endpoints ??= new List(); - return new ContainerServiceOutboundEnvironmentEndpoint(category, endpoints?.ToList()); + return new ContainerServiceOutboundEnvironmentEndpoint(category, endpoints?.ToList(), default); } - /// Initializes a new instance of ContainerServiceEndpointDependency. + /// Initializes a new instance of . /// The domain name of the dependency. /// The Ports and Protocols used when connecting to domainName. /// A new instance for mocking. @@ -554,10 +558,10 @@ public static ContainerServiceEndpointDependency ContainerServiceEndpointDepende { endpointDetails ??= new List(); - return new ContainerServiceEndpointDependency(domainName, endpointDetails?.ToList()); + return new ContainerServiceEndpointDependency(domainName, endpointDetails?.ToList(), default); } - /// Initializes a new instance of ContainerServiceEndpointDetail. + /// Initializes a new instance of . /// An IP Address that Domain Name currently resolves to. /// The port an endpoint is connected to. /// The protocol used for connection. @@ -565,10 +569,10 @@ public static ContainerServiceEndpointDependency ContainerServiceEndpointDepende /// A new instance for mocking. public static ContainerServiceEndpointDetail ContainerServiceEndpointDetail(IPAddress ipAddress = null, int? port = null, string protocol = null, string description = null) { - return new ContainerServiceEndpointDetail(ipAddress, port, protocol, description); + return new ContainerServiceEndpointDetail(ipAddress, port, protocol, description, default); } - /// Initializes a new instance of AgentPoolSnapshotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -588,10 +592,10 @@ public static AgentPoolSnapshotData AgentPoolSnapshotData(ResourceIdentifier id { tags ??= new Dictionary(); - return new AgentPoolSnapshotData(id, name, resourceType, systemData, tags, location, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId) : null, snapshotType, kubernetesVersion, nodeImageVersion, osType, osSku, vmSize, enableFips); + return new AgentPoolSnapshotData(id, name, resourceType, systemData, tags, location, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, new Dictionary()) : null, snapshotType, kubernetesVersion, nodeImageVersion, osType, osSku, vmSize, enableFips, default); } - /// Initializes a new instance of ManagedClusterSnapshotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -606,10 +610,10 @@ public static ManagedClusterSnapshotData ManagedClusterSnapshotData(ResourceIden { tags ??= new Dictionary(); - return new ManagedClusterSnapshotData(id, name, resourceType, systemData, tags, location, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId) : null, snapshotType, managedClusterPropertiesReadOnly); + return new ManagedClusterSnapshotData(id, name, resourceType, systemData, tags, location, creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, new Dictionary()) : null, snapshotType, managedClusterPropertiesReadOnly, default); } - /// Initializes a new instance of ManagedClusterPropertiesForSnapshot. + /// Initializes a new instance of . /// The current kubernetes version. /// The current managed cluster sku. /// Whether the cluster has enabled Kubernetes Role-Based Access Control or not. @@ -617,10 +621,10 @@ public static ManagedClusterSnapshotData ManagedClusterSnapshotData(ResourceIden /// A new instance for mocking. public static ManagedClusterPropertiesForSnapshot ManagedClusterPropertiesForSnapshot(string kubernetesVersion = null, ManagedClusterSku sku = null, bool? enableRbac = null, ContainerServiceNetworkProfileForSnapshot networkProfile = null) { - return new ManagedClusterPropertiesForSnapshot(kubernetesVersion, sku, enableRbac, networkProfile); + return new ManagedClusterPropertiesForSnapshot(kubernetesVersion, sku, enableRbac, networkProfile, default); } - /// Initializes a new instance of ContainerServiceNetworkProfileForSnapshot. + /// Initializes a new instance of . /// networkPlugin for managed cluster snapshot. /// NetworkPluginMode for managed cluster snapshot. /// networkPolicy for managed cluster snapshot. @@ -629,10 +633,10 @@ public static ManagedClusterPropertiesForSnapshot ManagedClusterPropertiesForSna /// A new instance for mocking. public static ContainerServiceNetworkProfileForSnapshot ContainerServiceNetworkProfileForSnapshot(ContainerServiceNetworkPlugin? networkPlugin = null, ContainerServiceNetworkPluginMode? networkPluginMode = null, ContainerServiceNetworkPolicy? networkPolicy = null, ContainerServiceNetworkMode? networkMode = null, ContainerServiceLoadBalancerSku? loadBalancerSku = null) { - return new ContainerServiceNetworkProfileForSnapshot(networkPlugin, networkPluginMode, networkPolicy, networkMode, loadBalancerSku); + return new ContainerServiceNetworkProfileForSnapshot(networkPlugin, networkPluginMode, networkPolicy, networkMode, loadBalancerSku, default); } - /// Initializes a new instance of ContainerServiceTrustedAccessRole. + /// Initializes a new instance of . /// Resource type of Azure resource. /// Name of role, name is unique under a source resource type. /// List of rules for the role. This maps to 'rules' property of [Kubernetes Cluster Role](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole). @@ -641,10 +645,10 @@ public static ContainerServiceTrustedAccessRole ContainerServiceTrustedAccessRol { rules ??= new List(); - return new ContainerServiceTrustedAccessRole(sourceResourceType, name, rules?.ToList()); + return new ContainerServiceTrustedAccessRole(sourceResourceType, name, rules?.ToList(), default); } - /// Initializes a new instance of ContainerServiceTrustedAccessRoleRule. + /// Initializes a new instance of . /// List of allowed verbs. /// List of allowed apiGroups. /// List of allowed resources. @@ -659,10 +663,10 @@ public static ContainerServiceTrustedAccessRoleRule ContainerServiceTrustedAcces resourceNames ??= new List(); nonResourceUrls ??= new List(); - return new ContainerServiceTrustedAccessRoleRule(verbs?.ToList(), apiGroups?.ToList(), resources?.ToList(), resourceNames?.ToList(), nonResourceUrls?.ToList()); + return new ContainerServiceTrustedAccessRoleRule(verbs?.ToList(), apiGroups?.ToList(), resources?.ToList(), resourceNames?.ToList(), nonResourceUrls?.ToList(), default); } - /// Initializes a new instance of ContainerServiceTrustedAccessRoleBindingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -675,10 +679,10 @@ public static ContainerServiceTrustedAccessRoleBindingData ContainerServiceTrust { roles ??= new List(); - return new ContainerServiceTrustedAccessRoleBindingData(id, name, resourceType, systemData, provisioningState, sourceResourceId, roles?.ToList()); + return new ContainerServiceTrustedAccessRoleBindingData(id, name, resourceType, systemData, provisioningState, sourceResourceId, roles?.ToList(), default); } - /// Initializes a new instance of ContainerServiceFleetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -693,39 +697,39 @@ public static ContainerServiceFleetData ContainerServiceFleetData(ResourceIdenti { tags ??= new Dictionary(); - return new ContainerServiceFleetData(id, name, resourceType, systemData, tags, location, etag, hubProfile, provisioningState); + return new ContainerServiceFleetData(id, name, resourceType, systemData, tags, location, etag, hubProfile, provisioningState, default); } - /// Initializes a new instance of ContainerServiceFleetHubProfile. + /// Initializes a new instance of . /// DNS prefix used to create the FQDN for the Fleet hub. /// The FQDN of the Fleet hub. /// The Kubernetes version of the Fleet hub. /// A new instance for mocking. public static ContainerServiceFleetHubProfile ContainerServiceFleetHubProfile(string dnsPrefix = null, string fqdn = null, string kubernetesVersion = null) { - return new ContainerServiceFleetHubProfile(dnsPrefix, fqdn, kubernetesVersion); + return new ContainerServiceFleetHubProfile(dnsPrefix, fqdn, kubernetesVersion, default); } - /// Initializes a new instance of ContainerServiceFleetCredentialResults. + /// Initializes a new instance of . /// Base64-encoded Kubernetes configuration file. /// A new instance for mocking. public static ContainerServiceFleetCredentialResults ContainerServiceFleetCredentialResults(IEnumerable kubeconfigs = null) { kubeconfigs ??= new List(); - return new ContainerServiceFleetCredentialResults(kubeconfigs?.ToList()); + return new ContainerServiceFleetCredentialResults(kubeconfigs?.ToList(), default); } - /// Initializes a new instance of ContainerServiceFleetCredentialResult. + /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. /// A new instance for mocking. public static ContainerServiceFleetCredentialResult ContainerServiceFleetCredentialResult(string name = null, byte[] value = null) { - return new ContainerServiceFleetCredentialResult(name, value); + return new ContainerServiceFleetCredentialResult(name, value, default); } - /// Initializes a new instance of ContainerServiceFleetMemberData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -736,7 +740,7 @@ public static ContainerServiceFleetCredentialResult ContainerServiceFleetCredent /// A new instance for mocking. public static ContainerServiceFleetMemberData ContainerServiceFleetMemberData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier clusterResourceId = null, ContainerServiceFleetMemberProvisioningState? provisioningState = null, ETag? etag = null) { - return new ContainerServiceFleetMemberData(id, name, resourceType, systemData, clusterResourceId, provisioningState, etag); + return new ContainerServiceFleetMemberData(id, name, resourceType, systemData, clusterResourceId, provisioningState, etag, default); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs index 06102300c6a7..f94f5001e166 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceAgentPoolResource(Client, ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(e)), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceAgentPoolResource(Client, ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(e)), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceAgentPoolResource(Client, ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(e)), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceAgentPoolResource(Client, ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(e)), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs index b22fb7e7db19..58143ea944a7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServiceAgentPoolData : ResourceData { - /// Initializes a new instance of ContainerServiceAgentPoolData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceAgentPoolData() { AvailabilityZones = new ChangeTrackingList(); @@ -27,7 +31,7 @@ public ContainerServiceAgentPoolData() NodeTaints = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceAgentPoolData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -78,7 +82,8 @@ public ContainerServiceAgentPoolData() /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. - internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? typePropertiesType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Count = count; VmSize = vmSize; @@ -126,6 +131,7 @@ internal ContainerServiceAgentPoolData(ResourceIdentifier id, string name, Resou HostGroupId = hostGroupId; WindowsProfile = windowsProfile; NetworkProfile = networkProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs index c93001cc1ddd..2f583113239e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceFleetFleetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceFleetFleetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), _containerServiceFleetFleetsClientDiagnostics, Pipeline, "ContainerServiceFleetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), _containerServiceFleetFleetsClientDiagnostics, Pipeline, "ContainerServiceFleetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -255,7 +255,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceFleetFleetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceFleetFleetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), _containerServiceFleetFleetsClientDiagnostics, Pipeline, "ContainerServiceFleetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), _containerServiceFleetFleetsClientDiagnostics, Pipeline, "ContainerServiceFleetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetData.cs index c324daa66f14..1ed40517977f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServiceFleetData : TrackedResourceData { - /// Initializes a new instance of ContainerServiceFleetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerServiceFleetData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ContainerServiceFleetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,11 +39,18 @@ public ContainerServiceFleetData(AzureLocation location) : base(location) /// Resource Etag. /// The FleetHubProfile configures the Fleet's hub. /// The provisioning state of the last accepted operation. - internal ContainerServiceFleetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ContainerServiceFleetHubProfile hubProfile, ContainerServiceFleetProvisioningState? provisioningState) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceFleetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ContainerServiceFleetHubProfile hubProfile, ContainerServiceFleetProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; HubProfile = hubProfile; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceFleetData() + { } /// Resource Etag. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs index 745fa57ee43b..092434726a47 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceFleetMemberFleetMembersRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceFleetMemberFleetMembersRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetMemberResource(Client, ContainerServiceFleetMemberData.DeserializeContainerServiceFleetMemberData(e)), _containerServiceFleetMemberFleetMembersClientDiagnostics, Pipeline, "ContainerServiceFleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceFleetMemberResource(Client, ContainerServiceFleetMemberData.DeserializeContainerServiceFleetMemberData(e)), _containerServiceFleetMemberFleetMembersClientDiagnostics, Pipeline, "ContainerServiceFleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceFleetMemberFleetMembersRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceFleetMemberFleetMembersRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetMemberResource(Client, ContainerServiceFleetMemberData.DeserializeContainerServiceFleetMemberData(e)), _containerServiceFleetMemberFleetMembersClientDiagnostics, Pipeline, "ContainerServiceFleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceFleetMemberResource(Client, ContainerServiceFleetMemberData.DeserializeContainerServiceFleetMemberData(e)), _containerServiceFleetMemberFleetMembersClientDiagnostics, Pipeline, "ContainerServiceFleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberData.cs index bbc55d99d1f4..17272eaeeab8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServiceFleetMemberData : ResourceData { - /// Initializes a new instance of ContainerServiceFleetMemberData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceFleetMemberData() { } - /// Initializes a new instance of ContainerServiceFleetMemberData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public ContainerServiceFleetMemberData() /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. /// The provisioning state of the last accepted operation. /// Resource Etag. - internal ContainerServiceFleetMemberData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier clusterResourceId, ContainerServiceFleetMemberProvisioningState? provisioningState, ETag? etag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceFleetMemberData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier clusterResourceId, ContainerServiceFleetMemberProvisioningState? provisioningState, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ClusterResourceId = clusterResourceId; ProvisioningState = provisioningState; ETag = etag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs index b69cdcf47a9d..8900990617a4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable G { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceMaintenanceConfigurationResource(Client, ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(e)), _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics, Pipeline, "ContainerServiceMaintenanceConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceMaintenanceConfigurationResource(Client, ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(e)), _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics, Pipeline, "ContainerServiceMaintenanceConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceMaintenanceConfigurationResource(Client, ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(e)), _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics, Pipeline, "ContainerServiceMaintenanceConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceMaintenanceConfigurationResource(Client, ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(e)), _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics, Pipeline, "ContainerServiceMaintenanceConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs index 7e9594f77c0a..fcc1a4f7c7d6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServiceMaintenanceConfigurationData : ResourceData { - /// Initializes a new instance of ContainerServiceMaintenanceConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceMaintenanceConfigurationData() { TimesInWeek = new ChangeTrackingList(); NotAllowedTimes = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceMaintenanceConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,11 +37,13 @@ public ContainerServiceMaintenanceConfigurationData() /// If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. /// Time slots on which upgrade is not allowed. /// Maintenance window for the maintenance configuration. - internal ContainerServiceMaintenanceConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList timesInWeek, IList notAllowedTimes, ContainerServiceMaintenanceWindow maintenanceWindow) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList timesInWeek, IList notAllowedTimes, ContainerServiceMaintenanceWindow maintenanceWindow, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TimesInWeek = timesInWeek; NotAllowedTimes = notAllowedTimes; MaintenanceWindow = maintenanceWindow; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs index d685cfb39125..30b546522956 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs index f595ffd37f03..c53d09cdbd69 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServiceManagedClusterData : TrackedResourceData { - /// Initializes a new instance of ContainerServiceManagedClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ContainerServiceManagedClusterData(AzureLocation location) : base(location) { @@ -29,7 +33,7 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio PrivateLinkResources = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceManagedClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -79,7 +83,8 @@ public ContainerServiceManagedClusterData(AzureLocation location) : base(locatio /// Workload Auto-scaler profile for the managed cluster. /// Prometheus addon profile for the container service cluster. /// The guardrails profile holds all the guardrails information for a given cluster. - internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedServiceIdentity identity, string provisioningState, ContainerServicePowerState powerState, ContainerServiceCreationData creationData, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, ManagedClusterNodeResourceGroupProfile nodeResourceGroupProfile, bool? enableRbac, bool? enablePodSecurityPolicy, bool? enableNamespaceResources, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IList privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ManagedClusterIngressProfile ingressProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterAzureMonitorProfile azureMonitorProfile, ManagedClusterGuardrailsProfile guardrailsProfile) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedClusterSku sku, ExtendedLocation extendedLocation, ManagedServiceIdentity identity, string provisioningState, ContainerServicePowerState powerState, ContainerServiceCreationData creationData, int? maxAgentPools, string kubernetesVersion, string currentKubernetesVersion, string dnsPrefix, string fqdnSubdomain, string fqdn, string privateFqdn, string azurePortalFqdn, IList agentPoolProfiles, ContainerServiceLinuxProfile linuxProfile, ManagedClusterWindowsProfile windowsProfile, ManagedClusterServicePrincipalProfile servicePrincipalProfile, IDictionary addonProfiles, ManagedClusterPodIdentityProfile podIdentityProfile, ManagedClusterOidcIssuerProfile oidcIssuerProfile, string nodeResourceGroup, ManagedClusterNodeResourceGroupProfile nodeResourceGroupProfile, bool? enableRbac, bool? enablePodSecurityPolicy, bool? enableNamespaceResources, ContainerServiceNetworkProfile networkProfile, ManagedClusterAadProfile aadProfile, ManagedClusterAutoUpgradeProfile autoUpgradeProfile, ManagedClusterAutoScalerProfile autoScalerProfile, ManagedClusterApiServerAccessProfile apiServerAccessProfile, ResourceIdentifier diskEncryptionSetId, IDictionary identityProfile, IList privateLinkResources, bool? disableLocalAccounts, ManagedClusterHttpProxyConfig httpProxyConfig, ManagedClusterSecurityProfile securityProfile, ManagedClusterStorageProfile storageProfile, ManagedClusterIngressProfile ingressProfile, ContainerServicePublicNetworkAccess? publicNetworkAccess, ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile, ManagedClusterAzureMonitorProfile azureMonitorProfile, ManagedClusterGuardrailsProfile guardrailsProfile, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; ExtendedLocation = extendedLocation; @@ -124,6 +129,12 @@ internal ContainerServiceManagedClusterData(ResourceIdentifier id, string name, WorkloadAutoScalerProfile = workloadAutoScalerProfile; AzureMonitorProfile = azureMonitorProfile; GuardrailsProfile = guardrailsProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceManagedClusterData() + { } /// The managed cluster SKU. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs index 2fb292478c40..f2aa2c680ac7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(s public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ContainerServicePrivateEndpointConnectionResource(Client, ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(e)), _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new ContainerServicePrivateEndpointConnectionResource(Client, ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(e)), _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ContainerServicePrivateEndpointConnectionResource(Client, ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(e)), _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new ContainerServicePrivateEndpointConnectionResource(Client, ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(e)), _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs index e5b74ac6b0eb..6731edc0ea46 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; @@ -18,12 +20,15 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServicePrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of ContainerServicePrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServicePrivateEndpointConnectionData() { } - /// Initializes a new instance of ContainerServicePrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +36,13 @@ public ContainerServicePrivateEndpointConnectionData() /// The current provisioning state. /// The resource of private endpoint. /// A collection of information about the state of the connection between service consumer and provider. - internal ContainerServicePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerServicePrivateEndpointConnectionProvisioningState? provisioningState, WritableSubResource privateEndpoint, ContainerServicePrivateLinkServiceConnectionState connectionState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerServicePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerServicePrivateEndpointConnectionProvisioningState? provisioningState, WritableSubResource privateEndpoint, ContainerServicePrivateLinkServiceConnectionState connectionState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The current provisioning state. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs index 44e6acf6bf03..42f3ad1ee171 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable G { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceTrustedAccessRoleBindingResource(Client, ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(e)), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, "ContainerServiceTrustedAccessRoleBindingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceTrustedAccessRoleBindingResource(Client, ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(e)), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, "ContainerServiceTrustedAccessRoleBindingCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll { HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceTrustedAccessRoleBindingResource(Client, ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(e)), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, "ContainerServiceTrustedAccessRoleBindingCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceTrustedAccessRoleBindingResource(Client, ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(e)), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, "ContainerServiceTrustedAccessRoleBindingCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs index e5296b99cef7..036b5ddc0b72 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ContainerServiceTrustedAccessRoleBindingData : ResourceData { - /// Initializes a new instance of ContainerServiceTrustedAccessRoleBindingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The ARM resource ID of source resource that trusted access is configured for. /// A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. /// or is null. @@ -33,7 +36,7 @@ public ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier sourceRes Roles = roles.ToList(); } - /// Initializes a new instance of ContainerServiceTrustedAccessRoleBindingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,11 +44,18 @@ public ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier sourceRes /// The current provisioning state of trusted access role binding. /// The ARM resource ID of source resource that trusted access is configured for. /// A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. - internal ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerServiceTrustedAccessRoleBindingProvisioningState? provisioningState, ResourceIdentifier sourceResourceId, IList roles) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerServiceTrustedAccessRoleBindingProvisioningState? provisioningState, ResourceIdentifier sourceResourceId, IList roles, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; SourceResourceId = sourceResourceId; Roles = roles; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceTrustedAccessRoleBindingData() + { } /// The current provisioning state of trusted access role binding. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 00ff449ba0c8..7a76070cee3a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -77,7 +77,7 @@ public virtual AsyncPageable GetContaine { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); } /// @@ -99,7 +99,7 @@ public virtual Pageable GetContainerServ { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); } /// @@ -121,7 +121,7 @@ public virtual AsyncPageable GetAgentPoolSnapshotsAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); } /// @@ -143,7 +143,7 @@ public virtual Pageable GetAgentPoolSnapshots(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); } /// @@ -165,7 +165,7 @@ public virtual AsyncPageable GetManagedClusterSn { HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); } /// @@ -187,7 +187,7 @@ public virtual Pageable GetManagedClusterSnapsho { HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); } /// @@ -255,7 +255,7 @@ public virtual AsyncPageable GetContainerServiceF { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); } /// @@ -277,7 +277,7 @@ public virtual Pageable GetContainerServiceFleets { HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs index ee672f36a36f..a621dec3f4af 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _managedClusterSnapshotRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedClusterSnapshotRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), _managedClusterSnapshotClientDiagnostics, Pipeline, "ManagedClusterSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), _managedClusterSnapshotClientDiagnostics, Pipeline, "ManagedClusterSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _managedClusterSnapshotRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedClusterSnapshotRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), _managedClusterSnapshotClientDiagnostics, Pipeline, "ManagedClusterSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), _managedClusterSnapshotClientDiagnostics, Pipeline, "ManagedClusterSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs index 30e2ec52bae2..0c552c6a3de0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ManagedClusterSnapshotData : TrackedResourceData { - /// Initializes a new instance of ManagedClusterSnapshotData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ManagedClusterSnapshotData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ManagedClusterSnapshotData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public ManagedClusterSnapshotData(AzureLocation location) : base(location) /// CreationData to be used to specify the source resource ID to create this snapshot. /// The type of a snapshot. The default is NodePool. /// What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. - internal ManagedClusterSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerServiceCreationData creationData, SnapshotType? snapshotType, ManagedClusterPropertiesForSnapshot managedClusterPropertiesReadOnly) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerServiceCreationData creationData, SnapshotType? snapshotType, ManagedClusterPropertiesForSnapshot managedClusterPropertiesReadOnly, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { CreationData = creationData; SnapshotType = snapshotType; ManagedClusterPropertiesReadOnly = managedClusterPropertiesReadOnly; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterSnapshotData() + { } /// CreationData to be used to specify the source resource ID to create this snapshot. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs index 11d813dd7048..03db276d26d0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ContainerService /// public partial class ManagedClusterUpgradeProfileData : ResourceData { - /// Initializes a new instance of ManagedClusterUpgradeProfileData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of available upgrade versions for the control plane. /// The list of available upgrade versions for agent pools. /// or is null. @@ -33,17 +36,24 @@ internal ManagedClusterUpgradeProfileData(ManagedClusterPoolUpgradeProfile contr AgentPoolProfiles = agentPoolProfiles.ToList(); } - /// Initializes a new instance of ManagedClusterUpgradeProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The list of available upgrade versions for the control plane. /// The list of available upgrade versions for agent pools. - internal ManagedClusterUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedClusterPoolUpgradeProfile controlPlaneProfile, IReadOnlyList agentPoolProfiles) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedClusterPoolUpgradeProfile controlPlaneProfile, IReadOnlyList agentPoolProfiles, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ControlPlaneProfile = controlPlaneProfile; AgentPoolProfiles = agentPoolProfiles; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterUpgradeProfileData() + { } /// The list of available upgrade versions for the control plane. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs index 806b3abaa1ab..6d8cf084d38a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolAvailableVersion + public partial class AgentPoolAvailableVersion : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsDefault)) + { + writer.WritePropertyName("default"u8); + writer.WriteBooleanValue(IsDefault.Value); + } + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (Optional.IsDefined(IsPreview)) + { + writer.WritePropertyName("isPreview"u8); + writer.WriteBooleanValue(IsPreview.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(J Optional @default = default; Optional kubernetesVersion = default; Optional isPreview = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("default"u8)) @@ -46,8 +90,61 @@ internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(J isPreview = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentPoolAvailableVersion(Optional.ToNullable(@default), kubernetesVersion.Value, Optional.ToNullable(isPreview)); + return new AgentPoolAvailableVersion(Optional.ToNullable(@default), kubernetesVersion.Value, Optional.ToNullable(isPreview), serializedAdditionalRawData); + } + + AgentPoolAvailableVersion IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolAvailableVersion(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolAvailableVersion IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolAvailableVersion(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolAvailableVersion model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolAvailableVersion(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolAvailableVersion(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs index 51296ed9d7ca..1f790163e787 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The AgentPoolAvailableVersion. public partial class AgentPoolAvailableVersion { - /// Initializes a new instance of AgentPoolAvailableVersion. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgentPoolAvailableVersion() { } - /// Initializes a new instance of AgentPoolAvailableVersion. + /// Initializes a new instance of . /// Whether this version is the default agent pool version. /// The Kubernetes version (major.minor.patch). /// Whether Kubernetes version is currently in preview. - internal AgentPoolAvailableVersion(bool? isDefault, string kubernetesVersion, bool? isPreview) + /// Keeps track of any properties unknown to the library. + internal AgentPoolAvailableVersion(bool? isDefault, string kubernetesVersion, bool? isPreview, Dictionary serializedAdditionalRawData) { IsDefault = isDefault; KubernetesVersion = kubernetesVersion; IsPreview = isPreview; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether this version is the default agent pool version. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs index 60d7110806d2..59aa531e2275 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs @@ -5,17 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolAvailableVersions + public partial class AgentPoolAvailableVersions : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentPoolAvailableVersions DeserializeAgentPoolAvailableVersions(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AgentPoolVersions)) + { + writer.WritePropertyName("agentPoolVersions"u8); + writer.WriteStartArray(); + foreach (var item in AgentPoolVersions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentPoolAvailableVersions DeserializeAgentPoolAvailableVersions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +72,7 @@ internal static AgentPoolAvailableVersions DeserializeAgentPoolAvailableVersions ResourceType type = default; Optional systemData = default; Optional> agentPoolVersions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -77,8 +125,61 @@ internal static AgentPoolAvailableVersions DeserializeAgentPoolAvailableVersions } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentPoolAvailableVersions(id, name, type, systemData.Value, Optional.ToList(agentPoolVersions)); + return new AgentPoolAvailableVersions(id, name, type, systemData.Value, Optional.ToList(agentPoolVersions), serializedAdditionalRawData); + } + + AgentPoolAvailableVersions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolAvailableVersions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolAvailableVersions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolAvailableVersions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolAvailableVersions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolAvailableVersions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolAvailableVersions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs index f523851d0655..b078a7cc957f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ContainerService.Models /// The list of available versions for an agent pool. public partial class AgentPoolAvailableVersions : ResourceData { - /// Initializes a new instance of AgentPoolAvailableVersions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgentPoolAvailableVersions() { AgentPoolVersions = new ChangeTrackingList(); } - /// Initializes a new instance of AgentPoolAvailableVersions. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// List of versions available for agent pool. - internal AgentPoolAvailableVersions(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList agentPoolVersions) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AgentPoolAvailableVersions(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList agentPoolVersions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { AgentPoolVersions = agentPoolVersions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of versions available for agent pool. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs index 7e4281049abc..adf3dbdcb6a4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolNetworkPortRange : IUtf8JsonSerializable + public partial class AgentPoolNetworkPortRange : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PortStart)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("protocol"u8); writer.WriteStringValue(Protocol.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgentPoolNetworkPortRange DeserializeAgentPoolNetworkPortRange(JsonElement element) + internal static AgentPoolNetworkPortRange DeserializeAgentPoolNetworkPortRange(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AgentPoolNetworkPortRange DeserializeAgentPoolNetworkPortRange(J Optional portStart = default; Optional portEnd = default; Optional protocol = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("portStart"u8)) @@ -71,8 +94,61 @@ internal static AgentPoolNetworkPortRange DeserializeAgentPoolNetworkPortRange(J protocol = new AgentPoolNetworkPortProtocol(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgentPoolNetworkPortRange(Optional.ToNullable(portStart), Optional.ToNullable(portEnd), Optional.ToNullable(protocol), serializedAdditionalRawData); + } + + AgentPoolNetworkPortRange IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolNetworkPortRange(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolNetworkPortRange IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolNetworkPortRange(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolNetworkPortRange model) + { + if (model is null) + { + return null; } - return new AgentPoolNetworkPortRange(Optional.ToNullable(portStart), Optional.ToNullable(portEnd), Optional.ToNullable(protocol)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolNetworkPortRange(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolNetworkPortRange(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs index 533c434f7ddb..79dff7971ebe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The port range. public partial class AgentPoolNetworkPortRange { - /// Initializes a new instance of AgentPoolNetworkPortRange. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgentPoolNetworkPortRange() { } - /// Initializes a new instance of AgentPoolNetworkPortRange. + /// Initializes a new instance of . /// The minimum port that is included in the range. It should be ranged from 1 to 65535, and be less than or equal to portEnd. /// The maximum port that is included in the range. It should be ranged from 1 to 65535, and be greater than or equal to portStart. /// The network protocol of the port. - internal AgentPoolNetworkPortRange(int? portStart, int? portEnd, AgentPoolNetworkPortProtocol? protocol) + /// Keeps track of any properties unknown to the library. + internal AgentPoolNetworkPortRange(int? portStart, int? portEnd, AgentPoolNetworkPortProtocol? protocol, Dictionary serializedAdditionalRawData) { PortStart = portStart; PortEnd = portEnd; Protocol = protocol; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The minimum port that is included in the range. It should be ranged from 1 to 65535, and be less than or equal to portEnd. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs index 3c0b57049e8b..c5973f0c922c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolNetworkProfile : IUtf8JsonSerializable + public partial class AgentPoolNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(NodePublicIPTags)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NodePublicIPTags) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AllowedHostPorts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -51,11 +72,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgentPoolNetworkProfile DeserializeAgentPoolNetworkProfile(JsonElement element) + internal static AgentPoolNetworkProfile DeserializeAgentPoolNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +98,7 @@ internal static AgentPoolNetworkProfile DeserializeAgentPoolNetworkProfile(JsonE Optional> nodePublicIPTags = default; Optional> allowedHostPorts = default; Optional> applicationSecurityGroups = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nodePublicIPTags"u8)) @@ -114,8 +150,61 @@ internal static AgentPoolNetworkProfile DeserializeAgentPoolNetworkProfile(JsonE applicationSecurityGroups = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgentPoolNetworkProfile(Optional.ToList(nodePublicIPTags), Optional.ToList(allowedHostPorts), Optional.ToList(applicationSecurityGroups), serializedAdditionalRawData); + } + + AgentPoolNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolNetworkProfile model) + { + if (model is null) + { + return null; } - return new AgentPoolNetworkProfile(Optional.ToList(nodePublicIPTags), Optional.ToList(allowedHostPorts), Optional.ToList(applicationSecurityGroups)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolNetworkProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs index 752c231db889..b993bc9ac210 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Network settings of an agent pool. public partial class AgentPoolNetworkProfile { - /// Initializes a new instance of AgentPoolNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgentPoolNetworkProfile() { NodePublicIPTags = new ChangeTrackingList(); @@ -21,15 +25,17 @@ public AgentPoolNetworkProfile() ApplicationSecurityGroups = new ChangeTrackingList(); } - /// Initializes a new instance of AgentPoolNetworkProfile. + /// Initializes a new instance of . /// IPTags of instance-level public IPs. /// The port ranges that are allowed to access. The specified ranges are allowed to overlap. /// The IDs of the application security groups which agent pool will associate when created. - internal AgentPoolNetworkProfile(IList nodePublicIPTags, IList allowedHostPorts, IList applicationSecurityGroups) + /// Keeps track of any properties unknown to the library. + internal AgentPoolNetworkProfile(IList nodePublicIPTags, IList allowedHostPorts, IList applicationSecurityGroups, Dictionary serializedAdditionalRawData) { NodePublicIPTags = nodePublicIPTags; AllowedHostPorts = allowedHostPorts; ApplicationSecurityGroups = applicationSecurityGroups; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// IPTags of instance-level public IPs. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotData.Serialization.cs index 43bdd88b350b..958f0cf517f2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class AgentPoolSnapshotData : IUtf8JsonSerializable + public partial class AgentPoolSnapshotData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(SnapshotType)) { @@ -44,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SnapshotType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgentPoolSnapshotData DeserializeAgentPoolSnapshotData(JsonElement element) + internal static AgentPoolSnapshotData DeserializeAgentPoolSnapshotData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +95,7 @@ internal static AgentPoolSnapshotData DeserializeAgentPoolSnapshotData(JsonEleme Optional osSku = default; Optional vmSize = default; Optional enableFIPS = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -184,8 +213,61 @@ internal static AgentPoolSnapshotData DeserializeAgentPoolSnapshotData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgentPoolSnapshotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, creationData.Value, Optional.ToNullable(snapshotType), kubernetesVersion.Value, nodeImageVersion.Value, Optional.ToNullable(osType), Optional.ToNullable(osSku), vmSize.Value, Optional.ToNullable(enableFIPS), serializedAdditionalRawData); + } + + AgentPoolSnapshotData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolSnapshotData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolSnapshotData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolSnapshotData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolSnapshotData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolSnapshotData(Response response) + { + if (response is null) + { + return null; } - return new AgentPoolSnapshotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, creationData.Value, Optional.ToNullable(snapshotType), kubernetesVersion.Value, nodeImageVersion.Value, Optional.ToNullable(osType), Optional.ToNullable(osSku), vmSize.Value, Optional.ToNullable(enableFIPS)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolSnapshotData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs index 6f3e6ab6bb09..e136fe3af992 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class AgentPoolSnapshotListResult + internal partial class AgentPoolSnapshotListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentPoolSnapshotListResult DeserializeAgentPoolSnapshotListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentPoolSnapshotListResult DeserializeAgentPoolSnapshotListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static AgentPoolSnapshotListResult DeserializeAgentPoolSnapshotListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentPoolSnapshotListResult(Optional.ToList(value), nextLink.Value); + return new AgentPoolSnapshotListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AgentPoolSnapshotListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolSnapshotListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolSnapshotListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolSnapshotListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolSnapshotListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolSnapshotListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolSnapshotListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.cs index c55afdb62086..8c0c055c5587 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List Snapshots operation. internal partial class AgentPoolSnapshotListResult { - /// Initializes a new instance of AgentPoolSnapshotListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgentPoolSnapshotListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AgentPoolSnapshotListResult. + /// Initializes a new instance of . /// The list of snapshots. /// The URL to get the next set of snapshot results. - internal AgentPoolSnapshotListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AgentPoolSnapshotListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of snapshots. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfileData.Serialization.cs index 14634db5bcf3..3546493d955d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfileData.Serialization.cs @@ -5,18 +5,74 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class AgentPoolUpgradeProfileData + public partial class AgentPoolUpgradeProfileData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.ToString()); + if (Optional.IsCollectionDefined(Upgrades)) + { + writer.WritePropertyName("upgrades"u8); + writer.WriteStartArray(); + foreach (var item in Upgrades) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LatestNodeImageVersion)) + { + writer.WritePropertyName("latestNodeImageVersion"u8); + writer.WriteStringValue(LatestNodeImageVersion); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +85,7 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa ContainerServiceOSType osType = default; Optional> upgrades = default; Optional latestNodeImageVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -96,8 +153,61 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentPoolUpgradeProfileData(id, name, type, systemData.Value, kubernetesVersion, osType, Optional.ToList(upgrades), latestNodeImageVersion.Value); + return new AgentPoolUpgradeProfileData(id, name, type, systemData.Value, kubernetesVersion, osType, Optional.ToList(upgrades), latestNodeImageVersion.Value, serializedAdditionalRawData); + } + + AgentPoolUpgradeProfileData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolUpgradeProfileData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolUpgradeProfileData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolUpgradeProfileData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolUpgradeProfileData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolUpgradeProfileData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolUpgradeProfileData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs index d6c849c6c78d..7a896390519c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem + public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AgentPoolUpgradeProfilePropertiesUpgradesItem DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (Optional.IsDefined(IsPreview)) + { + writer.WritePropertyName("isPreview"u8); + writer.WriteBooleanValue(IsPreview.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AgentPoolUpgradeProfilePropertiesUpgradesItem DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional kubernetesVersion = default; Optional isPreview = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kubernetesVersion"u8)) @@ -36,8 +75,61 @@ internal static AgentPoolUpgradeProfilePropertiesUpgradesItem DeserializeAgentPo isPreview = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion.Value, Optional.ToNullable(isPreview)); + return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion.Value, Optional.ToNullable(isPreview), serializedAdditionalRawData); + } + + AgentPoolUpgradeProfilePropertiesUpgradesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolUpgradeProfilePropertiesUpgradesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolUpgradeProfilePropertiesUpgradesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolUpgradeProfilePropertiesUpgradesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs index 9abc79b5bd3d..96852bfc7159 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The AgentPoolUpgradeProfilePropertiesUpgradesItem. public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem { - /// Initializes a new instance of AgentPoolUpgradeProfilePropertiesUpgradesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AgentPoolUpgradeProfilePropertiesUpgradesItem() { } - /// Initializes a new instance of AgentPoolUpgradeProfilePropertiesUpgradesItem. + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. - internal AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, bool? isPreview) + /// Keeps track of any properties unknown to the library. + internal AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, bool? isPreview, Dictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; IsPreview = isPreview; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Kubernetes version (major.minor.patch). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs index 133412603104..4da9c7e15d59 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class AgentPoolUpgradeSettings : IUtf8JsonSerializable + internal partial class AgentPoolUpgradeSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaxSurge)) { writer.WritePropertyName("maxSurge"u8); writer.WriteStringValue(MaxSurge); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(JsonElement element) + internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional maxSurge = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("maxSurge"u8)) @@ -37,8 +60,61 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso maxSurge = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgentPoolUpgradeSettings(maxSurge.Value, serializedAdditionalRawData); + } + + AgentPoolUpgradeSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolUpgradeSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolUpgradeSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolUpgradeSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolUpgradeSettings model) + { + if (model is null) + { + return null; } - return new AgentPoolUpgradeSettings(maxSurge.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolUpgradeSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolUpgradeSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs index cffe9c0943c2..1496284f89c3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Settings for upgrading an agentpool. internal partial class AgentPoolUpgradeSettings { - /// Initializes a new instance of AgentPoolUpgradeSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgentPoolUpgradeSettings() { } - /// Initializes a new instance of AgentPoolUpgradeSettings. + /// Initializes a new instance of . /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. - internal AgentPoolUpgradeSettings(string maxSurge) + /// Keeps track of any properties unknown to the library. + internal AgentPoolUpgradeSettings(string maxSurge, Dictionary serializedAdditionalRawData) { MaxSurge = maxSurge; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs index 5d78eeb771bd..d5222952a5fa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class AgentPoolWindowsProfile : IUtf8JsonSerializable + internal partial class AgentPoolWindowsProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DisableOutboundNat)) { writer.WritePropertyName("disableOutboundNat"u8); writer.WriteBooleanValue(DisableOutboundNat.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AgentPoolWindowsProfile DeserializeAgentPoolWindowsProfile(JsonElement element) + internal static AgentPoolWindowsProfile DeserializeAgentPoolWindowsProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional disableOutboundNat = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("disableOutboundNat"u8)) @@ -41,8 +64,61 @@ internal static AgentPoolWindowsProfile DeserializeAgentPoolWindowsProfile(JsonE disableOutboundNat = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AgentPoolWindowsProfile(Optional.ToNullable(disableOutboundNat), serializedAdditionalRawData); + } + + AgentPoolWindowsProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAgentPoolWindowsProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AgentPoolWindowsProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAgentPoolWindowsProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AgentPoolWindowsProfile model) + { + if (model is null) + { + return null; } - return new AgentPoolWindowsProfile(Optional.ToNullable(disableOutboundNat)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AgentPoolWindowsProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAgentPoolWindowsProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs index 0f7f1df47e7c..4e133a5552da 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The Windows agent pool's specific profile. internal partial class AgentPoolWindowsProfile { - /// Initializes a new instance of AgentPoolWindowsProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AgentPoolWindowsProfile() { } - /// Initializes a new instance of AgentPoolWindowsProfile. + /// Initializes a new instance of . /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. - internal AgentPoolWindowsProfile(bool? disableOutboundNat) + /// Keeps track of any properties unknown to the library. + internal AgentPoolWindowsProfile(bool? disableOutboundNat, Dictionary serializedAdditionalRawData) { DisableOutboundNat = disableOutboundNat; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows agent pool does not have node public IP enabled. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolData.Serialization.cs index b2b5caa1785b..6946d8aeb6f2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServiceAgentPoolData : IUtf8JsonSerializable + public partial class ContainerServiceAgentPoolData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -118,12 +125,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UpgradeSettings)) { writer.WritePropertyName("upgradeSettings"u8); - writer.WriteObjectValue(UpgradeSettings); + if (UpgradeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpgradeSettings).Serialize(writer, options); + } } if (Optional.IsDefined(PowerState)) { writer.WritePropertyName("powerState"u8); - writer.WriteObjectValue(PowerState); + if (PowerState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PowerState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AvailabilityZones)) { @@ -205,12 +226,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KubeletConfig)) { writer.WritePropertyName("kubeletConfig"u8); - writer.WriteObjectValue(KubeletConfig); + if (KubeletConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubeletConfig).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxOSConfig)) { writer.WritePropertyName("linuxOSConfig"u8); - writer.WriteObjectValue(LinuxOSConfig); + if (LinuxOSConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxOSConfig).Serialize(writer, options); + } } if (Optional.IsDefined(EnableEncryptionAtHost)) { @@ -235,7 +270,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(CapacityReservationGroupId)) { @@ -250,19 +292,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsProfile)) { writer.WritePropertyName("windowsProfile"u8); - writer.WriteObjectValue(WindowsProfile); + if (WindowsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPoolData(JsonElement element) + internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPoolData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -317,6 +387,7 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo Optional hostGroupId = default; Optional windowsProfile = default; Optional networkProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -765,8 +836,61 @@ internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceAgentPoolData(id, name, type, systemData.Value, Optional.ToNullable(count), vmSize.Value, Optional.ToNullable(osDiskSizeGB), Optional.ToNullable(osDiskType), Optional.ToNullable(kubeletDiskType), Optional.ToNullable(workloadRuntime), messageOfTheDay.Value, vnetSubnetId.Value, podSubnetId.Value, Optional.ToNullable(maxPods), Optional.ToNullable(osType), Optional.ToNullable(osSku), Optional.ToNullable(maxCount), Optional.ToNullable(minCount), Optional.ToNullable(enableAutoScaling), Optional.ToNullable(scaleDownMode), Optional.ToNullable(type0), Optional.ToNullable(mode), orchestratorVersion.Value, currentOrchestratorVersion.Value, nodeImageVersion.Value, upgradeSettings.Value, provisioningState.Value, powerState.Value, Optional.ToList(availabilityZones), Optional.ToNullable(enableNodePublicIP), Optional.ToNullable(enableCustomCATrust), nodePublicIPPrefixId.Value, Optional.ToNullable(scaleSetPriority), Optional.ToNullable(scaleSetEvictionPolicy), Optional.ToNullable(spotMaxPrice), Optional.ToDictionary(tags), Optional.ToDictionary(nodeLabels), Optional.ToList(nodeTaints), proximityPlacementGroupId.Value, kubeletConfig.Value, linuxOSConfig.Value, Optional.ToNullable(enableEncryptionAtHost), Optional.ToNullable(enableUltraSsd), Optional.ToNullable(enableFIPS), Optional.ToNullable(gpuInstanceProfile), creationData.Value, capacityReservationGroupId.Value, hostGroupId.Value, windowsProfile.Value, networkProfile.Value, serializedAdditionalRawData); + } + + ContainerServiceAgentPoolData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceAgentPoolData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceAgentPoolData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceAgentPoolData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceAgentPoolData model) + { + if (model is null) + { + return null; } - return new ContainerServiceAgentPoolData(id, name, type, systemData.Value, Optional.ToNullable(count), vmSize.Value, Optional.ToNullable(osDiskSizeGB), Optional.ToNullable(osDiskType), Optional.ToNullable(kubeletDiskType), Optional.ToNullable(workloadRuntime), messageOfTheDay.Value, vnetSubnetId.Value, podSubnetId.Value, Optional.ToNullable(maxPods), Optional.ToNullable(osType), Optional.ToNullable(osSku), Optional.ToNullable(maxCount), Optional.ToNullable(minCount), Optional.ToNullable(enableAutoScaling), Optional.ToNullable(scaleDownMode), Optional.ToNullable(type0), Optional.ToNullable(mode), orchestratorVersion.Value, currentOrchestratorVersion.Value, nodeImageVersion.Value, upgradeSettings.Value, provisioningState.Value, powerState.Value, Optional.ToList(availabilityZones), Optional.ToNullable(enableNodePublicIP), Optional.ToNullable(enableCustomCATrust), nodePublicIPPrefixId.Value, Optional.ToNullable(scaleSetPriority), Optional.ToNullable(scaleSetEvictionPolicy), Optional.ToNullable(spotMaxPrice), Optional.ToDictionary(tags), Optional.ToDictionary(nodeLabels), Optional.ToList(nodeTaints), proximityPlacementGroupId.Value, kubeletConfig.Value, linuxOSConfig.Value, Optional.ToNullable(enableEncryptionAtHost), Optional.ToNullable(enableUltraSsd), Optional.ToNullable(enableFIPS), Optional.ToNullable(gpuInstanceProfile), creationData.Value, capacityReservationGroupId.Value, hostGroupId.Value, windowsProfile.Value, networkProfile.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceAgentPoolData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceAgentPoolData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs index b4270f36a5a2..0eef36724914 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ContainerServiceAgentPoolListResult + internal partial class ContainerServiceAgentPoolListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceAgentPoolListResult DeserializeContainerServiceAgentPoolListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceAgentPoolListResult DeserializeContainerServiceAgentPoolListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ContainerServiceAgentPoolListResult DeserializeContainerServiceA nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceAgentPoolListResult(Optional.ToList(value), nextLink.Value); + return new ContainerServiceAgentPoolListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerServiceAgentPoolListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceAgentPoolListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceAgentPoolListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceAgentPoolListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceAgentPoolListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceAgentPoolListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceAgentPoolListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs index 8bcd684c1fd7..5de68aac32aa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List Agent Pools operation. internal partial class ContainerServiceAgentPoolListResult { - /// Initializes a new instance of ContainerServiceAgentPoolListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceAgentPoolListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceAgentPoolListResult. + /// Initializes a new instance of . /// The list of agent pools. /// The URL to get the next set of agent pool results. - internal ContainerServiceAgentPoolListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceAgentPoolListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of agent pools. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs index 15a0b4a8b761..aed270fa4449 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ContainerServiceCreationData : IUtf8JsonSerializable + internal partial class ContainerServiceCreationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceResourceId)) { writer.WritePropertyName("sourceResourceId"u8); writer.WriteStringValue(SourceResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceCreationData DeserializeContainerServiceCreationData(JsonElement element) + internal static ContainerServiceCreationData DeserializeContainerServiceCreationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional sourceResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceResourceId"u8)) @@ -41,8 +64,61 @@ internal static ContainerServiceCreationData DeserializeContainerServiceCreation sourceResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceCreationData(sourceResourceId.Value, serializedAdditionalRawData); + } + + ContainerServiceCreationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceCreationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceCreationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceCreationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceCreationData model) + { + if (model is null) + { + return null; } - return new ContainerServiceCreationData(sourceResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceCreationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceCreationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs index 16c629314844..73aba4c2c8b5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.ContainerService.Models /// Data used when creating a target resource from a source resource. internal partial class ContainerServiceCreationData { - /// Initializes a new instance of ContainerServiceCreationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceCreationData() { } - /// Initializes a new instance of ContainerServiceCreationData. + /// Initializes a new instance of . /// This is the ARM ID of the source object to be used to create the target object. - internal ContainerServiceCreationData(ResourceIdentifier sourceResourceId) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceCreationData(ResourceIdentifier sourceResourceId, Dictionary serializedAdditionalRawData) { SourceResourceId = sourceResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// This is the ARM ID of the source object to be used to create the target object. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs index 228b8728dcd1..0bbaf28f24d7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceDateSpan : IUtf8JsonSerializable + public partial class ContainerServiceDateSpan : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("start"u8); writer.WriteStringValue(Start, "D"); writer.WritePropertyName("end"u8); writer.WriteStringValue(End, "D"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceDateSpan DeserializeContainerServiceDateSpan(JsonElement element) + internal static ContainerServiceDateSpan DeserializeContainerServiceDateSpan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset start = default; DateTimeOffset end = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("start"u8)) @@ -43,8 +65,61 @@ internal static ContainerServiceDateSpan DeserializeContainerServiceDateSpan(Jso end = property.Value.GetDateTimeOffset("D"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceDateSpan(start, end, serializedAdditionalRawData); + } + + ContainerServiceDateSpan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceDateSpan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceDateSpan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceDateSpan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceDateSpan model) + { + if (model is null) + { + return null; } - return new ContainerServiceDateSpan(start, end); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceDateSpan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceDateSpan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs index 2f11c6419671..00d3b7c3e630 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerService.Models { /// For example, between '2022-12-23' and '2023-01-05'. public partial class ContainerServiceDateSpan { - /// Initializes a new instance of ContainerServiceDateSpan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date of the date span. /// The end date of the date span. public ContainerServiceDateSpan(DateTimeOffset start, DateTimeOffset end) @@ -21,6 +25,22 @@ public ContainerServiceDateSpan(DateTimeOffset start, DateTimeOffset end) End = end; } + /// Initializes a new instance of . + /// The start date of the date span. + /// The end date of the date span. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceDateSpan(DateTimeOffset start, DateTimeOffset end, Dictionary serializedAdditionalRawData) + { + Start = start; + End = end; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceDateSpan() + { + } + /// The start date of the date span. public DateTimeOffset Start { get; set; } /// The end date of the date span. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs index c85f2c272f1b..3de77ae4bfbe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceEndpointDependency + public partial class ContainerServiceEndpointDependency : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceEndpointDependency DeserializeContainerServiceEndpointDependency(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DomainName)) + { + writer.WritePropertyName("domainName"u8); + writer.WriteStringValue(DomainName); + } + if (Optional.IsCollectionDefined(EndpointDetails)) + { + writer.WritePropertyName("endpointDetails"u8); + writer.WriteStartArray(); + foreach (var item in EndpointDetails) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceEndpointDependency DeserializeContainerServiceEndpointDependency(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional domainName = default; Optional> endpointDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainName"u8)) @@ -42,8 +92,61 @@ internal static ContainerServiceEndpointDependency DeserializeContainerServiceEn endpointDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceEndpointDependency(domainName.Value, Optional.ToList(endpointDetails)); + return new ContainerServiceEndpointDependency(domainName.Value, Optional.ToList(endpointDetails), serializedAdditionalRawData); + } + + ContainerServiceEndpointDependency IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceEndpointDependency(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceEndpointDependency IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceEndpointDependency(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceEndpointDependency model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceEndpointDependency(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceEndpointDependency(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs index a5ac237d2e86..c8af76d73adf 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// A domain name that AKS agent nodes are reaching at. public partial class ContainerServiceEndpointDependency { - /// Initializes a new instance of ContainerServiceEndpointDependency. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceEndpointDependency() { EndpointDetails = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceEndpointDependency. + /// Initializes a new instance of . /// The domain name of the dependency. /// The Ports and Protocols used when connecting to domainName. - internal ContainerServiceEndpointDependency(string domainName, IReadOnlyList endpointDetails) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceEndpointDependency(string domainName, IReadOnlyList endpointDetails, Dictionary serializedAdditionalRawData) { DomainName = domainName; EndpointDetails = endpointDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The domain name of the dependency. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.Serialization.cs index b8ea111ba394..ffbeaf1be7b4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.Serialization.cs @@ -5,16 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceEndpointDetail + public partial class ContainerServiceEndpointDetail : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpointDetail(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IPAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IPAddress.ToString()); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpointDetail(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +71,7 @@ internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpoi Optional port = default; Optional protocol = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipAddress"u8)) @@ -53,8 +102,61 @@ internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpoi description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceEndpointDetail(ipAddress.Value, Optional.ToNullable(port), protocol.Value, description.Value); + return new ContainerServiceEndpointDetail(ipAddress.Value, Optional.ToNullable(port), protocol.Value, description.Value, serializedAdditionalRawData); + } + + ContainerServiceEndpointDetail IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceEndpointDetail(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceEndpointDetail IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceEndpointDetail(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceEndpointDetail model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceEndpointDetail(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceEndpointDetail(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs index dc769e615ec0..6774ab2d6902 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Net; namespace Azure.ResourceManager.ContainerService.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.ContainerService.Models /// connect information from the AKS agent nodes to a single endpoint. public partial class ContainerServiceEndpointDetail { - /// Initializes a new instance of ContainerServiceEndpointDetail. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceEndpointDetail() { } - /// Initializes a new instance of ContainerServiceEndpointDetail. + /// Initializes a new instance of . /// An IP Address that Domain Name currently resolves to. /// The port an endpoint is connected to. /// The protocol used for connection. /// Description of the detail. - internal ContainerServiceEndpointDetail(IPAddress ipAddress, int? port, string protocol, string description) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceEndpointDetail(IPAddress ipAddress, int? port, string protocol, string description, Dictionary serializedAdditionalRawData) { IPAddress = ipAddress; Port = port; Protocol = protocol; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An IP Address that Domain Name currently resolves to. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.Serialization.cs index 8ca64cd35234..30a3fee6659d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceFleetCredentialResult + public partial class ContainerServiceFleetCredentialResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceFleetCredentialResult DeserializeContainerServiceFleetCredentialResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceFleetCredentialResult DeserializeContainerServiceFleetCredentialResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +65,61 @@ internal static ContainerServiceFleetCredentialResult DeserializeContainerServic value = property.Value.GetBytesFromBase64("D"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceFleetCredentialResult(name.Value, value.Value); + return new ContainerServiceFleetCredentialResult(name.Value, value.Value, serializedAdditionalRawData); + } + + ContainerServiceFleetCredentialResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceFleetCredentialResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceFleetCredentialResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceFleetCredentialResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceFleetCredentialResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceFleetCredentialResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceFleetCredentialResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.cs index e7209ec8e068..5ce1966b9d19 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerService.Models { /// The credential result response. public partial class ContainerServiceFleetCredentialResult { - /// Initializes a new instance of ContainerServiceFleetCredentialResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceFleetCredentialResult() { } - /// Initializes a new instance of ContainerServiceFleetCredentialResult. + /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. - internal ContainerServiceFleetCredentialResult(string name, byte[] value) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceFleetCredentialResult(string name, byte[] value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the credential. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.Serialization.cs index e19a32475d77..26dbb2343615 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceFleetCredentialResults + public partial class ContainerServiceFleetCredentialResults : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceFleetCredentialResults DeserializeContainerServiceFleetCredentialResults(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceFleetCredentialResults DeserializeContainerServiceFleetCredentialResults(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> kubeconfigs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kubeconfigs"u8)) @@ -36,8 +64,61 @@ internal static ContainerServiceFleetCredentialResults DeserializeContainerServi kubeconfigs = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceFleetCredentialResults(Optional.ToList(kubeconfigs)); + return new ContainerServiceFleetCredentialResults(Optional.ToList(kubeconfigs), serializedAdditionalRawData); + } + + ContainerServiceFleetCredentialResults IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceFleetCredentialResults(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceFleetCredentialResults IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceFleetCredentialResults(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceFleetCredentialResults model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceFleetCredentialResults(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceFleetCredentialResults(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.cs index 1795137827a3..22c813730253 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetCredentialResults.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ContainerService.Models /// The list credential result response. public partial class ContainerServiceFleetCredentialResults { - /// Initializes a new instance of ContainerServiceFleetCredentialResults. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceFleetCredentialResults() { Kubeconfigs = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceFleetCredentialResults. + /// Initializes a new instance of . /// Base64-encoded Kubernetes configuration file. - internal ContainerServiceFleetCredentialResults(IReadOnlyList kubeconfigs) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceFleetCredentialResults(IReadOnlyList kubeconfigs, Dictionary serializedAdditionalRawData) { Kubeconfigs = kubeconfigs; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Base64-encoded Kubernetes configuration file. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetData.Serialization.cs index 2578c55996e8..647d2b4fd8f5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetData.Serialization.cs @@ -5,19 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServiceFleetData : IUtf8JsonSerializable + public partial class ContainerServiceFleetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -37,14 +43,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HubProfile)) { writer.WritePropertyName("hubProfile"u8); - writer.WriteObjectValue(HubProfile); + if (HubProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HubProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceFleetData DeserializeContainerServiceFleetData(JsonElement element) + internal static ContainerServiceFleetData DeserializeContainerServiceFleetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +85,7 @@ internal static ContainerServiceFleetData DeserializeContainerServiceFleetData(J Optional systemData = default; Optional hubProfile = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -142,8 +170,61 @@ internal static ContainerServiceFleetData DeserializeContainerServiceFleetData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceFleetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), hubProfile.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ContainerServiceFleetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceFleetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceFleetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceFleetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceFleetData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceFleetData(Response response) + { + if (response is null) + { + return null; } - return new ContainerServiceFleetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), hubProfile.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceFleetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.Serialization.cs index 4ac2350a0d5a..8a7c2a73bd5d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.Serialization.cs @@ -5,26 +5,48 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceFleetHubProfile : IUtf8JsonSerializable + public partial class ContainerServiceFleetHubProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DnsPrefix)) { writer.WritePropertyName("dnsPrefix"u8); writer.WriteStringValue(DnsPrefix); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceFleetHubProfile DeserializeContainerServiceFleetHubProfile(JsonElement element) + internal static ContainerServiceFleetHubProfile DeserializeContainerServiceFleetHubProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +54,7 @@ internal static ContainerServiceFleetHubProfile DeserializeContainerServiceFleet Optional dnsPrefix = default; Optional fqdn = default; Optional kubernetesVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dnsPrefix"u8)) @@ -49,8 +72,61 @@ internal static ContainerServiceFleetHubProfile DeserializeContainerServiceFleet kubernetesVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceFleetHubProfile(dnsPrefix.Value, fqdn.Value, kubernetesVersion.Value, serializedAdditionalRawData); + } + + ContainerServiceFleetHubProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceFleetHubProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceFleetHubProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceFleetHubProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceFleetHubProfile model) + { + if (model is null) + { + return null; } - return new ContainerServiceFleetHubProfile(dnsPrefix.Value, fqdn.Value, kubernetesVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceFleetHubProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceFleetHubProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.cs index c4f53a7ab183..8c5d63f9fa7c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetHubProfile.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The FleetHubProfile configures the fleet hub. public partial class ContainerServiceFleetHubProfile { - /// Initializes a new instance of ContainerServiceFleetHubProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceFleetHubProfile() { } - /// Initializes a new instance of ContainerServiceFleetHubProfile. + /// Initializes a new instance of . /// DNS prefix used to create the FQDN for the Fleet hub. /// The FQDN of the Fleet hub. /// The Kubernetes version of the Fleet hub. - internal ContainerServiceFleetHubProfile(string dnsPrefix, string fqdn, string kubernetesVersion) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceFleetHubProfile(string dnsPrefix, string fqdn, string kubernetesVersion, Dictionary serializedAdditionalRawData) { DnsPrefix = dnsPrefix; Fqdn = fqdn; KubernetesVersion = kubernetesVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// DNS prefix used to create the FQDN for the Fleet hub. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetMemberData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetMemberData.Serialization.cs index 93b769b25e80..5de3f9474e67 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetMemberData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetMemberData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServiceFleetMemberData : IUtf8JsonSerializable + public partial class ContainerServiceFleetMemberData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ClusterResourceId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceFleetMemberData DeserializeContainerServiceFleetMemberData(JsonElement element) + internal static ContainerServiceFleetMemberData DeserializeContainerServiceFleetMemberData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +63,7 @@ internal static ContainerServiceFleetMemberData DeserializeContainerServiceFleet Optional systemData = default; Optional clusterResourceId = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -107,8 +129,61 @@ internal static ContainerServiceFleetMemberData DeserializeContainerServiceFleet } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceFleetMemberData(id, name, type, systemData.Value, clusterResourceId.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ContainerServiceFleetMemberData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceFleetMemberData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceFleetMemberData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceFleetMemberData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceFleetMemberData model) + { + if (model is null) + { + return null; } - return new ContainerServiceFleetMemberData(id, name, type, systemData.Value, clusterResourceId.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceFleetMemberData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceFleetMemberData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.Serialization.cs index 6086adb8f5cf..65e04c2d2ad6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceFleetPatch : IUtf8JsonSerializable + public partial class ContainerServiceFleetPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerServiceFleetPatch DeserializeContainerServiceFleetPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceFleetPatch(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ContainerServiceFleetPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceFleetPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceFleetPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceFleetPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceFleetPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceFleetPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceFleetPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.cs index 60c76f1b6cf1..51c1f66c87d7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceFleetPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// Properties of a Fleet that can be patched. public partial class ContainerServiceFleetPatch { - /// Initializes a new instance of ContainerServiceFleetPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceFleetPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceFleetPatch(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs index 95af38ccb8f1..ff82ad121e55 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceIPTag : IUtf8JsonSerializable + public partial class ContainerServiceIPTag : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IPTagType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tag"u8); writer.WriteStringValue(Tag); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceIPTag DeserializeContainerServiceIPTag(JsonElement element) + internal static ContainerServiceIPTag DeserializeContainerServiceIPTag(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ipTagType = default; Optional tag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipTagType"u8)) @@ -48,8 +71,61 @@ internal static ContainerServiceIPTag DeserializeContainerServiceIPTag(JsonEleme tag = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceIPTag(ipTagType.Value, tag.Value, serializedAdditionalRawData); + } + + ContainerServiceIPTag IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceIPTag(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceIPTag IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceIPTag(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceIPTag model) + { + if (model is null) + { + return null; } - return new ContainerServiceIPTag(ipTagType.Value, tag.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceIPTag(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceIPTag(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs index 8e0d46a29a9c..a9910e6cb937 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Contains the IPTag associated with the object. public partial class ContainerServiceIPTag { - /// Initializes a new instance of ContainerServiceIPTag. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceIPTag() { } - /// Initializes a new instance of ContainerServiceIPTag. + /// Initializes a new instance of . /// The IP tag type. Example: RoutingPreference. /// The value of the IP tag associated with the public IP. Example: Internet. - internal ContainerServiceIPTag(string ipTagType, string tag) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceIPTag(string ipTagType, string tag, Dictionary serializedAdditionalRawData) { IPTagType = ipTagType; Tag = tag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The IP tag type. Example: RoutingPreference. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs index 3413a7d36f4a..d8ddef686778 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceLinuxProfile : IUtf8JsonSerializable + public partial class ContainerServiceLinuxProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("adminUsername"u8); writer.WriteStringValue(AdminUsername); writer.WritePropertyName("ssh"u8); - writer.WriteObjectValue(Ssh); + if (Ssh is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Ssh).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceLinuxProfile DeserializeContainerServiceLinuxProfile(JsonElement element) + internal static ContainerServiceLinuxProfile DeserializeContainerServiceLinuxProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string adminUsername = default; ContainerServiceSshConfiguration ssh = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("adminUsername"u8)) @@ -42,8 +72,61 @@ internal static ContainerServiceLinuxProfile DeserializeContainerServiceLinuxPro ssh = ContainerServiceSshConfiguration.DeserializeContainerServiceSshConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceLinuxProfile(adminUsername, ssh, serializedAdditionalRawData); + } + + ContainerServiceLinuxProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceLinuxProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceLinuxProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceLinuxProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceLinuxProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceLinuxProfile(Response response) + { + if (response is null) + { + return null; } - return new ContainerServiceLinuxProfile(adminUsername, ssh); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceLinuxProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs index e79a81b5233c..978ae424e10f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Profile for Linux VMs in the container service cluster. public partial class ContainerServiceLinuxProfile { - /// Initializes a new instance of ContainerServiceLinuxProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The administrator username to use for Linux VMs. /// The SSH configuration for Linux-based VMs running on Azure. /// or is null. @@ -27,6 +30,22 @@ public ContainerServiceLinuxProfile(string adminUsername, ContainerServiceSshCon Ssh = ssh; } + /// Initializes a new instance of . + /// The administrator username to use for Linux VMs. + /// The SSH configuration for Linux-based VMs running on Azure. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceLinuxProfile(string adminUsername, ContainerServiceSshConfiguration ssh, Dictionary serializedAdditionalRawData) + { + AdminUsername = adminUsername; + Ssh = ssh; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceLinuxProfile() + { + } + /// The administrator username to use for Linux VMs. public string AdminUsername { get; set; } /// The SSH configuration for Linux-based VMs running on Azure. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs index f759d46b7292..709c1795d002 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceMaintenanceAbsoluteMonthlySchedule : IUtf8JsonSerializable + public partial class ContainerServiceMaintenanceAbsoluteMonthlySchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("intervalMonths"u8); writer.WriteNumberValue(IntervalMonths); writer.WritePropertyName("dayOfMonth"u8); writer.WriteNumberValue(DayOfMonth); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceMaintenanceAbsoluteMonthlySchedule DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(JsonElement element) + internal static ContainerServiceMaintenanceAbsoluteMonthlySchedule DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int intervalMonths = default; int dayOfMonth = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("intervalMonths"u8)) @@ -42,8 +65,61 @@ internal static ContainerServiceMaintenanceAbsoluteMonthlySchedule DeserializeCo dayOfMonth = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceMaintenanceAbsoluteMonthlySchedule(intervalMonths, dayOfMonth, serializedAdditionalRawData); + } + + ContainerServiceMaintenanceAbsoluteMonthlySchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceAbsoluteMonthlySchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceAbsoluteMonthlySchedule model) + { + if (model is null) + { + return null; } - return new ContainerServiceMaintenanceAbsoluteMonthlySchedule(intervalMonths, dayOfMonth); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceAbsoluteMonthlySchedule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs index 41b08d63831b..df41a63d9e77 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. public partial class ContainerServiceMaintenanceAbsoluteMonthlySchedule { - /// Initializes a new instance of ContainerServiceMaintenanceAbsoluteMonthlySchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the number of months between each set of occurrences. /// The date of the month. public ContainerServiceMaintenanceAbsoluteMonthlySchedule(int intervalMonths, int dayOfMonth) @@ -19,6 +25,22 @@ public ContainerServiceMaintenanceAbsoluteMonthlySchedule(int intervalMonths, in DayOfMonth = dayOfMonth; } + /// Initializes a new instance of . + /// Specifies the number of months between each set of occurrences. + /// The date of the month. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceAbsoluteMonthlySchedule(int intervalMonths, int dayOfMonth, Dictionary serializedAdditionalRawData) + { + IntervalMonths = intervalMonths; + DayOfMonth = dayOfMonth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceMaintenanceAbsoluteMonthlySchedule() + { + } + /// Specifies the number of months between each set of occurrences. public int IntervalMonths { get; set; } /// The date of the month. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationData.Serialization.cs index cdc6b2504e51..6f45bfc0aaaa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServiceMaintenanceConfigurationData : IUtf8JsonSerializable + public partial class ContainerServiceMaintenanceConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -26,7 +33,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TimesInWeek) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -36,21 +50,49 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NotAllowedTimes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(MaintenanceWindow)) { writer.WritePropertyName("maintenanceWindow"u8); - writer.WriteObjectValue(MaintenanceWindow); + if (MaintenanceWindow is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaintenanceWindow).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceMaintenanceConfigurationData DeserializeContainerServiceMaintenanceConfigurationData(JsonElement element) + internal static ContainerServiceMaintenanceConfigurationData DeserializeContainerServiceMaintenanceConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +104,7 @@ internal static ContainerServiceMaintenanceConfigurationData DeserializeContaine Optional> timeInWeek = default; Optional> notAllowedTime = default; Optional maintenanceWindow = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -137,8 +180,61 @@ internal static ContainerServiceMaintenanceConfigurationData DeserializeContaine } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceMaintenanceConfigurationData(id, name, type, systemData.Value, Optional.ToList(timeInWeek), Optional.ToList(notAllowedTime), maintenanceWindow.Value, serializedAdditionalRawData); + } + + ContainerServiceMaintenanceConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceConfigurationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceConfigurationData(Response response) + { + if (response is null) + { + return null; } - return new ContainerServiceMaintenanceConfigurationData(id, name, type, systemData.Value, Optional.ToList(timeInWeek), Optional.ToList(notAllowedTime), maintenanceWindow.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs index e6be698f1e05..cf5a1d1bfb47 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ContainerServiceMaintenanceConfigurationListResult + internal partial class ContainerServiceMaintenanceConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceMaintenanceConfigurationListResult DeserializeContainerServiceMaintenanceConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceMaintenanceConfigurationListResult DeserializeContainerServiceMaintenanceConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ContainerServiceMaintenanceConfigurationListResult DeserializeCo nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceMaintenanceConfigurationListResult(Optional.ToList(value), nextLink.Value); + return new ContainerServiceMaintenanceConfigurationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerServiceMaintenanceConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs index 35b54065fc83..7807907d9ce7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List maintenance configurations operation. internal partial class ContainerServiceMaintenanceConfigurationListResult { - /// Initializes a new instance of ContainerServiceMaintenanceConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceMaintenanceConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceMaintenanceConfigurationListResult. + /// Initializes a new instance of . /// The list of maintenance configurations. /// The URL to get the next set of maintenance configuration results. - internal ContainerServiceMaintenanceConfigurationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceConfigurationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of maintenance configurations. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs index 817ec8149013..1714d49fd0e1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceMaintenanceRelativeMonthlySchedule : IUtf8JsonSerializable + public partial class ContainerServiceMaintenanceRelativeMonthlySchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("intervalMonths"u8); writer.WriteNumberValue(IntervalMonths); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(WeekIndex.ToString()); writer.WritePropertyName("dayOfWeek"u8); writer.WriteStringValue(DayOfWeek.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceMaintenanceRelativeMonthlySchedule DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(JsonElement element) + internal static ContainerServiceMaintenanceRelativeMonthlySchedule DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static ContainerServiceMaintenanceRelativeMonthlySchedule DeserializeCo int intervalMonths = default; ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex weekIndex = default; ContainerServiceWeekDay dayOfWeek = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("intervalMonths"u8)) @@ -50,8 +73,61 @@ internal static ContainerServiceMaintenanceRelativeMonthlySchedule DeserializeCo dayOfWeek = new ContainerServiceWeekDay(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceMaintenanceRelativeMonthlySchedule(intervalMonths, weekIndex, dayOfWeek, serializedAdditionalRawData); + } + + ContainerServiceMaintenanceRelativeMonthlySchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceRelativeMonthlySchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceRelativeMonthlySchedule model) + { + if (model is null) + { + return null; } - return new ContainerServiceMaintenanceRelativeMonthlySchedule(intervalMonths, weekIndex, dayOfWeek); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceRelativeMonthlySchedule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs index d1aaf411256a..4d60d63664fa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'. public partial class ContainerServiceMaintenanceRelativeMonthlySchedule { - /// Initializes a new instance of ContainerServiceMaintenanceRelativeMonthlySchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the number of months between each set of occurrences. /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. /// Specifies on which day of the week the maintenance occurs. @@ -21,6 +27,24 @@ public ContainerServiceMaintenanceRelativeMonthlySchedule(int intervalMonths, Co DayOfWeek = dayOfWeek; } + /// Initializes a new instance of . + /// Specifies the number of months between each set of occurrences. + /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. + /// Specifies on which day of the week the maintenance occurs. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceRelativeMonthlySchedule(int intervalMonths, ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex weekIndex, ContainerServiceWeekDay dayOfWeek, Dictionary serializedAdditionalRawData) + { + IntervalMonths = intervalMonths; + WeekIndex = weekIndex; + DayOfWeek = dayOfWeek; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceMaintenanceRelativeMonthlySchedule() + { + } + /// Specifies the number of months between each set of occurrences. public int IntervalMonths { get; set; } /// Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs index 322b3e604c47..9a9cc704a2ae 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs @@ -5,41 +5,91 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceMaintenanceSchedule : IUtf8JsonSerializable + public partial class ContainerServiceMaintenanceSchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Daily)) { writer.WritePropertyName("daily"u8); - writer.WriteObjectValue(Daily); + if (Daily is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Daily).Serialize(writer, options); + } } if (Optional.IsDefined(Weekly)) { writer.WritePropertyName("weekly"u8); - writer.WriteObjectValue(Weekly); + if (Weekly is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Weekly).Serialize(writer, options); + } } if (Optional.IsDefined(AbsoluteMonthly)) { writer.WritePropertyName("absoluteMonthly"u8); - writer.WriteObjectValue(AbsoluteMonthly); + if (AbsoluteMonthly is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AbsoluteMonthly).Serialize(writer, options); + } } if (Optional.IsDefined(RelativeMonthly)) { writer.WritePropertyName("relativeMonthly"u8); - writer.WriteObjectValue(RelativeMonthly); + if (RelativeMonthly is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RelativeMonthly).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerServiceMaintenanceSchedule DeserializeContainerServiceMaintenanceSchedule(JsonElement element) + internal static ContainerServiceMaintenanceSchedule DeserializeContainerServiceMaintenanceSchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +98,7 @@ internal static ContainerServiceMaintenanceSchedule DeserializeContainerServiceM Optional weekly = default; Optional absoluteMonthly = default; Optional relativeMonthly = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("daily"u8)) @@ -86,8 +137,61 @@ internal static ContainerServiceMaintenanceSchedule DeserializeContainerServiceM relativeMonthly = ContainerServiceMaintenanceRelativeMonthlySchedule.DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceMaintenanceSchedule(daily.Value, weekly.Value, absoluteMonthly.Value, relativeMonthly.Value); + return new ContainerServiceMaintenanceSchedule(daily.Value, weekly.Value, absoluteMonthly.Value, relativeMonthly.Value, serializedAdditionalRawData); + } + + ContainerServiceMaintenanceSchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceSchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceSchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceSchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceSchedule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceSchedule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceSchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs index 90ee662a942e..1703405cbe58 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// One and only one of the schedule types should be specified. Choose either 'daily', 'weekly', 'absoluteMonthly' or 'relativeMonthly' for your maintenance schedule. public partial class ContainerServiceMaintenanceSchedule { - /// Initializes a new instance of ContainerServiceMaintenanceSchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceMaintenanceSchedule() { } - /// Initializes a new instance of ContainerServiceMaintenanceSchedule. + /// Initializes a new instance of . /// For schedules like: 'recur every day' or 'recur every 3 days'. /// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. /// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. /// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'. - internal ContainerServiceMaintenanceSchedule(DailySchedule daily, ContainerServiceMaintenanceWeeklySchedule weekly, ContainerServiceMaintenanceAbsoluteMonthlySchedule absoluteMonthly, ContainerServiceMaintenanceRelativeMonthlySchedule relativeMonthly) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceSchedule(DailySchedule daily, ContainerServiceMaintenanceWeeklySchedule weekly, ContainerServiceMaintenanceAbsoluteMonthlySchedule absoluteMonthly, ContainerServiceMaintenanceRelativeMonthlySchedule relativeMonthly, Dictionary serializedAdditionalRawData) { Daily = daily; Weekly = weekly; AbsoluteMonthly = absoluteMonthly; RelativeMonthly = relativeMonthly; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// For schedules like: 'recur every day' or 'recur every 3 days'. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs index be42d43b6a13..757f753e8a76 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceMaintenanceWeeklySchedule : IUtf8JsonSerializable + public partial class ContainerServiceMaintenanceWeeklySchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("intervalWeeks"u8); writer.WriteNumberValue(IntervalWeeks); writer.WritePropertyName("dayOfWeek"u8); writer.WriteStringValue(DayOfWeek.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceMaintenanceWeeklySchedule DeserializeContainerServiceMaintenanceWeeklySchedule(JsonElement element) + internal static ContainerServiceMaintenanceWeeklySchedule DeserializeContainerServiceMaintenanceWeeklySchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int intervalWeeks = default; ContainerServiceWeekDay dayOfWeek = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("intervalWeeks"u8)) @@ -42,8 +65,61 @@ internal static ContainerServiceMaintenanceWeeklySchedule DeserializeContainerSe dayOfWeek = new ContainerServiceWeekDay(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceMaintenanceWeeklySchedule(intervalWeeks, dayOfWeek, serializedAdditionalRawData); + } + + ContainerServiceMaintenanceWeeklySchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceWeeklySchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceWeeklySchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceWeeklySchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceWeeklySchedule model) + { + if (model is null) + { + return null; } - return new ContainerServiceMaintenanceWeeklySchedule(intervalWeeks, dayOfWeek); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceWeeklySchedule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceWeeklySchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs index 0dc70389478d..c10c71d02878 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. public partial class ContainerServiceMaintenanceWeeklySchedule { - /// Initializes a new instance of ContainerServiceMaintenanceWeeklySchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the number of weeks between each set of occurrences. /// Specifies on which day of the week the maintenance occurs. public ContainerServiceMaintenanceWeeklySchedule(int intervalWeeks, ContainerServiceWeekDay dayOfWeek) @@ -19,6 +25,22 @@ public ContainerServiceMaintenanceWeeklySchedule(int intervalWeeks, ContainerSer DayOfWeek = dayOfWeek; } + /// Initializes a new instance of . + /// Specifies the number of weeks between each set of occurrences. + /// Specifies on which day of the week the maintenance occurs. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceWeeklySchedule(int intervalWeeks, ContainerServiceWeekDay dayOfWeek, Dictionary serializedAdditionalRawData) + { + IntervalWeeks = intervalWeeks; + DayOfWeek = dayOfWeek; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceMaintenanceWeeklySchedule() + { + } + /// Specifies the number of weeks between each set of occurrences. public int IntervalWeeks { get; set; } /// Specifies on which day of the week the maintenance occurs. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs index d0fe0f8d04bc..db9eb7786f0c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs @@ -5,19 +5,33 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceMaintenanceWindow : IUtf8JsonSerializable + public partial class ContainerServiceMaintenanceWindow : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } writer.WritePropertyName("durationHours"u8); writer.WriteNumberValue(DurationHours); if (Optional.IsDefined(UtcOffset)) @@ -38,15 +52,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NotAllowedDates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceMaintenanceWindow DeserializeContainerServiceMaintenanceWindow(JsonElement element) + internal static ContainerServiceMaintenanceWindow DeserializeContainerServiceMaintenanceWindow(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +92,7 @@ internal static ContainerServiceMaintenanceWindow DeserializeContainerServiceMai Optional startDate = default; string startTime = default; Optional> notAllowedDates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schedule"u8)) @@ -98,8 +134,61 @@ internal static ContainerServiceMaintenanceWindow DeserializeContainerServiceMai notAllowedDates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceMaintenanceWindow(schedule, durationHours, utcOffset.Value, startDate.Value, startTime, Optional.ToList(notAllowedDates), serializedAdditionalRawData); + } + + ContainerServiceMaintenanceWindow IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceMaintenanceWindow(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceMaintenanceWindow IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceMaintenanceWindow(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceMaintenanceWindow model) + { + if (model is null) + { + return null; } - return new ContainerServiceMaintenanceWindow(schedule, durationHours, utcOffset.Value, startDate.Value, startTime, Optional.ToList(notAllowedDates)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceMaintenanceWindow(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceMaintenanceWindow(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs index 15a4afd3a87e..8556d4c6ca17 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster. public partial class ContainerServiceMaintenanceWindow { - /// Initializes a new instance of ContainerServiceMaintenanceWindow. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Recurrence schedule for the maintenance window. /// Length of maintenance window range from 4 to 24 hours. /// The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'. @@ -30,14 +33,15 @@ public ContainerServiceMaintenanceWindow(ContainerServiceMaintenanceSchedule sch NotAllowedDates = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceMaintenanceWindow. + /// Initializes a new instance of . /// Recurrence schedule for the maintenance window. /// Length of maintenance window range from 4 to 24 hours. /// The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'. /// The date the maintenance window activates. If the current date is before this date, the maintenance window is inactive and will not be used for upgrades. If not specified, the maintenance window will be active right away. /// The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'. /// Date ranges on which upgrade is not allowed. 'utcOffset' applies to this field. For example, with 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to '2023-01-03', maintenance will be blocked from '2022-12-22 22:00' to '2023-01-03 22:00' in UTC time. - internal ContainerServiceMaintenanceWindow(ContainerServiceMaintenanceSchedule schedule, int durationHours, string utcOffset, string startDate, string startTime, IList notAllowedDates) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceMaintenanceWindow(ContainerServiceMaintenanceSchedule schedule, int durationHours, string utcOffset, string startDate, string startTime, IList notAllowedDates, Dictionary serializedAdditionalRawData) { Schedule = schedule; DurationHours = durationHours; @@ -45,6 +49,12 @@ internal ContainerServiceMaintenanceWindow(ContainerServiceMaintenanceSchedule s StartDate = startDate; StartTime = startTime; NotAllowedDates = notAllowedDates; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceMaintenanceWindow() + { } /// Recurrence schedule for the maintenance window. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceManagedClusterData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceManagedClusterData.Serialization.cs index 34863594aa93..541bf23287ca 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceManagedClusterData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceManagedClusterData.Serialization.cs @@ -5,24 +5,38 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServiceManagedClusterData : IUtf8JsonSerializable + public partial class ContainerServiceManagedClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(ExtendedLocation)) { @@ -52,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(KubernetesVersion)) { @@ -75,24 +96,52 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AgentPoolProfiles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(LinuxProfile)) { writer.WritePropertyName("linuxProfile"u8); - writer.WriteObjectValue(LinuxProfile); + if (LinuxProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxProfile).Serialize(writer, options); + } } if (Optional.IsDefined(WindowsProfile)) { writer.WritePropertyName("windowsProfile"u8); - writer.WriteObjectValue(WindowsProfile); + if (WindowsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ServicePrincipalProfile)) { writer.WritePropertyName("servicePrincipalProfile"u8); - writer.WriteObjectValue(ServicePrincipalProfile); + if (ServicePrincipalProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ServicePrincipalProfile).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AddonProfiles)) { @@ -101,19 +150,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in AddonProfiles) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } if (Optional.IsDefined(PodIdentityProfile)) { writer.WritePropertyName("podIdentityProfile"u8); - writer.WriteObjectValue(PodIdentityProfile); + if (PodIdentityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PodIdentityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(OidcIssuerProfile)) { writer.WritePropertyName("oidcIssuerProfile"u8); - writer.WriteObjectValue(OidcIssuerProfile); + if (OidcIssuerProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OidcIssuerProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NodeResourceGroup)) { @@ -123,7 +193,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NodeResourceGroupProfile)) { writer.WritePropertyName("nodeResourceGroupProfile"u8); - writer.WriteObjectValue(NodeResourceGroupProfile); + if (NodeResourceGroupProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NodeResourceGroupProfile).Serialize(writer, options); + } } if (Optional.IsDefined(EnableRbac)) { @@ -143,27 +220,62 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AadProfile)) { writer.WritePropertyName("aadProfile"u8); - writer.WriteObjectValue(AadProfile); + if (AadProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AadProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AutoUpgradeProfile)) { writer.WritePropertyName("autoUpgradeProfile"u8); - writer.WriteObjectValue(AutoUpgradeProfile); + if (AutoUpgradeProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoUpgradeProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AutoScalerProfile)) { writer.WritePropertyName("autoScalerProfile"u8); - writer.WriteObjectValue(AutoScalerProfile); + if (AutoScalerProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoScalerProfile).Serialize(writer, options); + } } if (Optional.IsDefined(ApiServerAccessProfile)) { writer.WritePropertyName("apiServerAccessProfile"u8); - writer.WriteObjectValue(ApiServerAccessProfile); + if (ApiServerAccessProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiServerAccessProfile).Serialize(writer, options); + } } if (Optional.IsDefined(DiskEncryptionSetId)) { @@ -177,7 +289,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in IdentityProfile) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -187,7 +306,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PrivateLinkResources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -199,22 +325,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HttpProxyConfig)) { writer.WritePropertyName("httpProxyConfig"u8); - writer.WriteObjectValue(HttpProxyConfig); + if (HttpProxyConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HttpProxyConfig).Serialize(writer, options); + } } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile); + if (SecurityProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityProfile).Serialize(writer, options); + } } if (Optional.IsDefined(StorageProfile)) { writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile); + if (StorageProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StorageProfile).Serialize(writer, options); + } } if (Optional.IsDefined(IngressProfile)) { writer.WritePropertyName("ingressProfile"u8); - writer.WriteObjectValue(IngressProfile); + if (IngressProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IngressProfile).Serialize(writer, options); + } } if (Optional.IsDefined(PublicNetworkAccess)) { @@ -224,24 +378,59 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WorkloadAutoScalerProfile)) { writer.WritePropertyName("workloadAutoScalerProfile"u8); - writer.WriteObjectValue(WorkloadAutoScalerProfile); + if (WorkloadAutoScalerProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WorkloadAutoScalerProfile).Serialize(writer, options); + } } if (Optional.IsDefined(AzureMonitorProfile)) { writer.WritePropertyName("azureMonitorProfile"u8); - writer.WriteObjectValue(AzureMonitorProfile); + if (AzureMonitorProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureMonitorProfile).Serialize(writer, options); + } } if (Optional.IsDefined(GuardrailsProfile)) { writer.WritePropertyName("guardrailsProfile"u8); - writer.WriteObjectValue(GuardrailsProfile); + if (GuardrailsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GuardrailsProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceManagedClusterData DeserializeContainerServiceManagedClusterData(JsonElement element) + internal static ContainerServiceManagedClusterData DeserializeContainerServiceManagedClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -295,6 +484,7 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa Optional workloadAutoScalerProfile = default; Optional azureMonitorProfile = default; Optional guardrailsProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -723,8 +913,61 @@ internal static ContainerServiceManagedClusterData DeserializeContainerServiceMa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceManagedClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, extendedLocation, identity, provisioningState.Value, powerState.Value, creationData.Value, Optional.ToNullable(maxAgentPools), kubernetesVersion.Value, currentKubernetesVersion.Value, dnsPrefix.Value, fqdnSubdomain.Value, fqdn.Value, privateFQDN.Value, azurePortalFQDN.Value, Optional.ToList(agentPoolProfiles), linuxProfile.Value, windowsProfile.Value, servicePrincipalProfile.Value, Optional.ToDictionary(addonProfiles), podIdentityProfile.Value, oidcIssuerProfile.Value, nodeResourceGroup.Value, nodeResourceGroupProfile.Value, Optional.ToNullable(enableRBAC), Optional.ToNullable(enablePodSecurityPolicy), Optional.ToNullable(enableNamespaceResources), networkProfile.Value, aadProfile.Value, autoUpgradeProfile.Value, autoScalerProfile.Value, apiServerAccessProfile.Value, diskEncryptionSetId.Value, Optional.ToDictionary(identityProfile), Optional.ToList(privateLinkResources), Optional.ToNullable(disableLocalAccounts), httpProxyConfig.Value, securityProfile.Value, storageProfile.Value, ingressProfile.Value, Optional.ToNullable(publicNetworkAccess), workloadAutoScalerProfile.Value, azureMonitorProfile.Value, guardrailsProfile.Value); + return new ContainerServiceManagedClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, extendedLocation, identity, provisioningState.Value, powerState.Value, creationData.Value, Optional.ToNullable(maxAgentPools), kubernetesVersion.Value, currentKubernetesVersion.Value, dnsPrefix.Value, fqdnSubdomain.Value, fqdn.Value, privateFQDN.Value, azurePortalFQDN.Value, Optional.ToList(agentPoolProfiles), linuxProfile.Value, windowsProfile.Value, servicePrincipalProfile.Value, Optional.ToDictionary(addonProfiles), podIdentityProfile.Value, oidcIssuerProfile.Value, nodeResourceGroup.Value, nodeResourceGroupProfile.Value, Optional.ToNullable(enableRBAC), Optional.ToNullable(enablePodSecurityPolicy), Optional.ToNullable(enableNamespaceResources), networkProfile.Value, aadProfile.Value, autoUpgradeProfile.Value, autoScalerProfile.Value, apiServerAccessProfile.Value, diskEncryptionSetId.Value, Optional.ToDictionary(identityProfile), Optional.ToList(privateLinkResources), Optional.ToNullable(disableLocalAccounts), httpProxyConfig.Value, securityProfile.Value, storageProfile.Value, ingressProfile.Value, Optional.ToNullable(publicNetworkAccess), workloadAutoScalerProfile.Value, azureMonitorProfile.Value, guardrailsProfile.Value, serializedAdditionalRawData); + } + + ContainerServiceManagedClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceManagedClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceManagedClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceManagedClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceManagedClusterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceManagedClusterData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceManagedClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs index fe31e4de931d..21d96b21ac3a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceNetworkProfile : IUtf8JsonSerializable + public partial class ContainerServiceNetworkProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NetworkPlugin)) { @@ -74,12 +81,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LoadBalancerProfile)) { writer.WritePropertyName("loadBalancerProfile"u8); - writer.WriteObjectValue(LoadBalancerProfile); + if (LoadBalancerProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LoadBalancerProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NatGatewayProfile)) { writer.WritePropertyName("natGatewayProfile"u8); - writer.WriteObjectValue(NatGatewayProfile); + if (NatGatewayProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NatGatewayProfile).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(PodCidrs)) { @@ -114,13 +135,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KubeProxyConfig)) { writer.WritePropertyName("kubeProxyConfig"u8); - writer.WriteObjectValue(KubeProxyConfig); + if (KubeProxyConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubeProxyConfig).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetworkProfile(JsonElement element) + internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetworkProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -142,6 +184,7 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor Optional> serviceCidrs = default; Optional> ipFamilies = default; Optional kubeProxyConfig = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkPlugin"u8)) @@ -296,8 +339,61 @@ internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetwor kubeProxyConfig = ContainerServiceNetworkProfileKubeProxyConfig.DeserializeContainerServiceNetworkProfileKubeProxyConfig(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceNetworkProfile(Optional.ToNullable(networkPlugin), Optional.ToNullable(networkPluginMode), Optional.ToNullable(networkPolicy), Optional.ToNullable(networkMode), Optional.ToNullable(ebpfDataplane), podCidr.Value, serviceCidr.Value, dnsServiceIP.Value, dockerBridgeCidr.Value, Optional.ToNullable(outboundType), Optional.ToNullable(loadBalancerSku), loadBalancerProfile.Value, natGatewayProfile.Value, Optional.ToList(podCidrs), Optional.ToList(serviceCidrs), Optional.ToList(ipFamilies), kubeProxyConfig.Value, serializedAdditionalRawData); + } + + ContainerServiceNetworkProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceNetworkProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceNetworkProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceNetworkProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceNetworkProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceNetworkProfile(Response response) + { + if (response is null) + { + return null; } - return new ContainerServiceNetworkProfile(Optional.ToNullable(networkPlugin), Optional.ToNullable(networkPluginMode), Optional.ToNullable(networkPolicy), Optional.ToNullable(networkMode), Optional.ToNullable(ebpfDataplane), podCidr.Value, serviceCidr.Value, dnsServiceIP.Value, dockerBridgeCidr.Value, Optional.ToNullable(outboundType), Optional.ToNullable(loadBalancerSku), loadBalancerProfile.Value, natGatewayProfile.Value, Optional.ToList(podCidrs), Optional.ToList(serviceCidrs), Optional.ToList(ipFamilies), kubeProxyConfig.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceNetworkProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 9354974b9757..64901dd437bb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Profile of network configuration. public partial class ContainerServiceNetworkProfile { - /// Initializes a new instance of ContainerServiceNetworkProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceNetworkProfile() { PodCidrs = new ChangeTrackingList(); @@ -21,7 +25,7 @@ public ContainerServiceNetworkProfile() IPFamilies = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceNetworkProfile. + /// Initializes a new instance of . /// Network plugin used for building the Kubernetes network. /// Network plugin mode used for building the Kubernetes network. /// Network policy used for building the Kubernetes network. @@ -39,7 +43,8 @@ public ContainerServiceNetworkProfile() /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. /// IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. /// Holds configuration customizations for kube-proxy. Any values not defined will use the kube-proxy defaulting behavior. See https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where <version> is represented by a <major version>-<minor version> string. Kubernetes version 1.23 would be '1-23'. - internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, EbpfDataplane? ebpfDataplane, string podCidr, string serviceCidr, string dnsServiceIP, string dockerBridgeCidr, ContainerServiceOutboundType? outboundType, ContainerServiceLoadBalancerSku? loadBalancerSku, ManagedClusterLoadBalancerProfile loadBalancerProfile, ManagedClusterNatGatewayProfile natGatewayProfile, IList podCidrs, IList serviceCidrs, IList ipFamilies, ContainerServiceNetworkProfileKubeProxyConfig kubeProxyConfig) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, EbpfDataplane? ebpfDataplane, string podCidr, string serviceCidr, string dnsServiceIP, string dockerBridgeCidr, ContainerServiceOutboundType? outboundType, ContainerServiceLoadBalancerSku? loadBalancerSku, ManagedClusterLoadBalancerProfile loadBalancerProfile, ManagedClusterNatGatewayProfile natGatewayProfile, IList podCidrs, IList serviceCidrs, IList ipFamilies, ContainerServiceNetworkProfileKubeProxyConfig kubeProxyConfig, Dictionary serializedAdditionalRawData) { NetworkPlugin = networkPlugin; NetworkPluginMode = networkPluginMode; @@ -58,6 +63,7 @@ internal ContainerServiceNetworkProfile(ContainerServiceNetworkPlugin? networkPl ServiceCidrs = serviceCidrs; IPFamilies = ipFamilies; KubeProxyConfig = kubeProxyConfig; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Network plugin used for building the Kubernetes network. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.Serialization.cs index 184ef81ebf78..2607e918d6e0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceNetworkProfileForSnapshot + public partial class ContainerServiceNetworkProfileForSnapshot : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceNetworkProfileForSnapshot DeserializeContainerServiceNetworkProfileForSnapshot(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkPlugin)) + { + writer.WritePropertyName("networkPlugin"u8); + writer.WriteStringValue(NetworkPlugin.Value.ToString()); + } + if (Optional.IsDefined(NetworkPluginMode)) + { + writer.WritePropertyName("networkPluginMode"u8); + writer.WriteStringValue(NetworkPluginMode.Value.ToString()); + } + if (Optional.IsDefined(NetworkPolicy)) + { + writer.WritePropertyName("networkPolicy"u8); + writer.WriteStringValue(NetworkPolicy.Value.ToString()); + } + if (Optional.IsDefined(NetworkMode)) + { + writer.WritePropertyName("networkMode"u8); + writer.WriteStringValue(NetworkMode.Value.ToString()); + } + if (Optional.IsDefined(LoadBalancerSku)) + { + writer.WritePropertyName("loadBalancerSku"u8); + writer.WriteStringValue(LoadBalancerSku.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceNetworkProfileForSnapshot DeserializeContainerServiceNetworkProfileForSnapshot(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static ContainerServiceNetworkProfileForSnapshot DeserializeContainerSe Optional networkPolicy = default; Optional networkMode = default; Optional loadBalancerSku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkPlugin"u8)) @@ -70,8 +124,61 @@ internal static ContainerServiceNetworkProfileForSnapshot DeserializeContainerSe loadBalancerSku = new ContainerServiceLoadBalancerSku(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceNetworkProfileForSnapshot(Optional.ToNullable(networkPlugin), Optional.ToNullable(networkPluginMode), Optional.ToNullable(networkPolicy), Optional.ToNullable(networkMode), Optional.ToNullable(loadBalancerSku)); + return new ContainerServiceNetworkProfileForSnapshot(Optional.ToNullable(networkPlugin), Optional.ToNullable(networkPluginMode), Optional.ToNullable(networkPolicy), Optional.ToNullable(networkMode), Optional.ToNullable(loadBalancerSku), serializedAdditionalRawData); + } + + ContainerServiceNetworkProfileForSnapshot IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceNetworkProfileForSnapshot(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceNetworkProfileForSnapshot IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceNetworkProfileForSnapshot(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceNetworkProfileForSnapshot model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceNetworkProfileForSnapshot(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceNetworkProfileForSnapshot(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.cs index 6e919803de90..29f407099413 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileForSnapshot.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// network profile for managed cluster snapshot, these properties are read only. public partial class ContainerServiceNetworkProfileForSnapshot { - /// Initializes a new instance of ContainerServiceNetworkProfileForSnapshot. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceNetworkProfileForSnapshot() { } - /// Initializes a new instance of ContainerServiceNetworkProfileForSnapshot. + /// Initializes a new instance of . /// networkPlugin for managed cluster snapshot. /// NetworkPluginMode for managed cluster snapshot. /// networkPolicy for managed cluster snapshot. /// networkMode for managed cluster snapshot. /// loadBalancerSku for managed cluster snapshot. - internal ContainerServiceNetworkProfileForSnapshot(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, ContainerServiceLoadBalancerSku? loadBalancerSku) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceNetworkProfileForSnapshot(ContainerServiceNetworkPlugin? networkPlugin, ContainerServiceNetworkPluginMode? networkPluginMode, ContainerServiceNetworkPolicy? networkPolicy, ContainerServiceNetworkMode? networkMode, ContainerServiceLoadBalancerSku? loadBalancerSku, Dictionary serializedAdditionalRawData) { NetworkPlugin = networkPlugin; NetworkPluginMode = networkPluginMode; NetworkPolicy = networkPolicy; NetworkMode = networkMode; LoadBalancerSku = loadBalancerSku; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// networkPlugin for managed cluster snapshot. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs index 7a4660984682..bb0e097e0375 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceNetworkProfileKubeProxyConfig : IUtf8JsonSerializable + public partial class ContainerServiceNetworkProfileKubeProxyConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IPVSConfig)) { writer.WritePropertyName("ipvsConfig"u8); - writer.WriteObjectValue(IPVSConfig); + if (IPVSConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IPVSConfig).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContainerServiceNetworkProfileKubeProxyConfig DeserializeContainerServiceNetworkProfileKubeProxyConfig(JsonElement element) + internal static ContainerServiceNetworkProfileKubeProxyConfig DeserializeContainerServiceNetworkProfileKubeProxyConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static ContainerServiceNetworkProfileKubeProxyConfig DeserializeContain Optional enabled = default; Optional mode = default; Optional ipvsConfig = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -71,8 +101,61 @@ internal static ContainerServiceNetworkProfileKubeProxyConfig DeserializeContain ipvsConfig = ContainerServiceNetworkProfileKubeProxyIPVSConfig.DeserializeContainerServiceNetworkProfileKubeProxyIPVSConfig(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceNetworkProfileKubeProxyConfig(Optional.ToNullable(enabled), Optional.ToNullable(mode), ipvsConfig.Value, serializedAdditionalRawData); + } + + ContainerServiceNetworkProfileKubeProxyConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceNetworkProfileKubeProxyConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceNetworkProfileKubeProxyConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceNetworkProfileKubeProxyConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceNetworkProfileKubeProxyConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceNetworkProfileKubeProxyConfig(Response response) + { + if (response is null) + { + return null; } - return new ContainerServiceNetworkProfileKubeProxyConfig(Optional.ToNullable(enabled), Optional.ToNullable(mode), ipvsConfig.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceNetworkProfileKubeProxyConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs index fd2d75fb3c46..e7d5981f9649 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Holds configuration customizations for kube-proxy. Any values not defined will use the kube-proxy defaulting behavior. See https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where <version> is represented by a <major version>-<minor version> string. Kubernetes version 1.23 would be '1-23'. public partial class ContainerServiceNetworkProfileKubeProxyConfig { - /// Initializes a new instance of ContainerServiceNetworkProfileKubeProxyConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceNetworkProfileKubeProxyConfig() { } - /// Initializes a new instance of ContainerServiceNetworkProfileKubeProxyConfig. + /// Initializes a new instance of . /// Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' exists, kube-proxy is enabled in AKS by default without these customizations). /// Specify which proxy mode to use ('IPTABLES' or 'IPVS'). /// Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. - internal ContainerServiceNetworkProfileKubeProxyConfig(bool? isEnabled, ContainerServiceNetworkProfileKubeProxyMode? mode, ContainerServiceNetworkProfileKubeProxyIPVSConfig ipvsConfig) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceNetworkProfileKubeProxyConfig(bool? isEnabled, ContainerServiceNetworkProfileKubeProxyMode? mode, ContainerServiceNetworkProfileKubeProxyIPVSConfig ipvsConfig, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Mode = mode; IPVSConfig = ipvsConfig; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' exists, kube-proxy is enabled in AKS by default without these customizations). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.Serialization.cs index 01603be2b921..2ab9e9ff67ea 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceNetworkProfileKubeProxyIPVSConfig : IUtf8JsonSerializable + public partial class ContainerServiceNetworkProfileKubeProxyIPVSConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Scheduler)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("udpTimeoutSeconds"u8); writer.WriteNumberValue(UdpTimeoutSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceNetworkProfileKubeProxyIPVSConfig DeserializeContainerServiceNetworkProfileKubeProxyIPVSConfig(JsonElement element) + internal static ContainerServiceNetworkProfileKubeProxyIPVSConfig DeserializeContainerServiceNetworkProfileKubeProxyIPVSConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ContainerServiceNetworkProfileKubeProxyIPVSConfig DeserializeCon Optional tcpTimeoutSeconds = default; Optional tcpFinTimeoutSeconds = default; Optional udpTimeoutSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scheduler"u8)) @@ -86,8 +109,61 @@ internal static ContainerServiceNetworkProfileKubeProxyIPVSConfig DeserializeCon udpTimeoutSeconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceNetworkProfileKubeProxyIPVSConfig(Optional.ToNullable(scheduler), Optional.ToNullable(tcpTimeoutSeconds), Optional.ToNullable(tcpFinTimeoutSeconds), Optional.ToNullable(udpTimeoutSeconds), serializedAdditionalRawData); + } + + ContainerServiceNetworkProfileKubeProxyIPVSConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceNetworkProfileKubeProxyIPVSConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceNetworkProfileKubeProxyIPVSConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceNetworkProfileKubeProxyIPVSConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceNetworkProfileKubeProxyIPVSConfig model) + { + if (model is null) + { + return null; } - return new ContainerServiceNetworkProfileKubeProxyIPVSConfig(Optional.ToNullable(scheduler), Optional.ToNullable(tcpTimeoutSeconds), Optional.ToNullable(tcpFinTimeoutSeconds), Optional.ToNullable(udpTimeoutSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceNetworkProfileKubeProxyIPVSConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceNetworkProfileKubeProxyIPVSConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.cs index 7cbcdce1b863..e47ca77a57e8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyIPVSConfig.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. public partial class ContainerServiceNetworkProfileKubeProxyIPVSConfig { - /// Initializes a new instance of ContainerServiceNetworkProfileKubeProxyIPVSConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceNetworkProfileKubeProxyIPVSConfig() { } - /// Initializes a new instance of ContainerServiceNetworkProfileKubeProxyIPVSConfig. + /// Initializes a new instance of . /// IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. /// The timeout value used for idle IPVS TCP sessions in seconds. Must be a positive integer value. /// The timeout value used for IPVS TCP sessions after receiving a FIN in seconds. Must be a positive integer value. /// The timeout value used for IPVS UDP packets in seconds. Must be a positive integer value. - internal ContainerServiceNetworkProfileKubeProxyIPVSConfig(ContainerServiceNetworkProfileKubeProxyIPVSScheduler? scheduler, int? tcpTimeoutSeconds, int? tcpFinTimeoutSeconds, int? udpTimeoutSeconds) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceNetworkProfileKubeProxyIPVSConfig(ContainerServiceNetworkProfileKubeProxyIPVSScheduler? scheduler, int? tcpTimeoutSeconds, int? tcpFinTimeoutSeconds, int? udpTimeoutSeconds, Dictionary serializedAdditionalRawData) { Scheduler = scheduler; TcpTimeoutSeconds = tcpTimeoutSeconds; TcpFinTimeoutSeconds = tcpFinTimeoutSeconds; UdpTimeoutSeconds = udpTimeoutSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs index acd1f61d0c25..902e59585ee0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceOSOptionProperty + public partial class ContainerServiceOSOptionProperty : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOptionProperty(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("os-type"u8); + writer.WriteStringValue(OSType); + writer.WritePropertyName("enable-fips-image"u8); + writer.WriteBooleanValue(EnableFipsImage); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOptionProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string osType = default; bool enableFipsImage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("os-type"u8)) @@ -32,8 +65,61 @@ internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOp enableFipsImage = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceOSOptionProperty(osType, enableFipsImage); + return new ContainerServiceOSOptionProperty(osType, enableFipsImage, serializedAdditionalRawData); + } + + ContainerServiceOSOptionProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceOSOptionProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceOSOptionProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceOSOptionProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceOSOptionProperty model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceOSOptionProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceOSOptionProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs index 3b8a9ce2cf18..59f5cf04793f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// OS option property. public partial class ContainerServiceOSOptionProperty { - /// Initializes a new instance of ContainerServiceOSOptionProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The OS type. /// Whether the image is FIPS-enabled. /// is null. @@ -25,6 +29,22 @@ internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage) EnableFipsImage = enableFipsImage; } + /// Initializes a new instance of . + /// The OS type. + /// Whether the image is FIPS-enabled. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage, Dictionary serializedAdditionalRawData) + { + OSType = osType; + EnableFipsImage = enableFipsImage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceOSOptionProperty() + { + } + /// The OS type. public string OSType { get; } /// Whether the image is FIPS-enabled. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs index bbd5a0e4d97a..eca5c0ac50d5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceOutboundEnvironmentEndpoint + public partial class ContainerServiceOutboundEnvironmentEndpoint : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceOutboundEnvironmentEndpoint DeserializeContainerServiceOutboundEnvironmentEndpoint(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + } + if (Optional.IsCollectionDefined(Endpoints)) + { + writer.WritePropertyName("endpoints"u8); + writer.WriteStartArray(); + foreach (var item in Endpoints) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceOutboundEnvironmentEndpoint DeserializeContainerServiceOutboundEnvironmentEndpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional category = default; Optional> endpoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -42,8 +92,61 @@ internal static ContainerServiceOutboundEnvironmentEndpoint DeserializeContainer endpoints = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceOutboundEnvironmentEndpoint(category.Value, Optional.ToList(endpoints)); + return new ContainerServiceOutboundEnvironmentEndpoint(category.Value, Optional.ToList(endpoints), serializedAdditionalRawData); + } + + ContainerServiceOutboundEnvironmentEndpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceOutboundEnvironmentEndpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceOutboundEnvironmentEndpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceOutboundEnvironmentEndpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceOutboundEnvironmentEndpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceOutboundEnvironmentEndpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceOutboundEnvironmentEndpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs index 800943b850a9..083e3ac80db6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// Egress endpoints which AKS agent nodes connect to for common purpose. public partial class ContainerServiceOutboundEnvironmentEndpoint { - /// Initializes a new instance of ContainerServiceOutboundEnvironmentEndpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceOutboundEnvironmentEndpoint() { Endpoints = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceOutboundEnvironmentEndpoint. + /// Initializes a new instance of . /// The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. /// The endpoints that AKS agent nodes connect to. - internal ContainerServiceOutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceOutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints, Dictionary serializedAdditionalRawData) { Category = category; Endpoints = endpoints; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs index 5f123efaae7a..7caecd720656 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ContainerServicePowerState : IUtf8JsonSerializable + internal partial class ContainerServicePowerState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { writer.WritePropertyName("code"u8); writer.WriteStringValue(Code.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServicePowerState DeserializeContainerServicePowerState(JsonElement element) + internal static ContainerServicePowerState DeserializeContainerServicePowerState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -41,8 +64,61 @@ internal static ContainerServicePowerState DeserializeContainerServicePowerState code = new ContainerServiceStateCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServicePowerState(Optional.ToNullable(code), serializedAdditionalRawData); + } + + ContainerServicePowerState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServicePowerState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServicePowerState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServicePowerState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServicePowerState model) + { + if (model is null) + { + return null; } - return new ContainerServicePowerState(Optional.ToNullable(code)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServicePowerState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServicePowerState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.cs index 6f2b7c2ce79d..a85020e52fcb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Describes the Power State of the cluster. internal partial class ContainerServicePowerState { - /// Initializes a new instance of ContainerServicePowerState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServicePowerState() { } - /// Initializes a new instance of ContainerServicePowerState. + /// Initializes a new instance of . /// Tells whether the cluster is Running or Stopped. - internal ContainerServicePowerState(ContainerServiceStateCode? code) + /// Keeps track of any properties unknown to the library. + internal ContainerServicePowerState(ContainerServiceStateCode? code, Dictionary serializedAdditionalRawData) { Code = code; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Tells whether the cluster is Running or Stopped. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionData.Serialization.cs index d679c051a9c2..ab61d51ff7f6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionData.Serialization.cs @@ -5,18 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServicePrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class ContainerServicePrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServicePrivateEndpointConnectionData DeserializeContainerServicePrivateEndpointConnectionData(JsonElement element) + internal static ContainerServicePrivateEndpointConnectionData DeserializeContainerServicePrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +76,7 @@ internal static ContainerServicePrivateEndpointConnectionData DeserializeContain Optional provisioningState = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +142,61 @@ internal static ContainerServicePrivateEndpointConnectionData DeserializeContain } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServicePrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + ContainerServicePrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServicePrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServicePrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServicePrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServicePrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServicePrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new ContainerServicePrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), privateEndpoint, privateLinkServiceConnectionState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServicePrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs index dd2c9cc02f6a..978e54261e56 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ContainerServicePrivateEndpointConnectionListResult + internal partial class ContainerServicePrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServicePrivateEndpointConnectionListResult DeserializeContainerServicePrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServicePrivateEndpointConnectionListResult DeserializeContainerServicePrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static ContainerServicePrivateEndpointConnectionListResult DeserializeC value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServicePrivateEndpointConnectionListResult(Optional.ToList(value)); + return new ContainerServicePrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ContainerServicePrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServicePrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServicePrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServicePrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServicePrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServicePrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServicePrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs index 811d208ba0cb..8379dbbc86ae 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.ContainerService.Models /// A list of private endpoint connections. internal partial class ContainerServicePrivateEndpointConnectionListResult { - /// Initializes a new instance of ContainerServicePrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServicePrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServicePrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// The collection value. - internal ContainerServicePrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ContainerServicePrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs index d3a0aca1b38f..9012a3537ac6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServicePrivateLinkResourceData : IUtf8JsonSerializable + public partial class ContainerServicePrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServicePrivateLinkResourceData DeserializeContainerServicePrivateLinkResourceData(JsonElement element) + internal static ContainerServicePrivateLinkResourceData DeserializeContainerServicePrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +82,7 @@ internal static ContainerServicePrivateLinkResourceData DeserializeContainerServ Optional groupId = default; Optional> requiredMembers = default; Optional privateLinkServiceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -114,8 +136,61 @@ internal static ContainerServicePrivateLinkResourceData DeserializeContainerServ privateLinkServiceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServicePrivateLinkResourceData(id.Value, name.Value, Optional.ToNullable(type), groupId.Value, Optional.ToList(requiredMembers), privateLinkServiceId.Value, serializedAdditionalRawData); + } + + ContainerServicePrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServicePrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServicePrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServicePrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServicePrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new ContainerServicePrivateLinkResourceData(id.Value, name.Value, Optional.ToNullable(type), groupId.Value, Optional.ToList(requiredMembers), privateLinkServiceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServicePrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServicePrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs index 0f251e5d9c27..363124408e40 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// A private link resource. public partial class ContainerServicePrivateLinkResourceData { - /// Initializes a new instance of ContainerServicePrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServicePrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServicePrivateLinkResourceData. + /// Initializes a new instance of . /// The ID of the private link resource. /// The name of the private link resource. /// The resource type. /// The group ID of the resource. /// The RequiredMembers of the resource. /// The private link service ID of the resource, this field is exposed only to NRP internally. - internal ContainerServicePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType? resourceType, string groupId, IList requiredMembers, ResourceIdentifier privateLinkServiceId) + /// Keeps track of any properties unknown to the library. + internal ContainerServicePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType? resourceType, string groupId, IList requiredMembers, ResourceIdentifier privateLinkServiceId, Dictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -34,6 +39,7 @@ internal ContainerServicePrivateLinkResourceData(ResourceIdentifier id, string n GroupId = groupId; RequiredMembers = requiredMembers; PrivateLinkServiceId = privateLinkServiceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ID of the private link resource. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs index 826bcf5850b0..609b8067362a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ContainerServicePrivateLinkResourcesListResult + internal partial class ContainerServicePrivateLinkResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServicePrivateLinkResourcesListResult DeserializeContainerServicePrivateLinkResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServicePrivateLinkResourcesListResult DeserializeContainerServicePrivateLinkResourcesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static ContainerServicePrivateLinkResourcesListResult DeserializeContai value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServicePrivateLinkResourcesListResult(Optional.ToList(value)); + return new ContainerServicePrivateLinkResourcesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ContainerServicePrivateLinkResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServicePrivateLinkResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServicePrivateLinkResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServicePrivateLinkResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServicePrivateLinkResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServicePrivateLinkResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServicePrivateLinkResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs index ee482597547f..b1580099a8a9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ContainerService.Models /// A list of private link resources. internal partial class ContainerServicePrivateLinkResourcesListResult { - /// Initializes a new instance of ContainerServicePrivateLinkResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServicePrivateLinkResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServicePrivateLinkResourcesListResult. + /// Initializes a new instance of . /// The collection value. - internal ContainerServicePrivateLinkResourcesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ContainerServicePrivateLinkResourcesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The collection value. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs index 8664230f53bb..4c31116bc650 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServicePrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class ContainerServicePrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServicePrivateLinkServiceConnectionState DeserializeContainerServicePrivateLinkServiceConnectionState(JsonElement element) + internal static ContainerServicePrivateLinkServiceConnectionState DeserializeContainerServicePrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -52,8 +75,61 @@ internal static ContainerServicePrivateLinkServiceConnectionState DeserializeCon description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServicePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, serializedAdditionalRawData); + } + + ContainerServicePrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServicePrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServicePrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServicePrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServicePrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new ContainerServicePrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServicePrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServicePrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.cs index 724cc9b5bec0..ae4345f69604 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The state of a private link service connection. public partial class ContainerServicePrivateLinkServiceConnectionState { - /// Initializes a new instance of ContainerServicePrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServicePrivateLinkServiceConnectionState() { } - /// Initializes a new instance of ContainerServicePrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. - internal ContainerServicePrivateLinkServiceConnectionState(ContainerServicePrivateLinkServiceConnectionStatus? status, string description) + /// Keeps track of any properties unknown to the library. + internal ContainerServicePrivateLinkServiceConnectionState(ContainerServicePrivateLinkServiceConnectionStatus? status, string description, Dictionary serializedAdditionalRawData) { Status = status; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link service connection status. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs index 84e0ba53efb6..1717389033ab 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs @@ -5,34 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceSshConfiguration : IUtf8JsonSerializable + public partial class ContainerServiceSshConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("publicKeys"u8); writer.WriteStartArray(); foreach (var item in PublicKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceSshConfiguration DeserializeContainerServiceSshConfiguration(JsonElement element) + internal static ContainerServiceSshConfiguration DeserializeContainerServiceSshConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList publicKeys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicKeys"u8)) @@ -45,8 +74,61 @@ internal static ContainerServiceSshConfiguration DeserializeContainerServiceSshC publicKeys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceSshConfiguration(publicKeys, serializedAdditionalRawData); + } + + ContainerServiceSshConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceSshConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceSshConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceSshConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceSshConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceSshConfiguration(Response response) + { + if (response is null) + { + return null; } - return new ContainerServiceSshConfiguration(publicKeys); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceSshConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.cs index 456606b9f89b..b993794d9926 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// SSH configuration for Linux-based VMs running on Azure. public partial class ContainerServiceSshConfiguration { - /// Initializes a new instance of ContainerServiceSshConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. /// is null. public ContainerServiceSshConfiguration(IEnumerable publicKeys) @@ -25,11 +28,18 @@ public ContainerServiceSshConfiguration(IEnumerable Initializes a new instance of ContainerServiceSshConfiguration. + /// Initializes a new instance of . /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. - internal ContainerServiceSshConfiguration(IList publicKeys) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceSshConfiguration(IList publicKeys, Dictionary serializedAdditionalRawData) { PublicKeys = publicKeys; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceSshConfiguration() + { } /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.Serialization.cs index 514a4dcf059d..d86ca0a4a05c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceSshPublicKey : IUtf8JsonSerializable + public partial class ContainerServiceSshPublicKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyData"u8); writer.WriteStringValue(KeyData); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceSshPublicKey DeserializeContainerServiceSshPublicKey(JsonElement element) + internal static ContainerServiceSshPublicKey DeserializeContainerServiceSshPublicKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string keyData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyData"u8)) @@ -34,8 +57,61 @@ internal static ContainerServiceSshPublicKey DeserializeContainerServiceSshPubli keyData = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceSshPublicKey(keyData, serializedAdditionalRawData); + } + + ContainerServiceSshPublicKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceSshPublicKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceSshPublicKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceSshPublicKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceSshPublicKey model) + { + if (model is null) + { + return null; } - return new ContainerServiceSshPublicKey(keyData); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceSshPublicKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceSshPublicKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.cs index 8c9f1ae79278..bf0aacde4ebe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Contains information about SSH certificate public key data. public partial class ContainerServiceSshPublicKey { - /// Initializes a new instance of ContainerServiceSshPublicKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. /// is null. public ContainerServiceSshPublicKey(string keyData) @@ -23,6 +27,20 @@ public ContainerServiceSshPublicKey(string keyData) KeyData = keyData; } + /// Initializes a new instance of . + /// Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceSshPublicKey(string keyData, Dictionary serializedAdditionalRawData) + { + KeyData = keyData; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerServiceSshPublicKey() + { + } + /// Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. public string KeyData { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs index 8eaf90291561..61355f9d9a1e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTagsObject : IUtf8JsonSerializable + public partial class ContainerServiceTagsObject : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -26,7 +34,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContainerServiceTagsObject DeserializeContainerServiceTagsObject(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceTagsObject(Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ContainerServiceTagsObject IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceTagsObject(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceTagsObject IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceTagsObject(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceTagsObject model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceTagsObject(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceTagsObject(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.cs index 72f3e770ae81..812d21025dc8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// Tags object for patch operations. public partial class ContainerServiceTagsObject { - /// Initializes a new instance of ContainerServiceTagsObject. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceTagsObject() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal ContainerServiceTagsObject(IDictionary tags, Dictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Resource tags. public IDictionary Tags { get; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs index 8ffa29f15519..81ed2353628f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTimeInWeek : IUtf8JsonSerializable + public partial class ContainerServiceTimeInWeek : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Day)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceTimeInWeek DeserializeContainerServiceTimeInWeek(JsonElement element) + internal static ContainerServiceTimeInWeek DeserializeContainerServiceTimeInWeek(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional day = default; Optional> hourSlots = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("day"u8)) @@ -67,8 +89,61 @@ internal static ContainerServiceTimeInWeek DeserializeContainerServiceTimeInWeek hourSlots = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceTimeInWeek(Optional.ToNullable(day), Optional.ToList(hourSlots), serializedAdditionalRawData); + } + + ContainerServiceTimeInWeek IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceTimeInWeek(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceTimeInWeek IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceTimeInWeek(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceTimeInWeek model) + { + if (model is null) + { + return null; } - return new ContainerServiceTimeInWeek(Optional.ToNullable(day), Optional.ToList(hourSlots)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceTimeInWeek(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceTimeInWeek(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs index 1d97599795d4..314110b53520 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// Time in a week. public partial class ContainerServiceTimeInWeek { - /// Initializes a new instance of ContainerServiceTimeInWeek. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceTimeInWeek() { HourSlots = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceTimeInWeek. + /// Initializes a new instance of . /// The day of the week. /// Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. - internal ContainerServiceTimeInWeek(ContainerServiceWeekDay? day, IList hourSlots) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceTimeInWeek(ContainerServiceWeekDay? day, IList hourSlots, Dictionary serializedAdditionalRawData) { Day = day; HourSlots = hourSlots; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The day of the week. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs index 95fb48b848ab..e8b1a4900e0e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTimeSpan : IUtf8JsonSerializable + public partial class ContainerServiceTimeSpan : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StartOn)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("end"u8); writer.WriteStringValue(EndOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceTimeSpan DeserializeContainerServiceTimeSpan(JsonElement element) + internal static ContainerServiceTimeSpan DeserializeContainerServiceTimeSpan(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional start = default; Optional end = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("start"u8)) @@ -57,8 +79,61 @@ internal static ContainerServiceTimeSpan DeserializeContainerServiceTimeSpan(Jso end = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceTimeSpan(Optional.ToNullable(start), Optional.ToNullable(end), serializedAdditionalRawData); + } + + ContainerServiceTimeSpan IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceTimeSpan(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceTimeSpan IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceTimeSpan(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceTimeSpan model) + { + if (model is null) + { + return null; } - return new ContainerServiceTimeSpan(Optional.ToNullable(start), Optional.ToNullable(end)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceTimeSpan(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceTimeSpan(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.cs index f8d96d693ab0..e08edfe6efe9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerService.Models { /// For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. public partial class ContainerServiceTimeSpan { - /// Initializes a new instance of ContainerServiceTimeSpan. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceTimeSpan() { } - /// Initializes a new instance of ContainerServiceTimeSpan. + /// Initializes a new instance of . /// The start of a time span. /// The end of a time span. - internal ContainerServiceTimeSpan(DateTimeOffset? startOn, DateTimeOffset? endOn) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceTimeSpan(DateTimeOffset? startOn, DateTimeOffset? endOn, Dictionary serializedAdditionalRawData) { StartOn = startOn; EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The start of a time span. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs index 16986e75173f..fdfabb34bf80 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTrustedAccessRole + public partial class ContainerServiceTrustedAccessRole : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTrustedAccessRole(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTrustedAccessRole(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTru Optional sourceResourceType = default; Optional name = default; Optional> rules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceResourceType"u8)) @@ -48,8 +76,61 @@ internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTru rules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceTrustedAccessRole(sourceResourceType.Value, name.Value, Optional.ToList(rules)); + return new ContainerServiceTrustedAccessRole(sourceResourceType.Value, name.Value, Optional.ToList(rules), serializedAdditionalRawData); + } + + ContainerServiceTrustedAccessRole IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceTrustedAccessRole(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceTrustedAccessRole IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceTrustedAccessRole(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceTrustedAccessRole model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceTrustedAccessRole(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceTrustedAccessRole(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.cs index 482470d03f7e..8e07fa5b47df 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.ContainerService.Models /// Trusted access role definition. public partial class ContainerServiceTrustedAccessRole { - /// Initializes a new instance of ContainerServiceTrustedAccessRole. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceTrustedAccessRole() { Rules = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceTrustedAccessRole. + /// Initializes a new instance of . /// Resource type of Azure resource. /// Name of role, name is unique under a source resource type. /// List of rules for the role. This maps to 'rules' property of [Kubernetes Cluster Role](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole). - internal ContainerServiceTrustedAccessRole(string sourceResourceType, string name, IReadOnlyList rules) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceTrustedAccessRole(string sourceResourceType, string name, IReadOnlyList rules, Dictionary serializedAdditionalRawData) { SourceResourceType = sourceResourceType; Name = name; Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource type of Azure resource. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs index 76564a2b0a67..6e58b6798e0d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServiceTrustedAccessRoleBindingData : IUtf8JsonSerializable + public partial class ContainerServiceTrustedAccessRoleBindingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContainerServiceTrustedAccessRoleBindingData(JsonElement element) + internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContainerServiceTrustedAccessRoleBindingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContaine Optional provisioningState = default; ResourceIdentifier sourceResourceId = default; IList roles = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -108,8 +130,61 @@ internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContaine } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceTrustedAccessRoleBindingData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), sourceResourceId, roles, serializedAdditionalRawData); + } + + ContainerServiceTrustedAccessRoleBindingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceTrustedAccessRoleBindingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceTrustedAccessRoleBindingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceTrustedAccessRoleBindingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceTrustedAccessRoleBindingData model) + { + if (model is null) + { + return null; } - return new ContainerServiceTrustedAccessRoleBindingData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), sourceResourceId, roles); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceTrustedAccessRoleBindingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceTrustedAccessRoleBindingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs index 6273c54568e9..d52d585d2190 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTrustedAccessRoleRule + public partial class ContainerServiceTrustedAccessRoleRule : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerServiceTrustedAccessRoleRule DeserializeContainerServiceTrustedAccessRoleRule(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerServiceTrustedAccessRoleRule DeserializeContainerServiceTrustedAccessRoleRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static ContainerServiceTrustedAccessRoleRule DeserializeContainerServic Optional> resources = default; Optional> resourceNames = default; Optional> nonResourceUrls = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("verbs"u8)) @@ -96,8 +124,61 @@ internal static ContainerServiceTrustedAccessRoleRule DeserializeContainerServic nonResourceUrls = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerServiceTrustedAccessRoleRule(Optional.ToList(verbs), Optional.ToList(apiGroups), Optional.ToList(resources), Optional.ToList(resourceNames), Optional.ToList(nonResourceUrls)); + return new ContainerServiceTrustedAccessRoleRule(Optional.ToList(verbs), Optional.ToList(apiGroups), Optional.ToList(resources), Optional.ToList(resourceNames), Optional.ToList(nonResourceUrls), serializedAdditionalRawData); + } + + ContainerServiceTrustedAccessRoleRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceTrustedAccessRoleRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceTrustedAccessRoleRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceTrustedAccessRoleRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceTrustedAccessRoleRule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceTrustedAccessRoleRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceTrustedAccessRoleRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs index 9fd93e791649..015ee98d8e56 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Rule for trusted access role. public partial class ContainerServiceTrustedAccessRoleRule { - /// Initializes a new instance of ContainerServiceTrustedAccessRoleRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerServiceTrustedAccessRoleRule() { Verbs = new ChangeTrackingList(); @@ -23,19 +27,21 @@ internal ContainerServiceTrustedAccessRoleRule() NonResourceUrls = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerServiceTrustedAccessRoleRule. + /// Initializes a new instance of . /// List of allowed verbs. /// List of allowed apiGroups. /// List of allowed resources. /// List of allowed names. /// List of allowed nonResourceURLs. - internal ContainerServiceTrustedAccessRoleRule(IReadOnlyList verbs, IReadOnlyList apiGroups, IReadOnlyList resources, IReadOnlyList resourceNames, IReadOnlyList nonResourceUrls) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceTrustedAccessRoleRule(IReadOnlyList verbs, IReadOnlyList apiGroups, IReadOnlyList resources, IReadOnlyList resourceNames, IReadOnlyList nonResourceUrls, Dictionary serializedAdditionalRawData) { Verbs = verbs; ApiGroups = apiGroups; Resources = resources; ResourceNames = resourceNames; NonResourceUrls = nonResourceUrls; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of allowed verbs. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs index e0450e16c44e..a9dccbb09426 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceUserAssignedIdentity : IUtf8JsonSerializable + public partial class ContainerServiceUserAssignedIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("objectId"u8); writer.WriteStringValue(ObjectId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContainerServiceUserAssignedIdentity DeserializeContainerServiceUserAssignedIdentity(JsonElement element) + internal static ContainerServiceUserAssignedIdentity DeserializeContainerServiceUserAssignedIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static ContainerServiceUserAssignedIdentity DeserializeContainerService Optional resourceId = default; Optional clientId = default; Optional objectId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -72,8 +94,61 @@ internal static ContainerServiceUserAssignedIdentity DeserializeContainerService objectId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContainerServiceUserAssignedIdentity(resourceId.Value, Optional.ToNullable(clientId), Optional.ToNullable(objectId), serializedAdditionalRawData); + } + + ContainerServiceUserAssignedIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerServiceUserAssignedIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerServiceUserAssignedIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerServiceUserAssignedIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerServiceUserAssignedIdentity model) + { + if (model is null) + { + return null; } - return new ContainerServiceUserAssignedIdentity(resourceId.Value, Optional.ToNullable(clientId), Optional.ToNullable(objectId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerServiceUserAssignedIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerServiceUserAssignedIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs index 9fa6ccc336fc..0cb2b4aded1d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.ContainerService.Models /// Details about a user assigned identity. public partial class ContainerServiceUserAssignedIdentity { - /// Initializes a new instance of ContainerServiceUserAssignedIdentity. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContainerServiceUserAssignedIdentity() { } - /// Initializes a new instance of ContainerServiceUserAssignedIdentity. + /// Initializes a new instance of . /// The resource ID of the user assigned identity. /// The client ID of the user assigned identity. /// The object ID of the user assigned identity. - internal ContainerServiceUserAssignedIdentity(ResourceIdentifier resourceId, Guid? clientId, Guid? objectId) + /// Keeps track of any properties unknown to the library. + internal ContainerServiceUserAssignedIdentity(ResourceIdentifier resourceId, Guid? clientId, Guid? objectId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; ClientId = clientId; ObjectId = objectId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource ID of the user assigned identity. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs index fa1eb423ca45..5cf5b225f1f6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class DailySchedule : IUtf8JsonSerializable + internal partial class DailySchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("intervalDays"u8); writer.WriteNumberValue(IntervalDays); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DailySchedule DeserializeDailySchedule(JsonElement element) + internal static DailySchedule DeserializeDailySchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int intervalDays = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("intervalDays"u8)) @@ -34,8 +57,61 @@ internal static DailySchedule DeserializeDailySchedule(JsonElement element) intervalDays = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DailySchedule(intervalDays, serializedAdditionalRawData); + } + + DailySchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDailySchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DailySchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDailySchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DailySchedule model) + { + if (model is null) + { + return null; } - return new DailySchedule(intervalDays); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DailySchedule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDailySchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs index eabdcf302782..57b2424917f9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// For schedules like: 'recur every day' or 'recur every 3 days'. internal partial class DailySchedule { - /// Initializes a new instance of DailySchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the number of days between each set of occurrences. public DailySchedule(int intervalDays) { IntervalDays = intervalDays; } + /// Initializes a new instance of . + /// Specifies the number of days between each set of occurrences. + /// Keeps track of any properties unknown to the library. + internal DailySchedule(int intervalDays, Dictionary serializedAdditionalRawData) + { + IntervalDays = intervalDays; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DailySchedule() + { + } + /// Specifies the number of days between each set of occurrences. public int IntervalDays { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs index f13504a775a9..be08ec45ba18 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class FleetListResult + internal partial class FleetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FleetListResult DeserializeFleetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FleetListResult DeserializeFleetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static FleetListResult DeserializeFleetListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FleetListResult(Optional.ToList(value), nextLink.Value); + return new FleetListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FleetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFleetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FleetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFleetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FleetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FleetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFleetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs index f9577a68048d..002be93ee42e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List Fleets operation. internal partial class FleetListResult { - /// Initializes a new instance of FleetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FleetListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FleetListResult. + /// Initializes a new instance of . /// The list of Fleets. /// The URL to get the next page of Fleets. - internal FleetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FleetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of Fleets. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.Serialization.cs index 1dc7ef1f85ef..9a99195ed63f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class FleetMembersListResult + internal partial class FleetMembersListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FleetMembersListResult DeserializeFleetMembersListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FleetMembersListResult DeserializeFleetMembersListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static FleetMembersListResult DeserializeFleetMembersListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FleetMembersListResult(Optional.ToList(value), nextLink.Value); + return new FleetMembersListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FleetMembersListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFleetMembersListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FleetMembersListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFleetMembersListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FleetMembersListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FleetMembersListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFleetMembersListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.cs index e1eb4a312555..bb9efa2833e4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMembersListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List FleetMembers operation. internal partial class FleetMembersListResult { - /// Initializes a new instance of FleetMembersListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FleetMembersListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FleetMembersListResult. + /// Initializes a new instance of . /// The list of members in a given Fleet. /// The URL to get the next page of Fleet members. - internal FleetMembersListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FleetMembersListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of members in a given Fleet. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs index 573e830cc157..efaead1610d3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class KubeletConfig : IUtf8JsonSerializable + public partial class KubeletConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CpuManagerPolicy)) { @@ -76,11 +83,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("podMaxPids"u8); writer.WriteNumberValue(PodMaxPids.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KubeletConfig DeserializeKubeletConfig(JsonElement element) + internal static KubeletConfig DeserializeKubeletConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -96,6 +117,7 @@ internal static KubeletConfig DeserializeKubeletConfig(JsonElement element) Optional containerLogMaxSizeMB = default; Optional containerLogMaxFiles = default; Optional podMaxPids = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cpuManagerPolicy"u8)) @@ -190,8 +212,61 @@ internal static KubeletConfig DeserializeKubeletConfig(JsonElement element) podMaxPids = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KubeletConfig(cpuManagerPolicy.Value, Optional.ToNullable(cpuCfsQuota), cpuCfsQuotaPeriod.Value, Optional.ToNullable(imageGcHighThreshold), Optional.ToNullable(imageGcLowThreshold), topologyManagerPolicy.Value, Optional.ToList(allowedUnsafeSysctls), Optional.ToNullable(failSwapOn), Optional.ToNullable(containerLogMaxSizeMB), Optional.ToNullable(containerLogMaxFiles), Optional.ToNullable(podMaxPids), serializedAdditionalRawData); + } + + KubeletConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKubeletConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KubeletConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKubeletConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KubeletConfig model) + { + if (model is null) + { + return null; } - return new KubeletConfig(cpuManagerPolicy.Value, Optional.ToNullable(cpuCfsQuota), cpuCfsQuotaPeriod.Value, Optional.ToNullable(imageGcHighThreshold), Optional.ToNullable(imageGcLowThreshold), topologyManagerPolicy.Value, Optional.ToList(allowedUnsafeSysctls), Optional.ToNullable(failSwapOn), Optional.ToNullable(containerLogMaxSizeMB), Optional.ToNullable(containerLogMaxFiles), Optional.ToNullable(podMaxPids)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KubeletConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKubeletConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs index 3fdaea7c7bac..65940868cbc2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.ContainerService.Models /// See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. public partial class KubeletConfig { - /// Initializes a new instance of KubeletConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public KubeletConfig() { AllowedUnsafeSysctls = new ChangeTrackingList(); } - /// Initializes a new instance of KubeletConfig. + /// Initializes a new instance of . /// The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. /// The default is true. /// The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. @@ -31,7 +35,8 @@ public KubeletConfig() /// The maximum size (e.g. 10Mi) of container log file before it is rotated. /// The maximum number of container log files that can be present for a container. The number must be ≥ 2. /// The maximum number of processes per pod. - internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, string cpuCfsQuotaPeriod, int? imageGcHighThreshold, int? imageGcLowThreshold, string topologyManagerPolicy, IList allowedUnsafeSysctls, bool? failStartWithSwapOn, int? containerLogMaxSizeInMB, int? containerLogMaxFiles, int? podMaxPids) + /// Keeps track of any properties unknown to the library. + internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, string cpuCfsQuotaPeriod, int? imageGcHighThreshold, int? imageGcLowThreshold, string topologyManagerPolicy, IList allowedUnsafeSysctls, bool? failStartWithSwapOn, int? containerLogMaxSizeInMB, int? containerLogMaxFiles, int? podMaxPids, Dictionary serializedAdditionalRawData) { CpuManagerPolicy = cpuManagerPolicy; IsCpuCfsQuotaEnabled = isCpuCfsQuotaEnabled; @@ -44,6 +49,7 @@ internal KubeletConfig(string cpuManagerPolicy, bool? isCpuCfsQuotaEnabled, stri ContainerLogMaxSizeInMB = containerLogMaxSizeInMB; ContainerLogMaxFiles = containerLogMaxFiles; PodMaxPids = podMaxPids; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs index 112a3e725622..471dd328c339 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class LinuxOSConfig : IUtf8JsonSerializable + public partial class LinuxOSConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sysctls)) { writer.WritePropertyName("sysctls"u8); - writer.WriteObjectValue(Sysctls); + if (Sysctls is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sysctls).Serialize(writer, options); + } } if (Optional.IsDefined(TransparentHugePageEnabled)) { @@ -35,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("swapFileSizeMB"u8); writer.WriteNumberValue(SwapFileSizeInMB.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinuxOSConfig DeserializeLinuxOSConfig(JsonElement element) + internal static LinuxOSConfig DeserializeLinuxOSConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +77,7 @@ internal static LinuxOSConfig DeserializeLinuxOSConfig(JsonElement element) Optional transparentHugePageEnabled = default; Optional transparentHugePageDefrag = default; Optional swapFileSizeMB = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sysctls"u8)) @@ -78,8 +108,61 @@ internal static LinuxOSConfig DeserializeLinuxOSConfig(JsonElement element) swapFileSizeMB = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinuxOSConfig(sysctls.Value, transparentHugePageEnabled.Value, transparentHugePageDefrag.Value, Optional.ToNullable(swapFileSizeMB), serializedAdditionalRawData); + } + + LinuxOSConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinuxOSConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinuxOSConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinuxOSConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinuxOSConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinuxOSConfig(Response response) + { + if (response is null) + { + return null; } - return new LinuxOSConfig(sysctls.Value, transparentHugePageEnabled.Value, transparentHugePageDefrag.Value, Optional.ToNullable(swapFileSizeMB)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinuxOSConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs index f06c618967ee..959bb5f44c35 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. public partial class LinuxOSConfig { - /// Initializes a new instance of LinuxOSConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinuxOSConfig() { } - /// Initializes a new instance of LinuxOSConfig. + /// Initializes a new instance of . /// Sysctl settings for Linux agent nodes. /// Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). /// Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). /// The size in MB of a swap file that will be created on each node. - internal LinuxOSConfig(SysctlConfig sysctls, string transparentHugePageEnabled, string transparentHugePageDefrag, int? swapFileSizeInMB) + /// Keeps track of any properties unknown to the library. + internal LinuxOSConfig(SysctlConfig sysctls, string transparentHugePageEnabled, string transparentHugePageDefrag, int? swapFileSizeInMB, Dictionary serializedAdditionalRawData) { Sysctls = sysctls; TransparentHugePageEnabled = transparentHugePageEnabled; TransparentHugePageDefrag = transparentHugePageDefrag; SwapFileSizeInMB = swapFileSizeInMB; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sysctl settings for Linux agent nodes. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs index e6f638c2be10..40e94c1b2942 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAadProfile : IUtf8JsonSerializable + public partial class ManagedClusterAadProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsManagedAadEnabled)) { @@ -57,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tenantID"u8); writer.WriteStringValue(TenantId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterAadProfile DeserializeManagedClusterAadProfile(JsonElement element) + internal static ManagedClusterAadProfile DeserializeManagedClusterAadProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +93,7 @@ internal static ManagedClusterAadProfile DeserializeManagedClusterAadProfile(Jso Optional serverAppId = default; Optional serverAppSecret = default; Optional tenantId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managed"u8)) @@ -139,8 +160,61 @@ internal static ManagedClusterAadProfile DeserializeManagedClusterAadProfile(Jso tenantId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAadProfile(Optional.ToNullable(managed), Optional.ToNullable(enableAzureRBAC), Optional.ToList(adminGroupObjectIds), Optional.ToNullable(clientAppId), Optional.ToNullable(serverAppId), serverAppSecret.Value, Optional.ToNullable(tenantId), serializedAdditionalRawData); + } + + ManagedClusterAadProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAadProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAadProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAadProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAadProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterAadProfile(Optional.ToNullable(managed), Optional.ToNullable(enableAzureRBAC), Optional.ToList(adminGroupObjectIds), Optional.ToNullable(clientAppId), Optional.ToNullable(serverAppId), serverAppSecret.Value, Optional.ToNullable(tenantId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAadProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAadProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs index 514a606840f2..e2a921b5b556 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.ContainerService.Models /// For more details see [managed AAD on AKS](https://docs.microsoft.com/azure/aks/managed-aad). public partial class ManagedClusterAadProfile { - /// Initializes a new instance of ManagedClusterAadProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterAadProfile() { AdminGroupObjectIds = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterAadProfile. + /// Initializes a new instance of . /// Whether to enable managed AAD. /// Whether to enable Azure RBAC for Kubernetes authorization. /// The list of AAD group object IDs that will have admin role of the cluster. @@ -28,7 +31,8 @@ public ManagedClusterAadProfile() /// The server AAD application ID. /// The server AAD application secret. /// The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - internal ManagedClusterAadProfile(bool? isManagedAadEnabled, bool? isAzureRbacEnabled, IList adminGroupObjectIds, Guid? clientAppId, Guid? serverAppId, string serverAppSecret, Guid? tenantId) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAadProfile(bool? isManagedAadEnabled, bool? isAzureRbacEnabled, IList adminGroupObjectIds, Guid? clientAppId, Guid? serverAppId, string serverAppSecret, Guid? tenantId, Dictionary serializedAdditionalRawData) { IsManagedAadEnabled = isManagedAadEnabled; IsAzureRbacEnabled = isAzureRbacEnabled; @@ -37,6 +41,7 @@ internal ManagedClusterAadProfile(bool? isManagedAadEnabled, bool? isAzureRbacEn ServerAppId = serverAppId; ServerAppSecret = serverAppSecret; TenantId = tenantId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable managed AAD. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.Serialization.cs index 9d77d8439d1e..76c2cc7ec702 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAccessProfile : IUtf8JsonSerializable + public partial class ManagedClusterAccessProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -39,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBase64StringValue(KubeConfig, "D"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfile(JsonElement element) + internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +75,7 @@ internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfi ResourceType type = default; Optional systemData = default; Optional kubeConfig = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -121,8 +142,61 @@ internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAccessProfile(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kubeConfig.Value, serializedAdditionalRawData); + } + + ManagedClusterAccessProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAccessProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAccessProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAccessProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAccessProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterAccessProfile(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, kubeConfig.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAccessProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAccessProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs index 5c066dc03c14..47435e180370 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.ContainerService.Models /// Managed cluster Access Profile. public partial class ManagedClusterAccessProfile : TrackedResourceData { - /// Initializes a new instance of ManagedClusterAccessProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ManagedClusterAccessProfile(AzureLocation location) : base(location) { } - /// Initializes a new instance of ManagedClusterAccessProfile. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,9 +32,16 @@ public ManagedClusterAccessProfile(AzureLocation location) : base(location) /// The tags. /// The location. /// Base64-encoded Kubernetes configuration file. - internal ManagedClusterAccessProfile(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, byte[] kubeConfig) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAccessProfile(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, byte[] kubeConfig, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { KubeConfig = kubeConfig; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterAccessProfile() + { } /// Base64-encoded Kubernetes configuration file. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs index d378069362f0..dc627e84fb5e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAddonProfile : IUtf8JsonSerializable + public partial class ManagedClusterAddonProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled); @@ -29,11 +36,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterAddonProfile DeserializeManagedClusterAddonProfile(JsonElement element) + internal static ManagedClusterAddonProfile DeserializeManagedClusterAddonProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +62,7 @@ internal static ManagedClusterAddonProfile DeserializeManagedClusterAddonProfile bool enabled = default; Optional> config = default; Optional identity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -71,8 +93,61 @@ internal static ManagedClusterAddonProfile DeserializeManagedClusterAddonProfile identity = ManagedClusterAddonProfileIdentity.DeserializeManagedClusterAddonProfileIdentity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAddonProfile(enabled, Optional.ToDictionary(config), identity.Value, serializedAdditionalRawData); + } + + ManagedClusterAddonProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAddonProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAddonProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAddonProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAddonProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterAddonProfile(enabled, Optional.ToDictionary(config), identity.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAddonProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAddonProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs index 780c45887435..0499c166076d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// A Kubernetes add-on profile for a managed cluster. public partial class ManagedClusterAddonProfile { - /// Initializes a new instance of ManagedClusterAddonProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether the add-on is enabled or not. public ManagedClusterAddonProfile(bool isEnabled) { @@ -21,15 +25,22 @@ public ManagedClusterAddonProfile(bool isEnabled) Config = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ManagedClusterAddonProfile. + /// Initializes a new instance of . /// Whether the add-on is enabled or not. /// Key-value pairs for configuring an add-on. /// Information of user assigned identity used by this add-on. - internal ManagedClusterAddonProfile(bool isEnabled, IDictionary config, ManagedClusterAddonProfileIdentity identity) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAddonProfile(bool isEnabled, IDictionary config, ManagedClusterAddonProfileIdentity identity, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Config = config; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterAddonProfile() + { } /// Whether the add-on is enabled or not. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs index 57328ec3e8fb..e860a569a49e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAddonProfileIdentity : IUtf8JsonSerializable + public partial class ManagedClusterAddonProfileIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("objectId"u8); writer.WriteStringValue(ObjectId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterAddonProfileIdentity DeserializeManagedClusterAddonProfileIdentity(JsonElement element) + internal static ManagedClusterAddonProfileIdentity DeserializeManagedClusterAddonProfileIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static ManagedClusterAddonProfileIdentity DeserializeManagedClusterAddo Optional resourceId = default; Optional clientId = default; Optional objectId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -72,8 +94,61 @@ internal static ManagedClusterAddonProfileIdentity DeserializeManagedClusterAddo objectId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAddonProfileIdentity(resourceId.Value, Optional.ToNullable(clientId), Optional.ToNullable(objectId), serializedAdditionalRawData); + } + + ManagedClusterAddonProfileIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAddonProfileIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAddonProfileIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAddonProfileIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAddonProfileIdentity model) + { + if (model is null) + { + return null; } - return new ManagedClusterAddonProfileIdentity(resourceId.Value, Optional.ToNullable(clientId), Optional.ToNullable(objectId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAddonProfileIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAddonProfileIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs index 382befe1b346..ebf5da6d4cf6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,16 +14,17 @@ namespace Azure.ResourceManager.ContainerService.Models /// Information of user assigned identity used by this add-on. public partial class ManagedClusterAddonProfileIdentity : ContainerServiceUserAssignedIdentity { - /// Initializes a new instance of ManagedClusterAddonProfileIdentity. + /// Initializes a new instance of . public ManagedClusterAddonProfileIdentity() { } - /// Initializes a new instance of ManagedClusterAddonProfileIdentity. + /// Initializes a new instance of . /// The resource ID of the user assigned identity. /// The client ID of the user assigned identity. /// The object ID of the user assigned identity. - internal ManagedClusterAddonProfileIdentity(ResourceIdentifier resourceId, Guid? clientId, Guid? objectId) : base(resourceId, clientId, objectId) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAddonProfileIdentity(ResourceIdentifier resourceId, Guid? clientId, Guid? objectId, Dictionary serializedAdditionalRawData) : base(resourceId, clientId, objectId, serializedAdditionalRawData) { } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs index d6481f72aac4..dfe2ebd8f058 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAgentPoolProfile : IUtf8JsonSerializable + public partial class ManagedClusterAgentPoolProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -116,12 +123,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UpgradeSettings)) { writer.WritePropertyName("upgradeSettings"u8); - writer.WriteObjectValue(UpgradeSettings); + if (UpgradeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpgradeSettings).Serialize(writer, options); + } } if (Optional.IsDefined(PowerState)) { writer.WritePropertyName("powerState"u8); - writer.WriteObjectValue(PowerState); + if (PowerState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PowerState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AvailabilityZones)) { @@ -203,12 +224,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KubeletConfig)) { writer.WritePropertyName("kubeletConfig"u8); - writer.WriteObjectValue(KubeletConfig); + if (KubeletConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubeletConfig).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxOSConfig)) { writer.WritePropertyName("linuxOSConfig"u8); - writer.WriteObjectValue(LinuxOSConfig); + if (LinuxOSConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxOSConfig).Serialize(writer, options); + } } if (Optional.IsDefined(EnableEncryptionAtHost)) { @@ -233,7 +268,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(CapacityReservationGroupId)) { @@ -248,18 +290,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsProfile)) { writer.WritePropertyName("windowsProfile"u8); - writer.WriteObjectValue(WindowsProfile); + if (WindowsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoolProfile(JsonElement element) + internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoolProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -311,6 +381,7 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo Optional hostGroupId = default; Optional windowsProfile = default; Optional networkProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -728,8 +799,61 @@ internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoo networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAgentPoolProfile(Optional.ToNullable(count), vmSize.Value, Optional.ToNullable(osDiskSizeGB), Optional.ToNullable(osDiskType), Optional.ToNullable(kubeletDiskType), Optional.ToNullable(workloadRuntime), messageOfTheDay.Value, vnetSubnetId.Value, podSubnetId.Value, Optional.ToNullable(maxPods), Optional.ToNullable(osType), Optional.ToNullable(osSku), Optional.ToNullable(maxCount), Optional.ToNullable(minCount), Optional.ToNullable(enableAutoScaling), Optional.ToNullable(scaleDownMode), Optional.ToNullable(type), Optional.ToNullable(mode), orchestratorVersion.Value, currentOrchestratorVersion.Value, nodeImageVersion.Value, upgradeSettings.Value, provisioningState.Value, powerState.Value, Optional.ToList(availabilityZones), Optional.ToNullable(enableNodePublicIP), Optional.ToNullable(enableCustomCATrust), nodePublicIPPrefixId.Value, Optional.ToNullable(scaleSetPriority), Optional.ToNullable(scaleSetEvictionPolicy), Optional.ToNullable(spotMaxPrice), Optional.ToDictionary(tags), Optional.ToDictionary(nodeLabels), Optional.ToList(nodeTaints), proximityPlacementGroupId.Value, kubeletConfig.Value, linuxOSConfig.Value, Optional.ToNullable(enableEncryptionAtHost), Optional.ToNullable(enableUltraSsd), Optional.ToNullable(enableFIPS), Optional.ToNullable(gpuInstanceProfile), creationData.Value, capacityReservationGroupId.Value, hostGroupId.Value, windowsProfile.Value, networkProfile.Value, name, serializedAdditionalRawData); + } + + ManagedClusterAgentPoolProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAgentPoolProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAgentPoolProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAgentPoolProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAgentPoolProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterAgentPoolProfile(Optional.ToNullable(count), vmSize.Value, Optional.ToNullable(osDiskSizeGB), Optional.ToNullable(osDiskType), Optional.ToNullable(kubeletDiskType), Optional.ToNullable(workloadRuntime), messageOfTheDay.Value, vnetSubnetId.Value, podSubnetId.Value, Optional.ToNullable(maxPods), Optional.ToNullable(osType), Optional.ToNullable(osSku), Optional.ToNullable(maxCount), Optional.ToNullable(minCount), Optional.ToNullable(enableAutoScaling), Optional.ToNullable(scaleDownMode), Optional.ToNullable(type), Optional.ToNullable(mode), orchestratorVersion.Value, currentOrchestratorVersion.Value, nodeImageVersion.Value, upgradeSettings.Value, provisioningState.Value, powerState.Value, Optional.ToList(availabilityZones), Optional.ToNullable(enableNodePublicIP), Optional.ToNullable(enableCustomCATrust), nodePublicIPPrefixId.Value, Optional.ToNullable(scaleSetPriority), Optional.ToNullable(scaleSetEvictionPolicy), Optional.ToNullable(spotMaxPrice), Optional.ToDictionary(tags), Optional.ToDictionary(nodeLabels), Optional.ToList(nodeTaints), proximityPlacementGroupId.Value, kubeletConfig.Value, linuxOSConfig.Value, Optional.ToNullable(enableEncryptionAtHost), Optional.ToNullable(enableUltraSsd), Optional.ToNullable(enableFIPS), Optional.ToNullable(gpuInstanceProfile), creationData.Value, capacityReservationGroupId.Value, hostGroupId.Value, windowsProfile.Value, networkProfile.Value, name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAgentPoolProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAgentPoolProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 3199e7835874..82cfd54b7679 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.ContainerService.Models /// Profile for the container service agent pool. public partial class ManagedClusterAgentPoolProfile : ManagedClusterAgentPoolProfileProperties { - /// Initializes a new instance of ManagedClusterAgentPoolProfile. + /// Initializes a new instance of . /// Windows agent pool names must be 6 characters or less. /// is null. public ManagedClusterAgentPoolProfile(string name) @@ -24,7 +24,7 @@ public ManagedClusterAgentPoolProfile(string name) Name = name; } - /// Initializes a new instance of ManagedClusterAgentPoolProfile. + /// Initializes a new instance of . /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. @@ -72,11 +72,17 @@ public ManagedClusterAgentPoolProfile(string name) /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. /// Windows agent pool names must be 6 characters or less. - internal ManagedClusterAgentPoolProfile(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, string name) : base(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationData, capacityReservationGroupId, hostGroupId, windowsProfile, networkProfile) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAgentPoolProfile(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, string name, Dictionary serializedAdditionalRawData) : base(count, vmSize, osDiskSizeInGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetId, podSubnetId, maxPods, osType, osSku, maxCount, minCount, enableAutoScaling, scaleDownMode, agentPoolType, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixId, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupId, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSsd, enableFips, gpuInstanceProfile, creationData, capacityReservationGroupId, hostGroupId, windowsProfile, networkProfile, serializedAdditionalRawData) { Name = name; } + /// Initializes a new instance of for deserialization. + internal ManagedClusterAgentPoolProfile() + { + } + /// Windows agent pool names must be 6 characters or less. public string Name { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs index 7b74552e926c..a39ff39e42ff 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAgentPoolProfileProperties : IUtf8JsonSerializable + public partial class ManagedClusterAgentPoolProfileProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Count)) { @@ -114,12 +121,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UpgradeSettings)) { writer.WritePropertyName("upgradeSettings"u8); - writer.WriteObjectValue(UpgradeSettings); + if (UpgradeSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpgradeSettings).Serialize(writer, options); + } } if (Optional.IsDefined(PowerState)) { writer.WritePropertyName("powerState"u8); - writer.WriteObjectValue(PowerState); + if (PowerState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PowerState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AvailabilityZones)) { @@ -201,12 +222,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KubeletConfig)) { writer.WritePropertyName("kubeletConfig"u8); - writer.WriteObjectValue(KubeletConfig); + if (KubeletConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubeletConfig).Serialize(writer, options); + } } if (Optional.IsDefined(LinuxOSConfig)) { writer.WritePropertyName("linuxOSConfig"u8); - writer.WriteObjectValue(LinuxOSConfig); + if (LinuxOSConfig is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinuxOSConfig).Serialize(writer, options); + } } if (Optional.IsDefined(EnableEncryptionAtHost)) { @@ -231,7 +266,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(CapacityReservationGroupId)) { @@ -246,18 +288,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WindowsProfile)) { writer.WritePropertyName("windowsProfile"u8); - writer.WriteObjectValue(WindowsProfile); + if (WindowsProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WindowsProfile).Serialize(writer, options); + } } if (Optional.IsDefined(NetworkProfile)) { writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile); + if (NetworkProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NetworkProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClusterAgentPoolProfileProperties(JsonElement element) + internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClusterAgentPoolProfileProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -308,6 +378,7 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust Optional hostGroupId = default; Optional windowsProfile = default; Optional networkProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -720,8 +791,61 @@ internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClust networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAgentPoolProfileProperties(Optional.ToNullable(count), vmSize.Value, Optional.ToNullable(osDiskSizeGB), Optional.ToNullable(osDiskType), Optional.ToNullable(kubeletDiskType), Optional.ToNullable(workloadRuntime), messageOfTheDay.Value, vnetSubnetId.Value, podSubnetId.Value, Optional.ToNullable(maxPods), Optional.ToNullable(osType), Optional.ToNullable(osSku), Optional.ToNullable(maxCount), Optional.ToNullable(minCount), Optional.ToNullable(enableAutoScaling), Optional.ToNullable(scaleDownMode), Optional.ToNullable(type), Optional.ToNullable(mode), orchestratorVersion.Value, currentOrchestratorVersion.Value, nodeImageVersion.Value, upgradeSettings.Value, provisioningState.Value, powerState.Value, Optional.ToList(availabilityZones), Optional.ToNullable(enableNodePublicIP), Optional.ToNullable(enableCustomCATrust), nodePublicIPPrefixId.Value, Optional.ToNullable(scaleSetPriority), Optional.ToNullable(scaleSetEvictionPolicy), Optional.ToNullable(spotMaxPrice), Optional.ToDictionary(tags), Optional.ToDictionary(nodeLabels), Optional.ToList(nodeTaints), proximityPlacementGroupId.Value, kubeletConfig.Value, linuxOSConfig.Value, Optional.ToNullable(enableEncryptionAtHost), Optional.ToNullable(enableUltraSsd), Optional.ToNullable(enableFIPS), Optional.ToNullable(gpuInstanceProfile), creationData.Value, capacityReservationGroupId.Value, hostGroupId.Value, windowsProfile.Value, networkProfile.Value, serializedAdditionalRawData); + } + + ManagedClusterAgentPoolProfileProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAgentPoolProfileProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAgentPoolProfileProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAgentPoolProfileProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAgentPoolProfileProperties model) + { + if (model is null) + { + return null; } - return new ManagedClusterAgentPoolProfileProperties(Optional.ToNullable(count), vmSize.Value, Optional.ToNullable(osDiskSizeGB), Optional.ToNullable(osDiskType), Optional.ToNullable(kubeletDiskType), Optional.ToNullable(workloadRuntime), messageOfTheDay.Value, vnetSubnetId.Value, podSubnetId.Value, Optional.ToNullable(maxPods), Optional.ToNullable(osType), Optional.ToNullable(osSku), Optional.ToNullable(maxCount), Optional.ToNullable(minCount), Optional.ToNullable(enableAutoScaling), Optional.ToNullable(scaleDownMode), Optional.ToNullable(type), Optional.ToNullable(mode), orchestratorVersion.Value, currentOrchestratorVersion.Value, nodeImageVersion.Value, upgradeSettings.Value, provisioningState.Value, powerState.Value, Optional.ToList(availabilityZones), Optional.ToNullable(enableNodePublicIP), Optional.ToNullable(enableCustomCATrust), nodePublicIPPrefixId.Value, Optional.ToNullable(scaleSetPriority), Optional.ToNullable(scaleSetEvictionPolicy), Optional.ToNullable(spotMaxPrice), Optional.ToDictionary(tags), Optional.ToDictionary(nodeLabels), Optional.ToList(nodeTaints), proximityPlacementGroupId.Value, kubeletConfig.Value, linuxOSConfig.Value, Optional.ToNullable(enableEncryptionAtHost), Optional.ToNullable(enableUltraSsd), Optional.ToNullable(enableFIPS), Optional.ToNullable(gpuInstanceProfile), creationData.Value, capacityReservationGroupId.Value, hostGroupId.Value, windowsProfile.Value, networkProfile.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAgentPoolProfileProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAgentPoolProfileProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index cec5e144be97..2727be604ba2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Properties for the container service agent pool profile. public partial class ManagedClusterAgentPoolProfileProperties { - /// Initializes a new instance of ManagedClusterAgentPoolProfileProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterAgentPoolProfileProperties() { AvailabilityZones = new ChangeTrackingList(); @@ -22,7 +26,7 @@ public ManagedClusterAgentPoolProfileProperties() NodeTaints = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterAgentPoolProfileProperties. + /// Initializes a new instance of . /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. /// VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. /// OS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. @@ -69,7 +73,8 @@ public ManagedClusterAgentPoolProfileProperties() /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). /// The Windows agent pool's specific profile. /// Network-related settings of an agent pool. - internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int? osDiskSizeInGB, ContainerServiceOSDiskType? osDiskType, KubeletDiskType? kubeletDiskType, WorkloadRuntime? workloadRuntime, string messageOfTheDay, ResourceIdentifier vnetSubnetId, ResourceIdentifier podSubnetId, int? maxPods, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, int? maxCount, int? minCount, bool? enableAutoScaling, ScaleDownMode? scaleDownMode, AgentPoolType? agentPoolType, AgentPoolMode? mode, string orchestratorVersion, string currentOrchestratorVersion, string nodeImageVersion, AgentPoolUpgradeSettings upgradeSettings, string provisioningState, ContainerServicePowerState powerState, IList availabilityZones, bool? enableNodePublicIP, bool? enableCustomCATrust, ResourceIdentifier nodePublicIPPrefixId, ScaleSetPriority? scaleSetPriority, ScaleSetEvictionPolicy? scaleSetEvictionPolicy, float? spotMaxPrice, IDictionary tags, IDictionary nodeLabels, IList nodeTaints, ResourceIdentifier proximityPlacementGroupId, KubeletConfig kubeletConfig, LinuxOSConfig linuxOSConfig, bool? enableEncryptionAtHost, bool? enableUltraSsd, bool? enableFips, GpuInstanceProfile? gpuInstanceProfile, ContainerServiceCreationData creationData, ResourceIdentifier capacityReservationGroupId, ResourceIdentifier hostGroupId, AgentPoolWindowsProfile windowsProfile, AgentPoolNetworkProfile networkProfile, Dictionary serializedAdditionalRawData) { Count = count; VmSize = vmSize; @@ -117,6 +122,7 @@ internal ManagedClusterAgentPoolProfileProperties(int? count, string vmSize, int HostGroupId = hostGroupId; WindowsProfile = windowsProfile; NetworkProfile = networkProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs index 8db0c8fe95cd..bbde736f0536 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterApiServerAccessProfile : IUtf8JsonSerializable + public partial class ManagedClusterApiServerAccessProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AuthorizedIPRanges)) { @@ -56,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("subnetId"u8); writer.WriteStringValue(SubnetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterApiServerAccessProfile(JsonElement element) + internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterApiServerAccessProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +93,7 @@ internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterAp Optional disableRunCommand = default; Optional enableVnetIntegration = default; Optional subnetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authorizedIPRanges"u8)) @@ -138,8 +160,61 @@ internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterAp subnetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterApiServerAccessProfile(Optional.ToList(authorizedIPRanges), Optional.ToNullable(enablePrivateCluster), privateDnsZone.Value, Optional.ToNullable(enablePrivateClusterPublicFQDN), Optional.ToNullable(disableRunCommand), Optional.ToNullable(enableVnetIntegration), subnetId.Value, serializedAdditionalRawData); + } + + ManagedClusterApiServerAccessProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterApiServerAccessProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterApiServerAccessProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterApiServerAccessProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterApiServerAccessProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterApiServerAccessProfile(Optional.ToList(authorizedIPRanges), Optional.ToNullable(enablePrivateCluster), privateDnsZone.Value, Optional.ToNullable(enablePrivateClusterPublicFQDN), Optional.ToNullable(disableRunCommand), Optional.ToNullable(enableVnetIntegration), subnetId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterApiServerAccessProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterApiServerAccessProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs index 65b1f3eb05bf..0b09ec912daf 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.ContainerService.Models /// Access profile for managed cluster API server. public partial class ManagedClusterApiServerAccessProfile { - /// Initializes a new instance of ManagedClusterApiServerAccessProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterApiServerAccessProfile() { AuthorizedIPRanges = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterApiServerAccessProfile. + /// Initializes a new instance of . /// IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). /// For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). /// The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. @@ -27,7 +31,8 @@ public ManagedClusterApiServerAccessProfile() /// Whether to disable run command for the cluster or not. /// Whether to enable apiserver vnet integration for the cluster or not. /// It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an existing cluster to enable apiserver vnet integration. - internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, bool? enablePrivateCluster, string privateDnsZone, bool? enablePrivateClusterPublicFqdn, bool? disableRunCommand, bool? enableVnetIntegration, ResourceIdentifier subnetId) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, bool? enablePrivateCluster, string privateDnsZone, bool? enablePrivateClusterPublicFqdn, bool? disableRunCommand, bool? enableVnetIntegration, ResourceIdentifier subnetId, Dictionary serializedAdditionalRawData) { AuthorizedIPRanges = authorizedIPRanges; EnablePrivateCluster = enablePrivateCluster; @@ -36,6 +41,7 @@ internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, DisableRunCommand = disableRunCommand; EnableVnetIntegration = enableVnetIntegration; SubnetId = subnetId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs index 6d35f5a0fbdb..b366c11d223f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAutoScalerProfile : IUtf8JsonSerializable + public partial class ManagedClusterAutoScalerProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BalanceSimilarNodeGroups)) { @@ -100,11 +108,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("skip-nodes-with-system-pods"u8); writer.WriteStringValue(SkipNodesWithSystemPods); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoScalerProfile(JsonElement element) + internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoScalerProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -126,6 +148,7 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca Optional scaleDownUtilizationThreshold = default; Optional skipNodesWithLocalStorage = default; Optional skipNodesWithSystemPods = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("balance-similar-node-groups"u8)) @@ -217,8 +240,61 @@ internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoSca skipNodesWithSystemPods = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAutoScalerProfile(balanceSimilarNodeGroups.Value, Optional.ToNullable(expander), maxEmptyBulkDelete.Value, maxGracefulTerminationSec.Value, maxNodeProvisionTime.Value, maxTotalUnreadyPercentage.Value, newPodScaleUpDelay.Value, okTotalUnreadyCount.Value, scanInterval.Value, scaleDownDelayAfterAdd.Value, scaleDownDelayAfterDelete.Value, scaleDownDelayAfterFailure.Value, scaleDownUnneededTime.Value, scaleDownUnreadyTime.Value, scaleDownUtilizationThreshold.Value, skipNodesWithLocalStorage.Value, skipNodesWithSystemPods.Value, serializedAdditionalRawData); + } + + ManagedClusterAutoScalerProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAutoScalerProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAutoScalerProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAutoScalerProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAutoScalerProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterAutoScalerProfile(balanceSimilarNodeGroups.Value, Optional.ToNullable(expander), maxEmptyBulkDelete.Value, maxGracefulTerminationSec.Value, maxNodeProvisionTime.Value, maxTotalUnreadyPercentage.Value, newPodScaleUpDelay.Value, okTotalUnreadyCount.Value, scanInterval.Value, scaleDownDelayAfterAdd.Value, scaleDownDelayAfterDelete.Value, scaleDownDelayAfterFailure.Value, scaleDownUnneededTime.Value, scaleDownUnreadyTime.Value, scaleDownUtilizationThreshold.Value, skipNodesWithLocalStorage.Value, skipNodesWithSystemPods.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAutoScalerProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAutoScalerProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs index c98ff672027b..546e0e524e0a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Parameters to be applied to the cluster-autoscaler when enabled. public partial class ManagedClusterAutoScalerProfile { - /// Initializes a new instance of ManagedClusterAutoScalerProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterAutoScalerProfile() { } - /// Initializes a new instance of ManagedClusterAutoScalerProfile. + /// Initializes a new instance of . /// Valid values are 'true' and 'false'. /// If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. /// The default is 10. @@ -33,7 +39,8 @@ public ManagedClusterAutoScalerProfile() /// The default is '0.5'. /// The default is true. /// The default is true. - internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoScaleExpander? expander, string maxEmptyBulkDelete, string maxGracefulTerminationSec, string maxNodeProvisionTime, string maxTotalUnreadyPercentage, string newPodScaleUpDelay, string okTotalUnreadyCount, string scanIntervalInSeconds, string scaleDownDelayAfterAdd, string scaleDownDelayAfterDelete, string scaleDownDelayAfterFailure, string scaleDownUnneededTime, string scaleDownUnreadyTime, string scaleDownUtilizationThreshold, string skipNodesWithLocalStorage, string skipNodesWithSystemPods) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoScaleExpander? expander, string maxEmptyBulkDelete, string maxGracefulTerminationSec, string maxNodeProvisionTime, string maxTotalUnreadyPercentage, string newPodScaleUpDelay, string okTotalUnreadyCount, string scanIntervalInSeconds, string scaleDownDelayAfterAdd, string scaleDownDelayAfterDelete, string scaleDownDelayAfterFailure, string scaleDownUnneededTime, string scaleDownUnreadyTime, string scaleDownUtilizationThreshold, string skipNodesWithLocalStorage, string skipNodesWithSystemPods, Dictionary serializedAdditionalRawData) { BalanceSimilarNodeGroups = balanceSimilarNodeGroups; Expander = expander; @@ -52,6 +59,7 @@ internal ManagedClusterAutoScalerProfile(string balanceSimilarNodeGroups, AutoSc ScaleDownUtilizationThreshold = scaleDownUtilizationThreshold; SkipNodesWithLocalStorage = skipNodesWithLocalStorage; SkipNodesWithSystemPods = skipNodesWithSystemPods; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Valid values are 'true' and 'false'. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs index e3d49663c5cd..fa53abbb41f6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterAutoUpgradeProfile : IUtf8JsonSerializable + public partial class ManagedClusterAutoUpgradeProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UpgradeChannel)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("nodeOSUpgradeChannel"u8); writer.WriteStringValue(NodeOSUpgradeChannel.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterAutoUpgradeProfile DeserializeManagedClusterAutoUpgradeProfile(JsonElement element) + internal static ManagedClusterAutoUpgradeProfile DeserializeManagedClusterAutoUpgradeProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional upgradeChannel = default; Optional nodeOSUpgradeChannel = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("upgradeChannel"u8)) @@ -56,8 +79,61 @@ internal static ManagedClusterAutoUpgradeProfile DeserializeManagedClusterAutoUp nodeOSUpgradeChannel = new ManagedClusterNodeOSUpgradeChannel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAutoUpgradeProfile(Optional.ToNullable(upgradeChannel), Optional.ToNullable(nodeOSUpgradeChannel), serializedAdditionalRawData); + } + + ManagedClusterAutoUpgradeProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAutoUpgradeProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAutoUpgradeProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAutoUpgradeProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAutoUpgradeProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterAutoUpgradeProfile(Optional.ToNullable(upgradeChannel), Optional.ToNullable(nodeOSUpgradeChannel)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAutoUpgradeProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAutoUpgradeProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs index 17e2932e184b..e52a0e68b5fd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Auto upgrade profile for a managed cluster. public partial class ManagedClusterAutoUpgradeProfile { - /// Initializes a new instance of ManagedClusterAutoUpgradeProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterAutoUpgradeProfile() { } - /// Initializes a new instance of ManagedClusterAutoUpgradeProfile. + /// Initializes a new instance of . /// For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). /// The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA. - internal ManagedClusterAutoUpgradeProfile(UpgradeChannel? upgradeChannel, ManagedClusterNodeOSUpgradeChannel? nodeOSUpgradeChannel) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAutoUpgradeProfile(UpgradeChannel? upgradeChannel, ManagedClusterNodeOSUpgradeChannel? nodeOSUpgradeChannel, Dictionary serializedAdditionalRawData) { UpgradeChannel = upgradeChannel; NodeOSUpgradeChannel = nodeOSUpgradeChannel; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs index 99c1d53c8c84..07016755a597 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterAzureMonitorProfile : IUtf8JsonSerializable + internal partial class ManagedClusterAzureMonitorProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Metrics)) { writer.WritePropertyName("metrics"u8); - writer.WriteObjectValue(Metrics); + if (Metrics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Metrics).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterAzureMonitorProfile DeserializeManagedClusterAzureMonitorProfile(JsonElement element) + internal static ManagedClusterAzureMonitorProfile DeserializeManagedClusterAzureMonitorProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional metrics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metrics"u8)) @@ -41,8 +71,61 @@ internal static ManagedClusterAzureMonitorProfile DeserializeManagedClusterAzure metrics = ManagedClusterMonitorProfileMetrics.DeserializeManagedClusterMonitorProfileMetrics(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterAzureMonitorProfile(metrics.Value, serializedAdditionalRawData); + } + + ManagedClusterAzureMonitorProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterAzureMonitorProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterAzureMonitorProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterAzureMonitorProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterAzureMonitorProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterAzureMonitorProfile(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterAzureMonitorProfile(metrics.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterAzureMonitorProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs index bdccfd01c7af..3a216f548c9a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Prometheus addon profile for the container service cluster. internal partial class ManagedClusterAzureMonitorProfile { - /// Initializes a new instance of ManagedClusterAzureMonitorProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterAzureMonitorProfile() { } - /// Initializes a new instance of ManagedClusterAzureMonitorProfile. + /// Initializes a new instance of . /// Metrics profile for the prometheus service addon. - internal ManagedClusterAzureMonitorProfile(ManagedClusterMonitorProfileMetrics metrics) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterAzureMonitorProfile(ManagedClusterMonitorProfileMetrics metrics, Dictionary serializedAdditionalRawData) { Metrics = metrics; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Metrics profile for the prometheus service addon. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs index 751a6ab7639b..92077e26db59 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterCredential + public partial class ManagedClusterCredential : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterCredential DeserializeManagedClusterCredential(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterCredential DeserializeManagedClusterCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +65,61 @@ internal static ManagedClusterCredential DeserializeManagedClusterCredential(Jso value = property.Value.GetBytesFromBase64("D"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterCredential(name.Value, value.Value); + return new ManagedClusterCredential(name.Value, value.Value, serializedAdditionalRawData); + } + + ManagedClusterCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterCredential model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.cs index db19f318382f..9dfed23b5e16 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerService.Models { /// The credential result response. public partial class ManagedClusterCredential { - /// Initializes a new instance of ManagedClusterCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterCredential() { } - /// Initializes a new instance of ManagedClusterCredential. + /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. - internal ManagedClusterCredential(string name, byte[] value) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterCredential(string name, byte[] value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the credential. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs index b59263f0269d..7c6a3b27f373 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterCredentials + public partial class ManagedClusterCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> kubeconfigs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kubeconfigs"u8)) @@ -36,8 +64,61 @@ internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(J kubeconfigs = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterCredentials(Optional.ToList(kubeconfigs)); + return new ManagedClusterCredentials(Optional.ToList(kubeconfigs), serializedAdditionalRawData); + } + + ManagedClusterCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterCredentials model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.cs index dcdd923adfc4..b9f1398147ff 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.ContainerService.Models /// The list credential result response. public partial class ManagedClusterCredentials { - /// Initializes a new instance of ManagedClusterCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterCredentials() { Kubeconfigs = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterCredentials. + /// Initializes a new instance of . /// Base64-encoded Kubernetes configuration file. - internal ManagedClusterCredentials(IReadOnlyList kubeconfigs) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterCredentials(IReadOnlyList kubeconfigs, Dictionary serializedAdditionalRawData) { Kubeconfigs = kubeconfigs; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Base64-encoded Kubernetes configuration file. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.Serialization.cs index 732fd4c26c54..151a12b8994f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterGuardrailsProfile : IUtf8JsonSerializable + public partial class ManagedClusterGuardrailsProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterGuardrailsProfile DeserializeManagedClusterGuardrailsProfile(JsonElement element) + internal static ManagedClusterGuardrailsProfile DeserializeManagedClusterGuardrailsProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static ManagedClusterGuardrailsProfile DeserializeManagedClusterGuardra string version = default; ManagedClusterGuardrailsProfileLevel level = default; Optional> excludedNamespaces = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("systemExcludedNamespaces"u8)) @@ -83,8 +105,61 @@ internal static ManagedClusterGuardrailsProfile DeserializeManagedClusterGuardra excludedNamespaces = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterGuardrailsProfile(Optional.ToList(systemExcludedNamespaces), version, level, Optional.ToList(excludedNamespaces), serializedAdditionalRawData); + } + + ManagedClusterGuardrailsProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterGuardrailsProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterGuardrailsProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterGuardrailsProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterGuardrailsProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterGuardrailsProfile(Optional.ToList(systemExcludedNamespaces), version, level, Optional.ToList(excludedNamespaces)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterGuardrailsProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterGuardrailsProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.cs index d3e83b15756c..97f9f2391702 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterGuardrailsProfile.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// The Guardrails profile. public partial class ManagedClusterGuardrailsProfile { - /// Initializes a new instance of ManagedClusterGuardrailsProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The version of constraints to use. /// The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. /// is null. @@ -28,17 +31,24 @@ public ManagedClusterGuardrailsProfile(string version, ManagedClusterGuardrailsP ExcludedNamespaces = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterGuardrailsProfile. + /// Initializes a new instance of . /// List of namespaces specified by AKS to be excluded from Guardrails. /// The version of constraints to use. /// The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes via systemExcludedNamespaces. /// List of namespaces excluded from guardrails checks. - internal ManagedClusterGuardrailsProfile(IReadOnlyList systemExcludedNamespaces, string version, ManagedClusterGuardrailsProfileLevel level, IList excludedNamespaces) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterGuardrailsProfile(IReadOnlyList systemExcludedNamespaces, string version, ManagedClusterGuardrailsProfileLevel level, IList excludedNamespaces, Dictionary serializedAdditionalRawData) { SystemExcludedNamespaces = systemExcludedNamespaces; Version = version; Level = level; ExcludedNamespaces = excludedNamespaces; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterGuardrailsProfile() + { } /// List of namespaces specified by AKS to be excluded from Guardrails. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs index f172b999a542..e47e8ed000bc 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterHttpProxyConfig : IUtf8JsonSerializable + public partial class ManagedClusterHttpProxyConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HttpProxy)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("trustedCa"u8); writer.WriteStringValue(TrustedCA); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxyConfig(JsonElement element) + internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxyConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxy Optional> noProxy = default; Optional> effectiveNoProxy = default; Optional trustedCA = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("httpProxy"u8)) @@ -100,8 +122,61 @@ internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxy trustedCA = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterHttpProxyConfig(httpProxy.Value, httpsProxy.Value, Optional.ToList(noProxy), Optional.ToList(effectiveNoProxy), trustedCA.Value, serializedAdditionalRawData); + } + + ManagedClusterHttpProxyConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterHttpProxyConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterHttpProxyConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterHttpProxyConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterHttpProxyConfig model) + { + if (model is null) + { + return null; } - return new ManagedClusterHttpProxyConfig(httpProxy.Value, httpsProxy.Value, Optional.ToList(noProxy), Optional.ToList(effectiveNoProxy), trustedCA.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterHttpProxyConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterHttpProxyConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs index 7358246cecc8..32492e122442 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.ResourceManager.ContainerService.Models /// Cluster HTTP proxy configuration. public partial class ManagedClusterHttpProxyConfig { - /// Initializes a new instance of ManagedClusterHttpProxyConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterHttpProxyConfig() { NoProxy = new ChangeTrackingList(); EffectiveNoProxy = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterHttpProxyConfig. + /// Initializes a new instance of . /// The HTTP proxy server endpoint to use. /// The HTTPS proxy server endpoint to use. /// The endpoints that should not go through proxy. /// A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS. /// Alternative CA cert to use for connecting to proxy servers. - internal ManagedClusterHttpProxyConfig(string httpProxy, string httpsProxy, IList noProxy, IReadOnlyList effectiveNoProxy, string trustedCA) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterHttpProxyConfig(string httpProxy, string httpsProxy, IList noProxy, IReadOnlyList effectiveNoProxy, string trustedCA, Dictionary serializedAdditionalRawData) { HttpProxy = httpProxy; HttpsProxy = httpsProxy; NoProxy = noProxy; EffectiveNoProxy = effectiveNoProxy; TrustedCA = trustedCA; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The HTTP proxy server endpoint to use. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs index 2e1ad74dabfb..ddf2f38c0295 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterIngressProfile : IUtf8JsonSerializable + internal partial class ManagedClusterIngressProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WebAppRouting)) { writer.WritePropertyName("webAppRouting"u8); - writer.WriteObjectValue(WebAppRouting); + if (WebAppRouting is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WebAppRouting).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterIngressProfile DeserializeManagedClusterIngressProfile(JsonElement element) + internal static ManagedClusterIngressProfile DeserializeManagedClusterIngressProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional webAppRouting = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("webAppRouting"u8)) @@ -41,8 +71,61 @@ internal static ManagedClusterIngressProfile DeserializeManagedClusterIngressPro webAppRouting = ManagedClusterIngressProfileWebAppRouting.DeserializeManagedClusterIngressProfileWebAppRouting(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterIngressProfile(webAppRouting.Value, serializedAdditionalRawData); + } + + ManagedClusterIngressProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterIngressProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterIngressProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterIngressProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterIngressProfile(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterIngressProfile(webAppRouting.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterIngressProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs index 4203cf68ef36..0fd15df9b15e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Ingress profile for the container service cluster. internal partial class ManagedClusterIngressProfile { - /// Initializes a new instance of ManagedClusterIngressProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterIngressProfile() { } - /// Initializes a new instance of ManagedClusterIngressProfile. + /// Initializes a new instance of . /// Web App Routing settings for the ingress profile. - internal ManagedClusterIngressProfile(ManagedClusterIngressProfileWebAppRouting webAppRouting) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfile(ManagedClusterIngressProfileWebAppRouting webAppRouting, Dictionary serializedAdditionalRawData) { WebAppRouting = webAppRouting; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Web App Routing settings for the ingress profile. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs index 63478798350c..5ab49a0dccfc 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterIngressProfileWebAppRouting : IUtf8JsonSerializable + public partial class ManagedClusterIngressProfileWebAppRouting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dnsZoneResourceId"u8); writer.WriteStringValue(DnsZoneResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterIngressProfileWebAppRouting DeserializeManagedClusterIngressProfileWebAppRouting(JsonElement element) + internal static ManagedClusterIngressProfileWebAppRouting DeserializeManagedClusterIngressProfileWebAppRouting(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional dnsZoneResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -56,8 +79,61 @@ internal static ManagedClusterIngressProfileWebAppRouting DeserializeManagedClus dnsZoneResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterIngressProfileWebAppRouting(Optional.ToNullable(enabled), dnsZoneResourceId.Value, serializedAdditionalRawData); + } + + ManagedClusterIngressProfileWebAppRouting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterIngressProfileWebAppRouting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterIngressProfileWebAppRouting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterIngressProfileWebAppRouting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterIngressProfileWebAppRouting model) + { + if (model is null) + { + return null; } - return new ManagedClusterIngressProfileWebAppRouting(Optional.ToNullable(enabled), dnsZoneResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterIngressProfileWebAppRouting(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterIngressProfileWebAppRouting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs index 064240f2d6dd..8f588dc4d11f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.ContainerService.Models /// Web App Routing settings for the ingress profile. public partial class ManagedClusterIngressProfileWebAppRouting { - /// Initializes a new instance of ManagedClusterIngressProfileWebAppRouting. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterIngressProfileWebAppRouting() { } - /// Initializes a new instance of ManagedClusterIngressProfileWebAppRouting. + /// Initializes a new instance of . /// Whether to enable Web App Routing. /// Resource ID of the DNS Zone to be associated with the web app. Used only when Web App Routing is enabled. - internal ManagedClusterIngressProfileWebAppRouting(bool? isEnabled, ResourceIdentifier dnsZoneResourceId) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterIngressProfileWebAppRouting(bool? isEnabled, ResourceIdentifier dnsZoneResourceId, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; DnsZoneResourceId = dnsZoneResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable Web App Routing. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs index a146f91c9a40..b039a15cde24 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterListResult + internal partial class ManagedClusterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterListResult DeserializeManagedClusterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterListResult DeserializeManagedClusterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ManagedClusterListResult DeserializeManagedClusterListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterListResult(Optional.ToList(value), nextLink.Value); + return new ManagedClusterListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ManagedClusterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs index 1cd51e4e2d2a..118fcbd92784 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List Managed Clusters operation. internal partial class ManagedClusterListResult { - /// Initializes a new instance of ManagedClusterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterListResult. + /// Initializes a new instance of . /// The list of managed clusters. /// The URL to get the next set of managed cluster results. - internal ManagedClusterListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of managed clusters. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs index 1d7af34551ef..f2cf8248d723 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs @@ -5,32 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterLoadBalancerProfile : IUtf8JsonSerializable + public partial class ManagedClusterLoadBalancerProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ManagedOutboundIPs)) { writer.WritePropertyName("managedOutboundIPs"u8); - writer.WriteObjectValue(ManagedOutboundIPs); + if (ManagedOutboundIPs is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedOutboundIPs).Serialize(writer, options); + } } if (Optional.IsDefined(OutboundIPPrefixes)) { writer.WritePropertyName("outboundIPPrefixes"u8); - writer.WriteObjectValue(OutboundIPPrefixes); + if (OutboundIPPrefixes is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OutboundIPPrefixes).Serialize(writer, options); + } } if (Optional.IsDefined(OutboundIPs)) { writer.WritePropertyName("outboundIPs"u8); - writer.WriteObjectValue(OutboundIPs); + if (OutboundIPs is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)OutboundIPs).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) { @@ -62,11 +90,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("backendPoolType"u8); writer.WriteStringValue(BackendPoolType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadBalancerProfile(JsonElement element) + internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadBalancerProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +121,7 @@ internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadB Optional idleTimeoutInMinutes = default; Optional enableMultipleStandardLoadBalancers = default; Optional backendPoolType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedOutboundIPs"u8)) @@ -158,8 +201,61 @@ internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadB backendPoolType = new ManagedClusterLoadBalancerBackendPoolType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterLoadBalancerProfile(managedOutboundIPs.Value, outboundIPPrefixes.Value, outboundIPs.Value, Optional.ToList(effectiveOutboundIPs), Optional.ToNullable(allocatedOutboundPorts), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableMultipleStandardLoadBalancers), Optional.ToNullable(backendPoolType), serializedAdditionalRawData); + } + + ManagedClusterLoadBalancerProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterLoadBalancerProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterLoadBalancerProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterLoadBalancerProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterLoadBalancerProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterLoadBalancerProfile(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterLoadBalancerProfile(managedOutboundIPs.Value, outboundIPPrefixes.Value, outboundIPs.Value, Optional.ToList(effectiveOutboundIPs), Optional.ToNullable(allocatedOutboundPorts), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableMultipleStandardLoadBalancers), Optional.ToNullable(backendPoolType)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterLoadBalancerProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs index b3d3cc57d2e7..9d05bf80db9b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.ContainerService.Models /// Profile of the managed cluster load balancer. public partial class ManagedClusterLoadBalancerProfile { - /// Initializes a new instance of ManagedClusterLoadBalancerProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterLoadBalancerProfile() { EffectiveOutboundIPs = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterLoadBalancerProfile. + /// Initializes a new instance of . /// Desired managed outbound IPs for the cluster load balancer. /// Desired outbound IP Prefix resources for the cluster load balancer. /// Desired outbound IP resources for the cluster load balancer. @@ -29,7 +33,8 @@ public ManagedClusterLoadBalancerProfile() /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. /// Enable multiple standard load balancers per AKS cluster or not. /// The type of the managed inbound Load Balancer BackendPool. - internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs, ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes, ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs, IList effectiveOutboundIPs, int? allocatedOutboundPorts, int? idleTimeoutInMinutes, bool? enableMultipleStandardLoadBalancers, ManagedClusterLoadBalancerBackendPoolType? backendPoolType) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs, ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes, ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs, IList effectiveOutboundIPs, int? allocatedOutboundPorts, int? idleTimeoutInMinutes, bool? enableMultipleStandardLoadBalancers, ManagedClusterLoadBalancerBackendPoolType? backendPoolType, Dictionary serializedAdditionalRawData) { ManagedOutboundIPs = managedOutboundIPs; OutboundIPPrefixes = outboundIPPrefixes; @@ -39,6 +44,7 @@ internal ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileMana IdleTimeoutInMinutes = idleTimeoutInMinutes; EnableMultipleStandardLoadBalancers = enableMultipleStandardLoadBalancers; BackendPoolType = backendPoolType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Desired managed outbound IPs for the cluster load balancer. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs index 85282a1214e8..6894cbbbbc9f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs : IUtf8JsonSerializable + public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Count)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("countIPv6"u8); writer.WriteNumberValue(CountIPv6.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterLoadBalancerProfileManagedOutboundIPs DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(JsonElement element) + internal static ManagedClusterLoadBalancerProfileManagedOutboundIPs DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional count = default; Optional countIPv6 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -56,8 +79,61 @@ internal static ManagedClusterLoadBalancerProfileManagedOutboundIPs DeserializeM countIPv6 = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterLoadBalancerProfileManagedOutboundIPs(Optional.ToNullable(count), Optional.ToNullable(countIPv6), serializedAdditionalRawData); + } + + ManagedClusterLoadBalancerProfileManagedOutboundIPs IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterLoadBalancerProfileManagedOutboundIPs IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterLoadBalancerProfileManagedOutboundIPs model) + { + if (model is null) + { + return null; } - return new ManagedClusterLoadBalancerProfileManagedOutboundIPs(Optional.ToNullable(count), Optional.ToNullable(countIPv6)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterLoadBalancerProfileManagedOutboundIPs(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs index a008ece8a105..d75d8d41c44c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Desired managed outbound IPs for the cluster load balancer. public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs { - /// Initializes a new instance of ManagedClusterLoadBalancerProfileManagedOutboundIPs. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterLoadBalancerProfileManagedOutboundIPs() { } - /// Initializes a new instance of ManagedClusterLoadBalancerProfileManagedOutboundIPs. + /// Initializes a new instance of . /// The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. /// The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. - internal ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count, int? countIPv6) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count, int? countIPv6, Dictionary serializedAdditionalRawData) { Count = count; CountIPv6 = countIPv6; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs index 8180f33181dc..0047c138c137 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes : IUtf8JsonSerializable + internal partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PublicIPPrefixes)) { @@ -27,16 +34,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterLoadBalancerProfileOutboundIPPrefixes DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(JsonElement element) + internal static ManagedClusterLoadBalancerProfileOutboundIPPrefixes DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> publicIPPrefixes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicIPPrefixes"u8)) @@ -53,8 +75,61 @@ internal static ManagedClusterLoadBalancerProfileOutboundIPPrefixes DeserializeM publicIPPrefixes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterLoadBalancerProfileOutboundIPPrefixes(Optional.ToList(publicIPPrefixes), serializedAdditionalRawData); + } + + ManagedClusterLoadBalancerProfileOutboundIPPrefixes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterLoadBalancerProfileOutboundIPPrefixes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterLoadBalancerProfileOutboundIPPrefixes model) + { + if (model is null) + { + return null; } - return new ManagedClusterLoadBalancerProfileOutboundIPPrefixes(Optional.ToList(publicIPPrefixes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterLoadBalancerProfileOutboundIPPrefixes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs index 77fcd4e1fb1a..958d802f0d30 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.ContainerService.Models /// Desired outbound IP Prefix resources for the cluster load balancer. internal partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes { - /// Initializes a new instance of ManagedClusterLoadBalancerProfileOutboundIPPrefixes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterLoadBalancerProfileOutboundIPPrefixes() { PublicIPPrefixes = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterLoadBalancerProfileOutboundIPPrefixes. + /// Initializes a new instance of . /// A list of public IP prefix resources. - internal ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes, Dictionary serializedAdditionalRawData) { PublicIPPrefixes = publicIPPrefixes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of public IP prefix resources. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs index b60aca67ca00..13fed9b9c29a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterLoadBalancerProfileOutboundIPs : IUtf8JsonSerializable + internal partial class ManagedClusterLoadBalancerProfileOutboundIPs : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PublicIPs)) { @@ -27,16 +34,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterLoadBalancerProfileOutboundIPs DeserializeManagedClusterLoadBalancerProfileOutboundIPs(JsonElement element) + internal static ManagedClusterLoadBalancerProfileOutboundIPs DeserializeManagedClusterLoadBalancerProfileOutboundIPs(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> publicIPs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicIPs"u8)) @@ -53,8 +75,61 @@ internal static ManagedClusterLoadBalancerProfileOutboundIPs DeserializeManagedC publicIPs = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterLoadBalancerProfileOutboundIPs(Optional.ToList(publicIPs), serializedAdditionalRawData); + } + + ManagedClusterLoadBalancerProfileOutboundIPs IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterLoadBalancerProfileOutboundIPs(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterLoadBalancerProfileOutboundIPs IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterLoadBalancerProfileOutboundIPs(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterLoadBalancerProfileOutboundIPs model) + { + if (model is null) + { + return null; } - return new ManagedClusterLoadBalancerProfileOutboundIPs(Optional.ToList(publicIPs)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterLoadBalancerProfileOutboundIPs(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterLoadBalancerProfileOutboundIPs(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs index 4682a9ad2cfd..c650b2224ff4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.ContainerService.Models /// Desired outbound IP resources for the cluster load balancer. internal partial class ManagedClusterLoadBalancerProfileOutboundIPs { - /// Initializes a new instance of ManagedClusterLoadBalancerProfileOutboundIPs. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterLoadBalancerProfileOutboundIPs() { PublicIPs = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterLoadBalancerProfileOutboundIPs. + /// Initializes a new instance of . /// A list of public IP resources. - internal ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs, Dictionary serializedAdditionalRawData) { PublicIPs = publicIPs; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of public IP resources. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs index 876288c425e3..17405b97ebdc 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterManagedOutboundIPProfile : IUtf8JsonSerializable + internal partial class ManagedClusterManagedOutboundIPProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Count)) { writer.WritePropertyName("count"u8); writer.WriteNumberValue(Count.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterManagedOutboundIPProfile DeserializeManagedClusterManagedOutboundIPProfile(JsonElement element) + internal static ManagedClusterManagedOutboundIPProfile DeserializeManagedClusterManagedOutboundIPProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional count = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterManagedOutboundIPProfile DeserializeManagedCluster count = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterManagedOutboundIPProfile(Optional.ToNullable(count), serializedAdditionalRawData); + } + + ManagedClusterManagedOutboundIPProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterManagedOutboundIPProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterManagedOutboundIPProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterManagedOutboundIPProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterManagedOutboundIPProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterManagedOutboundIPProfile(Optional.ToNullable(count)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterManagedOutboundIPProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterManagedOutboundIPProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs index 339672f1cdbe..7ec1310e59ea 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Profile of the managed outbound IP resources of the managed cluster. internal partial class ManagedClusterManagedOutboundIPProfile { - /// Initializes a new instance of ManagedClusterManagedOutboundIPProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterManagedOutboundIPProfile() { } - /// Initializes a new instance of ManagedClusterManagedOutboundIPProfile. + /// Initializes a new instance of . /// The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. - internal ManagedClusterManagedOutboundIPProfile(int? count) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterManagedOutboundIPProfile(int? count, Dictionary serializedAdditionalRawData) { Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs index 3490928c26bb..31a6da8b6dad 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterMonitorProfileKubeStateMetrics : IUtf8JsonSerializable + public partial class ManagedClusterMonitorProfileKubeStateMetrics : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MetricLabelsAllowlist)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("metricAnnotationsAllowList"u8); writer.WriteStringValue(MetricAnnotationsAllowList); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterMonitorProfileKubeStateMetrics DeserializeManagedClusterMonitorProfileKubeStateMetrics(JsonElement element) + internal static ManagedClusterMonitorProfileKubeStateMetrics DeserializeManagedClusterMonitorProfileKubeStateMetrics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional metricLabelsAllowlist = default; Optional metricAnnotationsAllowList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metricLabelsAllowlist"u8)) @@ -48,8 +71,61 @@ internal static ManagedClusterMonitorProfileKubeStateMetrics DeserializeManagedC metricAnnotationsAllowList = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterMonitorProfileKubeStateMetrics(metricLabelsAllowlist.Value, metricAnnotationsAllowList.Value, serializedAdditionalRawData); + } + + ManagedClusterMonitorProfileKubeStateMetrics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterMonitorProfileKubeStateMetrics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterMonitorProfileKubeStateMetrics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterMonitorProfileKubeStateMetrics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterMonitorProfileKubeStateMetrics model) + { + if (model is null) + { + return null; } - return new ManagedClusterMonitorProfileKubeStateMetrics(metricLabelsAllowlist.Value, metricAnnotationsAllowList.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterMonitorProfileKubeStateMetrics(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterMonitorProfileKubeStateMetrics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs index 0347e19d28ae..220b5a52ba1f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Kube State Metrics for prometheus addon profile for the container service cluster. public partial class ManagedClusterMonitorProfileKubeStateMetrics { - /// Initializes a new instance of ManagedClusterMonitorProfileKubeStateMetrics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterMonitorProfileKubeStateMetrics() { } - /// Initializes a new instance of ManagedClusterMonitorProfileKubeStateMetrics. + /// Initializes a new instance of . /// Comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. /// Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric. - internal ManagedClusterMonitorProfileKubeStateMetrics(string metricLabelsAllowlist, string metricAnnotationsAllowList) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterMonitorProfileKubeStateMetrics(string metricLabelsAllowlist, string metricAnnotationsAllowList, Dictionary serializedAdditionalRawData) { MetricLabelsAllowlist = metricLabelsAllowlist; MetricAnnotationsAllowList = metricAnnotationsAllowList; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs index 4025cd61cf3b..52d8c7752b41 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs @@ -5,34 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterMonitorProfileMetrics : IUtf8JsonSerializable + public partial class ManagedClusterMonitorProfileMetrics : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled); if (Optional.IsDefined(KubeStateMetrics)) { writer.WritePropertyName("kubeStateMetrics"u8); - writer.WriteObjectValue(KubeStateMetrics); + if (KubeStateMetrics is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubeStateMetrics).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterMonitorProfileMetrics DeserializeManagedClusterMonitorProfileMetrics(JsonElement element) + internal static ManagedClusterMonitorProfileMetrics DeserializeManagedClusterMonitorProfileMetrics(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } bool enabled = default; Optional kubeStateMetrics = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -49,8 +79,61 @@ internal static ManagedClusterMonitorProfileMetrics DeserializeManagedClusterMon kubeStateMetrics = ManagedClusterMonitorProfileKubeStateMetrics.DeserializeManagedClusterMonitorProfileKubeStateMetrics(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterMonitorProfileMetrics(enabled, kubeStateMetrics.Value, serializedAdditionalRawData); + } + + ManagedClusterMonitorProfileMetrics IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterMonitorProfileMetrics(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterMonitorProfileMetrics IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterMonitorProfileMetrics(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterMonitorProfileMetrics model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterMonitorProfileMetrics(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterMonitorProfileMetrics(enabled, kubeStateMetrics.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterMonitorProfileMetrics(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs index e5f9ca8ada80..5326cd0b0798 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Metrics profile for the prometheus service addon. public partial class ManagedClusterMonitorProfileMetrics { - /// Initializes a new instance of ManagedClusterMonitorProfileMetrics. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether to enable the Prometheus collector. public ManagedClusterMonitorProfileMetrics(bool isEnabled) { IsEnabled = isEnabled; } - /// Initializes a new instance of ManagedClusterMonitorProfileMetrics. + /// Initializes a new instance of . /// Whether to enable the Prometheus collector. /// Kube State Metrics for prometheus addon profile for the container service cluster. - internal ManagedClusterMonitorProfileMetrics(bool isEnabled, ManagedClusterMonitorProfileKubeStateMetrics kubeStateMetrics) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterMonitorProfileMetrics(bool isEnabled, ManagedClusterMonitorProfileKubeStateMetrics kubeStateMetrics, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; KubeStateMetrics = kubeStateMetrics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterMonitorProfileMetrics() + { } /// Whether to enable the Prometheus collector. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs index 7788d760d921..81ed2b30480e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs @@ -5,22 +5,36 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterNatGatewayProfile : IUtf8JsonSerializable + public partial class ManagedClusterNatGatewayProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ManagedOutboundIPProfile)) { writer.WritePropertyName("managedOutboundIPProfile"u8); - writer.WriteObjectValue(ManagedOutboundIPProfile); + if (ManagedOutboundIPProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedOutboundIPProfile).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) { @@ -37,11 +51,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("idleTimeoutInMinutes"u8); writer.WriteNumberValue(IdleTimeoutInMinutes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGatewayProfile(JsonElement element) + internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGatewayProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGate Optional managedOutboundIPProfile = default; Optional> effectiveOutboundIPs = default; Optional idleTimeoutInMinutes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("managedOutboundIPProfile"u8)) @@ -83,8 +112,61 @@ internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGate idleTimeoutInMinutes = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterNatGatewayProfile(managedOutboundIPProfile.Value, Optional.ToList(effectiveOutboundIPs), Optional.ToNullable(idleTimeoutInMinutes), serializedAdditionalRawData); + } + + ManagedClusterNatGatewayProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterNatGatewayProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterNatGatewayProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterNatGatewayProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterNatGatewayProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterNatGatewayProfile(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterNatGatewayProfile(managedOutboundIPProfile.Value, Optional.ToList(effectiveOutboundIPs), Optional.ToNullable(idleTimeoutInMinutes)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterNatGatewayProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs index ef36ed722029..51471904acba 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.ContainerService.Models /// Profile of the managed cluster NAT gateway. public partial class ManagedClusterNatGatewayProfile { - /// Initializes a new instance of ManagedClusterNatGatewayProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterNatGatewayProfile() { EffectiveOutboundIPs = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterNatGatewayProfile. + /// Initializes a new instance of . /// Profile of the managed outbound IP resources of the cluster NAT gateway. /// The effective outbound IP resources of the cluster NAT gateway. /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. - internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IList effectiveOutboundIPs, int? idleTimeoutInMinutes) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IList effectiveOutboundIPs, int? idleTimeoutInMinutes, Dictionary serializedAdditionalRawData) { ManagedOutboundIPProfile = managedOutboundIPProfile; EffectiveOutboundIPs = effectiveOutboundIPs; IdleTimeoutInMinutes = idleTimeoutInMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Profile of the managed outbound IP resources of the cluster NAT gateway. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs index a0648822e575..93ebb8e16b2c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterNodeResourceGroupProfile : IUtf8JsonSerializable + internal partial class ManagedClusterNodeResourceGroupProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RestrictionLevel)) { writer.WritePropertyName("restrictionLevel"u8); writer.WriteStringValue(RestrictionLevel.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterNodeResourceGroupProfile DeserializeManagedClusterNodeResourceGroupProfile(JsonElement element) + internal static ManagedClusterNodeResourceGroupProfile DeserializeManagedClusterNodeResourceGroupProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional restrictionLevel = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("restrictionLevel"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterNodeResourceGroupProfile DeserializeManagedCluster restrictionLevel = new ManagedClusterNodeResourceGroupRestrictionLevel(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterNodeResourceGroupProfile(Optional.ToNullable(restrictionLevel), serializedAdditionalRawData); + } + + ManagedClusterNodeResourceGroupProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterNodeResourceGroupProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterNodeResourceGroupProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterNodeResourceGroupProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterNodeResourceGroupProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterNodeResourceGroupProfile(Optional.ToNullable(restrictionLevel)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterNodeResourceGroupProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterNodeResourceGroupProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs index a9d6ded2dd56..361ae6d55ca3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeResourceGroupProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Node resource group lockdown profile for a managed cluster. internal partial class ManagedClusterNodeResourceGroupProfile { - /// Initializes a new instance of ManagedClusterNodeResourceGroupProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterNodeResourceGroupProfile() { } - /// Initializes a new instance of ManagedClusterNodeResourceGroupProfile. + /// Initializes a new instance of . /// The restriction level applied to the cluster's node resource group. - internal ManagedClusterNodeResourceGroupProfile(ManagedClusterNodeResourceGroupRestrictionLevel? restrictionLevel) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterNodeResourceGroupProfile(ManagedClusterNodeResourceGroupRestrictionLevel? restrictionLevel, Dictionary serializedAdditionalRawData) { RestrictionLevel = restrictionLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The restriction level applied to the cluster's node resource group. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs index a5ff3d7d4c59..0580102ae3f7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterOidcIssuerProfile : IUtf8JsonSerializable + public partial class ManagedClusterOidcIssuerProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterOidcIssuerProfile DeserializeManagedClusterOidcIssuerProfile(JsonElement element) + internal static ManagedClusterOidcIssuerProfile DeserializeManagedClusterOidcIssuerProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional issuerUrl = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("issuerURL"u8)) @@ -47,8 +70,61 @@ internal static ManagedClusterOidcIssuerProfile DeserializeManagedClusterOidcIss enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterOidcIssuerProfile(issuerUrl.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterOidcIssuerProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterOidcIssuerProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterOidcIssuerProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterOidcIssuerProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterOidcIssuerProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterOidcIssuerProfile(issuerUrl.Value, Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterOidcIssuerProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterOidcIssuerProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.cs index 17bc6eeb3f96..869b69164be8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The OIDC issuer profile of the Managed Cluster. public partial class ManagedClusterOidcIssuerProfile { - /// Initializes a new instance of ManagedClusterOidcIssuerProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterOidcIssuerProfile() { } - /// Initializes a new instance of ManagedClusterOidcIssuerProfile. + /// Initializes a new instance of . /// The OIDC issuer url of the Managed Cluster. /// Whether the OIDC issuer is enabled. - internal ManagedClusterOidcIssuerProfile(string issuerUriInfo, bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterOidcIssuerProfile(string issuerUriInfo, bool? isEnabled, Dictionary serializedAdditionalRawData) { IssuerUriInfo = issuerUriInfo; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The OIDC issuer url of the Managed Cluster. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.Serialization.cs index adf23ecb02f9..3c2822c8242d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPodIdentity : IUtf8JsonSerializable + public partial class ManagedClusterPodIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -25,12 +33,33 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(BindingSelector); } writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(JsonElement element) + internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +70,7 @@ internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(J ContainerServiceUserAssignedIdentity identity = default; Optional provisioningState = default; Optional provisioningInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -81,8 +111,61 @@ internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(J provisioningInfo = ManagedClusterPodIdentityProvisioningInfo.DeserializeManagedClusterPodIdentityProvisioningInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterPodIdentity(name, @namespace, bindingSelector.Value, identity, Optional.ToNullable(provisioningState), provisioningInfo.Value, serializedAdditionalRawData); + } + + ManagedClusterPodIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPodIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPodIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPodIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPodIdentity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPodIdentity(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterPodIdentity(name, @namespace, bindingSelector.Value, identity, Optional.ToNullable(provisioningState), provisioningInfo.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPodIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs index f3a9c352f712..710a94e6b0ca 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Details about the pod identity assigned to the Managed Cluster. public partial class ManagedClusterPodIdentity { - /// Initializes a new instance of ManagedClusterPodIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the pod identity. /// The namespace of the pod identity. /// The user assigned identity details. @@ -30,14 +34,15 @@ public ManagedClusterPodIdentity(string name, string @namespace, ContainerServic Identity = identity; } - /// Initializes a new instance of ManagedClusterPodIdentity. + /// Initializes a new instance of . /// The name of the pod identity. /// The namespace of the pod identity. /// The binding selector to use for the AzureIdentityBinding resource. /// The user assigned identity details. /// The current provisioning state of the pod identity. /// - internal ManagedClusterPodIdentity(string name, string @namespace, string bindingSelector, ContainerServiceUserAssignedIdentity identity, ManagedClusterPodIdentityProvisioningState? provisioningState, ManagedClusterPodIdentityProvisioningInfo provisioningInfo) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPodIdentity(string name, string @namespace, string bindingSelector, ContainerServiceUserAssignedIdentity identity, ManagedClusterPodIdentityProvisioningState? provisioningState, ManagedClusterPodIdentityProvisioningInfo provisioningInfo, Dictionary serializedAdditionalRawData) { Name = name; Namespace = @namespace; @@ -45,6 +50,12 @@ internal ManagedClusterPodIdentity(string name, string @namespace, string bindin Identity = identity; ProvisioningState = provisioningState; ProvisioningInfo = provisioningInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterPodIdentity() + { } /// The name of the pod identity. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs index 8879efa8dc23..51d17cd0289b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPodIdentityException : IUtf8JsonSerializable + public partial class ManagedClusterPodIdentityException : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -28,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterPodIdentityException DeserializeManagedClusterPodIdentityException(JsonElement element) + internal static ManagedClusterPodIdentityException DeserializeManagedClusterPodIdentityException(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static ManagedClusterPodIdentityException DeserializeManagedClusterPodI string name = default; string @namespace = default; IDictionary podLabels = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -62,8 +84,61 @@ internal static ManagedClusterPodIdentityException DeserializeManagedClusterPodI podLabels = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterPodIdentityException(name, @namespace, podLabels, serializedAdditionalRawData); + } + + ManagedClusterPodIdentityException IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPodIdentityException(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPodIdentityException IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPodIdentityException(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPodIdentityException model) + { + if (model is null) + { + return null; } - return new ManagedClusterPodIdentityException(name, @namespace, podLabels); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPodIdentityException(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPodIdentityException(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs index b9723e4eb89c..00b0e3fad871 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// See [disable AAD Pod Identity for a specific Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for more details. public partial class ManagedClusterPodIdentityException { - /// Initializes a new instance of ManagedClusterPodIdentityException. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the pod identity exception. /// The namespace of the pod identity exception. /// The pod labels to match. @@ -30,6 +33,24 @@ public ManagedClusterPodIdentityException(string name, string @namespace, IDicti PodLabels = podLabels; } + /// Initializes a new instance of . + /// The name of the pod identity exception. + /// The namespace of the pod identity exception. + /// The pod labels to match. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPodIdentityException(string name, string @namespace, IDictionary podLabels, Dictionary serializedAdditionalRawData) + { + Name = name; + Namespace = @namespace; + PodLabels = podLabels; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterPodIdentityException() + { + } + /// The name of the pod identity exception. public string Name { get; set; } /// The namespace of the pod identity exception. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs index 674f69c849c9..5f817a7c7ba9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPodIdentityProfile : IUtf8JsonSerializable + public partial class ManagedClusterPodIdentityProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -32,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserAssignedIdentities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,15 +56,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserAssignedIdentityExceptions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterPodIdentityProfile DeserializeManagedClusterPodIdentityProfile(JsonElement element) + internal static ManagedClusterPodIdentityProfile DeserializeManagedClusterPodIdentityProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +94,7 @@ internal static ManagedClusterPodIdentityProfile DeserializeManagedClusterPodIde Optional allowNetworkPluginKubenet = default; Optional> userAssignedIdentities = default; Optional> userAssignedIdentityExceptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -107,8 +143,61 @@ internal static ManagedClusterPodIdentityProfile DeserializeManagedClusterPodIde userAssignedIdentityExceptions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterPodIdentityProfile(Optional.ToNullable(enabled), Optional.ToNullable(allowNetworkPluginKubenet), Optional.ToList(userAssignedIdentities), Optional.ToList(userAssignedIdentityExceptions), serializedAdditionalRawData); + } + + ManagedClusterPodIdentityProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPodIdentityProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPodIdentityProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPodIdentityProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPodIdentityProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterPodIdentityProfile(Optional.ToNullable(enabled), Optional.ToNullable(allowNetworkPluginKubenet), Optional.ToList(userAssignedIdentities), Optional.ToList(userAssignedIdentityExceptions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPodIdentityProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPodIdentityProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs index a1314d3ad315..fb7775b432ab 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.ContainerService.Models /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod identity integration. public partial class ManagedClusterPodIdentityProfile { - /// Initializes a new instance of ManagedClusterPodIdentityProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterPodIdentityProfile() { UserAssignedIdentities = new ChangeTrackingList(); UserAssignedIdentityExceptions = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterPodIdentityProfile. + /// Initializes a new instance of . /// Whether the pod identity addon is enabled. /// Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. /// The pod identities to use in the cluster. /// The pod identity exceptions to allow. - internal ManagedClusterPodIdentityProfile(bool? isEnabled, bool? allowNetworkPluginKubenet, IList userAssignedIdentities, IList userAssignedIdentityExceptions) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPodIdentityProfile(bool? isEnabled, bool? allowNetworkPluginKubenet, IList userAssignedIdentities, IList userAssignedIdentityExceptions, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; AllowNetworkPluginKubenet = allowNetworkPluginKubenet; UserAssignedIdentities = userAssignedIdentities; UserAssignedIdentityExceptions = userAssignedIdentityExceptions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether the pod identity addon is enabled. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs index 1c7a6fa991d4..5f9f49ea238f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterPodIdentityProvisioningError + internal partial class ManagedClusterPodIdentityProvisioningError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterPodIdentityProvisioningError DeserializeManagedClusterPodIdentityProvisioningError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ErrorDetail)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(ErrorDetail); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterPodIdentityProvisioningError DeserializeManagedClusterPodIdentityProvisioningError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -31,8 +64,61 @@ internal static ManagedClusterPodIdentityProvisioningError DeserializeManagedClu error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterPodIdentityProvisioningError(error.Value); + return new ManagedClusterPodIdentityProvisioningError(error.Value, serializedAdditionalRawData); + } + + ManagedClusterPodIdentityProvisioningError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPodIdentityProvisioningError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPodIdentityProvisioningError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPodIdentityProvisioningError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPodIdentityProvisioningError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPodIdentityProvisioningError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPodIdentityProvisioningError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.cs index a450af9a114a..13a0a06251f6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.ContainerService.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.ContainerService.Models /// An error response from the pod identity provisioning. internal partial class ManagedClusterPodIdentityProvisioningError { - /// Initializes a new instance of ManagedClusterPodIdentityProvisioningError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterPodIdentityProvisioningError() { } - /// Initializes a new instance of ManagedClusterPodIdentityProvisioningError. + /// Initializes a new instance of . /// Details about the error. - internal ManagedClusterPodIdentityProvisioningError(ResponseError errorDetail) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPodIdentityProvisioningError(ResponseError errorDetail, Dictionary serializedAdditionalRawData) { ErrorDetail = errorDetail; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Details about the error. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs index 5163901b60c8..c3bf96f296cd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterPodIdentityProvisioningInfo + internal partial class ManagedClusterPodIdentityProvisioningInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterPodIdentityProvisioningInfo DeserializeManagedClusterPodIdentityProvisioningInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterPodIdentityProvisioningInfo DeserializeManagedClusterPodIdentityProvisioningInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error"u8)) @@ -30,8 +71,61 @@ internal static ManagedClusterPodIdentityProvisioningInfo DeserializeManagedClus error = ManagedClusterPodIdentityProvisioningError.DeserializeManagedClusterPodIdentityProvisioningError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterPodIdentityProvisioningInfo(error.Value); + return new ManagedClusterPodIdentityProvisioningInfo(error.Value, serializedAdditionalRawData); + } + + ManagedClusterPodIdentityProvisioningInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPodIdentityProvisioningInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPodIdentityProvisioningInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPodIdentityProvisioningInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPodIdentityProvisioningInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPodIdentityProvisioningInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPodIdentityProvisioningInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs index badf9f00e137..e57333fabe22 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.ContainerService.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.ContainerService.Models /// The ManagedClusterPodIdentityProvisioningInfo. internal partial class ManagedClusterPodIdentityProvisioningInfo { - /// Initializes a new instance of ManagedClusterPodIdentityProvisioningInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterPodIdentityProvisioningInfo() { } - /// Initializes a new instance of ManagedClusterPodIdentityProvisioningInfo. + /// Initializes a new instance of . /// Pod identity assignment error (if any). - internal ManagedClusterPodIdentityProvisioningInfo(ManagedClusterPodIdentityProvisioningError error) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPodIdentityProvisioningInfo(ManagedClusterPodIdentityProvisioningError error, Dictionary serializedAdditionalRawData) { Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Pod identity assignment error (if any). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs index f5b6f8a9522e..636aefb2bb12 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs @@ -5,16 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPoolUpgradeProfile + public partial class ManagedClusterPoolUpgradeProfile : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUpgradeProfile(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.ToString()); + if (Optional.IsCollectionDefined(Upgrades)) + { + writer.WritePropertyName("upgrades"u8); + writer.WriteStartArray(); + foreach (var item in Upgrades) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUpgradeProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp Optional name = default; ContainerServiceOSType osType = default; Optional> upgrades = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kubernetesVersion"u8)) @@ -54,8 +108,61 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp upgrades = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name.Value, osType, Optional.ToList(upgrades)); + return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name.Value, osType, Optional.ToList(upgrades), serializedAdditionalRawData); + } + + ManagedClusterPoolUpgradeProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPoolUpgradeProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPoolUpgradeProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPoolUpgradeProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPoolUpgradeProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPoolUpgradeProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPoolUpgradeProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs index 8ced9c34fc07..9def6357d5a9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// The list of available upgrade versions. public partial class ManagedClusterPoolUpgradeProfile { - /// Initializes a new instance of ManagedClusterPoolUpgradeProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// The operating system type. The default is Linux. /// is null. @@ -27,17 +30,24 @@ internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, ContainerSer Upgrades = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterPoolUpgradeProfile. + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// The Agent Pool name. /// The operating system type. The default is Linux. /// List of orchestrator types and versions available for upgrade. - internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, string name, ContainerServiceOSType osType, IReadOnlyList upgrades) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, string name, ContainerServiceOSType osType, IReadOnlyList upgrades, Dictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; Name = name; OSType = osType; Upgrades = upgrades; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterPoolUpgradeProfile() + { } /// The Kubernetes version (major.minor.patch). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs index ece262c83514..422d578d7a70 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPoolUpgradeProfileUpgradesItem + public partial class ManagedClusterPoolUpgradeProfileUpgradesItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (Optional.IsDefined(IsPreview)) + { + writer.WritePropertyName("isPreview"u8); + writer.WriteBooleanValue(IsPreview.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional kubernetesVersion = default; Optional isPreview = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kubernetesVersion"u8)) @@ -36,8 +75,61 @@ internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedC isPreview = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion.Value, Optional.ToNullable(isPreview)); + return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion.Value, Optional.ToNullable(isPreview), serializedAdditionalRawData); + } + + ManagedClusterPoolUpgradeProfileUpgradesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPoolUpgradeProfileUpgradesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPoolUpgradeProfileUpgradesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPoolUpgradeProfileUpgradesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs index 75c942639cd4..d3811b3e661e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The ManagedClusterPoolUpgradeProfileUpgradesItem. public partial class ManagedClusterPoolUpgradeProfileUpgradesItem { - /// Initializes a new instance of ManagedClusterPoolUpgradeProfileUpgradesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterPoolUpgradeProfileUpgradesItem() { } - /// Initializes a new instance of ManagedClusterPoolUpgradeProfileUpgradesItem. + /// Initializes a new instance of . /// The Kubernetes version (major.minor.patch). /// Whether the Kubernetes version is currently in preview. - internal ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, bool? isPreview) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, bool? isPreview, Dictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; IsPreview = isPreview; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Kubernetes version (major.minor.patch). diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs index 02749283d97e..a29d31c16487 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.Serialization.cs @@ -5,15 +5,65 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPropertiesForSnapshot + public partial class ManagedClusterPropertiesForSnapshot : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterPropertiesForSnapshot DeserializeManagedClusterPropertiesForSnapshot(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (Optional.IsDefined(EnableRbac)) + { + writer.WritePropertyName("enableRbac"u8); + writer.WriteBooleanValue(EnableRbac.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterPropertiesForSnapshot DeserializeManagedClusterPropertiesForSnapshot(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +72,7 @@ internal static ManagedClusterPropertiesForSnapshot DeserializeManagedClusterPro Optional sku = default; Optional enableRbac = default; Optional networkProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kubernetesVersion"u8)) @@ -56,8 +107,61 @@ internal static ManagedClusterPropertiesForSnapshot DeserializeManagedClusterPro networkProfile = ContainerServiceNetworkProfileForSnapshot.DeserializeContainerServiceNetworkProfileForSnapshot(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterPropertiesForSnapshot(kubernetesVersion.Value, sku.Value, Optional.ToNullable(enableRbac), networkProfile.Value); + return new ManagedClusterPropertiesForSnapshot(kubernetesVersion.Value, sku.Value, Optional.ToNullable(enableRbac), networkProfile.Value, serializedAdditionalRawData); + } + + ManagedClusterPropertiesForSnapshot IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterPropertiesForSnapshot(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterPropertiesForSnapshot IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterPropertiesForSnapshot(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterPropertiesForSnapshot model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterPropertiesForSnapshot(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterPropertiesForSnapshot(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs index 60cd68e1c4a2..973a0c1d31c8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// managed cluster properties for snapshot, these properties are read only. public partial class ManagedClusterPropertiesForSnapshot { - /// Initializes a new instance of ManagedClusterPropertiesForSnapshot. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterPropertiesForSnapshot() { } - /// Initializes a new instance of ManagedClusterPropertiesForSnapshot. + /// Initializes a new instance of . /// The current kubernetes version. /// The current managed cluster sku. /// Whether the cluster has enabled Kubernetes Role-Based Access Control or not. /// The current network profile. - internal ManagedClusterPropertiesForSnapshot(string kubernetesVersion, ManagedClusterSku sku, bool? enableRbac, ContainerServiceNetworkProfileForSnapshot networkProfile) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterPropertiesForSnapshot(string kubernetesVersion, ManagedClusterSku sku, bool? enableRbac, ContainerServiceNetworkProfileForSnapshot networkProfile, Dictionary serializedAdditionalRawData) { KubernetesVersion = kubernetesVersion; Sku = sku; EnableRbac = enableRbac; NetworkProfile = networkProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The current kubernetes version. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs index dfd34151ad73..85f30c1c5036 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterRunCommandContent : IUtf8JsonSerializable + public partial class ManagedClusterRunCommandContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("command"u8); writer.WriteStringValue(Command); @@ -27,7 +35,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clusterToken"u8); writer.WriteStringValue(ClusterToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ManagedClusterRunCommandContent DeserializeManagedClusterRunCommandContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string command = default; + Optional context = default; + Optional clusterToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("command"u8)) + { + command = property.Value.GetString(); + continue; + } + if (property.NameEquals("context"u8)) + { + context = property.Value.GetString(); + continue; + } + if (property.NameEquals("clusterToken"u8)) + { + clusterToken = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterRunCommandContent(command, context.Value, clusterToken.Value, serializedAdditionalRawData); + } + + ManagedClusterRunCommandContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterRunCommandContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterRunCommandContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterRunCommandContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterRunCommandContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterRunCommandContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterRunCommandContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs index 20aceab47a92..2f0e8309ad74 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// A run command request. public partial class ManagedClusterRunCommandContent { - /// Initializes a new instance of ManagedClusterRunCommandContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The command to run. /// is null. public ManagedClusterRunCommandContent(string command) @@ -23,6 +27,24 @@ public ManagedClusterRunCommandContent(string command) Command = command; } + /// Initializes a new instance of . + /// The command to run. + /// A base64 encoded zip file containing the files required by the command. + /// AuthToken issued for AKS AAD Server App. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterRunCommandContent(string command, string context, string clusterToken, Dictionary serializedAdditionalRawData) + { + Command = command; + Context = context; + ClusterToken = clusterToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterRunCommandContent() + { + } + /// The command to run. public string Command { get; } /// A base64 encoded zip file containing the files required by the command. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs index e325aa0da2c7..f3c0a5d2bfad 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs @@ -6,15 +6,45 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterRunCommandResult + public partial class ManagedClusterRunCommandResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterRunCommandResult DeserializeManagedClusterRunCommandResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterRunCommandResult DeserializeManagedClusterRunCommandResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +56,7 @@ internal static ManagedClusterRunCommandResult DeserializeManagedClusterRunComma Optional finishedAt = default; Optional logs = default; Optional reason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -87,8 +118,61 @@ internal static ManagedClusterRunCommandResult DeserializeManagedClusterRunComma } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterRunCommandResult(id.Value, provisioningState.Value, Optional.ToNullable(exitCode), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), logs.Value, reason.Value); + return new ManagedClusterRunCommandResult(id.Value, provisioningState.Value, Optional.ToNullable(exitCode), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), logs.Value, reason.Value, serializedAdditionalRawData); + } + + ManagedClusterRunCommandResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterRunCommandResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterRunCommandResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterRunCommandResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterRunCommandResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterRunCommandResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterRunCommandResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs index b31f361490d0..ae2ef9b40d65 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ContainerService.Models { /// run command result. public partial class ManagedClusterRunCommandResult { - /// Initializes a new instance of ManagedClusterRunCommandResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterRunCommandResult() { } - /// Initializes a new instance of ManagedClusterRunCommandResult. + /// Initializes a new instance of . /// The command id. /// provisioning State. /// The exit code of the command. @@ -25,7 +29,8 @@ internal ManagedClusterRunCommandResult() /// The time when the command finished. /// The command output. /// An explanation of why provisioningState is set to failed (if so). - internal ManagedClusterRunCommandResult(string id, string provisioningState, int? exitCode, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, string logs, string reason) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterRunCommandResult(string id, string provisioningState, int? exitCode, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, string logs, string reason, Dictionary serializedAdditionalRawData) { Id = id; ProvisioningState = provisioningState; @@ -34,6 +39,7 @@ internal ManagedClusterRunCommandResult(string id, string provisioningState, int FinishedOn = finishedOn; Logs = logs; Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The command id. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs index 35b1d9c63cf3..2aeb2da3b151 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs @@ -8,39 +8,80 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterSecurityProfile : IUtf8JsonSerializable + public partial class ManagedClusterSecurityProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Defender)) { writer.WritePropertyName("defender"u8); - writer.WriteObjectValue(Defender); + if (Defender is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Defender).Serialize(writer, options); + } } if (Optional.IsDefined(AzureKeyVaultKms)) { writer.WritePropertyName("azureKeyVaultKms"u8); - writer.WriteObjectValue(AzureKeyVaultKms); + if (AzureKeyVaultKms is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureKeyVaultKms).Serialize(writer, options); + } } if (Optional.IsDefined(WorkloadIdentity)) { writer.WritePropertyName("workloadIdentity"u8); - writer.WriteObjectValue(WorkloadIdentity); + if (WorkloadIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WorkloadIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(ImageCleaner)) { writer.WritePropertyName("imageCleaner"u8); - writer.WriteObjectValue(ImageCleaner); + if (ImageCleaner is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageCleaner).Serialize(writer, options); + } } if (Optional.IsDefined(NodeRestriction)) { writer.WritePropertyName("nodeRestriction"u8); - writer.WriteObjectValue(NodeRestriction); + if (NodeRestriction is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)NodeRestriction).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(CustomCATrustCertificates)) { @@ -52,11 +93,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityProfile(JsonElement element) + internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +122,7 @@ internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityP Optional imageCleaner = default; Optional nodeRestriction = default; Optional> customCATrustCertificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defender"u8)) @@ -128,8 +184,61 @@ internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityP customCATrustCertificates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfile(defender.Value, azureKeyVaultKms.Value, workloadIdentity.Value, imageCleaner.Value, nodeRestriction.Value, Optional.ToList(customCATrustCertificates), serializedAdditionalRawData); + } + + ManagedClusterSecurityProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfile(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterSecurityProfile(defender.Value, azureKeyVaultKms.Value, workloadIdentity.Value, imageCleaner.Value, nodeRestriction.Value, Optional.ToList(customCATrustCertificates)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs index d69f3c386742..a61f97d329ef 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// Security profile for the container service cluster. public partial class ManagedClusterSecurityProfile { - /// Initializes a new instance of ManagedClusterSecurityProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfile() { CustomCATrustCertificates = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterSecurityProfile. + /// Initializes a new instance of . /// Microsoft Defender settings for the security profile. /// Azure Key Vault [key management service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) settings for the security profile. /// [Workload Identity](https://azure.github.io/azure-workload-identity/docs/) settings for the security profile. /// ImageCleaner settings for the security profile. /// [Node Restriction](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction) settings for the security profile. /// A list of up to 10 base64 encoded CAs that will be added to the trust store on nodes with the Custom CA Trust feature enabled. For more information see [Custom CA Trust Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority). - internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, ManagedClusterSecurityProfileNodeRestriction nodeRestriction, IList customCATrustCertificates) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, ManagedClusterSecurityProfileNodeRestriction nodeRestriction, IList customCATrustCertificates, Dictionary serializedAdditionalRawData) { Defender = defender; AzureKeyVaultKms = azureKeyVaultKms; @@ -35,6 +39,7 @@ internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender def ImageCleaner = imageCleaner; NodeRestriction = nodeRestriction; CustomCATrustCertificates = customCATrustCertificates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Microsoft Defender settings for the security profile. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs index 99fa9916d79b..250bf5925935 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterSecurityProfileDefender : IUtf8JsonSerializable + public partial class ManagedClusterSecurityProfileDefender : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LogAnalyticsWorkspaceResourceId)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SecurityMonitoring)) { writer.WritePropertyName("securityMonitoring"u8); - writer.WriteObjectValue(SecurityMonitoring); + if (SecurityMonitoring is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SecurityMonitoring).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfileDefender DeserializeManagedClusterSecurityProfileDefender(JsonElement element) + internal static ManagedClusterSecurityProfileDefender DeserializeManagedClusterSecurityProfileDefender(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional logAnalyticsWorkspaceResourceId = default; Optional securityMonitoring = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logAnalyticsWorkspaceResourceId"u8)) @@ -56,8 +86,61 @@ internal static ManagedClusterSecurityProfileDefender DeserializeManagedClusterS securityMonitoring = ManagedClusterSecurityProfileDefenderSecurityMonitoring.DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfileDefender(logAnalyticsWorkspaceResourceId.Value, securityMonitoring.Value, serializedAdditionalRawData); + } + + ManagedClusterSecurityProfileDefender IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileDefender(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfileDefender IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfileDefender(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfileDefender model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfileDefender(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterSecurityProfileDefender(logAnalyticsWorkspaceResourceId.Value, securityMonitoring.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfileDefender(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs index 692226eaf229..cf2dfecc4a31 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.ContainerService.Models /// Microsoft Defender settings for the security profile. public partial class ManagedClusterSecurityProfileDefender { - /// Initializes a new instance of ManagedClusterSecurityProfileDefender. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfileDefender() { } - /// Initializes a new instance of ManagedClusterSecurityProfileDefender. + /// Initializes a new instance of . /// Resource ID of the Log Analytics workspace to be associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field empty. /// Microsoft Defender threat detection for Cloud settings for the security profile. - internal ManagedClusterSecurityProfileDefender(ResourceIdentifier logAnalyticsWorkspaceResourceId, ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileDefender(ResourceIdentifier logAnalyticsWorkspaceResourceId, ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring, Dictionary serializedAdditionalRawData) { LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; SecurityMonitoring = securityMonitoring; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID of the Log Analytics workspace to be associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field empty. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs index 2fda61e94263..0021c758200b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterSecurityProfileDefenderSecurityMonitoring : IUtf8JsonSerializable + internal partial class ManagedClusterSecurityProfileDefenderSecurityMonitoring : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSecurityMonitoringEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsSecurityMonitoringEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfileDefenderSecurityMonitoring DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(JsonElement element) + internal static ManagedClusterSecurityProfileDefenderSecurityMonitoring DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterSecurityProfileDefenderSecurityMonitoring Deserial enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfileDefenderSecurityMonitoring(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterSecurityProfileDefenderSecurityMonitoring IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfileDefenderSecurityMonitoring IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfileDefenderSecurityMonitoring model) + { + if (model is null) + { + return null; } - return new ManagedClusterSecurityProfileDefenderSecurityMonitoring(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfileDefenderSecurityMonitoring(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs index a39cee43fce6..b8725c75d2bd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Microsoft Defender settings for the security profile threat detection. internal partial class ManagedClusterSecurityProfileDefenderSecurityMonitoring { - /// Initializes a new instance of ManagedClusterSecurityProfileDefenderSecurityMonitoring. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfileDefenderSecurityMonitoring() { } - /// Initializes a new instance of ManagedClusterSecurityProfileDefenderSecurityMonitoring. + /// Initializes a new instance of . /// Whether to enable Defender threat detection. - internal ManagedClusterSecurityProfileDefenderSecurityMonitoring(bool? isSecurityMonitoringEnabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileDefenderSecurityMonitoring(bool? isSecurityMonitoringEnabled, Dictionary serializedAdditionalRawData) { IsSecurityMonitoringEnabled = isSecurityMonitoringEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable Defender threat detection. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs index b2675de438be..dd96379fbb57 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterSecurityProfileImageCleaner : IUtf8JsonSerializable + public partial class ManagedClusterSecurityProfileImageCleaner : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("intervalHours"u8); writer.WriteNumberValue(IntervalHours.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfileImageCleaner DeserializeManagedClusterSecurityProfileImageCleaner(JsonElement element) + internal static ManagedClusterSecurityProfileImageCleaner DeserializeManagedClusterSecurityProfileImageCleaner(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional intervalHours = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -56,8 +79,61 @@ internal static ManagedClusterSecurityProfileImageCleaner DeserializeManagedClus intervalHours = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfileImageCleaner(Optional.ToNullable(enabled), Optional.ToNullable(intervalHours), serializedAdditionalRawData); + } + + ManagedClusterSecurityProfileImageCleaner IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileImageCleaner(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfileImageCleaner IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfileImageCleaner(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfileImageCleaner model) + { + if (model is null) + { + return null; } - return new ManagedClusterSecurityProfileImageCleaner(Optional.ToNullable(enabled), Optional.ToNullable(intervalHours)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfileImageCleaner(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfileImageCleaner(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs index c7bbb3e9e87b..b45ee712e721 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// ImageCleaner removes unused images from nodes, freeing up disk space and helping to reduce attack surface area. Here are settings for the security profile. public partial class ManagedClusterSecurityProfileImageCleaner { - /// Initializes a new instance of ManagedClusterSecurityProfileImageCleaner. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfileImageCleaner() { } - /// Initializes a new instance of ManagedClusterSecurityProfileImageCleaner. + /// Initializes a new instance of . /// Whether to enable ImageCleaner on AKS cluster. /// ImageCleaner scanning interval. - internal ManagedClusterSecurityProfileImageCleaner(bool? isEnabled, int? intervalHours) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileImageCleaner(bool? isEnabled, int? intervalHours, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; IntervalHours = intervalHours; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable ImageCleaner on AKS cluster. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs index 566e09944861..19980d29b923 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterSecurityProfileKeyVaultKms : IUtf8JsonSerializable + public partial class ManagedClusterSecurityProfileKeyVaultKms : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyVaultResourceId"u8); writer.WriteStringValue(KeyVaultResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfileKeyVaultKms DeserializeManagedClusterSecurityProfileKeyVaultKms(JsonElement element) + internal static ManagedClusterSecurityProfileKeyVaultKms DeserializeManagedClusterSecurityProfileKeyVaultKms(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static ManagedClusterSecurityProfileKeyVaultKms DeserializeManagedClust Optional keyId = default; Optional keyVaultNetworkAccess = default; Optional keyVaultResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -82,8 +105,61 @@ internal static ManagedClusterSecurityProfileKeyVaultKms DeserializeManagedClust keyVaultResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfileKeyVaultKms(Optional.ToNullable(enabled), keyId.Value, Optional.ToNullable(keyVaultNetworkAccess), keyVaultResourceId.Value, serializedAdditionalRawData); + } + + ManagedClusterSecurityProfileKeyVaultKms IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileKeyVaultKms(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfileKeyVaultKms IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfileKeyVaultKms(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfileKeyVaultKms model) + { + if (model is null) + { + return null; } - return new ManagedClusterSecurityProfileKeyVaultKms(Optional.ToNullable(enabled), keyId.Value, Optional.ToNullable(keyVaultNetworkAccess), keyVaultResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfileKeyVaultKms(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfileKeyVaultKms(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs index 0e2131e16fb4..b3f0f83de93d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.ContainerService.Models /// Azure Key Vault key management service settings for the security profile. public partial class ManagedClusterSecurityProfileKeyVaultKms { - /// Initializes a new instance of ManagedClusterSecurityProfileKeyVaultKms. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfileKeyVaultKms() { } - /// Initializes a new instance of ManagedClusterSecurityProfileKeyVaultKms. + /// Initializes a new instance of . /// Whether to enable Azure Key Vault key management service. The default is false. /// Identifier of Azure Key Vault key. See [key identifier format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When Azure Key Vault key management service is disabled, leave the field empty. /// Network access of key vault. The possible values are `Public` and `Private`. `Public` means the key vault allows public access from all networks. `Private` means the key vault disables public access and enables private link. The default value is `Public`. /// Resource ID of key vault. When keyVaultNetworkAccess is `Private`, this field is required and must be a valid resource ID. When keyVaultNetworkAccess is `Public`, leave the field empty. - internal ManagedClusterSecurityProfileKeyVaultKms(bool? isEnabled, string keyId, ManagedClusterKeyVaultNetworkAccessType? keyVaultNetworkAccess, ResourceIdentifier keyVaultResourceId) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileKeyVaultKms(bool? isEnabled, string keyId, ManagedClusterKeyVaultNetworkAccessType? keyVaultNetworkAccess, ResourceIdentifier keyVaultResourceId, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; KeyId = keyId; KeyVaultNetworkAccess = keyVaultNetworkAccess; KeyVaultResourceId = keyVaultResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable Azure Key Vault key management service. The default is false. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs index 7a816c52ee24..e47e272c9ff3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterSecurityProfileNodeRestriction : IUtf8JsonSerializable + internal partial class ManagedClusterSecurityProfileNodeRestriction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Enabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(Enabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfileNodeRestriction DeserializeManagedClusterSecurityProfileNodeRestriction(JsonElement element) + internal static ManagedClusterSecurityProfileNodeRestriction DeserializeManagedClusterSecurityProfileNodeRestriction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterSecurityProfileNodeRestriction DeserializeManagedC enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfileNodeRestriction(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterSecurityProfileNodeRestriction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileNodeRestriction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfileNodeRestriction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfileNodeRestriction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfileNodeRestriction model) + { + if (model is null) + { + return null; } - return new ManagedClusterSecurityProfileNodeRestriction(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfileNodeRestriction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfileNodeRestriction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs index b349da572f9e..65f353ec1254 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Node Restriction settings for the security profile. internal partial class ManagedClusterSecurityProfileNodeRestriction { - /// Initializes a new instance of ManagedClusterSecurityProfileNodeRestriction. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfileNodeRestriction() { } - /// Initializes a new instance of ManagedClusterSecurityProfileNodeRestriction. + /// Initializes a new instance of . /// Whether to enable Node Restriction. - internal ManagedClusterSecurityProfileNodeRestriction(bool? enabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileNodeRestriction(bool? enabled, Dictionary serializedAdditionalRawData) { Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable Node Restriction. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs index e73881a88877..63cd5e2b04cb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterSecurityProfileWorkloadIdentity : IUtf8JsonSerializable + internal partial class ManagedClusterSecurityProfileWorkloadIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Enabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(Enabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSecurityProfileWorkloadIdentity DeserializeManagedClusterSecurityProfileWorkloadIdentity(JsonElement element) + internal static ManagedClusterSecurityProfileWorkloadIdentity DeserializeManagedClusterSecurityProfileWorkloadIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterSecurityProfileWorkloadIdentity DeserializeManaged enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSecurityProfileWorkloadIdentity(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterSecurityProfileWorkloadIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSecurityProfileWorkloadIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSecurityProfileWorkloadIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSecurityProfileWorkloadIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSecurityProfileWorkloadIdentity model) + { + if (model is null) + { + return null; } - return new ManagedClusterSecurityProfileWorkloadIdentity(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSecurityProfileWorkloadIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSecurityProfileWorkloadIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs index a27aecc4ec51..c7c28a0bcd6f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Workload Identity settings for the security profile. internal partial class ManagedClusterSecurityProfileWorkloadIdentity { - /// Initializes a new instance of ManagedClusterSecurityProfileWorkloadIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSecurityProfileWorkloadIdentity() { } - /// Initializes a new instance of ManagedClusterSecurityProfileWorkloadIdentity. + /// Initializes a new instance of . /// Whether to enable Workload Identity. - internal ManagedClusterSecurityProfileWorkloadIdentity(bool? enabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSecurityProfileWorkloadIdentity(bool? enabled, Dictionary serializedAdditionalRawData) { Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable Workload Identity. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs index 47f4939ab932..c0489cd69418 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterServicePrincipalProfile : IUtf8JsonSerializable + public partial class ManagedClusterServicePrincipalProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("clientId"u8); writer.WriteStringValue(ClientId); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secret"u8); writer.WriteStringValue(Secret); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterServicePrincipalProfile DeserializeManagedClusterServicePrincipalProfile(JsonElement element) + internal static ManagedClusterServicePrincipalProfile DeserializeManagedClusterServicePrincipalProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string clientId = default; Optional secret = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -45,8 +68,61 @@ internal static ManagedClusterServicePrincipalProfile DeserializeManagedClusterS secret = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterServicePrincipalProfile(clientId, secret.Value, serializedAdditionalRawData); + } + + ManagedClusterServicePrincipalProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterServicePrincipalProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterServicePrincipalProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterServicePrincipalProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterServicePrincipalProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterServicePrincipalProfile(clientId, secret.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterServicePrincipalProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterServicePrincipalProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.cs index 8eb5d2b39fde..9486a64117ed 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Information about a service principal identity for the cluster to use for manipulating Azure APIs. public partial class ManagedClusterServicePrincipalProfile { - /// Initializes a new instance of ManagedClusterServicePrincipalProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The ID for the service principal. /// is null. public ManagedClusterServicePrincipalProfile(string clientId) @@ -23,13 +27,20 @@ public ManagedClusterServicePrincipalProfile(string clientId) ClientId = clientId; } - /// Initializes a new instance of ManagedClusterServicePrincipalProfile. + /// Initializes a new instance of . /// The ID for the service principal. /// The secret password associated with the service principal in plain text. - internal ManagedClusterServicePrincipalProfile(string clientId, string secret) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterServicePrincipalProfile(string clientId, string secret, Dictionary serializedAdditionalRawData) { ClientId = clientId; Secret = secret; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterServicePrincipalProfile() + { } /// The ID for the service principal. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.Serialization.cs index 9bed2f8105d6..ccbd11ad900b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterSku : IUtf8JsonSerializable + public partial class ManagedClusterSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tier"u8); writer.WriteStringValue(Tier.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSku DeserializeManagedClusterSku(JsonElement element) + internal static ManagedClusterSku DeserializeManagedClusterSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -56,8 +79,61 @@ internal static ManagedClusterSku DeserializeManagedClusterSku(JsonElement eleme tier = new ManagedClusterSkuTier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSku(Optional.ToNullable(name), Optional.ToNullable(tier), serializedAdditionalRawData); + } + + ManagedClusterSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSku model) + { + if (model is null) + { + return null; } - return new ManagedClusterSku(Optional.ToNullable(name), Optional.ToNullable(tier)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.cs index 01ca87404945..099cf6adfd3c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The SKU of a Managed Cluster. public partial class ManagedClusterSku { - /// Initializes a new instance of ManagedClusterSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterSku() { } - /// Initializes a new instance of ManagedClusterSku. + /// Initializes a new instance of . /// The name of a managed cluster SKU. /// If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details. - internal ManagedClusterSku(ManagedClusterSkuName? name, ManagedClusterSkuTier? tier) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSku(ManagedClusterSkuName? name, ManagedClusterSkuTier? tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of a managed cluster SKU. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotData.Serialization.cs index 2807de369465..2bbdae88d239 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ManagedClusterSnapshotData : IUtf8JsonSerializable + public partial class ManagedClusterSnapshotData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,7 +43,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CreationData)) { writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData); + if (CreationData is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CreationData).Serialize(writer, options); + } } if (Optional.IsDefined(SnapshotType)) { @@ -44,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SnapshotType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterSnapshotData DeserializeManagedClusterSnapshotData(JsonElement element) + internal static ManagedClusterSnapshotData DeserializeManagedClusterSnapshotData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static ManagedClusterSnapshotData DeserializeManagedClusterSnapshotData Optional creationData = default; Optional snapshotType = default; Optional managedClusterPropertiesReadOnly = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -146,8 +175,61 @@ internal static ManagedClusterSnapshotData DeserializeManagedClusterSnapshotData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterSnapshotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, creationData.Value, Optional.ToNullable(snapshotType), managedClusterPropertiesReadOnly.Value, serializedAdditionalRawData); + } + + ManagedClusterSnapshotData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSnapshotData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSnapshotData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSnapshotData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSnapshotData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSnapshotData(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterSnapshotData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, creationData.Value, Optional.ToNullable(snapshotType), managedClusterPropertiesReadOnly.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSnapshotData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs index d6d4945113d1..8a300763005e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterSnapshotListResult + internal partial class ManagedClusterSnapshotListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterSnapshotListResult DeserializeManagedClusterSnapshotListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterSnapshotListResult DeserializeManagedClusterSnapshotListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ManagedClusterSnapshotListResult DeserializeManagedClusterSnapsh nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterSnapshotListResult(Optional.ToList(value), nextLink.Value); + return new ManagedClusterSnapshotListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ManagedClusterSnapshotListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterSnapshotListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterSnapshotListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterSnapshotListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterSnapshotListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterSnapshotListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterSnapshotListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs index 2ab7e806d1ab..d74299a6e452 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSnapshotListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// The response from the List Managed Cluster Snapshots operation. internal partial class ManagedClusterSnapshotListResult { - /// Initializes a new instance of ManagedClusterSnapshotListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ManagedClusterSnapshotListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ManagedClusterSnapshotListResult. + /// Initializes a new instance of . /// The list of managed cluster snapshots. /// The URL to get the next set of managed cluster snapshot results. - internal ManagedClusterSnapshotListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterSnapshotListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of managed cluster snapshots. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs index a9bb41db6a0c..f181c0580106 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs @@ -5,41 +5,91 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterStorageProfile : IUtf8JsonSerializable + public partial class ManagedClusterStorageProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DiskCsiDriver)) { writer.WritePropertyName("diskCSIDriver"u8); - writer.WriteObjectValue(DiskCsiDriver); + if (DiskCsiDriver is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiskCsiDriver).Serialize(writer, options); + } } if (Optional.IsDefined(FileCsiDriver)) { writer.WritePropertyName("fileCSIDriver"u8); - writer.WriteObjectValue(FileCsiDriver); + if (FileCsiDriver is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FileCsiDriver).Serialize(writer, options); + } } if (Optional.IsDefined(SnapshotController)) { writer.WritePropertyName("snapshotController"u8); - writer.WriteObjectValue(SnapshotController); + if (SnapshotController is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SnapshotController).Serialize(writer, options); + } } if (Optional.IsDefined(BlobCsiDriver)) { writer.WritePropertyName("blobCSIDriver"u8); - writer.WriteObjectValue(BlobCsiDriver); + if (BlobCsiDriver is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BlobCsiDriver).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterStorageProfile DeserializeManagedClusterStorageProfile(JsonElement element) + internal static ManagedClusterStorageProfile DeserializeManagedClusterStorageProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +98,7 @@ internal static ManagedClusterStorageProfile DeserializeManagedClusterStoragePro Optional fileCsiDriver = default; Optional snapshotController = default; Optional blobCsiDriver = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskCSIDriver"u8)) @@ -86,8 +137,61 @@ internal static ManagedClusterStorageProfile DeserializeManagedClusterStoragePro blobCsiDriver = ManagedClusterStorageProfileBlobCsiDriver.DeserializeManagedClusterStorageProfileBlobCsiDriver(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterStorageProfile(diskCsiDriver.Value, fileCsiDriver.Value, snapshotController.Value, blobCsiDriver.Value); + return new ManagedClusterStorageProfile(diskCsiDriver.Value, fileCsiDriver.Value, snapshotController.Value, blobCsiDriver.Value, serializedAdditionalRawData); + } + + ManagedClusterStorageProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStorageProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterStorageProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterStorageProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterStorageProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterStorageProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterStorageProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs index 5baf256c8067..72dfecaa1e0d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Storage profile for the container service cluster. public partial class ManagedClusterStorageProfile { - /// Initializes a new instance of ManagedClusterStorageProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterStorageProfile() { } - /// Initializes a new instance of ManagedClusterStorageProfile. + /// Initializes a new instance of . /// AzureDisk CSI Driver settings for the storage profile. /// AzureFile CSI Driver settings for the storage profile. /// Snapshot Controller settings for the storage profile. /// AzureBlob CSI Driver settings for the storage profile. - internal ManagedClusterStorageProfile(ManagedClusterStorageProfileDiskCsiDriver diskCsiDriver, ManagedClusterStorageProfileFileCsiDriver fileCsiDriver, ManagedClusterStorageProfileSnapshotController snapshotController, ManagedClusterStorageProfileBlobCsiDriver blobCsiDriver) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStorageProfile(ManagedClusterStorageProfileDiskCsiDriver diskCsiDriver, ManagedClusterStorageProfileFileCsiDriver fileCsiDriver, ManagedClusterStorageProfileSnapshotController snapshotController, ManagedClusterStorageProfileBlobCsiDriver blobCsiDriver, Dictionary serializedAdditionalRawData) { DiskCsiDriver = diskCsiDriver; FileCsiDriver = fileCsiDriver; SnapshotController = snapshotController; BlobCsiDriver = blobCsiDriver; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// AzureDisk CSI Driver settings for the storage profile. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs index 0dc4b21d05ce..ecdce7ff3a7c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterStorageProfileBlobCsiDriver : IUtf8JsonSerializable + internal partial class ManagedClusterStorageProfileBlobCsiDriver : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterStorageProfileBlobCsiDriver DeserializeManagedClusterStorageProfileBlobCsiDriver(JsonElement element) + internal static ManagedClusterStorageProfileBlobCsiDriver DeserializeManagedClusterStorageProfileBlobCsiDriver(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterStorageProfileBlobCsiDriver DeserializeManagedClus enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterStorageProfileBlobCsiDriver(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterStorageProfileBlobCsiDriver IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStorageProfileBlobCsiDriver(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterStorageProfileBlobCsiDriver IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterStorageProfileBlobCsiDriver(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterStorageProfileBlobCsiDriver model) + { + if (model is null) + { + return null; } - return new ManagedClusterStorageProfileBlobCsiDriver(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterStorageProfileBlobCsiDriver(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterStorageProfileBlobCsiDriver(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs index 40d0b5fd9207..868a16a75e39 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// AzureBlob CSI Driver settings for the storage profile. internal partial class ManagedClusterStorageProfileBlobCsiDriver { - /// Initializes a new instance of ManagedClusterStorageProfileBlobCsiDriver. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterStorageProfileBlobCsiDriver() { } - /// Initializes a new instance of ManagedClusterStorageProfileBlobCsiDriver. + /// Initializes a new instance of . /// Whether to enable AzureBlob CSI Driver. The default value is false. - internal ManagedClusterStorageProfileBlobCsiDriver(bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStorageProfileBlobCsiDriver(bool? isEnabled, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable AzureBlob CSI Driver. The default value is false. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs index 91d5bc8e3f7f..89ef7013c80e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterStorageProfileDiskCsiDriver : IUtf8JsonSerializable + public partial class ManagedClusterStorageProfileDiskCsiDriver : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterStorageProfileDiskCsiDriver DeserializeManagedClusterStorageProfileDiskCsiDriver(JsonElement element) + internal static ManagedClusterStorageProfileDiskCsiDriver DeserializeManagedClusterStorageProfileDiskCsiDriver(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -52,8 +75,61 @@ internal static ManagedClusterStorageProfileDiskCsiDriver DeserializeManagedClus version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterStorageProfileDiskCsiDriver(Optional.ToNullable(enabled), version.Value, serializedAdditionalRawData); + } + + ManagedClusterStorageProfileDiskCsiDriver IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStorageProfileDiskCsiDriver(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterStorageProfileDiskCsiDriver IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterStorageProfileDiskCsiDriver(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterStorageProfileDiskCsiDriver model) + { + if (model is null) + { + return null; } - return new ManagedClusterStorageProfileDiskCsiDriver(Optional.ToNullable(enabled), version.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterStorageProfileDiskCsiDriver(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterStorageProfileDiskCsiDriver(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs index 60362538dd7e..2db8790efffe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// AzureDisk CSI Driver settings for the storage profile. public partial class ManagedClusterStorageProfileDiskCsiDriver { - /// Initializes a new instance of ManagedClusterStorageProfileDiskCsiDriver. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterStorageProfileDiskCsiDriver() { } - /// Initializes a new instance of ManagedClusterStorageProfileDiskCsiDriver. + /// Initializes a new instance of . /// Whether to enable AzureDisk CSI Driver. The default value is true. /// The version of AzureDisk CSI Driver. The default value is v1. - internal ManagedClusterStorageProfileDiskCsiDriver(bool? isEnabled, string version) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStorageProfileDiskCsiDriver(bool? isEnabled, string version, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable AzureDisk CSI Driver. The default value is true. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs index 5f6c0031aa93..713e158bcf0f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterStorageProfileFileCsiDriver : IUtf8JsonSerializable + internal partial class ManagedClusterStorageProfileFileCsiDriver : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterStorageProfileFileCsiDriver DeserializeManagedClusterStorageProfileFileCsiDriver(JsonElement element) + internal static ManagedClusterStorageProfileFileCsiDriver DeserializeManagedClusterStorageProfileFileCsiDriver(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterStorageProfileFileCsiDriver DeserializeManagedClus enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterStorageProfileFileCsiDriver(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterStorageProfileFileCsiDriver IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStorageProfileFileCsiDriver(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterStorageProfileFileCsiDriver IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterStorageProfileFileCsiDriver(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterStorageProfileFileCsiDriver model) + { + if (model is null) + { + return null; } - return new ManagedClusterStorageProfileFileCsiDriver(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterStorageProfileFileCsiDriver(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterStorageProfileFileCsiDriver(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs index 66d1f0e95b09..722025c816c9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// AzureFile CSI Driver settings for the storage profile. internal partial class ManagedClusterStorageProfileFileCsiDriver { - /// Initializes a new instance of ManagedClusterStorageProfileFileCsiDriver. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterStorageProfileFileCsiDriver() { } - /// Initializes a new instance of ManagedClusterStorageProfileFileCsiDriver. + /// Initializes a new instance of . /// Whether to enable AzureFile CSI Driver. The default value is true. - internal ManagedClusterStorageProfileFileCsiDriver(bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStorageProfileFileCsiDriver(bool? isEnabled, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable AzureFile CSI Driver. The default value is true. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs index 36bfcedf9264..fc3d6dfaa442 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterStorageProfileSnapshotController : IUtf8JsonSerializable + internal partial class ManagedClusterStorageProfileSnapshotController : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterStorageProfileSnapshotController DeserializeManagedClusterStorageProfileSnapshotController(JsonElement element) + internal static ManagedClusterStorageProfileSnapshotController DeserializeManagedClusterStorageProfileSnapshotController(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -41,8 +64,61 @@ internal static ManagedClusterStorageProfileSnapshotController DeserializeManage enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterStorageProfileSnapshotController(Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ManagedClusterStorageProfileSnapshotController IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterStorageProfileSnapshotController(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterStorageProfileSnapshotController IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterStorageProfileSnapshotController(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterStorageProfileSnapshotController model) + { + if (model is null) + { + return null; } - return new ManagedClusterStorageProfileSnapshotController(Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterStorageProfileSnapshotController(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterStorageProfileSnapshotController(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs index 8a24c3edb037..e495eb5258b3 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Snapshot Controller settings for the storage profile. internal partial class ManagedClusterStorageProfileSnapshotController { - /// Initializes a new instance of ManagedClusterStorageProfileSnapshotController. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterStorageProfileSnapshotController() { } - /// Initializes a new instance of ManagedClusterStorageProfileSnapshotController. + /// Initializes a new instance of . /// Whether to enable Snapshot Controller. The default value is true. - internal ManagedClusterStorageProfileSnapshotController(bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterStorageProfileSnapshotController(bool? isEnabled, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether to enable Snapshot Controller. The default value is true. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeProfileData.Serialization.cs index 89a1cfe84e53..0ff2ac42aba9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeProfileData.Serialization.cs @@ -5,18 +5,71 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ManagedClusterUpgradeProfileData + public partial class ManagedClusterUpgradeProfileData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedClusterUpgradeProfileData DeserializeManagedClusterUpgradeProfileData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("controlPlaneProfile"u8); + if (ControlPlaneProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ControlPlaneProfile).Serialize(writer, options); + } + writer.WritePropertyName("agentPoolProfiles"u8); + writer.WriteStartArray(); + foreach (var item in AgentPoolProfiles) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ManagedClusterUpgradeProfileData DeserializeManagedClusterUpgradeProfileData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +80,7 @@ internal static ManagedClusterUpgradeProfileData DeserializeManagedClusterUpgrad Optional systemData = default; ManagedClusterPoolUpgradeProfile controlPlaneProfile = default; IReadOnlyList agentPoolProfiles = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -80,8 +134,61 @@ internal static ManagedClusterUpgradeProfileData DeserializeManagedClusterUpgrad } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ManagedClusterUpgradeProfileData(id, name, type, systemData.Value, controlPlaneProfile, agentPoolProfiles); + return new ManagedClusterUpgradeProfileData(id, name, type, systemData.Value, controlPlaneProfile, agentPoolProfiles, serializedAdditionalRawData); + } + + ManagedClusterUpgradeProfileData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterUpgradeProfileData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterUpgradeProfileData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterUpgradeProfileData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterUpgradeProfileData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterUpgradeProfileData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterUpgradeProfileData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs index 5e716222a5bd..ff05ab4d3449 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterVerticalPodAutoscaler : IUtf8JsonSerializable + public partial class ManagedClusterVerticalPodAutoscaler : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ControlledValues.ToString()); writer.WritePropertyName("updateMode"u8); writer.WriteStringValue(UpdateMode.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVerticalPodAutoscaler(JsonElement element) + internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVerticalPodAutoscaler(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVer bool enabled = default; ManagedClusterWorkloadAutoScalerControlledValue controlledValues = default; ManagedClusterVerticalPodAutoscalerUpdateMode updateMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -50,8 +73,61 @@ internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVer updateMode = new ManagedClusterVerticalPodAutoscalerUpdateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterVerticalPodAutoscaler(enabled, controlledValues, updateMode, serializedAdditionalRawData); + } + + ManagedClusterVerticalPodAutoscaler IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterVerticalPodAutoscaler(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterVerticalPodAutoscaler IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterVerticalPodAutoscaler(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterVerticalPodAutoscaler model) + { + if (model is null) + { + return null; } - return new ManagedClusterVerticalPodAutoscaler(enabled, controlledValues, updateMode); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterVerticalPodAutoscaler(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterVerticalPodAutoscaler(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs index d6828722ea16..7e2b26a23ec9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// The ManagedClusterVerticalPodAutoscaler. public partial class ManagedClusterVerticalPodAutoscaler { - /// Initializes a new instance of ManagedClusterVerticalPodAutoscaler. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether to enable VPA. Default value is false. /// Controls which resource value autoscaler will change. Default value is RequestsAndLimits. /// Each update mode level is a superset of the lower levels. Off<Initial<Recreate<=Auto. For example: if UpdateMode is Initial, it means VPA sets the recommended resources in the VerticalPodAutoscaler Custom Resource (from UpdateMode Off) and also assigns resources on pod creation (from Initial). The default value is Off. @@ -21,6 +27,24 @@ public ManagedClusterVerticalPodAutoscaler(bool isEnabled, ManagedClusterWorkloa UpdateMode = updateMode; } + /// Initializes a new instance of . + /// Whether to enable VPA. Default value is false. + /// Controls which resource value autoscaler will change. Default value is RequestsAndLimits. + /// Each update mode level is a superset of the lower levels. Off<Initial<Recreate<=Auto. For example: if UpdateMode is Initial, it means VPA sets the recommended resources in the VerticalPodAutoscaler Custom Resource (from UpdateMode Off) and also assigns resources on pod creation (from Initial). The default value is Off. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterVerticalPodAutoscaler(bool isEnabled, ManagedClusterWorkloadAutoScalerControlledValue controlledValues, ManagedClusterVerticalPodAutoscalerUpdateMode updateMode, Dictionary serializedAdditionalRawData) + { + IsEnabled = isEnabled; + ControlledValues = controlledValues; + UpdateMode = updateMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterVerticalPodAutoscaler() + { + } + /// Whether to enable VPA. Default value is false. public bool IsEnabled { get; set; } /// Controls which resource value autoscaler will change. Default value is RequestsAndLimits. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs index 2e45d94550c8..dc41fc10eabe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterWindowsProfile : IUtf8JsonSerializable + public partial class ManagedClusterWindowsProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("adminUsername"u8); writer.WriteStringValue(AdminUsername); @@ -35,13 +43,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GmsaProfile)) { writer.WritePropertyName("gmsaProfile"u8); - writer.WriteObjectValue(GmsaProfile); + if (GmsaProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GmsaProfile).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterWindowsProfile DeserializeManagedClusterWindowsProfile(JsonElement element) + internal static ManagedClusterWindowsProfile DeserializeManagedClusterWindowsProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +80,7 @@ internal static ManagedClusterWindowsProfile DeserializeManagedClusterWindowsPro Optional licenseType = default; Optional enableCsiProxy = default; Optional gmsaProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("adminUsername"u8)) @@ -90,8 +120,61 @@ internal static ManagedClusterWindowsProfile DeserializeManagedClusterWindowsPro gmsaProfile = WindowsGmsaProfile.DeserializeWindowsGmsaProfile(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterWindowsProfile(adminUsername, adminPassword.Value, Optional.ToNullable(licenseType), Optional.ToNullable(enableCsiProxy), gmsaProfile.Value, serializedAdditionalRawData); + } + + ManagedClusterWindowsProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterWindowsProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterWindowsProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterWindowsProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterWindowsProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterWindowsProfile(Response response) + { + if (response is null) + { + return null; } - return new ManagedClusterWindowsProfile(adminUsername, adminPassword.Value, Optional.ToNullable(licenseType), Optional.ToNullable(enableCsiProxy), gmsaProfile.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterWindowsProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs index df61fdfb2486..6eeecfa208aa 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Profile for Windows VMs in the managed cluster. public partial class ManagedClusterWindowsProfile { - /// Initializes a new instance of ManagedClusterWindowsProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the name of the administrator account. <br><br> **Restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length:** 1 character <br><br> **Max-length:** 20 characters. /// is null. public ManagedClusterWindowsProfile(string adminUsername) @@ -23,19 +27,26 @@ public ManagedClusterWindowsProfile(string adminUsername) AdminUsername = adminUsername; } - /// Initializes a new instance of ManagedClusterWindowsProfile. + /// Initializes a new instance of . /// Specifies the name of the administrator account. <br><br> **Restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length:** 1 character <br><br> **Max-length:** 20 characters. /// Specifies the password of the administrator account. <br><br> **Minimum-length:** 8 characters <br><br> **Max-length:** 123 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". /// The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. /// For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). /// The Windows gMSA Profile in the Managed Cluster. - internal ManagedClusterWindowsProfile(string adminUsername, string adminPassword, WindowsVmLicenseType? licenseType, bool? isCsiProxyEnabled, WindowsGmsaProfile gmsaProfile) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterWindowsProfile(string adminUsername, string adminPassword, WindowsVmLicenseType? licenseType, bool? isCsiProxyEnabled, WindowsGmsaProfile gmsaProfile, Dictionary serializedAdditionalRawData) { AdminUsername = adminUsername; AdminPassword = adminPassword; LicenseType = licenseType; IsCsiProxyEnabled = isCsiProxyEnabled; GmsaProfile = gmsaProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterWindowsProfile() + { } /// Specifies the name of the administrator account. <br><br> **Restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length:** 1 character <br><br> **Max-length:** 20 characters. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs index f39e717b4ab5..34f89b74059c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterWorkloadAutoScalerProfile : IUtf8JsonSerializable + public partial class ManagedClusterWorkloadAutoScalerProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Keda)) { writer.WritePropertyName("keda"u8); - writer.WriteObjectValue(Keda); + if (Keda is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Keda).Serialize(writer, options); + } } if (Optional.IsDefined(VerticalPodAutoscaler)) { writer.WritePropertyName("verticalPodAutoscaler"u8); - writer.WriteObjectValue(VerticalPodAutoscaler); + if (VerticalPodAutoscaler is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VerticalPodAutoscaler).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ManagedClusterWorkloadAutoScalerProfile DeserializeManagedClusterWorkloadAutoScalerProfile(JsonElement element) + internal static ManagedClusterWorkloadAutoScalerProfile DeserializeManagedClusterWorkloadAutoScalerProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional keda = default; Optional verticalPodAutoscaler = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keda"u8)) @@ -56,8 +93,61 @@ internal static ManagedClusterWorkloadAutoScalerProfile DeserializeManagedCluste verticalPodAutoscaler = ManagedClusterVerticalPodAutoscaler.DeserializeManagedClusterVerticalPodAutoscaler(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterWorkloadAutoScalerProfile(keda.Value, verticalPodAutoscaler.Value, serializedAdditionalRawData); + } + + ManagedClusterWorkloadAutoScalerProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterWorkloadAutoScalerProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterWorkloadAutoScalerProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterWorkloadAutoScalerProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterWorkloadAutoScalerProfile model) + { + if (model is null) + { + return null; } - return new ManagedClusterWorkloadAutoScalerProfile(keda.Value, verticalPodAutoscaler.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterWorkloadAutoScalerProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterWorkloadAutoScalerProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs index 97a7dbf89e4f..011d84db9dcd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Workload Auto-scaler profile for the managed cluster. public partial class ManagedClusterWorkloadAutoScalerProfile { - /// Initializes a new instance of ManagedClusterWorkloadAutoScalerProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ManagedClusterWorkloadAutoScalerProfile() { } - /// Initializes a new instance of ManagedClusterWorkloadAutoScalerProfile. + /// Initializes a new instance of . /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. /// - internal ManagedClusterWorkloadAutoScalerProfile(ManagedClusterWorkloadAutoScalerProfileKeda keda, ManagedClusterVerticalPodAutoscaler verticalPodAutoscaler) + /// Keeps track of any properties unknown to the library. + internal ManagedClusterWorkloadAutoScalerProfile(ManagedClusterWorkloadAutoScalerProfileKeda keda, ManagedClusterVerticalPodAutoscaler verticalPodAutoscaler, Dictionary serializedAdditionalRawData) { Keda = keda; VerticalPodAutoscaler = verticalPodAutoscaler; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs index d2cf5220f116..226228bc7333 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterWorkloadAutoScalerProfileKeda : IUtf8JsonSerializable + internal partial class ManagedClusterWorkloadAutoScalerProfileKeda : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(Enabled); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedClusterWorkloadAutoScalerProfileKeda DeserializeManagedClusterWorkloadAutoScalerProfileKeda(JsonElement element) + internal static ManagedClusterWorkloadAutoScalerProfileKeda DeserializeManagedClusterWorkloadAutoScalerProfileKeda(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } bool enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -34,8 +57,61 @@ internal static ManagedClusterWorkloadAutoScalerProfileKeda DeserializeManagedCl enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedClusterWorkloadAutoScalerProfileKeda(enabled, serializedAdditionalRawData); + } + + ManagedClusterWorkloadAutoScalerProfileKeda IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedClusterWorkloadAutoScalerProfileKeda(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedClusterWorkloadAutoScalerProfileKeda IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedClusterWorkloadAutoScalerProfileKeda(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedClusterWorkloadAutoScalerProfileKeda model) + { + if (model is null) + { + return null; } - return new ManagedClusterWorkloadAutoScalerProfileKeda(enabled); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedClusterWorkloadAutoScalerProfileKeda(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedClusterWorkloadAutoScalerProfileKeda(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs index 6f1d543dec44..e3c851d5ce2a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. internal partial class ManagedClusterWorkloadAutoScalerProfileKeda { - /// Initializes a new instance of ManagedClusterWorkloadAutoScalerProfileKeda. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Whether to enable KEDA. public ManagedClusterWorkloadAutoScalerProfileKeda(bool enabled) { Enabled = enabled; } + /// Initializes a new instance of . + /// Whether to enable KEDA. + /// Keeps track of any properties unknown to the library. + internal ManagedClusterWorkloadAutoScalerProfileKeda(bool enabled, Dictionary serializedAdditionalRawData) + { + Enabled = enabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedClusterWorkloadAutoScalerProfileKeda() + { + } + /// Whether to enable KEDA. public bool Enabled { get; set; } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OSOptionProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OSOptionProfileData.Serialization.cs index fcc869154de0..363e359020e4 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OSOptionProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OSOptionProfileData.Serialization.cs @@ -5,18 +5,62 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService { - public partial class OSOptionProfileData + public partial class OSOptionProfileData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("osOptionPropertyList"u8); + writer.WriteStartArray(); + foreach (var item in OSOptionPropertyList) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +70,7 @@ internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement e ResourceType type = default; Optional systemData = default; IReadOnlyList osOptionPropertyList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -74,8 +119,61 @@ internal static OSOptionProfileData DeserializeOSOptionProfileData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OSOptionProfileData(id, name, type, systemData.Value, osOptionPropertyList); + return new OSOptionProfileData(id, name, type, systemData.Value, osOptionPropertyList, serializedAdditionalRawData); + } + + OSOptionProfileData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOSOptionProfileData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OSOptionProfileData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOSOptionProfileData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OSOptionProfileData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OSOptionProfileData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOSOptionProfileData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.Serialization.cs index c14fc607e569..68f6a1252a0b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.Serialization.cs @@ -5,22 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class OutboundEnvironmentEndpointListResult + internal partial class OutboundEnvironmentEndpointListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OutboundEnvironmentEndpointListResult DeserializeOutboundEnvironmentEndpointListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OutboundEnvironmentEndpointListResult DeserializeOutboundEnvironmentEndpointListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +80,61 @@ internal static OutboundEnvironmentEndpointListResult DeserializeOutboundEnviron nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OutboundEnvironmentEndpointListResult(value, nextLink.Value); + return new OutboundEnvironmentEndpointListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + OutboundEnvironmentEndpointListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOutboundEnvironmentEndpointListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OutboundEnvironmentEndpointListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOutboundEnvironmentEndpointListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OutboundEnvironmentEndpointListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OutboundEnvironmentEndpointListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOutboundEnvironmentEndpointListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.cs index ce2bd4aaad17..de7211b3ecbd 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.ContainerService.Models /// Collection of OutboundEnvironmentEndpoint. internal partial class OutboundEnvironmentEndpointListResult { - /// Initializes a new instance of OutboundEnvironmentEndpointListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Collection of resources. /// is null. internal OutboundEnvironmentEndpointListResult(IEnumerable value) @@ -25,13 +28,20 @@ internal OutboundEnvironmentEndpointListResult(IEnumerable Initializes a new instance of OutboundEnvironmentEndpointListResult. + /// Initializes a new instance of . /// Collection of resources. /// Link to next page of resources. - internal OutboundEnvironmentEndpointListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OutboundEnvironmentEndpointListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OutboundEnvironmentEndpointListResult() + { } /// Collection of resources. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs index ab9854d2493c..d1f6ba5733d9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class SysctlConfig : IUtf8JsonSerializable + public partial class SysctlConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NetCoreSomaxconn)) { @@ -155,11 +163,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("vmVfsCachePressure"u8); writer.WriteNumberValue(VmVfsCachePressure.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SysctlConfig DeserializeSysctlConfig(JsonElement element) + internal static SysctlConfig DeserializeSysctlConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,6 +214,7 @@ internal static SysctlConfig DeserializeSysctlConfig(JsonElement element) Optional vmMaxMapCount = default; Optional vmSwappiness = default; Optional vmVfsCachePressure = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("netCoreSomaxconn"u8)) @@ -442,8 +465,61 @@ internal static SysctlConfig DeserializeSysctlConfig(JsonElement element) vmVfsCachePressure = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SysctlConfig(Optional.ToNullable(netCoreSomaxconn), Optional.ToNullable(netCoreNetdevMaxBacklog), Optional.ToNullable(netCoreRmemDefault), Optional.ToNullable(netCoreRmemMax), Optional.ToNullable(netCoreWmemDefault), Optional.ToNullable(netCoreWmemMax), Optional.ToNullable(netCoreOptmemMax), Optional.ToNullable(netIPv4TcpMaxSynBacklog), Optional.ToNullable(netIPv4TcpMaxTwBuckets), Optional.ToNullable(netIPv4TcpFinTimeout), Optional.ToNullable(netIPv4TcpKeepaliveTime), Optional.ToNullable(netIPv4TcpKeepaliveProbes), Optional.ToNullable(netIPv4TcpKeepaliveIntvl), Optional.ToNullable(netIPv4TcpTwReuse), netIPv4IPLocalPortRange.Value, Optional.ToNullable(netIPv4NeighDefaultGcThresh1), Optional.ToNullable(netIPv4NeighDefaultGcThresh2), Optional.ToNullable(netIPv4NeighDefaultGcThresh3), Optional.ToNullable(netNetfilterNfConntrackMax), Optional.ToNullable(netNetfilterNfConntrackBuckets), Optional.ToNullable(fsInotifyMaxUserWatches), Optional.ToNullable(fsFileMax), Optional.ToNullable(fsAioMaxNr), Optional.ToNullable(fsNrOpen), Optional.ToNullable(kernelThreadsMax), Optional.ToNullable(vmMaxMapCount), Optional.ToNullable(vmSwappiness), Optional.ToNullable(vmVfsCachePressure), serializedAdditionalRawData); + } + + SysctlConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSysctlConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SysctlConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSysctlConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SysctlConfig model) + { + if (model is null) + { + return null; } - return new SysctlConfig(Optional.ToNullable(netCoreSomaxconn), Optional.ToNullable(netCoreNetdevMaxBacklog), Optional.ToNullable(netCoreRmemDefault), Optional.ToNullable(netCoreRmemMax), Optional.ToNullable(netCoreWmemDefault), Optional.ToNullable(netCoreWmemMax), Optional.ToNullable(netCoreOptmemMax), Optional.ToNullable(netIPv4TcpMaxSynBacklog), Optional.ToNullable(netIPv4TcpMaxTwBuckets), Optional.ToNullable(netIPv4TcpFinTimeout), Optional.ToNullable(netIPv4TcpKeepaliveTime), Optional.ToNullable(netIPv4TcpKeepaliveProbes), Optional.ToNullable(netIPv4TcpKeepaliveIntvl), Optional.ToNullable(netIPv4TcpTwReuse), netIPv4IPLocalPortRange.Value, Optional.ToNullable(netIPv4NeighDefaultGcThresh1), Optional.ToNullable(netIPv4NeighDefaultGcThresh2), Optional.ToNullable(netIPv4NeighDefaultGcThresh3), Optional.ToNullable(netNetfilterNfConntrackMax), Optional.ToNullable(netNetfilterNfConntrackBuckets), Optional.ToNullable(fsInotifyMaxUserWatches), Optional.ToNullable(fsFileMax), Optional.ToNullable(fsAioMaxNr), Optional.ToNullable(fsNrOpen), Optional.ToNullable(kernelThreadsMax), Optional.ToNullable(vmMaxMapCount), Optional.ToNullable(vmSwappiness), Optional.ToNullable(vmVfsCachePressure)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SysctlConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSysctlConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs index 85ad7856d253..69200624a507 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Sysctl settings for Linux agent nodes. public partial class SysctlConfig { - /// Initializes a new instance of SysctlConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SysctlConfig() { } - /// Initializes a new instance of SysctlConfig. + /// Initializes a new instance of . /// Sysctl setting net.core.somaxconn. /// Sysctl setting net.core.netdev_max_backlog. /// Sysctl setting net.core.rmem_default. @@ -44,7 +50,8 @@ public SysctlConfig() /// Sysctl setting vm.max_map_count. /// Sysctl setting vm.swappiness. /// Sysctl setting vm.vfs_cache_pressure. - internal SysctlConfig(int? netCoreSomaxconn, int? netCoreNetdevMaxBacklog, int? netCoreRmemDefault, int? netCoreRmemMax, int? netCoreWmemDefault, int? netCoreWmemMax, int? netCoreOptmemMax, int? netIPv4TcpMaxSynBacklog, int? netIPv4TcpMaxTwBuckets, int? netIPv4TcpFinTimeout, int? netIPv4TcpKeepaliveTime, int? netIPv4TcpKeepaliveProbes, int? netIPv4TcpKeepaliveIntvl, bool? netIPv4TcpTwReuse, string netIPv4IPLocalPortRange, int? netIPv4NeighDefaultGcThresh1, int? netIPv4NeighDefaultGcThresh2, int? netIPv4NeighDefaultGcThresh3, int? netNetfilterNfConntrackMax, int? netNetfilterNfConntrackBuckets, int? fsInotifyMaxUserWatches, int? fsFileMax, int? fsAioMaxNr, int? fsNrOpen, int? kernelThreadsMax, int? vmMaxMapCount, int? vmSwappiness, int? vmVfsCachePressure) + /// Keeps track of any properties unknown to the library. + internal SysctlConfig(int? netCoreSomaxconn, int? netCoreNetdevMaxBacklog, int? netCoreRmemDefault, int? netCoreRmemMax, int? netCoreWmemDefault, int? netCoreWmemMax, int? netCoreOptmemMax, int? netIPv4TcpMaxSynBacklog, int? netIPv4TcpMaxTwBuckets, int? netIPv4TcpFinTimeout, int? netIPv4TcpKeepaliveTime, int? netIPv4TcpKeepaliveProbes, int? netIPv4TcpKeepaliveIntvl, bool? netIPv4TcpTwReuse, string netIPv4IPLocalPortRange, int? netIPv4NeighDefaultGcThresh1, int? netIPv4NeighDefaultGcThresh2, int? netIPv4NeighDefaultGcThresh3, int? netNetfilterNfConntrackMax, int? netNetfilterNfConntrackBuckets, int? fsInotifyMaxUserWatches, int? fsFileMax, int? fsAioMaxNr, int? fsNrOpen, int? kernelThreadsMax, int? vmMaxMapCount, int? vmSwappiness, int? vmVfsCachePressure, Dictionary serializedAdditionalRawData) { NetCoreSomaxconn = netCoreSomaxconn; NetCoreNetdevMaxBacklog = netCoreNetdevMaxBacklog; @@ -74,6 +81,7 @@ internal SysctlConfig(int? netCoreSomaxconn, int? netCoreNetdevMaxBacklog, int? VmMaxMapCount = vmMaxMapCount; VmSwappiness = vmSwappiness; VmVfsCachePressure = vmVfsCachePressure; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sysctl setting net.core.somaxconn. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs index 240a3ba672ea..bb512c51de71 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.ContainerService; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class TrustedAccessRoleBindingListResult + internal partial class TrustedAccessRoleBindingListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TrustedAccessRoleBindingListResult DeserializeTrustedAccessRoleBindingListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TrustedAccessRoleBindingListResult DeserializeTrustedAccessRoleBindingListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static TrustedAccessRoleBindingListResult DeserializeTrustedAccessRoleB nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TrustedAccessRoleBindingListResult(Optional.ToList(value), nextLink.Value); + return new TrustedAccessRoleBindingListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + TrustedAccessRoleBindingListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTrustedAccessRoleBindingListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TrustedAccessRoleBindingListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTrustedAccessRoleBindingListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TrustedAccessRoleBindingListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TrustedAccessRoleBindingListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTrustedAccessRoleBindingListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.cs index 9faf042014df..82f12025cb47 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ContainerService; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// List of trusted access role bindings. internal partial class TrustedAccessRoleBindingListResult { - /// Initializes a new instance of TrustedAccessRoleBindingListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TrustedAccessRoleBindingListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TrustedAccessRoleBindingListResult. + /// Initializes a new instance of . /// Role binding list. /// Link to next page of resources. - internal TrustedAccessRoleBindingListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TrustedAccessRoleBindingListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role binding list. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs index 1b069e5ac320..a330432ab3c8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - internal partial class TrustedAccessRoleListResult + internal partial class TrustedAccessRoleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TrustedAccessRoleListResult DeserializeTrustedAccessRoleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TrustedAccessRoleListResult DeserializeTrustedAccessRoleListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static TrustedAccessRoleListResult DeserializeTrustedAccessRoleListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TrustedAccessRoleListResult(Optional.ToList(value), nextLink.Value); + return new TrustedAccessRoleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + TrustedAccessRoleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTrustedAccessRoleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TrustedAccessRoleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTrustedAccessRoleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TrustedAccessRoleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TrustedAccessRoleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTrustedAccessRoleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs index 8b16dfcf78d5..395490d3d326 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.ContainerService.Models /// List of trusted access roles. internal partial class TrustedAccessRoleListResult { - /// Initializes a new instance of TrustedAccessRoleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TrustedAccessRoleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TrustedAccessRoleListResult. + /// Initializes a new instance of . /// Role list. /// Link to next page of resources. - internal TrustedAccessRoleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TrustedAccessRoleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role list. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs index d60e8bd9f273..a4e84e974b31 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.ContainerService.Models { - public partial class WindowsGmsaProfile : IUtf8JsonSerializable + public partial class WindowsGmsaProfile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("rootDomainName"u8); writer.WriteStringValue(RootDomainName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WindowsGmsaProfile DeserializeWindowsGmsaProfile(JsonElement element) + internal static WindowsGmsaProfile DeserializeWindowsGmsaProfile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static WindowsGmsaProfile DeserializeWindowsGmsaProfile(JsonElement ele Optional enabled = default; Optional dnsServer = default; Optional rootDomainName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled"u8)) @@ -63,8 +86,61 @@ internal static WindowsGmsaProfile DeserializeWindowsGmsaProfile(JsonElement ele rootDomainName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WindowsGmsaProfile(Optional.ToNullable(enabled), dnsServer.Value, rootDomainName.Value, serializedAdditionalRawData); + } + + WindowsGmsaProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWindowsGmsaProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WindowsGmsaProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWindowsGmsaProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WindowsGmsaProfile model) + { + if (model is null) + { + return null; } - return new WindowsGmsaProfile(Optional.ToNullable(enabled), dnsServer.Value, rootDomainName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WindowsGmsaProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWindowsGmsaProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs index 4211ab2ead5c..a21c086f83b1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.ContainerService.Models { /// Windows gMSA Profile in the managed cluster. public partial class WindowsGmsaProfile { - /// Initializes a new instance of WindowsGmsaProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WindowsGmsaProfile() { } - /// Initializes a new instance of WindowsGmsaProfile. + /// Initializes a new instance of . /// Specifies whether to enable Windows gMSA in the managed cluster. /// Specifies the DNS server for Windows gMSA. <br><br> Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. /// Specifies the root domain name for Windows gMSA. <br><br> Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - internal WindowsGmsaProfile(bool? isEnabled, string dnsServer, string rootDomainName) + /// Keeps track of any properties unknown to the library. + internal WindowsGmsaProfile(bool? isEnabled, string dnsServer, string rootDomainName, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; DnsServer = dnsServer; RootDomainName = rootDomainName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies whether to enable Windows gMSA in the managed cluster. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs index 676e321e358b..044886ef4891 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.ContainerService /// public partial class OSOptionProfileData : ResourceData { - /// Initializes a new instance of OSOptionProfileData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The list of OS options. /// is null. internal OSOptionProfileData(IEnumerable osOptionPropertyList) @@ -30,15 +33,22 @@ internal OSOptionProfileData(IEnumerable osOpt OSOptionPropertyList = osOptionPropertyList.ToList(); } - /// Initializes a new instance of OSOptionProfileData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The list of OS options. - internal OSOptionProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList osOptionPropertyList) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal OSOptionProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList osOptionPropertyList, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { OSOptionPropertyList = osOptionPropertyList; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OSOptionProfileData() + { } /// The list of OS options. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs index 71ed04c3996d..e2d2b8163582 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs @@ -300,9 +300,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs index bba3f87d32d3..07f256015fc2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs @@ -231,9 +231,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs index 6244b6548054..1c94abddfe19 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs @@ -284,9 +284,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -370,9 +368,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs index 4fd182b1bf23..3562398e135e 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs index 0a9c2f6d1923..56094e9adb55 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClusterSnapshotsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -364,9 +362,7 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(containerServiceTagsObject); - request.Content = content; + request.Content = containerServiceTagsObject; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs index 11e008ac150c..6451a0b3321a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs @@ -786,9 +786,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -864,9 +862,7 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(containerServiceTagsObject); - request.Content = content; + request.Content = containerServiceTagsObject; _userAgent.Apply(message); return message; } @@ -1017,9 +1013,7 @@ internal HttpMessage CreateResetServicePrincipalProfileRequest(string subscripti request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(managedClusterServicePrincipalProfile); - request.Content = content; + request.Content = managedClusterServicePrincipalProfile; _userAgent.Apply(message); return message; } @@ -1096,9 +1090,7 @@ internal HttpMessage CreateResetAadProfileRequest(string subscriptionId, string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(managedClusterAadProfile); - request.Content = content; + request.Content = managedClusterAadProfile; _userAgent.Apply(message); return message; } @@ -1530,9 +1522,7 @@ internal HttpMessage CreateRunCommandRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 7b99af4858c3..92669317c0e7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs index 2c2106f120d2..db03e8aabf13 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGro request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs index fda1c7f91ee7..76ed97c71a24 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs @@ -276,9 +276,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -364,9 +362,7 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(containerServiceTagsObject); - request.Content = content; + request.Content = containerServiceTagsObject; _userAgent.Apply(message); return message; } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs index 170406914957..78b8e1f43093 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AIContentSafetyModelFactory.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AIContentSafetyModelFactory.cs index a66c6f5b7b82..42f386c3638a 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AIContentSafetyModelFactory.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AIContentSafetyModelFactory.cs @@ -14,6 +14,20 @@ namespace Azure.AI.ContentSafety /// Model factory for models. public static partial class AIContentSafetyModelFactory { + /// Initializes a new instance of AnalyzeTextOptions. + /// The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request. + /// The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. + /// The names of blocklists. + /// When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit. + /// A new instance for mocking. + public static AnalyzeTextOptions AnalyzeTextOptions(string text = null, IEnumerable categories = null, IEnumerable blocklistNames = null, bool? breakByBlocklists = null) + { + categories ??= new List(); + blocklistNames ??= new List(); + + return new AnalyzeTextOptions(text, categories?.ToList(), blocklistNames?.ToList(), breakByBlocklists, default); + } + /// Initializes a new instance of AnalyzeTextResult. /// The details of blocklist match. /// Analysis result for Hate category. @@ -25,7 +39,7 @@ public static AnalyzeTextResult AnalyzeTextResult(IEnumerable(); - return new AnalyzeTextResult(blocklistsMatchResults?.ToList(), hateResult, selfHarmResult, sexualResult, violenceResult); + return new AnalyzeTextResult(blocklistsMatchResults?.ToList(), hateResult, selfHarmResult, sexualResult, violenceResult, default); } /// Initializes a new instance of TextBlocklistMatchResult. @@ -34,24 +48,10 @@ public static AnalyzeTextResult AnalyzeTextResult(IEnumerable The content of matched item. /// The character offset of matched text in original input. /// The length of matched text in original input. - /// , or is null. /// A new instance for mocking. public static TextBlocklistMatchResult TextBlocklistMatchResult(string blocklistName = null, string blockItemId = null, string blockItemText = null, int offset = default, int length = default) { - if (blocklistName == null) - { - throw new ArgumentNullException(nameof(blocklistName)); - } - if (blockItemId == null) - { - throw new ArgumentNullException(nameof(blockItemId)); - } - if (blockItemText == null) - { - throw new ArgumentNullException(nameof(blockItemText)); - } - - return new TextBlocklistMatchResult(blocklistName, blockItemId, blockItemText, offset, length); + return new TextBlocklistMatchResult(blocklistName, blockItemId, blockItemText, offset, length, default); } /// Initializes a new instance of TextAnalyzeSeverityResult. @@ -60,7 +60,18 @@ public static TextBlocklistMatchResult TextBlocklistMatchResult(string blocklist /// A new instance for mocking. public static TextAnalyzeSeverityResult TextAnalyzeSeverityResult(TextCategory category = default, int severity = default) { - return new TextAnalyzeSeverityResult(category, severity); + return new TextAnalyzeSeverityResult(category, severity, default); + } + + /// Initializes a new instance of AnalyzeImageOptions. + /// The image needs to be analyzed. + /// The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. + /// A new instance for mocking. + public static AnalyzeImageOptions AnalyzeImageOptions(ContentSafetyImageData image = null, IEnumerable categories = null) + { + categories ??= new List(); + + return new AnalyzeImageOptions(image, categories?.ToList(), default); } /// Initializes a new instance of AnalyzeImageResult. @@ -71,7 +82,7 @@ public static TextAnalyzeSeverityResult TextAnalyzeSeverityResult(TextCategory c /// A new instance for mocking. public static AnalyzeImageResult AnalyzeImageResult(ImageAnalyzeSeverityResult hateResult = null, ImageAnalyzeSeverityResult selfHarmResult = null, ImageAnalyzeSeverityResult sexualResult = null, ImageAnalyzeSeverityResult violenceResult = null) { - return new AnalyzeImageResult(hateResult, selfHarmResult, sexualResult, violenceResult); + return new AnalyzeImageResult(hateResult, selfHarmResult, sexualResult, violenceResult, default); } /// Initializes a new instance of ImageAnalyzeSeverityResult. @@ -80,7 +91,7 @@ public static AnalyzeImageResult AnalyzeImageResult(ImageAnalyzeSeverityResult h /// A new instance for mocking. public static ImageAnalyzeSeverityResult ImageAnalyzeSeverityResult(ImageCategory category = default, int severity = default) { - return new ImageAnalyzeSeverityResult(category, severity); + return new ImageAnalyzeSeverityResult(category, severity, default); } /// Initializes a new instance of TextBlocklist. @@ -89,7 +100,16 @@ public static ImageAnalyzeSeverityResult ImageAnalyzeSeverityResult(ImageCategor /// A new instance for mocking. public static TextBlocklist TextBlocklist(string blocklistName = null, string description = null) { - return new TextBlocklist(blocklistName, description); + return new TextBlocklist(blocklistName, description, default); + } + + /// Initializes a new instance of TextBlockItemInfo. + /// Block item description. + /// Block item content. + /// A new instance for mocking. + public static TextBlockItemInfo TextBlockItemInfo(string description = null, string text = null) + { + return new TextBlockItemInfo(description, text, default); } /// Initializes a new instance of AddBlockItemsResult. @@ -99,7 +119,7 @@ public static AddBlockItemsResult AddBlockItemsResult(IEnumerable { value ??= new List(); - return new AddBlockItemsResult(value?.ToList()); + return new AddBlockItemsResult(value?.ToList(), default); } /// Initializes a new instance of TextBlockItem. @@ -109,7 +129,7 @@ public static AddBlockItemsResult AddBlockItemsResult(IEnumerable /// A new instance for mocking. public static TextBlockItem TextBlockItem(string blockItemId = null, string description = null, string text = null) { - return new TextBlockItem(blockItemId, description, text); + return new TextBlockItem(blockItemId, description, text, default); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.Serialization.cs index e524744c252d..9dacd117329b 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.Serialization.cs @@ -5,32 +5,130 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class AddBlockItemsOptions : IUtf8JsonSerializable + public partial class AddBlockItemsOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("blockItems"u8); writer.WriteStartArray(); foreach (var item in BlockItems) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static AddBlockItemsOptions DeserializeAddBlockItemsOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList blockItems = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("blockItems"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TextBlockItemInfo.DeserializeTextBlockItemInfo(item)); + } + blockItems = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddBlockItemsOptions(blockItems, serializedAdditionalRawData); + } + + AddBlockItemsOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddBlockItemsOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddBlockItemsOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddBlockItemsOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddBlockItemsOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddBlockItemsOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddBlockItemsOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.cs index 1cf626e27a0e..d95de4c2140b 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsOptions.cs @@ -15,6 +15,9 @@ namespace Azure.AI.ContentSafety /// The request of adding blockItems to text blocklist. public partial class AddBlockItemsOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AddBlockItemsOptions. /// Array of blockItemInfo to add. /// is null. @@ -27,9 +30,16 @@ public AddBlockItemsOptions(IEnumerable blockItems) /// Initializes a new instance of AddBlockItemsOptions. /// Array of blockItemInfo to add. - internal AddBlockItemsOptions(IList blockItems) + /// Keeps track of any properties unknown to the library. + internal AddBlockItemsOptions(IList blockItems, Dictionary serializedAdditionalRawData) { BlockItems = blockItems; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AddBlockItemsOptions() + { } /// Array of blockItemInfo to add. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.Serialization.cs index 2cc2e19f8267..adbad8a19b0b 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.Serialization.cs @@ -5,22 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class AddBlockItemsResult + public partial class AddBlockItemsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddBlockItemsResult DeserializeAddBlockItemsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddBlockItemsResult DeserializeAddBlockItemsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,16 +81,61 @@ internal static AddBlockItemsResult DeserializeAddBlockItemsResult(JsonElement e value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AddBlockItemsResult(Optional.ToList(value), serializedAdditionalRawData); + } + + AddBlockItemsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddBlockItemsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddBlockItemsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddBlockItemsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddBlockItemsResult model) + { + if (model is null) + { + return null; } - return new AddBlockItemsResult(Optional.ToList(value)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AddBlockItemsResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator AddBlockItemsResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAddBlockItemsResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddBlockItemsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.cs index cdcc2c531e98..a5a7aba9adc5 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AddBlockItemsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.ContentSafety /// The response of adding blockItems to text blocklist. public partial class AddBlockItemsResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AddBlockItemsResult. internal AddBlockItemsResult() { @@ -21,9 +25,11 @@ internal AddBlockItemsResult() /// Initializes a new instance of AddBlockItemsResult. /// Array of blockItems added. - internal AddBlockItemsResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal AddBlockItemsResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of blockItems added. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.Serialization.cs index 0b09ca42ffa6..57140d4fc628 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.Serialization.cs @@ -5,18 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class AnalyzeImageOptions : IUtf8JsonSerializable + public partial class AnalyzeImageOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image); + if (Image is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Image).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Categories)) { writer.WritePropertyName("categories"u8); @@ -27,15 +42,108 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static AnalyzeImageOptions DeserializeAnalyzeImageOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContentSafetyImageData image = default; + Optional> categories = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("image"u8)) + { + image = ContentSafetyImageData.DeserializeContentSafetyImageData(property.Value); + continue; + } + if (property.NameEquals("categories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ImageCategory(item.GetString())); + } + categories = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalyzeImageOptions(image, Optional.ToList(categories), serializedAdditionalRawData); + } + + AnalyzeImageOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeImageOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalyzeImageOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalyzeImageOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalyzeImageOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalyzeImageOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalyzeImageOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.cs index 228bc2bb7f30..d69544cc6c51 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageOptions.cs @@ -14,6 +14,9 @@ namespace Azure.AI.ContentSafety /// The analysis request of the image. public partial class AnalyzeImageOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnalyzeImageOptions. /// The image needs to be analyzed. /// is null. @@ -28,10 +31,17 @@ public AnalyzeImageOptions(ContentSafetyImageData image) /// Initializes a new instance of AnalyzeImageOptions. /// The image needs to be analyzed. /// The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. - internal AnalyzeImageOptions(ContentSafetyImageData image, IList categories) + /// Keeps track of any properties unknown to the library. + internal AnalyzeImageOptions(ContentSafetyImageData image, IList categories, Dictionary serializedAdditionalRawData) { Image = image; Categories = categories; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeImageOptions() + { } /// The image needs to be analyzed. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.Serialization.cs index aaf7dd21ab38..df1384e0793a 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.Serialization.cs @@ -5,16 +5,91 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class AnalyzeImageResult + public partial class AnalyzeImageResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnalyzeImageResult DeserializeAnalyzeImageResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(HateResult)) + { + writer.WritePropertyName("hateResult"u8); + if (HateResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HateResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(SelfHarmResult)) + { + writer.WritePropertyName("selfHarmResult"u8); + if (SelfHarmResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SelfHarmResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(SexualResult)) + { + writer.WritePropertyName("sexualResult"u8); + if (SexualResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SexualResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(ViolenceResult)) + { + writer.WritePropertyName("violenceResult"u8); + if (ViolenceResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ViolenceResult).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnalyzeImageResult DeserializeAnalyzeImageResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +98,7 @@ internal static AnalyzeImageResult DeserializeAnalyzeImageResult(JsonElement ele Optional selfHarmResult = default; Optional sexualResult = default; Optional violenceResult = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hateResult"u8)) @@ -61,16 +137,61 @@ internal static AnalyzeImageResult DeserializeAnalyzeImageResult(JsonElement ele violenceResult = ImageAnalyzeSeverityResult.DeserializeImageAnalyzeSeverityResult(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalyzeImageResult(hateResult.Value, selfHarmResult.Value, sexualResult.Value, violenceResult.Value, serializedAdditionalRawData); + } + + AnalyzeImageResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeImageResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalyzeImageResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalyzeImageResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalyzeImageResult model) + { + if (model is null) + { + return null; } - return new AnalyzeImageResult(hateResult.Value, selfHarmResult.Value, sexualResult.Value, violenceResult.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnalyzeImageResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator AnalyzeImageResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnalyzeImageResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalyzeImageResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.cs index 45b67ca068c7..f07ab0431374 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeImageResult.cs @@ -5,11 +5,17 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.ContentSafety { /// The analysis response of the image. public partial class AnalyzeImageResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnalyzeImageResult. internal AnalyzeImageResult() { @@ -20,12 +26,14 @@ internal AnalyzeImageResult() /// Analysis result for SelfHarm category. /// Analysis result for Sexual category. /// Analysis result for Violence category. - internal AnalyzeImageResult(ImageAnalyzeSeverityResult hateResult, ImageAnalyzeSeverityResult selfHarmResult, ImageAnalyzeSeverityResult sexualResult, ImageAnalyzeSeverityResult violenceResult) + /// Keeps track of any properties unknown to the library. + internal AnalyzeImageResult(ImageAnalyzeSeverityResult hateResult, ImageAnalyzeSeverityResult selfHarmResult, ImageAnalyzeSeverityResult sexualResult, ImageAnalyzeSeverityResult violenceResult, Dictionary serializedAdditionalRawData) { HateResult = hateResult; SelfHarmResult = selfHarmResult; SexualResult = sexualResult; ViolenceResult = violenceResult; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Analysis result for Hate category. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.Serialization.cs index 91c37f38eb2f..002e79f618f2 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class AnalyzeTextOptions : IUtf8JsonSerializable + public partial class AnalyzeTextOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); @@ -42,15 +50,133 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("breakByBlocklists"u8); writer.WriteBooleanValue(BreakByBlocklists.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static AnalyzeTextOptions DeserializeAnalyzeTextOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + Optional> categories = default; + Optional> blocklistNames = default; + Optional breakByBlocklists = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("categories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new TextCategory(item.GetString())); + } + categories = array; + continue; + } + if (property.NameEquals("blocklistNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + blocklistNames = array; + continue; + } + if (property.NameEquals("breakByBlocklists"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + breakByBlocklists = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalyzeTextOptions(text, Optional.ToList(categories), Optional.ToList(blocklistNames), Optional.ToNullable(breakByBlocklists), serializedAdditionalRawData); + } + + AnalyzeTextOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalyzeTextOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalyzeTextOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalyzeTextOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalyzeTextOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.cs index 73ffda9748cc..29df137e67ba 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextOptions.cs @@ -14,6 +14,9 @@ namespace Azure.AI.ContentSafety /// The analysis request of the text. public partial class AnalyzeTextOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnalyzeTextOptions. /// The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request. /// is null. @@ -31,12 +34,19 @@ public AnalyzeTextOptions(string text) /// The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. /// The names of blocklists. /// When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit. - internal AnalyzeTextOptions(string text, IList categories, IList blocklistNames, bool? breakByBlocklists) + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOptions(string text, IList categories, IList blocklistNames, bool? breakByBlocklists, Dictionary serializedAdditionalRawData) { Text = text; Categories = categories; BlocklistNames = blocklistNames; BreakByBlocklists = breakByBlocklists; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextOptions() + { } /// The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.Serialization.cs index 8256e6e78157..c879ad57bbc3 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.Serialization.cs @@ -5,17 +5,108 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class AnalyzeTextResult + public partial class AnalyzeTextResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AnalyzeTextResult DeserializeAnalyzeTextResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(BlocklistsMatchResults)) + { + writer.WritePropertyName("blocklistsMatchResults"u8); + writer.WriteStartArray(); + foreach (var item in BlocklistsMatchResults) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(HateResult)) + { + writer.WritePropertyName("hateResult"u8); + if (HateResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HateResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(SelfHarmResult)) + { + writer.WritePropertyName("selfHarmResult"u8); + if (SelfHarmResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SelfHarmResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(SexualResult)) + { + writer.WritePropertyName("sexualResult"u8); + if (SexualResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SexualResult).Serialize(writer, options); + } + } + if (Optional.IsDefined(ViolenceResult)) + { + writer.WritePropertyName("violenceResult"u8); + if (ViolenceResult is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ViolenceResult).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AnalyzeTextResult DeserializeAnalyzeTextResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +116,7 @@ internal static AnalyzeTextResult DeserializeAnalyzeTextResult(JsonElement eleme Optional selfHarmResult = default; Optional sexualResult = default; Optional violenceResult = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blocklistsMatchResults"u8)) @@ -77,16 +169,61 @@ internal static AnalyzeTextResult DeserializeAnalyzeTextResult(JsonElement eleme violenceResult = TextAnalyzeSeverityResult.DeserializeTextAnalyzeSeverityResult(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalyzeTextResult(Optional.ToList(blocklistsMatchResults), hateResult.Value, selfHarmResult.Value, sexualResult.Value, violenceResult.Value, serializedAdditionalRawData); + } + + AnalyzeTextResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalyzeTextResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalyzeTextResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalyzeTextResult model) + { + if (model is null) + { + return null; } - return new AnalyzeTextResult(Optional.ToList(blocklistsMatchResults), hateResult.Value, selfHarmResult.Value, sexualResult.Value, violenceResult.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnalyzeTextResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator AnalyzeTextResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnalyzeTextResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalyzeTextResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.cs index 125ca8a7f6ee..c89225791e30 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/AnalyzeTextResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,9 @@ namespace Azure.AI.ContentSafety /// The analysis response of the text. public partial class AnalyzeTextResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of AnalyzeTextResult. internal AnalyzeTextResult() { @@ -25,13 +29,15 @@ internal AnalyzeTextResult() /// Analysis result for SelfHarm category. /// Analysis result for Sexual category. /// Analysis result for Violence category. - internal AnalyzeTextResult(IReadOnlyList blocklistsMatchResults, TextAnalyzeSeverityResult hateResult, TextAnalyzeSeverityResult selfHarmResult, TextAnalyzeSeverityResult sexualResult, TextAnalyzeSeverityResult violenceResult) + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextResult(IReadOnlyList blocklistsMatchResults, TextAnalyzeSeverityResult hateResult, TextAnalyzeSeverityResult selfHarmResult, TextAnalyzeSeverityResult sexualResult, TextAnalyzeSeverityResult violenceResult, Dictionary serializedAdditionalRawData) { BlocklistsMatchResults = blocklistsMatchResults; HateResult = hateResult; SelfHarmResult = selfHarmResult; SexualResult = sexualResult; ViolenceResult = violenceResult; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The details of blocklist match. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClient.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClient.cs index 5cf374ddc9a3..31a493889956 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClient.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClient.cs @@ -79,8 +79,8 @@ public virtual async Task> AnalyzeTextAsync(AnalyzeT Argument.AssertNotNull(body, nameof(body)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await AnalyzeTextAsync(body.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(AnalyzeTextResult.FromResponse(response), response); + Response response = await AnalyzeTextAsync(body, context).ConfigureAwait(false); + return Response.FromValue((AnalyzeTextResult)response, response); } /// Analyze Text. @@ -94,8 +94,8 @@ public virtual Response AnalyzeText(AnalyzeTextOptions body, Argument.AssertNotNull(body, nameof(body)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = AnalyzeText(body.ToRequestContent(), context); - return Response.FromValue(AnalyzeTextResult.FromResponse(response), response); + Response response = AnalyzeText(body, context); + return Response.FromValue((AnalyzeTextResult)response, response); } /// @@ -187,8 +187,8 @@ public virtual async Task> AnalyzeImageAsync(Analyz Argument.AssertNotNull(body, nameof(body)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await AnalyzeImageAsync(body.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(AnalyzeImageResult.FromResponse(response), response); + Response response = await AnalyzeImageAsync(body, context).ConfigureAwait(false); + return Response.FromValue((AnalyzeImageResult)response, response); } /// Analyze Image. @@ -202,8 +202,8 @@ public virtual Response AnalyzeImage(AnalyzeImageOptions bod Argument.AssertNotNull(body, nameof(body)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = AnalyzeImage(body.ToRequestContent(), context); - return Response.FromValue(AnalyzeImageResult.FromResponse(response), response); + Response response = AnalyzeImage(body, context); + return Response.FromValue((AnalyzeImageResult)response, response); } /// @@ -297,7 +297,7 @@ public virtual async Task> GetTextBlocklistAsync(string RequestContext context = FromCancellationToken(cancellationToken); Response response = await GetTextBlocklistAsync(blocklistName, context).ConfigureAwait(false); - return Response.FromValue(TextBlocklist.FromResponse(response), response); + return Response.FromValue((TextBlocklist)response, response); } /// Get Text Blocklist By blocklistName. @@ -313,7 +313,7 @@ public virtual Response GetTextBlocklist(string blocklistName, Ca RequestContext context = FromCancellationToken(cancellationToken); Response response = GetTextBlocklist(blocklistName, context); - return Response.FromValue(TextBlocklist.FromResponse(response), response); + return Response.FromValue((TextBlocklist)response, response); } /// @@ -556,8 +556,8 @@ public virtual async Task> AddBlockItemsAsync(stri Argument.AssertNotNull(addBlockItemsOptions, nameof(addBlockItemsOptions)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await AddBlockItemsAsync(blocklistName, addBlockItemsOptions.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(AddBlockItemsResult.FromResponse(response), response); + Response response = await AddBlockItemsAsync(blocklistName, addBlockItemsOptions, context).ConfigureAwait(false); + return Response.FromValue((AddBlockItemsResult)response, response); } /// Add BlockItems To Text Blocklist. @@ -574,8 +574,8 @@ public virtual Response AddBlockItems(string blocklistName, Argument.AssertNotNull(addBlockItemsOptions, nameof(addBlockItemsOptions)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = AddBlockItems(blocklistName, addBlockItemsOptions.ToRequestContent(), context); - return Response.FromValue(AddBlockItemsResult.FromResponse(response), response); + Response response = AddBlockItems(blocklistName, addBlockItemsOptions, context); + return Response.FromValue((AddBlockItemsResult)response, response); } /// @@ -676,7 +676,7 @@ public virtual async Task RemoveBlockItemsAsync(string blocklistName, Argument.AssertNotNull(removeBlockItemsOptions, nameof(removeBlockItemsOptions)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await RemoveBlockItemsAsync(blocklistName, removeBlockItemsOptions.ToRequestContent(), context).ConfigureAwait(false); + Response response = await RemoveBlockItemsAsync(blocklistName, removeBlockItemsOptions, context).ConfigureAwait(false); return response; } @@ -694,7 +694,7 @@ public virtual Response RemoveBlockItems(string blocklistName, RemoveBlockItemsO Argument.AssertNotNull(removeBlockItemsOptions, nameof(removeBlockItemsOptions)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = RemoveBlockItems(blocklistName, removeBlockItemsOptions.ToRequestContent(), context); + Response response = RemoveBlockItems(blocklistName, removeBlockItemsOptions, context); return response; } @@ -797,7 +797,7 @@ public virtual async Task> GetTextBlocklistItemAsync(str RequestContext context = FromCancellationToken(cancellationToken); Response response = await GetTextBlocklistItemAsync(blocklistName, blockItemId, context).ConfigureAwait(false); - return Response.FromValue(TextBlockItem.FromResponse(response), response); + return Response.FromValue((TextBlockItem)response, response); } /// Get BlockItem By blocklistName And blockItemId. @@ -815,7 +815,7 @@ public virtual Response GetTextBlocklistItem(string blocklistName RequestContext context = FromCancellationToken(cancellationToken); Response response = GetTextBlocklistItem(blocklistName, blockItemId, context); - return Response.FromValue(TextBlockItem.FromResponse(response), response); + return Response.FromValue((TextBlockItem)response, response); } /// @@ -949,7 +949,7 @@ public virtual AsyncPageable GetTextBlocklistsAsync(RequestContext c { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklists", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklists", "value", "nextLink", context); } /// @@ -975,7 +975,7 @@ public virtual Pageable GetTextBlocklists(RequestContext context) { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistsRequest(context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklists", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklists", "value", "nextLink", context); } /// Get All BlockItems By blocklistName. @@ -1049,7 +1049,7 @@ public virtual AsyncPageable GetTextBlocklistItemsAsync(string block HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistItemsRequest(blocklistName, maxCount, skip, maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistItemsNextPageRequest(nextLink, blocklistName, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklistItems", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklistItems", "value", "nextLink", context); } /// @@ -1083,7 +1083,7 @@ public virtual Pageable GetTextBlocklistItems(string blocklistName, HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTextBlocklistItemsRequest(blocklistName, maxCount, skip, maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTextBlocklistItemsNextPageRequest(nextLink, blocklistName, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklistItems", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContentSafetyClient.GetTextBlocklistItems", "value", "nextLink", context); } internal HttpMessage CreateAnalyzeTextRequest(RequestContent content, RequestContext context) diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.Serialization.cs index cc1640cbb19d..366a55d48f23 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class ContentSafetyImageData : IUtf8JsonSerializable + public partial class ContentSafetyImageData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Content)) { @@ -25,15 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("blobUrl"u8); writer.WriteStringValue(BlobUrl.AbsoluteUri); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static ContentSafetyImageData DeserializeContentSafetyImageData(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional content = default; + Optional blobUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + content = BinaryData.FromBytes(property.Value.GetBytesFromBase64("D")); + continue; + } + if (property.NameEquals("blobUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blobUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContentSafetyImageData(content.Value, blobUrl.Value, serializedAdditionalRawData); + } + + ContentSafetyImageData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContentSafetyImageData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContentSafetyImageData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContentSafetyImageData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContentSafetyImageData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContentSafetyImageData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContentSafetyImageData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.cs index 5bcf3028b84f..9afb15f99f3b 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyImageData.cs @@ -6,12 +6,16 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.AI.ContentSafety { /// The content or blob url of image, could be base64 encoding bytes or blob url. If both are given, the request will be refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum size of image is 50 pixels * 50 pixels. public partial class ContentSafetyImageData { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of ContentSafetyImageData. public ContentSafetyImageData() { @@ -20,10 +24,12 @@ public ContentSafetyImageData() /// Initializes a new instance of ContentSafetyImageData. /// Base64 encoding of image. /// The blob url of image. - internal ContentSafetyImageData(BinaryData content, Uri blobUrl) + /// Keeps track of any properties unknown to the library. + internal ContentSafetyImageData(BinaryData content, Uri blobUrl, Dictionary serializedAdditionalRawData) { Content = content; BlobUrl = blobUrl; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.Serialization.cs index 8463864488a1..08df63c400fe 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.Serialization.cs @@ -5,22 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class ImageAnalyzeSeverityResult + public partial class ImageAnalyzeSeverityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ImageAnalyzeSeverityResult DeserializeImageAnalyzeSeverityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + writer.WritePropertyName("severity"u8); + writer.WriteNumberValue(Severity); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ImageAnalyzeSeverityResult DeserializeImageAnalyzeSeverityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ImageCategory category = default; int severity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -33,16 +65,61 @@ internal static ImageAnalyzeSeverityResult DeserializeImageAnalyzeSeverityResult severity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageAnalyzeSeverityResult(category, severity, serializedAdditionalRawData); + } + + ImageAnalyzeSeverityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageAnalyzeSeverityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageAnalyzeSeverityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageAnalyzeSeverityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageAnalyzeSeverityResult model) + { + if (model is null) + { + return null; } - return new ImageAnalyzeSeverityResult(category, severity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ImageAnalyzeSeverityResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator ImageAnalyzeSeverityResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeImageAnalyzeSeverityResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageAnalyzeSeverityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.cs index 9af75fe1da78..43f0935c3149 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ImageAnalyzeSeverityResult.cs @@ -5,11 +5,17 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.ContentSafety { /// Image analysis result. public partial class ImageAnalyzeSeverityResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of ImageAnalyzeSeverityResult. /// The image category. /// The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6. @@ -19,6 +25,22 @@ internal ImageAnalyzeSeverityResult(ImageCategory category, int severity) Severity = severity; } + /// Initializes a new instance of ImageAnalyzeSeverityResult. + /// The image category. + /// The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6. + /// Keeps track of any properties unknown to the library. + internal ImageAnalyzeSeverityResult(ImageCategory category, int severity, Dictionary serializedAdditionalRawData) + { + Category = category; + Severity = severity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImageAnalyzeSeverityResult() + { + } + /// The image category. public ImageCategory Category { get; } /// The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.Serialization.cs index d1df71a0dbe1..e2ebe454f78d 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class RemoveBlockItemsOptions : IUtf8JsonSerializable + public partial class RemoveBlockItemsOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("blockItemIds"u8); writer.WriteStartArray(); @@ -22,15 +30,98 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static RemoveBlockItemsOptions DeserializeRemoveBlockItemsOptions(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList blockItemIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("blockItemIds"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + blockItemIds = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RemoveBlockItemsOptions(blockItemIds, serializedAdditionalRawData); + } + + RemoveBlockItemsOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveBlockItemsOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RemoveBlockItemsOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRemoveBlockItemsOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RemoveBlockItemsOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RemoveBlockItemsOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRemoveBlockItemsOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.cs index d8759e8db58e..3b5478a02c5c 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/RemoveBlockItemsOptions.cs @@ -15,6 +15,9 @@ namespace Azure.AI.ContentSafety /// The request of removing blockItems from text blocklist. public partial class RemoveBlockItemsOptions { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of RemoveBlockItemsOptions. /// Array of blockItemIds to remove. /// is null. @@ -27,9 +30,16 @@ public RemoveBlockItemsOptions(IEnumerable blockItemIds) /// Initializes a new instance of RemoveBlockItemsOptions. /// Array of blockItemIds to remove. - internal RemoveBlockItemsOptions(IList blockItemIds) + /// Keeps track of any properties unknown to the library. + internal RemoveBlockItemsOptions(IList blockItemIds, Dictionary serializedAdditionalRawData) { BlockItemIds = blockItemIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RemoveBlockItemsOptions() + { } /// Array of blockItemIds to remove. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.Serialization.cs index 6f2b4c9a2c82..c58eb6c27683 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.Serialization.cs @@ -5,22 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class TextAnalyzeSeverityResult + public partial class TextAnalyzeSeverityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TextAnalyzeSeverityResult DeserializeTextAnalyzeSeverityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + writer.WritePropertyName("severity"u8); + writer.WriteNumberValue(Severity); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TextAnalyzeSeverityResult DeserializeTextAnalyzeSeverityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } TextCategory category = default; int severity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -33,16 +65,61 @@ internal static TextAnalyzeSeverityResult DeserializeTextAnalyzeSeverityResult(J severity = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextAnalyzeSeverityResult(category, severity, serializedAdditionalRawData); + } + + TextAnalyzeSeverityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextAnalyzeSeverityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextAnalyzeSeverityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextAnalyzeSeverityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextAnalyzeSeverityResult model) + { + if (model is null) + { + return null; } - return new TextAnalyzeSeverityResult(category, severity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TextAnalyzeSeverityResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator TextAnalyzeSeverityResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTextAnalyzeSeverityResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextAnalyzeSeverityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.cs index b77d1561e74d..7135525634a2 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextAnalyzeSeverityResult.cs @@ -5,11 +5,17 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.ContentSafety { /// Text analysis result. public partial class TextAnalyzeSeverityResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of TextAnalyzeSeverityResult. /// The text category. /// The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6. @@ -19,6 +25,22 @@ internal TextAnalyzeSeverityResult(TextCategory category, int severity) Severity = severity; } + /// Initializes a new instance of TextAnalyzeSeverityResult. + /// The text category. + /// The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6. + /// Keeps track of any properties unknown to the library. + internal TextAnalyzeSeverityResult(TextCategory category, int severity, Dictionary serializedAdditionalRawData) + { + Category = category; + Severity = severity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextAnalyzeSeverityResult() + { + } + /// The text category. public TextCategory Category { get; } /// The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.Serialization.cs index a29aa1d978f6..ac8fd9d1cdb2 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.Serialization.cs @@ -5,16 +5,52 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class TextBlockItem + public partial class TextBlockItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TextBlockItem DeserializeTextBlockItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("blockItemId"u8); + writer.WriteStringValue(BlockItemId); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TextBlockItem DeserializeTextBlockItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +58,7 @@ internal static TextBlockItem DeserializeTextBlockItem(JsonElement element) string blockItemId = default; Optional description = default; string text = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blockItemId"u8)) @@ -39,16 +76,61 @@ internal static TextBlockItem DeserializeTextBlockItem(JsonElement element) text = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextBlockItem(blockItemId, description.Value, text, serializedAdditionalRawData); + } + + TextBlockItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextBlockItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextBlockItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextBlockItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextBlockItem model) + { + if (model is null) + { + return null; } - return new TextBlockItem(blockItemId, description.Value, text); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TextBlockItem FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator TextBlockItem(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTextBlockItem(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextBlockItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.cs index 23ac2522a815..fcf218b6e1e2 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItem.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.ContentSafety @@ -13,6 +14,9 @@ namespace Azure.AI.ContentSafety /// Item in TextBlocklist. public partial class TextBlockItem { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of TextBlockItem. /// Block Item Id. It will be uuid. /// Block item content. @@ -30,11 +34,18 @@ internal TextBlockItem(string blockItemId, string text) /// Block Item Id. It will be uuid. /// Block item description. /// Block item content. - internal TextBlockItem(string blockItemId, string description, string text) + /// Keeps track of any properties unknown to the library. + internal TextBlockItem(string blockItemId, string description, string text, Dictionary serializedAdditionalRawData) { BlockItemId = blockItemId; Description = description; Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextBlockItem() + { } /// Block Item Id. It will be uuid. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.Serialization.cs index 0f78b5dc1d76..dc7aec97c6af 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class TextBlockItemInfo : IUtf8JsonSerializable + public partial class TextBlockItemInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Description)) { @@ -22,15 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() + internal static TextBlockItemInfo DeserializeTextBlockItemInfo(JsonElement element, ModelSerializerOptions options = default) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + string text = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextBlockItemInfo(description.Value, text, serializedAdditionalRawData); + } + + TextBlockItemInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextBlockItemInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextBlockItemInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextBlockItemInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextBlockItemInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TextBlockItemInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextBlockItemInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.cs index f983f67dbbee..baa58ffce3b4 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlockItemInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.ContentSafety @@ -13,6 +14,9 @@ namespace Azure.AI.ContentSafety /// Block item info in text blocklist. public partial class TextBlockItemInfo { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of TextBlockItemInfo. /// Block item content. /// is null. @@ -26,10 +30,17 @@ public TextBlockItemInfo(string text) /// Initializes a new instance of TextBlockItemInfo. /// Block item description. /// Block item content. - internal TextBlockItemInfo(string description, string text) + /// Keeps track of any properties unknown to the library. + internal TextBlockItemInfo(string description, string text, Dictionary serializedAdditionalRawData) { Description = description; Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextBlockItemInfo() + { } /// Block item description. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.Serialization.cs index 5fb614186b1a..f4b0cc9450ea 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.Serialization.cs @@ -5,22 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class TextBlocklist + public partial class TextBlocklist : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TextBlocklist DeserializeTextBlocklist(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("blocklistName"u8); + writer.WriteStringValue(BlocklistName); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TextBlocklist DeserializeTextBlocklist(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string blocklistName = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blocklistName"u8)) @@ -33,16 +68,61 @@ internal static TextBlocklist DeserializeTextBlocklist(JsonElement element) description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextBlocklist(blocklistName, description.Value, serializedAdditionalRawData); + } + + TextBlocklist IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextBlocklist(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextBlocklist IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextBlocklist(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextBlocklist model) + { + if (model is null) + { + return null; } - return new TextBlocklist(blocklistName, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TextBlocklist FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator TextBlocklist(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTextBlocklist(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextBlocklist(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.cs index c2261aee3d68..710e18dc4cc1 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklist.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.ContentSafety @@ -13,6 +14,9 @@ namespace Azure.AI.ContentSafety /// Text Blocklist. public partial class TextBlocklist { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of TextBlocklist. /// Text blocklist name. /// is null. @@ -26,10 +30,17 @@ internal TextBlocklist(string blocklistName) /// Initializes a new instance of TextBlocklist. /// Text blocklist name. /// Text blocklist description. - internal TextBlocklist(string blocklistName, string description) + /// Keeps track of any properties unknown to the library. + internal TextBlocklist(string blocklistName, string description, Dictionary serializedAdditionalRawData) { BlocklistName = blocklistName; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextBlocklist() + { } /// Text blocklist name. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.Serialization.cs index 5af845e64bb1..2da77c37c61e 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.Serialization.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.Serialization.cs @@ -5,16 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.AI.ContentSafety { - public partial class TextBlocklistMatchResult + public partial class TextBlocklistMatchResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TextBlocklistMatchResult DeserializeTextBlocklistMatchResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("blocklistName"u8); + writer.WriteStringValue(BlocklistName); + writer.WritePropertyName("blockItemId"u8); + writer.WriteStringValue(BlockItemId); + writer.WritePropertyName("blockItemText"u8); + writer.WriteStringValue(BlockItemText); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TextBlocklistMatchResult DeserializeTextBlocklistMatchResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +61,7 @@ internal static TextBlocklistMatchResult DeserializeTextBlocklistMatchResult(Jso string blockItemText = default; int offset = default; int length = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blocklistName"u8)) @@ -51,16 +89,61 @@ internal static TextBlocklistMatchResult DeserializeTextBlocklistMatchResult(Jso length = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TextBlocklistMatchResult(blocklistName, blockItemId, blockItemText, offset, length, serializedAdditionalRawData); + } + + TextBlocklistMatchResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTextBlocklistMatchResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TextBlocklistMatchResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTextBlocklistMatchResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TextBlocklistMatchResult model) + { + if (model is null) + { + return null; } - return new TextBlocklistMatchResult(blocklistName, blockItemId, blockItemText, offset, length); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); } - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TextBlocklistMatchResult FromResponse(Response response) + /// Converts a into a . + /// The to convert. + public static explicit operator TextBlocklistMatchResult(Response response) { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTextBlocklistMatchResult(document.RootElement); + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTextBlocklistMatchResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.cs index b4fc2ead623b..c83cc7b07268 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/TextBlocklistMatchResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.AI.ContentSafety @@ -13,6 +14,9 @@ namespace Azure.AI.ContentSafety /// The result of blocklist match. public partial class TextBlocklistMatchResult { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + /// Initializes a new instance of TextBlocklistMatchResult. /// The name of matched blocklist. /// The id of matched item. @@ -33,6 +37,28 @@ internal TextBlocklistMatchResult(string blocklistName, string blockItemId, stri Length = length; } + /// Initializes a new instance of TextBlocklistMatchResult. + /// The name of matched blocklist. + /// The id of matched item. + /// The content of matched item. + /// The character offset of matched text in original input. + /// The length of matched text in original input. + /// Keeps track of any properties unknown to the library. + internal TextBlocklistMatchResult(string blocklistName, string blockItemId, string blockItemText, int offset, int length, Dictionary serializedAdditionalRawData) + { + BlocklistName = blocklistName; + BlockItemId = blockItemId; + BlockItemText = blockItemText; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextBlocklistMatchResult() + { + } + /// The name of matched blocklist. public string BlocklistName { get; } /// The id of matched item. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/CoreTestFrameworkModelFactory.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/CoreTestFrameworkModelFactory.cs new file mode 100644 index 000000000000..84a85eca84ce --- /dev/null +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/CoreTestFrameworkModelFactory.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Core.TestFramework.Models +{ + /// Model factory for models. + public static partial class CoreTestFrameworkModelFactory + { + /// Initializes a new instance of . + /// + /// + /// A new instance for mocking. + public static StartInformation StartInformation(string xRecordingFile = null, string xRecordingAssetsFile = null) + { + return new StartInformation(xRecordingFile, xRecordingAssetsFile, default); + } + + /// Initializes a new instance of . + /// + /// + /// + /// + /// A new instance for mocking. + public static BodyKeySanitizer BodyKeySanitizer(string jsonPath = null, string value = null, string regex = null, string groupForReplace = null) + { + return new BodyKeySanitizer(jsonPath, value, regex, groupForReplace, default); + } + + /// Initializes a new instance of . + /// + /// + /// + /// + /// A new instance for mocking. + public static HeaderRegexSanitizer HeaderRegexSanitizer(string key = null, string value = null, string regex = null, string groupForReplace = null) + { + return new HeaderRegexSanitizer(key, value, regex, groupForReplace, default); + } + + /// Initializes a new instance of . + /// + /// + /// + /// A new instance for mocking. + public static UriRegexSanitizer UriRegexSanitizer(string regex = null, string value = null, string groupForReplace = null) + { + return new UriRegexSanitizer(regex, value, groupForReplace, default); + } + + /// Initializes a new instance of . + /// + /// + /// + /// Condition to apply for the sanitization or transform. If the condition is not met, sanitization/transform is not performed. + /// A new instance for mocking. + public static BodyRegexSanitizer BodyRegexSanitizer(string regex = null, string value = null, string groupForReplace = null, Condition condition = null) + { + return new BodyRegexSanitizer(regex, value, groupForReplace, condition, default); + } + + /// Initializes a new instance of . + /// + /// + /// Condition to apply for the sanitization or transform. If the condition is not met, sanitization/transform is not performed. + /// A new instance for mocking. + public static HeaderTransform HeaderTransform(string key = null, string value = null, Condition condition = null) + { + return new HeaderTransform(key, value, condition, default); + } + } +} diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.Serialization.cs index 703324ecefda..b6e61520f881 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class BodyKeySanitizer : IUtf8JsonSerializable + public partial class BodyKeySanitizer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(JsonPath)) { @@ -32,7 +40,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("groupForReplace"u8); writer.WriteStringValue(GroupForReplace); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static BodyKeySanitizer DeserializeBodyKeySanitizer(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional jsonPath = default; + string value = default; + Optional regex = default; + Optional groupForReplace = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("jsonPath"u8)) + { + jsonPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("regex"u8)) + { + regex = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupForReplace"u8)) + { + groupForReplace = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BodyKeySanitizer(jsonPath.Value, value, regex.Value, groupForReplace.Value, serializedAdditionalRawData); + } + + BodyKeySanitizer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBodyKeySanitizer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BodyKeySanitizer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBodyKeySanitizer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BodyKeySanitizer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BodyKeySanitizer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBodyKeySanitizer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.cs index b5cd7d537f0a..a39a6646a39a 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyKeySanitizer.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Core.TestFramework.Models @@ -13,7 +14,10 @@ namespace Azure.Core.TestFramework.Models /// Sanitizer for a request body. public partial class BodyKeySanitizer { - /// Initializes a new instance of BodyKeySanitizer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. public BodyKeySanitizer(string value) @@ -23,6 +27,26 @@ public BodyKeySanitizer(string value) Value = value; } + /// Initializes a new instance of . + /// + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal BodyKeySanitizer(string jsonPath, string value, string regex, string groupForReplace, Dictionary serializedAdditionalRawData) + { + JsonPath = jsonPath; + Value = value; + Regex = regex; + GroupForReplace = groupForReplace; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BodyKeySanitizer() + { + } + /// Gets or sets the json path. public string JsonPath { get; set; } /// Gets the value. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.Serialization.cs index d2f8ad69dc79..ef32e8187854 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class BodyRegexSanitizer : IUtf8JsonSerializable + public partial class BodyRegexSanitizer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("regex"u8); writer.WriteStringValue(Regex); @@ -27,9 +35,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Condition)) { writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); + if (Condition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Condition).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static BodyRegexSanitizer DeserializeBodyRegexSanitizer(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string regex = default; + string value = default; + Optional groupForReplace = default; + Optional condition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("regex"u8)) + { + regex = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupForReplace"u8)) + { + groupForReplace = property.Value.GetString(); + continue; + } + if (property.NameEquals("condition"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + condition = Condition.DeserializeCondition(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BodyRegexSanitizer(regex, value, groupForReplace.Value, condition.Value, serializedAdditionalRawData); + } + + BodyRegexSanitizer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBodyRegexSanitizer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BodyRegexSanitizer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBodyRegexSanitizer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BodyRegexSanitizer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BodyRegexSanitizer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBodyRegexSanitizer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.cs index dc40026ce935..f1ba0272cd63 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/BodyRegexSanitizer.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Core.TestFramework.Models @@ -13,7 +14,10 @@ namespace Azure.Core.TestFramework.Models /// Sanitizer for a request body. public partial class BodyRegexSanitizer { - /// Initializes a new instance of BodyRegexSanitizer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// /// or is null. @@ -26,6 +30,26 @@ public BodyRegexSanitizer(string regex, string value) Value = value; } + /// Initializes a new instance of . + /// + /// + /// + /// Condition to apply for the sanitization or transform. If the condition is not met, sanitization/transform is not performed. + /// Keeps track of any properties unknown to the library. + internal BodyRegexSanitizer(string regex, string value, string groupForReplace, Condition condition, Dictionary serializedAdditionalRawData) + { + Regex = regex; + Value = value; + GroupForReplace = groupForReplace; + Condition = condition; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BodyRegexSanitizer() + { + } + /// Gets the regex. public string Regex { get; } /// Gets the value. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.Serialization.cs index c215e83a0144..ead440ebc828 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class Condition : IUtf8JsonSerializable + public partial class Condition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UriRegex)) { @@ -23,9 +31,112 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ResponseHeader)) { writer.WritePropertyName("responseHeader"u8); - writer.WriteObjectValue(ResponseHeader); + if (ResponseHeader is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ResponseHeader).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static Condition DeserializeCondition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional uriRegex = default; + Optional responseHeader = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uriRegex"u8)) + { + uriRegex = property.Value.GetString(); + continue; + } + if (property.NameEquals("responseHeader"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + responseHeader = HeaderCondition.DeserializeHeaderCondition(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Condition(uriRegex.Value, responseHeader.Value, serializedAdditionalRawData); + } + + Condition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Condition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Condition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Condition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.cs index 190e61d33637..ce6a7091a5f3 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/Condition.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Core.TestFramework.Models { /// Condition to apply for the sanitization or transform. If the condition is not met, sanitization/transform is not performed. public partial class Condition { - /// Initializes a new instance of Condition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Condition() { } + /// Initializes a new instance of . + /// + /// Header condition to apply. + /// Keeps track of any properties unknown to the library. + internal Condition(string uriRegex, HeaderCondition responseHeader, Dictionary serializedAdditionalRawData) + { + UriRegex = uriRegex; + ResponseHeader = responseHeader; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the uri regex. public string UriRegex { get; set; } /// Header condition to apply. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.Serialization.cs index 6349e423f010..6d63536577d6 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class CustomDefaultMatcher : IUtf8JsonSerializable + public partial class CustomDefaultMatcher : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExcludedHeaders)) { @@ -35,7 +43,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ignoredQueryParameters"u8); writer.WriteStringValue(IgnoredQueryParameters); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CustomDefaultMatcher DeserializeCustomDefaultMatcher(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional excludedHeaders = default; + Optional compareBodies = default; + Optional ignoredHeaders = default; + Optional ignoredQueryParameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("excludedHeaders"u8)) + { + excludedHeaders = property.Value.GetString(); + continue; + } + if (property.NameEquals("compareBodies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + compareBodies = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("ignoredHeaders"u8)) + { + ignoredHeaders = property.Value.GetString(); + continue; + } + if (property.NameEquals("ignoredQueryParameters"u8)) + { + ignoredQueryParameters = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomDefaultMatcher(excludedHeaders.Value, Optional.ToNullable(compareBodies), ignoredHeaders.Value, ignoredQueryParameters.Value, serializedAdditionalRawData); + } + + CustomDefaultMatcher IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDefaultMatcher(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDefaultMatcher IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDefaultMatcher(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomDefaultMatcher model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomDefaultMatcher(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomDefaultMatcher(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.cs index bc1647f43558..c7ae30cc56ea 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/CustomDefaultMatcher.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Core.TestFramework.Models { /// The CustomDefaultMatcher. public partial class CustomDefaultMatcher { - /// Initializes a new instance of CustomDefaultMatcher. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomDefaultMatcher() { } + /// Initializes a new instance of . + /// + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal CustomDefaultMatcher(string excludedHeaders, bool? compareBodies, string ignoredHeaders, string ignoredQueryParameters, Dictionary serializedAdditionalRawData) + { + ExcludedHeaders = excludedHeaders; + CompareBodies = compareBodies; + IgnoredHeaders = ignoredHeaders; + IgnoredQueryParameters = ignoredQueryParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the excluded headers. public string ExcludedHeaders { get; set; } /// Gets or sets the compare bodies. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.Serialization.cs index 306fe919a2bb..15c2ce9590fd 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class HeaderCondition : IUtf8JsonSerializable + public partial class HeaderCondition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Key)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("valueRegex"u8); writer.WriteStringValue(ValueRegex); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HeaderCondition DeserializeHeaderCondition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional key = default; + Optional valueRegex = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("valueRegex"u8)) + { + valueRegex = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HeaderCondition(key.Value, valueRegex.Value, serializedAdditionalRawData); + } + + HeaderCondition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHeaderCondition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HeaderCondition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHeaderCondition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HeaderCondition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HeaderCondition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHeaderCondition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.cs index da8bc71b2e7a..682f41e7450c 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderCondition.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Core.TestFramework.Models { /// Header condition to apply. public partial class HeaderCondition { - /// Initializes a new instance of HeaderCondition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HeaderCondition() { } + /// Initializes a new instance of . + /// + /// + /// Keeps track of any properties unknown to the library. + internal HeaderCondition(string key, string valueRegex, Dictionary serializedAdditionalRawData) + { + Key = key; + ValueRegex = valueRegex; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the key. public string Key { get; set; } /// Gets or sets the value regex. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.Serialization.cs index 4be8f40c2461..f6acb0e70d5c 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class HeaderRegexSanitizer : IUtf8JsonSerializable + public partial class HeaderRegexSanitizer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); @@ -29,7 +37,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("groupForReplace"u8); writer.WriteStringValue(GroupForReplace); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HeaderRegexSanitizer DeserializeHeaderRegexSanitizer(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string value = default; + Optional regex = default; + Optional groupForReplace = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("regex"u8)) + { + regex = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupForReplace"u8)) + { + groupForReplace = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HeaderRegexSanitizer(key, value, regex.Value, groupForReplace.Value, serializedAdditionalRawData); + } + + HeaderRegexSanitizer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHeaderRegexSanitizer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HeaderRegexSanitizer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHeaderRegexSanitizer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HeaderRegexSanitizer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HeaderRegexSanitizer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHeaderRegexSanitizer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.cs index 292c844b8861..79e32f431feb 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderRegexSanitizer.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Core.TestFramework.Models @@ -13,7 +14,10 @@ namespace Azure.Core.TestFramework.Models /// Sanitizer for a request header. public partial class HeaderRegexSanitizer { - /// Initializes a new instance of HeaderRegexSanitizer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// /// or is null. @@ -26,6 +30,26 @@ public HeaderRegexSanitizer(string key, string value) Value = value; } + /// Initializes a new instance of . + /// + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal HeaderRegexSanitizer(string key, string value, string regex, string groupForReplace, Dictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + Regex = regex; + GroupForReplace = groupForReplace; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HeaderRegexSanitizer() + { + } + /// Gets the key. public string Key { get; } /// Gets the value. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.Serialization.cs index 104b78a727d9..527fe10cd299 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class HeaderTransform : IUtf8JsonSerializable + public partial class HeaderTransform : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); @@ -22,9 +30,118 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Condition)) { writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); + if (Condition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Condition).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static HeaderTransform DeserializeHeaderTransform(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string value = default; + Optional condition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("condition"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + condition = Condition.DeserializeCondition(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HeaderTransform(key, value, condition.Value, serializedAdditionalRawData); + } + + HeaderTransform IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHeaderTransform(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HeaderTransform IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHeaderTransform(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HeaderTransform model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HeaderTransform(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHeaderTransform(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.cs index eccaa0526381..a39c8b6641f6 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/HeaderTransform.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Core.TestFramework.Models @@ -13,7 +14,10 @@ namespace Azure.Core.TestFramework.Models /// The HeaderTransform. public partial class HeaderTransform { - /// Initializes a new instance of HeaderTransform. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// /// or is null. @@ -26,6 +30,24 @@ public HeaderTransform(string key, string value) Value = value; } + /// Initializes a new instance of . + /// + /// + /// Condition to apply for the sanitization or transform. If the condition is not met, sanitization/transform is not performed. + /// Keeps track of any properties unknown to the library. + internal HeaderTransform(string key, string value, Condition condition, Dictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + Condition = condition; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HeaderTransform() + { + } + /// Gets the key. public string Key { get; } /// Gets the value. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.Serialization.cs index 6f02cc948260..f0e8699ca732 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.Serialization.cs @@ -5,22 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class ProxyOptions : IUtf8JsonSerializable + public partial class ProxyOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Transport)) { writer.WritePropertyName("Transport"u8); - writer.WriteObjectValue(Transport); + if (Transport is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Transport).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ProxyOptions DeserializeProxyOptions(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional transport = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Transport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transport = ProxyOptionsTransport.DeserializeProxyOptionsTransport(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProxyOptions(transport.Value, serializedAdditionalRawData); + } + + ProxyOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProxyOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProxyOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProxyOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProxyOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProxyOptions(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProxyOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.cs index ed2028cc107b..dc7a37ae0605 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptions.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Core.TestFramework.Models { /// The proxy options. public partial class ProxyOptions { - /// Initializes a new instance of ProxyOptions. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProxyOptions() { } + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal ProxyOptions(ProxyOptionsTransport transport, Dictionary serializedAdditionalRawData) + { + Transport = transport; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the transport. public ProxyOptionsTransport Transport { get; set; } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.Serialization.cs index bbad44366498..12d318c56fa0 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class ProxyOptionsTransport : IUtf8JsonSerializable + public partial class ProxyOptionsTransport : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllowAutoRedirect)) { @@ -31,11 +39,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Certificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ProxyOptionsTransport DeserializeProxyOptionsTransport(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional allowAutoRedirect = default; + Optional tlsValidationCert = default; + Optional> certificates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("AllowAutoRedirect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowAutoRedirect = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("TLSValidationCert"u8)) + { + tlsValidationCert = property.Value.GetString(); + continue; + } + if (property.NameEquals("Certificates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProxyOptionsTransportCertificatesItem.DeserializeProxyOptionsTransportCertificatesItem(item)); + } + certificates = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProxyOptionsTransport(Optional.ToNullable(allowAutoRedirect), tlsValidationCert.Value, Optional.ToList(certificates), serializedAdditionalRawData); + } + + ProxyOptionsTransport IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProxyOptionsTransport(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProxyOptionsTransport IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProxyOptionsTransport(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProxyOptionsTransport model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProxyOptionsTransport(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProxyOptionsTransport(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.cs index 2b95e5933473..7659b803b0b4 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransport.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.Core.TestFramework.Models /// The ProxyOptionsTransport. public partial class ProxyOptionsTransport { - /// Initializes a new instance of ProxyOptionsTransport. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProxyOptionsTransport() { Certificates = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal ProxyOptionsTransport(bool? allowAutoRedirect, string tlsValidationCert, IList certificates, Dictionary serializedAdditionalRawData) + { + AllowAutoRedirect = allowAutoRedirect; + TLSValidationCert = tlsValidationCert; + Certificates = certificates; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the allow auto redirect. public bool? AllowAutoRedirect { get; set; } /// Gets or sets the tls validation cert. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.Serialization.cs index c6ce9e21edf8..df7f6d3a1829 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class ProxyOptionsTransportCertificatesItem : IUtf8JsonSerializable + public partial class ProxyOptionsTransportCertificatesItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PemValue)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("PemKey"u8); writer.WriteStringValue(PemKey); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ProxyOptionsTransportCertificatesItem DeserializeProxyOptionsTransportCertificatesItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional pemValue = default; + Optional pemKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("PemValue"u8)) + { + pemValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("PemKey"u8)) + { + pemKey = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProxyOptionsTransportCertificatesItem(pemValue.Value, pemKey.Value, serializedAdditionalRawData); + } + + ProxyOptionsTransportCertificatesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProxyOptionsTransportCertificatesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProxyOptionsTransportCertificatesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProxyOptionsTransportCertificatesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProxyOptionsTransportCertificatesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProxyOptionsTransportCertificatesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProxyOptionsTransportCertificatesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.cs index 3ed8ed0e6e45..88aed9f32001 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/ProxyOptionsTransportCertificatesItem.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.Core.TestFramework.Models { /// The ProxyOptionsTransportCertificatesItem. public partial class ProxyOptionsTransportCertificatesItem { - /// Initializes a new instance of ProxyOptionsTransportCertificatesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProxyOptionsTransportCertificatesItem() { } + /// Initializes a new instance of . + /// + /// + /// Keeps track of any properties unknown to the library. + internal ProxyOptionsTransportCertificatesItem(string pemValue, string pemKey, Dictionary serializedAdditionalRawData) + { + PemValue = pemValue; + PemKey = pemKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Gets or sets the pem value. public string PemValue { get; set; } /// Gets or sets the pem key. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.Serialization.cs index 29fa19bc8c49..ab96df05d10b 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class StartInformation : IUtf8JsonSerializable + public partial class StartInformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("x-recording-file"u8); writer.WriteStringValue(XRecordingFile); @@ -22,7 +30,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("x-recording-assets-file"u8); writer.WriteStringValue(XRecordingAssetsFile); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static StartInformation DeserializeStartInformation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string xRecordingFile = default; + Optional xRecordingAssetsFile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("x-recording-file"u8)) + { + xRecordingFile = property.Value.GetString(); + continue; + } + if (property.NameEquals("x-recording-assets-file"u8)) + { + xRecordingAssetsFile = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StartInformation(xRecordingFile, xRecordingAssetsFile.Value, serializedAdditionalRawData); + } + + StartInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStartInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StartInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStartInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StartInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StartInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStartInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.cs index b19e997eda5e..05dd7eca2bc7 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/StartInformation.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Core.TestFramework.Models @@ -13,7 +14,10 @@ namespace Azure.Core.TestFramework.Models /// Start object to be specified when starting playback or record. public partial class StartInformation { - /// Initializes a new instance of StartInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. public StartInformation(string xRecordingFile) @@ -23,6 +27,22 @@ public StartInformation(string xRecordingFile) XRecordingFile = xRecordingFile; } + /// Initializes a new instance of . + /// + /// + /// Keeps track of any properties unknown to the library. + internal StartInformation(string xRecordingFile, string xRecordingAssetsFile, Dictionary serializedAdditionalRawData) + { + XRecordingFile = xRecordingFile; + XRecordingAssetsFile = xRecordingAssetsFile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StartInformation() + { + } + /// Gets the x recording file. public string XRecordingFile { get; } /// Gets or sets the x recording assets file. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.Serialization.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.Serialization.cs index 149f8fcfaff3..3d8c9dba36a7 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.Serialization.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Core.TestFramework.Models { - public partial class UriRegexSanitizer : IUtf8JsonSerializable + public partial class UriRegexSanitizer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("regex"u8); writer.WriteStringValue(Regex); @@ -24,7 +32,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("groupForReplace"u8); writer.WriteStringValue(GroupForReplace); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UriRegexSanitizer DeserializeUriRegexSanitizer(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string regex = default; + string value = default; + Optional groupForReplace = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("regex"u8)) + { + regex = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupForReplace"u8)) + { + groupForReplace = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UriRegexSanitizer(regex, value, groupForReplace.Value, serializedAdditionalRawData); + } + + UriRegexSanitizer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUriRegexSanitizer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UriRegexSanitizer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUriRegexSanitizer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UriRegexSanitizer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UriRegexSanitizer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUriRegexSanitizer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.cs index d66de6445e74..e1df77df0f4c 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/Models/UriRegexSanitizer.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.Core.TestFramework.Models @@ -13,7 +14,10 @@ namespace Azure.Core.TestFramework.Models /// Sanitizer for a request URI. public partial class UriRegexSanitizer { - /// Initializes a new instance of UriRegexSanitizer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// /// or is null. @@ -26,6 +30,24 @@ public UriRegexSanitizer(string regex, string value) Value = value; } + /// Initializes a new instance of . + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal UriRegexSanitizer(string regex, string value, string groupForReplace, Dictionary serializedAdditionalRawData) + { + Regex = regex; + Value = value; + GroupForReplace = groupForReplace; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UriRegexSanitizer() + { + } + /// Gets the regex. public string Regex { get; } /// Gets the value. diff --git a/sdk/core/Azure.Core.TestFramework/src/Generated/TestProxyRestClient.cs b/sdk/core/Azure.Core.TestFramework/src/Generated/TestProxyRestClient.cs index 3c48e865db9f..5c665d5dd15c 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Generated/TestProxyRestClient.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Generated/TestProxyRestClient.cs @@ -48,9 +48,7 @@ internal HttpMessage CreateStartPlaybackRequest(StartInformation body) request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; return message; } @@ -187,9 +185,7 @@ internal HttpMessage CreateStartRecordRequest(StartInformation body) uri.AppendPath("/record/start", false); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; return message; } @@ -335,9 +331,7 @@ internal HttpMessage CreateSetRecordingTransportOptionsRequest(string xRecording request.Uri = uri; request.Headers.Add("x-recording-id", xRecordingId); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(proxyOptions); - request.Content = content; + request.Content = proxyOptions; return message; } @@ -410,9 +404,7 @@ internal HttpMessage CreateAddBodyKeySanitizerRequest(BodyKeySanitizer sanitizer request.Headers.Add("x-recording-id", xRecordingId); } request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sanitizer); - request.Content = content; + request.Content = sanitizer; return message; } @@ -479,9 +471,7 @@ internal HttpMessage CreateAddHeaderSanitizerRequest(HeaderRegexSanitizer saniti request.Headers.Add("x-recording-id", xRecordingId); } request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sanitizer); - request.Content = content; + request.Content = sanitizer; return message; } @@ -548,9 +538,7 @@ internal HttpMessage CreateAddUriSanitizerRequest(UriRegexSanitizer sanitizer, s request.Headers.Add("x-recording-id", xRecordingId); } request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sanitizer); - request.Content = content; + request.Content = sanitizer; return message; } @@ -615,9 +603,7 @@ internal HttpMessage CreateAddBodyRegexSanitizerRequest(BodyRegexSanitizer sanit request.Headers.Add("x-recording-id", xRecordingId); } request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sanitizer); - request.Content = content; + request.Content = sanitizer; return message; } @@ -731,9 +717,7 @@ internal HttpMessage CreateAddCustomMatcherRequest(CustomDefaultMatcher matcher, request.Headers.Add("x-recording-id", xRecordingId); } request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(matcher); - request.Content = content; + request.Content = matcher; return message; } @@ -798,9 +782,7 @@ internal HttpMessage CreateAddHeaderTransformRequest(HeaderTransform transform, request.Headers.Add("x-recording-id", xRecordingId); } request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(transform); - request.Content = content; + request.Content = transform; return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs index eb6270daaa54..f3ea6aa1fd1c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Model factory for models. public static partial class ArmCosmosDBModelFactory { - /// Initializes a new instance of CosmosDBAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -87,10 +87,10 @@ public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = nu cors ??= new List(); networkAclBypassResourceIds ??= new List(); - return new CosmosDBAccountData(id, name, resourceType, systemData, tags, location, kind, provisioningState, documentEndpoint, databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, consistencyPolicy, capabilities?.ToList(), writeLocations?.ToList(), readLocations?.ToList(), locations?.ToList(), failoverPolicies?.ToList(), virtualNetworkRules?.ToList(), privateEndpointConnections?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, instanceId, createMode, restoreParameters, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity); + return new CosmosDBAccountData(id, name, resourceType, systemData, tags, location, kind, provisioningState, documentEndpoint, databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, consistencyPolicy, capabilities?.ToList(), writeLocations?.ToList(), readLocations?.ToList(), locations?.ToList(), failoverPolicies?.ToList(), virtualNetworkRules?.ToList(), privateEndpointConnections?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion, new Dictionary()) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType, new Dictionary()) : null, instanceId, createMode, restoreParameters, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery, new Dictionary()) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit, new Dictionary()) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity, default); } - /// Initializes a new instance of CosmosDBAccountLocation. + /// Initializes a new instance of . /// The unique identifier of the region within the database account. Example: <accountName>-<locationName>. /// The name of the region. /// The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/. @@ -100,20 +100,20 @@ public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = nu /// A new instance for mocking. public static CosmosDBAccountLocation CosmosDBAccountLocation(string id = null, AzureLocation? locationName = null, string documentEndpoint = null, string provisioningState = null, int? failoverPriority = null, bool? isZoneRedundant = null) { - return new CosmosDBAccountLocation(id, locationName, documentEndpoint, provisioningState, failoverPriority, isZoneRedundant); + return new CosmosDBAccountLocation(id, locationName, documentEndpoint, provisioningState, failoverPriority, isZoneRedundant, default); } - /// Initializes a new instance of CosmosDBFailoverPolicy. + /// Initializes a new instance of . /// The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. /// The name of the region in which the database account exists. /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. /// A new instance for mocking. public static CosmosDBFailoverPolicy CosmosDBFailoverPolicy(string id = null, AzureLocation? locationName = null, int? failoverPriority = null) { - return new CosmosDBFailoverPolicy(id, locationName, failoverPriority); + return new CosmosDBFailoverPolicy(id, locationName, failoverPriority, default); } - /// Initializes a new instance of CosmosDBPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -125,20 +125,20 @@ public static CosmosDBFailoverPolicy CosmosDBFailoverPolicy(string id = null, Az /// A new instance for mocking. public static CosmosDBPrivateEndpointConnectionData CosmosDBPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, CosmosDBPrivateLinkServiceConnectionStateProperty connectionState = null, string groupId = null, string provisioningState = null) { - return new CosmosDBPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? new PrivateEndpointProperty(privateEndpointId) : null, connectionState, groupId, provisioningState); + return new CosmosDBPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? new PrivateEndpointProperty(privateEndpointId, new Dictionary()) : null, connectionState, groupId, provisioningState, default); } - /// Initializes a new instance of CosmosDBPrivateLinkServiceConnectionStateProperty. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). /// A new instance for mocking. public static CosmosDBPrivateLinkServiceConnectionStateProperty CosmosDBPrivateLinkServiceConnectionStateProperty(string status = null, string description = null, string actionsRequired = null) { - return new CosmosDBPrivateLinkServiceConnectionStateProperty(status, description, actionsRequired); + return new CosmosDBPrivateLinkServiceConnectionStateProperty(status, description, actionsRequired, default); } - /// Initializes a new instance of DatabaseAccountKeysMetadata. + /// Initializes a new instance of . /// The metadata related to the Primary Read-Write Key for the given Cosmos DB database account. /// The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account. /// The metadata related to the Primary Read-Only Key for the given Cosmos DB database account. @@ -146,10 +146,62 @@ public static CosmosDBPrivateLinkServiceConnectionStateProperty CosmosDBPrivateL /// A new instance for mocking. public static DatabaseAccountKeysMetadata DatabaseAccountKeysMetadata(DateTimeOffset? primaryMasterKeyGeneratedOn = null, DateTimeOffset? secondaryMasterKeyGeneratedOn = null, DateTimeOffset? primaryReadonlyMasterKeyGeneratedOn = null, DateTimeOffset? secondaryReadonlyMasterKeyGeneratedOn = null) { - return new DatabaseAccountKeysMetadata(primaryMasterKeyGeneratedOn != null ? new AccountKeyMetadata(primaryMasterKeyGeneratedOn) : null, secondaryMasterKeyGeneratedOn != null ? new AccountKeyMetadata(secondaryMasterKeyGeneratedOn) : null, primaryReadonlyMasterKeyGeneratedOn != null ? new AccountKeyMetadata(primaryReadonlyMasterKeyGeneratedOn) : null, secondaryReadonlyMasterKeyGeneratedOn != null ? new AccountKeyMetadata(secondaryReadonlyMasterKeyGeneratedOn) : null); + return new DatabaseAccountKeysMetadata(primaryMasterKeyGeneratedOn != null ? new AccountKeyMetadata(primaryMasterKeyGeneratedOn, new Dictionary()) : null, secondaryMasterKeyGeneratedOn != null ? new AccountKeyMetadata(secondaryMasterKeyGeneratedOn, new Dictionary()) : null, primaryReadonlyMasterKeyGeneratedOn != null ? new AccountKeyMetadata(primaryReadonlyMasterKeyGeneratedOn, new Dictionary()) : null, secondaryReadonlyMasterKeyGeneratedOn != null ? new AccountKeyMetadata(secondaryReadonlyMasterKeyGeneratedOn, new Dictionary()) : null, default); } - /// Initializes a new instance of CosmosDBAccountCreateOrUpdateContent. + /// Initializes a new instance of . + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The location of the resource group to which the resource belongs. + /// Identity for the resource. + /// The consistency policy for the Cosmos DB account. + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// List of IpRules. + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + /// List of Cosmos DB capabilities for the account. + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + /// Enables the account to write in multiple locations. + /// Enables the cassandra connector on the Cosmos DB C* account. + /// The cassandra connector offer type for the Cosmos DB database C* account. + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + /// The URI of the key vault. + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + /// Whether requests from Public Network are allowed. + /// Flag to indicate whether Free Tier is enabled. + /// API specific properties. Currently, supported only for MongoDB API. + /// Flag to indicate whether to enable storage analytics. + /// Analytical storage specific properties. + /// + /// The object representing the policy for taking backups on an account. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The CORS policy for the Cosmos DB database account. + /// Indicates what services are allowed to bypass firewall checks. + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + /// The object that represents all properties related to capacity enforcement on an account. + /// Flag to indicate whether to enable MaterializedViews on the Cosmos DB account. + /// This property is ignored during the update operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. + /// Flag to indicate enabling/disabling of Partition Merge feature on the account. + /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. + /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// A new instance for mocking. + public static CosmosDBAccountPatch CosmosDBAccountPatch(IDictionary tags = null, AzureLocation? location = null, ManagedServiceIdentity identity = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable locations = null, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, IEnumerable capabilities = null, IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null) + { + tags ??= new Dictionary(); + locations ??= new List(); + ipRules ??= new List(); + capabilities ??= new List(); + virtualNetworkRules ??= new List(); + cors ??= new List(); + networkAclBypassResourceIds ??= new List(); + + return new CosmosDBAccountPatch(tags, location, identity, consistencyPolicy, locations?.ToList(), ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion, new Dictionary()) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType, new Dictionary()) : null, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery, new Dictionary()) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit, new Dictionary()) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -206,10 +258,10 @@ public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdate cors ??= new List(); networkAclBypassResourceIds ??= new List(); - return new CosmosDBAccountCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, kind, consistencyPolicy, locations?.ToList(), databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, createMode, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, restoreParameters, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity); + return new CosmosDBAccountCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, kind, consistencyPolicy, locations?.ToList(), databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion, new Dictionary()) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType, new Dictionary()) : null, createMode, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery, new Dictionary()) : null, disableLocalAuth, restoreParameters, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit, new Dictionary()) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity, default); } - /// Initializes a new instance of CosmosDBAccountKeyList. + /// Initializes a new instance of . /// Base 64 encoded value of the primary read-only key. /// Base 64 encoded value of the secondary read-only key. /// Base 64 encoded value of the primary read-write key. @@ -217,19 +269,19 @@ public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdate /// A new instance for mocking. public static CosmosDBAccountKeyList CosmosDBAccountKeyList(string primaryReadonlyMasterKey = null, string secondaryReadonlyMasterKey = null, string primaryMasterKey = null, string secondaryMasterKey = null) { - return new CosmosDBAccountKeyList(primaryReadonlyMasterKey, secondaryReadonlyMasterKey, primaryMasterKey, secondaryMasterKey); + return new CosmosDBAccountKeyList(primaryReadonlyMasterKey, secondaryReadonlyMasterKey, primaryMasterKey, secondaryMasterKey, default); } - /// Initializes a new instance of CosmosDBAccountReadOnlyKeyList. + /// Initializes a new instance of . /// Base 64 encoded value of the primary read-only key. /// Base 64 encoded value of the secondary read-only key. /// A new instance for mocking. public static CosmosDBAccountReadOnlyKeyList CosmosDBAccountReadOnlyKeyList(string primaryReadonlyMasterKey = null, string secondaryReadonlyMasterKey = null) { - return new CosmosDBAccountReadOnlyKeyList(primaryReadonlyMasterKey, secondaryReadonlyMasterKey); + return new CosmosDBAccountReadOnlyKeyList(primaryReadonlyMasterKey, secondaryReadonlyMasterKey, default); } - /// Initializes a new instance of CosmosDBAccountConnectionString. + /// Initializes a new instance of . /// Value of the connection string. /// Description of the connection string. /// Kind of the connection string key. @@ -237,19 +289,19 @@ public static CosmosDBAccountReadOnlyKeyList CosmosDBAccountReadOnlyKeyList(stri /// A new instance for mocking. public static CosmosDBAccountConnectionString CosmosDBAccountConnectionString(string connectionString = null, string description = null, CosmosDBKind? keyKind = null, CosmosDBType? keyType = null) { - return new CosmosDBAccountConnectionString(connectionString, description, keyKind, keyType); + return new CosmosDBAccountConnectionString(connectionString, description, keyKind, keyType, default); } - /// Initializes a new instance of ErrorResponse. + /// Initializes a new instance of . /// Error code. /// Error message indicating why the operation failed. /// A new instance for mocking. public static ErrorResponse ErrorResponse(string code = null, string message = null) { - return new ErrorResponse(code, message); + return new ErrorResponse(code, message, default); } - /// Initializes a new instance of CosmosDBBaseMetric. + /// Initializes a new instance of . /// The start time for the metric (ISO-8601 format). /// The end time for the metric (ISO-8601 format). /// The time grain to be used to summarize the metric values. @@ -261,19 +313,19 @@ public static CosmosDBBaseMetric CosmosDBBaseMetric(DateTimeOffset? startOn = nu { metricValues ??= new List(); - return new CosmosDBBaseMetric(startOn, endOn, timeGrain, unit, name, metricValues?.ToList()); + return new CosmosDBBaseMetric(startOn, endOn, timeGrain, unit, name, metricValues?.ToList(), default); } - /// Initializes a new instance of CosmosDBMetricName. + /// Initializes a new instance of . /// The name of the metric. /// The friendly name of the metric. /// A new instance for mocking. public static CosmosDBMetricName CosmosDBMetricName(string value = null, string localizedValue = null) { - return new CosmosDBMetricName(value, localizedValue); + return new CosmosDBMetricName(value, localizedValue, default); } - /// Initializes a new instance of CosmosDBMetricValue. + /// Initializes a new instance of . /// The number of values for the metric. /// The average value of the metric. /// The max value of the metric. @@ -283,10 +335,10 @@ public static CosmosDBMetricName CosmosDBMetricName(string value = null, string /// A new instance for mocking. public static CosmosDBMetricValue CosmosDBMetricValue(int? count = null, double? average = null, double? maximum = null, double? minimum = null, DateTimeOffset? timestamp = null, double? total = null) { - return new CosmosDBMetricValue(count, average, maximum, minimum, timestamp, total); + return new CosmosDBMetricValue(count, average, maximum, minimum, timestamp, total, default); } - /// Initializes a new instance of CosmosDBPercentileMetric. + /// Initializes a new instance of . /// The start time for the metric (ISO-8601 format). /// The end time for the metric (ISO-8601 format). /// The time grain to be used to summarize the metric values. @@ -298,10 +350,10 @@ public static CosmosDBPercentileMetric CosmosDBPercentileMetric(DateTimeOffset? { metricValues ??= new List(); - return new CosmosDBPercentileMetric(startOn, endOn, timeGrain, unit, name, metricValues?.ToList()); + return new CosmosDBPercentileMetric(startOn, endOn, timeGrain, unit, name, metricValues?.ToList(), default); } - /// Initializes a new instance of PercentileMetricValue. + /// Initializes a new instance of . /// The number of values for the metric. /// The average value of the metric. /// The max value of the metric. @@ -318,10 +370,10 @@ public static CosmosDBPercentileMetric CosmosDBPercentileMetric(DateTimeOffset? /// A new instance for mocking. public static PercentileMetricValue PercentileMetricValue(int? count = null, double? average = null, double? maximum = null, double? minimum = null, DateTimeOffset? timestamp = null, double? total = null, double? p10 = null, double? p25 = null, double? p50 = null, double? p75 = null, double? p90 = null, double? p95 = null, double? p99 = null) { - return new PercentileMetricValue(count, average, maximum, minimum, timestamp, total, p10, p25, p50, p75, p90, p95, p99); + return new PercentileMetricValue(count, average, maximum, minimum, timestamp, total, p10, p25, p50, p75, p90, p95, p99, default); } - /// Initializes a new instance of PartitionMetric. + /// Initializes a new instance of . /// The start time for the metric (ISO-8601 format). /// The end time for the metric (ISO-8601 format). /// The time grain to be used to summarize the metric values. @@ -335,10 +387,10 @@ public static PartitionMetric PartitionMetric(DateTimeOffset? startOn = null, Da { metricValues ??= new List(); - return new PartitionMetric(startOn, endOn, timeGrain, unit, name, metricValues?.ToList(), partitionId, partitionKeyRangeId); + return new PartitionMetric(startOn, endOn, timeGrain, unit, name, metricValues?.ToList(), partitionId, partitionKeyRangeId, default); } - /// Initializes a new instance of CosmosDBBaseUsage. + /// Initializes a new instance of . /// The unit of the metric. /// The name information for the metric. /// The quota period used to summarize the usage values. @@ -347,10 +399,10 @@ public static PartitionMetric PartitionMetric(DateTimeOffset? startOn = null, Da /// A new instance for mocking. public static CosmosDBBaseUsage CosmosDBBaseUsage(CosmosDBMetricUnitType? unit = null, CosmosDBMetricName name = null, string quotaPeriod = null, long? limit = null, long? currentValue = null) { - return new CosmosDBBaseUsage(unit, name, quotaPeriod, limit, currentValue); + return new CosmosDBBaseUsage(unit, name, quotaPeriod, limit, currentValue, default); } - /// Initializes a new instance of PartitionUsage. + /// Initializes a new instance of . /// The unit of the metric. /// The name information for the metric. /// The quota period used to summarize the usage values. @@ -361,10 +413,10 @@ public static CosmosDBBaseUsage CosmosDBBaseUsage(CosmosDBMetricUnitType? unit = /// A new instance for mocking. public static PartitionUsage PartitionUsage(CosmosDBMetricUnitType? unit = null, CosmosDBMetricName name = null, string quotaPeriod = null, long? limit = null, long? currentValue = null, Guid? partitionId = null, string partitionKeyRangeId = null) { - return new PartitionUsage(unit, name, quotaPeriod, limit, currentValue, partitionId, partitionKeyRangeId); + return new PartitionUsage(unit, name, quotaPeriod, limit, currentValue, partitionId, partitionKeyRangeId, default); } - /// Initializes a new instance of CosmosDBMetricDefinition. + /// Initializes a new instance of . /// The list of metric availabilities for the account. /// The primary aggregation type of the metric. /// The unit of the metric. @@ -375,19 +427,19 @@ public static CosmosDBMetricDefinition CosmosDBMetricDefinition(IEnumerable(); - return new CosmosDBMetricDefinition(metricAvailabilities?.ToList(), primaryAggregationType, unit, resourceId, name); + return new CosmosDBMetricDefinition(metricAvailabilities?.ToList(), primaryAggregationType, unit, resourceId, name, default); } - /// Initializes a new instance of CosmosDBMetricAvailability. + /// Initializes a new instance of . /// The time grain to be used to summarize the metric values. /// The retention for the metric values. /// A new instance for mocking. public static CosmosDBMetricAvailability CosmosDBMetricAvailability(string timeGrain = null, string retention = null) { - return new CosmosDBMetricAvailability(timeGrain, retention); + return new CosmosDBMetricAvailability(timeGrain, retention, default); } - /// Initializes a new instance of GraphResourceGetResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -402,10 +454,10 @@ public static GraphResourceGetResultData GraphResourceGetResultData(ResourceIden { tags ??= new Dictionary(); - return new GraphResourceGetResultData(id, name, resourceType, systemData, tags, location, resourceId != null ? ResourceManagerModelFactory.WritableSubResource(resourceId) : null, options, identity); + return new GraphResourceGetResultData(id, name, resourceType, systemData, tags, location, resourceId != null ? ResourceManagerModelFactory.WritableSubResource(resourceId) : null, options, identity, default); } - /// Initializes a new instance of GraphResourceGetResultCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -420,10 +472,10 @@ public static GraphResourceGetResultCreateOrUpdateContent GraphResourceGetResult { tags ??= new Dictionary(); - return new GraphResourceGetResultCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resourceId != null ? ResourceManagerModelFactory.WritableSubResource(resourceId) : null, options, identity); + return new GraphResourceGetResultCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resourceId != null ? ResourceManagerModelFactory.WritableSubResource(resourceId) : null, options, identity, default); } - /// Initializes a new instance of CosmosDBSqlDatabaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -438,10 +490,10 @@ public static CosmosDBSqlDatabaseData CosmosDBSqlDatabaseData(ResourceIdentifier { tags ??= new Dictionary(); - return new CosmosDBSqlDatabaseData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlDatabaseData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedCosmosDBSqlDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -453,10 +505,10 @@ public static CosmosDBSqlDatabaseData CosmosDBSqlDatabaseData(ResourceIdentifier /// A new instance for mocking. public static ExtendedCosmosDBSqlDatabaseResourceInfo ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName = null, ResourceRestoreParameters restoreParameters = null, CosmosDBAccountCreateMode? createMode = null, string colls = null, string users = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedCosmosDBSqlDatabaseResourceInfo(databaseName, restoreParameters, createMode, colls, users, rid, timestamp, etag); + return new ExtendedCosmosDBSqlDatabaseResourceInfo(databaseName, restoreParameters, createMode, colls, users, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBSqlDatabaseCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -471,10 +523,10 @@ public static CosmosDBSqlDatabaseCreateOrUpdateContent CosmosDBSqlDatabaseCreate { tags ??= new Dictionary(); - return new CosmosDBSqlDatabaseCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlDatabaseCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ThroughputSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -488,10 +540,10 @@ public static ThroughputSettingData ThroughputSettingData(ResourceIdentifier id { tags ??= new Dictionary(); - return new ThroughputSettingData(id, name, resourceType, systemData, tags, location, resource, identity); + return new ThroughputSettingData(id, name, resourceType, systemData, tags, location, resource, identity, default); } - /// Initializes a new instance of ExtendedThroughputSettingsResourceInfo. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. @@ -502,10 +554,10 @@ public static ThroughputSettingData ThroughputSettingData(ResourceIdentifier id /// A new instance for mocking. public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, rid, timestamp, etag); + return new ExtendedThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, rid, timestamp, etag, default); } - /// Initializes a new instance of ThroughputSettingsResourceInfo. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. @@ -513,20 +565,20 @@ public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsR /// A new instance for mocking. public static ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null) { - return new ThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending); + return new ThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, default); } - /// Initializes a new instance of AutoscaleSettingsResourceInfo. + /// Initializes a new instance of . /// Represents maximum throughput container can scale up to. /// Cosmos DB resource auto-upgrade policy. /// Represents target maximum throughput container can scale up to once offer is no longer in pending state. /// A new instance for mocking. public static AutoscaleSettingsResourceInfo AutoscaleSettingsResourceInfo(int maxThroughput = default, ThroughputPolicyResourceInfo autoUpgradeThroughputPolicy = null, int? targetMaxThroughput = null) { - return new AutoscaleSettingsResourceInfo(maxThroughput, autoUpgradeThroughputPolicy != null ? new AutoUpgradePolicyResourceInfo(autoUpgradeThroughputPolicy) : null, targetMaxThroughput); + return new AutoscaleSettingsResourceInfo(maxThroughput, autoUpgradeThroughputPolicy != null ? new AutoUpgradePolicyResourceInfo(autoUpgradeThroughputPolicy, new Dictionary()) : null, targetMaxThroughput, default); } - /// Initializes a new instance of ThroughputSettingsUpdateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -540,10 +592,10 @@ public static ThroughputSettingsUpdateData ThroughputSettingsUpdateData(Resource { tags ??= new Dictionary(); - return new ThroughputSettingsUpdateData(id, name, resourceType, systemData, tags, location, resource, identity); + return new ThroughputSettingsUpdateData(id, name, resourceType, systemData, tags, location, resource, identity, default); } - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -552,10 +604,10 @@ public static ThroughputSettingsUpdateData ThroughputSettingsUpdateData(Resource /// A new instance for mocking. public static CosmosDBSqlClientEncryptionKeyData CosmosDBSqlClientEncryptionKeyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CosmosDBSqlClientEncryptionKeyProperties resource = null) { - return new CosmosDBSqlClientEncryptionKeyData(id, name, resourceType, systemData, resource); + return new CosmosDBSqlClientEncryptionKeyData(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyProperties. + /// Initializes a new instance of . /// Name of the ClientEncryptionKey. /// Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data. /// Wrapped (encrypted) form of the key represented as a byte array. @@ -566,10 +618,10 @@ public static CosmosDBSqlClientEncryptionKeyData CosmosDBSqlClientEncryptionKeyD /// A new instance for mocking. public static CosmosDBSqlClientEncryptionKeyProperties CosmosDBSqlClientEncryptionKeyProperties(string id = null, string encryptionAlgorithm = null, byte[] wrappedDataEncryptionKey = null, CosmosDBKeyWrapMetadata keyWrapMetadata = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new CosmosDBSqlClientEncryptionKeyProperties(id, encryptionAlgorithm, wrappedDataEncryptionKey, keyWrapMetadata, rid, timestamp, etag); + return new CosmosDBSqlClientEncryptionKeyProperties(id, encryptionAlgorithm, wrappedDataEncryptionKey, keyWrapMetadata, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBSqlContainerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -584,10 +636,10 @@ public static CosmosDBSqlContainerData CosmosDBSqlContainerData(ResourceIdentifi { tags ??= new Dictionary(); - return new CosmosDBSqlContainerData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlContainerData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedCosmosDBSqlContainerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -607,10 +659,10 @@ public static ExtendedCosmosDBSqlContainerResourceInfo ExtendedCosmosDBSqlContai { uniqueKeys ??= new List(); - return new ExtendedCosmosDBSqlContainerResourceInfo(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeys != null ? new CosmosDBUniqueKeyPolicy(uniqueKeys?.ToList()) : null, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition, rid, timestamp, etag); + return new ExtendedCosmosDBSqlContainerResourceInfo(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeys != null ? new CosmosDBUniqueKeyPolicy(uniqueKeys?.ToList(), new Dictionary()) : null, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBContainerPartitionKey. + /// Initializes a new instance of . /// List of paths using which data within the container can be partitioned. /// Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create. /// Indicates the version of the partition key definition. @@ -620,20 +672,20 @@ public static CosmosDBContainerPartitionKey CosmosDBContainerPartitionKey(IEnume { paths ??= new List(); - return new CosmosDBContainerPartitionKey(paths?.ToList(), kind, version, isSystemKey); + return new CosmosDBContainerPartitionKey(paths?.ToList(), kind, version, isSystemKey, default); } - /// Initializes a new instance of MaterializedViewDefinition. + /// Initializes a new instance of . /// An unique identifier for the source collection. This is a system generated property. /// The name of the source container on which the Materialized View will be created. /// The definition should be an SQL query which would be used to fetch data from the source container to populate into the Materialized View container. /// A new instance for mocking. public static MaterializedViewDefinition MaterializedViewDefinition(string sourceCollectionRid = null, string sourceCollectionId = null, string definition = null) { - return new MaterializedViewDefinition(sourceCollectionRid, sourceCollectionId, definition); + return new MaterializedViewDefinition(sourceCollectionRid, sourceCollectionId, definition, default); } - /// Initializes a new instance of CosmosDBSqlContainerCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -648,29 +700,29 @@ public static CosmosDBSqlContainerCreateOrUpdateContent CosmosDBSqlContainerCrea { tags ??= new Dictionary(); - return new CosmosDBSqlContainerCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlContainerCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of PhysicalPartitionStorageInfoCollection. + /// Initializes a new instance of . /// List of physical partitions and their properties. /// A new instance for mocking. public static PhysicalPartitionStorageInfoCollection PhysicalPartitionStorageInfoCollection(IEnumerable physicalPartitionStorageInfoCollectionValue = null) { physicalPartitionStorageInfoCollectionValue ??= new List(); - return new PhysicalPartitionStorageInfoCollection(physicalPartitionStorageInfoCollectionValue?.ToList()); + return new PhysicalPartitionStorageInfoCollection(physicalPartitionStorageInfoCollectionValue?.ToList(), default); } - /// Initializes a new instance of PhysicalPartitionStorageInfo. + /// Initializes a new instance of . /// The unique identifier of the partition. /// The storage in KB for the physical partition. /// A new instance for mocking. public static PhysicalPartitionStorageInfo PhysicalPartitionStorageInfo(string id = null, double? storageInKB = null) { - return new PhysicalPartitionStorageInfo(id, storageInKB); + return new PhysicalPartitionStorageInfo(id, storageInKB, default); } - /// Initializes a new instance of RetrieveThroughputParameters. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -685,10 +737,10 @@ public static RetrieveThroughputParameters RetrieveThroughputParameters(Resource tags ??= new Dictionary(); resourcePhysicalPartitionIds ??= new List(); - return new RetrieveThroughputParameters(id, name, resourceType, systemData, tags, location, resourcePhysicalPartitionIds != null ? new RetrieveThroughputPropertiesResource(resourcePhysicalPartitionIds?.ToList()) : null, identity); + return new RetrieveThroughputParameters(id, name, resourceType, systemData, tags, location, resourcePhysicalPartitionIds != null ? new RetrieveThroughputPropertiesResource(resourcePhysicalPartitionIds?.ToList(), new Dictionary()) : null, identity, default); } - /// Initializes a new instance of PhysicalPartitionThroughputInfoResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -703,10 +755,10 @@ public static PhysicalPartitionThroughputInfoResult PhysicalPartitionThroughputI tags ??= new Dictionary(); resourcePhysicalPartitionThroughputInfo ??= new List(); - return new PhysicalPartitionThroughputInfoResult(id, name, resourceType, systemData, tags, location, resourcePhysicalPartitionThroughputInfo != null ? new PhysicalPartitionThroughputInfoResultPropertiesResource(resourcePhysicalPartitionThroughputInfo?.ToList()) : null, identity); + return new PhysicalPartitionThroughputInfoResult(id, name, resourceType, systemData, tags, location, resourcePhysicalPartitionThroughputInfo != null ? new PhysicalPartitionThroughputInfoResultPropertiesResource(resourcePhysicalPartitionThroughputInfo?.ToList(), new Dictionary()) : null, identity, default); } - /// Initializes a new instance of RedistributeThroughputParameters. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -720,10 +772,10 @@ public static RedistributeThroughputParameters RedistributeThroughputParameters( { tags ??= new Dictionary(); - return new RedistributeThroughputParameters(id, name, resourceType, systemData, tags, location, resource, identity); + return new RedistributeThroughputParameters(id, name, resourceType, systemData, tags, location, resource, identity, default); } - /// Initializes a new instance of CosmosDBSqlStoredProcedureData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -737,10 +789,10 @@ public static CosmosDBSqlStoredProcedureData CosmosDBSqlStoredProcedureData(Reso { tags ??= new Dictionary(); - return new CosmosDBSqlStoredProcedureData(id, name, resourceType, systemData, tags, location, resource, identity); + return new CosmosDBSqlStoredProcedureData(id, name, resourceType, systemData, tags, location, resource, identity, default); } - /// Initializes a new instance of ExtendedCosmosDBSqlStoredProcedureResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL storedProcedure. /// Body of the Stored Procedure. /// A system generated property. A unique identifier. @@ -749,10 +801,10 @@ public static CosmosDBSqlStoredProcedureData CosmosDBSqlStoredProcedureData(Reso /// A new instance for mocking. public static ExtendedCosmosDBSqlStoredProcedureResourceInfo ExtendedCosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName = null, string body = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedCosmosDBSqlStoredProcedureResourceInfo(storedProcedureName, body, rid, timestamp, etag); + return new ExtendedCosmosDBSqlStoredProcedureResourceInfo(storedProcedureName, body, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBSqlStoredProcedureCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -767,10 +819,10 @@ public static CosmosDBSqlStoredProcedureCreateOrUpdateContent CosmosDBSqlStoredP { tags ??= new Dictionary(); - return new CosmosDBSqlStoredProcedureCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlStoredProcedureCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -784,10 +836,10 @@ public static CosmosDBSqlUserDefinedFunctionData CosmosDBSqlUserDefinedFunctionD { tags ??= new Dictionary(); - return new CosmosDBSqlUserDefinedFunctionData(id, name, resourceType, systemData, tags, location, resource, identity); + return new CosmosDBSqlUserDefinedFunctionData(id, name, resourceType, systemData, tags, location, resource, identity, default); } - /// Initializes a new instance of ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL userDefinedFunction. /// Body of the User Defined Function. /// A system generated property. A unique identifier. @@ -796,10 +848,10 @@ public static CosmosDBSqlUserDefinedFunctionData CosmosDBSqlUserDefinedFunctionD /// A new instance for mocking. public static ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(string functionName = null, string body = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(functionName, body, rid, timestamp, etag); + return new ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(functionName, body, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -814,10 +866,10 @@ public static CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent CosmosDBSqlUse { tags ??= new Dictionary(); - return new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CosmosDBSqlTriggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -831,10 +883,10 @@ public static CosmosDBSqlTriggerData CosmosDBSqlTriggerData(ResourceIdentifier i { tags ??= new Dictionary(); - return new CosmosDBSqlTriggerData(id, name, resourceType, systemData, tags, location, resource, identity); + return new CosmosDBSqlTriggerData(id, name, resourceType, systemData, tags, location, resource, identity, default); } - /// Initializes a new instance of ExtendedCosmosDBSqlTriggerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL trigger. /// Body of the Trigger. /// Type of the Trigger. @@ -845,10 +897,10 @@ public static CosmosDBSqlTriggerData CosmosDBSqlTriggerData(ResourceIdentifier i /// A new instance for mocking. public static ExtendedCosmosDBSqlTriggerResourceInfo ExtendedCosmosDBSqlTriggerResourceInfo(string triggerName = null, string body = null, CosmosDBSqlTriggerType? triggerType = null, CosmosDBSqlTriggerOperation? triggerOperation = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedCosmosDBSqlTriggerResourceInfo(triggerName, body, triggerType, triggerOperation, rid, timestamp, etag); + return new ExtendedCosmosDBSqlTriggerResourceInfo(triggerName, body, triggerType, triggerOperation, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBSqlTriggerCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -863,10 +915,10 @@ public static CosmosDBSqlTriggerCreateOrUpdateContent CosmosDBSqlTriggerCreateOr { tags ??= new Dictionary(); - return new CosmosDBSqlTriggerCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBSqlTriggerCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of MongoDBDatabaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -881,10 +933,10 @@ public static MongoDBDatabaseData MongoDBDatabaseData(ResourceIdentifier id = nu { tags ??= new Dictionary(); - return new MongoDBDatabaseData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new MongoDBDatabaseData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedMongoDBDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -894,10 +946,10 @@ public static MongoDBDatabaseData MongoDBDatabaseData(ResourceIdentifier id = nu /// A new instance for mocking. public static ExtendedMongoDBDatabaseResourceInfo ExtendedMongoDBDatabaseResourceInfo(string databaseName = null, ResourceRestoreParameters restoreParameters = null, CosmosDBAccountCreateMode? createMode = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedMongoDBDatabaseResourceInfo(databaseName, restoreParameters, createMode, rid, timestamp, etag); + return new ExtendedMongoDBDatabaseResourceInfo(databaseName, restoreParameters, createMode, rid, timestamp, etag, default); } - /// Initializes a new instance of MongoDBDatabaseCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -912,10 +964,10 @@ public static MongoDBDatabaseCreateOrUpdateContent MongoDBDatabaseCreateOrUpdate { tags ??= new Dictionary(); - return new MongoDBDatabaseCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new MongoDBDatabaseCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of MongoDBCollectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -930,10 +982,10 @@ public static MongoDBCollectionData MongoDBCollectionData(ResourceIdentifier id { tags ??= new Dictionary(); - return new MongoDBCollectionData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new MongoDBCollectionData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedMongoDBCollectionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB collection. /// A key-value pair of shard keys to be applied for the request. /// List of index keys. @@ -949,10 +1001,10 @@ public static ExtendedMongoDBCollectionResourceInfo ExtendedMongoDBCollectionRes shardKey ??= new Dictionary(); indexes ??= new List(); - return new ExtendedMongoDBCollectionResourceInfo(collectionName, shardKey, indexes?.ToList(), analyticalStorageTtl, restoreParameters, createMode, rid, timestamp, etag); + return new ExtendedMongoDBCollectionResourceInfo(collectionName, shardKey, indexes?.ToList(), analyticalStorageTtl, restoreParameters, createMode, rid, timestamp, etag, default); } - /// Initializes a new instance of MongoDBCollectionCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -967,10 +1019,10 @@ public static MongoDBCollectionCreateOrUpdateContent MongoDBCollectionCreateOrUp { tags ??= new Dictionary(); - return new MongoDBCollectionCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new MongoDBCollectionCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CosmosDBTableData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -985,10 +1037,10 @@ public static CosmosDBTableData CosmosDBTableData(ResourceIdentifier id = null, { tags ??= new Dictionary(); - return new CosmosDBTableData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBTableData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CosmosDBTablePropertiesResource. + /// Initializes a new instance of . /// Name of the Cosmos DB table. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -998,10 +1050,10 @@ public static CosmosDBTableData CosmosDBTableData(ResourceIdentifier id = null, /// A new instance for mocking. public static CosmosDBTablePropertiesResource CosmosDBTablePropertiesResource(string tableName = null, ResourceRestoreParameters restoreParameters = null, CosmosDBAccountCreateMode? createMode = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new CosmosDBTablePropertiesResource(tableName, restoreParameters, createMode, rid, timestamp, etag); + return new CosmosDBTablePropertiesResource(tableName, restoreParameters, createMode, rid, timestamp, etag, default); } - /// Initializes a new instance of CosmosDBTableCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1016,10 +1068,10 @@ public static CosmosDBTableCreateOrUpdateContent CosmosDBTableCreateOrUpdateCont { tags ??= new Dictionary(); - return new CosmosDBTableCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CosmosDBTableCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CassandraKeyspaceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1034,27 +1086,21 @@ public static CassandraKeyspaceData CassandraKeyspaceData(ResourceIdentifier id { tags ??= new Dictionary(); - return new CassandraKeyspaceData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CassandraKeyspaceData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedCassandraKeyspaceResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra keyspace. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - /// is null. /// A new instance for mocking. public static ExtendedCassandraKeyspaceResourceInfo ExtendedCassandraKeyspaceResourceInfo(string keyspaceName = null, string rid = null, float? timestamp = null, ETag? etag = null) { - if (keyspaceName == null) - { - throw new ArgumentNullException(nameof(keyspaceName)); - } - - return new ExtendedCassandraKeyspaceResourceInfo(keyspaceName, rid, timestamp, etag); + return new ExtendedCassandraKeyspaceResourceInfo(keyspaceName, rid, timestamp, etag, default); } - /// Initializes a new instance of CassandraKeyspaceCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1069,10 +1115,10 @@ public static CassandraKeyspaceCreateOrUpdateContent CassandraKeyspaceCreateOrUp { tags ??= new Dictionary(); - return new CassandraKeyspaceCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resourceKeyspaceName != null ? new CassandraKeyspaceResourceInfo(resourceKeyspaceName) : null, options, identity); + return new CassandraKeyspaceCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resourceKeyspaceName != null ? new CassandraKeyspaceResourceInfo(resourceKeyspaceName, new Dictionary()) : null, options, identity, default); } - /// Initializes a new instance of CassandraTableData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1087,10 +1133,10 @@ public static CassandraTableData CassandraTableData(ResourceIdentifier id = null { tags ??= new Dictionary(); - return new CassandraTableData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CassandraTableData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedCassandraTableResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table. /// Time to live of the Cosmos DB Cassandra table. /// Schema of the Cosmos DB Cassandra table. @@ -1101,10 +1147,10 @@ public static CassandraTableData CassandraTableData(ResourceIdentifier id = null /// A new instance for mocking. public static ExtendedCassandraTableResourceInfo ExtendedCassandraTableResourceInfo(string tableName = null, int? defaultTtl = null, CassandraSchema schema = null, int? analyticalStorageTtl = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedCassandraTableResourceInfo(tableName, defaultTtl, schema, analyticalStorageTtl, rid, timestamp, etag); + return new ExtendedCassandraTableResourceInfo(tableName, defaultTtl, schema, analyticalStorageTtl, rid, timestamp, etag, default); } - /// Initializes a new instance of CassandraTableCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1119,10 +1165,10 @@ public static CassandraTableCreateOrUpdateContent CassandraTableCreateOrUpdateCo { tags ??= new Dictionary(); - return new CassandraTableCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CassandraTableCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of GremlinDatabaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1137,10 +1183,10 @@ public static GremlinDatabaseData GremlinDatabaseData(ResourceIdentifier id = nu { tags ??= new Dictionary(); - return new GremlinDatabaseData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new GremlinDatabaseData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedGremlinDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -1150,10 +1196,10 @@ public static GremlinDatabaseData GremlinDatabaseData(ResourceIdentifier id = nu /// A new instance for mocking. public static ExtendedGremlinDatabaseResourceInfo ExtendedGremlinDatabaseResourceInfo(string databaseName = null, ResourceRestoreParameters restoreParameters = null, CosmosDBAccountCreateMode? createMode = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedGremlinDatabaseResourceInfo(databaseName, restoreParameters, createMode, rid, timestamp, etag); + return new ExtendedGremlinDatabaseResourceInfo(databaseName, restoreParameters, createMode, rid, timestamp, etag, default); } - /// Initializes a new instance of GremlinDatabaseCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1168,10 +1214,10 @@ public static GremlinDatabaseCreateOrUpdateContent GremlinDatabaseCreateOrUpdate { tags ??= new Dictionary(); - return new GremlinDatabaseCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new GremlinDatabaseCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of GremlinGraphData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1186,10 +1232,10 @@ public static GremlinGraphData GremlinGraphData(ResourceIdentifier id = null, st { tags ??= new Dictionary(); - return new GremlinGraphData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new GremlinGraphData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of ExtendedGremlinGraphResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin graph. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -1207,10 +1253,10 @@ public static ExtendedGremlinGraphResourceInfo ExtendedGremlinGraphResourceInfo( { uniqueKeys ??= new List(); - return new ExtendedGremlinGraphResourceInfo(graphName, indexingPolicy, partitionKey, defaultTtl, uniqueKeys != null ? new CosmosDBUniqueKeyPolicy(uniqueKeys?.ToList()) : null, conflictResolutionPolicy, analyticalStorageTtl, restoreParameters, createMode, rid, timestamp, etag); + return new ExtendedGremlinGraphResourceInfo(graphName, indexingPolicy, partitionKey, defaultTtl, uniqueKeys != null ? new CosmosDBUniqueKeyPolicy(uniqueKeys?.ToList(), new Dictionary()) : null, conflictResolutionPolicy, analyticalStorageTtl, restoreParameters, createMode, rid, timestamp, etag, default); } - /// Initializes a new instance of GremlinGraphCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1225,10 +1271,10 @@ public static GremlinGraphCreateOrUpdateContent GremlinGraphCreateOrUpdateConten { tags ??= new Dictionary(); - return new GremlinGraphCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new GremlinGraphCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CosmosDBLocationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1237,10 +1283,10 @@ public static GremlinGraphCreateOrUpdateContent GremlinGraphCreateOrUpdateConten /// A new instance for mocking. public static CosmosDBLocationData CosmosDBLocationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CosmosDBLocationProperties properties = null) { - return new CosmosDBLocationData(id, name, resourceType, systemData, properties); + return new CosmosDBLocationData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of CosmosDBLocationProperties. + /// Initializes a new instance of . /// Flag indicating whether the location supports availability zones or not. /// Flag indicating whether the location is residency sensitive. /// The properties of available backup storage redundancies. @@ -1252,10 +1298,10 @@ public static CosmosDBLocationProperties CosmosDBLocationProperties(bool? doesSu { backupStorageRedundancies ??= new List(); - return new CosmosDBLocationProperties(doesSupportAvailabilityZone, isResidencyRestricted, backupStorageRedundancies?.ToList(), isSubscriptionRegionAccessAllowedForRegular, isSubscriptionRegionAccessAllowedForAz, status); + return new CosmosDBLocationProperties(doesSupportAvailabilityZone, isResidencyRestricted, backupStorageRedundancies?.ToList(), isSubscriptionRegionAccessAllowedForRegular, isSubscriptionRegionAccessAllowedForAz, status, default); } - /// Initializes a new instance of CassandraViewGetResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1270,32 +1316,22 @@ public static CassandraViewGetResultData CassandraViewGetResultData(ResourceIden { tags ??= new Dictionary(); - return new CassandraViewGetResultData(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CassandraViewGetResultData(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of CassandraViewGetPropertiesResource. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra view. /// View Definition of the Cosmos DB Cassandra view. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - /// or is null. /// A new instance for mocking. public static CassandraViewGetPropertiesResource CassandraViewGetPropertiesResource(string id = null, string viewDefinition = null, string rid = null, float? timestamp = null, ETag? etag = null) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (viewDefinition == null) - { - throw new ArgumentNullException(nameof(viewDefinition)); - } - - return new CassandraViewGetPropertiesResource(id, viewDefinition, rid, timestamp, etag); + return new CassandraViewGetPropertiesResource(id, viewDefinition, rid, timestamp, etag, default); } - /// Initializes a new instance of CassandraViewGetResultCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1310,10 +1346,10 @@ public static CassandraViewGetResultCreateOrUpdateContent CassandraViewGetResult { tags ??= new Dictionary(); - return new CassandraViewGetResultCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity); + return new CassandraViewGetResultCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, resource, options, identity, default); } - /// Initializes a new instance of DataTransferJobGetResultCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1322,10 +1358,10 @@ public static CassandraViewGetResultCreateOrUpdateContent CassandraViewGetResult /// A new instance for mocking. public static DataTransferJobGetResultCreateOrUpdateContent DataTransferJobGetResultCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataTransferJobProperties properties = null) { - return new DataTransferJobGetResultCreateOrUpdateContent(id, name, resourceType, systemData, properties); + return new DataTransferJobGetResultCreateOrUpdateContent(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of DataTransferJobProperties. + /// Initializes a new instance of . /// Job Name. /// /// Source DataStore details @@ -1346,10 +1382,10 @@ public static DataTransferJobGetResultCreateOrUpdateContent DataTransferJobGetRe /// A new instance for mocking. public static DataTransferJobProperties DataTransferJobProperties(string jobName = null, DataTransferDataSourceSink source = null, DataTransferDataSourceSink destination = null, string status = null, long? processedCount = null, long? totalCount = null, DateTimeOffset? lastUpdatedUtcOn = null, int? workerCount = null, ErrorResponse error = null) { - return new DataTransferJobProperties(jobName, source, destination, status, processedCount, totalCount, lastUpdatedUtcOn, workerCount, error); + return new DataTransferJobProperties(jobName, source, destination, status, processedCount, totalCount, lastUpdatedUtcOn, workerCount, error, default); } - /// Initializes a new instance of DataTransferJobGetResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1374,10 +1410,10 @@ public static DataTransferJobProperties DataTransferJobProperties(string jobName /// A new instance for mocking. public static DataTransferJobGetResultData DataTransferJobGetResultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string jobName = null, DataTransferDataSourceSink source = null, DataTransferDataSourceSink destination = null, string status = null, long? processedCount = null, long? totalCount = null, DateTimeOffset? lastUpdatedUtcOn = null, int? workerCount = null, ErrorResponse error = null) { - return new DataTransferJobGetResultData(id, name, resourceType, systemData, jobName, source, destination, status, processedCount, totalCount, lastUpdatedUtcOn, workerCount, error); + return new DataTransferJobGetResultData(id, name, resourceType, systemData, jobName, source, destination, status, processedCount, totalCount, lastUpdatedUtcOn, workerCount, error, default); } - /// Initializes a new instance of CassandraClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1391,10 +1427,10 @@ public static CassandraClusterData CassandraClusterData(ResourceIdentifier id = { tags ??= new Dictionary(); - return new CassandraClusterData(id, name, resourceType, systemData, tags, location, properties, identity); + return new CassandraClusterData(id, name, resourceType, systemData, tags, location, properties, identity, default); } - /// Initializes a new instance of CassandraClusterProperties. + /// Initializes a new instance of . /// The status of the resource at the time the operation was called. /// To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this field to the resource id of the backup. /// Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. @@ -1422,18 +1458,32 @@ public static CassandraClusterProperties CassandraClusterProperties(CassandraPro externalSeedNodes ??= new List(); seedNodes ??= new List(); - return new CassandraClusterProperties(provisioningState, restoreFromBackupId, delegatedManagementSubnetId, cassandraVersion, clusterNameOverride, authenticationMethod, initialCassandraAdminPassword, prometheusEndpointIPAddress != null ? new CassandraDataCenterSeedNode(prometheusEndpointIPAddress) : null, isRepairEnabled, clientCertificates?.ToList(), externalGossipCertificates?.ToList(), gossipCertificates?.ToList(), externalSeedNodes?.ToList(), seedNodes?.ToList(), hoursBetweenBackups, isDeallocated, isCassandraAuditLoggingEnabled, provisionError); + return new CassandraClusterProperties(provisioningState, restoreFromBackupId, delegatedManagementSubnetId, cassandraVersion, clusterNameOverride, authenticationMethod, initialCassandraAdminPassword, prometheusEndpointIPAddress != null ? new CassandraDataCenterSeedNode(prometheusEndpointIPAddress, new Dictionary()) : null, isRepairEnabled, clientCertificates?.ToList(), externalGossipCertificates?.ToList(), gossipCertificates?.ToList(), externalSeedNodes?.ToList(), seedNodes?.ToList(), hoursBetweenBackups, isDeallocated, isCassandraAuditLoggingEnabled, provisionError, default); + } + + /// Initializes a new instance of . + /// The command which should be run. + /// The arguments for the command to be run. + /// IP address of the cassandra host to run the command on. + /// If true, stops cassandra before executing the command and then start it again. + /// If true, allows the command to *write* to the cassandra directory, otherwise read-only. + /// A new instance for mocking. + public static CassandraCommandPostBody CassandraCommandPostBody(string command = null, IDictionary arguments = null, string host = null, bool? cassandraStopStart = null, bool? allowWrite = null) + { + arguments ??= new Dictionary(); + + return new CassandraCommandPostBody(command, arguments, host, cassandraStopStart, allowWrite, default); } - /// Initializes a new instance of CassandraCommandOutput. + /// Initializes a new instance of . /// Output of the command. /// A new instance for mocking. public static CassandraCommandOutput CassandraCommandOutput(string commandOutput = null) { - return new CassandraCommandOutput(commandOutput); + return new CassandraCommandOutput(commandOutput, default); } - /// Initializes a new instance of CassandraClusterBackupResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1442,10 +1492,10 @@ public static CassandraCommandOutput CassandraCommandOutput(string commandOutput /// A new instance for mocking. public static CassandraClusterBackupResourceData CassandraClusterBackupResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? backupResourceTimestamp = null) { - return new CassandraClusterBackupResourceData(id, name, resourceType, systemData, backupResourceTimestamp != null ? new BackupResourceProperties(backupResourceTimestamp) : null); + return new CassandraClusterBackupResourceData(id, name, resourceType, systemData, backupResourceTimestamp != null ? new BackupResourceProperties(backupResourceTimestamp, new Dictionary()) : null, default); } - /// Initializes a new instance of CassandraDataCenterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1454,10 +1504,10 @@ public static CassandraClusterBackupResourceData CassandraClusterBackupResourceD /// A new instance for mocking. public static CassandraDataCenterData CassandraDataCenterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CassandraDataCenterProperties properties = null) { - return new CassandraDataCenterData(id, name, resourceType, systemData, properties); + return new CassandraDataCenterData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of CassandraDataCenterProperties. + /// Initializes a new instance of . /// The status of the resource at the time the operation was called. /// The region this data center should be created in. /// Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. @@ -1478,10 +1528,10 @@ public static CassandraDataCenterProperties CassandraDataCenterProperties(Cassan { seedNodes ??= new List(); - return new CassandraDataCenterProperties(provisioningState, dataCenterLocation, delegatedSubnetId, nodeCount, seedNodes?.ToList(), base64EncodedCassandraYamlFragment, managedDiskCustomerKeyUri, backupStorageCustomerKeyUri, sku, diskSku, diskCapacity, doesSupportAvailabilityZone, authenticationMethodLdapProperties, deallocated, provisionError); + return new CassandraDataCenterProperties(provisioningState, dataCenterLocation, delegatedSubnetId, nodeCount, seedNodes?.ToList(), base64EncodedCassandraYamlFragment, managedDiskCustomerKeyUri, backupStorageCustomerKeyUri, sku, diskSku, diskCapacity, doesSupportAvailabilityZone, authenticationMethodLdapProperties, deallocated, provisionError, default); } - /// Initializes a new instance of CassandraClusterPublicStatus. + /// Initializes a new instance of . /// /// /// List relevant information about any connection errors to the Datacenters. @@ -1494,10 +1544,10 @@ public static CassandraClusterPublicStatus CassandraClusterPublicStatus(ETag? et errors ??= new List(); dataCenters ??= new List(); - return new CassandraClusterPublicStatus(etag, reaperStatus, connectionErrors?.ToList(), errors?.ToList(), dataCenters?.ToList()); + return new CassandraClusterPublicStatus(etag, reaperStatus, connectionErrors?.ToList(), errors?.ToList(), dataCenters?.ToList(), default); } - /// Initializes a new instance of CassandraReaperStatus. + /// Initializes a new instance of . /// /// Dictionary of <string>. /// Dictionary of <string>. @@ -1507,10 +1557,10 @@ public static CassandraReaperStatus CassandraReaperStatus(bool? isHealthy = null repairRunIds ??= new Dictionary(); repairSchedules ??= new Dictionary(); - return new CassandraReaperStatus(isHealthy, repairRunIds, repairSchedules); + return new CassandraReaperStatus(isHealthy, repairRunIds, repairSchedules, default); } - /// Initializes a new instance of CassandraConnectionError. + /// Initializes a new instance of . /// The kind of connection error that occurred. /// The IP of host that originated the failed connection. /// The IP that the connection attempted to reach. @@ -1519,10 +1569,10 @@ public static CassandraReaperStatus CassandraReaperStatus(bool? isHealthy = null /// A new instance for mocking. public static CassandraConnectionError CassandraConnectionError(CassandraConnectionState? connectionState = null, string ipFrom = null, string ipTo = null, int? port = null, string exception = null) { - return new CassandraConnectionError(connectionState, ipFrom, ipTo, port, exception); + return new CassandraConnectionError(connectionState, ipFrom, ipTo, port, exception, default); } - /// Initializes a new instance of CassandraClusterPublicStatusDataCentersItem. + /// Initializes a new instance of . /// The name of this Datacenter. /// A list of all seed nodes in the cluster, managed and unmanaged. /// @@ -1532,10 +1582,10 @@ public static CassandraClusterPublicStatusDataCentersItem CassandraClusterPublic seedNodes ??= new List(); nodes ??= new List(); - return new CassandraClusterPublicStatusDataCentersItem(name, seedNodes?.ToList(), nodes?.ToList()); + return new CassandraClusterPublicStatusDataCentersItem(name, seedNodes?.ToList(), nodes?.ToList(), default); } - /// Initializes a new instance of CassandraClusterDataCenterNodeItem. + /// Initializes a new instance of . /// The node's IP address. /// The state of the node in Cassandra ring. /// @@ -1558,10 +1608,10 @@ public static CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeI { tokens ??= new List(); - return new CassandraClusterDataCenterNodeItem(address, state, status, cassandraProcessStatus, load, tokens?.ToList(), size, hostId, rack, timestamp, diskUsedKB, diskFreeKB, memoryUsedKB, memoryBuffersAndCachedKB, memoryFreeKB, memoryTotalKB, cpuUsage); + return new CassandraClusterDataCenterNodeItem(address, state, status, cassandraProcessStatus, load, tokens?.ToList(), size, hostId, rack, timestamp, diskUsedKB, diskFreeKB, memoryUsedKB, memoryBuffersAndCachedKB, memoryFreeKB, memoryTotalKB, cpuUsage, default); } - /// Initializes a new instance of MongoClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1584,10 +1634,31 @@ public static MongoClusterData MongoClusterData(ResourceIdentifier id = null, st tags ??= new Dictionary(); nodeGroupSpecs ??= new List(); - return new MongoClusterData(id, name, resourceType, systemData, tags, location, createMode, restoreParameters, administratorLogin, administratorLoginPassword, serverVersion, connectionString, earliestRestoreTime, provisioningState, clusterStatus, nodeGroupSpecs?.ToList()); + return new MongoClusterData(id, name, resourceType, systemData, tags, location, createMode, restoreParameters, administratorLogin, administratorLoginPassword, serverVersion, connectionString, earliestRestoreTime, provisioningState, clusterStatus, nodeGroupSpecs?.ToList(), default); + } + + /// Initializes a new instance of . + /// Application-specific metadata in the form of key-value pairs. + /// The mode to create a mongo cluster. + /// Parameters used for restore operations. + /// The administrator's login for the mongo cluster. + /// The password of the administrator login. + /// The Mongo DB server version. Defaults to the latest available version if not specified. + /// The default mongo connection string for the cluster. + /// Earliest restore timestamp in UTC ISO8601 format. + /// A provisioning state of the mongo cluster. + /// A status of the mongo cluster. + /// The list of node group specs in the cluster. + /// A new instance for mocking. + public static MongoClusterPatch MongoClusterPatch(IDictionary tags = null, CosmosDBAccountCreateMode? createMode = null, MongoClusterRestoreParameters restoreParameters = null, string administratorLogin = null, string administratorLoginPassword = null, string serverVersion = null, string connectionString = null, string earliestRestoreTime = null, CosmosDBProvisioningState? provisioningState = null, MongoClusterStatus? clusterStatus = null, IEnumerable nodeGroupSpecs = null) + { + tags ??= new Dictionary(); + nodeGroupSpecs ??= new List(); + + return new MongoClusterPatch(tags, createMode, restoreParameters, administratorLogin, administratorLoginPassword, serverVersion, connectionString, earliestRestoreTime, provisioningState, clusterStatus, nodeGroupSpecs?.ToList(), default); } - /// Initializes a new instance of CosmosDBFirewallRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1598,39 +1669,39 @@ public static MongoClusterData MongoClusterData(ResourceIdentifier id = null, st /// A new instance for mocking. public static CosmosDBFirewallRuleData CosmosDBFirewallRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CosmosDBProvisioningState? provisioningState = null, string startIPAddress = null, string endIPAddress = null) { - return new CosmosDBFirewallRuleData(id, name, resourceType, systemData, provisioningState, startIPAddress, endIPAddress); + return new CosmosDBFirewallRuleData(id, name, resourceType, systemData, provisioningState, startIPAddress, endIPAddress, default); } - /// Initializes a new instance of CheckCosmosDBNameAvailabilityResponse. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. /// A new instance for mocking. public static CheckCosmosDBNameAvailabilityResponse CheckCosmosDBNameAvailabilityResponse(bool? nameAvailable = null, CosmosDBNameUnavailableReason? reason = null, string message = null) { - return new CheckCosmosDBNameAvailabilityResponse(nameAvailable, reason, message); + return new CheckCosmosDBNameAvailabilityResponse(nameAvailable, reason, message, default); } - /// Initializes a new instance of ListConnectionStringsResult. + /// Initializes a new instance of . /// An array that contains the connection strings for a mongo cluster. /// A new instance for mocking. public static ListConnectionStringsResult ListConnectionStringsResult(IEnumerable connectionStrings = null) { connectionStrings ??= new List(); - return new ListConnectionStringsResult(connectionStrings?.ToList()); + return new ListConnectionStringsResult(connectionStrings?.ToList(), default); } - /// Initializes a new instance of CosmosDBConnectionString. + /// Initializes a new instance of . /// Value of the connection string. /// Description of the connection string. /// A new instance for mocking. public static CosmosDBConnectionString CosmosDBConnectionString(string connectionString = null, string description = null) { - return new CosmosDBConnectionString(connectionString, description); + return new CosmosDBConnectionString(connectionString, description, default); } - /// Initializes a new instance of MongoDBRoleDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1646,10 +1717,10 @@ public static MongoDBRoleDefinitionData MongoDBRoleDefinitionData(ResourceIdenti privileges ??= new List(); roles ??= new List(); - return new MongoDBRoleDefinitionData(id, name, resourceType, systemData, roleName, roleDefinitionType, databaseName, privileges?.ToList(), roles?.ToList()); + return new MongoDBRoleDefinitionData(id, name, resourceType, systemData, roleName, roleDefinitionType, databaseName, privileges?.ToList(), roles?.ToList(), default); } - /// Initializes a new instance of MongoDBUserDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1665,10 +1736,10 @@ public static MongoDBUserDefinitionData MongoDBUserDefinitionData(ResourceIdenti { roles ??= new List(); - return new MongoDBUserDefinitionData(id, name, resourceType, systemData, userName, password, databaseName, customData, roles?.ToList(), mechanisms); + return new MongoDBUserDefinitionData(id, name, resourceType, systemData, userName, password, databaseName, customData, roles?.ToList(), mechanisms, default); } - /// Initializes a new instance of CosmosDBPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1682,10 +1753,10 @@ public static CosmosDBPrivateLinkResourceData CosmosDBPrivateLinkResourceData(Re requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new CosmosDBPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new CosmosDBPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } - /// Initializes a new instance of CosmosDBSqlRoleDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1700,10 +1771,10 @@ public static CosmosDBSqlRoleDefinitionData CosmosDBSqlRoleDefinitionData(Resour assignableScopes ??= new List(); permissions ??= new List(); - return new CosmosDBSqlRoleDefinitionData(id, name, resourceType, systemData, roleName, roleDefinitionType, assignableScopes?.ToList(), permissions?.ToList()); + return new CosmosDBSqlRoleDefinitionData(id, name, resourceType, systemData, roleName, roleDefinitionType, assignableScopes?.ToList(), permissions?.ToList(), default); } - /// Initializes a new instance of CosmosDBSqlRoleAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1714,10 +1785,10 @@ public static CosmosDBSqlRoleDefinitionData CosmosDBSqlRoleDefinitionData(Resour /// A new instance for mocking. public static CosmosDBSqlRoleAssignmentData CosmosDBSqlRoleAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier roleDefinitionId = null, string scope = null, Guid? principalId = null) { - return new CosmosDBSqlRoleAssignmentData(id, name, resourceType, systemData, roleDefinitionId, scope, principalId); + return new CosmosDBSqlRoleAssignmentData(id, name, resourceType, systemData, roleDefinitionId, scope, principalId, default); } - /// Initializes a new instance of RestorableCosmosDBAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1734,10 +1805,10 @@ public static RestorableCosmosDBAccountData RestorableCosmosDBAccountData(Resour { restorableLocations ??= new List(); - return new RestorableCosmosDBAccountData(id, name, resourceType, systemData, location, accountName, createdOn, oldestRestorableOn, deletedOn, apiType, restorableLocations?.ToList()); + return new RestorableCosmosDBAccountData(id, name, resourceType, systemData, location, accountName, createdOn, oldestRestorableOn, deletedOn, apiType, restorableLocations?.ToList(), default); } - /// Initializes a new instance of RestorableLocationResourceInfo. + /// Initializes a new instance of . /// The location of the regional restorable account. /// The instance id of the regional restorable account. /// The creation time of the regional restorable database account (ISO-8601 format). @@ -1745,18 +1816,18 @@ public static RestorableCosmosDBAccountData RestorableCosmosDBAccountData(Resour /// A new instance for mocking. public static RestorableLocationResourceInfo RestorableLocationResourceInfo(AzureLocation? locationName = null, string regionalDatabaseAccountInstanceId = null, DateTimeOffset? createdOn = null, DateTimeOffset? deletedOn = null) { - return new RestorableLocationResourceInfo(locationName, regionalDatabaseAccountInstanceId, createdOn, deletedOn); + return new RestorableLocationResourceInfo(locationName, regionalDatabaseAccountInstanceId, createdOn, deletedOn, default); } - /// Initializes a new instance of CosmosDBBackupInformation. + /// Initializes a new instance of . /// Information about the status of continuous backups. /// A new instance for mocking. public static CosmosDBBackupInformation CosmosDBBackupInformation(DateTimeOffset? continuousBackupInformationLatestRestorableTimestamp = null) { - return new CosmosDBBackupInformation(continuousBackupInformationLatestRestorableTimestamp != null ? new ContinuousBackupInformation(continuousBackupInformationLatestRestorableTimestamp) : null); + return new CosmosDBBackupInformation(continuousBackupInformationLatestRestorableTimestamp != null ? new ContinuousBackupInformation(continuousBackupInformationLatestRestorableTimestamp, new Dictionary()) : null, default); } - /// Initializes a new instance of RestorableSqlDatabase. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1765,10 +1836,10 @@ public static CosmosDBBackupInformation CosmosDBBackupInformation(DateTimeOffset /// A new instance for mocking. public static RestorableSqlDatabase RestorableSqlDatabase(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableSqlDatabaseResourceInfo resource = null) { - return new RestorableSqlDatabase(id, name, resourceType, systemData, resource); + return new RestorableSqlDatabase(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableSqlDatabaseResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this database event. /// The time when this database event happened. @@ -1778,10 +1849,10 @@ public static RestorableSqlDatabase RestorableSqlDatabase(ResourceIdentifier id /// A new instance for mocking. public static ExtendedRestorableSqlDatabaseResourceInfo ExtendedRestorableSqlDatabaseResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string databaseName = null, string databaseId = null, RestorableSqlDatabasePropertiesResourceDatabase database = null) { - return new ExtendedRestorableSqlDatabaseResourceInfo(rid, operationType, eventTimestamp, databaseName, databaseId, database); + return new ExtendedRestorableSqlDatabaseResourceInfo(rid, operationType, eventTimestamp, databaseName, databaseId, database, default); } - /// Initializes a new instance of RestorableSqlDatabasePropertiesResourceDatabase. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -1794,10 +1865,10 @@ public static ExtendedRestorableSqlDatabaseResourceInfo ExtendedRestorableSqlDat /// A new instance for mocking. public static RestorableSqlDatabasePropertiesResourceDatabase RestorableSqlDatabasePropertiesResourceDatabase(string databaseName = null, ResourceRestoreParameters restoreParameters = null, CosmosDBAccountCreateMode? createMode = null, string colls = null, string users = null, string self = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new RestorableSqlDatabasePropertiesResourceDatabase(databaseName, restoreParameters, createMode, colls, users, self, rid, timestamp, etag); + return new RestorableSqlDatabasePropertiesResourceDatabase(databaseName, restoreParameters, createMode, colls, users, self, rid, timestamp, etag, default); } - /// Initializes a new instance of RestorableSqlContainer. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1806,10 +1877,10 @@ public static RestorableSqlDatabasePropertiesResourceDatabase RestorableSqlDatab /// A new instance for mocking. public static RestorableSqlContainer RestorableSqlContainer(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableSqlContainerResourceInfo resource = null) { - return new RestorableSqlContainer(id, name, resourceType, systemData, resource); + return new RestorableSqlContainer(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableSqlContainerResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this container event. /// The when this container event happened. @@ -1819,10 +1890,10 @@ public static RestorableSqlContainer RestorableSqlContainer(ResourceIdentifier i /// A new instance for mocking. public static ExtendedRestorableSqlContainerResourceInfo ExtendedRestorableSqlContainerResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string containerName = null, string containerId = null, RestorableSqlContainerPropertiesResourceContainer container = null) { - return new ExtendedRestorableSqlContainerResourceInfo(rid, operationType, eventTimestamp, containerName, containerId, container); + return new ExtendedRestorableSqlContainerResourceInfo(rid, operationType, eventTimestamp, containerName, containerId, container, default); } - /// Initializes a new instance of RestorableSqlContainerPropertiesResourceContainer. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -1843,10 +1914,10 @@ public static RestorableSqlContainerPropertiesResourceContainer RestorableSqlCon { uniqueKeys ??= new List(); - return new RestorableSqlContainerPropertiesResourceContainer(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeys != null ? new CosmosDBUniqueKeyPolicy(uniqueKeys?.ToList()) : null, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition, self, rid, timestamp, etag); + return new RestorableSqlContainerPropertiesResourceContainer(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeys != null ? new CosmosDBUniqueKeyPolicy(uniqueKeys?.ToList(), new Dictionary()) : null, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition, self, rid, timestamp, etag, default); } - /// Initializes a new instance of RestorableSqlResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1858,10 +1929,10 @@ public static RestorableSqlResourceData RestorableSqlResourceData(ResourceIdenti { collectionNames ??= new List(); - return new RestorableSqlResourceData(id, name, resourceType, systemData, databaseName, collectionNames?.ToList()); + return new RestorableSqlResourceData(id, name, resourceType, systemData, databaseName, collectionNames?.ToList(), default); } - /// Initializes a new instance of RestorableMongoDBDatabase. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1870,10 +1941,10 @@ public static RestorableSqlResourceData RestorableSqlResourceData(ResourceIdenti /// A new instance for mocking. public static RestorableMongoDBDatabase RestorableMongoDBDatabase(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableMongoDBDatabaseResourceInfo resource = null) { - return new RestorableMongoDBDatabase(id, name, resourceType, systemData, resource); + return new RestorableMongoDBDatabase(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableMongoDBDatabaseResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this database event. /// The time when this database event happened. @@ -1882,10 +1953,10 @@ public static RestorableMongoDBDatabase RestorableMongoDBDatabase(ResourceIdenti /// A new instance for mocking. public static ExtendedRestorableMongoDBDatabaseResourceInfo ExtendedRestorableMongoDBDatabaseResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string databaseName = null, string databaseId = null) { - return new ExtendedRestorableMongoDBDatabaseResourceInfo(rid, operationType, eventTimestamp, databaseName, databaseId); + return new ExtendedRestorableMongoDBDatabaseResourceInfo(rid, operationType, eventTimestamp, databaseName, databaseId, default); } - /// Initializes a new instance of RestorableMongoDBCollection. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1894,10 +1965,10 @@ public static ExtendedRestorableMongoDBDatabaseResourceInfo ExtendedRestorableMo /// A new instance for mocking. public static RestorableMongoDBCollection RestorableMongoDBCollection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableMongoDBCollectionResourceInfo resource = null) { - return new RestorableMongoDBCollection(id, name, resourceType, systemData, resource); + return new RestorableMongoDBCollection(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableMongoDBCollectionResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this collection event. /// The time when this collection event happened. @@ -1906,10 +1977,10 @@ public static RestorableMongoDBCollection RestorableMongoDBCollection(ResourceId /// A new instance for mocking. public static ExtendedRestorableMongoDBCollectionResourceInfo ExtendedRestorableMongoDBCollectionResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string collectionName = null, string collectionId = null) { - return new ExtendedRestorableMongoDBCollectionResourceInfo(rid, operationType, eventTimestamp, collectionName, collectionId); + return new ExtendedRestorableMongoDBCollectionResourceInfo(rid, operationType, eventTimestamp, collectionName, collectionId, default); } - /// Initializes a new instance of RestorableMongoDBResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1921,10 +1992,10 @@ public static RestorableMongoDBResourceData RestorableMongoDBResourceData(Resour { collectionNames ??= new List(); - return new RestorableMongoDBResourceData(id, name, resourceType, systemData, databaseName, collectionNames?.ToList()); + return new RestorableMongoDBResourceData(id, name, resourceType, systemData, databaseName, collectionNames?.ToList(), default); } - /// Initializes a new instance of RestorableGremlinDatabase. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1933,10 +2004,10 @@ public static RestorableMongoDBResourceData RestorableMongoDBResourceData(Resour /// A new instance for mocking. public static RestorableGremlinDatabase RestorableGremlinDatabase(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableGremlinDatabaseResourceInfo resource = null) { - return new RestorableGremlinDatabase(id, name, resourceType, systemData, resource); + return new RestorableGremlinDatabase(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableGremlinDatabaseResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this database event. /// The time when this database event happened. @@ -1945,10 +2016,10 @@ public static RestorableGremlinDatabase RestorableGremlinDatabase(ResourceIdenti /// A new instance for mocking. public static ExtendedRestorableGremlinDatabaseResourceInfo ExtendedRestorableGremlinDatabaseResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string databaseName = null, string databaseId = null) { - return new ExtendedRestorableGremlinDatabaseResourceInfo(rid, operationType, eventTimestamp, databaseName, databaseId); + return new ExtendedRestorableGremlinDatabaseResourceInfo(rid, operationType, eventTimestamp, databaseName, databaseId, default); } - /// Initializes a new instance of RestorableGremlinGraph. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1957,10 +2028,10 @@ public static ExtendedRestorableGremlinDatabaseResourceInfo ExtendedRestorableGr /// A new instance for mocking. public static RestorableGremlinGraph RestorableGremlinGraph(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableGremlinGraphResourceInfo resource = null) { - return new RestorableGremlinGraph(id, name, resourceType, systemData, resource); + return new RestorableGremlinGraph(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableGremlinGraphResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this graph event. /// The time when this graph event happened. @@ -1969,10 +2040,10 @@ public static RestorableGremlinGraph RestorableGremlinGraph(ResourceIdentifier i /// A new instance for mocking. public static ExtendedRestorableGremlinGraphResourceInfo ExtendedRestorableGremlinGraphResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string graphName = null, string graphId = null) { - return new ExtendedRestorableGremlinGraphResourceInfo(rid, operationType, eventTimestamp, graphName, graphId); + return new ExtendedRestorableGremlinGraphResourceInfo(rid, operationType, eventTimestamp, graphName, graphId, default); } - /// Initializes a new instance of RestorableGremlinResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1984,10 +2055,10 @@ public static RestorableGremlinResourceData RestorableGremlinResourceData(Resour { graphNames ??= new List(); - return new RestorableGremlinResourceData(id, name, resourceType, systemData, databaseName, graphNames?.ToList()); + return new RestorableGremlinResourceData(id, name, resourceType, systemData, databaseName, graphNames?.ToList(), default); } - /// Initializes a new instance of RestorableTable. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1996,10 +2067,10 @@ public static RestorableGremlinResourceData RestorableGremlinResourceData(Resour /// A new instance for mocking. public static RestorableTable RestorableTable(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExtendedRestorableTableResourceInfo resource = null) { - return new RestorableTable(id, name, resourceType, systemData, resource); + return new RestorableTable(id, name, resourceType, systemData, resource, default); } - /// Initializes a new instance of ExtendedRestorableTableResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this table event. /// The time when this table event happened. @@ -2008,20 +2079,20 @@ public static RestorableTable RestorableTable(ResourceIdentifier id = null, stri /// A new instance for mocking. public static ExtendedRestorableTableResourceInfo ExtendedRestorableTableResourceInfo(string rid = null, CosmosDBOperationType? operationType = null, string eventTimestamp = null, string tableName = null, string tableId = null) { - return new ExtendedRestorableTableResourceInfo(rid, operationType, eventTimestamp, tableName, tableId); + return new ExtendedRestorableTableResourceInfo(rid, operationType, eventTimestamp, tableName, tableId, default); } - /// Initializes a new instance of RestorableTableResourceData. + /// Initializes a new instance of . /// The unique resource identifier of the ARM resource. /// The name of the Table. /// The type of Azure resource. /// A new instance for mocking. public static RestorableTableResourceData RestorableTableResourceData(string id = null, string name = null, string resourceType = null) { - return new RestorableTableResourceData(id, name, resourceType); + return new RestorableTableResourceData(id, name, resourceType, default); } - /// Initializes a new instance of CosmosDBServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -2034,10 +2105,10 @@ public static RestorableTableResourceData RestorableTableResourceData(string id /// A new instance for mocking. public static CosmosDBServiceData CosmosDBServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CosmosDBServiceProperties properties = null) { - return new CosmosDBServiceData(id, name, resourceType, systemData, properties); + return new CosmosDBServiceData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of CosmosDBServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. @@ -2052,7 +2123,7 @@ public static CosmosDBServiceProperties CosmosDBServiceProperties(DateTimeOffset return new CosmosDBServiceProperties(createdOn, instanceSize, instanceCount, serviceType, status, additionalProperties); } - /// Initializes a new instance of DataTransferServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. @@ -2068,27 +2139,27 @@ public static DataTransferServiceProperties DataTransferServiceProperties(DateTi return new DataTransferServiceProperties(createdOn, instanceSize, instanceCount, CosmosDBServiceType.DataTransfer, status, additionalProperties, locations?.ToList()); } - /// Initializes a new instance of DataTransferRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. /// A new instance for mocking. public static DataTransferRegionalService DataTransferRegionalService(string name = null, AzureLocation? location = null, CosmosDBServiceStatus? status = null) { - return new DataTransferRegionalService(name, location, status); + return new DataTransferRegionalService(name, location, status, default); } - /// Initializes a new instance of CosmosDBRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. /// A new instance for mocking. public static CosmosDBRegionalService CosmosDBRegionalService(string name = null, AzureLocation? location = null, CosmosDBServiceStatus? status = null) { - return new CosmosDBRegionalService(name, location, status); + return new CosmosDBRegionalService(name, location, status, default); } - /// Initializes a new instance of SqlDedicatedGatewayServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. @@ -2105,7 +2176,7 @@ public static SqlDedicatedGatewayServiceProperties SqlDedicatedGatewayServicePro return new SqlDedicatedGatewayServiceProperties(createdOn, instanceSize, instanceCount, CosmosDBServiceType.SqlDedicatedGateway, status, additionalProperties, sqlDedicatedGatewayEndpoint, locations?.ToList()); } - /// Initializes a new instance of SqlDedicatedGatewayRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. @@ -2113,10 +2184,10 @@ public static SqlDedicatedGatewayServiceProperties SqlDedicatedGatewayServicePro /// A new instance for mocking. public static SqlDedicatedGatewayRegionalService SqlDedicatedGatewayRegionalService(string name = null, AzureLocation? location = null, CosmosDBServiceStatus? status = null, string sqlDedicatedGatewayEndpoint = null) { - return new SqlDedicatedGatewayRegionalService(name, location, status, sqlDedicatedGatewayEndpoint); + return new SqlDedicatedGatewayRegionalService(name, location, status, sqlDedicatedGatewayEndpoint, default); } - /// Initializes a new instance of GraphApiComputeServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. @@ -2133,7 +2204,7 @@ public static GraphApiComputeServiceProperties GraphApiComputeServiceProperties( return new GraphApiComputeServiceProperties(createdOn, instanceSize, instanceCount, CosmosDBServiceType.GraphApiCompute, status, additionalProperties, graphApiComputeEndpoint, locations?.ToList()); } - /// Initializes a new instance of GraphApiComputeRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. @@ -2141,10 +2212,10 @@ public static GraphApiComputeServiceProperties GraphApiComputeServiceProperties( /// A new instance for mocking. public static GraphApiComputeRegionalService GraphApiComputeRegionalService(string name = null, AzureLocation? location = null, CosmosDBServiceStatus? status = null, string graphApiComputeEndpoint = null) { - return new GraphApiComputeRegionalService(name, location, status, graphApiComputeEndpoint); + return new GraphApiComputeRegionalService(name, location, status, graphApiComputeEndpoint, default); } - /// Initializes a new instance of MaterializedViewsBuilderServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. @@ -2160,14 +2231,14 @@ public static MaterializedViewsBuilderServiceProperties MaterializedViewsBuilder return new MaterializedViewsBuilderServiceProperties(createdOn, instanceSize, instanceCount, CosmosDBServiceType.MaterializedViewsBuilder, status, additionalProperties, locations?.ToList()); } - /// Initializes a new instance of MaterializedViewsBuilderRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. /// A new instance for mocking. public static MaterializedViewsBuilderRegionalService MaterializedViewsBuilderRegionalService(string name = null, AzureLocation? location = null, CosmosDBServiceStatus? status = null) { - return new MaterializedViewsBuilderRegionalService(name, location, status); + return new MaterializedViewsBuilderRegionalService(name, location, status, default); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs index 99f029301ad8..5e804a02938f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string backupId, Can public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterBackupResourceCassandraClustersRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync(Cancell public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterBackupResourceCassandraClustersRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs index 34396aff9db2..fb7f6cf55310 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -18,20 +19,25 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CassandraClusterBackupResourceData : ResourceData { - /// Initializes a new instance of CassandraClusterBackupResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraClusterBackupResourceData() { } - /// Initializes a new instance of CassandraClusterBackupResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// - internal CassandraClusterBackupResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BackupResourceProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterBackupResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BackupResourceProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs index 07bfd735e5ef..0107c7b46aea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string clusterName, Cancel public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterData.cs index 1daec5b4f8cb..1094f1ea6755 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CassandraClusterData : TrackedResourceData { - /// Initializes a new instance of CassandraClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CassandraClusterData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CassandraClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public CassandraClusterData(AzureLocation location) : base(location) /// The location. /// Properties of a managed Cassandra cluster. /// Identity for the resource. Current supported identity types: SystemAssigned, None. - internal CassandraClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraClusterProperties properties, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraClusterProperties properties, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraClusterData() + { } /// Properties of a managed Cassandra cluster. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs index 1d49ceb75de4..5e11db6e2bfa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string dataCenterName, public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraDataCenterRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraDataCenterResource(Client, CassandraDataCenterData.DeserializeCassandraDataCenterData(e)), _cassandraDataCenterClientDiagnostics, Pipeline, "CassandraDataCenterCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraDataCenterResource(Client, CassandraDataCenterData.DeserializeCassandraDataCenterData(e)), _cassandraDataCenterClientDiagnostics, Pipeline, "CassandraDataCenterCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraDataCenterRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraDataCenterResource(Client, CassandraDataCenterData.DeserializeCassandraDataCenterData(e)), _cassandraDataCenterClientDiagnostics, Pipeline, "CassandraDataCenterCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraDataCenterResource(Client, CassandraDataCenterData.DeserializeCassandraDataCenterData(e)), _cassandraDataCenterClientDiagnostics, Pipeline, "CassandraDataCenterCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterData.cs index b4ff3f814ab4..abd342dea232 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CassandraDataCenterData : ResourceData { - /// Initializes a new instance of CassandraDataCenterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraDataCenterData() { } - /// Initializes a new instance of CassandraDataCenterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of a managed Cassandra data center. - internal CassandraDataCenterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CassandraDataCenterProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CassandraDataCenterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CassandraDataCenterProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of a managed Cassandra data center. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs index 606df35e623b..22e04f3a556c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string keyspaceName, Canc public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraKeyspaceCassandraResourcesRestClient.CreateListCassandraKeyspacesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraKeyspaceResource(Client, CassandraKeyspaceData.DeserializeCassandraKeyspaceData(e)), _cassandraKeyspaceCassandraResourcesClientDiagnostics, Pipeline, "CassandraKeyspaceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraKeyspaceResource(Client, CassandraKeyspaceData.DeserializeCassandraKeyspaceData(e)), _cassandraKeyspaceCassandraResourcesClientDiagnostics, Pipeline, "CassandraKeyspaceCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraKeyspaceCassandraResourcesRestClient.CreateListCassandraKeyspacesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraKeyspaceResource(Client, CassandraKeyspaceData.DeserializeCassandraKeyspaceData(e)), _cassandraKeyspaceCassandraResourcesClientDiagnostics, Pipeline, "CassandraKeyspaceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraKeyspaceResource(Client, CassandraKeyspaceData.DeserializeCassandraKeyspaceData(e)), _cassandraKeyspaceCassandraResourcesClientDiagnostics, Pipeline, "CassandraKeyspaceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceData.cs index d297dbcca7bb..78d73c142b1e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CassandraKeyspaceData : TrackedResourceData { - /// Initializes a new instance of CassandraKeyspaceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CassandraKeyspaceData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CassandraKeyspaceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public CassandraKeyspaceData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal CassandraKeyspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCassandraKeyspaceResourceInfo resource, CassandraKeyspacePropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraKeyspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCassandraKeyspaceResourceInfo resource, CassandraKeyspacePropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraKeyspaceData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs index e94ad29b9c3c..28feda1d58b4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string tableName, Cancellati public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraTableCassandraResourcesRestClient.CreateListCassandraTablesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraTableResource(Client, CassandraTableData.DeserializeCassandraTableData(e)), _cassandraTableCassandraResourcesClientDiagnostics, Pipeline, "CassandraTableCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraTableResource(Client, CassandraTableData.DeserializeCassandraTableData(e)), _cassandraTableCassandraResourcesClientDiagnostics, Pipeline, "CassandraTableCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraTableCassandraResourcesRestClient.CreateListCassandraTablesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraTableResource(Client, CassandraTableData.DeserializeCassandraTableData(e)), _cassandraTableCassandraResourcesClientDiagnostics, Pipeline, "CassandraTableCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraTableResource(Client, CassandraTableData.DeserializeCassandraTableData(e)), _cassandraTableCassandraResourcesClientDiagnostics, Pipeline, "CassandraTableCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableData.cs index 60b12f4d0039..209f5d8ccc49 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CassandraTableData : TrackedResourceData { - /// Initializes a new instance of CassandraTableData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CassandraTableData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CassandraTableData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public CassandraTableData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal CassandraTableData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCassandraTableResourceInfo resource, CassandraTablePropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraTableData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCassandraTableResourceInfo resource, CassandraTablePropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraTableData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs index db36607c7573..9c00752a9418 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string viewName, Can public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraViewGetResultCassandraResourcesRestClient.CreateListCassandraViewsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraViewGetResultResource(Client, CassandraViewGetResultData.DeserializeCassandraViewGetResultData(e)), _cassandraViewGetResultCassandraResourcesClientDiagnostics, Pipeline, "CassandraViewGetResultCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraViewGetResultResource(Client, CassandraViewGetResultData.DeserializeCassandraViewGetResultData(e)), _cassandraViewGetResultCassandraResourcesClientDiagnostics, Pipeline, "CassandraViewGetResultCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancell public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraViewGetResultCassandraResourcesRestClient.CreateListCassandraViewsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraViewGetResultResource(Client, CassandraViewGetResultData.DeserializeCassandraViewGetResultData(e)), _cassandraViewGetResultCassandraResourcesClientDiagnostics, Pipeline, "CassandraViewGetResultCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraViewGetResultResource(Client, CassandraViewGetResultData.DeserializeCassandraViewGetResultData(e)), _cassandraViewGetResultCassandraResourcesClientDiagnostics, Pipeline, "CassandraViewGetResultCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultData.cs index eea495edc02f..eec9ed8e87b7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CassandraViewGetResultData : TrackedResourceData { - /// Initializes a new instance of CassandraViewGetResultData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CassandraViewGetResultData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CassandraViewGetResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public CassandraViewGetResultData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal CassandraViewGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraViewGetPropertiesResource resource, CassandraViewGetPropertiesOptions options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraViewGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraViewGetPropertiesResource resource, CassandraViewGetPropertiesOptions options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraViewGetResultData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs index 507873a0ba4f..2d759b6c5c2d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountCollection.cs @@ -229,7 +229,7 @@ public virtual Response Get(string accountName, Cancell public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBAccountDatabaseAccountsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), _cosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "CosmosDBAccountCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), _cosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "CosmosDBAccountCollection.GetAll", "value", null, cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBAccountDatabaseAccountsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), _cosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "CosmosDBAccountCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), _cosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "CosmosDBAccountCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs index 3172aa3a75dc..e095727ff397 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBAccountData : TrackedResourceData { - /// Initializes a new instance of CosmosDBAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBAccountData(AzureLocation location) : base(location) { @@ -35,7 +38,7 @@ public CosmosDBAccountData(AzureLocation location) : base(location) NetworkAclBypassResourceIds = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -88,7 +91,8 @@ public CosmosDBAccountData(AzureLocation location) : base(location) /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. /// Identity for the resource. - internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, string provisioningState, string documentEndpoint, CosmosDBAccountOfferType? databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, Guid? instanceId, CosmosDBAccountCreateMode? createMode, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, string provisioningState, string documentEndpoint, CosmosDBAccountOfferType? databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, Guid? instanceId, CosmosDBAccountCreateMode? createMode, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ProvisioningState = provisioningState; @@ -132,6 +136,12 @@ internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType re EnableBurstCapacity = enableBurstCapacity; MinimalTlsVersion = minimalTlsVersion; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBAccountData() + { } /// Indicates the type of database account. This can only be set at database account creation. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs index 6a2e87370c3e..98770851162f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBFirewallRuleMongoClustersRestClient.CreateListFirewallRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cosmosDBFirewallRuleMongoClustersRestClient.CreateListFirewallRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CosmosDBFirewallRuleResource(Client, CosmosDBFirewallRuleData.DeserializeCosmosDBFirewallRuleData(e)), _cosmosDBFirewallRuleMongoClustersClientDiagnostics, Pipeline, "CosmosDBFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBFirewallRuleResource(Client, CosmosDBFirewallRuleData.DeserializeCosmosDBFirewallRuleData(e)), _cosmosDBFirewallRuleMongoClustersClientDiagnostics, Pipeline, "CosmosDBFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBFirewallRuleMongoClustersRestClient.CreateListFirewallRulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cosmosDBFirewallRuleMongoClustersRestClient.CreateListFirewallRulesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CosmosDBFirewallRuleResource(Client, CosmosDBFirewallRuleData.DeserializeCosmosDBFirewallRuleData(e)), _cosmosDBFirewallRuleMongoClustersClientDiagnostics, Pipeline, "CosmosDBFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBFirewallRuleResource(Client, CosmosDBFirewallRuleData.DeserializeCosmosDBFirewallRuleData(e)), _cosmosDBFirewallRuleMongoClustersClientDiagnostics, Pipeline, "CosmosDBFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleData.cs index 5d5b980ee757..e2f0009f6561 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBFirewallRuleData : ResourceData { - /// Initializes a new instance of CosmosDBFirewallRuleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start IP address of the mongo cluster firewall rule. Must be IPv4 format. /// The end IP address of the mongo cluster firewall rule. Must be IPv4 format. /// or is null. @@ -31,7 +35,7 @@ public CosmosDBFirewallRuleData(string startIPAddress, string endIPAddress) EndIPAddress = endIPAddress; } - /// Initializes a new instance of CosmosDBFirewallRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,11 +43,18 @@ public CosmosDBFirewallRuleData(string startIPAddress, string endIPAddress) /// The provisioning state of the firewall rule. /// The start IP address of the mongo cluster firewall rule. Must be IPv4 format. /// The end IP address of the mongo cluster firewall rule. Must be IPv4 format. - internal CosmosDBFirewallRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBProvisioningState? provisioningState, string startIPAddress, string endIPAddress) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBFirewallRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBProvisioningState? provisioningState, string startIPAddress, string endIPAddress, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; StartIPAddress = startIPAddress; EndIPAddress = endIPAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBFirewallRuleData() + { } /// The provisioning state of the firewall rule. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs index fe5ba1916c02..f2411e472a7e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationCollection.cs @@ -138,7 +138,7 @@ public virtual Response Get(AzureLocation location, Ca public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBLocationLocationsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBLocationResource(Client, CosmosDBLocationData.DeserializeCosmosDBLocationData(e)), _cosmosDBLocationLocationsClientDiagnostics, Pipeline, "CosmosDBLocationCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBLocationResource(Client, CosmosDBLocationData.DeserializeCosmosDBLocationData(e)), _cosmosDBLocationLocationsClientDiagnostics, Pipeline, "CosmosDBLocationCollection.GetAll", "value", null, cancellationToken); } /// @@ -159,7 +159,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBLocationLocationsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBLocationResource(Client, CosmosDBLocationData.DeserializeCosmosDBLocationData(e)), _cosmosDBLocationLocationsClientDiagnostics, Pipeline, "CosmosDBLocationCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBLocationResource(Client, CosmosDBLocationData.DeserializeCosmosDBLocationData(e)), _cosmosDBLocationLocationsClientDiagnostics, Pipeline, "CosmosDBLocationCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationData.cs index 978669db32f2..1437313fa356 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBLocationData : ResourceData { - /// Initializes a new instance of CosmosDBLocationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBLocationData() { } - /// Initializes a new instance of CosmosDBLocationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Cosmos DB location metadata. - internal CosmosDBLocationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBLocationProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBLocationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBLocationProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cosmos DB location metadata. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs index 9c763ce5b796..70d7b872da33 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string pr public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByDatabaseAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBPrivateEndpointConnectionResource(Client, CosmosDBPrivateEndpointConnectionData.DeserializeCosmosDBPrivateEndpointConnectionData(e)), _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBPrivateEndpointConnectionResource(Client, CosmosDBPrivateEndpointConnectionData.DeserializeCosmosDBPrivateEndpointConnectionData(e)), _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAllAs public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByDatabaseAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBPrivateEndpointConnectionResource(Client, CosmosDBPrivateEndpointConnectionData.DeserializeCosmosDBPrivateEndpointConnectionData(e)), _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBPrivateEndpointConnectionResource(Client, CosmosDBPrivateEndpointConnectionData.DeserializeCosmosDBPrivateEndpointConnectionData(e)), _cosmosDBPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionData.cs index 0f0f3c6dc65f..eb9ebccfb88b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of CosmosDBPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBPrivateEndpointConnectionData() { } - /// Initializes a new instance of CosmosDBPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,12 +36,14 @@ public CosmosDBPrivateEndpointConnectionData() /// Connection State of the Private Endpoint Connection. /// Group id of the private endpoint. /// Provisioning state of the private endpoint. - internal CosmosDBPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpointProperty privateEndpoint, CosmosDBPrivateLinkServiceConnectionStateProperty connectionState, string groupId, string provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpointProperty privateEndpoint, CosmosDBPrivateLinkServiceConnectionStateProperty connectionState, string groupId, string provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; GroupId = groupId; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Private endpoint which the connection belongs to. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs index 32b256d509fb..3b648f2a6e28 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string groupName, Cance public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByDatabaseAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBPrivateLinkResource(Client, CosmosDBPrivateLinkResourceData.DeserializeCosmosDBPrivateLinkResourceData(e)), _cosmosDBPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBPrivateLinkResource(Client, CosmosDBPrivateLinkResourceData.DeserializeCosmosDBPrivateLinkResourceData(e)), _cosmosDBPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByDatabaseAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBPrivateLinkResource(Client, CosmosDBPrivateLinkResourceData.DeserializeCosmosDBPrivateLinkResourceData(e)), _cosmosDBPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBPrivateLinkResource(Client, CosmosDBPrivateLinkResourceData.DeserializeCosmosDBPrivateLinkResourceData(e)), _cosmosDBPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceData.cs index dbcc47508b36..46c77cbd83db 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,14 +18,17 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of CosmosDBPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,11 +36,13 @@ public CosmosDBPrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource required zone names. - internal CosmosDBPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs index 3e2f6afe299e..46b685c2d37c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string serviceName, Cancell public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBServiceServiceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBServiceResource(Client, CosmosDBServiceData.DeserializeCosmosDBServiceData(e)), _cosmosDBServiceServiceClientDiagnostics, Pipeline, "CosmosDBServiceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBServiceResource(Client, CosmosDBServiceData.DeserializeCosmosDBServiceData(e)), _cosmosDBServiceServiceClientDiagnostics, Pipeline, "CosmosDBServiceCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBServiceServiceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBServiceResource(Client, CosmosDBServiceData.DeserializeCosmosDBServiceData(e)), _cosmosDBServiceServiceClientDiagnostics, Pipeline, "CosmosDBServiceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBServiceResource(Client, CosmosDBServiceData.DeserializeCosmosDBServiceData(e)), _cosmosDBServiceServiceClientDiagnostics, Pipeline, "CosmosDBServiceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceData.cs index 71d99bf9b5cf..1a2051db590f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBServiceData : ResourceData { - /// Initializes a new instance of CosmosDBServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBServiceData() { } - /// Initializes a new instance of CosmosDBServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,9 +37,11 @@ public CosmosDBServiceData() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// - internal CosmosDBServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBServiceProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBServiceProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs index af35744fb387..9fb4a93f6e4c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string clien public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlClientEncryptionKeySqlResourcesRestClient.CreateListClientEncryptionKeysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlClientEncryptionKeyResource(Client, CosmosDBSqlClientEncryptionKeyData.DeserializeCosmosDBSqlClientEncryptionKeyData(e)), _cosmosDBSqlClientEncryptionKeySqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlClientEncryptionKeyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlClientEncryptionKeyResource(Client, CosmosDBSqlClientEncryptionKeyData.DeserializeCosmosDBSqlClientEncryptionKeyData(e)), _cosmosDBSqlClientEncryptionKeySqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlClientEncryptionKeyCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlClientEncryptionKeySqlResourcesRestClient.CreateListClientEncryptionKeysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlClientEncryptionKeyResource(Client, CosmosDBSqlClientEncryptionKeyData.DeserializeCosmosDBSqlClientEncryptionKeyData(e)), _cosmosDBSqlClientEncryptionKeySqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlClientEncryptionKeyCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlClientEncryptionKeyResource(Client, CosmosDBSqlClientEncryptionKeyData.DeserializeCosmosDBSqlClientEncryptionKeyData(e)), _cosmosDBSqlClientEncryptionKeySqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlClientEncryptionKeyCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyData.cs index d91713df0cbe..7664e2f33a45 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlClientEncryptionKeyData : ResourceData { - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlClientEncryptionKeyData() { } - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// - internal CosmosDBSqlClientEncryptionKeyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBSqlClientEncryptionKeyProperties resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlClientEncryptionKeyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CosmosDBSqlClientEncryptionKeyProperties resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs index 2296dfaf6fad..4db6645d1ad7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string containerName, public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlContainerSqlResourcesRestClient.CreateListSqlContainersRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlContainerResource(Client, CosmosDBSqlContainerData.DeserializeCosmosDBSqlContainerData(e)), _cosmosDBSqlContainerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlContainerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlContainerResource(Client, CosmosDBSqlContainerData.DeserializeCosmosDBSqlContainerData(e)), _cosmosDBSqlContainerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlContainerCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlContainerSqlResourcesRestClient.CreateListSqlContainersRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlContainerResource(Client, CosmosDBSqlContainerData.DeserializeCosmosDBSqlContainerData(e)), _cosmosDBSqlContainerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlContainerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlContainerResource(Client, CosmosDBSqlContainerData.DeserializeCosmosDBSqlContainerData(e)), _cosmosDBSqlContainerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlContainerCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerData.cs index ae7e65385444..8f6542011ba5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlContainerData : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlContainerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBSqlContainerData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CosmosDBSqlContainerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public CosmosDBSqlContainerData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal CosmosDBSqlContainerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlContainerResourceInfo resource, CosmosDBSqlContainerPropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlContainerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlContainerResourceInfo resource, CosmosDBSqlContainerPropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlContainerData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs index 6c9437fb5a88..b807c9b1f2fb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string databaseName, Ca public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlDatabaseSqlResourcesRestClient.CreateListSqlDatabasesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlDatabaseResource(Client, CosmosDBSqlDatabaseData.DeserializeCosmosDBSqlDatabaseData(e)), _cosmosDBSqlDatabaseSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlDatabaseCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlDatabaseResource(Client, CosmosDBSqlDatabaseData.DeserializeCosmosDBSqlDatabaseData(e)), _cosmosDBSqlDatabaseSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlDatabaseCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlDatabaseSqlResourcesRestClient.CreateListSqlDatabasesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlDatabaseResource(Client, CosmosDBSqlDatabaseData.DeserializeCosmosDBSqlDatabaseData(e)), _cosmosDBSqlDatabaseSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlDatabaseCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlDatabaseResource(Client, CosmosDBSqlDatabaseData.DeserializeCosmosDBSqlDatabaseData(e)), _cosmosDBSqlDatabaseSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlDatabaseCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseData.cs index b7f5ca8cc8f4..cd7573bab36d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlDatabaseData : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlDatabaseData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBSqlDatabaseData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CosmosDBSqlDatabaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public CosmosDBSqlDatabaseData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal CosmosDBSqlDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlDatabaseResourceInfo resource, CosmosDBSqlDatabasePropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlDatabaseResourceInfo resource, CosmosDBSqlDatabasePropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlDatabaseData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs index 086d10b5e2a0..590d7ac2a49e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string roleAssign public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlRoleAssignmentSqlResourcesRestClient.CreateListSqlRoleAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlRoleAssignmentResource(Client, CosmosDBSqlRoleAssignmentData.DeserializeCosmosDBSqlRoleAssignmentData(e)), _cosmosDBSqlRoleAssignmentSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlRoleAssignmentResource(Client, CosmosDBSqlRoleAssignmentData.DeserializeCosmosDBSqlRoleAssignmentData(e)), _cosmosDBSqlRoleAssignmentSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleAssignmentCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Canc public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlRoleAssignmentSqlResourcesRestClient.CreateListSqlRoleAssignmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlRoleAssignmentResource(Client, CosmosDBSqlRoleAssignmentData.DeserializeCosmosDBSqlRoleAssignmentData(e)), _cosmosDBSqlRoleAssignmentSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleAssignmentCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlRoleAssignmentResource(Client, CosmosDBSqlRoleAssignmentData.DeserializeCosmosDBSqlRoleAssignmentData(e)), _cosmosDBSqlRoleAssignmentSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleAssignmentCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentData.cs index 5984d9befa97..8a8ea8a05b13 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,12 +18,15 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlRoleAssignmentData : ResourceData { - /// Initializes a new instance of CosmosDBSqlRoleAssignmentData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlRoleAssignmentData() { } - /// Initializes a new instance of CosmosDBSqlRoleAssignmentData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,11 +34,13 @@ public CosmosDBSqlRoleAssignmentData() /// The unique identifier for the associated Role Definition. /// The data plane resource path for which access is being granted through this Role Assignment. /// The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. - internal CosmosDBSqlRoleAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier roleDefinitionId, string scope, Guid? principalId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRoleAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier roleDefinitionId, string scope, Guid? principalId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RoleDefinitionId = roleDefinitionId; Scope = scope; PrincipalId = principalId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique identifier for the associated Role Definition. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs index fefc21f2a882..b324807bdbf0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string roleDefini public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlRoleDefinitionSqlResourcesRestClient.CreateListSqlRoleDefinitionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlRoleDefinitionResource(Client, CosmosDBSqlRoleDefinitionData.DeserializeCosmosDBSqlRoleDefinitionData(e)), _cosmosDBSqlRoleDefinitionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleDefinitionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlRoleDefinitionResource(Client, CosmosDBSqlRoleDefinitionData.DeserializeCosmosDBSqlRoleDefinitionData(e)), _cosmosDBSqlRoleDefinitionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleDefinitionCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Canc public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlRoleDefinitionSqlResourcesRestClient.CreateListSqlRoleDefinitionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlRoleDefinitionResource(Client, CosmosDBSqlRoleDefinitionData.DeserializeCosmosDBSqlRoleDefinitionData(e)), _cosmosDBSqlRoleDefinitionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleDefinitionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlRoleDefinitionResource(Client, CosmosDBSqlRoleDefinitionData.DeserializeCosmosDBSqlRoleDefinitionData(e)), _cosmosDBSqlRoleDefinitionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlRoleDefinitionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionData.cs index e6192c54942e..d67d8de8add5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlRoleDefinitionData : ResourceData { - /// Initializes a new instance of CosmosDBSqlRoleDefinitionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlRoleDefinitionData() { AssignableScopes = new ChangeTrackingList(); Permissions = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlRoleDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,12 +38,14 @@ public CosmosDBSqlRoleDefinitionData() /// Indicates whether the Role Definition was built-in or user created. /// A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. /// The set of operations allowed through this Role Definition. - internal CosmosDBSqlRoleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, CosmosDBSqlRoleDefinitionType? roleDefinitionType, IList assignableScopes, IList permissions) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRoleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, CosmosDBSqlRoleDefinitionType? roleDefinitionType, IList assignableScopes, IList permissions, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RoleName = roleName; RoleDefinitionType = roleDefinitionType; AssignableScopes = assignableScopes; Permissions = permissions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A user-friendly name for the Role Definition. Must be unique for the database account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs index 53d232faf646..53b56ba34375 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string storedPro public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlStoredProcedureSqlResourcesRestClient.CreateListSqlStoredProceduresRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlStoredProcedureResource(Client, CosmosDBSqlStoredProcedureData.DeserializeCosmosDBSqlStoredProcedureData(e)), _cosmosDBSqlStoredProcedureSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlStoredProcedureCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlStoredProcedureResource(Client, CosmosDBSqlStoredProcedureData.DeserializeCosmosDBSqlStoredProcedureData(e)), _cosmosDBSqlStoredProcedureSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlStoredProcedureCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Can public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlStoredProcedureSqlResourcesRestClient.CreateListSqlStoredProceduresRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlStoredProcedureResource(Client, CosmosDBSqlStoredProcedureData.DeserializeCosmosDBSqlStoredProcedureData(e)), _cosmosDBSqlStoredProcedureSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlStoredProcedureCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlStoredProcedureResource(Client, CosmosDBSqlStoredProcedureData.DeserializeCosmosDBSqlStoredProcedureData(e)), _cosmosDBSqlStoredProcedureSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlStoredProcedureCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureData.cs index 86a1734b7cc9..bd7e09dec4fb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlStoredProcedureData : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlStoredProcedureData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBSqlStoredProcedureData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CosmosDBSqlStoredProcedureData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public CosmosDBSqlStoredProcedureData(AzureLocation location) : base(location) /// The location. /// /// Identity for the resource. - internal CosmosDBSqlStoredProcedureData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlStoredProcedureResourceInfo resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlStoredProcedureData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlStoredProcedureResourceInfo resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlStoredProcedureData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs index 77c775a25d0e..b4f07438bbf5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string triggerName, Canc public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlTriggerSqlResourcesRestClient.CreateListSqlTriggersRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlTriggerResource(Client, CosmosDBSqlTriggerData.DeserializeCosmosDBSqlTriggerData(e)), _cosmosDBSqlTriggerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlTriggerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlTriggerResource(Client, CosmosDBSqlTriggerData.DeserializeCosmosDBSqlTriggerData(e)), _cosmosDBSqlTriggerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlTriggerCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlTriggerSqlResourcesRestClient.CreateListSqlTriggersRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlTriggerResource(Client, CosmosDBSqlTriggerData.DeserializeCosmosDBSqlTriggerData(e)), _cosmosDBSqlTriggerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlTriggerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlTriggerResource(Client, CosmosDBSqlTriggerData.DeserializeCosmosDBSqlTriggerData(e)), _cosmosDBSqlTriggerSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlTriggerCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerData.cs index 79baac9cd2be..9059b25a8100 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlTriggerData : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlTriggerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBSqlTriggerData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CosmosDBSqlTriggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public CosmosDBSqlTriggerData(AzureLocation location) : base(location) /// The location. /// /// Identity for the resource. - internal CosmosDBSqlTriggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlTriggerResourceInfo resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlTriggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlTriggerResourceInfo resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlTriggerData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs index 66eaad42801b..0c6589b6dcd7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string userD public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlUserDefinedFunctionSqlResourcesRestClient.CreateListSqlUserDefinedFunctionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBSqlUserDefinedFunctionResource(Client, CosmosDBSqlUserDefinedFunctionData.DeserializeCosmosDBSqlUserDefinedFunctionData(e)), _cosmosDBSqlUserDefinedFunctionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlUserDefinedFunctionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlUserDefinedFunctionResource(Client, CosmosDBSqlUserDefinedFunctionData.DeserializeCosmosDBSqlUserDefinedFunctionData(e)), _cosmosDBSqlUserDefinedFunctionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlUserDefinedFunctionCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBSqlUserDefinedFunctionSqlResourcesRestClient.CreateListSqlUserDefinedFunctionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBSqlUserDefinedFunctionResource(Client, CosmosDBSqlUserDefinedFunctionData.DeserializeCosmosDBSqlUserDefinedFunctionData(e)), _cosmosDBSqlUserDefinedFunctionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlUserDefinedFunctionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBSqlUserDefinedFunctionResource(Client, CosmosDBSqlUserDefinedFunctionData.DeserializeCosmosDBSqlUserDefinedFunctionData(e)), _cosmosDBSqlUserDefinedFunctionSqlResourcesClientDiagnostics, Pipeline, "CosmosDBSqlUserDefinedFunctionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionData.cs index 5a64cdab474c..5bd8802242dc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBSqlUserDefinedFunctionData : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBSqlUserDefinedFunctionData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public CosmosDBSqlUserDefinedFunctionData(AzureLocation location) : base(locatio /// The location. /// /// Identity for the resource. - internal CosmosDBSqlUserDefinedFunctionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlUserDefinedFunctionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlUserDefinedFunctionData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs index 0fcc3456a5ce..3147aa979342 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string tableName, Cancellatio public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBTableTableResourcesRestClient.CreateListTablesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBTableResource(Client, CosmosDBTableData.DeserializeCosmosDBTableData(e)), _cosmosDBTableTableResourcesClientDiagnostics, Pipeline, "CosmosDBTableCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBTableResource(Client, CosmosDBTableData.DeserializeCosmosDBTableData(e)), _cosmosDBTableTableResourcesClientDiagnostics, Pipeline, "CosmosDBTableCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToke public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBTableTableResourcesRestClient.CreateListTablesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBTableResource(Client, CosmosDBTableData.DeserializeCosmosDBTableData(e)), _cosmosDBTableTableResourcesClientDiagnostics, Pipeline, "CosmosDBTableCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBTableResource(Client, CosmosDBTableData.DeserializeCosmosDBTableData(e)), _cosmosDBTableTableResourcesClientDiagnostics, Pipeline, "CosmosDBTableCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableData.cs index 924cddf84198..67ced548bd1d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class CosmosDBTableData : TrackedResourceData { - /// Initializes a new instance of CosmosDBTableData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBTableData(AzureLocation location) : base(location) { } - /// Initializes a new instance of CosmosDBTableData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public CosmosDBTableData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal CosmosDBTableData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBTablePropertiesResource resource, CosmosDBTablePropertiesOptions options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBTableData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBTablePropertiesResource resource, CosmosDBTablePropertiesOptions options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBTableData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs index b537a60cc62e..294ce79ddaf1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataTransferJobGetResultDataTransferJobsRestClient.CreateListByDatabaseAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataTransferJobGetResultDataTransferJobsRestClient.CreateListByDatabaseAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataTransferJobGetResultResource(Client, DataTransferJobGetResultData.DeserializeDataTransferJobGetResultData(e)), _dataTransferJobGetResultDataTransferJobsClientDiagnostics, Pipeline, "DataTransferJobGetResultCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataTransferJobGetResultResource(Client, DataTransferJobGetResultData.DeserializeDataTransferJobGetResultData(e)), _dataTransferJobGetResultDataTransferJobsClientDiagnostics, Pipeline, "DataTransferJobGetResultCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataTransferJobGetResultDataTransferJobsRestClient.CreateListByDatabaseAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataTransferJobGetResultDataTransferJobsRestClient.CreateListByDatabaseAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataTransferJobGetResultResource(Client, DataTransferJobGetResultData.DeserializeDataTransferJobGetResultData(e)), _dataTransferJobGetResultDataTransferJobsClientDiagnostics, Pipeline, "DataTransferJobGetResultCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataTransferJobGetResultResource(Client, DataTransferJobGetResultData.DeserializeDataTransferJobGetResultData(e)), _dataTransferJobGetResultDataTransferJobsClientDiagnostics, Pipeline, "DataTransferJobGetResultCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultData.cs index 335de32d2db2..923e63c695c9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class DataTransferJobGetResultData : ResourceData { - /// Initializes a new instance of DataTransferJobGetResultData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataTransferJobGetResultData() { } - /// Initializes a new instance of DataTransferJobGetResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ public DataTransferJobGetResultData() /// Last Updated Time (ISO-8601 format). /// Worker count. /// Error response for Faulted job. - internal DataTransferJobGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string jobName, DataTransferDataSourceSink source, DataTransferDataSourceSink destination, string status, long? processedCount, long? totalCount, DateTimeOffset? lastUpdatedUtcOn, int? workerCount, ErrorResponse error) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataTransferJobGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string jobName, DataTransferDataSourceSink source, DataTransferDataSourceSink destination, string status, long? processedCount, long? totalCount, DateTimeOffset? lastUpdatedUtcOn, int? workerCount, ErrorResponse error, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { JobName = jobName; Source = source; @@ -56,6 +61,7 @@ internal DataTransferJobGetResultData(ResourceIdentifier id, string name, Resour LastUpdatedUtcOn = lastUpdatedUtcOn; WorkerCount = workerCount; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Job Name. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 045361201fde..855e7b8cf1e4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -78,7 +78,7 @@ public virtual CosmosDBLocationCollection GetCosmosDBLocations() public virtual AsyncPageable GetCosmosDBAccountsAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBAccountDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBAccounts", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBAccounts", "value", null, cancellationToken); } /// @@ -99,7 +99,7 @@ public virtual AsyncPageable GetCosmosDBAccountsAsync(C public virtual Pageable GetCosmosDBAccounts(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBAccountDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBAccounts", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBAccounts", "value", null, cancellationToken); } /// @@ -120,7 +120,7 @@ public virtual Pageable GetCosmosDBAccounts(Cancellatio public virtual AsyncPageable GetCassandraClustersAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => CassandraClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCassandraClusters", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCassandraClusters", "value", null, cancellationToken); } /// @@ -141,7 +141,7 @@ public virtual AsyncPageable GetCassandraClustersAsync public virtual Pageable GetCassandraClusters(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => CassandraClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCassandraClusters", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCassandraClusters", "value", null, cancellationToken); } /// @@ -163,7 +163,7 @@ public virtual AsyncPageable GetMongoClustersAsync(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => MongoClusterRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMongoClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMongoClusters", "value", "nextLink", cancellationToken); } /// @@ -185,7 +185,7 @@ public virtual Pageable GetMongoClusters(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => MongoClusterRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMongoClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMongoClusters", "value", "nextLink", cancellationToken); } /// @@ -206,7 +206,7 @@ public virtual Pageable GetMongoClusters(CancellationToken public virtual AsyncPageable GetRestorableCosmosDBAccountsAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); } /// @@ -227,7 +227,7 @@ public virtual AsyncPageable GetRestorableCos public virtual Pageable GetRestorableCosmosDBAccounts(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs index bf6300fa5f84..b22d18951041 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string graphName, Ca public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _graphResourceGetResultGraphResourcesRestClient.CreateListGraphsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new GraphResourceGetResultResource(Client, GraphResourceGetResultData.DeserializeGraphResourceGetResultData(e)), _graphResourceGetResultGraphResourcesClientDiagnostics, Pipeline, "GraphResourceGetResultCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new GraphResourceGetResultResource(Client, GraphResourceGetResultData.DeserializeGraphResourceGetResultData(e)), _graphResourceGetResultGraphResourcesClientDiagnostics, Pipeline, "GraphResourceGetResultCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancell public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _graphResourceGetResultGraphResourcesRestClient.CreateListGraphsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new GraphResourceGetResultResource(Client, GraphResourceGetResultData.DeserializeGraphResourceGetResultData(e)), _graphResourceGetResultGraphResourcesClientDiagnostics, Pipeline, "GraphResourceGetResultCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new GraphResourceGetResultResource(Client, GraphResourceGetResultData.DeserializeGraphResourceGetResultData(e)), _graphResourceGetResultGraphResourcesClientDiagnostics, Pipeline, "GraphResourceGetResultCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultData.cs index 7d8886fa3f4d..ba64c0e9d5eb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class GraphResourceGetResultData : TrackedResourceData { - /// Initializes a new instance of GraphResourceGetResultData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GraphResourceGetResultData(AzureLocation location) : base(location) { } - /// Initializes a new instance of GraphResourceGetResultData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,11 +39,18 @@ public GraphResourceGetResultData(AzureLocation location) : base(location) /// Gets or sets the resource. /// /// Identity for the resource. - internal GraphResourceGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WritableSubResource resource, GraphResourceGetPropertiesOptions options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GraphResourceGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WritableSubResource resource, GraphResourceGetPropertiesOptions options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GraphResourceGetResultData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs index 7ffa747e33f7..34b0e4600067 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string databaseName, Cancel public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _gremlinDatabaseGremlinResourcesRestClient.CreateListGremlinDatabasesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new GremlinDatabaseResource(Client, GremlinDatabaseData.DeserializeGremlinDatabaseData(e)), _gremlinDatabaseGremlinResourcesClientDiagnostics, Pipeline, "GremlinDatabaseCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new GremlinDatabaseResource(Client, GremlinDatabaseData.DeserializeGremlinDatabaseData(e)), _gremlinDatabaseGremlinResourcesClientDiagnostics, Pipeline, "GremlinDatabaseCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _gremlinDatabaseGremlinResourcesRestClient.CreateListGremlinDatabasesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new GremlinDatabaseResource(Client, GremlinDatabaseData.DeserializeGremlinDatabaseData(e)), _gremlinDatabaseGremlinResourcesClientDiagnostics, Pipeline, "GremlinDatabaseCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new GremlinDatabaseResource(Client, GremlinDatabaseData.DeserializeGremlinDatabaseData(e)), _gremlinDatabaseGremlinResourcesClientDiagnostics, Pipeline, "GremlinDatabaseCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseData.cs index a78493b5595f..497fb60f1592 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class GremlinDatabaseData : TrackedResourceData { - /// Initializes a new instance of GremlinDatabaseData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GremlinDatabaseData(AzureLocation location) : base(location) { } - /// Initializes a new instance of GremlinDatabaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public GremlinDatabaseData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal GremlinDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedGremlinDatabaseResourceInfo resource, GremlinDatabasePropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GremlinDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedGremlinDatabaseResourceInfo resource, GremlinDatabasePropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GremlinDatabaseData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs index 9e2e08621b38..916a9ad9180d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string graphName, Cancellation public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _gremlinGraphGremlinResourcesRestClient.CreateListGremlinGraphsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new GremlinGraphResource(Client, GremlinGraphData.DeserializeGremlinGraphData(e)), _gremlinGraphGremlinResourcesClientDiagnostics, Pipeline, "GremlinGraphCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new GremlinGraphResource(Client, GremlinGraphData.DeserializeGremlinGraphData(e)), _gremlinGraphGremlinResourcesClientDiagnostics, Pipeline, "GremlinGraphCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _gremlinGraphGremlinResourcesRestClient.CreateListGremlinGraphsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new GremlinGraphResource(Client, GremlinGraphData.DeserializeGremlinGraphData(e)), _gremlinGraphGremlinResourcesClientDiagnostics, Pipeline, "GremlinGraphCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new GremlinGraphResource(Client, GremlinGraphData.DeserializeGremlinGraphData(e)), _gremlinGraphGremlinResourcesClientDiagnostics, Pipeline, "GremlinGraphCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphData.cs index 4ae2bcd34a7c..d9e006a0c6d4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class GremlinGraphData : TrackedResourceData { - /// Initializes a new instance of GremlinGraphData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public GremlinGraphData(AzureLocation location) : base(location) { } - /// Initializes a new instance of GremlinGraphData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public GremlinGraphData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal GremlinGraphData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedGremlinGraphResourceInfo resource, GremlinGraphPropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GremlinGraphData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedGremlinGraphResourceInfo resource, GremlinGraphPropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GremlinGraphData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.Serialization.cs index 0549092e7a36..7bedd09fc8e3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.Serialization.cs @@ -6,20 +6,48 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class AccountKeyMetadata + internal partial class AccountKeyMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AccountKeyMetadata DeserializeAccountKeyMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AccountKeyMetadata DeserializeAccountKeyMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional generationTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("generationTime"u8)) @@ -31,8 +59,61 @@ internal static AccountKeyMetadata DeserializeAccountKeyMetadata(JsonElement ele generationTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AccountKeyMetadata(Optional.ToNullable(generationTime)); + return new AccountKeyMetadata(Optional.ToNullable(generationTime), serializedAdditionalRawData); + } + + AccountKeyMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAccountKeyMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AccountKeyMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAccountKeyMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AccountKeyMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AccountKeyMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAccountKeyMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.cs index a699023c1dab..9d07b58c18fd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AccountKeyMetadata.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// The metadata related to an access key for a given database account. internal partial class AccountKeyMetadata { - /// Initializes a new instance of AccountKeyMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AccountKeyMetadata() { } - /// Initializes a new instance of AccountKeyMetadata. + /// Initializes a new instance of . /// Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the last key regeneration was triggered before 2022-06-18. - internal AccountKeyMetadata(DateTimeOffset? generatedOn) + /// Keeps track of any properties unknown to the library. + internal AccountKeyMetadata(DateTimeOffset? generatedOn, Dictionary serializedAdditionalRawData) { GeneratedOn = generatedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the last key regeneration was triggered before 2022-06-18. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs index 50f1d90cd65d..b8958bd24a31 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class AnalyticalStorageConfiguration : IUtf8JsonSerializable + internal partial class AnalyticalStorageConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SchemaType)) { writer.WritePropertyName("schemaType"u8); writer.WriteStringValue(SchemaType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AnalyticalStorageConfiguration DeserializeAnalyticalStorageConfiguration(JsonElement element) + internal static AnalyticalStorageConfiguration DeserializeAnalyticalStorageConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional schemaType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schemaType"u8)) @@ -41,8 +64,61 @@ internal static AnalyticalStorageConfiguration DeserializeAnalyticalStorageConfi schemaType = new AnalyticalStorageSchemaType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AnalyticalStorageConfiguration(Optional.ToNullable(schemaType), serializedAdditionalRawData); + } + + AnalyticalStorageConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyticalStorageConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AnalyticalStorageConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAnalyticalStorageConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AnalyticalStorageConfiguration model) + { + if (model is null) + { + return null; } - return new AnalyticalStorageConfiguration(Optional.ToNullable(schemaType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AnalyticalStorageConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAnalyticalStorageConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs index f2f83f793ecc..a9e00e474e49 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AnalyticalStorageConfiguration.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Analytical storage specific properties. internal partial class AnalyticalStorageConfiguration { - /// Initializes a new instance of AnalyticalStorageConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AnalyticalStorageConfiguration() { } - /// Initializes a new instance of AnalyticalStorageConfiguration. + /// Initializes a new instance of . /// Describes the types of schema for analytical storage. - internal AnalyticalStorageConfiguration(AnalyticalStorageSchemaType? schemaType) + /// Keeps track of any properties unknown to the library. + internal AnalyticalStorageConfiguration(AnalyticalStorageSchemaType? schemaType, Dictionary serializedAdditionalRawData) { SchemaType = schemaType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the types of schema for analytical storage. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs index 0c18a381713c..d848f24d2a97 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class ApiProperties : IUtf8JsonSerializable + internal partial class ApiProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ServerVersion)) { writer.WritePropertyName("serverVersion"u8); writer.WriteStringValue(ServerVersion.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ApiProperties DeserializeApiProperties(JsonElement element) + internal static ApiProperties DeserializeApiProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional serverVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serverVersion"u8)) @@ -41,8 +64,61 @@ internal static ApiProperties DeserializeApiProperties(JsonElement element) serverVersion = new CosmosDBServerVersion(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ApiProperties(Optional.ToNullable(serverVersion), serializedAdditionalRawData); + } + + ApiProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApiProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApiProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApiProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApiProperties model) + { + if (model is null) + { + return null; } - return new ApiProperties(Optional.ToNullable(serverVersion)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApiProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApiProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs index 50b7efca95e4..dc7cfa0c539b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ApiProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The ApiProperties. internal partial class ApiProperties { - /// Initializes a new instance of ApiProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ApiProperties() { } - /// Initializes a new instance of ApiProperties. + /// Initializes a new instance of . /// Describes the ServerVersion of an a MongoDB account. - internal ApiProperties(CosmosDBServerVersion? serverVersion) + /// Keeps track of any properties unknown to the library. + internal ApiProperties(CosmosDBServerVersion? serverVersion, Dictionary serializedAdditionalRawData) { ServerVersion = serverVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the ServerVersion of an a MongoDB account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.Serialization.cs index cf95ef14d149..bc01b506bf70 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class AuthenticationMethodLdapProperties : IUtf8JsonSerializable + public partial class AuthenticationMethodLdapProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ServerHostname)) { @@ -52,7 +59,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ServerCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -61,11 +75,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("connectionTimeoutInMs"u8); writer.WriteNumberValue(ConnectionTimeoutInMs.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AuthenticationMethodLdapProperties DeserializeAuthenticationMethodLdapProperties(JsonElement element) + internal static AuthenticationMethodLdapProperties DeserializeAuthenticationMethodLdapProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +106,7 @@ internal static AuthenticationMethodLdapProperties DeserializeAuthenticationMeth Optional searchFilterTemplate = default; Optional> serverCertificates = default; Optional connectionTimeoutInMs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serverHostname"u8)) @@ -137,8 +166,61 @@ internal static AuthenticationMethodLdapProperties DeserializeAuthenticationMeth connectionTimeoutInMs = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AuthenticationMethodLdapProperties(serverHostname.Value, Optional.ToNullable(serverPort), serviceUserDistinguishedName.Value, serviceUserPassword.Value, searchBaseDistinguishedName.Value, searchFilterTemplate.Value, Optional.ToList(serverCertificates), Optional.ToNullable(connectionTimeoutInMs), serializedAdditionalRawData); + } + + AuthenticationMethodLdapProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthenticationMethodLdapProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthenticationMethodLdapProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthenticationMethodLdapProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthenticationMethodLdapProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthenticationMethodLdapProperties(Response response) + { + if (response is null) + { + return null; } - return new AuthenticationMethodLdapProperties(serverHostname.Value, Optional.ToNullable(serverPort), serviceUserDistinguishedName.Value, serviceUserPassword.Value, searchBaseDistinguishedName.Value, searchFilterTemplate.Value, Optional.ToList(serverCertificates), Optional.ToNullable(connectionTimeoutInMs)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthenticationMethodLdapProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.cs index d30c58972d73..4edec21567fd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AuthenticationMethodLdapProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,16 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Ldap authentication method properties. This feature is in preview. public partial class AuthenticationMethodLdapProperties { - /// Initializes a new instance of AuthenticationMethodLdapProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AuthenticationMethodLdapProperties() { ServerCertificates = new ChangeTrackingList(); } - /// Initializes a new instance of AuthenticationMethodLdapProperties. + /// Initializes a new instance of . /// Hostname of the LDAP server. /// Port of the LDAP server. /// Distinguished name of the look up user account, who can look up user details on authentication. @@ -28,7 +32,8 @@ public AuthenticationMethodLdapProperties() /// Template to use for searching. Defaults to (cn=%s) where %s will be replaced by the username used to login. /// /// Timeout for connecting to the LDAP server in miliseconds. The default is 5000 ms. - internal AuthenticationMethodLdapProperties(string serverHostname, int? serverPort, string serviceUserDistinguishedName, string serviceUserPassword, string searchBaseDistinguishedName, string searchFilterTemplate, IList serverCertificates, int? connectionTimeoutInMs) + /// Keeps track of any properties unknown to the library. + internal AuthenticationMethodLdapProperties(string serverHostname, int? serverPort, string serviceUserDistinguishedName, string serviceUserPassword, string searchBaseDistinguishedName, string searchFilterTemplate, IList serverCertificates, int? connectionTimeoutInMs, Dictionary serializedAdditionalRawData) { ServerHostname = serverHostname; ServerPort = serverPort; @@ -38,6 +43,7 @@ internal AuthenticationMethodLdapProperties(string serverHostname, int? serverPo SearchFilterTemplate = searchFilterTemplate; ServerCertificates = serverCertificates; ConnectionTimeoutInMs = connectionTimeoutInMs; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Hostname of the LDAP server. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.Serialization.cs index 076a74afe923..90d424092e63 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class AutoUpgradePolicyResourceInfo : IUtf8JsonSerializable + internal partial class AutoUpgradePolicyResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ThroughputPolicy)) { writer.WritePropertyName("throughputPolicy"u8); - writer.WriteObjectValue(ThroughputPolicy); + if (ThroughputPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ThroughputPolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AutoUpgradePolicyResourceInfo DeserializeAutoUpgradePolicyResourceInfo(JsonElement element) + internal static AutoUpgradePolicyResourceInfo DeserializeAutoUpgradePolicyResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughputPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughputPolicy"u8)) @@ -41,8 +71,61 @@ internal static AutoUpgradePolicyResourceInfo DeserializeAutoUpgradePolicyResour throughputPolicy = ThroughputPolicyResourceInfo.DeserializeThroughputPolicyResourceInfo(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutoUpgradePolicyResourceInfo(throughputPolicy.Value, serializedAdditionalRawData); + } + + AutoUpgradePolicyResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutoUpgradePolicyResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutoUpgradePolicyResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutoUpgradePolicyResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutoUpgradePolicyResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutoUpgradePolicyResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new AutoUpgradePolicyResourceInfo(throughputPolicy.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutoUpgradePolicyResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.cs index d34b7b309431..0283908f8209 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoUpgradePolicyResourceInfo.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB resource auto-upgrade policy. internal partial class AutoUpgradePolicyResourceInfo { - /// Initializes a new instance of AutoUpgradePolicyResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutoUpgradePolicyResourceInfo() { } - /// Initializes a new instance of AutoUpgradePolicyResourceInfo. + /// Initializes a new instance of . /// Represents throughput policy which service must adhere to for auto-upgrade. - internal AutoUpgradePolicyResourceInfo(ThroughputPolicyResourceInfo throughputPolicy) + /// Keeps track of any properties unknown to the library. + internal AutoUpgradePolicyResourceInfo(ThroughputPolicyResourceInfo throughputPolicy, Dictionary serializedAdditionalRawData) { ThroughputPolicy = throughputPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Represents throughput policy which service must adhere to for auto-upgrade. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs index 836ba523261a..773e58b21fa3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class AutoscaleSettings : IUtf8JsonSerializable + internal partial class AutoscaleSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaxThroughput)) { writer.WritePropertyName("maxThroughput"u8); writer.WriteNumberValue(MaxThroughput.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AutoscaleSettings DeserializeAutoscaleSettings(JsonElement element) + internal static AutoscaleSettings DeserializeAutoscaleSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional maxThroughput = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("maxThroughput"u8)) @@ -41,8 +64,61 @@ internal static AutoscaleSettings DeserializeAutoscaleSettings(JsonElement eleme maxThroughput = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutoscaleSettings(Optional.ToNullable(maxThroughput), serializedAdditionalRawData); + } + + AutoscaleSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutoscaleSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutoscaleSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutoscaleSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutoscaleSettings model) + { + if (model is null) + { + return null; } - return new AutoscaleSettings(Optional.ToNullable(maxThroughput)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutoscaleSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutoscaleSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs index e80a5c6de654..d338bc32c25a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The AutoscaleSettings. internal partial class AutoscaleSettings { - /// Initializes a new instance of AutoscaleSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AutoscaleSettings() { } - /// Initializes a new instance of AutoscaleSettings. + /// Initializes a new instance of . /// Represents maximum throughput, the resource can scale up to. - internal AutoscaleSettings(int? maxThroughput) + /// Keeps track of any properties unknown to the library. + internal AutoscaleSettings(int? maxThroughput, Dictionary serializedAdditionalRawData) { MaxThroughput = maxThroughput; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Represents maximum throughput, the resource can scale up to. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.Serialization.cs index b4155aea5087..83f3eb82fb80 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class AutoscaleSettingsResourceInfo : IUtf8JsonSerializable + public partial class AutoscaleSettingsResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("maxThroughput"u8); writer.WriteNumberValue(MaxThroughput); if (Optional.IsDefined(AutoUpgradePolicy)) { writer.WritePropertyName("autoUpgradePolicy"u8); - writer.WriteObjectValue(AutoUpgradePolicy); + if (AutoUpgradePolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoUpgradePolicy).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static AutoscaleSettingsResourceInfo DeserializeAutoscaleSettingsResourceInfo(JsonElement element) + internal static AutoscaleSettingsResourceInfo DeserializeAutoscaleSettingsResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +63,7 @@ internal static AutoscaleSettingsResourceInfo DeserializeAutoscaleSettingsResour int maxThroughput = default; Optional autoUpgradePolicy = default; Optional targetMaxThroughput = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("maxThroughput"u8)) @@ -59,8 +89,61 @@ internal static AutoscaleSettingsResourceInfo DeserializeAutoscaleSettingsResour targetMaxThroughput = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AutoscaleSettingsResourceInfo(maxThroughput, autoUpgradePolicy.Value, Optional.ToNullable(targetMaxThroughput), serializedAdditionalRawData); + } + + AutoscaleSettingsResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAutoscaleSettingsResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AutoscaleSettingsResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAutoscaleSettingsResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AutoscaleSettingsResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AutoscaleSettingsResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new AutoscaleSettingsResourceInfo(maxThroughput, autoUpgradePolicy.Value, Optional.ToNullable(targetMaxThroughput)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAutoscaleSettingsResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.cs index 65e5fc74a183..63607a4334c3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AutoscaleSettingsResourceInfo.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB provisioned throughput settings object. public partial class AutoscaleSettingsResourceInfo { - /// Initializes a new instance of AutoscaleSettingsResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Represents maximum throughput container can scale up to. public AutoscaleSettingsResourceInfo(int maxThroughput) { MaxThroughput = maxThroughput; } - /// Initializes a new instance of AutoscaleSettingsResourceInfo. + /// Initializes a new instance of . /// Represents maximum throughput container can scale up to. /// Cosmos DB resource auto-upgrade policy. /// Represents target maximum throughput container can scale up to once offer is no longer in pending state. - internal AutoscaleSettingsResourceInfo(int maxThroughput, AutoUpgradePolicyResourceInfo autoUpgradePolicy, int? targetMaxThroughput) + /// Keeps track of any properties unknown to the library. + internal AutoscaleSettingsResourceInfo(int maxThroughput, AutoUpgradePolicyResourceInfo autoUpgradePolicy, int? targetMaxThroughput, Dictionary serializedAdditionalRawData) { MaxThroughput = maxThroughput; AutoUpgradePolicy = autoUpgradePolicy; TargetMaxThroughput = targetMaxThroughput; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AutoscaleSettingsResourceInfo() + { } /// Represents maximum throughput container can scale up to. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.Serialization.cs index 94ade54edd53..c195718ec66a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class AzureBlobDataTransferDataSourceSink : IUtf8JsonSerializable + public partial class AzureBlobDataTransferDataSourceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("containerName"u8); writer.WriteStringValue(ContainerName); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AzureBlobDataTransferDataSourceSink DeserializeAzureBlobDataTransferDataSourceSink(JsonElement element) + internal static AzureBlobDataTransferDataSourceSink DeserializeAzureBlobDataTransferDataSourceSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +58,7 @@ internal static AzureBlobDataTransferDataSourceSink DeserializeAzureBlobDataTran string containerName = default; Optional endpointUrl = default; DataTransferComponent component = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("containerName"u8)) @@ -58,8 +80,61 @@ internal static AzureBlobDataTransferDataSourceSink DeserializeAzureBlobDataTran component = new DataTransferComponent(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureBlobDataTransferDataSourceSink(component, containerName, endpointUrl.Value, serializedAdditionalRawData); + } + + AzureBlobDataTransferDataSourceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobDataTransferDataSourceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobDataTransferDataSourceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobDataTransferDataSourceSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobDataTransferDataSourceSink model) + { + if (model is null) + { + return null; } - return new AzureBlobDataTransferDataSourceSink(component, containerName, endpointUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobDataTransferDataSourceSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobDataTransferDataSourceSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.cs index ab3c7f67e4a1..a8207175c6d7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/AzureBlobDataTransferDataSourceSink.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Blob Storage data source/sink. public partial class AzureBlobDataTransferDataSourceSink : DataTransferDataSourceSink { - /// Initializes a new instance of AzureBlobDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// is null. public AzureBlobDataTransferDataSourceSink(string containerName) @@ -24,17 +25,23 @@ public AzureBlobDataTransferDataSourceSink(string containerName) Component = DataTransferComponent.AzureBlobStorage; } - /// Initializes a new instance of AzureBlobDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// - internal AzureBlobDataTransferDataSourceSink(DataTransferComponent component, string containerName, Uri endpointUri) : base(component) + /// Keeps track of any properties unknown to the library. + internal AzureBlobDataTransferDataSourceSink(DataTransferComponent component, string containerName, Uri endpointUri, Dictionary serializedAdditionalRawData) : base(component, serializedAdditionalRawData) { ContainerName = containerName; EndpointUri = endpointUri; Component = component; } + /// Initializes a new instance of for deserialization. + internal AzureBlobDataTransferDataSourceSink() + { + } + /// Gets or sets the container name. public string ContainerName { get; set; } /// Gets or sets the endpoint uri. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs index 41f3569adc2b..2c0745200d7e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class BackupPolicyMigrationState : IUtf8JsonSerializable + public partial class BackupPolicyMigrationState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("startTime"u8); writer.WriteStringValue(StartOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackupPolicyMigrationState DeserializeBackupPolicyMigrationState(JsonElement element) + internal static BackupPolicyMigrationState DeserializeBackupPolicyMigrationState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static BackupPolicyMigrationState DeserializeBackupPolicyMigrationState Optional status = default; Optional targetType = default; Optional startTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -72,8 +94,61 @@ internal static BackupPolicyMigrationState DeserializeBackupPolicyMigrationState startTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackupPolicyMigrationState(Optional.ToNullable(status), Optional.ToNullable(targetType), Optional.ToNullable(startTime), serializedAdditionalRawData); + } + + BackupPolicyMigrationState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackupPolicyMigrationState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackupPolicyMigrationState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackupPolicyMigrationState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackupPolicyMigrationState model) + { + if (model is null) + { + return null; } - return new BackupPolicyMigrationState(Optional.ToNullable(status), Optional.ToNullable(targetType), Optional.ToNullable(startTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackupPolicyMigrationState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackupPolicyMigrationState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs index 45d5e1253be6..3f41001089ac 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupPolicyMigrationState.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// The object representing the state of the migration between the backup policies. public partial class BackupPolicyMigrationState { - /// Initializes a new instance of BackupPolicyMigrationState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BackupPolicyMigrationState() { } - /// Initializes a new instance of BackupPolicyMigrationState. + /// Initializes a new instance of . /// Describes the status of migration between backup policy types. /// Describes the target backup policy type of the backup policy migration. /// Time at which the backup policy migration started (ISO-8601 format). - internal BackupPolicyMigrationState(BackupPolicyMigrationStatus? status, BackupPolicyType? targetType, DateTimeOffset? startOn) + /// Keeps track of any properties unknown to the library. + internal BackupPolicyMigrationState(BackupPolicyMigrationStatus? status, BackupPolicyType? targetType, DateTimeOffset? startOn, Dictionary serializedAdditionalRawData) { Status = status; TargetType = targetType; StartOn = startOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the status of migration between backup policy types. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs index c3eefe00ba27..84ee0b320e18 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class BackupResourceProperties : IUtf8JsonSerializable + internal partial class BackupResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Timestamp)) { writer.WritePropertyName("timestamp"u8); writer.WriteStringValue(Timestamp.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BackupResourceProperties DeserializeBackupResourceProperties(JsonElement element) + internal static BackupResourceProperties DeserializeBackupResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional timestamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timestamp"u8)) @@ -42,8 +64,61 @@ internal static BackupResourceProperties DeserializeBackupResourceProperties(Jso timestamp = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BackupResourceProperties(Optional.ToNullable(timestamp), serializedAdditionalRawData); + } + + BackupResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBackupResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BackupResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBackupResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BackupResourceProperties model) + { + if (model is null) + { + return null; } - return new BackupResourceProperties(Optional.ToNullable(timestamp)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BackupResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBackupResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs index 4ebac73a40b3..b228637052fd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// The BackupResourceProperties. internal partial class BackupResourceProperties { - /// Initializes a new instance of BackupResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BackupResourceProperties() { } - /// Initializes a new instance of BackupResourceProperties. + /// Initializes a new instance of . /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - internal BackupResourceProperties(DateTimeOffset? timestamp) + /// Keeps track of any properties unknown to the library. + internal BackupResourceProperties(DateTimeOffset? timestamp, Dictionary serializedAdditionalRawData) { Timestamp = timestamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The time this backup was taken, formatted like 2021-01-21T17:35:21. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.Serialization.cs index 11df4b096ba1..0df104b2d35f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraCertificate : IUtf8JsonSerializable + public partial class CassandraCertificate : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Pem)) { writer.WritePropertyName("pem"u8); writer.WriteStringValue(Pem); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraCertificate DeserializeCassandraCertificate(JsonElement element) + internal static CassandraCertificate DeserializeCassandraCertificate(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional pem = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("pem"u8)) @@ -37,8 +60,61 @@ internal static CassandraCertificate DeserializeCassandraCertificate(JsonElement pem = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraCertificate(pem.Value, serializedAdditionalRawData); + } + + CassandraCertificate IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraCertificate(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraCertificate IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraCertificate(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraCertificate model) + { + if (model is null) + { + return null; } - return new CassandraCertificate(pem.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraCertificate(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraCertificate(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.cs index 1b08c5ea9e8c..28f59d50aa30 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCertificate.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraCertificate. public partial class CassandraCertificate { - /// Initializes a new instance of CassandraCertificate. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraCertificate() { } - /// Initializes a new instance of CassandraCertificate. + /// Initializes a new instance of . /// PEM formatted public key. - internal CassandraCertificate(string pem) + /// Keeps track of any properties unknown to the library. + internal CassandraCertificate(string pem, Dictionary serializedAdditionalRawData) { Pem = pem; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// PEM formatted public key. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs index 6f2b4ee52dd7..3d2954779545 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraClusterBackupResourceData : IUtf8JsonSerializable + public partial class CassandraClusterBackupResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraClusterBackupResourceData DeserializeCassandraClusterBackupResourceData(JsonElement element) + internal static CassandraClusterBackupResourceData DeserializeCassandraClusterBackupResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static CassandraClusterBackupResourceData DeserializeCassandraClusterBa string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static CassandraClusterBackupResourceData DeserializeCassandraClusterBa systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraClusterBackupResourceData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + CassandraClusterBackupResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterBackupResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterBackupResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterBackupResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterBackupResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterBackupResourceData(Response response) + { + if (response is null) + { + return null; } - return new CassandraClusterBackupResourceData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterBackupResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterData.Serialization.cs index 3c596062f8ec..2d2c482d00ed 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterData.Serialization.cs @@ -5,23 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraClusterData : IUtf8JsonSerializable + public partial class CassandraClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -41,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraClusterData DeserializeCassandraClusterData(JsonElement element) + internal static CassandraClusterData DeserializeCassandraClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static CassandraClusterData DeserializeCassandraClusterData(JsonElement string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -121,8 +150,61 @@ internal static CassandraClusterData DeserializeCassandraClusterData(JsonElement systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, identity, serializedAdditionalRawData); + } + + CassandraClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterData(Response response) + { + if (response is null) + { + return null; } - return new CassandraClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs index 4559539d64a1..406edd559bf9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs @@ -8,14 +8,130 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraClusterDataCenterNodeItem + public partial class CassandraClusterDataCenterNodeItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDataCenterNodeItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Address)) + { + writer.WritePropertyName("address"u8); + writer.WriteStringValue(Address); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(CassandraProcessStatus)) + { + writer.WritePropertyName("cassandraProcessStatus"u8); + writer.WriteStringValue(CassandraProcessStatus); + } + if (Optional.IsDefined(Load)) + { + writer.WritePropertyName("load"u8); + writer.WriteStringValue(Load); + } + if (Optional.IsCollectionDefined(Tokens)) + { + writer.WritePropertyName("tokens"u8); + writer.WriteStartArray(); + foreach (var item in Tokens) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(HostId)) + { + writer.WritePropertyName("hostID"u8); + writer.WriteStringValue(HostId.Value); + } + if (Optional.IsDefined(Rack)) + { + writer.WritePropertyName("rack"u8); + writer.WriteStringValue(Rack); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp); + } + if (Optional.IsDefined(DiskUsedKB)) + { + writer.WritePropertyName("diskUsedKB"u8); + writer.WriteNumberValue(DiskUsedKB.Value); + } + if (Optional.IsDefined(DiskFreeKB)) + { + writer.WritePropertyName("diskFreeKB"u8); + writer.WriteNumberValue(DiskFreeKB.Value); + } + if (Optional.IsDefined(MemoryUsedKB)) + { + writer.WritePropertyName("memoryUsedKB"u8); + writer.WriteNumberValue(MemoryUsedKB.Value); + } + if (Optional.IsDefined(MemoryBuffersAndCachedKB)) + { + writer.WritePropertyName("memoryBuffersAndCachedKB"u8); + writer.WriteNumberValue(MemoryBuffersAndCachedKB.Value); + } + if (Optional.IsDefined(MemoryFreeKB)) + { + writer.WritePropertyName("memoryFreeKB"u8); + writer.WriteNumberValue(MemoryFreeKB.Value); + } + if (Optional.IsDefined(MemoryTotalKB)) + { + writer.WritePropertyName("memoryTotalKB"u8); + writer.WriteNumberValue(MemoryTotalKB.Value); + } + if (Optional.IsDefined(CpuUsage)) + { + writer.WritePropertyName("cpuUsage"u8); + writer.WriteNumberValue(CpuUsage.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDataCenterNodeItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +153,7 @@ internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDa Optional memoryFreeKB = default; Optional memoryTotalKB = default; Optional cpuUsage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("address"u8)) @@ -173,8 +290,61 @@ internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDa cpuUsage = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraClusterDataCenterNodeItem(address.Value, Optional.ToNullable(state), status.Value, cassandraProcessStatus.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(size), Optional.ToNullable(hostId), rack.Value, timestamp.Value, Optional.ToNullable(diskUsedKB), Optional.ToNullable(diskFreeKB), Optional.ToNullable(memoryUsedKB), Optional.ToNullable(memoryBuffersAndCachedKB), Optional.ToNullable(memoryFreeKB), Optional.ToNullable(memoryTotalKB), Optional.ToNullable(cpuUsage)); + return new CassandraClusterDataCenterNodeItem(address.Value, Optional.ToNullable(state), status.Value, cassandraProcessStatus.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(size), Optional.ToNullable(hostId), rack.Value, timestamp.Value, Optional.ToNullable(diskUsedKB), Optional.ToNullable(diskFreeKB), Optional.ToNullable(memoryUsedKB), Optional.ToNullable(memoryBuffersAndCachedKB), Optional.ToNullable(memoryFreeKB), Optional.ToNullable(memoryTotalKB), Optional.ToNullable(cpuUsage), serializedAdditionalRawData); + } + + CassandraClusterDataCenterNodeItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterDataCenterNodeItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterDataCenterNodeItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterDataCenterNodeItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterDataCenterNodeItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterDataCenterNodeItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterDataCenterNodeItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs index a1ee7125f2cc..b5dccbdf26f8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CassandraClusterDataCenterNodeItem. public partial class CassandraClusterDataCenterNodeItem { - /// Initializes a new instance of CassandraClusterDataCenterNodeItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraClusterDataCenterNodeItem() { Tokens = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraClusterDataCenterNodeItem. + /// Initializes a new instance of . /// The node's IP address. /// The state of the node in Cassandra ring. /// @@ -38,7 +41,8 @@ internal CassandraClusterDataCenterNodeItem() /// Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. /// Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. /// A float representing the current system-wide CPU utilization as a percentage. - internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? state, string status, string cassandraProcessStatus, string load, IReadOnlyList tokens, int? size, Guid? hostId, string rack, string timestamp, long? diskUsedKB, long? diskFreeKB, long? memoryUsedKB, long? memoryBuffersAndCachedKB, long? memoryFreeKB, long? memoryTotalKB, double? cpuUsage) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? state, string status, string cassandraProcessStatus, string load, IReadOnlyList tokens, int? size, Guid? hostId, string rack, string timestamp, long? diskUsedKB, long? diskFreeKB, long? memoryUsedKB, long? memoryBuffersAndCachedKB, long? memoryFreeKB, long? memoryTotalKB, double? cpuUsage, Dictionary serializedAdditionalRawData) { Address = address; State = state; @@ -57,6 +61,7 @@ internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? MemoryFreeKB = memoryFreeKB; MemoryTotalKB = memoryTotalKB; CpuUsage = cpuUsage; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The node's IP address. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.Serialization.cs index be2b72823850..e9eb8b8ccf27 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraClusterKey : IUtf8JsonSerializable + public partial class CassandraClusterKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("orderBy"u8); writer.WriteStringValue(OrderBy); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraClusterKey DeserializeCassandraClusterKey(JsonElement element) + internal static CassandraClusterKey DeserializeCassandraClusterKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional orderBy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static CassandraClusterKey DeserializeCassandraClusterKey(JsonElement e orderBy = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraClusterKey(name.Value, orderBy.Value, serializedAdditionalRawData); + } + + CassandraClusterKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterKey model) + { + if (model is null) + { + return null; } - return new CassandraClusterKey(name.Value, orderBy.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.cs index 9ce7ae4cfb76..7ab9dc88767c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterKey.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB Cassandra table cluster key. public partial class CassandraClusterKey { - /// Initializes a new instance of CassandraClusterKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraClusterKey() { } - /// Initializes a new instance of CassandraClusterKey. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table cluster key. /// Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". - internal CassandraClusterKey(string name, string orderBy) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterKey(string name, string orderBy, Dictionary serializedAdditionalRawData) { Name = name; OrderBy = orderBy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Cosmos DB Cassandra table cluster key. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.Serialization.cs index 4b0312cb8d11..3039daa542d9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CassandraClusterListResult + internal partial class CassandraClusterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraClusterListResult DeserializeCassandraClusterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraClusterListResult DeserializeCassandraClusterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CassandraClusterListResult DeserializeCassandraClusterListResult value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraClusterListResult(Optional.ToList(value)); + return new CassandraClusterListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CassandraClusterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.cs index 1dce42d52e0c..4d6e549a8ba2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// List of managed Cassandra clusters. internal partial class CassandraClusterListResult { - /// Initializes a new instance of CassandraClusterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraClusterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraClusterListResult. + /// Initializes a new instance of . /// Container for the array of clusters. - internal CassandraClusterListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container for the array of clusters. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs index e388325d8e83..09ce4e2067d5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraClusterProperties : IUtf8JsonSerializable + public partial class CassandraClusterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProvisioningState)) { @@ -54,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrometheusEndpoint)) { writer.WritePropertyName("prometheusEndpoint"u8); - writer.WriteObjectValue(PrometheusEndpoint); + if (PrometheusEndpoint is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrometheusEndpoint).Serialize(writer, options); + } } if (Optional.IsDefined(IsRepairEnabled)) { @@ -67,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ClientCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -77,7 +98,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExternalGossipCertificates) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,7 +115,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExternalSeedNodes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -109,13 +144,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProvisionError)) { writer.WritePropertyName("provisionError"u8); - writer.WriteObjectValue(ProvisionError); + if (ProvisionError is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProvisionError).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraClusterProperties DeserializeCassandraClusterProperties(JsonElement element) + internal static CassandraClusterProperties DeserializeCassandraClusterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -138,6 +194,7 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties Optional deallocated = default; Optional cassandraAuditLoggingEnabled = default; Optional provisionError = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -311,8 +368,61 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties provisionError = CassandraError.DeserializeCassandraError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraClusterProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes), Optional.ToNullable(hoursBetweenBackups), Optional.ToNullable(deallocated), Optional.ToNullable(cassandraAuditLoggingEnabled), provisionError.Value, serializedAdditionalRawData); + } + + CassandraClusterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterProperties(Response response) + { + if (response is null) + { + return null; } - return new CassandraClusterProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes), Optional.ToNullable(hoursBetweenBackups), Optional.ToNullable(deallocated), Optional.ToNullable(cassandraAuditLoggingEnabled), provisionError.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs index eb9ad28e5a7c..df8667d24150 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties of a managed Cassandra cluster. public partial class CassandraClusterProperties { - /// Initializes a new instance of CassandraClusterProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraClusterProperties() { ClientCertificates = new ChangeTrackingList(); @@ -23,7 +27,7 @@ public CassandraClusterProperties() SeedNodes = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraClusterProperties. + /// Initializes a new instance of . /// The status of the resource at the time the operation was called. /// To create an empty cluster, omit this field or set it to null. To restore a backup into a new cluster, set this field to the resource id of the backup. /// Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets that will be delegated to data centers. The resource id must be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. @@ -42,7 +46,8 @@ public CassandraClusterProperties() /// Whether the cluster and associated data centers has been deallocated. /// Whether Cassandra audit logging is enabled. /// Error related to resource provisioning. - internal CassandraClusterProperties(CassandraProvisioningState? provisioningState, string restoreFromBackupId, ResourceIdentifier delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, CassandraAuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, CassandraDataCenterSeedNode prometheusEndpoint, bool? isRepairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes, int? hoursBetweenBackups, bool? isDeallocated, bool? isCassandraAuditLoggingEnabled, CassandraError provisionError) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterProperties(CassandraProvisioningState? provisioningState, string restoreFromBackupId, ResourceIdentifier delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, CassandraAuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, CassandraDataCenterSeedNode prometheusEndpoint, bool? isRepairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes, int? hoursBetweenBackups, bool? isDeallocated, bool? isCassandraAuditLoggingEnabled, CassandraError provisionError, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; RestoreFromBackupId = restoreFromBackupId; @@ -62,6 +67,7 @@ internal CassandraClusterProperties(CassandraProvisioningState? provisioningStat IsDeallocated = isDeallocated; IsCassandraAuditLoggingEnabled = isCassandraAuditLoggingEnabled; ProvisionError = provisionError; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status of the resource at the time the operation was called. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.Serialization.cs index 6d53ecada5d8..a84790983c15 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.Serialization.cs @@ -5,17 +5,111 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraClusterPublicStatus + public partial class CassandraClusterPublicStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraClusterPublicStatus DeserializeCassandraClusterPublicStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsDefined(ReaperStatus)) + { + writer.WritePropertyName("reaperStatus"u8); + if (ReaperStatus is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReaperStatus).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(ConnectionErrors)) + { + writer.WritePropertyName("connectionErrors"u8); + writer.WriteStartArray(); + foreach (var item in ConnectionErrors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DataCenters)) + { + writer.WritePropertyName("dataCenters"u8); + writer.WriteStartArray(); + foreach (var item in DataCenters) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraClusterPublicStatus DeserializeCassandraClusterPublicStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +119,7 @@ internal static CassandraClusterPublicStatus DeserializeCassandraClusterPublicSt Optional> connectionErrors = default; Optional> errors = default; Optional> dataCenters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -87,8 +182,61 @@ internal static CassandraClusterPublicStatus DeserializeCassandraClusterPublicSt dataCenters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraClusterPublicStatus(Optional.ToNullable(eTag), reaperStatus.Value, Optional.ToList(connectionErrors), Optional.ToList(errors), Optional.ToList(dataCenters)); + return new CassandraClusterPublicStatus(Optional.ToNullable(eTag), reaperStatus.Value, Optional.ToList(connectionErrors), Optional.ToList(errors), Optional.ToList(dataCenters), serializedAdditionalRawData); + } + + CassandraClusterPublicStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterPublicStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterPublicStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterPublicStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterPublicStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterPublicStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterPublicStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.cs index f70e1b562dc3..37c33bb981eb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties of a managed Cassandra cluster public status. public partial class CassandraClusterPublicStatus { - /// Initializes a new instance of CassandraClusterPublicStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraClusterPublicStatus() { ConnectionErrors = new ChangeTrackingList(); @@ -22,19 +26,21 @@ internal CassandraClusterPublicStatus() DataCenters = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraClusterPublicStatus. + /// Initializes a new instance of . /// /// /// List relevant information about any connection errors to the Datacenters. /// List relevant information about any errors about cluster, data center and connection error. /// List of the status of each datacenter in this cluster. - internal CassandraClusterPublicStatus(ETag? etag, CassandraReaperStatus reaperStatus, IReadOnlyList connectionErrors, IReadOnlyList errors, IReadOnlyList dataCenters) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterPublicStatus(ETag? etag, CassandraReaperStatus reaperStatus, IReadOnlyList connectionErrors, IReadOnlyList errors, IReadOnlyList dataCenters, Dictionary serializedAdditionalRawData) { ETag = etag; ReaperStatus = reaperStatus; ConnectionErrors = connectionErrors; Errors = errors; DataCenters = dataCenters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the e tag. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.Serialization.cs index 31421e590e2c..d030e4cecbad 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.Serialization.cs @@ -5,16 +5,75 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraClusterPublicStatusDataCentersItem + public partial class CassandraClusterPublicStatusDataCentersItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraClusterPublicStatusDataCentersItem DeserializeCassandraClusterPublicStatusDataCentersItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(SeedNodes)) + { + writer.WritePropertyName("seedNodes"u8); + writer.WriteStartArray(); + foreach (var item in SeedNodes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Nodes)) + { + writer.WritePropertyName("nodes"u8); + writer.WriteStartArray(); + foreach (var item in Nodes) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraClusterPublicStatusDataCentersItem DeserializeCassandraClusterPublicStatusDataCentersItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +81,7 @@ internal static CassandraClusterPublicStatusDataCentersItem DeserializeCassandra Optional name = default; Optional> seedNodes = default; Optional> nodes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +117,61 @@ internal static CassandraClusterPublicStatusDataCentersItem DeserializeCassandra nodes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraClusterPublicStatusDataCentersItem(name.Value, Optional.ToList(seedNodes), Optional.ToList(nodes)); + return new CassandraClusterPublicStatusDataCentersItem(name.Value, Optional.ToList(seedNodes), Optional.ToList(nodes), serializedAdditionalRawData); + } + + CassandraClusterPublicStatusDataCentersItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraClusterPublicStatusDataCentersItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraClusterPublicStatusDataCentersItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraClusterPublicStatusDataCentersItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraClusterPublicStatusDataCentersItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraClusterPublicStatusDataCentersItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraClusterPublicStatusDataCentersItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.cs index 43e820b66346..8dda28ea81df 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterPublicStatusDataCentersItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CassandraClusterPublicStatusDataCentersItem. public partial class CassandraClusterPublicStatusDataCentersItem { - /// Initializes a new instance of CassandraClusterPublicStatusDataCentersItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraClusterPublicStatusDataCentersItem() { SeedNodes = new ChangeTrackingList(); Nodes = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraClusterPublicStatusDataCentersItem. + /// Initializes a new instance of . /// The name of this Datacenter. /// A list of all seed nodes in the cluster, managed and unmanaged. /// - internal CassandraClusterPublicStatusDataCentersItem(string name, IReadOnlyList seedNodes, IReadOnlyList nodes) + /// Keeps track of any properties unknown to the library. + internal CassandraClusterPublicStatusDataCentersItem(string name, IReadOnlyList seedNodes, IReadOnlyList nodes, Dictionary serializedAdditionalRawData) { Name = name; SeedNodes = seedNodes; Nodes = nodes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of this Datacenter. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.Serialization.cs index 37c50d660ccc..49bf29737386 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraColumn : IUtf8JsonSerializable + public partial class CassandraColumn : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(CassandraColumnType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraColumn DeserializeCassandraColumn(JsonElement element) + internal static CassandraColumn DeserializeCassandraColumn(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static CassandraColumn DeserializeCassandraColumn(JsonElement element) type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraColumn(name.Value, type.Value, serializedAdditionalRawData); + } + + CassandraColumn IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraColumn(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraColumn IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraColumn(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraColumn model) + { + if (model is null) + { + return null; } - return new CassandraColumn(name.Value, type.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraColumn(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraColumn(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.cs index dd4cc8486337..58033df13413 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraColumn.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB Cassandra table column. public partial class CassandraColumn { - /// Initializes a new instance of CassandraColumn. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraColumn() { } - /// Initializes a new instance of CassandraColumn. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table column. /// Type of the Cosmos DB Cassandra table column. - internal CassandraColumn(string name, string cassandraColumnType) + /// Keeps track of any properties unknown to the library. + internal CassandraColumn(string name, string cassandraColumnType, Dictionary serializedAdditionalRawData) { Name = name; CassandraColumnType = cassandraColumnType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Cosmos DB Cassandra table column. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.Serialization.cs index b3e4ac762470..e407eda4b960 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraCommandOutput + public partial class CassandraCommandOutput : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraCommandOutput DeserializeCassandraCommandOutput(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CommandOutput)) + { + writer.WritePropertyName("commandOutput"u8); + writer.WriteStringValue(CommandOutput); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraCommandOutput DeserializeCassandraCommandOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional commandOutput = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("commandOutput"u8)) @@ -26,8 +60,61 @@ internal static CassandraCommandOutput DeserializeCassandraCommandOutput(JsonEle commandOutput = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraCommandOutput(commandOutput.Value); + return new CassandraCommandOutput(commandOutput.Value, serializedAdditionalRawData); + } + + CassandraCommandOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraCommandOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraCommandOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraCommandOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraCommandOutput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraCommandOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraCommandOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.cs index 2fc1aef83646..5ea0423a9953 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandOutput.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Response of /command api. public partial class CassandraCommandOutput { - /// Initializes a new instance of CassandraCommandOutput. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraCommandOutput() { } - /// Initializes a new instance of CassandraCommandOutput. + /// Initializes a new instance of . /// Output of the command. - internal CassandraCommandOutput(string commandOutput) + /// Keeps track of any properties unknown to the library. + internal CassandraCommandOutput(string commandOutput, Dictionary serializedAdditionalRawData) { CommandOutput = commandOutput; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Output of the command. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.Serialization.cs index 230722662fa7..8e4ec4e4faff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraCommandPostBody : IUtf8JsonSerializable + public partial class CassandraCommandPostBody : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("command"u8); writer.WriteStringValue(Command); @@ -40,7 +48,134 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readwrite"u8); writer.WriteBooleanValue(AllowWrite.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CassandraCommandPostBody DeserializeCassandraCommandPostBody(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string command = default; + Optional> arguments = default; + string host = default; + Optional cassandraStopStart = default; + Optional readwrite = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("command"u8)) + { + command = property.Value.GetString(); + continue; + } + if (property.NameEquals("arguments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + arguments = dictionary; + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("cassandra-stop-start"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cassandraStopStart = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("readwrite"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readwrite = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraCommandPostBody(command, Optional.ToDictionary(arguments), host, Optional.ToNullable(cassandraStopStart), Optional.ToNullable(readwrite), serializedAdditionalRawData); + } + + CassandraCommandPostBody IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraCommandPostBody(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraCommandPostBody IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraCommandPostBody(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraCommandPostBody model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraCommandPostBody(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraCommandPostBody(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.cs index 0bfb2c341b4f..87dde8e2dc18 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraCommandPostBody.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Specification of which command to run where. public partial class CassandraCommandPostBody { - /// Initializes a new instance of CassandraCommandPostBody. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The command which should be run. /// IP address of the cassandra host to run the command on. /// or is null. @@ -28,6 +31,28 @@ public CassandraCommandPostBody(string command, string host) Host = host; } + /// Initializes a new instance of . + /// The command which should be run. + /// The arguments for the command to be run. + /// IP address of the cassandra host to run the command on. + /// If true, stops cassandra before executing the command and then start it again. + /// If true, allows the command to *write* to the cassandra directory, otherwise read-only. + /// Keeps track of any properties unknown to the library. + internal CassandraCommandPostBody(string command, IDictionary arguments, string host, bool? cassandraStopStart, bool? allowWrite, Dictionary serializedAdditionalRawData) + { + Command = command; + Arguments = arguments; + Host = host; + CassandraStopStart = cassandraStopStart; + AllowWrite = allowWrite; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraCommandPostBody() + { + } + /// The command which should be run. public string Command { get; } /// The arguments for the command to be run. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.Serialization.cs index 9c2cec27d934..9aa1d784d2e5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraConnectionError + public partial class CassandraConnectionError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraConnectionError DeserializeCassandraConnectionError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("connectionState"u8); + writer.WriteStringValue(ConnectionState.Value.ToString()); + } + if (Optional.IsDefined(IPFrom)) + { + writer.WritePropertyName("iPFrom"u8); + writer.WriteStringValue(IPFrom); + } + if (Optional.IsDefined(IPTo)) + { + writer.WritePropertyName("iPTo"u8); + writer.WriteStringValue(IPTo); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(Exception)) + { + writer.WritePropertyName("exception"u8); + writer.WriteStringValue(Exception); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraConnectionError DeserializeCassandraConnectionError(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static CassandraConnectionError DeserializeCassandraConnectionError(Jso Optional ipTo = default; Optional port = default; Optional exception = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionState"u8)) @@ -58,8 +112,61 @@ internal static CassandraConnectionError DeserializeCassandraConnectionError(Jso exception = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraConnectionError(Optional.ToNullable(connectionState), ipFrom.Value, ipTo.Value, Optional.ToNullable(port), exception.Value); + return new CassandraConnectionError(Optional.ToNullable(connectionState), ipFrom.Value, ipTo.Value, Optional.ToNullable(port), exception.Value, serializedAdditionalRawData); + } + + CassandraConnectionError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraConnectionError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraConnectionError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraConnectionError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraConnectionError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraConnectionError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraConnectionError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.cs index 2b621194beed..38d25b9b2ada 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraConnectionError.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraConnectionError. public partial class CassandraConnectionError { - /// Initializes a new instance of CassandraConnectionError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraConnectionError() { } - /// Initializes a new instance of CassandraConnectionError. + /// Initializes a new instance of . /// The kind of connection error that occurred. /// The IP of host that originated the failed connection. /// The IP that the connection attempted to reach. /// The TCP port the connection was attempted on. /// Detailed error message about the failed connection. - internal CassandraConnectionError(CassandraConnectionState? connectionState, string ipFrom, string ipTo, int? port, string exception) + /// Keeps track of any properties unknown to the library. + internal CassandraConnectionError(CassandraConnectionState? connectionState, string ipFrom, string ipTo, int? port, string exception, Dictionary serializedAdditionalRawData) { ConnectionState = connectionState; IPFrom = ipFrom; IPTo = ipTo; Port = port; Exception = exception; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The kind of connection error that occurred. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterData.Serialization.cs index ebb7578565a2..9724b719039c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraDataCenterData : IUtf8JsonSerializable + public partial class CassandraDataCenterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraDataCenterData DeserializeCassandraDataCenterData(JsonElement element) + internal static CassandraDataCenterData DeserializeCassandraDataCenterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static CassandraDataCenterData DeserializeCassandraDataCenterData(JsonE string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static CassandraDataCenterData DeserializeCassandraDataCenterData(JsonE systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraDataCenterData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + CassandraDataCenterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraDataCenterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraDataCenterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraDataCenterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraDataCenterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraDataCenterData(Response response) + { + if (response is null) + { + return null; } - return new CassandraDataCenterData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraDataCenterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.Serialization.cs index 8c406d37e74d..3827ccfb4a3b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CassandraDataCenterListResult + internal partial class CassandraDataCenterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraDataCenterListResult DeserializeCassandraDataCenterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraDataCenterListResult DeserializeCassandraDataCenterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CassandraDataCenterListResult DeserializeCassandraDataCenterList value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraDataCenterListResult(Optional.ToList(value)); + return new CassandraDataCenterListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CassandraDataCenterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraDataCenterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraDataCenterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraDataCenterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraDataCenterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraDataCenterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraDataCenterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.cs index ac816f280c71..a0538da94938 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// List of managed Cassandra data centers and their properties. internal partial class CassandraDataCenterListResult { - /// Initializes a new instance of CassandraDataCenterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraDataCenterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraDataCenterListResult. + /// Initializes a new instance of . /// Container for array of data centers. - internal CassandraDataCenterListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CassandraDataCenterListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container for array of data centers. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.Serialization.cs index 084d9d927dac..54b7a9d2b08e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraDataCenterProperties : IUtf8JsonSerializable + public partial class CassandraDataCenterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ProvisioningState)) { @@ -75,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationMethodLdapProperties)) { writer.WritePropertyName("authenticationMethodLdapProperties"u8); - writer.WriteObjectValue(AuthenticationMethodLdapProperties); + if (AuthenticationMethodLdapProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AuthenticationMethodLdapProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Deallocated)) { @@ -85,13 +98,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProvisionError)) { writer.WritePropertyName("provisionError"u8); - writer.WriteObjectValue(ProvisionError); + if (ProvisionError is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ProvisionError).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraDataCenterProperties DeserializeCassandraDataCenterProperties(JsonElement element) + internal static CassandraDataCenterProperties DeserializeCassandraDataCenterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -111,6 +145,7 @@ internal static CassandraDataCenterProperties DeserializeCassandraDataCenterProp Optional authenticationMethodLdapProperties = default; Optional deallocated = default; Optional provisionError = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -241,8 +276,61 @@ internal static CassandraDataCenterProperties DeserializeCassandraDataCenterProp provisionError = CassandraError.DeserializeCassandraError(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraDataCenterProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(dataCenterLocation), delegatedSubnetId.Value, Optional.ToNullable(nodeCount), Optional.ToList(seedNodes), base64EncodedCassandraYamlFragment.Value, managedDiskCustomerKeyUri.Value, backupStorageCustomerKeyUri.Value, sku.Value, diskSku.Value, Optional.ToNullable(diskCapacity), Optional.ToNullable(availabilityZone), authenticationMethodLdapProperties.Value, Optional.ToNullable(deallocated), provisionError.Value, serializedAdditionalRawData); + } + + CassandraDataCenterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraDataCenterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraDataCenterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraDataCenterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraDataCenterProperties model) + { + if (model is null) + { + return null; } - return new CassandraDataCenterProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(dataCenterLocation), delegatedSubnetId.Value, Optional.ToNullable(nodeCount), Optional.ToList(seedNodes), base64EncodedCassandraYamlFragment.Value, managedDiskCustomerKeyUri.Value, backupStorageCustomerKeyUri.Value, sku.Value, diskSku.Value, Optional.ToNullable(diskCapacity), Optional.ToNullable(availabilityZone), authenticationMethodLdapProperties.Value, Optional.ToNullable(deallocated), provisionError.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraDataCenterProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraDataCenterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.cs index 1b8186440b81..1a285df81ec1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterProperties.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties of a managed Cassandra data center. public partial class CassandraDataCenterProperties { - /// Initializes a new instance of CassandraDataCenterProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraDataCenterProperties() { SeedNodes = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraDataCenterProperties. + /// Initializes a new instance of . /// The status of the resource at the time the operation was called. /// The region this data center should be created in. /// Resource id of a subnet the nodes in this data center should have their network interfaces connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' property. This resource id will be of the form '/subscriptions/<subscription id>/resourceGroups/<resource group>/providers/Microsoft.Network/virtualNetworks/<virtual network>/subnets/<subnet>'. @@ -36,7 +39,8 @@ public CassandraDataCenterProperties() /// Ldap authentication method properties. This feature is in preview. /// Whether the data center has been deallocated. /// Error related to resource provisioning. - internal CassandraDataCenterProperties(CassandraProvisioningState? provisioningState, AzureLocation? dataCenterLocation, ResourceIdentifier delegatedSubnetId, int? nodeCount, IReadOnlyList seedNodes, string base64EncodedCassandraYamlFragment, Uri managedDiskCustomerKeyUri, Uri backupStorageCustomerKeyUri, string sku, string diskSku, int? diskCapacity, bool? doesSupportAvailabilityZone, AuthenticationMethodLdapProperties authenticationMethodLdapProperties, bool? deallocated, CassandraError provisionError) + /// Keeps track of any properties unknown to the library. + internal CassandraDataCenterProperties(CassandraProvisioningState? provisioningState, AzureLocation? dataCenterLocation, ResourceIdentifier delegatedSubnetId, int? nodeCount, IReadOnlyList seedNodes, string base64EncodedCassandraYamlFragment, Uri managedDiskCustomerKeyUri, Uri backupStorageCustomerKeyUri, string sku, string diskSku, int? diskCapacity, bool? doesSupportAvailabilityZone, AuthenticationMethodLdapProperties authenticationMethodLdapProperties, bool? deallocated, CassandraError provisionError, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; DataCenterLocation = dataCenterLocation; @@ -53,6 +57,7 @@ internal CassandraDataCenterProperties(CassandraProvisioningState? provisioningS AuthenticationMethodLdapProperties = authenticationMethodLdapProperties; Deallocated = deallocated; ProvisionError = provisionError; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status of the resource at the time the operation was called. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.Serialization.cs index 32da00fa7876..440dca17d0fa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraDataCenterSeedNode : IUtf8JsonSerializable + public partial class CassandraDataCenterSeedNode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IPAddress)) { writer.WritePropertyName("ipAddress"u8); writer.WriteStringValue(IPAddress); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraDataCenterSeedNode DeserializeCassandraDataCenterSeedNode(JsonElement element) + internal static CassandraDataCenterSeedNode DeserializeCassandraDataCenterSeedNode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ipAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipAddress"u8)) @@ -37,8 +60,61 @@ internal static CassandraDataCenterSeedNode DeserializeCassandraDataCenterSeedNo ipAddress = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraDataCenterSeedNode(ipAddress.Value, serializedAdditionalRawData); + } + + CassandraDataCenterSeedNode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraDataCenterSeedNode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraDataCenterSeedNode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraDataCenterSeedNode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraDataCenterSeedNode model) + { + if (model is null) + { + return null; } - return new CassandraDataCenterSeedNode(ipAddress.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraDataCenterSeedNode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraDataCenterSeedNode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.cs index 47cd0968c847..69694140eca0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraDataCenterSeedNode.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraDataCenterSeedNode. public partial class CassandraDataCenterSeedNode { - /// Initializes a new instance of CassandraDataCenterSeedNode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraDataCenterSeedNode() { } - /// Initializes a new instance of CassandraDataCenterSeedNode. + /// Initializes a new instance of . /// IP address of this seed node. - internal CassandraDataCenterSeedNode(string ipAddress) + /// Keeps track of any properties unknown to the library. + internal CassandraDataCenterSeedNode(string ipAddress, Dictionary serializedAdditionalRawData) { IPAddress = ipAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// IP address of this seed node. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.Serialization.cs index b710cb81b61b..e6d829d51e8d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraError : IUtf8JsonSerializable + public partial class CassandraError : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Code)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("additionalErrorInfo"u8); writer.WriteStringValue(AdditionalErrorInfo); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraError DeserializeCassandraError(JsonElement element) + internal static CassandraError DeserializeCassandraError(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static CassandraError DeserializeCassandraError(JsonElement element) Optional message = default; Optional target = default; Optional additionalErrorInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -70,8 +93,61 @@ internal static CassandraError DeserializeCassandraError(JsonElement element) additionalErrorInfo = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraError(code.Value, message.Value, target.Value, additionalErrorInfo.Value, serializedAdditionalRawData); + } + + CassandraError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraError model) + { + if (model is null) + { + return null; } - return new CassandraError(code.Value, message.Value, target.Value, additionalErrorInfo.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.cs index cd955ff7dccc..204d62600ac7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraError.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraError. public partial class CassandraError { - /// Initializes a new instance of CassandraError. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraError() { } - /// Initializes a new instance of CassandraError. + /// Initializes a new instance of . /// The code of error that occurred. /// The message of the error. /// The target resource of the error. /// Additional information about the error. - internal CassandraError(string code, string message, string target, string additionalErrorInfo) + /// Keeps track of any properties unknown to the library. + internal CassandraError(string code, string message, string target, string additionalErrorInfo, Dictionary serializedAdditionalRawData) { Code = code; Message = message; Target = target; AdditionalErrorInfo = additionalErrorInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The code of error that occurred. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.Serialization.cs index 710273fa1ddb..d95a021d215d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraKeyspaceCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CassandraKeyspaceCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraKeyspaceCreateOrUpdateContent DeserializeCassandraKeyspaceCreateOrUpdateContent(JsonElement element) + internal static CassandraKeyspaceCreateOrUpdateContent DeserializeCassandraKeyspaceCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CassandraKeyspaceCreateOrUpdateContent DeserializeCassandraKeysp Optional systemData = default; CassandraKeyspaceResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CassandraKeyspaceCreateOrUpdateContent DeserializeCassandraKeysp } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraKeyspaceCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CassandraKeyspaceCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraKeyspaceCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraKeyspaceCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraKeyspaceCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraKeyspaceCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CassandraKeyspaceCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraKeyspaceCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraKeyspaceCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.cs index 817e47628cd2..c2711d9225f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Cassandra keyspace. public partial class CassandraKeyspaceCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CassandraKeyspaceCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Cassandra keyspace. /// is null. @@ -26,7 +29,7 @@ public CassandraKeyspaceCreateOrUpdateContent(AzureLocation location, CassandraK Resource = resource; } - /// Initializes a new instance of CassandraKeyspaceCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CassandraKeyspaceCreateOrUpdateContent(AzureLocation location, CassandraK /// The standard JSON format of a Cassandra keyspace. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CassandraKeyspaceCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraKeyspaceResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraKeyspaceCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraKeyspaceResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraKeyspaceCreateOrUpdateContent() + { } /// The standard JSON format of a Cassandra keyspace. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceData.Serialization.cs index f668cc32805e..b8ab5f97074d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraKeyspaceData : IUtf8JsonSerializable + public partial class CassandraKeyspaceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraKeyspaceData DeserializeCassandraKeyspaceData(JsonElement element) + internal static CassandraKeyspaceData DeserializeCassandraKeyspaceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static CassandraKeyspaceData DeserializeCassandraKeyspaceData(JsonEleme Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static CassandraKeyspaceData DeserializeCassandraKeyspaceData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraKeyspaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + CassandraKeyspaceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraKeyspaceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraKeyspaceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraKeyspaceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraKeyspaceData model) + { + if (model is null) + { + return null; } - return new CassandraKeyspaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraKeyspaceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraKeyspaceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs index 9e03145f23fa..0c1caa4c2bda 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CassandraKeyspaceListResult + internal partial class CassandraKeyspaceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraKeyspaceListResult DeserializeCassandraKeyspaceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraKeyspaceListResult DeserializeCassandraKeyspaceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CassandraKeyspaceListResult DeserializeCassandraKeyspaceListResu value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraKeyspaceListResult(Optional.ToList(value)); + return new CassandraKeyspaceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CassandraKeyspaceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraKeyspaceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraKeyspaceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraKeyspaceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraKeyspaceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraKeyspaceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraKeyspaceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs index bf72fc050a8c..333f55dc29c9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Cassandra keyspaces and their properties. internal partial class CassandraKeyspaceListResult { - /// Initializes a new instance of CassandraKeyspaceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraKeyspaceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraKeyspaceListResult. + /// Initializes a new instance of . /// List of Cassandra keyspaces and their properties. - internal CassandraKeyspaceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CassandraKeyspaceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Cassandra keyspaces and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.Serialization.cs index 1b55da7b9974..6a0ef90ec960 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraKeyspacePropertiesConfig : IUtf8JsonSerializable + public partial class CassandraKeyspacePropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraKeyspacePropertiesConfig DeserializeCassandraKeyspacePropertiesConfig(JsonElement element) + internal static CassandraKeyspacePropertiesConfig DeserializeCassandraKeyspacePropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CassandraKeyspacePropertiesConfig DeserializeCassandraKeyspacePr autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraKeyspacePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CassandraKeyspacePropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraKeyspacePropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraKeyspacePropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraKeyspacePropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraKeyspacePropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraKeyspacePropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new CassandraKeyspacePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraKeyspacePropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.cs index 6649872acd62..187b27d96cd7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspacePropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraKeyspacePropertiesConfig. public partial class CassandraKeyspacePropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of CassandraKeyspacePropertiesConfig. + /// Initializes a new instance of . public CassandraKeyspacePropertiesConfig() { } - /// Initializes a new instance of CassandraKeyspacePropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CassandraKeyspacePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CassandraKeyspacePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.Serialization.cs index f294cecb19c0..11c6ccde892c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraKeyspaceResourceInfo : IUtf8JsonSerializable + public partial class CassandraKeyspaceResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(KeyspaceName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraKeyspaceResourceInfo DeserializeCassandraKeyspaceResourceInfo(JsonElement element) + internal static CassandraKeyspaceResourceInfo DeserializeCassandraKeyspaceResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -34,8 +57,61 @@ internal static CassandraKeyspaceResourceInfo DeserializeCassandraKeyspaceResour id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraKeyspaceResourceInfo(id, serializedAdditionalRawData); + } + + CassandraKeyspaceResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraKeyspaceResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraKeyspaceResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraKeyspaceResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraKeyspaceResourceInfo model) + { + if (model is null) + { + return null; } - return new CassandraKeyspaceResourceInfo(id); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraKeyspaceResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraKeyspaceResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.cs index 3554d4f4b91b..7b665cf566c7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraKeyspaceResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB Cassandra keyspace resource object. public partial class CassandraKeyspaceResourceInfo { - /// Initializes a new instance of CassandraKeyspaceResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra keyspace. /// is null. public CassandraKeyspaceResourceInfo(string keyspaceName) @@ -23,6 +27,20 @@ public CassandraKeyspaceResourceInfo(string keyspaceName) KeyspaceName = keyspaceName; } + /// Initializes a new instance of . + /// Name of the Cosmos DB Cassandra keyspace. + /// Keeps track of any properties unknown to the library. + internal CassandraKeyspaceResourceInfo(string keyspaceName, Dictionary serializedAdditionalRawData) + { + KeyspaceName = keyspaceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraKeyspaceResourceInfo() + { + } + /// Name of the Cosmos DB Cassandra keyspace. public string KeyspaceName { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs index cc2d81cab487..2829a59206ef 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraPartitionKey : IUtf8JsonSerializable + public partial class CassandraPartitionKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraPartitionKey DeserializeCassandraPartitionKey(JsonElement element) + internal static CassandraPartitionKey DeserializeCassandraPartitionKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static CassandraPartitionKey DeserializeCassandraPartitionKey(JsonEleme name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraPartitionKey(name.Value, serializedAdditionalRawData); + } + + CassandraPartitionKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraPartitionKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraPartitionKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraPartitionKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraPartitionKey model) + { + if (model is null) + { + return null; } - return new CassandraPartitionKey(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraPartitionKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraPartitionKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs index 241bb78e9a01..e4c18be4bee1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraPartitionKey.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB Cassandra table partition key. public partial class CassandraPartitionKey { - /// Initializes a new instance of CassandraPartitionKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraPartitionKey() { } - /// Initializes a new instance of CassandraPartitionKey. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table partition key. - internal CassandraPartitionKey(string name) + /// Keeps track of any properties unknown to the library. + internal CassandraPartitionKey(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Cosmos DB Cassandra table partition key. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.Serialization.cs index da59e4378f80..4fe8513911f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraReaperStatus + public partial class CassandraReaperStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraReaperStatus DeserializeCassandraReaperStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IsHealthy)) + { + writer.WritePropertyName("healthy"u8); + writer.WriteBooleanValue(IsHealthy.Value); + } + if (Optional.IsCollectionDefined(RepairRunIds)) + { + writer.WritePropertyName("repairRunIds"u8); + writer.WriteStartObject(); + foreach (var item in RepairRunIds) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(RepairSchedules)) + { + writer.WritePropertyName("repairSchedules"u8); + writer.WriteStartObject(); + foreach (var item in RepairSchedules) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraReaperStatus DeserializeCassandraReaperStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static CassandraReaperStatus DeserializeCassandraReaperStatus(JsonEleme Optional healthy = default; Optional> repairRunIds = default; Optional> repairSchedules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("healthy"u8)) @@ -61,8 +116,61 @@ internal static CassandraReaperStatus DeserializeCassandraReaperStatus(JsonEleme repairSchedules = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraReaperStatus(Optional.ToNullable(healthy), Optional.ToDictionary(repairRunIds), Optional.ToDictionary(repairSchedules)); + return new CassandraReaperStatus(Optional.ToNullable(healthy), Optional.ToDictionary(repairRunIds), Optional.ToDictionary(repairSchedules), serializedAdditionalRawData); + } + + CassandraReaperStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraReaperStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraReaperStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraReaperStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraReaperStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraReaperStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraReaperStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.cs index 26b4c0c12bf3..84d1e0503317 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraReaperStatus.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CassandraReaperStatus. public partial class CassandraReaperStatus { - /// Initializes a new instance of CassandraReaperStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraReaperStatus() { RepairRunIds = new ChangeTrackingDictionary(); RepairSchedules = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CassandraReaperStatus. + /// Initializes a new instance of . /// /// Dictionary of <string>. /// Dictionary of <string>. - internal CassandraReaperStatus(bool? isHealthy, IReadOnlyDictionary repairRunIds, IReadOnlyDictionary repairSchedules) + /// Keeps track of any properties unknown to the library. + internal CassandraReaperStatus(bool? isHealthy, IReadOnlyDictionary repairRunIds, IReadOnlyDictionary repairSchedules, Dictionary serializedAdditionalRawData) { IsHealthy = isHealthy; RepairRunIds = repairRunIds; RepairSchedules = repairSchedules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the is healthy. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs index c397509fdcc4..494e0c778126 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraSchema : IUtf8JsonSerializable + public partial class CassandraSchema : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Columns)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Columns) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PartitionKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,15 +63,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ClusterKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraSchema DeserializeCassandraSchema(JsonElement element) + internal static CassandraSchema DeserializeCassandraSchema(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +100,7 @@ internal static CassandraSchema DeserializeCassandraSchema(JsonElement element) Optional> columns = default; Optional> partitionKeys = default; Optional> clusterKeys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("columns"u8)) @@ -102,8 +145,61 @@ internal static CassandraSchema DeserializeCassandraSchema(JsonElement element) clusterKeys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraSchema(Optional.ToList(columns), Optional.ToList(partitionKeys), Optional.ToList(clusterKeys), serializedAdditionalRawData); + } + + CassandraSchema IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraSchema(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraSchema IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraSchema(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraSchema model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraSchema(Response response) + { + if (response is null) + { + return null; } - return new CassandraSchema(Optional.ToList(columns), Optional.ToList(partitionKeys), Optional.ToList(clusterKeys)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraSchema(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs index cc014e0506ec..ea1f74b5be38 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraSchema.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB Cassandra table schema. public partial class CassandraSchema { - /// Initializes a new instance of CassandraSchema. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CassandraSchema() { Columns = new ChangeTrackingList(); @@ -21,15 +25,17 @@ public CassandraSchema() ClusterKeys = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraSchema. + /// Initializes a new instance of . /// List of Cassandra table columns. /// List of partition key. /// List of cluster key. - internal CassandraSchema(IList columns, IList partitionKeys, IList clusterKeys) + /// Keeps track of any properties unknown to the library. + internal CassandraSchema(IList columns, IList partitionKeys, IList clusterKeys, Dictionary serializedAdditionalRawData) { Columns = columns; PartitionKeys = partitionKeys; ClusterKeys = clusterKeys; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Cassandra table columns. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.Serialization.cs index 1fefbd338866..65158b963318 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraTableCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CassandraTableCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraTableCreateOrUpdateContent DeserializeCassandraTableCreateOrUpdateContent(JsonElement element) + internal static CassandraTableCreateOrUpdateContent DeserializeCassandraTableCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CassandraTableCreateOrUpdateContent DeserializeCassandraTableCre Optional systemData = default; CassandraTableResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CassandraTableCreateOrUpdateContent DeserializeCassandraTableCre } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraTableCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CassandraTableCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraTableCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraTableCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraTableCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraTableCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CassandraTableCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraTableCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraTableCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.cs index 18bc4802d0da..fb49cc640c08 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Cassandra table. public partial class CassandraTableCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CassandraTableCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Cassandra table. /// is null. @@ -26,7 +29,7 @@ public CassandraTableCreateOrUpdateContent(AzureLocation location, CassandraTabl Resource = resource; } - /// Initializes a new instance of CassandraTableCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CassandraTableCreateOrUpdateContent(AzureLocation location, CassandraTabl /// The standard JSON format of a Cassandra table. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CassandraTableCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraTableResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraTableCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraTableResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraTableCreateOrUpdateContent() + { } /// The standard JSON format of a Cassandra table. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableData.Serialization.cs index 50acc6db9cfd..6a1ac53afb5b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraTableData : IUtf8JsonSerializable + public partial class CassandraTableData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraTableData DeserializeCassandraTableData(JsonElement element) + internal static CassandraTableData DeserializeCassandraTableData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static CassandraTableData DeserializeCassandraTableData(JsonElement ele Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static CassandraTableData DeserializeCassandraTableData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraTableData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + CassandraTableData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraTableData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraTableData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraTableData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraTableData model) + { + if (model is null) + { + return null; } - return new CassandraTableData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraTableData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraTableData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs index 28a9a1533997..cfc5bf36fabb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CassandraTableListResult + internal partial class CassandraTableListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraTableListResult DeserializeCassandraTableListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraTableListResult DeserializeCassandraTableListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CassandraTableListResult DeserializeCassandraTableListResult(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraTableListResult(Optional.ToList(value)); + return new CassandraTableListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CassandraTableListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraTableListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraTableListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraTableListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraTableListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraTableListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraTableListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs index 56eda0daa931..871b284ed789 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Cassandra tables and their properties. internal partial class CassandraTableListResult { - /// Initializes a new instance of CassandraTableListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraTableListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraTableListResult. + /// Initializes a new instance of . /// List of Cassandra tables and their properties. - internal CassandraTableListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CassandraTableListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Cassandra tables and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.Serialization.cs index 255d28475678..5d2c84aad74c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraTablePropertiesConfig : IUtf8JsonSerializable + public partial class CassandraTablePropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraTablePropertiesConfig DeserializeCassandraTablePropertiesConfig(JsonElement element) + internal static CassandraTablePropertiesConfig DeserializeCassandraTablePropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CassandraTablePropertiesConfig DeserializeCassandraTableProperti autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraTablePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CassandraTablePropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraTablePropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraTablePropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraTablePropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraTablePropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraTablePropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new CassandraTablePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraTablePropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.cs index 0ea29c473497..bf86cd5ff988 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTablePropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraTablePropertiesConfig. public partial class CassandraTablePropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of CassandraTablePropertiesConfig. + /// Initializes a new instance of . public CassandraTablePropertiesConfig() { } - /// Initializes a new instance of CassandraTablePropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CassandraTablePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CassandraTablePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.Serialization.cs index 26312b58ce0c..ddd31b4994be 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraTableResourceInfo : IUtf8JsonSerializable + public partial class CassandraTableResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(TableName); @@ -25,18 +33,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Schema)) { writer.WritePropertyName("schema"u8); - writer.WriteObjectValue(Schema); + if (Schema is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schema).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { writer.WritePropertyName("analyticalStorageTtl"u8); writer.WriteNumberValue(AnalyticalStorageTtl.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraTableResourceInfo DeserializeCassandraTableResourceInfo(JsonElement element) + internal static CassandraTableResourceInfo DeserializeCassandraTableResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +74,7 @@ internal static CassandraTableResourceInfo DeserializeCassandraTableResourceInfo Optional defaultTtl = default; Optional schema = default; Optional analyticalStorageTtl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -79,8 +109,61 @@ internal static CassandraTableResourceInfo DeserializeCassandraTableResourceInfo analyticalStorageTtl = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraTableResourceInfo(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), serializedAdditionalRawData); + } + + CassandraTableResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraTableResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraTableResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraTableResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraTableResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraTableResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new CassandraTableResourceInfo(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraTableResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.cs index e65cd3e5698a..2c46e8c5311b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraTableResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB Cassandra table resource object. public partial class CassandraTableResourceInfo { - /// Initializes a new instance of CassandraTableResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table. /// is null. public CassandraTableResourceInfo(string tableName) @@ -23,17 +27,24 @@ public CassandraTableResourceInfo(string tableName) TableName = tableName; } - /// Initializes a new instance of CassandraTableResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table. /// Time to live of the Cosmos DB Cassandra table. /// Schema of the Cosmos DB Cassandra table. /// Analytical TTL. - internal CassandraTableResourceInfo(string tableName, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl) + /// Keeps track of any properties unknown to the library. + internal CassandraTableResourceInfo(string tableName, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl, Dictionary serializedAdditionalRawData) { TableName = tableName; DefaultTtl = defaultTtl; Schema = schema; AnalyticalStorageTtl = analyticalStorageTtl; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraTableResourceInfo() + { } /// Name of the Cosmos DB Cassandra table. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs index 7bb286949004..5c16855545ff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraViewGetPropertiesOptions : IUtf8JsonSerializable + public partial class CassandraViewGetPropertiesOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CassandraViewGetPropertiesOptions DeserializeCassandraViewGetPropertiesOptions(JsonElement element) + internal static CassandraViewGetPropertiesOptions DeserializeCassandraViewGetPropertiesOptions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CassandraViewGetPropertiesOptions DeserializeCassandraViewGetPro autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraViewGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CassandraViewGetPropertiesOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraViewGetPropertiesOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraViewGetPropertiesOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraViewGetPropertiesOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraViewGetPropertiesOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraViewGetPropertiesOptions(Response response) + { + if (response is null) + { + return null; } - return new CassandraViewGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraViewGetPropertiesOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs index 4e5806e92c01..d49591683fd6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesOptions.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CassandraViewGetPropertiesOptions. public partial class CassandraViewGetPropertiesOptions : CosmosDBBaseConfig { - /// Initializes a new instance of CassandraViewGetPropertiesOptions. + /// Initializes a new instance of . public CassandraViewGetPropertiesOptions() { } - /// Initializes a new instance of CassandraViewGetPropertiesOptions. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CassandraViewGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CassandraViewGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs index 894a75917545..520b435d8da7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraViewGetPropertiesResource : IUtf8JsonSerializable + public partial class CassandraViewGetPropertiesResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("viewDefinition"u8); writer.WriteStringValue(ViewDefinition); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraViewGetPropertiesResource DeserializeCassandraViewGetPropertiesResource(JsonElement element) + internal static CassandraViewGetPropertiesResource DeserializeCassandraViewGetPropertiesResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +55,7 @@ internal static CassandraViewGetPropertiesResource DeserializeCassandraViewGetPr Optional etag = default; string id = default; string viewDefinition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -69,8 +91,61 @@ internal static CassandraViewGetPropertiesResource DeserializeCassandraViewGetPr viewDefinition = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraViewGetPropertiesResource(id, viewDefinition, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + CassandraViewGetPropertiesResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraViewGetPropertiesResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraViewGetPropertiesResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraViewGetPropertiesResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraViewGetPropertiesResource model) + { + if (model is null) + { + return null; } - return new CassandraViewGetPropertiesResource(id, viewDefinition, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraViewGetPropertiesResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraViewGetPropertiesResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs index 627c47bac308..487a84e002af 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetPropertiesResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CassandraViewGetPropertiesResource. public partial class CassandraViewGetPropertiesResource : CassandraViewResource { - /// Initializes a new instance of CassandraViewGetPropertiesResource. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra view. /// View Definition of the Cosmos DB Cassandra view. /// or is null. @@ -24,23 +25,25 @@ public CassandraViewGetPropertiesResource(string id, string viewDefinition) : ba Argument.AssertNotNull(viewDefinition, nameof(viewDefinition)); } - /// Initializes a new instance of CassandraViewGetPropertiesResource. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra view. /// View Definition of the Cosmos DB Cassandra view. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - /// or is null. - internal CassandraViewGetPropertiesResource(string id, string viewDefinition, string rid, float? timestamp, ETag? etag) : base(id, viewDefinition) + /// Keeps track of any properties unknown to the library. + internal CassandraViewGetPropertiesResource(string id, string viewDefinition, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, viewDefinition, serializedAdditionalRawData) { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(viewDefinition, nameof(viewDefinition)); - Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal CassandraViewGetPropertiesResource() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.Serialization.cs index c637517992cf..935facc725d4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraViewGetResultCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CassandraViewGetResultCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraViewGetResultCreateOrUpdateContent DeserializeCassandraViewGetResultCreateOrUpdateContent(JsonElement element) + internal static CassandraViewGetResultCreateOrUpdateContent DeserializeCassandraViewGetResultCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CassandraViewGetResultCreateOrUpdateContent DeserializeCassandra Optional systemData = default; CassandraViewResource resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CassandraViewGetResultCreateOrUpdateContent DeserializeCassandra } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraViewGetResultCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CassandraViewGetResultCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraViewGetResultCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraViewGetResultCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraViewGetResultCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraViewGetResultCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CassandraViewGetResultCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraViewGetResultCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraViewGetResultCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.cs index d47b2934977d..a0c6aeedd22d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Cassandra view. public partial class CassandraViewGetResultCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CassandraViewGetResultCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Cassandra view. /// is null. @@ -26,7 +29,7 @@ public CassandraViewGetResultCreateOrUpdateContent(AzureLocation location, Cassa Resource = resource; } - /// Initializes a new instance of CassandraViewGetResultCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CassandraViewGetResultCreateOrUpdateContent(AzureLocation location, Cassa /// The standard JSON format of a Cassandra view. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CassandraViewGetResultCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraViewResource resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CassandraViewGetResultCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CassandraViewResource resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraViewGetResultCreateOrUpdateContent() + { } /// The standard JSON format of a Cassandra view. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultData.Serialization.cs index 26c5e2bcf0fe..2afe3b673742 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewGetResultData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraViewGetResultData : IUtf8JsonSerializable + public partial class CassandraViewGetResultData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraViewGetResultData DeserializeCassandraViewGetResultData(JsonElement element) + internal static CassandraViewGetResultData DeserializeCassandraViewGetResultData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static CassandraViewGetResultData DeserializeCassandraViewGetResultData Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static CassandraViewGetResultData DeserializeCassandraViewGetResultData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraViewGetResultData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + CassandraViewGetResultData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraViewGetResultData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraViewGetResultData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraViewGetResultData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraViewGetResultData model) + { + if (model is null) + { + return null; } - return new CassandraViewGetResultData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraViewGetResultData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraViewGetResultData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs index 60d6f9c05fda..21657a2fdfbd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CassandraViewListResult + internal partial class CassandraViewListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CassandraViewListResult DeserializeCassandraViewListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CassandraViewListResult DeserializeCassandraViewListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CassandraViewListResult DeserializeCassandraViewListResult(JsonE value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CassandraViewListResult(Optional.ToList(value)); + return new CassandraViewListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CassandraViewListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraViewListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraViewListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraViewListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraViewListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraViewListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraViewListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs index 09528f94f148..64f9495acaf5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Cassandra views and their properties. internal partial class CassandraViewListResult { - /// Initializes a new instance of CassandraViewListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CassandraViewListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CassandraViewListResult. + /// Initializes a new instance of . /// List of Cassandra views and their properties. - internal CassandraViewListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CassandraViewListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Cassandra views and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs index a252876efa2b..a1caacc603b3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CassandraViewResource : IUtf8JsonSerializable + public partial class CassandraViewResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); writer.WritePropertyName("viewDefinition"u8); writer.WriteStringValue(ViewDefinition); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CassandraViewResource DeserializeCassandraViewResource(JsonElement element) + internal static CassandraViewResource DeserializeCassandraViewResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; string viewDefinition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -42,8 +65,61 @@ internal static CassandraViewResource DeserializeCassandraViewResource(JsonEleme viewDefinition = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CassandraViewResource(id, viewDefinition, serializedAdditionalRawData); + } + + CassandraViewResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraViewResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraViewResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraViewResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraViewResource model) + { + if (model is null) + { + return null; } - return new CassandraViewResource(id, viewDefinition); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraViewResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraViewResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs index 696ebfd1a149..21ff302786d3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraViewResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB Cassandra view resource object. public partial class CassandraViewResource { - /// Initializes a new instance of CassandraViewResource. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra view. /// View Definition of the Cosmos DB Cassandra view. /// or is null. @@ -26,6 +30,22 @@ public CassandraViewResource(string id, string viewDefinition) ViewDefinition = viewDefinition; } + /// Initializes a new instance of . + /// Name of the Cosmos DB Cassandra view. + /// View Definition of the Cosmos DB Cassandra view. + /// Keeps track of any properties unknown to the library. + internal CassandraViewResource(string id, string viewDefinition, Dictionary serializedAdditionalRawData) + { + Id = id; + ViewDefinition = viewDefinition; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CassandraViewResource() + { + } + /// Name of the Cosmos DB Cassandra view. public string Id { get; set; } /// View Definition of the Cosmos DB Cassandra view. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.Serialization.cs index bc32d76703d1..a4461daec3e9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CheckCosmosDBNameAvailabilityContent : IUtf8JsonSerializable + public partial class CheckCosmosDBNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CheckCosmosDBNameAvailabilityContent DeserializeCheckCosmosDBNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CheckCosmosDBNameAvailabilityContent(name.Value, type.Value, serializedAdditionalRawData); + } + + CheckCosmosDBNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCheckCosmosDBNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CheckCosmosDBNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCheckCosmosDBNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CheckCosmosDBNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CheckCosmosDBNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCheckCosmosDBNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.cs index 0aef1e039e09..6f844443cb82 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The check availability request body. public partial class CheckCosmosDBNameAvailabilityContent { - /// Initializes a new instance of CheckCosmosDBNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CheckCosmosDBNameAvailabilityContent() { } + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal CheckCosmosDBNameAvailabilityContent(string name, string resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the resource for which availability needs to be checked. public string Name { get; set; } /// The resource type. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.Serialization.cs index d2568f41395c..e83a8f4e2e9f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CheckCosmosDBNameAvailabilityResponse + public partial class CheckCosmosDBNameAvailabilityResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CheckCosmosDBNameAvailabilityResponse DeserializeCheckCosmosDBNameAvailabilityResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(NameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CheckCosmosDBNameAvailabilityResponse DeserializeCheckCosmosDBNameAvailabilityResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static CheckCosmosDBNameAvailabilityResponse DeserializeCheckCosmosDBNa Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +90,61 @@ internal static CheckCosmosDBNameAvailabilityResponse DeserializeCheckCosmosDBNa message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CheckCosmosDBNameAvailabilityResponse(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new CheckCosmosDBNameAvailabilityResponse(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + CheckCosmosDBNameAvailabilityResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCheckCosmosDBNameAvailabilityResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CheckCosmosDBNameAvailabilityResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCheckCosmosDBNameAvailabilityResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CheckCosmosDBNameAvailabilityResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CheckCosmosDBNameAvailabilityResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCheckCosmosDBNameAvailabilityResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.cs index 56fe22c17478..dd0724294efd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CheckCosmosDBNameAvailabilityResponse.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The check availability result. public partial class CheckCosmosDBNameAvailabilityResponse { - /// Initializes a new instance of CheckCosmosDBNameAvailabilityResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CheckCosmosDBNameAvailabilityResponse() { } - /// Initializes a new instance of CheckCosmosDBNameAvailabilityResponse. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. - internal CheckCosmosDBNameAvailabilityResponse(bool? nameAvailable, CosmosDBNameUnavailableReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal CheckCosmosDBNameAvailabilityResponse(bool? nameAvailable, CosmosDBNameUnavailableReason? reason, string message, Dictionary serializedAdditionalRawData) { NameAvailable = nameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the resource name is available. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.Serialization.cs index 029405cf3762..a0687dc8cab4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class ClientEncryptionKeysListResult + internal partial class ClientEncryptionKeysListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ClientEncryptionKeysListResult DeserializeClientEncryptionKeysListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ClientEncryptionKeysListResult DeserializeClientEncryptionKeysListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static ClientEncryptionKeysListResult DeserializeClientEncryptionKeysLi value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ClientEncryptionKeysListResult(Optional.ToList(value)); + return new ClientEncryptionKeysListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ClientEncryptionKeysListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClientEncryptionKeysListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClientEncryptionKeysListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClientEncryptionKeysListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClientEncryptionKeysListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClientEncryptionKeysListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClientEncryptionKeysListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.cs index c58f9773fc0b..47335a43b265 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ClientEncryptionKeysListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the client encryption keys and their properties. internal partial class ClientEncryptionKeysListResult { - /// Initializes a new instance of ClientEncryptionKeysListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ClientEncryptionKeysListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ClientEncryptionKeysListResult. + /// Initializes a new instance of . /// List of client encryption keys and their properties. - internal ClientEncryptionKeysListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ClientEncryptionKeysListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of client encryption keys and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs index f1a40efca5b1..637a520c5db6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ConflictResolutionPolicy : IUtf8JsonSerializable + public partial class ConflictResolutionPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Mode)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("conflictResolutionProcedure"u8); writer.WriteStringValue(ConflictResolutionProcedure); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConflictResolutionPolicy DeserializeConflictResolutionPolicy(JsonElement element) + internal static ConflictResolutionPolicy DeserializeConflictResolutionPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ConflictResolutionPolicy DeserializeConflictResolutionPolicy(Jso Optional mode = default; Optional conflictResolutionPath = default; Optional conflictResolutionProcedure = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mode"u8)) @@ -63,8 +86,61 @@ internal static ConflictResolutionPolicy DeserializeConflictResolutionPolicy(Jso conflictResolutionProcedure = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConflictResolutionPolicy(Optional.ToNullable(mode), conflictResolutionPath.Value, conflictResolutionProcedure.Value, serializedAdditionalRawData); + } + + ConflictResolutionPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConflictResolutionPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConflictResolutionPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConflictResolutionPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConflictResolutionPolicy model) + { + if (model is null) + { + return null; } - return new ConflictResolutionPolicy(Optional.ToNullable(mode), conflictResolutionPath.Value, conflictResolutionProcedure.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConflictResolutionPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConflictResolutionPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs index b44c27321ab4..1b95c0c7c442 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConflictResolutionPolicy.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The conflict resolution policy for the container. public partial class ConflictResolutionPolicy { - /// Initializes a new instance of ConflictResolutionPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConflictResolutionPolicy() { } - /// Initializes a new instance of ConflictResolutionPolicy. + /// Initializes a new instance of . /// Indicates the conflict resolution mode. /// The conflict resolution path in the case of LastWriterWins mode. /// The procedure to resolve conflicts in the case of custom mode. - internal ConflictResolutionPolicy(ConflictResolutionMode? mode, string conflictResolutionPath, string conflictResolutionProcedure) + /// Keeps track of any properties unknown to the library. + internal ConflictResolutionPolicy(ConflictResolutionMode? mode, string conflictResolutionPath, string conflictResolutionProcedure, Dictionary serializedAdditionalRawData) { Mode = mode; ConflictResolutionPath = conflictResolutionPath; ConflictResolutionProcedure = conflictResolutionProcedure; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates the conflict resolution mode. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs index 2a3077c514fc..8de701e576c7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ConsistencyPolicy : IUtf8JsonSerializable + public partial class ConsistencyPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("defaultConsistencyLevel"u8); writer.WriteStringValue(DefaultConsistencyLevel.ToSerialString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxIntervalInSeconds"u8); writer.WriteNumberValue(MaxIntervalInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConsistencyPolicy DeserializeConsistencyPolicy(JsonElement element) + internal static ConsistencyPolicy DeserializeConsistencyPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ConsistencyPolicy DeserializeConsistencyPolicy(JsonElement eleme DefaultConsistencyLevel defaultConsistencyLevel = default; Optional maxStalenessPrefix = default; Optional maxIntervalInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defaultConsistencyLevel"u8)) @@ -64,8 +87,61 @@ internal static ConsistencyPolicy DeserializeConsistencyPolicy(JsonElement eleme maxIntervalInSeconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConsistencyPolicy(defaultConsistencyLevel, Optional.ToNullable(maxStalenessPrefix), Optional.ToNullable(maxIntervalInSeconds), serializedAdditionalRawData); + } + + ConsistencyPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConsistencyPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConsistencyPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConsistencyPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConsistencyPolicy model) + { + if (model is null) + { + return null; } - return new ConsistencyPolicy(defaultConsistencyLevel, Optional.ToNullable(maxStalenessPrefix), Optional.ToNullable(maxIntervalInSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConsistencyPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConsistencyPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs index 19c321460f78..a95bbe61315b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ConsistencyPolicy.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The consistency policy for the Cosmos DB database account. public partial class ConsistencyPolicy { - /// Initializes a new instance of ConsistencyPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The default consistency level and configuration settings of the Cosmos DB account. public ConsistencyPolicy(DefaultConsistencyLevel defaultConsistencyLevel) { DefaultConsistencyLevel = defaultConsistencyLevel; } - /// Initializes a new instance of ConsistencyPolicy. + /// Initializes a new instance of . /// The default consistency level and configuration settings of the Cosmos DB account. /// When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. /// When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. - internal ConsistencyPolicy(DefaultConsistencyLevel defaultConsistencyLevel, long? maxStalenessPrefix, int? maxIntervalInSeconds) + /// Keeps track of any properties unknown to the library. + internal ConsistencyPolicy(DefaultConsistencyLevel defaultConsistencyLevel, long? maxStalenessPrefix, int? maxIntervalInSeconds, Dictionary serializedAdditionalRawData) { DefaultConsistencyLevel = defaultConsistencyLevel; MaxStalenessPrefix = maxStalenessPrefix; MaxIntervalInSeconds = maxIntervalInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConsistencyPolicy() + { } /// The default consistency level and configuration settings of the Cosmos DB account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs index f392f41c4600..534872774663 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.Serialization.cs @@ -6,20 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class ContinuousBackupInformation + internal partial class ContinuousBackupInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContinuousBackupInformation DeserializeContinuousBackupInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(LatestRestorableTimestamp)) + { + writer.WritePropertyName("latestRestorableTimestamp"u8); + writer.WriteStringValue(LatestRestorableTimestamp.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContinuousBackupInformation DeserializeContinuousBackupInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional latestRestorableTimestamp = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("latestRestorableTimestamp"u8)) @@ -31,8 +64,61 @@ internal static ContinuousBackupInformation DeserializeContinuousBackupInformati latestRestorableTimestamp = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContinuousBackupInformation(Optional.ToNullable(latestRestorableTimestamp)); + return new ContinuousBackupInformation(Optional.ToNullable(latestRestorableTimestamp), serializedAdditionalRawData); + } + + ContinuousBackupInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousBackupInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousBackupInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousBackupInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousBackupInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousBackupInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousBackupInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs index 66911bdac7ad..94d9ca35ec9a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupInformation.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Information about the status of continuous backups. internal partial class ContinuousBackupInformation { - /// Initializes a new instance of ContinuousBackupInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContinuousBackupInformation() { } - /// Initializes a new instance of ContinuousBackupInformation. + /// Initializes a new instance of . /// The latest restorable timestamp for a resource. - internal ContinuousBackupInformation(DateTimeOffset? latestRestorableTimestamp) + /// Keeps track of any properties unknown to the library. + internal ContinuousBackupInformation(DateTimeOffset? latestRestorableTimestamp, Dictionary serializedAdditionalRawData) { LatestRestorableTimestamp = latestRestorableTimestamp; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The latest restorable timestamp for a resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs index 499006ebf3d8..b4188ed448a5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ContinuousBackupRestoreLocation : IUtf8JsonSerializable + public partial class ContinuousBackupRestoreLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); writer.WriteStringValue(Location.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ContinuousBackupRestoreLocation DeserializeContinuousBackupRestoreLocation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContinuousBackupRestoreLocation(Optional.ToNullable(location), serializedAdditionalRawData); + } + + ContinuousBackupRestoreLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousBackupRestoreLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousBackupRestoreLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousBackupRestoreLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousBackupRestoreLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousBackupRestoreLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousBackupRestoreLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs index d2a0d32d7b61..3e8cc19511fd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousBackupRestoreLocation.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,11 +14,23 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties of the regional restorable account. public partial class ContinuousBackupRestoreLocation { - /// Initializes a new instance of ContinuousBackupRestoreLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContinuousBackupRestoreLocation() { } + /// Initializes a new instance of . + /// The name of the continuous backup restore location. + /// Keeps track of any properties unknown to the library. + internal ContinuousBackupRestoreLocation(AzureLocation? location, Dictionary serializedAdditionalRawData) + { + Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the continuous backup restore location. public AzureLocation? Location { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs index 04378494c900..b287a9f59895 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.Serialization.cs @@ -5,33 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ContinuousModeBackupPolicy : IUtf8JsonSerializable + public partial class ContinuousModeBackupPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContinuousModeProperties)) { writer.WritePropertyName("continuousModeProperties"u8); - writer.WriteObjectValue(ContinuousModeProperties); + if (ContinuousModeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContinuousModeProperties).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(BackupPolicyType.ToString()); if (Optional.IsDefined(MigrationState)) { writer.WritePropertyName("migrationState"u8); - writer.WriteObjectValue(MigrationState); + if (MigrationState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MigrationState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ContinuousModeBackupPolicy DeserializeContinuousModeBackupPolicy(JsonElement element) + internal static ContinuousModeBackupPolicy DeserializeContinuousModeBackupPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +75,7 @@ internal static ContinuousModeBackupPolicy DeserializeContinuousModeBackupPolicy Optional continuousModeProperties = default; BackupPolicyType type = default; Optional migrationState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("continuousModeProperties"u8)) @@ -64,8 +101,61 @@ internal static ContinuousModeBackupPolicy DeserializeContinuousModeBackupPolicy migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContinuousModeBackupPolicy(type, migrationState.Value, continuousModeProperties.Value, serializedAdditionalRawData); + } + + ContinuousModeBackupPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousModeBackupPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousModeBackupPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousModeBackupPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousModeBackupPolicy model) + { + if (model is null) + { + return null; } - return new ContinuousModeBackupPolicy(type, migrationState.Value, continuousModeProperties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousModeBackupPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousModeBackupPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs index bd208879c709..53d71243a7a1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeBackupPolicy.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The object representing continuous mode backup policy. public partial class ContinuousModeBackupPolicy : CosmosDBAccountBackupPolicy { - /// Initializes a new instance of ContinuousModeBackupPolicy. + /// Initializes a new instance of . public ContinuousModeBackupPolicy() { BackupPolicyType = BackupPolicyType.Continuous; } - /// Initializes a new instance of ContinuousModeBackupPolicy. + /// Initializes a new instance of . /// Describes the mode of backups. /// The object representing the state of the migration between the backup policies. /// Configuration values for continuous mode backup. - internal ContinuousModeBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState, ContinuousModeProperties continuousModeProperties) : base(backupPolicyType, migrationState) + /// Keeps track of any properties unknown to the library. + internal ContinuousModeBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState, ContinuousModeProperties continuousModeProperties, Dictionary serializedAdditionalRawData) : base(backupPolicyType, migrationState, serializedAdditionalRawData) { ContinuousModeProperties = continuousModeProperties; BackupPolicyType = backupPolicyType; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.Serialization.cs index 9f8ef3140c9a..ec2ef62043ac 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class ContinuousModeProperties : IUtf8JsonSerializable + internal partial class ContinuousModeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Tier)) { writer.WritePropertyName("tier"u8); writer.WriteStringValue(Tier.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContinuousModeProperties DeserializeContinuousModeProperties(JsonElement element) + internal static ContinuousModeProperties DeserializeContinuousModeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tier"u8)) @@ -41,8 +64,61 @@ internal static ContinuousModeProperties DeserializeContinuousModeProperties(Jso tier = new ContinuousTier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContinuousModeProperties(Optional.ToNullable(tier), serializedAdditionalRawData); + } + + ContinuousModeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContinuousModeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContinuousModeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContinuousModeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContinuousModeProperties model) + { + if (model is null) + { + return null; } - return new ContinuousModeProperties(Optional.ToNullable(tier)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContinuousModeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContinuousModeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.cs index 4fcdcee386c7..6a9eb84b43a0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ContinuousModeProperties.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Configuration values for periodic mode backup. internal partial class ContinuousModeProperties { - /// Initializes a new instance of ContinuousModeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ContinuousModeProperties() { } - /// Initializes a new instance of ContinuousModeProperties. + /// Initializes a new instance of . /// Enum to indicate type of Continuos backup mode. - internal ContinuousModeProperties(ContinuousTier? tier) + /// Keeps track of any properties unknown to the library. + internal ContinuousModeProperties(ContinuousTier? tier, Dictionary serializedAdditionalRawData) { Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Enum to indicate type of Continuos backup mode. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs index bbcb69a41a87..12d769d30696 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosCassandraDataTransferDataSourceSink : IUtf8JsonSerializable + public partial class CosmosCassandraDataTransferDataSourceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyspaceName"u8); writer.WriteStringValue(KeyspaceName); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(TableName); writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassandraDataTransferDataSourceSink(JsonElement element) + internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassandraDataTransferDataSourceSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassa string keyspaceName = default; string tableName = default; DataTransferComponent component = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyspaceName"u8)) @@ -50,8 +73,61 @@ internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassa component = new DataTransferComponent(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosCassandraDataTransferDataSourceSink(component, keyspaceName, tableName, serializedAdditionalRawData); + } + + CosmosCassandraDataTransferDataSourceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosCassandraDataTransferDataSourceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosCassandraDataTransferDataSourceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosCassandraDataTransferDataSourceSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosCassandraDataTransferDataSourceSink model) + { + if (model is null) + { + return null; } - return new CosmosCassandraDataTransferDataSourceSink(component, keyspaceName, tableName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosCassandraDataTransferDataSourceSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosCassandraDataTransferDataSourceSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs index d9eec6cc215b..e94816817d48 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A CosmosDB Cassandra API data source/sink. public partial class CosmosCassandraDataTransferDataSourceSink : DataTransferDataSourceSink { - /// Initializes a new instance of CosmosCassandraDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// or is null. @@ -27,17 +28,23 @@ public CosmosCassandraDataTransferDataSourceSink(string keyspaceName, string tab Component = DataTransferComponent.CosmosDBCassandra; } - /// Initializes a new instance of CosmosCassandraDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// - internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent component, string keyspaceName, string tableName) : base(component) + /// Keeps track of any properties unknown to the library. + internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent component, string keyspaceName, string tableName, Dictionary serializedAdditionalRawData) : base(component, serializedAdditionalRawData) { KeyspaceName = keyspaceName; TableName = tableName; Component = component; } + /// Initializes a new instance of for deserialization. + internal CosmosCassandraDataTransferDataSourceSink() + { + } + /// Gets or sets the keyspace name. public string KeyspaceName { get; set; } /// Gets or sets the table name. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.Serialization.cs index 4452f5520fe1..d5e2faabaf98 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountBackupPolicy : IUtf8JsonSerializable + public partial class CosmosDBAccountBackupPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(BackupPolicyType.ToString()); if (Optional.IsDefined(MigrationState)) { writer.WritePropertyName("migrationState"u8); - writer.WriteObjectValue(MigrationState); + if (MigrationState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MigrationState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBAccountBackupPolicy DeserializeCosmosDBAccountBackupPolicy(JsonElement element) + internal static CosmosDBAccountBackupPolicy DeserializeCosmosDBAccountBackupPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,7 +68,82 @@ internal static CosmosDBAccountBackupPolicy DeserializeCosmosDBAccountBackupPoli case "Periodic": return PeriodicModeBackupPolicy.DeserializePeriodicModeBackupPolicy(element); } } - return UnknownBackupPolicy.DeserializeUnknownBackupPolicy(element); + + // Unknown type found so we will deserialize the base properties only + BackupPolicyType type = default; + Optional migrationState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new BackupPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownBackupPolicy(type, migrationState.Value, serializedAdditionalRawData); + } + + CosmosDBAccountBackupPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountBackupPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountBackupPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountBackupPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountBackupPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountBackupPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountBackupPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.cs index a45f0be35e8b..a519d1e045c3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountBackupPolicy.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.CosmosDB.Models { /// @@ -12,20 +16,26 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownBackupPolicy))] public abstract partial class CosmosDBAccountBackupPolicy { - /// Initializes a new instance of CosmosDBAccountBackupPolicy. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected CosmosDBAccountBackupPolicy() { } - /// Initializes a new instance of CosmosDBAccountBackupPolicy. + /// Initializes a new instance of . /// Describes the mode of backups. /// The object representing the state of the migration between the backup policies. - internal CosmosDBAccountBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState, Dictionary serializedAdditionalRawData) { BackupPolicyType = backupPolicyType; MigrationState = migrationState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describes the mode of backups. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.Serialization.cs index 30cb128a3992..071a16c4b848 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountCapability : IUtf8JsonSerializable + public partial class CosmosDBAccountCapability : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountCapability DeserializeCosmosDBAccountCapability(JsonElement element) + internal static CosmosDBAccountCapability DeserializeCosmosDBAccountCapability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static CosmosDBAccountCapability DeserializeCosmosDBAccountCapability(J name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountCapability(name.Value, serializedAdditionalRawData); + } + + CosmosDBAccountCapability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountCapability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountCapability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountCapability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountCapability model) + { + if (model is null) + { + return null; } - return new CosmosDBAccountCapability(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountCapability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountCapability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.cs index c08e54b371f4..fde359b41068 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapability.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB capability object. public partial class CosmosDBAccountCapability { - /// Initializes a new instance of CosmosDBAccountCapability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBAccountCapability() { } - /// Initializes a new instance of CosmosDBAccountCapability. + /// Initializes a new instance of . /// Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - internal CosmosDBAccountCapability(string name) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountCapability(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.Serialization.cs index 4fa844c91552..7c90bdcce31d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBAccountCapacity : IUtf8JsonSerializable + internal partial class CosmosDBAccountCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TotalThroughputLimit)) { writer.WritePropertyName("totalThroughputLimit"u8); writer.WriteNumberValue(TotalThroughputLimit.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountCapacity DeserializeCosmosDBAccountCapacity(JsonElement element) + internal static CosmosDBAccountCapacity DeserializeCosmosDBAccountCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional totalThroughputLimit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("totalThroughputLimit"u8)) @@ -41,8 +64,61 @@ internal static CosmosDBAccountCapacity DeserializeCosmosDBAccountCapacity(JsonE totalThroughputLimit = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountCapacity(Optional.ToNullable(totalThroughputLimit), serializedAdditionalRawData); + } + + CosmosDBAccountCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountCapacity model) + { + if (model is null) + { + return null; } - return new CosmosDBAccountCapacity(Optional.ToNullable(totalThroughputLimit)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.cs index 88b567c6cec9..fe221050af25 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCapacity.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The object that represents all properties related to capacity enforcement on an account. internal partial class CosmosDBAccountCapacity { - /// Initializes a new instance of CosmosDBAccountCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBAccountCapacity() { } - /// Initializes a new instance of CosmosDBAccountCapacity. + /// Initializes a new instance of . /// The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of throughput. - internal CosmosDBAccountCapacity(int? totalThroughputLimit) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountCapacity(int? totalThroughputLimit, Dictionary serializedAdditionalRawData) { TotalThroughputLimit = totalThroughputLimit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of throughput. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.Serialization.cs index 0bf12446be27..a7732429073b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountConnectionString + public partial class CosmosDBAccountConnectionString : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBAccountConnectionString DeserializeCosmosDBAccountConnectionString(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBAccountConnectionString DeserializeCosmosDBAccountConnectionString(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static CosmosDBAccountConnectionString DeserializeCosmosDBAccountConnec Optional description = default; Optional keyKind = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionString"u8)) @@ -52,8 +81,61 @@ internal static CosmosDBAccountConnectionString DeserializeCosmosDBAccountConnec type = new CosmosDBType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBAccountConnectionString(connectionString.Value, description.Value, Optional.ToNullable(keyKind), Optional.ToNullable(type)); + return new CosmosDBAccountConnectionString(connectionString.Value, description.Value, Optional.ToNullable(keyKind), Optional.ToNullable(type), serializedAdditionalRawData); + } + + CosmosDBAccountConnectionString IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountConnectionString(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountConnectionString IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountConnectionString(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountConnectionString model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountConnectionString(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountConnectionString(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.cs index 8b2136134f3f..6f0d12a20169 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountConnectionString.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Connection string for the Cosmos DB account. public partial class CosmosDBAccountConnectionString { - /// Initializes a new instance of CosmosDBAccountConnectionString. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBAccountConnectionString() { } - /// Initializes a new instance of CosmosDBAccountConnectionString. + /// Initializes a new instance of . /// Value of the connection string. /// Description of the connection string. /// Kind of the connection string key. /// Type of the connection string. - internal CosmosDBAccountConnectionString(string connectionString, string description, CosmosDBKind? keyKind, CosmosDBType? keyType) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountConnectionString(string connectionString, string description, CosmosDBKind? keyKind, CosmosDBType? keyType, Dictionary serializedAdditionalRawData) { ConnectionString = connectionString; Description = description; KeyKind = keyKind; KeyType = keyType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value of the connection string. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.Serialization.cs index 1dee429e43ee..3c5379b7c7dc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountCorsPolicy : IUtf8JsonSerializable + public partial class CosmosDBAccountCorsPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("allowedOrigins"u8); writer.WriteStringValue(AllowedOrigins); @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxAgeInSeconds"u8); writer.WriteNumberValue(MaxAgeInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountCorsPolicy DeserializeCosmosDBAccountCorsPolicy(JsonElement element) + internal static CosmosDBAccountCorsPolicy DeserializeCosmosDBAccountCorsPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static CosmosDBAccountCorsPolicy DeserializeCosmosDBAccountCorsPolicy(J Optional allowedHeaders = default; Optional exposedHeaders = default; Optional maxAgeInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("allowedOrigins"u8)) @@ -82,8 +105,61 @@ internal static CosmosDBAccountCorsPolicy DeserializeCosmosDBAccountCorsPolicy(J maxAgeInSeconds = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountCorsPolicy(allowedOrigins, allowedMethods.Value, allowedHeaders.Value, exposedHeaders.Value, Optional.ToNullable(maxAgeInSeconds), serializedAdditionalRawData); + } + + CosmosDBAccountCorsPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountCorsPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountCorsPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountCorsPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountCorsPolicy model) + { + if (model is null) + { + return null; } - return new CosmosDBAccountCorsPolicy(allowedOrigins, allowedMethods.Value, allowedHeaders.Value, exposedHeaders.Value, Optional.ToNullable(maxAgeInSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountCorsPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountCorsPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.cs index 2c22c91db514..996de2fbfbfc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCorsPolicy.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CORS policy for the Cosmos DB database account. public partial class CosmosDBAccountCorsPolicy { - /// Initializes a new instance of CosmosDBAccountCorsPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The origin domains that are permitted to make a request against the service via CORS. /// is null. public CosmosDBAccountCorsPolicy(string allowedOrigins) @@ -23,19 +27,26 @@ public CosmosDBAccountCorsPolicy(string allowedOrigins) AllowedOrigins = allowedOrigins; } - /// Initializes a new instance of CosmosDBAccountCorsPolicy. + /// Initializes a new instance of . /// The origin domains that are permitted to make a request against the service via CORS. /// The methods (HTTP request verbs) that the origin domain may use for a CORS request. /// The request headers that the origin domain may specify on the CORS request. /// The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. /// The maximum amount time that a browser should cache the preflight OPTIONS request. - internal CosmosDBAccountCorsPolicy(string allowedOrigins, string allowedMethods, string allowedHeaders, string exposedHeaders, long? maxAgeInSeconds) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountCorsPolicy(string allowedOrigins, string allowedMethods, string allowedHeaders, string exposedHeaders, long? maxAgeInSeconds, Dictionary serializedAdditionalRawData) { AllowedOrigins = allowedOrigins; AllowedMethods = allowedMethods; AllowedHeaders = allowedHeaders; ExposedHeaders = exposedHeaders; MaxAgeInSeconds = maxAgeInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBAccountCorsPolicy() + { } /// The origin domains that are permitted to make a request against the service via CORS. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs index 952ffdab53a7..213c208fe4e6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBAccountCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -47,13 +53,27 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConsistencyPolicy)) { writer.WritePropertyName("consistencyPolicy"u8); - writer.WriteObjectValue(ConsistencyPolicy); + if (ConsistencyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConsistencyPolicy).Serialize(writer, options); + } } writer.WritePropertyName("locations"u8); writer.WriteStartArray(); foreach (var item in Locations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("databaseAccountOfferType"u8); @@ -64,7 +84,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -84,7 +111,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Capabilities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -94,7 +128,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualNetworkRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -141,7 +182,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiProperties)) { writer.WritePropertyName("apiProperties"u8); - writer.WriteObjectValue(ApiProperties); + if (ApiProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiProperties).Serialize(writer, options); + } } if (Optional.IsDefined(IsAnalyticalStorageEnabled)) { @@ -151,7 +199,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AnalyticalStorageConfiguration)) { writer.WritePropertyName("analyticalStorageConfiguration"u8); - writer.WriteObjectValue(AnalyticalStorageConfiguration); + if (AnalyticalStorageConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnalyticalStorageConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { @@ -161,7 +216,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BackupPolicy)) { writer.WritePropertyName("backupPolicy"u8); - writer.WriteObjectValue(BackupPolicy); + if (BackupPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BackupPolicy).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Cors)) { @@ -169,7 +231,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Cors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -196,7 +265,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiagnosticLogSettings)) { writer.WritePropertyName("diagnosticLogSettings"u8); - writer.WriteObjectValue(DiagnosticLogSettings); + if (DiagnosticLogSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticLogSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DisableLocalAuth)) { @@ -206,12 +282,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(Capacity)) { writer.WritePropertyName("capacity"u8); - writer.WriteObjectValue(Capacity); + if (Capacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capacity).Serialize(writer, options); + } } if (Optional.IsDefined(EnableMaterializedViews)) { @@ -234,11 +324,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountCreateOrUpdateContent(JsonElement element) + internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -284,6 +388,7 @@ internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountC Optional enablePartitionMerge = default; Optional enableBurstCapacity = default; Optional minimalTlsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -682,8 +787,61 @@ internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountC } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity, serializedAdditionalRawData); + } + + CosmosDBAccountCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBAccountCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs index cbd4b75abefb..619e9c48e00d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB database accounts. public partial class CosmosDBAccountCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBAccountCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// An array that contains the georeplication locations enabled for the Cosmos DB account. /// is null. @@ -33,7 +36,7 @@ public CosmosDBAccountCreateOrUpdateContent(AzureLocation location, IEnumerable< NetworkAclBypassResourceIds = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBAccountCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -79,7 +82,8 @@ public CosmosDBAccountCreateOrUpdateContent(AzureLocation location, IEnumerable< /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. /// Identity for the resource. - internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, CosmosDBAccountOfferType databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountCreateMode? createMode, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, CosmosDBAccountOfferType databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountCreateMode? createMode, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ConsistencyPolicy = consistencyPolicy; @@ -116,6 +120,12 @@ internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name EnableBurstCapacity = enableBurstCapacity; MinimalTlsVersion = minimalTlsVersion; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBAccountCreateOrUpdateContent() + { } /// Indicates the type of database account. This can only be set at database account creation. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs index f47aaff16686..c4a739ee575c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBAccountData : IUtf8JsonSerializable + public partial class CosmosDBAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -51,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -68,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConsistencyPolicy)) { writer.WritePropertyName("consistencyPolicy"u8); - writer.WriteObjectValue(ConsistencyPolicy); + if (ConsistencyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConsistencyPolicy).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Capabilities)) { @@ -76,7 +96,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Capabilities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -86,7 +113,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualNetworkRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -133,7 +167,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiProperties)) { writer.WritePropertyName("apiProperties"u8); - writer.WriteObjectValue(ApiProperties); + if (ApiProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiProperties).Serialize(writer, options); + } } if (Optional.IsDefined(IsAnalyticalStorageEnabled)) { @@ -143,7 +184,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AnalyticalStorageConfiguration)) { writer.WritePropertyName("analyticalStorageConfiguration"u8); - writer.WriteObjectValue(AnalyticalStorageConfiguration); + if (AnalyticalStorageConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnalyticalStorageConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { @@ -153,12 +201,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(BackupPolicy)) { writer.WritePropertyName("backupPolicy"u8); - writer.WriteObjectValue(BackupPolicy); + if (BackupPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BackupPolicy).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Cors)) { @@ -166,7 +228,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Cors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -193,7 +262,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiagnosticLogSettings)) { writer.WritePropertyName("diagnosticLogSettings"u8); - writer.WriteObjectValue(DiagnosticLogSettings); + if (DiagnosticLogSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticLogSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DisableLocalAuth)) { @@ -203,7 +279,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Capacity)) { writer.WritePropertyName("capacity"u8); - writer.WriteObjectValue(Capacity); + if (Capacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capacity).Serialize(writer, options); + } } if (Optional.IsDefined(EnableMaterializedViews)) { @@ -226,11 +309,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement element) + internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -283,6 +380,7 @@ internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement e Optional enablePartitionMerge = default; Optional enableBurstCapacity = default; Optional minimalTlsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -764,8 +862,61 @@ internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, Optional.ToNullable(databaseAccountOfferType), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(instanceId), Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity, serializedAdditionalRawData); + } + + CosmosDBAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, Optional.ToNullable(databaseAccountOfferType), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(instanceId), Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.Serialization.cs index 8f87458b1a84..b42e24541afc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountKeyList + public partial class CosmosDBAccountKeyList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBAccountKeyList DeserializeCosmosDBAccountKeyList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBAccountKeyList DeserializeCosmosDBAccountKeyList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static CosmosDBAccountKeyList DeserializeCosmosDBAccountKeyList(JsonEle Optional secondaryMasterKey = default; Optional primaryReadonlyMasterKey = default; Optional secondaryReadonlyMasterKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryMasterKey"u8)) @@ -44,8 +73,61 @@ internal static CosmosDBAccountKeyList DeserializeCosmosDBAccountKeyList(JsonEle secondaryReadonlyMasterKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBAccountKeyList(primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value, primaryMasterKey.Value, secondaryMasterKey.Value); + return new CosmosDBAccountKeyList(primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value, primaryMasterKey.Value, secondaryMasterKey.Value, serializedAdditionalRawData); + } + + CosmosDBAccountKeyList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountKeyList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountKeyList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountKeyList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountKeyList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountKeyList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountKeyList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.cs index 59d3df9e051c..cae14e9a2636 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountKeyList.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The access keys for the given database account. public partial class CosmosDBAccountKeyList : CosmosDBAccountReadOnlyKeyList { - /// Initializes a new instance of CosmosDBAccountKeyList. + /// Initializes a new instance of . internal CosmosDBAccountKeyList() { } - /// Initializes a new instance of CosmosDBAccountKeyList. + /// Initializes a new instance of . /// Base 64 encoded value of the primary read-only key. /// Base 64 encoded value of the secondary read-only key. /// Base 64 encoded value of the primary read-write key. /// Base 64 encoded value of the secondary read-write key. - internal CosmosDBAccountKeyList(string primaryReadonlyMasterKey, string secondaryReadonlyMasterKey, string primaryMasterKey, string secondaryMasterKey) : base(primaryReadonlyMasterKey, secondaryReadonlyMasterKey) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountKeyList(string primaryReadonlyMasterKey, string secondaryReadonlyMasterKey, string primaryMasterKey, string secondaryMasterKey, Dictionary serializedAdditionalRawData) : base(primaryReadonlyMasterKey, secondaryReadonlyMasterKey, serializedAdditionalRawData) { PrimaryMasterKey = primaryMasterKey; SecondaryMasterKey = secondaryMasterKey; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.Serialization.cs index 8bb983d2ae02..d7798386ad00 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountLocation : IUtf8JsonSerializable + public partial class CosmosDBAccountLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LocationName)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isZoneRedundant"u8); writer.WriteBooleanValue(IsZoneRedundant.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountLocation DeserializeCosmosDBAccountLocation(JsonElement element) + internal static CosmosDBAccountLocation DeserializeCosmosDBAccountLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static CosmosDBAccountLocation DeserializeCosmosDBAccountLocation(JsonE Optional provisioningState = default; Optional failoverPriority = default; Optional isZoneRedundant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -89,8 +112,61 @@ internal static CosmosDBAccountLocation DeserializeCosmosDBAccountLocation(JsonE isZoneRedundant = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountLocation(id.Value, Optional.ToNullable(locationName), documentEndpoint.Value, provisioningState.Value, Optional.ToNullable(failoverPriority), Optional.ToNullable(isZoneRedundant), serializedAdditionalRawData); + } + + CosmosDBAccountLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountLocation model) + { + if (model is null) + { + return null; } - return new CosmosDBAccountLocation(id.Value, Optional.ToNullable(locationName), documentEndpoint.Value, provisioningState.Value, Optional.ToNullable(failoverPriority), Optional.ToNullable(isZoneRedundant)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.cs index 5a58bad1350c..85b2c4a18a83 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountLocation.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,19 +14,23 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A region in which the Azure Cosmos DB database account is deployed. public partial class CosmosDBAccountLocation { - /// Initializes a new instance of CosmosDBAccountLocation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBAccountLocation() { } - /// Initializes a new instance of CosmosDBAccountLocation. + /// Initializes a new instance of . /// The unique identifier of the region within the database account. Example: <accountName>-<locationName>. /// The name of the region. /// The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/. /// The status of the Cosmos DB account at the time the operation was called. The status can be one of following. 'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned. 'Succeeded' – the Cosmos DB account is active for use. 'Updating' – the Cosmos DB account is being updated. 'Deleting' – the Cosmos DB account is being deleted. 'Failed' – the Cosmos DB account failed creation. 'DeletionFailed' – the Cosmos DB account deletion failed. /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. /// Flag to indicate whether or not this region is an AvailabilityZone region. - internal CosmosDBAccountLocation(string id, AzureLocation? locationName, string documentEndpoint, string provisioningState, int? failoverPriority, bool? isZoneRedundant) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountLocation(string id, AzureLocation? locationName, string documentEndpoint, string provisioningState, int? failoverPriority, bool? isZoneRedundant, Dictionary serializedAdditionalRawData) { Id = id; LocationName = locationName; @@ -32,6 +38,7 @@ internal CosmosDBAccountLocation(string id, AzureLocation? locationName, string ProvisioningState = provisioningState; FailoverPriority = failoverPriority; IsZoneRedundant = isZoneRedundant; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique identifier of the region within the database account. Example: <accountName>-<locationName>. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs index d138e308f1fe..5812592b2da9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountPatch : IUtf8JsonSerializable + public partial class CosmosDBAccountPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -43,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConsistencyPolicy)) { writer.WritePropertyName("consistencyPolicy"u8); - writer.WriteObjectValue(ConsistencyPolicy); + if (ConsistencyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConsistencyPolicy).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Locations)) { @@ -51,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Locations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -61,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IPRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -81,7 +110,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Capabilities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -91,7 +127,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualNetworkRules) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -138,7 +181,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ApiProperties)) { writer.WritePropertyName("apiProperties"u8); - writer.WriteObjectValue(ApiProperties); + if (ApiProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ApiProperties).Serialize(writer, options); + } } if (Optional.IsDefined(IsAnalyticalStorageEnabled)) { @@ -148,12 +198,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AnalyticalStorageConfiguration)) { writer.WritePropertyName("analyticalStorageConfiguration"u8); - writer.WriteObjectValue(AnalyticalStorageConfiguration); + if (AnalyticalStorageConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AnalyticalStorageConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(BackupPolicy)) { writer.WritePropertyName("backupPolicy"u8); - writer.WriteObjectValue(BackupPolicy); + if (BackupPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BackupPolicy).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Cors)) { @@ -161,7 +225,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Cors) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -188,7 +259,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiagnosticLogSettings)) { writer.WritePropertyName("diagnosticLogSettings"u8); - writer.WriteObjectValue(DiagnosticLogSettings); + if (DiagnosticLogSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DiagnosticLogSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DisableLocalAuth)) { @@ -198,7 +276,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Capacity)) { writer.WritePropertyName("capacity"u8); - writer.WriteObjectValue(Capacity); + if (Capacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Capacity).Serialize(writer, options); + } } if (Optional.IsDefined(EnableMaterializedViews)) { @@ -221,7 +306,468 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBAccountPatch DeserializeCosmosDBAccountPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional location = default; + Optional identity = default; + Optional consistencyPolicy = default; + Optional> locations = default; + Optional> ipRules = default; + Optional isVirtualNetworkFilterEnabled = default; + Optional enableAutomaticFailover = default; + Optional> capabilities = default; + Optional> virtualNetworkRules = default; + Optional enableMultipleWriteLocations = default; + Optional enableCassandraConnector = default; + Optional connectorOffer = default; + Optional disableKeyBasedMetadataWriteAccess = default; + Optional keyVaultKeyUri = default; + Optional defaultIdentity = default; + Optional publicNetworkAccess = default; + Optional enableFreeTier = default; + Optional apiProperties = default; + Optional enableAnalyticalStorage = default; + Optional analyticalStorageConfiguration = default; + Optional backupPolicy = default; + Optional> cors = default; + Optional networkAclBypass = default; + Optional> networkAclBypassResourceIds = default; + Optional diagnosticLogSettings = default; + Optional disableLocalAuth = default; + Optional capacity = default; + Optional enableMaterializedViews = default; + Optional keysMetadata = default; + Optional enablePartitionMerge = default; + Optional enableBurstCapacity = default; + Optional minimalTlsVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("consistencyPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value); + continue; + } + if (property0.NameEquals("locations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CosmosDBAccountLocation.DeserializeCosmosDBAccountLocation(item)); + } + locations = array; + continue; + } + if (property0.NameEquals("ipRules"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CosmosDBIPAddressOrRange.DeserializeCosmosDBIPAddressOrRange(item)); + } + ipRules = array; + continue; + } + if (property0.NameEquals("isVirtualNetworkFilterEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isVirtualNetworkFilterEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableAutomaticFailover"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableAutomaticFailover = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("capabilities"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CosmosDBAccountCapability.DeserializeCosmosDBAccountCapability(item)); + } + capabilities = array; + continue; + } + if (property0.NameEquals("virtualNetworkRules"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CosmosDBVirtualNetworkRule.DeserializeCosmosDBVirtualNetworkRule(item)); + } + virtualNetworkRules = array; + continue; + } + if (property0.NameEquals("enableMultipleWriteLocations"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableMultipleWriteLocations = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableCassandraConnector"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableCassandraConnector = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("connectorOffer"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectorOffer = new ConnectorOffer(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("disableKeyBasedMetadataWriteAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("keyVaultKeyUri"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultKeyUri = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("defaultIdentity"u8)) + { + defaultIdentity = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new CosmosDBPublicNetworkAccess(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enableFreeTier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableFreeTier = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("apiProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiProperties = ApiProperties.DeserializeApiProperties(property0.Value); + continue; + } + if (property0.NameEquals("enableAnalyticalStorage"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableAnalyticalStorage = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("analyticalStorageConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analyticalStorageConfiguration = AnalyticalStorageConfiguration.DeserializeAnalyticalStorageConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("backupPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupPolicy = CosmosDBAccountBackupPolicy.DeserializeCosmosDBAccountBackupPolicy(property0.Value); + continue; + } + if (property0.NameEquals("cors"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CosmosDBAccountCorsPolicy.DeserializeCosmosDBAccountCorsPolicy(item)); + } + cors = array; + continue; + } + if (property0.NameEquals("networkAclBypass"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkAclBypass = property0.Value.GetString().ToNetworkAclBypass(); + continue; + } + if (property0.NameEquals("networkAclBypassResourceIds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new ResourceIdentifier(item.GetString())); + } + } + networkAclBypassResourceIds = array; + continue; + } + if (property0.NameEquals("diagnosticLogSettings"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diagnosticLogSettings = DiagnosticLogSettings.DeserializeDiagnosticLogSettings(property0.Value); + continue; + } + if (property0.NameEquals("disableLocalAuth"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableLocalAuth = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("capacity"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = CosmosDBAccountCapacity.DeserializeCosmosDBAccountCapacity(property0.Value); + continue; + } + if (property0.NameEquals("enableMaterializedViews"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableMaterializedViews = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("keysMetadata"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keysMetadata = DatabaseAccountKeysMetadata.DeserializeDatabaseAccountKeysMetadata(property0.Value); + continue; + } + if (property0.NameEquals("enablePartitionMerge"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePartitionMerge = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableBurstCapacity"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableBurstCapacity = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("minimalTlsVersion"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minimalTlsVersion = new CosmosDBMinimalTlsVersion(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountPatch(Optional.ToDictionary(tags), Optional.ToNullable(location), identity, consistencyPolicy.Value, Optional.ToList(locations), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), serializedAdditionalRawData); + } + + CosmosDBAccountPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs index 1f7fb92e0808..a9f6ea28d4e0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters for patching Azure Cosmos DB database account properties. public partial class CosmosDBAccountPatch { - /// Initializes a new instance of CosmosDBAccountPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBAccountPatch() { Tags = new ChangeTrackingDictionary(); @@ -27,6 +30,83 @@ public CosmosDBAccountPatch() NetworkAclBypassResourceIds = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + /// The location of the resource group to which the resource belongs. + /// Identity for the resource. + /// The consistency policy for the Cosmos DB account. + /// An array that contains the georeplication locations enabled for the Cosmos DB account. + /// List of IpRules. + /// Flag to indicate whether to enable/disable Virtual Network ACL rules. + /// Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + /// List of Cosmos DB capabilities for the account. + /// List of Virtual Network ACL rules configured for the Cosmos DB account. + /// Enables the account to write in multiple locations. + /// Enables the cassandra connector on the Cosmos DB C* account. + /// The cassandra connector offer type for the Cosmos DB database C* account. + /// Disable write operations on metadata resources (databases, containers, throughput) via account keys. + /// The URI of the key vault. + /// The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. + /// Whether requests from Public Network are allowed. + /// Flag to indicate whether Free Tier is enabled. + /// API specific properties. Currently, supported only for MongoDB API. + /// Flag to indicate whether to enable storage analytics. + /// Analytical storage specific properties. + /// + /// The object representing the policy for taking backups on an account. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The CORS policy for the Cosmos DB database account. + /// Indicates what services are allowed to bypass firewall checks. + /// An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. + /// The Object representing the different Diagnostic log settings for the Cosmos DB Account. + /// Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. + /// The object that represents all properties related to capacity enforcement on an account. + /// Flag to indicate whether to enable MaterializedViews on the Cosmos DB account. + /// This property is ignored during the update operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. + /// Flag to indicate enabling/disabling of Partition Merge feature on the account. + /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. + /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountPatch(IDictionary tags, AzureLocation? location, ManagedServiceIdentity identity, ConsistencyPolicy consistencyPolicy, IList locations, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Location = location; + Identity = identity; + ConsistencyPolicy = consistencyPolicy; + Locations = locations; + IPRules = ipRules; + IsVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + EnableAutomaticFailover = enableAutomaticFailover; + Capabilities = capabilities; + VirtualNetworkRules = virtualNetworkRules; + EnableMultipleWriteLocations = enableMultipleWriteLocations; + EnableCassandraConnector = enableCassandraConnector; + ConnectorOffer = connectorOffer; + DisableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + KeyVaultKeyUri = keyVaultKeyUri; + DefaultIdentity = defaultIdentity; + PublicNetworkAccess = publicNetworkAccess; + IsFreeTierEnabled = isFreeTierEnabled; + ApiProperties = apiProperties; + IsAnalyticalStorageEnabled = isAnalyticalStorageEnabled; + AnalyticalStorageConfiguration = analyticalStorageConfiguration; + BackupPolicy = backupPolicy; + Cors = cors; + NetworkAclBypass = networkAclBypass; + NetworkAclBypassResourceIds = networkAclBypassResourceIds; + DiagnosticLogSettings = diagnosticLogSettings; + DisableLocalAuth = disableLocalAuth; + Capacity = capacity; + EnableMaterializedViews = enableMaterializedViews; + KeysMetadata = keysMetadata; + EnablePartitionMerge = enablePartitionMerge; + EnableBurstCapacity = enableBurstCapacity; + MinimalTlsVersion = minimalTlsVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". public IDictionary Tags { get; } /// The location of the resource group to which the resource belongs. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.Serialization.cs index f212cf5e9fcf..a2aee341b56d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountReadOnlyKeyList + public partial class CosmosDBAccountReadOnlyKeyList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBAccountReadOnlyKeyList DeserializeCosmosDBAccountReadOnlyKeyList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBAccountReadOnlyKeyList DeserializeCosmosDBAccountReadOnlyKeyList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional primaryReadonlyMasterKey = default; Optional secondaryReadonlyMasterKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryReadonlyMasterKey"u8)) @@ -32,8 +61,61 @@ internal static CosmosDBAccountReadOnlyKeyList DeserializeCosmosDBAccountReadOnl secondaryReadonlyMasterKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBAccountReadOnlyKeyList(primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value); + return new CosmosDBAccountReadOnlyKeyList(primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value, serializedAdditionalRawData); + } + + CosmosDBAccountReadOnlyKeyList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountReadOnlyKeyList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountReadOnlyKeyList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountReadOnlyKeyList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountReadOnlyKeyList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountReadOnlyKeyList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountReadOnlyKeyList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.cs index f90712fa736c..afccee360749 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountReadOnlyKeyList.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The read-only access keys for the given database account. public partial class CosmosDBAccountReadOnlyKeyList { - /// Initializes a new instance of CosmosDBAccountReadOnlyKeyList. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBAccountReadOnlyKeyList() { } - /// Initializes a new instance of CosmosDBAccountReadOnlyKeyList. + /// Initializes a new instance of . /// Base 64 encoded value of the primary read-only key. /// Base 64 encoded value of the secondary read-only key. - internal CosmosDBAccountReadOnlyKeyList(string primaryReadonlyMasterKey, string secondaryReadonlyMasterKey) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountReadOnlyKeyList(string primaryReadonlyMasterKey, string secondaryReadonlyMasterKey, Dictionary serializedAdditionalRawData) { PrimaryReadonlyMasterKey = primaryReadonlyMasterKey; SecondaryReadonlyMasterKey = secondaryReadonlyMasterKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Base 64 encoded value of the primary read-only key. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.Serialization.cs index 8329d314f4d7..38f4fa84e73a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountRegenerateKeyContent : IUtf8JsonSerializable + public partial class CosmosDBAccountRegenerateKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyKind"u8); writer.WriteStringValue(KeyKind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBAccountRegenerateKeyContent DeserializeCosmosDBAccountRegenerateKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CosmosDBAccountKeyKind keyKind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyKind"u8)) + { + keyKind = new CosmosDBAccountKeyKind(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountRegenerateKeyContent(keyKind, serializedAdditionalRawData); + } + + CosmosDBAccountRegenerateKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountRegenerateKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountRegenerateKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountRegenerateKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountRegenerateKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountRegenerateKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountRegenerateKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.cs index 874a9bb7532c..5c17a4d1ab17 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRegenerateKeyContent.cs @@ -5,18 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Parameters to regenerate the keys within the database account. public partial class CosmosDBAccountRegenerateKeyContent { - /// Initializes a new instance of CosmosDBAccountRegenerateKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The access key to regenerate. public CosmosDBAccountRegenerateKeyContent(CosmosDBAccountKeyKind keyKind) { KeyKind = keyKind; } + /// Initializes a new instance of . + /// The access key to regenerate. + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountRegenerateKeyContent(CosmosDBAccountKeyKind keyKind, Dictionary serializedAdditionalRawData) + { + KeyKind = keyKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBAccountRegenerateKeyContent() + { + } + /// The access key to regenerate. public CosmosDBAccountKeyKind KeyKind { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.Serialization.cs index 3ac6bccffc7e..32b9c82b7131 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBAccountRestoreParameters : IUtf8JsonSerializable + public partial class CosmosDBAccountRestoreParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RestoreMode)) { @@ -28,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DatabasesToRestore) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -38,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in GremlinDatabasesToRestore) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -67,11 +87,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("restoreTimestampInUtc"u8); writer.WriteStringValue(RestoreTimestampInUtc.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBAccountRestoreParameters DeserializeCosmosDBAccountRestoreParameters(JsonElement element) + internal static CosmosDBAccountRestoreParameters DeserializeCosmosDBAccountRestoreParameters(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,6 +117,7 @@ internal static CosmosDBAccountRestoreParameters DeserializeCosmosDBAccountResto Optional sourceBackupLocation = default; Optional restoreSource = default; Optional restoreTimestampInUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("restoreMode"u8)) @@ -155,8 +190,61 @@ internal static CosmosDBAccountRestoreParameters DeserializeCosmosDBAccountResto restoreTimestampInUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBAccountRestoreParameters(restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc), Optional.ToNullable(restoreMode), Optional.ToList(databasesToRestore), Optional.ToList(gremlinDatabasesToRestore), Optional.ToList(tablesToRestore), sourceBackupLocation.Value, serializedAdditionalRawData); + } + + CosmosDBAccountRestoreParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBAccountRestoreParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountRestoreParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountRestoreParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBAccountRestoreParameters model) + { + if (model is null) + { + return null; } - return new CosmosDBAccountRestoreParameters(restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc), Optional.ToNullable(restoreMode), Optional.ToList(databasesToRestore), Optional.ToList(gremlinDatabasesToRestore), Optional.ToList(tablesToRestore), sourceBackupLocation.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBAccountRestoreParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBAccountRestoreParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.cs index 74eb38df4b0a..6ff5190a2c74 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountRestoreParameters.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to indicate the information about the restore. public partial class CosmosDBAccountRestoreParameters : RestoreParametersBase { - /// Initializes a new instance of CosmosDBAccountRestoreParameters. + /// Initializes a new instance of . public CosmosDBAccountRestoreParameters() { DatabasesToRestore = new ChangeTrackingList(); @@ -22,7 +22,7 @@ public CosmosDBAccountRestoreParameters() TablesToRestore = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBAccountRestoreParameters. + /// Initializes a new instance of . /// The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. /// Time to which the account has to be restored (ISO-8601 format). /// Describes the mode of the restore. @@ -30,7 +30,8 @@ public CosmosDBAccountRestoreParameters() /// List of specific gremlin databases available for restore. /// List of specific tables available for restore. /// The source backup location for restore. - internal CosmosDBAccountRestoreParameters(string restoreSource, DateTimeOffset? restoreTimestampInUtc, CosmosDBAccountRestoreMode? restoreMode, IList databasesToRestore, IList gremlinDatabasesToRestore, IList tablesToRestore, string sourceBackupLocation) : base(restoreSource, restoreTimestampInUtc) + /// Keeps track of any properties unknown to the library. + internal CosmosDBAccountRestoreParameters(string restoreSource, DateTimeOffset? restoreTimestampInUtc, CosmosDBAccountRestoreMode? restoreMode, IList databasesToRestore, IList gremlinDatabasesToRestore, IList tablesToRestore, string sourceBackupLocation, Dictionary serializedAdditionalRawData) : base(restoreSource, restoreTimestampInUtc, serializedAdditionalRawData) { RestoreMode = restoreMode; DatabasesToRestore = databasesToRestore; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.Serialization.cs index 073a3cb53b08..7686be6eb0ff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBBackupInformation + public partial class CosmosDBBackupInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBBackupInformation DeserializeCosmosDBBackupInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBBackupInformation DeserializeCosmosDBBackupInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional continuousBackupInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("continuousBackupInformation"u8)) @@ -30,8 +59,61 @@ internal static CosmosDBBackupInformation DeserializeCosmosDBBackupInformation(J continuousBackupInformation = ContinuousBackupInformation.DeserializeContinuousBackupInformation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBBackupInformation(continuousBackupInformation.Value); + return new CosmosDBBackupInformation(continuousBackupInformation.Value, serializedAdditionalRawData); + } + + CosmosDBBackupInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBBackupInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBBackupInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBBackupInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBBackupInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBBackupInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBBackupInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.cs index e95b34cbe666..ded384c2cbd8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBackupInformation.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Backup information of a resource. public partial class CosmosDBBackupInformation { - /// Initializes a new instance of CosmosDBBackupInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBBackupInformation() { } - /// Initializes a new instance of CosmosDBBackupInformation. + /// Initializes a new instance of . /// Information about the status of continuous backups. - internal CosmosDBBackupInformation(ContinuousBackupInformation continuousBackupInformation) + /// Keeps track of any properties unknown to the library. + internal CosmosDBBackupInformation(ContinuousBackupInformation continuousBackupInformation, Dictionary serializedAdditionalRawData) { ContinuousBackupInformation = continuousBackupInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Information about the status of continuous backups. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.Serialization.cs index 5fdef408b19e..727e846f0c7c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBBaseConfig : IUtf8JsonSerializable + public partial class CosmosDBBaseConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBBaseConfig DeserializeCosmosDBBaseConfig(JsonElement element) + internal static CosmosDBBaseConfig DeserializeCosmosDBBaseConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CosmosDBBaseConfig DeserializeCosmosDBBaseConfig(JsonElement ele autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBBaseConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CosmosDBBaseConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBBaseConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBBaseConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBBaseConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBBaseConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBBaseConfig(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBBaseConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBBaseConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.cs index 6bc79d7a4b5b..6b6cff3b5a0a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseConfig.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB options resource object. public partial class CosmosDBBaseConfig { - /// Initializes a new instance of CosmosDBBaseConfig. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBBaseConfig() { } - /// Initializes a new instance of CosmosDBBaseConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CosmosDBBaseConfig(int? throughput, AutoscaleSettings autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CosmosDBBaseConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) { Throughput = throughput; AutoscaleSettings = autoscaleSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.Serialization.cs index 7717be42ece4..51c020d59ee2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBBaseMetric + public partial class CosmosDBBaseMetric : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBBaseMetric DeserializeCosmosDBBaseMetric(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBBaseMetric DeserializeCosmosDBBaseMetric(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +52,7 @@ internal static CosmosDBBaseMetric DeserializeCosmosDBBaseMetric(JsonElement ele Optional unit = default; Optional name = default; Optional> metricValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("startTime"u8)) @@ -83,8 +110,61 @@ internal static CosmosDBBaseMetric DeserializeCosmosDBBaseMetric(JsonElement ele metricValues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBBaseMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues)); + return new CosmosDBBaseMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues), serializedAdditionalRawData); + } + + CosmosDBBaseMetric IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBBaseMetric(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBBaseMetric IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBBaseMetric(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBBaseMetric model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBBaseMetric(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBBaseMetric(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.cs index 74c00e593ec1..60b43d4ad6a5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseMetric.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Metric data. public partial class CosmosDBBaseMetric { - /// Initializes a new instance of CosmosDBBaseMetric. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBBaseMetric() { MetricValues = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBBaseMetric. + /// Initializes a new instance of . /// The start time for the metric (ISO-8601 format). /// The end time for the metric (ISO-8601 format). /// The time grain to be used to summarize the metric values. /// The unit of the metric. /// The name information for the metric. /// The metric values for the specified time window and timestep. - internal CosmosDBBaseMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, string timeGrain, CosmosDBMetricUnitType? unit, CosmosDBMetricName name, IReadOnlyList metricValues) + /// Keeps track of any properties unknown to the library. + internal CosmosDBBaseMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, string timeGrain, CosmosDBMetricUnitType? unit, CosmosDBMetricName name, IReadOnlyList metricValues, Dictionary serializedAdditionalRawData) { StartOn = startOn; EndOn = endOn; @@ -35,6 +39,7 @@ internal CosmosDBBaseMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, stri Unit = unit; Name = name; MetricValues = metricValues; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The start time for the metric (ISO-8601 format). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.Serialization.cs index 07fec2855bcb..b25cbd1f6064 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBBaseUsage + public partial class CosmosDBBaseUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBBaseUsage DeserializeCosmosDBBaseUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBBaseUsage DeserializeCosmosDBBaseUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static CosmosDBBaseUsage DeserializeCosmosDBBaseUsage(JsonElement eleme Optional quotaPeriod = default; Optional limit = default; Optional currentValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("unit"u8)) @@ -66,8 +95,61 @@ internal static CosmosDBBaseUsage DeserializeCosmosDBBaseUsage(JsonElement eleme currentValue = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBBaseUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue)); + return new CosmosDBBaseUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), serializedAdditionalRawData); + } + + CosmosDBBaseUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBBaseUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBBaseUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBBaseUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBBaseUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBBaseUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBBaseUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.cs index 6c9ee92e98bc..d79a827cb877 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBBaseUsage.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The usage data for a usage request. public partial class CosmosDBBaseUsage { - /// Initializes a new instance of CosmosDBBaseUsage. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBBaseUsage() { } - /// Initializes a new instance of CosmosDBBaseUsage. + /// Initializes a new instance of . /// The unit of the metric. /// The name information for the metric. /// The quota period used to summarize the usage values. /// Maximum value for this metric. /// Current value for this metric. - internal CosmosDBBaseUsage(CosmosDBMetricUnitType? unit, CosmosDBMetricName name, string quotaPeriod, long? limit, long? currentValue) + /// Keeps track of any properties unknown to the library. + internal CosmosDBBaseUsage(CosmosDBMetricUnitType? unit, CosmosDBMetricName name, string quotaPeriod, long? limit, long? currentValue, Dictionary serializedAdditionalRawData) { Unit = unit; Name = name; QuotaPeriod = quotaPeriod; Limit = limit; CurrentValue = currentValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unit of the metric. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.Serialization.cs index efde12dc093b..dc1347af50cd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBClientEncryptionIncludedPath : IUtf8JsonSerializable + public partial class CosmosDBClientEncryptionIncludedPath : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("path"u8); writer.WriteStringValue(Path); @@ -23,11 +31,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EncryptionType); writer.WritePropertyName("encryptionAlgorithm"u8); writer.WriteStringValue(EncryptionAlgorithm); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBClientEncryptionIncludedPath DeserializeCosmosDBClientEncryptionIncludedPath(JsonElement element) + internal static CosmosDBClientEncryptionIncludedPath DeserializeCosmosDBClientEncryptionIncludedPath(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static CosmosDBClientEncryptionIncludedPath DeserializeCosmosDBClientEn string clientEncryptionKeyId = default; string encryptionType = default; string encryptionAlgorithm = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -58,8 +81,61 @@ internal static CosmosDBClientEncryptionIncludedPath DeserializeCosmosDBClientEn encryptionAlgorithm = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBClientEncryptionIncludedPath(path, clientEncryptionKeyId, encryptionType, encryptionAlgorithm, serializedAdditionalRawData); + } + + CosmosDBClientEncryptionIncludedPath IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBClientEncryptionIncludedPath(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBClientEncryptionIncludedPath IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBClientEncryptionIncludedPath(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBClientEncryptionIncludedPath model) + { + if (model is null) + { + return null; } - return new CosmosDBClientEncryptionIncludedPath(path, clientEncryptionKeyId, encryptionType, encryptionAlgorithm); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBClientEncryptionIncludedPath(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBClientEncryptionIncludedPath(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.cs index 10759d72d357..912fcd4bf536 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionIncludedPath.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// . public partial class CosmosDBClientEncryptionIncludedPath { - /// Initializes a new instance of CosmosDBClientEncryptionIncludedPath. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Path that needs to be encrypted. /// The identifier of the Client Encryption Key to be used to encrypt the path. /// The type of encryption to be performed. Eg - Deterministic, Randomized. @@ -32,6 +36,26 @@ public CosmosDBClientEncryptionIncludedPath(string path, string clientEncryption EncryptionAlgorithm = encryptionAlgorithm; } + /// Initializes a new instance of . + /// Path that needs to be encrypted. + /// The identifier of the Client Encryption Key to be used to encrypt the path. + /// The type of encryption to be performed. Eg - Deterministic, Randomized. + /// The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. + /// Keeps track of any properties unknown to the library. + internal CosmosDBClientEncryptionIncludedPath(string path, string clientEncryptionKeyId, string encryptionType, string encryptionAlgorithm, Dictionary serializedAdditionalRawData) + { + Path = path; + ClientEncryptionKeyId = clientEncryptionKeyId; + EncryptionType = encryptionType; + EncryptionAlgorithm = encryptionAlgorithm; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBClientEncryptionIncludedPath() + { + } + /// Path that needs to be encrypted. public string Path { get; set; } /// The identifier of the Client Encryption Key to be used to encrypt the path. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.Serialization.cs index 37100e4c1bf1..2b512da80d8b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.Serialization.cs @@ -5,37 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBClientEncryptionPolicy : IUtf8JsonSerializable + public partial class CosmosDBClientEncryptionPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("includedPaths"u8); writer.WriteStartArray(); foreach (var item in IncludedPaths) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("policyFormatVersion"u8); writer.WriteNumberValue(PolicyFormatVersion); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBClientEncryptionPolicy DeserializeCosmosDBClientEncryptionPolicy(JsonElement element) + internal static CosmosDBClientEncryptionPolicy DeserializeCosmosDBClientEncryptionPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList includedPaths = default; int policyFormatVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("includedPaths"u8)) @@ -53,8 +82,61 @@ internal static CosmosDBClientEncryptionPolicy DeserializeCosmosDBClientEncrypti policyFormatVersion = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBClientEncryptionPolicy(includedPaths, policyFormatVersion, serializedAdditionalRawData); + } + + CosmosDBClientEncryptionPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBClientEncryptionPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBClientEncryptionPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBClientEncryptionPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBClientEncryptionPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBClientEncryptionPolicy(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBClientEncryptionPolicy(includedPaths, policyFormatVersion); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBClientEncryptionPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.cs index 779d1e6f2851..fc32f21a9807 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBClientEncryptionPolicy.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB client encryption policy. public partial class CosmosDBClientEncryptionPolicy { - /// Initializes a new instance of CosmosDBClientEncryptionPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Paths of the item that need encryption along with path-specific settings. /// Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 supports id and partition key path encryption. /// is null. @@ -27,13 +30,20 @@ public CosmosDBClientEncryptionPolicy(IEnumerable Initializes a new instance of CosmosDBClientEncryptionPolicy. + /// Initializes a new instance of . /// Paths of the item that need encryption along with path-specific settings. /// Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 supports id and partition key path encryption. - internal CosmosDBClientEncryptionPolicy(IList includedPaths, int policyFormatVersion) + /// Keeps track of any properties unknown to the library. + internal CosmosDBClientEncryptionPolicy(IList includedPaths, int policyFormatVersion, Dictionary serializedAdditionalRawData) { IncludedPaths = includedPaths; PolicyFormatVersion = policyFormatVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBClientEncryptionPolicy() + { } /// Paths of the item that need encryption along with path-specific settings. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.Serialization.cs index 1d1278d86729..c2870ebcfb11 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBCompositePath : IUtf8JsonSerializable + public partial class CosmosDBCompositePath : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("order"u8); writer.WriteStringValue(Order.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBCompositePath DeserializeCosmosDBCompositePath(JsonElement element) + internal static CosmosDBCompositePath DeserializeCosmosDBCompositePath(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional path = default; Optional order = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -52,8 +75,61 @@ internal static CosmosDBCompositePath DeserializeCosmosDBCompositePath(JsonEleme order = new CompositePathSortOrder(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBCompositePath(path.Value, Optional.ToNullable(order), serializedAdditionalRawData); + } + + CosmosDBCompositePath IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBCompositePath(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBCompositePath IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBCompositePath(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBCompositePath model) + { + if (model is null) + { + return null; } - return new CosmosDBCompositePath(path.Value, Optional.ToNullable(order)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBCompositePath(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBCompositePath(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.cs index c63821816fca..cd6586725b0f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCompositePath.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CosmosDBCompositePath. public partial class CosmosDBCompositePath { - /// Initializes a new instance of CosmosDBCompositePath. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBCompositePath() { } - /// Initializes a new instance of CosmosDBCompositePath. + /// Initializes a new instance of . /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). /// Sort order for composite paths. - internal CosmosDBCompositePath(string path, CompositePathSortOrder? order) + /// Keeps track of any properties unknown to the library. + internal CosmosDBCompositePath(string path, CompositePathSortOrder? order, Dictionary serializedAdditionalRawData) { Path = path; Order = order; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.Serialization.cs index 714ac877206b..890dcbb60e13 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBConnectionString + public partial class CosmosDBConnectionString : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBConnectionString DeserializeCosmosDBConnectionString(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBConnectionString DeserializeCosmosDBConnectionString(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional connectionString = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionString"u8)) @@ -32,8 +61,61 @@ internal static CosmosDBConnectionString DeserializeCosmosDBConnectionString(Jso description = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBConnectionString(connectionString.Value, description.Value); + return new CosmosDBConnectionString(connectionString.Value, description.Value, serializedAdditionalRawData); + } + + CosmosDBConnectionString IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBConnectionString(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBConnectionString IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBConnectionString(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBConnectionString model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBConnectionString(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBConnectionString(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.cs index 66e63581d226..fdaae3afb4b2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBConnectionString.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Connection string for the mongo cluster. public partial class CosmosDBConnectionString { - /// Initializes a new instance of CosmosDBConnectionString. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBConnectionString() { } - /// Initializes a new instance of CosmosDBConnectionString. + /// Initializes a new instance of . /// Value of the connection string. /// Description of the connection string. - internal CosmosDBConnectionString(string connectionString, string description) + /// Keeps track of any properties unknown to the library. + internal CosmosDBConnectionString(string connectionString, string description, Dictionary serializedAdditionalRawData) { ConnectionString = connectionString; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value of the connection string. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.Serialization.cs index 39cc2a1fda06..29ef6e289411 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBContainerPartitionKey : IUtf8JsonSerializable + public partial class CosmosDBContainerPartitionKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Paths)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteNumberValue(Version.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBContainerPartitionKey DeserializeCosmosDBContainerPartitionKey(JsonElement element) + internal static CosmosDBContainerPartitionKey DeserializeCosmosDBContainerPartitionKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static CosmosDBContainerPartitionKey DeserializeCosmosDBContainerPartit Optional kind = default; Optional version = default; Optional systemKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("paths"u8)) @@ -92,8 +114,61 @@ internal static CosmosDBContainerPartitionKey DeserializeCosmosDBContainerPartit systemKey = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBContainerPartitionKey(Optional.ToList(paths), Optional.ToNullable(kind), Optional.ToNullable(version), Optional.ToNullable(systemKey), serializedAdditionalRawData); + } + + CosmosDBContainerPartitionKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBContainerPartitionKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBContainerPartitionKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBContainerPartitionKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBContainerPartitionKey model) + { + if (model is null) + { + return null; } - return new CosmosDBContainerPartitionKey(Optional.ToList(paths), Optional.ToNullable(kind), Optional.ToNullable(version), Optional.ToNullable(systemKey)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBContainerPartitionKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBContainerPartitionKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.cs index 31dc4c14c691..1400bbaa36a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBContainerPartitionKey.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The configuration of the partition key to be used for partitioning data into multiple partitions. public partial class CosmosDBContainerPartitionKey { - /// Initializes a new instance of CosmosDBContainerPartitionKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBContainerPartitionKey() { Paths = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBContainerPartitionKey. + /// Initializes a new instance of . /// List of paths using which data within the container can be partitioned. /// Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create. /// Indicates the version of the partition key definition. /// Indicates if the container is using a system generated partition key. - internal CosmosDBContainerPartitionKey(IList paths, CosmosDBPartitionKind? kind, int? version, bool? isSystemKey) + /// Keeps track of any properties unknown to the library. + internal CosmosDBContainerPartitionKey(IList paths, CosmosDBPartitionKind? kind, int? version, bool? isSystemKey, Dictionary serializedAdditionalRawData) { Paths = paths; Kind = kind; Version = version; IsSystemKey = isSystemKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of paths using which data within the container can be partitioned. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.Serialization.cs index ffa318471bbb..0c7c7cb54de4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBCreateUpdateConfig : IUtf8JsonSerializable + public partial class CosmosDBCreateUpdateConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBCreateUpdateConfig DeserializeCosmosDBCreateUpdateConfig(JsonElement element) + internal static CosmosDBCreateUpdateConfig DeserializeCosmosDBCreateUpdateConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CosmosDBCreateUpdateConfig DeserializeCosmosDBCreateUpdateConfig autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBCreateUpdateConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CosmosDBCreateUpdateConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBCreateUpdateConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBCreateUpdateConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBCreateUpdateConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBCreateUpdateConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBCreateUpdateConfig(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBCreateUpdateConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBCreateUpdateConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs index 5889e9c32a66..9e3e6b8d5527 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput". public partial class CosmosDBCreateUpdateConfig { - /// Initializes a new instance of CosmosDBCreateUpdateConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBCreateUpdateConfig() { } - /// Initializes a new instance of CosmosDBCreateUpdateConfig. + /// Initializes a new instance of . /// Request Units per second. For example, "throughput": 10000. /// Specifies the Autoscale settings. - internal CosmosDBCreateUpdateConfig(int? throughput, AutoscaleSettings autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CosmosDBCreateUpdateConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) { Throughput = throughput; AutoscaleSettings = autoscaleSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Request Units per second. For example, "throughput": 10000. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.Serialization.cs index 4fa40df9ab29..f19d8964c805 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBExcludedPath : IUtf8JsonSerializable + public partial class CosmosDBExcludedPath : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { writer.WritePropertyName("path"u8); writer.WriteStringValue(Path); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBExcludedPath DeserializeCosmosDBExcludedPath(JsonElement element) + internal static CosmosDBExcludedPath DeserializeCosmosDBExcludedPath(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional path = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -37,8 +60,61 @@ internal static CosmosDBExcludedPath DeserializeCosmosDBExcludedPath(JsonElement path = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBExcludedPath(path.Value, serializedAdditionalRawData); + } + + CosmosDBExcludedPath IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBExcludedPath(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBExcludedPath IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBExcludedPath(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBExcludedPath model) + { + if (model is null) + { + return null; } - return new CosmosDBExcludedPath(path.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBExcludedPath(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBExcludedPath(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.cs index 5717e7670497..d65321b9ec7f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBExcludedPath.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CosmosDBExcludedPath. public partial class CosmosDBExcludedPath { - /// Initializes a new instance of CosmosDBExcludedPath. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBExcludedPath() { } - /// Initializes a new instance of CosmosDBExcludedPath. + /// Initializes a new instance of . /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). - internal CosmosDBExcludedPath(string path) + /// Keeps track of any properties unknown to the library. + internal CosmosDBExcludedPath(string path, Dictionary serializedAdditionalRawData) { Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.Serialization.cs index 931d6135b5e2..0a84d4f248b7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.Serialization.cs @@ -5,24 +5,130 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBFailoverPolicies : IUtf8JsonSerializable + public partial class CosmosDBFailoverPolicies : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("failoverPolicies"u8); writer.WriteStartArray(); foreach (var item in FailoverPolicies) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBFailoverPolicies DeserializeCosmosDBFailoverPolicies(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList failoverPolicies = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("failoverPolicies"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CosmosDBFailoverPolicy.DeserializeCosmosDBFailoverPolicy(item)); + } + failoverPolicies = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBFailoverPolicies(failoverPolicies, serializedAdditionalRawData); + } + + CosmosDBFailoverPolicies IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBFailoverPolicies(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBFailoverPolicies IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBFailoverPolicies(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBFailoverPolicies model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBFailoverPolicies(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBFailoverPolicies(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.cs index 64c82e3407df..dbe2213ea953 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicies.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The list of new failover policies for the failover priority change. public partial class CosmosDBFailoverPolicies { - /// Initializes a new instance of CosmosDBFailoverPolicies. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of failover policies. /// is null. public CosmosDBFailoverPolicies(IEnumerable failoverPolicies) @@ -25,6 +28,20 @@ public CosmosDBFailoverPolicies(IEnumerable failoverPoli FailoverPolicies = failoverPolicies.ToList(); } + /// Initializes a new instance of . + /// List of failover policies. + /// Keeps track of any properties unknown to the library. + internal CosmosDBFailoverPolicies(IList failoverPolicies, Dictionary serializedAdditionalRawData) + { + FailoverPolicies = failoverPolicies; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBFailoverPolicies() + { + } + /// List of failover policies. public IList FailoverPolicies { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.Serialization.cs index 6ae0ca02afb8..75a7433df05c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBFailoverPolicy : IUtf8JsonSerializable + public partial class CosmosDBFailoverPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LocationName)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("failoverPriority"u8); writer.WriteNumberValue(FailoverPriority.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBFailoverPolicy DeserializeCosmosDBFailoverPolicy(JsonElement element) + internal static CosmosDBFailoverPolicy DeserializeCosmosDBFailoverPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static CosmosDBFailoverPolicy DeserializeCosmosDBFailoverPolicy(JsonEle Optional id = default; Optional locationName = default; Optional failoverPriority = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -62,8 +85,61 @@ internal static CosmosDBFailoverPolicy DeserializeCosmosDBFailoverPolicy(JsonEle failoverPriority = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBFailoverPolicy(id.Value, Optional.ToNullable(locationName), Optional.ToNullable(failoverPriority), serializedAdditionalRawData); + } + + CosmosDBFailoverPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBFailoverPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBFailoverPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBFailoverPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBFailoverPolicy model) + { + if (model is null) + { + return null; } - return new CosmosDBFailoverPolicy(id.Value, Optional.ToNullable(locationName), Optional.ToNullable(failoverPriority)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBFailoverPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBFailoverPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.cs index fec2cdb2d199..f88f20a7d5fa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFailoverPolicy.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The failover policy for a given region of a database account. public partial class CosmosDBFailoverPolicy { - /// Initializes a new instance of CosmosDBFailoverPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBFailoverPolicy() { } - /// Initializes a new instance of CosmosDBFailoverPolicy. + /// Initializes a new instance of . /// The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. /// The name of the region in which the database account exists. /// The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - internal CosmosDBFailoverPolicy(string id, AzureLocation? locationName, int? failoverPriority) + /// Keeps track of any properties unknown to the library. + internal CosmosDBFailoverPolicy(string id, AzureLocation? locationName, int? failoverPriority, Dictionary serializedAdditionalRawData) { Id = id; LocationName = locationName; FailoverPriority = failoverPriority; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFirewallRuleData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFirewallRuleData.Serialization.cs index 86ddfbd60f83..69850d698ca4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFirewallRuleData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBFirewallRuleData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBFirewallRuleData : IUtf8JsonSerializable + public partial class CosmosDBFirewallRuleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endIpAddress"u8); writer.WriteStringValue(EndIPAddress); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBFirewallRuleData DeserializeCosmosDBFirewallRuleData(JsonElement element) + internal static CosmosDBFirewallRuleData DeserializeCosmosDBFirewallRuleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +62,7 @@ internal static CosmosDBFirewallRuleData DeserializeCosmosDBFirewallRuleData(Jso Optional provisioningState = default; string startIPAddress = default; string endIPAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +120,61 @@ internal static CosmosDBFirewallRuleData DeserializeCosmosDBFirewallRuleData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBFirewallRuleData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), startIPAddress, endIPAddress, serializedAdditionalRawData); + } + + CosmosDBFirewallRuleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBFirewallRuleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBFirewallRuleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBFirewallRuleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBFirewallRuleData model) + { + if (model is null) + { + return null; } - return new CosmosDBFirewallRuleData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), startIPAddress, endIPAddress); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBFirewallRuleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBFirewallRuleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.Serialization.cs index 83d172ed812d..59b515e68e11 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBIPAddressOrRange : IUtf8JsonSerializable + public partial class CosmosDBIPAddressOrRange : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IPAddressOrRange)) { writer.WritePropertyName("ipAddressOrRange"u8); writer.WriteStringValue(IPAddressOrRange); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBIPAddressOrRange DeserializeCosmosDBIPAddressOrRange(JsonElement element) + internal static CosmosDBIPAddressOrRange DeserializeCosmosDBIPAddressOrRange(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ipAddressOrRange = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipAddressOrRange"u8)) @@ -37,8 +60,61 @@ internal static CosmosDBIPAddressOrRange DeserializeCosmosDBIPAddressOrRange(Jso ipAddressOrRange = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBIPAddressOrRange(ipAddressOrRange.Value, serializedAdditionalRawData); + } + + CosmosDBIPAddressOrRange IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBIPAddressOrRange(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBIPAddressOrRange IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBIPAddressOrRange(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBIPAddressOrRange model) + { + if (model is null) + { + return null; } - return new CosmosDBIPAddressOrRange(ipAddressOrRange.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBIPAddressOrRange(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBIPAddressOrRange(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.cs index e868a95ad54e..18a2d856870e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIPAddressOrRange.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// IpAddressOrRange object. public partial class CosmosDBIPAddressOrRange { - /// Initializes a new instance of CosmosDBIPAddressOrRange. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBIPAddressOrRange() { } - /// Initializes a new instance of CosmosDBIPAddressOrRange. + /// Initializes a new instance of . /// A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - internal CosmosDBIPAddressOrRange(string ipAddressOrRange) + /// Keeps track of any properties unknown to the library. + internal CosmosDBIPAddressOrRange(string ipAddressOrRange, Dictionary serializedAdditionalRawData) { IPAddressOrRange = ipAddressOrRange; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.Serialization.cs index 0dbaa09cca1d..2b25c9a204d4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBIncludedPath : IUtf8JsonSerializable + public partial class CosmosDBIncludedPath : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { @@ -27,21 +34,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Indexes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBIncludedPath DeserializeCosmosDBIncludedPath(JsonElement element) + internal static CosmosDBIncludedPath DeserializeCosmosDBIncludedPath(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional path = default; Optional> indexes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -63,8 +92,61 @@ internal static CosmosDBIncludedPath DeserializeCosmosDBIncludedPath(JsonElement indexes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBIncludedPath(path.Value, Optional.ToList(indexes), serializedAdditionalRawData); + } + + CosmosDBIncludedPath IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBIncludedPath(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBIncludedPath IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBIncludedPath(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBIncludedPath model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBIncludedPath(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBIncludedPath(path.Value, Optional.ToList(indexes)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBIncludedPath(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.cs index 6b70ed653f9e..31698ad441dc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIncludedPath.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The paths that are included in indexing. public partial class CosmosDBIncludedPath { - /// Initializes a new instance of CosmosDBIncludedPath. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBIncludedPath() { Indexes = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBIncludedPath. + /// Initializes a new instance of . /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). /// List of indexes for this path. - internal CosmosDBIncludedPath(string path, IList indexes) + /// Keeps track of any properties unknown to the library. + internal CosmosDBIncludedPath(string path, IList indexes, Dictionary serializedAdditionalRawData) { Path = path; Indexes = indexes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.Serialization.cs index ed3d152e36a0..07327b467f3f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBIndexingPolicy : IUtf8JsonSerializable + public partial class CosmosDBIndexingPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsAutomatic)) { @@ -32,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IncludedPaths) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -42,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExcludedPaths) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -60,7 +81,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item0 in item) { - writer.WriteObjectValue(item0); + if (item0 is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item0).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -72,15 +100,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SpatialIndexes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBIndexingPolicy DeserializeCosmosDBIndexingPolicy(JsonElement element) + internal static CosmosDBIndexingPolicy DeserializeCosmosDBIndexingPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +140,7 @@ internal static CosmosDBIndexingPolicy DeserializeCosmosDBIndexingPolicy(JsonEle Optional> excludedPaths = default; Optional>> compositeIndexes = default; Optional> spatialIndexes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("automatic"u8)) @@ -179,8 +229,61 @@ internal static CosmosDBIndexingPolicy DeserializeCosmosDBIndexingPolicy(JsonEle spatialIndexes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBIndexingPolicy(Optional.ToNullable(automatic), Optional.ToNullable(indexingMode), Optional.ToList(includedPaths), Optional.ToList(excludedPaths), Optional.ToList(compositeIndexes), Optional.ToList(spatialIndexes), serializedAdditionalRawData); + } + + CosmosDBIndexingPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBIndexingPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBIndexingPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBIndexingPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBIndexingPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBIndexingPolicy(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBIndexingPolicy(Optional.ToNullable(automatic), Optional.ToNullable(indexingMode), Optional.ToList(includedPaths), Optional.ToList(excludedPaths), Optional.ToList(compositeIndexes), Optional.ToList(spatialIndexes)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBIndexingPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.cs index a36bae667067..c0aa563a7f16 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBIndexingPolicy.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB indexing policy. public partial class CosmosDBIndexingPolicy { - /// Initializes a new instance of CosmosDBIndexingPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBIndexingPolicy() { IncludedPaths = new ChangeTrackingList(); @@ -22,14 +26,15 @@ public CosmosDBIndexingPolicy() SpatialIndexes = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBIndexingPolicy. + /// Initializes a new instance of . /// Indicates if the indexing policy is automatic. /// Indicates the indexing mode. /// List of paths to include in the indexing. /// List of paths to exclude from indexing. /// List of composite path list. /// List of spatial specifics. - internal CosmosDBIndexingPolicy(bool? isAutomatic, CosmosDBIndexingMode? indexingMode, IList includedPaths, IList excludedPaths, IList> compositeIndexes, IList spatialIndexes) + /// Keeps track of any properties unknown to the library. + internal CosmosDBIndexingPolicy(bool? isAutomatic, CosmosDBIndexingMode? indexingMode, IList includedPaths, IList excludedPaths, IList> compositeIndexes, IList spatialIndexes, Dictionary serializedAdditionalRawData) { IsAutomatic = isAutomatic; IndexingMode = indexingMode; @@ -37,6 +42,7 @@ internal CosmosDBIndexingPolicy(bool? isAutomatic, CosmosDBIndexingMode? indexin ExcludedPaths = excludedPaths; CompositeIndexes = compositeIndexes; SpatialIndexes = spatialIndexes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the indexing policy is automatic. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.Serialization.cs index f3f2729b6bbd..ded070bfacdf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBKeyWrapMetadata : IUtf8JsonSerializable + public partial class CosmosDBKeyWrapMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("algorithm"u8); writer.WriteStringValue(Algorithm); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBKeyWrapMetadata DeserializeCosmosDBKeyWrapMetadata(JsonElement element) + internal static CosmosDBKeyWrapMetadata DeserializeCosmosDBKeyWrapMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static CosmosDBKeyWrapMetadata DeserializeCosmosDBKeyWrapMetadata(JsonE Optional type = default; Optional value = default; Optional algorithm = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -70,8 +93,61 @@ internal static CosmosDBKeyWrapMetadata DeserializeCosmosDBKeyWrapMetadata(JsonE algorithm = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBKeyWrapMetadata(name.Value, type.Value, value.Value, algorithm.Value, serializedAdditionalRawData); + } + + CosmosDBKeyWrapMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBKeyWrapMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBKeyWrapMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBKeyWrapMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBKeyWrapMetadata model) + { + if (model is null) + { + return null; } - return new CosmosDBKeyWrapMetadata(name.Value, type.Value, value.Value, algorithm.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBKeyWrapMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBKeyWrapMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.cs index 1bc6fc774550..a3aa5359db67 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBKeyWrapMetadata.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key. public partial class CosmosDBKeyWrapMetadata { - /// Initializes a new instance of CosmosDBKeyWrapMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBKeyWrapMetadata() { } - /// Initializes a new instance of CosmosDBKeyWrapMetadata. + /// Initializes a new instance of . /// The name of associated KeyEncryptionKey (aka CustomerManagedKey). /// ProviderName of KeyStoreProvider. /// Reference / link to the KeyEncryptionKey. /// Algorithm used in wrapping and unwrapping of the data encryption key. - internal CosmosDBKeyWrapMetadata(string name, string cosmosDBKeyWrapMetadataType, string value, string algorithm) + /// Keeps track of any properties unknown to the library. + internal CosmosDBKeyWrapMetadata(string name, string cosmosDBKeyWrapMetadataType, string value, string algorithm, Dictionary serializedAdditionalRawData) { Name = name; CosmosDBKeyWrapMetadataType = cosmosDBKeyWrapMetadataType; Value = value; Algorithm = algorithm; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of associated KeyEncryptionKey (aka CustomerManagedKey). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationData.Serialization.cs index ca3026cc3d66..5ac8de8ef065 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBLocationData : IUtf8JsonSerializable + public partial class CosmosDBLocationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBLocationData DeserializeCosmosDBLocationData(JsonElement element) + internal static CosmosDBLocationData DeserializeCosmosDBLocationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static CosmosDBLocationData DeserializeCosmosDBLocationData(JsonElement string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static CosmosDBLocationData DeserializeCosmosDBLocationData(JsonElement systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBLocationData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + CosmosDBLocationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBLocationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBLocationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBLocationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBLocationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBLocationData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBLocationData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBLocationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.Serialization.cs index 7d8bddd04927..5af41d2f2a2f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBLocationListResult + internal partial class CosmosDBLocationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBLocationListResult DeserializeCosmosDBLocationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBLocationListResult DeserializeCosmosDBLocationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBLocationListResult DeserializeCosmosDBLocationListResult value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBLocationListResult(Optional.ToList(value)); + return new CosmosDBLocationListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBLocationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBLocationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBLocationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBLocationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBLocationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBLocationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBLocationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.cs index 08c4ff46dd0e..0de47eb476ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains Cosmos DB locations and their properties. internal partial class CosmosDBLocationListResult { - /// Initializes a new instance of CosmosDBLocationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBLocationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBLocationListResult. + /// Initializes a new instance of . /// List of Cosmos DB locations and their properties. - internal CosmosDBLocationListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBLocationListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Cosmos DB locations and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.Serialization.cs index 9c4ab9daa00d..55635c85e4ec 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.Serialization.cs @@ -5,22 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBLocationProperties : IUtf8JsonSerializable + public partial class CosmosDBLocationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBLocationProperties DeserializeCosmosDBLocationProperties(JsonElement element) + internal static CosmosDBLocationProperties DeserializeCosmosDBLocationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +52,7 @@ internal static CosmosDBLocationProperties DeserializeCosmosDBLocationProperties Optional isSubscriptionRegionAccessAllowedForRegular = default; Optional isSubscriptionRegionAccessAllowedForAz = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("supportsAvailabilityZone"u8)) @@ -92,8 +114,61 @@ internal static CosmosDBLocationProperties DeserializeCosmosDBLocationProperties status = new CosmosDBStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBLocationProperties(Optional.ToNullable(supportsAvailabilityZone), Optional.ToNullable(isResidencyRestricted), Optional.ToList(backupStorageRedundancies), Optional.ToNullable(isSubscriptionRegionAccessAllowedForRegular), Optional.ToNullable(isSubscriptionRegionAccessAllowedForAz), Optional.ToNullable(status), serializedAdditionalRawData); + } + + CosmosDBLocationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBLocationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBLocationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBLocationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBLocationProperties model) + { + if (model is null) + { + return null; } - return new CosmosDBLocationProperties(Optional.ToNullable(supportsAvailabilityZone), Optional.ToNullable(isResidencyRestricted), Optional.ToList(backupStorageRedundancies), Optional.ToNullable(isSubscriptionRegionAccessAllowedForRegular), Optional.ToNullable(isSubscriptionRegionAccessAllowedForAz), Optional.ToNullable(status)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBLocationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBLocationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.cs index 7620d40f55ee..c8034866838c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBLocationProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB location metadata. public partial class CosmosDBLocationProperties { - /// Initializes a new instance of CosmosDBLocationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBLocationProperties() { BackupStorageRedundancies = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBLocationProperties. + /// Initializes a new instance of . /// Flag indicating whether the location supports availability zones or not. /// Flag indicating whether the location is residency sensitive. /// The properties of available backup storage redundancies. /// Flag indicating whether the subscription have access in region for Non-Availability Zones. /// Flag indicating whether the subscription have access in region for Availability Zones(Az). /// Enum to indicate current buildout status of the region. - internal CosmosDBLocationProperties(bool? doesSupportAvailabilityZone, bool? isResidencyRestricted, IReadOnlyList backupStorageRedundancies, bool? isSubscriptionRegionAccessAllowedForRegular, bool? isSubscriptionRegionAccessAllowedForAz, CosmosDBStatus? status) + /// Keeps track of any properties unknown to the library. + internal CosmosDBLocationProperties(bool? doesSupportAvailabilityZone, bool? isResidencyRestricted, IReadOnlyList backupStorageRedundancies, bool? isSubscriptionRegionAccessAllowedForRegular, bool? isSubscriptionRegionAccessAllowedForAz, CosmosDBStatus? status, Dictionary serializedAdditionalRawData) { DoesSupportAvailabilityZone = doesSupportAvailabilityZone; IsResidencyRestricted = isResidencyRestricted; @@ -34,6 +39,7 @@ internal CosmosDBLocationProperties(bool? doesSupportAvailabilityZone, bool? isR IsSubscriptionRegionAccessAllowedForRegular = isSubscriptionRegionAccessAllowedForRegular; IsSubscriptionRegionAccessAllowedForAz = isSubscriptionRegionAccessAllowedForAz; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Flag indicating whether the location supports availability zones or not. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.Serialization.cs index c258c78749f4..be9736a2d604 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBMetricAvailability + public partial class CosmosDBMetricAvailability : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBMetricAvailability DeserializeCosmosDBMetricAvailability(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBMetricAvailability DeserializeCosmosDBMetricAvailability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional timeGrain = default; Optional retention = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timeGrain"u8)) @@ -32,8 +61,61 @@ internal static CosmosDBMetricAvailability DeserializeCosmosDBMetricAvailability retention = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBMetricAvailability(timeGrain.Value, retention.Value); + return new CosmosDBMetricAvailability(timeGrain.Value, retention.Value, serializedAdditionalRawData); + } + + CosmosDBMetricAvailability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMetricAvailability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMetricAvailability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMetricAvailability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMetricAvailability model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMetricAvailability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMetricAvailability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.cs index c34f1148f13b..b605786600c2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricAvailability.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The availability of the metric. public partial class CosmosDBMetricAvailability { - /// Initializes a new instance of CosmosDBMetricAvailability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBMetricAvailability() { } - /// Initializes a new instance of CosmosDBMetricAvailability. + /// Initializes a new instance of . /// The time grain to be used to summarize the metric values. /// The retention for the metric values. - internal CosmosDBMetricAvailability(string timeGrain, string retention) + /// Keeps track of any properties unknown to the library. + internal CosmosDBMetricAvailability(string timeGrain, string retention, Dictionary serializedAdditionalRawData) { TimeGrain = timeGrain; Retention = retention; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The time grain to be used to summarize the metric values. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.Serialization.cs index 0a7eb41f18b5..e822e4d1a014 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBMetricDefinition + public partial class CosmosDBMetricDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBMetricDefinition DeserializeCosmosDBMetricDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBMetricDefinition DeserializeCosmosDBMetricDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static CosmosDBMetricDefinition DeserializeCosmosDBMetricDefinition(Jso Optional unit = default; Optional resourceUri = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("metricAvailabilities"u8)) @@ -76,8 +104,61 @@ internal static CosmosDBMetricDefinition DeserializeCosmosDBMetricDefinition(Jso name = CosmosDBMetricName.DeserializeCosmosDBMetricName(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBMetricDefinition(Optional.ToList(metricAvailabilities), Optional.ToNullable(primaryAggregationType), Optional.ToNullable(unit), resourceUri.Value, name.Value); + return new CosmosDBMetricDefinition(Optional.ToList(metricAvailabilities), Optional.ToNullable(primaryAggregationType), Optional.ToNullable(unit), resourceUri.Value, name.Value, serializedAdditionalRawData); + } + + CosmosDBMetricDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMetricDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMetricDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMetricDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMetricDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMetricDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMetricDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.cs index d486f72d23a4..30c4ad4199fa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The definition of a metric. public partial class CosmosDBMetricDefinition { - /// Initializes a new instance of CosmosDBMetricDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBMetricDefinition() { MetricAvailabilities = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBMetricDefinition. + /// Initializes a new instance of . /// The list of metric availabilities for the account. /// The primary aggregation type of the metric. /// The unit of the metric. /// The resource uri of the database. /// The name information for the metric. - internal CosmosDBMetricDefinition(IReadOnlyList metricAvailabilities, CosmosDBMetricPrimaryAggregationType? primaryAggregationType, CosmosDBMetricUnitType? unit, ResourceIdentifier resourceId, CosmosDBMetricName name) + /// Keeps track of any properties unknown to the library. + internal CosmosDBMetricDefinition(IReadOnlyList metricAvailabilities, CosmosDBMetricPrimaryAggregationType? primaryAggregationType, CosmosDBMetricUnitType? unit, ResourceIdentifier resourceId, CosmosDBMetricName name, Dictionary serializedAdditionalRawData) { MetricAvailabilities = metricAvailabilities; PrimaryAggregationType = primaryAggregationType; Unit = unit; ResourceId = resourceId; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of metric availabilities for the account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.Serialization.cs index aedec57ad263..f67d9ee697c3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBMetricDefinitionsListResult + internal partial class CosmosDBMetricDefinitionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBMetricDefinitionsListResult DeserializeCosmosDBMetricDefinitionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBMetricDefinitionsListResult DeserializeCosmosDBMetricDefinitionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static CosmosDBMetricDefinitionsListResult DeserializeCosmosDBMetricDef value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBMetricDefinitionsListResult(Optional.ToList(value)); + return new CosmosDBMetricDefinitionsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBMetricDefinitionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMetricDefinitionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMetricDefinitionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMetricDefinitionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMetricDefinitionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMetricDefinitionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMetricDefinitionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.cs index cb06805cd03e..db9c8d62ce95 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricDefinitionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The response to a list metric definitions request. internal partial class CosmosDBMetricDefinitionsListResult { - /// Initializes a new instance of CosmosDBMetricDefinitionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBMetricDefinitionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBMetricDefinitionsListResult. + /// Initializes a new instance of . /// The list of metric definitions for the account. - internal CosmosDBMetricDefinitionsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBMetricDefinitionsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of metric definitions for the account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.Serialization.cs index 139d5b3f9434..2f30c2b2ba57 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBMetricListResult + internal partial class CosmosDBMetricListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBMetricListResult DeserializeCosmosDBMetricListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBMetricListResult DeserializeCosmosDBMetricListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static CosmosDBMetricListResult DeserializeCosmosDBMetricListResult(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBMetricListResult(Optional.ToList(value)); + return new CosmosDBMetricListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBMetricListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMetricListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMetricListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMetricListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMetricListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMetricListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMetricListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.cs index 0d236c8556f2..5238b1a04db2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The response to a list metrics request. internal partial class CosmosDBMetricListResult { - /// Initializes a new instance of CosmosDBMetricListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBMetricListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBMetricListResult. + /// Initializes a new instance of . /// The list of metrics for the account. - internal CosmosDBMetricListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBMetricListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of metrics for the account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.Serialization.cs index d34f5b104747..a316fefa2f78 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBMetricName + public partial class CosmosDBMetricName : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBMetricName DeserializeCosmosDBMetricName(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBMetricName DeserializeCosmosDBMetricName(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional localizedValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +61,61 @@ internal static CosmosDBMetricName DeserializeCosmosDBMetricName(JsonElement ele localizedValue = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBMetricName(value.Value, localizedValue.Value); + return new CosmosDBMetricName(value.Value, localizedValue.Value, serializedAdditionalRawData); + } + + CosmosDBMetricName IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMetricName(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMetricName IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMetricName(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMetricName model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMetricName(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMetricName(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.cs index b9c64e13b402..8d3464f91e99 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricName.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// A metric name. public partial class CosmosDBMetricName { - /// Initializes a new instance of CosmosDBMetricName. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBMetricName() { } - /// Initializes a new instance of CosmosDBMetricName. + /// Initializes a new instance of . /// The name of the metric. /// The friendly name of the metric. - internal CosmosDBMetricName(string value, string localizedValue) + /// Keeps track of any properties unknown to the library. + internal CosmosDBMetricName(string value, string localizedValue, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the metric. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.Serialization.cs index 5ab5c91bd245..c54af19e0d71 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBMetricValue + public partial class CosmosDBMetricValue : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBMetricValue DeserializeCosmosDBMetricValue(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBMetricValue DeserializeCosmosDBMetricValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +52,7 @@ internal static CosmosDBMetricValue DeserializeCosmosDBMetricValue(JsonElement e Optional minimum = default; Optional timestamp = default; Optional total = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_count"u8)) @@ -81,8 +109,61 @@ internal static CosmosDBMetricValue DeserializeCosmosDBMetricValue(JsonElement e total = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBMetricValue(Optional.ToNullable(count), Optional.ToNullable(average), Optional.ToNullable(maximum), Optional.ToNullable(minimum), Optional.ToNullable(timestamp), Optional.ToNullable(total)); + return new CosmosDBMetricValue(Optional.ToNullable(count), Optional.ToNullable(average), Optional.ToNullable(maximum), Optional.ToNullable(minimum), Optional.ToNullable(timestamp), Optional.ToNullable(total), serializedAdditionalRawData); + } + + CosmosDBMetricValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMetricValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMetricValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMetricValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMetricValue model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMetricValue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMetricValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.cs index 3bc7d9a8f420..c779af89b6b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBMetricValue.cs @@ -6,25 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Represents metrics values. public partial class CosmosDBMetricValue { - /// Initializes a new instance of CosmosDBMetricValue. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBMetricValue() { } - /// Initializes a new instance of CosmosDBMetricValue. + /// Initializes a new instance of . /// The number of values for the metric. /// The average value of the metric. /// The max value of the metric. /// The min value of the metric. /// The metric timestamp (ISO-8601 format). /// The total value of the metric. - internal CosmosDBMetricValue(int? count, double? average, double? maximum, double? minimum, DateTimeOffset? timestamp, double? total) + /// Keeps track of any properties unknown to the library. + internal CosmosDBMetricValue(int? count, double? average, double? maximum, double? minimum, DateTimeOffset? timestamp, double? total, Dictionary serializedAdditionalRawData) { Count = count; Average = average; @@ -32,6 +37,7 @@ internal CosmosDBMetricValue(int? count, double? average, double? maximum, doubl Minimum = minimum; Timestamp = timestamp; Total = total; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The number of values for the metric. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.Serialization.cs index 510ff9a32cf2..bb3c40f731d1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBPathIndexes : IUtf8JsonSerializable + public partial class CosmosDBPathIndexes : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DataType)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBPathIndexes DeserializeCosmosDBPathIndexes(JsonElement element) + internal static CosmosDBPathIndexes DeserializeCosmosDBPathIndexes(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static CosmosDBPathIndexes DeserializeCosmosDBPathIndexes(JsonElement e Optional dataType = default; Optional precision = default; Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataType"u8)) @@ -71,8 +94,61 @@ internal static CosmosDBPathIndexes DeserializeCosmosDBPathIndexes(JsonElement e kind = new CosmosDBIndexKind(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBPathIndexes(Optional.ToNullable(dataType), Optional.ToNullable(precision), Optional.ToNullable(kind), serializedAdditionalRawData); + } + + CosmosDBPathIndexes IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPathIndexes(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPathIndexes IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPathIndexes(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPathIndexes model) + { + if (model is null) + { + return null; } - return new CosmosDBPathIndexes(Optional.ToNullable(dataType), Optional.ToNullable(precision), Optional.ToNullable(kind)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPathIndexes(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPathIndexes(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.cs index 7f09336a9670..d7fe8b66a13d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPathIndexes.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The indexes for the path. public partial class CosmosDBPathIndexes { - /// Initializes a new instance of CosmosDBPathIndexes. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBPathIndexes() { } - /// Initializes a new instance of CosmosDBPathIndexes. + /// Initializes a new instance of . /// The datatype for which the indexing behavior is applied to. /// The precision of the index. -1 is maximum precision. /// Indicates the type of index. - internal CosmosDBPathIndexes(CosmosDBDataType? dataType, int? precision, CosmosDBIndexKind? kind) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPathIndexes(CosmosDBDataType? dataType, int? precision, CosmosDBIndexKind? kind, Dictionary serializedAdditionalRawData) { DataType = dataType; Precision = precision; Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The datatype for which the indexing behavior is applied to. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.Serialization.cs index fb3358c58fff..6f4e2322ea11 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBPercentileMetric + public partial class CosmosDBPercentileMetric : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBPercentileMetric DeserializeCosmosDBPercentileMetric(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBPercentileMetric DeserializeCosmosDBPercentileMetric(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +52,7 @@ internal static CosmosDBPercentileMetric DeserializeCosmosDBPercentileMetric(Jso Optional unit = default; Optional name = default; Optional> metricValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("startTime"u8)) @@ -83,8 +110,61 @@ internal static CosmosDBPercentileMetric DeserializeCosmosDBPercentileMetric(Jso metricValues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBPercentileMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues)); + return new CosmosDBPercentileMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues), serializedAdditionalRawData); + } + + CosmosDBPercentileMetric IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPercentileMetric(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPercentileMetric IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPercentileMetric(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPercentileMetric model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPercentileMetric(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPercentileMetric(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.cs index 3ee1cd85abfc..eed235f6e843 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPercentileMetric.cs @@ -14,20 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Percentile Metric data. public partial class CosmosDBPercentileMetric { - /// Initializes a new instance of CosmosDBPercentileMetric. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBPercentileMetric() { MetricValues = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBPercentileMetric. + /// Initializes a new instance of . /// The start time for the metric (ISO-8601 format). /// The end time for the metric (ISO-8601 format). /// The time grain to be used to summarize the metric values. /// The unit of the metric. /// The name information for the metric. /// The percentile metric values for the specified time window and timestep. - internal CosmosDBPercentileMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, string timeGrain, CosmosDBMetricUnitType? unit, CosmosDBMetricName name, IReadOnlyList metricValues) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPercentileMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, string timeGrain, CosmosDBMetricUnitType? unit, CosmosDBMetricName name, IReadOnlyList metricValues, Dictionary serializedAdditionalRawData) { StartOn = startOn; EndOn = endOn; @@ -35,6 +39,7 @@ internal CosmosDBPercentileMetric(DateTimeOffset? startOn, DateTimeOffset? endOn Unit = unit; Name = name; MetricValues = metricValues; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The start time for the metric (ISO-8601 format). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionData.Serialization.cs index 6766263b7d01..9fa22440b272 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionData.Serialization.cs @@ -5,29 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class CosmosDBPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PrivateEndpoint)) { writer.WritePropertyName("privateEndpoint"u8); - writer.WriteObjectValue(PrivateEndpoint); + if (PrivateEndpoint is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrivateEndpoint).Serialize(writer, options); + } } if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } if (Optional.IsDefined(GroupId)) { @@ -40,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ProvisioningState); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBPrivateEndpointConnectionData DeserializeCosmosDBPrivateEndpointConnectionData(JsonElement element) + internal static CosmosDBPrivateEndpointConnectionData DeserializeCosmosDBPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +93,7 @@ internal static CosmosDBPrivateEndpointConnectionData DeserializeCosmosDBPrivate Optional privateLinkServiceConnectionState = default; Optional groupId = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -123,8 +160,61 @@ internal static CosmosDBPrivateEndpointConnectionData DeserializeCosmosDBPrivate } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, groupId.Value, provisioningState.Value, serializedAdditionalRawData); + } + + CosmosDBPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; } - return new CosmosDBPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, groupId.Value, provisioningState.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.Serialization.cs index e7ba65c69335..e8309b8a3084 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBPrivateEndpointConnectionListResult + internal partial class CosmosDBPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBPrivateEndpointConnectionListResult DeserializeCosmosDBPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBPrivateEndpointConnectionListResult DeserializeCosmosDBPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBPrivateEndpointConnectionListResult DeserializeCosmosDBP value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new CosmosDBPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.cs index b9a27acf5fc7..d17ff6271044 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A list of private endpoint connections. internal partial class CosmosDBPrivateEndpointConnectionListResult { - /// Initializes a new instance of CosmosDBPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal CosmosDBPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceData.Serialization.cs index d27eb681cae5..24d8e04e2573 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceData.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBPrivateLinkResourceData : IUtf8JsonSerializable + public partial class CosmosDBPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBPrivateLinkResourceData DeserializeCosmosDBPrivateLinkResourceData(JsonElement element) + internal static CosmosDBPrivateLinkResourceData DeserializeCosmosDBPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +57,7 @@ internal static CosmosDBPrivateLinkResourceData DeserializeCosmosDBPrivateLinkRe Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -107,8 +129,61 @@ internal static CosmosDBPrivateLinkResourceData DeserializeCosmosDBPrivateLinkRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + CosmosDBPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new CosmosDBPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.Serialization.cs index 7e471f3400d8..036109c16af4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBPrivateLinkResourceListResult + internal partial class CosmosDBPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBPrivateLinkResourceListResult DeserializeCosmosDBPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBPrivateLinkResourceListResult DeserializeCosmosDBPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBPrivateLinkResourceListResult DeserializeCosmosDBPrivate value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBPrivateLinkResourceListResult(Optional.ToList(value)); + return new CosmosDBPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.cs index 1ed793db2923..fe10fb03b1b9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A list of private link resources. internal partial class CosmosDBPrivateLinkResourceListResult { - /// Initializes a new instance of CosmosDBPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal CosmosDBPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.Serialization.cs index 8731fabd1094..539bdfd5e550 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBPrivateLinkServiceConnectionStateProperty : IUtf8JsonSerializable + public partial class CosmosDBPrivateLinkServiceConnectionStateProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("description"u8); writer.WriteStringValue(Description); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBPrivateLinkServiceConnectionStateProperty DeserializeCosmosDBPrivateLinkServiceConnectionStateProperty(JsonElement element) + internal static CosmosDBPrivateLinkServiceConnectionStateProperty DeserializeCosmosDBPrivateLinkServiceConnectionStateProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static CosmosDBPrivateLinkServiceConnectionStateProperty DeserializeCos Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -54,8 +77,61 @@ internal static CosmosDBPrivateLinkServiceConnectionStateProperty DeserializeCos actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBPrivateLinkServiceConnectionStateProperty(status.Value, description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + CosmosDBPrivateLinkServiceConnectionStateProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBPrivateLinkServiceConnectionStateProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBPrivateLinkServiceConnectionStateProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBPrivateLinkServiceConnectionStateProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBPrivateLinkServiceConnectionStateProperty model) + { + if (model is null) + { + return null; } - return new CosmosDBPrivateLinkServiceConnectionStateProperty(status.Value, description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBPrivateLinkServiceConnectionStateProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBPrivateLinkServiceConnectionStateProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.cs index 6012c393ae56..6b4a55ca24e6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPrivateLinkServiceConnectionStateProperty.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Connection State of the Private Endpoint Connection. public partial class CosmosDBPrivateLinkServiceConnectionStateProperty { - /// Initializes a new instance of CosmosDBPrivateLinkServiceConnectionStateProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBPrivateLinkServiceConnectionStateProperty() { } - /// Initializes a new instance of CosmosDBPrivateLinkServiceConnectionStateProperty. + /// Initializes a new instance of . /// The private link service connection status. /// The private link service connection description. /// Any action that is required beyond basic workflow (approve/ reject/ disconnect). - internal CosmosDBPrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal CosmosDBPrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link service connection status. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.Serialization.cs index e9127c11650c..74d1ad8aae2f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBRegionalService + public partial class CosmosDBRegionalService : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBRegionalService DeserializeCosmosDBRegionalService(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBRegionalService DeserializeCosmosDBRegionalService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static CosmosDBRegionalService DeserializeCosmosDBRegionalService(JsonE Optional name = default; Optional location = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -46,8 +75,61 @@ internal static CosmosDBRegionalService DeserializeCosmosDBRegionalService(JsonE status = new CosmosDBServiceStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status)); + return new CosmosDBRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), serializedAdditionalRawData); + } + + CosmosDBRegionalService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBRegionalService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBRegionalService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBRegionalService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBRegionalService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBRegionalService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBRegionalService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.cs index 4f951e136038..5011be5a0b47 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBRegionalService.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource for a regional service location. public partial class CosmosDBRegionalService { - /// Initializes a new instance of CosmosDBRegionalService. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBRegionalService() { } - /// Initializes a new instance of CosmosDBRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. - internal CosmosDBRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status) + /// Keeps track of any properties unknown to the library. + internal CosmosDBRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, Dictionary serializedAdditionalRawData) { Name = name; Location = location; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The regional service name. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.Serialization.cs index 3fb79b45773f..e4ac991a716e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBServiceCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBServiceCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ServiceType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBServiceCreateOrUpdateContent DeserializeCosmosDBServiceCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional instanceSize = default; + Optional instanceCount = default; + Optional serviceType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("instanceSize"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceSize = new CosmosDBServiceSize(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("instanceCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("serviceType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceType = new CosmosDBServiceType(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBServiceCreateOrUpdateContent(Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), Optional.ToNullable(serviceType), serializedAdditionalRawData); + } + + CosmosDBServiceCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBServiceCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBServiceCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBServiceCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBServiceCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBServiceCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBServiceCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.cs index 51a6839bc8a0..952a65857cb7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceCreateOrUpdateContent.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Parameters for Create or Update Request for ServiceResource. public partial class CosmosDBServiceCreateOrUpdateContent { - /// Initializes a new instance of CosmosDBServiceCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBServiceCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// Instance type for the service. + /// Instance count for the service. + /// ServiceType for the service. + /// Keeps track of any properties unknown to the library. + internal CosmosDBServiceCreateOrUpdateContent(CosmosDBServiceSize? instanceSize, int? instanceCount, CosmosDBServiceType? serviceType, Dictionary serializedAdditionalRawData) + { + InstanceSize = instanceSize; + InstanceCount = instanceCount; + ServiceType = serviceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Instance type for the service. public CosmosDBServiceSize? InstanceSize { get; set; } /// Instance count for the service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceData.Serialization.cs index 291e47a26a72..f61e0601eee7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBServiceData : IUtf8JsonSerializable + public partial class CosmosDBServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBServiceData DeserializeCosmosDBServiceData(JsonElement element) + internal static CosmosDBServiceData DeserializeCosmosDBServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static CosmosDBServiceData DeserializeCosmosDBServiceData(JsonElement e string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static CosmosDBServiceData DeserializeCosmosDBServiceData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBServiceData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + CosmosDBServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBServiceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBServiceData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBServiceData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.Serialization.cs index b555cb0c8335..b2960b7ca2c9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBServiceListResult + internal partial class CosmosDBServiceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBServiceListResult DeserializeCosmosDBServiceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBServiceListResult DeserializeCosmosDBServiceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBServiceListResult DeserializeCosmosDBServiceListResult(J value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBServiceListResult(Optional.ToList(value)); + return new CosmosDBServiceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBServiceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBServiceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBServiceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBServiceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBServiceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBServiceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBServiceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.cs index 59551acdb246..1abda9a9a2fa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Service Resource and their properties. internal partial class CosmosDBServiceListResult { - /// Initializes a new instance of CosmosDBServiceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBServiceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBServiceListResult. + /// Initializes a new instance of . /// List of Service Resource and their properties. - internal CosmosDBServiceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBServiceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Service Resource and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.Serialization.cs index 2144212a55f1..7ab6779d81ac 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBServiceProperties : IUtf8JsonSerializable + public partial class CosmosDBServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InstanceSize)) { @@ -39,8 +47,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBServiceProperties DeserializeCosmosDBServiceProperties(JsonElement element) + internal static CosmosDBServiceProperties DeserializeCosmosDBServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,7 +65,110 @@ internal static CosmosDBServiceProperties DeserializeCosmosDBServiceProperties(J case "SqlDedicatedGateway": return SqlDedicatedGatewayServiceProperties.DeserializeSqlDedicatedGatewayServiceProperties(element); } } - return UnknownServiceResourceProperties.DeserializeUnknownServiceResourceProperties(element); + + // Unknown type found so we will deserialize the base properties only + Optional creationTime = default; + Optional instanceSize = default; + Optional instanceCount = default; + CosmosDBServiceType serviceType = default; + Optional status = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceSize = new CosmosDBServiceSize(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("serviceType"u8)) + { + serviceType = new CosmosDBServiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new CosmosDBServiceStatus(property.Value.GetString()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownServiceResourceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties); + } + + CosmosDBServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.cs index b78bd0419936..bc31e12d285f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBServiceProperties.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.CosmosDB.Models /// public partial class CosmosDBServiceProperties { - /// Initializes a new instance of CosmosDBServiceProperties. + /// Initializes a new instance of . public CosmosDBServiceProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CosmosDBServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.Serialization.cs index bf3b091f9842..2c7db7e9fddb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.Serialization.cs @@ -5,22 +5,135 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent DeserializeCosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CosmosDBSqlClientEncryptionKeyResourceInfo resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resource"u8)) + { + resource = CosmosDBSqlClientEncryptionKeyResourceInfo.DeserializeCosmosDBSqlClientEncryptionKeyResourceInfo(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(resource, serializedAdditionalRawData); + } + + CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.cs index 04267e729468..fa2028d8a772 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update ClientEncryptionKey. public partial class CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent { - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The standard JSON format of a ClientEncryptionKey. /// is null. public CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(CosmosDBSqlClientEncryptionKeyResourceInfo resource) @@ -23,6 +27,20 @@ public CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(CosmosDBSqlClientEncr Resource = resource; } + /// Initializes a new instance of . + /// The standard JSON format of a ClientEncryptionKey. + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(CosmosDBSqlClientEncryptionKeyResourceInfo resource, Dictionary serializedAdditionalRawData) + { + Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent() + { + } + /// The standard JSON format of a ClientEncryptionKey. public CosmosDBSqlClientEncryptionKeyResourceInfo Resource { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyData.Serialization.cs index 2ae3acc41fba..3f740600b6a3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyData.Serialization.cs @@ -5,31 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlClientEncryptionKeyData : IUtf8JsonSerializable + public partial class CosmosDBSqlClientEncryptionKeyData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlClientEncryptionKeyData DeserializeCosmosDBSqlClientEncryptionKeyData(JsonElement element) + internal static CosmosDBSqlClientEncryptionKeyData DeserializeCosmosDBSqlClientEncryptionKeyData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static CosmosDBSqlClientEncryptionKeyData DeserializeCosmosDBSqlClientE ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +116,61 @@ internal static CosmosDBSqlClientEncryptionKeyData DeserializeCosmosDBSqlClientE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlClientEncryptionKeyData(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + CosmosDBSqlClientEncryptionKeyData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlClientEncryptionKeyData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlClientEncryptionKeyData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlClientEncryptionKeyData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlClientEncryptionKeyData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlClientEncryptionKeyData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlClientEncryptionKeyData(id, name, type, systemData.Value, resource.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlClientEncryptionKeyData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.Serialization.cs index 983f9555ea3d..4a21c6d4023f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.Serialization.cs @@ -6,16 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlClientEncryptionKeyProperties : IUtf8JsonSerializable + public partial class CosmosDBSqlClientEncryptionKeyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -35,13 +41,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyWrapMetadata)) { writer.WritePropertyName("keyWrapMetadata"u8); - writer.WriteObjectValue(KeyWrapMetadata); + if (KeyWrapMetadata is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyWrapMetadata).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBSqlClientEncryptionKeyProperties DeserializeCosmosDBSqlClientEncryptionKeyProperties(JsonElement element) + internal static CosmosDBSqlClientEncryptionKeyProperties DeserializeCosmosDBSqlClientEncryptionKeyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +80,7 @@ internal static CosmosDBSqlClientEncryptionKeyProperties DeserializeCosmosDBSqlC Optional encryptionAlgorithm = default; Optional wrappedDataEncryptionKey = default; Optional keyWrapMetadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -106,8 +134,61 @@ internal static CosmosDBSqlClientEncryptionKeyProperties DeserializeCosmosDBSqlC keyWrapMetadata = CosmosDBKeyWrapMetadata.DeserializeCosmosDBKeyWrapMetadata(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlClientEncryptionKeyProperties(id.Value, encryptionAlgorithm.Value, wrappedDataEncryptionKey.Value, keyWrapMetadata.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + CosmosDBSqlClientEncryptionKeyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlClientEncryptionKeyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlClientEncryptionKeyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlClientEncryptionKeyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlClientEncryptionKeyProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlClientEncryptionKeyProperties(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlClientEncryptionKeyProperties(id.Value, encryptionAlgorithm.Value, wrappedDataEncryptionKey.Value, keyWrapMetadata.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlClientEncryptionKeyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.cs index b06a36ac1222..55e4f5b8d3a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,12 +14,12 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CosmosDBSqlClientEncryptionKeyProperties. public partial class CosmosDBSqlClientEncryptionKeyProperties : CosmosDBSqlClientEncryptionKeyResourceInfo { - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyProperties. + /// Initializes a new instance of . public CosmosDBSqlClientEncryptionKeyProperties() { } - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyProperties. + /// Initializes a new instance of . /// Name of the ClientEncryptionKey. /// Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data. /// Wrapped (encrypted) form of the key represented as a byte array. @@ -26,7 +27,8 @@ public CosmosDBSqlClientEncryptionKeyProperties() /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal CosmosDBSqlClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, CosmosDBKeyWrapMetadata keyWrapMetadata, string rid, float? timestamp, ETag? etag) : base(id, encryptionAlgorithm, wrappedDataEncryptionKey, keyWrapMetadata) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, CosmosDBKeyWrapMetadata keyWrapMetadata, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(id, encryptionAlgorithm, wrappedDataEncryptionKey, keyWrapMetadata, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.Serialization.cs index 8180742a45c6..1654942ee2aa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlClientEncryptionKeyResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBSqlClientEncryptionKeyResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -34,13 +41,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KeyWrapMetadata)) { writer.WritePropertyName("keyWrapMetadata"u8); - writer.WriteObjectValue(KeyWrapMetadata); + if (KeyWrapMetadata is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyWrapMetadata).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBSqlClientEncryptionKeyResourceInfo DeserializeCosmosDBSqlClientEncryptionKeyResourceInfo(JsonElement element) + internal static CosmosDBSqlClientEncryptionKeyResourceInfo DeserializeCosmosDBSqlClientEncryptionKeyResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static CosmosDBSqlClientEncryptionKeyResourceInfo DeserializeCosmosDBSq Optional encryptionAlgorithm = default; Optional wrappedDataEncryptionKey = default; Optional keyWrapMetadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -79,8 +108,61 @@ internal static CosmosDBSqlClientEncryptionKeyResourceInfo DeserializeCosmosDBSq keyWrapMetadata = CosmosDBKeyWrapMetadata.DeserializeCosmosDBKeyWrapMetadata(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlClientEncryptionKeyResourceInfo(id.Value, encryptionAlgorithm.Value, wrappedDataEncryptionKey.Value, keyWrapMetadata.Value, serializedAdditionalRawData); + } + + CosmosDBSqlClientEncryptionKeyResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlClientEncryptionKeyResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlClientEncryptionKeyResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlClientEncryptionKeyResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlClientEncryptionKeyResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlClientEncryptionKeyResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlClientEncryptionKeyResourceInfo(id.Value, encryptionAlgorithm.Value, wrappedDataEncryptionKey.Value, keyWrapMetadata.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlClientEncryptionKeyResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.cs index 7455f5803fe5..110aa19e9b3b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlClientEncryptionKeyResourceInfo.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB client encryption key resource object. public partial class CosmosDBSqlClientEncryptionKeyResourceInfo { - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlClientEncryptionKeyResourceInfo() { } - /// Initializes a new instance of CosmosDBSqlClientEncryptionKeyResourceInfo. + /// Initializes a new instance of . /// Name of the ClientEncryptionKey. /// Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data. /// Wrapped (encrypted) form of the key represented as a byte array. /// Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption key. - internal CosmosDBSqlClientEncryptionKeyResourceInfo(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, CosmosDBKeyWrapMetadata keyWrapMetadata) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlClientEncryptionKeyResourceInfo(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, CosmosDBKeyWrapMetadata keyWrapMetadata, Dictionary serializedAdditionalRawData) { Id = id; EncryptionAlgorithm = encryptionAlgorithm; WrappedDataEncryptionKey = wrappedDataEncryptionKey; KeyWrapMetadata = keyWrapMetadata; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the ClientEncryptionKey. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.Serialization.cs index de187cf9022f..a5297cd91b53 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlContainerCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlContainerCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlContainerCreateOrUpdateContent DeserializeCosmosDBSqlContainerCreateOrUpdateContent(JsonElement element) + internal static CosmosDBSqlContainerCreateOrUpdateContent DeserializeCosmosDBSqlContainerCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CosmosDBSqlContainerCreateOrUpdateContent DeserializeCosmosDBSql Optional systemData = default; CosmosDBSqlContainerResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CosmosDBSqlContainerCreateOrUpdateContent DeserializeCosmosDBSql } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlContainerCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlContainerCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlContainerCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlContainerCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlContainerCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlContainerCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlContainerCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlContainerCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlContainerCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.cs index 1e0e84646c72..00b5d0ce26b8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB container. public partial class CosmosDBSqlContainerCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlContainerCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a container. /// is null. @@ -26,7 +29,7 @@ public CosmosDBSqlContainerCreateOrUpdateContent(AzureLocation location, CosmosD Resource = resource; } - /// Initializes a new instance of CosmosDBSqlContainerCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CosmosDBSqlContainerCreateOrUpdateContent(AzureLocation location, CosmosD /// The standard JSON format of a container. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CosmosDBSqlContainerCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlContainerResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlContainerCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlContainerResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlContainerCreateOrUpdateContent() + { } /// The standard JSON format of a container. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerData.Serialization.cs index 160f716a9c61..5fb4f097f2e4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlContainerData : IUtf8JsonSerializable + public partial class CosmosDBSqlContainerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlContainerData DeserializeCosmosDBSqlContainerData(JsonElement element) + internal static CosmosDBSqlContainerData DeserializeCosmosDBSqlContainerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static CosmosDBSqlContainerData DeserializeCosmosDBSqlContainerData(Jso Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static CosmosDBSqlContainerData DeserializeCosmosDBSqlContainerData(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlContainerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlContainerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlContainerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlContainerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlContainerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlContainerData model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlContainerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlContainerData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlContainerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.Serialization.cs index 3890d552f3cd..76abe3ee0197 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlContainerListResult + internal partial class CosmosDBSqlContainerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlContainerListResult DeserializeCosmosDBSqlContainerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlContainerListResult DeserializeCosmosDBSqlContainerListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlContainerListResult DeserializeCosmosDBSqlContainerLi value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlContainerListResult(Optional.ToList(value)); + return new CosmosDBSqlContainerListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlContainerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlContainerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlContainerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlContainerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlContainerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlContainerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlContainerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.cs index e90c58f7f883..0da9e6481c99 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the containers and their properties. internal partial class CosmosDBSqlContainerListResult { - /// Initializes a new instance of CosmosDBSqlContainerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlContainerListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlContainerListResult. + /// Initializes a new instance of . /// List of containers and their properties. - internal CosmosDBSqlContainerListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlContainerListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of containers and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.Serialization.cs index b665fcdcd725..26daa04d61fd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlContainerPropertiesConfig : IUtf8JsonSerializable + public partial class CosmosDBSqlContainerPropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBSqlContainerPropertiesConfig DeserializeCosmosDBSqlContainerPropertiesConfig(JsonElement element) + internal static CosmosDBSqlContainerPropertiesConfig DeserializeCosmosDBSqlContainerPropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CosmosDBSqlContainerPropertiesConfig DeserializeCosmosDBSqlConta autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlContainerPropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CosmosDBSqlContainerPropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlContainerPropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlContainerPropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlContainerPropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlContainerPropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlContainerPropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlContainerPropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlContainerPropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.cs index 6c5468c81624..8c172d5a0b1f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerPropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CosmosDBSqlContainerPropertiesConfig. public partial class CosmosDBSqlContainerPropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of CosmosDBSqlContainerPropertiesConfig. + /// Initializes a new instance of . public CosmosDBSqlContainerPropertiesConfig() { } - /// Initializes a new instance of CosmosDBSqlContainerPropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CosmosDBSqlContainerPropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlContainerPropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.Serialization.cs index faabf08d6e9e..9bbe163e6934 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.Serialization.cs @@ -5,27 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlContainerResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBSqlContainerResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(ContainerName); if (Optional.IsDefined(IndexingPolicy)) { writer.WritePropertyName("indexingPolicy"u8); - writer.WriteObjectValue(IndexingPolicy); + if (IndexingPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IndexingPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionKey)) { writer.WritePropertyName("partitionKey"u8); - writer.WriteObjectValue(PartitionKey); + if (PartitionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionKey).Serialize(writer, options); + } } if (Optional.IsDefined(DefaultTtl)) { @@ -35,17 +57,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UniqueKeyPolicy)) { writer.WritePropertyName("uniqueKeyPolicy"u8); - writer.WriteObjectValue(UniqueKeyPolicy); + if (UniqueKeyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UniqueKeyPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ConflictResolutionPolicy)) { writer.WritePropertyName("conflictResolutionPolicy"u8); - writer.WriteObjectValue(ConflictResolutionPolicy); + if (ConflictResolutionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConflictResolutionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ClientEncryptionPolicy)) { writer.WritePropertyName("clientEncryptionPolicy"u8); - writer.WriteObjectValue(ClientEncryptionPolicy); + if (ClientEncryptionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientEncryptionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { @@ -55,7 +98,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { @@ -65,13 +115,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MaterializedViewDefinition)) { writer.WritePropertyName("materializedViewDefinition"u8); - writer.WriteObjectValue(MaterializedViewDefinition); + if (MaterializedViewDefinition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaterializedViewDefinition).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBSqlContainerResourceInfo DeserializeCosmosDBSqlContainerResourceInfo(JsonElement element) + internal static CosmosDBSqlContainerResourceInfo DeserializeCosmosDBSqlContainerResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +158,7 @@ internal static CosmosDBSqlContainerResourceInfo DeserializeCosmosDBSqlContainer Optional restoreParameters = default; Optional createMode = default; Optional materializedViewDefinition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -184,8 +256,61 @@ internal static CosmosDBSqlContainerResourceInfo DeserializeCosmosDBSqlContainer materializedViewDefinition = MaterializedViewDefinition.DeserializeMaterializedViewDefinition(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlContainerResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, clientEncryptionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), materializedViewDefinition.Value, serializedAdditionalRawData); + } + + CosmosDBSqlContainerResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlContainerResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlContainerResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlContainerResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlContainerResourceInfo model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlContainerResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, clientEncryptionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), materializedViewDefinition.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlContainerResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlContainerResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.cs index f024dbec8af6..f7026760449c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL container resource object. public partial class CosmosDBSqlContainerResourceInfo { - /// Initializes a new instance of CosmosDBSqlContainerResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// is null. public CosmosDBSqlContainerResourceInfo(string containerName) @@ -24,7 +27,7 @@ public CosmosDBSqlContainerResourceInfo(string containerName) ContainerName = containerName; } - /// Initializes a new instance of CosmosDBSqlContainerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -36,7 +39,8 @@ public CosmosDBSqlContainerResourceInfo(string containerName) /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. /// The configuration for defining Materialized Views. This must be specified only for creating a Materialized View container. - internal CosmosDBSqlContainerResourceInfo(string containerName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, CosmosDBClientEncryptionPolicy clientEncryptionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, MaterializedViewDefinition materializedViewDefinition) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlContainerResourceInfo(string containerName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, CosmosDBClientEncryptionPolicy clientEncryptionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, MaterializedViewDefinition materializedViewDefinition, Dictionary serializedAdditionalRawData) { ContainerName = containerName; IndexingPolicy = indexingPolicy; @@ -49,6 +53,12 @@ internal CosmosDBSqlContainerResourceInfo(string containerName, CosmosDBIndexing RestoreParameters = restoreParameters; CreateMode = createMode; MaterializedViewDefinition = materializedViewDefinition; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlContainerResourceInfo() + { } /// Name of the Cosmos DB SQL container. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.Serialization.cs index fe246251bb19..68707b27be70 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlDatabaseCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlDatabaseCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlDatabaseCreateOrUpdateContent DeserializeCosmosDBSqlDatabaseCreateOrUpdateContent(JsonElement element) + internal static CosmosDBSqlDatabaseCreateOrUpdateContent DeserializeCosmosDBSqlDatabaseCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CosmosDBSqlDatabaseCreateOrUpdateContent DeserializeCosmosDBSqlD Optional systemData = default; CosmosDBSqlDatabaseResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CosmosDBSqlDatabaseCreateOrUpdateContent DeserializeCosmosDBSqlD } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlDatabaseCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlDatabaseCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlDatabaseCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlDatabaseCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlDatabaseCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlDatabaseCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlDatabaseCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlDatabaseCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlDatabaseCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.cs index 039e310eee8d..758881d89e55 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB SQL database. public partial class CosmosDBSqlDatabaseCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlDatabaseCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a SQL database. /// is null. @@ -26,7 +29,7 @@ public CosmosDBSqlDatabaseCreateOrUpdateContent(AzureLocation location, CosmosDB Resource = resource; } - /// Initializes a new instance of CosmosDBSqlDatabaseCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CosmosDBSqlDatabaseCreateOrUpdateContent(AzureLocation location, CosmosDB /// The standard JSON format of a SQL database. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CosmosDBSqlDatabaseCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlDatabaseResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlDatabaseCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlDatabaseResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlDatabaseCreateOrUpdateContent() + { } /// The standard JSON format of a SQL database. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseData.Serialization.cs index 3bcedb5056c0..91cb8b2b2eb5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlDatabaseData : IUtf8JsonSerializable + public partial class CosmosDBSqlDatabaseData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlDatabaseData DeserializeCosmosDBSqlDatabaseData(JsonElement element) + internal static CosmosDBSqlDatabaseData DeserializeCosmosDBSqlDatabaseData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static CosmosDBSqlDatabaseData DeserializeCosmosDBSqlDatabaseData(JsonE Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static CosmosDBSqlDatabaseData DeserializeCosmosDBSqlDatabaseData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlDatabaseData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlDatabaseData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlDatabaseData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlDatabaseData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlDatabaseData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlDatabaseData model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlDatabaseData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlDatabaseData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlDatabaseData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.Serialization.cs index ee087591bdb6..05d02f78dabe 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlDatabaseListResult + internal partial class CosmosDBSqlDatabaseListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlDatabaseListResult DeserializeCosmosDBSqlDatabaseListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlDatabaseListResult DeserializeCosmosDBSqlDatabaseListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlDatabaseListResult DeserializeCosmosDBSqlDatabaseList value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlDatabaseListResult(Optional.ToList(value)); + return new CosmosDBSqlDatabaseListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlDatabaseListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlDatabaseListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlDatabaseListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlDatabaseListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlDatabaseListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlDatabaseListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlDatabaseListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.cs index dc46bf358c8a..8f759857e3e8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the SQL databases and their properties. internal partial class CosmosDBSqlDatabaseListResult { - /// Initializes a new instance of CosmosDBSqlDatabaseListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlDatabaseListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlDatabaseListResult. + /// Initializes a new instance of . /// List of SQL databases and their properties. - internal CosmosDBSqlDatabaseListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlDatabaseListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of SQL databases and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.Serialization.cs index 8c7f2bfba54e..550b808fb86c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlDatabasePropertiesConfig : IUtf8JsonSerializable + public partial class CosmosDBSqlDatabasePropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBSqlDatabasePropertiesConfig DeserializeCosmosDBSqlDatabasePropertiesConfig(JsonElement element) + internal static CosmosDBSqlDatabasePropertiesConfig DeserializeCosmosDBSqlDatabasePropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CosmosDBSqlDatabasePropertiesConfig DeserializeCosmosDBSqlDataba autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlDatabasePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CosmosDBSqlDatabasePropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlDatabasePropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlDatabasePropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlDatabasePropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlDatabasePropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlDatabasePropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlDatabasePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlDatabasePropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.cs index 60cf8f379040..d4ea0ad0848f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabasePropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CosmosDBSqlDatabasePropertiesConfig. public partial class CosmosDBSqlDatabasePropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of CosmosDBSqlDatabasePropertiesConfig. + /// Initializes a new instance of . public CosmosDBSqlDatabasePropertiesConfig() { } - /// Initializes a new instance of CosmosDBSqlDatabasePropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CosmosDBSqlDatabasePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlDatabasePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.Serialization.cs index ee3a859c721c..e1aa92b91e3e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.Serialization.cs @@ -5,33 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlDatabaseResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBSqlDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(DatabaseName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlDatabaseResourceInfo DeserializeCosmosDBSqlDatabaseResourceInfo(JsonElement element) + internal static CosmosDBSqlDatabaseResourceInfo DeserializeCosmosDBSqlDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static CosmosDBSqlDatabaseResourceInfo DeserializeCosmosDBSqlDatabaseRe string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -64,8 +94,61 @@ internal static CosmosDBSqlDatabaseResourceInfo DeserializeCosmosDBSqlDatabaseRe createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + CosmosDBSqlDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.cs index 32f24c161891..fa920d537526 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlDatabaseResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL database resource object. public partial class CosmosDBSqlDatabaseResourceInfo { - /// Initializes a new instance of CosmosDBSqlDatabaseResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// is null. public CosmosDBSqlDatabaseResourceInfo(string databaseName) @@ -23,15 +27,22 @@ public CosmosDBSqlDatabaseResourceInfo(string databaseName) DatabaseName = databaseName; } - /// Initializes a new instance of CosmosDBSqlDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. - internal CosmosDBSqlDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, Dictionary serializedAdditionalRawData) { DatabaseName = databaseName; RestoreParameters = restoreParameters; CreateMode = createMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlDatabaseResourceInfo() + { } /// Name of the Cosmos DB SQL database. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.Serialization.cs index 876bb2f29f7f..c2c2962b525f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlRoleAssignmentCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlRoleAssignmentCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +41,125 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrincipalId.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBSqlRoleAssignmentCreateOrUpdateContent DeserializeCosmosDBSqlRoleAssignmentCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional roleDefinitionId = default; + Optional scope = default; + Optional principalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("roleDefinitionId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + roleDefinitionId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("scope"u8)) + { + scope = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("principalId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property0.Value.GetGuid(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlRoleAssignmentCreateOrUpdateContent(roleDefinitionId.Value, scope.Value, Optional.ToNullable(principalId), serializedAdditionalRawData); + } + + CosmosDBSqlRoleAssignmentCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRoleAssignmentCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRoleAssignmentCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRoleAssignmentCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRoleAssignmentCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRoleAssignmentCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRoleAssignmentCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.cs index 57362aa089ef..a7d989f08b96 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,11 +14,27 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update an Azure Cosmos DB SQL Role Assignment. public partial class CosmosDBSqlRoleAssignmentCreateOrUpdateContent { - /// Initializes a new instance of CosmosDBSqlRoleAssignmentCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlRoleAssignmentCreateOrUpdateContent() { } + /// Initializes a new instance of . + /// The unique identifier for the associated Role Definition. + /// The data plane resource path for which access is being granted through this Role Assignment. + /// The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRoleAssignmentCreateOrUpdateContent(ResourceIdentifier roleDefinitionId, string scope, Guid? principalId, Dictionary serializedAdditionalRawData) + { + RoleDefinitionId = roleDefinitionId; + Scope = scope; + PrincipalId = principalId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The unique identifier for the associated Role Definition. public ResourceIdentifier RoleDefinitionId { get; set; } /// The data plane resource path for which access is being granted through this Role Assignment. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentData.Serialization.cs index 522a03dbd891..2b5f05feca29 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentData.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlRoleAssignmentData : IUtf8JsonSerializable + public partial class CosmosDBSqlRoleAssignmentData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrincipalId.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlRoleAssignmentData DeserializeCosmosDBSqlRoleAssignmentData(JsonElement element) + internal static CosmosDBSqlRoleAssignmentData DeserializeCosmosDBSqlRoleAssignmentData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +72,7 @@ internal static CosmosDBSqlRoleAssignmentData DeserializeCosmosDBSqlRoleAssignme Optional roleDefinitionId = default; Optional scope = default; Optional principalId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +134,61 @@ internal static CosmosDBSqlRoleAssignmentData DeserializeCosmosDBSqlRoleAssignme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlRoleAssignmentData(id, name, type, systemData.Value, roleDefinitionId.Value, scope.Value, Optional.ToNullable(principalId), serializedAdditionalRawData); + } + + CosmosDBSqlRoleAssignmentData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRoleAssignmentData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRoleAssignmentData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRoleAssignmentData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRoleAssignmentData model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlRoleAssignmentData(id, name, type, systemData.Value, roleDefinitionId.Value, scope.Value, Optional.ToNullable(principalId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRoleAssignmentData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRoleAssignmentData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.Serialization.cs index 9f5330ce9763..0147279dd804 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlRoleAssignmentList + internal partial class CosmosDBSqlRoleAssignmentList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlRoleAssignmentList DeserializeCosmosDBSqlRoleAssignmentList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlRoleAssignmentList DeserializeCosmosDBSqlRoleAssignmentList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlRoleAssignmentList DeserializeCosmosDBSqlRoleAssignme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlRoleAssignmentList(Optional.ToList(value)); + return new CosmosDBSqlRoleAssignmentList(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlRoleAssignmentList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRoleAssignmentList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRoleAssignmentList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRoleAssignmentList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRoleAssignmentList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRoleAssignmentList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRoleAssignmentList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.cs index b21e111c2230..b474e6ab8cf6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleAssignmentList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The relevant Role Assignments. internal partial class CosmosDBSqlRoleAssignmentList { - /// Initializes a new instance of CosmosDBSqlRoleAssignmentList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlRoleAssignmentList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlRoleAssignmentList. + /// Initializes a new instance of . /// List of Role Assignments and their properties. - internal CosmosDBSqlRoleAssignmentList(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRoleAssignmentList(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Role Assignments and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.Serialization.cs index e2e18fc765a3..809b337b7f1c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlRoleDefinitionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlRoleDefinitionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,12 +51,157 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Permissions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBSqlRoleDefinitionCreateOrUpdateContent DeserializeCosmosDBSqlRoleDefinitionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional roleName = default; + Optional type = default; + Optional> assignableScopes = default; + Optional> permissions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("roleName"u8)) + { + roleName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property0.Value.GetString().ToCosmosDBSqlRoleDefinitionType(); + continue; + } + if (property0.NameEquals("assignableScopes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + assignableScopes = array; + continue; + } + if (property0.NameEquals("permissions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(CosmosDBSqlRolePermission.DeserializeCosmosDBSqlRolePermission(item)); + } + permissions = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlRoleDefinitionCreateOrUpdateContent(roleName.Value, Optional.ToNullable(type), Optional.ToList(assignableScopes), Optional.ToList(permissions), serializedAdditionalRawData); + } + + CosmosDBSqlRoleDefinitionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRoleDefinitionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRoleDefinitionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRoleDefinitionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRoleDefinitionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRoleDefinitionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRoleDefinitionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.cs index 3c6d01aea84a..cd9cd2b7ffc2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,31 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update an Azure Cosmos DB SQL Role Definition. public partial class CosmosDBSqlRoleDefinitionCreateOrUpdateContent { - /// Initializes a new instance of CosmosDBSqlRoleDefinitionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlRoleDefinitionCreateOrUpdateContent() { AssignableScopes = new ChangeTrackingList(); Permissions = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// A user-friendly name for the Role Definition. Must be unique for the database account. + /// Indicates whether the Role Definition was built-in or user created. + /// A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. + /// The set of operations allowed through this Role Definition. + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRoleDefinitionCreateOrUpdateContent(string roleName, CosmosDBSqlRoleDefinitionType? roleDefinitionType, IList assignableScopes, IList permissions, Dictionary serializedAdditionalRawData) + { + RoleName = roleName; + RoleDefinitionType = roleDefinitionType; + AssignableScopes = assignableScopes; + Permissions = permissions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// A user-friendly name for the Role Definition. Must be unique for the database account. public string RoleName { get; set; } /// Indicates whether the Role Definition was built-in or user created. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionData.Serialization.cs index 89e92a8ba7ff..29236d08adf0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlRoleDefinitionData : IUtf8JsonSerializable + public partial class CosmosDBSqlRoleDefinitionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,16 +53,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Permissions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlRoleDefinitionData DeserializeCosmosDBSqlRoleDefinitionData(JsonElement element) + internal static CosmosDBSqlRoleDefinitionData DeserializeCosmosDBSqlRoleDefinitionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +96,7 @@ internal static CosmosDBSqlRoleDefinitionData DeserializeCosmosDBSqlRoleDefiniti Optional type0 = default; Optional> assignableScopes = default; Optional> permissions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -148,8 +177,61 @@ internal static CosmosDBSqlRoleDefinitionData DeserializeCosmosDBSqlRoleDefiniti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlRoleDefinitionData(id, name, type, systemData.Value, roleName.Value, Optional.ToNullable(type0), Optional.ToList(assignableScopes), Optional.ToList(permissions), serializedAdditionalRawData); + } + + CosmosDBSqlRoleDefinitionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRoleDefinitionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRoleDefinitionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRoleDefinitionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRoleDefinitionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRoleDefinitionData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlRoleDefinitionData(id, name, type, systemData.Value, roleName.Value, Optional.ToNullable(type0), Optional.ToList(assignableScopes), Optional.ToList(permissions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRoleDefinitionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.Serialization.cs index 6b4c4047e1a0..5873c52e91f0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlRoleDefinitionList + internal partial class CosmosDBSqlRoleDefinitionList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlRoleDefinitionList DeserializeCosmosDBSqlRoleDefinitionList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlRoleDefinitionList DeserializeCosmosDBSqlRoleDefinitionList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlRoleDefinitionList DeserializeCosmosDBSqlRoleDefiniti value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlRoleDefinitionList(Optional.ToList(value)); + return new CosmosDBSqlRoleDefinitionList(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlRoleDefinitionList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRoleDefinitionList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRoleDefinitionList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRoleDefinitionList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRoleDefinitionList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRoleDefinitionList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRoleDefinitionList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.cs index 386ea24d8cf8..1986148a2e01 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRoleDefinitionList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The relevant Role Definitions. internal partial class CosmosDBSqlRoleDefinitionList { - /// Initializes a new instance of CosmosDBSqlRoleDefinitionList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlRoleDefinitionList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlRoleDefinitionList. + /// Initializes a new instance of . /// List of Role Definitions and their properties. - internal CosmosDBSqlRoleDefinitionList(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRoleDefinitionList(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Role Definitions and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.Serialization.cs index 2b53af5891f0..90a67a216fb3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlRolePermission : IUtf8JsonSerializable + public partial class CosmosDBSqlRolePermission : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DataActions)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlRolePermission DeserializeCosmosDBSqlRolePermission(JsonElement element) + internal static CosmosDBSqlRolePermission DeserializeCosmosDBSqlRolePermission(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> dataActions = default; Optional> notDataActions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataActions"u8)) @@ -77,8 +99,61 @@ internal static CosmosDBSqlRolePermission DeserializeCosmosDBSqlRolePermission(J notDataActions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlRolePermission(Optional.ToList(dataActions), Optional.ToList(notDataActions), serializedAdditionalRawData); + } + + CosmosDBSqlRolePermission IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlRolePermission(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlRolePermission IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlRolePermission(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlRolePermission model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlRolePermission(Optional.ToList(dataActions), Optional.ToList(notDataActions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlRolePermission(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlRolePermission(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.cs index df88e3a6ae82..4736a69d747c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlRolePermission.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The set of data plane operations permitted through this Role Definition. public partial class CosmosDBSqlRolePermission { - /// Initializes a new instance of CosmosDBSqlRolePermission. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBSqlRolePermission() { DataActions = new ChangeTrackingList(); NotDataActions = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlRolePermission. + /// Initializes a new instance of . /// An array of data actions that are allowed. /// An array of data actions that are denied. - internal CosmosDBSqlRolePermission(IList dataActions, IList notDataActions) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlRolePermission(IList dataActions, IList notDataActions, Dictionary serializedAdditionalRawData) { DataActions = dataActions; NotDataActions = notDataActions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array of data actions that are allowed. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.Serialization.cs index 089b7f4e969c..5deaf8085692 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlStoredProcedureCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlStoredProcedureCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlStoredProcedureCreateOrUpdateContent DeserializeCosmosDBSqlStoredProcedureCreateOrUpdateContent(JsonElement element) + internal static CosmosDBSqlStoredProcedureCreateOrUpdateContent DeserializeCosmosDBSqlStoredProcedureCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CosmosDBSqlStoredProcedureCreateOrUpdateContent DeserializeCosmo Optional systemData = default; CosmosDBSqlStoredProcedureResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CosmosDBSqlStoredProcedureCreateOrUpdateContent DeserializeCosmo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlStoredProcedureCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlStoredProcedureCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlStoredProcedureCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlStoredProcedureCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlStoredProcedureCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlStoredProcedureCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlStoredProcedureCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlStoredProcedureCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlStoredProcedureCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.cs index 80a17f74fa0d..95c8c0785839 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB storedProcedure. public partial class CosmosDBSqlStoredProcedureCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlStoredProcedureCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a storedProcedure. /// is null. @@ -26,7 +29,7 @@ public CosmosDBSqlStoredProcedureCreateOrUpdateContent(AzureLocation location, C Resource = resource; } - /// Initializes a new instance of CosmosDBSqlStoredProcedureCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CosmosDBSqlStoredProcedureCreateOrUpdateContent(AzureLocation location, C /// The standard JSON format of a storedProcedure. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CosmosDBSqlStoredProcedureCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlStoredProcedureResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlStoredProcedureCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlStoredProcedureResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlStoredProcedureCreateOrUpdateContent() + { } /// The standard JSON format of a storedProcedure. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureData.Serialization.cs index ad3cd65b49c7..c35502ef3998 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlStoredProcedureData : IUtf8JsonSerializable + public partial class CosmosDBSqlStoredProcedureData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,14 +49,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlStoredProcedureData DeserializeCosmosDBSqlStoredProcedureData(JsonElement element) + internal static CosmosDBSqlStoredProcedureData DeserializeCosmosDBSqlStoredProcedureData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static CosmosDBSqlStoredProcedureData DeserializeCosmosDBSqlStoredProce ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -138,8 +167,61 @@ internal static CosmosDBSqlStoredProcedureData DeserializeCosmosDBSqlStoredProce } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlStoredProcedureData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlStoredProcedureData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlStoredProcedureData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlStoredProcedureData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlStoredProcedureData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlStoredProcedureData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlStoredProcedureData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlStoredProcedureData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlStoredProcedureData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.Serialization.cs index ce0d6f1b0736..d65279149b59 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlStoredProcedureListResult + internal partial class CosmosDBSqlStoredProcedureListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlStoredProcedureListResult DeserializeCosmosDBSqlStoredProcedureListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlStoredProcedureListResult DeserializeCosmosDBSqlStoredProcedureListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlStoredProcedureListResult DeserializeCosmosDBSqlStore value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlStoredProcedureListResult(Optional.ToList(value)); + return new CosmosDBSqlStoredProcedureListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlStoredProcedureListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlStoredProcedureListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlStoredProcedureListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlStoredProcedureListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlStoredProcedureListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlStoredProcedureListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlStoredProcedureListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.cs index e607ab68a2fd..39869f034f2f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the storedProcedures and their properties. internal partial class CosmosDBSqlStoredProcedureListResult { - /// Initializes a new instance of CosmosDBSqlStoredProcedureListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlStoredProcedureListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlStoredProcedureListResult. + /// Initializes a new instance of . /// List of storedProcedures and their properties. - internal CosmosDBSqlStoredProcedureListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlStoredProcedureListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of storedProcedures and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.Serialization.cs index 0302827a48fc..cf72548af0a0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlStoredProcedureResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBSqlStoredProcedureResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(StoredProcedureName); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("body"u8); writer.WriteStringValue(Body); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlStoredProcedureResourceInfo DeserializeCosmosDBSqlStoredProcedureResourceInfo(JsonElement element) + internal static CosmosDBSqlStoredProcedureResourceInfo DeserializeCosmosDBSqlStoredProcedureResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; Optional body = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -45,8 +68,61 @@ internal static CosmosDBSqlStoredProcedureResourceInfo DeserializeCosmosDBSqlSto body = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlStoredProcedureResourceInfo(id, body.Value, serializedAdditionalRawData); + } + + CosmosDBSqlStoredProcedureResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlStoredProcedureResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlStoredProcedureResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlStoredProcedureResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlStoredProcedureResourceInfo model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlStoredProcedureResourceInfo(id, body.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlStoredProcedureResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlStoredProcedureResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.cs index 8f60d94cb4df..100cacee6407 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlStoredProcedureResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL storedProcedure resource object. public partial class CosmosDBSqlStoredProcedureResourceInfo { - /// Initializes a new instance of CosmosDBSqlStoredProcedureResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB SQL storedProcedure. /// is null. public CosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName) @@ -23,13 +27,20 @@ public CosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName) StoredProcedureName = storedProcedureName; } - /// Initializes a new instance of CosmosDBSqlStoredProcedureResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL storedProcedure. /// Body of the Stored Procedure. - internal CosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName, string body) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName, string body, Dictionary serializedAdditionalRawData) { StoredProcedureName = storedProcedureName; Body = body; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlStoredProcedureResourceInfo() + { } /// Name of the Cosmos DB SQL storedProcedure. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.Serialization.cs index d655d926493a..6bb4f4ff0b7c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlTriggerCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlTriggerCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlTriggerCreateOrUpdateContent DeserializeCosmosDBSqlTriggerCreateOrUpdateContent(JsonElement element) + internal static CosmosDBSqlTriggerCreateOrUpdateContent DeserializeCosmosDBSqlTriggerCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CosmosDBSqlTriggerCreateOrUpdateContent DeserializeCosmosDBSqlTr Optional systemData = default; CosmosDBSqlTriggerResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CosmosDBSqlTriggerCreateOrUpdateContent DeserializeCosmosDBSqlTr } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlTriggerCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlTriggerCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlTriggerCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlTriggerCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlTriggerCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlTriggerCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlTriggerCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlTriggerCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlTriggerCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.cs index 20723c0567a6..a923bb2c6152 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB trigger. public partial class CosmosDBSqlTriggerCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlTriggerCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a trigger. /// is null. @@ -26,7 +29,7 @@ public CosmosDBSqlTriggerCreateOrUpdateContent(AzureLocation location, CosmosDBS Resource = resource; } - /// Initializes a new instance of CosmosDBSqlTriggerCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CosmosDBSqlTriggerCreateOrUpdateContent(AzureLocation location, CosmosDBS /// The standard JSON format of a trigger. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CosmosDBSqlTriggerCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlTriggerResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlTriggerCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlTriggerResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlTriggerCreateOrUpdateContent() + { } /// The standard JSON format of a trigger. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerData.Serialization.cs index ac823134606e..030488ac13dd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlTriggerData : IUtf8JsonSerializable + public partial class CosmosDBSqlTriggerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,14 +49,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlTriggerData DeserializeCosmosDBSqlTriggerData(JsonElement element) + internal static CosmosDBSqlTriggerData DeserializeCosmosDBSqlTriggerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static CosmosDBSqlTriggerData DeserializeCosmosDBSqlTriggerData(JsonEle ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -138,8 +167,61 @@ internal static CosmosDBSqlTriggerData DeserializeCosmosDBSqlTriggerData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlTriggerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlTriggerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlTriggerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlTriggerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlTriggerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlTriggerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlTriggerData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlTriggerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlTriggerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.Serialization.cs index 0c85248c20f3..bb1fe468aee9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlTriggerListResult + internal partial class CosmosDBSqlTriggerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlTriggerListResult DeserializeCosmosDBSqlTriggerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlTriggerListResult DeserializeCosmosDBSqlTriggerListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlTriggerListResult DeserializeCosmosDBSqlTriggerListRe value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlTriggerListResult(Optional.ToList(value)); + return new CosmosDBSqlTriggerListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlTriggerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlTriggerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlTriggerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlTriggerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlTriggerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlTriggerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlTriggerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.cs index 36c86e1f3039..166e23b547a0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the triggers and their properties. internal partial class CosmosDBSqlTriggerListResult { - /// Initializes a new instance of CosmosDBSqlTriggerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlTriggerListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlTriggerListResult. + /// Initializes a new instance of . /// List of triggers and their properties. - internal CosmosDBSqlTriggerListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlTriggerListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of triggers and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.Serialization.cs index 86c3ce07b3df..2a5b6ce9012c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlTriggerResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBSqlTriggerResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(TriggerName); @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("triggerOperation"u8); writer.WriteStringValue(TriggerOperation.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlTriggerResourceInfo DeserializeCosmosDBSqlTriggerResourceInfo(JsonElement element) + internal static CosmosDBSqlTriggerResourceInfo DeserializeCosmosDBSqlTriggerResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static CosmosDBSqlTriggerResourceInfo DeserializeCosmosDBSqlTriggerReso Optional body = default; Optional triggerType = default; Optional triggerOperation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -75,8 +98,61 @@ internal static CosmosDBSqlTriggerResourceInfo DeserializeCosmosDBSqlTriggerReso triggerOperation = new CosmosDBSqlTriggerOperation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlTriggerResourceInfo(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), serializedAdditionalRawData); + } + + CosmosDBSqlTriggerResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlTriggerResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlTriggerResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlTriggerResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlTriggerResourceInfo model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlTriggerResourceInfo(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlTriggerResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlTriggerResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.cs index 45fd2a7ab674..7f43ee669202 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlTriggerResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL trigger resource object. public partial class CosmosDBSqlTriggerResourceInfo { - /// Initializes a new instance of CosmosDBSqlTriggerResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB SQL trigger. /// is null. public CosmosDBSqlTriggerResourceInfo(string triggerName) @@ -23,17 +27,24 @@ public CosmosDBSqlTriggerResourceInfo(string triggerName) TriggerName = triggerName; } - /// Initializes a new instance of CosmosDBSqlTriggerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL trigger. /// Body of the Trigger. /// Type of the Trigger. /// The operation the trigger is associated with. - internal CosmosDBSqlTriggerResourceInfo(string triggerName, string body, CosmosDBSqlTriggerType? triggerType, CosmosDBSqlTriggerOperation? triggerOperation) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlTriggerResourceInfo(string triggerName, string body, CosmosDBSqlTriggerType? triggerType, CosmosDBSqlTriggerOperation? triggerOperation, Dictionary serializedAdditionalRawData) { TriggerName = triggerName; Body = body; TriggerType = triggerType; TriggerOperation = triggerOperation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlTriggerResourceInfo() + { } /// Name of the Cosmos DB SQL trigger. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.Serialization.cs index 97d293746992..8a9b9c37c840 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent DeserializeCosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(JsonElement element) + internal static CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent DeserializeCosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent DeserializeC Optional systemData = default; CosmosDBSqlUserDefinedFunctionResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent DeserializeC } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.cs index f8f6d1c82238..7a3b30227b07 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB userDefinedFunction. public partial class CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a userDefinedFunction. /// is null. @@ -26,7 +29,7 @@ public CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(AzureLocation locatio Resource = resource; } - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(AzureLocation locatio /// The standard JSON format of a userDefinedFunction. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlUserDefinedFunctionResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBSqlUserDefinedFunctionResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent() + { } /// The standard JSON format of a userDefinedFunction. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionData.Serialization.cs index 94b16baee621..7583c0bb7126 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBSqlUserDefinedFunctionData : IUtf8JsonSerializable + public partial class CosmosDBSqlUserDefinedFunctionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,14 +49,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlUserDefinedFunctionData DeserializeCosmosDBSqlUserDefinedFunctionData(JsonElement element) + internal static CosmosDBSqlUserDefinedFunctionData DeserializeCosmosDBSqlUserDefinedFunctionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static CosmosDBSqlUserDefinedFunctionData DeserializeCosmosDBSqlUserDef ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -138,8 +167,61 @@ internal static CosmosDBSqlUserDefinedFunctionData DeserializeCosmosDBSqlUserDef } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlUserDefinedFunctionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity, serializedAdditionalRawData); + } + + CosmosDBSqlUserDefinedFunctionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlUserDefinedFunctionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlUserDefinedFunctionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlUserDefinedFunctionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlUserDefinedFunctionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlUserDefinedFunctionData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBSqlUserDefinedFunctionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlUserDefinedFunctionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.Serialization.cs index bf214ac4cdcc..fbec72d46c56 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBSqlUserDefinedFunctionListResult + internal partial class CosmosDBSqlUserDefinedFunctionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBSqlUserDefinedFunctionListResult DeserializeCosmosDBSqlUserDefinedFunctionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBSqlUserDefinedFunctionListResult DeserializeCosmosDBSqlUserDefinedFunctionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBSqlUserDefinedFunctionListResult DeserializeCosmosDBSqlU value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBSqlUserDefinedFunctionListResult(Optional.ToList(value)); + return new CosmosDBSqlUserDefinedFunctionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBSqlUserDefinedFunctionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlUserDefinedFunctionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlUserDefinedFunctionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlUserDefinedFunctionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlUserDefinedFunctionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlUserDefinedFunctionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlUserDefinedFunctionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.cs index dade7d5acc80..d1d84c41328b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the userDefinedFunctions and their properties. internal partial class CosmosDBSqlUserDefinedFunctionListResult { - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBSqlUserDefinedFunctionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionListResult. + /// Initializes a new instance of . /// List of userDefinedFunctions and their properties. - internal CosmosDBSqlUserDefinedFunctionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlUserDefinedFunctionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of userDefinedFunctions and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs index 96eaceee9dca..53b0e042f118 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBSqlUserDefinedFunctionResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBSqlUserDefinedFunctionResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(FunctionName); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("body"u8); writer.WriteStringValue(Body); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBSqlUserDefinedFunctionResourceInfo DeserializeCosmosDBSqlUserDefinedFunctionResourceInfo(JsonElement element) + internal static CosmosDBSqlUserDefinedFunctionResourceInfo DeserializeCosmosDBSqlUserDefinedFunctionResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; Optional body = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -45,8 +68,61 @@ internal static CosmosDBSqlUserDefinedFunctionResourceInfo DeserializeCosmosDBSq body = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBSqlUserDefinedFunctionResourceInfo(id, body.Value, serializedAdditionalRawData); + } + + CosmosDBSqlUserDefinedFunctionResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlUserDefinedFunctionResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlUserDefinedFunctionResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlUserDefinedFunctionResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlUserDefinedFunctionResourceInfo model) + { + if (model is null) + { + return null; } - return new CosmosDBSqlUserDefinedFunctionResourceInfo(id, body.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlUserDefinedFunctionResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlUserDefinedFunctionResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.cs index 08d1920a08b6..69c13290227e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlUserDefinedFunctionResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL userDefinedFunction resource object. public partial class CosmosDBSqlUserDefinedFunctionResourceInfo { - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB SQL userDefinedFunction. /// is null. public CosmosDBSqlUserDefinedFunctionResourceInfo(string functionName) @@ -23,13 +27,20 @@ public CosmosDBSqlUserDefinedFunctionResourceInfo(string functionName) FunctionName = functionName; } - /// Initializes a new instance of CosmosDBSqlUserDefinedFunctionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL userDefinedFunction. /// Body of the User Defined Function. - internal CosmosDBSqlUserDefinedFunctionResourceInfo(string functionName, string body) + /// Keeps track of any properties unknown to the library. + internal CosmosDBSqlUserDefinedFunctionResourceInfo(string functionName, string body, Dictionary serializedAdditionalRawData) { FunctionName = functionName; Body = body; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlUserDefinedFunctionResourceInfo() + { } /// Name of the Cosmos DB SQL userDefinedFunction. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.Serialization.cs index b77198926556..2e498e93b929 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBTableCreateOrUpdateContent : IUtf8JsonSerializable + public partial class CosmosDBTableCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBTableCreateOrUpdateContent DeserializeCosmosDBTableCreateOrUpdateContent(JsonElement element) + internal static CosmosDBTableCreateOrUpdateContent DeserializeCosmosDBTableCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static CosmosDBTableCreateOrUpdateContent DeserializeCosmosDBTableCreat Optional systemData = default; CosmosDBTableResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static CosmosDBTableCreateOrUpdateContent DeserializeCosmosDBTableCreat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBTableCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBTableCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBTableCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBTableCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBTableCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBTableCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new CosmosDBTableCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBTableCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBTableCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.cs index e60249d45c79..d94c2bbf6de8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Table. public partial class CosmosDBTableCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of CosmosDBTableCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Table. /// is null. @@ -26,7 +29,7 @@ public CosmosDBTableCreateOrUpdateContent(AzureLocation location, CosmosDBTableR Resource = resource; } - /// Initializes a new instance of CosmosDBTableCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public CosmosDBTableCreateOrUpdateContent(AzureLocation location, CosmosDBTableR /// The standard JSON format of a Table. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal CosmosDBTableCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBTableResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBTableCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBTableResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBTableCreateOrUpdateContent() + { } /// The standard JSON format of a Table. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableData.Serialization.cs index 1ec2607433ae..e56cba107e94 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class CosmosDBTableData : IUtf8JsonSerializable + public partial class CosmosDBTableData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBTableData DeserializeCosmosDBTableData(JsonElement element) + internal static CosmosDBTableData DeserializeCosmosDBTableData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static CosmosDBTableData DeserializeCosmosDBTableData(JsonElement eleme Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static CosmosDBTableData DeserializeCosmosDBTableData(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBTableData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + CosmosDBTableData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBTableData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBTableData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBTableData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBTableData model) + { + if (model is null) + { + return null; } - return new CosmosDBTableData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBTableData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBTableData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.Serialization.cs index edeb26ecc0b6..b2972a00b252 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBTableListResult + internal partial class CosmosDBTableListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBTableListResult DeserializeCosmosDBTableListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBTableListResult DeserializeCosmosDBTableListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static CosmosDBTableListResult DeserializeCosmosDBTableListResult(JsonE value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBTableListResult(Optional.ToList(value)); + return new CosmosDBTableListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBTableListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBTableListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBTableListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBTableListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBTableListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBTableListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBTableListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.cs index 6891a17a9355..1948499a5591 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Table and their properties. internal partial class CosmosDBTableListResult { - /// Initializes a new instance of CosmosDBTableListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBTableListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBTableListResult. + /// Initializes a new instance of . /// List of Table and their properties. - internal CosmosDBTableListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBTableListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Table and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.Serialization.cs index dcb1a5b9840a..6f2d3d896b98 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBTablePropertiesOptions : IUtf8JsonSerializable + public partial class CosmosDBTablePropertiesOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static CosmosDBTablePropertiesOptions DeserializeCosmosDBTablePropertiesOptions(JsonElement element) + internal static CosmosDBTablePropertiesOptions DeserializeCosmosDBTablePropertiesOptions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static CosmosDBTablePropertiesOptions DeserializeCosmosDBTablePropertie autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBTablePropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + CosmosDBTablePropertiesOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBTablePropertiesOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBTablePropertiesOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBTablePropertiesOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBTablePropertiesOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBTablePropertiesOptions(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBTablePropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBTablePropertiesOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.cs index 8591ac7553a8..51eeb194ca13 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesOptions.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The CosmosDBTablePropertiesOptions. public partial class CosmosDBTablePropertiesOptions : CosmosDBBaseConfig { - /// Initializes a new instance of CosmosDBTablePropertiesOptions. + /// Initializes a new instance of . public CosmosDBTablePropertiesOptions() { } - /// Initializes a new instance of CosmosDBTablePropertiesOptions. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal CosmosDBTablePropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal CosmosDBTablePropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.Serialization.cs index 4700291134cc..6bdeae95ab3f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.Serialization.cs @@ -5,34 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBTablePropertiesResource : IUtf8JsonSerializable + public partial class CosmosDBTablePropertiesResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(TableName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBTablePropertiesResource DeserializeCosmosDBTablePropertiesResource(JsonElement element) + internal static CosmosDBTablePropertiesResource DeserializeCosmosDBTablePropertiesResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static CosmosDBTablePropertiesResource DeserializeCosmosDBTableProperti string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -91,8 +120,61 @@ internal static CosmosDBTablePropertiesResource DeserializeCosmosDBTableProperti createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBTablePropertiesResource(id, restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + CosmosDBTablePropertiesResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBTablePropertiesResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBTablePropertiesResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBTablePropertiesResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBTablePropertiesResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBTablePropertiesResource(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBTablePropertiesResource(id, restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBTablePropertiesResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.cs index 39916accdaf6..53590f826c6b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTablePropertiesResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The CosmosDBTablePropertiesResource. public partial class CosmosDBTablePropertiesResource : CosmosDBTableResourceInfo { - /// Initializes a new instance of CosmosDBTablePropertiesResource. + /// Initializes a new instance of . /// Name of the Cosmos DB table. /// is null. public CosmosDBTablePropertiesResource(string tableName) : base(tableName) @@ -22,20 +23,26 @@ public CosmosDBTablePropertiesResource(string tableName) : base(tableName) Argument.AssertNotNull(tableName, nameof(tableName)); } - /// Initializes a new instance of CosmosDBTablePropertiesResource. + /// Initializes a new instance of . /// Name of the Cosmos DB table. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal CosmosDBTablePropertiesResource(string tableName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag) : base(tableName, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal CosmosDBTablePropertiesResource(string tableName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(tableName, restoreParameters, createMode, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal CosmosDBTablePropertiesResource() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.Serialization.cs index e2828c99204b..991dd9d9cfc0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.Serialization.cs @@ -5,33 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBTableResourceInfo : IUtf8JsonSerializable + public partial class CosmosDBTableResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(TableName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBTableResourceInfo DeserializeCosmosDBTableResourceInfo(JsonElement element) + internal static CosmosDBTableResourceInfo DeserializeCosmosDBTableResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static CosmosDBTableResourceInfo DeserializeCosmosDBTableResourceInfo(J string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -64,8 +94,61 @@ internal static CosmosDBTableResourceInfo DeserializeCosmosDBTableResourceInfo(J createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBTableResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + CosmosDBTableResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBTableResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBTableResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBTableResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBTableResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBTableResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBTableResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBTableResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.cs index 198d4080ceb2..3381564eccb8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBTableResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB table resource object. public partial class CosmosDBTableResourceInfo { - /// Initializes a new instance of CosmosDBTableResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB table. /// is null. public CosmosDBTableResourceInfo(string tableName) @@ -23,15 +27,22 @@ public CosmosDBTableResourceInfo(string tableName) TableName = tableName; } - /// Initializes a new instance of CosmosDBTableResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB table. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. - internal CosmosDBTableResourceInfo(string tableName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode) + /// Keeps track of any properties unknown to the library. + internal CosmosDBTableResourceInfo(string tableName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, Dictionary serializedAdditionalRawData) { TableName = tableName; RestoreParameters = restoreParameters; CreateMode = createMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBTableResourceInfo() + { } /// Name of the Cosmos DB table. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.Serialization.cs index b64c639b5a40..d02c4af46cbf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBUniqueKey : IUtf8JsonSerializable + public partial class CosmosDBUniqueKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Paths)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBUniqueKey DeserializeCosmosDBUniqueKey(JsonElement element) + internal static CosmosDBUniqueKey DeserializeCosmosDBUniqueKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> paths = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("paths"u8)) @@ -52,8 +74,61 @@ internal static CosmosDBUniqueKey DeserializeCosmosDBUniqueKey(JsonElement eleme paths = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBUniqueKey(Optional.ToList(paths), serializedAdditionalRawData); + } + + CosmosDBUniqueKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBUniqueKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBUniqueKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBUniqueKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBUniqueKey model) + { + if (model is null) + { + return null; } - return new CosmosDBUniqueKey(Optional.ToList(paths)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBUniqueKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBUniqueKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.cs index 434d27e0b529..c3f21da3d7b7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKey.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. public partial class CosmosDBUniqueKey { - /// Initializes a new instance of CosmosDBUniqueKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBUniqueKey() { Paths = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBUniqueKey. + /// Initializes a new instance of . /// List of paths must be unique for each document in the Azure Cosmos DB service. - internal CosmosDBUniqueKey(IList paths) + /// Keeps track of any properties unknown to the library. + internal CosmosDBUniqueKey(IList paths, Dictionary serializedAdditionalRawData) { Paths = paths; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of paths must be unique for each document in the Azure Cosmos DB service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.Serialization.cs index 93596b101f86..a43443ccb6e7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBUniqueKeyPolicy : IUtf8JsonSerializable + internal partial class CosmosDBUniqueKeyPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(UniqueKeys)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UniqueKeys) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBUniqueKeyPolicy DeserializeCosmosDBUniqueKeyPolicy(JsonElement element) + internal static CosmosDBUniqueKeyPolicy DeserializeCosmosDBUniqueKeyPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> uniqueKeys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uniqueKeys"u8)) @@ -52,8 +81,61 @@ internal static CosmosDBUniqueKeyPolicy DeserializeCosmosDBUniqueKeyPolicy(JsonE uniqueKeys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBUniqueKeyPolicy(Optional.ToList(uniqueKeys), serializedAdditionalRawData); + } + + CosmosDBUniqueKeyPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBUniqueKeyPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBUniqueKeyPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBUniqueKeyPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBUniqueKeyPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBUniqueKeyPolicy(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBUniqueKeyPolicy(Optional.ToList(uniqueKeys)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBUniqueKeyPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.cs index 8266c344d496..215b18153952 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUniqueKeyPolicy.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. internal partial class CosmosDBUniqueKeyPolicy { - /// Initializes a new instance of CosmosDBUniqueKeyPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBUniqueKeyPolicy() { UniqueKeys = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBUniqueKeyPolicy. + /// Initializes a new instance of . /// List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - internal CosmosDBUniqueKeyPolicy(IList uniqueKeys) + /// Keeps track of any properties unknown to the library. + internal CosmosDBUniqueKeyPolicy(IList uniqueKeys, Dictionary serializedAdditionalRawData) { UniqueKeys = uniqueKeys; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.Serialization.cs index 2815b26d4803..e426faeee6b3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class CosmosDBUsagesResult + internal partial class CosmosDBUsagesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBUsagesResult DeserializeCosmosDBUsagesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBUsagesResult DeserializeCosmosDBUsagesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static CosmosDBUsagesResult DeserializeCosmosDBUsagesResult(JsonElement value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBUsagesResult(Optional.ToList(value)); + return new CosmosDBUsagesResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBUsagesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBUsagesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBUsagesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBUsagesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBUsagesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBUsagesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBUsagesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.cs index e1a90356ebef..d21b57edb202 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBUsagesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The response to a list usage request. internal partial class CosmosDBUsagesResult { - /// Initializes a new instance of CosmosDBUsagesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBUsagesResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBUsagesResult. + /// Initializes a new instance of . /// The list of usages for the database. A usage is a point in time metric. - internal CosmosDBUsagesResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBUsagesResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of usages for the database. A usage is a point in time metric. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.Serialization.cs index e7b9deba9b05..240c0dcfffb5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosDBVirtualNetworkRule : IUtf8JsonSerializable + public partial class CosmosDBVirtualNetworkRule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("ignoreMissingVNetServiceEndpoint"u8); writer.WriteBooleanValue(IgnoreMissingVnetServiceEndpoint.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBVirtualNetworkRule DeserializeCosmosDBVirtualNetworkRule(JsonElement element) + internal static CosmosDBVirtualNetworkRule DeserializeCosmosDBVirtualNetworkRule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional ignoreMissingVnetServiceEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -56,8 +79,61 @@ internal static CosmosDBVirtualNetworkRule DeserializeCosmosDBVirtualNetworkRule ignoreMissingVnetServiceEndpoint = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBVirtualNetworkRule(id.Value, Optional.ToNullable(ignoreMissingVnetServiceEndpoint), serializedAdditionalRawData); + } + + CosmosDBVirtualNetworkRule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBVirtualNetworkRule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBVirtualNetworkRule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBVirtualNetworkRule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBVirtualNetworkRule model) + { + if (model is null) + { + return null; } - return new CosmosDBVirtualNetworkRule(id.Value, Optional.ToNullable(ignoreMissingVnetServiceEndpoint)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBVirtualNetworkRule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBVirtualNetworkRule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.cs index 3ce6515a75b3..0c95399afc9c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBVirtualNetworkRule.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Virtual Network ACL Rule object. public partial class CosmosDBVirtualNetworkRule { - /// Initializes a new instance of CosmosDBVirtualNetworkRule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBVirtualNetworkRule() { } - /// Initializes a new instance of CosmosDBVirtualNetworkRule. + /// Initializes a new instance of . /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. /// Create firewall rule before the virtual network has vnet service endpoint enabled. - internal CosmosDBVirtualNetworkRule(ResourceIdentifier id, bool? ignoreMissingVnetServiceEndpoint) + /// Keeps track of any properties unknown to the library. + internal CosmosDBVirtualNetworkRule(ResourceIdentifier id, bool? ignoreMissingVnetServiceEndpoint, Dictionary serializedAdditionalRawData) { Id = id; IgnoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs index 77100d389fd9..474f55b3ed36 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosMongoDataTransferDataSourceSink : IUtf8JsonSerializable + public partial class CosmosMongoDataTransferDataSourceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("databaseName"u8); writer.WriteStringValue(DatabaseName); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(CollectionName); writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoDataTransferDataSourceSink(JsonElement element) + internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoDataTransferDataSourceSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoData string databaseName = default; string collectionName = default; DataTransferComponent component = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -50,8 +73,61 @@ internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoData component = new DataTransferComponent(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosMongoDataTransferDataSourceSink(component, databaseName, collectionName, serializedAdditionalRawData); + } + + CosmosMongoDataTransferDataSourceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosMongoDataTransferDataSourceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosMongoDataTransferDataSourceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosMongoDataTransferDataSourceSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosMongoDataTransferDataSourceSink model) + { + if (model is null) + { + return null; } - return new CosmosMongoDataTransferDataSourceSink(component, databaseName, collectionName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosMongoDataTransferDataSourceSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosMongoDataTransferDataSourceSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs index e6277f0c865c..b188c00549f1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A CosmosDB Cassandra API data source/sink. public partial class CosmosMongoDataTransferDataSourceSink : DataTransferDataSourceSink { - /// Initializes a new instance of CosmosMongoDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// or is null. @@ -27,17 +28,23 @@ public CosmosMongoDataTransferDataSourceSink(string databaseName, string collect Component = DataTransferComponent.CosmosDBMongo; } - /// Initializes a new instance of CosmosMongoDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// - internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string collectionName) : base(component) + /// Keeps track of any properties unknown to the library. + internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string collectionName, Dictionary serializedAdditionalRawData) : base(component, serializedAdditionalRawData) { DatabaseName = databaseName; CollectionName = collectionName; Component = component; } + /// Initializes a new instance of for deserialization. + internal CosmosMongoDataTransferDataSourceSink() + { + } + /// Gets or sets the database name. public string DatabaseName { get; set; } /// Gets or sets the collection name. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs index 8b29a34e28eb..4ab7574e15e6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class CosmosSqlDataTransferDataSourceSink : IUtf8JsonSerializable + public partial class CosmosSqlDataTransferDataSourceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("databaseName"u8); writer.WriteStringValue(DatabaseName); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ContainerName); writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTransferDataSourceSink(JsonElement element) + internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTransferDataSourceSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTran string databaseName = default; string containerName = default; DataTransferComponent component = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -50,8 +73,61 @@ internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTran component = new DataTransferComponent(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosSqlDataTransferDataSourceSink(component, databaseName, containerName, serializedAdditionalRawData); + } + + CosmosSqlDataTransferDataSourceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosSqlDataTransferDataSourceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosSqlDataTransferDataSourceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosSqlDataTransferDataSourceSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosSqlDataTransferDataSourceSink model) + { + if (model is null) + { + return null; } - return new CosmosSqlDataTransferDataSourceSink(component, databaseName, containerName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosSqlDataTransferDataSourceSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosSqlDataTransferDataSourceSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs index a7fb15827cfc..7f70fc0373a4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A CosmosDB Cassandra API data source/sink. public partial class CosmosSqlDataTransferDataSourceSink : DataTransferDataSourceSink { - /// Initializes a new instance of CosmosSqlDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// or is null. @@ -27,17 +28,23 @@ public CosmosSqlDataTransferDataSourceSink(string databaseName, string container Component = DataTransferComponent.CosmosDBSql; } - /// Initializes a new instance of CosmosSqlDataTransferDataSourceSink. + /// Initializes a new instance of . /// /// /// - internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string containerName) : base(component) + /// Keeps track of any properties unknown to the library. + internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string containerName, Dictionary serializedAdditionalRawData) : base(component, serializedAdditionalRawData) { DatabaseName = databaseName; ContainerName = containerName; Component = component; } + /// Initializes a new instance of for deserialization. + internal CosmosSqlDataTransferDataSourceSink() + { + } + /// Gets or sets the database name. public string DatabaseName { get; set; } /// Gets or sets the container name. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.Serialization.cs index 18b7e82150b9..f7e53c302cb6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DataTransferDataSourceSink : IUtf8JsonSerializable + public partial class DataTransferDataSourceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataTransferDataSourceSink DeserializeDataTransferDataSourceSink(JsonElement element) + internal static DataTransferDataSourceSink DeserializeDataTransferDataSourceSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,7 +58,72 @@ internal static DataTransferDataSourceSink DeserializeDataTransferDataSourceSink case "CosmosDBSql": return CosmosSqlDataTransferDataSourceSink.DeserializeCosmosSqlDataTransferDataSourceSink(element); } } - return UnknownDataTransferDataSourceSink.DeserializeUnknownDataTransferDataSourceSink(element); + + // Unknown type found so we will deserialize the base properties only + DataTransferComponent component = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("component"u8)) + { + component = new DataTransferComponent(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDataTransferDataSourceSink(component, serializedAdditionalRawData); + } + + DataTransferDataSourceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferDataSourceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferDataSourceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferDataSourceSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferDataSourceSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferDataSourceSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferDataSourceSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.cs index 059b843564a1..9cb6ce128787 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferDataSourceSink.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.CosmosDB.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownDataTransferDataSourceSink))] public abstract partial class DataTransferDataSourceSink { - /// Initializes a new instance of DataTransferDataSourceSink. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DataTransferDataSourceSink() { } - /// Initializes a new instance of DataTransferDataSourceSink. + /// Initializes a new instance of . /// - internal DataTransferDataSourceSink(DataTransferComponent component) + /// Keeps track of any properties unknown to the library. + internal DataTransferDataSourceSink(DataTransferComponent component, Dictionary serializedAdditionalRawData) { Component = component; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the component. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.Serialization.cs index a5626af72bfc..3d044afbfb2e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class DataTransferJobFeedResults + internal partial class DataTransferJobFeedResults : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataTransferJobFeedResults DeserializeDataTransferJobFeedResults(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataTransferJobFeedResults DeserializeDataTransferJobFeedResults(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static DataTransferJobFeedResults DeserializeDataTransferJobFeedResults nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataTransferJobFeedResults(Optional.ToList(value), nextLink.Value); + return new DataTransferJobFeedResults(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DataTransferJobFeedResults IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferJobFeedResults(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferJobFeedResults IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferJobFeedResults(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferJobFeedResults model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferJobFeedResults(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferJobFeedResults(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.cs index 4f5732927f45..881d7993dce2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobFeedResults.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Data Transfer jobs and their properties. internal partial class DataTransferJobFeedResults { - /// Initializes a new instance of DataTransferJobFeedResults. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataTransferJobFeedResults() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DataTransferJobFeedResults. + /// Initializes a new instance of . /// List of Data Transfer jobs and their properties. /// URL to get the next set of Data Transfer job list results if there are any. - internal DataTransferJobFeedResults(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataTransferJobFeedResults(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Data Transfer jobs and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.Serialization.cs index 50264c062a8a..a8c723dcad7a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.Serialization.cs @@ -5,24 +5,53 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DataTransferJobGetResultCreateOrUpdateContent : IUtf8JsonSerializable + public partial class DataTransferJobGetResultCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataTransferJobGetResultCreateOrUpdateContent DeserializeDataTransferJobGetResultCreateOrUpdateContent(JsonElement element) + internal static DataTransferJobGetResultCreateOrUpdateContent DeserializeDataTransferJobGetResultCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +61,7 @@ internal static DataTransferJobGetResultCreateOrUpdateContent DeserializeDataTra string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -63,8 +93,61 @@ internal static DataTransferJobGetResultCreateOrUpdateContent DeserializeDataTra systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataTransferJobGetResultCreateOrUpdateContent(id, name, type, systemData.Value, properties, serializedAdditionalRawData); + } + + DataTransferJobGetResultCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferJobGetResultCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferJobGetResultCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferJobGetResultCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferJobGetResultCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferJobGetResultCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; } - return new DataTransferJobGetResultCreateOrUpdateContent(id, name, type, systemData.Value, properties); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferJobGetResultCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.cs index 687566d4986b..ccaa260db3e4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultCreateOrUpdateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create Data Transfer Job. public partial class DataTransferJobGetResultCreateOrUpdateContent : ResourceData { - /// Initializes a new instance of DataTransferJobGetResultCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Data Transfer Create Job Properties. /// is null. public DataTransferJobGetResultCreateOrUpdateContent(DataTransferJobProperties properties) @@ -24,15 +28,22 @@ public DataTransferJobGetResultCreateOrUpdateContent(DataTransferJobProperties p Properties = properties; } - /// Initializes a new instance of DataTransferJobGetResultCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Data Transfer Create Job Properties. - internal DataTransferJobGetResultCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataTransferJobProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataTransferJobGetResultCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataTransferJobProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataTransferJobGetResultCreateOrUpdateContent() + { } /// Data Transfer Create Job Properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultData.Serialization.cs index e6e4f90db295..78d4db18c297 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobGetResultData.Serialization.cs @@ -6,29 +6,50 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class DataTransferJobGetResultData : IUtf8JsonSerializable + public partial class DataTransferJobGetResultData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Source)) { writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } } if (Optional.IsDefined(Destination)) { writer.WritePropertyName("destination"u8); - writer.WriteObjectValue(Destination); + if (Destination is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Destination).Serialize(writer, options); + } } if (Optional.IsDefined(WorkerCount)) { @@ -36,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(WorkerCount.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataTransferJobGetResultData DeserializeDataTransferJobGetResultData(JsonElement element) + internal static DataTransferJobGetResultData DeserializeDataTransferJobGetResultData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +93,7 @@ internal static DataTransferJobGetResultData DeserializeDataTransferJobGetResult Optional lastUpdatedUtcTime = default; Optional workerCount = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -169,8 +205,61 @@ internal static DataTransferJobGetResultData DeserializeDataTransferJobGetResult } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataTransferJobGetResultData(id, name, type, systemData.Value, jobName.Value, source.Value, destination.Value, status.Value, Optional.ToNullable(processedCount), Optional.ToNullable(totalCount), Optional.ToNullable(lastUpdatedUtcTime), Optional.ToNullable(workerCount), error.Value, serializedAdditionalRawData); + } + + DataTransferJobGetResultData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferJobGetResultData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferJobGetResultData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferJobGetResultData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferJobGetResultData model) + { + if (model is null) + { + return null; } - return new DataTransferJobGetResultData(id, name, type, systemData.Value, jobName.Value, source.Value, destination.Value, status.Value, Optional.ToNullable(processedCount), Optional.ToNullable(totalCount), Optional.ToNullable(lastUpdatedUtcTime), Optional.ToNullable(workerCount), error.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferJobGetResultData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferJobGetResultData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.Serialization.cs index c148a0979f39..251d668a3f91 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.Serialization.cs @@ -6,30 +6,65 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DataTransferJobProperties : IUtf8JsonSerializable + public partial class DataTransferJobProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } writer.WritePropertyName("destination"u8); - writer.WriteObjectValue(Destination); + if (Destination is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Destination).Serialize(writer, options); + } if (Optional.IsDefined(WorkerCount)) { writer.WritePropertyName("workerCount"u8); writer.WriteNumberValue(WorkerCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataTransferJobProperties DeserializeDataTransferJobProperties(JsonElement element) + internal static DataTransferJobProperties DeserializeDataTransferJobProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +78,7 @@ internal static DataTransferJobProperties DeserializeDataTransferJobProperties(J Optional lastUpdatedUtcTime = default; Optional workerCount = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobName"u8)) @@ -110,8 +146,61 @@ internal static DataTransferJobProperties DeserializeDataTransferJobProperties(J error = ErrorResponse.DeserializeErrorResponse(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataTransferJobProperties(jobName.Value, source, destination, status.Value, Optional.ToNullable(processedCount), Optional.ToNullable(totalCount), Optional.ToNullable(lastUpdatedUtcTime), Optional.ToNullable(workerCount), error.Value, serializedAdditionalRawData); + } + + DataTransferJobProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferJobProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferJobProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferJobProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferJobProperties model) + { + if (model is null) + { + return null; } - return new DataTransferJobProperties(jobName.Value, source, destination, status.Value, Optional.ToNullable(processedCount), Optional.ToNullable(totalCount), Optional.ToNullable(lastUpdatedUtcTime), Optional.ToNullable(workerCount), error.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferJobProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferJobProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.cs index 89b16311715f..ea4dc4473211 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferJobProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The properties of a DataTransfer Job. public partial class DataTransferJobProperties { - /// Initializes a new instance of DataTransferJobProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Source DataStore details /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -34,7 +38,7 @@ public DataTransferJobProperties(DataTransferDataSourceSink source, DataTransfer Destination = destination; } - /// Initializes a new instance of DataTransferJobProperties. + /// Initializes a new instance of . /// Job Name. /// /// Source DataStore details @@ -52,7 +56,8 @@ public DataTransferJobProperties(DataTransferDataSourceSink source, DataTransfer /// Last Updated Time (ISO-8601 format). /// Worker count. /// Error response for Faulted job. - internal DataTransferJobProperties(string jobName, DataTransferDataSourceSink source, DataTransferDataSourceSink destination, string status, long? processedCount, long? totalCount, DateTimeOffset? lastUpdatedUtcOn, int? workerCount, ErrorResponse error) + /// Keeps track of any properties unknown to the library. + internal DataTransferJobProperties(string jobName, DataTransferDataSourceSink source, DataTransferDataSourceSink destination, string status, long? processedCount, long? totalCount, DateTimeOffset? lastUpdatedUtcOn, int? workerCount, ErrorResponse error, Dictionary serializedAdditionalRawData) { JobName = jobName; Source = source; @@ -63,6 +68,12 @@ internal DataTransferJobProperties(string jobName, DataTransferDataSourceSink so LastUpdatedUtcOn = lastUpdatedUtcOn; WorkerCount = workerCount; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataTransferJobProperties() + { } /// Job Name. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.Serialization.cs index 8b08f2f6c8b0..d9cd4715b2da 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DataTransferRegionalService + public partial class DataTransferRegionalService : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataTransferRegionalService DeserializeDataTransferRegionalService(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataTransferRegionalService DeserializeDataTransferRegionalService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static DataTransferRegionalService DeserializeDataTransferRegionalServi Optional name = default; Optional location = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -46,8 +75,61 @@ internal static DataTransferRegionalService DeserializeDataTransferRegionalServi status = new CosmosDBServiceStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataTransferRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status)); + return new DataTransferRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), serializedAdditionalRawData); + } + + DataTransferRegionalService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferRegionalService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferRegionalService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferRegionalService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferRegionalService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferRegionalService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferRegionalService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.cs index c4234588b73e..7ddb44f6e47d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferRegionalService.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,16 +14,17 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource for a regional service location. public partial class DataTransferRegionalService : CosmosDBRegionalService { - /// Initializes a new instance of DataTransferRegionalService. + /// Initializes a new instance of . internal DataTransferRegionalService() { } - /// Initializes a new instance of DataTransferRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. - internal DataTransferRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status) : base(name, location, status) + /// Keeps track of any properties unknown to the library. + internal DataTransferRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, Dictionary serializedAdditionalRawData) : base(name, location, status, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.Serialization.cs index 19bf041cbe8c..aa89194f973e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DataTransferServiceProperties : IUtf8JsonSerializable + public partial class DataTransferServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InstanceSize)) { @@ -41,8 +47,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataTransferServiceProperties DeserializeDataTransferServiceProperties(JsonElement element) + internal static DataTransferServiceProperties DeserializeDataTransferServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,5 +125,53 @@ internal static DataTransferServiceProperties DeserializeDataTransferServiceProp additionalProperties = additionalPropertiesDictionary; return new DataTransferServiceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, Optional.ToList(locations)); } + + DataTransferServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.cs index 49a21ab68fe7..a7a15346d025 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DataTransferServiceProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties for DataTransferServiceResource. public partial class DataTransferServiceProperties : CosmosDBServiceProperties { - /// Initializes a new instance of DataTransferServiceProperties. + /// Initializes a new instance of . public DataTransferServiceProperties() { Locations = new ChangeTrackingList(); ServiceType = CosmosDBServiceType.DataTransfer; } - /// Initializes a new instance of DataTransferServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.Serialization.cs index 01ba27101c7c..4333a5856320 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DatabaseAccountKeysMetadata + public partial class DatabaseAccountKeysMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatabaseAccountKeysMetadata DeserializeDatabaseAccountKeysMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatabaseAccountKeysMetadata DeserializeDatabaseAccountKeysMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static DatabaseAccountKeysMetadata DeserializeDatabaseAccountKeysMetada Optional secondaryMasterKey = default; Optional primaryReadonlyMasterKey = default; Optional secondaryReadonlyMasterKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("primaryMasterKey"u8)) @@ -60,8 +89,61 @@ internal static DatabaseAccountKeysMetadata DeserializeDatabaseAccountKeysMetada secondaryReadonlyMasterKey = AccountKeyMetadata.DeserializeAccountKeyMetadata(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatabaseAccountKeysMetadata(primaryMasterKey.Value, secondaryMasterKey.Value, primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value); + return new DatabaseAccountKeysMetadata(primaryMasterKey.Value, secondaryMasterKey.Value, primaryReadonlyMasterKey.Value, secondaryReadonlyMasterKey.Value, serializedAdditionalRawData); + } + + DatabaseAccountKeysMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseAccountKeysMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabaseAccountKeysMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabaseAccountKeysMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabaseAccountKeysMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabaseAccountKeysMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabaseAccountKeysMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.cs index 5b204ba59e36..d8c63828bb42 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountKeysMetadata.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// The metadata related to each access key for the given Cosmos DB database account. public partial class DatabaseAccountKeysMetadata { - /// Initializes a new instance of DatabaseAccountKeysMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatabaseAccountKeysMetadata() { } - /// Initializes a new instance of DatabaseAccountKeysMetadata. + /// Initializes a new instance of . /// The metadata related to the Primary Read-Write Key for the given Cosmos DB database account. /// The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account. /// The metadata related to the Primary Read-Only Key for the given Cosmos DB database account. /// The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account. - internal DatabaseAccountKeysMetadata(AccountKeyMetadata primaryMasterKey, AccountKeyMetadata secondaryMasterKey, AccountKeyMetadata primaryReadonlyMasterKey, AccountKeyMetadata secondaryReadonlyMasterKey) + /// Keeps track of any properties unknown to the library. + internal DatabaseAccountKeysMetadata(AccountKeyMetadata primaryMasterKey, AccountKeyMetadata secondaryMasterKey, AccountKeyMetadata primaryReadonlyMasterKey, AccountKeyMetadata secondaryReadonlyMasterKey, Dictionary serializedAdditionalRawData) { PrimaryMasterKey = primaryMasterKey; SecondaryMasterKey = secondaryMasterKey; PrimaryReadonlyMasterKey = primaryReadonlyMasterKey; SecondaryReadonlyMasterKey = secondaryReadonlyMasterKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The metadata related to the Primary Read-Write Key for the given Cosmos DB database account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs index 3c039f6d2e0d..66c5d1fff546 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class DatabaseAccountListConnectionStringsResult + internal partial class DatabaseAccountListConnectionStringsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatabaseAccountListConnectionStringsResult DeserializeDatabaseAccountListConnectionStringsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ConnectionStrings)) + { + writer.WritePropertyName("connectionStrings"u8); + writer.WriteStartArray(); + foreach (var item in ConnectionStrings) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatabaseAccountListConnectionStringsResult DeserializeDatabaseAccountListConnectionStringsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> connectionStrings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionStrings"u8)) @@ -36,8 +81,61 @@ internal static DatabaseAccountListConnectionStringsResult DeserializeDatabaseAc connectionStrings = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatabaseAccountListConnectionStringsResult(Optional.ToList(connectionStrings)); + return new DatabaseAccountListConnectionStringsResult(Optional.ToList(connectionStrings), serializedAdditionalRawData); + } + + DatabaseAccountListConnectionStringsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseAccountListConnectionStringsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabaseAccountListConnectionStringsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabaseAccountListConnectionStringsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabaseAccountListConnectionStringsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabaseAccountListConnectionStringsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabaseAccountListConnectionStringsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs index 7d28fb8e5d1b..f9b37a013d57 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountListConnectionStringsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The connection strings for the given database account. internal partial class DatabaseAccountListConnectionStringsResult { - /// Initializes a new instance of DatabaseAccountListConnectionStringsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatabaseAccountListConnectionStringsResult() { ConnectionStrings = new ChangeTrackingList(); } - /// Initializes a new instance of DatabaseAccountListConnectionStringsResult. + /// Initializes a new instance of . /// An array that contains the connection strings for the Cosmos DB account. - internal DatabaseAccountListConnectionStringsResult(IReadOnlyList connectionStrings) + /// Keeps track of any properties unknown to the library. + internal DatabaseAccountListConnectionStringsResult(IReadOnlyList connectionStrings, Dictionary serializedAdditionalRawData) { ConnectionStrings = connectionStrings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array that contains the connection strings for the Cosmos DB account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs index 6df95b23e951..e793d0a5a3ca 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class DatabaseAccountsListResult + internal partial class DatabaseAccountsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatabaseAccountsListResult DeserializeDatabaseAccountsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatabaseAccountsListResult DeserializeDatabaseAccountsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static DatabaseAccountsListResult DeserializeDatabaseAccountsListResult value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatabaseAccountsListResult(Optional.ToList(value)); + return new DatabaseAccountsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + DatabaseAccountsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseAccountsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabaseAccountsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabaseAccountsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabaseAccountsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabaseAccountsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabaseAccountsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs index 4e8d3894e059..ff6f31d2363d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseAccountsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the database accounts and their properties. internal partial class DatabaseAccountsListResult { - /// Initializes a new instance of DatabaseAccountsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatabaseAccountsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatabaseAccountsListResult. + /// Initializes a new instance of . /// List of database account and their properties. - internal DatabaseAccountsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal DatabaseAccountsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of database account and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.Serialization.cs index aa7bb7a5c9c0..cabad1c483b2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class DatabaseRestoreResourceInfo : IUtf8JsonSerializable + public partial class DatabaseRestoreResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DatabaseName)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatabaseRestoreResourceInfo DeserializeDatabaseRestoreResourceInfo(JsonElement element) + internal static DatabaseRestoreResourceInfo DeserializeDatabaseRestoreResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional databaseName = default; Optional> collectionNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -63,8 +85,61 @@ internal static DatabaseRestoreResourceInfo DeserializeDatabaseRestoreResourceIn collectionNames = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatabaseRestoreResourceInfo(databaseName.Value, Optional.ToList(collectionNames), serializedAdditionalRawData); + } + + DatabaseRestoreResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseRestoreResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabaseRestoreResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabaseRestoreResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabaseRestoreResourceInfo model) + { + if (model is null) + { + return null; } - return new DatabaseRestoreResourceInfo(databaseName.Value, Optional.ToList(collectionNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabaseRestoreResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabaseRestoreResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.cs index 0887182e5164..0ad031fe58ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DatabaseRestoreResourceInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Specific Databases to restore. public partial class DatabaseRestoreResourceInfo { - /// Initializes a new instance of DatabaseRestoreResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatabaseRestoreResourceInfo() { CollectionNames = new ChangeTrackingList(); } - /// Initializes a new instance of DatabaseRestoreResourceInfo. + /// Initializes a new instance of . /// The name of the database available for restore. /// The names of the collections available for restore. - internal DatabaseRestoreResourceInfo(string databaseName, IList collectionNames) + /// Keeps track of any properties unknown to the library. + internal DatabaseRestoreResourceInfo(string databaseName, IList collectionNames, Dictionary serializedAdditionalRawData) { DatabaseName = databaseName; CollectionNames = collectionNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the database available for restore. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs index 027ef163f75d..0fe35928a2db 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class DiagnosticLogSettings : IUtf8JsonSerializable + internal partial class DiagnosticLogSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EnableFullTextQuery)) { writer.WritePropertyName("enableFullTextQuery"u8); writer.WriteStringValue(EnableFullTextQuery.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiagnosticLogSettings DeserializeDiagnosticLogSettings(JsonElement element) + internal static DiagnosticLogSettings DeserializeDiagnosticLogSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional enableFullTextQuery = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enableFullTextQuery"u8)) @@ -41,8 +64,61 @@ internal static DiagnosticLogSettings DeserializeDiagnosticLogSettings(JsonEleme enableFullTextQuery = property.Value.GetString().ToEnableFullTextQuery(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiagnosticLogSettings(Optional.ToNullable(enableFullTextQuery), serializedAdditionalRawData); + } + + DiagnosticLogSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticLogSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticLogSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticLogSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticLogSettings model) + { + if (model is null) + { + return null; } - return new DiagnosticLogSettings(Optional.ToNullable(enableFullTextQuery)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticLogSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticLogSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs index ab09dc037d3b..ee628769f537 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DiagnosticLogSettings.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Indicates what diagnostic log settings are to be enabled. internal partial class DiagnosticLogSettings { - /// Initializes a new instance of DiagnosticLogSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiagnosticLogSettings() { } - /// Initializes a new instance of DiagnosticLogSettings. + /// Initializes a new instance of . /// Describe the level of detail with which queries are to be logged. - internal DiagnosticLogSettings(EnableFullTextQuery? enableFullTextQuery) + /// Keeps track of any properties unknown to the library. + internal DiagnosticLogSettings(EnableFullTextQuery? enableFullTextQuery, Dictionary serializedAdditionalRawData) { EnableFullTextQuery = enableFullTextQuery; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Describe the level of detail with which queries are to be logged. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs index 449f73ea730e..7c41e84dbd51 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ErrorResponse + public partial class ErrorResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -32,8 +71,61 @@ internal static ErrorResponse DeserializeErrorResponse(JsonElement element) message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ErrorResponse(code.Value, message.Value); + return new ErrorResponse(code.Value, message.Value, serializedAdditionalRawData); + } + + ErrorResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ErrorResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeErrorResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ErrorResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ErrorResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeErrorResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs index f8007d3f4575..822ba54c646a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ErrorResponse.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Error Response. public partial class ErrorResponse { - /// Initializes a new instance of ErrorResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ErrorResponse() { } - /// Initializes a new instance of ErrorResponse. + /// Initializes a new instance of . /// Error code. /// Error message indicating why the operation failed. - internal ErrorResponse(string code, string message) + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.Serialization.cs index e9e3f842470b..71138f0eb53d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.Serialization.cs @@ -5,24 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCassandraKeyspaceResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCassandraKeyspaceResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(KeyspaceName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedCassandraKeyspaceResourceInfo DeserializeExtendedCassandraKeyspaceResourceInfo(JsonElement element) + internal static ExtendedCassandraKeyspaceResourceInfo DeserializeExtendedCassandraKeyspaceResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +52,7 @@ internal static ExtendedCassandraKeyspaceResourceInfo DeserializeExtendedCassand Optional ts = default; Optional etag = default; string id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -61,8 +83,61 @@ internal static ExtendedCassandraKeyspaceResourceInfo DeserializeExtendedCassand id = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCassandraKeyspaceResourceInfo(id, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCassandraKeyspaceResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCassandraKeyspaceResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCassandraKeyspaceResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCassandraKeyspaceResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCassandraKeyspaceResourceInfo model) + { + if (model is null) + { + return null; } - return new ExtendedCassandraKeyspaceResourceInfo(id, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCassandraKeyspaceResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCassandraKeyspaceResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.cs index 4879d5d0938a..edb3cee90de6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraKeyspaceResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCassandraKeyspaceResourceInfo. public partial class ExtendedCassandraKeyspaceResourceInfo : CassandraKeyspaceResourceInfo { - /// Initializes a new instance of ExtendedCassandraKeyspaceResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra keyspace. /// is null. public ExtendedCassandraKeyspaceResourceInfo(string keyspaceName) : base(keyspaceName) @@ -22,21 +23,24 @@ public ExtendedCassandraKeyspaceResourceInfo(string keyspaceName) : base(keyspac Argument.AssertNotNull(keyspaceName, nameof(keyspaceName)); } - /// Initializes a new instance of ExtendedCassandraKeyspaceResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra keyspace. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - /// is null. - internal ExtendedCassandraKeyspaceResourceInfo(string keyspaceName, string rid, float? timestamp, ETag? etag) : base(keyspaceName) + /// Keeps track of any properties unknown to the library. + internal ExtendedCassandraKeyspaceResourceInfo(string keyspaceName, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(keyspaceName, serializedAdditionalRawData) { - Argument.AssertNotNull(keyspaceName, nameof(keyspaceName)); - Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCassandraKeyspaceResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.Serialization.cs index 0de8b8454251..23593768a75b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCassandraTableResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCassandraTableResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(TableName); @@ -26,18 +33,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Schema)) { writer.WritePropertyName("schema"u8); - writer.WriteObjectValue(Schema); + if (Schema is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schema).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { writer.WritePropertyName("analyticalStorageTtl"u8); writer.WriteNumberValue(AnalyticalStorageTtl.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedCassandraTableResourceInfo DeserializeExtendedCassandraTableResourceInfo(JsonElement element) + internal static ExtendedCassandraTableResourceInfo DeserializeExtendedCassandraTableResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static ExtendedCassandraTableResourceInfo DeserializeExtendedCassandraT Optional defaultTtl = default; Optional schema = default; Optional analyticalStorageTtl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -106,8 +135,61 @@ internal static ExtendedCassandraTableResourceInfo DeserializeExtendedCassandraT analyticalStorageTtl = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCassandraTableResourceInfo(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCassandraTableResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCassandraTableResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCassandraTableResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCassandraTableResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCassandraTableResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCassandraTableResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ExtendedCassandraTableResourceInfo(id, Optional.ToNullable(defaultTtl), schema.Value, Optional.ToNullable(analyticalStorageTtl), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCassandraTableResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.cs index 420dab0bec39..f3c45bda0db0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCassandraTableResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCassandraTableResourceInfo. public partial class ExtendedCassandraTableResourceInfo : CassandraTableResourceInfo { - /// Initializes a new instance of ExtendedCassandraTableResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table. /// is null. public ExtendedCassandraTableResourceInfo(string tableName) : base(tableName) @@ -22,7 +23,7 @@ public ExtendedCassandraTableResourceInfo(string tableName) : base(tableName) Argument.AssertNotNull(tableName, nameof(tableName)); } - /// Initializes a new instance of ExtendedCassandraTableResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Cassandra table. /// Time to live of the Cosmos DB Cassandra table. /// Schema of the Cosmos DB Cassandra table. @@ -30,13 +31,19 @@ public ExtendedCassandraTableResourceInfo(string tableName) : base(tableName) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedCassandraTableResourceInfo(string tableName, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl, string rid, float? timestamp, ETag? etag) : base(tableName, defaultTtl, schema, analyticalStorageTtl) + /// Keeps track of any properties unknown to the library. + internal ExtendedCassandraTableResourceInfo(string tableName, int? defaultTtl, CassandraSchema schema, int? analyticalStorageTtl, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(tableName, defaultTtl, schema, analyticalStorageTtl, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCassandraTableResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.Serialization.cs index 89be68ef783c..26ca0eb5d8b7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.Serialization.cs @@ -5,28 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCosmosDBSqlContainerResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCosmosDBSqlContainerResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(ContainerName); if (Optional.IsDefined(IndexingPolicy)) { writer.WritePropertyName("indexingPolicy"u8); - writer.WriteObjectValue(IndexingPolicy); + if (IndexingPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IndexingPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionKey)) { writer.WritePropertyName("partitionKey"u8); - writer.WriteObjectValue(PartitionKey); + if (PartitionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionKey).Serialize(writer, options); + } } if (Optional.IsDefined(DefaultTtl)) { @@ -36,17 +57,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UniqueKeyPolicy)) { writer.WritePropertyName("uniqueKeyPolicy"u8); - writer.WriteObjectValue(UniqueKeyPolicy); + if (UniqueKeyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UniqueKeyPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ConflictResolutionPolicy)) { writer.WritePropertyName("conflictResolutionPolicy"u8); - writer.WriteObjectValue(ConflictResolutionPolicy); + if (ConflictResolutionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConflictResolutionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ClientEncryptionPolicy)) { writer.WritePropertyName("clientEncryptionPolicy"u8); - writer.WriteObjectValue(ClientEncryptionPolicy); + if (ClientEncryptionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientEncryptionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { @@ -56,7 +98,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { @@ -66,13 +115,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MaterializedViewDefinition)) { writer.WritePropertyName("materializedViewDefinition"u8); - writer.WriteObjectValue(MaterializedViewDefinition); + if (MaterializedViewDefinition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaterializedViewDefinition).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ExtendedCosmosDBSqlContainerResourceInfo DeserializeExtendedCosmosDBSqlContainerResourceInfo(JsonElement element) + internal static ExtendedCosmosDBSqlContainerResourceInfo DeserializeExtendedCosmosDBSqlContainerResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +161,7 @@ internal static ExtendedCosmosDBSqlContainerResourceInfo DeserializeExtendedCosm Optional restoreParameters = default; Optional createMode = default; Optional materializedViewDefinition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -211,8 +282,61 @@ internal static ExtendedCosmosDBSqlContainerResourceInfo DeserializeExtendedCosm materializedViewDefinition = MaterializedViewDefinition.DeserializeMaterializedViewDefinition(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCosmosDBSqlContainerResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, clientEncryptionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), materializedViewDefinition.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCosmosDBSqlContainerResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCosmosDBSqlContainerResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCosmosDBSqlContainerResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCosmosDBSqlContainerResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCosmosDBSqlContainerResourceInfo model) + { + if (model is null) + { + return null; } - return new ExtendedCosmosDBSqlContainerResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, clientEncryptionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), materializedViewDefinition.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCosmosDBSqlContainerResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCosmosDBSqlContainerResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.cs index 0aa13a3dc1c2..76e38fcb9809 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlContainerResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCosmosDBSqlContainerResourceInfo. public partial class ExtendedCosmosDBSqlContainerResourceInfo : CosmosDBSqlContainerResourceInfo { - /// Initializes a new instance of ExtendedCosmosDBSqlContainerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// is null. public ExtendedCosmosDBSqlContainerResourceInfo(string containerName) : base(containerName) @@ -22,7 +23,7 @@ public ExtendedCosmosDBSqlContainerResourceInfo(string containerName) : base(con Argument.AssertNotNull(containerName, nameof(containerName)); } - /// Initializes a new instance of ExtendedCosmosDBSqlContainerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -37,13 +38,19 @@ public ExtendedCosmosDBSqlContainerResourceInfo(string containerName) : base(con /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedCosmosDBSqlContainerResourceInfo(string containerName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, CosmosDBClientEncryptionPolicy clientEncryptionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, MaterializedViewDefinition materializedViewDefinition, string rid, float? timestamp, ETag? etag) : base(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition) + /// Keeps track of any properties unknown to the library. + internal ExtendedCosmosDBSqlContainerResourceInfo(string containerName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, CosmosDBClientEncryptionPolicy clientEncryptionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, MaterializedViewDefinition materializedViewDefinition, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCosmosDBSqlContainerResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.Serialization.cs index 8192d59d385d..c5b25a9dd96f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCosmosDBSqlDatabaseResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCosmosDBSqlDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Colls)) { @@ -31,18 +38,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedCosmosDBSqlDatabaseResourceInfo DeserializeExtendedCosmosDBSqlDatabaseResourceInfo(JsonElement element) + internal static ExtendedCosmosDBSqlDatabaseResourceInfo DeserializeExtendedCosmosDBSqlDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +83,7 @@ internal static ExtendedCosmosDBSqlDatabaseResourceInfo DeserializeExtendedCosmo string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_colls"u8)) @@ -113,8 +142,61 @@ internal static ExtendedCosmosDBSqlDatabaseResourceInfo DeserializeExtendedCosmo createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCosmosDBSqlDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), colls.Value, users.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCosmosDBSqlDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCosmosDBSqlDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCosmosDBSqlDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCosmosDBSqlDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCosmosDBSqlDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCosmosDBSqlDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ExtendedCosmosDBSqlDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), colls.Value, users.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCosmosDBSqlDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.cs index 633d255e9f52..a017447eef8a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlDatabaseResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCosmosDBSqlDatabaseResourceInfo. public partial class ExtendedCosmosDBSqlDatabaseResourceInfo : CosmosDBSqlDatabaseResourceInfo { - /// Initializes a new instance of ExtendedCosmosDBSqlDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// is null. public ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName) : base(databaseName) @@ -22,7 +23,7 @@ public ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName) : base(datab Argument.AssertNotNull(databaseName, nameof(databaseName)); } - /// Initializes a new instance of ExtendedCosmosDBSqlDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -31,7 +32,8 @@ public ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName) : base(datab /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string colls, string users, string rid, float? timestamp, ETag? etag) : base(databaseName, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string colls, string users, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(databaseName, restoreParameters, createMode, serializedAdditionalRawData) { Colls = colls; Users = users; @@ -40,6 +42,11 @@ internal ExtendedCosmosDBSqlDatabaseResourceInfo(string databaseName, ResourceRe ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCosmosDBSqlDatabaseResourceInfo() + { + } + /// A system generated property that specified the addressable path of the collections resource. public string Colls { get; set; } /// A system generated property that specifies the addressable path of the users resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.Serialization.cs index 1982af4cea1a..223ed20bfddf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCosmosDBSqlStoredProcedureResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCosmosDBSqlStoredProcedureResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(StoredProcedureName); @@ -23,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("body"u8); writer.WriteStringValue(Body); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedCosmosDBSqlStoredProcedureResourceInfo DeserializeExtendedCosmosDBSqlStoredProcedureResourceInfo(JsonElement element) + internal static ExtendedCosmosDBSqlStoredProcedureResourceInfo DeserializeExtendedCosmosDBSqlStoredProcedureResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +58,7 @@ internal static ExtendedCosmosDBSqlStoredProcedureResourceInfo DeserializeExtend Optional etag = default; string id = default; Optional body = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -72,8 +94,61 @@ internal static ExtendedCosmosDBSqlStoredProcedureResourceInfo DeserializeExtend body = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCosmosDBSqlStoredProcedureResourceInfo(id, body.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCosmosDBSqlStoredProcedureResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCosmosDBSqlStoredProcedureResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCosmosDBSqlStoredProcedureResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCosmosDBSqlStoredProcedureResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCosmosDBSqlStoredProcedureResourceInfo model) + { + if (model is null) + { + return null; } - return new ExtendedCosmosDBSqlStoredProcedureResourceInfo(id, body.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCosmosDBSqlStoredProcedureResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCosmosDBSqlStoredProcedureResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.cs index 3644f2194713..16a5a7ef768a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlStoredProcedureResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCosmosDBSqlStoredProcedureResourceInfo. public partial class ExtendedCosmosDBSqlStoredProcedureResourceInfo : CosmosDBSqlStoredProcedureResourceInfo { - /// Initializes a new instance of ExtendedCosmosDBSqlStoredProcedureResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL storedProcedure. /// is null. public ExtendedCosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName) : base(storedProcedureName) @@ -22,19 +23,25 @@ public ExtendedCosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName Argument.AssertNotNull(storedProcedureName, nameof(storedProcedureName)); } - /// Initializes a new instance of ExtendedCosmosDBSqlStoredProcedureResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL storedProcedure. /// Body of the Stored Procedure. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedCosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName, string body, string rid, float? timestamp, ETag? etag) : base(storedProcedureName, body) + /// Keeps track of any properties unknown to the library. + internal ExtendedCosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName, string body, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(storedProcedureName, body, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCosmosDBSqlStoredProcedureResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.Serialization.cs index 28589f8d1082..1edae60bb3d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCosmosDBSqlTriggerResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCosmosDBSqlTriggerResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(TriggerName); @@ -33,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("triggerOperation"u8); writer.WriteStringValue(TriggerOperation.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedCosmosDBSqlTriggerResourceInfo DeserializeExtendedCosmosDBSqlTriggerResourceInfo(JsonElement element) + internal static ExtendedCosmosDBSqlTriggerResourceInfo DeserializeExtendedCosmosDBSqlTriggerResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static ExtendedCosmosDBSqlTriggerResourceInfo DeserializeExtendedCosmos Optional body = default; Optional triggerType = default; Optional triggerOperation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -102,8 +124,61 @@ internal static ExtendedCosmosDBSqlTriggerResourceInfo DeserializeExtendedCosmos triggerOperation = new CosmosDBSqlTriggerOperation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCosmosDBSqlTriggerResourceInfo(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCosmosDBSqlTriggerResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCosmosDBSqlTriggerResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCosmosDBSqlTriggerResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCosmosDBSqlTriggerResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCosmosDBSqlTriggerResourceInfo model) + { + if (model is null) + { + return null; } - return new ExtendedCosmosDBSqlTriggerResourceInfo(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCosmosDBSqlTriggerResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCosmosDBSqlTriggerResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.cs index 6f5a071d88d0..ee05d3629ab8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlTriggerResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCosmosDBSqlTriggerResourceInfo. public partial class ExtendedCosmosDBSqlTriggerResourceInfo : CosmosDBSqlTriggerResourceInfo { - /// Initializes a new instance of ExtendedCosmosDBSqlTriggerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL trigger. /// is null. public ExtendedCosmosDBSqlTriggerResourceInfo(string triggerName) : base(triggerName) @@ -22,7 +23,7 @@ public ExtendedCosmosDBSqlTriggerResourceInfo(string triggerName) : base(trigger Argument.AssertNotNull(triggerName, nameof(triggerName)); } - /// Initializes a new instance of ExtendedCosmosDBSqlTriggerResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL trigger. /// Body of the Trigger. /// Type of the Trigger. @@ -30,13 +31,19 @@ public ExtendedCosmosDBSqlTriggerResourceInfo(string triggerName) : base(trigger /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedCosmosDBSqlTriggerResourceInfo(string triggerName, string body, CosmosDBSqlTriggerType? triggerType, CosmosDBSqlTriggerOperation? triggerOperation, string rid, float? timestamp, ETag? etag) : base(triggerName, body, triggerType, triggerOperation) + /// Keeps track of any properties unknown to the library. + internal ExtendedCosmosDBSqlTriggerResourceInfo(string triggerName, string body, CosmosDBSqlTriggerType? triggerType, CosmosDBSqlTriggerOperation? triggerOperation, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(triggerName, body, triggerType, triggerOperation, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCosmosDBSqlTriggerResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs index 3184d21e0214..fb8c8af478fb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo : IUtf8JsonSerializable + public partial class ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(FunctionName); @@ -23,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("body"u8); writer.WriteStringValue(Body); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo DeserializeExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(JsonElement element) + internal static ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo DeserializeExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +58,7 @@ internal static ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo DeserializeEx Optional etag = default; string id = default; Optional body = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -72,8 +94,61 @@ internal static ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo DeserializeEx body = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(id, body.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo model) + { + if (model is null) + { + return null; } - return new ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(id, body.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.cs index 8c1aade38908..c13ac42acfe8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo. public partial class ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo : CosmosDBSqlUserDefinedFunctionResourceInfo { - /// Initializes a new instance of ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL userDefinedFunction. /// is null. public ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(string functionName) : base(functionName) @@ -22,19 +23,25 @@ public ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(string functionName) : Argument.AssertNotNull(functionName, nameof(functionName)); } - /// Initializes a new instance of ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL userDefinedFunction. /// Body of the User Defined Function. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(string functionName, string body, string rid, float? timestamp, ETag? etag) : base(functionName, body) + /// Keeps track of any properties unknown to the library. + internal ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo(string functionName, string body, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(functionName, body, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.Serialization.cs index ef0408ba067c..2b9d07fdda01 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.Serialization.cs @@ -5,34 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedGremlinDatabaseResourceInfo : IUtf8JsonSerializable + public partial class ExtendedGremlinDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(DatabaseName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedGremlinDatabaseResourceInfo DeserializeExtendedGremlinDatabaseResourceInfo(JsonElement element) + internal static ExtendedGremlinDatabaseResourceInfo DeserializeExtendedGremlinDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static ExtendedGremlinDatabaseResourceInfo DeserializeExtendedGremlinDa string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -91,8 +120,61 @@ internal static ExtendedGremlinDatabaseResourceInfo DeserializeExtendedGremlinDa createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedGremlinDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedGremlinDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedGremlinDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedGremlinDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedGremlinDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedGremlinDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedGremlinDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ExtendedGremlinDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedGremlinDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.cs index 13e9b219629d..fc0f40f3979b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinDatabaseResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedGremlinDatabaseResourceInfo. public partial class ExtendedGremlinDatabaseResourceInfo : GremlinDatabaseResourceInfo { - /// Initializes a new instance of ExtendedGremlinDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin database. /// is null. public ExtendedGremlinDatabaseResourceInfo(string databaseName) : base(databaseName) @@ -22,20 +23,26 @@ public ExtendedGremlinDatabaseResourceInfo(string databaseName) : base(databaseN Argument.AssertNotNull(databaseName, nameof(databaseName)); } - /// Initializes a new instance of ExtendedGremlinDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedGremlinDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag) : base(databaseName, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal ExtendedGremlinDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(databaseName, restoreParameters, createMode, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedGremlinDatabaseResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.Serialization.cs index d222c10901ae..48fc6726c246 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.Serialization.cs @@ -5,28 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedGremlinGraphResourceInfo : IUtf8JsonSerializable + public partial class ExtendedGremlinGraphResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(GraphName); if (Optional.IsDefined(IndexingPolicy)) { writer.WritePropertyName("indexingPolicy"u8); - writer.WriteObjectValue(IndexingPolicy); + if (IndexingPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IndexingPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionKey)) { writer.WritePropertyName("partitionKey"u8); - writer.WriteObjectValue(PartitionKey); + if (PartitionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionKey).Serialize(writer, options); + } } if (Optional.IsDefined(DefaultTtl)) { @@ -36,12 +57,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UniqueKeyPolicy)) { writer.WritePropertyName("uniqueKeyPolicy"u8); - writer.WriteObjectValue(UniqueKeyPolicy); + if (UniqueKeyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UniqueKeyPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ConflictResolutionPolicy)) { writer.WritePropertyName("conflictResolutionPolicy"u8); - writer.WriteObjectValue(ConflictResolutionPolicy); + if (ConflictResolutionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConflictResolutionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { @@ -51,18 +86,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedGremlinGraphResourceInfo DeserializeExtendedGremlinGraphResourceInfo(JsonElement element) + internal static ExtendedGremlinGraphResourceInfo DeserializeExtendedGremlinGraphResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +135,7 @@ internal static ExtendedGremlinGraphResourceInfo DeserializeExtendedGremlinGraph Optional analyticalStorageTtl = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -181,8 +238,61 @@ internal static ExtendedGremlinGraphResourceInfo DeserializeExtendedGremlinGraph createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedGremlinGraphResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedGremlinGraphResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedGremlinGraphResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedGremlinGraphResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedGremlinGraphResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedGremlinGraphResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedGremlinGraphResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ExtendedGremlinGraphResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedGremlinGraphResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.cs index 51d36df553d4..097cc2afdf3a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedGremlinGraphResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedGremlinGraphResourceInfo. public partial class ExtendedGremlinGraphResourceInfo : GremlinGraphResourceInfo { - /// Initializes a new instance of ExtendedGremlinGraphResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin graph. /// is null. public ExtendedGremlinGraphResourceInfo(string graphName) : base(graphName) @@ -22,7 +23,7 @@ public ExtendedGremlinGraphResourceInfo(string graphName) : base(graphName) Argument.AssertNotNull(graphName, nameof(graphName)); } - /// Initializes a new instance of ExtendedGremlinGraphResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin graph. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -35,13 +36,19 @@ public ExtendedGremlinGraphResourceInfo(string graphName) : base(graphName) /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedGremlinGraphResourceInfo(string graphName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag) : base(graphName, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal ExtendedGremlinGraphResourceInfo(string graphName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(graphName, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, analyticalStorageTtl, restoreParameters, createMode, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedGremlinGraphResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.Serialization.cs index 8a0eb7cd7c6d..689b7606c4a4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.Serialization.cs @@ -5,17 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedMongoDBCollectionResourceInfo : IUtf8JsonSerializable + public partial class ExtendedMongoDBCollectionResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(CollectionName); @@ -36,7 +42,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Indexes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -48,18 +61,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedMongoDBCollectionResourceInfo DeserializeExtendedMongoDBCollectionResourceInfo(JsonElement element) + internal static ExtendedMongoDBCollectionResourceInfo DeserializeExtendedMongoDBCollectionResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +107,7 @@ internal static ExtendedMongoDBCollectionResourceInfo DeserializeExtendedMongoDB Optional analyticalStorageTtl = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -158,8 +193,61 @@ internal static ExtendedMongoDBCollectionResourceInfo DeserializeExtendedMongoDB createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedMongoDBCollectionResourceInfo(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedMongoDBCollectionResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedMongoDBCollectionResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedMongoDBCollectionResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedMongoDBCollectionResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedMongoDBCollectionResourceInfo model) + { + if (model is null) + { + return null; } - return new ExtendedMongoDBCollectionResourceInfo(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedMongoDBCollectionResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedMongoDBCollectionResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.cs index 5868c8a95971..cd97973f7593 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBCollectionResourceInfo.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedMongoDBCollectionResourceInfo. public partial class ExtendedMongoDBCollectionResourceInfo : MongoDBCollectionResourceInfo { - /// Initializes a new instance of ExtendedMongoDBCollectionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB collection. /// is null. public ExtendedMongoDBCollectionResourceInfo(string collectionName) : base(collectionName) @@ -23,7 +23,7 @@ public ExtendedMongoDBCollectionResourceInfo(string collectionName) : base(colle Argument.AssertNotNull(collectionName, nameof(collectionName)); } - /// Initializes a new instance of ExtendedMongoDBCollectionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB collection. /// A key-value pair of shard keys to be applied for the request. /// List of index keys. @@ -33,13 +33,19 @@ public ExtendedMongoDBCollectionResourceInfo(string collectionName) : base(colle /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedMongoDBCollectionResourceInfo(string collectionName, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag) : base(collectionName, shardKey, indexes, analyticalStorageTtl, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal ExtendedMongoDBCollectionResourceInfo(string collectionName, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(collectionName, shardKey, indexes, analyticalStorageTtl, restoreParameters, createMode, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedMongoDBCollectionResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.Serialization.cs index 1eecb9f4cf90..9b0add982ec6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.Serialization.cs @@ -5,34 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedMongoDBDatabaseResourceInfo : IUtf8JsonSerializable + public partial class ExtendedMongoDBDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(DatabaseName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExtendedMongoDBDatabaseResourceInfo DeserializeExtendedMongoDBDatabaseResourceInfo(JsonElement element) + internal static ExtendedMongoDBDatabaseResourceInfo DeserializeExtendedMongoDBDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static ExtendedMongoDBDatabaseResourceInfo DeserializeExtendedMongoDBDa string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -91,8 +120,61 @@ internal static ExtendedMongoDBDatabaseResourceInfo DeserializeExtendedMongoDBDa createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedMongoDBDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedMongoDBDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedMongoDBDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedMongoDBDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedMongoDBDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedMongoDBDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedMongoDBDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ExtendedMongoDBDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedMongoDBDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.cs index 5ccbde252b25..9092e8f85cdb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedMongoDBDatabaseResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedMongoDBDatabaseResourceInfo. public partial class ExtendedMongoDBDatabaseResourceInfo : MongoDBDatabaseResourceInfo { - /// Initializes a new instance of ExtendedMongoDBDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB database. /// is null. public ExtendedMongoDBDatabaseResourceInfo(string databaseName) : base(databaseName) @@ -22,20 +23,26 @@ public ExtendedMongoDBDatabaseResourceInfo(string databaseName) : base(databaseN Argument.AssertNotNull(databaseName, nameof(databaseName)); } - /// Initializes a new instance of ExtendedMongoDBDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedMongoDBDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag) : base(databaseName, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal ExtendedMongoDBDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(databaseName, restoreParameters, createMode, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; ETag = etag; } + /// Initializes a new instance of for deserialization. + internal ExtendedMongoDBDatabaseResourceInfo() + { + } + /// A system generated property. A unique identifier. public string Rid { get; } /// A system generated property that denotes the last updated timestamp of the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.Serialization.cs index 294ce89d4c19..f1865ea15ba5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableGremlinDatabaseResourceInfo + public partial class ExtendedRestorableGremlinDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableGremlinDatabaseResourceInfo DeserializeExtendedRestorableGremlinDatabaseResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableGremlinDatabaseResourceInfo DeserializeExtendedRestorableGremlinDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ExtendedRestorableGremlinDatabaseResourceInfo DeserializeExtende Optional eventTimestamp = default; Optional ownerId = default; Optional ownerResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -54,8 +83,61 @@ internal static ExtendedRestorableGremlinDatabaseResourceInfo DeserializeExtende ownerResourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableGremlinDatabaseResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + return new ExtendedRestorableGremlinDatabaseResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, serializedAdditionalRawData); + } + + ExtendedRestorableGremlinDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableGremlinDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableGremlinDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableGremlinDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableGremlinDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableGremlinDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableGremlinDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.cs index a520a214e059..0c1204a5cb06 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinDatabaseResourceInfo.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB Gremlin database event. public partial class ExtendedRestorableGremlinDatabaseResourceInfo { - /// Initializes a new instance of ExtendedRestorableGremlinDatabaseResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableGremlinDatabaseResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableGremlinDatabaseResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this database event. /// The time when this database event happened. /// The name of this Gremlin database. /// The resource ID of this Gremlin database. - internal ExtendedRestorableGremlinDatabaseResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string databaseName, string databaseId) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableGremlinDatabaseResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string databaseName, string databaseId, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; EventTimestamp = eventTimestamp; DatabaseName = databaseName; DatabaseId = databaseId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.Serialization.cs index 41a47406761b..a513625a5ff2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableGremlinGraphResourceInfo + public partial class ExtendedRestorableGremlinGraphResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableGremlinGraphResourceInfo DeserializeExtendedRestorableGremlinGraphResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableGremlinGraphResourceInfo DeserializeExtendedRestorableGremlinGraphResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ExtendedRestorableGremlinGraphResourceInfo DeserializeExtendedRe Optional eventTimestamp = default; Optional ownerId = default; Optional ownerResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -54,8 +83,61 @@ internal static ExtendedRestorableGremlinGraphResourceInfo DeserializeExtendedRe ownerResourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableGremlinGraphResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + return new ExtendedRestorableGremlinGraphResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, serializedAdditionalRawData); + } + + ExtendedRestorableGremlinGraphResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableGremlinGraphResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableGremlinGraphResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableGremlinGraphResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableGremlinGraphResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableGremlinGraphResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableGremlinGraphResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.cs index 412f8ba1150a..1b13e1a98bd0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableGremlinGraphResourceInfo.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB Gremlin graph event. public partial class ExtendedRestorableGremlinGraphResourceInfo { - /// Initializes a new instance of ExtendedRestorableGremlinGraphResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableGremlinGraphResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableGremlinGraphResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this graph event. /// The time when this graph event happened. /// The name of this Gremlin graph. /// The resource ID of this Gremlin graph. - internal ExtendedRestorableGremlinGraphResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string graphName, string graphId) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableGremlinGraphResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string graphName, string graphId, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; EventTimestamp = eventTimestamp; GraphName = graphName; GraphId = graphId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.Serialization.cs index a0597becca77..2fac78fa189f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableMongoDBCollectionResourceInfo + public partial class ExtendedRestorableMongoDBCollectionResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableMongoDBCollectionResourceInfo DeserializeExtendedRestorableMongoDBCollectionResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableMongoDBCollectionResourceInfo DeserializeExtendedRestorableMongoDBCollectionResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ExtendedRestorableMongoDBCollectionResourceInfo DeserializeExten Optional eventTimestamp = default; Optional ownerId = default; Optional ownerResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -54,8 +83,61 @@ internal static ExtendedRestorableMongoDBCollectionResourceInfo DeserializeExten ownerResourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableMongoDBCollectionResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + return new ExtendedRestorableMongoDBCollectionResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, serializedAdditionalRawData); + } + + ExtendedRestorableMongoDBCollectionResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableMongoDBCollectionResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableMongoDBCollectionResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableMongoDBCollectionResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableMongoDBCollectionResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableMongoDBCollectionResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableMongoDBCollectionResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.cs index 64815045a1cb..73a87f8c49ff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBCollectionResourceInfo.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB MongoDB collection event. public partial class ExtendedRestorableMongoDBCollectionResourceInfo { - /// Initializes a new instance of ExtendedRestorableMongoDBCollectionResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableMongoDBCollectionResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableMongoDBCollectionResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this collection event. /// The time when this collection event happened. /// The name of this MongoDB collection. /// The resource ID of this MongoDB collection. - internal ExtendedRestorableMongoDBCollectionResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string collectionName, string collectionId) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableMongoDBCollectionResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string collectionName, string collectionId, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; EventTimestamp = eventTimestamp; CollectionName = collectionName; CollectionId = collectionId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.Serialization.cs index b49f038e951a..6ba211965772 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableMongoDBDatabaseResourceInfo + public partial class ExtendedRestorableMongoDBDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableMongoDBDatabaseResourceInfo DeserializeExtendedRestorableMongoDBDatabaseResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableMongoDBDatabaseResourceInfo DeserializeExtendedRestorableMongoDBDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ExtendedRestorableMongoDBDatabaseResourceInfo DeserializeExtende Optional eventTimestamp = default; Optional ownerId = default; Optional ownerResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -54,8 +83,61 @@ internal static ExtendedRestorableMongoDBDatabaseResourceInfo DeserializeExtende ownerResourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableMongoDBDatabaseResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + return new ExtendedRestorableMongoDBDatabaseResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, serializedAdditionalRawData); + } + + ExtendedRestorableMongoDBDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableMongoDBDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableMongoDBDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableMongoDBDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableMongoDBDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableMongoDBDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableMongoDBDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.cs index e17df3cb499e..ad83852de9ec 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableMongoDBDatabaseResourceInfo.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB MongoDB database event. public partial class ExtendedRestorableMongoDBDatabaseResourceInfo { - /// Initializes a new instance of ExtendedRestorableMongoDBDatabaseResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableMongoDBDatabaseResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableMongoDBDatabaseResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this database event. /// The time when this database event happened. /// The name of this MongoDB database. /// The resource ID of this MongoDB database. - internal ExtendedRestorableMongoDBDatabaseResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string databaseName, string databaseId) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableMongoDBDatabaseResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string databaseName, string databaseId, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; EventTimestamp = eventTimestamp; DatabaseName = databaseName; DatabaseId = databaseId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.Serialization.cs index 459239259b34..562d465a4035 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.Serialization.cs @@ -5,15 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableSqlContainerResourceInfo + public partial class ExtendedRestorableSqlContainerResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableSqlContainerResourceInfo DeserializeExtendedRestorableSqlContainerResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Container)) + { + writer.WritePropertyName("container"u8); + if (Container is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Container).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableSqlContainerResourceInfo DeserializeExtendedRestorableSqlContainerResourceInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +64,7 @@ internal static ExtendedRestorableSqlContainerResourceInfo DeserializeExtendedRe Optional ownerId = default; Optional ownerResourceId = default; Optional container = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -64,8 +105,61 @@ internal static ExtendedRestorableSqlContainerResourceInfo DeserializeExtendedRe container = RestorableSqlContainerPropertiesResourceContainer.DeserializeRestorableSqlContainerPropertiesResourceContainer(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableSqlContainerResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, container.Value); + return new ExtendedRestorableSqlContainerResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, container.Value, serializedAdditionalRawData); + } + + ExtendedRestorableSqlContainerResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableSqlContainerResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableSqlContainerResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableSqlContainerResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableSqlContainerResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableSqlContainerResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableSqlContainerResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.cs index 44571ad96369..4495768f614b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlContainerResourceInfo.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB SQL container event. public partial class ExtendedRestorableSqlContainerResourceInfo { - /// Initializes a new instance of ExtendedRestorableSqlContainerResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableSqlContainerResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableSqlContainerResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this container event. /// The when this container event happened. /// The name of this SQL container. /// The resource ID of this SQL container. /// Cosmos DB SQL container resource object. - internal ExtendedRestorableSqlContainerResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string containerName, string containerId, RestorableSqlContainerPropertiesResourceContainer container) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableSqlContainerResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string containerName, string containerId, RestorableSqlContainerPropertiesResourceContainer container, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; @@ -30,6 +37,7 @@ internal ExtendedRestorableSqlContainerResourceInfo(string rid, CosmosDBOperatio ContainerName = containerName; ContainerId = containerId; Container = container; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.Serialization.cs index 70dfe9afd471..7a7f75315d14 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.Serialization.cs @@ -5,15 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableSqlDatabaseResourceInfo + public partial class ExtendedRestorableSqlDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableSqlDatabaseResourceInfo DeserializeExtendedRestorableSqlDatabaseResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Database)) + { + writer.WritePropertyName("database"u8); + if (Database is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Database).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableSqlDatabaseResourceInfo DeserializeExtendedRestorableSqlDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +64,7 @@ internal static ExtendedRestorableSqlDatabaseResourceInfo DeserializeExtendedRes Optional ownerId = default; Optional ownerResourceId = default; Optional database = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -64,8 +105,61 @@ internal static ExtendedRestorableSqlDatabaseResourceInfo DeserializeExtendedRes database = RestorableSqlDatabasePropertiesResourceDatabase.DeserializeRestorableSqlDatabasePropertiesResourceDatabase(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableSqlDatabaseResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, database.Value); + return new ExtendedRestorableSqlDatabaseResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, database.Value, serializedAdditionalRawData); + } + + ExtendedRestorableSqlDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableSqlDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableSqlDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableSqlDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableSqlDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableSqlDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableSqlDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.cs index 3c6491ac82b7..0c73d5ba58d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableSqlDatabaseResourceInfo.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB SQL database event. public partial class ExtendedRestorableSqlDatabaseResourceInfo { - /// Initializes a new instance of ExtendedRestorableSqlDatabaseResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableSqlDatabaseResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableSqlDatabaseResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this database event. /// The time when this database event happened. /// The name of the SQL database. /// The resource ID of the SQL database. /// Cosmos DB SQL database resource object. - internal ExtendedRestorableSqlDatabaseResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string databaseName, string databaseId, RestorableSqlDatabasePropertiesResourceDatabase database) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableSqlDatabaseResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string databaseName, string databaseId, RestorableSqlDatabasePropertiesResourceDatabase database, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; @@ -30,6 +37,7 @@ internal ExtendedRestorableSqlDatabaseResourceInfo(string rid, CosmosDBOperation DatabaseName = databaseName; DatabaseId = databaseId; Database = database; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.Serialization.cs index 710fc7ab90fc..42d20f7068b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedRestorableTableResourceInfo + public partial class ExtendedRestorableTableResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExtendedRestorableTableResourceInfo DeserializeExtendedRestorableTableResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExtendedRestorableTableResourceInfo DeserializeExtendedRestorableTableResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +51,7 @@ internal static ExtendedRestorableTableResourceInfo DeserializeExtendedRestorabl Optional eventTimestamp = default; Optional ownerId = default; Optional ownerResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -54,8 +83,61 @@ internal static ExtendedRestorableTableResourceInfo DeserializeExtendedRestorabl ownerResourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExtendedRestorableTableResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value); + return new ExtendedRestorableTableResourceInfo(rid.Value, Optional.ToNullable(operationType), eventTimestamp.Value, ownerId.Value, ownerResourceId.Value, serializedAdditionalRawData); + } + + ExtendedRestorableTableResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedRestorableTableResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedRestorableTableResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedRestorableTableResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedRestorableTableResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedRestorableTableResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedRestorableTableResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.cs index 4ee036d18393..74ab15f14db3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedRestorableTableResourceInfo.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The resource of an Azure Cosmos DB Table event. public partial class ExtendedRestorableTableResourceInfo { - /// Initializes a new instance of ExtendedRestorableTableResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExtendedRestorableTableResourceInfo() { } - /// Initializes a new instance of ExtendedRestorableTableResourceInfo. + /// Initializes a new instance of . /// A system generated property. A unique identifier. /// The operation type of this table event. /// The time when this table event happened. /// The name of this Table. /// The resource ID of this Table. - internal ExtendedRestorableTableResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string tableName, string tableId) + /// Keeps track of any properties unknown to the library. + internal ExtendedRestorableTableResourceInfo(string rid, CosmosDBOperationType? operationType, string eventTimestamp, string tableName, string tableId, Dictionary serializedAdditionalRawData) { Rid = rid; OperationType = operationType; EventTimestamp = eventTimestamp; TableName = tableName; TableId = tableId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs index 281833e22667..b326a4c100b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ExtendedThroughputSettingsResourceInfo : IUtf8JsonSerializable + public partial class ExtendedThroughputSettingsResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -24,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroughputSettingsResourceInfo(JsonElement element) + internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroughputSettingsResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +70,7 @@ internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroug Optional autoscaleSettings = default; Optional minimumThroughput = default; Optional offerReplacePending = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -95,8 +124,61 @@ internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroug offerReplacePending = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExtendedThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + ExtendedThroughputSettingsResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedThroughputSettingsResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExtendedThroughputSettingsResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExtendedThroughputSettingsResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExtendedThroughputSettingsResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExtendedThroughputSettingsResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ExtendedThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExtendedThroughputSettingsResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs index f19bfd8672e3..240609cc2619 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,12 +14,12 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The ExtendedThroughputSettingsResourceInfo. public partial class ExtendedThroughputSettingsResourceInfo : ThroughputSettingsResourceInfo { - /// Initializes a new instance of ExtendedThroughputSettingsResourceInfo. + /// Initializes a new instance of . public ExtendedThroughputSettingsResourceInfo() { } - /// Initializes a new instance of ExtendedThroughputSettingsResourceInfo. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. @@ -25,7 +27,8 @@ public ExtendedThroughputSettingsResourceInfo() /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, float? timestamp, ETag? etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending) + /// Keeps track of any properties unknown to the library. + internal ExtendedThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, serializedAdditionalRawData) { Rid = rid; Timestamp = timestamp; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.Serialization.cs index 4abf0d4bd83d..aca22b2084f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class FirewallRuleListResult + internal partial class FirewallRuleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static FirewallRuleListResult DeserializeFirewallRuleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static FirewallRuleListResult DeserializeFirewallRuleListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static FirewallRuleListResult DeserializeFirewallRuleListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new FirewallRuleListResult(Optional.ToList(value), nextLink.Value); + return new FirewallRuleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + FirewallRuleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFirewallRuleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FirewallRuleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFirewallRuleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FirewallRuleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FirewallRuleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFirewallRuleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.cs index 3b68f54eaea4..dab86fc4ea96 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/FirewallRuleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A list of firewall rules. internal partial class FirewallRuleListResult { - /// Initializes a new instance of FirewallRuleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal FirewallRuleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of FirewallRuleListResult. + /// Initializes a new instance of . /// The list of firewall rules in a mongo cluster. /// The link used to get the next page of results. - internal FirewallRuleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal FirewallRuleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of firewall rules in a mongo cluster. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.Serialization.cs index db927c6d12c6..29a82ed8076f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GraphApiComputeRegionalService + public partial class GraphApiComputeRegionalService : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GraphApiComputeRegionalService DeserializeGraphApiComputeRegionalService(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GraphApiComputeRegionalService DeserializeGraphApiComputeRegionalService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static GraphApiComputeRegionalService DeserializeGraphApiComputeRegiona Optional name = default; Optional location = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("graphApiComputeEndpoint"u8)) @@ -52,8 +81,61 @@ internal static GraphApiComputeRegionalService DeserializeGraphApiComputeRegiona status = new CosmosDBServiceStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GraphApiComputeRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), graphApiComputeEndpoint.Value); + return new GraphApiComputeRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), graphApiComputeEndpoint.Value, serializedAdditionalRawData); + } + + GraphApiComputeRegionalService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphApiComputeRegionalService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphApiComputeRegionalService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphApiComputeRegionalService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphApiComputeRegionalService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphApiComputeRegionalService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphApiComputeRegionalService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.cs index f7716160bd5a..45d605f4875a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeRegionalService.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource for a regional service location. public partial class GraphApiComputeRegionalService : CosmosDBRegionalService { - /// Initializes a new instance of GraphApiComputeRegionalService. + /// Initializes a new instance of . internal GraphApiComputeRegionalService() { } - /// Initializes a new instance of GraphApiComputeRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. /// The regional endpoint for GraphAPICompute. - internal GraphApiComputeRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, string graphApiComputeEndpoint) : base(name, location, status) + /// Keeps track of any properties unknown to the library. + internal GraphApiComputeRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, string graphApiComputeEndpoint, Dictionary serializedAdditionalRawData) : base(name, location, status, serializedAdditionalRawData) { GraphApiComputeEndpoint = graphApiComputeEndpoint; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.Serialization.cs index ede44cee4a04..ea8459da4e34 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GraphApiComputeServiceProperties : IUtf8JsonSerializable + public partial class GraphApiComputeServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GraphApiComputeEndpoint)) { @@ -46,8 +52,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GraphApiComputeServiceProperties DeserializeGraphApiComputeServiceProperties(JsonElement element) + internal static GraphApiComputeServiceProperties DeserializeGraphApiComputeServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -128,5 +136,53 @@ internal static GraphApiComputeServiceProperties DeserializeGraphApiComputeServi additionalProperties = additionalPropertiesDictionary; return new GraphApiComputeServiceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, graphApiComputeEndpoint.Value, Optional.ToList(locations)); } + + GraphApiComputeServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphApiComputeServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphApiComputeServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphApiComputeServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphApiComputeServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphApiComputeServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphApiComputeServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.cs index cba572d0a2c2..81aa6d0e0b78 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphApiComputeServiceProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties for GraphAPIComputeServiceResource. public partial class GraphApiComputeServiceProperties : CosmosDBServiceProperties { - /// Initializes a new instance of GraphApiComputeServiceProperties. + /// Initializes a new instance of . public GraphApiComputeServiceProperties() { Locations = new ChangeTrackingList(); ServiceType = CosmosDBServiceType.GraphApiCompute; } - /// Initializes a new instance of GraphApiComputeServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs index 240e041eb345..ab3123dab016 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GraphResourceGetPropertiesOptions : IUtf8JsonSerializable + public partial class GraphResourceGetPropertiesOptions : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GraphResourceGetPropertiesOptions DeserializeGraphResourceGetPropertiesOptions(JsonElement element) + internal static GraphResourceGetPropertiesOptions DeserializeGraphResourceGetPropertiesOptions(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static GraphResourceGetPropertiesOptions DeserializeGraphResourceGetPro autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GraphResourceGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + GraphResourceGetPropertiesOptions IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphResourceGetPropertiesOptions(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphResourceGetPropertiesOptions IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphResourceGetPropertiesOptions(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphResourceGetPropertiesOptions model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphResourceGetPropertiesOptions(Response response) + { + if (response is null) + { + return null; } - return new GraphResourceGetPropertiesOptions(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphResourceGetPropertiesOptions(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs index 44277e437b2a..585a33e249b4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetPropertiesOptions.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The GraphResourceGetPropertiesOptions. public partial class GraphResourceGetPropertiesOptions : CosmosDBBaseConfig { - /// Initializes a new instance of GraphResourceGetPropertiesOptions. + /// Initializes a new instance of . public GraphResourceGetPropertiesOptions() { } - /// Initializes a new instance of GraphResourceGetPropertiesOptions. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal GraphResourceGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal GraphResourceGetPropertiesOptions(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.Serialization.cs index 0b4c8766a972..4a36fd25ecbd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GraphResourceGetResultCreateOrUpdateContent : IUtf8JsonSerializable + public partial class GraphResourceGetResultCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -43,14 +50,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, Resource); if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GraphResourceGetResultCreateOrUpdateContent DeserializeGraphResourceGetResultCreateOrUpdateContent(JsonElement element) + internal static GraphResourceGetResultCreateOrUpdateContent DeserializeGraphResourceGetResultCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +92,7 @@ internal static GraphResourceGetResultCreateOrUpdateContent DeserializeGraphReso Optional systemData = default; WritableSubResource resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +174,61 @@ internal static GraphResourceGetResultCreateOrUpdateContent DeserializeGraphReso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GraphResourceGetResultCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + GraphResourceGetResultCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphResourceGetResultCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphResourceGetResultCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphResourceGetResultCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphResourceGetResultCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphResourceGetResultCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; } - return new GraphResourceGetResultCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphResourceGetResultCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.cs index 9ae5c75ba76b..6270341d0292 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultCreateOrUpdateContent.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Graph resource. public partial class GraphResourceGetResultCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of GraphResourceGetResultCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Graph resource. /// is null. @@ -27,7 +30,7 @@ public GraphResourceGetResultCreateOrUpdateContent(AzureLocation location, Writa Resource = resource; } - /// Initializes a new instance of GraphResourceGetResultCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,11 +40,18 @@ public GraphResourceGetResultCreateOrUpdateContent(AzureLocation location, Writa /// The standard JSON format of a Graph resource. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal GraphResourceGetResultCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WritableSubResource resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GraphResourceGetResultCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WritableSubResource resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GraphResourceGetResultCreateOrUpdateContent() + { } /// The standard JSON format of a Graph resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultData.Serialization.cs index cf9cda31de2d..38986ebf4a97 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourceGetResultData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class GraphResourceGetResultData : IUtf8JsonSerializable + public partial class GraphResourceGetResultData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -48,14 +55,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GraphResourceGetResultData DeserializeGraphResourceGetResultData(JsonElement element) + internal static GraphResourceGetResultData DeserializeGraphResourceGetResultData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +97,7 @@ internal static GraphResourceGetResultData DeserializeGraphResourceGetResultData Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -154,8 +183,61 @@ internal static GraphResourceGetResultData DeserializeGraphResourceGetResultData } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GraphResourceGetResultData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + GraphResourceGetResultData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphResourceGetResultData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphResourceGetResultData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphResourceGetResultData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphResourceGetResultData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphResourceGetResultData(Response response) + { + if (response is null) + { + return null; } - return new GraphResourceGetResultData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphResourceGetResultData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs index a009a8b5f0d1..3f67e5e8fad4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class GraphResourcesListResult + internal partial class GraphResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GraphResourcesListResult DeserializeGraphResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GraphResourcesListResult DeserializeGraphResourcesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static GraphResourcesListResult DeserializeGraphResourcesListResult(Jso value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GraphResourcesListResult(Optional.ToList(value)); + return new GraphResourcesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + GraphResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGraphResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GraphResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGraphResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GraphResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GraphResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGraphResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs index 17ed1bba3f26..f8585317342d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GraphResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Graph resource and their properties. internal partial class GraphResourcesListResult { - /// Initializes a new instance of GraphResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GraphResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GraphResourcesListResult. + /// Initializes a new instance of . /// List of Graph resource and their properties. - internal GraphResourcesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal GraphResourcesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Graph resource and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.Serialization.cs index 4ca2ea4339aa..fb913b96dc59 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinDatabaseCreateOrUpdateContent : IUtf8JsonSerializable + public partial class GremlinDatabaseCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinDatabaseCreateOrUpdateContent DeserializeGremlinDatabaseCreateOrUpdateContent(JsonElement element) + internal static GremlinDatabaseCreateOrUpdateContent DeserializeGremlinDatabaseCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static GremlinDatabaseCreateOrUpdateContent DeserializeGremlinDatabaseC Optional systemData = default; GremlinDatabaseResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static GremlinDatabaseCreateOrUpdateContent DeserializeGremlinDatabaseC } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinDatabaseCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + GremlinDatabaseCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinDatabaseCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinDatabaseCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinDatabaseCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinDatabaseCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new GremlinDatabaseCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinDatabaseCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinDatabaseCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.cs index 76fec43eaa87..2d06017b76d4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Gremlin database. public partial class GremlinDatabaseCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of GremlinDatabaseCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Gremlin database. /// is null. @@ -26,7 +29,7 @@ public GremlinDatabaseCreateOrUpdateContent(AzureLocation location, GremlinDatab Resource = resource; } - /// Initializes a new instance of GremlinDatabaseCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public GremlinDatabaseCreateOrUpdateContent(AzureLocation location, GremlinDatab /// The standard JSON format of a Gremlin database. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal GremlinDatabaseCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GremlinDatabaseResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GremlinDatabaseCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GremlinDatabaseResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GremlinDatabaseCreateOrUpdateContent() + { } /// The standard JSON format of a Gremlin database. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseData.Serialization.cs index f3ae4854efb8..f6b129f8d3f2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class GremlinDatabaseData : IUtf8JsonSerializable + public partial class GremlinDatabaseData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinDatabaseData DeserializeGremlinDatabaseData(JsonElement element) + internal static GremlinDatabaseData DeserializeGremlinDatabaseData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static GremlinDatabaseData DeserializeGremlinDatabaseData(JsonElement e Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static GremlinDatabaseData DeserializeGremlinDatabaseData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinDatabaseData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + GremlinDatabaseData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinDatabaseData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinDatabaseData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinDatabaseData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinDatabaseData model) + { + if (model is null) + { + return null; } - return new GremlinDatabaseData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinDatabaseData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinDatabaseData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs index bae5e17f4ac4..43f76475facc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class GremlinDatabaseListResult + internal partial class GremlinDatabaseListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GremlinDatabaseListResult DeserializeGremlinDatabaseListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GremlinDatabaseListResult DeserializeGremlinDatabaseListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static GremlinDatabaseListResult DeserializeGremlinDatabaseListResult(J value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GremlinDatabaseListResult(Optional.ToList(value)); + return new GremlinDatabaseListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + GremlinDatabaseListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinDatabaseListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinDatabaseListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinDatabaseListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinDatabaseListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinDatabaseListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinDatabaseListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs index 15514b4b8081..6bd51f171ea6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Gremlin databases and their properties. internal partial class GremlinDatabaseListResult { - /// Initializes a new instance of GremlinDatabaseListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GremlinDatabaseListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GremlinDatabaseListResult. + /// Initializes a new instance of . /// List of Gremlin databases and their properties. - internal GremlinDatabaseListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal GremlinDatabaseListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Gremlin databases and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.Serialization.cs index dba3ce545aa8..78ec4e1670f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinDatabasePropertiesConfig : IUtf8JsonSerializable + public partial class GremlinDatabasePropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GremlinDatabasePropertiesConfig DeserializeGremlinDatabasePropertiesConfig(JsonElement element) + internal static GremlinDatabasePropertiesConfig DeserializeGremlinDatabasePropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static GremlinDatabasePropertiesConfig DeserializeGremlinDatabaseProper autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinDatabasePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + GremlinDatabasePropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinDatabasePropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinDatabasePropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinDatabasePropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinDatabasePropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinDatabasePropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new GremlinDatabasePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinDatabasePropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.cs index 3dcf699d1401..423dfa3ba5a4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabasePropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The GremlinDatabasePropertiesConfig. public partial class GremlinDatabasePropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of GremlinDatabasePropertiesConfig. + /// Initializes a new instance of . public GremlinDatabasePropertiesConfig() { } - /// Initializes a new instance of GremlinDatabasePropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal GremlinDatabasePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal GremlinDatabasePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.Serialization.cs index 47d4c618f589..7bca9f249b91 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.Serialization.cs @@ -5,33 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinDatabaseResourceInfo : IUtf8JsonSerializable + public partial class GremlinDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(DatabaseName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinDatabaseResourceInfo DeserializeGremlinDatabaseResourceInfo(JsonElement element) + internal static GremlinDatabaseResourceInfo DeserializeGremlinDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static GremlinDatabaseResourceInfo DeserializeGremlinDatabaseResourceIn string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -64,8 +94,61 @@ internal static GremlinDatabaseResourceInfo DeserializeGremlinDatabaseResourceIn createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + GremlinDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new GremlinDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.cs index 7e65b23777df..da9a5166032f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB Gremlin database resource object. public partial class GremlinDatabaseResourceInfo { - /// Initializes a new instance of GremlinDatabaseResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin database. /// is null. public GremlinDatabaseResourceInfo(string databaseName) @@ -23,15 +27,22 @@ public GremlinDatabaseResourceInfo(string databaseName) DatabaseName = databaseName; } - /// Initializes a new instance of GremlinDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. - internal GremlinDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode) + /// Keeps track of any properties unknown to the library. + internal GremlinDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, Dictionary serializedAdditionalRawData) { DatabaseName = databaseName; RestoreParameters = restoreParameters; CreateMode = createMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GremlinDatabaseResourceInfo() + { } /// Name of the Cosmos DB Gremlin database. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.Serialization.cs index bfdd5b5230b2..531d9e006873 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinDatabaseRestoreResourceInfo : IUtf8JsonSerializable + public partial class GremlinDatabaseRestoreResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DatabaseName)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinDatabaseRestoreResourceInfo DeserializeGremlinDatabaseRestoreResourceInfo(JsonElement element) + internal static GremlinDatabaseRestoreResourceInfo DeserializeGremlinDatabaseRestoreResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional databaseName = default; Optional> graphNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -63,8 +85,61 @@ internal static GremlinDatabaseRestoreResourceInfo DeserializeGremlinDatabaseRes graphNames = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinDatabaseRestoreResourceInfo(databaseName.Value, Optional.ToList(graphNames), serializedAdditionalRawData); + } + + GremlinDatabaseRestoreResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinDatabaseRestoreResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinDatabaseRestoreResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinDatabaseRestoreResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinDatabaseRestoreResourceInfo model) + { + if (model is null) + { + return null; } - return new GremlinDatabaseRestoreResourceInfo(databaseName.Value, Optional.ToList(graphNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinDatabaseRestoreResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinDatabaseRestoreResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.cs index b8df48ac7cd6..512aa38cb0dc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinDatabaseRestoreResourceInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Specific Gremlin Databases to restore. public partial class GremlinDatabaseRestoreResourceInfo { - /// Initializes a new instance of GremlinDatabaseRestoreResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GremlinDatabaseRestoreResourceInfo() { GraphNames = new ChangeTrackingList(); } - /// Initializes a new instance of GremlinDatabaseRestoreResourceInfo. + /// Initializes a new instance of . /// The name of the gremlin database available for restore. /// The names of the graphs available for restore. - internal GremlinDatabaseRestoreResourceInfo(string databaseName, IList graphNames) + /// Keeps track of any properties unknown to the library. + internal GremlinDatabaseRestoreResourceInfo(string databaseName, IList graphNames, Dictionary serializedAdditionalRawData) { DatabaseName = databaseName; GraphNames = graphNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the gremlin database available for restore. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.Serialization.cs index 1c736d62d710..4afc8b6c15fd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinGraphCreateOrUpdateContent : IUtf8JsonSerializable + public partial class GremlinGraphCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinGraphCreateOrUpdateContent DeserializeGremlinGraphCreateOrUpdateContent(JsonElement element) + internal static GremlinGraphCreateOrUpdateContent DeserializeGremlinGraphCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static GremlinGraphCreateOrUpdateContent DeserializeGremlinGraphCreateO Optional systemData = default; GremlinGraphResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static GremlinGraphCreateOrUpdateContent DeserializeGremlinGraphCreateO } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinGraphCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + GremlinGraphCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinGraphCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinGraphCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinGraphCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinGraphCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new GremlinGraphCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinGraphCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinGraphCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.cs index 00d148d7fea1..21bf20830cc3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB Gremlin graph. public partial class GremlinGraphCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of GremlinGraphCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a Gremlin graph. /// is null. @@ -26,7 +29,7 @@ public GremlinGraphCreateOrUpdateContent(AzureLocation location, GremlinGraphRes Resource = resource; } - /// Initializes a new instance of GremlinGraphCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public GremlinGraphCreateOrUpdateContent(AzureLocation location, GremlinGraphRes /// The standard JSON format of a Gremlin graph. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal GremlinGraphCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GremlinGraphResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal GremlinGraphCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, GremlinGraphResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GremlinGraphCreateOrUpdateContent() + { } /// The standard JSON format of a Gremlin graph. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphData.Serialization.cs index 9c3716a1f2b1..f7ec990762ee 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class GremlinGraphData : IUtf8JsonSerializable + public partial class GremlinGraphData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinGraphData DeserializeGremlinGraphData(JsonElement element) + internal static GremlinGraphData DeserializeGremlinGraphData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static GremlinGraphData DeserializeGremlinGraphData(JsonElement element Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static GremlinGraphData DeserializeGremlinGraphData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinGraphData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + GremlinGraphData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinGraphData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinGraphData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinGraphData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinGraphData model) + { + if (model is null) + { + return null; } - return new GremlinGraphData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinGraphData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinGraphData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs index 4f028017792d..ee487a9633eb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class GremlinGraphListResult + internal partial class GremlinGraphListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GremlinGraphListResult DeserializeGremlinGraphListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GremlinGraphListResult DeserializeGremlinGraphListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static GremlinGraphListResult DeserializeGremlinGraphListResult(JsonEle value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GremlinGraphListResult(Optional.ToList(value)); + return new GremlinGraphListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + GremlinGraphListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinGraphListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinGraphListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinGraphListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinGraphListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinGraphListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinGraphListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs index 8a8cdae29379..bae4eae40717 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the graphs and their properties. internal partial class GremlinGraphListResult { - /// Initializes a new instance of GremlinGraphListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GremlinGraphListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of GremlinGraphListResult. + /// Initializes a new instance of . /// List of graphs and their properties. - internal GremlinGraphListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal GremlinGraphListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of graphs and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.Serialization.cs index 9db5019be882..ceb13dd5a883 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinGraphPropertiesConfig : IUtf8JsonSerializable + public partial class GremlinGraphPropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static GremlinGraphPropertiesConfig DeserializeGremlinGraphPropertiesConfig(JsonElement element) + internal static GremlinGraphPropertiesConfig DeserializeGremlinGraphPropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static GremlinGraphPropertiesConfig DeserializeGremlinGraphPropertiesCo autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinGraphPropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + GremlinGraphPropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinGraphPropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinGraphPropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinGraphPropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinGraphPropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinGraphPropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new GremlinGraphPropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinGraphPropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.cs index 1b2a374737cb..3c5fe845a68d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphPropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The GremlinGraphPropertiesConfig. public partial class GremlinGraphPropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of GremlinGraphPropertiesConfig. + /// Initializes a new instance of . public GremlinGraphPropertiesConfig() { } - /// Initializes a new instance of GremlinGraphPropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal GremlinGraphPropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal GremlinGraphPropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.Serialization.cs index dff8c74c4d86..de608e15dfa1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.Serialization.cs @@ -5,27 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class GremlinGraphResourceInfo : IUtf8JsonSerializable + public partial class GremlinGraphResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(GraphName); if (Optional.IsDefined(IndexingPolicy)) { writer.WritePropertyName("indexingPolicy"u8); - writer.WriteObjectValue(IndexingPolicy); + if (IndexingPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IndexingPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionKey)) { writer.WritePropertyName("partitionKey"u8); - writer.WriteObjectValue(PartitionKey); + if (PartitionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionKey).Serialize(writer, options); + } } if (Optional.IsDefined(DefaultTtl)) { @@ -35,12 +57,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UniqueKeyPolicy)) { writer.WritePropertyName("uniqueKeyPolicy"u8); - writer.WriteObjectValue(UniqueKeyPolicy); + if (UniqueKeyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UniqueKeyPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ConflictResolutionPolicy)) { writer.WritePropertyName("conflictResolutionPolicy"u8); - writer.WriteObjectValue(ConflictResolutionPolicy); + if (ConflictResolutionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConflictResolutionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { @@ -50,18 +86,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static GremlinGraphResourceInfo DeserializeGremlinGraphResourceInfo(JsonElement element) + internal static GremlinGraphResourceInfo DeserializeGremlinGraphResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +132,7 @@ internal static GremlinGraphResourceInfo DeserializeGremlinGraphResourceInfo(Jso Optional analyticalStorageTtl = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -154,8 +212,61 @@ internal static GremlinGraphResourceInfo DeserializeGremlinGraphResourceInfo(Jso createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GremlinGraphResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + GremlinGraphResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGremlinGraphResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GremlinGraphResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGremlinGraphResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GremlinGraphResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GremlinGraphResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new GremlinGraphResourceInfo(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGremlinGraphResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.cs index 0fe7e6ad8e87..04ff3533e284 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/GremlinGraphResourceInfo.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB Gremlin graph resource object. public partial class GremlinGraphResourceInfo { - /// Initializes a new instance of GremlinGraphResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin graph. /// is null. public GremlinGraphResourceInfo(string graphName) @@ -24,7 +27,7 @@ public GremlinGraphResourceInfo(string graphName) GraphName = graphName; } - /// Initializes a new instance of GremlinGraphResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB Gremlin graph. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -34,7 +37,8 @@ public GremlinGraphResourceInfo(string graphName) /// Analytical TTL. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. - internal GremlinGraphResourceInfo(string graphName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode) + /// Keeps track of any properties unknown to the library. + internal GremlinGraphResourceInfo(string graphName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, Dictionary serializedAdditionalRawData) { GraphName = graphName; IndexingPolicy = indexingPolicy; @@ -45,6 +49,12 @@ internal GremlinGraphResourceInfo(string graphName, CosmosDBIndexingPolicy index AnalyticalStorageTtl = analyticalStorageTtl; RestoreParameters = restoreParameters; CreateMode = createMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GremlinGraphResourceInfo() + { } /// Name of the Cosmos DB Gremlin graph. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs index 90fdc8cc1b07..8f7bf0173033 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class ListBackups + internal partial class ListBackups : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListBackups DeserializeListBackups(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListBackups DeserializeListBackups(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static ListBackups DeserializeListBackups(JsonElement element) value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListBackups(Optional.ToList(value)); + return new ListBackups(Optional.ToList(value), serializedAdditionalRawData); + } + + ListBackups IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListBackups(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListBackups IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListBackups(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListBackups model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListBackups(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListBackups(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs index bb47d5d85409..56516a19d8a6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// List of restorable backups for a Cassandra cluster. internal partial class ListBackups { - /// Initializes a new instance of ListBackups. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListBackups() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ListBackups. + /// Initializes a new instance of . /// Container for array of backups. - internal ListBackups(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ListBackups(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Container for array of backups. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.Serialization.cs index ac39ee474403..230e39d13604 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ListConnectionStringsResult + public partial class ListConnectionStringsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ListConnectionStringsResult DeserializeListConnectionStringsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ListConnectionStringsResult DeserializeListConnectionStringsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> connectionStrings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionStrings"u8)) @@ -36,8 +64,61 @@ internal static ListConnectionStringsResult DeserializeListConnectionStringsResu connectionStrings = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ListConnectionStringsResult(Optional.ToList(connectionStrings)); + return new ListConnectionStringsResult(Optional.ToList(connectionStrings), serializedAdditionalRawData); + } + + ListConnectionStringsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeListConnectionStringsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ListConnectionStringsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeListConnectionStringsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ListConnectionStringsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ListConnectionStringsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeListConnectionStringsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.cs index 1fbcd9855bcc..880a695aebf2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListConnectionStringsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The connection strings for the given mongo cluster. public partial class ListConnectionStringsResult { - /// Initializes a new instance of ListConnectionStringsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ListConnectionStringsResult() { ConnectionStrings = new ChangeTrackingList(); } - /// Initializes a new instance of ListConnectionStringsResult. + /// Initializes a new instance of . /// An array that contains the connection strings for a mongo cluster. - internal ListConnectionStringsResult(IReadOnlyList connectionStrings) + /// Keeps track of any properties unknown to the library. + internal ListConnectionStringsResult(IReadOnlyList connectionStrings, Dictionary serializedAdditionalRawData) { ConnectionStrings = connectionStrings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An array that contains the connection strings for a mongo cluster. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.Serialization.cs index 61e0620d9c49..10b8f3c0a671 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MaterializedViewDefinition : IUtf8JsonSerializable + public partial class MaterializedViewDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceCollectionId"u8); writer.WriteStringValue(SourceCollectionId); writer.WritePropertyName("definition"u8); writer.WriteStringValue(Definition); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MaterializedViewDefinition DeserializeMaterializedViewDefinition(JsonElement element) + internal static MaterializedViewDefinition DeserializeMaterializedViewDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +53,7 @@ internal static MaterializedViewDefinition DeserializeMaterializedViewDefinition Optional sourceCollectionRid = default; string sourceCollectionId = default; string definition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceCollectionRid"u8)) @@ -48,8 +71,61 @@ internal static MaterializedViewDefinition DeserializeMaterializedViewDefinition definition = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MaterializedViewDefinition(sourceCollectionRid.Value, sourceCollectionId, definition, serializedAdditionalRawData); + } + + MaterializedViewDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMaterializedViewDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MaterializedViewDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMaterializedViewDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MaterializedViewDefinition model) + { + if (model is null) + { + return null; } - return new MaterializedViewDefinition(sourceCollectionRid.Value, sourceCollectionId, definition); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MaterializedViewDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMaterializedViewDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.cs index 1df98d984e85..93337a22bcc1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewDefinition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Materialized View definition for the container. public partial class MaterializedViewDefinition { - /// Initializes a new instance of MaterializedViewDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the source container on which the Materialized View will be created. /// The definition should be an SQL query which would be used to fetch data from the source container to populate into the Materialized View container. /// or is null. @@ -26,15 +30,22 @@ public MaterializedViewDefinition(string sourceCollectionId, string definition) Definition = definition; } - /// Initializes a new instance of MaterializedViewDefinition. + /// Initializes a new instance of . /// An unique identifier for the source collection. This is a system generated property. /// The name of the source container on which the Materialized View will be created. /// The definition should be an SQL query which would be used to fetch data from the source container to populate into the Materialized View container. - internal MaterializedViewDefinition(string sourceCollectionRid, string sourceCollectionId, string definition) + /// Keeps track of any properties unknown to the library. + internal MaterializedViewDefinition(string sourceCollectionRid, string sourceCollectionId, string definition, Dictionary serializedAdditionalRawData) { SourceCollectionRid = sourceCollectionRid; SourceCollectionId = sourceCollectionId; Definition = definition; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MaterializedViewDefinition() + { } /// An unique identifier for the source collection. This is a system generated property. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.Serialization.cs index 7a76c4319a18..7dab7db3b40a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MaterializedViewsBuilderRegionalService + public partial class MaterializedViewsBuilderRegionalService : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MaterializedViewsBuilderRegionalService DeserializeMaterializedViewsBuilderRegionalService(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MaterializedViewsBuilderRegionalService DeserializeMaterializedViewsBuilderRegionalService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static MaterializedViewsBuilderRegionalService DeserializeMaterializedV Optional name = default; Optional location = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -46,8 +75,61 @@ internal static MaterializedViewsBuilderRegionalService DeserializeMaterializedV status = new CosmosDBServiceStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MaterializedViewsBuilderRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status)); + return new MaterializedViewsBuilderRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), serializedAdditionalRawData); + } + + MaterializedViewsBuilderRegionalService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMaterializedViewsBuilderRegionalService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MaterializedViewsBuilderRegionalService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMaterializedViewsBuilderRegionalService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MaterializedViewsBuilderRegionalService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MaterializedViewsBuilderRegionalService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMaterializedViewsBuilderRegionalService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.cs index 4e852dc2a042..18c4dc59fdf3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderRegionalService.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,16 +14,17 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource for a regional service location. public partial class MaterializedViewsBuilderRegionalService : CosmosDBRegionalService { - /// Initializes a new instance of MaterializedViewsBuilderRegionalService. + /// Initializes a new instance of . internal MaterializedViewsBuilderRegionalService() { } - /// Initializes a new instance of MaterializedViewsBuilderRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. - internal MaterializedViewsBuilderRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status) : base(name, location, status) + /// Keeps track of any properties unknown to the library. + internal MaterializedViewsBuilderRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, Dictionary serializedAdditionalRawData) : base(name, location, status, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.Serialization.cs index e59faae4fd38..31309a5f926d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MaterializedViewsBuilderServiceProperties : IUtf8JsonSerializable + public partial class MaterializedViewsBuilderServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InstanceSize)) { @@ -41,8 +47,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MaterializedViewsBuilderServiceProperties DeserializeMaterializedViewsBuilderServiceProperties(JsonElement element) + internal static MaterializedViewsBuilderServiceProperties DeserializeMaterializedViewsBuilderServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,5 +125,53 @@ internal static MaterializedViewsBuilderServiceProperties DeserializeMaterialize additionalProperties = additionalPropertiesDictionary; return new MaterializedViewsBuilderServiceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, Optional.ToList(locations)); } + + MaterializedViewsBuilderServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMaterializedViewsBuilderServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MaterializedViewsBuilderServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMaterializedViewsBuilderServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MaterializedViewsBuilderServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MaterializedViewsBuilderServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMaterializedViewsBuilderServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.cs index 38214b9238cf..590ec337fc64 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MaterializedViewsBuilderServiceProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties for MaterializedViewsBuilderServiceResource. public partial class MaterializedViewsBuilderServiceProperties : CosmosDBServiceProperties { - /// Initializes a new instance of MaterializedViewsBuilderServiceProperties. + /// Initializes a new instance of . public MaterializedViewsBuilderServiceProperties() { Locations = new ChangeTrackingList(); ServiceType = CosmosDBServiceType.MaterializedViewsBuilder; } - /// Initializes a new instance of MaterializedViewsBuilderServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.Serialization.cs index 77e01343c6e5..420746233067 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MergeParameters : IUtf8JsonSerializable + public partial class MergeParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsDryRun)) { writer.WritePropertyName("isDryRun"u8); writer.WriteBooleanValue(IsDryRun.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MergeParameters DeserializeMergeParameters(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional isDryRun = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isDryRun"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDryRun = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MergeParameters(Optional.ToNullable(isDryRun), serializedAdditionalRawData); + } + + MergeParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMergeParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MergeParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMergeParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MergeParameters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MergeParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMergeParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.cs index 1e87b8faea99..47b9028cbbe7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MergeParameters.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The properties of an Azure Cosmos DB merge operations. public partial class MergeParameters { - /// Initializes a new instance of MergeParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MergeParameters() { } + /// Initializes a new instance of . + /// Specifies whether the operation is a real merge operation or a simulation. + /// Keeps track of any properties unknown to the library. + internal MergeParameters(bool? isDryRun, Dictionary serializedAdditionalRawData) + { + IsDryRun = isDryRun; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Specifies whether the operation is a real merge operation or a simulation. public bool? IsDryRun { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterData.Serialization.cs index ea554cbcd68f..9d07b138dd1b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class MongoClusterData : IUtf8JsonSerializable + public partial class MongoClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -41,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(AdministratorLogin)) { @@ -64,16 +78,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NodeGroupSpecs) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoClusterData DeserializeMongoClusterData(JsonElement element) + internal static MongoClusterData DeserializeMongoClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -94,6 +129,7 @@ internal static MongoClusterData DeserializeMongoClusterData(JsonElement element Optional provisioningState = default; Optional clusterStatus = default; Optional> nodeGroupSpecs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -226,8 +262,61 @@ internal static MongoClusterData DeserializeMongoClusterData(JsonElement element } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(createMode), restoreParameters.Value, administratorLogin.Value, administratorLoginPassword.Value, serverVersion.Value, connectionString.Value, earliestRestoreTime.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(clusterStatus), Optional.ToList(nodeGroupSpecs), serializedAdditionalRawData); + } + + MongoClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoClusterData model) + { + if (model is null) + { + return null; } - return new MongoClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(createMode), restoreParameters.Value, administratorLogin.Value, administratorLoginPassword.Value, serverVersion.Value, connectionString.Value, earliestRestoreTime.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(clusterStatus), Optional.ToList(nodeGroupSpecs)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoClusterData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.Serialization.cs index 07277be5f474..dfc698691cfd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class MongoClusterListResult + internal partial class MongoClusterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MongoClusterListResult DeserializeMongoClusterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MongoClusterListResult DeserializeMongoClusterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static MongoClusterListResult DeserializeMongoClusterListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MongoClusterListResult(Optional.ToList(value), nextLink.Value); + return new MongoClusterListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MongoClusterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoClusterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoClusterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoClusterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoClusterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoClusterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoClusterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.cs index f7ea3f66429e..c998608bac8e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// A list of mongo clusters. internal partial class MongoClusterListResult { - /// Initializes a new instance of MongoClusterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MongoClusterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MongoClusterListResult. + /// Initializes a new instance of . /// The list of mongo clusters. /// The link used to get the next page of results. - internal MongoClusterListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MongoClusterListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of mongo clusters. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.Serialization.cs index ae5b07a7e364..c1b90120b355 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoClusterPatch : IUtf8JsonSerializable + public partial class MongoClusterPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,7 +44,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(AdministratorLogin)) { @@ -59,12 +74,211 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NodeGroupSpecs) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MongoClusterPatch DeserializeMongoClusterPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional createMode = default; + Optional restoreParameters = default; + Optional administratorLogin = default; + Optional administratorLoginPassword = default; + Optional serverVersion = default; + Optional connectionString = default; + Optional earliestRestoreTime = default; + Optional provisioningState = default; + Optional clusterStatus = default; + Optional> nodeGroupSpecs = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("createMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createMode = new CosmosDBAccountCreateMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("restoreParameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + restoreParameters = MongoClusterRestoreParameters.DeserializeMongoClusterRestoreParameters(property0.Value); + continue; + } + if (property0.NameEquals("administratorLogin"u8)) + { + administratorLogin = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("administratorLoginPassword"u8)) + { + administratorLoginPassword = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("serverVersion"u8)) + { + serverVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionString"u8)) + { + connectionString = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("earliestRestoreTime"u8)) + { + earliestRestoreTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new CosmosDBProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("clusterStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterStatus = new MongoClusterStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("nodeGroupSpecs"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(NodeGroupSpec.DeserializeNodeGroupSpec(item)); + } + nodeGroupSpecs = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoClusterPatch(Optional.ToDictionary(tags), Optional.ToNullable(createMode), restoreParameters.Value, administratorLogin.Value, administratorLoginPassword.Value, serverVersion.Value, connectionString.Value, earliestRestoreTime.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(clusterStatus), Optional.ToList(nodeGroupSpecs), serializedAdditionalRawData); + } + + MongoClusterPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoClusterPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoClusterPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoClusterPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoClusterPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoClusterPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoClusterPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.cs index 21236b3d576c..33f3cdb3e50c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,45 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Represents a mongo cluster resource for updates. public partial class MongoClusterPatch { - /// Initializes a new instance of MongoClusterPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoClusterPatch() { Tags = new ChangeTrackingDictionary(); NodeGroupSpecs = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Application-specific metadata in the form of key-value pairs. + /// The mode to create a mongo cluster. + /// Parameters used for restore operations. + /// The administrator's login for the mongo cluster. + /// The password of the administrator login. + /// The Mongo DB server version. Defaults to the latest available version if not specified. + /// The default mongo connection string for the cluster. + /// Earliest restore timestamp in UTC ISO8601 format. + /// A provisioning state of the mongo cluster. + /// A status of the mongo cluster. + /// The list of node group specs in the cluster. + /// Keeps track of any properties unknown to the library. + internal MongoClusterPatch(IDictionary tags, CosmosDBAccountCreateMode? createMode, MongoClusterRestoreParameters restoreParameters, string administratorLogin, string administratorLoginPassword, string serverVersion, string connectionString, string earliestRestoreTime, CosmosDBProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, IList nodeGroupSpecs, Dictionary serializedAdditionalRawData) + { + Tags = tags; + CreateMode = createMode; + RestoreParameters = restoreParameters; + AdministratorLogin = administratorLogin; + AdministratorLoginPassword = administratorLoginPassword; + ServerVersion = serverVersion; + ConnectionString = connectionString; + EarliestRestoreTime = earliestRestoreTime; + ProvisioningState = provisioningState; + ClusterStatus = clusterStatus; + NodeGroupSpecs = nodeGroupSpecs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Application-specific metadata in the form of key-value pairs. public IDictionary Tags { get; } /// The mode to create a mongo cluster. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.Serialization.cs index 85564f5637c6..18f0e763edd2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoClusterRestoreParameters : IUtf8JsonSerializable + public partial class MongoClusterRestoreParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PointInTimeUTC)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sourceResourceId"u8); writer.WriteStringValue(SourceResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoClusterRestoreParameters DeserializeMongoClusterRestoreParameters(JsonElement element) + internal static MongoClusterRestoreParameters DeserializeMongoClusterRestoreParameters(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional pointInTimeUTC = default; Optional sourceResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("pointInTimeUTC"u8)) @@ -53,8 +75,61 @@ internal static MongoClusterRestoreParameters DeserializeMongoClusterRestorePara sourceResourceId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoClusterRestoreParameters(Optional.ToNullable(pointInTimeUTC), sourceResourceId.Value, serializedAdditionalRawData); + } + + MongoClusterRestoreParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoClusterRestoreParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoClusterRestoreParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoClusterRestoreParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoClusterRestoreParameters model) + { + if (model is null) + { + return null; } - return new MongoClusterRestoreParameters(Optional.ToNullable(pointInTimeUTC), sourceResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoClusterRestoreParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoClusterRestoreParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.cs index 41e420746fbc..281980f14d43 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoClusterRestoreParameters.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Parameters used for restore operations. public partial class MongoClusterRestoreParameters { - /// Initializes a new instance of MongoClusterRestoreParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoClusterRestoreParameters() { } - /// Initializes a new instance of MongoClusterRestoreParameters. + /// Initializes a new instance of . /// UTC point in time to restore a mongo cluster. /// Resource ID to locate the source cluster to restore. - internal MongoClusterRestoreParameters(DateTimeOffset? pointInTimeUTC, string sourceResourceId) + /// Keeps track of any properties unknown to the library. + internal MongoClusterRestoreParameters(DateTimeOffset? pointInTimeUTC, string sourceResourceId, Dictionary serializedAdditionalRawData) { PointInTimeUTC = pointInTimeUTC; SourceResourceId = sourceResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// UTC point in time to restore a mongo cluster. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.Serialization.cs index b89784b6fc3b..0f5b175e009f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBCollectionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class MongoDBCollectionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBCollectionCreateOrUpdateContent DeserializeMongoDBCollectionCreateOrUpdateContent(JsonElement element) + internal static MongoDBCollectionCreateOrUpdateContent DeserializeMongoDBCollectionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static MongoDBCollectionCreateOrUpdateContent DeserializeMongoDBCollect Optional systemData = default; MongoDBCollectionResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static MongoDBCollectionCreateOrUpdateContent DeserializeMongoDBCollect } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBCollectionCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + MongoDBCollectionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCollectionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCollectionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCollectionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCollectionCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new MongoDBCollectionCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCollectionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCollectionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.cs index ee8c28c66705..6128f11c2cde 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB MongoDB collection. public partial class MongoDBCollectionCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of MongoDBCollectionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a MongoDB collection. /// is null. @@ -26,7 +29,7 @@ public MongoDBCollectionCreateOrUpdateContent(AzureLocation location, MongoDBCol Resource = resource; } - /// Initializes a new instance of MongoDBCollectionCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public MongoDBCollectionCreateOrUpdateContent(AzureLocation location, MongoDBCol /// The standard JSON format of a MongoDB collection. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal MongoDBCollectionCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MongoDBCollectionResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal MongoDBCollectionCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MongoDBCollectionResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MongoDBCollectionCreateOrUpdateContent() + { } /// The standard JSON format of a MongoDB collection. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionData.Serialization.cs index 2a32471980f4..d9b7a98a2848 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class MongoDBCollectionData : IUtf8JsonSerializable + public partial class MongoDBCollectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBCollectionData DeserializeMongoDBCollectionData(JsonElement element) + internal static MongoDBCollectionData DeserializeMongoDBCollectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static MongoDBCollectionData DeserializeMongoDBCollectionData(JsonEleme Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static MongoDBCollectionData DeserializeMongoDBCollectionData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBCollectionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + MongoDBCollectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCollectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCollectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCollectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCollectionData model) + { + if (model is null) + { + return null; } - return new MongoDBCollectionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCollectionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCollectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs index 41911c3948a0..7fb0b38ba85f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class MongoDBCollectionListResult + internal partial class MongoDBCollectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MongoDBCollectionListResult DeserializeMongoDBCollectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MongoDBCollectionListResult DeserializeMongoDBCollectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static MongoDBCollectionListResult DeserializeMongoDBCollectionListResu value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MongoDBCollectionListResult(Optional.ToList(value)); + return new MongoDBCollectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + MongoDBCollectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCollectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCollectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCollectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCollectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCollectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCollectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs index ec26155fe28d..45f18399b113 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the MongoDB collections and their properties. internal partial class MongoDBCollectionListResult { - /// Initializes a new instance of MongoDBCollectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MongoDBCollectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBCollectionListResult. + /// Initializes a new instance of . /// List of MongoDB collections and their properties. - internal MongoDBCollectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal MongoDBCollectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of MongoDB collections and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.Serialization.cs index 378cbed1e174..8bec696abec0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBCollectionPropertiesConfig : IUtf8JsonSerializable + public partial class MongoDBCollectionPropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MongoDBCollectionPropertiesConfig DeserializeMongoDBCollectionPropertiesConfig(JsonElement element) + internal static MongoDBCollectionPropertiesConfig DeserializeMongoDBCollectionPropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static MongoDBCollectionPropertiesConfig DeserializeMongoDBCollectionPr autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBCollectionPropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + MongoDBCollectionPropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCollectionPropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCollectionPropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCollectionPropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCollectionPropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCollectionPropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new MongoDBCollectionPropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCollectionPropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.cs index 70a09364642e..a9886d22ac59 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionPropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The MongoDBCollectionPropertiesConfig. public partial class MongoDBCollectionPropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of MongoDBCollectionPropertiesConfig. + /// Initializes a new instance of . public MongoDBCollectionPropertiesConfig() { } - /// Initializes a new instance of MongoDBCollectionPropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal MongoDBCollectionPropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal MongoDBCollectionPropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.Serialization.cs index 227a619f1dd4..d86ad2cc9c63 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBCollectionResourceInfo : IUtf8JsonSerializable + public partial class MongoDBCollectionResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(CollectionName); @@ -35,7 +42,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Indexes) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,18 +61,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBCollectionResourceInfo DeserializeMongoDBCollectionResourceInfo(JsonElement element) + internal static MongoDBCollectionResourceInfo DeserializeMongoDBCollectionResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +104,7 @@ internal static MongoDBCollectionResourceInfo DeserializeMongoDBCollectionResour Optional analyticalStorageTtl = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -131,8 +167,61 @@ internal static MongoDBCollectionResourceInfo DeserializeMongoDBCollectionResour createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBCollectionResourceInfo(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + MongoDBCollectionResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCollectionResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCollectionResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCollectionResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCollectionResourceInfo model) + { + if (model is null) + { + return null; } - return new MongoDBCollectionResourceInfo(id, Optional.ToDictionary(shardKey), Optional.ToList(indexes), Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCollectionResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCollectionResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.cs index 0f34dc174c3d..d536ed6b66d8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBCollectionResourceInfo.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB MongoDB collection resource object. public partial class MongoDBCollectionResourceInfo { - /// Initializes a new instance of MongoDBCollectionResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB collection. /// is null. public MongoDBCollectionResourceInfo(string collectionName) @@ -26,14 +29,15 @@ public MongoDBCollectionResourceInfo(string collectionName) Indexes = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBCollectionResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB collection. /// A key-value pair of shard keys to be applied for the request. /// List of index keys. /// Analytical TTL. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. - internal MongoDBCollectionResourceInfo(string collectionName, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode) + /// Keeps track of any properties unknown to the library. + internal MongoDBCollectionResourceInfo(string collectionName, IDictionary shardKey, IList indexes, int? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, Dictionary serializedAdditionalRawData) { CollectionName = collectionName; ShardKey = shardKey; @@ -41,6 +45,12 @@ internal MongoDBCollectionResourceInfo(string collectionName, IDictionary Initializes a new instance of for deserialization. + internal MongoDBCollectionResourceInfo() + { } /// Name of the Cosmos DB MongoDB collection. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.Serialization.cs index a7209237342f..8ba9afcd67b2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBDatabaseCreateOrUpdateContent : IUtf8JsonSerializable + public partial class MongoDBDatabaseCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,18 +46,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBDatabaseCreateOrUpdateContent DeserializeMongoDBDatabaseCreateOrUpdateContent(JsonElement element) + internal static MongoDBDatabaseCreateOrUpdateContent DeserializeMongoDBDatabaseCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static MongoDBDatabaseCreateOrUpdateContent DeserializeMongoDBDatabaseC Optional systemData = default; MongoDBDatabaseResourceInfo resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -145,8 +181,61 @@ internal static MongoDBDatabaseCreateOrUpdateContent DeserializeMongoDBDatabaseC } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBDatabaseCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity, serializedAdditionalRawData); + } + + MongoDBDatabaseCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBDatabaseCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBDatabaseCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBDatabaseCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBDatabaseCreateOrUpdateContent model) + { + if (model is null) + { + return null; } - return new MongoDBDatabaseCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBDatabaseCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBDatabaseCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.cs index d18f764d12a5..57fcdcaa774a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseCreateOrUpdateContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update Cosmos DB MongoDB database. public partial class MongoDBDatabaseCreateOrUpdateContent : TrackedResourceData { - /// Initializes a new instance of MongoDBDatabaseCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a MongoDB database. /// is null. @@ -26,7 +29,7 @@ public MongoDBDatabaseCreateOrUpdateContent(AzureLocation location, MongoDBDatab Resource = resource; } - /// Initializes a new instance of MongoDBDatabaseCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,11 +39,18 @@ public MongoDBDatabaseCreateOrUpdateContent(AzureLocation location, MongoDBDatab /// The standard JSON format of a MongoDB database. /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// Identity for the resource. - internal MongoDBDatabaseCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MongoDBDatabaseResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal MongoDBDatabaseCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MongoDBDatabaseResourceInfo resource, CosmosDBCreateUpdateConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MongoDBDatabaseCreateOrUpdateContent() + { } /// The standard JSON format of a MongoDB database. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseData.Serialization.cs index 4fdf19ef6c25..978c97df3700 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class MongoDBDatabaseData : IUtf8JsonSerializable + public partial class MongoDBDatabaseData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,19 +49,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBDatabaseData DeserializeMongoDBDatabaseData(JsonElement element) + internal static MongoDBDatabaseData DeserializeMongoDBDatabaseData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,6 +103,7 @@ internal static MongoDBDatabaseData DeserializeMongoDBDatabaseData(JsonElement e Optional systemData = default; Optional resource = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -153,8 +189,61 @@ internal static MongoDBDatabaseData DeserializeMongoDBDatabaseData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBDatabaseData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity, serializedAdditionalRawData); + } + + MongoDBDatabaseData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBDatabaseData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBDatabaseData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBDatabaseData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBDatabaseData model) + { + if (model is null) + { + return null; } - return new MongoDBDatabaseData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, options.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBDatabaseData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBDatabaseData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs index 6e13bda0b3fb..171831b0ee1d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class MongoDBDatabaseListResult + internal partial class MongoDBDatabaseListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MongoDBDatabaseListResult DeserializeMongoDBDatabaseListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MongoDBDatabaseListResult DeserializeMongoDBDatabaseListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static MongoDBDatabaseListResult DeserializeMongoDBDatabaseListResult(J value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MongoDBDatabaseListResult(Optional.ToList(value)); + return new MongoDBDatabaseListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + MongoDBDatabaseListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBDatabaseListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBDatabaseListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBDatabaseListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBDatabaseListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBDatabaseListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBDatabaseListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs index 4beedb9ab9d6..bc25bebe56d1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the MongoDB databases and their properties. internal partial class MongoDBDatabaseListResult { - /// Initializes a new instance of MongoDBDatabaseListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MongoDBDatabaseListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBDatabaseListResult. + /// Initializes a new instance of . /// List of MongoDB databases and their properties. - internal MongoDBDatabaseListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal MongoDBDatabaseListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of MongoDB databases and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.Serialization.cs index 40720eefde17..b0317b60bffa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBDatabasePropertiesConfig : IUtf8JsonSerializable + public partial class MongoDBDatabasePropertiesConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MongoDBDatabasePropertiesConfig DeserializeMongoDBDatabasePropertiesConfig(JsonElement element) + internal static MongoDBDatabasePropertiesConfig DeserializeMongoDBDatabasePropertiesConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional throughput = default; Optional autoscaleSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -56,8 +86,61 @@ internal static MongoDBDatabasePropertiesConfig DeserializeMongoDBDatabaseProper autoscaleSettings = AutoscaleSettings.DeserializeAutoscaleSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBDatabasePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value, serializedAdditionalRawData); + } + + MongoDBDatabasePropertiesConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBDatabasePropertiesConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBDatabasePropertiesConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBDatabasePropertiesConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBDatabasePropertiesConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBDatabasePropertiesConfig(Response response) + { + if (response is null) + { + return null; } - return new MongoDBDatabasePropertiesConfig(Optional.ToNullable(throughput), autoscaleSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBDatabasePropertiesConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.cs index 08808a4ac6b0..f89c3e218c00 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabasePropertiesConfig.cs @@ -5,20 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The MongoDBDatabasePropertiesConfig. public partial class MongoDBDatabasePropertiesConfig : CosmosDBBaseConfig { - /// Initializes a new instance of MongoDBDatabasePropertiesConfig. + /// Initializes a new instance of . public MongoDBDatabasePropertiesConfig() { } - /// Initializes a new instance of MongoDBDatabasePropertiesConfig. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. /// Specifies the Autoscale settings. - internal MongoDBDatabasePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings) : base(throughput, autoscaleSettings) + /// Keeps track of any properties unknown to the library. + internal MongoDBDatabasePropertiesConfig(int? throughput, AutoscaleSettings autoscaleSettings, Dictionary serializedAdditionalRawData) : base(throughput, autoscaleSettings, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.Serialization.cs index ed8e26144e11..26e413cd2fef 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.Serialization.cs @@ -5,33 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBDatabaseResourceInfo : IUtf8JsonSerializable + public partial class MongoDBDatabaseResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(DatabaseName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBDatabaseResourceInfo DeserializeMongoDBDatabaseResourceInfo(JsonElement element) + internal static MongoDBDatabaseResourceInfo DeserializeMongoDBDatabaseResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +68,7 @@ internal static MongoDBDatabaseResourceInfo DeserializeMongoDBDatabaseResourceIn string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -64,8 +94,61 @@ internal static MongoDBDatabaseResourceInfo DeserializeMongoDBDatabaseResourceIn createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode), serializedAdditionalRawData); + } + + MongoDBDatabaseResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBDatabaseResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBDatabaseResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBDatabaseResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBDatabaseResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBDatabaseResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new MongoDBDatabaseResourceInfo(id, restoreParameters.Value, Optional.ToNullable(createMode)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBDatabaseResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.cs index ff0b84cc8832..5bb5c50d7c32 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBDatabaseResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB MongoDB database resource object. public partial class MongoDBDatabaseResourceInfo { - /// Initializes a new instance of MongoDBDatabaseResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB database. /// is null. public MongoDBDatabaseResourceInfo(string databaseName) @@ -23,15 +27,22 @@ public MongoDBDatabaseResourceInfo(string databaseName) DatabaseName = databaseName; } - /// Initializes a new instance of MongoDBDatabaseResourceInfo. + /// Initializes a new instance of . /// Name of the Cosmos DB MongoDB database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. - internal MongoDBDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode) + /// Keeps track of any properties unknown to the library. + internal MongoDBDatabaseResourceInfo(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, Dictionary serializedAdditionalRawData) { DatabaseName = databaseName; RestoreParameters = restoreParameters; CreateMode = createMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MongoDBDatabaseResourceInfo() + { } /// Name of the Cosmos DB MongoDB database. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.Serialization.cs index 1344af9089ce..2f3a68aa269f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.Serialization.cs @@ -5,37 +5,74 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBIndex : IUtf8JsonSerializable + public partial class MongoDBIndex : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Key)) { writer.WritePropertyName("key"u8); - writer.WriteObjectValue(Key); + if (Key is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Key).Serialize(writer, options); + } } if (Optional.IsDefined(Options)) { writer.WritePropertyName("options"u8); - writer.WriteObjectValue(Options); + if (Options is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Options).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MongoDBIndex DeserializeMongoDBIndex(JsonElement element) + internal static MongoDBIndex DeserializeMongoDBIndex(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional key = default; Optional options = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -56,8 +93,61 @@ internal static MongoDBIndex DeserializeMongoDBIndex(JsonElement element) options = MongoDBIndexConfig.DeserializeMongoDBIndexConfig(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBIndex(key.Value, options.Value, serializedAdditionalRawData); + } + + MongoDBIndex IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBIndex(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBIndex IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBIndex(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBIndex model) + { + if (model is null) + { + return null; } - return new MongoDBIndex(key.Value, options.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBIndex(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBIndex(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.cs index 44dfbd8b2943..db7322bcecf0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndex.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,18 +13,23 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB MongoDB collection index key. public partial class MongoDBIndex { - /// Initializes a new instance of MongoDBIndex. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBIndex() { } - /// Initializes a new instance of MongoDBIndex. + /// Initializes a new instance of . /// Cosmos DB MongoDB collection index keys. /// Cosmos DB MongoDB collection index key options. - internal MongoDBIndex(MongoIndexKeys key, MongoDBIndexConfig options) + /// Keeps track of any properties unknown to the library. + internal MongoDBIndex(MongoIndexKeys key, MongoDBIndexConfig options, Dictionary serializedAdditionalRawData) { Key = key; Options = options; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cosmos DB MongoDB collection index keys. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.Serialization.cs index 0463e67e47a6..a9df9738207c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBIndexConfig : IUtf8JsonSerializable + public partial class MongoDBIndexConfig : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExpireAfterSeconds)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("unique"u8); writer.WriteBooleanValue(IsUnique.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBIndexConfig DeserializeMongoDBIndexConfig(JsonElement element) + internal static MongoDBIndexConfig DeserializeMongoDBIndexConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional expireAfterSeconds = default; Optional unique = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("expireAfterSeconds"u8)) @@ -56,8 +79,61 @@ internal static MongoDBIndexConfig DeserializeMongoDBIndexConfig(JsonElement ele unique = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBIndexConfig(Optional.ToNullable(expireAfterSeconds), Optional.ToNullable(unique), serializedAdditionalRawData); + } + + MongoDBIndexConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBIndexConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBIndexConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBIndexConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBIndexConfig model) + { + if (model is null) + { + return null; } - return new MongoDBIndexConfig(Optional.ToNullable(expireAfterSeconds), Optional.ToNullable(unique)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBIndexConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBIndexConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.cs index 26dac79e0ab2..ba1e4260fafd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBIndexConfig.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB MongoDB collection index options. public partial class MongoDBIndexConfig { - /// Initializes a new instance of MongoDBIndexConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBIndexConfig() { } - /// Initializes a new instance of MongoDBIndexConfig. + /// Initializes a new instance of . /// Expire after seconds. /// Is unique or not. - internal MongoDBIndexConfig(int? expireAfterSeconds, bool? isUnique) + /// Keeps track of any properties unknown to the library. + internal MongoDBIndexConfig(int? expireAfterSeconds, bool? isUnique, Dictionary serializedAdditionalRawData) { ExpireAfterSeconds = expireAfterSeconds; IsUnique = isUnique; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Expire after seconds. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.Serialization.cs index 47eb2ae04ac1..2f92443346a1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.Serialization.cs @@ -5,21 +5,35 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBPrivilege : IUtf8JsonSerializable + public partial class MongoDBPrivilege : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Actions)) { @@ -31,17 +45,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBPrivilege DeserializeMongoDBPrivilege(JsonElement element) + internal static MongoDBPrivilege DeserializeMongoDBPrivilege(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resource = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resource"u8)) @@ -67,8 +96,61 @@ internal static MongoDBPrivilege DeserializeMongoDBPrivilege(JsonElement element actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBPrivilege(resource.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + MongoDBPrivilege IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBPrivilege(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBPrivilege IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBPrivilege(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBPrivilege model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBPrivilege(Response response) + { + if (response is null) + { + return null; } - return new MongoDBPrivilege(resource.Value, Optional.ToList(actions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBPrivilege(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.cs index 86a2c8e89707..1ea3628df8e6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilege.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The set of data plane operations permitted through this Role Definition. public partial class MongoDBPrivilege { - /// Initializes a new instance of MongoDBPrivilege. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBPrivilege() { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBPrivilege. + /// Initializes a new instance of . /// An Azure Cosmos DB Mongo DB Resource. /// An array of actions that are allowed. - internal MongoDBPrivilege(MongoDBPrivilegeResourceInfo resource, IList actions) + /// Keeps track of any properties unknown to the library. + internal MongoDBPrivilege(MongoDBPrivilegeResourceInfo resource, IList actions, Dictionary serializedAdditionalRawData) { Resource = resource; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An Azure Cosmos DB Mongo DB Resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.Serialization.cs index 7c64013db8f7..956ac10a4a7c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBPrivilegeResourceInfo : IUtf8JsonSerializable + public partial class MongoDBPrivilegeResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DBName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("collection"u8); writer.WriteStringValue(Collection); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBPrivilegeResourceInfo DeserializeMongoDBPrivilegeResourceInfo(JsonElement element) + internal static MongoDBPrivilegeResourceInfo DeserializeMongoDBPrivilegeResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional db = default; Optional collection = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("db"u8)) @@ -48,8 +71,61 @@ internal static MongoDBPrivilegeResourceInfo DeserializeMongoDBPrivilegeResource collection = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBPrivilegeResourceInfo(db.Value, collection.Value, serializedAdditionalRawData); + } + + MongoDBPrivilegeResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBPrivilegeResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBPrivilegeResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBPrivilegeResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBPrivilegeResourceInfo model) + { + if (model is null) + { + return null; } - return new MongoDBPrivilegeResourceInfo(db.Value, collection.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBPrivilegeResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBPrivilegeResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.cs index 68416a4bfd70..67299a08bf84 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBPrivilegeResourceInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// An Azure Cosmos DB Mongo DB Resource. public partial class MongoDBPrivilegeResourceInfo { - /// Initializes a new instance of MongoDBPrivilegeResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBPrivilegeResourceInfo() { } - /// Initializes a new instance of MongoDBPrivilegeResourceInfo. + /// Initializes a new instance of . /// The database name the role is applied. /// The collection name the role is applied. - internal MongoDBPrivilegeResourceInfo(string dbName, string collection) + /// Keeps track of any properties unknown to the library. + internal MongoDBPrivilegeResourceInfo(string dbName, string collection, Dictionary serializedAdditionalRawData) { DBName = dbName; Collection = collection; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The database name the role is applied. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.Serialization.cs index d6f3e857b4ba..1dc365310748 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBRole : IUtf8JsonSerializable + public partial class MongoDBRole : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DBName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("role"u8); writer.WriteStringValue(Role); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBRole DeserializeMongoDBRole(JsonElement element) + internal static MongoDBRole DeserializeMongoDBRole(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional db = default; Optional role = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("db"u8)) @@ -48,8 +71,61 @@ internal static MongoDBRole DeserializeMongoDBRole(JsonElement element) role = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBRole(db.Value, role.Value, serializedAdditionalRawData); + } + + MongoDBRole IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBRole(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBRole IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBRole(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBRole model) + { + if (model is null) + { + return null; } - return new MongoDBRole(db.Value, role.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBRole(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBRole(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.cs index c6533eb4a03d..1c0765a20dc9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRole.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The set of roles permitted through this Role Definition. public partial class MongoDBRole { - /// Initializes a new instance of MongoDBRole. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBRole() { } - /// Initializes a new instance of MongoDBRole. + /// Initializes a new instance of . /// The database name the role is applied. /// The role name. - internal MongoDBRole(string dbName, string role) + /// Keeps track of any properties unknown to the library. + internal MongoDBRole(string dbName, string role, Dictionary serializedAdditionalRawData) { DBName = dbName; Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The database name the role is applied. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.Serialization.cs index cd13f8b6300c..3ecbdc4223f8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBRoleDefinitionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class MongoDBRoleDefinitionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Privileges) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -48,12 +63,163 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Roles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MongoDBRoleDefinitionCreateOrUpdateContent DeserializeMongoDBRoleDefinitionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional roleName = default; + Optional type = default; + Optional databaseName = default; + Optional> privileges = default; + Optional> roles = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("roleName"u8)) + { + roleName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property0.Value.GetString().ToMongoDBRoleDefinitionType(); + continue; + } + if (property0.NameEquals("databaseName"u8)) + { + databaseName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privileges"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MongoDBPrivilege.DeserializeMongoDBPrivilege(item)); + } + privileges = array; + continue; + } + if (property0.NameEquals("roles"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MongoDBRole.DeserializeMongoDBRole(item)); + } + roles = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBRoleDefinitionCreateOrUpdateContent(roleName.Value, Optional.ToNullable(type), databaseName.Value, Optional.ToList(privileges), Optional.ToList(roles), serializedAdditionalRawData); + } + + MongoDBRoleDefinitionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBRoleDefinitionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBRoleDefinitionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBRoleDefinitionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBRoleDefinitionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBRoleDefinitionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBRoleDefinitionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.cs index cc2feeaa1b35..c6b2fbbc4755 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,33 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update an Azure Cosmos DB Mongo Role Definition. public partial class MongoDBRoleDefinitionCreateOrUpdateContent { - /// Initializes a new instance of MongoDBRoleDefinitionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBRoleDefinitionCreateOrUpdateContent() { Privileges = new ChangeTrackingList(); Roles = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// A user-friendly name for the Role Definition. Must be unique for the database account. + /// Indicates whether the Role Definition was built-in or user created. + /// The database name for which access is being granted for this Role Definition. + /// A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege. + /// The set of roles inherited by this Role Definition. + /// Keeps track of any properties unknown to the library. + internal MongoDBRoleDefinitionCreateOrUpdateContent(string roleName, MongoDBRoleDefinitionType? definitionType, string databaseName, IList privileges, IList roles, Dictionary serializedAdditionalRawData) + { + RoleName = roleName; + DefinitionType = definitionType; + DatabaseName = databaseName; + Privileges = privileges; + Roles = roles; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// A user-friendly name for the Role Definition. Must be unique for the database account. public string RoleName { get; set; } /// Indicates whether the Role Definition was built-in or user created. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionData.Serialization.cs index f8c948e448d9..41da1f56798a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class MongoDBRoleDefinitionData : IUtf8JsonSerializable + public partial class MongoDBRoleDefinitionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -41,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Privileges) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -51,12 +65,191 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Roles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MongoDBRoleDefinitionData DeserializeMongoDBRoleDefinitionData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional roleName = default; + Optional type0 = default; + Optional databaseName = default; + Optional> privileges = default; + Optional> roles = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("roleName"u8)) + { + roleName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type0 = property0.Value.GetString().ToMongoDBRoleDefinitionType(); + continue; + } + if (property0.NameEquals("databaseName"u8)) + { + databaseName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privileges"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MongoDBPrivilege.DeserializeMongoDBPrivilege(item)); + } + privileges = array; + continue; + } + if (property0.NameEquals("roles"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MongoDBRole.DeserializeMongoDBRole(item)); + } + roles = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBRoleDefinitionData(id, name, type, systemData.Value, roleName.Value, Optional.ToNullable(type0), databaseName.Value, Optional.ToList(privileges), Optional.ToList(roles), serializedAdditionalRawData); + } + + MongoDBRoleDefinitionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBRoleDefinitionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBRoleDefinitionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBRoleDefinitionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBRoleDefinitionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBRoleDefinitionData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBRoleDefinitionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.Serialization.cs index 4c0ca5efbecd..7c8f79271745 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class MongoDBRoleDefinitionListResult + internal partial class MongoDBRoleDefinitionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MongoDBRoleDefinitionListResult DeserializeMongoDBRoleDefinitionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MongoDBRoleDefinitionListResult DeserializeMongoDBRoleDefinitionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static MongoDBRoleDefinitionListResult DeserializeMongoDBRoleDefinition value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MongoDBRoleDefinitionListResult(Optional.ToList(value)); + return new MongoDBRoleDefinitionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + MongoDBRoleDefinitionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBRoleDefinitionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBRoleDefinitionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBRoleDefinitionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBRoleDefinitionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBRoleDefinitionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBRoleDefinitionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.cs index 0b4c24eb9d19..aee6cefbcfd4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBRoleDefinitionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The relevant Mongo Role Definitions. internal partial class MongoDBRoleDefinitionListResult { - /// Initializes a new instance of MongoDBRoleDefinitionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MongoDBRoleDefinitionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBRoleDefinitionListResult. + /// Initializes a new instance of . /// List of Mongo Role Definitions and their properties. - internal MongoDBRoleDefinitionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal MongoDBRoleDefinitionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Mongo Role Definitions and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.Serialization.cs index 9517ca4f7db0..123fe96d6a1d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class MongoDBUserDefinitionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class MongoDBUserDefinitionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -43,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Roles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,7 +68,144 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Mechanisms); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MongoDBUserDefinitionCreateOrUpdateContent DeserializeMongoDBUserDefinitionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional userName = default; + Optional password = default; + Optional databaseName = default; + Optional customData = default; + Optional> roles = default; + Optional mechanisms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("userName"u8)) + { + userName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("password"u8)) + { + password = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("databaseName"u8)) + { + databaseName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("customData"u8)) + { + customData = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("roles"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MongoDBRole.DeserializeMongoDBRole(item)); + } + roles = array; + continue; + } + if (property0.NameEquals("mechanisms"u8)) + { + mechanisms = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBUserDefinitionCreateOrUpdateContent(userName.Value, password.Value, databaseName.Value, customData.Value, Optional.ToList(roles), mechanisms.Value, serializedAdditionalRawData); + } + + MongoDBUserDefinitionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBUserDefinitionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBUserDefinitionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBUserDefinitionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBUserDefinitionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBUserDefinitionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBUserDefinitionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.cs index 4f7a496fde45..48e060649214 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionCreateOrUpdateContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,34 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to create and update an Azure Cosmos DB Mongo User Definition. public partial class MongoDBUserDefinitionCreateOrUpdateContent { - /// Initializes a new instance of MongoDBUserDefinitionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBUserDefinitionCreateOrUpdateContent() { Roles = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The user name for User Definition. + /// The password for User Definition. Response does not contain user password. + /// The database name for which access is being granted for this User Definition. + /// A custom definition for the USer Definition. + /// The set of roles inherited by the User Definition. + /// The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. + /// Keeps track of any properties unknown to the library. + internal MongoDBUserDefinitionCreateOrUpdateContent(string userName, string password, string databaseName, string customData, IList roles, string mechanisms, Dictionary serializedAdditionalRawData) + { + UserName = userName; + Password = password; + DatabaseName = databaseName; + CustomData = customData; + Roles = roles; + Mechanisms = mechanisms; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The user name for User Definition. public string UserName { get; set; } /// The password for User Definition. Response does not contain user password. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionData.Serialization.cs index 23c6003371a4..152e8d4bafb9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class MongoDBUserDefinitionData : IUtf8JsonSerializable + public partial class MongoDBUserDefinitionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -46,7 +53,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Roles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -56,11 +70,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Mechanisms); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoDBUserDefinitionData DeserializeMongoDBUserDefinitionData(JsonElement element) + internal static MongoDBUserDefinitionData DeserializeMongoDBUserDefinitionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -75,6 +103,7 @@ internal static MongoDBUserDefinitionData DeserializeMongoDBUserDefinitionData(J Optional customData = default; Optional> roles = default; Optional mechanisms = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -152,8 +181,61 @@ internal static MongoDBUserDefinitionData DeserializeMongoDBUserDefinitionData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoDBUserDefinitionData(id, name, type, systemData.Value, userName.Value, password.Value, databaseName.Value, customData.Value, Optional.ToList(roles), mechanisms.Value, serializedAdditionalRawData); + } + + MongoDBUserDefinitionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBUserDefinitionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBUserDefinitionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBUserDefinitionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBUserDefinitionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBUserDefinitionData(Response response) + { + if (response is null) + { + return null; } - return new MongoDBUserDefinitionData(id, name, type, systemData.Value, userName.Value, password.Value, databaseName.Value, customData.Value, Optional.ToList(roles), mechanisms.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBUserDefinitionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.Serialization.cs index 167f37a67769..f3048ee790f6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class MongoDBUserDefinitionListResult + internal partial class MongoDBUserDefinitionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MongoDBUserDefinitionListResult DeserializeMongoDBUserDefinitionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MongoDBUserDefinitionListResult DeserializeMongoDBUserDefinitionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static MongoDBUserDefinitionListResult DeserializeMongoDBUserDefinition value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MongoDBUserDefinitionListResult(Optional.ToList(value)); + return new MongoDBUserDefinitionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + MongoDBUserDefinitionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBUserDefinitionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBUserDefinitionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBUserDefinitionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBUserDefinitionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBUserDefinitionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBUserDefinitionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.cs index bbb36f02061b..095af0dfa52a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoDBUserDefinitionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The relevant User Definition. internal partial class MongoDBUserDefinitionListResult { - /// Initializes a new instance of MongoDBUserDefinitionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MongoDBUserDefinitionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBUserDefinitionListResult. + /// Initializes a new instance of . /// List of User Definition and their properties. - internal MongoDBUserDefinitionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal MongoDBUserDefinitionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of User Definition and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs index 8693cbeb020e..4729ed9aa00d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class MongoIndexKeys : IUtf8JsonSerializable + internal partial class MongoIndexKeys : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Keys)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MongoIndexKeys DeserializeMongoIndexKeys(JsonElement element) + internal static MongoIndexKeys DeserializeMongoIndexKeys(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> keys = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keys"u8)) @@ -52,8 +74,61 @@ internal static MongoIndexKeys DeserializeMongoIndexKeys(JsonElement element) keys = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MongoIndexKeys(Optional.ToList(keys), serializedAdditionalRawData); + } + + MongoIndexKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoIndexKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoIndexKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoIndexKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoIndexKeys model) + { + if (model is null) + { + return null; } - return new MongoIndexKeys(Optional.ToList(keys)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoIndexKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoIndexKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs index d458bb4f063f..0af61fe1aa16 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/MongoIndexKeys.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB MongoDB collection resource object. internal partial class MongoIndexKeys { - /// Initializes a new instance of MongoIndexKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoIndexKeys() { Keys = new ChangeTrackingList(); } - /// Initializes a new instance of MongoIndexKeys. + /// Initializes a new instance of . /// List of keys for each MongoDB collection in the Azure Cosmos DB service. - internal MongoIndexKeys(IList keys) + /// Keeps track of any properties unknown to the library. + internal MongoIndexKeys(IList keys, Dictionary serializedAdditionalRawData) { Keys = keys; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of keys for each MongoDB collection in the Azure Cosmos DB service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.Serialization.cs index 16901805fb91..51bb6ec28518 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class NodeGroupProperties : IUtf8JsonSerializable + public partial class NodeGroupProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableHa"u8); writer.WriteBooleanValue(EnableHa.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NodeGroupProperties DeserializeNodeGroupProperties(JsonElement element) + internal static NodeGroupProperties DeserializeNodeGroupProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static NodeGroupProperties DeserializeNodeGroupProperties(JsonElement e Optional sku = default; Optional diskSizeGB = default; Optional enableHa = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -67,8 +90,61 @@ internal static NodeGroupProperties DeserializeNodeGroupProperties(JsonElement e enableHa = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NodeGroupProperties(sku.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(enableHa), serializedAdditionalRawData); + } + + NodeGroupProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNodeGroupProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NodeGroupProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNodeGroupProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NodeGroupProperties model) + { + if (model is null) + { + return null; } - return new NodeGroupProperties(sku.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(enableHa)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NodeGroupProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNodeGroupProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.cs index 5b4633a30c60..b5dc42260844 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The properties of the node group on a cluster. public partial class NodeGroupProperties { - /// Initializes a new instance of NodeGroupProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NodeGroupProperties() { } - /// Initializes a new instance of NodeGroupProperties. + /// Initializes a new instance of . /// The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. /// The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. /// Whether high availability is enabled on the node group. - internal NodeGroupProperties(string sku, long? diskSizeInGB, bool? enableHa) + /// Keeps track of any properties unknown to the library. + internal NodeGroupProperties(string sku, long? diskSizeInGB, bool? enableHa, Dictionary serializedAdditionalRawData) { Sku = sku; DiskSizeInGB = diskSizeInGB; EnableHa = enableHa; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.Serialization.cs index 71eb657281d2..2ef3c63dbbc1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class NodeGroupSpec : IUtf8JsonSerializable + public partial class NodeGroupSpec : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableHa"u8); writer.WriteBooleanValue(EnableHa.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NodeGroupSpec DeserializeNodeGroupSpec(JsonElement element) + internal static NodeGroupSpec DeserializeNodeGroupSpec(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static NodeGroupSpec DeserializeNodeGroupSpec(JsonElement element) Optional sku = default; Optional diskSizeGB = default; Optional enableHa = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -97,8 +120,61 @@ internal static NodeGroupSpec DeserializeNodeGroupSpec(JsonElement element) enableHa = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NodeGroupSpec(sku.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(enableHa), Optional.ToNullable(kind), Optional.ToNullable(nodeCount), serializedAdditionalRawData); + } + + NodeGroupSpec IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNodeGroupSpec(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NodeGroupSpec IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNodeGroupSpec(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NodeGroupSpec model) + { + if (model is null) + { + return null; } - return new NodeGroupSpec(sku.Value, Optional.ToNullable(diskSizeGB), Optional.ToNullable(enableHa), Optional.ToNullable(kind), Optional.ToNullable(nodeCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NodeGroupSpec(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNodeGroupSpec(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.cs index fbbeb83af774..bc7122deb040 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/NodeGroupSpec.cs @@ -5,23 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Specification for a node group. public partial class NodeGroupSpec : NodeGroupProperties { - /// Initializes a new instance of NodeGroupSpec. + /// Initializes a new instance of . public NodeGroupSpec() { } - /// Initializes a new instance of NodeGroupSpec. + /// Initializes a new instance of . /// The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. /// The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. /// Whether high availability is enabled on the node group. /// The node type deployed in the node group. /// The number of nodes in the node group. - internal NodeGroupSpec(string sku, long? diskSizeInGB, bool? enableHa, NodeKind? kind, int? nodeCount) : base(sku, diskSizeInGB, enableHa) + /// Keeps track of any properties unknown to the library. + internal NodeGroupSpec(string sku, long? diskSizeInGB, bool? enableHa, NodeKind? kind, int? nodeCount, Dictionary serializedAdditionalRawData) : base(sku, diskSizeInGB, enableHa, serializedAdditionalRawData) { Kind = kind; NodeCount = nodeCount; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.cs index 6b0fb5fa0645..892d69f3f46e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PartitionMetric + public partial class PartitionMetric : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PartitionMetric DeserializePartitionMetric(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PartitionMetric DeserializePartitionMetric(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +54,7 @@ internal static PartitionMetric DeserializePartitionMetric(JsonElement element) Optional unit = default; Optional name = default; Optional> metricValues = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionId"u8)) @@ -99,8 +126,61 @@ internal static PartitionMetric DeserializePartitionMetric(JsonElement element) metricValues = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PartitionMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues), Optional.ToNullable(partitionId), partitionKeyRangeId.Value); + return new PartitionMetric(Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeGrain.Value, Optional.ToNullable(unit), name.Value, Optional.ToList(metricValues), Optional.ToNullable(partitionId), partitionKeyRangeId.Value, serializedAdditionalRawData); + } + + PartitionMetric IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePartitionMetric(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PartitionMetric IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePartitionMetric(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PartitionMetric model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PartitionMetric(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePartitionMetric(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs index f1a663178ac3..32d260785880 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetric.cs @@ -13,12 +13,12 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The metric values for a single partition. public partial class PartitionMetric : CosmosDBBaseMetric { - /// Initializes a new instance of PartitionMetric. + /// Initializes a new instance of . internal PartitionMetric() { } - /// Initializes a new instance of PartitionMetric. + /// Initializes a new instance of . /// The start time for the metric (ISO-8601 format). /// The end time for the metric (ISO-8601 format). /// The time grain to be used to summarize the metric values. @@ -27,7 +27,8 @@ internal PartitionMetric() /// The metric values for the specified time window and timestep. /// The partition id (GUID identifier) of the metric values. /// The partition key range id (integer identifier) of the metric values. - internal PartitionMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, string timeGrain, CosmosDBMetricUnitType? unit, CosmosDBMetricName name, IReadOnlyList metricValues, Guid? partitionId, string partitionKeyRangeId) : base(startOn, endOn, timeGrain, unit, name, metricValues) + /// Keeps track of any properties unknown to the library. + internal PartitionMetric(DateTimeOffset? startOn, DateTimeOffset? endOn, string timeGrain, CosmosDBMetricUnitType? unit, CosmosDBMetricName name, IReadOnlyList metricValues, Guid? partitionId, string partitionKeyRangeId, Dictionary serializedAdditionalRawData) : base(startOn, endOn, timeGrain, unit, name, metricValues, serializedAdditionalRawData) { PartitionId = partitionId; PartitionKeyRangeId = partitionKeyRangeId; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs index daeae871c814..2c554830e438 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class PartitionMetricListResult + internal partial class PartitionMetricListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PartitionMetricListResult DeserializePartitionMetricListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PartitionMetricListResult DeserializePartitionMetricListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static PartitionMetricListResult DeserializePartitionMetricListResult(J value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PartitionMetricListResult(Optional.ToList(value)); + return new PartitionMetricListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + PartitionMetricListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePartitionMetricListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PartitionMetricListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePartitionMetricListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PartitionMetricListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PartitionMetricListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePartitionMetricListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs index bd2bab3a41c9..8da10f23ca40 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionMetricListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The response to a list partition metrics request. internal partial class PartitionMetricListResult { - /// Initializes a new instance of PartitionMetricListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PartitionMetricListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PartitionMetricListResult. + /// Initializes a new instance of . /// The list of partition-level metrics for the account. - internal PartitionMetricListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal PartitionMetricListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of partition-level metrics for the account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs index c8bd3c50ec2d..ba4804b7dd11 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PartitionUsage + public partial class PartitionUsage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PartitionUsage DeserializePartitionUsage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PartitionUsage DeserializePartitionUsage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +53,7 @@ internal static PartitionUsage DeserializePartitionUsage(JsonElement element) Optional quotaPeriod = default; Optional limit = default; Optional currentValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionId"u8)) @@ -83,8 +111,61 @@ internal static PartitionUsage DeserializePartitionUsage(JsonElement element) currentValue = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PartitionUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), Optional.ToNullable(partitionId), partitionKeyRangeId.Value); + return new PartitionUsage(Optional.ToNullable(unit), name.Value, quotaPeriod.Value, Optional.ToNullable(limit), Optional.ToNullable(currentValue), Optional.ToNullable(partitionId), partitionKeyRangeId.Value, serializedAdditionalRawData); + } + + PartitionUsage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePartitionUsage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PartitionUsage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePartitionUsage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PartitionUsage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PartitionUsage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePartitionUsage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs index 472482d96830..ba4834390039 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsage.cs @@ -6,18 +6,19 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// The partition level usage data for a usage request. public partial class PartitionUsage : CosmosDBBaseUsage { - /// Initializes a new instance of PartitionUsage. + /// Initializes a new instance of . internal PartitionUsage() { } - /// Initializes a new instance of PartitionUsage. + /// Initializes a new instance of . /// The unit of the metric. /// The name information for the metric. /// The quota period used to summarize the usage values. @@ -25,7 +26,8 @@ internal PartitionUsage() /// Current value for this metric. /// The partition id (GUID identifier) of the usages. /// The partition key range id (integer identifier) of the usages. - internal PartitionUsage(CosmosDBMetricUnitType? unit, CosmosDBMetricName name, string quotaPeriod, long? limit, long? currentValue, Guid? partitionId, string partitionKeyRangeId) : base(unit, name, quotaPeriod, limit, currentValue) + /// Keeps track of any properties unknown to the library. + internal PartitionUsage(CosmosDBMetricUnitType? unit, CosmosDBMetricName name, string quotaPeriod, long? limit, long? currentValue, Guid? partitionId, string partitionKeyRangeId, Dictionary serializedAdditionalRawData) : base(unit, name, quotaPeriod, limit, currentValue, serializedAdditionalRawData) { PartitionId = partitionId; PartitionKeyRangeId = partitionKeyRangeId; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs index 77c0051b707a..cd755f1b56b4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class PartitionUsagesResult + internal partial class PartitionUsagesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PartitionUsagesResult DeserializePartitionUsagesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PartitionUsagesResult DeserializePartitionUsagesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static PartitionUsagesResult DeserializePartitionUsagesResult(JsonEleme value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PartitionUsagesResult(Optional.ToList(value)); + return new PartitionUsagesResult(Optional.ToList(value), serializedAdditionalRawData); + } + + PartitionUsagesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePartitionUsagesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PartitionUsagesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePartitionUsagesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PartitionUsagesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PartitionUsagesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePartitionUsagesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs index c242185e4144..c215c2aaa1cc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PartitionUsagesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The response to a list partition level usage request. internal partial class PartitionUsagesResult { - /// Initializes a new instance of PartitionUsagesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PartitionUsagesResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PartitionUsagesResult. + /// Initializes a new instance of . /// The list of partition-level usages for the database. A usage is a point in time metric. - internal PartitionUsagesResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal PartitionUsagesResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of partition-level usages for the database. A usage is a point in time metric. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs index 6100839ae95a..8300bad7e6d0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class PercentileMetricListResult + internal partial class PercentileMetricListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PercentileMetricListResult DeserializePercentileMetricListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PercentileMetricListResult DeserializePercentileMetricListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static PercentileMetricListResult DeserializePercentileMetricListResult value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PercentileMetricListResult(Optional.ToList(value)); + return new PercentileMetricListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + PercentileMetricListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePercentileMetricListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PercentileMetricListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePercentileMetricListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PercentileMetricListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PercentileMetricListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePercentileMetricListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs index f875f73dca54..9a1180576ac0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The response to a list percentile metrics request. internal partial class PercentileMetricListResult { - /// Initializes a new instance of PercentileMetricListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PercentileMetricListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PercentileMetricListResult. + /// Initializes a new instance of . /// The list of percentile metrics for the account. - internal PercentileMetricListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal PercentileMetricListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of percentile metrics for the account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs index d044adb7ce29..8f5eb8eeb692 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PercentileMetricValue + public partial class PercentileMetricValue : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PercentileMetricValue DeserializePercentileMetricValue(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PercentileMetricValue DeserializePercentileMetricValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +59,7 @@ internal static PercentileMetricValue DeserializePercentileMetricValue(JsonEleme Optional minimum = default; Optional timestamp = default; Optional total = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("P10"u8)) @@ -151,8 +179,61 @@ internal static PercentileMetricValue DeserializePercentileMetricValue(JsonEleme total = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PercentileMetricValue(Optional.ToNullable(count), Optional.ToNullable(average), Optional.ToNullable(maximum), Optional.ToNullable(minimum), Optional.ToNullable(timestamp), Optional.ToNullable(total), Optional.ToNullable(p10), Optional.ToNullable(p25), Optional.ToNullable(p50), Optional.ToNullable(p75), Optional.ToNullable(p90), Optional.ToNullable(p95), Optional.ToNullable(p99)); + return new PercentileMetricValue(Optional.ToNullable(count), Optional.ToNullable(average), Optional.ToNullable(maximum), Optional.ToNullable(minimum), Optional.ToNullable(timestamp), Optional.ToNullable(total), Optional.ToNullable(p10), Optional.ToNullable(p25), Optional.ToNullable(p50), Optional.ToNullable(p75), Optional.ToNullable(p90), Optional.ToNullable(p95), Optional.ToNullable(p99), serializedAdditionalRawData); + } + + PercentileMetricValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePercentileMetricValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PercentileMetricValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePercentileMetricValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PercentileMetricValue model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PercentileMetricValue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePercentileMetricValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs index 7bc3e689874f..8e515e978df9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PercentileMetricValue.cs @@ -6,18 +6,19 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Represents percentile metrics values. public partial class PercentileMetricValue : CosmosDBMetricValue { - /// Initializes a new instance of PercentileMetricValue. + /// Initializes a new instance of . internal PercentileMetricValue() { } - /// Initializes a new instance of PercentileMetricValue. + /// Initializes a new instance of . /// The number of values for the metric. /// The average value of the metric. /// The max value of the metric. @@ -31,7 +32,8 @@ internal PercentileMetricValue() /// The 90th percentile value for the metric. /// The 95th percentile value for the metric. /// The 99th percentile value for the metric. - internal PercentileMetricValue(int? count, double? average, double? maximum, double? minimum, DateTimeOffset? timestamp, double? total, double? p10, double? p25, double? p50, double? p75, double? p90, double? p95, double? p99) : base(count, average, maximum, minimum, timestamp, total) + /// Keeps track of any properties unknown to the library. + internal PercentileMetricValue(int? count, double? average, double? maximum, double? minimum, DateTimeOffset? timestamp, double? total, double? p10, double? p25, double? p50, double? p75, double? p90, double? p95, double? p99, Dictionary serializedAdditionalRawData) : base(count, average, maximum, minimum, timestamp, total, serializedAdditionalRawData) { P10 = p10; P25 = p25; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs index b0cd5a305c6c..7d1104bffa62 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.Serialization.cs @@ -5,33 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PeriodicModeBackupPolicy : IUtf8JsonSerializable + public partial class PeriodicModeBackupPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PeriodicModeProperties)) { writer.WritePropertyName("periodicModeProperties"u8); - writer.WriteObjectValue(PeriodicModeProperties); + if (PeriodicModeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PeriodicModeProperties).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(BackupPolicyType.ToString()); if (Optional.IsDefined(MigrationState)) { writer.WritePropertyName("migrationState"u8); - writer.WriteObjectValue(MigrationState); + if (MigrationState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MigrationState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PeriodicModeBackupPolicy DeserializePeriodicModeBackupPolicy(JsonElement element) + internal static PeriodicModeBackupPolicy DeserializePeriodicModeBackupPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +75,7 @@ internal static PeriodicModeBackupPolicy DeserializePeriodicModeBackupPolicy(Jso Optional periodicModeProperties = default; BackupPolicyType type = default; Optional migrationState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("periodicModeProperties"u8)) @@ -64,8 +101,61 @@ internal static PeriodicModeBackupPolicy DeserializePeriodicModeBackupPolicy(Jso migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PeriodicModeBackupPolicy(type, migrationState.Value, periodicModeProperties.Value, serializedAdditionalRawData); + } + + PeriodicModeBackupPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePeriodicModeBackupPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PeriodicModeBackupPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePeriodicModeBackupPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PeriodicModeBackupPolicy model) + { + if (model is null) + { + return null; } - return new PeriodicModeBackupPolicy(type, migrationState.Value, periodicModeProperties.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PeriodicModeBackupPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePeriodicModeBackupPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs index c2de67a75756..c5a6c7c8f07f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeBackupPolicy.cs @@ -5,22 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The object representing periodic mode backup policy. public partial class PeriodicModeBackupPolicy : CosmosDBAccountBackupPolicy { - /// Initializes a new instance of PeriodicModeBackupPolicy. + /// Initializes a new instance of . public PeriodicModeBackupPolicy() { BackupPolicyType = BackupPolicyType.Periodic; } - /// Initializes a new instance of PeriodicModeBackupPolicy. + /// Initializes a new instance of . /// Describes the mode of backups. /// The object representing the state of the migration between the backup policies. /// Configuration values for periodic mode backup. - internal PeriodicModeBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState, PeriodicModeProperties periodicModeProperties) : base(backupPolicyType, migrationState) + /// Keeps track of any properties unknown to the library. + internal PeriodicModeBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState, PeriodicModeProperties periodicModeProperties, Dictionary serializedAdditionalRawData) : base(backupPolicyType, migrationState, serializedAdditionalRawData) { PeriodicModeProperties = periodicModeProperties; BackupPolicyType = backupPolicyType; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs index 44d51d4d3e32..67fa9ffb439b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PeriodicModeProperties : IUtf8JsonSerializable + public partial class PeriodicModeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BackupIntervalInMinutes)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("backupStorageRedundancy"u8); writer.WriteStringValue(BackupStorageRedundancy.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PeriodicModeProperties DeserializePeriodicModeProperties(JsonElement element) + internal static PeriodicModeProperties DeserializePeriodicModeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static PeriodicModeProperties DeserializePeriodicModeProperties(JsonEle Optional backupIntervalInMinutes = default; Optional backupRetentionIntervalInHours = default; Optional backupStorageRedundancy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("backupIntervalInMinutes"u8)) @@ -71,8 +94,61 @@ internal static PeriodicModeProperties DeserializePeriodicModeProperties(JsonEle backupStorageRedundancy = new CosmosDBBackupStorageRedundancy(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PeriodicModeProperties(Optional.ToNullable(backupIntervalInMinutes), Optional.ToNullable(backupRetentionIntervalInHours), Optional.ToNullable(backupStorageRedundancy), serializedAdditionalRawData); + } + + PeriodicModeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePeriodicModeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PeriodicModeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePeriodicModeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PeriodicModeProperties model) + { + if (model is null) + { + return null; } - return new PeriodicModeProperties(Optional.ToNullable(backupIntervalInMinutes), Optional.ToNullable(backupRetentionIntervalInHours), Optional.ToNullable(backupStorageRedundancy)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PeriodicModeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePeriodicModeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs index 42359299982a..0111a1d84542 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PeriodicModeProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Configuration values for periodic mode backup. public partial class PeriodicModeProperties { - /// Initializes a new instance of PeriodicModeProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PeriodicModeProperties() { } - /// Initializes a new instance of PeriodicModeProperties. + /// Initializes a new instance of . /// An integer representing the interval in minutes between two backups. /// An integer representing the time (in hours) that each backup is retained. /// Enum to indicate type of backup residency. - internal PeriodicModeProperties(int? backupIntervalInMinutes, int? backupRetentionIntervalInHours, CosmosDBBackupStorageRedundancy? backupStorageRedundancy) + /// Keeps track of any properties unknown to the library. + internal PeriodicModeProperties(int? backupIntervalInMinutes, int? backupRetentionIntervalInHours, CosmosDBBackupStorageRedundancy? backupStorageRedundancy, Dictionary serializedAdditionalRawData) { BackupIntervalInMinutes = backupIntervalInMinutes; BackupRetentionIntervalInHours = backupRetentionIntervalInHours; BackupStorageRedundancy = backupStorageRedundancy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An integer representing the interval in minutes between two backups. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.Serialization.cs index 4d40ccf93515..2aec6ae64fec 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PhysicalPartitionStorageInfo + public partial class PhysicalPartitionStorageInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhysicalPartitionStorageInfo DeserializePhysicalPartitionStorageInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhysicalPartitionStorageInfo DeserializePhysicalPartitionStorageInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; Optional storageInKB = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -36,8 +65,61 @@ internal static PhysicalPartitionStorageInfo DeserializePhysicalPartitionStorage storageInKB = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhysicalPartitionStorageInfo(id.Value, Optional.ToNullable(storageInKB)); + return new PhysicalPartitionStorageInfo(id.Value, Optional.ToNullable(storageInKB), serializedAdditionalRawData); + } + + PhysicalPartitionStorageInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhysicalPartitionStorageInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhysicalPartitionStorageInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhysicalPartitionStorageInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhysicalPartitionStorageInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhysicalPartitionStorageInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhysicalPartitionStorageInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.cs index b7124d73ad9e..b81a08942c4e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The storage of a physical partition. public partial class PhysicalPartitionStorageInfo { - /// Initializes a new instance of PhysicalPartitionStorageInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PhysicalPartitionStorageInfo() { } - /// Initializes a new instance of PhysicalPartitionStorageInfo. + /// Initializes a new instance of . /// The unique identifier of the partition. /// The storage in KB for the physical partition. - internal PhysicalPartitionStorageInfo(string id, double? storageInKB) + /// Keeps track of any properties unknown to the library. + internal PhysicalPartitionStorageInfo(string id, double? storageInKB, Dictionary serializedAdditionalRawData) { Id = id; StorageInKB = storageInKB; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique identifier of the partition. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.Serialization.cs index bf5a4c715e26..9b9f14103247 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PhysicalPartitionStorageInfoCollection + public partial class PhysicalPartitionStorageInfoCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PhysicalPartitionStorageInfoCollection DeserializePhysicalPartitionStorageInfoCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PhysicalPartitionStorageInfoCollection DeserializePhysicalPartitionStorageInfoCollection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> physicalPartitionStorageInfoCollection = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("physicalPartitionStorageInfoCollection"u8)) @@ -36,8 +64,61 @@ internal static PhysicalPartitionStorageInfoCollection DeserializePhysicalPartit physicalPartitionStorageInfoCollection = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PhysicalPartitionStorageInfoCollection(Optional.ToList(physicalPartitionStorageInfoCollection)); + return new PhysicalPartitionStorageInfoCollection(Optional.ToList(physicalPartitionStorageInfoCollection), serializedAdditionalRawData); + } + + PhysicalPartitionStorageInfoCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhysicalPartitionStorageInfoCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhysicalPartitionStorageInfoCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhysicalPartitionStorageInfoCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhysicalPartitionStorageInfoCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhysicalPartitionStorageInfoCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhysicalPartitionStorageInfoCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.cs index 629a7d94c69e..d1e148b9e985 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionStorageInfoCollection.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// List of physical partitions and their properties returned by a merge operation. public partial class PhysicalPartitionStorageInfoCollection { - /// Initializes a new instance of PhysicalPartitionStorageInfoCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PhysicalPartitionStorageInfoCollection() { PhysicalPartitionStorageInfoCollectionValue = new ChangeTrackingList(); } - /// Initializes a new instance of PhysicalPartitionStorageInfoCollection. + /// Initializes a new instance of . /// List of physical partitions and their properties. - internal PhysicalPartitionStorageInfoCollection(IReadOnlyList physicalPartitionStorageInfoCollectionValue) + /// Keeps track of any properties unknown to the library. + internal PhysicalPartitionStorageInfoCollection(IReadOnlyList physicalPartitionStorageInfoCollectionValue, Dictionary serializedAdditionalRawData) { PhysicalPartitionStorageInfoCollectionValue = physicalPartitionStorageInfoCollectionValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of physical partitions and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.Serialization.cs index e37b0c8fcddc..395fc4b7d2a6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class PhysicalPartitionThroughputInfoProperties : IUtf8JsonSerializable + internal partial class PhysicalPartitionThroughputInfoProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PhysicalPartitionThroughputInfo)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PhysicalPartitionThroughputInfo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhysicalPartitionThroughputInfoProperties DeserializePhysicalPartitionThroughputInfoProperties(JsonElement element) + internal static PhysicalPartitionThroughputInfoProperties DeserializePhysicalPartitionThroughputInfoProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> physicalPartitionThroughputInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("physicalPartitionThroughputInfo"u8)) @@ -52,8 +81,61 @@ internal static PhysicalPartitionThroughputInfoProperties DeserializePhysicalPar physicalPartitionThroughputInfo = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhysicalPartitionThroughputInfoProperties(Optional.ToList(physicalPartitionThroughputInfo), serializedAdditionalRawData); + } + + PhysicalPartitionThroughputInfoProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhysicalPartitionThroughputInfoProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhysicalPartitionThroughputInfoProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhysicalPartitionThroughputInfoProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhysicalPartitionThroughputInfoProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhysicalPartitionThroughputInfoProperties(Response response) + { + if (response is null) + { + return null; } - return new PhysicalPartitionThroughputInfoProperties(Optional.ToList(physicalPartitionThroughputInfo)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhysicalPartitionThroughputInfoProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.cs index bcc8adcc1438..361f9246c5a8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoProperties object. internal partial class PhysicalPartitionThroughputInfoProperties { - /// Initializes a new instance of PhysicalPartitionThroughputInfoProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PhysicalPartitionThroughputInfoProperties() { PhysicalPartitionThroughputInfo = new ChangeTrackingList(); } - /// Initializes a new instance of PhysicalPartitionThroughputInfoProperties. + /// Initializes a new instance of . /// Array of physical partition throughput info objects. - internal PhysicalPartitionThroughputInfoProperties(IList physicalPartitionThroughputInfo) + /// Keeps track of any properties unknown to the library. + internal PhysicalPartitionThroughputInfoProperties(IList physicalPartitionThroughputInfo, Dictionary serializedAdditionalRawData) { PhysicalPartitionThroughputInfo = physicalPartitionThroughputInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of physical partition throughput info objects. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.Serialization.cs index 23a6817c9c2e..720295598b00 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PhysicalPartitionThroughputInfoResource : IUtf8JsonSerializable + public partial class PhysicalPartitionThroughputInfoResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("throughput"u8); writer.WriteNumberValue(Throughput.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhysicalPartitionThroughputInfoResource DeserializePhysicalPartitionThroughputInfoResource(JsonElement element) + internal static PhysicalPartitionThroughputInfoResource DeserializePhysicalPartitionThroughputInfoResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; Optional throughput = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -49,8 +72,61 @@ internal static PhysicalPartitionThroughputInfoResource DeserializePhysicalParti throughput = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhysicalPartitionThroughputInfoResource(id, Optional.ToNullable(throughput), serializedAdditionalRawData); + } + + PhysicalPartitionThroughputInfoResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhysicalPartitionThroughputInfoResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhysicalPartitionThroughputInfoResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhysicalPartitionThroughputInfoResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhysicalPartitionThroughputInfoResource model) + { + if (model is null) + { + return null; } - return new PhysicalPartitionThroughputInfoResource(id, Optional.ToNullable(throughput)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhysicalPartitionThroughputInfoResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhysicalPartitionThroughputInfoResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.cs index e3630ccace13..1a207f39eb0a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// PhysicalPartitionThroughputInfo object. public partial class PhysicalPartitionThroughputInfoResource { - /// Initializes a new instance of PhysicalPartitionThroughputInfoResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Id of a physical partition. /// is null. public PhysicalPartitionThroughputInfoResource(string id) @@ -23,13 +27,20 @@ public PhysicalPartitionThroughputInfoResource(string id) Id = id; } - /// Initializes a new instance of PhysicalPartitionThroughputInfoResource. + /// Initializes a new instance of . /// Id of a physical partition. /// Throughput of a physical partition. - internal PhysicalPartitionThroughputInfoResource(string id, double? throughput) + /// Keeps track of any properties unknown to the library. + internal PhysicalPartitionThroughputInfoResource(string id, double? throughput, Dictionary serializedAdditionalRawData) { Id = id; Throughput = throughput; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhysicalPartitionThroughputInfoResource() + { } /// Id of a physical partition. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.Serialization.cs index 303064461dd7..f8731d4b2010 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class PhysicalPartitionThroughputInfoResult : IUtf8JsonSerializable + public partial class PhysicalPartitionThroughputInfoResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -41,14 +48,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhysicalPartitionThroughputInfoResult DeserializePhysicalPartitionThroughputInfoResult(JsonElement element) + internal static PhysicalPartitionThroughputInfoResult DeserializePhysicalPartitionThroughputInfoResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +89,7 @@ internal static PhysicalPartitionThroughputInfoResult DeserializePhysicalPartiti ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -137,8 +166,61 @@ internal static PhysicalPartitionThroughputInfoResult DeserializePhysicalPartiti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhysicalPartitionThroughputInfoResult(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity, serializedAdditionalRawData); + } + + PhysicalPartitionThroughputInfoResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhysicalPartitionThroughputInfoResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhysicalPartitionThroughputInfoResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhysicalPartitionThroughputInfoResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhysicalPartitionThroughputInfoResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhysicalPartitionThroughputInfoResult(Response response) + { + if (response is null) + { + return null; } - return new PhysicalPartitionThroughputInfoResult(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhysicalPartitionThroughputInfoResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.cs index 851256cdf3c6..0bfe4d39ca56 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. public partial class PhysicalPartitionThroughputInfoResult : TrackedResourceData { - /// Initializes a new instance of PhysicalPartitionThroughputInfoResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public PhysicalPartitionThroughputInfoResult(AzureLocation location) : base(location) { } - /// Initializes a new instance of PhysicalPartitionThroughputInfoResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,10 +33,17 @@ public PhysicalPartitionThroughputInfoResult(AzureLocation location) : base(loca /// The location. /// properties of physical partition throughput info. /// Identity for the resource. - internal PhysicalPartitionThroughputInfoResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PhysicalPartitionThroughputInfoResultPropertiesResource resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal PhysicalPartitionThroughputInfoResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PhysicalPartitionThroughputInfoResultPropertiesResource resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PhysicalPartitionThroughputInfoResult() + { } /// properties of physical partition throughput info. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.Serialization.cs index 414fe06991a8..f1109bc2bdaf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class PhysicalPartitionThroughputInfoResultPropertiesResource : IUtf8JsonSerializable + internal partial class PhysicalPartitionThroughputInfoResultPropertiesResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PhysicalPartitionThroughputInfo)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PhysicalPartitionThroughputInfo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PhysicalPartitionThroughputInfoResultPropertiesResource DeserializePhysicalPartitionThroughputInfoResultPropertiesResource(JsonElement element) + internal static PhysicalPartitionThroughputInfoResultPropertiesResource DeserializePhysicalPartitionThroughputInfoResultPropertiesResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> physicalPartitionThroughputInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("physicalPartitionThroughputInfo"u8)) @@ -52,8 +81,61 @@ internal static PhysicalPartitionThroughputInfoResultPropertiesResource Deserial physicalPartitionThroughputInfo = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PhysicalPartitionThroughputInfoResultPropertiesResource(Optional.ToList(physicalPartitionThroughputInfo), serializedAdditionalRawData); + } + + PhysicalPartitionThroughputInfoResultPropertiesResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhysicalPartitionThroughputInfoResultPropertiesResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhysicalPartitionThroughputInfoResultPropertiesResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhysicalPartitionThroughputInfoResultPropertiesResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhysicalPartitionThroughputInfoResultPropertiesResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhysicalPartitionThroughputInfoResultPropertiesResource(Response response) + { + if (response is null) + { + return null; } - return new PhysicalPartitionThroughputInfoResultPropertiesResource(Optional.ToList(physicalPartitionThroughputInfo)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhysicalPartitionThroughputInfoResultPropertiesResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.cs index 70a0a8959196..ff8fcba7d939 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PhysicalPartitionThroughputInfoResultPropertiesResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,14 +13,15 @@ namespace Azure.ResourceManager.CosmosDB.Models /// properties of physical partition throughput info. internal partial class PhysicalPartitionThroughputInfoResultPropertiesResource : PhysicalPartitionThroughputInfoProperties { - /// Initializes a new instance of PhysicalPartitionThroughputInfoResultPropertiesResource. + /// Initializes a new instance of . public PhysicalPartitionThroughputInfoResultPropertiesResource() { } - /// Initializes a new instance of PhysicalPartitionThroughputInfoResultPropertiesResource. + /// Initializes a new instance of . /// Array of physical partition throughput info objects. - internal PhysicalPartitionThroughputInfoResultPropertiesResource(IList physicalPartitionThroughputInfo) : base(physicalPartitionThroughputInfo) + /// Keeps track of any properties unknown to the library. + internal PhysicalPartitionThroughputInfoResultPropertiesResource(IList physicalPartitionThroughputInfo, Dictionary serializedAdditionalRawData) : base(physicalPartitionThroughputInfo, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs index 71caa0ceb73d..fb39050e8793 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class PrivateEndpointProperty : IUtf8JsonSerializable + internal partial class PrivateEndpointProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PrivateEndpointProperty DeserializePrivateEndpointProperty(JsonElement element) + internal static PrivateEndpointProperty DeserializePrivateEndpointProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional id = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -41,8 +64,61 @@ internal static PrivateEndpointProperty DeserializePrivateEndpointProperty(JsonE id = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PrivateEndpointProperty(id.Value, serializedAdditionalRawData); + } + + PrivateEndpointProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateEndpointProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateEndpointProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateEndpointProperty model) + { + if (model is null) + { + return null; } - return new PrivateEndpointProperty(id.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateEndpointProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateEndpointProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs index ed2b8155d6fb..2d8480a75175 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/PrivateEndpointProperty.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Private endpoint which the connection belongs to. internal partial class PrivateEndpointProperty { - /// Initializes a new instance of PrivateEndpointProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PrivateEndpointProperty() { } - /// Initializes a new instance of PrivateEndpointProperty. + /// Initializes a new instance of . /// Resource id of the private endpoint. - internal PrivateEndpointProperty(ResourceIdentifier id) + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointProperty(ResourceIdentifier id, Dictionary serializedAdditionalRawData) { Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource id of the private endpoint. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.Serialization.cs index 09e73c77fde5..89dc2c703f46 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RedistributeThroughputParameters : IUtf8JsonSerializable + public partial class RedistributeThroughputParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,13 +46,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RedistributeThroughputParameters DeserializeRedistributeThroughputParameters(JsonElement element) + internal static RedistributeThroughputParameters DeserializeRedistributeThroughputParameters(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static RedistributeThroughputParameters DeserializeRedistributeThroughp ResourceType type = default; Optional systemData = default; RedistributeThroughputPropertiesResource resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -130,8 +159,61 @@ internal static RedistributeThroughputParameters DeserializeRedistributeThroughp } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RedistributeThroughputParameters(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, identity, serializedAdditionalRawData); + } + + RedistributeThroughputParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRedistributeThroughputParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RedistributeThroughputParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRedistributeThroughputParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RedistributeThroughputParameters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RedistributeThroughputParameters(Response response) + { + if (response is null) + { + return null; } - return new RedistributeThroughputParameters(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRedistributeThroughputParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.cs index 20a5f8fb16f6..b6a5c12fbf1f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputParameters.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB redistribute throughput parameters object. public partial class RedistributeThroughputParameters : TrackedResourceData { - /// Initializes a new instance of RedistributeThroughputParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a resource throughput. /// is null. @@ -26,7 +29,7 @@ public RedistributeThroughputParameters(AzureLocation location, RedistributeThro Resource = resource; } - /// Initializes a new instance of RedistributeThroughputParameters. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,10 +38,17 @@ public RedistributeThroughputParameters(AzureLocation location, RedistributeThro /// The location. /// The standard JSON format of a resource throughput. /// Identity for the resource. - internal RedistributeThroughputParameters(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RedistributeThroughputPropertiesResource resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal RedistributeThroughputParameters(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RedistributeThroughputPropertiesResource resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedistributeThroughputParameters() + { } /// The standard JSON format of a resource throughput. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.Serialization.cs index 93aeadbd1977..36bdc31b0d08 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RedistributeThroughputPropertiesResource : IUtf8JsonSerializable + public partial class RedistributeThroughputPropertiesResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("throughputPolicy"u8); writer.WriteStringValue(ThroughputPolicy.ToString()); @@ -22,21 +29,49 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetPhysicalPartitionThroughputInfo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("sourcePhysicalPartitionThroughputInfo"u8); writer.WriteStartArray(); foreach (var item in SourcePhysicalPartitionThroughputInfo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RedistributeThroughputPropertiesResource DeserializeRedistributeThroughputPropertiesResource(JsonElement element) + internal static RedistributeThroughputPropertiesResource DeserializeRedistributeThroughputPropertiesResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +79,7 @@ internal static RedistributeThroughputPropertiesResource DeserializeRedistribute ThroughputPolicyType throughputPolicy = default; IList targetPhysicalPartitionThroughputInfo = default; IList sourcePhysicalPartitionThroughputInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughputPolicy"u8)) @@ -71,8 +107,61 @@ internal static RedistributeThroughputPropertiesResource DeserializeRedistribute sourcePhysicalPartitionThroughputInfo = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RedistributeThroughputPropertiesResource(throughputPolicy, targetPhysicalPartitionThroughputInfo, sourcePhysicalPartitionThroughputInfo, serializedAdditionalRawData); + } + + RedistributeThroughputPropertiesResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRedistributeThroughputPropertiesResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RedistributeThroughputPropertiesResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRedistributeThroughputPropertiesResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RedistributeThroughputPropertiesResource model) + { + if (model is null) + { + return null; } - return new RedistributeThroughputPropertiesResource(throughputPolicy, targetPhysicalPartitionThroughputInfo, sourcePhysicalPartitionThroughputInfo); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RedistributeThroughputPropertiesResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRedistributeThroughputPropertiesResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.cs index 174af94a0fa3..7c970d700565 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RedistributeThroughputPropertiesResource.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource to redistribute throughput for Azure Cosmos DB resource. public partial class RedistributeThroughputPropertiesResource { - /// Initializes a new instance of RedistributeThroughputPropertiesResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// ThroughputPolicy to apply for throughput redistribution. /// Array of PhysicalPartitionThroughputInfoResource objects. /// Array of PhysicalPartitionThroughputInfoResource objects. @@ -30,15 +33,22 @@ public RedistributeThroughputPropertiesResource(ThroughputPolicyType throughputP SourcePhysicalPartitionThroughputInfo = sourcePhysicalPartitionThroughputInfo.ToList(); } - /// Initializes a new instance of RedistributeThroughputPropertiesResource. + /// Initializes a new instance of . /// ThroughputPolicy to apply for throughput redistribution. /// Array of PhysicalPartitionThroughputInfoResource objects. /// Array of PhysicalPartitionThroughputInfoResource objects. - internal RedistributeThroughputPropertiesResource(ThroughputPolicyType throughputPolicy, IList targetPhysicalPartitionThroughputInfo, IList sourcePhysicalPartitionThroughputInfo) + /// Keeps track of any properties unknown to the library. + internal RedistributeThroughputPropertiesResource(ThroughputPolicyType throughputPolicy, IList targetPhysicalPartitionThroughputInfo, IList sourcePhysicalPartitionThroughputInfo, Dictionary serializedAdditionalRawData) { ThroughputPolicy = throughputPolicy; TargetPhysicalPartitionThroughputInfo = targetPhysicalPartitionThroughputInfo; SourcePhysicalPartitionThroughputInfo = sourcePhysicalPartitionThroughputInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedistributeThroughputPropertiesResource() + { } /// ThroughputPolicy to apply for throughput redistribution. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs index da3c19b7cfd8..753318d5b2dd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RegionForOnlineOffline : IUtf8JsonSerializable + public partial class RegionForOnlineOffline : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("region"u8); writer.WriteStringValue(Region); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RegionForOnlineOffline DeserializeRegionForOnlineOffline(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string region = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RegionForOnlineOffline(region, serializedAdditionalRawData); + } + + RegionForOnlineOffline IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionForOnlineOffline(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionForOnlineOffline IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionForOnlineOffline(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionForOnlineOffline model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionForOnlineOffline(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionForOnlineOffline(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs index 5d20119d97d6..0c5f4a1be2fc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RegionForOnlineOffline.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB region to online or offline. public partial class RegionForOnlineOffline { - /// Initializes a new instance of RegionForOnlineOffline. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Cosmos DB region, with spaces between words and each word capitalized. /// is null. public RegionForOnlineOffline(string region) @@ -23,6 +27,20 @@ public RegionForOnlineOffline(string region) Region = region; } + /// Initializes a new instance of . + /// Cosmos DB region, with spaces between words and each word capitalized. + /// Keeps track of any properties unknown to the library. + internal RegionForOnlineOffline(string region, Dictionary serializedAdditionalRawData) + { + Region = region; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RegionForOnlineOffline() + { + } + /// Cosmos DB region, with spaces between words and each word capitalized. public string Region { get; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.Serialization.cs index 211de177f5be..1fbd7886133f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ResourceRestoreParameters : IUtf8JsonSerializable + public partial class ResourceRestoreParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RestoreSource)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("restoreTimestampInUtc"u8); writer.WriteStringValue(RestoreTimestampInUtc.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceRestoreParameters DeserializeResourceRestoreParameters(JsonElement element) + internal static ResourceRestoreParameters DeserializeResourceRestoreParameters(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional restoreSource = default; Optional restoreTimestampInUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("restoreSource"u8)) @@ -53,8 +75,61 @@ internal static ResourceRestoreParameters DeserializeResourceRestoreParameters(J restoreTimestampInUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceRestoreParameters(restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc), serializedAdditionalRawData); + } + + ResourceRestoreParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceRestoreParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceRestoreParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceRestoreParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceRestoreParameters model) + { + if (model is null) + { + return null; } - return new ResourceRestoreParameters(restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceRestoreParameters(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceRestoreParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.cs index 3f8657c418c3..03f0df4e51a3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ResourceRestoreParameters.cs @@ -6,21 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Parameters to indicate the information about the restore. public partial class ResourceRestoreParameters : RestoreParametersBase { - /// Initializes a new instance of ResourceRestoreParameters. + /// Initializes a new instance of . public ResourceRestoreParameters() { } - /// Initializes a new instance of ResourceRestoreParameters. + /// Initializes a new instance of . /// The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. /// Time to which the account has to be restored (ISO-8601 format). - internal ResourceRestoreParameters(string restoreSource, DateTimeOffset? restoreTimestampInUtc) : base(restoreSource, restoreTimestampInUtc) + /// Keeps track of any properties unknown to the library. + internal ResourceRestoreParameters(string restoreSource, DateTimeOffset? restoreTimestampInUtc, Dictionary serializedAdditionalRawData) : base(restoreSource, restoreTimestampInUtc, serializedAdditionalRawData) { } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableCosmosDBAccountData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableCosmosDBAccountData.Serialization.cs index 26b5b7784d6e..467c4dd9ce33 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableCosmosDBAccountData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableCosmosDBAccountData.Serialization.cs @@ -8,16 +8,70 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class RestorableCosmosDBAccountData + public partial class RestorableCosmosDBAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableCosmosDBAccountData DeserializeRestorableCosmosDBAccountData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AccountName)) + { + writer.WritePropertyName("accountName"u8); + writer.WriteStringValue(AccountName); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationTime"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(OldestRestorableOn)) + { + writer.WritePropertyName("oldestRestorableTime"u8); + writer.WriteStringValue(OldestRestorableOn.Value, "O"); + } + if (Optional.IsDefined(DeletedOn)) + { + writer.WritePropertyName("deletionTime"u8); + writer.WriteStringValue(DeletedOn.Value, "O"); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableCosmosDBAccountData DeserializeRestorableCosmosDBAccountData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +87,7 @@ internal static RestorableCosmosDBAccountData DeserializeRestorableCosmosDBAccou Optional deletionTime = default; Optional apiType = default; Optional> restorableLocations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -135,8 +190,61 @@ internal static RestorableCosmosDBAccountData DeserializeRestorableCosmosDBAccou } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableCosmosDBAccountData(id, name, type, systemData.Value, Optional.ToNullable(location), accountName.Value, Optional.ToNullable(creationTime), Optional.ToNullable(oldestRestorableTime), Optional.ToNullable(deletionTime), Optional.ToNullable(apiType), Optional.ToList(restorableLocations)); + return new RestorableCosmosDBAccountData(id, name, type, systemData.Value, Optional.ToNullable(location), accountName.Value, Optional.ToNullable(creationTime), Optional.ToNullable(oldestRestorableTime), Optional.ToNullable(deletionTime), Optional.ToNullable(apiType), Optional.ToList(restorableLocations), serializedAdditionalRawData); + } + + RestorableCosmosDBAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableCosmosDBAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableCosmosDBAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableCosmosDBAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableCosmosDBAccountData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableCosmosDBAccountData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableCosmosDBAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs index da83742b1121..6f5b50e7a04f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableDatabaseAccountsListResult + internal partial class RestorableDatabaseAccountsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableDatabaseAccountsListResult DeserializeRestorableDatabaseAccountsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableDatabaseAccountsListResult DeserializeRestorableDatabaseAccountsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static RestorableDatabaseAccountsListResult DeserializeRestorableDataba value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableDatabaseAccountsListResult(Optional.ToList(value)); + return new RestorableDatabaseAccountsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableDatabaseAccountsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableDatabaseAccountsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableDatabaseAccountsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableDatabaseAccountsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableDatabaseAccountsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableDatabaseAccountsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableDatabaseAccountsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs index fbfe0957bd1a..cfd44b069be7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableDatabaseAccountsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the restorable database accounts and their properties. internal partial class RestorableDatabaseAccountsListResult { - /// Initializes a new instance of RestorableDatabaseAccountsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableDatabaseAccountsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableDatabaseAccountsListResult. + /// Initializes a new instance of . /// List of restorable database accounts and their properties. - internal RestorableDatabaseAccountsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableDatabaseAccountsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of restorable database accounts and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.Serialization.cs index 510f47a24dd5..fa512fa068d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableGremlinDatabase + public partial class RestorableGremlinDatabase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableGremlinDatabase DeserializeRestorableGremlinDatabase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableGremlinDatabase DeserializeRestorableGremlinDatabase(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableGremlinDatabase DeserializeRestorableGremlinDatabase(J ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableGremlinDatabase DeserializeRestorableGremlinDatabase(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableGremlinDatabase(id, name, type, systemData.Value, resource.Value); + return new RestorableGremlinDatabase(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableGremlinDatabase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableGremlinDatabase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableGremlinDatabase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableGremlinDatabase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableGremlinDatabase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableGremlinDatabase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableGremlinDatabase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.cs index 9070aa8b02c6..b78da301733c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabase.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB Gremlin database event. public partial class RestorableGremlinDatabase : ResourceData { - /// Initializes a new instance of RestorableGremlinDatabase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableGremlinDatabase() { } - /// Initializes a new instance of RestorableGremlinDatabase. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB Gremlin database event. - internal RestorableGremlinDatabase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableGremlinDatabaseResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableGremlinDatabase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableGremlinDatabaseResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB Gremlin database event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.Serialization.cs index bcfcb06d66f3..14dfa82a3c20 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableGremlinDatabasesListResult + internal partial class RestorableGremlinDatabasesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableGremlinDatabasesListResult DeserializeRestorableGremlinDatabasesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableGremlinDatabasesListResult DeserializeRestorableGremlinDatabasesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableGremlinDatabasesListResult DeserializeRestorableGremli value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableGremlinDatabasesListResult(Optional.ToList(value)); + return new RestorableGremlinDatabasesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableGremlinDatabasesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableGremlinDatabasesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableGremlinDatabasesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableGremlinDatabasesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableGremlinDatabasesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableGremlinDatabasesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableGremlinDatabasesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.cs index 56ce1e63fb10..8f3374adfdf9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinDatabasesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Gremlin database events and their properties. internal partial class RestorableGremlinDatabasesListResult { - /// Initializes a new instance of RestorableGremlinDatabasesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableGremlinDatabasesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableGremlinDatabasesListResult. + /// Initializes a new instance of . /// List of Gremlin database events and their properties. - internal RestorableGremlinDatabasesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableGremlinDatabasesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Gremlin database events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.Serialization.cs index 33937fb8238e..92ddf7f7b383 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableGremlinGraph + public partial class RestorableGremlinGraph : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableGremlinGraph DeserializeRestorableGremlinGraph(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableGremlinGraph DeserializeRestorableGremlinGraph(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableGremlinGraph DeserializeRestorableGremlinGraph(JsonEle ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableGremlinGraph DeserializeRestorableGremlinGraph(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableGremlinGraph(id, name, type, systemData.Value, resource.Value); + return new RestorableGremlinGraph(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableGremlinGraph IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableGremlinGraph(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableGremlinGraph IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableGremlinGraph(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableGremlinGraph model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableGremlinGraph(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableGremlinGraph(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.cs index 8c97eef042e0..9aa1980b6c6a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraph.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB Gremlin graph event. public partial class RestorableGremlinGraph : ResourceData { - /// Initializes a new instance of RestorableGremlinGraph. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableGremlinGraph() { } - /// Initializes a new instance of RestorableGremlinGraph. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB Gremlin graph event. - internal RestorableGremlinGraph(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableGremlinGraphResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableGremlinGraph(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableGremlinGraphResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB Gremlin graph event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.Serialization.cs index a36e2d6023b8..8c242d002feb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableGremlinGraphsListResult + internal partial class RestorableGremlinGraphsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableGremlinGraphsListResult DeserializeRestorableGremlinGraphsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableGremlinGraphsListResult DeserializeRestorableGremlinGraphsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableGremlinGraphsListResult DeserializeRestorableGremlinGr value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableGremlinGraphsListResult(Optional.ToList(value)); + return new RestorableGremlinGraphsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableGremlinGraphsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableGremlinGraphsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableGremlinGraphsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableGremlinGraphsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableGremlinGraphsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableGremlinGraphsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableGremlinGraphsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.cs index 2f90d607f9c7..89f996ca1352 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinGraphsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Gremlin graph events and their properties. internal partial class RestorableGremlinGraphsListResult { - /// Initializes a new instance of RestorableGremlinGraphsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableGremlinGraphsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableGremlinGraphsListResult. + /// Initializes a new instance of . /// List of Gremlin graph events and their properties. - internal RestorableGremlinGraphsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableGremlinGraphsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Gremlin graph events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.Serialization.cs index a65424303063..caf81be07434 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.Serialization.cs @@ -5,17 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableGremlinResourceData + public partial class RestorableGremlinResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableGremlinResourceData DeserializeRestorableGremlinResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"u8); + writer.WriteStringValue(DatabaseName); + } + if (Optional.IsCollectionDefined(GraphNames)) + { + writer.WritePropertyName("graphNames"u8); + writer.WriteStartArray(); + foreach (var item in GraphNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableGremlinResourceData DeserializeRestorableGremlinResourceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +68,7 @@ internal static RestorableGremlinResourceData DeserializeRestorableGremlinResour string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -71,8 +114,61 @@ internal static RestorableGremlinResourceData DeserializeRestorableGremlinResour systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableGremlinResourceData(id, name, type, systemData.Value, databaseName.Value, Optional.ToList(graphNames)); + return new RestorableGremlinResourceData(id, name, type, systemData.Value, databaseName.Value, Optional.ToList(graphNames), serializedAdditionalRawData); + } + + RestorableGremlinResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableGremlinResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableGremlinResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableGremlinResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableGremlinResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableGremlinResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableGremlinResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.cs index 55a888fb7eb1..3cb2818ed7da 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Specific Databases to restore. public partial class RestorableGremlinResourceData : ResourceData { - /// Initializes a new instance of RestorableGremlinResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableGremlinResourceData() { GraphNames = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableGremlinResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The name of the gremlin database available for restore. /// The names of the graphs available for restore. - internal RestorableGremlinResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, IReadOnlyList graphNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableGremlinResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, IReadOnlyList graphNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DatabaseName = databaseName; GraphNames = graphNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the gremlin database available for restore. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.Serialization.cs index 5cb47d321c3c..daccb0934f15 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableGremlinResourcesListResult + internal partial class RestorableGremlinResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableGremlinResourcesListResult DeserializeRestorableGremlinResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableGremlinResourcesListResult DeserializeRestorableGremlinResourcesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableGremlinResourcesListResult DeserializeRestorableGremli value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableGremlinResourcesListResult(Optional.ToList(value)); + return new RestorableGremlinResourcesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableGremlinResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableGremlinResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableGremlinResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableGremlinResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableGremlinResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableGremlinResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableGremlinResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.cs index c0f267d01e62..3472d44e1e0c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableGremlinResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the restorable Gremlin resources. internal partial class RestorableGremlinResourcesListResult { - /// Initializes a new instance of RestorableGremlinResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableGremlinResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableGremlinResourcesListResult. + /// Initializes a new instance of . /// List of restorable Gremlin resources, including the gremlin database and graph names. - internal RestorableGremlinResourcesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableGremlinResourcesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of restorable Gremlin resources, including the gremlin database and graph names. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.Serialization.cs index 07481bd62080..ab90a4cb70de 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableLocationResourceInfo + public partial class RestorableLocationResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableLocationResourceInfo DeserializeRestorableLocationResourceInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableLocationResourceInfo DeserializeRestorableLocationResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static RestorableLocationResourceInfo DeserializeRestorableLocationReso Optional regionalDatabaseAccountInstanceId = default; Optional creationTime = default; Optional deletionTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("locationName"u8)) @@ -57,8 +85,61 @@ internal static RestorableLocationResourceInfo DeserializeRestorableLocationReso deletionTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableLocationResourceInfo(Optional.ToNullable(locationName), regionalDatabaseAccountInstanceId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(deletionTime)); + return new RestorableLocationResourceInfo(Optional.ToNullable(locationName), regionalDatabaseAccountInstanceId.Value, Optional.ToNullable(creationTime), Optional.ToNullable(deletionTime), serializedAdditionalRawData); + } + + RestorableLocationResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableLocationResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableLocationResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableLocationResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableLocationResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableLocationResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableLocationResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.cs index b9b1e78919c1..4bfe3f2430a3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableLocationResourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties of the regional restorable account. public partial class RestorableLocationResourceInfo { - /// Initializes a new instance of RestorableLocationResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableLocationResourceInfo() { } - /// Initializes a new instance of RestorableLocationResourceInfo. + /// Initializes a new instance of . /// The location of the regional restorable account. /// The instance id of the regional restorable account. /// The creation time of the regional restorable database account (ISO-8601 format). /// The time at which the regional restorable database account has been deleted (ISO-8601 format). - internal RestorableLocationResourceInfo(AzureLocation? locationName, string regionalDatabaseAccountInstanceId, DateTimeOffset? createdOn, DateTimeOffset? deletedOn) + /// Keeps track of any properties unknown to the library. + internal RestorableLocationResourceInfo(AzureLocation? locationName, string regionalDatabaseAccountInstanceId, DateTimeOffset? createdOn, DateTimeOffset? deletedOn, Dictionary serializedAdditionalRawData) { LocationName = locationName; RegionalDatabaseAccountInstanceId = regionalDatabaseAccountInstanceId; CreatedOn = createdOn; DeletedOn = deletedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The location of the regional restorable account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.Serialization.cs index fb99915c38a8..3aed3bca29a4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableMongoDBCollection + public partial class RestorableMongoDBCollection : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableMongoDBCollection DeserializeRestorableMongoDBCollection(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableMongoDBCollection DeserializeRestorableMongoDBCollection(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableMongoDBCollection DeserializeRestorableMongoDBCollecti ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableMongoDBCollection DeserializeRestorableMongoDBCollecti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableMongoDBCollection(id, name, type, systemData.Value, resource.Value); + return new RestorableMongoDBCollection(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableMongoDBCollection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableMongoDBCollection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableMongoDBCollection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableMongoDBCollection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableMongoDBCollection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableMongoDBCollection(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableMongoDBCollection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.cs index 1db515a27e2d..179d3794f587 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollection.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB MongoDB collection event. public partial class RestorableMongoDBCollection : ResourceData { - /// Initializes a new instance of RestorableMongoDBCollection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableMongoDBCollection() { } - /// Initializes a new instance of RestorableMongoDBCollection. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB MongoDB collection event. - internal RestorableMongoDBCollection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableMongoDBCollectionResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableMongoDBCollection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableMongoDBCollectionResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB MongoDB collection event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.Serialization.cs index 75b8fa2229bb..8f6b88c06212 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableMongoDBCollectionsListResult + internal partial class RestorableMongoDBCollectionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableMongoDBCollectionsListResult DeserializeRestorableMongoDBCollectionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableMongoDBCollectionsListResult DeserializeRestorableMongoDBCollectionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableMongoDBCollectionsListResult DeserializeRestorableMong value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableMongoDBCollectionsListResult(Optional.ToList(value)); + return new RestorableMongoDBCollectionsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableMongoDBCollectionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableMongoDBCollectionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableMongoDBCollectionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableMongoDBCollectionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableMongoDBCollectionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableMongoDBCollectionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableMongoDBCollectionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.cs index 7d9fcaf74157..e4874372e93f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBCollectionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the MongoDB collection events and their properties. internal partial class RestorableMongoDBCollectionsListResult { - /// Initializes a new instance of RestorableMongoDBCollectionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableMongoDBCollectionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableMongoDBCollectionsListResult. + /// Initializes a new instance of . /// List of MongoDB collection events and their properties. - internal RestorableMongoDBCollectionsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableMongoDBCollectionsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of MongoDB collection events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.Serialization.cs index 4e0c9b0ca7a8..130cfc9a783f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableMongoDBDatabase + public partial class RestorableMongoDBDatabase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableMongoDBDatabase DeserializeRestorableMongoDBDatabase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableMongoDBDatabase DeserializeRestorableMongoDBDatabase(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableMongoDBDatabase DeserializeRestorableMongoDBDatabase(J ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableMongoDBDatabase DeserializeRestorableMongoDBDatabase(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableMongoDBDatabase(id, name, type, systemData.Value, resource.Value); + return new RestorableMongoDBDatabase(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableMongoDBDatabase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableMongoDBDatabase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableMongoDBDatabase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableMongoDBDatabase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableMongoDBDatabase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableMongoDBDatabase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableMongoDBDatabase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.cs index 73f9cdc67fb3..a2569a714951 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabase.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB MongoDB database event. public partial class RestorableMongoDBDatabase : ResourceData { - /// Initializes a new instance of RestorableMongoDBDatabase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableMongoDBDatabase() { } - /// Initializes a new instance of RestorableMongoDBDatabase. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB MongoDB database event. - internal RestorableMongoDBDatabase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableMongoDBDatabaseResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableMongoDBDatabase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableMongoDBDatabaseResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB MongoDB database event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.Serialization.cs index 3ad796232ef0..74cfdc150bda 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableMongoDBDatabasesListResult + internal partial class RestorableMongoDBDatabasesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableMongoDBDatabasesListResult DeserializeRestorableMongoDBDatabasesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableMongoDBDatabasesListResult DeserializeRestorableMongoDBDatabasesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableMongoDBDatabasesListResult DeserializeRestorableMongoD value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableMongoDBDatabasesListResult(Optional.ToList(value)); + return new RestorableMongoDBDatabasesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableMongoDBDatabasesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableMongoDBDatabasesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableMongoDBDatabasesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableMongoDBDatabasesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableMongoDBDatabasesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableMongoDBDatabasesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableMongoDBDatabasesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.cs index 2002ecc266c5..35b0e99d1139 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBDatabasesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the MongoDB database events and their properties. internal partial class RestorableMongoDBDatabasesListResult { - /// Initializes a new instance of RestorableMongoDBDatabasesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableMongoDBDatabasesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableMongoDBDatabasesListResult. + /// Initializes a new instance of . /// List of MongoDB database events and their properties. - internal RestorableMongoDBDatabasesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableMongoDBDatabasesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of MongoDB database events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.Serialization.cs index c325c6b7ef2f..c96370d58022 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.Serialization.cs @@ -5,17 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableMongoDBResourceData + public partial class RestorableMongoDBResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableMongoDBResourceData DeserializeRestorableMongoDBResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"u8); + writer.WriteStringValue(DatabaseName); + } + if (Optional.IsCollectionDefined(CollectionNames)) + { + writer.WritePropertyName("collectionNames"u8); + writer.WriteStartArray(); + foreach (var item in CollectionNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableMongoDBResourceData DeserializeRestorableMongoDBResourceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +68,7 @@ internal static RestorableMongoDBResourceData DeserializeRestorableMongoDBResour string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -71,8 +114,61 @@ internal static RestorableMongoDBResourceData DeserializeRestorableMongoDBResour systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableMongoDBResourceData(id, name, type, systemData.Value, databaseName.Value, Optional.ToList(collectionNames)); + return new RestorableMongoDBResourceData(id, name, type, systemData.Value, databaseName.Value, Optional.ToList(collectionNames), serializedAdditionalRawData); + } + + RestorableMongoDBResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableMongoDBResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableMongoDBResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableMongoDBResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableMongoDBResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableMongoDBResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableMongoDBResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.cs index 626f4a0f0fb9..a446901d4110 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Specific Databases to restore. public partial class RestorableMongoDBResourceData : ResourceData { - /// Initializes a new instance of RestorableMongoDBResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableMongoDBResourceData() { CollectionNames = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableMongoDBResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The name of the database available for restore. /// The names of the collections available for restore. - internal RestorableMongoDBResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, IReadOnlyList collectionNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableMongoDBResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, IReadOnlyList collectionNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DatabaseName = databaseName; CollectionNames = collectionNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the database available for restore. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.Serialization.cs index 31a397b48c63..c26dea64c1cf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableMongoDBResourcesListResult + internal partial class RestorableMongoDBResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableMongoDBResourcesListResult DeserializeRestorableMongoDBResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableMongoDBResourcesListResult DeserializeRestorableMongoDBResourcesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableMongoDBResourcesListResult DeserializeRestorableMongoD value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableMongoDBResourcesListResult(Optional.ToList(value)); + return new RestorableMongoDBResourcesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableMongoDBResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableMongoDBResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableMongoDBResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableMongoDBResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableMongoDBResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableMongoDBResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableMongoDBResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.cs index 8cd54287b942..059b167f53ff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableMongoDBResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the restorable MongoDB resources. internal partial class RestorableMongoDBResourcesListResult { - /// Initializes a new instance of RestorableMongoDBResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableMongoDBResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableMongoDBResourcesListResult. + /// Initializes a new instance of . /// List of restorable MongoDB resources, including the database and collection names. - internal RestorableMongoDBResourcesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableMongoDBResourcesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of restorable MongoDB resources, including the database and collection names. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.Serialization.cs index 319476db5d90..6b731d934d9a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableSqlContainer + public partial class RestorableSqlContainer : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableSqlContainer DeserializeRestorableSqlContainer(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableSqlContainer DeserializeRestorableSqlContainer(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableSqlContainer DeserializeRestorableSqlContainer(JsonEle ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableSqlContainer DeserializeRestorableSqlContainer(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableSqlContainer(id, name, type, systemData.Value, resource.Value); + return new RestorableSqlContainer(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableSqlContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlContainer model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlContainer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.cs index 8724d323d531..573186268b4d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainer.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB SQL container event. public partial class RestorableSqlContainer : ResourceData { - /// Initializes a new instance of RestorableSqlContainer. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableSqlContainer() { } - /// Initializes a new instance of RestorableSqlContainer. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB SQL container event. - internal RestorableSqlContainer(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableSqlContainerResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlContainer(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableSqlContainerResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB SQL container event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs index 57004819798e..de7c25fe21db 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.Serialization.cs @@ -5,28 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableSqlContainerPropertiesResourceContainer : IUtf8JsonSerializable + public partial class RestorableSqlContainerPropertiesResourceContainer : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(ContainerName); if (Optional.IsDefined(IndexingPolicy)) { writer.WritePropertyName("indexingPolicy"u8); - writer.WriteObjectValue(IndexingPolicy); + if (IndexingPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IndexingPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionKey)) { writer.WritePropertyName("partitionKey"u8); - writer.WriteObjectValue(PartitionKey); + if (PartitionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionKey).Serialize(writer, options); + } } if (Optional.IsDefined(DefaultTtl)) { @@ -36,17 +57,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UniqueKeyPolicy)) { writer.WritePropertyName("uniqueKeyPolicy"u8); - writer.WriteObjectValue(UniqueKeyPolicy); + if (UniqueKeyPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UniqueKeyPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ConflictResolutionPolicy)) { writer.WritePropertyName("conflictResolutionPolicy"u8); - writer.WriteObjectValue(ConflictResolutionPolicy); + if (ConflictResolutionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConflictResolutionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(ClientEncryptionPolicy)) { writer.WritePropertyName("clientEncryptionPolicy"u8); - writer.WriteObjectValue(ClientEncryptionPolicy); + if (ClientEncryptionPolicy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientEncryptionPolicy).Serialize(writer, options); + } } if (Optional.IsDefined(AnalyticalStorageTtl)) { @@ -56,7 +98,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { @@ -66,13 +115,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MaterializedViewDefinition)) { writer.WritePropertyName("materializedViewDefinition"u8); - writer.WriteObjectValue(MaterializedViewDefinition); + if (MaterializedViewDefinition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaterializedViewDefinition).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static RestorableSqlContainerPropertiesResourceContainer DeserializeRestorableSqlContainerPropertiesResourceContainer(JsonElement element) + internal static RestorableSqlContainerPropertiesResourceContainer DeserializeRestorableSqlContainerPropertiesResourceContainer(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -92,6 +162,7 @@ internal static RestorableSqlContainerPropertiesResourceContainer DeserializeRes Optional restoreParameters = default; Optional createMode = default; Optional materializedViewDefinition = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_self"u8)) @@ -217,8 +288,61 @@ internal static RestorableSqlContainerPropertiesResourceContainer DeserializeRes materializedViewDefinition = MaterializedViewDefinition.DeserializeMaterializedViewDefinition(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorableSqlContainerPropertiesResourceContainer(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, clientEncryptionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), materializedViewDefinition.Value, self.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + RestorableSqlContainerPropertiesResourceContainer IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlContainerPropertiesResourceContainer(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlContainerPropertiesResourceContainer IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlContainerPropertiesResourceContainer(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlContainerPropertiesResourceContainer model) + { + if (model is null) + { + return null; } - return new RestorableSqlContainerPropertiesResourceContainer(id, indexingPolicy.Value, partitionKey.Value, Optional.ToNullable(defaultTtl), uniqueKeyPolicy.Value, conflictResolutionPolicy.Value, clientEncryptionPolicy.Value, Optional.ToNullable(analyticalStorageTtl), restoreParameters.Value, Optional.ToNullable(createMode), materializedViewDefinition.Value, self.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlContainerPropertiesResourceContainer(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlContainerPropertiesResourceContainer(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs index cb23511a682c..b26b72ed76b5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainerPropertiesResourceContainer.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL container resource object. public partial class RestorableSqlContainerPropertiesResourceContainer : CosmosDBSqlContainerResourceInfo { - /// Initializes a new instance of RestorableSqlContainerPropertiesResourceContainer. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// is null. public RestorableSqlContainerPropertiesResourceContainer(string containerName) : base(containerName) @@ -22,7 +23,7 @@ public RestorableSqlContainerPropertiesResourceContainer(string containerName) : Argument.AssertNotNull(containerName, nameof(containerName)); } - /// Initializes a new instance of RestorableSqlContainerPropertiesResourceContainer. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL container. /// The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. /// The configuration of the partition key to be used for partitioning data into multiple partitions. @@ -38,7 +39,8 @@ public RestorableSqlContainerPropertiesResourceContainer(string containerName) : /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal RestorableSqlContainerPropertiesResourceContainer(string containerName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, CosmosDBClientEncryptionPolicy clientEncryptionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, MaterializedViewDefinition materializedViewDefinition, string self, string rid, float? timestamp, ETag? etag) : base(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlContainerPropertiesResourceContainer(string containerName, CosmosDBIndexingPolicy indexingPolicy, CosmosDBContainerPartitionKey partitionKey, int? defaultTtl, CosmosDBUniqueKeyPolicy uniqueKeyPolicy, ConflictResolutionPolicy conflictResolutionPolicy, CosmosDBClientEncryptionPolicy clientEncryptionPolicy, long? analyticalStorageTtl, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, MaterializedViewDefinition materializedViewDefinition, string self, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(containerName, indexingPolicy, partitionKey, defaultTtl, uniqueKeyPolicy, conflictResolutionPolicy, clientEncryptionPolicy, analyticalStorageTtl, restoreParameters, createMode, materializedViewDefinition, serializedAdditionalRawData) { Self = self; Rid = rid; @@ -46,6 +48,11 @@ internal RestorableSqlContainerPropertiesResourceContainer(string containerName, ETag = etag; } + /// Initializes a new instance of for deserialization. + internal RestorableSqlContainerPropertiesResourceContainer() + { + } + /// A system generated property that specifies the addressable path of the container resource. public string Self { get; } /// A system generated property. A unique identifier. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs index e176d07bdd2e..8134c5e4cccf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableSqlContainersListResult + internal partial class RestorableSqlContainersListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableSqlContainersListResult DeserializeRestorableSqlContainersListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableSqlContainersListResult DeserializeRestorableSqlContainersListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableSqlContainersListResult DeserializeRestorableSqlContai value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableSqlContainersListResult(Optional.ToList(value)); + return new RestorableSqlContainersListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableSqlContainersListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlContainersListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlContainersListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlContainersListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlContainersListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlContainersListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlContainersListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs index 25731d1146a6..e6e1dd601d37 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlContainersListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the SQL container events and their properties. internal partial class RestorableSqlContainersListResult { - /// Initializes a new instance of RestorableSqlContainersListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableSqlContainersListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableSqlContainersListResult. + /// Initializes a new instance of . /// List of SQL container events and their properties. - internal RestorableSqlContainersListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlContainersListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of SQL container events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.Serialization.cs index 1abee1a6fae4..69fb1874d3e4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableSqlDatabase + public partial class RestorableSqlDatabase : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableSqlDatabase DeserializeRestorableSqlDatabase(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableSqlDatabase DeserializeRestorableSqlDatabase(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableSqlDatabase DeserializeRestorableSqlDatabase(JsonEleme ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableSqlDatabase DeserializeRestorableSqlDatabase(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableSqlDatabase(id, name, type, systemData.Value, resource.Value); + return new RestorableSqlDatabase(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableSqlDatabase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlDatabase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlDatabase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlDatabase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlDatabase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlDatabase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlDatabase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.cs index bbcc1361c291..b5265f85a6b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabase.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB SQL database event. public partial class RestorableSqlDatabase : ResourceData { - /// Initializes a new instance of RestorableSqlDatabase. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableSqlDatabase() { } - /// Initializes a new instance of RestorableSqlDatabase. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB SQL database event. - internal RestorableSqlDatabase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableSqlDatabaseResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlDatabase(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableSqlDatabaseResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB SQL database event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs index 5f2157a1ba84..4baedb035389 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.Serialization.cs @@ -5,34 +5,62 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableSqlDatabasePropertiesResourceDatabase : IUtf8JsonSerializable + public partial class RestorableSqlDatabasePropertiesResourceDatabase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("id"u8); writer.WriteStringValue(DatabaseName); if (Optional.IsDefined(RestoreParameters)) { writer.WritePropertyName("restoreParameters"u8); - writer.WriteObjectValue(RestoreParameters); + if (RestoreParameters is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RestoreParameters).Serialize(writer, options); + } } if (Optional.IsDefined(CreateMode)) { writer.WritePropertyName("createMode"u8); writer.WriteStringValue(CreateMode.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestorableSqlDatabasePropertiesResourceDatabase DeserializeRestorableSqlDatabasePropertiesResourceDatabase(JsonElement element) + internal static RestorableSqlDatabasePropertiesResourceDatabase DeserializeRestorableSqlDatabasePropertiesResourceDatabase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +74,7 @@ internal static RestorableSqlDatabasePropertiesResourceDatabase DeserializeResto string id = default; Optional restoreParameters = default; Optional createMode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_colls"u8)) @@ -109,8 +138,61 @@ internal static RestorableSqlDatabasePropertiesResourceDatabase DeserializeResto createMode = new CosmosDBAccountCreateMode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestorableSqlDatabasePropertiesResourceDatabase(id, restoreParameters.Value, Optional.ToNullable(createMode), colls.Value, users.Value, self.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag), serializedAdditionalRawData); + } + + RestorableSqlDatabasePropertiesResourceDatabase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlDatabasePropertiesResourceDatabase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlDatabasePropertiesResourceDatabase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlDatabasePropertiesResourceDatabase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlDatabasePropertiesResourceDatabase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlDatabasePropertiesResourceDatabase(Response response) + { + if (response is null) + { + return null; } - return new RestorableSqlDatabasePropertiesResourceDatabase(id, restoreParameters.Value, Optional.ToNullable(createMode), colls.Value, users.Value, self.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlDatabasePropertiesResourceDatabase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs index 4acfbe614708..4cb3ae7578ed 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasePropertiesResourceDatabase.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB SQL database resource object. public partial class RestorableSqlDatabasePropertiesResourceDatabase : CosmosDBSqlDatabaseResourceInfo { - /// Initializes a new instance of RestorableSqlDatabasePropertiesResourceDatabase. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// is null. public RestorableSqlDatabasePropertiesResourceDatabase(string databaseName) : base(databaseName) @@ -22,7 +23,7 @@ public RestorableSqlDatabasePropertiesResourceDatabase(string databaseName) : ba Argument.AssertNotNull(databaseName, nameof(databaseName)); } - /// Initializes a new instance of RestorableSqlDatabasePropertiesResourceDatabase. + /// Initializes a new instance of . /// Name of the Cosmos DB SQL database. /// Parameters to indicate the information about the restore. /// Enum to indicate the mode of resource creation. @@ -32,7 +33,8 @@ public RestorableSqlDatabasePropertiesResourceDatabase(string databaseName) : ba /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal RestorableSqlDatabasePropertiesResourceDatabase(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string colls, string users, string self, string rid, float? timestamp, ETag? etag) : base(databaseName, restoreParameters, createMode) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlDatabasePropertiesResourceDatabase(string databaseName, ResourceRestoreParameters restoreParameters, CosmosDBAccountCreateMode? createMode, string colls, string users, string self, string rid, float? timestamp, ETag? etag, Dictionary serializedAdditionalRawData) : base(databaseName, restoreParameters, createMode, serializedAdditionalRawData) { Colls = colls; Users = users; @@ -42,6 +44,11 @@ internal RestorableSqlDatabasePropertiesResourceDatabase(string databaseName, Re ETag = etag; } + /// Initializes a new instance of for deserialization. + internal RestorableSqlDatabasePropertiesResourceDatabase() + { + } + /// A system generated property that specified the addressable path of the collections resource. public string Colls { get; } /// A system generated property that specifies the addressable path of the users resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs index 1ec1f0a12c2f..2d87b4d6a212 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableSqlDatabasesListResult + internal partial class RestorableSqlDatabasesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableSqlDatabasesListResult DeserializeRestorableSqlDatabasesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableSqlDatabasesListResult DeserializeRestorableSqlDatabasesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableSqlDatabasesListResult DeserializeRestorableSqlDatabas value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableSqlDatabasesListResult(Optional.ToList(value)); + return new RestorableSqlDatabasesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableSqlDatabasesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlDatabasesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlDatabasesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlDatabasesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlDatabasesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlDatabasesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlDatabasesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs index 024191c8bb78..0583dccce73d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlDatabasesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the SQL database events and their properties. internal partial class RestorableSqlDatabasesListResult { - /// Initializes a new instance of RestorableSqlDatabasesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableSqlDatabasesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableSqlDatabasesListResult. + /// Initializes a new instance of . /// List of SQL database events and their properties. - internal RestorableSqlDatabasesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlDatabasesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of SQL database events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.Serialization.cs index 5dfc9ac2a475..b925bc1e2272 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.Serialization.cs @@ -5,17 +5,59 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableSqlResourceData + public partial class RestorableSqlResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableSqlResourceData DeserializeRestorableSqlResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"u8); + writer.WriteStringValue(DatabaseName); + } + if (Optional.IsCollectionDefined(CollectionNames)) + { + writer.WritePropertyName("collectionNames"u8); + writer.WriteStartArray(); + foreach (var item in CollectionNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableSqlResourceData DeserializeRestorableSqlResourceData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +68,7 @@ internal static RestorableSqlResourceData DeserializeRestorableSqlResourceData(J string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("databaseName"u8)) @@ -71,8 +114,61 @@ internal static RestorableSqlResourceData DeserializeRestorableSqlResourceData(J systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableSqlResourceData(id, name, type, systemData.Value, databaseName.Value, Optional.ToList(collectionNames)); + return new RestorableSqlResourceData(id, name, type, systemData.Value, databaseName.Value, Optional.ToList(collectionNames), serializedAdditionalRawData); + } + + RestorableSqlResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.cs index 28f4ff7792b0..f6c33ca31e01 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Specific Databases to restore. public partial class RestorableSqlResourceData : ResourceData { - /// Initializes a new instance of RestorableSqlResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableSqlResourceData() { CollectionNames = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableSqlResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The name of the database available for restore. /// The names of the collections available for restore. - internal RestorableSqlResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, IReadOnlyList collectionNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string databaseName, IReadOnlyList collectionNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DatabaseName = databaseName; CollectionNames = collectionNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the database available for restore. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs index 83fedcd6c488..621e092ff293 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableSqlResourcesListResult + internal partial class RestorableSqlResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableSqlResourcesListResult DeserializeRestorableSqlResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableSqlResourcesListResult DeserializeRestorableSqlResourcesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableSqlResourcesListResult DeserializeRestorableSqlResourc value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableSqlResourcesListResult(Optional.ToList(value)); + return new RestorableSqlResourcesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableSqlResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableSqlResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableSqlResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableSqlResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableSqlResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableSqlResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableSqlResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs index d7e5621814f3..b8d0127b7ffc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableSqlResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the restorable SQL resources. internal partial class RestorableSqlResourcesListResult { - /// Initializes a new instance of RestorableSqlResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableSqlResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableSqlResourcesListResult. + /// Initializes a new instance of . /// List of restorable SQL resources, including the database and collection names. - internal RestorableSqlResourcesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableSqlResourcesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of restorable SQL resources, including the database and collection names. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.Serialization.cs index 3f6070cab79c..9dc566a67089 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.Serialization.cs @@ -5,16 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableTable + public partial class RestorableTable : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableTable DeserializeRestorableTable(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableTable DeserializeRestorableTable(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +67,7 @@ internal static RestorableTable DeserializeRestorableTable(JsonElement element) ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -71,8 +115,61 @@ internal static RestorableTable DeserializeRestorableTable(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableTable(id, name, type, systemData.Value, resource.Value); + return new RestorableTable(id, name, type, systemData.Value, resource.Value, serializedAdditionalRawData); + } + + RestorableTable IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableTable(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableTable IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableTable(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableTable model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableTable(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableTable(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.cs index 82cbf4b637ab..5f9edfabbc1b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTable.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.CosmosDB.Models /// An Azure Cosmos DB Table event. public partial class RestorableTable : ResourceData { - /// Initializes a new instance of RestorableTable. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableTable() { } - /// Initializes a new instance of RestorableTable. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The resource of an Azure Cosmos DB Table event. - internal RestorableTable(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableTableResourceInfo resource) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableTable(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExtendedRestorableTableResourceInfo resource, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Resource = resource; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource of an Azure Cosmos DB Table event. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.Serialization.cs index 6dc0fcf8fcd5..a849054c4acd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestorableTableResourceData + public partial class RestorableTableResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableTableResourceData DeserializeRestorableTableResourceData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableTableResourceData DeserializeRestorableTableResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static RestorableTableResourceData DeserializeRestorableTableResourceDa Optional id = default; Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -38,8 +67,61 @@ internal static RestorableTableResourceData DeserializeRestorableTableResourceDa type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableTableResourceData(id.Value, name.Value, type.Value); + return new RestorableTableResourceData(id.Value, name.Value, type.Value, serializedAdditionalRawData); + } + + RestorableTableResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableTableResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableTableResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableTableResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableTableResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableTableResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableTableResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.cs index 3ee7b3cbf30e..f1dbba89c959 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourceData.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Specific Databases to restore. public partial class RestorableTableResourceData { - /// Initializes a new instance of RestorableTableResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableTableResourceData() { } - /// Initializes a new instance of RestorableTableResourceData. + /// Initializes a new instance of . /// The unique resource identifier of the ARM resource. /// The name of the Table. /// The type of Azure resource. - internal RestorableTableResourceData(string id, string name, string resourceType) + /// Keeps track of any properties unknown to the library. + internal RestorableTableResourceData(string id, string name, string resourceType, Dictionary serializedAdditionalRawData) { Id = id; Name = name; ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The unique resource identifier of the ARM resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.Serialization.cs index cc359edb0362..d7d756de6483 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableTableResourcesListResult + internal partial class RestorableTableResourcesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableTableResourcesListResult DeserializeRestorableTableResourcesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableTableResourcesListResult DeserializeRestorableTableResourcesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableTableResourcesListResult DeserializeRestorableTableRes value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableTableResourcesListResult(Optional.ToList(value)); + return new RestorableTableResourcesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableTableResourcesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableTableResourcesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableTableResourcesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableTableResourcesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableTableResourcesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableTableResourcesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableTableResourcesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.cs index ca577691d1b5..19b07ec63c43 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTableResourcesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// List of restorable table names. internal partial class RestorableTableResourcesListResult { - /// Initializes a new instance of RestorableTableResourcesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableTableResourcesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableTableResourcesListResult. + /// Initializes a new instance of . /// List of restorable table names. - internal RestorableTableResourcesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableTableResourcesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of restorable table names. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.Serialization.cs index 0e72d4c1f936..aae26393dbac 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class RestorableTablesListResult + internal partial class RestorableTablesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RestorableTablesListResult DeserializeRestorableTablesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RestorableTablesListResult DeserializeRestorableTablesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static RestorableTablesListResult DeserializeRestorableTablesListResult value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RestorableTablesListResult(Optional.ToList(value)); + return new RestorableTablesListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + RestorableTablesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestorableTablesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestorableTablesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestorableTablesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestorableTablesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestorableTablesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestorableTablesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.cs index 14b10dab2fd3..c3a132e23fd5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestorableTablesListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The List operation response, that contains the Table events and their properties. internal partial class RestorableTablesListResult { - /// Initializes a new instance of RestorableTablesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableTablesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableTablesListResult. + /// Initializes a new instance of . /// List of Table events and their properties. - internal RestorableTablesListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal RestorableTablesListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of Table events and their properties. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.Serialization.cs index 52178be273ac..478765177d23 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RestoreParametersBase : IUtf8JsonSerializable + public partial class RestoreParametersBase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RestoreSource)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("restoreTimestampInUtc"u8); writer.WriteStringValue(RestoreTimestampInUtc.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RestoreParametersBase DeserializeRestoreParametersBase(JsonElement element) + internal static RestoreParametersBase DeserializeRestoreParametersBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional restoreSource = default; Optional restoreTimestampInUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("restoreSource"u8)) @@ -53,8 +75,61 @@ internal static RestoreParametersBase DeserializeRestoreParametersBase(JsonEleme restoreTimestampInUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RestoreParametersBase(restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc), serializedAdditionalRawData); + } + + RestoreParametersBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestoreParametersBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestoreParametersBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestoreParametersBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestoreParametersBase model) + { + if (model is null) + { + return null; } - return new RestoreParametersBase(restoreSource.Value, Optional.ToNullable(restoreTimestampInUtc)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestoreParametersBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestoreParametersBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.cs index 061ca1db74c4..81a3f9b27eba 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RestoreParametersBase.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CosmosDB.Models { /// Parameters to indicate the information about the restore. public partial class RestoreParametersBase { - /// Initializes a new instance of RestoreParametersBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RestoreParametersBase() { } - /// Initializes a new instance of RestoreParametersBase. + /// Initializes a new instance of . /// The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. /// Time to which the account has to be restored (ISO-8601 format). - internal RestoreParametersBase(string restoreSource, DateTimeOffset? restoreTimestampInUtc) + /// Keeps track of any properties unknown to the library. + internal RestoreParametersBase(string restoreSource, DateTimeOffset? restoreTimestampInUtc, Dictionary serializedAdditionalRawData) { RestoreSource = restoreSource; RestoreTimestampInUtc = restoreTimestampInUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.Serialization.cs index 949612741557..f25fed27bf6c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RetrieveThroughputParameters : IUtf8JsonSerializable + public partial class RetrieveThroughputParameters : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,13 +46,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RetrieveThroughputParameters DeserializeRetrieveThroughputParameters(JsonElement element) + internal static RetrieveThroughputParameters DeserializeRetrieveThroughputParameters(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static RetrieveThroughputParameters DeserializeRetrieveThroughputParame ResourceType type = default; Optional systemData = default; RetrieveThroughputPropertiesResource resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -130,8 +159,61 @@ internal static RetrieveThroughputParameters DeserializeRetrieveThroughputParame } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RetrieveThroughputParameters(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, identity, serializedAdditionalRawData); + } + + RetrieveThroughputParameters IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRetrieveThroughputParameters(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RetrieveThroughputParameters IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRetrieveThroughputParameters(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RetrieveThroughputParameters model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RetrieveThroughputParameters(Response response) + { + if (response is null) + { + return null; } - return new RetrieveThroughputParameters(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRetrieveThroughputParameters(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.cs index 426fa7a5a4e6..62faf7d5e0f8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputParameters.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Cosmos DB retrieve throughput parameters object. public partial class RetrieveThroughputParameters : TrackedResourceData { - /// Initializes a new instance of RetrieveThroughputParameters. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a resource throughput. /// is null. @@ -27,7 +30,7 @@ public RetrieveThroughputParameters(AzureLocation location, RetrieveThroughputPr Resource = resource; } - /// Initializes a new instance of RetrieveThroughputParameters. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,10 +39,17 @@ public RetrieveThroughputParameters(AzureLocation location, RetrieveThroughputPr /// The location. /// The standard JSON format of a resource throughput. /// Identity for the resource. - internal RetrieveThroughputParameters(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RetrieveThroughputPropertiesResource resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal RetrieveThroughputParameters(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RetrieveThroughputPropertiesResource resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RetrieveThroughputParameters() + { } /// The standard JSON format of a resource throughput. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.Serialization.cs index 79fb33c8ff3a..73bf6965a7ab 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class RetrieveThroughputPropertiesResource : IUtf8JsonSerializable + public partial class RetrieveThroughputPropertiesResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("physicalPartitionIds"u8); writer.WriteStartArray(); @@ -24,16 +31,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RetrieveThroughputPropertiesResource DeserializeRetrieveThroughputPropertiesResource(JsonElement element) + internal static RetrieveThroughputPropertiesResource DeserializeRetrieveThroughputPropertiesResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList physicalPartitionIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("physicalPartitionIds"u8)) @@ -46,8 +68,61 @@ internal static RetrieveThroughputPropertiesResource DeserializeRetrieveThroughp physicalPartitionIds = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RetrieveThroughputPropertiesResource(physicalPartitionIds, serializedAdditionalRawData); + } + + RetrieveThroughputPropertiesResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRetrieveThroughputPropertiesResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RetrieveThroughputPropertiesResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRetrieveThroughputPropertiesResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RetrieveThroughputPropertiesResource model) + { + if (model is null) + { + return null; } - return new RetrieveThroughputPropertiesResource(physicalPartitionIds); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RetrieveThroughputPropertiesResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRetrieveThroughputPropertiesResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.cs index f3c458f0619d..c77c10c597e4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/RetrieveThroughputPropertiesResource.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource to retrieve throughput information for Cosmos DB resource. public partial class RetrieveThroughputPropertiesResource { - /// Initializes a new instance of RetrieveThroughputPropertiesResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of PhysicalPartitionId objects. /// is null. public RetrieveThroughputPropertiesResource(IEnumerable physicalPartitionIds) @@ -26,11 +29,18 @@ public RetrieveThroughputPropertiesResource(IEnumerable phy PhysicalPartitionIds = physicalPartitionIds.ToList(); } - /// Initializes a new instance of RetrieveThroughputPropertiesResource. + /// Initializes a new instance of . /// Array of PhysicalPartitionId objects. - internal RetrieveThroughputPropertiesResource(IList physicalPartitionIds) + /// Keeps track of any properties unknown to the library. + internal RetrieveThroughputPropertiesResource(IList physicalPartitionIds, Dictionary serializedAdditionalRawData) { PhysicalPartitionIds = physicalPartitionIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RetrieveThroughputPropertiesResource() + { } /// Array of PhysicalPartitionId objects. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs index 51184a063844..8cc5ab13c3ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class SpatialSpec : IUtf8JsonSerializable + public partial class SpatialSpec : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Path)) { @@ -31,17 +38,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SpatialSpec DeserializeSpatialSpec(JsonElement element) + internal static SpatialSpec DeserializeSpatialSpec(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional path = default; Optional> types = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("path"u8)) @@ -63,8 +85,61 @@ internal static SpatialSpec DeserializeSpatialSpec(JsonElement element) types = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SpatialSpec(path.Value, Optional.ToList(types), serializedAdditionalRawData); + } + + SpatialSpec IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSpatialSpec(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SpatialSpec IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSpatialSpec(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SpatialSpec model) + { + if (model is null) + { + return null; } - return new SpatialSpec(path.Value, Optional.ToList(types)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SpatialSpec(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSpatialSpec(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs index c69cde3dd14e..35323d42b4cf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SpatialSpec.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The SpatialSpec. public partial class SpatialSpec { - /// Initializes a new instance of SpatialSpec. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SpatialSpec() { Types = new ChangeTrackingList(); } - /// Initializes a new instance of SpatialSpec. + /// Initializes a new instance of . /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). /// List of path's spatial type. - internal SpatialSpec(string path, IList types) + /// Keeps track of any properties unknown to the library. + internal SpatialSpec(string path, IList types, Dictionary serializedAdditionalRawData) { Path = path; Types = types; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.Serialization.cs index 13529002b9c8..24ce1c79c7be 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class SqlDedicatedGatewayRegionalService + public partial class SqlDedicatedGatewayRegionalService : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SqlDedicatedGatewayRegionalService DeserializeSqlDedicatedGatewayRegionalService(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SqlDedicatedGatewayRegionalService DeserializeSqlDedicatedGatewayRegionalService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static SqlDedicatedGatewayRegionalService DeserializeSqlDedicatedGatewa Optional name = default; Optional location = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sqlDedicatedGatewayEndpoint"u8)) @@ -52,8 +81,61 @@ internal static SqlDedicatedGatewayRegionalService DeserializeSqlDedicatedGatewa status = new CosmosDBServiceStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SqlDedicatedGatewayRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), sqlDedicatedGatewayEndpoint.Value); + return new SqlDedicatedGatewayRegionalService(name.Value, Optional.ToNullable(location), Optional.ToNullable(status), sqlDedicatedGatewayEndpoint.Value, serializedAdditionalRawData); + } + + SqlDedicatedGatewayRegionalService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSqlDedicatedGatewayRegionalService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SqlDedicatedGatewayRegionalService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSqlDedicatedGatewayRegionalService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SqlDedicatedGatewayRegionalService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SqlDedicatedGatewayRegionalService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSqlDedicatedGatewayRegionalService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.cs index 3e0588d4818b..f5e66e20da40 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayRegionalService.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDB.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Resource for a regional service location. public partial class SqlDedicatedGatewayRegionalService : CosmosDBRegionalService { - /// Initializes a new instance of SqlDedicatedGatewayRegionalService. + /// Initializes a new instance of . internal SqlDedicatedGatewayRegionalService() { } - /// Initializes a new instance of SqlDedicatedGatewayRegionalService. + /// Initializes a new instance of . /// The regional service name. /// The location name. /// Describes the status of a service. /// The regional endpoint for SqlDedicatedGateway. - internal SqlDedicatedGatewayRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, string sqlDedicatedGatewayEndpoint) : base(name, location, status) + /// Keeps track of any properties unknown to the library. + internal SqlDedicatedGatewayRegionalService(string name, AzureLocation? location, CosmosDBServiceStatus? status, string sqlDedicatedGatewayEndpoint, Dictionary serializedAdditionalRawData) : base(name, location, status, serializedAdditionalRawData) { SqlDedicatedGatewayEndpoint = sqlDedicatedGatewayEndpoint; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.Serialization.cs index e6b50b37d463..bd864cf8dc49 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class SqlDedicatedGatewayServiceProperties : IUtf8JsonSerializable + public partial class SqlDedicatedGatewayServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SqlDedicatedGatewayEndpoint)) { @@ -46,8 +52,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SqlDedicatedGatewayServiceProperties DeserializeSqlDedicatedGatewayServiceProperties(JsonElement element) + internal static SqlDedicatedGatewayServiceProperties DeserializeSqlDedicatedGatewayServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -128,5 +136,53 @@ internal static SqlDedicatedGatewayServiceProperties DeserializeSqlDedicatedGate additionalProperties = additionalPropertiesDictionary; return new SqlDedicatedGatewayServiceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties, sqlDedicatedGatewayEndpoint.Value, Optional.ToList(locations)); } + + SqlDedicatedGatewayServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSqlDedicatedGatewayServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SqlDedicatedGatewayServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSqlDedicatedGatewayServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SqlDedicatedGatewayServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SqlDedicatedGatewayServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSqlDedicatedGatewayServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.cs index 239b0f0a0c76..73358d3ab1d3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/SqlDedicatedGatewayServiceProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Properties for SqlDedicatedGatewayServiceResource. public partial class SqlDedicatedGatewayServiceProperties : CosmosDBServiceProperties { - /// Initializes a new instance of SqlDedicatedGatewayServiceProperties. + /// Initializes a new instance of . public SqlDedicatedGatewayServiceProperties() { Locations = new ChangeTrackingList(); ServiceType = CosmosDBServiceType.SqlDedicatedGateway; } - /// Initializes a new instance of SqlDedicatedGatewayServiceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.Serialization.cs index 3e6788495906..4173148ba6ce 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ThroughputPolicyResourceInfo : IUtf8JsonSerializable + public partial class ThroughputPolicyResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("incrementPercent"u8); writer.WriteNumberValue(IncrementPercent.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ThroughputPolicyResourceInfo DeserializeThroughputPolicyResourceInfo(JsonElement element) + internal static ThroughputPolicyResourceInfo DeserializeThroughputPolicyResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional isEnabled = default; Optional incrementPercent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("isEnabled"u8)) @@ -56,8 +79,61 @@ internal static ThroughputPolicyResourceInfo DeserializeThroughputPolicyResource incrementPercent = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ThroughputPolicyResourceInfo(Optional.ToNullable(isEnabled), Optional.ToNullable(incrementPercent), serializedAdditionalRawData); + } + + ThroughputPolicyResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeThroughputPolicyResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ThroughputPolicyResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeThroughputPolicyResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ThroughputPolicyResourceInfo model) + { + if (model is null) + { + return null; } - return new ThroughputPolicyResourceInfo(Optional.ToNullable(isEnabled), Optional.ToNullable(incrementPercent)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ThroughputPolicyResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeThroughputPolicyResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.cs index 42376a67aaf0..158ff885494a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputPolicyResourceInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB resource throughput policy. public partial class ThroughputPolicyResourceInfo { - /// Initializes a new instance of ThroughputPolicyResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ThroughputPolicyResourceInfo() { } - /// Initializes a new instance of ThroughputPolicyResourceInfo. + /// Initializes a new instance of . /// Determines whether the ThroughputPolicy is active or not. /// Represents the percentage by which throughput can increase every time throughput policy kicks in. - internal ThroughputPolicyResourceInfo(bool? isEnabled, int? incrementPercent) + /// Keeps track of any properties unknown to the library. + internal ThroughputPolicyResourceInfo(bool? isEnabled, int? incrementPercent, Dictionary serializedAdditionalRawData) { IsEnabled = isEnabled; IncrementPercent = incrementPercent; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Determines whether the ThroughputPolicy is active or not. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingData.Serialization.cs index a618a625b9ba..c88ced2c715a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB { - public partial class ThroughputSettingData : IUtf8JsonSerializable + public partial class ThroughputSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -42,14 +49,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Resource)) { writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ThroughputSettingData DeserializeThroughputSettingData(JsonElement element) + internal static ThroughputSettingData DeserializeThroughputSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static ThroughputSettingData DeserializeThroughputSettingData(JsonEleme ResourceType type = default; Optional systemData = default; Optional resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -138,8 +167,61 @@ internal static ThroughputSettingData DeserializeThroughputSettingData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ThroughputSettingData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity, serializedAdditionalRawData); + } + + ThroughputSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeThroughputSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ThroughputSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeThroughputSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ThroughputSettingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ThroughputSettingData(Response response) + { + if (response is null) + { + return null; } - return new ThroughputSettingData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource.Value, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeThroughputSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs index 4af5cc145725..61ee6aafc247 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ThroughputSettingsResourceInfo : IUtf8JsonSerializable + public partial class ThroughputSettingsResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Throughput)) { @@ -23,13 +31,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AutoscaleSettings)) { writer.WritePropertyName("autoscaleSettings"u8); - writer.WriteObjectValue(AutoscaleSettings); + if (AutoscaleSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AutoscaleSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsResourceInfo(JsonElement element) + internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +67,7 @@ internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsReso Optional autoscaleSettings = default; Optional minimumThroughput = default; Optional offerReplacePending = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -68,8 +98,61 @@ internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsReso offerReplacePending = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, serializedAdditionalRawData); + } + + ThroughputSettingsResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeThroughputSettingsResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ThroughputSettingsResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeThroughputSettingsResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ThroughputSettingsResourceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ThroughputSettingsResourceInfo(Response response) + { + if (response is null) + { + return null; } - return new ThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeThroughputSettingsResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs index 142119bf39c9..b635a34825cd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. public partial class ThroughputSettingsResourceInfo { - /// Initializes a new instance of ThroughputSettingsResourceInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ThroughputSettingsResourceInfo() { } - /// Initializes a new instance of ThroughputSettingsResourceInfo. + /// Initializes a new instance of . /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. - internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending) + /// Keeps track of any properties unknown to the library. + internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, Dictionary serializedAdditionalRawData) { Throughput = throughput; AutoscaleSettings = autoscaleSettings; MinimumThroughput = minimumThroughput; OfferReplacePending = offerReplacePending; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.Serialization.cs index 862839bd1061..5ff7b79b96f1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDB.Models { - public partial class ThroughputSettingsUpdateData : IUtf8JsonSerializable + public partial class ThroughputSettingsUpdateData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -39,13 +46,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("resource"u8); - writer.WriteObjectValue(Resource); + if (Resource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Resource).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ThroughputSettingsUpdateData DeserializeThroughputSettingsUpdateData(JsonElement element) + internal static ThroughputSettingsUpdateData DeserializeThroughputSettingsUpdateData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static ThroughputSettingsUpdateData DeserializeThroughputSettingsUpdate ResourceType type = default; Optional systemData = default; ThroughputSettingsResourceInfo resource = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -130,8 +159,61 @@ internal static ThroughputSettingsUpdateData DeserializeThroughputSettingsUpdate } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ThroughputSettingsUpdateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, identity, serializedAdditionalRawData); + } + + ThroughputSettingsUpdateData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeThroughputSettingsUpdateData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ThroughputSettingsUpdateData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeThroughputSettingsUpdateData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ThroughputSettingsUpdateData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ThroughputSettingsUpdateData(Response response) + { + if (response is null) + { + return null; } - return new ThroughputSettingsUpdateData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, resource, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeThroughputSettingsUpdateData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.cs index b79ea3bc462a..8f9dddeafd5e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsUpdateData.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CosmosDB.Models /// Parameters to update Cosmos DB resource throughput. public partial class ThroughputSettingsUpdateData : TrackedResourceData { - /// Initializes a new instance of ThroughputSettingsUpdateData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// The standard JSON format of a resource throughput. /// is null. @@ -26,7 +29,7 @@ public ThroughputSettingsUpdateData(AzureLocation location, ThroughputSettingsRe Resource = resource; } - /// Initializes a new instance of ThroughputSettingsUpdateData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,10 +38,17 @@ public ThroughputSettingsUpdateData(AzureLocation location, ThroughputSettingsRe /// The location. /// The standard JSON format of a resource throughput. /// Identity for the resource. - internal ThroughputSettingsUpdateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ThroughputSettingsResourceInfo resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ThroughputSettingsUpdateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ThroughputSettingsResourceInfo resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ThroughputSettingsUpdateData() + { } /// The standard JSON format of a resource throughput. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.Serialization.cs index 276854c0b543..066bbb347d55 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.Serialization.cs @@ -5,52 +5,74 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class UnknownBackupPolicy : IUtf8JsonSerializable + internal partial class UnknownBackupPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(BackupPolicyType.ToString()); if (Optional.IsDefined(MigrationState)) { writer.WritePropertyName("migrationState"u8); - writer.WriteObjectValue(MigrationState); - } - writer.WriteEndObject(); - } - - internal static UnknownBackupPolicy DeserializeUnknownBackupPolicy(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - BackupPolicyType type = "Unknown"; - Optional migrationState = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) + if (MigrationState is null) { - type = new BackupPolicyType(property.Value.GetString()); - continue; + writer.WriteNullValue(); } - if (property.NameEquals("migrationState"u8)) + else + { + ((IModelJsonSerializable)MigrationState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - migrationState = BackupPolicyMigrationState.DeserializeBackupPolicyMigrationState(property.Value); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownBackupPolicy(type, migrationState.Value); + writer.WriteEndObject(); + } + + internal static CosmosDBAccountBackupPolicy DeserializeUnknownBackupPolicy(JsonElement element, ModelSerializerOptions options = default) => DeserializeCosmosDBAccountBackupPolicy(element, options); + + CosmosDBAccountBackupPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownBackupPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBAccountBackupPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBAccountBackupPolicy(doc.RootElement, options); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.cs index 4f179e589f27..54ae77135435 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownBackupPolicy.cs @@ -5,17 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The UnknownBackupPolicy. internal partial class UnknownBackupPolicy : CosmosDBAccountBackupPolicy { - /// Initializes a new instance of UnknownBackupPolicy. + /// Initializes a new instance of . /// Describes the mode of backups. /// The object representing the state of the migration between the backup policies. - internal UnknownBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState) : base(backupPolicyType, migrationState) + /// Keeps track of any properties unknown to the library. + internal UnknownBackupPolicy(BackupPolicyType backupPolicyType, BackupPolicyMigrationState migrationState, Dictionary serializedAdditionalRawData) : base(backupPolicyType, migrationState, serializedAdditionalRawData) { BackupPolicyType = backupPolicyType; } + + /// Initializes a new instance of for deserialization. + internal UnknownBackupPolicy() + { + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.Serialization.cs index bd7dae91ba27..beeaee519a8a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.Serialization.cs @@ -5,37 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class UnknownDataTransferDataSourceSink : IUtf8JsonSerializable + internal partial class UnknownDataTransferDataSourceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownDataTransferDataSourceSink DeserializeUnknownDataTransferDataSourceSink(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - return null; - } - DataTransferComponent component = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("component"u8)) + foreach (var property in _serializedAdditionalRawData) { - component = new DataTransferComponent(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownDataTransferDataSourceSink(component); + writer.WriteEndObject(); + } + + internal static DataTransferDataSourceSink DeserializeUnknownDataTransferDataSourceSink(JsonElement element, ModelSerializerOptions options = default) => DeserializeDataTransferDataSourceSink(element, options); + + DataTransferDataSourceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownDataTransferDataSourceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferDataSourceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferDataSourceSink(doc.RootElement, options); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.cs index 055926a1ac7b..9ef39ff63b1c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownDataTransferDataSourceSink.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDB.Models { /// The UnknownDataTransferDataSourceSink. internal partial class UnknownDataTransferDataSourceSink : DataTransferDataSourceSink { - /// Initializes a new instance of UnknownDataTransferDataSourceSink. + /// Initializes a new instance of . /// - internal UnknownDataTransferDataSourceSink(DataTransferComponent component) : base(component) + /// Keeps track of any properties unknown to the library. + internal UnknownDataTransferDataSourceSink(DataTransferComponent component, Dictionary serializedAdditionalRawData) : base(component, serializedAdditionalRawData) { Component = component; } + + /// Initializes a new instance of for deserialization. + internal UnknownDataTransferDataSourceSink() + { + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.Serialization.cs index 9b81f309a4c5..20aa336ed9a1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.Serialization.cs @@ -6,16 +6,20 @@ #nullable disable using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDB.Models { - internal partial class UnknownServiceResourceProperties : IUtf8JsonSerializable + internal partial class UnknownServiceResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InstanceSize)) { @@ -41,66 +45,29 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static UnknownServiceResourceProperties DeserializeUnknownServiceResourceProperties(JsonElement element) + internal static CosmosDBServiceProperties DeserializeUnknownServiceResourceProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeCosmosDBServiceProperties(element, options); + + CosmosDBServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional creationTime = default; - Optional instanceSize = default; - Optional instanceCount = default; - CosmosDBServiceType serviceType = "Unknown"; - Optional status = default; - IDictionary additionalProperties = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("creationTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("instanceSize"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - instanceSize = new CosmosDBServiceSize(property.Value.GetString()); - continue; - } - if (property.NameEquals("instanceCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - instanceCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("serviceType"u8)) - { - serviceType = new CosmosDBServiceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("status"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new CosmosDBServiceStatus(property.Value.GetString()); - continue; - } - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - additionalProperties = additionalPropertiesDictionary; - return new UnknownServiceResourceProperties(Optional.ToNullable(creationTime), Optional.ToNullable(instanceSize), Optional.ToNullable(instanceCount), serviceType, Optional.ToNullable(status), additionalProperties); + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownServiceResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBServiceProperties(doc.RootElement, options); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.cs index 0cbc59814f2c..d498482ab0a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/UnknownServiceResourceProperties.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.CosmosDB.Models /// The UnknownServiceResourceProperties. internal partial class UnknownServiceResourceProperties : CosmosDBServiceProperties { - /// Initializes a new instance of UnknownServiceResourceProperties. + /// Initializes a new instance of . /// Time of the last state change (ISO-8601 format). /// Instance type for the service. /// Instance count for the service. @@ -24,5 +24,10 @@ internal UnknownServiceResourceProperties(DateTimeOffset? createdOn, CosmosDBSer { ServiceType = serviceType; } + + /// Initializes a new instance of for deserialization. + internal UnknownServiceResourceProperties() + { + } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs index a8aa296c4ea4..ce12c59c10aa 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mongoClusterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), _mongoClusterClientDiagnostics, Pipeline, "MongoClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), _mongoClusterClientDiagnostics, Pipeline, "MongoClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mongoClusterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), _mongoClusterClientDiagnostics, Pipeline, "MongoClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), _mongoClusterClientDiagnostics, Pipeline, "MongoClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterData.cs index 8b0042a4d737..973f229bb42b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class MongoClusterData : TrackedResourceData { - /// Initializes a new instance of MongoClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public MongoClusterData(AzureLocation location) : base(location) { NodeGroupSpecs = new ChangeTrackingList(); } - /// Initializes a new instance of MongoClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -42,7 +46,8 @@ public MongoClusterData(AzureLocation location) : base(location) /// A provisioning state of the mongo cluster. /// A status of the mongo cluster. /// The list of node group specs in the cluster. - internal MongoClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountCreateMode? createMode, MongoClusterRestoreParameters restoreParameters, string administratorLogin, string administratorLoginPassword, string serverVersion, string connectionString, string earliestRestoreTime, CosmosDBProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, IList nodeGroupSpecs) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal MongoClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountCreateMode? createMode, MongoClusterRestoreParameters restoreParameters, string administratorLogin, string administratorLoginPassword, string serverVersion, string connectionString, string earliestRestoreTime, CosmosDBProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, IList nodeGroupSpecs, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { CreateMode = createMode; RestoreParameters = restoreParameters; @@ -54,6 +59,12 @@ internal MongoClusterData(ResourceIdentifier id, string name, ResourceType resou ProvisioningState = provisioningState; ClusterStatus = clusterStatus; NodeGroupSpecs = nodeGroupSpecs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MongoClusterData() + { } /// The mode to create a mongo cluster. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs index de2bdad78886..c2c6ff212458 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string collectionName, Ca public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBCollectionMongoDBResourcesRestClient.CreateListMongoDBCollectionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MongoDBCollectionResource(Client, MongoDBCollectionData.DeserializeMongoDBCollectionData(e)), _mongoDBCollectionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBCollectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new MongoDBCollectionResource(Client, MongoDBCollectionData.DeserializeMongoDBCollectionData(e)), _mongoDBCollectionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBCollectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBCollectionMongoDBResourcesRestClient.CreateListMongoDBCollectionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MongoDBCollectionResource(Client, MongoDBCollectionData.DeserializeMongoDBCollectionData(e)), _mongoDBCollectionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBCollectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new MongoDBCollectionResource(Client, MongoDBCollectionData.DeserializeMongoDBCollectionData(e)), _mongoDBCollectionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBCollectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionData.cs index b124009bdc9c..6617b6901d6f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class MongoDBCollectionData : TrackedResourceData { - /// Initializes a new instance of MongoDBCollectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public MongoDBCollectionData(AzureLocation location) : base(location) { } - /// Initializes a new instance of MongoDBCollectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public MongoDBCollectionData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal MongoDBCollectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedMongoDBCollectionResourceInfo resource, MongoDBCollectionPropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal MongoDBCollectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedMongoDBCollectionResourceInfo resource, MongoDBCollectionPropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MongoDBCollectionData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs index 11d7a3354fdc..1be94b51b5c1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string databaseName, Cancel public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBDatabaseMongoDBResourcesRestClient.CreateListMongoDBDatabasesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MongoDBDatabaseResource(Client, MongoDBDatabaseData.DeserializeMongoDBDatabaseData(e)), _mongoDBDatabaseMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBDatabaseCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new MongoDBDatabaseResource(Client, MongoDBDatabaseData.DeserializeMongoDBDatabaseData(e)), _mongoDBDatabaseMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBDatabaseCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBDatabaseMongoDBResourcesRestClient.CreateListMongoDBDatabasesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MongoDBDatabaseResource(Client, MongoDBDatabaseData.DeserializeMongoDBDatabaseData(e)), _mongoDBDatabaseMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBDatabaseCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new MongoDBDatabaseResource(Client, MongoDBDatabaseData.DeserializeMongoDBDatabaseData(e)), _mongoDBDatabaseMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBDatabaseCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseData.cs index 02ad1995b38d..9efc88eb73bd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class MongoDBDatabaseData : TrackedResourceData { - /// Initializes a new instance of MongoDBDatabaseData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public MongoDBDatabaseData(AzureLocation location) : base(location) { } - /// Initializes a new instance of MongoDBDatabaseData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public MongoDBDatabaseData(AzureLocation location) : base(location) /// /// /// Identity for the resource. - internal MongoDBDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedMongoDBDatabaseResourceInfo resource, MongoDBDatabasePropertiesConfig options, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal MongoDBDatabaseData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedMongoDBDatabaseResourceInfo resource, MongoDBDatabasePropertiesConfig options, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Options = options; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MongoDBDatabaseData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs index 05f64175cf02..a5ade569a577 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string mongoRoleDefin public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBRoleDefinitionMongoDBResourcesRestClient.CreateListMongoRoleDefinitionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MongoDBRoleDefinitionResource(Client, MongoDBRoleDefinitionData.DeserializeMongoDBRoleDefinitionData(e)), _mongoDBRoleDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBRoleDefinitionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new MongoDBRoleDefinitionResource(Client, MongoDBRoleDefinitionData.DeserializeMongoDBRoleDefinitionData(e)), _mongoDBRoleDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBRoleDefinitionCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancella public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBRoleDefinitionMongoDBResourcesRestClient.CreateListMongoRoleDefinitionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MongoDBRoleDefinitionResource(Client, MongoDBRoleDefinitionData.DeserializeMongoDBRoleDefinitionData(e)), _mongoDBRoleDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBRoleDefinitionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new MongoDBRoleDefinitionResource(Client, MongoDBRoleDefinitionData.DeserializeMongoDBRoleDefinitionData(e)), _mongoDBRoleDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBRoleDefinitionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionData.cs index 72af87c8e9df..ddc8df2ac6a0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class MongoDBRoleDefinitionData : ResourceData { - /// Initializes a new instance of MongoDBRoleDefinitionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBRoleDefinitionData() { Privileges = new ChangeTrackingList(); Roles = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBRoleDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,13 +39,15 @@ public MongoDBRoleDefinitionData() /// The database name for which access is being granted for this Role Definition. /// A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege. /// The set of roles inherited by this Role Definition. - internal MongoDBRoleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, MongoDBRoleDefinitionType? roleDefinitionType, string databaseName, IList privileges, IList roles) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal MongoDBRoleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, MongoDBRoleDefinitionType? roleDefinitionType, string databaseName, IList privileges, IList roles, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RoleName = roleName; RoleDefinitionType = roleDefinitionType; DatabaseName = databaseName; Privileges = privileges; Roles = roles; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A user-friendly name for the Role Definition. Must be unique for the database account. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs index a1729357a63b..7aa24e549d44 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionCollection.cs @@ -228,7 +228,7 @@ public virtual Response Get(string mongoUserDefin public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBUserDefinitionMongoDBResourcesRestClient.CreateListMongoUserDefinitionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MongoDBUserDefinitionResource(Client, MongoDBUserDefinitionData.DeserializeMongoDBUserDefinitionData(e)), _mongoDBUserDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBUserDefinitionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new MongoDBUserDefinitionResource(Client, MongoDBUserDefinitionData.DeserializeMongoDBUserDefinitionData(e)), _mongoDBUserDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBUserDefinitionCollection.GetAll", "value", null, cancellationToken); } /// @@ -249,7 +249,7 @@ public virtual AsyncPageable GetAllAsync(Cancella public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBUserDefinitionMongoDBResourcesRestClient.CreateListMongoUserDefinitionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MongoDBUserDefinitionResource(Client, MongoDBUserDefinitionData.DeserializeMongoDBUserDefinitionData(e)), _mongoDBUserDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBUserDefinitionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new MongoDBUserDefinitionResource(Client, MongoDBUserDefinitionData.DeserializeMongoDBUserDefinitionData(e)), _mongoDBUserDefinitionMongoDBResourcesClientDiagnostics, Pipeline, "MongoDBUserDefinitionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionData.cs index d58dc1ee5994..630391457cbc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class MongoDBUserDefinitionData : ResourceData { - /// Initializes a new instance of MongoDBUserDefinitionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MongoDBUserDefinitionData() { Roles = new ChangeTrackingList(); } - /// Initializes a new instance of MongoDBUserDefinitionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public MongoDBUserDefinitionData() /// A custom definition for the USer Definition. /// The set of roles inherited by the User Definition. /// The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256. - internal MongoDBUserDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string userName, string password, string databaseName, string customData, IList roles, string mechanisms) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal MongoDBUserDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string userName, string password, string databaseName, string customData, IList roles, string mechanisms, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { UserName = userName; Password = password; @@ -43,6 +48,7 @@ internal MongoDBUserDefinitionData(ResourceIdentifier id, string name, ResourceT CustomData = customData; Roles = roles; Mechanisms = mechanisms; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The user name for User Definition. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs index 05e8566a997a..fe8cc3da03fb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs @@ -346,9 +346,7 @@ internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string res request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -424,9 +422,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -503,9 +499,7 @@ internal HttpMessage CreateInvokeCommandRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs index 0b8a82792cd9..36612f44d860 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs @@ -299,9 +299,7 @@ internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string res request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -383,9 +381,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs index c492127ad13d..efd41dcfd149 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateUpdateCassandraKeyspaceRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -472,9 +470,7 @@ internal HttpMessage CreateUpdateCassandraKeyspaceThroughputRequest(string subsc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -891,9 +887,7 @@ internal HttpMessage CreateCreateUpdateCassandraTableRequest(string subscription request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1158,9 +1152,7 @@ internal HttpMessage CreateUpdateCassandraTableThroughputRequest(string subscrip request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1593,9 +1585,7 @@ internal HttpMessage CreateCreateUpdateCassandraViewRequest(string subscriptionI request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1862,9 +1852,7 @@ internal HttpMessage CreateUpdateCassandraViewThroughputRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs index e27575c882d1..cf75c5593945 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs index 7d304c5f67ad..dd9190bc7df3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs @@ -136,9 +136,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -212,9 +210,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -357,9 +353,7 @@ internal HttpMessage CreateFailoverPriorityChangeRequest(string subscriptionId, uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(failoverParameters); - request.Content = content; + request.Content = failoverParameters; _userAgent.Apply(message); return message; } @@ -734,9 +728,7 @@ internal HttpMessage CreateOfflineRegionRequest(string subscriptionId, string re request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(regionParameterForOffline); - request.Content = content; + request.Content = regionParameterForOffline; _userAgent.Apply(message); return message; } @@ -813,9 +805,7 @@ internal HttpMessage CreateOnlineRegionRequest(string subscriptionId, string res request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(regionParameterForOnline); - request.Content = content; + request.Content = regionParameterForOnline; _userAgent.Apply(message); return message; } @@ -970,9 +960,7 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs index f4a6ef913446..375c9d5a1454 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateUpdateGraphRequest(string subscriptionId, strin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs index aaca2a15404f..fff31954e71f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateUpdateGremlinDatabaseRequest(string subscriptio request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -472,9 +470,7 @@ internal HttpMessage CreateUpdateGremlinDatabaseThroughputRequest(string subscri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -891,9 +887,7 @@ internal HttpMessage CreateCreateUpdateGremlinGraphRequest(string subscriptionId request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1158,9 +1152,7 @@ internal HttpMessage CreateUpdateGremlinGraphThroughputRequest(string subscripti request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1415,9 +1407,7 @@ internal HttpMessage CreateRetrieveContinuousBackupInformationRequest(string sub request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(location); - request.Content = content; + request.Content = location; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs index 345a7a3340aa..6c488d21deed 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs @@ -194,9 +194,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -424,9 +422,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -504,9 +500,7 @@ internal HttpMessage CreateCreateOrUpdateFirewallRuleRequest(string subscription request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -828,9 +822,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs index 69a75d483635..8250df730b94 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateUpdateMongoDBDatabaseRequest(string subscriptio request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -472,9 +470,7 @@ internal HttpMessage CreateUpdateMongoDBDatabaseThroughputRequest(string subscri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -711,9 +707,7 @@ internal HttpMessage CreateMongoDBDatabaseRetrieveThroughputDistributionRequest( request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(retrieveThroughputParameters); - request.Content = content; + request.Content = retrieveThroughputParameters; _userAgent.Apply(message); return message; } @@ -796,9 +790,7 @@ internal HttpMessage CreateMongoDBDatabaseRedistributeThroughputRequest(string s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(redistributeThroughputParameters); - request.Content = content; + request.Content = redistributeThroughputParameters; _userAgent.Apply(message); return message; } @@ -883,9 +875,7 @@ internal HttpMessage CreateMongoDBContainerRetrieveThroughputDistributionRequest request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(retrieveThroughputParameters); - request.Content = content; + request.Content = retrieveThroughputParameters; _userAgent.Apply(message); return message; } @@ -974,9 +964,7 @@ internal HttpMessage CreateMongoDBContainerRedistributeThroughputRequest(string request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(redistributeThroughputParameters); - request.Content = content; + request.Content = redistributeThroughputParameters; _userAgent.Apply(message); return message; } @@ -1243,9 +1231,7 @@ internal HttpMessage CreateCreateUpdateMongoDBCollectionRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1413,9 +1399,7 @@ internal HttpMessage CreateMongoDBDatabasePartitionMergeRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(mergeParameters); - request.Content = content; + request.Content = mergeParameters; _userAgent.Apply(message); return message; } @@ -1500,9 +1484,7 @@ internal HttpMessage CreateListMongoDBCollectionPartitionMergeRequest(string sub request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(mergeParameters); - request.Content = content; + request.Content = mergeParameters; _userAgent.Apply(message); return message; } @@ -1686,9 +1668,7 @@ internal HttpMessage CreateUpdateMongoDBCollectionThroughputRequest(string subsc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -2028,9 +2008,7 @@ internal HttpMessage CreateCreateUpdateMongoRoleDefinitionRequest(string subscri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -2357,9 +2335,7 @@ internal HttpMessage CreateCreateUpdateMongoUserDefinitionRequest(string subscri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -2601,9 +2577,7 @@ internal HttpMessage CreateRetrieveContinuousBackupInformationRequest(string sub request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(location); - request.Content = content; + request.Content = location; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index c8a01377f74f..c21c92af66ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs index 80ed56e4796c..fbd19136cb03 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs @@ -135,9 +135,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs index f8bea3d172d4..d4799bdf0046 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateUpdateSqlDatabaseRequest(string subscriptionId, request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -472,9 +470,7 @@ internal HttpMessage CreateUpdateSqlDatabaseThroughputRequest(string subscriptio request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -891,9 +887,7 @@ internal HttpMessage CreateCreateUpdateClientEncryptionKeyRequest(string subscri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1160,9 +1154,7 @@ internal HttpMessage CreateCreateUpdateSqlContainerRequest(string subscriptionId request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -1330,9 +1322,7 @@ internal HttpMessage CreateSqlDatabasePartitionMergeRequest(string subscriptionI request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(mergeParameters); - request.Content = content; + request.Content = mergeParameters; _userAgent.Apply(message); return message; } @@ -1417,9 +1407,7 @@ internal HttpMessage CreateListSqlContainerPartitionMergeRequest(string subscrip request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(mergeParameters); - request.Content = content; + request.Content = mergeParameters; _userAgent.Apply(message); return message; } @@ -1603,9 +1591,7 @@ internal HttpMessage CreateUpdateSqlContainerThroughputRequest(string subscripti request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -1858,9 +1844,7 @@ internal HttpMessage CreateSqlDatabaseRetrieveThroughputDistributionRequest(stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(retrieveThroughputParameters); - request.Content = content; + request.Content = retrieveThroughputParameters; _userAgent.Apply(message); return message; } @@ -1943,9 +1927,7 @@ internal HttpMessage CreateSqlDatabaseRedistributeThroughputRequest(string subsc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(redistributeThroughputParameters); - request.Content = content; + request.Content = redistributeThroughputParameters; _userAgent.Apply(message); return message; } @@ -2030,9 +2012,7 @@ internal HttpMessage CreateSqlContainerRetrieveThroughputDistributionRequest(str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(retrieveThroughputParameters); - request.Content = content; + request.Content = retrieveThroughputParameters; _userAgent.Apply(message); return message; } @@ -2121,9 +2101,7 @@ internal HttpMessage CreateSqlContainerRedistributeThroughputRequest(string subs request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(redistributeThroughputParameters); - request.Content = content; + request.Content = redistributeThroughputParameters; _userAgent.Apply(message); return message; } @@ -2404,9 +2382,7 @@ internal HttpMessage CreateCreateUpdateSqlStoredProcedureRequest(string subscrip request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -2778,9 +2754,7 @@ internal HttpMessage CreateCreateUpdateSqlUserDefinedFunctionRequest(string subs request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -3152,9 +3126,7 @@ internal HttpMessage CreateCreateUpdateSqlTriggerRequest(string subscriptionId, request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -3419,9 +3391,7 @@ internal HttpMessage CreateCreateUpdateSqlRoleDefinitionRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -3748,9 +3718,7 @@ internal HttpMessage CreateCreateUpdateSqlRoleAssignmentRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -3992,9 +3960,7 @@ internal HttpMessage CreateRetrieveContinuousBackupInformationRequest(string sub request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(location); - request.Content = content; + request.Content = location; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs index 0ace58f3fc9e..180af7fed820 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateUpdateTableRequest(string subscriptionId, strin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -472,9 +470,7 @@ internal HttpMessage CreateUpdateTableThroughputRequest(string subscriptionId, s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -711,9 +707,7 @@ internal HttpMessage CreateRetrieveContinuousBackupInformationRequest(string sub request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(location); - request.Content = content; + request.Content = location; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs index 8cba090da6df..deac56c9e46e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountCollection.cs @@ -137,7 +137,7 @@ public virtual Response Get(Guid instanceId, public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListByLocationRequest(Id.SubscriptionId, new AzureLocation(Id.Name)); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "RestorableCosmosDBAccountCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "RestorableCosmosDBAccountCollection.GetAll", "value", null, cancellationToken); } /// @@ -158,7 +158,7 @@ public virtual AsyncPageable GetAllAsync(Canc public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListByLocationRequest(Id.SubscriptionId, new AzureLocation(Id.Name)); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "RestorableCosmosDBAccountCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "RestorableCosmosDBAccountCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountData.cs index d79fc1a62b2a..37a86a0a7f75 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class RestorableCosmosDBAccountData : ResourceData { - /// Initializes a new instance of RestorableCosmosDBAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RestorableCosmosDBAccountData() { RestorableLocations = new ChangeTrackingList(); } - /// Initializes a new instance of RestorableCosmosDBAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +40,8 @@ internal RestorableCosmosDBAccountData() /// The time at which the restorable database account has been deleted (ISO-8601 format). /// The API type of the restorable database account. /// List of regions where the of the database account can be restored from. - internal RestorableCosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string accountName, DateTimeOffset? createdOn, DateTimeOffset? oldestRestorableOn, DateTimeOffset? deletedOn, CosmosDBApiType? apiType, IReadOnlyList restorableLocations) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RestorableCosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string accountName, DateTimeOffset? createdOn, DateTimeOffset? oldestRestorableOn, DateTimeOffset? deletedOn, CosmosDBApiType? apiType, IReadOnlyList restorableLocations, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; AccountName = accountName; @@ -46,6 +50,7 @@ internal RestorableCosmosDBAccountData(ResourceIdentifier id, string name, Resou DeletedOn = deletedOn; ApiType = apiType; RestorableLocations = restorableLocations; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The location of the resource group to which the resource belongs. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ThroughputSettingData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ThroughputSettingData.cs index e68aac488cdd..69c6c61b5de2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ThroughputSettingData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ThroughputSettingData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDB.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDB /// public partial class ThroughputSettingData : TrackedResourceData { - /// Initializes a new instance of ThroughputSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public ThroughputSettingData(AzureLocation location) : base(location) { } - /// Initializes a new instance of ThroughputSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,10 +37,17 @@ public ThroughputSettingData(AzureLocation location) : base(location) /// The location. /// /// Identity for the resource. - internal ThroughputSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedThroughputSettingsResourceInfo resource, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal ThroughputSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedThroughputSettingsResourceInfo resource, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Resource = resource; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ThroughputSettingData() + { } /// Gets or sets the resource. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ArmCosmosDBForPostgreSqlModelFactory.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ArmCosmosDBForPostgreSqlModelFactory.cs index 9305155d35ff..d79d77805d0a 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ArmCosmosDBForPostgreSqlModelFactory.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ArmCosmosDBForPostgreSqlModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// Model factory for models. public static partial class ArmCosmosDBForPostgreSqlModelFactory { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -58,19 +58,19 @@ public static CosmosDBForPostgreSqlClusterData CosmosDBForPostgreSqlClusterData( readReplicas ??= new List(); privateEndpointConnections ??= new List(); - return new CosmosDBForPostgreSqlClusterData(id, name, resourceType, systemData, tags, location, administratorLogin, administratorLoginPassword, provisioningState, state, postgresqlVersion, citusVersion, maintenanceWindow, preferredPrimaryZone, isShardsOnCoordinatorEnabled, isHAEnabled, coordinatorServerEdition, coordinatorStorageQuotaInMb, coordinatorVCores, isCoordinatorPublicIPAccessEnabled, nodeServerEdition, nodeCount, nodeStorageQuotaInMb, nodeVCores, isNodePublicIPAccessEnabled, serverNames?.ToList(), sourceResourceId, sourceLocation, pointInTimeUTC, readReplicas?.ToList(), earliestRestoreOn, privateEndpointConnections?.ToList()); + return new CosmosDBForPostgreSqlClusterData(id, name, resourceType, systemData, tags, location, administratorLogin, administratorLoginPassword, provisioningState, state, postgresqlVersion, citusVersion, maintenanceWindow, preferredPrimaryZone, isShardsOnCoordinatorEnabled, isHAEnabled, coordinatorServerEdition, coordinatorStorageQuotaInMb, coordinatorVCores, isCoordinatorPublicIPAccessEnabled, nodeServerEdition, nodeCount, nodeStorageQuotaInMb, nodeVCores, isNodePublicIPAccessEnabled, serverNames?.ToList(), sourceResourceId, sourceLocation, pointInTimeUTC, readReplicas?.ToList(), earliestRestoreOn, privateEndpointConnections?.ToList(), default); } - /// Initializes a new instance of ServerNameItem. + /// Initializes a new instance of . /// The name of a server. /// The fully qualified domain name of a server. /// A new instance for mocking. public static ServerNameItem ServerNameItem(string name = null, string fullyQualifiedDomainName = null) { - return new ServerNameItem(name, fullyQualifiedDomainName); + return new ServerNameItem(name, fullyQualifiedDomainName, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlSimplePrivateEndpointConnection. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -83,10 +83,36 @@ public static CosmosDBForPostgreSqlSimplePrivateEndpointConnection CosmosDBForPo { groupIds ??= new List(); - return new CosmosDBForPostgreSqlSimplePrivateEndpointConnection(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, groupIds?.ToList(), privateLinkServiceConnectionState); + return new CosmosDBForPostgreSqlSimplePrivateEndpointConnection(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, groupIds?.ToList(), privateLinkServiceConnectionState, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterServerData. + /// Initializes a new instance of . + /// Application-specific metadata in the form of key-value pairs. + /// The password of the administrator login. Each cluster is created with pre-defined administrative role called ‘citus’. . + /// The major PostgreSQL version on all cluster servers. + /// The Citus extension version on all cluster servers. + /// If shards on coordinator is enabled or not for the cluster. + /// If high availability (HA) is enabled or not for the cluster. + /// Preferred primary availability zone (AZ) for all cluster servers. + /// The edition of the coordinator (default: GeneralPurpose). + /// The storage of the coordinator in MB. + /// The vCores count of the coordinator (max: 96). + /// If public access is enabled on coordinator. + /// The edition of a node (default: MemoryOptimized). + /// Worker node count of the cluster. When node count is 0, it represents a single node configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent multi-node configuration. Node count value cannot be 1. + /// The storage in MB on each worker node. + /// The compute in vCores on each worker node (max: 104). + /// If public access is enabled on worker nodes. + /// Maintenance window of a cluster. + /// A new instance for mocking. + public static CosmosDBForPostgreSqlClusterPatch CosmosDBForPostgreSqlClusterPatch(IDictionary tags = null, string administratorLoginPassword = null, string postgresqlVersion = null, string citusVersion = null, bool? isShardsOnCoordinatorEnabled = null, bool? isHAEnabled = null, string preferredPrimaryZone = null, string coordinatorServerEdition = null, int? coordinatorStorageQuotaInMb = null, int? coordinatorVCores = null, bool? isCoordinatorPublicIPAccessEnabled = null, string nodeServerEdition = null, int? nodeCount = null, int? nodeStorageQuotaInMb = null, int? nodeVCores = null, bool? isNodePublicIPAccessEnabled = null, CosmosDBForPostgreSqlMaintenanceWindow maintenanceWindow = null) + { + tags ??= new Dictionary(); + + return new CosmosDBForPostgreSqlClusterPatch(tags, administratorLoginPassword, postgresqlVersion, citusVersion, isShardsOnCoordinatorEnabled, isHAEnabled, preferredPrimaryZone, coordinatorServerEdition, coordinatorStorageQuotaInMb, coordinatorVCores, isCoordinatorPublicIPAccessEnabled, nodeServerEdition, nodeCount, nodeStorageQuotaInMb, nodeVCores, isNodePublicIPAccessEnabled, maintenanceWindow, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -108,10 +134,10 @@ public static CosmosDBForPostgreSqlSimplePrivateEndpointConnection CosmosDBForPo /// A new instance for mocking. public static CosmosDBForPostgreSqlClusterServerData CosmosDBForPostgreSqlClusterServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string serverEdition = null, int? storageQuotaInMb = null, int? vCores = null, bool? isHAEnabled = null, bool? isPublicIPAccessEnabled = null, bool? isReadOnly = null, string administratorLogin = null, string fullyQualifiedDomainName = null, CosmosDBForPostgreSqlServerRole? role = null, string state = null, string haState = null, string availabilityZone = null, string postgresqlVersion = null, string citusVersion = null) { - return new CosmosDBForPostgreSqlClusterServerData(id, name, resourceType, systemData, serverEdition, storageQuotaInMb, vCores, isHAEnabled, isPublicIPAccessEnabled, isReadOnly, administratorLogin, fullyQualifiedDomainName, role, state, haState, availabilityZone, postgresqlVersion, citusVersion); + return new CosmosDBForPostgreSqlClusterServerData(id, name, resourceType, systemData, serverEdition, storageQuotaInMb, vCores, isHAEnabled, isPublicIPAccessEnabled, isReadOnly, administratorLogin, fullyQualifiedDomainName, role, state, haState, availabilityZone, postgresqlVersion, citusVersion, default); } - /// Initializes a new instance of ServerConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -127,10 +153,10 @@ public static CosmosDBForPostgreSqlClusterServerData CosmosDBForPostgreSqlCluste /// A new instance for mocking. public static ServerConfigurationData ServerConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, string source = null, string description = null, string defaultValue = null, CosmosDBForPostgreSqlConfigurationDataType? dataType = null, string allowedValues = null, bool? isRestartRequired = null, ProvisioningState? provisioningState = null) { - return new ServerConfigurationData(id, name, resourceType, systemData, value, source, description, defaultValue, dataType, allowedValues, isRestartRequired, provisioningState); + return new ServerConfigurationData(id, name, resourceType, systemData, value, source, description, defaultValue, dataType, allowedValues, isRestartRequired, provisioningState, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -146,10 +172,10 @@ public static CosmosDBForPostgreSqlConfigurationData CosmosDBForPostgreSqlConfig { serverRoleGroupConfigurations ??= new List(); - return new CosmosDBForPostgreSqlConfigurationData(id, name, resourceType, systemData, description, dataType, allowedValues, isRestartRequired, serverRoleGroupConfigurations?.ToList(), provisioningState); + return new CosmosDBForPostgreSqlConfigurationData(id, name, resourceType, systemData, description, dataType, allowedValues, isRestartRequired, serverRoleGroupConfigurations?.ToList(), provisioningState, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlServerRoleGroupConfiguration. + /// Initializes a new instance of . /// The role of servers in the server role group. /// Value of the configuration. /// Default value of the configuration. @@ -157,10 +183,10 @@ public static CosmosDBForPostgreSqlConfigurationData CosmosDBForPostgreSqlConfig /// A new instance for mocking. public static CosmosDBForPostgreSqlServerRoleGroupConfiguration CosmosDBForPostgreSqlServerRoleGroupConfiguration(CosmosDBForPostgreSqlServerRole role = default, string value = null, string defaultValue = null, string source = null) { - return new CosmosDBForPostgreSqlServerRoleGroupConfiguration(role, value, defaultValue, source); + return new CosmosDBForPostgreSqlServerRoleGroupConfiguration(role, value, defaultValue, source, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlFirewallRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -171,10 +197,10 @@ public static CosmosDBForPostgreSqlServerRoleGroupConfiguration CosmosDBForPostg /// A new instance for mocking. public static CosmosDBForPostgreSqlFirewallRuleData CosmosDBForPostgreSqlFirewallRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string startIPAddress = null, string endIPAddress = null, ProvisioningState? provisioningState = null) { - return new CosmosDBForPostgreSqlFirewallRuleData(id, name, resourceType, systemData, startIPAddress, endIPAddress, provisioningState); + return new CosmosDBForPostgreSqlFirewallRuleData(id, name, resourceType, systemData, startIPAddress, endIPAddress, provisioningState, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlRoleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -184,10 +210,19 @@ public static CosmosDBForPostgreSqlFirewallRuleData CosmosDBForPostgreSqlFirewal /// A new instance for mocking. public static CosmosDBForPostgreSqlRoleData CosmosDBForPostgreSqlRoleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string password = null, ProvisioningState? provisioningState = null) { - return new CosmosDBForPostgreSqlRoleData(id, name, resourceType, systemData, password, provisioningState); + return new CosmosDBForPostgreSqlRoleData(id, name, resourceType, systemData, password, provisioningState, default); + } + + /// Initializes a new instance of . + /// Cluster name to verify. + /// Resource type used for verification. + /// A new instance for mocking. + public static CosmosDBForPostgreSqlClusterNameAvailabilityContent CosmosDBForPostgreSqlClusterNameAvailabilityContent(string name = null, CosmosDBForPostgreSqlNameAvailabilityResourceType resourceType = default) + { + return new CosmosDBForPostgreSqlClusterNameAvailabilityContent(name, resourceType, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterNameAvailabilityResult. + /// Initializes a new instance of . /// Error message. /// Indicates whether the cluster name is available. /// Name of the cluster. @@ -195,10 +230,10 @@ public static CosmosDBForPostgreSqlRoleData CosmosDBForPostgreSqlRoleData(Resour /// A new instance for mocking. public static CosmosDBForPostgreSqlClusterNameAvailabilityResult CosmosDBForPostgreSqlClusterNameAvailabilityResult(string message = null, bool? isNameAvailable = null, string name = null, ResourceType? resourceType = null) { - return new CosmosDBForPostgreSqlClusterNameAvailabilityResult(message, isNameAvailable, name, resourceType); + return new CosmosDBForPostgreSqlClusterNameAvailabilityResult(message, isNameAvailable, name, resourceType, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -212,10 +247,10 @@ public static CosmosDBForPostgreSqlPrivateEndpointConnectionData CosmosDBForPost { groupIds ??= new List(); - return new CosmosDBForPostgreSqlPrivateEndpointConnectionData(id, name, resourceType, systemData, groupIds?.ToList(), privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState); + return new CosmosDBForPostgreSqlPrivateEndpointConnectionData(id, name, resourceType, systemData, groupIds?.ToList(), privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, default); } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -229,7 +264,7 @@ public static CosmosDBForPostgreSqlPrivateLinkResourceData CosmosDBForPostgreSql requiredMembers ??= new List(); requiredZoneNames ??= new List(); - return new CosmosDBForPostgreSqlPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + return new CosmosDBForPostgreSqlPrivateLinkResourceData(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), default); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs index 0be20124eeba..f72fb756b2e2 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlClusterClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cosmosDBForPostgreSqlClusterClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), _cosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), _cosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlClusterClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cosmosDBForPostgreSqlClusterClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), _cosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), _cosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterData.cs index 3f69b3aab58b..46dcb3f90bd2 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlClusterData : TrackedResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public CosmosDBForPostgreSqlClusterData(AzureLocation location) : base(location) { @@ -28,7 +31,7 @@ public CosmosDBForPostgreSqlClusterData(AzureLocation location) : base(location) PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -61,7 +64,8 @@ public CosmosDBForPostgreSqlClusterData(AzureLocation location) : base(location) /// The array of read replica clusters. /// The earliest restore point time (ISO8601 format) for the cluster. /// The private endpoint connections for a cluster. - internal CosmosDBForPostgreSqlClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string administratorLogin, string administratorLoginPassword, string provisioningState, string state, string postgresqlVersion, string citusVersion, CosmosDBForPostgreSqlMaintenanceWindow maintenanceWindow, string preferredPrimaryZone, bool? isShardsOnCoordinatorEnabled, bool? isHAEnabled, string coordinatorServerEdition, int? coordinatorStorageQuotaInMb, int? coordinatorVCores, bool? isCoordinatorPublicIPAccessEnabled, string nodeServerEdition, int? nodeCount, int? nodeStorageQuotaInMb, int? nodeVCores, bool? isNodePublicIPAccessEnabled, IReadOnlyList serverNames, ResourceIdentifier sourceResourceId, AzureLocation? sourceLocation, DateTimeOffset? pointInTimeUTC, IReadOnlyList readReplicas, DateTimeOffset? earliestRestoreOn, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string administratorLogin, string administratorLoginPassword, string provisioningState, string state, string postgresqlVersion, string citusVersion, CosmosDBForPostgreSqlMaintenanceWindow maintenanceWindow, string preferredPrimaryZone, bool? isShardsOnCoordinatorEnabled, bool? isHAEnabled, string coordinatorServerEdition, int? coordinatorStorageQuotaInMb, int? coordinatorVCores, bool? isCoordinatorPublicIPAccessEnabled, string nodeServerEdition, int? nodeCount, int? nodeStorageQuotaInMb, int? nodeVCores, bool? isNodePublicIPAccessEnabled, IReadOnlyList serverNames, ResourceIdentifier sourceResourceId, AzureLocation? sourceLocation, DateTimeOffset? pointInTimeUTC, IReadOnlyList readReplicas, DateTimeOffset? earliestRestoreOn, IReadOnlyList privateEndpointConnections, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { AdministratorLogin = administratorLogin; AdministratorLoginPassword = administratorLoginPassword; @@ -89,6 +93,12 @@ internal CosmosDBForPostgreSqlClusterData(ResourceIdentifier id, string name, Re ReadReplicas = readReplicas; EarliestRestoreOn = earliestRestoreOn; PrivateEndpointConnections = privateEndpointConnections; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBForPostgreSqlClusterData() + { } /// The administrator's login name of the servers in the cluster. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs index 0a49d1e01232..38d167889b46 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string s public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlClusterServerServersRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlClusterServerResource(Client, CosmosDBForPostgreSqlClusterServerData.DeserializeCosmosDBForPostgreSqlClusterServerData(e)), _cosmosDBForPostgreSqlClusterServerServersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterServerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlClusterServerResource(Client, CosmosDBForPostgreSqlClusterServerData.DeserializeCosmosDBForPostgreSqlClusterServerData(e)), _cosmosDBForPostgreSqlClusterServerServersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterServerCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllA public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlClusterServerServersRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlClusterServerResource(Client, CosmosDBForPostgreSqlClusterServerData.DeserializeCosmosDBForPostgreSqlClusterServerData(e)), _cosmosDBForPostgreSqlClusterServerServersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterServerCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlClusterServerResource(Client, CosmosDBForPostgreSqlClusterServerData.DeserializeCosmosDBForPostgreSqlClusterServerData(e)), _cosmosDBForPostgreSqlClusterServerServersClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlClusterServerCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerData.cs index c3ff792dde0a..aae3c3120407 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlClusterServerData : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterServerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlClusterServerData() { } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterServerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +46,8 @@ public CosmosDBForPostgreSqlClusterServerData() /// Availability Zone information of the server. /// The major PostgreSQL version of server. /// The Citus extension version of server. - internal CosmosDBForPostgreSqlClusterServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string serverEdition, int? storageQuotaInMb, int? vCores, bool? isHAEnabled, bool? isPublicIPAccessEnabled, bool? isReadOnly, string administratorLogin, string fullyQualifiedDomainName, CosmosDBForPostgreSqlServerRole? role, string state, string haState, string availabilityZone, string postgresqlVersion, string citusVersion) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string serverEdition, int? storageQuotaInMb, int? vCores, bool? isHAEnabled, bool? isPublicIPAccessEnabled, bool? isReadOnly, string administratorLogin, string fullyQualifiedDomainName, CosmosDBForPostgreSqlServerRole? role, string state, string haState, string availabilityZone, string postgresqlVersion, string citusVersion, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ServerEdition = serverEdition; StorageQuotaInMb = storageQuotaInMb; @@ -57,6 +63,7 @@ internal CosmosDBForPostgreSqlClusterServerData(ResourceIdentifier id, string na AvailabilityZone = availabilityZone; PostgresqlVersion = postgresqlVersion; CitusVersion = citusVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The edition of a server. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs index fcf88499cbcf..81b932c92639 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllA { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlConfigurationConfigurationsRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cosmosDBForPostgreSqlConfigurationConfigurationsRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlConfigurationResource(Client, CosmosDBForPostgreSqlConfigurationData.DeserializeCosmosDBForPostgreSqlConfigurationData(e)), _cosmosDBForPostgreSqlConfigurationConfigurationsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBForPostgreSqlConfigurationResource(Client, CosmosDBForPostgreSqlConfigurationData.DeserializeCosmosDBForPostgreSqlConfigurationData(e)), _cosmosDBForPostgreSqlConfigurationConfigurationsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlConfigurationConfigurationsRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cosmosDBForPostgreSqlConfigurationConfigurationsRestClient.CreateListByClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlConfigurationResource(Client, CosmosDBForPostgreSqlConfigurationData.DeserializeCosmosDBForPostgreSqlConfigurationData(e)), _cosmosDBForPostgreSqlConfigurationConfigurationsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBForPostgreSqlConfigurationResource(Client, CosmosDBForPostgreSqlConfigurationData.DeserializeCosmosDBForPostgreSqlConfigurationData(e)), _cosmosDBForPostgreSqlConfigurationConfigurationsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationData.cs index d751fd3be8f7..0dd0b8969744 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlConfigurationData : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlConfigurationData() { ServerRoleGroupConfigurations = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public CosmosDBForPostgreSqlConfigurationData() /// If configuration change requires restart. /// The list of server role group configuration values. /// Provisioning state of the configuration. - internal CosmosDBForPostgreSqlConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, CosmosDBForPostgreSqlConfigurationDataType? dataType, string allowedValues, bool? isRestartRequired, IList serverRoleGroupConfigurations, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, CosmosDBForPostgreSqlConfigurationDataType? dataType, string allowedValues, bool? isRestartRequired, IList serverRoleGroupConfigurations, ProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; DataType = dataType; @@ -43,6 +48,7 @@ internal CosmosDBForPostgreSqlConfigurationData(ResourceIdentifier id, string na IsRestartRequired = isRestartRequired; ServerRoleGroupConfigurations = serverRoleGroupConfigurations; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the configuration. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs index e7c0f58657d1..ef88ccd15b6f 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string fi public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlFirewallRuleFirewallRulesRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlFirewallRuleResource(Client, CosmosDBForPostgreSqlFirewallRuleData.DeserializeCosmosDBForPostgreSqlFirewallRuleData(e)), _cosmosDBForPostgreSqlFirewallRuleFirewallRulesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlFirewallRuleCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlFirewallRuleResource(Client, CosmosDBForPostgreSqlFirewallRuleData.DeserializeCosmosDBForPostgreSqlFirewallRuleData(e)), _cosmosDBForPostgreSqlFirewallRuleFirewallRulesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlFirewallRuleCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAllAs public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlFirewallRuleFirewallRulesRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlFirewallRuleResource(Client, CosmosDBForPostgreSqlFirewallRuleData.DeserializeCosmosDBForPostgreSqlFirewallRuleData(e)), _cosmosDBForPostgreSqlFirewallRuleFirewallRulesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlFirewallRuleCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlFirewallRuleResource(Client, CosmosDBForPostgreSqlFirewallRuleData.DeserializeCosmosDBForPostgreSqlFirewallRuleData(e)), _cosmosDBForPostgreSqlFirewallRuleFirewallRulesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlFirewallRuleCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleData.cs index 6ef0696cdfd0..bacf4afe5db1 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlFirewallRuleData : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlFirewallRuleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start IP address of the cluster firewall rule. Must be IPv4 format. /// The end IP address of the cluster firewall rule. Must be IPv4 format. /// or is null. @@ -31,7 +35,7 @@ public CosmosDBForPostgreSqlFirewallRuleData(string startIPAddress, string endIP EndIPAddress = endIPAddress; } - /// Initializes a new instance of CosmosDBForPostgreSqlFirewallRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,11 +43,18 @@ public CosmosDBForPostgreSqlFirewallRuleData(string startIPAddress, string endIP /// The start IP address of the cluster firewall rule. Must be IPv4 format. /// The end IP address of the cluster firewall rule. Must be IPv4 format. /// Provisioning state of the firewall rule. - internal CosmosDBForPostgreSqlFirewallRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string startIPAddress, string endIPAddress, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlFirewallRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string startIPAddress, string endIPAddress, ProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { StartIPAddress = startIPAddress; EndIPAddress = endIPAddress; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBForPostgreSqlFirewallRuleData() + { } /// The start IP address of the cluster firewall rule. Must be IPv4 format. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs index e1eab92420da..88de716cbb45 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.cs @@ -227,7 +227,7 @@ public virtual Response public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(Client, CosmosDBForPostgreSqlPrivateEndpointConnectionData.DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(e)), _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(Client, CosmosDBForPostgreSqlPrivateEndpointConnectionData.DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(e)), _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(Client, CosmosDBForPostgreSqlPrivateEndpointConnectionData.DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(e)), _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(Client, CosmosDBForPostgreSqlPrivateEndpointConnectionData.DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(e)), _cosmosDBForPostgreSqlPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionData.cs index 1733aff009ad..c31c00bcec71 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; @@ -19,13 +20,16 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlPrivateEndpointConnectionData() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,12 +38,14 @@ public CosmosDBForPostgreSqlPrivateEndpointConnectionData() /// The private endpoint resource. /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. - internal CosmosDBForPostgreSqlPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList groupIds, SubResource privateEndpoint, CosmosDBForPostgreSqlPrivateLinkServiceConnectionState connectionState, CosmosDBForPostgreSqlPrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList groupIds, SubResource privateEndpoint, CosmosDBForPostgreSqlPrivateLinkServiceConnectionState connectionState, CosmosDBForPostgreSqlPrivateEndpointConnectionProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupIds = groupIds; PrivateEndpoint = privateEndpoint; ConnectionState = connectionState; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The group ids for the private endpoint resource. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs index 53a6df12ed2f..da5da3786c7d 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceCollection.cs @@ -145,7 +145,7 @@ public virtual Response Get(string pri public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlPrivateLinkResource(Client, CosmosDBForPostgreSqlPrivateLinkResourceData.DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(e)), _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlPrivateLinkResource(Client, CosmosDBForPostgreSqlPrivateLinkResourceData.DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(e)), _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// @@ -166,7 +166,7 @@ public virtual AsyncPageable GetAllAsy public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlPrivateLinkResource(Client, CosmosDBForPostgreSqlPrivateLinkResourceData.DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(e)), _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlPrivateLinkResource(Client, CosmosDBForPostgreSqlPrivateLinkResourceData.DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(e)), _cosmosDBForPostgreSqlPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlPrivateLinkResourceCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceData.cs index 95de59f46ede..3d9a3a643144 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,14 +18,17 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlPrivateLinkResourceData : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,11 +36,13 @@ public CosmosDBForPostgreSqlPrivateLinkResourceData() /// The private link resource group id. /// The private link resource required member names. /// The private link resource private link DNS zone name. - internal CosmosDBForPostgreSqlPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The private link resource group id. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs index 19cbc988c705..2814293b0557 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleCollection.cs @@ -227,7 +227,7 @@ public virtual Response Get(string roleName, public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlRoleRolesRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlRoleResource(Client, CosmosDBForPostgreSqlRoleData.DeserializeCosmosDBForPostgreSqlRoleData(e)), _cosmosDBForPostgreSqlRoleRolesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlRoleCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlRoleResource(Client, CosmosDBForPostgreSqlRoleData.DeserializeCosmosDBForPostgreSqlRoleData(e)), _cosmosDBForPostgreSqlRoleRolesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlRoleCollection.GetAll", "value", null, cancellationToken); } /// @@ -248,7 +248,7 @@ public virtual AsyncPageable GetAllAsync(Canc public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _cosmosDBForPostgreSqlRoleRolesRestClient.CreateListByClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBForPostgreSqlRoleResource(Client, CosmosDBForPostgreSqlRoleData.DeserializeCosmosDBForPostgreSqlRoleData(e)), _cosmosDBForPostgreSqlRoleRolesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlRoleCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CosmosDBForPostgreSqlRoleResource(Client, CosmosDBForPostgreSqlRoleData.DeserializeCosmosDBForPostgreSqlRoleData(e)), _cosmosDBForPostgreSqlRoleRolesClientDiagnostics, Pipeline, "CosmosDBForPostgreSqlRoleCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleData.cs index fc570604c345..29ffcf8d5f74 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class CosmosDBForPostgreSqlRoleData : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlRoleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The password of the cluster role. /// is null. public CosmosDBForPostgreSqlRoleData(string password) @@ -28,17 +32,24 @@ public CosmosDBForPostgreSqlRoleData(string password) Password = password; } - /// Initializes a new instance of CosmosDBForPostgreSqlRoleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The password of the cluster role. /// Provisioning state of the role. - internal CosmosDBForPostgreSqlRoleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string password, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlRoleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string password, ProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Password = password; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBForPostgreSqlRoleData() + { } /// The password of the cluster role. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 3f97299bef20..0597e917ab9e 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -63,7 +63,7 @@ public virtual AsyncPageable GetCosmosDBFo { HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); } /// @@ -85,7 +85,7 @@ public virtual Pageable GetCosmosDBForPost { HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.Serialization.cs index a0843d41f810..3ae3389be61e 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlClusterConfigurationListResult + internal partial class CosmosDBForPostgreSqlClusterConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlClusterConfigurationListResult DeserializeCosmosDBForPostgreSqlClusterConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlClusterConfigurationListResult DeserializeCosmosDBForPostgreSqlClusterConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static CosmosDBForPostgreSqlClusterConfigurationListResult DeserializeC nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlClusterConfigurationListResult(Optional.ToList(value), nextLink.Value); + return new CosmosDBForPostgreSqlClusterConfigurationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.cs index a1ddbeba1d6e..14c693ba11bf 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of cluster configurations. internal partial class CosmosDBForPostgreSqlClusterConfigurationListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlClusterConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterConfigurationListResult. + /// Initializes a new instance of . /// The list of cluster configurations. /// Link to retrieve next page of results. - internal CosmosDBForPostgreSqlClusterConfigurationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterConfigurationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of cluster configurations. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterData.Serialization.cs index 4158feaa331a..066542fd56f4 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlClusterData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlClusterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -52,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MaintenanceWindow)) { writer.WritePropertyName("maintenanceWindow"u8); - writer.WriteObjectValue(MaintenanceWindow); + if (MaintenanceWindow is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaintenanceWindow).Serialize(writer, options); + } } if (Optional.IsDefined(PreferredPrimaryZone)) { @@ -130,11 +143,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PointInTimeUTC.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlClusterData DeserializeCosmosDBForPostgreSqlClusterData(JsonElement element) + internal static CosmosDBForPostgreSqlClusterData DeserializeCosmosDBForPostgreSqlClusterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -171,6 +198,7 @@ internal static CosmosDBForPostgreSqlClusterData DeserializeCosmosDBForPostgreSq Optional> readReplicas = default; Optional earliestRestoreTime = default; Optional> privateEndpointConnections = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -441,8 +469,61 @@ internal static CosmosDBForPostgreSqlClusterData DeserializeCosmosDBForPostgreSq } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, administratorLogin.Value, administratorLoginPassword.Value, provisioningState.Value, state.Value, postgresqlVersion.Value, citusVersion.Value, maintenanceWindow.Value, preferredPrimaryZone.Value, Optional.ToNullable(enableShardsOnCoordinator), Optional.ToNullable(enableHa), coordinatorServerEdition.Value, Optional.ToNullable(coordinatorStorageQuotaInMb), Optional.ToNullable(coordinatorVCores), Optional.ToNullable(coordinatorEnablePublicIPAccess), nodeServerEdition.Value, Optional.ToNullable(nodeCount), Optional.ToNullable(nodeStorageQuotaInMb), Optional.ToNullable(nodeVCores), Optional.ToNullable(nodeEnablePublicIPAccess), Optional.ToList(serverNames), sourceResourceId.Value, Optional.ToNullable(sourceLocation), Optional.ToNullable(pointInTimeUTC), Optional.ToList(readReplicas), Optional.ToNullable(earliestRestoreTime), Optional.ToList(privateEndpointConnections), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBForPostgreSqlClusterData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, administratorLogin.Value, administratorLoginPassword.Value, provisioningState.Value, state.Value, postgresqlVersion.Value, citusVersion.Value, maintenanceWindow.Value, preferredPrimaryZone.Value, Optional.ToNullable(enableShardsOnCoordinator), Optional.ToNullable(enableHa), coordinatorServerEdition.Value, Optional.ToNullable(coordinatorStorageQuotaInMb), Optional.ToNullable(coordinatorVCores), Optional.ToNullable(coordinatorEnablePublicIPAccess), nodeServerEdition.Value, Optional.ToNullable(nodeCount), Optional.ToNullable(nodeStorageQuotaInMb), Optional.ToNullable(nodeVCores), Optional.ToNullable(nodeEnablePublicIPAccess), Optional.ToList(serverNames), sourceResourceId.Value, Optional.ToNullable(sourceLocation), Optional.ToNullable(pointInTimeUTC), Optional.ToList(readReplicas), Optional.ToNullable(earliestRestoreTime), Optional.ToList(privateEndpointConnections)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.Serialization.cs index 9ba80dcb81f3..58e3129b8fcc 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlClusterListResult + internal partial class CosmosDBForPostgreSqlClusterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlClusterListResult DeserializeCosmosDBForPostgreSqlClusterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlClusterListResult DeserializeCosmosDBForPostgreSqlClusterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static CosmosDBForPostgreSqlClusterListResult DeserializeCosmosDBForPos nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlClusterListResult(Optional.ToList(value), nextLink.Value); + return new CosmosDBForPostgreSqlClusterListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.cs index 38a92c96743e..764b8f69a276 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of clusters. internal partial class CosmosDBForPostgreSqlClusterListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlClusterListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterListResult. + /// Initializes a new instance of . /// The list of clusters. /// The link used to get the next page of cluster list. - internal CosmosDBForPostgreSqlClusterListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of clusters. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.Serialization.cs index f763f4259e6f..07d50f489615 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlClusterNameAvailabilityContent : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlClusterNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBForPostgreSqlClusterNameAvailabilityContent DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + CosmosDBForPostgreSqlNameAvailabilityResourceType type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new CosmosDBForPostgreSqlNameAvailabilityResourceType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlClusterNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.cs index 42b05523e094..21557e4792bc 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// Request from client to check cluster name availability. public partial class CosmosDBForPostgreSqlClusterNameAvailabilityContent { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Cluster name to verify. /// is null. public CosmosDBForPostgreSqlClusterNameAvailabilityContent(string name) @@ -24,6 +28,22 @@ public CosmosDBForPostgreSqlClusterNameAvailabilityContent(string name) ResourceType = CosmosDBForPostgreSqlNameAvailabilityResourceType.ServerGroupsV2; } + /// Initializes a new instance of . + /// Cluster name to verify. + /// Resource type used for verification. + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterNameAvailabilityContent(string name, CosmosDBForPostgreSqlNameAvailabilityResourceType resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBForPostgreSqlClusterNameAvailabilityContent() + { + } + /// Cluster name to verify. public string Name { get; } /// Resource type used for verification. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.Serialization.cs index 5ad390bc533d..ea5131f5d994 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.Serialization.cs @@ -5,15 +5,63 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlClusterNameAvailabilityResult + public partial class CosmosDBForPostgreSqlClusterNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlClusterNameAvailabilityResult DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlClusterNameAvailabilityResult DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static CosmosDBForPostgreSqlClusterNameAvailabilityResult DeserializeCo Optional nameAvailable = default; Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("message"u8)) @@ -52,8 +101,61 @@ internal static CosmosDBForPostgreSqlClusterNameAvailabilityResult DeserializeCo type = new ResourceType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlClusterNameAvailabilityResult(message.Value, Optional.ToNullable(nameAvailable), name.Value, Optional.ToNullable(type)); + return new CosmosDBForPostgreSqlClusterNameAvailabilityResult(message.Value, Optional.ToNullable(nameAvailable), name.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.cs index b3c03982870b..5b2381f84cea 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterNameAvailabilityResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// Represents cluster name availability. public partial class CosmosDBForPostgreSqlClusterNameAvailabilityResult { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlClusterNameAvailabilityResult() { } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterNameAvailabilityResult. + /// Initializes a new instance of . /// Error message. /// Indicates whether the cluster name is available. /// Name of the cluster. /// Type of the cluster. - internal CosmosDBForPostgreSqlClusterNameAvailabilityResult(string message, bool? isNameAvailable, string name, ResourceType? resourceType) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterNameAvailabilityResult(string message, bool? isNameAvailable, string name, ResourceType? resourceType, Dictionary serializedAdditionalRawData) { Message = message; IsNameAvailable = isNameAvailable; Name = name; ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error message. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.Serialization.cs index d486b7370af6..bbbc99349cee 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlClusterPatch : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlClusterPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -101,10 +109,260 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MaintenanceWindow)) { writer.WritePropertyName("maintenanceWindow"u8); - writer.WriteObjectValue(MaintenanceWindow); + if (MaintenanceWindow is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MaintenanceWindow).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CosmosDBForPostgreSqlClusterPatch DeserializeCosmosDBForPostgreSqlClusterPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional administratorLoginPassword = default; + Optional postgresqlVersion = default; + Optional citusVersion = default; + Optional enableShardsOnCoordinator = default; + Optional enableHa = default; + Optional preferredPrimaryZone = default; + Optional coordinatorServerEdition = default; + Optional coordinatorStorageQuotaInMb = default; + Optional coordinatorVCores = default; + Optional coordinatorEnablePublicIPAccess = default; + Optional nodeServerEdition = default; + Optional nodeCount = default; + Optional nodeStorageQuotaInMb = default; + Optional nodeVCores = default; + Optional nodeEnablePublicIPAccess = default; + Optional maintenanceWindow = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("administratorLoginPassword"u8)) + { + administratorLoginPassword = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("postgresqlVersion"u8)) + { + postgresqlVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("citusVersion"u8)) + { + citusVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("enableShardsOnCoordinator"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableShardsOnCoordinator = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableHa"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableHa = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("preferredPrimaryZone"u8)) + { + preferredPrimaryZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("coordinatorServerEdition"u8)) + { + coordinatorServerEdition = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("coordinatorStorageQuotaInMb"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coordinatorStorageQuotaInMb = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("coordinatorVCores"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coordinatorVCores = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("coordinatorEnablePublicIpAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coordinatorEnablePublicIPAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("nodeServerEdition"u8)) + { + nodeServerEdition = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("nodeCount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("nodeStorageQuotaInMb"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeStorageQuotaInMb = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("nodeVCores"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeVCores = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("nodeEnablePublicIpAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeEnablePublicIPAccess = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("maintenanceWindow"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenanceWindow = CosmosDBForPostgreSqlMaintenanceWindow.DeserializeCosmosDBForPostgreSqlMaintenanceWindow(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlClusterPatch(Optional.ToDictionary(tags), administratorLoginPassword.Value, postgresqlVersion.Value, citusVersion.Value, Optional.ToNullable(enableShardsOnCoordinator), Optional.ToNullable(enableHa), preferredPrimaryZone.Value, coordinatorServerEdition.Value, Optional.ToNullable(coordinatorStorageQuotaInMb), Optional.ToNullable(coordinatorVCores), Optional.ToNullable(coordinatorEnablePublicIPAccess), nodeServerEdition.Value, Optional.ToNullable(nodeCount), Optional.ToNullable(nodeStorageQuotaInMb), Optional.ToNullable(nodeVCores), Optional.ToNullable(nodeEnablePublicIPAccess), maintenanceWindow.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.cs index 894af61a2bce..dc6639a69e32 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,56 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// Represents a cluster for update. public partial class CosmosDBForPostgreSqlClusterPatch { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlClusterPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Application-specific metadata in the form of key-value pairs. + /// The password of the administrator login. Each cluster is created with pre-defined administrative role called ‘citus’. . + /// The major PostgreSQL version on all cluster servers. + /// The Citus extension version on all cluster servers. + /// If shards on coordinator is enabled or not for the cluster. + /// If high availability (HA) is enabled or not for the cluster. + /// Preferred primary availability zone (AZ) for all cluster servers. + /// The edition of the coordinator (default: GeneralPurpose). + /// The storage of the coordinator in MB. + /// The vCores count of the coordinator (max: 96). + /// If public access is enabled on coordinator. + /// The edition of a node (default: MemoryOptimized). + /// Worker node count of the cluster. When node count is 0, it represents a single node configuration with the ability to create distributed tables on that node. 2 or more worker nodes represent multi-node configuration. Node count value cannot be 1. + /// The storage in MB on each worker node. + /// The compute in vCores on each worker node (max: 104). + /// If public access is enabled on worker nodes. + /// Maintenance window of a cluster. + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterPatch(IDictionary tags, string administratorLoginPassword, string postgresqlVersion, string citusVersion, bool? isShardsOnCoordinatorEnabled, bool? isHAEnabled, string preferredPrimaryZone, string coordinatorServerEdition, int? coordinatorStorageQuotaInMb, int? coordinatorVCores, bool? isCoordinatorPublicIPAccessEnabled, string nodeServerEdition, int? nodeCount, int? nodeStorageQuotaInMb, int? nodeVCores, bool? isNodePublicIPAccessEnabled, CosmosDBForPostgreSqlMaintenanceWindow maintenanceWindow, Dictionary serializedAdditionalRawData) + { + Tags = tags; + AdministratorLoginPassword = administratorLoginPassword; + PostgresqlVersion = postgresqlVersion; + CitusVersion = citusVersion; + IsShardsOnCoordinatorEnabled = isShardsOnCoordinatorEnabled; + IsHAEnabled = isHAEnabled; + PreferredPrimaryZone = preferredPrimaryZone; + CoordinatorServerEdition = coordinatorServerEdition; + CoordinatorStorageQuotaInMb = coordinatorStorageQuotaInMb; + CoordinatorVCores = coordinatorVCores; + IsCoordinatorPublicIPAccessEnabled = isCoordinatorPublicIPAccessEnabled; + NodeServerEdition = nodeServerEdition; + NodeCount = nodeCount; + NodeStorageQuotaInMb = nodeStorageQuotaInMb; + NodeVCores = nodeVCores; + IsNodePublicIPAccessEnabled = isNodePublicIPAccessEnabled; + MaintenanceWindow = maintenanceWindow; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Application-specific metadata in the form of key-value pairs. public IDictionary Tags { get; } /// The password of the administrator login. Each cluster is created with pre-defined administrative role called ‘citus’. . diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerData.Serialization.cs index 865ae1e28d29..592bfc46d71c 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlClusterServerData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlClusterServerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -60,11 +68,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(CitusVersion); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlClusterServerData DeserializeCosmosDBForPostgreSqlClusterServerData(JsonElement element) + internal static CosmosDBForPostgreSqlClusterServerData DeserializeCosmosDBForPostgreSqlClusterServerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +109,7 @@ internal static CosmosDBForPostgreSqlClusterServerData DeserializeCosmosDBForPos Optional availabilityZone = default; Optional postgresqlVersion = default; Optional citusVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -219,8 +242,61 @@ internal static CosmosDBForPostgreSqlClusterServerData DeserializeCosmosDBForPos } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlClusterServerData(id, name, type, systemData.Value, serverEdition.Value, Optional.ToNullable(storageQuotaInMb), Optional.ToNullable(vCores), Optional.ToNullable(enableHa), Optional.ToNullable(enablePublicIPAccess), Optional.ToNullable(isReadOnly), administratorLogin.Value, fullyQualifiedDomainName.Value, Optional.ToNullable(role), state.Value, haState.Value, availabilityZone.Value, postgresqlVersion.Value, citusVersion.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterServerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterServerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterServerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterServerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterServerData model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlClusterServerData(id, name, type, systemData.Value, serverEdition.Value, Optional.ToNullable(storageQuotaInMb), Optional.ToNullable(vCores), Optional.ToNullable(enableHa), Optional.ToNullable(enablePublicIPAccess), Optional.ToNullable(isReadOnly), administratorLogin.Value, fullyQualifiedDomainName.Value, Optional.ToNullable(role), state.Value, haState.Value, availabilityZone.Value, postgresqlVersion.Value, citusVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterServerData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterServerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.Serialization.cs index 356f28358343..4fa1c2112e39 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlClusterServerListResult + internal partial class CosmosDBForPostgreSqlClusterServerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlClusterServerListResult DeserializeCosmosDBForPostgreSqlClusterServerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlClusterServerListResult DeserializeCosmosDBForPostgreSqlClusterServerListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBForPostgreSqlClusterServerListResult DeserializeCosmosDB value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlClusterServerListResult(Optional.ToList(value)); + return new CosmosDBForPostgreSqlClusterServerListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlClusterServerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlClusterServerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlClusterServerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlClusterServerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlClusterServerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlClusterServerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlClusterServerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.cs index 720867706673..c8713882e47f 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlClusterServerListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of servers in a cluster. internal partial class CosmosDBForPostgreSqlClusterServerListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlClusterServerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlClusterServerListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlClusterServerListResult. + /// Initializes a new instance of . /// The list of servers in a cluster. - internal CosmosDBForPostgreSqlClusterServerListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlClusterServerListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of servers in a cluster. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlConfigurationData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlConfigurationData.Serialization.cs index ff73685e32f0..ebd9f67435f9 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlConfigurationData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlConfigurationData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlConfigurationData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -31,16 +38,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ServerRoleGroupConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlConfigurationData DeserializeCosmosDBForPostgreSqlConfigurationData(JsonElement element) + internal static CosmosDBForPostgreSqlConfigurationData DeserializeCosmosDBForPostgreSqlConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +83,7 @@ internal static CosmosDBForPostgreSqlConfigurationData DeserializeCosmosDBForPos Optional requiresRestart = default; Optional> serverRoleGroupConfigurations = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -144,8 +173,61 @@ internal static CosmosDBForPostgreSqlConfigurationData DeserializeCosmosDBForPos } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlConfigurationData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(dataType), allowedValues.Value, Optional.ToNullable(requiresRestart), Optional.ToList(serverRoleGroupConfigurations), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlConfigurationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlConfigurationData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBForPostgreSqlConfigurationData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(dataType), allowedValues.Value, Optional.ToNullable(requiresRestart), Optional.ToList(serverRoleGroupConfigurations), Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleData.Serialization.cs index 7f48fc679b46..0965255dd783 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlFirewallRuleData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlFirewallRuleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("endIpAddress"u8); writer.WriteStringValue(EndIPAddress); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlFirewallRuleData DeserializeCosmosDBForPostgreSqlFirewallRuleData(JsonElement element) + internal static CosmosDBForPostgreSqlFirewallRuleData DeserializeCosmosDBForPostgreSqlFirewallRuleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +62,7 @@ internal static CosmosDBForPostgreSqlFirewallRuleData DeserializeCosmosDBForPost string startIPAddress = default; string endIPAddress = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +120,61 @@ internal static CosmosDBForPostgreSqlFirewallRuleData DeserializeCosmosDBForPost } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlFirewallRuleData(id, name, type, systemData.Value, startIPAddress, endIPAddress, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlFirewallRuleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlFirewallRuleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlFirewallRuleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlFirewallRuleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlFirewallRuleData model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlFirewallRuleData(id, name, type, systemData.Value, startIPAddress, endIPAddress, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlFirewallRuleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlFirewallRuleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.Serialization.cs index 448168e3373e..df21663d3ce1 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlFirewallRuleListResult + internal partial class CosmosDBForPostgreSqlFirewallRuleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlFirewallRuleListResult DeserializeCosmosDBForPostgreSqlFirewallRuleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlFirewallRuleListResult DeserializeCosmosDBForPostgreSqlFirewallRuleListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBForPostgreSqlFirewallRuleListResult DeserializeCosmosDBF value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlFirewallRuleListResult(Optional.ToList(value)); + return new CosmosDBForPostgreSqlFirewallRuleListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlFirewallRuleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlFirewallRuleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlFirewallRuleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlFirewallRuleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlFirewallRuleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlFirewallRuleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlFirewallRuleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.cs index cece8c6893c5..b6b33a0ceba7 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlFirewallRuleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of firewall rules. internal partial class CosmosDBForPostgreSqlFirewallRuleListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlFirewallRuleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlFirewallRuleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlFirewallRuleListResult. + /// Initializes a new instance of . /// The list of firewall rules in a cluster. - internal CosmosDBForPostgreSqlFirewallRuleListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlFirewallRuleListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of firewall rules in a cluster. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.Serialization.cs index af5c936aa935..6eafa052ed92 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlMaintenanceWindow : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlMaintenanceWindow : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CustomWindow)) { @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dayOfWeek"u8); writer.WriteNumberValue(DayOfWeek.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlMaintenanceWindow DeserializeCosmosDBForPostgreSqlMaintenanceWindow(JsonElement element) + internal static CosmosDBForPostgreSqlMaintenanceWindow DeserializeCosmosDBForPostgreSqlMaintenanceWindow(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +70,7 @@ internal static CosmosDBForPostgreSqlMaintenanceWindow DeserializeCosmosDBForPos Optional startHour = default; Optional startMinute = default; Optional dayOfWeek = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("customWindow"u8)) @@ -82,8 +105,61 @@ internal static CosmosDBForPostgreSqlMaintenanceWindow DeserializeCosmosDBForPos dayOfWeek = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlMaintenanceWindow(customWindow.Value, Optional.ToNullable(startHour), Optional.ToNullable(startMinute), Optional.ToNullable(dayOfWeek), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlMaintenanceWindow IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlMaintenanceWindow(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlMaintenanceWindow IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlMaintenanceWindow(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlMaintenanceWindow model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlMaintenanceWindow(customWindow.Value, Optional.ToNullable(startHour), Optional.ToNullable(startMinute), Optional.ToNullable(dayOfWeek)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlMaintenanceWindow(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlMaintenanceWindow(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.cs index bb6822933e65..f46307ead4af 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlMaintenanceWindow.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { /// Schedule settings for regular cluster updates. public partial class CosmosDBForPostgreSqlMaintenanceWindow { - /// Initializes a new instance of CosmosDBForPostgreSqlMaintenanceWindow. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlMaintenanceWindow() { } - /// Initializes a new instance of CosmosDBForPostgreSqlMaintenanceWindow. + /// Initializes a new instance of . /// Indicates whether custom maintenance window is enabled or not. /// Start hour within preferred day of the week for maintenance window. /// Start minute within the start hour for maintenance window. /// Preferred day of the week for maintenance window. - internal CosmosDBForPostgreSqlMaintenanceWindow(string customWindow, int? startHour, int? startMinute, int? dayOfWeek) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlMaintenanceWindow(string customWindow, int? startHour, int? startMinute, int? dayOfWeek, Dictionary serializedAdditionalRawData) { CustomWindow = customWindow; StartHour = startHour; StartMinute = startMinute; DayOfWeek = dayOfWeek; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether custom maintenance window is enabled or not. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionData.Serialization.cs index 9547d1cc0706..34cb615765ce 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionData.Serialization.cs @@ -5,19 +5,26 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,14 +36,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlPrivateEndpointConnectionData DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(JsonElement element) + internal static CosmosDBForPostgreSqlPrivateEndpointConnectionData DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +77,7 @@ internal static CosmosDBForPostgreSqlPrivateEndpointConnectionData DeserializeCo Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -128,8 +157,61 @@ internal static CosmosDBForPostgreSqlPrivateEndpointConnectionData DeserializeCo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToList(groupIds), privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBForPostgreSqlPrivateEndpointConnectionData(id, name, type, systemData.Value, Optional.ToList(groupIds), privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.Serialization.cs index d8c8595e0e96..ca3fd80f2824 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlPrivateEndpointConnectionListResult + internal partial class CosmosDBForPostgreSqlPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlPrivateEndpointConnectionListResult DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlPrivateEndpointConnectionListResult DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBForPostgreSqlPrivateEndpointConnectionListResult Deseria value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlPrivateEndpointConnectionListResult(Optional.ToList(value)); + return new CosmosDBForPostgreSqlPrivateEndpointConnectionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.cs index 00e902266ba8..58c921c55f68 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateEndpointConnectionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// List of private endpoint connections associated with the specified resource. internal partial class CosmosDBForPostgreSqlPrivateEndpointConnectionListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlPrivateEndpointConnectionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// Array of private endpoint connections. - internal CosmosDBForPostgreSqlPrivateEndpointConnectionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlPrivateEndpointConnectionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private endpoint connections. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceData.Serialization.cs index feb028e44724..0a943eb49038 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceData.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlPrivateLinkResourceData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlPrivateLinkResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -30,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlPrivateLinkResourceData DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(JsonElement element) + internal static CosmosDBForPostgreSqlPrivateLinkResourceData DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +67,7 @@ internal static CosmosDBForPostgreSqlPrivateLinkResourceData DeserializeCosmosDB Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -117,8 +139,61 @@ internal static CosmosDBForPostgreSqlPrivateLinkResourceData DeserializeCosmosDB } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlPrivateLinkResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlPrivateLinkResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlPrivateLinkResourceData model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlPrivateLinkResourceData(id, name, type, systemData.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlPrivateLinkResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlPrivateLinkResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.Serialization.cs index ef2f4c7d07ba..02b40ea9587d 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlPrivateLinkResourceListResult + internal partial class CosmosDBForPostgreSqlPrivateLinkResourceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlPrivateLinkResourceListResult DeserializeCosmosDBForPostgreSqlPrivateLinkResourceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlPrivateLinkResourceListResult DeserializeCosmosDBForPostgreSqlPrivateLinkResourceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBForPostgreSqlPrivateLinkResourceListResult DeserializeCo value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlPrivateLinkResourceListResult(Optional.ToList(value)); + return new CosmosDBForPostgreSqlPrivateLinkResourceListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlPrivateLinkResourceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlPrivateLinkResourceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlPrivateLinkResourceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlPrivateLinkResourceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlPrivateLinkResourceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlPrivateLinkResourceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlPrivateLinkResourceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.cs index f76e5542ae87..09081de1d342 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkResourceListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of private link resources. internal partial class CosmosDBForPostgreSqlPrivateLinkResourceListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkResourceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlPrivateLinkResourceListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkResourceListResult. + /// Initializes a new instance of . /// Array of private link resources. - internal CosmosDBForPostgreSqlPrivateLinkResourceListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlPrivateLinkResourceListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of private link resources. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.Serialization.cs index 1ec7456f86f9..644ec3ef7c0a 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlPrivateLinkServiceConnectionState : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlPrivateLinkServiceConnectionState DeserializeCosmosDBForPostgreSqlPrivateLinkServiceConnectionState(JsonElement element) + internal static CosmosDBForPostgreSqlPrivateLinkServiceConnectionState DeserializeCosmosDBForPostgreSqlPrivateLinkServiceConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static CosmosDBForPostgreSqlPrivateLinkServiceConnectionState Deseriali Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +86,61 @@ internal static CosmosDBForPostgreSqlPrivateLinkServiceConnectionState Deseriali actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlPrivateLinkServiceConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlPrivateLinkServiceConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlPrivateLinkServiceConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlPrivateLinkServiceConnectionState model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlPrivateLinkServiceConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlPrivateLinkServiceConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.cs index 72843f717dbf..ab9693f25e34 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlPrivateLinkServiceConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { /// A collection of information about the state of the connection between service consumer and provider. public partial class CosmosDBForPostgreSqlPrivateLinkServiceConnectionState { - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkServiceConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlPrivateLinkServiceConnectionState() { } - /// Initializes a new instance of CosmosDBForPostgreSqlPrivateLinkServiceConnectionState. + /// Initializes a new instance of . /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - internal CosmosDBForPostgreSqlPrivateLinkServiceConnectionState(CosmosDBForPostgreSqlPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlPrivateLinkServiceConnectionState(CosmosDBForPostgreSqlPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleData.Serialization.cs index 3e4925847370..83ae0c10f803 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleData.Serialization.cs @@ -5,28 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class CosmosDBForPostgreSqlRoleData : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlRoleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("password"u8); writer.WriteStringValue(Password); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlRoleData DeserializeCosmosDBForPostgreSqlRoleData(JsonElement element) + internal static CosmosDBForPostgreSqlRoleData DeserializeCosmosDBForPostgreSqlRoleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static CosmosDBForPostgreSqlRoleData DeserializeCosmosDBForPostgreSqlRo Optional systemData = default; string password = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -89,8 +112,61 @@ internal static CosmosDBForPostgreSqlRoleData DeserializeCosmosDBForPostgreSqlRo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlRoleData(id, name, type, systemData.Value, password, Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlRoleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlRoleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlRoleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlRoleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlRoleData model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlRoleData(id, name, type, systemData.Value, password, Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlRoleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlRoleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.Serialization.cs index 9770f11fff9c..e983ab9042f4 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.Serialization.cs @@ -5,22 +5,67 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class CosmosDBForPostgreSqlRoleListResult + internal partial class CosmosDBForPostgreSqlRoleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CosmosDBForPostgreSqlRoleListResult DeserializeCosmosDBForPostgreSqlRoleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CosmosDBForPostgreSqlRoleListResult DeserializeCosmosDBForPostgreSqlRoleListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +82,61 @@ internal static CosmosDBForPostgreSqlRoleListResult DeserializeCosmosDBForPostgr value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CosmosDBForPostgreSqlRoleListResult(Optional.ToList(value)); + return new CosmosDBForPostgreSqlRoleListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlRoleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlRoleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlRoleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlRoleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlRoleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlRoleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlRoleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.cs index 8008e63a296d..3d62c0633ad2 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlRoleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of roles. internal partial class CosmosDBForPostgreSqlRoleListResult { - /// Initializes a new instance of CosmosDBForPostgreSqlRoleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CosmosDBForPostgreSqlRoleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlRoleListResult. + /// Initializes a new instance of . /// The list of roles in a cluster. - internal CosmosDBForPostgreSqlRoleListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlRoleListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of roles in a cluster. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.Serialization.cs index 4ec689e68dcc..0765eb273ce6 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlServerRoleGroupConfiguration : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlServerRoleGroupConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("role"u8); writer.WriteStringValue(Role.ToString()); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlServerRoleGroupConfiguration DeserializeCosmosDBForPostgreSqlServerRoleGroupConfiguration(JsonElement element) + internal static CosmosDBForPostgreSqlServerRoleGroupConfiguration DeserializeCosmosDBForPostgreSqlServerRoleGroupConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -32,6 +54,7 @@ internal static CosmosDBForPostgreSqlServerRoleGroupConfiguration DeserializeCos string value = default; Optional defaultValue = default; Optional source = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("role"u8)) @@ -54,8 +77,61 @@ internal static CosmosDBForPostgreSqlServerRoleGroupConfiguration DeserializeCos source = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlServerRoleGroupConfiguration(role, value, defaultValue.Value, source.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlServerRoleGroupConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlServerRoleGroupConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlServerRoleGroupConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlServerRoleGroupConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlServerRoleGroupConfiguration model) + { + if (model is null) + { + return null; } - return new CosmosDBForPostgreSqlServerRoleGroupConfiguration(role, value, defaultValue.Value, source.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlServerRoleGroupConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlServerRoleGroupConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.cs index 68da0e442c8e..2434746abdfa 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlServerRoleGroupConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// Represents server role group configuration value. public partial class CosmosDBForPostgreSqlServerRoleGroupConfiguration { - /// Initializes a new instance of CosmosDBForPostgreSqlServerRoleGroupConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The role of servers in the server role group. /// Value of the configuration. /// is null. @@ -25,17 +29,24 @@ public CosmosDBForPostgreSqlServerRoleGroupConfiguration(CosmosDBForPostgreSqlSe Value = value; } - /// Initializes a new instance of CosmosDBForPostgreSqlServerRoleGroupConfiguration. + /// Initializes a new instance of . /// The role of servers in the server role group. /// Value of the configuration. /// Default value of the configuration. /// Source of the configuration. - internal CosmosDBForPostgreSqlServerRoleGroupConfiguration(CosmosDBForPostgreSqlServerRole role, string value, string defaultValue, string source) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlServerRoleGroupConfiguration(CosmosDBForPostgreSqlServerRole role, string value, string defaultValue, string source, Dictionary serializedAdditionalRawData) { Role = role; Value = value; DefaultValue = defaultValue; Source = source; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CosmosDBForPostgreSqlServerRoleGroupConfiguration() + { } /// The role of servers in the server role group. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.Serialization.cs index 4376dc410977..91b951c91a60 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class CosmosDBForPostgreSqlSimplePrivateEndpointConnection : IUtf8JsonSerializable + public partial class CosmosDBForPostgreSqlSimplePrivateEndpointConnection : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -38,14 +45,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState); + if (PrivateLinkServiceConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrivateLinkServiceConnectionState).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CosmosDBForPostgreSqlSimplePrivateEndpointConnection DeserializeCosmosDBForPostgreSqlSimplePrivateEndpointConnection(JsonElement element) + internal static CosmosDBForPostgreSqlSimplePrivateEndpointConnection DeserializeCosmosDBForPostgreSqlSimplePrivateEndpointConnection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +85,7 @@ internal static CosmosDBForPostgreSqlSimplePrivateEndpointConnection Deserialize Optional privateEndpoint = default; Optional> groupIds = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -127,8 +156,61 @@ internal static CosmosDBForPostgreSqlSimplePrivateEndpointConnection Deserialize } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CosmosDBForPostgreSqlSimplePrivateEndpointConnection(id, name, type, systemData.Value, privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + CosmosDBForPostgreSqlSimplePrivateEndpointConnection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBForPostgreSqlSimplePrivateEndpointConnection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBForPostgreSqlSimplePrivateEndpointConnection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBForPostgreSqlSimplePrivateEndpointConnection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBForPostgreSqlSimplePrivateEndpointConnection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBForPostgreSqlSimplePrivateEndpointConnection(Response response) + { + if (response is null) + { + return null; } - return new CosmosDBForPostgreSqlSimplePrivateEndpointConnection(id, name, type, systemData.Value, privateEndpoint, Optional.ToList(groupIds), privateLinkServiceConnectionState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBForPostgreSqlSimplePrivateEndpointConnection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.cs index d9ecd5a29239..565fa3ae5247 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/CosmosDBForPostgreSqlSimplePrivateEndpointConnection.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,13 +16,16 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A private endpoint connection. public partial class CosmosDBForPostgreSqlSimplePrivateEndpointConnection : ResourceData { - /// Initializes a new instance of CosmosDBForPostgreSqlSimplePrivateEndpointConnection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CosmosDBForPostgreSqlSimplePrivateEndpointConnection() { GroupIds = new ChangeTrackingList(); } - /// Initializes a new instance of CosmosDBForPostgreSqlSimplePrivateEndpointConnection. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,11 +33,13 @@ public CosmosDBForPostgreSqlSimplePrivateEndpointConnection() /// Private endpoint which the connection belongs to. /// Group ids of the private endpoint connection. /// A collection of information about the state of the connection between service consumer and provider. - internal CosmosDBForPostgreSqlSimplePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WritableSubResource privateEndpoint, IList groupIds, CosmosDBForPostgreSqlPrivateLinkServiceConnectionState privateLinkServiceConnectionState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CosmosDBForPostgreSqlSimplePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WritableSubResource privateEndpoint, IList groupIds, CosmosDBForPostgreSqlPrivateLinkServiceConnectionState privateLinkServiceConnectionState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; GroupIds = groupIds; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Private endpoint which the connection belongs to. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationData.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationData.Serialization.cs index 7bf2692d09c8..728c11941977 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationData.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CosmosDBForPostgreSql { - public partial class ServerConfigurationData : IUtf8JsonSerializable + public partial class ServerConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ServerConfigurationData DeserializeServerConfigurationData(JsonElement element) + internal static ServerConfigurationData DeserializeServerConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +68,7 @@ internal static ServerConfigurationData DeserializeServerConfigurationData(JsonE Optional allowedValues = default; Optional requiresRestart = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -136,8 +159,61 @@ internal static ServerConfigurationData DeserializeServerConfigurationData(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ServerConfigurationData(id, name, type, systemData.Value, value.Value, source.Value, description.Value, defaultValue.Value, Optional.ToNullable(dataType), allowedValues.Value, Optional.ToNullable(requiresRestart), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + ServerConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServerConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServerConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServerConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServerConfigurationData model) + { + if (model is null) + { + return null; } - return new ServerConfigurationData(id, name, type, systemData.Value, value.Value, source.Value, description.Value, defaultValue.Value, Optional.ToNullable(dataType), allowedValues.Value, Optional.ToNullable(requiresRestart), Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServerConfigurationData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServerConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.Serialization.cs index 134f515b283e..2f40de976ac3 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.Serialization.cs @@ -5,23 +5,68 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CosmosDBForPostgreSql; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - internal partial class ServerConfigurationListResult + internal partial class ServerConfigurationListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServerConfigurationListResult DeserializeServerConfigurationListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServerConfigurationListResult DeserializeServerConfigurationListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +88,61 @@ internal static ServerConfigurationListResult DeserializeServerConfigurationList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServerConfigurationListResult(Optional.ToList(value), nextLink.Value); + return new ServerConfigurationListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ServerConfigurationListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServerConfigurationListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServerConfigurationListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServerConfigurationListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServerConfigurationListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServerConfigurationListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServerConfigurationListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.cs index 31ba06ad9472..b72ac039c136 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerConfigurationListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models /// A list of server configurations. internal partial class ServerConfigurationListResult { - /// Initializes a new instance of ServerConfigurationListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServerConfigurationListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ServerConfigurationListResult. + /// Initializes a new instance of . /// The list of server configurations. /// Link to retrieve next page of results. - internal ServerConfigurationListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ServerConfigurationListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of server configurations. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.Serialization.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.Serialization.cs index b4c7a35d9bfb..fafa538ab73a 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.Serialization.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.Serialization.cs @@ -5,21 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { - public partial class ServerNameItem + public partial class ServerNameItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ServerNameItem DeserializeServerNameItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ServerNameItem DeserializeServerNameItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional fullyQualifiedDomainName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +66,61 @@ internal static ServerNameItem DeserializeServerNameItem(JsonElement element) fullyQualifiedDomainName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ServerNameItem(name.Value, fullyQualifiedDomainName.Value); + return new ServerNameItem(name.Value, fullyQualifiedDomainName.Value, serializedAdditionalRawData); + } + + ServerNameItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServerNameItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServerNameItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServerNameItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServerNameItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServerNameItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServerNameItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.cs index 9b17788a55e2..ed9bdd8cbc1c 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Models/ServerNameItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { /// The name object for a server. public partial class ServerNameItem { - /// Initializes a new instance of ServerNameItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ServerNameItem() { } - /// Initializes a new instance of ServerNameItem. + /// Initializes a new instance of . /// The name of a server. /// The fully qualified domain name of a server. - internal ServerNameItem(string name, string fullyQualifiedDomainName) + /// Keeps track of any properties unknown to the library. + internal ServerNameItem(string name, string fullyQualifiedDomainName, Dictionary serializedAdditionalRawData) { Name = name; FullyQualifiedDomainName = fullyQualifiedDomainName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of a server. diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ClustersRestOperations.cs index c6a696a1600e..47c8799ca52e 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ClustersRestOperations.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ClustersRestOperations.cs @@ -194,9 +194,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -426,9 +424,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -781,9 +777,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ConfigurationsRestOperations.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ConfigurationsRestOperations.cs index 330d833cb82f..3f4bfc91dbba 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ConfigurationsRestOperations.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/ConfigurationsRestOperations.cs @@ -396,9 +396,7 @@ internal HttpMessage CreateUpdateOnCoordinatorRequest(string subscriptionId, str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -568,9 +566,7 @@ internal HttpMessage CreateUpdateOnNodeRequest(string subscriptionId, string res request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/FirewallRulesRestOperations.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/FirewallRulesRestOperations.cs index 7e90ddff6e77..4843bc0ce8be 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/FirewallRulesRestOperations.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/FirewallRulesRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 3b25b0e641ac..0a4d3720fdb2 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/RolesRestOperations.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/RolesRestOperations.cs index 25a33c7a21fe..be9cd67c452d 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/RolesRestOperations.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/RestOperations/RolesRestOperations.cs @@ -144,9 +144,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ServerConfigurationData.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ServerConfigurationData.cs index 9ab92559fdd4..99ef0d653abd 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ServerConfigurationData.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/ServerConfigurationData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Models; @@ -17,12 +19,15 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// public partial class ServerConfigurationData : ResourceData { - /// Initializes a new instance of ServerConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ServerConfigurationData() { } - /// Initializes a new instance of ServerConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +40,8 @@ public ServerConfigurationData() /// Allowed values of the configuration. /// If configuration change requires restart. /// Provisioning state of the configuration. - internal ServerConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, string source, string description, string defaultValue, CosmosDBForPostgreSqlConfigurationDataType? dataType, string allowedValues, bool? isRestartRequired, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ServerConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, string source, string description, string defaultValue, CosmosDBForPostgreSqlConfigurationDataType? dataType, string allowedValues, bool? isRestartRequired, ProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Value = value; Source = source; @@ -45,6 +51,7 @@ internal ServerConfigurationData(ResourceIdentifier id, string name, ResourceTyp AllowedValues = allowedValues; IsRestartRequired = isRestartRequired; ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Value of the configuration. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs index 5118cffd412e..10902e05b99a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.CostManagement.Models /// Model factory for models. public static partial class ArmCostManagementModelFactory { - /// Initializes a new instance of BenefitRecommendationModel. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,10 +32,10 @@ public static partial class ArmCostManagementModelFactory /// A new instance for mocking. public static BenefitRecommendationModel BenefitRecommendationModel(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BenefitRecommendationProperties properties = null, BillingAccountBenefitKind? kind = null) { - return new BenefitRecommendationModel(id, name, resourceType, systemData, properties, kind); + return new BenefitRecommendationModel(id, name, resourceType, systemData, properties, kind, default); } - /// Initializes a new instance of BenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -52,10 +52,10 @@ public static BenefitRecommendationModel BenefitRecommendationModel(ResourceIden /// A new instance for mocking. public static BenefitRecommendationProperties BenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null, string scope = "Unknown") { - return new UnknownBenefitRecommendationProperties(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope); + return new UnknownBenefitRecommendationProperties(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope, default); } - /// Initializes a new instance of RecommendationUsageDetails. + /// Initializes a new instance of . /// The grain of the usage. Supported values: 'Hourly'. /// On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. /// A new instance for mocking. @@ -63,10 +63,10 @@ public static RecommendationUsageDetails RecommendationUsageDetails(BenefitRecom { charges ??= new List(); - return new RecommendationUsageDetails(usageGrain, charges?.ToList()); + return new RecommendationUsageDetails(usageGrain, charges?.ToList(), default); } - /// Initializes a new instance of AllSavingsBenefitDetails. + /// Initializes a new instance of . /// The difference between total cost and benefit cost for the 'totalHours' in the look-back period. /// The estimated cost with benefit for the 'totalHours' in the look-back period. It's equal to (commitmentAmount * totalHours). /// Total cost, which is sum of benefit cost and overage cost. @@ -79,10 +79,10 @@ public static RecommendationUsageDetails RecommendationUsageDetails(BenefitRecom /// A new instance for mocking. public static AllSavingsBenefitDetails AllSavingsBenefitDetails(decimal? overageCost = null, decimal? benefitCost = null, decimal? totalCost = null, decimal? savingsAmount = null, decimal? savingsPercentage = null, decimal? coveragePercentage = null, decimal? commitmentAmount = null, decimal? averageUtilizationPercentage = null, decimal? wastageCost = null) { - return new AllSavingsBenefitDetails(overageCost, benefitCost, totalCost, savingsAmount, savingsPercentage, coveragePercentage, commitmentAmount, averageUtilizationPercentage, wastageCost); + return new AllSavingsBenefitDetails(overageCost, benefitCost, totalCost, savingsAmount, savingsPercentage, coveragePercentage, commitmentAmount, averageUtilizationPercentage, wastageCost, default); } - /// Initializes a new instance of AllSavingsList. + /// Initializes a new instance of . /// The list of benefit recommendations with the recommendation details.. /// The link (URL) to the next page of results. /// A new instance for mocking. @@ -90,19 +90,19 @@ public static AllSavingsList AllSavingsList(IEnumerable(); - return new AllSavingsList(value?.ToList(), nextLink); + return new AllSavingsList(value?.ToList(), nextLink, default); } - /// Initializes a new instance of ExportRunErrorDetails. + /// Initializes a new instance of . /// Error code. /// Error message indicating why the operation failed. /// A new instance for mocking. public static ExportRunErrorDetails ExportRunErrorDetails(string code = null, string message = null) { - return new ExportRunErrorDetails(code, message); + return new ExportRunErrorDetails(code, message, default); } - /// Initializes a new instance of BenefitUtilizationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -111,30 +111,30 @@ public static ExportRunErrorDetails ExportRunErrorDetails(string code = null, st /// A new instance for mocking. public static BenefitUtilizationSummary BenefitUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = "Unknown") { - return new BenefitUtilizationSummary(id, name, resourceType, systemData, kind); + return new BenefitUtilizationSummary(id, name, resourceType, systemData, kind, default); } - /// Initializes a new instance of BenefitUtilizationSummariesOperationStatus. + /// Initializes a new instance of . /// Input given to create the benefit utilization summaries report. /// The status of the creation of the benefit utilization summaries report. /// Contains sas url to the async benefit utilization summaries report and a date that the url is valid until. These values will be empty if the report is in a Running or Failed state. /// A new instance for mocking. public static BenefitUtilizationSummariesOperationStatus BenefitUtilizationSummariesOperationStatus(BenefitUtilizationSummariesContent input = null, OperationStatusType? status = null, AsyncOperationStatusProperties properties = null) { - return new BenefitUtilizationSummariesOperationStatus(input, status, properties); + return new BenefitUtilizationSummariesOperationStatus(input, status, properties, default); } - /// Initializes a new instance of AsyncOperationStatusProperties. + /// Initializes a new instance of . /// Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. /// Sas url to async benefit utilization summaries report in secondary storage in case of primary outage. Will be empty if the report is in Running or Failed state. /// The date that the sas url provided in reportUrl expires. /// A new instance for mocking. public static AsyncOperationStatusProperties AsyncOperationStatusProperties(BenefitUtilizationSummaryReportSchema? reportUri = null, BenefitUtilizationSummaryReportSchema? secondaryReportUri = null, DateTimeOffset? validUntil = null) { - return new AsyncOperationStatusProperties(reportUri, secondaryReportUri, validUntil); + return new AsyncOperationStatusProperties(reportUri, secondaryReportUri, validUntil, default); } - /// Initializes a new instance of CostManagementExportData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -152,10 +152,10 @@ public static CostManagementExportData CostManagementExportData(ResourceIdentifi { runHistoryValue ??= new List(); - return new CostManagementExportData(id, name, resourceType, systemData, format, deliveryInfoDestination != null ? new ExportDeliveryInfo(deliveryInfoDestination) : null, definition, runHistoryValue != null ? new ExportExecutionListResult(runHistoryValue?.ToList()) : null, partitionData, nextRunTimeEstimate, schedule, eTag); + return new CostManagementExportData(id, name, resourceType, systemData, format, deliveryInfoDestination != null ? new ExportDeliveryInfo(deliveryInfoDestination, new Dictionary()) : null, definition, runHistoryValue != null ? new ExportExecutionListResult(runHistoryValue?.ToList(), new Dictionary()) : null, partitionData, nextRunTimeEstimate, schedule, eTag, default); } - /// Initializes a new instance of CommonExportProperties. + /// Initializes a new instance of . /// The format of the export being delivered. Currently only 'Csv' is supported. /// Has delivery information for the export. /// Has the definition for the export. @@ -167,10 +167,10 @@ public static CommonExportProperties CommonExportProperties(ExportFormatType? fo { runHistoryValue ??= new List(); - return new CommonExportProperties(format, deliveryInfoDestination != null ? new ExportDeliveryInfo(deliveryInfoDestination) : null, definition, runHistoryValue != null ? new ExportExecutionListResult(runHistoryValue?.ToList()) : null, partitionData, nextRunTimeEstimate); + return new CommonExportProperties(format, deliveryInfoDestination != null ? new ExportDeliveryInfo(deliveryInfoDestination, new Dictionary()) : null, definition, runHistoryValue != null ? new ExportExecutionListResult(runHistoryValue?.ToList(), new Dictionary()) : null, partitionData, nextRunTimeEstimate, default); } - /// Initializes a new instance of ExportRun. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -188,10 +188,10 @@ public static CommonExportProperties CommonExportProperties(ExportFormatType? fo /// A new instance for mocking. public static ExportRun ExportRun(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExportRunExecutionType? executionType = null, ExportRunExecutionStatus? status = null, string submittedBy = null, DateTimeOffset? submittedOn = null, DateTimeOffset? processingStartOn = null, DateTimeOffset? processingEndOn = null, string fileName = null, CommonExportProperties runSettings = null, ExportRunErrorDetails error = null, ETag? eTag = null) { - return new ExportRun(id, name, resourceType, systemData, executionType, status, submittedBy, submittedOn, processingStartOn, processingEndOn, fileName, runSettings, error, eTag); + return new ExportRun(id, name, resourceType, systemData, executionType, status, submittedBy, submittedOn, processingStartOn, processingEndOn, fileName, runSettings, error, eTag, default); } - /// Initializes a new instance of CostManagementViewData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -219,10 +219,10 @@ public static CostManagementViewData CostManagementViewData(ResourceIdentifier i kpis ??= new List(); pivots ??= new List(); - return new CostManagementViewData(id, name, resourceType, systemData, displayName, scope, createdOn, modifiedOn, dateRange, currency, chart, accumulated, metric, kpis?.ToList(), pivots?.ToList(), typePropertiesQueryType, timeframe, timePeriod, dataSet, includeMonetaryCommitment, eTag); + return new CostManagementViewData(id, name, resourceType, systemData, displayName, scope, createdOn, modifiedOn, dateRange, currency, chart, accumulated, metric, kpis?.ToList(), pivots?.ToList(), typePropertiesQueryType, timeframe, timePeriod, dataSet, includeMonetaryCommitment, eTag, default); } - /// Initializes a new instance of CostManagementAlertData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -242,10 +242,23 @@ public static CostManagementViewData CostManagementViewData(ResourceIdentifier i /// A new instance for mocking. public static CostManagementAlertData CostManagementAlertData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AlertPropertiesDefinition definition = null, string description = null, CostManagementAlertSource? source = null, AlertPropertiesDetails details = null, string costEntityId = null, CostManagementAlertStatus? status = null, DateTimeOffset? createdOn = null, DateTimeOffset? closeOn = null, DateTimeOffset? modifiedOn = null, string statusModificationUserName = null, DateTimeOffset? statusModifiedOn = null, ETag? eTag = null) { - return new CostManagementAlertData(id, name, resourceType, systemData, definition, description, source, details, costEntityId, status, createdOn, closeOn, modifiedOn, statusModificationUserName, statusModifiedOn, eTag); + return new CostManagementAlertData(id, name, resourceType, systemData, definition, description, source, details, costEntityId, status, createdOn, closeOn, modifiedOn, statusModificationUserName, statusModifiedOn, eTag, default); } - /// Initializes a new instance of ForecastResult. + /// Initializes a new instance of . + /// The type of the forecast. + /// The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. + /// Has time period for pulling data for the forecast. + /// Has definition for data in this forecast. + /// A boolean determining if actualCost will be included. + /// A boolean determining if FreshPartialCost will be included. + /// A new instance for mocking. + public static ForecastDefinition ForecastDefinition(ForecastType forecastType = default, ForecastTimeframe timeframe = default, ForecastTimePeriod timePeriod = null, ForecastDataset dataset = null, bool? includeActualCost = null, bool? includeFreshPartialCost = null) + { + return new ForecastDefinition(forecastType, timeframe, timePeriod, dataset, includeActualCost, includeFreshPartialCost, default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -264,19 +277,19 @@ public static ForecastResult ForecastResult(ResourceIdentifier id = null, string rows ??= new List>(); tags ??= new Dictionary(); - return new ForecastResult(id, name, resourceType, systemData, nextLink, columns?.ToList(), rows?.ToList(), location, sku, eTag, tags); + return new ForecastResult(id, name, resourceType, systemData, nextLink, columns?.ToList(), rows?.ToList(), location, sku, eTag, tags, default); } - /// Initializes a new instance of ForecastColumn. + /// Initializes a new instance of . /// The name of column. /// The type of column. /// A new instance for mocking. public static ForecastColumn ForecastColumn(string name = null, string forecastColumnType = null) { - return new ForecastColumn(name, forecastColumnType); + return new ForecastColumn(name, forecastColumnType, default); } - /// Initializes a new instance of CostManagementDimension. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -300,10 +313,21 @@ public static CostManagementDimension CostManagementDimension(ResourceIdentifier data ??= new List(); tags ??= new Dictionary(); - return new CostManagementDimension(id, name, resourceType, systemData, description, isFilterEnabled, isGroupingEnabled, data?.ToList(), total, category, usageStart, usageEnd, nextLink, location, sku, eTag, tags); + return new CostManagementDimension(id, name, resourceType, systemData, description, isFilterEnabled, isGroupingEnabled, data?.ToList(), total, category, usageStart, usageEnd, nextLink, location, sku, eTag, tags, default); + } + + /// Initializes a new instance of . + /// The type of the query. + /// The time frame for pulling data for the query. If custom, then a specific time period must be provided. + /// Has time period for pulling data for the query. + /// Has definition for data in this query. + /// A new instance for mocking. + public static QueryDefinition QueryDefinition(ExportType exportType = default, TimeframeType timeframe = default, QueryTimePeriod timePeriod = null, QueryDataset dataset = null) + { + return new QueryDefinition(exportType, timeframe, timePeriod, dataset, default); } - /// Initializes a new instance of QueryResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -322,39 +346,39 @@ public static QueryResult QueryResult(ResourceIdentifier id = null, string name rows ??= new List>(); tags ??= new Dictionary(); - return new QueryResult(id, name, resourceType, systemData, nextLink, columns?.ToList(), rows?.ToList(), location, sku, eTag, tags); + return new QueryResult(id, name, resourceType, systemData, nextLink, columns?.ToList(), rows?.ToList(), location, sku, eTag, tags, default); } - /// Initializes a new instance of QueryColumn. + /// Initializes a new instance of . /// The name of column. /// The type of column. /// A new instance for mocking. public static QueryColumn QueryColumn(string name = null, string queryColumnType = null) { - return new QueryColumn(name, queryColumnType); + return new QueryColumn(name, queryColumnType, default); } - /// Initializes a new instance of OperationStatus. + /// Initializes a new instance of . /// The status of the long running operation. /// The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity. /// The time at which report URL becomes invalid. /// A new instance for mocking. public static OperationStatus OperationStatus(OperationStatusType? status = null, ReservationReportSchema? reportUri = null, DateTimeOffset? validUntil = null) { - return new OperationStatus(status, reportUri, validUntil); + return new OperationStatus(status, reportUri, validUntil, default); } - /// Initializes a new instance of DownloadURL. + /// Initializes a new instance of . /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. /// The URL to download the generated report. /// A new instance for mocking. public static DownloadURL DownloadURL(DateTimeOffset? expiryOn = null, DateTimeOffset? validTill = null, Uri downloadUri = null) { - return new DownloadURL(expiryOn, validTill, downloadUri); + return new DownloadURL(expiryOn, validTill, downloadUri, default); } - /// Initializes a new instance of ScheduledActionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -374,20 +398,20 @@ public static ScheduledActionData ScheduledActionData(ResourceIdentifier id = nu { fileFormats ??= new List(); - return new ScheduledActionData(id, name, resourceType, systemData, displayName, fileFormats != null ? new FileDestination(fileFormats?.ToList()) : null, notification, notificationEmail, schedule, scope, status, viewId, eTag, kind); + return new ScheduledActionData(id, name, resourceType, systemData, displayName, fileFormats != null ? new FileDestination(fileFormats?.ToList(), new Dictionary()) : null, notification, notificationEmail, schedule, scope, status, viewId, eTag, kind, default); } - /// Initializes a new instance of CostManagementNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. /// A new instance for mocking. public static CostManagementNameAvailabilityResult CostManagementNameAvailabilityResult(bool? nameAvailable = null, CostManagementUnavailabilityReason? reason = null, string message = null) { - return new CostManagementNameAvailabilityResult(nameAvailable, reason, message); + return new CostManagementNameAvailabilityResult(nameAvailable, reason, message, default); } - /// Initializes a new instance of SingleScopeBenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -405,10 +429,10 @@ public static CostManagementNameAvailabilityResult CostManagementNameAvailabilit /// A new instance for mocking. public static SingleScopeBenefitRecommendationProperties SingleScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null, string subscriptionId = null, string resourceGroup = null) { - return new SingleScopeBenefitRecommendationProperties(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, BenefitRecommendationScope.Single, subscriptionId, resourceGroup); + return new SingleScopeBenefitRecommendationProperties(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, BenefitRecommendationScope.Single, subscriptionId, resourceGroup, default); } - /// Initializes a new instance of SharedScopeBenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -424,10 +448,10 @@ public static SingleScopeBenefitRecommendationProperties SingleScopeBenefitRecom /// A new instance for mocking. public static SharedScopeBenefitRecommendationProperties SharedScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null) { - return new SharedScopeBenefitRecommendationProperties(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, BenefitRecommendationScope.Shared); + return new SharedScopeBenefitRecommendationProperties(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, BenefitRecommendationScope.Shared, default); } - /// Initializes a new instance of IncludedQuantityUtilizationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -441,10 +465,10 @@ public static SharedScopeBenefitRecommendationProperties SharedScopeBenefitRecom /// A new instance for mocking. public static IncludedQuantityUtilizationSummary IncludedQuantityUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string armSkuName = null, string benefitId = null, string benefitOrderId = null, BillingAccountBenefitKind? benefitType = null, DateTimeOffset? usageOn = null, decimal? utilizationPercentage = null) { - return new IncludedQuantityUtilizationSummary(id, name, resourceType, systemData, BillingAccountBenefitKind.IncludedQuantity, armSkuName, benefitId, benefitOrderId, benefitType, usageOn, utilizationPercentage); + return new IncludedQuantityUtilizationSummary(id, name, resourceType, systemData, BillingAccountBenefitKind.IncludedQuantity, armSkuName, benefitId, benefitOrderId, benefitType, usageOn, utilizationPercentage, default); } - /// Initializes a new instance of SavingsPlanUtilizationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -460,7 +484,7 @@ public static IncludedQuantityUtilizationSummary IncludedQuantityUtilizationSumm /// A new instance for mocking. public static SavingsPlanUtilizationSummary SavingsPlanUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string armSkuName = null, string benefitId = null, string benefitOrderId = null, BillingAccountBenefitKind? benefitType = null, DateTimeOffset? usageOn = null, decimal? avgUtilizationPercentage = null, decimal? minUtilizationPercentage = null, decimal? maxUtilizationPercentage = null) { - return new SavingsPlanUtilizationSummary(id, name, resourceType, systemData, BillingAccountBenefitKind.SavingsPlan, armSkuName, benefitId, benefitOrderId, benefitType, usageOn, avgUtilizationPercentage, minUtilizationPercentage, maxUtilizationPercentage); + return new SavingsPlanUtilizationSummary(id, name, resourceType, systemData, BillingAccountBenefitKind.SavingsPlan, armSkuName, benefitId, benefitOrderId, benefitType, usageOn, avgUtilizationPercentage, minUtilizationPercentage, maxUtilizationPercentage, default); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs index 5217b40e438e..22b363d82dc7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs @@ -133,7 +133,7 @@ public virtual Response Get(string alertId, Cancell public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _costManagementAlertAlertsRestClient.CreateListRequest(Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), _costManagementAlertAlertsClientDiagnostics, Pipeline, "CostManagementAlertCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), _costManagementAlertAlertsClientDiagnostics, Pipeline, "CostManagementAlertCollection.GetAll", "value", null, cancellationToken); } /// @@ -154,7 +154,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _costManagementAlertAlertsRestClient.CreateListRequest(Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), _costManagementAlertAlertsClientDiagnostics, Pipeline, "CostManagementAlertCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), _costManagementAlertAlertsClientDiagnostics, Pipeline, "CostManagementAlertCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs index 8af6f62bfeda..64a91df9e75f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.CostManagement.Models; @@ -19,12 +20,15 @@ namespace Azure.ResourceManager.CostManagement /// public partial class CostManagementAlertData : ResourceData { - /// Initializes a new instance of CostManagementAlertData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CostManagementAlertData() { } - /// Initializes a new instance of CostManagementAlertData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +45,8 @@ public CostManagementAlertData() /// User who last modified the alert. /// dateTime in which the alert status was last modified. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AlertPropertiesDefinition definition, string description, CostManagementAlertSource? source, AlertPropertiesDetails details, string costEntityId, CostManagementAlertStatus? status, DateTimeOffset? createdOn, DateTimeOffset? closeOn, DateTimeOffset? modifiedOn, string statusModificationUserName, DateTimeOffset? statusModifiedOn, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AlertPropertiesDefinition definition, string description, CostManagementAlertSource? source, AlertPropertiesDetails details, string costEntityId, CostManagementAlertStatus? status, DateTimeOffset? createdOn, DateTimeOffset? closeOn, DateTimeOffset? modifiedOn, string statusModificationUserName, DateTimeOffset? statusModifiedOn, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Definition = definition; Description = description; @@ -55,6 +60,7 @@ internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceTyp StatusModificationUserName = statusModificationUserName; StatusModifiedOn = statusModifiedOn; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// defines the type of alert. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs index bb132e74f1e8..26faeb6de53e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs @@ -220,7 +220,7 @@ public virtual Response Get(string exportName, str public virtual AsyncPageable GetAllAsync(string expand = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _costManagementExportExportsRestClient.CreateListRequest(Id, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementExportResource(Client, CostManagementExportData.DeserializeCostManagementExportData(e)), _costManagementExportExportsClientDiagnostics, Pipeline, "CostManagementExportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CostManagementExportResource(Client, CostManagementExportData.DeserializeCostManagementExportData(e)), _costManagementExportExportsClientDiagnostics, Pipeline, "CostManagementExportCollection.GetAll", "value", null, cancellationToken); } /// @@ -242,7 +242,7 @@ public virtual AsyncPageable GetAllAsync(string ex public virtual Pageable GetAll(string expand = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _costManagementExportExportsRestClient.CreateListRequest(Id, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementExportResource(Client, CostManagementExportData.DeserializeCostManagementExportData(e)), _costManagementExportExportsClientDiagnostics, Pipeline, "CostManagementExportCollection.GetAll", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CostManagementExportResource(Client, CostManagementExportData.DeserializeCostManagementExportData(e)), _costManagementExportExportsClientDiagnostics, Pipeline, "CostManagementExportCollection.GetAll", "value", null, cancellationToken); } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs index 0ad93eecc1c2..71dedfa00992 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs @@ -20,12 +20,15 @@ namespace Azure.ResourceManager.CostManagement /// public partial class CostManagementExportData : ResourceData { - /// Initializes a new instance of CostManagementExportData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CostManagementExportData() { } - /// Initializes a new instance of CostManagementExportData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +41,8 @@ public CostManagementExportData() /// If the export has an active schedule, provides an estimate of the next run time. /// Has schedule information for the export. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal CostManagementExportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DateTimeOffset? nextRunTimeEstimate, ExportSchedule schedule, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CostManagementExportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DateTimeOffset? nextRunTimeEstimate, ExportSchedule schedule, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Format = format; DeliveryInfo = deliveryInfo; @@ -48,6 +52,7 @@ internal CostManagementExportData(ResourceIdentifier id, string name, ResourceTy NextRunTimeEstimate = nextRunTimeEstimate; Schedule = schedule; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The format of the export being delivered. Currently only 'Csv' is supported. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs index 401f70c05735..30458f45e758 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs @@ -20,14 +20,17 @@ namespace Azure.ResourceManager.CostManagement /// public partial class CostManagementViewData : ResourceData { - /// Initializes a new instance of CostManagementViewData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CostManagementViewData() { Kpis = new ChangeTrackingList(); Pivots = new ChangeTrackingList(); } - /// Initializes a new instance of CostManagementViewData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -49,7 +52,8 @@ public CostManagementViewData() /// Has definition for data in this report config. /// If true, report includes monetary commitment. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, ResourceIdentifier scope, DateTimeOffset? createdOn, DateTimeOffset? modifiedOn, string dateRange, string currency, ViewChartType? chart, AccumulatedType? accumulated, ViewMetricType? metric, IList kpis, IList pivots, ViewReportType? typePropertiesQueryType, ReportTimeframeType? timeframe, ReportConfigTimePeriod timePeriod, ReportConfigDataset dataSet, bool? includeMonetaryCommitment, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, ResourceIdentifier scope, DateTimeOffset? createdOn, DateTimeOffset? modifiedOn, string dateRange, string currency, ViewChartType? chart, AccumulatedType? accumulated, ViewMetricType? metric, IList kpis, IList pivots, ViewReportType? typePropertiesQueryType, ReportTimeframeType? timeframe, ReportConfigTimePeriod timePeriod, ReportConfigDataset dataSet, bool? includeMonetaryCommitment, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Scope = scope; @@ -68,6 +72,7 @@ internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType DataSet = dataSet; IncludeMonetaryCommitment = includeMonetaryCommitment; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// User input name of the view. Required. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs index 4e54499e7a53..e0b316cd38f6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs @@ -218,7 +218,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _costManagementViewsViewsRestClient.CreateListByScopeRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _costManagementViewsViewsRestClient.CreateListByScopeNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CostManagementViewsResource(Client, CostManagementViewData.DeserializeCostManagementViewData(e)), _costManagementViewsViewsClientDiagnostics, Pipeline, "CostManagementViewsCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new CostManagementViewsResource(Client, CostManagementViewData.DeserializeCostManagementViewData(e)), _costManagementViewsViewsClientDiagnostics, Pipeline, "CostManagementViewsCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -240,7 +240,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _costManagementViewsViewsRestClient.CreateListByScopeRequest(Id); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _costManagementViewsViewsRestClient.CreateListByScopeNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CostManagementViewsResource(Client, CostManagementViewData.DeserializeCostManagementViewData(e)), _costManagementViewsViewsClientDiagnostics, Pipeline, "CostManagementViewsCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new CostManagementViewsResource(Client, CostManagementViewData.DeserializeCostManagementViewData(e)), _costManagementViewsViewsClientDiagnostics, Pipeline, "CostManagementViewsCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs index 19274737033d..6d924f763dc7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs @@ -772,7 +772,7 @@ public virtual ArmOperation Generate public virtual AsyncPageable GetCostManagementAlertsAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetCostManagementAlerts", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetCostManagementAlerts", "value", null, cancellationToken); } /// @@ -795,7 +795,7 @@ public virtual AsyncPageable GetCostManagementAlert public virtual Pageable GetCostManagementAlerts(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetCostManagementAlerts", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetCostManagementAlerts", "value", null, cancellationToken); } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.Serialization.cs index 441d9520fc4e..fdf15175ce75 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class AlertPropertiesDefinition : IUtf8JsonSerializable + public partial class AlertPropertiesDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AlertType)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("criteria"u8); writer.WriteStringValue(Criteria.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertPropertiesDefinition DeserializeAlertPropertiesDefinition(JsonElement element) + internal static AlertPropertiesDefinition DeserializeAlertPropertiesDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static AlertPropertiesDefinition DeserializeAlertPropertiesDefinition(J Optional type = default; Optional category = default; Optional criteria = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -71,8 +94,61 @@ internal static AlertPropertiesDefinition DeserializeAlertPropertiesDefinition(J criteria = new AlertCriterion(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AlertPropertiesDefinition(Optional.ToNullable(type), Optional.ToNullable(category), Optional.ToNullable(criteria), serializedAdditionalRawData); + } + + AlertPropertiesDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertPropertiesDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertPropertiesDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertPropertiesDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertPropertiesDefinition model) + { + if (model is null) + { + return null; } - return new AlertPropertiesDefinition(Optional.ToNullable(type), Optional.ToNullable(category), Optional.ToNullable(criteria)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertPropertiesDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertPropertiesDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs index 59c6d4117d64..2e6a34b91f9c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// defines the type of alert. public partial class AlertPropertiesDefinition { - /// Initializes a new instance of AlertPropertiesDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AlertPropertiesDefinition() { } - /// Initializes a new instance of AlertPropertiesDefinition. + /// Initializes a new instance of . /// type of alert. /// Alert category. /// Criteria that triggered alert. - internal AlertPropertiesDefinition(CostManagementAlertType? alertType, CostManagementAlertCategory? category, AlertCriterion? criteria) + /// Keeps track of any properties unknown to the library. + internal AlertPropertiesDefinition(CostManagementAlertType? alertType, CostManagementAlertCategory? category, AlertCriterion? criteria, Dictionary serializedAdditionalRawData) { AlertType = alertType; Category = category; Criteria = criteria; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// type of alert. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.Serialization.cs index a88dcedea1de..9fac87af3c5c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class AlertPropertiesDetails : IUtf8JsonSerializable + public partial class AlertPropertiesDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TimeGrainType)) { @@ -188,11 +194,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("invoicingThreshold"u8); writer.WriteNumberValue(InvoicingThreshold.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AlertPropertiesDetails DeserializeAlertPropertiesDetails(JsonElement element) + internal static AlertPropertiesDetails DeserializeAlertPropertiesDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -219,6 +239,7 @@ internal static AlertPropertiesDetails DeserializeAlertPropertiesDetails(JsonEle Optional enrollmentStartDate = default; Optional enrollmentEndDate = default; Optional invoicingThreshold = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("timeGrainType"u8)) @@ -434,8 +455,61 @@ internal static AlertPropertiesDetails DeserializeAlertPropertiesDetails(JsonEle invoicingThreshold = property.Value.GetDecimal(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AlertPropertiesDetails(Optional.ToNullable(timeGrainType), periodStartDate.Value, triggeredBy.Value, Optional.ToList(resourceGroupFilter), Optional.ToList(resourceFilter), Optional.ToList(meterFilter), tagFilter.Value, Optional.ToNullable(threshold), Optional.ToNullable(@operator), Optional.ToNullable(amount), unit.Value, Optional.ToNullable(currentSpend), Optional.ToList(contactEmails), Optional.ToList(contactGroups), Optional.ToList(contactRoles), overridingAlert.Value, departmentName.Value, companyName.Value, enrollmentNumber.Value, enrollmentStartDate.Value, enrollmentEndDate.Value, Optional.ToNullable(invoicingThreshold)); + return new AlertPropertiesDetails(Optional.ToNullable(timeGrainType), periodStartDate.Value, triggeredBy.Value, Optional.ToList(resourceGroupFilter), Optional.ToList(resourceFilter), Optional.ToList(meterFilter), tagFilter.Value, Optional.ToNullable(threshold), Optional.ToNullable(@operator), Optional.ToNullable(amount), unit.Value, Optional.ToNullable(currentSpend), Optional.ToList(contactEmails), Optional.ToList(contactGroups), Optional.ToList(contactRoles), overridingAlert.Value, departmentName.Value, companyName.Value, enrollmentNumber.Value, enrollmentStartDate.Value, enrollmentEndDate.Value, Optional.ToNullable(invoicingThreshold), serializedAdditionalRawData); + } + + AlertPropertiesDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertPropertiesDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertPropertiesDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertPropertiesDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertPropertiesDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertPropertiesDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertPropertiesDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs index 1f1d295e5cd9..755ef5d56f94 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// Alert details. public partial class AlertPropertiesDetails { - /// Initializes a new instance of AlertPropertiesDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AlertPropertiesDetails() { ResourceGroupFilter = new ChangeTrackingList(); @@ -25,7 +28,7 @@ public AlertPropertiesDetails() ContactRoles = new ChangeTrackingList(); } - /// Initializes a new instance of AlertPropertiesDetails. + /// Initializes a new instance of . /// Type of timegrain cadence. /// datetime of periodStartDate. /// notificationId that triggered this alert. @@ -48,7 +51,8 @@ public AlertPropertiesDetails() /// datetime of enrollmentStartDate. /// datetime of enrollmentEndDate. /// invoicing threshold. - internal AlertPropertiesDetails(AlertTimeGrainType? timeGrainType, string periodStartDate, string triggeredBy, IList resourceGroupFilter, IList resourceFilter, IList meterFilter, BinaryData tagFilter, decimal? threshold, CostManagementAlertOperator? @operator, decimal? amount, string unit, decimal? currentSpend, IList contactEmails, IList contactGroups, IList contactRoles, string overridingAlert, string departmentName, string companyName, string enrollmentNumber, string enrollmentStartDate, string enrollmentEndDate, decimal? invoicingThreshold) + /// Keeps track of any properties unknown to the library. + internal AlertPropertiesDetails(AlertTimeGrainType? timeGrainType, string periodStartDate, string triggeredBy, IList resourceGroupFilter, IList resourceFilter, IList meterFilter, BinaryData tagFilter, decimal? threshold, CostManagementAlertOperator? @operator, decimal? amount, string unit, decimal? currentSpend, IList contactEmails, IList contactGroups, IList contactRoles, string overridingAlert, string departmentName, string companyName, string enrollmentNumber, string enrollmentStartDate, string enrollmentEndDate, decimal? invoicingThreshold, Dictionary serializedAdditionalRawData) { TimeGrainType = timeGrainType; PeriodStartDate = periodStartDate; @@ -72,6 +76,7 @@ internal AlertPropertiesDetails(AlertTimeGrainType? timeGrainType, string period EnrollmentStartDate = enrollmentStartDate; EnrollmentEndDate = enrollmentEndDate; InvoicingThreshold = invoicingThreshold; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of timegrain cadence. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.Serialization.cs index bbc82eae4971..5e9e070e3833 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.Serialization.cs @@ -5,21 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class AllSavingsBenefitDetails : IUtf8JsonSerializable + public partial class AllSavingsBenefitDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AllSavingsBenefitDetails DeserializeAllSavingsBenefitDetails(JsonElement element) + internal static AllSavingsBenefitDetails DeserializeAllSavingsBenefitDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static AllSavingsBenefitDetails DeserializeAllSavingsBenefitDetails(Jso Optional commitmentAmount = default; Optional averageUtilizationPercentage = default; Optional wastageCost = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("overageCost"u8)) @@ -116,8 +139,61 @@ internal static AllSavingsBenefitDetails DeserializeAllSavingsBenefitDetails(Jso wastageCost = property.Value.GetDecimal(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AllSavingsBenefitDetails(Optional.ToNullable(overageCost), Optional.ToNullable(benefitCost), Optional.ToNullable(totalCost), Optional.ToNullable(savingsAmount), Optional.ToNullable(savingsPercentage), Optional.ToNullable(coveragePercentage), Optional.ToNullable(commitmentAmount), Optional.ToNullable(averageUtilizationPercentage), Optional.ToNullable(wastageCost), serializedAdditionalRawData); + } + + AllSavingsBenefitDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAllSavingsBenefitDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AllSavingsBenefitDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAllSavingsBenefitDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AllSavingsBenefitDetails model) + { + if (model is null) + { + return null; } - return new AllSavingsBenefitDetails(Optional.ToNullable(overageCost), Optional.ToNullable(benefitCost), Optional.ToNullable(totalCost), Optional.ToNullable(savingsAmount), Optional.ToNullable(savingsPercentage), Optional.ToNullable(coveragePercentage), Optional.ToNullable(commitmentAmount), Optional.ToNullable(averageUtilizationPercentage), Optional.ToNullable(wastageCost)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AllSavingsBenefitDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAllSavingsBenefitDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.cs index 0c09a961c5bc..8becfcd68bea 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsBenefitDetails.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// Benefit recommendation details. public partial class AllSavingsBenefitDetails { - /// Initializes a new instance of AllSavingsBenefitDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AllSavingsBenefitDetails() { } - /// Initializes a new instance of AllSavingsBenefitDetails. + /// Initializes a new instance of . /// The difference between total cost and benefit cost for the 'totalHours' in the look-back period. /// The estimated cost with benefit for the 'totalHours' in the look-back period. It's equal to (commitmentAmount * totalHours). /// Total cost, which is sum of benefit cost and overage cost. @@ -25,7 +31,8 @@ public AllSavingsBenefitDetails() /// The commitment amount at the commitmentGranularity. /// Estimated average utilization percentage for the 'totalHours' in the look-back period, with this commitment. /// Estimated unused portion of the 'benefitCost'. - internal AllSavingsBenefitDetails(decimal? overageCost, decimal? benefitCost, decimal? totalCost, decimal? savingsAmount, decimal? savingsPercentage, decimal? coveragePercentage, decimal? commitmentAmount, decimal? averageUtilizationPercentage, decimal? wastageCost) + /// Keeps track of any properties unknown to the library. + internal AllSavingsBenefitDetails(decimal? overageCost, decimal? benefitCost, decimal? totalCost, decimal? savingsAmount, decimal? savingsPercentage, decimal? coveragePercentage, decimal? commitmentAmount, decimal? averageUtilizationPercentage, decimal? wastageCost, Dictionary serializedAdditionalRawData) { OverageCost = overageCost; BenefitCost = benefitCost; @@ -36,6 +43,7 @@ internal AllSavingsBenefitDetails(decimal? overageCost, decimal? benefitCost, de CommitmentAmount = commitmentAmount; AverageUtilizationPercentage = averageUtilizationPercentage; WastageCost = wastageCost; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The difference between total cost and benefit cost for the 'totalHours' in the look-back period. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.Serialization.cs index 4bd31ccb4ff2..542af7a8250d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.Serialization.cs @@ -8,20 +8,47 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class AllSavingsList + public partial class AllSavingsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AllSavingsList DeserializeAllSavingsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AllSavingsList DeserializeAllSavingsList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -47,8 +74,61 @@ internal static AllSavingsList DeserializeAllSavingsList(JsonElement element) nextLink = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AllSavingsList(Optional.ToList(value), nextLink.Value); + return new AllSavingsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AllSavingsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAllSavingsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AllSavingsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAllSavingsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AllSavingsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AllSavingsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAllSavingsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.cs index 902ffb4ae075..8167bf3c9b6c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AllSavingsList.cs @@ -14,19 +14,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// The list of all benefit recommendations with the recommendation details. public partial class AllSavingsList { - /// Initializes a new instance of AllSavingsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AllSavingsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AllSavingsList. + /// Initializes a new instance of . /// The list of benefit recommendations with the recommendation details.. /// The link (URL) to the next page of results. - internal AllSavingsList(IReadOnlyList value, Uri nextLink) + /// Keeps track of any properties unknown to the library. + internal AllSavingsList(IReadOnlyList value, Uri nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of benefit recommendations with the recommendation details.. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.Serialization.cs index a3ef5e6649c8..e0304f024c57 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class AsyncOperationStatusProperties + public partial class AsyncOperationStatusProperties : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AsyncOperationStatusProperties DeserializeAsyncOperationStatusProperties(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ReportUri)) + { + writer.WritePropertyName("reportUrl"u8); + writer.WriteStringValue(ReportUri.Value.ToString()); + } + if (Optional.IsDefined(SecondaryReportUri)) + { + writer.WritePropertyName("secondaryReportUrl"u8); + writer.WriteStringValue(SecondaryReportUri.Value.ToString()); + } + if (Optional.IsDefined(ValidUntil)) + { + writer.WritePropertyName("validUntil"u8); + writer.WriteStringValue(ValidUntil.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AsyncOperationStatusProperties DeserializeAsyncOperationStatusProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static AsyncOperationStatusProperties DeserializeAsyncOperationStatusPr Optional reportUrl = default; Optional secondaryReportUrl = default; Optional validUntil = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("reportUrl"u8)) @@ -51,8 +94,61 @@ internal static AsyncOperationStatusProperties DeserializeAsyncOperationStatusPr validUntil = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AsyncOperationStatusProperties(Optional.ToNullable(reportUrl), Optional.ToNullable(secondaryReportUrl), Optional.ToNullable(validUntil)); + return new AsyncOperationStatusProperties(Optional.ToNullable(reportUrl), Optional.ToNullable(secondaryReportUrl), Optional.ToNullable(validUntil), serializedAdditionalRawData); + } + + AsyncOperationStatusProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAsyncOperationStatusProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AsyncOperationStatusProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAsyncOperationStatusProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AsyncOperationStatusProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AsyncOperationStatusProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAsyncOperationStatusProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.cs index de58ebdfa293..6dd1acd0d916 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AsyncOperationStatusProperties.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// Object representing the report url and valid until date of the async report generated. public partial class AsyncOperationStatusProperties { - /// Initializes a new instance of AsyncOperationStatusProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AsyncOperationStatusProperties() { } - /// Initializes a new instance of AsyncOperationStatusProperties. + /// Initializes a new instance of . /// Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. /// Sas url to async benefit utilization summaries report in secondary storage in case of primary outage. Will be empty if the report is in Running or Failed state. /// The date that the sas url provided in reportUrl expires. - internal AsyncOperationStatusProperties(BenefitUtilizationSummaryReportSchema? reportUri, BenefitUtilizationSummaryReportSchema? secondaryReportUri, DateTimeOffset? validUntil) + /// Keeps track of any properties unknown to the library. + internal AsyncOperationStatusProperties(BenefitUtilizationSummaryReportSchema? reportUri, BenefitUtilizationSummaryReportSchema? secondaryReportUri, DateTimeOffset? validUntil, Dictionary serializedAdditionalRawData) { ReportUri = reportUri; SecondaryReportUri = secondaryReportUri; ValidUntil = validUntil; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.Serialization.cs index bfd8819a3dd0..a68d58cf2ff3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.Serialization.cs @@ -5,32 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class BenefitRecommendationModel : IUtf8JsonSerializable + public partial class BenefitRecommendationModel : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Kind)) { writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BenefitRecommendationModel DeserializeBenefitRecommendationModel(JsonElement element) + internal static BenefitRecommendationModel DeserializeBenefitRecommendationModel(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -41,6 +70,7 @@ internal static BenefitRecommendationModel DeserializeBenefitRecommendationModel string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -85,8 +115,61 @@ internal static BenefitRecommendationModel DeserializeBenefitRecommendationModel systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BenefitRecommendationModel(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(kind), serializedAdditionalRawData); + } + + BenefitRecommendationModel IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitRecommendationModel(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitRecommendationModel IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitRecommendationModel(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitRecommendationModel model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitRecommendationModel(Response response) + { + if (response is null) + { + return null; } - return new BenefitRecommendationModel(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(kind)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitRecommendationModel(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.cs index 7523ab0b09e0..55b02ecdc149 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationModel.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,12 +15,15 @@ namespace Azure.ResourceManager.CostManagement.Models /// benefit plan recommendation details. public partial class BenefitRecommendationModel : ResourceData { - /// Initializes a new instance of BenefitRecommendationModel. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BenefitRecommendationModel() { } - /// Initializes a new instance of BenefitRecommendationModel. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -29,10 +34,12 @@ public BenefitRecommendationModel() /// The available derived classes include and . /// /// Reservation or SavingsPlan. - internal BenefitRecommendationModel(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BenefitRecommendationProperties properties, BillingAccountBenefitKind? kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BenefitRecommendationModel(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BenefitRecommendationProperties properties, BillingAccountBenefitKind? kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.Serialization.cs index 86f7b2265b44..3c85211e6a58 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class BenefitRecommendationProperties : IUtf8JsonSerializable + public partial class BenefitRecommendationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LookBackPeriod)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Usage)) { writer.WritePropertyName("usage"u8); - writer.WriteObjectValue(Usage); + if (Usage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Usage).Serialize(writer, options); + } } if (Optional.IsDefined(Term)) { @@ -38,15 +53,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RecommendationDetails)) { writer.WritePropertyName("recommendationDetails"u8); - writer.WriteObjectValue(RecommendationDetails); + if (RecommendationDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RecommendationDetails).Serialize(writer, options); + } } writer.WritePropertyName("scope"u8); writer.WriteStringValue(Scope.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BenefitRecommendationProperties DeserializeBenefitRecommendationProperties(JsonElement element) + internal static BenefitRecommendationProperties DeserializeBenefitRecommendationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,7 +95,184 @@ internal static BenefitRecommendationProperties DeserializeBenefitRecommendation case "Single": return SingleScopeBenefitRecommendationProperties.DeserializeSingleScopeBenefitRecommendationProperties(element); } } - return UnknownBenefitRecommendationProperties.DeserializeUnknownBenefitRecommendationProperties(element); + + // Unknown type found so we will deserialize the base properties only + Optional firstConsumptionDate = default; + Optional lastConsumptionDate = default; + Optional lookBackPeriod = default; + Optional totalHours = default; + Optional usage = default; + Optional armSkuName = default; + Optional term = default; + Optional commitmentGranularity = default; + Optional currencyCode = default; + Optional costWithoutBenefit = default; + Optional recommendationDetails = default; + Optional allRecommendationDetails = default; + BenefitRecommendationScope scope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("firstConsumptionDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstConsumptionDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastConsumptionDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastConsumptionDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lookBackPeriod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lookBackPeriod = new LookBackPeriod(property.Value.GetString()); + continue; + } + if (property.NameEquals("totalHours"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalHours = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("usage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usage = RecommendationUsageDetails.DeserializeRecommendationUsageDetails(property.Value); + continue; + } + if (property.NameEquals("armSkuName"u8)) + { + armSkuName = property.Value.GetString(); + continue; + } + if (property.NameEquals("term"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + term = new BenefitRecommendationPeriodTerm(property.Value.GetString()); + continue; + } + if (property.NameEquals("commitmentGranularity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + commitmentGranularity = new BenefitRecommendationUsageGrain(property.Value.GetString()); + continue; + } + if (property.NameEquals("currencyCode"u8)) + { + currencyCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("costWithoutBenefit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + costWithoutBenefit = property.Value.GetDecimal(); + continue; + } + if (property.NameEquals("recommendationDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recommendationDetails = AllSavingsBenefitDetails.DeserializeAllSavingsBenefitDetails(property.Value); + continue; + } + if (property.NameEquals("allRecommendationDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allRecommendationDetails = AllSavingsList.DeserializeAllSavingsList(property.Value); + continue; + } + if (property.NameEquals("scope"u8)) + { + scope = new BenefitRecommendationScope(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownBenefitRecommendationProperties(Optional.ToNullable(firstConsumptionDate), Optional.ToNullable(lastConsumptionDate), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(totalHours), usage.Value, armSkuName.Value, Optional.ToNullable(term), Optional.ToNullable(commitmentGranularity), currencyCode.Value, Optional.ToNullable(costWithoutBenefit), recommendationDetails.Value, allRecommendationDetails.Value, scope, serializedAdditionalRawData); + } + + BenefitRecommendationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitRecommendationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitRecommendationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitRecommendationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitRecommendationProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitRecommendationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitRecommendationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.cs index 6ef8f167d5d7..f69d150167e7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationProperties.cs @@ -6,6 +6,8 @@ #nullable disable using System; +using System.Collections.Generic; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { @@ -14,14 +16,18 @@ namespace Azure.ResourceManager.CostManagement.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownBenefitRecommendationProperties))] public abstract partial class BenefitRecommendationProperties { - /// Initializes a new instance of BenefitRecommendationProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected BenefitRecommendationProperties() { } - /// Initializes a new instance of BenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -35,7 +41,8 @@ protected BenefitRecommendationProperties() /// The details of the proposed recommendation. /// The list of all benefit recommendations with the recommendation details. /// Benefit scope. For example, Single or Shared. - internal BenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope) + /// Keeps track of any properties unknown to the library. + internal BenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope, Dictionary serializedAdditionalRawData) { FirstConsumptionOn = firstConsumptionOn; LastConsumptionOn = lastConsumptionOn; @@ -50,6 +57,7 @@ internal BenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, Dat RecommendationDetails = recommendationDetails; AllRecommendationDetails = allRecommendationDetails; Scope = scope; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The first usage date used for looking back for computing the recommendations. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs index a91b0e2b659b..9c536dc882a4 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs @@ -8,20 +8,47 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class BenefitRecommendationsListResult + internal partial class BenefitRecommendationsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BenefitRecommendationsListResult DeserializeBenefitRecommendationsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BenefitRecommendationsListResult DeserializeBenefitRecommendationsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -47,8 +74,61 @@ internal static BenefitRecommendationsListResult DeserializeBenefitRecommendatio nextLink = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BenefitRecommendationsListResult(Optional.ToList(value), nextLink.Value); + return new BenefitRecommendationsListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BenefitRecommendationsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitRecommendationsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitRecommendationsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitRecommendationsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitRecommendationsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitRecommendationsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitRecommendationsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs index 11d247dd7968..9930df36eecd 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs @@ -14,19 +14,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of listing benefit recommendations. internal partial class BenefitRecommendationsListResult { - /// Initializes a new instance of BenefitRecommendationsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BenefitRecommendationsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BenefitRecommendationsListResult. + /// Initializes a new instance of . /// The list of benefit recommendations. /// The link (URL) to the next page of results. - internal BenefitRecommendationsListResult(IReadOnlyList value, Uri nextLink) + /// Keeps track of any properties unknown to the library. + internal BenefitRecommendationsListResult(IReadOnlyList value, Uri nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of benefit recommendations. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.Serialization.cs index 5549443f6d0e..8406fe6fb0c2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class BenefitUtilizationSummariesContent : IUtf8JsonSerializable + public partial class BenefitUtilizationSummariesContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BillingAccountId)) { @@ -47,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BenefitUtilizationSummariesContent DeserializeBenefitUtilizationSummariesContent(JsonElement element) + internal static BenefitUtilizationSummariesContent DeserializeBenefitUtilizationSummariesContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +85,7 @@ internal static BenefitUtilizationSummariesContent DeserializeBenefitUtilization DateTimeOffset startDate = default; DateTimeOffset endDate = default; Optional kind = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("billingAccountId"u8)) @@ -110,8 +132,61 @@ internal static BenefitUtilizationSummariesContent DeserializeBenefitUtilization kind = new BillingAccountBenefitKind(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BenefitUtilizationSummariesContent(billingAccountId.Value, billingProfileId.Value, benefitOrderId.Value, benefitId.Value, grain, startDate, endDate, Optional.ToNullable(kind), serializedAdditionalRawData); + } + + BenefitUtilizationSummariesContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitUtilizationSummariesContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitUtilizationSummariesContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitUtilizationSummariesContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitUtilizationSummariesContent model) + { + if (model is null) + { + return null; } - return new BenefitUtilizationSummariesContent(billingAccountId.Value, billingProfileId.Value, benefitOrderId.Value, benefitId.Value, grain, startDate, endDate, Optional.ToNullable(kind)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitUtilizationSummariesContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitUtilizationSummariesContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.cs index 65dfada1b2a4..b9d0d61d4b89 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesContent.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// Properties of an async benefit utilization summaries request. public partial class BenefitUtilizationSummariesContent { - /// Initializes a new instance of BenefitUtilizationSummariesContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The grain the summaries data is served at in the report. Accepted values are 'Daily' or 'Monthly'. /// The start date of the summaries data that will be served in the report. /// The end date of the summaries data that will be served in the report. @@ -23,7 +27,7 @@ public BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain grain, EndOn = endOn; } - /// Initializes a new instance of BenefitUtilizationSummariesContent. + /// Initializes a new instance of . /// Billing account the benefit utilization summaries report is for. Required for billing account and billing profile scopes. Not supported for any benefit scopes. /// Billing profile id the benefit utilization summaries report is for. Required for billing profile scope. Not supported for billing account or any benefit scopes. /// Benefit order id the benefit utilization summaries report is for. Required for benefit order and benefit id scopes. Not supported for any billing scopes. @@ -32,7 +36,8 @@ public BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain grain, /// The start date of the summaries data that will be served in the report. /// The end date of the summaries data that will be served in the report. /// The type of benefit data requested. Required for billing account and billing profile scopes. Implied and not to be passed at benefit scopes. Supported values are Reservation and SavingsPlan. - internal BenefitUtilizationSummariesContent(string billingAccountId, string billingProfileId, string benefitOrderId, string benefitId, BenefitRecommendationUsageGrain grain, DateTimeOffset startOn, DateTimeOffset endOn, BillingAccountBenefitKind? kind) + /// Keeps track of any properties unknown to the library. + internal BenefitUtilizationSummariesContent(string billingAccountId, string billingProfileId, string benefitOrderId, string benefitId, BenefitRecommendationUsageGrain grain, DateTimeOffset startOn, DateTimeOffset endOn, BillingAccountBenefitKind? kind, Dictionary serializedAdditionalRawData) { BillingAccountId = billingAccountId; BillingProfileId = billingProfileId; @@ -42,6 +47,12 @@ internal BenefitUtilizationSummariesContent(string billingAccountId, string bill StartOn = startOn; EndOn = endOn; Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BenefitUtilizationSummariesContent() + { } /// Billing account the benefit utilization summaries report is for. Required for billing account and billing profile scopes. Not supported for any benefit scopes. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs index 7ce9a9f2e827..efc9ada14af0 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs @@ -8,20 +8,47 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class BenefitUtilizationSummariesListResult + internal partial class BenefitUtilizationSummariesListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BenefitUtilizationSummariesListResult DeserializeBenefitUtilizationSummariesListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BenefitUtilizationSummariesListResult DeserializeBenefitUtilizationSummariesListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -47,8 +74,61 @@ internal static BenefitUtilizationSummariesListResult DeserializeBenefitUtilizat nextLink = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BenefitUtilizationSummariesListResult(Optional.ToList(value), nextLink.Value); + return new BenefitUtilizationSummariesListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BenefitUtilizationSummariesListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitUtilizationSummariesListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitUtilizationSummariesListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitUtilizationSummariesListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitUtilizationSummariesListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitUtilizationSummariesListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitUtilizationSummariesListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs index 9201c27789a2..d259dd54e424 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs @@ -14,23 +14,28 @@ namespace Azure.ResourceManager.CostManagement.Models /// List of benefit utilization summaries. internal partial class BenefitUtilizationSummariesListResult { - /// Initializes a new instance of BenefitUtilizationSummariesListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BenefitUtilizationSummariesListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BenefitUtilizationSummariesListResult. + /// Initializes a new instance of . /// /// The list of benefit utilization summaries. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// /// The link (URL) to the next page of results. - internal BenefitUtilizationSummariesListResult(IReadOnlyList value, Uri nextLink) + /// Keeps track of any properties unknown to the library. + internal BenefitUtilizationSummariesListResult(IReadOnlyList value, Uri nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.Serialization.cs index 6ec281a12e0c..758611c3a503 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.Serialization.cs @@ -5,15 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class BenefitUtilizationSummariesOperationStatus + public partial class BenefitUtilizationSummariesOperationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BenefitUtilizationSummariesOperationStatus DeserializeBenefitUtilizationSummariesOperationStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Input)) + { + writer.WritePropertyName("input"u8); + if (Input is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Input).Serialize(writer, options); + } + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BenefitUtilizationSummariesOperationStatus DeserializeBenefitUtilizationSummariesOperationStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +78,7 @@ internal static BenefitUtilizationSummariesOperationStatus DeserializeBenefitUti Optional input = default; Optional status = default; Optional properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("input"u8)) @@ -50,8 +108,61 @@ internal static BenefitUtilizationSummariesOperationStatus DeserializeBenefitUti properties = AsyncOperationStatusProperties.DeserializeAsyncOperationStatusProperties(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BenefitUtilizationSummariesOperationStatus(input.Value, Optional.ToNullable(status), properties.Value); + return new BenefitUtilizationSummariesOperationStatus(input.Value, Optional.ToNullable(status), properties.Value, serializedAdditionalRawData); + } + + BenefitUtilizationSummariesOperationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitUtilizationSummariesOperationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitUtilizationSummariesOperationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitUtilizationSummariesOperationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitUtilizationSummariesOperationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitUtilizationSummariesOperationStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitUtilizationSummariesOperationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.cs index 2046892046dc..f1741b3c76ea 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesOperationStatus.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// Status of a benefit utilization summaries report. Provides Async Benefit Utilization Summaries Request input, status, and report sas url. public partial class BenefitUtilizationSummariesOperationStatus { - /// Initializes a new instance of BenefitUtilizationSummariesOperationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BenefitUtilizationSummariesOperationStatus() { } - /// Initializes a new instance of BenefitUtilizationSummariesOperationStatus. + /// Initializes a new instance of . /// Input given to create the benefit utilization summaries report. /// The status of the creation of the benefit utilization summaries report. /// Contains sas url to the async benefit utilization summaries report and a date that the url is valid until. These values will be empty if the report is in a Running or Failed state. - internal BenefitUtilizationSummariesOperationStatus(BenefitUtilizationSummariesContent input, OperationStatusType? status, AsyncOperationStatusProperties properties) + /// Keeps track of any properties unknown to the library. + internal BenefitUtilizationSummariesOperationStatus(BenefitUtilizationSummariesContent input, OperationStatusType? status, AsyncOperationStatusProperties properties, Dictionary serializedAdditionalRawData) { Input = input; Status = status; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Input given to create the benefit utilization summaries report. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.Serialization.cs index 9a625d63ca8c..c085ef331d3d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.Serialization.cs @@ -5,24 +5,46 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class BenefitUtilizationSummary : IUtf8JsonSerializable + public partial class BenefitUtilizationSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BenefitUtilizationSummary DeserializeBenefitUtilizationSummary(JsonElement element) + internal static BenefitUtilizationSummary DeserializeBenefitUtilizationSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,11 +57,14 @@ internal static BenefitUtilizationSummary DeserializeBenefitUtilizationSummary(J case "SavingsPlan": return SavingsPlanUtilizationSummary.DeserializeSavingsPlanUtilizationSummary(element); } } + + // Unknown type found so we will deserialize the base properties only BillingAccountBenefitKind kind = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -71,8 +96,61 @@ internal static BenefitUtilizationSummary DeserializeBenefitUtilizationSummary(J systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BenefitUtilizationSummary(id, name, type, systemData.Value, kind); + return new BenefitUtilizationSummary(id, name, type, systemData.Value, kind, serializedAdditionalRawData); + } + + BenefitUtilizationSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBenefitUtilizationSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitUtilizationSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitUtilizationSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BenefitUtilizationSummary model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BenefitUtilizationSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBenefitUtilizationSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.cs index 1e596edf7ba4..e2934a511398 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummary.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.CostManagement.Models /// public partial class BenefitUtilizationSummary : ResourceData { - /// Initializes a new instance of BenefitUtilizationSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BenefitUtilizationSummary() { } - /// Initializes a new instance of BenefitUtilizationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Supported values: 'SavingsPlan'. - internal BenefitUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BenefitUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Supported values: 'SavingsPlan'. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs index c93728c20909..22225065ecb2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class CommonExportProperties : IUtf8JsonSerializable + public partial class CommonExportProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Format)) { @@ -22,24 +29,59 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Format.Value.ToString()); } writer.WritePropertyName("deliveryInfo"u8); - writer.WriteObjectValue(DeliveryInfo); + if (DeliveryInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeliveryInfo).Serialize(writer, options); + } writer.WritePropertyName("definition"u8); - writer.WriteObjectValue(Definition); + if (Definition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Definition).Serialize(writer, options); + } if (Optional.IsDefined(RunHistory)) { writer.WritePropertyName("runHistory"u8); - writer.WriteObjectValue(RunHistory); + if (RunHistory is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RunHistory).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionData)) { writer.WritePropertyName("partitionData"u8); writer.WriteBooleanValue(PartitionData.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CommonExportProperties DeserializeCommonExportProperties(JsonElement element) + internal static CommonExportProperties DeserializeCommonExportProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -50,6 +92,7 @@ internal static CommonExportProperties DeserializeCommonExportProperties(JsonEle Optional runHistory = default; Optional partitionData = default; Optional nextRunTimeEstimate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("format"u8)) @@ -98,8 +141,61 @@ internal static CommonExportProperties DeserializeCommonExportProperties(JsonEle nextRunTimeEstimate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CommonExportProperties(Optional.ToNullable(format), deliveryInfo, definition, runHistory.Value, Optional.ToNullable(partitionData), Optional.ToNullable(nextRunTimeEstimate), serializedAdditionalRawData); + } + + CommonExportProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommonExportProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommonExportProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommonExportProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommonExportProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommonExportProperties(Response response) + { + if (response is null) + { + return null; } - return new CommonExportProperties(Optional.ToNullable(format), deliveryInfo, definition, runHistory.Value, Optional.ToNullable(partitionData), Optional.ToNullable(nextRunTimeEstimate)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommonExportProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs index 17a3c16b8f6c..d08f809fb0ae 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The common properties of the export. public partial class CommonExportProperties { - /// Initializes a new instance of CommonExportProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Has delivery information for the export. /// Has the definition for the export. /// or is null. @@ -27,14 +30,15 @@ public CommonExportProperties(ExportDeliveryInfo deliveryInfo, ExportDefinition Definition = definition; } - /// Initializes a new instance of CommonExportProperties. + /// Initializes a new instance of . /// The format of the export being delivered. Currently only 'Csv' is supported. /// Has delivery information for the export. /// Has the definition for the export. /// If requested, has the most recent run history for the export. /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. /// If the export has an active schedule, provides an estimate of the next run time. - internal CommonExportProperties(ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DateTimeOffset? nextRunTimeEstimate) + /// Keeps track of any properties unknown to the library. + internal CommonExportProperties(ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DateTimeOffset? nextRunTimeEstimate, Dictionary serializedAdditionalRawData) { Format = format; DeliveryInfo = deliveryInfo; @@ -42,6 +46,12 @@ internal CommonExportProperties(ExportFormatType? format, ExportDeliveryInfo del RunHistory = runHistory; PartitionData = partitionData; NextRunTimeEstimate = nextRunTimeEstimate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CommonExportProperties() + { } /// The format of the export being delivered. Currently only 'Csv' is supported. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertData.Serialization.cs index e0dbbcc1cf99..a9a7fb4939ea 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertData.Serialization.cs @@ -6,18 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement { - public partial class CostManagementAlertData : IUtf8JsonSerializable + public partial class CostManagementAlertData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -29,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Definition)) { writer.WritePropertyName("definition"u8); - writer.WriteObjectValue(Definition); + if (Definition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Definition).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -44,7 +57,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Details)) { writer.WritePropertyName("details"u8); - writer.WriteObjectValue(Details); + if (Details is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Details).Serialize(writer, options); + } } if (Optional.IsDefined(CostEntityId)) { @@ -82,7 +102,235 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StatusModifiedOn.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CostManagementAlertData DeserializeCostManagementAlertData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eTag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional definition = default; + Optional description = default; + Optional source = default; + Optional details = default; + Optional costEntityId = default; + Optional status = default; + Optional creationTime = default; + Optional closeTime = default; + Optional modificationTime = default; + Optional statusModificationUserName = default; + Optional statusModificationTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("definition"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + definition = AlertPropertiesDefinition.DeserializeAlertPropertiesDefinition(property0.Value); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("source"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = new CostManagementAlertSource(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("details"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + details = AlertPropertiesDetails.DeserializeAlertPropertiesDetails(property0.Value); + continue; + } + if (property0.NameEquals("costEntityId"u8)) + { + costEntityId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new CostManagementAlertStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("creationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property0.Value.GetDateTimeOffset(); + continue; + } + if (property0.NameEquals("closeTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + closeTime = property0.Value.GetDateTimeOffset(); + continue; + } + if (property0.NameEquals("modificationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modificationTime = property0.Value.GetDateTimeOffset(); + continue; + } + if (property0.NameEquals("statusModificationUserName"u8)) + { + statusModificationUserName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("statusModificationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statusModificationTime = property0.Value.GetDateTimeOffset(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CostManagementAlertData(id, name, type, systemData.Value, definition.Value, description.Value, Optional.ToNullable(source), details.Value, costEntityId.Value, Optional.ToNullable(status), Optional.ToNullable(creationTime), Optional.ToNullable(closeTime), Optional.ToNullable(modificationTime), statusModificationUserName.Value, Optional.ToNullable(statusModificationTime), Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + CostManagementAlertData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementAlertData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementAlertData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementAlertData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementAlertData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementAlertData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementAlertData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.Serialization.cs index 42e16f8331aa..ce3ac29ff108 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class CostManagementAlertPatch : IUtf8JsonSerializable + public partial class CostManagementAlertPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Definition)) { writer.WritePropertyName("definition"u8); - writer.WriteObjectValue(Definition); + if (Definition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Definition).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -35,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Details)) { writer.WritePropertyName("details"u8); - writer.WriteObjectValue(Details); + if (Details is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Details).Serialize(writer, options); + } } if (Optional.IsDefined(CostEntityId)) { @@ -73,7 +95,197 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StatusModifiedOn.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CostManagementAlertPatch DeserializeCostManagementAlertPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional definition = default; + Optional description = default; + Optional source = default; + Optional details = default; + Optional costEntityId = default; + Optional status = default; + Optional creationTime = default; + Optional closeTime = default; + Optional modificationTime = default; + Optional statusModificationUserName = default; + Optional statusModificationTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("definition"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + definition = AlertPropertiesDefinition.DeserializeAlertPropertiesDefinition(property0.Value); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("source"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = new CostManagementAlertSource(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("details"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + details = AlertPropertiesDetails.DeserializeAlertPropertiesDetails(property0.Value); + continue; + } + if (property0.NameEquals("costEntityId"u8)) + { + costEntityId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new CostManagementAlertStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("creationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property0.Value.GetDateTimeOffset(); + continue; + } + if (property0.NameEquals("closeTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + closeTime = property0.Value.GetDateTimeOffset(); + continue; + } + if (property0.NameEquals("modificationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modificationTime = property0.Value.GetDateTimeOffset(); + continue; + } + if (property0.NameEquals("statusModificationUserName"u8)) + { + statusModificationUserName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("statusModificationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statusModificationTime = property0.Value.GetDateTimeOffset(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CostManagementAlertPatch(definition.Value, description.Value, Optional.ToNullable(source), details.Value, costEntityId.Value, Optional.ToNullable(status), Optional.ToNullable(creationTime), Optional.ToNullable(closeTime), Optional.ToNullable(modificationTime), statusModificationUserName.Value, Optional.ToNullable(statusModificationTime), serializedAdditionalRawData); + } + + CostManagementAlertPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementAlertPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementAlertPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementAlertPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementAlertPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementAlertPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementAlertPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.cs index f68523fa7f9e..72c6248411ae 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertPatch.cs @@ -6,17 +6,50 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The request payload to update an alert. public partial class CostManagementAlertPatch { - /// Initializes a new instance of CostManagementAlertPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CostManagementAlertPatch() { } + /// Initializes a new instance of . + /// defines the type of alert. + /// Alert description. + /// Source of alert. + /// Alert details. + /// related budget. + /// alert status. + /// dateTime in which alert was created. + /// dateTime in which alert was closed. + /// dateTime in which alert was last modified. + /// User who last modified the alert. + /// dateTime in which the alert status was last modified. + /// Keeps track of any properties unknown to the library. + internal CostManagementAlertPatch(AlertPropertiesDefinition definition, string description, CostManagementAlertSource? source, AlertPropertiesDetails details, string costEntityId, CostManagementAlertStatus? status, DateTimeOffset? createdOn, DateTimeOffset? closeOn, DateTimeOffset? modifiedOn, string statusModificationUserName, DateTimeOffset? statusModifiedOn, Dictionary serializedAdditionalRawData) + { + Definition = definition; + Description = description; + Source = source; + Details = details; + CostEntityId = costEntityId; + Status = status; + CreatedOn = createdOn; + CloseOn = closeOn; + ModifiedOn = modifiedOn; + StatusModificationUserName = statusModificationUserName; + StatusModifiedOn = statusModifiedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// defines the type of alert. public AlertPropertiesDefinition Definition { get; set; } /// Alert description. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.Serialization.cs index d28af17862b6..f038bfbb6034 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class CostManagementAlertsResult + internal partial class CostManagementAlertsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CostManagementAlertsResult DeserializeCostManagementAlertsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CostManagementAlertsResult DeserializeCostManagementAlertsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static CostManagementAlertsResult DeserializeCostManagementAlertsResult nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CostManagementAlertsResult(Optional.ToList(value), nextLink.Value); + return new CostManagementAlertsResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + CostManagementAlertsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementAlertsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementAlertsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementAlertsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementAlertsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementAlertsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementAlertsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.cs index e8c008e605ee..2841b8f0266a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementAlertsResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CostManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of alerts. internal partial class CostManagementAlertsResult { - /// Initializes a new instance of CostManagementAlertsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CostManagementAlertsResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CostManagementAlertsResult. + /// Initializes a new instance of . /// List of alerts. /// URL to get the next set of alerts results if there are any. - internal CostManagementAlertsResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal CostManagementAlertsResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of alerts. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.Serialization.cs index 0975ffbdc425..5f99d78e347b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.Serialization.cs @@ -10,11 +10,278 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class CostManagementDimension + public partial class CostManagementDimension : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CostManagementDimension DeserializeCostManagementDimension(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional sku = default; + Optional eTag = default; + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional description = default; + Optional filterEnabled = default; + Optional groupingEnabled = default; + Optional> data = default; + Optional total = default; + Optional category = default; + Optional usageStart = default; + Optional usageEnd = default; + Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("filterEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filterEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("groupingEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupingEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("data"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + data = array; + continue; + } + if (property0.NameEquals("total"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + total = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("category"u8)) + { + category = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("usageStart"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usageStart = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("usageEnd"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usageEnd = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("nextLink"u8)) + { + nextLink = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CostManagementDimension(id, name, type, systemData.Value, description.Value, Optional.ToNullable(filterEnabled), Optional.ToNullable(groupingEnabled), Optional.ToList(data), Optional.ToNullable(total), category.Value, Optional.ToNullable(usageStart), Optional.ToNullable(usageEnd), nextLink.Value, Optional.ToNullable(location), sku.Value, Optional.ToNullable(eTag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + CostManagementDimension IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementDimension(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementDimension IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementDimension(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementDimension model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementDimension(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementDimension(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.cs index 72554f74430e..3d6b7bf536b3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimension.cs @@ -16,14 +16,17 @@ namespace Azure.ResourceManager.CostManagement.Models /// List of Dimension. public partial class CostManagementDimension : ResourceData { - /// Initializes a new instance of CostManagementDimension. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CostManagementDimension() { Data = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CostManagementDimension. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ internal CostManagementDimension() /// SKU of the resource. /// ETag of the resource. /// Resource tags. - internal CostManagementDimension(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, bool? isFilterEnabled, bool? isGroupingEnabled, IReadOnlyList data, int? total, string category, DateTimeOffset? usageStart, DateTimeOffset? usageEnd, string nextLink, AzureLocation? location, string sku, ETag? eTag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal CostManagementDimension(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, bool? isFilterEnabled, bool? isGroupingEnabled, IReadOnlyList data, int? total, string category, DateTimeOffset? usageStart, DateTimeOffset? usageEnd, string nextLink, AzureLocation? location, string sku, ETag? eTag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; IsFilterEnabled = isFilterEnabled; @@ -56,6 +60,7 @@ internal CostManagementDimension(ResourceIdentifier id, string name, ResourceTyp Sku = sku; ETag = eTag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Dimension description. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs index 90b69c9f0538..be248319e908 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class CostManagementDimensionsListResult + internal partial class CostManagementDimensionsListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CostManagementDimensionsListResult DeserializeCostManagementDimensionsListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CostManagementDimensionsListResult DeserializeCostManagementDimensionsListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +64,61 @@ internal static CostManagementDimensionsListResult DeserializeCostManagementDime value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CostManagementDimensionsListResult(Optional.ToList(value)); + return new CostManagementDimensionsListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + CostManagementDimensionsListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementDimensionsListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementDimensionsListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementDimensionsListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementDimensionsListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementDimensionsListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementDimensionsListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs index 67b047d844b5..a7b319a801d5 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of listing dimensions. It contains a list of available dimensions. internal partial class CostManagementDimensionsListResult { - /// Initializes a new instance of CostManagementDimensionsListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CostManagementDimensionsListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of CostManagementDimensionsListResult. + /// Initializes a new instance of . /// The list of dimensions. - internal CostManagementDimensionsListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal CostManagementDimensionsListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of dimensions. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementExportData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementExportData.Serialization.cs index bfb7a90d1c22..f10d2167da83 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementExportData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementExportData.Serialization.cs @@ -6,18 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement { - public partial class CostManagementExportData : IUtf8JsonSerializable + public partial class CostManagementExportData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -34,17 +40,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DeliveryInfo)) { writer.WritePropertyName("deliveryInfo"u8); - writer.WriteObjectValue(DeliveryInfo); + if (DeliveryInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeliveryInfo).Serialize(writer, options); + } } if (Optional.IsDefined(Definition)) { writer.WritePropertyName("definition"u8); - writer.WriteObjectValue(Definition); + if (Definition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Definition).Serialize(writer, options); + } } if (Optional.IsDefined(RunHistory)) { writer.WritePropertyName("runHistory"u8); - writer.WriteObjectValue(RunHistory); + if (RunHistory is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RunHistory).Serialize(writer, options); + } } if (Optional.IsDefined(PartitionData)) { @@ -54,10 +81,217 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Schedule)) { writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CostManagementExportData DeserializeCostManagementExportData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eTag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional format = default; + Optional deliveryInfo = default; + Optional definition = default; + Optional runHistory = default; + Optional partitionData = default; + Optional nextRunTimeEstimate = default; + Optional schedule = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("format"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + format = new ExportFormatType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("deliveryInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deliveryInfo = ExportDeliveryInfo.DeserializeExportDeliveryInfo(property0.Value); + continue; + } + if (property0.NameEquals("definition"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + definition = ExportDefinition.DeserializeExportDefinition(property0.Value); + continue; + } + if (property0.NameEquals("runHistory"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runHistory = ExportExecutionListResult.DeserializeExportExecutionListResult(property0.Value); + continue; + } + if (property0.NameEquals("partitionData"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partitionData = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("nextRunTimeEstimate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextRunTimeEstimate = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("schedule"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + schedule = ExportSchedule.DeserializeExportSchedule(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CostManagementExportData(id, name, type, systemData.Value, Optional.ToNullable(format), deliveryInfo.Value, definition.Value, runHistory.Value, Optional.ToNullable(partitionData), Optional.ToNullable(nextRunTimeEstimate), schedule.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + CostManagementExportData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementExportData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementExportData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementExportData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementExportData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementExportData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementExportData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.Serialization.cs index 38f235e8c110..6f516c03a27c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class CostManagementNameAvailabilityContent : IUtf8JsonSerializable + public partial class CostManagementNameAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CostManagementNameAvailabilityContent DeserializeCostManagementNameAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CostManagementNameAvailabilityContent(name.Value, type.Value, serializedAdditionalRawData); + } + + CostManagementNameAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementNameAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementNameAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementNameAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementNameAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementNameAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementNameAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.cs index 001b8efc3686..77aa29f5c780 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// The check availability request body. public partial class CostManagementNameAvailabilityContent { - /// Initializes a new instance of CostManagementNameAvailabilityContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CostManagementNameAvailabilityContent() { } + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal CostManagementNameAvailabilityContent(string name, string resourceType, Dictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the resource for which availability needs to be checked. public string Name { get; set; } /// The resource type. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.Serialization.cs index 828200c60bf2..ad77d4e50485 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class CostManagementNameAvailabilityResult + public partial class CostManagementNameAvailabilityResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CostManagementNameAvailabilityResult DeserializeCostManagementNameAvailabilityResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(NameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CostManagementNameAvailabilityResult DeserializeCostManagementNameAvailabilityResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static CostManagementNameAvailabilityResult DeserializeCostManagementNa Optional nameAvailable = default; Optional reason = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("nameAvailable"u8)) @@ -46,8 +90,61 @@ internal static CostManagementNameAvailabilityResult DeserializeCostManagementNa message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CostManagementNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value); + return new CostManagementNameAvailabilityResult(Optional.ToNullable(nameAvailable), Optional.ToNullable(reason), message.Value, serializedAdditionalRawData); + } + + CostManagementNameAvailabilityResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementNameAvailabilityResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementNameAvailabilityResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementNameAvailabilityResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementNameAvailabilityResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementNameAvailabilityResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementNameAvailabilityResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.cs index 260908e465de..e0b1142019e1 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementNameAvailabilityResult.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// The check availability result. public partial class CostManagementNameAvailabilityResult { - /// Initializes a new instance of CostManagementNameAvailabilityResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CostManagementNameAvailabilityResult() { } - /// Initializes a new instance of CostManagementNameAvailabilityResult. + /// Initializes a new instance of . /// Indicates if the resource name is available. /// The reason why the given name is not available. /// Detailed reason why the given name is available. - internal CostManagementNameAvailabilityResult(bool? nameAvailable, CostManagementUnavailabilityReason? reason, string message) + /// Keeps track of any properties unknown to the library. + internal CostManagementNameAvailabilityResult(bool? nameAvailable, CostManagementUnavailabilityReason? reason, string message, Dictionary serializedAdditionalRawData) { NameAvailable = nameAvailable; Reason = reason; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates if the resource name is available. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementViewData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementViewData.Serialization.cs index 1c684cfbb89f..f9d9952149ea 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementViewData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementViewData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement { - public partial class CostManagementViewData : IUtf8JsonSerializable + public partial class CostManagementViewData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -58,7 +63,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Kpis) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -68,7 +80,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pivots) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,12 +106,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TimePeriod)) { writer.WritePropertyName("timePeriod"u8); - writer.WriteObjectValue(TimePeriod); + if (TimePeriod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TimePeriod).Serialize(writer, options); + } } if (Optional.IsDefined(DataSet)) { writer.WritePropertyName("dataSet"u8); - writer.WriteObjectValue(DataSet); + if (DataSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataSet).Serialize(writer, options); + } } if (Optional.IsDefined(IncludeMonetaryCommitment)) { @@ -101,7 +134,307 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CostManagementViewData DeserializeCostManagementViewData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eTag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional scope = default; + Optional createdOn = default; + Optional modifiedOn = default; + Optional dateRange = default; + Optional currency = default; + Optional chart = default; + Optional accumulated = default; + Optional metric = default; + Optional> kpis = default; + Optional> pivots = default; + Optional type0 = default; + Optional timeframe = default; + Optional timePeriod = default; + Optional dataSet = default; + Optional includeMonetaryCommitment = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("scope"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scope = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("createdOn"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("modifiedOn"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifiedOn = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("dateRange"u8)) + { + dateRange = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("currency"u8)) + { + currency = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("chart"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + chart = new ViewChartType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("accumulated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + accumulated = new AccumulatedType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("metric"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metric = new ViewMetricType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("kpis"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ViewKpiProperties.DeserializeViewKpiProperties(item)); + } + kpis = array; + continue; + } + if (property0.NameEquals("pivots"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ViewPivotProperties.DeserializeViewPivotProperties(item)); + } + pivots = array; + continue; + } + if (property0.NameEquals("query"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.NameEquals("type"u8)) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type0 = new ViewReportType(property1.Value.GetString()); + continue; + } + if (property1.NameEquals("timeframe"u8)) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeframe = new ReportTimeframeType(property1.Value.GetString()); + continue; + } + if (property1.NameEquals("timePeriod"u8)) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timePeriod = ReportConfigTimePeriod.DeserializeReportConfigTimePeriod(property1.Value); + continue; + } + if (property1.NameEquals("dataSet"u8)) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataSet = ReportConfigDataset.DeserializeReportConfigDataset(property1.Value); + continue; + } + if (property1.NameEquals("includeMonetaryCommitment"u8)) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + includeMonetaryCommitment = property1.Value.GetBoolean(); + continue; + } + } + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CostManagementViewData(id, name, type, systemData.Value, displayName.Value, scope.Value, Optional.ToNullable(createdOn), Optional.ToNullable(modifiedOn), dateRange.Value, currency.Value, Optional.ToNullable(chart), Optional.ToNullable(accumulated), Optional.ToNullable(metric), Optional.ToList(kpis), Optional.ToList(pivots), Optional.ToNullable(type0), Optional.ToNullable(timeframe), timePeriod.Value, dataSet.Value, Optional.ToNullable(includeMonetaryCommitment), Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + CostManagementViewData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCostManagementViewData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CostManagementViewData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCostManagementViewData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CostManagementViewData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CostManagementViewData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCostManagementViewData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.Serialization.cs index 577270870fd2..1997b62c873c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.Serialization.cs @@ -6,15 +6,52 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class DownloadURL + public partial class DownloadURL : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DownloadURL DeserializeDownloadURL(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ValidTill)) + { + writer.WritePropertyName("validTill"u8); + writer.WriteStringValue(ValidTill.Value, "O"); + } + if (Optional.IsDefined(DownloadUri)) + { + writer.WritePropertyName("downloadUrl"u8); + writer.WriteStringValue(DownloadUri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DownloadURL DeserializeDownloadURL(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +59,7 @@ internal static DownloadURL DeserializeDownloadURL(JsonElement element) Optional expiryTime = default; Optional validTill = default; Optional downloadUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("expiryTime"u8)) @@ -51,8 +89,61 @@ internal static DownloadURL DeserializeDownloadURL(JsonElement element) downloadUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DownloadURL(Optional.ToNullable(expiryTime), Optional.ToNullable(validTill), downloadUrl.Value); + return new DownloadURL(Optional.ToNullable(expiryTime), Optional.ToNullable(validTill), downloadUrl.Value, serializedAdditionalRawData); + } + + DownloadURL IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDownloadURL(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DownloadURL IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDownloadURL(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DownloadURL model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DownloadURL(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDownloadURL(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.cs index 89150032b77f..8bce5a443896 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DownloadURL.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The URL to download the generated report. public partial class DownloadURL { - /// Initializes a new instance of DownloadURL. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DownloadURL() { } - /// Initializes a new instance of DownloadURL. + /// Initializes a new instance of . /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. /// The URL to download the generated report. - internal DownloadURL(DateTimeOffset? expiryOn, DateTimeOffset? validTill, Uri downloadUri) + /// Keeps track of any properties unknown to the library. + internal DownloadURL(DateTimeOffset? expiryOn, DateTimeOffset? validTill, Uri downloadUri, Dictionary serializedAdditionalRawData) { ExpiryOn = expiryOn; ValidTill = validTill; DownloadUri = downloadUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.Serialization.cs index 9c1eeffdc07e..0f13b85673a3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportDataset : IUtf8JsonSerializable + public partial class ExportDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Granularity)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ExportDataset DeserializeExportDataset(JsonElement element) + internal static ExportDataset DeserializeExportDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional granularity = default; Optional configuration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("granularity"u8)) @@ -56,8 +86,61 @@ internal static ExportDataset DeserializeExportDataset(JsonElement element) configuration = ExportDatasetConfiguration.DeserializeExportDatasetConfiguration(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportDataset(Optional.ToNullable(granularity), configuration.Value, serializedAdditionalRawData); + } + + ExportDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportDataset(Response response) + { + if (response is null) + { + return null; } - return new ExportDataset(Optional.ToNullable(granularity), configuration.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs index 06d8b30bd68a..d3831740a2b4 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models @@ -12,18 +13,23 @@ namespace Azure.ResourceManager.CostManagement.Models /// The definition for data in the export. public partial class ExportDataset { - /// Initializes a new instance of ExportDataset. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExportDataset() { } - /// Initializes a new instance of ExportDataset. + /// Initializes a new instance of . /// The granularity of rows in the export. Currently only 'Daily' is supported. /// The export dataset configuration. - internal ExportDataset(GranularityType? granularity, ExportDatasetConfiguration configuration) + /// Keeps track of any properties unknown to the library. + internal ExportDataset(GranularityType? granularity, ExportDatasetConfiguration configuration, Dictionary serializedAdditionalRawData) { Granularity = granularity; Configuration = configuration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The granularity of rows in the export. Currently only 'Daily' is supported. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs index 7c672cf1be00..36080e635ceb 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ExportDatasetConfiguration : IUtf8JsonSerializable + internal partial class ExportDatasetConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Columns)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportDatasetConfiguration DeserializeExportDatasetConfiguration(JsonElement element) + internal static ExportDatasetConfiguration DeserializeExportDatasetConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> columns = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("columns"u8)) @@ -52,8 +74,61 @@ internal static ExportDatasetConfiguration DeserializeExportDatasetConfiguration columns = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportDatasetConfiguration(Optional.ToList(columns), serializedAdditionalRawData); + } + + ExportDatasetConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportDatasetConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportDatasetConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportDatasetConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportDatasetConfiguration model) + { + if (model is null) + { + return null; } - return new ExportDatasetConfiguration(Optional.ToList(columns)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportDatasetConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportDatasetConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs index 478f90d274a4..9258c7c15537 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CostManagement.Models /// The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. internal partial class ExportDatasetConfiguration { - /// Initializes a new instance of ExportDatasetConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExportDatasetConfiguration() { Columns = new ChangeTrackingList(); } - /// Initializes a new instance of ExportDatasetConfiguration. + /// Initializes a new instance of . /// Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). - internal ExportDatasetConfiguration(IList columns) + /// Keeps track of any properties unknown to the library. + internal ExportDatasetConfiguration(IList columns, Dictionary serializedAdditionalRawData) { Columns = columns; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.Serialization.cs index b657dc944b38..5df645a52f2d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportDefinition : IUtf8JsonSerializable + public partial class ExportDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ExportType.ToString()); @@ -22,18 +30,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TimePeriod)) { writer.WritePropertyName("timePeriod"u8); - writer.WriteObjectValue(TimePeriod); + if (TimePeriod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TimePeriod).Serialize(writer, options); + } } if (Optional.IsDefined(DataSet)) { writer.WritePropertyName("dataSet"u8); - writer.WriteObjectValue(DataSet); + if (DataSet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataSet).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ExportDefinition DeserializeExportDefinition(JsonElement element) + internal static ExportDefinition DeserializeExportDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static ExportDefinition DeserializeExportDefinition(JsonElement element TimeframeType timeframe = default; Optional timePeriod = default; Optional dataSet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -72,8 +109,61 @@ internal static ExportDefinition DeserializeExportDefinition(JsonElement element dataSet = ExportDataset.DeserializeExportDataset(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportDefinition(type, timeframe, timePeriod.Value, dataSet.Value, serializedAdditionalRawData); + } + + ExportDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportDefinition model) + { + if (model is null) + { + return null; } - return new ExportDefinition(type, timeframe, timePeriod.Value, dataSet.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.cs index b8b213e66113..ab3636c226af 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDefinition.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// The definition of an export. public partial class ExportDefinition { - /// Initializes a new instance of ExportDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. /// The time frame for pulling data for the export. If custom, then a specific time period must be provided. public ExportDefinition(ExportType exportType, TimeframeType timeframe) @@ -19,17 +25,24 @@ public ExportDefinition(ExportType exportType, TimeframeType timeframe) Timeframe = timeframe; } - /// Initializes a new instance of ExportDefinition. + /// Initializes a new instance of . /// The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. /// The time frame for pulling data for the export. If custom, then a specific time period must be provided. /// Has time period for pulling data for the export. /// The definition for data in the export. - internal ExportDefinition(ExportType exportType, TimeframeType timeframe, ExportTimePeriod timePeriod, ExportDataset dataSet) + /// Keeps track of any properties unknown to the library. + internal ExportDefinition(ExportType exportType, TimeframeType timeframe, ExportTimePeriod timePeriod, ExportDataset dataSet, Dictionary serializedAdditionalRawData) { ExportType = exportType; Timeframe = timeframe; TimePeriod = timePeriod; DataSet = dataSet; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportDefinition() + { } /// The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs index b7971ddb38c1..e0d2686fe413 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportDeliveryDestination : IUtf8JsonSerializable + public partial class ExportDeliveryDestination : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("storageAccount"u8); writer.WriteStringValue(StorageAccount); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(JsonElement element) + internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(J Optional rootFolderPath = default; Optional sasToken = default; Optional storageAccount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -82,8 +105,61 @@ internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(J storageAccount = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportDeliveryDestination(resourceId.Value, container, rootFolderPath.Value, sasToken.Value, storageAccount.Value, serializedAdditionalRawData); + } + + ExportDeliveryDestination IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportDeliveryDestination(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportDeliveryDestination IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportDeliveryDestination(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportDeliveryDestination model) + { + if (model is null) + { + return null; } - return new ExportDeliveryDestination(resourceId.Value, container, rootFolderPath.Value, sasToken.Value, storageAccount.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportDeliveryDestination(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportDeliveryDestination(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs index 1260bb837a97..653632fe9d4b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ). public partial class ExportDeliveryDestination { - /// Initializes a new instance of ExportDeliveryDestination. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the container where exports will be uploaded. If the container does not exist it will be created. /// is null. public ExportDeliveryDestination(string container) @@ -23,19 +27,26 @@ public ExportDeliveryDestination(string container) Container = container; } - /// Initializes a new instance of ExportDeliveryDestination. + /// Initializes a new instance of . /// The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified. /// The name of the container where exports will be uploaded. If the container does not exist it will be created. /// The name of the directory where exports will be uploaded. /// A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified instead of resourceId. Note: the value returned by the API for this property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. To update this value a new SAS token must be specified. /// The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken can be specified instead of resourceId. - internal ExportDeliveryDestination(ResourceIdentifier resourceId, string container, string rootFolderPath, string sasToken, string storageAccount) + /// Keeps track of any properties unknown to the library. + internal ExportDeliveryDestination(ResourceIdentifier resourceId, string container, string rootFolderPath, string sasToken, string storageAccount, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; Container = container; RootFolderPath = rootFolderPath; SasToken = sasToken; StorageAccount = storageAccount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportDeliveryDestination() + { } /// The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.Serialization.cs index 4226367d12f5..7af3a399e476 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.Serialization.cs @@ -5,28 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportDeliveryInfo : IUtf8JsonSerializable + public partial class ExportDeliveryInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("destination"u8); - writer.WriteObjectValue(Destination); + if (Destination is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Destination).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportDeliveryInfo DeserializeExportDeliveryInfo(JsonElement element) + internal static ExportDeliveryInfo DeserializeExportDeliveryInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ExportDeliveryDestination destination = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("destination"u8)) @@ -34,8 +64,61 @@ internal static ExportDeliveryInfo DeserializeExportDeliveryInfo(JsonElement ele destination = ExportDeliveryDestination.DeserializeExportDeliveryDestination(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportDeliveryInfo(destination, serializedAdditionalRawData); + } + + ExportDeliveryInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportDeliveryInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportDeliveryInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportDeliveryInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportDeliveryInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportDeliveryInfo(Response response) + { + if (response is null) + { + return null; } - return new ExportDeliveryInfo(destination); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportDeliveryInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.cs index f5fe26a043d2..970464a0020f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The delivery information associated with a export. public partial class ExportDeliveryInfo { - /// Initializes a new instance of ExportDeliveryInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Has destination for the export being delivered. /// is null. public ExportDeliveryInfo(ExportDeliveryDestination destination) @@ -23,6 +27,20 @@ public ExportDeliveryInfo(ExportDeliveryDestination destination) Destination = destination; } + /// Initializes a new instance of . + /// Has destination for the export being delivered. + /// Keeps track of any properties unknown to the library. + internal ExportDeliveryInfo(ExportDeliveryDestination destination, Dictionary serializedAdditionalRawData) + { + Destination = destination; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportDeliveryInfo() + { + } + /// Has destination for the export being delivered. public ExportDeliveryDestination Destination { get; set; } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.Serialization.cs index bc4778148aec..7dc7932a3081 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.Serialization.cs @@ -5,27 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ExportExecutionListResult : IUtf8JsonSerializable + internal partial class ExportExecutionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportExecutionListResult DeserializeExportExecutionListResult(JsonElement element) + internal static ExportExecutionListResult DeserializeExportExecutionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +64,61 @@ internal static ExportExecutionListResult DeserializeExportExecutionListResult(J value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportExecutionListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ExportExecutionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportExecutionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportExecutionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportExecutionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportExecutionListResult model) + { + if (model is null) + { + return null; } - return new ExportExecutionListResult(Optional.ToList(value)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportExecutionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportExecutionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.cs index ee3cb660eefb..16b061027e6f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportExecutionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of listing the run history of an export. internal partial class ExportExecutionListResult { - /// Initializes a new instance of ExportExecutionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExportExecutionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExportExecutionListResult. + /// Initializes a new instance of . /// A list of export runs. - internal ExportExecutionListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ExportExecutionListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// A list of export runs. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.Serialization.cs index e55f90f8add4..e3fe297bcad9 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ExportListResult + internal partial class ExportListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExportListResult DeserializeExportListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExportListResult DeserializeExportListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -37,8 +65,61 @@ internal static ExportListResult DeserializeExportListResult(JsonElement element value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExportListResult(Optional.ToList(value)); + return new ExportListResult(Optional.ToList(value), serializedAdditionalRawData); + } + + ExportListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.cs index 5b6b2b3ad45a..06dac452325d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CostManagement; @@ -14,17 +15,22 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of listing exports. It contains a list of available exports in the scope provided. internal partial class ExportListResult { - /// Initializes a new instance of ExportListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExportListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ExportListResult. + /// Initializes a new instance of . /// The list of exports. - internal ExportListResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal ExportListResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of exports. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.Serialization.cs index 32b2e4c81d58..3813acb90bd3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportRecurrencePeriod : IUtf8JsonSerializable + public partial class ExportRecurrencePeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("from"u8); writer.WriteStringValue(From, "O"); @@ -23,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("to"u8); writer.WriteStringValue(To.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportRecurrencePeriod DeserializeExportRecurrencePeriod(JsonElement element) + internal static ExportRecurrencePeriod DeserializeExportRecurrencePeriod(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset @from = default; Optional to = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("from"u8)) @@ -50,8 +72,61 @@ internal static ExportRecurrencePeriod DeserializeExportRecurrencePeriod(JsonEle to = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportRecurrencePeriod(@from, Optional.ToNullable(to), serializedAdditionalRawData); + } + + ExportRecurrencePeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportRecurrencePeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportRecurrencePeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportRecurrencePeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportRecurrencePeriod model) + { + if (model is null) + { + return null; } - return new ExportRecurrencePeriod(@from, Optional.ToNullable(to)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportRecurrencePeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportRecurrencePeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.cs index 12e142688ad9..738de696eed5 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRecurrencePeriod.cs @@ -6,26 +6,37 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The start and end date for recurrence schedule. public partial class ExportRecurrencePeriod { - /// Initializes a new instance of ExportRecurrencePeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date of recurrence. public ExportRecurrencePeriod(DateTimeOffset @from) { From = @from; } - /// Initializes a new instance of ExportRecurrencePeriod. + /// Initializes a new instance of . /// The start date of recurrence. /// The end date of recurrence. - internal ExportRecurrencePeriod(DateTimeOffset @from, DateTimeOffset? to) + /// Keeps track of any properties unknown to the library. + internal ExportRecurrencePeriod(DateTimeOffset @from, DateTimeOffset? to, Dictionary serializedAdditionalRawData) { From = @from; To = to; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportRecurrencePeriod() + { } /// The start date of recurrence. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs index 3893bd7da713..a671729d828b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs @@ -6,17 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportRun : IUtf8JsonSerializable + public partial class ExportRun : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ETag)) { @@ -63,19 +69,47 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RunSettings)) { writer.WritePropertyName("runSettings"u8); - writer.WriteObjectValue(RunSettings); + if (RunSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RunSettings).Serialize(writer, options); + } } if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); + if (Error is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Error).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportRun DeserializeExportRun(JsonElement element) + internal static ExportRun DeserializeExportRun(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -94,6 +128,7 @@ internal static ExportRun DeserializeExportRun(JsonElement element) Optional fileName = default; Optional runSettings = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -214,8 +249,61 @@ internal static ExportRun DeserializeExportRun(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportRun(id, name, type, systemData.Value, Optional.ToNullable(executionType), Optional.ToNullable(status), submittedBy.Value, Optional.ToNullable(submittedTime), Optional.ToNullable(processingStartTime), Optional.ToNullable(processingEndTime), fileName.Value, runSettings.Value, error.Value, Optional.ToNullable(eTag), serializedAdditionalRawData); + } + + ExportRun IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportRun(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportRun IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportRun(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportRun model) + { + if (model is null) + { + return null; } - return new ExportRun(id, name, type, systemData.Value, Optional.ToNullable(executionType), Optional.ToNullable(status), submittedBy.Value, Optional.ToNullable(submittedTime), Optional.ToNullable(processingStartTime), Optional.ToNullable(processingEndTime), fileName.Value, runSettings.Value, error.Value, Optional.ToNullable(eTag)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportRun(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportRun(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs index 8abf16fde48c..5495b112c305 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,12 +16,15 @@ namespace Azure.ResourceManager.CostManagement.Models /// An export run. public partial class ExportRun : ResourceData { - /// Initializes a new instance of ExportRun. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExportRun() { } - /// Initializes a new instance of ExportRun. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public ExportRun() /// The export settings that were in effect for this run. /// The details of any error. /// eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportRunExecutionType? executionType, ExportRunExecutionStatus? status, string submittedBy, DateTimeOffset? submittedOn, DateTimeOffset? processingStartOn, DateTimeOffset? processingEndOn, string fileName, CommonExportProperties runSettings, ExportRunErrorDetails error, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportRunExecutionType? executionType, ExportRunExecutionStatus? status, string submittedBy, DateTimeOffset? submittedOn, DateTimeOffset? processingStartOn, DateTimeOffset? processingEndOn, string fileName, CommonExportProperties runSettings, ExportRunErrorDetails error, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ExecutionType = executionType; Status = status; @@ -47,6 +52,7 @@ internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType RunSettings = runSettings; Error = error; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the export run. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.Serialization.cs index 9c7dcd43b4a7..c730305b4a60 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.Serialization.cs @@ -5,27 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportRunErrorDetails : IUtf8JsonSerializable + public partial class ExportRunErrorDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportRunErrorDetails DeserializeExportRunErrorDetails(JsonElement element) + internal static ExportRunErrorDetails DeserializeExportRunErrorDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -38,8 +61,61 @@ internal static ExportRunErrorDetails DeserializeExportRunErrorDetails(JsonEleme message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportRunErrorDetails(code.Value, message.Value, serializedAdditionalRawData); + } + + ExportRunErrorDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportRunErrorDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportRunErrorDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportRunErrorDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportRunErrorDetails model) + { + if (model is null) + { + return null; } - return new ExportRunErrorDetails(code.Value, message.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportRunErrorDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportRunErrorDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.cs index 0a328c391f4d..687b46b91b98 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunErrorDetails.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// The details of the error. public partial class ExportRunErrorDetails { - /// Initializes a new instance of ExportRunErrorDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExportRunErrorDetails() { } - /// Initializes a new instance of ExportRunErrorDetails. + /// Initializes a new instance of . /// Error code. /// Error message indicating why the operation failed. - internal ExportRunErrorDetails(string code, string message) + /// Keeps track of any properties unknown to the library. + internal ExportRunErrorDetails(string code, string message, Dictionary serializedAdditionalRawData) { Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.Serialization.cs index 30b5f5e1996f..482968416f02 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportSchedule : IUtf8JsonSerializable + public partial class ExportSchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RecurrencePeriod)) { writer.WritePropertyName("recurrencePeriod"u8); - writer.WriteObjectValue(RecurrencePeriod); + if (RecurrencePeriod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RecurrencePeriod).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ExportSchedule DeserializeExportSchedule(JsonElement element) + internal static ExportSchedule DeserializeExportSchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static ExportSchedule DeserializeExportSchedule(JsonElement element) Optional status = default; Optional recurrence = default; Optional recurrencePeriod = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -71,8 +101,61 @@ internal static ExportSchedule DeserializeExportSchedule(JsonElement element) recurrencePeriod = ExportRecurrencePeriod.DeserializeExportRecurrencePeriod(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportSchedule(Optional.ToNullable(status), Optional.ToNullable(recurrence), recurrencePeriod.Value, serializedAdditionalRawData); + } + + ExportSchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportSchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportSchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportSchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportSchedule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportSchedule(Response response) + { + if (response is null) + { + return null; } - return new ExportSchedule(Optional.ToNullable(status), Optional.ToNullable(recurrence), recurrencePeriod.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportSchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs index 03e46e474f6a..13a55e6586d6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// The schedule associated with the export. public partial class ExportSchedule { - /// Initializes a new instance of ExportSchedule. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExportSchedule() { } - /// Initializes a new instance of ExportSchedule. + /// Initializes a new instance of . /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. /// The schedule recurrence. /// Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. - internal ExportSchedule(ExportScheduleStatusType? status, ExportScheduleRecurrenceType? recurrence, ExportRecurrencePeriod recurrencePeriod) + /// Keeps track of any properties unknown to the library. + internal ExportSchedule(ExportScheduleStatusType? status, ExportScheduleRecurrenceType? recurrence, ExportRecurrencePeriod recurrencePeriod, Dictionary serializedAdditionalRawData) { Status = status; Recurrence = recurrence; RecurrencePeriod = recurrencePeriod; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.Serialization.cs index 0ed9cf0bbfc1..b7833590246a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ExportTimePeriod : IUtf8JsonSerializable + public partial class ExportTimePeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("from"u8); writer.WriteStringValue(From, "O"); writer.WritePropertyName("to"u8); writer.WriteStringValue(To, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExportTimePeriod DeserializeExportTimePeriod(JsonElement element) + internal static ExportTimePeriod DeserializeExportTimePeriod(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset @from = default; DateTimeOffset to = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("from"u8)) @@ -43,8 +65,61 @@ internal static ExportTimePeriod DeserializeExportTimePeriod(JsonElement element to = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExportTimePeriod(@from, to, serializedAdditionalRawData); + } + + ExportTimePeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportTimePeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportTimePeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportTimePeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportTimePeriod model) + { + if (model is null) + { + return null; } - return new ExportTimePeriod(@from, to); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportTimePeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportTimePeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs index 6eba49a0c0a1..f89bdfa107f7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months. public partial class ExportTimePeriod { - /// Initializes a new instance of ExportTimePeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date for export data. /// The end date for export data. public ExportTimePeriod(DateTimeOffset @from, DateTimeOffset to) @@ -21,6 +25,22 @@ public ExportTimePeriod(DateTimeOffset @from, DateTimeOffset to) To = to; } + /// Initializes a new instance of . + /// The start date for export data. + /// The end date for export data. + /// Keeps track of any properties unknown to the library. + internal ExportTimePeriod(DateTimeOffset @from, DateTimeOffset to, Dictionary serializedAdditionalRawData) + { + From = @from; + To = to; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExportTimePeriod() + { + } + /// The start date for export data. public DateTimeOffset From { get; set; } /// The end date for export data. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.Serialization.cs index abaa83492740..ffeb903b2d67 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class FileDestination : IUtf8JsonSerializable + internal partial class FileDestination : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(FileFormats)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FileDestination DeserializeFileDestination(JsonElement element) + internal static FileDestination DeserializeFileDestination(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> fileFormats = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("fileFormats"u8)) @@ -52,8 +74,61 @@ internal static FileDestination DeserializeFileDestination(JsonElement element) fileFormats = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FileDestination(Optional.ToList(fileFormats), serializedAdditionalRawData); + } + + FileDestination IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileDestination(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileDestination IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileDestination(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileDestination model) + { + if (model is null) + { + return null; } - return new FileDestination(Optional.ToList(fileFormats)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileDestination(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileDestination(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.cs index df73ba8c1efc..37e42dca5834 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FileDestination.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CostManagement.Models /// Destination of the view data. This is optional. Currently only CSV format is supported. internal partial class FileDestination { - /// Initializes a new instance of FileDestination. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FileDestination() { FileFormats = new ChangeTrackingList(); } - /// Initializes a new instance of FileDestination. + /// Initializes a new instance of . /// Destination of the view data. Currently only CSV format is supported. - internal FileDestination(IList fileFormats) + /// Keeps track of any properties unknown to the library. + internal FileDestination(IList fileFormats, Dictionary serializedAdditionalRawData) { FileFormats = fileFormats; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Destination of the view data. Currently only CSV format is supported. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.Serialization.cs index 63747a1c3587..8409745cc46c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastAggregation : IUtf8JsonSerializable + public partial class ForecastAggregation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToString()); writer.WritePropertyName("function"u8); writer.WriteStringValue(Function.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ForecastAggregation DeserializeForecastAggregation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FunctionName name = default; + FunctionType function = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new FunctionName(property.Value.GetString()); + continue; + } + if (property.NameEquals("function"u8)) + { + function = new FunctionType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastAggregation(name, function, serializedAdditionalRawData); + } + + ForecastAggregation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastAggregation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastAggregation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastAggregation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastAggregation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastAggregation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastAggregation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.cs index f6c02ba9fe16..d1ec8ba4d2d8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastAggregation.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// The aggregation expression to be used in the forecast. public partial class ForecastAggregation { - /// Initializes a new instance of ForecastAggregation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to aggregate. /// The name of the aggregation function to use. public ForecastAggregation(FunctionName name, FunctionType function) @@ -19,6 +25,22 @@ public ForecastAggregation(FunctionName name, FunctionType function) Function = function; } + /// Initializes a new instance of . + /// The name of the column to aggregate. + /// The name of the aggregation function to use. + /// Keeps track of any properties unknown to the library. + internal ForecastAggregation(FunctionName name, FunctionType function, Dictionary serializedAdditionalRawData) + { + Name = name; + Function = function; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ForecastAggregation() + { + } + /// The name of the column to aggregate. public FunctionName Name { get; } /// The name of the aggregation function to use. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.Serialization.cs index 03811428c07b..e95168953ff1 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastColumn + public partial class ForecastColumn : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ForecastColumn DeserializeForecastColumn(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ForecastColumnType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ForecastColumnType); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ForecastColumn DeserializeForecastColumn(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static ForecastColumn DeserializeForecastColumn(JsonElement element) type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ForecastColumn(name.Value, type.Value); + return new ForecastColumn(name.Value, type.Value, serializedAdditionalRawData); + } + + ForecastColumn IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastColumn(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastColumn IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastColumn(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastColumn model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastColumn(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastColumn(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.cs index 36600db5c22a..7d8ea8ad2a05 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastColumn.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// Forecast column properties. public partial class ForecastColumn { - /// Initializes a new instance of ForecastColumn. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ForecastColumn() { } - /// Initializes a new instance of ForecastColumn. + /// Initializes a new instance of . /// The name of column. /// The type of column. - internal ForecastColumn(string name, string forecastColumnType) + /// Keeps track of any properties unknown to the library. + internal ForecastColumn(string name, string forecastColumnType, Dictionary serializedAdditionalRawData) { Name = name; ForecastColumnType = forecastColumnType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of column. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.Serialization.cs index 5e70b6163cc2..3b3c9aa18b8a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastComparisonExpression : IUtf8JsonSerializable + public partial class ForecastComparisonExpression : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -26,7 +34,110 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ForecastComparisonExpression DeserializeForecastComparisonExpression(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ForecastOperatorType @operator = default; + IList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = new ForecastOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastComparisonExpression(name, @operator, values, serializedAdditionalRawData); + } + + ForecastComparisonExpression IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastComparisonExpression(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastComparisonExpression IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastComparisonExpression(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastComparisonExpression model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastComparisonExpression(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastComparisonExpression(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.cs index eb69b45362ff..485ec289a53a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastComparisonExpression.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The comparison expression to be used in the forecast. public partial class ForecastComparisonExpression { - /// Initializes a new instance of ForecastComparisonExpression. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to use in comparison. /// The operator to use for comparison. /// Array of values to use for comparison. @@ -30,6 +33,24 @@ public ForecastComparisonExpression(string name, ForecastOperatorType @operator, Values = values.ToList(); } + /// Initializes a new instance of . + /// The name of the column to use in comparison. + /// The operator to use for comparison. + /// Array of values to use for comparison. + /// Keeps track of any properties unknown to the library. + internal ForecastComparisonExpression(string name, ForecastOperatorType @operator, IList values, Dictionary serializedAdditionalRawData) + { + Name = name; + Operator = @operator; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ForecastComparisonExpression() + { + } + /// The name of the column to use in comparison. public string Name { get; } /// The operator to use for comparison. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.Serialization.cs index f23d2372406e..7d539e597497 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastDataset : IUtf8JsonSerializable + public partial class ForecastDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Granularity)) { @@ -23,22 +31,164 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } writer.WritePropertyName("aggregation"u8); writer.WriteStartObject(); foreach (var item in Aggregation) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); if (Optional.IsDefined(Filter)) { writer.WritePropertyName("filter"u8); - writer.WriteObjectValue(Filter); + if (Filter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Filter).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ForecastDataset DeserializeForecastDataset(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional granularity = default; + Optional configuration = default; + IDictionary aggregation = default; + Optional filter = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("granularity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + granularity = new GranularityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = ForecastDatasetConfiguration.DeserializeForecastDatasetConfiguration(property.Value); + continue; + } + if (property.NameEquals("aggregation"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ForecastAggregation.DeserializeForecastAggregation(property0.Value)); + } + aggregation = dictionary; + continue; + } + if (property.NameEquals("filter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filter = ForecastFilter.DeserializeForecastFilter(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastDataset(Optional.ToNullable(granularity), configuration.Value, aggregation, filter.Value, serializedAdditionalRawData); + } + + ForecastDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.cs index 9d037d9c0d6e..92306ea31cad 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDataset.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The definition of data present in the forecast. public partial class ForecastDataset { - /// Initializes a new instance of ForecastDataset. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. /// is null. public ForecastDataset(IDictionary aggregation) @@ -24,6 +27,26 @@ public ForecastDataset(IDictionary aggregation) Aggregation = aggregation; } + /// Initializes a new instance of . + /// The granularity of rows in the forecast. + /// Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. + /// Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. + /// Has filter expression to use in the forecast. + /// Keeps track of any properties unknown to the library. + internal ForecastDataset(GranularityType? granularity, ForecastDatasetConfiguration configuration, IDictionary aggregation, ForecastFilter filter, Dictionary serializedAdditionalRawData) + { + Granularity = granularity; + Configuration = configuration; + Aggregation = aggregation; + Filter = filter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ForecastDataset() + { + } + /// The granularity of rows in the forecast. public GranularityType? Granularity { get; set; } /// Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.Serialization.cs index e009b29f0cdd..e321ebea39a4 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ForecastDatasetConfiguration : IUtf8JsonSerializable + internal partial class ForecastDatasetConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Columns)) { @@ -25,7 +33,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ForecastDatasetConfiguration DeserializeForecastDatasetConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> columns = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("columns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + columns = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastDatasetConfiguration(Optional.ToList(columns), serializedAdditionalRawData); + } + + ForecastDatasetConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastDatasetConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastDatasetConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastDatasetConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastDatasetConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastDatasetConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastDatasetConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.cs index 1d411ba7473a..8842918a9685 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDatasetConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// The configuration of dataset in the forecast. internal partial class ForecastDatasetConfiguration { - /// Initializes a new instance of ForecastDatasetConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ForecastDatasetConfiguration() { Columns = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns. + /// Keeps track of any properties unknown to the library. + internal ForecastDatasetConfiguration(IList columns, Dictionary serializedAdditionalRawData) + { + Columns = columns; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns. public IList Columns { get; } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.Serialization.cs index fefd3080c12f..777a2f3b8721 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastDefinition : IUtf8JsonSerializable + public partial class ForecastDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ForecastType.ToString()); @@ -22,10 +30,24 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TimePeriod)) { writer.WritePropertyName("timePeriod"u8); - writer.WriteObjectValue(TimePeriod); + if (TimePeriod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TimePeriod).Serialize(writer, options); + } } writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } if (Optional.IsDefined(IncludeActualCost)) { writer.WritePropertyName("includeActualCost"u8); @@ -36,7 +58,135 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("includeFreshPartialCost"u8); writer.WriteBooleanValue(IncludeFreshPartialCost.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ForecastDefinition DeserializeForecastDefinition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ForecastType type = default; + ForecastTimeframe timeframe = default; + Optional timePeriod = default; + ForecastDataset dataset = default; + Optional includeActualCost = default; + Optional includeFreshPartialCost = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ForecastType(property.Value.GetString()); + continue; + } + if (property.NameEquals("timeframe"u8)) + { + timeframe = new ForecastTimeframe(property.Value.GetString()); + continue; + } + if (property.NameEquals("timePeriod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timePeriod = ForecastTimePeriod.DeserializeForecastTimePeriod(property.Value); + continue; + } + if (property.NameEquals("dataset"u8)) + { + dataset = ForecastDataset.DeserializeForecastDataset(property.Value); + continue; + } + if (property.NameEquals("includeActualCost"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + includeActualCost = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("includeFreshPartialCost"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + includeFreshPartialCost = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastDefinition(type, timeframe, timePeriod.Value, dataset, Optional.ToNullable(includeActualCost), Optional.ToNullable(includeFreshPartialCost), serializedAdditionalRawData); + } + + ForecastDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.cs index 16eb4570befd..ca666c9e22be 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastDefinition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The definition of a forecast. public partial class ForecastDefinition { - /// Initializes a new instance of ForecastDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of the forecast. /// The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. /// Has definition for data in this forecast. @@ -27,6 +31,30 @@ public ForecastDefinition(ForecastType forecastType, ForecastTimeframe timeframe Dataset = dataset; } + /// Initializes a new instance of . + /// The type of the forecast. + /// The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. + /// Has time period for pulling data for the forecast. + /// Has definition for data in this forecast. + /// A boolean determining if actualCost will be included. + /// A boolean determining if FreshPartialCost will be included. + /// Keeps track of any properties unknown to the library. + internal ForecastDefinition(ForecastType forecastType, ForecastTimeframe timeframe, ForecastTimePeriod timePeriod, ForecastDataset dataset, bool? includeActualCost, bool? includeFreshPartialCost, Dictionary serializedAdditionalRawData) + { + ForecastType = forecastType; + Timeframe = timeframe; + TimePeriod = timePeriod; + Dataset = dataset; + IncludeActualCost = includeActualCost; + IncludeFreshPartialCost = includeFreshPartialCost; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ForecastDefinition() + { + } + /// The type of the forecast. public ForecastType ForecastType { get; } /// The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.Serialization.cs index f77b1f50c9a5..0d2a5dd5ce4f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastFilter : IUtf8JsonSerializable + public partial class ForecastFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(And)) { @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in And) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -31,21 +46,172 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Or) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Dimensions)) { writer.WritePropertyName("dimensions"u8); - writer.WriteObjectValue(Dimensions); + if (Dimensions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dimensions).Serialize(writer, options); + } } if (Optional.IsDefined(Tags)) { writer.WritePropertyName("tags"u8); - writer.WriteObjectValue(Tags); + if (Tags is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tags).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static ForecastFilter DeserializeForecastFilter(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> and = default; + Optional> or = default; + Optional dimensions = default; + Optional tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("and"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeForecastFilter(item)); + } + and = array; + continue; + } + if (property.NameEquals("or"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeForecastFilter(item)); + } + or = array; + continue; + } + if (property.NameEquals("dimensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dimensions = ForecastComparisonExpression.DeserializeForecastComparisonExpression(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tags = ForecastComparisonExpression.DeserializeForecastComparisonExpression(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastFilter(Optional.ToList(and), Optional.ToList(or), dimensions.Value, tags.Value, serializedAdditionalRawData); + } + + ForecastFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastFilter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.cs index a26ca63b8768..431bb6807632 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastFilter.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,31 @@ namespace Azure.ResourceManager.CostManagement.Models /// The filter expression to be used in the export. public partial class ForecastFilter { - /// Initializes a new instance of ForecastFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ForecastFilter() { And = new ChangeTrackingList(); Or = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The logical "AND" expression. Must have at least 2 items. + /// The logical "OR" expression. Must have at least 2 items. + /// Has comparison expression for a dimension. + /// Has comparison expression for a tag. + /// Keeps track of any properties unknown to the library. + internal ForecastFilter(IList and, IList or, ForecastComparisonExpression dimensions, ForecastComparisonExpression tags, Dictionary serializedAdditionalRawData) + { + And = and; + Or = or; + Dimensions = dimensions; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The logical "AND" expression. Must have at least 2 items. public IList And { get; } /// The logical "OR" expression. Must have at least 2 items. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.Serialization.cs index 581111eef022..c2f521f1e8ab 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.Serialization.cs @@ -10,11 +10,291 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastResult + public partial class ForecastResult : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Columns)) + { + writer.WritePropertyName("columns"u8); + writer.WriteStartArray(); + foreach (var item in Columns) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Rows)) + { + writer.WritePropertyName("rows"u8); + writer.WriteStartArray(); + foreach (var item in Rows) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartArray(); + foreach (var item0 in item) + { + if (item0 == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item0); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item0.ToString()).RootElement); +#endif + } + writer.WriteEndArray(); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ForecastResult DeserializeForecastResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional sku = default; + Optional eTag = default; + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional nextLink = default; + Optional> columns = default; + Optional>> rows = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("nextLink"u8)) + { + nextLink = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("columns"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ForecastColumn.DeserializeForecastColumn(item)); + } + columns = array; + continue; + } + if (property0.NameEquals("rows"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List> array = new List>(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + if (item0.ValueKind == JsonValueKind.Null) + { + array0.Add(null); + } + else + { + array0.Add(BinaryData.FromString(item0.GetRawText())); + } + } + array.Add(array0); + } + } + rows = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastResult(id, name, type, systemData.Value, nextLink.Value, Optional.ToList(columns), Optional.ToList(rows), Optional.ToNullable(location), sku.Value, Optional.ToNullable(eTag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + ForecastResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.cs index abea012f9192..327afc8ba3e3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of forecast. It contains all columns listed under groupings and aggregation. public partial class ForecastResult : ResourceData { - /// Initializes a new instance of ForecastResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ForecastResult() { Columns = new ChangeTrackingList(); @@ -24,7 +27,7 @@ internal ForecastResult() Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ForecastResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +39,8 @@ internal ForecastResult() /// SKU of the resource. /// ETag of the resource. /// Resource tags. - internal ForecastResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string nextLink, IReadOnlyList columns, IReadOnlyList> rows, AzureLocation? location, string sku, ETag? eTag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ForecastResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string nextLink, IReadOnlyList columns, IReadOnlyList> rows, AzureLocation? location, string sku, ETag? eTag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { NextLink = nextLink; Columns = columns; @@ -45,6 +49,7 @@ internal ForecastResult(ResourceIdentifier id, string name, ResourceType resourc Sku = sku; ETag = eTag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link (url) to the next page of results. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.Serialization.cs index 57da90628663..e42fdfbacb3e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ForecastTimePeriod : IUtf8JsonSerializable + public partial class ForecastTimePeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("from"u8); writer.WriteStringValue(From, "O"); writer.WritePropertyName("to"u8); writer.WriteStringValue(To, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ForecastTimePeriod DeserializeForecastTimePeriod(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset @from = default; + DateTimeOffset to = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("from"u8)) + { + @from = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("to"u8)) + { + to = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ForecastTimePeriod(@from, to, serializedAdditionalRawData); + } + + ForecastTimePeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForecastTimePeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForecastTimePeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForecastTimePeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForecastTimePeriod model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForecastTimePeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForecastTimePeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.cs index 41b96ccc16da..850e5a1b5212 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastTimePeriod.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// Has time period for pulling data for the forecast. public partial class ForecastTimePeriod { - /// Initializes a new instance of ForecastTimePeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date to pull data from. /// The end date to pull data to. public ForecastTimePeriod(DateTimeOffset @from, DateTimeOffset to) @@ -21,6 +25,22 @@ public ForecastTimePeriod(DateTimeOffset @from, DateTimeOffset to) To = to; } + /// Initializes a new instance of . + /// The start date to pull data from. + /// The end date to pull data to. + /// Keeps track of any properties unknown to the library. + internal ForecastTimePeriod(DateTimeOffset @from, DateTimeOffset to, Dictionary serializedAdditionalRawData) + { + From = @from; + To = to; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ForecastTimePeriod() + { + } + /// The start date to pull data from. public DateTimeOffset From { get; } /// The end date to pull data to. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.Serialization.cs index c4483d174b9d..5129c37d6abe 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class IncludedQuantityUtilizationSummary : IUtf8JsonSerializable + public partial class IncludedQuantityUtilizationSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(BenefitType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IncludedQuantityUtilizationSummary DeserializeIncludedQuantityUtilizationSummary(JsonElement element) + internal static IncludedQuantityUtilizationSummary DeserializeIncludedQuantityUtilizationSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +68,7 @@ internal static IncludedQuantityUtilizationSummary DeserializeIncludedQuantityUt Optional benefitType = default; Optional usageDate = default; Optional utilizationPercentage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -132,8 +154,61 @@ internal static IncludedQuantityUtilizationSummary DeserializeIncludedQuantityUt } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IncludedQuantityUtilizationSummary(id, name, type, systemData.Value, kind, armSkuName.Value, benefitId.Value, benefitOrderId.Value, Optional.ToNullable(benefitType), Optional.ToNullable(usageDate), Optional.ToNullable(utilizationPercentage), serializedAdditionalRawData); + } + + IncludedQuantityUtilizationSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIncludedQuantityUtilizationSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IncludedQuantityUtilizationSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIncludedQuantityUtilizationSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IncludedQuantityUtilizationSummary model) + { + if (model is null) + { + return null; } - return new IncludedQuantityUtilizationSummary(id, name, type, systemData.Value, kind, armSkuName.Value, benefitId.Value, benefitOrderId.Value, Optional.ToNullable(benefitType), Optional.ToNullable(usageDate), Optional.ToNullable(utilizationPercentage)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IncludedQuantityUtilizationSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIncludedQuantityUtilizationSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.cs index 636ba4a95eff..7bd61174c106 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/IncludedQuantityUtilizationSummary.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,13 @@ namespace Azure.ResourceManager.CostManagement.Models /// Included Quantity utilization summary resource. public partial class IncludedQuantityUtilizationSummary : BenefitUtilizationSummary { - /// Initializes a new instance of IncludedQuantityUtilizationSummary. + /// Initializes a new instance of . public IncludedQuantityUtilizationSummary() { Kind = BillingAccountBenefitKind.IncludedQuantity; } - /// Initializes a new instance of IncludedQuantityUtilizationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -32,7 +33,8 @@ public IncludedQuantityUtilizationSummary() /// The benefit type. Supported values: 'SavingsPlan'. /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. /// This is the utilized percentage for the benefit ID. - internal IncludedQuantityUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind, string armSkuName, string benefitId, string benefitOrderId, BillingAccountBenefitKind? benefitType, DateTimeOffset? usageOn, decimal? utilizationPercentage) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal IncludedQuantityUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind, string armSkuName, string benefitId, string benefitOrderId, BillingAccountBenefitKind? benefitType, DateTimeOffset? usageOn, decimal? utilizationPercentage, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { ArmSkuName = armSkuName; BenefitId = benefitId; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.Serialization.cs index cb8de62adc2c..abed0112b4f9 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class NotificationProperties : IUtf8JsonSerializable + public partial class NotificationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("to"u8); writer.WriteStartArray(); @@ -40,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("subject"u8); writer.WriteStringValue(Subject); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NotificationProperties DeserializeNotificationProperties(JsonElement element) + internal static NotificationProperties DeserializeNotificationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +75,7 @@ internal static NotificationProperties DeserializeNotificationProperties(JsonEle Optional message = default; Optional regionalFormat = default; string subject = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("to"u8)) @@ -86,8 +108,61 @@ internal static NotificationProperties DeserializeNotificationProperties(JsonEle subject = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NotificationProperties(to, language.Value, message.Value, regionalFormat.Value, subject, serializedAdditionalRawData); + } + + NotificationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NotificationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNotificationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NotificationProperties model) + { + if (model is null) + { + return null; } - return new NotificationProperties(to, language.Value, message.Value, regionalFormat.Value, subject); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NotificationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNotificationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.cs index 9d8c4ca72380..128720a62661 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/NotificationProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The properties of the scheduled action notification. public partial class NotificationProperties { - /// Initializes a new instance of NotificationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array of email addresses. /// Subject of the email. Length is limited to 70 characters. /// or is null. @@ -28,19 +31,26 @@ public NotificationProperties(IEnumerable to, string subject) Subject = subject; } - /// Initializes a new instance of NotificationProperties. + /// Initializes a new instance of . /// Array of email addresses. /// Locale of the email. /// Optional message to be added in the email. Length is limited to 250 characters. /// Regional format used for formatting date/time and currency values in the email. /// Subject of the email. Length is limited to 70 characters. - internal NotificationProperties(IList to, string language, string message, string regionalFormat, string subject) + /// Keeps track of any properties unknown to the library. + internal NotificationProperties(IList to, string language, string message, string regionalFormat, string subject, Dictionary serializedAdditionalRawData) { To = to; Language = language; Message = message; RegionalFormat = regionalFormat; Subject = subject; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NotificationProperties() + { } /// Array of email addresses. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.Serialization.cs index cd88020815e0..a3f87aad65da 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.Serialization.cs @@ -6,15 +6,60 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class OperationStatus + public partial class OperationStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OperationStatus DeserializeOperationStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ReportUri)) + { + writer.WritePropertyName("reportUrl"u8); + writer.WriteStringValue(ReportUri.Value.ToString()); + } + if (Optional.IsDefined(ValidUntil)) + { + writer.WritePropertyName("validUntil"u8); + writer.WriteStringValue(ValidUntil.Value, "O"); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OperationStatus DeserializeOperationStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +67,7 @@ internal static OperationStatus DeserializeOperationStatus(JsonElement element) Optional status = default; Optional reportUrl = default; Optional validUntil = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -63,8 +109,61 @@ internal static OperationStatus DeserializeOperationStatus(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OperationStatus(Optional.ToNullable(status), Optional.ToNullable(reportUrl), Optional.ToNullable(validUntil)); + return new OperationStatus(Optional.ToNullable(status), Optional.ToNullable(reportUrl), Optional.ToNullable(validUntil), serializedAdditionalRawData); + } + + OperationStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOperationStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OperationStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOperationStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OperationStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OperationStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOperationStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.cs index 3f50a15e591c..c211c25ca09d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatus.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The status of the long running operation. public partial class OperationStatus { - /// Initializes a new instance of OperationStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OperationStatus() { } - /// Initializes a new instance of OperationStatus. + /// Initializes a new instance of . /// The status of the long running operation. /// The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity. /// The time at which report URL becomes invalid. - internal OperationStatus(OperationStatusType? status, ReservationReportSchema? reportUri, DateTimeOffset? validUntil) + /// Keeps track of any properties unknown to the library. + internal OperationStatus(OperationStatusType? status, ReservationReportSchema? reportUri, DateTimeOffset? validUntil, Dictionary serializedAdditionalRawData) { Status = status; ReportUri = reportUri; ValidUntil = validUntil; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The status of the long running operation. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.Serialization.cs index 5940dca95afe..d555825bb316 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryAggregation : IUtf8JsonSerializable + public partial class QueryAggregation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("function"u8); writer.WriteStringValue(Function.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryAggregation DeserializeQueryAggregation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + FunctionType function = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("function"u8)) + { + function = new FunctionType(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryAggregation(name, function, serializedAdditionalRawData); + } + + QueryAggregation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryAggregation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryAggregation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryAggregation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryAggregation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryAggregation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryAggregation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.cs index ae8103239055..b3507759cbdc 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryAggregation.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The aggregation expression to be used in the query. public partial class QueryAggregation { - /// Initializes a new instance of QueryAggregation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to aggregate. /// The name of the aggregation function to use. /// is null. @@ -25,6 +29,22 @@ public QueryAggregation(string name, FunctionType function) Function = function; } + /// Initializes a new instance of . + /// The name of the column to aggregate. + /// The name of the aggregation function to use. + /// Keeps track of any properties unknown to the library. + internal QueryAggregation(string name, FunctionType function, Dictionary serializedAdditionalRawData) + { + Name = name; + Function = function; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueryAggregation() + { + } + /// The name of the column to aggregate. public string Name { get; } /// The name of the aggregation function to use. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.Serialization.cs index b6cb840d0924..4c93d6886d6e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryColumn + public partial class QueryColumn : IUtf8JsonSerializable, IModelJsonSerializable { - internal static QueryColumn DeserializeQueryColumn(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(QueryColumnType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(QueryColumnType); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static QueryColumn DeserializeQueryColumn(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static QueryColumn DeserializeQueryColumn(JsonElement element) type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new QueryColumn(name.Value, type.Value); + return new QueryColumn(name.Value, type.Value, serializedAdditionalRawData); + } + + QueryColumn IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryColumn(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryColumn IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryColumn(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryColumn model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryColumn(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryColumn(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.cs index eeefc630145d..4f4c4a04ce60 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryColumn.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// QueryColumn properties. public partial class QueryColumn { - /// Initializes a new instance of QueryColumn. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal QueryColumn() { } - /// Initializes a new instance of QueryColumn. + /// Initializes a new instance of . /// The name of column. /// The type of column. - internal QueryColumn(string name, string queryColumnType) + /// Keeps track of any properties unknown to the library. + internal QueryColumn(string name, string queryColumnType, Dictionary serializedAdditionalRawData) { Name = name; QueryColumnType = queryColumnType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of column. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.Serialization.cs index 138ad610b816..aa7be72c8f58 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryComparisonExpression : IUtf8JsonSerializable + public partial class QueryComparisonExpression : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -26,7 +34,110 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryComparisonExpression DeserializeQueryComparisonExpression(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + QueryOperatorType @operator = default; + IList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = new QueryOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryComparisonExpression(name, @operator, values, serializedAdditionalRawData); + } + + QueryComparisonExpression IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryComparisonExpression(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryComparisonExpression IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryComparisonExpression(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryComparisonExpression model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryComparisonExpression(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryComparisonExpression(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.cs index e1a8df013b40..9fe91ad15f97 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryComparisonExpression.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The comparison expression to be used in the query. public partial class QueryComparisonExpression { - /// Initializes a new instance of QueryComparisonExpression. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to use in comparison. /// The operator to use for comparison. /// Array of values to use for comparison. @@ -30,6 +33,24 @@ public QueryComparisonExpression(string name, QueryOperatorType @operator, IEnum Values = values.ToList(); } + /// Initializes a new instance of . + /// The name of the column to use in comparison. + /// The operator to use for comparison. + /// Array of values to use for comparison. + /// Keeps track of any properties unknown to the library. + internal QueryComparisonExpression(string name, QueryOperatorType @operator, IList values, Dictionary serializedAdditionalRawData) + { + Name = name; + Operator = @operator; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueryComparisonExpression() + { + } + /// The name of the column to use in comparison. public string Name { get; } /// The operator to use for comparison. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.Serialization.cs index 02c47f822a4c..6cc86401474f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryDataset : IUtf8JsonSerializable + public partial class QueryDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Granularity)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Aggregation)) { @@ -32,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Aggregation) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -42,16 +64,170 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Grouping) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Filter)) { writer.WritePropertyName("filter"u8); - writer.WriteObjectValue(Filter); + if (Filter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Filter).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static QueryDataset DeserializeQueryDataset(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional granularity = default; + Optional configuration = default; + Optional> aggregation = default; + Optional> grouping = default; + Optional filter = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("granularity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + granularity = new GranularityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = QueryDatasetConfiguration.DeserializeQueryDatasetConfiguration(property.Value); + continue; + } + if (property.NameEquals("aggregation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, QueryAggregation.DeserializeQueryAggregation(property0.Value)); + } + aggregation = dictionary; + continue; + } + if (property.NameEquals("grouping"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryGrouping.DeserializeQueryGrouping(item)); + } + grouping = array; + continue; + } + if (property.NameEquals("filter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filter = QueryFilter.DeserializeQueryFilter(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryDataset(Optional.ToNullable(granularity), configuration.Value, Optional.ToDictionary(aggregation), Optional.ToList(grouping), filter.Value, serializedAdditionalRawData); + } + + QueryDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.cs index 63896c6008e8..66aa354613f1 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDataset.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,33 @@ namespace Azure.ResourceManager.CostManagement.Models /// The definition of data present in the query. public partial class QueryDataset { - /// Initializes a new instance of QueryDataset. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public QueryDataset() { Aggregation = new ChangeTrackingDictionary(); Grouping = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The granularity of rows in the query. + /// Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. + /// Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses. + /// Array of group by expression to use in the query. Query can have up to 2 group by clauses. + /// The filter expression to use in the query. Please reference our Query API REST documentation for how to properly format the filter. + /// Keeps track of any properties unknown to the library. + internal QueryDataset(GranularityType? granularity, QueryDatasetConfiguration configuration, IDictionary aggregation, IList grouping, QueryFilter filter, Dictionary serializedAdditionalRawData) + { + Granularity = granularity; + Configuration = configuration; + Aggregation = aggregation; + Grouping = grouping; + Filter = filter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The granularity of rows in the query. public GranularityType? Granularity { get; set; } /// Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.Serialization.cs index b8104b5e5060..afae6dbf9675 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class QueryDatasetConfiguration : IUtf8JsonSerializable + internal partial class QueryDatasetConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Columns)) { @@ -25,7 +33,102 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryDatasetConfiguration DeserializeQueryDatasetConfiguration(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> columns = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("columns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + columns = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryDatasetConfiguration(Optional.ToList(columns), serializedAdditionalRawData); + } + + QueryDatasetConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryDatasetConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryDatasetConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryDatasetConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryDatasetConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryDatasetConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryDatasetConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs index f953516e3672..d7db868bd187 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// The configuration of dataset in the query. internal partial class QueryDatasetConfiguration { - /// Initializes a new instance of QueryDatasetConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public QueryDatasetConfiguration() { Columns = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns. + /// Keeps track of any properties unknown to the library. + internal QueryDatasetConfiguration(IList columns, Dictionary serializedAdditionalRawData) + { + Columns = columns; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns. public IList Columns { get; } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.Serialization.cs index 7844b331cf63..722f7a544109 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryDefinition : IUtf8JsonSerializable + public partial class QueryDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ExportType.ToString()); @@ -22,11 +30,133 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TimePeriod)) { writer.WritePropertyName("timePeriod"u8); - writer.WriteObjectValue(TimePeriod); + if (TimePeriod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TimePeriod).Serialize(writer, options); + } } writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryDefinition DeserializeQueryDefinition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExportType type = default; + TimeframeType timeframe = default; + Optional timePeriod = default; + QueryDataset dataset = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new ExportType(property.Value.GetString()); + continue; + } + if (property.NameEquals("timeframe"u8)) + { + timeframe = new TimeframeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("timePeriod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timePeriod = QueryTimePeriod.DeserializeQueryTimePeriod(property.Value); + continue; + } + if (property.NameEquals("dataset"u8)) + { + dataset = QueryDataset.DeserializeQueryDataset(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryDefinition(type, timeframe, timePeriod.Value, dataset, serializedAdditionalRawData); + } + + QueryDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.cs index 3e6d5efff24e..0626efebb583 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryDefinition.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The definition of a query. public partial class QueryDefinition { - /// Initializes a new instance of QueryDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of the query. /// The time frame for pulling data for the query. If custom, then a specific time period must be provided. /// Has definition for data in this query. @@ -27,6 +31,26 @@ public QueryDefinition(ExportType exportType, TimeframeType timeframe, QueryData Dataset = dataset; } + /// Initializes a new instance of . + /// The type of the query. + /// The time frame for pulling data for the query. If custom, then a specific time period must be provided. + /// Has time period for pulling data for the query. + /// Has definition for data in this query. + /// Keeps track of any properties unknown to the library. + internal QueryDefinition(ExportType exportType, TimeframeType timeframe, QueryTimePeriod timePeriod, QueryDataset dataset, Dictionary serializedAdditionalRawData) + { + ExportType = exportType; + Timeframe = timeframe; + TimePeriod = timePeriod; + Dataset = dataset; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueryDefinition() + { + } + /// The type of the query. public ExportType ExportType { get; } /// The time frame for pulling data for the query. If custom, then a specific time period must be provided. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.Serialization.cs index 3739684190d7..eb3dc76cd2e3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryFilter : IUtf8JsonSerializable + public partial class QueryFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(And)) { @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in And) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -31,21 +46,172 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Or) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Dimensions)) { writer.WritePropertyName("dimensions"u8); - writer.WriteObjectValue(Dimensions); + if (Dimensions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dimensions).Serialize(writer, options); + } } if (Optional.IsDefined(Tags)) { writer.WritePropertyName("tags"u8); - writer.WriteObjectValue(Tags); + if (Tags is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tags).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static QueryFilter DeserializeQueryFilter(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> and = default; + Optional> or = default; + Optional dimensions = default; + Optional tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("and"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeQueryFilter(item)); + } + and = array; + continue; + } + if (property.NameEquals("or"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeQueryFilter(item)); + } + or = array; + continue; + } + if (property.NameEquals("dimensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dimensions = QueryComparisonExpression.DeserializeQueryComparisonExpression(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tags = QueryComparisonExpression.DeserializeQueryComparisonExpression(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryFilter(Optional.ToList(and), Optional.ToList(or), dimensions.Value, tags.Value, serializedAdditionalRawData); + } + + QueryFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryFilter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.cs index 9e0a24022846..c2c927a7f379 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryFilter.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,31 @@ namespace Azure.ResourceManager.CostManagement.Models /// The filter expression to be used in the export. public partial class QueryFilter { - /// Initializes a new instance of QueryFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public QueryFilter() { And = new ChangeTrackingList(); Or = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The logical "AND" expression. Must have at least 2 items. + /// The logical "OR" expression. Must have at least 2 items. + /// Has comparison expression for a dimension. + /// Has comparison expression for a tag. + /// Keeps track of any properties unknown to the library. + internal QueryFilter(IList and, IList or, QueryComparisonExpression dimensions, QueryComparisonExpression tags, Dictionary serializedAdditionalRawData) + { + And = and; + Or = or; + Dimensions = dimensions; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The logical "AND" expression. Must have at least 2 items. public IList And { get; } /// The logical "OR" expression. Must have at least 2 items. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.Serialization.cs index 45619125c53c..b2bf73f9828c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryGrouping : IUtf8JsonSerializable + public partial class QueryGrouping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ColumnType.ToString()); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryGrouping DeserializeQueryGrouping(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + QueryColumnType type = default; + string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new QueryColumnType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryGrouping(type, name, serializedAdditionalRawData); + } + + QueryGrouping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryGrouping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryGrouping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryGrouping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryGrouping model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryGrouping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryGrouping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.cs index ea85fbc3e484..f905cde9fa1d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryGrouping.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The group by expression to be used in the query. public partial class QueryGrouping { - /// Initializes a new instance of QueryGrouping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Has type of the column to group. /// The name of the column to group. /// is null. @@ -25,6 +29,22 @@ public QueryGrouping(QueryColumnType columnType, string name) Name = name; } + /// Initializes a new instance of . + /// Has type of the column to group. + /// The name of the column to group. + /// Keeps track of any properties unknown to the library. + internal QueryGrouping(QueryColumnType columnType, string name, Dictionary serializedAdditionalRawData) + { + ColumnType = columnType; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueryGrouping() + { + } + /// Has type of the column to group. public QueryColumnType ColumnType { get; } /// The name of the column to group. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.Serialization.cs index 2375c65a7885..323440b30411 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.Serialization.cs @@ -10,11 +10,291 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryResult + public partial class QueryResult : IUtf8JsonSerializable, IModelJsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Columns)) + { + writer.WritePropertyName("columns"u8); + writer.WriteStartArray(); + foreach (var item in Columns) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Rows)) + { + writer.WritePropertyName("rows"u8); + writer.WriteStartArray(); + foreach (var item in Rows) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartArray(); + foreach (var item0 in item) + { + if (item0 == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item0); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item0.ToString()).RootElement); +#endif + } + writer.WriteEndArray(); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static QueryResult DeserializeQueryResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional sku = default; + Optional eTag = default; + Optional> tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional nextLink = default; + Optional> columns = default; + Optional>> rows = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("nextLink"u8)) + { + nextLink = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("columns"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(QueryColumn.DeserializeQueryColumn(item)); + } + columns = array; + continue; + } + if (property0.NameEquals("rows"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List> array = new List>(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + if (item0.ValueKind == JsonValueKind.Null) + { + array0.Add(null); + } + else + { + array0.Add(BinaryData.FromString(item0.GetRawText())); + } + } + array.Add(array0); + } + } + rows = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryResult(id, name, type, systemData.Value, nextLink.Value, Optional.ToList(columns), Optional.ToList(rows), Optional.ToNullable(location), sku.Value, Optional.ToNullable(eTag), Optional.ToDictionary(tags), serializedAdditionalRawData); + } + + QueryResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.cs index 40c8651e2f68..ac92f702672e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of query. It contains all columns listed under groupings and aggregation. public partial class QueryResult : ResourceData { - /// Initializes a new instance of QueryResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal QueryResult() { Columns = new ChangeTrackingList(); @@ -24,7 +27,7 @@ internal QueryResult() Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of QueryResult. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +39,8 @@ internal QueryResult() /// SKU of the resource. /// ETag of the resource. /// Resource tags. - internal QueryResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string nextLink, IReadOnlyList columns, IReadOnlyList> rows, AzureLocation? location, string sku, ETag? eTag, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal QueryResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string nextLink, IReadOnlyList columns, IReadOnlyList> rows, AzureLocation? location, string sku, ETag? eTag, IReadOnlyDictionary tags, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { NextLink = nextLink; Columns = columns; @@ -45,6 +49,7 @@ internal QueryResult(ResourceIdentifier id, string name, ResourceType resourceTy Sku = sku; ETag = eTag; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The link (url) to the next page of results. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.Serialization.cs index 0e9bc921c69c..5b105cde692c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class QueryTimePeriod : IUtf8JsonSerializable + public partial class QueryTimePeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("from"u8); writer.WriteStringValue(From, "O"); writer.WritePropertyName("to"u8); writer.WriteStringValue(To, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static QueryTimePeriod DeserializeQueryTimePeriod(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset @from = default; + DateTimeOffset to = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("from"u8)) + { + @from = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("to"u8)) + { + to = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new QueryTimePeriod(@from, to, serializedAdditionalRawData); + } + + QueryTimePeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQueryTimePeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QueryTimePeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQueryTimePeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QueryTimePeriod model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QueryTimePeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQueryTimePeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.cs index 6796a6e0083c..e084e52392df 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/QueryTimePeriod.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The start and end date for pulling data for the query. public partial class QueryTimePeriod { - /// Initializes a new instance of QueryTimePeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date to pull data from. /// The end date to pull data to. public QueryTimePeriod(DateTimeOffset @from, DateTimeOffset to) @@ -21,6 +25,22 @@ public QueryTimePeriod(DateTimeOffset @from, DateTimeOffset to) To = to; } + /// Initializes a new instance of . + /// The start date to pull data from. + /// The end date to pull data to. + /// Keeps track of any properties unknown to the library. + internal QueryTimePeriod(DateTimeOffset @from, DateTimeOffset to, Dictionary serializedAdditionalRawData) + { + From = @from; + To = to; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QueryTimePeriod() + { + } + /// The start date to pull data from. public DateTimeOffset From { get; } /// The end date to pull data to. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.Serialization.cs index fef986f9c406..5a14a929f848 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.Serialization.cs @@ -5,33 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class RecommendationUsageDetails : IUtf8JsonSerializable + public partial class RecommendationUsageDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UsageGrain)) { writer.WritePropertyName("usageGrain"u8); writer.WriteStringValue(UsageGrain.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RecommendationUsageDetails DeserializeRecommendationUsageDetails(JsonElement element) + internal static RecommendationUsageDetails DeserializeRecommendationUsageDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional usageGrain = default; Optional> charges = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("usageGrain"u8)) @@ -57,8 +79,61 @@ internal static RecommendationUsageDetails DeserializeRecommendationUsageDetails charges = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RecommendationUsageDetails(Optional.ToNullable(usageGrain), Optional.ToList(charges), serializedAdditionalRawData); + } + + RecommendationUsageDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRecommendationUsageDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RecommendationUsageDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRecommendationUsageDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RecommendationUsageDetails model) + { + if (model is null) + { + return null; } - return new RecommendationUsageDetails(Optional.ToNullable(usageGrain), Optional.ToList(charges)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RecommendationUsageDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRecommendationUsageDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.cs index 8facfa2f3157..9721750a5cb8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RecommendationUsageDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. public partial class RecommendationUsageDetails { - /// Initializes a new instance of RecommendationUsageDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RecommendationUsageDetails() { Charges = new ChangeTrackingList(); } - /// Initializes a new instance of RecommendationUsageDetails. + /// Initializes a new instance of . /// The grain of the usage. Supported values: 'Hourly'. /// On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. - internal RecommendationUsageDetails(BenefitRecommendationUsageGrain? usageGrain, IReadOnlyList charges) + /// Keeps track of any properties unknown to the library. + internal RecommendationUsageDetails(BenefitRecommendationUsageGrain? usageGrain, IReadOnlyList charges, Dictionary serializedAdditionalRawData) { UsageGrain = usageGrain; Charges = charges; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The grain of the usage. Supported values: 'Hourly'. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.Serialization.cs index dc279e6d34d3..e41fc82c3ad8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigAggregation : IUtf8JsonSerializable + public partial class ReportConfigAggregation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("function"u8); writer.WriteStringValue(Function.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportConfigAggregation DeserializeReportConfigAggregation(JsonElement element) + internal static ReportConfigAggregation DeserializeReportConfigAggregation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; FunctionType function = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +65,61 @@ internal static ReportConfigAggregation DeserializeReportConfigAggregation(JsonE function = new FunctionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigAggregation(name, function, serializedAdditionalRawData); + } + + ReportConfigAggregation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigAggregation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigAggregation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigAggregation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigAggregation model) + { + if (model is null) + { + return null; } - return new ReportConfigAggregation(name, function); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigAggregation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigAggregation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.cs index 673f6698ef4d..bc86bd161ed2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigAggregation.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The aggregation expression to be used in the report. public partial class ReportConfigAggregation { - /// Initializes a new instance of ReportConfigAggregation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to aggregate. /// The name of the aggregation function to use. /// is null. @@ -25,6 +29,22 @@ public ReportConfigAggregation(string name, FunctionType function) Function = function; } + /// Initializes a new instance of . + /// The name of the column to aggregate. + /// The name of the aggregation function to use. + /// Keeps track of any properties unknown to the library. + internal ReportConfigAggregation(string name, FunctionType function, Dictionary serializedAdditionalRawData) + { + Name = name; + Function = function; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportConfigAggregation() + { + } + /// The name of the column to aggregate. public string Name { get; set; } /// The name of the aggregation function to use. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.Serialization.cs index f5722154b2de..beab532f46e8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigComparisonExpression : IUtf8JsonSerializable + public partial class ReportConfigComparisonExpression : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportConfigComparisonExpression DeserializeReportConfigComparisonExpression(JsonElement element) + internal static ReportConfigComparisonExpression DeserializeReportConfigComparisonExpression(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static ReportConfigComparisonExpression DeserializeReportConfigComparis string name = default; ComparisonOperatorType @operator = default; IList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -61,8 +83,61 @@ internal static ReportConfigComparisonExpression DeserializeReportConfigComparis values = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigComparisonExpression(name, @operator, values, serializedAdditionalRawData); + } + + ReportConfigComparisonExpression IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigComparisonExpression(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigComparisonExpression IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigComparisonExpression(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigComparisonExpression model) + { + if (model is null) + { + return null; } - return new ReportConfigComparisonExpression(name, @operator, values); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigComparisonExpression(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigComparisonExpression(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs index e15eb2c6169a..806f7b8df654 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The comparison expression to be used in the report. public partial class ReportConfigComparisonExpression { - /// Initializes a new instance of ReportConfigComparisonExpression. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to use in comparison. /// The operator to use for comparison. /// Array of values to use for comparison. @@ -30,15 +33,22 @@ public ReportConfigComparisonExpression(string name, ComparisonOperatorType @ope Values = values.ToList(); } - /// Initializes a new instance of ReportConfigComparisonExpression. + /// Initializes a new instance of . /// The name of the column to use in comparison. /// The operator to use for comparison. /// Array of values to use for comparison. - internal ReportConfigComparisonExpression(string name, ComparisonOperatorType @operator, IList values) + /// Keeps track of any properties unknown to the library. + internal ReportConfigComparisonExpression(string name, ComparisonOperatorType @operator, IList values, Dictionary serializedAdditionalRawData) { Name = name; Operator = @operator; Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportConfigComparisonExpression() + { } /// The name of the column to use in comparison. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.Serialization.cs index f93d97995109..51d56df8df6e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigDataset : IUtf8JsonSerializable + public partial class ReportConfigDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Granularity)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Configuration)) { writer.WritePropertyName("configuration"u8); - writer.WriteObjectValue(Configuration); + if (Configuration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Configuration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Aggregation)) { @@ -33,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Aggregation) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -43,7 +64,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Grouping) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,20 +81,48 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sorting) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Filter)) { writer.WritePropertyName("filter"u8); - writer.WriteObjectValue(Filter); + if (Filter is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Filter).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ReportConfigDataset DeserializeReportConfigDataset(JsonElement element) + internal static ReportConfigDataset DeserializeReportConfigDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -77,6 +133,7 @@ internal static ReportConfigDataset DeserializeReportConfigDataset(JsonElement e Optional> grouping = default; Optional> sorting = default; Optional filter = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("granularity"u8)) @@ -148,8 +205,61 @@ internal static ReportConfigDataset DeserializeReportConfigDataset(JsonElement e filter = ReportConfigFilter.DeserializeReportConfigFilter(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigDataset(Optional.ToNullable(granularity), configuration.Value, Optional.ToDictionary(aggregation), Optional.ToList(grouping), Optional.ToList(sorting), filter.Value, serializedAdditionalRawData); + } + + ReportConfigDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigDataset(Response response) + { + if (response is null) + { + return null; } - return new ReportConfigDataset(Optional.ToNullable(granularity), configuration.Value, Optional.ToDictionary(aggregation), Optional.ToList(grouping), Optional.ToList(sorting), filter.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.cs index 3f658c1ac3cb..2b0d5a36ce4d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDataset.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The definition of data present in the report. public partial class ReportConfigDataset { - /// Initializes a new instance of ReportConfigDataset. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReportConfigDataset() { Aggregation = new ChangeTrackingDictionary(); @@ -21,14 +25,15 @@ public ReportConfigDataset() Sorting = new ChangeTrackingList(); } - /// Initializes a new instance of ReportConfigDataset. + /// Initializes a new instance of . /// The granularity of rows in the report. /// Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided. /// Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the aggregated column. Report can have up to 2 aggregation clauses. /// Array of group by expression to use in the report. Report can have up to 2 group by clauses. /// Array of order by expression to use in the report. /// Has filter expression to use in the report. - internal ReportConfigDataset(ReportGranularityType? granularity, ReportConfigDatasetConfiguration configuration, IDictionary aggregation, IList grouping, IList sorting, ReportConfigFilter filter) + /// Keeps track of any properties unknown to the library. + internal ReportConfigDataset(ReportGranularityType? granularity, ReportConfigDatasetConfiguration configuration, IDictionary aggregation, IList grouping, IList sorting, ReportConfigFilter filter, Dictionary serializedAdditionalRawData) { Granularity = granularity; Configuration = configuration; @@ -36,6 +41,7 @@ internal ReportConfigDataset(ReportGranularityType? granularity, ReportConfigDat Grouping = grouping; Sorting = sorting; Filter = filter; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The granularity of rows in the report. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.Serialization.cs index ab79ca7fd138..9dfe52dfbdfb 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ReportConfigDatasetConfiguration : IUtf8JsonSerializable + internal partial class ReportConfigDatasetConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Columns)) { @@ -26,16 +33,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportConfigDatasetConfiguration DeserializeReportConfigDatasetConfiguration(JsonElement element) + internal static ReportConfigDatasetConfiguration DeserializeReportConfigDatasetConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> columns = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("columns"u8)) @@ -52,8 +74,61 @@ internal static ReportConfigDatasetConfiguration DeserializeReportConfigDatasetC columns = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigDatasetConfiguration(Optional.ToList(columns), serializedAdditionalRawData); + } + + ReportConfigDatasetConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigDatasetConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigDatasetConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigDatasetConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigDatasetConfiguration model) + { + if (model is null) + { + return null; } - return new ReportConfigDatasetConfiguration(Optional.ToList(columns)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigDatasetConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigDatasetConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs index b69c08b7b740..bf34ebc551a0 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.CostManagement.Models /// The configuration of dataset in the report. internal partial class ReportConfigDatasetConfiguration { - /// Initializes a new instance of ReportConfigDatasetConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReportConfigDatasetConfiguration() { Columns = new ChangeTrackingList(); } - /// Initializes a new instance of ReportConfigDatasetConfiguration. + /// Initializes a new instance of . /// Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns. - internal ReportConfigDatasetConfiguration(IList columns) + /// Keeps track of any properties unknown to the library. + internal ReportConfigDatasetConfiguration(IList columns, Dictionary serializedAdditionalRawData) { Columns = columns; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.Serialization.cs index 95ca1da89908..8c5a14354f46 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigFilter : IUtf8JsonSerializable + public partial class ReportConfigFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(And)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in And) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -32,25 +46,60 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Or) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Dimensions)) { writer.WritePropertyName("dimensions"u8); - writer.WriteObjectValue(Dimensions); + if (Dimensions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dimensions).Serialize(writer, options); + } } if (Optional.IsDefined(Tags)) { writer.WritePropertyName("tags"u8); - writer.WriteObjectValue(Tags); + if (Tags is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Tags).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ReportConfigFilter DeserializeReportConfigFilter(JsonElement element) + internal static ReportConfigFilter DeserializeReportConfigFilter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +108,7 @@ internal static ReportConfigFilter DeserializeReportConfigFilter(JsonElement ele Optional> or = default; Optional dimensions = default; Optional tags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("and"u8)) @@ -107,8 +157,61 @@ internal static ReportConfigFilter DeserializeReportConfigFilter(JsonElement ele tags = ReportConfigComparisonExpression.DeserializeReportConfigComparisonExpression(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ReportConfigFilter(Optional.ToList(and), Optional.ToList(or), dimensions.Value, tags.Value); + return new ReportConfigFilter(Optional.ToList(and), Optional.ToList(or), dimensions.Value, tags.Value, serializedAdditionalRawData); + } + + ReportConfigFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigFilter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.cs index 03d85e4bf57e..75214716044a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigFilter.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.CostManagement.Models /// The filter expression to be used in the report. public partial class ReportConfigFilter { - /// Initializes a new instance of ReportConfigFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReportConfigFilter() { And = new ChangeTrackingList(); Or = new ChangeTrackingList(); } - /// Initializes a new instance of ReportConfigFilter. + /// Initializes a new instance of . /// The logical "AND" expression. Must have at least 2 items. /// The logical "OR" expression. Must have at least 2 items. /// Has comparison expression for a dimension. /// Has comparison expression for a tag. - internal ReportConfigFilter(IList and, IList or, ReportConfigComparisonExpression dimensions, ReportConfigComparisonExpression tags) + /// Keeps track of any properties unknown to the library. + internal ReportConfigFilter(IList and, IList or, ReportConfigComparisonExpression dimensions, ReportConfigComparisonExpression tags, Dictionary serializedAdditionalRawData) { And = and; Or = or; Dimensions = dimensions; Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The logical "AND" expression. Must have at least 2 items. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.Serialization.cs index 5c667c761caa..2778c09f7d61 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigGrouping : IUtf8JsonSerializable + public partial class ReportConfigGrouping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(QueryColumnType.ToString()); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportConfigGrouping DeserializeReportConfigGrouping(JsonElement element) + internal static ReportConfigGrouping DeserializeReportConfigGrouping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } QueryColumnType type = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -42,8 +65,61 @@ internal static ReportConfigGrouping DeserializeReportConfigGrouping(JsonElement name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigGrouping(type, name, serializedAdditionalRawData); + } + + ReportConfigGrouping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigGrouping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigGrouping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigGrouping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigGrouping model) + { + if (model is null) + { + return null; } - return new ReportConfigGrouping(type, name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigGrouping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigGrouping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.cs index 2b3fdda6ac8f..b0bff17bdc84 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigGrouping.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The group by expression to be used in the report. public partial class ReportConfigGrouping { - /// Initializes a new instance of ReportConfigGrouping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Has type of the column to group. /// The name of the column to group. This version supports subscription lowest possible grain. /// is null. @@ -25,6 +29,22 @@ public ReportConfigGrouping(QueryColumnType queryColumnType, string name) Name = name; } + /// Initializes a new instance of . + /// Has type of the column to group. + /// The name of the column to group. This version supports subscription lowest possible grain. + /// Keeps track of any properties unknown to the library. + internal ReportConfigGrouping(QueryColumnType queryColumnType, string name, Dictionary serializedAdditionalRawData) + { + QueryColumnType = queryColumnType; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportConfigGrouping() + { + } + /// Has type of the column to group. public QueryColumnType QueryColumnType { get; set; } /// The name of the column to group. This version supports subscription lowest possible grain. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.Serialization.cs index 811859ac4197..cba708f787e6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigSorting : IUtf8JsonSerializable + public partial class ReportConfigSorting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Direction)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportConfigSorting DeserializeReportConfigSorting(JsonElement element) + internal static ReportConfigSorting DeserializeReportConfigSorting(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional direction = default; string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("direction"u8)) @@ -49,8 +72,61 @@ internal static ReportConfigSorting DeserializeReportConfigSorting(JsonElement e name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigSorting(Optional.ToNullable(direction), name, serializedAdditionalRawData); + } + + ReportConfigSorting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigSorting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigSorting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigSorting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigSorting model) + { + if (model is null) + { + return null; } - return new ReportConfigSorting(Optional.ToNullable(direction), name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigSorting(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigSorting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.cs index 9723fa3731d7..08e727658cc5 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigSorting.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The order by expression to be used in the report. public partial class ReportConfigSorting { - /// Initializes a new instance of ReportConfigSorting. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the column to sort. /// is null. public ReportConfigSorting(string name) @@ -23,13 +27,20 @@ public ReportConfigSorting(string name) Name = name; } - /// Initializes a new instance of ReportConfigSorting. + /// Initializes a new instance of . /// Direction of sort. /// The name of the column to sort. - internal ReportConfigSorting(ReportConfigSortingType? direction, string name) + /// Keeps track of any properties unknown to the library. + internal ReportConfigSorting(ReportConfigSortingType? direction, string name, Dictionary serializedAdditionalRawData) { Direction = direction; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportConfigSorting() + { } /// Direction of sort. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.Serialization.cs index 6a3ea9df165a..dbdd7ab10372 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ReportConfigTimePeriod : IUtf8JsonSerializable + public partial class ReportConfigTimePeriod : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("from"u8); writer.WriteStringValue(From, "O"); writer.WritePropertyName("to"u8); writer.WriteStringValue(To, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ReportConfigTimePeriod DeserializeReportConfigTimePeriod(JsonElement element) + internal static ReportConfigTimePeriod DeserializeReportConfigTimePeriod(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset @from = default; DateTimeOffset to = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("from"u8)) @@ -43,8 +65,61 @@ internal static ReportConfigTimePeriod DeserializeReportConfigTimePeriod(JsonEle to = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReportConfigTimePeriod(@from, to, serializedAdditionalRawData); + } + + ReportConfigTimePeriod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReportConfigTimePeriod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReportConfigTimePeriod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReportConfigTimePeriod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReportConfigTimePeriod model) + { + if (model is null) + { + return null; } - return new ReportConfigTimePeriod(@from, to); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReportConfigTimePeriod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReportConfigTimePeriod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs index 9fa88bc99cf9..02454df3d84d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs @@ -6,13 +6,17 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The start and end date for pulling data for the report. public partial class ReportConfigTimePeriod { - /// Initializes a new instance of ReportConfigTimePeriod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start date to pull data from. /// The end date to pull data to. public ReportConfigTimePeriod(DateTimeOffset @from, DateTimeOffset to) @@ -21,6 +25,22 @@ public ReportConfigTimePeriod(DateTimeOffset @from, DateTimeOffset to) To = to; } + /// Initializes a new instance of . + /// The start date to pull data from. + /// The end date to pull data to. + /// Keeps track of any properties unknown to the library. + internal ReportConfigTimePeriod(DateTimeOffset @from, DateTimeOffset to, Dictionary serializedAdditionalRawData) + { + From = @from; + To = to; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ReportConfigTimePeriod() + { + } + /// The start date to pull data from. public DateTimeOffset From { get; set; } /// The end date to pull data to. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.Serialization.cs index b4c74fba118e..7e54d55d4efd 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement.Models { - public partial class SavingsPlanUtilizationSummary : IUtf8JsonSerializable + public partial class SavingsPlanUtilizationSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -27,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(BenefitType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SavingsPlanUtilizationSummary DeserializeSavingsPlanUtilizationSummary(JsonElement element) + internal static SavingsPlanUtilizationSummary DeserializeSavingsPlanUtilizationSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static SavingsPlanUtilizationSummary DeserializeSavingsPlanUtilizationS Optional avgUtilizationPercentage = default; Optional minUtilizationPercentage = default; Optional maxUtilizationPercentage = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -152,8 +174,61 @@ internal static SavingsPlanUtilizationSummary DeserializeSavingsPlanUtilizationS } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SavingsPlanUtilizationSummary(id, name, type, systemData.Value, kind, armSkuName.Value, benefitId.Value, benefitOrderId.Value, Optional.ToNullable(benefitType), Optional.ToNullable(usageDate), Optional.ToNullable(avgUtilizationPercentage), Optional.ToNullable(minUtilizationPercentage), Optional.ToNullable(maxUtilizationPercentage), serializedAdditionalRawData); + } + + SavingsPlanUtilizationSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSavingsPlanUtilizationSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SavingsPlanUtilizationSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSavingsPlanUtilizationSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SavingsPlanUtilizationSummary model) + { + if (model is null) + { + return null; } - return new SavingsPlanUtilizationSummary(id, name, type, systemData.Value, kind, armSkuName.Value, benefitId.Value, benefitOrderId.Value, Optional.ToNullable(benefitType), Optional.ToNullable(usageDate), Optional.ToNullable(avgUtilizationPercentage), Optional.ToNullable(minUtilizationPercentage), Optional.ToNullable(maxUtilizationPercentage)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SavingsPlanUtilizationSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSavingsPlanUtilizationSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs index 787ee4e53399..82f97e1bb3d6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,13 +15,13 @@ namespace Azure.ResourceManager.CostManagement.Models /// Savings plan utilization summary resource. public partial class SavingsPlanUtilizationSummary : BenefitUtilizationSummary { - /// Initializes a new instance of SavingsPlanUtilizationSummary. + /// Initializes a new instance of . public SavingsPlanUtilizationSummary() { Kind = BillingAccountBenefitKind.SavingsPlan; } - /// Initializes a new instance of SavingsPlanUtilizationSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,7 +35,8 @@ public SavingsPlanUtilizationSummary() /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. - internal SavingsPlanUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind, string armSkuName, string benefitId, string benefitOrderId, BillingAccountBenefitKind? benefitType, DateTimeOffset? usageOn, decimal? avgUtilizationPercentage, decimal? minUtilizationPercentage, decimal? maxUtilizationPercentage) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal SavingsPlanUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind, string armSkuName, string benefitId, string benefitOrderId, BillingAccountBenefitKind? benefitType, DateTimeOffset? usageOn, decimal? avgUtilizationPercentage, decimal? minUtilizationPercentage, decimal? maxUtilizationPercentage, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { ArmSkuName = armSkuName; BenefitId = benefitId; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.Serialization.cs index 74376b73e9e4..c851627432e2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ScheduleProperties : IUtf8JsonSerializable + public partial class ScheduleProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("frequency"u8); writer.WriteStringValue(Frequency.ToString()); @@ -53,11 +59,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StartOn, "O"); writer.WritePropertyName("endDate"u8); writer.WriteStringValue(EndOn, "O"); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScheduleProperties DeserializeScheduleProperties(JsonElement element) + internal static ScheduleProperties DeserializeScheduleProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +89,7 @@ internal static ScheduleProperties DeserializeScheduleProperties(JsonElement ele Optional dayOfMonth = default; DateTimeOffset startDate = default; DateTimeOffset endDate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("frequency"u8)) @@ -132,8 +153,61 @@ internal static ScheduleProperties DeserializeScheduleProperties(JsonElement ele endDate = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScheduleProperties(frequency, Optional.ToNullable(hourOfDay), Optional.ToList(daysOfWeek), Optional.ToList(weeksOfMonth), Optional.ToNullable(dayOfMonth), startDate, endDate, serializedAdditionalRawData); + } + + ScheduleProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduleProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduleProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduleProperties model) + { + if (model is null) + { + return null; } - return new ScheduleProperties(frequency, Optional.ToNullable(hourOfDay), Optional.ToList(daysOfWeek), Optional.ToList(weeksOfMonth), Optional.ToNullable(dayOfMonth), startDate, endDate); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduleProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduleProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.cs index 7b2032463362..e285fb738f64 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduleProperties.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CostManagement.Models /// The properties of the schedule. public partial class ScheduleProperties { - /// Initializes a new instance of ScheduleProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Frequency of the schedule. /// The start date and time of the scheduled action (UTC). /// The end date and time of the scheduled action (UTC). @@ -27,7 +30,7 @@ public ScheduleProperties(ScheduleFrequency frequency, DateTimeOffset startOn, D EndOn = endOn; } - /// Initializes a new instance of ScheduleProperties. + /// Initializes a new instance of . /// Frequency of the schedule. /// UTC time at which cost analysis data will be emailed. /// Day names in english on which cost analysis data will be emailed. This property is applicable when frequency is Weekly or Monthly. @@ -35,7 +38,8 @@ public ScheduleProperties(ScheduleFrequency frequency, DateTimeOffset startOn, D /// UTC day on which cost analysis data will be emailed. Must be between 1 and 31. This property is applicable when frequency is Monthly and overrides weeksOfMonth or daysOfWeek. /// The start date and time of the scheduled action (UTC). /// The end date and time of the scheduled action (UTC). - internal ScheduleProperties(ScheduleFrequency frequency, int? hourOfDay, IList daysOfWeek, IList weeksOfMonth, int? dayOfMonth, DateTimeOffset startOn, DateTimeOffset endOn) + /// Keeps track of any properties unknown to the library. + internal ScheduleProperties(ScheduleFrequency frequency, int? hourOfDay, IList daysOfWeek, IList weeksOfMonth, int? dayOfMonth, DateTimeOffset startOn, DateTimeOffset endOn, Dictionary serializedAdditionalRawData) { Frequency = frequency; HourOfDay = hourOfDay; @@ -44,6 +48,12 @@ internal ScheduleProperties(ScheduleFrequency frequency, int? hourOfDay, IList Initializes a new instance of for deserialization. + internal ScheduleProperties() + { } /// Frequency of the schedule. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionData.Serialization.cs index 9d714d6f57a0..f66e609645e2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CostManagement { - public partial class ScheduledActionData : IUtf8JsonSerializable + public partial class ScheduledActionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { @@ -33,12 +40,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(FileDestination)) { writer.WritePropertyName("fileDestination"u8); - writer.WriteObjectValue(FileDestination); + if (FileDestination is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FileDestination).Serialize(writer, options); + } } if (Optional.IsDefined(Notification)) { writer.WritePropertyName("notification"u8); - writer.WriteObjectValue(Notification); + if (Notification is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Notification).Serialize(writer, options); + } } if (Optional.IsDefined(NotificationEmail)) { @@ -48,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Schedule)) { writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } } if (Optional.IsDefined(Scope)) { @@ -66,11 +94,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ViewId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScheduledActionData DeserializeScheduledActionData(JsonElement element) + internal static ScheduledActionData DeserializeScheduledActionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +131,7 @@ internal static ScheduledActionData DeserializeScheduledActionData(JsonElement e Optional scope = default; Optional status = default; Optional viewId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("eTag"u8)) @@ -209,8 +252,61 @@ internal static ScheduledActionData DeserializeScheduledActionData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScheduledActionData(id, name, type, systemData.Value, displayName.Value, fileDestination.Value, notification.Value, notificationEmail.Value, schedule.Value, scope.Value, Optional.ToNullable(status), viewId.Value, Optional.ToNullable(eTag), Optional.ToNullable(kind), serializedAdditionalRawData); + } + + ScheduledActionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduledActionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduledActionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduledActionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduledActionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduledActionData(Response response) + { + if (response is null) + { + return null; } - return new ScheduledActionData(id, name, type, systemData.Value, displayName.Value, fileDestination.Value, notification.Value, notificationEmail.Value, schedule.Value, scope.Value, Optional.ToNullable(status), viewId.Value, Optional.ToNullable(eTag), Optional.ToNullable(kind)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduledActionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs index 0e2d53fa1ca9..fd6628eff0ba 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ScheduledActionListResult + internal partial class ScheduledActionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScheduledActionListResult DeserializeScheduledActionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScheduledActionListResult DeserializeScheduledActionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ScheduledActionListResult DeserializeScheduledActionListResult(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScheduledActionListResult(Optional.ToList(value), nextLink.Value); + return new ScheduledActionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ScheduledActionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduledActionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduledActionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduledActionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduledActionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduledActionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduledActionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.cs index 3555cc15b03b..c1521a505087 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CostManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// Scheduled actions list result. It contains a list of scheduled actions. internal partial class ScheduledActionListResult { - /// Initializes a new instance of ScheduledActionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScheduledActionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ScheduledActionListResult. + /// Initializes a new instance of . /// The list of scheduled actions. /// The link (url) to the next page of results. - internal ScheduledActionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ScheduledActionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of scheduled actions. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.Serialization.cs index 98349e340ecc..a316cfe4b114 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class SharedScopeBenefitRecommendationProperties : IUtf8JsonSerializable + public partial class SharedScopeBenefitRecommendationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LookBackPeriod)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Usage)) { writer.WritePropertyName("usage"u8); - writer.WriteObjectValue(Usage); + if (Usage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Usage).Serialize(writer, options); + } } if (Optional.IsDefined(Term)) { @@ -39,15 +53,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RecommendationDetails)) { writer.WritePropertyName("recommendationDetails"u8); - writer.WriteObjectValue(RecommendationDetails); + if (RecommendationDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RecommendationDetails).Serialize(writer, options); + } } writer.WritePropertyName("scope"u8); writer.WriteStringValue(Scope.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SharedScopeBenefitRecommendationProperties DeserializeSharedScopeBenefitRecommendationProperties(JsonElement element) + internal static SharedScopeBenefitRecommendationProperties DeserializeSharedScopeBenefitRecommendationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +100,7 @@ internal static SharedScopeBenefitRecommendationProperties DeserializeSharedScop Optional recommendationDetails = default; Optional allRecommendationDetails = default; BenefitRecommendationScope scope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("firstConsumptionDate"u8)) @@ -172,8 +208,61 @@ internal static SharedScopeBenefitRecommendationProperties DeserializeSharedScop scope = new BenefitRecommendationScope(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SharedScopeBenefitRecommendationProperties(Optional.ToNullable(firstConsumptionDate), Optional.ToNullable(lastConsumptionDate), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(totalHours), usage.Value, armSkuName.Value, Optional.ToNullable(term), Optional.ToNullable(commitmentGranularity), currencyCode.Value, Optional.ToNullable(costWithoutBenefit), recommendationDetails.Value, allRecommendationDetails.Value, scope, serializedAdditionalRawData); + } + + SharedScopeBenefitRecommendationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSharedScopeBenefitRecommendationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SharedScopeBenefitRecommendationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSharedScopeBenefitRecommendationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SharedScopeBenefitRecommendationProperties model) + { + if (model is null) + { + return null; } - return new SharedScopeBenefitRecommendationProperties(Optional.ToNullable(firstConsumptionDate), Optional.ToNullable(lastConsumptionDate), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(totalHours), usage.Value, armSkuName.Value, Optional.ToNullable(term), Optional.ToNullable(commitmentGranularity), currencyCode.Value, Optional.ToNullable(costWithoutBenefit), recommendationDetails.Value, allRecommendationDetails.Value, scope); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SharedScopeBenefitRecommendationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSharedScopeBenefitRecommendationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.cs index b95e36c47d17..c33e24870691 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SharedScopeBenefitRecommendationProperties.cs @@ -6,19 +6,20 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The properties of the benefit recommendation when scope is 'Shared'. public partial class SharedScopeBenefitRecommendationProperties : BenefitRecommendationProperties { - /// Initializes a new instance of SharedScopeBenefitRecommendationProperties. + /// Initializes a new instance of . public SharedScopeBenefitRecommendationProperties() { Scope = BenefitRecommendationScope.Shared; } - /// Initializes a new instance of SharedScopeBenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -32,7 +33,8 @@ public SharedScopeBenefitRecommendationProperties() /// The details of the proposed recommendation. /// The list of all benefit recommendations with the recommendation details. /// Benefit scope. For example, Single or Shared. - internal SharedScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope) : base(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope) + /// Keeps track of any properties unknown to the library. + internal SharedScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope, Dictionary serializedAdditionalRawData) : base(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope, serializedAdditionalRawData) { Scope = scope; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.Serialization.cs index 8401a8cd2150..e21969ededb5 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class SingleScopeBenefitRecommendationProperties : IUtf8JsonSerializable + public partial class SingleScopeBenefitRecommendationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LookBackPeriod)) { @@ -24,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Usage)) { writer.WritePropertyName("usage"u8); - writer.WriteObjectValue(Usage); + if (Usage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Usage).Serialize(writer, options); + } } if (Optional.IsDefined(Term)) { @@ -39,15 +53,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RecommendationDetails)) { writer.WritePropertyName("recommendationDetails"u8); - writer.WriteObjectValue(RecommendationDetails); + if (RecommendationDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RecommendationDetails).Serialize(writer, options); + } } writer.WritePropertyName("scope"u8); writer.WriteStringValue(Scope.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SingleScopeBenefitRecommendationProperties DeserializeSingleScopeBenefitRecommendationProperties(JsonElement element) + internal static SingleScopeBenefitRecommendationProperties DeserializeSingleScopeBenefitRecommendationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,6 +102,7 @@ internal static SingleScopeBenefitRecommendationProperties DeserializeSingleScop Optional recommendationDetails = default; Optional allRecommendationDetails = default; BenefitRecommendationScope scope = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subscriptionId"u8)) @@ -184,8 +220,61 @@ internal static SingleScopeBenefitRecommendationProperties DeserializeSingleScop scope = new BenefitRecommendationScope(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SingleScopeBenefitRecommendationProperties(Optional.ToNullable(firstConsumptionDate), Optional.ToNullable(lastConsumptionDate), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(totalHours), usage.Value, armSkuName.Value, Optional.ToNullable(term), Optional.ToNullable(commitmentGranularity), currencyCode.Value, Optional.ToNullable(costWithoutBenefit), recommendationDetails.Value, allRecommendationDetails.Value, scope, subscriptionId.Value, resourceGroup.Value, serializedAdditionalRawData); + } + + SingleScopeBenefitRecommendationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSingleScopeBenefitRecommendationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SingleScopeBenefitRecommendationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSingleScopeBenefitRecommendationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SingleScopeBenefitRecommendationProperties model) + { + if (model is null) + { + return null; } - return new SingleScopeBenefitRecommendationProperties(Optional.ToNullable(firstConsumptionDate), Optional.ToNullable(lastConsumptionDate), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(totalHours), usage.Value, armSkuName.Value, Optional.ToNullable(term), Optional.ToNullable(commitmentGranularity), currencyCode.Value, Optional.ToNullable(costWithoutBenefit), recommendationDetails.Value, allRecommendationDetails.Value, scope, subscriptionId.Value, resourceGroup.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SingleScopeBenefitRecommendationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSingleScopeBenefitRecommendationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.cs index 1e8e79036b2e..f1ee6fb2fe2f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SingleScopeBenefitRecommendationProperties.cs @@ -6,19 +6,20 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The properties of the benefit recommendations when scope is 'Single'. public partial class SingleScopeBenefitRecommendationProperties : BenefitRecommendationProperties { - /// Initializes a new instance of SingleScopeBenefitRecommendationProperties. + /// Initializes a new instance of . public SingleScopeBenefitRecommendationProperties() { Scope = BenefitRecommendationScope.Single; } - /// Initializes a new instance of SingleScopeBenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -34,7 +35,8 @@ public SingleScopeBenefitRecommendationProperties() /// Benefit scope. For example, Single or Shared. /// The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope. /// The resource group that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope and 'ResourceGroup' request scope. - internal SingleScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope, string subscriptionId, string resourceGroup) : base(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope) + /// Keeps track of any properties unknown to the library. + internal SingleScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope, string subscriptionId, string resourceGroup, Dictionary serializedAdditionalRawData) : base(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope, serializedAdditionalRawData) { SubscriptionId = subscriptionId; ResourceGroup = resourceGroup; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TenantResourceByExternalCloudProviderTypeDimensionsOptions.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TenantResourceByExternalCloudProviderTypeDimensionsOptions.cs index ff30f94f714d..008b98f560bd 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TenantResourceByExternalCloudProviderTypeDimensionsOptions.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TenantResourceByExternalCloudProviderTypeDimensionsOptions.cs @@ -25,6 +25,11 @@ public TenantResourceByExternalCloudProviderTypeDimensionsOptions(ExternalCloudP ExternalCloudProviderId = externalCloudProviderId; } + /// Initializes a new instance of for deserialization. + internal TenantResourceByExternalCloudProviderTypeDimensionsOptions() + { + } + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. public ExternalCloudProviderType ExternalCloudProviderType { get; } /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.Serialization.cs index 341acfa91b74..5211f65664c9 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.Serialization.cs @@ -8,13 +8,18 @@ using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class UnknownBenefitRecommendationProperties : IUtf8JsonSerializable + internal partial class UnknownBenefitRecommendationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LookBackPeriod)) { @@ -24,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Usage)) { writer.WritePropertyName("usage"u8); - writer.WriteObjectValue(Usage); + if (Usage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Usage).Serialize(writer, options); + } } if (Optional.IsDefined(Term)) { @@ -39,141 +51,55 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RecommendationDetails)) { writer.WritePropertyName("recommendationDetails"u8); - writer.WriteObjectValue(RecommendationDetails); - } - writer.WritePropertyName("scope"u8); - writer.WriteStringValue(Scope.ToString()); - writer.WriteEndObject(); - } - - internal static UnknownBenefitRecommendationProperties DeserializeUnknownBenefitRecommendationProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional firstConsumptionDate = default; - Optional lastConsumptionDate = default; - Optional lookBackPeriod = default; - Optional totalHours = default; - Optional usage = default; - Optional armSkuName = default; - Optional term = default; - Optional commitmentGranularity = default; - Optional currencyCode = default; - Optional costWithoutBenefit = default; - Optional recommendationDetails = default; - Optional allRecommendationDetails = default; - BenefitRecommendationScope scope = "Unknown"; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("firstConsumptionDate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - firstConsumptionDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("lastConsumptionDate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastConsumptionDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("lookBackPeriod"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lookBackPeriod = new LookBackPeriod(property.Value.GetString()); - continue; - } - if (property.NameEquals("totalHours"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalHours = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("usage"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - usage = RecommendationUsageDetails.DeserializeRecommendationUsageDetails(property.Value); - continue; - } - if (property.NameEquals("armSkuName"u8)) - { - armSkuName = property.Value.GetString(); - continue; - } - if (property.NameEquals("term"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - term = new BenefitRecommendationPeriodTerm(property.Value.GetString()); - continue; - } - if (property.NameEquals("commitmentGranularity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - commitmentGranularity = new BenefitRecommendationUsageGrain(property.Value.GetString()); - continue; - } - if (property.NameEquals("currencyCode"u8)) - { - currencyCode = property.Value.GetString(); - continue; - } - if (property.NameEquals("costWithoutBenefit"u8)) + if (RecommendationDetails is null) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - costWithoutBenefit = property.Value.GetDecimal(); - continue; + writer.WriteNullValue(); } - if (property.NameEquals("recommendationDetails"u8)) + else { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - recommendationDetails = AllSavingsBenefitDetails.DeserializeAllSavingsBenefitDetails(property.Value); - continue; + ((IModelJsonSerializable)RecommendationDetails).Serialize(writer, options); } - if (property.NameEquals("allRecommendationDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - allRecommendationDetails = AllSavingsList.DeserializeAllSavingsList(property.Value); - continue; - } - if (property.NameEquals("scope"u8)) + } + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) { - scope = new BenefitRecommendationScope(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownBenefitRecommendationProperties(Optional.ToNullable(firstConsumptionDate), Optional.ToNullable(lastConsumptionDate), Optional.ToNullable(lookBackPeriod), Optional.ToNullable(totalHours), usage.Value, armSkuName.Value, Optional.ToNullable(term), Optional.ToNullable(commitmentGranularity), currencyCode.Value, Optional.ToNullable(costWithoutBenefit), recommendationDetails.Value, allRecommendationDetails.Value, scope); + writer.WriteEndObject(); + } + + internal static BenefitRecommendationProperties DeserializeUnknownBenefitRecommendationProperties(JsonElement element, ModelSerializerOptions options = default) => DeserializeBenefitRecommendationProperties(element, options); + + BenefitRecommendationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownBenefitRecommendationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BenefitRecommendationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBenefitRecommendationProperties(doc.RootElement, options); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.cs index 6408d1768763..71d0d9b06916 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownBenefitRecommendationProperties.cs @@ -6,13 +6,14 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CostManagement.Models { /// The UnknownBenefitRecommendationProperties. internal partial class UnknownBenefitRecommendationProperties : BenefitRecommendationProperties { - /// Initializes a new instance of UnknownBenefitRecommendationProperties. + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -26,9 +27,15 @@ internal partial class UnknownBenefitRecommendationProperties : BenefitRecommend /// The details of the proposed recommendation. /// The list of all benefit recommendations with the recommendation details. /// Benefit scope. For example, Single or Shared. - internal UnknownBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope) : base(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope) + /// Keeps track of any properties unknown to the library. + internal UnknownBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn, DateTimeOffset? lastConsumptionOn, LookBackPeriod? lookBackPeriod, int? totalHours, RecommendationUsageDetails usage, string armSkuName, BenefitRecommendationPeriodTerm? term, BenefitRecommendationUsageGrain? commitmentGranularity, string currencyCode, decimal? costWithoutBenefit, AllSavingsBenefitDetails recommendationDetails, AllSavingsList allRecommendationDetails, BenefitRecommendationScope scope, Dictionary serializedAdditionalRawData) : base(firstConsumptionOn, lastConsumptionOn, lookBackPeriod, totalHours, usage, armSkuName, term, commitmentGranularity, currencyCode, costWithoutBenefit, recommendationDetails, allRecommendationDetails, scope, serializedAdditionalRawData) { Scope = scope; } + + /// Initializes a new instance of for deserialization. + internal UnknownBenefitRecommendationProperties() + { + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.Serialization.cs index 89cc06f4b112..55dff44c6cb0 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ViewKpiProperties : IUtf8JsonSerializable + public partial class ViewKpiProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KpiType)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enabled"u8); writer.WriteBooleanValue(IsEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ViewKpiProperties DeserializeViewKpiProperties(JsonElement element) + internal static ViewKpiProperties DeserializeViewKpiProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ViewKpiProperties DeserializeViewKpiProperties(JsonElement eleme Optional type = default; Optional id = default; Optional enabled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -71,8 +94,61 @@ internal static ViewKpiProperties DeserializeViewKpiProperties(JsonElement eleme enabled = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ViewKpiProperties(Optional.ToNullable(type), id.Value, Optional.ToNullable(enabled), serializedAdditionalRawData); + } + + ViewKpiProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeViewKpiProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ViewKpiProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeViewKpiProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ViewKpiProperties model) + { + if (model is null) + { + return null; } - return new ViewKpiProperties(Optional.ToNullable(type), id.Value, Optional.ToNullable(enabled)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ViewKpiProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeViewKpiProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.cs index 89cd6c106116..c24dc63382a7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewKpiProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CostManagement.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.CostManagement.Models /// Each KPI must contain a 'type' and 'enabled' key. public partial class ViewKpiProperties { - /// Initializes a new instance of ViewKpiProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ViewKpiProperties() { } - /// Initializes a new instance of ViewKpiProperties. + /// Initializes a new instance of . /// KPI type (Forecast, Budget). /// ID of resource related to metric (budget). /// show the KPI in the UI?. - internal ViewKpiProperties(ViewKpiType? kpiType, ResourceIdentifier id, bool? isEnabled) + /// Keeps track of any properties unknown to the library. + internal ViewKpiProperties(ViewKpiType? kpiType, ResourceIdentifier id, bool? isEnabled, Dictionary serializedAdditionalRawData) { KpiType = kpiType; Id = id; IsEnabled = isEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// KPI type (Forecast, Budget). diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs index 1c283c86a0ed..e8b9273a3fda 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CostManagement; namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ViewListResult + internal partial class ViewListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ViewListResult DeserializeViewListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ViewListResult DeserializeViewListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ViewListResult DeserializeViewListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ViewListResult(Optional.ToList(value), nextLink.Value); + return new ViewListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ViewListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeViewListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ViewListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeViewListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ViewListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ViewListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeViewListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.cs index ee99fc5b91d2..a8fc5a5aaffa 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CostManagement; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CostManagement.Models /// Result of listing views. It contains a list of available views. internal partial class ViewListResult { - /// Initializes a new instance of ViewListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ViewListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ViewListResult. + /// Initializes a new instance of . /// The list of views. /// The link (url) to the next page of results. - internal ViewListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ViewListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of views. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.Serialization.cs index 1ae87878f59c..72153559ad0e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CostManagement.Models { - public partial class ViewPivotProperties : IUtf8JsonSerializable + public partial class ViewPivotProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PivotType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ViewPivotProperties DeserializeViewPivotProperties(JsonElement element) + internal static ViewPivotProperties DeserializeViewPivotProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -52,8 +75,61 @@ internal static ViewPivotProperties DeserializeViewPivotProperties(JsonElement e name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ViewPivotProperties(Optional.ToNullable(type), name.Value, serializedAdditionalRawData); + } + + ViewPivotProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeViewPivotProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ViewPivotProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeViewPivotProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ViewPivotProperties model) + { + if (model is null) + { + return null; } - return new ViewPivotProperties(Optional.ToNullable(type), name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ViewPivotProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeViewPivotProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.cs index ed3936d9b218..41b3d120aba3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewPivotProperties.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CostManagement.Models { /// Each pivot must contain a 'type' and 'name'. public partial class ViewPivotProperties { - /// Initializes a new instance of ViewPivotProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ViewPivotProperties() { } - /// Initializes a new instance of ViewPivotProperties. + /// Initializes a new instance of . /// Data type to show in view. /// Data field to show in view. - internal ViewPivotProperties(ViewPivotType? pivotType, string name) + /// Keeps track of any properties unknown to the library. + internal ViewPivotProperties(ViewPivotType? pivotType, string name, Dictionary serializedAdditionalRawData) { PivotType = pivotType; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Data type to show in view. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs index ad3e878a26c3..703abe025f54 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs @@ -191,9 +191,7 @@ internal HttpMessage CreateDismissRequest(string scope, string alertId, CostMana request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs index 0a7398bd59be..6b7f8d10efa2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs @@ -50,9 +50,7 @@ internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs index b3234cd78123..c8baf593e022 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs index b756a826cd09..c1198cbd9834 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs @@ -205,9 +205,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string scope, string exportName request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs index ccee5583aa75..95a84303834b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateUsageRequest(string scope, ForecastDefinition forecas request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(forecastDefinition); - request.Content = content; + request.Content = forecastDefinition; _userAgent.Apply(message); return message; } @@ -140,9 +138,7 @@ internal HttpMessage CreateExternalCloudProviderUsageRequest(ExternalCloudProvid request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(forecastDefinition); - request.Content = content; + request.Content = forecastDefinition; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs index 0af63419a00f..09ae0d64563b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs @@ -51,9 +51,7 @@ internal HttpMessage CreateUsageRequest(string scope, QueryDefinition queryDefin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(queryDefinition); - request.Content = content; + request.Content = queryDefinition; _userAgent.Apply(message); return message; } @@ -130,9 +128,7 @@ internal HttpMessage CreateUsageByExternalCloudProviderTypeRequest(ExternalCloud request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(queryDefinition); - request.Content = content; + request.Content = queryDefinition; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs index 8f739e8239d1..b8cf16b8600a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs @@ -50,9 +50,7 @@ internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs index 1d4ec5ecec4e..e3d1ccf3a2a6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs index a7a9509363e3..cafccf5003cc 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs @@ -50,9 +50,7 @@ internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs index f7f37dea460d..a6f0f2c2cd3e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs @@ -52,9 +52,7 @@ internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportAsyncRequest request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs index e7cd3b4185b5..c3f1631946b4 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs @@ -125,9 +125,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string name, ScheduledActionDat } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -337,9 +335,7 @@ internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string nam } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -678,9 +674,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(CostManagementNameAvaila request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -747,9 +741,7 @@ internal HttpMessage CreateCheckNameAvailabilityByScopeRequest(string scope, Cos request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs index fe0f17bb20cb..569fa7a9faf8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs @@ -185,9 +185,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string viewName, CostManagement request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -397,9 +395,7 @@ internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string vie request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs index 830fd899b06f..a66151f287d5 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs @@ -221,7 +221,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _scheduledActionRestClient.CreateListByScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scheduledActionRestClient.CreateListByScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScheduledActionResource(Client, ScheduledActionData.DeserializeScheduledActionData(e)), _scheduledActionClientDiagnostics, Pipeline, "ScheduledActionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ScheduledActionResource(Client, ScheduledActionData.DeserializeScheduledActionData(e)), _scheduledActionClientDiagnostics, Pipeline, "ScheduledActionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -244,7 +244,7 @@ public virtual Pageable GetAll(string filter = null, Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _scheduledActionRestClient.CreateListByScopeRequest(Id, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scheduledActionRestClient.CreateListByScopeNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScheduledActionResource(Client, ScheduledActionData.DeserializeScheduledActionData(e)), _scheduledActionClientDiagnostics, Pipeline, "ScheduledActionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ScheduledActionResource(Client, ScheduledActionData.DeserializeScheduledActionData(e)), _scheduledActionClientDiagnostics, Pipeline, "ScheduledActionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs index 47168aae55e5..90e24227fb9e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,12 +20,15 @@ namespace Azure.ResourceManager.CostManagement /// public partial class ScheduledActionData : ResourceData { - /// Initializes a new instance of ScheduledActionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScheduledActionData() { } - /// Initializes a new instance of ScheduledActionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -39,7 +43,8 @@ public ScheduledActionData() /// Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. /// Kind of the scheduled action. - internal ScheduledActionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, FileDestination fileDestination, NotificationProperties notification, string notificationEmail, ScheduleProperties schedule, ResourceIdentifier scope, ScheduledActionStatus? status, ResourceIdentifier viewId, ETag? eTag, ScheduledActionKind? kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ScheduledActionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, FileDestination fileDestination, NotificationProperties notification, string notificationEmail, ScheduleProperties schedule, ResourceIdentifier scope, ScheduledActionStatus? status, ResourceIdentifier viewId, ETag? eTag, ScheduledActionKind? kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; FileDestination = fileDestination; @@ -51,6 +56,7 @@ internal ScheduledActionData(ResourceIdentifier id, string name, ResourceType re ViewId = viewId; ETag = eTag; Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scheduled action name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ArmCustomerInsightsModelFactory.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ArmCustomerInsightsModelFactory.cs index c6dea869489d..4d5ccec74a37 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ArmCustomerInsightsModelFactory.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ArmCustomerInsightsModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Model factory for models. public static partial class ArmCustomerInsightsModelFactory { - /// Initializes a new instance of HubData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,10 +34,10 @@ public static HubData HubData(ResourceIdentifier id = null, string name = null, { tags ??= new Dictionary(); - return new HubData(id, name, resourceType, systemData, tags, location, apiEndpoint, webEndpoint, provisioningState, tenantFeatures, hubBillingInfo); + return new HubData(id, name, resourceType, systemData, tags, location, apiEndpoint, webEndpoint, provisioningState, tenantFeatures, hubBillingInfo, default); } - /// Initializes a new instance of ProfileResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -70,10 +70,10 @@ public static ProfileResourceFormatData ProfileResourceFormatData(ResourceIdenti fields ??= new List(); strongIds ??= new List(); - return new ProfileResourceFormatData(id, name, resourceType, systemData, attributes, description, displayName, localizedAttributes, smallImage, mediumImage, largeImage, apiEntitySetName, entityType, fields?.ToList(), instancesCount, lastChangedUtc, provisioningState, schemaItemTypeLink, tenantId, timestampFieldName, typeName, strongIds?.ToList()); + return new ProfileResourceFormatData(id, name, resourceType, systemData, attributes, description, displayName, localizedAttributes, smallImage, mediumImage, largeImage, apiEntitySetName, entityType, fields?.ToList(), instancesCount, lastChangedUtc, provisioningState, schemaItemTypeLink, tenantId, timestampFieldName, typeName, strongIds?.ToList(), default); } - /// Initializes a new instance of PropertyDefinition. + /// Initializes a new instance of . /// Array value separator for properties with isArray set. /// Describes valid values for an enum property. /// Name of the property. @@ -96,10 +96,10 @@ public static PropertyDefinition PropertyDefinition(string arrayValueSeparator = enumValidValues ??= new List(); dataSourcePrecedenceRules ??= new List(); - return new PropertyDefinition(arrayValueSeparator, enumValidValues?.ToList(), fieldName, fieldType, isArray, isEnum, isFlagEnum, isImage, isLocalizedString, isName, isRequired, propertyId, schemaItemPropLink, maxLength, isAvailableInGraph, dataSourcePrecedenceRules?.ToList()); + return new PropertyDefinition(arrayValueSeparator, enumValidValues?.ToList(), fieldName, fieldType, isArray, isEnum, isFlagEnum, isImage, isLocalizedString, isName, isRequired, propertyId, schemaItemPropLink, maxLength, isAvailableInGraph, dataSourcePrecedenceRules?.ToList(), default); } - /// Initializes a new instance of DataSourcePrecedence. + /// Initializes a new instance of . /// the precedence value. /// The data source name. /// The data source type. @@ -109,10 +109,10 @@ public static PropertyDefinition PropertyDefinition(string arrayValueSeparator = /// A new instance for mocking. public static DataSourcePrecedence DataSourcePrecedence(int? precedence = null, string name = null, DataSourceType? dataSourceType = null, Status? status = null, int? id = null, string dataSourceReferenceId = null) { - return new DataSourcePrecedence(precedence, name, dataSourceType, status, id, dataSourceReferenceId); + return new DataSourcePrecedence(precedence, name, dataSourceType, status, id, dataSourceReferenceId, default); } - /// Initializes a new instance of KpiDefinition. + /// Initializes a new instance of . /// The mapping entity type. /// The mapping entity name. /// The hub name. @@ -143,10 +143,10 @@ public static KpiDefinition KpiDefinition(EntityType entityType = default, strin aliases ??= new List(); extracts ??= new List(); - return new KpiDefinition(entityType, entityTypeName, tenantId, kpiName, displayName, description, calculationWindow, calculationWindowFieldName, function, expression, unit, filter, groupBy?.ToList(), groupByMetadata?.ToList(), participantProfilesMetadata?.ToList(), provisioningState, thresHolds, aliases?.ToList(), extracts?.ToList()); + return new KpiDefinition(entityType, entityTypeName, tenantId, kpiName, displayName, description, calculationWindow, calculationWindowFieldName, function, expression, unit, filter, groupBy?.ToList(), groupByMetadata?.ToList(), participantProfilesMetadata?.ToList(), provisioningState, thresHolds, aliases?.ToList(), extracts?.ToList(), default); } - /// Initializes a new instance of KpiGroupByMetadata. + /// Initializes a new instance of . /// The display name. /// The name of the field. /// The type of the field. @@ -155,24 +155,18 @@ public static KpiGroupByMetadata KpiGroupByMetadata(IReadOnlyDictionary(); - return new KpiGroupByMetadata(displayName, fieldName, fieldType); + return new KpiGroupByMetadata(displayName, fieldName, fieldType, default); } - /// Initializes a new instance of KpiParticipantProfilesMetadata. + /// Initializes a new instance of . /// Name of the type. - /// is null. /// A new instance for mocking. public static KpiParticipantProfilesMetadata KpiParticipantProfilesMetadata(string typeName = null) { - if (typeName == null) - { - throw new ArgumentNullException(nameof(typeName)); - } - - return new KpiParticipantProfilesMetadata(typeName); + return new KpiParticipantProfilesMetadata(typeName, default); } - /// Initializes a new instance of InteractionResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -216,10 +210,10 @@ public static InteractionResourceFormatData InteractionResourceFormatData(Resour participantProfiles ??= new List(); dataSourcePrecedenceRules ??= new List(); - return new InteractionResourceFormatData(id, name, resourceType, systemData, attributes, description, displayName, localizedAttributes, smallImage, mediumImage, largeImage, apiEntitySetName, entityType, fields?.ToList(), instancesCount, lastChangedUtc, provisioningState, schemaItemTypeLink, tenantId, timestampFieldName, typeName, idPropertyNames?.ToList(), participantProfiles?.ToList(), primaryParticipantProfilePropertyName, dataSourcePrecedenceRules?.ToList(), isActivity, namePropertiesDefaultDataSourceName, dataSourceType, status, idPropertiesDefaultDataSourceId, dataSourceReferenceId); + return new InteractionResourceFormatData(id, name, resourceType, systemData, attributes, description, displayName, localizedAttributes, smallImage, mediumImage, largeImage, apiEntitySetName, entityType, fields?.ToList(), instancesCount, lastChangedUtc, provisioningState, schemaItemTypeLink, tenantId, timestampFieldName, typeName, idPropertyNames?.ToList(), participantProfiles?.ToList(), primaryParticipantProfilePropertyName, dataSourcePrecedenceRules?.ToList(), isActivity, namePropertiesDefaultDataSourceName, dataSourceType, status, idPropertiesDefaultDataSourceId, dataSourceReferenceId, default); } - /// Initializes a new instance of SuggestRelationshipLinksResponse. + /// Initializes a new instance of . /// The interaction name. /// Suggested relationships for the type. /// A new instance for mocking. @@ -227,10 +221,10 @@ public static SuggestRelationshipLinksResponse SuggestRelationshipLinksResponse( { suggestedRelationships ??= new List(); - return new SuggestRelationshipLinksResponse(interactionName, suggestedRelationships?.ToList()); + return new SuggestRelationshipLinksResponse(interactionName, suggestedRelationships?.ToList(), default); } - /// Initializes a new instance of RelationshipsLookup. + /// Initializes a new instance of . /// The relationship profile. /// The property references for the profile type. /// The related profile. @@ -242,10 +236,10 @@ public static RelationshipsLookup RelationshipsLookup(string profileName = null, profilePropertyReferences ??= new List(); relatedProfilePropertyReferences ??= new List(); - return new RelationshipsLookup(profileName, profilePropertyReferences?.ToList(), relatedProfileName, relatedProfilePropertyReferences?.ToList(), existingRelationshipName); + return new RelationshipsLookup(profileName, profilePropertyReferences?.ToList(), relatedProfileName, relatedProfilePropertyReferences?.ToList(), existingRelationshipName, default); } - /// Initializes a new instance of RelationshipResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -270,10 +264,10 @@ public static RelationshipResourceFormatData RelationshipResourceFormatData(Reso fields ??= new List(); lookupMappings ??= new List(); - return new RelationshipResourceFormatData(id, name, resourceType, systemData, cardinality, displayName, description, expiryDateTimeUtc, fields?.ToList(), lookupMappings?.ToList(), profileType, provisioningState, relationshipName, relatedProfileType, relationshipGuidId, tenantId); + return new RelationshipResourceFormatData(id, name, resourceType, systemData, cardinality, displayName, description, expiryDateTimeUtc, fields?.ToList(), lookupMappings?.ToList(), profileType, provisioningState, relationshipName, relatedProfileType, relationshipGuidId, tenantId, default); } - /// Initializes a new instance of RelationshipLinkResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -298,10 +292,10 @@ public static RelationshipLinkResourceFormatData RelationshipLinkResourceFormatD profilePropertyReferences ??= new List(); relatedProfilePropertyReferences ??= new List(); - return new RelationshipLinkResourceFormatData(id, name, resourceType, systemData, displayName, description, interactionType, linkName, mappings?.ToList(), profilePropertyReferences?.ToList(), provisioningState, relatedProfilePropertyReferences?.ToList(), relationshipName, relationshipGuidId, tenantId); + return new RelationshipLinkResourceFormatData(id, name, resourceType, systemData, displayName, description, interactionType, linkName, mappings?.ToList(), profilePropertyReferences?.ToList(), provisioningState, relatedProfilePropertyReferences?.ToList(), relationshipName, relationshipGuidId, tenantId, default); } - /// Initializes a new instance of AuthorizationPolicyResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -315,10 +309,10 @@ public static AuthorizationPolicyResourceFormatData AuthorizationPolicyResourceF { permissions ??= new List(); - return new AuthorizationPolicyResourceFormatData(id, name, resourceType, systemData, policyName, permissions?.ToList(), primaryKey, secondaryKey); + return new AuthorizationPolicyResourceFormatData(id, name, resourceType, systemData, policyName, permissions?.ToList(), primaryKey, secondaryKey, default); } - /// Initializes a new instance of AuthorizationPolicy. + /// Initializes a new instance of . /// Name of the policy. /// The permissions associated with the policy. /// Primary key associated with the policy. @@ -328,10 +322,10 @@ public static AuthorizationPolicy AuthorizationPolicy(string policyName = null, { permissions ??= new List(); - return new AuthorizationPolicy(policyName, permissions?.ToList(), primaryKey, secondaryKey); + return new AuthorizationPolicy(policyName, permissions?.ToList(), primaryKey, secondaryKey, default); } - /// Initializes a new instance of ConnectorResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -352,10 +346,10 @@ public static ConnectorResourceFormatData ConnectorResourceFormatData(ResourceId { connectorProperties ??= new Dictionary(); - return new ConnectorResourceFormatData(id, name, resourceType, systemData, connectorId, connectorName, connectorType, displayName, description, connectorProperties, created, lastModified, state, tenantId, isInternal); + return new ConnectorResourceFormatData(id, name, resourceType, systemData, connectorId, connectorName, connectorType, displayName, description, connectorProperties, created, lastModified, state, tenantId, isInternal, default); } - /// Initializes a new instance of ConnectorMappingResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -378,10 +372,10 @@ public static ConnectorResourceFormatData ConnectorResourceFormatData(ResourceId /// A new instance for mocking. public static ConnectorMappingResourceFormatData ConnectorMappingResourceFormatData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string connectorName = null, ConnectorType? connectorType = null, DateTimeOffset? created = null, DateTimeOffset? lastModified = null, EntityType? entityType = null, string entityTypeName = null, string connectorMappingName = null, string displayName = null, string description = null, string dataFormatId = null, ConnectorMappingProperties mappingProperties = null, DateTimeOffset? nextRunOn = null, string runId = null, ConnectorMappingState? state = null, Guid? tenantId = null) { - return new ConnectorMappingResourceFormatData(id, name, resourceType, systemData, connectorName, connectorType, created, lastModified, entityType, entityTypeName, connectorMappingName, displayName, description, dataFormatId, mappingProperties, nextRunOn, runId, state, tenantId); + return new ConnectorMappingResourceFormatData(id, name, resourceType, systemData, connectorName, connectorType, created, lastModified, entityType, entityTypeName, connectorMappingName, displayName, description, dataFormatId, mappingProperties, nextRunOn, runId, state, tenantId, default); } - /// Initializes a new instance of ConnectorMappingFormat. + /// Initializes a new instance of . /// The type mapping format. /// The character that signifies a break between columns. /// The oData language. @@ -391,10 +385,10 @@ public static ConnectorMappingResourceFormatData ConnectorMappingResourceFormatD /// A new instance for mocking. public static ConnectorMappingFormat ConnectorMappingFormat(FormatType formatType = default, string columnDelimiter = null, string acceptLanguage = null, string quoteCharacter = null, string quoteEscapeCharacter = null, string arraySeparator = null) { - return new ConnectorMappingFormat(formatType, columnDelimiter, acceptLanguage, quoteCharacter, quoteEscapeCharacter, arraySeparator); + return new ConnectorMappingFormat(formatType, columnDelimiter, acceptLanguage, quoteCharacter, quoteEscapeCharacter, arraySeparator, default); } - /// Initializes a new instance of KpiResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -429,10 +423,10 @@ public static KpiResourceFormatData KpiResourceFormatData(ResourceIdentifier id aliases ??= new List(); extracts ??= new List(); - return new KpiResourceFormatData(id, name, resourceType, systemData, entityType, entityTypeName, tenantId, kpiName, displayName, description, calculationWindow, calculationWindowFieldName, function, expression, unit, filter, groupBy?.ToList(), groupByMetadata?.ToList(), participantProfilesMetadata?.ToList(), provisioningState, thresHolds, aliases?.ToList(), extracts?.ToList()); + return new KpiResourceFormatData(id, name, resourceType, systemData, entityType, entityTypeName, tenantId, kpiName, displayName, description, calculationWindow, calculationWindowFieldName, function, expression, unit, filter, groupBy?.ToList(), groupByMetadata?.ToList(), participantProfilesMetadata?.ToList(), provisioningState, thresHolds, aliases?.ToList(), extracts?.ToList(), default); } - /// Initializes a new instance of WidgetTypeResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -451,10 +445,10 @@ public static WidgetTypeResourceFormatData WidgetTypeResourceFormatData(Resource { displayName ??= new Dictionary(); - return new WidgetTypeResourceFormatData(id, name, resourceType, systemData, widgetTypeName, definition, description, displayName, imageUri, tenantId, widgetVersion, changed, created); + return new WidgetTypeResourceFormatData(id, name, resourceType, systemData, widgetTypeName, definition, description, displayName, imageUri, tenantId, widgetVersion, changed, created, default); } - /// Initializes a new instance of ViewResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -471,10 +465,10 @@ public static ViewResourceFormatData ViewResourceFormatData(ResourceIdentifier i { displayName ??= new Dictionary(); - return new ViewResourceFormatData(id, name, resourceType, systemData, viewName, userId, tenantId, displayName, definition, changed, created); + return new ViewResourceFormatData(id, name, resourceType, systemData, viewName, userId, tenantId, displayName, definition, changed, created, default); } - /// Initializes a new instance of LinkResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -500,10 +494,10 @@ public static LinkResourceFormatData LinkResourceFormatData(ResourceIdentifier i mappings ??= new List(); participantPropertyReferences ??= new List(); - return new LinkResourceFormatData(id, name, resourceType, systemData, tenantId, linkName, sourceEntityType, targetEntityType, sourceEntityTypeName, targetEntityTypeName, displayName, description, mappings?.ToList(), participantPropertyReferences?.ToList(), provisioningState, referenceOnly, operationType); + return new LinkResourceFormatData(id, name, resourceType, systemData, tenantId, linkName, sourceEntityType, targetEntityType, sourceEntityTypeName, targetEntityTypeName, displayName, description, mappings?.ToList(), participantPropertyReferences?.ToList(), provisioningState, referenceOnly, operationType, default); } - /// Initializes a new instance of RoleResourceFormat. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -513,10 +507,10 @@ public static LinkResourceFormatData LinkResourceFormatData(ResourceIdentifier i /// A new instance for mocking. public static RoleResourceFormat RoleResourceFormat(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string roleName = null, string description = null) { - return new RoleResourceFormat(id, name, resourceType, systemData, roleName, description); + return new RoleResourceFormat(id, name, resourceType, systemData, roleName, description, default); } - /// Initializes a new instance of RoleAssignmentResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -548,20 +542,20 @@ public static RoleAssignmentResourceFormatData RoleAssignmentResourceFormatData( description ??= new Dictionary(); principals ??= new List(); - return new RoleAssignmentResourceFormatData(id, name, resourceType, systemData, tenantId, assignmentName, displayName, description, provisioningState, role, principals?.ToList(), profiles, interactions, links, kpis, sasPolicies, connectors, views, relationshipLinks, relationships, widgetTypes, roleAssignments, conflationPolicies, segments); + return new RoleAssignmentResourceFormatData(id, name, resourceType, systemData, tenantId, assignmentName, displayName, description, provisioningState, role, principals?.ToList(), profiles, interactions, links, kpis, sasPolicies, connectors, views, relationshipLinks, relationships, widgetTypes, roleAssignments, conflationPolicies, segments, default); } - /// Initializes a new instance of ImageDefinition. + /// Initializes a new instance of . /// Whether image exists already. /// Content URL for the image blob. /// Relative path of the image. /// A new instance for mocking. public static ImageDefinition ImageDefinition(bool? imageExists = null, Uri contentUri = null, string relativePath = null) { - return new ImageDefinition(imageExists, contentUri, relativePath); + return new ImageDefinition(imageExists, contentUri, relativePath, default); } - /// Initializes a new instance of PredictionResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -593,10 +587,10 @@ public static PredictionResourceFormatData PredictionResourceFormatData(Resource involvedRelationships ??= new List(); grades ??= new List(); - return new PredictionResourceFormatData(id, name, resourceType, systemData, description, displayName, involvedInteractionTypes?.ToList(), involvedKpiTypes?.ToList(), involvedRelationships?.ToList(), negativeOutcomeExpression, positiveOutcomeExpression, primaryProfileType, provisioningState, predictionName, scopeExpression, tenantId, autoAnalyze, mappings, scoreLabel, grades?.ToList(), systemGeneratedEntities); + return new PredictionResourceFormatData(id, name, resourceType, systemData, description, displayName, involvedInteractionTypes?.ToList(), involvedKpiTypes?.ToList(), involvedRelationships?.ToList(), negativeOutcomeExpression, positiveOutcomeExpression, primaryProfileType, provisioningState, predictionName, scopeExpression, tenantId, autoAnalyze, mappings, scoreLabel, grades?.ToList(), systemGeneratedEntities, default); } - /// Initializes a new instance of PredictionSystemGeneratedEntities. + /// Initializes a new instance of . /// Generated interaction types. /// Generated links. /// Generated KPIs. @@ -607,10 +601,10 @@ public static PredictionSystemGeneratedEntities PredictionSystemGeneratedEntitie generatedLinks ??= new List(); generatedKpis ??= new Dictionary(); - return new PredictionSystemGeneratedEntities(generatedInteractionTypes?.ToList(), generatedLinks?.ToList(), generatedKpis); + return new PredictionSystemGeneratedEntities(generatedInteractionTypes?.ToList(), generatedLinks?.ToList(), generatedKpis, default); } - /// Initializes a new instance of PredictionTrainingResults. + /// Initializes a new instance of . /// The hub name. /// Score name. /// Prediction distribution. @@ -621,10 +615,10 @@ public static PredictionTrainingResults PredictionTrainingResults(Guid? tenantId { canonicalProfiles ??= new List(); - return new PredictionTrainingResults(tenantId, scoreName, predictionDistribution, canonicalProfiles?.ToList(), primaryProfileInstanceCount); + return new PredictionTrainingResults(tenantId, scoreName, predictionDistribution, canonicalProfiles?.ToList(), primaryProfileInstanceCount, default); } - /// Initializes a new instance of PredictionDistributionDefinition. + /// Initializes a new instance of . /// Total positive in the distribution. /// Total negatives in the distribution. /// Distributions of the prediction. @@ -633,10 +627,10 @@ public static PredictionDistributionDefinition PredictionDistributionDefinition( { distributions ??= new List(); - return new PredictionDistributionDefinition(totalPositives, totalNegatives, distributions?.ToList()); + return new PredictionDistributionDefinition(totalPositives, totalNegatives, distributions?.ToList(), default); } - /// Initializes a new instance of PredictionDistributionDefinitionDistributionsItem. + /// Initializes a new instance of . /// Score threshold. /// Number of positives. /// Number of negatives. @@ -645,10 +639,10 @@ public static PredictionDistributionDefinition PredictionDistributionDefinition( /// A new instance for mocking. public static PredictionDistributionDefinitionDistributionsItem PredictionDistributionDefinitionDistributionsItem(int? scoreThreshold = null, long? positives = null, long? negatives = null, long? positivesAboveThreshold = null, long? negativesAboveThreshold = null) { - return new PredictionDistributionDefinitionDistributionsItem(scoreThreshold, positives, negatives, positivesAboveThreshold, negativesAboveThreshold); + return new PredictionDistributionDefinitionDistributionsItem(scoreThreshold, positives, negatives, positivesAboveThreshold, negativesAboveThreshold, default); } - /// Initializes a new instance of CanonicalProfileDefinition. + /// Initializes a new instance of . /// Canonical profile ID. /// Properties of the canonical profile. /// A new instance for mocking. @@ -656,10 +650,10 @@ public static CanonicalProfileDefinition CanonicalProfileDefinition(int? canonic { properties ??= new List(); - return new CanonicalProfileDefinition(canonicalProfileId, properties?.ToList()); + return new CanonicalProfileDefinition(canonicalProfileId, properties?.ToList(), default); } - /// Initializes a new instance of CanonicalProfileDefinitionPropertiesItem. + /// Initializes a new instance of . /// Profile name. /// Property name of profile. /// The rank. @@ -668,10 +662,10 @@ public static CanonicalProfileDefinition CanonicalProfileDefinition(int? canonic /// A new instance for mocking. public static CanonicalProfileDefinitionPropertiesItem CanonicalProfileDefinitionPropertiesItem(string profileName = null, string profilePropertyName = null, int? rank = null, CanonicalPropertyValueType? valueType = null, string value = null) { - return new CanonicalProfileDefinitionPropertiesItem(profileName, profilePropertyName, rank, valueType, value); + return new CanonicalProfileDefinitionPropertiesItem(profileName, profilePropertyName, rank, valueType, value, default); } - /// Initializes a new instance of PredictionModelStatus. + /// Initializes a new instance of . /// The hub name. /// The prediction name. /// The prediction GUID ID. @@ -686,7 +680,7 @@ public static CanonicalProfileDefinitionPropertiesItem CanonicalProfileDefinitio /// A new instance for mocking. public static PredictionModelStatus PredictionModelStatus(Guid? tenantId = null, string predictionName = null, string predictionGuidId = null, PredictionModelLifeCycle status = default, string message = null, int? trainingSetCount = null, int? testSetCount = null, int? validationSetCount = null, decimal? trainingAccuracy = null, int? signalsUsed = null, string modelVersion = null) { - return new PredictionModelStatus(tenantId, predictionName, predictionGuidId, status, message, trainingSetCount, testSetCount, validationSetCount, trainingAccuracy, signalsUsed, modelVersion); + return new PredictionModelStatus(tenantId, predictionName, predictionGuidId, status, message, trainingSetCount, testSetCount, validationSetCount, trainingAccuracy, signalsUsed, modelVersion, default); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs index 95bc1276e9b9..69c6112872a0 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAs { HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationPolicyResourceFormatAuthorizationPoliciesRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationPolicyResourceFormatAuthorizationPoliciesRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationPolicyResourceFormatResource(Client, AuthorizationPolicyResourceFormatData.DeserializeAuthorizationPolicyResourceFormatData(e)), _authorizationPolicyResourceFormatAuthorizationPoliciesClientDiagnostics, Pipeline, "AuthorizationPolicyResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new AuthorizationPolicyResourceFormatResource(Client, AuthorizationPolicyResourceFormatData.DeserializeAuthorizationPolicyResourceFormatData(e)), _authorizationPolicyResourceFormatAuthorizationPoliciesClientDiagnostics, Pipeline, "AuthorizationPolicyResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationPolicyResourceFormatAuthorizationPoliciesRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationPolicyResourceFormatAuthorizationPoliciesRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationPolicyResourceFormatResource(Client, AuthorizationPolicyResourceFormatData.DeserializeAuthorizationPolicyResourceFormatData(e)), _authorizationPolicyResourceFormatAuthorizationPoliciesClientDiagnostics, Pipeline, "AuthorizationPolicyResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new AuthorizationPolicyResourceFormatResource(Client, AuthorizationPolicyResourceFormatData.DeserializeAuthorizationPolicyResourceFormatData(e)), _authorizationPolicyResourceFormatAuthorizationPoliciesClientDiagnostics, Pipeline, "AuthorizationPolicyResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatData.cs index 62d6fedc0384..e521317bf6ea 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class AuthorizationPolicyResourceFormatData : ResourceData { - /// Initializes a new instance of AuthorizationPolicyResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AuthorizationPolicyResourceFormatData() { Permissions = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationPolicyResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,12 +37,14 @@ public AuthorizationPolicyResourceFormatData() /// The permissions associated with the policy. /// Primary key associated with the policy. /// Secondary key associated with the policy. - internal AuthorizationPolicyResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string policyName, IList permissions, string primaryKey, string secondaryKey) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal AuthorizationPolicyResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string policyName, IList permissions, string primaryKey, string secondaryKey, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PolicyName = policyName; Permissions = permissions; PrimaryKey = primaryKey; SecondaryKey = secondaryKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the policy. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs index f8513e056109..0433d389455f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorMappingResourceFormatConnectorMappingsRestClient.CreateListByConnectorRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorMappingResourceFormatConnectorMappingsRestClient.CreateListByConnectorNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectorMappingResourceFormatResource(Client, ConnectorMappingResourceFormatData.DeserializeConnectorMappingResourceFormatData(e)), _connectorMappingResourceFormatConnectorMappingsClientDiagnostics, Pipeline, "ConnectorMappingResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConnectorMappingResourceFormatResource(Client, ConnectorMappingResourceFormatData.DeserializeConnectorMappingResourceFormatData(e)), _connectorMappingResourceFormatConnectorMappingsClientDiagnostics, Pipeline, "ConnectorMappingResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorMappingResourceFormatConnectorMappingsRestClient.CreateListByConnectorRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorMappingResourceFormatConnectorMappingsRestClient.CreateListByConnectorNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectorMappingResourceFormatResource(Client, ConnectorMappingResourceFormatData.DeserializeConnectorMappingResourceFormatData(e)), _connectorMappingResourceFormatConnectorMappingsClientDiagnostics, Pipeline, "ConnectorMappingResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConnectorMappingResourceFormatResource(Client, ConnectorMappingResourceFormatData.DeserializeConnectorMappingResourceFormatData(e)), _connectorMappingResourceFormatConnectorMappingsClientDiagnostics, Pipeline, "ConnectorMappingResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatData.cs index cca430bc0c3d..b1e38a4943f5 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class ConnectorMappingResourceFormatData : ResourceData { - /// Initializes a new instance of ConnectorMappingResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectorMappingResourceFormatData() { } - /// Initializes a new instance of ConnectorMappingResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -43,7 +47,8 @@ public ConnectorMappingResourceFormatData() /// The RunId. /// State of connector mapping. /// The hub name. - internal ConnectorMappingResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string connectorName, ConnectorType? connectorType, DateTimeOffset? created, DateTimeOffset? lastModified, EntityType? entityType, string entityTypeName, string connectorMappingName, string displayName, string description, string dataFormatId, ConnectorMappingProperties mappingProperties, DateTimeOffset? nextRunOn, string runId, ConnectorMappingState? state, Guid? tenantId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string connectorName, ConnectorType? connectorType, DateTimeOffset? created, DateTimeOffset? lastModified, EntityType? entityType, string entityTypeName, string connectorMappingName, string displayName, string description, string dataFormatId, ConnectorMappingProperties mappingProperties, DateTimeOffset? nextRunOn, string runId, ConnectorMappingState? state, Guid? tenantId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ConnectorName = connectorName; ConnectorType = connectorType; @@ -60,6 +65,7 @@ internal ConnectorMappingResourceFormatData(ResourceIdentifier id, string name, RunId = runId; State = state; TenantId = tenantId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The connector name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs index d3012224f20b..d2e91756edbb 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorResourceFormatConnectorsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorResourceFormatConnectorsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectorResourceFormatResource(Client, ConnectorResourceFormatData.DeserializeConnectorResourceFormatData(e)), _connectorResourceFormatConnectorsClientDiagnostics, Pipeline, "ConnectorResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ConnectorResourceFormatResource(Client, ConnectorResourceFormatData.DeserializeConnectorResourceFormatData(e)), _connectorResourceFormatConnectorsClientDiagnostics, Pipeline, "ConnectorResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToke { HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorResourceFormatConnectorsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorResourceFormatConnectorsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectorResourceFormatResource(Client, ConnectorResourceFormatData.DeserializeConnectorResourceFormatData(e)), _connectorResourceFormatConnectorsClientDiagnostics, Pipeline, "ConnectorResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ConnectorResourceFormatResource(Client, ConnectorResourceFormatData.DeserializeConnectorResourceFormatData(e)), _connectorResourceFormatConnectorsClientDiagnostics, Pipeline, "ConnectorResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatData.cs index e505bcce70af..67a8cee99880 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class ConnectorResourceFormatData : ResourceData { - /// Initializes a new instance of ConnectorResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectorResourceFormatData() { ConnectorProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ConnectorResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public ConnectorResourceFormatData() /// State of connector. /// The hub name. /// If this is an internal connector. - internal ConnectorResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? connectorId, string connectorName, ConnectorType? connectorType, string displayName, string description, IDictionary connectorProperties, DateTimeOffset? created, DateTimeOffset? lastModified, ConnectorState? state, Guid? tenantId, bool? isInternal) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ConnectorResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? connectorId, string connectorName, ConnectorType? connectorType, string displayName, string description, IDictionary connectorProperties, DateTimeOffset? created, DateTimeOffset? lastModified, ConnectorState? state, Guid? tenantId, bool? isInternal, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ConnectorId = connectorId; ConnectorName = connectorName; @@ -54,6 +58,7 @@ internal ConnectorResourceFormatData(ResourceIdentifier id, string name, Resourc State = state; TenantId = tenantId; IsInternal = isInternal; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// ID of the connector. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 86b7a5a888b7..a93182c0501b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -60,7 +60,7 @@ public virtual AsyncPageable GetHubsAsync(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => HubRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHubs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHubs", "value", "nextLink", cancellationToken); } /// @@ -82,7 +82,7 @@ public virtual Pageable GetHubs(CancellationToken cancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => HubRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHubs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHubs", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs index e4d9efbed699..0f9ba0ac9c26 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => _hubRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hubRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), _hubClientDiagnostics, Pipeline, "HubCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new HubResource(Client, HubData.DeserializeHubData(e)), _hubClientDiagnostics, Pipeline, "HubCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _hubRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hubRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), _hubClientDiagnostics, Pipeline, "HubCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new HubResource(Client, HubData.DeserializeHubData(e)), _hubClientDiagnostics, Pipeline, "HubCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubData.cs index c280b3f989ea..1f1dc638752a 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights.Models; @@ -18,13 +19,16 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class HubData : TrackedResourceData { - /// Initializes a new instance of HubData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public HubData(AzureLocation location) : base(location) { } - /// Initializes a new instance of HubData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,13 +40,20 @@ public HubData(AzureLocation location) : base(location) /// Provisioning state of the hub. /// The bit flags for enabled hub features. Bit 0 is set to 1 indicates graph is enabled, or disabled if set to 0. Bit 1 is set to 1 indicates the hub is disabled, or enabled if set to 0. /// Billing settings of the hub. - internal HubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string apiEndpoint, string webEndpoint, string provisioningState, int? tenantFeatures, HubBillingInfoFormat hubBillingInfo) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal HubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string apiEndpoint, string webEndpoint, string provisioningState, int? tenantFeatures, HubBillingInfoFormat hubBillingInfo, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ApiEndpoint = apiEndpoint; WebEndpoint = webEndpoint; ProvisioningState = provisioningState; TenantFeatures = tenantFeatures; HubBillingInfo = hubBillingInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HubData() + { } /// API endpoint URL of the hub. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs index 957ea7f94f60..c435d200cff5 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(stri { HttpMessage FirstPageRequest(int? pageSizeHint) => _interactionResourceFormatInteractionsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _interactionResourceFormatInteractionsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InteractionResourceFormatResource(Client, InteractionResourceFormatData.DeserializeInteractionResourceFormatData(e)), _interactionResourceFormatInteractionsClientDiagnostics, Pipeline, "InteractionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new InteractionResourceFormatResource(Client, InteractionResourceFormatData.DeserializeInteractionResourceFormatData(e)), _interactionResourceFormatInteractionsClientDiagnostics, Pipeline, "InteractionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(string localeC { HttpMessage FirstPageRequest(int? pageSizeHint) => _interactionResourceFormatInteractionsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _interactionResourceFormatInteractionsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InteractionResourceFormatResource(Client, InteractionResourceFormatData.DeserializeInteractionResourceFormatData(e)), _interactionResourceFormatInteractionsClientDiagnostics, Pipeline, "InteractionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new InteractionResourceFormatResource(Client, InteractionResourceFormatData.DeserializeInteractionResourceFormatData(e)), _interactionResourceFormatInteractionsClientDiagnostics, Pipeline, "InteractionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatData.cs index 1885b904f315..5b5a91b7c087 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class InteractionResourceFormatData : ResourceData { - /// Initializes a new instance of InteractionResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public InteractionResourceFormatData() { Attributes = new ChangeTrackingDictionary>(); @@ -32,7 +35,7 @@ public InteractionResourceFormatData() DataSourcePrecedenceRules = new ChangeTrackingList(); } - /// Initializes a new instance of InteractionResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -64,7 +67,8 @@ public InteractionResourceFormatData() /// The data source status. /// The data source ID. /// The data source reference id. - internal InteractionResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary> attributes, IDictionary description, IDictionary displayName, IDictionary> localizedAttributes, string smallImage, string mediumImage, string largeImage, string apiEntitySetName, EntityType? entityType, IList fields, int? instancesCount, DateTimeOffset? lastChangedUtc, ProvisioningState? provisioningState, string schemaItemTypeLink, Guid? tenantId, string timestampFieldName, string typeName, IList idPropertyNames, IList participantProfiles, string primaryParticipantProfilePropertyName, IReadOnlyList dataSourcePrecedenceRules, bool? isActivity, string namePropertiesDefaultDataSourceName, DataSourceType? dataSourceType, Status? status, int? idPropertiesDefaultDataSourceId, string dataSourceReferenceId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal InteractionResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary> attributes, IDictionary description, IDictionary displayName, IDictionary> localizedAttributes, string smallImage, string mediumImage, string largeImage, string apiEntitySetName, EntityType? entityType, IList fields, int? instancesCount, DateTimeOffset? lastChangedUtc, ProvisioningState? provisioningState, string schemaItemTypeLink, Guid? tenantId, string timestampFieldName, string typeName, IList idPropertyNames, IList participantProfiles, string primaryParticipantProfilePropertyName, IReadOnlyList dataSourcePrecedenceRules, bool? isActivity, string namePropertiesDefaultDataSourceName, DataSourceType? dataSourceType, Status? status, int? idPropertiesDefaultDataSourceId, string dataSourceReferenceId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Attributes = attributes; Description = description; @@ -93,6 +97,7 @@ internal InteractionResourceFormatData(ResourceIdentifier id, string name, Resou Status = status; IdPropertiesDefaultDataSourceId = idPropertiesDefaultDataSourceId; DataSourceReferenceId = dataSourceReferenceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The attributes for the Type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs index 0b256742c72e..d5763e17ec1a 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _kpiResourceFormatKpiRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _kpiResourceFormatKpiRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KpiResourceFormatResource(Client, KpiResourceFormatData.DeserializeKpiResourceFormatData(e)), _kpiResourceFormatKpiClientDiagnostics, Pipeline, "KpiResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new KpiResourceFormatResource(Client, KpiResourceFormatData.DeserializeKpiResourceFormatData(e)), _kpiResourceFormatKpiClientDiagnostics, Pipeline, "KpiResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _kpiResourceFormatKpiRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _kpiResourceFormatKpiRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KpiResourceFormatResource(Client, KpiResourceFormatData.DeserializeKpiResourceFormatData(e)), _kpiResourceFormatKpiClientDiagnostics, Pipeline, "KpiResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new KpiResourceFormatResource(Client, KpiResourceFormatData.DeserializeKpiResourceFormatData(e)), _kpiResourceFormatKpiClientDiagnostics, Pipeline, "KpiResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatData.cs index d1c4144ce391..2f418a2bf0cd 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class KpiResourceFormatData : ResourceData { - /// Initializes a new instance of KpiResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public KpiResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); @@ -31,7 +34,7 @@ public KpiResourceFormatData() Extracts = new ChangeTrackingList(); } - /// Initializes a new instance of KpiResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -55,7 +58,8 @@ public KpiResourceFormatData() /// The KPI thresholds. /// The aliases. /// The KPI extracts. - internal KpiResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EntityType? entityType, string entityTypeName, Guid? tenantId, string kpiName, IDictionary displayName, IDictionary description, CalculationWindowType? calculationWindow, string calculationWindowFieldName, KpiFunction? function, string expression, string unit, string filter, IList groupBy, IReadOnlyList groupByMetadata, IReadOnlyList participantProfilesMetadata, ProvisioningState? provisioningState, KpiThresholds thresHolds, IList aliases, IList extracts) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal KpiResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EntityType? entityType, string entityTypeName, Guid? tenantId, string kpiName, IDictionary displayName, IDictionary description, CalculationWindowType? calculationWindow, string calculationWindowFieldName, KpiFunction? function, string expression, string unit, string filter, IList groupBy, IReadOnlyList groupByMetadata, IReadOnlyList participantProfilesMetadata, ProvisioningState? provisioningState, KpiThresholds thresHolds, IList aliases, IList extracts, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { EntityType = entityType; EntityTypeName = entityTypeName; @@ -76,6 +80,7 @@ internal KpiResourceFormatData(ResourceIdentifier id, string name, ResourceType ThresHolds = thresHolds; Aliases = aliases; Extracts = extracts; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The mapping entity type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs index 04367b3cdc32..c65f82e23da8 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _linkResourceFormatLinksRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _linkResourceFormatLinksRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LinkResourceFormatResource(Client, LinkResourceFormatData.DeserializeLinkResourceFormatData(e)), _linkResourceFormatLinksClientDiagnostics, Pipeline, "LinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new LinkResourceFormatResource(Client, LinkResourceFormatData.DeserializeLinkResourceFormatData(e)), _linkResourceFormatLinksClientDiagnostics, Pipeline, "LinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _linkResourceFormatLinksRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _linkResourceFormatLinksRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LinkResourceFormatResource(Client, LinkResourceFormatData.DeserializeLinkResourceFormatData(e)), _linkResourceFormatLinksClientDiagnostics, Pipeline, "LinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new LinkResourceFormatResource(Client, LinkResourceFormatData.DeserializeLinkResourceFormatData(e)), _linkResourceFormatLinksClientDiagnostics, Pipeline, "LinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatData.cs index 8c7d872bb4af..4fc2dc7d25e9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class LinkResourceFormatData : ResourceData { - /// Initializes a new instance of LinkResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LinkResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); @@ -28,7 +31,7 @@ public LinkResourceFormatData() ParticipantPropertyReferences = new ChangeTrackingList(); } - /// Initializes a new instance of LinkResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -46,7 +49,8 @@ public LinkResourceFormatData() /// Provisioning state. /// Indicating whether the link is reference only link. This flag is ignored if the Mappings are defined. If the mappings are not defined and it is set to true, links processing will not create or update profiles. /// Determines whether this link is supposed to create or delete instances if Link is NOT Reference Only. - internal LinkResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? tenantId, string linkName, EntityType? sourceEntityType, EntityType? targetEntityType, string sourceEntityTypeName, string targetEntityTypeName, IDictionary displayName, IDictionary description, IList mappings, IList participantPropertyReferences, ProvisioningState? provisioningState, bool? referenceOnly, InstanceOperationType? operationType) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal LinkResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? tenantId, string linkName, EntityType? sourceEntityType, EntityType? targetEntityType, string sourceEntityTypeName, string targetEntityTypeName, IDictionary displayName, IDictionary description, IList mappings, IList participantPropertyReferences, ProvisioningState? provisioningState, bool? referenceOnly, InstanceOperationType? operationType, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TenantId = tenantId; LinkName = linkName; @@ -61,6 +65,7 @@ internal LinkResourceFormatData(ResourceIdentifier id, string name, ResourceType ProvisioningState = provisioningState; ReferenceOnly = referenceOnly; OperationType = operationType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The hub name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.Serialization.cs index 52e1e265263f..f9322146d7c7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class AssignmentPrincipal : IUtf8JsonSerializable + public partial class AssignmentPrincipal : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("principalId"u8); writer.WriteStringValue(PrincipalId); @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AssignmentPrincipal DeserializeAssignmentPrincipal(JsonElement element) + internal static AssignmentPrincipal DeserializeAssignmentPrincipal(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static AssignmentPrincipal DeserializeAssignmentPrincipal(JsonElement e string principalId = default; string principalType = default; Optional> principalMetadata = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("principalId"u8)) @@ -69,8 +91,61 @@ internal static AssignmentPrincipal DeserializeAssignmentPrincipal(JsonElement e principalMetadata = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AssignmentPrincipal(principalId, principalType, Optional.ToDictionary(principalMetadata), serializedAdditionalRawData); + } + + AssignmentPrincipal IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAssignmentPrincipal(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AssignmentPrincipal IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAssignmentPrincipal(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AssignmentPrincipal model) + { + if (model is null) + { + return null; } - return new AssignmentPrincipal(principalId, principalType, Optional.ToDictionary(principalMetadata)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AssignmentPrincipal(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAssignmentPrincipal(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.cs index dd195dd00e80..b0736795e4ce 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AssignmentPrincipal.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The AssignmentPrincipal. public partial class AssignmentPrincipal { - /// Initializes a new instance of AssignmentPrincipal. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The principal id being assigned to. /// The Type of the principal ID. /// or is null. @@ -28,15 +31,22 @@ public AssignmentPrincipal(string principalId, string principalType) PrincipalMetadata = new ChangeTrackingDictionary(); } - /// Initializes a new instance of AssignmentPrincipal. + /// Initializes a new instance of . /// The principal id being assigned to. /// The Type of the principal ID. /// Other metadata for the principal. - internal AssignmentPrincipal(string principalId, string principalType, IDictionary principalMetadata) + /// Keeps track of any properties unknown to the library. + internal AssignmentPrincipal(string principalId, string principalType, IDictionary principalMetadata, Dictionary serializedAdditionalRawData) { PrincipalId = principalId; PrincipalType = principalType; PrincipalMetadata = principalMetadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssignmentPrincipal() + { } /// The principal id being assigned to. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.Serialization.cs index 1b29dfea1778..ddaf2762d22a 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.Serialization.cs @@ -5,16 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class AuthorizationPolicy + public partial class AuthorizationPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationPolicy DeserializeAuthorizationPolicy(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("permissions"u8); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + writer.WriteStringValue(item.ToSerialString()); + } + writer.WriteEndArray(); + if (Optional.IsDefined(PrimaryKey)) + { + writer.WritePropertyName("primaryKey"u8); + writer.WriteStringValue(PrimaryKey); + } + if (Optional.IsDefined(SecondaryKey)) + { + writer.WritePropertyName("secondaryKey"u8); + writer.WriteStringValue(SecondaryKey); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationPolicy DeserializeAuthorizationPolicy(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +67,7 @@ internal static AuthorizationPolicy DeserializeAuthorizationPolicy(JsonElement e IReadOnlyList permissions = default; Optional primaryKey = default; Optional secondaryKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("policyName"u8)) @@ -50,8 +95,61 @@ internal static AuthorizationPolicy DeserializeAuthorizationPolicy(JsonElement e secondaryKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationPolicy(policyName.Value, permissions, primaryKey.Value, secondaryKey.Value); + return new AuthorizationPolicy(policyName.Value, permissions, primaryKey.Value, secondaryKey.Value, serializedAdditionalRawData); + } + + AuthorizationPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.cs index 462c41003dff..1fdef3e5ca91 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicy.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The authorization policy. public partial class AuthorizationPolicy { - /// Initializes a new instance of AuthorizationPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The permissions associated with the policy. /// is null. internal AuthorizationPolicy(IEnumerable permissions) @@ -25,17 +28,24 @@ internal AuthorizationPolicy(IEnumerable permissions) Permissions = permissions.ToList(); } - /// Initializes a new instance of AuthorizationPolicy. + /// Initializes a new instance of . /// Name of the policy. /// The permissions associated with the policy. /// Primary key associated with the policy. /// Secondary key associated with the policy. - internal AuthorizationPolicy(string policyName, IReadOnlyList permissions, string primaryKey, string secondaryKey) + /// Keeps track of any properties unknown to the library. + internal AuthorizationPolicy(string policyName, IReadOnlyList permissions, string primaryKey, string secondaryKey, Dictionary serializedAdditionalRawData) { PolicyName = policyName; Permissions = permissions; PrimaryKey = primaryKey; SecondaryKey = secondaryKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AuthorizationPolicy() + { } /// Name of the policy. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.Serialization.cs index ac74b9f4483a..bcf61e5ac653 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class AuthorizationPolicyListResult + internal partial class AuthorizationPolicyListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AuthorizationPolicyListResult DeserializeAuthorizationPolicyListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AuthorizationPolicyListResult DeserializeAuthorizationPolicyListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static AuthorizationPolicyListResult DeserializeAuthorizationPolicyList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AuthorizationPolicyListResult(Optional.ToList(value), nextLink.Value); + return new AuthorizationPolicyListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AuthorizationPolicyListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationPolicyListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationPolicyListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationPolicyListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationPolicyListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationPolicyListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationPolicyListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.cs index 7d61840cd240..4ad71e903756 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list authorization policy operation. internal partial class AuthorizationPolicyListResult { - /// Initializes a new instance of AuthorizationPolicyListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AuthorizationPolicyListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AuthorizationPolicyListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal AuthorizationPolicyListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AuthorizationPolicyListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyResourceFormatData.Serialization.cs index c7781c4d5fd5..7957bdf6cf05 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/AuthorizationPolicyResourceFormatData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class AuthorizationPolicyResourceFormatData : IUtf8JsonSerializable + public partial class AuthorizationPolicyResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(SecondaryKey); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AuthorizationPolicyResourceFormatData DeserializeAuthorizationPolicyResourceFormatData(JsonElement element) + internal static AuthorizationPolicyResourceFormatData DeserializeAuthorizationPolicyResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +79,7 @@ internal static AuthorizationPolicyResourceFormatData DeserializeAuthorizationPo Optional> permissions = default; Optional primaryKey = default; Optional secondaryKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -125,8 +147,61 @@ internal static AuthorizationPolicyResourceFormatData DeserializeAuthorizationPo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AuthorizationPolicyResourceFormatData(id, name, type, systemData.Value, policyName.Value, Optional.ToList(permissions), primaryKey.Value, secondaryKey.Value, serializedAdditionalRawData); + } + + AuthorizationPolicyResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationPolicyResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AuthorizationPolicyResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthorizationPolicyResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AuthorizationPolicyResourceFormatData model) + { + if (model is null) + { + return null; } - return new AuthorizationPolicyResourceFormatData(id, name, type, systemData.Value, policyName.Value, Optional.ToList(permissions), primaryKey.Value, secondaryKey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AuthorizationPolicyResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthorizationPolicyResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.Serialization.cs index baab333293f4..92abfec0b2d9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class CanonicalProfileDefinition + public partial class CanonicalProfileDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CanonicalProfileDefinition DeserializeCanonicalProfileDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(CanonicalProfileId)) + { + writer.WritePropertyName("canonicalProfileId"u8); + writer.WriteNumberValue(CanonicalProfileId.Value); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CanonicalProfileDefinition DeserializeCanonicalProfileDefinition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional canonicalProfileId = default; Optional> properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("canonicalProfileId"u8)) @@ -46,8 +96,61 @@ internal static CanonicalProfileDefinition DeserializeCanonicalProfileDefinition properties = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CanonicalProfileDefinition(Optional.ToNullable(canonicalProfileId), Optional.ToList(properties)); + return new CanonicalProfileDefinition(Optional.ToNullable(canonicalProfileId), Optional.ToList(properties), serializedAdditionalRawData); + } + + CanonicalProfileDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCanonicalProfileDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CanonicalProfileDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCanonicalProfileDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CanonicalProfileDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CanonicalProfileDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCanonicalProfileDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.cs index 633caf484004..8727bc499462 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Definition of canonical profile. public partial class CanonicalProfileDefinition { - /// Initializes a new instance of CanonicalProfileDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CanonicalProfileDefinition() { Properties = new ChangeTrackingList(); } - /// Initializes a new instance of CanonicalProfileDefinition. + /// Initializes a new instance of . /// Canonical profile ID. /// Properties of the canonical profile. - internal CanonicalProfileDefinition(int? canonicalProfileId, IReadOnlyList properties) + /// Keeps track of any properties unknown to the library. + internal CanonicalProfileDefinition(int? canonicalProfileId, IReadOnlyList properties, Dictionary serializedAdditionalRawData) { CanonicalProfileId = canonicalProfileId; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Canonical profile ID. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.Serialization.cs index bb734350b0a2..a51d03d25f22 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class CanonicalProfileDefinitionPropertiesItem + public partial class CanonicalProfileDefinitionPropertiesItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CanonicalProfileDefinitionPropertiesItem DeserializeCanonicalProfileDefinitionPropertiesItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ProfileName)) + { + writer.WritePropertyName("profileName"u8); + writer.WriteStringValue(ProfileName); + } + if (Optional.IsDefined(ProfilePropertyName)) + { + writer.WritePropertyName("profilePropertyName"u8); + writer.WriteStringValue(ProfilePropertyName); + } + if (Optional.IsDefined(Rank)) + { + writer.WritePropertyName("rank"u8); + writer.WriteNumberValue(Rank.Value); + } + if (Optional.IsDefined(ValueType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ValueType.Value.ToString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CanonicalProfileDefinitionPropertiesItem DeserializeCanonicalProfileDefinitionPropertiesItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static CanonicalProfileDefinitionPropertiesItem DeserializeCanonicalPro Optional rank = default; Optional type = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("profileName"u8)) @@ -58,8 +112,61 @@ internal static CanonicalProfileDefinitionPropertiesItem DeserializeCanonicalPro value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CanonicalProfileDefinitionPropertiesItem(profileName.Value, profilePropertyName.Value, Optional.ToNullable(rank), Optional.ToNullable(type), value.Value); + return new CanonicalProfileDefinitionPropertiesItem(profileName.Value, profilePropertyName.Value, Optional.ToNullable(rank), Optional.ToNullable(type), value.Value, serializedAdditionalRawData); + } + + CanonicalProfileDefinitionPropertiesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCanonicalProfileDefinitionPropertiesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CanonicalProfileDefinitionPropertiesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCanonicalProfileDefinitionPropertiesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CanonicalProfileDefinitionPropertiesItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CanonicalProfileDefinitionPropertiesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCanonicalProfileDefinitionPropertiesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.cs index 00e2956dd237..50f3464e3855 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/CanonicalProfileDefinitionPropertiesItem.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// The definition of a canonical profile property. public partial class CanonicalProfileDefinitionPropertiesItem { - /// Initializes a new instance of CanonicalProfileDefinitionPropertiesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CanonicalProfileDefinitionPropertiesItem() { } - /// Initializes a new instance of CanonicalProfileDefinitionPropertiesItem. + /// Initializes a new instance of . /// Profile name. /// Property name of profile. /// The rank. /// Type of canonical property value. /// Value of the canonical property. - internal CanonicalProfileDefinitionPropertiesItem(string profileName, string profilePropertyName, int? rank, CanonicalPropertyValueType? valueType, string value) + /// Keeps track of any properties unknown to the library. + internal CanonicalProfileDefinitionPropertiesItem(string profileName, string profilePropertyName, int? rank, CanonicalPropertyValueType? valueType, string value, Dictionary serializedAdditionalRawData) { ProfileName = profileName; ProfilePropertyName = profilePropertyName; Rank = rank; ValueType = valueType; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Profile name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.Serialization.cs index 70521c80234f..fbd263faea5c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class ConnectorListResult + internal partial class ConnectorListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectorListResult DeserializeConnectorListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectorListResult DeserializeConnectorListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ConnectorListResult DeserializeConnectorListResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectorListResult(Optional.ToList(value), nextLink.Value); + return new ConnectorListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConnectorListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.cs index fe037e0f1d12..e2f54b9309ad 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list connector operation. internal partial class ConnectorListResult { - /// Initializes a new instance of ConnectorListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectorListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConnectorListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal ConnectorListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConnectorListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.Serialization.cs index 2edca495b0bb..98a7e0236433 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ConnectorMappingAvailability : IUtf8JsonSerializable + public partial class ConnectorMappingAvailability : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Frequency)) { @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("interval"u8); writer.WriteNumberValue(Interval); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingAvailability DeserializeConnectorMappingAvailability(JsonElement element) + internal static ConnectorMappingAvailability DeserializeConnectorMappingAvailability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional frequency = default; int interval = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("frequency"u8)) @@ -49,8 +72,61 @@ internal static ConnectorMappingAvailability DeserializeConnectorMappingAvailabi interval = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingAvailability(Optional.ToNullable(frequency), interval, serializedAdditionalRawData); + } + + ConnectorMappingAvailability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingAvailability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingAvailability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingAvailability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingAvailability model) + { + if (model is null) + { + return null; } - return new ConnectorMappingAvailability(Optional.ToNullable(frequency), interval); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingAvailability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingAvailability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.cs index fac5bd9d2b48..66523cf57e6c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingAvailability.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// Connector mapping property availability. public partial class ConnectorMappingAvailability { - /// Initializes a new instance of ConnectorMappingAvailability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The interval of the given frequency to use. public ConnectorMappingAvailability(int interval) { Interval = interval; } - /// Initializes a new instance of ConnectorMappingAvailability. + /// Initializes a new instance of . /// The frequency to update. /// The interval of the given frequency to use. - internal ConnectorMappingAvailability(FrequencyType? frequency, int interval) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingAvailability(FrequencyType? frequency, int interval, Dictionary serializedAdditionalRawData) { Frequency = frequency; Interval = interval; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorMappingAvailability() + { } /// The frequency to update. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.Serialization.cs index ea899bd3cce3..7ce8f1197288 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ConnectorMappingCompleteOperation : IUtf8JsonSerializable + public partial class ConnectorMappingCompleteOperation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CompletionOperationType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("destinationFolder"u8); writer.WriteStringValue(DestinationFolder); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingCompleteOperation DeserializeConnectorMappingCompleteOperation(JsonElement element) + internal static ConnectorMappingCompleteOperation DeserializeConnectorMappingCompleteOperation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional completionOperationType = default; Optional destinationFolder = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("completionOperationType"u8)) @@ -52,8 +75,61 @@ internal static ConnectorMappingCompleteOperation DeserializeConnectorMappingCom destinationFolder = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingCompleteOperation(Optional.ToNullable(completionOperationType), destinationFolder.Value, serializedAdditionalRawData); + } + + ConnectorMappingCompleteOperation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingCompleteOperation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingCompleteOperation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingCompleteOperation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingCompleteOperation model) + { + if (model is null) + { + return null; } - return new ConnectorMappingCompleteOperation(Optional.ToNullable(completionOperationType), destinationFolder.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingCompleteOperation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingCompleteOperation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.cs index 44b19ee8b502..ea10c4dcdd0b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingCompleteOperation.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// The complete operation. public partial class ConnectorMappingCompleteOperation { - /// Initializes a new instance of ConnectorMappingCompleteOperation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectorMappingCompleteOperation() { } - /// Initializes a new instance of ConnectorMappingCompleteOperation. + /// Initializes a new instance of . /// The type of completion operation. /// The destination folder where files will be moved to once the import is done. - internal ConnectorMappingCompleteOperation(CompletionOperationType? completionOperationType, string destinationFolder) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingCompleteOperation(CompletionOperationType? completionOperationType, string destinationFolder, Dictionary serializedAdditionalRawData) { CompletionOperationType = completionOperationType; DestinationFolder = destinationFolder; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of completion operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.Serialization.cs index ba05f676d386..c93292946dc1 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ConnectorMappingErrorManagement : IUtf8JsonSerializable + public partial class ConnectorMappingErrorManagement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("errorManagementType"u8); writer.WriteStringValue(ErrorManagementType.ToSerialString()); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("errorLimit"u8); writer.WriteNumberValue(ErrorLimit.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingErrorManagement DeserializeConnectorMappingErrorManagement(JsonElement element) + internal static ConnectorMappingErrorManagement DeserializeConnectorMappingErrorManagement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ErrorManagementType errorManagementType = default; Optional errorLimit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errorManagementType"u8)) @@ -49,8 +72,61 @@ internal static ConnectorMappingErrorManagement DeserializeConnectorMappingError errorLimit = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingErrorManagement(errorManagementType, Optional.ToNullable(errorLimit), serializedAdditionalRawData); + } + + ConnectorMappingErrorManagement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingErrorManagement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingErrorManagement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingErrorManagement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingErrorManagement model) + { + if (model is null) + { + return null; } - return new ConnectorMappingErrorManagement(errorManagementType, Optional.ToNullable(errorLimit)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingErrorManagement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingErrorManagement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.cs index 5296379c95c3..63c65f0c06be 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingErrorManagement.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// The error management. public partial class ConnectorMappingErrorManagement { - /// Initializes a new instance of ConnectorMappingErrorManagement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The type of error management to use for the mapping. public ConnectorMappingErrorManagement(ErrorManagementType errorManagementType) { ErrorManagementType = errorManagementType; } - /// Initializes a new instance of ConnectorMappingErrorManagement. + /// Initializes a new instance of . /// The type of error management to use for the mapping. /// The error limit allowed while importing data. - internal ConnectorMappingErrorManagement(ErrorManagementType errorManagementType, int? errorLimit) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingErrorManagement(ErrorManagementType errorManagementType, int? errorLimit, Dictionary serializedAdditionalRawData) { ErrorManagementType = errorManagementType; ErrorLimit = errorLimit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorMappingErrorManagement() + { } /// The type of error management to use for the mapping. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.Serialization.cs index 1db4db9c126b..9280fdf06eca 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ConnectorMappingFormat : IUtf8JsonSerializable + public partial class ConnectorMappingFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("formatType"u8); writer.WriteStringValue(FormatType.ToString()); @@ -42,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("arraySeparator"u8); writer.WriteStringValue(ArraySeparator); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingFormat DeserializeConnectorMappingFormat(JsonElement element) + internal static ConnectorMappingFormat DeserializeConnectorMappingFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -57,6 +79,7 @@ internal static ConnectorMappingFormat DeserializeConnectorMappingFormat(JsonEle Optional quoteCharacter = default; Optional quoteEscapeCharacter = default; Optional arraySeparator = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("formatType"u8)) @@ -89,8 +112,61 @@ internal static ConnectorMappingFormat DeserializeConnectorMappingFormat(JsonEle arraySeparator = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingFormat(formatType, columnDelimiter.Value, acceptLanguage.Value, quoteCharacter.Value, quoteEscapeCharacter.Value, arraySeparator.Value, serializedAdditionalRawData); + } + + ConnectorMappingFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingFormat model) + { + if (model is null) + { + return null; } - return new ConnectorMappingFormat(formatType, columnDelimiter.Value, acceptLanguage.Value, quoteCharacter.Value, quoteEscapeCharacter.Value, arraySeparator.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.cs index a3d96662dffb..9be2fe8ad2af 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingFormat.cs @@ -5,25 +5,32 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// Connector mapping property format. public partial class ConnectorMappingFormat { - /// Initializes a new instance of ConnectorMappingFormat. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectorMappingFormat() { FormatType = FormatType.TextFormat; } - /// Initializes a new instance of ConnectorMappingFormat. + /// Initializes a new instance of . /// The type mapping format. /// The character that signifies a break between columns. /// The oData language. /// Quote character, used to indicate enquoted fields. /// Escape character for quotes, can be the same as the quoteCharacter. /// Character separating array elements. - internal ConnectorMappingFormat(FormatType formatType, string columnDelimiter, string acceptLanguage, string quoteCharacter, string quoteEscapeCharacter, string arraySeparator) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingFormat(FormatType formatType, string columnDelimiter, string acceptLanguage, string quoteCharacter, string quoteEscapeCharacter, string arraySeparator, Dictionary serializedAdditionalRawData) { FormatType = formatType; ColumnDelimiter = columnDelimiter; @@ -31,6 +38,7 @@ internal ConnectorMappingFormat(FormatType formatType, string columnDelimiter, s QuoteCharacter = quoteCharacter; QuoteEscapeCharacter = quoteEscapeCharacter; ArraySeparator = arraySeparator; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type mapping format. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.Serialization.cs index 34fd854cb024..68a04d9cff0c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class ConnectorMappingListResult + internal partial class ConnectorMappingListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ConnectorMappingListResult DeserializeConnectorMappingListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ConnectorMappingListResult DeserializeConnectorMappingListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ConnectorMappingListResult DeserializeConnectorMappingListResult nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectorMappingListResult(Optional.ToList(value), nextLink.Value); + return new ConnectorMappingListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ConnectorMappingListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.cs index 27112f556401..1d3dd0b83a2b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list connector mapping operation. internal partial class ConnectorMappingListResult { - /// Initializes a new instance of ConnectorMappingListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ConnectorMappingListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ConnectorMappingListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal ConnectorMappingListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.Serialization.cs index d13b2d58517d..184cbb10a324 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ConnectorMappingProperties : IUtf8JsonSerializable + public partial class ConnectorMappingProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FolderPath)) { @@ -32,25 +39,74 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(HasHeader.Value); } writer.WritePropertyName("errorManagement"u8); - writer.WriteObjectValue(ErrorManagement); + if (ErrorManagement is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ErrorManagement).Serialize(writer, options); + } writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } writer.WritePropertyName("availability"u8); - writer.WriteObjectValue(Availability); + if (Availability is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Availability).Serialize(writer, options); + } writer.WritePropertyName("structure"u8); writer.WriteStartArray(); foreach (var item in Structure) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("completeOperation"u8); - writer.WriteObjectValue(CompleteOperation); + if (CompleteOperation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CompleteOperation).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingProperties DeserializeConnectorMappingProperties(JsonElement element) + internal static ConnectorMappingProperties DeserializeConnectorMappingProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +119,7 @@ internal static ConnectorMappingProperties DeserializeConnectorMappingProperties ConnectorMappingAvailability availability = default; IList structure = default; ConnectorMappingCompleteOperation completeOperation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("folderPath"u8)) @@ -114,8 +171,61 @@ internal static ConnectorMappingProperties DeserializeConnectorMappingProperties completeOperation = ConnectorMappingCompleteOperation.DeserializeConnectorMappingCompleteOperation(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingProperties(folderPath.Value, fileFilter.Value, Optional.ToNullable(hasHeader), errorManagement, format, availability, structure, completeOperation, serializedAdditionalRawData); + } + + ConnectorMappingProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingProperties(Response response) + { + if (response is null) + { + return null; } - return new ConnectorMappingProperties(folderPath.Value, fileFilter.Value, Optional.ToNullable(hasHeader), errorManagement, format, availability, structure, completeOperation); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.cs index 003d04f87068..d0c10a1ae8a6 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingProperties.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The connector mapping properties. public partial class ConnectorMappingProperties { - /// Initializes a new instance of ConnectorMappingProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The error management setting for the mapping. /// The format of mapping property. /// The availability of mapping property. @@ -37,7 +40,7 @@ public ConnectorMappingProperties(ConnectorMappingErrorManagement errorManagemen CompleteOperation = completeOperation; } - /// Initializes a new instance of ConnectorMappingProperties. + /// Initializes a new instance of . /// The folder path for the mapping. /// The file filter for the mapping. /// If the file contains a header or not. @@ -46,7 +49,8 @@ public ConnectorMappingProperties(ConnectorMappingErrorManagement errorManagemen /// The availability of mapping property. /// Ingestion mapping information at property level. /// The operation after import is done. - internal ConnectorMappingProperties(string folderPath, string fileFilter, bool? hasHeader, ConnectorMappingErrorManagement errorManagement, ConnectorMappingFormat format, ConnectorMappingAvailability availability, IList structure, ConnectorMappingCompleteOperation completeOperation) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingProperties(string folderPath, string fileFilter, bool? hasHeader, ConnectorMappingErrorManagement errorManagement, ConnectorMappingFormat format, ConnectorMappingAvailability availability, IList structure, ConnectorMappingCompleteOperation completeOperation, Dictionary serializedAdditionalRawData) { FolderPath = folderPath; FileFilter = fileFilter; @@ -56,6 +60,12 @@ internal ConnectorMappingProperties(string folderPath, string fileFilter, bool? Availability = availability; Structure = structure; CompleteOperation = completeOperation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorMappingProperties() + { } /// The folder path for the mapping. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingResourceFormatData.Serialization.cs index 3f27368fda85..914803c3502a 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingResourceFormatData.Serialization.cs @@ -6,17 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class ConnectorMappingResourceFormatData : IUtf8JsonSerializable + public partial class ConnectorMappingResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -48,14 +55,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(MappingProperties)) { writer.WritePropertyName("mappingProperties"u8); - writer.WriteObjectValue(MappingProperties); + if (MappingProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MappingProperties).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingResourceFormatData DeserializeConnectorMappingResourceFormatData(JsonElement element) + internal static ConnectorMappingResourceFormatData DeserializeConnectorMappingResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -79,6 +107,7 @@ internal static ConnectorMappingResourceFormatData DeserializeConnectorMappingRe Optional runId = default; Optional state = default; Optional tenantId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -224,8 +253,61 @@ internal static ConnectorMappingResourceFormatData DeserializeConnectorMappingRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingResourceFormatData(id, name, type, systemData.Value, connectorName.Value, Optional.ToNullable(connectorType), Optional.ToNullable(created), Optional.ToNullable(lastModified), Optional.ToNullable(entityType), entityTypeName.Value, connectorMappingName.Value, displayName.Value, description.Value, dataFormatId.Value, mappingProperties.Value, Optional.ToNullable(nextRunTime), runId.Value, Optional.ToNullable(state), Optional.ToNullable(tenantId), serializedAdditionalRawData); + } + + ConnectorMappingResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingResourceFormatData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingResourceFormatData(Response response) + { + if (response is null) + { + return null; } - return new ConnectorMappingResourceFormatData(id, name, type, systemData.Value, connectorName.Value, Optional.ToNullable(connectorType), Optional.ToNullable(created), Optional.ToNullable(lastModified), Optional.ToNullable(entityType), entityTypeName.Value, connectorMappingName.Value, displayName.Value, description.Value, dataFormatId.Value, mappingProperties.Value, Optional.ToNullable(nextRunTime), runId.Value, Optional.ToNullable(state), Optional.ToNullable(tenantId)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.Serialization.cs index 5ca89d2e2d23..1486bedd317e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ConnectorMappingStructure : IUtf8JsonSerializable + public partial class ConnectorMappingStructure : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("propertyName"u8); writer.WriteStringValue(PropertyName); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isEncrypted"u8); writer.WriteBooleanValue(IsEncrypted.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorMappingStructure DeserializeConnectorMappingStructure(JsonElement element) + internal static ConnectorMappingStructure DeserializeConnectorMappingStructure(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ConnectorMappingStructure DeserializeConnectorMappingStructure(J string columnName = default; Optional customFormatSpecifier = default; Optional isEncrypted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("propertyName"u8)) @@ -68,8 +91,61 @@ internal static ConnectorMappingStructure DeserializeConnectorMappingStructure(J isEncrypted = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectorMappingStructure(propertyName, columnName, customFormatSpecifier.Value, Optional.ToNullable(isEncrypted), serializedAdditionalRawData); + } + + ConnectorMappingStructure IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorMappingStructure(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorMappingStructure IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorMappingStructure(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorMappingStructure model) + { + if (model is null) + { + return null; } - return new ConnectorMappingStructure(propertyName, columnName, customFormatSpecifier.Value, Optional.ToNullable(isEncrypted)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorMappingStructure(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorMappingStructure(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.cs index e0ae6c41fb6b..344f02e9f8e0 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorMappingStructure.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Connector mapping property structure. public partial class ConnectorMappingStructure { - /// Initializes a new instance of ConnectorMappingStructure. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The property name of the mapping entity. /// The column name of the import file. /// or is null. @@ -26,17 +30,24 @@ public ConnectorMappingStructure(string propertyName, string columnName) ColumnName = columnName; } - /// Initializes a new instance of ConnectorMappingStructure. + /// Initializes a new instance of . /// The property name of the mapping entity. /// The column name of the import file. /// Custom format specifier for input parsing. /// Indicates if the column is encrypted. - internal ConnectorMappingStructure(string propertyName, string columnName, string customFormatSpecifier, bool? isEncrypted) + /// Keeps track of any properties unknown to the library. + internal ConnectorMappingStructure(string propertyName, string columnName, string customFormatSpecifier, bool? isEncrypted, Dictionary serializedAdditionalRawData) { PropertyName = propertyName; ColumnName = columnName; CustomFormatSpecifier = customFormatSpecifier; IsEncrypted = isEncrypted; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorMappingStructure() + { } /// The property name of the mapping entity. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorResourceFormatData.Serialization.cs index 7bec4f52fbce..355aaf0027d9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ConnectorResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class ConnectorResourceFormatData : IUtf8JsonSerializable + public partial class ConnectorResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -67,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteBooleanValue(IsInternal.Value); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectorResourceFormatData DeserializeConnectorResourceFormatData(JsonElement element) + internal static ConnectorResourceFormatData DeserializeConnectorResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +111,7 @@ internal static ConnectorResourceFormatData DeserializeConnectorResourceFormatDa Optional state = default; Optional tenantId = default; Optional isInternal = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -228,8 +249,61 @@ internal static ConnectorResourceFormatData DeserializeConnectorResourceFormatDa } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ConnectorResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(connectorId), connectorName.Value, Optional.ToNullable(connectorType), displayName.Value, description.Value, Optional.ToDictionary(connectorProperties), Optional.ToNullable(created), Optional.ToNullable(lastModified), Optional.ToNullable(state), Optional.ToNullable(tenantId), Optional.ToNullable(isInternal)); + return new ConnectorResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(connectorId), connectorName.Value, Optional.ToNullable(connectorType), displayName.Value, description.Value, Optional.ToDictionary(connectorProperties), Optional.ToNullable(created), Optional.ToNullable(lastModified), Optional.ToNullable(state), Optional.ToNullable(tenantId), Optional.ToNullable(isInternal), serializedAdditionalRawData); + } + + ConnectorResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectorResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectorResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectorResourceFormatData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectorResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectorResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.Serialization.cs index 8100d44e74b9..475e6db71129 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.Serialization.cs @@ -5,15 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class DataSourcePrecedence + public partial class DataSourcePrecedence : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataSourcePrecedence DeserializeDataSourcePrecedence(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Precedence)) + { + writer.WritePropertyName("precedence"u8); + writer.WriteNumberValue(Precedence.Value); + } + writer.WritePropertyName("dataSource"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataSourcePrecedence DeserializeDataSourcePrecedence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +60,7 @@ internal static DataSourcePrecedence DeserializeDataSourcePrecedence(JsonElement Optional status = default; Optional id = default; Optional dataSourceReferenceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("precedence"u8)) @@ -84,8 +121,61 @@ internal static DataSourcePrecedence DeserializeDataSourcePrecedence(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataSourcePrecedence(Optional.ToNullable(precedence), name.Value, Optional.ToNullable(dataSourceType), Optional.ToNullable(status), Optional.ToNullable(id), dataSourceReferenceId.Value); + return new DataSourcePrecedence(Optional.ToNullable(precedence), name.Value, Optional.ToNullable(dataSourceType), Optional.ToNullable(status), Optional.ToNullable(id), dataSourceReferenceId.Value, serializedAdditionalRawData); + } + + DataSourcePrecedence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataSourcePrecedence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataSourcePrecedence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataSourcePrecedence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataSourcePrecedence model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataSourcePrecedence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataSourcePrecedence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.cs index b2a6f228191d..f18a526e2512 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/DataSourcePrecedence.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// The data source precedence is a way to know the precedence of each data source. public partial class DataSourcePrecedence { - /// Initializes a new instance of DataSourcePrecedence. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataSourcePrecedence() { } - /// Initializes a new instance of DataSourcePrecedence. + /// Initializes a new instance of . /// the precedence value. /// The data source name. /// The data source type. /// The data source status. /// The data source ID. /// The data source reference id. - internal DataSourcePrecedence(int? precedence, string name, DataSourceType? dataSourceType, Status? status, int? id, string dataSourceReferenceId) + /// Keeps track of any properties unknown to the library. + internal DataSourcePrecedence(int? precedence, string name, DataSourceType? dataSourceType, Status? status, int? id, string dataSourceReferenceId, Dictionary serializedAdditionalRawData) { Precedence = precedence; Name = name; @@ -30,6 +37,7 @@ internal DataSourcePrecedence(int? precedence, string name, DataSourceType? data Status = status; Id = id; DataSourceReferenceId = dataSourceReferenceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// the precedence value. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.Serialization.cs index f45c17f4fdc5..9870291b0f44 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class GetImageUploadUrlInput : IUtf8JsonSerializable + public partial class GetImageUploadUrlInput : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EntityType)) { @@ -30,7 +38,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("relativePath"u8); writer.WriteStringValue(RelativePath); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GetImageUploadUrlInput DeserializeGetImageUploadUrlInput(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional entityType = default; + Optional entityTypeName = default; + Optional relativePath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("entityType"u8)) + { + entityType = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityTypeName"u8)) + { + entityTypeName = property.Value.GetString(); + continue; + } + if (property.NameEquals("relativePath"u8)) + { + relativePath = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GetImageUploadUrlInput(entityType.Value, entityTypeName.Value, relativePath.Value, serializedAdditionalRawData); + } + + GetImageUploadUrlInput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetImageUploadUrlInput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetImageUploadUrlInput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetImageUploadUrlInput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetImageUploadUrlInput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetImageUploadUrlInput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetImageUploadUrlInput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.cs index dfabcbd53390..4d41021cd912 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/GetImageUploadUrlInput.cs @@ -5,16 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// Input type for getting image upload url. public partial class GetImageUploadUrlInput { - /// Initializes a new instance of GetImageUploadUrlInput. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GetImageUploadUrlInput() { } + /// Initializes a new instance of . + /// Type of entity. Can be Profile or Interaction. + /// Name of the entity type. + /// Relative path of the image. + /// Keeps track of any properties unknown to the library. + internal GetImageUploadUrlInput(string entityType, string entityTypeName, string relativePath, Dictionary serializedAdditionalRawData) + { + EntityType = entityType; + EntityTypeName = entityTypeName; + RelativePath = relativePath; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Type of entity. Can be Profile or Interaction. public string EntityType { get; set; } /// Name of the entity type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.Serialization.cs index 3e4cdf926e17..1010be99f320 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class HubBillingInfoFormat : IUtf8JsonSerializable + public partial class HubBillingInfoFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SkuName)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxUnits"u8); writer.WriteNumberValue(MaxUnits.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HubBillingInfoFormat DeserializeHubBillingInfoFormat(JsonElement element) + internal static HubBillingInfoFormat DeserializeHubBillingInfoFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static HubBillingInfoFormat DeserializeHubBillingInfoFormat(JsonElement Optional skuName = default; Optional minUnits = default; Optional maxUnits = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("skuName"u8)) @@ -67,8 +90,61 @@ internal static HubBillingInfoFormat DeserializeHubBillingInfoFormat(JsonElement maxUnits = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HubBillingInfoFormat(skuName.Value, Optional.ToNullable(minUnits), Optional.ToNullable(maxUnits), serializedAdditionalRawData); + } + + HubBillingInfoFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHubBillingInfoFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HubBillingInfoFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHubBillingInfoFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HubBillingInfoFormat model) + { + if (model is null) + { + return null; } - return new HubBillingInfoFormat(skuName.Value, Optional.ToNullable(minUnits), Optional.ToNullable(maxUnits)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HubBillingInfoFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHubBillingInfoFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.cs index 6899ce80944e..28d5ea0a31c7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubBillingInfoFormat.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// Hub billing info. public partial class HubBillingInfoFormat { - /// Initializes a new instance of HubBillingInfoFormat. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HubBillingInfoFormat() { } - /// Initializes a new instance of HubBillingInfoFormat. + /// Initializes a new instance of . /// The sku name. /// The minimum number of units will be billed. One unit is 10,000 Profiles and 100,000 Interactions. /// The maximum number of units can be used. One unit is 10,000 Profiles and 100,000 Interactions. - internal HubBillingInfoFormat(string skuName, int? minUnits, int? maxUnits) + /// Keeps track of any properties unknown to the library. + internal HubBillingInfoFormat(string skuName, int? minUnits, int? maxUnits, Dictionary serializedAdditionalRawData) { SkuName = skuName; MinUnits = minUnits; MaxUnits = maxUnits; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The sku name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubData.Serialization.cs index 7b32e6a53353..5678f77cb1a2 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class HubData : IUtf8JsonSerializable + public partial class HubData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -41,14 +48,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HubBillingInfo)) { writer.WritePropertyName("hubBillingInfo"u8); - writer.WriteObjectValue(HubBillingInfo); + if (HubBillingInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)HubBillingInfo).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HubData DeserializeHubData(JsonElement element) + internal static HubData DeserializeHubData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +92,7 @@ internal static HubData DeserializeHubData(JsonElement element) Optional provisioningState = default; Optional tenantFeatures = default; Optional hubBillingInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -154,8 +183,61 @@ internal static HubData DeserializeHubData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HubData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, apiEndpoint.Value, webEndpoint.Value, provisioningState.Value, Optional.ToNullable(tenantFeatures), hubBillingInfo.Value, serializedAdditionalRawData); + } + + HubData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHubData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HubData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHubData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HubData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HubData(Response response) + { + if (response is null) + { + return null; } - return new HubData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, apiEndpoint.Value, webEndpoint.Value, provisioningState.Value, Optional.ToNullable(tenantFeatures), hubBillingInfo.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHubData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.Serialization.cs index f2e7f9581f9a..314376977cae 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class HubListResult + internal partial class HubListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static HubListResult DeserializeHubListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static HubListResult DeserializeHubListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static HubListResult DeserializeHubListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new HubListResult(Optional.ToList(value), nextLink.Value); + return new HubListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + HubListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHubListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HubListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHubListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HubListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HubListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHubListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.cs index bbcdeb96b833..2e02ac0bef27 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/HubListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Response of list hub operation. internal partial class HubListResult { - /// Initializes a new instance of HubListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal HubListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of HubListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link for next set of results. - internal HubListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal HubListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.Serialization.cs index 16eb4933ba6e..6c773ef9534b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ImageDefinition + public partial class ImageDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ImageDefinition DeserializeImageDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ImageExists)) + { + writer.WritePropertyName("imageExists"u8); + writer.WriteBooleanValue(ImageExists.Value); + } + if (Optional.IsDefined(ContentUri)) + { + writer.WritePropertyName("contentUrl"u8); + writer.WriteStringValue(ContentUri.AbsoluteUri); + } + if (Optional.IsDefined(RelativePath)) + { + writer.WritePropertyName("relativePath"u8); + writer.WriteStringValue(RelativePath); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ImageDefinition DeserializeImageDefinition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static ImageDefinition DeserializeImageDefinition(JsonElement element) Optional imageExists = default; Optional contentUrl = default; Optional relativePath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageExists"u8)) @@ -47,8 +90,61 @@ internal static ImageDefinition DeserializeImageDefinition(JsonElement element) relativePath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ImageDefinition(Optional.ToNullable(imageExists), contentUrl.Value, relativePath.Value); + return new ImageDefinition(Optional.ToNullable(imageExists), contentUrl.Value, relativePath.Value, serializedAdditionalRawData); + } + + ImageDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.cs index a55c7240d566..ef6b2d1ee4f1 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ImageDefinition.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CustomerInsights.Models { /// The image definition. public partial class ImageDefinition { - /// Initializes a new instance of ImageDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ImageDefinition() { } - /// Initializes a new instance of ImageDefinition. + /// Initializes a new instance of . /// Whether image exists already. /// Content URL for the image blob. /// Relative path of the image. - internal ImageDefinition(bool? imageExists, Uri contentUri, string relativePath) + /// Keeps track of any properties unknown to the library. + internal ImageDefinition(bool? imageExists, Uri contentUri, string relativePath, Dictionary serializedAdditionalRawData) { ImageExists = imageExists; ContentUri = contentUri; RelativePath = relativePath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Whether image exists already. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.Serialization.cs index 0aba77166743..0548db5e9c05 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class InteractionListResult + internal partial class InteractionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static InteractionListResult DeserializeInteractionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static InteractionListResult DeserializeInteractionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static InteractionListResult DeserializeInteractionListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new InteractionListResult(Optional.ToList(value), nextLink.Value); + return new InteractionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + InteractionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInteractionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InteractionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInteractionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InteractionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InteractionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInteractionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.cs index e0cb354d7422..3554da9789fd 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list interaction operation. internal partial class InteractionListResult { - /// Initializes a new instance of InteractionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal InteractionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of InteractionListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal InteractionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal InteractionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionResourceFormatData.Serialization.cs index fd3b28981782..dd41acecbf73 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/InteractionResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class InteractionResourceFormatData : IUtf8JsonSerializable + public partial class InteractionResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -117,7 +123,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Fields) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -157,7 +170,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ParticipantProfiles) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -175,11 +195,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WriteEndObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static InteractionResourceFormatData DeserializeInteractionResourceFormatData(JsonElement element) + internal static InteractionResourceFormatData DeserializeInteractionResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -215,6 +249,7 @@ internal static InteractionResourceFormatData DeserializeInteractionResourceForm Optional status = default; Optional id0 = default; Optional dataSourceReferenceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -532,8 +567,61 @@ internal static InteractionResourceFormatData DeserializeInteractionResourceForm } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new InteractionResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(attributes), Optional.ToDictionary(description), Optional.ToDictionary(displayName), Optional.ToDictionary(localizedAttributes), smallImage.Value, mediumImage.Value, largeImage.Value, apiEntitySetName.Value, Optional.ToNullable(entityType), Optional.ToList(fields), Optional.ToNullable(instancesCount), Optional.ToNullable(lastChangedUtc), Optional.ToNullable(provisioningState), schemaItemTypeLink.Value, Optional.ToNullable(tenantId), timestampFieldName.Value, typeName.Value, Optional.ToList(idPropertyNames), Optional.ToList(participantProfiles), primaryParticipantProfilePropertyName.Value, Optional.ToList(dataSourcePrecedenceRules), Optional.ToNullable(isActivity), name0.Value, Optional.ToNullable(dataSourceType), Optional.ToNullable(status), Optional.ToNullable(id0), dataSourceReferenceId.Value, serializedAdditionalRawData); + } + + InteractionResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInteractionResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InteractionResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInteractionResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InteractionResourceFormatData model) + { + if (model is null) + { + return null; } - return new InteractionResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(attributes), Optional.ToDictionary(description), Optional.ToDictionary(displayName), Optional.ToDictionary(localizedAttributes), smallImage.Value, mediumImage.Value, largeImage.Value, apiEntitySetName.Value, Optional.ToNullable(entityType), Optional.ToList(fields), Optional.ToNullable(instancesCount), Optional.ToNullable(lastChangedUtc), Optional.ToNullable(provisioningState), schemaItemTypeLink.Value, Optional.ToNullable(tenantId), timestampFieldName.Value, typeName.Value, Optional.ToList(idPropertyNames), Optional.ToList(participantProfiles), primaryParticipantProfilePropertyName.Value, Optional.ToList(dataSourcePrecedenceRules), Optional.ToNullable(isActivity), name0.Value, Optional.ToNullable(dataSourceType), Optional.ToNullable(status), Optional.ToNullable(id0), dataSourceReferenceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InteractionResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInteractionResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.Serialization.cs index b3692b1e96b0..31d6d8e0c494 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class KpiAlias : IUtf8JsonSerializable + public partial class KpiAlias : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("aliasName"u8); writer.WriteStringValue(AliasName); writer.WritePropertyName("expression"u8); writer.WriteStringValue(Expression); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KpiAlias DeserializeKpiAlias(JsonElement element) + internal static KpiAlias DeserializeKpiAlias(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string aliasName = default; string expression = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("aliasName"u8)) @@ -42,8 +65,61 @@ internal static KpiAlias DeserializeKpiAlias(JsonElement element) expression = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KpiAlias(aliasName, expression, serializedAdditionalRawData); + } + + KpiAlias IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiAlias(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiAlias IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiAlias(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiAlias model) + { + if (model is null) + { + return null; } - return new KpiAlias(aliasName, expression); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiAlias(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiAlias(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.cs index 4ff66dc3f9c7..11c8d3f022dd 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiAlias.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The KPI alias. public partial class KpiAlias { - /// Initializes a new instance of KpiAlias. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// KPI alias name. /// The expression. /// or is null. @@ -26,6 +30,22 @@ public KpiAlias(string aliasName, string expression) Expression = expression; } + /// Initializes a new instance of . + /// KPI alias name. + /// The expression. + /// Keeps track of any properties unknown to the library. + internal KpiAlias(string aliasName, string expression, Dictionary serializedAdditionalRawData) + { + AliasName = aliasName; + Expression = expression; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KpiAlias() + { + } + /// KPI alias name. public string AliasName { get; set; } /// The expression. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.Serialization.cs index 911f55d49e41..4c5ee63c8c53 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.Serialization.cs @@ -8,14 +8,143 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class KpiDefinition + public partial class KpiDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KpiDefinition DeserializeKpiDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("entityType"u8); + writer.WriteStringValue(EntityType.ToSerialString()); + writer.WritePropertyName("entityTypeName"u8); + writer.WriteStringValue(EntityTypeName); + if (Optional.IsCollectionDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStartObject(); + foreach (var item in DisplayName) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStartObject(); + foreach (var item in Description) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("calculationWindow"u8); + writer.WriteStringValue(CalculationWindow.ToSerialString()); + if (Optional.IsDefined(CalculationWindowFieldName)) + { + writer.WritePropertyName("calculationWindowFieldName"u8); + writer.WriteStringValue(CalculationWindowFieldName); + } + writer.WritePropertyName("function"u8); + writer.WriteStringValue(Function.ToSerialString()); + writer.WritePropertyName("expression"u8); + writer.WriteStringValue(Expression); + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (Optional.IsDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteStringValue(Filter); + } + if (Optional.IsCollectionDefined(GroupBy)) + { + writer.WritePropertyName("groupBy"u8); + writer.WriteStartArray(); + foreach (var item in GroupBy) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ThresHolds)) + { + writer.WritePropertyName("thresHolds"u8); + if (ThresHolds is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ThresHolds).Serialize(writer, options); + } + } + if (Optional.IsCollectionDefined(Aliases)) + { + writer.WritePropertyName("aliases"u8); + writer.WriteStartArray(); + foreach (var item in Aliases) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Extracts)) + { + writer.WritePropertyName("extracts"u8); + writer.WriteStartArray(); + foreach (var item in Extracts) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KpiDefinition DeserializeKpiDefinition(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +168,7 @@ internal static KpiDefinition DeserializeKpiDefinition(JsonElement element) Optional thresHolds = default; Optional> aliases = default; Optional> extracts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("entityType"u8)) @@ -211,8 +341,61 @@ internal static KpiDefinition DeserializeKpiDefinition(JsonElement element) extracts = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KpiDefinition(entityType, entityTypeName, Optional.ToNullable(tenantId), kpiName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), calculationWindow, calculationWindowFieldName.Value, function, expression, unit.Value, filter.Value, Optional.ToList(groupBy), Optional.ToList(groupByMetadata), Optional.ToList(participantProfilesMetadata), Optional.ToNullable(provisioningState), thresHolds.Value, Optional.ToList(aliases), Optional.ToList(extracts)); + return new KpiDefinition(entityType, entityTypeName, Optional.ToNullable(tenantId), kpiName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), calculationWindow, calculationWindowFieldName.Value, function, expression, unit.Value, filter.Value, Optional.ToList(groupBy), Optional.ToList(groupByMetadata), Optional.ToList(participantProfilesMetadata), Optional.ToNullable(provisioningState), thresHolds.Value, Optional.ToList(aliases), Optional.ToList(extracts), serializedAdditionalRawData); + } + + KpiDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.cs index cae6b8fe18ce..abf42af2daf0 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiDefinition.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Defines the KPI Threshold limits. public partial class KpiDefinition { - /// Initializes a new instance of KpiDefinition. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The mapping entity type. /// The mapping entity name. /// The calculation window. @@ -40,7 +43,7 @@ internal KpiDefinition(EntityType entityType, string entityTypeName, Calculation Extracts = new ChangeTrackingList(); } - /// Initializes a new instance of KpiDefinition. + /// Initializes a new instance of . /// The mapping entity type. /// The mapping entity name. /// The hub name. @@ -60,7 +63,8 @@ internal KpiDefinition(EntityType entityType, string entityTypeName, Calculation /// The KPI thresholds. /// The aliases. /// The KPI extracts. - internal KpiDefinition(EntityType entityType, string entityTypeName, Guid? tenantId, string kpiName, IReadOnlyDictionary displayName, IReadOnlyDictionary description, CalculationWindowType calculationWindow, string calculationWindowFieldName, KpiFunction function, string expression, string unit, string filter, IReadOnlyList groupBy, IReadOnlyList groupByMetadata, IReadOnlyList participantProfilesMetadata, ProvisioningState? provisioningState, KpiThresholds thresHolds, IReadOnlyList aliases, IReadOnlyList extracts) + /// Keeps track of any properties unknown to the library. + internal KpiDefinition(EntityType entityType, string entityTypeName, Guid? tenantId, string kpiName, IReadOnlyDictionary displayName, IReadOnlyDictionary description, CalculationWindowType calculationWindow, string calculationWindowFieldName, KpiFunction function, string expression, string unit, string filter, IReadOnlyList groupBy, IReadOnlyList groupByMetadata, IReadOnlyList participantProfilesMetadata, ProvisioningState? provisioningState, KpiThresholds thresHolds, IReadOnlyList aliases, IReadOnlyList extracts, Dictionary serializedAdditionalRawData) { EntityType = entityType; EntityTypeName = entityTypeName; @@ -81,6 +85,12 @@ internal KpiDefinition(EntityType entityType, string entityTypeName, Guid? tenan ThresHolds = thresHolds; Aliases = aliases; Extracts = extracts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KpiDefinition() + { } /// The mapping entity type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.Serialization.cs index f9e82646c6bf..2267a87e34fd 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class KpiExtract : IUtf8JsonSerializable + public partial class KpiExtract : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("extractName"u8); writer.WriteStringValue(ExtractName); writer.WritePropertyName("expression"u8); writer.WriteStringValue(Expression); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KpiExtract DeserializeKpiExtract(JsonElement element) + internal static KpiExtract DeserializeKpiExtract(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string extractName = default; string expression = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extractName"u8)) @@ -42,8 +65,61 @@ internal static KpiExtract DeserializeKpiExtract(JsonElement element) expression = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KpiExtract(extractName, expression, serializedAdditionalRawData); + } + + KpiExtract IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiExtract(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiExtract IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiExtract(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiExtract model) + { + if (model is null) + { + return null; } - return new KpiExtract(extractName, expression); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiExtract(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiExtract(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.cs index 73060617c9a9..eb742af8c00d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiExtract.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The KPI extract. public partial class KpiExtract { - /// Initializes a new instance of KpiExtract. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// KPI extract name. /// The expression. /// or is null. @@ -26,6 +30,22 @@ public KpiExtract(string extractName, string expression) Expression = expression; } + /// Initializes a new instance of . + /// KPI extract name. + /// The expression. + /// Keeps track of any properties unknown to the library. + internal KpiExtract(string extractName, string expression, Dictionary serializedAdditionalRawData) + { + ExtractName = extractName; + Expression = expression; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KpiExtract() + { + } + /// KPI extract name. public string ExtractName { get; set; } /// The expression. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.Serialization.cs index 637153c0be6b..3eecd596b4f5 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.Serialization.cs @@ -5,16 +5,64 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class KpiGroupByMetadata + public partial class KpiGroupByMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KpiGroupByMetadata DeserializeKpiGroupByMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStartObject(); + foreach (var item in DisplayName) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(FieldName)) + { + writer.WritePropertyName("fieldName"u8); + writer.WriteStringValue(FieldName); + } + if (Optional.IsDefined(FieldType)) + { + writer.WritePropertyName("fieldType"u8); + writer.WriteStringValue(FieldType); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KpiGroupByMetadata DeserializeKpiGroupByMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +70,7 @@ internal static KpiGroupByMetadata DeserializeKpiGroupByMetadata(JsonElement ele Optional> displayName = default; Optional fieldName = default; Optional fieldType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("displayName"u8)) @@ -48,8 +97,61 @@ internal static KpiGroupByMetadata DeserializeKpiGroupByMetadata(JsonElement ele fieldType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KpiGroupByMetadata(Optional.ToDictionary(displayName), fieldName.Value, fieldType.Value); + return new KpiGroupByMetadata(Optional.ToDictionary(displayName), fieldName.Value, fieldType.Value, serializedAdditionalRawData); + } + + KpiGroupByMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiGroupByMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiGroupByMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiGroupByMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiGroupByMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiGroupByMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiGroupByMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.cs index 2c82b46ba1cf..5d8cb88b7158 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiGroupByMetadata.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The KPI GroupBy field metadata. public partial class KpiGroupByMetadata { - /// Initializes a new instance of KpiGroupByMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal KpiGroupByMetadata() { DisplayName = new ChangeTrackingDictionary(); } - /// Initializes a new instance of KpiGroupByMetadata. + /// Initializes a new instance of . /// The display name. /// The name of the field. /// The type of the field. - internal KpiGroupByMetadata(IReadOnlyDictionary displayName, string fieldName, string fieldType) + /// Keeps track of any properties unknown to the library. + internal KpiGroupByMetadata(IReadOnlyDictionary displayName, string fieldName, string fieldType, Dictionary serializedAdditionalRawData) { DisplayName = displayName; FieldName = fieldName; FieldType = fieldType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The display name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.Serialization.cs index 8436dd73535e..e4b5aa29eb27 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class KpiListResult + internal partial class KpiListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KpiListResult DeserializeKpiListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KpiListResult DeserializeKpiListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static KpiListResult DeserializeKpiListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KpiListResult(Optional.ToList(value), nextLink.Value); + return new KpiListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + KpiListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.cs index b9c5a5ceb398..a64c727a2be1 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list KPI operation. internal partial class KpiListResult { - /// Initializes a new instance of KpiListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal KpiListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of KpiListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal KpiListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal KpiListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.Serialization.cs index 2341fb576530..cf32610af9c1 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.Serialization.cs @@ -5,20 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class KpiParticipantProfilesMetadata + public partial class KpiParticipantProfilesMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static KpiParticipantProfilesMetadata DeserializeKpiParticipantProfilesMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("typeName"u8); + writer.WriteStringValue(TypeName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static KpiParticipantProfilesMetadata DeserializeKpiParticipantProfilesMetadata(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string typeName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("typeName"u8)) @@ -26,8 +57,61 @@ internal static KpiParticipantProfilesMetadata DeserializeKpiParticipantProfiles typeName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new KpiParticipantProfilesMetadata(typeName); + return new KpiParticipantProfilesMetadata(typeName, serializedAdditionalRawData); + } + + KpiParticipantProfilesMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiParticipantProfilesMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiParticipantProfilesMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiParticipantProfilesMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiParticipantProfilesMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiParticipantProfilesMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiParticipantProfilesMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.cs index 3090aa7b6765..35dd375a8e28 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiParticipantProfilesMetadata.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The KPI participant profile metadata. public partial class KpiParticipantProfilesMetadata { - /// Initializes a new instance of KpiParticipantProfilesMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the type. /// is null. internal KpiParticipantProfilesMetadata(string typeName) @@ -23,6 +27,20 @@ internal KpiParticipantProfilesMetadata(string typeName) TypeName = typeName; } + /// Initializes a new instance of . + /// Name of the type. + /// Keeps track of any properties unknown to the library. + internal KpiParticipantProfilesMetadata(string typeName, Dictionary serializedAdditionalRawData) + { + TypeName = typeName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KpiParticipantProfilesMetadata() + { + } + /// Name of the type. public string TypeName { get; } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiResourceFormatData.Serialization.cs index ceab5af7149e..92a22dedee79 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class KpiResourceFormatData : IUtf8JsonSerializable + public partial class KpiResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -96,7 +102,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ThresHolds)) { writer.WritePropertyName("thresHolds"u8); - writer.WriteObjectValue(ThresHolds); + if (ThresHolds is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ThresHolds).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Aliases)) { @@ -104,7 +117,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Aliases) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -114,16 +134,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Extracts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KpiResourceFormatData DeserializeKpiResourceFormatData(JsonElement element) + internal static KpiResourceFormatData DeserializeKpiResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -151,6 +192,7 @@ internal static KpiResourceFormatData DeserializeKpiResourceFormatData(JsonEleme Optional thresHolds = default; Optional> aliases = default; Optional> extracts = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -371,8 +413,61 @@ internal static KpiResourceFormatData DeserializeKpiResourceFormatData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KpiResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(entityType), entityTypeName.Value, Optional.ToNullable(tenantId), kpiName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToNullable(calculationWindow), calculationWindowFieldName.Value, Optional.ToNullable(function), expression.Value, unit.Value, filter.Value, Optional.ToList(groupBy), Optional.ToList(groupByMetadata), Optional.ToList(participantProfilesMetadata), Optional.ToNullable(provisioningState), thresHolds.Value, Optional.ToList(aliases), Optional.ToList(extracts), serializedAdditionalRawData); + } + + KpiResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiResourceFormatData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiResourceFormatData(Response response) + { + if (response is null) + { + return null; } - return new KpiResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(entityType), entityTypeName.Value, Optional.ToNullable(tenantId), kpiName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToNullable(calculationWindow), calculationWindowFieldName.Value, Optional.ToNullable(function), expression.Value, unit.Value, filter.Value, Optional.ToList(groupBy), Optional.ToList(groupByMetadata), Optional.ToList(participantProfilesMetadata), Optional.ToNullable(provisioningState), thresHolds.Value, Optional.ToList(aliases), Optional.ToList(extracts)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.Serialization.cs index 7b64786e7d86..eec358939ab4 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class KpiThresholds : IUtf8JsonSerializable + public partial class KpiThresholds : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("lowerLimit"u8); writer.WriteNumberValue(LowerLimit); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(UpperLimit); writer.WritePropertyName("increasingKpi"u8); writer.WriteBooleanValue(IncreasingKpi); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static KpiThresholds DeserializeKpiThresholds(JsonElement element) + internal static KpiThresholds DeserializeKpiThresholds(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static KpiThresholds DeserializeKpiThresholds(JsonElement element) decimal lowerLimit = default; decimal upperLimit = default; bool increasingKpi = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lowerLimit"u8)) @@ -50,8 +73,61 @@ internal static KpiThresholds DeserializeKpiThresholds(JsonElement element) increasingKpi = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new KpiThresholds(lowerLimit, upperLimit, increasingKpi, serializedAdditionalRawData); + } + + KpiThresholds IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeKpiThresholds(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + KpiThresholds IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeKpiThresholds(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(KpiThresholds model) + { + if (model is null) + { + return null; } - return new KpiThresholds(lowerLimit, upperLimit, increasingKpi); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator KpiThresholds(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeKpiThresholds(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.cs index 233507d73f65..d3094f8736b6 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/KpiThresholds.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// Defines the KPI Threshold limits. public partial class KpiThresholds { - /// Initializes a new instance of KpiThresholds. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The lower threshold limit. /// The upper threshold limit. /// Whether or not the KPI is an increasing KPI. @@ -21,6 +27,24 @@ public KpiThresholds(decimal lowerLimit, decimal upperLimit, bool increasingKpi) IncreasingKpi = increasingKpi; } + /// Initializes a new instance of . + /// The lower threshold limit. + /// The upper threshold limit. + /// Whether or not the KPI is an increasing KPI. + /// Keeps track of any properties unknown to the library. + internal KpiThresholds(decimal lowerLimit, decimal upperLimit, bool increasingKpi, Dictionary serializedAdditionalRawData) + { + LowerLimit = lowerLimit; + UpperLimit = upperLimit; + IncreasingKpi = increasingKpi; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KpiThresholds() + { + } + /// The lower threshold limit. public decimal LowerLimit { get; set; } /// The upper threshold limit. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.Serialization.cs index bb383ac4a215..393c7d62abda 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class LinkListResult + internal partial class LinkListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LinkListResult DeserializeLinkListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LinkListResult DeserializeLinkListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static LinkListResult DeserializeLinkListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LinkListResult(Optional.ToList(value), nextLink.Value); + return new LinkListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + LinkListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.cs index b1139133d813..71461f8a10a9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list link operation. internal partial class LinkListResult { - /// Initializes a new instance of LinkListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LinkListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of LinkListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal LinkListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal LinkListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkResourceFormatData.Serialization.cs index 945e2548ea8e..89dd5894f471 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/LinkResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class LinkResourceFormatData : IUtf8JsonSerializable + public partial class LinkResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -69,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Mappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -79,7 +92,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ParticipantPropertyReferences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -94,11 +114,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(OperationType.Value.ToSerialString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinkResourceFormatData DeserializeLinkResourceFormatData(JsonElement element) + internal static LinkResourceFormatData DeserializeLinkResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -120,6 +154,7 @@ internal static LinkResourceFormatData DeserializeLinkResourceFormatData(JsonEle Optional provisioningState = default; Optional referenceOnly = default; Optional operationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -283,8 +318,61 @@ internal static LinkResourceFormatData DeserializeLinkResourceFormatData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinkResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(tenantId), linkName.Value, Optional.ToNullable(sourceEntityType), Optional.ToNullable(targetEntityType), sourceEntityTypeName.Value, targetEntityTypeName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToList(mappings), Optional.ToList(participantPropertyReferences), Optional.ToNullable(provisioningState), Optional.ToNullable(referenceOnly), Optional.ToNullable(operationType), serializedAdditionalRawData); + } + + LinkResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkResourceFormatData model) + { + if (model is null) + { + return null; } - return new LinkResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(tenantId), linkName.Value, Optional.ToNullable(sourceEntityType), Optional.ToNullable(targetEntityType), sourceEntityTypeName.Value, targetEntityTypeName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToList(mappings), Optional.ToList(participantPropertyReferences), Optional.ToNullable(provisioningState), Optional.ToNullable(referenceOnly), Optional.ToNullable(operationType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.Serialization.cs index ac2fa08b1ddd..73c24ceec04b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class Participant : IUtf8JsonSerializable + public partial class Participant : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("profileTypeName"u8); writer.WriteStringValue(ProfileTypeName); @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ParticipantPropertyReferences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("participantName"u8); @@ -54,11 +68,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("role"u8); writer.WriteStringValue(Role); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Participant DeserializeParticipant(JsonElement element) + internal static Participant DeserializeParticipant(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +97,7 @@ internal static Participant DeserializeParticipant(JsonElement element) Optional> displayName = default; Optional> description = default; Optional role = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("profileTypeName"u8)) @@ -124,8 +153,61 @@ internal static Participant DeserializeParticipant(JsonElement element) role = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Participant(profileTypeName, participantPropertyReferences, participantName, Optional.ToDictionary(displayName), Optional.ToDictionary(description), role.Value, serializedAdditionalRawData); + } + + Participant IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipant(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Participant IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipant(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Participant model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Participant(Response response) + { + if (response is null) + { + return null; } - return new Participant(profileTypeName, participantPropertyReferences, participantName, Optional.ToDictionary(displayName), Optional.ToDictionary(description), role.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipant(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.cs index 5e720477be36..0f3a6fce1012 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/Participant.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Describes a profile type participating in an interaction. public partial class Participant { - /// Initializes a new instance of Participant. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Profile type name. /// The property references. /// Participant name. @@ -33,14 +36,15 @@ public Participant(string profileTypeName, IEnumerable(); } - /// Initializes a new instance of Participant. + /// Initializes a new instance of . /// Profile type name. /// The property references. /// Participant name. /// Localized display name. /// Localized descriptions. /// The role that the participant is playing in the interaction. - internal Participant(string profileTypeName, IList participantPropertyReferences, string participantName, IDictionary displayName, IDictionary description, string role) + /// Keeps track of any properties unknown to the library. + internal Participant(string profileTypeName, IList participantPropertyReferences, string participantName, IDictionary displayName, IDictionary description, string role, Dictionary serializedAdditionalRawData) { ProfileTypeName = profileTypeName; ParticipantPropertyReferences = participantPropertyReferences; @@ -48,6 +52,12 @@ internal Participant(string profileTypeName, IList DisplayName = displayName; Description = description; Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Participant() + { } /// Profile type name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.Serialization.cs index 29e290523c5c..f5e9537541b0 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ParticipantProfilePropertyReference : IUtf8JsonSerializable + public partial class ParticipantProfilePropertyReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("interactionPropertyName"u8); writer.WriteStringValue(InteractionPropertyName); writer.WritePropertyName("profilePropertyName"u8); writer.WriteStringValue(ProfilePropertyName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ParticipantProfilePropertyReference DeserializeParticipantProfilePropertyReference(JsonElement element) + internal static ParticipantProfilePropertyReference DeserializeParticipantProfilePropertyReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string interactionPropertyName = default; string profilePropertyName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("interactionPropertyName"u8)) @@ -42,8 +65,61 @@ internal static ParticipantProfilePropertyReference DeserializeParticipantProfil profilePropertyName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ParticipantProfilePropertyReference(interactionPropertyName, profilePropertyName, serializedAdditionalRawData); + } + + ParticipantProfilePropertyReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantProfilePropertyReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantProfilePropertyReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantProfilePropertyReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantProfilePropertyReference model) + { + if (model is null) + { + return null; } - return new ParticipantProfilePropertyReference(interactionPropertyName, profilePropertyName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantProfilePropertyReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantProfilePropertyReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.cs index 3a5ad9756d8a..4495506b54ca 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantProfilePropertyReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The participant profile property reference. public partial class ParticipantProfilePropertyReference { - /// Initializes a new instance of ParticipantProfilePropertyReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The source interaction property that maps to the target profile property. /// The target profile property that maps to the source interaction property. /// or is null. @@ -26,6 +30,22 @@ public ParticipantProfilePropertyReference(string interactionPropertyName, strin ProfilePropertyName = profilePropertyName; } + /// Initializes a new instance of . + /// The source interaction property that maps to the target profile property. + /// The target profile property that maps to the source interaction property. + /// Keeps track of any properties unknown to the library. + internal ParticipantProfilePropertyReference(string interactionPropertyName, string profilePropertyName, Dictionary serializedAdditionalRawData) + { + InteractionPropertyName = interactionPropertyName; + ProfilePropertyName = profilePropertyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ParticipantProfilePropertyReference() + { + } + /// The source interaction property that maps to the target profile property. public string InteractionPropertyName { get; set; } /// The target profile property that maps to the source interaction property. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.Serialization.cs index 39c652f04203..f196395e0ccf 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ParticipantPropertyReference : IUtf8JsonSerializable + public partial class ParticipantPropertyReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourcePropertyName"u8); writer.WriteStringValue(SourcePropertyName); writer.WritePropertyName("targetPropertyName"u8); writer.WriteStringValue(TargetPropertyName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ParticipantPropertyReference DeserializeParticipantPropertyReference(JsonElement element) + internal static ParticipantPropertyReference DeserializeParticipantPropertyReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string sourcePropertyName = default; string targetPropertyName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourcePropertyName"u8)) @@ -42,8 +65,61 @@ internal static ParticipantPropertyReference DeserializeParticipantPropertyRefer targetPropertyName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ParticipantPropertyReference(sourcePropertyName, targetPropertyName, serializedAdditionalRawData); + } + + ParticipantPropertyReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParticipantPropertyReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParticipantPropertyReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParticipantPropertyReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParticipantPropertyReference model) + { + if (model is null) + { + return null; } - return new ParticipantPropertyReference(sourcePropertyName, targetPropertyName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParticipantPropertyReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParticipantPropertyReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.cs index 00af710295e5..930c94006d34 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ParticipantPropertyReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The participant property reference. public partial class ParticipantPropertyReference { - /// Initializes a new instance of ParticipantPropertyReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The source property that maps to the target property. /// The target property that maps to the source property. /// or is null. @@ -26,6 +30,22 @@ public ParticipantPropertyReference(string sourcePropertyName, string targetProp TargetPropertyName = targetPropertyName; } + /// Initializes a new instance of . + /// The source property that maps to the target property. + /// The target property that maps to the source property. + /// Keeps track of any properties unknown to the library. + internal ParticipantPropertyReference(string sourcePropertyName, string targetPropertyName, Dictionary serializedAdditionalRawData) + { + SourcePropertyName = sourcePropertyName; + TargetPropertyName = targetPropertyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ParticipantPropertyReference() + { + } + /// The source property that maps to the target property. public string SourcePropertyName { get; set; } /// The target property that maps to the source property. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.Serialization.cs index 39fc1a124ce7..69891d7e3db8 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.Serialization.cs @@ -5,16 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionDistributionDefinition + public partial class PredictionDistributionDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PredictionDistributionDefinition DeserializePredictionDistributionDefinition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(TotalPositives)) + { + writer.WritePropertyName("totalPositives"u8); + writer.WriteNumberValue(TotalPositives.Value); + } + if (Optional.IsDefined(TotalNegatives)) + { + writer.WritePropertyName("totalNegatives"u8); + writer.WriteNumberValue(TotalNegatives.Value); + } + if (Optional.IsCollectionDefined(Distributions)) + { + writer.WritePropertyName("distributions"u8); + writer.WriteStartArray(); + foreach (var item in Distributions) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PredictionDistributionDefinition DeserializePredictionDistributionDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +76,7 @@ internal static PredictionDistributionDefinition DeserializePredictionDistributi Optional totalPositives = default; Optional totalNegatives = default; Optional> distributions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("totalPositives"u8)) @@ -56,8 +111,61 @@ internal static PredictionDistributionDefinition DeserializePredictionDistributi distributions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PredictionDistributionDefinition(Optional.ToNullable(totalPositives), Optional.ToNullable(totalNegatives), Optional.ToList(distributions)); + return new PredictionDistributionDefinition(Optional.ToNullable(totalPositives), Optional.ToNullable(totalNegatives), Optional.ToList(distributions), serializedAdditionalRawData); + } + + PredictionDistributionDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionDistributionDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionDistributionDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionDistributionDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionDistributionDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionDistributionDefinition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionDistributionDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.cs index e45cbad37f08..449b8a77bca9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinition.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The definition of the prediction distribution. public partial class PredictionDistributionDefinition { - /// Initializes a new instance of PredictionDistributionDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PredictionDistributionDefinition() { Distributions = new ChangeTrackingList(); } - /// Initializes a new instance of PredictionDistributionDefinition. + /// Initializes a new instance of . /// Total positive in the distribution. /// Total negatives in the distribution. /// Distributions of the prediction. - internal PredictionDistributionDefinition(long? totalPositives, long? totalNegatives, IReadOnlyList distributions) + /// Keeps track of any properties unknown to the library. + internal PredictionDistributionDefinition(long? totalPositives, long? totalNegatives, IReadOnlyList distributions, Dictionary serializedAdditionalRawData) { TotalPositives = totalPositives; TotalNegatives = totalNegatives; Distributions = distributions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Total positive in the distribution. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.Serialization.cs index 8d00687c7abd..bd845be6dddb 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionDistributionDefinitionDistributionsItem + public partial class PredictionDistributionDefinitionDistributionsItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PredictionDistributionDefinitionDistributionsItem DeserializePredictionDistributionDefinitionDistributionsItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ScoreThreshold)) + { + writer.WritePropertyName("scoreThreshold"u8); + writer.WriteNumberValue(ScoreThreshold.Value); + } + if (Optional.IsDefined(Positives)) + { + writer.WritePropertyName("positives"u8); + writer.WriteNumberValue(Positives.Value); + } + if (Optional.IsDefined(Negatives)) + { + writer.WritePropertyName("negatives"u8); + writer.WriteNumberValue(Negatives.Value); + } + if (Optional.IsDefined(PositivesAboveThreshold)) + { + writer.WritePropertyName("positivesAboveThreshold"u8); + writer.WriteNumberValue(PositivesAboveThreshold.Value); + } + if (Optional.IsDefined(NegativesAboveThreshold)) + { + writer.WritePropertyName("negativesAboveThreshold"u8); + writer.WriteNumberValue(NegativesAboveThreshold.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PredictionDistributionDefinitionDistributionsItem DeserializePredictionDistributionDefinitionDistributionsItem(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static PredictionDistributionDefinitionDistributionsItem DeserializePre Optional negatives = default; Optional positivesAboveThreshold = default; Optional negativesAboveThreshold = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scoreThreshold"u8)) @@ -70,8 +124,61 @@ internal static PredictionDistributionDefinitionDistributionsItem DeserializePre negativesAboveThreshold = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PredictionDistributionDefinitionDistributionsItem(Optional.ToNullable(scoreThreshold), Optional.ToNullable(positives), Optional.ToNullable(negatives), Optional.ToNullable(positivesAboveThreshold), Optional.ToNullable(negativesAboveThreshold)); + return new PredictionDistributionDefinitionDistributionsItem(Optional.ToNullable(scoreThreshold), Optional.ToNullable(positives), Optional.ToNullable(negatives), Optional.ToNullable(positivesAboveThreshold), Optional.ToNullable(negativesAboveThreshold), serializedAdditionalRawData); + } + + PredictionDistributionDefinitionDistributionsItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionDistributionDefinitionDistributionsItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionDistributionDefinitionDistributionsItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionDistributionDefinitionDistributionsItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionDistributionDefinitionDistributionsItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionDistributionDefinitionDistributionsItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionDistributionDefinitionDistributionsItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.cs index beabd5be3088..ee3efd285456 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionDistributionDefinitionDistributionsItem.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// The definition of a prediction distribution. public partial class PredictionDistributionDefinitionDistributionsItem { - /// Initializes a new instance of PredictionDistributionDefinitionDistributionsItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PredictionDistributionDefinitionDistributionsItem() { } - /// Initializes a new instance of PredictionDistributionDefinitionDistributionsItem. + /// Initializes a new instance of . /// Score threshold. /// Number of positives. /// Number of negatives. /// Number of positives above threshold. /// Number of negatives above threshold. - internal PredictionDistributionDefinitionDistributionsItem(int? scoreThreshold, long? positives, long? negatives, long? positivesAboveThreshold, long? negativesAboveThreshold) + /// Keeps track of any properties unknown to the library. + internal PredictionDistributionDefinitionDistributionsItem(int? scoreThreshold, long? positives, long? negatives, long? positivesAboveThreshold, long? negativesAboveThreshold, Dictionary serializedAdditionalRawData) { ScoreThreshold = scoreThreshold; Positives = positives; Negatives = negatives; PositivesAboveThreshold = positivesAboveThreshold; NegativesAboveThreshold = negativesAboveThreshold; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Score threshold. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.Serialization.cs index c9d33579d5ac..25bea6dee2ba 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionGradesItem : IUtf8JsonSerializable + public partial class PredictionGradesItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GradeName)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxScoreThreshold"u8); writer.WriteNumberValue(MaxScoreThreshold.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PredictionGradesItem DeserializePredictionGradesItem(JsonElement element) + internal static PredictionGradesItem DeserializePredictionGradesItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static PredictionGradesItem DeserializePredictionGradesItem(JsonElement Optional gradeName = default; Optional minScoreThreshold = default; Optional maxScoreThreshold = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gradeName"u8)) @@ -67,8 +90,61 @@ internal static PredictionGradesItem DeserializePredictionGradesItem(JsonElement maxScoreThreshold = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PredictionGradesItem(gradeName.Value, Optional.ToNullable(minScoreThreshold), Optional.ToNullable(maxScoreThreshold), serializedAdditionalRawData); + } + + PredictionGradesItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionGradesItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionGradesItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionGradesItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionGradesItem model) + { + if (model is null) + { + return null; } - return new PredictionGradesItem(gradeName.Value, Optional.ToNullable(minScoreThreshold), Optional.ToNullable(maxScoreThreshold)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionGradesItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionGradesItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.cs index dba72fb86272..3071e7af7276 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionGradesItem.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.CustomerInsights.Models { /// The definition of a prediction grade. public partial class PredictionGradesItem { - /// Initializes a new instance of PredictionGradesItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PredictionGradesItem() { } - /// Initializes a new instance of PredictionGradesItem. + /// Initializes a new instance of . /// Name of the grade. /// Minimum score threshold. /// Maximum score threshold. - internal PredictionGradesItem(string gradeName, int? minScoreThreshold, int? maxScoreThreshold) + /// Keeps track of any properties unknown to the library. + internal PredictionGradesItem(string gradeName, int? minScoreThreshold, int? maxScoreThreshold, Dictionary serializedAdditionalRawData) { GradeName = gradeName; MinScoreThreshold = minScoreThreshold; MaxScoreThreshold = maxScoreThreshold; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the grade. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.Serialization.cs index b43a4befe4e6..ea99bd66656f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class PredictionListResult + internal partial class PredictionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PredictionListResult DeserializePredictionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PredictionListResult DeserializePredictionListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static PredictionListResult DeserializePredictionListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PredictionListResult(Optional.ToList(value), nextLink.Value); + return new PredictionListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + PredictionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.cs index b7f2d60d1f9d..afa11b89b798 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list predictions operation. internal partial class PredictionListResult { - /// Initializes a new instance of PredictionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PredictionListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of PredictionListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal PredictionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal PredictionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.Serialization.cs index 02adad3e1700..36e69e55dd12 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionMappings : IUtf8JsonSerializable + public partial class PredictionMappings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("score"u8); writer.WriteStringValue(Score); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Grade); writer.WritePropertyName("reason"u8); writer.WriteStringValue(Reason); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PredictionMappings DeserializePredictionMappings(JsonElement element) + internal static PredictionMappings DeserializePredictionMappings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static PredictionMappings DeserializePredictionMappings(JsonElement ele string score = default; string grade = default; string reason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("score"u8)) @@ -50,8 +73,61 @@ internal static PredictionMappings DeserializePredictionMappings(JsonElement ele reason = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PredictionMappings(score, grade, reason, serializedAdditionalRawData); + } + + PredictionMappings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionMappings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionMappings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionMappings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionMappings model) + { + if (model is null) + { + return null; } - return new PredictionMappings(score, grade, reason); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionMappings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionMappings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.cs index 0705163af204..b43eaca92a16 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionMappings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Definition of the link mapping of prediction. public partial class PredictionMappings { - /// Initializes a new instance of PredictionMappings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The score of the link mapping. /// The grade of the link mapping. /// The reason of the link mapping. @@ -29,6 +33,24 @@ public PredictionMappings(string score, string grade, string reason) Reason = reason; } + /// Initializes a new instance of . + /// The score of the link mapping. + /// The grade of the link mapping. + /// The reason of the link mapping. + /// Keeps track of any properties unknown to the library. + internal PredictionMappings(string score, string grade, string reason, Dictionary serializedAdditionalRawData) + { + Score = score; + Grade = grade; + Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PredictionMappings() + { + } + /// The score of the link mapping. public string Score { get; set; } /// The grade of the link mapping. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.Serialization.cs index 9876a3f932e9..69f987542a1d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.Serialization.cs @@ -6,23 +6,44 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionModelStatus : IUtf8JsonSerializable + public partial class PredictionModelStatus : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PredictionModelStatus DeserializePredictionModelStatus(JsonElement element) + internal static PredictionModelStatus DeserializePredictionModelStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +59,7 @@ internal static PredictionModelStatus DeserializePredictionModelStatus(JsonEleme Optional trainingAccuracy = default; Optional signalsUsed = default; Optional modelVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId"u8)) @@ -119,8 +141,61 @@ internal static PredictionModelStatus DeserializePredictionModelStatus(JsonEleme modelVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PredictionModelStatus(Optional.ToNullable(tenantId), predictionName.Value, predictionGuidId.Value, status, message.Value, Optional.ToNullable(trainingSetCount), Optional.ToNullable(testSetCount), Optional.ToNullable(validationSetCount), Optional.ToNullable(trainingAccuracy), Optional.ToNullable(signalsUsed), modelVersion.Value, serializedAdditionalRawData); + } + + PredictionModelStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionModelStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionModelStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionModelStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionModelStatus model) + { + if (model is null) + { + return null; } - return new PredictionModelStatus(Optional.ToNullable(tenantId), predictionName.Value, predictionGuidId.Value, status, message.Value, Optional.ToNullable(trainingSetCount), Optional.ToNullable(testSetCount), Optional.ToNullable(validationSetCount), Optional.ToNullable(trainingAccuracy), Optional.ToNullable(signalsUsed), modelVersion.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionModelStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionModelStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.cs index 2e1b1457e143..cd5632c78707 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionModelStatus.cs @@ -6,20 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.CustomerInsights.Models { /// The prediction model status. public partial class PredictionModelStatus { - /// Initializes a new instance of PredictionModelStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Prediction model life cycle. When prediction is in PendingModelConfirmation status, it is allowed to update the status to PendingFeaturing or Active through API. public PredictionModelStatus(PredictionModelLifeCycle status) { Status = status; } - /// Initializes a new instance of PredictionModelStatus. + /// Initializes a new instance of . /// The hub name. /// The prediction name. /// The prediction GUID ID. @@ -31,7 +35,8 @@ public PredictionModelStatus(PredictionModelLifeCycle status) /// The training accuracy. /// The signals used. /// Version of the model. - internal PredictionModelStatus(Guid? tenantId, string predictionName, string predictionGuidId, PredictionModelLifeCycle status, string message, int? trainingSetCount, int? testSetCount, int? validationSetCount, decimal? trainingAccuracy, int? signalsUsed, string modelVersion) + /// Keeps track of any properties unknown to the library. + internal PredictionModelStatus(Guid? tenantId, string predictionName, string predictionGuidId, PredictionModelLifeCycle status, string message, int? trainingSetCount, int? testSetCount, int? validationSetCount, decimal? trainingAccuracy, int? signalsUsed, string modelVersion, Dictionary serializedAdditionalRawData) { TenantId = tenantId; PredictionName = predictionName; @@ -44,6 +49,12 @@ internal PredictionModelStatus(Guid? tenantId, string predictionName, string pre TrainingAccuracy = trainingAccuracy; SignalsUsed = signalsUsed; ModelVersion = modelVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PredictionModelStatus() + { } /// The hub name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionResourceFormatData.Serialization.cs index cc3329651efe..d72777673021 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class PredictionResourceFormatData : IUtf8JsonSerializable + public partial class PredictionResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -106,7 +112,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Mappings)) { writer.WritePropertyName("mappings"u8); - writer.WriteObjectValue(Mappings); + if (Mappings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Mappings).Serialize(writer, options); + } } if (Optional.IsDefined(ScoreLabel)) { @@ -119,16 +132,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Grades) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PredictionResourceFormatData DeserializePredictionResourceFormatData(JsonElement element) + internal static PredictionResourceFormatData DeserializePredictionResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -154,6 +188,7 @@ internal static PredictionResourceFormatData DeserializePredictionResourceFormat Optional scoreLabel = default; Optional> grades = default; Optional systemGeneratedEntities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -351,8 +386,61 @@ internal static PredictionResourceFormatData DeserializePredictionResourceFormat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PredictionResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(description), Optional.ToDictionary(displayName), Optional.ToList(involvedInteractionTypes), Optional.ToList(involvedKpiTypes), Optional.ToList(involvedRelationships), negativeOutcomeExpression.Value, positiveOutcomeExpression.Value, primaryProfileType.Value, Optional.ToNullable(provisioningState), predictionName.Value, scopeExpression.Value, Optional.ToNullable(tenantId), Optional.ToNullable(autoAnalyze), mappings.Value, scoreLabel.Value, Optional.ToList(grades), systemGeneratedEntities.Value, serializedAdditionalRawData); + } + + PredictionResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionResourceFormatData model) + { + if (model is null) + { + return null; } - return new PredictionResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(description), Optional.ToDictionary(displayName), Optional.ToList(involvedInteractionTypes), Optional.ToList(involvedKpiTypes), Optional.ToList(involvedRelationships), negativeOutcomeExpression.Value, positiveOutcomeExpression.Value, primaryProfileType.Value, Optional.ToNullable(provisioningState), predictionName.Value, scopeExpression.Value, Optional.ToNullable(tenantId), Optional.ToNullable(autoAnalyze), mappings.Value, scoreLabel.Value, Optional.ToList(grades), systemGeneratedEntities.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.Serialization.cs index d6f377ebcd01..1f201069c00b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.Serialization.cs @@ -5,16 +5,74 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionSystemGeneratedEntities + public partial class PredictionSystemGeneratedEntities : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PredictionSystemGeneratedEntities DeserializePredictionSystemGeneratedEntities(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(GeneratedInteractionTypes)) + { + writer.WritePropertyName("generatedInteractionTypes"u8); + writer.WriteStartArray(); + foreach (var item in GeneratedInteractionTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(GeneratedLinks)) + { + writer.WritePropertyName("generatedLinks"u8); + writer.WriteStartArray(); + foreach (var item in GeneratedLinks) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(GeneratedKpis)) + { + writer.WritePropertyName("generatedKpis"u8); + writer.WriteStartObject(); + foreach (var item in GeneratedKpis) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PredictionSystemGeneratedEntities DeserializePredictionSystemGeneratedEntities(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +80,7 @@ internal static PredictionSystemGeneratedEntities DeserializePredictionSystemGen Optional> generatedInteractionTypes = default; Optional> generatedLinks = default; Optional> generatedKpis = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("generatedInteractionTypes"u8)) @@ -66,8 +125,61 @@ internal static PredictionSystemGeneratedEntities DeserializePredictionSystemGen generatedKpis = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PredictionSystemGeneratedEntities(Optional.ToList(generatedInteractionTypes), Optional.ToList(generatedLinks), Optional.ToDictionary(generatedKpis)); + return new PredictionSystemGeneratedEntities(Optional.ToList(generatedInteractionTypes), Optional.ToList(generatedLinks), Optional.ToDictionary(generatedKpis), serializedAdditionalRawData); + } + + PredictionSystemGeneratedEntities IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionSystemGeneratedEntities(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionSystemGeneratedEntities IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionSystemGeneratedEntities(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionSystemGeneratedEntities model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionSystemGeneratedEntities(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionSystemGeneratedEntities(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.cs index 8409c9ed4a71..11947deb91cf 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionSystemGeneratedEntities.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// System generated entities. public partial class PredictionSystemGeneratedEntities { - /// Initializes a new instance of PredictionSystemGeneratedEntities. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PredictionSystemGeneratedEntities() { GeneratedInteractionTypes = new ChangeTrackingList(); @@ -21,15 +25,17 @@ internal PredictionSystemGeneratedEntities() GeneratedKpis = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PredictionSystemGeneratedEntities. + /// Initializes a new instance of . /// Generated interaction types. /// Generated links. /// Generated KPIs. - internal PredictionSystemGeneratedEntities(IReadOnlyList generatedInteractionTypes, IReadOnlyList generatedLinks, IReadOnlyDictionary generatedKpis) + /// Keeps track of any properties unknown to the library. + internal PredictionSystemGeneratedEntities(IReadOnlyList generatedInteractionTypes, IReadOnlyList generatedLinks, IReadOnlyDictionary generatedKpis, Dictionary serializedAdditionalRawData) { GeneratedInteractionTypes = generatedInteractionTypes; GeneratedLinks = generatedLinks; GeneratedKpis = generatedKpis; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Generated interaction types. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.Serialization.cs index 59e04488b588..583f5c44cad6 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.Serialization.cs @@ -8,14 +8,40 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PredictionTrainingResults + public partial class PredictionTrainingResults : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PredictionTrainingResults DeserializePredictionTrainingResults(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PredictionTrainingResults DeserializePredictionTrainingResults(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +51,7 @@ internal static PredictionTrainingResults DeserializePredictionTrainingResults(J Optional predictionDistribution = default; Optional> canonicalProfiles = default; Optional primaryProfileInstanceCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId"u8)) @@ -73,8 +100,61 @@ internal static PredictionTrainingResults DeserializePredictionTrainingResults(J primaryProfileInstanceCount = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PredictionTrainingResults(Optional.ToNullable(tenantId), scoreName.Value, predictionDistribution.Value, Optional.ToList(canonicalProfiles), Optional.ToNullable(primaryProfileInstanceCount)); + return new PredictionTrainingResults(Optional.ToNullable(tenantId), scoreName.Value, predictionDistribution.Value, Optional.ToList(canonicalProfiles), Optional.ToNullable(primaryProfileInstanceCount), serializedAdditionalRawData); + } + + PredictionTrainingResults IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePredictionTrainingResults(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PredictionTrainingResults IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePredictionTrainingResults(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PredictionTrainingResults model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PredictionTrainingResults(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePredictionTrainingResults(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.cs index 66e1d62e13a3..86a847157e63 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PredictionTrainingResults.cs @@ -14,25 +14,30 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The training results of the prediction. public partial class PredictionTrainingResults { - /// Initializes a new instance of PredictionTrainingResults. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PredictionTrainingResults() { CanonicalProfiles = new ChangeTrackingList(); } - /// Initializes a new instance of PredictionTrainingResults. + /// Initializes a new instance of . /// The hub name. /// Score name. /// Prediction distribution. /// Canonical profiles. /// Instance count of the primary profile. - internal PredictionTrainingResults(Guid? tenantId, string scoreName, PredictionDistributionDefinition predictionDistribution, IReadOnlyList canonicalProfiles, long? primaryProfileInstanceCount) + /// Keeps track of any properties unknown to the library. + internal PredictionTrainingResults(Guid? tenantId, string scoreName, PredictionDistributionDefinition predictionDistribution, IReadOnlyList canonicalProfiles, long? primaryProfileInstanceCount, Dictionary serializedAdditionalRawData) { TenantId = tenantId; ScoreName = scoreName; PredictionDistribution = predictionDistribution; CanonicalProfiles = canonicalProfiles; PrimaryProfileInstanceCount = primaryProfileInstanceCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The hub name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.Serialization.cs index f7a18f42d32f..1525cd5648d3 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ProfileEnumValidValuesFormat : IUtf8JsonSerializable + public partial class ProfileEnumValidValuesFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Value)) { @@ -32,17 +39,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProfileEnumValidValuesFormat DeserializeProfileEnumValidValuesFormat(JsonElement element) + internal static ProfileEnumValidValuesFormat DeserializeProfileEnumValidValuesFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional value = default; Optional> localizedValueNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -68,8 +90,61 @@ internal static ProfileEnumValidValuesFormat DeserializeProfileEnumValidValuesFo localizedValueNames = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProfileEnumValidValuesFormat(Optional.ToNullable(value), Optional.ToDictionary(localizedValueNames), serializedAdditionalRawData); + } + + ProfileEnumValidValuesFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProfileEnumValidValuesFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProfileEnumValidValuesFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProfileEnumValidValuesFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProfileEnumValidValuesFormat model) + { + if (model is null) + { + return null; } - return new ProfileEnumValidValuesFormat(Optional.ToNullable(value), Optional.ToDictionary(localizedValueNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProfileEnumValidValuesFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProfileEnumValidValuesFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.cs index 3e96d2a2bc50..7133f434e3ff 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileEnumValidValuesFormat.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Valid enum values in case of an enum property. public partial class ProfileEnumValidValuesFormat { - /// Initializes a new instance of ProfileEnumValidValuesFormat. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProfileEnumValidValuesFormat() { LocalizedValueNames = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ProfileEnumValidValuesFormat. + /// Initializes a new instance of . /// The integer value of the enum member. /// Localized names of the enum member. - internal ProfileEnumValidValuesFormat(int? value, IDictionary localizedValueNames) + /// Keeps track of any properties unknown to the library. + internal ProfileEnumValidValuesFormat(int? value, IDictionary localizedValueNames, Dictionary serializedAdditionalRawData) { Value = value; LocalizedValueNames = localizedValueNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The integer value of the enum member. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.Serialization.cs index 4861f4e7cc16..3e0191360ce6 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class ProfileListResult + internal partial class ProfileListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ProfileListResult DeserializeProfileListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ProfileListResult DeserializeProfileListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ProfileListResult DeserializeProfileListResult(JsonElement eleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ProfileListResult(Optional.ToList(value), nextLink.Value); + return new ProfileListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ProfileListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProfileListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProfileListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProfileListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProfileListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProfileListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProfileListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.cs index b9a5dd4c25d0..807f0ebff7be 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list profile operation. internal partial class ProfileListResult { - /// Initializes a new instance of ProfileListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ProfileListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ProfileListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal ProfileListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ProfileListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileResourceFormatData.Serialization.cs index 470390076de1..9072bc71b72b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ProfileResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class ProfileResourceFormatData : IUtf8JsonSerializable + public partial class ProfileResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -117,7 +123,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Fields) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -147,16 +160,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in StrongIds) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ProfileResourceFormatData DeserializeProfileResourceFormatData(JsonElement element) + internal static ProfileResourceFormatData DeserializeProfileResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -183,6 +217,7 @@ internal static ProfileResourceFormatData DeserializeProfileResourceFormatData(J Optional timestampFieldName = default; Optional typeName = default; Optional> strongIds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -409,8 +444,61 @@ internal static ProfileResourceFormatData DeserializeProfileResourceFormatData(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ProfileResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(attributes), Optional.ToDictionary(description), Optional.ToDictionary(displayName), Optional.ToDictionary(localizedAttributes), smallImage.Value, mediumImage.Value, largeImage.Value, apiEntitySetName.Value, Optional.ToNullable(entityType), Optional.ToList(fields), Optional.ToNullable(instancesCount), Optional.ToNullable(lastChangedUtc), Optional.ToNullable(provisioningState), schemaItemTypeLink.Value, Optional.ToNullable(tenantId), timestampFieldName.Value, typeName.Value, Optional.ToList(strongIds), serializedAdditionalRawData); + } + + ProfileResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeProfileResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ProfileResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeProfileResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ProfileResourceFormatData model) + { + if (model is null) + { + return null; } - return new ProfileResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(attributes), Optional.ToDictionary(description), Optional.ToDictionary(displayName), Optional.ToDictionary(localizedAttributes), smallImage.Value, mediumImage.Value, largeImage.Value, apiEntitySetName.Value, Optional.ToNullable(entityType), Optional.ToList(fields), Optional.ToNullable(instancesCount), Optional.ToNullable(lastChangedUtc), Optional.ToNullable(provisioningState), schemaItemTypeLink.Value, Optional.ToNullable(tenantId), timestampFieldName.Value, typeName.Value, Optional.ToList(strongIds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ProfileResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeProfileResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.Serialization.cs index 5d575b4142db..2c580926f01e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class PropertyDefinition : IUtf8JsonSerializable + public partial class PropertyDefinition : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ArrayValueSeparator)) { @@ -27,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EnumValidValues) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -90,11 +104,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("isAvailableInGraph"u8); writer.WriteBooleanValue(IsAvailableInGraph.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PropertyDefinition DeserializePropertyDefinition(JsonElement element) + internal static PropertyDefinition DeserializePropertyDefinition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -115,6 +143,7 @@ internal static PropertyDefinition DeserializePropertyDefinition(JsonElement ele Optional maxLength = default; Optional isAvailableInGraph = default; Optional> dataSourcePrecedenceRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("arrayValueSeparator"u8)) @@ -251,8 +280,61 @@ internal static PropertyDefinition DeserializePropertyDefinition(JsonElement ele dataSourcePrecedenceRules = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PropertyDefinition(arrayValueSeparator.Value, Optional.ToList(enumValidValues), fieldName, fieldType, Optional.ToNullable(isArray), Optional.ToNullable(isEnum), Optional.ToNullable(isFlagEnum), Optional.ToNullable(isImage), Optional.ToNullable(isLocalizedString), Optional.ToNullable(isName), Optional.ToNullable(isRequired), propertyId.Value, schemaItemPropLink.Value, Optional.ToNullable(maxLength), Optional.ToNullable(isAvailableInGraph), Optional.ToList(dataSourcePrecedenceRules), serializedAdditionalRawData); + } + + PropertyDefinition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePropertyDefinition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PropertyDefinition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePropertyDefinition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PropertyDefinition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PropertyDefinition(Response response) + { + if (response is null) + { + return null; } - return new PropertyDefinition(arrayValueSeparator.Value, Optional.ToList(enumValidValues), fieldName, fieldType, Optional.ToNullable(isArray), Optional.ToNullable(isEnum), Optional.ToNullable(isFlagEnum), Optional.ToNullable(isImage), Optional.ToNullable(isLocalizedString), Optional.ToNullable(isName), Optional.ToNullable(isRequired), propertyId.Value, schemaItemPropLink.Value, Optional.ToNullable(maxLength), Optional.ToNullable(isAvailableInGraph), Optional.ToList(dataSourcePrecedenceRules)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePropertyDefinition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.cs index 0adcb99fbef8..9c20c2fc0f0d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/PropertyDefinition.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Property definition. public partial class PropertyDefinition { - /// Initializes a new instance of PropertyDefinition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the property. /// Type of the property. /// or is null. @@ -29,7 +32,7 @@ public PropertyDefinition(string fieldName, string fieldType) DataSourcePrecedenceRules = new ChangeTrackingList(); } - /// Initializes a new instance of PropertyDefinition. + /// Initializes a new instance of . /// Array value separator for properties with isArray set. /// Describes valid values for an enum property. /// Name of the property. @@ -46,7 +49,8 @@ public PropertyDefinition(string fieldName, string fieldType) /// Max length of string. Used only if type is string. /// Whether property is available in graph or not. /// This is specific to interactions modeled as activities. Data sources are used to determine where data is stored and also in precedence rules. - internal PropertyDefinition(string arrayValueSeparator, IList enumValidValues, string fieldName, string fieldType, bool? isArray, bool? isEnum, bool? isFlagEnum, bool? isImage, bool? isLocalizedString, bool? isName, bool? isRequired, string propertyId, string schemaItemPropLink, int? maxLength, bool? isAvailableInGraph, IReadOnlyList dataSourcePrecedenceRules) + /// Keeps track of any properties unknown to the library. + internal PropertyDefinition(string arrayValueSeparator, IList enumValidValues, string fieldName, string fieldType, bool? isArray, bool? isEnum, bool? isFlagEnum, bool? isImage, bool? isLocalizedString, bool? isName, bool? isRequired, string propertyId, string schemaItemPropLink, int? maxLength, bool? isAvailableInGraph, IReadOnlyList dataSourcePrecedenceRules, Dictionary serializedAdditionalRawData) { ArrayValueSeparator = arrayValueSeparator; EnumValidValues = enumValidValues; @@ -64,6 +68,12 @@ internal PropertyDefinition(string arrayValueSeparator, IList Initializes a new instance of for deserialization. + internal PropertyDefinition() + { } /// Array value separator for properties with isArray set. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.Serialization.cs index 75f699e1ed66..ec333ec8eb63 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class RelationshipLinkFieldMapping : IUtf8JsonSerializable + public partial class RelationshipLinkFieldMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("interactionFieldName"u8); writer.WriteStringValue(InteractionFieldName); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("relationshipFieldName"u8); writer.WriteStringValue(RelationshipFieldName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RelationshipLinkFieldMapping DeserializeRelationshipLinkFieldMapping(JsonElement element) + internal static RelationshipLinkFieldMapping DeserializeRelationshipLinkFieldMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static RelationshipLinkFieldMapping DeserializeRelationshipLinkFieldMap string interactionFieldName = default; Optional linkType = default; string relationshipFieldName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("interactionFieldName"u8)) @@ -57,8 +80,61 @@ internal static RelationshipLinkFieldMapping DeserializeRelationshipLinkFieldMap relationshipFieldName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RelationshipLinkFieldMapping(interactionFieldName, Optional.ToNullable(linkType), relationshipFieldName, serializedAdditionalRawData); + } + + RelationshipLinkFieldMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipLinkFieldMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipLinkFieldMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipLinkFieldMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipLinkFieldMapping model) + { + if (model is null) + { + return null; } - return new RelationshipLinkFieldMapping(interactionFieldName, Optional.ToNullable(linkType), relationshipFieldName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipLinkFieldMapping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipLinkFieldMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.cs index 54e26ce7c641..5cd30e0086c7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkFieldMapping.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The fields mapping for Relationships. public partial class RelationshipLinkFieldMapping { - /// Initializes a new instance of RelationshipLinkFieldMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The field name on the Interaction Type. /// The field name on the Relationship metadata. /// or is null. @@ -26,15 +30,22 @@ public RelationshipLinkFieldMapping(string interactionFieldName, string relation RelationshipFieldName = relationshipFieldName; } - /// Initializes a new instance of RelationshipLinkFieldMapping. + /// Initializes a new instance of . /// The field name on the Interaction Type. /// Link type. /// The field name on the Relationship metadata. - internal RelationshipLinkFieldMapping(string interactionFieldName, LinkType? linkType, string relationshipFieldName) + /// Keeps track of any properties unknown to the library. + internal RelationshipLinkFieldMapping(string interactionFieldName, LinkType? linkType, string relationshipFieldName, Dictionary serializedAdditionalRawData) { InteractionFieldName = interactionFieldName; LinkType = linkType; RelationshipFieldName = relationshipFieldName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RelationshipLinkFieldMapping() + { } /// The field name on the Interaction Type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.Serialization.cs index eda345b5e66a..e709019b7087 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class RelationshipLinkListResult + internal partial class RelationshipLinkListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RelationshipLinkListResult DeserializeRelationshipLinkListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RelationshipLinkListResult DeserializeRelationshipLinkListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RelationshipLinkListResult DeserializeRelationshipLinkListResult nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RelationshipLinkListResult(Optional.ToList(value), nextLink.Value); + return new RelationshipLinkListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RelationshipLinkListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipLinkListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipLinkListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipLinkListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipLinkListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipLinkListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipLinkListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.cs index ebc8f66967da..d688e93faaad 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list relationship link operation. internal partial class RelationshipLinkListResult { - /// Initializes a new instance of RelationshipLinkListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RelationshipLinkListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RelationshipLinkListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal RelationshipLinkListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RelationshipLinkListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkResourceFormatData.Serialization.cs index 1dc3ebe6c6d1..aa452d735ec7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipLinkResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class RelationshipLinkResourceFormatData : IUtf8JsonSerializable + public partial class RelationshipLinkResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -54,7 +60,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Mappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -64,7 +77,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ProfilePropertyReferences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -74,7 +94,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in RelatedProfilePropertyReferences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -84,11 +111,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RelationshipName); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RelationshipLinkResourceFormatData DeserializeRelationshipLinkResourceFormatData(JsonElement element) + internal static RelationshipLinkResourceFormatData DeserializeRelationshipLinkResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -108,6 +149,7 @@ internal static RelationshipLinkResourceFormatData DeserializeRelationshipLinkRe Optional relationshipName = default; Optional relationshipGuidId = default; Optional tenantId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -254,8 +296,61 @@ internal static RelationshipLinkResourceFormatData DeserializeRelationshipLinkRe } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RelationshipLinkResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), interactionType.Value, linkName.Value, Optional.ToList(mappings), Optional.ToList(profilePropertyReferences), Optional.ToNullable(provisioningState), Optional.ToList(relatedProfilePropertyReferences), relationshipName.Value, relationshipGuidId.Value, Optional.ToNullable(tenantId), serializedAdditionalRawData); + } + + RelationshipLinkResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipLinkResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipLinkResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipLinkResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipLinkResourceFormatData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipLinkResourceFormatData(Response response) + { + if (response is null) + { + return null; } - return new RelationshipLinkResourceFormatData(id, name, type, systemData.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), interactionType.Value, linkName.Value, Optional.ToList(mappings), Optional.ToList(profilePropertyReferences), Optional.ToNullable(provisioningState), Optional.ToList(relatedProfilePropertyReferences), relationshipName.Value, relationshipGuidId.Value, Optional.ToNullable(tenantId)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipLinkResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.Serialization.cs index 07064f4c2afc..469668c65d8b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class RelationshipListResult + internal partial class RelationshipListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RelationshipListResult DeserializeRelationshipListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RelationshipListResult DeserializeRelationshipListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RelationshipListResult DeserializeRelationshipListResult(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RelationshipListResult(Optional.ToList(value), nextLink.Value); + return new RelationshipListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RelationshipListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.cs index 8240c6f33219..5709f2ffc2b4 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list relationship operation. internal partial class RelationshipListResult { - /// Initializes a new instance of RelationshipListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RelationshipListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RelationshipListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal RelationshipListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RelationshipListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipResourceFormatData.Serialization.cs index dd5387609f93..326e7532ddb0 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class RelationshipResourceFormatData : IUtf8JsonSerializable + public partial class RelationshipResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -59,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Fields) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LookupMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -84,11 +104,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RelatedProfileType); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RelationshipResourceFormatData DeserializeRelationshipResourceFormatData(JsonElement element) + internal static RelationshipResourceFormatData DeserializeRelationshipResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,6 +143,7 @@ internal static RelationshipResourceFormatData DeserializeRelationshipResourceFo Optional relatedProfileType = default; Optional relationshipGuidId = default; Optional tenantId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -259,8 +294,61 @@ internal static RelationshipResourceFormatData DeserializeRelationshipResourceFo } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RelationshipResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(cardinality), Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToNullable(expiryDateTimeUtc), Optional.ToList(fields), Optional.ToList(lookupMappings), profileType.Value, Optional.ToNullable(provisioningState), relationshipName.Value, relatedProfileType.Value, relationshipGuidId.Value, Optional.ToNullable(tenantId), serializedAdditionalRawData); + } + + RelationshipResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipResourceFormatData model) + { + if (model is null) + { + return null; } - return new RelationshipResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(cardinality), Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToNullable(expiryDateTimeUtc), Optional.ToList(fields), Optional.ToList(lookupMappings), profileType.Value, Optional.ToNullable(provisioningState), relationshipName.Value, relatedProfileType.Value, relationshipGuidId.Value, Optional.ToNullable(tenantId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.Serialization.cs index bfc0ff7ce121..682326e82601 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class RelationshipTypeFieldMapping : IUtf8JsonSerializable + public partial class RelationshipTypeFieldMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("profileFieldName"u8); writer.WriteStringValue(ProfileFieldName); writer.WritePropertyName("relatedProfileKeyProperty"u8); writer.WriteStringValue(RelatedProfileKeyProperty); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RelationshipTypeFieldMapping DeserializeRelationshipTypeFieldMapping(JsonElement element) + internal static RelationshipTypeFieldMapping DeserializeRelationshipTypeFieldMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string profileFieldName = default; string relatedProfileKeyProperty = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("profileFieldName"u8)) @@ -42,8 +65,61 @@ internal static RelationshipTypeFieldMapping DeserializeRelationshipTypeFieldMap relatedProfileKeyProperty = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RelationshipTypeFieldMapping(profileFieldName, relatedProfileKeyProperty, serializedAdditionalRawData); + } + + RelationshipTypeFieldMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipTypeFieldMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipTypeFieldMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipTypeFieldMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipTypeFieldMapping model) + { + if (model is null) + { + return null; } - return new RelationshipTypeFieldMapping(profileFieldName, relatedProfileKeyProperty); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipTypeFieldMapping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipTypeFieldMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.cs index c563c7e623e4..8df2238b71c4 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeFieldMapping.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Map a field of profile to its corresponding StrongId in Related Profile. public partial class RelationshipTypeFieldMapping { - /// Initializes a new instance of RelationshipTypeFieldMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the fieldName in profile. /// Specifies the KeyProperty (from StrongId) of the related profile. /// or is null. @@ -26,6 +30,22 @@ public RelationshipTypeFieldMapping(string profileFieldName, string relatedProfi RelatedProfileKeyProperty = relatedProfileKeyProperty; } + /// Initializes a new instance of . + /// Specifies the fieldName in profile. + /// Specifies the KeyProperty (from StrongId) of the related profile. + /// Keeps track of any properties unknown to the library. + internal RelationshipTypeFieldMapping(string profileFieldName, string relatedProfileKeyProperty, Dictionary serializedAdditionalRawData) + { + ProfileFieldName = profileFieldName; + RelatedProfileKeyProperty = relatedProfileKeyProperty; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RelationshipTypeFieldMapping() + { + } + /// Specifies the fieldName in profile. public string ProfileFieldName { get; set; } /// Specifies the KeyProperty (from StrongId) of the related profile. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.Serialization.cs index dbe723fb1ada..be91dfc4a050 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.Serialization.cs @@ -5,34 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class RelationshipTypeMapping : IUtf8JsonSerializable + public partial class RelationshipTypeMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("fieldMappings"u8); writer.WriteStartArray(); foreach (var item in FieldMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RelationshipTypeMapping DeserializeRelationshipTypeMapping(JsonElement element) + internal static RelationshipTypeMapping DeserializeRelationshipTypeMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList fieldMappings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("fieldMappings"u8)) @@ -45,8 +74,61 @@ internal static RelationshipTypeMapping DeserializeRelationshipTypeMapping(JsonE fieldMappings = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RelationshipTypeMapping(fieldMappings, serializedAdditionalRawData); + } + + RelationshipTypeMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipTypeMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipTypeMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipTypeMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipTypeMapping model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipTypeMapping(Response response) + { + if (response is null) + { + return null; } - return new RelationshipTypeMapping(fieldMappings); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipTypeMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.cs index dadbfb9ca923..0bd513ca5a85 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipTypeMapping.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Maps fields in Profile to their corresponding StrongIds in Related Profile. public partial class RelationshipTypeMapping { - /// Initializes a new instance of RelationshipTypeMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Maps a profile property with the StrongId of related profile. This is an array to support StrongIds that are composite key as well. /// is null. public RelationshipTypeMapping(IEnumerable fieldMappings) @@ -25,11 +28,18 @@ public RelationshipTypeMapping(IEnumerable fieldMa FieldMappings = fieldMappings.ToList(); } - /// Initializes a new instance of RelationshipTypeMapping. + /// Initializes a new instance of . /// Maps a profile property with the StrongId of related profile. This is an array to support StrongIds that are composite key as well. - internal RelationshipTypeMapping(IList fieldMappings) + /// Keeps track of any properties unknown to the library. + internal RelationshipTypeMapping(IList fieldMappings, Dictionary serializedAdditionalRawData) { FieldMappings = fieldMappings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RelationshipTypeMapping() + { } /// Maps a profile property with the StrongId of related profile. This is an array to support StrongIds that are composite key as well. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.Serialization.cs index 6b641bef0cd2..5ff6ffda0f70 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class RelationshipsLookup + public partial class RelationshipsLookup : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RelationshipsLookup DeserializeRelationshipsLookup(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RelationshipsLookup DeserializeRelationshipsLookup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static RelationshipsLookup DeserializeRelationshipsLookup(JsonElement e Optional relatedProfileName = default; Optional> relatedProfilePropertyReferences = default; Optional existingRelationshipName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("profileName"u8)) @@ -69,8 +97,61 @@ internal static RelationshipsLookup DeserializeRelationshipsLookup(JsonElement e existingRelationshipName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RelationshipsLookup(profileName.Value, Optional.ToList(profilePropertyReferences), relatedProfileName.Value, Optional.ToList(relatedProfilePropertyReferences), existingRelationshipName.Value); + return new RelationshipsLookup(profileName.Value, Optional.ToList(profilePropertyReferences), relatedProfileName.Value, Optional.ToList(relatedProfilePropertyReferences), existingRelationshipName.Value, serializedAdditionalRawData); + } + + RelationshipsLookup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationshipsLookup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationshipsLookup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationshipsLookup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationshipsLookup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationshipsLookup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationshipsLookup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.cs index ce37493c23f5..379e933e7786 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RelationshipsLookup.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The definition of suggested relationship for the type. public partial class RelationshipsLookup { - /// Initializes a new instance of RelationshipsLookup. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RelationshipsLookup() { ProfilePropertyReferences = new ChangeTrackingList(); RelatedProfilePropertyReferences = new ChangeTrackingList(); } - /// Initializes a new instance of RelationshipsLookup. + /// Initializes a new instance of . /// The relationship profile. /// The property references for the profile type. /// The related profile. /// The property references for the related profile type. /// The name of existing Relationship. - internal RelationshipsLookup(string profileName, IReadOnlyList profilePropertyReferences, string relatedProfileName, IReadOnlyList relatedProfilePropertyReferences, string existingRelationshipName) + /// Keeps track of any properties unknown to the library. + internal RelationshipsLookup(string profileName, IReadOnlyList profilePropertyReferences, string relatedProfileName, IReadOnlyList relatedProfilePropertyReferences, string existingRelationshipName, Dictionary serializedAdditionalRawData) { ProfileName = profileName; ProfilePropertyReferences = profilePropertyReferences; RelatedProfileName = relatedProfileName; RelatedProfilePropertyReferences = relatedProfilePropertyReferences; ExistingRelationshipName = existingRelationshipName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The relationship profile. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.Serialization.cs index c1e6790f96d4..8f668c0f22d4 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class ResourceSetDescription : IUtf8JsonSerializable + public partial class ResourceSetDescription : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Elements)) { @@ -36,17 +43,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceSetDescription DeserializeResourceSetDescription(JsonElement element) + internal static ResourceSetDescription DeserializeResourceSetDescription(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> elements = default; Optional> exceptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("elements"u8)) @@ -77,8 +99,61 @@ internal static ResourceSetDescription DeserializeResourceSetDescription(JsonEle exceptions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceSetDescription(Optional.ToList(elements), Optional.ToList(exceptions), serializedAdditionalRawData); + } + + ResourceSetDescription IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSetDescription(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSetDescription IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSetDescription(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSetDescription model) + { + if (model is null) + { + return null; } - return new ResourceSetDescription(Optional.ToList(elements), Optional.ToList(exceptions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSetDescription(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSetDescription(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.cs index 1723b96916ef..fbc802f4ac8f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ResourceSetDescription.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The resource set description. public partial class ResourceSetDescription { - /// Initializes a new instance of ResourceSetDescription. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ResourceSetDescription() { Elements = new ChangeTrackingList(); Exceptions = new ChangeTrackingList(); } - /// Initializes a new instance of ResourceSetDescription. + /// Initializes a new instance of . /// The elements included in the set. /// The elements that are not included in the set, in case elements contains '*' indicating 'all'. - internal ResourceSetDescription(IList elements, IList exceptions) + /// Keeps track of any properties unknown to the library. + internal ResourceSetDescription(IList elements, IList exceptions, Dictionary serializedAdditionalRawData) { Elements = elements; Exceptions = exceptions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The elements included in the set. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.Serialization.cs index 9c6696263f67..d7976395e651 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class RoleAssignmentListResult + internal partial class RoleAssignmentListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static RoleAssignmentListResult DeserializeRoleAssignmentListResult(Jso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleAssignmentListResult(Optional.ToList(value), nextLink.Value); + return new RoleAssignmentListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleAssignmentListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.cs index 652d8293d187..0fc33ec7ea6b 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list role assignment operation. internal partial class RoleAssignmentListResult { - /// Initializes a new instance of RoleAssignmentListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleAssignmentListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleAssignmentListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal RoleAssignmentListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentResourceFormatData.Serialization.cs index c0e2d0614438..501a232689b7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleAssignmentResourceFormatData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class RoleAssignmentResourceFormatData : IUtf8JsonSerializable + public partial class RoleAssignmentResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -54,81 +60,193 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Principals) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Profiles)) { writer.WritePropertyName("profiles"u8); - writer.WriteObjectValue(Profiles); + if (Profiles is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Profiles).Serialize(writer, options); + } } if (Optional.IsDefined(Interactions)) { writer.WritePropertyName("interactions"u8); - writer.WriteObjectValue(Interactions); + if (Interactions is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Interactions).Serialize(writer, options); + } } if (Optional.IsDefined(Links)) { writer.WritePropertyName("links"u8); - writer.WriteObjectValue(Links); + if (Links is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Links).Serialize(writer, options); + } } if (Optional.IsDefined(Kpis)) { writer.WritePropertyName("kpis"u8); - writer.WriteObjectValue(Kpis); + if (Kpis is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Kpis).Serialize(writer, options); + } } if (Optional.IsDefined(SasPolicies)) { writer.WritePropertyName("sasPolicies"u8); - writer.WriteObjectValue(SasPolicies); + if (SasPolicies is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SasPolicies).Serialize(writer, options); + } } if (Optional.IsDefined(Connectors)) { writer.WritePropertyName("connectors"u8); - writer.WriteObjectValue(Connectors); + if (Connectors is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Connectors).Serialize(writer, options); + } } if (Optional.IsDefined(Views)) { writer.WritePropertyName("views"u8); - writer.WriteObjectValue(Views); + if (Views is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Views).Serialize(writer, options); + } } if (Optional.IsDefined(RelationshipLinks)) { writer.WritePropertyName("relationshipLinks"u8); - writer.WriteObjectValue(RelationshipLinks); + if (RelationshipLinks is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RelationshipLinks).Serialize(writer, options); + } } if (Optional.IsDefined(Relationships)) { writer.WritePropertyName("relationships"u8); - writer.WriteObjectValue(Relationships); + if (Relationships is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Relationships).Serialize(writer, options); + } } if (Optional.IsDefined(WidgetTypes)) { writer.WritePropertyName("widgetTypes"u8); - writer.WriteObjectValue(WidgetTypes); + if (WidgetTypes is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)WidgetTypes).Serialize(writer, options); + } } if (Optional.IsDefined(RoleAssignments)) { writer.WritePropertyName("roleAssignments"u8); - writer.WriteObjectValue(RoleAssignments); + if (RoleAssignments is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RoleAssignments).Serialize(writer, options); + } } if (Optional.IsDefined(ConflationPolicies)) { writer.WritePropertyName("conflationPolicies"u8); - writer.WriteObjectValue(ConflationPolicies); + if (ConflationPolicies is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConflationPolicies).Serialize(writer, options); + } } if (Optional.IsDefined(Segments)) { writer.WritePropertyName("segments"u8); - writer.WriteObjectValue(Segments); + if (Segments is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Segments).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleAssignmentResourceFormatData DeserializeRoleAssignmentResourceFormatData(JsonElement element) + internal static RoleAssignmentResourceFormatData DeserializeRoleAssignmentResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -157,6 +275,7 @@ internal static RoleAssignmentResourceFormatData DeserializeRoleAssignmentResour Optional roleAssignments = default; Optional conflationPolicies = default; Optional segments = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -386,8 +505,61 @@ internal static RoleAssignmentResourceFormatData DeserializeRoleAssignmentResour } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleAssignmentResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(tenantId), assignmentName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToNullable(provisioningState), Optional.ToNullable(role), Optional.ToList(principals), profiles.Value, interactions.Value, links.Value, kpis.Value, sasPolicies.Value, connectors.Value, views.Value, relationshipLinks.Value, relationships.Value, widgetTypes.Value, roleAssignments.Value, conflationPolicies.Value, segments.Value, serializedAdditionalRawData); + } + + RoleAssignmentResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleAssignmentResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleAssignmentResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleAssignmentResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleAssignmentResourceFormatData model) + { + if (model is null) + { + return null; } - return new RoleAssignmentResourceFormatData(id, name, type, systemData.Value, Optional.ToNullable(tenantId), assignmentName.Value, Optional.ToDictionary(displayName), Optional.ToDictionary(description), Optional.ToNullable(provisioningState), Optional.ToNullable(role), Optional.ToList(principals), profiles.Value, interactions.Value, links.Value, kpis.Value, sasPolicies.Value, connectors.Value, views.Value, relationshipLinks.Value, relationships.Value, widgetTypes.Value, roleAssignments.Value, conflationPolicies.Value, segments.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleAssignmentResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleAssignmentResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.Serialization.cs index 1fae0a955ce5..36b897a05468 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class RoleListResult + internal partial class RoleListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleListResult DeserializeRoleListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleListResult DeserializeRoleListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static RoleListResult DeserializeRoleListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleListResult(Optional.ToList(value), nextLink.Value); + return new RoleListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.cs index 91122b6f5a1b..a802f1cbc9dd 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list role assignment operation. internal partial class RoleListResult { - /// Initializes a new instance of RoleListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal RoleListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.Serialization.cs index 58011a5488fa..8611488ab77e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class RoleResourceFormat : IUtf8JsonSerializable + public partial class RoleResourceFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Description); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RoleResourceFormat DeserializeRoleResourceFormat(JsonElement element) + internal static RoleResourceFormat DeserializeRoleResourceFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +66,7 @@ internal static RoleResourceFormat DeserializeRoleResourceFormat(JsonElement ele Optional systemData = default; Optional roleName = default; Optional description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -92,8 +115,61 @@ internal static RoleResourceFormat DeserializeRoleResourceFormat(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RoleResourceFormat(id, name, type, systemData.Value, roleName.Value, description.Value, serializedAdditionalRawData); + } + + RoleResourceFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleResourceFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleResourceFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleResourceFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleResourceFormat model) + { + if (model is null) + { + return null; } - return new RoleResourceFormat(id, name, type, systemData.Value, roleName.Value, description.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleResourceFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleResourceFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.cs index ac4a30f506c3..049659f4c827 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/RoleResourceFormat.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,22 +15,27 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The role resource format. public partial class RoleResourceFormat : ResourceData { - /// Initializes a new instance of RoleResourceFormat. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleResourceFormat() { } - /// Initializes a new instance of RoleResourceFormat. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The role name. /// The description of the role. - internal RoleResourceFormat(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, string description) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleResourceFormat(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string roleName, string description, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RoleName = roleName; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The role name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.Serialization.cs index f32595907f5a..a713d343b08f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class StrongId : IUtf8JsonSerializable + public partial class StrongId : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyPropertyNames"u8); writer.WriteStartArray(); @@ -47,11 +54,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static StrongId DeserializeStrongId(JsonElement element) + internal static StrongId DeserializeStrongId(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,6 +81,7 @@ internal static StrongId DeserializeStrongId(JsonElement element) string strongIdName = default; Optional> displayName = default; Optional> description = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyPropertyNames"u8)) @@ -105,8 +127,61 @@ internal static StrongId DeserializeStrongId(JsonElement element) description = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new StrongId(keyPropertyNames, strongIdName, Optional.ToDictionary(displayName), Optional.ToDictionary(description), serializedAdditionalRawData); + } + + StrongId IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStrongId(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StrongId IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStrongId(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StrongId model) + { + if (model is null) + { + return null; } - return new StrongId(keyPropertyNames, strongIdName, Optional.ToDictionary(displayName), Optional.ToDictionary(description)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StrongId(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStrongId(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.cs index ff654bf55f97..a37906de2c18 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/StrongId.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Property/Properties which represent a unique ID. public partial class StrongId { - /// Initializes a new instance of StrongId. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The properties which make up the unique ID. /// The Name identifying the strong ID. /// or is null. @@ -30,17 +33,24 @@ public StrongId(IEnumerable keyPropertyNames, string strongIdName) Description = new ChangeTrackingDictionary(); } - /// Initializes a new instance of StrongId. + /// Initializes a new instance of . /// The properties which make up the unique ID. /// The Name identifying the strong ID. /// Localized display name. /// Localized descriptions. - internal StrongId(IList keyPropertyNames, string strongIdName, IDictionary displayName, IDictionary description) + /// Keeps track of any properties unknown to the library. + internal StrongId(IList keyPropertyNames, string strongIdName, IDictionary displayName, IDictionary description, Dictionary serializedAdditionalRawData) { KeyPropertyNames = keyPropertyNames; StrongIdName = strongIdName; DisplayName = displayName; Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StrongId() + { } /// The properties which make up the unique ID. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.Serialization.cs index 30d5eaddd8ce..7a0df460ff11 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class SuggestRelationshipLinksResponse + public partial class SuggestRelationshipLinksResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SuggestRelationshipLinksResponse DeserializeSuggestRelationshipLinksResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SuggestRelationshipLinksResponse DeserializeSuggestRelationshipLinksResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional interactionName = default; Optional> suggestedRelationships = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("interactionName"u8)) @@ -42,8 +70,61 @@ internal static SuggestRelationshipLinksResponse DeserializeSuggestRelationshipL suggestedRelationships = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SuggestRelationshipLinksResponse(interactionName.Value, Optional.ToList(suggestedRelationships)); + return new SuggestRelationshipLinksResponse(interactionName.Value, Optional.ToList(suggestedRelationships), serializedAdditionalRawData); + } + + SuggestRelationshipLinksResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSuggestRelationshipLinksResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SuggestRelationshipLinksResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSuggestRelationshipLinksResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SuggestRelationshipLinksResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SuggestRelationshipLinksResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSuggestRelationshipLinksResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.cs index 7545a692183e..2110d9793d5e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/SuggestRelationshipLinksResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of suggest relationship links operation. public partial class SuggestRelationshipLinksResponse { - /// Initializes a new instance of SuggestRelationshipLinksResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SuggestRelationshipLinksResponse() { SuggestedRelationships = new ChangeTrackingList(); } - /// Initializes a new instance of SuggestRelationshipLinksResponse. + /// Initializes a new instance of . /// The interaction name. /// Suggested relationships for the type. - internal SuggestRelationshipLinksResponse(string interactionName, IReadOnlyList suggestedRelationships) + /// Keeps track of any properties unknown to the library. + internal SuggestRelationshipLinksResponse(string interactionName, IReadOnlyList suggestedRelationships, Dictionary serializedAdditionalRawData) { InteractionName = interactionName; SuggestedRelationships = suggestedRelationships; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The interaction name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.Serialization.cs index e490941ec4d4..3a5b7334bb99 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.CustomerInsights.Models { - public partial class TypePropertiesMapping : IUtf8JsonSerializable + public partial class TypePropertiesMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourcePropertyName"u8); writer.WriteStringValue(SourcePropertyName); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("linkType"u8); writer.WriteStringValue(LinkType.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TypePropertiesMapping DeserializeTypePropertiesMapping(JsonElement element) + internal static TypePropertiesMapping DeserializeTypePropertiesMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static TypePropertiesMapping DeserializeTypePropertiesMapping(JsonEleme string sourcePropertyName = default; string targetPropertyName = default; Optional linkType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourcePropertyName"u8)) @@ -57,8 +80,61 @@ internal static TypePropertiesMapping DeserializeTypePropertiesMapping(JsonEleme linkType = property.Value.GetString().ToLinkType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TypePropertiesMapping(sourcePropertyName, targetPropertyName, Optional.ToNullable(linkType), serializedAdditionalRawData); + } + + TypePropertiesMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTypePropertiesMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TypePropertiesMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTypePropertiesMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TypePropertiesMapping model) + { + if (model is null) + { + return null; } - return new TypePropertiesMapping(sourcePropertyName, targetPropertyName, Optional.ToNullable(linkType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TypePropertiesMapping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTypePropertiesMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.cs index 6de986df9d8b..6e6f5300e8b1 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/TypePropertiesMapping.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.CustomerInsights.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// Metadata for a Link's property mapping. public partial class TypePropertiesMapping { - /// Initializes a new instance of TypePropertiesMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Property name on the source Entity Type. /// Property name on the target Entity Type. /// or is null. @@ -26,15 +30,22 @@ public TypePropertiesMapping(string sourcePropertyName, string targetPropertyNam TargetPropertyName = targetPropertyName; } - /// Initializes a new instance of TypePropertiesMapping. + /// Initializes a new instance of . /// Property name on the source Entity Type. /// Property name on the target Entity Type. /// Link type. - internal TypePropertiesMapping(string sourcePropertyName, string targetPropertyName, LinkType? linkType) + /// Keeps track of any properties unknown to the library. + internal TypePropertiesMapping(string sourcePropertyName, string targetPropertyName, LinkType? linkType, Dictionary serializedAdditionalRawData) { SourcePropertyName = sourcePropertyName; TargetPropertyName = targetPropertyName; LinkType = linkType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TypePropertiesMapping() + { } /// Property name on the source Entity Type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.Serialization.cs index 1390ba2150b9..c58155722906 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class ViewListResult + internal partial class ViewListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ViewListResult DeserializeViewListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ViewListResult DeserializeViewListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static ViewListResult DeserializeViewListResult(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ViewListResult(Optional.ToList(value), nextLink.Value); + return new ViewListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ViewListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeViewListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ViewListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeViewListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ViewListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ViewListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeViewListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.cs index ab71fbe4275c..12d054373514 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list view operation. internal partial class ViewListResult { - /// Initializes a new instance of ViewListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ViewListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ViewListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal ViewListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ViewListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewResourceFormatData.Serialization.cs index 6edf10872fcb..b597d0c27410 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/ViewResourceFormatData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class ViewResourceFormatData : IUtf8JsonSerializable + public partial class ViewResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -42,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Definition); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ViewResourceFormatData DeserializeViewResourceFormatData(JsonElement element) + internal static ViewResourceFormatData DeserializeViewResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +82,7 @@ internal static ViewResourceFormatData DeserializeViewResourceFormatData(JsonEle Optional definition = default; Optional changed = default; Optional created = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -156,8 +177,61 @@ internal static ViewResourceFormatData DeserializeViewResourceFormatData(JsonEle } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ViewResourceFormatData(id, name, type, systemData.Value, viewName.Value, userId.Value, Optional.ToNullable(tenantId), Optional.ToDictionary(displayName), definition.Value, Optional.ToNullable(changed), Optional.ToNullable(created), serializedAdditionalRawData); + } + + ViewResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeViewResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ViewResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeViewResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ViewResourceFormatData model) + { + if (model is null) + { + return null; } - return new ViewResourceFormatData(id, name, type, systemData.Value, viewName.Value, userId.Value, Optional.ToNullable(tenantId), Optional.ToDictionary(displayName), definition.Value, Optional.ToNullable(changed), Optional.ToNullable(created)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ViewResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeViewResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.Serialization.cs index 6b4b3a403702..d6672b3a2250 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.CustomerInsights; namespace Azure.ResourceManager.CustomerInsights.Models { - internal partial class WidgetTypeListResult + internal partial class WidgetTypeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static WidgetTypeListResult DeserializeWidgetTypeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static WidgetTypeListResult DeserializeWidgetTypeListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static WidgetTypeListResult DeserializeWidgetTypeListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new WidgetTypeListResult(Optional.ToList(value), nextLink.Value); + return new WidgetTypeListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + WidgetTypeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWidgetTypeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WidgetTypeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWidgetTypeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WidgetTypeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WidgetTypeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWidgetTypeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.cs index fe6e7187fa55..a18d276f8d2c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.CustomerInsights; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.CustomerInsights.Models /// The response of list widget type operation. internal partial class WidgetTypeListResult { - /// Initializes a new instance of WidgetTypeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal WidgetTypeListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of WidgetTypeListResult. + /// Initializes a new instance of . /// Results of the list operation. /// Link to the next set of results. - internal WidgetTypeListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal WidgetTypeListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of the list operation. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeResourceFormatData.Serialization.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeResourceFormatData.Serialization.cs index 059ffd67a75a..a416a7449be8 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeResourceFormatData.Serialization.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Models/WidgetTypeResourceFormatData.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CustomerInsights { - public partial class WidgetTypeResourceFormatData : IUtf8JsonSerializable + public partial class WidgetTypeResourceFormatData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -52,11 +58,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(WidgetVersion); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static WidgetTypeResourceFormatData DeserializeWidgetTypeResourceFormatData(JsonElement element) + internal static WidgetTypeResourceFormatData DeserializeWidgetTypeResourceFormatData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +94,7 @@ internal static WidgetTypeResourceFormatData DeserializeWidgetTypeResourceFormat Optional widgetVersion = default; Optional changed = default; Optional created = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -182,8 +203,61 @@ internal static WidgetTypeResourceFormatData DeserializeWidgetTypeResourceFormat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new WidgetTypeResourceFormatData(id, name, type, systemData.Value, widgetTypeName.Value, definition.Value, description.Value, Optional.ToDictionary(displayName), imageUrl.Value, Optional.ToNullable(tenantId), widgetVersion.Value, Optional.ToNullable(changed), Optional.ToNullable(created), serializedAdditionalRawData); + } + + WidgetTypeResourceFormatData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeWidgetTypeResourceFormatData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + WidgetTypeResourceFormatData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeWidgetTypeResourceFormatData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(WidgetTypeResourceFormatData model) + { + if (model is null) + { + return null; } - return new WidgetTypeResourceFormatData(id, name, type, systemData.Value, widgetTypeName.Value, definition.Value, description.Value, Optional.ToDictionary(displayName), imageUrl.Value, Optional.ToNullable(tenantId), widgetVersion.Value, Optional.ToNullable(changed), Optional.ToNullable(created)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator WidgetTypeResourceFormatData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeWidgetTypeResourceFormatData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs index b3a74e91c8d4..c18d819e0858 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _predictionResourceFormatPredictionsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _predictionResourceFormatPredictionsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PredictionResourceFormatResource(Client, PredictionResourceFormatData.DeserializePredictionResourceFormatData(e)), _predictionResourceFormatPredictionsClientDiagnostics, Pipeline, "PredictionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new PredictionResourceFormatResource(Client, PredictionResourceFormatData.DeserializePredictionResourceFormatData(e)), _predictionResourceFormatPredictionsClientDiagnostics, Pipeline, "PredictionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _predictionResourceFormatPredictionsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _predictionResourceFormatPredictionsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PredictionResourceFormatResource(Client, PredictionResourceFormatData.DeserializePredictionResourceFormatData(e)), _predictionResourceFormatPredictionsClientDiagnostics, Pipeline, "PredictionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new PredictionResourceFormatResource(Client, PredictionResourceFormatData.DeserializePredictionResourceFormatData(e)), _predictionResourceFormatPredictionsClientDiagnostics, Pipeline, "PredictionResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatData.cs index d66ed52ab2ea..68af4c04c35f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class PredictionResourceFormatData : ResourceData { - /// Initializes a new instance of PredictionResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PredictionResourceFormatData() { Description = new ChangeTrackingDictionary(); @@ -30,7 +33,7 @@ public PredictionResourceFormatData() Grades = new ChangeTrackingList(); } - /// Initializes a new instance of PredictionResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -52,7 +55,8 @@ public PredictionResourceFormatData() /// Score label. /// The prediction grades. /// System generated entities. - internal PredictionResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary description, IDictionary displayName, IList involvedInteractionTypes, IList involvedKpiTypes, IList involvedRelationships, string negativeOutcomeExpression, string positiveOutcomeExpression, string primaryProfileType, ProvisioningState? provisioningState, string predictionName, string scopeExpression, Guid? tenantId, bool? autoAnalyze, PredictionMappings mappings, string scoreLabel, IList grades, PredictionSystemGeneratedEntities systemGeneratedEntities) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal PredictionResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary description, IDictionary displayName, IList involvedInteractionTypes, IList involvedKpiTypes, IList involvedRelationships, string negativeOutcomeExpression, string positiveOutcomeExpression, string primaryProfileType, ProvisioningState? provisioningState, string predictionName, string scopeExpression, Guid? tenantId, bool? autoAnalyze, PredictionMappings mappings, string scoreLabel, IList grades, PredictionSystemGeneratedEntities systemGeneratedEntities, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; DisplayName = displayName; @@ -71,6 +75,7 @@ internal PredictionResourceFormatData(ResourceIdentifier id, string name, Resour ScoreLabel = scoreLabel; Grades = grades; SystemGeneratedEntities = systemGeneratedEntities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Description of the prediction. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs index 29c5184d4f5a..158e6810c427 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatCollection.cs @@ -231,7 +231,7 @@ public virtual AsyncPageable GetAllAsync(string l { HttpMessage FirstPageRequest(int? pageSizeHint) => _profileResourceFormatProfilesRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _profileResourceFormatProfilesRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProfileResourceFormatResource(Client, ProfileResourceFormatData.DeserializeProfileResourceFormatData(e)), _profileResourceFormatProfilesClientDiagnostics, Pipeline, "ProfileResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ProfileResourceFormatResource(Client, ProfileResourceFormatData.DeserializeProfileResourceFormatData(e)), _profileResourceFormatProfilesClientDiagnostics, Pipeline, "ProfileResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(string localeCode { HttpMessage FirstPageRequest(int? pageSizeHint) => _profileResourceFormatProfilesRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _profileResourceFormatProfilesRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, localeCode); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProfileResourceFormatResource(Client, ProfileResourceFormatData.DeserializeProfileResourceFormatData(e)), _profileResourceFormatProfilesClientDiagnostics, Pipeline, "ProfileResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ProfileResourceFormatResource(Client, ProfileResourceFormatData.DeserializeProfileResourceFormatData(e)), _profileResourceFormatProfilesClientDiagnostics, Pipeline, "ProfileResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatData.cs index ee4ece48ac7b..9a8091f3a2b1 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class ProfileResourceFormatData : ResourceData { - /// Initializes a new instance of ProfileResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ProfileResourceFormatData() { Attributes = new ChangeTrackingDictionary>(); @@ -30,7 +33,7 @@ public ProfileResourceFormatData() StrongIds = new ChangeTrackingList(); } - /// Initializes a new instance of ProfileResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -53,7 +56,8 @@ public ProfileResourceFormatData() /// The timestamp property name. Represents the time when the interaction or profile update happened. /// The name of the entity. /// The strong IDs. - internal ProfileResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary> attributes, IDictionary description, IDictionary displayName, IDictionary> localizedAttributes, string smallImage, string mediumImage, string largeImage, string apiEntitySetName, EntityType? entityType, IList fields, int? instancesCount, DateTimeOffset? lastChangedUtc, ProvisioningState? provisioningState, string schemaItemTypeLink, Guid? tenantId, string timestampFieldName, string typeName, IList strongIds) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ProfileResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary> attributes, IDictionary description, IDictionary displayName, IDictionary> localizedAttributes, string smallImage, string mediumImage, string largeImage, string apiEntitySetName, EntityType? entityType, IList fields, int? instancesCount, DateTimeOffset? lastChangedUtc, ProvisioningState? provisioningState, string schemaItemTypeLink, Guid? tenantId, string timestampFieldName, string typeName, IList strongIds, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Attributes = attributes; Description = description; @@ -73,6 +77,7 @@ internal ProfileResourceFormatData(ResourceIdentifier id, string name, ResourceT TimestampFieldName = timestampFieldName; TypeName = typeName; StrongIds = strongIds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The attributes for the Type. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs index ca0b179c800f..0914d1727184 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync { HttpMessage FirstPageRequest(int? pageSizeHint) => _relationshipLinkResourceFormatRelationshipLinksRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _relationshipLinkResourceFormatRelationshipLinksRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RelationshipLinkResourceFormatResource(Client, RelationshipLinkResourceFormatData.DeserializeRelationshipLinkResourceFormatData(e)), _relationshipLinkResourceFormatRelationshipLinksClientDiagnostics, Pipeline, "RelationshipLinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RelationshipLinkResourceFormatResource(Client, RelationshipLinkResourceFormatData.DeserializeRelationshipLinkResourceFormatData(e)), _relationshipLinkResourceFormatRelationshipLinksClientDiagnostics, Pipeline, "RelationshipLinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _relationshipLinkResourceFormatRelationshipLinksRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _relationshipLinkResourceFormatRelationshipLinksRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RelationshipLinkResourceFormatResource(Client, RelationshipLinkResourceFormatData.DeserializeRelationshipLinkResourceFormatData(e)), _relationshipLinkResourceFormatRelationshipLinksClientDiagnostics, Pipeline, "RelationshipLinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RelationshipLinkResourceFormatResource(Client, RelationshipLinkResourceFormatData.DeserializeRelationshipLinkResourceFormatData(e)), _relationshipLinkResourceFormatRelationshipLinksClientDiagnostics, Pipeline, "RelationshipLinkResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatData.cs index 13c308efd83f..9c3fbb10af14 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class RelationshipLinkResourceFormatData : ResourceData { - /// Initializes a new instance of RelationshipLinkResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RelationshipLinkResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); @@ -29,7 +32,7 @@ public RelationshipLinkResourceFormatData() RelatedProfilePropertyReferences = new ChangeTrackingList(); } - /// Initializes a new instance of RelationshipLinkResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +48,8 @@ public RelationshipLinkResourceFormatData() /// The Relationship associated with the Link. /// The relationship guid id. /// The hub name. - internal RelationshipLinkResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary displayName, IDictionary description, string interactionType, string linkName, IList mappings, IList profilePropertyReferences, ProvisioningState? provisioningState, IList relatedProfilePropertyReferences, string relationshipName, string relationshipGuidId, Guid? tenantId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RelationshipLinkResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary displayName, IDictionary description, string interactionType, string linkName, IList mappings, IList profilePropertyReferences, ProvisioningState? provisioningState, IList relatedProfilePropertyReferences, string relationshipName, string relationshipGuidId, Guid? tenantId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; @@ -58,6 +62,7 @@ internal RelationshipLinkResourceFormatData(ResourceIdentifier id, string name, RelationshipName = relationshipName; RelationshipGuidId = relationshipGuidId; TenantId = tenantId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Localized display name for the Relationship Link. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs index 4f85bea60313..b6a29972ec79 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _relationshipResourceFormatRelationshipsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _relationshipResourceFormatRelationshipsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RelationshipResourceFormatResource(Client, RelationshipResourceFormatData.DeserializeRelationshipResourceFormatData(e)), _relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, "RelationshipResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RelationshipResourceFormatResource(Client, RelationshipResourceFormatData.DeserializeRelationshipResourceFormatData(e)), _relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, "RelationshipResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _relationshipResourceFormatRelationshipsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _relationshipResourceFormatRelationshipsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RelationshipResourceFormatResource(Client, RelationshipResourceFormatData.DeserializeRelationshipResourceFormatData(e)), _relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, "RelationshipResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RelationshipResourceFormatResource(Client, RelationshipResourceFormatData.DeserializeRelationshipResourceFormatData(e)), _relationshipResourceFormatRelationshipsClientDiagnostics, Pipeline, "RelationshipResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatData.cs index ae6cbb034c5b..e81b8a5726c9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class RelationshipResourceFormatData : ResourceData { - /// Initializes a new instance of RelationshipResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RelationshipResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); @@ -28,7 +31,7 @@ public RelationshipResourceFormatData() LookupMappings = new ChangeTrackingList(); } - /// Initializes a new instance of RelationshipResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +48,8 @@ public RelationshipResourceFormatData() /// Related profile being referenced. /// The relationship guid id. /// The hub name. - internal RelationshipResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CardinalityType? cardinality, IDictionary displayName, IDictionary description, DateTimeOffset? expiryDateTimeUtc, IList fields, IList lookupMappings, string profileType, ProvisioningState? provisioningState, string relationshipName, string relatedProfileType, string relationshipGuidId, Guid? tenantId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RelationshipResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CardinalityType? cardinality, IDictionary displayName, IDictionary description, DateTimeOffset? expiryDateTimeUtc, IList fields, IList lookupMappings, string profileType, ProvisioningState? provisioningState, string relationshipName, string relatedProfileType, string relationshipGuidId, Guid? tenantId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Cardinality = cardinality; DisplayName = displayName; @@ -59,6 +63,7 @@ internal RelationshipResourceFormatData(ResourceIdentifier id, string name, Reso RelatedProfileType = relatedProfileType; RelationshipGuidId = relationshipGuidId; TenantId = tenantId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The Relationship Cardinality. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/AuthorizationPoliciesRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/AuthorizationPoliciesRestOperations.cs index f7038b1ea923..da7d37da0675 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/AuthorizationPoliciesRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/AuthorizationPoliciesRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorMappingsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorMappingsRestOperations.cs index 55c6ab957188..84b36867eac4 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorMappingsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorMappingsRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorsRestOperations.cs index 14ff542d0a4b..fbec7759a463 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ConnectorsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/HubsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/HubsRestOperations.cs index 3b8473552ddc..59f4a3f32b89 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/HubsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/HubsRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ImagesRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ImagesRestOperations.cs index 17610a55b32a..da7b90017fa2 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ImagesRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ImagesRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateGetUploadUrlForEntityTypeRequest(string subscriptionI request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(input); - request.Content = content; + request.Content = input; _userAgent.Apply(message); return message; } @@ -142,9 +140,7 @@ internal HttpMessage CreateGetUploadUrlForDataRequest(string subscriptionId, str request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(input); - request.Content = content; + request.Content = input; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/InteractionsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/InteractionsRestOperations.cs index a996e3a22dd6..389a579058ec 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/InteractionsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/InteractionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/KpiRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/KpiRestOperations.cs index 597817c61a1b..c0105f15b456 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/KpiRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/KpiRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/LinksRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/LinksRestOperations.cs index ee9da5d9c9b7..069e122c7276 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/LinksRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/LinksRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/PredictionsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/PredictionsRestOperations.cs index d43b53ad05c6..e17d9bbb39d4 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/PredictionsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/PredictionsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -473,9 +471,7 @@ internal HttpMessage CreateModelStatusRequest(string subscriptionId, string reso uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(predictionModelStatus); - request.Content = content; + request.Content = predictionModelStatus; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ProfilesRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ProfilesRestOperations.cs index c55fb2133998..d7ed19ff00f2 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ProfilesRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ProfilesRestOperations.cs @@ -57,9 +57,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipLinksRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipLinksRestOperations.cs index 72449f19ded4..73ef8a3fd046 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipLinksRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipLinksRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipsRestOperations.cs index 7e9f06425e7e..d7ab4d79dda9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RelationshipsRestOperations.cs @@ -56,9 +56,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs index d26bd73c2dea..47e07b2dce2e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/RoleAssignmentsRestOperations.cs @@ -135,9 +135,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ViewsRestOperations.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ViewsRestOperations.cs index ef8b3d4a7f22..c0aed0790934 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ViewsRestOperations.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RestOperations/ViewsRestOperations.cs @@ -140,9 +140,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs index e1cc8e37e53a..a5462d9c9f78 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentResourceFormatRoleAssignmentsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentResourceFormatRoleAssignmentsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentResourceFormatResource(Client, RoleAssignmentResourceFormatData.DeserializeRoleAssignmentResourceFormatData(e)), _roleAssignmentResourceFormatRoleAssignmentsClientDiagnostics, Pipeline, "RoleAssignmentResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentResourceFormatResource(Client, RoleAssignmentResourceFormatData.DeserializeRoleAssignmentResourceFormatData(e)), _roleAssignmentResourceFormatRoleAssignmentsClientDiagnostics, Pipeline, "RoleAssignmentResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _roleAssignmentResourceFormatRoleAssignmentsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _roleAssignmentResourceFormatRoleAssignmentsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RoleAssignmentResourceFormatResource(Client, RoleAssignmentResourceFormatData.DeserializeRoleAssignmentResourceFormatData(e)), _roleAssignmentResourceFormatRoleAssignmentsClientDiagnostics, Pipeline, "RoleAssignmentResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new RoleAssignmentResourceFormatResource(Client, RoleAssignmentResourceFormatData.DeserializeRoleAssignmentResourceFormatData(e)), _roleAssignmentResourceFormatRoleAssignmentsClientDiagnostics, Pipeline, "RoleAssignmentResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatData.cs index b909a8bcb2c4..aa4e6261f360 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatData.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class RoleAssignmentResourceFormatData : ResourceData { - /// Initializes a new instance of RoleAssignmentResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RoleAssignmentResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); @@ -27,7 +30,7 @@ public RoleAssignmentResourceFormatData() Principals = new ChangeTrackingList(); } - /// Initializes a new instance of RoleAssignmentResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -52,7 +55,8 @@ public RoleAssignmentResourceFormatData() /// The Role assignments set for the assignment. /// Widget types set for the assignment. /// The Role assignments set for the assignment. - internal RoleAssignmentResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? tenantId, string assignmentName, IDictionary displayName, IDictionary description, ProvisioningState? provisioningState, RoleType? role, IList principals, ResourceSetDescription profiles, ResourceSetDescription interactions, ResourceSetDescription links, ResourceSetDescription kpis, ResourceSetDescription sasPolicies, ResourceSetDescription connectors, ResourceSetDescription views, ResourceSetDescription relationshipLinks, ResourceSetDescription relationships, ResourceSetDescription widgetTypes, ResourceSetDescription roleAssignments, ResourceSetDescription conflationPolicies, ResourceSetDescription segments) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal RoleAssignmentResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? tenantId, string assignmentName, IDictionary displayName, IDictionary description, ProvisioningState? provisioningState, RoleType? role, IList principals, ResourceSetDescription profiles, ResourceSetDescription interactions, ResourceSetDescription links, ResourceSetDescription kpis, ResourceSetDescription sasPolicies, ResourceSetDescription connectors, ResourceSetDescription views, ResourceSetDescription relationshipLinks, ResourceSetDescription relationships, ResourceSetDescription widgetTypes, ResourceSetDescription roleAssignments, ResourceSetDescription conflationPolicies, ResourceSetDescription segments, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TenantId = tenantId; AssignmentName = assignmentName; @@ -74,6 +78,7 @@ internal RoleAssignmentResourceFormatData(ResourceIdentifier id, string name, Re RoleAssignments = roleAssignments; ConflationPolicies = conflationPolicies; Segments = segments; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The hub name. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs index 08a9c33ed285..2ba4c6036893 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatCollection.cs @@ -234,7 +234,7 @@ public virtual AsyncPageable GetAllAsync(string user HttpMessage FirstPageRequest(int? pageSizeHint) => _viewResourceFormatViewsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _viewResourceFormatViewsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ViewResourceFormatResource(Client, ViewResourceFormatData.DeserializeViewResourceFormatData(e)), _viewResourceFormatViewsClientDiagnostics, Pipeline, "ViewResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new ViewResourceFormatResource(Client, ViewResourceFormatData.DeserializeViewResourceFormatData(e)), _viewResourceFormatViewsClientDiagnostics, Pipeline, "ViewResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -260,7 +260,7 @@ public virtual Pageable GetAll(string userId, Cancel HttpMessage FirstPageRequest(int? pageSizeHint) => _viewResourceFormatViewsRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _viewResourceFormatViewsRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ViewResourceFormatResource(Client, ViewResourceFormatData.DeserializeViewResourceFormatData(e)), _viewResourceFormatViewsClientDiagnostics, Pipeline, "ViewResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new ViewResourceFormatResource(Client, ViewResourceFormatData.DeserializeViewResourceFormatData(e)), _viewResourceFormatViewsClientDiagnostics, Pipeline, "ViewResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatData.cs index 2482a18a5af5..acd14f23814f 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatData.cs @@ -18,13 +18,16 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class ViewResourceFormatData : ResourceData { - /// Initializes a new instance of ViewResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ViewResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ViewResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +39,8 @@ public ViewResourceFormatData() /// View definition. /// Date time when view was last modified. /// Date time when view was created. - internal ViewResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string viewName, string userId, Guid? tenantId, IDictionary displayName, string definition, DateTimeOffset? changed, DateTimeOffset? created) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal ViewResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string viewName, string userId, Guid? tenantId, IDictionary displayName, string definition, DateTimeOffset? changed, DateTimeOffset? created, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ViewName = viewName; UserId = userId; @@ -45,6 +49,7 @@ internal ViewResourceFormatData(ResourceIdentifier id, string name, ResourceType Definition = definition; Changed = changed; Created = created; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the view. diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs index 67002c7b6836..7180ed9578cc 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _widgetTypeResourceFormatWidgetTypesRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _widgetTypeResourceFormatWidgetTypesRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WidgetTypeResourceFormatResource(Client, WidgetTypeResourceFormatData.DeserializeWidgetTypeResourceFormatData(e)), _widgetTypeResourceFormatWidgetTypesClientDiagnostics, Pipeline, "WidgetTypeResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new WidgetTypeResourceFormatResource(Client, WidgetTypeResourceFormatData.DeserializeWidgetTypeResourceFormatData(e)), _widgetTypeResourceFormatWidgetTypesClientDiagnostics, Pipeline, "WidgetTypeResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _widgetTypeResourceFormatWidgetTypesRestClient.CreateListByHubRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _widgetTypeResourceFormatWidgetTypesRestClient.CreateListByHubNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WidgetTypeResourceFormatResource(Client, WidgetTypeResourceFormatData.DeserializeWidgetTypeResourceFormatData(e)), _widgetTypeResourceFormatWidgetTypesClientDiagnostics, Pipeline, "WidgetTypeResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new WidgetTypeResourceFormatResource(Client, WidgetTypeResourceFormatData.DeserializeWidgetTypeResourceFormatData(e)), _widgetTypeResourceFormatWidgetTypesClientDiagnostics, Pipeline, "WidgetTypeResourceFormatCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatData.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatData.cs index 6c9dd00beb85..cd8a3384be41 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatData.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatData.cs @@ -18,13 +18,16 @@ namespace Azure.ResourceManager.CustomerInsights /// public partial class WidgetTypeResourceFormatData : ResourceData { - /// Initializes a new instance of WidgetTypeResourceFormatData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public WidgetTypeResourceFormatData() { DisplayName = new ChangeTrackingDictionary(); } - /// Initializes a new instance of WidgetTypeResourceFormatData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +41,8 @@ public WidgetTypeResourceFormatData() /// The widget version. /// Date time when widget type was last modified. /// Date time when widget type was created. - internal WidgetTypeResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string widgetTypeName, string definition, string description, IDictionary displayName, Uri imageUri, Guid? tenantId, string widgetVersion, DateTimeOffset? changed, DateTimeOffset? created) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal WidgetTypeResourceFormatData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string widgetTypeName, string definition, string description, IDictionary displayName, Uri imageUri, Guid? tenantId, string widgetVersion, DateTimeOffset? changed, DateTimeOffset? created, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { WidgetTypeName = widgetTypeName; Definition = definition; @@ -49,6 +53,7 @@ internal WidgetTypeResourceFormatData(ResourceIdentifier id, string name, Resour WidgetVersion = widgetVersion; Changed = changed; Created = created; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the widget type. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/ArmDataBoxModelFactory.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/ArmDataBoxModelFactory.cs index 665603781f5b..5b279711a084 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/ArmDataBoxModelFactory.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/ArmDataBoxModelFactory.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Model factory for models. public static partial class ArmDataBoxModelFactory { - /// Initializes a new instance of DataBoxJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -51,10 +51,10 @@ public static DataBoxJobData DataBoxJobData(ResourceIdentifier id = null, string { tags ??= new Dictionary(); - return new DataBoxJobData(id, name, resourceType, systemData, tags, location, transferType, isCancellable, isDeletable, isShippingAddressEditable, reverseShippingDetailsUpdate, reverseTransportPreferenceUpdate, isPrepareToShipEnabled, status, startOn, error, details, cancellationReason, deliveryType, deliveryInfoScheduledOn != null ? new JobDeliveryInfo(deliveryInfoScheduledOn) : null, isCancellableWithoutFee, sku, identity); + return new DataBoxJobData(id, name, resourceType, systemData, tags, location, transferType, isCancellable, isDeletable, isShippingAddressEditable, reverseShippingDetailsUpdate, reverseTransportPreferenceUpdate, isPrepareToShipEnabled, status, startOn, error, details, cancellationReason, deliveryType, deliveryInfoScheduledOn != null ? new JobDeliveryInfo(deliveryInfoScheduledOn, new Dictionary()) : null, isCancellableWithoutFee, sku, identity, default); } - /// Initializes a new instance of DataBoxBasicJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -91,10 +91,10 @@ public static DataBoxBasicJobDetails DataBoxBasicJobDetails(IEnumerable(); actions ??= new List(); - return new UnknownJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), default, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode); + return new UnknownJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), default, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, default); } - /// Initializes a new instance of DataBoxJobStage. + /// Initializes a new instance of . /// Name of the job stage. /// Display name of the job stage. /// Status of the job stage. @@ -103,29 +103,29 @@ public static DataBoxBasicJobDetails DataBoxBasicJobDetails(IEnumerable A new instance for mocking. public static DataBoxJobStage DataBoxJobStage(DataBoxStageName? stageName = null, string displayName = null, DataBoxStageStatus? stageStatus = null, DateTimeOffset? stageTime = null, BinaryData jobStageDetails = null) { - return new DataBoxJobStage(stageName, displayName, stageStatus, stageTime, jobStageDetails); + return new DataBoxJobStage(stageName, displayName, stageStatus, stageTime, jobStageDetails, default); } - /// Initializes a new instance of PackageShippingDetails. + /// Initializes a new instance of . /// Url where shipment can be tracked. /// Name of the carrier. /// Tracking Id of shipment. /// A new instance for mocking. public static PackageShippingDetails PackageShippingDetails(Uri trackingUri = null, string carrierName = null, string trackingId = null) { - return new PackageShippingDetails(trackingUri, carrierName, trackingId); + return new PackageShippingDetails(trackingUri, carrierName, trackingId, default); } - /// Initializes a new instance of TransportPreferences. + /// Initializes a new instance of . /// Indicates Shipment Logistics type that the customer preferred. /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. /// A new instance for mocking. public static TransportPreferences TransportPreferences(TransportShipmentType preferredShipmentType = default, bool? isUpdated = null) { - return new TransportPreferences(preferredShipmentType, isUpdated); + return new TransportPreferences(preferredShipmentType, isUpdated, default); } - /// Initializes a new instance of ReverseShippingDetails. + /// Initializes a new instance of . /// Contact Info. /// Shipping address where customer wishes to receive the device. /// @@ -135,19 +135,19 @@ public static TransportPreferences TransportPreferences(TransportShipmentType pr /// A new instance for mocking. public static ReverseShippingDetails ReverseShippingDetails(ContactInfo contactDetails = null, DataBoxShippingAddress shippingAddress = null, bool? isUpdated = null) { - return new ReverseShippingDetails(contactDetails, shippingAddress, isUpdated); + return new ReverseShippingDetails(contactDetails, shippingAddress, isUpdated, default); } - /// Initializes a new instance of DeviceErasureDetails. + /// Initializes a new instance of . /// Holds the device erasure completion status. /// Shared access key to download cleanup or destruction certificate for device. /// A new instance for mocking. public static DeviceErasureDetails DeviceErasureDetails(DataBoxStageStatus? deviceErasureStatus = null, string erasureOrDestructionCertificateSasKey = null) { - return new DeviceErasureDetails(deviceErasureStatus, erasureOrDestructionCertificateSasKey); + return new DeviceErasureDetails(deviceErasureStatus, erasureOrDestructionCertificateSasKey, default); } - /// Initializes a new instance of LastMitigationActionOnJob. + /// Initializes a new instance of . /// Action performed date time. /// /// Action performed by customer, @@ -157,10 +157,10 @@ public static DeviceErasureDetails DeviceErasureDetails(DataBoxStageStatus? devi /// A new instance for mocking. public static LastMitigationActionOnJob LastMitigationActionOnJob(DateTimeOffset? actionPerformedOn = null, bool? isPerformedByCustomer = null, CustomerResolutionCode? customerResolution = null) { - return new LastMitigationActionOnJob(actionPerformedOn, isPerformedByCustomer, customerResolution); + return new LastMitigationActionOnJob(actionPerformedOn, isPerformedByCustomer, customerResolution, default); } - /// Initializes a new instance of DataCenterAddressResult. + /// Initializes a new instance of . /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. /// A new instance for mocking. @@ -168,10 +168,34 @@ public static DataCenterAddressResult DataCenterAddressResult(IEnumerable(); - return new UnknownDataCenterAddressResponse(default, supportedCarriersForReturnShipment?.ToList(), dataCenterAzureLocation); + return new UnknownDataCenterAddressResponse(default, supportedCarriersForReturnShipment?.ToList(), dataCenterAzureLocation, default); } - /// Initializes a new instance of DataBoxSkuInformation. + /// Initializes a new instance of . + /// Resolution code for the job. + /// Serial number and the customer resolution code corresponding to each serial number. + /// A new instance for mocking. + public static MitigateJobContent MitigateJobContent(CustomerResolutionCode customerResolutionCode = default, IDictionary serialNumberCustomerResolutionMap = null) + { + serialNumberCustomerResolutionMap ??= new Dictionary(); + + return new MitigateJobContent(customerResolutionCode, serialNumberCustomerResolutionMap, default); + } + + /// Initializes a new instance of . + /// Type of the transfer. + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Names to filter for available skus. + /// A new instance for mocking. + public static AvailableSkusContent AvailableSkusContent(DataBoxJobTransferType transferType = default, string country = null, AzureLocation location = default, IEnumerable skuNames = null) + { + skuNames ??= new List(); + + return new AvailableSkusContent(transferType, country, location, skuNames?.ToList(), default); + } + + /// Initializes a new instance of . /// The Sku. /// The sku is enabled or not. /// The map of data location to service location. @@ -190,38 +214,48 @@ public static DataBoxSkuInformation DataBoxSkuInformation(DataBoxSku sku = null, apiVersions ??= new List(); countriesWithinCommerceBoundary ??= new List(); - return new DataBoxSkuInformation(sku, isEnabled, dataLocationToServiceLocationMap?.ToList(), capacity, costs?.ToList(), apiVersions?.ToList(), disabledReason, disabledReasonMessage, requiredFeature, countriesWithinCommerceBoundary?.ToList()); + return new DataBoxSkuInformation(sku, isEnabled, dataLocationToServiceLocationMap?.ToList(), capacity, costs?.ToList(), apiVersions?.ToList(), disabledReason, disabledReasonMessage, requiredFeature, countriesWithinCommerceBoundary?.ToList(), default); } - /// Initializes a new instance of DataLocationToServiceLocationMap. + /// Initializes a new instance of . /// Location of the data. /// Location of the service. /// A new instance for mocking. public static DataLocationToServiceLocationMap DataLocationToServiceLocationMap(AzureLocation? dataLocation = null, AzureLocation? serviceLocation = null) { - return new DataLocationToServiceLocationMap(dataLocation, serviceLocation); + return new DataLocationToServiceLocationMap(dataLocation, serviceLocation, default); } - /// Initializes a new instance of DataBoxSkuCapacity. + /// Initializes a new instance of . /// Usable capacity in TB. /// Maximum capacity in TB. /// A new instance for mocking. public static DataBoxSkuCapacity DataBoxSkuCapacity(string usable = null, string maximum = null) { - return new DataBoxSkuCapacity(usable, maximum); + return new DataBoxSkuCapacity(usable, maximum, default); } - /// Initializes a new instance of DataBoxSkuCost. + /// Initializes a new instance of . /// Meter id of the Sku. /// The type of the meter. /// Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region. /// A new instance for mocking. public static DataBoxSkuCost DataBoxSkuCost(Guid? meterId = null, string meterType = null, double? multiplier = null) { - return new DataBoxSkuCost(meterId, meterType, multiplier); + return new DataBoxSkuCost(meterId, meterType, multiplier, default); + } + + /// Initializes a new instance of . + /// Shipping address of the customer. + /// Device type to be used for the job. + /// Preferences related to the shipment logistics of the sku. + /// A new instance for mocking. + public static DataBoxValidateAddressContent DataBoxValidateAddressContent(DataBoxShippingAddress shippingAddress = null, DataBoxSkuName deviceType = default, TransportPreferences transportPreferences = null) + { + return new DataBoxValidateAddressContent(DataBoxValidationInputDiscriminator.ValidateAddress, shippingAddress, deviceType, transportPreferences, default); } - /// Initializes a new instance of AddressValidationResult. + /// Initializes a new instance of . /// Error code and message of validation response. /// The address validation status. /// List of alternate addresses. @@ -230,18 +264,18 @@ public static AddressValidationResult AddressValidationResult(ResponseError erro { alternateAddresses ??= new List(); - return new AddressValidationResult(DataBoxValidationInputDiscriminator.ValidateAddress, error, validationStatus, alternateAddresses?.ToList()); + return new AddressValidationResult(DataBoxValidationInputDiscriminator.ValidateAddress, error, validationStatus, alternateAddresses?.ToList(), default); } - /// Initializes a new instance of DataBoxValidationInputResult. + /// Initializes a new instance of . /// Error code and message of validation response. /// A new instance for mocking. public static DataBoxValidationInputResult DataBoxValidationInputResult(ResponseError error = null) { - return new UnknownValidationInputResponse(default, error); + return new UnknownValidationInputResponse(default, error, default); } - /// Initializes a new instance of DataBoxValidationResult. + /// Initializes a new instance of . /// Overall validation status. /// /// List of response details contain validationType and its response as key and value respectively. @@ -253,19 +287,19 @@ public static DataBoxValidationResult DataBoxValidationResult(OverallValidationS { individualResponseDetails ??= new List(); - return new DataBoxValidationResult(status, individualResponseDetails?.ToList()); + return new DataBoxValidationResult(status, individualResponseDetails?.ToList(), default); } - /// Initializes a new instance of DataBoxShipmentPickUpResult. + /// Initializes a new instance of . /// Confirmation number for the pick up request. /// Time by which shipment should be ready for pick up, this is in local time of pick up area. /// A new instance for mocking. public static DataBoxShipmentPickUpResult DataBoxShipmentPickUpResult(string confirmationNumber = null, DateTimeOffset? readyBy = null) { - return new DataBoxShipmentPickUpResult(confirmationNumber, readyBy); + return new DataBoxShipmentPickUpResult(confirmationNumber, readyBy, default); } - /// Initializes a new instance of UnencryptedCredentials. + /// Initializes a new instance of . /// Name of the job. /// /// Secrets related to this job. @@ -275,28 +309,37 @@ public static DataBoxShipmentPickUpResult DataBoxShipmentPickUpResult(string con /// A new instance for mocking. public static UnencryptedCredentials UnencryptedCredentials(string jobName = null, JobSecrets jobSecrets = null) { - return new UnencryptedCredentials(jobName, jobSecrets); + return new UnencryptedCredentials(jobName, jobSecrets, default); } - /// Initializes a new instance of JobSecrets. + /// Initializes a new instance of . /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// A new instance for mocking. public static JobSecrets JobSecrets(DataCenterAccessSecurityCode dataCenterAccessSecurityCode = null, ResponseError error = null) { - return new UnknownJobSecrets(default, dataCenterAccessSecurityCode, error); + return new UnknownJobSecrets(default, dataCenterAccessSecurityCode, error, default); } - /// Initializes a new instance of DataCenterAccessSecurityCode. + /// Initializes a new instance of . /// Reverse Dc access security code. /// Forward Dc access security code. /// A new instance for mocking. public static DataCenterAccessSecurityCode DataCenterAccessSecurityCode(string reverseDataCenterAccessCode = null, string forwardDataCenterAccessCode = null) { - return new DataCenterAccessSecurityCode(reverseDataCenterAccessCode, forwardDataCenterAccessCode); + return new DataCenterAccessSecurityCode(reverseDataCenterAccessCode, forwardDataCenterAccessCode, default); + } + + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Country in which storage location should be supported. + /// A new instance for mocking. + public static ScheduleAvailabilityContent ScheduleAvailabilityContent(AzureLocation storageLocation = default, string country = null) + { + return new Models.ScheduleAvailabilityContent(storageLocation, default, country, default); } - /// Initializes a new instance of RegionConfigurationResult. + /// Initializes a new instance of . /// Schedule availability for given sku in a region. /// Transport options available for given sku in a region. /// @@ -310,18 +353,18 @@ public static RegionConfigurationResult RegionConfigurationResult(IEnumerable(); transportAvailabilityDetails ??= new List(); - return new RegionConfigurationResult(scheduleAvailabilityResponseAvailableDates != null ? new ScheduleAvailabilityResponse(scheduleAvailabilityResponseAvailableDates?.ToList()) : null, transportAvailabilityDetails != null ? new TransportAvailabilityResponse(transportAvailabilityDetails?.ToList()) : null, dataCenterAddressResponse); + return new RegionConfigurationResult(scheduleAvailabilityResponseAvailableDates != null ? new ScheduleAvailabilityResponse(scheduleAvailabilityResponseAvailableDates?.ToList(), new Dictionary()) : null, transportAvailabilityDetails != null ? new TransportAvailabilityResponse(transportAvailabilityDetails?.ToList(), new Dictionary()) : null, dataCenterAddressResponse, default); } - /// Initializes a new instance of TransportAvailabilityDetails. + /// Initializes a new instance of . /// Transport Shipment Type supported for given region. /// A new instance for mocking. public static TransportAvailabilityDetails TransportAvailabilityDetails(TransportShipmentType? shipmentType = null) { - return new TransportAvailabilityDetails(shipmentType); + return new TransportAvailabilityDetails(shipmentType, default); } - /// Initializes a new instance of DataBoxAccountCredentialDetails. + /// Initializes a new instance of . /// Name of the account. /// Type of the account. /// Connection string of the account endpoint to use the account as a storage endpoint on the device. @@ -331,10 +374,10 @@ public static DataBoxAccountCredentialDetails DataBoxAccountCredentialDetails(st { shareCredentialDetails ??= new List(); - return new DataBoxAccountCredentialDetails(accountName, dataAccountType, accountConnectionString, shareCredentialDetails?.ToList()); + return new DataBoxAccountCredentialDetails(accountName, dataAccountType, accountConnectionString, shareCredentialDetails?.ToList(), default); } - /// Initializes a new instance of ShareCredentialDetails. + /// Initializes a new instance of . /// Name of the share. /// Type of the share. /// User name for the share. @@ -345,19 +388,19 @@ public static ShareCredentialDetails ShareCredentialDetails(string shareName = n { supportedAccessProtocols ??= new List(); - return new ShareCredentialDetails(shareName, shareType, userName, password, supportedAccessProtocols?.ToList()); + return new ShareCredentialDetails(shareName, shareType, userName, password, supportedAccessProtocols?.ToList(), default); } - /// Initializes a new instance of ApplianceNetworkConfiguration. + /// Initializes a new instance of . /// Name of the network. /// Mac Address. /// A new instance for mocking. public static ApplianceNetworkConfiguration ApplianceNetworkConfiguration(string name = null, string macAddress = null) { - return new ApplianceNetworkConfiguration(name, macAddress); + return new ApplianceNetworkConfiguration(name, macAddress, default); } - /// Initializes a new instance of DataBoxCustomerDiskCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -385,10 +428,10 @@ public static DataBoxCustomerDiskCopyProgress DataBoxCustomerDiskCopyProgress(st { actions ??= new List(); - return new DataBoxCustomerDiskCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList(), serialNumber, copyStatus); + return new DataBoxCustomerDiskCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList(), serialNumber, copyStatus, default); } - /// Initializes a new instance of DataBoxCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -414,10 +457,10 @@ public static DataBoxCopyProgress DataBoxCopyProgress(string storageAccountName { actions ??= new List(); - return new DataBoxCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList()); + return new DataBoxCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList(), default); } - /// Initializes a new instance of GranularCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -443,19 +486,27 @@ public static GranularCopyProgress GranularCopyProgress(string storageAccountNam { actions ??= new List(); - return new GranularCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList()); + return new GranularCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList(), default); } - /// Initializes a new instance of CreateOrderLimitForSubscriptionValidationResult. + /// Initializes a new instance of . + /// Device type to be used for the job. + /// A new instance for mocking. + public static CreateOrderLimitForSubscriptionValidationContent CreateOrderLimitForSubscriptionValidationContent(DataBoxSkuName deviceType = default) + { + return new CreateOrderLimitForSubscriptionValidationContent(DataBoxValidationInputDiscriminator.ValidateCreateOrderLimit, deviceType, default); + } + + /// Initializes a new instance of . /// Error code and message of validation response. /// Create order limit validation status. /// A new instance for mocking. public static CreateOrderLimitForSubscriptionValidationResult CreateOrderLimitForSubscriptionValidationResult(ResponseError error = null, DataBoxValidationStatus? status = null) { - return new CreateOrderLimitForSubscriptionValidationResult(DataBoxValidationInputDiscriminator.ValidateCreateOrderLimit, error, status); + return new CreateOrderLimitForSubscriptionValidationResult(DataBoxValidationInputDiscriminator.ValidateCreateOrderLimit, error, status, default); } - /// Initializes a new instance of DataBoxCustomerDiskJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -501,10 +552,10 @@ public static DataBoxCustomerDiskJobDetails DataBoxCustomerDiskJobDetails(IEnume exportDiskDetails ??= new Dictionary(); copyProgress ??= new List(); - return new DataBoxCustomerDiskJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBoxCustomerDisk, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, importDiskDetails, exportDiskDetails, copyProgress?.ToList(), deliverToDataCenterPackageDetails, returnToCustomerPackageDetails, enableManifestBackup); + return new DataBoxCustomerDiskJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBoxCustomerDisk, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, importDiskDetails, exportDiskDetails, copyProgress?.ToList(), deliverToDataCenterPackageDetails, returnToCustomerPackageDetails, enableManifestBackup, default); } - /// Initializes a new instance of ImportDiskDetails. + /// Initializes a new instance of . /// The relative path of the manifest file on the disk. /// The Base16-encoded MD5 hash of the manifest file on the disk. /// BitLocker key used to encrypt the disk. @@ -512,20 +563,20 @@ public static DataBoxCustomerDiskJobDetails DataBoxCustomerDiskJobDetails(IEnume /// A new instance for mocking. public static ImportDiskDetails ImportDiskDetails(string manifestFile = null, string manifestHash = null, string bitLockerKey = null, string backupManifestCloudPath = null) { - return new ImportDiskDetails(manifestFile, manifestHash, bitLockerKey, backupManifestCloudPath); + return new ImportDiskDetails(manifestFile, manifestHash, bitLockerKey, backupManifestCloudPath, default); } - /// Initializes a new instance of ExportDiskDetails. + /// Initializes a new instance of . /// The relative path of the manifest file on the disk. /// The Base16-encoded MD5 hash of the manifest file on the disk. /// Path to backed up manifest, only returned if enableManifestBackup is true. /// A new instance for mocking. public static ExportDiskDetails ExportDiskDetails(string manifestFile = null, string manifestHash = null, string backupManifestCloudPath = null) { - return new ExportDiskDetails(manifestFile, manifestHash, backupManifestCloudPath); + return new ExportDiskDetails(manifestFile, manifestHash, backupManifestCloudPath, default); } - /// Initializes a new instance of CustomerDiskJobSecrets. + /// Initializes a new instance of . /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secrets object for that device. @@ -535,19 +586,19 @@ public static CustomerDiskJobSecrets CustomerDiskJobSecrets(DataCenterAccessSecu { diskSecrets ??= new List(); - return new CustomerDiskJobSecrets(DataBoxOrderType.DataBoxCustomerDisk, dataCenterAccessSecurityCode, error, diskSecrets?.ToList(), carrierAccountNumber); + return new CustomerDiskJobSecrets(DataBoxOrderType.DataBoxCustomerDisk, dataCenterAccessSecurityCode, error, diskSecrets?.ToList(), carrierAccountNumber, default); } - /// Initializes a new instance of DataBoxDiskSecret. + /// Initializes a new instance of . /// Serial number of the assigned disk. /// Bit Locker key of the disk which can be used to unlock the disk to copy data. /// A new instance for mocking. public static DataBoxDiskSecret DataBoxDiskSecret(string diskSerialNumber = null, string bitLockerKey = null) { - return new DataBoxDiskSecret(diskSerialNumber, bitLockerKey); + return new DataBoxDiskSecret(diskSerialNumber, bitLockerKey, default); } - /// Initializes a new instance of DataCenterAddressInstructionResult. + /// Initializes a new instance of . /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. /// Data center communication instruction. @@ -556,10 +607,10 @@ public static DataCenterAddressInstructionResult DataCenterAddressInstructionRes { supportedCarriersForReturnShipment ??= new List(); - return new DataCenterAddressInstructionResult(DataCenterAddressType.DataCenterAddressInstruction, supportedCarriersForReturnShipment?.ToList(), dataCenterAzureLocation, communicationInstruction); + return new DataCenterAddressInstructionResult(DataCenterAddressType.DataCenterAddressInstruction, supportedCarriersForReturnShipment?.ToList(), dataCenterAzureLocation, communicationInstruction, default); } - /// Initializes a new instance of DataCenterAddressLocationResult. + /// Initializes a new instance of . /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. /// Contact person name. @@ -580,40 +631,40 @@ public static DataCenterAddressLocationResult DataCenterAddressLocationResult(IE { supportedCarriersForReturnShipment ??= new List(); - return new DataCenterAddressLocationResult(DataCenterAddressType.DataCenterAddressLocation, supportedCarriersForReturnShipment?.ToList(), dataCenterAzureLocation, contactPersonName, company, street1, street2, street3, city, state, zip, country, phone, phoneExtension, addressType, additionalShippingInformation); + return new DataCenterAddressLocationResult(DataCenterAddressType.DataCenterAddressLocation, supportedCarriersForReturnShipment?.ToList(), dataCenterAzureLocation, contactPersonName, company, street1, street2, street3, city, state, zip, country, phone, phoneExtension, addressType, additionalShippingInformation, default); } - /// Initializes a new instance of DataBoxAccountCopyLogDetails. + /// Initializes a new instance of . /// Account name. /// Link for copy logs. /// Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose. /// A new instance for mocking. public static DataBoxAccountCopyLogDetails DataBoxAccountCopyLogDetails(string accountName = null, string copyLogLink = null, string copyVerboseLogLink = null) { - return new DataBoxAccountCopyLogDetails(DataBoxOrderType.DataBox, accountName, copyLogLink, copyVerboseLogLink); + return new DataBoxAccountCopyLogDetails(DataBoxOrderType.DataBox, accountName, copyLogLink, copyVerboseLogLink, default); } - /// Initializes a new instance of DataBoxCustomerDiskCopyLogDetails. + /// Initializes a new instance of . /// Disk Serial Number. /// Link for copy error logs. /// Link for copy verbose logs. /// A new instance for mocking. public static DataBoxCustomerDiskCopyLogDetails DataBoxCustomerDiskCopyLogDetails(string serialNumber = null, string errorLogLink = null, string verboseLogLink = null) { - return new DataBoxCustomerDiskCopyLogDetails(DataBoxOrderType.DataBoxCustomerDisk, serialNumber, errorLogLink, verboseLogLink); + return new DataBoxCustomerDiskCopyLogDetails(DataBoxOrderType.DataBoxCustomerDisk, serialNumber, errorLogLink, verboseLogLink, default); } - /// Initializes a new instance of DataBoxDiskCopyLogDetails. + /// Initializes a new instance of . /// Disk Serial Number. /// Link for copy error logs. /// Link for copy verbose logs. /// A new instance for mocking. public static DataBoxDiskCopyLogDetails DataBoxDiskCopyLogDetails(string diskSerialNumber = null, string errorLogLink = null, string verboseLogLink = null) { - return new DataBoxDiskCopyLogDetails(DataBoxOrderType.DataBoxDisk, diskSerialNumber, errorLogLink, verboseLogLink); + return new DataBoxDiskCopyLogDetails(DataBoxOrderType.DataBoxDisk, diskSerialNumber, errorLogLink, verboseLogLink, default); } - /// Initializes a new instance of DataBoxDiskGranularCopyLogDetails. + /// Initializes a new instance of . /// Disk Serial Number. /// Account id. /// Link for copy error logs. @@ -621,10 +672,10 @@ public static DataBoxDiskCopyLogDetails DataBoxDiskCopyLogDetails(string diskSer /// A new instance for mocking. public static DataBoxDiskGranularCopyLogDetails DataBoxDiskGranularCopyLogDetails(string serialNumber = null, ResourceIdentifier accountId = null, string errorLogLink = null, string verboseLogLink = null) { - return new DataBoxDiskGranularCopyLogDetails(DataBoxOrderType.DataBoxCustomerDisk, serialNumber, accountId, errorLogLink, verboseLogLink); + return new DataBoxDiskGranularCopyLogDetails(DataBoxOrderType.DataBoxCustomerDisk, serialNumber, accountId, errorLogLink, verboseLogLink, default); } - /// Initializes a new instance of DataBoxDiskCopyProgress. + /// Initializes a new instance of . /// The serial number of the disk. /// Bytes copied during the copy of disk. /// Indicates the percentage completed for the copy of the disk. @@ -636,10 +687,10 @@ public static DataBoxDiskCopyProgress DataBoxDiskCopyProgress(string serialNumbe { actions ??= new List(); - return new DataBoxDiskCopyProgress(serialNumber, bytesCopied, percentComplete, status, error, actions?.ToList()); + return new DataBoxDiskCopyProgress(serialNumber, bytesCopied, percentComplete, status, error, actions?.ToList(), default); } - /// Initializes a new instance of DataBoxDiskGranularCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -667,10 +718,10 @@ public static DataBoxDiskGranularCopyProgress DataBoxDiskGranularCopyProgress(st { actions ??= new List(); - return new DataBoxDiskGranularCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList(), serialNumber, copyStatus); + return new DataBoxDiskGranularCopyProgress(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions?.ToList(), serialNumber, copyStatus, default); } - /// Initializes a new instance of DataBoxDiskJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -718,10 +769,10 @@ public static DataBoxDiskJobDetails DataBoxDiskJobDetails(IEnumerable(); disksAndSizeDetails ??= new Dictionary(); - return new DataBoxDiskJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBoxDisk, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, preferredDisks, copyProgress?.ToList(), granularCopyProgress?.ToList(), granularCopyLogDetails?.ToList(), disksAndSizeDetails, passkey); + return new DataBoxDiskJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBoxDisk, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, preferredDisks, copyProgress?.ToList(), granularCopyProgress?.ToList(), granularCopyLogDetails?.ToList(), disksAndSizeDetails, passkey, default); } - /// Initializes a new instance of DataBoxDiskJobSecrets. + /// Initializes a new instance of . /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secrets object for that device. @@ -732,10 +783,10 @@ public static DataBoxDiskJobSecrets DataBoxDiskJobSecrets(DataCenterAccessSecuri { diskSecrets ??= new List(); - return new DataBoxDiskJobSecrets(DataBoxOrderType.DataBoxDisk, dataCenterAccessSecurityCode, error, diskSecrets?.ToList(), passkey, isPasskeyUserDefined); + return new DataBoxDiskJobSecrets(DataBoxOrderType.DataBoxDisk, dataCenterAccessSecurityCode, error, diskSecrets?.ToList(), passkey, isPasskeyUserDefined, default); } - /// Initializes a new instance of DataBoxHeavyAccountCopyLogDetails. + /// Initializes a new instance of . /// Account name. /// Link for copy logs. /// Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose. @@ -745,10 +796,10 @@ public static DataBoxHeavyAccountCopyLogDetails DataBoxHeavyAccountCopyLogDetail copyLogLink ??= new List(); copyVerboseLogLink ??= new List(); - return new DataBoxHeavyAccountCopyLogDetails(DataBoxOrderType.DataBoxHeavy, accountName, copyLogLink?.ToList(), copyVerboseLogLink?.ToList()); + return new DataBoxHeavyAccountCopyLogDetails(DataBoxOrderType.DataBoxHeavy, accountName, copyLogLink?.ToList(), copyVerboseLogLink?.ToList(), default); } - /// Initializes a new instance of DataBoxHeavyJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -788,10 +839,10 @@ public static DataBoxHeavyJobDetails DataBoxHeavyJobDetails(IEnumerable(); copyProgress ??= new List(); - return new DataBoxHeavyJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBoxHeavy, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, copyProgress?.ToList(), devicePassword); + return new DataBoxHeavyJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBoxHeavy, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, copyProgress?.ToList(), devicePassword, default); } - /// Initializes a new instance of DataBoxHeavyJobSecrets. + /// Initializes a new instance of . /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secret objects for a databox heavy job. @@ -800,10 +851,10 @@ public static DataBoxHeavyJobSecrets DataBoxHeavyJobSecrets(DataCenterAccessSecu { cabinetPodSecrets ??= new List(); - return new DataBoxHeavyJobSecrets(DataBoxOrderType.DataBoxHeavy, dataCenterAccessSecurityCode, error, cabinetPodSecrets?.ToList()); + return new DataBoxHeavyJobSecrets(DataBoxOrderType.DataBoxHeavy, dataCenterAccessSecurityCode, error, cabinetPodSecrets?.ToList(), default); } - /// Initializes a new instance of DataBoxHeavySecret. + /// Initializes a new instance of . /// Serial number of the assigned device. /// Password for out of the box experience on device. /// Network configuration of the appliance. @@ -815,10 +866,10 @@ public static DataBoxHeavySecret DataBoxHeavySecret(string deviceSerialNumber = networkConfigurations ??= new List(); accountCredentialDetails ??= new List(); - return new DataBoxHeavySecret(deviceSerialNumber, devicePassword, networkConfigurations?.ToList(), encodedValidationCertPubKey, accountCredentialDetails?.ToList()); + return new DataBoxHeavySecret(deviceSerialNumber, devicePassword, networkConfigurations?.ToList(), encodedValidationCertPubKey, accountCredentialDetails?.ToList(), default); } - /// Initializes a new instance of DataBoxJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -858,10 +909,10 @@ public static DataBoxJobDetails DataBoxJobDetails(IEnumerable j actions ??= new List(); copyProgress ??= new List(); - return new DataBoxJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBox, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, copyProgress?.ToList(), devicePassword); + return new DataBoxJobDetails(jobStages?.ToList(), contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails?.ToList(), dataExportDetails?.ToList(), DataBoxOrderType.DataBox, preferences, reverseShippingDetails, copyLogDetails?.ToList(), reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions?.ToList(), lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, copyProgress?.ToList(), devicePassword, default); } - /// Initializes a new instance of DataboxJobSecrets. + /// Initializes a new instance of . /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secret objects for a job. @@ -870,10 +921,10 @@ public static DataboxJobSecrets DataboxJobSecrets(DataCenterAccessSecurityCode d { podSecrets ??= new List(); - return new DataboxJobSecrets(DataBoxOrderType.DataBox, dataCenterAccessSecurityCode, error, podSecrets?.ToList()); + return new DataboxJobSecrets(DataBoxOrderType.DataBox, dataCenterAccessSecurityCode, error, podSecrets?.ToList(), default); } - /// Initializes a new instance of DataBoxSecret. + /// Initializes a new instance of . /// Serial number of the assigned device. /// Password for out of the box experience on device. /// Network configuration of the appliance. @@ -885,43 +936,105 @@ public static DataBoxSecret DataBoxSecret(string deviceSerialNumber = null, stri networkConfigurations ??= new List(); accountCredentialDetails ??= new List(); - return new DataBoxSecret(deviceSerialNumber, devicePassword, networkConfigurations?.ToList(), encodedValidationCertPubKey, accountCredentialDetails?.ToList()); + return new DataBoxSecret(deviceSerialNumber, devicePassword, networkConfigurations?.ToList(), encodedValidationCertPubKey, accountCredentialDetails?.ToList(), default); + } + + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Country in which storage location should be supported. + /// A new instance for mocking. + public static DataBoxScheduleAvailabilityContent DataBoxScheduleAvailabilityContent(AzureLocation storageLocation = default, string country = null) + { + return new DataBoxScheduleAvailabilityContent(storageLocation, DataBoxSkuName.DataBox, country, default); + } + + /// Initializes a new instance of . + /// List of DataTransfer details to be used to export data from azure. + /// List of DataTransfer details to be used to import data to azure. + /// Device type. + /// Type of the transfer. + /// A new instance for mocking. + public static DataTransferDetailsValidationContent DataTransferDetailsValidationContent(IEnumerable dataExportDetails = null, IEnumerable dataImportDetails = null, DataBoxSkuName deviceType = default, DataBoxJobTransferType transferType = default) + { + dataExportDetails ??= new List(); + dataImportDetails ??= new List(); + + return new DataTransferDetailsValidationContent(DataBoxValidationInputDiscriminator.ValidateDataTransferDetails, dataExportDetails?.ToList(), dataImportDetails?.ToList(), deviceType, transferType, default); } - /// Initializes a new instance of DataTransferDetailsValidationResult. + /// Initializes a new instance of . /// Error code and message of validation response. /// Data transfer details validation status. /// A new instance for mocking. public static DataTransferDetailsValidationResult DataTransferDetailsValidationResult(ResponseError error = null, DataBoxValidationStatus? status = null) { - return new DataTransferDetailsValidationResult(DataBoxValidationInputDiscriminator.ValidateDataTransferDetails, error, status); + return new DataTransferDetailsValidationResult(DataBoxValidationInputDiscriminator.ValidateDataTransferDetails, error, status, default); + } + + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Country in which storage location should be supported. + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// A new instance for mocking. + public static DiskScheduleAvailabilityContent DiskScheduleAvailabilityContent(AzureLocation storageLocation = default, string country = null, int expectedDataSizeInTerabytes = default) + { + return new DiskScheduleAvailabilityContent(storageLocation, DataBoxSkuName.DataBoxDisk, country, expectedDataSizeInTerabytes, default); + } + + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Country in which storage location should be supported. + /// A new instance for mocking. + public static HeavyScheduleAvailabilityContent HeavyScheduleAvailabilityContent(AzureLocation storageLocation = default, string country = null) + { + return new HeavyScheduleAvailabilityContent(storageLocation, DataBoxSkuName.DataBoxHeavy, country, default); + } + + /// Initializes a new instance of . + /// Preference of transport and data center. + /// Device type to be used for the job. + /// A new instance for mocking. + public static PreferencesValidationContent PreferencesValidationContent(DataBoxOrderPreferences preference = null, DataBoxSkuName deviceType = default) + { + return new PreferencesValidationContent(DataBoxValidationInputDiscriminator.ValidatePreferences, preference, deviceType, default); } - /// Initializes a new instance of PreferencesValidationResult. + /// Initializes a new instance of . /// Error code and message of validation response. /// Validation status of requested data center and transport. /// A new instance for mocking. public static PreferencesValidationResult PreferencesValidationResult(ResponseError error = null, DataBoxValidationStatus? status = null) { - return new PreferencesValidationResult(DataBoxValidationInputDiscriminator.ValidatePreferences, error, status); + return new PreferencesValidationResult(DataBoxValidationInputDiscriminator.ValidatePreferences, error, status, default); + } + + /// Initializes a new instance of . + /// Device type to be used for the job. + /// Type of the transfer. + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// A new instance for mocking. + public static SkuAvailabilityValidationContent SkuAvailabilityValidationContent(DataBoxSkuName deviceType = default, DataBoxJobTransferType transferType = default, string country = null, AzureLocation location = default) + { + return new SkuAvailabilityValidationContent(DataBoxValidationInputDiscriminator.ValidateSkuAvailability, deviceType, transferType, country, location, default); } - /// Initializes a new instance of SkuAvailabilityValidationResult. + /// Initializes a new instance of . /// Error code and message of validation response. /// Sku availability validation status. /// A new instance for mocking. public static SkuAvailabilityValidationResult SkuAvailabilityValidationResult(ResponseError error = null, DataBoxValidationStatus? status = null) { - return new SkuAvailabilityValidationResult(DataBoxValidationInputDiscriminator.ValidateSkuAvailability, error, status); + return new SkuAvailabilityValidationResult(DataBoxValidationInputDiscriminator.ValidateSkuAvailability, error, status, default); } - /// Initializes a new instance of SubscriptionIsAllowedToCreateJobValidationResult. + /// Initializes a new instance of . /// Error code and message of validation response. /// Validation status of subscription permission to create job. /// A new instance for mocking. public static SubscriptionIsAllowedToCreateJobValidationResult SubscriptionIsAllowedToCreateJobValidationResult(ResponseError error = null, DataBoxValidationStatus? status = null) { - return new SubscriptionIsAllowedToCreateJobValidationResult(DataBoxValidationInputDiscriminator.ValidateSubscriptionIsAllowedToCreateJob, error, status); + return new SubscriptionIsAllowedToCreateJobValidationResult(DataBoxValidationInputDiscriminator.ValidateSubscriptionIsAllowedToCreateJob, error, status, default); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs index a6c33eb91055..ff104ec39d4f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(string skipToken = { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxJobJobsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxJobJobsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), _dataBoxJobJobsClientDiagnostics, Pipeline, "DataBoxJobCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), _dataBoxJobJobsClientDiagnostics, Pipeline, "DataBoxJobCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -255,7 +255,7 @@ public virtual Pageable GetAll(string skipToken = null, Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxJobJobsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxJobJobsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), _dataBoxJobJobsClientDiagnostics, Pipeline, "DataBoxJobCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), _dataBoxJobJobsClientDiagnostics, Pipeline, "DataBoxJobCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobData.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobData.cs index f9e85b746892..a178acfa784e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobData.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.DataBox /// public partial class DataBoxJobData : TrackedResourceData { - /// Initializes a new instance of DataBoxJobData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. /// Type of the data transfer. /// The sku type. @@ -33,7 +36,7 @@ public DataBoxJobData(AzureLocation location, DataBoxJobTransferType transferTyp Sku = sku; } - /// Initializes a new instance of DataBoxJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -61,7 +64,8 @@ public DataBoxJobData(AzureLocation location, DataBoxJobTransferType transferTyp /// Flag to indicate cancellation of scheduled job. /// The sku type. /// Msi identity of the resource. - internal DataBoxJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DataBoxJobTransferType transferType, bool? isCancellable, bool? isDeletable, bool? isShippingAddressEditable, ReverseShippingDetailsEditStatus? reverseShippingDetailsUpdate, ReverseTransportPreferenceEditStatus? reverseTransportPreferenceUpdate, bool? isPrepareToShipEnabled, DataBoxStageName? status, DateTimeOffset? startOn, ResponseError error, DataBoxBasicJobDetails details, string cancellationReason, JobDeliveryType? deliveryType, JobDeliveryInfo deliveryInfo, bool? isCancellableWithoutFee, DataBoxSku sku, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DataBoxJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DataBoxJobTransferType transferType, bool? isCancellable, bool? isDeletable, bool? isShippingAddressEditable, ReverseShippingDetailsEditStatus? reverseShippingDetailsUpdate, ReverseTransportPreferenceEditStatus? reverseTransportPreferenceUpdate, bool? isPrepareToShipEnabled, DataBoxStageName? status, DateTimeOffset? startOn, ResponseError error, DataBoxBasicJobDetails details, string cancellationReason, JobDeliveryType? deliveryType, JobDeliveryInfo deliveryInfo, bool? isCancellableWithoutFee, DataBoxSku sku, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { TransferType = transferType; IsCancellable = isCancellable; @@ -80,6 +84,12 @@ internal DataBoxJobData(ResourceIdentifier id, string name, ResourceType resourc IsCancellableWithoutFee = isCancellableWithoutFee; Sku = sku; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxJobData() + { } /// Type of the data transfer. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index a0a972d78467..fdf857718b51 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -68,7 +68,7 @@ public virtual AsyncPageable GetDataBoxJobsAsync(string skip { HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxJobJobsRestClient.CreateListRequest(Id.SubscriptionId, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxJobJobsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxJobs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxJobs", "value", "nextLink", cancellationToken); } /// @@ -91,7 +91,7 @@ public virtual Pageable GetDataBoxJobs(string skipToken = nu { HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxJobJobsRestClient.CreateListRequest(Id.SubscriptionId, skipToken); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxJobJobsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxJobs", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxJobs", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.Serialization.cs index dd9621cc8b01..b6e54f6e20b3 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.Serialization.cs @@ -5,17 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class AddressValidationOutput + public partial class AddressValidationOutput : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddressValidationOutput DeserializeAddressValidationOutput(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ValidationType)) + { + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.Value.ToSerialString()); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddressValidationOutput DeserializeAddressValidationOutput(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +58,7 @@ internal static AddressValidationOutput DeserializeAddressValidationOutput(JsonE Optional error = default; Optional validationStatus = default; Optional> alternateAddresses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -79,8 +114,61 @@ internal static AddressValidationOutput DeserializeAddressValidationOutput(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddressValidationOutput(Optional.ToNullable(validationType), error.Value, Optional.ToNullable(validationStatus), Optional.ToList(alternateAddresses)); + return new AddressValidationOutput(Optional.ToNullable(validationType), error.Value, Optional.ToNullable(validationStatus), Optional.ToList(alternateAddresses), serializedAdditionalRawData); + } + + AddressValidationOutput IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddressValidationOutput(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddressValidationOutput IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddressValidationOutput(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddressValidationOutput model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddressValidationOutput(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddressValidationOutput(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.cs index fac838618819..d62efded0cf7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationOutput.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.DataBox.Models /// Output of the address validation api. public partial class AddressValidationOutput { - /// Initializes a new instance of AddressValidationOutput. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddressValidationOutput() { AlternateAddresses = new ChangeTrackingList(); } - /// Initializes a new instance of AddressValidationOutput. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// The address validation status. /// List of alternate addresses. - internal AddressValidationOutput(DataBoxValidationInputDiscriminator? validationType, ResponseError error, AddressValidationStatus? validationStatus, IReadOnlyList alternateAddresses) + /// Keeps track of any properties unknown to the library. + internal AddressValidationOutput(DataBoxValidationInputDiscriminator? validationType, ResponseError error, AddressValidationStatus? validationStatus, IReadOnlyList alternateAddresses, Dictionary serializedAdditionalRawData) { ValidationType = validationType; Error = error; ValidationStatus = validationStatus; AlternateAddresses = alternateAddresses; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifies the type of validation response. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.Serialization.cs index e3cc01581857..6af88f119f26 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.Serialization.cs @@ -5,17 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class AddressValidationResult + public partial class AddressValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddressValidationResult DeserializeAddressValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddressValidationResult DeserializeAddressValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +52,7 @@ internal static AddressValidationResult DeserializeAddressValidationResult(JsonE Optional> alternateAddresses = default; DataBoxValidationInputDiscriminator validationType = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("validationStatus"u8)) @@ -63,8 +92,61 @@ internal static AddressValidationResult DeserializeAddressValidationResult(JsonE error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddressValidationResult(validationType, error.Value, Optional.ToNullable(validationStatus), Optional.ToList(alternateAddresses)); + return new AddressValidationResult(validationType, error.Value, Optional.ToNullable(validationStatus), Optional.ToList(alternateAddresses), serializedAdditionalRawData); + } + + AddressValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddressValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddressValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddressValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddressValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddressValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddressValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.cs index a1d31b235de5..b996f5ca6b57 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AddressValidationResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,19 +15,20 @@ namespace Azure.ResourceManager.DataBox.Models /// The address validation output. public partial class AddressValidationResult : DataBoxValidationInputResult { - /// Initializes a new instance of AddressValidationResult. + /// Initializes a new instance of . internal AddressValidationResult() { AlternateAddresses = new ChangeTrackingList(); ValidationType = DataBoxValidationInputDiscriminator.ValidateAddress; } - /// Initializes a new instance of AddressValidationResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// The address validation status. /// List of alternate addresses. - internal AddressValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, AddressValidationStatus? validationStatus, IReadOnlyList alternateAddresses) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal AddressValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, AddressValidationStatus? validationStatus, IReadOnlyList alternateAddresses, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { ValidationStatus = validationStatus; AlternateAddresses = alternateAddresses; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.Serialization.cs index fef8cf3ce213..741a5898ead0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ApplianceNetworkConfiguration + public partial class ApplianceNetworkConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ApplianceNetworkConfiguration DeserializeApplianceNetworkConfiguration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ApplianceNetworkConfiguration DeserializeApplianceNetworkConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional macAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static ApplianceNetworkConfiguration DeserializeApplianceNetworkConfigu macAddress = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ApplianceNetworkConfiguration(name.Value, macAddress.Value); + return new ApplianceNetworkConfiguration(name.Value, macAddress.Value, serializedAdditionalRawData); + } + + ApplianceNetworkConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeApplianceNetworkConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ApplianceNetworkConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeApplianceNetworkConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ApplianceNetworkConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ApplianceNetworkConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeApplianceNetworkConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.cs index 674158aa362c..d2ae267b9154 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ApplianceNetworkConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// The Network Adapter configuration of a DataBox. public partial class ApplianceNetworkConfiguration { - /// Initializes a new instance of ApplianceNetworkConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ApplianceNetworkConfiguration() { } - /// Initializes a new instance of ApplianceNetworkConfiguration. + /// Initializes a new instance of . /// Name of the network. /// Mac Address. - internal ApplianceNetworkConfiguration(string name, string macAddress) + /// Keeps track of any properties unknown to the library. + internal ApplianceNetworkConfiguration(string name, string macAddress, Dictionary serializedAdditionalRawData) { Name = name; MacAddress = macAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the network. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.Serialization.cs index 7bfdcdc2df08..9c30e7e9a4ce 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class AvailableSkusContent : IUtf8JsonSerializable + public partial class AvailableSkusContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("transferType"u8); writer.WriteStringValue(TransferType.ToSerialString()); @@ -31,7 +39,120 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static AvailableSkusContent DeserializeAvailableSkusContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataBoxJobTransferType transferType = default; + string country = default; + AzureLocation location = default; + Optional> skuNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("transferType"u8)) + { + transferType = property.Value.GetString().ToDataBoxJobTransferType(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("skuNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString().ToDataBoxSkuName()); + } + skuNames = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AvailableSkusContent(transferType, country, location, Optional.ToList(skuNames), serializedAdditionalRawData); + } + + AvailableSkusContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableSkusContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableSkusContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableSkusContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableSkusContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableSkusContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableSkusContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.cs index 420627493884..d2df91748c5b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// The filters for showing the available skus. public partial class AvailableSkusContent { - /// Initializes a new instance of AvailableSkusContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the transfer. /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. @@ -29,6 +32,26 @@ public AvailableSkusContent(DataBoxJobTransferType transferType, string country, SkuNames = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Type of the transfer. + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Names to filter for available skus. + /// Keeps track of any properties unknown to the library. + internal AvailableSkusContent(DataBoxJobTransferType transferType, string country, AzureLocation location, IList skuNames, Dictionary serializedAdditionalRawData) + { + TransferType = transferType; + Country = country; + Location = location; + SkuNames = skuNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailableSkusContent() + { + } + /// Type of the transfer. public DataBoxJobTransferType TransferType { get; } /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.Serialization.cs index 0d7fca6ca2e2..71927e74a812 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.Serialization.cs @@ -5,22 +5,55 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class AvailableSkusResult + internal partial class AvailableSkusResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableSkusResult DeserializeAvailableSkusResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableSkusResult DeserializeAvailableSkusResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +75,61 @@ internal static AvailableSkusResult DeserializeAvailableSkusResult(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableSkusResult(Optional.ToList(value), nextLink.Value); + return new AvailableSkusResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AvailableSkusResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableSkusResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableSkusResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableSkusResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableSkusResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableSkusResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableSkusResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.cs index c82215c8a632..fee0221b431f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AvailableSkusResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataBox.Models /// The available skus operation response. internal partial class AvailableSkusResult { - /// Initializes a new instance of AvailableSkusResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableSkusResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AvailableSkusResult. + /// Initializes a new instance of . /// List of available skus. /// Link for the next set of skus. - internal AvailableSkusResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AvailableSkusResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of available skus. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.Serialization.cs index 560458cfc558..9549f597f596 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class AzureFileFilterDetails : IUtf8JsonSerializable + public partial class AzureFileFilterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(FilePrefixList)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AzureFileFilterDetails DeserializeAzureFileFilterDetails(JsonElement element) + internal static AzureFileFilterDetails DeserializeAzureFileFilterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +79,7 @@ internal static AzureFileFilterDetails DeserializeAzureFileFilterDetails(JsonEle Optional> filePrefixList = default; Optional> filePathList = default; Optional> fileShareList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("filePrefixList"u8)) @@ -102,8 +124,61 @@ internal static AzureFileFilterDetails DeserializeAzureFileFilterDetails(JsonEle fileShareList = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureFileFilterDetails(Optional.ToList(filePrefixList), Optional.ToList(filePathList), Optional.ToList(fileShareList), serializedAdditionalRawData); + } + + AzureFileFilterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFileFilterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFileFilterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFileFilterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFileFilterDetails model) + { + if (model is null) + { + return null; } - return new AzureFileFilterDetails(Optional.ToList(filePrefixList), Optional.ToList(filePathList), Optional.ToList(fileShareList)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFileFilterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFileFilterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.cs index 5d488dd8df80..64b6dacaee3e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/AzureFileFilterDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Filter details to transfer Azure files. public partial class AzureFileFilterDetails { - /// Initializes a new instance of AzureFileFilterDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AzureFileFilterDetails() { FilePrefixList = new ChangeTrackingList(); @@ -21,15 +25,17 @@ public AzureFileFilterDetails() FileShareList = new ChangeTrackingList(); } - /// Initializes a new instance of AzureFileFilterDetails. + /// Initializes a new instance of . /// Prefix list of the Azure files to be transferred. /// List of full path of the files to be transferred. /// List of file shares to be transferred. - internal AzureFileFilterDetails(IList filePrefixList, IList filePathList, IList fileShareList) + /// Keeps track of any properties unknown to the library. + internal AzureFileFilterDetails(IList filePrefixList, IList filePathList, IList fileShareList, Dictionary serializedAdditionalRawData) { FilePrefixList = filePrefixList; FilePathList = filePathList; FileShareList = fileShareList; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Prefix list of the Azure files to be transferred. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.Serialization.cs index 3e5f4085d5d6..33e9f5ca56ee 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class BlobFilterDetails : IUtf8JsonSerializable + public partial class BlobFilterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(BlobPrefixList)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BlobFilterDetails DeserializeBlobFilterDetails(JsonElement element) + internal static BlobFilterDetails DeserializeBlobFilterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +79,7 @@ internal static BlobFilterDetails DeserializeBlobFilterDetails(JsonElement eleme Optional> blobPrefixList = default; Optional> blobPathList = default; Optional> containerList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blobPrefixList"u8)) @@ -102,8 +124,61 @@ internal static BlobFilterDetails DeserializeBlobFilterDetails(JsonElement eleme containerList = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BlobFilterDetails(Optional.ToList(blobPrefixList), Optional.ToList(blobPathList), Optional.ToList(containerList), serializedAdditionalRawData); + } + + BlobFilterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBlobFilterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BlobFilterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBlobFilterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BlobFilterDetails model) + { + if (model is null) + { + return null; } - return new BlobFilterDetails(Optional.ToList(blobPrefixList), Optional.ToList(blobPathList), Optional.ToList(containerList)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BlobFilterDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBlobFilterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.cs index cc84aa9d954b..ef6a0df98cd2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/BlobFilterDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Filter details to transfer Azure Blobs. public partial class BlobFilterDetails { - /// Initializes a new instance of BlobFilterDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public BlobFilterDetails() { BlobPrefixList = new ChangeTrackingList(); @@ -21,15 +25,17 @@ public BlobFilterDetails() ContainerList = new ChangeTrackingList(); } - /// Initializes a new instance of BlobFilterDetails. + /// Initializes a new instance of . /// Prefix list of the Azure blobs to be transferred. /// List of full path of the blobs to be transferred. /// List of blob containers to be transferred. - internal BlobFilterDetails(IList blobPrefixList, IList blobPathList, IList containerList) + /// Keeps track of any properties unknown to the library. + internal BlobFilterDetails(IList blobPrefixList, IList blobPathList, IList containerList, Dictionary serializedAdditionalRawData) { BlobPrefixList = blobPrefixList; BlobPathList = blobPathList; ContainerList = containerList; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Prefix list of the Azure blobs to be transferred. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.Serialization.cs index bd730f994a99..a6a25e105d80 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ContactInfo : IUtf8JsonSerializable + public partial class ContactInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contactName"u8); writer.WriteStringValue(ContactName); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mobile"u8); writer.WriteStringValue(Mobile); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ContactInfo DeserializeContactInfo(JsonElement element) + internal static ContactInfo DeserializeContactInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static ContactInfo DeserializeContactInfo(JsonElement element) string phone = default; Optional phoneExtension = default; Optional mobile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contactName"u8)) @@ -64,8 +87,61 @@ internal static ContactInfo DeserializeContactInfo(JsonElement element) mobile = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ContactInfo(contactName, phone, phoneExtension.Value, mobile.Value, serializedAdditionalRawData); + } + + ContactInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContactInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContactInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContactInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContactInfo model) + { + if (model is null) + { + return null; } - return new ContactInfo(contactName, phone, phoneExtension.Value, mobile.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContactInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContactInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.cs index 6fcbfe9fcd49..194f7d4f309f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ContactInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Contact Info. public partial class ContactInfo { - /// Initializes a new instance of ContactInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Contact name of the person. /// Phone number of the contact person. /// or is null. @@ -26,17 +30,24 @@ public ContactInfo(string contactName, string phone) Phone = phone; } - /// Initializes a new instance of ContactInfo. + /// Initializes a new instance of . /// Contact name of the person. /// Phone number of the contact person. /// Phone extension number of the contact person. /// Mobile number of the contact person. - internal ContactInfo(string contactName, string phone, string phoneExtension, string mobile) + /// Keeps track of any properties unknown to the library. + internal ContactInfo(string contactName, string phone, string phoneExtension, string mobile, Dictionary serializedAdditionalRawData) { ContactName = contactName; Phone = phone; PhoneExtension = phoneExtension; Mobile = mobile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContactInfo() + { } /// Contact name of the person. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.Serialization.cs index e195271f736b..dea5f0c6891e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.Serialization.cs @@ -5,14 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class CopyLogDetails + public partial class CopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CopyLogDetails DeserializeCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CopyLogDetails DeserializeCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,7 +58,72 @@ internal static CopyLogDetails DeserializeCopyLogDetails(JsonElement element) case "DataBoxHeavy": return DataBoxHeavyAccountCopyLogDetails.DeserializeDataBoxHeavyAccountCopyLogDetails(element); } } - return UnknownCopyLogDetails.DeserializeUnknownCopyLogDetails(element); + + // Unknown type found so we will deserialize the base properties only + DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("copyLogDetailsType"u8)) + { + copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownCopyLogDetails(copyLogDetailsType, serializedAdditionalRawData); + } + + CopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.cs index 7a3e8be8893b..d56c1b998627 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CopyLogDetails.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.DataBox.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownCopyLogDetails))] public abstract partial class CopyLogDetails { - /// Initializes a new instance of CopyLogDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected CopyLogDetails() { } - /// Initializes a new instance of CopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. - internal CopyLogDetails(DataBoxOrderType copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal CopyLogDetails(DataBoxOrderType copyLogDetailsType, Dictionary serializedAdditionalRawData) { CopyLogDetailsType = copyLogDetailsType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates the type of job details. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.Serialization.cs index 9bc14602c166..192c51ff48b9 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class CreateJobValidationContent : IUtf8JsonSerializable + public partial class CreateJobValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("validationCategory"u8); writer.WriteStringValue(ValidationCategory.ToString()); @@ -21,10 +29,114 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IndividualRequestDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CreateJobValidationContent DeserializeCreateJobValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataBoxValidationCategory validationCategory = default; + IList individualRequestDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validationCategory"u8)) + { + validationCategory = new DataBoxValidationCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("individualRequestDetails"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataBoxValidationInputContent.DeserializeDataBoxValidationInputContent(item)); + } + individualRequestDetails = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateJobValidationContent(validationCategory, individualRequestDetails, serializedAdditionalRawData); + } + + CreateJobValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateJobValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateJobValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateJobValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateJobValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateJobValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateJobValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.cs index 42f617150e64..3fa3a21d1cf0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateJobValidationContent.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// It does all pre-job creation validations. public partial class CreateJobValidationContent : DataBoxValidationContent { - /// Initializes a new instance of CreateJobValidationContent. + /// Initializes a new instance of . /// /// List of request details contain validationType and its request as key and value respectively. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,5 +27,23 @@ public CreateJobValidationContent(IEnumerable ind ValidationCategory = DataBoxValidationCategory.JobCreationValidation; } + + /// Initializes a new instance of . + /// Identify the nature of validation. + /// + /// List of request details contain validationType and its request as key and value respectively. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal CreateJobValidationContent(DataBoxValidationCategory validationCategory, IList individualRequestDetails, Dictionary serializedAdditionalRawData) : base(validationCategory, individualRequestDetails, serializedAdditionalRawData) + { + ValidationCategory = validationCategory; + } + + /// Initializes a new instance of for deserialization. + internal CreateJobValidationContent() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.Serialization.cs index 7c332833d311..0d9a25149270 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class CreateOrderLimitForSubscriptionValidationContent : IUtf8JsonSerializable + public partial class CreateOrderLimitForSubscriptionValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("deviceType"u8); writer.WriteStringValue(DeviceType.ToSerialString()); writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CreateOrderLimitForSubscriptionValidationContent DeserializeCreateOrderLimitForSubscriptionValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataBoxSkuName deviceType = default; + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deviceType"u8)) + { + deviceType = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateOrderLimitForSubscriptionValidationContent(validationType, deviceType, serializedAdditionalRawData); + } + + CreateOrderLimitForSubscriptionValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateOrderLimitForSubscriptionValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateOrderLimitForSubscriptionValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateOrderLimitForSubscriptionValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateOrderLimitForSubscriptionValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateOrderLimitForSubscriptionValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateOrderLimitForSubscriptionValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.cs index 90b9da37147b..774fd745c201 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationContent.cs @@ -5,12 +5,15 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Request to validate create order limit for current subscription. public partial class CreateOrderLimitForSubscriptionValidationContent : DataBoxValidationInputContent { - /// Initializes a new instance of CreateOrderLimitForSubscriptionValidationContent. + /// Initializes a new instance of . /// Device type to be used for the job. public CreateOrderLimitForSubscriptionValidationContent(DataBoxSkuName deviceType) { @@ -18,6 +21,21 @@ public CreateOrderLimitForSubscriptionValidationContent(DataBoxSkuName deviceTyp ValidationType = DataBoxValidationInputDiscriminator.ValidateCreateOrderLimit; } + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// Device type to be used for the job. + /// Keeps track of any properties unknown to the library. + internal CreateOrderLimitForSubscriptionValidationContent(DataBoxValidationInputDiscriminator validationType, DataBoxSkuName deviceType, Dictionary serializedAdditionalRawData) : base(validationType, serializedAdditionalRawData) + { + DeviceType = deviceType; + ValidationType = validationType; + } + + /// Initializes a new instance of for deserialization. + internal CreateOrderLimitForSubscriptionValidationContent() + { + } + /// Device type to be used for the job. public DataBoxSkuName DeviceType { get; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.Serialization.cs index 210c852a4403..dfb46c626a84 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class CreateOrderLimitForSubscriptionValidationResult + public partial class CreateOrderLimitForSubscriptionValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CreateOrderLimitForSubscriptionValidationResult DeserializeCreateOrderLimitForSubscriptionValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CreateOrderLimitForSubscriptionValidationResult DeserializeCreateOrderLimitForSubscriptionValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +51,7 @@ internal static CreateOrderLimitForSubscriptionValidationResult DeserializeCreat Optional status = default; DataBoxValidationInputDiscriminator validationType = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -47,8 +77,61 @@ internal static CreateOrderLimitForSubscriptionValidationResult DeserializeCreat error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CreateOrderLimitForSubscriptionValidationResult(validationType, error.Value, Optional.ToNullable(status)); + return new CreateOrderLimitForSubscriptionValidationResult(validationType, error.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + CreateOrderLimitForSubscriptionValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateOrderLimitForSubscriptionValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateOrderLimitForSubscriptionValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateOrderLimitForSubscriptionValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateOrderLimitForSubscriptionValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateOrderLimitForSubscriptionValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateOrderLimitForSubscriptionValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.cs index 56b344c4e2b2..6b7c27454322 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CreateOrderLimitForSubscriptionValidationResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.DataBox.Models /// Properties of create order limit for subscription validation response. public partial class CreateOrderLimitForSubscriptionValidationResult : DataBoxValidationInputResult { - /// Initializes a new instance of CreateOrderLimitForSubscriptionValidationResult. + /// Initializes a new instance of . internal CreateOrderLimitForSubscriptionValidationResult() { ValidationType = DataBoxValidationInputDiscriminator.ValidateCreateOrderLimit; } - /// Initializes a new instance of CreateOrderLimitForSubscriptionValidationResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// Create order limit validation status. - internal CreateOrderLimitForSubscriptionValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal CreateOrderLimitForSubscriptionValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { Status = status; ValidationType = validationType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.Serialization.cs index 264d821f3b01..14d4e0e614ed 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.Serialization.cs @@ -5,17 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class CustomerDiskJobSecrets + public partial class CustomerDiskJobSecrets : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CustomerDiskJobSecrets DeserializeCustomerDiskJobSecrets(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobSecretsType"u8); + writer.WriteStringValue(JobSecretsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CustomerDiskJobSecrets DeserializeCustomerDiskJobSecrets(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +53,7 @@ internal static CustomerDiskJobSecrets DeserializeCustomerDiskJobSecrets(JsonEle DataBoxOrderType jobSecretsType = default; Optional dcAccessSecurityCode = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskSecrets"u8)) @@ -69,8 +98,61 @@ internal static CustomerDiskJobSecrets DeserializeCustomerDiskJobSecrets(JsonEle error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CustomerDiskJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(diskSecrets), carrierAccountNumber.Value); + return new CustomerDiskJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(diskSecrets), carrierAccountNumber.Value, serializedAdditionalRawData); + } + + CustomerDiskJobSecrets IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomerDiskJobSecrets(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomerDiskJobSecrets IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomerDiskJobSecrets(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomerDiskJobSecrets model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomerDiskJobSecrets(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomerDiskJobSecrets(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.cs index ef5cb6b475c8..7dd56c3cb10a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/CustomerDiskJobSecrets.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,20 +15,21 @@ namespace Azure.ResourceManager.DataBox.Models /// The secrets related to customer disk job. public partial class CustomerDiskJobSecrets : JobSecrets { - /// Initializes a new instance of CustomerDiskJobSecrets. + /// Initializes a new instance of . internal CustomerDiskJobSecrets() { DiskSecrets = new ChangeTrackingList(); JobSecretsType = DataBoxOrderType.DataBoxCustomerDisk; } - /// Initializes a new instance of CustomerDiskJobSecrets. + /// Initializes a new instance of . /// Used to indicate what type of job secrets object. /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secrets object for that device. /// Carrier Account Number of the customer. - internal CustomerDiskJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList diskSecrets, string carrierAccountNumber) : base(jobSecretsType, dataCenterAccessSecurityCode, error) + /// Keeps track of any properties unknown to the library. + internal CustomerDiskJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList diskSecrets, string carrierAccountNumber, Dictionary serializedAdditionalRawData) : base(jobSecretsType, dataCenterAccessSecurityCode, error, serializedAdditionalRawData) { DiskSecrets = diskSecrets; CarrierAccountNumber = carrierAccountNumber; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.Serialization.cs index dcba7dc7a80c..b5a08ec7fb9b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataAccountDetails : IUtf8JsonSerializable + public partial class DataAccountDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dataAccountType"u8); writer.WriteStringValue(DataAccountType.ToSerialString()); @@ -22,11 +30,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sharePassword"u8); writer.WriteStringValue(SharePassword); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataAccountDetails DeserializeDataAccountDetails(JsonElement element) + internal static DataAccountDetails DeserializeDataAccountDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,7 +61,78 @@ internal static DataAccountDetails DeserializeDataAccountDetails(JsonElement ele case "StorageAccount": return DataBoxStorageAccountDetails.DeserializeDataBoxStorageAccountDetails(element); } } - return UnknownDataAccountDetails.DeserializeUnknownDataAccountDetails(element); + + // Unknown type found so we will deserialize the base properties only + DataAccountType dataAccountType = default; + Optional sharePassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataAccountType"u8)) + { + dataAccountType = property.Value.GetString().ToDataAccountType(); + continue; + } + if (property.NameEquals("sharePassword"u8)) + { + sharePassword = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDataAccountDetails(dataAccountType, sharePassword.Value, serializedAdditionalRawData); + } + + DataAccountDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataAccountDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataAccountDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataAccountDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataAccountDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataAccountDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataAccountDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.cs index 9bd5007a343b..8e49497dce3b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataAccountDetails.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.DataBox.Models { /// @@ -12,20 +16,26 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownDataAccountDetails))] public abstract partial class DataAccountDetails { - /// Initializes a new instance of DataAccountDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DataAccountDetails() { } - /// Initializes a new instance of DataAccountDetails. + /// Initializes a new instance of . /// Account Type of the data to be transferred. /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. - internal DataAccountDetails(DataAccountType dataAccountType, string sharePassword) + /// Keeps track of any properties unknown to the library. + internal DataAccountDetails(DataAccountType dataAccountType, string sharePassword, Dictionary serializedAdditionalRawData) { DataAccountType = dataAccountType; SharePassword = sharePassword; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Account Type of the data to be transferred. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.Serialization.cs index aaf708719923..9df638b3f0dc 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.Serialization.cs @@ -5,15 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxAccountCopyLogDetails + public partial class DataBoxAccountCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxAccountCopyLogDetails DeserializeDataBoxAccountCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxAccountCopyLogDetails DeserializeDataBoxAccountCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +52,7 @@ internal static DataBoxAccountCopyLogDetails DeserializeDataBoxAccountCopyLogDet Optional copyLogLink = default; Optional copyVerboseLogLink = default; DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -44,8 +75,61 @@ internal static DataBoxAccountCopyLogDetails DeserializeDataBoxAccountCopyLogDet copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxAccountCopyLogDetails(copyLogDetailsType, accountName.Value, copyLogLink.Value, copyVerboseLogLink.Value); + return new DataBoxAccountCopyLogDetails(copyLogDetailsType, accountName.Value, copyLogLink.Value, copyVerboseLogLink.Value, serializedAdditionalRawData); + } + + DataBoxAccountCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxAccountCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxAccountCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxAccountCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxAccountCopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxAccountCopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxAccountCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.cs index 38adf56806d9..44df823fda55 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCopyLogDetails.cs @@ -5,23 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Copy log details for a storage account of a DataBox job. public partial class DataBoxAccountCopyLogDetails : CopyLogDetails { - /// Initializes a new instance of DataBoxAccountCopyLogDetails. + /// Initializes a new instance of . internal DataBoxAccountCopyLogDetails() { CopyLogDetailsType = DataBoxOrderType.DataBox; } - /// Initializes a new instance of DataBoxAccountCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. /// Account name. /// Link for copy logs. /// Link for copy verbose logs. This will be set only when LogCollectionLevel is set to Verbose. - internal DataBoxAccountCopyLogDetails(DataBoxOrderType copyLogDetailsType, string accountName, string copyLogLink, string copyVerboseLogLink) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal DataBoxAccountCopyLogDetails(DataBoxOrderType copyLogDetailsType, string accountName, string copyLogLink, string copyVerboseLogLink, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { AccountName = accountName; CopyLogLink = copyLogLink; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.Serialization.cs index 1263c9788bb2..fd7deae79af7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxAccountCredentialDetails + public partial class DataBoxAccountCredentialDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxAccountCredentialDetails DeserializeDataBoxAccountCredentialDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxAccountCredentialDetails DeserializeDataBoxAccountCredentialDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +50,7 @@ internal static DataBoxAccountCredentialDetails DeserializeDataBoxAccountCredent Optional dataAccountType = default; Optional accountConnectionString = default; Optional> shareCredentialDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -58,8 +86,61 @@ internal static DataBoxAccountCredentialDetails DeserializeDataBoxAccountCredent shareCredentialDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxAccountCredentialDetails(accountName.Value, Optional.ToNullable(dataAccountType), accountConnectionString.Value, Optional.ToList(shareCredentialDetails)); + return new DataBoxAccountCredentialDetails(accountName.Value, Optional.ToNullable(dataAccountType), accountConnectionString.Value, Optional.ToList(shareCredentialDetails), serializedAdditionalRawData); + } + + DataBoxAccountCredentialDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxAccountCredentialDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxAccountCredentialDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxAccountCredentialDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxAccountCredentialDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxAccountCredentialDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxAccountCredentialDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.cs index 13d2d371895b..b24d64e3c30b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxAccountCredentialDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.DataBox.Models /// Credential details of the account. public partial class DataBoxAccountCredentialDetails { - /// Initializes a new instance of DataBoxAccountCredentialDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxAccountCredentialDetails() { ShareCredentialDetails = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxAccountCredentialDetails. + /// Initializes a new instance of . /// Name of the account. /// Type of the account. /// Connection string of the account endpoint to use the account as a storage endpoint on the device. /// Per share level unencrypted access credentials. - internal DataBoxAccountCredentialDetails(string accountName, DataAccountType? dataAccountType, string accountConnectionString, IReadOnlyList shareCredentialDetails) + /// Keeps track of any properties unknown to the library. + internal DataBoxAccountCredentialDetails(string accountName, DataAccountType? dataAccountType, string accountConnectionString, IReadOnlyList shareCredentialDetails, Dictionary serializedAdditionalRawData) { AccountName = accountName; DataAccountType = dataAccountType; AccountConnectionString = accountConnectionString; ShareCredentialDetails = shareCredentialDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the account. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.Serialization.cs index c32673b142fd..811ab316a1f6 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.Serialization.cs @@ -5,22 +5,44 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxBasicJobDetails : IUtf8JsonSerializable + public partial class DataBoxBasicJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataImportDetails)) { @@ -28,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -38,7 +67,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -47,28 +83,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ExpectedDataSizeInTerabytes)) { writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxBasicJobDetails DeserializeDataBoxBasicJobDetails(JsonElement element) + internal static DataBoxBasicJobDetails DeserializeDataBoxBasicJobDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,7 +154,275 @@ internal static DataBoxBasicJobDetails DeserializeDataBoxBasicJobDetails(JsonEle case "DataBoxHeavy": return DataBoxHeavyJobDetails.DeserializeDataBoxHeavyJobDetails(element); } } - return UnknownJobDetails.DeserializeUnknownJobDetails(element); + + // Unknown type found so we will deserialize the base properties only + Optional> jobStages = default; + DataBoxContactDetails contactDetails = default; + Optional shippingAddress = default; + Optional deliveryPackage = default; + Optional returnPackage = default; + Optional> dataImportDetails = default; + Optional> dataExportDetails = default; + DataBoxOrderType jobDetailsType = default; + Optional preferences = default; + Optional reverseShippingDetails = default; + Optional> copyLogDetails = default; + Optional reverseShipmentLabelSasKey = default; + Optional chainOfCustodySasKey = default; + Optional deviceErasureDetails = default; + Optional keyEncryptionKey = default; + Optional expectedDataSizeInTerabytes = default; + Optional> actions = default; + Optional lastMitigationActionOnJob = default; + Optional dataCenterAddress = default; + Optional dataCenterCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("jobStages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataBoxJobStage.DeserializeDataBoxJobStage(item)); + } + jobStages = array; + continue; + } + if (property.NameEquals("contactDetails"u8)) + { + contactDetails = DataBoxContactDetails.DeserializeDataBoxContactDetails(property.Value); + continue; + } + if (property.NameEquals("shippingAddress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + shippingAddress = DataBoxShippingAddress.DeserializeDataBoxShippingAddress(property.Value); + continue; + } + if (property.NameEquals("deliveryPackage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deliveryPackage = PackageShippingDetails.DeserializePackageShippingDetails(property.Value); + continue; + } + if (property.NameEquals("returnPackage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + returnPackage = PackageShippingDetails.DeserializePackageShippingDetails(property.Value); + continue; + } + if (property.NameEquals("dataImportDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.DataImportDetails.DeserializeDataImportDetails(item)); + } + dataImportDetails = array; + continue; + } + if (property.NameEquals("dataExportDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.DataExportDetails.DeserializeDataExportDetails(item)); + } + dataExportDetails = array; + continue; + } + if (property.NameEquals("jobDetailsType"u8)) + { + jobDetailsType = property.Value.GetString().ToDataBoxOrderType(); + continue; + } + if (property.NameEquals("preferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preferences = DataBoxOrderPreferences.DeserializeDataBoxOrderPreferences(property.Value); + continue; + } + if (property.NameEquals("reverseShippingDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reverseShippingDetails = ReverseShippingDetails.DeserializeReverseShippingDetails(property.Value); + continue; + } + if (property.NameEquals("copyLogDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.CopyLogDetails.DeserializeCopyLogDetails(item)); + } + copyLogDetails = array; + continue; + } + if (property.NameEquals("reverseShipmentLabelSasKey"u8)) + { + reverseShipmentLabelSasKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("chainOfCustodySasKey"u8)) + { + chainOfCustodySasKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("deviceErasureDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deviceErasureDetails = DeviceErasureDetails.DeserializeDeviceErasureDetails(property.Value); + continue; + } + if (property.NameEquals("keyEncryptionKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyEncryptionKey = DataBoxKeyEncryptionKey.DeserializeDataBoxKeyEncryptionKey(property.Value); + continue; + } + if (property.NameEquals("expectedDataSizeInTeraBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expectedDataSizeInTerabytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("actions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString().ToCustomerResolutionCode()); + } + actions = array; + continue; + } + if (property.NameEquals("lastMitigationActionOnJob"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastMitigationActionOnJob = LastMitigationActionOnJob.DeserializeLastMitigationActionOnJob(property.Value); + continue; + } + if (property.NameEquals("datacenterAddress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataCenterAddress = DataCenterAddressResult.DeserializeDataCenterAddressResult(property.Value); + continue; + } + if (property.NameEquals("dataCenterCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataCenterCode = new DataCenterCode(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), serializedAdditionalRawData); + } + + DataBoxBasicJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxBasicJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxBasicJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxBasicJobDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxBasicJobDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxBasicJobDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxBasicJobDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.cs index c8a9e8293132..84134492c808 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxBasicJobDetails.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { @@ -16,9 +17,13 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownJobDetails))] public abstract partial class DataBoxBasicJobDetails { - /// Initializes a new instance of DataBoxBasicJobDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Contact details for notification and shipping. /// is null. protected DataBoxBasicJobDetails(DataBoxContactDetails contactDetails) @@ -33,7 +38,7 @@ protected DataBoxBasicJobDetails(DataBoxContactDetails contactDetails) Actions = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxBasicJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -62,7 +67,8 @@ protected DataBoxBasicJobDetails(DataBoxContactDetails contactDetails) /// The available derived classes include and . /// /// DataCenter code. - internal DataBoxBasicJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode) + /// Keeps track of any properties unknown to the library. + internal DataBoxBasicJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, Dictionary serializedAdditionalRawData) { JobStages = jobStages; ContactDetails = contactDetails; @@ -84,6 +90,12 @@ internal DataBoxBasicJobDetails(IReadOnlyList jobStages, DataBo LastMitigationActionOnJob = lastMitigationActionOnJob; DataCenterAddress = dataCenterAddress; DataCenterCode = dataCenterCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxBasicJobDetails() + { } /// List of stages that run in the job. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.Serialization.cs index 868a7b0fe40c..2e4d2ea7c350 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxContactDetails : IUtf8JsonSerializable + public partial class DataBoxContactDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contactName"u8); writer.WriteStringValue(ContactName); @@ -43,15 +50,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NotificationPreference) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxContactDetails DeserializeDataBoxContactDetails(JsonElement element) + internal static DataBoxContactDetails DeserializeDataBoxContactDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -62,6 +90,7 @@ internal static DataBoxContactDetails DeserializeDataBoxContactDetails(JsonEleme Optional mobile = default; IList emailList = default; Optional> notificationPreference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contactName"u8)) @@ -108,8 +137,61 @@ internal static DataBoxContactDetails DeserializeDataBoxContactDetails(JsonEleme notificationPreference = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxContactDetails(contactName, phone, phoneExtension.Value, mobile.Value, emailList, Optional.ToList(notificationPreference), serializedAdditionalRawData); + } + + DataBoxContactDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxContactDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxContactDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxContactDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxContactDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxContactDetails(Response response) + { + if (response is null) + { + return null; } - return new DataBoxContactDetails(contactName, phone, phoneExtension.Value, mobile.Value, emailList, Optional.ToList(notificationPreference)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxContactDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.cs index b416416f5734..7452318d9b31 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxContactDetails.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Contact Details. public partial class DataBoxContactDetails { - /// Initializes a new instance of DataBoxContactDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Contact name of the person. /// Phone number of the contact person. /// List of Email-ids to be notified about job progress. @@ -32,14 +35,15 @@ public DataBoxContactDetails(string contactName, string phone, IEnumerable(); } - /// Initializes a new instance of DataBoxContactDetails. + /// Initializes a new instance of . /// Contact name of the person. /// Phone number of the contact person. /// Phone extension number of the contact person. /// Mobile number of the contact person. /// List of Email-ids to be notified about job progress. /// Notification preference for a job stage. - internal DataBoxContactDetails(string contactName, string phone, string phoneExtension, string mobile, IList emailList, IList notificationPreference) + /// Keeps track of any properties unknown to the library. + internal DataBoxContactDetails(string contactName, string phone, string phoneExtension, string mobile, IList emailList, IList notificationPreference, Dictionary serializedAdditionalRawData) { ContactName = contactName; Phone = phone; @@ -47,6 +51,12 @@ internal DataBoxContactDetails(string contactName, string phone, string phoneExt Mobile = mobile; EmailList = emailList; NotificationPreference = notificationPreference; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxContactDetails() + { } /// Contact name of the person. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.Serialization.cs index 71613bca495e..ee782972c8a6 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.Serialization.cs @@ -5,17 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxCopyProgress + public partial class DataBoxCopyProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxCopyProgress DeserializeDataBoxCopyProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxCopyProgress DeserializeDataBoxCopyProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +63,7 @@ internal static DataBoxCopyProgress DeserializeDataBoxCopyProgress(JsonElement e Optional isEnumerationInProgress = default; Optional error = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountName"u8)) @@ -193,8 +220,61 @@ internal static DataBoxCopyProgress DeserializeDataBoxCopyProgress(JsonElement e actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions)); + return new DataBoxCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + DataBoxCopyProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxCopyProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxCopyProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxCopyProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxCopyProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxCopyProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxCopyProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.cs index 8fa7e5ef1cf9..50541c729e6a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCopyProgress.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.DataBox.Models /// Copy progress. public partial class DataBoxCopyProgress { - /// Initializes a new instance of DataBoxCopyProgress. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxCopyProgress() { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -41,7 +45,8 @@ internal DataBoxCopyProgress() /// /// Error, if any, in the stage. /// Available actions on the job. - internal DataBoxCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions) + /// Keeps track of any properties unknown to the library. + internal DataBoxCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions, Dictionary serializedAdditionalRawData) { StorageAccountName = storageAccountName; TransferType = transferType; @@ -60,6 +65,7 @@ internal DataBoxCopyProgress(string storageAccountName, DataBoxJobTransferType? IsEnumerationInProgress = isEnumerationInProgress; Error = error; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the storage account. This will be empty for data account types other than storage account. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.Serialization.cs index 6b8c12b690b5..a0aba2b44266 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.Serialization.cs @@ -5,15 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxCustomerDiskCopyLogDetails + public partial class DataBoxCustomerDiskCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxCustomerDiskCopyLogDetails DeserializeDataBoxCustomerDiskCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxCustomerDiskCopyLogDetails DeserializeDataBoxCustomerDiskCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +52,7 @@ internal static DataBoxCustomerDiskCopyLogDetails DeserializeDataBoxCustomerDisk Optional errorLogLink = default; Optional verboseLogLink = default; DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serialNumber"u8)) @@ -44,8 +75,61 @@ internal static DataBoxCustomerDiskCopyLogDetails DeserializeDataBoxCustomerDisk copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxCustomerDiskCopyLogDetails(copyLogDetailsType, serialNumber.Value, errorLogLink.Value, verboseLogLink.Value); + return new DataBoxCustomerDiskCopyLogDetails(copyLogDetailsType, serialNumber.Value, errorLogLink.Value, verboseLogLink.Value, serializedAdditionalRawData); + } + + DataBoxCustomerDiskCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxCustomerDiskCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxCustomerDiskCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxCustomerDiskCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxCustomerDiskCopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxCustomerDiskCopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxCustomerDiskCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.cs index 1ac2144c6093..52bb233c8e16 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyLogDetails.cs @@ -5,23 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Copy Log Details for customer disk. public partial class DataBoxCustomerDiskCopyLogDetails : CopyLogDetails { - /// Initializes a new instance of DataBoxCustomerDiskCopyLogDetails. + /// Initializes a new instance of . internal DataBoxCustomerDiskCopyLogDetails() { CopyLogDetailsType = DataBoxOrderType.DataBoxCustomerDisk; } - /// Initializes a new instance of DataBoxCustomerDiskCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. /// Disk Serial Number. /// Link for copy error logs. /// Link for copy verbose logs. - internal DataBoxCustomerDiskCopyLogDetails(DataBoxOrderType copyLogDetailsType, string serialNumber, string errorLogLink, string verboseLogLink) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal DataBoxCustomerDiskCopyLogDetails(DataBoxOrderType copyLogDetailsType, string serialNumber, string errorLogLink, string verboseLogLink, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { SerialNumber = serialNumber; ErrorLogLink = errorLogLink; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.Serialization.cs index 5d7ed3380ee7..1369b51445aa 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.Serialization.cs @@ -5,17 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxCustomerDiskCopyProgress + public partial class DataBoxCustomerDiskCopyProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxCustomerDiskCopyProgress DeserializeDataBoxCustomerDiskCopyProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxCustomerDiskCopyProgress DeserializeDataBoxCustomerDiskCopyProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +65,7 @@ internal static DataBoxCustomerDiskCopyProgress DeserializeDataBoxCustomerDiskCo Optional isEnumerationInProgress = default; Optional error = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serialNumber"u8)) @@ -209,8 +236,61 @@ internal static DataBoxCustomerDiskCopyProgress DeserializeDataBoxCustomerDiskCo actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxCustomerDiskCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions), serialNumber.Value, Optional.ToNullable(copyStatus)); + return new DataBoxCustomerDiskCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions), serialNumber.Value, Optional.ToNullable(copyStatus), serializedAdditionalRawData); + } + + DataBoxCustomerDiskCopyProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxCustomerDiskCopyProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxCustomerDiskCopyProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxCustomerDiskCopyProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxCustomerDiskCopyProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxCustomerDiskCopyProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxCustomerDiskCopyProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.cs index 58ba51bb34c0..cf0f92921770 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskCopyProgress.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,12 +15,12 @@ namespace Azure.ResourceManager.DataBox.Models /// DataBox CustomerDisk Copy Progress. public partial class DataBoxCustomerDiskCopyProgress : DataBoxCopyProgress { - /// Initializes a new instance of DataBoxCustomerDiskCopyProgress. + /// Initializes a new instance of . internal DataBoxCustomerDiskCopyProgress() { } - /// Initializes a new instance of DataBoxCustomerDiskCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -42,7 +43,8 @@ internal DataBoxCustomerDiskCopyProgress() /// Available actions on the job. /// Disk Serial Number. /// The Status of the copy. - internal DataBoxCustomerDiskCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions, string serialNumber, DataBoxCopyStatus? copyStatus) : base(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions) + /// Keeps track of any properties unknown to the library. + internal DataBoxCustomerDiskCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions, string serialNumber, DataBoxCopyStatus? copyStatus, Dictionary serializedAdditionalRawData) : base(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions, serializedAdditionalRawData) { SerialNumber = serialNumber; CopyStatus = copyStatus; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.Serialization.cs index 918943e0c191..8d5f646a2cf0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxCustomerDiskJobDetails : IUtf8JsonSerializable + public partial class DataBoxCustomerDiskJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(ImportDiskDetails)) { @@ -23,23 +30,51 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in ImportDiskDetails) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } writer.WritePropertyName("returnToCustomerPackageDetails"u8); - writer.WriteObjectValue(ReturnToCustomerPackageDetails); + if (ReturnToCustomerPackageDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReturnToCustomerPackageDetails).Serialize(writer, options); + } if (Optional.IsDefined(EnableManifestBackup)) { writer.WritePropertyName("enableManifestBackup"u8); writer.WriteBooleanValue(EnableManifestBackup.Value); } writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataImportDetails)) { @@ -47,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -57,7 +99,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -66,28 +115,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ExpectedDataSizeInTerabytes)) { writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxCustomerDiskJobDetails DeserializeDataBoxCustomerDiskJobDetails(JsonElement element) + internal static DataBoxCustomerDiskJobDetails DeserializeDataBoxCustomerDiskJobDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -118,6 +202,7 @@ internal static DataBoxCustomerDiskJobDetails DeserializeDataBoxCustomerDiskJobD Optional lastMitigationActionOnJob = default; Optional dataCenterAddress = default; Optional dataCenterCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("importDiskDetailsCollection"u8)) @@ -374,8 +459,61 @@ internal static DataBoxCustomerDiskJobDetails DeserializeDataBoxCustomerDiskJobD dataCenterCode = new DataCenterCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxCustomerDiskJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToDictionary(importDiskDetailsCollection), Optional.ToDictionary(exportDiskDetailsCollection), Optional.ToList(copyProgress), deliverToDcPackageDetails.Value, returnToCustomerPackageDetails, Optional.ToNullable(enableManifestBackup), serializedAdditionalRawData); + } + + DataBoxCustomerDiskJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxCustomerDiskJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxCustomerDiskJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxCustomerDiskJobDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxCustomerDiskJobDetails model) + { + if (model is null) + { + return null; } - return new DataBoxCustomerDiskJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToDictionary(importDiskDetailsCollection), Optional.ToDictionary(exportDiskDetailsCollection), Optional.ToList(copyProgress), deliverToDcPackageDetails.Value, returnToCustomerPackageDetails, Optional.ToNullable(enableManifestBackup)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxCustomerDiskJobDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxCustomerDiskJobDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.cs index d63fd6fe81ce..21a8b860d7fc 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxCustomerDiskJobDetails.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Customer disk job details. public partial class DataBoxCustomerDiskJobDetails : DataBoxBasicJobDetails { - /// Initializes a new instance of DataBoxCustomerDiskJobDetails. + /// Initializes a new instance of . /// Contact details for notification and shipping. /// Return package shipping details. /// or is null. @@ -30,7 +30,7 @@ public DataBoxCustomerDiskJobDetails(DataBoxContactDetails contactDetails, Packa JobDetailsType = DataBoxOrderType.DataBoxCustomerDisk; } - /// Initializes a new instance of DataBoxCustomerDiskJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -65,7 +65,8 @@ public DataBoxCustomerDiskJobDetails(DataBoxContactDetails contactDetails, Packa /// Delivery package shipping details. /// Return package shipping details. /// Flag to indicate if disk manifest should be backed-up in the Storage Account. - internal DataBoxCustomerDiskJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IDictionary importDiskDetails, IReadOnlyDictionary exportDiskDetails, IReadOnlyList copyProgress, PackageCarrierInfo deliverToDataCenterPackageDetails, PackageCarrierDetails returnToCustomerPackageDetails, bool? enableManifestBackup) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode) + /// Keeps track of any properties unknown to the library. + internal DataBoxCustomerDiskJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IDictionary importDiskDetails, IReadOnlyDictionary exportDiskDetails, IReadOnlyList copyProgress, PackageCarrierInfo deliverToDataCenterPackageDetails, PackageCarrierDetails returnToCustomerPackageDetails, bool? enableManifestBackup, Dictionary serializedAdditionalRawData) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, serializedAdditionalRawData) { ImportDiskDetails = importDiskDetails; ExportDiskDetails = exportDiskDetails; @@ -76,6 +77,11 @@ internal DataBoxCustomerDiskJobDetails(IReadOnlyList jobStages, JobDetailsType = jobDetailsType; } + /// Initializes a new instance of for deserialization. + internal DataBoxCustomerDiskJobDetails() + { + } + /// Contains the map of disk serial number to the disk details for import jobs. public IDictionary ImportDiskDetails { get; } /// Contains the map of disk serial number to the disk details for export jobs. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.Serialization.cs index af11fff1d2e5..5164f70dfeee 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.Serialization.cs @@ -5,15 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskCopyLogDetails + public partial class DataBoxDiskCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxDiskCopyLogDetails DeserializeDataBoxDiskCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxDiskCopyLogDetails DeserializeDataBoxDiskCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +52,7 @@ internal static DataBoxDiskCopyLogDetails DeserializeDataBoxDiskCopyLogDetails(J Optional errorLogLink = default; Optional verboseLogLink = default; DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskSerialNumber"u8)) @@ -44,8 +75,61 @@ internal static DataBoxDiskCopyLogDetails DeserializeDataBoxDiskCopyLogDetails(J copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxDiskCopyLogDetails(copyLogDetailsType, diskSerialNumber.Value, errorLogLink.Value, verboseLogLink.Value); + return new DataBoxDiskCopyLogDetails(copyLogDetailsType, diskSerialNumber.Value, errorLogLink.Value, verboseLogLink.Value, serializedAdditionalRawData); + } + + DataBoxDiskCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskCopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskCopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.cs index 49d24c4cbc90..88cacc0eefff 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyLogDetails.cs @@ -5,23 +5,27 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Copy Log Details for a disk. public partial class DataBoxDiskCopyLogDetails : CopyLogDetails { - /// Initializes a new instance of DataBoxDiskCopyLogDetails. + /// Initializes a new instance of . internal DataBoxDiskCopyLogDetails() { CopyLogDetailsType = DataBoxOrderType.DataBoxDisk; } - /// Initializes a new instance of DataBoxDiskCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. /// Disk Serial Number. /// Link for copy error logs. /// Link for copy verbose logs. - internal DataBoxDiskCopyLogDetails(DataBoxOrderType copyLogDetailsType, string diskSerialNumber, string errorLogLink, string verboseLogLink) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskCopyLogDetails(DataBoxOrderType copyLogDetailsType, string diskSerialNumber, string errorLogLink, string verboseLogLink, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { DiskSerialNumber = diskSerialNumber; ErrorLogLink = errorLogLink; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.Serialization.cs index 4085df10d002..28ba7834af22 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.Serialization.cs @@ -5,17 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskCopyProgress + public partial class DataBoxDiskCopyProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxDiskCopyProgress DeserializeDataBoxDiskCopyProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxDiskCopyProgress DeserializeDataBoxDiskCopyProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +52,7 @@ internal static DataBoxDiskCopyProgress DeserializeDataBoxDiskCopyProgress(JsonE Optional status = default; Optional error = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serialNumber"u8)) @@ -83,8 +110,61 @@ internal static DataBoxDiskCopyProgress DeserializeDataBoxDiskCopyProgress(JsonE actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxDiskCopyProgress(serialNumber.Value, Optional.ToNullable(bytesCopied), Optional.ToNullable(percentComplete), Optional.ToNullable(status), error.Value, Optional.ToList(actions)); + return new DataBoxDiskCopyProgress(serialNumber.Value, Optional.ToNullable(bytesCopied), Optional.ToNullable(percentComplete), Optional.ToNullable(status), error.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + DataBoxDiskCopyProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskCopyProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskCopyProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskCopyProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskCopyProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskCopyProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskCopyProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.cs index b88d39710974..08cd29fe0d43 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskCopyProgress.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,20 +15,24 @@ namespace Azure.ResourceManager.DataBox.Models /// DataBox Disk Copy Progress. public partial class DataBoxDiskCopyProgress { - /// Initializes a new instance of DataBoxDiskCopyProgress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxDiskCopyProgress() { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxDiskCopyProgress. + /// Initializes a new instance of . /// The serial number of the disk. /// Bytes copied during the copy of disk. /// Indicates the percentage completed for the copy of the disk. /// The Status of the copy. /// Error, if any, in the stage. /// Available actions on the job. - internal DataBoxDiskCopyProgress(string serialNumber, long? bytesCopied, int? percentComplete, DataBoxCopyStatus? status, ResponseError error, IReadOnlyList actions) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskCopyProgress(string serialNumber, long? bytesCopied, int? percentComplete, DataBoxCopyStatus? status, ResponseError error, IReadOnlyList actions, Dictionary serializedAdditionalRawData) { SerialNumber = serialNumber; BytesCopied = bytesCopied; @@ -35,6 +40,7 @@ internal DataBoxDiskCopyProgress(string serialNumber, long? bytesCopied, int? pe Status = status; Error = error; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The serial number of the disk. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.Serialization.cs index 1deb1fd813cc..4d741d988501 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.Serialization.cs @@ -5,15 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskGranularCopyLogDetails + public partial class DataBoxDiskGranularCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxDiskGranularCopyLogDetails DeserializeDataBoxDiskGranularCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxDiskGranularCopyLogDetails DeserializeDataBoxDiskGranularCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +53,7 @@ internal static DataBoxDiskGranularCopyLogDetails DeserializeDataBoxDiskGranular Optional errorLogLink = default; Optional verboseLogLink = default; DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serialNumber"u8)) @@ -54,8 +85,61 @@ internal static DataBoxDiskGranularCopyLogDetails DeserializeDataBoxDiskGranular copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxDiskGranularCopyLogDetails(copyLogDetailsType, serialNumber.Value, accountId.Value, errorLogLink.Value, verboseLogLink.Value); + return new DataBoxDiskGranularCopyLogDetails(copyLogDetailsType, serialNumber.Value, accountId.Value, errorLogLink.Value, verboseLogLink.Value, serializedAdditionalRawData); + } + + DataBoxDiskGranularCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskGranularCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskGranularCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskGranularCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskGranularCopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskGranularCopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskGranularCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.cs index e1f0f77bfa30..04d9ac6caca8 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyLogDetails.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,19 +14,20 @@ namespace Azure.ResourceManager.DataBox.Models /// Granular Copy Log Details for customer disk. public partial class DataBoxDiskGranularCopyLogDetails : GranularCopyLogDetails { - /// Initializes a new instance of DataBoxDiskGranularCopyLogDetails. + /// Initializes a new instance of . internal DataBoxDiskGranularCopyLogDetails() { CopyLogDetailsType = DataBoxOrderType.DataBoxCustomerDisk; } - /// Initializes a new instance of DataBoxDiskGranularCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. /// Disk Serial Number. /// Account id. /// Link for copy error logs. /// Link for copy verbose logs. - internal DataBoxDiskGranularCopyLogDetails(DataBoxOrderType copyLogDetailsType, string serialNumber, ResourceIdentifier accountId, string errorLogLink, string verboseLogLink) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskGranularCopyLogDetails(DataBoxOrderType copyLogDetailsType, string serialNumber, ResourceIdentifier accountId, string errorLogLink, string verboseLogLink, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { SerialNumber = serialNumber; AccountId = accountId; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.Serialization.cs index d344829fd26b..aa1430529345 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.Serialization.cs @@ -5,17 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskGranularCopyProgress + public partial class DataBoxDiskGranularCopyProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxDiskGranularCopyProgress DeserializeDataBoxDiskGranularCopyProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxDiskGranularCopyProgress DeserializeDataBoxDiskGranularCopyProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +65,7 @@ internal static DataBoxDiskGranularCopyProgress DeserializeDataBoxDiskGranularCo Optional isEnumerationInProgress = default; Optional error = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serialNumber"u8)) @@ -209,8 +236,61 @@ internal static DataBoxDiskGranularCopyProgress DeserializeDataBoxDiskGranularCo actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxDiskGranularCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions), serialNumber.Value, Optional.ToNullable(copyStatus)); + return new DataBoxDiskGranularCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions), serialNumber.Value, Optional.ToNullable(copyStatus), serializedAdditionalRawData); + } + + DataBoxDiskGranularCopyProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskGranularCopyProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskGranularCopyProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskGranularCopyProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskGranularCopyProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskGranularCopyProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskGranularCopyProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.cs index 6849c0732277..e57b859709fd 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskGranularCopyProgress.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,12 +15,12 @@ namespace Azure.ResourceManager.DataBox.Models /// DataBox Disk Granular Copy Progress. public partial class DataBoxDiskGranularCopyProgress : GranularCopyProgress { - /// Initializes a new instance of DataBoxDiskGranularCopyProgress. + /// Initializes a new instance of . internal DataBoxDiskGranularCopyProgress() { } - /// Initializes a new instance of DataBoxDiskGranularCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -42,7 +43,8 @@ internal DataBoxDiskGranularCopyProgress() /// Available actions on the job. /// Disk Serial Number. /// The Status of the copy. - internal DataBoxDiskGranularCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions, string serialNumber, DataBoxCopyStatus? copyStatus) : base(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskGranularCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions, string serialNumber, DataBoxCopyStatus? copyStatus, Dictionary serializedAdditionalRawData) : base(storageAccountName, transferType, dataAccountType, accountId, bytesProcessed, totalBytesToProcess, filesProcessed, totalFilesToProcess, invalidFilesProcessed, invalidFileBytesUploaded, renamedContainerCount, filesErroredOut, directoriesErroredOut, invalidDirectoriesProcessed, isEnumerationInProgress, error, actions, serializedAdditionalRawData) { SerialNumber = serialNumber; CopyStatus = copyStatus; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.Serialization.cs index bce07a6ab46c..4647c5f9df38 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskJobDetails : IUtf8JsonSerializable + public partial class DataBoxDiskJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PreferredDisks)) { @@ -33,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Passkey); } writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataImportDetails)) { @@ -45,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -55,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -64,28 +99,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ExpectedDataSizeInTerabytes)) { writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxDiskJobDetails DeserializeDataBoxDiskJobDetails(JsonElement element) + internal static DataBoxDiskJobDetails DeserializeDataBoxDiskJobDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -116,6 +186,7 @@ internal static DataBoxDiskJobDetails DeserializeDataBoxDiskJobDetails(JsonEleme Optional lastMitigationActionOnJob = default; Optional dataCenterAddress = default; Optional dataCenterCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("preferredDisks"u8)) @@ -382,8 +453,61 @@ internal static DataBoxDiskJobDetails DeserializeDataBoxDiskJobDetails(JsonEleme dataCenterCode = new DataCenterCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxDiskJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToDictionary(preferredDisks), Optional.ToList(copyProgress), Optional.ToList(granularCopyProgress), Optional.ToList(granularCopyLogDetails), Optional.ToDictionary(disksAndSizeDetails), passkey.Value, serializedAdditionalRawData); + } + + DataBoxDiskJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskJobDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskJobDetails model) + { + if (model is null) + { + return null; } - return new DataBoxDiskJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToDictionary(preferredDisks), Optional.ToList(copyProgress), Optional.ToList(granularCopyProgress), Optional.ToList(granularCopyLogDetails), Optional.ToDictionary(disksAndSizeDetails), passkey.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskJobDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskJobDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.cs index 263752a0b2bc..7033a12acfdf 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobDetails.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// DataBox Disk Job Details. public partial class DataBoxDiskJobDetails : DataBoxBasicJobDetails { - /// Initializes a new instance of DataBoxDiskJobDetails. + /// Initializes a new instance of . /// Contact details for notification and shipping. /// is null. public DataBoxDiskJobDetails(DataBoxContactDetails contactDetails) : base(contactDetails) @@ -29,7 +29,7 @@ public DataBoxDiskJobDetails(DataBoxContactDetails contactDetails) : base(contac JobDetailsType = DataBoxOrderType.DataBoxDisk; } - /// Initializes a new instance of DataBoxDiskJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -64,7 +64,8 @@ public DataBoxDiskJobDetails(DataBoxContactDetails contactDetails) : base(contac /// Copy progress per disk. /// Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer. /// User entered passkey for DataBox Disk job. - internal DataBoxDiskJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IDictionary preferredDisks, IReadOnlyList copyProgress, IReadOnlyList granularCopyProgress, IReadOnlyList granularCopyLogDetails, IReadOnlyDictionary disksAndSizeDetails, string passkey) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IDictionary preferredDisks, IReadOnlyList copyProgress, IReadOnlyList granularCopyProgress, IReadOnlyList granularCopyLogDetails, IReadOnlyDictionary disksAndSizeDetails, string passkey, Dictionary serializedAdditionalRawData) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, serializedAdditionalRawData) { PreferredDisks = preferredDisks; CopyProgress = copyProgress; @@ -75,6 +76,11 @@ internal DataBoxDiskJobDetails(IReadOnlyList jobStages, DataBox JobDetailsType = jobDetailsType; } + /// Initializes a new instance of for deserialization. + internal DataBoxDiskJobDetails() + { + } + /// User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int. public IDictionary PreferredDisks { get; } /// Copy progress per disk. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.Serialization.cs index 35f23ff02efd..019e839702b8 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.Serialization.cs @@ -5,17 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskJobSecrets + public partial class DataBoxDiskJobSecrets : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxDiskJobSecrets DeserializeDataBoxDiskJobSecrets(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobSecretsType"u8); + writer.WriteStringValue(JobSecretsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxDiskJobSecrets DeserializeDataBoxDiskJobSecrets(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -26,6 +54,7 @@ internal static DataBoxDiskJobSecrets DeserializeDataBoxDiskJobSecrets(JsonEleme DataBoxOrderType jobSecretsType = default; Optional dcAccessSecurityCode = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskSecrets"u8)) @@ -79,8 +108,61 @@ internal static DataBoxDiskJobSecrets DeserializeDataBoxDiskJobSecrets(JsonEleme error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxDiskJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(diskSecrets), passKey.Value, Optional.ToNullable(isPasskeyUserDefined)); + return new DataBoxDiskJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(diskSecrets), passKey.Value, Optional.ToNullable(isPasskeyUserDefined), serializedAdditionalRawData); + } + + DataBoxDiskJobSecrets IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskJobSecrets(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskJobSecrets IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskJobSecrets(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskJobSecrets model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskJobSecrets(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskJobSecrets(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.cs index 6d6d310786a1..1ad678d0632c 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskJobSecrets.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,21 +15,22 @@ namespace Azure.ResourceManager.DataBox.Models /// The secrets related to disk job. public partial class DataBoxDiskJobSecrets : JobSecrets { - /// Initializes a new instance of DataBoxDiskJobSecrets. + /// Initializes a new instance of . internal DataBoxDiskJobSecrets() { DiskSecrets = new ChangeTrackingList(); JobSecretsType = DataBoxOrderType.DataBoxDisk; } - /// Initializes a new instance of DataBoxDiskJobSecrets. + /// Initializes a new instance of . /// Used to indicate what type of job secrets object. /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secrets object for that device. /// PassKey for the disk Job. /// Whether passkey was provided by user. - internal DataBoxDiskJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList diskSecrets, string passkey, bool? isPasskeyUserDefined) : base(jobSecretsType, dataCenterAccessSecurityCode, error) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList diskSecrets, string passkey, bool? isPasskeyUserDefined, Dictionary serializedAdditionalRawData) : base(jobSecretsType, dataCenterAccessSecurityCode, error, serializedAdditionalRawData) { DiskSecrets = diskSecrets; Passkey = passkey; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.Serialization.cs index 473742e986be..92169281f45a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxDiskSecret + public partial class DataBoxDiskSecret : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxDiskSecret DeserializeDataBoxDiskSecret(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxDiskSecret DeserializeDataBoxDiskSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional diskSerialNumber = default; Optional bitLockerKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("diskSerialNumber"u8)) @@ -32,8 +61,61 @@ internal static DataBoxDiskSecret DeserializeDataBoxDiskSecret(JsonElement eleme bitLockerKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxDiskSecret(diskSerialNumber.Value, bitLockerKey.Value); + return new DataBoxDiskSecret(diskSerialNumber.Value, bitLockerKey.Value, serializedAdditionalRawData); + } + + DataBoxDiskSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxDiskSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxDiskSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxDiskSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxDiskSecret model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxDiskSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxDiskSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.cs index be6b7b119add..67d5f481e7b8 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxDiskSecret.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Contains all the secrets of a Disk. public partial class DataBoxDiskSecret { - /// Initializes a new instance of DataBoxDiskSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxDiskSecret() { } - /// Initializes a new instance of DataBoxDiskSecret. + /// Initializes a new instance of . /// Serial number of the assigned disk. /// Bit Locker key of the disk which can be used to unlock the disk to copy data. - internal DataBoxDiskSecret(string diskSerialNumber, string bitLockerKey) + /// Keeps track of any properties unknown to the library. + internal DataBoxDiskSecret(string diskSerialNumber, string bitLockerKey, Dictionary serializedAdditionalRawData) { DiskSerialNumber = diskSerialNumber; BitLockerKey = bitLockerKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Serial number of the assigned disk. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.Serialization.cs index 688e58b413a5..ec14ce79ea53 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxEncryptionPreferences : IUtf8JsonSerializable + public partial class DataBoxEncryptionPreferences : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DoubleEncryption)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("hardwareEncryption"u8); writer.WriteStringValue(HardwareEncryption.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEncryptionPreferences DeserializeDataBoxEncryptionPreferences(JsonElement element) + internal static DataBoxEncryptionPreferences DeserializeDataBoxEncryptionPreferences(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional doubleEncryption = default; Optional hardwareEncryption = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("doubleEncryption"u8)) @@ -56,8 +79,61 @@ internal static DataBoxEncryptionPreferences DeserializeDataBoxEncryptionPrefere hardwareEncryption = property.Value.GetString().ToHardwareEncryption(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEncryptionPreferences(Optional.ToNullable(doubleEncryption), Optional.ToNullable(hardwareEncryption), serializedAdditionalRawData); + } + + DataBoxEncryptionPreferences IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEncryptionPreferences(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEncryptionPreferences IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEncryptionPreferences(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEncryptionPreferences model) + { + if (model is null) + { + return null; } - return new DataBoxEncryptionPreferences(Optional.ToNullable(doubleEncryption), Optional.ToNullable(hardwareEncryption)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEncryptionPreferences(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEncryptionPreferences(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.cs index 1607a21bc147..e15a0ef1a87d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxEncryptionPreferences.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Preferences related to the Encryption. public partial class DataBoxEncryptionPreferences { - /// Initializes a new instance of DataBoxEncryptionPreferences. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEncryptionPreferences() { } - /// Initializes a new instance of DataBoxEncryptionPreferences. + /// Initializes a new instance of . /// Defines secondary layer of software-based encryption enablement. /// Defines Hardware level encryption (Only for disk). - internal DataBoxEncryptionPreferences(DataBoxDoubleEncryption? doubleEncryption, HardwareEncryption? hardwareEncryption) + /// Keeps track of any properties unknown to the library. + internal DataBoxEncryptionPreferences(DataBoxDoubleEncryption? doubleEncryption, HardwareEncryption? hardwareEncryption, Dictionary serializedAdditionalRawData) { DoubleEncryption = doubleEncryption; HardwareEncryption = hardwareEncryption; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Defines secondary layer of software-based encryption enablement. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.Serialization.cs index 126969120397..007cb231acc5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxHeavyAccountCopyLogDetails + public partial class DataBoxHeavyAccountCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxHeavyAccountCopyLogDetails DeserializeDataBoxHeavyAccountCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxHeavyAccountCopyLogDetails DeserializeDataBoxHeavyAccountCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +52,7 @@ internal static DataBoxHeavyAccountCopyLogDetails DeserializeDataBoxHeavyAccount Optional> copyLogLink = default; Optional> copyVerboseLogLink = default; DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountName"u8)) @@ -63,8 +93,61 @@ internal static DataBoxHeavyAccountCopyLogDetails DeserializeDataBoxHeavyAccount copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxHeavyAccountCopyLogDetails(copyLogDetailsType, accountName.Value, Optional.ToList(copyLogLink), Optional.ToList(copyVerboseLogLink)); + return new DataBoxHeavyAccountCopyLogDetails(copyLogDetailsType, accountName.Value, Optional.ToList(copyLogLink), Optional.ToList(copyVerboseLogLink), serializedAdditionalRawData); + } + + DataBoxHeavyAccountCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxHeavyAccountCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxHeavyAccountCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxHeavyAccountCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxHeavyAccountCopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxHeavyAccountCopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxHeavyAccountCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.cs index 92eaab078846..cf08e7e550c3 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyAccountCopyLogDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Copy log details for a storage account for Databox heavy. public partial class DataBoxHeavyAccountCopyLogDetails : CopyLogDetails { - /// Initializes a new instance of DataBoxHeavyAccountCopyLogDetails. + /// Initializes a new instance of . internal DataBoxHeavyAccountCopyLogDetails() { CopyLogLink = new ChangeTrackingList(); @@ -21,12 +22,13 @@ internal DataBoxHeavyAccountCopyLogDetails() CopyLogDetailsType = DataBoxOrderType.DataBoxHeavy; } - /// Initializes a new instance of DataBoxHeavyAccountCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. /// Account name. /// Link for copy logs. /// Link for copy verbose logs. This will be set only when the LogCollectionLevel is set to verbose. - internal DataBoxHeavyAccountCopyLogDetails(DataBoxOrderType copyLogDetailsType, string accountName, IReadOnlyList copyLogLink, IReadOnlyList copyVerboseLogLink) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal DataBoxHeavyAccountCopyLogDetails(DataBoxOrderType copyLogDetailsType, string accountName, IReadOnlyList copyLogLink, IReadOnlyList copyVerboseLogLink, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { AccountName = accountName; CopyLogLink = copyLogLink; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.Serialization.cs index a049714f57ab..76696925d427 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxHeavyJobDetails : IUtf8JsonSerializable + public partial class DataBoxHeavyJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DevicePassword)) { @@ -22,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DevicePassword); } writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataImportDetails)) { @@ -34,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -44,7 +72,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,28 +88,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ExpectedDataSizeInTerabytes)) { writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxHeavyJobDetails DeserializeDataBoxHeavyJobDetails(JsonElement element) + internal static DataBoxHeavyJobDetails DeserializeDataBoxHeavyJobDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,6 +171,7 @@ internal static DataBoxHeavyJobDetails DeserializeDataBoxHeavyJobDetails(JsonEle Optional lastMitigationActionOnJob = default; Optional dataCenterAddress = default; Optional dataCenterCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("copyProgress"u8)) @@ -311,8 +382,61 @@ internal static DataBoxHeavyJobDetails DeserializeDataBoxHeavyJobDetails(JsonEle dataCenterCode = new DataCenterCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxHeavyJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToList(copyProgress), devicePassword.Value, serializedAdditionalRawData); + } + + DataBoxHeavyJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxHeavyJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxHeavyJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxHeavyJobDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxHeavyJobDetails model) + { + if (model is null) + { + return null; } - return new DataBoxHeavyJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToList(copyProgress), devicePassword.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxHeavyJobDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxHeavyJobDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.cs index e044062ed935..616587ebfb7f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobDetails.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Databox Heavy Device Job Details. public partial class DataBoxHeavyJobDetails : DataBoxBasicJobDetails { - /// Initializes a new instance of DataBoxHeavyJobDetails. + /// Initializes a new instance of . /// Contact details for notification and shipping. /// is null. public DataBoxHeavyJobDetails(DataBoxContactDetails contactDetails) : base(contactDetails) @@ -25,7 +25,7 @@ public DataBoxHeavyJobDetails(DataBoxContactDetails contactDetails) : base(conta JobDetailsType = DataBoxOrderType.DataBoxHeavy; } - /// Initializes a new instance of DataBoxHeavyJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -56,13 +56,19 @@ public DataBoxHeavyJobDetails(DataBoxContactDetails contactDetails) : base(conta /// DataCenter code. /// Copy progress per account. /// Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. - internal DataBoxHeavyJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IReadOnlyList copyProgress, string devicePassword) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode) + /// Keeps track of any properties unknown to the library. + internal DataBoxHeavyJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IReadOnlyList copyProgress, string devicePassword, Dictionary serializedAdditionalRawData) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, serializedAdditionalRawData) { CopyProgress = copyProgress; DevicePassword = devicePassword; JobDetailsType = jobDetailsType; } + /// Initializes a new instance of for deserialization. + internal DataBoxHeavyJobDetails() + { + } + /// Copy progress per account. public IReadOnlyList CopyProgress { get; } /// Set Device password for unlocking Databox Heavy. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.Serialization.cs index 173b9561c1cf..b3e676612cac 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.Serialization.cs @@ -5,17 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxHeavyJobSecrets + public partial class DataBoxHeavyJobSecrets : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxHeavyJobSecrets DeserializeDataBoxHeavyJobSecrets(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobSecretsType"u8); + writer.WriteStringValue(JobSecretsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxHeavyJobSecrets DeserializeDataBoxHeavyJobSecrets(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +52,7 @@ internal static DataBoxHeavyJobSecrets DeserializeDataBoxHeavyJobSecrets(JsonEle DataBoxOrderType jobSecretsType = default; Optional dcAccessSecurityCode = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cabinetPodSecrets"u8)) @@ -63,8 +92,61 @@ internal static DataBoxHeavyJobSecrets DeserializeDataBoxHeavyJobSecrets(JsonEle error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxHeavyJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(cabinetPodSecrets)); + return new DataBoxHeavyJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(cabinetPodSecrets), serializedAdditionalRawData); + } + + DataBoxHeavyJobSecrets IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxHeavyJobSecrets(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxHeavyJobSecrets IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxHeavyJobSecrets(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxHeavyJobSecrets model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxHeavyJobSecrets(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxHeavyJobSecrets(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.cs index 355b042138a4..475bf9acd0b8 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavyJobSecrets.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,19 +15,20 @@ namespace Azure.ResourceManager.DataBox.Models /// The secrets related to a databox heavy job. public partial class DataBoxHeavyJobSecrets : JobSecrets { - /// Initializes a new instance of DataBoxHeavyJobSecrets. + /// Initializes a new instance of . internal DataBoxHeavyJobSecrets() { CabinetPodSecrets = new ChangeTrackingList(); JobSecretsType = DataBoxOrderType.DataBoxHeavy; } - /// Initializes a new instance of DataBoxHeavyJobSecrets. + /// Initializes a new instance of . /// Used to indicate what type of job secrets object. /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secret objects for a databox heavy job. - internal DataBoxHeavyJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList cabinetPodSecrets) : base(jobSecretsType, dataCenterAccessSecurityCode, error) + /// Keeps track of any properties unknown to the library. + internal DataBoxHeavyJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList cabinetPodSecrets, Dictionary serializedAdditionalRawData) : base(jobSecretsType, dataCenterAccessSecurityCode, error, serializedAdditionalRawData) { CabinetPodSecrets = cabinetPodSecrets; JobSecretsType = jobSecretsType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.Serialization.cs index 7fe95b37f5d3..69df567ce7d6 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxHeavySecret + public partial class DataBoxHeavySecret : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxHeavySecret DeserializeDataBoxHeavySecret(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxHeavySecret DeserializeDataBoxHeavySecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static DataBoxHeavySecret DeserializeDataBoxHeavySecret(JsonElement ele Optional> networkConfigurations = default; Optional encodedValidationCertPubKey = default; Optional> accountCredentialDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deviceSerialNumber"u8)) @@ -69,8 +97,61 @@ internal static DataBoxHeavySecret DeserializeDataBoxHeavySecret(JsonElement ele accountCredentialDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxHeavySecret(deviceSerialNumber.Value, devicePassword.Value, Optional.ToList(networkConfigurations), encodedValidationCertPubKey.Value, Optional.ToList(accountCredentialDetails)); + return new DataBoxHeavySecret(deviceSerialNumber.Value, devicePassword.Value, Optional.ToList(networkConfigurations), encodedValidationCertPubKey.Value, Optional.ToList(accountCredentialDetails), serializedAdditionalRawData); + } + + DataBoxHeavySecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxHeavySecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxHeavySecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxHeavySecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxHeavySecret model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxHeavySecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxHeavySecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.cs index 2400c8febce7..0ba6bb6d3ca3 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxHeavySecret.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.ResourceManager.DataBox.Models /// The secrets related to a databox heavy. public partial class DataBoxHeavySecret { - /// Initializes a new instance of DataBoxHeavySecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxHeavySecret() { NetworkConfigurations = new ChangeTrackingList(); AccountCredentialDetails = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxHeavySecret. + /// Initializes a new instance of . /// Serial number of the assigned device. /// Password for out of the box experience on device. /// Network configuration of the appliance. /// The base 64 encoded public key to authenticate with the device. /// Per account level access credentials. - internal DataBoxHeavySecret(string deviceSerialNumber, string devicePassword, IReadOnlyList networkConfigurations, string encodedValidationCertPubKey, IReadOnlyList accountCredentialDetails) + /// Keeps track of any properties unknown to the library. + internal DataBoxHeavySecret(string deviceSerialNumber, string devicePassword, IReadOnlyList networkConfigurations, string encodedValidationCertPubKey, IReadOnlyList accountCredentialDetails, Dictionary serializedAdditionalRawData) { DeviceSerialNumber = deviceSerialNumber; DevicePassword = devicePassword; NetworkConfigurations = networkConfigurations; EncodedValidationCertPubKey = encodedValidationCertPubKey; AccountCredentialDetails = accountCredentialDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Serial number of the assigned device. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.Serialization.cs index 225944606508..0f76416f25b0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxJobCancellationReason : IUtf8JsonSerializable + public partial class DataBoxJobCancellationReason : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("reason"u8); writer.WriteStringValue(Reason); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxJobCancellationReason DeserializeDataBoxJobCancellationReason(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string reason = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxJobCancellationReason(reason, serializedAdditionalRawData); + } + + DataBoxJobCancellationReason IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxJobCancellationReason(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxJobCancellationReason IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxJobCancellationReason(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxJobCancellationReason model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxJobCancellationReason(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxJobCancellationReason(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.cs index 4890c1d8cc94..5a7e9b791189 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobCancellationReason.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Reason for cancellation. public partial class DataBoxJobCancellationReason { - /// Initializes a new instance of DataBoxJobCancellationReason. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Reason for cancellation. /// is null. public DataBoxJobCancellationReason(string reason) @@ -23,6 +27,20 @@ public DataBoxJobCancellationReason(string reason) Reason = reason; } + /// Initializes a new instance of . + /// Reason for cancellation. + /// Keeps track of any properties unknown to the library. + internal DataBoxJobCancellationReason(string reason, Dictionary serializedAdditionalRawData) + { + Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxJobCancellationReason() + { + } + /// Reason for cancellation. public string Reason { get; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobData.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobData.Serialization.cs index 73afdc68ec75..31c2a2f82c09 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobData.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobData.Serialization.cs @@ -10,18 +10,30 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBox.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBox { - public partial class DataBoxJobData : IUtf8JsonSerializable + public partial class DataBoxJobData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -47,7 +59,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Details)) { writer.WritePropertyName("details"u8); - writer.WriteObjectValue(Details); + if (Details is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Details).Serialize(writer, options); + } } if (Optional.IsDefined(DeliveryType)) { @@ -57,14 +76,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DeliveryInfo)) { writer.WritePropertyName("deliveryInfo"u8); - writer.WriteObjectValue(DeliveryInfo); + if (DeliveryInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeliveryInfo).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxJobData DeserializeDataBoxJobData(JsonElement element) + internal static DataBoxJobData DeserializeDataBoxJobData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -92,6 +132,7 @@ internal static DataBoxJobData DeserializeDataBoxJobData(JsonElement element) Optional deliveryType = default; Optional deliveryInfo = default; Optional isCancellableWithoutFee = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -290,8 +331,61 @@ internal static DataBoxJobData DeserializeDataBoxJobData(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxJobData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, transferType, Optional.ToNullable(isCancellable), Optional.ToNullable(isDeletable), Optional.ToNullable(isShippingAddressEditable), Optional.ToNullable(reverseShippingDetailsUpdate), Optional.ToNullable(reverseTransportPreferenceUpdate), Optional.ToNullable(isPrepareToShipEnabled), Optional.ToNullable(status), Optional.ToNullable(startTime), error.Value, details.Value, cancellationReason.Value, Optional.ToNullable(deliveryType), deliveryInfo.Value, Optional.ToNullable(isCancellableWithoutFee), sku, identity, serializedAdditionalRawData); + } + + DataBoxJobData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxJobData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxJobData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxJobData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxJobData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxJobData(Response response) + { + if (response is null) + { + return null; } - return new DataBoxJobData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, transferType, Optional.ToNullable(isCancellable), Optional.ToNullable(isDeletable), Optional.ToNullable(isShippingAddressEditable), Optional.ToNullable(reverseShippingDetailsUpdate), Optional.ToNullable(reverseTransportPreferenceUpdate), Optional.ToNullable(isPrepareToShipEnabled), Optional.ToNullable(status), Optional.ToNullable(startTime), error.Value, details.Value, cancellationReason.Value, Optional.ToNullable(deliveryType), deliveryInfo.Value, Optional.ToNullable(isCancellableWithoutFee), sku, identity); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxJobData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.Serialization.cs index 20f6b29f46cc..1a2867c6ba6e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxJobDetails : IUtf8JsonSerializable + public partial class DataBoxJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DevicePassword)) { @@ -22,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DevicePassword); } writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataImportDetails)) { @@ -34,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -44,7 +72,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,28 +88,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ExpectedDataSizeInTerabytes)) { writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxJobDetails DeserializeDataBoxJobDetails(JsonElement element) + internal static DataBoxJobDetails DeserializeDataBoxJobDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,6 +171,7 @@ internal static DataBoxJobDetails DeserializeDataBoxJobDetails(JsonElement eleme Optional lastMitigationActionOnJob = default; Optional dataCenterAddress = default; Optional dataCenterCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("copyProgress"u8)) @@ -311,8 +382,61 @@ internal static DataBoxJobDetails DeserializeDataBoxJobDetails(JsonElement eleme dataCenterCode = new DataCenterCode(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToList(copyProgress), devicePassword.Value, serializedAdditionalRawData); + } + + DataBoxJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxJobDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxJobDetails model) + { + if (model is null) + { + return null; } - return new DataBoxJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode), Optional.ToList(copyProgress), devicePassword.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxJobDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxJobDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.cs index 45bc5bdfe290..43f68c23e444 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobDetails.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Databox Job Details. public partial class DataBoxJobDetails : DataBoxBasicJobDetails { - /// Initializes a new instance of DataBoxJobDetails. + /// Initializes a new instance of . /// Contact details for notification and shipping. /// is null. public DataBoxJobDetails(DataBoxContactDetails contactDetails) : base(contactDetails) @@ -25,7 +25,7 @@ public DataBoxJobDetails(DataBoxContactDetails contactDetails) : base(contactDet JobDetailsType = DataBoxOrderType.DataBox; } - /// Initializes a new instance of DataBoxJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -56,13 +56,19 @@ public DataBoxJobDetails(DataBoxContactDetails contactDetails) : base(contactDet /// DataCenter code. /// Copy progress per storage account. /// Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. - internal DataBoxJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IReadOnlyList copyProgress, string devicePassword) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode) + /// Keeps track of any properties unknown to the library. + internal DataBoxJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, IReadOnlyList copyProgress, string devicePassword, Dictionary serializedAdditionalRawData) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, serializedAdditionalRawData) { CopyProgress = copyProgress; DevicePassword = devicePassword; JobDetailsType = jobDetailsType; } + /// Initializes a new instance of for deserialization. + internal DataBoxJobDetails() + { + } + /// Copy progress per storage account. public IReadOnlyList CopyProgress { get; } /// Set Device password for unlocking Databox. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.Serialization.cs index d96af1b5ad58..a81b38cbc283 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBox; namespace Azure.ResourceManager.DataBox.Models { - internal partial class DataBoxJobListResult + internal partial class DataBoxJobListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxJobListResult DeserializeDataBoxJobListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxJobListResult DeserializeDataBoxJobListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DataBoxJobListResult DeserializeDataBoxJobListResult(JsonElement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxJobListResult(Optional.ToList(value), nextLink.Value); + return new DataBoxJobListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DataBoxJobListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxJobListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxJobListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxJobListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxJobListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxJobListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxJobListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.cs index 82c99869d8d0..884c475e994e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBox; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBox.Models /// Job Resource Collection. internal partial class DataBoxJobListResult { - /// Initializes a new instance of DataBoxJobListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxJobListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxJobListResult. + /// Initializes a new instance of . /// List of job resources. /// Link for the next set of job resources. - internal DataBoxJobListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataBoxJobListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of job resources. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.Serialization.cs index 1a6f7c91c8dd..2361f21e8e7d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxJobPatch : IUtf8JsonSerializable + public partial class DataBoxJobPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,10 +45,144 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Details)) { writer.WritePropertyName("details"u8); - writer.WriteObjectValue(Details); + if (Details is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Details).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxJobPatch DeserializeDataBoxJobPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional details = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("details"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + details = UpdateJobDetails.DeserializeUpdateJobDetails(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxJobPatch(Optional.ToDictionary(tags), identity, details.Value, serializedAdditionalRawData); + } + + DataBoxJobPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxJobPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxJobPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxJobPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxJobPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxJobPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxJobPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.cs index fcd1e408a3ef..168de872c395 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,28 @@ namespace Azure.ResourceManager.DataBox.Models /// The JobResourceUpdateParameter. public partial class DataBoxJobPatch { - /// Initializes a new instance of DataBoxJobPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxJobPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). + /// Msi identity of the resource. + /// Details of a job to be updated. + /// Keeps track of any properties unknown to the library. + internal DataBoxJobPatch(IDictionary tags, ManagedServiceIdentity identity, UpdateJobDetails details, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + Details = details; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). public IDictionary Tags { get; } /// Msi identity of the resource. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.Serialization.cs index 9883b2f03763..92b0a0b66e98 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxJobStage + public partial class DataBoxJobStage : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxJobStage DeserializeDataBoxJobStage(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxJobStage DeserializeDataBoxJobStage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static DataBoxJobStage DeserializeDataBoxJobStage(JsonElement element) Optional stageStatus = default; Optional stageTime = default; Optional jobStageDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("stageName"u8)) @@ -67,8 +95,61 @@ internal static DataBoxJobStage DeserializeDataBoxJobStage(JsonElement element) jobStageDetails = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxJobStage(Optional.ToNullable(stageName), displayName.Value, Optional.ToNullable(stageStatus), Optional.ToNullable(stageTime), jobStageDetails.Value); + return new DataBoxJobStage(Optional.ToNullable(stageName), displayName.Value, Optional.ToNullable(stageStatus), Optional.ToNullable(stageTime), jobStageDetails.Value, serializedAdditionalRawData); + } + + DataBoxJobStage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxJobStage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxJobStage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxJobStage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxJobStage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxJobStage(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxJobStage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.cs index a370c8064b1a..8bbaed96431d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxJobStage.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models { /// Job stages. public partial class DataBoxJobStage { - /// Initializes a new instance of DataBoxJobStage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxJobStage() { } - /// Initializes a new instance of DataBoxJobStage. + /// Initializes a new instance of . /// Name of the job stage. /// Display name of the job stage. /// Status of the job stage. /// Time for the job stage in UTC ISO 8601 format. /// Job Stage Details. - internal DataBoxJobStage(DataBoxStageName? stageName, string displayName, DataBoxStageStatus? stageStatus, DateTimeOffset? stageTime, BinaryData jobStageDetails) + /// Keeps track of any properties unknown to the library. + internal DataBoxJobStage(DataBoxStageName? stageName, string displayName, DataBoxStageStatus? stageStatus, DateTimeOffset? stageTime, BinaryData jobStageDetails, Dictionary serializedAdditionalRawData) { StageName = stageName; DisplayName = displayName; StageStatus = stageStatus; StageTime = stageTime; JobStageDetails = jobStageDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the job stage. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.Serialization.cs index 8598faba66ee..b1e3b2b7ef76 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.Serialization.cs @@ -6,22 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxKeyEncryptionKey : IUtf8JsonSerializable + public partial class DataBoxKeyEncryptionKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kekType"u8); writer.WriteStringValue(KekType.ToSerialString()); if (Optional.IsDefined(ManagedIdentity)) { writer.WritePropertyName("identityProperties"u8); - writer.WriteObjectValue(ManagedIdentity); + if (ManagedIdentity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedIdentity).Serialize(writer, options); + } } if (Optional.IsDefined(KekUri)) { @@ -33,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("kekVaultResourceID"u8); writer.WriteStringValue(KekVaultResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxKeyEncryptionKey DeserializeDataBoxKeyEncryptionKey(JsonElement element) + internal static DataBoxKeyEncryptionKey DeserializeDataBoxKeyEncryptionKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +74,7 @@ internal static DataBoxKeyEncryptionKey DeserializeDataBoxKeyEncryptionKey(JsonE Optional identityProperties = default; Optional kekUrl = default; Optional kekVaultResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kekType"u8)) @@ -80,8 +109,61 @@ internal static DataBoxKeyEncryptionKey DeserializeDataBoxKeyEncryptionKey(JsonE kekVaultResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxKeyEncryptionKey(kekType, identityProperties.Value, kekUrl.Value, kekVaultResourceId.Value, serializedAdditionalRawData); + } + + DataBoxKeyEncryptionKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxKeyEncryptionKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxKeyEncryptionKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxKeyEncryptionKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxKeyEncryptionKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxKeyEncryptionKey(Response response) + { + if (response is null) + { + return null; } - return new DataBoxKeyEncryptionKey(kekType, identityProperties.Value, kekUrl.Value, kekVaultResourceId.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxKeyEncryptionKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.cs index 995ccf373624..9d08b239c670 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxKeyEncryptionKey.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,24 +14,34 @@ namespace Azure.ResourceManager.DataBox.Models /// Encryption key containing details about key to encrypt different keys. public partial class DataBoxKeyEncryptionKey { - /// Initializes a new instance of DataBoxKeyEncryptionKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of encryption key used for key encryption. public DataBoxKeyEncryptionKey(DataBoxKeyEncryptionKeyType kekType) { KekType = kekType; } - /// Initializes a new instance of DataBoxKeyEncryptionKey. + /// Initializes a new instance of . /// Type of encryption key used for key encryption. /// Managed identity properties used for key encryption. /// Key encryption key. It is required in case of Customer managed KekType. /// Kek vault resource id. It is required in case of Customer managed KekType. - internal DataBoxKeyEncryptionKey(DataBoxKeyEncryptionKeyType kekType, DataBoxManagedIdentity managedIdentity, Uri kekUri, ResourceIdentifier kekVaultResourceId) + /// Keeps track of any properties unknown to the library. + internal DataBoxKeyEncryptionKey(DataBoxKeyEncryptionKeyType kekType, DataBoxManagedIdentity managedIdentity, Uri kekUri, ResourceIdentifier kekVaultResourceId, Dictionary serializedAdditionalRawData) { KekType = kekType; ManagedIdentity = managedIdentity; KekUri = kekUri; KekVaultResourceId = kekVaultResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxKeyEncryptionKey() + { } /// Type of encryption key used for key encryption. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.Serialization.cs index c3db6b9553d2..cec94bfb5182 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxManagedIdentity : IUtf8JsonSerializable + public partial class DataBoxManagedIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IdentityType)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UserAssigned)) { writer.WritePropertyName("userAssigned"u8); - writer.WriteObjectValue(UserAssigned); + if (UserAssigned is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserAssigned).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataBoxManagedIdentity DeserializeDataBoxManagedIdentity(JsonElement element) + internal static DataBoxManagedIdentity DeserializeDataBoxManagedIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional userAssigned = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -52,8 +82,61 @@ internal static DataBoxManagedIdentity DeserializeDataBoxManagedIdentity(JsonEle userAssigned = DataBoxUserAssignedIdentity.DeserializeDataBoxUserAssignedIdentity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxManagedIdentity(type.Value, userAssigned.Value, serializedAdditionalRawData); + } + + DataBoxManagedIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxManagedIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxManagedIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxManagedIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxManagedIdentity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxManagedIdentity(Response response) + { + if (response is null) + { + return null; } - return new DataBoxManagedIdentity(type.Value, userAssigned.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxManagedIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.cs index 6ad1edd1ce56..e545073b82b5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxManagedIdentity.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataBox.Models /// Managed identity properties. public partial class DataBoxManagedIdentity { - /// Initializes a new instance of DataBoxManagedIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxManagedIdentity() { } - /// Initializes a new instance of DataBoxManagedIdentity. + /// Initializes a new instance of . /// Managed service identity type. /// User assigned identity properties. - internal DataBoxManagedIdentity(string identityType, DataBoxUserAssignedIdentity userAssigned) + /// Keeps track of any properties unknown to the library. + internal DataBoxManagedIdentity(string identityType, DataBoxUserAssignedIdentity userAssigned, Dictionary serializedAdditionalRawData) { IdentityType = identityType; UserAssigned = userAssigned; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Managed service identity type. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.Serialization.cs index 6d30d6bfe227..55091c79b175 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxOrderPreferences : IUtf8JsonSerializable + public partial class DataBoxOrderPreferences : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(PreferredDataCenterRegion)) { @@ -29,17 +36,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TransportPreferences)) { writer.WritePropertyName("transportPreferences"u8); - writer.WriteObjectValue(TransportPreferences); + if (TransportPreferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransportPreferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseTransportPreferences)) { writer.WritePropertyName("reverseTransportPreferences"u8); - writer.WriteObjectValue(ReverseTransportPreferences); + if (ReverseTransportPreferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseTransportPreferences).Serialize(writer, options); + } } if (Optional.IsDefined(EncryptionPreferences)) { writer.WritePropertyName("encryptionPreferences"u8); - writer.WriteObjectValue(EncryptionPreferences); + if (EncryptionPreferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptionPreferences).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(StorageAccountAccessTierPreferences)) { @@ -51,11 +79,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxOrderPreferences DeserializeDataBoxOrderPreferences(JsonElement element) + internal static DataBoxOrderPreferences DeserializeDataBoxOrderPreferences(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -65,6 +107,7 @@ internal static DataBoxOrderPreferences DeserializeDataBoxOrderPreferences(JsonE Optional reverseTransportPreferences = default; Optional encryptionPreferences = default; Optional> storageAccountAccessTierPreferences = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("preferredDataCenterRegion"u8)) @@ -122,8 +165,61 @@ internal static DataBoxOrderPreferences DeserializeDataBoxOrderPreferences(JsonE storageAccountAccessTierPreferences = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxOrderPreferences(Optional.ToList(preferredDataCenterRegion), transportPreferences.Value, reverseTransportPreferences.Value, encryptionPreferences.Value, Optional.ToList(storageAccountAccessTierPreferences), serializedAdditionalRawData); + } + + DataBoxOrderPreferences IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxOrderPreferences(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxOrderPreferences IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxOrderPreferences(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxOrderPreferences model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxOrderPreferences(Response response) + { + if (response is null) + { + return null; } - return new DataBoxOrderPreferences(Optional.ToList(preferredDataCenterRegion), transportPreferences.Value, reverseTransportPreferences.Value, encryptionPreferences.Value, Optional.ToList(storageAccountAccessTierPreferences)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxOrderPreferences(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.cs index c972d9f7a5ff..190724e098ae 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxOrderPreferences.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.ResourceManager.DataBox.Models /// Preferences related to the order. public partial class DataBoxOrderPreferences { - /// Initializes a new instance of DataBoxOrderPreferences. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxOrderPreferences() { PreferredDataCenterRegion = new ChangeTrackingList(); StorageAccountAccessTierPreferences = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxOrderPreferences. + /// Initializes a new instance of . /// Preferred data center region. /// Preferences related to the shipment logistics of the sku. /// Optional Preferences related to the reverse shipment logistics of the sku. /// Preferences related to the Encryption. /// Preferences related to the Access Tier of storage accounts. - internal DataBoxOrderPreferences(IList preferredDataCenterRegion, TransportPreferences transportPreferences, TransportPreferences reverseTransportPreferences, DataBoxEncryptionPreferences encryptionPreferences, IList storageAccountAccessTierPreferences) + /// Keeps track of any properties unknown to the library. + internal DataBoxOrderPreferences(IList preferredDataCenterRegion, TransportPreferences transportPreferences, TransportPreferences reverseTransportPreferences, DataBoxEncryptionPreferences encryptionPreferences, IList storageAccountAccessTierPreferences, Dictionary serializedAdditionalRawData) { PreferredDataCenterRegion = preferredDataCenterRegion; TransportPreferences = transportPreferences; ReverseTransportPreferences = reverseTransportPreferences; EncryptionPreferences = encryptionPreferences; StorageAccountAccessTierPreferences = storageAccountAccessTierPreferences; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Preferred data center region. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.Serialization.cs index 2f1888542d81..310088697cfd 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxScheduleAvailabilityContent : IUtf8JsonSerializable + public partial class DataBoxScheduleAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageLocation"u8); writer.WriteStringValue(StorageLocation); @@ -24,7 +32,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("country"u8); writer.WriteStringValue(Country); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxScheduleAvailabilityContent DeserializeDataBoxScheduleAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation storageLocation = default; + DataBoxSkuName skuName = default; + Optional country = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageLocation"u8)) + { + storageLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxScheduleAvailabilityContent(storageLocation, skuName, country.Value, serializedAdditionalRawData); + } + + DataBoxScheduleAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxScheduleAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxScheduleAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxScheduleAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxScheduleAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxScheduleAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxScheduleAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.cs index af836fc3e178..af4f0bc4d5c5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxScheduleAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,11 +14,26 @@ namespace Azure.ResourceManager.DataBox.Models /// Request body to get the availability for scheduling data box orders orders. public partial class DataBoxScheduleAvailabilityContent : ScheduleAvailabilityContent { - /// Initializes a new instance of DataBoxScheduleAvailabilityContent. + /// Initializes a new instance of . /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. public DataBoxScheduleAvailabilityContent(AzureLocation storageLocation) : base(storageLocation) { SkuName = DataBoxSkuName.DataBox; } + + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Name for which the order is to be scheduled. + /// Country in which storage location should be supported. + /// Keeps track of any properties unknown to the library. + internal DataBoxScheduleAvailabilityContent(AzureLocation storageLocation, DataBoxSkuName skuName, string country, Dictionary serializedAdditionalRawData) : base(storageLocation, skuName, country, serializedAdditionalRawData) + { + SkuName = skuName; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxScheduleAvailabilityContent() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.Serialization.cs index db2d2d38466d..c674104b06a0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxSecret + public partial class DataBoxSecret : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxSecret DeserializeDataBoxSecret(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxSecret DeserializeDataBoxSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static DataBoxSecret DeserializeDataBoxSecret(JsonElement element) Optional> networkConfigurations = default; Optional encodedValidationCertPubKey = default; Optional> accountCredentialDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deviceSerialNumber"u8)) @@ -69,8 +97,61 @@ internal static DataBoxSecret DeserializeDataBoxSecret(JsonElement element) accountCredentialDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxSecret(deviceSerialNumber.Value, devicePassword.Value, Optional.ToList(networkConfigurations), encodedValidationCertPubKey.Value, Optional.ToList(accountCredentialDetails)); + return new DataBoxSecret(deviceSerialNumber.Value, devicePassword.Value, Optional.ToList(networkConfigurations), encodedValidationCertPubKey.Value, Optional.ToList(accountCredentialDetails), serializedAdditionalRawData); + } + + DataBoxSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxSecret model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.cs index 77c4d8377af9..8fe001131c0e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSecret.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,26 +14,31 @@ namespace Azure.ResourceManager.DataBox.Models /// The secrets related to a DataBox. public partial class DataBoxSecret { - /// Initializes a new instance of DataBoxSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxSecret() { NetworkConfigurations = new ChangeTrackingList(); AccountCredentialDetails = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxSecret. + /// Initializes a new instance of . /// Serial number of the assigned device. /// Password for out of the box experience on device. /// Network configuration of the appliance. /// The base 64 encoded public key to authenticate with the device. /// Per account level access credentials. - internal DataBoxSecret(string deviceSerialNumber, string devicePassword, IReadOnlyList networkConfigurations, string encodedValidationCertPubKey, IReadOnlyList accountCredentialDetails) + /// Keeps track of any properties unknown to the library. + internal DataBoxSecret(string deviceSerialNumber, string devicePassword, IReadOnlyList networkConfigurations, string encodedValidationCertPubKey, IReadOnlyList accountCredentialDetails, Dictionary serializedAdditionalRawData) { DeviceSerialNumber = deviceSerialNumber; DevicePassword = devicePassword; NetworkConfigurations = networkConfigurations; EncodedValidationCertPubKey = encodedValidationCertPubKey; AccountCredentialDetails = accountCredentialDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Serial number of the assigned device. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.Serialization.cs index 7d99e20c52c3..b192fbb0cd6d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.Serialization.cs @@ -6,21 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxShipmentPickUpResult + public partial class DataBoxShipmentPickUpResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxShipmentPickUpResult DeserializeDataBoxShipmentPickUpResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxShipmentPickUpResult DeserializeDataBoxShipmentPickUpResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional confirmationNumber = default; Optional readyByTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("confirmationNumber"u8)) @@ -37,8 +65,61 @@ internal static DataBoxShipmentPickUpResult DeserializeDataBoxShipmentPickUpResu readyByTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxShipmentPickUpResult(confirmationNumber.Value, Optional.ToNullable(readyByTime)); + return new DataBoxShipmentPickUpResult(confirmationNumber.Value, Optional.ToNullable(readyByTime), serializedAdditionalRawData); + } + + DataBoxShipmentPickUpResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxShipmentPickUpResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxShipmentPickUpResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxShipmentPickUpResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxShipmentPickUpResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxShipmentPickUpResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxShipmentPickUpResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.cs index 2d236a023a0f..6b78c9c9dcd1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShipmentPickUpResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models { /// Shipment pick up response. public partial class DataBoxShipmentPickUpResult { - /// Initializes a new instance of DataBoxShipmentPickUpResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxShipmentPickUpResult() { } - /// Initializes a new instance of DataBoxShipmentPickUpResult. + /// Initializes a new instance of . /// Confirmation number for the pick up request. /// Time by which shipment should be ready for pick up, this is in local time of pick up area. - internal DataBoxShipmentPickUpResult(string confirmationNumber, DateTimeOffset? readyBy) + /// Keeps track of any properties unknown to the library. + internal DataBoxShipmentPickUpResult(string confirmationNumber, DateTimeOffset? readyBy, Dictionary serializedAdditionalRawData) { ConfirmationNumber = confirmationNumber; ReadyBy = readyBy; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Confirmation number for the pick up request. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.Serialization.cs index 0b8d61b8afab..04e8435e9f07 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxShippingAddress : IUtf8JsonSerializable + public partial class DataBoxShippingAddress : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("streetAddress1"u8); writer.WriteStringValue(StreetAddress1); @@ -66,11 +74,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("taxIdentificationNumber"u8); writer.WriteStringValue(TaxIdentificationNumber); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxShippingAddress DeserializeDataBoxShippingAddress(JsonElement element) + internal static DataBoxShippingAddress DeserializeDataBoxShippingAddress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +109,7 @@ internal static DataBoxShippingAddress DeserializeDataBoxShippingAddress(JsonEle Optional addressType = default; Optional skipAddressValidation = default; Optional taxIdentificationNumber = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("streetAddress1"u8)) @@ -157,8 +180,61 @@ internal static DataBoxShippingAddress DeserializeDataBoxShippingAddress(JsonEle taxIdentificationNumber = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxShippingAddress(streetAddress1, streetAddress2.Value, streetAddress3.Value, city.Value, stateOrProvince.Value, country, postalCode, zipExtendedCode.Value, companyName.Value, Optional.ToNullable(addressType), Optional.ToNullable(skipAddressValidation), taxIdentificationNumber.Value, serializedAdditionalRawData); + } + + DataBoxShippingAddress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxShippingAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxShippingAddress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxShippingAddress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxShippingAddress model) + { + if (model is null) + { + return null; } - return new DataBoxShippingAddress(streetAddress1, streetAddress2.Value, streetAddress3.Value, city.Value, stateOrProvince.Value, country, postalCode, zipExtendedCode.Value, companyName.Value, Optional.ToNullable(addressType), Optional.ToNullable(skipAddressValidation), taxIdentificationNumber.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxShippingAddress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxShippingAddress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.cs index d076f8ed5072..0b786980f558 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxShippingAddress.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Shipping address where customer wishes to receive the device. public partial class DataBoxShippingAddress { - /// Initializes a new instance of DataBoxShippingAddress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Street Address line 1. /// Name of the Country. /// Postal code. @@ -29,7 +33,7 @@ public DataBoxShippingAddress(string streetAddress1, string country, string post PostalCode = postalCode; } - /// Initializes a new instance of DataBoxShippingAddress. + /// Initializes a new instance of . /// Street Address line 1. /// Street Address line 2. /// Street Address line 3. @@ -42,7 +46,8 @@ public DataBoxShippingAddress(string streetAddress1, string country, string post /// Type of address. /// Flag to indicate if customer has chosen to skip default address validation. /// Tax Identification Number. - internal DataBoxShippingAddress(string streetAddress1, string streetAddress2, string streetAddress3, string city, string stateOrProvince, string country, string postalCode, string zipExtendedCode, string companyName, DataBoxShippingAddressType? addressType, bool? skipAddressValidation, string taxIdentificationNumber) + /// Keeps track of any properties unknown to the library. + internal DataBoxShippingAddress(string streetAddress1, string streetAddress2, string streetAddress3, string city, string stateOrProvince, string country, string postalCode, string zipExtendedCode, string companyName, DataBoxShippingAddressType? addressType, bool? skipAddressValidation, string taxIdentificationNumber, Dictionary serializedAdditionalRawData) { StreetAddress1 = streetAddress1; StreetAddress2 = streetAddress2; @@ -56,6 +61,12 @@ internal DataBoxShippingAddress(string streetAddress1, string streetAddress2, st AddressType = addressType; SkipAddressValidation = skipAddressValidation; TaxIdentificationNumber = taxIdentificationNumber; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxShippingAddress() + { } /// Street Address line 1. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.Serialization.cs index cb0022ac6d02..da0272a3924e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxSku : IUtf8JsonSerializable + public partial class DataBoxSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToSerialString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("family"u8); writer.WriteStringValue(Family); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxSku DeserializeDataBoxSku(JsonElement element) + internal static DataBoxSku DeserializeDataBoxSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static DataBoxSku DeserializeDataBoxSku(JsonElement element) DataBoxSkuName name = default; Optional displayName = default; Optional family = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -56,8 +79,61 @@ internal static DataBoxSku DeserializeDataBoxSku(JsonElement element) family = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxSku(name, displayName.Value, family.Value, serializedAdditionalRawData); + } + + DataBoxSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxSku model) + { + if (model is null) + { + return null; } - return new DataBoxSku(name, displayName.Value, family.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.cs index 3939c50ad590..3eee3934a0b9 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSku.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// The Sku. public partial class DataBoxSku { - /// Initializes a new instance of DataBoxSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The sku name. public DataBoxSku(DataBoxSkuName name) { Name = name; } - /// Initializes a new instance of DataBoxSku. + /// Initializes a new instance of . /// The sku name. /// The display name of the sku. /// The sku family. - internal DataBoxSku(DataBoxSkuName name, string displayName, string family) + /// Keeps track of any properties unknown to the library. + internal DataBoxSku(DataBoxSkuName name, string displayName, string family, Dictionary serializedAdditionalRawData) { Name = name; DisplayName = displayName; Family = family; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxSku() + { } /// The sku name. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.Serialization.cs index 87bfdc4e24dc..a8ebf2cff8e4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxSkuCapacity + public partial class DataBoxSkuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxSkuCapacity DeserializeDataBoxSkuCapacity(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxSkuCapacity DeserializeDataBoxSkuCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional usable = default; Optional maximum = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("usable"u8)) @@ -32,8 +61,61 @@ internal static DataBoxSkuCapacity DeserializeDataBoxSkuCapacity(JsonElement ele maximum = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxSkuCapacity(usable.Value, maximum.Value); + return new DataBoxSkuCapacity(usable.Value, maximum.Value, serializedAdditionalRawData); + } + + DataBoxSkuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxSkuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxSkuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxSkuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxSkuCapacity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxSkuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxSkuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.cs index df93f58d8a11..429d49f7ca68 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCapacity.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Capacity of the sku. public partial class DataBoxSkuCapacity { - /// Initializes a new instance of DataBoxSkuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxSkuCapacity() { } - /// Initializes a new instance of DataBoxSkuCapacity. + /// Initializes a new instance of . /// Usable capacity in TB. /// Maximum capacity in TB. - internal DataBoxSkuCapacity(string usable, string maximum) + /// Keeps track of any properties unknown to the library. + internal DataBoxSkuCapacity(string usable, string maximum, Dictionary serializedAdditionalRawData) { Usable = usable; Maximum = maximum; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Usable capacity in TB. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.Serialization.cs index 1e8091cc38ed..eace67a29ef1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxSkuCost + public partial class DataBoxSkuCost : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxSkuCost DeserializeDataBoxSkuCost(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxSkuCost DeserializeDataBoxSkuCost(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static DataBoxSkuCost DeserializeDataBoxSkuCost(JsonElement element) Optional meterId = default; Optional meterType = default; Optional multiplier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterId"u8)) @@ -47,8 +75,61 @@ internal static DataBoxSkuCost DeserializeDataBoxSkuCost(JsonElement element) multiplier = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxSkuCost(Optional.ToNullable(meterId), meterType.Value, Optional.ToNullable(multiplier)); + return new DataBoxSkuCost(Optional.ToNullable(meterId), meterType.Value, Optional.ToNullable(multiplier), serializedAdditionalRawData); + } + + DataBoxSkuCost IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxSkuCost(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxSkuCost IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxSkuCost(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxSkuCost model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxSkuCost(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxSkuCost(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.cs index 3bdb282bd292..5f4341f3d310 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuCost.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models { /// Describes metadata for retrieving price info. public partial class DataBoxSkuCost { - /// Initializes a new instance of DataBoxSkuCost. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxSkuCost() { } - /// Initializes a new instance of DataBoxSkuCost. + /// Initializes a new instance of . /// Meter id of the Sku. /// The type of the meter. /// Multiplier specifies the region specific value to be multiplied with 1$ guid. Eg: Our new regions will be using 1$ shipping guid with appropriate multiplier specific to region. - internal DataBoxSkuCost(Guid? meterId, string meterType, double? multiplier) + /// Keeps track of any properties unknown to the library. + internal DataBoxSkuCost(Guid? meterId, string meterType, double? multiplier, Dictionary serializedAdditionalRawData) { MeterId = meterId; MeterType = meterType; Multiplier = multiplier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Meter id of the Sku. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.Serialization.cs index faba2aae9613..afd19f919023 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.Serialization.cs @@ -5,16 +5,46 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxSkuInformation + public partial class DataBoxSkuInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxSkuInformation DeserializeDataBoxSkuInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxSkuInformation DeserializeDataBoxSkuInformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +59,7 @@ internal static DataBoxSkuInformation DeserializeDataBoxSkuInformation(JsonEleme Optional disabledReasonMessage = default; Optional requiredFeature = default; Optional> countriesWithinCommerceBoundary = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -145,8 +176,61 @@ internal static DataBoxSkuInformation DeserializeDataBoxSkuInformation(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxSkuInformation(sku.Value, Optional.ToNullable(enabled), Optional.ToList(dataLocationToServiceLocationMap), capacity.Value, Optional.ToList(costs), Optional.ToList(apiVersions), Optional.ToNullable(disabledReason), disabledReasonMessage.Value, requiredFeature.Value, Optional.ToList(countriesWithinCommerceBoundary)); + return new DataBoxSkuInformation(sku.Value, Optional.ToNullable(enabled), Optional.ToList(dataLocationToServiceLocationMap), capacity.Value, Optional.ToList(costs), Optional.ToList(apiVersions), Optional.ToNullable(disabledReason), disabledReasonMessage.Value, requiredFeature.Value, Optional.ToList(countriesWithinCommerceBoundary), serializedAdditionalRawData); + } + + DataBoxSkuInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxSkuInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxSkuInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxSkuInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxSkuInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxSkuInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxSkuInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.cs index d7e2494f4f30..7bf7551b1858 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxSkuInformation.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Information of the sku. public partial class DataBoxSkuInformation { - /// Initializes a new instance of DataBoxSkuInformation. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxSkuInformation() { DataLocationToServiceLocationMap = new ChangeTrackingList(); @@ -22,7 +26,7 @@ internal DataBoxSkuInformation() CountriesWithinCommerceBoundary = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxSkuInformation. + /// Initializes a new instance of . /// The Sku. /// The sku is enabled or not. /// The map of data location to service location. @@ -33,7 +37,8 @@ internal DataBoxSkuInformation() /// Message for why the Sku is disabled. /// Required feature to access the sku. /// List of all the Countries in the SKU specific commerce boundary. - internal DataBoxSkuInformation(DataBoxSku sku, bool? isEnabled, IReadOnlyList dataLocationToServiceLocationMap, DataBoxSkuCapacity capacity, IReadOnlyList costs, IReadOnlyList apiVersions, SkuDisabledReason? disabledReason, string disabledReasonMessage, string requiredFeature, IReadOnlyList countriesWithinCommerceBoundary) + /// Keeps track of any properties unknown to the library. + internal DataBoxSkuInformation(DataBoxSku sku, bool? isEnabled, IReadOnlyList dataLocationToServiceLocationMap, DataBoxSkuCapacity capacity, IReadOnlyList costs, IReadOnlyList apiVersions, SkuDisabledReason? disabledReason, string disabledReasonMessage, string requiredFeature, IReadOnlyList countriesWithinCommerceBoundary, Dictionary serializedAdditionalRawData) { Sku = sku; IsEnabled = isEnabled; @@ -45,6 +50,7 @@ internal DataBoxSkuInformation(DataBoxSku sku, bool? isEnabled, IReadOnlyList The Sku. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.Serialization.cs index 51a7c138e764..5af86d1d2f3b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxStorageAccountDetails : IUtf8JsonSerializable + public partial class DataBoxStorageAccountDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageAccountId"u8); writer.WriteStringValue(StorageAccountId); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sharePassword"u8); writer.WriteStringValue(SharePassword); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxStorageAccountDetails DeserializeDataBoxStorageAccountDetails(JsonElement element) + internal static DataBoxStorageAccountDetails DeserializeDataBoxStorageAccountDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static DataBoxStorageAccountDetails DeserializeDataBoxStorageAccountDet ResourceIdentifier storageAccountId = default; DataAccountType dataAccountType = default; Optional sharePassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountId"u8)) @@ -53,8 +76,61 @@ internal static DataBoxStorageAccountDetails DeserializeDataBoxStorageAccountDet sharePassword = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxStorageAccountDetails(dataAccountType, sharePassword.Value, storageAccountId, serializedAdditionalRawData); + } + + DataBoxStorageAccountDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxStorageAccountDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxStorageAccountDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxStorageAccountDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxStorageAccountDetails model) + { + if (model is null) + { + return null; } - return new DataBoxStorageAccountDetails(dataAccountType, sharePassword.Value, storageAccountId); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxStorageAccountDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxStorageAccountDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.cs index 58d83772bc95..4fd4b6c7d049 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxStorageAccountDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Details for the storage account. public partial class DataBoxStorageAccountDetails : DataAccountDetails { - /// Initializes a new instance of DataBoxStorageAccountDetails. + /// Initializes a new instance of . /// Storage Account Resource Id. /// is null. public DataBoxStorageAccountDetails(ResourceIdentifier storageAccountId) @@ -24,16 +25,22 @@ public DataBoxStorageAccountDetails(ResourceIdentifier storageAccountId) DataAccountType = DataAccountType.StorageAccount; } - /// Initializes a new instance of DataBoxStorageAccountDetails. + /// Initializes a new instance of . /// Account Type of the data to be transferred. /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. /// Storage Account Resource Id. - internal DataBoxStorageAccountDetails(DataAccountType dataAccountType, string sharePassword, ResourceIdentifier storageAccountId) : base(dataAccountType, sharePassword) + /// Keeps track of any properties unknown to the library. + internal DataBoxStorageAccountDetails(DataAccountType dataAccountType, string sharePassword, ResourceIdentifier storageAccountId, Dictionary serializedAdditionalRawData) : base(dataAccountType, sharePassword, serializedAdditionalRawData) { StorageAccountId = storageAccountId; DataAccountType = dataAccountType; } + /// Initializes a new instance of for deserialization. + internal DataBoxStorageAccountDetails() + { + } + /// Storage Account Resource Id. public ResourceIdentifier StorageAccountId { get; set; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.Serialization.cs index 150cf9ca6c98..483f5d41a32f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class DataBoxUserAssignedIdentity : IUtf8JsonSerializable + internal partial class DataBoxUserAssignedIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResourceId)) { writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxUserAssignedIdentity DeserializeDataBoxUserAssignedIdentity(JsonElement element) + internal static DataBoxUserAssignedIdentity DeserializeDataBoxUserAssignedIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional resourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -41,8 +64,61 @@ internal static DataBoxUserAssignedIdentity DeserializeDataBoxUserAssignedIdenti resourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxUserAssignedIdentity(resourceId.Value, serializedAdditionalRawData); + } + + DataBoxUserAssignedIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxUserAssignedIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxUserAssignedIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxUserAssignedIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxUserAssignedIdentity model) + { + if (model is null) + { + return null; } - return new DataBoxUserAssignedIdentity(resourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxUserAssignedIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxUserAssignedIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.cs index 27fe8756a541..698f818e4a54 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxUserAssignedIdentity.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.DataBox.Models /// User assigned identity properties. internal partial class DataBoxUserAssignedIdentity { - /// Initializes a new instance of DataBoxUserAssignedIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxUserAssignedIdentity() { } - /// Initializes a new instance of DataBoxUserAssignedIdentity. + /// Initializes a new instance of . /// Arm resource id for user assigned identity to be used to fetch MSI token. - internal DataBoxUserAssignedIdentity(ResourceIdentifier resourceId) + /// Keeps track of any properties unknown to the library. + internal DataBoxUserAssignedIdentity(ResourceIdentifier resourceId, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Arm resource id for user assigned identity to be used to fetch MSI token. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.Serialization.cs index dc29ecea7f00..cccd524b20b0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.Serialization.cs @@ -5,28 +5,158 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxValidateAddressContent : IUtf8JsonSerializable + public partial class DataBoxValidateAddressContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } writer.WritePropertyName("deviceType"u8); writer.WriteStringValue(DeviceType.ToSerialString()); if (Optional.IsDefined(TransportPreferences)) { writer.WritePropertyName("transportPreferences"u8); - writer.WriteObjectValue(TransportPreferences); + if (TransportPreferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransportPreferences).Serialize(writer, options); + } } writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxValidateAddressContent DeserializeDataBoxValidateAddressContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataBoxShippingAddress shippingAddress = default; + DataBoxSkuName deviceType = default; + Optional transportPreferences = default; + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("shippingAddress"u8)) + { + shippingAddress = DataBoxShippingAddress.DeserializeDataBoxShippingAddress(property.Value); + continue; + } + if (property.NameEquals("deviceType"u8)) + { + deviceType = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("transportPreferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transportPreferences = TransportPreferences.DeserializeTransportPreferences(property.Value); + continue; + } + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxValidateAddressContent(validationType, shippingAddress, deviceType, transportPreferences.Value, serializedAdditionalRawData); + } + + DataBoxValidateAddressContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxValidateAddressContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxValidateAddressContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxValidateAddressContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxValidateAddressContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxValidateAddressContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxValidateAddressContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.cs index 83a7ff9462c1..9f0b1d46ed00 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidateAddressContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// The requirements to validate customer address where the device needs to be shipped. public partial class DataBoxValidateAddressContent : DataBoxValidationInputContent { - /// Initializes a new instance of DataBoxValidateAddressContent. + /// Initializes a new instance of . /// Shipping address of the customer. /// Device type to be used for the job. /// is null. @@ -26,6 +27,25 @@ public DataBoxValidateAddressContent(DataBoxShippingAddress shippingAddress, Dat ValidationType = DataBoxValidationInputDiscriminator.ValidateAddress; } + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// Shipping address of the customer. + /// Device type to be used for the job. + /// Preferences related to the shipment logistics of the sku. + /// Keeps track of any properties unknown to the library. + internal DataBoxValidateAddressContent(DataBoxValidationInputDiscriminator validationType, DataBoxShippingAddress shippingAddress, DataBoxSkuName deviceType, TransportPreferences transportPreferences, Dictionary serializedAdditionalRawData) : base(validationType, serializedAdditionalRawData) + { + ShippingAddress = shippingAddress; + DeviceType = deviceType; + TransportPreferences = transportPreferences; + ValidationType = validationType; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxValidateAddressContent() + { + } + /// Shipping address of the customer. public DataBoxShippingAddress ShippingAddress { get; } /// Device type to be used for the job. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.Serialization.cs index 4668313a2747..8eea425806f9 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxValidationContent : IUtf8JsonSerializable + public partial class DataBoxValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("validationCategory"u8); writer.WriteStringValue(ValidationCategory.ToString()); @@ -21,10 +29,123 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IndividualRequestDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxValidationContent DeserializeDataBoxValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("validationCategory", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "JobCreationValidation": return CreateJobValidationContent.DeserializeCreateJobValidationContent(element); + } + } + + // Unknown type found so we will deserialize the base properties only + DataBoxValidationCategory validationCategory = default; + IList individualRequestDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validationCategory"u8)) + { + validationCategory = new DataBoxValidationCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("individualRequestDetails"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataBoxValidationInputContent.DeserializeDataBoxValidationInputContent(item)); + } + individualRequestDetails = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Models.DataBoxValidationContent(validationCategory, individualRequestDetails, serializedAdditionalRawData); + } + + DataBoxValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.cs index d197941a6736..e9f12c17f21a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationContent.cs @@ -19,7 +19,10 @@ namespace Azure.ResourceManager.DataBox.Models /// public abstract partial class DataBoxValidationContent { - /// Initializes a new instance of DataBoxValidationContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// List of request details contain validationType and its request as key and value respectively. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -33,6 +36,26 @@ protected DataBoxValidationContent(IEnumerable in IndividualRequestDetails = individualRequestDetails.ToList(); } + /// Initializes a new instance of . + /// Identify the nature of validation. + /// + /// List of request details contain validationType and its request as key and value respectively. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal DataBoxValidationContent(DataBoxValidationCategory validationCategory, IList individualRequestDetails, Dictionary serializedAdditionalRawData) + { + ValidationCategory = validationCategory; + IndividualRequestDetails = individualRequestDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxValidationContent() + { + } + /// Identify the nature of validation. internal DataBoxValidationCategory ValidationCategory { get; set; } /// diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.Serialization.cs index dec263c28c7c..baf3835ee202 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.Serialization.cs @@ -5,19 +5,127 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxValidationInputContent : IUtf8JsonSerializable + public partial class DataBoxValidationInputContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxValidationInputContent DeserializeDataBoxValidationInputContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("validationType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ValidateCreateOrderLimit": return CreateOrderLimitForSubscriptionValidationContent.DeserializeCreateOrderLimitForSubscriptionValidationContent(element); + case "ValidateDataTransferDetails": return DataTransferDetailsValidationContent.DeserializeDataTransferDetailsValidationContent(element); + case "ValidatePreferences": return PreferencesValidationContent.DeserializePreferencesValidationContent(element); + case "ValidateSkuAvailability": return SkuAvailabilityValidationContent.DeserializeSkuAvailabilityValidationContent(element); + case "ValidateSubscriptionIsAllowedToCreateJob": return SubscriptionIsAllowedToCreateJobValidationContent.DeserializeSubscriptionIsAllowedToCreateJobValidationContent(element); + case "ValidateAddress": return DataBoxValidateAddressContent.DeserializeDataBoxValidateAddressContent(element); + } + } + + // Unknown type found so we will deserialize the base properties only + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Models.DataBoxValidationInputContent(validationType, serializedAdditionalRawData); + } + + DataBoxValidationInputContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxValidationInputContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxValidationInputContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxValidationInputContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxValidationInputContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxValidationInputContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxValidationInputContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.cs index 197c94d6417e..12476911ca15 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputContent.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// @@ -14,11 +17,23 @@ namespace Azure.ResourceManager.DataBox.Models /// public abstract partial class DataBoxValidationInputContent { - /// Initializes a new instance of DataBoxValidationInputContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DataBoxValidationInputContent() { } + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// Keeps track of any properties unknown to the library. + internal DataBoxValidationInputContent(DataBoxValidationInputDiscriminator validationType, Dictionary serializedAdditionalRawData) + { + ValidationType = validationType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Identifies the type of validation request. internal DataBoxValidationInputDiscriminator ValidationType { get; set; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.Serialization.cs index a25d0f472b68..c5dfbfd9dc05 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.Serialization.cs @@ -5,14 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxValidationInputResult + public partial class DataBoxValidationInputResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxValidationInputResult DeserializeDataBoxValidationInputResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxValidationInputResult DeserializeDataBoxValidationInputResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,7 +60,82 @@ internal static DataBoxValidationInputResult DeserializeDataBoxValidationInputRe case "ValidateAddress": return AddressValidationResult.DeserializeAddressValidationResult(element); } } - return UnknownValidationInputResponse.DeserializeUnknownValidationInputResponse(element); + + // Unknown type found so we will deserialize the base properties only + DataBoxValidationInputDiscriminator validationType = default; + Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownValidationInputResponse(validationType, error.Value, serializedAdditionalRawData); + } + + DataBoxValidationInputResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxValidationInputResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxValidationInputResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxValidationInputResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxValidationInputResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxValidationInputResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxValidationInputResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.cs index 96bfec752eb5..393dff514da4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationInputResult.cs @@ -5,7 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { @@ -14,20 +17,26 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , and . /// + [DeserializationProxy(typeof(UnknownValidationInputResponse))] public abstract partial class DataBoxValidationInputResult { - /// Initializes a new instance of DataBoxValidationInputResult. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DataBoxValidationInputResult() { } - /// Initializes a new instance of DataBoxValidationInputResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. - internal DataBoxValidationInputResult(DataBoxValidationInputDiscriminator validationType, ResponseError error) + /// Keeps track of any properties unknown to the library. + internal DataBoxValidationInputResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, Dictionary serializedAdditionalRawData) { ValidationType = validationType; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Identifies the type of validation response. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.Serialization.cs index 442604ce6eb3..dd1aefa23a33 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.Serialization.cs @@ -5,22 +5,53 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataBoxValidationResult + public partial class DataBoxValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxValidationResult DeserializeDataBoxValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxValidationResult DeserializeDataBoxValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional> individualResponseDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -58,8 +89,61 @@ internal static DataBoxValidationResult DeserializeDataBoxValidationResult(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxValidationResult(Optional.ToNullable(status), Optional.ToList(individualResponseDetails)); + return new DataBoxValidationResult(Optional.ToNullable(status), Optional.ToList(individualResponseDetails), serializedAdditionalRawData); + } + + DataBoxValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.cs index 5b8ae793dc34..782ceaf2a4e7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataBoxValidationResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.DataBox.Models /// Response of pre job creation validations. public partial class DataBoxValidationResult { - /// Initializes a new instance of DataBoxValidationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxValidationResult() { IndividualResponseDetails = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxValidationResult. + /// Initializes a new instance of . /// Overall validation status. /// /// List of response details contain validationType and its response as key and value respectively. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , , , and . /// - internal DataBoxValidationResult(OverallValidationStatus? status, IReadOnlyList individualResponseDetails) + /// Keeps track of any properties unknown to the library. + internal DataBoxValidationResult(OverallValidationStatus? status, IReadOnlyList individualResponseDetails, Dictionary serializedAdditionalRawData) { Status = status; IndividualResponseDetails = individualResponseDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Overall validation status. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.Serialization.cs index 4a25768bb901..61df8048c720 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataCenterAccessSecurityCode + public partial class DataCenterAccessSecurityCode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataCenterAccessSecurityCode DeserializeDataCenterAccessSecurityCode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ReverseDataCenterAccessCode)) + { + writer.WritePropertyName("reverseDCAccessCode"u8); + writer.WriteStringValue(ReverseDataCenterAccessCode); + } + if (Optional.IsDefined(ForwardDataCenterAccessCode)) + { + writer.WritePropertyName("forwardDCAccessCode"u8); + writer.WriteStringValue(ForwardDataCenterAccessCode); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataCenterAccessSecurityCode DeserializeDataCenterAccessSecurityCode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional reverseDCAccessCode = default; Optional forwardDCAccessCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("reverseDCAccessCode"u8)) @@ -32,8 +71,61 @@ internal static DataCenterAccessSecurityCode DeserializeDataCenterAccessSecurity forwardDCAccessCode = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataCenterAccessSecurityCode(reverseDCAccessCode.Value, forwardDCAccessCode.Value); + return new DataCenterAccessSecurityCode(reverseDCAccessCode.Value, forwardDCAccessCode.Value, serializedAdditionalRawData); + } + + DataCenterAccessSecurityCode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataCenterAccessSecurityCode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataCenterAccessSecurityCode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataCenterAccessSecurityCode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataCenterAccessSecurityCode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataCenterAccessSecurityCode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataCenterAccessSecurityCode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.cs index ea8782d1b796..f86482c2abba 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAccessSecurityCode.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Dc access security code. public partial class DataCenterAccessSecurityCode { - /// Initializes a new instance of DataCenterAccessSecurityCode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataCenterAccessSecurityCode() { } - /// Initializes a new instance of DataCenterAccessSecurityCode. + /// Initializes a new instance of . /// Reverse Dc access security code. /// Forward Dc access security code. - internal DataCenterAccessSecurityCode(string reverseDataCenterAccessCode, string forwardDataCenterAccessCode) + /// Keeps track of any properties unknown to the library. + internal DataCenterAccessSecurityCode(string reverseDataCenterAccessCode, string forwardDataCenterAccessCode, Dictionary serializedAdditionalRawData) { ReverseDataCenterAccessCode = reverseDataCenterAccessCode; ForwardDataCenterAccessCode = forwardDataCenterAccessCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Reverse Dc access security code. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.Serialization.cs index 41b3af34aea9..3a1f4fb14451 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataCenterAddressContent : IUtf8JsonSerializable + public partial class DataCenterAddressContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageLocation"u8); writer.WriteStringValue(StorageLocation); writer.WritePropertyName("skuName"u8); writer.WriteStringValue(SkuName.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataCenterAddressContent DeserializeDataCenterAddressContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation storageLocation = default; + DataBoxSkuName skuName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageLocation"u8)) + { + storageLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataCenterAddressContent(storageLocation, skuName, serializedAdditionalRawData); + } + + DataCenterAddressContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataCenterAddressContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataCenterAddressContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataCenterAddressContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataCenterAddressContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataCenterAddressContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataCenterAddressContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.cs index 800ca7969853..fd86239ca54b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Request body to get the datacenter address. public partial class DataCenterAddressContent { - /// Initializes a new instance of DataCenterAddressContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. /// Sku Name for which the data center address requested. public DataCenterAddressContent(AzureLocation storageLocation, DataBoxSkuName skuName) @@ -21,6 +26,22 @@ public DataCenterAddressContent(AzureLocation storageLocation, DataBoxSkuName sk SkuName = skuName; } + /// Initializes a new instance of . + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Name for which the data center address requested. + /// Keeps track of any properties unknown to the library. + internal DataCenterAddressContent(AzureLocation storageLocation, DataBoxSkuName skuName, Dictionary serializedAdditionalRawData) + { + StorageLocation = storageLocation; + SkuName = skuName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataCenterAddressContent() + { + } + /// Storage location. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. public AzureLocation StorageLocation { get; } /// Sku Name for which the data center address requested. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.Serialization.cs index cc14823096db..2caa830b173e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataCenterAddressInstructionResult + public partial class DataCenterAddressInstructionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataCenterAddressInstructionResult DeserializeDataCenterAddressInstructionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("datacenterAddressType"u8); + writer.WriteStringValue(DataCenterAddressType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataCenterAddressInstructionResult DeserializeDataCenterAddressInstructionResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +52,7 @@ internal static DataCenterAddressInstructionResult DeserializeDataCenterAddressI DataCenterAddressType dataCenterAddressType = default; Optional> supportedCarriersForReturnShipment = default; Optional dataCenterAzureLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("communicationInstruction"u8)) @@ -58,8 +88,61 @@ internal static DataCenterAddressInstructionResult DeserializeDataCenterAddressI dataCenterAzureLocation = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataCenterAddressInstructionResult(dataCenterAddressType, Optional.ToList(supportedCarriersForReturnShipment), Optional.ToNullable(dataCenterAzureLocation), communicationInstruction.Value); + return new DataCenterAddressInstructionResult(dataCenterAddressType, Optional.ToList(supportedCarriersForReturnShipment), Optional.ToNullable(dataCenterAzureLocation), communicationInstruction.Value, serializedAdditionalRawData); + } + + DataCenterAddressInstructionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataCenterAddressInstructionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataCenterAddressInstructionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataCenterAddressInstructionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataCenterAddressInstructionResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataCenterAddressInstructionResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataCenterAddressInstructionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.cs index e56637490b26..d40bfb253d77 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressInstructionResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,18 +14,19 @@ namespace Azure.ResourceManager.DataBox.Models /// Datacenter instruction for given storage location. public partial class DataCenterAddressInstructionResult : DataCenterAddressResult { - /// Initializes a new instance of DataCenterAddressInstructionResult. + /// Initializes a new instance of . internal DataCenterAddressInstructionResult() { DataCenterAddressType = DataCenterAddressType.DataCenterAddressInstruction; } - /// Initializes a new instance of DataCenterAddressInstructionResult. + /// Initializes a new instance of . /// Data center address type. /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. /// Data center communication instruction. - internal DataCenterAddressInstructionResult(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation, string communicationInstruction) : base(dataCenterAddressType, supportedCarriersForReturnShipment, dataCenterAzureLocation) + /// Keeps track of any properties unknown to the library. + internal DataCenterAddressInstructionResult(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation, string communicationInstruction, Dictionary serializedAdditionalRawData) : base(dataCenterAddressType, supportedCarriersForReturnShipment, dataCenterAzureLocation, serializedAdditionalRawData) { CommunicationInstruction = communicationInstruction; DataCenterAddressType = dataCenterAddressType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.Serialization.cs index 9fcadd1321ed..86555687e0db 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataCenterAddressLocationResult + public partial class DataCenterAddressLocationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataCenterAddressLocationResult DeserializeDataCenterAddressLocationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("datacenterAddressType"u8); + writer.WriteStringValue(DataCenterAddressType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataCenterAddressLocationResult DeserializeDataCenterAddressLocationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static DataCenterAddressLocationResult DeserializeDataCenterAddressLoca DataCenterAddressType dataCenterAddressType = default; Optional> supportedCarriersForReturnShipment = default; Optional dataCenterAzureLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contactPersonName"u8)) @@ -130,8 +160,61 @@ internal static DataCenterAddressLocationResult DeserializeDataCenterAddressLoca dataCenterAzureLocation = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataCenterAddressLocationResult(dataCenterAddressType, Optional.ToList(supportedCarriersForReturnShipment), Optional.ToNullable(dataCenterAzureLocation), contactPersonName.Value, company.Value, street1.Value, street2.Value, street3.Value, city.Value, state.Value, zip.Value, country.Value, phone.Value, phoneExtension.Value, addressType.Value, additionalShippingInformation.Value); + return new DataCenterAddressLocationResult(dataCenterAddressType, Optional.ToList(supportedCarriersForReturnShipment), Optional.ToNullable(dataCenterAzureLocation), contactPersonName.Value, company.Value, street1.Value, street2.Value, street3.Value, city.Value, state.Value, zip.Value, country.Value, phone.Value, phoneExtension.Value, addressType.Value, additionalShippingInformation.Value, serializedAdditionalRawData); + } + + DataCenterAddressLocationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataCenterAddressLocationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataCenterAddressLocationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataCenterAddressLocationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataCenterAddressLocationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataCenterAddressLocationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataCenterAddressLocationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.cs index 37b8a9a4e487..bca9158d1d43 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressLocationResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,13 @@ namespace Azure.ResourceManager.DataBox.Models /// Datacenter address for given storage location. public partial class DataCenterAddressLocationResult : DataCenterAddressResult { - /// Initializes a new instance of DataCenterAddressLocationResult. + /// Initializes a new instance of . internal DataCenterAddressLocationResult() { DataCenterAddressType = DataCenterAddressType.DataCenterAddressLocation; } - /// Initializes a new instance of DataCenterAddressLocationResult. + /// Initializes a new instance of . /// Data center address type. /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. @@ -36,7 +37,8 @@ internal DataCenterAddressLocationResult() /// Phone extension. /// Address type. /// Special instruction for shipping. - internal DataCenterAddressLocationResult(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation, string contactPersonName, string company, string street1, string street2, string street3, string city, string state, string zip, string country, string phone, string phoneExtension, string addressType, string additionalShippingInformation) : base(dataCenterAddressType, supportedCarriersForReturnShipment, dataCenterAzureLocation) + /// Keeps track of any properties unknown to the library. + internal DataCenterAddressLocationResult(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation, string contactPersonName, string company, string street1, string street2, string street3, string city, string state, string zip, string country, string phone, string phoneExtension, string addressType, string additionalShippingInformation, Dictionary serializedAdditionalRawData) : base(dataCenterAddressType, supportedCarriersForReturnShipment, dataCenterAzureLocation, serializedAdditionalRawData) { ContactPersonName = contactPersonName; Company = company; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.Serialization.cs index 5a604d2874d5..a64c6ad639bd 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.Serialization.cs @@ -5,14 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataCenterAddressResult + public partial class DataCenterAddressResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataCenterAddressResult DeserializeDataCenterAddressResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("datacenterAddressType"u8); + writer.WriteStringValue(DataCenterAddressType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataCenterAddressResult DeserializeDataCenterAddressResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,7 +56,97 @@ internal static DataCenterAddressResult DeserializeDataCenterAddressResult(JsonE case "DatacenterAddressLocation": return DataCenterAddressLocationResult.DeserializeDataCenterAddressLocationResult(element); } } - return UnknownDataCenterAddressResponse.DeserializeUnknownDataCenterAddressResponse(element); + + // Unknown type found so we will deserialize the base properties only + DataCenterAddressType dataCenterAddressType = default; + Optional> supportedCarriersForReturnShipment = default; + Optional dataCenterAzureLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("datacenterAddressType"u8)) + { + dataCenterAddressType = property.Value.GetString().ToDataCenterAddressType(); + continue; + } + if (property.NameEquals("supportedCarriersForReturnShipment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + supportedCarriersForReturnShipment = array; + continue; + } + if (property.NameEquals("dataCenterAzureLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataCenterAzureLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDataCenterAddressResponse(dataCenterAddressType, Optional.ToList(supportedCarriersForReturnShipment), Optional.ToNullable(dataCenterAzureLocation), serializedAdditionalRawData); + } + + DataCenterAddressResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataCenterAddressResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataCenterAddressResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataCenterAddressResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataCenterAddressResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataCenterAddressResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataCenterAddressResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.cs index f7803d256106..dbf182c69d85 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataCenterAddressResult.cs @@ -5,8 +5,10 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { @@ -15,23 +17,29 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownDataCenterAddressResponse))] public abstract partial class DataCenterAddressResult { - /// Initializes a new instance of DataCenterAddressResult. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DataCenterAddressResult() { SupportedCarriersForReturnShipment = new ChangeTrackingList(); } - /// Initializes a new instance of DataCenterAddressResult. + /// Initializes a new instance of . /// Data center address type. /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. - internal DataCenterAddressResult(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation) + /// Keeps track of any properties unknown to the library. + internal DataCenterAddressResult(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation, Dictionary serializedAdditionalRawData) { DataCenterAddressType = dataCenterAddressType; SupportedCarriersForReturnShipment = supportedCarriersForReturnShipment; DataCenterAzureLocation = dataCenterAzureLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Data center address type. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.Serialization.cs index a862f2da0e87..0836a8f6856a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.Serialization.cs @@ -5,30 +5,66 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataExportDetails : IUtf8JsonSerializable + public partial class DataExportDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("transferConfiguration"u8); - writer.WriteObjectValue(TransferConfiguration); + if (TransferConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransferConfiguration).Serialize(writer, options); + } if (Optional.IsDefined(LogCollectionLevel)) { writer.WritePropertyName("logCollectionLevel"u8); writer.WriteStringValue(LogCollectionLevel.Value.ToSerialString()); } writer.WritePropertyName("accountDetails"u8); - writer.WriteObjectValue(AccountDetails); + if (AccountDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AccountDetails).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataExportDetails DeserializeDataExportDetails(JsonElement element) + internal static DataExportDetails DeserializeDataExportDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +72,7 @@ internal static DataExportDetails DeserializeDataExportDetails(JsonElement eleme TransferConfiguration transferConfiguration = default; Optional logCollectionLevel = default; DataAccountDetails accountDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("transferConfiguration"u8)) @@ -57,8 +94,61 @@ internal static DataExportDetails DeserializeDataExportDetails(JsonElement eleme accountDetails = DataAccountDetails.DeserializeDataAccountDetails(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataExportDetails(transferConfiguration, Optional.ToNullable(logCollectionLevel), accountDetails, serializedAdditionalRawData); + } + + DataExportDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataExportDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataExportDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataExportDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataExportDetails model) + { + if (model is null) + { + return null; } - return new DataExportDetails(transferConfiguration, Optional.ToNullable(logCollectionLevel), accountDetails); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataExportDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataExportDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.cs index 22ef764d9d1c..72971472dbbf 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataExportDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Details of the data to be used for exporting data from azure. public partial class DataExportDetails { - /// Initializes a new instance of DataExportDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Configuration for the data transfer. /// /// Account details of the data to be transferred @@ -30,7 +34,7 @@ public DataExportDetails(TransferConfiguration transferConfiguration, DataAccoun AccountDetails = accountDetails; } - /// Initializes a new instance of DataExportDetails. + /// Initializes a new instance of . /// Configuration for the data transfer. /// Level of the logs to be collected. /// @@ -38,11 +42,18 @@ public DataExportDetails(TransferConfiguration transferConfiguration, DataAccoun /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal DataExportDetails(TransferConfiguration transferConfiguration, LogCollectionLevel? logCollectionLevel, DataAccountDetails accountDetails) + /// Keeps track of any properties unknown to the library. + internal DataExportDetails(TransferConfiguration transferConfiguration, LogCollectionLevel? logCollectionLevel, DataAccountDetails accountDetails, Dictionary serializedAdditionalRawData) { TransferConfiguration = transferConfiguration; LogCollectionLevel = logCollectionLevel; AccountDetails = accountDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataExportDetails() + { } /// Configuration for the data transfer. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.Serialization.cs index ffd4a305e537..3318cd6ade69 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.Serialization.cs @@ -5,34 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataImportDetails : IUtf8JsonSerializable + public partial class DataImportDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("accountDetails"u8); - writer.WriteObjectValue(AccountDetails); + if (AccountDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AccountDetails).Serialize(writer, options); + } if (Optional.IsDefined(LogCollectionLevel)) { writer.WritePropertyName("logCollectionLevel"u8); writer.WriteStringValue(LogCollectionLevel.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataImportDetails DeserializeDataImportDetails(JsonElement element) + internal static DataImportDetails DeserializeDataImportDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataAccountDetails accountDetails = default; Optional logCollectionLevel = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accountDetails"u8)) @@ -49,8 +79,61 @@ internal static DataImportDetails DeserializeDataImportDetails(JsonElement eleme logCollectionLevel = property.Value.GetString().ToLogCollectionLevel(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataImportDetails(accountDetails, Optional.ToNullable(logCollectionLevel), serializedAdditionalRawData); + } + + DataImportDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataImportDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataImportDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataImportDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataImportDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataImportDetails(Response response) + { + if (response is null) + { + return null; } - return new DataImportDetails(accountDetails, Optional.ToNullable(logCollectionLevel)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataImportDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.cs index 08f9c9824ba9..7ba1ae623078 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataImportDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Details of the data to be used for importing data to azure. public partial class DataImportDetails { - /// Initializes a new instance of DataImportDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Account details of the data to be transferred /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,17 +31,24 @@ public DataImportDetails(DataAccountDetails accountDetails) AccountDetails = accountDetails; } - /// Initializes a new instance of DataImportDetails. + /// Initializes a new instance of . /// /// Account details of the data to be transferred /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// /// Level of the logs to be collected. - internal DataImportDetails(DataAccountDetails accountDetails, LogCollectionLevel? logCollectionLevel) + /// Keeps track of any properties unknown to the library. + internal DataImportDetails(DataAccountDetails accountDetails, LogCollectionLevel? logCollectionLevel, Dictionary serializedAdditionalRawData) { AccountDetails = accountDetails; LogCollectionLevel = logCollectionLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataImportDetails() + { } /// diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.Serialization.cs index 951096c57a18..f14d493b359a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataLocationToServiceLocationMap + public partial class DataLocationToServiceLocationMap : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataLocationToServiceLocationMap DeserializeDataLocationToServiceLocationMap(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataLocationToServiceLocationMap DeserializeDataLocationToServiceLocationMap(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional dataLocation = default; Optional serviceLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataLocation"u8)) @@ -40,8 +69,61 @@ internal static DataLocationToServiceLocationMap DeserializeDataLocationToServic serviceLocation = new AzureLocation(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataLocationToServiceLocationMap(Optional.ToNullable(dataLocation), Optional.ToNullable(serviceLocation)); + return new DataLocationToServiceLocationMap(Optional.ToNullable(dataLocation), Optional.ToNullable(serviceLocation), serializedAdditionalRawData); + } + + DataLocationToServiceLocationMap IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataLocationToServiceLocationMap(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataLocationToServiceLocationMap IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataLocationToServiceLocationMap(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataLocationToServiceLocationMap model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataLocationToServiceLocationMap(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataLocationToServiceLocationMap(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.cs index c3b46b7bb826..12850b2a3a42 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataLocationToServiceLocationMap.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataBox.Models /// Map of data location to service location. public partial class DataLocationToServiceLocationMap { - /// Initializes a new instance of DataLocationToServiceLocationMap. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataLocationToServiceLocationMap() { } - /// Initializes a new instance of DataLocationToServiceLocationMap. + /// Initializes a new instance of . /// Location of the data. /// Location of the service. - internal DataLocationToServiceLocationMap(AzureLocation? dataLocation, AzureLocation? serviceLocation) + /// Keeps track of any properties unknown to the library. + internal DataLocationToServiceLocationMap(AzureLocation? dataLocation, AzureLocation? serviceLocation, Dictionary serializedAdditionalRawData) { DataLocation = dataLocation; ServiceLocation = serviceLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Location of the data. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.Serialization.cs index bfe0d275928d..1806b405d504 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataTransferDetailsValidationContent : IUtf8JsonSerializable + public partial class DataTransferDetailsValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DataExportDetails)) { @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -31,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,7 +63,135 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(TransferType.ToSerialString()); writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataTransferDetailsValidationContent DeserializeDataTransferDetailsValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> dataExportDetails = default; + Optional> dataImportDetails = default; + DataBoxSkuName deviceType = default; + DataBoxJobTransferType transferType = default; + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataExportDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.DataExportDetails.DeserializeDataExportDetails(item)); + } + dataExportDetails = array; + continue; + } + if (property.NameEquals("dataImportDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.DataImportDetails.DeserializeDataImportDetails(item)); + } + dataImportDetails = array; + continue; + } + if (property.NameEquals("deviceType"u8)) + { + deviceType = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("transferType"u8)) + { + transferType = property.Value.GetString().ToDataBoxJobTransferType(); + continue; + } + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataTransferDetailsValidationContent(validationType, Optional.ToList(dataExportDetails), Optional.ToList(dataImportDetails), deviceType, transferType, serializedAdditionalRawData); + } + + DataTransferDetailsValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferDetailsValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferDetailsValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferDetailsValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferDetailsValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferDetailsValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferDetailsValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.cs index 56456614dd78..a8358c72af3e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Request to validate export and import data details. public partial class DataTransferDetailsValidationContent : DataBoxValidationInputContent { - /// Initializes a new instance of DataTransferDetailsValidationContent. + /// Initializes a new instance of . /// Device type. /// Type of the transfer. public DataTransferDetailsValidationContent(DataBoxSkuName deviceType, DataBoxJobTransferType transferType) @@ -25,6 +26,27 @@ public DataTransferDetailsValidationContent(DataBoxSkuName deviceType, DataBoxJo ValidationType = DataBoxValidationInputDiscriminator.ValidateDataTransferDetails; } + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// List of DataTransfer details to be used to export data from azure. + /// List of DataTransfer details to be used to import data to azure. + /// Device type. + /// Type of the transfer. + /// Keeps track of any properties unknown to the library. + internal DataTransferDetailsValidationContent(DataBoxValidationInputDiscriminator validationType, IList dataExportDetails, IList dataImportDetails, DataBoxSkuName deviceType, DataBoxJobTransferType transferType, Dictionary serializedAdditionalRawData) : base(validationType, serializedAdditionalRawData) + { + DataExportDetails = dataExportDetails; + DataImportDetails = dataImportDetails; + DeviceType = deviceType; + TransferType = transferType; + ValidationType = validationType; + } + + /// Initializes a new instance of for deserialization. + internal DataTransferDetailsValidationContent() + { + } + /// List of DataTransfer details to be used to export data from azure. public IList DataExportDetails { get; } /// List of DataTransfer details to be used to import data to azure. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.Serialization.cs index 9145a8859326..e21ddb7297ea 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataTransferDetailsValidationResult + public partial class DataTransferDetailsValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataTransferDetailsValidationResult DeserializeDataTransferDetailsValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataTransferDetailsValidationResult DeserializeDataTransferDetailsValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +51,7 @@ internal static DataTransferDetailsValidationResult DeserializeDataTransferDetai Optional status = default; DataBoxValidationInputDiscriminator validationType = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -47,8 +77,61 @@ internal static DataTransferDetailsValidationResult DeserializeDataTransferDetai error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataTransferDetailsValidationResult(validationType, error.Value, Optional.ToNullable(status)); + return new DataTransferDetailsValidationResult(validationType, error.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + DataTransferDetailsValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataTransferDetailsValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataTransferDetailsValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataTransferDetailsValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataTransferDetailsValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataTransferDetailsValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataTransferDetailsValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.cs index ee723d58814b..74a9438929c2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataTransferDetailsValidationResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.DataBox.Models /// Properties of data transfer details validation response. public partial class DataTransferDetailsValidationResult : DataBoxValidationInputResult { - /// Initializes a new instance of DataTransferDetailsValidationResult. + /// Initializes a new instance of . internal DataTransferDetailsValidationResult() { ValidationType = DataBoxValidationInputDiscriminator.ValidateDataTransferDetails; } - /// Initializes a new instance of DataTransferDetailsValidationResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// Data transfer details validation status. - internal DataTransferDetailsValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal DataTransferDetailsValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { Status = status; ValidationType = validationType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.Serialization.cs index 13079d9ddfb4..ef8caadb61ec 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.Serialization.cs @@ -5,17 +5,62 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DataboxJobSecrets + public partial class DataboxJobSecrets : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataboxJobSecrets DeserializeDataboxJobSecrets(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(PodSecrets)) + { + writer.WritePropertyName("podSecrets"u8); + writer.WriteStartArray(); + foreach (var item in PodSecrets) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WritePropertyName("jobSecretsType"u8); + writer.WriteStringValue(JobSecretsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataboxJobSecrets DeserializeDataboxJobSecrets(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +69,7 @@ internal static DataboxJobSecrets DeserializeDataboxJobSecrets(JsonElement eleme DataBoxOrderType jobSecretsType = default; Optional dcAccessSecurityCode = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("podSecrets"u8)) @@ -63,8 +109,61 @@ internal static DataboxJobSecrets DeserializeDataboxJobSecrets(JsonElement eleme error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataboxJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(podSecrets)); + return new DataboxJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, Optional.ToList(podSecrets), serializedAdditionalRawData); + } + + DataboxJobSecrets IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataboxJobSecrets(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataboxJobSecrets IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataboxJobSecrets(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataboxJobSecrets model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataboxJobSecrets(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataboxJobSecrets(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.cs index 23f293c7fc33..014b96e6a0a5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DataboxJobSecrets.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,19 +15,20 @@ namespace Azure.ResourceManager.DataBox.Models /// The secrets related to a databox job. public partial class DataboxJobSecrets : JobSecrets { - /// Initializes a new instance of DataboxJobSecrets. + /// Initializes a new instance of . internal DataboxJobSecrets() { PodSecrets = new ChangeTrackingList(); JobSecretsType = DataBoxOrderType.DataBox; } - /// Initializes a new instance of DataboxJobSecrets. + /// Initializes a new instance of . /// Used to indicate what type of job secrets object. /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. /// Contains the list of secret objects for a job. - internal DataboxJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList podSecrets) : base(jobSecretsType, dataCenterAccessSecurityCode, error) + /// Keeps track of any properties unknown to the library. + internal DataboxJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, IReadOnlyList podSecrets, Dictionary serializedAdditionalRawData) : base(jobSecretsType, dataCenterAccessSecurityCode, error, serializedAdditionalRawData) { PodSecrets = podSecrets; JobSecretsType = jobSecretsType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.Serialization.cs index 83c6d1830cfa..69c79090c6e9 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DeviceErasureDetails + public partial class DeviceErasureDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DeviceErasureDetails DeserializeDeviceErasureDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DeviceErasureDetails DeserializeDeviceErasureDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional deviceErasureStatus = default; Optional erasureOrDestructionCertificateSasKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deviceErasureStatus"u8)) @@ -36,8 +65,61 @@ internal static DeviceErasureDetails DeserializeDeviceErasureDetails(JsonElement erasureOrDestructionCertificateSasKey = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DeviceErasureDetails(Optional.ToNullable(deviceErasureStatus), erasureOrDestructionCertificateSasKey.Value); + return new DeviceErasureDetails(Optional.ToNullable(deviceErasureStatus), erasureOrDestructionCertificateSasKey.Value, serializedAdditionalRawData); + } + + DeviceErasureDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceErasureDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeviceErasureDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeviceErasureDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeviceErasureDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeviceErasureDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeviceErasureDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.cs index 6b2823d91adb..35cf2e57bd8f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DeviceErasureDetails.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Device erasure details with erasure completion status and erasureordestructionlog sas key. public partial class DeviceErasureDetails { - /// Initializes a new instance of DeviceErasureDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DeviceErasureDetails() { } - /// Initializes a new instance of DeviceErasureDetails. + /// Initializes a new instance of . /// Holds the device erasure completion status. /// Shared access key to download cleanup or destruction certificate for device. - internal DeviceErasureDetails(DataBoxStageStatus? deviceErasureStatus, string erasureOrDestructionCertificateSasKey) + /// Keeps track of any properties unknown to the library. + internal DeviceErasureDetails(DataBoxStageStatus? deviceErasureStatus, string erasureOrDestructionCertificateSasKey, Dictionary serializedAdditionalRawData) { DeviceErasureStatus = deviceErasureStatus; ErasureOrDestructionCertificateSasKey = erasureOrDestructionCertificateSasKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Holds the device erasure completion status. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.Serialization.cs index 65b146977d90..8ea8d00570a5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class DiskScheduleAvailabilityContent : IUtf8JsonSerializable + public partial class DiskScheduleAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes); @@ -26,7 +34,111 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("country"u8); writer.WriteStringValue(Country); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DiskScheduleAvailabilityContent DeserializeDiskScheduleAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int expectedDataSizeInTerabytes = default; + AzureLocation storageLocation = default; + DataBoxSkuName skuName = default; + Optional country = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("expectedDataSizeInTeraBytes"u8)) + { + expectedDataSizeInTerabytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("storageLocation"u8)) + { + storageLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiskScheduleAvailabilityContent(storageLocation, skuName, country.Value, expectedDataSizeInTerabytes, serializedAdditionalRawData); + } + + DiskScheduleAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiskScheduleAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiskScheduleAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiskScheduleAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiskScheduleAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiskScheduleAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiskScheduleAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.cs index 4341911a52be..3410f7ad4357 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/DiskScheduleAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Request body to get the availability for scheduling disk orders. public partial class DiskScheduleAvailabilityContent : ScheduleAvailabilityContent { - /// Initializes a new instance of DiskScheduleAvailabilityContent. + /// Initializes a new instance of . /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. /// The expected size of the data, which needs to be transferred in this job, in terabytes. public DiskScheduleAvailabilityContent(AzureLocation storageLocation, int expectedDataSizeInTerabytes) : base(storageLocation) @@ -21,6 +23,23 @@ public DiskScheduleAvailabilityContent(AzureLocation storageLocation, int expect SkuName = DataBoxSkuName.DataBoxDisk; } + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Name for which the order is to be scheduled. + /// Country in which storage location should be supported. + /// The expected size of the data, which needs to be transferred in this job, in terabytes. + /// Keeps track of any properties unknown to the library. + internal DiskScheduleAvailabilityContent(AzureLocation storageLocation, DataBoxSkuName skuName, string country, int expectedDataSizeInTerabytes, Dictionary serializedAdditionalRawData) : base(storageLocation, skuName, country, serializedAdditionalRawData) + { + ExpectedDataSizeInTerabytes = expectedDataSizeInTerabytes; + SkuName = skuName; + } + + /// Initializes a new instance of for deserialization. + internal DiskScheduleAvailabilityContent() + { + } + /// The expected size of the data, which needs to be transferred in this job, in terabytes. public int ExpectedDataSizeInTerabytes { get; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.Serialization.cs index 529df95a6a89..35b1e1446a7f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ExportDiskDetails + public partial class ExportDiskDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExportDiskDetails DeserializeExportDiskDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExportDiskDetails DeserializeExportDiskDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static ExportDiskDetails DeserializeExportDiskDetails(JsonElement eleme Optional manifestFile = default; Optional manifestHash = default; Optional backupManifestCloudPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("manifestFile"u8)) @@ -38,8 +67,61 @@ internal static ExportDiskDetails DeserializeExportDiskDetails(JsonElement eleme backupManifestCloudPath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExportDiskDetails(manifestFile.Value, manifestHash.Value, backupManifestCloudPath.Value); + return new ExportDiskDetails(manifestFile.Value, manifestHash.Value, backupManifestCloudPath.Value, serializedAdditionalRawData); + } + + ExportDiskDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportDiskDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportDiskDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportDiskDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportDiskDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportDiskDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportDiskDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.cs index 86444469f6e9..5d96e6584072 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ExportDiskDetails.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Export disk details. public partial class ExportDiskDetails { - /// Initializes a new instance of ExportDiskDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExportDiskDetails() { } - /// Initializes a new instance of ExportDiskDetails. + /// Initializes a new instance of . /// The relative path of the manifest file on the disk. /// The Base16-encoded MD5 hash of the manifest file on the disk. /// Path to backed up manifest, only returned if enableManifestBackup is true. - internal ExportDiskDetails(string manifestFile, string manifestHash, string backupManifestCloudPath) + /// Keeps track of any properties unknown to the library. + internal ExportDiskDetails(string manifestFile, string manifestHash, string backupManifestCloudPath, Dictionary serializedAdditionalRawData) { ManifestFile = manifestFile; ManifestHash = manifestHash; BackupManifestCloudPath = backupManifestCloudPath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The relative path of the manifest file on the disk. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.Serialization.cs index 3c22eb3d3416..d99bb7b79dd2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class FilterFileDetails : IUtf8JsonSerializable + public partial class FilterFileDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("filterFileType"u8); writer.WriteStringValue(FilterFileType.ToSerialString()); writer.WritePropertyName("filterFilePath"u8); writer.WriteStringValue(FilterFilePath); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FilterFileDetails DeserializeFilterFileDetails(JsonElement element) + internal static FilterFileDetails DeserializeFilterFileDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } FilterFileType filterFileType = default; string filterFilePath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("filterFileType"u8)) @@ -42,8 +65,61 @@ internal static FilterFileDetails DeserializeFilterFileDetails(JsonElement eleme filterFilePath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FilterFileDetails(filterFileType, filterFilePath, serializedAdditionalRawData); + } + + FilterFileDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFilterFileDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FilterFileDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFilterFileDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FilterFileDetails model) + { + if (model is null) + { + return null; } - return new FilterFileDetails(filterFileType, filterFilePath); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FilterFileDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFilterFileDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.cs index 3e0ac57df70d..61a149bd5298 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/FilterFileDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Details of the filter files to be used for data transfer. public partial class FilterFileDetails { - /// Initializes a new instance of FilterFileDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the filter file. /// Path of the file that contains the details of all items to transfer. /// is null. @@ -25,6 +29,22 @@ public FilterFileDetails(FilterFileType filterFileType, string filterFilePath) FilterFilePath = filterFilePath; } + /// Initializes a new instance of . + /// Type of the filter file. + /// Path of the file that contains the details of all items to transfer. + /// Keeps track of any properties unknown to the library. + internal FilterFileDetails(FilterFileType filterFileType, string filterFilePath, Dictionary serializedAdditionalRawData) + { + FilterFileType = filterFileType; + FilterFilePath = filterFilePath; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FilterFileDetails() + { + } + /// Type of the filter file. public FilterFileType FilterFileType { get; set; } /// Path of the file that contains the details of all items to transfer. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.Serialization.cs index f30042a9b3d8..de7066b27d98 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.Serialization.cs @@ -5,14 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class GranularCopyLogDetails + public partial class GranularCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GranularCopyLogDetails DeserializeGranularCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GranularCopyLogDetails DeserializeGranularCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,7 +55,72 @@ internal static GranularCopyLogDetails DeserializeGranularCopyLogDetails(JsonEle case "DataBoxCustomerDisk": return DataBoxDiskGranularCopyLogDetails.DeserializeDataBoxDiskGranularCopyLogDetails(element); } } - return UnknownGranularCopyLogDetails.DeserializeUnknownGranularCopyLogDetails(element); + + // Unknown type found so we will deserialize the base properties only + DataBoxOrderType copyLogDetailsType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("copyLogDetailsType"u8)) + { + copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownGranularCopyLogDetails(copyLogDetailsType, serializedAdditionalRawData); + } + + GranularCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGranularCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GranularCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGranularCopyLogDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GranularCopyLogDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GranularCopyLogDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGranularCopyLogDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.cs index 91feb67d2279..0b8dccf822fb 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyLogDetails.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.DataBox.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include . /// + [DeserializationProxy(typeof(UnknownGranularCopyLogDetails))] public abstract partial class GranularCopyLogDetails { - /// Initializes a new instance of GranularCopyLogDetails. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected GranularCopyLogDetails() { } - /// Initializes a new instance of GranularCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. - internal GranularCopyLogDetails(DataBoxOrderType copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal GranularCopyLogDetails(DataBoxOrderType copyLogDetailsType, Dictionary serializedAdditionalRawData) { CopyLogDetailsType = copyLogDetailsType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Indicates the type of job details. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.Serialization.cs index d4b835178eda..5c5346d0941b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.Serialization.cs @@ -5,17 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class GranularCopyProgress + public partial class GranularCopyProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GranularCopyProgress DeserializeGranularCopyProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GranularCopyProgress DeserializeGranularCopyProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +63,7 @@ internal static GranularCopyProgress DeserializeGranularCopyProgress(JsonElement Optional isEnumerationInProgress = default; Optional error = default; Optional> actions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountName"u8)) @@ -193,8 +220,61 @@ internal static GranularCopyProgress DeserializeGranularCopyProgress(JsonElement actions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GranularCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions)); + return new GranularCopyProgress(storageAccountName.Value, Optional.ToNullable(transferType), Optional.ToNullable(dataAccountType), accountId.Value, Optional.ToNullable(bytesProcessed), Optional.ToNullable(totalBytesToProcess), Optional.ToNullable(filesProcessed), Optional.ToNullable(totalFilesToProcess), Optional.ToNullable(invalidFilesProcessed), Optional.ToNullable(invalidFileBytesUploaded), Optional.ToNullable(renamedContainerCount), Optional.ToNullable(filesErroredOut), Optional.ToNullable(directoriesErroredOut), Optional.ToNullable(invalidDirectoriesProcessed), Optional.ToNullable(isEnumerationInProgress), error.Value, Optional.ToList(actions), serializedAdditionalRawData); + } + + GranularCopyProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGranularCopyProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GranularCopyProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGranularCopyProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GranularCopyProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GranularCopyProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGranularCopyProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.cs index 14e347dff41d..6a3ee85aaff4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/GranularCopyProgress.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -14,13 +15,16 @@ namespace Azure.ResourceManager.DataBox.Models /// Granular Copy progress. public partial class GranularCopyProgress { - /// Initializes a new instance of GranularCopyProgress. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GranularCopyProgress() { Actions = new ChangeTrackingList(); } - /// Initializes a new instance of GranularCopyProgress. + /// Initializes a new instance of . /// Name of the storage account. This will be empty for data account types other than storage account. /// Transfer type of data. /// Data Account Type. @@ -41,7 +45,8 @@ internal GranularCopyProgress() /// /// Error, if any, in the stage. /// Available actions on the job. - internal GranularCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions) + /// Keeps track of any properties unknown to the library. + internal GranularCopyProgress(string storageAccountName, DataBoxJobTransferType? transferType, DataAccountType? dataAccountType, ResourceIdentifier accountId, long? bytesProcessed, long? totalBytesToProcess, long? filesProcessed, long? totalFilesToProcess, long? invalidFilesProcessed, long? invalidFileBytesUploaded, long? renamedContainerCount, long? filesErroredOut, long? directoriesErroredOut, long? invalidDirectoriesProcessed, bool? isEnumerationInProgress, ResponseError error, IReadOnlyList actions, Dictionary serializedAdditionalRawData) { StorageAccountName = storageAccountName; TransferType = transferType; @@ -60,6 +65,7 @@ internal GranularCopyProgress(string storageAccountName, DataBoxJobTransferType? IsEnumerationInProgress = isEnumerationInProgress; Error = error; Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the storage account. This will be empty for data account types other than storage account. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.Serialization.cs index 237cc1d198f7..eee5c91429ee 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class HeavyScheduleAvailabilityContent : IUtf8JsonSerializable + public partial class HeavyScheduleAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageLocation"u8); writer.WriteStringValue(StorageLocation); @@ -24,7 +32,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("country"u8); writer.WriteStringValue(Country); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static HeavyScheduleAvailabilityContent DeserializeHeavyScheduleAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation storageLocation = default; + DataBoxSkuName skuName = default; + Optional country = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageLocation"u8)) + { + storageLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HeavyScheduleAvailabilityContent(storageLocation, skuName, country.Value, serializedAdditionalRawData); + } + + HeavyScheduleAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHeavyScheduleAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HeavyScheduleAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHeavyScheduleAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HeavyScheduleAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HeavyScheduleAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHeavyScheduleAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.cs index b73ce04f21b9..d80052bb2854 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/HeavyScheduleAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -12,11 +14,26 @@ namespace Azure.ResourceManager.DataBox.Models /// Request body to get the availability for scheduling heavy orders. public partial class HeavyScheduleAvailabilityContent : ScheduleAvailabilityContent { - /// Initializes a new instance of HeavyScheduleAvailabilityContent. + /// Initializes a new instance of . /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. public HeavyScheduleAvailabilityContent(AzureLocation storageLocation) : base(storageLocation) { SkuName = DataBoxSkuName.DataBoxHeavy; } + + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Name for which the order is to be scheduled. + /// Country in which storage location should be supported. + /// Keeps track of any properties unknown to the library. + internal HeavyScheduleAvailabilityContent(AzureLocation storageLocation, DataBoxSkuName skuName, string country, Dictionary serializedAdditionalRawData) : base(storageLocation, skuName, country, serializedAdditionalRawData) + { + SkuName = skuName; + } + + /// Initializes a new instance of for deserialization. + internal HeavyScheduleAvailabilityContent() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.Serialization.cs index 7cfc17ff5275..790bb75d4c05 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ImportDiskDetails : IUtf8JsonSerializable + public partial class ImportDiskDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("manifestFile"u8); writer.WriteStringValue(ManifestFile); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ManifestHash); writer.WritePropertyName("bitLockerKey"u8); writer.WriteStringValue(BitLockerKey); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ImportDiskDetails DeserializeImportDiskDetails(JsonElement element) + internal static ImportDiskDetails DeserializeImportDiskDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +56,7 @@ internal static ImportDiskDetails DeserializeImportDiskDetails(JsonElement eleme string manifestHash = default; string bitLockerKey = default; Optional backupManifestCloudPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("manifestFile"u8)) @@ -56,8 +79,61 @@ internal static ImportDiskDetails DeserializeImportDiskDetails(JsonElement eleme backupManifestCloudPath = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImportDiskDetails(manifestFile, manifestHash, bitLockerKey, backupManifestCloudPath.Value, serializedAdditionalRawData); + } + + ImportDiskDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImportDiskDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImportDiskDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImportDiskDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImportDiskDetails model) + { + if (model is null) + { + return null; } - return new ImportDiskDetails(manifestFile, manifestHash, bitLockerKey, backupManifestCloudPath.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImportDiskDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImportDiskDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.cs index a5619b46d99b..6127594781c4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ImportDiskDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Import disk details. public partial class ImportDiskDetails { - /// Initializes a new instance of ImportDiskDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The relative path of the manifest file on the disk. /// The Base16-encoded MD5 hash of the manifest file on the disk. /// BitLocker key used to encrypt the disk. @@ -29,17 +33,24 @@ public ImportDiskDetails(string manifestFile, string manifestHash, string bitLoc BitLockerKey = bitLockerKey; } - /// Initializes a new instance of ImportDiskDetails. + /// Initializes a new instance of . /// The relative path of the manifest file on the disk. /// The Base16-encoded MD5 hash of the manifest file on the disk. /// BitLocker key used to encrypt the disk. /// Path to backed up manifest, only returned if enableManifestBackup is true. - internal ImportDiskDetails(string manifestFile, string manifestHash, string bitLockerKey, string backupManifestCloudPath) + /// Keeps track of any properties unknown to the library. + internal ImportDiskDetails(string manifestFile, string manifestHash, string bitLockerKey, string backupManifestCloudPath, Dictionary serializedAdditionalRawData) { ManifestFile = manifestFile; ManifestHash = manifestHash; BitLockerKey = bitLockerKey; BackupManifestCloudPath = backupManifestCloudPath; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImportDiskDetails() + { } /// The relative path of the manifest file on the disk. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.Serialization.cs index 054684659c95..43f62ff487ef 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.Serialization.cs @@ -6,31 +6,53 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class JobDeliveryInfo : IUtf8JsonSerializable + internal partial class JobDeliveryInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ScheduledOn)) { writer.WritePropertyName("scheduledDateTime"u8); writer.WriteStringValue(ScheduledOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static JobDeliveryInfo DeserializeJobDeliveryInfo(JsonElement element) + internal static JobDeliveryInfo DeserializeJobDeliveryInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional scheduledDateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scheduledDateTime"u8)) @@ -42,8 +64,61 @@ internal static JobDeliveryInfo DeserializeJobDeliveryInfo(JsonElement element) scheduledDateTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new JobDeliveryInfo(Optional.ToNullable(scheduledDateTime), serializedAdditionalRawData); + } + + JobDeliveryInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobDeliveryInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobDeliveryInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobDeliveryInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobDeliveryInfo model) + { + if (model is null) + { + return null; } - return new JobDeliveryInfo(Optional.ToNullable(scheduledDateTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobDeliveryInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobDeliveryInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.cs index fef1039f94cd..7b6816a58089 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobDeliveryInfo.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models { /// Additional delivery info. internal partial class JobDeliveryInfo { - /// Initializes a new instance of JobDeliveryInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public JobDeliveryInfo() { } - /// Initializes a new instance of JobDeliveryInfo. + /// Initializes a new instance of . /// Scheduled date time. - internal JobDeliveryInfo(DateTimeOffset? scheduledOn) + /// Keeps track of any properties unknown to the library. + internal JobDeliveryInfo(DateTimeOffset? scheduledOn, Dictionary serializedAdditionalRawData) { ScheduledOn = scheduledOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scheduled date time. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.Serialization.cs index de7b46b33359..fc931fc3c4ba 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.Serialization.cs @@ -5,14 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class JobSecrets + public partial class JobSecrets : IUtf8JsonSerializable, IModelJsonSerializable { - internal static JobSecrets DeserializeJobSecrets(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobSecretsType"u8); + writer.WriteStringValue(JobSecretsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static JobSecrets DeserializeJobSecrets(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,7 +58,92 @@ internal static JobSecrets DeserializeJobSecrets(JsonElement element) case "DataBoxHeavy": return DataBoxHeavyJobSecrets.DeserializeDataBoxHeavyJobSecrets(element); } } - return UnknownJobSecrets.DeserializeUnknownJobSecrets(element); + + // Unknown type found so we will deserialize the base properties only + DataBoxOrderType jobSecretsType = default; + Optional dcAccessSecurityCode = default; + Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("jobSecretsType"u8)) + { + jobSecretsType = property.Value.GetString().ToDataBoxOrderType(); + continue; + } + if (property.NameEquals("dcAccessSecurityCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dcAccessSecurityCode = DataCenterAccessSecurityCode.DeserializeDataCenterAccessSecurityCode(property.Value); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value, serializedAdditionalRawData); + } + + JobSecrets IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJobSecrets(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobSecrets IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobSecrets(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JobSecrets model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JobSecrets(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJobSecrets(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.cs index 44b5f173bb78..5a563c65bac5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/JobSecrets.cs @@ -5,7 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { @@ -14,22 +17,28 @@ namespace Azure.ResourceManager.DataBox.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownJobSecrets))] public abstract partial class JobSecrets { - /// Initializes a new instance of JobSecrets. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected JobSecrets() { } - /// Initializes a new instance of JobSecrets. + /// Initializes a new instance of . /// Used to indicate what type of job secrets object. /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. - internal JobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error) + /// Keeps track of any properties unknown to the library. + internal JobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, Dictionary serializedAdditionalRawData) { JobSecretsType = jobSecretsType; DataCenterAccessSecurityCode = dataCenterAccessSecurityCode; Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Used to indicate what type of job secrets object. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.Serialization.cs index 10b5b49adde5..6a0a54176b70 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class LastMitigationActionOnJob + public partial class LastMitigationActionOnJob : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LastMitigationActionOnJob DeserializeLastMitigationActionOnJob(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionPerformedOn)) + { + writer.WritePropertyName("actionDateTimeInUtc"u8); + writer.WriteStringValue(ActionPerformedOn.Value, "O"); + } + if (Optional.IsDefined(IsPerformedByCustomer)) + { + writer.WritePropertyName("isPerformedByCustomer"u8); + writer.WriteBooleanValue(IsPerformedByCustomer.Value); + } + if (Optional.IsDefined(CustomerResolution)) + { + writer.WritePropertyName("customerResolution"u8); + writer.WriteStringValue(CustomerResolution.Value.ToSerialString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LastMitigationActionOnJob DeserializeLastMitigationActionOnJob(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static LastMitigationActionOnJob DeserializeLastMitigationActionOnJob(J Optional actionDateTimeInUtc = default; Optional isPerformedByCustomer = default; Optional customerResolution = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actionDateTimeInUtc"u8)) @@ -51,8 +94,61 @@ internal static LastMitigationActionOnJob DeserializeLastMitigationActionOnJob(J customerResolution = property.Value.GetString().ToCustomerResolutionCode(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LastMitigationActionOnJob(Optional.ToNullable(actionDateTimeInUtc), Optional.ToNullable(isPerformedByCustomer), Optional.ToNullable(customerResolution)); + return new LastMitigationActionOnJob(Optional.ToNullable(actionDateTimeInUtc), Optional.ToNullable(isPerformedByCustomer), Optional.ToNullable(customerResolution), serializedAdditionalRawData); + } + + LastMitigationActionOnJob IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLastMitigationActionOnJob(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LastMitigationActionOnJob IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLastMitigationActionOnJob(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LastMitigationActionOnJob model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LastMitigationActionOnJob(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLastMitigationActionOnJob(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.cs index 8d9f289d41ac..6389ede1d3c1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/LastMitigationActionOnJob.cs @@ -6,29 +6,35 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models { /// Last Mitigation Action Performed On Job. public partial class LastMitigationActionOnJob { - /// Initializes a new instance of LastMitigationActionOnJob. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LastMitigationActionOnJob() { } - /// Initializes a new instance of LastMitigationActionOnJob. + /// Initializes a new instance of . /// Action performed date time. /// /// Action performed by customer, /// possibility is that mitigation might happen by customer or service or by ops /// /// Resolution code provided by customer. - internal LastMitigationActionOnJob(DateTimeOffset? actionPerformedOn, bool? isPerformedByCustomer, CustomerResolutionCode? customerResolution) + /// Keeps track of any properties unknown to the library. + internal LastMitigationActionOnJob(DateTimeOffset? actionPerformedOn, bool? isPerformedByCustomer, CustomerResolutionCode? customerResolution, Dictionary serializedAdditionalRawData) { ActionPerformedOn = actionPerformedOn; IsPerformedByCustomer = isPerformedByCustomer; CustomerResolution = customerResolution; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Action performed date time. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.Serialization.cs index 6d1375d8629f..46ac3cf588bf 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ManagedDiskDetails : IUtf8JsonSerializable + public partial class ManagedDiskDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceGroupId"u8); writer.WriteStringValue(ResourceGroupId); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sharePassword"u8); writer.WriteStringValue(SharePassword); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedDiskDetails DeserializeManagedDiskDetails(JsonElement element) + internal static ManagedDiskDetails DeserializeManagedDiskDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static ManagedDiskDetails DeserializeManagedDiskDetails(JsonElement ele ResourceIdentifier stagingStorageAccountId = default; DataAccountType dataAccountType = default; Optional sharePassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceGroupId"u8)) @@ -61,8 +84,61 @@ internal static ManagedDiskDetails DeserializeManagedDiskDetails(JsonElement ele sharePassword = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedDiskDetails(dataAccountType, sharePassword.Value, resourceGroupId, stagingStorageAccountId, serializedAdditionalRawData); + } + + ManagedDiskDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedDiskDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedDiskDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedDiskDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedDiskDetails model) + { + if (model is null) + { + return null; } - return new ManagedDiskDetails(dataAccountType, sharePassword.Value, resourceGroupId, stagingStorageAccountId); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedDiskDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedDiskDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.cs index 46141f8c8784..22cdb5b847b0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ManagedDiskDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Details of the managed disks. public partial class ManagedDiskDetails : DataAccountDetails { - /// Initializes a new instance of ManagedDiskDetails. + /// Initializes a new instance of . /// Resource Group Id of the compute disks. /// Resource Id of the storage account that can be used to copy the vhd for staging. /// or is null. @@ -27,18 +28,24 @@ public ManagedDiskDetails(ResourceIdentifier resourceGroupId, ResourceIdentifier DataAccountType = DataAccountType.ManagedDisk; } - /// Initializes a new instance of ManagedDiskDetails. + /// Initializes a new instance of . /// Account Type of the data to be transferred. /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. /// Resource Group Id of the compute disks. /// Resource Id of the storage account that can be used to copy the vhd for staging. - internal ManagedDiskDetails(DataAccountType dataAccountType, string sharePassword, ResourceIdentifier resourceGroupId, ResourceIdentifier stagingStorageAccountId) : base(dataAccountType, sharePassword) + /// Keeps track of any properties unknown to the library. + internal ManagedDiskDetails(DataAccountType dataAccountType, string sharePassword, ResourceIdentifier resourceGroupId, ResourceIdentifier stagingStorageAccountId, Dictionary serializedAdditionalRawData) : base(dataAccountType, sharePassword, serializedAdditionalRawData) { ResourceGroupId = resourceGroupId; StagingStorageAccountId = stagingStorageAccountId; DataAccountType = dataAccountType; } + /// Initializes a new instance of for deserialization. + internal ManagedDiskDetails() + { + } + /// Resource Group Id of the compute disks. public ResourceIdentifier ResourceGroupId { get; set; } /// Resource Id of the storage account that can be used to copy the vhd for staging. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.Serialization.cs index 869fcf304843..056a1fa44d36 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.Serialization.cs @@ -5,19 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class MarkDevicesShippedContent : IUtf8JsonSerializable + public partial class MarkDevicesShippedContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("deliverToDcPackageDetails"u8); - writer.WriteObjectValue(DeliverToDataCenterPackageDetails); + if (DeliverToDataCenterPackageDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeliverToDataCenterPackageDetails).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MarkDevicesShippedContent DeserializeMarkDevicesShippedContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PackageCarrierInfo deliverToDcPackageDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deliverToDcPackageDetails"u8)) + { + deliverToDcPackageDetails = PackageCarrierInfo.DeserializePackageCarrierInfo(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MarkDevicesShippedContent(deliverToDcPackageDetails, serializedAdditionalRawData); + } + + MarkDevicesShippedContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMarkDevicesShippedContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MarkDevicesShippedContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMarkDevicesShippedContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MarkDevicesShippedContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MarkDevicesShippedContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMarkDevicesShippedContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.cs index 6fa601209813..0b5a42e3fde2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MarkDevicesShippedContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// The request body to provide the delivery package details of job. public partial class MarkDevicesShippedContent { - /// Initializes a new instance of MarkDevicesShippedContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Delivery package details. /// is null. public MarkDevicesShippedContent(PackageCarrierInfo deliverToDataCenterPackageDetails) @@ -23,6 +27,20 @@ public MarkDevicesShippedContent(PackageCarrierInfo deliverToDataCenterPackageDe DeliverToDataCenterPackageDetails = deliverToDataCenterPackageDetails; } + /// Initializes a new instance of . + /// Delivery package details. + /// Keeps track of any properties unknown to the library. + internal MarkDevicesShippedContent(PackageCarrierInfo deliverToDataCenterPackageDetails, Dictionary serializedAdditionalRawData) + { + DeliverToDataCenterPackageDetails = deliverToDataCenterPackageDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MarkDevicesShippedContent() + { + } + /// Delivery package details. public PackageCarrierInfo DeliverToDataCenterPackageDetails { get; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.Serialization.cs index deef8980f82a..9e4678aa4b1c 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.Serialization.cs @@ -5,12 +5,137 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class MitigateJobContent : IUtf8JsonSerializable + public partial class MitigateJobContent : IUtf8JsonSerializable, IModelJsonSerializable { + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("customerResolutionCode"u8); + writer.WriteStringValue(CustomerResolutionCode.ToSerialString()); + if (Optional.IsCollectionDefined(SerialNumberCustomerResolutionMap)) + { + writer.WritePropertyName("serialNumberCustomerResolutionMap"u8); + writer.WriteStartObject(); + foreach (var item in SerialNumberCustomerResolutionMap) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MitigateJobContent DeserializeMitigateJobContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomerResolutionCode customerResolutionCode = default; + Optional> serialNumberCustomerResolutionMap = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customerResolutionCode"u8)) + { + customerResolutionCode = property.Value.GetString().ToCustomerResolutionCode(); + continue; + } + if (property.NameEquals("serialNumberCustomerResolutionMap"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString().ToCustomerResolutionCode()); + } + serialNumberCustomerResolutionMap = dictionary; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MitigateJobContent(customerResolutionCode, Optional.ToDictionary(serialNumberCustomerResolutionMap), serializedAdditionalRawData); + } + + MitigateJobContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMitigateJobContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MitigateJobContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMitigateJobContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MitigateJobContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MitigateJobContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMitigateJobContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.cs index 4b4aa33a5d22..fd91ba32fe16 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/MitigateJobContent.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,6 +14,19 @@ namespace Azure.ResourceManager.DataBox.Models /// The Mitigate Job captured from request body for Mitigate API. public partial class MitigateJobContent { + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Resolution code for the job. + /// Serial number and the customer resolution code corresponding to each serial number. + /// Keeps track of any properties unknown to the library. + internal MitigateJobContent(CustomerResolutionCode customerResolutionCode, IDictionary serialNumberCustomerResolutionMap, Dictionary serializedAdditionalRawData) + { + CustomerResolutionCode = customerResolutionCode; + SerialNumberCustomerResolutionMap = serialNumberCustomerResolutionMap; + _serializedAdditionalRawData = serializedAdditionalRawData; + } /// Serial number and the customer resolution code corresponding to each serial number. public IDictionary SerialNumberCustomerResolutionMap { get; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.Serialization.cs index ba6d80991d60..2207a68899cc 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class NotificationPreference : IUtf8JsonSerializable + public partial class NotificationPreference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("stageName"u8); writer.WriteStringValue(StageName.ToString()); writer.WritePropertyName("sendNotification"u8); writer.WriteBooleanValue(SendNotification); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NotificationPreference DeserializeNotificationPreference(JsonElement element) + internal static NotificationPreference DeserializeNotificationPreference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } NotificationStageName stageName = default; bool sendNotification = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("stageName"u8)) @@ -42,8 +65,61 @@ internal static NotificationPreference DeserializeNotificationPreference(JsonEle sendNotification = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NotificationPreference(stageName, sendNotification, serializedAdditionalRawData); + } + + NotificationPreference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationPreference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NotificationPreference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNotificationPreference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NotificationPreference model) + { + if (model is null) + { + return null; } - return new NotificationPreference(stageName, sendNotification); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NotificationPreference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNotificationPreference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.cs index c3acd6b5c02f..418ae7ff5fd7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/NotificationPreference.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Notification preference for a job stage. public partial class NotificationPreference { - /// Initializes a new instance of NotificationPreference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the stage. /// Notification is required or not. public NotificationPreference(NotificationStageName stageName, bool sendNotification) @@ -19,6 +25,22 @@ public NotificationPreference(NotificationStageName stageName, bool sendNotifica SendNotification = sendNotification; } + /// Initializes a new instance of . + /// Name of the stage. + /// Notification is required or not. + /// Keeps track of any properties unknown to the library. + internal NotificationPreference(NotificationStageName stageName, bool sendNotification, Dictionary serializedAdditionalRawData) + { + StageName = stageName; + SendNotification = sendNotification; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NotificationPreference() + { + } + /// Name of the stage. public NotificationStageName StageName { get; set; } /// Notification is required or not. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.Serialization.cs index 3e8ceaaecdbb..1b53d9b483a7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class PackageCarrierDetails : IUtf8JsonSerializable + public partial class PackageCarrierDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CarrierAccountNumber)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("trackingId"u8); writer.WriteStringValue(TrackingId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PackageCarrierDetails DeserializePackageCarrierDetails(JsonElement element) + internal static PackageCarrierDetails DeserializePackageCarrierDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static PackageCarrierDetails DeserializePackageCarrierDetails(JsonEleme Optional carrierAccountNumber = default; Optional carrierName = default; Optional trackingId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("carrierAccountNumber"u8)) @@ -59,8 +82,61 @@ internal static PackageCarrierDetails DeserializePackageCarrierDetails(JsonEleme trackingId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PackageCarrierDetails(carrierAccountNumber.Value, carrierName.Value, trackingId.Value, serializedAdditionalRawData); + } + + PackageCarrierDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePackageCarrierDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PackageCarrierDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePackageCarrierDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PackageCarrierDetails model) + { + if (model is null) + { + return null; } - return new PackageCarrierDetails(carrierAccountNumber.Value, carrierName.Value, trackingId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PackageCarrierDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePackageCarrierDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.cs index 95ec34b4a940..84b0b08869b6 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierDetails.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Package carrier details. public partial class PackageCarrierDetails { - /// Initializes a new instance of PackageCarrierDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PackageCarrierDetails() { } - /// Initializes a new instance of PackageCarrierDetails. + /// Initializes a new instance of . /// Carrier Account Number of customer for customer disk. /// Name of the carrier. /// Tracking Id of shipment. - internal PackageCarrierDetails(string carrierAccountNumber, string carrierName, string trackingId) + /// Keeps track of any properties unknown to the library. + internal PackageCarrierDetails(string carrierAccountNumber, string carrierName, string trackingId, Dictionary serializedAdditionalRawData) { CarrierAccountNumber = carrierAccountNumber; CarrierName = carrierName; TrackingId = trackingId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Carrier Account Number of customer for customer disk. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.Serialization.cs index f1a5119451aa..51d2974d9a4c 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class PackageCarrierInfo : IUtf8JsonSerializable + public partial class PackageCarrierInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CarrierName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("trackingId"u8); writer.WriteStringValue(TrackingId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PackageCarrierInfo DeserializePackageCarrierInfo(JsonElement element) + internal static PackageCarrierInfo DeserializePackageCarrierInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional carrierName = default; Optional trackingId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("carrierName"u8)) @@ -48,8 +71,61 @@ internal static PackageCarrierInfo DeserializePackageCarrierInfo(JsonElement ele trackingId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PackageCarrierInfo(carrierName.Value, trackingId.Value, serializedAdditionalRawData); + } + + PackageCarrierInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePackageCarrierInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PackageCarrierInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePackageCarrierInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PackageCarrierInfo model) + { + if (model is null) + { + return null; } - return new PackageCarrierInfo(carrierName.Value, trackingId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PackageCarrierInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePackageCarrierInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.cs index 06c3413f6950..d56310eb2620 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageCarrierInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// package carrier info. public partial class PackageCarrierInfo { - /// Initializes a new instance of PackageCarrierInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PackageCarrierInfo() { } - /// Initializes a new instance of PackageCarrierInfo. + /// Initializes a new instance of . /// Name of the carrier. /// Tracking Id of shipment. - internal PackageCarrierInfo(string carrierName, string trackingId) + /// Keeps track of any properties unknown to the library. + internal PackageCarrierInfo(string carrierName, string trackingId, Dictionary serializedAdditionalRawData) { CarrierName = carrierName; TrackingId = trackingId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the carrier. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.Serialization.cs index dd892bb3087c..2b9f6e9be15d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class PackageShippingDetails + public partial class PackageShippingDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PackageShippingDetails DeserializePackageShippingDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PackageShippingDetails DeserializePackageShippingDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static PackageShippingDetails DeserializePackageShippingDetails(JsonEle Optional trackingUrl = default; Optional carrierName = default; Optional trackingId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("trackingUrl"u8)) @@ -43,8 +71,61 @@ internal static PackageShippingDetails DeserializePackageShippingDetails(JsonEle trackingId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PackageShippingDetails(trackingUrl.Value, carrierName.Value, trackingId.Value); + return new PackageShippingDetails(trackingUrl.Value, carrierName.Value, trackingId.Value, serializedAdditionalRawData); + } + + PackageShippingDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePackageShippingDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PackageShippingDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePackageShippingDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PackageShippingDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PackageShippingDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePackageShippingDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.cs index d0d85043f535..bbc8057d3d1a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PackageShippingDetails.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models { /// package shipping details. public partial class PackageShippingDetails { - /// Initializes a new instance of PackageShippingDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal PackageShippingDetails() { } - /// Initializes a new instance of PackageShippingDetails. + /// Initializes a new instance of . /// Url where shipment can be tracked. /// Name of the carrier. /// Tracking Id of shipment. - internal PackageShippingDetails(Uri trackingUri, string carrierName, string trackingId) + /// Keeps track of any properties unknown to the library. + internal PackageShippingDetails(Uri trackingUri, string carrierName, string trackingId, Dictionary serializedAdditionalRawData) { TrackingUri = trackingUri; CarrierName = carrierName; TrackingId = trackingId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Url where shipment can be tracked. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.Serialization.cs index aee294ecbaee..a141449d39c0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.Serialization.cs @@ -5,26 +5,143 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class PreferencesValidationContent : IUtf8JsonSerializable + public partial class PreferencesValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Preference)) { writer.WritePropertyName("preference"u8); - writer.WriteObjectValue(Preference); + if (Preference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preference).Serialize(writer, options); + } } writer.WritePropertyName("deviceType"u8); writer.WriteStringValue(DeviceType.ToSerialString()); writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static PreferencesValidationContent DeserializePreferencesValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional preference = default; + DataBoxSkuName deviceType = default; + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("preference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preference = DataBoxOrderPreferences.DeserializeDataBoxOrderPreferences(property.Value); + continue; + } + if (property.NameEquals("deviceType"u8)) + { + deviceType = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PreferencesValidationContent(validationType, preference.Value, deviceType, serializedAdditionalRawData); + } + + PreferencesValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePreferencesValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PreferencesValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePreferencesValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PreferencesValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PreferencesValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePreferencesValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.cs index 0da0ae5c7656..ad3b765dccc1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationContent.cs @@ -5,12 +5,15 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Request to validate preference of transport and data center. public partial class PreferencesValidationContent : DataBoxValidationInputContent { - /// Initializes a new instance of PreferencesValidationContent. + /// Initializes a new instance of . /// Device type to be used for the job. public PreferencesValidationContent(DataBoxSkuName deviceType) { @@ -18,6 +21,23 @@ public PreferencesValidationContent(DataBoxSkuName deviceType) ValidationType = DataBoxValidationInputDiscriminator.ValidatePreferences; } + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// Preference of transport and data center. + /// Device type to be used for the job. + /// Keeps track of any properties unknown to the library. + internal PreferencesValidationContent(DataBoxValidationInputDiscriminator validationType, DataBoxOrderPreferences preference, DataBoxSkuName deviceType, Dictionary serializedAdditionalRawData) : base(validationType, serializedAdditionalRawData) + { + Preference = preference; + DeviceType = deviceType; + ValidationType = validationType; + } + + /// Initializes a new instance of for deserialization. + internal PreferencesValidationContent() + { + } + /// Preference of transport and data center. public DataBoxOrderPreferences Preference { get; set; } /// Device type to be used for the job. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.Serialization.cs index af461e3ad7b2..6534d4019b47 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class PreferencesValidationResult + public partial class PreferencesValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PreferencesValidationResult DeserializePreferencesValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PreferencesValidationResult DeserializePreferencesValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +51,7 @@ internal static PreferencesValidationResult DeserializePreferencesValidationResu Optional status = default; DataBoxValidationInputDiscriminator validationType = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -47,8 +77,61 @@ internal static PreferencesValidationResult DeserializePreferencesValidationResu error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PreferencesValidationResult(validationType, error.Value, Optional.ToNullable(status)); + return new PreferencesValidationResult(validationType, error.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + PreferencesValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePreferencesValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PreferencesValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePreferencesValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PreferencesValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PreferencesValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePreferencesValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.cs index 1d729a2b48b4..28aeaff9a2be 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/PreferencesValidationResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.DataBox.Models /// Properties of data center and transport preference validation response. public partial class PreferencesValidationResult : DataBoxValidationInputResult { - /// Initializes a new instance of PreferencesValidationResult. + /// Initializes a new instance of . internal PreferencesValidationResult() { ValidationType = DataBoxValidationInputDiscriminator.ValidatePreferences; } - /// Initializes a new instance of PreferencesValidationResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// Validation status of requested data center and transport. - internal PreferencesValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal PreferencesValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { Status = status; ValidationType = validationType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.Serialization.cs index 3da9687b6dbc..ab4f7fc7b18a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.Serialization.cs @@ -5,32 +5,171 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class RegionConfigurationContent : IUtf8JsonSerializable + public partial class RegionConfigurationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ScheduleAvailabilityRequest)) { writer.WritePropertyName("scheduleAvailabilityRequest"u8); - writer.WriteObjectValue(ScheduleAvailabilityRequest); + if (ScheduleAvailabilityRequest is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ScheduleAvailabilityRequest).Serialize(writer, options); + } } if (Optional.IsDefined(TransportAvailabilityRequest)) { writer.WritePropertyName("transportAvailabilityRequest"u8); - writer.WriteObjectValue(TransportAvailabilityRequest); + if (TransportAvailabilityRequest is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransportAvailabilityRequest).Serialize(writer, options); + } } if (Optional.IsDefined(DataCenterAddressRequest)) { writer.WritePropertyName("datacenterAddressRequest"u8); - writer.WriteObjectValue(DataCenterAddressRequest); + if (DataCenterAddressRequest is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataCenterAddressRequest).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static RegionConfigurationContent DeserializeRegionConfigurationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scheduleAvailabilityRequest = default; + Optional transportAvailabilityRequest = default; + Optional dataCenterAddressRequest = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheduleAvailabilityRequest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduleAvailabilityRequest = ScheduleAvailabilityContent.DeserializeScheduleAvailabilityContent(property.Value); + continue; + } + if (property.NameEquals("transportAvailabilityRequest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transportAvailabilityRequest = TransportAvailabilityRequest.DeserializeTransportAvailabilityRequest(property.Value); + continue; + } + if (property.NameEquals("datacenterAddressRequest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataCenterAddressRequest = DataCenterAddressContent.DeserializeDataCenterAddressContent(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RegionConfigurationContent(scheduleAvailabilityRequest.Value, transportAvailabilityRequest.Value, dataCenterAddressRequest.Value, serializedAdditionalRawData); + } + + RegionConfigurationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionConfigurationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionConfigurationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionConfigurationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionConfigurationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionConfigurationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionConfigurationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.cs index c8c5c92c5b29..8b2554fb46d1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationContent.cs @@ -5,16 +5,39 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Request body to get the configuration for the region. public partial class RegionConfigurationContent { - /// Initializes a new instance of RegionConfigurationContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RegionConfigurationContent() { } + /// Initializes a new instance of . + /// + /// Request body to get the availability for scheduling orders. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Request body to get the transport availability for given sku. + /// Request body to get the datacenter address for given sku. + /// Keeps track of any properties unknown to the library. + internal RegionConfigurationContent(ScheduleAvailabilityContent scheduleAvailabilityRequest, TransportAvailabilityRequest transportAvailabilityRequest, DataCenterAddressContent dataCenterAddressRequest, Dictionary serializedAdditionalRawData) + { + ScheduleAvailabilityRequest = scheduleAvailabilityRequest; + TransportAvailabilityRequest = transportAvailabilityRequest; + DataCenterAddressRequest = dataCenterAddressRequest; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// /// Request body to get the availability for scheduling orders. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.Serialization.cs index f1dc5bb04b7e..561fd76139d5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class RegionConfigurationResult + public partial class RegionConfigurationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RegionConfigurationResult DeserializeRegionConfigurationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RegionConfigurationResult DeserializeRegionConfigurationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static RegionConfigurationResult DeserializeRegionConfigurationResult(J Optional scheduleAvailabilityResponse = default; Optional transportAvailabilityResponse = default; Optional dataCenterAddressResponse = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scheduleAvailabilityResponse"u8)) @@ -50,8 +79,61 @@ internal static RegionConfigurationResult DeserializeRegionConfigurationResult(J dataCenterAddressResponse = DataCenterAddressResult.DeserializeDataCenterAddressResult(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RegionConfigurationResult(scheduleAvailabilityResponse.Value, transportAvailabilityResponse.Value, dataCenterAddressResponse.Value); + return new RegionConfigurationResult(scheduleAvailabilityResponse.Value, transportAvailabilityResponse.Value, dataCenterAddressResponse.Value, serializedAdditionalRawData); + } + + RegionConfigurationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRegionConfigurationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RegionConfigurationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRegionConfigurationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RegionConfigurationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RegionConfigurationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRegionConfigurationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.cs index fed4ef6eb829..afa32a56d5c2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/RegionConfigurationResult.cs @@ -13,12 +13,15 @@ namespace Azure.ResourceManager.DataBox.Models /// Configuration response specific to a region. public partial class RegionConfigurationResult { - /// Initializes a new instance of RegionConfigurationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RegionConfigurationResult() { } - /// Initializes a new instance of RegionConfigurationResult. + /// Initializes a new instance of . /// Schedule availability for given sku in a region. /// Transport options available for given sku in a region. /// @@ -26,11 +29,13 @@ internal RegionConfigurationResult() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal RegionConfigurationResult(ScheduleAvailabilityResponse scheduleAvailabilityResponse, TransportAvailabilityResponse transportAvailabilityResponse, DataCenterAddressResult dataCenterAddressResponse) + /// Keeps track of any properties unknown to the library. + internal RegionConfigurationResult(ScheduleAvailabilityResponse scheduleAvailabilityResponse, TransportAvailabilityResponse transportAvailabilityResponse, DataCenterAddressResult dataCenterAddressResponse, Dictionary serializedAdditionalRawData) { ScheduleAvailabilityResponse = scheduleAvailabilityResponse; TransportAvailabilityResponse = transportAvailabilityResponse; DataCenterAddressResponse = dataCenterAddressResponse; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Schedule availability for given sku in a region. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.Serialization.cs index 420e9efdeb74..6272dee822ab 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.Serialization.cs @@ -5,31 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ReverseShippingDetails : IUtf8JsonSerializable + public partial class ReverseShippingDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContactDetails)) { writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ReverseShippingDetails DeserializeReverseShippingDetails(JsonElement element) + internal static ReverseShippingDetails DeserializeReverseShippingDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +73,7 @@ internal static ReverseShippingDetails DeserializeReverseShippingDetails(JsonEle Optional contactDetails = default; Optional shippingAddress = default; Optional isUpdated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contactDetails"u8)) @@ -66,8 +103,61 @@ internal static ReverseShippingDetails DeserializeReverseShippingDetails(JsonEle isUpdated = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ReverseShippingDetails(contactDetails.Value, shippingAddress.Value, Optional.ToNullable(isUpdated), serializedAdditionalRawData); + } + + ReverseShippingDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeReverseShippingDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ReverseShippingDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeReverseShippingDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ReverseShippingDetails model) + { + if (model is null) + { + return null; } - return new ReverseShippingDetails(contactDetails.Value, shippingAddress.Value, Optional.ToNullable(isUpdated)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ReverseShippingDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeReverseShippingDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.cs index 6432e59432b7..271a77ef6099 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ReverseShippingDetails.cs @@ -5,28 +5,36 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Reverse Shipping Address and contact details for a job. public partial class ReverseShippingDetails { - /// Initializes a new instance of ReverseShippingDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ReverseShippingDetails() { } - /// Initializes a new instance of ReverseShippingDetails. + /// Initializes a new instance of . /// Contact Info. /// Shipping address where customer wishes to receive the device. /// /// A flag to indicate whether Reverse Shipping details are updated or not after device has been prepared. /// Read only field /// - internal ReverseShippingDetails(ContactInfo contactDetails, DataBoxShippingAddress shippingAddress, bool? isUpdated) + /// Keeps track of any properties unknown to the library. + internal ReverseShippingDetails(ContactInfo contactDetails, DataBoxShippingAddress shippingAddress, bool? isUpdated, Dictionary serializedAdditionalRawData) { ContactDetails = contactDetails; ShippingAddress = shippingAddress; IsUpdated = isUpdated; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Contact Info. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.Serialization.cs index 62e2ade840c6..abae2a1cb1f1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ScheduleAvailabilityContent : IUtf8JsonSerializable + public partial class ScheduleAvailabilityContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageLocation"u8); writer.WriteStringValue(StorageLocation); @@ -24,7 +32,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("country"u8); writer.WriteStringValue(Country); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ScheduleAvailabilityContent DeserializeScheduleAvailabilityContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("skuName", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DataBox": return DataBoxScheduleAvailabilityContent.DeserializeDataBoxScheduleAvailabilityContent(element); + case "DataBoxDisk": return DiskScheduleAvailabilityContent.DeserializeDiskScheduleAvailabilityContent(element); + case "DataBoxHeavy": return HeavyScheduleAvailabilityContent.DeserializeHeavyScheduleAvailabilityContent(element); + } + } + + // Unknown type found so we will deserialize the base properties only + AzureLocation storageLocation = default; + DataBoxSkuName skuName = default; + Optional country = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageLocation"u8)) + { + storageLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Models.ScheduleAvailabilityContent(storageLocation, skuName, country.Value, serializedAdditionalRawData); + } + + ScheduleAvailabilityContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleAvailabilityContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduleAvailabilityContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduleAvailabilityContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduleAvailabilityContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduleAvailabilityContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduleAvailabilityContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.cs index 689be8a671a2..7d8820e29877 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -16,13 +18,34 @@ namespace Azure.ResourceManager.DataBox.Models /// public abstract partial class ScheduleAvailabilityContent { - /// Initializes a new instance of ScheduleAvailabilityContent. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. protected ScheduleAvailabilityContent(AzureLocation storageLocation) { StorageLocation = storageLocation; } + /// Initializes a new instance of . + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Sku Name for which the order is to be scheduled. + /// Country in which storage location should be supported. + /// Keeps track of any properties unknown to the library. + internal ScheduleAvailabilityContent(AzureLocation storageLocation, DataBoxSkuName skuName, string country, Dictionary serializedAdditionalRawData) + { + StorageLocation = storageLocation; + SkuName = skuName; + Country = country; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScheduleAvailabilityContent() + { + } + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. public AzureLocation StorageLocation { get; } /// Sku Name for which the order is to be scheduled. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.Serialization.cs index 418bc2d261f6..3694f0083569 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.Serialization.cs @@ -8,19 +8,46 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class ScheduleAvailabilityResponse + internal partial class ScheduleAvailabilityResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ScheduleAvailabilityResponse DeserializeScheduleAvailabilityResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ScheduleAvailabilityResponse DeserializeScheduleAvailabilityResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> availableDates = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("availableDates"u8)) @@ -37,8 +64,61 @@ internal static ScheduleAvailabilityResponse DeserializeScheduleAvailabilityResp availableDates = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ScheduleAvailabilityResponse(Optional.ToList(availableDates)); + return new ScheduleAvailabilityResponse(Optional.ToList(availableDates), serializedAdditionalRawData); + } + + ScheduleAvailabilityResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleAvailabilityResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduleAvailabilityResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduleAvailabilityResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduleAvailabilityResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduleAvailabilityResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduleAvailabilityResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.cs index dff05d6e6723..01f90caeac21 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ScheduleAvailabilityResponse.cs @@ -14,17 +14,22 @@ namespace Azure.ResourceManager.DataBox.Models /// Schedule availability for given sku in a region. internal partial class ScheduleAvailabilityResponse { - /// Initializes a new instance of ScheduleAvailabilityResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ScheduleAvailabilityResponse() { AvailableDates = new ChangeTrackingList(); } - /// Initializes a new instance of ScheduleAvailabilityResponse. + /// Initializes a new instance of . /// List of dates available to schedule. - internal ScheduleAvailabilityResponse(IReadOnlyList availableDates) + /// Keeps track of any properties unknown to the library. + internal ScheduleAvailabilityResponse(IReadOnlyList availableDates, Dictionary serializedAdditionalRawData) { AvailableDates = availableDates; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of dates available to schedule. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.Serialization.cs index 56cdc9403da0..e59d7be58b7f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ShareCredentialDetails + public partial class ShareCredentialDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ShareCredentialDetails DeserializeShareCredentialDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ShareCredentialDetails DeserializeShareCredentialDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static ShareCredentialDetails DeserializeShareCredentialDetails(JsonEle Optional userName = default; Optional password = default; Optional> supportedAccessProtocols = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shareName"u8)) @@ -64,8 +92,61 @@ internal static ShareCredentialDetails DeserializeShareCredentialDetails(JsonEle supportedAccessProtocols = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ShareCredentialDetails(shareName.Value, Optional.ToNullable(shareType), userName.Value, password.Value, Optional.ToList(supportedAccessProtocols)); + return new ShareCredentialDetails(shareName.Value, Optional.ToNullable(shareType), userName.Value, password.Value, Optional.ToList(supportedAccessProtocols), serializedAdditionalRawData); + } + + ShareCredentialDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShareCredentialDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShareCredentialDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShareCredentialDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShareCredentialDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShareCredentialDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShareCredentialDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.cs index 5abaa9f0b188..4976415f233d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShareCredentialDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,25 +14,30 @@ namespace Azure.ResourceManager.DataBox.Models /// Credential details of the shares in account. public partial class ShareCredentialDetails { - /// Initializes a new instance of ShareCredentialDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ShareCredentialDetails() { SupportedAccessProtocols = new ChangeTrackingList(); } - /// Initializes a new instance of ShareCredentialDetails. + /// Initializes a new instance of . /// Name of the share. /// Type of the share. /// User name for the share. /// Password for the share. /// Access protocols supported on the device. - internal ShareCredentialDetails(string shareName, ShareDestinationFormatType? shareType, string userName, string password, IReadOnlyList supportedAccessProtocols) + /// Keeps track of any properties unknown to the library. + internal ShareCredentialDetails(string shareName, ShareDestinationFormatType? shareType, string userName, string password, IReadOnlyList supportedAccessProtocols, Dictionary serializedAdditionalRawData) { ShareName = shareName; ShareType = shareType; UserName = userName; Password = password; SupportedAccessProtocols = supportedAccessProtocols; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the share. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.Serialization.cs index fbb6c73a2f60..93731ded84db 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class ShipmentPickUpContent : IUtf8JsonSerializable + public partial class ShipmentPickUpContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("startTime"u8); writer.WriteStringValue(StartOn, "O"); @@ -21,7 +29,105 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(EndOn, "O"); writer.WritePropertyName("shipmentLocation"u8); writer.WriteStringValue(ShipmentLocation); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ShipmentPickUpContent DeserializeShipmentPickUpContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset startTime = default; + DateTimeOffset endTime = default; + string shipmentLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime"u8)) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("shipmentLocation"u8)) + { + shipmentLocation = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ShipmentPickUpContent(startTime, endTime, shipmentLocation, serializedAdditionalRawData); + } + + ShipmentPickUpContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShipmentPickUpContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShipmentPickUpContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShipmentPickUpContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShipmentPickUpContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShipmentPickUpContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShipmentPickUpContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.cs index c4e03d245e46..1313c75be3ea 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/ShipmentPickUpContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Shipment pick up request details. public partial class ShipmentPickUpContent { - /// Initializes a new instance of ShipmentPickUpContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Minimum date after which the pick up should commence, this must be in local time of pick up area. /// Maximum date before which the pick up should commence, this must be in local time of pick up area. /// Shipment Location in the pickup place. Eg.front desk. @@ -27,6 +31,24 @@ public ShipmentPickUpContent(DateTimeOffset startOn, DateTimeOffset endOn, strin ShipmentLocation = shipmentLocation; } + /// Initializes a new instance of . + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. + /// Maximum date before which the pick up should commence, this must be in local time of pick up area. + /// Shipment Location in the pickup place. Eg.front desk. + /// Keeps track of any properties unknown to the library. + internal ShipmentPickUpContent(DateTimeOffset startOn, DateTimeOffset endOn, string shipmentLocation, Dictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + ShipmentLocation = shipmentLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ShipmentPickUpContent() + { + } + /// Minimum date after which the pick up should commence, this must be in local time of pick up area. public DateTimeOffset StartOn { get; } /// Maximum date before which the pick up should commence, this must be in local time of pick up area. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.Serialization.cs index 4564ef1f614e..e54d567137ad 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class SkuAvailabilityValidationContent : IUtf8JsonSerializable + public partial class SkuAvailabilityValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("deviceType"u8); writer.WriteStringValue(DeviceType.ToSerialString()); @@ -25,7 +33,117 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Location); writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SkuAvailabilityValidationContent DeserializeSkuAvailabilityValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataBoxSkuName deviceType = default; + DataBoxJobTransferType transferType = default; + string country = default; + AzureLocation location = default; + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deviceType"u8)) + { + deviceType = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (property.NameEquals("transferType"u8)) + { + transferType = property.Value.GetString().ToDataBoxJobTransferType(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SkuAvailabilityValidationContent(validationType, deviceType, transferType, country, location, serializedAdditionalRawData); + } + + SkuAvailabilityValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSkuAvailabilityValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SkuAvailabilityValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSkuAvailabilityValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SkuAvailabilityValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SkuAvailabilityValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSkuAvailabilityValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.cs index 4ea764a9e5ad..d23c09d00870 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBox.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataBox.Models /// Request to validate sku availability. public partial class SkuAvailabilityValidationContent : DataBoxValidationInputContent { - /// Initializes a new instance of SkuAvailabilityValidationContent. + /// Initializes a new instance of . /// Device type to be used for the job. /// Type of the transfer. /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. @@ -30,6 +31,27 @@ public SkuAvailabilityValidationContent(DataBoxSkuName deviceType, DataBoxJobTra ValidationType = DataBoxValidationInputDiscriminator.ValidateSkuAvailability; } + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// Device type to be used for the job. + /// Type of the transfer. + /// ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements. + /// Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01. + /// Keeps track of any properties unknown to the library. + internal SkuAvailabilityValidationContent(DataBoxValidationInputDiscriminator validationType, DataBoxSkuName deviceType, DataBoxJobTransferType transferType, string country, AzureLocation location, Dictionary serializedAdditionalRawData) : base(validationType, serializedAdditionalRawData) + { + DeviceType = deviceType; + TransferType = transferType; + Country = country; + Location = location; + ValidationType = validationType; + } + + /// Initializes a new instance of for deserialization. + internal SkuAvailabilityValidationContent() + { + } + /// Device type to be used for the job. public DataBoxSkuName DeviceType { get; } /// Type of the transfer. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.Serialization.cs index eb388494fd86..e67cba98cd84 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class SkuAvailabilityValidationResult + public partial class SkuAvailabilityValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SkuAvailabilityValidationResult DeserializeSkuAvailabilityValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SkuAvailabilityValidationResult DeserializeSkuAvailabilityValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +51,7 @@ internal static SkuAvailabilityValidationResult DeserializeSkuAvailabilityValida Optional status = default; DataBoxValidationInputDiscriminator validationType = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -47,8 +77,61 @@ internal static SkuAvailabilityValidationResult DeserializeSkuAvailabilityValida error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SkuAvailabilityValidationResult(validationType, error.Value, Optional.ToNullable(status)); + return new SkuAvailabilityValidationResult(validationType, error.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + SkuAvailabilityValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSkuAvailabilityValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SkuAvailabilityValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSkuAvailabilityValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SkuAvailabilityValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SkuAvailabilityValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSkuAvailabilityValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.cs index e4502915f0e3..496c89f95588 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SkuAvailabilityValidationResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.DataBox.Models /// Properties of sku availability validation response. public partial class SkuAvailabilityValidationResult : DataBoxValidationInputResult { - /// Initializes a new instance of SkuAvailabilityValidationResult. + /// Initializes a new instance of . internal SkuAvailabilityValidationResult() { ValidationType = DataBoxValidationInputDiscriminator.ValidateSkuAvailability; } - /// Initializes a new instance of SkuAvailabilityValidationResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// Sku availability validation status. - internal SkuAvailabilityValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal SkuAvailabilityValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { Status = status; ValidationType = validationType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.Serialization.cs index e022a8780e7c..d65f11270e5d 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class SubscriptionIsAllowedToCreateJobValidationContent : IUtf8JsonSerializable + public partial class SubscriptionIsAllowedToCreateJobValidationContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("validationType"u8); writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static SubscriptionIsAllowedToCreateJobValidationContent DeserializeSubscriptionIsAllowedToCreateJobValidationContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataBoxValidationInputDiscriminator validationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("validationType"u8)) + { + validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SubscriptionIsAllowedToCreateJobValidationContent(validationType, serializedAdditionalRawData); + } + + SubscriptionIsAllowedToCreateJobValidationContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionIsAllowedToCreateJobValidationContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionIsAllowedToCreateJobValidationContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionIsAllowedToCreateJobValidationContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionIsAllowedToCreateJobValidationContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionIsAllowedToCreateJobValidationContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionIsAllowedToCreateJobValidationContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.cs index 8c029a8a3386..52bb9ae327b1 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationContent.cs @@ -5,15 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Request to validate subscription permission to create jobs. public partial class SubscriptionIsAllowedToCreateJobValidationContent : DataBoxValidationInputContent { - /// Initializes a new instance of SubscriptionIsAllowedToCreateJobValidationContent. + /// Initializes a new instance of . public SubscriptionIsAllowedToCreateJobValidationContent() { ValidationType = DataBoxValidationInputDiscriminator.ValidateSubscriptionIsAllowedToCreateJob; } + + /// Initializes a new instance of . + /// Identifies the type of validation request. + /// Keeps track of any properties unknown to the library. + internal SubscriptionIsAllowedToCreateJobValidationContent(DataBoxValidationInputDiscriminator validationType, Dictionary serializedAdditionalRawData) : base(validationType, serializedAdditionalRawData) + { + ValidationType = validationType; + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.Serialization.cs index 1703dc8c8f13..cd27b798cead 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.Serialization.cs @@ -5,16 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class SubscriptionIsAllowedToCreateJobValidationResult + public partial class SubscriptionIsAllowedToCreateJobValidationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SubscriptionIsAllowedToCreateJobValidationResult DeserializeSubscriptionIsAllowedToCreateJobValidationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SubscriptionIsAllowedToCreateJobValidationResult DeserializeSubscriptionIsAllowedToCreateJobValidationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +51,7 @@ internal static SubscriptionIsAllowedToCreateJobValidationResult DeserializeSubs Optional status = default; DataBoxValidationInputDiscriminator validationType = default; Optional error = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -47,8 +77,61 @@ internal static SubscriptionIsAllowedToCreateJobValidationResult DeserializeSubs error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SubscriptionIsAllowedToCreateJobValidationResult(validationType, error.Value, Optional.ToNullable(status)); + return new SubscriptionIsAllowedToCreateJobValidationResult(validationType, error.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + SubscriptionIsAllowedToCreateJobValidationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionIsAllowedToCreateJobValidationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionIsAllowedToCreateJobValidationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionIsAllowedToCreateJobValidationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionIsAllowedToCreateJobValidationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionIsAllowedToCreateJobValidationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionIsAllowedToCreateJobValidationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.cs index 1a34ab621d8d..9805c399cf45 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/SubscriptionIsAllowedToCreateJobValidationResult.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,17 +14,18 @@ namespace Azure.ResourceManager.DataBox.Models /// Properties of subscription permission to create job validation response. public partial class SubscriptionIsAllowedToCreateJobValidationResult : DataBoxValidationInputResult { - /// Initializes a new instance of SubscriptionIsAllowedToCreateJobValidationResult. + /// Initializes a new instance of . internal SubscriptionIsAllowedToCreateJobValidationResult() { ValidationType = DataBoxValidationInputDiscriminator.ValidateSubscriptionIsAllowedToCreateJob; } - /// Initializes a new instance of SubscriptionIsAllowedToCreateJobValidationResult. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. /// Validation status of subscription permission to create job. - internal SubscriptionIsAllowedToCreateJobValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal SubscriptionIsAllowedToCreateJobValidationResult(DataBoxValidationInputDiscriminator validationType, ResponseError error, DataBoxValidationStatus? status, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { Status = status; ValidationType = validationType; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.Serialization.cs index 3504c98e6aad..cde96af26c4b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class TransferAllDetails : IUtf8JsonSerializable + public partial class TransferAllDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dataAccountType"u8); writer.WriteStringValue(DataAccountType.ToSerialString()); @@ -27,11 +35,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("transferAllFiles"u8); writer.WriteBooleanValue(TransferAllFiles.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TransferAllDetails DeserializeTransferAllDetails(JsonElement element) + internal static TransferAllDetails DeserializeTransferAllDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +61,7 @@ internal static TransferAllDetails DeserializeTransferAllDetails(JsonElement ele DataAccountType dataAccountType = default; Optional transferAllBlobs = default; Optional transferAllFiles = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataAccountType"u8)) @@ -64,8 +87,61 @@ internal static TransferAllDetails DeserializeTransferAllDetails(JsonElement ele transferAllFiles = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferAllDetails(dataAccountType, Optional.ToNullable(transferAllBlobs), Optional.ToNullable(transferAllFiles), serializedAdditionalRawData); + } + + TransferAllDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferAllDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferAllDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferAllDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferAllDetails model) + { + if (model is null) + { + return null; } - return new TransferAllDetails(dataAccountType, Optional.ToNullable(transferAllBlobs), Optional.ToNullable(transferAllFiles)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferAllDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferAllDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.cs index 07731bfacc9b..1e4659293429 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferAllDetails.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Details to transfer all data. public partial class TransferAllDetails { - /// Initializes a new instance of TransferAllDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the account of data. public TransferAllDetails(DataAccountType dataAccountType) { DataAccountType = dataAccountType; } - /// Initializes a new instance of TransferAllDetails. + /// Initializes a new instance of . /// Type of the account of data. /// To indicate if all Azure blobs have to be transferred. /// To indicate if all Azure Files have to be transferred. - internal TransferAllDetails(DataAccountType dataAccountType, bool? transferAllBlobs, bool? transferAllFiles) + /// Keeps track of any properties unknown to the library. + internal TransferAllDetails(DataAccountType dataAccountType, bool? transferAllBlobs, bool? transferAllFiles, Dictionary serializedAdditionalRawData) { DataAccountType = dataAccountType; TransferAllBlobs = transferAllBlobs; TransferAllFiles = transferAllFiles; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TransferAllDetails() + { } /// Type of the account of data. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.Serialization.cs index 797dd511218a..9533794da3b9 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.Serialization.cs @@ -5,33 +5,69 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class TransferConfiguration : IUtf8JsonSerializable + public partial class TransferConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("transferConfigurationType"u8); writer.WriteStringValue(TransferConfigurationType.ToSerialString()); if (Optional.IsDefined(TransferFilterDetails)) { writer.WritePropertyName("transferFilterDetails"u8); - writer.WriteObjectValue(TransferFilterDetails); + if (TransferFilterDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransferFilterDetails).Serialize(writer, options); + } } if (Optional.IsDefined(TransferAllDetails)) { writer.WritePropertyName("transferAllDetails"u8); - writer.WriteObjectValue(TransferAllDetails); + if (TransferAllDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)TransferAllDetails).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static TransferConfiguration DeserializeTransferConfiguration(JsonElement element) + internal static TransferConfiguration DeserializeTransferConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +75,7 @@ internal static TransferConfiguration DeserializeTransferConfiguration(JsonEleme TransferConfigurationType transferConfigurationType = default; Optional transferFilterDetails = default; Optional transferAllDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("transferConfigurationType"u8)) @@ -64,8 +101,61 @@ internal static TransferConfiguration DeserializeTransferConfiguration(JsonEleme transferAllDetails = TransferConfigurationTransferAllDetails.DeserializeTransferConfigurationTransferAllDetails(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferConfiguration(transferConfigurationType, transferFilterDetails.Value, transferAllDetails.Value, serializedAdditionalRawData); + } + + TransferConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferConfiguration model) + { + if (model is null) + { + return null; } - return new TransferConfiguration(transferConfigurationType, transferFilterDetails.Value, transferAllDetails.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.cs index 27ecf7e6fcbd..9f428127eac8 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfiguration.cs @@ -5,27 +5,40 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Configuration for defining the transfer of data. public partial class TransferConfiguration { - /// Initializes a new instance of TransferConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the configuration for transfer. public TransferConfiguration(TransferConfigurationType transferConfigurationType) { TransferConfigurationType = transferConfigurationType; } - /// Initializes a new instance of TransferConfiguration. + /// Initializes a new instance of . /// Type of the configuration for transfer. /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter. /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll. - internal TransferConfiguration(TransferConfigurationType transferConfigurationType, TransferConfigurationTransferFilterDetails transferFilterDetails, TransferConfigurationTransferAllDetails transferAllDetails) + /// Keeps track of any properties unknown to the library. + internal TransferConfiguration(TransferConfigurationType transferConfigurationType, TransferConfigurationTransferFilterDetails transferFilterDetails, TransferConfigurationTransferAllDetails transferAllDetails, Dictionary serializedAdditionalRawData) { TransferConfigurationType = transferConfigurationType; TransferFilterDetails = transferFilterDetails; TransferAllDetails = transferAllDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TransferConfiguration() + { } /// Type of the configuration for transfer. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.Serialization.cs index 271890522d44..c6e9c4a9a1f7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class TransferConfigurationTransferAllDetails : IUtf8JsonSerializable + internal partial class TransferConfigurationTransferAllDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Include)) { writer.WritePropertyName("include"u8); - writer.WriteObjectValue(Include); + if (Include is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Include).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static TransferConfigurationTransferAllDetails DeserializeTransferConfigurationTransferAllDetails(JsonElement element) + internal static TransferConfigurationTransferAllDetails DeserializeTransferConfigurationTransferAllDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional include = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("include"u8)) @@ -41,8 +71,61 @@ internal static TransferConfigurationTransferAllDetails DeserializeTransferConfi include = TransferAllDetails.DeserializeTransferAllDetails(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferConfigurationTransferAllDetails(include.Value, serializedAdditionalRawData); + } + + TransferConfigurationTransferAllDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferConfigurationTransferAllDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferConfigurationTransferAllDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferConfigurationTransferAllDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferConfigurationTransferAllDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferConfigurationTransferAllDetails(Response response) + { + if (response is null) + { + return null; } - return new TransferConfigurationTransferAllDetails(include.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferConfigurationTransferAllDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.cs index 4362be907b3f..104d52195984 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferAllDetails.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Map of filter type and the details to transfer all data. This field is required only if the TransferConfigurationType is given as TransferAll. internal partial class TransferConfigurationTransferAllDetails { - /// Initializes a new instance of TransferConfigurationTransferAllDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TransferConfigurationTransferAllDetails() { } - /// Initializes a new instance of TransferConfigurationTransferAllDetails. + /// Initializes a new instance of . /// Details to transfer all data. - internal TransferConfigurationTransferAllDetails(TransferAllDetails include) + /// Keeps track of any properties unknown to the library. + internal TransferConfigurationTransferAllDetails(TransferAllDetails include, Dictionary serializedAdditionalRawData) { Include = include; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Details to transfer all data. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.Serialization.cs index 88490ebd082d..69aeef4f2897 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class TransferConfigurationTransferFilterDetails : IUtf8JsonSerializable + internal partial class TransferConfigurationTransferFilterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Include)) { writer.WritePropertyName("include"u8); - writer.WriteObjectValue(Include); + if (Include is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Include).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static TransferConfigurationTransferFilterDetails DeserializeTransferConfigurationTransferFilterDetails(JsonElement element) + internal static TransferConfigurationTransferFilterDetails DeserializeTransferConfigurationTransferFilterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional include = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("include"u8)) @@ -41,8 +71,61 @@ internal static TransferConfigurationTransferFilterDetails DeserializeTransferCo include = TransferFilterDetails.DeserializeTransferFilterDetails(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferConfigurationTransferFilterDetails(include.Value, serializedAdditionalRawData); + } + + TransferConfigurationTransferFilterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferConfigurationTransferFilterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferConfigurationTransferFilterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferConfigurationTransferFilterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferConfigurationTransferFilterDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferConfigurationTransferFilterDetails(Response response) + { + if (response is null) + { + return null; } - return new TransferConfigurationTransferFilterDetails(include.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferConfigurationTransferFilterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.cs index 723c3d4f86be..0b9481ccc8c0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferConfigurationTransferFilterDetails.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Map of filter type and the details to filter. This field is required only if the TransferConfigurationType is given as TransferUsingFilter. internal partial class TransferConfigurationTransferFilterDetails { - /// Initializes a new instance of TransferConfigurationTransferFilterDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TransferConfigurationTransferFilterDetails() { } - /// Initializes a new instance of TransferConfigurationTransferFilterDetails. + /// Initializes a new instance of . /// Details of the filtering the transfer of data. - internal TransferConfigurationTransferFilterDetails(TransferFilterDetails include) + /// Keeps track of any properties unknown to the library. + internal TransferConfigurationTransferFilterDetails(TransferFilterDetails include, Dictionary serializedAdditionalRawData) { Include = include; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Details of the filtering the transfer of data. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.Serialization.cs index 8cc3852e8266..a22498c4bd67 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.Serialization.cs @@ -5,28 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class TransferFilterDetails : IUtf8JsonSerializable + public partial class TransferFilterDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dataAccountType"u8); writer.WriteStringValue(DataAccountType.ToSerialString()); if (Optional.IsDefined(BlobFilterDetails)) { writer.WritePropertyName("blobFilterDetails"u8); - writer.WriteObjectValue(BlobFilterDetails); + if (BlobFilterDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)BlobFilterDetails).Serialize(writer, options); + } } if (Optional.IsDefined(AzureFileFilterDetails)) { writer.WritePropertyName("azureFileFilterDetails"u8); - writer.WriteObjectValue(AzureFileFilterDetails); + if (AzureFileFilterDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureFileFilterDetails).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(FilterFileDetails)) { @@ -34,15 +55,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FilterFileDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TransferFilterDetails DeserializeTransferFilterDetails(JsonElement element) + internal static TransferFilterDetails DeserializeTransferFilterDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +93,7 @@ internal static TransferFilterDetails DeserializeTransferFilterDetails(JsonEleme Optional blobFilterDetails = default; Optional azureFileFilterDetails = default; Optional> filterFileDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dataAccountType"u8)) @@ -90,8 +133,61 @@ internal static TransferFilterDetails DeserializeTransferFilterDetails(JsonEleme filterFileDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransferFilterDetails(dataAccountType, blobFilterDetails.Value, azureFileFilterDetails.Value, Optional.ToList(filterFileDetails), serializedAdditionalRawData); + } + + TransferFilterDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransferFilterDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransferFilterDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransferFilterDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransferFilterDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransferFilterDetails(Response response) + { + if (response is null) + { + return null; } - return new TransferFilterDetails(dataAccountType, blobFilterDetails.Value, azureFileFilterDetails.Value, Optional.ToList(filterFileDetails)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransferFilterDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.cs index f2b5cd780a82..813591c486ba 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransferFilterDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBox.Models /// Details of the filtering the transfer of data. public partial class TransferFilterDetails { - /// Initializes a new instance of TransferFilterDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the account of data. public TransferFilterDetails(DataAccountType dataAccountType) { @@ -21,17 +25,24 @@ public TransferFilterDetails(DataAccountType dataAccountType) FilterFileDetails = new ChangeTrackingList(); } - /// Initializes a new instance of TransferFilterDetails. + /// Initializes a new instance of . /// Type of the account of data. /// Filter details to transfer blobs. /// Filter details to transfer Azure files. /// Details of the filter files to be used for data transfer. - internal TransferFilterDetails(DataAccountType dataAccountType, BlobFilterDetails blobFilterDetails, AzureFileFilterDetails azureFileFilterDetails, IList filterFileDetails) + /// Keeps track of any properties unknown to the library. + internal TransferFilterDetails(DataAccountType dataAccountType, BlobFilterDetails blobFilterDetails, AzureFileFilterDetails azureFileFilterDetails, IList filterFileDetails, Dictionary serializedAdditionalRawData) { DataAccountType = dataAccountType; BlobFilterDetails = blobFilterDetails; AzureFileFilterDetails = azureFileFilterDetails; FilterFileDetails = filterFileDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TransferFilterDetails() + { } /// Type of the account of data. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.Serialization.cs index 39550db868e3..2f61a070ebaa 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.Serialization.cs @@ -5,20 +5,49 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class TransportAvailabilityDetails + public partial class TransportAvailabilityDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TransportAvailabilityDetails DeserializeTransportAvailabilityDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TransportAvailabilityDetails DeserializeTransportAvailabilityDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional shipmentType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shipmentType"u8)) @@ -30,8 +59,61 @@ internal static TransportAvailabilityDetails DeserializeTransportAvailabilityDet shipmentType = property.Value.GetString().ToTransportShipmentType(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TransportAvailabilityDetails(Optional.ToNullable(shipmentType)); + return new TransportAvailabilityDetails(Optional.ToNullable(shipmentType), serializedAdditionalRawData); + } + + TransportAvailabilityDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransportAvailabilityDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransportAvailabilityDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransportAvailabilityDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransportAvailabilityDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransportAvailabilityDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransportAvailabilityDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.cs index dfd2e7ab3dab..957088ddd0f2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityDetails.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Transport options availability details for given region. public partial class TransportAvailabilityDetails { - /// Initializes a new instance of TransportAvailabilityDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TransportAvailabilityDetails() { } - /// Initializes a new instance of TransportAvailabilityDetails. + /// Initializes a new instance of . /// Transport Shipment Type supported for given region. - internal TransportAvailabilityDetails(TransportShipmentType? shipmentType) + /// Keeps track of any properties unknown to the library. + internal TransportAvailabilityDetails(TransportShipmentType? shipmentType, Dictionary serializedAdditionalRawData) { ShipmentType = shipmentType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Transport Shipment Type supported for given region. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.Serialization.cs index 927822440d26..d61894385cc0 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class TransportAvailabilityRequest : IUtf8JsonSerializable + internal partial class TransportAvailabilityRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SkuName)) { writer.WritePropertyName("skuName"u8); writer.WriteStringValue(SkuName.Value.ToSerialString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static TransportAvailabilityRequest DeserializeTransportAvailabilityRequest(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional skuName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("skuName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + skuName = property.Value.GetString().ToDataBoxSkuName(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransportAvailabilityRequest(Optional.ToNullable(skuName), serializedAdditionalRawData); + } + + TransportAvailabilityRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransportAvailabilityRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransportAvailabilityRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransportAvailabilityRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransportAvailabilityRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransportAvailabilityRequest(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransportAvailabilityRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.cs index 812fca99718b..550b18ca4a54 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityRequest.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Request body to get the transport availability for given sku. internal partial class TransportAvailabilityRequest { - /// Initializes a new instance of TransportAvailabilityRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TransportAvailabilityRequest() { } + /// Initializes a new instance of . + /// Type of the device. + /// Keeps track of any properties unknown to the library. + internal TransportAvailabilityRequest(DataBoxSkuName? skuName, Dictionary serializedAdditionalRawData) + { + SkuName = skuName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Type of the device. public DataBoxSkuName? SkuName { get; set; } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.Serialization.cs index 8dfd8f0dbcca..870a6cbdf0ab 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.Serialization.cs @@ -5,21 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class TransportAvailabilityResponse + internal partial class TransportAvailabilityResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TransportAvailabilityResponse DeserializeTransportAvailabilityResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TransportAvailabilityResponse DeserializeTransportAvailabilityResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> transportAvailabilityDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("transportAvailabilityDetails"u8)) @@ -36,8 +64,61 @@ internal static TransportAvailabilityResponse DeserializeTransportAvailabilityRe transportAvailabilityDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TransportAvailabilityResponse(Optional.ToList(transportAvailabilityDetails)); + return new TransportAvailabilityResponse(Optional.ToList(transportAvailabilityDetails), serializedAdditionalRawData); + } + + TransportAvailabilityResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransportAvailabilityResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransportAvailabilityResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransportAvailabilityResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransportAvailabilityResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransportAvailabilityResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransportAvailabilityResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.cs index 2034b650c179..de07b62187d2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportAvailabilityResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.DataBox.Models /// Transport options available for given sku in a region. internal partial class TransportAvailabilityResponse { - /// Initializes a new instance of TransportAvailabilityResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TransportAvailabilityResponse() { TransportAvailabilityDetails = new ChangeTrackingList(); } - /// Initializes a new instance of TransportAvailabilityResponse. + /// Initializes a new instance of . /// List of transport availability details for given region. - internal TransportAvailabilityResponse(IReadOnlyList transportAvailabilityDetails) + /// Keeps track of any properties unknown to the library. + internal TransportAvailabilityResponse(IReadOnlyList transportAvailabilityDetails, Dictionary serializedAdditionalRawData) { TransportAvailabilityDetails = transportAvailabilityDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of transport availability details for given region. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.Serialization.cs index 68ad63b6db8f..cbc309bcde02 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.Serialization.cs @@ -5,29 +5,52 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class TransportPreferences : IUtf8JsonSerializable + public partial class TransportPreferences : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("preferredShipmentType"u8); writer.WriteStringValue(PreferredShipmentType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TransportPreferences DeserializeTransportPreferences(JsonElement element) + internal static TransportPreferences DeserializeTransportPreferences(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } TransportShipmentType preferredShipmentType = default; Optional isUpdated = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("preferredShipmentType"u8)) @@ -44,8 +67,61 @@ internal static TransportPreferences DeserializeTransportPreferences(JsonElement isUpdated = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TransportPreferences(preferredShipmentType, Optional.ToNullable(isUpdated), serializedAdditionalRawData); + } + + TransportPreferences IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTransportPreferences(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TransportPreferences IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTransportPreferences(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TransportPreferences model) + { + if (model is null) + { + return null; } - return new TransportPreferences(preferredShipmentType, Optional.ToNullable(isUpdated)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TransportPreferences(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTransportPreferences(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.cs index e73c3d03e496..6afb0696ec1e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/TransportPreferences.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Preferences related to the shipment logistics of the sku. public partial class TransportPreferences { - /// Initializes a new instance of TransportPreferences. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Indicates Shipment Logistics type that the customer preferred. public TransportPreferences(TransportShipmentType preferredShipmentType) { PreferredShipmentType = preferredShipmentType; } - /// Initializes a new instance of TransportPreferences. + /// Initializes a new instance of . /// Indicates Shipment Logistics type that the customer preferred. /// Read only property which indicates whether transport preferences has been updated or not after device is prepared. - internal TransportPreferences(TransportShipmentType preferredShipmentType, bool? isUpdated) + /// Keeps track of any properties unknown to the library. + internal TransportPreferences(TransportShipmentType preferredShipmentType, bool? isUpdated, Dictionary serializedAdditionalRawData) { PreferredShipmentType = preferredShipmentType; IsUpdated = isUpdated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TransportPreferences() + { } /// Indicates Shipment Logistics type that the customer preferred. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.Serialization.cs index 0e801cb06f35..4b5ab2289529 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class UnencryptedCredentials + public partial class UnencryptedCredentials : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnencryptedCredentials DeserializeUnencryptedCredentials(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnencryptedCredentials DeserializeUnencryptedCredentials(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional jobName = default; Optional jobSecrets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobName"u8)) @@ -36,8 +65,61 @@ internal static UnencryptedCredentials DeserializeUnencryptedCredentials(JsonEle jobSecrets = JobSecrets.DeserializeJobSecrets(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UnencryptedCredentials(jobName.Value, jobSecrets.Value); + return new UnencryptedCredentials(jobName.Value, jobSecrets.Value, serializedAdditionalRawData); + } + + UnencryptedCredentials IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnencryptedCredentials(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnencryptedCredentials IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnencryptedCredentials(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnencryptedCredentials model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnencryptedCredentials(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnencryptedCredentials(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.cs index 85a0fd9399fa..90d801463917 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentials.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Unencrypted credentials for accessing device. public partial class UnencryptedCredentials { - /// Initializes a new instance of UnencryptedCredentials. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UnencryptedCredentials() { } - /// Initializes a new instance of UnencryptedCredentials. + /// Initializes a new instance of . /// Name of the job. /// /// Secrets related to this job. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// - internal UnencryptedCredentials(string jobName, JobSecrets jobSecrets) + /// Keeps track of any properties unknown to the library. + internal UnencryptedCredentials(string jobName, JobSecrets jobSecrets, Dictionary serializedAdditionalRawData) { JobName = jobName; JobSecrets = jobSecrets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the job. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.Serialization.cs index fb0e0d9885f8..8db31d9f02c7 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnencryptedCredentialsList + internal partial class UnencryptedCredentialsList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnencryptedCredentialsList DeserializeUnencryptedCredentialsList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UnencryptedCredentialsList DeserializeUnencryptedCredentialsList(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static UnencryptedCredentialsList DeserializeUnencryptedCredentialsList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UnencryptedCredentialsList(Optional.ToList(value), nextLink.Value); + return new UnencryptedCredentialsList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + UnencryptedCredentialsList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnencryptedCredentialsList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UnencryptedCredentialsList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUnencryptedCredentialsList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UnencryptedCredentialsList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UnencryptedCredentialsList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUnencryptedCredentialsList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.cs index be3899db9185..99c1b69f2303 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnencryptedCredentialsList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataBox.Models /// List of unencrypted credentials for accessing device. internal partial class UnencryptedCredentialsList { - /// Initializes a new instance of UnencryptedCredentialsList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UnencryptedCredentialsList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UnencryptedCredentialsList. + /// Initializes a new instance of . /// List of unencrypted credentials. /// Link for the next set of unencrypted credentials. - internal UnencryptedCredentialsList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UnencryptedCredentialsList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of unencrypted credentials. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.Serialization.cs index fc0e1e73270e..b7c8ff28c613 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.Serialization.cs @@ -5,29 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownCopyLogDetails + internal partial class UnknownCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnknownCopyLogDetails DeserializeUnknownCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DataBoxOrderType copyLogDetailsType = default; - foreach (var property in element.EnumerateObject()) + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("copyLogDetailsType"u8)) + foreach (var property in _serializedAdditionalRawData) { - copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownCopyLogDetails(copyLogDetailsType); + writer.WriteEndObject(); + } + + internal static CopyLogDetails DeserializeUnknownCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) => DeserializeCopyLogDetails(element, options); + + CopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyLogDetails(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.cs index dd0d8d65a3c6..d02db27605f2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownCopyLogDetails.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// The UnknownCopyLogDetails. internal partial class UnknownCopyLogDetails : CopyLogDetails { - /// Initializes a new instance of UnknownCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. - internal UnknownCopyLogDetails(DataBoxOrderType copyLogDetailsType) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal UnknownCopyLogDetails(DataBoxOrderType copyLogDetailsType, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { CopyLogDetailsType = copyLogDetailsType; } + + /// Initializes a new instance of for deserialization. + internal UnknownCopyLogDetails() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.Serialization.cs index 1fa58e108cf8..2eae1fe890ed 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.Serialization.cs @@ -5,15 +5,21 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownDataAccountDetails : IUtf8JsonSerializable + internal partial class UnknownDataAccountDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("dataAccountType"u8); writer.WriteStringValue(DataAccountType.ToSerialString()); @@ -22,31 +28,44 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sharePassword"u8); writer.WriteStringValue(SharePassword); } - writer.WriteEndObject(); - } - - internal static UnknownDataAccountDetails DeserializeUnknownDataAccountDetails(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DataAccountType dataAccountType = default; - Optional sharePassword = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("dataAccountType"u8)) - { - dataAccountType = property.Value.GetString().ToDataAccountType(); - continue; - } - if (property.NameEquals("sharePassword"u8)) + foreach (var property in _serializedAdditionalRawData) { - sharePassword = property.Value.GetString(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownDataAccountDetails(dataAccountType, sharePassword.Value); + writer.WriteEndObject(); + } + + internal static DataAccountDetails DeserializeUnknownDataAccountDetails(JsonElement element, ModelSerializerOptions options = default) => DeserializeDataAccountDetails(element, options); + + DataAccountDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownDataAccountDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataAccountDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataAccountDetails(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.cs index 9a3a90381b7b..a3b544927984 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataAccountDetails.cs @@ -5,17 +5,26 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// The UnknownDataAccountDetails. internal partial class UnknownDataAccountDetails : DataAccountDetails { - /// Initializes a new instance of UnknownDataAccountDetails. + /// Initializes a new instance of . /// Account Type of the data to be transferred. /// Password for all the shares to be created on the device. Should not be passed for TransferType:ExportFromAzure jobs. If this is not passed, the service will generate password itself. This will not be returned in Get Call. Password Requirements : Password must be minimum of 12 and maximum of 64 characters. Password must have at least one uppercase alphabet, one number and one special character. Password cannot have the following characters : IilLoO0 Password can have only alphabets, numbers and these characters : @#\-$%^!+=;:_()]+. - internal UnknownDataAccountDetails(DataAccountType dataAccountType, string sharePassword) : base(dataAccountType, sharePassword) + /// Keeps track of any properties unknown to the library. + internal UnknownDataAccountDetails(DataAccountType dataAccountType, string sharePassword, Dictionary serializedAdditionalRawData) : base(dataAccountType, sharePassword, serializedAdditionalRawData) { DataAccountType = dataAccountType; } + + /// Initializes a new instance of for deserialization. + internal UnknownDataAccountDetails() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.Serialization.cs index cc33868ba777..cf4fe36e5cd6 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.Serialization.cs @@ -5,55 +5,62 @@ #nullable disable -using System.Collections.Generic; +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownDataCenterAddressResponse + internal partial class UnknownDataCenterAddressResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnknownDataCenterAddressResponse DeserializeUnknownDataCenterAddressResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DataCenterAddressType dataCenterAddressType = default; - Optional> supportedCarriersForReturnShipment = default; - Optional dataCenterAzureLocation = default; - foreach (var property in element.EnumerateObject()) + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("datacenterAddressType"u8); + writer.WriteStringValue(DataCenterAddressType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("datacenterAddressType"u8)) - { - dataCenterAddressType = property.Value.GetString().ToDataCenterAddressType(); - continue; - } - if (property.NameEquals("supportedCarriersForReturnShipment"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - supportedCarriersForReturnShipment = array; - continue; - } - if (property.NameEquals("dataCenterAzureLocation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataCenterAzureLocation = new AzureLocation(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownDataCenterAddressResponse(dataCenterAddressType, Optional.ToList(supportedCarriersForReturnShipment), Optional.ToNullable(dataCenterAzureLocation)); + writer.WriteEndObject(); + } + + internal static DataCenterAddressResult DeserializeUnknownDataCenterAddressResponse(JsonElement element, ModelSerializerOptions options = default) => DeserializeDataCenterAddressResult(element, options); + + DataCenterAddressResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownDataCenterAddressResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataCenterAddressResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataCenterAddressResult(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.cs index 852811e0612c..ebc4edef6b7f 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownDataCenterAddressResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,13 +14,19 @@ namespace Azure.ResourceManager.DataBox.Models /// The UnknownDataCenterAddressResponse. internal partial class UnknownDataCenterAddressResponse : DataCenterAddressResult { - /// Initializes a new instance of UnknownDataCenterAddressResponse. + /// Initializes a new instance of . /// Data center address type. /// List of supported carriers for return shipment. /// Azure Location where the Data Center serves primarily. - internal UnknownDataCenterAddressResponse(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation) : base(dataCenterAddressType, supportedCarriersForReturnShipment, dataCenterAzureLocation) + /// Keeps track of any properties unknown to the library. + internal UnknownDataCenterAddressResponse(DataCenterAddressType dataCenterAddressType, IReadOnlyList supportedCarriersForReturnShipment, AzureLocation? dataCenterAzureLocation, Dictionary serializedAdditionalRawData) : base(dataCenterAddressType, supportedCarriersForReturnShipment, dataCenterAzureLocation, serializedAdditionalRawData) { DataCenterAddressType = dataCenterAddressType; } + + /// Initializes a new instance of for deserialization. + internal UnknownDataCenterAddressResponse() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.Serialization.cs index 1279898df94b..a2bc69bbd4fe 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.Serialization.cs @@ -5,29 +5,62 @@ #nullable disable +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownGranularCopyLogDetails + internal partial class UnknownGranularCopyLogDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnknownGranularCopyLogDetails DeserializeUnknownGranularCopyLogDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DataBoxOrderType copyLogDetailsType = default; - foreach (var property in element.EnumerateObject()) + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("copyLogDetailsType"u8); + writer.WriteStringValue(CopyLogDetailsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("copyLogDetailsType"u8)) + foreach (var property in _serializedAdditionalRawData) { - copyLogDetailsType = property.Value.GetString().ToDataBoxOrderType(); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownGranularCopyLogDetails(copyLogDetailsType); + writer.WriteEndObject(); + } + + internal static GranularCopyLogDetails DeserializeUnknownGranularCopyLogDetails(JsonElement element, ModelSerializerOptions options = default) => DeserializeGranularCopyLogDetails(element, options); + + GranularCopyLogDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownGranularCopyLogDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GranularCopyLogDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGranularCopyLogDetails(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.cs index 8d1058ec86e3..c19654a67988 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownGranularCopyLogDetails.cs @@ -5,16 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// The UnknownGranularCopyLogDetails. internal partial class UnknownGranularCopyLogDetails : GranularCopyLogDetails { - /// Initializes a new instance of UnknownGranularCopyLogDetails. + /// Initializes a new instance of . /// Indicates the type of job details. - internal UnknownGranularCopyLogDetails(DataBoxOrderType copyLogDetailsType) : base(copyLogDetailsType) + /// Keeps track of any properties unknown to the library. + internal UnknownGranularCopyLogDetails(DataBoxOrderType copyLogDetailsType, Dictionary serializedAdditionalRawData) : base(copyLogDetailsType, serializedAdditionalRawData) { CopyLogDetailsType = copyLogDetailsType; } + + /// Initializes a new instance of for deserialization. + internal UnknownGranularCopyLogDetails() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.Serialization.cs index 8ff5527b05a3..03a476b83cae 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.Serialization.cs @@ -5,23 +5,42 @@ #nullable disable -using System.Collections.Generic; +using System; using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownJobDetails : IUtf8JsonSerializable + internal partial class UnknownJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataImportDetails)) { @@ -29,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataImportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataExportDetails) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -48,245 +81,82 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ExpectedDataSizeInTerabytes)) { writer.WritePropertyName("expectedDataSizeInTeraBytes"u8); writer.WriteNumberValue(ExpectedDataSizeInTerabytes.Value); } - writer.WriteEndObject(); - } - - internal static UnknownJobDetails DeserializeUnknownJobDetails(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional> jobStages = default; - DataBoxContactDetails contactDetails = default; - Optional shippingAddress = default; - Optional deliveryPackage = default; - Optional returnPackage = default; - Optional> dataImportDetails = default; - Optional> dataExportDetails = default; - DataBoxOrderType jobDetailsType = default; - Optional preferences = default; - Optional reverseShippingDetails = default; - Optional> copyLogDetails = default; - Optional reverseShipmentLabelSasKey = default; - Optional chainOfCustodySasKey = default; - Optional deviceErasureDetails = default; - Optional keyEncryptionKey = default; - Optional expectedDataSizeInTerabytes = default; - Optional> actions = default; - Optional lastMitigationActionOnJob = default; - Optional dataCenterAddress = default; - Optional dataCenterCode = default; - foreach (var property in element.EnumerateObject()) + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("jobStages"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DataBoxJobStage.DeserializeDataBoxJobStage(item)); - } - jobStages = array; - continue; - } - if (property.NameEquals("contactDetails"u8)) - { - contactDetails = DataBoxContactDetails.DeserializeDataBoxContactDetails(property.Value); - continue; - } - if (property.NameEquals("shippingAddress"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - shippingAddress = DataBoxShippingAddress.DeserializeDataBoxShippingAddress(property.Value); - continue; - } - if (property.NameEquals("deliveryPackage"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - deliveryPackage = PackageShippingDetails.DeserializePackageShippingDetails(property.Value); - continue; - } - if (property.NameEquals("returnPackage"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - returnPackage = PackageShippingDetails.DeserializePackageShippingDetails(property.Value); - continue; - } - if (property.NameEquals("dataImportDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Models.DataImportDetails.DeserializeDataImportDetails(item)); - } - dataImportDetails = array; - continue; - } - if (property.NameEquals("dataExportDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Models.DataExportDetails.DeserializeDataExportDetails(item)); - } - dataExportDetails = array; - continue; - } - if (property.NameEquals("jobDetailsType"u8)) - { - jobDetailsType = property.Value.GetString().ToDataBoxOrderType(); - continue; - } - if (property.NameEquals("preferences"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - preferences = DataBoxOrderPreferences.DeserializeDataBoxOrderPreferences(property.Value); - continue; - } - if (property.NameEquals("reverseShippingDetails"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - reverseShippingDetails = ReverseShippingDetails.DeserializeReverseShippingDetails(property.Value); - continue; - } - if (property.NameEquals("copyLogDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Models.CopyLogDetails.DeserializeCopyLogDetails(item)); - } - copyLogDetails = array; - continue; - } - if (property.NameEquals("reverseShipmentLabelSasKey"u8)) - { - reverseShipmentLabelSasKey = property.Value.GetString(); - continue; - } - if (property.NameEquals("chainOfCustodySasKey"u8)) - { - chainOfCustodySasKey = property.Value.GetString(); - continue; - } - if (property.NameEquals("deviceErasureDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - deviceErasureDetails = DeviceErasureDetails.DeserializeDeviceErasureDetails(property.Value); - continue; - } - if (property.NameEquals("keyEncryptionKey"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyEncryptionKey = DataBoxKeyEncryptionKey.DeserializeDataBoxKeyEncryptionKey(property.Value); - continue; - } - if (property.NameEquals("expectedDataSizeInTeraBytes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expectedDataSizeInTerabytes = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("actions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString().ToCustomerResolutionCode()); - } - actions = array; - continue; - } - if (property.NameEquals("lastMitigationActionOnJob"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastMitigationActionOnJob = LastMitigationActionOnJob.DeserializeLastMitigationActionOnJob(property.Value); - continue; - } - if (property.NameEquals("datacenterAddress"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataCenterAddress = DataCenterAddressResult.DeserializeDataCenterAddressResult(property.Value); - continue; - } - if (property.NameEquals("dataCenterCode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataCenterCode = new DataCenterCode(property.Value.GetString()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownJobDetails(Optional.ToList(jobStages), contactDetails, shippingAddress.Value, deliveryPackage.Value, returnPackage.Value, Optional.ToList(dataImportDetails), Optional.ToList(dataExportDetails), jobDetailsType, preferences.Value, reverseShippingDetails.Value, Optional.ToList(copyLogDetails), reverseShipmentLabelSasKey.Value, chainOfCustodySasKey.Value, deviceErasureDetails.Value, keyEncryptionKey.Value, Optional.ToNullable(expectedDataSizeInTerabytes), Optional.ToList(actions), lastMitigationActionOnJob.Value, dataCenterAddress.Value, Optional.ToNullable(dataCenterCode)); + writer.WriteEndObject(); + } + + internal static DataBoxBasicJobDetails DeserializeUnknownJobDetails(JsonElement element, ModelSerializerOptions options = default) => DeserializeDataBoxBasicJobDetails(element, options); + + DataBoxBasicJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxBasicJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxBasicJobDetails(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.cs index 549e1e8380db..a9c6db7cc813 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.DataBox.Models @@ -12,7 +13,7 @@ namespace Azure.ResourceManager.DataBox.Models /// The UnknownJobDetails. internal partial class UnknownJobDetails : DataBoxBasicJobDetails { - /// Initializes a new instance of UnknownJobDetails. + /// Initializes a new instance of . /// List of stages that run in the job. /// Contact details for notification and shipping. /// Shipping address of the customer. @@ -41,9 +42,15 @@ internal partial class UnknownJobDetails : DataBoxBasicJobDetails /// The available derived classes include and . /// /// DataCenter code. - internal UnknownJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode) + /// Keeps track of any properties unknown to the library. + internal UnknownJobDetails(IReadOnlyList jobStages, DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, PackageShippingDetails deliveryPackage, PackageShippingDetails returnPackage, IList dataImportDetails, IList dataExportDetails, DataBoxOrderType jobDetailsType, DataBoxOrderPreferences preferences, ReverseShippingDetails reverseShippingDetails, IReadOnlyList copyLogDetails, string reverseShipmentLabelSasKey, string chainOfCustodySasKey, DeviceErasureDetails deviceErasureDetails, DataBoxKeyEncryptionKey keyEncryptionKey, int? expectedDataSizeInTerabytes, IReadOnlyList actions, LastMitigationActionOnJob lastMitigationActionOnJob, DataCenterAddressResult dataCenterAddress, DataCenterCode? dataCenterCode, Dictionary serializedAdditionalRawData) : base(jobStages, contactDetails, shippingAddress, deliveryPackage, returnPackage, dataImportDetails, dataExportDetails, jobDetailsType, preferences, reverseShippingDetails, copyLogDetails, reverseShipmentLabelSasKey, chainOfCustodySasKey, deviceErasureDetails, keyEncryptionKey, expectedDataSizeInTerabytes, actions, lastMitigationActionOnJob, dataCenterAddress, dataCenterCode, serializedAdditionalRawData) { JobDetailsType = jobDetailsType; } + + /// Initializes a new instance of for deserialization. + internal UnknownJobDetails() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.Serialization.cs index 4a666aa0757e..1e5cd3498061 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.Serialization.cs @@ -5,50 +5,62 @@ #nullable disable +using System; using System.Text.Json; -using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownJobSecrets + internal partial class UnknownJobSecrets : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnknownJobSecrets DeserializeUnknownJobSecrets(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DataBoxOrderType jobSecretsType = default; - Optional dcAccessSecurityCode = default; - Optional error = default; - foreach (var property in element.EnumerateObject()) + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("jobSecretsType"u8); + writer.WriteStringValue(JobSecretsType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("jobSecretsType"u8)) - { - jobSecretsType = property.Value.GetString().ToDataBoxOrderType(); - continue; - } - if (property.NameEquals("dcAccessSecurityCode"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dcAccessSecurityCode = DataCenterAccessSecurityCode.DeserializeDataCenterAccessSecurityCode(property.Value); - continue; - } - if (property.NameEquals("error"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - error = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownJobSecrets(jobSecretsType, dcAccessSecurityCode.Value, error.Value); + writer.WriteEndObject(); + } + + internal static JobSecrets DeserializeUnknownJobSecrets(JsonElement element, ModelSerializerOptions options = default) => DeserializeJobSecrets(element, options); + + JobSecrets IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownJobSecrets(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JobSecrets IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJobSecrets(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.cs index eebd578ef64a..22096c9479a4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownJobSecrets.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,13 +14,19 @@ namespace Azure.ResourceManager.DataBox.Models /// The UnknownJobSecrets. internal partial class UnknownJobSecrets : JobSecrets { - /// Initializes a new instance of UnknownJobSecrets. + /// Initializes a new instance of . /// Used to indicate what type of job secrets object. /// Dc Access Security Code for Customer Managed Shipping. /// Error while fetching the secrets. - internal UnknownJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error) : base(jobSecretsType, dataCenterAccessSecurityCode, error) + /// Keeps track of any properties unknown to the library. + internal UnknownJobSecrets(DataBoxOrderType jobSecretsType, DataCenterAccessSecurityCode dataCenterAccessSecurityCode, ResponseError error, Dictionary serializedAdditionalRawData) : base(jobSecretsType, dataCenterAccessSecurityCode, error, serializedAdditionalRawData) { JobSecretsType = jobSecretsType; } + + /// Initializes a new instance of for deserialization. + internal UnknownJobSecrets() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.Serialization.cs index 7025d1850a3b..c8978a2e51bc 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.Serialization.cs @@ -5,40 +5,62 @@ #nullable disable +using System; using System.Text.Json; -using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - internal partial class UnknownValidationInputResponse + internal partial class UnknownValidationInputResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UnknownValidationInputResponse DeserializeUnknownValidationInputResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DataBoxValidationInputDiscriminator validationType = default; - Optional error = default; - foreach (var property in element.EnumerateObject()) + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.ToSerialString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) { - if (property.NameEquals("validationType"u8)) - { - validationType = property.Value.GetString().ToDataBoxValidationInputDiscriminator(); - continue; - } - if (property.NameEquals("error"u8)) + foreach (var property in _serializedAdditionalRawData) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - error = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif } } - return new UnknownValidationInputResponse(validationType, error.Value); + writer.WriteEndObject(); + } + + internal static DataBoxValidationInputResult DeserializeUnknownValidationInputResponse(JsonElement element, ModelSerializerOptions options = default) => DeserializeDataBoxValidationInputResult(element, options); + + DataBoxValidationInputResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUnknownValidationInputResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxValidationInputResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxValidationInputResult(doc.RootElement, options); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.cs index abb9dbf92d1f..68ff5212c51a 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UnknownValidationInputResponse.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; namespace Azure.ResourceManager.DataBox.Models @@ -12,12 +14,18 @@ namespace Azure.ResourceManager.DataBox.Models /// The UnknownValidationInputResponse. internal partial class UnknownValidationInputResponse : DataBoxValidationInputResult { - /// Initializes a new instance of UnknownValidationInputResponse. + /// Initializes a new instance of . /// Identifies the type of validation response. /// Error code and message of validation response. - internal UnknownValidationInputResponse(DataBoxValidationInputDiscriminator validationType, ResponseError error) : base(validationType, error) + /// Keeps track of any properties unknown to the library. + internal UnknownValidationInputResponse(DataBoxValidationInputDiscriminator validationType, ResponseError error, Dictionary serializedAdditionalRawData) : base(validationType, error, serializedAdditionalRawData) { ValidationType = validationType; } + + /// Initializes a new instance of for deserialization. + internal UnknownValidationInputResponse() + { + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.Serialization.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.Serialization.cs index a9db8643f8d4..5b25a127eae2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.Serialization.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.Serialization.cs @@ -5,47 +5,237 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBox.Models { - public partial class UpdateJobDetails : IUtf8JsonSerializable + public partial class UpdateJobDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContactDetails)) { writer.WritePropertyName("contactDetails"u8); - writer.WriteObjectValue(ContactDetails); + if (ContactDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactDetails).Serialize(writer, options); + } } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsDefined(ReverseShippingDetails)) { writer.WritePropertyName("reverseShippingDetails"u8); - writer.WriteObjectValue(ReverseShippingDetails); + if (ReverseShippingDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReverseShippingDetails).Serialize(writer, options); + } } if (Optional.IsDefined(Preferences)) { writer.WritePropertyName("preferences"u8); - writer.WriteObjectValue(Preferences); + if (Preferences is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Preferences).Serialize(writer, options); + } } if (Optional.IsDefined(KeyEncryptionKey)) { writer.WritePropertyName("keyEncryptionKey"u8); - writer.WriteObjectValue(KeyEncryptionKey); + if (KeyEncryptionKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KeyEncryptionKey).Serialize(writer, options); + } } if (Optional.IsDefined(ReturnToCustomerPackageDetails)) { writer.WritePropertyName("returnToCustomerPackageDetails"u8); - writer.WriteObjectValue(ReturnToCustomerPackageDetails); + if (ReturnToCustomerPackageDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReturnToCustomerPackageDetails).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static UpdateJobDetails DeserializeUpdateJobDetails(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional contactDetails = default; + Optional shippingAddress = default; + Optional reverseShippingDetails = default; + Optional preferences = default; + Optional keyEncryptionKey = default; + Optional returnToCustomerPackageDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contactDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contactDetails = DataBoxContactDetails.DeserializeDataBoxContactDetails(property.Value); + continue; + } + if (property.NameEquals("shippingAddress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + shippingAddress = DataBoxShippingAddress.DeserializeDataBoxShippingAddress(property.Value); + continue; + } + if (property.NameEquals("reverseShippingDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reverseShippingDetails = ReverseShippingDetails.DeserializeReverseShippingDetails(property.Value); + continue; + } + if (property.NameEquals("preferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preferences = DataBoxOrderPreferences.DeserializeDataBoxOrderPreferences(property.Value); + continue; + } + if (property.NameEquals("keyEncryptionKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyEncryptionKey = DataBoxKeyEncryptionKey.DeserializeDataBoxKeyEncryptionKey(property.Value); + continue; + } + if (property.NameEquals("returnToCustomerPackageDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + returnToCustomerPackageDetails = PackageCarrierDetails.DeserializePackageCarrierDetails(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UpdateJobDetails(contactDetails.Value, shippingAddress.Value, reverseShippingDetails.Value, preferences.Value, keyEncryptionKey.Value, returnToCustomerPackageDetails.Value, serializedAdditionalRawData); + } + + UpdateJobDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateJobDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateJobDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateJobDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateJobDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateJobDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateJobDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.cs index 8718515cf897..5f009e3eecb5 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Models/UpdateJobDetails.cs @@ -5,16 +5,41 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBox.Models { /// Job details for update. public partial class UpdateJobDetails { - /// Initializes a new instance of UpdateJobDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UpdateJobDetails() { } + /// Initializes a new instance of . + /// Contact details for notification and shipping. + /// Shipping address of the customer. + /// Reverse Shipping Address and contact details for a job. + /// Preferences related to the order. + /// Key encryption key for the job. + /// Return package details of job. + /// Keeps track of any properties unknown to the library. + internal UpdateJobDetails(DataBoxContactDetails contactDetails, DataBoxShippingAddress shippingAddress, ReverseShippingDetails reverseShippingDetails, DataBoxOrderPreferences preferences, DataBoxKeyEncryptionKey keyEncryptionKey, PackageCarrierDetails returnToCustomerPackageDetails, Dictionary serializedAdditionalRawData) + { + ContactDetails = contactDetails; + ShippingAddress = shippingAddress; + ReverseShippingDetails = reverseShippingDetails; + Preferences = preferences; + KeyEncryptionKey = keyEncryptionKey; + ReturnToCustomerPackageDetails = returnToCustomerPackageDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Contact details for notification and shipping. public DataBoxContactDetails ContactDetails { get; set; } /// Shipping address of the customer. diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/DataBoxManagementRestOperations.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/DataBoxManagementRestOperations.cs index 919c5c6e407b..d43ed7a7984e 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/DataBoxManagementRestOperations.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/DataBoxManagementRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateMitigateRequest(string subscriptionId, string resourc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/JobsRestOperations.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/JobsRestOperations.cs index 0d22cc8ab656..feea8e8e25a4 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/JobsRestOperations.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/JobsRestOperations.cs @@ -128,9 +128,7 @@ internal HttpMessage CreateMarkDevicesShippedRequest(string subscriptionId, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -371,9 +369,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -525,9 +521,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -606,9 +600,7 @@ internal HttpMessage CreateBookShipmentPickUpRequest(string subscriptionId, stri request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -693,9 +685,7 @@ internal HttpMessage CreateCancelRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(cancellationReason); - request.Content = content; + request.Content = cancellationReason; _userAgent.Apply(message); return message; } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/ServiceRestOperations.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/ServiceRestOperations.cs index 3eab62e51d18..f55e3d4acff2 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/ServiceRestOperations.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/RestOperations/ServiceRestOperations.cs @@ -55,9 +55,7 @@ internal HttpMessage CreateListAvailableSkusByResourceGroupRequest(string subscr request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -138,9 +136,7 @@ internal HttpMessage CreateValidateAddressRequest(string subscriptionId, AzureLo request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -219,9 +215,7 @@ internal HttpMessage CreateValidateInputsByResourceGroupRequest(string subscript request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -302,9 +296,7 @@ internal HttpMessage CreateValidateInputsRequest(string subscriptionId, AzureLoc request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -381,9 +373,7 @@ internal HttpMessage CreateRegionConfigurationRequest(string subscriptionId, Azu request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } @@ -462,9 +452,7 @@ internal HttpMessage CreateRegionConfigurationByResourceGroupRequest(string subs request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/ArmDataBoxEdgeModelFactory.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/ArmDataBoxEdgeModelFactory.cs index e86c32a7284e..e0dd00a04f59 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/ArmDataBoxEdgeModelFactory.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/ArmDataBoxEdgeModelFactory.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Model factory for models. public static partial class ArmDataBoxEdgeModelFactory { - /// Initializes a new instance of AvailableDataBoxEdgeSku. + /// Initializes a new instance of . /// The type of the resource. /// The Sku name. /// The Sku kind. @@ -45,10 +45,10 @@ public static AvailableDataBoxEdgeSku AvailableDataBoxEdgeSku(string resourceTyp shipmentTypes ??= new List(); capabilities ??= new List(); - return new AvailableDataBoxEdgeSku(resourceType, name, kind, tier, size, family, locations?.ToList(), apiVersions?.ToList(), locationInfo?.ToList(), costs?.ToList(), signupOption, version, availability, shipmentTypes?.ToList(), capabilities?.ToList()); + return new AvailableDataBoxEdgeSku(resourceType, name, kind, tier, size, family, locations?.ToList(), apiVersions?.ToList(), locationInfo?.ToList(), costs?.ToList(), signupOption, version, availability, shipmentTypes?.ToList(), capabilities?.ToList(), default); } - /// Initializes a new instance of DataBoxEdgeSkuLocationInfo. + /// Initializes a new instance of . /// The location. /// The zones. /// The sites. @@ -58,29 +58,29 @@ public static DataBoxEdgeSkuLocationInfo DataBoxEdgeSkuLocationInfo(AzureLocatio zones ??= new List(); sites ??= new List(); - return new DataBoxEdgeSkuLocationInfo(location, zones?.ToList(), sites?.ToList()); + return new DataBoxEdgeSkuLocationInfo(location, zones?.ToList(), sites?.ToList(), default); } - /// Initializes a new instance of DataBoxEdgeSkuCost. + /// Initializes a new instance of . /// Used for querying price from commerce. /// The cost quantity. /// The extended unit. /// A new instance for mocking. public static DataBoxEdgeSkuCost DataBoxEdgeSkuCost(string meterId = null, long? quantity = null, string extendedUnit = null) { - return new DataBoxEdgeSkuCost(meterId, quantity, extendedUnit); + return new DataBoxEdgeSkuCost(meterId, quantity, extendedUnit, default); } - /// Initializes a new instance of DataBoxEdgeSkuCapability. + /// Initializes a new instance of . /// An invariant to describe the feature. /// An invariant if the feature is measured by quantity. /// A new instance for mocking. public static DataBoxEdgeSkuCapability DataBoxEdgeSkuCapability(string name = null, string value = null) { - return new DataBoxEdgeSkuCapability(name, value); + return new DataBoxEdgeSkuCapability(name, value, default); } - /// Initializes a new instance of DataBoxEdgeDeviceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -114,19 +114,19 @@ public static DataBoxEdgeDeviceData DataBoxEdgeDeviceData(ResourceIdentifier id tags ??= new Dictionary(); configuredRoleTypes ??= new List(); - return new DataBoxEdgeDeviceData(id, name, resourceType, systemData, tags, location, sku, etag, identity, kind, dataBoxEdgeDeviceStatus, serialNumber, description, modelDescription, deviceType, friendlyName, culture, deviceModel, deviceSoftwareVersion, deviceLocalCapacity, timeZone, deviceHcsVersion, configuredRoleTypes?.ToList(), nodeCount, resourceMoveDetails, edgeSubscription != null ? new EdgeProfile(edgeSubscription) : null, residencyType != null ? new DataResidency(residencyType) : null); + return new DataBoxEdgeDeviceData(id, name, resourceType, systemData, tags, location, sku, etag, identity, kind, dataBoxEdgeDeviceStatus, serialNumber, description, modelDescription, deviceType, friendlyName, culture, deviceModel, deviceSoftwareVersion, deviceLocalCapacity, timeZone, deviceHcsVersion, configuredRoleTypes?.ToList(), nodeCount, resourceMoveDetails, edgeSubscription != null ? new EdgeProfile(edgeSubscription, new Dictionary()) : null, residencyType != null ? new DataResidency(residencyType, new Dictionary()) : null, default); } - /// Initializes a new instance of DataBoxEdgeResourceMoveDetails. + /// Initializes a new instance of . /// Denotes whether move operation is in progress. /// Denotes the timeout of the operation to finish. /// A new instance for mocking. public static DataBoxEdgeResourceMoveDetails DataBoxEdgeResourceMoveDetails(DataBoxEdgeResourceMoveStatus? operationInProgress = null, DateTimeOffset? operationInProgressLockTimeoutInUtc = null) { - return new DataBoxEdgeResourceMoveDetails(operationInProgress, operationInProgressLockTimeoutInUtc); + return new DataBoxEdgeResourceMoveDetails(operationInProgress, operationInProgressLockTimeoutInUtc, default); } - /// Initializes a new instance of EdgeProfileSubscription. + /// Initializes a new instance of . /// Edge Subscription Registration ID. /// ARM ID of the subscription. /// @@ -142,19 +142,19 @@ public static EdgeProfileSubscription EdgeProfileSubscription(Guid? registration { registeredFeatures ??= new List(); - return new EdgeProfileSubscription(registrationId, id, state, registrationDate, subscriptionId, tenantId, locationPlacementId, quotaId, serializedDetails, registeredFeatures?.ToList()); + return new EdgeProfileSubscription(registrationId, id, state, registrationDate, subscriptionId, tenantId, locationPlacementId, quotaId, serializedDetails, registeredFeatures?.ToList(), default); } - /// Initializes a new instance of SubscriptionRegisteredFeatures. + /// Initializes a new instance of . /// /// /// A new instance for mocking. public static SubscriptionRegisteredFeatures SubscriptionRegisteredFeatures(string name = null, string state = null) { - return new SubscriptionRegisteredFeatures(name, state); + return new SubscriptionRegisteredFeatures(name, state, default); } - /// Initializes a new instance of DataBoxEdgeAlertData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -171,20 +171,20 @@ public static DataBoxEdgeAlertData DataBoxEdgeAlertData(ResourceIdentifier id = { detailedInformation ??= new Dictionary(); - return new DataBoxEdgeAlertData(id, name, resourceType, systemData, title, alertType, appearedOn, recommendation, severity, errorDetails, detailedInformation); + return new DataBoxEdgeAlertData(id, name, resourceType, systemData, title, alertType, appearedOn, recommendation, severity, errorDetails, detailedInformation, default); } - /// Initializes a new instance of DataBoxEdgeAlertErrorDetails. + /// Initializes a new instance of . /// Error code. /// Error Message. /// Number of occurrences. /// A new instance for mocking. public static DataBoxEdgeAlertErrorDetails DataBoxEdgeAlertErrorDetails(string errorCode = null, string errorMessage = null, int? occurrences = null) { - return new DataBoxEdgeAlertErrorDetails(errorCode, errorMessage, occurrences); + return new DataBoxEdgeAlertErrorDetails(errorCode, errorMessage, occurrences, default); } - /// Initializes a new instance of BandwidthScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -198,10 +198,10 @@ public static BandwidthScheduleData BandwidthScheduleData(ResourceIdentifier id { days ??= new List(); - return new BandwidthScheduleData(id, name, resourceType, systemData, startOn, stopOn, rateInMbps, days?.ToList()); + return new BandwidthScheduleData(id, name, resourceType, systemData, startOn, stopOn, rateInMbps, days?.ToList(), default); } - /// Initializes a new instance of DataBoxEdgeDeviceCapacityInfo. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -215,10 +215,10 @@ public static DataBoxEdgeDeviceCapacityInfo DataBoxEdgeDeviceCapacityInfo(Resour { nodeCapacityInfos ??= new Dictionary(); - return new DataBoxEdgeDeviceCapacityInfo(id, name, resourceType, systemData, timeStamp, clusterStorageCapacityInfo, clusterComputeCapacityInfo, nodeCapacityInfos); + return new DataBoxEdgeDeviceCapacityInfo(id, name, resourceType, systemData, timeStamp, clusterStorageCapacityInfo, clusterComputeCapacityInfo, nodeCapacityInfos, default); } - /// Initializes a new instance of DiagnosticProactiveLogCollectionSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -227,10 +227,10 @@ public static DataBoxEdgeDeviceCapacityInfo DataBoxEdgeDeviceCapacityInfo(Resour /// A new instance for mocking. public static DiagnosticProactiveLogCollectionSettingData DiagnosticProactiveLogCollectionSettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProactiveDiagnosticsConsent userConsent = default) { - return new DiagnosticProactiveLogCollectionSettingData(id, name, resourceType, systemData, userConsent); + return new DiagnosticProactiveLogCollectionSettingData(id, name, resourceType, systemData, userConsent, default); } - /// Initializes a new instance of DiagnosticRemoteSupportSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -241,10 +241,10 @@ public static DiagnosticRemoteSupportSettingData DiagnosticRemoteSupportSettingD { remoteSupportSettingsList ??= new List(); - return new DiagnosticRemoteSupportSettingData(id, name, resourceType, systemData, remoteSupportSettingsList?.ToList()); + return new DiagnosticRemoteSupportSettingData(id, name, resourceType, systemData, remoteSupportSettingsList?.ToList(), default); } - /// Initializes a new instance of GenerateCertResult. + /// Initializes a new instance of . /// /// Gets or sets base64 encoded certificate raw data, /// this is the public part needed to be uploaded to cert vault @@ -257,10 +257,10 @@ public static DiagnosticRemoteSupportSettingData DiagnosticRemoteSupportSettingD /// A new instance for mocking. public static GenerateCertResult GenerateCertResult(string publicKey = null, string privateKey = null, DateTimeOffset? expireOn = null) { - return new GenerateCertResult(publicKey, privateKey, expireOn); + return new GenerateCertResult(publicKey, privateKey, expireOn, default); } - /// Initializes a new instance of DataBoxEdgeDeviceExtendedInfo. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -285,19 +285,19 @@ public static DataBoxEdgeDeviceExtendedInfo DataBoxEdgeDeviceExtendedInfo(Resour { deviceSecrets ??= new Dictionary(); - return new DataBoxEdgeDeviceExtendedInfo(id, name, resourceType, systemData, encryptionKeyThumbprint, encryptionKey, resourceKey, clientSecretStoreId, clientSecretStoreUri, channelIntegrityKeyName, channelIntegrityKeyVersion, keyVaultSyncStatus, deviceSecrets, clusterWitnessType, fileShareWitnessLocation, fileShareWitnessUsername, cloudWitnessStorageAccountName, cloudWitnessContainerName, cloudWitnessStorageEndpoint); + return new DataBoxEdgeDeviceExtendedInfo(id, name, resourceType, systemData, encryptionKeyThumbprint, encryptionKey, resourceKey, clientSecretStoreId, clientSecretStoreUri, channelIntegrityKeyName, channelIntegrityKeyVersion, keyVaultSyncStatus, deviceSecrets, clusterWitnessType, fileShareWitnessLocation, fileShareWitnessUsername, cloudWitnessStorageAccountName, cloudWitnessContainerName, cloudWitnessStorageEndpoint, default); } - /// Initializes a new instance of DataBoxEdgeDeviceSecret. + /// Initializes a new instance of . /// Encrypted (using device public key) secret value. /// Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). /// A new instance for mocking. public static DataBoxEdgeDeviceSecret DataBoxEdgeDeviceSecret(AsymmetricEncryptedSecret encryptedSecret = null, string keyVaultId = null) { - return new DataBoxEdgeDeviceSecret(encryptedSecret, keyVaultId); + return new DataBoxEdgeDeviceSecret(encryptedSecret, keyVaultId, default); } - /// Initializes a new instance of DataBoxEdgeJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -318,10 +318,10 @@ public static DataBoxEdgeDeviceSecret DataBoxEdgeDeviceSecret(AsymmetricEncrypte /// A new instance for mocking. public static DataBoxEdgeJobData DataBoxEdgeJobData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataBoxEdgeJobStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, int? percentComplete = null, DataBoxEdgeJobErrorDetails error = null, DataBoxEdgeJobType? jobType = null, UpdateOperationStage? currentStage = null, UpdateDownloadProgress downloadProgress = null, UpdateInstallProgress installProgress = null, int? totalRefreshErrors = null, string errorManifestFile = null, ResourceIdentifier refreshedEntityId = null, string folder = null) { - return new DataBoxEdgeJobData(id, name, resourceType, systemData, status, startOn, endOn, percentComplete, error, jobType, currentStage, downloadProgress, installProgress, totalRefreshErrors, errorManifestFile, refreshedEntityId, folder); + return new DataBoxEdgeJobData(id, name, resourceType, systemData, status, startOn, endOn, percentComplete, error, jobType, currentStage, downloadProgress, installProgress, totalRefreshErrors, errorManifestFile, refreshedEntityId, folder, default); } - /// Initializes a new instance of DataBoxEdgeJobErrorDetails. + /// Initializes a new instance of . /// The error details. /// The code intended for programmatic access. /// The message that describes the error in detail. @@ -330,10 +330,10 @@ public static DataBoxEdgeJobErrorDetails DataBoxEdgeJobErrorDetails(IEnumerable< { errorDetails ??= new List(); - return new DataBoxEdgeJobErrorDetails(errorDetails?.ToList(), code, message); + return new DataBoxEdgeJobErrorDetails(errorDetails?.ToList(), code, message, default); } - /// Initializes a new instance of DataBoxEdgeJobErrorItem. + /// Initializes a new instance of . /// The recommended actions. /// The code intended for programmatic access. /// The message that describes the error in detail. @@ -342,10 +342,10 @@ public static DataBoxEdgeJobErrorItem DataBoxEdgeJobErrorItem(IEnumerable(); - return new DataBoxEdgeJobErrorItem(recommendations?.ToList(), code, message); + return new DataBoxEdgeJobErrorItem(recommendations?.ToList(), code, message, default); } - /// Initializes a new instance of UpdateDownloadProgress. + /// Initializes a new instance of . /// The download phase. /// Percentage of completion. /// Total bytes to download. @@ -355,20 +355,20 @@ public static DataBoxEdgeJobErrorItem DataBoxEdgeJobErrorItem(IEnumerable A new instance for mocking. public static UpdateDownloadProgress UpdateDownloadProgress(DataBoxEdgeDownloadPhase? downloadPhase = null, int? percentComplete = null, double? totalBytesToDownload = null, double? totalBytesDownloaded = null, int? numberOfUpdatesToDownload = null, int? numberOfUpdatesDownloaded = null) { - return new UpdateDownloadProgress(downloadPhase, percentComplete, totalBytesToDownload, totalBytesDownloaded, numberOfUpdatesToDownload, numberOfUpdatesDownloaded); + return new UpdateDownloadProgress(downloadPhase, percentComplete, totalBytesToDownload, totalBytesDownloaded, numberOfUpdatesToDownload, numberOfUpdatesDownloaded, default); } - /// Initializes a new instance of UpdateInstallProgress. + /// Initializes a new instance of . /// Percentage completed. /// Number of updates to install. /// Number of updates installed. /// A new instance for mocking. public static UpdateInstallProgress UpdateInstallProgress(int? percentComplete = null, int? numberOfUpdatesToInstall = null, int? numberOfUpdatesInstalled = null) { - return new UpdateInstallProgress(percentComplete, numberOfUpdatesToInstall, numberOfUpdatesInstalled); + return new UpdateInstallProgress(percentComplete, numberOfUpdatesToInstall, numberOfUpdatesInstalled, default); } - /// Initializes a new instance of DataBoxEdgeDeviceNetworkSettings. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -379,10 +379,10 @@ public static DataBoxEdgeDeviceNetworkSettings DataBoxEdgeDeviceNetworkSettings( { networkAdapters ??= new List(); - return new DataBoxEdgeDeviceNetworkSettings(id, name, resourceType, systemData, networkAdapters?.ToList()); + return new DataBoxEdgeDeviceNetworkSettings(id, name, resourceType, systemData, networkAdapters?.ToList(), default); } - /// Initializes a new instance of DataBoxEdgeNetworkAdapter. + /// Initializes a new instance of . /// Instance ID of network adapter. /// Hardware position of network adapter. /// Logical index of the adapter. @@ -403,39 +403,39 @@ public static DataBoxEdgeNetworkAdapter DataBoxEdgeNetworkAdapter(string adapter { dnsServers ??= new List(); - return new DataBoxEdgeNetworkAdapter(adapterId, adapterPosition, index, nodeId, networkAdapterName, label, macAddress, linkSpeed, status, rdmaStatus, dhcpStatus, ipv4Configuration, ipv6Configuration, ipv6LinkLocalAddress, dnsServers?.ToList()); + return new DataBoxEdgeNetworkAdapter(adapterId, adapterPosition, index, nodeId, networkAdapterName, label, macAddress, linkSpeed, status, rdmaStatus, dhcpStatus, ipv4Configuration, ipv6Configuration, ipv6LinkLocalAddress, dnsServers?.ToList(), default); } - /// Initializes a new instance of DataBoxEdgeNetworkAdapterPosition. + /// Initializes a new instance of . /// The network group. /// The port. /// A new instance for mocking. public static DataBoxEdgeNetworkAdapterPosition DataBoxEdgeNetworkAdapterPosition(DataBoxEdgeNetworkGroup? networkGroup = null, int? port = null) { - return new DataBoxEdgeNetworkAdapterPosition(networkGroup, port); + return new DataBoxEdgeNetworkAdapterPosition(networkGroup, port, default); } - /// Initializes a new instance of DataBoxEdgeIPv4Config. + /// Initializes a new instance of . /// The IPv4 address of the network adapter. /// The IPv4 subnet of the network adapter. /// The IPv4 gateway of the network adapter. /// A new instance for mocking. public static DataBoxEdgeIPv4Config DataBoxEdgeIPv4Config(IPAddress ipAddress = null, string subnet = null, string gateway = null) { - return new DataBoxEdgeIPv4Config(ipAddress, subnet, gateway); + return new DataBoxEdgeIPv4Config(ipAddress, subnet, gateway, default); } - /// Initializes a new instance of DataBoxEdgeIPv6Config. + /// Initializes a new instance of . /// The IPv6 address of the network adapter. /// The IPv6 prefix of the network adapter. /// The IPv6 gateway of the network adapter. /// A new instance for mocking. public static DataBoxEdgeIPv6Config DataBoxEdgeIPv6Config(string ipAddress = null, int? prefixLength = null, string gateway = null) { - return new DataBoxEdgeIPv6Config(ipAddress, prefixLength, gateway); + return new DataBoxEdgeIPv6Config(ipAddress, prefixLength, gateway, default); } - /// Initializes a new instance of DataBoxEdgeNode. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -450,10 +450,10 @@ public static DataBoxEdgeIPv6Config DataBoxEdgeIPv6Config(string ipAddress = nul /// A new instance for mocking. public static DataBoxEdgeNode DataBoxEdgeNode(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataBoxEdgeNodeStatus? nodeStatus = null, string nodeChassisSerialNumber = null, string nodeSerialNumber = null, string nodeDisplayName = null, string nodeFriendlySoftwareVersion = null, string nodeHcsVersion = null, Guid? nodeInstanceId = null) { - return new DataBoxEdgeNode(id, name, resourceType, systemData, nodeStatus, nodeChassisSerialNumber, nodeSerialNumber, nodeDisplayName, nodeFriendlySoftwareVersion, nodeHcsVersion, nodeInstanceId); + return new DataBoxEdgeNode(id, name, resourceType, systemData, nodeStatus, nodeChassisSerialNumber, nodeSerialNumber, nodeDisplayName, nodeFriendlySoftwareVersion, nodeHcsVersion, nodeInstanceId, default); } - /// Initializes a new instance of DataBoxEdgeOrderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -475,10 +475,10 @@ public static DataBoxEdgeOrderData DataBoxEdgeOrderData(ResourceIdentifier id = deliveryTrackingInfo ??= new List(); returnTrackingInfo ??= new List(); - return new DataBoxEdgeOrderData(id, name, resourceType, systemData, kind, orderId, contactInformation, shippingAddress, currentStatus, orderHistory?.ToList(), serialNumber, deliveryTrackingInfo?.ToList(), returnTrackingInfo?.ToList(), shipmentType); + return new DataBoxEdgeOrderData(id, name, resourceType, systemData, kind, orderId, contactInformation, shippingAddress, currentStatus, orderHistory?.ToList(), serialNumber, deliveryTrackingInfo?.ToList(), returnTrackingInfo?.ToList(), shipmentType, default); } - /// Initializes a new instance of DataBoxEdgeOrderStatus. + /// Initializes a new instance of . /// Status of the order as per the allowed status types. /// Time of status update. /// Comments related to this status change. @@ -492,10 +492,10 @@ public static DataBoxEdgeOrderStatus DataBoxEdgeOrderStatus(DataBoxEdgeOrderStat { additionalOrderDetails ??= new Dictionary(); - return new DataBoxEdgeOrderStatus(status, updateOn, comments, trackingInformation, additionalOrderDetails); + return new DataBoxEdgeOrderStatus(status, updateOn, comments, trackingInformation, additionalOrderDetails, default); } - /// Initializes a new instance of DataBoxEdgeTrackingInfo. + /// Initializes a new instance of . /// Serial number of the device being tracked. /// Name of the carrier used in the delivery. /// Tracking ID of the shipment. @@ -503,18 +503,18 @@ public static DataBoxEdgeOrderStatus DataBoxEdgeOrderStatus(DataBoxEdgeOrderStat /// A new instance for mocking. public static DataBoxEdgeTrackingInfo DataBoxEdgeTrackingInfo(string serialNumber = null, string carrierName = null, string trackingId = null, Uri trackingUri = null) { - return new DataBoxEdgeTrackingInfo(serialNumber, carrierName, trackingId, trackingUri); + return new DataBoxEdgeTrackingInfo(serialNumber, carrierName, trackingId, trackingUri, default); } - /// Initializes a new instance of DataBoxEdgeDataCenterAccessCode. + /// Initializes a new instance of . /// DCAccess Code for the Self Managed shipment. /// A new instance for mocking. public static DataBoxEdgeDataCenterAccessCode DataBoxEdgeDataCenterAccessCode(string authCode = null) { - return new DataBoxEdgeDataCenterAccessCode(authCode); + return new DataBoxEdgeDataCenterAccessCode(authCode, default); } - /// Initializes a new instance of DataBoxEdgeRoleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -523,10 +523,10 @@ public static DataBoxEdgeDataCenterAccessCode DataBoxEdgeDataCenterAccessCode(st /// A new instance for mocking. public static DataBoxEdgeRoleData DataBoxEdgeRoleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = "Unknown") { - return new DataBoxEdgeRoleData(id, name, resourceType, systemData, kind); + return new DataBoxEdgeRoleData(id, name, resourceType, systemData, kind, default); } - /// Initializes a new instance of DataBoxEdgeRoleAddonData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -535,10 +535,10 @@ public static DataBoxEdgeRoleData DataBoxEdgeRoleData(ResourceIdentifier id = nu /// A new instance for mocking. public static DataBoxEdgeRoleAddonData DataBoxEdgeRoleAddonData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = "Unknown") { - return new DataBoxEdgeRoleAddonData(id, name, resourceType, systemData, kind); + return new DataBoxEdgeRoleAddonData(id, name, resourceType, systemData, kind, default); } - /// Initializes a new instance of MonitoringMetricConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -549,10 +549,10 @@ public static MonitoringMetricConfigurationData MonitoringMetricConfigurationDat { metricConfigurations ??= new List(); - return new MonitoringMetricConfigurationData(id, name, resourceType, systemData, metricConfigurations?.ToList()); + return new MonitoringMetricConfigurationData(id, name, resourceType, systemData, metricConfigurations?.ToList(), default); } - /// Initializes a new instance of DataBoxEdgeSecuritySettings. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -561,10 +561,10 @@ public static MonitoringMetricConfigurationData MonitoringMetricConfigurationDat /// A new instance for mocking. public static DataBoxEdgeSecuritySettings DataBoxEdgeSecuritySettings(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AsymmetricEncryptedSecret deviceAdminPassword = null) { - return new DataBoxEdgeSecuritySettings(id, name, resourceType, systemData, deviceAdminPassword); + return new DataBoxEdgeSecuritySettings(id, name, resourceType, systemData, deviceAdminPassword, default); } - /// Initializes a new instance of DataBoxEdgeShareData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -586,10 +586,10 @@ public static DataBoxEdgeShareData DataBoxEdgeShareData(ResourceIdentifier id = clientAccessRights ??= new List(); shareMappings ??= new List(); - return new DataBoxEdgeShareData(id, name, resourceType, systemData, description, shareStatus, monitoringStatus, azureContainerInfo, accessProtocol, userAccessRights?.ToList(), clientAccessRights?.ToList(), refreshDetails, shareMappings?.ToList(), dataPolicy); + return new DataBoxEdgeShareData(id, name, resourceType, systemData, description, shareStatus, monitoringStatus, azureContainerInfo, accessProtocol, userAccessRights?.ToList(), clientAccessRights?.ToList(), refreshDetails, shareMappings?.ToList(), dataPolicy, default); } - /// Initializes a new instance of DataBoxEdgeMountPointMap. + /// Initializes a new instance of . /// ID of the share mounted to the role VM. /// ID of the role to which share is mounted. /// Mount point for the share. @@ -598,10 +598,10 @@ public static DataBoxEdgeShareData DataBoxEdgeShareData(ResourceIdentifier id = /// A new instance for mocking. public static DataBoxEdgeMountPointMap DataBoxEdgeMountPointMap(ResourceIdentifier shareId = null, ResourceIdentifier roleId = null, string mountPoint = null, DataBoxEdgeMountType? mountType = null, DataBoxEdgeRoleType? roleType = null) { - return new DataBoxEdgeMountPointMap(shareId, roleId, mountPoint, mountType, roleType); + return new DataBoxEdgeMountPointMap(shareId, roleId, mountPoint, mountType, roleType, default); } - /// Initializes a new instance of DataBoxEdgeStorageAccountCredentialData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -617,10 +617,10 @@ public static DataBoxEdgeMountPointMap DataBoxEdgeMountPointMap(ResourceIdentifi /// A new instance for mocking. public static DataBoxEdgeStorageAccountCredentialData DataBoxEdgeStorageAccountCredentialData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string @alias = null, string userName = null, AsymmetricEncryptedSecret accountKey = null, string connectionString = null, DataBoxEdgeStorageAccountSslStatus sslStatus = default, string blobDomainName = null, DataBoxEdgeStorageAccountType accountType = default, ResourceIdentifier storageAccountId = null) { - return new DataBoxEdgeStorageAccountCredentialData(id, name, resourceType, systemData, @alias, userName, accountKey, connectionString, sslStatus, blobDomainName, accountType, storageAccountId); + return new DataBoxEdgeStorageAccountCredentialData(id, name, resourceType, systemData, @alias, userName, accountKey, connectionString, sslStatus, blobDomainName, accountType, storageAccountId, default); } - /// Initializes a new instance of DataBoxEdgeStorageAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -634,10 +634,10 @@ public static DataBoxEdgeStorageAccountCredentialData DataBoxEdgeStorageAccountC /// A new instance for mocking. public static DataBoxEdgeStorageAccountData DataBoxEdgeStorageAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, DataBoxEdgeStorageAccountStatus? storageAccountStatus = null, DataBoxEdgeDataPolicy dataPolicy = default, ResourceIdentifier storageAccountCredentialId = null, string blobEndpoint = null, int? containerCount = null) { - return new DataBoxEdgeStorageAccountData(id, name, resourceType, systemData, description, storageAccountStatus, dataPolicy, storageAccountCredentialId, blobEndpoint, containerCount); + return new DataBoxEdgeStorageAccountData(id, name, resourceType, systemData, description, storageAccountStatus, dataPolicy, storageAccountCredentialId, blobEndpoint, containerCount, default); } - /// Initializes a new instance of DataBoxEdgeStorageContainerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -649,10 +649,10 @@ public static DataBoxEdgeStorageAccountData DataBoxEdgeStorageAccountData(Resour /// A new instance for mocking. public static DataBoxEdgeStorageContainerData DataBoxEdgeStorageContainerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataBoxEdgeStorageContainerStatus? containerStatus = null, DataBoxEdgeStorageContainerDataFormat dataFormat = default, DataBoxEdgeRefreshDetails refreshDetails = null, DateTimeOffset? createdOn = null) { - return new DataBoxEdgeStorageContainerData(id, name, resourceType, systemData, containerStatus, dataFormat, refreshDetails, createdOn); + return new DataBoxEdgeStorageContainerData(id, name, resourceType, systemData, containerStatus, dataFormat, refreshDetails, createdOn, default); } - /// Initializes a new instance of DataBoxEdgeTriggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -661,10 +661,10 @@ public static DataBoxEdgeStorageContainerData DataBoxEdgeStorageContainerData(Re /// A new instance for mocking. public static DataBoxEdgeTriggerData DataBoxEdgeTriggerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = "Unknown") { - return new DataBoxEdgeTriggerData(id, name, resourceType, systemData, kind); + return new DataBoxEdgeTriggerData(id, name, resourceType, systemData, kind, default); } - /// Initializes a new instance of TriggerSupportPackageContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -679,10 +679,10 @@ public static DataBoxEdgeTriggerData DataBoxEdgeTriggerData(ResourceIdentifier i /// A new instance for mocking. public static TriggerSupportPackageContent TriggerSupportPackageContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? minimumTimeStamp = null, DateTimeOffset? maximumTimeStamp = null, string include = null) { - return new TriggerSupportPackageContent(id, name, resourceType, systemData, minimumTimeStamp, maximumTimeStamp, include); + return new TriggerSupportPackageContent(id, name, resourceType, systemData, minimumTimeStamp, maximumTimeStamp, include, default); } - /// Initializes a new instance of DataBoxEdgeDeviceUpdateSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -718,10 +718,10 @@ public static DataBoxEdgeDeviceUpdateSummary DataBoxEdgeDeviceUpdateSummary(Reso updateTitles ??= new List(); updates ??= new List(); - return new DataBoxEdgeDeviceUpdateSummary(id, name, resourceType, systemData, deviceVersionNumber, friendlyDeviceVersionName, deviceLastScannedOn, lastCompletedScanJobOn, lastSuccessfulScanJobOn, lastCompletedDownloadJobOn, lastCompletedDownloadJobId, lastDownloadJobStatus, lastSuccessfulInstallJobOn, lastCompletedInstallJobOn, lastCompletedInstallJobId, lastInstallJobStatus, totalNumberOfUpdatesAvailable, totalNumberOfUpdatesPendingDownload, totalNumberOfUpdatesPendingInstall, rebootBehavior, ongoingUpdateOperation, inProgressDownloadJobId, inProgressInstallJobId, inProgressDownloadJobStartedOn, inProgressInstallJobStartedOn, updateTitles?.ToList(), updates?.ToList(), totalUpdateSizeInBytes, totalTimeInMinutes); + return new DataBoxEdgeDeviceUpdateSummary(id, name, resourceType, systemData, deviceVersionNumber, friendlyDeviceVersionName, deviceLastScannedOn, lastCompletedScanJobOn, lastSuccessfulScanJobOn, lastCompletedDownloadJobOn, lastCompletedDownloadJobId, lastDownloadJobStatus, lastSuccessfulInstallJobOn, lastCompletedInstallJobOn, lastCompletedInstallJobId, lastInstallJobStatus, totalNumberOfUpdatesAvailable, totalNumberOfUpdatesPendingDownload, totalNumberOfUpdatesPendingInstall, rebootBehavior, ongoingUpdateOperation, inProgressDownloadJobId, inProgressInstallJobId, inProgressDownloadJobStartedOn, inProgressInstallJobStartedOn, updateTitles?.ToList(), updates?.ToList(), totalUpdateSizeInBytes, totalTimeInMinutes, default); } - /// Initializes a new instance of DataBoxEdgeUpdateDetails. + /// Initializes a new instance of . /// Title of the Update. /// Size of the update(In Bytes). /// Type of the Update. @@ -734,10 +734,19 @@ public static DataBoxEdgeDeviceUpdateSummary DataBoxEdgeDeviceUpdateSummary(Reso /// A new instance for mocking. public static DataBoxEdgeUpdateDetails DataBoxEdgeUpdateDetails(string updateTitle = null, double? updateSizeInBytes = null, DataBoxEdgeUpdateType? updateType = null, string targetVersion = null, string friendlyVersionNumber = null, int? estimatedInstallTimeInMins = null, InstallRebootBehavior? rebootBehavior = null, InstallationImpact? installationImpact = null, DataBoxEdgeUpdateStatus? status = null) { - return new DataBoxEdgeUpdateDetails(updateTitle, updateSizeInBytes, updateType, targetVersion, friendlyVersionNumber, estimatedInstallTimeInMins, rebootBehavior, installationImpact, status); + return new DataBoxEdgeUpdateDetails(updateTitle, updateSizeInBytes, updateType, targetVersion, friendlyVersionNumber, estimatedInstallTimeInMins, rebootBehavior, installationImpact, status, default); } - /// Initializes a new instance of UploadCertificateResponse. + /// Initializes a new instance of . + /// The authentication type. + /// The base64 encoded certificate raw data. + /// A new instance for mocking. + public static UploadCertificateContent UploadCertificateContent(DataBoxEdgeAuthenticationType? authenticationType = null, string certificate = null) + { + return new UploadCertificateContent(authenticationType, certificate, default); + } + + /// Initializes a new instance of . /// Specifies authentication type. /// The resource ID of the Data Box Edge/Gateway device. /// Azure Active Directory tenant authority. @@ -749,10 +758,10 @@ public static DataBoxEdgeUpdateDetails DataBoxEdgeUpdateDetails(string updateTit /// A new instance for mocking. public static UploadCertificateResponse UploadCertificateResponse(DataBoxEdgeAuthenticationType? authType = null, string resourceId = null, string aadAuthority = null, Guid? aadTenantId = null, Guid? servicePrincipalClientId = null, Guid? servicePrincipalObjectId = null, string azureManagementEndpointAudience = null, string aadAudience = null) { - return new UploadCertificateResponse(authType, resourceId, aadAuthority, aadTenantId, servicePrincipalClientId, servicePrincipalObjectId, azureManagementEndpointAudience, aadAudience); + return new UploadCertificateResponse(authType, resourceId, aadAuthority, aadTenantId, servicePrincipalClientId, servicePrincipalObjectId, azureManagementEndpointAudience, aadAudience, default); } - /// Initializes a new instance of DataBoxEdgeUserData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -765,25 +774,19 @@ public static DataBoxEdgeUserData DataBoxEdgeUserData(ResourceIdentifier id = nu { shareAccessRights ??= new List(); - return new DataBoxEdgeUserData(id, name, resourceType, systemData, encryptedPassword, shareAccessRights?.ToList(), userType); + return new DataBoxEdgeUserData(id, name, resourceType, systemData, encryptedPassword, shareAccessRights?.ToList(), userType, default); } - /// Initializes a new instance of ShareAccessRight. + /// Initializes a new instance of . /// The share ID. /// Type of access to be allowed on the share for this user. - /// is null. /// A new instance for mocking. public static ShareAccessRight ShareAccessRight(ResourceIdentifier shareId = null, ShareAccessType accessType = default) { - if (shareId == null) - { - throw new ArgumentNullException(nameof(shareId)); - } - - return new ShareAccessRight(shareId, accessType); + return new ShareAccessRight(shareId, accessType, default); } - /// Initializes a new instance of EdgeArcAddon. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -799,10 +802,10 @@ public static ShareAccessRight ShareAccessRight(ResourceIdentifier shareId = nul /// A new instance for mocking. public static EdgeArcAddon EdgeArcAddon(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string subscriptionId = null, string resourceGroupName = null, string resourceName = null, AzureLocation resourceLocation = default, string version = null, DataBoxEdgeOSPlatformType? hostPlatform = null, HostPlatformType? hostPlatformType = null, DataBoxEdgeRoleAddonProvisioningState? provisioningState = null) { - return new EdgeArcAddon(id, name, resourceType, systemData, AddonType.ArcForKubernetes, subscriptionId, resourceGroupName, resourceName, resourceLocation, version, hostPlatform, hostPlatformType, provisioningState); + return new EdgeArcAddon(id, name, resourceType, systemData, AddonType.ArcForKubernetes, subscriptionId, resourceGroupName, resourceName, resourceLocation, version, hostPlatform, hostPlatformType, provisioningState, default); } - /// Initializes a new instance of CloudEdgeManagementRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -813,10 +816,10 @@ public static EdgeArcAddon EdgeArcAddon(ResourceIdentifier id = null, string nam /// A new instance for mocking. public static CloudEdgeManagementRole CloudEdgeManagementRole(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataBoxEdgeRoleStatus? localManagementStatus = null, EdgeProfileSubscription edgeSubscription = null, DataBoxEdgeRoleStatus? roleStatus = null) { - return new CloudEdgeManagementRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.CloudEdgeManagement, localManagementStatus, edgeSubscription != null ? new EdgeProfile(edgeSubscription) : null, roleStatus); + return new CloudEdgeManagementRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.CloudEdgeManagement, localManagementStatus, edgeSubscription != null ? new EdgeProfile(edgeSubscription, new Dictionary()) : null, roleStatus, default); } - /// Initializes a new instance of CniConfig. + /// Initializes a new instance of . /// Cni type. /// Cni version. /// Pod Subnet. @@ -824,19 +827,19 @@ public static CloudEdgeManagementRole CloudEdgeManagementRole(ResourceIdentifier /// A new instance for mocking. public static CniConfig CniConfig(string cniConfigType = null, string version = null, string podSubnet = null, string serviceSubnet = null) { - return new CniConfig(cniConfigType, version, podSubnet, serviceSubnet); + return new CniConfig(cniConfigType, version, podSubnet, serviceSubnet, default); } - /// Initializes a new instance of DataBoxEdgeEtcdInfo. + /// Initializes a new instance of . /// Etcd type. /// Etcd version. /// A new instance for mocking. public static DataBoxEdgeEtcdInfo DataBoxEdgeEtcdInfo(string etcdInfoType = null, string version = null) { - return new DataBoxEdgeEtcdInfo(etcdInfoType, version); + return new DataBoxEdgeEtcdInfo(etcdInfoType, version, default); } - /// Initializes a new instance of EdgeFileEventTrigger. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -847,10 +850,10 @@ public static DataBoxEdgeEtcdInfo DataBoxEdgeEtcdInfo(string etcdInfoType = null /// A new instance for mocking. public static EdgeFileEventTrigger EdgeFileEventTrigger(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier sourceInfoShareId = null, ResourceIdentifier sinkInfoRoleId = null, string customContextTag = null) { - return new EdgeFileEventTrigger(id, name, resourceType, systemData, TriggerEventType.FileEvent, sourceInfoShareId != null ? new EdgeFileSourceInfo(sourceInfoShareId) : null, sinkInfoRoleId != null ? new DataBoxEdgeRoleSinkInfo(sinkInfoRoleId) : null, customContextTag); + return new EdgeFileEventTrigger(id, name, resourceType, systemData, TriggerEventType.FileEvent, sourceInfoShareId != null ? new EdgeFileSourceInfo(sourceInfoShareId, new Dictionary()) : null, sinkInfoRoleId != null ? new DataBoxEdgeRoleSinkInfo(sinkInfoRoleId, new Dictionary()) : null, customContextTag, default); } - /// Initializes a new instance of EdgeIotAddon. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -864,10 +867,10 @@ public static EdgeFileEventTrigger EdgeFileEventTrigger(ResourceIdentifier id = /// A new instance for mocking. public static EdgeIotAddon EdgeIotAddon(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, EdgeIotDeviceInfo iotDeviceDetails = null, EdgeIotDeviceInfo iotEdgeDeviceDetails = null, string version = null, DataBoxEdgeOSPlatformType? hostPlatform = null, HostPlatformType? hostPlatformType = null, DataBoxEdgeRoleAddonProvisioningState? provisioningState = null) { - return new EdgeIotAddon(id, name, resourceType, systemData, AddonType.IotEdge, iotDeviceDetails, iotEdgeDeviceDetails, version, hostPlatform, hostPlatformType, provisioningState); + return new EdgeIotAddon(id, name, resourceType, systemData, AddonType.IotEdge, iotDeviceDetails, iotEdgeDeviceDetails, version, hostPlatform, hostPlatformType, provisioningState, default); } - /// Initializes a new instance of EdgeIotRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -885,10 +888,10 @@ public static EdgeIotRole EdgeIotRole(ResourceIdentifier id = null, string name { shareMappings ??= new List(); - return new EdgeIotRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.IoT, hostPlatform, iotDeviceDetails, iotEdgeDeviceDetails, shareMappings?.ToList(), iotEdgeAgentInfo, hostPlatformType, computeResource, roleStatus); + return new EdgeIotRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.IoT, hostPlatform, iotDeviceDetails, iotEdgeDeviceDetails, shareMappings?.ToList(), iotEdgeAgentInfo, hostPlatformType, computeResource, roleStatus, default); } - /// Initializes a new instance of EdgeKubernetesClusterInfo. + /// Initializes a new instance of . /// Etcd configuration. /// Kubernetes cluster nodes. /// Kubernetes cluster version. @@ -897,10 +900,10 @@ public static EdgeKubernetesClusterInfo EdgeKubernetesClusterInfo(DataBoxEdgeEtc { nodes ??= new List(); - return new EdgeKubernetesClusterInfo(etcdInfo, nodes?.ToList(), version); + return new EdgeKubernetesClusterInfo(etcdInfo, nodes?.ToList(), version, default); } - /// Initializes a new instance of EdgeKubernetesNodeInfo. + /// Initializes a new instance of . /// Node name. /// Node type - Master/Worker. /// IP Configuration of the Kubernetes node. @@ -909,19 +912,19 @@ public static EdgeKubernetesNodeInfo EdgeKubernetesNodeInfo(string name = null, { ipConfiguration ??= new List(); - return new EdgeKubernetesNodeInfo(name, nodeType, ipConfiguration?.ToList()); + return new EdgeKubernetesNodeInfo(name, nodeType, ipConfiguration?.ToList(), default); } - /// Initializes a new instance of EdgeKubernetesIPConfiguration. + /// Initializes a new instance of . /// Port of the Kubernetes node. /// IP address of the Kubernetes node. /// A new instance for mocking. public static EdgeKubernetesIPConfiguration EdgeKubernetesIPConfiguration(string port = null, string ipAddress = null) { - return new EdgeKubernetesIPConfiguration(port, ipAddress); + return new EdgeKubernetesIPConfiguration(port, ipAddress, default); } - /// Initializes a new instance of EdgeKubernetesRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -935,20 +938,20 @@ public static EdgeKubernetesIPConfiguration EdgeKubernetesIPConfiguration(string /// A new instance for mocking. public static EdgeKubernetesRole EdgeKubernetesRole(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataBoxEdgeOSPlatformType? hostPlatform = null, EdgeKubernetesState? provisioningState = null, HostPlatformType? hostPlatformType = null, EdgeKubernetesClusterInfo kubernetesClusterInfo = null, EdgeKubernetesRoleResources kubernetesRoleResources = null, DataBoxEdgeRoleStatus? roleStatus = null) { - return new EdgeKubernetesRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.Kubernetes, hostPlatform, provisioningState, hostPlatformType, kubernetesClusterInfo, kubernetesRoleResources, roleStatus); + return new EdgeKubernetesRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.Kubernetes, hostPlatform, provisioningState, hostPlatformType, kubernetesClusterInfo, kubernetesRoleResources, roleStatus, default); } - /// Initializes a new instance of EdgeKubernetesRoleResources. + /// Initializes a new instance of . /// Kubernetes role storage resource. /// Kubernetes role compute resource. /// Kubernetes role network resource. /// A new instance for mocking. public static EdgeKubernetesRoleResources EdgeKubernetesRoleResources(EdgeKubernetesRoleStorage storage = null, EdgeKubernetesRoleCompute compute = null, EdgeKubernetesRoleNetwork network = null) { - return new EdgeKubernetesRoleResources(storage, compute, network); + return new EdgeKubernetesRoleResources(storage, compute, network, default); } - /// Initializes a new instance of EdgeKubernetesRoleStorage. + /// Initializes a new instance of . /// Kubernetes storage class info. /// Mount points of shares in role(s). /// A new instance for mocking. @@ -957,48 +960,48 @@ public static EdgeKubernetesRoleStorage EdgeKubernetesRoleStorage(IEnumerable(); endpoints ??= new List(); - return new EdgeKubernetesRoleStorage(storageClasses?.ToList(), endpoints?.ToList()); + return new EdgeKubernetesRoleStorage(storageClasses?.ToList(), endpoints?.ToList(), default); } - /// Initializes a new instance of EdgeKubernetesRoleStorageClassInfo. + /// Initializes a new instance of . /// Storage class name. /// Storage class type. /// If provisioned storage is posix compliant. /// A new instance for mocking. public static EdgeKubernetesRoleStorageClassInfo EdgeKubernetesRoleStorageClassInfo(string name = null, string kubernetesRoleStorageClassInfoType = null, PosixComplianceStatus? posixCompliant = null) { - return new EdgeKubernetesRoleStorageClassInfo(name, kubernetesRoleStorageClassInfoType, posixCompliant); + return new EdgeKubernetesRoleStorageClassInfo(name, kubernetesRoleStorageClassInfoType, posixCompliant, default); } - /// Initializes a new instance of EdgeKubernetesRoleCompute. + /// Initializes a new instance of . /// VM profile. /// Memory in bytes. /// Processor count. /// A new instance for mocking. public static EdgeKubernetesRoleCompute EdgeKubernetesRoleCompute(string vmProfile = null, long? memoryInBytes = null, int? processorCount = null) { - return new EdgeKubernetesRoleCompute(vmProfile, memoryInBytes, processorCount); + return new EdgeKubernetesRoleCompute(vmProfile, memoryInBytes, processorCount, default); } - /// Initializes a new instance of EdgeKubernetesRoleNetwork. + /// Initializes a new instance of . /// Cni configuration. /// Load balancer configuration. /// A new instance for mocking. public static EdgeKubernetesRoleNetwork EdgeKubernetesRoleNetwork(CniConfig cniConfig = null, DataBoxEdgeLoadBalancerConfig loadBalancerConfig = null) { - return new EdgeKubernetesRoleNetwork(cniConfig, loadBalancerConfig); + return new EdgeKubernetesRoleNetwork(cniConfig, loadBalancerConfig, default); } - /// Initializes a new instance of DataBoxEdgeLoadBalancerConfig. + /// Initializes a new instance of . /// Load balancer type. /// Load balancer version. /// A new instance for mocking. public static DataBoxEdgeLoadBalancerConfig DataBoxEdgeLoadBalancerConfig(string loadBalancerConfigType = null, string version = null) { - return new DataBoxEdgeLoadBalancerConfig(loadBalancerConfigType, version); + return new DataBoxEdgeLoadBalancerConfig(loadBalancerConfigType, version, default); } - /// Initializes a new instance of MecRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1010,10 +1013,10 @@ public static DataBoxEdgeLoadBalancerConfig DataBoxEdgeLoadBalancerConfig(string /// A new instance for mocking. public static MecRole MecRole(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AsymmetricEncryptedSecret connectionString = null, string controllerEndpoint = null, string resourceUniqueId = null, DataBoxEdgeRoleStatus? roleStatus = null) { - return new MecRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.Mec, connectionString, controllerEndpoint, resourceUniqueId, roleStatus); + return new MecRole(id, name, resourceType, systemData, DataBoxEdgeRoleType.Mec, connectionString, controllerEndpoint, resourceUniqueId, roleStatus, default); } - /// Initializes a new instance of PeriodicTimerEventTrigger. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -1024,7 +1027,7 @@ public static MecRole MecRole(ResourceIdentifier id = null, string name = null, /// A new instance for mocking. public static PeriodicTimerEventTrigger PeriodicTimerEventTrigger(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PeriodicTimerSourceInfo sourceInfo = null, ResourceIdentifier sinkInfoRoleId = null, string customContextTag = null) { - return new PeriodicTimerEventTrigger(id, name, resourceType, systemData, TriggerEventType.PeriodicTimerEvent, sourceInfo, sinkInfoRoleId != null ? new DataBoxEdgeRoleSinkInfo(sinkInfoRoleId) : null, customContextTag); + return new PeriodicTimerEventTrigger(id, name, resourceType, systemData, TriggerEventType.PeriodicTimerEvent, sourceInfo, sinkInfoRoleId != null ? new DataBoxEdgeRoleSinkInfo(sinkInfoRoleId, new Dictionary()) : null, customContextTag, default); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs index 19088aec80ec..1d729794f089 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _bandwidthScheduleRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _bandwidthScheduleRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BandwidthScheduleResource(Client, BandwidthScheduleData.DeserializeBandwidthScheduleData(e)), _bandwidthScheduleClientDiagnostics, Pipeline, "BandwidthScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new BandwidthScheduleResource(Client, BandwidthScheduleData.DeserializeBandwidthScheduleData(e)), _bandwidthScheduleClientDiagnostics, Pipeline, "BandwidthScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _bandwidthScheduleRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _bandwidthScheduleRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BandwidthScheduleResource(Client, BandwidthScheduleData.DeserializeBandwidthScheduleData(e)), _bandwidthScheduleClientDiagnostics, Pipeline, "BandwidthScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new BandwidthScheduleResource(Client, BandwidthScheduleData.DeserializeBandwidthScheduleData(e)), _bandwidthScheduleClientDiagnostics, Pipeline, "BandwidthScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleData.cs index 1dd4b54fba10..d0554e24ea29 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class BandwidthScheduleData : ResourceData { - /// Initializes a new instance of BandwidthScheduleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The start time of the schedule in UTC. /// The stop time of the schedule in UTC. /// The bandwidth rate in Mbps. @@ -36,7 +39,7 @@ public BandwidthScheduleData(TimeSpan startOn, TimeSpan stopOn, int rateInMbps, Days = days.ToList(); } - /// Initializes a new instance of BandwidthScheduleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,12 +48,19 @@ public BandwidthScheduleData(TimeSpan startOn, TimeSpan stopOn, int rateInMbps, /// The stop time of the schedule in UTC. /// The bandwidth rate in Mbps. /// The days of the week when this schedule is applicable. - internal BandwidthScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TimeSpan startOn, TimeSpan stopOn, int rateInMbps, IList days) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BandwidthScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TimeSpan startOn, TimeSpan stopOn, int rateInMbps, IList days, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { StartOn = startOn; StopOn = stopOn; RateInMbps = rateInMbps; Days = days; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BandwidthScheduleData() + { } /// The start time of the schedule in UTC. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs index f3b81208a6ba..0a50cdfef23b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertCollection.cs @@ -146,7 +146,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeAlertAlertsRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeAlertAlertsRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeAlertResource(Client, DataBoxEdgeAlertData.DeserializeDataBoxEdgeAlertData(e)), _dataBoxEdgeAlertAlertsClientDiagnostics, Pipeline, "DataBoxEdgeAlertCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeAlertResource(Client, DataBoxEdgeAlertData.DeserializeDataBoxEdgeAlertData(e)), _dataBoxEdgeAlertAlertsClientDiagnostics, Pipeline, "DataBoxEdgeAlertCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -168,7 +168,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeAlertAlertsRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeAlertAlertsRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeAlertResource(Client, DataBoxEdgeAlertData.DeserializeDataBoxEdgeAlertData(e)), _dataBoxEdgeAlertAlertsClientDiagnostics, Pipeline, "DataBoxEdgeAlertCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeAlertResource(Client, DataBoxEdgeAlertData.DeserializeDataBoxEdgeAlertData(e)), _dataBoxEdgeAlertAlertsClientDiagnostics, Pipeline, "DataBoxEdgeAlertCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertData.cs index 3a143a26a1f6..67d442331b68 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertData.cs @@ -19,13 +19,16 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeAlertData : ResourceData { - /// Initializes a new instance of DataBoxEdgeAlertData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeAlertData() { DetailedInformation = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataBoxEdgeAlertData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -37,7 +40,8 @@ public DataBoxEdgeAlertData() /// Severity of the alert. /// Error details of the alert. /// Alert details. - internal DataBoxEdgeAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string alertType, DateTimeOffset? appearedOn, string recommendation, DataBoxEdgeAlertSeverity? severity, DataBoxEdgeAlertErrorDetails errorDetails, IReadOnlyDictionary detailedInformation) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string alertType, DateTimeOffset? appearedOn, string recommendation, DataBoxEdgeAlertSeverity? severity, DataBoxEdgeAlertErrorDetails errorDetails, IReadOnlyDictionary detailedInformation, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Title = title; AlertType = alertType; @@ -46,6 +50,7 @@ internal DataBoxEdgeAlertData(ResourceIdentifier id, string name, ResourceType r Severity = severity; ErrorDetails = errorDetails; DetailedInformation = detailedInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Alert title. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs index 9aaa46331a20..8d54a91e2aa8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceCollection.cs @@ -230,7 +230,7 @@ public virtual AsyncPageable GetAllAsync(string expan { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeDeviceDevicesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeDeviceDevicesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), _dataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "DataBoxEdgeDeviceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), _dataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "DataBoxEdgeDeviceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,7 +253,7 @@ public virtual Pageable GetAll(string expand = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeDeviceDevicesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeDeviceDevicesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), _dataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "DataBoxEdgeDeviceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), _dataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "DataBoxEdgeDeviceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceData.cs index fe6bab0c05a7..6174a0f825b1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure; using Azure.Core; @@ -19,14 +20,17 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeDeviceData : TrackedResourceData { - /// Initializes a new instance of DataBoxEdgeDeviceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DataBoxEdgeDeviceData(AzureLocation location) : base(location) { ConfiguredRoleTypes = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeDeviceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -54,7 +58,8 @@ public DataBoxEdgeDeviceData(AzureLocation location) : base(location) /// The details of the move operation on this resource. /// The details of Edge Profile for this resource. /// The details of data-residency related properties for this resource. - internal DataBoxEdgeDeviceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DataBoxEdgeSku sku, ETag? etag, ManagedServiceIdentity identity, DataBoxEdgeDeviceKind? kind, DataBoxEdgeDeviceStatus? dataBoxEdgeDeviceStatus, string serialNumber, string description, string modelDescription, DataBoxEdgeDeviceType? deviceType, string friendlyName, string culture, string deviceModel, string deviceSoftwareVersion, long? deviceLocalCapacity, string timeZone, string deviceHcsVersion, IReadOnlyList configuredRoleTypes, int? nodeCount, DataBoxEdgeResourceMoveDetails resourceMoveDetails, EdgeProfile edgeProfile, DataResidency dataResidency) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DataBoxEdgeSku sku, ETag? etag, ManagedServiceIdentity identity, DataBoxEdgeDeviceKind? kind, DataBoxEdgeDeviceStatus? dataBoxEdgeDeviceStatus, string serialNumber, string description, string modelDescription, DataBoxEdgeDeviceType? deviceType, string friendlyName, string culture, string deviceModel, string deviceSoftwareVersion, long? deviceLocalCapacity, string timeZone, string deviceHcsVersion, IReadOnlyList configuredRoleTypes, int? nodeCount, DataBoxEdgeResourceMoveDetails resourceMoveDetails, EdgeProfile edgeProfile, DataResidency dataResidency, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; ETag = etag; @@ -77,6 +82,12 @@ internal DataBoxEdgeDeviceData(ResourceIdentifier id, string name, ResourceType ResourceMoveDetails = resourceMoveDetails; EdgeProfile = edgeProfile; DataResidency = dataResidency; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeDeviceData() + { } /// The SKU type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobData.cs index 5810a111ef07..e195050b03a3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeJobData : ResourceData { - /// Initializes a new instance of DataBoxEdgeJobData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeJobData() { } - /// Initializes a new instance of DataBoxEdgeJobData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +45,8 @@ internal DataBoxEdgeJobData() /// Local share/remote container relative path to the error manifest file of the refresh. /// ARM ID of the entity that was refreshed. /// If only subfolders need to be refreshed, then the subfolder path inside the share or container. (The path is empty if there are no subfolders.). - internal DataBoxEdgeJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeJobStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, int? percentComplete, DataBoxEdgeJobErrorDetails error, DataBoxEdgeJobType? jobType, UpdateOperationStage? currentStage, UpdateDownloadProgress downloadProgress, UpdateInstallProgress installProgress, int? totalRefreshErrors, string errorManifestFile, ResourceIdentifier refreshedEntityId, string folder) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeJobData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeJobStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, int? percentComplete, DataBoxEdgeJobErrorDetails error, DataBoxEdgeJobType? jobType, UpdateOperationStage? currentStage, UpdateDownloadProgress downloadProgress, UpdateInstallProgress installProgress, int? totalRefreshErrors, string errorManifestFile, ResourceIdentifier refreshedEntityId, string folder, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Status = status; StartOn = startOn; @@ -56,6 +61,7 @@ internal DataBoxEdgeJobData(ResourceIdentifier id, string name, ResourceType res ErrorManifestFile = errorManifestFile; RefreshedEntityId = refreshedEntityId; Folder = folder; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The current status of the job. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderData.cs index 25f53640522a..5ce486e63778 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeOrderData : ResourceData { - /// Initializes a new instance of DataBoxEdgeOrderData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeOrderData() { OrderHistory = new ChangeTrackingList(); @@ -26,7 +30,7 @@ public DataBoxEdgeOrderData() ReturnTrackingInfo = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeOrderData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +45,8 @@ public DataBoxEdgeOrderData() /// Tracking information for the package delivered to the customer whether it has an original or a replacement device. /// Tracking information for the package returned from the customer whether it has an original or a replacement device. /// ShipmentType of the order. - internal DataBoxEdgeOrderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, string orderId, DataBoxEdgeContactDetails contactInformation, DataBoxEdgeShippingAddress shippingAddress, DataBoxEdgeOrderStatus currentStatus, IReadOnlyList orderHistory, string serialNumber, IReadOnlyList deliveryTrackingInfo, IReadOnlyList returnTrackingInfo, DataBoxEdgeShipmentType? shipmentType) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeOrderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, string orderId, DataBoxEdgeContactDetails contactInformation, DataBoxEdgeShippingAddress shippingAddress, DataBoxEdgeOrderStatus currentStatus, IReadOnlyList orderHistory, string serialNumber, IReadOnlyList deliveryTrackingInfo, IReadOnlyList returnTrackingInfo, DataBoxEdgeShipmentType? shipmentType, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; OrderId = orderId; @@ -53,6 +58,7 @@ internal DataBoxEdgeOrderData(ResourceIdentifier id, string name, ResourceType r DeliveryTrackingInfo = deliveryTrackingInfo; ReturnTrackingInfo = returnTrackingInfo; ShipmentType = shipmentType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// It specify the order api version. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs index 84aa729743a2..74b128bfec49 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellat { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeRoleAddonAddonsRestClient.CreateListByRoleRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeRoleAddonAddonsRestClient.CreateListByRoleNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeRoleAddonResource(Client, DataBoxEdgeRoleAddonData.DeserializeDataBoxEdgeRoleAddonData(e)), _dataBoxEdgeRoleAddonAddonsClientDiagnostics, Pipeline, "DataBoxEdgeRoleAddonCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeRoleAddonResource(Client, DataBoxEdgeRoleAddonData.DeserializeDataBoxEdgeRoleAddonData(e)), _dataBoxEdgeRoleAddonAddonsClientDiagnostics, Pipeline, "DataBoxEdgeRoleAddonCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken c { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeRoleAddonAddonsRestClient.CreateListByRoleRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeRoleAddonAddonsRestClient.CreateListByRoleNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeRoleAddonResource(Client, DataBoxEdgeRoleAddonData.DeserializeDataBoxEdgeRoleAddonData(e)), _dataBoxEdgeRoleAddonAddonsClientDiagnostics, Pipeline, "DataBoxEdgeRoleAddonCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeRoleAddonResource(Client, DataBoxEdgeRoleAddonData.DeserializeDataBoxEdgeRoleAddonData(e)), _dataBoxEdgeRoleAddonAddonsClientDiagnostics, Pipeline, "DataBoxEdgeRoleAddonCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonData.cs index 45f693eb1f58..d096a7bc173f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -19,20 +21,25 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeRoleAddonData : ResourceData { - /// Initializes a new instance of DataBoxEdgeRoleAddonData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeRoleAddonData() { } - /// Initializes a new instance of DataBoxEdgeRoleAddonData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Addon type. - internal DataBoxEdgeRoleAddonData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonType kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeRoleAddonData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonType kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Addon type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs index ab42d1711813..e43ec2b8f1d3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeRoleRolesRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeRoleRolesRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeRoleResource(Client, DataBoxEdgeRoleData.DeserializeDataBoxEdgeRoleData(e)), _dataBoxEdgeRoleRolesClientDiagnostics, Pipeline, "DataBoxEdgeRoleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeRoleResource(Client, DataBoxEdgeRoleData.DeserializeDataBoxEdgeRoleData(e)), _dataBoxEdgeRoleRolesClientDiagnostics, Pipeline, "DataBoxEdgeRoleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeRoleRolesRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeRoleRolesRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeRoleResource(Client, DataBoxEdgeRoleData.DeserializeDataBoxEdgeRoleData(e)), _dataBoxEdgeRoleRolesClientDiagnostics, Pipeline, "DataBoxEdgeRoleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeRoleResource(Client, DataBoxEdgeRoleData.DeserializeDataBoxEdgeRoleData(e)), _dataBoxEdgeRoleRolesClientDiagnostics, Pipeline, "DataBoxEdgeRoleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleData.cs index d1a58d7d9f31..d4740891f946 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -19,20 +21,25 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeRoleData : ResourceData { - /// Initializes a new instance of DataBoxEdgeRoleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeRoleData() { } - /// Initializes a new instance of DataBoxEdgeRoleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Role type. - internal DataBoxEdgeRoleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeRoleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Role type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs index 03fca4cbe6b1..fca792cd8b0b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeShareSharesRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeShareSharesRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeShareResource(Client, DataBoxEdgeShareData.DeserializeDataBoxEdgeShareData(e)), _dataBoxEdgeShareSharesClientDiagnostics, Pipeline, "DataBoxEdgeShareCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeShareResource(Client, DataBoxEdgeShareData.DeserializeDataBoxEdgeShareData(e)), _dataBoxEdgeShareSharesClientDiagnostics, Pipeline, "DataBoxEdgeShareCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeShareSharesRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeShareSharesRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeShareResource(Client, DataBoxEdgeShareData.DeserializeDataBoxEdgeShareData(e)), _dataBoxEdgeShareSharesClientDiagnostics, Pipeline, "DataBoxEdgeShareCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeShareResource(Client, DataBoxEdgeShareData.DeserializeDataBoxEdgeShareData(e)), _dataBoxEdgeShareSharesClientDiagnostics, Pipeline, "DataBoxEdgeShareCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareData.cs index 569608e987f8..0ad10112435c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeShareData : ResourceData { - /// Initializes a new instance of DataBoxEdgeShareData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Current status of the share. /// Current monitoring status of the share. /// Access protocol to be used by the share. @@ -32,7 +36,7 @@ public DataBoxEdgeShareData(ShareStatus shareStatus, DataBoxEdgeShareMonitoringS ShareMappings = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeShareData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -47,7 +51,8 @@ public DataBoxEdgeShareData(ShareStatus shareStatus, DataBoxEdgeShareMonitoringS /// Details of the refresh job on this share. /// Share mount point to the role. /// Data policy of the share. - internal DataBoxEdgeShareData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, ShareStatus shareStatus, DataBoxEdgeShareMonitoringStatus monitoringStatus, DataBoxEdgeStorageContainerInfo azureContainerInfo, ShareAccessProtocol accessProtocol, IList userAccessRights, IList clientAccessRights, DataBoxEdgeRefreshDetails refreshDetails, IReadOnlyList shareMappings, DataBoxEdgeDataPolicy? dataPolicy) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeShareData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, ShareStatus shareStatus, DataBoxEdgeShareMonitoringStatus monitoringStatus, DataBoxEdgeStorageContainerInfo azureContainerInfo, ShareAccessProtocol accessProtocol, IList userAccessRights, IList clientAccessRights, DataBoxEdgeRefreshDetails refreshDetails, IReadOnlyList shareMappings, DataBoxEdgeDataPolicy? dataPolicy, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; ShareStatus = shareStatus; @@ -59,6 +64,12 @@ internal DataBoxEdgeShareData(ResourceIdentifier id, string name, ResourceType r RefreshDetails = refreshDetails; ShareMappings = shareMappings; DataPolicy = dataPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeShareData() + { } /// Description for the share. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs index b234266a95e6..1113dc5365b3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeStorageAccountStorageAccountsRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeStorageAccountStorageAccountsRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeStorageAccountResource(Client, DataBoxEdgeStorageAccountData.DeserializeDataBoxEdgeStorageAccountData(e)), _dataBoxEdgeStorageAccountStorageAccountsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeStorageAccountResource(Client, DataBoxEdgeStorageAccountData.DeserializeDataBoxEdgeStorageAccountData(e)), _dataBoxEdgeStorageAccountStorageAccountsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeStorageAccountStorageAccountsRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeStorageAccountStorageAccountsRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeStorageAccountResource(Client, DataBoxEdgeStorageAccountData.DeserializeDataBoxEdgeStorageAccountData(e)), _dataBoxEdgeStorageAccountStorageAccountsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeStorageAccountResource(Client, DataBoxEdgeStorageAccountData.DeserializeDataBoxEdgeStorageAccountData(e)), _dataBoxEdgeStorageAccountStorageAccountsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs index 839f959c3a73..9bce7bd139c0 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAll { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeStorageAccountCredentialResource(Client, DataBoxEdgeStorageAccountCredentialData.DeserializeDataBoxEdgeStorageAccountCredentialData(e)), _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCredentialCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeStorageAccountCredentialResource(Client, DataBoxEdgeStorageAccountCredentialData.DeserializeDataBoxEdgeStorageAccountCredentialData(e)), _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCredentialCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeStorageAccountCredentialResource(Client, DataBoxEdgeStorageAccountCredentialData.DeserializeDataBoxEdgeStorageAccountCredentialData(e)), _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCredentialCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeStorageAccountCredentialResource(Client, DataBoxEdgeStorageAccountCredentialData.DeserializeDataBoxEdgeStorageAccountCredentialData(e)), _dataBoxEdgeStorageAccountCredentialStorageAccountCredentialsClientDiagnostics, Pipeline, "DataBoxEdgeStorageAccountCredentialCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialData.cs index 969048762c5d..a28c90c6eafa 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeStorageAccountCredentialData : ResourceData { - /// Initializes a new instance of DataBoxEdgeStorageAccountCredentialData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Alias for the storage account. /// Signifies whether SSL needs to be enabled or not. /// Type of storage accessed on the storage account. @@ -32,7 +36,7 @@ public DataBoxEdgeStorageAccountCredentialData(string @alias, DataBoxEdgeStorage AccountType = accountType; } - /// Initializes a new instance of DataBoxEdgeStorageAccountCredentialData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -45,7 +49,8 @@ public DataBoxEdgeStorageAccountCredentialData(string @alias, DataBoxEdgeStorage /// Blob end point for private clouds. /// Type of storage accessed on the storage account. /// Id of the storage account. - internal DataBoxEdgeStorageAccountCredentialData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string @alias, string userName, AsymmetricEncryptedSecret accountKey, string connectionString, DataBoxEdgeStorageAccountSslStatus sslStatus, string blobDomainName, DataBoxEdgeStorageAccountType accountType, ResourceIdentifier storageAccountId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeStorageAccountCredentialData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string @alias, string userName, AsymmetricEncryptedSecret accountKey, string connectionString, DataBoxEdgeStorageAccountSslStatus sslStatus, string blobDomainName, DataBoxEdgeStorageAccountType accountType, ResourceIdentifier storageAccountId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Alias = @alias; UserName = userName; @@ -55,6 +60,12 @@ internal DataBoxEdgeStorageAccountCredentialData(ResourceIdentifier id, string n BlobDomainName = blobDomainName; AccountType = accountType; StorageAccountId = storageAccountId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeStorageAccountCredentialData() + { } /// Alias for the storage account. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountData.cs index 34588f7882de..e0274267967d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -17,14 +19,17 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeStorageAccountData : ResourceData { - /// Initializes a new instance of DataBoxEdgeStorageAccountData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Data policy of the storage Account. public DataBoxEdgeStorageAccountData(DataBoxEdgeDataPolicy dataPolicy) { DataPolicy = dataPolicy; } - /// Initializes a new instance of DataBoxEdgeStorageAccountData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +40,8 @@ public DataBoxEdgeStorageAccountData(DataBoxEdgeDataPolicy dataPolicy) /// Storage Account Credential Id. /// BlobEndpoint of Storage Account. /// The Container Count. Present only for Storage Accounts with DataPolicy set to Cloud. - internal DataBoxEdgeStorageAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, DataBoxEdgeStorageAccountStatus? storageAccountStatus, DataBoxEdgeDataPolicy dataPolicy, ResourceIdentifier storageAccountCredentialId, string blobEndpoint, int? containerCount) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeStorageAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, DataBoxEdgeStorageAccountStatus? storageAccountStatus, DataBoxEdgeDataPolicy dataPolicy, ResourceIdentifier storageAccountCredentialId, string blobEndpoint, int? containerCount, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Description = description; StorageAccountStatus = storageAccountStatus; @@ -43,6 +49,12 @@ internal DataBoxEdgeStorageAccountData(ResourceIdentifier id, string name, Resou StorageAccountCredentialId = storageAccountCredentialId; BlobEndpoint = blobEndpoint; ContainerCount = containerCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeStorageAccountData() + { } /// Description for the storage Account. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs index 887b52a4bed7..8683588f13f5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeStorageContainerContainersRestClient.CreateListByStorageAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeStorageContainerContainersRestClient.CreateListByStorageAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeStorageContainerResource(Client, DataBoxEdgeStorageContainerData.DeserializeDataBoxEdgeStorageContainerData(e)), _dataBoxEdgeStorageContainerContainersClientDiagnostics, Pipeline, "DataBoxEdgeStorageContainerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeStorageContainerResource(Client, DataBoxEdgeStorageContainerData.DeserializeDataBoxEdgeStorageContainerData(e)), _dataBoxEdgeStorageContainerContainersClientDiagnostics, Pipeline, "DataBoxEdgeStorageContainerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeStorageContainerContainersRestClient.CreateListByStorageAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeStorageContainerContainersRestClient.CreateListByStorageAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeStorageContainerResource(Client, DataBoxEdgeStorageContainerData.DeserializeDataBoxEdgeStorageContainerData(e)), _dataBoxEdgeStorageContainerContainersClientDiagnostics, Pipeline, "DataBoxEdgeStorageContainerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeStorageContainerResource(Client, DataBoxEdgeStorageContainerData.DeserializeDataBoxEdgeStorageContainerData(e)), _dataBoxEdgeStorageContainerContainersClientDiagnostics, Pipeline, "DataBoxEdgeStorageContainerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerData.cs index 0802f5ecbdf2..67d60a9fb2f5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -18,14 +19,17 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeStorageContainerData : ResourceData { - /// Initializes a new instance of DataBoxEdgeStorageContainerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// DataFormat for Container. public DataBoxEdgeStorageContainerData(DataBoxEdgeStorageContainerDataFormat dataFormat) { DataFormat = dataFormat; } - /// Initializes a new instance of DataBoxEdgeStorageContainerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,12 +38,19 @@ public DataBoxEdgeStorageContainerData(DataBoxEdgeStorageContainerDataFormat dat /// DataFormat for Container. /// Details of the refresh job on this container. /// The UTC time when container got created. - internal DataBoxEdgeStorageContainerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeStorageContainerStatus? containerStatus, DataBoxEdgeStorageContainerDataFormat dataFormat, DataBoxEdgeRefreshDetails refreshDetails, DateTimeOffset? createdOn) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeStorageContainerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeStorageContainerStatus? containerStatus, DataBoxEdgeStorageContainerDataFormat dataFormat, DataBoxEdgeRefreshDetails refreshDetails, DateTimeOffset? createdOn, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ContainerStatus = containerStatus; DataFormat = dataFormat; RefreshDetails = refreshDetails; CreatedOn = createdOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeStorageContainerData() + { } /// Current status of the container. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs index 5949de533da4..3d7c3d1558ce 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeTriggerTriggersRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeTriggerTriggersRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeTriggerResource(Client, DataBoxEdgeTriggerData.DeserializeDataBoxEdgeTriggerData(e)), _dataBoxEdgeTriggerTriggersClientDiagnostics, Pipeline, "DataBoxEdgeTriggerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeTriggerResource(Client, DataBoxEdgeTriggerData.DeserializeDataBoxEdgeTriggerData(e)), _dataBoxEdgeTriggerTriggersClientDiagnostics, Pipeline, "DataBoxEdgeTriggerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeTriggerTriggersRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeTriggerTriggersRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeTriggerResource(Client, DataBoxEdgeTriggerData.DeserializeDataBoxEdgeTriggerData(e)), _dataBoxEdgeTriggerTriggersClientDiagnostics, Pipeline, "DataBoxEdgeTriggerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeTriggerResource(Client, DataBoxEdgeTriggerData.DeserializeDataBoxEdgeTriggerData(e)), _dataBoxEdgeTriggerTriggersClientDiagnostics, Pipeline, "DataBoxEdgeTriggerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerData.cs index 53959365de85..a7b3477250ce 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -19,20 +21,25 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeTriggerData : ResourceData { - /// Initializes a new instance of DataBoxEdgeTriggerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeTriggerData() { } - /// Initializes a new instance of DataBoxEdgeTriggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Trigger Kind. - internal DataBoxEdgeTriggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TriggerEventType kind) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeTriggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TriggerEventType kind, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Trigger Kind. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs index 61a41c17eda4..7c4ad90bc605 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeUserUsersRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeUserUsersRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeUserResource(Client, DataBoxEdgeUserData.DeserializeDataBoxEdgeUserData(e)), _dataBoxEdgeUserUsersClientDiagnostics, Pipeline, "DataBoxEdgeUserCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeUserResource(Client, DataBoxEdgeUserData.DeserializeDataBoxEdgeUserData(e)), _dataBoxEdgeUserUsersClientDiagnostics, Pipeline, "DataBoxEdgeUserCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,7 +252,7 @@ public virtual Pageable GetAll(string filter = null, Ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataBoxEdgeUserUsersRestClient.CreateListByDataBoxEdgeDeviceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataBoxEdgeUserUsersRestClient.CreateListByDataBoxEdgeDeviceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeUserResource(Client, DataBoxEdgeUserData.DeserializeDataBoxEdgeUserData(e)), _dataBoxEdgeUserUsersClientDiagnostics, Pipeline, "DataBoxEdgeUserCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeUserResource(Client, DataBoxEdgeUserData.DeserializeDataBoxEdgeUserData(e)), _dataBoxEdgeUserUsersClientDiagnostics, Pipeline, "DataBoxEdgeUserCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserData.cs index d6da0fdaf397..b373f6e5f769 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; @@ -18,7 +19,10 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DataBoxEdgeUserData : ResourceData { - /// Initializes a new instance of DataBoxEdgeUserData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of the user. public DataBoxEdgeUserData(DataBoxEdgeUserType userType) { @@ -26,7 +30,7 @@ public DataBoxEdgeUserData(DataBoxEdgeUserType userType) UserType = userType; } - /// Initializes a new instance of DataBoxEdgeUserData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -34,11 +38,18 @@ public DataBoxEdgeUserData(DataBoxEdgeUserType userType) /// The password details. /// List of shares that the user has rights on. This field should not be specified during user creation. /// Type of the user. - internal DataBoxEdgeUserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AsymmetricEncryptedSecret encryptedPassword, IReadOnlyList shareAccessRights, DataBoxEdgeUserType userType) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeUserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AsymmetricEncryptedSecret encryptedPassword, IReadOnlyList shareAccessRights, DataBoxEdgeUserType userType, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { EncryptedPassword = encryptedPassword; ShareAccessRights = shareAccessRights; UserType = userType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeUserData() + { } /// The password details. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingData.cs index b614f544c34a..ed50bac4bf2c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; @@ -17,22 +19,32 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DiagnosticProactiveLogCollectionSettingData : ResourceData { - /// Initializes a new instance of DiagnosticProactiveLogCollectionSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Proactive diagnostic collection consent flag. public DiagnosticProactiveLogCollectionSettingData(ProactiveDiagnosticsConsent userConsent) { UserConsent = userConsent; } - /// Initializes a new instance of DiagnosticProactiveLogCollectionSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Proactive diagnostic collection consent flag. - internal DiagnosticProactiveLogCollectionSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProactiveDiagnosticsConsent userConsent) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DiagnosticProactiveLogCollectionSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProactiveDiagnosticsConsent userConsent, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { UserConsent = userConsent; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiagnosticProactiveLogCollectionSettingData() + { } /// Proactive diagnostic collection consent flag. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingData.cs index 6330812b9c30..c2d28bdb3b1c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge.Models; @@ -18,21 +19,26 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class DiagnosticRemoteSupportSettingData : ResourceData { - /// Initializes a new instance of DiagnosticRemoteSupportSettingData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DiagnosticRemoteSupportSettingData() { RemoteSupportSettingsList = new ChangeTrackingList(); } - /// Initializes a new instance of DiagnosticRemoteSupportSettingData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Remote support settings list according to the RemoteApplicationType. - internal DiagnosticRemoteSupportSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList remoteSupportSettingsList) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DiagnosticRemoteSupportSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList remoteSupportSettingsList, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { RemoteSupportSettingsList = remoteSupportSettingsList; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Remote support settings list according to the RemoteApplicationType. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 46c4ea7a5d1a..fa0ce23175db 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -110,7 +110,7 @@ public virtual AsyncPageable GetDataBoxEdgeDevicesAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); } /// @@ -133,7 +133,7 @@ public virtual Pageable GetDataBoxEdgeDevices(string { HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.Serialization.cs index e05003d3a052..55d9c8136f19 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class AddonList + internal partial class AddonList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AddonList DeserializeAddonList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AddonList DeserializeAddonList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static AddonList DeserializeAddonList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AddonList(Optional.ToList(value), nextLink.Value); + return new AddonList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AddonList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAddonList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AddonList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAddonList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AddonList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AddonList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAddonList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.cs index f73f9c97f266..cb23c6ac9455 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AddonList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of all the Role addon on the Azure Stack Edge device. internal partial class AddonList { - /// Initializes a new instance of AddonList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AddonList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AddonList. + /// Initializes a new instance of . /// /// The Value. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// /// Link to the next set of results. - internal AddonList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AddonList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.Serialization.cs index 91cd4b8daa26..c9e75f343dbd 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class AlertList + internal partial class AlertList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AlertList DeserializeAlertList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AlertList DeserializeAlertList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static AlertList DeserializeAlertList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AlertList(Optional.ToList(value), nextLink.Value); + return new AlertList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AlertList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAlertList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AlertList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAlertList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AlertList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AlertList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAlertList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.cs index dfef89963301..04654334349a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AlertList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of alerts. internal partial class AlertList { - /// Initializes a new instance of AlertList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AlertList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AlertList. + /// Initializes a new instance of . /// The value. /// Link to the next set of results. - internal AlertList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AlertList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.Serialization.cs index 3a5d9ca9f91c..1b2d267b7bc6 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class AsymmetricEncryptedSecret : IUtf8JsonSerializable + public partial class AsymmetricEncryptedSecret : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("encryptionAlgorithm"u8); writer.WriteStringValue(EncryptionAlgorithm.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AsymmetricEncryptedSecret DeserializeAsymmetricEncryptedSecret(JsonElement element) + internal static AsymmetricEncryptedSecret DeserializeAsymmetricEncryptedSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static AsymmetricEncryptedSecret DeserializeAsymmetricEncryptedSecret(J string value = default; Optional encryptionCertThumbprint = default; DataBoxEdgeEncryptionAlgorithm encryptionAlgorithm = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -53,8 +76,61 @@ internal static AsymmetricEncryptedSecret DeserializeAsymmetricEncryptedSecret(J encryptionAlgorithm = new DataBoxEdgeEncryptionAlgorithm(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AsymmetricEncryptedSecret(value, encryptionCertThumbprint.Value, encryptionAlgorithm, serializedAdditionalRawData); + } + + AsymmetricEncryptedSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAsymmetricEncryptedSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AsymmetricEncryptedSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAsymmetricEncryptedSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AsymmetricEncryptedSecret model) + { + if (model is null) + { + return null; } - return new AsymmetricEncryptedSecret(value, encryptionCertThumbprint.Value, encryptionAlgorithm); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AsymmetricEncryptedSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAsymmetricEncryptedSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.cs index 032604b54c4d..a1633adde5b7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AsymmetricEncryptedSecret.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Represent the secrets intended for encryption with asymmetric key pair. public partial class AsymmetricEncryptedSecret { - /// Initializes a new instance of AsymmetricEncryptedSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The value of the secret. /// The algorithm used to encrypt "Value". /// is null. @@ -25,15 +29,22 @@ public AsymmetricEncryptedSecret(string value, DataBoxEdgeEncryptionAlgorithm en EncryptionAlgorithm = encryptionAlgorithm; } - /// Initializes a new instance of AsymmetricEncryptedSecret. + /// Initializes a new instance of . /// The value of the secret. /// Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. /// The algorithm used to encrypt "Value". - internal AsymmetricEncryptedSecret(string value, string encryptionCertThumbprint, DataBoxEdgeEncryptionAlgorithm encryptionAlgorithm) + /// Keeps track of any properties unknown to the library. + internal AsymmetricEncryptedSecret(string value, string encryptionCertThumbprint, DataBoxEdgeEncryptionAlgorithm encryptionAlgorithm, Dictionary serializedAdditionalRawData) { Value = value; EncryptionCertThumbprint = encryptionCertThumbprint; EncryptionAlgorithm = encryptionAlgorithm; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AsymmetricEncryptedSecret() + { } /// The value of the secret. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.Serialization.cs index 72beb622bc64..0dbe5e8f46ce 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class Authentication : IUtf8JsonSerializable + internal partial class Authentication : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SymmetricKey)) { writer.WritePropertyName("symmetricKey"u8); - writer.WriteObjectValue(SymmetricKey); + if (SymmetricKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SymmetricKey).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static Authentication DeserializeAuthentication(JsonElement element) + internal static Authentication DeserializeAuthentication(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional symmetricKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("symmetricKey"u8)) @@ -41,8 +71,61 @@ internal static Authentication DeserializeAuthentication(JsonElement element) symmetricKey = DataBoxEdgeSymmetricKey.DeserializeDataBoxEdgeSymmetricKey(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Authentication(symmetricKey.Value, serializedAdditionalRawData); + } + + Authentication IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAuthentication(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Authentication IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAuthentication(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Authentication model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Authentication(Response response) + { + if (response is null) + { + return null; } - return new Authentication(symmetricKey.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAuthentication(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.cs index 4f882ef6b16e..31d6d51ace20 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/Authentication.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Authentication mechanism for IoT devices. internal partial class Authentication { - /// Initializes a new instance of Authentication. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Authentication() { } - /// Initializes a new instance of Authentication. + /// Initializes a new instance of . /// Symmetric key for authentication. - internal Authentication(DataBoxEdgeSymmetricKey symmetricKey) + /// Keeps track of any properties unknown to the library. + internal Authentication(DataBoxEdgeSymmetricKey symmetricKey, Dictionary serializedAdditionalRawData) { SymmetricKey = symmetricKey; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Symmetric key for authentication. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.Serialization.cs index fb8c0fe39662..17de2dd41298 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class AvailableDataBoxEdgeSku + public partial class AvailableDataBoxEdgeSku : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableDataBoxEdgeSku DeserializeAvailableDataBoxEdgeSku(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableDataBoxEdgeSku DeserializeAvailableDataBoxEdgeSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +61,7 @@ internal static AvailableDataBoxEdgeSku DeserializeAvailableDataBoxEdgeSku(JsonE Optional availability = default; Optional> shipmentTypes = default; Optional> capabilities = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceType"u8)) @@ -185,8 +213,61 @@ internal static AvailableDataBoxEdgeSku DeserializeAvailableDataBoxEdgeSku(JsonE capabilities = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableDataBoxEdgeSku(resourceType.Value, Optional.ToNullable(name), kind.Value, Optional.ToNullable(tier), size.Value, family.Value, Optional.ToList(locations), Optional.ToList(apiVersions), Optional.ToList(locationInfo), Optional.ToList(costs), Optional.ToNullable(signupOption), Optional.ToNullable(version), Optional.ToNullable(availability), Optional.ToList(shipmentTypes), Optional.ToList(capabilities)); + return new AvailableDataBoxEdgeSku(resourceType.Value, Optional.ToNullable(name), kind.Value, Optional.ToNullable(tier), size.Value, family.Value, Optional.ToList(locations), Optional.ToList(apiVersions), Optional.ToList(locationInfo), Optional.ToList(costs), Optional.ToNullable(signupOption), Optional.ToNullable(version), Optional.ToNullable(availability), Optional.ToList(shipmentTypes), Optional.ToList(capabilities), serializedAdditionalRawData); + } + + AvailableDataBoxEdgeSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableDataBoxEdgeSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableDataBoxEdgeSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableDataBoxEdgeSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableDataBoxEdgeSku model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableDataBoxEdgeSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableDataBoxEdgeSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.cs index 38630352afbb..ce638f6b23ca 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSku.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The Sku information. public partial class AvailableDataBoxEdgeSku { - /// Initializes a new instance of AvailableDataBoxEdgeSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableDataBoxEdgeSku() { Locations = new ChangeTrackingList(); @@ -24,7 +28,7 @@ internal AvailableDataBoxEdgeSku() Capabilities = new ChangeTrackingList(); } - /// Initializes a new instance of AvailableDataBoxEdgeSku. + /// Initializes a new instance of . /// The type of the resource. /// The Sku name. /// The Sku kind. @@ -40,7 +44,8 @@ internal AvailableDataBoxEdgeSku() /// Links to the next set of results. /// List of Shipment Types supported by this SKU. /// The capability info of the SKU. - internal AvailableDataBoxEdgeSku(string resourceType, DataBoxEdgeSkuName? name, string kind, DataBoxEdgeSkuTier? tier, string size, string family, IReadOnlyList locations, IReadOnlyList apiVersions, IReadOnlyList locationInfo, IReadOnlyList costs, DataBoxEdgeSkuSignupOption? signupOption, DataBoxEdgeSkuVersion? version, DataBoxEdgeSkuAvailability? availability, IReadOnlyList shipmentTypes, IReadOnlyList capabilities) + /// Keeps track of any properties unknown to the library. + internal AvailableDataBoxEdgeSku(string resourceType, DataBoxEdgeSkuName? name, string kind, DataBoxEdgeSkuTier? tier, string size, string family, IReadOnlyList locations, IReadOnlyList apiVersions, IReadOnlyList locationInfo, IReadOnlyList costs, DataBoxEdgeSkuSignupOption? signupOption, DataBoxEdgeSkuVersion? version, DataBoxEdgeSkuAvailability? availability, IReadOnlyList shipmentTypes, IReadOnlyList capabilities, Dictionary serializedAdditionalRawData) { ResourceType = resourceType; Name = name; @@ -57,6 +62,7 @@ internal AvailableDataBoxEdgeSku(string resourceType, DataBoxEdgeSkuName? name, Availability = availability; ShipmentTypes = shipmentTypes; Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of the resource. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.Serialization.cs index 8059457e1bae..c4c512de96b8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class AvailableDataBoxEdgeSkuList + internal partial class AvailableDataBoxEdgeSkuList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static AvailableDataBoxEdgeSkuList DeserializeAvailableDataBoxEdgeSkuList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static AvailableDataBoxEdgeSkuList DeserializeAvailableDataBoxEdgeSkuList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static AvailableDataBoxEdgeSkuList DeserializeAvailableDataBoxEdgeSkuLi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AvailableDataBoxEdgeSkuList(Optional.ToList(value), nextLink.Value); + return new AvailableDataBoxEdgeSkuList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + AvailableDataBoxEdgeSkuList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableDataBoxEdgeSkuList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvailableDataBoxEdgeSkuList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvailableDataBoxEdgeSkuList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvailableDataBoxEdgeSkuList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvailableDataBoxEdgeSkuList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvailableDataBoxEdgeSkuList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.cs index 5aa2043dc063..179e5aa9756f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/AvailableDataBoxEdgeSkuList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// List of SKU Information objects. internal partial class AvailableDataBoxEdgeSkuList { - /// Initializes a new instance of AvailableDataBoxEdgeSkuList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal AvailableDataBoxEdgeSkuList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of AvailableDataBoxEdgeSkuList. + /// Initializes a new instance of . /// List of ResourceType Sku. /// Links to the next set of results. - internal AvailableDataBoxEdgeSkuList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal AvailableDataBoxEdgeSkuList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of ResourceType Sku. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthScheduleData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthScheduleData.Serialization.cs index bf5816176995..9638bc084aad 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthScheduleData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthScheduleData.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class BandwidthScheduleData : IUtf8JsonSerializable + public partial class BandwidthScheduleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +41,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BandwidthScheduleData DeserializeBandwidthScheduleData(JsonElement element) + internal static BandwidthScheduleData DeserializeBandwidthScheduleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +72,7 @@ internal static BandwidthScheduleData DeserializeBandwidthScheduleData(JsonEleme TimeSpan stop = default; int rateInMbps = default; IList days = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -115,8 +136,61 @@ internal static BandwidthScheduleData DeserializeBandwidthScheduleData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BandwidthScheduleData(id, name, type, systemData.Value, start, stop, rateInMbps, days, serializedAdditionalRawData); + } + + BandwidthScheduleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBandwidthScheduleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BandwidthScheduleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBandwidthScheduleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BandwidthScheduleData model) + { + if (model is null) + { + return null; } - return new BandwidthScheduleData(id, name, type, systemData.Value, start, stop, rateInMbps, days); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BandwidthScheduleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBandwidthScheduleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.Serialization.cs index d9ce9256e3f8..56387d499304 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class BandwidthSchedulesList + internal partial class BandwidthSchedulesList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static BandwidthSchedulesList DeserializeBandwidthSchedulesList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static BandwidthSchedulesList DeserializeBandwidthSchedulesList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static BandwidthSchedulesList DeserializeBandwidthSchedulesList(JsonEle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new BandwidthSchedulesList(Optional.ToList(value), nextLink.Value); + return new BandwidthSchedulesList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + BandwidthSchedulesList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBandwidthSchedulesList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BandwidthSchedulesList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBandwidthSchedulesList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BandwidthSchedulesList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BandwidthSchedulesList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBandwidthSchedulesList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.cs index 9041cede296a..c9ca4ecee562 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/BandwidthSchedulesList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The collection of bandwidth schedules. internal partial class BandwidthSchedulesList { - /// Initializes a new instance of BandwidthSchedulesList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal BandwidthSchedulesList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of BandwidthSchedulesList. + /// Initializes a new instance of . /// The list of bandwidth schedules. /// Link to the next set of results. - internal BandwidthSchedulesList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal BandwidthSchedulesList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of bandwidth schedules. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.Serialization.cs index 6d47a7744ca4..f38aac477689 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class ClientAccessRight : IUtf8JsonSerializable + public partial class ClientAccessRight : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("client"u8); writer.WriteStringValue(Client); writer.WritePropertyName("accessPermission"u8); writer.WriteStringValue(AccessPermission.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ClientAccessRight DeserializeClientAccessRight(JsonElement element) + internal static ClientAccessRight DeserializeClientAccessRight(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string client = default; EdgeClientPermissionType accessPermission = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("client"u8)) @@ -42,8 +65,61 @@ internal static ClientAccessRight DeserializeClientAccessRight(JsonElement eleme accessPermission = new EdgeClientPermissionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ClientAccessRight(client, accessPermission, serializedAdditionalRawData); + } + + ClientAccessRight IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeClientAccessRight(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ClientAccessRight IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeClientAccessRight(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ClientAccessRight model) + { + if (model is null) + { + return null; } - return new ClientAccessRight(client, accessPermission); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ClientAccessRight(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeClientAccessRight(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.cs index 5fc06eedcc70..13a3c7e3d4bc 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ClientAccessRight.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The mapping between a particular client IP and the type of access client has on the NFS share. public partial class ClientAccessRight { - /// Initializes a new instance of ClientAccessRight. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// IP of the client. /// Type of access to be allowed for the client. /// is null. @@ -25,6 +29,22 @@ public ClientAccessRight(string client, EdgeClientPermissionType accessPermissio AccessPermission = accessPermission; } + /// Initializes a new instance of . + /// IP of the client. + /// Type of access to be allowed for the client. + /// Keeps track of any properties unknown to the library. + internal ClientAccessRight(string client, EdgeClientPermissionType accessPermission, Dictionary serializedAdditionalRawData) + { + Client = client; + AccessPermission = accessPermission; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClientAccessRight() + { + } + /// IP of the client. public string Client { get; set; } /// Type of access to be allowed for the client. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.Serialization.cs index 1eaed97ea0f0..1bcf7436bf7c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class CloudEdgeManagementRole : IUtf8JsonSerializable + public partial class CloudEdgeManagementRole : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -26,11 +34,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RoleStatus.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CloudEdgeManagementRole DeserializeCloudEdgeManagementRole(JsonElement element) + internal static CloudEdgeManagementRole DeserializeCloudEdgeManagementRole(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +65,7 @@ internal static CloudEdgeManagementRole DeserializeCloudEdgeManagementRole(JsonE Optional localManagementStatus = default; Optional edgeProfile = default; Optional roleStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -113,8 +136,61 @@ internal static CloudEdgeManagementRole DeserializeCloudEdgeManagementRole(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CloudEdgeManagementRole(id, name, type, systemData.Value, kind, Optional.ToNullable(localManagementStatus), edgeProfile.Value, Optional.ToNullable(roleStatus), serializedAdditionalRawData); + } + + CloudEdgeManagementRole IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCloudEdgeManagementRole(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CloudEdgeManagementRole IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCloudEdgeManagementRole(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CloudEdgeManagementRole model) + { + if (model is null) + { + return null; } - return new CloudEdgeManagementRole(id, name, type, systemData.Value, kind, Optional.ToNullable(localManagementStatus), edgeProfile.Value, Optional.ToNullable(roleStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CloudEdgeManagementRole(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCloudEdgeManagementRole(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.cs index c0b644ff71aa..cf690c0b3b51 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CloudEdgeManagementRole.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -18,13 +20,13 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// public partial class CloudEdgeManagementRole : DataBoxEdgeRoleData { - /// Initializes a new instance of CloudEdgeManagementRole. + /// Initializes a new instance of . public CloudEdgeManagementRole() { Kind = DataBoxEdgeRoleType.CloudEdgeManagement; } - /// Initializes a new instance of CloudEdgeManagementRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -33,7 +35,8 @@ public CloudEdgeManagementRole() /// Local Edge Management Status. /// Edge Profile of the resource. /// Role status. - internal CloudEdgeManagementRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, DataBoxEdgeRoleStatus? localManagementStatus, EdgeProfile edgeProfile, DataBoxEdgeRoleStatus? roleStatus) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal CloudEdgeManagementRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, DataBoxEdgeRoleStatus? localManagementStatus, EdgeProfile edgeProfile, DataBoxEdgeRoleStatus? roleStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { LocalManagementStatus = localManagementStatus; EdgeProfile = edgeProfile; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.Serialization.cs index fe0b90ed4164..8fe590569d04 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class CniConfig + public partial class CniConfig : IUtf8JsonSerializable, IModelJsonSerializable { - internal static CniConfig DeserializeCniConfig(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static CniConfig DeserializeCniConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static CniConfig DeserializeCniConfig(JsonElement element) Optional version = default; Optional podSubnet = default; Optional serviceSubnet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -44,8 +73,61 @@ internal static CniConfig DeserializeCniConfig(JsonElement element) serviceSubnet = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CniConfig(type.Value, version.Value, podSubnet.Value, serviceSubnet.Value); + return new CniConfig(type.Value, version.Value, podSubnet.Value, serviceSubnet.Value, serializedAdditionalRawData); + } + + CniConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCniConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CniConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCniConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CniConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CniConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCniConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.cs index 4a4ef16e6682..64bee5e20268 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/CniConfig.cs @@ -5,27 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Cni configuration. public partial class CniConfig { - /// Initializes a new instance of CniConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal CniConfig() { } - /// Initializes a new instance of CniConfig. + /// Initializes a new instance of . /// Cni type. /// Cni version. /// Pod Subnet. /// Service subnet. - internal CniConfig(string cniConfigType, string version, string podSubnet, string serviceSubnet) + /// Keeps track of any properties unknown to the library. + internal CniConfig(string cniConfigType, string version, string podSubnet, string serviceSubnet, Dictionary serializedAdditionalRawData) { CniConfigType = cniConfigType; Version = version; PodSubnet = podSubnet; ServiceSubnet = serviceSubnet; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cni type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.Serialization.cs index ebdafab39f9e..870ac72ec978 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class ContainerList + internal partial class ContainerList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ContainerList DeserializeContainerList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ContainerList DeserializeContainerList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ContainerList DeserializeContainerList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ContainerList(Optional.ToList(value), nextLink.Value); + return new ContainerList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ContainerList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeContainerList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ContainerList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeContainerList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ContainerList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ContainerList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeContainerList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.cs index b754c46f6659..91f9098097fb 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ContainerList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of all the containers on the Data Box Edge/Gateway device. internal partial class ContainerList { - /// Initializes a new instance of ContainerList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ContainerList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ContainerList. + /// Initializes a new instance of . /// The list of containers. /// Link to the next set of results. - internal ContainerList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ContainerList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of containers. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertData.Serialization.cs index 03e3b1f593d8..cc649ec2a705 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertData.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeAlertData : IUtf8JsonSerializable + public partial class DataBoxEdgeAlertData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeAlertData DeserializeDataBoxEdgeAlertData(JsonElement element) + internal static DataBoxEdgeAlertData DeserializeDataBoxEdgeAlertData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +62,7 @@ internal static DataBoxEdgeAlertData DeserializeDataBoxEdgeAlertData(JsonElement Optional severity = default; Optional errorDetails = default; Optional> detailedInformation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -136,8 +157,61 @@ internal static DataBoxEdgeAlertData DeserializeDataBoxEdgeAlertData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeAlertData(id, name, type, systemData.Value, title.Value, alertType.Value, Optional.ToNullable(appearedAtDateTime), recommendation.Value, Optional.ToNullable(severity), errorDetails.Value, Optional.ToDictionary(detailedInformation), serializedAdditionalRawData); + } + + DataBoxEdgeAlertData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeAlertData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeAlertData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeAlertData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeAlertData model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeAlertData(id, name, type, systemData.Value, title.Value, alertType.Value, Optional.ToNullable(appearedAtDateTime), recommendation.Value, Optional.ToNullable(severity), errorDetails.Value, Optional.ToDictionary(detailedInformation)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeAlertData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeAlertData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.Serialization.cs index 1a752ccea084..c6350d28b5fb 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeAlertErrorDetails + public partial class DataBoxEdgeAlertErrorDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeAlertErrorDetails DeserializeDataBoxEdgeAlertErrorDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeAlertErrorDetails DeserializeDataBoxEdgeAlertErrorDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static DataBoxEdgeAlertErrorDetails DeserializeDataBoxEdgeAlertErrorDet Optional errorCode = default; Optional errorMessage = default; Optional occurrences = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errorCode"u8)) @@ -42,8 +71,61 @@ internal static DataBoxEdgeAlertErrorDetails DeserializeDataBoxEdgeAlertErrorDet occurrences = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeAlertErrorDetails(errorCode.Value, errorMessage.Value, Optional.ToNullable(occurrences)); + return new DataBoxEdgeAlertErrorDetails(errorCode.Value, errorMessage.Value, Optional.ToNullable(occurrences), serializedAdditionalRawData); + } + + DataBoxEdgeAlertErrorDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeAlertErrorDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeAlertErrorDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeAlertErrorDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeAlertErrorDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeAlertErrorDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeAlertErrorDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.cs index d8bb78a0ec64..c7f6639c9ebc 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeAlertErrorDetails.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Error details for the alert. public partial class DataBoxEdgeAlertErrorDetails { - /// Initializes a new instance of DataBoxEdgeAlertErrorDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeAlertErrorDetails() { } - /// Initializes a new instance of DataBoxEdgeAlertErrorDetails. + /// Initializes a new instance of . /// Error code. /// Error Message. /// Number of occurrences. - internal DataBoxEdgeAlertErrorDetails(string errorCode, string errorMessage, int? occurrences) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeAlertErrorDetails(string errorCode, string errorMessage, int? occurrences, Dictionary serializedAdditionalRawData) { ErrorCode = errorCode; ErrorMessage = errorMessage; Occurrences = occurrences; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Error code. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.Serialization.cs index bfaffce73919..ce885bb5972f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeContactDetails : IUtf8JsonSerializable + public partial class DataBoxEdgeContactDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("contactPerson"u8); writer.WriteStringValue(ContactPerson); @@ -29,11 +36,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeContactDetails DeserializeDataBoxEdgeContactDetails(JsonElement element) + internal static DataBoxEdgeContactDetails DeserializeDataBoxEdgeContactDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +63,7 @@ internal static DataBoxEdgeContactDetails DeserializeDataBoxEdgeContactDetails(J string companyName = default; string phone = default; IList emailList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("contactPerson"u8)) @@ -69,8 +91,61 @@ internal static DataBoxEdgeContactDetails DeserializeDataBoxEdgeContactDetails(J emailList = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeContactDetails(contactPerson, companyName, phone, emailList, serializedAdditionalRawData); + } + + DataBoxEdgeContactDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeContactDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeContactDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeContactDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeContactDetails model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeContactDetails(contactPerson, companyName, phone, emailList); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeContactDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeContactDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.cs index 271f3384ddfd..2a2bcdff10e5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeContactDetails.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Contains all the contact details of the customer. public partial class DataBoxEdgeContactDetails { - /// Initializes a new instance of DataBoxEdgeContactDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The contact person name. /// The name of the company. /// The phone number. @@ -34,17 +37,24 @@ public DataBoxEdgeContactDetails(string contactPerson, string companyName, strin EmailList = emailList.ToList(); } - /// Initializes a new instance of DataBoxEdgeContactDetails. + /// Initializes a new instance of . /// The contact person name. /// The name of the company. /// The phone number. /// The email list. - internal DataBoxEdgeContactDetails(string contactPerson, string companyName, string phone, IList emailList) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeContactDetails(string contactPerson, string companyName, string phone, IList emailList, Dictionary serializedAdditionalRawData) { ContactPerson = contactPerson; CompanyName = companyName; Phone = phone; EmailList = emailList; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeContactDetails() + { } /// The contact person name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.Serialization.cs index 9e34e9a11663..77d86891c1fa 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.Serialization.cs @@ -5,20 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDataCenterAccessCode + public partial class DataBoxEdgeDataCenterAccessCode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeDataCenterAccessCode DeserializeDataBoxEdgeDataCenterAccessCode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AuthCode)) + { + writer.WritePropertyName("authCode"u8); + writer.WriteStringValue(AuthCode); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeDataCenterAccessCode DeserializeDataBoxEdgeDataCenterAccessCode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional authCode = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -38,8 +75,61 @@ internal static DataBoxEdgeDataCenterAccessCode DeserializeDataBoxEdgeDataCenter } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeDataCenterAccessCode(authCode.Value); + return new DataBoxEdgeDataCenterAccessCode(authCode.Value, serializedAdditionalRawData); + } + + DataBoxEdgeDataCenterAccessCode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDataCenterAccessCode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDataCenterAccessCode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDataCenterAccessCode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDataCenterAccessCode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDataCenterAccessCode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDataCenterAccessCode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.cs index e7214da70be9..cee47418fa48 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDataCenterAccessCode.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// DC Access code in the case of Self Managed Shipping. public partial class DataBoxEdgeDataCenterAccessCode { - /// Initializes a new instance of DataBoxEdgeDataCenterAccessCode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeDataCenterAccessCode() { } - /// Initializes a new instance of DataBoxEdgeDataCenterAccessCode. + /// Initializes a new instance of . /// DCAccess Code for the Self Managed shipment. - internal DataBoxEdgeDataCenterAccessCode(string authCode) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDataCenterAccessCode(string authCode, Dictionary serializedAdditionalRawData) { AuthCode = authCode; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// DCAccess Code for the Self Managed shipment. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.Serialization.cs index 0fb5f5cf12c2..75ffb9e3f00e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDeviceCapacityInfo : IUtf8JsonSerializable + public partial class DataBoxEdgeDeviceCapacityInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -28,12 +34,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ClusterStorageCapacityInfo)) { writer.WritePropertyName("clusterStorageCapacityInfo"u8); - writer.WriteObjectValue(ClusterStorageCapacityInfo); + if (ClusterStorageCapacityInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClusterStorageCapacityInfo).Serialize(writer, options); + } } if (Optional.IsDefined(ClusterComputeCapacityInfo)) { writer.WritePropertyName("clusterComputeCapacityInfo"u8); - writer.WriteObjectValue(ClusterComputeCapacityInfo); + if (ClusterComputeCapacityInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClusterComputeCapacityInfo).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(NodeCapacityInfos)) { @@ -42,16 +62,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in NodeCapacityInfos) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeDeviceCapacityInfo DeserializeDataBoxEdgeDeviceCapacityInfo(JsonElement element) + internal static DataBoxEdgeDeviceCapacityInfo DeserializeDataBoxEdgeDeviceCapacityInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +105,7 @@ internal static DataBoxEdgeDeviceCapacityInfo DeserializeDataBoxEdgeDeviceCapaci Optional clusterStorageCapacityInfo = default; Optional clusterComputeCapacityInfo = default; Optional> nodeCapacityInfos = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -143,8 +185,61 @@ internal static DataBoxEdgeDeviceCapacityInfo DeserializeDataBoxEdgeDeviceCapaci } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDeviceCapacityInfo(id, name, type, systemData.Value, Optional.ToNullable(timeStamp), clusterStorageCapacityInfo.Value, clusterComputeCapacityInfo.Value, Optional.ToDictionary(nodeCapacityInfos), serializedAdditionalRawData); + } + + DataBoxEdgeDeviceCapacityInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceCapacityInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceCapacityInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceCapacityInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceCapacityInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceCapacityInfo(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeDeviceCapacityInfo(id, name, type, systemData.Value, Optional.ToNullable(timeStamp), clusterStorageCapacityInfo.Value, clusterComputeCapacityInfo.Value, Optional.ToDictionary(nodeCapacityInfos)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceCapacityInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.cs index 341626327e43..84eeb67381a1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceCapacityInfo.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Object for Capturing DeviceCapacityInfo. public partial class DataBoxEdgeDeviceCapacityInfo : ResourceData { - /// Initializes a new instance of DataBoxEdgeDeviceCapacityInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeDeviceCapacityInfo() { NodeCapacityInfos = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataBoxEdgeDeviceCapacityInfo. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,12 +33,14 @@ public DataBoxEdgeDeviceCapacityInfo() /// Cluster capacity data for storage resources (CSV). /// Cluster capacity data for compute resources (Memory and GPU). /// The dictionary of individual node names and node capacities in the cluster. - internal DataBoxEdgeDeviceCapacityInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? timeStamp, EdgeClusterStorageViewInfo clusterStorageCapacityInfo, EdgeClusterCapacityViewInfo clusterComputeCapacityInfo, IDictionary nodeCapacityInfos) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceCapacityInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? timeStamp, EdgeClusterStorageViewInfo clusterStorageCapacityInfo, EdgeClusterCapacityViewInfo clusterComputeCapacityInfo, IDictionary nodeCapacityInfos, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TimeStamp = timeStamp; ClusterStorageCapacityInfo = clusterStorageCapacityInfo; ClusterComputeCapacityInfo = clusterComputeCapacityInfo; NodeCapacityInfos = nodeCapacityInfos; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Timestamp of request in UTC. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceData.Serialization.cs index 1d5b10897b01..6c81860dc748 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceData.Serialization.cs @@ -5,24 +5,37 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeDeviceData : IUtf8JsonSerializable + public partial class DataBoxEdgeDeviceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(ETag)) { @@ -52,14 +65,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DataResidency)) { writer.WritePropertyName("dataResidency"u8); - writer.WriteObjectValue(DataResidency); + if (DataResidency is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataResidency).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeDeviceData DeserializeDataBoxEdgeDeviceData(JsonElement element) + internal static DataBoxEdgeDeviceData DeserializeDataBoxEdgeDeviceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -91,6 +125,7 @@ internal static DataBoxEdgeDeviceData DeserializeDataBoxEdgeDeviceData(JsonEleme Optional resourceMoveDetails = default; Optional edgeProfile = default; Optional dataResidency = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -306,8 +341,61 @@ internal static DataBoxEdgeDeviceData DeserializeDataBoxEdgeDeviceData(JsonEleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDeviceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, Optional.ToNullable(etag), identity, Optional.ToNullable(kind), Optional.ToNullable(dataBoxEdgeDeviceStatus), serialNumber.Value, description.Value, modelDescription.Value, Optional.ToNullable(deviceType), friendlyName.Value, culture.Value, deviceModel.Value, deviceSoftwareVersion.Value, Optional.ToNullable(deviceLocalCapacity), timeZone.Value, deviceHcsVersion.Value, Optional.ToList(configuredRoleTypes), Optional.ToNullable(nodeCount), resourceMoveDetails.Value, edgeProfile.Value, dataResidency.Value, serializedAdditionalRawData); + } + + DataBoxEdgeDeviceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceData model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeDeviceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, Optional.ToNullable(etag), identity, Optional.ToNullable(kind), Optional.ToNullable(dataBoxEdgeDeviceStatus), serialNumber.Value, description.Value, modelDescription.Value, Optional.ToNullable(deviceType), friendlyName.Value, culture.Value, deviceModel.Value, deviceSoftwareVersion.Value, Optional.ToNullable(deviceLocalCapacity), timeZone.Value, deviceHcsVersion.Value, Optional.ToList(configuredRoleTypes), Optional.ToNullable(nodeCount), resourceMoveDetails.Value, edgeProfile.Value, dataResidency.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.Serialization.cs index 1956f3cb423b..9a37f1398693 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDeviceExtendedInfo : IUtf8JsonSerializable + public partial class DataBoxEdgeDeviceExtendedInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -56,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(KeyVaultSyncStatus.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeDeviceExtendedInfo DeserializeDataBoxEdgeDeviceExtendedInfo(JsonElement element) + internal static DataBoxEdgeDeviceExtendedInfo DeserializeDataBoxEdgeDeviceExtendedInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +104,7 @@ internal static DataBoxEdgeDeviceExtendedInfo DeserializeDataBoxEdgeDeviceExtend Optional cloudWitnessStorageAccountName = default; Optional cloudWitnessContainerName = default; Optional cloudWitnessStorageEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -222,8 +243,61 @@ internal static DataBoxEdgeDeviceExtendedInfo DeserializeDataBoxEdgeDeviceExtend } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDeviceExtendedInfo(id, name, type, systemData.Value, encryptionKeyThumbprint.Value, encryptionKey.Value, resourceKey.Value, clientSecretStoreId.Value, clientSecretStoreUrl.Value, channelIntegrityKeyName.Value, channelIntegrityKeyVersion.Value, Optional.ToNullable(keyVaultSyncStatus), Optional.ToDictionary(deviceSecrets), Optional.ToNullable(clusterWitnessType), fileShareWitnessLocation.Value, fileShareWitnessUsername.Value, cloudWitnessStorageAccountName.Value, cloudWitnessContainerName.Value, cloudWitnessStorageEndpoint.Value, serializedAdditionalRawData); + } + + DataBoxEdgeDeviceExtendedInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceExtendedInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceExtendedInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceExtendedInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceExtendedInfo model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeDeviceExtendedInfo(id, name, type, systemData.Value, encryptionKeyThumbprint.Value, encryptionKey.Value, resourceKey.Value, clientSecretStoreId.Value, clientSecretStoreUrl.Value, channelIntegrityKeyName.Value, channelIntegrityKeyVersion.Value, Optional.ToNullable(keyVaultSyncStatus), Optional.ToDictionary(deviceSecrets), Optional.ToNullable(clusterWitnessType), fileShareWitnessLocation.Value, fileShareWitnessUsername.Value, cloudWitnessStorageAccountName.Value, cloudWitnessContainerName.Value, cloudWitnessStorageEndpoint.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceExtendedInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceExtendedInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.cs index 8f8e200d67f8..418234bf6c70 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfo.cs @@ -15,13 +15,16 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The extended Info of the Data Box Edge/Gateway device. public partial class DataBoxEdgeDeviceExtendedInfo : ResourceData { - /// Initializes a new instance of DataBoxEdgeDeviceExtendedInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeDeviceExtendedInfo() { DeviceSecrets = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataBoxEdgeDeviceExtendedInfo. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +44,8 @@ public DataBoxEdgeDeviceExtendedInfo() /// The Cloud Witness Storage account name. /// The Container for cloud witness in the storage account. /// The Azure service endpoint of the cloud witness storage account. - internal DataBoxEdgeDeviceExtendedInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string encryptionKeyThumbprint, string encryptionKey, string resourceKey, ResourceIdentifier clientSecretStoreId, Uri clientSecretStoreUri, string channelIntegrityKeyName, string channelIntegrityKeyVersion, EdgeKeyVaultSyncStatus? keyVaultSyncStatus, IReadOnlyDictionary deviceSecrets, EdgeClusterWitnessType? clusterWitnessType, string fileShareWitnessLocation, string fileShareWitnessUsername, string cloudWitnessStorageAccountName, string cloudWitnessContainerName, string cloudWitnessStorageEndpoint) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceExtendedInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string encryptionKeyThumbprint, string encryptionKey, string resourceKey, ResourceIdentifier clientSecretStoreId, Uri clientSecretStoreUri, string channelIntegrityKeyName, string channelIntegrityKeyVersion, EdgeKeyVaultSyncStatus? keyVaultSyncStatus, IReadOnlyDictionary deviceSecrets, EdgeClusterWitnessType? clusterWitnessType, string fileShareWitnessLocation, string fileShareWitnessUsername, string cloudWitnessStorageAccountName, string cloudWitnessContainerName, string cloudWitnessStorageEndpoint, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { EncryptionKeyThumbprint = encryptionKeyThumbprint; EncryptionKey = encryptionKey; @@ -58,6 +62,7 @@ internal DataBoxEdgeDeviceExtendedInfo(ResourceIdentifier id, string name, Resou CloudWitnessStorageAccountName = cloudWitnessStorageAccountName; CloudWitnessContainerName = cloudWitnessContainerName; CloudWitnessStorageEndpoint = cloudWitnessStorageEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The digital signature of encrypted certificate. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.Serialization.cs index 33aee1ad6b2b..936f783f9e6f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDeviceExtendedInfoPatch : IUtf8JsonSerializable + public partial class DataBoxEdgeDeviceExtendedInfoPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClientSecretStoreId)) { @@ -40,7 +48,129 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("syncStatus"u8); writer.WriteStringValue(SyncStatus.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxEdgeDeviceExtendedInfoPatch DeserializeDataBoxEdgeDeviceExtendedInfoPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientSecretStoreId = default; + Optional clientSecretStoreUrl = default; + Optional channelIntegrityKeyName = default; + Optional channelIntegrityKeyVersion = default; + Optional syncStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientSecretStoreId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientSecretStoreId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("clientSecretStoreUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientSecretStoreUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("channelIntegrityKeyName"u8)) + { + channelIntegrityKeyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("channelIntegrityKeyVersion"u8)) + { + channelIntegrityKeyVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("syncStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + syncStatus = new EdgeKeyVaultSyncStatus(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDeviceExtendedInfoPatch(clientSecretStoreId.Value, clientSecretStoreUrl.Value, channelIntegrityKeyName.Value, channelIntegrityKeyVersion.Value, Optional.ToNullable(syncStatus), serializedAdditionalRawData); + } + + DataBoxEdgeDeviceExtendedInfoPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceExtendedInfoPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceExtendedInfoPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceExtendedInfoPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceExtendedInfoPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceExtendedInfoPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceExtendedInfoPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.cs index ad3eb047d6e1..f882ba1d64aa 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceExtendedInfoPatch.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,11 +14,31 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The Data Box Edge/Gateway device extended info patch. public partial class DataBoxEdgeDeviceExtendedInfoPatch { - /// Initializes a new instance of DataBoxEdgeDeviceExtendedInfoPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeDeviceExtendedInfoPatch() { } + /// Initializes a new instance of . + /// The Key Vault ARM Id for client secrets. + /// The url to access the Client Key Vault. + /// The name for Channel Integrity Key stored in the Client Key Vault. + /// The version of Channel Integrity Key stored in the Client Key Vault. + /// For changing or to initiate the resync to key-vault set the status to KeyVaultSyncPending, rest of the status will not be applicable. + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceExtendedInfoPatch(ResourceIdentifier clientSecretStoreId, Uri clientSecretStoreUri, string channelIntegrityKeyName, string channelIntegrityKeyVersion, EdgeKeyVaultSyncStatus? syncStatus, Dictionary serializedAdditionalRawData) + { + ClientSecretStoreId = clientSecretStoreId; + ClientSecretStoreUri = clientSecretStoreUri; + ChannelIntegrityKeyName = channelIntegrityKeyName; + ChannelIntegrityKeyVersion = channelIntegrityKeyVersion; + SyncStatus = syncStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The Key Vault ARM Id for client secrets. public ResourceIdentifier ClientSecretStoreId { get; set; } /// The url to access the Client Key Vault. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.Serialization.cs index 55c525ec1e3f..22f97f76e570 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class DataBoxEdgeDeviceList + internal partial class DataBoxEdgeDeviceList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeDeviceList DeserializeDataBoxEdgeDeviceList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeDeviceList DeserializeDataBoxEdgeDeviceList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static DataBoxEdgeDeviceList DeserializeDataBoxEdgeDeviceList(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeDeviceList(Optional.ToList(value), nextLink.Value); + return new DataBoxEdgeDeviceList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DataBoxEdgeDeviceList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.cs index aa6c625446a0..7fecd2dbfc5b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The collection of Data Box Edge/Gateway devices. internal partial class DataBoxEdgeDeviceList { - /// Initializes a new instance of DataBoxEdgeDeviceList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeDeviceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeDeviceList. + /// Initializes a new instance of . /// The list of Data Box Edge/Gateway devices. /// Link to the next set of results. - internal DataBoxEdgeDeviceList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of Data Box Edge/Gateway devices. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.Serialization.cs index cfe36af62594..b35bd76c2f19 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.Serialization.cs @@ -5,26 +5,47 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDeviceNetworkSettings : IUtf8JsonSerializable + public partial class DataBoxEdgeDeviceNetworkSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeDeviceNetworkSettings DeserializeDataBoxEdgeDeviceNetworkSettings(JsonElement element) + internal static DataBoxEdgeDeviceNetworkSettings DeserializeDataBoxEdgeDeviceNetworkSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +55,7 @@ internal static DataBoxEdgeDeviceNetworkSettings DeserializeDataBoxEdgeDeviceNet ResourceType type = default; Optional systemData = default; Optional> networkAdapters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -86,8 +108,61 @@ internal static DataBoxEdgeDeviceNetworkSettings DeserializeDataBoxEdgeDeviceNet } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDeviceNetworkSettings(id, name, type, systemData.Value, Optional.ToList(networkAdapters), serializedAdditionalRawData); + } + + DataBoxEdgeDeviceNetworkSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceNetworkSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceNetworkSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceNetworkSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceNetworkSettings model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeDeviceNetworkSettings(id, name, type, systemData.Value, Optional.ToList(networkAdapters)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceNetworkSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceNetworkSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.cs index 328b2fe6c8a4..cf13118897a7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceNetworkSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,21 +15,26 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The network settings of a device. public partial class DataBoxEdgeDeviceNetworkSettings : ResourceData { - /// Initializes a new instance of DataBoxEdgeDeviceNetworkSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeDeviceNetworkSettings() { NetworkAdapters = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeDeviceNetworkSettings. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The network adapter list on the device. - internal DataBoxEdgeDeviceNetworkSettings(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList networkAdapters) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceNetworkSettings(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList networkAdapters, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { NetworkAdapters = networkAdapters; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The network adapter list on the device. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.Serialization.cs index 349462ba2795..47bd9803b8fc 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDevicePatch : IUtf8JsonSerializable + public partial class DataBoxEdgeDevicePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -36,10 +45,144 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EdgeProfile)) { writer.WritePropertyName("edgeProfile"u8); - writer.WriteObjectValue(EdgeProfile); + if (EdgeProfile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EdgeProfile).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataBoxEdgeDevicePatch DeserializeDataBoxEdgeDevicePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional edgeProfile = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("edgeProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + edgeProfile = EdgeProfilePatch.DeserializeEdgeProfilePatch(property0.Value); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDevicePatch(Optional.ToDictionary(tags), identity, edgeProfile.Value, serializedAdditionalRawData); + } + + DataBoxEdgeDevicePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDevicePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDevicePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDevicePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDevicePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDevicePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDevicePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.cs index 5871ee5fc4fc..3c85fad07a70 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDevicePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,28 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The Data Box Edge/Gateway device patch. public partial class DataBoxEdgeDevicePatch { - /// Initializes a new instance of DataBoxEdgeDevicePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeDevicePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The tags attached to the Data Box Edge/Gateway resource. + /// Msi identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. + /// Edge Profile property of the Data Box Edge/Gateway device. + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDevicePatch(IDictionary tags, ManagedServiceIdentity identity, EdgeProfilePatch edgeProfile, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + EdgeProfile = edgeProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The tags attached to the Data Box Edge/Gateway resource. public IDictionary Tags { get; } /// Msi identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.Serialization.cs index 56fbc3579657..d816fd5cbeb0 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.Serialization.cs @@ -5,21 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDeviceSecret + public partial class DataBoxEdgeDeviceSecret : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeDeviceSecret DeserializeDataBoxEdgeDeviceSecret(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(EncryptedSecret)) + { + writer.WritePropertyName("encryptedSecret"u8); + if (EncryptedSecret is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptedSecret).Serialize(writer, options); + } + } + if (Optional.IsDefined(KeyVaultId)) + { + writer.WritePropertyName("keyVaultId"u8); + writer.WriteStringValue(KeyVaultId); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeDeviceSecret DeserializeDataBoxEdgeDeviceSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional encryptedSecret = default; Optional keyVaultId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("encryptedSecret"u8)) @@ -36,8 +82,61 @@ internal static DataBoxEdgeDeviceSecret DeserializeDataBoxEdgeDeviceSecret(JsonE keyVaultId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeDeviceSecret(encryptedSecret.Value, keyVaultId.Value); + return new DataBoxEdgeDeviceSecret(encryptedSecret.Value, keyVaultId.Value, serializedAdditionalRawData); + } + + DataBoxEdgeDeviceSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceSecret model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.cs index 4d2029014a29..a9b70addb958 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceSecret.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Holds device secret either as a KeyVault reference or as an encrypted value. public partial class DataBoxEdgeDeviceSecret { - /// Initializes a new instance of DataBoxEdgeDeviceSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeDeviceSecret() { } - /// Initializes a new instance of DataBoxEdgeDeviceSecret. + /// Initializes a new instance of . /// Encrypted (using device public key) secret value. /// Id of the Key-Vault where secret is stored (ex: secrets/AuthClientSecret/82ef4346187a4033a10d629cde07d740). - internal DataBoxEdgeDeviceSecret(AsymmetricEncryptedSecret encryptedSecret, string keyVaultId) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceSecret(AsymmetricEncryptedSecret encryptedSecret, string keyVaultId, Dictionary serializedAdditionalRawData) { EncryptedSecret = encryptedSecret; KeyVaultId = keyVaultId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Encrypted (using device public key) secret value. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.Serialization.cs index 6261ccc6b228..c8e7e674f56b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeDeviceUpdateSummary : IUtf8JsonSerializable + public partial class DataBoxEdgeDeviceUpdateSummary : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -51,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(LastSuccessfulInstallJobOn.Value, "O"); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeDeviceUpdateSummary DeserializeDataBoxEdgeDeviceUpdateSummary(JsonElement element) + internal static DataBoxEdgeDeviceUpdateSummary DeserializeDataBoxEdgeDeviceUpdateSummary(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,6 +109,7 @@ internal static DataBoxEdgeDeviceUpdateSummary DeserializeDataBoxEdgeDeviceUpdat Optional> updates = default; Optional totalUpdateSizeInBytes = default; Optional totalTimeInMinutes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -354,8 +375,61 @@ internal static DataBoxEdgeDeviceUpdateSummary DeserializeDataBoxEdgeDeviceUpdat } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeDeviceUpdateSummary(id, name, type, systemData.Value, deviceVersionNumber.Value, friendlyDeviceVersionName.Value, Optional.ToNullable(deviceLastScannedDateTime), Optional.ToNullable(lastCompletedScanJobDateTime), Optional.ToNullable(lastSuccessfulScanJobTime), Optional.ToNullable(lastCompletedDownloadJobDateTime), lastCompletedDownloadJobId.Value, Optional.ToNullable(lastDownloadJobStatus), Optional.ToNullable(lastSuccessfulInstallJobDateTime), Optional.ToNullable(lastCompletedInstallJobDateTime), lastCompletedInstallJobId.Value, Optional.ToNullable(lastInstallJobStatus), Optional.ToNullable(totalNumberOfUpdatesAvailable), Optional.ToNullable(totalNumberOfUpdatesPendingDownload), Optional.ToNullable(totalNumberOfUpdatesPendingInstall), Optional.ToNullable(rebootBehavior), Optional.ToNullable(ongoingUpdateOperation), inProgressDownloadJobId.Value, inProgressInstallJobId.Value, Optional.ToNullable(inProgressDownloadJobStartedDateTime), Optional.ToNullable(inProgressInstallJobStartedDateTime), Optional.ToList(updateTitles), Optional.ToList(updates), Optional.ToNullable(totalUpdateSizeInBytes), Optional.ToNullable(totalTimeInMinutes), serializedAdditionalRawData); + } + + DataBoxEdgeDeviceUpdateSummary IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeDeviceUpdateSummary(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeDeviceUpdateSummary IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeDeviceUpdateSummary(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeDeviceUpdateSummary model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeDeviceUpdateSummary(id, name, type, systemData.Value, deviceVersionNumber.Value, friendlyDeviceVersionName.Value, Optional.ToNullable(deviceLastScannedDateTime), Optional.ToNullable(lastCompletedScanJobDateTime), Optional.ToNullable(lastSuccessfulScanJobTime), Optional.ToNullable(lastCompletedDownloadJobDateTime), lastCompletedDownloadJobId.Value, Optional.ToNullable(lastDownloadJobStatus), Optional.ToNullable(lastSuccessfulInstallJobDateTime), Optional.ToNullable(lastCompletedInstallJobDateTime), lastCompletedInstallJobId.Value, Optional.ToNullable(lastInstallJobStatus), Optional.ToNullable(totalNumberOfUpdatesAvailable), Optional.ToNullable(totalNumberOfUpdatesPendingDownload), Optional.ToNullable(totalNumberOfUpdatesPendingInstall), Optional.ToNullable(rebootBehavior), Optional.ToNullable(ongoingUpdateOperation), inProgressDownloadJobId.Value, inProgressInstallJobId.Value, Optional.ToNullable(inProgressDownloadJobStartedDateTime), Optional.ToNullable(inProgressInstallJobStartedDateTime), Optional.ToList(updateTitles), Optional.ToList(updates), Optional.ToNullable(totalUpdateSizeInBytes), Optional.ToNullable(totalTimeInMinutes)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeDeviceUpdateSummary(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeDeviceUpdateSummary(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.cs index 931cb0ab490c..39fc683def2e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeDeviceUpdateSummary.cs @@ -15,14 +15,17 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Details about ongoing updates and availability of updates on the device. public partial class DataBoxEdgeDeviceUpdateSummary : ResourceData { - /// Initializes a new instance of DataBoxEdgeDeviceUpdateSummary. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeDeviceUpdateSummary() { UpdateTitles = new ChangeTrackingList(); Updates = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeDeviceUpdateSummary. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -52,7 +55,8 @@ public DataBoxEdgeDeviceUpdateSummary() /// The list of updates available for install. /// The total size of updates available for download in bytes. /// The total time in Minutes. - internal DataBoxEdgeDeviceUpdateSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string deviceVersionNumber, string friendlyDeviceVersionName, DateTimeOffset? deviceLastScannedOn, DateTimeOffset? lastCompletedScanJobOn, DateTimeOffset? lastSuccessfulScanJobOn, DateTimeOffset? lastCompletedDownloadJobOn, ResourceIdentifier lastCompletedDownloadJobId, DataBoxEdgeJobStatus? lastDownloadJobStatus, DateTimeOffset? lastSuccessfulInstallJobOn, DateTimeOffset? lastCompletedInstallJobOn, ResourceIdentifier lastCompletedInstallJobId, DataBoxEdgeJobStatus? lastInstallJobStatus, int? totalNumberOfUpdatesAvailable, int? totalNumberOfUpdatesPendingDownload, int? totalNumberOfUpdatesPendingInstall, InstallRebootBehavior? rebootBehavior, DataBoxEdgeUpdateOperation? ongoingUpdateOperation, ResourceIdentifier inProgressDownloadJobId, ResourceIdentifier inProgressInstallJobId, DateTimeOffset? inProgressDownloadJobStartedOn, DateTimeOffset? inProgressInstallJobStartedOn, IReadOnlyList updateTitles, IReadOnlyList updates, double? totalUpdateSizeInBytes, int? totalTimeInMinutes) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeDeviceUpdateSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string deviceVersionNumber, string friendlyDeviceVersionName, DateTimeOffset? deviceLastScannedOn, DateTimeOffset? lastCompletedScanJobOn, DateTimeOffset? lastSuccessfulScanJobOn, DateTimeOffset? lastCompletedDownloadJobOn, ResourceIdentifier lastCompletedDownloadJobId, DataBoxEdgeJobStatus? lastDownloadJobStatus, DateTimeOffset? lastSuccessfulInstallJobOn, DateTimeOffset? lastCompletedInstallJobOn, ResourceIdentifier lastCompletedInstallJobId, DataBoxEdgeJobStatus? lastInstallJobStatus, int? totalNumberOfUpdatesAvailable, int? totalNumberOfUpdatesPendingDownload, int? totalNumberOfUpdatesPendingInstall, InstallRebootBehavior? rebootBehavior, DataBoxEdgeUpdateOperation? ongoingUpdateOperation, ResourceIdentifier inProgressDownloadJobId, ResourceIdentifier inProgressInstallJobId, DateTimeOffset? inProgressDownloadJobStartedOn, DateTimeOffset? inProgressInstallJobStartedOn, IReadOnlyList updateTitles, IReadOnlyList updates, double? totalUpdateSizeInBytes, int? totalTimeInMinutes, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DeviceVersionNumber = deviceVersionNumber; FriendlyDeviceVersionName = friendlyDeviceVersionName; @@ -79,6 +83,7 @@ internal DataBoxEdgeDeviceUpdateSummary(ResourceIdentifier id, string name, Reso Updates = updates; TotalUpdateSizeInBytes = totalUpdateSizeInBytes; TotalTimeInMinutes = totalTimeInMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The current version of the device in format: 1.2.17312.13.",. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.Serialization.cs index b4d69402168d..27c6022a0fd5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeEtcdInfo + public partial class DataBoxEdgeEtcdInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeEtcdInfo DeserializeDataBoxEdgeEtcdInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeEtcdInfo DeserializeDataBoxEdgeEtcdInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -32,8 +61,61 @@ internal static DataBoxEdgeEtcdInfo DeserializeDataBoxEdgeEtcdInfo(JsonElement e version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeEtcdInfo(type.Value, version.Value); + return new DataBoxEdgeEtcdInfo(type.Value, version.Value, serializedAdditionalRawData); + } + + DataBoxEdgeEtcdInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeEtcdInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeEtcdInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeEtcdInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeEtcdInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeEtcdInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeEtcdInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.cs index d2e33f102c40..97c4df0e3a18 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeEtcdInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Etcd configuration. public partial class DataBoxEdgeEtcdInfo { - /// Initializes a new instance of DataBoxEdgeEtcdInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeEtcdInfo() { } - /// Initializes a new instance of DataBoxEdgeEtcdInfo. + /// Initializes a new instance of . /// Etcd type. /// Etcd version. - internal DataBoxEdgeEtcdInfo(string etcdInfoType, string version) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeEtcdInfo(string etcdInfoType, string version, Dictionary serializedAdditionalRawData) { EtcdInfoType = etcdInfoType; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Etcd type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.Serialization.cs index 2e04732ebef2..d2f4fbc49757 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.Serialization.cs @@ -5,16 +5,44 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeIPv4Config + public partial class DataBoxEdgeIPv4Config : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeIPv4Config DeserializeDataBoxEdgeIPv4Config(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeIPv4Config DeserializeDataBoxEdgeIPv4Config(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +50,7 @@ internal static DataBoxEdgeIPv4Config DeserializeDataBoxEdgeIPv4Config(JsonEleme Optional ipAddress = default; Optional subnet = default; Optional gateway = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipAddress"u8)) @@ -43,8 +72,61 @@ internal static DataBoxEdgeIPv4Config DeserializeDataBoxEdgeIPv4Config(JsonEleme gateway = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeIPv4Config(ipAddress.Value, subnet.Value, gateway.Value); + return new DataBoxEdgeIPv4Config(ipAddress.Value, subnet.Value, gateway.Value, serializedAdditionalRawData); + } + + DataBoxEdgeIPv4Config IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeIPv4Config(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeIPv4Config IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeIPv4Config(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeIPv4Config model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeIPv4Config(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeIPv4Config(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.cs index b69a6e047996..035fc1436a6a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv4Config.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Net; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Details related to the IPv4 address configuration. public partial class DataBoxEdgeIPv4Config { - /// Initializes a new instance of DataBoxEdgeIPv4Config. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeIPv4Config() { } - /// Initializes a new instance of DataBoxEdgeIPv4Config. + /// Initializes a new instance of . /// The IPv4 address of the network adapter. /// The IPv4 subnet of the network adapter. /// The IPv4 gateway of the network adapter. - internal DataBoxEdgeIPv4Config(IPAddress ipAddress, string subnet, string gateway) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeIPv4Config(IPAddress ipAddress, string subnet, string gateway, Dictionary serializedAdditionalRawData) { IPAddress = ipAddress; Subnet = subnet; Gateway = gateway; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The IPv4 address of the network adapter. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.Serialization.cs index 99e521b96882..9f458b659c2c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeIPv6Config + public partial class DataBoxEdgeIPv6Config : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeIPv6Config DeserializeDataBoxEdgeIPv6Config(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeIPv6Config DeserializeDataBoxEdgeIPv6Config(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static DataBoxEdgeIPv6Config DeserializeDataBoxEdgeIPv6Config(JsonEleme Optional ipAddress = default; Optional prefixLength = default; Optional gateway = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipAddress"u8)) @@ -42,8 +71,61 @@ internal static DataBoxEdgeIPv6Config DeserializeDataBoxEdgeIPv6Config(JsonEleme gateway = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeIPv6Config(ipAddress.Value, Optional.ToNullable(prefixLength), gateway.Value); + return new DataBoxEdgeIPv6Config(ipAddress.Value, Optional.ToNullable(prefixLength), gateway.Value, serializedAdditionalRawData); + } + + DataBoxEdgeIPv6Config IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeIPv6Config(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeIPv6Config IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeIPv6Config(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeIPv6Config model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeIPv6Config(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeIPv6Config(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.cs index d369616afb1e..536e438718e4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeIPv6Config.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Details related to the IPv6 address configuration. public partial class DataBoxEdgeIPv6Config { - /// Initializes a new instance of DataBoxEdgeIPv6Config. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeIPv6Config() { } - /// Initializes a new instance of DataBoxEdgeIPv6Config. + /// Initializes a new instance of . /// The IPv6 address of the network adapter. /// The IPv6 prefix of the network adapter. /// The IPv6 gateway of the network adapter. - internal DataBoxEdgeIPv6Config(string ipAddress, int? prefixLength, string gateway) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeIPv6Config(string ipAddress, int? prefixLength, string gateway, Dictionary serializedAdditionalRawData) { IPAddress = ipAddress; PrefixLength = prefixLength; Gateway = gateway; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The IPv6 address of the network adapter. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobData.Serialization.cs index 8310ae35dd9a..959e58c60ff4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobData.Serialization.cs @@ -6,17 +6,52 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeJobData + public partial class DataBoxEdgeJobData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeJobData DeserializeDataBoxEdgeJobData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Folder)) + { + writer.WritePropertyName("folder"u8); + writer.WriteStringValue(Folder); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeJobData DeserializeDataBoxEdgeJobData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +73,7 @@ internal static DataBoxEdgeJobData DeserializeDataBoxEdgeJobData(JsonElement ele Optional errorManifestFile = default; Optional refreshedEntityId = default; Optional folder = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -185,8 +221,61 @@ internal static DataBoxEdgeJobData DeserializeDataBoxEdgeJobData(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeJobData(id, name, type, systemData.Value, Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(percentComplete), error.Value, Optional.ToNullable(jobType), Optional.ToNullable(currentStage), downloadProgress.Value, installProgress.Value, Optional.ToNullable(totalRefreshErrors), errorManifestFile.Value, refreshedEntityId.Value, folder.Value); + return new DataBoxEdgeJobData(id, name, type, systemData.Value, Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(percentComplete), error.Value, Optional.ToNullable(jobType), Optional.ToNullable(currentStage), downloadProgress.Value, installProgress.Value, Optional.ToNullable(totalRefreshErrors), errorManifestFile.Value, refreshedEntityId.Value, folder.Value, serializedAdditionalRawData); + } + + DataBoxEdgeJobData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeJobData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeJobData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeJobData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeJobData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeJobData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeJobData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.Serialization.cs index 2d631b998bcd..135c40a48373 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeJobErrorDetails + public partial class DataBoxEdgeJobErrorDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeJobErrorDetails DeserializeDataBoxEdgeJobErrorDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeJobErrorDetails DeserializeDataBoxEdgeJobErrorDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static DataBoxEdgeJobErrorDetails DeserializeDataBoxEdgeJobErrorDetails Optional> errorDetails = default; Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errorDetails"u8)) @@ -48,8 +76,61 @@ internal static DataBoxEdgeJobErrorDetails DeserializeDataBoxEdgeJobErrorDetails message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeJobErrorDetails(Optional.ToList(errorDetails), code.Value, message.Value); + return new DataBoxEdgeJobErrorDetails(Optional.ToList(errorDetails), code.Value, message.Value, serializedAdditionalRawData); + } + + DataBoxEdgeJobErrorDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeJobErrorDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeJobErrorDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeJobErrorDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeJobErrorDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeJobErrorDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeJobErrorDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.cs index 2e03d82255c2..6cc8c33f3788 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorDetails.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The job error information containing the list of job errors. public partial class DataBoxEdgeJobErrorDetails { - /// Initializes a new instance of DataBoxEdgeJobErrorDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeJobErrorDetails() { ErrorDetails = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeJobErrorDetails. + /// Initializes a new instance of . /// The error details. /// The code intended for programmatic access. /// The message that describes the error in detail. - internal DataBoxEdgeJobErrorDetails(IReadOnlyList errorDetails, string code, string message) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeJobErrorDetails(IReadOnlyList errorDetails, string code, string message, Dictionary serializedAdditionalRawData) { ErrorDetails = errorDetails; Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The error details. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.Serialization.cs index 245dc10e2e7b..416c1d5cbccc 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeJobErrorItem + public partial class DataBoxEdgeJobErrorItem : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeJobErrorItem DeserializeDataBoxEdgeJobErrorItem(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeJobErrorItem DeserializeDataBoxEdgeJobErrorItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static DataBoxEdgeJobErrorItem DeserializeDataBoxEdgeJobErrorItem(JsonE Optional> recommendations = default; Optional code = default; Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("recommendations"u8)) @@ -48,8 +76,61 @@ internal static DataBoxEdgeJobErrorItem DeserializeDataBoxEdgeJobErrorItem(JsonE message = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeJobErrorItem(Optional.ToList(recommendations), code.Value, message.Value); + return new DataBoxEdgeJobErrorItem(Optional.ToList(recommendations), code.Value, message.Value, serializedAdditionalRawData); + } + + DataBoxEdgeJobErrorItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeJobErrorItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeJobErrorItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeJobErrorItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeJobErrorItem model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeJobErrorItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeJobErrorItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.cs index 3d9e2bf5249b..728361cd5c12 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeJobErrorItem.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The job error items. public partial class DataBoxEdgeJobErrorItem { - /// Initializes a new instance of DataBoxEdgeJobErrorItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeJobErrorItem() { Recommendations = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeJobErrorItem. + /// Initializes a new instance of . /// The recommended actions. /// The code intended for programmatic access. /// The message that describes the error in detail. - internal DataBoxEdgeJobErrorItem(IReadOnlyList recommendations, string code, string message) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeJobErrorItem(IReadOnlyList recommendations, string code, string message, Dictionary serializedAdditionalRawData) { Recommendations = recommendations; Code = code; Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The recommended actions. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.Serialization.cs index 830f1a09a42d..0768c52465d8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeLoadBalancerConfig + public partial class DataBoxEdgeLoadBalancerConfig : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeLoadBalancerConfig DeserializeDataBoxEdgeLoadBalancerConfig(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeLoadBalancerConfig DeserializeDataBoxEdgeLoadBalancerConfig(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -32,8 +61,61 @@ internal static DataBoxEdgeLoadBalancerConfig DeserializeDataBoxEdgeLoadBalancer version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeLoadBalancerConfig(type.Value, version.Value); + return new DataBoxEdgeLoadBalancerConfig(type.Value, version.Value, serializedAdditionalRawData); + } + + DataBoxEdgeLoadBalancerConfig IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeLoadBalancerConfig(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeLoadBalancerConfig IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeLoadBalancerConfig(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeLoadBalancerConfig model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeLoadBalancerConfig(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeLoadBalancerConfig(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.cs index f1cc19e37d33..5e684d7c094c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeLoadBalancerConfig.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Load balancer configuration. public partial class DataBoxEdgeLoadBalancerConfig { - /// Initializes a new instance of DataBoxEdgeLoadBalancerConfig. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeLoadBalancerConfig() { } - /// Initializes a new instance of DataBoxEdgeLoadBalancerConfig. + /// Initializes a new instance of . /// Load balancer type. /// Load balancer version. - internal DataBoxEdgeLoadBalancerConfig(string loadBalancerConfigType, string version) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeLoadBalancerConfig(string loadBalancerConfigType, string version, Dictionary serializedAdditionalRawData) { LoadBalancerConfigType = loadBalancerConfigType; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Load balancer type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.Serialization.cs index 8eaba8d36e5e..5b415dc66e3a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeMetricConfiguration : IUtf8JsonSerializable + public partial class DataBoxEdgeMetricConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); @@ -32,14 +39,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CounterSets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeMetricConfiguration DeserializeDataBoxEdgeMetricConfiguration(JsonElement element) + internal static DataBoxEdgeMetricConfiguration DeserializeDataBoxEdgeMetricConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +76,7 @@ internal static DataBoxEdgeMetricConfiguration DeserializeDataBoxEdgeMetricConfi Optional mdmAccount = default; Optional metricNameSpace = default; IList counterSets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -75,8 +104,61 @@ internal static DataBoxEdgeMetricConfiguration DeserializeDataBoxEdgeMetricConfi counterSets = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeMetricConfiguration(resourceId, mdmAccount.Value, metricNameSpace.Value, counterSets, serializedAdditionalRawData); + } + + DataBoxEdgeMetricConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeMetricConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeMetricConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeMetricConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeMetricConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeMetricConfiguration(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeMetricConfiguration(resourceId, mdmAccount.Value, metricNameSpace.Value, counterSets); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeMetricConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.cs index 9fb5bc7de8c1..59fc7ddca809 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricConfiguration.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Metric configuration. public partial class DataBoxEdgeMetricConfiguration { - /// Initializes a new instance of DataBoxEdgeMetricConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The Resource ID on which the metrics should be pushed. /// Host name for the IoT hub associated to the device. /// or is null. @@ -28,17 +31,24 @@ public DataBoxEdgeMetricConfiguration(ResourceIdentifier resourceId, IEnumerable CounterSets = counterSets.ToList(); } - /// Initializes a new instance of DataBoxEdgeMetricConfiguration. + /// Initializes a new instance of . /// The Resource ID on which the metrics should be pushed. /// The MDM account to which the counters should be pushed. /// The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified. /// Host name for the IoT hub associated to the device. - internal DataBoxEdgeMetricConfiguration(ResourceIdentifier resourceId, string mdmAccount, string metricNameSpace, IList counterSets) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeMetricConfiguration(ResourceIdentifier resourceId, string mdmAccount, string metricNameSpace, IList counterSets, Dictionary serializedAdditionalRawData) { ResourceId = resourceId; MdmAccount = mdmAccount; MetricNameSpace = metricNameSpace; CounterSets = counterSets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeMetricConfiguration() + { } /// The Resource ID on which the metrics should be pushed. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.Serialization.cs index dadfa57f7611..468fbddf4b9f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeMetricCounter : IUtf8JsonSerializable + public partial class DataBoxEdgeMetricCounter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DimensionFilter) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,15 +53,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AdditionalDimensions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeMetricCounter DeserializeDataBoxEdgeMetricCounter(JsonElement element) + internal static DataBoxEdgeMetricCounter DeserializeDataBoxEdgeMetricCounter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +91,7 @@ internal static DataBoxEdgeMetricCounter DeserializeDataBoxEdgeMetricCounter(Jso Optional instance = default; Optional> dimensionFilter = default; Optional> additionalDimensions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -96,8 +132,61 @@ internal static DataBoxEdgeMetricCounter DeserializeDataBoxEdgeMetricCounter(Jso additionalDimensions = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeMetricCounter(name, instance.Value, Optional.ToList(dimensionFilter), Optional.ToList(additionalDimensions), serializedAdditionalRawData); + } + + DataBoxEdgeMetricCounter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeMetricCounter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeMetricCounter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeMetricCounter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeMetricCounter model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeMetricCounter(name, instance.Value, Optional.ToList(dimensionFilter), Optional.ToList(additionalDimensions)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeMetricCounter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeMetricCounter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.cs index 6244dbdfbf5a..293f79444ab0 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounter.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The metric counter. public partial class DataBoxEdgeMetricCounter { - /// Initializes a new instance of DataBoxEdgeMetricCounter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The counter name. /// is null. public DataBoxEdgeMetricCounter(string name) @@ -26,17 +29,24 @@ public DataBoxEdgeMetricCounter(string name) AdditionalDimensions = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeMetricCounter. + /// Initializes a new instance of . /// The counter name. /// The instance from which counter should be collected. /// The dimension filter. /// The additional dimensions to be added to metric. - internal DataBoxEdgeMetricCounter(string name, string instance, IList dimensionFilter, IList additionalDimensions) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeMetricCounter(string name, string instance, IList dimensionFilter, IList additionalDimensions, Dictionary serializedAdditionalRawData) { Name = name; Instance = instance; DimensionFilter = dimensionFilter; AdditionalDimensions = additionalDimensions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeMetricCounter() + { } /// The counter name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.Serialization.cs index ee88850f7d27..6d64c921e229 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.Serialization.cs @@ -5,34 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeMetricCounterSet : IUtf8JsonSerializable + public partial class DataBoxEdgeMetricCounterSet : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("counters"u8); writer.WriteStartArray(); foreach (var item in Counters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeMetricCounterSet DeserializeDataBoxEdgeMetricCounterSet(JsonElement element) + internal static DataBoxEdgeMetricCounterSet DeserializeDataBoxEdgeMetricCounterSet(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IList counters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("counters"u8)) @@ -45,8 +74,61 @@ internal static DataBoxEdgeMetricCounterSet DeserializeDataBoxEdgeMetricCounterS counters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeMetricCounterSet(counters, serializedAdditionalRawData); + } + + DataBoxEdgeMetricCounterSet IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeMetricCounterSet(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeMetricCounterSet IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeMetricCounterSet(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeMetricCounterSet model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeMetricCounterSet(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeMetricCounterSet(counters); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeMetricCounterSet(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.cs index 772ec0653ab3..7c003c436985 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricCounterSet.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The metric counter set. public partial class DataBoxEdgeMetricCounterSet { - /// Initializes a new instance of DataBoxEdgeMetricCounterSet. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The counters that should be collected in this set. /// is null. public DataBoxEdgeMetricCounterSet(IEnumerable counters) @@ -25,11 +28,18 @@ public DataBoxEdgeMetricCounterSet(IEnumerable counter Counters = counters.ToList(); } - /// Initializes a new instance of DataBoxEdgeMetricCounterSet. + /// Initializes a new instance of . /// The counters that should be collected in this set. - internal DataBoxEdgeMetricCounterSet(IList counters) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeMetricCounterSet(IList counters, Dictionary serializedAdditionalRawData) { Counters = counters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeMetricCounterSet() + { } /// The counters that should be collected in this set. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.Serialization.cs index 96719b2642b0..c911d4c1d4b2 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeMetricDimension : IUtf8JsonSerializable + public partial class DataBoxEdgeMetricDimension : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("sourceType"u8); writer.WriteStringValue(SourceType); writer.WritePropertyName("sourceName"u8); writer.WriteStringValue(SourceName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeMetricDimension DeserializeDataBoxEdgeMetricDimension(JsonElement element) + internal static DataBoxEdgeMetricDimension DeserializeDataBoxEdgeMetricDimension(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string sourceType = default; string sourceName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceType"u8)) @@ -42,8 +65,61 @@ internal static DataBoxEdgeMetricDimension DeserializeDataBoxEdgeMetricDimension sourceName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeMetricDimension(sourceType, sourceName, serializedAdditionalRawData); + } + + DataBoxEdgeMetricDimension IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeMetricDimension(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeMetricDimension IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeMetricDimension(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeMetricDimension model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeMetricDimension(sourceType, sourceName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeMetricDimension(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeMetricDimension(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.cs index e7085abc3dfe..9c60f3b1748a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMetricDimension.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The metric dimension. public partial class DataBoxEdgeMetricDimension { - /// Initializes a new instance of DataBoxEdgeMetricDimension. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The dimension type. /// The dimension value. /// or is null. @@ -26,6 +30,22 @@ public DataBoxEdgeMetricDimension(string sourceType, string sourceName) SourceName = sourceName; } + /// Initializes a new instance of . + /// The dimension type. + /// The dimension value. + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeMetricDimension(string sourceType, string sourceName, Dictionary serializedAdditionalRawData) + { + SourceType = sourceType; + SourceName = sourceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeMetricDimension() + { + } + /// The dimension type. public string SourceType { get; set; } /// The dimension value. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.Serialization.cs index c427fdb9f0dc..f63c9719b018 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeMountPointMap : IUtf8JsonSerializable + public partial class DataBoxEdgeMountPointMap : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("shareId"u8); writer.WriteStringValue(ShareId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeMountPointMap DeserializeDataBoxEdgeMountPointMap(JsonElement element) + internal static DataBoxEdgeMountPointMap DeserializeDataBoxEdgeMountPointMap(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -31,6 +53,7 @@ internal static DataBoxEdgeMountPointMap DeserializeDataBoxEdgeMountPointMap(Jso Optional mountPoint = default; Optional mountType = default; Optional roleType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shareId"u8)) @@ -70,8 +93,61 @@ internal static DataBoxEdgeMountPointMap DeserializeDataBoxEdgeMountPointMap(Jso roleType = new DataBoxEdgeRoleType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeMountPointMap(shareId, roleId.Value, mountPoint.Value, Optional.ToNullable(mountType), Optional.ToNullable(roleType), serializedAdditionalRawData); + } + + DataBoxEdgeMountPointMap IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeMountPointMap(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeMountPointMap IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeMountPointMap(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeMountPointMap model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeMountPointMap(shareId, roleId.Value, mountPoint.Value, Optional.ToNullable(mountType), Optional.ToNullable(roleType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeMountPointMap(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeMountPointMap(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.cs index d5038b110084..f3be5e820330 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeMountPointMap.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The share mount point. public partial class DataBoxEdgeMountPointMap { - /// Initializes a new instance of DataBoxEdgeMountPointMap. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// ID of the share mounted to the role VM. /// is null. public DataBoxEdgeMountPointMap(ResourceIdentifier shareId) @@ -23,19 +27,26 @@ public DataBoxEdgeMountPointMap(ResourceIdentifier shareId) ShareId = shareId; } - /// Initializes a new instance of DataBoxEdgeMountPointMap. + /// Initializes a new instance of . /// ID of the share mounted to the role VM. /// ID of the role to which share is mounted. /// Mount point for the share. /// Mounting type. /// Role type. - internal DataBoxEdgeMountPointMap(ResourceIdentifier shareId, ResourceIdentifier roleId, string mountPoint, DataBoxEdgeMountType? mountType, DataBoxEdgeRoleType? roleType) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeMountPointMap(ResourceIdentifier shareId, ResourceIdentifier roleId, string mountPoint, DataBoxEdgeMountType? mountType, DataBoxEdgeRoleType? roleType, Dictionary serializedAdditionalRawData) { ShareId = shareId; RoleId = roleId; MountPoint = mountPoint; MountType = mountType; RoleType = roleType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeMountPointMap() + { } /// ID of the share mounted to the role VM. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.Serialization.cs index f1f76cbf4b68..9c91db0d46aa 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.Serialization.cs @@ -8,14 +8,50 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeNetworkAdapter + public partial class DataBoxEdgeNetworkAdapter : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeNetworkAdapter DeserializeDataBoxEdgeNetworkAdapter(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RdmaStatus)) + { + writer.WritePropertyName("rdmaStatus"u8); + writer.WriteStringValue(RdmaStatus.Value.ToString()); + } + if (Optional.IsDefined(DhcpStatus)) + { + writer.WritePropertyName("dhcpStatus"u8); + writer.WriteStringValue(DhcpStatus.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeNetworkAdapter DeserializeDataBoxEdgeNetworkAdapter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +71,7 @@ internal static DataBoxEdgeNetworkAdapter DeserializeDataBoxEdgeNetworkAdapter(J Optional ipv6Configuration = default; Optional ipv6LinkLocalAddress = default; Optional> dnsServers = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("adapterId"u8)) @@ -157,8 +194,61 @@ internal static DataBoxEdgeNetworkAdapter DeserializeDataBoxEdgeNetworkAdapter(J dnsServers = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeNetworkAdapter(adapterId.Value, adapterPosition.Value, Optional.ToNullable(index), Optional.ToNullable(nodeId), networkAdapterName.Value, label.Value, macAddress.Value, Optional.ToNullable(linkSpeed), Optional.ToNullable(status), Optional.ToNullable(rdmaStatus), Optional.ToNullable(dhcpStatus), ipv4Configuration.Value, ipv6Configuration.Value, ipv6LinkLocalAddress.Value, Optional.ToList(dnsServers)); + return new DataBoxEdgeNetworkAdapter(adapterId.Value, adapterPosition.Value, Optional.ToNullable(index), Optional.ToNullable(nodeId), networkAdapterName.Value, label.Value, macAddress.Value, Optional.ToNullable(linkSpeed), Optional.ToNullable(status), Optional.ToNullable(rdmaStatus), Optional.ToNullable(dhcpStatus), ipv4Configuration.Value, ipv6Configuration.Value, ipv6LinkLocalAddress.Value, Optional.ToList(dnsServers), serializedAdditionalRawData); + } + + DataBoxEdgeNetworkAdapter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeNetworkAdapter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeNetworkAdapter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeNetworkAdapter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeNetworkAdapter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeNetworkAdapter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeNetworkAdapter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.cs index 422e5c2ae0fa..2992973b5544 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapter.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Represents the networkAdapter on a device. public partial class DataBoxEdgeNetworkAdapter { - /// Initializes a new instance of DataBoxEdgeNetworkAdapter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeNetworkAdapter() { DnsServers = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeNetworkAdapter. + /// Initializes a new instance of . /// Instance ID of network adapter. /// Hardware position of network adapter. /// Logical index of the adapter. @@ -36,7 +39,8 @@ internal DataBoxEdgeNetworkAdapter() /// The IPv6 configuration of the network adapter. /// The IPv6 local address. /// The list of DNS Servers of the device. - internal DataBoxEdgeNetworkAdapter(string adapterId, DataBoxEdgeNetworkAdapterPosition adapterPosition, int? index, Guid? nodeId, string networkAdapterName, string label, string macAddress, long? linkSpeed, DataBoxEdgeNetworkAdapterStatus? status, DataBoxEdgeNetworkAdapterRdmaStatus? rdmaStatus, DataBoxEdgeNetworkAdapterDhcpStatus? dhcpStatus, DataBoxEdgeIPv4Config ipv4Configuration, DataBoxEdgeIPv6Config ipv6Configuration, string ipv6LinkLocalAddress, IReadOnlyList dnsServers) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeNetworkAdapter(string adapterId, DataBoxEdgeNetworkAdapterPosition adapterPosition, int? index, Guid? nodeId, string networkAdapterName, string label, string macAddress, long? linkSpeed, DataBoxEdgeNetworkAdapterStatus? status, DataBoxEdgeNetworkAdapterRdmaStatus? rdmaStatus, DataBoxEdgeNetworkAdapterDhcpStatus? dhcpStatus, DataBoxEdgeIPv4Config ipv4Configuration, DataBoxEdgeIPv6Config ipv6Configuration, string ipv6LinkLocalAddress, IReadOnlyList dnsServers, Dictionary serializedAdditionalRawData) { AdapterId = adapterId; AdapterPosition = adapterPosition; @@ -53,6 +57,7 @@ internal DataBoxEdgeNetworkAdapter(string adapterId, DataBoxEdgeNetworkAdapterPo IPv6Configuration = ipv6Configuration; IPv6LinkLocalAddress = ipv6LinkLocalAddress; DnsServers = dnsServers; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Instance ID of network adapter. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.Serialization.cs index c126f3e811fa..dc66cda396bc 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeNetworkAdapterPosition + public partial class DataBoxEdgeNetworkAdapterPosition : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeNetworkAdapterPosition DeserializeDataBoxEdgeNetworkAdapterPosition(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeNetworkAdapterPosition DeserializeDataBoxEdgeNetworkAdapterPosition(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional networkGroup = default; Optional port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkGroup"u8)) @@ -40,8 +69,61 @@ internal static DataBoxEdgeNetworkAdapterPosition DeserializeDataBoxEdgeNetworkA port = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeNetworkAdapterPosition(Optional.ToNullable(networkGroup), Optional.ToNullable(port)); + return new DataBoxEdgeNetworkAdapterPosition(Optional.ToNullable(networkGroup), Optional.ToNullable(port), serializedAdditionalRawData); + } + + DataBoxEdgeNetworkAdapterPosition IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeNetworkAdapterPosition(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeNetworkAdapterPosition IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeNetworkAdapterPosition(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeNetworkAdapterPosition model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeNetworkAdapterPosition(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeNetworkAdapterPosition(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.cs index b3caa70fe267..674220ce30e4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNetworkAdapterPosition.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// The network adapter position. public partial class DataBoxEdgeNetworkAdapterPosition { - /// Initializes a new instance of DataBoxEdgeNetworkAdapterPosition. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeNetworkAdapterPosition() { } - /// Initializes a new instance of DataBoxEdgeNetworkAdapterPosition. + /// Initializes a new instance of . /// The network group. /// The port. - internal DataBoxEdgeNetworkAdapterPosition(DataBoxEdgeNetworkGroup? networkGroup, int? port) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeNetworkAdapterPosition(DataBoxEdgeNetworkGroup? networkGroup, int? port, Dictionary serializedAdditionalRawData) { NetworkGroup = networkGroup; Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The network group. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.Serialization.cs index b55522e6fcf8..5797fe85af21 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.Serialization.cs @@ -6,25 +6,46 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeNode : IUtf8JsonSerializable + public partial class DataBoxEdgeNode : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeNode DeserializeDataBoxEdgeNode(JsonElement element) + internal static DataBoxEdgeNode DeserializeDataBoxEdgeNode(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static DataBoxEdgeNode DeserializeDataBoxEdgeNode(JsonElement element) Optional nodeFriendlySoftwareVersion = default; Optional nodeHcsVersion = default; Optional nodeInstanceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -121,8 +143,61 @@ internal static DataBoxEdgeNode DeserializeDataBoxEdgeNode(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeNode(id, name, type, systemData.Value, Optional.ToNullable(nodeStatus), nodeChassisSerialNumber.Value, nodeSerialNumber.Value, nodeDisplayName.Value, nodeFriendlySoftwareVersion.Value, nodeHcsVersion.Value, Optional.ToNullable(nodeInstanceId), serializedAdditionalRawData); + } + + DataBoxEdgeNode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeNode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeNode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeNode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeNode model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeNode(id, name, type, systemData.Value, Optional.ToNullable(nodeStatus), nodeChassisSerialNumber.Value, nodeSerialNumber.Value, nodeDisplayName.Value, nodeFriendlySoftwareVersion.Value, nodeHcsVersion.Value, Optional.ToNullable(nodeInstanceId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeNode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeNode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.cs index 585385065055..a7db2c0c3c7a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNode.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -18,12 +19,15 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// public partial class DataBoxEdgeNode : ResourceData { - /// Initializes a new instance of DataBoxEdgeNode. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeNode() { } - /// Initializes a new instance of DataBoxEdgeNode. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -35,7 +39,8 @@ public DataBoxEdgeNode() /// Friendly software version name that is currently installed on the node. /// HCS version that is currently installed on the node. /// Guid instance id of the node. - internal DataBoxEdgeNode(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeNodeStatus? nodeStatus, string nodeChassisSerialNumber, string nodeSerialNumber, string nodeDisplayName, string nodeFriendlySoftwareVersion, string nodeHcsVersion, Guid? nodeInstanceId) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeNode(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeNodeStatus? nodeStatus, string nodeChassisSerialNumber, string nodeSerialNumber, string nodeDisplayName, string nodeFriendlySoftwareVersion, string nodeHcsVersion, Guid? nodeInstanceId, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { NodeStatus = nodeStatus; NodeChassisSerialNumber = nodeChassisSerialNumber; @@ -44,6 +49,7 @@ internal DataBoxEdgeNode(ResourceIdentifier id, string name, ResourceType resour NodeFriendlySoftwareVersion = nodeFriendlySoftwareVersion; NodeHcsVersion = nodeHcsVersion; NodeInstanceId = nodeInstanceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The current status of the individual node. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.Serialization.cs index 0e6ce5b9d884..27658a196c0c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.Serialization.cs @@ -5,22 +5,50 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class DataBoxEdgeNodeList + internal partial class DataBoxEdgeNodeList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeNodeList DeserializeDataBoxEdgeNodeList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeNodeList DeserializeDataBoxEdgeNodeList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +70,61 @@ internal static DataBoxEdgeNodeList DeserializeDataBoxEdgeNodeList(JsonElement e nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeNodeList(Optional.ToList(value), nextLink.Value); + return new DataBoxEdgeNodeList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DataBoxEdgeNodeList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeNodeList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeNodeList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeNodeList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeNodeList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeNodeList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeNodeList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.cs index a5f8d4e9745d..5f3e5c687c95 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeNodeList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of Nodes. internal partial class DataBoxEdgeNodeList { - /// Initializes a new instance of DataBoxEdgeNodeList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeNodeList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeNodeList. + /// Initializes a new instance of . /// The list of Nodes. /// Link to the next set of results. - internal DataBoxEdgeNodeList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeNodeList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of Nodes. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderData.Serialization.cs index 83fad0d3fa81..a098e6d5cfac 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderData.Serialization.cs @@ -5,30 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeOrderData : IUtf8JsonSerializable + public partial class DataBoxEdgeOrderData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ContactInformation)) { writer.WritePropertyName("contactInformation"u8); - writer.WriteObjectValue(ContactInformation); + if (ContactInformation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ContactInformation).Serialize(writer, options); + } } if (Optional.IsDefined(ShippingAddress)) { writer.WritePropertyName("shippingAddress"u8); - writer.WriteObjectValue(ShippingAddress); + if (ShippingAddress is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ShippingAddress).Serialize(writer, options); + } } if (Optional.IsDefined(ShipmentType)) { @@ -36,11 +57,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ShipmentType.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeOrderData DeserializeDataBoxEdgeOrderData(JsonElement element) + internal static DataBoxEdgeOrderData DeserializeDataBoxEdgeOrderData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +94,7 @@ internal static DataBoxEdgeOrderData DeserializeDataBoxEdgeOrderData(JsonElement Optional> deliveryTrackingInfo = default; Optional> returnTrackingInfo = default; Optional shipmentType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -190,8 +226,61 @@ internal static DataBoxEdgeOrderData DeserializeDataBoxEdgeOrderData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeOrderData(id, name, type, systemData.Value, kind.Value, orderId.Value, contactInformation.Value, shippingAddress.Value, currentStatus.Value, Optional.ToList(orderHistory), serialNumber.Value, Optional.ToList(deliveryTrackingInfo), Optional.ToList(returnTrackingInfo), Optional.ToNullable(shipmentType), serializedAdditionalRawData); + } + + DataBoxEdgeOrderData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeOrderData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeOrderData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeOrderData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeOrderData model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeOrderData(id, name, type, systemData.Value, kind.Value, orderId.Value, contactInformation.Value, shippingAddress.Value, currentStatus.Value, Optional.ToList(orderHistory), serialNumber.Value, Optional.ToList(deliveryTrackingInfo), Optional.ToList(returnTrackingInfo), Optional.ToNullable(shipmentType)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeOrderData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeOrderData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.Serialization.cs index 103b5dbf316b..6d5a9eeb91fb 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.Serialization.cs @@ -8,14 +8,47 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeOrderStatus + public partial class DataBoxEdgeOrderStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeOrderStatus DeserializeDataBoxEdgeOrderStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Comments)) + { + writer.WritePropertyName("comments"u8); + writer.WriteStringValue(Comments); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeOrderStatus DeserializeDataBoxEdgeOrderStatus(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,6 +58,7 @@ internal static DataBoxEdgeOrderStatus DeserializeDataBoxEdgeOrderStatus(JsonEle Optional comments = default; Optional trackingInformation = default; Optional> additionalOrderDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -69,8 +103,61 @@ internal static DataBoxEdgeOrderStatus DeserializeDataBoxEdgeOrderStatus(JsonEle additionalOrderDetails = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeOrderStatus(status, Optional.ToNullable(updateDateTime), comments.Value, trackingInformation.Value, Optional.ToDictionary(additionalOrderDetails)); + return new DataBoxEdgeOrderStatus(status, Optional.ToNullable(updateDateTime), comments.Value, trackingInformation.Value, Optional.ToDictionary(additionalOrderDetails), serializedAdditionalRawData); + } + + DataBoxEdgeOrderStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeOrderStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeOrderStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeOrderStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeOrderStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeOrderStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeOrderStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.cs index 27f39bd4a1e2..58ac3f7d20f6 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeOrderStatus.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Represents a single status change. public partial class DataBoxEdgeOrderStatus { - /// Initializes a new instance of DataBoxEdgeOrderStatus. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Status of the order as per the allowed status types. internal DataBoxEdgeOrderStatus(DataBoxEdgeOrderState status) { @@ -22,7 +25,7 @@ internal DataBoxEdgeOrderStatus(DataBoxEdgeOrderState status) AdditionalOrderDetails = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataBoxEdgeOrderStatus. + /// Initializes a new instance of . /// Status of the order as per the allowed status types. /// Time of status update. /// Comments related to this status change. @@ -31,13 +34,20 @@ internal DataBoxEdgeOrderStatus(DataBoxEdgeOrderState status) /// Dictionary to hold generic information which is not stored /// by the already existing properties /// - internal DataBoxEdgeOrderStatus(DataBoxEdgeOrderState status, DateTimeOffset? updateOn, string comments, DataBoxEdgeTrackingInfo trackingInformation, IReadOnlyDictionary additionalOrderDetails) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeOrderStatus(DataBoxEdgeOrderState status, DateTimeOffset? updateOn, string comments, DataBoxEdgeTrackingInfo trackingInformation, IReadOnlyDictionary additionalOrderDetails, Dictionary serializedAdditionalRawData) { Status = status; UpdateOn = updateOn; Comments = comments; TrackingInformation = trackingInformation; AdditionalOrderDetails = additionalOrderDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeOrderStatus() + { } /// Status of the order as per the allowed status types. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.Serialization.cs index 2b30ec2f2e61..2acf82041f69 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeRefreshDetails : IUtf8JsonSerializable + public partial class DataBoxEdgeRefreshDetails : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(InProgressRefreshJobId)) { @@ -36,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("lastJob"u8); writer.WriteStringValue(LastJob); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeRefreshDetails DeserializeDataBoxEdgeRefreshDetails(JsonElement element) + internal static DataBoxEdgeRefreshDetails DeserializeDataBoxEdgeRefreshDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +70,7 @@ internal static DataBoxEdgeRefreshDetails DeserializeDataBoxEdgeRefreshDetails(J Optional lastCompletedRefreshJobTimeInUtc = default; Optional errorManifestFile = default; Optional lastJob = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("inProgressRefreshJobId"u8)) @@ -79,8 +101,61 @@ internal static DataBoxEdgeRefreshDetails DeserializeDataBoxEdgeRefreshDetails(J lastJob = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeRefreshDetails(inProgressRefreshJobId.Value, Optional.ToNullable(lastCompletedRefreshJobTimeInUtc), errorManifestFile.Value, lastJob.Value, serializedAdditionalRawData); + } + + DataBoxEdgeRefreshDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeRefreshDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeRefreshDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeRefreshDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeRefreshDetails model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeRefreshDetails(inProgressRefreshJobId.Value, Optional.ToNullable(lastCompletedRefreshJobTimeInUtc), errorManifestFile.Value, lastJob.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeRefreshDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeRefreshDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.cs index 538c7dc0c55b..6ace5d2f22a7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRefreshDetails.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Fields for tracking refresh job on the share or container. public partial class DataBoxEdgeRefreshDetails { - /// Initializes a new instance of DataBoxEdgeRefreshDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeRefreshDetails() { } - /// Initializes a new instance of DataBoxEdgeRefreshDetails. + /// Initializes a new instance of . /// If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. /// Indicates the completed time for the last refresh job on this particular share or container, if any.This could be a failed job or a successful job. /// Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. /// Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. - internal DataBoxEdgeRefreshDetails(ResourceIdentifier inProgressRefreshJobId, DateTimeOffset? lastCompletedRefreshJobTimeInUtc, string errorManifestFile, string lastJob) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeRefreshDetails(ResourceIdentifier inProgressRefreshJobId, DateTimeOffset? lastCompletedRefreshJobTimeInUtc, string errorManifestFile, string lastJob, Dictionary serializedAdditionalRawData) { InProgressRefreshJobId = inProgressRefreshJobId; LastCompletedRefreshJobTimeInUtc = lastCompletedRefreshJobTimeInUtc; ErrorManifestFile = errorManifestFile; LastJob = lastJob; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.Serialization.cs index 3b5bdc8c7d82..f18cb9492556 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeResourceMoveDetails + public partial class DataBoxEdgeResourceMoveDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeResourceMoveDetails DeserializeDataBoxEdgeResourceMoveDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(OperationInProgress)) + { + writer.WritePropertyName("operationInProgress"u8); + writer.WriteStringValue(OperationInProgress.Value.ToString()); + } + if (Optional.IsDefined(OperationInProgressLockTimeoutInUtc)) + { + writer.WritePropertyName("operationInProgressLockTimeoutInUTC"u8); + writer.WriteStringValue(OperationInProgressLockTimeoutInUtc.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeResourceMoveDetails DeserializeDataBoxEdgeResourceMoveDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional operationInProgress = default; Optional operationInProgressLockTimeoutInUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationInProgress"u8)) @@ -41,8 +79,61 @@ internal static DataBoxEdgeResourceMoveDetails DeserializeDataBoxEdgeResourceMov operationInProgressLockTimeoutInUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeResourceMoveDetails(Optional.ToNullable(operationInProgress), Optional.ToNullable(operationInProgressLockTimeoutInUtc)); + return new DataBoxEdgeResourceMoveDetails(Optional.ToNullable(operationInProgress), Optional.ToNullable(operationInProgressLockTimeoutInUtc), serializedAdditionalRawData); + } + + DataBoxEdgeResourceMoveDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeResourceMoveDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeResourceMoveDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeResourceMoveDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeResourceMoveDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeResourceMoveDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeResourceMoveDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.cs index b6177385e964..d38987ee66ff 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeResourceMoveDetails.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBoxEdge.Models { /// Fields for tracking resource move. public partial class DataBoxEdgeResourceMoveDetails { - /// Initializes a new instance of DataBoxEdgeResourceMoveDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeResourceMoveDetails() { } - /// Initializes a new instance of DataBoxEdgeResourceMoveDetails. + /// Initializes a new instance of . /// Denotes whether move operation is in progress. /// Denotes the timeout of the operation to finish. - internal DataBoxEdgeResourceMoveDetails(DataBoxEdgeResourceMoveStatus? operationInProgress, DateTimeOffset? operationInProgressLockTimeoutInUtc) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeResourceMoveDetails(DataBoxEdgeResourceMoveStatus? operationInProgress, DateTimeOffset? operationInProgressLockTimeoutInUtc, Dictionary serializedAdditionalRawData) { OperationInProgress = operationInProgress; OperationInProgressLockTimeoutInUtc = operationInProgressLockTimeoutInUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Denotes whether move operation is in progress. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleAddonData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleAddonData.Serialization.cs index 3ee48c55fabc..fbbc818d2892 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleAddonData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleAddonData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeRoleAddonData : IUtf8JsonSerializable + public partial class DataBoxEdgeRoleAddonData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeRoleAddonData DeserializeDataBoxEdgeRoleAddonData(JsonElement element) + internal static DataBoxEdgeRoleAddonData DeserializeDataBoxEdgeRoleAddonData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,11 +58,14 @@ internal static DataBoxEdgeRoleAddonData DeserializeDataBoxEdgeRoleAddonData(Jso case "IotEdge": return EdgeIotAddon.DeserializeEdgeIotAddon(element); } } + + // Unknown type found so we will deserialize the base properties only AddonType kind = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -72,8 +97,61 @@ internal static DataBoxEdgeRoleAddonData DeserializeDataBoxEdgeRoleAddonData(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeRoleAddonData(id, name, type, systemData.Value, kind); + return new DataBoxEdgeRoleAddonData(id, name, type, systemData.Value, kind, serializedAdditionalRawData); + } + + DataBoxEdgeRoleAddonData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeRoleAddonData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeRoleAddonData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeRoleAddonData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeRoleAddonData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeRoleAddonData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeRoleAddonData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleData.Serialization.cs index c36045bb76d7..05e0efbea7a1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeRoleData : IUtf8JsonSerializable + public partial class DataBoxEdgeRoleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeRoleData DeserializeDataBoxEdgeRoleData(JsonElement element) + internal static DataBoxEdgeRoleData DeserializeDataBoxEdgeRoleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,11 +60,14 @@ internal static DataBoxEdgeRoleData DeserializeDataBoxEdgeRoleData(JsonElement e case "MEC": return MecRole.DeserializeMecRole(element); } } + + // Unknown type found so we will deserialize the base properties only DataBoxEdgeRoleType kind = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -74,8 +99,61 @@ internal static DataBoxEdgeRoleData DeserializeDataBoxEdgeRoleData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeRoleData(id, name, type, systemData.Value, kind); + return new DataBoxEdgeRoleData(id, name, type, systemData.Value, kind, serializedAdditionalRawData); + } + + DataBoxEdgeRoleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeRoleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeRoleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeRoleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeRoleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeRoleData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeRoleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.Serialization.cs index 700ff14cfaad..9cce2bef5418 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeRoleSinkInfo : IUtf8JsonSerializable + public partial class DataBoxEdgeRoleSinkInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("roleId"u8); writer.WriteStringValue(RoleId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeRoleSinkInfo DeserializeDataBoxEdgeRoleSinkInfo(JsonElement element) + internal static DataBoxEdgeRoleSinkInfo DeserializeDataBoxEdgeRoleSinkInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier roleId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("roleId"u8)) @@ -34,8 +57,61 @@ internal static DataBoxEdgeRoleSinkInfo DeserializeDataBoxEdgeRoleSinkInfo(JsonE roleId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeRoleSinkInfo(roleId, serializedAdditionalRawData); + } + + DataBoxEdgeRoleSinkInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeRoleSinkInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeRoleSinkInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeRoleSinkInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeRoleSinkInfo model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeRoleSinkInfo(roleId); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeRoleSinkInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeRoleSinkInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.cs index 60c59c8ae4f2..7cc331953144 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeRoleSinkInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Compute role against which events will be raised. public partial class DataBoxEdgeRoleSinkInfo { - /// Initializes a new instance of DataBoxEdgeRoleSinkInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Compute role ID. /// is null. public DataBoxEdgeRoleSinkInfo(ResourceIdentifier roleId) @@ -23,6 +27,20 @@ public DataBoxEdgeRoleSinkInfo(ResourceIdentifier roleId) RoleId = roleId; } + /// Initializes a new instance of . + /// Compute role ID. + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeRoleSinkInfo(ResourceIdentifier roleId, Dictionary serializedAdditionalRawData) + { + RoleId = roleId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeRoleSinkInfo() + { + } + /// Compute role ID. public ResourceIdentifier RoleId { get; set; } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.Serialization.cs index ab4031e4c2b3..d179e98708c8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeSecuritySettings : IUtf8JsonSerializable + public partial class DataBoxEdgeSecuritySettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("deviceAdminPassword"u8); - writer.WriteObjectValue(DeviceAdminPassword); + if (DeviceAdminPassword is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DeviceAdminPassword).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeSecuritySettings DeserializeDataBoxEdgeSecuritySettings(JsonElement element) + internal static DataBoxEdgeSecuritySettings DeserializeDataBoxEdgeSecuritySettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static DataBoxEdgeSecuritySettings DeserializeDataBoxEdgeSecuritySettin ResourceType type = default; Optional systemData = default; AsymmetricEncryptedSecret deviceAdminPassword = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -78,8 +108,61 @@ internal static DataBoxEdgeSecuritySettings DeserializeDataBoxEdgeSecuritySettin } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeSecuritySettings(id, name, type, systemData.Value, deviceAdminPassword, serializedAdditionalRawData); + } + + DataBoxEdgeSecuritySettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeSecuritySettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeSecuritySettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeSecuritySettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeSecuritySettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeSecuritySettings(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeSecuritySettings(id, name, type, systemData.Value, deviceAdminPassword); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeSecuritySettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.cs index e49c877c12fa..77ac1039bd3a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSecuritySettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The security settings of a device. public partial class DataBoxEdgeSecuritySettings : ResourceData { - /// Initializes a new instance of DataBoxEdgeSecuritySettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. /// is null. public DataBoxEdgeSecuritySettings(AsymmetricEncryptedSecret deviceAdminPassword) @@ -24,15 +28,22 @@ public DataBoxEdgeSecuritySettings(AsymmetricEncryptedSecret deviceAdminPassword DeviceAdminPassword = deviceAdminPassword; } - /// Initializes a new instance of DataBoxEdgeSecuritySettings. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. - internal DataBoxEdgeSecuritySettings(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AsymmetricEncryptedSecret deviceAdminPassword) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeSecuritySettings(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AsymmetricEncryptedSecret deviceAdminPassword, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DeviceAdminPassword = deviceAdminPassword; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeSecuritySettings() + { } /// Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShareData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShareData.Serialization.cs index 6a732abdfe00..40ae0d51eaf7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShareData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShareData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeShareData : IUtf8JsonSerializable + public partial class DataBoxEdgeShareData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -32,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AzureContainerInfo)) { writer.WritePropertyName("azureContainerInfo"u8); - writer.WriteObjectValue(AzureContainerInfo); + if (AzureContainerInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AzureContainerInfo).Serialize(writer, options); + } } writer.WritePropertyName("accessProtocol"u8); writer.WriteStringValue(AccessProtocol.ToString()); @@ -42,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserAccessRights) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,14 +73,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ClientAccessRights) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(RefreshDetails)) { writer.WritePropertyName("refreshDetails"u8); - writer.WriteObjectValue(RefreshDetails); + if (RefreshDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RefreshDetails).Serialize(writer, options); + } } if (Optional.IsDefined(DataPolicy)) { @@ -67,11 +102,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DataPolicy.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeShareData DeserializeDataBoxEdgeShareData(JsonElement element) + internal static DataBoxEdgeShareData DeserializeDataBoxEdgeShareData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,6 +139,7 @@ internal static DataBoxEdgeShareData DeserializeDataBoxEdgeShareData(JsonElement Optional refreshDetails = default; Optional> shareMappings = default; Optional dataPolicy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -217,8 +267,61 @@ internal static DataBoxEdgeShareData DeserializeDataBoxEdgeShareData(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeShareData(id, name, type, systemData.Value, description.Value, shareStatus, monitoringStatus, azureContainerInfo.Value, accessProtocol, Optional.ToList(userAccessRights), Optional.ToList(clientAccessRights), refreshDetails.Value, Optional.ToList(shareMappings), Optional.ToNullable(dataPolicy)); + return new DataBoxEdgeShareData(id, name, type, systemData.Value, description.Value, shareStatus, monitoringStatus, azureContainerInfo.Value, accessProtocol, Optional.ToList(userAccessRights), Optional.ToList(clientAccessRights), refreshDetails.Value, Optional.ToList(shareMappings), Optional.ToNullable(dataPolicy), serializedAdditionalRawData); + } + + DataBoxEdgeShareData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeShareData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeShareData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeShareData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeShareData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeShareData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeShareData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.Serialization.cs index 426a9fa5eb41..2df2dc20788d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeShippingAddress : IUtf8JsonSerializable + public partial class DataBoxEdgeShippingAddress : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AddressLine1)) { @@ -47,11 +55,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("country"u8); writer.WriteStringValue(Country); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeShippingAddress DeserializeDataBoxEdgeShippingAddress(JsonElement element) + internal static DataBoxEdgeShippingAddress DeserializeDataBoxEdgeShippingAddress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +85,7 @@ internal static DataBoxEdgeShippingAddress DeserializeDataBoxEdgeShippingAddress Optional city = default; Optional state = default; string country = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("addressLine1"u8)) @@ -100,8 +123,61 @@ internal static DataBoxEdgeShippingAddress DeserializeDataBoxEdgeShippingAddress country = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeShippingAddress(addressLine1.Value, addressLine2.Value, addressLine3.Value, postalCode.Value, city.Value, state.Value, country, serializedAdditionalRawData); + } + + DataBoxEdgeShippingAddress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeShippingAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeShippingAddress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeShippingAddress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeShippingAddress model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeShippingAddress(addressLine1.Value, addressLine2.Value, addressLine3.Value, postalCode.Value, city.Value, state.Value, country); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeShippingAddress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeShippingAddress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.cs index e61b5f821520..583bc03e9656 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeShippingAddress.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The shipping address of the customer. public partial class DataBoxEdgeShippingAddress { - /// Initializes a new instance of DataBoxEdgeShippingAddress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The country name. /// is null. public DataBoxEdgeShippingAddress(string country) @@ -23,7 +27,7 @@ public DataBoxEdgeShippingAddress(string country) Country = country; } - /// Initializes a new instance of DataBoxEdgeShippingAddress. + /// Initializes a new instance of . /// The address line1. /// The address line2. /// The address line3. @@ -31,7 +35,8 @@ public DataBoxEdgeShippingAddress(string country) /// The city name. /// The state name. /// The country name. - internal DataBoxEdgeShippingAddress(string addressLine1, string addressLine2, string addressLine3, string postalCode, string city, string state, string country) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeShippingAddress(string addressLine1, string addressLine2, string addressLine3, string postalCode, string city, string state, string country, Dictionary serializedAdditionalRawData) { AddressLine1 = addressLine1; AddressLine2 = addressLine2; @@ -40,6 +45,12 @@ internal DataBoxEdgeShippingAddress(string addressLine1, string addressLine2, st City = city; State = state; Country = country; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeShippingAddress() + { } /// The address line1. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.Serialization.cs index fb6fcda616cf..f119de084def 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeSku : IUtf8JsonSerializable + public partial class DataBoxEdgeSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tier"u8); writer.WriteStringValue(Tier.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeSku DeserializeDataBoxEdgeSku(JsonElement element) + internal static DataBoxEdgeSku DeserializeDataBoxEdgeSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional tier = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -56,8 +79,61 @@ internal static DataBoxEdgeSku DeserializeDataBoxEdgeSku(JsonElement element) tier = new DataBoxEdgeSkuTier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeSku(Optional.ToNullable(name), Optional.ToNullable(tier), serializedAdditionalRawData); + } + + DataBoxEdgeSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeSku model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeSku(Optional.ToNullable(name), Optional.ToNullable(tier)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.cs index ff4dabe70a14..962b649ac085 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSku.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// The SKU type. public partial class DataBoxEdgeSku { - /// Initializes a new instance of DataBoxEdgeSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeSku() { } - /// Initializes a new instance of DataBoxEdgeSku. + /// Initializes a new instance of . /// SKU name. /// The SKU tier. This is based on the SKU name. - internal DataBoxEdgeSku(DataBoxEdgeSkuName? name, DataBoxEdgeSkuTier? tier) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeSku(DataBoxEdgeSkuName? name, DataBoxEdgeSkuTier? tier, Dictionary serializedAdditionalRawData) { Name = name; Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// SKU name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.Serialization.cs index 08066270dd71..1eddda661923 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeSkuCapability + public partial class DataBoxEdgeSkuCapability : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeSkuCapability DeserializeDataBoxEdgeSkuCapability(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeSkuCapability DeserializeDataBoxEdgeSkuCapability(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +61,61 @@ internal static DataBoxEdgeSkuCapability DeserializeDataBoxEdgeSkuCapability(Jso value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeSkuCapability(name.Value, value.Value); + return new DataBoxEdgeSkuCapability(name.Value, value.Value, serializedAdditionalRawData); + } + + DataBoxEdgeSkuCapability IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeSkuCapability(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeSkuCapability IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeSkuCapability(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeSkuCapability model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeSkuCapability(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeSkuCapability(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.cs index 355711792080..2ef838344f02 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCapability.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// The metadata to describe the capability. public partial class DataBoxEdgeSkuCapability { - /// Initializes a new instance of DataBoxEdgeSkuCapability. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeSkuCapability() { } - /// Initializes a new instance of DataBoxEdgeSkuCapability. + /// Initializes a new instance of . /// An invariant to describe the feature. /// An invariant if the feature is measured by quantity. - internal DataBoxEdgeSkuCapability(string name, string value) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeSkuCapability(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// An invariant to describe the feature. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.Serialization.cs index f0a5970356c1..94908689c908 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeSkuCost + public partial class DataBoxEdgeSkuCost : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeSkuCost DeserializeDataBoxEdgeSkuCost(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeSkuCost DeserializeDataBoxEdgeSkuCost(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static DataBoxEdgeSkuCost DeserializeDataBoxEdgeSkuCost(JsonElement ele Optional meterId = default; Optional quantity = default; Optional extendedUnit = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("meterId"u8)) @@ -42,8 +71,61 @@ internal static DataBoxEdgeSkuCost DeserializeDataBoxEdgeSkuCost(JsonElement ele extendedUnit = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeSkuCost(meterId.Value, Optional.ToNullable(quantity), extendedUnit.Value); + return new DataBoxEdgeSkuCost(meterId.Value, Optional.ToNullable(quantity), extendedUnit.Value, serializedAdditionalRawData); + } + + DataBoxEdgeSkuCost IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeSkuCost(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeSkuCost IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeSkuCost(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeSkuCost model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeSkuCost(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeSkuCost(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.cs index 3d5cf2d0962e..9bc932827ec4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuCost.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// The metadata for retrieving price info. public partial class DataBoxEdgeSkuCost { - /// Initializes a new instance of DataBoxEdgeSkuCost. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeSkuCost() { } - /// Initializes a new instance of DataBoxEdgeSkuCost. + /// Initializes a new instance of . /// Used for querying price from commerce. /// The cost quantity. /// The extended unit. - internal DataBoxEdgeSkuCost(string meterId, long? quantity, string extendedUnit) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeSkuCost(string meterId, long? quantity, string extendedUnit, Dictionary serializedAdditionalRawData) { MeterId = meterId; Quantity = quantity; ExtendedUnit = extendedUnit; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Used for querying price from commerce. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.Serialization.cs index 62d4555eb70e..21d9c40eb535 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.Serialization.cs @@ -5,16 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeSkuLocationInfo + public partial class DataBoxEdgeSkuLocationInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeSkuLocationInfo DeserializeDataBoxEdgeSkuLocationInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeSkuLocationInfo DeserializeDataBoxEdgeSkuLocationInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +49,7 @@ internal static DataBoxEdgeSkuLocationInfo DeserializeDataBoxEdgeSkuLocationInfo Optional location = default; Optional> zones = default; Optional> sites = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -61,8 +89,61 @@ internal static DataBoxEdgeSkuLocationInfo DeserializeDataBoxEdgeSkuLocationInfo sites = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(sites)); + return new DataBoxEdgeSkuLocationInfo(Optional.ToNullable(location), Optional.ToList(zones), Optional.ToList(sites), serializedAdditionalRawData); + } + + DataBoxEdgeSkuLocationInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeSkuLocationInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeSkuLocationInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeSkuLocationInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeSkuLocationInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeSkuLocationInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeSkuLocationInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.cs index 856c76e55eb1..0515d8b7438a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSkuLocationInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The location info. public partial class DataBoxEdgeSkuLocationInfo { - /// Initializes a new instance of DataBoxEdgeSkuLocationInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeSkuLocationInfo() { Zones = new ChangeTrackingList(); Sites = new ChangeTrackingList(); } - /// Initializes a new instance of DataBoxEdgeSkuLocationInfo. + /// Initializes a new instance of . /// The location. /// The zones. /// The sites. - internal DataBoxEdgeSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList sites) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IReadOnlyList sites, Dictionary serializedAdditionalRawData) { Location = location; Zones = zones; Sites = sites; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The location. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountCredentialData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountCredentialData.Serialization.cs index a999420ab87e..c96b8edfa8bf 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountCredentialData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountCredentialData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeStorageAccountCredentialData : IUtf8JsonSerializable + public partial class DataBoxEdgeStorageAccountCredentialData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -29,7 +37,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AccountKey)) { writer.WritePropertyName("accountKey"u8); - writer.WriteObjectValue(AccountKey); + if (AccountKey is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AccountKey).Serialize(writer, options); + } } if (Optional.IsDefined(ConnectionString)) { @@ -51,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StorageAccountId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeStorageAccountCredentialData DeserializeDataBoxEdgeStorageAccountCredentialData(JsonElement element) + internal static DataBoxEdgeStorageAccountCredentialData DeserializeDataBoxEdgeStorageAccountCredentialData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +101,7 @@ internal static DataBoxEdgeStorageAccountCredentialData DeserializeDataBoxEdgeSt Optional blobDomainName = default; DataBoxEdgeStorageAccountType accountType = default; Optional storageAccountId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -158,8 +188,61 @@ internal static DataBoxEdgeStorageAccountCredentialData DeserializeDataBoxEdgeSt } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeStorageAccountCredentialData(id, name, type, systemData.Value, @alias, userName.Value, accountKey.Value, connectionString.Value, sslStatus, blobDomainName.Value, accountType, storageAccountId.Value, serializedAdditionalRawData); + } + + DataBoxEdgeStorageAccountCredentialData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeStorageAccountCredentialData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeStorageAccountCredentialData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeStorageAccountCredentialData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeStorageAccountCredentialData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeStorageAccountCredentialData(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeStorageAccountCredentialData(id, name, type, systemData.Value, @alias, userName.Value, accountKey.Value, connectionString.Value, sslStatus, blobDomainName.Value, accountType, storageAccountId.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeStorageAccountCredentialData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountData.Serialization.cs index 876c94d66cbb..b0ac11cf127a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageAccountData.Serialization.cs @@ -5,17 +5,25 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeStorageAccountData : IUtf8JsonSerializable + public partial class DataBoxEdgeStorageAccountData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -37,11 +45,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(StorageAccountCredentialId); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeStorageAccountData DeserializeDataBoxEdgeStorageAccountData(JsonElement element) + internal static DataBoxEdgeStorageAccountData DeserializeDataBoxEdgeStorageAccountData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +78,7 @@ internal static DataBoxEdgeStorageAccountData DeserializeDataBoxEdgeStorageAccou Optional storageAccountCredentialId = default; Optional blobEndpoint = default; Optional containerCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -136,8 +159,61 @@ internal static DataBoxEdgeStorageAccountData DeserializeDataBoxEdgeStorageAccou } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeStorageAccountData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(storageAccountStatus), dataPolicy, storageAccountCredentialId.Value, blobEndpoint.Value, Optional.ToNullable(containerCount), serializedAdditionalRawData); + } + + DataBoxEdgeStorageAccountData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeStorageAccountData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeStorageAccountData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeStorageAccountData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeStorageAccountData model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeStorageAccountData(id, name, type, systemData.Value, description.Value, Optional.ToNullable(storageAccountStatus), dataPolicy, storageAccountCredentialId.Value, blobEndpoint.Value, Optional.ToNullable(containerCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeStorageAccountData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeStorageAccountData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerData.Serialization.cs index d2ca00ec0e5f..9e763b1a0b86 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerData.Serialization.cs @@ -6,28 +6,49 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeStorageContainerData : IUtf8JsonSerializable + public partial class DataBoxEdgeStorageContainerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("dataFormat"u8); writer.WriteStringValue(DataFormat.ToString()); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeStorageContainerData DeserializeDataBoxEdgeStorageContainerData(JsonElement element) + internal static DataBoxEdgeStorageContainerData DeserializeDataBoxEdgeStorageContainerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +61,7 @@ internal static DataBoxEdgeStorageContainerData DeserializeDataBoxEdgeStorageCon DataBoxEdgeStorageContainerDataFormat dataFormat = default; Optional refreshDetails = default; Optional createdDateTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -110,8 +132,61 @@ internal static DataBoxEdgeStorageContainerData DeserializeDataBoxEdgeStorageCon } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeStorageContainerData(id, name, type, systemData.Value, Optional.ToNullable(containerStatus), dataFormat, refreshDetails.Value, Optional.ToNullable(createdDateTime), serializedAdditionalRawData); + } + + DataBoxEdgeStorageContainerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeStorageContainerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeStorageContainerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeStorageContainerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeStorageContainerData model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeStorageContainerData(id, name, type, systemData.Value, Optional.ToNullable(containerStatus), dataFormat, refreshDetails.Value, Optional.ToNullable(createdDateTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeStorageContainerData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeStorageContainerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.Serialization.cs index 74af07ece281..ff2fcc72e3c5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeStorageContainerInfo : IUtf8JsonSerializable + public partial class DataBoxEdgeStorageContainerInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("storageAccountCredentialId"u8); writer.WriteStringValue(StorageAccountCredentialId); @@ -21,11 +29,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(ContainerName); writer.WritePropertyName("dataFormat"u8); writer.WriteStringValue(DataFormat.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeStorageContainerInfo DeserializeDataBoxEdgeStorageContainerInfo(JsonElement element) + internal static DataBoxEdgeStorageContainerInfo DeserializeDataBoxEdgeStorageContainerInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -33,6 +55,7 @@ internal static DataBoxEdgeStorageContainerInfo DeserializeDataBoxEdgeStorageCon ResourceIdentifier storageAccountCredentialId = default; string containerName = default; DataBoxEdgeStorageContainerDataFormat dataFormat = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountCredentialId"u8)) @@ -50,8 +73,61 @@ internal static DataBoxEdgeStorageContainerInfo DeserializeDataBoxEdgeStorageCon dataFormat = new DataBoxEdgeStorageContainerDataFormat(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeStorageContainerInfo(storageAccountCredentialId, containerName, dataFormat, serializedAdditionalRawData); + } + + DataBoxEdgeStorageContainerInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeStorageContainerInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeStorageContainerInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeStorageContainerInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeStorageContainerInfo model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeStorageContainerInfo(storageAccountCredentialId, containerName, dataFormat); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeStorageContainerInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeStorageContainerInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.cs index b480fe0a19ae..c15ec6e20c85 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeStorageContainerInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Azure container mapping of the endpoint. public partial class DataBoxEdgeStorageContainerInfo { - /// Initializes a new instance of DataBoxEdgeStorageContainerInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// ID of the storage account credential used to access storage. /// Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). /// Storage format used for the file represented by the share. @@ -28,6 +32,24 @@ public DataBoxEdgeStorageContainerInfo(ResourceIdentifier storageAccountCredenti DataFormat = dataFormat; } + /// Initializes a new instance of . + /// ID of the storage account credential used to access storage. + /// Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). + /// Storage format used for the file represented by the share. + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeStorageContainerInfo(ResourceIdentifier storageAccountCredentialId, string containerName, DataBoxEdgeStorageContainerDataFormat dataFormat, Dictionary serializedAdditionalRawData) + { + StorageAccountCredentialId = storageAccountCredentialId; + ContainerName = containerName; + DataFormat = dataFormat; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataBoxEdgeStorageContainerInfo() + { + } + /// ID of the storage account credential used to access storage. public ResourceIdentifier StorageAccountCredentialId { get; set; } /// Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.Serialization.cs index a6d6081285a9..37c8f5ae57a9 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class DataBoxEdgeSymmetricKey : IUtf8JsonSerializable + internal partial class DataBoxEdgeSymmetricKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConnectionString)) { writer.WritePropertyName("connectionString"u8); - writer.WriteObjectValue(ConnectionString); + if (ConnectionString is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionString).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataBoxEdgeSymmetricKey DeserializeDataBoxEdgeSymmetricKey(JsonElement element) + internal static DataBoxEdgeSymmetricKey DeserializeDataBoxEdgeSymmetricKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional connectionString = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionString"u8)) @@ -41,8 +71,61 @@ internal static DataBoxEdgeSymmetricKey DeserializeDataBoxEdgeSymmetricKey(JsonE connectionString = AsymmetricEncryptedSecret.DeserializeAsymmetricEncryptedSecret(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeSymmetricKey(connectionString.Value, serializedAdditionalRawData); + } + + DataBoxEdgeSymmetricKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeSymmetricKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeSymmetricKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeSymmetricKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeSymmetricKey model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeSymmetricKey(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeSymmetricKey(connectionString.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeSymmetricKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.cs index 564cbfeacfe5..8cbddd2edae6 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeSymmetricKey.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Symmetric key for authentication. internal partial class DataBoxEdgeSymmetricKey { - /// Initializes a new instance of DataBoxEdgeSymmetricKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeSymmetricKey() { } - /// Initializes a new instance of DataBoxEdgeSymmetricKey. + /// Initializes a new instance of . /// Connection string based on the symmetric key. - internal DataBoxEdgeSymmetricKey(AsymmetricEncryptedSecret connectionString) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeSymmetricKey(AsymmetricEncryptedSecret connectionString, Dictionary serializedAdditionalRawData) { ConnectionString = connectionString; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Connection string based on the symmetric key. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.Serialization.cs index 2e88146fc09d..3075df3370b9 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.Serialization.cs @@ -6,15 +6,62 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeTrackingInfo + public partial class DataBoxEdgeTrackingInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeTrackingInfo DeserializeDataBoxEdgeTrackingInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsDefined(CarrierName)) + { + writer.WritePropertyName("carrierName"u8); + writer.WriteStringValue(CarrierName); + } + if (Optional.IsDefined(TrackingId)) + { + writer.WritePropertyName("trackingId"u8); + writer.WriteStringValue(TrackingId); + } + if (Optional.IsDefined(TrackingUri)) + { + writer.WritePropertyName("trackingUrl"u8); + writer.WriteStringValue(TrackingUri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeTrackingInfo DeserializeDataBoxEdgeTrackingInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +70,7 @@ internal static DataBoxEdgeTrackingInfo DeserializeDataBoxEdgeTrackingInfo(JsonE Optional carrierName = default; Optional trackingId = default; Optional trackingUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("serialNumber"u8)) @@ -49,8 +97,61 @@ internal static DataBoxEdgeTrackingInfo DeserializeDataBoxEdgeTrackingInfo(JsonE trackingUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeTrackingInfo(serialNumber.Value, carrierName.Value, trackingId.Value, trackingUrl.Value); + return new DataBoxEdgeTrackingInfo(serialNumber.Value, carrierName.Value, trackingId.Value, trackingUrl.Value, serializedAdditionalRawData); + } + + DataBoxEdgeTrackingInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeTrackingInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeTrackingInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeTrackingInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeTrackingInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeTrackingInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeTrackingInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.cs index 55eff2b7316c..a31fcd4682d0 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTrackingInfo.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBoxEdge.Models { /// Tracking courier information. public partial class DataBoxEdgeTrackingInfo { - /// Initializes a new instance of DataBoxEdgeTrackingInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeTrackingInfo() { } - /// Initializes a new instance of DataBoxEdgeTrackingInfo. + /// Initializes a new instance of . /// Serial number of the device being tracked. /// Name of the carrier used in the delivery. /// Tracking ID of the shipment. /// Tracking URL of the shipment. - internal DataBoxEdgeTrackingInfo(string serialNumber, string carrierName, string trackingId, Uri trackingUri) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeTrackingInfo(string serialNumber, string carrierName, string trackingId, Uri trackingUri, Dictionary serializedAdditionalRawData) { SerialNumber = serialNumber; CarrierName = carrierName; TrackingId = trackingId; TrackingUri = trackingUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Serial number of the device being tracked. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTriggerData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTriggerData.Serialization.cs index f9689016e543..4d20ce125f7f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTriggerData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeTriggerData.Serialization.cs @@ -5,25 +5,47 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeTriggerData : IUtf8JsonSerializable + public partial class DataBoxEdgeTriggerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeTriggerData DeserializeDataBoxEdgeTriggerData(JsonElement element) + internal static DataBoxEdgeTriggerData DeserializeDataBoxEdgeTriggerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,11 +58,14 @@ internal static DataBoxEdgeTriggerData DeserializeDataBoxEdgeTriggerData(JsonEle case "PeriodicTimerEvent": return PeriodicTimerEventTrigger.DeserializePeriodicTimerEventTrigger(element); } } + + // Unknown type found so we will deserialize the base properties only TriggerEventType kind = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -72,8 +97,61 @@ internal static DataBoxEdgeTriggerData DeserializeDataBoxEdgeTriggerData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataBoxEdgeTriggerData(id, name, type, systemData.Value, kind); + return new DataBoxEdgeTriggerData(id, name, type, systemData.Value, kind, serializedAdditionalRawData); + } + + DataBoxEdgeTriggerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeTriggerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeTriggerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeTriggerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeTriggerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeTriggerData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeTriggerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.Serialization.cs index d800cd8bc591..21f3a3cfc3ff 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.Serialization.cs @@ -5,15 +5,88 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeUpdateDetails + public partial class DataBoxEdgeUpdateDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataBoxEdgeUpdateDetails DeserializeDataBoxEdgeUpdateDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(UpdateTitle)) + { + writer.WritePropertyName("updateTitle"u8); + writer.WriteStringValue(UpdateTitle); + } + if (Optional.IsDefined(UpdateSizeInBytes)) + { + writer.WritePropertyName("updateSize"u8); + writer.WriteNumberValue(UpdateSizeInBytes.Value); + } + if (Optional.IsDefined(UpdateType)) + { + writer.WritePropertyName("updateType"u8); + writer.WriteStringValue(UpdateType.Value.ToString()); + } + if (Optional.IsDefined(TargetVersion)) + { + writer.WritePropertyName("targetVersion"u8); + writer.WriteStringValue(TargetVersion); + } + if (Optional.IsDefined(FriendlyVersionNumber)) + { + writer.WritePropertyName("friendlyVersionNumber"u8); + writer.WriteStringValue(FriendlyVersionNumber); + } + if (Optional.IsDefined(EstimatedInstallTimeInMins)) + { + writer.WritePropertyName("estimatedInstallTimeInMins"u8); + writer.WriteNumberValue(EstimatedInstallTimeInMins.Value); + } + if (Optional.IsDefined(RebootBehavior)) + { + writer.WritePropertyName("rebootBehavior"u8); + writer.WriteStringValue(RebootBehavior.Value.ToString()); + } + if (Optional.IsDefined(InstallationImpact)) + { + writer.WritePropertyName("installationImpact"u8); + writer.WriteStringValue(InstallationImpact.Value.ToString()); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataBoxEdgeUpdateDetails DeserializeDataBoxEdgeUpdateDetails(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +100,7 @@ internal static DataBoxEdgeUpdateDetails DeserializeDataBoxEdgeUpdateDetails(Jso Optional rebootBehavior = default; Optional installationImpact = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("updateTitle"u8)) @@ -98,8 +172,61 @@ internal static DataBoxEdgeUpdateDetails DeserializeDataBoxEdgeUpdateDetails(Jso status = new DataBoxEdgeUpdateStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeUpdateDetails(updateTitle.Value, Optional.ToNullable(updateSize), Optional.ToNullable(updateType), targetVersion.Value, friendlyVersionNumber.Value, Optional.ToNullable(estimatedInstallTimeInMins), Optional.ToNullable(rebootBehavior), Optional.ToNullable(installationImpact), Optional.ToNullable(status), serializedAdditionalRawData); + } + + DataBoxEdgeUpdateDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeUpdateDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeUpdateDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeUpdateDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeUpdateDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeUpdateDetails(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeUpdateDetails(updateTitle.Value, Optional.ToNullable(updateSize), Optional.ToNullable(updateType), targetVersion.Value, friendlyVersionNumber.Value, Optional.ToNullable(estimatedInstallTimeInMins), Optional.ToNullable(rebootBehavior), Optional.ToNullable(installationImpact), Optional.ToNullable(status)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeUpdateDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.cs index 678674854528..b6a3da71ba6a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUpdateDetails.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Update Specific attributes. public partial class DataBoxEdgeUpdateDetails { - /// Initializes a new instance of DataBoxEdgeUpdateDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataBoxEdgeUpdateDetails() { } - /// Initializes a new instance of DataBoxEdgeUpdateDetails. + /// Initializes a new instance of . /// Title of the Update. /// Size of the update(In Bytes). /// Type of the Update. @@ -25,7 +31,8 @@ internal DataBoxEdgeUpdateDetails() /// Indicates if updates are available and at least one of the updates needs a reboot. /// Impact of Installing an updateType. /// Status of the update. - internal DataBoxEdgeUpdateDetails(string updateTitle, double? updateSizeInBytes, DataBoxEdgeUpdateType? updateType, string targetVersion, string friendlyVersionNumber, int? estimatedInstallTimeInMins, InstallRebootBehavior? rebootBehavior, InstallationImpact? installationImpact, DataBoxEdgeUpdateStatus? status) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeUpdateDetails(string updateTitle, double? updateSizeInBytes, DataBoxEdgeUpdateType? updateType, string targetVersion, string friendlyVersionNumber, int? estimatedInstallTimeInMins, InstallRebootBehavior? rebootBehavior, InstallationImpact? installationImpact, DataBoxEdgeUpdateStatus? status, Dictionary serializedAdditionalRawData) { UpdateTitle = updateTitle; UpdateSizeInBytes = updateSizeInBytes; @@ -36,6 +43,7 @@ internal DataBoxEdgeUpdateDetails(string updateTitle, double? updateSizeInBytes, RebootBehavior = rebootBehavior; InstallationImpact = installationImpact; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Title of the Update. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUserData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUserData.Serialization.cs index a6d4ccddfab5..deb0a334060f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUserData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeUserData.Serialization.cs @@ -5,34 +5,62 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DataBoxEdgeUserData : IUtf8JsonSerializable + public partial class DataBoxEdgeUserData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(EncryptedPassword)) { writer.WritePropertyName("encryptedPassword"u8); - writer.WriteObjectValue(EncryptedPassword); + if (EncryptedPassword is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EncryptedPassword).Serialize(writer, options); + } } writer.WritePropertyName("userType"u8); writer.WriteStringValue(UserType.ToString()); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeUserData DeserializeDataBoxEdgeUserData(JsonElement element) + internal static DataBoxEdgeUserData DeserializeDataBoxEdgeUserData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +72,7 @@ internal static DataBoxEdgeUserData DeserializeDataBoxEdgeUserData(JsonElement e Optional encryptedPassword = default; Optional> shareAccessRights = default; DataBoxEdgeUserType userType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -110,8 +139,61 @@ internal static DataBoxEdgeUserData DeserializeDataBoxEdgeUserData(JsonElement e } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeUserData(id, name, type, systemData.Value, encryptedPassword.Value, Optional.ToList(shareAccessRights), userType, serializedAdditionalRawData); + } + + DataBoxEdgeUserData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeUserData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeUserData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeUserData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeUserData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeUserData(Response response) + { + if (response is null) + { + return null; } - return new DataBoxEdgeUserData(id, name, type, systemData.Value, encryptedPassword.Value, Optional.ToList(shareAccessRights), userType); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeUserData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.Serialization.cs index 1a89bde07884..1e5e61ecc95e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DataBoxEdgeVmMemory : IUtf8JsonSerializable + public partial class DataBoxEdgeVmMemory : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StartupMemoryInMB)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("currentMemoryUsageMB"u8); writer.WriteNumberValue(CurrentMemoryUsageInMB.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataBoxEdgeVmMemory DeserializeDataBoxEdgeVmMemory(JsonElement element) + internal static DataBoxEdgeVmMemory DeserializeDataBoxEdgeVmMemory(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional startupMemoryMB = default; Optional currentMemoryUsageMB = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("startupMemoryMB"u8)) @@ -56,8 +79,61 @@ internal static DataBoxEdgeVmMemory DeserializeDataBoxEdgeVmMemory(JsonElement e currentMemoryUsageMB = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataBoxEdgeVmMemory(Optional.ToNullable(startupMemoryMB), Optional.ToNullable(currentMemoryUsageMB), serializedAdditionalRawData); + } + + DataBoxEdgeVmMemory IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataBoxEdgeVmMemory(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataBoxEdgeVmMemory IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataBoxEdgeVmMemory(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataBoxEdgeVmMemory model) + { + if (model is null) + { + return null; } - return new DataBoxEdgeVmMemory(Optional.ToNullable(startupMemoryMB), Optional.ToNullable(currentMemoryUsageMB)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataBoxEdgeVmMemory(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataBoxEdgeVmMemory(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.cs index f57f30ac3b64..bc795134b90d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataBoxEdgeVmMemory.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// VmMemory Data. public partial class DataBoxEdgeVmMemory { - /// Initializes a new instance of DataBoxEdgeVmMemory. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataBoxEdgeVmMemory() { } - /// Initializes a new instance of DataBoxEdgeVmMemory. + /// Initializes a new instance of . /// The total amount of RAM in the virtual machine, as seen by the guest operating system. For a virtual machine with dynamic memory enabled, this represents the initial memory available at startup. /// The current memory used by the virtual machine. - internal DataBoxEdgeVmMemory(long? startupMemoryInMB, long? currentMemoryUsageInMB) + /// Keeps track of any properties unknown to the library. + internal DataBoxEdgeVmMemory(long? startupMemoryInMB, long? currentMemoryUsageInMB, Dictionary serializedAdditionalRawData) { StartupMemoryInMB = startupMemoryInMB; CurrentMemoryUsageInMB = currentMemoryUsageInMB; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The total amount of RAM in the virtual machine, as seen by the guest operating system. For a virtual machine with dynamic memory enabled, this represents the initial memory available at startup. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.Serialization.cs index 431b1a2271ec..65191fab27ca 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class DataResidency : IUtf8JsonSerializable + internal partial class DataResidency : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ResidencyType)) { writer.WritePropertyName("type"u8); writer.WriteStringValue(ResidencyType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataResidency DeserializeDataResidency(JsonElement element) + internal static DataResidency DeserializeDataResidency(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -41,8 +64,61 @@ internal static DataResidency DeserializeDataResidency(JsonElement element) type = new DataBoxEdgeDataResidencyType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataResidency(Optional.ToNullable(type), serializedAdditionalRawData); + } + + DataResidency IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataResidency(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataResidency IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataResidency(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataResidency model) + { + if (model is null) + { + return null; } - return new DataResidency(Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataResidency(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataResidency(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.cs index 61d38b8230e3..a37624f0e07e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DataResidency.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Wraps data-residency related information for edge-resource and this should be used with ARM layer. internal partial class DataResidency { - /// Initializes a new instance of DataResidency. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataResidency() { } - /// Initializes a new instance of DataResidency. + /// Initializes a new instance of . /// DataResidencyType enum. - internal DataResidency(DataBoxEdgeDataResidencyType? residencyType) + /// Keeps track of any properties unknown to the library. + internal DataResidency(DataBoxEdgeDataResidencyType? residencyType, Dictionary serializedAdditionalRawData) { ResidencyType = residencyType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// DataResidencyType enum. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.Serialization.cs index 7b55e5669653..86fba7cd8ac2 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class DeviceCapacityRequestContent : IUtf8JsonSerializable + public partial class DeviceCapacityRequestContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -40,12 +48,149 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VmPlacementResults) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DeviceCapacityRequestContent DeserializeDeviceCapacityRequestContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList> vmPlacementQuery = default; + Optional> vmPlacementResults = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("vmPlacementQuery"u8)) + { + List> array = new List>(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + array0.Add(item0.GetString()); + } + array.Add(array0); + } + } + vmPlacementQuery = array; + continue; + } + if (property0.NameEquals("vmPlacementResults"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(VmPlacementRequestResult.DeserializeVmPlacementRequestResult(item)); + } + vmPlacementResults = array; + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeviceCapacityRequestContent(vmPlacementQuery, Optional.ToList(vmPlacementResults), serializedAdditionalRawData); + } + + DeviceCapacityRequestContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeviceCapacityRequestContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeviceCapacityRequestContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeviceCapacityRequestContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeviceCapacityRequestContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeviceCapacityRequestContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeviceCapacityRequestContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.cs index a96186e0958b..4371cf159c80 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DeviceCapacityRequestContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Object for Capturing DeviceCapacityRequestInfo. public partial class DeviceCapacityRequestContent { - /// Initializes a new instance of DeviceCapacityRequestContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Array containing the sizes of the VMs for checking if its feasible to create them on the appliance. /// is null. public DeviceCapacityRequestContent(IEnumerable> vmPlacementQuery) @@ -26,6 +29,22 @@ public DeviceCapacityRequestContent(IEnumerable> vmPlacementQuery) VmPlacementResults = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// Array containing the sizes of the VMs for checking if its feasible to create them on the appliance. + /// Array of the VMs of the sizes in VmSizes can be provisioned on the appliance. + /// Keeps track of any properties unknown to the library. + internal DeviceCapacityRequestContent(IList> vmPlacementQuery, IList vmPlacementResults, Dictionary serializedAdditionalRawData) + { + VmPlacementQuery = vmPlacementQuery; + VmPlacementResults = vmPlacementResults; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeviceCapacityRequestContent() + { + } + /// Array containing the sizes of the VMs for checking if its feasible to create them on the appliance. public IList> VmPlacementQuery { get; } /// Array of the VMs of the sizes in VmSizes can be provisioned on the appliance. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticProactiveLogCollectionSettingData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticProactiveLogCollectionSettingData.Serialization.cs index 5fa41ff1f93b..3202d0b9ab7a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticProactiveLogCollectionSettingData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticProactiveLogCollectionSettingData.Serialization.cs @@ -5,28 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DiagnosticProactiveLogCollectionSettingData : IUtf8JsonSerializable + public partial class DiagnosticProactiveLogCollectionSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("userConsent"u8); writer.WriteStringValue(UserConsent.ToString()); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiagnosticProactiveLogCollectionSettingData DeserializeDiagnosticProactiveLogCollectionSettingData(JsonElement element) + internal static DiagnosticProactiveLogCollectionSettingData DeserializeDiagnosticProactiveLogCollectionSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static DiagnosticProactiveLogCollectionSettingData DeserializeDiagnosti ResourceType type = default; Optional systemData = default; ProactiveDiagnosticsConsent userConsent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -79,8 +102,61 @@ internal static DiagnosticProactiveLogCollectionSettingData DeserializeDiagnosti } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiagnosticProactiveLogCollectionSettingData(id, name, type, systemData.Value, userConsent, serializedAdditionalRawData); + } + + DiagnosticProactiveLogCollectionSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticProactiveLogCollectionSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticProactiveLogCollectionSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticProactiveLogCollectionSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticProactiveLogCollectionSettingData model) + { + if (model is null) + { + return null; } - return new DiagnosticProactiveLogCollectionSettingData(id, name, type, systemData.Value, userConsent); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticProactiveLogCollectionSettingData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticProactiveLogCollectionSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticRemoteSupportSettingData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticRemoteSupportSettingData.Serialization.cs index 278c09e84252..e56bf55bd724 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticRemoteSupportSettingData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/DiagnosticRemoteSupportSettingData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class DiagnosticRemoteSupportSettingData : IUtf8JsonSerializable + public partial class DiagnosticRemoteSupportSettingData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -26,16 +33,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in RemoteSupportSettingsList) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DiagnosticRemoteSupportSettingData DeserializeDiagnosticRemoteSupportSettingData(JsonElement element) + internal static DiagnosticRemoteSupportSettingData DeserializeDiagnosticRemoteSupportSettingData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +73,7 @@ internal static DiagnosticRemoteSupportSettingData DeserializeDiagnosticRemoteSu ResourceType type = default; Optional systemData = default; Optional> remoteSupportSettingsList = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -97,8 +126,61 @@ internal static DiagnosticRemoteSupportSettingData DeserializeDiagnosticRemoteSu } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DiagnosticRemoteSupportSettingData(id, name, type, systemData.Value, Optional.ToList(remoteSupportSettingsList), serializedAdditionalRawData); + } + + DiagnosticRemoteSupportSettingData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticRemoteSupportSettingData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DiagnosticRemoteSupportSettingData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDiagnosticRemoteSupportSettingData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DiagnosticRemoteSupportSettingData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DiagnosticRemoteSupportSettingData(Response response) + { + if (response is null) + { + return null; } - return new DiagnosticRemoteSupportSettingData(id, name, type, systemData.Value, Optional.ToList(remoteSupportSettingsList)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDiagnosticRemoteSupportSettingData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.Serialization.cs index ec4eef8441bd..dbb3f4c15e74 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeArcAddon : IUtf8JsonSerializable + public partial class EdgeArcAddon : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -29,11 +37,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("resourceLocation"u8); writer.WriteStringValue(ResourceLocation); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeArcAddon DeserializeEdgeArcAddon(JsonElement element) + internal static EdgeArcAddon DeserializeEdgeArcAddon(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +73,7 @@ internal static EdgeArcAddon DeserializeEdgeArcAddon(JsonElement element) Optional hostPlatform = default; Optional hostPlatformType = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -146,8 +169,61 @@ internal static EdgeArcAddon DeserializeEdgeArcAddon(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeArcAddon(id, name, type, systemData.Value, kind, subscriptionId, resourceGroupName, resourceName, resourceLocation, version.Value, Optional.ToNullable(hostPlatform), Optional.ToNullable(hostPlatformType), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + EdgeArcAddon IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeArcAddon(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeArcAddon IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeArcAddon(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeArcAddon model) + { + if (model is null) + { + return null; } - return new EdgeArcAddon(id, name, type, systemData.Value, kind, subscriptionId, resourceGroupName, resourceName, resourceLocation, version.Value, Optional.ToNullable(hostPlatform), Optional.ToNullable(hostPlatformType), Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeArcAddon(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeArcAddon(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.cs index 9301f2f0cde2..5f583255a808 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeArcAddon.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -15,7 +16,7 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Arc Addon. public partial class EdgeArcAddon : DataBoxEdgeRoleAddonData { - /// Initializes a new instance of EdgeArcAddon. + /// Initializes a new instance of . /// Arc resource subscription Id. /// Arc resource group name. /// Arc resource Name. @@ -34,7 +35,7 @@ public EdgeArcAddon(string subscriptionId, string resourceGroupName, string reso Kind = AddonType.ArcForKubernetes; } - /// Initializes a new instance of EdgeArcAddon. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -48,7 +49,8 @@ public EdgeArcAddon(string subscriptionId, string resourceGroupName, string reso /// Host OS supported by the Arc addon. /// Platform where the runtime is hosted. /// Addon Provisioning State. - internal EdgeArcAddon(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonType kind, string subscriptionId, string resourceGroupName, string resourceName, AzureLocation resourceLocation, string version, DataBoxEdgeOSPlatformType? hostPlatform, HostPlatformType? hostPlatformType, DataBoxEdgeRoleAddonProvisioningState? provisioningState) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal EdgeArcAddon(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonType kind, string subscriptionId, string resourceGroupName, string resourceName, AzureLocation resourceLocation, string version, DataBoxEdgeOSPlatformType? hostPlatform, HostPlatformType? hostPlatformType, DataBoxEdgeRoleAddonProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { SubscriptionId = subscriptionId; ResourceGroupName = resourceGroupName; @@ -61,6 +63,11 @@ internal EdgeArcAddon(ResourceIdentifier id, string name, ResourceType resourceT Kind = kind; } + /// Initializes a new instance of for deserialization. + internal EdgeArcAddon() + { + } + /// Arc resource subscription Id. public string SubscriptionId { get; set; } /// Arc resource group name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.Serialization.cs index 85ef67f25cdc..90113b5696d3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeClusterCapacityViewInfo : IUtf8JsonSerializable + public partial class EdgeClusterCapacityViewInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Fqdn)) { @@ -24,12 +31,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GpuCapacity)) { writer.WritePropertyName("gpuCapacity"u8); - writer.WriteObjectValue(GpuCapacity); + if (GpuCapacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GpuCapacity).Serialize(writer, options); + } } if (Optional.IsDefined(MemoryCapacity)) { writer.WritePropertyName("memoryCapacity"u8); - writer.WriteObjectValue(MemoryCapacity); + if (MemoryCapacity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MemoryCapacity).Serialize(writer, options); + } } if (Optional.IsDefined(LastRefreshedOn)) { @@ -41,11 +62,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("totalProvisionedNonHpnCores"u8); writer.WriteNumberValue(TotalProvisionedNonHpnCores.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeClusterCapacityViewInfo DeserializeEdgeClusterCapacityViewInfo(JsonElement element) + internal static EdgeClusterCapacityViewInfo DeserializeEdgeClusterCapacityViewInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +90,7 @@ internal static EdgeClusterCapacityViewInfo DeserializeEdgeClusterCapacityViewIn Optional memoryCapacity = default; Optional lastRefreshedTime = default; Optional totalProvisionedNonHpnCores = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("fqdn"u8)) @@ -98,8 +134,61 @@ internal static EdgeClusterCapacityViewInfo DeserializeEdgeClusterCapacityViewIn totalProvisionedNonHpnCores = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeClusterCapacityViewInfo(fqdn.Value, gpuCapacity.Value, memoryCapacity.Value, Optional.ToNullable(lastRefreshedTime), Optional.ToNullable(totalProvisionedNonHpnCores), serializedAdditionalRawData); + } + + EdgeClusterCapacityViewInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeClusterCapacityViewInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeClusterCapacityViewInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeClusterCapacityViewInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeClusterCapacityViewInfo model) + { + if (model is null) + { + return null; } - return new EdgeClusterCapacityViewInfo(fqdn.Value, gpuCapacity.Value, memoryCapacity.Value, Optional.ToNullable(lastRefreshedTime), Optional.ToNullable(totalProvisionedNonHpnCores)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeClusterCapacityViewInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeClusterCapacityViewInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.cs index 0398b237032c..c8d0cf28a0cd 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterCapacityViewInfo.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBoxEdge.Models { /// Cluster Compute Data. public partial class EdgeClusterCapacityViewInfo { - /// Initializes a new instance of EdgeClusterCapacityViewInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeClusterCapacityViewInfo() { } - /// Initializes a new instance of EdgeClusterCapacityViewInfo. + /// Initializes a new instance of . /// The FQDN of the cluster. /// The cluster's GPU capacity. /// The cluster's memory capacity. /// The last time at which the ClusterCapacityViewData was set. /// The total # of vCPUs provisioned by non-HPN VM per appliance. - internal EdgeClusterCapacityViewInfo(string fqdn, EdgeClusterGpuCapacity gpuCapacity, EdgeClusterMemoryCapacity memoryCapacity, DateTimeOffset? lastRefreshedOn, long? totalProvisionedNonHpnCores) + /// Keeps track of any properties unknown to the library. + internal EdgeClusterCapacityViewInfo(string fqdn, EdgeClusterGpuCapacity gpuCapacity, EdgeClusterMemoryCapacity memoryCapacity, DateTimeOffset? lastRefreshedOn, long? totalProvisionedNonHpnCores, Dictionary serializedAdditionalRawData) { Fqdn = fqdn; GpuCapacity = gpuCapacity; MemoryCapacity = memoryCapacity; LastRefreshedOn = lastRefreshedOn; TotalProvisionedNonHpnCores = totalProvisionedNonHpnCores; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The FQDN of the cluster. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.Serialization.cs index 9bdaa6d2044a..633abeed0b3f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeClusterGpuCapacity : IUtf8JsonSerializable + public partial class EdgeClusterGpuCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(GpuType)) { @@ -40,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("gpuTotalUnitsCount"u8); writer.WriteNumberValue(GpuTotalUnitsCount.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeClusterGpuCapacity DeserializeEdgeClusterGpuCapacity(JsonElement element) + internal static EdgeClusterGpuCapacity DeserializeEdgeClusterGpuCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +76,7 @@ internal static EdgeClusterGpuCapacity DeserializeEdgeClusterGpuCapacity(JsonEle Optional gpuFreeUnitsCount = default; Optional gpuReservedForFailoverUnitsCount = default; Optional gpuTotalUnitsCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gpuType"u8)) @@ -97,8 +120,61 @@ internal static EdgeClusterGpuCapacity DeserializeEdgeClusterGpuCapacity(JsonEle gpuTotalUnitsCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeClusterGpuCapacity(gpuType.Value, Optional.ToNullable(gpuUsedUnitsCount), Optional.ToNullable(gpuFreeUnitsCount), Optional.ToNullable(gpuReservedForFailoverUnitsCount), Optional.ToNullable(gpuTotalUnitsCount), serializedAdditionalRawData); + } + + EdgeClusterGpuCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeClusterGpuCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeClusterGpuCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeClusterGpuCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeClusterGpuCapacity model) + { + if (model is null) + { + return null; } - return new EdgeClusterGpuCapacity(gpuType.Value, Optional.ToNullable(gpuUsedUnitsCount), Optional.ToNullable(gpuFreeUnitsCount), Optional.ToNullable(gpuReservedForFailoverUnitsCount), Optional.ToNullable(gpuTotalUnitsCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeClusterGpuCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeClusterGpuCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.cs index 70e7419d146f..6fbfe3f92fff 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterGpuCapacity.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Cluster GPU Data. public partial class EdgeClusterGpuCapacity { - /// Initializes a new instance of EdgeClusterGpuCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeClusterGpuCapacity() { } - /// Initializes a new instance of EdgeClusterGpuCapacity. + /// Initializes a new instance of . /// The cluster GPU Type. /// The used GPU units count in the cluster. /// The free GPU units count in the cluster. /// The GPU units count reserved for failover in the cluster. /// The total GPU units count in the cluster. - internal EdgeClusterGpuCapacity(string gpuType, int? gpuUsedUnitsCount, int? gpuFreeUnitsCount, int? gpuReservedForFailoverUnitsCount, int? gpuTotalUnitsCount) + /// Keeps track of any properties unknown to the library. + internal EdgeClusterGpuCapacity(string gpuType, int? gpuUsedUnitsCount, int? gpuFreeUnitsCount, int? gpuReservedForFailoverUnitsCount, int? gpuTotalUnitsCount, Dictionary serializedAdditionalRawData) { GpuType = gpuType; GpuUsedUnitsCount = gpuUsedUnitsCount; GpuFreeUnitsCount = gpuFreeUnitsCount; GpuReservedForFailoverUnitsCount = gpuReservedForFailoverUnitsCount; GpuTotalUnitsCount = gpuTotalUnitsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The cluster GPU Type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.Serialization.cs index c117ee35f3f4..ce92ade522b5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeClusterMemoryCapacity : IUtf8JsonSerializable + public partial class EdgeClusterMemoryCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClusterFreeMemoryInMB)) { @@ -60,11 +68,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clusterMemoryUsedByVmsMb"u8); writer.WriteNumberValue(ClusterMemoryUsedByVmsInMB.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeClusterMemoryCapacity DeserializeEdgeClusterMemoryCapacity(JsonElement element) + internal static EdgeClusterMemoryCapacity DeserializeEdgeClusterMemoryCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +100,7 @@ internal static EdgeClusterMemoryCapacity DeserializeEdgeClusterMemoryCapacity(J Optional clusterTotalMemoryMb = default; Optional clusterNonFailoverVmMb = default; Optional clusterMemoryUsedByVmsMb = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clusterFreeMemoryMb"u8)) @@ -161,8 +184,61 @@ internal static EdgeClusterMemoryCapacity DeserializeEdgeClusterMemoryCapacity(J clusterMemoryUsedByVmsMb = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeClusterMemoryCapacity(Optional.ToNullable(clusterFreeMemoryMb), Optional.ToNullable(clusterUsedMemoryMb), Optional.ToNullable(clusterFailoverMemoryMb), Optional.ToNullable(clusterFragmentationMemoryMb), Optional.ToNullable(clusterHyperVReserveMemoryMb), Optional.ToNullable(clusterInfraVmMemoryMb), Optional.ToNullable(clusterTotalMemoryMb), Optional.ToNullable(clusterNonFailoverVmMb), Optional.ToNullable(clusterMemoryUsedByVmsMb), serializedAdditionalRawData); + } + + EdgeClusterMemoryCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeClusterMemoryCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeClusterMemoryCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeClusterMemoryCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeClusterMemoryCapacity model) + { + if (model is null) + { + return null; } - return new EdgeClusterMemoryCapacity(Optional.ToNullable(clusterFreeMemoryMb), Optional.ToNullable(clusterUsedMemoryMb), Optional.ToNullable(clusterFailoverMemoryMb), Optional.ToNullable(clusterFragmentationMemoryMb), Optional.ToNullable(clusterHyperVReserveMemoryMb), Optional.ToNullable(clusterInfraVmMemoryMb), Optional.ToNullable(clusterTotalMemoryMb), Optional.ToNullable(clusterNonFailoverVmMb), Optional.ToNullable(clusterMemoryUsedByVmsMb)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeClusterMemoryCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeClusterMemoryCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.cs index caf7615d3e22..0322cb6d329b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterMemoryCapacity.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// NodeCapacityInfo defines the required information to determine the placement of a VM. public partial class EdgeClusterMemoryCapacity { - /// Initializes a new instance of EdgeClusterMemoryCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeClusterMemoryCapacity() { } - /// Initializes a new instance of EdgeClusterMemoryCapacity. + /// Initializes a new instance of . /// The free memory in the cluster in MB. /// The used memory in the cluster in MB. /// The failover memory in the cluster in MB. @@ -25,7 +31,8 @@ public EdgeClusterMemoryCapacity() /// The total memory in the cluster in MB. /// The non-failover memory in the cluster in MB. /// The memory used by VMs in the cluster in MB. - internal EdgeClusterMemoryCapacity(double? clusterFreeMemoryInMB, double? clusterUsedMemoryInMB, double? clusterFailoverMemoryInMB, double? clusterFragmentationMemoryInMB, double? clusterHyperVReserveMemoryMb, double? clusterInfraVmMemoryInMB, double? clusterTotalMemoryInMB, double? clusterNonFailoverVmInMB, double? clusterMemoryUsedByVmsInMB) + /// Keeps track of any properties unknown to the library. + internal EdgeClusterMemoryCapacity(double? clusterFreeMemoryInMB, double? clusterUsedMemoryInMB, double? clusterFailoverMemoryInMB, double? clusterFragmentationMemoryInMB, double? clusterHyperVReserveMemoryMb, double? clusterInfraVmMemoryInMB, double? clusterTotalMemoryInMB, double? clusterNonFailoverVmInMB, double? clusterMemoryUsedByVmsInMB, Dictionary serializedAdditionalRawData) { ClusterFreeMemoryInMB = clusterFreeMemoryInMB; ClusterUsedMemoryInMB = clusterUsedMemoryInMB; @@ -36,6 +43,7 @@ internal EdgeClusterMemoryCapacity(double? clusterFreeMemoryInMB, double? cluste ClusterTotalMemoryInMB = clusterTotalMemoryInMB; ClusterNonFailoverVmInMB = clusterNonFailoverVmInMB; ClusterMemoryUsedByVmsInMB = clusterMemoryUsedByVmsInMB; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The free memory in the cluster in MB. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.Serialization.cs index 018369bfbc59..ee40d25512a9 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeClusterStorageViewInfo : IUtf8JsonSerializable + public partial class EdgeClusterStorageViewInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ClusterTotalStorageInMB)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clusterFreeStorageMb"u8); writer.WriteNumberValue(ClusterFreeStorageInMB.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeClusterStorageViewInfo DeserializeEdgeClusterStorageViewInfo(JsonElement element) + internal static EdgeClusterStorageViewInfo DeserializeEdgeClusterStorageViewInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional clusterTotalStorageMb = default; Optional clusterFreeStorageMb = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clusterTotalStorageMb"u8)) @@ -56,8 +79,61 @@ internal static EdgeClusterStorageViewInfo DeserializeEdgeClusterStorageViewInfo clusterFreeStorageMb = property.Value.GetDouble(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeClusterStorageViewInfo(Optional.ToNullable(clusterTotalStorageMb), Optional.ToNullable(clusterFreeStorageMb), serializedAdditionalRawData); + } + + EdgeClusterStorageViewInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeClusterStorageViewInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeClusterStorageViewInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeClusterStorageViewInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeClusterStorageViewInfo model) + { + if (model is null) + { + return null; } - return new EdgeClusterStorageViewInfo(Optional.ToNullable(clusterTotalStorageMb), Optional.ToNullable(clusterFreeStorageMb)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeClusterStorageViewInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeClusterStorageViewInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.cs index 51ef115820f5..5d78ba149d5b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeClusterStorageViewInfo.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Cluster Storage Data. public partial class EdgeClusterStorageViewInfo { - /// Initializes a new instance of EdgeClusterStorageViewInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeClusterStorageViewInfo() { } - /// Initializes a new instance of EdgeClusterStorageViewInfo. + /// Initializes a new instance of . /// Total storage on the cluster in MB. /// The available or free storage on the cluster in MB. - internal EdgeClusterStorageViewInfo(double? clusterTotalStorageInMB, double? clusterFreeStorageInMB) + /// Keeps track of any properties unknown to the library. + internal EdgeClusterStorageViewInfo(double? clusterTotalStorageInMB, double? clusterFreeStorageInMB, Dictionary serializedAdditionalRawData) { ClusterTotalStorageInMB = clusterTotalStorageInMB; ClusterFreeStorageInMB = clusterFreeStorageInMB; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Total storage on the cluster in MB. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.Serialization.cs index 002c30acc526..4530de781b7d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeComputeResourceInfo : IUtf8JsonSerializable + public partial class EdgeComputeResourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("processorCount"u8); writer.WriteNumberValue(ProcessorCount); writer.WritePropertyName("memoryInGB"u8); writer.WriteNumberValue(MemoryInGB); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeComputeResourceInfo DeserializeEdgeComputeResourceInfo(JsonElement element) + internal static EdgeComputeResourceInfo DeserializeEdgeComputeResourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } int processorCount = default; long memoryInGB = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("processorCount"u8)) @@ -42,8 +65,61 @@ internal static EdgeComputeResourceInfo DeserializeEdgeComputeResourceInfo(JsonE memoryInGB = property.Value.GetInt64(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeComputeResourceInfo(processorCount, memoryInGB, serializedAdditionalRawData); + } + + EdgeComputeResourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeComputeResourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeComputeResourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeComputeResourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeComputeResourceInfo model) + { + if (model is null) + { + return null; } - return new EdgeComputeResourceInfo(processorCount, memoryInGB); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeComputeResourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeComputeResourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.cs index 7e486ecd9f82..b4a2ee7f9c5a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeComputeResourceInfo.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Compute infrastructure Resource. public partial class EdgeComputeResourceInfo { - /// Initializes a new instance of EdgeComputeResourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Processor count. /// Memory in GB. public EdgeComputeResourceInfo(int processorCount, long memoryInGB) @@ -19,6 +25,22 @@ public EdgeComputeResourceInfo(int processorCount, long memoryInGB) MemoryInGB = memoryInGB; } + /// Initializes a new instance of . + /// Processor count. + /// Memory in GB. + /// Keeps track of any properties unknown to the library. + internal EdgeComputeResourceInfo(int processorCount, long memoryInGB, Dictionary serializedAdditionalRawData) + { + ProcessorCount = processorCount; + MemoryInGB = memoryInGB; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EdgeComputeResourceInfo() + { + } + /// Processor count. public int ProcessorCount { get; set; } /// Memory in GB. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.Serialization.cs index 2bf610320955..0e128edf17dd 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.Serialization.cs @@ -5,36 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeFileEventTrigger : IUtf8JsonSerializable + public partial class EdgeFileEventTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("sourceInfo"u8); - writer.WriteObjectValue(SourceInfo); + if (SourceInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceInfo).Serialize(writer, options); + } writer.WritePropertyName("sinkInfo"u8); - writer.WriteObjectValue(SinkInfo); + if (SinkInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SinkInfo).Serialize(writer, options); + } if (Optional.IsDefined(CustomContextTag)) { writer.WritePropertyName("customContextTag"u8); writer.WriteStringValue(CustomContextTag); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeFileEventTrigger DeserializeEdgeFileEventTrigger(JsonElement element) + internal static EdgeFileEventTrigger DeserializeEdgeFileEventTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +83,7 @@ internal static EdgeFileEventTrigger DeserializeEdgeFileEventTrigger(JsonElement EdgeFileSourceInfo sourceInfo = default; DataBoxEdgeRoleSinkInfo sinkInfo = default; Optional customContextTag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -105,8 +142,61 @@ internal static EdgeFileEventTrigger DeserializeEdgeFileEventTrigger(JsonElement } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeFileEventTrigger(id, name, type, systemData.Value, kind, sourceInfo, sinkInfo, customContextTag.Value, serializedAdditionalRawData); + } + + EdgeFileEventTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeFileEventTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeFileEventTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeFileEventTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeFileEventTrigger model) + { + if (model is null) + { + return null; } - return new EdgeFileEventTrigger(id, name, type, systemData.Value, kind, sourceInfo, sinkInfo, customContextTag.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeFileEventTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeFileEventTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.cs index 051a7655e4b2..67646cebba80 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileEventTrigger.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -15,7 +16,7 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Trigger details. public partial class EdgeFileEventTrigger : DataBoxEdgeTriggerData { - /// Initializes a new instance of EdgeFileEventTrigger. + /// Initializes a new instance of . /// File event source details. /// Role sink info. /// or is null. @@ -29,7 +30,7 @@ public EdgeFileEventTrigger(EdgeFileSourceInfo sourceInfo, DataBoxEdgeRoleSinkIn Kind = TriggerEventType.FileEvent; } - /// Initializes a new instance of EdgeFileEventTrigger. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +39,8 @@ public EdgeFileEventTrigger(EdgeFileSourceInfo sourceInfo, DataBoxEdgeRoleSinkIn /// File event source details. /// Role sink info. /// A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - internal EdgeFileEventTrigger(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TriggerEventType kind, EdgeFileSourceInfo sourceInfo, DataBoxEdgeRoleSinkInfo sinkInfo, string customContextTag) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal EdgeFileEventTrigger(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TriggerEventType kind, EdgeFileSourceInfo sourceInfo, DataBoxEdgeRoleSinkInfo sinkInfo, string customContextTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { SourceInfo = sourceInfo; SinkInfo = sinkInfo; @@ -46,6 +48,11 @@ internal EdgeFileEventTrigger(ResourceIdentifier id, string name, ResourceType r Kind = kind; } + /// Initializes a new instance of for deserialization. + internal EdgeFileEventTrigger() + { + } + /// File event source details. internal EdgeFileSourceInfo SourceInfo { get; set; } /// File share ID. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.Serialization.cs index e416067b7099..41a33e9e264a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeFileSourceInfo : IUtf8JsonSerializable + public partial class EdgeFileSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("shareId"u8); writer.WriteStringValue(ShareId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeFileSourceInfo DeserializeEdgeFileSourceInfo(JsonElement element) + internal static EdgeFileSourceInfo DeserializeEdgeFileSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier shareId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shareId"u8)) @@ -34,8 +57,61 @@ internal static EdgeFileSourceInfo DeserializeEdgeFileSourceInfo(JsonElement ele shareId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeFileSourceInfo(shareId, serializedAdditionalRawData); + } + + EdgeFileSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeFileSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeFileSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeFileSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeFileSourceInfo model) + { + if (model is null) + { + return null; } - return new EdgeFileSourceInfo(shareId); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeFileSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeFileSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.cs index 1d24d6b03fd6..e373adf6b0b5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeFileSourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// File source details. public partial class EdgeFileSourceInfo { - /// Initializes a new instance of EdgeFileSourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// File share ID. /// is null. public EdgeFileSourceInfo(ResourceIdentifier shareId) @@ -23,6 +27,20 @@ public EdgeFileSourceInfo(ResourceIdentifier shareId) ShareId = shareId; } + /// Initializes a new instance of . + /// File share ID. + /// Keeps track of any properties unknown to the library. + internal EdgeFileSourceInfo(ResourceIdentifier shareId, Dictionary serializedAdditionalRawData) + { + ShareId = shareId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EdgeFileSourceInfo() + { + } + /// File share ID. public ResourceIdentifier ShareId { get; set; } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.Serialization.cs index 8fdaf19fa1f3..50af2ac95e78 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.Serialization.cs @@ -5,31 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeIotAddon : IUtf8JsonSerializable + public partial class EdgeIotAddon : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("ioTDeviceDetails"u8); - writer.WriteObjectValue(IotDeviceDetails); + if (IotDeviceDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IotDeviceDetails).Serialize(writer, options); + } writer.WritePropertyName("ioTEdgeDeviceDetails"u8); - writer.WriteObjectValue(IotEdgeDeviceDetails); + if (IotEdgeDeviceDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IotEdgeDeviceDetails).Serialize(writer, options); + } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeIotAddon DeserializeEdgeIotAddon(JsonElement element) + internal static EdgeIotAddon DeserializeEdgeIotAddon(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +81,7 @@ internal static EdgeIotAddon DeserializeEdgeIotAddon(JsonElement element) Optional hostPlatform = default; Optional hostPlatformType = default; Optional provisioningState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -130,8 +167,61 @@ internal static EdgeIotAddon DeserializeEdgeIotAddon(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeIotAddon(id, name, type, systemData.Value, kind, iotDeviceDetails, iotEdgeDeviceDetails, version.Value, Optional.ToNullable(hostPlatform), Optional.ToNullable(hostPlatformType), Optional.ToNullable(provisioningState), serializedAdditionalRawData); + } + + EdgeIotAddon IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeIotAddon(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeIotAddon IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeIotAddon(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeIotAddon model) + { + if (model is null) + { + return null; } - return new EdgeIotAddon(id, name, type, systemData.Value, kind, iotDeviceDetails, iotEdgeDeviceDetails, version.Value, Optional.ToNullable(hostPlatform), Optional.ToNullable(hostPlatformType), Optional.ToNullable(provisioningState)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeIotAddon(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeIotAddon(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.cs index 29795217ec12..c41c7730e22b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotAddon.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -15,7 +16,7 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// IoT Addon. public partial class EdgeIotAddon : DataBoxEdgeRoleAddonData { - /// Initializes a new instance of EdgeIotAddon. + /// Initializes a new instance of . /// IoT device metadata to which appliance needs to be connected. /// IoT edge device to which the IoT Addon needs to be configured. /// or is null. @@ -29,7 +30,7 @@ public EdgeIotAddon(EdgeIotDeviceInfo iotDeviceDetails, EdgeIotDeviceInfo iotEdg Kind = AddonType.IotEdge; } - /// Initializes a new instance of EdgeIotAddon. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +42,8 @@ public EdgeIotAddon(EdgeIotDeviceInfo iotDeviceDetails, EdgeIotDeviceInfo iotEdg /// Host OS supported by the IoT addon. /// Platform where the runtime is hosted. /// Addon Provisioning State. - internal EdgeIotAddon(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonType kind, EdgeIotDeviceInfo iotDeviceDetails, EdgeIotDeviceInfo iotEdgeDeviceDetails, string version, DataBoxEdgeOSPlatformType? hostPlatform, HostPlatformType? hostPlatformType, DataBoxEdgeRoleAddonProvisioningState? provisioningState) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal EdgeIotAddon(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonType kind, EdgeIotDeviceInfo iotDeviceDetails, EdgeIotDeviceInfo iotEdgeDeviceDetails, string version, DataBoxEdgeOSPlatformType? hostPlatform, HostPlatformType? hostPlatformType, DataBoxEdgeRoleAddonProvisioningState? provisioningState, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { IotDeviceDetails = iotDeviceDetails; IotEdgeDeviceDetails = iotEdgeDeviceDetails; @@ -52,6 +54,11 @@ internal EdgeIotAddon(ResourceIdentifier id, string name, ResourceType resourceT Kind = kind; } + /// Initializes a new instance of for deserialization. + internal EdgeIotAddon() + { + } + /// IoT device metadata to which appliance needs to be connected. public EdgeIotDeviceInfo IotDeviceDetails { get; set; } /// IoT edge device to which the IoT Addon needs to be configured. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.Serialization.cs index c12afe7da3b6..9ea621b51346 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeIotDeviceInfo : IUtf8JsonSerializable + public partial class EdgeIotDeviceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("deviceId"u8); writer.WriteStringValue(DeviceId); @@ -27,13 +35,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Authentication)) { writer.WritePropertyName("authentication"u8); - writer.WriteObjectValue(Authentication); + if (Authentication is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Authentication).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static EdgeIotDeviceInfo DeserializeEdgeIotDeviceInfo(JsonElement element) + internal static EdgeIotDeviceInfo DeserializeEdgeIotDeviceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static EdgeIotDeviceInfo DeserializeEdgeIotDeviceInfo(JsonElement eleme string iotHostHub = default; Optional iotHostHubId = default; Optional authentication = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("deviceId"u8)) @@ -72,8 +102,61 @@ internal static EdgeIotDeviceInfo DeserializeEdgeIotDeviceInfo(JsonElement eleme authentication = Authentication.DeserializeAuthentication(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeIotDeviceInfo(deviceId, iotHostHub, iotHostHubId.Value, authentication.Value, serializedAdditionalRawData); + } + + EdgeIotDeviceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeIotDeviceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeIotDeviceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeIotDeviceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeIotDeviceInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeIotDeviceInfo(Response response) + { + if (response is null) + { + return null; } - return new EdgeIotDeviceInfo(deviceId, iotHostHub, iotHostHubId.Value, authentication.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeIotDeviceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.cs index 5228b6ae309d..54e06edc8b0d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotDeviceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Metadata of IoT device/IoT Edge device to be configured. public partial class EdgeIotDeviceInfo { - /// Initializes a new instance of EdgeIotDeviceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// ID of the IoT device/edge device. /// Host name for the IoT hub associated to the device. /// or is null. @@ -26,17 +30,24 @@ public EdgeIotDeviceInfo(string deviceId, string iotHostHub) IotHostHub = iotHostHub; } - /// Initializes a new instance of EdgeIotDeviceInfo. + /// Initializes a new instance of . /// ID of the IoT device/edge device. /// Host name for the IoT hub associated to the device. /// Id for the IoT hub associated to the device. /// Encrypted IoT device/IoT edge device connection string. - internal EdgeIotDeviceInfo(string deviceId, string iotHostHub, ResourceIdentifier iotHostHubId, Authentication authentication) + /// Keeps track of any properties unknown to the library. + internal EdgeIotDeviceInfo(string deviceId, string iotHostHub, ResourceIdentifier iotHostHubId, Authentication authentication, Dictionary serializedAdditionalRawData) { DeviceId = deviceId; IotHostHub = iotHostHub; IotHostHubId = iotHostHubId; Authentication = authentication; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EdgeIotDeviceInfo() + { } /// ID of the IoT device/edge device. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.Serialization.cs index 15a1b8c49089..8c1e21c14e84 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeIotRole : IUtf8JsonSerializable + public partial class EdgeIotRole : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -29,12 +36,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IotDeviceDetails)) { writer.WritePropertyName("ioTDeviceDetails"u8); - writer.WriteObjectValue(IotDeviceDetails); + if (IotDeviceDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IotDeviceDetails).Serialize(writer, options); + } } if (Optional.IsDefined(IotEdgeDeviceDetails)) { writer.WritePropertyName("ioTEdgeDeviceDetails"u8); - writer.WriteObjectValue(IotEdgeDeviceDetails); + if (IotEdgeDeviceDetails is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IotEdgeDeviceDetails).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(ShareMappings)) { @@ -42,19 +63,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ShareMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(IotEdgeAgentInfo)) { writer.WritePropertyName("ioTEdgeAgentInfo"u8); - writer.WriteObjectValue(IotEdgeAgentInfo); + if (IotEdgeAgentInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IotEdgeAgentInfo).Serialize(writer, options); + } } if (Optional.IsDefined(ComputeResource)) { writer.WritePropertyName("computeResource"u8); - writer.WriteObjectValue(ComputeResource); + if (ComputeResource is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ComputeResource).Serialize(writer, options); + } } if (Optional.IsDefined(RoleStatus)) { @@ -62,11 +104,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RoleStatus.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeIotRole DeserializeEdgeIotRole(JsonElement element) + internal static EdgeIotRole DeserializeEdgeIotRole(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -84,6 +140,7 @@ internal static EdgeIotRole DeserializeEdgeIotRole(JsonElement element) Optional hostPlatformType = default; Optional computeResource = default; Optional roleStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -204,8 +261,61 @@ internal static EdgeIotRole DeserializeEdgeIotRole(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeIotRole(id, name, type, systemData.Value, kind, Optional.ToNullable(hostPlatform), iotDeviceDetails.Value, iotEdgeDeviceDetails.Value, Optional.ToList(shareMappings), iotEdgeAgentInfo.Value, Optional.ToNullable(hostPlatformType), computeResource.Value, Optional.ToNullable(roleStatus), serializedAdditionalRawData); + } + + EdgeIotRole IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeIotRole(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeIotRole IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeIotRole(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeIotRole model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeIotRole(Response response) + { + if (response is null) + { + return null; } - return new EdgeIotRole(id, name, type, systemData.Value, kind, Optional.ToNullable(hostPlatform), iotDeviceDetails.Value, iotEdgeDeviceDetails.Value, Optional.ToList(shareMappings), iotEdgeAgentInfo.Value, Optional.ToNullable(hostPlatformType), computeResource.Value, Optional.ToNullable(roleStatus)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeIotRole(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.cs index 91da8d724b36..b25525defc6f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeIotRole.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -15,14 +16,14 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Compute role. public partial class EdgeIotRole : DataBoxEdgeRoleData { - /// Initializes a new instance of EdgeIotRole. + /// Initializes a new instance of . public EdgeIotRole() { ShareMappings = new ChangeTrackingList(); Kind = DataBoxEdgeRoleType.IoT; } - /// Initializes a new instance of EdgeIotRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -36,7 +37,8 @@ public EdgeIotRole() /// Platform where the Iot runtime is hosted. /// Resource allocation. /// Role status. - internal EdgeIotRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, DataBoxEdgeOSPlatformType? hostPlatform, EdgeIotDeviceInfo iotDeviceDetails, EdgeIotDeviceInfo iotEdgeDeviceDetails, IList shareMappings, IotEdgeAgentInfo iotEdgeAgentInfo, HostPlatformType? hostPlatformType, EdgeComputeResourceInfo computeResource, DataBoxEdgeRoleStatus? roleStatus) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal EdgeIotRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, DataBoxEdgeOSPlatformType? hostPlatform, EdgeIotDeviceInfo iotDeviceDetails, EdgeIotDeviceInfo iotEdgeDeviceDetails, IList shareMappings, IotEdgeAgentInfo iotEdgeAgentInfo, HostPlatformType? hostPlatformType, EdgeComputeResourceInfo computeResource, DataBoxEdgeRoleStatus? roleStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { HostPlatform = hostPlatform; IotDeviceDetails = iotDeviceDetails; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.Serialization.cs index 10a206890064..89e725ceeaf1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.Serialization.cs @@ -5,24 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesClusterInfo : IUtf8JsonSerializable + public partial class EdgeKubernetesClusterInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeKubernetesClusterInfo DeserializeEdgeKubernetesClusterInfo(JsonElement element) + internal static EdgeKubernetesClusterInfo DeserializeEdgeKubernetesClusterInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +51,7 @@ internal static EdgeKubernetesClusterInfo DeserializeEdgeKubernetesClusterInfo(J Optional etcdInfo = default; Optional> nodes = default; string version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etcdInfo"u8)) @@ -60,8 +82,61 @@ internal static EdgeKubernetesClusterInfo DeserializeEdgeKubernetesClusterInfo(J version = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeKubernetesClusterInfo(etcdInfo.Value, Optional.ToList(nodes), version, serializedAdditionalRawData); + } + + EdgeKubernetesClusterInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesClusterInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesClusterInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesClusterInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesClusterInfo model) + { + if (model is null) + { + return null; } - return new EdgeKubernetesClusterInfo(etcdInfo.Value, Optional.ToList(nodes), version); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesClusterInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesClusterInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.cs index ad35c89266ab..acf8be1b129d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesClusterInfo.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Kubernetes cluster configuration. public partial class EdgeKubernetesClusterInfo { - /// Initializes a new instance of EdgeKubernetesClusterInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Kubernetes cluster version. /// is null. public EdgeKubernetesClusterInfo(string version) @@ -25,15 +28,22 @@ public EdgeKubernetesClusterInfo(string version) Version = version; } - /// Initializes a new instance of EdgeKubernetesClusterInfo. + /// Initializes a new instance of . /// Etcd configuration. /// Kubernetes cluster nodes. /// Kubernetes cluster version. - internal EdgeKubernetesClusterInfo(DataBoxEdgeEtcdInfo etcdInfo, IReadOnlyList nodes, string version) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesClusterInfo(DataBoxEdgeEtcdInfo etcdInfo, IReadOnlyList nodes, string version, Dictionary serializedAdditionalRawData) { EtcdInfo = etcdInfo; Nodes = nodes; Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EdgeKubernetesClusterInfo() + { } /// Etcd configuration. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.Serialization.cs index 168b2a87b131..24a96985bb76 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.Serialization.cs @@ -5,21 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesIPConfiguration + public partial class EdgeKubernetesIPConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgeKubernetesIPConfiguration DeserializeEdgeKubernetesIPConfiguration(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(IPAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IPAddress); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgeKubernetesIPConfiguration DeserializeEdgeKubernetesIPConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional port = default; Optional ipAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("port"u8)) @@ -32,8 +66,61 @@ internal static EdgeKubernetesIPConfiguration DeserializeEdgeKubernetesIPConfigu ipAddress = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EdgeKubernetesIPConfiguration(port.Value, ipAddress.Value); + return new EdgeKubernetesIPConfiguration(port.Value, ipAddress.Value, serializedAdditionalRawData); + } + + EdgeKubernetesIPConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesIPConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesIPConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesIPConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesIPConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesIPConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesIPConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.cs index 0fe95e5e9d06..c495af70c775 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesIPConfiguration.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Kubernetes node IP configuration. public partial class EdgeKubernetesIPConfiguration { - /// Initializes a new instance of EdgeKubernetesIPConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgeKubernetesIPConfiguration() { } - /// Initializes a new instance of EdgeKubernetesIPConfiguration. + /// Initializes a new instance of . /// Port of the Kubernetes node. /// IP address of the Kubernetes node. - internal EdgeKubernetesIPConfiguration(string port, string ipAddress) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesIPConfiguration(string port, string ipAddress, Dictionary serializedAdditionalRawData) { Port = port; IPAddress = ipAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Port of the Kubernetes node. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.Serialization.cs index a7380fd5a3ae..674c17dc5512 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.Serialization.cs @@ -5,16 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesNodeInfo + public partial class EdgeKubernetesNodeInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgeKubernetesNodeInfo DeserializeEdgeKubernetesNodeInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(IPConfiguration)) + { + writer.WritePropertyName("ipConfiguration"u8); + writer.WriteStartArray(); + foreach (var item in IPConfiguration) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgeKubernetesNodeInfo DeserializeEdgeKubernetesNodeInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +66,7 @@ internal static EdgeKubernetesNodeInfo DeserializeEdgeKubernetesNodeInfo(JsonEle Optional name = default; Optional type = default; Optional> ipConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -52,8 +97,61 @@ internal static EdgeKubernetesNodeInfo DeserializeEdgeKubernetesNodeInfo(JsonEle ipConfiguration = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EdgeKubernetesNodeInfo(name.Value, Optional.ToNullable(type), Optional.ToList(ipConfiguration)); + return new EdgeKubernetesNodeInfo(name.Value, Optional.ToNullable(type), Optional.ToList(ipConfiguration), serializedAdditionalRawData); + } + + EdgeKubernetesNodeInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesNodeInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesNodeInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesNodeInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesNodeInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesNodeInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesNodeInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.cs index 764241ec278c..3370b03bf9b7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesNodeInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,26 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Kubernetes node info. public partial class EdgeKubernetesNodeInfo { - /// Initializes a new instance of EdgeKubernetesNodeInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgeKubernetesNodeInfo() { IPConfiguration = new ChangeTrackingList(); } - /// Initializes a new instance of EdgeKubernetesNodeInfo. + /// Initializes a new instance of . /// Node name. /// Node type - Master/Worker. /// IP Configuration of the Kubernetes node. - internal EdgeKubernetesNodeInfo(string name, EdgeKubernetesNodeType? nodeType, IReadOnlyList ipConfiguration) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesNodeInfo(string name, EdgeKubernetesNodeType? nodeType, IReadOnlyList ipConfiguration, Dictionary serializedAdditionalRawData) { Name = name; NodeType = nodeType; IPConfiguration = ipConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Node name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.Serialization.cs index 5f6ec3b96688..0511c2ac1b54 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesRole : IUtf8JsonSerializable + public partial class EdgeKubernetesRole : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -28,12 +36,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(KubernetesClusterInfo)) { writer.WritePropertyName("kubernetesClusterInfo"u8); - writer.WriteObjectValue(KubernetesClusterInfo); + if (KubernetesClusterInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubernetesClusterInfo).Serialize(writer, options); + } } if (Optional.IsDefined(KubernetesRoleResources)) { writer.WritePropertyName("kubernetesRoleResources"u8); - writer.WriteObjectValue(KubernetesRoleResources); + if (KubernetesRoleResources is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)KubernetesRoleResources).Serialize(writer, options); + } } if (Optional.IsDefined(RoleStatus)) { @@ -41,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RoleStatus.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeKubernetesRole DeserializeEdgeKubernetesRole(JsonElement element) + internal static EdgeKubernetesRole DeserializeEdgeKubernetesRole(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +97,7 @@ internal static EdgeKubernetesRole DeserializeEdgeKubernetesRole(JsonElement ele Optional kubernetesClusterInfo = default; Optional kubernetesRoleResources = default; Optional roleStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -158,8 +195,61 @@ internal static EdgeKubernetesRole DeserializeEdgeKubernetesRole(JsonElement ele } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeKubernetesRole(id, name, type, systemData.Value, kind, Optional.ToNullable(hostPlatform), Optional.ToNullable(provisioningState), Optional.ToNullable(hostPlatformType), kubernetesClusterInfo.Value, kubernetesRoleResources.Value, Optional.ToNullable(roleStatus), serializedAdditionalRawData); + } + + EdgeKubernetesRole IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesRole(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesRole IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesRole(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesRole model) + { + if (model is null) + { + return null; } - return new EdgeKubernetesRole(id, name, type, systemData.Value, kind, Optional.ToNullable(hostPlatform), Optional.ToNullable(provisioningState), Optional.ToNullable(hostPlatformType), kubernetesClusterInfo.Value, kubernetesRoleResources.Value, Optional.ToNullable(roleStatus)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesRole(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesRole(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.cs index 03b135656cdb..3843bdd27ba4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRole.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -23,13 +25,13 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// public partial class EdgeKubernetesRole : DataBoxEdgeRoleData { - /// Initializes a new instance of EdgeKubernetesRole. + /// Initializes a new instance of . public EdgeKubernetesRole() { Kind = DataBoxEdgeRoleType.Kubernetes; } - /// Initializes a new instance of EdgeKubernetesRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -41,7 +43,8 @@ public EdgeKubernetesRole() /// Kubernetes cluster configuration. /// Kubernetes role resources. /// Role status. - internal EdgeKubernetesRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, DataBoxEdgeOSPlatformType? hostPlatform, EdgeKubernetesState? provisioningState, HostPlatformType? hostPlatformType, EdgeKubernetesClusterInfo kubernetesClusterInfo, EdgeKubernetesRoleResources kubernetesRoleResources, DataBoxEdgeRoleStatus? roleStatus) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, DataBoxEdgeOSPlatformType? hostPlatform, EdgeKubernetesState? provisioningState, HostPlatformType? hostPlatformType, EdgeKubernetesClusterInfo kubernetesClusterInfo, EdgeKubernetesRoleResources kubernetesRoleResources, DataBoxEdgeRoleStatus? roleStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { HostPlatform = hostPlatform; ProvisioningState = provisioningState; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.Serialization.cs index f882618a0113..575358efa1ad 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesRoleCompute : IUtf8JsonSerializable + public partial class EdgeKubernetesRoleCompute : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("vmProfile"u8); writer.WriteStringValue(VmProfile); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeKubernetesRoleCompute DeserializeEdgeKubernetesRoleCompute(JsonElement element) + internal static EdgeKubernetesRoleCompute DeserializeEdgeKubernetesRoleCompute(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -29,6 +51,7 @@ internal static EdgeKubernetesRoleCompute DeserializeEdgeKubernetesRoleCompute(J string vmProfile = default; Optional memoryInBytes = default; Optional processorCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmProfile"u8)) @@ -54,8 +77,61 @@ internal static EdgeKubernetesRoleCompute DeserializeEdgeKubernetesRoleCompute(J processorCount = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeKubernetesRoleCompute(vmProfile, Optional.ToNullable(memoryInBytes), Optional.ToNullable(processorCount), serializedAdditionalRawData); + } + + EdgeKubernetesRoleCompute IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesRoleCompute(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesRoleCompute IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesRoleCompute(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesRoleCompute model) + { + if (model is null) + { + return null; } - return new EdgeKubernetesRoleCompute(vmProfile, Optional.ToNullable(memoryInBytes), Optional.ToNullable(processorCount)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesRoleCompute(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesRoleCompute(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.cs index 702995b67aad..ddd75faddc2b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleCompute.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Kubernetes role compute resource. public partial class EdgeKubernetesRoleCompute { - /// Initializes a new instance of EdgeKubernetesRoleCompute. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// VM profile. /// is null. public EdgeKubernetesRoleCompute(string vmProfile) @@ -23,15 +27,22 @@ public EdgeKubernetesRoleCompute(string vmProfile) VmProfile = vmProfile; } - /// Initializes a new instance of EdgeKubernetesRoleCompute. + /// Initializes a new instance of . /// VM profile. /// Memory in bytes. /// Processor count. - internal EdgeKubernetesRoleCompute(string vmProfile, long? memoryInBytes, int? processorCount) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesRoleCompute(string vmProfile, long? memoryInBytes, int? processorCount, Dictionary serializedAdditionalRawData) { VmProfile = vmProfile; MemoryInBytes = memoryInBytes; ProcessorCount = processorCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EdgeKubernetesRoleCompute() + { } /// VM profile. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.Serialization.cs index d5e8a8663448..f7492b781f17 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesRoleNetwork + public partial class EdgeKubernetesRoleNetwork : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgeKubernetesRoleNetwork DeserializeEdgeKubernetesRoleNetwork(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgeKubernetesRoleNetwork DeserializeEdgeKubernetesRoleNetwork(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional cniConfig = default; Optional loadBalancerConfig = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cniConfig"u8)) @@ -40,8 +69,61 @@ internal static EdgeKubernetesRoleNetwork DeserializeEdgeKubernetesRoleNetwork(J loadBalancerConfig = DataBoxEdgeLoadBalancerConfig.DeserializeDataBoxEdgeLoadBalancerConfig(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EdgeKubernetesRoleNetwork(cniConfig.Value, loadBalancerConfig.Value); + return new EdgeKubernetesRoleNetwork(cniConfig.Value, loadBalancerConfig.Value, serializedAdditionalRawData); + } + + EdgeKubernetesRoleNetwork IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesRoleNetwork(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesRoleNetwork IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesRoleNetwork(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesRoleNetwork model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesRoleNetwork(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesRoleNetwork(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.cs index e3ad1976ff4f..41463fcdcc51 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleNetwork.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Kubernetes role network resource. public partial class EdgeKubernetesRoleNetwork { - /// Initializes a new instance of EdgeKubernetesRoleNetwork. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgeKubernetesRoleNetwork() { } - /// Initializes a new instance of EdgeKubernetesRoleNetwork. + /// Initializes a new instance of . /// Cni configuration. /// Load balancer configuration. - internal EdgeKubernetesRoleNetwork(CniConfig cniConfig, DataBoxEdgeLoadBalancerConfig loadBalancerConfig) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesRoleNetwork(CniConfig cniConfig, DataBoxEdgeLoadBalancerConfig loadBalancerConfig, Dictionary serializedAdditionalRawData) { CniConfig = cniConfig; LoadBalancerConfig = loadBalancerConfig; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Cni configuration. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.Serialization.cs index 9efb3fa79c0f..90e41779ff97 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.Serialization.cs @@ -5,28 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesRoleResources : IUtf8JsonSerializable + public partial class EdgeKubernetesRoleResources : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Storage)) { writer.WritePropertyName("storage"u8); - writer.WriteObjectValue(Storage); + if (Storage is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Storage).Serialize(writer, options); + } } writer.WritePropertyName("compute"u8); - writer.WriteObjectValue(Compute); + if (Compute is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compute).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeKubernetesRoleResources DeserializeEdgeKubernetesRoleResources(JsonElement element) + internal static EdgeKubernetesRoleResources DeserializeEdgeKubernetesRoleResources(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,6 +70,7 @@ internal static EdgeKubernetesRoleResources DeserializeEdgeKubernetesRoleResourc Optional storage = default; EdgeKubernetesRoleCompute compute = default; Optional network = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storage"u8)) @@ -59,8 +96,61 @@ internal static EdgeKubernetesRoleResources DeserializeEdgeKubernetesRoleResourc network = EdgeKubernetesRoleNetwork.DeserializeEdgeKubernetesRoleNetwork(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeKubernetesRoleResources(storage.Value, compute, network.Value, serializedAdditionalRawData); + } + + EdgeKubernetesRoleResources IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesRoleResources(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesRoleResources IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesRoleResources(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesRoleResources model) + { + if (model is null) + { + return null; } - return new EdgeKubernetesRoleResources(storage.Value, compute, network.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesRoleResources(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesRoleResources(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.cs index ef002ed6a931..75f537615bcd 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleResources.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Kubernetes role resources. public partial class EdgeKubernetesRoleResources { - /// Initializes a new instance of EdgeKubernetesRoleResources. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Kubernetes role compute resource. /// is null. public EdgeKubernetesRoleResources(EdgeKubernetesRoleCompute compute) @@ -23,15 +27,22 @@ public EdgeKubernetesRoleResources(EdgeKubernetesRoleCompute compute) Compute = compute; } - /// Initializes a new instance of EdgeKubernetesRoleResources. + /// Initializes a new instance of . /// Kubernetes role storage resource. /// Kubernetes role compute resource. /// Kubernetes role network resource. - internal EdgeKubernetesRoleResources(EdgeKubernetesRoleStorage storage, EdgeKubernetesRoleCompute compute, EdgeKubernetesRoleNetwork network) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesRoleResources(EdgeKubernetesRoleStorage storage, EdgeKubernetesRoleCompute compute, EdgeKubernetesRoleNetwork network, Dictionary serializedAdditionalRawData) { Storage = storage; Compute = compute; Network = network; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EdgeKubernetesRoleResources() + { } /// Kubernetes role storage resource. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.Serialization.cs index 3fa7840e3b16..7c0225a2c098 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesRoleStorage : IUtf8JsonSerializable + public partial class EdgeKubernetesRoleStorage : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Endpoints)) { @@ -22,21 +29,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Endpoints) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeKubernetesRoleStorage DeserializeEdgeKubernetesRoleStorage(JsonElement element) + internal static EdgeKubernetesRoleStorage DeserializeEdgeKubernetesRoleStorage(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> storageClasses = default; Optional> endpoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageClasses"u8)) @@ -67,8 +96,61 @@ internal static EdgeKubernetesRoleStorage DeserializeEdgeKubernetesRoleStorage(J endpoints = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeKubernetesRoleStorage(Optional.ToList(storageClasses), Optional.ToList(endpoints), serializedAdditionalRawData); + } + + EdgeKubernetesRoleStorage IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesRoleStorage(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesRoleStorage IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesRoleStorage(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesRoleStorage model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesRoleStorage(Response response) + { + if (response is null) + { + return null; } - return new EdgeKubernetesRoleStorage(Optional.ToList(storageClasses), Optional.ToList(endpoints)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesRoleStorage(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.cs index a4fde68034d4..a03a1bdf9243 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorage.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Kubernetes role storage resource. public partial class EdgeKubernetesRoleStorage { - /// Initializes a new instance of EdgeKubernetesRoleStorage. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeKubernetesRoleStorage() { StorageClasses = new ChangeTrackingList(); Endpoints = new ChangeTrackingList(); } - /// Initializes a new instance of EdgeKubernetesRoleStorage. + /// Initializes a new instance of . /// Kubernetes storage class info. /// Mount points of shares in role(s). - internal EdgeKubernetesRoleStorage(IReadOnlyList storageClasses, IList endpoints) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesRoleStorage(IReadOnlyList storageClasses, IList endpoints, Dictionary serializedAdditionalRawData) { StorageClasses = storageClasses; Endpoints = endpoints; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Kubernetes storage class info. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.Serialization.cs index 22c21059e7a4..450c61886aa3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeKubernetesRoleStorageClassInfo + public partial class EdgeKubernetesRoleStorageClassInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgeKubernetesRoleStorageClassInfo DeserializeEdgeKubernetesRoleStorageClassInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgeKubernetesRoleStorageClassInfo DeserializeEdgeKubernetesRoleStorageClassInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static EdgeKubernetesRoleStorageClassInfo DeserializeEdgeKubernetesRole Optional name = default; Optional type = default; Optional posixCompliant = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +71,61 @@ internal static EdgeKubernetesRoleStorageClassInfo DeserializeEdgeKubernetesRole posixCompliant = new PosixComplianceStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EdgeKubernetesRoleStorageClassInfo(name.Value, type.Value, Optional.ToNullable(posixCompliant)); + return new EdgeKubernetesRoleStorageClassInfo(name.Value, type.Value, Optional.ToNullable(posixCompliant), serializedAdditionalRawData); + } + + EdgeKubernetesRoleStorageClassInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeKubernetesRoleStorageClassInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeKubernetesRoleStorageClassInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeKubernetesRoleStorageClassInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeKubernetesRoleStorageClassInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeKubernetesRoleStorageClassInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeKubernetesRoleStorageClassInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.cs index 1db098b90ffb..7ecd947fad2e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeKubernetesRoleStorageClassInfo.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Kubernetes storage class info. public partial class EdgeKubernetesRoleStorageClassInfo { - /// Initializes a new instance of EdgeKubernetesRoleStorageClassInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgeKubernetesRoleStorageClassInfo() { } - /// Initializes a new instance of EdgeKubernetesRoleStorageClassInfo. + /// Initializes a new instance of . /// Storage class name. /// Storage class type. /// If provisioned storage is posix compliant. - internal EdgeKubernetesRoleStorageClassInfo(string name, string kubernetesRoleStorageClassInfoType, PosixComplianceStatus? posixCompliant) + /// Keeps track of any properties unknown to the library. + internal EdgeKubernetesRoleStorageClassInfo(string name, string kubernetesRoleStorageClassInfoType, PosixComplianceStatus? posixCompliant, Dictionary serializedAdditionalRawData) { Name = name; KubernetesRoleStorageClassInfoType = kubernetesRoleStorageClassInfoType; PosixCompliant = posixCompliant; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Storage class name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.Serialization.cs index 55552645963a..af24d276a35b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.Serialization.cs @@ -5,20 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class EdgeProfile + internal partial class EdgeProfile : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgeProfile DeserializeEdgeProfile(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Subscription)) + { + writer.WritePropertyName("subscription"u8); + if (Subscription is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Subscription).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgeProfile DeserializeEdgeProfile(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional subscription = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subscription"u8)) @@ -30,8 +71,61 @@ internal static EdgeProfile DeserializeEdgeProfile(JsonElement element) subscription = EdgeProfileSubscription.DeserializeEdgeProfileSubscription(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EdgeProfile(subscription.Value); + return new EdgeProfile(subscription.Value, serializedAdditionalRawData); + } + + EdgeProfile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeProfile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeProfile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeProfile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeProfile model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeProfile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeProfile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.cs index 32627dbf31c5..30fb715aa62c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfile.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Details about Edge Profile for the resource. internal partial class EdgeProfile { - /// Initializes a new instance of EdgeProfile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgeProfile() { } - /// Initializes a new instance of EdgeProfile. + /// Initializes a new instance of . /// Edge Profile Subscription. - internal EdgeProfile(EdgeProfileSubscription subscription) + /// Keeps track of any properties unknown to the library. + internal EdgeProfile(EdgeProfileSubscription subscription, Dictionary serializedAdditionalRawData) { Subscription = subscription; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Edge Profile Subscription. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.Serialization.cs index dbeccae50b2b..6fabae83e485 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.Serialization.cs @@ -5,22 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class EdgeProfilePatch : IUtf8JsonSerializable + internal partial class EdgeProfilePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Subscription)) { writer.WritePropertyName("subscription"u8); JsonSerializer.Serialize(writer, Subscription); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static EdgeProfilePatch DeserializeEdgeProfilePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional subscription = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscription"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscription = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeProfilePatch(subscription, serializedAdditionalRawData); + } + + EdgeProfilePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeProfilePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeProfilePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeProfilePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeProfilePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeProfilePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeProfilePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.cs index c6d62a440cc6..daca26c39255 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfilePatch.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,11 +15,23 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The Data Box Edge/Gateway Edge Profile patch. internal partial class EdgeProfilePatch { - /// Initializes a new instance of EdgeProfilePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeProfilePatch() { } + /// Initializes a new instance of . + /// The Data Box Edge/Gateway Edge Profile Subscription patch. + /// Keeps track of any properties unknown to the library. + internal EdgeProfilePatch(WritableSubResource subscription, Dictionary serializedAdditionalRawData) + { + Subscription = subscription; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The Data Box Edge/Gateway Edge Profile Subscription patch. internal WritableSubResource Subscription { get; set; } /// Gets or sets Id. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.Serialization.cs index 0a71e82ba3fe..3f30b1afa519 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.Serialization.cs @@ -8,14 +8,105 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeProfileSubscription + public partial class EdgeProfileSubscription : IUtf8JsonSerializable, IModelJsonSerializable { - internal static EdgeProfileSubscription DeserializeEdgeProfileSubscription(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(RegistrationId)) + { + writer.WritePropertyName("registrationId"u8); + writer.WriteStringValue(RegistrationId.Value); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(RegistrationDate)) + { + writer.WritePropertyName("registrationDate"u8); + writer.WriteStringValue(RegistrationDate); + } + if (Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId.Value); + } + if (Optional.IsDefined(LocationPlacementId)) + { + writer.WritePropertyName("locationPlacementId"u8); + writer.WriteStringValue(LocationPlacementId); + } + if (Optional.IsDefined(QuotaId)) + { + writer.WritePropertyName("quotaId"u8); + writer.WriteStringValue(QuotaId); + } + if (Optional.IsDefined(SerializedDetails)) + { + writer.WritePropertyName("serializedDetails"u8); + writer.WriteStringValue(SerializedDetails); + } + if (Optional.IsCollectionDefined(RegisteredFeatures)) + { + writer.WritePropertyName("registeredFeatures"u8); + writer.WriteStartArray(); + foreach (var item in RegisteredFeatures) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static EdgeProfileSubscription DeserializeEdgeProfileSubscription(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -30,6 +121,7 @@ internal static EdgeProfileSubscription DeserializeEdgeProfileSubscription(JsonE Optional quotaId = default; Optional serializedDetails = default; Optional> registeredFeatures = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("registrationId"u8)) @@ -119,8 +211,61 @@ internal static EdgeProfileSubscription DeserializeEdgeProfileSubscription(JsonE } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeProfileSubscription(Optional.ToNullable(registrationId), id.Value, Optional.ToNullable(state), registrationDate.Value, subscriptionId.Value, Optional.ToNullable(tenantId), locationPlacementId.Value, quotaId.Value, serializedDetails.Value, Optional.ToList(registeredFeatures), serializedAdditionalRawData); + } + + EdgeProfileSubscription IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeProfileSubscription(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeProfileSubscription IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeProfileSubscription(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeProfileSubscription model) + { + if (model is null) + { + return null; } - return new EdgeProfileSubscription(Optional.ToNullable(registrationId), id.Value, Optional.ToNullable(state), registrationDate.Value, subscriptionId.Value, Optional.ToNullable(tenantId), locationPlacementId.Value, quotaId.Value, serializedDetails.Value, Optional.ToList(registeredFeatures)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeProfileSubscription(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeProfileSubscription(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.cs index 1d7775e7501d..9e73347bbdad 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeProfileSubscription.cs @@ -14,13 +14,16 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Subscription details for the Edge Profile. public partial class EdgeProfileSubscription { - /// Initializes a new instance of EdgeProfileSubscription. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal EdgeProfileSubscription() { RegisteredFeatures = new ChangeTrackingList(); } - /// Initializes a new instance of EdgeProfileSubscription. + /// Initializes a new instance of . /// Edge Subscription Registration ID. /// ARM ID of the subscription. /// @@ -31,7 +34,8 @@ internal EdgeProfileSubscription() /// /// /// - internal EdgeProfileSubscription(Guid? registrationId, ResourceIdentifier id, DataBoxEdgeSubscriptionState? state, string registrationDate, string subscriptionId, Guid? tenantId, string locationPlacementId, string quotaId, string serializedDetails, IReadOnlyList registeredFeatures) + /// Keeps track of any properties unknown to the library. + internal EdgeProfileSubscription(Guid? registrationId, ResourceIdentifier id, DataBoxEdgeSubscriptionState? state, string registrationDate, string subscriptionId, Guid? tenantId, string locationPlacementId, string quotaId, string serializedDetails, IReadOnlyList registeredFeatures, Dictionary serializedAdditionalRawData) { RegistrationId = registrationId; Id = id; @@ -43,6 +47,7 @@ internal EdgeProfileSubscription(Guid? registrationId, ResourceIdentifier id, Da QuotaId = quotaId; SerializedDetails = serializedDetails; RegisteredFeatures = registeredFeatures; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Edge Subscription Registration ID. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.Serialization.cs index 73e25de05332..2177f2ad10d7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class EdgeRemoteSupportSettings : IUtf8JsonSerializable + public partial class EdgeRemoteSupportSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RemoteApplicationType)) { @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expirationTimeStampInUTC"u8); writer.WriteStringValue(ExpireOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EdgeRemoteSupportSettings DeserializeEdgeRemoteSupportSettings(JsonElement element) + internal static EdgeRemoteSupportSettings DeserializeEdgeRemoteSupportSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +64,7 @@ internal static EdgeRemoteSupportSettings DeserializeEdgeRemoteSupportSettings(J Optional remoteApplicationType = default; Optional accessLevel = default; Optional expirationTimeStampInUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("remoteApplicationType"u8)) @@ -72,8 +94,61 @@ internal static EdgeRemoteSupportSettings DeserializeEdgeRemoteSupportSettings(J expirationTimeStampInUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EdgeRemoteSupportSettings(Optional.ToNullable(remoteApplicationType), Optional.ToNullable(accessLevel), Optional.ToNullable(expirationTimeStampInUtc), serializedAdditionalRawData); + } + + EdgeRemoteSupportSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEdgeRemoteSupportSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EdgeRemoteSupportSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEdgeRemoteSupportSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EdgeRemoteSupportSettings model) + { + if (model is null) + { + return null; } - return new EdgeRemoteSupportSettings(Optional.ToNullable(remoteApplicationType), Optional.ToNullable(accessLevel), Optional.ToNullable(expirationTimeStampInUtc)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EdgeRemoteSupportSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEdgeRemoteSupportSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.cs index 843f7a5daeeb..41e46ea6d6c8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/EdgeRemoteSupportSettings.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBoxEdge.Models { /// RemoteApplicationType for which remote support settings is being modified. public partial class EdgeRemoteSupportSettings { - /// Initializes a new instance of EdgeRemoteSupportSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EdgeRemoteSupportSettings() { } - /// Initializes a new instance of EdgeRemoteSupportSettings. + /// Initializes a new instance of . /// Remote application type. /// Access level allowed for this remote application type. /// Expiration time stamp. - internal EdgeRemoteSupportSettings(EdgeRemoteApplicationType? remoteApplicationType, EdgeRemoteApplicationAccessLevel? accessLevel, DateTimeOffset? expireOn) + /// Keeps track of any properties unknown to the library. + internal EdgeRemoteSupportSettings(EdgeRemoteApplicationType? remoteApplicationType, EdgeRemoteApplicationAccessLevel? accessLevel, DateTimeOffset? expireOn, Dictionary serializedAdditionalRawData) { RemoteApplicationType = remoteApplicationType; AccessLevel = accessLevel; ExpireOn = expireOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Remote application type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.Serialization.cs index 6b43e19101f2..427e5bffa537 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.Serialization.cs @@ -6,15 +6,57 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class GenerateCertResult + public partial class GenerateCertResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GenerateCertResult DeserializeGenerateCertResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(PublicKey)) + { + writer.WritePropertyName("publicKey"u8); + writer.WriteStringValue(PublicKey); + } + if (Optional.IsDefined(PrivateKey)) + { + writer.WritePropertyName("privateKey"u8); + writer.WriteStringValue(PrivateKey); + } + if (Optional.IsDefined(ExpireOn)) + { + writer.WritePropertyName("expiryTimeInUTC"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GenerateCertResult DeserializeGenerateCertResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +64,7 @@ internal static GenerateCertResult DeserializeGenerateCertResult(JsonElement ele Optional publicKey = default; Optional privateKey = default; Optional expiryTimeInUtc = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publicKey"u8)) @@ -43,8 +86,61 @@ internal static GenerateCertResult DeserializeGenerateCertResult(JsonElement ele expiryTimeInUtc = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GenerateCertResult(publicKey.Value, privateKey.Value, Optional.ToNullable(expiryTimeInUtc)); + return new GenerateCertResult(publicKey.Value, privateKey.Value, Optional.ToNullable(expiryTimeInUtc), serializedAdditionalRawData); + } + + GenerateCertResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGenerateCertResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GenerateCertResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGenerateCertResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GenerateCertResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GenerateCertResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGenerateCertResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.cs index 52aaf02bb488..df4a657bebfa 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/GenerateCertResult.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBoxEdge.Models { /// Used in activation key generation flow. public partial class GenerateCertResult { - /// Initializes a new instance of GenerateCertResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GenerateCertResult() { } - /// Initializes a new instance of GenerateCertResult. + /// Initializes a new instance of . /// /// Gets or sets base64 encoded certificate raw data, /// this is the public part needed to be uploaded to cert vault @@ -27,11 +31,13 @@ internal GenerateCertResult() /// needed to form the activation key /// /// Gets or sets expiry time in UTC. - internal GenerateCertResult(string publicKey, string privateKey, DateTimeOffset? expireOn) + /// Keeps track of any properties unknown to the library. + internal GenerateCertResult(string publicKey, string privateKey, DateTimeOffset? expireOn, Dictionary serializedAdditionalRawData) { PublicKey = publicKey; PrivateKey = privateKey; ExpireOn = expireOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.Serialization.cs index 7256ed8b8a9c..99a134663f27 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class HostCapacity : IUtf8JsonSerializable + public partial class HostCapacity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HostName)) { @@ -38,7 +45,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in VmUsedMemory) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -53,15 +67,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in NumaNodesData) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static HostCapacity DeserializeHostCapacity(JsonElement element) + internal static HostCapacity DeserializeHostCapacity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -72,6 +107,7 @@ internal static HostCapacity DeserializeHostCapacity(JsonElement element) Optional> vmUsedMemory = default; Optional gpuType = default; Optional> numaNodesData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hostName"u8)) @@ -130,8 +166,61 @@ internal static HostCapacity DeserializeHostCapacity(JsonElement element) numaNodesData = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new HostCapacity(hostName.Value, Optional.ToNullable(effectiveAvailableMemoryMbOnHost), Optional.ToNullable(availableGpuCount), Optional.ToDictionary(vmUsedMemory), gpuType.Value, Optional.ToList(numaNodesData), serializedAdditionalRawData); + } + + HostCapacity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHostCapacity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HostCapacity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHostCapacity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HostCapacity model) + { + if (model is null) + { + return null; } - return new HostCapacity(hostName.Value, Optional.ToNullable(effectiveAvailableMemoryMbOnHost), Optional.ToNullable(availableGpuCount), Optional.ToDictionary(vmUsedMemory), gpuType.Value, Optional.ToList(numaNodesData)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HostCapacity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHostCapacity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.cs index cff732392b9d..408a3fe7790c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/HostCapacity.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,21 +14,25 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Host Capacity Data. public partial class HostCapacity { - /// Initializes a new instance of HostCapacity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public HostCapacity() { VmUsedMemory = new ChangeTrackingDictionary(); NumaNodesData = new ChangeTrackingList(); } - /// Initializes a new instance of HostCapacity. + /// Initializes a new instance of . /// The name of the host. /// The available memory on the host accounting for VM placement size and any host VM reservations. /// The available amount of GPUs on the host to use after accounting for GPUS used by reservations on the host. /// The VM used memory per VmId. /// The GPU type of the VM. /// The numa nodes information for Hpn VMs. - internal HostCapacity(string hostName, long? effectiveAvailableMemoryInMBOnHost, int? availableGpuCount, IDictionary vmUsedMemory, string gpuType, IList numaNodesData) + /// Keeps track of any properties unknown to the library. + internal HostCapacity(string hostName, long? effectiveAvailableMemoryInMBOnHost, int? availableGpuCount, IDictionary vmUsedMemory, string gpuType, IList numaNodesData, Dictionary serializedAdditionalRawData) { HostName = hostName; EffectiveAvailableMemoryInMBOnHost = effectiveAvailableMemoryInMBOnHost; @@ -35,6 +40,7 @@ internal HostCapacity(string hostName, long? effectiveAvailableMemoryInMBOnHost, VmUsedMemory = vmUsedMemory; GpuType = gpuType; NumaNodesData = numaNodesData; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the host. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.Serialization.cs index 4fba027fd07c..462b4b05b5a2 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class ImageRepositoryCredential : IUtf8JsonSerializable + public partial class ImageRepositoryCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("imageRepositoryUrl"u8); writer.WriteStringValue(ImageRepositoryUri.AbsoluteUri); @@ -23,13 +30,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Password)) { writer.WritePropertyName("password"u8); - writer.WriteObjectValue(Password); + if (Password is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Password).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ImageRepositoryCredential DeserializeImageRepositoryCredential(JsonElement element) + internal static ImageRepositoryCredential DeserializeImageRepositoryCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +65,7 @@ internal static ImageRepositoryCredential DeserializeImageRepositoryCredential(J Uri imageRepositoryUrl = default; string userName = default; Optional password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageRepositoryUrl"u8)) @@ -58,8 +87,61 @@ internal static ImageRepositoryCredential DeserializeImageRepositoryCredential(J password = AsymmetricEncryptedSecret.DeserializeAsymmetricEncryptedSecret(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ImageRepositoryCredential(imageRepositoryUrl, userName, password.Value, serializedAdditionalRawData); + } + + ImageRepositoryCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImageRepositoryCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImageRepositoryCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImageRepositoryCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImageRepositoryCredential model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImageRepositoryCredential(Response response) + { + if (response is null) + { + return null; } - return new ImageRepositoryCredential(imageRepositoryUrl, userName, password.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImageRepositoryCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.cs index e8455011d7eb..b2b675f62f19 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ImageRepositoryCredential.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Image repository credential. public partial class ImageRepositoryCredential { - /// Initializes a new instance of ImageRepositoryCredential. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Image repository url (e.g.: mcr.microsoft.com). /// Repository user name. /// or is null. @@ -26,15 +30,22 @@ public ImageRepositoryCredential(Uri imageRepositoryUri, string userName) UserName = userName; } - /// Initializes a new instance of ImageRepositoryCredential. + /// Initializes a new instance of . /// Image repository url (e.g.: mcr.microsoft.com). /// Repository user name. /// Repository user password. - internal ImageRepositoryCredential(Uri imageRepositoryUri, string userName, AsymmetricEncryptedSecret password) + /// Keeps track of any properties unknown to the library. + internal ImageRepositoryCredential(Uri imageRepositoryUri, string userName, AsymmetricEncryptedSecret password, Dictionary serializedAdditionalRawData) { ImageRepositoryUri = imageRepositoryUri; UserName = userName; Password = password; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImageRepositoryCredential() + { } /// Image repository url (e.g.: mcr.microsoft.com). diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.Serialization.cs index eefe3ea4d7d0..3579333fc547 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class IotEdgeAgentInfo : IUtf8JsonSerializable + public partial class IotEdgeAgentInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("imageName"u8); writer.WriteStringValue(ImageName); @@ -22,13 +30,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ImageRepository)) { writer.WritePropertyName("imageRepository"u8); - writer.WriteObjectValue(ImageRepository); + if (ImageRepository is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImageRepository).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static IotEdgeAgentInfo DeserializeIotEdgeAgentInfo(JsonElement element) + internal static IotEdgeAgentInfo DeserializeIotEdgeAgentInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static IotEdgeAgentInfo DeserializeIotEdgeAgentInfo(JsonElement element string imageName = default; string tag = default; Optional imageRepository = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("imageName"u8)) @@ -57,8 +87,61 @@ internal static IotEdgeAgentInfo DeserializeIotEdgeAgentInfo(JsonElement element imageRepository = ImageRepositoryCredential.DeserializeImageRepositoryCredential(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IotEdgeAgentInfo(imageName, tag, imageRepository.Value, serializedAdditionalRawData); + } + + IotEdgeAgentInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIotEdgeAgentInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IotEdgeAgentInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIotEdgeAgentInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IotEdgeAgentInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IotEdgeAgentInfo(Response response) + { + if (response is null) + { + return null; } - return new IotEdgeAgentInfo(imageName, tag, imageRepository.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIotEdgeAgentInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.cs index 8b621504bc6c..fb1f6e717ade 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/IotEdgeAgentInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// IoT edge agent details is optional, this will be used for download system Agent module while bootstrapping IoT Role if specified. public partial class IotEdgeAgentInfo { - /// Initializes a new instance of IotEdgeAgentInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the IoT edge agent image. /// Image Tag. /// or is null. @@ -26,15 +30,22 @@ public IotEdgeAgentInfo(string imageName, string tag) Tag = tag; } - /// Initializes a new instance of IotEdgeAgentInfo. + /// Initializes a new instance of . /// Name of the IoT edge agent image. /// Image Tag. /// Image repository details. - internal IotEdgeAgentInfo(string imageName, string tag, ImageRepositoryCredential imageRepository) + /// Keeps track of any properties unknown to the library. + internal IotEdgeAgentInfo(string imageName, string tag, ImageRepositoryCredential imageRepository, Dictionary serializedAdditionalRawData) { ImageName = imageName; Tag = tag; ImageRepository = imageRepository; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IotEdgeAgentInfo() + { } /// Name of the IoT edge agent image. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.Serialization.cs index c088827c3b00..22582f1b30f1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class MecRole : IUtf8JsonSerializable + public partial class MecRole : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionString)) { writer.WritePropertyName("connectionString"u8); - writer.WriteObjectValue(ConnectionString); + if (ConnectionString is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionString).Serialize(writer, options); + } } if (Optional.IsDefined(ControllerEndpoint)) { @@ -41,11 +56,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(RoleStatus.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MecRole DeserializeMecRole(JsonElement element) + internal static MecRole DeserializeMecRole(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +88,7 @@ internal static MecRole DeserializeMecRole(JsonElement element) Optional controllerEndpoint = default; Optional resourceUniqueId = default; Optional roleStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -130,8 +160,61 @@ internal static MecRole DeserializeMecRole(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MecRole(id, name, type, systemData.Value, kind, connectionString.Value, controllerEndpoint.Value, resourceUniqueId.Value, Optional.ToNullable(roleStatus), serializedAdditionalRawData); + } + + MecRole IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMecRole(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MecRole IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMecRole(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MecRole model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MecRole(Response response) + { + if (response is null) + { + return null; } - return new MecRole(id, name, type, systemData.Value, kind, connectionString.Value, controllerEndpoint.Value, resourceUniqueId.Value, Optional.ToNullable(roleStatus)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMecRole(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.cs index f81fe68aeb3f..79f0726cbbc4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MecRole.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -14,13 +16,13 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// MEC role. public partial class MecRole : DataBoxEdgeRoleData { - /// Initializes a new instance of MecRole. + /// Initializes a new instance of . public MecRole() { Kind = DataBoxEdgeRoleType.Mec; } - /// Initializes a new instance of MecRole. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -30,7 +32,8 @@ public MecRole() /// Controller Endpoint. /// Unique Id of the Resource. /// Role status. - internal MecRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, AsymmetricEncryptedSecret connectionString, string controllerEndpoint, string resourceUniqueId, DataBoxEdgeRoleStatus? roleStatus) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal MecRole(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataBoxEdgeRoleType kind, AsymmetricEncryptedSecret connectionString, string controllerEndpoint, string resourceUniqueId, DataBoxEdgeRoleStatus? roleStatus, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { ConnectionString = connectionString; ControllerEndpoint = controllerEndpoint; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationData.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationData.Serialization.cs index fa2532e391b1..35c2a0691003 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationData.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationData.Serialization.cs @@ -5,18 +5,25 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge { - public partial class MonitoringMetricConfigurationData : IUtf8JsonSerializable + public partial class MonitoringMetricConfigurationData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -24,15 +31,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MetricConfigurations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MonitoringMetricConfigurationData DeserializeMonitoringMetricConfigurationData(JsonElement element) + internal static MonitoringMetricConfigurationData DeserializeMonitoringMetricConfigurationData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +70,7 @@ internal static MonitoringMetricConfigurationData DeserializeMonitoringMetricCon ResourceType type = default; Optional systemData = default; IList metricConfigurations = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -90,8 +119,61 @@ internal static MonitoringMetricConfigurationData DeserializeMonitoringMetricCon } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MonitoringMetricConfigurationData(id, name, type, systemData.Value, metricConfigurations, serializedAdditionalRawData); + } + + MonitoringMetricConfigurationData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoringMetricConfigurationData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoringMetricConfigurationData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoringMetricConfigurationData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoringMetricConfigurationData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoringMetricConfigurationData(Response response) + { + if (response is null) + { + return null; } - return new MonitoringMetricConfigurationData(id, name, type, systemData.Value, metricConfigurations); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoringMetricConfigurationData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.Serialization.cs index 3ffc25f13d2d..2f8ef90a0052 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class MonitoringMetricConfigurationList + internal partial class MonitoringMetricConfigurationList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MonitoringMetricConfigurationList DeserializeMonitoringMetricConfigurationList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MonitoringMetricConfigurationList DeserializeMonitoringMetricConfigurationList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static MonitoringMetricConfigurationList DeserializeMonitoringMetricCon nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MonitoringMetricConfigurationList(Optional.ToList(value), nextLink.Value); + return new MonitoringMetricConfigurationList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MonitoringMetricConfigurationList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoringMetricConfigurationList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoringMetricConfigurationList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoringMetricConfigurationList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoringMetricConfigurationList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoringMetricConfigurationList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoringMetricConfigurationList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.cs index 8717cc10a826..0b17844a4703 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/MonitoringMetricConfigurationList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of metric configurations. internal partial class MonitoringMetricConfigurationList { - /// Initializes a new instance of MonitoringMetricConfigurationList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MonitoringMetricConfigurationList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MonitoringMetricConfigurationList. + /// Initializes a new instance of . /// The list of metric configurations. /// Link to the next set of results. - internal MonitoringMetricConfigurationList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MonitoringMetricConfigurationList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of metric configurations. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.Serialization.cs index 3e762f95286b..4a87d7e26371 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class NumaNodeInfo : IUtf8JsonSerializable + public partial class NumaNodeInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NumaNodeIndex)) { @@ -66,11 +73,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NumaNodeInfo DeserializeNumaNodeInfo(JsonElement element) + internal static NumaNodeInfo DeserializeNumaNodeInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -82,6 +103,7 @@ internal static NumaNodeInfo DeserializeNumaNodeInfo(JsonElement element) Optional> freeVCpuIndexesForHpn = default; Optional> vCpuIndexesForHpn = default; Optional> vCpuIndexesForRoot = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("numaNodeIndex"u8)) @@ -162,8 +184,61 @@ internal static NumaNodeInfo DeserializeNumaNodeInfo(JsonElement element) vCpuIndexesForRoot = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NumaNodeInfo(Optional.ToNullable(numaNodeIndex), Optional.ToNullable(totalMemoryInMb), Optional.ToNullable(logicalCoreCountPerCore), Optional.ToNullable(effectiveAvailableMemoryInMb), Optional.ToList(freeVCpuIndexesForHpn), Optional.ToList(vCpuIndexesForHpn), Optional.ToList(vCpuIndexesForRoot), serializedAdditionalRawData); + } + + NumaNodeInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNumaNodeInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NumaNodeInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNumaNodeInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NumaNodeInfo model) + { + if (model is null) + { + return null; } - return new NumaNodeInfo(Optional.ToNullable(numaNodeIndex), Optional.ToNullable(totalMemoryInMb), Optional.ToNullable(logicalCoreCountPerCore), Optional.ToNullable(effectiveAvailableMemoryInMb), Optional.ToList(freeVCpuIndexesForHpn), Optional.ToList(vCpuIndexesForHpn), Optional.ToList(vCpuIndexesForRoot)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NumaNodeInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNumaNodeInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.cs index 945e68be901b..75ca706a795b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/NumaNodeInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// NUMA node data. public partial class NumaNodeInfo { - /// Initializes a new instance of NumaNodeInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NumaNodeInfo() { FreeVCpuIndexesForHpn = new ChangeTrackingList(); @@ -21,7 +25,7 @@ public NumaNodeInfo() VCpuIndexesForRoot = new ChangeTrackingList(); } - /// Initializes a new instance of NumaNodeInfo. + /// Initializes a new instance of . /// The NUMA node index. /// The total memory on the NUMA node. /// The logical cores per core count. @@ -29,7 +33,8 @@ public NumaNodeInfo() /// The free VCPU indices for the Hpn VMs. /// The VCPU indices for Hpn VMs. /// The VCPU indices for the root. - internal NumaNodeInfo(int? numaNodeIndex, long? totalMemoryInMB, int? logicalCoreCountPerCore, long? effectiveAvailableMemoryInMB, IList freeVCpuIndexesForHpn, IList vCpuIndexesForHpn, IList vCpuIndexesForRoot) + /// Keeps track of any properties unknown to the library. + internal NumaNodeInfo(int? numaNodeIndex, long? totalMemoryInMB, int? logicalCoreCountPerCore, long? effectiveAvailableMemoryInMB, IList freeVCpuIndexesForHpn, IList vCpuIndexesForHpn, IList vCpuIndexesForRoot, Dictionary serializedAdditionalRawData) { NumaNodeIndex = numaNodeIndex; TotalMemoryInMB = totalMemoryInMB; @@ -38,6 +43,7 @@ internal NumaNodeInfo(int? numaNodeIndex, long? totalMemoryInMB, int? logicalCor FreeVCpuIndexesForHpn = freeVCpuIndexesForHpn; VCpuIndexesForHpn = vCpuIndexesForHpn; VCpuIndexesForRoot = vCpuIndexesForRoot; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The NUMA node index. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.Serialization.cs index 5b4f9435f401..31c06adee9cd 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class OrderList + internal partial class OrderList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static OrderList DeserializeOrderList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static OrderList DeserializeOrderList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static OrderList DeserializeOrderList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OrderList(Optional.ToList(value), nextLink.Value); + return new OrderList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + OrderList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrderList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrderList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrderList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrderList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrderList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrderList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.cs index 01ce35b2eb93..42253c4c5e8a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/OrderList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// List of order entities. internal partial class OrderList { - /// Initializes a new instance of OrderList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal OrderList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of OrderList. + /// Initializes a new instance of . /// The list of orders. /// Link to the next set of results. - internal OrderList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal OrderList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of orders. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.Serialization.cs index a379d31b0b49..801036908752 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.Serialization.cs @@ -5,36 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class PeriodicTimerEventTrigger : IUtf8JsonSerializable + public partial class PeriodicTimerEventTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("sourceInfo"u8); - writer.WriteObjectValue(SourceInfo); + if (SourceInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceInfo).Serialize(writer, options); + } writer.WritePropertyName("sinkInfo"u8); - writer.WriteObjectValue(SinkInfo); + if (SinkInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SinkInfo).Serialize(writer, options); + } if (Optional.IsDefined(CustomContextTag)) { writer.WritePropertyName("customContextTag"u8); writer.WriteStringValue(CustomContextTag); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PeriodicTimerEventTrigger DeserializePeriodicTimerEventTrigger(JsonElement element) + internal static PeriodicTimerEventTrigger DeserializePeriodicTimerEventTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -47,6 +83,7 @@ internal static PeriodicTimerEventTrigger DeserializePeriodicTimerEventTrigger(J PeriodicTimerSourceInfo sourceInfo = default; DataBoxEdgeRoleSinkInfo sinkInfo = default; Optional customContextTag = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -105,8 +142,61 @@ internal static PeriodicTimerEventTrigger DeserializePeriodicTimerEventTrigger(J } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PeriodicTimerEventTrigger(id, name, type, systemData.Value, kind, sourceInfo, sinkInfo, customContextTag.Value, serializedAdditionalRawData); + } + + PeriodicTimerEventTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePeriodicTimerEventTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PeriodicTimerEventTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePeriodicTimerEventTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PeriodicTimerEventTrigger model) + { + if (model is null) + { + return null; } - return new PeriodicTimerEventTrigger(id, name, type, systemData.Value, kind, sourceInfo, sinkInfo, customContextTag.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PeriodicTimerEventTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePeriodicTimerEventTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.cs index 12d5ef75dc43..ee023ba68892 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerEventTrigger.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; using Azure.ResourceManager.Models; @@ -15,7 +16,7 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Trigger details. public partial class PeriodicTimerEventTrigger : DataBoxEdgeTriggerData { - /// Initializes a new instance of PeriodicTimerEventTrigger. + /// Initializes a new instance of . /// Periodic timer details. /// Role Sink information. /// or is null. @@ -29,7 +30,7 @@ public PeriodicTimerEventTrigger(PeriodicTimerSourceInfo sourceInfo, DataBoxEdge Kind = TriggerEventType.PeriodicTimerEvent; } - /// Initializes a new instance of PeriodicTimerEventTrigger. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -38,7 +39,8 @@ public PeriodicTimerEventTrigger(PeriodicTimerSourceInfo sourceInfo, DataBoxEdge /// Periodic timer details. /// Role Sink information. /// A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. - internal PeriodicTimerEventTrigger(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TriggerEventType kind, PeriodicTimerSourceInfo sourceInfo, DataBoxEdgeRoleSinkInfo sinkInfo, string customContextTag) : base(id, name, resourceType, systemData, kind) + /// Keeps track of any properties unknown to the library. + internal PeriodicTimerEventTrigger(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TriggerEventType kind, PeriodicTimerSourceInfo sourceInfo, DataBoxEdgeRoleSinkInfo sinkInfo, string customContextTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { SourceInfo = sourceInfo; SinkInfo = sinkInfo; @@ -46,6 +48,11 @@ internal PeriodicTimerEventTrigger(ResourceIdentifier id, string name, ResourceT Kind = kind; } + /// Initializes a new instance of for deserialization. + internal PeriodicTimerEventTrigger() + { + } + /// Periodic timer details. public PeriodicTimerSourceInfo SourceInfo { get; set; } /// Role Sink information. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.Serialization.cs index 0c75dd0064ec..9f6cb2984ed1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class PeriodicTimerSourceInfo : IUtf8JsonSerializable + public partial class PeriodicTimerSourceInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("startTime"u8); writer.WriteStringValue(StartOn, "O"); @@ -25,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("topic"u8); writer.WriteStringValue(Topic); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PeriodicTimerSourceInfo DeserializePeriodicTimerSourceInfo(JsonElement element) + internal static PeriodicTimerSourceInfo DeserializePeriodicTimerSourceInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +58,7 @@ internal static PeriodicTimerSourceInfo DeserializePeriodicTimerSourceInfo(JsonE DateTimeOffset startTime = default; string schedule = default; Optional topic = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("startTime"u8)) @@ -54,8 +76,61 @@ internal static PeriodicTimerSourceInfo DeserializePeriodicTimerSourceInfo(JsonE topic = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PeriodicTimerSourceInfo(startTime, schedule, topic.Value, serializedAdditionalRawData); + } + + PeriodicTimerSourceInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePeriodicTimerSourceInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PeriodicTimerSourceInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePeriodicTimerSourceInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PeriodicTimerSourceInfo model) + { + if (model is null) + { + return null; } - return new PeriodicTimerSourceInfo(startTime, schedule, topic.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PeriodicTimerSourceInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePeriodicTimerSourceInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.cs index e2716db9131f..2acadd0391ac 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/PeriodicTimerSourceInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Periodic timer event source. public partial class PeriodicTimerSourceInfo { - /// Initializes a new instance of PeriodicTimerSourceInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. /// Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. /// is null. @@ -25,15 +29,22 @@ public PeriodicTimerSourceInfo(DateTimeOffset startOn, string schedule) Schedule = schedule; } - /// Initializes a new instance of PeriodicTimerSourceInfo. + /// Initializes a new instance of . /// The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. /// Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. /// Topic where periodic events are published to IoT device. - internal PeriodicTimerSourceInfo(DateTimeOffset startOn, string schedule, string topic) + /// Keeps track of any properties unknown to the library. + internal PeriodicTimerSourceInfo(DateTimeOffset startOn, string schedule, string topic, Dictionary serializedAdditionalRawData) { StartOn = startOn; Schedule = schedule; Topic = topic; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PeriodicTimerSourceInfo() + { } /// The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.Serialization.cs index b009187a7c07..b9333f7e00ea 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class RoleList + internal partial class RoleList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static RoleList DeserializeRoleList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static RoleList DeserializeRoleList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static RoleList DeserializeRoleList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new RoleList(Optional.ToList(value), nextLink.Value); + return new RoleList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + RoleList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRoleList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RoleList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRoleList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RoleList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RoleList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRoleList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.cs index c34463f705c1..84681064d981 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/RoleList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of all the roles on the Data Box Edge device. internal partial class RoleList { - /// Initializes a new instance of RoleList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal RoleList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of RoleList. + /// Initializes a new instance of . /// /// The Value. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// /// Link to the next set of results. - internal RoleList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal RoleList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.Serialization.cs index e0b5a7d7fc50..9160839c30f1 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.Serialization.cs @@ -5,21 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class ShareAccessRight + public partial class ShareAccessRight : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ShareAccessRight DeserializeShareAccessRight(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("shareId"u8); + writer.WriteStringValue(ShareId); + writer.WritePropertyName("accessType"u8); + writer.WriteStringValue(AccessType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ShareAccessRight DeserializeShareAccessRight(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier shareId = default; ShareAccessType accessType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("shareId"u8)) @@ -32,8 +65,61 @@ internal static ShareAccessRight DeserializeShareAccessRight(JsonElement element accessType = new ShareAccessType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ShareAccessRight(shareId, accessType); + return new ShareAccessRight(shareId, accessType, serializedAdditionalRawData); + } + + ShareAccessRight IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShareAccessRight(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShareAccessRight IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShareAccessRight(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShareAccessRight model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShareAccessRight(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShareAccessRight(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.cs index 0ae3304d6d8c..1d9fae653971 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareAccessRight.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Specifies the mapping between this particular user and the type of access he has on shares on this device. public partial class ShareAccessRight { - /// Initializes a new instance of ShareAccessRight. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The share ID. /// Type of access to be allowed on the share for this user. /// is null. @@ -25,6 +29,22 @@ internal ShareAccessRight(ResourceIdentifier shareId, ShareAccessType accessType AccessType = accessType; } + /// Initializes a new instance of . + /// The share ID. + /// Type of access to be allowed on the share for this user. + /// Keeps track of any properties unknown to the library. + internal ShareAccessRight(ResourceIdentifier shareId, ShareAccessType accessType, Dictionary serializedAdditionalRawData) + { + ShareId = shareId; + AccessType = accessType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ShareAccessRight() + { + } + /// The share ID. public ResourceIdentifier ShareId { get; } /// Type of access to be allowed on the share for this user. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.Serialization.cs index d44782e55da2..884935044768 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class ShareList + internal partial class ShareList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ShareList DeserializeShareList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ShareList DeserializeShareList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static ShareList DeserializeShareList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ShareList(Optional.ToList(value), nextLink.Value); + return new ShareList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + ShareList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeShareList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ShareList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeShareList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ShareList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ShareList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeShareList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.cs index 6b2a808733d8..f92163291168 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/ShareList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of all the shares on the Data Box Edge/Gateway device. internal partial class ShareList { - /// Initializes a new instance of ShareList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ShareList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of ShareList. + /// Initializes a new instance of . /// The list of shares. /// Link to the next set of results. - internal ShareList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ShareList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of shares. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.Serialization.cs index 1bd58b4f394c..22d3e38e8497 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class StorageAccountCredentialList + internal partial class StorageAccountCredentialList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static StorageAccountCredentialList DeserializeStorageAccountCredentialList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static StorageAccountCredentialList DeserializeStorageAccountCredentialList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static StorageAccountCredentialList DeserializeStorageAccountCredential nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new StorageAccountCredentialList(Optional.ToList(value), nextLink.Value); + return new StorageAccountCredentialList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + StorageAccountCredentialList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageAccountCredentialList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageAccountCredentialList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageAccountCredentialList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageAccountCredentialList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageAccountCredentialList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageAccountCredentialList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.cs index 5aebbd408294..8997727f4c69 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountCredentialList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The collection of storage account credentials. internal partial class StorageAccountCredentialList { - /// Initializes a new instance of StorageAccountCredentialList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal StorageAccountCredentialList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of StorageAccountCredentialList. + /// Initializes a new instance of . /// The value. /// Link to the next set of results. - internal StorageAccountCredentialList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal StorageAccountCredentialList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The value. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.Serialization.cs index 9afc9ec63550..3b10d98f8fa4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class StorageAccountList + internal partial class StorageAccountList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static StorageAccountList DeserializeStorageAccountList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static StorageAccountList DeserializeStorageAccountList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static StorageAccountList DeserializeStorageAccountList(JsonElement ele nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new StorageAccountList(Optional.ToList(value), nextLink.Value); + return new StorageAccountList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + StorageAccountList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeStorageAccountList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + StorageAccountList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeStorageAccountList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(StorageAccountList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator StorageAccountList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeStorageAccountList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.cs index 497f847c35f5..262ef74ec814 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/StorageAccountList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of all the Storage Accounts on the Data Box Edge/Gateway device. internal partial class StorageAccountList { - /// Initializes a new instance of StorageAccountList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal StorageAccountList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of StorageAccountList. + /// Initializes a new instance of . /// The list of storageAccounts. /// Link to the next set of results. - internal StorageAccountList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal StorageAccountList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of storageAccounts. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.Serialization.cs index 2b030dfec1c2..0b3ccde284f4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class SubscriptionRegisteredFeatures + public partial class SubscriptionRegisteredFeatures : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SubscriptionRegisteredFeatures DeserializeSubscriptionRegisteredFeatures(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static SubscriptionRegisteredFeatures DeserializeSubscriptionRegisteredFeatures(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional state = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +71,61 @@ internal static SubscriptionRegisteredFeatures DeserializeSubscriptionRegistered state = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new SubscriptionRegisteredFeatures(name.Value, state.Value); + return new SubscriptionRegisteredFeatures(name.Value, state.Value, serializedAdditionalRawData); + } + + SubscriptionRegisteredFeatures IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionRegisteredFeatures(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SubscriptionRegisteredFeatures IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSubscriptionRegisteredFeatures(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SubscriptionRegisteredFeatures model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SubscriptionRegisteredFeatures(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSubscriptionRegisteredFeatures(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.cs index 57a10e177998..bb4b2ec1d83b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/SubscriptionRegisteredFeatures.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// The SubscriptionRegisteredFeatures. public partial class SubscriptionRegisteredFeatures { - /// Initializes a new instance of SubscriptionRegisteredFeatures. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal SubscriptionRegisteredFeatures() { } - /// Initializes a new instance of SubscriptionRegisteredFeatures. + /// Initializes a new instance of . /// /// - internal SubscriptionRegisteredFeatures(string name, string state) + /// Keeps track of any properties unknown to the library. + internal SubscriptionRegisteredFeatures(string name, string state, Dictionary serializedAdditionalRawData) { Name = name; State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the name. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.Serialization.cs index fab7e84edba2..c678096b526d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class TriggerList + internal partial class TriggerList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static TriggerList DeserializeTriggerList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static TriggerList DeserializeTriggerList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static TriggerList DeserializeTriggerList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new TriggerList(Optional.ToList(value), nextLink.Value); + return new TriggerList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + TriggerList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTriggerList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TriggerList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTriggerList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TriggerList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TriggerList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTriggerList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.cs index 960f598e48c8..e5ad697073e4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,23 +15,28 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of all trigger on the data box edge device. internal partial class TriggerList { - /// Initializes a new instance of TriggerList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal TriggerList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of TriggerList. + /// Initializes a new instance of . /// /// The list of triggers. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// /// Link to the next set of results. - internal TriggerList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal TriggerList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.Serialization.cs index 9fb68bca694b..0679cc855f9e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class TriggerSupportPackageContent : IUtf8JsonSerializable + public partial class TriggerSupportPackageContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(Include); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static TriggerSupportPackageContent DeserializeTriggerSupportPackageContent(JsonElement element) + internal static TriggerSupportPackageContent DeserializeTriggerSupportPackageContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -51,6 +72,7 @@ internal static TriggerSupportPackageContent DeserializeTriggerSupportPackageCon Optional minimumTimeStamp = default; Optional maximumTimeStamp = default; Optional include = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,8 +134,61 @@ internal static TriggerSupportPackageContent DeserializeTriggerSupportPackageCon } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new TriggerSupportPackageContent(id, name, type, systemData.Value, Optional.ToNullable(minimumTimeStamp), Optional.ToNullable(maximumTimeStamp), include.Value, serializedAdditionalRawData); + } + + TriggerSupportPackageContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeTriggerSupportPackageContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + TriggerSupportPackageContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeTriggerSupportPackageContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(TriggerSupportPackageContent model) + { + if (model is null) + { + return null; } - return new TriggerSupportPackageContent(id, name, type, systemData.Value, Optional.ToNullable(minimumTimeStamp), Optional.ToNullable(maximumTimeStamp), include.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator TriggerSupportPackageContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeTriggerSupportPackageContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.cs index 89ff1e2a9e84..903d7f7d252e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/TriggerSupportPackageContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,15 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The request object for trigger support package. public partial class TriggerSupportPackageContent : ResourceData { - /// Initializes a new instance of TriggerSupportPackageContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public TriggerSupportPackageContent() { } - /// Initializes a new instance of TriggerSupportPackageContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +35,13 @@ public TriggerSupportPackageContent() /// This will contain the type of logs (Default/DefaultWithDumps/None/All/DefaultWithArchived) /// or a comma separated list of log types that are required /// - internal TriggerSupportPackageContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? minimumTimeStamp, DateTimeOffset? maximumTimeStamp, string include) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal TriggerSupportPackageContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? minimumTimeStamp, DateTimeOffset? maximumTimeStamp, string include, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { MinimumTimeStamp = minimumTimeStamp; MaximumTimeStamp = maximumTimeStamp; Include = include; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// MinimumTimeStamp from where logs need to be collected. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.Serialization.cs index d885ef4f7b13..3c575a813c03 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class UpdateDownloadProgress + public partial class UpdateDownloadProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpdateDownloadProgress DeserializeUpdateDownloadProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpdateDownloadProgress DeserializeUpdateDownloadProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +52,7 @@ internal static UpdateDownloadProgress DeserializeUpdateDownloadProgress(JsonEle Optional totalBytesDownloaded = default; Optional numberOfUpdatesToDownload = default; Optional numberOfUpdatesDownloaded = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("downloadPhase"u8)) @@ -80,8 +109,61 @@ internal static UpdateDownloadProgress DeserializeUpdateDownloadProgress(JsonEle numberOfUpdatesDownloaded = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpdateDownloadProgress(Optional.ToNullable(downloadPhase), Optional.ToNullable(percentComplete), Optional.ToNullable(totalBytesToDownload), Optional.ToNullable(totalBytesDownloaded), Optional.ToNullable(numberOfUpdatesToDownload), Optional.ToNullable(numberOfUpdatesDownloaded)); + return new UpdateDownloadProgress(Optional.ToNullable(downloadPhase), Optional.ToNullable(percentComplete), Optional.ToNullable(totalBytesToDownload), Optional.ToNullable(totalBytesDownloaded), Optional.ToNullable(numberOfUpdatesToDownload), Optional.ToNullable(numberOfUpdatesDownloaded), serializedAdditionalRawData); + } + + UpdateDownloadProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateDownloadProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateDownloadProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateDownloadProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateDownloadProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateDownloadProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateDownloadProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.cs index 529e0d5dce01..90c44e0bc8b5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateDownloadProgress.cs @@ -5,24 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Details about the download progress of update. public partial class UpdateDownloadProgress { - /// Initializes a new instance of UpdateDownloadProgress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpdateDownloadProgress() { } - /// Initializes a new instance of UpdateDownloadProgress. + /// Initializes a new instance of . /// The download phase. /// Percentage of completion. /// Total bytes to download. /// Total bytes downloaded. /// Number of updates to download. /// Number of updates downloaded. - internal UpdateDownloadProgress(DataBoxEdgeDownloadPhase? downloadPhase, int? percentComplete, double? totalBytesToDownload, double? totalBytesDownloaded, int? numberOfUpdatesToDownload, int? numberOfUpdatesDownloaded) + /// Keeps track of any properties unknown to the library. + internal UpdateDownloadProgress(DataBoxEdgeDownloadPhase? downloadPhase, int? percentComplete, double? totalBytesToDownload, double? totalBytesDownloaded, int? numberOfUpdatesToDownload, int? numberOfUpdatesDownloaded, Dictionary serializedAdditionalRawData) { DownloadPhase = downloadPhase; PercentComplete = percentComplete; @@ -30,6 +37,7 @@ internal UpdateDownloadProgress(DataBoxEdgeDownloadPhase? downloadPhase, int? pe TotalBytesDownloaded = totalBytesDownloaded; NumberOfUpdatesToDownload = numberOfUpdatesToDownload; NumberOfUpdatesDownloaded = numberOfUpdatesDownloaded; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The download phase. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.Serialization.cs index 6872bf30edf2..66cac36937d3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.Serialization.cs @@ -5,15 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class UpdateInstallProgress + public partial class UpdateInstallProgress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UpdateInstallProgress DeserializeUpdateInstallProgress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UpdateInstallProgress DeserializeUpdateInstallProgress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +49,7 @@ internal static UpdateInstallProgress DeserializeUpdateInstallProgress(JsonEleme Optional percentComplete = default; Optional numberOfUpdatesToInstall = default; Optional numberOfUpdatesInstalled = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("percentComplete"u8)) @@ -50,8 +79,61 @@ internal static UpdateInstallProgress DeserializeUpdateInstallProgress(JsonEleme numberOfUpdatesInstalled = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UpdateInstallProgress(Optional.ToNullable(percentComplete), Optional.ToNullable(numberOfUpdatesToInstall), Optional.ToNullable(numberOfUpdatesInstalled)); + return new UpdateInstallProgress(Optional.ToNullable(percentComplete), Optional.ToNullable(numberOfUpdatesToInstall), Optional.ToNullable(numberOfUpdatesInstalled), serializedAdditionalRawData); + } + + UpdateInstallProgress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateInstallProgress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UpdateInstallProgress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUpdateInstallProgress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UpdateInstallProgress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UpdateInstallProgress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUpdateInstallProgress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.cs index b79eed3b5d5a..29f7a9f6d024 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UpdateInstallProgress.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataBoxEdge.Models { /// Progress details during installation of updates. public partial class UpdateInstallProgress { - /// Initializes a new instance of UpdateInstallProgress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UpdateInstallProgress() { } - /// Initializes a new instance of UpdateInstallProgress. + /// Initializes a new instance of . /// Percentage completed. /// Number of updates to install. /// Number of updates installed. - internal UpdateInstallProgress(int? percentComplete, int? numberOfUpdatesToInstall, int? numberOfUpdatesInstalled) + /// Keeps track of any properties unknown to the library. + internal UpdateInstallProgress(int? percentComplete, int? numberOfUpdatesToInstall, int? numberOfUpdatesInstalled, Dictionary serializedAdditionalRawData) { PercentComplete = percentComplete; NumberOfUpdatesToInstall = numberOfUpdatesToInstall; NumberOfUpdatesInstalled = numberOfUpdatesInstalled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Percentage completed. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.Serialization.cs index fa7d7c656292..b9ee79599359 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class UploadCertificateContent : IUtf8JsonSerializable + public partial class UploadCertificateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -25,7 +33,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("certificate"u8); writer.WriteStringValue(Certificate); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static UploadCertificateContent DeserializeUploadCertificateContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional authenticationType = default; + string certificate = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("authenticationType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authenticationType = new DataBoxEdgeAuthenticationType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("certificate"u8)) + { + certificate = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UploadCertificateContent(Optional.ToNullable(authenticationType), certificate, serializedAdditionalRawData); + } + + UploadCertificateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUploadCertificateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UploadCertificateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUploadCertificateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UploadCertificateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UploadCertificateContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUploadCertificateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.cs index ffaa4def18be..4ff01013c202 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The upload certificate request. public partial class UploadCertificateContent { - /// Initializes a new instance of UploadCertificateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The base64 encoded certificate raw data. /// is null. public UploadCertificateContent(string certificate) @@ -23,6 +27,22 @@ public UploadCertificateContent(string certificate) Certificate = certificate; } + /// Initializes a new instance of . + /// The authentication type. + /// The base64 encoded certificate raw data. + /// Keeps track of any properties unknown to the library. + internal UploadCertificateContent(DataBoxEdgeAuthenticationType? authenticationType, string certificate, Dictionary serializedAdditionalRawData) + { + AuthenticationType = authenticationType; + Certificate = certificate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UploadCertificateContent() + { + } + /// The authentication type. public DataBoxEdgeAuthenticationType? AuthenticationType { get; set; } /// The base64 encoded certificate raw data. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.Serialization.cs index 01e616dc6c7f..d98d41c23b0a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.Serialization.cs @@ -6,15 +6,47 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class UploadCertificateResponse + public partial class UploadCertificateResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UploadCertificateResponse DeserializeUploadCertificateResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AuthType)) + { + writer.WritePropertyName("authType"u8); + writer.WriteStringValue(AuthType.Value.ToString()); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UploadCertificateResponse DeserializeUploadCertificateResponse(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +59,7 @@ internal static UploadCertificateResponse DeserializeUploadCertificateResponse(J Optional servicePrincipalObjectId = default; Optional azureManagementEndpointAudience = default; Optional aadAudience = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authType"u8)) @@ -85,8 +118,61 @@ internal static UploadCertificateResponse DeserializeUploadCertificateResponse(J aadAudience = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UploadCertificateResponse(Optional.ToNullable(authType), resourceId.Value, aadAuthority.Value, Optional.ToNullable(aadTenantId), Optional.ToNullable(servicePrincipalClientId), Optional.ToNullable(servicePrincipalObjectId), azureManagementEndpointAudience.Value, aadAudience.Value); + return new UploadCertificateResponse(Optional.ToNullable(authType), resourceId.Value, aadAuthority.Value, Optional.ToNullable(aadTenantId), Optional.ToNullable(servicePrincipalClientId), Optional.ToNullable(servicePrincipalObjectId), azureManagementEndpointAudience.Value, aadAudience.Value, serializedAdditionalRawData); + } + + UploadCertificateResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUploadCertificateResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UploadCertificateResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUploadCertificateResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UploadCertificateResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UploadCertificateResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUploadCertificateResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.cs index 966380d2fa9d..b450caab3a6a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UploadCertificateResponse.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataBoxEdge.Models { /// The upload registration certificate response. public partial class UploadCertificateResponse { - /// Initializes a new instance of UploadCertificateResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UploadCertificateResponse() { } - /// Initializes a new instance of UploadCertificateResponse. + /// Initializes a new instance of . /// Specifies authentication type. /// The resource ID of the Data Box Edge/Gateway device. /// Azure Active Directory tenant authority. @@ -26,7 +30,8 @@ internal UploadCertificateResponse() /// Azure Active Directory service principal object ID. /// The azure management endpoint audience. /// Identifier of the target resource that is the recipient of the requested token. - internal UploadCertificateResponse(DataBoxEdgeAuthenticationType? authType, string resourceId, string aadAuthority, Guid? aadTenantId, Guid? servicePrincipalClientId, Guid? servicePrincipalObjectId, string azureManagementEndpointAudience, string aadAudience) + /// Keeps track of any properties unknown to the library. + internal UploadCertificateResponse(DataBoxEdgeAuthenticationType? authType, string resourceId, string aadAuthority, Guid? aadTenantId, Guid? servicePrincipalClientId, Guid? servicePrincipalObjectId, string azureManagementEndpointAudience, string aadAudience, Dictionary serializedAdditionalRawData) { AuthType = authType; ResourceId = resourceId; @@ -36,6 +41,7 @@ internal UploadCertificateResponse(DataBoxEdgeAuthenticationType? authType, stri ServicePrincipalObjectId = servicePrincipalObjectId; AzureManagementEndpointAudience = azureManagementEndpointAudience; AadAudience = aadAudience; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies authentication type. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.Serialization.cs index f5d063a718de..ea1cf144dc9a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class UserAccessRight : IUtf8JsonSerializable + public partial class UserAccessRight : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("userId"u8); writer.WriteStringValue(UserId); writer.WritePropertyName("accessType"u8); writer.WriteStringValue(AccessType.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserAccessRight DeserializeUserAccessRight(JsonElement element) + internal static UserAccessRight DeserializeUserAccessRight(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier userId = default; ShareAccessType accessType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userId"u8)) @@ -42,8 +65,61 @@ internal static UserAccessRight DeserializeUserAccessRight(JsonElement element) accessType = new ShareAccessType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserAccessRight(userId, accessType, serializedAdditionalRawData); + } + + UserAccessRight IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserAccessRight(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserAccessRight IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserAccessRight(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserAccessRight model) + { + if (model is null) + { + return null; } - return new UserAccessRight(userId, accessType); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserAccessRight(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserAccessRight(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.cs index 34f99e9c0c65..f8be8b1e6ae9 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserAccessRight.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataBoxEdge.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// The mapping between a particular user and the access type on the SMB share. public partial class UserAccessRight { - /// Initializes a new instance of UserAccessRight. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// User ID (already existing in the device). /// Type of access to be allowed for the user. /// is null. @@ -25,6 +29,22 @@ public UserAccessRight(ResourceIdentifier userId, ShareAccessType accessType) AccessType = accessType; } + /// Initializes a new instance of . + /// User ID (already existing in the device). + /// Type of access to be allowed for the user. + /// Keeps track of any properties unknown to the library. + internal UserAccessRight(ResourceIdentifier userId, ShareAccessType accessType, Dictionary serializedAdditionalRawData) + { + UserId = userId; + AccessType = accessType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UserAccessRight() + { + } + /// User ID (already existing in the device). public ResourceIdentifier UserId { get; set; } /// Type of access to be allowed for the user. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.Serialization.cs index 1f7ac05be65a..b1208e036909 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.Serialization.cs @@ -5,23 +5,51 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataBoxEdge; namespace Azure.ResourceManager.DataBoxEdge.Models { - internal partial class UserList + internal partial class UserList : IUtf8JsonSerializable, IModelJsonSerializable { - internal static UserList DeserializeUserList(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static UserList DeserializeUserList(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +71,61 @@ internal static UserList DeserializeUserList(JsonElement element) nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new UserList(Optional.ToList(value), nextLink.Value); + return new UserList(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + UserList IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserList(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserList IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserList(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserList model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserList(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserList(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.cs index 753f638951ec..f17bc302d0d2 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/UserList.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.DataBoxEdge; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// Collection of users. internal partial class UserList { - /// Initializes a new instance of UserList. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal UserList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of UserList. + /// Initializes a new instance of . /// The list of users. /// Link to the next set of results. - internal UserList(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal UserList(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of users. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.Serialization.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.Serialization.cs index 033694ef9756..230c4fdeb094 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.Serialization.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataBoxEdge.Models { - public partial class VmPlacementRequestResult : IUtf8JsonSerializable + public partial class VmPlacementRequestResult : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(VmSize)) { @@ -40,7 +48,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static VmPlacementRequestResult DeserializeVmPlacementRequestResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> vmSize = default; + Optional isFeasible = default; + Optional messageCode = default; + Optional message = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vmSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + vmSize = array; + continue; + } + if (property.NameEquals("isFeasible"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isFeasible = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("messageCode"u8)) + { + messageCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new VmPlacementRequestResult(Optional.ToList(vmSize), Optional.ToNullable(isFeasible), messageCode.Value, message.Value, serializedAdditionalRawData); + } + + VmPlacementRequestResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeVmPlacementRequestResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + VmPlacementRequestResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeVmPlacementRequestResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(VmPlacementRequestResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator VmPlacementRequestResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeVmPlacementRequestResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.cs index 52659fe83a80..815a8bcfb8af 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Models/VmPlacementRequestResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,30 @@ namespace Azure.ResourceManager.DataBoxEdge.Models /// List of VM sizes being checked for creation on appliance along with corresponding result. public partial class VmPlacementRequestResult { - /// Initializes a new instance of VmPlacementRequestResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public VmPlacementRequestResult() { VmSize = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// List of VM sizes being checked. + /// Boolean value indicating if the VM(s) in VmSize can be created. + /// MessageCode indicating reason for success or failure. + /// Localized message to be displayed to the user to explain the check result. + /// Keeps track of any properties unknown to the library. + internal VmPlacementRequestResult(IList vmSize, bool? isFeasible, string messageCode, string message, Dictionary serializedAdditionalRawData) + { + VmSize = vmSize; + IsFeasible = isFeasible; + MessageCode = messageCode; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// List of VM sizes being checked. public IList VmSize { get; } /// Boolean value indicating if the VM(s) in VmSize can be created. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationData.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationData.cs index 70ccc48cd51b..c4d35f526118 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationData.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.DataBoxEdge /// public partial class MonitoringMetricConfigurationData : ResourceData { - /// Initializes a new instance of MonitoringMetricConfigurationData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The metrics configuration details. /// is null. public MonitoringMetricConfigurationData(IEnumerable metricConfigurations) @@ -30,15 +33,22 @@ public MonitoringMetricConfigurationData(IEnumerable Initializes a new instance of MonitoringMetricConfigurationData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The metrics configuration details. - internal MonitoringMetricConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList metricConfigurations) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal MonitoringMetricConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList metricConfigurations, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { MetricConfigurations = metricConfigurations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MonitoringMetricConfigurationData() + { } /// The metrics configuration details. diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/AddonsRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/AddonsRestOperations.cs index 5f9a57af6001..4c749c92efe8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/AddonsRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/AddonsRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/BandwidthSchedulesRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/BandwidthSchedulesRestOperations.cs index fde01473f634..f809871e3af2 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/BandwidthSchedulesRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/BandwidthSchedulesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/ContainersRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/ContainersRestOperations.cs index cc2975d5a38a..de18355b693e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/ContainersRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/ContainersRestOperations.cs @@ -237,9 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DeviceCapacityCheckRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DeviceCapacityCheckRestOperations.cs index 7f7982cd6422..e724cf5c549c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DeviceCapacityCheckRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DeviceCapacityCheckRestOperations.cs @@ -58,9 +58,7 @@ internal HttpMessage CreateCheckResourceCreationFeasibilityRequest(string subscr request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DevicesRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DevicesRestOperations.cs index 7627509400b1..001552cbfda3 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DevicesRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DevicesRestOperations.cs @@ -288,9 +288,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -446,9 +444,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -983,9 +979,7 @@ internal HttpMessage CreateCreateOrUpdateSecuritySettingsRequest(string subscrip request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(securitySettings); - request.Content = content; + request.Content = securitySettings; _userAgent.Apply(message); return message; } @@ -1062,9 +1056,7 @@ internal HttpMessage CreateUpdateExtendedInformationRequest(string subscriptionI request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } @@ -1228,9 +1220,7 @@ internal HttpMessage CreateUploadCertificateRequest(string subscriptionId, strin request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DiagnosticSettingsRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DiagnosticSettingsRestOperations.cs index 0eaa3b693e3c..f315ca2978ec 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DiagnosticSettingsRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/DiagnosticSettingsRestOperations.cs @@ -137,9 +137,7 @@ internal HttpMessage CreateUpdateDiagnosticProactiveLogCollectionSettingsRequest request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -299,9 +297,7 @@ internal HttpMessage CreateUpdateDiagnosticRemoteSupportSettingsRequest(string s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/MonitoringConfigRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/MonitoringConfigRestOperations.cs index 5e567d5e342d..7da20fc43eed 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/MonitoringConfigRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/MonitoringConfigRestOperations.cs @@ -231,9 +231,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/OrdersRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/OrdersRestOperations.cs index cd780fafc49c..b462ebee7d54 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/OrdersRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/OrdersRestOperations.cs @@ -217,9 +217,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/RolesRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/RolesRestOperations.cs index e33df8a6393d..56bb845ca9d7 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/RolesRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/RolesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SharesRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SharesRestOperations.cs index 8454bdb94c21..c95ced97617e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SharesRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SharesRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountCredentialsRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountCredentialsRestOperations.cs index 849d4c9d75b2..0b2904cab46e 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountCredentialsRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountCredentialsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountsRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountsRestOperations.cs index 05df866a7245..b54655e83d7a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountsRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/StorageAccountsRestOperations.cs @@ -223,9 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SupportPackagesRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SupportPackagesRestOperations.cs index 41e02677e56e..a410e055d526 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SupportPackagesRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/SupportPackagesRestOperations.cs @@ -54,9 +54,7 @@ internal HttpMessage CreateTriggerSupportPackageRequest(string subscriptionId, s request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + request.Content = content; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/TriggersRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/TriggersRestOperations.cs index 47b6c4a544b1..cf884ec33581 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/TriggersRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/TriggersRestOperations.cs @@ -229,9 +229,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/UsersRestOperations.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/UsersRestOperations.cs index af98fab388f7..9e8fb82b7f3a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/UsersRestOperations.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/RestOperations/UsersRestOperations.cs @@ -229,9 +229,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/ArmDatadogModelFactory.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/ArmDatadogModelFactory.cs index 7d6f6e7eeded..74e9989efa3d 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/ArmDatadogModelFactory.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/ArmDatadogModelFactory.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Datadog.Models /// Model factory for models. public static partial class ArmDatadogModelFactory { - /// Initializes a new instance of DatadogAgreementResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -26,10 +26,10 @@ public static partial class ArmDatadogModelFactory /// A new instance for mocking. public static DatadogAgreementResource DatadogAgreementResource(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatadogAgreementProperties properties = null) { - return new DatadogAgreementResource(id, name, resourceType, systemData, properties); + return new DatadogAgreementResource(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of DatadogHost. + /// Initializes a new instance of . /// The name of the host. /// The aliases for the host. /// The Datadog integrations reporting metrics for the host. @@ -40,30 +40,30 @@ public static DatadogHost DatadogHost(string name = null, IEnumerable al aliases ??= new List(); apps ??= new List(); - return new DatadogHost(name, aliases?.ToList(), apps?.ToList(), meta); + return new DatadogHost(name, aliases?.ToList(), apps?.ToList(), meta, default); } - /// Initializes a new instance of DatadogHostMetadata. + /// Initializes a new instance of . /// The agent version. /// /// /// A new instance for mocking. public static DatadogHostMetadata DatadogHostMetadata(string agentVersion = null, DatadogInstallMethod installMethod = null, string logsAgentTransport = null) { - return new DatadogHostMetadata(agentVersion, installMethod, logsAgentTransport != null ? new DatadogLogsAgent(logsAgentTransport) : null); + return new DatadogHostMetadata(agentVersion, installMethod, logsAgentTransport != null ? new DatadogLogsAgent(logsAgentTransport, new Dictionary()) : null, default); } - /// Initializes a new instance of DatadogInstallMethod. + /// Initializes a new instance of . /// The tool. /// The tool version. /// The installer version. /// A new instance for mocking. public static DatadogInstallMethod DatadogInstallMethod(string tool = null, string toolVersion = null, string installerVersion = null) { - return new DatadogInstallMethod(tool, toolVersion, installerVersion); + return new DatadogInstallMethod(tool, toolVersion, installerVersion, default); } - /// Initializes a new instance of MonitoredResource. + /// Initializes a new instance of . /// The ARM id of the resource. /// Flag indicating if resource is sending metrics to Datadog. /// Reason for why the resource is sending metrics (or why it is not sending). @@ -72,10 +72,10 @@ public static DatadogInstallMethod DatadogInstallMethod(string tool = null, stri /// A new instance for mocking. public static MonitoredResource MonitoredResource(string id = null, bool? sendingMetrics = null, string reasonForMetricsStatus = null, bool? sendingLogs = null, string reasonForLogsStatus = null) { - return new MonitoredResource(id, sendingMetrics, reasonForMetricsStatus, sendingLogs, reasonForLogsStatus); + return new MonitoredResource(id, sendingMetrics, reasonForMetricsStatus, sendingLogs, reasonForLogsStatus, default); } - /// Initializes a new instance of DatadogMonitorResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -90,10 +90,10 @@ public static DatadogMonitorResourceData DatadogMonitorResourceData(ResourceIden { tags ??= new Dictionary(); - return new DatadogMonitorResourceData(id, name, resourceType, systemData, tags, location, skuName != null ? new ResourceSku(skuName) : null, properties, identity); + return new DatadogMonitorResourceData(id, name, resourceType, systemData, tags, location, skuName != null ? new ResourceSku(skuName, new Dictionary()) : null, properties, identity, default); } - /// Initializes a new instance of MonitorProperties. + /// Initializes a new instance of . /// /// Flag specifying if the resource monitoring is enabled or disabled. /// Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. @@ -104,10 +104,10 @@ public static DatadogMonitorResourceData DatadogMonitorResourceData(ResourceIden /// A new instance for mocking. public static MonitorProperties MonitorProperties(ProvisioningState? provisioningState = null, MonitoringStatus? monitoringStatus = null, MarketplaceSubscriptionStatus? marketplaceSubscriptionStatus = null, DatadogOrganizationProperties datadogOrganizationProperties = null, UserInfo userInfo = null, LiftrResourceCategory? liftrResourceCategory = null, int? liftrResourcePreference = null) { - return new MonitorProperties(provisioningState, monitoringStatus, marketplaceSubscriptionStatus, datadogOrganizationProperties, userInfo, liftrResourceCategory, liftrResourcePreference); + return new MonitorProperties(provisioningState, monitoringStatus, marketplaceSubscriptionStatus, datadogOrganizationProperties, userInfo, liftrResourceCategory, liftrResourcePreference, default); } - /// Initializes a new instance of DatadogOrganizationProperties. + /// Initializes a new instance of . /// Name of the Datadog organization. /// Id of the Datadog organization. /// The auth code used to linking to an existing datadog organization. @@ -119,18 +119,18 @@ public static MonitorProperties MonitorProperties(ProvisioningState? provisionin /// A new instance for mocking. public static DatadogOrganizationProperties DatadogOrganizationProperties(string name = null, string id = null, string linkingAuthCode = null, string linkingClientId = null, Uri redirectUri = null, string apiKey = null, string applicationKey = null, string enterpriseAppId = null) { - return new DatadogOrganizationProperties(name, id, linkingAuthCode, linkingClientId, redirectUri, apiKey, applicationKey, enterpriseAppId); + return new DatadogOrganizationProperties(name, id, linkingAuthCode, linkingClientId, redirectUri, apiKey, applicationKey, enterpriseAppId, default); } - /// Initializes a new instance of DatadogSetPasswordLink. + /// Initializes a new instance of . /// /// A new instance for mocking. public static DatadogSetPasswordLink DatadogSetPasswordLink(string setPasswordLink = null) { - return new DatadogSetPasswordLink(setPasswordLink); + return new DatadogSetPasswordLink(setPasswordLink, default); } - /// Initializes a new instance of MonitoringTagRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -139,10 +139,10 @@ public static DatadogSetPasswordLink DatadogSetPasswordLink(string setPasswordLi /// A new instance for mocking. public static MonitoringTagRuleData MonitoringTagRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MonitoringTagRulesProperties properties = null) { - return new MonitoringTagRuleData(id, name, resourceType, systemData, properties); + return new MonitoringTagRuleData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of MonitoringTagRulesProperties. + /// Initializes a new instance of . /// /// Set of rules for sending logs for the Monitor resource. /// Set of rules for sending metrics for the Monitor resource. @@ -151,10 +151,10 @@ public static MonitoringTagRulesProperties MonitoringTagRulesProperties(Provisio { metricRulesFilteringTags ??= new List(); - return new MonitoringTagRulesProperties(provisioningState, logRules, metricRulesFilteringTags != null ? new MetricRules(metricRulesFilteringTags?.ToList()) : null); + return new MonitoringTagRulesProperties(provisioningState, logRules, metricRulesFilteringTags != null ? new MetricRules(metricRulesFilteringTags?.ToList(), new Dictionary()) : null, default); } - /// Initializes a new instance of DatadogSingleSignOnResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -163,10 +163,10 @@ public static MonitoringTagRulesProperties MonitoringTagRulesProperties(Provisio /// A new instance for mocking. public static DatadogSingleSignOnResourceData DatadogSingleSignOnResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatadogSingleSignOnProperties properties = null) { - return new DatadogSingleSignOnResourceData(id, name, resourceType, systemData, properties); + return new DatadogSingleSignOnResourceData(id, name, resourceType, systemData, properties, default); } - /// Initializes a new instance of DatadogSingleSignOnProperties. + /// Initializes a new instance of . /// /// Various states of the SSO resource. /// The Id of the Enterprise App used for Single sign-on. @@ -174,7 +174,7 @@ public static DatadogSingleSignOnResourceData DatadogSingleSignOnResourceData(Re /// A new instance for mocking. public static DatadogSingleSignOnProperties DatadogSingleSignOnProperties(ProvisioningState? provisioningState = null, SingleSignOnState? singleSignOnState = null, string enterpriseAppId = null, Uri singleSignOnUri = null) { - return new DatadogSingleSignOnProperties(provisioningState, singleSignOnState, enterpriseAppId, singleSignOnUri); + return new DatadogSingleSignOnProperties(provisioningState, singleSignOnState, enterpriseAppId, singleSignOnUri, default); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs index 06449ceca838..f28548532652 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs @@ -635,7 +635,7 @@ public virtual AsyncPageable GetLinkedResourcesAsync(CancellationTo { HttpMessage FirstPageRequest(int? pageSizeHint) => _datadogMonitorResourceMonitorsRestClient.CreateListLinkedResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datadogMonitorResourceMonitorsRestClient.CreateListLinkedResourcesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResource.GetLinkedResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => JsonSerializer.Deserialize(e.GetRawText()), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResource.GetLinkedResources", "value", "nextLink", cancellationToken); } /// @@ -657,7 +657,7 @@ public virtual Pageable GetLinkedResources(CancellationToken cancel { HttpMessage FirstPageRequest(int? pageSizeHint) => _datadogMonitorResourceMonitorsRestClient.CreateListLinkedResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datadogMonitorResourceMonitorsRestClient.CreateListLinkedResourcesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResource.GetLinkedResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => JsonSerializer.Deserialize(e.GetRawText()), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResource.GetLinkedResources", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs index b03e8a2bcf7c..73a785d35f3c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceCollection.cs @@ -229,7 +229,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _datadogMonitorResourceMonitorsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datadogMonitorResourceMonitorsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -251,7 +251,7 @@ public virtual Pageable GetAll(CancellationToken cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _datadogMonitorResourceMonitorsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datadogMonitorResourceMonitorsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), _datadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "DatadogMonitorResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceData.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceData.cs index 980adb9585ce..c9963b8a45f5 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceData.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResourceData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Datadog.Models; @@ -15,13 +16,16 @@ namespace Azure.ResourceManager.Datadog /// A class representing the DatadogMonitorResource data model. public partial class DatadogMonitorResourceData : TrackedResourceData { - /// Initializes a new instance of DatadogMonitorResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The location. public DatadogMonitorResourceData(AzureLocation location) : base(location) { } - /// Initializes a new instance of DatadogMonitorResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -31,11 +35,18 @@ public DatadogMonitorResourceData(AzureLocation location) : base(location) /// /// Properties specific to the monitor resource. /// Gets or sets the identity. Current supported identity types: SystemAssigned, UserAssigned. - internal DatadogMonitorResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceSku sku, MonitorProperties properties, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal DatadogMonitorResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceSku sku, MonitorProperties properties, ManagedServiceIdentity identity, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Properties = properties; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatadogMonitorResourceData() + { } /// Gets or sets the sku. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs index b138b3bca552..2ec729c64a16 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _datadogSingleSignOnResourceSingleSignOnConfigurationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datadogSingleSignOnResourceSingleSignOnConfigurationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatadogSingleSignOnResource(Client, DatadogSingleSignOnResourceData.DeserializeDatadogSingleSignOnResourceData(e)), _datadogSingleSignOnResourceSingleSignOnConfigurationsClientDiagnostics, Pipeline, "DatadogSingleSignOnResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DatadogSingleSignOnResource(Client, DatadogSingleSignOnResourceData.DeserializeDatadogSingleSignOnResourceData(e)), _datadogSingleSignOnResourceSingleSignOnConfigurationsClientDiagnostics, Pipeline, "DatadogSingleSignOnResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _datadogSingleSignOnResourceSingleSignOnConfigurationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datadogSingleSignOnResourceSingleSignOnConfigurationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatadogSingleSignOnResource(Client, DatadogSingleSignOnResourceData.DeserializeDatadogSingleSignOnResourceData(e)), _datadogSingleSignOnResourceSingleSignOnConfigurationsClientDiagnostics, Pipeline, "DatadogSingleSignOnResourceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DatadogSingleSignOnResource(Client, DatadogSingleSignOnResourceData.DeserializeDatadogSingleSignOnResourceData(e)), _datadogSingleSignOnResourceSingleSignOnConfigurationsClientDiagnostics, Pipeline, "DatadogSingleSignOnResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceData.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceData.cs index 83bb49659e1e..a7ec5be46e0a 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceData.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResourceData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Datadog.Models; using Azure.ResourceManager.Models; @@ -14,20 +16,25 @@ namespace Azure.ResourceManager.Datadog /// A class representing the DatadogSingleSignOnResource data model. public partial class DatadogSingleSignOnResourceData : ResourceData { - /// Initializes a new instance of DatadogSingleSignOnResourceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatadogSingleSignOnResourceData() { } - /// Initializes a new instance of DatadogSingleSignOnResourceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// - internal DatadogSingleSignOnResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatadogSingleSignOnProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DatadogSingleSignOnResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatadogSingleSignOnProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the properties. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 831c7d77da77..60cabf3d2b02 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -173,7 +173,7 @@ public virtual AsyncPageable GetDatadogMonitorResourcesA { HttpMessage FirstPageRequest(int? pageSizeHint) => DatadogMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatadogMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); } /// @@ -195,7 +195,7 @@ public virtual Pageable GetDatadogMonitorResources(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => DatadogMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatadogMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.Serialization.cs index 622d2260c593..61e1f097e473 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogAgreementProperties : IUtf8JsonSerializable + public partial class DatadogAgreementProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Publisher)) { @@ -56,11 +63,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("accepted"u8); writer.WriteBooleanValue(Accepted.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatadogAgreementProperties DeserializeDatadogAgreementProperties(JsonElement element) + internal static DatadogAgreementProperties DeserializeDatadogAgreementProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,6 +94,7 @@ internal static DatadogAgreementProperties DeserializeDatadogAgreementProperties Optional retrieveDatetime = default; Optional signature = default; Optional accepted = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher"u8)) @@ -123,8 +145,61 @@ internal static DatadogAgreementProperties DeserializeDatadogAgreementProperties accepted = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogAgreementProperties(publisher.Value, product.Value, plan.Value, licenseTextLink.Value, privacyPolicyLink.Value, Optional.ToNullable(retrieveDatetime), signature.Value, Optional.ToNullable(accepted), serializedAdditionalRawData); + } + + DatadogAgreementProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogAgreementProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogAgreementProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogAgreementProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogAgreementProperties model) + { + if (model is null) + { + return null; } - return new DatadogAgreementProperties(publisher.Value, product.Value, plan.Value, licenseTextLink.Value, privacyPolicyLink.Value, Optional.ToNullable(retrieveDatetime), signature.Value, Optional.ToNullable(accepted)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogAgreementProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogAgreementProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.cs index 81af3e1ecbdc..475065155177 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementProperties.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Datadog.Models { /// Terms properties. public partial class DatadogAgreementProperties { - /// Initializes a new instance of DatadogAgreementProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatadogAgreementProperties() { } - /// Initializes a new instance of DatadogAgreementProperties. + /// Initializes a new instance of . /// Publisher identifier string. /// Product identifier string. /// Plan identifier string. @@ -26,7 +30,8 @@ public DatadogAgreementProperties() /// Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. /// Terms signature. /// If any version of the terms have been accepted, otherwise false. - internal DatadogAgreementProperties(string publisher, string product, string plan, string licenseTextLink, string privacyPolicyLink, DateTimeOffset? retrieveDatetime, string signature, bool? accepted) + /// Keeps track of any properties unknown to the library. + internal DatadogAgreementProperties(string publisher, string product, string plan, string licenseTextLink, string privacyPolicyLink, DateTimeOffset? retrieveDatetime, string signature, bool? accepted, Dictionary serializedAdditionalRawData) { Publisher = publisher; Product = product; @@ -36,6 +41,7 @@ internal DatadogAgreementProperties(string publisher, string product, string pla RetrieveDatetime = retrieveDatetime; Signature = signature; Accepted = accepted; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Publisher identifier string. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.Serialization.cs index 8cb5fbf9e27f..f5ab6e99ea24 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.Serialization.cs @@ -5,27 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogAgreementResource : IUtf8JsonSerializable + public partial class DatadogAgreementResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DatadogAgreementResource DeserializeDatadogAgreementResource(JsonElement element) + internal static DatadogAgreementResource DeserializeDatadogAgreementResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +64,7 @@ internal static DatadogAgreementResource DeserializeDatadogAgreementResource(Jso string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -70,8 +100,61 @@ internal static DatadogAgreementResource DeserializeDatadogAgreementResource(Jso systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogAgreementResource(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + DatadogAgreementResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogAgreementResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogAgreementResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogAgreementResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogAgreementResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogAgreementResource(Response response) + { + if (response is null) + { + return null; } - return new DatadogAgreementResource(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogAgreementResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.cs index 2354d006eb77..912d37515a06 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResource.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.Datadog.Models /// The DatadogAgreementResource. public partial class DatadogAgreementResource : ResourceData { - /// Initializes a new instance of DatadogAgreementResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatadogAgreementResource() { } - /// Initializes a new instance of DatadogAgreementResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Represents the properties of the resource. - internal DatadogAgreementResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatadogAgreementProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DatadogAgreementResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatadogAgreementProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Represents the properties of the resource. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.Serialization.cs index 213f5003071d..3201e3232c0a 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class DatadogAgreementResourceListResponse + internal partial class DatadogAgreementResourceListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogAgreementResourceListResponse DeserializeDatadogAgreementResourceListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogAgreementResourceListResponse DeserializeDatadogAgreementResourceListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static DatadogAgreementResourceListResponse DeserializeDatadogAgreement nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogAgreementResourceListResponse(Optional.ToList(value), nextLink.Value); + return new DatadogAgreementResourceListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DatadogAgreementResourceListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogAgreementResourceListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogAgreementResourceListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogAgreementResourceListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogAgreementResourceListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogAgreementResourceListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogAgreementResourceListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.cs index a7cec5ed64f0..9df85dc4e439 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogAgreementResourceListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class DatadogAgreementResourceListResponse { - /// Initializes a new instance of DatadogAgreementResourceListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogAgreementResourceListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatadogAgreementResourceListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal DatadogAgreementResourceListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DatadogAgreementResourceListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.Serialization.cs index 4dcdea75493f..7066ed000ded 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogApiKey : IUtf8JsonSerializable + public partial class DatadogApiKey : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CreatedBy)) { @@ -32,11 +40,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("created"u8); writer.WriteStringValue(Created); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatadogApiKey DeserializeDatadogApiKey(JsonElement element) + internal static DatadogApiKey DeserializeDatadogApiKey(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,6 +67,7 @@ internal static DatadogApiKey DeserializeDatadogApiKey(JsonElement element) Optional name = default; string key = default; Optional created = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("createdBy"u8)) @@ -67,8 +90,61 @@ internal static DatadogApiKey DeserializeDatadogApiKey(JsonElement element) created = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogApiKey(createdBy.Value, name.Value, key, created.Value, serializedAdditionalRawData); + } + + DatadogApiKey IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogApiKey(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogApiKey IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogApiKey(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogApiKey model) + { + if (model is null) + { + return null; } - return new DatadogApiKey(createdBy.Value, name.Value, key, created.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogApiKey(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogApiKey(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.cs index 23260a27ac2f..fb06167fe30d 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKey.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Datadog.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Datadog.Models /// The DatadogApiKey. public partial class DatadogApiKey { - /// Initializes a new instance of DatadogApiKey. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The value of the API key. /// is null. public DatadogApiKey(string key) @@ -23,17 +27,24 @@ public DatadogApiKey(string key) Key = key; } - /// Initializes a new instance of DatadogApiKey. + /// Initializes a new instance of . /// The user that created the API key. /// The name of the API key. /// The value of the API key. /// The time of creation of the API key. - internal DatadogApiKey(string createdBy, string name, string key, string created) + /// Keeps track of any properties unknown to the library. + internal DatadogApiKey(string createdBy, string name, string key, string created, Dictionary serializedAdditionalRawData) { CreatedBy = createdBy; Name = name; Key = key; Created = created; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatadogApiKey() + { } /// The user that created the API key. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.Serialization.cs index d05d4403f370..c39f277d0ed8 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class DatadogApiKeyListResponse + internal partial class DatadogApiKeyListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogApiKeyListResponse DeserializeDatadogApiKeyListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogApiKeyListResponse DeserializeDatadogApiKeyListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static DatadogApiKeyListResponse DeserializeDatadogApiKeyListResponse(J nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogApiKeyListResponse(Optional.ToList(value), nextLink.Value); + return new DatadogApiKeyListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DatadogApiKeyListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogApiKeyListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogApiKeyListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogApiKeyListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogApiKeyListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogApiKeyListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogApiKeyListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.cs index 64e1d6693e02..f5645e5ad0dc 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogApiKeyListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class DatadogApiKeyListResponse { - /// Initializes a new instance of DatadogApiKeyListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogApiKeyListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatadogApiKeyListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal DatadogApiKeyListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DatadogApiKeyListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.Serialization.cs index 82044faa6413..f17760861be3 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.Serialization.cs @@ -5,16 +5,80 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogHost + public partial class DatadogHost : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogHost DeserializeDatadogHost(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Aliases)) + { + writer.WritePropertyName("aliases"u8); + writer.WriteStartArray(); + foreach (var item in Aliases) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Apps)) + { + writer.WritePropertyName("apps"u8); + writer.WriteStartArray(); + foreach (var item in Apps) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Meta)) + { + writer.WritePropertyName("meta"u8); + if (Meta is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Meta).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogHost DeserializeDatadogHost(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +87,7 @@ internal static DatadogHost DeserializeDatadogHost(JsonElement element) Optional> aliases = default; Optional> apps = default; Optional meta = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -67,8 +132,61 @@ internal static DatadogHost DeserializeDatadogHost(JsonElement element) meta = DatadogHostMetadata.DeserializeDatadogHostMetadata(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogHost(name.Value, Optional.ToList(aliases), Optional.ToList(apps), meta.Value); + return new DatadogHost(name.Value, Optional.ToList(aliases), Optional.ToList(apps), meta.Value, serializedAdditionalRawData); + } + + DatadogHost IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogHost(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogHost IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogHost(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogHost model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogHost(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogHost(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.cs index a2d015101e29..3c109700f26c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHost.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.Datadog.Models /// The DatadogHost. public partial class DatadogHost { - /// Initializes a new instance of DatadogHost. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogHost() { Aliases = new ChangeTrackingList(); Apps = new ChangeTrackingList(); } - /// Initializes a new instance of DatadogHost. + /// Initializes a new instance of . /// The name of the host. /// The aliases for the host. /// The Datadog integrations reporting metrics for the host. /// - internal DatadogHost(string name, IReadOnlyList aliases, IReadOnlyList apps, DatadogHostMetadata meta) + /// Keeps track of any properties unknown to the library. + internal DatadogHost(string name, IReadOnlyList aliases, IReadOnlyList apps, DatadogHostMetadata meta, Dictionary serializedAdditionalRawData) { Name = name; Aliases = aliases; Apps = apps; Meta = meta; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the host. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.Serialization.cs index c61bb17cfe0b..43c634f96992 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class DatadogHostListResponse + internal partial class DatadogHostListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogHostListResponse DeserializeDatadogHostListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogHostListResponse DeserializeDatadogHostListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static DatadogHostListResponse DeserializeDatadogHostListResponse(JsonE nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogHostListResponse(Optional.ToList(value), nextLink.Value); + return new DatadogHostListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DatadogHostListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogHostListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogHostListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogHostListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogHostListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogHostListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogHostListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.cs index ed4140a79a28..4990cf8dce6b 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class DatadogHostListResponse { - /// Initializes a new instance of DatadogHostListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogHostListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatadogHostListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal DatadogHostListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DatadogHostListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.Serialization.cs index 94050bffe023..697d652b6f2f 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.Serialization.cs @@ -5,15 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogHostMetadata + public partial class DatadogHostMetadata : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogHostMetadata DeserializeDatadogHostMetadata(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AgentVersion)) + { + writer.WritePropertyName("agentVersion"u8); + writer.WriteStringValue(AgentVersion); + } + if (Optional.IsDefined(InstallMethod)) + { + writer.WritePropertyName("installMethod"u8); + if (InstallMethod is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)InstallMethod).Serialize(writer, options); + } + } + if (Optional.IsDefined(LogsAgent)) + { + writer.WritePropertyName("logsAgent"u8); + if (LogsAgent is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogsAgent).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogHostMetadata DeserializeDatadogHostMetadata(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +78,7 @@ internal static DatadogHostMetadata DeserializeDatadogHostMetadata(JsonElement e Optional agentVersion = default; Optional installMethod = default; Optional logsAgent = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("agentVersion"u8)) @@ -46,8 +104,61 @@ internal static DatadogHostMetadata DeserializeDatadogHostMetadata(JsonElement e logsAgent = DatadogLogsAgent.DeserializeDatadogLogsAgent(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogHostMetadata(agentVersion.Value, installMethod.Value, logsAgent.Value); + return new DatadogHostMetadata(agentVersion.Value, installMethod.Value, logsAgent.Value, serializedAdditionalRawData); + } + + DatadogHostMetadata IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogHostMetadata(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogHostMetadata IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogHostMetadata(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogHostMetadata model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogHostMetadata(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogHostMetadata(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.cs index 2b971b56d5a7..7c24b21421f8 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogHostMetadata.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The DatadogHostMetadata. public partial class DatadogHostMetadata { - /// Initializes a new instance of DatadogHostMetadata. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogHostMetadata() { } - /// Initializes a new instance of DatadogHostMetadata. + /// Initializes a new instance of . /// The agent version. /// /// - internal DatadogHostMetadata(string agentVersion, DatadogInstallMethod installMethod, DatadogLogsAgent logsAgent) + /// Keeps track of any properties unknown to the library. + internal DatadogHostMetadata(string agentVersion, DatadogInstallMethod installMethod, DatadogLogsAgent logsAgent, Dictionary serializedAdditionalRawData) { AgentVersion = agentVersion; InstallMethod = installMethod; LogsAgent = logsAgent; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The agent version. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.Serialization.cs index 4a5b1353dc0d..e902f1b6a33b 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.Serialization.cs @@ -5,15 +5,58 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogInstallMethod + public partial class DatadogInstallMethod : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogInstallMethod DeserializeDatadogInstallMethod(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Tool)) + { + writer.WritePropertyName("tool"u8); + writer.WriteStringValue(Tool); + } + if (Optional.IsDefined(ToolVersion)) + { + writer.WritePropertyName("toolVersion"u8); + writer.WriteStringValue(ToolVersion); + } + if (Optional.IsDefined(InstallerVersion)) + { + writer.WritePropertyName("installerVersion"u8); + writer.WriteStringValue(InstallerVersion); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogInstallMethod DeserializeDatadogInstallMethod(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -21,6 +64,7 @@ internal static DatadogInstallMethod DeserializeDatadogInstallMethod(JsonElement Optional tool = default; Optional toolVersion = default; Optional installerVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tool"u8)) @@ -38,8 +82,61 @@ internal static DatadogInstallMethod DeserializeDatadogInstallMethod(JsonElement installerVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogInstallMethod(tool.Value, toolVersion.Value, installerVersion.Value); + return new DatadogInstallMethod(tool.Value, toolVersion.Value, installerVersion.Value, serializedAdditionalRawData); + } + + DatadogInstallMethod IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogInstallMethod(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogInstallMethod IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogInstallMethod(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogInstallMethod model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogInstallMethod(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogInstallMethod(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.cs index 8c0671224188..efbb26e0813b 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogInstallMethod.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The DatadogInstallMethod. public partial class DatadogInstallMethod { - /// Initializes a new instance of DatadogInstallMethod. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogInstallMethod() { } - /// Initializes a new instance of DatadogInstallMethod. + /// Initializes a new instance of . /// The tool. /// The tool version. /// The installer version. - internal DatadogInstallMethod(string tool, string toolVersion, string installerVersion) + /// Keeps track of any properties unknown to the library. + internal DatadogInstallMethod(string tool, string toolVersion, string installerVersion, Dictionary serializedAdditionalRawData) { Tool = tool; ToolVersion = toolVersion; InstallerVersion = installerVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The tool. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.Serialization.cs index 12fdb608beb1..ec1a3af3a60e 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class DatadogLogsAgent + internal partial class DatadogLogsAgent : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogLogsAgent DeserializeDatadogLogsAgent(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Transport)) + { + writer.WritePropertyName("transport"u8); + writer.WriteStringValue(Transport); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogLogsAgent DeserializeDatadogLogsAgent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional transport = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("transport"u8)) @@ -26,8 +60,61 @@ internal static DatadogLogsAgent DeserializeDatadogLogsAgent(JsonElement element transport = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogLogsAgent(transport.Value); + return new DatadogLogsAgent(transport.Value, serializedAdditionalRawData); + } + + DatadogLogsAgent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogLogsAgent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogLogsAgent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogLogsAgent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogLogsAgent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogLogsAgent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogLogsAgent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.cs index a27d9c073179..fa6ff9400f88 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogLogsAgent.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The DatadogLogsAgent. internal partial class DatadogLogsAgent { - /// Initializes a new instance of DatadogLogsAgent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogLogsAgent() { } - /// Initializes a new instance of DatadogLogsAgent. + /// Initializes a new instance of . /// The transport. - internal DatadogLogsAgent(string transport) + /// Keeps track of any properties unknown to the library. + internal DatadogLogsAgent(string transport, Dictionary serializedAdditionalRawData) { Transport = transport; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The transport. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceData.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceData.Serialization.cs index 13b8e5a351fd..b937ec6dbd45 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceData.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceData.Serialization.cs @@ -5,28 +5,49 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Datadog.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Datadog { - public partial class DatadogMonitorResourceData : IUtf8JsonSerializable + public partial class DatadogMonitorResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } } if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsDefined(Identity)) { @@ -46,11 +67,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatadogMonitorResourceData DeserializeDatadogMonitorResourceData(JsonElement element) + internal static DatadogMonitorResourceData DeserializeDatadogMonitorResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +99,7 @@ internal static DatadogMonitorResourceData DeserializeDatadogMonitorResourceData string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -136,8 +172,61 @@ internal static DatadogMonitorResourceData DeserializeDatadogMonitorResourceData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogMonitorResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, properties.Value, identity, serializedAdditionalRawData); + } + + DatadogMonitorResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogMonitorResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogMonitorResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogMonitorResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogMonitorResourceData model) + { + if (model is null) + { + return null; } - return new DatadogMonitorResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, properties.Value, identity); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogMonitorResourceData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogMonitorResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.Serialization.cs index babe622ca696..22e54acddb59 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Datadog; namespace Azure.ResourceManager.Datadog.Models { - internal partial class DatadogMonitorResourceListResponse + internal partial class DatadogMonitorResourceListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogMonitorResourceListResponse DeserializeDatadogMonitorResourceListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogMonitorResourceListResponse DeserializeDatadogMonitorResourceListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DatadogMonitorResourceListResponse DeserializeDatadogMonitorReso nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogMonitorResourceListResponse(Optional.ToList(value), nextLink.Value); + return new DatadogMonitorResourceListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DatadogMonitorResourceListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogMonitorResourceListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogMonitorResourceListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogMonitorResourceListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogMonitorResourceListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogMonitorResourceListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogMonitorResourceListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.cs index 1794bc2796f4..0c854bdb036c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourceListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Datadog; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class DatadogMonitorResourceListResponse { - /// Initializes a new instance of DatadogMonitorResourceListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogMonitorResourceListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatadogMonitorResourceListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal DatadogMonitorResourceListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DatadogMonitorResourceListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.Serialization.cs index 2afce9012c69..1c89d01fa9c4 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.Serialization.cs @@ -5,20 +5,35 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogMonitorResourcePatch : IUtf8JsonSerializable + public partial class DatadogMonitorResourcePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Tags)) { @@ -34,9 +49,131 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku); + if (Sku is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sku).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static DatadogMonitorResourcePatch DeserializeDatadogMonitorResourcePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + Optional sku = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = MonitorUpdateProperties.DeserializeMonitorUpdateProperties(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ResourceSku.DeserializeResourceSku(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogMonitorResourcePatch(properties.Value, Optional.ToDictionary(tags), sku.Value, serializedAdditionalRawData); + } + + DatadogMonitorResourcePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogMonitorResourcePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogMonitorResourcePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogMonitorResourcePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogMonitorResourcePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogMonitorResourcePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogMonitorResourcePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.cs index d6dd96b69939..45998f529cb3 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogMonitorResourcePatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,12 +14,28 @@ namespace Azure.ResourceManager.Datadog.Models /// The parameters for a PATCH request to a monitor resource. public partial class DatadogMonitorResourcePatch { - /// Initializes a new instance of DatadogMonitorResourcePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatadogMonitorResourcePatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The set of properties that can be update in a PATCH request to a monitor resource. + /// The new tags of the monitor resource. + /// + /// Keeps track of any properties unknown to the library. + internal DatadogMonitorResourcePatch(MonitorUpdateProperties properties, IDictionary tags, ResourceSku sku, Dictionary serializedAdditionalRawData) + { + Properties = properties; + Tags = tags; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The set of properties that can be update in a PATCH request to a monitor resource. internal MonitorUpdateProperties Properties { get; set; } /// Flag specifying if the resource monitoring is enabled or disabled. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.Serialization.cs index e1ec0a19455f..135408b8639c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogOrganizationProperties : IUtf8JsonSerializable + public partial class DatadogOrganizationProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkingAuthCode)) { @@ -46,11 +53,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enterpriseAppId"u8); writer.WriteStringValue(EnterpriseAppId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatadogOrganizationProperties DeserializeDatadogOrganizationProperties(JsonElement element) + internal static DatadogOrganizationProperties DeserializeDatadogOrganizationProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -63,6 +84,7 @@ internal static DatadogOrganizationProperties DeserializeDatadogOrganizationProp Optional apiKey = default; Optional applicationKey = default; Optional enterpriseAppId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -109,8 +131,61 @@ internal static DatadogOrganizationProperties DeserializeDatadogOrganizationProp enterpriseAppId = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogOrganizationProperties(name.Value, id.Value, linkingAuthCode.Value, linkingClientId.Value, redirectUri.Value, apiKey.Value, applicationKey.Value, enterpriseAppId.Value, serializedAdditionalRawData); + } + + DatadogOrganizationProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogOrganizationProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogOrganizationProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogOrganizationProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogOrganizationProperties model) + { + if (model is null) + { + return null; } - return new DatadogOrganizationProperties(name.Value, id.Value, linkingAuthCode.Value, linkingClientId.Value, redirectUri.Value, apiKey.Value, applicationKey.Value, enterpriseAppId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogOrganizationProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogOrganizationProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs index 2eb74f50d08b..f2b347b0ef68 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs @@ -6,18 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Datadog.Models { /// Datadog organization properties. public partial class DatadogOrganizationProperties { - /// Initializes a new instance of DatadogOrganizationProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatadogOrganizationProperties() { } - /// Initializes a new instance of DatadogOrganizationProperties. + /// Initializes a new instance of . /// Name of the Datadog organization. /// Id of the Datadog organization. /// The auth code used to linking to an existing datadog organization. @@ -26,7 +30,8 @@ public DatadogOrganizationProperties() /// Api key associated to the Datadog organization. /// Application key associated to the Datadog organization. /// The Id of the Enterprise App used for Single sign on. - internal DatadogOrganizationProperties(string name, string id, string linkingAuthCode, string linkingClientId, Uri redirectUri, string apiKey, string applicationKey, string enterpriseAppId) + /// Keeps track of any properties unknown to the library. + internal DatadogOrganizationProperties(string name, string id, string linkingAuthCode, string linkingClientId, Uri redirectUri, string apiKey, string applicationKey, string enterpriseAppId, Dictionary serializedAdditionalRawData) { Name = name; Id = id; @@ -36,6 +41,7 @@ internal DatadogOrganizationProperties(string name, string id, string linkingAut ApiKey = apiKey; ApplicationKey = applicationKey; EnterpriseAppId = enterpriseAppId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the Datadog organization. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.Serialization.cs index 2637233fe5ca..a3c92f98dac3 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogSetPasswordLink + public partial class DatadogSetPasswordLink : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogSetPasswordLink DeserializeDatadogSetPasswordLink(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(SetPasswordLink)) + { + writer.WritePropertyName("setPasswordLink"u8); + writer.WriteStringValue(SetPasswordLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogSetPasswordLink DeserializeDatadogSetPasswordLink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional setPasswordLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("setPasswordLink"u8)) @@ -26,8 +60,61 @@ internal static DatadogSetPasswordLink DeserializeDatadogSetPasswordLink(JsonEle setPasswordLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogSetPasswordLink(setPasswordLink.Value); + return new DatadogSetPasswordLink(setPasswordLink.Value, serializedAdditionalRawData); + } + + DatadogSetPasswordLink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogSetPasswordLink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogSetPasswordLink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogSetPasswordLink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogSetPasswordLink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogSetPasswordLink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogSetPasswordLink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.cs index bff4a94c0556..615e7f435c02 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSetPasswordLink.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The DatadogSetPasswordLink. public partial class DatadogSetPasswordLink { - /// Initializes a new instance of DatadogSetPasswordLink. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogSetPasswordLink() { } - /// Initializes a new instance of DatadogSetPasswordLink. + /// Initializes a new instance of . /// - internal DatadogSetPasswordLink(string setPasswordLink) + /// Keeps track of any properties unknown to the library. + internal DatadogSetPasswordLink(string setPasswordLink, Dictionary serializedAdditionalRawData) { SetPasswordLink = setPasswordLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the set password link. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.Serialization.cs index 507b87cb4245..0be70c6ba551 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class DatadogSingleSignOnProperties : IUtf8JsonSerializable + public partial class DatadogSingleSignOnProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SingleSignOnState)) { @@ -26,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enterpriseAppId"u8); writer.WriteStringValue(EnterpriseAppId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatadogSingleSignOnProperties DeserializeDatadogSingleSignOnProperties(JsonElement element) + internal static DatadogSingleSignOnProperties DeserializeDatadogSingleSignOnProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -39,6 +60,7 @@ internal static DatadogSingleSignOnProperties DeserializeDatadogSingleSignOnProp Optional singleSignOnState = default; Optional enterpriseAppId = default; Optional singleSignOnUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -73,8 +95,61 @@ internal static DatadogSingleSignOnProperties DeserializeDatadogSingleSignOnProp singleSignOnUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogSingleSignOnProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(singleSignOnState), enterpriseAppId.Value, singleSignOnUrl.Value, serializedAdditionalRawData); + } + + DatadogSingleSignOnProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogSingleSignOnProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogSingleSignOnProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogSingleSignOnProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogSingleSignOnProperties model) + { + if (model is null) + { + return null; } - return new DatadogSingleSignOnProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(singleSignOnState), enterpriseAppId.Value, singleSignOnUrl.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogSingleSignOnProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogSingleSignOnProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs index 78fc7d65dfca..c8e86cfda409 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs @@ -6,28 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.Datadog.Models { /// The DatadogSingleSignOnProperties. public partial class DatadogSingleSignOnProperties { - /// Initializes a new instance of DatadogSingleSignOnProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatadogSingleSignOnProperties() { } - /// Initializes a new instance of DatadogSingleSignOnProperties. + /// Initializes a new instance of . /// /// Various states of the SSO resource. /// The Id of the Enterprise App used for Single sign-on. /// The login URL specific to this Datadog Organization. - internal DatadogSingleSignOnProperties(ProvisioningState? provisioningState, SingleSignOnState? singleSignOnState, string enterpriseAppId, Uri singleSignOnUri) + /// Keeps track of any properties unknown to the library. + internal DatadogSingleSignOnProperties(ProvisioningState? provisioningState, SingleSignOnState? singleSignOnState, string enterpriseAppId, Uri singleSignOnUri, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; SingleSignOnState = singleSignOnState; EnterpriseAppId = enterpriseAppId; SingleSignOnUri = singleSignOnUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the provisioning state. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceData.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceData.Serialization.cs index fa010eea9c53..696d095af01c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceData.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Datadog.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Datadog { - public partial class DatadogSingleSignOnResourceData : IUtf8JsonSerializable + public partial class DatadogSingleSignOnResourceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DatadogSingleSignOnResourceData DeserializeDatadogSingleSignOnResourceData(JsonElement element) + internal static DatadogSingleSignOnResourceData DeserializeDatadogSingleSignOnResourceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static DatadogSingleSignOnResourceData DeserializeDatadogSingleSignOnRe string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static DatadogSingleSignOnResourceData DeserializeDatadogSingleSignOnRe systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatadogSingleSignOnResourceData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + DatadogSingleSignOnResourceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogSingleSignOnResourceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogSingleSignOnResourceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogSingleSignOnResourceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogSingleSignOnResourceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogSingleSignOnResourceData(Response response) + { + if (response is null) + { + return null; } - return new DatadogSingleSignOnResourceData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogSingleSignOnResourceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.Serialization.cs index d48ffdf4017a..8a2c425fe745 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Datadog; namespace Azure.ResourceManager.Datadog.Models { - internal partial class DatadogSingleSignOnResourceListResponse + internal partial class DatadogSingleSignOnResourceListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DatadogSingleSignOnResourceListResponse DeserializeDatadogSingleSignOnResourceListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DatadogSingleSignOnResourceListResponse DeserializeDatadogSingleSignOnResourceListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static DatadogSingleSignOnResourceListResponse DeserializeDatadogSingle nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatadogSingleSignOnResourceListResponse(Optional.ToList(value), nextLink.Value); + return new DatadogSingleSignOnResourceListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DatadogSingleSignOnResourceListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatadogSingleSignOnResourceListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatadogSingleSignOnResourceListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatadogSingleSignOnResourceListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatadogSingleSignOnResourceListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatadogSingleSignOnResourceListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatadogSingleSignOnResourceListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.cs index 2b4c0e4c2740..b29dc0ae5c18 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/DatadogSingleSignOnResourceListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Datadog; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class DatadogSingleSignOnResourceListResponse { - /// Initializes a new instance of DatadogSingleSignOnResourceListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DatadogSingleSignOnResourceListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DatadogSingleSignOnResourceListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal DatadogSingleSignOnResourceListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DatadogSingleSignOnResourceListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.Serialization.cs index 370d8c453ce8..4ba7ff982bd6 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class FilteringTag : IUtf8JsonSerializable + public partial class FilteringTag : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("action"u8); writer.WriteStringValue(Action.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FilteringTag DeserializeFilteringTag(JsonElement element) + internal static FilteringTag DeserializeFilteringTag(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static FilteringTag DeserializeFilteringTag(JsonElement element) Optional name = default; Optional value = default; Optional action = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +86,61 @@ internal static FilteringTag DeserializeFilteringTag(JsonElement element) action = new TagAction(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FilteringTag(name.Value, value.Value, Optional.ToNullable(action), serializedAdditionalRawData); + } + + FilteringTag IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFilteringTag(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FilteringTag IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFilteringTag(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FilteringTag model) + { + if (model is null) + { + return null; } - return new FilteringTag(name.Value, value.Value, Optional.ToNullable(action)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FilteringTag(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFilteringTag(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.cs index fccca60c8c8b..d9ea2f6332b6 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/FilteringTag.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. public partial class FilteringTag { - /// Initializes a new instance of FilteringTag. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FilteringTag() { } - /// Initializes a new instance of FilteringTag. + /// Initializes a new instance of . /// The name (also known as the key) of the tag. /// The value of the tag. /// Valid actions for a filtering tag. Exclusion takes priority over inclusion. - internal FilteringTag(string name, string value, TagAction? action) + /// Keeps track of any properties unknown to the library. + internal FilteringTag(string name, string value, TagAction? action, Dictionary serializedAdditionalRawData) { Name = name; Value = value; Action = action; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name (also known as the key) of the tag. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.Serialization.cs index ce5b35c7a354..13c637f8380e 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.Serialization.cs @@ -5,23 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Datadog.Models { - internal partial class LinkedResourceListResponse + internal partial class LinkedResourceListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LinkedResourceListResponse DeserializeLinkedResourceListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LinkedResourceListResponse DeserializeLinkedResourceListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +86,61 @@ internal static LinkedResourceListResponse DeserializeLinkedResourceListResponse nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LinkedResourceListResponse(Optional.ToList(value), nextLink.Value); + return new LinkedResourceListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + LinkedResourceListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedResourceListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedResourceListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedResourceListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedResourceListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedResourceListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedResourceListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.cs index 3aed7b46f579..0c4fabc53daf 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LinkedResourceListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class LinkedResourceListResponse { - /// Initializes a new instance of LinkedResourceListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LinkedResourceListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of LinkedResourceListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal LinkedResourceListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal LinkedResourceListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.Serialization.cs index 99171d419676..5b3b0bc6d418 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class LogRules : IUtf8JsonSerializable + public partial class LogRules : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SendAadLogs)) { @@ -37,15 +44,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FilteringTags) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LogRules DeserializeLogRules(JsonElement element) + internal static LogRules DeserializeLogRules(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +82,7 @@ internal static LogRules DeserializeLogRules(JsonElement element) Optional sendSubscriptionLogs = default; Optional sendResourceLogs = default; Optional> filteringTags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sendAadLogs"u8)) @@ -97,8 +126,61 @@ internal static LogRules DeserializeLogRules(JsonElement element) filteringTags = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LogRules(Optional.ToNullable(sendAadLogs), Optional.ToNullable(sendSubscriptionLogs), Optional.ToNullable(sendResourceLogs), Optional.ToList(filteringTags), serializedAdditionalRawData); + } + + LogRules IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLogRules(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LogRules IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLogRules(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LogRules model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LogRules(Response response) + { + if (response is null) + { + return null; } - return new LogRules(Optional.ToNullable(sendAadLogs), Optional.ToNullable(sendSubscriptionLogs), Optional.ToNullable(sendResourceLogs), Optional.ToList(filteringTags)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLogRules(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.cs index 6d746767d17e..bb7255e3ac79 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/LogRules.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,23 +14,28 @@ namespace Azure.ResourceManager.Datadog.Models /// Set of rules for sending logs for the Monitor resource. public partial class LogRules { - /// Initializes a new instance of LogRules. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public LogRules() { FilteringTags = new ChangeTrackingList(); } - /// Initializes a new instance of LogRules. + /// Initializes a new instance of . /// Flag specifying if AAD logs should be sent for the Monitor resource. /// Flag specifying if Azure subscription logs should be sent for the Monitor resource. /// Flag specifying if Azure resource logs should be sent for the Monitor resource. /// List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - internal LogRules(bool? sendAadLogs, bool? sendSubscriptionLogs, bool? sendResourceLogs, IList filteringTags) + /// Keeps track of any properties unknown to the library. + internal LogRules(bool? sendAadLogs, bool? sendSubscriptionLogs, bool? sendResourceLogs, IList filteringTags, Dictionary serializedAdditionalRawData) { SendAadLogs = sendAadLogs; SendSubscriptionLogs = sendSubscriptionLogs; SendResourceLogs = sendResourceLogs; FilteringTags = filteringTags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Flag specifying if AAD logs should be sent for the Monitor resource. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.Serialization.cs index dcaf125e8716..586750ad615e 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class MetricRules : IUtf8JsonSerializable + internal partial class MetricRules : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(FilteringTags)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FilteringTags) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MetricRules DeserializeMetricRules(JsonElement element) + internal static MetricRules DeserializeMetricRules(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> filteringTags = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("filteringTags"u8)) @@ -52,8 +81,61 @@ internal static MetricRules DeserializeMetricRules(JsonElement element) filteringTags = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MetricRules(Optional.ToList(filteringTags), serializedAdditionalRawData); + } + + MetricRules IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMetricRules(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MetricRules IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMetricRules(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MetricRules model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MetricRules(Response response) + { + if (response is null) + { + return null; } - return new MetricRules(Optional.ToList(filteringTags)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMetricRules(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.cs index d080abf31a2d..6744f3930304 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MetricRules.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.Datadog.Models /// Set of rules for sending metrics for the Monitor resource. internal partial class MetricRules { - /// Initializes a new instance of MetricRules. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MetricRules() { FilteringTags = new ChangeTrackingList(); } - /// Initializes a new instance of MetricRules. + /// Initializes a new instance of . /// List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - internal MetricRules(IList filteringTags) + /// Keeps track of any properties unknown to the library. + internal MetricRules(IList filteringTags, Dictionary serializedAdditionalRawData) { FilteringTags = filteringTags; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.Serialization.cs index 4aefe2daec08..b529023d9863 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class MonitorProperties : IUtf8JsonSerializable + public partial class MonitorProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MonitoringStatus)) { @@ -23,18 +31,46 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DatadogOrganizationProperties)) { writer.WritePropertyName("datadogOrganizationProperties"u8); - writer.WriteObjectValue(DatadogOrganizationProperties); + if (DatadogOrganizationProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DatadogOrganizationProperties).Serialize(writer, options); + } } if (Optional.IsDefined(UserInfo)) { writer.WritePropertyName("userInfo"u8); - writer.WriteObjectValue(UserInfo); + if (UserInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UserInfo).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MonitorProperties DeserializeMonitorProperties(JsonElement element) + internal static MonitorProperties DeserializeMonitorProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,6 +82,7 @@ internal static MonitorProperties DeserializeMonitorProperties(JsonElement eleme Optional userInfo = default; Optional liftrResourceCategory = default; Optional liftrResourcePreference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -111,8 +148,61 @@ internal static MonitorProperties DeserializeMonitorProperties(JsonElement eleme liftrResourcePreference = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MonitorProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(monitoringStatus), Optional.ToNullable(marketplaceSubscriptionStatus), datadogOrganizationProperties.Value, userInfo.Value, Optional.ToNullable(liftrResourceCategory), Optional.ToNullable(liftrResourcePreference), serializedAdditionalRawData); + } + + MonitorProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitorProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitorProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitorProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitorProperties model) + { + if (model is null) + { + return null; } - return new MonitorProperties(Optional.ToNullable(provisioningState), Optional.ToNullable(monitoringStatus), Optional.ToNullable(marketplaceSubscriptionStatus), datadogOrganizationProperties.Value, userInfo.Value, Optional.ToNullable(liftrResourceCategory), Optional.ToNullable(liftrResourcePreference)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitorProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitorProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.cs index fce23ce4dc61..45611348a82d 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorProperties.cs @@ -5,17 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// Properties specific to the monitor resource. public partial class MonitorProperties { - /// Initializes a new instance of MonitorProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MonitorProperties() { } - /// Initializes a new instance of MonitorProperties. + /// Initializes a new instance of . /// /// Flag specifying if the resource monitoring is enabled or disabled. /// Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource will go in Suspended state. @@ -23,7 +29,8 @@ public MonitorProperties() /// User info. /// /// The priority of the resource. - internal MonitorProperties(ProvisioningState? provisioningState, MonitoringStatus? monitoringStatus, MarketplaceSubscriptionStatus? marketplaceSubscriptionStatus, DatadogOrganizationProperties datadogOrganizationProperties, UserInfo userInfo, LiftrResourceCategory? liftrResourceCategory, int? liftrResourcePreference) + /// Keeps track of any properties unknown to the library. + internal MonitorProperties(ProvisioningState? provisioningState, MonitoringStatus? monitoringStatus, MarketplaceSubscriptionStatus? marketplaceSubscriptionStatus, DatadogOrganizationProperties datadogOrganizationProperties, UserInfo userInfo, LiftrResourceCategory? liftrResourceCategory, int? liftrResourcePreference, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; MonitoringStatus = monitoringStatus; @@ -32,6 +39,7 @@ internal MonitorProperties(ProvisioningState? provisioningState, MonitoringStatu UserInfo = userInfo; LiftrResourceCategory = liftrResourceCategory; LiftrResourcePreference = liftrResourcePreference; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the provisioning state. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.Serialization.cs index 18b9d48561e8..af90da7c1749 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class MonitorUpdateProperties : IUtf8JsonSerializable + internal partial class MonitorUpdateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MonitoringStatus)) { writer.WritePropertyName("monitoringStatus"u8); writer.WriteStringValue(MonitoringStatus.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static MonitorUpdateProperties DeserializeMonitorUpdateProperties(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional monitoringStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("monitoringStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monitoringStatus = new MonitoringStatus(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MonitorUpdateProperties(Optional.ToNullable(monitoringStatus), serializedAdditionalRawData); + } + + MonitorUpdateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitorUpdateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitorUpdateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitorUpdateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitorUpdateProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitorUpdateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitorUpdateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.cs index 7801e11aceae..76b24e4056a0 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitorUpdateProperties.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The set of properties that can be update in a PATCH request to a monitor resource. internal partial class MonitorUpdateProperties { - /// Initializes a new instance of MonitorUpdateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MonitorUpdateProperties() { } + /// Initializes a new instance of . + /// Flag specifying if the resource monitoring is enabled or disabled. + /// Keeps track of any properties unknown to the library. + internal MonitorUpdateProperties(MonitoringStatus? monitoringStatus, Dictionary serializedAdditionalRawData) + { + MonitoringStatus = monitoringStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Flag specifying if the resource monitoring is enabled or disabled. public MonitoringStatus? MonitoringStatus { get; set; } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.Serialization.cs index 841491aa9061..bb2275304311 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.Serialization.cs @@ -5,15 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class MonitoredResource + public partial class MonitoredResource : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MonitoredResource DeserializeMonitoredResource(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(SendingMetrics)) + { + writer.WritePropertyName("sendingMetrics"u8); + writer.WriteBooleanValue(SendingMetrics.Value); + } + if (Optional.IsDefined(ReasonForMetricsStatus)) + { + writer.WritePropertyName("reasonForMetricsStatus"u8); + writer.WriteStringValue(ReasonForMetricsStatus); + } + if (Optional.IsDefined(SendingLogs)) + { + writer.WritePropertyName("sendingLogs"u8); + writer.WriteBooleanValue(SendingLogs.Value); + } + if (Optional.IsDefined(ReasonForLogsStatus)) + { + writer.WritePropertyName("reasonForLogsStatus"u8); + writer.WriteStringValue(ReasonForLogsStatus); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MonitoredResource DeserializeMonitoredResource(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -23,6 +76,7 @@ internal static MonitoredResource DeserializeMonitoredResource(JsonElement eleme Optional reasonForMetricsStatus = default; Optional sendingLogs = default; Optional reasonForLogsStatus = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -58,8 +112,61 @@ internal static MonitoredResource DeserializeMonitoredResource(JsonElement eleme reasonForLogsStatus = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MonitoredResource(id.Value, Optional.ToNullable(sendingMetrics), reasonForMetricsStatus.Value, Optional.ToNullable(sendingLogs), reasonForLogsStatus.Value); + return new MonitoredResource(id.Value, Optional.ToNullable(sendingMetrics), reasonForMetricsStatus.Value, Optional.ToNullable(sendingLogs), reasonForLogsStatus.Value, serializedAdditionalRawData); + } + + MonitoredResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoredResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoredResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoredResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoredResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoredResource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoredResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.cs index 519d5d46ed52..09defd11379c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResource.cs @@ -5,29 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// The properties of a resource currently being monitored by the Datadog monitor resource. public partial class MonitoredResource { - /// Initializes a new instance of MonitoredResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MonitoredResource() { } - /// Initializes a new instance of MonitoredResource. + /// Initializes a new instance of . /// The ARM id of the resource. /// Flag indicating if resource is sending metrics to Datadog. /// Reason for why the resource is sending metrics (or why it is not sending). /// Flag indicating if resource is sending logs to Datadog. /// Reason for why the resource is sending logs (or why it is not sending). - internal MonitoredResource(string id, bool? sendingMetrics, string reasonForMetricsStatus, bool? sendingLogs, string reasonForLogsStatus) + /// Keeps track of any properties unknown to the library. + internal MonitoredResource(string id, bool? sendingMetrics, string reasonForMetricsStatus, bool? sendingLogs, string reasonForLogsStatus, Dictionary serializedAdditionalRawData) { Id = id; SendingMetrics = sendingMetrics; ReasonForMetricsStatus = reasonForMetricsStatus; SendingLogs = sendingLogs; ReasonForLogsStatus = reasonForLogsStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ARM id of the resource. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs index fa93233de0ea..75f4d9128044 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class MonitoredResourceListResponse + internal partial class MonitoredResourceListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MonitoredResourceListResponse DeserializeMonitoredResourceListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MonitoredResourceListResponse DeserializeMonitoredResourceListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static MonitoredResourceListResponse DeserializeMonitoredResourceListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MonitoredResourceListResponse(Optional.ToList(value), nextLink.Value); + return new MonitoredResourceListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MonitoredResourceListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoredResourceListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoredResourceListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoredResourceListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoredResourceListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoredResourceListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoredResourceListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.cs index 93bab0115d6d..3406763f394a 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoredResourceListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class MonitoredResourceListResponse { - /// Initializes a new instance of MonitoredResourceListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MonitoredResourceListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MonitoredResourceListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal MonitoredResourceListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MonitoredResourceListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRuleData.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRuleData.Serialization.cs index b722ae839bc9..b1fc14336c29 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRuleData.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRuleData.Serialization.cs @@ -5,28 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Datadog.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Datadog { - public partial class MonitoringTagRuleData : IUtf8JsonSerializable + public partial class MonitoringTagRuleData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MonitoringTagRuleData DeserializeMonitoringTagRuleData(JsonElement element) + internal static MonitoringTagRuleData DeserializeMonitoringTagRuleData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static MonitoringTagRuleData DeserializeMonitoringTagRuleData(JsonEleme string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -71,8 +101,61 @@ internal static MonitoringTagRuleData DeserializeMonitoringTagRuleData(JsonEleme systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MonitoringTagRuleData(id, name, type, systemData.Value, properties.Value, serializedAdditionalRawData); + } + + MonitoringTagRuleData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoringTagRuleData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoringTagRuleData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoringTagRuleData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoringTagRuleData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoringTagRuleData(Response response) + { + if (response is null) + { + return null; } - return new MonitoringTagRuleData(id, name, type, systemData.Value, properties.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoringTagRuleData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs index 3a4e3afe9df0..60da9a5946d9 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs @@ -5,23 +5,73 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Datadog; namespace Azure.ResourceManager.Datadog.Models { - internal partial class MonitoringTagRulesListResponse + internal partial class MonitoringTagRulesListResponse : IUtf8JsonSerializable, IModelJsonSerializable { - internal static MonitoringTagRulesListResponse DeserializeMonitoringTagRulesListResponse(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static MonitoringTagRulesListResponse DeserializeMonitoringTagRulesListResponse(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -43,8 +93,61 @@ internal static MonitoringTagRulesListResponse DeserializeMonitoringTagRulesList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MonitoringTagRulesListResponse(Optional.ToList(value), nextLink.Value); + return new MonitoringTagRulesListResponse(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + MonitoringTagRulesListResponse IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoringTagRulesListResponse(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoringTagRulesListResponse IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoringTagRulesListResponse(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoringTagRulesListResponse model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoringTagRulesListResponse(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoringTagRulesListResponse(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.cs index ed8e1b7ebda9..f1469d9d9b71 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesListResponse.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Datadog; @@ -14,19 +15,24 @@ namespace Azure.ResourceManager.Datadog.Models /// Response of a list operation. internal partial class MonitoringTagRulesListResponse { - /// Initializes a new instance of MonitoringTagRulesListResponse. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal MonitoringTagRulesListResponse() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of MonitoringTagRulesListResponse. + /// Initializes a new instance of . /// Results of a list operation. /// Link to the next set of results, if any. - internal MonitoringTagRulesListResponse(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal MonitoringTagRulesListResponse(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Results of a list operation. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs index 5de6bd3c0d7d..deea7fd9ee2b 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs @@ -5,31 +5,67 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class MonitoringTagRulesProperties : IUtf8JsonSerializable + public partial class MonitoringTagRulesProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LogRules)) { writer.WritePropertyName("logRules"u8); - writer.WriteObjectValue(LogRules); + if (LogRules is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogRules).Serialize(writer, options); + } } if (Optional.IsDefined(MetricRules)) { writer.WritePropertyName("metricRules"u8); - writer.WriteObjectValue(MetricRules); + if (MetricRules is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)MetricRules).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MonitoringTagRulesProperties DeserializeMonitoringTagRulesProperties(JsonElement element) + internal static MonitoringTagRulesProperties DeserializeMonitoringTagRulesProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +73,7 @@ internal static MonitoringTagRulesProperties DeserializeMonitoringTagRulesProper Optional provisioningState = default; Optional logRules = default; Optional metricRules = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -66,8 +103,61 @@ internal static MonitoringTagRulesProperties DeserializeMonitoringTagRulesProper metricRules = MetricRules.DeserializeMetricRules(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MonitoringTagRulesProperties(Optional.ToNullable(provisioningState), logRules.Value, metricRules.Value, serializedAdditionalRawData); + } + + MonitoringTagRulesProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoringTagRulesProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MonitoringTagRulesProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMonitoringTagRulesProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MonitoringTagRulesProperties model) + { + if (model is null) + { + return null; } - return new MonitoringTagRulesProperties(Optional.ToNullable(provisioningState), logRules.Value, metricRules.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MonitoringTagRulesProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMonitoringTagRulesProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs index 4d064bf580fe..dfd2c7f6af2d 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; namespace Azure.ResourceManager.Datadog.Models @@ -12,20 +13,25 @@ namespace Azure.ResourceManager.Datadog.Models /// Definition of the properties for a TagRules resource. public partial class MonitoringTagRulesProperties { - /// Initializes a new instance of MonitoringTagRulesProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MonitoringTagRulesProperties() { } - /// Initializes a new instance of MonitoringTagRulesProperties. + /// Initializes a new instance of . /// /// Set of rules for sending logs for the Monitor resource. /// Set of rules for sending metrics for the Monitor resource. - internal MonitoringTagRulesProperties(ProvisioningState? provisioningState, LogRules logRules, MetricRules metricRules) + /// Keeps track of any properties unknown to the library. + internal MonitoringTagRulesProperties(ProvisioningState? provisioningState, LogRules logRules, MetricRules metricRules, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; LogRules = logRules; MetricRules = metricRules; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the provisioning state. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.Serialization.cs index ac2880a2d91f..6d184c1a4d9c 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.Serialization.cs @@ -5,28 +5,51 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - internal partial class ResourceSku : IUtf8JsonSerializable + internal partial class ResourceSku : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ResourceSku DeserializeResourceSku(JsonElement element) + internal static ResourceSku DeserializeResourceSku(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -34,8 +57,61 @@ internal static ResourceSku DeserializeResourceSku(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ResourceSku(name, serializedAdditionalRawData); + } + + ResourceSku IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSku(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResourceSku IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResourceSku(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResourceSku model) + { + if (model is null) + { + return null; } - return new ResourceSku(name); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResourceSku(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResourceSku(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.cs index 57c9afc74c20..03407d7311ca 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/ResourceSku.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Datadog.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.Datadog.Models /// The ResourceSku. internal partial class ResourceSku { - /// Initializes a new instance of ResourceSku. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Name of the SKU. /// is null. public ResourceSku(string name) @@ -23,6 +27,20 @@ public ResourceSku(string name) Name = name; } + /// Initializes a new instance of . + /// Name of the SKU. + /// Keeps track of any properties unknown to the library. + internal ResourceSku(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSku() + { + } + /// Name of the SKU. public string Name { get; set; } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.Serialization.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.Serialization.cs index ed3a95bf3d82..88445d8da0a6 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.Serialization.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.Datadog.Models { - public partial class UserInfo : IUtf8JsonSerializable + public partial class UserInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("phoneNumber"u8); writer.WriteStringValue(PhoneNumber); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static UserInfo DeserializeUserInfo(JsonElement element) + internal static UserInfo DeserializeUserInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static UserInfo DeserializeUserInfo(JsonElement element) Optional name = default; Optional emailAddress = default; Optional phoneNumber = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +82,61 @@ internal static UserInfo DeserializeUserInfo(JsonElement element) phoneNumber = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UserInfo(name.Value, emailAddress.Value, phoneNumber.Value, serializedAdditionalRawData); + } + + UserInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeUserInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + UserInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeUserInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(UserInfo model) + { + if (model is null) + { + return null; } - return new UserInfo(name.Value, emailAddress.Value, phoneNumber.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator UserInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeUserInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.cs index 0a8561a6432a..8c1bc46b0e51 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Models/UserInfo.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.Datadog.Models { /// User info. public partial class UserInfo { - /// Initializes a new instance of UserInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public UserInfo() { } - /// Initializes a new instance of UserInfo. + /// Initializes a new instance of . /// Name of the user. /// Email of the user used by Datadog for contacting them if needed. /// Phone number of the user used by Datadog for contacting them if needed. - internal UserInfo(string name, string emailAddress, string phoneNumber) + /// Keeps track of any properties unknown to the library. + internal UserInfo(string name, string emailAddress, string phoneNumber, Dictionary serializedAdditionalRawData) { Name = name; EmailAddress = emailAddress; PhoneNumber = phoneNumber; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the user. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs index e47b6d307772..551863c0c37e 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation { HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoringTagRuleTagRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoringTagRuleTagRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitoringTagRuleResource(Client, MonitoringTagRuleData.DeserializeMonitoringTagRuleData(e)), _monitoringTagRuleTagRulesClientDiagnostics, Pipeline, "MonitoringTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new MonitoringTagRuleResource(Client, MonitoringTagRuleData.DeserializeMonitoringTagRuleData(e)), _monitoringTagRuleTagRulesClientDiagnostics, Pipeline, "MonitoringTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationToken canc { HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoringTagRuleTagRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoringTagRuleTagRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitoringTagRuleResource(Client, MonitoringTagRuleData.DeserializeMonitoringTagRuleData(e)), _monitoringTagRuleTagRulesClientDiagnostics, Pipeline, "MonitoringTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new MonitoringTagRuleResource(Client, MonitoringTagRuleData.DeserializeMonitoringTagRuleData(e)), _monitoringTagRuleTagRulesClientDiagnostics, Pipeline, "MonitoringTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleData.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleData.cs index 2ae8198e678f..51938e308cb7 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleData.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Datadog.Models; using Azure.ResourceManager.Models; @@ -17,20 +19,25 @@ namespace Azure.ResourceManager.Datadog /// public partial class MonitoringTagRuleData : ResourceData { - /// Initializes a new instance of MonitoringTagRuleData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MonitoringTagRuleData() { } - /// Initializes a new instance of MonitoringTagRuleData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Definition of the properties for a TagRules resource. - internal MonitoringTagRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MonitoringTagRulesProperties properties) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal MonitoringTagRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MonitoringTagRulesProperties properties, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Definition of the properties for a TagRules resource. diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs index d02c34f34bbf..0b3951a9edbb 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MarketplaceAgreementsRestOperations.cs @@ -120,9 +120,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, DatadogA if (body != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } _userAgent.Apply(message); return message; diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MonitorsRestOperations.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MonitorsRestOperations.cs index d943a570a5f6..df2ef1f44d86 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MonitorsRestOperations.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/MonitorsRestOperations.cs @@ -215,9 +215,7 @@ internal HttpMessage CreateSetDefaultKeyRequest(string subscriptionId, string re if (body != null) { request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body); - request.Content = content; + request.Content = body; } _userAgent.Apply(message); return message; @@ -749,9 +747,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } @@ -827,9 +823,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; + request.Content = patch; _userAgent.Apply(message); return message; } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/SingleSignOnConfigurationsRestOperations.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/SingleSignOnConfigurationsRestOperations.cs index c78ba4c91b20..92cb8d73853b 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/SingleSignOnConfigurationsRestOperations.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/SingleSignOnConfigurationsRestOperations.cs @@ -135,9 +135,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/TagRulesRestOperations.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/TagRulesRestOperations.cs index fa3479a0b7c1..936ebb041861 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/TagRulesRestOperations.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/RestOperations/TagRulesRestOperations.cs @@ -135,9 +135,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; + request.Content = data; _userAgent.Apply(message); return message; } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs index 273e254d4f0a..8f02cd531de1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(C { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryChangeDataCaptureChangeDataCaptureRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryChangeDataCaptureChangeDataCaptureRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryChangeDataCaptureResource(Client, DataFactoryChangeDataCaptureData.DeserializeDataFactoryChangeDataCaptureData(e)), _dataFactoryChangeDataCaptureChangeDataCaptureClientDiagnostics, Pipeline, "DataFactoryChangeDataCaptureCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryChangeDataCaptureResource(Client, DataFactoryChangeDataCaptureData.DeserializeDataFactoryChangeDataCaptureData(e)), _dataFactoryChangeDataCaptureChangeDataCaptureClientDiagnostics, Pipeline, "DataFactoryChangeDataCaptureCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryChangeDataCaptureChangeDataCaptureRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryChangeDataCaptureChangeDataCaptureRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryChangeDataCaptureResource(Client, DataFactoryChangeDataCaptureData.DeserializeDataFactoryChangeDataCaptureData(e)), _dataFactoryChangeDataCaptureChangeDataCaptureClientDiagnostics, Pipeline, "DataFactoryChangeDataCaptureCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryChangeDataCaptureResource(Client, DataFactoryChangeDataCaptureData.DeserializeDataFactoryChangeDataCaptureData(e)), _dataFactoryChangeDataCaptureChangeDataCaptureClientDiagnostics, Pipeline, "DataFactoryChangeDataCaptureCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureData.cs index 8d6df96cab0d..4fcae43ad300 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureData.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryChangeDataCaptureData : ResourceData { - /// Initializes a new instance of DataFactoryChangeDataCaptureData. + /// Initializes a new instance of . /// List of sources connections that can be used as sources in the CDC. /// List of target connections that can be used as sources in the CDC. /// CDC policy. @@ -38,7 +38,7 @@ public DataFactoryChangeDataCaptureData(IEnumerable AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryChangeDataCaptureData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -65,6 +65,11 @@ internal DataFactoryChangeDataCaptureData(ResourceIdentifier id, string name, Re AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal DataFactoryChangeDataCaptureData() + { + } + /// The folder that this CDC is in. If not specified, CDC will appear at the root level. internal ChangeDataCaptureFolder Folder { get; set; } /// The name of the folder that this CDC is in. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs index 09a9b00fa9d3..954abcf69d1c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryCollection.cs @@ -233,7 +233,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryFactoriesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryFactoriesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), _dataFactoryFactoriesClientDiagnostics, Pipeline, "DataFactoryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), _dataFactoryFactoriesClientDiagnostics, Pipeline, "DataFactoryCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -255,7 +255,7 @@ public virtual Pageable GetAll(CancellationToken cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryFactoriesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryFactoriesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), _dataFactoryFactoriesClientDiagnostics, Pipeline, "DataFactoryCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), _dataFactoryFactoriesClientDiagnostics, Pipeline, "DataFactoryCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryData.cs index df313b100904..432605384750 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryData.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryData : TrackedResourceData { - /// Initializes a new instance of DataFactoryData. + /// Initializes a new instance of . /// The location. public DataFactoryData(AzureLocation location) : base(location) { @@ -28,7 +28,7 @@ public DataFactoryData(AzureLocation location) : base(location) AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -65,6 +65,11 @@ internal DataFactoryData(ResourceIdentifier id, string name, ResourceType resour AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal DataFactoryData() + { + } + /// Managed service identity of the factory. Current supported identity types: SystemAssigned, UserAssigned, SystemAssigned,UserAssigned. public ManagedServiceIdentity Identity { get; set; } /// Factory provisioning state, example Succeeded. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs index 2cd69ddedf07..a4eb946c6cdc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryDataFlowDataFlowsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryDataFlowDataFlowsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryDataFlowResource(Client, DataFactoryDataFlowData.DeserializeDataFactoryDataFlowData(e)), _dataFactoryDataFlowDataFlowsClientDiagnostics, Pipeline, "DataFactoryDataFlowCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryDataFlowResource(Client, DataFactoryDataFlowData.DeserializeDataFactoryDataFlowData(e)), _dataFactoryDataFlowDataFlowsClientDiagnostics, Pipeline, "DataFactoryDataFlowCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryDataFlowDataFlowsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryDataFlowDataFlowsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryDataFlowResource(Client, DataFactoryDataFlowData.DeserializeDataFactoryDataFlowData(e)), _dataFactoryDataFlowDataFlowsClientDiagnostics, Pipeline, "DataFactoryDataFlowCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryDataFlowResource(Client, DataFactoryDataFlowData.DeserializeDataFactoryDataFlowData(e)), _dataFactoryDataFlowDataFlowsClientDiagnostics, Pipeline, "DataFactoryDataFlowCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowData.cs index 8e8cc7f0bc2a..733654c5fd5d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryDataFlowData : ResourceData { - /// Initializes a new instance of DataFactoryDataFlowData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Data flow properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -33,7 +37,7 @@ public DataFactoryDataFlowData(DataFactoryDataFlowProperties properties) Properties = properties; } - /// Initializes a new instance of DataFactoryDataFlowData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,10 +48,17 @@ public DataFactoryDataFlowData(DataFactoryDataFlowProperties properties) /// The available derived classes include , and . /// /// Etag identifies change in the resource. - internal DataFactoryDataFlowData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryDataFlowProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryDataFlowProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryDataFlowData() + { } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs index 50ca95bd5fdb..1bd879f9355d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryDatasetDatasetsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryDatasetDatasetsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryDatasetResource(Client, DataFactoryDatasetData.DeserializeDataFactoryDatasetData(e)), _dataFactoryDatasetDatasetsClientDiagnostics, Pipeline, "DataFactoryDatasetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryDatasetResource(Client, DataFactoryDatasetData.DeserializeDataFactoryDatasetData(e)), _dataFactoryDatasetDatasetsClientDiagnostics, Pipeline, "DataFactoryDatasetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryDatasetDatasetsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryDatasetDatasetsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryDatasetResource(Client, DataFactoryDatasetData.DeserializeDataFactoryDatasetData(e)), _dataFactoryDatasetDatasetsClientDiagnostics, Pipeline, "DataFactoryDatasetCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryDatasetResource(Client, DataFactoryDatasetData.DeserializeDataFactoryDatasetData(e)), _dataFactoryDatasetDatasetsClientDiagnostics, Pipeline, "DataFactoryDatasetCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetData.cs index ddfe992344a1..3c7cb9718307 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryDatasetData : ResourceData { - /// Initializes a new instance of DataFactoryDatasetData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Dataset properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -33,7 +37,7 @@ public DataFactoryDatasetData(DataFactoryDatasetProperties properties) Properties = properties; } - /// Initializes a new instance of DataFactoryDatasetData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,10 +48,17 @@ public DataFactoryDatasetData(DataFactoryDatasetProperties properties) /// The available derived classes include , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and . /// /// Etag identifies change in the resource. - internal DataFactoryDatasetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryDatasetProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDatasetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryDatasetProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryDatasetData() + { } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs index feaf127969e6..d7ea3034b083 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterCollection.cs @@ -228,7 +228,7 @@ public virtual AsyncPageable GetAllAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryGlobalParameterGlobalParametersRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryGlobalParameterGlobalParametersRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryGlobalParameterResource(Client, DataFactoryGlobalParameterData.DeserializeDataFactoryGlobalParameterData(e)), _dataFactoryGlobalParameterGlobalParametersClientDiagnostics, Pipeline, "DataFactoryGlobalParameterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryGlobalParameterResource(Client, DataFactoryGlobalParameterData.DeserializeDataFactoryGlobalParameterData(e)), _dataFactoryGlobalParameterGlobalParametersClientDiagnostics, Pipeline, "DataFactoryGlobalParameterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -250,7 +250,7 @@ public virtual Pageable GetAll(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryGlobalParameterGlobalParametersRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryGlobalParameterGlobalParametersRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryGlobalParameterResource(Client, DataFactoryGlobalParameterData.DeserializeDataFactoryGlobalParameterData(e)), _dataFactoryGlobalParameterGlobalParametersClientDiagnostics, Pipeline, "DataFactoryGlobalParameterCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryGlobalParameterResource(Client, DataFactoryGlobalParameterData.DeserializeDataFactoryGlobalParameterData(e)), _dataFactoryGlobalParameterGlobalParametersClientDiagnostics, Pipeline, "DataFactoryGlobalParameterCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterData.cs index 5c9c809a91ea..4afd57a0459c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterData.cs @@ -20,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryGlobalParameterData : ResourceData { - /// Initializes a new instance of DataFactoryGlobalParameterData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Properties of the global parameter. /// is null. public DataFactoryGlobalParameterData(IDictionary properties) @@ -30,17 +33,24 @@ public DataFactoryGlobalParameterData(IDictionary Initializes a new instance of DataFactoryGlobalParameterData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the global parameter. /// Etag identifies change in the resource. - internal DataFactoryGlobalParameterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryGlobalParameterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryGlobalParameterData() + { } /// Properties of the global parameter. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs index 7e95e84683be..ea43f9995bb1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryIntegrationRuntimeIntegrationRuntimesRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryIntegrationRuntimeIntegrationRuntimesRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryIntegrationRuntimeResource(Client, DataFactoryIntegrationRuntimeData.DeserializeDataFactoryIntegrationRuntimeData(e)), _dataFactoryIntegrationRuntimeIntegrationRuntimesClientDiagnostics, Pipeline, "DataFactoryIntegrationRuntimeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryIntegrationRuntimeResource(Client, DataFactoryIntegrationRuntimeData.DeserializeDataFactoryIntegrationRuntimeData(e)), _dataFactoryIntegrationRuntimeIntegrationRuntimesClientDiagnostics, Pipeline, "DataFactoryIntegrationRuntimeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryIntegrationRuntimeIntegrationRuntimesRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryIntegrationRuntimeIntegrationRuntimesRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryIntegrationRuntimeResource(Client, DataFactoryIntegrationRuntimeData.DeserializeDataFactoryIntegrationRuntimeData(e)), _dataFactoryIntegrationRuntimeIntegrationRuntimesClientDiagnostics, Pipeline, "DataFactoryIntegrationRuntimeCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryIntegrationRuntimeResource(Client, DataFactoryIntegrationRuntimeData.DeserializeDataFactoryIntegrationRuntimeData(e)), _dataFactoryIntegrationRuntimeIntegrationRuntimesClientDiagnostics, Pipeline, "DataFactoryIntegrationRuntimeCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeData.cs index d459b3752f3e..9bd2b8e0745d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryIntegrationRuntimeData : ResourceData { - /// Initializes a new instance of DataFactoryIntegrationRuntimeData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Integration runtime properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -33,7 +37,7 @@ public DataFactoryIntegrationRuntimeData(DataFactoryIntegrationRuntimeProperties Properties = properties; } - /// Initializes a new instance of DataFactoryIntegrationRuntimeData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,10 +48,17 @@ public DataFactoryIntegrationRuntimeData(DataFactoryIntegrationRuntimeProperties /// The available derived classes include and . /// /// Etag identifies change in the resource. - internal DataFactoryIntegrationRuntimeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryIntegrationRuntimeProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryIntegrationRuntimeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryIntegrationRuntimeProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryIntegrationRuntimeData() + { } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs index ce0e6673025f..cf38979ecedc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cance { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryLinkedServiceLinkedServicesRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryLinkedServiceLinkedServicesRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryLinkedServiceResource(Client, DataFactoryLinkedServiceData.DeserializeDataFactoryLinkedServiceData(e)), _dataFactoryLinkedServiceLinkedServicesClientDiagnostics, Pipeline, "DataFactoryLinkedServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryLinkedServiceResource(Client, DataFactoryLinkedServiceData.DeserializeDataFactoryLinkedServiceData(e)), _dataFactoryLinkedServiceLinkedServicesClientDiagnostics, Pipeline, "DataFactoryLinkedServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationTok { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryLinkedServiceLinkedServicesRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryLinkedServiceLinkedServicesRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryLinkedServiceResource(Client, DataFactoryLinkedServiceData.DeserializeDataFactoryLinkedServiceData(e)), _dataFactoryLinkedServiceLinkedServicesClientDiagnostics, Pipeline, "DataFactoryLinkedServiceCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryLinkedServiceResource(Client, DataFactoryLinkedServiceData.DeserializeDataFactoryLinkedServiceData(e)), _dataFactoryLinkedServiceLinkedServicesClientDiagnostics, Pipeline, "DataFactoryLinkedServiceCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceData.cs index c17109f6262a..01df2d2d164f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryLinkedServiceData : ResourceData { - /// Initializes a new instance of DataFactoryLinkedServiceData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Properties of linked service. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -33,7 +37,7 @@ public DataFactoryLinkedServiceData(DataFactoryLinkedServiceProperties propertie Properties = properties; } - /// Initializes a new instance of DataFactoryLinkedServiceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,10 +48,17 @@ public DataFactoryLinkedServiceData(DataFactoryLinkedServiceProperties propertie /// The available derived classes include , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and . /// /// Etag identifies change in the resource. - internal DataFactoryLinkedServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryLinkedServiceProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryLinkedServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryLinkedServiceProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryLinkedServiceData() + { } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs index 1c64dab9ded1..6301c820cebf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryManagedIdentityCredentialCredentialOperationsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryManagedIdentityCredentialCredentialOperationsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryManagedIdentityCredentialResource(Client, DataFactoryManagedIdentityCredentialData.DeserializeDataFactoryManagedIdentityCredentialData(e)), _dataFactoryManagedIdentityCredentialCredentialOperationsClientDiagnostics, Pipeline, "DataFactoryManagedIdentityCredentialCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryManagedIdentityCredentialResource(Client, DataFactoryManagedIdentityCredentialData.DeserializeDataFactoryManagedIdentityCredentialData(e)), _dataFactoryManagedIdentityCredentialCredentialOperationsClientDiagnostics, Pipeline, "DataFactoryManagedIdentityCredentialCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryManagedIdentityCredentialCredentialOperationsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryManagedIdentityCredentialCredentialOperationsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryManagedIdentityCredentialResource(Client, DataFactoryManagedIdentityCredentialData.DeserializeDataFactoryManagedIdentityCredentialData(e)), _dataFactoryManagedIdentityCredentialCredentialOperationsClientDiagnostics, Pipeline, "DataFactoryManagedIdentityCredentialCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryManagedIdentityCredentialResource(Client, DataFactoryManagedIdentityCredentialData.DeserializeDataFactoryManagedIdentityCredentialData(e)), _dataFactoryManagedIdentityCredentialCredentialOperationsClientDiagnostics, Pipeline, "DataFactoryManagedIdentityCredentialCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialData.cs index 4e8de7bc60c0..b07d8d9fbc15 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryManagedIdentityCredentialData : ResourceData { - /// Initializes a new instance of DataFactoryManagedIdentityCredentialData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Managed Identity Credential properties. /// is null. public DataFactoryManagedIdentityCredentialData(DataFactoryManagedIdentityCredentialProperties properties) @@ -29,17 +33,24 @@ public DataFactoryManagedIdentityCredentialData(DataFactoryManagedIdentityCreden Properties = properties; } - /// Initializes a new instance of DataFactoryManagedIdentityCredentialData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Managed Identity Credential properties. /// Etag identifies change in the resource. - internal DataFactoryManagedIdentityCredentialData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryManagedIdentityCredentialProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryManagedIdentityCredentialData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryManagedIdentityCredentialProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryManagedIdentityCredentialData() + { } /// Managed Identity Credential properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs index 4886c35d0f56..02b8144a6c1d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsy { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryManagedVirtualNetworkManagedVirtualNetworksRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryManagedVirtualNetworkManagedVirtualNetworksRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryManagedVirtualNetworkResource(Client, DataFactoryManagedVirtualNetworkData.DeserializeDataFactoryManagedVirtualNetworkData(e)), _dataFactoryManagedVirtualNetworkManagedVirtualNetworksClientDiagnostics, Pipeline, "DataFactoryManagedVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryManagedVirtualNetworkResource(Client, DataFactoryManagedVirtualNetworkData.DeserializeDataFactoryManagedVirtualNetworkData(e)), _dataFactoryManagedVirtualNetworkManagedVirtualNetworksClientDiagnostics, Pipeline, "DataFactoryManagedVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(Cancell { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryManagedVirtualNetworkManagedVirtualNetworksRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryManagedVirtualNetworkManagedVirtualNetworksRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryManagedVirtualNetworkResource(Client, DataFactoryManagedVirtualNetworkData.DeserializeDataFactoryManagedVirtualNetworkData(e)), _dataFactoryManagedVirtualNetworkManagedVirtualNetworksClientDiagnostics, Pipeline, "DataFactoryManagedVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryManagedVirtualNetworkResource(Client, DataFactoryManagedVirtualNetworkData.DeserializeDataFactoryManagedVirtualNetworkData(e)), _dataFactoryManagedVirtualNetworkManagedVirtualNetworksClientDiagnostics, Pipeline, "DataFactoryManagedVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkData.cs index 35a9ca8535d9..07366c18760e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryManagedVirtualNetworkData : ResourceData { - /// Initializes a new instance of DataFactoryManagedVirtualNetworkData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Managed Virtual Network properties. /// is null. public DataFactoryManagedVirtualNetworkData(DataFactoryManagedVirtualNetworkProperties properties) @@ -29,17 +33,24 @@ public DataFactoryManagedVirtualNetworkData(DataFactoryManagedVirtualNetworkProp Properties = properties; } - /// Initializes a new instance of DataFactoryManagedVirtualNetworkData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Managed Virtual Network properties. /// Etag identifies change in the resource. - internal DataFactoryManagedVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryManagedVirtualNetworkProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryManagedVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryManagedVirtualNetworkProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryManagedVirtualNetworkData() + { } /// Managed Virtual Network properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs index 3b23e583ed7e..318347354dea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryPipelinePipelinesRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryPipelinePipelinesRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryPipelineResource(Client, DataFactoryPipelineData.DeserializeDataFactoryPipelineData(e)), _dataFactoryPipelinePipelinesClientDiagnostics, Pipeline, "DataFactoryPipelineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryPipelineResource(Client, DataFactoryPipelineData.DeserializeDataFactoryPipelineData(e)), _dataFactoryPipelinePipelinesClientDiagnostics, Pipeline, "DataFactoryPipelineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken ca { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryPipelinePipelinesRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryPipelinePipelinesRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryPipelineResource(Client, DataFactoryPipelineData.DeserializeDataFactoryPipelineData(e)), _dataFactoryPipelinePipelinesClientDiagnostics, Pipeline, "DataFactoryPipelineCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryPipelineResource(Client, DataFactoryPipelineData.DeserializeDataFactoryPipelineData(e)), _dataFactoryPipelinePipelinesClientDiagnostics, Pipeline, "DataFactoryPipelineCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineData.cs index 18a20635658e..b29bf5db379f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineData.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryPipelineData : ResourceData { - /// Initializes a new instance of DataFactoryPipelineData. + /// Initializes a new instance of . public DataFactoryPipelineData() { Activities = new ChangeTrackingList(); @@ -31,7 +31,7 @@ public DataFactoryPipelineData() AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryPipelineData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs index 9b6419bfec14..5b792142196a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryPrivateEndpointManagedPrivateEndpointsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryPrivateEndpointManagedPrivateEndpointsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryPrivateEndpointResource(Client, DataFactoryPrivateEndpointData.DeserializeDataFactoryPrivateEndpointData(e)), _dataFactoryPrivateEndpointManagedPrivateEndpointsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryPrivateEndpointResource(Client, DataFactoryPrivateEndpointData.DeserializeDataFactoryPrivateEndpointData(e)), _dataFactoryPrivateEndpointManagedPrivateEndpointsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationT { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryPrivateEndpointManagedPrivateEndpointsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryPrivateEndpointManagedPrivateEndpointsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryPrivateEndpointResource(Client, DataFactoryPrivateEndpointData.DeserializeDataFactoryPrivateEndpointData(e)), _dataFactoryPrivateEndpointManagedPrivateEndpointsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryPrivateEndpointResource(Client, DataFactoryPrivateEndpointData.DeserializeDataFactoryPrivateEndpointData(e)), _dataFactoryPrivateEndpointManagedPrivateEndpointsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs index c4ab92df0e75..6b6073ec2447 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionCollection.cs @@ -238,7 +238,7 @@ public virtual AsyncPageable GetAl { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryPrivateEndpointConnectionResource(Client, DataFactoryPrivateEndpointConnectionData.DeserializeDataFactoryPrivateEndpointConnectionData(e)), _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryPrivateEndpointConnectionResource(Client, DataFactoryPrivateEndpointConnectionData.DeserializeDataFactoryPrivateEndpointConnectionData(e)), _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -260,7 +260,7 @@ public virtual Pageable GetAll(Can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryPrivateEndpointConnectionResource(Client, DataFactoryPrivateEndpointConnectionData.DeserializeDataFactoryPrivateEndpointConnectionData(e)), _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryPrivateEndpointConnectionResource(Client, DataFactoryPrivateEndpointConnectionData.DeserializeDataFactoryPrivateEndpointConnectionData(e)), _dataFactoryPrivateEndpointConnectionprivateEndPointConnectionsClientDiagnostics, Pipeline, "DataFactoryPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionData.cs index 594d18487c5b..8fab8fa1cbb9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionData.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -18,22 +20,27 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryPrivateEndpointConnectionData : ResourceData { - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPrivateEndpointConnectionData() { } - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Core resource properties. /// Etag identifies change in the resource. - internal DataFactoryPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryPrivateEndpointConnectionProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryPrivateEndpointConnectionProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Core resource properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointData.cs index 452cfdc0b4b8..8944c5ac173b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryPrivateEndpointData : ResourceData { - /// Initializes a new instance of DataFactoryPrivateEndpointData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Managed private endpoint properties. /// is null. public DataFactoryPrivateEndpointData(DataFactoryPrivateEndpointProperties properties) @@ -29,17 +33,24 @@ public DataFactoryPrivateEndpointData(DataFactoryPrivateEndpointProperties prope Properties = properties; } - /// Initializes a new instance of DataFactoryPrivateEndpointData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Managed private endpoint properties. /// Etag identifies change in the resource. - internal DataFactoryPrivateEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryPrivateEndpointProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryPrivateEndpointProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPrivateEndpointData() + { } /// Managed private endpoint properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs index 54a373e150cb..f5a01012a412 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs @@ -1466,7 +1466,7 @@ public virtual AsyncPageable GetTriggersAsync(Trigge Argument.AssertNotNull(content, nameof(content)); HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryTriggerTriggersRestClient.CreateQueryByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryResource.GetTriggers", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, (e, o) => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryResource.GetTriggers", "value", null, cancellationToken); } /// @@ -1491,7 +1491,7 @@ public virtual Pageable GetTriggers(TriggerFilterCon Argument.AssertNotNull(content, nameof(content)); HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryTriggerTriggersRestClient.CreateQueryByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryResource.GetTriggers", "value", null, cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, (e, o) => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryResource.GetTriggers", "value", null, cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs index 8b0c32586b56..8b6e0954b9c8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerCollection.cs @@ -232,7 +232,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryTriggerTriggersRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryTriggerTriggersRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryTriggerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryTriggerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,7 +254,7 @@ public virtual Pageable GetAll(CancellationToken can { HttpMessage FirstPageRequest(int? pageSizeHint) => _dataFactoryTriggerTriggersRestClient.CreateListByFactoryRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataFactoryTriggerTriggersRestClient.CreateListByFactoryNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryTriggerCollection.GetAll", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryTriggerResource(Client, DataFactoryTriggerData.DeserializeDataFactoryTriggerData(e)), _dataFactoryTriggerTriggersClientDiagnostics, Pipeline, "DataFactoryTriggerCollection.GetAll", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerData.cs index 72e6aea198a4..a5454c56ef28 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.DataFactory.Models; @@ -19,7 +20,10 @@ namespace Azure.ResourceManager.DataFactory /// public partial class DataFactoryTriggerData : ResourceData { - /// Initializes a new instance of DataFactoryTriggerData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Properties of the trigger. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -33,7 +37,7 @@ public DataFactoryTriggerData(DataFactoryTriggerProperties properties) Properties = properties; } - /// Initializes a new instance of DataFactoryTriggerData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -44,10 +48,17 @@ public DataFactoryTriggerData(DataFactoryTriggerProperties properties) /// The available derived classes include , , , , , , and . /// /// Etag identifies change in the resource. - internal DataFactoryTriggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryTriggerProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryTriggerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryTriggerProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryTriggerData() + { } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 5bc6c11b361e..9ec82e8668be 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -67,7 +67,7 @@ public virtual AsyncPageable GetDataFactoriesAsync(Cancella { HttpMessage FirstPageRequest(int? pageSizeHint) => DataFactoryFactoriesRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataFactoryFactoriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataFactories", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataFactories", "value", "nextLink", cancellationToken); } /// @@ -89,7 +89,7 @@ public virtual Pageable GetDataFactories(CancellationToken { HttpMessage FirstPageRequest(int? pageSizeHint) => DataFactoryFactoriesRestClient.CreateListRequest(Id.SubscriptionId); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataFactoryFactoriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataFactories", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, (e, o) => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataFactories", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.Serialization.cs index 6df21595e074..39fa7ef140d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonMwsLinkedService : IUtf8JsonSerializable + public partial class AmazonMwsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -113,8 +133,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonMwsLinkedService DeserializeAmazonMwsLinkedService(JsonElement element) + internal static AmazonMwsLinkedService DeserializeAmazonMwsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -279,5 +301,53 @@ internal static AmazonMwsLinkedService DeserializeAmazonMwsLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new AmazonMwsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, marketplaceId, sellerId, mwsAuthToken, accessKeyId, secretKey, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + AmazonMwsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonMwsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonMwsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonMwsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonMwsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonMwsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonMwsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.cs index 369e1dff1447..1dcd1bb43ff3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Amazon Marketplace Web Service linked service. public partial class AmazonMwsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AmazonMwsLinkedService. + /// Initializes a new instance of . /// The endpoint of the Amazon MWS server, (i.e. mws.amazonservices.com). /// The Amazon Marketplace ID you want to retrieve data from. To retrieve data from multiple Marketplace IDs, separate them with a comma (,). (i.e. A2EUQ1WTGCTBG2). /// The Amazon seller ID. @@ -35,7 +35,7 @@ public AmazonMwsLinkedService(DataFactoryElement endpoint, DataFactoryEl LinkedServiceType = "AmazonMWS"; } - /// Initializes a new instance of AmazonMwsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -67,6 +67,11 @@ internal AmazonMwsLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "AmazonMWS"; } + /// Initializes a new instance of for deserialization. + internal AmazonMwsLinkedService() + { + } + /// The endpoint of the Amazon MWS server, (i.e. mws.amazonservices.com). public DataFactoryElement Endpoint { get; set; } /// The Amazon Marketplace ID you want to retrieve data from. To retrieve data from multiple Marketplace IDs, separate them with a comma (,). (i.e. A2EUQ1WTGCTBG2). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.Serialization.cs index 03afa10d2777..3301620f40f5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonMwsObjectDataset : IUtf8JsonSerializable + public partial class AmazonMwsObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonMwsObjectDataset DeserializeAmazonMwsObjectDataset(JsonElement element) + internal static AmazonMwsObjectDataset DeserializeAmazonMwsObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static AmazonMwsObjectDataset DeserializeAmazonMwsObjectDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new AmazonMwsObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + AmazonMwsObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonMwsObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonMwsObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonMwsObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonMwsObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonMwsObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonMwsObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.cs index 15c2cf9806eb..bf7286f85da9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Amazon Marketplace Web Service dataset. public partial class AmazonMwsObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AmazonMwsObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AmazonMwsObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AmazonMwsObjectDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "AmazonMWSObject"; } - /// Initializes a new instance of AmazonMwsObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal AmazonMwsObjectDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "AmazonMWSObject"; } + /// Initializes a new instance of for deserialization. + internal AmazonMwsObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.Serialization.cs index 2a182a0a3c4a..4d71193837d6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonMwsSource : IUtf8JsonSerializable + public partial class AmazonMwsSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonMwsSource DeserializeAmazonMwsSource(JsonElement element) + internal static AmazonMwsSource DeserializeAmazonMwsSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static AmazonMwsSource DeserializeAmazonMwsSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AmazonMwsSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + AmazonMwsSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonMwsSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonMwsSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonMwsSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonMwsSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonMwsSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonMwsSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.cs index a3375f021c02..7fdb036d8881 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonMwsSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Amazon Marketplace Web Service source. public partial class AmazonMwsSource : TabularSource { - /// Initializes a new instance of AmazonMwsSource. + /// Initializes a new instance of . public AmazonMwsSource() { CopySourceType = "AmazonMWSSource"; } - /// Initializes a new instance of AmazonMwsSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.Serialization.cs index 908e94d4c95d..805e5c85bda5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForOracleLinkedService : IUtf8JsonSerializable + public partial class AmazonRdsForOracleLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRdsForOracleLinkedService DeserializeAmazonRdsForOracleLinkedService(JsonElement element) + internal static AmazonRdsForOracleLinkedService DeserializeAmazonRdsForOracleLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -195,5 +217,53 @@ internal static AmazonRdsForOracleLinkedService DeserializeAmazonRdsForOracleLin additionalProperties = additionalPropertiesDictionary; return new AmazonRdsForOracleLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, encryptedCredential.Value); } + + AmazonRdsForOracleLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForOracleLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForOracleLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForOracleLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForOracleLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForOracleLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForOracleLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.cs index cf1dcdb018ac..dde4e7354f87 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// AmazonRdsForOracle database. public partial class AmazonRdsForOracleLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AmazonRdsForOracleLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public AmazonRdsForOracleLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public AmazonRdsForOracleLinkedService(DataFactoryElement connectionStri LinkedServiceType = "AmazonRdsForOracle"; } - /// Initializes a new instance of AmazonRdsForOracleLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal AmazonRdsForOracleLinkedService(string linkedServiceType, IntegrationRu LinkedServiceType = linkedServiceType ?? "AmazonRdsForOracle"; } + /// Initializes a new instance of for deserialization. + internal AmazonRdsForOracleLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.Serialization.cs index 3f7d05a441c7..c11f5d0ce379 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForOraclePartitionSettings : IUtf8JsonSerializable + public partial class AmazonRdsForOraclePartitionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PartitionNames)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("partitionLowerBound"u8); JsonSerializer.Serialize(writer, PartitionLowerBound); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AmazonRdsForOraclePartitionSettings DeserializeAmazonRdsForOraclePartitionSettings(JsonElement element) + internal static AmazonRdsForOraclePartitionSettings DeserializeAmazonRdsForOraclePartitionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +75,7 @@ internal static AmazonRdsForOraclePartitionSettings DeserializeAmazonRdsForOracl Optional> partitionColumnName = default; Optional> partitionUpperBound = default; Optional> partitionLowerBound = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionNames"u8)) @@ -92,8 +114,61 @@ internal static AmazonRdsForOraclePartitionSettings DeserializeAmazonRdsForOracl partitionLowerBound = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new AmazonRdsForOraclePartitionSettings(partitionNames.Value, partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value); + return new AmazonRdsForOraclePartitionSettings(partitionNames.Value, partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value, serializedAdditionalRawData); + } + + AmazonRdsForOraclePartitionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForOraclePartitionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForOraclePartitionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForOraclePartitionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForOraclePartitionSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForOraclePartitionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForOraclePartitionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.cs index 5f5d699235c1..c2d3ffdd1c23 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOraclePartitionSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// The settings that will be leveraged for AmazonRdsForOracle source partitioning. public partial class AmazonRdsForOraclePartitionSettings { - /// Initializes a new instance of AmazonRdsForOraclePartitionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public AmazonRdsForOraclePartitionSettings() { } - /// Initializes a new instance of AmazonRdsForOraclePartitionSettings. + /// Initializes a new instance of . /// Names of the physical partitions of AmazonRdsForOracle table. /// The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). - internal AmazonRdsForOraclePartitionSettings(BinaryData partitionNames, DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound) + /// Keeps track of any properties unknown to the library. + internal AmazonRdsForOraclePartitionSettings(BinaryData partitionNames, DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound, Dictionary serializedAdditionalRawData) { PartitionNames = partitionNames; PartitionColumnName = partitionColumnName; PartitionUpperBound = partitionUpperBound; PartitionLowerBound = partitionLowerBound; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.Serialization.cs index c2a0eedef2f6..cca2aa19c21a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForOracleSource : IUtf8JsonSerializable + public partial class AmazonRdsForOracleSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OracleReaderQuery)) { @@ -36,7 +42,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -81,8 +94,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRdsForOracleSource DeserializeAmazonRdsForOracleSource(JsonElement element) + internal static AmazonRdsForOracleSource DeserializeAmazonRdsForOracleSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +207,53 @@ internal static AmazonRdsForOracleSource DeserializeAmazonRdsForOracleSource(Jso additionalProperties = additionalPropertiesDictionary; return new AmazonRdsForOracleSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, oracleReaderQuery.Value, queryTimeout.Value, partitionOption.Value, partitionSettings.Value, additionalColumns.Value); } + + AmazonRdsForOracleSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForOracleSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForOracleSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForOracleSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForOracleSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForOracleSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForOracleSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.cs index 9bd8959f1ae0..7251a31cd06c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity AmazonRdsForOracle source. public partial class AmazonRdsForOracleSource : CopyActivitySource { - /// Initializes a new instance of AmazonRdsForOracleSource. + /// Initializes a new instance of . public AmazonRdsForOracleSource() { CopySourceType = "AmazonRdsForOracleSource"; } - /// Initializes a new instance of AmazonRdsForOracleSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.Serialization.cs index 99f0ebc26538..cc27bd1034df 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForOracleTableDataset : IUtf8JsonSerializable + public partial class AmazonRdsForOracleTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRdsForOracleTableDataset DeserializeAmazonRdsForOracleTableDataset(JsonElement element) + internal static AmazonRdsForOracleTableDataset DeserializeAmazonRdsForOracleTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +250,53 @@ internal static AmazonRdsForOracleTableDataset DeserializeAmazonRdsForOracleTabl additionalProperties = additionalPropertiesDictionary; return new AmazonRdsForOracleTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, schema0.Value, table.Value); } + + AmazonRdsForOracleTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForOracleTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForOracleTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForOracleTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForOracleTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForOracleTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForOracleTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.cs index 5fbebf20e15f..bddd2d418dbd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForOracleTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The AmazonRdsForOracle database dataset. public partial class AmazonRdsForOracleTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AmazonRdsForOracleTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AmazonRdsForOracleTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AmazonRdsForOracleTableDataset(DataFactoryLinkedServiceReference linkedSe DatasetType = "AmazonRdsForOracleTable"; } - /// Initializes a new instance of AmazonRdsForOracleTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -44,6 +44,11 @@ internal AmazonRdsForOracleTableDataset(string datasetType, string description, DatasetType = datasetType ?? "AmazonRdsForOracleTable"; } + /// Initializes a new instance of for deserialization. + internal AmazonRdsForOracleTableDataset() + { + } + /// The schema name of the AmazonRdsForOracle database. Type: string (or Expression with resultType string). public DataFactoryElement SchemaTypePropertiesSchema { get; set; } /// The table name of the AmazonRdsForOracle database. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.Serialization.cs index f7f06aab5456..bc678bddcf8b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForSqlServerLinkedService : IUtf8JsonSerializable + public partial class AmazonRdsForSqlServerLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -82,7 +102,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AlwaysEncryptedSettings)) { writer.WritePropertyName("alwaysEncryptedSettings"u8); - writer.WriteObjectValue(AlwaysEncryptedSettings); + if (AlwaysEncryptedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AlwaysEncryptedSettings).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -97,8 +124,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRdsForSqlServerLinkedService DeserializeAmazonRdsForSqlServerLinkedService(JsonElement element) + internal static AmazonRdsForSqlServerLinkedService DeserializeAmazonRdsForSqlServerLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -225,5 +254,53 @@ internal static AmazonRdsForSqlServerLinkedService DeserializeAmazonRdsForSqlSer additionalProperties = additionalPropertiesDictionary; return new AmazonRdsForSqlServerLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, userName.Value, password, encryptedCredential.Value, alwaysEncryptedSettings.Value); } + + AmazonRdsForSqlServerLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForSqlServerLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForSqlServerLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForSqlServerLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForSqlServerLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForSqlServerLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForSqlServerLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.cs index 7dedaaa6ba94..f63ff42f5638 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Amazon RDS for SQL Server linked service. public partial class AmazonRdsForSqlServerLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AmazonRdsForSqlServerLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public AmazonRdsForSqlServerLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public AmazonRdsForSqlServerLinkedService(DataFactoryElement connectionS LinkedServiceType = "AmazonRdsForSqlServer"; } - /// Initializes a new instance of AmazonRdsForSqlServerLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -48,6 +48,11 @@ internal AmazonRdsForSqlServerLinkedService(string linkedServiceType, Integratio LinkedServiceType = linkedServiceType ?? "AmazonRdsForSqlServer"; } + /// Initializes a new instance of for deserialization. + internal AmazonRdsForSqlServerLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The on-premises Windows authentication user name. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs index f03808b6d698..b9d037fffef4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForSqlServerSource : IUtf8JsonSerializable + public partial class AmazonRdsForSqlServerSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SqlReaderQuery)) { @@ -63,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryTimeout)) { @@ -113,8 +126,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRdsForSqlServerSource DeserializeAmazonRdsForSqlServerSource(JsonElement element) + internal static AmazonRdsForSqlServerSource DeserializeAmazonRdsForSqlServerSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -264,5 +279,53 @@ internal static AmazonRdsForSqlServerSource DeserializeAmazonRdsForSqlServerSour additionalProperties = additionalPropertiesDictionary; return new AmazonRdsForSqlServerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); } + + AmazonRdsForSqlServerSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForSqlServerSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForSqlServerSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForSqlServerSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForSqlServerSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForSqlServerSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForSqlServerSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.cs index dcc5b82a353e..3b85f8f1fa41 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Amazon RDS for SQL Server source. public partial class AmazonRdsForSqlServerSource : TabularSource { - /// Initializes a new instance of AmazonRdsForSqlServerSource. + /// Initializes a new instance of . public AmazonRdsForSqlServerSource() { CopySourceType = "AmazonRdsForSqlServerSource"; } - /// Initializes a new instance of AmazonRdsForSqlServerSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.Serialization.cs index 9738b86196dd..4890fef4d264 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRdsForSqlServerTableDataset : IUtf8JsonSerializable + public partial class AmazonRdsForSqlServerTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRdsForSqlServerTableDataset DeserializeAmazonRdsForSqlServerTableDataset(JsonElement element) + internal static AmazonRdsForSqlServerTableDataset DeserializeAmazonRdsForSqlServerTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +250,53 @@ internal static AmazonRdsForSqlServerTableDataset DeserializeAmazonRdsForSqlServ additionalProperties = additionalPropertiesDictionary; return new AmazonRdsForSqlServerTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, schema0.Value, table.Value); } + + AmazonRdsForSqlServerTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRdsForSqlServerTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRdsForSqlServerTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRdsForSqlServerTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRdsForSqlServerTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRdsForSqlServerTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRdsForSqlServerTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.cs index d74625b6ff94..1c81c14e9bef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRdsForSqlServerTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Amazon RDS for SQL Server dataset. public partial class AmazonRdsForSqlServerTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AmazonRdsForSqlServerTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AmazonRdsForSqlServerTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AmazonRdsForSqlServerTableDataset(DataFactoryLinkedServiceReference linke DatasetType = "AmazonRdsForSqlServerTable"; } - /// Initializes a new instance of AmazonRdsForSqlServerTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -44,6 +44,11 @@ internal AmazonRdsForSqlServerTableDataset(string datasetType, string descriptio DatasetType = datasetType ?? "AmazonRdsForSqlServerTable"; } + /// Initializes a new instance of for deserialization. + internal AmazonRdsForSqlServerTableDataset() + { + } + /// The schema name of the SQL Server dataset. Type: string (or Expression with resultType string). public DataFactoryElement SchemaTypePropertiesSchema { get; set; } /// The table name of the SQL Server dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.Serialization.cs index bd90d7db435e..de8909799886 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRedshiftLinkedService : IUtf8JsonSerializable + public partial class AmazonRedshiftLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -99,8 +119,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRedshiftLinkedService DeserializeAmazonRedshiftLinkedService(JsonElement element) + internal static AmazonRedshiftLinkedService DeserializeAmazonRedshiftLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +255,53 @@ internal static AmazonRedshiftLinkedService DeserializeAmazonRedshiftLinkedServi additionalProperties = additionalPropertiesDictionary; return new AmazonRedshiftLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, server, username.Value, password, database, port.Value, encryptedCredential.Value); } + + AmazonRedshiftLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRedshiftLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRedshiftLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRedshiftLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRedshiftLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRedshiftLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRedshiftLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.cs index e4d12299b6c6..cfd7d49be686 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Amazon Redshift. public partial class AmazonRedshiftLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AmazonRedshiftLinkedService. + /// Initializes a new instance of . /// The name of the Amazon Redshift server. Type: string (or Expression with resultType string). /// The database name of the Amazon Redshift source. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public AmazonRedshiftLinkedService(DataFactoryElement server, DataFactor LinkedServiceType = "AmazonRedshift"; } - /// Initializes a new instance of AmazonRedshiftLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -53,6 +53,11 @@ internal AmazonRedshiftLinkedService(string linkedServiceType, IntegrationRuntim LinkedServiceType = linkedServiceType ?? "AmazonRedshift"; } + /// Initializes a new instance of for deserialization. + internal AmazonRedshiftLinkedService() + { + } + /// The name of the Amazon Redshift server. Type: string (or Expression with resultType string). public DataFactoryElement Server { get; set; } /// The username of the Amazon Redshift source. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.Serialization.cs index e6d17fae0844..c539af4f28ec 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRedshiftSource : IUtf8JsonSerializable + public partial class AmazonRedshiftSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RedshiftUnloadSettings)) { writer.WritePropertyName("redshiftUnloadSettings"u8); - writer.WriteObjectValue(RedshiftUnloadSettings); + if (RedshiftUnloadSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RedshiftUnloadSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryTimeout)) { @@ -76,8 +89,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRedshiftSource DeserializeAmazonRedshiftSource(JsonElement element) + internal static AmazonRedshiftSource DeserializeAmazonRedshiftSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +192,53 @@ internal static AmazonRedshiftSource DeserializeAmazonRedshiftSource(JsonElement additionalProperties = additionalPropertiesDictionary; return new AmazonRedshiftSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, redshiftUnloadSettings.Value); } + + AmazonRedshiftSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRedshiftSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRedshiftSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRedshiftSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRedshiftSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRedshiftSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRedshiftSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.cs index a19fe85e8571..423a0c7a3cd7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for Amazon Redshift Source. public partial class AmazonRedshiftSource : TabularSource { - /// Initializes a new instance of AmazonRedshiftSource. + /// Initializes a new instance of . public AmazonRedshiftSource() { CopySourceType = "AmazonRedshiftSource"; } - /// Initializes a new instance of AmazonRedshiftSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.Serialization.cs index c404b3f57014..89ea5293f05c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonRedshiftTableDataset : IUtf8JsonSerializable + public partial class AmazonRedshiftTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonRedshiftTableDataset DeserializeAmazonRedshiftTableDataset(JsonElement element) + internal static AmazonRedshiftTableDataset DeserializeAmazonRedshiftTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static AmazonRedshiftTableDataset DeserializeAmazonRedshiftTableDataset additionalProperties = additionalPropertiesDictionary; return new AmazonRedshiftTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + AmazonRedshiftTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonRedshiftTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonRedshiftTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonRedshiftTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonRedshiftTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonRedshiftTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonRedshiftTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.cs index fa6e6758ca28..883ca30462b4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonRedshiftTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Amazon Redshift table dataset. public partial class AmazonRedshiftTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AmazonRedshiftTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AmazonRedshiftTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AmazonRedshiftTableDataset(DataFactoryLinkedServiceReference linkedServic DatasetType = "AmazonRedshiftTable"; } - /// Initializes a new instance of AmazonRedshiftTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal AmazonRedshiftTableDataset(string datasetType, string description, Data DatasetType = datasetType ?? "AmazonRedshiftTable"; } + /// Initializes a new instance of for deserialization. + internal AmazonRedshiftTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.Serialization.cs index f9aaf2ac112c..3fe115617a76 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3CompatibleLinkedService : IUtf8JsonSerializable + public partial class AmazonS3CompatibleLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -100,8 +120,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3CompatibleLinkedService DeserializeAmazonS3CompatibleLinkedService(JsonElement element) + internal static AmazonS3CompatibleLinkedService DeserializeAmazonS3CompatibleLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -232,5 +254,53 @@ internal static AmazonS3CompatibleLinkedService DeserializeAmazonS3CompatibleLin additionalProperties = additionalPropertiesDictionary; return new AmazonS3CompatibleLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, accessKeyId.Value, secretAccessKey, serviceUrl.Value, forcePathStyle.Value, encryptedCredential.Value); } + + AmazonS3CompatibleLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3CompatibleLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3CompatibleLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3CompatibleLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3CompatibleLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3CompatibleLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3CompatibleLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.cs index 52ec5e76b8fa..29bda7e64eb0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Amazon S3 Compatible. public partial class AmazonS3CompatibleLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AmazonS3CompatibleLinkedService. + /// Initializes a new instance of . public AmazonS3CompatibleLinkedService() { LinkedServiceType = "AmazonS3Compatible"; } - /// Initializes a new instance of AmazonS3CompatibleLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.Serialization.cs index b248ce8b714e..31fca261a1cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3CompatibleLocation : IUtf8JsonSerializable + public partial class AmazonS3CompatibleLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BucketName)) { @@ -52,8 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3CompatibleLocation DeserializeAmazonS3CompatibleLocation(JsonElement element) + internal static AmazonS3CompatibleLocation DeserializeAmazonS3CompatibleLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,5 +121,53 @@ internal static AmazonS3CompatibleLocation DeserializeAmazonS3CompatibleLocation additionalProperties = additionalPropertiesDictionary; return new AmazonS3CompatibleLocation(type, folderPath.Value, fileName.Value, additionalProperties, bucketName.Value, version.Value); } + + AmazonS3CompatibleLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3CompatibleLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3CompatibleLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3CompatibleLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3CompatibleLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3CompatibleLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3CompatibleLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.cs index a5daeecddca6..17ce4515b9b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of Amazon S3 Compatible dataset. public partial class AmazonS3CompatibleLocation : DatasetLocation { - /// Initializes a new instance of AmazonS3CompatibleLocation. + /// Initializes a new instance of . public AmazonS3CompatibleLocation() { DatasetLocationType = "AmazonS3CompatibleLocation"; } - /// Initializes a new instance of AmazonS3CompatibleLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.Serialization.cs index ab8ec5d3a1b6..377e046b3e7a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3CompatibleReadSettings : IUtf8JsonSerializable + public partial class AmazonS3CompatibleReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3CompatibleReadSettings DeserializeAmazonS3CompatibleReadSettings(JsonElement element) + internal static AmazonS3CompatibleReadSettings DeserializeAmazonS3CompatibleReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static AmazonS3CompatibleReadSettings DeserializeAmazonS3CompatibleRead additionalProperties = additionalPropertiesDictionary; return new AmazonS3CompatibleReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + AmazonS3CompatibleReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3CompatibleReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3CompatibleReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3CompatibleReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3CompatibleReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3CompatibleReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3CompatibleReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.cs index 470c61502308..3638797c131e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3CompatibleReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Amazon S3 Compatible read settings. public partial class AmazonS3CompatibleReadSettings : StoreReadSettings { - /// Initializes a new instance of AmazonS3CompatibleReadSettings. + /// Initializes a new instance of . public AmazonS3CompatibleReadSettings() { StoreReadSettingsType = "AmazonS3CompatibleReadSettings"; } - /// Initializes a new instance of AmazonS3CompatibleReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.Serialization.cs index 367cb29139bb..5f2f2634913e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3Dataset : IUtf8JsonSerializable + public partial class AmazonS3Dataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -103,12 +123,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } } if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -123,8 +157,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3Dataset DeserializeAmazonS3Dataset(JsonElement element) + internal static AmazonS3Dataset DeserializeAmazonS3Dataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -311,5 +347,53 @@ internal static AmazonS3Dataset DeserializeAmazonS3Dataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AmazonS3Dataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, bucketName, key.Value, prefix.Value, version.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, format.Value, compression.Value); } + + AmazonS3Dataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3Dataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3Dataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3Dataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3Dataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3Dataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3Dataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.cs index 70f30f2d48ce..3d2b8004f59a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Dataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A single Amazon Simple Storage Service (S3) object or a set of S3 objects. public partial class AmazonS3Dataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AmazonS3Dataset. + /// Initializes a new instance of . /// Linked service reference. /// The name of the Amazon S3 bucket. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public AmazonS3Dataset(DataFactoryLinkedServiceReference linkedServiceName, Data DatasetType = "AmazonS3Object"; } - /// Initializes a new instance of AmazonS3Dataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -63,6 +63,11 @@ internal AmazonS3Dataset(string datasetType, string description, DataFactoryElem DatasetType = datasetType ?? "AmazonS3Object"; } + /// Initializes a new instance of for deserialization. + internal AmazonS3Dataset() + { + } + /// The name of the Amazon S3 bucket. Type: string (or Expression with resultType string). public DataFactoryElement BucketName { get; set; } /// The key of the Amazon S3 object. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.Serialization.cs index 29d16750df6e..c8132aa6e9cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3LinkedService : IUtf8JsonSerializable + public partial class AmazonS3LinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3LinkedService DeserializeAmazonS3LinkedService(JsonElement element) + internal static AmazonS3LinkedService DeserializeAmazonS3LinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static AmazonS3LinkedService DeserializeAmazonS3LinkedService(JsonEleme additionalProperties = additionalPropertiesDictionary; return new AmazonS3LinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, authenticationType.Value, accessKeyId.Value, secretAccessKey, serviceUrl.Value, sessionToken, encryptedCredential.Value); } + + AmazonS3LinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3LinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3LinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3LinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3LinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3LinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3LinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.cs index 6dcfd09c4b6f..cc34ff7a28f2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3LinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Amazon S3. public partial class AmazonS3LinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AmazonS3LinkedService. + /// Initializes a new instance of . public AmazonS3LinkedService() { LinkedServiceType = "AmazonS3"; } - /// Initializes a new instance of AmazonS3LinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.Serialization.cs index 80ec2ed51705..c0532a889563 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3Location : IUtf8JsonSerializable + public partial class AmazonS3Location : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BucketName)) { @@ -52,8 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3Location DeserializeAmazonS3Location(JsonElement element) + internal static AmazonS3Location DeserializeAmazonS3Location(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,5 +121,53 @@ internal static AmazonS3Location DeserializeAmazonS3Location(JsonElement element additionalProperties = additionalPropertiesDictionary; return new AmazonS3Location(type, folderPath.Value, fileName.Value, additionalProperties, bucketName.Value, version.Value); } + + AmazonS3Location IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3Location(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3Location IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3Location(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3Location model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3Location(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3Location(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.cs index e0b51b348afc..c9ea2ee071d9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3Location.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of amazon S3 dataset. public partial class AmazonS3Location : DatasetLocation { - /// Initializes a new instance of AmazonS3Location. + /// Initializes a new instance of . public AmazonS3Location() { DatasetLocationType = "AmazonS3Location"; } - /// Initializes a new instance of AmazonS3Location. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs index ef54b3268305..d0519fb6d798 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AmazonS3ReadSettings : IUtf8JsonSerializable + public partial class AmazonS3ReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AmazonS3ReadSettings DeserializeAmazonS3ReadSettings(JsonElement element) + internal static AmazonS3ReadSettings DeserializeAmazonS3ReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static AmazonS3ReadSettings DeserializeAmazonS3ReadSettings(JsonElement additionalProperties = additionalPropertiesDictionary; return new AmazonS3ReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + AmazonS3ReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAmazonS3ReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AmazonS3ReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAmazonS3ReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AmazonS3ReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AmazonS3ReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAmazonS3ReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.cs index f8d5061a49de..8440657d5fe3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AmazonS3ReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Amazon S3 read settings. public partial class AmazonS3ReadSettings : StoreReadSettings { - /// Initializes a new instance of AmazonS3ReadSettings. + /// Initializes a new instance of . public AmazonS3ReadSettings() { StoreReadSettingsType = "AmazonS3ReadSettings"; } - /// Initializes a new instance of AmazonS3ReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.Serialization.cs index 65c970681b89..61490892465d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AppFiguresLinkedService : IUtf8JsonSerializable + public partial class AppFiguresLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -79,8 +99,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AppFiguresLinkedService DeserializeAppFiguresLinkedService(JsonElement element) + internal static AppFiguresLinkedService DeserializeAppFiguresLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -183,5 +205,53 @@ internal static AppFiguresLinkedService DeserializeAppFiguresLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new AppFiguresLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, userName, password, clientKey); } + + AppFiguresLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppFiguresLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppFiguresLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppFiguresLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppFiguresLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppFiguresLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppFiguresLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.cs index 63d8d95c34f9..9598705fd9ff 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppFiguresLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for AppFigures. public partial class AppFiguresLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AppFiguresLinkedService. + /// Initializes a new instance of . /// The username of the Appfigures source. Type: string (or Expression with resultType string). /// The password of the AppFigures source. /// The client key for the AppFigures source. @@ -32,7 +32,7 @@ public AppFiguresLinkedService(DataFactoryElement userName, DataFactoryS LinkedServiceType = "AppFigures"; } - /// Initializes a new instance of AppFiguresLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal AppFiguresLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "AppFigures"; } + /// Initializes a new instance of for deserialization. + internal AppFiguresLinkedService() + { + } + /// The username of the Appfigures source. Type: string (or Expression with resultType string). public DataFactoryElement UserName { get; set; } /// The password of the AppFigures source. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.Serialization.cs index 16d32ec29af8..bd87dbf2ad58 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AppendVariableActivity : IUtf8JsonSerializable + public partial class AppendVariableActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -82,8 +102,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AppendVariableActivity DeserializeAppendVariableActivity(JsonElement element) + internal static AppendVariableActivity DeserializeAppendVariableActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -193,5 +215,53 @@ internal static AppendVariableActivity DeserializeAppendVariableActivity(JsonEle additionalProperties = additionalPropertiesDictionary; return new AppendVariableActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, variableName.Value, value.Value); } + + AppendVariableActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAppendVariableActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AppendVariableActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAppendVariableActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AppendVariableActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AppendVariableActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAppendVariableActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.cs index e1f44633d96e..76fa2510807b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AppendVariableActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Append value for a Variable of type Array. public partial class AppendVariableActivity : ControlActivity { - /// Initializes a new instance of AppendVariableActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public AppendVariableActivity(string name) : base(name) @@ -25,7 +25,7 @@ public AppendVariableActivity(string name) : base(name) ActivityType = "AppendVariable"; } - /// Initializes a new instance of AppendVariableActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -43,6 +43,11 @@ internal AppendVariableActivity(string name, string activityType, string descrip ActivityType = activityType ?? "AppendVariable"; } + /// Initializes a new instance of for deserialization. + internal AppendVariableActivity() + { + } + /// Name of the variable whose value needs to be appended to. public string VariableName { get; set; } /// Value to be appended. Type: could be a static value matching type of the variable item or Expression with resultType matching type of the variable item. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.Serialization.cs index 3ecab41bc01b..d551076015e9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AsanaLinkedService : IUtf8JsonSerializable + public partial class AsanaLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -81,8 +101,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AsanaLinkedService DeserializeAsanaLinkedService(JsonElement element) + internal static AsanaLinkedService DeserializeAsanaLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -179,5 +201,53 @@ internal static AsanaLinkedService DeserializeAsanaLinkedService(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new AsanaLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, apiToken, encryptedCredential.Value); } + + AsanaLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAsanaLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AsanaLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAsanaLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AsanaLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AsanaLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAsanaLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.cs index 2e2d79a1877e..08139921eabd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AsanaLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Asana. public partial class AsanaLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AsanaLinkedService. + /// Initializes a new instance of . /// The api token for the Asana source. /// is null. public AsanaLinkedService(DataFactorySecretBaseDefinition apiToken) @@ -26,7 +26,7 @@ public AsanaLinkedService(DataFactorySecretBaseDefinition apiToken) LinkedServiceType = "Asana"; } - /// Initializes a new instance of AsanaLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -42,6 +42,11 @@ internal AsanaLinkedService(string linkedServiceType, IntegrationRuntimeReferenc LinkedServiceType = linkedServiceType ?? "Asana"; } + /// Initializes a new instance of for deserialization. + internal AsanaLinkedService() + { + } + /// The api token for the Asana source. public DataFactorySecretBaseDefinition ApiToken { get; set; } /// The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.Serialization.cs index ab40d7bb091d..1f55e00babd5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AvroDataset : IUtf8JsonSerializable + public partial class AvroDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,14 +82,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(AvroCompressionCodec)) { @@ -101,8 +128,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AvroDataset DeserializeAvroDataset(JsonElement element) + internal static AvroDataset DeserializeAvroDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -243,5 +272,53 @@ internal static AvroDataset DeserializeAvroDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AvroDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, avroCompressionCodec.Value, Optional.ToNullable(avroCompressionLevel)); } + + AvroDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvroDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvroDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvroDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvroDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvroDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvroDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.cs index ff45ca093b44..8a048ccd894c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Avro dataset. public partial class AvroDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AvroDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AvroDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AvroDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(l DatasetType = "Avro"; } - /// Initializes a new instance of AvroDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -50,6 +50,11 @@ internal AvroDataset(string datasetType, string description, DataFactoryElement< DatasetType = datasetType ?? "Avro"; } + /// Initializes a new instance of for deserialization. + internal AvroDataset() + { + } + /// /// The location of the avro storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.Serialization.cs index 8a32411b84e9..de4bf7de34b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AvroSink : IUtf8JsonSerializable + public partial class AvroSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -72,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AvroSink DeserializeAvroSink(JsonElement element) + internal static AvroSink DeserializeAvroSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +195,53 @@ internal static AvroSink DeserializeAvroSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AvroSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value); } + + AvroSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvroSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvroSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvroSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvroSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvroSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvroSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.cs index eb825ec22ac5..f35dcf4128cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Avro sink. public partial class AvroSink : CopySink { - /// Initializes a new instance of AvroSink. + /// Initializes a new instance of . public AvroSink() { CopySinkType = "AvroSink"; } - /// Initializes a new instance of AvroSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.Serialization.cs index 3b20ef58efe4..1f2524dd6599 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AvroSource : IUtf8JsonSerializable + public partial class AvroSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -66,8 +79,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AvroSource DeserializeAvroSource(JsonElement element) + internal static AvroSource DeserializeAvroSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +162,53 @@ internal static AvroSource DeserializeAvroSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AvroSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, additionalColumns.Value); } + + AvroSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvroSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvroSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvroSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvroSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvroSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvroSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.cs index 2fcb85b4ac4d..bc8a1a46e302 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Avro source. public partial class AvroSource : CopyActivitySource { - /// Initializes a new instance of AvroSource. + /// Initializes a new instance of . public AvroSource() { CopySourceType = "AvroSource"; } - /// Initializes a new instance of AvroSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.Serialization.cs index 85ac915f5098..ed8ef80fafc8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AvroWriteSettings : IUtf8JsonSerializable + public partial class AvroWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RecordName)) { @@ -52,8 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AvroWriteSettings DeserializeAvroWriteSettings(JsonElement element) + internal static AvroWriteSettings DeserializeAvroWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -105,5 +113,53 @@ internal static AvroWriteSettings DeserializeAvroWriteSettings(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new AvroWriteSettings(type, additionalProperties, recordName.Value, recordNamespace.Value, maxRowsPerFile.Value, fileNamePrefix.Value); } + + AvroWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAvroWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AvroWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAvroWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AvroWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AvroWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAvroWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.cs index 34cb6386af66..4166fff909cb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AvroWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Avro write settings. public partial class AvroWriteSettings : FormatWriteSettings { - /// Initializes a new instance of AvroWriteSettings. + /// Initializes a new instance of . public AvroWriteSettings() { FormatWriteSettingsType = "AvroWriteSettings"; } - /// Initializes a new instance of AvroWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// Additional Properties. /// Top level record name in write result, which is required in AVRO spec. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.Serialization.cs index 1f1f2b4df342..2e254107e560 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzPowerShellSetup : IUtf8JsonSerializable + public partial class AzPowerShellSetup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CustomSetupBaseType); @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static AzPowerShellSetup DeserializeAzPowerShellSetup(JsonElement element) + internal static AzPowerShellSetup DeserializeAzPowerShellSetup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string type = default; string version = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -57,8 +80,61 @@ internal static AzPowerShellSetup DeserializeAzPowerShellSetup(JsonElement eleme } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzPowerShellSetup(type, version, serializedAdditionalRawData); + } + + AzPowerShellSetup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzPowerShellSetup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzPowerShellSetup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzPowerShellSetup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzPowerShellSetup model) + { + if (model is null) + { + return null; } - return new AzPowerShellSetup(type, version); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzPowerShellSetup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzPowerShellSetup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.cs index da43e2683e8c..c27c2fa6ee4b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzPowerShellSetup.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The express custom setup of installing Azure PowerShell. public partial class AzPowerShellSetup : CustomSetupBase { - /// Initializes a new instance of AzPowerShellSetup. + /// Initializes a new instance of . /// The required version of Azure PowerShell to install. /// is null. public AzPowerShellSetup(string version) @@ -24,15 +25,21 @@ public AzPowerShellSetup(string version) CustomSetupBaseType = "AzPowerShellSetup"; } - /// Initializes a new instance of AzPowerShellSetup. + /// Initializes a new instance of . /// The type of custom setup. /// The required version of Azure PowerShell to install. - internal AzPowerShellSetup(string customSetupBaseType, string version) : base(customSetupBaseType) + /// Keeps track of any properties unknown to the library. + internal AzPowerShellSetup(string customSetupBaseType, string version, Dictionary serializedAdditionalRawData) : base(customSetupBaseType, serializedAdditionalRawData) { Version = version; CustomSetupBaseType = customSetupBaseType ?? "AzPowerShellSetup"; } + /// Initializes a new instance of for deserialization. + internal AzPowerShellSetup() + { + } + /// The required version of Azure PowerShell to install. public string Version { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.Serialization.cs index 3658d5972b24..36946011415f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBatchLinkedService : IUtf8JsonSerializable + public partial class AzureBatchLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -82,7 +102,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -97,8 +124,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBatchLinkedService DeserializeAzureBatchLinkedService(JsonElement element) + internal static AzureBatchLinkedService DeserializeAzureBatchLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +262,53 @@ internal static AzureBatchLinkedService DeserializeAzureBatchLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureBatchLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, accountName, accessKey, batchUri, poolName, linkedServiceName, encryptedCredential.Value, credential.Value); } + + AzureBatchLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBatchLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBatchLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBatchLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBatchLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBatchLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBatchLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.cs index 174449c77193..2b728d1ce16b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBatchLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Batch linked service. public partial class AzureBatchLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureBatchLinkedService. + /// Initializes a new instance of . /// The Azure Batch account name. Type: string (or Expression with resultType string). /// The Azure Batch URI. Type: string (or Expression with resultType string). /// The Azure Batch pool name. Type: string (or Expression with resultType string). @@ -35,7 +35,7 @@ public AzureBatchLinkedService(DataFactoryElement accountName, DataFacto LinkedServiceType = "AzureBatch"; } - /// Initializes a new instance of AzureBatchLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -61,6 +61,11 @@ internal AzureBatchLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "AzureBatch"; } + /// Initializes a new instance of for deserialization. + internal AzureBatchLinkedService() + { + } + /// The Azure Batch account name. Type: string (or Expression with resultType string). public DataFactoryElement AccountName { get; set; } /// The Azure Batch account access key. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.Serialization.cs index d2b400621aef..21d754dc63ae 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobDataset : IUtf8JsonSerializable + public partial class AzureBlobDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -101,12 +121,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } } if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -121,8 +155,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobDataset DeserializeAzureBlobDataset(JsonElement element) + internal static AzureBlobDataset DeserializeAzureBlobDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -303,5 +339,53 @@ internal static AzureBlobDataset DeserializeAzureBlobDataset(JsonElement element additionalProperties = additionalPropertiesDictionary; return new AzureBlobDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, folderPath.Value, tableRootLocation.Value, fileName.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, format.Value, compression.Value); } + + AzureBlobDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.cs index 544cae418c43..649c0677a1da 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure Blob storage. public partial class AzureBlobDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureBlobDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureBlobDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureBlobDataset(DataFactoryLinkedServiceReference linkedServiceName) : b DatasetType = "AzureBlob"; } - /// Initializes a new instance of AzureBlobDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -58,6 +58,11 @@ internal AzureBlobDataset(string datasetType, string description, DataFactoryEle DatasetType = datasetType ?? "AzureBlob"; } + /// Initializes a new instance of for deserialization. + internal AzureBlobDataset() + { + } + /// The path of the Azure Blob storage. Type: string (or Expression with resultType string). public DataFactoryElement FolderPath { get; set; } /// The root of blob path. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.Serialization.cs index bdfa1933c798..65942ff58109 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSDataset : IUtf8JsonSerializable + public partial class AzureBlobFSDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -86,12 +106,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } } if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -106,8 +140,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSDataset DeserializeAzureBlobFSDataset(JsonElement element) + internal static AzureBlobFSDataset DeserializeAzureBlobFSDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -258,5 +294,53 @@ internal static AzureBlobFSDataset DeserializeAzureBlobFSDataset(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, folderPath.Value, fileName.Value, format.Value, compression.Value); } + + AzureBlobFSDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.cs index 4ebc643a4cb5..7b0366a85981 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure Data Lake Storage Gen2 storage. public partial class AzureBlobFSDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureBlobFSDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureBlobFSDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureBlobFSDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "AzureBlobFSFile"; } - /// Initializes a new instance of AzureBlobFSDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -52,6 +52,11 @@ internal AzureBlobFSDataset(string datasetType, string description, DataFactoryE DatasetType = datasetType ?? "AzureBlobFSFile"; } + /// Initializes a new instance of for deserialization. + internal AzureBlobFSDataset() + { + } + /// The path of the Azure Data Lake Storage Gen2 storage. Type: string (or Expression with resultType string). public DataFactoryElement FolderPath { get; set; } /// The name of the Azure Data Lake Storage Gen2. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.Serialization.cs index 642518f971e1..20173e5a8d2d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSLinkedService : IUtf8JsonSerializable + public partial class AzureBlobFSLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -100,7 +120,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } if (Optional.IsDefined(ServicePrincipalCredentialType)) { @@ -135,8 +162,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSLinkedService DeserializeAzureBlobFSLinkedService(JsonElement element) + internal static AzureBlobFSLinkedService DeserializeAzureBlobFSLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -337,5 +366,53 @@ internal static AzureBlobFSLinkedService DeserializeAzureBlobFSLinkedService(Jso additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url.Value, accountKey.Value, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, encryptedCredential.Value, credential.Value, servicePrincipalCredentialType.Value, servicePrincipalCredential, sasUri.Value, sasToken); } + + AzureBlobFSLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.cs index d590aa70191b..a1af2494afe4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Lake Storage Gen2 linked service. public partial class AzureBlobFSLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureBlobFSLinkedService. + /// Initializes a new instance of . public AzureBlobFSLinkedService() { LinkedServiceType = "AzureBlobFS"; } - /// Initializes a new instance of AzureBlobFSLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.Serialization.cs index d6d6b8f8fc4f..e08e805e1ee6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSLocation : IUtf8JsonSerializable + public partial class AzureBlobFSLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FileSystem)) { @@ -47,8 +53,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSLocation DeserializeAzureBlobFSLocation(JsonElement element) + internal static AzureBlobFSLocation DeserializeAzureBlobFSLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,5 +106,53 @@ internal static AzureBlobFSLocation DeserializeAzureBlobFSLocation(JsonElement e additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSLocation(type, folderPath.Value, fileName.Value, additionalProperties, fileSystem.Value); } + + AzureBlobFSLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.cs index c738818c959c..63f72779c1d8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of azure blobFS dataset. public partial class AzureBlobFSLocation : DatasetLocation { - /// Initializes a new instance of AzureBlobFSLocation. + /// Initializes a new instance of . public AzureBlobFSLocation() { DatasetLocationType = "AzureBlobFSLocation"; } - /// Initializes a new instance of AzureBlobFSLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.Serialization.cs index 34f31f262bea..0d729a525101 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSReadSettings : IUtf8JsonSerializable + public partial class AzureBlobFSReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -87,8 +93,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSReadSettings DeserializeAzureBlobFSReadSettings(JsonElement element) + internal static AzureBlobFSReadSettings DeserializeAzureBlobFSReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -218,5 +226,53 @@ internal static AzureBlobFSReadSettings DeserializeAzureBlobFSReadSettings(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + AzureBlobFSReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.cs index 67dd420e911b..0118a00a34a9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure blobFS read settings. public partial class AzureBlobFSReadSettings : StoreReadSettings { - /// Initializes a new instance of AzureBlobFSReadSettings. + /// Initializes a new instance of . public AzureBlobFSReadSettings() { StoreReadSettingsType = "AzureBlobFSReadSettings"; } - /// Initializes a new instance of AzureBlobFSReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.Serialization.cs index d7ea633b8a55..8adccf6b285e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSSink : IUtf8JsonSerializable + public partial class AzureBlobFSSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CopyBehavior)) { @@ -29,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Metadata) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -77,8 +90,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSSink DeserializeAzureBlobFSSink(JsonElement element) + internal static AzureBlobFSSink DeserializeAzureBlobFSSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -183,5 +198,53 @@ internal static AzureBlobFSSink DeserializeAzureBlobFSSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, copyBehavior.Value, Optional.ToList(metadata)); } + + AzureBlobFSSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.cs index 31c571f14d07..7721056ee22e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSink.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Data Lake Storage Gen2 sink. public partial class AzureBlobFSSink : CopySink { - /// Initializes a new instance of AzureBlobFSSink. + /// Initializes a new instance of . public AzureBlobFSSink() { Metadata = new ChangeTrackingList(); CopySinkType = "AzureBlobFSSink"; } - /// Initializes a new instance of AzureBlobFSSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.Serialization.cs index e321ec1f0c56..f57040b544da 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSSource : IUtf8JsonSerializable + public partial class AzureBlobFSSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TreatEmptyAsNull)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSSource DeserializeAzureBlobFSSource(JsonElement element) + internal static AzureBlobFSSource DeserializeAzureBlobFSSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static AzureBlobFSSource DeserializeAzureBlobFSSource(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, treatEmptyAsNull.Value, skipHeaderLineCount.Value, recursive.Value); } + + AzureBlobFSSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.cs index 325fac414454..b868f3359f95 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure BlobFS source. public partial class AzureBlobFSSource : CopyActivitySource { - /// Initializes a new instance of AzureBlobFSSource. + /// Initializes a new instance of . public AzureBlobFSSource() { CopySourceType = "AzureBlobFSSource"; } - /// Initializes a new instance of AzureBlobFSSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.Serialization.cs index bc2227637c42..7677bfd6b378 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobFSWriteSettings : IUtf8JsonSerializable + public partial class AzureBlobFSWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BlockSizeInMB)) { @@ -56,8 +62,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobFSWriteSettings DeserializeAzureBlobFSWriteSettings(JsonElement element) + internal static AzureBlobFSWriteSettings DeserializeAzureBlobFSWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,5 +125,53 @@ internal static AzureBlobFSWriteSettings DeserializeAzureBlobFSWriteSettings(Jso additionalProperties = additionalPropertiesDictionary; return new AzureBlobFSWriteSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, copyBehavior.Value, additionalProperties, blockSizeInMB.Value); } + + AzureBlobFSWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobFSWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobFSWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobFSWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobFSWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobFSWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobFSWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs index dab4f95372f4..5519bff3dd36 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure blobFS write settings. public partial class AzureBlobFSWriteSettings : StoreWriteSettings { - /// Initializes a new instance of AzureBlobFSWriteSettings. + /// Initializes a new instance of . public AzureBlobFSWriteSettings() { StoreWriteSettingsType = "AzureBlobFSWriteSettings"; } - /// Initializes a new instance of AzureBlobFSWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.Serialization.cs index 5a95f2ebfb40..6ac7181b2c9f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobStorageLinkedService : IUtf8JsonSerializable + public partial class AzureBlobStorageLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -120,7 +140,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } if (Optional.IsDefined(AuthenticationType)) { @@ -145,8 +172,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobStorageLinkedService DeserializeAzureBlobStorageLinkedService(JsonElement element) + internal static AzureBlobStorageLinkedService DeserializeAzureBlobStorageLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -367,5 +396,53 @@ internal static AzureBlobStorageLinkedService DeserializeAzureBlobStorageLinkedS additionalProperties = additionalPropertiesDictionary; return new AzureBlobStorageLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, accountKey, sasUri.Value, sasToken, serviceEndpoint.Value, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, accountKind.Value, encryptedCredential.Value, credential.Value, Optional.ToNullable(authenticationType), containerUri.Value); } + + AzureBlobStorageLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobStorageLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobStorageLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobStorageLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobStorageLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobStorageLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobStorageLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.cs index 4f7fb99402ec..3c1b818d07d1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The azure blob storage linked service. public partial class AzureBlobStorageLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureBlobStorageLinkedService. + /// Initializes a new instance of . public AzureBlobStorageLinkedService() { LinkedServiceType = "AzureBlobStorage"; } - /// Initializes a new instance of AzureBlobStorageLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.Serialization.cs index f537bf718a27..84524a97427c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobStorageLocation : IUtf8JsonSerializable + public partial class AzureBlobStorageLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Container)) { @@ -47,8 +53,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobStorageLocation DeserializeAzureBlobStorageLocation(JsonElement element) + internal static AzureBlobStorageLocation DeserializeAzureBlobStorageLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,5 +106,53 @@ internal static AzureBlobStorageLocation DeserializeAzureBlobStorageLocation(Jso additionalProperties = additionalPropertiesDictionary; return new AzureBlobStorageLocation(type, folderPath.Value, fileName.Value, additionalProperties, container.Value); } + + AzureBlobStorageLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobStorageLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobStorageLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobStorageLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobStorageLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobStorageLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobStorageLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.cs index 263199618a79..d518db9a185d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of azure blob dataset. public partial class AzureBlobStorageLocation : DatasetLocation { - /// Initializes a new instance of AzureBlobStorageLocation. + /// Initializes a new instance of . public AzureBlobStorageLocation() { DatasetLocationType = "AzureBlobStorageLocation"; } - /// Initializes a new instance of AzureBlobStorageLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs index 1636ecaed26e..6ac72848da64 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobStorageReadSettings : IUtf8JsonSerializable + public partial class AzureBlobStorageReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobStorageReadSettings DeserializeAzureBlobStorageReadSettings(JsonElement element) + internal static AzureBlobStorageReadSettings DeserializeAzureBlobStorageReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static AzureBlobStorageReadSettings DeserializeAzureBlobStorageReadSett additionalProperties = additionalPropertiesDictionary; return new AzureBlobStorageReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + AzureBlobStorageReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobStorageReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobStorageReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobStorageReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobStorageReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobStorageReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobStorageReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.cs index 9dd7d2cd728f..458bb327644f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure blob read settings. public partial class AzureBlobStorageReadSettings : StoreReadSettings { - /// Initializes a new instance of AzureBlobStorageReadSettings. + /// Initializes a new instance of . public AzureBlobStorageReadSettings() { StoreReadSettingsType = "AzureBlobStorageReadSettings"; } - /// Initializes a new instance of AzureBlobStorageReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.Serialization.cs index 7280e029a784..10bb0f866620 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureBlobStorageWriteSettings : IUtf8JsonSerializable + public partial class AzureBlobStorageWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BlockSizeInMB)) { @@ -56,8 +62,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureBlobStorageWriteSettings DeserializeAzureBlobStorageWriteSettings(JsonElement element) + internal static AzureBlobStorageWriteSettings DeserializeAzureBlobStorageWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,5 +125,53 @@ internal static AzureBlobStorageWriteSettings DeserializeAzureBlobStorageWriteSe additionalProperties = additionalPropertiesDictionary; return new AzureBlobStorageWriteSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, copyBehavior.Value, additionalProperties, blockSizeInMB.Value); } + + AzureBlobStorageWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobStorageWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureBlobStorageWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureBlobStorageWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureBlobStorageWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureBlobStorageWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureBlobStorageWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs index e4a6ef074f2a..f56113b6c8b9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure blob write settings. public partial class AzureBlobStorageWriteSettings : StoreWriteSettings { - /// Initializes a new instance of AzureBlobStorageWriteSettings. + /// Initializes a new instance of . public AzureBlobStorageWriteSettings() { StoreWriteSettingsType = "AzureBlobStorageWriteSettings"; } - /// Initializes a new instance of AzureBlobStorageWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.Serialization.cs index 94d12ebd6607..fd2a5f3e98f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataExplorerCommandActivity : IUtf8JsonSerializable + public partial class AzureDataExplorerCommandActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -89,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataExplorerCommandActivity DeserializeAzureDataExplorerCommandActivity(JsonElement element) + internal static AzureDataExplorerCommandActivity DeserializeAzureDataExplorerCommandActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -220,5 +249,53 @@ internal static AzureDataExplorerCommandActivity DeserializeAzureDataExplorerCom additionalProperties = additionalPropertiesDictionary; return new AzureDataExplorerCommandActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, command, commandTimeout.Value); } + + AzureDataExplorerCommandActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataExplorerCommandActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataExplorerCommandActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataExplorerCommandActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataExplorerCommandActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataExplorerCommandActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataExplorerCommandActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.cs index e82d8e0b1e8e..71d8b4b40edd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerCommandActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Explorer command activity. public partial class AzureDataExplorerCommandActivity : ExecutionActivity { - /// Initializes a new instance of AzureDataExplorerCommandActivity. + /// Initializes a new instance of . /// Activity name. /// A control command, according to the Azure Data Explorer command syntax. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public AzureDataExplorerCommandActivity(string name, DataFactoryElement ActivityType = "AzureDataExplorerCommand"; } - /// Initializes a new instance of AzureDataExplorerCommandActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -48,6 +48,11 @@ internal AzureDataExplorerCommandActivity(string name, string activityType, stri ActivityType = activityType ?? "AzureDataExplorerCommand"; } + /// Initializes a new instance of for deserialization. + internal AzureDataExplorerCommandActivity() + { + } + /// A control command, according to the Azure Data Explorer command syntax. Type: string (or Expression with resultType string). public DataFactoryElement Command { get; set; } /// Control command timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9]))..). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.Serialization.cs index ccc1443f7580..5930496c8bfa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataExplorerLinkedService : IUtf8JsonSerializable + public partial class AzureDataExplorerLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -84,7 +104,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -99,8 +126,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataExplorerLinkedService DeserializeAzureDataExplorerLinkedService(JsonElement element) + internal static AzureDataExplorerLinkedService DeserializeAzureDataExplorerLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -237,5 +266,53 @@ internal static AzureDataExplorerLinkedService DeserializeAzureDataExplorerLinke additionalProperties = additionalPropertiesDictionary; return new AzureDataExplorerLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, servicePrincipalId.Value, servicePrincipalKey, database, tenant.Value, credential.Value); } + + AzureDataExplorerLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataExplorerLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataExplorerLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataExplorerLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataExplorerLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataExplorerLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataExplorerLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.cs index d5a845511ffb..42de2ad3f699 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Explorer (Kusto) linked service. public partial class AzureDataExplorerLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureDataExplorerLinkedService. + /// Initializes a new instance of . /// The endpoint of Azure Data Explorer (the engine's endpoint). URL will be in the format https://<clusterName>.<regionName>.kusto.windows.net. Type: string (or Expression with resultType string). /// Database name for connection. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public AzureDataExplorerLinkedService(DataFactoryElement endpoint, DataF LinkedServiceType = "AzureDataExplorer"; } - /// Initializes a new instance of AzureDataExplorerLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -53,6 +53,11 @@ internal AzureDataExplorerLinkedService(string linkedServiceType, IntegrationRun LinkedServiceType = linkedServiceType ?? "AzureDataExplorer"; } + /// Initializes a new instance of for deserialization. + internal AzureDataExplorerLinkedService() + { + } + /// The endpoint of Azure Data Explorer (the engine's endpoint). URL will be in the format https://<clusterName>.<regionName>.kusto.windows.net. Type: string (or Expression with resultType string). public DataFactoryElement Endpoint { get; set; } /// The ID of the service principal used to authenticate against Azure Data Explorer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.Serialization.cs index 70cfcb9baf15..721cecc013eb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataExplorerSink : IUtf8JsonSerializable + public partial class AzureDataExplorerSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IngestionMappingName)) { @@ -77,8 +83,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataExplorerSink DeserializeAzureDataExplorerSink(JsonElement element) + internal static AzureDataExplorerSink DeserializeAzureDataExplorerSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -188,5 +196,53 @@ internal static AzureDataExplorerSink DeserializeAzureDataExplorerSink(JsonEleme additionalProperties = additionalPropertiesDictionary; return new AzureDataExplorerSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, ingestionMappingName.Value, ingestionMappingAsJson.Value, flushImmediately.Value); } + + AzureDataExplorerSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataExplorerSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataExplorerSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataExplorerSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataExplorerSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataExplorerSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataExplorerSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.cs index 7d3c4474d057..32f96900e796 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Data Explorer sink. public partial class AzureDataExplorerSink : CopySink { - /// Initializes a new instance of AzureDataExplorerSink. + /// Initializes a new instance of . public AzureDataExplorerSink() { CopySinkType = "AzureDataExplorerSink"; } - /// Initializes a new instance of AzureDataExplorerSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.Serialization.cs index 372f2a73e5b6..e60dbc69af32 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataExplorerSource : IUtf8JsonSerializable + public partial class AzureDataExplorerSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("query"u8); JsonSerializer.Serialize(writer, Query); @@ -77,8 +83,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataExplorerSource DeserializeAzureDataExplorerSource(JsonElement element) + internal static AzureDataExplorerSource DeserializeAzureDataExplorerSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -174,5 +182,53 @@ internal static AzureDataExplorerSource DeserializeAzureDataExplorerSource(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureDataExplorerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query, noTruncation.Value, queryTimeout.Value, additionalColumns.Value); } + + AzureDataExplorerSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataExplorerSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataExplorerSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataExplorerSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataExplorerSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataExplorerSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataExplorerSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.cs index 65709edf4ecc..b01d9ec29e54 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerSource.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Data Explorer (Kusto) source. public partial class AzureDataExplorerSource : CopyActivitySource { - /// Initializes a new instance of AzureDataExplorerSource. + /// Initializes a new instance of . /// Database query. Should be a Kusto Query Language (KQL) query. Type: string (or Expression with resultType string). /// is null. public AzureDataExplorerSource(DataFactoryElement query) @@ -26,7 +26,7 @@ public AzureDataExplorerSource(DataFactoryElement query) CopySourceType = "AzureDataExplorerSource"; } - /// Initializes a new instance of AzureDataExplorerSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). @@ -46,6 +46,11 @@ internal AzureDataExplorerSource(string copySourceType, DataFactoryElement CopySourceType = copySourceType ?? "AzureDataExplorerSource"; } + /// Initializes a new instance of for deserialization. + internal AzureDataExplorerSource() + { + } + /// Database query. Should be a Kusto Query Language (KQL) query. Type: string (or Expression with resultType string). public DataFactoryElement Query { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.Serialization.cs index abb461e145ab..0b5c646e65de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataExplorerTableDataset : IUtf8JsonSerializable + public partial class AzureDataExplorerTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataExplorerTableDataset DeserializeAzureDataExplorerTableDataset(JsonElement element) + internal static AzureDataExplorerTableDataset DeserializeAzureDataExplorerTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static AzureDataExplorerTableDataset DeserializeAzureDataExplorerTableD additionalProperties = additionalPropertiesDictionary; return new AzureDataExplorerTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, table.Value); } + + AzureDataExplorerTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataExplorerTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataExplorerTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataExplorerTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataExplorerTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataExplorerTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataExplorerTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.cs index 60075c1d0caf..686530018a5c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataExplorerTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure Data Explorer (Kusto) dataset. public partial class AzureDataExplorerTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureDataExplorerTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureDataExplorerTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureDataExplorerTableDataset(DataFactoryLinkedServiceReference linkedSer DatasetType = "AzureDataExplorerTable"; } - /// Initializes a new instance of AzureDataExplorerTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal AzureDataExplorerTableDataset(string datasetType, string description, D DatasetType = datasetType ?? "AzureDataExplorerTable"; } + /// Initializes a new instance of for deserialization. + internal AzureDataExplorerTableDataset() + { + } + /// The table name of the Azure Data Explorer database. Type: string (or Expression with resultType string). public DataFactoryElement Table { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.Serialization.cs index 33dd45f3e907..68ac3436f890 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeAnalyticsLinkedService : IUtf8JsonSerializable + public partial class AzureDataLakeAnalyticsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -109,8 +129,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeAnalyticsLinkedService DeserializeAzureDataLakeAnalyticsLinkedService(JsonElement element) + internal static AzureDataLakeAnalyticsLinkedService DeserializeAzureDataLakeAnalyticsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -263,5 +285,53 @@ internal static AzureDataLakeAnalyticsLinkedService DeserializeAzureDataLakeAnal additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeAnalyticsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, accountName, servicePrincipalId.Value, servicePrincipalKey, tenant, subscriptionId.Value, resourceGroupName.Value, dataLakeAnalyticsUri.Value, encryptedCredential.Value); } + + AzureDataLakeAnalyticsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeAnalyticsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeAnalyticsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeAnalyticsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeAnalyticsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeAnalyticsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeAnalyticsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.cs index a320cd7cd3e0..b1f53484f171 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeAnalyticsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Lake Analytics linked service. public partial class AzureDataLakeAnalyticsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureDataLakeAnalyticsLinkedService. + /// Initializes a new instance of . /// The Azure Data Lake Analytics account name. Type: string (or Expression with resultType string). /// The name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public AzureDataLakeAnalyticsLinkedService(DataFactoryElement accountNam LinkedServiceType = "AzureDataLakeAnalytics"; } - /// Initializes a new instance of AzureDataLakeAnalyticsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -57,6 +57,11 @@ internal AzureDataLakeAnalyticsLinkedService(string linkedServiceType, Integrati LinkedServiceType = linkedServiceType ?? "AzureDataLakeAnalytics"; } + /// Initializes a new instance of for deserialization. + internal AzureDataLakeAnalyticsLinkedService() + { + } + /// The Azure Data Lake Analytics account name. Type: string (or Expression with resultType string). public DataFactoryElement AccountName { get; set; } /// The ID of the application used to authenticate against the Azure Data Lake Analytics account. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.Serialization.cs index e79c233bbdbc..76fbbad437f6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreDataset : IUtf8JsonSerializable + public partial class AzureDataLakeStoreDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -86,12 +106,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } } if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -106,8 +140,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreDataset DeserializeAzureDataLakeStoreDataset(JsonElement element) + internal static AzureDataLakeStoreDataset DeserializeAzureDataLakeStoreDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -258,5 +294,53 @@ internal static AzureDataLakeStoreDataset DeserializeAzureDataLakeStoreDataset(J additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, folderPath.Value, fileName.Value, format.Value, compression.Value); } + + AzureDataLakeStoreDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.cs index 6498f94187ab..7b25c7807cd0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Lake Store dataset. public partial class AzureDataLakeStoreDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureDataLakeStoreDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureDataLakeStoreDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureDataLakeStoreDataset(DataFactoryLinkedServiceReference linkedService DatasetType = "AzureDataLakeStoreFile"; } - /// Initializes a new instance of AzureDataLakeStoreDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -52,6 +52,11 @@ internal AzureDataLakeStoreDataset(string datasetType, string description, DataF DatasetType = datasetType ?? "AzureDataLakeStoreFile"; } + /// Initializes a new instance of for deserialization. + internal AzureDataLakeStoreDataset() + { + } + /// Path to the folder in the Azure Data Lake Store. Type: string (or Expression with resultType string). public DataFactoryElement FolderPath { get; set; } /// The name of the file in the Azure Data Lake Store. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.Serialization.cs index c5f24c630952..0f66ca8bc4ca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreLinkedService : IUtf8JsonSerializable + public partial class AzureDataLakeStoreLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -107,7 +127,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -122,8 +149,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreLinkedService DeserializeAzureDataLakeStoreLinkedService(JsonElement element) + internal static AzureDataLakeStoreLinkedService DeserializeAzureDataLakeStoreLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -300,5 +329,53 @@ internal static AzureDataLakeStoreLinkedService DeserializeAzureDataLakeStoreLin additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, dataLakeStoreUri, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, accountName.Value, subscriptionId.Value, resourceGroupName.Value, encryptedCredential.Value, credential.Value); } + + AzureDataLakeStoreLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.cs index a050419a9f7b..3466aa4310bd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Lake Store linked service. public partial class AzureDataLakeStoreLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureDataLakeStoreLinkedService. + /// Initializes a new instance of . /// Data Lake Store service URI. Type: string (or Expression with resultType string). /// is null. public AzureDataLakeStoreLinkedService(DataFactoryElement dataLakeStoreUri) @@ -26,7 +26,7 @@ public AzureDataLakeStoreLinkedService(DataFactoryElement dataLakeStoreU LinkedServiceType = "AzureDataLakeStore"; } - /// Initializes a new instance of AzureDataLakeStoreLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -58,6 +58,11 @@ internal AzureDataLakeStoreLinkedService(string linkedServiceType, IntegrationRu LinkedServiceType = linkedServiceType ?? "AzureDataLakeStore"; } + /// Initializes a new instance of for deserialization. + internal AzureDataLakeStoreLinkedService() + { + } + /// Data Lake Store service URI. Type: string (or Expression with resultType string). public DataFactoryElement DataLakeStoreUri { get; set; } /// The ID of the application used to authenticate against the Azure Data Lake Store account. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.Serialization.cs index eb811ced792f..75fe71311311 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreLocation : IUtf8JsonSerializable + public partial class AzureDataLakeStoreLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetLocationType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreLocation DeserializeAzureDataLakeStoreLocation(JsonElement element) + internal static AzureDataLakeStoreLocation DeserializeAzureDataLakeStoreLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static AzureDataLakeStoreLocation DeserializeAzureDataLakeStoreLocation additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreLocation(type, folderPath.Value, fileName.Value, additionalProperties); } + + AzureDataLakeStoreLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.cs index 1a6d050f68e5..f11ed4f325e0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of azure data lake store dataset. public partial class AzureDataLakeStoreLocation : DatasetLocation { - /// Initializes a new instance of AzureDataLakeStoreLocation. + /// Initializes a new instance of . public AzureDataLakeStoreLocation() { DatasetLocationType = "AzureDataLakeStoreLocation"; } - /// Initializes a new instance of AzureDataLakeStoreLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.Serialization.cs index 6502e315b3f0..1bc63bea1f25 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreReadSettings : IUtf8JsonSerializable + public partial class AzureDataLakeStoreReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -97,8 +103,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreReadSettings DeserializeAzureDataLakeStoreReadSettings(JsonElement element) + internal static AzureDataLakeStoreReadSettings DeserializeAzureDataLakeStoreReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -248,5 +256,53 @@ internal static AzureDataLakeStoreReadSettings DeserializeAzureDataLakeStoreRead additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, listAfter.Value, listBefore.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + AzureDataLakeStoreReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.cs index 7b0a257f3309..8db888736eba 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure data lake store read settings. public partial class AzureDataLakeStoreReadSettings : StoreReadSettings { - /// Initializes a new instance of AzureDataLakeStoreReadSettings. + /// Initializes a new instance of . public AzureDataLakeStoreReadSettings() { StoreReadSettingsType = "AzureDataLakeStoreReadSettings"; } - /// Initializes a new instance of AzureDataLakeStoreReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.Serialization.cs index 206f98301fd6..6cd99e647f9f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreSink : IUtf8JsonSerializable + public partial class AzureDataLakeStoreSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CopyBehavior)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreSink DeserializeAzureDataLakeStoreSink(JsonElement element) + internal static AzureDataLakeStoreSink DeserializeAzureDataLakeStoreSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static AzureDataLakeStoreSink DeserializeAzureDataLakeStoreSink(JsonEle additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, copyBehavior.Value, enableAdlsSingleFileParallel.Value); } + + AzureDataLakeStoreSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.cs index 06108adcdd2f..d4f2e32be72a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Data Lake Store sink. public partial class AzureDataLakeStoreSink : CopySink { - /// Initializes a new instance of AzureDataLakeStoreSink. + /// Initializes a new instance of . public AzureDataLakeStoreSink() { CopySinkType = "AzureDataLakeStoreSink"; } - /// Initializes a new instance of AzureDataLakeStoreSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.Serialization.cs index b35dd77c2207..038e5f80580b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreSource : IUtf8JsonSerializable + public partial class AzureDataLakeStoreSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -57,8 +63,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreSource DeserializeAzureDataLakeStoreSource(JsonElement element) + internal static AzureDataLakeStoreSource DeserializeAzureDataLakeStoreSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -128,5 +136,53 @@ internal static AzureDataLakeStoreSource DeserializeAzureDataLakeStoreSource(Jso additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value); } + + AzureDataLakeStoreSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.cs index 9278395d160a..7b1d13cc08ff 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Data Lake source. public partial class AzureDataLakeStoreSource : CopyActivitySource { - /// Initializes a new instance of AzureDataLakeStoreSource. + /// Initializes a new instance of . public AzureDataLakeStoreSource() { CopySourceType = "AzureDataLakeStoreSource"; } - /// Initializes a new instance of AzureDataLakeStoreSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.Serialization.cs index 94c3f8e7d28b..a63c8a70a85a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDataLakeStoreWriteSettings : IUtf8JsonSerializable + public partial class AzureDataLakeStoreWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExpiryDateTime)) { @@ -56,8 +62,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDataLakeStoreWriteSettings DeserializeAzureDataLakeStoreWriteSettings(JsonElement element) + internal static AzureDataLakeStoreWriteSettings DeserializeAzureDataLakeStoreWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,5 +125,53 @@ internal static AzureDataLakeStoreWriteSettings DeserializeAzureDataLakeStoreWri additionalProperties = additionalPropertiesDictionary; return new AzureDataLakeStoreWriteSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, copyBehavior.Value, additionalProperties, expiryDateTime.Value); } + + AzureDataLakeStoreWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDataLakeStoreWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDataLakeStoreWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDataLakeStoreWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDataLakeStoreWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDataLakeStoreWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDataLakeStoreWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs index 007fffd32a72..63e8745c1ed0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure data lake store write settings. public partial class AzureDataLakeStoreWriteSettings : StoreWriteSettings { - /// Initializes a new instance of AzureDataLakeStoreWriteSettings. + /// Initializes a new instance of . public AzureDataLakeStoreWriteSettings() { StoreWriteSettingsType = "AzureDataLakeStoreWriteSettings"; } - /// Initializes a new instance of AzureDataLakeStoreWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.Serialization.cs index 7cdf3839fc8e..4187d3b00f8c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksDeltaLakeDataset : IUtf8JsonSerializable + public partial class AzureDatabricksDeltaLakeDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksDeltaLakeDataset DeserializeAzureDatabricksDeltaLakeDataset(JsonElement element) + internal static AzureDatabricksDeltaLakeDataset DeserializeAzureDatabricksDeltaLakeDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +250,53 @@ internal static AzureDatabricksDeltaLakeDataset DeserializeAzureDatabricksDeltaL additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksDeltaLakeDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, table.Value, database.Value); } + + AzureDatabricksDeltaLakeDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksDeltaLakeDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksDeltaLakeDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksDeltaLakeDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksDeltaLakeDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksDeltaLakeDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksDeltaLakeDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.cs index f485f2efd144..76788a8b31ed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Databricks Delta Lake dataset. public partial class AzureDatabricksDeltaLakeDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureDatabricksDeltaLakeDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureDatabricksDeltaLakeDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureDatabricksDeltaLakeDataset(DataFactoryLinkedServiceReference linkedS DatasetType = "AzureDatabricksDeltaLakeDataset"; } - /// Initializes a new instance of AzureDatabricksDeltaLakeDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -44,6 +44,11 @@ internal AzureDatabricksDeltaLakeDataset(string datasetType, string description, DatasetType = datasetType ?? "AzureDatabricksDeltaLakeDataset"; } + /// Initializes a new instance of for deserialization. + internal AzureDatabricksDeltaLakeDataset() + { + } + /// The name of delta table. Type: string (or Expression with resultType string). public DataFactoryElement Table { get; set; } /// The database name of delta table. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.Serialization.cs index 0ab209fb9329..74e01d986063 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksDeltaLakeExportCommand : IUtf8JsonSerializable + public partial class AzureDatabricksDeltaLakeExportCommand : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DateFormat)) { @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksDeltaLakeExportCommand DeserializeAzureDatabricksDeltaLakeExportCommand(JsonElement element) + internal static AzureDatabricksDeltaLakeExportCommand DeserializeAzureDatabricksDeltaLakeExportCommand(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static AzureDatabricksDeltaLakeExportCommand DeserializeAzureDatabricks additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksDeltaLakeExportCommand(type, additionalProperties, dateFormat.Value, timestampFormat.Value); } + + AzureDatabricksDeltaLakeExportCommand IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksDeltaLakeExportCommand(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksDeltaLakeExportCommand IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksDeltaLakeExportCommand(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksDeltaLakeExportCommand model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksDeltaLakeExportCommand(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksDeltaLakeExportCommand(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.cs index 9387720dc029..6a8c0b20073b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeExportCommand.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Databricks Delta Lake export command settings. public partial class AzureDatabricksDeltaLakeExportCommand : ExportSettings { - /// Initializes a new instance of AzureDatabricksDeltaLakeExportCommand. + /// Initializes a new instance of . public AzureDatabricksDeltaLakeExportCommand() { ExportSettingsType = "AzureDatabricksDeltaLakeExportCommand"; } - /// Initializes a new instance of AzureDatabricksDeltaLakeExportCommand. + /// Initializes a new instance of . /// The export setting type. /// Additional Properties. /// Specify the date format for the csv in Azure Databricks Delta Lake Copy. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.Serialization.cs index aff0ad7bff5e..7adde41e3bd1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksDeltaLakeImportCommand : IUtf8JsonSerializable + public partial class AzureDatabricksDeltaLakeImportCommand : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DateFormat)) { @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksDeltaLakeImportCommand DeserializeAzureDatabricksDeltaLakeImportCommand(JsonElement element) + internal static AzureDatabricksDeltaLakeImportCommand DeserializeAzureDatabricksDeltaLakeImportCommand(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static AzureDatabricksDeltaLakeImportCommand DeserializeAzureDatabricks additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksDeltaLakeImportCommand(type, additionalProperties, dateFormat.Value, timestampFormat.Value); } + + AzureDatabricksDeltaLakeImportCommand IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksDeltaLakeImportCommand(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksDeltaLakeImportCommand IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksDeltaLakeImportCommand(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksDeltaLakeImportCommand model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksDeltaLakeImportCommand(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksDeltaLakeImportCommand(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.cs index 813597ac6110..9b25627bd627 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeImportCommand.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Databricks Delta Lake import command settings. public partial class AzureDatabricksDeltaLakeImportCommand : ImportSettings { - /// Initializes a new instance of AzureDatabricksDeltaLakeImportCommand. + /// Initializes a new instance of . public AzureDatabricksDeltaLakeImportCommand() { ImportSettingsType = "AzureDatabricksDeltaLakeImportCommand"; } - /// Initializes a new instance of AzureDatabricksDeltaLakeImportCommand. + /// Initializes a new instance of . /// The import setting type. /// Additional Properties. /// Specify the date format for csv in Azure Databricks Delta Lake Copy. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.Serialization.cs index 393644e16e53..bf2e8f5398a1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksDeltaLakeLinkedService : IUtf8JsonSerializable + public partial class AzureDatabricksDeltaLakeLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -82,7 +102,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } if (Optional.IsDefined(WorkspaceResourceId)) { @@ -102,8 +129,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksDeltaLakeLinkedService DeserializeAzureDatabricksDeltaLakeLinkedService(JsonElement element) + internal static AzureDatabricksDeltaLakeLinkedService DeserializeAzureDatabricksDeltaLakeLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -240,5 +269,53 @@ internal static AzureDatabricksDeltaLakeLinkedService DeserializeAzureDatabricks additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksDeltaLakeLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, domain, accessToken, clusterId.Value, encryptedCredential.Value, credential.Value, workspaceResourceId.Value); } + + AzureDatabricksDeltaLakeLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksDeltaLakeLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksDeltaLakeLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksDeltaLakeLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksDeltaLakeLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksDeltaLakeLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksDeltaLakeLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.cs index aa0ac90f7948..88153cf0cc54 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Databricks Delta Lake linked service. public partial class AzureDatabricksDeltaLakeLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureDatabricksDeltaLakeLinkedService. + /// Initializes a new instance of . /// <REGION>.azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string). /// is null. public AzureDatabricksDeltaLakeLinkedService(DataFactoryElement domain) @@ -26,7 +26,7 @@ public AzureDatabricksDeltaLakeLinkedService(DataFactoryElement domain) LinkedServiceType = "AzureDatabricksDeltaLake"; } - /// Initializes a new instance of AzureDatabricksDeltaLakeLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal AzureDatabricksDeltaLakeLinkedService(string linkedServiceType, Integra LinkedServiceType = linkedServiceType ?? "AzureDatabricksDeltaLake"; } + /// Initializes a new instance of for deserialization. + internal AzureDatabricksDeltaLakeLinkedService() + { + } + /// <REGION>.azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string). public DataFactoryElement Domain { get; set; } /// Access token for databricks REST API. Refer to https://docs.azuredatabricks.net/api/latest/authentication.html. Type: string, SecureString or AzureKeyVaultSecretReference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.Serialization.cs index 8e569db9c213..4748046d7f10 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksDeltaLakeSink : IUtf8JsonSerializable + public partial class AzureDatabricksDeltaLakeSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ImportSettings)) { writer.WritePropertyName("importSettings"u8); - writer.WriteObjectValue(ImportSettings); + if (ImportSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ImportSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -72,8 +85,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksDeltaLakeSink DeserializeAzureDatabricksDeltaLakeSink(JsonElement element) + internal static AzureDatabricksDeltaLakeSink DeserializeAzureDatabricksDeltaLakeSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +188,53 @@ internal static AzureDatabricksDeltaLakeSink DeserializeAzureDatabricksDeltaLake additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksDeltaLakeSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value, importSettings.Value); } + + AzureDatabricksDeltaLakeSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksDeltaLakeSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksDeltaLakeSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksDeltaLakeSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksDeltaLakeSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksDeltaLakeSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksDeltaLakeSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.cs index 1f0e17b30d92..9abd315dd782 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Databricks Delta Lake sink. public partial class AzureDatabricksDeltaLakeSink : CopySink { - /// Initializes a new instance of AzureDatabricksDeltaLakeSink. + /// Initializes a new instance of . public AzureDatabricksDeltaLakeSink() { CopySinkType = "AzureDatabricksDeltaLakeSink"; } - /// Initializes a new instance of AzureDatabricksDeltaLakeSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.Serialization.cs index 9349ec13b726..7d5e77e78deb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksDeltaLakeSource : IUtf8JsonSerializable + public partial class AzureDatabricksDeltaLakeSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ExportSettings)) { writer.WritePropertyName("exportSettings"u8); - writer.WriteObjectValue(ExportSettings); + if (ExportSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExportSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySourceType); @@ -62,8 +75,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksDeltaLakeSource DeserializeAzureDatabricksDeltaLakeSource(JsonElement element) + internal static AzureDatabricksDeltaLakeSource DeserializeAzureDatabricksDeltaLakeSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -143,5 +158,53 @@ internal static AzureDatabricksDeltaLakeSource DeserializeAzureDatabricksDeltaLa additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksDeltaLakeSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, exportSettings.Value); } + + AzureDatabricksDeltaLakeSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksDeltaLakeSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksDeltaLakeSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksDeltaLakeSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksDeltaLakeSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksDeltaLakeSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksDeltaLakeSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.cs index 215bdaa882d6..c147ac335136 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksDeltaLakeSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Databricks Delta Lake source. public partial class AzureDatabricksDeltaLakeSource : CopyActivitySource { - /// Initializes a new instance of AzureDatabricksDeltaLakeSource. + /// Initializes a new instance of . public AzureDatabricksDeltaLakeSource() { CopySourceType = "AzureDatabricksDeltaLakeSource"; } - /// Initializes a new instance of AzureDatabricksDeltaLakeSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.Serialization.cs index 610b627219cf..a008f837d931 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureDatabricksLinkedService : IUtf8JsonSerializable + public partial class AzureDatabricksLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -197,7 +217,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -212,8 +239,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureDatabricksLinkedService DeserializeAzureDatabricksLinkedService(JsonElement element) + internal static AzureDatabricksLinkedService DeserializeAzureDatabricksLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -516,5 +545,53 @@ internal static AzureDatabricksLinkedService DeserializeAzureDatabricksLinkedSer additionalProperties = additionalPropertiesDictionary; return new AzureDatabricksLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, domain, accessToken, authentication.Value, workspaceResourceId.Value, existingClusterId.Value, instancePoolId.Value, newClusterVersion.Value, newClusterNumOfWorker.Value, newClusterNodeType.Value, Optional.ToDictionary(newClusterSparkConf), Optional.ToDictionary(newClusterSparkEnvVars), Optional.ToDictionary(newClusterCustomTags), newClusterLogDestination.Value, newClusterDriverNodeType.Value, newClusterInitScripts.Value, newClusterEnableElasticDisk.Value, encryptedCredential.Value, policyId.Value, credential.Value); } + + AzureDatabricksLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureDatabricksLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureDatabricksLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureDatabricksLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureDatabricksLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureDatabricksLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureDatabricksLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs index b659ad563ad8..e3de39a14ed0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Databricks linked service. public partial class AzureDatabricksLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureDatabricksLinkedService. + /// Initializes a new instance of . /// <REGION>.azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string). /// is null. public AzureDatabricksLinkedService(DataFactoryElement domain) @@ -29,7 +29,7 @@ public AzureDatabricksLinkedService(DataFactoryElement domain) LinkedServiceType = "AzureDatabricks"; } - /// Initializes a new instance of AzureDatabricksLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -79,6 +79,11 @@ internal AzureDatabricksLinkedService(string linkedServiceType, IntegrationRunti LinkedServiceType = linkedServiceType ?? "AzureDatabricks"; } + /// Initializes a new instance of for deserialization. + internal AzureDatabricksLinkedService() + { + } + /// <REGION>.azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string). public DataFactoryElement Domain { get; set; } /// Access token for databricks REST API. Refer to https://docs.azuredatabricks.net/api/latest/authentication.html. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.Serialization.cs index 392543159ab0..66bb2ef42647 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureFileStorageLinkedService : IUtf8JsonSerializable + public partial class AzureFileStorageLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -125,8 +145,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureFileStorageLinkedService DeserializeAzureFileStorageLinkedService(JsonElement element) + internal static AzureFileStorageLinkedService DeserializeAzureFileStorageLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -307,5 +329,53 @@ internal static AzureFileStorageLinkedService DeserializeAzureFileStorageLinkedS additionalProperties = additionalPropertiesDictionary; return new AzureFileStorageLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host.Value, userId.Value, password, connectionString.Value, accountKey, sasUri.Value, sasToken, fileShare.Value, snapshot.Value, encryptedCredential.Value); } + + AzureFileStorageLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFileStorageLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFileStorageLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFileStorageLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFileStorageLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFileStorageLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFileStorageLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.cs index c881274d507e..aef11ac92d67 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure File Storage linked service. public partial class AzureFileStorageLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureFileStorageLinkedService. + /// Initializes a new instance of . public AzureFileStorageLinkedService() { LinkedServiceType = "AzureFileStorage"; } - /// Initializes a new instance of AzureFileStorageLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.Serialization.cs index f2fca17fb7b0..aca5a50c478b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureFileStorageLocation : IUtf8JsonSerializable + public partial class AzureFileStorageLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetLocationType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureFileStorageLocation DeserializeAzureFileStorageLocation(JsonElement element) + internal static AzureFileStorageLocation DeserializeAzureFileStorageLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static AzureFileStorageLocation DeserializeAzureFileStorageLocation(Jso additionalProperties = additionalPropertiesDictionary; return new AzureFileStorageLocation(type, folderPath.Value, fileName.Value, additionalProperties); } + + AzureFileStorageLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFileStorageLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFileStorageLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFileStorageLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFileStorageLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFileStorageLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFileStorageLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.cs index 400d5efb4a51..d267ed3a5a51 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of file server dataset. public partial class AzureFileStorageLocation : DatasetLocation { - /// Initializes a new instance of AzureFileStorageLocation. + /// Initializes a new instance of . public AzureFileStorageLocation() { DatasetLocationType = "AzureFileStorageLocation"; } - /// Initializes a new instance of AzureFileStorageLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs index 70c282cd8dce..28253bb8d93d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureFileStorageReadSettings : IUtf8JsonSerializable + public partial class AzureFileStorageReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureFileStorageReadSettings DeserializeAzureFileStorageReadSettings(JsonElement element) + internal static AzureFileStorageReadSettings DeserializeAzureFileStorageReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static AzureFileStorageReadSettings DeserializeAzureFileStorageReadSett additionalProperties = additionalPropertiesDictionary; return new AzureFileStorageReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + AzureFileStorageReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFileStorageReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFileStorageReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFileStorageReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFileStorageReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFileStorageReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFileStorageReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.cs index f7990bab8e53..b8942580518a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure File Storage read settings. public partial class AzureFileStorageReadSettings : StoreReadSettings { - /// Initializes a new instance of AzureFileStorageReadSettings. + /// Initializes a new instance of . public AzureFileStorageReadSettings() { StoreReadSettingsType = "AzureFileStorageReadSettings"; } - /// Initializes a new instance of AzureFileStorageReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.Serialization.cs index 9f93e8ddd90f..fda7567a932b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureFileStorageWriteSettings : IUtf8JsonSerializable + public partial class AzureFileStorageWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(StoreWriteSettingsType); @@ -51,8 +57,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureFileStorageWriteSettings DeserializeAzureFileStorageWriteSettings(JsonElement element) + internal static AzureFileStorageWriteSettings DeserializeAzureFileStorageWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -102,5 +110,53 @@ internal static AzureFileStorageWriteSettings DeserializeAzureFileStorageWriteSe additionalProperties = additionalPropertiesDictionary; return new AzureFileStorageWriteSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, copyBehavior.Value, additionalProperties); } + + AzureFileStorageWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFileStorageWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFileStorageWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFileStorageWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFileStorageWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFileStorageWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFileStorageWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs index 10054e030922..129987f161ed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFileStorageWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure File Storage write settings. public partial class AzureFileStorageWriteSettings : StoreWriteSettings { - /// Initializes a new instance of AzureFileStorageWriteSettings. + /// Initializes a new instance of . public AzureFileStorageWriteSettings() { StoreWriteSettingsType = "AzureFileStorageWriteSettings"; } - /// Initializes a new instance of AzureFileStorageWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.Serialization.cs index f5bd9bbe8c97..434bbf79ee44 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureFunctionActivity : IUtf8JsonSerializable + public partial class AzureFunctionActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,8 +123,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureFunctionActivity DeserializeAzureFunctionActivity(JsonElement element) + internal static AzureFunctionActivity DeserializeAzureFunctionActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -243,5 +272,53 @@ internal static AzureFunctionActivity DeserializeAzureFunctionActivity(JsonEleme additionalProperties = additionalPropertiesDictionary; return new AzureFunctionActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, method, functionName, headers.Value, body.Value); } + + AzureFunctionActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFunctionActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFunctionActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFunctionActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFunctionActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFunctionActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.cs index 11abfdc355e2..79e370bf9902 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Function activity. public partial class AzureFunctionActivity : ExecutionActivity { - /// Initializes a new instance of AzureFunctionActivity. + /// Initializes a new instance of . /// Activity name. /// Rest API method for target endpoint. /// Name of the Function that the Azure Function Activity will call. Type: string (or Expression with resultType string). @@ -30,7 +30,7 @@ public AzureFunctionActivity(string name, AzureFunctionActivityMethod method, Da ActivityType = "AzureFunctionActivity"; } - /// Initializes a new instance of AzureFunctionActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -54,6 +54,11 @@ internal AzureFunctionActivity(string name, string activityType, string descript ActivityType = activityType ?? "AzureFunctionActivity"; } + /// Initializes a new instance of for deserialization. + internal AzureFunctionActivity() + { + } + /// Rest API method for target endpoint. public AzureFunctionActivityMethod Method { get; set; } /// Name of the Function that the Azure Function Activity will call. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.Serialization.cs index 1f272b754c5b..2f6e090e318e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureFunctionLinkedService : IUtf8JsonSerializable + public partial class AzureFunctionLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -81,7 +101,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } if (Optional.IsDefined(ResourceId)) { @@ -110,8 +137,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureFunctionLinkedService DeserializeAzureFunctionLinkedService(JsonElement element) + internal static AzureFunctionLinkedService DeserializeAzureFunctionLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -248,5 +277,53 @@ internal static AzureFunctionLinkedService DeserializeAzureFunctionLinkedService additionalProperties = additionalPropertiesDictionary; return new AzureFunctionLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, functionAppUrl, functionKey, encryptedCredential.Value, credential.Value, resourceId.Value, authentication.Value); } + + AzureFunctionLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureFunctionLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureFunctionLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureFunctionLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureFunctionLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureFunctionLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureFunctionLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.cs index 53510354a09d..d96928d5f554 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureFunctionLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Function linked service. public partial class AzureFunctionLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureFunctionLinkedService. + /// Initializes a new instance of . /// The endpoint of the Azure Function App. URL will be in the format https://<accountName>.azurewebsites.net. /// is null. public AzureFunctionLinkedService(BinaryData functionAppUri) @@ -26,7 +26,7 @@ public AzureFunctionLinkedService(BinaryData functionAppUri) LinkedServiceType = "AzureFunction"; } - /// Initializes a new instance of AzureFunctionLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal AzureFunctionLinkedService(string linkedServiceType, IntegrationRuntime LinkedServiceType = linkedServiceType ?? "AzureFunction"; } + /// Initializes a new instance of for deserialization. + internal AzureFunctionLinkedService() + { + } + /// /// The endpoint of the Azure Function App. URL will be in the format https://<accountName>.azurewebsites.net. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.Serialization.cs index 69d21e4ce9f8..1fd4f758ba9d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureKeyVaultLinkedService : IUtf8JsonSerializable + public partial class AzureKeyVaultLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -67,7 +87,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -82,8 +109,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureKeyVaultLinkedService DeserializeAzureKeyVaultLinkedService(JsonElement element) + internal static AzureKeyVaultLinkedService DeserializeAzureKeyVaultLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -184,5 +213,53 @@ internal static AzureKeyVaultLinkedService DeserializeAzureKeyVaultLinkedService additionalProperties = additionalPropertiesDictionary; return new AzureKeyVaultLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, baseUrl, credential.Value); } + + AzureKeyVaultLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureKeyVaultLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureKeyVaultLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureKeyVaultLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureKeyVaultLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.cs index da8a107cbaf6..9aca7ab743b4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureKeyVaultLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Key Vault linked service. public partial class AzureKeyVaultLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureKeyVaultLinkedService. + /// Initializes a new instance of . /// The base URL of the Azure Key Vault. e.g. https://myakv.vault.azure.net Type: string (or Expression with resultType string). /// is null. public AzureKeyVaultLinkedService(DataFactoryElement baseUri) @@ -26,7 +26,7 @@ public AzureKeyVaultLinkedService(DataFactoryElement baseUri) LinkedServiceType = "AzureKeyVault"; } - /// Initializes a new instance of AzureKeyVaultLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -42,6 +42,11 @@ internal AzureKeyVaultLinkedService(string linkedServiceType, IntegrationRuntime LinkedServiceType = linkedServiceType ?? "AzureKeyVault"; } + /// Initializes a new instance of for deserialization. + internal AzureKeyVaultLinkedService() + { + } + /// The base URL of the Azure Key Vault. e.g. https://myakv.vault.azure.net Type: string (or Expression with resultType string). public DataFactoryElement BaseUri { get; set; } /// The credential reference containing authentication information. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.Serialization.cs index 68f810b58d80..009320f502b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMLBatchExecutionActivity : IUtf8JsonSerializable + public partial class AzureMLBatchExecutionActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,7 +123,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in WebServiceOutputs) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -107,7 +141,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in WebServiceInputs) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -124,8 +165,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMLBatchExecutionActivity DeserializeAzureMLBatchExecutionActivity(JsonElement element) + internal static AzureMLBatchExecutionActivity DeserializeAzureMLBatchExecutionActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -291,5 +334,53 @@ internal static AzureMLBatchExecutionActivity DeserializeAzureMLBatchExecutionAc additionalProperties = additionalPropertiesDictionary; return new AzureMLBatchExecutionActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, Optional.ToDictionary(globalParameters), Optional.ToDictionary(webServiceOutputs), Optional.ToDictionary(webServiceInputs)); } + + AzureMLBatchExecutionActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMLBatchExecutionActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMLBatchExecutionActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMLBatchExecutionActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMLBatchExecutionActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMLBatchExecutionActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMLBatchExecutionActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.cs index 1406cc092dbd..5d3a9a344cf8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLBatchExecutionActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure ML Batch Execution activity. public partial class AzureMLBatchExecutionActivity : ExecutionActivity { - /// Initializes a new instance of AzureMLBatchExecutionActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public AzureMLBatchExecutionActivity(string name) : base(name) @@ -28,7 +28,7 @@ public AzureMLBatchExecutionActivity(string name) : base(name) ActivityType = "AzureMLBatchExecution"; } - /// Initializes a new instance of AzureMLBatchExecutionActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -50,6 +50,11 @@ internal AzureMLBatchExecutionActivity(string name, string activityType, string ActivityType = activityType ?? "AzureMLBatchExecution"; } + /// Initializes a new instance of for deserialization. + internal AzureMLBatchExecutionActivity() + { + } + /// /// Key,Value pairs to be passed to the Azure ML Batch Execution Service endpoint. Keys must match the names of web service parameters defined in the published Azure ML web service. Values will be passed in the GlobalParameters property of the Azure ML batch execution request. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.Serialization.cs index 163c70169e05..c3fc4838e217 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMLExecutePipelineActivity : IUtf8JsonSerializable + public partial class AzureMLExecutePipelineActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -122,8 +149,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMLExecutePipelineActivity DeserializeAzureMLExecutePipelineActivity(JsonElement element) + internal static AzureMLExecutePipelineActivity DeserializeAzureMLExecutePipelineActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -317,5 +346,53 @@ internal static AzureMLExecutePipelineActivity DeserializeAzureMLExecutePipeline additionalProperties = additionalPropertiesDictionary; return new AzureMLExecutePipelineActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, mlPipelineId.Value, mlPipelineEndpointId.Value, version.Value, experimentName.Value, mlPipelineParameters.Value, dataPathAssignments.Value, mlParentRunId.Value, continueOnStepFailure.Value); } + + AzureMLExecutePipelineActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMLExecutePipelineActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMLExecutePipelineActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMLExecutePipelineActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMLExecutePipelineActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMLExecutePipelineActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMLExecutePipelineActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.cs index ff089a8020ce..519f00bc6982 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLExecutePipelineActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure ML Execute Pipeline activity. public partial class AzureMLExecutePipelineActivity : ExecutionActivity { - /// Initializes a new instance of AzureMLExecutePipelineActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public AzureMLExecutePipelineActivity(string name) : base(name) @@ -25,7 +25,7 @@ public AzureMLExecutePipelineActivity(string name) : base(name) ActivityType = "AzureMLExecutePipeline"; } - /// Initializes a new instance of AzureMLExecutePipelineActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -57,6 +57,11 @@ internal AzureMLExecutePipelineActivity(string name, string activityType, string ActivityType = activityType ?? "AzureMLExecutePipeline"; } + /// Initializes a new instance of for deserialization. + internal AzureMLExecutePipelineActivity() + { + } + /// ID of the published Azure ML pipeline. Type: string (or Expression with resultType string). public DataFactoryElement MLPipelineId { get; set; } /// ID of the published Azure ML pipeline endpoint. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.Serialization.cs index b2f70f88881d..a3cadfcabbe2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMLLinkedService : IUtf8JsonSerializable + public partial class AzureMLLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -108,8 +128,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMLLinkedService DeserializeAzureMLLinkedService(JsonElement element) + internal static AzureMLLinkedService DeserializeAzureMLLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -262,5 +284,53 @@ internal static AzureMLLinkedService DeserializeAzureMLLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new AzureMLLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, mlEndpoint, apiKey, updateResourceEndpoint.Value, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, encryptedCredential.Value, authentication.Value); } + + AzureMLLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMLLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMLLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMLLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMLLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMLLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMLLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.cs index a4ed52d1bf1c..efd9ee1559fc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure ML Studio Web Service linked service. public partial class AzureMLLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureMLLinkedService. + /// Initializes a new instance of . /// The Batch Execution REST URL for an Azure ML Studio Web Service endpoint. Type: string (or Expression with resultType string). /// The API key for accessing the Azure ML model endpoint. /// or is null. @@ -29,7 +29,7 @@ public AzureMLLinkedService(DataFactoryElement mlEndpoint, DataFactorySe LinkedServiceType = "AzureML"; } - /// Initializes a new instance of AzureMLLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -57,6 +57,11 @@ internal AzureMLLinkedService(string linkedServiceType, IntegrationRuntimeRefere LinkedServiceType = linkedServiceType ?? "AzureML"; } + /// Initializes a new instance of for deserialization. + internal AzureMLLinkedService() + { + } + /// The Batch Execution REST URL for an Azure ML Studio Web Service endpoint. Type: string (or Expression with resultType string). public DataFactoryElement MLEndpoint { get; set; } /// The API key for accessing the Azure ML model endpoint. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.Serialization.cs index 16f6776f857c..f64b3ba44fec 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMLServiceLinkedService : IUtf8JsonSerializable + public partial class AzureMLServiceLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -106,8 +126,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMLServiceLinkedService DeserializeAzureMLServiceLinkedService(JsonElement element) + internal static AzureMLServiceLinkedService DeserializeAzureMLServiceLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -256,5 +278,53 @@ internal static AzureMLServiceLinkedService DeserializeAzureMLServiceLinkedServi additionalProperties = additionalPropertiesDictionary; return new AzureMLServiceLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, subscriptionId, resourceGroupName, mlWorkspaceName, authentication.Value, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, encryptedCredential.Value); } + + AzureMLServiceLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMLServiceLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMLServiceLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMLServiceLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMLServiceLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMLServiceLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMLServiceLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.cs index 33cd773f9c14..ea04fcc00211 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLServiceLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure ML Service linked service. public partial class AzureMLServiceLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureMLServiceLinkedService. + /// Initializes a new instance of . /// Azure ML Service workspace subscription ID. Type: string (or Expression with resultType string). /// Azure ML Service workspace resource group name. Type: string (or Expression with resultType string). /// Azure ML Service workspace name. Type: string (or Expression with resultType string). @@ -32,7 +32,7 @@ public AzureMLServiceLinkedService(DataFactoryElement subscriptionId, Da LinkedServiceType = "AzureMLService"; } - /// Initializes a new instance of AzureMLServiceLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -60,6 +60,11 @@ internal AzureMLServiceLinkedService(string linkedServiceType, IntegrationRuntim LinkedServiceType = linkedServiceType ?? "AzureMLService"; } + /// Initializes a new instance of for deserialization. + internal AzureMLServiceLinkedService() + { + } + /// Azure ML Service workspace subscription ID. Type: string (or Expression with resultType string). public DataFactoryElement SubscriptionId { get; set; } /// Azure ML Service workspace resource group name. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.Serialization.cs index 815dc18dd0a1..3b30918edb46 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMLUpdateResourceActivity : IUtf8JsonSerializable + public partial class AzureMLUpdateResourceActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,8 +114,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMLUpdateResourceActivity DeserializeAzureMLUpdateResourceActivity(JsonElement element) + internal static AzureMLUpdateResourceActivity DeserializeAzureMLUpdateResourceActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -220,5 +249,53 @@ internal static AzureMLUpdateResourceActivity DeserializeAzureMLUpdateResourceAc additionalProperties = additionalPropertiesDictionary; return new AzureMLUpdateResourceActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, trainedModelName, trainedModelLinkedServiceName, trainedModelFilePath); } + + AzureMLUpdateResourceActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMLUpdateResourceActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMLUpdateResourceActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMLUpdateResourceActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMLUpdateResourceActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMLUpdateResourceActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMLUpdateResourceActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.cs index d557089a5c99..ae9d3789b916 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLUpdateResourceActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure ML Update Resource management activity. public partial class AzureMLUpdateResourceActivity : ExecutionActivity { - /// Initializes a new instance of AzureMLUpdateResourceActivity. + /// Initializes a new instance of . /// Activity name. /// Name of the Trained Model module in the Web Service experiment to be updated. Type: string (or Expression with resultType string). /// Name of Azure Storage linked service holding the .ilearner file that will be uploaded by the update operation. @@ -34,7 +34,7 @@ public AzureMLUpdateResourceActivity(string name, DataFactoryElement tra ActivityType = "AzureMLUpdateResource"; } - /// Initializes a new instance of AzureMLUpdateResourceActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -56,6 +56,11 @@ internal AzureMLUpdateResourceActivity(string name, string activityType, string ActivityType = activityType ?? "AzureMLUpdateResource"; } + /// Initializes a new instance of for deserialization. + internal AzureMLUpdateResourceActivity() + { + } + /// Name of the Trained Model module in the Web Service experiment to be updated. Type: string (or Expression with resultType string). public DataFactoryElement TrainedModelName { get; set; } /// Name of Azure Storage linked service holding the .ilearner file that will be uploaded by the update operation. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.Serialization.cs index 774e10c038f1..0e173b32aaf5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMLWebServiceFile : IUtf8JsonSerializable + public partial class AzureMLWebServiceFile : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("filePath"u8); JsonSerializer.Serialize(writer, FilePath); writer.WritePropertyName("linkedServiceName"u8); - JsonSerializer.Serialize(writer, LinkedServiceName); writer.WriteEndObject(); + JsonSerializer.Serialize(writer, LinkedServiceName); if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); } - internal static AzureMLWebServiceFile DeserializeAzureMLWebServiceFile(JsonElement element) + internal static AzureMLWebServiceFile DeserializeAzureMLWebServiceFile(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactoryElement filePath = default; DataFactoryLinkedServiceReference linkedServiceName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("filePath"u8)) @@ -42,8 +65,61 @@ internal static AzureMLWebServiceFile DeserializeAzureMLWebServiceFile(JsonEleme linkedServiceName = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new AzureMLWebServiceFile(filePath, linkedServiceName, serializedAdditionalRawData); + } + + AzureMLWebServiceFile IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMLWebServiceFile(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMLWebServiceFile IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMLWebServiceFile(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMLWebServiceFile model) + { + if (model is null) + { + return null; } - return new AzureMLWebServiceFile(filePath, linkedServiceName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMLWebServiceFile(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMLWebServiceFile(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.cs index ddf312b1d48d..4be72ce92282 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMLWebServiceFile.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure ML WebService Input/Output file. public partial class AzureMLWebServiceFile { - /// Initializes a new instance of AzureMLWebServiceFile. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type: string (or Expression with resultType string). /// Reference to an Azure Storage LinkedService, where Azure ML WebService Input/Output file located. /// or is null. @@ -27,6 +31,22 @@ public AzureMLWebServiceFile(DataFactoryElement filePath, DataFactoryLin LinkedServiceName = linkedServiceName; } + /// Initializes a new instance of . + /// The relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type: string (or Expression with resultType string). + /// Reference to an Azure Storage LinkedService, where Azure ML WebService Input/Output file located. + /// Keeps track of any properties unknown to the library. + internal AzureMLWebServiceFile(DataFactoryElement filePath, DataFactoryLinkedServiceReference linkedServiceName, Dictionary serializedAdditionalRawData) + { + FilePath = filePath; + LinkedServiceName = linkedServiceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureMLWebServiceFile() + { + } + /// The relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type: string (or Expression with resultType string). public DataFactoryElement FilePath { get; set; } /// Reference to an Azure Storage LinkedService, where Azure ML WebService Input/Output file located. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.Serialization.cs index 51e9fdc3fb92..f1a3a4df9e7c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMariaDBLinkedService : IUtf8JsonSerializable + public partial class AzureMariaDBLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMariaDBLinkedService DeserializeAzureMariaDBLinkedService(JsonElement element) + internal static AzureMariaDBLinkedService DeserializeAzureMariaDBLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static AzureMariaDBLinkedService DeserializeAzureMariaDBLinkedService(J additionalProperties = additionalPropertiesDictionary; return new AzureMariaDBLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, password, encryptedCredential.Value); } + + AzureMariaDBLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMariaDBLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMariaDBLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMariaDBLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMariaDBLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMariaDBLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMariaDBLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.cs index 0596fd023255..7847e15dead6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Database for MariaDB linked service. public partial class AzureMariaDBLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureMariaDBLinkedService. + /// Initializes a new instance of . public AzureMariaDBLinkedService() { LinkedServiceType = "AzureMariaDB"; } - /// Initializes a new instance of AzureMariaDBLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.Serialization.cs index a8dc0aa8d5e0..b145b861845b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMariaDBSource : IUtf8JsonSerializable + public partial class AzureMariaDBSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMariaDBSource DeserializeAzureMariaDBSource(JsonElement element) + internal static AzureMariaDBSource DeserializeAzureMariaDBSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static AzureMariaDBSource DeserializeAzureMariaDBSource(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new AzureMariaDBSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + AzureMariaDBSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMariaDBSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMariaDBSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMariaDBSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMariaDBSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMariaDBSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMariaDBSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.cs index 421bb727ca9d..47985e32d461 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure MariaDB source. public partial class AzureMariaDBSource : TabularSource { - /// Initializes a new instance of AzureMariaDBSource. + /// Initializes a new instance of . public AzureMariaDBSource() { CopySourceType = "AzureMariaDBSource"; } - /// Initializes a new instance of AzureMariaDBSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.Serialization.cs index 7d95c3d51ecb..24c591d338dc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMariaDBTableDataset : IUtf8JsonSerializable + public partial class AzureMariaDBTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMariaDBTableDataset DeserializeAzureMariaDBTableDataset(JsonElement element) + internal static AzureMariaDBTableDataset DeserializeAzureMariaDBTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static AzureMariaDBTableDataset DeserializeAzureMariaDBTableDataset(Jso additionalProperties = additionalPropertiesDictionary; return new AzureMariaDBTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + AzureMariaDBTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMariaDBTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMariaDBTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMariaDBTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMariaDBTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMariaDBTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMariaDBTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.cs index 8540f6fe0c65..2648fa68bd96 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMariaDBTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Database for MariaDB dataset. public partial class AzureMariaDBTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureMariaDBTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureMariaDBTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureMariaDBTableDataset(DataFactoryLinkedServiceReference linkedServiceN DatasetType = "AzureMariaDBTable"; } - /// Initializes a new instance of AzureMariaDBTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal AzureMariaDBTableDataset(string datasetType, string description, DataFa DatasetType = datasetType ?? "AzureMariaDBTable"; } + /// Initializes a new instance of for deserialization. + internal AzureMariaDBTableDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.Serialization.cs index af622a7088e4..938dbc812a5b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMySqlLinkedService : IUtf8JsonSerializable + public partial class AzureMySqlLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMySqlLinkedService DeserializeAzureMySqlLinkedService(JsonElement element) + internal static AzureMySqlLinkedService DeserializeAzureMySqlLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -195,5 +217,53 @@ internal static AzureMySqlLinkedService DeserializeAzureMySqlLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureMySqlLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, encryptedCredential.Value); } + + AzureMySqlLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMySqlLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMySqlLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMySqlLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMySqlLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMySqlLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMySqlLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.cs index 7b470a5409a0..01541b2317b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure MySQL database linked service. public partial class AzureMySqlLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureMySqlLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public AzureMySqlLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public AzureMySqlLinkedService(DataFactoryElement connectionString) LinkedServiceType = "AzureMySql"; } - /// Initializes a new instance of AzureMySqlLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal AzureMySqlLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "AzureMySql"; } + /// Initializes a new instance of for deserialization. + internal AzureMySqlLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.Serialization.cs index 2f6b10fcdf51..03310aa17f2d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMySqlSink : IUtf8JsonSerializable + public partial class AzureMySqlSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMySqlSink DeserializeAzureMySqlSink(JsonElement element) + internal static AzureMySqlSink DeserializeAzureMySqlSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static AzureMySqlSink DeserializeAzureMySqlSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AzureMySqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value); } + + AzureMySqlSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMySqlSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMySqlSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMySqlSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMySqlSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMySqlSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMySqlSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.cs index 5ea066aac03b..ec9111876742 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure MySql sink. public partial class AzureMySqlSink : CopySink { - /// Initializes a new instance of AzureMySqlSink. + /// Initializes a new instance of . public AzureMySqlSink() { CopySinkType = "AzureMySqlSink"; } - /// Initializes a new instance of AzureMySqlSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.Serialization.cs index 79dd45ec2183..dfa24fc127fd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMySqlSource : IUtf8JsonSerializable + public partial class AzureMySqlSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMySqlSource DeserializeAzureMySqlSource(JsonElement element) + internal static AzureMySqlSource DeserializeAzureMySqlSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static AzureMySqlSource DeserializeAzureMySqlSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new AzureMySqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + AzureMySqlSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMySqlSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMySqlSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMySqlSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMySqlSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMySqlSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMySqlSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.cs index 9629259df3e4..5128aa6c488f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure MySQL source. public partial class AzureMySqlSource : TabularSource { - /// Initializes a new instance of AzureMySqlSource. + /// Initializes a new instance of . public AzureMySqlSource() { CopySourceType = "AzureMySqlSource"; } - /// Initializes a new instance of AzureMySqlSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.Serialization.cs index 97a7f3125ed9..d81cab216626 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureMySqlTableDataset : IUtf8JsonSerializable + public partial class AzureMySqlTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureMySqlTableDataset DeserializeAzureMySqlTableDataset(JsonElement element) + internal static AzureMySqlTableDataset DeserializeAzureMySqlTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +250,53 @@ internal static AzureMySqlTableDataset DeserializeAzureMySqlTableDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new AzureMySqlTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value); } + + AzureMySqlTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMySqlTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureMySqlTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureMySqlTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureMySqlTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureMySqlTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureMySqlTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.cs index a424b6517e49..afd33173caef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureMySqlTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure MySQL database dataset. public partial class AzureMySqlTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureMySqlTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureMySqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureMySqlTableDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "AzureMySqlTable"; } - /// Initializes a new instance of AzureMySqlTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -44,6 +44,11 @@ internal AzureMySqlTableDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "AzureMySqlTable"; } + /// Initializes a new instance of for deserialization. + internal AzureMySqlTableDataset() + { + } + /// The Azure MySQL database table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } /// The name of Azure MySQL database table. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.Serialization.cs index 2596a9613cbe..637ae8350c6a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzurePostgreSqlLinkedService : IUtf8JsonSerializable + public partial class AzurePostgreSqlLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzurePostgreSqlLinkedService DeserializeAzurePostgreSqlLinkedService(JsonElement element) + internal static AzurePostgreSqlLinkedService DeserializeAzurePostgreSqlLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static AzurePostgreSqlLinkedService DeserializeAzurePostgreSqlLinkedSer additionalProperties = additionalPropertiesDictionary; return new AzurePostgreSqlLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, password, encryptedCredential.Value); } + + AzurePostgreSqlLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzurePostgreSqlLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzurePostgreSqlLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzurePostgreSqlLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzurePostgreSqlLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzurePostgreSqlLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzurePostgreSqlLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.cs index 4e57df955e19..de7faa2f9acf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure PostgreSQL linked service. public partial class AzurePostgreSqlLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzurePostgreSqlLinkedService. + /// Initializes a new instance of . public AzurePostgreSqlLinkedService() { LinkedServiceType = "AzurePostgreSql"; } - /// Initializes a new instance of AzurePostgreSqlLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.Serialization.cs index 48196051210c..256bf38b1e40 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzurePostgreSqlSink : IUtf8JsonSerializable + public partial class AzurePostgreSqlSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzurePostgreSqlSink DeserializeAzurePostgreSqlSink(JsonElement element) + internal static AzurePostgreSqlSink DeserializeAzurePostgreSqlSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static AzurePostgreSqlSink DeserializeAzurePostgreSqlSink(JsonElement e additionalProperties = additionalPropertiesDictionary; return new AzurePostgreSqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value); } + + AzurePostgreSqlSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzurePostgreSqlSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzurePostgreSqlSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzurePostgreSqlSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzurePostgreSqlSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzurePostgreSqlSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzurePostgreSqlSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.cs index e1dee439e605..279836497c32 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure PostgreSQL sink. public partial class AzurePostgreSqlSink : CopySink { - /// Initializes a new instance of AzurePostgreSqlSink. + /// Initializes a new instance of . public AzurePostgreSqlSink() { CopySinkType = "AzurePostgreSqlSink"; } - /// Initializes a new instance of AzurePostgreSqlSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.Serialization.cs index ed7fbddc55f7..33a803f7271d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzurePostgreSqlSource : IUtf8JsonSerializable + public partial class AzurePostgreSqlSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzurePostgreSqlSource DeserializeAzurePostgreSqlSource(JsonElement element) + internal static AzurePostgreSqlSource DeserializeAzurePostgreSqlSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static AzurePostgreSqlSource DeserializeAzurePostgreSqlSource(JsonEleme additionalProperties = additionalPropertiesDictionary; return new AzurePostgreSqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + AzurePostgreSqlSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzurePostgreSqlSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzurePostgreSqlSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzurePostgreSqlSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzurePostgreSqlSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzurePostgreSqlSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzurePostgreSqlSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.cs index 10cd148afce7..5ab3cdaec3c0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure PostgreSQL source. public partial class AzurePostgreSqlSource : TabularSource { - /// Initializes a new instance of AzurePostgreSqlSource. + /// Initializes a new instance of . public AzurePostgreSqlSource() { CopySourceType = "AzurePostgreSqlSource"; } - /// Initializes a new instance of AzurePostgreSqlSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.Serialization.cs index e5224a9077bd..b23a28a14de3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzurePostgreSqlTableDataset : IUtf8JsonSerializable + public partial class AzurePostgreSqlTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -101,8 +121,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzurePostgreSqlTableDataset DeserializeAzurePostgreSqlTableDataset(JsonElement element) + internal static AzurePostgreSqlTableDataset DeserializeAzurePostgreSqlTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -243,5 +265,53 @@ internal static AzurePostgreSqlTableDataset DeserializeAzurePostgreSqlTableDatas additionalProperties = additionalPropertiesDictionary; return new AzurePostgreSqlTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + AzurePostgreSqlTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzurePostgreSqlTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzurePostgreSqlTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzurePostgreSqlTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzurePostgreSqlTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzurePostgreSqlTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzurePostgreSqlTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.cs index b8ada1b0e91f..8b8edc1e5e18 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzurePostgreSqlTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure PostgreSQL dataset. public partial class AzurePostgreSqlTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzurePostgreSqlTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzurePostgreSqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzurePostgreSqlTableDataset(DataFactoryLinkedServiceReference linkedServi DatasetType = "AzurePostgreSqlTable"; } - /// Initializes a new instance of AzurePostgreSqlTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal AzurePostgreSqlTableDataset(string datasetType, string description, Dat DatasetType = datasetType ?? "AzurePostgreSqlTable"; } + /// Initializes a new instance of for deserialization. + internal AzurePostgreSqlTableDataset() + { + } + /// The table name of the Azure PostgreSQL database which includes both schema and table. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } /// The table name of the Azure PostgreSQL database. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.Serialization.cs index 6eb47daf89ec..01a8e6038fb6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureQueueSink : IUtf8JsonSerializable + public partial class AzureQueueSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -62,8 +68,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureQueueSink DeserializeAzureQueueSink(JsonElement element) + internal static AzureQueueSink DeserializeAzureQueueSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -143,5 +151,53 @@ internal static AzureQueueSink DeserializeAzureQueueSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AzureQueueSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties); } + + AzureQueueSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureQueueSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureQueueSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureQueueSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureQueueSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureQueueSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureQueueSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.cs index 70d6076311fa..ccafe9c0358f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureQueueSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Queue sink. public partial class AzureQueueSink : CopySink { - /// Initializes a new instance of AzureQueueSink. + /// Initializes a new instance of . public AzureQueueSink() { CopySinkType = "AzureQueueSink"; } - /// Initializes a new instance of AzureQueueSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.Serialization.cs index e09968ae1814..7da15b64c72d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSearchIndexDataset : IUtf8JsonSerializable + public partial class AzureSearchIndexDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSearchIndexDataset DeserializeAzureSearchIndexDataset(JsonElement element) + internal static AzureSearchIndexDataset DeserializeAzureSearchIndexDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static AzureSearchIndexDataset DeserializeAzureSearchIndexDataset(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureSearchIndexDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, indexName); } + + AzureSearchIndexDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSearchIndexDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSearchIndexDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSearchIndexDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSearchIndexDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSearchIndexDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSearchIndexDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.cs index c7b2d65c8e14..a72c06bb0dd4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure Search Index. public partial class AzureSearchIndexDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureSearchIndexDataset. + /// Initializes a new instance of . /// Linked service reference. /// The name of the Azure Search Index. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public AzureSearchIndexDataset(DataFactoryLinkedServiceReference linkedServiceNa DatasetType = "AzureSearchIndex"; } - /// Initializes a new instance of AzureSearchIndexDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal AzureSearchIndexDataset(string datasetType, string description, DataFac DatasetType = datasetType ?? "AzureSearchIndex"; } + /// Initializes a new instance of for deserialization. + internal AzureSearchIndexDataset() + { + } + /// The name of the Azure Search Index. Type: string (or Expression with resultType string). public DataFactoryElement IndexName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.Serialization.cs index 4cd2010ac66e..979d8ac9454b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSearchIndexSink : IUtf8JsonSerializable + public partial class AzureSearchIndexSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSearchIndexSink DeserializeAzureSearchIndexSink(JsonElement element) + internal static AzureSearchIndexSink DeserializeAzureSearchIndexSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static AzureSearchIndexSink DeserializeAzureSearchIndexSink(JsonElement additionalProperties = additionalPropertiesDictionary; return new AzureSearchIndexSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, Optional.ToNullable(writeBehavior)); } + + AzureSearchIndexSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSearchIndexSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSearchIndexSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSearchIndexSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSearchIndexSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSearchIndexSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSearchIndexSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.cs index 74175a4283f3..369008ffb8e9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchIndexSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Search Index sink. public partial class AzureSearchIndexSink : CopySink { - /// Initializes a new instance of AzureSearchIndexSink. + /// Initializes a new instance of . public AzureSearchIndexSink() { CopySinkType = "AzureSearchIndexSink"; } - /// Initializes a new instance of AzureSearchIndexSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.Serialization.cs index 806eeeb6eda1..4860419af6df 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSearchLinkedService : IUtf8JsonSerializable + public partial class AzureSearchLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSearchLinkedService DeserializeAzureSearchLinkedService(JsonElement element) + internal static AzureSearchLinkedService DeserializeAzureSearchLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -195,5 +217,53 @@ internal static AzureSearchLinkedService DeserializeAzureSearchLinkedService(Jso additionalProperties = additionalPropertiesDictionary; return new AzureSearchLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, key, encryptedCredential.Value); } + + AzureSearchLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSearchLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSearchLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSearchLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSearchLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSearchLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSearchLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.cs index 353d788670d0..374764982060 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSearchLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Windows Azure Search Service. public partial class AzureSearchLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureSearchLinkedService. + /// Initializes a new instance of . /// URL for Azure Search service. Type: string (or Expression with resultType string). /// is null. public AzureSearchLinkedService(DataFactoryElement uri) @@ -26,7 +26,7 @@ public AzureSearchLinkedService(DataFactoryElement uri) LinkedServiceType = "AzureSearch"; } - /// Initializes a new instance of AzureSearchLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal AzureSearchLinkedService(string linkedServiceType, IntegrationRuntimeRe LinkedServiceType = linkedServiceType ?? "AzureSearch"; } + /// Initializes a new instance of for deserialization. + internal AzureSearchLinkedService() + { + } + /// URL for Azure Search service. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// Admin Key for Azure Search service. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.Serialization.cs index 2d8861db68fc..80b9d4c4d38a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlDWLinkedService : IUtf8JsonSerializable + public partial class AzureSqlDWLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -97,7 +117,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -112,8 +139,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlDWLinkedService DeserializeAzureSqlDWLinkedService(JsonElement element) + internal static AzureSqlDWLinkedService DeserializeAzureSqlDWLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -270,5 +299,53 @@ internal static AzureSqlDWLinkedService DeserializeAzureSqlDWLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureSqlDWLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, encryptedCredential.Value, credential.Value); } + + AzureSqlDWLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlDWLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlDWLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlDWLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlDWLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlDWLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlDWLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.cs index 26d46f067a11..338f7030c22b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure SQL Data Warehouse linked service. public partial class AzureSqlDWLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureSqlDWLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public AzureSqlDWLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public AzureSqlDWLinkedService(DataFactoryElement connectionString) LinkedServiceType = "AzureSqlDW"; } - /// Initializes a new instance of AzureSqlDWLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -54,6 +54,11 @@ internal AzureSqlDWLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "AzureSqlDW"; } + /// Initializes a new instance of for deserialization. + internal AzureSqlDWLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.Serialization.cs index 705d71081c36..32e95160f410 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlDWTableDataset : IUtf8JsonSerializable + public partial class AzureSqlDWTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlDWTableDataset DeserializeAzureSqlDWTableDataset(JsonElement element) + internal static AzureSqlDWTableDataset DeserializeAzureSqlDWTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static AzureSqlDWTableDataset DeserializeAzureSqlDWTableDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new AzureSqlDWTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, schema0.Value, table.Value); } + + AzureSqlDWTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlDWTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlDWTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlDWTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlDWTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlDWTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlDWTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.cs index c8fd8f873c87..3f6269ad9307 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDWTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure SQL Data Warehouse dataset. public partial class AzureSqlDWTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureSqlDWTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureSqlDWTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureSqlDWTableDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "AzureSqlDWTable"; } - /// Initializes a new instance of AzureSqlDWTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal AzureSqlDWTableDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "AzureSqlDWTable"; } + /// Initializes a new instance of for deserialization. + internal AzureSqlDWTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.Serialization.cs index 52cdbfc512e1..086f346e03a0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlDatabaseLinkedService : IUtf8JsonSerializable + public partial class AzureSqlDatabaseLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -97,12 +117,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AlwaysEncryptedSettings)) { writer.WritePropertyName("alwaysEncryptedSettings"u8); - writer.WriteObjectValue(AlwaysEncryptedSettings); + if (AlwaysEncryptedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AlwaysEncryptedSettings).Serialize(writer, options); + } } if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -117,8 +151,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlDatabaseLinkedService DeserializeAzureSqlDatabaseLinkedService(JsonElement element) + internal static AzureSqlDatabaseLinkedService DeserializeAzureSqlDatabaseLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -285,5 +321,53 @@ internal static AzureSqlDatabaseLinkedService DeserializeAzureSqlDatabaseLinkedS additionalProperties = additionalPropertiesDictionary; return new AzureSqlDatabaseLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, encryptedCredential.Value, alwaysEncryptedSettings.Value, credential.Value); } + + AzureSqlDatabaseLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlDatabaseLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlDatabaseLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlDatabaseLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlDatabaseLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlDatabaseLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlDatabaseLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.cs index 4764596cacd0..c431af004910 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlDatabaseLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Microsoft Azure SQL Database linked service. public partial class AzureSqlDatabaseLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureSqlDatabaseLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public AzureSqlDatabaseLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public AzureSqlDatabaseLinkedService(DataFactoryElement connectionString LinkedServiceType = "AzureSqlDatabase"; } - /// Initializes a new instance of AzureSqlDatabaseLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -56,6 +56,11 @@ internal AzureSqlDatabaseLinkedService(string linkedServiceType, IntegrationRunt LinkedServiceType = linkedServiceType ?? "AzureSqlDatabase"; } + /// Initializes a new instance of for deserialization. + internal AzureSqlDatabaseLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.Serialization.cs index 79aec8f385d0..98a93888260e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlMILinkedService : IUtf8JsonSerializable + public partial class AzureSqlMILinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -97,12 +117,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AlwaysEncryptedSettings)) { writer.WritePropertyName("alwaysEncryptedSettings"u8); - writer.WriteObjectValue(AlwaysEncryptedSettings); + if (AlwaysEncryptedSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AlwaysEncryptedSettings).Serialize(writer, options); + } } if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -117,8 +151,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlMILinkedService DeserializeAzureSqlMILinkedService(JsonElement element) + internal static AzureSqlMILinkedService DeserializeAzureSqlMILinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -285,5 +321,53 @@ internal static AzureSqlMILinkedService DeserializeAzureSqlMILinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new AzureSqlMILinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, encryptedCredential.Value, alwaysEncryptedSettings.Value, credential.Value); } + + AzureSqlMILinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlMILinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlMILinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlMILinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlMILinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlMILinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlMILinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.cs index e77e497b9b99..857958a5d34e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMILinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure SQL Managed Instance linked service. public partial class AzureSqlMILinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureSqlMILinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public AzureSqlMILinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public AzureSqlMILinkedService(DataFactoryElement connectionString) LinkedServiceType = "AzureSqlMI"; } - /// Initializes a new instance of AzureSqlMILinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -56,6 +56,11 @@ internal AzureSqlMILinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "AzureSqlMI"; } + /// Initializes a new instance of for deserialization. + internal AzureSqlMILinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.Serialization.cs index 50319e89c29e..c3102f40039b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlMITableDataset : IUtf8JsonSerializable + public partial class AzureSqlMITableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlMITableDataset DeserializeAzureSqlMITableDataset(JsonElement element) + internal static AzureSqlMITableDataset DeserializeAzureSqlMITableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static AzureSqlMITableDataset DeserializeAzureSqlMITableDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new AzureSqlMITableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, schema0.Value, table.Value); } + + AzureSqlMITableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlMITableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlMITableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlMITableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlMITableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlMITableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlMITableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.cs index d13496fdc49b..9363b730ccf1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlMITableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure SQL Managed Instance dataset. public partial class AzureSqlMITableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureSqlMITableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureSqlMITableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureSqlMITableDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "AzureSqlMITable"; } - /// Initializes a new instance of AzureSqlMITableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal AzureSqlMITableDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "AzureSqlMITable"; } + /// Initializes a new instance of for deserialization. + internal AzureSqlMITableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.Serialization.cs index 239f9990b252..3f413325d66a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlSink : IUtf8JsonSerializable + public partial class AzureSqlSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SqlWriterStoredProcedureName)) { @@ -69,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UpsertSettings)) { writer.WritePropertyName("upsertSettings"u8); - writer.WriteObjectValue(UpsertSettings); + if (UpsertSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)UpsertSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -115,8 +128,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlSink DeserializeAzureSqlSink(JsonElement element) + internal static AzureSqlSink DeserializeAzureSqlSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -286,5 +301,53 @@ internal static AzureSqlSink DeserializeAzureSqlSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AzureSqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, storedProcedureParameters.Value, storedProcedureTableTypeParameterName.Value, tableOption.Value, sqlWriterUseTableLock.Value, writeBehavior.Value, upsertSettings.Value); } + + AzureSqlSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.cs index 02338f6fed55..a8ebeae302e2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure SQL sink. public partial class AzureSqlSink : CopySink { - /// Initializes a new instance of AzureSqlSink. + /// Initializes a new instance of . public AzureSqlSink() { CopySinkType = "AzureSqlSink"; } - /// Initializes a new instance of AzureSqlSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.Serialization.cs index cc5d6ad4dffa..ec927493a828 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlSource : IUtf8JsonSerializable + public partial class AzureSqlSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SqlReaderQuery)) { @@ -63,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryTimeout)) { @@ -113,8 +126,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlSource DeserializeAzureSqlSource(JsonElement element) + internal static AzureSqlSource DeserializeAzureSqlSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -264,5 +279,53 @@ internal static AzureSqlSource DeserializeAzureSqlSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AzureSqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); } + + AzureSqlSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.cs index 7ddb2566b9f6..85d59420a551 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure SQL source. public partial class AzureSqlSource : TabularSource { - /// Initializes a new instance of AzureSqlSource. + /// Initializes a new instance of . public AzureSqlSource() { CopySourceType = "AzureSqlSource"; } - /// Initializes a new instance of AzureSqlSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.Serialization.cs index 2690fc5beebd..2aa8b9a00b20 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSqlTableDataset : IUtf8JsonSerializable + public partial class AzureSqlTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSqlTableDataset DeserializeAzureSqlTableDataset(JsonElement element) + internal static AzureSqlTableDataset DeserializeAzureSqlTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static AzureSqlTableDataset DeserializeAzureSqlTableDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new AzureSqlTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, schema0.Value, table.Value); } + + AzureSqlTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSqlTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSqlTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSqlTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSqlTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSqlTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSqlTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.cs index 851ba44590d9..12ad53291ff0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSqlTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure SQL Server database dataset. public partial class AzureSqlTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureSqlTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public AzureSqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public AzureSqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "AzureSqlTable"; } - /// Initializes a new instance of AzureSqlTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal AzureSqlTableDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "AzureSqlTable"; } + /// Initializes a new instance of for deserialization. + internal AzureSqlTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.Serialization.cs index 4b23a3318737..648d47528072 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureStorageLinkedService : IUtf8JsonSerializable + public partial class AzureStorageLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -100,8 +120,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureStorageLinkedService DeserializeAzureStorageLinkedService(JsonElement element) + internal static AzureStorageLinkedService DeserializeAzureStorageLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -232,5 +254,53 @@ internal static AzureStorageLinkedService DeserializeAzureStorageLinkedService(J additionalProperties = additionalPropertiesDictionary; return new AzureStorageLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, accountKey, sasUri.Value, sasToken, encryptedCredential.Value); } + + AzureStorageLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureStorageLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureStorageLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureStorageLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureStorageLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureStorageLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureStorageLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.cs index 48175e741eac..18bcb4042ec5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureStorageLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The storage account linked service. public partial class AzureStorageLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureStorageLinkedService. + /// Initializes a new instance of . public AzureStorageLinkedService() { LinkedServiceType = "AzureStorage"; } - /// Initializes a new instance of AzureStorageLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.Serialization.cs index 120daf8a2fb8..c7d78a840d50 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureSynapseArtifactsLinkedService : IUtf8JsonSerializable + public partial class AzureSynapseArtifactsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureSynapseArtifactsLinkedService DeserializeAzureSynapseArtifactsLinkedService(JsonElement element) + internal static AzureSynapseArtifactsLinkedService DeserializeAzureSynapseArtifactsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -199,5 +221,53 @@ internal static AzureSynapseArtifactsLinkedService DeserializeAzureSynapseArtifa additionalProperties = additionalPropertiesDictionary; return new AzureSynapseArtifactsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, authentication.Value, workspaceResourceId.Value); } + + AzureSynapseArtifactsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureSynapseArtifactsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureSynapseArtifactsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureSynapseArtifactsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureSynapseArtifactsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureSynapseArtifactsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureSynapseArtifactsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.cs index 09761ed7072a..455a74e6579b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureSynapseArtifactsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Synapse Analytics (Artifacts) linked service. public partial class AzureSynapseArtifactsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureSynapseArtifactsLinkedService. + /// Initializes a new instance of . /// https://<workspacename>.dev.azuresynapse.net, Azure Synapse Analytics workspace URL. Type: string (or Expression with resultType string). /// is null. public AzureSynapseArtifactsLinkedService(DataFactoryElement endpoint) @@ -26,7 +26,7 @@ public AzureSynapseArtifactsLinkedService(DataFactoryElement endpoint) LinkedServiceType = "AzureSynapseArtifacts"; } - /// Initializes a new instance of AzureSynapseArtifactsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal AzureSynapseArtifactsLinkedService(string linkedServiceType, Integratio LinkedServiceType = linkedServiceType ?? "AzureSynapseArtifacts"; } + /// Initializes a new instance of for deserialization. + internal AzureSynapseArtifactsLinkedService() + { + } + /// https://<workspacename>.dev.azuresynapse.net, Azure Synapse Analytics workspace URL. Type: string (or Expression with resultType string). public DataFactoryElement Endpoint { get; set; } /// Required to specify MSI, if using system assigned managed identity as authentication method. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.Serialization.cs index 7839b004f30a..7e2d278dd049 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureTableDataset : IUtf8JsonSerializable + public partial class AzureTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureTableDataset DeserializeAzureTableDataset(JsonElement element) + internal static AzureTableDataset DeserializeAzureTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static AzureTableDataset DeserializeAzureTableDataset(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new AzureTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName); } + + AzureTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.cs index 47d3bd01d147..d1c96382b2a7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Azure Table storage dataset. public partial class AzureTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of AzureTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// The table name of the Azure Table storage. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public AzureTableDataset(DataFactoryLinkedServiceReference linkedServiceName, Da DatasetType = "AzureTable"; } - /// Initializes a new instance of AzureTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal AzureTableDataset(string datasetType, string description, DataFactoryEl DatasetType = datasetType ?? "AzureTable"; } + /// Initializes a new instance of for deserialization. + internal AzureTableDataset() + { + } + /// The table name of the Azure Table storage. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.Serialization.cs index d9b12431551f..5a2d5234aaf6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureTableSink : IUtf8JsonSerializable + public partial class AzureTableSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AzureTableDefaultPartitionKeyValue)) { @@ -82,8 +88,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureTableSink DeserializeAzureTableSink(JsonElement element) + internal static AzureTableSink DeserializeAzureTableSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -203,5 +211,53 @@ internal static AzureTableSink DeserializeAzureTableSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new AzureTableSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, azureTableDefaultPartitionKeyValue.Value, azureTablePartitionKeyName.Value, azureTableRowKeyName.Value, azureTableInsertType.Value); } + + AzureTableSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureTableSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureTableSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureTableSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureTableSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureTableSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureTableSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.cs index c3b792180413..1533466d93d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Table sink. public partial class AzureTableSink : CopySink { - /// Initializes a new instance of AzureTableSink. + /// Initializes a new instance of . public AzureTableSink() { CopySinkType = "AzureTableSink"; } - /// Initializes a new instance of AzureTableSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.Serialization.cs index a56b2b717aee..0a0495061fe8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureTableSource : IUtf8JsonSerializable + public partial class AzureTableSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AzureTableSourceQuery)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureTableSource DeserializeAzureTableSource(JsonElement element) + internal static AzureTableSource DeserializeAzureTableSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static AzureTableSource DeserializeAzureTableSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new AzureTableSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, azureTableSourceQuery.Value, azureTableSourceIgnoreTableNotFound.Value); } + + AzureTableSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureTableSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureTableSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureTableSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureTableSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureTableSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureTableSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.cs index 5e59701834db..df169cc8e14b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Table source. public partial class AzureTableSource : TabularSource { - /// Initializes a new instance of AzureTableSource. + /// Initializes a new instance of . public AzureTableSource() { CopySourceType = "AzureTableSource"; } - /// Initializes a new instance of AzureTableSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.Serialization.cs index 109fd1090921..e6ebf8313737 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class AzureTableStorageLinkedService : IUtf8JsonSerializable + public partial class AzureTableStorageLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -100,8 +120,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AzureTableStorageLinkedService DeserializeAzureTableStorageLinkedService(JsonElement element) + internal static AzureTableStorageLinkedService DeserializeAzureTableStorageLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -232,5 +254,53 @@ internal static AzureTableStorageLinkedService DeserializeAzureTableStorageLinke additionalProperties = additionalPropertiesDictionary; return new AzureTableStorageLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, accountKey, sasUri.Value, sasToken, encryptedCredential.Value); } + + AzureTableStorageLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeAzureTableStorageLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + AzureTableStorageLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeAzureTableStorageLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(AzureTableStorageLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator AzureTableStorageLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeAzureTableStorageLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.cs index 30fe898d8d13..0471f6963019 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/AzureTableStorageLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The azure table storage linked service. public partial class AzureTableStorageLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of AzureTableStorageLinkedService. + /// Initializes a new instance of . public AzureTableStorageLinkedService() { LinkedServiceType = "AzureTableStorage"; } - /// Initializes a new instance of AzureTableStorageLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.Serialization.cs index 1ab083bb3a41..f3dd60061925 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class BigDataPoolParametrizationReference : IUtf8JsonSerializable + public partial class BigDataPoolParametrizationReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("referenceName"u8); JsonSerializer.Serialize(writer, ReferenceName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static BigDataPoolParametrizationReference DeserializeBigDataPoolParametrizationReference(JsonElement element) + internal static BigDataPoolParametrizationReference DeserializeBigDataPoolParametrizationReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } BigDataPoolReferenceType type = default; DataFactoryElement referenceName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -43,8 +66,61 @@ internal static BigDataPoolParametrizationReference DeserializeBigDataPoolParame referenceName = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new BigDataPoolParametrizationReference(type, referenceName, serializedAdditionalRawData); + } + + BigDataPoolParametrizationReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBigDataPoolParametrizationReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BigDataPoolParametrizationReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBigDataPoolParametrizationReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BigDataPoolParametrizationReference model) + { + if (model is null) + { + return null; } - return new BigDataPoolParametrizationReference(type, referenceName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BigDataPoolParametrizationReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBigDataPoolParametrizationReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.cs index e15d78d207e0..840c9a8d6a98 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BigDataPoolParametrizationReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Big data pool reference type. public partial class BigDataPoolParametrizationReference { - /// Initializes a new instance of BigDataPoolParametrizationReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Big data pool reference type. /// Reference big data pool name. Type: string (or Expression with resultType string). /// is null. @@ -26,6 +30,22 @@ public BigDataPoolParametrizationReference(BigDataPoolReferenceType referenceTyp ReferenceName = referenceName; } + /// Initializes a new instance of . + /// Big data pool reference type. + /// Reference big data pool name. Type: string (or Expression with resultType string). + /// Keeps track of any properties unknown to the library. + internal BigDataPoolParametrizationReference(BigDataPoolReferenceType referenceType, DataFactoryElement referenceName, Dictionary serializedAdditionalRawData) + { + ReferenceType = referenceType; + ReferenceName = referenceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BigDataPoolParametrizationReference() + { + } + /// Big data pool reference type. public BigDataPoolReferenceType ReferenceType { get; set; } /// Reference big data pool name. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.Serialization.cs index bf569589ccba..df62a66d93a6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class BinaryDataset : IUtf8JsonSerializable + public partial class BinaryDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,19 +82,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -96,8 +130,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static BinaryDataset DeserializeBinaryDataset(JsonElement element) + internal static BinaryDataset DeserializeBinaryDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +264,53 @@ internal static BinaryDataset DeserializeBinaryDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new BinaryDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, compression.Value); } + + BinaryDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBinaryDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BinaryDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBinaryDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BinaryDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BinaryDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBinaryDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.cs index dce45af07751..b23a202b7c43 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Binary dataset. public partial class BinaryDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of BinaryDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public BinaryDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public BinaryDataset(DataFactoryLinkedServiceReference linkedServiceName) : base DatasetType = "Binary"; } - /// Initializes a new instance of BinaryDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -48,6 +48,11 @@ internal BinaryDataset(string datasetType, string description, DataFactoryElemen DatasetType = datasetType ?? "Binary"; } + /// Initializes a new instance of for deserialization. + internal BinaryDataset() + { + } + /// /// The location of the Binary storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.Serialization.cs index 67dd33038585..54d5e0b729a0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class BinaryReadSettings : IUtf8JsonSerializable + public partial class BinaryReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CompressionProperties)) { writer.WritePropertyName("compressionProperties"u8); - writer.WriteObjectValue(CompressionProperties); + if (CompressionProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CompressionProperties).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(FormatReadSettingsType); @@ -36,8 +49,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static BinaryReadSettings DeserializeBinaryReadSettings(JsonElement element) + internal static BinaryReadSettings DeserializeBinaryReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,5 +82,53 @@ internal static BinaryReadSettings DeserializeBinaryReadSettings(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new BinaryReadSettings(type, additionalProperties, compressionProperties.Value); } + + BinaryReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBinaryReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BinaryReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBinaryReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BinaryReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BinaryReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBinaryReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.cs index 16e491f1c690..8e9ac57534dc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinaryReadSettings.cs @@ -13,13 +13,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Binary read settings. public partial class BinaryReadSettings : FormatReadSettings { - /// Initializes a new instance of BinaryReadSettings. + /// Initializes a new instance of . public BinaryReadSettings() { FormatReadSettingsType = "BinaryReadSettings"; } - /// Initializes a new instance of BinaryReadSettings. + /// Initializes a new instance of . /// The read setting type. /// Additional Properties. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.Serialization.cs index 45b76b880654..234f936c46b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class BinarySink : IUtf8JsonSerializable + public partial class BinarySink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -67,8 +80,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static BinarySink DeserializeBinarySink(JsonElement element) + internal static BinarySink DeserializeBinarySink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +173,53 @@ internal static BinarySink DeserializeBinarySink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new BinarySink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value); } + + BinarySink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBinarySink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BinarySink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBinarySink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BinarySink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BinarySink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBinarySink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.cs index fef1bcb7bf01..414398e53978 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Binary sink. public partial class BinarySink : CopySink { - /// Initializes a new instance of BinarySink. + /// Initializes a new instance of . public BinarySink() { CopySinkType = "BinarySink"; } - /// Initializes a new instance of BinarySink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.Serialization.cs index 676d8a46b2d6..daf1a17d7575 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class BinarySource : IUtf8JsonSerializable + public partial class BinarySource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySourceType); @@ -62,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static BinarySource DeserializeBinarySource(JsonElement element) + internal static BinarySource DeserializeBinarySource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -143,5 +165,53 @@ internal static BinarySource DeserializeBinarySource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new BinarySource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value); } + + BinarySource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeBinarySource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + BinarySource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeBinarySource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(BinarySource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator BinarySource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeBinarySource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.cs index a316688a0b16..1eadb784866b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/BinarySource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Binary source. public partial class BinarySource : CopyActivitySource { - /// Initializes a new instance of BinarySource. + /// Initializes a new instance of . public BinarySource() { CopySourceType = "BinarySource"; } - /// Initializes a new instance of BinarySource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.Serialization.cs index 31f9ff790679..9970246829da 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CassandraLinkedService : IUtf8JsonSerializable + public partial class CassandraLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -102,8 +122,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CassandraLinkedService DeserializeCassandraLinkedService(JsonElement element) + internal static CassandraLinkedService DeserializeCassandraLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -240,5 +262,53 @@ internal static CassandraLinkedService DeserializeCassandraLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new CassandraLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, authenticationType.Value, port.Value, username.Value, password, encryptedCredential.Value); } + + CassandraLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.cs index de07aa5fc58a..20bab6a4413d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Cassandra data source. public partial class CassandraLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of CassandraLinkedService. + /// Initializes a new instance of . /// Host name for connection. Type: string (or Expression with resultType string). /// is null. public CassandraLinkedService(DataFactoryElement host) @@ -26,7 +26,7 @@ public CassandraLinkedService(DataFactoryElement host) LinkedServiceType = "Cassandra"; } - /// Initializes a new instance of CassandraLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal CassandraLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "Cassandra"; } + /// Initializes a new instance of for deserialization. + internal CassandraLinkedService() + { + } + /// Host name for connection. Type: string (or Expression with resultType string). public DataFactoryElement Host { get; set; } /// AuthenticationType to be used for connection. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.Serialization.cs index e888bbaddf11..c9b642b5ed91 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CassandraSource : IUtf8JsonSerializable + public partial class CassandraSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CassandraSource DeserializeCassandraSource(JsonElement element) + internal static CassandraSource DeserializeCassandraSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static CassandraSource DeserializeCassandraSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new CassandraSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, Optional.ToNullable(consistencyLevel)); } + + CassandraSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.cs index b1fec642efc5..7efa9cf8e301 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for a Cassandra database. public partial class CassandraSource : TabularSource { - /// Initializes a new instance of CassandraSource. + /// Initializes a new instance of . public CassandraSource() { CopySourceType = "CassandraSource"; } - /// Initializes a new instance of CassandraSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.Serialization.cs index ccf34047b5f1..ca10751a41ba 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CassandraTableDataset : IUtf8JsonSerializable + public partial class CassandraTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CassandraTableDataset DeserializeCassandraTableDataset(JsonElement element) + internal static CassandraTableDataset DeserializeCassandraTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +250,53 @@ internal static CassandraTableDataset DeserializeCassandraTableDataset(JsonEleme additionalProperties = additionalPropertiesDictionary; return new CassandraTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, keyspace.Value); } + + CassandraTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCassandraTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CassandraTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCassandraTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CassandraTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CassandraTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCassandraTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.cs index 8cb8a7dd62a3..bc9a55ef53e5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CassandraTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Cassandra database dataset. public partial class CassandraTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of CassandraTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public CassandraTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public CassandraTableDataset(DataFactoryLinkedServiceReference linkedServiceName DatasetType = "CassandraTable"; } - /// Initializes a new instance of CassandraTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -44,6 +44,11 @@ internal CassandraTableDataset(string datasetType, string description, DataFacto DatasetType = datasetType ?? "CassandraTable"; } + /// Initializes a new instance of for deserialization. + internal CassandraTableDataset() + { + } + /// The table name of the Cassandra database. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } /// The keyspace of the Cassandra database. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.Serialization.cs index 3c4ebe0a2b4f..b4d804ee4aca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.Serialization.cs @@ -8,17 +8,30 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ChainingTrigger : IUtf8JsonSerializable + public partial class ChainingTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("pipeline"u8); - writer.WriteObjectValue(Pipeline); + if (Pipeline is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Pipeline).Serialize(writer, options); + } writer.WritePropertyName("type"u8); writer.WriteStringValue(TriggerType); if (Optional.IsDefined(Description)) @@ -51,7 +64,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("runDimension"u8); @@ -69,8 +89,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ChainingTrigger DeserializeChainingTrigger(JsonElement element) + internal static ChainingTrigger DeserializeChainingTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -163,5 +185,53 @@ internal static ChainingTrigger DeserializeChainingTrigger(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ChainingTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, pipeline, dependsOn, runDimension); } + + ChainingTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChainingTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChainingTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChainingTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChainingTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChainingTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChainingTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.cs index 148de9ad1688..a95df655b934 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChainingTrigger.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger that allows the referenced pipeline to depend on other pipeline runs based on runDimension Name/Value pairs. Upstream pipelines should declare the same runDimension Name and their runs should have the values for those runDimensions. The referenced pipeline run would be triggered if the values for the runDimension match for all upstream pipeline runs. public partial class ChainingTrigger : DataFactoryTriggerProperties { - /// Initializes a new instance of ChainingTrigger. + /// Initializes a new instance of . /// Pipeline for which runs are created when all upstream pipelines complete successfully. /// Upstream Pipelines. /// Run Dimension property that needs to be emitted by upstream pipelines. @@ -32,7 +32,7 @@ public ChainingTrigger(TriggerPipelineReference pipeline, IEnumerable Initializes a new instance of ChainingTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. @@ -49,6 +49,11 @@ internal ChainingTrigger(string triggerType, string description, DataFactoryTrig TriggerType = triggerType ?? "ChainingTrigger"; } + /// Initializes a new instance of for deserialization. + internal ChainingTrigger() + { + } + /// Pipeline for which runs are created when all upstream pipelines complete successfully. public TriggerPipelineReference Pipeline { get; set; } /// Upstream Pipelines. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.Serialization.cs index b4577f45f216..d85cb0497681 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class ChangeDataCaptureFolder : IUtf8JsonSerializable + internal partial class ChangeDataCaptureFolder : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ChangeDataCaptureFolder DeserializeChangeDataCaptureFolder(JsonElement element) + internal static ChangeDataCaptureFolder DeserializeChangeDataCaptureFolder(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static ChangeDataCaptureFolder DeserializeChangeDataCaptureFolder(JsonE name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ChangeDataCaptureFolder(name.Value, serializedAdditionalRawData); + } + + ChangeDataCaptureFolder IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChangeDataCaptureFolder(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChangeDataCaptureFolder IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChangeDataCaptureFolder(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChangeDataCaptureFolder model) + { + if (model is null) + { + return null; } - return new ChangeDataCaptureFolder(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChangeDataCaptureFolder(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChangeDataCaptureFolder(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.cs index 39a62905c0c3..145199b8cc9c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureFolder.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The folder that this CDC is in. If not specified, CDC will appear at the root level. internal partial class ChangeDataCaptureFolder { - /// Initializes a new instance of ChangeDataCaptureFolder. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ChangeDataCaptureFolder() { } - /// Initializes a new instance of ChangeDataCaptureFolder. + /// Initializes a new instance of . /// The name of the folder that this CDC is in. - internal ChangeDataCaptureFolder(string name) + /// Keeps track of any properties unknown to the library. + internal ChangeDataCaptureFolder(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the folder that this CDC is in. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.Serialization.cs index afcd7d9a4f87..63abd2176472 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class ChangeDataCaptureListResult + internal partial class ChangeDataCaptureListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ChangeDataCaptureListResult DeserializeChangeDataCaptureListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ChangeDataCaptureListResult DeserializeChangeDataCaptureListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static ChangeDataCaptureListResult DeserializeChangeDataCaptureListResu nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ChangeDataCaptureListResult(value, nextLink.Value); + return new ChangeDataCaptureListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + ChangeDataCaptureListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeChangeDataCaptureListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ChangeDataCaptureListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeChangeDataCaptureListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ChangeDataCaptureListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ChangeDataCaptureListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeChangeDataCaptureListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.cs index 696585781306..ef9b73d23a4d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ChangeDataCaptureListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of change data capture resources. internal partial class ChangeDataCaptureListResult { - /// Initializes a new instance of ChangeDataCaptureListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Lists all resources of type change data capture. /// is null. internal ChangeDataCaptureListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal ChangeDataCaptureListResult(IEnumerable Initializes a new instance of ChangeDataCaptureListResult. + /// Initializes a new instance of . /// Lists all resources of type change data capture. /// The link to the next page of results, if any remaining results exist. - internal ChangeDataCaptureListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal ChangeDataCaptureListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChangeDataCaptureListResult() + { } /// Lists all resources of type change data capture. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.Serialization.cs index 289805ddbb7c..fe36622bfcd8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CmdkeySetup : IUtf8JsonSerializable + public partial class CmdkeySetup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CustomSetupBaseType); @@ -35,11 +42,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #endif writer.WritePropertyName("password"u8); JsonSerializer.Serialize(writer, Password); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CmdkeySetup DeserializeCmdkeySetup(JsonElement element) + internal static CmdkeySetup DeserializeCmdkeySetup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,6 +69,7 @@ internal static CmdkeySetup DeserializeCmdkeySetup(JsonElement element) BinaryData targetName = default; BinaryData userName = default; DataFactorySecretBaseDefinition password = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -82,8 +104,61 @@ internal static CmdkeySetup DeserializeCmdkeySetup(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new CmdkeySetup(type, targetName, userName, password); + return new CmdkeySetup(type, targetName, userName, password, serializedAdditionalRawData); + } + + CmdkeySetup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCmdkeySetup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CmdkeySetup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCmdkeySetup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CmdkeySetup model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CmdkeySetup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCmdkeySetup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.cs index d8f378c2d13e..3e683dbb5653 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CmdkeySetup.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The custom setup of running cmdkey commands. public partial class CmdkeySetup : CustomSetupBase { - /// Initializes a new instance of CmdkeySetup. + /// Initializes a new instance of . /// The server name of data source access. /// The user name of data source access. /// The password of data source access. @@ -31,12 +32,13 @@ public CmdkeySetup(BinaryData targetName, BinaryData userName, DataFactorySecret CustomSetupBaseType = "CmdkeySetup"; } - /// Initializes a new instance of CmdkeySetup. + /// Initializes a new instance of . /// The type of custom setup. /// The server name of data source access. /// The user name of data source access. /// The password of data source access. - internal CmdkeySetup(string customSetupBaseType, BinaryData targetName, BinaryData userName, DataFactorySecretBaseDefinition password) : base(customSetupBaseType) + /// Keeps track of any properties unknown to the library. + internal CmdkeySetup(string customSetupBaseType, BinaryData targetName, BinaryData userName, DataFactorySecretBaseDefinition password, Dictionary serializedAdditionalRawData) : base(customSetupBaseType, serializedAdditionalRawData) { TargetName = targetName; UserName = userName; @@ -44,6 +46,11 @@ internal CmdkeySetup(string customSetupBaseType, BinaryData targetName, BinaryDa CustomSetupBaseType = customSetupBaseType ?? "CmdkeySetup"; } + /// Initializes a new instance of for deserialization. + internal CmdkeySetup() + { + } + /// /// The server name of data source access. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.Serialization.cs index 707726cb26be..7020476ba4be 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CommonDataServiceForAppsEntityDataset : IUtf8JsonSerializable + public partial class CommonDataServiceForAppsEntityDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CommonDataServiceForAppsEntityDataset DeserializeCommonDataServiceForAppsEntityDataset(JsonElement element) + internal static CommonDataServiceForAppsEntityDataset DeserializeCommonDataServiceForAppsEntityDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static CommonDataServiceForAppsEntityDataset DeserializeCommonDataServi additionalProperties = additionalPropertiesDictionary; return new CommonDataServiceForAppsEntityDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, entityName.Value); } + + CommonDataServiceForAppsEntityDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommonDataServiceForAppsEntityDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommonDataServiceForAppsEntityDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommonDataServiceForAppsEntityDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommonDataServiceForAppsEntityDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommonDataServiceForAppsEntityDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommonDataServiceForAppsEntityDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.cs index 0d6346bc1132..cf66e5b2ffdb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsEntityDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Common Data Service for Apps entity dataset. public partial class CommonDataServiceForAppsEntityDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of CommonDataServiceForAppsEntityDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public CommonDataServiceForAppsEntityDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public CommonDataServiceForAppsEntityDataset(DataFactoryLinkedServiceReference l DatasetType = "CommonDataServiceForAppsEntity"; } - /// Initializes a new instance of CommonDataServiceForAppsEntityDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal CommonDataServiceForAppsEntityDataset(string datasetType, string descri DatasetType = datasetType ?? "CommonDataServiceForAppsEntity"; } + /// Initializes a new instance of for deserialization. + internal CommonDataServiceForAppsEntityDataset() + { + } + /// The logical name of the entity. Type: string (or Expression with resultType string). public DataFactoryElement EntityName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.Serialization.cs index a6c17d258a63..0a4b89614d8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CommonDataServiceForAppsLinkedService : IUtf8JsonSerializable + public partial class CommonDataServiceForAppsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -129,8 +149,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CommonDataServiceForAppsLinkedService DeserializeCommonDataServiceForAppsLinkedService(JsonElement element) + internal static CommonDataServiceForAppsLinkedService DeserializeCommonDataServiceForAppsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -323,5 +345,53 @@ internal static CommonDataServiceForAppsLinkedService DeserializeCommonDataServi additionalProperties = additionalPropertiesDictionary; return new CommonDataServiceForAppsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, deploymentType, hostName.Value, port.Value, serviceUri.Value, organizationName.Value, authenticationType, username.Value, password, servicePrincipalId.Value, servicePrincipalCredentialType.Value, servicePrincipalCredential, encryptedCredential.Value); } + + CommonDataServiceForAppsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommonDataServiceForAppsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommonDataServiceForAppsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommonDataServiceForAppsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommonDataServiceForAppsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommonDataServiceForAppsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommonDataServiceForAppsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.cs index f134870da077..8ddfa0b1d51b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Common Data Service for Apps linked service. public partial class CommonDataServiceForAppsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of CommonDataServiceForAppsLinkedService. + /// Initializes a new instance of . /// The deployment type of the Common Data Service for Apps instance. 'Online' for Common Data Service for Apps Online and 'OnPremisesWithIfd' for Common Data Service for Apps on-premises with Ifd. Type: string (or Expression with resultType string). /// The authentication type to connect to Common Data Service for Apps server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario. 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public CommonDataServiceForAppsLinkedService(DataFactoryElement deployme LinkedServiceType = "CommonDataServiceForApps"; } - /// Initializes a new instance of CommonDataServiceForAppsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -65,6 +65,11 @@ internal CommonDataServiceForAppsLinkedService(string linkedServiceType, Integra LinkedServiceType = linkedServiceType ?? "CommonDataServiceForApps"; } + /// Initializes a new instance of for deserialization. + internal CommonDataServiceForAppsLinkedService() + { + } + /// The deployment type of the Common Data Service for Apps instance. 'Online' for Common Data Service for Apps Online and 'OnPremisesWithIfd' for Common Data Service for Apps on-premises with Ifd. Type: string (or Expression with resultType string). public DataFactoryElement DeploymentType { get; set; } /// The host name of the on-premises Common Data Service for Apps server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.Serialization.cs index 09f9e1a39bd7..0b2a58c74596 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CommonDataServiceForAppsSink : IUtf8JsonSerializable + public partial class CommonDataServiceForAppsSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("writeBehavior"u8); writer.WriteStringValue(WriteBehavior.ToString()); @@ -74,8 +80,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CommonDataServiceForAppsSink DeserializeCommonDataServiceForAppsSink(JsonElement element) + internal static CommonDataServiceForAppsSink DeserializeCommonDataServiceForAppsSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -181,5 +189,53 @@ internal static CommonDataServiceForAppsSink DeserializeCommonDataServiceForApps additionalProperties = additionalPropertiesDictionary; return new CommonDataServiceForAppsSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior, ignoreNullValues.Value, alternateKeyName.Value); } + + CommonDataServiceForAppsSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommonDataServiceForAppsSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommonDataServiceForAppsSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommonDataServiceForAppsSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommonDataServiceForAppsSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommonDataServiceForAppsSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommonDataServiceForAppsSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.cs index b1ebf0cc15af..426ec7e855d9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSink.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Common Data Service for Apps sink. public partial class CommonDataServiceForAppsSink : CopySink { - /// Initializes a new instance of CommonDataServiceForAppsSink. + /// Initializes a new instance of . /// The write behavior for the operation. public CommonDataServiceForAppsSink(DynamicsSinkWriteBehavior writeBehavior) { @@ -22,7 +22,7 @@ public CommonDataServiceForAppsSink(DynamicsSinkWriteBehavior writeBehavior) CopySinkType = "CommonDataServiceForAppsSink"; } - /// Initializes a new instance of CommonDataServiceForAppsSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). @@ -42,6 +42,11 @@ internal CommonDataServiceForAppsSink(string copySinkType, DataFactoryElement Initializes a new instance of for deserialization. + internal CommonDataServiceForAppsSink() + { + } + /// The write behavior for the operation. public DynamicsSinkWriteBehavior WriteBehavior { get; set; } /// The flag indicating whether to ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.Serialization.cs index 2424117148a5..d0f5a2b6764c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CommonDataServiceForAppsSource : IUtf8JsonSerializable + public partial class CommonDataServiceForAppsSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CommonDataServiceForAppsSource DeserializeCommonDataServiceForAppsSource(JsonElement element) + internal static CommonDataServiceForAppsSource DeserializeCommonDataServiceForAppsSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static CommonDataServiceForAppsSource DeserializeCommonDataServiceForAp additionalProperties = additionalPropertiesDictionary; return new CommonDataServiceForAppsSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, additionalColumns.Value); } + + CommonDataServiceForAppsSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCommonDataServiceForAppsSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CommonDataServiceForAppsSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCommonDataServiceForAppsSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CommonDataServiceForAppsSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CommonDataServiceForAppsSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCommonDataServiceForAppsSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.cs index fff135fb52c0..1404eeac82c2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CommonDataServiceForAppsSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Common Data Service for Apps source. public partial class CommonDataServiceForAppsSource : CopyActivitySource { - /// Initializes a new instance of CommonDataServiceForAppsSource. + /// Initializes a new instance of . public CommonDataServiceForAppsSource() { CopySourceType = "CommonDataServiceForAppsSource"; } - /// Initializes a new instance of CommonDataServiceForAppsSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.Serialization.cs index 9f6ff9eb09dd..5ea5aa4cab90 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ComponentSetup : IUtf8JsonSerializable + public partial class ComponentSetup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CustomSetupBaseType); @@ -28,11 +36,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, LicenseKey); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ComponentSetup DeserializeComponentSetup(JsonElement element) + internal static ComponentSetup DeserializeComponentSetup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +62,7 @@ internal static ComponentSetup DeserializeComponentSetup(JsonElement element) string type = default; string componentName = default; Optional licenseKey = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -73,8 +96,61 @@ internal static ComponentSetup DeserializeComponentSetup(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ComponentSetup(type, componentName, licenseKey, serializedAdditionalRawData); + } + + ComponentSetup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeComponentSetup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ComponentSetup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeComponentSetup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ComponentSetup model) + { + if (model is null) + { + return null; } - return new ComponentSetup(type, componentName, licenseKey); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ComponentSetup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeComponentSetup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.cs index 1866d5c066a2..fd760b2ff8bf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ComponentSetup.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The custom setup of installing 3rd party components. public partial class ComponentSetup : CustomSetupBase { - /// Initializes a new instance of ComponentSetup. + /// Initializes a new instance of . /// The name of the 3rd party component. /// is null. public ComponentSetup(string componentName) @@ -25,17 +26,23 @@ public ComponentSetup(string componentName) CustomSetupBaseType = "ComponentSetup"; } - /// Initializes a new instance of ComponentSetup. + /// Initializes a new instance of . /// The type of custom setup. /// The name of the 3rd party component. /// The license key to activate the component. - internal ComponentSetup(string customSetupBaseType, string componentName, DataFactorySecretBaseDefinition licenseKey) : base(customSetupBaseType) + /// Keeps track of any properties unknown to the library. + internal ComponentSetup(string customSetupBaseType, string componentName, DataFactorySecretBaseDefinition licenseKey, Dictionary serializedAdditionalRawData) : base(customSetupBaseType, serializedAdditionalRawData) { ComponentName = componentName; LicenseKey = licenseKey; CustomSetupBaseType = customSetupBaseType ?? "ComponentSetup"; } + /// Initializes a new instance of for deserialization. + internal ComponentSetup() + { + } + /// The name of the 3rd party component. public string ComponentName { get; set; } /// The license key to activate the component. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.Serialization.cs index c26ba2e97f30..fc84287db64f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CompressionReadSettings : IUtf8JsonSerializable + public partial class CompressionReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CompressionReadSettingsType); @@ -29,8 +37,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CompressionReadSettings DeserializeCompressionReadSettings(JsonElement element) + internal static CompressionReadSettings DeserializeCompressionReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,7 +54,70 @@ internal static CompressionReadSettings DeserializeCompressionReadSettings(JsonE case "ZipDeflateReadSettings": return ZipDeflateReadSettings.DeserializeZipDeflateReadSettings(element); } } - return UnknownCompressionReadSettings.DeserializeUnknownCompressionReadSettings(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownCompressionReadSettings(type, additionalProperties); + } + + CompressionReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCompressionReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CompressionReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCompressionReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CompressionReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CompressionReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCompressionReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.cs index 579a8add2b49..8d37036260a2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CompressionReadSettings.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class CompressionReadSettings { - /// Initializes a new instance of CompressionReadSettings. + /// Initializes a new instance of . public CompressionReadSettings() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CompressionReadSettings. + /// Initializes a new instance of . /// The Compression setting type. /// Additional Properties. internal CompressionReadSettings(string compressionReadSettingsType, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.Serialization.cs index 0d6b2d0874ae..ebea399ee443 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ConcurLinkedService : IUtf8JsonSerializable + public partial class ConcurLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -113,8 +133,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ConcurLinkedService DeserializeConcurLinkedService(JsonElement element) + internal static ConcurLinkedService DeserializeConcurLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -267,5 +289,53 @@ internal static ConcurLinkedService DeserializeConcurLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new ConcurLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionProperties.Value, clientId, username, password, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + ConcurLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConcurLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConcurLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConcurLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConcurLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConcurLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConcurLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.cs index d0cffda6a614..945b0f773c5d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Concur Service linked service. public partial class ConcurLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of ConcurLinkedService. + /// Initializes a new instance of . /// Application client_id supplied by Concur App Management. /// The user name that you use to access Concur Service. /// or is null. @@ -29,7 +29,7 @@ public ConcurLinkedService(DataFactoryElement clientId, DataFactoryEleme LinkedServiceType = "Concur"; } - /// Initializes a new instance of ConcurLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -57,6 +57,11 @@ internal ConcurLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "Concur"; } + /// Initializes a new instance of for deserialization. + internal ConcurLinkedService() + { + } + /// /// Properties used to connect to Concur. It is mutually exclusive with any other properties in the linked service. Type: object. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.Serialization.cs index 7d50e6f8a5a1..58bbf132645a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ConcurObjectDataset : IUtf8JsonSerializable + public partial class ConcurObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ConcurObjectDataset DeserializeConcurObjectDataset(JsonElement element) + internal static ConcurObjectDataset DeserializeConcurObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static ConcurObjectDataset DeserializeConcurObjectDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new ConcurObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + ConcurObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConcurObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConcurObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConcurObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConcurObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConcurObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConcurObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.cs index 04cbc33a94da..b3bb894cf04c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Concur Service dataset. public partial class ConcurObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ConcurObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ConcurObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ConcurObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "ConcurObject"; } - /// Initializes a new instance of ConcurObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal ConcurObjectDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "ConcurObject"; } + /// Initializes a new instance of for deserialization. + internal ConcurObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.Serialization.cs index ba465d98f3ad..5360ccb208d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ConcurSource : IUtf8JsonSerializable + public partial class ConcurSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ConcurSource DeserializeConcurSource(JsonElement element) + internal static ConcurSource DeserializeConcurSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static ConcurSource DeserializeConcurSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ConcurSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + ConcurSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConcurSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConcurSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConcurSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConcurSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConcurSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConcurSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.cs index 01ec0e686fe4..4f557f04d57d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConcurSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Concur Service source. public partial class ConcurSource : TabularSource { - /// Initializes a new instance of ConcurSource. + /// Initializes a new instance of . public ConcurSource() { CopySourceType = "ConcurSource"; } - /// Initializes a new instance of ConcurSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.Serialization.cs index ba0bbb3ed864..b7fe45bb0b8d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.Serialization.cs @@ -5,21 +5,43 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ConnectionStateProperties : IUtf8JsonSerializable + public partial class ConnectionStateProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ConnectionStateProperties DeserializeConnectionStateProperties(JsonElement element) + internal static ConnectionStateProperties DeserializeConnectionStateProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -27,6 +49,7 @@ internal static ConnectionStateProperties DeserializeConnectionStateProperties(J Optional actionsRequired = default; Optional description = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("actionsRequired"u8)) @@ -44,8 +67,61 @@ internal static ConnectionStateProperties DeserializeConnectionStateProperties(J status = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ConnectionStateProperties(actionsRequired.Value, description.Value, status.Value, serializedAdditionalRawData); + } + + ConnectionStateProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeConnectionStateProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ConnectionStateProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeConnectionStateProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ConnectionStateProperties model) + { + if (model is null) + { + return null; } - return new ConnectionStateProperties(actionsRequired.Value, description.Value, status.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ConnectionStateProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeConnectionStateProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.cs index 0051f1274778..01b464b53262 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ConnectionStateProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The connection state of a managed private endpoint. public partial class ConnectionStateProperties { - /// Initializes a new instance of ConnectionStateProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ConnectionStateProperties() { } - /// Initializes a new instance of ConnectionStateProperties. + /// Initializes a new instance of . /// The actions required on the managed private endpoint. /// The managed private endpoint description. /// The approval status. - internal ConnectionStateProperties(string actionsRequired, string description, string status) + /// Keeps track of any properties unknown to the library. + internal ConnectionStateProperties(string actionsRequired, string description, string status, Dictionary serializedAdditionalRawData) { ActionsRequired = actionsRequired; Description = description; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The actions required on the managed private endpoint. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.Serialization.cs index 0f920cb45f90..24b95167b9a0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ControlActivity : IUtf8JsonSerializable + public partial class ControlActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -42,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -68,8 +88,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ControlActivity DeserializeControlActivity(JsonElement element) + internal static ControlActivity DeserializeControlActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -92,6 +114,8 @@ internal static ControlActivity DeserializeControlActivity(JsonElement element) case "WebHook": return WebHookActivity.DeserializeWebHookActivity(element); } } + + // Unknown type found so we will deserialize the base properties only string name = default; string type = "Container"; Optional description = default; @@ -169,5 +193,53 @@ internal static ControlActivity DeserializeControlActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ControlActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties); } + + ControlActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeControlActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ControlActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeControlActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ControlActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ControlActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeControlActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.cs index ca0883716d96..5865cbd6baa2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ControlActivity.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class ControlActivity : PipelineActivity { - /// Initializes a new instance of ControlActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public ControlActivity(string name) : base(name) @@ -28,7 +28,7 @@ public ControlActivity(string name) : base(name) ActivityType = "Container"; } - /// Initializes a new instance of ControlActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -41,5 +41,10 @@ internal ControlActivity(string name, string activityType, string description, P { ActivityType = activityType ?? "Container"; } + + /// Initializes a new instance of for deserialization. + internal ControlActivity() + { + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.Serialization.cs index e7d0eb51963b..6bd5dec8c109 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CopyActivity : IUtf8JsonSerializable + public partial class CopyActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Inputs)) { @@ -24,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Inputs) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -34,7 +47,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Outputs) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -46,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -73,7 +100,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -83,16 +117,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } writer.WritePropertyName("sink"u8); - writer.WriteObjectValue(Sink); + if (Sink is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Sink).Serialize(writer, options); + } if (Optional.IsDefined(Translator)) { writer.WritePropertyName("translator"u8); @@ -110,7 +165,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(StagingSettings)) { writer.WritePropertyName("stagingSettings"u8); - writer.WriteObjectValue(StagingSettings); + if (StagingSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StagingSettings).Serialize(writer, options); + } } if (Optional.IsDefined(ParallelCopies)) { @@ -130,17 +192,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RedirectIncompatibleRowSettings)) { writer.WritePropertyName("redirectIncompatibleRowSettings"u8); - writer.WriteObjectValue(RedirectIncompatibleRowSettings); + if (RedirectIncompatibleRowSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RedirectIncompatibleRowSettings).Serialize(writer, options); + } } if (Optional.IsDefined(LogStorageSettings)) { writer.WritePropertyName("logStorageSettings"u8); - writer.WriteObjectValue(LogStorageSettings); + if (LogStorageSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogStorageSettings).Serialize(writer, options); + } } if (Optional.IsDefined(LogSettings)) { writer.WritePropertyName("logSettings"u8); - writer.WriteObjectValue(LogSettings); + if (LogSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogSettings).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(PreserveRules)) { @@ -188,7 +271,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SkipErrorFile)) { writer.WritePropertyName("skipErrorFile"u8); - writer.WriteObjectValue(SkipErrorFile); + if (SkipErrorFile is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SkipErrorFile).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -203,8 +293,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CopyActivity DeserializeCopyActivity(JsonElement element) + internal static CopyActivity DeserializeCopyActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -514,5 +606,53 @@ internal static CopyActivity DeserializeCopyActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new CopyActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, Optional.ToList(inputs), Optional.ToList(outputs), source, sink, translator.Value, enableStaging.Value, stagingSettings.Value, parallelCopies.Value, dataIntegrationUnits.Value, enableSkipIncompatibleRow.Value, redirectIncompatibleRowSettings.Value, logStorageSettings.Value, logSettings.Value, Optional.ToList(preserveRules), Optional.ToList(preserve), validateDataConsistency.Value, skipErrorFile.Value); } + + CopyActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopyActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopyActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopyActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopyActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.cs index 8355472c501e..8784e27c72b2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Copy activity. public partial class CopyActivity : ExecutionActivity { - /// Initializes a new instance of CopyActivity. + /// Initializes a new instance of . /// Activity name. /// /// Copy activity source. @@ -43,7 +43,7 @@ public CopyActivity(string name, CopyActivitySource source, CopySink sink) : bas ActivityType = "Copy"; } - /// Initializes a new instance of CopyActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -101,6 +101,11 @@ internal CopyActivity(string name, string activityType, string description, Pipe ActivityType = activityType ?? "Copy"; } + /// Initializes a new instance of for deserialization. + internal CopyActivity() + { + } + /// List of inputs for the activity. public IList Inputs { get; } /// List of outputs for the activity. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.Serialization.cs index 2f830abd62e3..3eca5cef4e9f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CopyActivityLogSettings : IUtf8JsonSerializable + public partial class CopyActivityLogSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LogLevel)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableReliableLogging"u8); JsonSerializer.Serialize(writer, EnableReliableLogging); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CopyActivityLogSettings DeserializeCopyActivityLogSettings(JsonElement element) + internal static CopyActivityLogSettings DeserializeCopyActivityLogSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> logLevel = default; Optional> enableReliableLogging = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logLevel"u8)) @@ -57,8 +80,61 @@ internal static CopyActivityLogSettings DeserializeCopyActivityLogSettings(JsonE enableReliableLogging = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CopyActivityLogSettings(logLevel.Value, enableReliableLogging.Value, serializedAdditionalRawData); + } + + CopyActivityLogSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopyActivityLogSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyActivityLogSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyActivityLogSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopyActivityLogSettings model) + { + if (model is null) + { + return null; } - return new CopyActivityLogSettings(logLevel.Value, enableReliableLogging.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopyActivityLogSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopyActivityLogSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.cs index 8b3bfb5b04db..6a4d00c31389 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivityLogSettings.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Settings for copy activity log. public partial class CopyActivityLogSettings { - /// Initializes a new instance of CopyActivityLogSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CopyActivityLogSettings() { } - /// Initializes a new instance of CopyActivityLogSettings. + /// Initializes a new instance of . /// Gets or sets the log level, support: Info, Warning. Type: string (or Expression with resultType string). /// Specifies whether to enable reliable logging. Type: boolean (or Expression with resultType boolean). - internal CopyActivityLogSettings(DataFactoryElement logLevel, DataFactoryElement enableReliableLogging) + /// Keeps track of any properties unknown to the library. + internal CopyActivityLogSettings(DataFactoryElement logLevel, DataFactoryElement enableReliableLogging, Dictionary serializedAdditionalRawData) { LogLevel = logLevel; EnableReliableLogging = enableReliableLogging; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets or sets the log level, support: Info, Warning. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.Serialization.cs index 2743082d9712..38d49cc4d0f9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CopyActivitySource : IUtf8JsonSerializable + public partial class CopyActivitySource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySourceType); @@ -49,8 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CopyActivitySource DeserializeCopyActivitySource(JsonElement element) + internal static CopyActivitySource DeserializeCopyActivitySource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -157,7 +168,110 @@ internal static CopyActivitySource DeserializeCopyActivitySource(JsonElement ele case "ZohoSource": return ZohoSource.DeserializeZohoSource(element); } } - return UnknownCopySource.DeserializeUnknownCopySource(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional> sourceRetryCount = default; + Optional> sourceRetryWait = default; + Optional> maxConcurrentConnections = default; + Optional> disableMetricsCollection = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceRetryCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceRetryCount = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("sourceRetryWait"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceRetryWait = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("maxConcurrentConnections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxConcurrentConnections = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("disableMetricsCollection"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableMetricsCollection = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownCopySource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties); + } + + CopyActivitySource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopyActivitySource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyActivitySource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyActivitySource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopyActivitySource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopyActivitySource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopyActivitySource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.cs index 0684e3285263..b787c22a8d31 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyActivitySource.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class CopyActivitySource { - /// Initializes a new instance of CopyActivitySource. + /// Initializes a new instance of . public CopyActivitySource() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CopyActivitySource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.Serialization.cs index 9be3e68e9b63..3d8d22913a7f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CopyComputeScaleProperties : IUtf8JsonSerializable + public partial class CopyComputeScaleProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(DataIntegrationUnit)) { @@ -39,8 +45,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CopyComputeScaleProperties DeserializeCopyComputeScaleProperties(JsonElement element) + internal static CopyComputeScaleProperties DeserializeCopyComputeScaleProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,5 +82,53 @@ internal static CopyComputeScaleProperties DeserializeCopyComputeScaleProperties additionalProperties = additionalPropertiesDictionary; return new CopyComputeScaleProperties(Optional.ToNullable(dataIntegrationUnit), Optional.ToNullable(timeToLive), additionalProperties); } + + CopyComputeScaleProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopyComputeScaleProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopyComputeScaleProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopyComputeScaleProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopyComputeScaleProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopyComputeScaleProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopyComputeScaleProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.cs index 460eb0e98fdb..cd695bf7ed17 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopyComputeScaleProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// CopyComputeScale properties for managed integration runtime. public partial class CopyComputeScaleProperties { - /// Initializes a new instance of CopyComputeScaleProperties. + /// Initializes a new instance of . public CopyComputeScaleProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CopyComputeScaleProperties. + /// Initializes a new instance of . /// DIU number setting reserved for copy activity execution. Supported values are multiples of 4 in range 4-256. /// Time to live (in minutes) setting of integration runtime which will execute copy activity. /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.Serialization.cs index ed74c3e7a88c..44f4e2905c52 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CopySink : IUtf8JsonSerializable + public partial class CopySink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -59,8 +68,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CopySink DeserializeCopySink(JsonElement element) + internal static CopySink DeserializeCopySink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -110,7 +121,130 @@ internal static CopySink DeserializeCopySink(JsonElement element) case "SqlSink": return SqlSink.DeserializeSqlSink(element); } } - return UnknownCopySink.DeserializeUnknownCopySink(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional> writeBatchSize = default; + Optional> writeBatchTimeout = default; + Optional> sinkRetryCount = default; + Optional> sinkRetryWait = default; + Optional> maxConcurrentConnections = default; + Optional> disableMetricsCollection = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("writeBatchSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeBatchSize = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("writeBatchTimeout"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeBatchTimeout = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("sinkRetryCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sinkRetryCount = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("sinkRetryWait"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sinkRetryWait = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("maxConcurrentConnections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxConcurrentConnections = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("disableMetricsCollection"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disableMetricsCollection = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownCopySink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties); + } + + CopySink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCopySink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CopySink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCopySink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CopySink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CopySink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCopySink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.cs index 1475da5b9364..a0007edc5173 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CopySink.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class CopySink { - /// Initializes a new instance of CopySink. + /// Initializes a new instance of . public CopySink() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of CopySink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.Serialization.cs index 75190e3b6658..b8a847e879fc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBLinkedService : IUtf8JsonSerializable + public partial class CosmosDBLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -120,7 +140,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -135,8 +162,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBLinkedService DeserializeCosmosDBLinkedService(JsonElement element) + internal static CosmosDBLinkedService DeserializeCosmosDBLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -337,5 +366,53 @@ internal static CosmosDBLinkedService DeserializeCosmosDBLinkedService(JsonEleme additionalProperties = additionalPropertiesDictionary; return new CosmosDBLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, accountEndpoint.Value, database.Value, accountKey, servicePrincipalId.Value, servicePrincipalCredentialType.Value, servicePrincipalCredential, tenant.Value, azureCloudType.Value, Optional.ToNullable(connectionMode), encryptedCredential.Value, credential.Value); } + + CosmosDBLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.cs index 497f6b59e9b3..63c346a29a4a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Microsoft Azure Cosmos Database (CosmosDB) linked service. public partial class CosmosDBLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of CosmosDBLinkedService. + /// Initializes a new instance of . public CosmosDBLinkedService() { LinkedServiceType = "CosmosDb"; } - /// Initializes a new instance of CosmosDBLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.Serialization.cs index 829649519bbb..0e35e81b612f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBMongoDBApiCollectionDataset : IUtf8JsonSerializable + public partial class CosmosDBMongoDBApiCollectionDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBMongoDBApiCollectionDataset DeserializeCosmosDBMongoDBApiCollectionDataset(JsonElement element) + internal static CosmosDBMongoDBApiCollectionDataset DeserializeCosmosDBMongoDBApiCollectionDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static CosmosDBMongoDBApiCollectionDataset DeserializeCosmosDBMongoDBAp additionalProperties = additionalPropertiesDictionary; return new CosmosDBMongoDBApiCollectionDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, collection); } + + CosmosDBMongoDBApiCollectionDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMongoDBApiCollectionDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMongoDBApiCollectionDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMongoDBApiCollectionDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMongoDBApiCollectionDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMongoDBApiCollectionDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMongoDBApiCollectionDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.cs index 6915be0fd347..8372d6e45c8b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiCollectionDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The CosmosDB (MongoDB API) database dataset. public partial class CosmosDBMongoDBApiCollectionDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of CosmosDBMongoDBApiCollectionDataset. + /// Initializes a new instance of . /// Linked service reference. /// The collection name of the CosmosDB (MongoDB API) database. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public CosmosDBMongoDBApiCollectionDataset(DataFactoryLinkedServiceReference lin DatasetType = "CosmosDbMongoDbApiCollection"; } - /// Initializes a new instance of CosmosDBMongoDBApiCollectionDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal CosmosDBMongoDBApiCollectionDataset(string datasetType, string descript DatasetType = datasetType ?? "CosmosDbMongoDbApiCollection"; } + /// Initializes a new instance of for deserialization. + internal CosmosDBMongoDBApiCollectionDataset() + { + } + /// The collection name of the CosmosDB (MongoDB API) database. Type: string (or Expression with resultType string). public DataFactoryElement Collection { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.Serialization.cs index 7cf4952acc46..04e06f603d67 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBMongoDBApiLinkedService : IUtf8JsonSerializable + public partial class CosmosDBMongoDBApiLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -84,8 +104,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBMongoDBApiLinkedService DeserializeCosmosDBMongoDBApiLinkedService(JsonElement element) + internal static CosmosDBMongoDBApiLinkedService DeserializeCosmosDBMongoDBApiLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +214,53 @@ internal static CosmosDBMongoDBApiLinkedService DeserializeCosmosDBMongoDBApiLin additionalProperties = additionalPropertiesDictionary; return new CosmosDBMongoDBApiLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, isServerVersionAbove32.Value, connectionString, database); } + + CosmosDBMongoDBApiLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMongoDBApiLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMongoDBApiLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMongoDBApiLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMongoDBApiLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMongoDBApiLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMongoDBApiLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.cs index bf0c44c0b9c1..d8af7a0dbe3f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for CosmosDB (MongoDB API) data source. public partial class CosmosDBMongoDBApiLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of CosmosDBMongoDBApiLinkedService. + /// Initializes a new instance of . /// The CosmosDB (MongoDB API) connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. /// The name of the CosmosDB (MongoDB API) database that you want to access. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public CosmosDBMongoDBApiLinkedService(DataFactoryElement connectionStri LinkedServiceType = "CosmosDbMongoDbApi"; } - /// Initializes a new instance of CosmosDBMongoDBApiLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -47,6 +47,11 @@ internal CosmosDBMongoDBApiLinkedService(string linkedServiceType, IntegrationRu LinkedServiceType = linkedServiceType ?? "CosmosDbMongoDbApi"; } + /// Initializes a new instance of for deserialization. + internal CosmosDBMongoDBApiLinkedService() + { + } + /// Whether the CosmosDB (MongoDB API) server version is higher than 3.2. The default value is false. Type: boolean (or Expression with resultType boolean). public DataFactoryElement IsServerVersionAbove32 { get; set; } /// The CosmosDB (MongoDB API) connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.Serialization.cs index 29e564d860d2..4ede6dbc370c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBMongoDBApiSink : IUtf8JsonSerializable + public partial class CosmosDBMongoDBApiSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBMongoDBApiSink DeserializeCosmosDBMongoDBApiSink(JsonElement element) + internal static CosmosDBMongoDBApiSink DeserializeCosmosDBMongoDBApiSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static CosmosDBMongoDBApiSink DeserializeCosmosDBMongoDBApiSink(JsonEle additionalProperties = additionalPropertiesDictionary; return new CosmosDBMongoDBApiSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior.Value); } + + CosmosDBMongoDBApiSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMongoDBApiSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMongoDBApiSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMongoDBApiSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMongoDBApiSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMongoDBApiSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMongoDBApiSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.cs index c3c5f40e77a1..0701e35e0397 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity sink for a CosmosDB (MongoDB API) database. public partial class CosmosDBMongoDBApiSink : CopySink { - /// Initializes a new instance of CosmosDBMongoDBApiSink. + /// Initializes a new instance of . public CosmosDBMongoDBApiSink() { CopySinkType = "CosmosDbMongoDbApiSink"; } - /// Initializes a new instance of CosmosDBMongoDBApiSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.Serialization.cs index 5a18ca67ff85..07aeaaaea0f6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBMongoDBApiSource : IUtf8JsonSerializable + public partial class CosmosDBMongoDBApiSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Filter)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CursorMethods)) { writer.WritePropertyName("cursorMethods"u8); - writer.WriteObjectValue(CursorMethods); + if (CursorMethods is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CursorMethods).Serialize(writer, options); + } } if (Optional.IsDefined(BatchSize)) { @@ -81,8 +94,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBMongoDBApiSource DeserializeCosmosDBMongoDBApiSource(JsonElement element) + internal static CosmosDBMongoDBApiSource DeserializeCosmosDBMongoDBApiSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +207,53 @@ internal static CosmosDBMongoDBApiSource DeserializeCosmosDBMongoDBApiSource(Jso additionalProperties = additionalPropertiesDictionary; return new CosmosDBMongoDBApiSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, filter.Value, cursorMethods.Value, batchSize.Value, queryTimeout.Value, additionalColumns.Value); } + + CosmosDBMongoDBApiSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBMongoDBApiSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBMongoDBApiSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBMongoDBApiSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBMongoDBApiSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBMongoDBApiSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBMongoDBApiSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.cs index 2429f72f64f8..b1ec6c087da3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBMongoDBApiSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for a CosmosDB (MongoDB API) database. public partial class CosmosDBMongoDBApiSource : CopyActivitySource { - /// Initializes a new instance of CosmosDBMongoDBApiSource. + /// Initializes a new instance of . public CosmosDBMongoDBApiSource() { CopySourceType = "CosmosDbMongoDbApiSource"; } - /// Initializes a new instance of CosmosDBMongoDBApiSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.Serialization.cs index a78310c062d7..1f8833350fcc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBSqlApiCollectionDataset : IUtf8JsonSerializable + public partial class CosmosDBSqlApiCollectionDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBSqlApiCollectionDataset DeserializeCosmosDBSqlApiCollectionDataset(JsonElement element) + internal static CosmosDBSqlApiCollectionDataset DeserializeCosmosDBSqlApiCollectionDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static CosmosDBSqlApiCollectionDataset DeserializeCosmosDBSqlApiCollect additionalProperties = additionalPropertiesDictionary; return new CosmosDBSqlApiCollectionDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, collectionName); } + + CosmosDBSqlApiCollectionDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlApiCollectionDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlApiCollectionDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlApiCollectionDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlApiCollectionDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlApiCollectionDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlApiCollectionDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.cs index 05d273f48fef..c106cba886d1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiCollectionDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Microsoft Azure CosmosDB (SQL API) Collection dataset. public partial class CosmosDBSqlApiCollectionDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of CosmosDBSqlApiCollectionDataset. + /// Initializes a new instance of . /// Linked service reference. /// CosmosDB (SQL API) collection name. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public CosmosDBSqlApiCollectionDataset(DataFactoryLinkedServiceReference linkedS DatasetType = "CosmosDbSqlApiCollection"; } - /// Initializes a new instance of CosmosDBSqlApiCollectionDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal CosmosDBSqlApiCollectionDataset(string datasetType, string description, DatasetType = datasetType ?? "CosmosDbSqlApiCollection"; } + /// Initializes a new instance of for deserialization. + internal CosmosDBSqlApiCollectionDataset() + { + } + /// CosmosDB (SQL API) collection name. Type: string (or Expression with resultType string). public DataFactoryElement CollectionName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.Serialization.cs index 81bc46933f76..379b9a323ec4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBSqlApiSink : IUtf8JsonSerializable + public partial class CosmosDBSqlApiSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBSqlApiSink DeserializeCosmosDBSqlApiSink(JsonElement element) + internal static CosmosDBSqlApiSink DeserializeCosmosDBSqlApiSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static CosmosDBSqlApiSink DeserializeCosmosDBSqlApiSink(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new CosmosDBSqlApiSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior.Value); } + + CosmosDBSqlApiSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlApiSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlApiSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlApiSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlApiSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlApiSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlApiSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.cs index 7102084b76b6..ba6a787c32d0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure CosmosDB (SQL API) Collection sink. public partial class CosmosDBSqlApiSink : CopySink { - /// Initializes a new instance of CosmosDBSqlApiSink. + /// Initializes a new instance of . public CosmosDBSqlApiSink() { CopySinkType = "CosmosDbSqlApiSink"; } - /// Initializes a new instance of CosmosDBSqlApiSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.Serialization.cs index 624314eac647..fd0a4ec57939 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CosmosDBSqlApiSource : IUtf8JsonSerializable + public partial class CosmosDBSqlApiSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -81,8 +87,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CosmosDBSqlApiSource DeserializeCosmosDBSqlApiSource(JsonElement element) + internal static CosmosDBSqlApiSource DeserializeCosmosDBSqlApiSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +200,53 @@ internal static CosmosDBSqlApiSource DeserializeCosmosDBSqlApiSource(JsonElement additionalProperties = additionalPropertiesDictionary; return new CosmosDBSqlApiSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, pageSize.Value, preferredRegions.Value, detectDatetime.Value, additionalColumns.Value); } + + CosmosDBSqlApiSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCosmosDBSqlApiSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CosmosDBSqlApiSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCosmosDBSqlApiSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CosmosDBSqlApiSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CosmosDBSqlApiSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCosmosDBSqlApiSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.cs index f6d60350067d..cf14a0fbc6ea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CosmosDBSqlApiSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure CosmosDB (SQL API) Collection source. public partial class CosmosDBSqlApiSource : CopyActivitySource { - /// Initializes a new instance of CosmosDBSqlApiSource. + /// Initializes a new instance of . public CosmosDBSqlApiSource() { CopySourceType = "CosmosDbSqlApiSource"; } - /// Initializes a new instance of CosmosDBSqlApiSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.Serialization.cs index 738868f2e37b..92395e7621ca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CouchbaseLinkedService : IUtf8JsonSerializable + public partial class CouchbaseLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CouchbaseLinkedService DeserializeCouchbaseLinkedService(JsonElement element) + internal static CouchbaseLinkedService DeserializeCouchbaseLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static CouchbaseLinkedService DeserializeCouchbaseLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new CouchbaseLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, credString, encryptedCredential.Value); } + + CouchbaseLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCouchbaseLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CouchbaseLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCouchbaseLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CouchbaseLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CouchbaseLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCouchbaseLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.cs index 96cb6d8e8c84..70e27c8e48e9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Couchbase server linked service. public partial class CouchbaseLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of CouchbaseLinkedService. + /// Initializes a new instance of . public CouchbaseLinkedService() { LinkedServiceType = "Couchbase"; } - /// Initializes a new instance of CouchbaseLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.Serialization.cs index 2cb886570a56..81892af2c0cb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CouchbaseSource : IUtf8JsonSerializable + public partial class CouchbaseSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CouchbaseSource DeserializeCouchbaseSource(JsonElement element) + internal static CouchbaseSource DeserializeCouchbaseSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static CouchbaseSource DeserializeCouchbaseSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new CouchbaseSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + CouchbaseSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCouchbaseSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CouchbaseSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCouchbaseSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CouchbaseSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CouchbaseSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCouchbaseSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.cs index 589d5fb76c78..f228a3901698 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Couchbase server source. public partial class CouchbaseSource : TabularSource { - /// Initializes a new instance of CouchbaseSource. + /// Initializes a new instance of . public CouchbaseSource() { CopySourceType = "CouchbaseSource"; } - /// Initializes a new instance of CouchbaseSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.Serialization.cs index 867a3009f4ae..cc56eda0c6e3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CouchbaseTableDataset : IUtf8JsonSerializable + public partial class CouchbaseTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CouchbaseTableDataset DeserializeCouchbaseTableDataset(JsonElement element) + internal static CouchbaseTableDataset DeserializeCouchbaseTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static CouchbaseTableDataset DeserializeCouchbaseTableDataset(JsonEleme additionalProperties = additionalPropertiesDictionary; return new CouchbaseTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + CouchbaseTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCouchbaseTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CouchbaseTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCouchbaseTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CouchbaseTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CouchbaseTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCouchbaseTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.cs index a36cf6b230ca..e1a8f81a4cc2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CouchbaseTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Couchbase server dataset. public partial class CouchbaseTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of CouchbaseTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public CouchbaseTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public CouchbaseTableDataset(DataFactoryLinkedServiceReference linkedServiceName DatasetType = "CouchbaseTable"; } - /// Initializes a new instance of CouchbaseTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal CouchbaseTableDataset(string datasetType, string description, DataFacto DatasetType = datasetType ?? "CouchbaseTable"; } + /// Initializes a new instance of for deserialization. + internal CouchbaseTableDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.Serialization.cs index a52edf045b70..3e24bd386021 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CreateLinkedIntegrationRuntimeContent : IUtf8JsonSerializable + public partial class CreateLinkedIntegrationRuntimeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -35,7 +43,115 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dataFactoryLocation"u8); writer.WriteStringValue(DataFactoryLocation.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static CreateLinkedIntegrationRuntimeContent DeserializeCreateLinkedIntegrationRuntimeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional subscriptionId = default; + Optional dataFactoryName = default; + Optional dataFactoryLocation = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataFactoryName"u8)) + { + dataFactoryName = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataFactoryLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataFactoryLocation = new AzureLocation(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CreateLinkedIntegrationRuntimeContent(name.Value, subscriptionId.Value, dataFactoryName.Value, Optional.ToNullable(dataFactoryLocation), serializedAdditionalRawData); + } + + CreateLinkedIntegrationRuntimeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCreateLinkedIntegrationRuntimeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CreateLinkedIntegrationRuntimeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCreateLinkedIntegrationRuntimeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CreateLinkedIntegrationRuntimeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CreateLinkedIntegrationRuntimeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCreateLinkedIntegrationRuntimeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.cs index a67dbdab262f..e3a536d1134b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CreateLinkedIntegrationRuntimeContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -12,11 +14,29 @@ namespace Azure.ResourceManager.DataFactory.Models /// The linked integration runtime information. public partial class CreateLinkedIntegrationRuntimeContent { - /// Initializes a new instance of CreateLinkedIntegrationRuntimeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CreateLinkedIntegrationRuntimeContent() { } + /// Initializes a new instance of . + /// The name of the linked integration runtime. + /// The ID of the subscription that the linked integration runtime belongs to. + /// The name of the data factory that the linked integration runtime belongs to. + /// The location of the data factory that the linked integration runtime belongs to. + /// Keeps track of any properties unknown to the library. + internal CreateLinkedIntegrationRuntimeContent(string name, string subscriptionId, string dataFactoryName, AzureLocation? dataFactoryLocation, Dictionary serializedAdditionalRawData) + { + Name = name; + SubscriptionId = subscriptionId; + DataFactoryName = dataFactoryName; + DataFactoryLocation = dataFactoryLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the linked integration runtime. public string Name { get; set; } /// The ID of the subscription that the linked integration runtime belongs to. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.Serialization.cs index bede938a2569..9f5f536d10ea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CustomActivity : IUtf8JsonSerializable + public partial class CustomActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -84,7 +111,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ReferenceObjects)) { writer.WritePropertyName("referenceObjects"u8); - writer.WriteObjectValue(ReferenceObjects); + if (ReferenceObjects is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ReferenceObjects).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(ExtendedProperties)) { @@ -133,8 +167,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CustomActivity DeserializeCustomActivity(JsonElement element) + internal static CustomActivity DeserializeCustomActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -326,5 +362,53 @@ internal static CustomActivity DeserializeCustomActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new CustomActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, command, resourceLinkedService, folderPath.Value, referenceObjects.Value, Optional.ToDictionary(extendedProperties), retentionTimeInDays.Value, autoUserSpecification.Value); } + + CustomActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.cs index b0d43f885a49..3b6d89572b4c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Custom activity type. public partial class CustomActivity : ExecutionActivity { - /// Initializes a new instance of CustomActivity. + /// Initializes a new instance of . /// Activity name. /// Command for custom activity Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public CustomActivity(string name, DataFactoryElement command) : base(na ActivityType = "Custom"; } - /// Initializes a new instance of CustomActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -59,6 +59,11 @@ internal CustomActivity(string name, string activityType, string description, Pi ActivityType = activityType ?? "Custom"; } + /// Initializes a new instance of for deserialization. + internal CustomActivity() + { + } + /// Command for custom activity Type: string (or Expression with resultType string). public DataFactoryElement Command { get; set; } /// Resource linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.Serialization.cs index edb122b34110..731e022f5cea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CustomActivityReferenceObject : IUtf8JsonSerializable + public partial class CustomActivityReferenceObject : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(LinkedServices)) { @@ -33,21 +40,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Datasets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomActivityReferenceObject DeserializeCustomActivityReferenceObject(JsonElement element) + internal static CustomActivityReferenceObject DeserializeCustomActivityReferenceObject(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> linkedServices = default; Optional> datasets = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("linkedServices"u8)) @@ -78,8 +107,61 @@ internal static CustomActivityReferenceObject DeserializeCustomActivityReference datasets = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new CustomActivityReferenceObject(Optional.ToList(linkedServices), Optional.ToList(datasets), serializedAdditionalRawData); + } + + CustomActivityReferenceObject IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomActivityReferenceObject(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomActivityReferenceObject IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomActivityReferenceObject(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomActivityReferenceObject model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomActivityReferenceObject(Response response) + { + if (response is null) + { + return null; } - return new CustomActivityReferenceObject(Optional.ToList(linkedServices), Optional.ToList(datasets)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomActivityReferenceObject(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.cs index 1560d1eb60d3..e1f746de38f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomActivityReferenceObject.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,20 +15,25 @@ namespace Azure.ResourceManager.DataFactory.Models /// Reference objects for custom activity. public partial class CustomActivityReferenceObject { - /// Initializes a new instance of CustomActivityReferenceObject. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public CustomActivityReferenceObject() { LinkedServices = new ChangeTrackingList(); Datasets = new ChangeTrackingList(); } - /// Initializes a new instance of CustomActivityReferenceObject. + /// Initializes a new instance of . /// Linked service references. /// Dataset references. - internal CustomActivityReferenceObject(IList linkedServices, IList datasets) + /// Keeps track of any properties unknown to the library. + internal CustomActivityReferenceObject(IList linkedServices, IList datasets, Dictionary serializedAdditionalRawData) { LinkedServices = linkedServices; Datasets = datasets; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Linked service references. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.Serialization.cs index c3a493470f0c..1584f9544286 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CustomDataSourceLinkedService : IUtf8JsonSerializable + public partial class CustomDataSourceLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("typeProperties"u8); #if NET6_0_OR_GREATER @@ -28,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -42,7 +55,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -77,8 +97,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CustomDataSourceLinkedService DeserializeCustomDataSourceLinkedService(JsonElement element) + internal static CustomDataSourceLinkedService DeserializeCustomDataSourceLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -157,5 +179,53 @@ internal static CustomDataSourceLinkedService DeserializeCustomDataSourceLinkedS additionalProperties = additionalPropertiesDictionary; return new CustomDataSourceLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, typeProperties); } + + CustomDataSourceLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDataSourceLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDataSourceLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDataSourceLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomDataSourceLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomDataSourceLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomDataSourceLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.cs index d6ae42df165a..9b2dd43e273a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataSourceLinkedService.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Custom linked service. public partial class CustomDataSourceLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of CustomDataSourceLinkedService. + /// Initializes a new instance of . /// Custom linked service properties. /// is null. public CustomDataSourceLinkedService(BinaryData typeProperties) @@ -25,7 +25,7 @@ public CustomDataSourceLinkedService(BinaryData typeProperties) LinkedServiceType = "CustomDataSource"; } - /// Initializes a new instance of CustomDataSourceLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -39,6 +39,11 @@ internal CustomDataSourceLinkedService(string linkedServiceType, IntegrationRunt LinkedServiceType = linkedServiceType ?? "CustomDataSource"; } + /// Initializes a new instance of for deserialization. + internal CustomDataSourceLinkedService() + { + } + /// /// Custom linked service properties. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.Serialization.cs index b6c3128f991d..f98c36e3c040 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CustomDataset : IUtf8JsonSerializable + public partial class CustomDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TypeProperties)) { @@ -52,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -78,7 +91,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -92,8 +112,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CustomDataset DeserializeCustomDataset(JsonElement element) + internal static CustomDataset DeserializeCustomDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static CustomDataset DeserializeCustomDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new CustomDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, typeProperties.Value); } + + CustomDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.cs index e333b2aa9abb..93b316728327 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The custom dataset. public partial class CustomDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of CustomDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public CustomDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public CustomDataset(DataFactoryLinkedServiceReference linkedServiceName) : base DatasetType = "CustomDataset"; } - /// Initializes a new instance of CustomDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal CustomDataset(string datasetType, string description, DataFactoryElemen DatasetType = datasetType ?? "CustomDataset"; } + /// Initializes a new instance of for deserialization. + internal CustomDataset() + { + } + /// /// Custom dataset properties. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.Serialization.cs index 5bdd45ed6a7f..873b48ad1ba8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CustomEventsTrigger : IUtf8JsonSerializable + public partial class CustomEventsTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Pipelines)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pipelines) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,8 +109,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static CustomEventsTrigger DeserializeCustomEventsTrigger(JsonElement element) + internal static CustomEventsTrigger DeserializeCustomEventsTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -218,5 +233,53 @@ internal static CustomEventsTrigger DeserializeCustomEventsTrigger(JsonElement e additionalProperties = additionalPropertiesDictionary; return new CustomEventsTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, Optional.ToList(pipelines), subjectBeginsWith.Value, subjectEndsWith.Value, events, scope); } + + CustomEventsTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEventsTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomEventsTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomEventsTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomEventsTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomEventsTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomEventsTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.cs index bcf4229f65b5..5a814365ed0d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomEventsTrigger.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger that runs every time a custom event is received. public partial class CustomEventsTrigger : MultiplePipelineTrigger { - /// Initializes a new instance of CustomEventsTrigger. + /// Initializes a new instance of . /// The list of event types that cause this trigger to fire. /// The ARM resource ID of the Azure Event Grid Topic. /// or is null. @@ -29,7 +29,7 @@ public CustomEventsTrigger(IEnumerable events, string scope) TriggerType = "CustomEventsTrigger"; } - /// Initializes a new instance of CustomEventsTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. @@ -49,6 +49,11 @@ internal CustomEventsTrigger(string triggerType, string description, DataFactory TriggerType = triggerType ?? "CustomEventsTrigger"; } + /// Initializes a new instance of for deserialization. + internal CustomEventsTrigger() + { + } + /// The event subject must begin with the pattern provided for trigger to fire. At least one of these must be provided: subjectBeginsWith, subjectEndsWith. public string SubjectBeginsWith { get; set; } /// The event subject must end with the pattern provided for trigger to fire. At least one of these must be provided: subjectBeginsWith, subjectEndsWith. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.Serialization.cs index 557f18add29a..6c2865281a41 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class CustomSetupBase : IUtf8JsonSerializable + public partial class CustomSetupBase : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CustomSetupBaseType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static CustomSetupBase DeserializeCustomSetupBase(JsonElement element) + internal static CustomSetupBase DeserializeCustomSetupBase(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,7 +58,72 @@ internal static CustomSetupBase DeserializeCustomSetupBase(JsonElement element) case "EnvironmentVariableSetup": return EnvironmentVariableSetup.DeserializeEnvironmentVariableSetup(element); } } - return UnknownCustomSetupBase.DeserializeUnknownCustomSetupBase(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownCustomSetupBase(type, serializedAdditionalRawData); + } + + CustomSetupBase IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSetupBase(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + CustomSetupBase IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeCustomSetupBase(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(CustomSetupBase model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator CustomSetupBase(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeCustomSetupBase(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.cs index 6fc2d73200a3..4275f2c6e8ca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/CustomSetupBase.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.DataFactory.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// + [DeserializationProxy(typeof(UnknownCustomSetupBase))] public abstract partial class CustomSetupBase { - /// Initializes a new instance of CustomSetupBase. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected CustomSetupBase() { } - /// Initializes a new instance of CustomSetupBase. + /// Initializes a new instance of . /// The type of custom setup. - internal CustomSetupBase(string customSetupBaseType) + /// Keeps track of any properties unknown to the library. + internal CustomSetupBase(string customSetupBaseType, Dictionary serializedAdditionalRawData) { CustomSetupBaseType = customSetupBaseType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of custom setup. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.Serialization.cs index ae34cca7f3cb..80351d0b0d5d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DWCopyCommandDefaultValue : IUtf8JsonSerializable + public partial class DWCopyCommandDefaultValue : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ColumnName)) { @@ -34,17 +41,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(DefaultValue.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DWCopyCommandDefaultValue DeserializeDWCopyCommandDefaultValue(JsonElement element) + internal static DWCopyCommandDefaultValue DeserializeDWCopyCommandDefaultValue(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional columnName = default; Optional defaultValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("columnName"u8)) @@ -65,8 +87,61 @@ internal static DWCopyCommandDefaultValue DeserializeDWCopyCommandDefaultValue(J defaultValue = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DWCopyCommandDefaultValue(columnName.Value, defaultValue.Value); + return new DWCopyCommandDefaultValue(columnName.Value, defaultValue.Value, serializedAdditionalRawData); + } + + DWCopyCommandDefaultValue IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDWCopyCommandDefaultValue(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DWCopyCommandDefaultValue IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDWCopyCommandDefaultValue(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DWCopyCommandDefaultValue model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DWCopyCommandDefaultValue(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDWCopyCommandDefaultValue(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.cs index a41c61e5c356..8f09bc43be98 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandDefaultValue.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Default value. public partial class DWCopyCommandDefaultValue { - /// Initializes a new instance of DWCopyCommandDefaultValue. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DWCopyCommandDefaultValue() { } - /// Initializes a new instance of DWCopyCommandDefaultValue. + /// Initializes a new instance of . /// Column name. Type: object (or Expression with resultType string). /// The default value of the column. Type: object (or Expression with resultType string). - internal DWCopyCommandDefaultValue(BinaryData columnName, BinaryData defaultValue) + /// Keeps track of any properties unknown to the library. + internal DWCopyCommandDefaultValue(BinaryData columnName, BinaryData defaultValue, Dictionary serializedAdditionalRawData) { ColumnName = columnName; DefaultValue = defaultValue; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.Serialization.cs index 2e3d6beb8be0..314140bbc8b5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DWCopyCommandSettings : IUtf8JsonSerializable + public partial class DWCopyCommandSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(DefaultValues)) { @@ -22,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DefaultValues) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -37,17 +51,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DWCopyCommandSettings DeserializeDWCopyCommandSettings(JsonElement element) + internal static DWCopyCommandSettings DeserializeDWCopyCommandSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> defaultValues = default; Optional> additionalOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defaultValues"u8)) @@ -78,8 +107,61 @@ internal static DWCopyCommandSettings DeserializeDWCopyCommandSettings(JsonEleme additionalOptions = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DWCopyCommandSettings(Optional.ToList(defaultValues), Optional.ToDictionary(additionalOptions), serializedAdditionalRawData); + } + + DWCopyCommandSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDWCopyCommandSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DWCopyCommandSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDWCopyCommandSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DWCopyCommandSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DWCopyCommandSettings(Response response) + { + if (response is null) + { + return null; } - return new DWCopyCommandSettings(Optional.ToList(defaultValues), Optional.ToDictionary(additionalOptions)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDWCopyCommandSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.cs index 2b738f633bad..538cc4e03a57 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DWCopyCommandSettings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,25 @@ namespace Azure.ResourceManager.DataFactory.Models /// DW Copy Command settings. public partial class DWCopyCommandSettings { - /// Initializes a new instance of DWCopyCommandSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DWCopyCommandSettings() { DefaultValues = new ChangeTrackingList(); AdditionalOptions = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DWCopyCommandSettings. + /// Initializes a new instance of . /// Specifies the default values for each target column in SQL DW. The default values in the property overwrite the DEFAULT constraint set in the DB, and identity column cannot have a default value. Type: array of objects (or Expression with resultType array of objects). /// Additional options directly passed to SQL DW in Copy Command. Type: key value pairs (value should be string type) (or Expression with resultType object). Example: "additionalOptions": { "MAXERRORS": "1000", "DATEFORMAT": "'ymd'" }. - internal DWCopyCommandSettings(IList defaultValues, IDictionary additionalOptions) + /// Keeps track of any properties unknown to the library. + internal DWCopyCommandSettings(IList defaultValues, IDictionary additionalOptions, Dictionary serializedAdditionalRawData) { DefaultValues = defaultValues; AdditionalOptions = additionalOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Specifies the default values for each target column in SQL DW. The default values in the property overwrite the DEFAULT constraint set in the DB, and identity column cannot have a default value. Type: array of objects (or Expression with resultType array of objects). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.Serialization.cs index af97dfc1a34b..fc4745bb540d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryBlobEventsTrigger : IUtf8JsonSerializable + public partial class DataFactoryBlobEventsTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Pipelines)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pipelines) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -92,8 +105,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryBlobEventsTrigger DeserializeDataFactoryBlobEventsTrigger(JsonElement element) + internal static DataFactoryBlobEventsTrigger DeserializeDataFactoryBlobEventsTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -217,5 +232,53 @@ internal static DataFactoryBlobEventsTrigger DeserializeDataFactoryBlobEventsTri additionalProperties = additionalPropertiesDictionary; return new DataFactoryBlobEventsTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, Optional.ToList(pipelines), blobPathBeginsWith.Value, blobPathEndsWith.Value, Optional.ToNullable(ignoreEmptyBlobs), events, scope); } + + DataFactoryBlobEventsTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryBlobEventsTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryBlobEventsTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryBlobEventsTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryBlobEventsTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryBlobEventsTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryBlobEventsTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.cs index 7e290330e7d8..ee3144847398 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobEventsTrigger.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger that runs every time a Blob event occurs. public partial class DataFactoryBlobEventsTrigger : MultiplePipelineTrigger { - /// Initializes a new instance of DataFactoryBlobEventsTrigger. + /// Initializes a new instance of . /// The type of events that cause this trigger to fire. /// The ARM resource ID of the Storage Account. /// or is null. @@ -29,7 +29,7 @@ public DataFactoryBlobEventsTrigger(IEnumerable events TriggerType = "BlobEventsTrigger"; } - /// Initializes a new instance of DataFactoryBlobEventsTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. @@ -51,6 +51,11 @@ internal DataFactoryBlobEventsTrigger(string triggerType, string description, Da TriggerType = triggerType ?? "BlobEventsTrigger"; } + /// Initializes a new instance of for deserialization. + internal DataFactoryBlobEventsTrigger() + { + } + /// The blob path must begin with the pattern provided for trigger to fire. For example, '/records/blobs/december/' will only fire the trigger for blobs in the december folder under the records container. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith. public string BlobPathBeginsWith { get; set; } /// The blob path must end with the pattern provided for trigger to fire. For example, 'december/boxes.csv' will only fire the trigger for blobs named boxes in a december folder. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.Serialization.cs index ad98b3398e17..f3f7a8c74226 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryBlobSink : IUtf8JsonSerializable + public partial class DataFactoryBlobSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BlobWriterOverwriteFiles)) { @@ -48,7 +54,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Metadata) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,8 +109,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryBlobSink DeserializeDataFactoryBlobSink(JsonElement element) + internal static DataFactoryBlobSink DeserializeDataFactoryBlobSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -232,5 +247,53 @@ internal static DataFactoryBlobSink DeserializeDataFactoryBlobSink(JsonElement e additionalProperties = additionalPropertiesDictionary; return new DataFactoryBlobSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, blobWriterOverwriteFiles.Value, blobWriterDateTimeFormat.Value, blobWriterAddHeader.Value, copyBehavior.Value, Optional.ToList(metadata)); } + + DataFactoryBlobSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryBlobSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryBlobSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryBlobSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryBlobSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryBlobSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryBlobSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.cs index 69e9e0da5731..2bd0bfd04c8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSink.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Blob sink. public partial class DataFactoryBlobSink : CopySink { - /// Initializes a new instance of DataFactoryBlobSink. + /// Initializes a new instance of . public DataFactoryBlobSink() { Metadata = new ChangeTrackingList(); CopySinkType = "BlobSink"; } - /// Initializes a new instance of DataFactoryBlobSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.Serialization.cs index 3ae3f05dea61..b33578a0ae58 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryBlobSource : IUtf8JsonSerializable + public partial class DataFactoryBlobSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TreatEmptyAsNull)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryBlobSource DeserializeDataFactoryBlobSource(JsonElement element) + internal static DataFactoryBlobSource DeserializeDataFactoryBlobSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static DataFactoryBlobSource DeserializeDataFactoryBlobSource(JsonEleme additionalProperties = additionalPropertiesDictionary; return new DataFactoryBlobSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, treatEmptyAsNull.Value, skipHeaderLineCount.Value, recursive.Value); } + + DataFactoryBlobSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryBlobSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryBlobSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryBlobSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryBlobSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryBlobSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryBlobSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.cs index 4463d6a4c0d2..95c720558e21 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Azure Blob source. public partial class DataFactoryBlobSource : CopyActivitySource { - /// Initializes a new instance of DataFactoryBlobSource. + /// Initializes a new instance of . public DataFactoryBlobSource() { CopySourceType = "BlobSource"; } - /// Initializes a new instance of DataFactoryBlobSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.Serialization.cs index 8b1422a84cd8..ddbca1d42e1a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryBlobTrigger : IUtf8JsonSerializable + public partial class DataFactoryBlobTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Pipelines)) { @@ -24,7 +30,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pipelines) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -74,8 +87,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryBlobTrigger DeserializeDataFactoryBlobTrigger(JsonElement element) + internal static DataFactoryBlobTrigger DeserializeDataFactoryBlobTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -178,5 +193,53 @@ internal static DataFactoryBlobTrigger DeserializeDataFactoryBlobTrigger(JsonEle additionalProperties = additionalPropertiesDictionary; return new DataFactoryBlobTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, Optional.ToList(pipelines), folderPath, maxConcurrency, linkedService); } + + DataFactoryBlobTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryBlobTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryBlobTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryBlobTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryBlobTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryBlobTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryBlobTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.cs index 919b2d48672b..5aded93657db 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryBlobTrigger.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger that runs every time the selected Blob container changes. public partial class DataFactoryBlobTrigger : MultiplePipelineTrigger { - /// Initializes a new instance of DataFactoryBlobTrigger. + /// Initializes a new instance of . /// The path of the container/folder that will trigger the pipeline. /// The max number of parallel files to handle when it is triggered. /// The Azure Storage linked service reference. @@ -31,7 +31,7 @@ public DataFactoryBlobTrigger(string folderPath, int maxConcurrency, DataFactory TriggerType = "BlobTrigger"; } - /// Initializes a new instance of DataFactoryBlobTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. @@ -49,6 +49,11 @@ internal DataFactoryBlobTrigger(string triggerType, string description, DataFact TriggerType = triggerType ?? "BlobTrigger"; } + /// Initializes a new instance of for deserialization. + internal DataFactoryBlobTrigger() + { + } + /// The path of the container/folder that will trigger the pipeline. public string FolderPath { get; set; } /// The max number of parallel files to handle when it is triggered. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryChangeDataCaptureData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryChangeDataCaptureData.Serialization.cs index c36affa23cb6..7fbcc02419d8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryChangeDataCaptureData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryChangeDataCaptureData.Serialization.cs @@ -10,22 +10,34 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryChangeDataCaptureData : IUtf8JsonSerializable + public partial class DataFactoryChangeDataCaptureData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -36,18 +48,39 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SourceConnectionsInfo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("targetConnectionsInfo"u8); writer.WriteStartArray(); foreach (var item in TargetConnectionsInfo) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } if (Optional.IsDefined(AllowVnetOverride)) { writer.WritePropertyName("allowVNetOverride"u8); @@ -71,8 +104,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryChangeDataCaptureData DeserializeDataFactoryChangeDataCaptureData(JsonElement element) + internal static DataFactoryChangeDataCaptureData DeserializeDataFactoryChangeDataCaptureData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -196,5 +231,53 @@ internal static DataFactoryChangeDataCaptureData DeserializeDataFactoryChangeDat additionalProperties = additionalPropertiesDictionary; return new DataFactoryChangeDataCaptureData(id, name, type, systemData.Value, folder.Value, description.Value, sourceConnectionsInfo, targetConnectionsInfo, policy, Optional.ToNullable(allowVnetOverride), status.Value, Optional.ToNullable(etag), additionalProperties); } + + DataFactoryChangeDataCaptureData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryChangeDataCaptureData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryChangeDataCaptureData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryChangeDataCaptureData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryChangeDataCaptureData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryChangeDataCaptureData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryChangeDataCaptureData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.Serialization.cs index e88caccff552..59e803c3a542 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryCmkIdentity : IUtf8JsonSerializable + internal partial class DataFactoryCmkIdentity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(UserAssignedIdentity)) { writer.WritePropertyName("userAssignedIdentity"u8); writer.WriteStringValue(UserAssignedIdentity); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryCmkIdentity DeserializeDataFactoryCmkIdentity(JsonElement element) + internal static DataFactoryCmkIdentity DeserializeDataFactoryCmkIdentity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional userAssignedIdentity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userAssignedIdentity"u8)) @@ -37,8 +60,61 @@ internal static DataFactoryCmkIdentity DeserializeDataFactoryCmkIdentity(JsonEle userAssignedIdentity = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryCmkIdentity(userAssignedIdentity.Value, serializedAdditionalRawData); + } + + DataFactoryCmkIdentity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryCmkIdentity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryCmkIdentity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryCmkIdentity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryCmkIdentity model) + { + if (model is null) + { + return null; } - return new DataFactoryCmkIdentity(userAssignedIdentity.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryCmkIdentity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryCmkIdentity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.cs index 6bc38f91446f..820efb698eae 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCmkIdentity.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Managed Identity used for CMK. internal partial class DataFactoryCmkIdentity { - /// Initializes a new instance of DataFactoryCmkIdentity. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryCmkIdentity() { } - /// Initializes a new instance of DataFactoryCmkIdentity. + /// Initializes a new instance of . /// The resource id of the user assigned identity to authenticate to customer's key vault. - internal DataFactoryCmkIdentity(string userAssignedIdentity) + /// Keeps track of any properties unknown to the library. + internal DataFactoryCmkIdentity(string userAssignedIdentity, Dictionary serializedAdditionalRawData) { UserAssignedIdentity = userAssignedIdentity; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource id of the user assigned identity to authenticate to customer's key vault. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.Serialization.cs index bace6a19570a..0b1ae9aac169 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryCredential : IUtf8JsonSerializable + public partial class DataFactoryCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CredentialType); @@ -53,8 +61,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryCredential DeserializeDataFactoryCredential(JsonElement element) + internal static DataFactoryCredential DeserializeDataFactoryCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,7 +77,98 @@ internal static DataFactoryCredential DeserializeDataFactoryCredential(JsonEleme case "ManagedIdentity": return DataFactoryManagedIdentityCredentialProperties.DeserializeDataFactoryManagedIdentityCredentialProperties(element); } } - return UnknownCredential.DeserializeUnknownCredential(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional description = default; + Optional> annotations = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + annotations = array; + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownCredential(type, description.Value, Optional.ToList(annotations), additionalProperties); + } + + DataFactoryCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryCredential model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.cs index d9a7ae171569..47a2fe3c36b4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredential.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DataFactoryCredential { - /// Initializes a new instance of DataFactoryCredential. + /// Initializes a new instance of . public DataFactoryCredential() { Annotations = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryCredential. + /// Initializes a new instance of . /// Type of credential. /// Credential description. /// List of tags that can be used for describing the Credential. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.Serialization.cs index c5dd0f7ff307..278dbea1e46a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryCredentialListResult + internal partial class DataFactoryCredentialListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryCredentialListResult DeserializeDataFactoryCredentialListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryCredentialListResult DeserializeDataFactoryCredentialListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryCredentialListResult DeserializeDataFactoryCredential nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryCredentialListResult(value, nextLink.Value); + return new DataFactoryCredentialListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryCredentialListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryCredentialListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryCredentialListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryCredentialListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryCredentialListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryCredentialListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryCredentialListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.cs index 2594df4c7b3d..736eefd5c845 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of credential resources. internal partial class DataFactoryCredentialListResult { - /// Initializes a new instance of DataFactoryCredentialListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of credentials. /// is null. internal DataFactoryCredentialListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryCredentialListResult(IEnumerable Initializes a new instance of DataFactoryCredentialListResult. + /// Initializes a new instance of . /// List of credentials. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryCredentialListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryCredentialListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryCredentialListResult() + { } /// List of credentials. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.Serialization.cs index 04fe709d2879..5397bf353e49 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryCredentialReference : IUtf8JsonSerializable + public partial class DataFactoryCredentialReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); @@ -33,8 +39,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryCredentialReference DeserializeDataFactoryCredentialReference(JsonElement element) + internal static DataFactoryCredentialReference DeserializeDataFactoryCredentialReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,5 +68,53 @@ internal static DataFactoryCredentialReference DeserializeDataFactoryCredentialR additionalProperties = additionalPropertiesDictionary; return new DataFactoryCredentialReference(type, referenceName, additionalProperties); } + + DataFactoryCredentialReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryCredentialReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryCredentialReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryCredentialReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryCredentialReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryCredentialReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryCredentialReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.cs index 178c4a7e3d30..374a8999e040 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryCredentialReference.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Credential reference type. public partial class DataFactoryCredentialReference { - /// Initializes a new instance of DataFactoryCredentialReference. + /// Initializes a new instance of . /// Credential reference type. /// Reference credential name. /// is null. @@ -27,7 +27,7 @@ public DataFactoryCredentialReference(DataFactoryCredentialReferenceType referen AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryCredentialReference. + /// Initializes a new instance of . /// Credential reference type. /// Reference credential name. /// Additional Properties. @@ -38,6 +38,11 @@ internal DataFactoryCredentialReference(DataFactoryCredentialReferenceType refer AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal DataFactoryCredentialReference() + { + } + /// Credential reference type. public DataFactoryCredentialReferenceType ReferenceType { get; set; } /// Reference credential name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryData.Serialization.cs index 2cc3a4f726dd..a7f2877a5682 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryData : IUtf8JsonSerializable + public partial class DataFactoryData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Identity)) { @@ -44,12 +49,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PurviewConfiguration)) { writer.WritePropertyName("purviewConfiguration"u8); - writer.WriteObjectValue(PurviewConfiguration); + if (PurviewConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PurviewConfiguration).Serialize(writer, options); + } } if (Optional.IsDefined(RepoConfiguration)) { writer.WritePropertyName("repoConfiguration"u8); - writer.WriteObjectValue(RepoConfiguration); + if (RepoConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RepoConfiguration).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(GlobalParameters)) { @@ -58,14 +77,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in GlobalParameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } if (Optional.IsDefined(Encryption)) { writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption); + if (Encryption is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Encryption).Serialize(writer, options); + } } if (Optional.IsDefined(PublicNetworkAccess)) { @@ -85,8 +118,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryData DeserializeDataFactoryData(JsonElement element) + internal static DataFactoryData DeserializeDataFactoryData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -259,5 +294,53 @@ internal static DataFactoryData DeserializeDataFactoryData(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new DataFactoryData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, provisioningState.Value, Optional.ToNullable(createTime), version.Value, purviewConfiguration.Value, repoConfiguration.Value, Optional.ToDictionary(globalParameters), encryption.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(eTag), additionalProperties); } + + DataFactoryData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.Serialization.cs index def307287596..4da0c5032cd2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.Serialization.cs @@ -6,21 +6,59 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowCreateDebugSessionResult + public partial class DataFactoryDataFlowCreateDebugSessionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryDataFlowCreateDebugSessionResult DeserializeDataFactoryDataFlowCreateDebugSessionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(SessionId)) + { + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryDataFlowCreateDebugSessionResult DeserializeDataFactoryDataFlowCreateDebugSessionResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional sessionId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -37,8 +75,61 @@ internal static DataFactoryDataFlowCreateDebugSessionResult DeserializeDataFacto sessionId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryDataFlowCreateDebugSessionResult(status.Value, Optional.ToNullable(sessionId)); + return new DataFactoryDataFlowCreateDebugSessionResult(status.Value, Optional.ToNullable(sessionId), serializedAdditionalRawData); + } + + DataFactoryDataFlowCreateDebugSessionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowCreateDebugSessionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowCreateDebugSessionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowCreateDebugSessionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowCreateDebugSessionResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowCreateDebugSessionResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowCreateDebugSessionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.cs index e5a3af586ebd..1efa13a4e384 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowCreateDebugSessionResult.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Response body structure for creating data flow debug session. public partial class DataFactoryDataFlowCreateDebugSessionResult { - /// Initializes a new instance of DataFactoryDataFlowCreateDebugSessionResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFactoryDataFlowCreateDebugSessionResult() { } - /// Initializes a new instance of DataFactoryDataFlowCreateDebugSessionResult. + /// Initializes a new instance of . /// The state of the debug session. /// The ID of data flow debug session. - internal DataFactoryDataFlowCreateDebugSessionResult(string status, Guid? sessionId) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowCreateDebugSessionResult(string status, Guid? sessionId, Dictionary serializedAdditionalRawData) { Status = status; SessionId = sessionId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the debug session. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowData.Serialization.cs index 3547b44ea31f..c3625a544f95 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryDataFlowData : IUtf8JsonSerializable + public partial class DataFactoryDataFlowData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryDataFlowData DeserializeDataFactoryDataFlowData(JsonElement element) + internal static DataFactoryDataFlowData DeserializeDataFactoryDataFlowData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryDataFlowData DeserializeDataFactoryDataFlowData(JsonE string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryDataFlowData DeserializeDataFactoryDataFlowData(JsonE systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDataFlowData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryDataFlowData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryDataFlowData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.Serialization.cs index 4f036b4c7355..5063828bdc38 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowDebugCommandResult + public partial class DataFactoryDataFlowDebugCommandResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryDataFlowDebugCommandResult DeserializeDataFactoryDataFlowDebugCommandResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(Data)) + { + writer.WritePropertyName("data"u8); + writer.WriteStringValue(Data); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryDataFlowDebugCommandResult DeserializeDataFactoryDataFlowDebugCommandResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional status = default; Optional data = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -32,8 +71,61 @@ internal static DataFactoryDataFlowDebugCommandResult DeserializeDataFactoryData data = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryDataFlowDebugCommandResult(status.Value, data.Value); + return new DataFactoryDataFlowDebugCommandResult(status.Value, data.Value, serializedAdditionalRawData); + } + + DataFactoryDataFlowDebugCommandResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowDebugCommandResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowDebugCommandResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowDebugCommandResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowDebugCommandResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowDebugCommandResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowDebugCommandResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.cs index b77dc45cb9e4..91cb95423298 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugCommandResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Response body structure of data flow result for data preview, statistics or expression preview. public partial class DataFactoryDataFlowDebugCommandResult { - /// Initializes a new instance of DataFactoryDataFlowDebugCommandResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFactoryDataFlowDebugCommandResult() { } - /// Initializes a new instance of DataFactoryDataFlowDebugCommandResult. + /// Initializes a new instance of . /// The run status of data preview, statistics or expression preview. /// The result data of data preview, statistics or expression preview. - internal DataFactoryDataFlowDebugCommandResult(string status, string data) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowDebugCommandResult(string status, string data, Dictionary serializedAdditionalRawData) { Status = status; Data = data; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The run status of data preview, statistics or expression preview. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.Serialization.cs index 1f37cb281c90..9c358a10c3b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.Serialization.cs @@ -5,24 +5,131 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowDebugInfo : IUtf8JsonSerializable + public partial class DataFactoryDataFlowDebugInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryDataFlowDebugInfo DeserializeDataFactoryDataFlowDebugInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataFactoryDataFlowProperties properties = default; + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataFactoryDataFlowProperties.DeserializeDataFactoryDataFlowProperties(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDataFlowDebugInfo(name.Value, properties, serializedAdditionalRawData); + } + + DataFactoryDataFlowDebugInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowDebugInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowDebugInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowDebugInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowDebugInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowDebugInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowDebugInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.cs index 0004856b4d11..53ea670aabf3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data flow debug resource. public partial class DataFactoryDataFlowDebugInfo : DataFactoryDebugInfo { - /// Initializes a new instance of DataFactoryDataFlowDebugInfo. + /// Initializes a new instance of . /// /// Data flow properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,6 +28,24 @@ public DataFactoryDataFlowDebugInfo(DataFactoryDataFlowProperties properties) Properties = properties; } + /// Initializes a new instance of . + /// The resource name. + /// + /// Data flow properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowDebugInfo(string name, DataFactoryDataFlowProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) + { + Properties = properties; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryDataFlowDebugInfo() + { + } + /// /// Data flow properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.Serialization.cs index 837a28398675..0c17ee27d407 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowDebugPackageContent : IUtf8JsonSerializable + public partial class DataFactoryDataFlowDebugPackageContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SessionId)) { @@ -23,7 +31,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DataFlow)) { writer.WritePropertyName("dataFlow"u8); - writer.WriteObjectValue(DataFlow); + if (DataFlow is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataFlow).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataFlows)) { @@ -31,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataFlows) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -41,7 +63,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Datasets) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -51,19 +80,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LinkedServices) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Staging)) { writer.WritePropertyName("staging"u8); - writer.WriteObjectValue(Staging); + if (Staging is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Staging).Serialize(writer, options); + } } if (Optional.IsDefined(DebugSettings)) { writer.WritePropertyName("debugSettings"u8); - writer.WriteObjectValue(DebugSettings); + if (DebugSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DebugSettings).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -76,5 +126,156 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + internal static DataFactoryDataFlowDebugPackageContent DeserializeDataFactoryDataFlowDebugPackageContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sessionId = default; + Optional dataFlow = default; + Optional> dataFlows = default; + Optional> datasets = default; + Optional> linkedServices = default; + Optional staging = default; + Optional debugSettings = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sessionId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("dataFlow"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataFlow = DataFactoryDataFlowDebugInfo.DeserializeDataFactoryDataFlowDebugInfo(property.Value); + continue; + } + if (property.NameEquals("dataFlows"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataFactoryDataFlowDebugInfo.DeserializeDataFactoryDataFlowDebugInfo(item)); + } + dataFlows = array; + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataFactoryDatasetDebugInfo.DeserializeDataFactoryDatasetDebugInfo(item)); + } + datasets = array; + continue; + } + if (property.NameEquals("linkedServices"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataFactoryLinkedServiceDebugInfo.DeserializeDataFactoryLinkedServiceDebugInfo(item)); + } + linkedServices = array; + continue; + } + if (property.NameEquals("staging"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + staging = DataFlowStagingInfo.DeserializeDataFlowStagingInfo(property.Value); + continue; + } + if (property.NameEquals("debugSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + debugSettings = DataFlowDebugPackageDebugSettings.DeserializeDataFlowDebugPackageDebugSettings(property.Value); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new DataFactoryDataFlowDebugPackageContent(Optional.ToNullable(sessionId), dataFlow.Value, Optional.ToList(dataFlows), Optional.ToList(datasets), Optional.ToList(linkedServices), staging.Value, debugSettings.Value, additionalProperties); + } + + DataFactoryDataFlowDebugPackageContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowDebugPackageContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowDebugPackageContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowDebugPackageContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowDebugPackageContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowDebugPackageContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowDebugPackageContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.cs index f6472554e6f6..f6ddedde2c99 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugPackageContent.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Request body structure for starting data flow debug session. public partial class DataFactoryDataFlowDebugPackageContent { - /// Initializes a new instance of DataFactoryDataFlowDebugPackageContent. + /// Initializes a new instance of . public DataFactoryDataFlowDebugPackageContent() { DataFlows = new ChangeTrackingList(); @@ -23,6 +23,27 @@ public DataFactoryDataFlowDebugPackageContent() AdditionalProperties = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The ID of data flow debug session. + /// Data flow instance. + /// List of Data flows. + /// List of datasets. + /// List of linked services. + /// Staging info for debug session. + /// Data flow debug settings. + /// Additional Properties. + internal DataFactoryDataFlowDebugPackageContent(Guid? sessionId, DataFactoryDataFlowDebugInfo dataFlow, IList dataFlows, IList datasets, IList linkedServices, DataFlowStagingInfo staging, DataFlowDebugPackageDebugSettings debugSettings, IDictionary additionalProperties) + { + SessionId = sessionId; + DataFlow = dataFlow; + DataFlows = dataFlows; + Datasets = datasets; + LinkedServices = linkedServices; + Staging = staging; + DebugSettings = debugSettings; + AdditionalProperties = additionalProperties; + } + /// The ID of data flow debug session. public Guid? SessionId { get; set; } /// Data flow instance. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.Serialization.cs index 0fe53bdfeccd..6d9cb3da15a9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowDebugSessionContent : IUtf8JsonSerializable + public partial class DataFactoryDataFlowDebugSessionContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ComputeType)) { @@ -33,9 +41,132 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(IntegrationRuntime)) { writer.WritePropertyName("integrationRuntime"u8); - writer.WriteObjectValue(IntegrationRuntime); + if (IntegrationRuntime is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IntegrationRuntime).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static DataFactoryDataFlowDebugSessionContent DeserializeDataFactoryDataFlowDebugSessionContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional computeType = default; + Optional coreCount = default; + Optional timeToLive = default; + Optional integrationRuntime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("computeType"u8)) + { + computeType = property.Value.GetString(); + continue; + } + if (property.NameEquals("coreCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coreCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("timeToLive"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeToLive = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("integrationRuntime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + integrationRuntime = DataFactoryIntegrationRuntimeDebugInfo.DeserializeDataFactoryIntegrationRuntimeDebugInfo(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDataFlowDebugSessionContent(computeType.Value, Optional.ToNullable(coreCount), Optional.ToNullable(timeToLive), integrationRuntime.Value, serializedAdditionalRawData); + } + + DataFactoryDataFlowDebugSessionContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowDebugSessionContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowDebugSessionContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowDebugSessionContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowDebugSessionContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowDebugSessionContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowDebugSessionContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.cs index 89c1ffdb599e..5694ef322410 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowDebugSessionContent.cs @@ -5,16 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Request body structure for creating data flow debug session. public partial class DataFactoryDataFlowDebugSessionContent { - /// Initializes a new instance of DataFactoryDataFlowDebugSessionContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryDataFlowDebugSessionContent() { } + /// Initializes a new instance of . + /// Compute type of the cluster. The value will be overwritten by the same setting in integration runtime if provided. + /// Core count of the cluster. The value will be overwritten by the same setting in integration runtime if provided. + /// Time to live setting of the cluster in minutes. + /// Set to use integration runtime setting for data flow debug session. + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowDebugSessionContent(string computeType, int? coreCount, int? timeToLiveInMinutes, DataFactoryIntegrationRuntimeDebugInfo integrationRuntime, Dictionary serializedAdditionalRawData) + { + ComputeType = computeType; + CoreCount = coreCount; + TimeToLiveInMinutes = timeToLiveInMinutes; + IntegrationRuntime = integrationRuntime; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Compute type of the cluster. The value will be overwritten by the same setting in integration runtime if provided. public string ComputeType { get; set; } /// Core count of the cluster. The value will be overwritten by the same setting in integration runtime if provided. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.Serialization.cs index 0945777e2a0d..bb09192136a5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryDataFlowListResult + internal partial class DataFactoryDataFlowListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryDataFlowListResult DeserializeDataFactoryDataFlowListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryDataFlowListResult DeserializeDataFactoryDataFlowListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryDataFlowListResult DeserializeDataFactoryDataFlowList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryDataFlowListResult(value, nextLink.Value); + return new DataFactoryDataFlowListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryDataFlowListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.cs index 4dc63d39fe03..422a15deaf53 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of data flow resources. internal partial class DataFactoryDataFlowListResult { - /// Initializes a new instance of DataFactoryDataFlowListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of data flows. /// is null. internal DataFactoryDataFlowListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryDataFlowListResult(IEnumerable valu Value = value.ToList(); } - /// Initializes a new instance of DataFactoryDataFlowListResult. + /// Initializes a new instance of . /// List of data flows. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryDataFlowListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryDataFlowListResult() + { } /// List of data flows. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.Serialization.cs index 3e2a1354fb08..05016a3ba87c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowProperties : IUtf8JsonSerializable + public partial class DataFactoryDataFlowProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DataFlowType); @@ -44,13 +52,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryDataFlowProperties DeserializeDataFactoryDataFlowProperties(JsonElement element) + internal static DataFactoryDataFlowProperties DeserializeDataFactoryDataFlowProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,7 +93,110 @@ internal static DataFactoryDataFlowProperties DeserializeDataFactoryDataFlowProp case "WranglingDataFlow": return DataFactoryWranglingDataFlowProperties.DeserializeDataFactoryWranglingDataFlowProperties(element); } } - return UnknownDataFlow.DeserializeUnknownDataFlow(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional description = default; + Optional> annotations = default; + Optional folder = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + annotations = array; + continue; + } + if (property.NameEquals("folder"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDataFlow(type, description.Value, Optional.ToList(annotations), folder.Value, serializedAdditionalRawData); + } + + DataFactoryDataFlowProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.cs index 8700c2c4e8cb..c4b59f26e3dc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowProperties.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { @@ -16,25 +17,31 @@ namespace Azure.ResourceManager.DataFactory.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownDataFlow))] public abstract partial class DataFactoryDataFlowProperties { - /// Initializes a new instance of DataFactoryDataFlowProperties. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DataFactoryDataFlowProperties() { Annotations = new ChangeTrackingList(); } - /// Initializes a new instance of DataFactoryDataFlowProperties. + /// Initializes a new instance of . /// Type of data flow. /// The description of the data flow. /// List of tags that can be used for describing the data flow. /// The folder that this data flow is in. If not specified, Data flow will appear at the root level. - internal DataFactoryDataFlowProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, Dictionary serializedAdditionalRawData) { DataFlowType = dataFlowType; Description = description; Annotations = annotations; Folder = folder; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of data flow. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.Serialization.cs index ff8d016f31e4..8f9b9383728d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataFlowStartDebugSessionResult + public partial class DataFactoryDataFlowStartDebugSessionResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryDataFlowStartDebugSessionResult DeserializeDataFactoryDataFlowStartDebugSessionResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(JobVersion)) + { + writer.WritePropertyName("jobVersion"u8); + writer.WriteStringValue(JobVersion); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryDataFlowStartDebugSessionResult DeserializeDataFactoryDataFlowStartDebugSessionResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional jobVersion = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobVersion"u8)) @@ -26,8 +60,61 @@ internal static DataFactoryDataFlowStartDebugSessionResult DeserializeDataFactor jobVersion = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryDataFlowStartDebugSessionResult(jobVersion.Value); + return new DataFactoryDataFlowStartDebugSessionResult(jobVersion.Value, serializedAdditionalRawData); + } + + DataFactoryDataFlowStartDebugSessionResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataFlowStartDebugSessionResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataFlowStartDebugSessionResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataFlowStartDebugSessionResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataFlowStartDebugSessionResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataFlowStartDebugSessionResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataFlowStartDebugSessionResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.cs index b196996fdf0b..f62336d5fea7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataFlowStartDebugSessionResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Response body structure for starting data flow debug session. public partial class DataFactoryDataFlowStartDebugSessionResult { - /// Initializes a new instance of DataFactoryDataFlowStartDebugSessionResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFactoryDataFlowStartDebugSessionResult() { } - /// Initializes a new instance of DataFactoryDataFlowStartDebugSessionResult. + /// Initializes a new instance of . /// The ID of data flow debug job version. - internal DataFactoryDataFlowStartDebugSessionResult(string jobVersion) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataFlowStartDebugSessionResult(string jobVersion, Dictionary serializedAdditionalRawData) { JobVersion = jobVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ID of data flow debug job version. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.Serialization.cs index 9239d9f94ab9..cdf4ed545d8c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.Serialization.cs @@ -6,15 +6,64 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataPlaneAccessPolicyResult + public partial class DataFactoryDataPlaneAccessPolicyResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryDataPlaneAccessPolicyResult DeserializeDataFactoryDataPlaneAccessPolicyResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Policy)) + { + writer.WritePropertyName("policy"u8); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } + } + if (Optional.IsDefined(AccessToken)) + { + writer.WritePropertyName("accessToken"u8); + writer.WriteStringValue(AccessToken); + } + if (Optional.IsDefined(DataPlaneUri)) + { + writer.WritePropertyName("dataPlaneUrl"u8); + writer.WriteStringValue(DataPlaneUri.AbsoluteUri); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryDataPlaneAccessPolicyResult DeserializeDataFactoryDataPlaneAccessPolicyResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -22,6 +71,7 @@ internal static DataFactoryDataPlaneAccessPolicyResult DeserializeDataFactoryDat Optional policy = default; Optional accessToken = default; Optional dataPlaneUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("policy"u8)) @@ -47,8 +97,61 @@ internal static DataFactoryDataPlaneAccessPolicyResult DeserializeDataFactoryDat dataPlaneUrl = new Uri(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryDataPlaneAccessPolicyResult(policy.Value, accessToken.Value, dataPlaneUrl.Value); + return new DataFactoryDataPlaneAccessPolicyResult(policy.Value, accessToken.Value, dataPlaneUrl.Value, serializedAdditionalRawData); + } + + DataFactoryDataPlaneAccessPolicyResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataPlaneAccessPolicyResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataPlaneAccessPolicyResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataPlaneAccessPolicyResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataPlaneAccessPolicyResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataPlaneAccessPolicyResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataPlaneAccessPolicyResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.cs index 800a99bea878..3340d890f905 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneAccessPolicyResult.cs @@ -6,26 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Get Data Plane read only token response definition. public partial class DataFactoryDataPlaneAccessPolicyResult { - /// Initializes a new instance of DataFactoryDataPlaneAccessPolicyResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFactoryDataPlaneAccessPolicyResult() { } - /// Initializes a new instance of DataFactoryDataPlaneAccessPolicyResult. + /// Initializes a new instance of . /// The user access policy. /// Data Plane read only access token. /// Data Plane service base URL. - internal DataFactoryDataPlaneAccessPolicyResult(DataFactoryDataPlaneUserAccessPolicy policy, string accessToken, Uri dataPlaneUri) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataPlaneAccessPolicyResult(DataFactoryDataPlaneUserAccessPolicy policy, string accessToken, Uri dataPlaneUri, Dictionary serializedAdditionalRawData) { Policy = policy; AccessToken = accessToken; DataPlaneUri = dataPlaneUri; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The user access policy. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.Serialization.cs index dd873d1b68be..4c2a0fe552c7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDataPlaneUserAccessPolicy : IUtf8JsonSerializable + public partial class DataFactoryDataPlaneUserAccessPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Permissions)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expireTime"u8); writer.WriteStringValue(ExpireOn.Value, "O"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryDataPlaneUserAccessPolicy DeserializeDataFactoryDataPlaneUserAccessPolicy(JsonElement element) + internal static DataFactoryDataPlaneUserAccessPolicy DeserializeDataFactoryDataPlaneUserAccessPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +76,7 @@ internal static DataFactoryDataPlaneUserAccessPolicy DeserializeDataFactoryDataP Optional profileName = default; Optional startTime = default; Optional expireTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("permissions"u8)) @@ -90,8 +112,61 @@ internal static DataFactoryDataPlaneUserAccessPolicy DeserializeDataFactoryDataP expireTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDataPlaneUserAccessPolicy(permissions.Value, accessResourcePath.Value, profileName.Value, Optional.ToNullable(startTime), Optional.ToNullable(expireTime), serializedAdditionalRawData); + } + + DataFactoryDataPlaneUserAccessPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDataPlaneUserAccessPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDataPlaneUserAccessPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDataPlaneUserAccessPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDataPlaneUserAccessPolicy model) + { + if (model is null) + { + return null; } - return new DataFactoryDataPlaneUserAccessPolicy(permissions.Value, accessResourcePath.Value, profileName.Value, Optional.ToNullable(startTime), Optional.ToNullable(expireTime)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDataPlaneUserAccessPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDataPlaneUserAccessPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.cs index 1268ef7cf4c3..ea4c54cb87d3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDataPlaneUserAccessPolicy.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Get Data Plane read only token request definition. public partial class DataFactoryDataPlaneUserAccessPolicy { - /// Initializes a new instance of DataFactoryDataPlaneUserAccessPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryDataPlaneUserAccessPolicy() { } - /// Initializes a new instance of DataFactoryDataPlaneUserAccessPolicy. + /// Initializes a new instance of . /// The string with permissions for Data Plane access. Currently only 'r' is supported which grants read only access. /// The resource path to get access relative to factory. Currently only empty string is supported which corresponds to the factory resource. /// The name of the profile. Currently only the default is supported. The default value is DefaultProfile. /// Start time for the token. If not specified the current time will be used. /// Expiration time for the token. Maximum duration for the token is eight hours and by default the token will expire in eight hours. - internal DataFactoryDataPlaneUserAccessPolicy(string permissions, string accessResourcePath, string profileName, DateTimeOffset? startOn, DateTimeOffset? expireOn) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDataPlaneUserAccessPolicy(string permissions, string accessResourcePath, string profileName, DateTimeOffset? startOn, DateTimeOffset? expireOn, Dictionary serializedAdditionalRawData) { Permissions = permissions; AccessResourcePath = accessResourcePath; ProfileName = profileName; StartOn = startOn; ExpireOn = expireOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The string with permissions for Data Plane access. Currently only 'r' is supported which grants read only access. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetData.Serialization.cs index f49c1dde3afa..fb14ae8f576b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryDatasetData : IUtf8JsonSerializable + public partial class DataFactoryDatasetData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryDatasetData DeserializeDataFactoryDatasetData(JsonElement element) + internal static DataFactoryDatasetData DeserializeDataFactoryDatasetData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryDatasetData DeserializeDataFactoryDatasetData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryDatasetData DeserializeDataFactoryDatasetData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDatasetData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryDatasetData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDatasetData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDatasetData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDatasetData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDatasetData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDatasetData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryDatasetData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDatasetData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.Serialization.cs index 6e2b40d3b611..2a1817651914 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.Serialization.cs @@ -5,24 +5,131 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDatasetDebugInfo : IUtf8JsonSerializable + public partial class DataFactoryDatasetDebugInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryDatasetDebugInfo DeserializeDataFactoryDatasetDebugInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataFactoryDatasetProperties properties = default; + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataFactoryDatasetProperties.DeserializeDataFactoryDatasetProperties(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDatasetDebugInfo(name.Value, properties, serializedAdditionalRawData); + } + + DataFactoryDatasetDebugInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDatasetDebugInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDatasetDebugInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDatasetDebugInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDatasetDebugInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDatasetDebugInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDatasetDebugInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.cs index b043694019d7..3c3b1908acc6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetDebugInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Dataset debug resource. public partial class DataFactoryDatasetDebugInfo : DataFactoryDebugInfo { - /// Initializes a new instance of DataFactoryDatasetDebugInfo. + /// Initializes a new instance of . /// /// Dataset properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,6 +28,24 @@ public DataFactoryDatasetDebugInfo(DataFactoryDatasetProperties properties) Properties = properties; } + /// Initializes a new instance of . + /// The resource name. + /// + /// Dataset properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal DataFactoryDatasetDebugInfo(string name, DataFactoryDatasetProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) + { + Properties = properties; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryDatasetDebugInfo() + { + } + /// /// Dataset properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.Serialization.cs index 1928ecabe8cf..f3f4b3c32a6f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryDatasetListResult + internal partial class DataFactoryDatasetListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryDatasetListResult DeserializeDataFactoryDatasetListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryDatasetListResult DeserializeDataFactoryDatasetListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryDatasetListResult DeserializeDataFactoryDatasetListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryDatasetListResult(value, nextLink.Value); + return new DataFactoryDatasetListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryDatasetListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDatasetListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDatasetListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDatasetListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDatasetListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDatasetListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDatasetListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.cs index 3a71749641b1..cd56382ba8d9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of dataset resources. internal partial class DataFactoryDatasetListResult { - /// Initializes a new instance of DataFactoryDatasetListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of datasets. /// is null. internal DataFactoryDatasetListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryDatasetListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DataFactoryDatasetListResult. + /// Initializes a new instance of . /// List of datasets. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryDatasetListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryDatasetListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryDatasetListResult() + { } /// List of datasets. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.Serialization.cs index 687d328b99d5..dfa1170dab03 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDatasetProperties : IUtf8JsonSerializable + public partial class DataFactoryDatasetProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -40,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -66,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -80,8 +103,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryDatasetProperties DeserializeDataFactoryDatasetProperties(JsonElement element) + internal static DataFactoryDatasetProperties DeserializeDataFactoryDatasetProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -188,7 +213,149 @@ internal static DataFactoryDatasetProperties DeserializeDataFactoryDatasetProper case "ZohoObject": return ZohoObjectDataset.DeserializeZohoObjectDataset(element); } } - return UnknownDataset.DeserializeUnknownDataset(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional description = default; + Optional>> structure = default; + Optional>> schema = default; + DataFactoryLinkedServiceReference linkedServiceName = default; + Optional> parameters = default; + Optional> annotations = default; + Optional folder = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("structure"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + structure = JsonSerializer.Deserialize>>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("schema"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + schema = JsonSerializer.Deserialize>>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("linkedServiceName"u8)) + { + linkedServiceName = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, EntityParameterSpecification.DeserializeEntityParameterSpecification(property0.Value)); + } + parameters = dictionary; + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + annotations = array; + continue; + } + if (property.NameEquals("folder"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + folder = DatasetFolder.DeserializeDatasetFolder(property.Value); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties); + } + + DataFactoryDatasetProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDatasetProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDatasetProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDatasetProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDatasetProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDatasetProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDatasetProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.cs index 283a06201fd1..35d638c9e911 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDatasetProperties.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DataFactoryDatasetProperties { - /// Initializes a new instance of DataFactoryDatasetProperties. + /// Initializes a new instance of . /// Linked service reference. /// is null. public DataFactoryDatasetProperties(DataFactoryLinkedServiceReference linkedServiceName) @@ -32,7 +32,7 @@ public DataFactoryDatasetProperties(DataFactoryLinkedServiceReference linkedServ AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryDatasetProperties. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -55,6 +55,11 @@ internal DataFactoryDatasetProperties(string datasetType, string description, Da AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal DataFactoryDatasetProperties() + { + } + /// Type of dataset. internal string DatasetType { get; set; } /// Dataset description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.Serialization.cs index 0ac88217eac4..82794f0024c5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryDebugInfo : IUtf8JsonSerializable + public partial class DataFactoryDebugInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryDebugInfo DeserializeDataFactoryDebugInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryDebugInfo(name.Value, serializedAdditionalRawData); + } + + DataFactoryDebugInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryDebugInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryDebugInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryDebugInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryDebugInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryDebugInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryDebugInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.cs index 439037f39fd4..1672555d05df 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryDebugInfo.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Azure Data Factory nested debug resource. public partial class DataFactoryDebugInfo { - /// Initializes a new instance of DataFactoryDebugInfo. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryDebugInfo() { } + /// Initializes a new instance of . + /// The resource name. + /// Keeps track of any properties unknown to the library. + internal DataFactoryDebugInfo(string name, Dictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The resource name. public string Name { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.Serialization.cs index 45295130413b..299b66a5c7ec 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryEncryptionConfiguration : IUtf8JsonSerializable + public partial class DataFactoryEncryptionConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyName); @@ -28,13 +35,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity); + if (Identity is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Identity).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryEncryptionConfiguration DeserializeDataFactoryEncryptionConfiguration(JsonElement element) + internal static DataFactoryEncryptionConfiguration DeserializeDataFactoryEncryptionConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static DataFactoryEncryptionConfiguration DeserializeDataFactoryEncrypt Uri vaultBaseUrl = default; Optional keyVersion = default; Optional identity = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyName"u8)) @@ -69,8 +98,61 @@ internal static DataFactoryEncryptionConfiguration DeserializeDataFactoryEncrypt identity = DataFactoryCmkIdentity.DeserializeDataFactoryCmkIdentity(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryEncryptionConfiguration(keyName, vaultBaseUrl, keyVersion.Value, identity.Value, serializedAdditionalRawData); + } + + DataFactoryEncryptionConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryEncryptionConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryEncryptionConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryEncryptionConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryEncryptionConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryEncryptionConfiguration(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryEncryptionConfiguration(keyName, vaultBaseUrl, keyVersion.Value, identity.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryEncryptionConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.cs index de59999db760..33b5589b3c21 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryEncryptionConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Definition of CMK for the factory. public partial class DataFactoryEncryptionConfiguration { - /// Initializes a new instance of DataFactoryEncryptionConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the key in Azure Key Vault to use as Customer Managed Key. /// The url of the Azure Key Vault used for CMK. /// or is null. @@ -26,17 +30,24 @@ public DataFactoryEncryptionConfiguration(string keyName, Uri vaultBaseUri) VaultBaseUri = vaultBaseUri; } - /// Initializes a new instance of DataFactoryEncryptionConfiguration. + /// Initializes a new instance of . /// The name of the key in Azure Key Vault to use as Customer Managed Key. /// The url of the Azure Key Vault used for CMK. /// The version of the key used for CMK. If not provided, latest version will be used. /// User assigned identity to use to authenticate to customer's key vault. If not provided Managed Service Identity will be used. - internal DataFactoryEncryptionConfiguration(string keyName, Uri vaultBaseUri, string keyVersion, DataFactoryCmkIdentity identity) + /// Keeps track of any properties unknown to the library. + internal DataFactoryEncryptionConfiguration(string keyName, Uri vaultBaseUri, string keyVersion, DataFactoryCmkIdentity identity, Dictionary serializedAdditionalRawData) { KeyName = keyName; VaultBaseUri = vaultBaseUri; KeyVersion = keyVersion; Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryEncryptionConfiguration() + { } /// The name of the key in Azure Key Vault to use as Customer Managed Key. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.Serialization.cs index 757b54b8b653..adffd5dc4384 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryExpression : IUtf8JsonSerializable + public partial class DataFactoryExpression : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ExpressionType.ToString()); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryExpression DeserializeDataFactoryExpression(JsonElement element) + internal static DataFactoryExpression DeserializeDataFactoryExpression(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactoryExpressionType type = default; string value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -42,8 +65,61 @@ internal static DataFactoryExpression DeserializeDataFactoryExpression(JsonEleme value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryExpression(type, value, serializedAdditionalRawData); + } + + DataFactoryExpression IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryExpression(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryExpression IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryExpression(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryExpression model) + { + if (model is null) + { + return null; } - return new DataFactoryExpression(type, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryExpression(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryExpression(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.cs index 26764808f209..8b62560ec79c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryExpression.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure Data Factory expression definition. public partial class DataFactoryExpression { - /// Initializes a new instance of DataFactoryExpression. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Expression type. /// Expression value. /// is null. @@ -25,6 +29,22 @@ public DataFactoryExpression(DataFactoryExpressionType expressionType, string va Value = value; } + /// Initializes a new instance of . + /// Expression type. + /// Expression value. + /// Keeps track of any properties unknown to the library. + internal DataFactoryExpression(DataFactoryExpressionType expressionType, string value, Dictionary serializedAdditionalRawData) + { + ExpressionType = expressionType; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryExpression() + { + } + /// Expression type. public DataFactoryExpressionType ExpressionType { get; set; } /// Expression value. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.Serialization.cs index eafd75980d1f..19717a2c5626 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryFlowletProperties : IUtf8JsonSerializable + public partial class DataFactoryFlowletProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DataFlowType); @@ -46,7 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -56,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -66,7 +86,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sinks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,7 +103,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Transformations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,11 +130,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryFlowletProperties DeserializeDataFactoryFlowletProperties(JsonElement element) + internal static DataFactoryFlowletProperties DeserializeDataFactoryFlowletProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -114,6 +162,7 @@ internal static DataFactoryFlowletProperties DeserializeDataFactoryFlowletProper Optional> transformations = default; Optional script = default; Optional> scriptLines = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -229,8 +278,61 @@ internal static DataFactoryFlowletProperties DeserializeDataFactoryFlowletProper } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryFlowletProperties(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), Optional.ToList(sinks), Optional.ToList(transformations), script.Value, Optional.ToList(scriptLines)); + return new DataFactoryFlowletProperties(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), Optional.ToList(sinks), Optional.ToList(transformations), script.Value, Optional.ToList(scriptLines), serializedAdditionalRawData); + } + + DataFactoryFlowletProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryFlowletProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryFlowletProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryFlowletProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryFlowletProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryFlowletProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryFlowletProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.cs index 8a6e94e4be46..58be29de82b1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryFlowletProperties.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data flow flowlet. public partial class DataFactoryFlowletProperties : DataFactoryDataFlowProperties { - /// Initializes a new instance of DataFactoryFlowletProperties. + /// Initializes a new instance of . public DataFactoryFlowletProperties() { Sources = new ChangeTrackingList(); @@ -24,7 +24,7 @@ public DataFactoryFlowletProperties() DataFlowType = "Flowlet"; } - /// Initializes a new instance of DataFactoryFlowletProperties. + /// Initializes a new instance of . /// Type of data flow. /// The description of the data flow. /// List of tags that can be used for describing the data flow. @@ -34,7 +34,8 @@ public DataFactoryFlowletProperties() /// List of transformations in Flowlet. /// Flowlet script. /// Flowlet script lines. - internal DataFactoryFlowletProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, IList sources, IList sinks, IList transformations, string script, IList scriptLines) : base(dataFlowType, description, annotations, folder) + /// Keeps track of any properties unknown to the library. + internal DataFactoryFlowletProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, IList sources, IList sinks, IList transformations, string script, IList scriptLines, Dictionary serializedAdditionalRawData) : base(dataFlowType, description, annotations, folder, serializedAdditionalRawData) { Sources = sources; Sinks = sinks; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterData.Serialization.cs index 0940aa3a8ffa..1fbfcb73eec7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterData.Serialization.cs @@ -5,33 +5,60 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryGlobalParameterData : IUtf8JsonSerializable + public partial class DataFactoryGlobalParameterData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); foreach (var item in Properties) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryGlobalParameterData DeserializeDataFactoryGlobalParameterData(JsonElement element) + internal static DataFactoryGlobalParameterData DeserializeDataFactoryGlobalParameterData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +69,7 @@ internal static DataFactoryGlobalParameterData DeserializeDataFactoryGlobalParam string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -87,8 +115,61 @@ internal static DataFactoryGlobalParameterData DeserializeDataFactoryGlobalParam systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryGlobalParameterData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryGlobalParameterData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryGlobalParameterData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryGlobalParameterData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryGlobalParameterData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryGlobalParameterData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryGlobalParameterData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryGlobalParameterData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryGlobalParameterData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.Serialization.cs index bc8821d40db5..cfdd2950157a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryGlobalParameterListResult + internal partial class DataFactoryGlobalParameterListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryGlobalParameterListResult DeserializeDataFactoryGlobalParameterListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryGlobalParameterListResult DeserializeDataFactoryGlobalParameterListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryGlobalParameterListResult DeserializeDataFactoryGloba nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryGlobalParameterListResult(value, nextLink.Value); + return new DataFactoryGlobalParameterListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryGlobalParameterListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryGlobalParameterListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryGlobalParameterListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryGlobalParameterListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryGlobalParameterListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryGlobalParameterListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryGlobalParameterListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.cs index e0a02332a249..f37ab9461a4b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of Global parameters. internal partial class DataFactoryGlobalParameterListResult { - /// Initializes a new instance of DataFactoryGlobalParameterListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of global parameters. /// is null. internal DataFactoryGlobalParameterListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryGlobalParameterListResult(IEnumerable Initializes a new instance of DataFactoryGlobalParameterListResult. + /// Initializes a new instance of . /// List of global parameters. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryGlobalParameterListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryGlobalParameterListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryGlobalParameterListResult() + { } /// List of global parameters. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.Serialization.cs index f88e850b6eb2..b9d5696a1020 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryGlobalParameterProperties : IUtf8JsonSerializable + public partial class DataFactoryGlobalParameterProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(GlobalParameterType.ToString()); @@ -24,17 +31,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) #else JsonSerializer.Serialize(writer, JsonDocument.Parse(Value.ToString()).RootElement); #endif + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryGlobalParameterProperties DeserializeDataFactoryGlobalParameterProperties(JsonElement element) + internal static DataFactoryGlobalParameterProperties DeserializeDataFactoryGlobalParameterProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactoryGlobalParameterType type = default; BinaryData value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -47,8 +69,61 @@ internal static DataFactoryGlobalParameterProperties DeserializeDataFactoryGloba value = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryGlobalParameterProperties(type, value); + return new DataFactoryGlobalParameterProperties(type, value, serializedAdditionalRawData); + } + + DataFactoryGlobalParameterProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryGlobalParameterProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryGlobalParameterProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryGlobalParameterProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryGlobalParameterProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryGlobalParameterProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryGlobalParameterProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.cs index 32804acaaeaa..06cbd2e99452 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryGlobalParameterProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Definition of a single parameter for an entity. public partial class DataFactoryGlobalParameterProperties { - /// Initializes a new instance of DataFactoryGlobalParameterProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Global Parameter type. /// Value of parameter. /// is null. @@ -25,6 +29,22 @@ public DataFactoryGlobalParameterProperties(DataFactoryGlobalParameterType globa Value = value; } + /// Initializes a new instance of . + /// Global Parameter type. + /// Value of parameter. + /// Keeps track of any properties unknown to the library. + internal DataFactoryGlobalParameterProperties(DataFactoryGlobalParameterType globalParameterType, BinaryData value, Dictionary serializedAdditionalRawData) + { + GlobalParameterType = globalParameterType; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryGlobalParameterProperties() + { + } + /// Global Parameter type. public DataFactoryGlobalParameterType GlobalParameterType { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.Serialization.cs index 20c8bb7ea085..2d395eac9c97 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryHttpDataset : IUtf8JsonSerializable + public partial class DataFactoryHttpDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,12 +116,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } } if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -116,8 +150,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryHttpDataset DeserializeDataFactoryHttpDataset(JsonElement element) + internal static DataFactoryHttpDataset DeserializeDataFactoryHttpDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -288,5 +324,53 @@ internal static DataFactoryHttpDataset DeserializeDataFactoryHttpDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new DataFactoryHttpDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, relativeUrl.Value, requestMethod.Value, requestBody.Value, additionalHeaders.Value, format.Value, compression.Value); } + + DataFactoryHttpDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryHttpDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryHttpDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryHttpDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryHttpDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryHttpDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryHttpDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.cs index 4123fec98a01..65b5ad149430 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A file in an HTTP web server. public partial class DataFactoryHttpDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DataFactoryHttpDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public DataFactoryHttpDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public DataFactoryHttpDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "HttpFile"; } - /// Initializes a new instance of DataFactoryHttpDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -60,6 +60,11 @@ internal DataFactoryHttpDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "HttpFile"; } + /// Initializes a new instance of for deserialization. + internal DataFactoryHttpDataset() + { + } + /// The relative URL based on the URL in the HttpLinkedService refers to an HTTP file Type: string (or Expression with resultType string). public DataFactoryElement RelativeUri { get; set; } /// The HTTP method for the HTTP request. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.Serialization.cs index e3be1296ec36..acb445ede7a1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryHttpFileSource : IUtf8JsonSerializable + public partial class DataFactoryHttpFileSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HttpRequestTimeout)) { @@ -57,8 +63,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryHttpFileSource DeserializeDataFactoryHttpFileSource(JsonElement element) + internal static DataFactoryHttpFileSource DeserializeDataFactoryHttpFileSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -128,5 +136,53 @@ internal static DataFactoryHttpFileSource DeserializeDataFactoryHttpFileSource(J additionalProperties = additionalPropertiesDictionary; return new DataFactoryHttpFileSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, httpRequestTimeout.Value); } + + DataFactoryHttpFileSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryHttpFileSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryHttpFileSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryHttpFileSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryHttpFileSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryHttpFileSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryHttpFileSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.cs index 818a423840d4..767b14769bc3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryHttpFileSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for an HTTP file. public partial class DataFactoryHttpFileSource : CopyActivitySource { - /// Initializes a new instance of DataFactoryHttpFileSource. + /// Initializes a new instance of . public DataFactoryHttpFileSource() { CopySourceType = "HttpSource"; } - /// Initializes a new instance of DataFactoryHttpFileSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeData.Serialization.cs index 99d59c4e79ca..b8628d621ba3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryIntegrationRuntimeData : IUtf8JsonSerializable + public partial class DataFactoryIntegrationRuntimeData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryIntegrationRuntimeData DeserializeDataFactoryIntegrationRuntimeData(JsonElement element) + internal static DataFactoryIntegrationRuntimeData DeserializeDataFactoryIntegrationRuntimeData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryIntegrationRuntimeData DeserializeDataFactoryIntegrat string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryIntegrationRuntimeData DeserializeDataFactoryIntegrat systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryIntegrationRuntimeData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryIntegrationRuntimeData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryIntegrationRuntimeData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryIntegrationRuntimeData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryIntegrationRuntimeData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryIntegrationRuntimeData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryIntegrationRuntimeData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryIntegrationRuntimeData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryIntegrationRuntimeData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.Serialization.cs index 013dde36416f..a42b0a2fb9f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.Serialization.cs @@ -5,24 +5,131 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryIntegrationRuntimeDebugInfo : IUtf8JsonSerializable + public partial class DataFactoryIntegrationRuntimeDebugInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryIntegrationRuntimeDebugInfo DeserializeDataFactoryIntegrationRuntimeDebugInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataFactoryIntegrationRuntimeProperties properties = default; + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataFactoryIntegrationRuntimeProperties.DeserializeDataFactoryIntegrationRuntimeProperties(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryIntegrationRuntimeDebugInfo(name.Value, properties, serializedAdditionalRawData); + } + + DataFactoryIntegrationRuntimeDebugInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryIntegrationRuntimeDebugInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryIntegrationRuntimeDebugInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryIntegrationRuntimeDebugInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryIntegrationRuntimeDebugInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryIntegrationRuntimeDebugInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryIntegrationRuntimeDebugInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.cs index 2ef7c9b771ab..9a15cdf5b370 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeDebugInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Integration runtime debug resource. public partial class DataFactoryIntegrationRuntimeDebugInfo : DataFactoryDebugInfo { - /// Initializes a new instance of DataFactoryIntegrationRuntimeDebugInfo. + /// Initializes a new instance of . /// /// Integration runtime properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,6 +28,24 @@ public DataFactoryIntegrationRuntimeDebugInfo(DataFactoryIntegrationRuntimePrope Properties = properties; } + /// Initializes a new instance of . + /// The resource name. + /// + /// Integration runtime properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal DataFactoryIntegrationRuntimeDebugInfo(string name, DataFactoryIntegrationRuntimeProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) + { + Properties = properties; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryIntegrationRuntimeDebugInfo() + { + } + /// /// Integration runtime properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.Serialization.cs index 2c8462d3a1a0..05c7e17e9864 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryIntegrationRuntimeListResult + internal partial class DataFactoryIntegrationRuntimeListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryIntegrationRuntimeListResult DeserializeDataFactoryIntegrationRuntimeListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryIntegrationRuntimeListResult DeserializeDataFactoryIntegrationRuntimeListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryIntegrationRuntimeListResult DeserializeDataFactoryIn nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryIntegrationRuntimeListResult(value, nextLink.Value); + return new DataFactoryIntegrationRuntimeListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryIntegrationRuntimeListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryIntegrationRuntimeListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryIntegrationRuntimeListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryIntegrationRuntimeListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryIntegrationRuntimeListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryIntegrationRuntimeListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryIntegrationRuntimeListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.cs index 6e316071bae2..30b2055c17ad 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of integration runtime resources. internal partial class DataFactoryIntegrationRuntimeListResult { - /// Initializes a new instance of DataFactoryIntegrationRuntimeListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of integration runtimes. /// is null. internal DataFactoryIntegrationRuntimeListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryIntegrationRuntimeListResult(IEnumerable Initializes a new instance of DataFactoryIntegrationRuntimeListResult. + /// Initializes a new instance of . /// List of integration runtimes. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryIntegrationRuntimeListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryIntegrationRuntimeListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryIntegrationRuntimeListResult() + { } /// List of integration runtimes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.Serialization.cs index 4e4371f489ef..ef19c621ed67 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryIntegrationRuntimePatch : IUtf8JsonSerializable + public partial class DataFactoryIntegrationRuntimePatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AutoUpdate)) { @@ -25,7 +33,107 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("updateDelayOffset"u8); writer.WriteStringValue(UpdateDelayOffset.Value, "P"); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryIntegrationRuntimePatch DeserializeDataFactoryIntegrationRuntimePatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional autoUpdate = default; + Optional updateDelayOffset = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("autoUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoUpdate = new IntegrationRuntimeAutoUpdateState(property.Value.GetString()); + continue; + } + if (property.NameEquals("updateDelayOffset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updateDelayOffset = property.Value.GetTimeSpan("P"); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryIntegrationRuntimePatch(Optional.ToNullable(autoUpdate), Optional.ToNullable(updateDelayOffset), serializedAdditionalRawData); + } + + DataFactoryIntegrationRuntimePatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryIntegrationRuntimePatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryIntegrationRuntimePatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryIntegrationRuntimePatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryIntegrationRuntimePatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryIntegrationRuntimePatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryIntegrationRuntimePatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.cs index 3583005bcb7a..578a8ecc1022 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimePatch.cs @@ -6,17 +6,32 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Update integration runtime request. public partial class DataFactoryIntegrationRuntimePatch { - /// Initializes a new instance of DataFactoryIntegrationRuntimePatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryIntegrationRuntimePatch() { } + /// Initializes a new instance of . + /// Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. + /// The time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. + /// Keeps track of any properties unknown to the library. + internal DataFactoryIntegrationRuntimePatch(IntegrationRuntimeAutoUpdateState? autoUpdate, TimeSpan? updateDelayOffset, Dictionary serializedAdditionalRawData) + { + AutoUpdate = autoUpdate; + UpdateDelayOffset = updateDelayOffset; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. public IntegrationRuntimeAutoUpdateState? AutoUpdate { get; set; } /// The time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.Serialization.cs index 29870e3b6f7e..a23b579367b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryIntegrationRuntimeProperties : IUtf8JsonSerializable + public partial class DataFactoryIntegrationRuntimeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(IntegrationRuntimeType.ToString()); @@ -34,8 +42,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryIntegrationRuntimeProperties DeserializeDataFactoryIntegrationRuntimeProperties(JsonElement element) + internal static DataFactoryIntegrationRuntimeProperties DeserializeDataFactoryIntegrationRuntimeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -48,7 +58,76 @@ internal static DataFactoryIntegrationRuntimeProperties DeserializeDataFactoryIn case "SelfHosted": return SelfHostedIntegrationRuntime.DeserializeSelfHostedIntegrationRuntime(element); } } - return UnknownIntegrationRuntime.DeserializeUnknownIntegrationRuntime(element); + + // Unknown type found so we will deserialize the base properties only + IntegrationRuntimeType type = default; + Optional description = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new IntegrationRuntimeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownIntegrationRuntime(type, description.Value, additionalProperties); + } + + DataFactoryIntegrationRuntimeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryIntegrationRuntimeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryIntegrationRuntimeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryIntegrationRuntimeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryIntegrationRuntimeProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryIntegrationRuntimeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryIntegrationRuntimeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.cs index d9f856076f70..5ebb5d71bac8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeProperties.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DataFactoryIntegrationRuntimeProperties { - /// Initializes a new instance of DataFactoryIntegrationRuntimeProperties. + /// Initializes a new instance of . public DataFactoryIntegrationRuntimeProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryIntegrationRuntimeProperties. + /// Initializes a new instance of . /// Type of integration runtime. /// Integration runtime description. /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.Serialization.cs index 4be61047383f..e53d89e0ea1a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.Serialization.cs @@ -5,21 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryIntegrationRuntimeStatusResult + public partial class DataFactoryIntegrationRuntimeStatusResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryIntegrationRuntimeStatusResult DeserializeDataFactoryIntegrationRuntimeStatusResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryIntegrationRuntimeStatusResult DeserializeDataFactoryIntegrationRuntimeStatusResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; IntegrationRuntimeStatus properties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -32,8 +70,61 @@ internal static DataFactoryIntegrationRuntimeStatusResult DeserializeDataFactory properties = IntegrationRuntimeStatus.DeserializeIntegrationRuntimeStatus(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryIntegrationRuntimeStatusResult(name.Value, properties); + return new DataFactoryIntegrationRuntimeStatusResult(name.Value, properties, serializedAdditionalRawData); + } + + DataFactoryIntegrationRuntimeStatusResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryIntegrationRuntimeStatusResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryIntegrationRuntimeStatusResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryIntegrationRuntimeStatusResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryIntegrationRuntimeStatusResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryIntegrationRuntimeStatusResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryIntegrationRuntimeStatusResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.cs index a5cb0ef5b5c4..38025acaae47 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryIntegrationRuntimeStatusResult.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Integration runtime status response. public partial class DataFactoryIntegrationRuntimeStatusResult { - /// Initializes a new instance of DataFactoryIntegrationRuntimeStatusResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// Integration runtime properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,17 +31,24 @@ internal DataFactoryIntegrationRuntimeStatusResult(IntegrationRuntimeStatus prop Properties = properties; } - /// Initializes a new instance of DataFactoryIntegrationRuntimeStatusResult. + /// Initializes a new instance of . /// The integration runtime name. /// /// Integration runtime properties. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// - internal DataFactoryIntegrationRuntimeStatusResult(string name, IntegrationRuntimeStatus properties) + /// Keeps track of any properties unknown to the library. + internal DataFactoryIntegrationRuntimeStatusResult(string name, IntegrationRuntimeStatus properties, Dictionary serializedAdditionalRawData) { Name = name; Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryIntegrationRuntimeStatusResult() + { } /// The integration runtime name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceData.Serialization.cs index 4930aa1dc54d..a01554c7cd80 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryLinkedServiceData : IUtf8JsonSerializable + public partial class DataFactoryLinkedServiceData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryLinkedServiceData DeserializeDataFactoryLinkedServiceData(JsonElement element) + internal static DataFactoryLinkedServiceData DeserializeDataFactoryLinkedServiceData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryLinkedServiceData DeserializeDataFactoryLinkedService string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryLinkedServiceData DeserializeDataFactoryLinkedService systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryLinkedServiceData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryLinkedServiceData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryLinkedServiceData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryLinkedServiceData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryLinkedServiceData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryLinkedServiceData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryLinkedServiceData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryLinkedServiceData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryLinkedServiceData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.Serialization.cs index 77079e4dafa5..e06f172f8439 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.Serialization.cs @@ -5,24 +5,131 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryLinkedServiceDebugInfo : IUtf8JsonSerializable + public partial class DataFactoryLinkedServiceDebugInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryLinkedServiceDebugInfo DeserializeDataFactoryLinkedServiceDebugInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataFactoryLinkedServiceProperties properties = default; + Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataFactoryLinkedServiceProperties.DeserializeDataFactoryLinkedServiceProperties(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryLinkedServiceDebugInfo(name.Value, properties, serializedAdditionalRawData); + } + + DataFactoryLinkedServiceDebugInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryLinkedServiceDebugInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryLinkedServiceDebugInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryLinkedServiceDebugInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryLinkedServiceDebugInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryLinkedServiceDebugInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryLinkedServiceDebugInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.cs index 5aaa20ea0ba7..f05313fb9da4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceDebugInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service debug resource. public partial class DataFactoryLinkedServiceDebugInfo : DataFactoryDebugInfo { - /// Initializes a new instance of DataFactoryLinkedServiceDebugInfo. + /// Initializes a new instance of . /// /// Properties of linked service. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. @@ -27,6 +28,24 @@ public DataFactoryLinkedServiceDebugInfo(DataFactoryLinkedServiceProperties prop Properties = properties; } + /// Initializes a new instance of . + /// The resource name. + /// + /// Properties of linked service. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal DataFactoryLinkedServiceDebugInfo(string name, DataFactoryLinkedServiceProperties properties, Dictionary serializedAdditionalRawData) : base(name, serializedAdditionalRawData) + { + Properties = properties; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryLinkedServiceDebugInfo() + { + } + /// /// Properties of linked service. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.Serialization.cs index 5473399a4a50..06c03c5fb36c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryLinkedServiceListResult + internal partial class DataFactoryLinkedServiceListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryLinkedServiceListResult DeserializeDataFactoryLinkedServiceListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryLinkedServiceListResult DeserializeDataFactoryLinkedServiceListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryLinkedServiceListResult DeserializeDataFactoryLinkedS nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryLinkedServiceListResult(value, nextLink.Value); + return new DataFactoryLinkedServiceListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryLinkedServiceListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryLinkedServiceListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryLinkedServiceListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryLinkedServiceListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryLinkedServiceListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryLinkedServiceListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryLinkedServiceListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.cs index 82b5d745e86d..c6007e7570f0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of linked service resources. internal partial class DataFactoryLinkedServiceListResult { - /// Initializes a new instance of DataFactoryLinkedServiceListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of linked services. /// is null. internal DataFactoryLinkedServiceListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryLinkedServiceListResult(IEnumerable Initializes a new instance of DataFactoryLinkedServiceListResult. + /// Initializes a new instance of . /// List of linked services. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryLinkedServiceListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryLinkedServiceListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryLinkedServiceListResult() + { } /// List of linked services. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.Serialization.cs index 7e43bb072d1e..775aec33be0a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.Serialization.cs @@ -5,22 +5,37 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryLinkedServiceProperties : IUtf8JsonSerializable + public partial class DataFactoryLinkedServiceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -34,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,8 +91,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryLinkedServiceProperties DeserializeDataFactoryLinkedServiceProperties(JsonElement element) + internal static DataFactoryLinkedServiceProperties DeserializeDataFactoryLinkedServiceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -194,7 +218,123 @@ internal static DataFactoryLinkedServiceProperties DeserializeDataFactoryLinkedS case "Zoho": return ZohoLinkedService.DeserializeZohoLinkedService(element); } } - return UnknownLinkedService.DeserializeUnknownLinkedService(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional connectVia = default; + Optional description = default; + Optional> parameters = default; + Optional> annotations = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("connectVia"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, EntityParameterSpecification.DeserializeEntityParameterSpecification(property0.Value)); + } + parameters = dictionary; + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + annotations = array; + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties); + } + + DataFactoryLinkedServiceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryLinkedServiceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryLinkedServiceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryLinkedServiceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryLinkedServiceProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryLinkedServiceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryLinkedServiceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.cs index 1236d6a8204a..a35ad09adcfe 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLinkedServiceProperties.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DataFactoryLinkedServiceProperties { - /// Initializes a new instance of DataFactoryLinkedServiceProperties. + /// Initializes a new instance of . public DataFactoryLinkedServiceProperties() { Parameters = new ChangeTrackingDictionary(); @@ -26,7 +26,7 @@ public DataFactoryLinkedServiceProperties() AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryLinkedServiceProperties. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.Serialization.cs index 25b12afb15ea..979657962dc5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryListResult + internal partial class DataFactoryListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryListResult DeserializeDataFactoryListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryListResult DeserializeDataFactoryListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryListResult DeserializeDataFactoryListResult(JsonEleme nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryListResult(value, nextLink.Value); + return new DataFactoryListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.cs index 62e9334cdc0b..ac6e6b3f6bdc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of factory resources. internal partial class DataFactoryListResult { - /// Initializes a new instance of DataFactoryListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of factories. /// is null. internal DataFactoryListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DataFactoryListResult. + /// Initializes a new instance of . /// List of factories. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryListResult() + { } /// List of factories. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.Serialization.cs index 02406d1c2867..746a5416f443 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryLogSettings : IUtf8JsonSerializable + public partial class DataFactoryLogSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(EnableCopyActivityLog)) { @@ -24,15 +32,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CopyActivityLogSettings)) { writer.WritePropertyName("copyActivityLogSettings"u8); - writer.WriteObjectValue(CopyActivityLogSettings); + if (CopyActivityLogSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CopyActivityLogSettings).Serialize(writer, options); + } } writer.WritePropertyName("logLocationSettings"u8); - writer.WriteObjectValue(LogLocationSettings); + if (LogLocationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogLocationSettings).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryLogSettings DeserializeDataFactoryLogSettings(JsonElement element) + internal static DataFactoryLogSettings DeserializeDataFactoryLogSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -40,6 +76,7 @@ internal static DataFactoryLogSettings DeserializeDataFactoryLogSettings(JsonEle Optional> enableCopyActivityLog = default; Optional copyActivityLogSettings = default; LogLocationSettings logLocationSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enableCopyActivityLog"u8)) @@ -65,8 +102,61 @@ internal static DataFactoryLogSettings DeserializeDataFactoryLogSettings(JsonEle logLocationSettings = LogLocationSettings.DeserializeLogLocationSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryLogSettings(enableCopyActivityLog.Value, copyActivityLogSettings.Value, logLocationSettings, serializedAdditionalRawData); + } + + DataFactoryLogSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryLogSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryLogSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryLogSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryLogSettings model) + { + if (model is null) + { + return null; } - return new DataFactoryLogSettings(enableCopyActivityLog.Value, copyActivityLogSettings.Value, logLocationSettings); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryLogSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryLogSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.cs index 3a08572ac95b..3b51600e4cee 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryLogSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Log settings. public partial class DataFactoryLogSettings { - /// Initializes a new instance of DataFactoryLogSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Log location settings customer needs to provide when enabling log. /// is null. public DataFactoryLogSettings(LogLocationSettings logLocationSettings) @@ -24,15 +28,22 @@ public DataFactoryLogSettings(LogLocationSettings logLocationSettings) LogLocationSettings = logLocationSettings; } - /// Initializes a new instance of DataFactoryLogSettings. + /// Initializes a new instance of . /// Specifies whether to enable copy activity log. Type: boolean (or Expression with resultType boolean). /// Specifies settings for copy activity log. /// Log location settings customer needs to provide when enabling log. - internal DataFactoryLogSettings(DataFactoryElement enableCopyActivityLog, CopyActivityLogSettings copyActivityLogSettings, LogLocationSettings logLocationSettings) + /// Keeps track of any properties unknown to the library. + internal DataFactoryLogSettings(DataFactoryElement enableCopyActivityLog, CopyActivityLogSettings copyActivityLogSettings, LogLocationSettings logLocationSettings, Dictionary serializedAdditionalRawData) { EnableCopyActivityLog = enableCopyActivityLog; CopyActivityLogSettings = copyActivityLogSettings; LogLocationSettings = logLocationSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryLogSettings() + { } /// Specifies whether to enable copy activity log. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialData.Serialization.cs index a73e2a9cea75..b1fa2fa3c51b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryManagedIdentityCredentialData : IUtf8JsonSerializable + public partial class DataFactoryManagedIdentityCredentialData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryManagedIdentityCredentialData DeserializeDataFactoryManagedIdentityCredentialData(JsonElement element) + internal static DataFactoryManagedIdentityCredentialData DeserializeDataFactoryManagedIdentityCredentialData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryManagedIdentityCredentialData DeserializeDataFactoryM string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryManagedIdentityCredentialData DeserializeDataFactoryM systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryManagedIdentityCredentialData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryManagedIdentityCredentialData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryManagedIdentityCredentialData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryManagedIdentityCredentialData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryManagedIdentityCredentialData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryManagedIdentityCredentialData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryManagedIdentityCredentialData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryManagedIdentityCredentialData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryManagedIdentityCredentialData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.Serialization.cs index 03c8ad7fb7c6..bd8972ff5789 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryManagedIdentityCredentialProperties : IUtf8JsonSerializable + public partial class DataFactoryManagedIdentityCredentialProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CredentialType); @@ -63,8 +69,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryManagedIdentityCredentialProperties DeserializeDataFactoryManagedIdentityCredentialProperties(JsonElement element) + internal static DataFactoryManagedIdentityCredentialProperties DeserializeDataFactoryManagedIdentityCredentialProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -134,5 +142,53 @@ internal static DataFactoryManagedIdentityCredentialProperties DeserializeDataFa additionalProperties = additionalPropertiesDictionary; return new DataFactoryManagedIdentityCredentialProperties(type, description.Value, Optional.ToList(annotations), additionalProperties, resourceId.Value); } + + DataFactoryManagedIdentityCredentialProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryManagedIdentityCredentialProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryManagedIdentityCredentialProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryManagedIdentityCredentialProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryManagedIdentityCredentialProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryManagedIdentityCredentialProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryManagedIdentityCredentialProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.cs index f1995128fbd6..74b68816f656 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedIdentityCredentialProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Managed identity credential. public partial class DataFactoryManagedIdentityCredentialProperties : DataFactoryCredential { - /// Initializes a new instance of DataFactoryManagedIdentityCredentialProperties. + /// Initializes a new instance of . public DataFactoryManagedIdentityCredentialProperties() { CredentialType = "ManagedIdentity"; } - /// Initializes a new instance of DataFactoryManagedIdentityCredentialProperties. + /// Initializes a new instance of . /// Type of credential. /// Credential description. /// List of tags that can be used for describing the Credential. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkData.Serialization.cs index 4cdd4eb0ce98..3b364a1bd64c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryManagedVirtualNetworkData : IUtf8JsonSerializable + public partial class DataFactoryManagedVirtualNetworkData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryManagedVirtualNetworkData DeserializeDataFactoryManagedVirtualNetworkData(JsonElement element) + internal static DataFactoryManagedVirtualNetworkData DeserializeDataFactoryManagedVirtualNetworkData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryManagedVirtualNetworkData DeserializeDataFactoryManag string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryManagedVirtualNetworkData DeserializeDataFactoryManag systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryManagedVirtualNetworkData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryManagedVirtualNetworkData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryManagedVirtualNetworkData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryManagedVirtualNetworkData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryManagedVirtualNetworkData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryManagedVirtualNetworkData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryManagedVirtualNetworkData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryManagedVirtualNetworkData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryManagedVirtualNetworkData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.Serialization.cs index 155df68fa87b..1c3fb760be57 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryManagedVirtualNetworkListResult + internal partial class DataFactoryManagedVirtualNetworkListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryManagedVirtualNetworkListResult DeserializeDataFactoryManagedVirtualNetworkListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryManagedVirtualNetworkListResult DeserializeDataFactoryManagedVirtualNetworkListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryManagedVirtualNetworkListResult DeserializeDataFactor nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryManagedVirtualNetworkListResult(value, nextLink.Value); + return new DataFactoryManagedVirtualNetworkListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryManagedVirtualNetworkListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryManagedVirtualNetworkListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryManagedVirtualNetworkListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryManagedVirtualNetworkListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryManagedVirtualNetworkListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryManagedVirtualNetworkListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryManagedVirtualNetworkListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.cs index a7b4eee04fda..f500c02c8b91 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of managed Virtual Network resources. internal partial class DataFactoryManagedVirtualNetworkListResult { - /// Initializes a new instance of DataFactoryManagedVirtualNetworkListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of managed Virtual Networks. /// is null. internal DataFactoryManagedVirtualNetworkListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryManagedVirtualNetworkListResult(IEnumerable Initializes a new instance of DataFactoryManagedVirtualNetworkListResult. + /// Initializes a new instance of . /// List of managed Virtual Networks. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryManagedVirtualNetworkListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryManagedVirtualNetworkListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryManagedVirtualNetworkListResult() + { } /// List of managed Virtual Networks. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.Serialization.cs index a996077249b6..8c5e104739fd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryManagedVirtualNetworkProperties : IUtf8JsonSerializable + public partial class DataFactoryManagedVirtualNetworkProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); foreach (var item in AdditionalProperties) { @@ -29,8 +35,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryManagedVirtualNetworkProperties DeserializeDataFactoryManagedVirtualNetworkProperties(JsonElement element) + internal static DataFactoryManagedVirtualNetworkProperties DeserializeDataFactoryManagedVirtualNetworkProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,5 +68,53 @@ internal static DataFactoryManagedVirtualNetworkProperties DeserializeDataFactor additionalProperties = additionalPropertiesDictionary; return new DataFactoryManagedVirtualNetworkProperties(Optional.ToNullable(vnetId), @alias.Value, additionalProperties); } + + DataFactoryManagedVirtualNetworkProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryManagedVirtualNetworkProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryManagedVirtualNetworkProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryManagedVirtualNetworkProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryManagedVirtualNetworkProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryManagedVirtualNetworkProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryManagedVirtualNetworkProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.cs index b3ad58adfdfb..fb94f745c9a4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryManagedVirtualNetworkProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A managed Virtual Network associated with the Azure Data Factory. public partial class DataFactoryManagedVirtualNetworkProperties { - /// Initializes a new instance of DataFactoryManagedVirtualNetworkProperties. + /// Initializes a new instance of . public DataFactoryManagedVirtualNetworkProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryManagedVirtualNetworkProperties. + /// Initializes a new instance of . /// Managed Virtual Network ID. /// Managed Virtual Network alias. /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.Serialization.cs index 8a75b1a1a97d..6270bdef6c6f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryMappingDataFlowProperties : IUtf8JsonSerializable + public partial class DataFactoryMappingDataFlowProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DataFlowType); @@ -46,7 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -56,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -66,7 +86,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sinks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,7 +103,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Transformations) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -96,11 +130,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryMappingDataFlowProperties DeserializeDataFactoryMappingDataFlowProperties(JsonElement element) + internal static DataFactoryMappingDataFlowProperties DeserializeDataFactoryMappingDataFlowProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -114,6 +162,7 @@ internal static DataFactoryMappingDataFlowProperties DeserializeDataFactoryMappi Optional> transformations = default; Optional script = default; Optional> scriptLines = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -229,8 +278,61 @@ internal static DataFactoryMappingDataFlowProperties DeserializeDataFactoryMappi } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryMappingDataFlowProperties(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), Optional.ToList(sinks), Optional.ToList(transformations), script.Value, Optional.ToList(scriptLines)); + return new DataFactoryMappingDataFlowProperties(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), Optional.ToList(sinks), Optional.ToList(transformations), script.Value, Optional.ToList(scriptLines), serializedAdditionalRawData); + } + + DataFactoryMappingDataFlowProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryMappingDataFlowProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryMappingDataFlowProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryMappingDataFlowProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryMappingDataFlowProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryMappingDataFlowProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryMappingDataFlowProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.cs index 5f1e06ab261c..e9529d1eee5a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMappingDataFlowProperties.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Mapping data flow. public partial class DataFactoryMappingDataFlowProperties : DataFactoryDataFlowProperties { - /// Initializes a new instance of DataFactoryMappingDataFlowProperties. + /// Initializes a new instance of . public DataFactoryMappingDataFlowProperties() { Sources = new ChangeTrackingList(); @@ -24,7 +24,7 @@ public DataFactoryMappingDataFlowProperties() DataFlowType = "MappingDataFlow"; } - /// Initializes a new instance of DataFactoryMappingDataFlowProperties. + /// Initializes a new instance of . /// Type of data flow. /// The description of the data flow. /// List of tags that can be used for describing the data flow. @@ -34,7 +34,8 @@ public DataFactoryMappingDataFlowProperties() /// List of transformations in data flow. /// DataFlow script. /// Data flow script lines. - internal DataFactoryMappingDataFlowProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, IList sources, IList sinks, IList transformations, string script, IList scriptLines) : base(dataFlowType, description, annotations, folder) + /// Keeps track of any properties unknown to the library. + internal DataFactoryMappingDataFlowProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, IList sources, IList sinks, IList transformations, string script, IList scriptLines, Dictionary serializedAdditionalRawData) : base(dataFlowType, description, annotations, folder, serializedAdditionalRawData) { Sources = sources; Sinks = sinks; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.Serialization.cs index 166290c88aa9..3f251173d28c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryMetadataItemInfo : IUtf8JsonSerializable + public partial class DataFactoryMetadataItemInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); JsonSerializer.Serialize(writer, Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryMetadataItemInfo DeserializeDataFactoryMetadataItemInfo(JsonElement element) + internal static DataFactoryMetadataItemInfo DeserializeDataFactoryMetadataItemInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> name = default; Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +80,61 @@ internal static DataFactoryMetadataItemInfo DeserializeDataFactoryMetadataItemIn value = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryMetadataItemInfo(name.Value, value.Value, serializedAdditionalRawData); + } + + DataFactoryMetadataItemInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryMetadataItemInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryMetadataItemInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryMetadataItemInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryMetadataItemInfo model) + { + if (model is null) + { + return null; } - return new DataFactoryMetadataItemInfo(name.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryMetadataItemInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryMetadataItemInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.cs index 198fc9699eeb..ef9b7b98ee34 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryMetadataItemInfo.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Specify the name and value of custom metadata item. public partial class DataFactoryMetadataItemInfo { - /// Initializes a new instance of DataFactoryMetadataItemInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryMetadataItemInfo() { } - /// Initializes a new instance of DataFactoryMetadataItemInfo. + /// Initializes a new instance of . /// Metadata item key name. Type: string (or Expression with resultType string). /// Metadata item value. Type: string (or Expression with resultType string). - internal DataFactoryMetadataItemInfo(DataFactoryElement name, DataFactoryElement value) + /// Keeps track of any properties unknown to the library. + internal DataFactoryMetadataItemInfo(DataFactoryElement name, DataFactoryElement value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Metadata item key name. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.Serialization.cs index 64a51977bf98..4a06f45d7ec0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPackageStore : IUtf8JsonSerializable + public partial class DataFactoryPackageStore : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("packageStoreLinkedService"u8); - writer.WriteObjectValue(PackageStoreLinkedService); + if (PackageStoreLinkedService is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PackageStoreLinkedService).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryPackageStore DeserializeDataFactoryPackageStore(JsonElement element) + internal static DataFactoryPackageStore DeserializeDataFactoryPackageStore(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; EntityReference packageStoreLinkedService = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +72,61 @@ internal static DataFactoryPackageStore DeserializeDataFactoryPackageStore(JsonE packageStoreLinkedService = EntityReference.DeserializeEntityReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPackageStore(name, packageStoreLinkedService, serializedAdditionalRawData); + } + + DataFactoryPackageStore IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPackageStore(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPackageStore IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPackageStore(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPackageStore model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPackageStore(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPackageStore(name, packageStoreLinkedService); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPackageStore(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.cs index 140d99e0749a..aaafbb25c987 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPackageStore.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Package store for the SSIS integration runtime. public partial class DataFactoryPackageStore { - /// Initializes a new instance of DataFactoryPackageStore. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the package store. /// The package store linked service reference. /// or is null. @@ -26,6 +30,22 @@ public DataFactoryPackageStore(string name, EntityReference packageStoreLinkedSe PackageStoreLinkedService = packageStoreLinkedService; } + /// Initializes a new instance of . + /// The name of the package store. + /// The package store linked service reference. + /// Keeps track of any properties unknown to the library. + internal DataFactoryPackageStore(string name, EntityReference packageStoreLinkedService, Dictionary serializedAdditionalRawData) + { + Name = name; + PackageStoreLinkedService = packageStoreLinkedService; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPackageStore() + { + } + /// The name of the package store. public string Name { get; set; } /// The package store linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.Serialization.cs index dafa4f3d9a76..0014ab79856c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPatch : IUtf8JsonSerializable + public partial class DataFactoryPatch : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { @@ -41,7 +49,135 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFactoryPatch DeserializeDataFactoryPatch(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + Optional identity = default; + Optional publicNetworkAccess = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new DataFactoryPublicNetworkAccess(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPatch(Optional.ToDictionary(tags), identity, Optional.ToNullable(publicNetworkAccess), serializedAdditionalRawData); + } + + DataFactoryPatch IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPatch(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPatch IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPatch(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPatch model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPatch(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPatch(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.cs index 309fe0550148..456ca6bcb8ed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPatch.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,12 +15,28 @@ namespace Azure.ResourceManager.DataFactory.Models /// Parameters for updating a factory resource. public partial class DataFactoryPatch { - /// Initializes a new instance of DataFactoryPatch. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPatch() { Tags = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The resource tags. + /// Managed service identity of the factory. Current supported identity types: SystemAssigned, UserAssigned, SystemAssigned,UserAssigned. + /// Whether or not public network access is allowed for the data factory. + /// Keeps track of any properties unknown to the library. + internal DataFactoryPatch(IDictionary tags, ManagedServiceIdentity identity, DataFactoryPublicNetworkAccess? publicNetworkAccess, Dictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + PublicNetworkAccess = publicNetworkAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The resource tags. public IDictionary Tags { get; } /// Managed service identity of the factory. Current supported identity types: SystemAssigned, UserAssigned, SystemAssigned,UserAssigned. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineData.Serialization.cs index c43c035ca492..17c34e92d3b1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineData.Serialization.cs @@ -10,15 +10,20 @@ using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryPipelineData : IUtf8JsonSerializable + public partial class DataFactoryPipelineData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -33,7 +38,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Activities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -44,7 +56,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -55,7 +74,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Variables) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -106,12 +132,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -126,8 +166,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryPipelineData DeserializeDataFactoryPipelineData(JsonElement element) + internal static DataFactoryPipelineData DeserializeDataFactoryPipelineData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -316,5 +358,53 @@ internal static DataFactoryPipelineData DeserializeDataFactoryPipelineData(JsonE additionalProperties = additionalPropertiesDictionary; return new DataFactoryPipelineData(id, name, type, systemData.Value, description.Value, Optional.ToList(activities), Optional.ToDictionary(parameters), Optional.ToDictionary(variables), Optional.ToNullable(concurrency), Optional.ToList(annotations), Optional.ToDictionary(runDimensions), folder.Value, policy.Value, Optional.ToNullable(etag), additionalProperties); } + + DataFactoryPipelineData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelineData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelineData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelineData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelineData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelineData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelineData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.Serialization.cs index 711f2cc5994e..0e29de6f3bec 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryPipelineListResult + internal partial class DataFactoryPipelineListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryPipelineListResult DeserializeDataFactoryPipelineListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryPipelineListResult DeserializeDataFactoryPipelineListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryPipelineListResult DeserializeDataFactoryPipelineList nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryPipelineListResult(value, nextLink.Value); + return new DataFactoryPipelineListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryPipelineListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelineListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelineListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelineListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelineListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelineListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelineListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.cs index 7822222c41cd..b8a5d006cc4e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of pipeline resources. internal partial class DataFactoryPipelineListResult { - /// Initializes a new instance of DataFactoryPipelineListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of pipelines. /// is null. internal DataFactoryPipelineListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryPipelineListResult(IEnumerable valu Value = value.ToList(); } - /// Initializes a new instance of DataFactoryPipelineListResult. + /// Initializes a new instance of . /// List of pipelines. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryPipelineListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPipelineListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPipelineListResult() + { } /// List of pipelines. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.Serialization.cs index fe1d73a194ca..b1f889c7c9ca 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.Serialization.cs @@ -5,31 +5,61 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryPipelinePolicy : IUtf8JsonSerializable + internal partial class DataFactoryPipelinePolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ElapsedTimeMetric)) { writer.WritePropertyName("elapsedTimeMetric"u8); - writer.WriteObjectValue(ElapsedTimeMetric); + if (ElapsedTimeMetric is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ElapsedTimeMetric).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryPipelinePolicy DeserializeDataFactoryPipelinePolicy(JsonElement element) + internal static DataFactoryPipelinePolicy DeserializeDataFactoryPipelinePolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional elapsedTimeMetric = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("elapsedTimeMetric"u8)) @@ -41,8 +71,61 @@ internal static DataFactoryPipelinePolicy DeserializeDataFactoryPipelinePolicy(J elapsedTimeMetric = PipelineElapsedTimeMetricPolicy.DeserializePipelineElapsedTimeMetricPolicy(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPipelinePolicy(elapsedTimeMetric.Value, serializedAdditionalRawData); + } + + DataFactoryPipelinePolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelinePolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelinePolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelinePolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelinePolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelinePolicy(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPipelinePolicy(elapsedTimeMetric.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelinePolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.cs index 099d47530ce7..4603f502fe22 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelinePolicy.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Pipeline Policy. internal partial class DataFactoryPipelinePolicy { - /// Initializes a new instance of DataFactoryPipelinePolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPipelinePolicy() { } - /// Initializes a new instance of DataFactoryPipelinePolicy. + /// Initializes a new instance of . /// Pipeline ElapsedTime Metric Policy. - internal DataFactoryPipelinePolicy(PipelineElapsedTimeMetricPolicy elapsedTimeMetric) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPipelinePolicy(PipelineElapsedTimeMetricPolicy elapsedTimeMetric, Dictionary serializedAdditionalRawData) { ElapsedTimeMetric = elapsedTimeMetric; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Pipeline ElapsedTime Metric Policy. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.Serialization.cs index 1ef351f0ebd1..82038fdaf249 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPipelineReference : IUtf8JsonSerializable + public partial class DataFactoryPipelineReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryPipelineReference DeserializeDataFactoryPipelineReference(JsonElement element) + internal static DataFactoryPipelineReference DeserializeDataFactoryPipelineReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static DataFactoryPipelineReference DeserializeDataFactoryPipelineRefer DataFactoryPipelineReferenceType type = default; string referenceName = default; Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -53,8 +76,61 @@ internal static DataFactoryPipelineReference DeserializeDataFactoryPipelineRefer name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPipelineReference(type, referenceName, name.Value, serializedAdditionalRawData); + } + + DataFactoryPipelineReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelineReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelineReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelineReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelineReference model) + { + if (model is null) + { + return null; } - return new DataFactoryPipelineReference(type, referenceName, name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelineReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelineReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.cs index ba4374562b5c..f50cf3c830f9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Pipeline reference type. public partial class DataFactoryPipelineReference { - /// Initializes a new instance of DataFactoryPipelineReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Pipeline reference type. /// Reference pipeline name. /// is null. @@ -25,15 +29,22 @@ public DataFactoryPipelineReference(DataFactoryPipelineReferenceType referenceTy ReferenceName = referenceName; } - /// Initializes a new instance of DataFactoryPipelineReference. + /// Initializes a new instance of . /// Pipeline reference type. /// Reference pipeline name. /// Reference name. - internal DataFactoryPipelineReference(DataFactoryPipelineReferenceType referenceType, string referenceName, string name) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPipelineReference(DataFactoryPipelineReferenceType referenceType, string referenceName, string name, Dictionary serializedAdditionalRawData) { ReferenceType = referenceType; ReferenceName = referenceName; Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPipelineReference() + { } /// Pipeline reference type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.Serialization.cs index d15ff890bb62..ecaead9f2a12 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPipelineRunEntityInfo + public partial class DataFactoryPipelineRunEntityInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryPipelineRunEntityInfo DeserializeDataFactoryPipelineRunEntityInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryPipelineRunEntityInfo DeserializeDataFactoryPipelineRunEntityInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static DataFactoryPipelineRunEntityInfo DeserializeDataFactoryPipelineR Optional invokedByType = default; Optional pipelineName = default; Optional pipelineRunId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -55,8 +83,61 @@ internal static DataFactoryPipelineRunEntityInfo DeserializeDataFactoryPipelineR pipelineRunId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryPipelineRunEntityInfo(name.Value, id.Value, invokedByType.Value, pipelineName.Value, Optional.ToNullable(pipelineRunId)); + return new DataFactoryPipelineRunEntityInfo(name.Value, id.Value, invokedByType.Value, pipelineName.Value, Optional.ToNullable(pipelineRunId), serializedAdditionalRawData); + } + + DataFactoryPipelineRunEntityInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelineRunEntityInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelineRunEntityInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelineRunEntityInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelineRunEntityInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelineRunEntityInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelineRunEntityInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.cs index c5d2dc419574..2d60afa2abaf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunEntityInfo.cs @@ -6,30 +6,36 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Provides entity name and id that started the pipeline run. public partial class DataFactoryPipelineRunEntityInfo { - /// Initializes a new instance of DataFactoryPipelineRunEntityInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFactoryPipelineRunEntityInfo() { } - /// Initializes a new instance of DataFactoryPipelineRunEntityInfo. + /// Initializes a new instance of . /// Name of the entity that started the pipeline run. /// The ID of the entity that started the run. /// The type of the entity that started the run. /// The name of the pipeline that triggered the run, if any. /// The run id of the pipeline that triggered the run, if any. - internal DataFactoryPipelineRunEntityInfo(string name, string id, string invokedByType, string pipelineName, Guid? pipelineRunId) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPipelineRunEntityInfo(string name, string id, string invokedByType, string pipelineName, Guid? pipelineRunId, Dictionary serializedAdditionalRawData) { Name = name; Id = id; InvokedByType = invokedByType; PipelineName = pipelineName; PipelineRunId = pipelineRunId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the entity that started the pipeline run. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.Serialization.cs index 34bdd7e4ab56..41ef67579a23 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPipelineRunInfo + public partial class DataFactoryPipelineRunInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryPipelineRunInfo DeserializeDataFactoryPipelineRunInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static DataFactoryPipelineRunInfo DeserializeDataFactoryPipelineRunInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -153,5 +176,53 @@ internal static DataFactoryPipelineRunInfo DeserializeDataFactoryPipelineRunInfo additionalProperties = additionalPropertiesDictionary; return new DataFactoryPipelineRunInfo(Optional.ToNullable(runId), runGroupId.Value, Optional.ToNullable(isLatest), pipelineName.Value, Optional.ToDictionary(parameters), Optional.ToDictionary(runDimensions), invokedBy.Value, Optional.ToNullable(lastUpdated), Optional.ToNullable(runStart), Optional.ToNullable(runEnd), Optional.ToNullable(durationInMs), status.Value, message.Value, additionalProperties); } + + DataFactoryPipelineRunInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelineRunInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelineRunInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelineRunInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelineRunInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelineRunInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelineRunInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.cs index 74724341b5ad..972d4a709e1b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunInfo.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Information about a pipeline run. public partial class DataFactoryPipelineRunInfo { - /// Initializes a new instance of DataFactoryPipelineRunInfo. + /// Initializes a new instance of . internal DataFactoryPipelineRunInfo() { Parameters = new ChangeTrackingDictionary(); @@ -22,7 +22,7 @@ internal DataFactoryPipelineRunInfo() AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryPipelineRunInfo. + /// Initializes a new instance of . /// Identifier of a run. /// Identifier that correlates all the recovery runs of a pipeline run. /// Indicates if the recovered pipeline run is the latest in its group. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.Serialization.cs index 3bd309ccf4a6..6547cfdfbd69 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryPipelineRunsQueryResult + internal partial class DataFactoryPipelineRunsQueryResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryPipelineRunsQueryResult DeserializeDataFactoryPipelineRunsQueryResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(ContinuationToken)) + { + writer.WritePropertyName("continuationToken"u8); + writer.WriteStringValue(ContinuationToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryPipelineRunsQueryResult DeserializeDataFactoryPipelineRunsQueryResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional continuationToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static DataFactoryPipelineRunsQueryResult DeserializeDataFactoryPipelin continuationToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryPipelineRunsQueryResult(value, continuationToken.Value); + return new DataFactoryPipelineRunsQueryResult(value, continuationToken.Value, serializedAdditionalRawData); + } + + DataFactoryPipelineRunsQueryResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPipelineRunsQueryResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPipelineRunsQueryResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPipelineRunsQueryResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPipelineRunsQueryResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPipelineRunsQueryResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPipelineRunsQueryResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.cs index d1f0c2ab37a7..2ee977a83e8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPipelineRunsQueryResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list pipeline runs. internal partial class DataFactoryPipelineRunsQueryResult { - /// Initializes a new instance of DataFactoryPipelineRunsQueryResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of pipeline runs. /// is null. internal DataFactoryPipelineRunsQueryResult(IEnumerable value) @@ -25,13 +28,20 @@ internal DataFactoryPipelineRunsQueryResult(IEnumerable Initializes a new instance of DataFactoryPipelineRunsQueryResult. + /// Initializes a new instance of . /// List of pipeline runs. /// The continuation token for getting the next page of results, if any remaining results exist, null otherwise. - internal DataFactoryPipelineRunsQueryResult(IReadOnlyList value, string continuationToken) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPipelineRunsQueryResult(IReadOnlyList value, string continuationToken, Dictionary serializedAdditionalRawData) { Value = value; ContinuationToken = continuationToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPipelineRunsQueryResult() + { } /// List of pipeline runs. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs index df10f1ad3d90..47f450ffeb84 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.Serialization.cs @@ -5,28 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPrivateEndpointConnectionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class DataFactoryPrivateEndpointConnectionCreateOrUpdateContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryPrivateEndpointConnectionCreateOrUpdateContent DeserializeDataFactoryPrivateEndpointConnectionCreateOrUpdateContent(JsonElement element) + internal static DataFactoryPrivateEndpointConnectionCreateOrUpdateContent DeserializeDataFactoryPrivateEndpointConnectionCreateOrUpdateContent(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +65,7 @@ internal static DataFactoryPrivateEndpointConnectionCreateOrUpdateContent Deseri string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -81,8 +110,61 @@ internal static DataFactoryPrivateEndpointConnectionCreateOrUpdateContent Deseri systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPrivateEndpointConnectionCreateOrUpdateContent(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryPrivateEndpointConnectionCreateOrUpdateContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointConnectionCreateOrUpdateContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointConnectionCreateOrUpdateContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointConnectionCreateOrUpdateContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointConnectionCreateOrUpdateContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointConnectionCreateOrUpdateContent(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPrivateEndpointConnectionCreateOrUpdateContent(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointConnectionCreateOrUpdateContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.cs index 76cfea8b44d2..6ae5a4d1cb9a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionCreateOrUpdateContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,22 +16,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// Private Endpoint Connection Approval ARM resource. public partial class DataFactoryPrivateEndpointConnectionCreateOrUpdateContent : ResourceData { - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionCreateOrUpdateContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPrivateEndpointConnectionCreateOrUpdateContent() { } - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionCreateOrUpdateContent. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Core resource properties. /// Etag identifies change in the resource. - internal DataFactoryPrivateEndpointConnectionCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateLinkConnectionApprovalRequest properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateEndpointConnectionCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateLinkConnectionApprovalRequest properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Core resource properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionData.Serialization.cs index f929ed8a58c4..254d0af983dc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionData.Serialization.cs @@ -5,29 +5,57 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryPrivateEndpointConnectionData : IUtf8JsonSerializable + public partial class DataFactoryPrivateEndpointConnectionData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryPrivateEndpointConnectionData DeserializeDataFactoryPrivateEndpointConnectionData(JsonElement element) + internal static DataFactoryPrivateEndpointConnectionData DeserializeDataFactoryPrivateEndpointConnectionData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +66,7 @@ internal static DataFactoryPrivateEndpointConnectionData DeserializeDataFactoryP string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -82,8 +111,61 @@ internal static DataFactoryPrivateEndpointConnectionData DeserializeDataFactoryP systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPrivateEndpointConnectionData(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryPrivateEndpointConnectionData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointConnectionData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointConnectionData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointConnectionData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointConnectionData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointConnectionData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPrivateEndpointConnectionData(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointConnectionData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.Serialization.cs index 80a39df6563f..127cbc37b2ef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryPrivateEndpointConnectionListResult + internal partial class DataFactoryPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryPrivateEndpointConnectionListResult DeserializeDataFactoryPrivateEndpointConnectionListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryPrivateEndpointConnectionListResult DeserializeDataFactoryPrivateEndpointConnectionListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryPrivateEndpointConnectionListResult DeserializeDataFa nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryPrivateEndpointConnectionListResult(value, nextLink.Value); + return new DataFactoryPrivateEndpointConnectionListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryPrivateEndpointConnectionListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointConnectionListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointConnectionListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointConnectionListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointConnectionListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointConnectionListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.cs index 4c868be6e3e6..bbb106967338 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of linked service resources. internal partial class DataFactoryPrivateEndpointConnectionListResult { - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of Private Endpoint Connections. /// is null. internal DataFactoryPrivateEndpointConnectionListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryPrivateEndpointConnectionListResult(IEnumerable Initializes a new instance of DataFactoryPrivateEndpointConnectionListResult. + /// Initializes a new instance of . /// List of Private Endpoint Connections. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPrivateEndpointConnectionListResult() + { } /// List of Private Endpoint Connections. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.Serialization.cs index 0d7d3a2f269e..856c90cd4111 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPrivateEndpointConnectionProperties : IUtf8JsonSerializable + public partial class DataFactoryPrivateEndpointConnectionProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PrivateEndpoint)) { @@ -24,13 +32,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState); + if (PrivateLinkServiceConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrivateLinkServiceConnectionState).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryPrivateEndpointConnectionProperties DeserializeDataFactoryPrivateEndpointConnectionProperties(JsonElement element) + internal static DataFactoryPrivateEndpointConnectionProperties DeserializeDataFactoryPrivateEndpointConnectionProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -38,6 +67,7 @@ internal static DataFactoryPrivateEndpointConnectionProperties DeserializeDataFa Optional provisioningState = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -63,8 +93,61 @@ internal static DataFactoryPrivateEndpointConnectionProperties DeserializeDataFa privateLinkServiceConnectionState = PrivateLinkConnectionState.DeserializePrivateLinkConnectionState(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPrivateEndpointConnectionProperties(provisioningState.Value, privateEndpoint, privateLinkServiceConnectionState.Value, serializedAdditionalRawData); + } + + DataFactoryPrivateEndpointConnectionProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointConnectionProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointConnectionProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointConnectionProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointConnectionProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointConnectionProperties(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPrivateEndpointConnectionProperties(provisioningState.Value, privateEndpoint, privateLinkServiceConnectionState.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointConnectionProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.cs index 306755b01a70..f257372af5ce 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointConnectionProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,20 +15,25 @@ namespace Azure.ResourceManager.DataFactory.Models /// A remote private endpoint connection. public partial class DataFactoryPrivateEndpointConnectionProperties { - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPrivateEndpointConnectionProperties() { } - /// Initializes a new instance of DataFactoryPrivateEndpointConnectionProperties. + /// Initializes a new instance of . /// /// PrivateEndpoint of a remote private endpoint connection. /// The state of a private link connection. - internal DataFactoryPrivateEndpointConnectionProperties(string provisioningState, SubResource privateEndpoint, PrivateLinkConnectionState privateLinkServiceConnectionState) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateEndpointConnectionProperties(string provisioningState, SubResource privateEndpoint, PrivateLinkConnectionState privateLinkServiceConnectionState, Dictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the provisioning state. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointData.Serialization.cs index d6b9375e83e1..8e06901caf78 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryPrivateEndpointData : IUtf8JsonSerializable + public partial class DataFactoryPrivateEndpointData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryPrivateEndpointData DeserializeDataFactoryPrivateEndpointData(JsonElement element) + internal static DataFactoryPrivateEndpointData DeserializeDataFactoryPrivateEndpointData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryPrivateEndpointData DeserializeDataFactoryPrivateEndp string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryPrivateEndpointData DeserializeDataFactoryPrivateEndp systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPrivateEndpointData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryPrivateEndpointData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPrivateEndpointData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.Serialization.cs index 03ac440833bf..ff0af4c8ea0a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryPrivateEndpointListResult + internal partial class DataFactoryPrivateEndpointListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryPrivateEndpointListResult DeserializeDataFactoryPrivateEndpointListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryPrivateEndpointListResult DeserializeDataFactoryPrivateEndpointListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryPrivateEndpointListResult DeserializeDataFactoryPriva nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryPrivateEndpointListResult(value, nextLink.Value); + return new DataFactoryPrivateEndpointListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryPrivateEndpointListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.cs index 08d5b9d91563..de5b5d1e96a0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of managed private endpoint resources. internal partial class DataFactoryPrivateEndpointListResult { - /// Initializes a new instance of DataFactoryPrivateEndpointListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of managed private endpoints. /// is null. internal DataFactoryPrivateEndpointListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryPrivateEndpointListResult(IEnumerable Initializes a new instance of DataFactoryPrivateEndpointListResult. + /// Initializes a new instance of . /// List of managed private endpoints. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryPrivateEndpointListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateEndpointListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryPrivateEndpointListResult() + { } /// List of managed private endpoints. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.Serialization.cs index 8cc263c957b2..3feec1a8c164 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPrivateEndpointProperties : IUtf8JsonSerializable + public partial class DataFactoryPrivateEndpointProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConnectionState)) { writer.WritePropertyName("connectionState"u8); - writer.WriteObjectValue(ConnectionState); + if (ConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectionState).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(Fqdns)) { @@ -54,8 +67,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryPrivateEndpointProperties DeserializeDataFactoryPrivateEndpointProperties(JsonElement element) + internal static DataFactoryPrivateEndpointProperties DeserializeDataFactoryPrivateEndpointProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -126,5 +141,53 @@ internal static DataFactoryPrivateEndpointProperties DeserializeDataFactoryPriva additionalProperties = additionalPropertiesDictionary; return new DataFactoryPrivateEndpointProperties(connectionState.Value, Optional.ToList(fqdns), groupId.Value, Optional.ToNullable(isReserved), privateLinkResourceId.Value, provisioningState.Value, additionalProperties); } + + DataFactoryPrivateEndpointProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateEndpointProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateEndpointProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateEndpointProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateEndpointProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateEndpointProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateEndpointProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.cs index 93e8a365995a..b1656d1be544 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateEndpointProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Properties of a managed private endpoint. public partial class DataFactoryPrivateEndpointProperties { - /// Initializes a new instance of DataFactoryPrivateEndpointProperties. + /// Initializes a new instance of . public DataFactoryPrivateEndpointProperties() { Fqdns = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryPrivateEndpointProperties. + /// Initializes a new instance of . /// The managed private endpoint connection state. /// Fully qualified domain names. /// The groupId to which the managed private endpoint is created. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.Serialization.cs index a9ed91637c44..59e26acfdf1a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.Serialization.cs @@ -5,28 +5,56 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPrivateLinkResource : IUtf8JsonSerializable + public partial class DataFactoryPrivateLinkResource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFactoryPrivateLinkResource DeserializeDataFactoryPrivateLinkResource(JsonElement element) + internal static DataFactoryPrivateLinkResource DeserializeDataFactoryPrivateLinkResource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +65,7 @@ internal static DataFactoryPrivateLinkResource DeserializeDataFactoryPrivateLink string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -81,8 +110,61 @@ internal static DataFactoryPrivateLinkResource DeserializeDataFactoryPrivateLink systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPrivateLinkResource(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryPrivateLinkResource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateLinkResource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateLinkResource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateLinkResource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateLinkResource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateLinkResource(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryPrivateLinkResource(id, name, type, systemData.Value, properties.Value, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateLinkResource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.cs index 10be5aced8cd..02c32d6426ea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResource.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,22 +16,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// A private link resource. public partial class DataFactoryPrivateLinkResource : ResourceData { - /// Initializes a new instance of DataFactoryPrivateLinkResource. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPrivateLinkResource() { } - /// Initializes a new instance of DataFactoryPrivateLinkResource. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Core resource properties. /// Etag identifies change in the resource. - internal DataFactoryPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryPrivateLinkResourceProperties properties, ETag? eTag) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataFactoryPrivateLinkResourceProperties properties, ETag? eTag, Dictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; ETag = eTag; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Core resource properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.Serialization.cs index d181cff6d3ef..28a47fdc7c61 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.Serialization.cs @@ -5,22 +5,43 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryPrivateLinkResourceProperties : IUtf8JsonSerializable + public partial class DataFactoryPrivateLinkResourceProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryPrivateLinkResourceProperties DeserializeDataFactoryPrivateLinkResourceProperties(JsonElement element) + internal static DataFactoryPrivateLinkResourceProperties DeserializeDataFactoryPrivateLinkResourceProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -28,6 +49,7 @@ internal static DataFactoryPrivateLinkResourceProperties DeserializeDataFactoryP Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("groupId"u8)) @@ -63,8 +85,61 @@ internal static DataFactoryPrivateLinkResourceProperties DeserializeDataFactoryP requiredZoneNames = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames), serializedAdditionalRawData); + } + + DataFactoryPrivateLinkResourceProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPrivateLinkResourceProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPrivateLinkResourceProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPrivateLinkResourceProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPrivateLinkResourceProperties model) + { + if (model is null) + { + return null; } - return new DataFactoryPrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPrivateLinkResourceProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPrivateLinkResourceProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.cs index 721f11f1889e..e7493a86572e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPrivateLinkResourceProperties.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// Properties of a private link resource. public partial class DataFactoryPrivateLinkResourceProperties { - /// Initializes a new instance of DataFactoryPrivateLinkResourceProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPrivateLinkResourceProperties() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of DataFactoryPrivateLinkResourceProperties. + /// Initializes a new instance of . /// GroupId of a private link resource. /// RequiredMembers of a private link resource. /// RequiredZoneNames of a private link resource. - internal DataFactoryPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, Dictionary serializedAdditionalRawData) { GroupId = groupId; RequiredMembers = requiredMembers; RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// GroupId of a private link resource. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.Serialization.cs index fbc96afdc9b0..829fb422b2f0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryPurviewConfiguration : IUtf8JsonSerializable + internal partial class DataFactoryPurviewConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PurviewResourceId)) { writer.WritePropertyName("purviewResourceId"u8); writer.WriteStringValue(PurviewResourceId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryPurviewConfiguration DeserializeDataFactoryPurviewConfiguration(JsonElement element) + internal static DataFactoryPurviewConfiguration DeserializeDataFactoryPurviewConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional purviewResourceId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("purviewResourceId"u8)) @@ -41,8 +64,61 @@ internal static DataFactoryPurviewConfiguration DeserializeDataFactoryPurviewCon purviewResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryPurviewConfiguration(purviewResourceId.Value, serializedAdditionalRawData); + } + + DataFactoryPurviewConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryPurviewConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryPurviewConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryPurviewConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryPurviewConfiguration model) + { + if (model is null) + { + return null; } - return new DataFactoryPurviewConfiguration(purviewResourceId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryPurviewConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryPurviewConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.cs index 3fc82a5902ab..55de8156325d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryPurviewConfiguration.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.DataFactory.Models /// Purview configuration. internal partial class DataFactoryPurviewConfiguration { - /// Initializes a new instance of DataFactoryPurviewConfiguration. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFactoryPurviewConfiguration() { } - /// Initializes a new instance of DataFactoryPurviewConfiguration. + /// Initializes a new instance of . /// Purview resource id. - internal DataFactoryPurviewConfiguration(ResourceIdentifier purviewResourceId) + /// Keeps track of any properties unknown to the library. + internal DataFactoryPurviewConfiguration(ResourceIdentifier purviewResourceId, Dictionary serializedAdditionalRawData) { PurviewResourceId = purviewResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Purview resource id. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.Serialization.cs index f9802da43d70..77d94fab4d11 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryRecurrenceSchedule : IUtf8JsonSerializable + public partial class DataFactoryRecurrenceSchedule : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Minutes)) { @@ -63,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in MonthlyOccurrences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -79,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryRecurrenceSchedule DeserializeDataFactoryRecurrenceSchedule(JsonElement element) + internal static DataFactoryRecurrenceSchedule DeserializeDataFactoryRecurrenceSchedule(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -169,5 +184,53 @@ internal static DataFactoryRecurrenceSchedule DeserializeDataFactoryRecurrenceSc additionalProperties = additionalPropertiesDictionary; return new DataFactoryRecurrenceSchedule(Optional.ToList(minutes), Optional.ToList(hours), Optional.ToList(weekDays), Optional.ToList(monthDays), Optional.ToList(monthlyOccurrences), additionalProperties); } + + DataFactoryRecurrenceSchedule IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryRecurrenceSchedule(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryRecurrenceSchedule IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryRecurrenceSchedule(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryRecurrenceSchedule model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryRecurrenceSchedule(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryRecurrenceSchedule(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.cs index fd5775ff6d3d..e6c223749d25 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceSchedule.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The recurrence schedule. public partial class DataFactoryRecurrenceSchedule { - /// Initializes a new instance of DataFactoryRecurrenceSchedule. + /// Initializes a new instance of . public DataFactoryRecurrenceSchedule() { Minutes = new ChangeTrackingList(); @@ -25,7 +25,7 @@ public DataFactoryRecurrenceSchedule() AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryRecurrenceSchedule. + /// Initializes a new instance of . /// The minutes. /// The hours. /// The days of the week. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.Serialization.cs index 598520826558..6135f078a0b9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryRecurrenceScheduleOccurrence : IUtf8JsonSerializable + public partial class DataFactoryRecurrenceScheduleOccurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Day)) { @@ -39,8 +45,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryRecurrenceScheduleOccurrence DeserializeDataFactoryRecurrenceScheduleOccurrence(JsonElement element) + internal static DataFactoryRecurrenceScheduleOccurrence DeserializeDataFactoryRecurrenceScheduleOccurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,5 +82,53 @@ internal static DataFactoryRecurrenceScheduleOccurrence DeserializeDataFactoryRe additionalProperties = additionalPropertiesDictionary; return new DataFactoryRecurrenceScheduleOccurrence(Optional.ToNullable(day), Optional.ToNullable(occurrence), additionalProperties); } + + DataFactoryRecurrenceScheduleOccurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryRecurrenceScheduleOccurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryRecurrenceScheduleOccurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryRecurrenceScheduleOccurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryRecurrenceScheduleOccurrence model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryRecurrenceScheduleOccurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryRecurrenceScheduleOccurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.cs index 8d2467a1ea82..32f28b7e4214 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryRecurrenceScheduleOccurrence.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The recurrence schedule occurrence. public partial class DataFactoryRecurrenceScheduleOccurrence { - /// Initializes a new instance of DataFactoryRecurrenceScheduleOccurrence. + /// Initializes a new instance of . public DataFactoryRecurrenceScheduleOccurrence() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryRecurrenceScheduleOccurrence. + /// Initializes a new instance of . /// The day of the week. /// The occurrence. /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.Serialization.cs index 1a03020402f7..cb50fe783ae7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryScheduleTrigger : IUtf8JsonSerializable + public partial class DataFactoryScheduleTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Pipelines)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pipelines) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -56,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("recurrence"u8); - writer.WriteObjectValue(Recurrence); + if (Recurrence is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recurrence).Serialize(writer, options); + } writer.WriteEndObject(); foreach (var item in AdditionalProperties) { @@ -70,8 +90,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryScheduleTrigger DeserializeDataFactoryScheduleTrigger(JsonElement element) + internal static DataFactoryScheduleTrigger DeserializeDataFactoryScheduleTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +184,53 @@ internal static DataFactoryScheduleTrigger DeserializeDataFactoryScheduleTrigger additionalProperties = additionalPropertiesDictionary; return new DataFactoryScheduleTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, Optional.ToList(pipelines), recurrence); } + + DataFactoryScheduleTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryScheduleTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryScheduleTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryScheduleTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryScheduleTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryScheduleTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryScheduleTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.cs index f3d04419511e..2a0ef751fbe2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScheduleTrigger.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger that creates pipeline runs periodically, on schedule. public partial class DataFactoryScheduleTrigger : MultiplePipelineTrigger { - /// Initializes a new instance of DataFactoryScheduleTrigger. + /// Initializes a new instance of . /// Recurrence schedule configuration. /// is null. public DataFactoryScheduleTrigger(ScheduleTriggerRecurrence recurrence) @@ -25,7 +25,7 @@ public DataFactoryScheduleTrigger(ScheduleTriggerRecurrence recurrence) TriggerType = "ScheduleTrigger"; } - /// Initializes a new instance of DataFactoryScheduleTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. @@ -39,6 +39,11 @@ internal DataFactoryScheduleTrigger(string triggerType, string description, Data TriggerType = triggerType ?? "ScheduleTrigger"; } + /// Initializes a new instance of for deserialization. + internal DataFactoryScheduleTrigger() + { + } + /// Recurrence schedule configuration. public ScheduleTriggerRecurrence Recurrence { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.Serialization.cs index 917a848c1c15..bacdb27c06d2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryScriptAction : IUtf8JsonSerializable + public partial class DataFactoryScriptAction : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -31,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteStringValue(Parameters); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryScriptAction DeserializeDataFactoryScriptAction(JsonElement element) + internal static DataFactoryScriptAction DeserializeDataFactoryScriptAction(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -44,6 +65,7 @@ internal static DataFactoryScriptAction DeserializeDataFactoryScriptAction(JsonE Uri uri = default; BinaryData roles = default; Optional parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -66,8 +88,61 @@ internal static DataFactoryScriptAction DeserializeDataFactoryScriptAction(JsonE parameters = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryScriptAction(name, uri, roles, parameters.Value); + return new DataFactoryScriptAction(name, uri, roles, parameters.Value, serializedAdditionalRawData); + } + + DataFactoryScriptAction IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryScriptAction(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryScriptAction IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryScriptAction(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryScriptAction model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryScriptAction(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryScriptAction(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.cs index a185feba0f59..c6bb8c37c0be 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptAction.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Custom script action to run on HDI ondemand cluster once it's up. public partial class DataFactoryScriptAction { - /// Initializes a new instance of DataFactoryScriptAction. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The user provided name of the script action. /// The URI for the script action. /// The node types on which the script action should be executed. @@ -29,17 +33,24 @@ public DataFactoryScriptAction(string name, Uri uri, BinaryData roles) Roles = roles; } - /// Initializes a new instance of DataFactoryScriptAction. + /// Initializes a new instance of . /// The user provided name of the script action. /// The URI for the script action. /// The node types on which the script action should be executed. /// The parameters for the script action. - internal DataFactoryScriptAction(string name, Uri uri, BinaryData roles, string parameters) + /// Keeps track of any properties unknown to the library. + internal DataFactoryScriptAction(string name, Uri uri, BinaryData roles, string parameters, Dictionary serializedAdditionalRawData) { Name = name; Uri = uri; Roles = roles; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryScriptAction() + { } /// The user provided name of the script action. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.Serialization.cs index 89a37d553d1b..4dd58c9eb345 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryScriptActivity : IUtf8JsonSerializable + public partial class DataFactoryScriptActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -80,14 +107,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Scripts) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(LogSettings)) { writer.WritePropertyName("logSettings"u8); - writer.WriteObjectValue(LogSettings); + if (LogSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogSettings).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -102,8 +143,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryScriptActivity DeserializeDataFactoryScriptActivity(JsonElement element) + internal static DataFactoryScriptActivity DeserializeDataFactoryScriptActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -252,5 +295,53 @@ internal static DataFactoryScriptActivity DeserializeDataFactoryScriptActivity(J additionalProperties = additionalPropertiesDictionary; return new DataFactoryScriptActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, scriptBlockExecutionTimeout.Value, Optional.ToList(scripts), logSettings.Value); } + + DataFactoryScriptActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryScriptActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryScriptActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryScriptActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryScriptActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryScriptActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryScriptActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.cs index 422290d969db..df77d2d1c6de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryScriptActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Script activity type. public partial class DataFactoryScriptActivity : ExecutionActivity { - /// Initializes a new instance of DataFactoryScriptActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public DataFactoryScriptActivity(string name) : base(name) @@ -26,7 +26,7 @@ public DataFactoryScriptActivity(string name) : base(name) ActivityType = "Script"; } - /// Initializes a new instance of DataFactoryScriptActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -48,6 +48,11 @@ internal DataFactoryScriptActivity(string name, string activityType, string desc ActivityType = activityType ?? "Script"; } + /// Initializes a new instance of for deserialization. + internal DataFactoryScriptActivity() + { + } + /// ScriptBlock execution timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). public DataFactoryElement ScriptBlockExecutionTimeout { get; set; } /// Array of script blocks. Type: array. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerData.Serialization.cs index b8b88466d9c5..3c892734a836 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerData.Serialization.cs @@ -5,26 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DataFactory { - public partial class DataFactoryTriggerData : IUtf8JsonSerializable + public partial class DataFactoryTriggerData : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); + if (Properties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Properties).Serialize(writer, options); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryTriggerData DeserializeDataFactoryTriggerData(JsonElement element) + internal static DataFactoryTriggerData DeserializeDataFactoryTriggerData(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,6 +63,7 @@ internal static DataFactoryTriggerData DeserializeDataFactoryTriggerData(JsonEle string name = default; ResourceType type = default; Optional systemData = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties"u8)) @@ -75,8 +104,61 @@ internal static DataFactoryTriggerData DeserializeDataFactoryTriggerData(JsonEle systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryTriggerData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag), serializedAdditionalRawData); + } + + DataFactoryTriggerData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerData(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryTriggerData(id, name, type, systemData.Value, properties, Optional.ToNullable(etag)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.Serialization.cs index aeb08e94c2e0..ccb18c9dd984 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryTriggerListResult + internal partial class DataFactoryTriggerListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryTriggerListResult DeserializeDataFactoryTriggerListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryTriggerListResult DeserializeDataFactoryTriggerListResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryTriggerListResult DeserializeDataFactoryTriggerListRe nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryTriggerListResult(value, nextLink.Value); + return new DataFactoryTriggerListResult(value, nextLink.Value, serializedAdditionalRawData); + } + + DataFactoryTriggerListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.cs index 26f3c6c76d28..e689c74a2e66 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerListResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of trigger resources. internal partial class DataFactoryTriggerListResult { - /// Initializes a new instance of DataFactoryTriggerListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of triggers. /// is null. internal DataFactoryTriggerListResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryTriggerListResult(IEnumerable value) Value = value.ToList(); } - /// Initializes a new instance of DataFactoryTriggerListResult. + /// Initializes a new instance of . /// List of triggers. /// The link to the next page of results, if any remaining results exist. - internal DataFactoryTriggerListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFactoryTriggerListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryTriggerListResult() + { } /// List of triggers. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.Serialization.cs index ceec2b0e2bd1..decac2386333 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryTriggerProperties : IUtf8JsonSerializable + public partial class DataFactoryTriggerProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(TriggerType); @@ -53,8 +61,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFactoryTriggerProperties DeserializeDataFactoryTriggerProperties(JsonElement element) + internal static DataFactoryTriggerProperties DeserializeDataFactoryTriggerProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,7 +83,108 @@ internal static DataFactoryTriggerProperties DeserializeDataFactoryTriggerProper case "TumblingWindowTrigger": return TumblingWindowTrigger.DeserializeTumblingWindowTrigger(element); } } - return UnknownTrigger.DeserializeUnknownTrigger(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional description = default; + Optional runtimeState = default; + Optional> annotations = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("runtimeState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runtimeState = new DataFactoryTriggerRuntimeState(property.Value.GetString()); + continue; + } + if (property.NameEquals("annotations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(BinaryData.FromString(item.GetRawText())); + } + } + annotations = array; + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties); + } + + DataFactoryTriggerProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.cs index a6713a98ff60..0ca64cbeb935 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerProperties.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DataFactoryTriggerProperties { - /// Initializes a new instance of DataFactoryTriggerProperties. + /// Initializes a new instance of . public DataFactoryTriggerProperties() { Annotations = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryTriggerProperties. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.Serialization.cs index 58e6783a4235..938a2c7574a7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.Serialization.cs @@ -5,23 +5,70 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.DataFactory; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryTriggerQueryResult + internal partial class DataFactoryTriggerQueryResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryTriggerQueryResult DeserializeDataFactoryTriggerQueryResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(ContinuationToken)) + { + writer.WritePropertyName("continuationToken"u8); + writer.WriteStringValue(ContinuationToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryTriggerQueryResult DeserializeDataFactoryTriggerQueryResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional continuationToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -39,8 +86,61 @@ internal static DataFactoryTriggerQueryResult DeserializeDataFactoryTriggerQuery continuationToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryTriggerQueryResult(value, continuationToken.Value); + return new DataFactoryTriggerQueryResult(value, continuationToken.Value, serializedAdditionalRawData); + } + + DataFactoryTriggerQueryResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerQueryResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerQueryResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerQueryResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerQueryResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerQueryResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerQueryResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.cs index efa558891af1..c70aa6b60df2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerQueryResult.cs @@ -16,7 +16,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A query of triggers. internal partial class DataFactoryTriggerQueryResult { - /// Initializes a new instance of DataFactoryTriggerQueryResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of triggers. /// is null. internal DataFactoryTriggerQueryResult(IEnumerable value) @@ -26,13 +29,20 @@ internal DataFactoryTriggerQueryResult(IEnumerable value Value = value.ToList(); } - /// Initializes a new instance of DataFactoryTriggerQueryResult. + /// Initializes a new instance of . /// List of triggers. /// The continuation token for getting the next page of results, if any remaining results exist, null otherwise. - internal DataFactoryTriggerQueryResult(IReadOnlyList value, string continuationToken) + /// Keeps track of any properties unknown to the library. + internal DataFactoryTriggerQueryResult(IReadOnlyList value, string continuationToken, Dictionary serializedAdditionalRawData) { Value = value; ContinuationToken = continuationToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryTriggerQueryResult() + { } /// List of triggers. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.Serialization.cs index 296ff0fb02dd..dfda6f5d1dbb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryTriggerReference : IUtf8JsonSerializable + public partial class DataFactoryTriggerReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("referenceName"u8); writer.WriteStringValue(ReferenceName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryTriggerReference DeserializeDataFactoryTriggerReference(JsonElement element) + internal static DataFactoryTriggerReference DeserializeDataFactoryTriggerReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactoryTriggerReferenceType type = default; string referenceName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -42,8 +65,61 @@ internal static DataFactoryTriggerReference DeserializeDataFactoryTriggerReferen referenceName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryTriggerReference(type, referenceName, serializedAdditionalRawData); + } + + DataFactoryTriggerReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerReference model) + { + if (model is null) + { + return null; } - return new DataFactoryTriggerReference(type, referenceName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.cs index 4b02f0c63969..6f18af098efb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger reference type. public partial class DataFactoryTriggerReference { - /// Initializes a new instance of DataFactoryTriggerReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Trigger reference type. /// Reference trigger name. /// is null. @@ -25,6 +29,22 @@ public DataFactoryTriggerReference(DataFactoryTriggerReferenceType referenceType ReferenceName = referenceName; } + /// Initializes a new instance of . + /// Trigger reference type. + /// Reference trigger name. + /// Keeps track of any properties unknown to the library. + internal DataFactoryTriggerReference(DataFactoryTriggerReferenceType referenceType, string referenceName, Dictionary serializedAdditionalRawData) + { + ReferenceType = referenceType; + ReferenceName = referenceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryTriggerReference() + { + } + /// Trigger reference type. public DataFactoryTriggerReferenceType ReferenceType { get; set; } /// Reference trigger name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.Serialization.cs index cfdb537990d8..5c1191b5743d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryTriggerRun + public partial class DataFactoryTriggerRun : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryTriggerRun DeserializeDataFactoryTriggerRun(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static DataFactoryTriggerRun DeserializeDataFactoryTriggerRun(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -140,5 +163,53 @@ internal static DataFactoryTriggerRun DeserializeDataFactoryTriggerRun(JsonEleme additionalProperties = additionalPropertiesDictionary; return new DataFactoryTriggerRun(triggerRunId.Value, triggerName.Value, triggerType.Value, Optional.ToNullable(triggerRunTimestamp), Optional.ToNullable(status), message.Value, Optional.ToDictionary(properties), Optional.ToDictionary(triggeredPipelines), Optional.ToDictionary(runDimension), Optional.ToDictionary(dependencyStatus), additionalProperties); } + + DataFactoryTriggerRun IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerRun(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerRun IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerRun(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerRun model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerRun(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerRun(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.cs index dc6010a1a4a8..54043608da50 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRun.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger runs. public partial class DataFactoryTriggerRun { - /// Initializes a new instance of DataFactoryTriggerRun. + /// Initializes a new instance of . internal DataFactoryTriggerRun() { Properties = new ChangeTrackingDictionary(); @@ -24,7 +24,7 @@ internal DataFactoryTriggerRun() AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFactoryTriggerRun. + /// Initializes a new instance of . /// Trigger run id. /// Trigger name. /// Trigger type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.Serialization.cs index 143f6f919093..d6b306fff47e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFactoryTriggerRunsQueryResult + internal partial class DataFactoryTriggerRunsQueryResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryTriggerRunsQueryResult DeserializeDataFactoryTriggerRunsQueryResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(ContinuationToken)) + { + writer.WritePropertyName("continuationToken"u8); + writer.WriteStringValue(ContinuationToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryTriggerRunsQueryResult DeserializeDataFactoryTriggerRunsQueryResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional continuationToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static DataFactoryTriggerRunsQueryResult DeserializeDataFactoryTriggerR continuationToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryTriggerRunsQueryResult(value, continuationToken.Value); + return new DataFactoryTriggerRunsQueryResult(value, continuationToken.Value, serializedAdditionalRawData); + } + + DataFactoryTriggerRunsQueryResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerRunsQueryResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerRunsQueryResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerRunsQueryResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerRunsQueryResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerRunsQueryResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerRunsQueryResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.cs index 31c6b5f476ae..5cdc30ae4e82 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerRunsQueryResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of trigger runs. internal partial class DataFactoryTriggerRunsQueryResult { - /// Initializes a new instance of DataFactoryTriggerRunsQueryResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of trigger runs. /// is null. internal DataFactoryTriggerRunsQueryResult(IEnumerable value) @@ -25,13 +28,20 @@ internal DataFactoryTriggerRunsQueryResult(IEnumerable va Value = value.ToList(); } - /// Initializes a new instance of DataFactoryTriggerRunsQueryResult. + /// Initializes a new instance of . /// List of trigger runs. /// The continuation token for getting the next page of results, if any remaining results exist, null otherwise. - internal DataFactoryTriggerRunsQueryResult(IReadOnlyList value, string continuationToken) + /// Keeps track of any properties unknown to the library. + internal DataFactoryTriggerRunsQueryResult(IReadOnlyList value, string continuationToken, Dictionary serializedAdditionalRawData) { Value = value; ContinuationToken = continuationToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFactoryTriggerRunsQueryResult() + { } /// List of trigger runs. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.Serialization.cs index 4f5dee500a2f..b74abdc59207 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryTriggerSubscriptionOperationResult + public partial class DataFactoryTriggerSubscriptionOperationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFactoryTriggerSubscriptionOperationResult DeserializeDataFactoryTriggerSubscriptionOperationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFactoryTriggerSubscriptionOperationResult DeserializeDataFactoryTriggerSubscriptionOperationResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional triggerName = default; Optional status = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("triggerName"u8)) @@ -36,8 +65,61 @@ internal static DataFactoryTriggerSubscriptionOperationResult DeserializeDataFac status = new EventSubscriptionStatus(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFactoryTriggerSubscriptionOperationResult(triggerName.Value, Optional.ToNullable(status)); + return new DataFactoryTriggerSubscriptionOperationResult(triggerName.Value, Optional.ToNullable(status), serializedAdditionalRawData); + } + + DataFactoryTriggerSubscriptionOperationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryTriggerSubscriptionOperationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryTriggerSubscriptionOperationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryTriggerSubscriptionOperationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryTriggerSubscriptionOperationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryTriggerSubscriptionOperationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryTriggerSubscriptionOperationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.cs index 382cf098a591..624d24052947 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryTriggerSubscriptionOperationResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Defines the response of a trigger subscription operation. public partial class DataFactoryTriggerSubscriptionOperationResult { - /// Initializes a new instance of DataFactoryTriggerSubscriptionOperationResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFactoryTriggerSubscriptionOperationResult() { } - /// Initializes a new instance of DataFactoryTriggerSubscriptionOperationResult. + /// Initializes a new instance of . /// Trigger name. /// Event Subscription Status. - internal DataFactoryTriggerSubscriptionOperationResult(string triggerName, EventSubscriptionStatus? status) + /// Keeps track of any properties unknown to the library. + internal DataFactoryTriggerSubscriptionOperationResult(string triggerName, EventSubscriptionStatus? status, Dictionary serializedAdditionalRawData) { TriggerName = triggerName; Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Trigger name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.Serialization.cs index 5425feb0932e..d01e55929077 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFactoryWranglingDataFlowProperties : IUtf8JsonSerializable + public partial class DataFactoryWranglingDataFlowProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DataFlowType); @@ -46,7 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -56,7 +69,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Sources) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -71,11 +91,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DocumentLocale); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFactoryWranglingDataFlowProperties DeserializeDataFactoryWranglingDataFlowProperties(JsonElement element) + internal static DataFactoryWranglingDataFlowProperties DeserializeDataFactoryWranglingDataFlowProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,6 +121,7 @@ internal static DataFactoryWranglingDataFlowProperties DeserializeDataFactoryWra Optional> sources = default; Optional script = default; Optional documentLocale = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -165,8 +200,61 @@ internal static DataFactoryWranglingDataFlowProperties DeserializeDataFactoryWra } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFactoryWranglingDataFlowProperties(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), script.Value, documentLocale.Value, serializedAdditionalRawData); + } + + DataFactoryWranglingDataFlowProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFactoryWranglingDataFlowProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFactoryWranglingDataFlowProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFactoryWranglingDataFlowProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFactoryWranglingDataFlowProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFactoryWranglingDataFlowProperties(Response response) + { + if (response is null) + { + return null; } - return new DataFactoryWranglingDataFlowProperties(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), script.Value, documentLocale.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFactoryWranglingDataFlowProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.cs index 06c1fb427410..89e619fb24f2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFactoryWranglingDataFlowProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Power Query data flow. public partial class DataFactoryWranglingDataFlowProperties : DataFactoryDataFlowProperties { - /// Initializes a new instance of DataFactoryWranglingDataFlowProperties. + /// Initializes a new instance of . public DataFactoryWranglingDataFlowProperties() { Sources = new ChangeTrackingList(); DataFlowType = "WranglingDataFlow"; } - /// Initializes a new instance of DataFactoryWranglingDataFlowProperties. + /// Initializes a new instance of . /// Type of data flow. /// The description of the data flow. /// List of tags that can be used for describing the data flow. @@ -29,7 +29,8 @@ public DataFactoryWranglingDataFlowProperties() /// List of sources in Power Query. /// Power query mashup script. /// Locale of the Power query mashup document. - internal DataFactoryWranglingDataFlowProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, IList sources, string script, string documentLocale) : base(dataFlowType, description, annotations, folder) + /// Keeps track of any properties unknown to the library. + internal DataFactoryWranglingDataFlowProperties(string dataFlowType, string description, IList annotations, DataFlowFolder folder, IList sources, string script, string documentLocale, Dictionary serializedAdditionalRawData) : base(dataFlowType, description, annotations, folder, serializedAdditionalRawData) { Sources = sources; Script = script; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.Serialization.cs index 63cd6cb55db6..7407036e5623 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowDebugCommandContent : IUtf8JsonSerializable + public partial class DataFlowDebugCommandContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SessionId)) { @@ -28,9 +36,126 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CommandPayload)) { writer.WritePropertyName("commandPayload"u8); - writer.WriteObjectValue(CommandPayload); + if (CommandPayload is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CommandPayload).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static DataFlowDebugCommandContent DeserializeDataFlowDebugCommandContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sessionId = default; + Optional command = default; + Optional commandPayload = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sessionId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("command"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + command = new DataFlowDebugCommandType(property.Value.GetString()); + continue; + } + if (property.NameEquals("commandPayload"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + commandPayload = DataFlowDebugCommandPayload.DeserializeDataFlowDebugCommandPayload(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowDebugCommandContent(Optional.ToNullable(sessionId), Optional.ToNullable(command), commandPayload.Value, serializedAdditionalRawData); + } + + DataFlowDebugCommandContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowDebugCommandContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowDebugCommandContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowDebugCommandContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowDebugCommandContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowDebugCommandContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowDebugCommandContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.cs index 6b94c0bb922d..56a44d65c45d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandContent.cs @@ -6,17 +6,34 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Request body structure for data flow debug command. public partial class DataFlowDebugCommandContent { - /// Initializes a new instance of DataFlowDebugCommandContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFlowDebugCommandContent() { } + /// Initializes a new instance of . + /// The ID of data flow debug session. + /// The command type. + /// The command payload object. + /// Keeps track of any properties unknown to the library. + internal DataFlowDebugCommandContent(Guid? sessionId, DataFlowDebugCommandType? command, DataFlowDebugCommandPayload commandPayload, Dictionary serializedAdditionalRawData) + { + SessionId = sessionId; + Command = command; + CommandPayload = commandPayload; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The ID of data flow debug session. public Guid? SessionId { get; set; } /// The command type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.Serialization.cs index 9a2ace108caa..2a1ff96fa944 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowDebugCommandPayload : IUtf8JsonSerializable + public partial class DataFlowDebugCommandPayload : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("streamName"u8); writer.WriteStringValue(StreamName); @@ -37,7 +45,124 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("expression"u8); writer.WriteStringValue(Expression); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFlowDebugCommandPayload DeserializeDataFlowDebugCommandPayload(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string streamName = default; + Optional rowLimits = default; + Optional> columns = default; + Optional expression = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("streamName"u8)) + { + streamName = property.Value.GetString(); + continue; + } + if (property.NameEquals("rowLimits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rowLimits = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("columns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + columns = array; + continue; + } + if (property.NameEquals("expression"u8)) + { + expression = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowDebugCommandPayload(streamName, Optional.ToNullable(rowLimits), Optional.ToList(columns), expression.Value, serializedAdditionalRawData); + } + + DataFlowDebugCommandPayload IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowDebugCommandPayload(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowDebugCommandPayload IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowDebugCommandPayload(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowDebugCommandPayload model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowDebugCommandPayload(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowDebugCommandPayload(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.cs index 1c2221b5a120..bfd5ad485dd2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugCommandPayload.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Structure of command payload. public partial class DataFlowDebugCommandPayload { - /// Initializes a new instance of DataFlowDebugCommandPayload. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The stream name which is used for preview. /// is null. public DataFlowDebugCommandPayload(string streamName) @@ -25,6 +28,26 @@ public DataFlowDebugCommandPayload(string streamName) Columns = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The stream name which is used for preview. + /// Row limits for preview response. + /// Array of column names. + /// The expression which is used for preview. + /// Keeps track of any properties unknown to the library. + internal DataFlowDebugCommandPayload(string streamName, int? rowLimits, IList columns, string expression, Dictionary serializedAdditionalRawData) + { + StreamName = streamName; + RowLimits = rowLimits; + Columns = columns; + Expression = expression; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFlowDebugCommandPayload() + { + } + /// The stream name which is used for preview. public string StreamName { get; } /// Row limits for preview response. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.Serialization.cs index 1478f30ee2fb..5b55ff5af65b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowDebugPackageDebugSettings : IUtf8JsonSerializable + public partial class DataFlowDebugPackageDebugSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(SourceSettings)) { @@ -21,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SourceSettings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -54,7 +69,134 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(DatasetParameters.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DataFlowDebugPackageDebugSettings DeserializeDataFlowDebugPackageDebugSettings(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> sourceSettings = default; + Optional> parameters = default; + Optional datasetParameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataFlowSourceSetting.DeserializeDataFlowSourceSetting(item)); + } + sourceSettings = array; + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + parameters = dictionary; + continue; + } + if (property.NameEquals("datasetParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + datasetParameters = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowDebugPackageDebugSettings(Optional.ToList(sourceSettings), Optional.ToDictionary(parameters), datasetParameters.Value, serializedAdditionalRawData); + } + + DataFlowDebugPackageDebugSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowDebugPackageDebugSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowDebugPackageDebugSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowDebugPackageDebugSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowDebugPackageDebugSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowDebugPackageDebugSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowDebugPackageDebugSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.cs index bb127caf5f6e..ee45cacf13a2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugPackageDebugSettings.cs @@ -14,13 +14,29 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data flow debug settings. public partial class DataFlowDebugPackageDebugSettings { - /// Initializes a new instance of DataFlowDebugPackageDebugSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFlowDebugPackageDebugSettings() { SourceSettings = new ChangeTrackingList(); Parameters = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// Source setting for data flow debug. + /// Data flow parameters. + /// Parameters for dataset. + /// Keeps track of any properties unknown to the library. + internal DataFlowDebugPackageDebugSettings(IList sourceSettings, IDictionary parameters, BinaryData datasetParameters, Dictionary serializedAdditionalRawData) + { + SourceSettings = sourceSettings; + Parameters = parameters; + DatasetParameters = datasetParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Source setting for data flow debug. public IList SourceSettings { get; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.Serialization.cs index add98642b840..410e27f75d33 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.Serialization.cs @@ -8,14 +8,82 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowDebugSessionInfo + public partial class DataFlowDebugSessionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFlowDebugSessionInfo DeserializeDataFlowDebugSessionInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DataFlowName)) + { + writer.WritePropertyName("dataFlowName"u8); + writer.WriteStringValue(DataFlowName); + } + if (Optional.IsDefined(ComputeType)) + { + writer.WritePropertyName("computeType"u8); + writer.WriteStringValue(ComputeType); + } + if (Optional.IsDefined(CoreCount)) + { + writer.WritePropertyName("coreCount"u8); + writer.WriteNumberValue(CoreCount.Value); + } + if (Optional.IsDefined(NodeCount)) + { + writer.WritePropertyName("nodeCount"u8); + writer.WriteNumberValue(NodeCount.Value); + } + if (Optional.IsDefined(IntegrationRuntimeName)) + { + writer.WritePropertyName("integrationRuntimeName"u8); + writer.WriteStringValue(IntegrationRuntimeName); + } + if (Optional.IsDefined(SessionId)) + { + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(TimeToLiveInMinutes)) + { + writer.WritePropertyName("timeToLiveInMinutes"u8); + writer.WriteNumberValue(TimeToLiveInMinutes.Value); + } + if (Optional.IsDefined(LastActivityOn)) + { + writer.WritePropertyName("lastActivityTime"u8); + writer.WriteStringValue(LastActivityOn.Value, "O"); + } + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static DataFlowDebugSessionInfo DeserializeDataFlowDebugSessionInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,5 +175,53 @@ internal static DataFlowDebugSessionInfo DeserializeDataFlowDebugSessionInfo(Jso additionalProperties = additionalPropertiesDictionary; return new DataFlowDebugSessionInfo(dataFlowName.Value, computeType.Value, Optional.ToNullable(coreCount), Optional.ToNullable(nodeCount), integrationRuntimeName.Value, Optional.ToNullable(sessionId), Optional.ToNullable(startTime), Optional.ToNullable(timeToLiveInMinutes), Optional.ToNullable(lastActivityTime), additionalProperties); } + + DataFlowDebugSessionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowDebugSessionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowDebugSessionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowDebugSessionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowDebugSessionInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowDebugSessionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowDebugSessionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.cs index 0b52f523c9bf..ff83004d615e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfo.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data flow debug session info. public partial class DataFlowDebugSessionInfo { - /// Initializes a new instance of DataFlowDebugSessionInfo. + /// Initializes a new instance of . internal DataFlowDebugSessionInfo() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFlowDebugSessionInfo. + /// Initializes a new instance of . /// The name of the data flow. /// Compute type of the cluster. /// Core count of the cluster. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.Serialization.cs index 7eb9bcf096c0..2cba650d5e94 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFlowDebugSessionInfoListResult + internal partial class DataFlowDebugSessionInfoListResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static DataFlowDebugSessionInfoListResult DeserializeDataFlowDebugSessionInfoListResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static DataFlowDebugSessionInfoListResult DeserializeDataFlowDebugSessionInfoListResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional nextLink = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -42,8 +92,61 @@ internal static DataFlowDebugSessionInfoListResult DeserializeDataFlowDebugSessi nextLink = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataFlowDebugSessionInfoListResult(Optional.ToList(value), nextLink.Value); + return new DataFlowDebugSessionInfoListResult(Optional.ToList(value), nextLink.Value, serializedAdditionalRawData); + } + + DataFlowDebugSessionInfoListResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowDebugSessionInfoListResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowDebugSessionInfoListResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowDebugSessionInfoListResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowDebugSessionInfoListResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowDebugSessionInfoListResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowDebugSessionInfoListResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.cs index 826387cb43c9..6ead1409bdbb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowDebugSessionInfoListResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of active debug sessions. internal partial class DataFlowDebugSessionInfoListResult { - /// Initializes a new instance of DataFlowDebugSessionInfoListResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal DataFlowDebugSessionInfoListResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of DataFlowDebugSessionInfoListResult. + /// Initializes a new instance of . /// Array with all active debug sessions. /// The link to the next page of results, if any remaining results exist. - internal DataFlowDebugSessionInfoListResult(IReadOnlyList value, string nextLink) + /// Keeps track of any properties unknown to the library. + internal DataFlowDebugSessionInfoListResult(IReadOnlyList value, string nextLink, Dictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array with all active debug sessions. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.Serialization.cs index 7ebcd6bcc879..e22501172889 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DataFlowFolder : IUtf8JsonSerializable + internal partial class DataFlowFolder : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFlowFolder DeserializeDataFlowFolder(JsonElement element) + internal static DataFlowFolder DeserializeDataFlowFolder(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static DataFlowFolder DeserializeDataFlowFolder(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowFolder(name.Value, serializedAdditionalRawData); + } + + DataFlowFolder IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowFolder(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowFolder IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowFolder(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowFolder model) + { + if (model is null) + { + return null; } - return new DataFlowFolder(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowFolder(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowFolder(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.cs index a0062620eb73..17a7ea2bed57 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowFolder.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The folder that this data flow is in. If not specified, Data flow will appear at the root level. internal partial class DataFlowFolder { - /// Initializes a new instance of DataFlowFolder. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFlowFolder() { } - /// Initializes a new instance of DataFlowFolder. + /// Initializes a new instance of . /// The name of the folder that this data flow is in. - internal DataFlowFolder(string name) + /// Keeps track of any properties unknown to the library. + internal DataFlowFolder(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the folder that this data flow is in. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.Serialization.cs index 0e8f29675e6d..34a308ef8442 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowReference : IUtf8JsonSerializable + public partial class DataFlowReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); @@ -62,8 +68,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataFlowReference DeserializeDataFlowReference(JsonElement element) + internal static DataFlowReference DeserializeDataFlowReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -121,5 +129,53 @@ internal static DataFlowReference DeserializeDataFlowReference(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DataFlowReference(type, referenceName, datasetParameters.Value, Optional.ToDictionary(parameters), additionalProperties); } + + DataFlowReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.cs index 8dff59b491cf..060b26d6dd63 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowReference.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data flow reference type. public partial class DataFlowReference { - /// Initializes a new instance of DataFlowReference. + /// Initializes a new instance of . /// Data flow reference type. /// Reference data flow name. /// is null. @@ -28,7 +28,7 @@ public DataFlowReference(DataFlowReferenceType referenceType, string referenceNa AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DataFlowReference. + /// Initializes a new instance of . /// Data flow reference type. /// Reference data flow name. /// Reference data flow parameters from dataset. @@ -43,6 +43,11 @@ internal DataFlowReference(DataFlowReferenceType referenceType, string reference AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal DataFlowReference() + { + } + /// Data flow reference type. public DataFlowReferenceType ReferenceType { get; set; } /// Reference data flow name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.Serialization.cs index 022f44758618..1b7381143899 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowSink : IUtf8JsonSerializable + public partial class DataFlowSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SchemaLinkedService)) { @@ -36,7 +44,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Dataset)) { writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } } if (Optional.IsDefined(LinkedService)) { @@ -46,13 +61,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Flowlet)) { writer.WritePropertyName("flowlet"u8); - writer.WriteObjectValue(Flowlet); + if (Flowlet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Flowlet).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFlowSink DeserializeDataFlowSink(JsonElement element) + internal static DataFlowSink DeserializeDataFlowSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +100,7 @@ internal static DataFlowSink DeserializeDataFlowSink(JsonElement element) Optional dataset = default; Optional linkedService = default; Optional flowlet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schemaLinkedService"u8)) @@ -121,8 +158,61 @@ internal static DataFlowSink DeserializeDataFlowSink(JsonElement element) flowlet = DataFlowReference.DeserializeDataFlowReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowSink(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, rejectedDataLinkedService, serializedAdditionalRawData); + } + + DataFlowSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowSink model) + { + if (model is null) + { + return null; } - return new DataFlowSink(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, rejectedDataLinkedService); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.cs index a0d109b76226..972a398d8da8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSink.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Transformation for data flow sink. public partial class DataFlowSink : DataFlowTransformation { - /// Initializes a new instance of DataFlowSink. + /// Initializes a new instance of . /// Transformation name. /// is null. public DataFlowSink(string name) : base(name) @@ -22,7 +23,7 @@ public DataFlowSink(string name) : base(name) Argument.AssertNotNull(name, nameof(name)); } - /// Initializes a new instance of DataFlowSink. + /// Initializes a new instance of . /// Transformation name. /// Transformation description. /// Dataset reference. @@ -30,12 +31,18 @@ public DataFlowSink(string name) : base(name) /// Flowlet Reference. /// Schema linked service reference. /// Rejected data linked service reference. - internal DataFlowSink(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, DataFactoryLinkedServiceReference rejectedDataLinkedService) : base(name, description, dataset, linkedService, flowlet) + /// Keeps track of any properties unknown to the library. + internal DataFlowSink(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, DataFactoryLinkedServiceReference rejectedDataLinkedService, Dictionary serializedAdditionalRawData) : base(name, description, dataset, linkedService, flowlet, serializedAdditionalRawData) { SchemaLinkedService = schemaLinkedService; RejectedDataLinkedService = rejectedDataLinkedService; } + /// Initializes a new instance of for deserialization. + internal DataFlowSink() + { + } + /// Schema linked service reference. public DataFactoryLinkedServiceReference SchemaLinkedService { get; set; } /// Rejected data linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.Serialization.cs index e70ec7da309f..2ab46e92f493 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowSource : IUtf8JsonSerializable + public partial class DataFlowSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SchemaLinkedService)) { @@ -31,7 +39,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Dataset)) { writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } } if (Optional.IsDefined(LinkedService)) { @@ -41,13 +56,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Flowlet)) { writer.WritePropertyName("flowlet"u8); - writer.WriteObjectValue(Flowlet); + if (Flowlet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Flowlet).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFlowSource DeserializeDataFlowSource(JsonElement element) + internal static DataFlowSource DeserializeDataFlowSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +94,7 @@ internal static DataFlowSource DeserializeDataFlowSource(JsonElement element) Optional dataset = default; Optional linkedService = default; Optional flowlet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("schemaLinkedService"u8)) @@ -106,8 +143,61 @@ internal static DataFlowSource DeserializeDataFlowSource(JsonElement element) flowlet = DataFlowReference.DeserializeDataFlowReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowSource(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, serializedAdditionalRawData); + } + + DataFlowSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowSource model) + { + if (model is null) + { + return null; } - return new DataFlowSource(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.cs index e3543d2a4d8e..22822090cbcd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Transformation for data flow source. public partial class DataFlowSource : DataFlowTransformation { - /// Initializes a new instance of DataFlowSource. + /// Initializes a new instance of . /// Transformation name. /// is null. public DataFlowSource(string name) : base(name) @@ -22,18 +23,24 @@ public DataFlowSource(string name) : base(name) Argument.AssertNotNull(name, nameof(name)); } - /// Initializes a new instance of DataFlowSource. + /// Initializes a new instance of . /// Transformation name. /// Transformation description. /// Dataset reference. /// Linked service reference. /// Flowlet Reference. /// Schema linked service reference. - internal DataFlowSource(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService) : base(name, description, dataset, linkedService, flowlet) + /// Keeps track of any properties unknown to the library. + internal DataFlowSource(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, Dictionary serializedAdditionalRawData) : base(name, description, dataset, linkedService, flowlet, serializedAdditionalRawData) { SchemaLinkedService = schemaLinkedService; } + /// Initializes a new instance of for deserialization. + internal DataFlowSource() + { + } + /// Schema linked service reference. public DataFactoryLinkedServiceReference SchemaLinkedService { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.Serialization.cs index 8e96a54a5458..9d4bf8892f0b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowSourceSetting : IUtf8JsonSerializable + public partial class DataFlowSourceSetting : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SourceName)) { @@ -36,5 +44,87 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + + internal static DataFlowSourceSetting DeserializeDataFlowSourceSetting(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sourceName = default; + Optional rowLimit = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceName"u8)) + { + sourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("rowLimit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rowLimit = property.Value.GetInt32(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new DataFlowSourceSetting(sourceName.Value, Optional.ToNullable(rowLimit), additionalProperties); + } + + DataFlowSourceSetting IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowSourceSetting(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowSourceSetting IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowSourceSetting(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowSourceSetting model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowSourceSetting(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowSourceSetting(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.cs index 276074ef471a..382f64ee9d62 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowSourceSetting.cs @@ -14,12 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Definition of data flow source setting for debug. public partial class DataFlowSourceSetting { - /// Initializes a new instance of DataFlowSourceSetting. + /// Initializes a new instance of . public DataFlowSourceSetting() { AdditionalProperties = new ChangeTrackingDictionary(); } + /// Initializes a new instance of . + /// The data flow source name. + /// Defines the row limit of data flow source in debug. + /// Additional Properties. + internal DataFlowSourceSetting(string sourceName, int? rowLimit, IDictionary additionalProperties) + { + SourceName = sourceName; + RowLimit = rowLimit; + AdditionalProperties = additionalProperties; + } + /// The data flow source name. public string SourceName { get; set; } /// Defines the row limit of data flow source in debug. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.Serialization.cs index abf50283bf68..064a93334a9f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowStagingInfo : IUtf8JsonSerializable + public partial class DataFlowStagingInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedService)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("folderPath"u8); JsonSerializer.Serialize(writer, FolderPath); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataFlowStagingInfo DeserializeDataFlowStagingInfo(JsonElement element) + internal static DataFlowStagingInfo DeserializeDataFlowStagingInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional linkedService = default; Optional> folderPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("linkedService"u8)) @@ -57,8 +80,61 @@ internal static DataFlowStagingInfo DeserializeDataFlowStagingInfo(JsonElement e folderPath = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowStagingInfo(linkedService, folderPath.Value, serializedAdditionalRawData); + } + + DataFlowStagingInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowStagingInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowStagingInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowStagingInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowStagingInfo model) + { + if (model is null) + { + return null; } - return new DataFlowStagingInfo(linkedService, folderPath.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowStagingInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowStagingInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.cs index 992bd06b6ea3..2b77eae791a1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowStagingInfo.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Staging info for execute data flow activity. public partial class DataFlowStagingInfo { - /// Initializes a new instance of DataFlowStagingInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataFlowStagingInfo() { } - /// Initializes a new instance of DataFlowStagingInfo. + /// Initializes a new instance of . /// Staging linked service reference. /// Folder path for staging blob. Type: string (or Expression with resultType string). - internal DataFlowStagingInfo(DataFactoryLinkedServiceReference linkedService, DataFactoryElement folderPath) + /// Keeps track of any properties unknown to the library. + internal DataFlowStagingInfo(DataFactoryLinkedServiceReference linkedService, DataFactoryElement folderPath, Dictionary serializedAdditionalRawData) { LinkedService = linkedService; FolderPath = folderPath; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Staging linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.Serialization.cs index 204b5076b64e..3a6c67943637 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataFlowTransformation : IUtf8JsonSerializable + public partial class DataFlowTransformation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -26,7 +34,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Dataset)) { writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } } if (Optional.IsDefined(LinkedService)) { @@ -36,13 +51,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Flowlet)) { writer.WritePropertyName("flowlet"u8); - writer.WriteObjectValue(Flowlet); + if (Flowlet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Flowlet).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static DataFlowTransformation DeserializeDataFlowTransformation(JsonElement element) + internal static DataFlowTransformation DeserializeDataFlowTransformation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,6 +88,7 @@ internal static DataFlowTransformation DeserializeDataFlowTransformation(JsonEle Optional dataset = default; Optional linkedService = default; Optional flowlet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -91,8 +128,61 @@ internal static DataFlowTransformation DeserializeDataFlowTransformation(JsonEle flowlet = DataFlowReference.DeserializeDataFlowReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DataFlowTransformation(name, description.Value, dataset.Value, linkedService, flowlet.Value, serializedAdditionalRawData); + } + + DataFlowTransformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataFlowTransformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataFlowTransformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataFlowTransformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataFlowTransformation model) + { + if (model is null) + { + return null; } - return new DataFlowTransformation(name, description.Value, dataset.Value, linkedService, flowlet.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataFlowTransformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataFlowTransformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.cs index d005a82d664d..07e0b1435346 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataFlowTransformation.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A data flow transformation. public partial class DataFlowTransformation { - /// Initializes a new instance of DataFlowTransformation. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Transformation name. /// is null. public DataFlowTransformation(string name) @@ -24,19 +28,26 @@ public DataFlowTransformation(string name) Name = name; } - /// Initializes a new instance of DataFlowTransformation. + /// Initializes a new instance of . /// Transformation name. /// Transformation description. /// Dataset reference. /// Linked service reference. /// Flowlet Reference. - internal DataFlowTransformation(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet) + /// Keeps track of any properties unknown to the library. + internal DataFlowTransformation(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, Dictionary serializedAdditionalRawData) { Name = name; Description = description; Dataset = dataset; LinkedService = linkedService; Flowlet = flowlet; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataFlowTransformation() + { } /// Transformation name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.Serialization.cs index 8f7e09783c2c..93a5eb5c18d7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataLakeAnalyticsUsqlActivity : IUtf8JsonSerializable + public partial class DataLakeAnalyticsUsqlActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -125,8 +152,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataLakeAnalyticsUsqlActivity DeserializeDataLakeAnalyticsUsqlActivity(JsonElement element) + internal static DataLakeAnalyticsUsqlActivity DeserializeDataLakeAnalyticsUsqlActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -314,5 +343,53 @@ internal static DataLakeAnalyticsUsqlActivity DeserializeDataLakeAnalyticsUsqlAc additionalProperties = additionalPropertiesDictionary; return new DataLakeAnalyticsUsqlActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, scriptPath, scriptLinkedService, degreeOfParallelism.Value, priority.Value, Optional.ToDictionary(parameters), runtimeVersion.Value, compilationMode.Value); } + + DataLakeAnalyticsUsqlActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataLakeAnalyticsUsqlActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataLakeAnalyticsUsqlActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataLakeAnalyticsUsqlActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataLakeAnalyticsUsqlActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataLakeAnalyticsUsqlActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataLakeAnalyticsUsqlActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.cs index 291c751dda7f..3b853e32b0f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataLakeAnalyticsUsqlActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data Lake Analytics U-SQL activity. public partial class DataLakeAnalyticsUsqlActivity : ExecutionActivity { - /// Initializes a new instance of DataLakeAnalyticsUsqlActivity. + /// Initializes a new instance of . /// Activity name. /// Case-sensitive path to folder that contains the U-SQL script. Type: string (or Expression with resultType string). /// Script linked service reference. @@ -32,7 +32,7 @@ public DataLakeAnalyticsUsqlActivity(string name, DataFactoryElement scr ActivityType = "DataLakeAnalyticsU-SQL"; } - /// Initializes a new instance of DataLakeAnalyticsUsqlActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -62,6 +62,11 @@ internal DataLakeAnalyticsUsqlActivity(string name, string activityType, string ActivityType = activityType ?? "DataLakeAnalyticsU-SQL"; } + /// Initializes a new instance of for deserialization. + internal DataLakeAnalyticsUsqlActivity() + { + } + /// Case-sensitive path to folder that contains the U-SQL script. Type: string (or Expression with resultType string). public DataFactoryElement ScriptPath { get; set; } /// Script linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.Serialization.cs index 55f8627523c4..64067256ac75 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataMapperMapping : IUtf8JsonSerializable + public partial class DataMapperMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TargetEntityName)) { @@ -29,12 +36,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceConnectionReference)) { writer.WritePropertyName("sourceConnectionReference"u8); - writer.WriteObjectValue(SourceConnectionReference); + if (SourceConnectionReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SourceConnectionReference).Serialize(writer, options); + } } if (Optional.IsDefined(AttributeMappingInfo)) { writer.WritePropertyName("attributeMappingInfo"u8); - writer.WriteObjectValue(AttributeMappingInfo); + if (AttributeMappingInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AttributeMappingInfo).Serialize(writer, options); + } } if (Optional.IsDefined(SourceDenormalizeInfo)) { @@ -45,11 +66,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(SourceDenormalizeInfo.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DataMapperMapping DeserializeDataMapperMapping(JsonElement element) + internal static DataMapperMapping DeserializeDataMapperMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,6 +94,7 @@ internal static DataMapperMapping DeserializeDataMapperMapping(JsonElement eleme Optional sourceConnectionReference = default; Optional attributeMappingInfo = default; Optional sourceDenormalizeInfo = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetEntityName"u8)) @@ -98,8 +134,61 @@ internal static DataMapperMapping DeserializeDataMapperMapping(JsonElement eleme sourceDenormalizeInfo = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DataMapperMapping(targetEntityName.Value, sourceEntityName.Value, sourceConnectionReference.Value, attributeMappingInfo.Value, sourceDenormalizeInfo.Value); + return new DataMapperMapping(targetEntityName.Value, sourceEntityName.Value, sourceConnectionReference.Value, attributeMappingInfo.Value, sourceDenormalizeInfo.Value, serializedAdditionalRawData); + } + + DataMapperMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataMapperMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataMapperMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataMapperMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataMapperMapping model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataMapperMapping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataMapperMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.cs index a42a3d2b62b8..0e4cca7f3790 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataMapperMapping.cs @@ -13,24 +13,29 @@ namespace Azure.ResourceManager.DataFactory.Models /// Source and target table mapping details. public partial class DataMapperMapping { - /// Initializes a new instance of DataMapperMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DataMapperMapping() { } - /// Initializes a new instance of DataMapperMapping. + /// Initializes a new instance of . /// Name of the target table. /// Name of the source table. /// The connection reference for the source connection. /// This holds the user provided attribute mapping information. /// This holds the source denormalization information used while joining multiple sources. - internal DataMapperMapping(string targetEntityName, string sourceEntityName, MapperConnectionReference sourceConnectionReference, MapperAttributeMappings attributeMappingInfo, BinaryData sourceDenormalizeInfo) + /// Keeps track of any properties unknown to the library. + internal DataMapperMapping(string targetEntityName, string sourceEntityName, MapperConnectionReference sourceConnectionReference, MapperAttributeMappings attributeMappingInfo, BinaryData sourceDenormalizeInfo, Dictionary serializedAdditionalRawData) { TargetEntityName = targetEntityName; SourceEntityName = sourceEntityName; SourceConnectionReference = sourceConnectionReference; AttributeMappingInfo = attributeMappingInfo; SourceDenormalizeInfo = sourceDenormalizeInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the target table. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.Serialization.cs index 3445dbae09d4..5f17cea83e9c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatabricksNotebookActivity : IUtf8JsonSerializable + public partial class DatabricksNotebookActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -134,8 +161,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatabricksNotebookActivity DeserializeDatabricksNotebookActivity(JsonElement element) + internal static DatabricksNotebookActivity DeserializeDatabricksNotebookActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -311,5 +340,53 @@ internal static DatabricksNotebookActivity DeserializeDatabricksNotebookActivity additionalProperties = additionalPropertiesDictionary; return new DatabricksNotebookActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, notebookPath, Optional.ToDictionary(baseParameters), Optional.ToList(libraries)); } + + DatabricksNotebookActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabricksNotebookActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabricksNotebookActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabricksNotebookActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabricksNotebookActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabricksNotebookActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabricksNotebookActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.cs index 88fc8ac6ac00..56d4092bee3c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksNotebookActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// DatabricksNotebook activity. public partial class DatabricksNotebookActivity : ExecutionActivity { - /// Initializes a new instance of DatabricksNotebookActivity. + /// Initializes a new instance of . /// Activity name. /// The absolute path of the notebook to be run in the Databricks Workspace. This path must begin with a slash. Type: string (or Expression with resultType string). /// or is null. @@ -30,7 +30,7 @@ public DatabricksNotebookActivity(string name, DataFactoryElement notebo ActivityType = "DatabricksNotebook"; } - /// Initializes a new instance of DatabricksNotebookActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -52,6 +52,11 @@ internal DatabricksNotebookActivity(string name, string activityType, string des ActivityType = activityType ?? "DatabricksNotebook"; } + /// Initializes a new instance of for deserialization. + internal DatabricksNotebookActivity() + { + } + /// The absolute path of the notebook to be run in the Databricks Workspace. This path must begin with a slash. Type: string (or Expression with resultType string). public DataFactoryElement NotebookPath { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.Serialization.cs index 3830eab5fb45..9c54a6ac1332 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatabricksSparkJarActivity : IUtf8JsonSerializable + public partial class DatabricksSparkJarActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -133,8 +160,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatabricksSparkJarActivity DeserializeDatabricksSparkJarActivity(JsonElement element) + internal static DatabricksSparkJarActivity DeserializeDatabricksSparkJarActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -310,5 +339,53 @@ internal static DatabricksSparkJarActivity DeserializeDatabricksSparkJarActivity additionalProperties = additionalPropertiesDictionary; return new DatabricksSparkJarActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, mainClassName, Optional.ToList(parameters), Optional.ToList(libraries)); } + + DatabricksSparkJarActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabricksSparkJarActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabricksSparkJarActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabricksSparkJarActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabricksSparkJarActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabricksSparkJarActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabricksSparkJarActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.cs index 4e2bb6a3d1fd..555dc1b3eef6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkJarActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// DatabricksSparkJar activity. public partial class DatabricksSparkJarActivity : ExecutionActivity { - /// Initializes a new instance of DatabricksSparkJarActivity. + /// Initializes a new instance of . /// Activity name. /// The full name of the class containing the main method to be executed. This class must be contained in a JAR provided as a library. Type: string (or Expression with resultType string). /// or is null. @@ -30,7 +30,7 @@ public DatabricksSparkJarActivity(string name, DataFactoryElement mainCl ActivityType = "DatabricksSparkJar"; } - /// Initializes a new instance of DatabricksSparkJarActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -52,6 +52,11 @@ internal DatabricksSparkJarActivity(string name, string activityType, string des ActivityType = activityType ?? "DatabricksSparkJar"; } + /// Initializes a new instance of for deserialization. + internal DatabricksSparkJarActivity() + { + } + /// The full name of the class containing the main method to be executed. This class must be contained in a JAR provided as a library. Type: string (or Expression with resultType string). public DataFactoryElement MainClassName { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.Serialization.cs index e937a7237a0b..21802b11c3fe 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatabricksSparkPythonActivity : IUtf8JsonSerializable + public partial class DatabricksSparkPythonActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -133,8 +160,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatabricksSparkPythonActivity DeserializeDatabricksSparkPythonActivity(JsonElement element) + internal static DatabricksSparkPythonActivity DeserializeDatabricksSparkPythonActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -310,5 +339,53 @@ internal static DatabricksSparkPythonActivity DeserializeDatabricksSparkPythonAc additionalProperties = additionalPropertiesDictionary; return new DatabricksSparkPythonActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, pythonFile, Optional.ToList(parameters), Optional.ToList(libraries)); } + + DatabricksSparkPythonActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatabricksSparkPythonActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatabricksSparkPythonActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatabricksSparkPythonActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatabricksSparkPythonActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatabricksSparkPythonActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatabricksSparkPythonActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.cs index 2bc28babb6ae..3dee91e3786d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatabricksSparkPythonActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// DatabricksSparkPython activity. public partial class DatabricksSparkPythonActivity : ExecutionActivity { - /// Initializes a new instance of DatabricksSparkPythonActivity. + /// Initializes a new instance of . /// Activity name. /// The URI of the Python file to be executed. DBFS paths are supported. Type: string (or Expression with resultType string). /// or is null. @@ -30,7 +30,7 @@ public DatabricksSparkPythonActivity(string name, DataFactoryElement pyt ActivityType = "DatabricksSparkPython"; } - /// Initializes a new instance of DatabricksSparkPythonActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -52,6 +52,11 @@ internal DatabricksSparkPythonActivity(string name, string activityType, string ActivityType = activityType ?? "DatabricksSparkPython"; } + /// Initializes a new instance of for deserialization. + internal DatabricksSparkPythonActivity() + { + } + /// The URI of the Python file to be executed. DBFS paths are supported. Type: string (or Expression with resultType string). public DataFactoryElement PythonFile { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.Serialization.cs index 87f719c75742..f2d7387a4c04 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetAvroFormat : IUtf8JsonSerializable + public partial class DatasetAvroFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetStorageFormatType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetAvroFormat DeserializeDatasetAvroFormat(JsonElement element) + internal static DatasetAvroFormat DeserializeDatasetAvroFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static DatasetAvroFormat DeserializeDatasetAvroFormat(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DatasetAvroFormat(type, serializer.Value, deserializer.Value, additionalProperties); } + + DatasetAvroFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetAvroFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetAvroFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetAvroFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetAvroFormat model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetAvroFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetAvroFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.cs index 0e03a245aa96..f64e410e4134 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetAvroFormat.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The data stored in Avro format. public partial class DatasetAvroFormat : DatasetStorageFormat { - /// Initializes a new instance of DatasetAvroFormat. + /// Initializes a new instance of . public DatasetAvroFormat() { DatasetStorageFormatType = "AvroFormat"; } - /// Initializes a new instance of DatasetAvroFormat. + /// Initializes a new instance of . /// Type of dataset storage format. /// Serializer. Type: string (or Expression with resultType string). /// Deserializer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.Serialization.cs index baa4307e3820..58bca205a607 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetCompression : IUtf8JsonSerializable + public partial class DatasetCompression : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); JsonSerializer.Serialize(writer, DatasetCompressionType); @@ -37,8 +43,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetCompression DeserializeDatasetCompression(JsonElement element) + internal static DatasetCompression DeserializeDatasetCompression(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,5 +76,53 @@ internal static DatasetCompression DeserializeDatasetCompression(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new DatasetCompression(type, level.Value, additionalProperties); } + + DatasetCompression IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetCompression(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetCompression IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetCompression(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetCompression model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetCompression(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetCompression(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.cs index 766e0af7ff62..bec073ca9344 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetCompression.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The compression method used on a dataset. public partial class DatasetCompression { - /// Initializes a new instance of DatasetCompression. + /// Initializes a new instance of . /// Type of dataset compression. Type: string (or Expression with resultType string). /// is null. public DatasetCompression(DataFactoryElement datasetCompressionType) @@ -26,7 +26,7 @@ public DatasetCompression(DataFactoryElement datasetCompressionType) AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DatasetCompression. + /// Initializes a new instance of . /// Type of dataset compression. Type: string (or Expression with resultType string). /// The dataset compression level. Type: string (or Expression with resultType string). /// Additional Properties. @@ -37,6 +37,11 @@ internal DatasetCompression(DataFactoryElement datasetCompressionType, D AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal DatasetCompression() + { + } + /// Type of dataset compression. Type: string (or Expression with resultType string). public DataFactoryElement DatasetCompressionType { get; set; } /// The dataset compression level. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.Serialization.cs index b4794e3e8544..09d69917bfed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.Serialization.cs @@ -6,18 +6,25 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { [JsonConverter(typeof(DatasetDataElementConverter))] - public partial class DatasetDataElement : IUtf8JsonSerializable + public partial class DatasetDataElement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ColumnName)) { @@ -29,17 +36,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); JsonSerializer.Serialize(writer, ColumnType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatasetDataElement DeserializeDatasetDataElement(JsonElement element) + internal static DatasetDataElement DeserializeDatasetDataElement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> name = default; Optional> type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -60,8 +82,61 @@ internal static DatasetDataElement DeserializeDatasetDataElement(JsonElement ele type = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatasetDataElement(name.Value, type.Value, serializedAdditionalRawData); + } + + DatasetDataElement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetDataElement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetDataElement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetDataElement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetDataElement model) + { + if (model is null) + { + return null; } - return new DatasetDataElement(name.Value, type.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetDataElement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetDataElement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class DatasetDataElementConverter : JsonConverter diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.cs index bcf087434d3a..621282b91001 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetDataElement.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Columns that define the structure of the dataset. public partial class DatasetDataElement { - /// Initializes a new instance of DatasetDataElement. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatasetDataElement() { } - /// Initializes a new instance of DatasetDataElement. + /// Initializes a new instance of . /// Name of the column. Type: string (or Expression with resultType string). /// Type of the column. Type: string (or Expression with resultType string). - internal DatasetDataElement(DataFactoryElement columnName, DataFactoryElement columnType) + /// Keeps track of any properties unknown to the library. + internal DatasetDataElement(DataFactoryElement columnName, DataFactoryElement columnType, Dictionary serializedAdditionalRawData) { ColumnName = columnName; ColumnType = columnType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the column. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.Serialization.cs index 9f5f0d2606a6..e72321a85500 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class DatasetFolder : IUtf8JsonSerializable + internal partial class DatasetFolder : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatasetFolder DeserializeDatasetFolder(JsonElement element) + internal static DatasetFolder DeserializeDatasetFolder(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static DatasetFolder DeserializeDatasetFolder(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DatasetFolder(name.Value, serializedAdditionalRawData); + } + + DatasetFolder IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetFolder(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetFolder IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetFolder(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetFolder model) + { + if (model is null) + { + return null; } - return new DatasetFolder(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetFolder(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetFolder(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.cs index 7ada2660f15f..3e07a777331c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetFolder.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The folder that this Dataset is in. If not specified, Dataset will appear at the root level. internal partial class DatasetFolder { - /// Initializes a new instance of DatasetFolder. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DatasetFolder() { } - /// Initializes a new instance of DatasetFolder. + /// Initializes a new instance of . /// The name of the folder that this Dataset is in. - internal DatasetFolder(string name) + /// Keeps track of any properties unknown to the library. + internal DatasetFolder(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the folder that this Dataset is in. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.Serialization.cs index 4c88875c4253..839ee483bb3c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetJsonFormat : IUtf8JsonSerializable + public partial class DatasetJsonFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FilePattern)) { @@ -75,8 +81,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetJsonFormat DeserializeDatasetJsonFormat(JsonElement element) + internal static DatasetJsonFormat DeserializeDatasetJsonFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -166,5 +174,53 @@ internal static DatasetJsonFormat DeserializeDatasetJsonFormat(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DatasetJsonFormat(type, serializer.Value, deserializer.Value, additionalProperties, filePattern.Value, nestingSeparator.Value, encodingName.Value, jsonNodeReference.Value, jsonPathDefinition.Value); } + + DatasetJsonFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetJsonFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetJsonFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetJsonFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetJsonFormat model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetJsonFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetJsonFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.cs index 1b3707a48abd..c4ee87b82419 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetJsonFormat.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The data stored in JSON format. public partial class DatasetJsonFormat : DatasetStorageFormat { - /// Initializes a new instance of DatasetJsonFormat. + /// Initializes a new instance of . public DatasetJsonFormat() { DatasetStorageFormatType = "JsonFormat"; } - /// Initializes a new instance of DatasetJsonFormat. + /// Initializes a new instance of . /// Type of dataset storage format. /// Serializer. Type: string (or Expression with resultType string). /// Deserializer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.Serialization.cs index 639244cfa40f..11c3743be093 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetLocation : IUtf8JsonSerializable + public partial class DatasetLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetLocationType); @@ -39,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetLocation DeserializeDatasetLocation(JsonElement element) + internal static DatasetLocation DeserializeDatasetLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,7 +75,90 @@ internal static DatasetLocation DeserializeDatasetLocation(JsonElement element) case "SftpLocation": return SftpLocation.DeserializeSftpLocation(element); } } - return UnknownDatasetLocation.DeserializeUnknownDatasetLocation(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional> folderPath = default; + Optional> fileName = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("folderPath"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + folderPath = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("fileName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileName = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownDatasetLocation(type, folderPath.Value, fileName.Value, additionalProperties); + } + + DatasetLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.cs index c55db7976134..c46f9be85bb2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetLocation.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DatasetLocation { - /// Initializes a new instance of DatasetLocation. + /// Initializes a new instance of . public DatasetLocation() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DatasetLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.Serialization.cs index b0a8d065ca70..06d7e373d232 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetOrcFormat : IUtf8JsonSerializable + public partial class DatasetOrcFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetStorageFormatType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetOrcFormat DeserializeDatasetOrcFormat(JsonElement element) + internal static DatasetOrcFormat DeserializeDatasetOrcFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static DatasetOrcFormat DeserializeDatasetOrcFormat(JsonElement element additionalProperties = additionalPropertiesDictionary; return new DatasetOrcFormat(type, serializer.Value, deserializer.Value, additionalProperties); } + + DatasetOrcFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetOrcFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetOrcFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetOrcFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetOrcFormat model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetOrcFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetOrcFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.cs index 1fac7b6be480..eabf1b1775df 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetOrcFormat.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The data stored in Optimized Row Columnar (ORC) format. public partial class DatasetOrcFormat : DatasetStorageFormat { - /// Initializes a new instance of DatasetOrcFormat. + /// Initializes a new instance of . public DatasetOrcFormat() { DatasetStorageFormatType = "OrcFormat"; } - /// Initializes a new instance of DatasetOrcFormat. + /// Initializes a new instance of . /// Type of dataset storage format. /// Serializer. Type: string (or Expression with resultType string). /// Deserializer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.Serialization.cs index 37419ae63216..168a578d797e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetParquetFormat : IUtf8JsonSerializable + public partial class DatasetParquetFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetStorageFormatType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetParquetFormat DeserializeDatasetParquetFormat(JsonElement element) + internal static DatasetParquetFormat DeserializeDatasetParquetFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static DatasetParquetFormat DeserializeDatasetParquetFormat(JsonElement additionalProperties = additionalPropertiesDictionary; return new DatasetParquetFormat(type, serializer.Value, deserializer.Value, additionalProperties); } + + DatasetParquetFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetParquetFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetParquetFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetParquetFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetParquetFormat model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetParquetFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetParquetFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.cs index a70b0c5a8e3e..27ebc3851440 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetParquetFormat.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The data stored in Parquet format. public partial class DatasetParquetFormat : DatasetStorageFormat { - /// Initializes a new instance of DatasetParquetFormat. + /// Initializes a new instance of . public DatasetParquetFormat() { DatasetStorageFormatType = "ParquetFormat"; } - /// Initializes a new instance of DatasetParquetFormat. + /// Initializes a new instance of . /// Type of dataset storage format. /// Serializer. Type: string (or Expression with resultType string). /// Deserializer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.Serialization.cs index 3dbc128ef8f7..01dfa95e4cda 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetReference : IUtf8JsonSerializable + public partial class DatasetReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); @@ -41,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DatasetReference DeserializeDatasetReference(JsonElement element) + internal static DatasetReference DeserializeDatasetReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +73,7 @@ internal static DatasetReference DeserializeDatasetReference(JsonElement element DatasetReferenceType type = default; string referenceName = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -86,8 +107,61 @@ internal static DatasetReference DeserializeDatasetReference(JsonElement element parameters = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new DatasetReference(type, referenceName, Optional.ToDictionary(parameters)); + return new DatasetReference(type, referenceName, Optional.ToDictionary(parameters), serializedAdditionalRawData); + } + + DatasetReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.cs index 43222883dc13..662630413b54 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetReference.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Dataset reference type. public partial class DatasetReference { - /// Initializes a new instance of DatasetReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Dataset reference type. /// Reference dataset name. /// is null. @@ -27,15 +30,22 @@ public DatasetReference(DatasetReferenceType referenceType, string referenceName Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DatasetReference. + /// Initializes a new instance of . /// Dataset reference type. /// Reference dataset name. /// Arguments for dataset. - internal DatasetReference(DatasetReferenceType referenceType, string referenceName, IDictionary parameters) + /// Keeps track of any properties unknown to the library. + internal DatasetReference(DatasetReferenceType referenceType, string referenceName, IDictionary parameters, Dictionary serializedAdditionalRawData) { ReferenceType = referenceType; ReferenceName = referenceName; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatasetReference() + { } /// Dataset reference type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.Serialization.cs index f839aa8f6b42..3358fa1b4966 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.Serialization.cs @@ -9,16 +9,22 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { [JsonConverter(typeof(DatasetSchemaDataElementConverter))] - public partial class DatasetSchemaDataElement : IUtf8JsonSerializable + public partial class DatasetSchemaDataElement : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SchemaColumnName)) { @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetSchemaDataElement DeserializeDatasetSchemaDataElement(JsonElement element) + internal static DatasetSchemaDataElement DeserializeDatasetSchemaDataElement(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,6 +86,54 @@ internal static DatasetSchemaDataElement DeserializeDatasetSchemaDataElement(Jso return new DatasetSchemaDataElement(name.Value, type.Value, additionalProperties); } + DatasetSchemaDataElement IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetSchemaDataElement(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetSchemaDataElement IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetSchemaDataElement(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetSchemaDataElement model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetSchemaDataElement(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetSchemaDataElement(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } + internal partial class DatasetSchemaDataElementConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, DatasetSchemaDataElement model, JsonSerializerOptions options) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.cs index 85a2a18a918e..aa351dd378b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetSchemaDataElement.cs @@ -15,13 +15,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Columns that define the physical type schema of the dataset. public partial class DatasetSchemaDataElement { - /// Initializes a new instance of DatasetSchemaDataElement. + /// Initializes a new instance of . public DatasetSchemaDataElement() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DatasetSchemaDataElement. + /// Initializes a new instance of . /// Name of the schema column. Type: string (or Expression with resultType string). /// Type of the schema column. Type: string (or Expression with resultType string). /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.Serialization.cs index 67c0aefb0d24..472048b4f5ed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.Serialization.cs @@ -5,15 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetStorageFormat : IUtf8JsonSerializable + public partial class DatasetStorageFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetStorageFormatType); @@ -39,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetStorageFormat DeserializeDatasetStorageFormat(JsonElement element) + internal static DatasetStorageFormat DeserializeDatasetStorageFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,7 +67,90 @@ internal static DatasetStorageFormat DeserializeDatasetStorageFormat(JsonElement case "TextFormat": return DatasetTextFormat.DeserializeDatasetTextFormat(element); } } - return UnknownDatasetStorageFormat.DeserializeUnknownDatasetStorageFormat(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Optional> serializer = default; + Optional> deserializer = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("serializer"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serializer = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("deserializer"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deserializer = JsonSerializer.Deserialize>(property.Value.GetRawText()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownDatasetStorageFormat(type, serializer.Value, deserializer.Value, additionalProperties); + } + + DatasetStorageFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetStorageFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetStorageFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetStorageFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetStorageFormat model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetStorageFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetStorageFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.cs index b737a4ad3f68..4be6ce118104 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetStorageFormat.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class DatasetStorageFormat { - /// Initializes a new instance of DatasetStorageFormat. + /// Initializes a new instance of . public DatasetStorageFormat() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DatasetStorageFormat. + /// Initializes a new instance of . /// Type of dataset storage format. /// Serializer. Type: string (or Expression with resultType string). /// Deserializer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.Serialization.cs index 7236d7964fc7..6896272488c9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DatasetTextFormat : IUtf8JsonSerializable + public partial class DatasetTextFormat : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ColumnDelimiter)) { @@ -87,8 +93,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DatasetTextFormat DeserializeDatasetTextFormat(JsonElement element) + internal static DatasetTextFormat DeserializeDatasetTextFormat(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -218,5 +226,53 @@ internal static DatasetTextFormat DeserializeDatasetTextFormat(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DatasetTextFormat(type, serializer.Value, deserializer.Value, additionalProperties, columnDelimiter.Value, rowDelimiter.Value, escapeChar.Value, quoteChar.Value, nullValue.Value, encodingName.Value, treatEmptyAsNull.Value, skipLineCount.Value, firstRowAsHeader.Value); } + + DatasetTextFormat IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDatasetTextFormat(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DatasetTextFormat IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDatasetTextFormat(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DatasetTextFormat model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DatasetTextFormat(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDatasetTextFormat(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.cs index cb224423eb87..71985afe8277 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DatasetTextFormat.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The data stored in text format. public partial class DatasetTextFormat : DatasetStorageFormat { - /// Initializes a new instance of DatasetTextFormat. + /// Initializes a new instance of . public DatasetTextFormat() { DatasetStorageFormatType = "TextFormat"; } - /// Initializes a new instance of DatasetTextFormat. + /// Initializes a new instance of . /// Type of dataset storage format. /// Serializer. Type: string (or Expression with resultType string). /// Deserializer. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.Serialization.cs index 6bdac5772637..47520d71ea24 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DataworldLinkedService : IUtf8JsonSerializable + public partial class DataworldLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -81,8 +101,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DataworldLinkedService DeserializeDataworldLinkedService(JsonElement element) + internal static DataworldLinkedService DeserializeDataworldLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -179,5 +201,53 @@ internal static DataworldLinkedService DeserializeDataworldLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new DataworldLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, apiToken, encryptedCredential.Value); } + + DataworldLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDataworldLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DataworldLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDataworldLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DataworldLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DataworldLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDataworldLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.cs index 1fb732651183..05a9ab33c352 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DataworldLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Dataworld. public partial class DataworldLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of DataworldLinkedService. + /// Initializes a new instance of . /// The api token for the Dataworld source. /// is null. public DataworldLinkedService(DataFactorySecretBaseDefinition apiToken) @@ -26,7 +26,7 @@ public DataworldLinkedService(DataFactorySecretBaseDefinition apiToken) LinkedServiceType = "Dataworld"; } - /// Initializes a new instance of DataworldLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -42,6 +42,11 @@ internal DataworldLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "Dataworld"; } + /// Initializes a new instance of for deserialization. + internal DataworldLinkedService() + { + } + /// The api token for the Dataworld source. public DataFactorySecretBaseDefinition ApiToken { get; set; } /// The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.Serialization.cs index 2df4e6efde6a..d596ac4a2eab 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class Db2LinkedService : IUtf8JsonSerializable + public partial class Db2LinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -120,8 +140,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static Db2LinkedService DeserializeDb2LinkedService(JsonElement element) + internal static Db2LinkedService DeserializeDb2LinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -292,5 +314,53 @@ internal static Db2LinkedService DeserializeDb2LinkedService(JsonElement element additionalProperties = additionalPropertiesDictionary; return new Db2LinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, server.Value, database.Value, Optional.ToNullable(authenticationType), username.Value, password, packageCollection.Value, certificateCommonName.Value, encryptedCredential.Value); } + + Db2LinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDb2LinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Db2LinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDb2LinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Db2LinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Db2LinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDb2LinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.cs index 1666d214dbf6..9363c04f06bb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2LinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for DB2 data source. public partial class Db2LinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of Db2LinkedService. + /// Initializes a new instance of . public Db2LinkedService() { LinkedServiceType = "Db2"; } - /// Initializes a new instance of Db2LinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.Serialization.cs index 256517a7f8e7..6a6f3591855b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class Db2Source : IUtf8JsonSerializable + public partial class Db2Source : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static Db2Source DeserializeDb2Source(JsonElement element) + internal static Db2Source DeserializeDb2Source(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static Db2Source DeserializeDb2Source(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new Db2Source(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + Db2Source IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDb2Source(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Db2Source IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDb2Source(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Db2Source model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Db2Source(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDb2Source(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.cs index 5fd52acc021f..8402c4cc76fa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2Source.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for Db2 databases. public partial class Db2Source : TabularSource { - /// Initializes a new instance of Db2Source. + /// Initializes a new instance of . public Db2Source() { CopySourceType = "Db2Source"; } - /// Initializes a new instance of Db2Source. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.Serialization.cs index ea7c8cb5b14f..d969474d7fd7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class Db2TableDataset : IUtf8JsonSerializable + public partial class Db2TableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static Db2TableDataset DeserializeDb2TableDataset(JsonElement element) + internal static Db2TableDataset DeserializeDb2TableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static Db2TableDataset DeserializeDb2TableDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new Db2TableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, schema0.Value, table.Value); } + + Db2TableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDb2TableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Db2TableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDb2TableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Db2TableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Db2TableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDb2TableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.cs index 0430a1843d9c..992c631f47b8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Db2TableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Db2 table dataset. public partial class Db2TableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of Db2TableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public Db2TableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public Db2TableDataset(DataFactoryLinkedServiceReference linkedServiceName) : ba DatasetType = "Db2Table"; } - /// Initializes a new instance of Db2TableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal Db2TableDataset(string datasetType, string description, DataFactoryElem DatasetType = datasetType ?? "Db2Table"; } + /// Initializes a new instance of for deserialization. + internal Db2TableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.Serialization.cs index 5089a9ebc4af..7e6dc43d1fef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DeleteActivity : IUtf8JsonSerializable + public partial class DeleteActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -87,14 +114,35 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LogStorageSettings)) { writer.WritePropertyName("logStorageSettings"u8); - writer.WriteObjectValue(LogStorageSettings); + if (LogStorageSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogStorageSettings).Serialize(writer, options); + } } writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -109,8 +157,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DeleteActivity DeserializeDeleteActivity(JsonElement element) + internal static DeleteActivity DeserializeDeleteActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -280,5 +330,53 @@ internal static DeleteActivity DeserializeDeleteActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new DeleteActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, recursive.Value, Optional.ToNullable(maxConcurrentConnections), enableLogging.Value, logStorageSettings.Value, dataset, storeSettings.Value); } + + DeleteActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeleteActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeleteActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeleteActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeleteActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeleteActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeleteActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.cs index 8dddf323f904..7cdebfacfb8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Delete activity. public partial class DeleteActivity : ExecutionActivity { - /// Initializes a new instance of DeleteActivity. + /// Initializes a new instance of . /// Activity name. /// Delete activity dataset reference. /// or is null. @@ -28,7 +28,7 @@ public DeleteActivity(string name, DatasetReference dataset) : base(name) ActivityType = "Delete"; } - /// Initializes a new instance of DeleteActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -60,6 +60,11 @@ internal DeleteActivity(string name, string activityType, string description, Pi ActivityType = activityType ?? "Delete"; } + /// Initializes a new instance of for deserialization. + internal DeleteActivity() + { + } + /// If true, files or sub-folders under current folder path will be deleted recursively. Default is false. Type: boolean (or Expression with resultType boolean). public DataFactoryElement Recursive { get; set; } /// The max concurrent connections to connect data source at the same time. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.Serialization.cs index 3fd528108f9d..a1d7a4b77ffb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DeleteDataFlowDebugSessionContent : IUtf8JsonSerializable + public partial class DeleteDataFlowDebugSessionContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SessionId)) { writer.WritePropertyName("sessionId"u8); writer.WriteStringValue(SessionId.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static DeleteDataFlowDebugSessionContent DeserializeDeleteDataFlowDebugSessionContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sessionId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sessionId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionId = property.Value.GetGuid(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DeleteDataFlowDebugSessionContent(Optional.ToNullable(sessionId), serializedAdditionalRawData); + } + + DeleteDataFlowDebugSessionContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDeleteDataFlowDebugSessionContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DeleteDataFlowDebugSessionContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDeleteDataFlowDebugSessionContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DeleteDataFlowDebugSessionContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DeleteDataFlowDebugSessionContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDeleteDataFlowDebugSessionContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.cs index 6e6154431802..1cd0d7ec3e82 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DeleteDataFlowDebugSessionContent.cs @@ -6,17 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Request body structure for deleting data flow debug session. public partial class DeleteDataFlowDebugSessionContent { - /// Initializes a new instance of DeleteDataFlowDebugSessionContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public DeleteDataFlowDebugSessionContent() { } + /// Initializes a new instance of . + /// The ID of data flow debug session. + /// Keeps track of any properties unknown to the library. + internal DeleteDataFlowDebugSessionContent(Guid? sessionId, Dictionary serializedAdditionalRawData) + { + SessionId = sessionId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The ID of data flow debug session. public Guid? SessionId { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.Serialization.cs index a0381f4bbc9b..c36f33dd2937 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DelimitedTextDataset : IUtf8JsonSerializable + public partial class DelimitedTextDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,14 +82,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(ColumnDelimiter)) { @@ -140,8 +167,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DelimitedTextDataset DeserializeDelimitedTextDataset(JsonElement element) + internal static DelimitedTextDataset DeserializeDelimitedTextDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -352,5 +381,53 @@ internal static DelimitedTextDataset DeserializeDelimitedTextDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new DelimitedTextDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, columnDelimiter.Value, rowDelimiter.Value, encodingName.Value, compressionCodec.Value, compressionLevel.Value, quoteChar.Value, escapeChar.Value, firstRowAsHeader.Value, nullValue.Value); } + + DelimitedTextDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDelimitedTextDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DelimitedTextDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDelimitedTextDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DelimitedTextDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DelimitedTextDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDelimitedTextDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.cs index bcd87cf39d35..7dcfec613258 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Delimited text dataset. public partial class DelimitedTextDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DelimitedTextDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public DelimitedTextDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public DelimitedTextDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "DelimitedText"; } - /// Initializes a new instance of DelimitedTextDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -64,6 +64,11 @@ internal DelimitedTextDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "DelimitedText"; } + /// Initializes a new instance of for deserialization. + internal DelimitedTextDataset() + { + } + /// /// The location of the delimited text storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.Serialization.cs index 63374ee49898..5bea2e6b44ea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DelimitedTextReadSettings : IUtf8JsonSerializable + public partial class DelimitedTextReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SkipLineCount)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CompressionProperties)) { writer.WritePropertyName("compressionProperties"u8); - writer.WriteObjectValue(CompressionProperties); + if (CompressionProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CompressionProperties).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(FormatReadSettingsType); @@ -42,8 +55,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DelimitedTextReadSettings DeserializeDelimitedTextReadSettings(JsonElement element) + internal static DelimitedTextReadSettings DeserializeDelimitedTextReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +98,53 @@ internal static DelimitedTextReadSettings DeserializeDelimitedTextReadSettings(J additionalProperties = additionalPropertiesDictionary; return new DelimitedTextReadSettings(type, additionalProperties, skipLineCount.Value, compressionProperties.Value); } + + DelimitedTextReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDelimitedTextReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DelimitedTextReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDelimitedTextReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DelimitedTextReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DelimitedTextReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDelimitedTextReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.cs index 46b593c08cc6..7066a7d3334d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Delimited text read settings. public partial class DelimitedTextReadSettings : FormatReadSettings { - /// Initializes a new instance of DelimitedTextReadSettings. + /// Initializes a new instance of . public DelimitedTextReadSettings() { FormatReadSettingsType = "DelimitedTextReadSettings"; } - /// Initializes a new instance of DelimitedTextReadSettings. + /// Initializes a new instance of . /// The read setting type. /// Additional Properties. /// Indicates the number of non-empty rows to skip when reading data from input files. Type: integer (or Expression with resultType integer). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.Serialization.cs index 7fe3a709ea9b..4f04a2956b71 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DelimitedTextSink : IUtf8JsonSerializable + public partial class DelimitedTextSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -72,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DelimitedTextSink DeserializeDelimitedTextSink(JsonElement element) + internal static DelimitedTextSink DeserializeDelimitedTextSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +195,53 @@ internal static DelimitedTextSink DeserializeDelimitedTextSink(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DelimitedTextSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value); } + + DelimitedTextSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDelimitedTextSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DelimitedTextSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDelimitedTextSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DelimitedTextSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DelimitedTextSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDelimitedTextSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.cs index 140c01687b88..201710fd2f7b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity DelimitedText sink. public partial class DelimitedTextSink : CopySink { - /// Initializes a new instance of DelimitedTextSink. + /// Initializes a new instance of . public DelimitedTextSink() { CopySinkType = "DelimitedTextSink"; } - /// Initializes a new instance of DelimitedTextSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.Serialization.cs index 0d25706b1620..2e2d9ec766c3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DelimitedTextSource : IUtf8JsonSerializable + public partial class DelimitedTextSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -71,8 +91,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DelimitedTextSource DeserializeDelimitedTextSource(JsonElement element) + internal static DelimitedTextSource DeserializeDelimitedTextSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +184,53 @@ internal static DelimitedTextSource DeserializeDelimitedTextSource(JsonElement e additionalProperties = additionalPropertiesDictionary; return new DelimitedTextSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value, additionalColumns.Value); } + + DelimitedTextSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDelimitedTextSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DelimitedTextSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDelimitedTextSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DelimitedTextSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DelimitedTextSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDelimitedTextSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.cs index fb858587f769..99764c5987e9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity DelimitedText source. public partial class DelimitedTextSource : CopyActivitySource { - /// Initializes a new instance of DelimitedTextSource. + /// Initializes a new instance of . public DelimitedTextSource() { CopySourceType = "DelimitedTextSource"; } - /// Initializes a new instance of DelimitedTextSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.Serialization.cs index 88d5adcd2679..bd41cc33d8c6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DelimitedTextWriteSettings : IUtf8JsonSerializable + public partial class DelimitedTextWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QuoteAllText)) { @@ -49,8 +55,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DelimitedTextWriteSettings DeserializeDelimitedTextWriteSettings(JsonElement element) + internal static DelimitedTextWriteSettings DeserializeDelimitedTextWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -106,5 +114,53 @@ internal static DelimitedTextWriteSettings DeserializeDelimitedTextWriteSettings additionalProperties = additionalPropertiesDictionary; return new DelimitedTextWriteSettings(type, additionalProperties, quoteAllText.Value, fileExtension, maxRowsPerFile.Value, fileNamePrefix.Value); } + + DelimitedTextWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDelimitedTextWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DelimitedTextWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDelimitedTextWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DelimitedTextWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DelimitedTextWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDelimitedTextWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.cs index ddd1a0ecc6b2..63281a1491db 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DelimitedTextWriteSettings.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Delimited text write settings. public partial class DelimitedTextWriteSettings : FormatWriteSettings { - /// Initializes a new instance of DelimitedTextWriteSettings. + /// Initializes a new instance of . /// The file extension used to create the files. Type: string (or Expression with resultType string). /// is null. public DelimitedTextWriteSettings(DataFactoryElement fileExtension) @@ -26,7 +26,7 @@ public DelimitedTextWriteSettings(DataFactoryElement fileExtension) FormatWriteSettingsType = "DelimitedTextWriteSettings"; } - /// Initializes a new instance of DelimitedTextWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// Additional Properties. /// Indicates whether string values should always be enclosed with quotes. Type: boolean (or Expression with resultType boolean). @@ -42,6 +42,11 @@ internal DelimitedTextWriteSettings(string formatWriteSettingsType, IDictionary< FormatWriteSettingsType = formatWriteSettingsType ?? "DelimitedTextWriteSettings"; } + /// Initializes a new instance of for deserialization. + internal DelimitedTextWriteSettings() + { + } + /// Indicates whether string values should always be enclosed with quotes. Type: boolean (or Expression with resultType boolean). public DataFactoryElement QuoteAllText { get; set; } /// The file extension used to create the files. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.Serialization.cs index 5718293fe499..e8f9502bc240 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DependencyReference : IUtf8JsonSerializable + public partial class DependencyReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DependencyReferenceType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DependencyReference DeserializeDependencyReference(JsonElement element) + internal static DependencyReference DeserializeDependencyReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -35,7 +57,72 @@ internal static DependencyReference DeserializeDependencyReference(JsonElement e case "TumblingWindowTriggerDependencyReference": return TumblingWindowTriggerDependencyReference.DeserializeTumblingWindowTriggerDependencyReference(element); } } - return UnknownDependencyReference.DeserializeUnknownDependencyReference(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownDependencyReference(type, serializedAdditionalRawData); + } + + DependencyReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDependencyReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DependencyReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDependencyReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DependencyReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DependencyReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDependencyReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.cs index c45f03a54a81..dc02f81374e2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DependencyReference.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.DataFactory.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// + [DeserializationProxy(typeof(UnknownDependencyReference))] public abstract partial class DependencyReference { - /// Initializes a new instance of DependencyReference. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected DependencyReference() { } - /// Initializes a new instance of DependencyReference. + /// Initializes a new instance of . /// The type of dependency reference. - internal DependencyReference(string dependencyReferenceType) + /// Keeps track of any properties unknown to the library. + internal DependencyReference(string dependencyReferenceType, Dictionary serializedAdditionalRawData) { DependencyReferenceType = dependencyReferenceType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of dependency reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.Serialization.cs index ccb9b7579096..e5c773bb1668 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DistcpSettings : IUtf8JsonSerializable + public partial class DistcpSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceManagerEndpoint"u8); JsonSerializer.Serialize(writer, ResourceManagerEndpoint); @@ -25,11 +33,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("distcpOptions"u8); JsonSerializer.Serialize(writer, DistcpOptions); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static DistcpSettings DeserializeDistcpSettings(JsonElement element) + internal static DistcpSettings DeserializeDistcpSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -37,6 +59,7 @@ internal static DistcpSettings DeserializeDistcpSettings(JsonElement element) DataFactoryElement resourceManagerEndpoint = default; DataFactoryElement tempScriptPath = default; Optional> distcpOptions = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceManagerEndpoint"u8)) @@ -58,8 +81,61 @@ internal static DistcpSettings DeserializeDistcpSettings(JsonElement element) distcpOptions = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new DistcpSettings(resourceManagerEndpoint, tempScriptPath, distcpOptions.Value, serializedAdditionalRawData); + } + + DistcpSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDistcpSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DistcpSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDistcpSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DistcpSettings model) + { + if (model is null) + { + return null; } - return new DistcpSettings(resourceManagerEndpoint, tempScriptPath, distcpOptions.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DistcpSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDistcpSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.cs index b19c271ff1b3..819e8272b74f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DistcpSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Distcp settings. public partial class DistcpSettings { - /// Initializes a new instance of DistcpSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Specifies the Yarn ResourceManager endpoint. Type: string (or Expression with resultType string). /// Specifies an existing folder path which will be used to store temp Distcp command script. The script file is generated by ADF and will be removed after Copy job finished. Type: string (or Expression with resultType string). /// or is null. @@ -27,15 +31,22 @@ public DistcpSettings(DataFactoryElement resourceManagerEndpoint, DataFa TempScriptPath = tempScriptPath; } - /// Initializes a new instance of DistcpSettings. + /// Initializes a new instance of . /// Specifies the Yarn ResourceManager endpoint. Type: string (or Expression with resultType string). /// Specifies an existing folder path which will be used to store temp Distcp command script. The script file is generated by ADF and will be removed after Copy job finished. Type: string (or Expression with resultType string). /// Specifies the Distcp options. Type: string (or Expression with resultType string). - internal DistcpSettings(DataFactoryElement resourceManagerEndpoint, DataFactoryElement tempScriptPath, DataFactoryElement distcpOptions) + /// Keeps track of any properties unknown to the library. + internal DistcpSettings(DataFactoryElement resourceManagerEndpoint, DataFactoryElement tempScriptPath, DataFactoryElement distcpOptions, Dictionary serializedAdditionalRawData) { ResourceManagerEndpoint = resourceManagerEndpoint; TempScriptPath = tempScriptPath; DistcpOptions = distcpOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DistcpSettings() + { } /// Specifies the Yarn ResourceManager endpoint. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.Serialization.cs index b042383b9529..4f91e130d214 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DocumentDBCollectionDataset : IUtf8JsonSerializable + public partial class DocumentDBCollectionDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DocumentDBCollectionDataset DeserializeDocumentDBCollectionDataset(JsonElement element) + internal static DocumentDBCollectionDataset DeserializeDocumentDBCollectionDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static DocumentDBCollectionDataset DeserializeDocumentDBCollectionDatas additionalProperties = additionalPropertiesDictionary; return new DocumentDBCollectionDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, collectionName); } + + DocumentDBCollectionDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentDBCollectionDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DocumentDBCollectionDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDocumentDBCollectionDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DocumentDBCollectionDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DocumentDBCollectionDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDocumentDBCollectionDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.cs index dea0ce69d3d6..1ee660c05c70 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Microsoft Azure Document Database Collection dataset. public partial class DocumentDBCollectionDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DocumentDBCollectionDataset. + /// Initializes a new instance of . /// Linked service reference. /// Document Database collection name. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public DocumentDBCollectionDataset(DataFactoryLinkedServiceReference linkedServi DatasetType = "DocumentDbCollection"; } - /// Initializes a new instance of DocumentDBCollectionDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal DocumentDBCollectionDataset(string datasetType, string description, Dat DatasetType = datasetType ?? "DocumentDbCollection"; } + /// Initializes a new instance of for deserialization. + internal DocumentDBCollectionDataset() + { + } + /// Document Database collection name. Type: string (or Expression with resultType string). public DataFactoryElement CollectionName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.Serialization.cs index f83999092dc7..0ed9aee2884f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DocumentDBCollectionSink : IUtf8JsonSerializable + public partial class DocumentDBCollectionSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(NestingSeparator)) { @@ -72,8 +78,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DocumentDBCollectionSink DeserializeDocumentDBCollectionSink(JsonElement element) + internal static DocumentDBCollectionSink DeserializeDocumentDBCollectionSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +181,53 @@ internal static DocumentDBCollectionSink DeserializeDocumentDBCollectionSink(Jso additionalProperties = additionalPropertiesDictionary; return new DocumentDBCollectionSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, nestingSeparator.Value, writeBehavior.Value); } + + DocumentDBCollectionSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentDBCollectionSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DocumentDBCollectionSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDocumentDBCollectionSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DocumentDBCollectionSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DocumentDBCollectionSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDocumentDBCollectionSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.cs index 608fd43493f6..e95878798037 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Document Database Collection sink. public partial class DocumentDBCollectionSink : CopySink { - /// Initializes a new instance of DocumentDBCollectionSink. + /// Initializes a new instance of . public DocumentDBCollectionSink() { CopySinkType = "DocumentDbCollectionSink"; } - /// Initializes a new instance of DocumentDBCollectionSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.Serialization.cs index e166ac1f4b98..da4c8d2dbf8d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DocumentDBCollectionSource : IUtf8JsonSerializable + public partial class DocumentDBCollectionSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DocumentDBCollectionSource DeserializeDocumentDBCollectionSource(JsonElement element) + internal static DocumentDBCollectionSource DeserializeDocumentDBCollectionSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static DocumentDBCollectionSource DeserializeDocumentDBCollectionSource additionalProperties = additionalPropertiesDictionary; return new DocumentDBCollectionSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, nestingSeparator.Value, queryTimeout.Value, additionalColumns.Value); } + + DocumentDBCollectionSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentDBCollectionSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DocumentDBCollectionSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDocumentDBCollectionSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DocumentDBCollectionSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DocumentDBCollectionSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDocumentDBCollectionSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.cs index f52918ac940c..c29a0c83d9bd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DocumentDBCollectionSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Document Database Collection source. public partial class DocumentDBCollectionSource : CopyActivitySource { - /// Initializes a new instance of DocumentDBCollectionSource. + /// Initializes a new instance of . public DocumentDBCollectionSource() { CopySourceType = "DocumentDbCollectionSource"; } - /// Initializes a new instance of DocumentDBCollectionSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.Serialization.cs index b904f06c7c45..b77535f39e1f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DrillLinkedService : IUtf8JsonSerializable + public partial class DrillLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DrillLinkedService DeserializeDrillLinkedService(JsonElement element) + internal static DrillLinkedService DeserializeDrillLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static DrillLinkedService DeserializeDrillLinkedService(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new DrillLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, password, encryptedCredential.Value); } + + DrillLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDrillLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DrillLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDrillLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DrillLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DrillLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDrillLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.cs index 8a1d40ffab52..7e63697ac74b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Drill server linked service. public partial class DrillLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of DrillLinkedService. + /// Initializes a new instance of . public DrillLinkedService() { LinkedServiceType = "Drill"; } - /// Initializes a new instance of DrillLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.Serialization.cs index 3b54ad0a2741..226676649a34 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DrillSource : IUtf8JsonSerializable + public partial class DrillSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DrillSource DeserializeDrillSource(JsonElement element) + internal static DrillSource DeserializeDrillSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static DrillSource DeserializeDrillSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new DrillSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + DrillSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDrillSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DrillSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDrillSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DrillSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DrillSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDrillSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.cs index dd4c222b1653..cd34ca1771d9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Drill server source. public partial class DrillSource : TabularSource { - /// Initializes a new instance of DrillSource. + /// Initializes a new instance of . public DrillSource() { CopySourceType = "DrillSource"; } - /// Initializes a new instance of DrillSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.Serialization.cs index 6fd44066f262..eec2e6551cae 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DrillTableDataset : IUtf8JsonSerializable + public partial class DrillTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DrillTableDataset DeserializeDrillTableDataset(JsonElement element) + internal static DrillTableDataset DeserializeDrillTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static DrillTableDataset DeserializeDrillTableDataset(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DrillTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + DrillTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDrillTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DrillTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDrillTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DrillTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DrillTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDrillTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.cs index 4fd354879150..09eee4b93009 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DrillTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Drill server dataset. public partial class DrillTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DrillTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public DrillTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public DrillTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "DrillTable"; } - /// Initializes a new instance of DrillTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal DrillTableDataset(string datasetType, string description, DataFactoryEl DatasetType = datasetType ?? "DrillTable"; } + /// Initializes a new instance of for deserialization. + internal DrillTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.Serialization.cs index c364b391526a..9257b7289dcd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsAXLinkedService : IUtf8JsonSerializable + public partial class DynamicsAXLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -93,8 +113,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsAXLinkedService DeserializeDynamicsAXLinkedService(JsonElement element) + internal static DynamicsAXLinkedService DeserializeDynamicsAXLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -215,5 +237,53 @@ internal static DynamicsAXLinkedService DeserializeDynamicsAXLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new DynamicsAXLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, servicePrincipalId, servicePrincipalKey, tenant, aadResourceId, encryptedCredential.Value); } + + DynamicsAXLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsAXLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsAXLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsAXLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsAXLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsAXLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsAXLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.cs index 0b354f02d65e..34c9671668e5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Dynamics AX linked service. public partial class DynamicsAXLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of DynamicsAXLinkedService. + /// Initializes a new instance of . /// The Dynamics AX (or Dynamics 365 Finance and Operations) instance OData endpoint. /// Specify the application's client ID. Type: string (or Expression with resultType string). /// Specify the application's key. Mark this field as a SecureString to store it securely in Data Factory, or reference a secret stored in Azure Key Vault. Type: string (or Expression with resultType string). @@ -38,7 +38,7 @@ public DynamicsAXLinkedService(BinaryData uri, DataFactoryElement servic LinkedServiceType = "DynamicsAX"; } - /// Initializes a new instance of DynamicsAXLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -62,6 +62,11 @@ internal DynamicsAXLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "DynamicsAX"; } + /// Initializes a new instance of for deserialization. + internal DynamicsAXLinkedService() + { + } + /// /// The Dynamics AX (or Dynamics 365 Finance and Operations) instance OData endpoint. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.Serialization.cs index 319d25625d03..21fdaa69d70d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsAXResourceDataset : IUtf8JsonSerializable + public partial class DynamicsAXResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsAXResourceDataset DeserializeDynamicsAXResourceDataset(JsonElement element) + internal static DynamicsAXResourceDataset DeserializeDynamicsAXResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static DynamicsAXResourceDataset DeserializeDynamicsAXResourceDataset(J additionalProperties = additionalPropertiesDictionary; return new DynamicsAXResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, path); } + + DynamicsAXResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsAXResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsAXResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsAXResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsAXResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsAXResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsAXResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.cs index d09fd300830b..ea1b45400487 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The path of the Dynamics AX OData entity. public partial class DynamicsAXResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DynamicsAXResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// The path of the Dynamics AX OData entity. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public DynamicsAXResourceDataset(DataFactoryLinkedServiceReference linkedService DatasetType = "DynamicsAXResource"; } - /// Initializes a new instance of DynamicsAXResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal DynamicsAXResourceDataset(string datasetType, string description, DataF DatasetType = datasetType ?? "DynamicsAXResource"; } + /// Initializes a new instance of for deserialization. + internal DynamicsAXResourceDataset() + { + } + /// The path of the Dynamics AX OData entity. Type: string (or Expression with resultType string). public DataFactoryElement Path { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.Serialization.cs index a9a4534f244e..e690cc8d17e0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsAXSource : IUtf8JsonSerializable + public partial class DynamicsAXSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsAXSource DeserializeDynamicsAXSource(JsonElement element) + internal static DynamicsAXSource DeserializeDynamicsAXSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static DynamicsAXSource DeserializeDynamicsAXSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new DynamicsAXSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, httpRequestTimeout.Value); } + + DynamicsAXSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsAXSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsAXSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsAXSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsAXSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsAXSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsAXSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.cs index 88d5b117c3a6..1cb2b1340a62 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsAXSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Dynamics AX source. public partial class DynamicsAXSource : TabularSource { - /// Initializes a new instance of DynamicsAXSource. + /// Initializes a new instance of . public DynamicsAXSource() { CopySourceType = "DynamicsAXSource"; } - /// Initializes a new instance of DynamicsAXSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.Serialization.cs index c625da91f634..fe5c0b320958 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsCrmEntityDataset : IUtf8JsonSerializable + public partial class DynamicsCrmEntityDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsCrmEntityDataset DeserializeDynamicsCrmEntityDataset(JsonElement element) + internal static DynamicsCrmEntityDataset DeserializeDynamicsCrmEntityDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static DynamicsCrmEntityDataset DeserializeDynamicsCrmEntityDataset(Jso additionalProperties = additionalPropertiesDictionary; return new DynamicsCrmEntityDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, entityName.Value); } + + DynamicsCrmEntityDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsCrmEntityDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsCrmEntityDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsCrmEntityDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsCrmEntityDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsCrmEntityDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsCrmEntityDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.cs index 764110b25781..901d16134df2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmEntityDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Dynamics CRM entity dataset. public partial class DynamicsCrmEntityDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DynamicsCrmEntityDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public DynamicsCrmEntityDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public DynamicsCrmEntityDataset(DataFactoryLinkedServiceReference linkedServiceN DatasetType = "DynamicsCrmEntity"; } - /// Initializes a new instance of DynamicsCrmEntityDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal DynamicsCrmEntityDataset(string datasetType, string description, DataFa DatasetType = datasetType ?? "DynamicsCrmEntity"; } + /// Initializes a new instance of for deserialization. + internal DynamicsCrmEntityDataset() + { + } + /// The logical name of the entity. Type: string (or Expression with resultType string). public DataFactoryElement EntityName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.Serialization.cs index 5a79ba3d3ce0..4f937b79c34c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsCrmLinkedService : IUtf8JsonSerializable + public partial class DynamicsCrmLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -129,8 +149,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsCrmLinkedService DeserializeDynamicsCrmLinkedService(JsonElement element) + internal static DynamicsCrmLinkedService DeserializeDynamicsCrmLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -323,5 +345,53 @@ internal static DynamicsCrmLinkedService DeserializeDynamicsCrmLinkedService(Jso additionalProperties = additionalPropertiesDictionary; return new DynamicsCrmLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, deploymentType, hostName.Value, port.Value, serviceUri.Value, organizationName.Value, authenticationType, username.Value, password, servicePrincipalId.Value, servicePrincipalCredentialType.Value, servicePrincipalCredential, encryptedCredential.Value); } + + DynamicsCrmLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsCrmLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsCrmLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsCrmLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsCrmLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsCrmLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsCrmLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.cs index 79f8a283f300..a0cf27c9c835 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Dynamics CRM linked service. public partial class DynamicsCrmLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of DynamicsCrmLinkedService. + /// Initializes a new instance of . /// The deployment type of the Dynamics CRM instance. 'Online' for Dynamics CRM Online and 'OnPremisesWithIfd' for Dynamics CRM on-premises with Ifd. Type: string (or Expression with resultType string). /// The authentication type to connect to Dynamics CRM server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public DynamicsCrmLinkedService(DataFactoryElement deploymentType, DataF LinkedServiceType = "DynamicsCrm"; } - /// Initializes a new instance of DynamicsCrmLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -65,6 +65,11 @@ internal DynamicsCrmLinkedService(string linkedServiceType, IntegrationRuntimeRe LinkedServiceType = linkedServiceType ?? "DynamicsCrm"; } + /// Initializes a new instance of for deserialization. + internal DynamicsCrmLinkedService() + { + } + /// The deployment type of the Dynamics CRM instance. 'Online' for Dynamics CRM Online and 'OnPremisesWithIfd' for Dynamics CRM on-premises with Ifd. Type: string (or Expression with resultType string). public DataFactoryElement DeploymentType { get; set; } /// The host name of the on-premises Dynamics CRM server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.Serialization.cs index 2b06627cdccc..19c1efb663ee 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsCrmSink : IUtf8JsonSerializable + public partial class DynamicsCrmSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("writeBehavior"u8); writer.WriteStringValue(WriteBehavior.ToString()); @@ -74,8 +80,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsCrmSink DeserializeDynamicsCrmSink(JsonElement element) + internal static DynamicsCrmSink DeserializeDynamicsCrmSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -181,5 +189,53 @@ internal static DynamicsCrmSink DeserializeDynamicsCrmSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new DynamicsCrmSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior, ignoreNullValues.Value, alternateKeyName.Value); } + + DynamicsCrmSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsCrmSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsCrmSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsCrmSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsCrmSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsCrmSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsCrmSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.cs index 42d6e9f17f53..102d7f5ff869 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSink.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Dynamics CRM sink. public partial class DynamicsCrmSink : CopySink { - /// Initializes a new instance of DynamicsCrmSink. + /// Initializes a new instance of . /// The write behavior for the operation. public DynamicsCrmSink(DynamicsSinkWriteBehavior writeBehavior) { @@ -22,7 +22,7 @@ public DynamicsCrmSink(DynamicsSinkWriteBehavior writeBehavior) CopySinkType = "DynamicsCrmSink"; } - /// Initializes a new instance of DynamicsCrmSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). @@ -42,6 +42,11 @@ internal DynamicsCrmSink(string copySinkType, DataFactoryElement writeBatch CopySinkType = copySinkType ?? "DynamicsCrmSink"; } + /// Initializes a new instance of for deserialization. + internal DynamicsCrmSink() + { + } + /// The write behavior for the operation. public DynamicsSinkWriteBehavior WriteBehavior { get; set; } /// The flag indicating whether to ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.Serialization.cs index b2402dbd5ce5..aee3eb5225e6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsCrmSource : IUtf8JsonSerializable + public partial class DynamicsCrmSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsCrmSource DeserializeDynamicsCrmSource(JsonElement element) + internal static DynamicsCrmSource DeserializeDynamicsCrmSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static DynamicsCrmSource DeserializeDynamicsCrmSource(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new DynamicsCrmSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, additionalColumns.Value); } + + DynamicsCrmSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsCrmSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsCrmSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsCrmSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsCrmSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsCrmSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsCrmSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.cs index edf8ed24c47d..823af191d8d8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsCrmSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Dynamics CRM source. public partial class DynamicsCrmSource : CopyActivitySource { - /// Initializes a new instance of DynamicsCrmSource. + /// Initializes a new instance of . public DynamicsCrmSource() { CopySourceType = "DynamicsCrmSource"; } - /// Initializes a new instance of DynamicsCrmSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.Serialization.cs index 657bdf7a367e..1a81b0ab86c2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsEntityDataset : IUtf8JsonSerializable + public partial class DynamicsEntityDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsEntityDataset DeserializeDynamicsEntityDataset(JsonElement element) + internal static DynamicsEntityDataset DeserializeDynamicsEntityDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static DynamicsEntityDataset DeserializeDynamicsEntityDataset(JsonEleme additionalProperties = additionalPropertiesDictionary; return new DynamicsEntityDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, entityName.Value); } + + DynamicsEntityDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsEntityDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsEntityDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsEntityDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsEntityDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsEntityDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsEntityDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.cs index 0d8e12e86ea1..d9949e761d7c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsEntityDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Dynamics entity dataset. public partial class DynamicsEntityDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of DynamicsEntityDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public DynamicsEntityDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public DynamicsEntityDataset(DataFactoryLinkedServiceReference linkedServiceName DatasetType = "DynamicsEntity"; } - /// Initializes a new instance of DynamicsEntityDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal DynamicsEntityDataset(string datasetType, string description, DataFacto DatasetType = datasetType ?? "DynamicsEntity"; } + /// Initializes a new instance of for deserialization. + internal DynamicsEntityDataset() + { + } + /// The logical name of the entity. Type: string (or Expression with resultType string). public DataFactoryElement EntityName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.Serialization.cs index 4d2bb6f0b086..96596bd60b36 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsLinkedService : IUtf8JsonSerializable + public partial class DynamicsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -119,7 +139,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -134,8 +161,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsLinkedService DeserializeDynamicsLinkedService(JsonElement element) + internal static DynamicsLinkedService DeserializeDynamicsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -338,5 +367,53 @@ internal static DynamicsLinkedService DeserializeDynamicsLinkedService(JsonEleme additionalProperties = additionalPropertiesDictionary; return new DynamicsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, deploymentType, hostName.Value, port.Value, serviceUri.Value, organizationName.Value, authenticationType, username.Value, password, servicePrincipalId.Value, servicePrincipalCredentialType.Value, servicePrincipalCredential, encryptedCredential.Value, credential.Value); } + + DynamicsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.cs index 318c2fec8d3d..f4d598ae1c76 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Dynamics linked service. public partial class DynamicsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of DynamicsLinkedService. + /// Initializes a new instance of . /// The deployment type of the Dynamics instance. 'Online' for Dynamics Online and 'OnPremisesWithIfd' for Dynamics on-premises with Ifd. Type: string (or Expression with resultType string). /// The authentication type to connect to Dynamics server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public DynamicsLinkedService(DataFactoryElement deploymentType, DataFact LinkedServiceType = "Dynamics"; } - /// Initializes a new instance of DynamicsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -67,6 +67,11 @@ internal DynamicsLinkedService(string linkedServiceType, IntegrationRuntimeRefer LinkedServiceType = linkedServiceType ?? "Dynamics"; } + /// Initializes a new instance of for deserialization. + internal DynamicsLinkedService() + { + } + /// The deployment type of the Dynamics instance. 'Online' for Dynamics Online and 'OnPremisesWithIfd' for Dynamics on-premises with Ifd. Type: string (or Expression with resultType string). public DataFactoryElement DeploymentType { get; set; } /// The host name of the on-premises Dynamics server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.Serialization.cs index 90bce3d1800c..da7b6bc1725e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsSink : IUtf8JsonSerializable + public partial class DynamicsSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("writeBehavior"u8); writer.WriteStringValue(WriteBehavior.ToString()); @@ -74,8 +80,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsSink DeserializeDynamicsSink(JsonElement element) + internal static DynamicsSink DeserializeDynamicsSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -181,5 +189,53 @@ internal static DynamicsSink DeserializeDynamicsSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new DynamicsSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior, ignoreNullValues.Value, alternateKeyName.Value); } + + DynamicsSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.cs index 5011ab15480e..94377b07aa39 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSink.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Dynamics sink. public partial class DynamicsSink : CopySink { - /// Initializes a new instance of DynamicsSink. + /// Initializes a new instance of . /// The write behavior for the operation. public DynamicsSink(DynamicsSinkWriteBehavior writeBehavior) { @@ -22,7 +22,7 @@ public DynamicsSink(DynamicsSinkWriteBehavior writeBehavior) CopySinkType = "DynamicsSink"; } - /// Initializes a new instance of DynamicsSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). @@ -42,6 +42,11 @@ internal DynamicsSink(string copySinkType, DataFactoryElement writeBatchSiz CopySinkType = copySinkType ?? "DynamicsSink"; } + /// Initializes a new instance of for deserialization. + internal DynamicsSink() + { + } + /// The write behavior for the operation. public DynamicsSinkWriteBehavior WriteBehavior { get; set; } /// The flag indicating whether ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.Serialization.cs index 248a368f4921..3ab5397e4e39 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class DynamicsSource : IUtf8JsonSerializable + public partial class DynamicsSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static DynamicsSource DeserializeDynamicsSource(JsonElement element) + internal static DynamicsSource DeserializeDynamicsSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static DynamicsSource DeserializeDynamicsSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new DynamicsSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, additionalColumns.Value); } + + DynamicsSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicsSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + DynamicsSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeDynamicsSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(DynamicsSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator DynamicsSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeDynamicsSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.cs index c72f21ca2742..e3d5143fcdab 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/DynamicsSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Dynamics source. public partial class DynamicsSource : CopyActivitySource { - /// Initializes a new instance of DynamicsSource. + /// Initializes a new instance of . public DynamicsSource() { CopySourceType = "DynamicsSource"; } - /// Initializes a new instance of DynamicsSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.Serialization.cs index 153e570e9ce5..e125359b8cfb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class EloquaLinkedService : IUtf8JsonSerializable + public partial class EloquaLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -104,8 +124,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static EloquaLinkedService DeserializeEloquaLinkedService(JsonElement element) + internal static EloquaLinkedService DeserializeEloquaLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -248,5 +270,53 @@ internal static EloquaLinkedService DeserializeEloquaLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new EloquaLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, username, password, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + EloquaLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEloquaLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EloquaLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEloquaLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EloquaLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EloquaLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEloquaLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.cs index 0e8443207d42..a0f7ccdff02f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Eloqua server linked service. public partial class EloquaLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of EloquaLinkedService. + /// Initializes a new instance of . /// The endpoint of the Eloqua server. (i.e. eloqua.example.com). /// The site name and user name of your Eloqua account in the form: sitename/username. (i.e. Eloqua/Alice). /// or is null. @@ -29,7 +29,7 @@ public EloquaLinkedService(DataFactoryElement endpoint, DataFactoryEleme LinkedServiceType = "Eloqua"; } - /// Initializes a new instance of EloquaLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -55,6 +55,11 @@ internal EloquaLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "Eloqua"; } + /// Initializes a new instance of for deserialization. + internal EloquaLinkedService() + { + } + /// The endpoint of the Eloqua server. (i.e. eloqua.example.com). public DataFactoryElement Endpoint { get; set; } /// The site name and user name of your Eloqua account in the form: sitename/username. (i.e. Eloqua/Alice). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.Serialization.cs index bc0d55646db2..a97ae89a9588 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class EloquaObjectDataset : IUtf8JsonSerializable + public partial class EloquaObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static EloquaObjectDataset DeserializeEloquaObjectDataset(JsonElement element) + internal static EloquaObjectDataset DeserializeEloquaObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static EloquaObjectDataset DeserializeEloquaObjectDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new EloquaObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + EloquaObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEloquaObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EloquaObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEloquaObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EloquaObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EloquaObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEloquaObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.cs index 73a1c820500b..72520165f8e3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Eloqua server dataset. public partial class EloquaObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of EloquaObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public EloquaObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public EloquaObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "EloquaObject"; } - /// Initializes a new instance of EloquaObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal EloquaObjectDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "EloquaObject"; } + /// Initializes a new instance of for deserialization. + internal EloquaObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.Serialization.cs index b1f1efec9208..70c66799f817 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class EloquaSource : IUtf8JsonSerializable + public partial class EloquaSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static EloquaSource DeserializeEloquaSource(JsonElement element) + internal static EloquaSource DeserializeEloquaSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static EloquaSource DeserializeEloquaSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new EloquaSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + EloquaSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEloquaSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EloquaSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEloquaSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EloquaSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EloquaSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEloquaSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.cs index 5c42e3bde69e..d2fda3e6b8d0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EloquaSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Eloqua server source. public partial class EloquaSource : TabularSource { - /// Initializes a new instance of EloquaSource. + /// Initializes a new instance of . public EloquaSource() { CopySourceType = "EloquaSource"; } - /// Initializes a new instance of EloquaSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.Serialization.cs index 87f21e86116d..103f8feaacdd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class EntityParameterSpecification : IUtf8JsonSerializable + public partial class EntityParameterSpecification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.ToString()); @@ -27,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(DefaultValue.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EntityParameterSpecification DeserializeEntityParameterSpecification(JsonElement element) + internal static EntityParameterSpecification DeserializeEntityParameterSpecification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } EntityParameterType type = default; Optional defaultValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -54,8 +76,61 @@ internal static EntityParameterSpecification DeserializeEntityParameterSpecifica defaultValue = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new EntityParameterSpecification(type, defaultValue.Value); + return new EntityParameterSpecification(type, defaultValue.Value, serializedAdditionalRawData); + } + + EntityParameterSpecification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEntityParameterSpecification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EntityParameterSpecification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEntityParameterSpecification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EntityParameterSpecification model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EntityParameterSpecification(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEntityParameterSpecification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.cs index 76c3cdf2226d..31f44e38bc00 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityParameterSpecification.cs @@ -6,26 +6,37 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Definition of a single parameter for an entity. public partial class EntityParameterSpecification { - /// Initializes a new instance of EntityParameterSpecification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Parameter type. public EntityParameterSpecification(EntityParameterType parameterType) { ParameterType = parameterType; } - /// Initializes a new instance of EntityParameterSpecification. + /// Initializes a new instance of . /// Parameter type. /// Default value of parameter. - internal EntityParameterSpecification(EntityParameterType parameterType, BinaryData defaultValue) + /// Keeps track of any properties unknown to the library. + internal EntityParameterSpecification(EntityParameterType parameterType, BinaryData defaultValue, Dictionary serializedAdditionalRawData) { ParameterType = parameterType; DefaultValue = defaultValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityParameterSpecification() + { } /// Parameter type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.Serialization.cs index d61df95ee256..935274450779 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class EntityReference : IUtf8JsonSerializable + public partial class EntityReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IntegrationRuntimeEntityReferenceType)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("referenceName"u8); writer.WriteStringValue(ReferenceName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EntityReference DeserializeEntityReference(JsonElement element) + internal static EntityReference DeserializeEntityReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional type = default; Optional referenceName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -52,8 +75,61 @@ internal static EntityReference DeserializeEntityReference(JsonElement element) referenceName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EntityReference(Optional.ToNullable(type), referenceName.Value, serializedAdditionalRawData); + } + + EntityReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEntityReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EntityReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEntityReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EntityReference model) + { + if (model is null) + { + return null; } - return new EntityReference(Optional.ToNullable(type), referenceName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EntityReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEntityReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.cs index f28770a944ff..528beb86de81 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EntityReference.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The entity reference. public partial class EntityReference { - /// Initializes a new instance of EntityReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public EntityReference() { } - /// Initializes a new instance of EntityReference. + /// Initializes a new instance of . /// The type of this referenced entity. /// The name of this referenced entity. - internal EntityReference(IntegrationRuntimeEntityReferenceType? integrationRuntimeEntityReferenceType, string referenceName) + /// Keeps track of any properties unknown to the library. + internal EntityReference(IntegrationRuntimeEntityReferenceType? integrationRuntimeEntityReferenceType, string referenceName, Dictionary serializedAdditionalRawData) { IntegrationRuntimeEntityReferenceType = integrationRuntimeEntityReferenceType; ReferenceName = referenceName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The type of this referenced entity. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.Serialization.cs index db287a5ee0f0..c669f26acab4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class EnvironmentVariableSetup : IUtf8JsonSerializable + public partial class EnvironmentVariableSetup : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CustomSetupBaseType); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("variableValue"u8); writer.WriteStringValue(VariableValue); writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static EnvironmentVariableSetup DeserializeEnvironmentVariableSetup(JsonElement element) + internal static EnvironmentVariableSetup DeserializeEnvironmentVariableSetup(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static EnvironmentVariableSetup DeserializeEnvironmentVariableSetup(Jso string type = default; string variableName = default; string variableValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -65,8 +88,61 @@ internal static EnvironmentVariableSetup DeserializeEnvironmentVariableSetup(Jso } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new EnvironmentVariableSetup(type, variableName, variableValue, serializedAdditionalRawData); + } + + EnvironmentVariableSetup IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeEnvironmentVariableSetup(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + EnvironmentVariableSetup IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeEnvironmentVariableSetup(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(EnvironmentVariableSetup model) + { + if (model is null) + { + return null; } - return new EnvironmentVariableSetup(type, variableName, variableValue); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator EnvironmentVariableSetup(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeEnvironmentVariableSetup(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.cs index ae28e11a6755..c5b219644446 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/EnvironmentVariableSetup.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The custom setup of setting environment variable. public partial class EnvironmentVariableSetup : CustomSetupBase { - /// Initializes a new instance of EnvironmentVariableSetup. + /// Initializes a new instance of . /// The name of the environment variable. /// The value of the environment variable. /// or is null. @@ -27,17 +28,23 @@ public EnvironmentVariableSetup(string variableName, string variableValue) CustomSetupBaseType = "EnvironmentVariableSetup"; } - /// Initializes a new instance of EnvironmentVariableSetup. + /// Initializes a new instance of . /// The type of custom setup. /// The name of the environment variable. /// The value of the environment variable. - internal EnvironmentVariableSetup(string customSetupBaseType, string variableName, string variableValue) : base(customSetupBaseType) + /// Keeps track of any properties unknown to the library. + internal EnvironmentVariableSetup(string customSetupBaseType, string variableName, string variableValue, Dictionary serializedAdditionalRawData) : base(customSetupBaseType, serializedAdditionalRawData) { VariableName = variableName; VariableValue = variableValue; CustomSetupBaseType = customSetupBaseType ?? "EnvironmentVariableSetup"; } + /// Initializes a new instance of for deserialization. + internal EnvironmentVariableSetup() + { + } + /// The name of the environment variable. public string VariableName { get; set; } /// The value of the environment variable. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.Serialization.cs index 1c976c2818f6..53e9cdcdf645 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExcelDataset : IUtf8JsonSerializable + public partial class ExcelDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,14 +82,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(SheetName)) { @@ -101,7 +128,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } if (Optional.IsDefined(NullValue)) { @@ -121,8 +155,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExcelDataset DeserializeExcelDataset(JsonElement element) + internal static ExcelDataset DeserializeExcelDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -303,5 +339,53 @@ internal static ExcelDataset DeserializeExcelDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ExcelDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, sheetName.Value, sheetIndex.Value, range.Value, firstRowAsHeader.Value, compression.Value, nullValue.Value); } + + ExcelDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExcelDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExcelDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExcelDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExcelDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExcelDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExcelDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.cs index 1c4cfc81e5c6..3311eeb44a03 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Excel dataset. public partial class ExcelDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ExcelDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ExcelDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ExcelDataset(DataFactoryLinkedServiceReference linkedServiceName) : base( DatasetType = "Excel"; } - /// Initializes a new instance of ExcelDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -58,6 +58,11 @@ internal ExcelDataset(string datasetType, string description, DataFactoryElement DatasetType = datasetType ?? "Excel"; } + /// Initializes a new instance of for deserialization. + internal ExcelDataset() + { + } + /// /// The location of the excel storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.Serialization.cs index a10b383b3c61..6154ac9b925d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExcelSource : IUtf8JsonSerializable + public partial class ExcelSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -66,8 +79,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExcelSource DeserializeExcelSource(JsonElement element) + internal static ExcelSource DeserializeExcelSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +162,53 @@ internal static ExcelSource DeserializeExcelSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ExcelSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, additionalColumns.Value); } + + ExcelSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExcelSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExcelSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExcelSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExcelSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExcelSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExcelSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.cs index 8be09a12b8e8..5896cd82a7ce 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExcelSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity excel source. public partial class ExcelSource : CopyActivitySource { - /// Initializes a new instance of ExcelSource. + /// Initializes a new instance of . public ExcelSource() { CopySourceType = "ExcelSource"; } - /// Initializes a new instance of ExcelSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.Serialization.cs index f5395a26ba3d..6250ef370a9f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecuteDataFlowActivity : IUtf8JsonSerializable + public partial class ExecuteDataFlowActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,28 +83,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("dataFlow"u8); - writer.WriteObjectValue(DataFlow); + if (DataFlow is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataFlow).Serialize(writer, options); + } if (Optional.IsDefined(Staging)) { writer.WritePropertyName("staging"u8); - writer.WriteObjectValue(Staging); + if (Staging is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Staging).Serialize(writer, options); + } } if (Optional.IsDefined(IntegrationRuntime)) { writer.WritePropertyName("integrationRuntime"u8); - writer.WriteObjectValue(IntegrationRuntime); + if (IntegrationRuntime is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IntegrationRuntime).Serialize(writer, options); + } } if (Optional.IsDefined(Compute)) { writer.WritePropertyName("compute"u8); - writer.WriteObjectValue(Compute); + if (Compute is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compute).Serialize(writer, options); + } } if (Optional.IsDefined(TraceLevel)) { @@ -119,8 +174,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExecuteDataFlowActivity DeserializeExecuteDataFlowActivity(JsonElement element) + internal static ExecuteDataFlowActivity DeserializeExecuteDataFlowActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -310,5 +367,53 @@ internal static ExecuteDataFlowActivity DeserializeExecuteDataFlowActivity(JsonE additionalProperties = additionalPropertiesDictionary; return new ExecuteDataFlowActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, dataFlow, staging.Value, integrationRuntime.Value, compute.Value, traceLevel.Value, continueOnError.Value, runConcurrently.Value, sourceStagingConcurrency.Value); } + + ExecuteDataFlowActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecuteDataFlowActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecuteDataFlowActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecuteDataFlowActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecuteDataFlowActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecuteDataFlowActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecuteDataFlowActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.cs index f899e226bd6c..adc999b50d0d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execute data flow activity. public partial class ExecuteDataFlowActivity : ExecutionActivity { - /// Initializes a new instance of ExecuteDataFlowActivity. + /// Initializes a new instance of . /// Activity name. /// Data flow reference. /// or is null. @@ -28,7 +28,7 @@ public ExecuteDataFlowActivity(string name, DataFlowReference dataFlow) : base(n ActivityType = "ExecuteDataFlow"; } - /// Initializes a new instance of ExecuteDataFlowActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -60,6 +60,11 @@ internal ExecuteDataFlowActivity(string name, string activityType, string descri ActivityType = activityType ?? "ExecuteDataFlow"; } + /// Initializes a new instance of for deserialization. + internal ExecuteDataFlowActivity() + { + } + /// Data flow reference. public DataFlowReference DataFlow { get; set; } /// Staging info for execute data flow activity. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.Serialization.cs index 9fd4974bef3c..73f7de2cb10c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecuteDataFlowActivityComputeType : IUtf8JsonSerializable + public partial class ExecuteDataFlowActivityComputeType : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ComputeType)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("coreCount"u8); JsonSerializer.Serialize(writer, CoreCount); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ExecuteDataFlowActivityComputeType DeserializeExecuteDataFlowActivityComputeType(JsonElement element) + internal static ExecuteDataFlowActivityComputeType DeserializeExecuteDataFlowActivityComputeType(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> computeType = default; Optional> coreCount = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("computeType"u8)) @@ -57,8 +80,61 @@ internal static ExecuteDataFlowActivityComputeType DeserializeExecuteDataFlowAct coreCount = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExecuteDataFlowActivityComputeType(computeType.Value, coreCount.Value, serializedAdditionalRawData); + } + + ExecuteDataFlowActivityComputeType IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecuteDataFlowActivityComputeType(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecuteDataFlowActivityComputeType IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecuteDataFlowActivityComputeType(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecuteDataFlowActivityComputeType model) + { + if (model is null) + { + return null; } - return new ExecuteDataFlowActivityComputeType(computeType.Value, coreCount.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecuteDataFlowActivityComputeType(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecuteDataFlowActivityComputeType(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.cs index 43f0d0835ad8..0c7a9b826068 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteDataFlowActivityComputeType.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Compute properties for data flow activity. public partial class ExecuteDataFlowActivityComputeType { - /// Initializes a new instance of ExecuteDataFlowActivityComputeType. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExecuteDataFlowActivityComputeType() { } - /// Initializes a new instance of ExecuteDataFlowActivityComputeType. + /// Initializes a new instance of . /// Compute type of the cluster which will execute data flow job. Possible values include: 'General', 'MemoryOptimized', 'ComputeOptimized'. Type: string (or Expression with resultType string). /// Core count of the cluster which will execute data flow job. Supported values are: 8, 16, 32, 48, 80, 144 and 272. Type: integer (or Expression with resultType integer). - internal ExecuteDataFlowActivityComputeType(DataFactoryElement computeType, DataFactoryElement coreCount) + /// Keeps track of any properties unknown to the library. + internal ExecuteDataFlowActivityComputeType(DataFactoryElement computeType, DataFactoryElement coreCount, Dictionary serializedAdditionalRawData) { ComputeType = computeType; CoreCount = coreCount; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Compute type of the cluster which will execute data flow job. Possible values include: 'General', 'MemoryOptimized', 'ComputeOptimized'. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.Serialization.cs index d86fca6570c5..ccef1fd220de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecutePipelineActivity : IUtf8JsonSerializable + public partial class ExecutePipelineActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -47,7 +60,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -57,14 +77,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("pipeline"u8); - writer.WriteObjectValue(Pipeline); + if (Pipeline is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Pipeline).Serialize(writer, options); + } if (Optional.IsCollectionDefined(Parameters)) { writer.WritePropertyName("parameters"u8); @@ -103,8 +137,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExecutePipelineActivity DeserializeExecutePipelineActivity(JsonElement element) + internal static ExecutePipelineActivity DeserializeExecutePipelineActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -246,5 +282,53 @@ internal static ExecutePipelineActivity DeserializeExecutePipelineActivity(JsonE additionalProperties = additionalPropertiesDictionary; return new ExecutePipelineActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, policy.Value, pipeline, Optional.ToDictionary(parameters), Optional.ToNullable(waitOnCompletion)); } + + ExecutePipelineActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecutePipelineActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecutePipelineActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecutePipelineActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecutePipelineActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecutePipelineActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecutePipelineActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.cs index 6f67c022069f..1b68f072a456 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivity.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execute pipeline activity. public partial class ExecutePipelineActivity : ControlActivity { - /// Initializes a new instance of ExecutePipelineActivity. + /// Initializes a new instance of . /// Activity name. /// Pipeline reference. /// or is null. @@ -28,7 +28,7 @@ public ExecutePipelineActivity(string name, DataFactoryPipelineReference pipelin ActivityType = "ExecutePipeline"; } - /// Initializes a new instance of ExecutePipelineActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -50,6 +50,11 @@ internal ExecutePipelineActivity(string name, string activityType, string descri ActivityType = activityType ?? "ExecutePipeline"; } + /// Initializes a new instance of for deserialization. + internal ExecutePipelineActivity() + { + } + /// Execute pipeline activity policy. public ExecutePipelineActivityPolicy Policy { get; set; } /// Pipeline reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.Serialization.cs index f79b2b5d7f62..070cfabce58f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecutePipelineActivityPolicy : IUtf8JsonSerializable + public partial class ExecutePipelineActivityPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSecureInputEnabled)) { @@ -34,8 +40,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExecutePipelineActivityPolicy DeserializeExecutePipelineActivityPolicy(JsonElement element) + internal static ExecutePipelineActivityPolicy DeserializeExecutePipelineActivityPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,5 +67,53 @@ internal static ExecutePipelineActivityPolicy DeserializeExecutePipelineActivity additionalProperties = additionalPropertiesDictionary; return new ExecutePipelineActivityPolicy(Optional.ToNullable(secureInput), additionalProperties); } + + ExecutePipelineActivityPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecutePipelineActivityPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecutePipelineActivityPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecutePipelineActivityPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecutePipelineActivityPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecutePipelineActivityPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecutePipelineActivityPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.cs index 4283b98b19ea..686db4365275 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutePipelineActivityPolicy.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execution policy for an execute pipeline activity. public partial class ExecutePipelineActivityPolicy { - /// Initializes a new instance of ExecutePipelineActivityPolicy. + /// Initializes a new instance of . public ExecutePipelineActivityPolicy() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ExecutePipelineActivityPolicy. + /// Initializes a new instance of . /// When set to true, Input from activity is considered as secure and will not be logged to monitoring. /// Additional Properties. internal ExecutePipelineActivityPolicy(bool? isSecureInputEnabled, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.Serialization.cs index 0c41f0fb32bf..b5b54c9e0975 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecuteSsisPackageActivity : IUtf8JsonSerializable + public partial class ExecuteSsisPackageActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,14 +83,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("packageLocation"u8); - writer.WriteObjectValue(PackageLocation); + if (PackageLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PackageLocation).Serialize(writer, options); + } if (Optional.IsDefined(Runtime)) { writer.WritePropertyName("runtime"u8); @@ -89,10 +123,24 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ExecutionCredential)) { writer.WritePropertyName("executionCredential"u8); - writer.WriteObjectValue(ExecutionCredential); + if (ExecutionCredential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ExecutionCredential).Serialize(writer, options); + } } writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } if (Optional.IsCollectionDefined(ProjectParameters)) { writer.WritePropertyName("projectParameters"u8); @@ -100,7 +148,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in ProjectParameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -111,7 +166,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in PackageParameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -131,7 +193,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item0 in item.Value) { writer.WritePropertyName(item0.Key); - writer.WriteObjectValue(item0.Value); + if (item0.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item0.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -153,7 +222,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item0 in item.Value) { writer.WritePropertyName(item0.Key); - writer.WriteObjectValue(item0.Value); + if (item0.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item0.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -166,14 +242,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in PropertyOverrides) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } if (Optional.IsDefined(LogLocation)) { writer.WritePropertyName("logLocation"u8); - writer.WriteObjectValue(LogLocation); + if (LogLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogLocation).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -188,8 +278,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExecuteSsisPackageActivity DeserializeExecuteSsisPackageActivity(JsonElement element) + internal static ExecuteSsisPackageActivity DeserializeExecuteSsisPackageActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -464,5 +556,53 @@ internal static ExecuteSsisPackageActivity DeserializeExecuteSsisPackageActivity additionalProperties = additionalPropertiesDictionary; return new ExecuteSsisPackageActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, packageLocation, runtime.Value, loggingLevel.Value, environmentPath.Value, executionCredential.Value, connectVia, Optional.ToDictionary(projectParameters), Optional.ToDictionary(packageParameters), Optional.ToDictionary(projectConnectionManagers), Optional.ToDictionary(packageConnectionManagers), Optional.ToDictionary(propertyOverrides), logLocation.Value); } + + ExecuteSsisPackageActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecuteSsisPackageActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecuteSsisPackageActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecuteSsisPackageActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecuteSsisPackageActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecuteSsisPackageActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecuteSsisPackageActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.cs index 6ae69cf4af49..6a329f2e29d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteSsisPackageActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execute SSIS package activity. public partial class ExecuteSsisPackageActivity : ExecutionActivity { - /// Initializes a new instance of ExecuteSsisPackageActivity. + /// Initializes a new instance of . /// Activity name. /// SSIS package location. /// The integration runtime reference. @@ -36,7 +36,7 @@ public ExecuteSsisPackageActivity(string name, SsisPackageLocation packageLocati ActivityType = "ExecuteSSISPackage"; } - /// Initializes a new instance of ExecuteSsisPackageActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -76,6 +76,11 @@ internal ExecuteSsisPackageActivity(string name, string activityType, string des ActivityType = activityType ?? "ExecuteSSISPackage"; } + /// Initializes a new instance of for deserialization. + internal ExecuteSsisPackageActivity() + { + } + /// SSIS package location. public SsisPackageLocation PackageLocation { get; set; } /// Specifies the runtime to execute SSIS package. The value should be "x86" or "x64". Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.Serialization.cs index 33556f125f94..9c387c736268 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecuteWranglingDataflowActivity : IUtf8JsonSerializable + public partial class ExecuteWranglingDataflowActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -48,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -58,28 +78,63 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("dataFlow"u8); - writer.WriteObjectValue(DataFlow); + if (DataFlow is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataFlow).Serialize(writer, options); + } if (Optional.IsDefined(Staging)) { writer.WritePropertyName("staging"u8); - writer.WriteObjectValue(Staging); + if (Staging is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Staging).Serialize(writer, options); + } } if (Optional.IsDefined(IntegrationRuntime)) { writer.WritePropertyName("integrationRuntime"u8); - writer.WriteObjectValue(IntegrationRuntime); + if (IntegrationRuntime is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)IntegrationRuntime).Serialize(writer, options); + } } if (Optional.IsDefined(Compute)) { writer.WritePropertyName("compute"u8); - writer.WriteObjectValue(Compute); + if (Compute is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compute).Serialize(writer, options); + } } if (Optional.IsDefined(TraceLevel)) { @@ -108,7 +163,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Sinks) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -118,7 +180,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Queries) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -135,8 +204,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExecuteWranglingDataflowActivity DeserializeExecuteWranglingDataflowActivity(JsonElement element) + internal static ExecuteWranglingDataflowActivity DeserializeExecuteWranglingDataflowActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -346,5 +417,53 @@ internal static ExecuteWranglingDataflowActivity DeserializeExecuteWranglingData additionalProperties = additionalPropertiesDictionary; return new ExecuteWranglingDataflowActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, policy.Value, dataFlow, staging.Value, integrationRuntime.Value, compute.Value, traceLevel.Value, continueOnError.Value, runConcurrently.Value, sourceStagingConcurrency.Value, Optional.ToDictionary(sinks), Optional.ToList(queries)); } + + ExecuteWranglingDataflowActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecuteWranglingDataflowActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecuteWranglingDataflowActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecuteWranglingDataflowActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecuteWranglingDataflowActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecuteWranglingDataflowActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecuteWranglingDataflowActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.cs index a880aac74f0e..ff6a8778bea0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecuteWranglingDataflowActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execute power query activity. public partial class ExecuteWranglingDataflowActivity : PipelineActivity { - /// Initializes a new instance of ExecuteWranglingDataflowActivity. + /// Initializes a new instance of . /// Activity name. /// Data flow reference. /// or is null. @@ -30,7 +30,7 @@ public ExecuteWranglingDataflowActivity(string name, DataFlowReference dataFlow) ActivityType = "ExecuteWranglingDataflow"; } - /// Initializes a new instance of ExecuteWranglingDataflowActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -66,6 +66,11 @@ internal ExecuteWranglingDataflowActivity(string name, string activityType, stri ActivityType = activityType ?? "ExecuteWranglingDataflow"; } + /// Initializes a new instance of for deserialization. + internal ExecuteWranglingDataflowActivity() + { + } + /// Activity policy. public PipelineActivityPolicy Policy { get; set; } /// Data flow reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.Serialization.cs index 990ef7fccb0c..9bc5ce6ef699 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExecutionActivity : IUtf8JsonSerializable + public partial class ExecutionActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -79,8 +106,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExecutionActivity DeserializeExecutionActivity(JsonElement element) + internal static ExecutionActivity DeserializeExecutionActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,6 +146,8 @@ internal static ExecutionActivity DeserializeExecutionActivity(JsonElement eleme case "WebActivity": return WebActivity.DeserializeWebActivity(element); } } + + // Unknown type found so we will deserialize the base properties only Optional linkedServiceName = default; Optional policy = default; string name = default; @@ -214,5 +245,53 @@ internal static ExecutionActivity DeserializeExecutionActivity(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new ExecutionActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value); } + + ExecutionActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExecutionActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExecutionActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExecutionActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExecutionActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExecutionActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExecutionActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.cs index a62125e33b1a..f508cec6f025 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExecutionActivity.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class ExecutionActivity : PipelineActivity { - /// Initializes a new instance of ExecutionActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public ExecutionActivity(string name) : base(name) @@ -29,7 +29,7 @@ public ExecutionActivity(string name) : base(name) ActivityType = "Execution"; } - /// Initializes a new instance of ExecutionActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -47,6 +47,11 @@ internal ExecutionActivity(string name, string activityType, string description, ActivityType = activityType ?? "Execution"; } + /// Initializes a new instance of for deserialization. + internal ExecutionActivity() + { + } + /// Linked service reference. public DataFactoryLinkedServiceReference LinkedServiceName { get; set; } /// Activity policy. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.Serialization.cs index 4c1d6e34351c..06d761aac2eb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExportSettings : IUtf8JsonSerializable + public partial class ExportSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ExportSettingsType); @@ -29,8 +37,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ExportSettings DeserializeExportSettings(JsonElement element) + internal static ExportSettings DeserializeExportSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,7 +53,70 @@ internal static ExportSettings DeserializeExportSettings(JsonElement element) case "SnowflakeExportCopyCommand": return SnowflakeExportCopyCommand.DeserializeSnowflakeExportCopyCommand(element); } } - return UnknownExportSettings.DeserializeUnknownExportSettings(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownExportSettings(type, additionalProperties); + } + + ExportSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExportSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExportSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExportSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExportSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExportSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExportSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.cs index 5b7a4a73afd7..b407d59aeb59 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExportSettings.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class ExportSettings { - /// Initializes a new instance of ExportSettings. + /// Initializes a new instance of . public ExportSettings() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ExportSettings. + /// Initializes a new instance of . /// The export setting type. /// Additional Properties. internal ExportSettings(string exportSettingsType, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.Serialization.cs index eddb31fe45a0..14c77b3eba6c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.Serialization.cs @@ -5,24 +5,130 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExposureControlBatchContent : IUtf8JsonSerializable + public partial class ExposureControlBatchContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("exposureControlRequests"u8); writer.WriteStartArray(); foreach (var item in ExposureControlRequests) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ExposureControlBatchContent DeserializeExposureControlBatchContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList exposureControlRequests = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("exposureControlRequests"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExposureControlContent.DeserializeExposureControlContent(item)); + } + exposureControlRequests = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExposureControlBatchContent(exposureControlRequests, serializedAdditionalRawData); + } + + ExposureControlBatchContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExposureControlBatchContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExposureControlBatchContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExposureControlBatchContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExposureControlBatchContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExposureControlBatchContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExposureControlBatchContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.cs index e65f20868f97..c14456c0891e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchContent.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of exposure control features. public partial class ExposureControlBatchContent { - /// Initializes a new instance of ExposureControlBatchContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of exposure control features. /// is null. public ExposureControlBatchContent(IEnumerable exposureControlRequests) @@ -25,6 +28,20 @@ public ExposureControlBatchContent(IEnumerable exposureC ExposureControlRequests = exposureControlRequests.ToList(); } + /// Initializes a new instance of . + /// List of exposure control features. + /// Keeps track of any properties unknown to the library. + internal ExposureControlBatchContent(IList exposureControlRequests, Dictionary serializedAdditionalRawData) + { + ExposureControlRequests = exposureControlRequests; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExposureControlBatchContent() + { + } + /// List of exposure control features. public IList ExposureControlRequests { get; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.Serialization.cs index 2373f8beb72d..cef1eda6e1d6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExposureControlBatchResult + public partial class ExposureControlBatchResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExposureControlBatchResult DeserializeExposureControlBatchResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("exposureControlResponses"u8); + writer.WriteStartArray(); + foreach (var item in ExposureControlResults) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExposureControlBatchResult DeserializeExposureControlBatchResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList exposureControlResponses = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("exposureControlResponses"u8)) @@ -32,8 +74,61 @@ internal static ExposureControlBatchResult DeserializeExposureControlBatchResult exposureControlResponses = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExposureControlBatchResult(exposureControlResponses); + return new ExposureControlBatchResult(exposureControlResponses, serializedAdditionalRawData); + } + + ExposureControlBatchResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExposureControlBatchResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExposureControlBatchResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExposureControlBatchResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExposureControlBatchResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExposureControlBatchResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExposureControlBatchResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.cs index b73b558db80f..5bda39f30df1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlBatchResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list of exposure control feature values. public partial class ExposureControlBatchResult { - /// Initializes a new instance of ExposureControlBatchResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of exposure control feature values. /// is null. internal ExposureControlBatchResult(IEnumerable exposureControlResults) @@ -25,11 +28,18 @@ internal ExposureControlBatchResult(IEnumerable exposureC ExposureControlResults = exposureControlResults.ToList(); } - /// Initializes a new instance of ExposureControlBatchResult. + /// Initializes a new instance of . /// List of exposure control feature values. - internal ExposureControlBatchResult(IReadOnlyList exposureControlResults) + /// Keeps track of any properties unknown to the library. + internal ExposureControlBatchResult(IReadOnlyList exposureControlResults, Dictionary serializedAdditionalRawData) { ExposureControlResults = exposureControlResults; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExposureControlBatchResult() + { } /// List of exposure control feature values. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.Serialization.cs index fb5861ff5e41..8e288fbbe02d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExposureControlContent : IUtf8JsonSerializable + public partial class ExposureControlContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FeatureName)) { @@ -25,7 +33,99 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("featureType"u8); writer.WriteStringValue(FeatureType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static ExposureControlContent DeserializeExposureControlContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional featureName = default; + Optional featureType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("featureName"u8)) + { + featureName = property.Value.GetString(); + continue; + } + if (property.NameEquals("featureType"u8)) + { + featureType = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ExposureControlContent(featureName.Value, featureType.Value, serializedAdditionalRawData); + } + + ExposureControlContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExposureControlContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExposureControlContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExposureControlContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExposureControlContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExposureControlContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExposureControlContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.cs index 11a82d7dcc84..959a219fe5b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlContent.cs @@ -5,16 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The exposure control request. public partial class ExposureControlContent { - /// Initializes a new instance of ExposureControlContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ExposureControlContent() { } + /// Initializes a new instance of . + /// The feature name. + /// The feature type. + /// Keeps track of any properties unknown to the library. + internal ExposureControlContent(string featureName, string featureType, Dictionary serializedAdditionalRawData) + { + FeatureName = featureName; + FeatureType = featureType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The feature name. public string FeatureName { get; set; } /// The feature type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.Serialization.cs index 012f9bcbbd2e..6d6a13e74e5c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ExposureControlResult + public partial class ExposureControlResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ExposureControlResult DeserializeExposureControlResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static ExposureControlResult DeserializeExposureControlResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional featureName = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("featureName"u8)) @@ -32,8 +61,61 @@ internal static ExposureControlResult DeserializeExposureControlResult(JsonEleme value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new ExposureControlResult(featureName.Value, value.Value); + return new ExposureControlResult(featureName.Value, value.Value, serializedAdditionalRawData); + } + + ExposureControlResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeExposureControlResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ExposureControlResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeExposureControlResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ExposureControlResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ExposureControlResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeExposureControlResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.cs index d38db925df10..b3f076c34a2e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ExposureControlResult.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The exposure control response. public partial class ExposureControlResult { - /// Initializes a new instance of ExposureControlResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal ExposureControlResult() { } - /// Initializes a new instance of ExposureControlResult. + /// Initializes a new instance of . /// The feature name. /// The feature value. - internal ExposureControlResult(string featureName, string value) + /// Keeps track of any properties unknown to the library. + internal ExposureControlResult(string featureName, string value, Dictionary serializedAdditionalRawData) { FeatureName = featureName; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The feature name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.Serialization.cs index 57b8b3826b68..9218aee6f460 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FactoryGitHubClientSecret : IUtf8JsonSerializable + public partial class FactoryGitHubClientSecret : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ByoaSecretAkvUri)) { @@ -26,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("byoaSecretName"u8); writer.WriteStringValue(ByoaSecretName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FactoryGitHubClientSecret DeserializeFactoryGitHubClientSecret(JsonElement element) + internal static FactoryGitHubClientSecret DeserializeFactoryGitHubClientSecret(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional byoaSecretAkvUrl = default; Optional byoaSecretName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("byoaSecretAkvUrl"u8)) @@ -53,8 +75,61 @@ internal static FactoryGitHubClientSecret DeserializeFactoryGitHubClientSecret(J byoaSecretName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FactoryGitHubClientSecret(byoaSecretAkvUrl.Value, byoaSecretName.Value, serializedAdditionalRawData); + } + + FactoryGitHubClientSecret IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFactoryGitHubClientSecret(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FactoryGitHubClientSecret IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFactoryGitHubClientSecret(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FactoryGitHubClientSecret model) + { + if (model is null) + { + return null; } - return new FactoryGitHubClientSecret(byoaSecretAkvUrl.Value, byoaSecretName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FactoryGitHubClientSecret(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFactoryGitHubClientSecret(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.cs index f381063e65b3..944e761ad6f8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubClientSecret.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Client secret information for factory's bring your own app repository configuration. public partial class FactoryGitHubClientSecret { - /// Initializes a new instance of FactoryGitHubClientSecret. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FactoryGitHubClientSecret() { } - /// Initializes a new instance of FactoryGitHubClientSecret. + /// Initializes a new instance of . /// Bring your own app client secret AKV URL. /// Bring your own app client secret name in AKV. - internal FactoryGitHubClientSecret(Uri byoaSecretAkvUri, string byoaSecretName) + /// Keeps track of any properties unknown to the library. + internal FactoryGitHubClientSecret(Uri byoaSecretAkvUri, string byoaSecretName, Dictionary serializedAdditionalRawData) { ByoaSecretAkvUri = byoaSecretAkvUri; ByoaSecretName = byoaSecretName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Bring your own app client secret AKV URL. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.Serialization.cs index a1760ce5a1a1..c065a113d488 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FactoryGitHubConfiguration : IUtf8JsonSerializable + public partial class FactoryGitHubConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(HostName)) { @@ -28,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ClientSecret)) { writer.WritePropertyName("clientSecret"u8); - writer.WriteObjectValue(ClientSecret); + if (ClientSecret is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ClientSecret).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(FactoryRepoConfigurationType); @@ -50,11 +65,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("disablePublish"u8); writer.WriteBooleanValue(DisablePublish.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FactoryGitHubConfiguration DeserializeFactoryGitHubConfiguration(JsonElement element) + internal static FactoryGitHubConfiguration DeserializeFactoryGitHubConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -69,6 +98,7 @@ internal static FactoryGitHubConfiguration DeserializeFactoryGitHubConfiguration string rootFolder = default; Optional lastCommitId = default; Optional disablePublish = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hostName"u8)) @@ -129,8 +159,61 @@ internal static FactoryGitHubConfiguration DeserializeFactoryGitHubConfiguration disablePublish = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FactoryGitHubConfiguration(type, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId.Value, Optional.ToNullable(disablePublish), hostName.Value, clientId.Value, clientSecret.Value, serializedAdditionalRawData); + } + + FactoryGitHubConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFactoryGitHubConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FactoryGitHubConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFactoryGitHubConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FactoryGitHubConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FactoryGitHubConfiguration(Response response) + { + if (response is null) + { + return null; } - return new FactoryGitHubConfiguration(type, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId.Value, Optional.ToNullable(disablePublish), hostName.Value, clientId.Value, clientSecret.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFactoryGitHubConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.cs index d96ee839385c..9742810b0520 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryGitHubConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Factory's GitHub repo information. public partial class FactoryGitHubConfiguration : FactoryRepoConfiguration { - /// Initializes a new instance of FactoryGitHubConfiguration. + /// Initializes a new instance of . /// Account name. /// Repository name. /// Collaboration branch. @@ -29,7 +30,7 @@ public FactoryGitHubConfiguration(string accountName, string repositoryName, str FactoryRepoConfigurationType = "FactoryGitHubConfiguration"; } - /// Initializes a new instance of FactoryGitHubConfiguration. + /// Initializes a new instance of . /// Type of repo configuration. /// Account name. /// Repository name. @@ -40,7 +41,8 @@ public FactoryGitHubConfiguration(string accountName, string repositoryName, str /// GitHub Enterprise host name. For example: `https://github.mydomain.com`. /// GitHub bring your own app client id. /// GitHub bring your own app client secret information. - internal FactoryGitHubConfiguration(string factoryRepoConfigurationType, string accountName, string repositoryName, string collaborationBranch, string rootFolder, string lastCommitId, bool? disablePublish, string hostName, string clientId, FactoryGitHubClientSecret clientSecret) : base(factoryRepoConfigurationType, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId, disablePublish) + /// Keeps track of any properties unknown to the library. + internal FactoryGitHubConfiguration(string factoryRepoConfigurationType, string accountName, string repositoryName, string collaborationBranch, string rootFolder, string lastCommitId, bool? disablePublish, string hostName, string clientId, FactoryGitHubClientSecret clientSecret, Dictionary serializedAdditionalRawData) : base(factoryRepoConfigurationType, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId, disablePublish, serializedAdditionalRawData) { HostName = hostName; ClientId = clientId; @@ -48,6 +50,11 @@ internal FactoryGitHubConfiguration(string factoryRepoConfigurationType, string FactoryRepoConfigurationType = factoryRepoConfigurationType ?? "FactoryGitHubConfiguration"; } + /// Initializes a new instance of for deserialization. + internal FactoryGitHubConfiguration() + { + } + /// GitHub Enterprise host name. For example: `https://github.mydomain.com`. public string HostName { get; set; } /// GitHub bring your own app client id. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.Serialization.cs index 5ecde357b4c7..41e46f312be7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FactoryRepoConfiguration : IUtf8JsonSerializable + public partial class FactoryRepoConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(FactoryRepoConfigurationType); @@ -35,11 +43,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("disablePublish"u8); writer.WriteBooleanValue(DisablePublish.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FactoryRepoConfiguration DeserializeFactoryRepoConfiguration(JsonElement element) + internal static FactoryRepoConfiguration DeserializeFactoryRepoConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -52,7 +74,112 @@ internal static FactoryRepoConfiguration DeserializeFactoryRepoConfiguration(Jso case "FactoryVSTSConfiguration": return FactoryVstsConfiguration.DeserializeFactoryVstsConfiguration(element); } } - return UnknownFactoryRepoConfiguration.DeserializeUnknownFactoryRepoConfiguration(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + string accountName = default; + string repositoryName = default; + string collaborationBranch = default; + string rootFolder = default; + Optional lastCommitId = default; + Optional disablePublish = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("accountName"u8)) + { + accountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("repositoryName"u8)) + { + repositoryName = property.Value.GetString(); + continue; + } + if (property.NameEquals("collaborationBranch"u8)) + { + collaborationBranch = property.Value.GetString(); + continue; + } + if (property.NameEquals("rootFolder"u8)) + { + rootFolder = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastCommitId"u8)) + { + lastCommitId = property.Value.GetString(); + continue; + } + if (property.NameEquals("disablePublish"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disablePublish = property.Value.GetBoolean(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownFactoryRepoConfiguration(type, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId.Value, Optional.ToNullable(disablePublish), serializedAdditionalRawData); + } + + FactoryRepoConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFactoryRepoConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FactoryRepoConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFactoryRepoConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FactoryRepoConfiguration model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FactoryRepoConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFactoryRepoConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.cs index 4fecc8062153..a3c39809aa7d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoConfiguration.cs @@ -6,7 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { @@ -15,9 +17,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownFactoryRepoConfiguration))] public abstract partial class FactoryRepoConfiguration { - /// Initializes a new instance of FactoryRepoConfiguration. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Account name. /// Repository name. /// Collaboration branch. @@ -36,7 +42,7 @@ protected FactoryRepoConfiguration(string accountName, string repositoryName, st RootFolder = rootFolder; } - /// Initializes a new instance of FactoryRepoConfiguration. + /// Initializes a new instance of . /// Type of repo configuration. /// Account name. /// Repository name. @@ -44,7 +50,8 @@ protected FactoryRepoConfiguration(string accountName, string repositoryName, st /// Root folder. /// Last commit id. /// Disable manual publish operation in ADF studio to favor automated publish. - internal FactoryRepoConfiguration(string factoryRepoConfigurationType, string accountName, string repositoryName, string collaborationBranch, string rootFolder, string lastCommitId, bool? disablePublish) + /// Keeps track of any properties unknown to the library. + internal FactoryRepoConfiguration(string factoryRepoConfigurationType, string accountName, string repositoryName, string collaborationBranch, string rootFolder, string lastCommitId, bool? disablePublish, Dictionary serializedAdditionalRawData) { FactoryRepoConfigurationType = factoryRepoConfigurationType; AccountName = accountName; @@ -53,6 +60,12 @@ internal FactoryRepoConfiguration(string factoryRepoConfigurationType, string ac RootFolder = rootFolder; LastCommitId = lastCommitId; DisablePublish = disablePublish; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FactoryRepoConfiguration() + { } /// Type of repo configuration. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.Serialization.cs index f125f625fff0..ba13bee42f53 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FactoryRepoContent : IUtf8JsonSerializable + public partial class FactoryRepoContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FactoryResourceId)) { @@ -23,9 +31,116 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RepoConfiguration)) { writer.WritePropertyName("repoConfiguration"u8); - writer.WriteObjectValue(RepoConfiguration); + if (RepoConfiguration is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)RepoConfiguration).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } + + internal static FactoryRepoContent DeserializeFactoryRepoContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional factoryResourceId = default; + Optional repoConfiguration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("factoryResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + factoryResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("repoConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + repoConfiguration = FactoryRepoConfiguration.DeserializeFactoryRepoConfiguration(property.Value); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FactoryRepoContent(factoryResourceId.Value, repoConfiguration.Value, serializedAdditionalRawData); + } + + FactoryRepoContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFactoryRepoContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FactoryRepoContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFactoryRepoContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FactoryRepoContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FactoryRepoContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFactoryRepoContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.cs index 004d21befbdc..38023abe32f8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryRepoContent.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -12,11 +14,29 @@ namespace Azure.ResourceManager.DataFactory.Models /// Factory's git repo information. public partial class FactoryRepoContent { - /// Initializes a new instance of FactoryRepoContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public FactoryRepoContent() { } + /// Initializes a new instance of . + /// The factory resource id. + /// + /// Git repo information of the factory. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal FactoryRepoContent(ResourceIdentifier factoryResourceId, FactoryRepoConfiguration repoConfiguration, Dictionary serializedAdditionalRawData) + { + FactoryResourceId = factoryResourceId; + RepoConfiguration = repoConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The factory resource id. public ResourceIdentifier FactoryResourceId { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.Serialization.cs index 9d5c87040b4c..a7446e551d24 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FactoryVstsConfiguration : IUtf8JsonSerializable + public partial class FactoryVstsConfiguration : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("projectName"u8); writer.WriteStringValue(ProjectName); @@ -43,11 +50,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("disablePublish"u8); writer.WriteBooleanValue(DisablePublish.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static FactoryVstsConfiguration DeserializeFactoryVstsConfiguration(JsonElement element) + internal static FactoryVstsConfiguration DeserializeFactoryVstsConfiguration(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -61,6 +82,7 @@ internal static FactoryVstsConfiguration DeserializeFactoryVstsConfiguration(Jso string rootFolder = default; Optional lastCommitId = default; Optional disablePublish = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("projectName"u8)) @@ -116,8 +138,61 @@ internal static FactoryVstsConfiguration DeserializeFactoryVstsConfiguration(Jso disablePublish = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new FactoryVstsConfiguration(type, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId.Value, Optional.ToNullable(disablePublish), projectName, Optional.ToNullable(tenantId), serializedAdditionalRawData); + } + + FactoryVstsConfiguration IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFactoryVstsConfiguration(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FactoryVstsConfiguration IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFactoryVstsConfiguration(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FactoryVstsConfiguration model) + { + if (model is null) + { + return null; } - return new FactoryVstsConfiguration(type, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId.Value, Optional.ToNullable(disablePublish), projectName, Optional.ToNullable(tenantId)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FactoryVstsConfiguration(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFactoryVstsConfiguration(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.cs index aac4d98838d6..4cb7225172de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FactoryVstsConfiguration.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Factory's VSTS repo information. public partial class FactoryVstsConfiguration : FactoryRepoConfiguration { - /// Initializes a new instance of FactoryVstsConfiguration. + /// Initializes a new instance of . /// Account name. /// Repository name. /// Collaboration branch. @@ -32,7 +33,7 @@ public FactoryVstsConfiguration(string accountName, string repositoryName, strin FactoryRepoConfigurationType = "FactoryVSTSConfiguration"; } - /// Initializes a new instance of FactoryVstsConfiguration. + /// Initializes a new instance of . /// Type of repo configuration. /// Account name. /// Repository name. @@ -42,13 +43,19 @@ public FactoryVstsConfiguration(string accountName, string repositoryName, strin /// Disable manual publish operation in ADF studio to favor automated publish. /// VSTS project name. /// VSTS tenant id. - internal FactoryVstsConfiguration(string factoryRepoConfigurationType, string accountName, string repositoryName, string collaborationBranch, string rootFolder, string lastCommitId, bool? disablePublish, string projectName, Guid? tenantId) : base(factoryRepoConfigurationType, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId, disablePublish) + /// Keeps track of any properties unknown to the library. + internal FactoryVstsConfiguration(string factoryRepoConfigurationType, string accountName, string repositoryName, string collaborationBranch, string rootFolder, string lastCommitId, bool? disablePublish, string projectName, Guid? tenantId, Dictionary serializedAdditionalRawData) : base(factoryRepoConfigurationType, accountName, repositoryName, collaborationBranch, rootFolder, lastCommitId, disablePublish, serializedAdditionalRawData) { ProjectName = projectName; TenantId = tenantId; FactoryRepoConfigurationType = factoryRepoConfigurationType ?? "FactoryVSTSConfiguration"; } + /// Initializes a new instance of for deserialization. + internal FactoryVstsConfiguration() + { + } + /// VSTS project name. public string ProjectName { get; set; } /// VSTS tenant id. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.Serialization.cs index 2066c32b82f9..0fdaef3f0102 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FailActivity : IUtf8JsonSerializable + public partial class FailActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,8 +96,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FailActivity DeserializeFailActivity(JsonElement element) + internal static FailActivity DeserializeFailActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -183,5 +205,53 @@ internal static FailActivity DeserializeFailActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new FailActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, message, errorCode); } + + FailActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFailActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FailActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFailActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FailActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FailActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFailActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.cs index fa2ec356ba24..078c9bd67c0c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FailActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// This activity will fail within its own scope and output a custom error message and error code. The error message and code can provided either as a string literal or as an expression that can be evaluated to a string at runtime. The activity scope can be the whole pipeline or a control activity (e.g. foreach, switch, until), if the fail activity is contained in it. public partial class FailActivity : ControlActivity { - /// Initializes a new instance of FailActivity. + /// Initializes a new instance of . /// Activity name. /// The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string). /// The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string). @@ -31,7 +31,7 @@ public FailActivity(string name, DataFactoryElement message, DataFactory ActivityType = "Fail"; } - /// Initializes a new instance of FailActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -49,6 +49,11 @@ internal FailActivity(string name, string activityType, string description, Pipe ActivityType = activityType ?? "Fail"; } + /// Initializes a new instance of for deserialization. + internal FailActivity() + { + } + /// The error message that surfaced in the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string). public DataFactoryElement Message { get; set; } /// The error code that categorizes the error type of the Fail activity. It can be dynamic content that's evaluated to a non empty/blank string at runtime. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.Serialization.cs index 58eb9118ee71..243a97cb26b5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileServerLinkedService : IUtf8JsonSerializable + public partial class FileServerLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -92,8 +112,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileServerLinkedService DeserializeFileServerLinkedService(JsonElement element) + internal static FileServerLinkedService DeserializeFileServerLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -210,5 +232,53 @@ internal static FileServerLinkedService DeserializeFileServerLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new FileServerLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, userId.Value, password, encryptedCredential.Value); } + + FileServerLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileServerLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileServerLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileServerLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileServerLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileServerLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileServerLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.cs index 6b564c8a0a5b..0edfa34dc55c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// File system linked service. public partial class FileServerLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of FileServerLinkedService. + /// Initializes a new instance of . /// Host name of the server. Type: string (or Expression with resultType string). /// is null. public FileServerLinkedService(DataFactoryElement host) @@ -26,7 +26,7 @@ public FileServerLinkedService(DataFactoryElement host) LinkedServiceType = "FileServer"; } - /// Initializes a new instance of FileServerLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -46,6 +46,11 @@ internal FileServerLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "FileServer"; } + /// Initializes a new instance of for deserialization. + internal FileServerLinkedService() + { + } + /// Host name of the server. Type: string (or Expression with resultType string). public DataFactoryElement Host { get; set; } /// User ID to logon the server. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.Serialization.cs index 2b7fef2206f9..f1f13bb4cc90 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileServerLocation : IUtf8JsonSerializable + public partial class FileServerLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetLocationType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileServerLocation DeserializeFileServerLocation(JsonElement element) + internal static FileServerLocation DeserializeFileServerLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static FileServerLocation DeserializeFileServerLocation(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new FileServerLocation(type, folderPath.Value, fileName.Value, additionalProperties); } + + FileServerLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileServerLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileServerLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileServerLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileServerLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileServerLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileServerLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.cs index 6b99c3832588..db88b2082fd1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of file server dataset. public partial class FileServerLocation : DatasetLocation { - /// Initializes a new instance of FileServerLocation. + /// Initializes a new instance of . public FileServerLocation() { DatasetLocationType = "FileServerLocation"; } - /// Initializes a new instance of FileServerLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.Serialization.cs index ae3d81d80ab2..3c715ae3852d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileServerReadSettings : IUtf8JsonSerializable + public partial class FileServerReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileServerReadSettings DeserializeFileServerReadSettings(JsonElement element) + internal static FileServerReadSettings DeserializeFileServerReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static FileServerReadSettings DeserializeFileServerReadSettings(JsonEle additionalProperties = additionalPropertiesDictionary; return new FileServerReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, fileFilter.Value); } + + FileServerReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileServerReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileServerReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileServerReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileServerReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileServerReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileServerReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.cs index 04fa524298c0..d72cf4b65ab4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// File server read settings. public partial class FileServerReadSettings : StoreReadSettings { - /// Initializes a new instance of FileServerReadSettings. + /// Initializes a new instance of . public FileServerReadSettings() { StoreReadSettingsType = "FileServerReadSettings"; } - /// Initializes a new instance of FileServerReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.Serialization.cs index bf2583f0aa5d..6cf7dd81e6b1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileServerWriteSettings : IUtf8JsonSerializable + public partial class FileServerWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(StoreWriteSettingsType); @@ -51,8 +57,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileServerWriteSettings DeserializeFileServerWriteSettings(JsonElement element) + internal static FileServerWriteSettings DeserializeFileServerWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -102,5 +110,53 @@ internal static FileServerWriteSettings DeserializeFileServerWriteSettings(JsonE additionalProperties = additionalPropertiesDictionary; return new FileServerWriteSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, copyBehavior.Value, additionalProperties); } + + FileServerWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileServerWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileServerWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileServerWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileServerWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileServerWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileServerWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.cs index ceb543bed2cf..bd9dc44663aa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileServerWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// File server write settings. public partial class FileServerWriteSettings : StoreWriteSettings { - /// Initializes a new instance of FileServerWriteSettings. + /// Initializes a new instance of . public FileServerWriteSettings() { StoreWriteSettingsType = "FileServerWriteSettings"; } - /// Initializes a new instance of FileServerWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.Serialization.cs index c8fb86df45f1..26ee1ce0c486 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileShareDataset : IUtf8JsonSerializable + public partial class FileShareDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,7 +116,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); - writer.WriteObjectValue(Format); + if (Format is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Format).Serialize(writer, options); + } } if (Optional.IsDefined(FileFilter)) { @@ -106,7 +133,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -121,8 +155,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileShareDataset DeserializeFileShareDataset(JsonElement element) + internal static FileShareDataset DeserializeFileShareDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -303,5 +339,53 @@ internal static FileShareDataset DeserializeFileShareDataset(JsonElement element additionalProperties = additionalPropertiesDictionary; return new FileShareDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, folderPath.Value, fileName.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, format.Value, fileFilter.Value, compression.Value); } + + FileShareDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileShareDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileShareDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileShareDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileShareDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileShareDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileShareDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.cs index d38e23bc6ea8..0ceb09d7c997 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileShareDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// An on-premises file system dataset. public partial class FileShareDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of FileShareDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public FileShareDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public FileShareDataset(DataFactoryLinkedServiceReference linkedServiceName) : b DatasetType = "FileShare"; } - /// Initializes a new instance of FileShareDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -58,6 +58,11 @@ internal FileShareDataset(string datasetType, string description, DataFactoryEle DatasetType = datasetType ?? "FileShare"; } + /// Initializes a new instance of for deserialization. + internal FileShareDataset() + { + } + /// The path of the on-premises file system. Type: string (or Expression with resultType string). public DataFactoryElement FolderPath { get; set; } /// The name of the on-premises file system. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.Serialization.cs index b486f7f02206..64919c0230d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileSystemSink : IUtf8JsonSerializable + public partial class FileSystemSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CopyBehavior)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileSystemSink DeserializeFileSystemSink(JsonElement element) + internal static FileSystemSink DeserializeFileSystemSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static FileSystemSink DeserializeFileSystemSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new FileSystemSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, copyBehavior.Value); } + + FileSystemSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileSystemSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileSystemSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileSystemSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileSystemSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileSystemSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileSystemSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.cs index 060cf57fe2f1..72b94933db1b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity file system sink. public partial class FileSystemSink : CopySink { - /// Initializes a new instance of FileSystemSink. + /// Initializes a new instance of . public FileSystemSink() { CopySinkType = "FileSystemSink"; } - /// Initializes a new instance of FileSystemSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.Serialization.cs index 97c8c990b0a8..5852442a124e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FileSystemSource : IUtf8JsonSerializable + public partial class FileSystemSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FileSystemSource DeserializeFileSystemSource(JsonElement element) + internal static FileSystemSource DeserializeFileSystemSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static FileSystemSource DeserializeFileSystemSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new FileSystemSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, additionalColumns.Value); } + + FileSystemSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFileSystemSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FileSystemSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFileSystemSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FileSystemSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FileSystemSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFileSystemSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.cs index d9954bd797b2..a99f90e42f7a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FileSystemSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity file system source. public partial class FileSystemSource : CopyActivitySource { - /// Initializes a new instance of FileSystemSource. + /// Initializes a new instance of . public FileSystemSource() { CopySourceType = "FileSystemSource"; } - /// Initializes a new instance of FileSystemSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.Serialization.cs index f32457d770c0..5e5bf1faf175 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FilterActivity : IUtf8JsonSerializable + public partial class FilterActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -42,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,16 +65,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("items"u8); - writer.WriteObjectValue(Items); + if (Items is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Items).Serialize(writer, options); + } writer.WritePropertyName("condition"u8); - writer.WriteObjectValue(Condition); + if (Condition is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Condition).Serialize(writer, options); + } writer.WriteEndObject(); foreach (var item in AdditionalProperties) { @@ -75,8 +109,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FilterActivity DeserializeFilterActivity(JsonElement element) + internal static FilterActivity DeserializeFilterActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -182,5 +218,53 @@ internal static FilterActivity DeserializeFilterActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new FilterActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, items, condition); } + + FilterActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFilterActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FilterActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFilterActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FilterActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FilterActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFilterActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.cs index 72d4665a1134..9c75b2f64dfe 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FilterActivity.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Filter and return results from input array based on the conditions. public partial class FilterActivity : ControlActivity { - /// Initializes a new instance of FilterActivity. + /// Initializes a new instance of . /// Activity name. /// Input array on which filter should be applied. /// Condition to be used for filtering the input. @@ -30,7 +30,7 @@ public FilterActivity(string name, DataFactoryExpression items, DataFactoryExpre ActivityType = "Filter"; } - /// Initializes a new instance of FilterActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -48,6 +48,11 @@ internal FilterActivity(string name, string activityType, string description, Pi ActivityType = activityType ?? "Filter"; } + /// Initializes a new instance of for deserialization. + internal FilterActivity() + { + } + /// Input array on which filter should be applied. public DataFactoryExpression Items { get; set; } /// Condition to be used for filtering the input. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.Serialization.cs index dd213da1723c..070bb8f39b94 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ForEachActivity : IUtf8JsonSerializable + public partial class ForEachActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -42,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -69,12 +89,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(BatchCount.Value); } writer.WritePropertyName("items"u8); - writer.WriteObjectValue(Items); + if (Items is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Items).Serialize(writer, options); + } writer.WritePropertyName("activities"u8); writer.WriteStartArray(); foreach (var item in Activities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); writer.WriteEndObject(); @@ -90,8 +124,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ForEachActivity DeserializeForEachActivity(JsonElement element) + internal static ForEachActivity DeserializeForEachActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -222,5 +258,53 @@ internal static ForEachActivity DeserializeForEachActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ForEachActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, Optional.ToNullable(isSequential), Optional.ToNullable(batchCount), items, activities); } + + ForEachActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeForEachActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ForEachActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeForEachActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ForEachActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ForEachActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeForEachActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.cs index 422473024bbd..dff927c10ac4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ForEachActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// This activity is used for iterating over a collection and execute given activities. public partial class ForEachActivity : ControlActivity { - /// Initializes a new instance of ForEachActivity. + /// Initializes a new instance of . /// Activity name. /// Collection to iterate. /// @@ -35,7 +35,7 @@ public ForEachActivity(string name, DataFactoryExpression items, IEnumerable Initializes a new instance of ForEachActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -61,6 +61,11 @@ internal ForEachActivity(string name, string activityType, string description, P ActivityType = activityType ?? "ForEach"; } + /// Initializes a new instance of for deserialization. + internal ForEachActivity() + { + } + /// Should the loop be executed in sequence or in parallel (max 50). public bool? IsSequential { get; set; } /// Batch count to be used for controlling the number of parallel execution (when isSequential is set to false). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.Serialization.cs index c5d9a66c2ae6..59d7644d05c5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FormatReadSettings : IUtf8JsonSerializable + public partial class FormatReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(FormatReadSettingsType); @@ -29,8 +37,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FormatReadSettings DeserializeFormatReadSettings(JsonElement element) + internal static FormatReadSettings DeserializeFormatReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -45,7 +55,70 @@ internal static FormatReadSettings DeserializeFormatReadSettings(JsonElement ele case "DelimitedTextReadSettings": return DelimitedTextReadSettings.DeserializeDelimitedTextReadSettings(element); } } - return UnknownFormatReadSettings.DeserializeUnknownFormatReadSettings(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownFormatReadSettings(type, additionalProperties); + } + + FormatReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFormatReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FormatReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFormatReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FormatReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FormatReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFormatReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.cs index 8b5a12622032..09214dbc27ea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatReadSettings.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class FormatReadSettings { - /// Initializes a new instance of FormatReadSettings. + /// Initializes a new instance of . public FormatReadSettings() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of FormatReadSettings. + /// Initializes a new instance of . /// The read setting type. /// Additional Properties. internal FormatReadSettings(string formatReadSettingsType, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.Serialization.cs index 583984374ad7..11b68857f414 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FormatWriteSettings : IUtf8JsonSerializable + public partial class FormatWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(FormatWriteSettingsType); @@ -29,8 +37,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FormatWriteSettings DeserializeFormatWriteSettings(JsonElement element) + internal static FormatWriteSettings DeserializeFormatWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -46,7 +56,70 @@ internal static FormatWriteSettings DeserializeFormatWriteSettings(JsonElement e case "DelimitedTextWriteSettings": return DelimitedTextWriteSettings.DeserializeDelimitedTextWriteSettings(element); } } - return UnknownFormatWriteSettings.DeserializeUnknownFormatWriteSettings(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownFormatWriteSettings(type, additionalProperties); + } + + FormatWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFormatWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FormatWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFormatWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FormatWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FormatWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFormatWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.cs index 5bb9077bf500..7251fb2a49a1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FormatWriteSettings.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class FormatWriteSettings { - /// Initializes a new instance of FormatWriteSettings. + /// Initializes a new instance of . public FormatWriteSettings() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of FormatWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// Additional Properties. internal FormatWriteSettings(string formatWriteSettingsType, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.Serialization.cs index 655353fb668c..6ed9639e49be 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FtpReadSettings : IUtf8JsonSerializable + public partial class FtpReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -87,8 +93,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element) + internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -218,5 +226,53 @@ internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new FtpReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, fileListPath.Value, useBinaryTransfer.Value, disableChunking.Value); } + + FtpReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFtpReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FtpReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFtpReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FtpReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FtpReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFtpReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.cs index ed1c87113e82..82ba81a4b903 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Ftp read settings. public partial class FtpReadSettings : StoreReadSettings { - /// Initializes a new instance of FtpReadSettings. + /// Initializes a new instance of . public FtpReadSettings() { StoreReadSettingsType = "FtpReadSettings"; } - /// Initializes a new instance of FtpReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.Serialization.cs index 5151273f41d8..7d7b77f48229 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FtpServerLinkedService : IUtf8JsonSerializable + public partial class FtpServerLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -112,8 +132,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FtpServerLinkedService DeserializeFtpServerLinkedService(JsonElement element) + internal static FtpServerLinkedService DeserializeFtpServerLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -270,5 +292,53 @@ internal static FtpServerLinkedService DeserializeFtpServerLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new FtpServerLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, port.Value, Optional.ToNullable(authenticationType), userName.Value, password, encryptedCredential.Value, enableSsl.Value, enableServerCertificateValidation.Value); } + + FtpServerLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFtpServerLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FtpServerLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFtpServerLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FtpServerLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FtpServerLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFtpServerLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.cs index 3e0b347e5887..5b6270046edd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A FTP server Linked Service. public partial class FtpServerLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of FtpServerLinkedService. + /// Initializes a new instance of . /// Host name of the FTP server. Type: string (or Expression with resultType string). /// is null. public FtpServerLinkedService(DataFactoryElement host) @@ -26,7 +26,7 @@ public FtpServerLinkedService(DataFactoryElement host) LinkedServiceType = "FtpServer"; } - /// Initializes a new instance of FtpServerLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -54,6 +54,11 @@ internal FtpServerLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "FtpServer"; } + /// Initializes a new instance of for deserialization. + internal FtpServerLinkedService() + { + } + /// Host name of the FTP server. Type: string (or Expression with resultType string). public DataFactoryElement Host { get; set; } /// The TCP port number that the FTP server uses to listen for client connections. Default value is 21. Type: integer (or Expression with resultType integer), minimum: 0. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.Serialization.cs index e24b9d9213d3..6aac8cdb1c38 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class FtpServerLocation : IUtf8JsonSerializable + public partial class FtpServerLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetLocationType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static FtpServerLocation DeserializeFtpServerLocation(JsonElement element) + internal static FtpServerLocation DeserializeFtpServerLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static FtpServerLocation DeserializeFtpServerLocation(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new FtpServerLocation(type, folderPath.Value, fileName.Value, additionalProperties); } + + FtpServerLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeFtpServerLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + FtpServerLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeFtpServerLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(FtpServerLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator FtpServerLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeFtpServerLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.cs index 8d642895cb5a..d2831a4e3695 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/FtpServerLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of ftp server dataset. public partial class FtpServerLocation : DatasetLocation { - /// Initializes a new instance of FtpServerLocation. + /// Initializes a new instance of . public FtpServerLocation() { DatasetLocationType = "FtpServerLocation"; } - /// Initializes a new instance of FtpServerLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.Serialization.cs index e2913a197c6e..209b75e43d74 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GetDatasetMetadataActivity : IUtf8JsonSerializable + public partial class GetDatasetMetadataActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,14 +83,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } if (Optional.IsCollectionDefined(FieldList)) { writer.WritePropertyName("fieldList"u8); @@ -93,12 +127,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -113,8 +161,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GetDatasetMetadataActivity DeserializeGetDatasetMetadataActivity(JsonElement element) + internal static GetDatasetMetadataActivity DeserializeGetDatasetMetadataActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -276,5 +326,53 @@ internal static GetDatasetMetadataActivity DeserializeGetDatasetMetadataActivity additionalProperties = additionalPropertiesDictionary; return new GetDatasetMetadataActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, dataset, Optional.ToList(fieldList), storeSettings.Value, formatSettings.Value); } + + GetDatasetMetadataActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetDatasetMetadataActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetDatasetMetadataActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetDatasetMetadataActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetDatasetMetadataActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetDatasetMetadataActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetDatasetMetadataActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.cs index fa36e5e6a081..87c31ecb2bf5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetDatasetMetadataActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Activity to get metadata of dataset. public partial class GetDatasetMetadataActivity : ExecutionActivity { - /// Initializes a new instance of GetDatasetMetadataActivity. + /// Initializes a new instance of . /// Activity name. /// GetMetadata activity dataset reference. /// or is null. @@ -29,7 +29,7 @@ public GetDatasetMetadataActivity(string name, DatasetReference dataset) : base( ActivityType = "GetMetadata"; } - /// Initializes a new instance of GetDatasetMetadataActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -61,6 +61,11 @@ internal GetDatasetMetadataActivity(string name, string activityType, string des ActivityType = activityType ?? "GetMetadata"; } + /// Initializes a new instance of for deserialization. + internal GetDatasetMetadataActivity() + { + } + /// GetMetadata activity dataset reference. public DatasetReference Dataset { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.Serialization.cs index 8ab8ef26983c..a86bdda30273 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.Serialization.cs @@ -5,22 +5,116 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GetSsisObjectMetadataContent : IUtf8JsonSerializable + public partial class GetSsisObjectMetadataContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MetadataPath)) { writer.WritePropertyName("metadataPath"u8); writer.WriteStringValue(MetadataPath); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GetSsisObjectMetadataContent DeserializeGetSsisObjectMetadataContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional metadataPath = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadataPath"u8)) + { + metadataPath = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GetSsisObjectMetadataContent(metadataPath.Value, serializedAdditionalRawData); + } + + GetSsisObjectMetadataContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGetSsisObjectMetadataContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GetSsisObjectMetadataContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGetSsisObjectMetadataContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GetSsisObjectMetadataContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GetSsisObjectMetadataContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGetSsisObjectMetadataContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.cs index ee4a36084573..72f2542b0b41 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GetSsisObjectMetadataContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The request payload of get SSIS object metadata. public partial class GetSsisObjectMetadataContent { - /// Initializes a new instance of GetSsisObjectMetadataContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public GetSsisObjectMetadataContent() { } + /// Initializes a new instance of . + /// Metadata path. + /// Keeps track of any properties unknown to the library. + internal GetSsisObjectMetadataContent(string metadataPath, Dictionary serializedAdditionalRawData) + { + MetadataPath = metadataPath; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// Metadata path. public string MetadataPath { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.Serialization.cs index 56582be94a92..7eb52c0220a5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GitHubAccessTokenContent : IUtf8JsonSerializable + public partial class GitHubAccessTokenContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("gitHubAccessCode"u8); writer.WriteStringValue(GitHubAccessCode); @@ -25,11 +33,126 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GitHubClientSecret)) { writer.WritePropertyName("gitHubClientSecret"u8); - writer.WriteObjectValue(GitHubClientSecret); + if (GitHubClientSecret is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)GitHubClientSecret).Serialize(writer, options); + } } writer.WritePropertyName("gitHubAccessTokenBaseUrl"u8); writer.WriteStringValue(GitHubAccessTokenBaseUri.AbsoluteUri); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static GitHubAccessTokenContent DeserializeGitHubAccessTokenContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string gitHubAccessCode = default; + Optional gitHubClientId = default; + Optional gitHubClientSecret = default; + Uri gitHubAccessTokenBaseUrl = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("gitHubAccessCode"u8)) + { + gitHubAccessCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("gitHubClientId"u8)) + { + gitHubClientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("gitHubClientSecret"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gitHubClientSecret = FactoryGitHubClientSecret.DeserializeFactoryGitHubClientSecret(property.Value); + continue; + } + if (property.NameEquals("gitHubAccessTokenBaseUrl"u8)) + { + gitHubAccessTokenBaseUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new GitHubAccessTokenContent(gitHubAccessCode, gitHubClientId.Value, gitHubClientSecret.Value, gitHubAccessTokenBaseUrl, serializedAdditionalRawData); + } + + GitHubAccessTokenContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGitHubAccessTokenContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GitHubAccessTokenContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGitHubAccessTokenContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GitHubAccessTokenContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GitHubAccessTokenContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGitHubAccessTokenContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.cs index ebeee24e3d5f..99ce22d95996 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Get GitHub access token request definition. public partial class GitHubAccessTokenContent { - /// Initializes a new instance of GitHubAccessTokenContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// GitHub access code. /// GitHub access token base URL. /// or is null. @@ -26,6 +30,26 @@ public GitHubAccessTokenContent(string gitHubAccessCode, Uri gitHubAccessTokenBa GitHubAccessTokenBaseUri = gitHubAccessTokenBaseUri; } + /// Initializes a new instance of . + /// GitHub access code. + /// GitHub application client ID. + /// GitHub bring your own app client secret information. + /// GitHub access token base URL. + /// Keeps track of any properties unknown to the library. + internal GitHubAccessTokenContent(string gitHubAccessCode, string gitHubClientId, FactoryGitHubClientSecret gitHubClientSecret, Uri gitHubAccessTokenBaseUri, Dictionary serializedAdditionalRawData) + { + GitHubAccessCode = gitHubAccessCode; + GitHubClientId = gitHubClientId; + GitHubClientSecret = gitHubClientSecret; + GitHubAccessTokenBaseUri = gitHubAccessTokenBaseUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GitHubAccessTokenContent() + { + } + /// GitHub access code. public string GitHubAccessCode { get; } /// GitHub application client ID. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.Serialization.cs index f5c24de53f5a..2fd3d3bdd6ee 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GitHubAccessTokenResult + public partial class GitHubAccessTokenResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static GitHubAccessTokenResult DeserializeGitHubAccessTokenResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(GitHubAccessToken)) + { + writer.WritePropertyName("gitHubAccessToken"u8); + writer.WriteStringValue(GitHubAccessToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static GitHubAccessTokenResult DeserializeGitHubAccessTokenResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional gitHubAccessToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("gitHubAccessToken"u8)) @@ -26,8 +60,61 @@ internal static GitHubAccessTokenResult DeserializeGitHubAccessTokenResult(JsonE gitHubAccessToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new GitHubAccessTokenResult(gitHubAccessToken.Value); + return new GitHubAccessTokenResult(gitHubAccessToken.Value, serializedAdditionalRawData); + } + + GitHubAccessTokenResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGitHubAccessTokenResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GitHubAccessTokenResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGitHubAccessTokenResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GitHubAccessTokenResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GitHubAccessTokenResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGitHubAccessTokenResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.cs index fe052ce5f420..cd103ba85431 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GitHubAccessTokenResult.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Get GitHub access token response definition. public partial class GitHubAccessTokenResult { - /// Initializes a new instance of GitHubAccessTokenResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal GitHubAccessTokenResult() { } - /// Initializes a new instance of GitHubAccessTokenResult. + /// Initializes a new instance of . /// GitHub access token. - internal GitHubAccessTokenResult(string gitHubAccessToken) + /// Keeps track of any properties unknown to the library. + internal GitHubAccessTokenResult(string gitHubAccessToken, Dictionary serializedAdditionalRawData) { GitHubAccessToken = gitHubAccessToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// GitHub access token. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.Serialization.cs index c4f30c20a301..799ab14b16f5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleAdWordsLinkedService : IUtf8JsonSerializable + public partial class GoogleAdWordsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -139,8 +159,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleAdWordsLinkedService DeserializeGoogleAdWordsLinkedService(JsonElement element) + internal static GoogleAdWordsLinkedService DeserializeGoogleAdWordsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -341,5 +363,53 @@ internal static GoogleAdWordsLinkedService DeserializeGoogleAdWordsLinkedService additionalProperties = additionalPropertiesDictionary; return new GoogleAdWordsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionProperties.Value, clientCustomerId.Value, developerToken, Optional.ToNullable(authenticationType), refreshToken, clientId.Value, clientSecret, email.Value, keyFilePath.Value, trustedCertPath.Value, useSystemTrustStore.Value, encryptedCredential.Value); } + + GoogleAdWordsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleAdWordsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleAdWordsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleAdWordsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleAdWordsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleAdWordsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleAdWordsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.cs index 955c24927cb6..0030cf25d52b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Google AdWords service linked service. public partial class GoogleAdWordsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of GoogleAdWordsLinkedService. + /// Initializes a new instance of . public GoogleAdWordsLinkedService() { LinkedServiceType = "GoogleAdWords"; } - /// Initializes a new instance of GoogleAdWordsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.Serialization.cs index 8f9be19e9588..09898640e070 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleAdWordsObjectDataset : IUtf8JsonSerializable + public partial class GoogleAdWordsObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleAdWordsObjectDataset DeserializeGoogleAdWordsObjectDataset(JsonElement element) + internal static GoogleAdWordsObjectDataset DeserializeGoogleAdWordsObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static GoogleAdWordsObjectDataset DeserializeGoogleAdWordsObjectDataset additionalProperties = additionalPropertiesDictionary; return new GoogleAdWordsObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + GoogleAdWordsObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleAdWordsObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleAdWordsObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleAdWordsObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleAdWordsObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleAdWordsObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleAdWordsObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.cs index ccdf4b1a4820..1b1edf7554e8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Google AdWords service dataset. public partial class GoogleAdWordsObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of GoogleAdWordsObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public GoogleAdWordsObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public GoogleAdWordsObjectDataset(DataFactoryLinkedServiceReference linkedServic DatasetType = "GoogleAdWordsObject"; } - /// Initializes a new instance of GoogleAdWordsObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal GoogleAdWordsObjectDataset(string datasetType, string description, Data DatasetType = datasetType ?? "GoogleAdWordsObject"; } + /// Initializes a new instance of for deserialization. + internal GoogleAdWordsObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.Serialization.cs index 2130c6326932..da370153c1b5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleAdWordsSource : IUtf8JsonSerializable + public partial class GoogleAdWordsSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleAdWordsSource DeserializeGoogleAdWordsSource(JsonElement element) + internal static GoogleAdWordsSource DeserializeGoogleAdWordsSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static GoogleAdWordsSource DeserializeGoogleAdWordsSource(JsonElement e additionalProperties = additionalPropertiesDictionary; return new GoogleAdWordsSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + GoogleAdWordsSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleAdWordsSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleAdWordsSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleAdWordsSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleAdWordsSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleAdWordsSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleAdWordsSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.cs index 65fe89990b96..849f9677619c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleAdWordsSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Google AdWords service source. public partial class GoogleAdWordsSource : TabularSource { - /// Initializes a new instance of GoogleAdWordsSource. + /// Initializes a new instance of . public GoogleAdWordsSource() { CopySourceType = "GoogleAdWordsSource"; } - /// Initializes a new instance of GoogleAdWordsSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.Serialization.cs index 7866c4efb58a..65c27ec3bf7b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleBigQueryLinkedService : IUtf8JsonSerializable + public partial class GoogleBigQueryLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -129,8 +149,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleBigQueryLinkedService DeserializeGoogleBigQueryLinkedService(JsonElement element) + internal static GoogleBigQueryLinkedService DeserializeGoogleBigQueryLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -323,5 +345,53 @@ internal static GoogleBigQueryLinkedService DeserializeGoogleBigQueryLinkedServi additionalProperties = additionalPropertiesDictionary; return new GoogleBigQueryLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, project, additionalProjects.Value, requestGoogleDriveScope.Value, authenticationType, refreshToken, clientId.Value, clientSecret, email.Value, keyFilePath.Value, trustedCertPath.Value, useSystemTrustStore.Value, encryptedCredential.Value); } + + GoogleBigQueryLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleBigQueryLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleBigQueryLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleBigQueryLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleBigQueryLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleBigQueryLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleBigQueryLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.cs index 90d7506ffe63..86dcc1c6c0f5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Google BigQuery service linked service. public partial class GoogleBigQueryLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of GoogleBigQueryLinkedService. + /// Initializes a new instance of . /// The default BigQuery project to query against. Type: string (or Expression with resultType string). /// The OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR. /// is null. @@ -28,7 +28,7 @@ public GoogleBigQueryLinkedService(DataFactoryElement project, GoogleBig LinkedServiceType = "GoogleBigQuery"; } - /// Initializes a new instance of GoogleBigQueryLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -64,6 +64,11 @@ internal GoogleBigQueryLinkedService(string linkedServiceType, IntegrationRuntim LinkedServiceType = linkedServiceType ?? "GoogleBigQuery"; } + /// Initializes a new instance of for deserialization. + internal GoogleBigQueryLinkedService() + { + } + /// The default BigQuery project to query against. Type: string (or Expression with resultType string). public DataFactoryElement Project { get; set; } /// A comma-separated list of public BigQuery projects to access. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.Serialization.cs index 8b890725e5a3..5444fe801c70 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleBigQueryObjectDataset : IUtf8JsonSerializable + public partial class GoogleBigQueryObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleBigQueryObjectDataset DeserializeGoogleBigQueryObjectDataset(JsonElement element) + internal static GoogleBigQueryObjectDataset DeserializeGoogleBigQueryObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static GoogleBigQueryObjectDataset DeserializeGoogleBigQueryObjectDatas additionalProperties = additionalPropertiesDictionary; return new GoogleBigQueryObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, dataset.Value); } + + GoogleBigQueryObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleBigQueryObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleBigQueryObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleBigQueryObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleBigQueryObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleBigQueryObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleBigQueryObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.cs index 669499a47837..17e8704d1dbf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQueryObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Google BigQuery service dataset. public partial class GoogleBigQueryObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of GoogleBigQueryObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public GoogleBigQueryObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public GoogleBigQueryObjectDataset(DataFactoryLinkedServiceReference linkedServi DatasetType = "GoogleBigQueryObject"; } - /// Initializes a new instance of GoogleBigQueryObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal GoogleBigQueryObjectDataset(string datasetType, string description, Dat DatasetType = datasetType ?? "GoogleBigQueryObject"; } + /// Initializes a new instance of for deserialization. + internal GoogleBigQueryObjectDataset() + { + } + /// /// This property will be retired. Please consider using database + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.Serialization.cs index f99451eeedd0..70b3eafb7971 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleBigQuerySource : IUtf8JsonSerializable + public partial class GoogleBigQuerySource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleBigQuerySource DeserializeGoogleBigQuerySource(JsonElement element) + internal static GoogleBigQuerySource DeserializeGoogleBigQuerySource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static GoogleBigQuerySource DeserializeGoogleBigQuerySource(JsonElement additionalProperties = additionalPropertiesDictionary; return new GoogleBigQuerySource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + GoogleBigQuerySource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleBigQuerySource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleBigQuerySource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleBigQuerySource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleBigQuerySource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleBigQuerySource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleBigQuerySource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.cs index f508a7c67f45..0b8620870b6b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleBigQuerySource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Google BigQuery service source. public partial class GoogleBigQuerySource : TabularSource { - /// Initializes a new instance of GoogleBigQuerySource. + /// Initializes a new instance of . public GoogleBigQuerySource() { CopySourceType = "GoogleBigQuerySource"; } - /// Initializes a new instance of GoogleBigQuerySource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.Serialization.cs index 85b684562016..4deabd3baf05 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleCloudStorageLinkedService : IUtf8JsonSerializable + public partial class GoogleCloudStorageLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -95,8 +115,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleCloudStorageLinkedService DeserializeGoogleCloudStorageLinkedService(JsonElement element) + internal static GoogleCloudStorageLinkedService DeserializeGoogleCloudStorageLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -217,5 +239,53 @@ internal static GoogleCloudStorageLinkedService DeserializeGoogleCloudStorageLin additionalProperties = additionalPropertiesDictionary; return new GoogleCloudStorageLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, accessKeyId.Value, secretAccessKey, serviceUrl.Value, encryptedCredential.Value); } + + GoogleCloudStorageLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleCloudStorageLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleCloudStorageLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleCloudStorageLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleCloudStorageLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleCloudStorageLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleCloudStorageLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.cs index 4eedf8b004ef..68d184b53039 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Google Cloud Storage. public partial class GoogleCloudStorageLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of GoogleCloudStorageLinkedService. + /// Initializes a new instance of . public GoogleCloudStorageLinkedService() { LinkedServiceType = "GoogleCloudStorage"; } - /// Initializes a new instance of GoogleCloudStorageLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.Serialization.cs index cb79c4d93add..c9a671c174f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleCloudStorageLocation : IUtf8JsonSerializable + public partial class GoogleCloudStorageLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BucketName)) { @@ -52,8 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleCloudStorageLocation DeserializeGoogleCloudStorageLocation(JsonElement element) + internal static GoogleCloudStorageLocation DeserializeGoogleCloudStorageLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,5 +121,53 @@ internal static GoogleCloudStorageLocation DeserializeGoogleCloudStorageLocation additionalProperties = additionalPropertiesDictionary; return new GoogleCloudStorageLocation(type, folderPath.Value, fileName.Value, additionalProperties, bucketName.Value, version.Value); } + + GoogleCloudStorageLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleCloudStorageLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleCloudStorageLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleCloudStorageLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleCloudStorageLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleCloudStorageLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleCloudStorageLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.cs index e07956dcbe27..026bbd1e0364 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of Google Cloud Storage dataset. public partial class GoogleCloudStorageLocation : DatasetLocation { - /// Initializes a new instance of GoogleCloudStorageLocation. + /// Initializes a new instance of . public GoogleCloudStorageLocation() { DatasetLocationType = "GoogleCloudStorageLocation"; } - /// Initializes a new instance of GoogleCloudStorageLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs index 7e47baea1295..ebcd32759080 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleCloudStorageReadSettings : IUtf8JsonSerializable + public partial class GoogleCloudStorageReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleCloudStorageReadSettings DeserializeGoogleCloudStorageReadSettings(JsonElement element) + internal static GoogleCloudStorageReadSettings DeserializeGoogleCloudStorageReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static GoogleCloudStorageReadSettings DeserializeGoogleCloudStorageRead additionalProperties = additionalPropertiesDictionary; return new GoogleCloudStorageReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + GoogleCloudStorageReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleCloudStorageReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleCloudStorageReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleCloudStorageReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleCloudStorageReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleCloudStorageReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleCloudStorageReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.cs index befde72a7020..ab0c4b63775b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleCloudStorageReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Google Cloud Storage read settings. public partial class GoogleCloudStorageReadSettings : StoreReadSettings { - /// Initializes a new instance of GoogleCloudStorageReadSettings. + /// Initializes a new instance of . public GoogleCloudStorageReadSettings() { StoreReadSettingsType = "GoogleCloudStorageReadSettings"; } - /// Initializes a new instance of GoogleCloudStorageReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.Serialization.cs index 9b2ae40dbf76..f8f03f53099e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GoogleSheetsLinkedService : IUtf8JsonSerializable + public partial class GoogleSheetsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -81,8 +101,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GoogleSheetsLinkedService DeserializeGoogleSheetsLinkedService(JsonElement element) + internal static GoogleSheetsLinkedService DeserializeGoogleSheetsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -179,5 +201,53 @@ internal static GoogleSheetsLinkedService DeserializeGoogleSheetsLinkedService(J additionalProperties = additionalPropertiesDictionary; return new GoogleSheetsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, apiToken, encryptedCredential.Value); } + + GoogleSheetsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGoogleSheetsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GoogleSheetsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGoogleSheetsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GoogleSheetsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GoogleSheetsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGoogleSheetsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.cs index 288b897435c6..087f6f743796 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GoogleSheetsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for GoogleSheets. public partial class GoogleSheetsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of GoogleSheetsLinkedService. + /// Initializes a new instance of . /// The api token for the GoogleSheets source. /// is null. public GoogleSheetsLinkedService(DataFactorySecretBaseDefinition apiToken) @@ -26,7 +26,7 @@ public GoogleSheetsLinkedService(DataFactorySecretBaseDefinition apiToken) LinkedServiceType = "GoogleSheets"; } - /// Initializes a new instance of GoogleSheetsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -42,6 +42,11 @@ internal GoogleSheetsLinkedService(string linkedServiceType, IntegrationRuntimeR LinkedServiceType = linkedServiceType ?? "GoogleSheets"; } + /// Initializes a new instance of for deserialization. + internal GoogleSheetsLinkedService() + { + } + /// The api token for the GoogleSheets source. public DataFactorySecretBaseDefinition ApiToken { get; set; } /// The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.Serialization.cs index 7beef48616ec..ead611d7be57 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GreenplumLinkedService : IUtf8JsonSerializable + public partial class GreenplumLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -94,8 +114,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GreenplumLinkedService DeserializeGreenplumLinkedService(JsonElement element) + internal static GreenplumLinkedService DeserializeGreenplumLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static GreenplumLinkedService DeserializeGreenplumLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new GreenplumLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, password, encryptedCredential.Value); } + + GreenplumLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGreenplumLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GreenplumLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGreenplumLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GreenplumLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GreenplumLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGreenplumLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.cs index a4f50ec874ae..005b50ffcc1d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Greenplum Database linked service. public partial class GreenplumLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of GreenplumLinkedService. + /// Initializes a new instance of . public GreenplumLinkedService() { LinkedServiceType = "Greenplum"; } - /// Initializes a new instance of GreenplumLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.Serialization.cs index 75e31eb35a01..4594b1bd94fa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GreenplumSource : IUtf8JsonSerializable + public partial class GreenplumSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GreenplumSource DeserializeGreenplumSource(JsonElement element) + internal static GreenplumSource DeserializeGreenplumSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static GreenplumSource DeserializeGreenplumSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new GreenplumSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + GreenplumSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGreenplumSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GreenplumSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGreenplumSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GreenplumSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GreenplumSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGreenplumSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.cs index c9c0f957c604..6b7b026a2310 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Greenplum Database source. public partial class GreenplumSource : TabularSource { - /// Initializes a new instance of GreenplumSource. + /// Initializes a new instance of . public GreenplumSource() { CopySourceType = "GreenplumSource"; } - /// Initializes a new instance of GreenplumSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.Serialization.cs index 3ec65551e968..a4789cbaa5f4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class GreenplumTableDataset : IUtf8JsonSerializable + public partial class GreenplumTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static GreenplumTableDataset DeserializeGreenplumTableDataset(JsonElement element) + internal static GreenplumTableDataset DeserializeGreenplumTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static GreenplumTableDataset DeserializeGreenplumTableDataset(JsonEleme additionalProperties = additionalPropertiesDictionary; return new GreenplumTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + GreenplumTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeGreenplumTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + GreenplumTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeGreenplumTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(GreenplumTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator GreenplumTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeGreenplumTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.cs index 0bfb764bfde4..856db9630a4b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/GreenplumTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Greenplum Database dataset. public partial class GreenplumTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of GreenplumTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public GreenplumTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public GreenplumTableDataset(DataFactoryLinkedServiceReference linkedServiceName DatasetType = "GreenplumTable"; } - /// Initializes a new instance of GreenplumTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal GreenplumTableDataset(string datasetType, string description, DataFacto DatasetType = datasetType ?? "GreenplumTable"; } + /// Initializes a new instance of for deserialization. + internal GreenplumTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.Serialization.cs index b9f0e17aff56..3af1b0ee7808 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HBaseLinkedService : IUtf8JsonSerializable + public partial class HBaseLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -124,8 +144,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HBaseLinkedService DeserializeHBaseLinkedService(JsonElement element) + internal static HBaseLinkedService DeserializeHBaseLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -308,5 +330,53 @@ internal static HBaseLinkedService DeserializeHBaseLinkedService(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new HBaseLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, port.Value, httpPath.Value, authenticationType, username.Value, password, enableSsl.Value, trustedCertPath.Value, allowHostNameCNMismatch.Value, allowSelfSignedServerCert.Value, encryptedCredential.Value); } + + HBaseLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHBaseLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HBaseLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHBaseLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HBaseLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HBaseLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHBaseLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.cs index 8357ff8f4bf2..5e7cf6445351 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HBase server linked service. public partial class HBaseLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HBaseLinkedService. + /// Initializes a new instance of . /// The IP address or host name of the HBase server. (i.e. 192.168.222.160). /// The authentication mechanism to use to connect to the HBase server. /// is null. @@ -28,7 +28,7 @@ public HBaseLinkedService(DataFactoryElement host, HBaseAuthenticationTy LinkedServiceType = "HBase"; } - /// Initializes a new instance of HBaseLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -62,6 +62,11 @@ internal HBaseLinkedService(string linkedServiceType, IntegrationRuntimeReferenc LinkedServiceType = linkedServiceType ?? "HBase"; } + /// Initializes a new instance of for deserialization. + internal HBaseLinkedService() + { + } + /// The IP address or host name of the HBase server. (i.e. 192.168.222.160). public DataFactoryElement Host { get; set; } /// The TCP port that the HBase instance uses to listen for client connections. The default value is 9090. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.Serialization.cs index 6284d7cf992e..0beb51353180 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HBaseObjectDataset : IUtf8JsonSerializable + public partial class HBaseObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HBaseObjectDataset DeserializeHBaseObjectDataset(JsonElement element) + internal static HBaseObjectDataset DeserializeHBaseObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static HBaseObjectDataset DeserializeHBaseObjectDataset(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new HBaseObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + HBaseObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHBaseObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HBaseObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHBaseObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HBaseObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HBaseObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHBaseObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.cs index e37d6f84d9ad..2c1d4088db79 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HBase server dataset. public partial class HBaseObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of HBaseObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public HBaseObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public HBaseObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "HBaseObject"; } - /// Initializes a new instance of HBaseObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal HBaseObjectDataset(string datasetType, string description, DataFactoryE DatasetType = datasetType ?? "HBaseObject"; } + /// Initializes a new instance of for deserialization. + internal HBaseObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.Serialization.cs index 982876f63432..1ccc4e504f96 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HBaseSource : IUtf8JsonSerializable + public partial class HBaseSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HBaseSource DeserializeHBaseSource(JsonElement element) + internal static HBaseSource DeserializeHBaseSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static HBaseSource DeserializeHBaseSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new HBaseSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + HBaseSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHBaseSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HBaseSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHBaseSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HBaseSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HBaseSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHBaseSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.cs index 70a6486edf02..481a310323cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HBaseSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity HBase server source. public partial class HBaseSource : TabularSource { - /// Initializes a new instance of HBaseSource. + /// Initializes a new instance of . public HBaseSource() { CopySourceType = "HBaseSource"; } - /// Initializes a new instance of HBaseSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.Serialization.cs index f880db964564..1669a371c960 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightHiveActivity : IUtf8JsonSerializable + public partial class HDInsightHiveActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -171,8 +198,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightHiveActivity DeserializeHDInsightHiveActivity(JsonElement element) + internal static HDInsightHiveActivity DeserializeHDInsightHiveActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -407,5 +436,53 @@ internal static HDInsightHiveActivity DeserializeHDInsightHiveActivity(JsonEleme additionalProperties = additionalPropertiesDictionary; return new HDInsightHiveActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, Optional.ToList(storageLinkedServices), Optional.ToList(arguments), Optional.ToNullable(getDebugInfo), scriptPath.Value, scriptLinkedService, Optional.ToDictionary(defines), Optional.ToDictionary(variables), Optional.ToNullable(queryTimeout)); } + + HDInsightHiveActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightHiveActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightHiveActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightHiveActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightHiveActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightHiveActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightHiveActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.cs index 63c13d4d3c7b..0f302e1ebc3d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightHiveActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight Hive activity type. public partial class HDInsightHiveActivity : ExecutionActivity { - /// Initializes a new instance of HDInsightHiveActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public HDInsightHiveActivity(string name) : base(name) @@ -29,7 +29,7 @@ public HDInsightHiveActivity(string name) : base(name) ActivityType = "HDInsightHive"; } - /// Initializes a new instance of HDInsightHiveActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -61,6 +61,11 @@ internal HDInsightHiveActivity(string name, string activityType, string descript ActivityType = activityType ?? "HDInsightHive"; } + /// Initializes a new instance of for deserialization. + internal HDInsightHiveActivity() + { + } + /// Storage linked service references. public IList StorageLinkedServices { get; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.Serialization.cs index a3f042eeacb1..2ad0ebd239d8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightLinkedService : IUtf8JsonSerializable + public partial class HDInsightLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -112,8 +132,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightLinkedService DeserializeHDInsightLinkedService(JsonElement element) + internal static HDInsightLinkedService DeserializeHDInsightLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -270,5 +292,53 @@ internal static HDInsightLinkedService DeserializeHDInsightLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new HDInsightLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, clusterUri, userName.Value, password, linkedServiceName, hcatalogLinkedServiceName, encryptedCredential.Value, isEspEnabled.Value, fileSystem.Value); } + + HDInsightLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.cs index 42a546760d46..948b1d41887b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight linked service. public partial class HDInsightLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HDInsightLinkedService. + /// Initializes a new instance of . /// HDInsight cluster URI. Type: string (or Expression with resultType string). /// is null. public HDInsightLinkedService(DataFactoryElement clusterUri) @@ -26,7 +26,7 @@ public HDInsightLinkedService(DataFactoryElement clusterUri) LinkedServiceType = "HDInsight"; } - /// Initializes a new instance of HDInsightLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -54,6 +54,11 @@ internal HDInsightLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "HDInsight"; } + /// Initializes a new instance of for deserialization. + internal HDInsightLinkedService() + { + } + /// HDInsight cluster URI. Type: string (or Expression with resultType string). public DataFactoryElement ClusterUri { get; set; } /// HDInsight cluster user name. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.Serialization.cs index fda664ad6841..cb2b848adb3d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightMapReduceActivity : IUtf8JsonSerializable + public partial class HDInsightMapReduceActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -164,8 +191,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightMapReduceActivity DeserializeHDInsightMapReduceActivity(JsonElement element) + internal static HDInsightMapReduceActivity DeserializeHDInsightMapReduceActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -392,5 +421,53 @@ internal static HDInsightMapReduceActivity DeserializeHDInsightMapReduceActivity additionalProperties = additionalPropertiesDictionary; return new HDInsightMapReduceActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, Optional.ToList(storageLinkedServices), Optional.ToList(arguments), Optional.ToNullable(getDebugInfo), className, jarFilePath, jarLinkedService, Optional.ToList(jarLibs), Optional.ToDictionary(defines)); } + + HDInsightMapReduceActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightMapReduceActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightMapReduceActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightMapReduceActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightMapReduceActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightMapReduceActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightMapReduceActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.cs index 67de6f4b35ea..c5b570ad7ce4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightMapReduceActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight MapReduce activity type. public partial class HDInsightMapReduceActivity : ExecutionActivity { - /// Initializes a new instance of HDInsightMapReduceActivity. + /// Initializes a new instance of . /// Activity name. /// Class name. Type: string (or Expression with resultType string). /// Jar path. Type: string (or Expression with resultType string). @@ -35,7 +35,7 @@ public HDInsightMapReduceActivity(string name, DataFactoryElement classN ActivityType = "HDInsightMapReduce"; } - /// Initializes a new instance of HDInsightMapReduceActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -67,6 +67,11 @@ internal HDInsightMapReduceActivity(string name, string activityType, string des ActivityType = activityType ?? "HDInsightMapReduce"; } + /// Initializes a new instance of for deserialization. + internal HDInsightMapReduceActivity() + { + } + /// Storage linked service references. public IList StorageLinkedServices { get; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.Serialization.cs index dc63e19dddc9..50d0f37f24d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightOnDemandLinkedService : IUtf8JsonSerializable + public partial class HDInsightOnDemandLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -245,7 +265,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ScriptActions) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -262,7 +289,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -277,8 +311,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightOnDemandLinkedService DeserializeHDInsightOnDemandLinkedService(JsonElement element) + internal static HDInsightOnDemandLinkedService DeserializeHDInsightOnDemandLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -681,5 +717,53 @@ internal static HDInsightOnDemandLinkedService DeserializeHDInsightOnDemandLinke additionalProperties = additionalPropertiesDictionary; return new HDInsightOnDemandLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, clusterSize, timeToLive, version, linkedServiceName, hostSubscriptionId, servicePrincipalId.Value, servicePrincipalKey, tenant, clusterResourceGroup, clusterNamePrefix.Value, clusterUserName.Value, clusterPassword, clusterSshUserName.Value, clusterSshPassword, Optional.ToList(additionalLinkedServiceNames), hcatalogLinkedServiceName, clusterType.Value, sparkVersion.Value, coreConfiguration.Value, hBaseConfiguration.Value, hdfsConfiguration.Value, hiveConfiguration.Value, mapReduceConfiguration.Value, oozieConfiguration.Value, stormConfiguration.Value, yarnConfiguration.Value, encryptedCredential.Value, headNodeSize.Value, dataNodeSize.Value, zookeeperNodeSize.Value, Optional.ToList(scriptActions), virtualNetworkId.Value, subnetName.Value, credential.Value); } + + HDInsightOnDemandLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightOnDemandLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightOnDemandLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightOnDemandLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightOnDemandLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightOnDemandLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightOnDemandLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.cs index cc91a2e87d36..08df21202dff 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightOnDemandLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight ondemand linked service. public partial class HDInsightOnDemandLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HDInsightOnDemandLinkedService. + /// Initializes a new instance of . /// Number of worker/data nodes in the cluster. Suggestion value: 4. Type: string (or Expression with resultType string). /// The allowed idle time for the on-demand HDInsight cluster. Specifies how long the on-demand HDInsight cluster stays alive after completion of an activity run if there are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string). /// Version of the HDInsight cluster.  Type: string (or Expression with resultType string). @@ -46,7 +46,7 @@ public HDInsightOnDemandLinkedService(DataFactoryElement clusterSize, Da LinkedServiceType = "HDInsightOnDemand"; } - /// Initializes a new instance of HDInsightOnDemandLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -126,6 +126,11 @@ internal HDInsightOnDemandLinkedService(string linkedServiceType, IntegrationRun LinkedServiceType = linkedServiceType ?? "HDInsightOnDemand"; } + /// Initializes a new instance of for deserialization. + internal HDInsightOnDemandLinkedService() + { + } + /// Number of worker/data nodes in the cluster. Suggestion value: 4. Type: string (or Expression with resultType string). public DataFactoryElement ClusterSize { get; set; } /// The allowed idle time for the on-demand HDInsight cluster. Specifies how long the on-demand HDInsight cluster stays alive after completion of an activity run if there are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.Serialization.cs index cacb8a67c75e..009411230a5c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightPigActivity : IUtf8JsonSerializable + public partial class HDInsightPigActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -136,8 +163,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightPigActivity DeserializeHDInsightPigActivity(JsonElement element) + internal static HDInsightPigActivity DeserializeHDInsightPigActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -328,5 +357,53 @@ internal static HDInsightPigActivity DeserializeHDInsightPigActivity(JsonElement additionalProperties = additionalPropertiesDictionary; return new HDInsightPigActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, Optional.ToList(storageLinkedServices), arguments.Value, Optional.ToNullable(getDebugInfo), scriptPath.Value, scriptLinkedService, Optional.ToDictionary(defines)); } + + HDInsightPigActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightPigActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightPigActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightPigActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightPigActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightPigActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightPigActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.cs index 41180d38e1fa..db9b432c47ed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightPigActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight Pig activity type. public partial class HDInsightPigActivity : ExecutionActivity { - /// Initializes a new instance of HDInsightPigActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public HDInsightPigActivity(string name) : base(name) @@ -27,7 +27,7 @@ public HDInsightPigActivity(string name) : base(name) ActivityType = "HDInsightPig"; } - /// Initializes a new instance of HDInsightPigActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -55,6 +55,11 @@ internal HDInsightPigActivity(string name, string activityType, string descripti ActivityType = activityType ?? "HDInsightPig"; } + /// Initializes a new instance of for deserialization. + internal HDInsightPigActivity() + { + } + /// Storage linked service references. public IList StorageLinkedServices { get; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.Serialization.cs index 4e0adb8549ef..3d5bf9873da5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightSparkActivity : IUtf8JsonSerializable + public partial class HDInsightSparkActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -145,8 +172,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightSparkActivity DeserializeHDInsightSparkActivity(JsonElement element) + internal static HDInsightSparkActivity DeserializeHDInsightSparkActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -352,5 +381,53 @@ internal static HDInsightSparkActivity DeserializeHDInsightSparkActivity(JsonEle additionalProperties = additionalPropertiesDictionary; return new HDInsightSparkActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, rootPath, entryFilePath, Optional.ToList(arguments), Optional.ToNullable(getDebugInfo), sparkJobLinkedService, className.Value, proxyUser.Value, Optional.ToDictionary(sparkConfig)); } + + HDInsightSparkActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightSparkActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightSparkActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightSparkActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightSparkActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightSparkActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightSparkActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.cs index eaeab14353af..db0317148e1d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightSparkActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight Spark activity. public partial class HDInsightSparkActivity : ExecutionActivity { - /// Initializes a new instance of HDInsightSparkActivity. + /// Initializes a new instance of . /// Activity name. /// The root path in 'sparkJobLinkedService' for all the job’s files. Type: string (or Expression with resultType string). /// The relative path to the root folder of the code/package to be executed. Type: string (or Expression with resultType string). @@ -33,7 +33,7 @@ public HDInsightSparkActivity(string name, DataFactoryElement rootPath, ActivityType = "HDInsightSpark"; } - /// Initializes a new instance of HDInsightSparkActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -65,6 +65,11 @@ internal HDInsightSparkActivity(string name, string activityType, string descrip ActivityType = activityType ?? "HDInsightSpark"; } + /// Initializes a new instance of for deserialization. + internal HDInsightSparkActivity() + { + } + /// The root path in 'sparkJobLinkedService' for all the job’s files. Type: string (or Expression with resultType string). public DataFactoryElement RootPath { get; set; } /// The relative path to the root folder of the code/package to be executed. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.Serialization.cs index a0cdcf24c129..723535a2ed89 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HDInsightStreamingActivity : IUtf8JsonSerializable + public partial class HDInsightStreamingActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,7 +83,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -189,8 +216,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HDInsightStreamingActivity DeserializeHDInsightStreamingActivity(JsonElement element) + internal static HDInsightStreamingActivity DeserializeHDInsightStreamingActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -457,5 +486,53 @@ internal static HDInsightStreamingActivity DeserializeHDInsightStreamingActivity additionalProperties = additionalPropertiesDictionary; return new HDInsightStreamingActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, Optional.ToList(storageLinkedServices), Optional.ToList(arguments), Optional.ToNullable(getDebugInfo), mapper, reducer, input, output, filePaths, fileLinkedService, combiner.Value, Optional.ToList(commandEnvironment), Optional.ToDictionary(defines)); } + + HDInsightStreamingActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHDInsightStreamingActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HDInsightStreamingActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHDInsightStreamingActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HDInsightStreamingActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HDInsightStreamingActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHDInsightStreamingActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.cs index 91e2aeac3331..4398d50e24fc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HDInsightStreamingActivity.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDInsight streaming activity type. public partial class HDInsightStreamingActivity : ExecutionActivity { - /// Initializes a new instance of HDInsightStreamingActivity. + /// Initializes a new instance of . /// Activity name. /// Mapper executable name. Type: string (or Expression with resultType string). /// Reducer executable name. Type: string (or Expression with resultType string). @@ -45,7 +45,7 @@ public HDInsightStreamingActivity(string name, DataFactoryElement mapper ActivityType = "HDInsightStreaming"; } - /// Initializes a new instance of HDInsightStreamingActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -85,6 +85,11 @@ internal HDInsightStreamingActivity(string name, string activityType, string des ActivityType = activityType ?? "HDInsightStreaming"; } + /// Initializes a new instance of for deserialization. + internal HDInsightStreamingActivity() + { + } + /// Storage linked service references. public IList StorageLinkedServices { get; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.Serialization.cs index 8474bfe99659..c7cc7372c092 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HdfsLinkedService : IUtf8JsonSerializable + public partial class HdfsLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -97,8 +117,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HdfsLinkedService DeserializeHdfsLinkedService(JsonElement element) + internal static HdfsLinkedService DeserializeHdfsLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -225,5 +247,53 @@ internal static HdfsLinkedService DeserializeHdfsLinkedService(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new HdfsLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, authenticationType.Value, encryptedCredential.Value, userName.Value, password); } + + HdfsLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHdfsLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HdfsLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHdfsLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HdfsLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HdfsLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHdfsLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.cs index ec7c1d6eae56..1e180d1a812a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Hadoop Distributed File System (HDFS) linked service. public partial class HdfsLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HdfsLinkedService. + /// Initializes a new instance of . /// The URL of the HDFS service endpoint, e.g. http://myhostname:50070/webhdfs/v1 . Type: string (or Expression with resultType string). /// is null. public HdfsLinkedService(DataFactoryElement uri) @@ -26,7 +26,7 @@ public HdfsLinkedService(DataFactoryElement uri) LinkedServiceType = "Hdfs"; } - /// Initializes a new instance of HdfsLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -48,6 +48,11 @@ internal HdfsLinkedService(string linkedServiceType, IntegrationRuntimeReference LinkedServiceType = linkedServiceType ?? "Hdfs"; } + /// Initializes a new instance of for deserialization. + internal HdfsLinkedService() + { + } + /// The URL of the HDFS service endpoint, e.g. http://myhostname:50070/webhdfs/v1 . Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// Type of authentication used to connect to the HDFS. Possible values are: Anonymous and Windows. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.Serialization.cs index c400e94a3e0d..9c776fb003d3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HdfsLocation : IUtf8JsonSerializable + public partial class HdfsLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetLocationType); @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HdfsLocation DeserializeHdfsLocation(JsonElement element) + internal static HdfsLocation DeserializeHdfsLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static HdfsLocation DeserializeHdfsLocation(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new HdfsLocation(type, folderPath.Value, fileName.Value, additionalProperties); } + + HdfsLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHdfsLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HdfsLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHdfsLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HdfsLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HdfsLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHdfsLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.cs index b0b56c264338..7194221b5736 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of HDFS. public partial class HdfsLocation : DatasetLocation { - /// Initializes a new instance of HdfsLocation. + /// Initializes a new instance of . public HdfsLocation() { DatasetLocationType = "HdfsLocation"; } - /// Initializes a new instance of HdfsLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.Serialization.cs index 62ce04bc236c..bb0625a5352d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HdfsReadSettings : IUtf8JsonSerializable + public partial class HdfsReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -61,7 +67,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DistcpSettings)) { writer.WritePropertyName("distcpSettings"u8); - writer.WriteObjectValue(DistcpSettings); + if (DistcpSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DistcpSettings).Serialize(writer, options); + } } if (Optional.IsDefined(DeleteFilesAfterCompletion)) { @@ -92,8 +105,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HdfsReadSettings DeserializeHdfsReadSettings(JsonElement element) + internal static HdfsReadSettings DeserializeHdfsReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +248,53 @@ internal static HdfsReadSettings DeserializeHdfsReadSettings(JsonElement element additionalProperties = additionalPropertiesDictionary; return new HdfsReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, distcpSettings.Value, deleteFilesAfterCompletion.Value); } + + HdfsReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHdfsReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HdfsReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHdfsReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HdfsReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HdfsReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHdfsReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.cs index 9f256ccb9600..87910b832cee 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// HDFS read settings. public partial class HdfsReadSettings : StoreReadSettings { - /// Initializes a new instance of HdfsReadSettings. + /// Initializes a new instance of . public HdfsReadSettings() { StoreReadSettingsType = "HdfsReadSettings"; } - /// Initializes a new instance of HdfsReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.Serialization.cs index 3209915cca1e..3f6f2fffed9e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HdfsSource : IUtf8JsonSerializable + public partial class HdfsSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DistcpSettings)) { writer.WritePropertyName("distcpSettings"u8); - writer.WriteObjectValue(DistcpSettings); + if (DistcpSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DistcpSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySourceType); @@ -62,8 +75,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HdfsSource DeserializeHdfsSource(JsonElement element) + internal static HdfsSource DeserializeHdfsSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -143,5 +158,53 @@ internal static HdfsSource DeserializeHdfsSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new HdfsSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, distcpSettings.Value); } + + HdfsSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHdfsSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HdfsSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHdfsSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HdfsSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HdfsSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHdfsSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.cs index 110d591d2047..e2899a8a42cb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HdfsSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity HDFS source. public partial class HdfsSource : CopyActivitySource { - /// Initializes a new instance of HdfsSource. + /// Initializes a new instance of . public HdfsSource() { CopySourceType = "HdfsSource"; } - /// Initializes a new instance of HdfsSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.Serialization.cs index 245ffa734082..c0d170af26e4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HiveLinkedService : IUtf8JsonSerializable + public partial class HiveLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -154,8 +174,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HiveLinkedService DeserializeHiveLinkedService(JsonElement element) + internal static HiveLinkedService DeserializeHiveLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -398,5 +420,53 @@ internal static HiveLinkedService DeserializeHiveLinkedService(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new HiveLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, port.Value, Optional.ToNullable(serverType), Optional.ToNullable(thriftTransportProtocol), authenticationType, serviceDiscoveryMode.Value, zooKeeperNameSpace.Value, useNativeQuery.Value, username.Value, password, httpPath.Value, enableSsl.Value, trustedCertPath.Value, useSystemTrustStore.Value, allowHostNameCNMismatch.Value, allowSelfSignedServerCert.Value, encryptedCredential.Value); } + + HiveLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHiveLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HiveLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHiveLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HiveLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HiveLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHiveLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.cs index d2f1170ec80e..817a1dd55dba 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Hive Server linked service. public partial class HiveLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HiveLinkedService. + /// Initializes a new instance of . /// IP address or host name of the Hive server, separated by ';' for multiple hosts (only when serviceDiscoveryMode is enable). /// The authentication method used to access the Hive server. /// is null. @@ -28,7 +28,7 @@ public HiveLinkedService(DataFactoryElement host, HiveAuthenticationType LinkedServiceType = "Hive"; } - /// Initializes a new instance of HiveLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -74,6 +74,11 @@ internal HiveLinkedService(string linkedServiceType, IntegrationRuntimeReference LinkedServiceType = linkedServiceType ?? "Hive"; } + /// Initializes a new instance of for deserialization. + internal HiveLinkedService() + { + } + /// IP address or host name of the Hive server, separated by ';' for multiple hosts (only when serviceDiscoveryMode is enable). public DataFactoryElement Host { get; set; } /// The TCP port that the Hive server uses to listen for client connections. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.Serialization.cs index 9bce2affcb34..bb1b20a1439b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HiveObjectDataset : IUtf8JsonSerializable + public partial class HiveObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HiveObjectDataset DeserializeHiveObjectDataset(JsonElement element) + internal static HiveObjectDataset DeserializeHiveObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static HiveObjectDataset DeserializeHiveObjectDataset(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new HiveObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + HiveObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHiveObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HiveObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHiveObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HiveObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HiveObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHiveObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.cs index e9c110016ece..5ade5355490d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Hive Server dataset. public partial class HiveObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of HiveObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public HiveObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public HiveObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "HiveObject"; } - /// Initializes a new instance of HiveObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal HiveObjectDataset(string datasetType, string description, DataFactoryEl DatasetType = datasetType ?? "HiveObject"; } + /// Initializes a new instance of for deserialization. + internal HiveObjectDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.Serialization.cs index e64f53f49f22..3ae62088ec79 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HiveSource : IUtf8JsonSerializable + public partial class HiveSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HiveSource DeserializeHiveSource(JsonElement element) + internal static HiveSource DeserializeHiveSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static HiveSource DeserializeHiveSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new HiveSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + HiveSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHiveSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HiveSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHiveSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HiveSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HiveSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHiveSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.cs index 9098ecadfcb0..f4b6d661e58b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HiveSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Hive Server source. public partial class HiveSource : TabularSource { - /// Initializes a new instance of HiveSource. + /// Initializes a new instance of . public HiveSource() { CopySourceType = "HiveSource"; } - /// Initializes a new instance of HiveSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.Serialization.cs index a3c6eefd1001..76b22df04b0c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HttpLinkedService : IUtf8JsonSerializable + public partial class HttpLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -117,8 +137,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HttpLinkedService DeserializeHttpLinkedService(JsonElement element) + internal static HttpLinkedService DeserializeHttpLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -285,5 +307,53 @@ internal static HttpLinkedService DeserializeHttpLinkedService(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new HttpLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, Optional.ToNullable(authenticationType), userName.Value, password, authHeaders.Value, embeddedCertData.Value, certThumbprint.Value, encryptedCredential.Value, enableServerCertificateValidation.Value); } + + HttpLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.cs index 0e45e6a11779..8d0f12b67545 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for an HTTP source. public partial class HttpLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HttpLinkedService. + /// Initializes a new instance of . /// The base URL of the HTTP endpoint, e.g. https://www.microsoft.com. Type: string (or Expression with resultType string). /// is null. public HttpLinkedService(DataFactoryElement uri) @@ -26,7 +26,7 @@ public HttpLinkedService(DataFactoryElement uri) LinkedServiceType = "HttpServer"; } - /// Initializes a new instance of HttpLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -56,6 +56,11 @@ internal HttpLinkedService(string linkedServiceType, IntegrationRuntimeReference LinkedServiceType = linkedServiceType ?? "HttpServer"; } + /// Initializes a new instance of for deserialization. + internal HttpLinkedService() + { + } + /// The base URL of the HTTP endpoint, e.g. https://www.microsoft.com. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// The authentication type to be used to connect to the HTTP server. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.Serialization.cs index 9f40358be2c6..ae539f9d5040 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HttpReadSettings : IUtf8JsonSerializable + public partial class HttpReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RequestMethod)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element) + internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element additionalProperties = additionalPropertiesDictionary; return new HttpReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, requestMethod.Value, requestBody.Value, additionalHeaders.Value, requestTimeout.Value, additionalColumns.Value); } + + HttpReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.cs index 45c64faf4835..0344ae89f101 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Http read settings. public partial class HttpReadSettings : StoreReadSettings { - /// Initializes a new instance of HttpReadSettings. + /// Initializes a new instance of . public HttpReadSettings() { StoreReadSettingsType = "HttpReadSettings"; } - /// Initializes a new instance of HttpReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.Serialization.cs index 9267097385bd..8b6412f54278 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HttpServerLocation : IUtf8JsonSerializable + public partial class HttpServerLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RelativeUri)) { @@ -47,8 +53,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HttpServerLocation DeserializeHttpServerLocation(JsonElement element) + internal static HttpServerLocation DeserializeHttpServerLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,5 +106,53 @@ internal static HttpServerLocation DeserializeHttpServerLocation(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new HttpServerLocation(type, folderPath.Value, fileName.Value, additionalProperties, relativeUrl.Value); } + + HttpServerLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHttpServerLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HttpServerLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHttpServerLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HttpServerLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HttpServerLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHttpServerLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.cs index dd2ff496affe..096502c32f7a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HttpServerLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of http server. public partial class HttpServerLocation : DatasetLocation { - /// Initializes a new instance of HttpServerLocation. + /// Initializes a new instance of . public HttpServerLocation() { DatasetLocationType = "HttpServerLocation"; } - /// Initializes a new instance of HttpServerLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.Serialization.cs index 8a87e3e30dd4..3c5a469dc040 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HubspotLinkedService : IUtf8JsonSerializable + public partial class HubspotLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -112,8 +132,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HubspotLinkedService DeserializeHubspotLinkedService(JsonElement element) + internal static HubspotLinkedService DeserializeHubspotLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -270,5 +292,53 @@ internal static HubspotLinkedService DeserializeHubspotLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new HubspotLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, clientId, clientSecret, accessToken, refreshToken, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + HubspotLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHubspotLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HubspotLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHubspotLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HubspotLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HubspotLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHubspotLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.cs index a8500690ab3b..23243e92d2b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Hubspot Service linked service. public partial class HubspotLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of HubspotLinkedService. + /// Initializes a new instance of . /// The client ID associated with your Hubspot application. /// is null. public HubspotLinkedService(DataFactoryElement clientId) @@ -26,7 +26,7 @@ public HubspotLinkedService(DataFactoryElement clientId) LinkedServiceType = "Hubspot"; } - /// Initializes a new instance of HubspotLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -54,6 +54,11 @@ internal HubspotLinkedService(string linkedServiceType, IntegrationRuntimeRefere LinkedServiceType = linkedServiceType ?? "Hubspot"; } + /// Initializes a new instance of for deserialization. + internal HubspotLinkedService() + { + } + /// The client ID associated with your Hubspot application. public DataFactoryElement ClientId { get; set; } /// The client secret associated with your Hubspot application. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.Serialization.cs index 6ea7918f3512..3ab45316058b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HubspotObjectDataset : IUtf8JsonSerializable + public partial class HubspotObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HubspotObjectDataset DeserializeHubspotObjectDataset(JsonElement element) + internal static HubspotObjectDataset DeserializeHubspotObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static HubspotObjectDataset DeserializeHubspotObjectDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new HubspotObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + HubspotObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHubspotObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HubspotObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHubspotObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HubspotObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HubspotObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHubspotObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.cs index fdd888b75ccd..2e5e9e61d24e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Hubspot Service dataset. public partial class HubspotObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of HubspotObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public HubspotObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public HubspotObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "HubspotObject"; } - /// Initializes a new instance of HubspotObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal HubspotObjectDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "HubspotObject"; } + /// Initializes a new instance of for deserialization. + internal HubspotObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.Serialization.cs index fc79536409c2..af1775b9fadd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class HubspotSource : IUtf8JsonSerializable + public partial class HubspotSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static HubspotSource DeserializeHubspotSource(JsonElement element) + internal static HubspotSource DeserializeHubspotSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static HubspotSource DeserializeHubspotSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new HubspotSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + HubspotSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeHubspotSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + HubspotSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeHubspotSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(HubspotSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator HubspotSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeHubspotSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.cs index ca912baa2e23..2f325843684c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/HubspotSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Hubspot Service source. public partial class HubspotSource : TabularSource { - /// Initializes a new instance of HubspotSource. + /// Initializes a new instance of . public HubspotSource() { CopySourceType = "HubspotSource"; } - /// Initializes a new instance of HubspotSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.Serialization.cs index 84bec69510df..b75084d776f4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IfConditionActivity : IUtf8JsonSerializable + public partial class IfConditionActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -42,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -52,21 +65,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("expression"u8); - writer.WriteObjectValue(Expression); + if (Expression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Expression).Serialize(writer, options); + } if (Optional.IsCollectionDefined(IfTrueActivities)) { writer.WritePropertyName("ifTrueActivities"u8); writer.WriteStartArray(); foreach (var item in IfTrueActivities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -76,7 +110,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IfFalseActivities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -93,8 +134,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static IfConditionActivity DeserializeIfConditionActivity(JsonElement element) + internal static IfConditionActivity DeserializeIfConditionActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -224,5 +267,53 @@ internal static IfConditionActivity DeserializeIfConditionActivity(JsonElement e additionalProperties = additionalPropertiesDictionary; return new IfConditionActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, expression, Optional.ToList(ifTrueActivities), Optional.ToList(ifFalseActivities)); } + + IfConditionActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIfConditionActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IfConditionActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIfConditionActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IfConditionActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IfConditionActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIfConditionActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.cs index d17408951e1a..9cec44b2fad8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IfConditionActivity.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// This activity evaluates a boolean expression and executes either the activities under the ifTrueActivities property or the ifFalseActivities property depending on the result of the expression. public partial class IfConditionActivity : ControlActivity { - /// Initializes a new instance of IfConditionActivity. + /// Initializes a new instance of . /// Activity name. /// An expression that would evaluate to Boolean. This is used to determine the block of activities (ifTrueActivities or ifFalseActivities) that will be executed. /// or is null. @@ -29,7 +29,7 @@ public IfConditionActivity(string name, DataFactoryExpression expression) : base ActivityType = "IfCondition"; } - /// Initializes a new instance of IfConditionActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -57,6 +57,11 @@ internal IfConditionActivity(string name, string activityType, string descriptio ActivityType = activityType ?? "IfCondition"; } + /// Initializes a new instance of for deserialization. + internal IfConditionActivity() + { + } + /// An expression that would evaluate to Boolean. This is used to determine the block of activities (ifTrueActivities or ifFalseActivities) that will be executed. public DataFactoryExpression Expression { get; set; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.Serialization.cs index 5396394d86b0..4738b68f80b3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ImpalaLinkedService : IUtf8JsonSerializable + public partial class ImpalaLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -124,8 +144,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ImpalaLinkedService DeserializeImpalaLinkedService(JsonElement element) + internal static ImpalaLinkedService DeserializeImpalaLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -308,5 +330,53 @@ internal static ImpalaLinkedService DeserializeImpalaLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new ImpalaLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, port.Value, authenticationType, username.Value, password, enableSsl.Value, trustedCertPath.Value, useSystemTrustStore.Value, allowHostNameCNMismatch.Value, allowSelfSignedServerCert.Value, encryptedCredential.Value); } + + ImpalaLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImpalaLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImpalaLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImpalaLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImpalaLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImpalaLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImpalaLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.cs index 0238171d1408..6b784522046a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Impala server linked service. public partial class ImpalaLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of ImpalaLinkedService. + /// Initializes a new instance of . /// The IP address or host name of the Impala server. (i.e. 192.168.222.160). /// The authentication type to use. /// is null. @@ -28,7 +28,7 @@ public ImpalaLinkedService(DataFactoryElement host, ImpalaAuthentication LinkedServiceType = "Impala"; } - /// Initializes a new instance of ImpalaLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -62,6 +62,11 @@ internal ImpalaLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "Impala"; } + /// Initializes a new instance of for deserialization. + internal ImpalaLinkedService() + { + } + /// The IP address or host name of the Impala server. (i.e. 192.168.222.160). public DataFactoryElement Host { get; set; } /// The TCP port that the Impala server uses to listen for client connections. The default value is 21050. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.Serialization.cs index a1f03ed4be15..d63f32e96370 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ImpalaObjectDataset : IUtf8JsonSerializable + public partial class ImpalaObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ImpalaObjectDataset DeserializeImpalaObjectDataset(JsonElement element) + internal static ImpalaObjectDataset DeserializeImpalaObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static ImpalaObjectDataset DeserializeImpalaObjectDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new ImpalaObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + ImpalaObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImpalaObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImpalaObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImpalaObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImpalaObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImpalaObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImpalaObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.cs index 6f02a02fce82..c26459481214 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Impala server dataset. public partial class ImpalaObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ImpalaObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ImpalaObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ImpalaObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "ImpalaObject"; } - /// Initializes a new instance of ImpalaObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal ImpalaObjectDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "ImpalaObject"; } + /// Initializes a new instance of for deserialization. + internal ImpalaObjectDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.Serialization.cs index 9618932d1813..58186314cbcb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ImpalaSource : IUtf8JsonSerializable + public partial class ImpalaSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ImpalaSource DeserializeImpalaSource(JsonElement element) + internal static ImpalaSource DeserializeImpalaSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static ImpalaSource DeserializeImpalaSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ImpalaSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + ImpalaSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImpalaSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImpalaSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImpalaSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImpalaSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImpalaSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImpalaSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.cs index 0642d2928ded..c1183ce1440f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImpalaSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Impala server source. public partial class ImpalaSource : TabularSource { - /// Initializes a new instance of ImpalaSource. + /// Initializes a new instance of . public ImpalaSource() { CopySourceType = "ImpalaSource"; } - /// Initializes a new instance of ImpalaSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.Serialization.cs index 54b4338d0102..d411f1054038 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ImportSettings : IUtf8JsonSerializable + public partial class ImportSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ImportSettingsType); @@ -29,8 +37,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ImportSettings DeserializeImportSettings(JsonElement element) + internal static ImportSettings DeserializeImportSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,7 +53,70 @@ internal static ImportSettings DeserializeImportSettings(JsonElement element) case "AzureDatabricksDeltaLakeImportCommand": return AzureDatabricksDeltaLakeImportCommand.DeserializeAzureDatabricksDeltaLakeImportCommand(element); } } - return UnknownImportSettings.DeserializeUnknownImportSettings(element); + + // Unknown type found so we will deserialize the base properties only + string type = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownImportSettings(type, additionalProperties); + } + + ImportSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeImportSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ImportSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeImportSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ImportSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ImportSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeImportSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.cs index a4b6f5eb32e9..7ff22aa6812f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ImportSettings.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class ImportSettings { - /// Initializes a new instance of ImportSettings. + /// Initializes a new instance of . public ImportSettings() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ImportSettings. + /// Initializes a new instance of . /// The import setting type. /// Additional Properties. internal ImportSettings(string importSettingsType, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.Serialization.cs index a11f1c5bb425..8af0e72dc723 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class InformixLinkedService : IUtf8JsonSerializable + public partial class InformixLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -102,8 +122,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static InformixLinkedService DeserializeInformixLinkedService(JsonElement element) + internal static InformixLinkedService DeserializeInformixLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -240,5 +262,53 @@ internal static InformixLinkedService DeserializeInformixLinkedService(JsonEleme additionalProperties = additionalPropertiesDictionary; return new InformixLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, authenticationType.Value, credential, userName.Value, password, encryptedCredential.Value); } + + InformixLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInformixLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InformixLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInformixLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InformixLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InformixLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInformixLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.cs index 5a8f7dcb31c4..0cdcd8dc0b6b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Informix linked service. public partial class InformixLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of InformixLinkedService. + /// Initializes a new instance of . /// The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. /// is null. public InformixLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public InformixLinkedService(DataFactoryElement connectionString) LinkedServiceType = "Informix"; } - /// Initializes a new instance of InformixLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal InformixLinkedService(string linkedServiceType, IntegrationRuntimeRefer LinkedServiceType = linkedServiceType ?? "Informix"; } + /// Initializes a new instance of for deserialization. + internal InformixLinkedService() + { + } + /// The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. public DataFactoryElement ConnectionString { get; set; } /// Type of authentication used to connect to the Informix as ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.Serialization.cs index 82befb0e804a..799a7856c5b7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class InformixSink : IUtf8JsonSerializable + public partial class InformixSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static InformixSink DeserializeInformixSink(JsonElement element) + internal static InformixSink DeserializeInformixSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static InformixSink DeserializeInformixSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new InformixSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value); } + + InformixSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInformixSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InformixSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInformixSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InformixSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InformixSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInformixSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.cs index 74628d6e2382..d6cd307f519c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Informix sink. public partial class InformixSink : CopySink { - /// Initializes a new instance of InformixSink. + /// Initializes a new instance of . public InformixSink() { CopySinkType = "InformixSink"; } - /// Initializes a new instance of InformixSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.Serialization.cs index c64b0a473898..c36240b8518b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class InformixSource : IUtf8JsonSerializable + public partial class InformixSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static InformixSource DeserializeInformixSource(JsonElement element) + internal static InformixSource DeserializeInformixSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static InformixSource DeserializeInformixSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new InformixSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + InformixSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInformixSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InformixSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInformixSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InformixSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InformixSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInformixSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.cs index 392c6389d0cc..7e4b9a49379f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for Informix. public partial class InformixSource : TabularSource { - /// Initializes a new instance of InformixSource. + /// Initializes a new instance of . public InformixSource() { CopySourceType = "InformixSource"; } - /// Initializes a new instance of InformixSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.Serialization.cs index fc2bce0f39fe..07ed6d667ed0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class InformixTableDataset : IUtf8JsonSerializable + public partial class InformixTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static InformixTableDataset DeserializeInformixTableDataset(JsonElement element) + internal static InformixTableDataset DeserializeInformixTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static InformixTableDataset DeserializeInformixTableDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new InformixTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + InformixTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeInformixTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + InformixTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeInformixTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(InformixTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator InformixTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeInformixTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.cs index 0cc40524f4b8..66f35ce60258 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/InformixTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Informix table dataset. public partial class InformixTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of InformixTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public InformixTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public InformixTableDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "InformixTable"; } - /// Initializes a new instance of InformixTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal InformixTableDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "InformixTable"; } + /// Initializes a new instance of for deserialization. + internal InformixTableDataset() + { + } + /// The Informix table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.Serialization.cs index fff7ed68c092..0b167223d13e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.Serialization.cs @@ -5,21 +5,60 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeAuthKeys + public partial class IntegrationRuntimeAuthKeys : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeAuthKeys DeserializeIntegrationRuntimeAuthKeys(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(AuthKey1)) + { + writer.WritePropertyName("authKey1"u8); + writer.WriteStringValue(AuthKey1); + } + if (Optional.IsDefined(AuthKey2)) + { + writer.WritePropertyName("authKey2"u8); + writer.WriteStringValue(AuthKey2); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeAuthKeys DeserializeIntegrationRuntimeAuthKeys(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional authKey1 = default; Optional authKey2 = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authKey1"u8)) @@ -32,8 +71,61 @@ internal static IntegrationRuntimeAuthKeys DeserializeIntegrationRuntimeAuthKeys authKey2 = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeAuthKeys(authKey1.Value, authKey2.Value); + return new IntegrationRuntimeAuthKeys(authKey1.Value, authKey2.Value, serializedAdditionalRawData); + } + + IntegrationRuntimeAuthKeys IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeAuthKeys(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeAuthKeys IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeAuthKeys(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeAuthKeys model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeAuthKeys(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeAuthKeys(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.cs index bf3d5165dd0f..2063b73bc09c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeAuthKeys.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The integration runtime authentication keys. public partial class IntegrationRuntimeAuthKeys { - /// Initializes a new instance of IntegrationRuntimeAuthKeys. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeAuthKeys() { } - /// Initializes a new instance of IntegrationRuntimeAuthKeys. + /// Initializes a new instance of . /// The primary integration runtime authentication key. /// The secondary integration runtime authentication key. - internal IntegrationRuntimeAuthKeys(string authKey1, string authKey2) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeAuthKeys(string authKey1, string authKey2, Dictionary serializedAdditionalRawData) { AuthKey1 = authKey1; AuthKey2 = authKey2; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The primary integration runtime authentication key. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.Serialization.cs index ae14fca04635..41fe4b570506 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeComputeProperties : IUtf8JsonSerializable + public partial class IntegrationRuntimeComputeProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Location)) { @@ -40,22 +46,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DataFlowProperties)) { writer.WritePropertyName("dataFlowProperties"u8); - writer.WriteObjectValue(DataFlowProperties); + if (DataFlowProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataFlowProperties).Serialize(writer, options); + } } if (Optional.IsDefined(VnetProperties)) { writer.WritePropertyName("vNetProperties"u8); - writer.WriteObjectValue(VnetProperties); + if (VnetProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)VnetProperties).Serialize(writer, options); + } } if (Optional.IsDefined(CopyComputeScaleProperties)) { writer.WritePropertyName("copyComputeScaleProperties"u8); - writer.WriteObjectValue(CopyComputeScaleProperties); + if (CopyComputeScaleProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CopyComputeScaleProperties).Serialize(writer, options); + } } if (Optional.IsDefined(PipelineExternalComputeScaleProperties)) { writer.WritePropertyName("pipelineExternalComputeScaleProperties"u8); - writer.WriteObjectValue(PipelineExternalComputeScaleProperties); + if (PipelineExternalComputeScaleProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PipelineExternalComputeScaleProperties).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -69,8 +103,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static IntegrationRuntimeComputeProperties DeserializeIntegrationRuntimeComputeProperties(JsonElement element) + internal static IntegrationRuntimeComputeProperties DeserializeIntegrationRuntimeComputeProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -160,5 +196,53 @@ internal static IntegrationRuntimeComputeProperties DeserializeIntegrationRuntim additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeComputeProperties(Optional.ToNullable(location), nodeSize.Value, Optional.ToNullable(numberOfNodes), Optional.ToNullable(maxParallelExecutionsPerNode), dataFlowProperties.Value, vnetProperties.Value, copyComputeScaleProperties.Value, pipelineExternalComputeScaleProperties.Value, additionalProperties); } + + IntegrationRuntimeComputeProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeComputeProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeComputeProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeComputeProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeComputeProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeComputeProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeComputeProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.cs index 77235759932a..f40d93500e5f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeComputeProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The compute resource properties for managed integration runtime. public partial class IntegrationRuntimeComputeProperties { - /// Initializes a new instance of IntegrationRuntimeComputeProperties. + /// Initializes a new instance of . public IntegrationRuntimeComputeProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeComputeProperties. + /// Initializes a new instance of . /// The location for managed integration runtime. The supported regions could be found on https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. /// The node size requirement to managed integration runtime. /// The required number of nodes for managed integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.Serialization.cs index 28cd3880893b..e2c04842798e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeConnectionInfo + public partial class IntegrationRuntimeConnectionInfo : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeConnectionInfo DeserializeIntegrationRuntimeConnectionInfo(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeConnectionInfo DeserializeIntegrationRuntimeConnectionInfo(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -73,5 +96,53 @@ internal static IntegrationRuntimeConnectionInfo DeserializeIntegrationRuntimeCo additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeConnectionInfo(serviceToken.Value, identityCertThumbprint.Value, hostServiceUri.Value, version.Value, publicKey.Value, Optional.ToNullable(isIdentityCertExprired), additionalProperties); } + + IntegrationRuntimeConnectionInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeConnectionInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeConnectionInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeConnectionInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeConnectionInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeConnectionInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeConnectionInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.cs index b95efbf77558..434a6587ddd6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeConnectionInfo.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Connection information for encrypting the on-premises data source credentials. public partial class IntegrationRuntimeConnectionInfo { - /// Initializes a new instance of IntegrationRuntimeConnectionInfo. + /// Initializes a new instance of . internal IntegrationRuntimeConnectionInfo() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeConnectionInfo. + /// Initializes a new instance of . /// The token generated in service. Callers use this token to authenticate to integration runtime. /// The integration runtime SSL certificate thumbprint. Click-Once application uses it to do server validation. /// The on-premises integration runtime host URL. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.Serialization.cs index ebbbc87cfc14..7ffbfc31f60d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeCustomSetupScriptProperties : IUtf8JsonSerializable + public partial class IntegrationRuntimeCustomSetupScriptProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BlobContainerUri)) { @@ -27,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sasToken"u8); JsonSerializer.Serialize(writer, SasToken); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IntegrationRuntimeCustomSetupScriptProperties DeserializeIntegrationRuntimeCustomSetupScriptProperties(JsonElement element) + internal static IntegrationRuntimeCustomSetupScriptProperties DeserializeIntegrationRuntimeCustomSetupScriptProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional blobContainerUri = default; Optional sasToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("blobContainerUri"u8)) @@ -58,8 +80,61 @@ internal static IntegrationRuntimeCustomSetupScriptProperties DeserializeIntegra sasToken = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IntegrationRuntimeCustomSetupScriptProperties(blobContainerUri.Value, sasToken, serializedAdditionalRawData); + } + + IntegrationRuntimeCustomSetupScriptProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeCustomSetupScriptProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeCustomSetupScriptProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeCustomSetupScriptProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeCustomSetupScriptProperties model) + { + if (model is null) + { + return null; } - return new IntegrationRuntimeCustomSetupScriptProperties(blobContainerUri.Value, sasToken); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeCustomSetupScriptProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeCustomSetupScriptProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.cs index 25efbeb8a1a5..8688f326a10b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomSetupScriptProperties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -13,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Custom setup script properties for a managed dedicated integration runtime. public partial class IntegrationRuntimeCustomSetupScriptProperties { - /// Initializes a new instance of IntegrationRuntimeCustomSetupScriptProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IntegrationRuntimeCustomSetupScriptProperties() { } - /// Initializes a new instance of IntegrationRuntimeCustomSetupScriptProperties. + /// Initializes a new instance of . /// The URI of the Azure blob container that contains the custom setup script. /// The SAS token of the Azure blob container. - internal IntegrationRuntimeCustomSetupScriptProperties(Uri blobContainerUri, DataFactorySecretString sasToken) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeCustomSetupScriptProperties(Uri blobContainerUri, DataFactorySecretString sasToken, Dictionary serializedAdditionalRawData) { BlobContainerUri = blobContainerUri; SasToken = sasToken; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The URI of the Azure blob container that contains the custom setup script. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.Serialization.cs index f9f609f4de32..5f35c02201bb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class IntegrationRuntimeCustomerVirtualNetwork : IUtf8JsonSerializable + internal partial class IntegrationRuntimeCustomerVirtualNetwork : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(SubnetId)) { writer.WritePropertyName("subnetId"u8); writer.WriteStringValue(SubnetId); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IntegrationRuntimeCustomerVirtualNetwork DeserializeIntegrationRuntimeCustomerVirtualNetwork(JsonElement element) + internal static IntegrationRuntimeCustomerVirtualNetwork DeserializeIntegrationRuntimeCustomerVirtualNetwork(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional subnetId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("subnetId"u8)) @@ -41,8 +64,61 @@ internal static IntegrationRuntimeCustomerVirtualNetwork DeserializeIntegrationR subnetId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IntegrationRuntimeCustomerVirtualNetwork(subnetId.Value, serializedAdditionalRawData); + } + + IntegrationRuntimeCustomerVirtualNetwork IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeCustomerVirtualNetwork(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeCustomerVirtualNetwork IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeCustomerVirtualNetwork(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeCustomerVirtualNetwork model) + { + if (model is null) + { + return null; } - return new IntegrationRuntimeCustomerVirtualNetwork(subnetId.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeCustomerVirtualNetwork(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeCustomerVirtualNetwork(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.cs index e840672a43f0..5cb36cd25bf3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeCustomerVirtualNetwork.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.DataFactory.Models /// The definition and properties of virtual network to which Azure-SSIS integration runtime will join. internal partial class IntegrationRuntimeCustomerVirtualNetwork { - /// Initializes a new instance of IntegrationRuntimeCustomerVirtualNetwork. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IntegrationRuntimeCustomerVirtualNetwork() { } - /// Initializes a new instance of IntegrationRuntimeCustomerVirtualNetwork. + /// Initializes a new instance of . /// The ID of subnet to which Azure-SSIS integration runtime will join. - internal IntegrationRuntimeCustomerVirtualNetwork(ResourceIdentifier subnetId) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeCustomerVirtualNetwork(ResourceIdentifier subnetId, Dictionary serializedAdditionalRawData) { SubnetId = subnetId; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ID of subnet to which Azure-SSIS integration runtime will join. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.Serialization.cs index cd02b02c59b0..ca44a9e3433a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeDataFlowCustomItem : IUtf8JsonSerializable + public partial class IntegrationRuntimeDataFlowCustomItem : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IntegrationRuntimeDataFlowCustomItem DeserializeIntegrationRuntimeDataFlowCustomItem(JsonElement element) + internal static IntegrationRuntimeDataFlowCustomItem DeserializeIntegrationRuntimeDataFlowCustomItem(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static IntegrationRuntimeDataFlowCustomItem DeserializeIntegrationRunti value = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IntegrationRuntimeDataFlowCustomItem(name.Value, value.Value, serializedAdditionalRawData); + } + + IntegrationRuntimeDataFlowCustomItem IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeDataFlowCustomItem(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeDataFlowCustomItem IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeDataFlowCustomItem(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeDataFlowCustomItem model) + { + if (model is null) + { + return null; } - return new IntegrationRuntimeDataFlowCustomItem(name.Value, value.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeDataFlowCustomItem(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeDataFlowCustomItem(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.cs index a1783ab5a875..c28d16f82d95 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowCustomItem.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The IntegrationRuntimeDataFlowCustomItem. public partial class IntegrationRuntimeDataFlowCustomItem { - /// Initializes a new instance of IntegrationRuntimeDataFlowCustomItem. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IntegrationRuntimeDataFlowCustomItem() { } - /// Initializes a new instance of IntegrationRuntimeDataFlowCustomItem. + /// Initializes a new instance of . /// Name of custom property. /// Value of custom property. - internal IntegrationRuntimeDataFlowCustomItem(string name, string value) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeDataFlowCustomItem(string name, string value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of custom property. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.Serialization.cs index 30b7d78f7bc4..b86fd3dcbdc3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeDataFlowProperties : IUtf8JsonSerializable + public partial class IntegrationRuntimeDataFlowProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ComputeType)) { @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CustomProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -59,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static IntegrationRuntimeDataFlowProperties DeserializeIntegrationRuntimeDataFlowProperties(JsonElement element) + internal static IntegrationRuntimeDataFlowProperties DeserializeIntegrationRuntimeDataFlowProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -129,5 +144,53 @@ internal static IntegrationRuntimeDataFlowProperties DeserializeIntegrationRunti additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeDataFlowProperties(Optional.ToNullable(computeType), Optional.ToNullable(coreCount), Optional.ToNullable(timeToLive), Optional.ToNullable(cleanup), Optional.ToList(customProperties), additionalProperties); } + + IntegrationRuntimeDataFlowProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeDataFlowProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeDataFlowProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeDataFlowProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeDataFlowProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeDataFlowProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeDataFlowProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.cs index f3c8ae7f67fc..081239bdaef1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataFlowProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data flow properties for managed integration runtime. public partial class IntegrationRuntimeDataFlowProperties { - /// Initializes a new instance of IntegrationRuntimeDataFlowProperties. + /// Initializes a new instance of . public IntegrationRuntimeDataFlowProperties() { CustomProperties = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeDataFlowProperties. + /// Initializes a new instance of . /// Compute type of the cluster which will execute data flow job. /// Core count of the cluster which will execute data flow job. Supported values are: 8, 16, 32, 48, 80, 144 and 272. /// Time to live (in minutes) setting of the cluster which will execute data flow job. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.Serialization.cs index 089b93e0bbf6..3717aee01ccc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.Serialization.cs @@ -5,36 +5,72 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeDataProxyProperties : IUtf8JsonSerializable + public partial class IntegrationRuntimeDataProxyProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(StagingLinkedService)) { writer.WritePropertyName("stagingLinkedService"u8); - writer.WriteObjectValue(StagingLinkedService); + if (StagingLinkedService is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StagingLinkedService).Serialize(writer, options); + } } if (Optional.IsDefined(Path)) { writer.WritePropertyName("path"u8); writer.WriteStringValue(Path); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IntegrationRuntimeDataProxyProperties DeserializeIntegrationRuntimeDataProxyProperties(JsonElement element) + internal static IntegrationRuntimeDataProxyProperties DeserializeIntegrationRuntimeDataProxyProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +78,7 @@ internal static IntegrationRuntimeDataProxyProperties DeserializeIntegrationRunt Optional connectVia = default; Optional stagingLinkedService = default; Optional path = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectVia"u8)) @@ -67,8 +104,61 @@ internal static IntegrationRuntimeDataProxyProperties DeserializeIntegrationRunt path = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IntegrationRuntimeDataProxyProperties(connectVia.Value, stagingLinkedService.Value, path.Value, serializedAdditionalRawData); + } + + IntegrationRuntimeDataProxyProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeDataProxyProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeDataProxyProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeDataProxyProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeDataProxyProperties model) + { + if (model is null) + { + return null; } - return new IntegrationRuntimeDataProxyProperties(connectVia.Value, stagingLinkedService.Value, path.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeDataProxyProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeDataProxyProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.cs index 6b28fed99969..4a9d25dd7091 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeDataProxyProperties.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Data proxy properties for a managed dedicated integration runtime. public partial class IntegrationRuntimeDataProxyProperties { - /// Initializes a new instance of IntegrationRuntimeDataProxyProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IntegrationRuntimeDataProxyProperties() { } - /// Initializes a new instance of IntegrationRuntimeDataProxyProperties. + /// Initializes a new instance of . /// The self-hosted integration runtime reference. /// The staging linked service reference. /// The path to contain the staged data in the Blob storage. - internal IntegrationRuntimeDataProxyProperties(EntityReference connectVia, EntityReference stagingLinkedService, string path) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeDataProxyProperties(EntityReference connectVia, EntityReference stagingLinkedService, string path, Dictionary serializedAdditionalRawData) { ConnectVia = connectVia; StagingLinkedService = stagingLinkedService; Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The self-hosted integration runtime reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.Serialization.cs index cb603fb8fcb2..6e2925aec02d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeMonitoringData + public partial class IntegrationRuntimeMonitoringData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeMonitoringData DeserializeIntegrationRuntimeMonitoringData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Nodes)) + { + writer.WritePropertyName("nodes"u8); + writer.WriteStartArray(); + foreach (var item in Nodes) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeMonitoringData DeserializeIntegrationRuntimeMonitoringData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional> nodes = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -42,8 +92,61 @@ internal static IntegrationRuntimeMonitoringData DeserializeIntegrationRuntimeMo nodes = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeMonitoringData(name.Value, Optional.ToList(nodes)); + return new IntegrationRuntimeMonitoringData(name.Value, Optional.ToList(nodes), serializedAdditionalRawData); + } + + IntegrationRuntimeMonitoringData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeMonitoringData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeMonitoringData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeMonitoringData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeMonitoringData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeMonitoringData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeMonitoringData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.cs index ebb1cdc830bd..cf23ddf3287f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeMonitoringData.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Get monitoring data response. public partial class IntegrationRuntimeMonitoringData { - /// Initializes a new instance of IntegrationRuntimeMonitoringData. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeMonitoringData() { Nodes = new ChangeTrackingList(); } - /// Initializes a new instance of IntegrationRuntimeMonitoringData. + /// Initializes a new instance of . /// Integration runtime name. /// Integration runtime node monitoring data. - internal IntegrationRuntimeMonitoringData(string name, IReadOnlyList nodes) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeMonitoringData(string name, IReadOnlyList nodes, Dictionary serializedAdditionalRawData) { Name = name; Nodes = nodes; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Integration runtime name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.Serialization.cs index 3988cdc6bc3d..05cff791572e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.Serialization.cs @@ -5,21 +5,50 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Net; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeNodeIPAddress + public partial class IntegrationRuntimeNodeIPAddress : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeNodeIPAddress DeserializeIntegrationRuntimeNodeIPAddress(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeNodeIPAddress DeserializeIntegrationRuntimeNodeIPAddress(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional ipAddress = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("ipAddress"u8)) @@ -31,8 +60,61 @@ internal static IntegrationRuntimeNodeIPAddress DeserializeIntegrationRuntimeNod ipAddress = IPAddress.Parse(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeNodeIPAddress(ipAddress.Value); + return new IntegrationRuntimeNodeIPAddress(ipAddress.Value, serializedAdditionalRawData); + } + + IntegrationRuntimeNodeIPAddress IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeNodeIPAddress(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeNodeIPAddress IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeNodeIPAddress(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeNodeIPAddress model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeNodeIPAddress(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeNodeIPAddress(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.cs index 40eab945fef5..cc36975c82e6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeIPAddress.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Net; namespace Azure.ResourceManager.DataFactory.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.DataFactory.Models /// The IP address of self-hosted integration runtime node. public partial class IntegrationRuntimeNodeIPAddress { - /// Initializes a new instance of IntegrationRuntimeNodeIPAddress. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeNodeIPAddress() { } - /// Initializes a new instance of IntegrationRuntimeNodeIPAddress. + /// Initializes a new instance of . /// The IP address of self-hosted integration runtime node. - internal IntegrationRuntimeNodeIPAddress(IPAddress ipAddress) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeNodeIPAddress(IPAddress ipAddress, Dictionary serializedAdditionalRawData) { IPAddress = ipAddress; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The IP address of self-hosted integration runtime node. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.Serialization.cs index e01a9e916473..6a50abf521dd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeNodeMonitoringData + public partial class IntegrationRuntimeNodeMonitoringData : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeNodeMonitoringData DeserializeIntegrationRuntimeNodeMonitoringData(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeNodeMonitoringData DeserializeIntegrationRuntimeNodeMonitoringData(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -105,5 +128,53 @@ internal static IntegrationRuntimeNodeMonitoringData DeserializeIntegrationRunti additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeNodeMonitoringData(nodeName.Value, Optional.ToNullable(availableMemoryInMB), Optional.ToNullable(cpuUtilization), Optional.ToNullable(concurrentJobsLimit), Optional.ToNullable(concurrentJobsRunning), Optional.ToNullable(maxConcurrentJobs), Optional.ToNullable(sentBytes), Optional.ToNullable(receivedBytes), additionalProperties); } + + IntegrationRuntimeNodeMonitoringData IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeNodeMonitoringData(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeNodeMonitoringData IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeNodeMonitoringData(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeNodeMonitoringData model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeNodeMonitoringData(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeNodeMonitoringData(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.cs index e2c672fd46b2..a1b759a5a3da 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeNodeMonitoringData.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Monitoring data for integration runtime node. public partial class IntegrationRuntimeNodeMonitoringData { - /// Initializes a new instance of IntegrationRuntimeNodeMonitoringData. + /// Initializes a new instance of . internal IntegrationRuntimeNodeMonitoringData() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeNodeMonitoringData. + /// Initializes a new instance of . /// Name of the integration runtime node. /// Available memory (MB) on the integration runtime node. /// CPU percentage on the integration runtime node. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.Serialization.cs index de4497b7fdf1..8aeeed5f5920 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint + public partial class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint DeserializeIntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + } + if (Optional.IsCollectionDefined(Endpoints)) + { + writer.WritePropertyName("endpoints"u8); + writer.WriteStartArray(); + foreach (var item in Endpoints) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint DeserializeIntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional category = default; Optional> endpoints = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("category"u8)) @@ -42,8 +92,61 @@ internal static IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint De endpoints = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(category.Value, Optional.ToList(endpoints)); + return new IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(category.Value, Optional.ToList(endpoints), serializedAdditionalRawData); + } + + IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs index 1466d64cc5bb..6e8d58f61bd1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure-SSIS integration runtime outbound network dependency endpoints for one category. public partial class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint { - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint() { Endpoints = new ChangeTrackingList(); } - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint. + /// Initializes a new instance of . /// The category of outbound network dependency. /// The endpoints for outbound network dependency. - internal IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(string category, IReadOnlyList endpoints) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(string category, IReadOnlyList endpoints, Dictionary serializedAdditionalRawData) { Category = category; Endpoints = endpoints; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The category of outbound network dependency. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.Serialization.cs index 774cf01bbbeb..144c152d1cce 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.Serialization.cs @@ -5,22 +5,72 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpoint + public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpoint : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeOutboundNetworkDependenciesEndpoint DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpoint(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(DomainName)) + { + writer.WritePropertyName("domainName"u8); + writer.WriteStringValue(DomainName); + } + if (Optional.IsCollectionDefined(EndpointDetails)) + { + writer.WritePropertyName("endpointDetails"u8); + writer.WriteStartArray(); + foreach (var item in EndpointDetails) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeOutboundNetworkDependenciesEndpoint DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpoint(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional domainName = default; Optional> endpointDetails = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("domainName"u8)) @@ -42,8 +92,61 @@ internal static IntegrationRuntimeOutboundNetworkDependenciesEndpoint Deserializ endpointDetails = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeOutboundNetworkDependenciesEndpoint(domainName.Value, Optional.ToList(endpointDetails)); + return new IntegrationRuntimeOutboundNetworkDependenciesEndpoint(domainName.Value, Optional.ToList(endpointDetails), serializedAdditionalRawData); + } + + IntegrationRuntimeOutboundNetworkDependenciesEndpoint IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpoint(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeOutboundNetworkDependenciesEndpoint IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpoint(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeOutboundNetworkDependenciesEndpoint model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeOutboundNetworkDependenciesEndpoint(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpoint(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs index 18bd9229c7d7..202c00d01394 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpoint.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// The endpoint for Azure-SSIS integration runtime outbound network dependency. public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpoint { - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesEndpoint. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeOutboundNetworkDependenciesEndpoint() { EndpointDetails = new ChangeTrackingList(); } - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesEndpoint. + /// Initializes a new instance of . /// The domain name of endpoint. /// The details of endpoint. - internal IntegrationRuntimeOutboundNetworkDependenciesEndpoint(string domainName, IReadOnlyList endpointDetails) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeOutboundNetworkDependenciesEndpoint(string domainName, IReadOnlyList endpointDetails, Dictionary serializedAdditionalRawData) { DomainName = domainName; EndpointDetails = endpointDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The domain name of endpoint. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.Serialization.cs index 201e99391962..3896f67d4554 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.Serialization.cs @@ -5,20 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails + public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional port = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("port"u8)) @@ -30,8 +64,61 @@ internal static IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails Des port = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(Optional.ToNullable(port)); + return new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(Optional.ToNullable(port), serializedAdditionalRawData); + } + + IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs index c8a50a971b41..b3bde8c7e043 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The details of Azure-SSIS integration runtime outbound network dependency endpoint. public partial class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails { - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() { } - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails. + /// Initializes a new instance of . /// The port of endpoint. - internal IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(int? port) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(int? port, Dictionary serializedAdditionalRawData) { Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The port of endpoint. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.Serialization.cs index 27b7c3bb58c1..53a7d09d0e0a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.Serialization.cs @@ -5,21 +5,66 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class IntegrationRuntimeOutboundNetworkDependenciesResult + internal partial class IntegrationRuntimeOutboundNetworkDependenciesResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeOutboundNetworkDependenciesResult DeserializeIntegrationRuntimeOutboundNetworkDependenciesResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeOutboundNetworkDependenciesResult DeserializeIntegrationRuntimeOutboundNetworkDependenciesResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -36,8 +81,61 @@ internal static IntegrationRuntimeOutboundNetworkDependenciesResult DeserializeI value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeOutboundNetworkDependenciesResult(Optional.ToList(value)); + return new IntegrationRuntimeOutboundNetworkDependenciesResult(Optional.ToList(value), serializedAdditionalRawData); + } + + IntegrationRuntimeOutboundNetworkDependenciesResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeOutboundNetworkDependenciesResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeOutboundNetworkDependenciesResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeOutboundNetworkDependenciesResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeOutboundNetworkDependenciesResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.cs index f79b937a4307..49d755b09d4f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeOutboundNetworkDependenciesResult.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.DataFactory.Models /// Azure-SSIS integration runtime outbound network dependency endpoints. internal partial class IntegrationRuntimeOutboundNetworkDependenciesResult { - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal IntegrationRuntimeOutboundNetworkDependenciesResult() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of IntegrationRuntimeOutboundNetworkDependenciesResult. + /// Initializes a new instance of . /// The list of outbound network dependency endpoints. - internal IntegrationRuntimeOutboundNetworkDependenciesResult(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeOutboundNetworkDependenciesResult(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of outbound network dependency endpoints. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.Serialization.cs index cad14ccbabf1..ef913859c006 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeReference : IUtf8JsonSerializable + public partial class IntegrationRuntimeReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); @@ -41,11 +47,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static IntegrationRuntimeReference DeserializeIntegrationRuntimeReference(JsonElement element) + internal static IntegrationRuntimeReference DeserializeIntegrationRuntimeReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -53,6 +73,7 @@ internal static IntegrationRuntimeReference DeserializeIntegrationRuntimeReferen IntegrationRuntimeReferenceType type = default; string referenceName = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -86,8 +107,61 @@ internal static IntegrationRuntimeReference DeserializeIntegrationRuntimeReferen parameters = dictionary; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new IntegrationRuntimeReference(type, referenceName, Optional.ToDictionary(parameters)); + return new IntegrationRuntimeReference(type, referenceName, Optional.ToDictionary(parameters), serializedAdditionalRawData); + } + + IntegrationRuntimeReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.cs index 28600ee0f06a..4aa0d5306a43 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeReference.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Integration runtime reference type. public partial class IntegrationRuntimeReference { - /// Initializes a new instance of IntegrationRuntimeReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of integration runtime. /// Reference integration runtime name. /// is null. @@ -27,15 +30,22 @@ public IntegrationRuntimeReference(IntegrationRuntimeReferenceType referenceType Parameters = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeReference. + /// Initializes a new instance of . /// Type of integration runtime. /// Reference integration runtime name. /// Arguments for integration runtime. - internal IntegrationRuntimeReference(IntegrationRuntimeReferenceType referenceType, string referenceName, IDictionary parameters) + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeReference(IntegrationRuntimeReferenceType referenceType, string referenceName, IDictionary parameters, Dictionary serializedAdditionalRawData) { ReferenceType = referenceType; ReferenceName = referenceName; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IntegrationRuntimeReference() + { } /// Type of integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.Serialization.cs index fa4dc7582180..94bb2135ce44 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.Serialization.cs @@ -5,22 +5,120 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeRegenerateKeyContent : IUtf8JsonSerializable + public partial class IntegrationRuntimeRegenerateKeyContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(KeyName)) { writer.WritePropertyName("keyName"u8); writer.WriteStringValue(KeyName.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static IntegrationRuntimeRegenerateKeyContent DeserializeIntegrationRuntimeRegenerateKeyContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional keyName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyName = new IntegrationRuntimeAuthKeyName(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new IntegrationRuntimeRegenerateKeyContent(Optional.ToNullable(keyName), serializedAdditionalRawData); + } + + IntegrationRuntimeRegenerateKeyContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeRegenerateKeyContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeRegenerateKeyContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeRegenerateKeyContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeRegenerateKeyContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeRegenerateKeyContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeRegenerateKeyContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.cs index ecdbe74f1fb3..9e77b0a59a1a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeRegenerateKeyContent.cs @@ -5,16 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Parameters to regenerate the authentication key. public partial class IntegrationRuntimeRegenerateKeyContent { - /// Initializes a new instance of IntegrationRuntimeRegenerateKeyContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public IntegrationRuntimeRegenerateKeyContent() { } + /// Initializes a new instance of . + /// The name of the authentication key to regenerate. + /// Keeps track of any properties unknown to the library. + internal IntegrationRuntimeRegenerateKeyContent(IntegrationRuntimeAuthKeyName? keyName, Dictionary serializedAdditionalRawData) + { + KeyName = keyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + /// The name of the authentication key to regenerate. public IntegrationRuntimeAuthKeyName? KeyName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.Serialization.cs index a07c19a0b0cf..3a117b4b15f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeSsisCatalogInfo : IUtf8JsonSerializable + public partial class IntegrationRuntimeSsisCatalogInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CatalogServerEndpoint)) { @@ -55,8 +61,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static IntegrationRuntimeSsisCatalogInfo DeserializeIntegrationRuntimeSsisCatalogInfo(JsonElement element) + internal static IntegrationRuntimeSsisCatalogInfo DeserializeIntegrationRuntimeSsisCatalogInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -108,5 +116,53 @@ internal static IntegrationRuntimeSsisCatalogInfo DeserializeIntegrationRuntimeS additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeSsisCatalogInfo(catalogServerEndpoint.Value, catalogAdminUserName.Value, catalogAdminPassword, Optional.ToNullable(catalogPricingTier), dualStandbyPairName.Value, additionalProperties); } + + IntegrationRuntimeSsisCatalogInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeSsisCatalogInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeSsisCatalogInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeSsisCatalogInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeSsisCatalogInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeSsisCatalogInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeSsisCatalogInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.cs index 4bd21ee2791f..caa526a4b879 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisCatalogInfo.cs @@ -15,13 +15,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Catalog information for managed dedicated integration runtime. public partial class IntegrationRuntimeSsisCatalogInfo { - /// Initializes a new instance of IntegrationRuntimeSsisCatalogInfo. + /// Initializes a new instance of . public IntegrationRuntimeSsisCatalogInfo() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeSsisCatalogInfo. + /// Initializes a new instance of . /// The catalog database server URL. /// The administrator user name of catalog database. /// The password of the administrator user account of the catalog database. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.Serialization.cs index dde0b5938990..7eb8f2fd463a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeSsisProperties : IUtf8JsonSerializable + public partial class IntegrationRuntimeSsisProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CatalogInfo)) { writer.WritePropertyName("catalogInfo"u8); - writer.WriteObjectValue(CatalogInfo); + if (CatalogInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CatalogInfo).Serialize(writer, options); + } } if (Optional.IsDefined(LicenseType)) { @@ -30,12 +43,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CustomSetupScriptProperties)) { writer.WritePropertyName("customSetupScriptProperties"u8); - writer.WriteObjectValue(CustomSetupScriptProperties); + if (CustomSetupScriptProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomSetupScriptProperties).Serialize(writer, options); + } } if (Optional.IsDefined(DataProxyProperties)) { writer.WritePropertyName("dataProxyProperties"u8); - writer.WriteObjectValue(DataProxyProperties); + if (DataProxyProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataProxyProperties).Serialize(writer, options); + } } if (Optional.IsDefined(Edition)) { @@ -48,7 +75,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExpressCustomSetupProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -58,14 +92,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PackageStores) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -79,8 +127,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static IntegrationRuntimeSsisProperties DeserializeIntegrationRuntimeSsisProperties(JsonElement element) + internal static IntegrationRuntimeSsisProperties DeserializeIntegrationRuntimeSsisProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -184,5 +234,53 @@ internal static IntegrationRuntimeSsisProperties DeserializeIntegrationRuntimeSs additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeSsisProperties(catalogInfo.Value, Optional.ToNullable(licenseType), customSetupScriptProperties.Value, dataProxyProperties.Value, Optional.ToNullable(edition), Optional.ToList(expressCustomSetupProperties), Optional.ToList(packageStores), credential.Value, additionalProperties); } + + IntegrationRuntimeSsisProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeSsisProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeSsisProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeSsisProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeSsisProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeSsisProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeSsisProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs index acbb3b134ad7..0da1aa3c3cea 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// SSIS properties for managed integration runtime. public partial class IntegrationRuntimeSsisProperties { - /// Initializes a new instance of IntegrationRuntimeSsisProperties. + /// Initializes a new instance of . public IntegrationRuntimeSsisProperties() { ExpressCustomSetupProperties = new ChangeTrackingList(); @@ -22,7 +22,7 @@ public IntegrationRuntimeSsisProperties() AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeSsisProperties. + /// Initializes a new instance of . /// Catalog information for managed dedicated integration runtime. /// License type for bringing your own license scenario. /// Custom setup script properties for a managed dedicated integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.Serialization.cs index 25fba8069c7f..8c98e34ec2a7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.Serialization.cs @@ -5,14 +5,42 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeStatus + public partial class IntegrationRuntimeStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static IntegrationRuntimeStatus DeserializeIntegrationRuntimeStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RuntimeType.ToString()); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static IntegrationRuntimeStatus DeserializeIntegrationRuntimeStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -25,7 +53,86 @@ internal static IntegrationRuntimeStatus DeserializeIntegrationRuntimeStatus(Jso case "SelfHosted": return SelfHostedIntegrationRuntimeStatus.DeserializeSelfHostedIntegrationRuntimeStatus(element); } } - return UnknownIntegrationRuntimeStatus.DeserializeUnknownIntegrationRuntimeStatus(element); + + // Unknown type found so we will deserialize the base properties only + IntegrationRuntimeType type = default; + Optional dataFactoryName = default; + Optional state = default; + IReadOnlyDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new IntegrationRuntimeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataFactoryName"u8)) + { + dataFactoryName = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new IntegrationRuntimeState(property.Value.GetString()); + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownIntegrationRuntimeStatus(type, dataFactoryName.Value, Optional.ToNullable(state), additionalProperties); + } + + IntegrationRuntimeStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.cs index 3e272bbcba78..f6fa800ce142 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeStatus.cs @@ -18,13 +18,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class IntegrationRuntimeStatus { - /// Initializes a new instance of IntegrationRuntimeStatus. + /// Initializes a new instance of . internal IntegrationRuntimeStatus() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeStatus. + /// Initializes a new instance of . /// Type of integration runtime. /// The data factory name which the integration runtime belong to. /// The state of integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.Serialization.cs index abdc0e97cdc7..4b8a1c5681bc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class IntegrationRuntimeVnetProperties : IUtf8JsonSerializable + public partial class IntegrationRuntimeVnetProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(VnetId)) { @@ -54,8 +60,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static IntegrationRuntimeVnetProperties DeserializeIntegrationRuntimeVnetProperties(JsonElement element) + internal static IntegrationRuntimeVnetProperties DeserializeIntegrationRuntimeVnetProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -110,5 +118,53 @@ internal static IntegrationRuntimeVnetProperties DeserializeIntegrationRuntimeVn additionalProperties = additionalPropertiesDictionary; return new IntegrationRuntimeVnetProperties(Optional.ToNullable(vnetId), subnet.Value, Optional.ToList(publicIPs), subnetId.Value, additionalProperties); } + + IntegrationRuntimeVnetProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeIntegrationRuntimeVnetProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + IntegrationRuntimeVnetProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeIntegrationRuntimeVnetProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(IntegrationRuntimeVnetProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator IntegrationRuntimeVnetProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeIntegrationRuntimeVnetProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.cs index a6b6b6b04301..4d9f362d53e3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/IntegrationRuntimeVnetProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// VNet properties for managed integration runtime. public partial class IntegrationRuntimeVnetProperties { - /// Initializes a new instance of IntegrationRuntimeVnetProperties. + /// Initializes a new instance of . public IntegrationRuntimeVnetProperties() { PublicIPs = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of IntegrationRuntimeVnetProperties. + /// Initializes a new instance of . /// The ID of the VNet that this integration runtime will join. /// The name of the subnet this integration runtime will join. /// Resource IDs of the public IP addresses that this integration runtime will use. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.Serialization.cs index 2c324d06cfe2..9e2c58240d7b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JiraLinkedService : IUtf8JsonSerializable + public partial class JiraLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -109,8 +129,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JiraLinkedService DeserializeJiraLinkedService(JsonElement element) + internal static JiraLinkedService DeserializeJiraLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -263,5 +285,53 @@ internal static JiraLinkedService DeserializeJiraLinkedService(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new JiraLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, port.Value, username, password, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + JiraLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJiraLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JiraLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJiraLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JiraLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JiraLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJiraLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.cs index 8d78d81c335a..5bf1a2938812 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Jira Service linked service. public partial class JiraLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of JiraLinkedService. + /// Initializes a new instance of . /// The IP address or host name of the Jira service. (e.g. jira.example.com). /// The user name that you use to access Jira Service. /// or is null. @@ -29,7 +29,7 @@ public JiraLinkedService(DataFactoryElement host, DataFactoryElement Initializes a new instance of JiraLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -57,6 +57,11 @@ internal JiraLinkedService(string linkedServiceType, IntegrationRuntimeReference LinkedServiceType = linkedServiceType ?? "Jira"; } + /// Initializes a new instance of for deserialization. + internal JiraLinkedService() + { + } + /// The IP address or host name of the Jira service. (e.g. jira.example.com). public DataFactoryElement Host { get; set; } /// The TCP port that the Jira server uses to listen for client connections. The default value is 443 if connecting through HTTPS, or 8080 if connecting through HTTP. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.Serialization.cs index d7b20e8fdebf..d72cb7e8dbd7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JiraObjectDataset : IUtf8JsonSerializable + public partial class JiraObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JiraObjectDataset DeserializeJiraObjectDataset(JsonElement element) + internal static JiraObjectDataset DeserializeJiraObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static JiraObjectDataset DeserializeJiraObjectDataset(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new JiraObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + JiraObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJiraObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JiraObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJiraObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JiraObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JiraObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJiraObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.cs index 59770af35f1f..fb068bb6da8c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Jira Service dataset. public partial class JiraObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of JiraObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public JiraObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public JiraObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "JiraObject"; } - /// Initializes a new instance of JiraObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal JiraObjectDataset(string datasetType, string description, DataFactoryEl DatasetType = datasetType ?? "JiraObject"; } + /// Initializes a new instance of for deserialization. + internal JiraObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.Serialization.cs index 0f797336710a..20de41c76ede 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JiraSource : IUtf8JsonSerializable + public partial class JiraSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JiraSource DeserializeJiraSource(JsonElement element) + internal static JiraSource DeserializeJiraSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static JiraSource DeserializeJiraSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new JiraSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + JiraSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJiraSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JiraSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJiraSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JiraSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JiraSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJiraSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.cs index 690a83f46d77..ba1f5eb05448 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JiraSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Jira Service source. public partial class JiraSource : TabularSource { - /// Initializes a new instance of JiraSource. + /// Initializes a new instance of . public JiraSource() { CopySourceType = "JiraSource"; } - /// Initializes a new instance of JiraSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.Serialization.cs index 0d7af27b8ca9..cde304e5d42b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JsonDataset : IUtf8JsonSerializable + public partial class JsonDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,14 +82,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(EncodingName)) { @@ -86,7 +113,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Compression)) { writer.WritePropertyName("compression"u8); - writer.WriteObjectValue(Compression); + if (Compression is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Compression).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -101,8 +135,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JsonDataset DeserializeJsonDataset(JsonElement element) + internal static JsonDataset DeserializeJsonDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -243,5 +279,53 @@ internal static JsonDataset DeserializeJsonDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new JsonDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, encodingName.Value, compression.Value); } + + JsonDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.cs index 3c3f1e4eae23..52ecd07041b2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Json dataset. public partial class JsonDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of JsonDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public JsonDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public JsonDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(l DatasetType = "Json"; } - /// Initializes a new instance of JsonDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -50,6 +50,11 @@ internal JsonDataset(string datasetType, string description, DataFactoryElement< DatasetType = datasetType ?? "Json"; } + /// Initializes a new instance of for deserialization. + internal JsonDataset() + { + } + /// /// The location of the json data storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.Serialization.cs index d86824a944e5..d2dd832eca89 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JsonReadSettings : IUtf8JsonSerializable + public partial class JsonReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(CompressionProperties)) { writer.WritePropertyName("compressionProperties"u8); - writer.WriteObjectValue(CompressionProperties); + if (CompressionProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CompressionProperties).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(FormatReadSettingsType); @@ -36,8 +49,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JsonReadSettings DeserializeJsonReadSettings(JsonElement element) + internal static JsonReadSettings DeserializeJsonReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -67,5 +82,53 @@ internal static JsonReadSettings DeserializeJsonReadSettings(JsonElement element additionalProperties = additionalPropertiesDictionary; return new JsonReadSettings(type, additionalProperties, compressionProperties.Value); } + + JsonReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.cs index ca6e7d1094ea..b43ae2656261 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonReadSettings.cs @@ -13,13 +13,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Json read settings. public partial class JsonReadSettings : FormatReadSettings { - /// Initializes a new instance of JsonReadSettings. + /// Initializes a new instance of . public JsonReadSettings() { FormatReadSettingsType = "JsonReadSettings"; } - /// Initializes a new instance of JsonReadSettings. + /// Initializes a new instance of . /// The read setting type. /// Additional Properties. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.Serialization.cs index bff1c353c904..8a60bba63ad4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JsonSink : IUtf8JsonSerializable + public partial class JsonSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -72,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JsonSink DeserializeJsonSink(JsonElement element) + internal static JsonSink DeserializeJsonSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +195,53 @@ internal static JsonSink DeserializeJsonSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new JsonSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value); } + + JsonSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.cs index 7209bbd43381..31051d996a6b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Json sink. public partial class JsonSink : CopySink { - /// Initializes a new instance of JsonSink. + /// Initializes a new instance of . public JsonSink() { CopySinkType = "JsonSink"; } - /// Initializes a new instance of JsonSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.Serialization.cs index 5b5671bd60c8..e402297d399e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JsonSource : IUtf8JsonSerializable + public partial class JsonSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -71,8 +91,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JsonSource DeserializeJsonSource(JsonElement element) + internal static JsonSource DeserializeJsonSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +184,53 @@ internal static JsonSource DeserializeJsonSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new JsonSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value, additionalColumns.Value); } + + JsonSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.cs index b07d526f2821..e61ca8d1863c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Json source. public partial class JsonSource : CopyActivitySource { - /// Initializes a new instance of JsonSource. + /// Initializes a new instance of . public JsonSource() { CopySourceType = "JsonSource"; } - /// Initializes a new instance of JsonSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.Serialization.cs index fe2ec6fbb88f..cf232f5c4288 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class JsonWriteSettings : IUtf8JsonSerializable + public partial class JsonWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(FilePattern)) { @@ -40,8 +46,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static JsonWriteSettings DeserializeJsonWriteSettings(JsonElement element) + internal static JsonWriteSettings DeserializeJsonWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -71,5 +79,53 @@ internal static JsonWriteSettings DeserializeJsonWriteSettings(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new JsonWriteSettings(type, additionalProperties, filePattern.Value); } + + JsonWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeJsonWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + JsonWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeJsonWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(JsonWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator JsonWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeJsonWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.cs index e70bf025d646..05c95da4b3c8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/JsonWriteSettings.cs @@ -13,13 +13,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Json write settings. public partial class JsonWriteSettings : FormatWriteSettings { - /// Initializes a new instance of JsonWriteSettings. + /// Initializes a new instance of . public JsonWriteSettings() { FormatWriteSettingsType = "JsonWriteSettings"; } - /// Initializes a new instance of JsonWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// Additional Properties. /// File pattern of JSON. This setting controls the way a collection of JSON objects will be treated. The default value is 'setOfObjects'. It is case-sensitive. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.Serialization.cs index 2f9733cddbf5..5b134792a5bc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.Serialization.cs @@ -6,15 +6,42 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LinkedIntegrationRuntime + public partial class LinkedIntegrationRuntime : IUtf8JsonSerializable, IModelJsonSerializable { - internal static LinkedIntegrationRuntime DeserializeLinkedIntegrationRuntime(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static LinkedIntegrationRuntime DeserializeLinkedIntegrationRuntime(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -24,6 +51,7 @@ internal static LinkedIntegrationRuntime DeserializeLinkedIntegrationRuntime(Jso Optional dataFactoryName = default; Optional dataFactoryLocation = default; Optional createTime = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -59,8 +87,61 @@ internal static LinkedIntegrationRuntime DeserializeLinkedIntegrationRuntime(Jso createTime = property.Value.GetDateTimeOffset("O"); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new LinkedIntegrationRuntime(name.Value, subscriptionId.Value, dataFactoryName.Value, Optional.ToNullable(dataFactoryLocation), Optional.ToNullable(createTime)); + return new LinkedIntegrationRuntime(name.Value, subscriptionId.Value, dataFactoryName.Value, Optional.ToNullable(dataFactoryLocation), Optional.ToNullable(createTime), serializedAdditionalRawData); + } + + LinkedIntegrationRuntime IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedIntegrationRuntime(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedIntegrationRuntime IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedIntegrationRuntime(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedIntegrationRuntime model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedIntegrationRuntime(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedIntegrationRuntime(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.cs index e14746ec0741..ca6530aa5fb4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntime.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,24 +14,29 @@ namespace Azure.ResourceManager.DataFactory.Models /// The linked integration runtime information. public partial class LinkedIntegrationRuntime { - /// Initializes a new instance of LinkedIntegrationRuntime. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . internal LinkedIntegrationRuntime() { } - /// Initializes a new instance of LinkedIntegrationRuntime. + /// Initializes a new instance of . /// The name of the linked integration runtime. /// The subscription ID for which the linked integration runtime belong to. /// The name of the data factory for which the linked integration runtime belong to. /// The location of the data factory for which the linked integration runtime belong to. /// The creating time of the linked integration runtime. - internal LinkedIntegrationRuntime(string name, string subscriptionId, string dataFactoryName, AzureLocation? dataFactoryLocation, DateTimeOffset? createdOn) + /// Keeps track of any properties unknown to the library. + internal LinkedIntegrationRuntime(string name, string subscriptionId, string dataFactoryName, AzureLocation? dataFactoryLocation, DateTimeOffset? createdOn, Dictionary serializedAdditionalRawData) { Name = name; SubscriptionId = subscriptionId; DataFactoryName = dataFactoryName; DataFactoryLocation = dataFactoryLocation; CreatedOn = createdOn; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the linked integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.Serialization.cs index 813b554e8225..660c952f3cdd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.Serialization.cs @@ -5,19 +5,113 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LinkedIntegrationRuntimeContent : IUtf8JsonSerializable + public partial class LinkedIntegrationRuntimeContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("factoryName"u8); writer.WriteStringValue(LinkedFactoryName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static LinkedIntegrationRuntimeContent DeserializeLinkedIntegrationRuntimeContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string factoryName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("factoryName"u8)) + { + factoryName = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinkedIntegrationRuntimeContent(factoryName, serializedAdditionalRawData); + } + + LinkedIntegrationRuntimeContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedIntegrationRuntimeContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedIntegrationRuntimeContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedIntegrationRuntimeContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedIntegrationRuntimeContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedIntegrationRuntimeContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedIntegrationRuntimeContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.cs index c94a69fb6ee1..ce15a54bf5f8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeContent.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Data factory name for linked integration runtime request. public partial class LinkedIntegrationRuntimeContent { - /// Initializes a new instance of LinkedIntegrationRuntimeContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The data factory name for linked integration runtime. /// is null. public LinkedIntegrationRuntimeContent(string linkedFactoryName) @@ -23,6 +27,20 @@ public LinkedIntegrationRuntimeContent(string linkedFactoryName) LinkedFactoryName = linkedFactoryName; } + /// Initializes a new instance of . + /// The data factory name for linked integration runtime. + /// Keeps track of any properties unknown to the library. + internal LinkedIntegrationRuntimeContent(string linkedFactoryName, Dictionary serializedAdditionalRawData) + { + LinkedFactoryName = linkedFactoryName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LinkedIntegrationRuntimeContent() + { + } + /// The data factory name for linked integration runtime. public string LinkedFactoryName { get; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.Serialization.cs index 252e44812517..db3089b722c2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LinkedIntegrationRuntimeKeyAuthorization : IUtf8JsonSerializable + public partial class LinkedIntegrationRuntimeKeyAuthorization : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("key"u8); JsonSerializer.Serialize(writer, Key); writer.WritePropertyName("authorizationType"u8); writer.WriteStringValue(AuthorizationType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinkedIntegrationRuntimeKeyAuthorization DeserializeLinkedIntegrationRuntimeKeyAuthorization(JsonElement element) + internal static LinkedIntegrationRuntimeKeyAuthorization DeserializeLinkedIntegrationRuntimeKeyAuthorization(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactorySecretString key = default; string authorizationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -42,8 +65,61 @@ internal static LinkedIntegrationRuntimeKeyAuthorization DeserializeLinkedIntegr authorizationType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinkedIntegrationRuntimeKeyAuthorization(authorizationType, key, serializedAdditionalRawData); + } + + LinkedIntegrationRuntimeKeyAuthorization IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedIntegrationRuntimeKeyAuthorization(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedIntegrationRuntimeKeyAuthorization IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedIntegrationRuntimeKeyAuthorization(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedIntegrationRuntimeKeyAuthorization model) + { + if (model is null) + { + return null; } - return new LinkedIntegrationRuntimeKeyAuthorization(authorizationType, key); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedIntegrationRuntimeKeyAuthorization(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedIntegrationRuntimeKeyAuthorization(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.cs index 106b30a4026c..0300857a72ad 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeKeyAuthorization.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The key authorization type integration runtime. public partial class LinkedIntegrationRuntimeKeyAuthorization : LinkedIntegrationRuntimeType { - /// Initializes a new instance of LinkedIntegrationRuntimeKeyAuthorization. + /// Initializes a new instance of . /// The key used for authorization. /// is null. public LinkedIntegrationRuntimeKeyAuthorization(DataFactorySecretString key) @@ -25,15 +26,21 @@ public LinkedIntegrationRuntimeKeyAuthorization(DataFactorySecretString key) AuthorizationType = "Key"; } - /// Initializes a new instance of LinkedIntegrationRuntimeKeyAuthorization. + /// Initializes a new instance of . /// The authorization type for integration runtime sharing. /// The key used for authorization. - internal LinkedIntegrationRuntimeKeyAuthorization(string authorizationType, DataFactorySecretString key) : base(authorizationType) + /// Keeps track of any properties unknown to the library. + internal LinkedIntegrationRuntimeKeyAuthorization(string authorizationType, DataFactorySecretString key, Dictionary serializedAdditionalRawData) : base(authorizationType, serializedAdditionalRawData) { Key = key; AuthorizationType = authorizationType ?? "Key"; } + /// Initializes a new instance of for deserialization. + internal LinkedIntegrationRuntimeKeyAuthorization() + { + } + /// The key used for authorization. public DataFactorySecretString Key { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.Serialization.cs index 8a47c25c9c1b..5bbfdad4d493 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.Serialization.cs @@ -5,30 +5,59 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LinkedIntegrationRuntimeRbacAuthorization : IUtf8JsonSerializable + public partial class LinkedIntegrationRuntimeRbacAuthorization : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } writer.WritePropertyName("authorizationType"u8); writer.WriteStringValue(AuthorizationType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinkedIntegrationRuntimeRbacAuthorization DeserializeLinkedIntegrationRuntimeRbacAuthorization(JsonElement element) + internal static LinkedIntegrationRuntimeRbacAuthorization DeserializeLinkedIntegrationRuntimeRbacAuthorization(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +65,7 @@ internal static LinkedIntegrationRuntimeRbacAuthorization DeserializeLinkedInteg ResourceIdentifier resourceId = default; Optional credential = default; string authorizationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) @@ -57,8 +87,61 @@ internal static LinkedIntegrationRuntimeRbacAuthorization DeserializeLinkedInteg authorizationType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LinkedIntegrationRuntimeRbacAuthorization(authorizationType, resourceId, credential.Value, serializedAdditionalRawData); + } + + LinkedIntegrationRuntimeRbacAuthorization IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedIntegrationRuntimeRbacAuthorization(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedIntegrationRuntimeRbacAuthorization IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedIntegrationRuntimeRbacAuthorization(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedIntegrationRuntimeRbacAuthorization model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedIntegrationRuntimeRbacAuthorization(Response response) + { + if (response is null) + { + return null; } - return new LinkedIntegrationRuntimeRbacAuthorization(authorizationType, resourceId, credential.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedIntegrationRuntimeRbacAuthorization(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.cs index 835ddbf9b0c8..4d6a1d047a39 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeRbacAuthorization.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The role based access control (RBAC) authorization type integration runtime. public partial class LinkedIntegrationRuntimeRbacAuthorization : LinkedIntegrationRuntimeType { - /// Initializes a new instance of LinkedIntegrationRuntimeRbacAuthorization. + /// Initializes a new instance of . /// The resource identifier of the integration runtime to be shared. /// is null. public LinkedIntegrationRuntimeRbacAuthorization(ResourceIdentifier resourceId) @@ -24,17 +25,23 @@ public LinkedIntegrationRuntimeRbacAuthorization(ResourceIdentifier resourceId) AuthorizationType = "RBAC"; } - /// Initializes a new instance of LinkedIntegrationRuntimeRbacAuthorization. + /// Initializes a new instance of . /// The authorization type for integration runtime sharing. /// The resource identifier of the integration runtime to be shared. /// The credential reference containing authentication information. - internal LinkedIntegrationRuntimeRbacAuthorization(string authorizationType, ResourceIdentifier resourceId, DataFactoryCredentialReference credential) : base(authorizationType) + /// Keeps track of any properties unknown to the library. + internal LinkedIntegrationRuntimeRbacAuthorization(string authorizationType, ResourceIdentifier resourceId, DataFactoryCredentialReference credential, Dictionary serializedAdditionalRawData) : base(authorizationType, serializedAdditionalRawData) { ResourceId = resourceId; Credential = credential; AuthorizationType = authorizationType ?? "RBAC"; } + /// Initializes a new instance of for deserialization. + internal LinkedIntegrationRuntimeRbacAuthorization() + { + } + /// The resource identifier of the integration runtime to be shared. public ResourceIdentifier ResourceId { get; set; } /// The credential reference containing authentication information. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.Serialization.cs index a08d4e2637cf..f1893469992e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.Serialization.cs @@ -5,23 +5,45 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LinkedIntegrationRuntimeType : IUtf8JsonSerializable + public partial class LinkedIntegrationRuntimeType : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("authorizationType"u8); writer.WriteStringValue(AuthorizationType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LinkedIntegrationRuntimeType DeserializeLinkedIntegrationRuntimeType(JsonElement element) + internal static LinkedIntegrationRuntimeType DeserializeLinkedIntegrationRuntimeType(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -34,7 +56,72 @@ internal static LinkedIntegrationRuntimeType DeserializeLinkedIntegrationRuntime case "RBAC": return LinkedIntegrationRuntimeRbacAuthorization.DeserializeLinkedIntegrationRuntimeRbacAuthorization(element); } } - return UnknownLinkedIntegrationRuntimeType.DeserializeUnknownLinkedIntegrationRuntimeType(element); + + // Unknown type found so we will deserialize the base properties only + string authorizationType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authorizationType"u8)) + { + authorizationType = property.Value.GetString(); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new UnknownLinkedIntegrationRuntimeType(authorizationType, serializedAdditionalRawData); + } + + LinkedIntegrationRuntimeType IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedIntegrationRuntimeType(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LinkedIntegrationRuntimeType IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLinkedIntegrationRuntimeType(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LinkedIntegrationRuntimeType model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LinkedIntegrationRuntimeType(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLinkedIntegrationRuntimeType(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.cs index ce31fb791701..00024caab4dd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LinkedIntegrationRuntimeType.cs @@ -5,6 +5,10 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core.Serialization; + namespace Azure.ResourceManager.DataFactory.Models { /// @@ -12,18 +16,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + [DeserializationProxy(typeof(UnknownLinkedIntegrationRuntimeType))] public abstract partial class LinkedIntegrationRuntimeType { - /// Initializes a new instance of LinkedIntegrationRuntimeType. + /// Keeps track of any properties unknown to the library. + protected internal Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . protected LinkedIntegrationRuntimeType() { } - /// Initializes a new instance of LinkedIntegrationRuntimeType. + /// Initializes a new instance of . /// The authorization type for integration runtime sharing. - internal LinkedIntegrationRuntimeType(string authorizationType) + /// Keeps track of any properties unknown to the library. + internal LinkedIntegrationRuntimeType(string authorizationType, Dictionary serializedAdditionalRawData) { AuthorizationType = authorizationType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The authorization type for integration runtime sharing. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.Serialization.cs index 78ad2532ca54..bbbbee21d146 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LogLocationSettings : IUtf8JsonSerializable + public partial class LogLocationSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("linkedServiceName"u8); JsonSerializer.Serialize(writer, LinkedServiceName); if (Optional.IsDefined(Path)) @@ -22,17 +30,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("path"u8); JsonSerializer.Serialize(writer, Path); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static LogLocationSettings DeserializeLogLocationSettings(JsonElement element) + internal static LogLocationSettings DeserializeLogLocationSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactoryLinkedServiceReference linkedServiceName = default; Optional> path = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("linkedServiceName"u8)) @@ -49,8 +72,61 @@ internal static LogLocationSettings DeserializeLogLocationSettings(JsonElement e path = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new LogLocationSettings(linkedServiceName, path.Value, serializedAdditionalRawData); + } + + LogLocationSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLogLocationSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LogLocationSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLogLocationSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LogLocationSettings model) + { + if (model is null) + { + return null; } - return new LogLocationSettings(linkedServiceName, path.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LogLocationSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLogLocationSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.cs index b0a1257fa0bd..6dc378c35621 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogLocationSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Log location settings. public partial class LogLocationSettings { - /// Initializes a new instance of LogLocationSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Log storage linked service reference. /// is null. public LogLocationSettings(DataFactoryLinkedServiceReference linkedServiceName) @@ -24,13 +28,20 @@ public LogLocationSettings(DataFactoryLinkedServiceReference linkedServiceName) LinkedServiceName = linkedServiceName; } - /// Initializes a new instance of LogLocationSettings. + /// Initializes a new instance of . /// Log storage linked service reference. /// The path to storage for storing detailed logs of activity execution. Type: string (or Expression with resultType string). - internal LogLocationSettings(DataFactoryLinkedServiceReference linkedServiceName, DataFactoryElement path) + /// Keeps track of any properties unknown to the library. + internal LogLocationSettings(DataFactoryLinkedServiceReference linkedServiceName, DataFactoryElement path, Dictionary serializedAdditionalRawData) { LinkedServiceName = linkedServiceName; Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LogLocationSettings() + { } /// Log storage linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.Serialization.cs index 07777d77402d..77fe4ca675bb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LogStorageSettings : IUtf8JsonSerializable + public partial class LogStorageSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("linkedServiceName"u8); JsonSerializer.Serialize(writer, LinkedServiceName); if (Optional.IsDefined(Path)) @@ -46,8 +52,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static LogStorageSettings DeserializeLogStorageSettings(JsonElement element) + internal static LogStorageSettings DeserializeLogStorageSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -97,5 +105,53 @@ internal static LogStorageSettings DeserializeLogStorageSettings(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new LogStorageSettings(linkedServiceName, path.Value, logLevel.Value, enableReliableLogging.Value, additionalProperties); } + + LogStorageSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLogStorageSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LogStorageSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLogStorageSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LogStorageSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LogStorageSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLogStorageSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.cs index d52c03d2f7c0..f2081e40fdda 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LogStorageSettings.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// (Deprecated. Please use LogSettings) Log storage settings. public partial class LogStorageSettings { - /// Initializes a new instance of LogStorageSettings. + /// Initializes a new instance of . /// Log storage linked service reference. /// is null. public LogStorageSettings(DataFactoryLinkedServiceReference linkedServiceName) @@ -26,7 +26,7 @@ public LogStorageSettings(DataFactoryLinkedServiceReference linkedServiceName) AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of LogStorageSettings. + /// Initializes a new instance of . /// Log storage linked service reference. /// The path to storage for storing detailed logs of activity execution. Type: string (or Expression with resultType string). /// Gets or sets the log level, support: Info, Warning. Type: string (or Expression with resultType string). @@ -41,6 +41,11 @@ internal LogStorageSettings(DataFactoryLinkedServiceReference linkedServiceName, AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal LogStorageSettings() + { + } + /// Log storage linked service reference. public DataFactoryLinkedServiceReference LinkedServiceName { get; set; } /// The path to storage for storing detailed logs of activity execution. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.Serialization.cs index 7b1be427b4e0..69ef9e575833 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class LookupActivity : IUtf8JsonSerializable + public partial class LookupActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedServiceName)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -53,7 +66,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -63,16 +83,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); writer.WritePropertyName("source"u8); - writer.WriteObjectValue(Source); + if (Source is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Source).Serialize(writer, options); + } writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } if (Optional.IsDefined(FirstRowOnly)) { writer.WritePropertyName("firstRowOnly"u8); @@ -91,8 +132,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static LookupActivity DeserializeLookupActivity(JsonElement element) + internal static LookupActivity DeserializeLookupActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +271,53 @@ internal static LookupActivity DeserializeLookupActivity(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new LookupActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName, policy.Value, source, dataset, firstRowOnly.Value); } + + LookupActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeLookupActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + LookupActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeLookupActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(LookupActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator LookupActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeLookupActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.cs index d7ad4df5aa60..83bf7dd04572 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/LookupActivity.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Lookup activity. public partial class LookupActivity : ExecutionActivity { - /// Initializes a new instance of LookupActivity. + /// Initializes a new instance of . /// Activity name. /// /// Dataset-specific source properties, same as copy activity source. @@ -35,7 +35,7 @@ public LookupActivity(string name, CopyActivitySource source, DatasetReference d ActivityType = "Lookup"; } - /// Initializes a new instance of LookupActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -61,6 +61,11 @@ internal LookupActivity(string name, string activityType, string description, Pi ActivityType = activityType ?? "Lookup"; } + /// Initializes a new instance of for deserialization. + internal LookupActivity() + { + } + /// /// Dataset-specific source properties, same as copy activity source. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.Serialization.cs index b406ffd103ed..3b6e768b20fb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MagentoLinkedService : IUtf8JsonSerializable + public partial class MagentoLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -102,8 +122,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MagentoLinkedService DeserializeMagentoLinkedService(JsonElement element) + internal static MagentoLinkedService DeserializeMagentoLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -240,5 +262,53 @@ internal static MagentoLinkedService DeserializeMagentoLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new MagentoLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, accessToken, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + MagentoLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMagentoLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MagentoLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMagentoLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MagentoLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MagentoLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMagentoLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.cs index e99bd8e638c5..a07b7dbadfc4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Magento server linked service. public partial class MagentoLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MagentoLinkedService. + /// Initializes a new instance of . /// The URL of the Magento instance. (i.e. 192.168.222.110/magento3). /// is null. public MagentoLinkedService(DataFactoryElement host) @@ -26,7 +26,7 @@ public MagentoLinkedService(DataFactoryElement host) LinkedServiceType = "Magento"; } - /// Initializes a new instance of MagentoLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal MagentoLinkedService(string linkedServiceType, IntegrationRuntimeRefere LinkedServiceType = linkedServiceType ?? "Magento"; } + /// Initializes a new instance of for deserialization. + internal MagentoLinkedService() + { + } + /// The URL of the Magento instance. (i.e. 192.168.222.110/magento3). public DataFactoryElement Host { get; set; } /// The access token from Magento. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.Serialization.cs index 26bc192f3931..d7785f34a5c1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MagentoObjectDataset : IUtf8JsonSerializable + public partial class MagentoObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MagentoObjectDataset DeserializeMagentoObjectDataset(JsonElement element) + internal static MagentoObjectDataset DeserializeMagentoObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static MagentoObjectDataset DeserializeMagentoObjectDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new MagentoObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + MagentoObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMagentoObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MagentoObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMagentoObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MagentoObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MagentoObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMagentoObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.cs index 0330817d080e..31df36f8a805 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Magento server dataset. public partial class MagentoObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MagentoObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public MagentoObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public MagentoObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "MagentoObject"; } - /// Initializes a new instance of MagentoObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal MagentoObjectDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "MagentoObject"; } + /// Initializes a new instance of for deserialization. + internal MagentoObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.Serialization.cs index c0eee1146ad9..0b4d0c8ead9f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MagentoSource : IUtf8JsonSerializable + public partial class MagentoSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MagentoSource DeserializeMagentoSource(JsonElement element) + internal static MagentoSource DeserializeMagentoSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static MagentoSource DeserializeMagentoSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MagentoSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + MagentoSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMagentoSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MagentoSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMagentoSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MagentoSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MagentoSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMagentoSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.cs index 212e6725fd59..294d41f6fbdb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MagentoSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Magento server source. public partial class MagentoSource : TabularSource { - /// Initializes a new instance of MagentoSource. + /// Initializes a new instance of . public MagentoSource() { CopySourceType = "MagentoSource"; } - /// Initializes a new instance of MagentoSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.Serialization.cs index 63a7bfe1242e..2bd84b9934b4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.Serialization.cs @@ -8,19 +8,32 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ManagedIntegrationRuntime : IUtf8JsonSerializable + public partial class ManagedIntegrationRuntime : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ManagedVirtualNetwork)) { writer.WritePropertyName("managedVirtualNetwork"u8); - writer.WriteObjectValue(ManagedVirtualNetwork); + if (ManagedVirtualNetwork is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ManagedVirtualNetwork).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(IntegrationRuntimeType.ToString()); @@ -34,17 +47,38 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ComputeProperties)) { writer.WritePropertyName("computeProperties"u8); - writer.WriteObjectValue(ComputeProperties); + if (ComputeProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ComputeProperties).Serialize(writer, options); + } } if (Optional.IsDefined(SsisProperties)) { writer.WritePropertyName("ssisProperties"u8); - writer.WriteObjectValue(SsisProperties); + if (SsisProperties is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)SsisProperties).Serialize(writer, options); + } } if (Optional.IsDefined(CustomerVirtualNetwork)) { writer.WritePropertyName("customerVirtualNetwork"u8); - writer.WriteObjectValue(CustomerVirtualNetwork); + if (CustomerVirtualNetwork is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CustomerVirtualNetwork).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -59,8 +93,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ManagedIntegrationRuntime DeserializeManagedIntegrationRuntime(JsonElement element) + internal static ManagedIntegrationRuntime DeserializeManagedIntegrationRuntime(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -148,5 +184,53 @@ internal static ManagedIntegrationRuntime DeserializeManagedIntegrationRuntime(J additionalProperties = additionalPropertiesDictionary; return new ManagedIntegrationRuntime(type, description.Value, additionalProperties, Optional.ToNullable(state), managedVirtualNetwork.Value, computeProperties.Value, ssisProperties.Value, customerVirtualNetwork.Value); } + + ManagedIntegrationRuntime IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedIntegrationRuntime(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedIntegrationRuntime IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedIntegrationRuntime(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedIntegrationRuntime model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedIntegrationRuntime(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedIntegrationRuntime(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.cs index 52f607c6c2dc..e93669c32693 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntime.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Managed integration runtime, including managed elastic and managed dedicated integration runtimes. public partial class ManagedIntegrationRuntime : DataFactoryIntegrationRuntimeProperties { - /// Initializes a new instance of ManagedIntegrationRuntime. + /// Initializes a new instance of . public ManagedIntegrationRuntime() { IntegrationRuntimeType = IntegrationRuntimeType.Managed; } - /// Initializes a new instance of ManagedIntegrationRuntime. + /// Initializes a new instance of . /// Type of integration runtime. /// Integration runtime description. /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.Serialization.cs index 1632cd859cd1..18d0a8a98021 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ManagedIntegrationRuntimeError + public partial class ManagedIntegrationRuntimeError : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedIntegrationRuntimeError DeserializeManagedIntegrationRuntimeError(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static ManagedIntegrationRuntimeError DeserializeManagedIntegrationRuntimeError(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,5 +89,53 @@ internal static ManagedIntegrationRuntimeError DeserializeManagedIntegrationRunt additionalProperties = additionalPropertiesDictionary; return new ManagedIntegrationRuntimeError(Optional.ToNullable(time), code.Value, Optional.ToList(parameters), message.Value, additionalProperties); } + + ManagedIntegrationRuntimeError IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedIntegrationRuntimeError(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedIntegrationRuntimeError IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedIntegrationRuntimeError(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedIntegrationRuntimeError model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedIntegrationRuntimeError(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedIntegrationRuntimeError(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.cs index 307afa774fd8..f9a450244a08 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeError.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Error definition for managed integration runtime. public partial class ManagedIntegrationRuntimeError { - /// Initializes a new instance of ManagedIntegrationRuntimeError. + /// Initializes a new instance of . internal ManagedIntegrationRuntimeError() { Parameters = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ManagedIntegrationRuntimeError. + /// Initializes a new instance of . /// The time when the error occurred. /// Error code. /// Managed integration runtime error parameters. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.Serialization.cs index b742212c3b13..5c082498110b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.Serialization.cs @@ -8,14 +8,54 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ManagedIntegrationRuntimeNode + public partial class ManagedIntegrationRuntimeNode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedIntegrationRuntimeNode DeserializeManagedIntegrationRuntimeNode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static ManagedIntegrationRuntimeNode DeserializeManagedIntegrationRuntimeNode(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -60,5 +100,53 @@ internal static ManagedIntegrationRuntimeNode DeserializeManagedIntegrationRunti additionalProperties = additionalPropertiesDictionary; return new ManagedIntegrationRuntimeNode(nodeId.Value, Optional.ToNullable(status), Optional.ToList(errors), additionalProperties); } + + ManagedIntegrationRuntimeNode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedIntegrationRuntimeNode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedIntegrationRuntimeNode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedIntegrationRuntimeNode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedIntegrationRuntimeNode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedIntegrationRuntimeNode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedIntegrationRuntimeNode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.cs index 8fa5705b1414..1f44c1f8efd7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeNode.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Properties of integration runtime node. public partial class ManagedIntegrationRuntimeNode { - /// Initializes a new instance of ManagedIntegrationRuntimeNode. + /// Initializes a new instance of . internal ManagedIntegrationRuntimeNode() { Errors = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ManagedIntegrationRuntimeNode. + /// Initializes a new instance of . /// The managed integration runtime node id. /// The managed integration runtime node status. /// The errors that occurred on this integration runtime node. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.Serialization.cs index 33113dd1312c..0e911b70eefc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ManagedIntegrationRuntimeOperationResult + public partial class ManagedIntegrationRuntimeOperationResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedIntegrationRuntimeOperationResult DeserializeManagedIntegrationRuntimeOperationResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static ManagedIntegrationRuntimeOperationResult DeserializeManagedIntegrationRuntimeOperationResult(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -78,5 +101,53 @@ internal static ManagedIntegrationRuntimeOperationResult DeserializeManagedInteg additionalProperties = additionalPropertiesDictionary; return new ManagedIntegrationRuntimeOperationResult(type.Value, Optional.ToNullable(startTime), result.Value, errorCode.Value, Optional.ToList(parameters), activityId.Value, additionalProperties); } + + ManagedIntegrationRuntimeOperationResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedIntegrationRuntimeOperationResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedIntegrationRuntimeOperationResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedIntegrationRuntimeOperationResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedIntegrationRuntimeOperationResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedIntegrationRuntimeOperationResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedIntegrationRuntimeOperationResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.cs index 7dcf2b9ba1a4..f6dba1e84d0e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeOperationResult.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Properties of managed integration runtime operation result. public partial class ManagedIntegrationRuntimeOperationResult { - /// Initializes a new instance of ManagedIntegrationRuntimeOperationResult. + /// Initializes a new instance of . internal ManagedIntegrationRuntimeOperationResult() { Parameters = new ChangeTrackingList(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ManagedIntegrationRuntimeOperationResult. + /// Initializes a new instance of . /// The operation type. Could be start or stop. /// The start time of the operation. /// The operation result. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.Serialization.cs index 1c56a8d1bd19..29945effd4c1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.Serialization.cs @@ -8,14 +8,42 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ManagedIntegrationRuntimeStatus + public partial class ManagedIntegrationRuntimeStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static ManagedIntegrationRuntimeStatus DeserializeManagedIntegrationRuntimeStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RuntimeType.ToString()); + writer.WritePropertyName("typeProperties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static ManagedIntegrationRuntimeStatus DeserializeManagedIntegrationRuntimeStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,5 +141,53 @@ internal static ManagedIntegrationRuntimeStatus DeserializeManagedIntegrationRun additionalProperties = additionalPropertiesDictionary; return new ManagedIntegrationRuntimeStatus(type, dataFactoryName.Value, Optional.ToNullable(state), additionalProperties, Optional.ToNullable(createTime), Optional.ToList(nodes), Optional.ToList(otherErrors), lastOperation.Value); } + + ManagedIntegrationRuntimeStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedIntegrationRuntimeStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedIntegrationRuntimeStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedIntegrationRuntimeStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedIntegrationRuntimeStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedIntegrationRuntimeStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedIntegrationRuntimeStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.cs index 365388313c28..ddb53033508e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedIntegrationRuntimeStatus.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Managed integration runtime status. public partial class ManagedIntegrationRuntimeStatus : IntegrationRuntimeStatus { - /// Initializes a new instance of ManagedIntegrationRuntimeStatus. + /// Initializes a new instance of . internal ManagedIntegrationRuntimeStatus() { Nodes = new ChangeTrackingList(); @@ -22,7 +22,7 @@ internal ManagedIntegrationRuntimeStatus() RuntimeType = IntegrationRuntimeType.Managed; } - /// Initializes a new instance of ManagedIntegrationRuntimeStatus. + /// Initializes a new instance of . /// Type of integration runtime. /// The data factory name which the integration runtime belong to. /// The state of integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.Serialization.cs index cb9ac49e1854..f84a1b58ff31 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ManagedVirtualNetworkReference : IUtf8JsonSerializable + public partial class ManagedVirtualNetworkReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("referenceName"u8); writer.WriteStringValue(ReferenceName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ManagedVirtualNetworkReference DeserializeManagedVirtualNetworkReference(JsonElement element) + internal static ManagedVirtualNetworkReference DeserializeManagedVirtualNetworkReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ManagedVirtualNetworkReferenceType type = default; string referenceName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -42,8 +65,61 @@ internal static ManagedVirtualNetworkReference DeserializeManagedVirtualNetworkR referenceName = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ManagedVirtualNetworkReference(type, referenceName, serializedAdditionalRawData); + } + + ManagedVirtualNetworkReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeManagedVirtualNetworkReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ManagedVirtualNetworkReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeManagedVirtualNetworkReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ManagedVirtualNetworkReference model) + { + if (model is null) + { + return null; } - return new ManagedVirtualNetworkReference(type, referenceName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ManagedVirtualNetworkReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeManagedVirtualNetworkReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.cs index 7bc5faba2092..613cc5bee17c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ManagedVirtualNetworkReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Managed Virtual Network reference type. public partial class ManagedVirtualNetworkReference { - /// Initializes a new instance of ManagedVirtualNetworkReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Managed Virtual Network reference type. /// Reference ManagedVirtualNetwork name. /// is null. @@ -25,6 +29,22 @@ public ManagedVirtualNetworkReference(ManagedVirtualNetworkReferenceType referen ReferenceName = referenceName; } + /// Initializes a new instance of . + /// Managed Virtual Network reference type. + /// Reference ManagedVirtualNetwork name. + /// Keeps track of any properties unknown to the library. + internal ManagedVirtualNetworkReference(ManagedVirtualNetworkReferenceType referenceType, string referenceName, Dictionary serializedAdditionalRawData) + { + ReferenceType = referenceType; + ReferenceName = referenceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedVirtualNetworkReference() + { + } + /// Managed Virtual Network reference type. public ManagedVirtualNetworkReferenceType ReferenceType { get; set; } /// Reference ManagedVirtualNetwork name. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.Serialization.cs index edd781026a75..422268dbd222 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperAttributeMapping : IUtf8JsonSerializable + public partial class MapperAttributeMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -39,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AttributeReference)) { writer.WritePropertyName("attributeReference"u8); - writer.WriteObjectValue(AttributeReference); + if (AttributeReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)AttributeReference).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(AttributeReferences)) { @@ -47,15 +61,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AttributeReferences) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperAttributeMapping DeserializeMapperAttributeMapping(JsonElement element) + internal static MapperAttributeMapping DeserializeMapperAttributeMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -66,6 +101,7 @@ internal static MapperAttributeMapping DeserializeMapperAttributeMapping(JsonEle Optional expression = default; Optional attributeReference = default; Optional> attributeReferences = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -115,8 +151,61 @@ internal static MapperAttributeMapping DeserializeMapperAttributeMapping(JsonEle attributeReferences = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperAttributeMapping(name.Value, Optional.ToNullable(type), functionName.Value, expression.Value, attributeReference.Value, Optional.ToList(attributeReferences), serializedAdditionalRawData); + } + + MapperAttributeMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperAttributeMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperAttributeMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperAttributeMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperAttributeMapping model) + { + if (model is null) + { + return null; } - return new MapperAttributeMapping(name.Value, Optional.ToNullable(type), functionName.Value, expression.Value, attributeReference.Value, Optional.ToList(attributeReferences)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperAttributeMapping(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperAttributeMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.cs index b7ed23e4de95..5efb806ea33d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMapping.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,20 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Source and target column mapping details. public partial class MapperAttributeMapping { - /// Initializes a new instance of MapperAttributeMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperAttributeMapping() { AttributeReferences = new ChangeTrackingList(); } - /// Initializes a new instance of MapperAttributeMapping. + /// Initializes a new instance of . /// Name of the target column. /// Type of the CDC attribute mapping. Note: 'Advanced' mapping type is also saved as 'Derived'. /// Name of the function used for 'Aggregate' and 'Derived' (except 'Advanced') type mapping. /// Expression used for 'Aggregate' and 'Derived' type mapping. /// Reference of the source column used in the mapping. It is used for 'Direct' mapping type only. /// List of references for source columns. It is used for 'Derived' and 'Aggregate' type mappings only. - internal MapperAttributeMapping(string name, MappingType? mappingType, string functionName, string expression, MapperAttributeReference attributeReference, IList attributeReferences) + /// Keeps track of any properties unknown to the library. + internal MapperAttributeMapping(string name, MappingType? mappingType, string functionName, string expression, MapperAttributeReference attributeReference, IList attributeReferences, Dictionary serializedAdditionalRawData) { Name = name; MappingType = mappingType; @@ -34,6 +39,7 @@ internal MapperAttributeMapping(string name, MappingType? mappingType, string fu Expression = expression; AttributeReference = attributeReference; AttributeReferences = attributeReferences; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the target column. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.Serialization.cs index 87d267f6a177..d5802f475c48 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class MapperAttributeMappings : IUtf8JsonSerializable + internal partial class MapperAttributeMappings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(AttributeMappings)) { @@ -22,20 +29,42 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AttributeMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperAttributeMappings DeserializeMapperAttributeMappings(JsonElement element) + internal static MapperAttributeMappings DeserializeMapperAttributeMappings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> attributeMappings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("attributeMappings"u8)) @@ -52,8 +81,61 @@ internal static MapperAttributeMappings DeserializeMapperAttributeMappings(JsonE attributeMappings = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperAttributeMappings(Optional.ToList(attributeMappings), serializedAdditionalRawData); + } + + MapperAttributeMappings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperAttributeMappings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperAttributeMappings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperAttributeMappings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperAttributeMappings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperAttributeMappings(Response response) + { + if (response is null) + { + return null; } - return new MapperAttributeMappings(Optional.ToList(attributeMappings)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperAttributeMappings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.cs index 4df3e3071bff..e9b015821a1e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeMappings.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,17 +14,22 @@ namespace Azure.ResourceManager.DataFactory.Models /// Attribute mapping details. internal partial class MapperAttributeMappings { - /// Initializes a new instance of MapperAttributeMappings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperAttributeMappings() { AttributeMappings = new ChangeTrackingList(); } - /// Initializes a new instance of MapperAttributeMappings. + /// Initializes a new instance of . /// List of attribute mappings. - internal MapperAttributeMappings(IList attributeMappings) + /// Keeps track of any properties unknown to the library. + internal MapperAttributeMappings(IList attributeMappings, Dictionary serializedAdditionalRawData) { AttributeMappings = attributeMappings; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of attribute mappings. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.Serialization.cs index 2dae39b0372c..2d22aa8180b0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperAttributeReference : IUtf8JsonSerializable + public partial class MapperAttributeReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -28,13 +36,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EntityConnectionReference)) { writer.WritePropertyName("entityConnectionReference"u8); - writer.WriteObjectValue(EntityConnectionReference); + if (EntityConnectionReference is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)EntityConnectionReference).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MapperAttributeReference DeserializeMapperAttributeReference(JsonElement element) + internal static MapperAttributeReference DeserializeMapperAttributeReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +71,7 @@ internal static MapperAttributeReference DeserializeMapperAttributeReference(Jso Optional name = default; Optional entity = default; Optional entityConnectionReference = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -63,8 +93,61 @@ internal static MapperAttributeReference DeserializeMapperAttributeReference(Jso entityConnectionReference = MapperConnectionReference.DeserializeMapperConnectionReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperAttributeReference(name.Value, entity.Value, entityConnectionReference.Value, serializedAdditionalRawData); + } + + MapperAttributeReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperAttributeReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperAttributeReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperAttributeReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperAttributeReference model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperAttributeReference(Response response) + { + if (response is null) + { + return null; } - return new MapperAttributeReference(name.Value, entity.Value, entityConnectionReference.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperAttributeReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.cs index 17bcb73af84a..6a6f6d7d48cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperAttributeReference.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Attribute reference details for the referred column. public partial class MapperAttributeReference { - /// Initializes a new instance of MapperAttributeReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperAttributeReference() { } - /// Initializes a new instance of MapperAttributeReference. + /// Initializes a new instance of . /// Name of the column. /// Name of the table. /// The connection reference for the connection. - internal MapperAttributeReference(string name, string entity, MapperConnectionReference entityConnectionReference) + /// Keeps track of any properties unknown to the library. + internal MapperAttributeReference(string name, string entity, MapperConnectionReference entityConnectionReference, Dictionary serializedAdditionalRawData) { Name = name; Entity = entity; EntityConnectionReference = entityConnectionReference; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the column. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.Serialization.cs index 16f08c0d962e..18f30c546572 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperConnection : IUtf8JsonSerializable + public partial class MapperConnection : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(LinkedService)) { @@ -40,15 +47,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in CommonDslConnectorProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperConnection DeserializeMapperConnection(JsonElement element) + internal static MapperConnection DeserializeMapperConnection(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -58,6 +86,7 @@ internal static MapperConnection DeserializeMapperConnection(JsonElement element MapperConnectionType type = default; Optional isInlineDataset = default; Optional> commonDslConnectorProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("linkedService"u8)) @@ -102,8 +131,61 @@ internal static MapperConnection DeserializeMapperConnection(JsonElement element commonDslConnectorProperties = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperConnection(linkedService, linkedServiceType.Value, type, Optional.ToNullable(isInlineDataset), Optional.ToList(commonDslConnectorProperties), serializedAdditionalRawData); + } + + MapperConnection IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperConnection(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperConnection IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperConnection(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperConnection model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperConnection(Response response) + { + if (response is null) + { + return null; } - return new MapperConnection(linkedService, linkedServiceType.Value, type, Optional.ToNullable(isInlineDataset), Optional.ToList(commonDslConnectorProperties)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperConnection(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.cs index 50f3ff1713af..47b5dc261094 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnection.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Source connection details. public partial class MapperConnection { - /// Initializes a new instance of MapperConnection. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Type of connection via linked service or dataset. public MapperConnection(MapperConnectionType connectionType) { @@ -22,19 +26,26 @@ public MapperConnection(MapperConnectionType connectionType) CommonDslConnectorProperties = new ChangeTrackingList(); } - /// Initializes a new instance of MapperConnection. + /// Initializes a new instance of . /// Linked service reference. /// Type of the linked service e.g.: AzureBlobFS. /// Type of connection via linked service or dataset. /// A boolean indicating whether linked service is of type inline dataset. Currently only inline datasets are supported. /// List of name/value pairs for connection properties. - internal MapperConnection(DataFactoryLinkedServiceReference linkedService, string linkedServiceType, MapperConnectionType connectionType, bool? isInlineDataset, IList commonDslConnectorProperties) + /// Keeps track of any properties unknown to the library. + internal MapperConnection(DataFactoryLinkedServiceReference linkedService, string linkedServiceType, MapperConnectionType connectionType, bool? isInlineDataset, IList commonDslConnectorProperties, Dictionary serializedAdditionalRawData) { LinkedService = linkedService; LinkedServiceType = linkedServiceType; ConnectionType = connectionType; IsInlineDataset = isInlineDataset; CommonDslConnectorProperties = commonDslConnectorProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MapperConnection() + { } /// Linked service reference. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.Serialization.cs index 19103cd1a5b9..b9470fa3a3de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperConnectionReference : IUtf8JsonSerializable + public partial class MapperConnectionReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ConnectionName)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ConnectionType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperConnectionReference DeserializeMapperConnectionReference(JsonElement element) + internal static MapperConnectionReference DeserializeMapperConnectionReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional connectionName = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("connectionName"u8)) @@ -52,8 +75,61 @@ internal static MapperConnectionReference DeserializeMapperConnectionReference(J type = new MapperConnectionType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperConnectionReference(connectionName.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + MapperConnectionReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperConnectionReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperConnectionReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperConnectionReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperConnectionReference model) + { + if (model is null) + { + return null; } - return new MapperConnectionReference(connectionName.Value, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperConnectionReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperConnectionReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.cs index 7050d9e33d46..5e69b0877941 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperConnectionReference.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Source or target connection reference details. public partial class MapperConnectionReference { - /// Initializes a new instance of MapperConnectionReference. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperConnectionReference() { } - /// Initializes a new instance of MapperConnectionReference. + /// Initializes a new instance of . /// Name of the connection. /// Type of connection via linked service or dataset. - internal MapperConnectionReference(string connectionName, MapperConnectionType? connectionType) + /// Keeps track of any properties unknown to the library. + internal MapperConnectionReference(string connectionName, MapperConnectionType? connectionType, Dictionary serializedAdditionalRawData) { ConnectionName = connectionName; ConnectionType = connectionType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the connection. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.Serialization.cs index d1060ace7f70..0bbf3738f222 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperDslConnectorProperties : IUtf8JsonSerializable + public partial class MapperDslConnectorProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -30,17 +37,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(Value.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperDslConnectorProperties DeserializeMapperDslConnectorProperties(JsonElement element) + internal static MapperDslConnectorProperties DeserializeMapperDslConnectorProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -57,8 +79,61 @@ internal static MapperDslConnectorProperties DeserializeMapperDslConnectorProper value = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MapperDslConnectorProperties(name.Value, value.Value); + return new MapperDslConnectorProperties(name.Value, value.Value, serializedAdditionalRawData); + } + + MapperDslConnectorProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperDslConnectorProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperDslConnectorProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperDslConnectorProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperDslConnectorProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperDslConnectorProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperDslConnectorProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.cs index 81ba26c4f5a1..f8e47e97b6fd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperDslConnectorProperties.cs @@ -6,24 +6,30 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Connector properties of a CDC table in terms of name / value pairs. public partial class MapperDslConnectorProperties { - /// Initializes a new instance of MapperDslConnectorProperties. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperDslConnectorProperties() { } - /// Initializes a new instance of MapperDslConnectorProperties. + /// Initializes a new instance of . /// Name of the property. /// Value of the property. - internal MapperDslConnectorProperties(string name, BinaryData value) + /// Keeps track of any properties unknown to the library. + internal MapperDslConnectorProperties(string name, BinaryData value, Dictionary serializedAdditionalRawData) { Name = name; Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the property. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.Serialization.cs index 2f3b900167a5..b3fbb3d32adf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperPolicy : IUtf8JsonSerializable + public partial class MapperPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Mode)) { @@ -23,19 +31,41 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Recurrence)) { writer.WritePropertyName("recurrence"u8); - writer.WriteObjectValue(Recurrence); + if (Recurrence is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Recurrence).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MapperPolicy DeserializeMapperPolicy(JsonElement element) + internal static MapperPolicy DeserializeMapperPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional mode = default; Optional recurrence = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("mode"u8)) @@ -52,8 +82,61 @@ internal static MapperPolicy DeserializeMapperPolicy(JsonElement element) recurrence = MapperPolicyRecurrence.DeserializeMapperPolicyRecurrence(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperPolicy(mode.Value, recurrence.Value, serializedAdditionalRawData); + } + + MapperPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperPolicy(Response response) + { + if (response is null) + { + return null; } - return new MapperPolicy(mode.Value, recurrence.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.cs index 315c0989c64e..8957e15b9c4d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicy.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// CDC Policy. public partial class MapperPolicy { - /// Initializes a new instance of MapperPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperPolicy() { } - /// Initializes a new instance of MapperPolicy. + /// Initializes a new instance of . /// Mode of running the CDC: batch vs continuous. /// Defines the frequency and interval for running the CDC for batch mode. - internal MapperPolicy(string mode, MapperPolicyRecurrence recurrence) + /// Keeps track of any properties unknown to the library. + internal MapperPolicy(string mode, MapperPolicyRecurrence recurrence, Dictionary serializedAdditionalRawData) { Mode = mode; Recurrence = recurrence; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Mode of running the CDC: batch vs continuous. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.Serialization.cs index 3dbb0e50e382..0676817eb26b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperPolicyRecurrence : IUtf8JsonSerializable + public partial class MapperPolicyRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Frequency)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("interval"u8); writer.WriteNumberValue(Interval.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperPolicyRecurrence DeserializeMapperPolicyRecurrence(JsonElement element) + internal static MapperPolicyRecurrence DeserializeMapperPolicyRecurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional frequency = default; Optional interval = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("frequency"u8)) @@ -56,8 +79,61 @@ internal static MapperPolicyRecurrence DeserializeMapperPolicyRecurrence(JsonEle interval = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperPolicyRecurrence(Optional.ToNullable(frequency), Optional.ToNullable(interval), serializedAdditionalRawData); + } + + MapperPolicyRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperPolicyRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperPolicyRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperPolicyRecurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperPolicyRecurrence model) + { + if (model is null) + { + return null; } - return new MapperPolicyRecurrence(Optional.ToNullable(frequency), Optional.ToNullable(interval)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperPolicyRecurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperPolicyRecurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.cs index 93748cfa25ee..9d66c8fe02b0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperPolicyRecurrence.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// CDC policy recurrence details. public partial class MapperPolicyRecurrence { - /// Initializes a new instance of MapperPolicyRecurrence. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperPolicyRecurrence() { } - /// Initializes a new instance of MapperPolicyRecurrence. + /// Initializes a new instance of . /// Frequency of period in terms of 'Hour', 'Minute' or 'Second'. /// Actual interval value as per chosen frequency. - internal MapperPolicyRecurrence(MapperPolicyRecurrenceFrequencyType? frequency, int? interval) + /// Keeps track of any properties unknown to the library. + internal MapperPolicyRecurrence(MapperPolicyRecurrenceFrequencyType? frequency, int? interval, Dictionary serializedAdditionalRawData) { Frequency = frequency; Interval = interval; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Frequency of period in terms of 'Hour', 'Minute' or 'Second'. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.Serialization.cs index efba10087669..56ccd3d7caf3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperSourceConnectionsInfo : IUtf8JsonSerializable + public partial class MapperSourceConnectionsInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(SourceEntities)) { @@ -22,26 +29,55 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in SourceEntities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Connection)) { writer.WritePropertyName("connection"u8); - writer.WriteObjectValue(Connection); + if (Connection is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Connection).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static MapperSourceConnectionsInfo DeserializeMapperSourceConnectionsInfo(JsonElement element) + internal static MapperSourceConnectionsInfo DeserializeMapperSourceConnectionsInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> sourceEntities = default; Optional connection = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceEntities"u8)) @@ -67,8 +103,61 @@ internal static MapperSourceConnectionsInfo DeserializeMapperSourceConnectionsIn connection = MapperConnection.DeserializeMapperConnection(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperSourceConnectionsInfo(Optional.ToList(sourceEntities), connection.Value, serializedAdditionalRawData); + } + + MapperSourceConnectionsInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperSourceConnectionsInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperSourceConnectionsInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperSourceConnectionsInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperSourceConnectionsInfo model) + { + if (model is null) + { + return null; } - return new MapperSourceConnectionsInfo(Optional.ToList(sourceEntities), connection.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperSourceConnectionsInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperSourceConnectionsInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.cs index 70f9d44134b0..cfd8152b1e66 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperSourceConnectionsInfo.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// A object which contains list of tables and connection details for a source connection. public partial class MapperSourceConnectionsInfo { - /// Initializes a new instance of MapperSourceConnectionsInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperSourceConnectionsInfo() { SourceEntities = new ChangeTrackingList(); } - /// Initializes a new instance of MapperSourceConnectionsInfo. + /// Initializes a new instance of . /// List of source tables for a source connection. /// Source connection details. - internal MapperSourceConnectionsInfo(IList sourceEntities, MapperConnection connection) + /// Keeps track of any properties unknown to the library. + internal MapperSourceConnectionsInfo(IList sourceEntities, MapperConnection connection, Dictionary serializedAdditionalRawData) { SourceEntities = sourceEntities; Connection = connection; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of source tables for a source connection. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.Serialization.cs index a8b03e652743..d5afb7bda5b7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperTable : IUtf8JsonSerializable + public partial class MapperTable : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -29,7 +36,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Schema) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -39,16 +53,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DslConnectorProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } writer.WriteEndObject(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperTable DeserializeMapperTable(JsonElement element) + internal static MapperTable DeserializeMapperTable(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -56,6 +91,7 @@ internal static MapperTable DeserializeMapperTable(JsonElement element) Optional name = default; Optional> schema = default; Optional> dslConnectorProperties = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -103,8 +139,61 @@ internal static MapperTable DeserializeMapperTable(JsonElement element) } continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperTable(name.Value, Optional.ToList(schema), Optional.ToList(dslConnectorProperties), serializedAdditionalRawData); + } + + MapperTable IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperTable(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperTable IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperTable(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperTable model) + { + if (model is null) + { + return null; } - return new MapperTable(name.Value, Optional.ToList(schema), Optional.ToList(dslConnectorProperties)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperTable(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperTable(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.cs index ef8bf56d2b1c..1cd2313a6504 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTable.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// CDC table details. public partial class MapperTable { - /// Initializes a new instance of MapperTable. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperTable() { Schema = new ChangeTrackingList(); DslConnectorProperties = new ChangeTrackingList(); } - /// Initializes a new instance of MapperTable. + /// Initializes a new instance of . /// Name of the table. /// List of columns for the source table. /// List of name/value pairs for connection properties. - internal MapperTable(string name, IList schema, IList dslConnectorProperties) + /// Keeps track of any properties unknown to the library. + internal MapperTable(string name, IList schema, IList dslConnectorProperties, Dictionary serializedAdditionalRawData) { Name = name; Schema = schema; DslConnectorProperties = dslConnectorProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the table. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.Serialization.cs index f4a128667540..2e6049553ac6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperTableSchema : IUtf8JsonSerializable + public partial class MapperTableSchema : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dataType"u8); writer.WriteStringValue(DataType); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperTableSchema DeserializeMapperTableSchema(JsonElement element) + internal static MapperTableSchema DeserializeMapperTableSchema(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; Optional dataType = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -48,8 +71,61 @@ internal static MapperTableSchema DeserializeMapperTableSchema(JsonElement eleme dataType = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new MapperTableSchema(name.Value, dataType.Value, serializedAdditionalRawData); + } + + MapperTableSchema IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperTableSchema(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperTableSchema IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperTableSchema(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperTableSchema model) + { + if (model is null) + { + return null; } - return new MapperTableSchema(name.Value, dataType.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperTableSchema(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperTableSchema(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.cs index 285353e2563a..46e9e272efbd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTableSchema.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Schema of a CDC table in terms of column names and their corresponding data types. public partial class MapperTableSchema { - /// Initializes a new instance of MapperTableSchema. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperTableSchema() { } - /// Initializes a new instance of MapperTableSchema. + /// Initializes a new instance of . /// Name of the column. /// Data type of the column. - internal MapperTableSchema(string name, string dataType) + /// Keeps track of any properties unknown to the library. + internal MapperTableSchema(string name, string dataType, Dictionary serializedAdditionalRawData) { Name = name; DataType = dataType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the column. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.Serialization.cs index 316b5be17bfe..97534da5f695 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MapperTargetConnectionsInfo : IUtf8JsonSerializable + public partial class MapperTargetConnectionsInfo : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(TargetEntities)) { @@ -23,14 +29,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TargetEntities) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } if (Optional.IsDefined(Connection)) { writer.WritePropertyName("connection"u8); - writer.WriteObjectValue(Connection); + if (Connection is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Connection).Serialize(writer, options); + } } if (Optional.IsCollectionDefined(DataMapperMappings)) { @@ -38,7 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataMapperMappings) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -61,11 +88,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static MapperTargetConnectionsInfo DeserializeMapperTargetConnectionsInfo(JsonElement element) + internal static MapperTargetConnectionsInfo DeserializeMapperTargetConnectionsInfo(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -74,6 +115,7 @@ internal static MapperTargetConnectionsInfo DeserializeMapperTargetConnectionsIn Optional connection = default; Optional> dataMapperMappings = default; Optional> relationships = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("targetEntities"u8)) @@ -134,8 +176,61 @@ internal static MapperTargetConnectionsInfo DeserializeMapperTargetConnectionsIn relationships = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new MapperTargetConnectionsInfo(Optional.ToList(targetEntities), connection.Value, Optional.ToList(dataMapperMappings), Optional.ToList(relationships)); + return new MapperTargetConnectionsInfo(Optional.ToList(targetEntities), connection.Value, Optional.ToList(dataMapperMappings), Optional.ToList(relationships), serializedAdditionalRawData); + } + + MapperTargetConnectionsInfo IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMapperTargetConnectionsInfo(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MapperTargetConnectionsInfo IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMapperTargetConnectionsInfo(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MapperTargetConnectionsInfo model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MapperTargetConnectionsInfo(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMapperTargetConnectionsInfo(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.cs index 95a846ba1b6f..f796e40bc2c2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MapperTargetConnectionsInfo.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A object which contains list of tables and connection details for a target connection. public partial class MapperTargetConnectionsInfo { - /// Initializes a new instance of MapperTargetConnectionsInfo. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public MapperTargetConnectionsInfo() { TargetEntities = new ChangeTrackingList(); @@ -22,17 +25,19 @@ public MapperTargetConnectionsInfo() Relationships = new ChangeTrackingList(); } - /// Initializes a new instance of MapperTargetConnectionsInfo. + /// Initializes a new instance of . /// List of source tables for a target connection. /// Source connection details. /// List of table mappings. /// List of relationship info among the tables. - internal MapperTargetConnectionsInfo(IList targetEntities, MapperConnection connection, IList dataMapperMappings, IList relationships) + /// Keeps track of any properties unknown to the library. + internal MapperTargetConnectionsInfo(IList targetEntities, MapperConnection connection, IList dataMapperMappings, IList relationships, Dictionary serializedAdditionalRawData) { TargetEntities = targetEntities; Connection = connection; DataMapperMappings = dataMapperMappings; Relationships = relationships; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// List of source tables for a target connection. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.Serialization.cs index d37a0a2e5b98..5f5a776c11b1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MariaDBLinkedService : IUtf8JsonSerializable + public partial class MariaDBLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MariaDBLinkedService DeserializeMariaDBLinkedService(JsonElement element) + internal static MariaDBLinkedService DeserializeMariaDBLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static MariaDBLinkedService DeserializeMariaDBLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new MariaDBLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, password, encryptedCredential.Value); } + + MariaDBLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMariaDBLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MariaDBLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMariaDBLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MariaDBLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MariaDBLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMariaDBLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.cs index 05041eae15fa..c07af3c14e3d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// MariaDB server linked service. public partial class MariaDBLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MariaDBLinkedService. + /// Initializes a new instance of . public MariaDBLinkedService() { LinkedServiceType = "MariaDB"; } - /// Initializes a new instance of MariaDBLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.Serialization.cs index ef515ef2ace4..5aed9c7aeff6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MariaDBSource : IUtf8JsonSerializable + public partial class MariaDBSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MariaDBSource DeserializeMariaDBSource(JsonElement element) + internal static MariaDBSource DeserializeMariaDBSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static MariaDBSource DeserializeMariaDBSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MariaDBSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + MariaDBSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMariaDBSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MariaDBSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMariaDBSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MariaDBSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MariaDBSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMariaDBSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.cs index ea1c4031075f..80f28b1ee822 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity MariaDB server source. public partial class MariaDBSource : TabularSource { - /// Initializes a new instance of MariaDBSource. + /// Initializes a new instance of . public MariaDBSource() { CopySourceType = "MariaDBSource"; } - /// Initializes a new instance of MariaDBSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.Serialization.cs index 29778c546cf3..e0f6ef702ed8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MariaDBTableDataset : IUtf8JsonSerializable + public partial class MariaDBTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MariaDBTableDataset DeserializeMariaDBTableDataset(JsonElement element) + internal static MariaDBTableDataset DeserializeMariaDBTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static MariaDBTableDataset DeserializeMariaDBTableDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new MariaDBTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + MariaDBTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMariaDBTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MariaDBTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMariaDBTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MariaDBTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MariaDBTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMariaDBTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.cs index 5adea7364387..eb345680fef0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MariaDBTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// MariaDB server dataset. public partial class MariaDBTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MariaDBTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public MariaDBTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public MariaDBTableDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "MariaDBTable"; } - /// Initializes a new instance of MariaDBTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal MariaDBTableDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "MariaDBTable"; } + /// Initializes a new instance of for deserialization. + internal MariaDBTableDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.Serialization.cs index c41522d12dca..36caaad8f492 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MarketoLinkedService : IUtf8JsonSerializable + public partial class MarketoLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -104,8 +124,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MarketoLinkedService DeserializeMarketoLinkedService(JsonElement element) + internal static MarketoLinkedService DeserializeMarketoLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -248,5 +270,53 @@ internal static MarketoLinkedService DeserializeMarketoLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new MarketoLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, clientId, clientSecret, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + MarketoLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMarketoLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MarketoLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMarketoLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MarketoLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MarketoLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMarketoLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.cs index b3e1a5578c52..6ab75c15183f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Marketo server linked service. public partial class MarketoLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MarketoLinkedService. + /// Initializes a new instance of . /// The endpoint of the Marketo server. (i.e. 123-ABC-321.mktorest.com). /// The client Id of your Marketo service. /// or is null. @@ -29,7 +29,7 @@ public MarketoLinkedService(DataFactoryElement endpoint, DataFactoryElem LinkedServiceType = "Marketo"; } - /// Initializes a new instance of MarketoLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -55,6 +55,11 @@ internal MarketoLinkedService(string linkedServiceType, IntegrationRuntimeRefere LinkedServiceType = linkedServiceType ?? "Marketo"; } + /// Initializes a new instance of for deserialization. + internal MarketoLinkedService() + { + } + /// The endpoint of the Marketo server. (i.e. 123-ABC-321.mktorest.com). public DataFactoryElement Endpoint { get; set; } /// The client Id of your Marketo service. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.Serialization.cs index c2ea837c04ba..fe4408d0f636 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MarketoObjectDataset : IUtf8JsonSerializable + public partial class MarketoObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MarketoObjectDataset DeserializeMarketoObjectDataset(JsonElement element) + internal static MarketoObjectDataset DeserializeMarketoObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static MarketoObjectDataset DeserializeMarketoObjectDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new MarketoObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + MarketoObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMarketoObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MarketoObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMarketoObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MarketoObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MarketoObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMarketoObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.cs index 51be78faf71c..abf348461aac 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Marketo server dataset. public partial class MarketoObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MarketoObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public MarketoObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public MarketoObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "MarketoObject"; } - /// Initializes a new instance of MarketoObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal MarketoObjectDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "MarketoObject"; } + /// Initializes a new instance of for deserialization. + internal MarketoObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.Serialization.cs index 420bb6ce1520..ef415d14653d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MarketoSource : IUtf8JsonSerializable + public partial class MarketoSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MarketoSource DeserializeMarketoSource(JsonElement element) + internal static MarketoSource DeserializeMarketoSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static MarketoSource DeserializeMarketoSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MarketoSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + MarketoSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMarketoSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MarketoSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMarketoSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MarketoSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MarketoSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMarketoSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.cs index 9c63fa019e5b..070728469089 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MarketoSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Marketo server source. public partial class MarketoSource : TabularSource { - /// Initializes a new instance of MarketoSource. + /// Initializes a new instance of . public MarketoSource() { CopySourceType = "MarketoSource"; } - /// Initializes a new instance of MarketoSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.Serialization.cs index 8dde47fa66fb..35a235f1192d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MicrosoftAccessLinkedService : IUtf8JsonSerializable + public partial class MicrosoftAccessLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -102,8 +122,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MicrosoftAccessLinkedService DeserializeMicrosoftAccessLinkedService(JsonElement element) + internal static MicrosoftAccessLinkedService DeserializeMicrosoftAccessLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -240,5 +262,53 @@ internal static MicrosoftAccessLinkedService DeserializeMicrosoftAccessLinkedSer additionalProperties = additionalPropertiesDictionary; return new MicrosoftAccessLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, authenticationType.Value, credential, userName.Value, password, encryptedCredential.Value); } + + MicrosoftAccessLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftAccessLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftAccessLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftAccessLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftAccessLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftAccessLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftAccessLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.cs index 26a0990f11b6..e225081a216d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Microsoft Access linked service. public partial class MicrosoftAccessLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MicrosoftAccessLinkedService. + /// Initializes a new instance of . /// The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. /// is null. public MicrosoftAccessLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public MicrosoftAccessLinkedService(DataFactoryElement connectionString) LinkedServiceType = "MicrosoftAccess"; } - /// Initializes a new instance of MicrosoftAccessLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal MicrosoftAccessLinkedService(string linkedServiceType, IntegrationRunti LinkedServiceType = linkedServiceType ?? "MicrosoftAccess"; } + /// Initializes a new instance of for deserialization. + internal MicrosoftAccessLinkedService() + { + } + /// The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. public DataFactoryElement ConnectionString { get; set; } /// Type of authentication used to connect to the Microsoft Access as ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.Serialization.cs index 43dd058a53c3..37a072c833a5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MicrosoftAccessSink : IUtf8JsonSerializable + public partial class MicrosoftAccessSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MicrosoftAccessSink DeserializeMicrosoftAccessSink(JsonElement element) + internal static MicrosoftAccessSink DeserializeMicrosoftAccessSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static MicrosoftAccessSink DeserializeMicrosoftAccessSink(JsonElement e additionalProperties = additionalPropertiesDictionary; return new MicrosoftAccessSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value); } + + MicrosoftAccessSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftAccessSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftAccessSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftAccessSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftAccessSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftAccessSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftAccessSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.cs index 73d87a0e6acf..6b76b871f1c5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Microsoft Access sink. public partial class MicrosoftAccessSink : CopySink { - /// Initializes a new instance of MicrosoftAccessSink. + /// Initializes a new instance of . public MicrosoftAccessSink() { CopySinkType = "MicrosoftAccessSink"; } - /// Initializes a new instance of MicrosoftAccessSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.Serialization.cs index 7c02bda7998e..09ac1c1243d0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MicrosoftAccessSource : IUtf8JsonSerializable + public partial class MicrosoftAccessSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MicrosoftAccessSource DeserializeMicrosoftAccessSource(JsonElement element) + internal static MicrosoftAccessSource DeserializeMicrosoftAccessSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static MicrosoftAccessSource DeserializeMicrosoftAccessSource(JsonEleme additionalProperties = additionalPropertiesDictionary; return new MicrosoftAccessSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, additionalColumns.Value); } + + MicrosoftAccessSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftAccessSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftAccessSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftAccessSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftAccessSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftAccessSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftAccessSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.cs index 239a8cc7fae6..85acd83a0c6f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for Microsoft Access. public partial class MicrosoftAccessSource : CopyActivitySource { - /// Initializes a new instance of MicrosoftAccessSource. + /// Initializes a new instance of . public MicrosoftAccessSource() { CopySourceType = "MicrosoftAccessSource"; } - /// Initializes a new instance of MicrosoftAccessSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.Serialization.cs index c31c3560f580..ba56fb694b41 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MicrosoftAccessTableDataset : IUtf8JsonSerializable + public partial class MicrosoftAccessTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MicrosoftAccessTableDataset DeserializeMicrosoftAccessTableDataset(JsonElement element) + internal static MicrosoftAccessTableDataset DeserializeMicrosoftAccessTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static MicrosoftAccessTableDataset DeserializeMicrosoftAccessTableDatas additionalProperties = additionalPropertiesDictionary; return new MicrosoftAccessTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + MicrosoftAccessTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMicrosoftAccessTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MicrosoftAccessTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMicrosoftAccessTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MicrosoftAccessTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MicrosoftAccessTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMicrosoftAccessTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.cs index 17fdd8a005d1..cb526bcd9afd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MicrosoftAccessTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Microsoft Access table dataset. public partial class MicrosoftAccessTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MicrosoftAccessTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public MicrosoftAccessTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public MicrosoftAccessTableDataset(DataFactoryLinkedServiceReference linkedServi DatasetType = "MicrosoftAccessTable"; } - /// Initializes a new instance of MicrosoftAccessTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal MicrosoftAccessTableDataset(string datasetType, string description, Dat DatasetType = datasetType ?? "MicrosoftAccessTable"; } + /// Initializes a new instance of for deserialization. + internal MicrosoftAccessTableDataset() + { + } + /// The Microsoft Access table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.Serialization.cs index a8fa8cc30fdd..658dd2737474 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBAtlasCollectionDataset : IUtf8JsonSerializable + public partial class MongoDBAtlasCollectionDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBAtlasCollectionDataset DeserializeMongoDBAtlasCollectionDataset(JsonElement element) + internal static MongoDBAtlasCollectionDataset DeserializeMongoDBAtlasCollectionDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static MongoDBAtlasCollectionDataset DeserializeMongoDBAtlasCollectionD additionalProperties = additionalPropertiesDictionary; return new MongoDBAtlasCollectionDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, collection); } + + MongoDBAtlasCollectionDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBAtlasCollectionDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBAtlasCollectionDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBAtlasCollectionDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBAtlasCollectionDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBAtlasCollectionDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBAtlasCollectionDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.cs index 5da78800e9ab..31925cc326e6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasCollectionDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The MongoDB Atlas database dataset. public partial class MongoDBAtlasCollectionDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MongoDBAtlasCollectionDataset. + /// Initializes a new instance of . /// Linked service reference. /// The collection name of the MongoDB Atlas database. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public MongoDBAtlasCollectionDataset(DataFactoryLinkedServiceReference linkedSer DatasetType = "MongoDbAtlasCollection"; } - /// Initializes a new instance of MongoDBAtlasCollectionDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal MongoDBAtlasCollectionDataset(string datasetType, string description, D DatasetType = datasetType ?? "MongoDbAtlasCollection"; } + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasCollectionDataset() + { + } + /// The collection name of the MongoDB Atlas database. Type: string (or Expression with resultType string). public DataFactoryElement Collection { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.Serialization.cs index a8c66450bc0f..2609d197cd65 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBAtlasLinkedService : IUtf8JsonSerializable + public partial class MongoDBAtlasLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -84,8 +104,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBAtlasLinkedService DeserializeMongoDBAtlasLinkedService(JsonElement element) + internal static MongoDBAtlasLinkedService DeserializeMongoDBAtlasLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +214,53 @@ internal static MongoDBAtlasLinkedService DeserializeMongoDBAtlasLinkedService(J additionalProperties = additionalPropertiesDictionary; return new MongoDBAtlasLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, database, driverVersion.Value); } + + MongoDBAtlasLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBAtlasLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBAtlasLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBAtlasLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBAtlasLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBAtlasLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBAtlasLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.cs index 6af363a1beed..10fa211b6463 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for MongoDB Atlas data source. public partial class MongoDBAtlasLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MongoDBAtlasLinkedService. + /// Initializes a new instance of . /// The MongoDB Atlas connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. /// The name of the MongoDB Atlas database that you want to access. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public MongoDBAtlasLinkedService(DataFactoryElement connectionString, Da LinkedServiceType = "MongoDbAtlas"; } - /// Initializes a new instance of MongoDBAtlasLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -47,6 +47,11 @@ internal MongoDBAtlasLinkedService(string linkedServiceType, IntegrationRuntimeR LinkedServiceType = linkedServiceType ?? "MongoDbAtlas"; } + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasLinkedService() + { + } + /// The MongoDB Atlas connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The name of the MongoDB Atlas database that you want to access. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.Serialization.cs index 8f742d8fb272..d83fdb815c66 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBAtlasSink : IUtf8JsonSerializable + public partial class MongoDBAtlasSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBAtlasSink DeserializeMongoDBAtlasSink(JsonElement element) + internal static MongoDBAtlasSink DeserializeMongoDBAtlasSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static MongoDBAtlasSink DeserializeMongoDBAtlasSink(JsonElement element additionalProperties = additionalPropertiesDictionary; return new MongoDBAtlasSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior.Value); } + + MongoDBAtlasSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBAtlasSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBAtlasSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBAtlasSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBAtlasSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBAtlasSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBAtlasSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.cs index 6e3f72ccdd11..9c30d185ccb7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity MongoDB Atlas sink. public partial class MongoDBAtlasSink : CopySink { - /// Initializes a new instance of MongoDBAtlasSink. + /// Initializes a new instance of . public MongoDBAtlasSink() { CopySinkType = "MongoDbAtlasSink"; } - /// Initializes a new instance of MongoDBAtlasSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.Serialization.cs index a2499e033e83..1f5a680ecabb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBAtlasSource : IUtf8JsonSerializable + public partial class MongoDBAtlasSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Filter)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CursorMethods)) { writer.WritePropertyName("cursorMethods"u8); - writer.WriteObjectValue(CursorMethods); + if (CursorMethods is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CursorMethods).Serialize(writer, options); + } } if (Optional.IsDefined(BatchSize)) { @@ -81,8 +94,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBAtlasSource DeserializeMongoDBAtlasSource(JsonElement element) + internal static MongoDBAtlasSource DeserializeMongoDBAtlasSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +207,53 @@ internal static MongoDBAtlasSource DeserializeMongoDBAtlasSource(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new MongoDBAtlasSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, filter.Value, cursorMethods.Value, batchSize.Value, queryTimeout.Value, additionalColumns.Value); } + + MongoDBAtlasSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBAtlasSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBAtlasSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBAtlasSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBAtlasSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBAtlasSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBAtlasSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.cs index 8ac4491d2b18..cf8bde26bcc2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBAtlasSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for a MongoDB Atlas database. public partial class MongoDBAtlasSource : CopyActivitySource { - /// Initializes a new instance of MongoDBAtlasSource. + /// Initializes a new instance of . public MongoDBAtlasSource() { CopySourceType = "MongoDbAtlasSource"; } - /// Initializes a new instance of MongoDBAtlasSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.Serialization.cs index 18aa4846a154..bec68be9bed5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBCollectionDataset : IUtf8JsonSerializable + public partial class MongoDBCollectionDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBCollectionDataset DeserializeMongoDBCollectionDataset(JsonElement element) + internal static MongoDBCollectionDataset DeserializeMongoDBCollectionDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static MongoDBCollectionDataset DeserializeMongoDBCollectionDataset(Jso additionalProperties = additionalPropertiesDictionary; return new MongoDBCollectionDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, collectionName); } + + MongoDBCollectionDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCollectionDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCollectionDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCollectionDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCollectionDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCollectionDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCollectionDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.cs index eb1f7d60ef19..198998f4037b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCollectionDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The MongoDB database dataset. public partial class MongoDBCollectionDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MongoDBCollectionDataset. + /// Initializes a new instance of . /// Linked service reference. /// The table name of the MongoDB database. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public MongoDBCollectionDataset(DataFactoryLinkedServiceReference linkedServiceN DatasetType = "MongoDbCollection"; } - /// Initializes a new instance of MongoDBCollectionDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal MongoDBCollectionDataset(string datasetType, string description, DataFa DatasetType = datasetType ?? "MongoDbCollection"; } + /// Initializes a new instance of for deserialization. + internal MongoDBCollectionDataset() + { + } + /// The table name of the MongoDB database. Type: string (or Expression with resultType string). public DataFactoryElement CollectionName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.Serialization.cs index febdbbba86e6..5cfd744d021c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBCursorMethodsProperties : IUtf8JsonSerializable + public partial class MongoDBCursorMethodsProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Project)) { @@ -50,8 +56,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBCursorMethodsProperties DeserializeMongoDBCursorMethodsProperties(JsonElement element) + internal static MongoDBCursorMethodsProperties DeserializeMongoDBCursorMethodsProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -105,5 +113,53 @@ internal static MongoDBCursorMethodsProperties DeserializeMongoDBCursorMethodsPr additionalProperties = additionalPropertiesDictionary; return new MongoDBCursorMethodsProperties(project.Value, sort.Value, skip.Value, limit.Value, additionalProperties); } + + MongoDBCursorMethodsProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBCursorMethodsProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBCursorMethodsProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBCursorMethodsProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBCursorMethodsProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBCursorMethodsProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBCursorMethodsProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.cs index 62a7295f0851..b9bf42fe4554 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBCursorMethodsProperties.cs @@ -15,13 +15,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Cursor methods for Mongodb query. public partial class MongoDBCursorMethodsProperties { - /// Initializes a new instance of MongoDBCursorMethodsProperties. + /// Initializes a new instance of . public MongoDBCursorMethodsProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of MongoDBCursorMethodsProperties. + /// Initializes a new instance of . /// Specifies the fields to return in the documents that match the query filter. To return all fields in the matching documents, omit this parameter. Type: string (or Expression with resultType string). /// Specifies the order in which the query returns matching documents. Type: string (or Expression with resultType string). Type: string (or Expression with resultType string). /// Specifies the how many documents skipped and where MongoDB begins returning results. This approach may be useful in implementing paginated results. Type: integer (or Expression with resultType integer). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.Serialization.cs index 240c9ae7e964..3b35d3b8f36b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBLinkedService : IUtf8JsonSerializable + public partial class MongoDBLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -119,8 +139,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBLinkedService DeserializeMongoDBLinkedService(JsonElement element) + internal static MongoDBLinkedService DeserializeMongoDBLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -293,5 +315,53 @@ internal static MongoDBLinkedService DeserializeMongoDBLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new MongoDBLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, server, Optional.ToNullable(authenticationType), databaseName, username.Value, password, authSource.Value, port.Value, enableSsl.Value, allowSelfSignedServerCert.Value, encryptedCredential.Value); } + + MongoDBLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.cs index c07e1274e204..a70e4cbbc6c0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for MongoDb data source. public partial class MongoDBLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MongoDBLinkedService. + /// Initializes a new instance of . /// The IP address or server name of the MongoDB server. Type: string (or Expression with resultType string). /// The name of the MongoDB database that you want to access. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public MongoDBLinkedService(DataFactoryElement server, DataFactoryElemen LinkedServiceType = "MongoDb"; } - /// Initializes a new instance of MongoDBLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -61,6 +61,11 @@ internal MongoDBLinkedService(string linkedServiceType, IntegrationRuntimeRefere LinkedServiceType = linkedServiceType ?? "MongoDb"; } + /// Initializes a new instance of for deserialization. + internal MongoDBLinkedService() + { + } + /// The IP address or server name of the MongoDB server. Type: string (or Expression with resultType string). public DataFactoryElement Server { get; set; } /// The authentication type to be used to connect to the MongoDB database. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.Serialization.cs index ee5f67da5ff6..9ef207c83b8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBSource : IUtf8JsonSerializable + public partial class MongoDBSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBSource DeserializeMongoDBSource(JsonElement element) + internal static MongoDBSource DeserializeMongoDBSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static MongoDBSource DeserializeMongoDBSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MongoDBSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, additionalColumns.Value); } + + MongoDBSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.cs index c4e68c14b077..3416a4516f09 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for a MongoDB database. public partial class MongoDBSource : CopyActivitySource { - /// Initializes a new instance of MongoDBSource. + /// Initializes a new instance of . public MongoDBSource() { CopySourceType = "MongoDbSource"; } - /// Initializes a new instance of MongoDBSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.Serialization.cs index e4631751c3c1..2705ed7d4cd7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBV2CollectionDataset : IUtf8JsonSerializable + public partial class MongoDBV2CollectionDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBV2CollectionDataset DeserializeMongoDBV2CollectionDataset(JsonElement element) + internal static MongoDBV2CollectionDataset DeserializeMongoDBV2CollectionDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static MongoDBV2CollectionDataset DeserializeMongoDBV2CollectionDataset additionalProperties = additionalPropertiesDictionary; return new MongoDBV2CollectionDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, collection); } + + MongoDBV2CollectionDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBV2CollectionDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBV2CollectionDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBV2CollectionDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBV2CollectionDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBV2CollectionDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBV2CollectionDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.cs index 632409884d6d..5b0ec3a68ef8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2CollectionDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The MongoDB database dataset. public partial class MongoDBV2CollectionDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MongoDBV2CollectionDataset. + /// Initializes a new instance of . /// Linked service reference. /// The collection name of the MongoDB database. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public MongoDBV2CollectionDataset(DataFactoryLinkedServiceReference linkedServic DatasetType = "MongoDbV2Collection"; } - /// Initializes a new instance of MongoDBV2CollectionDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal MongoDBV2CollectionDataset(string datasetType, string description, Data DatasetType = datasetType ?? "MongoDbV2Collection"; } + /// Initializes a new instance of for deserialization. + internal MongoDBV2CollectionDataset() + { + } + /// The collection name of the MongoDB database. Type: string (or Expression with resultType string). public DataFactoryElement Collection { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.Serialization.cs index d0f6ebc7dca9..d789fc6d453c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBV2LinkedService : IUtf8JsonSerializable + public partial class MongoDBV2LinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -79,8 +99,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBV2LinkedService DeserializeMongoDBV2LinkedService(JsonElement element) + internal static MongoDBV2LinkedService DeserializeMongoDBV2LinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +199,53 @@ internal static MongoDBV2LinkedService DeserializeMongoDBV2LinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new MongoDBV2LinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, database); } + + MongoDBV2LinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBV2LinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBV2LinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBV2LinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBV2LinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBV2LinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBV2LinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.cs index 499a4f3e894d..9aa0728e0f94 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2LinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for MongoDB data source. public partial class MongoDBV2LinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MongoDBV2LinkedService. + /// Initializes a new instance of . /// The MongoDB connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. /// The name of the MongoDB database that you want to access. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public MongoDBV2LinkedService(DataFactoryElement connectionString, DataF LinkedServiceType = "MongoDbV2"; } - /// Initializes a new instance of MongoDBV2LinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -45,6 +45,11 @@ internal MongoDBV2LinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "MongoDbV2"; } + /// Initializes a new instance of for deserialization. + internal MongoDBV2LinkedService() + { + } + /// The MongoDB connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The name of the MongoDB database that you want to access. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.Serialization.cs index 7e9c645bcd9e..ab3d5e3f9921 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBV2Sink : IUtf8JsonSerializable + public partial class MongoDBV2Sink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBV2Sink DeserializeMongoDBV2Sink(JsonElement element) + internal static MongoDBV2Sink DeserializeMongoDBV2Sink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static MongoDBV2Sink DeserializeMongoDBV2Sink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MongoDBV2Sink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, writeBehavior.Value); } + + MongoDBV2Sink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBV2Sink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBV2Sink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBV2Sink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBV2Sink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBV2Sink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBV2Sink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.cs index 8bea113dcd28..532b1f0c872b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Sink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity MongoDB sink. public partial class MongoDBV2Sink : CopySink { - /// Initializes a new instance of MongoDBV2Sink. + /// Initializes a new instance of . public MongoDBV2Sink() { CopySinkType = "MongoDbV2Sink"; } - /// Initializes a new instance of MongoDBV2Sink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.Serialization.cs index c59006ab6229..1760a4881530 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MongoDBV2Source : IUtf8JsonSerializable + public partial class MongoDBV2Source : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Filter)) { @@ -26,7 +32,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CursorMethods)) { writer.WritePropertyName("cursorMethods"u8); - writer.WriteObjectValue(CursorMethods); + if (CursorMethods is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)CursorMethods).Serialize(writer, options); + } } if (Optional.IsDefined(BatchSize)) { @@ -81,8 +94,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MongoDBV2Source DeserializeMongoDBV2Source(JsonElement element) + internal static MongoDBV2Source DeserializeMongoDBV2Source(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -192,5 +207,53 @@ internal static MongoDBV2Source DeserializeMongoDBV2Source(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MongoDBV2Source(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, filter.Value, cursorMethods.Value, batchSize.Value, queryTimeout.Value, additionalColumns.Value); } + + MongoDBV2Source IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMongoDBV2Source(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MongoDBV2Source IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMongoDBV2Source(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MongoDBV2Source model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MongoDBV2Source(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMongoDBV2Source(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.cs index 154d48161222..d930cd8689e5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MongoDBV2Source.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for a MongoDB database. public partial class MongoDBV2Source : CopyActivitySource { - /// Initializes a new instance of MongoDBV2Source. + /// Initializes a new instance of . public MongoDBV2Source() { CopySourceType = "MongoDbV2Source"; } - /// Initializes a new instance of MongoDBV2Source. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.Serialization.cs index 82bc11b26518..83296893ad8c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MultiplePipelineTrigger : IUtf8JsonSerializable + public partial class MultiplePipelineTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsCollectionDefined(Pipelines)) { @@ -23,7 +29,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Pipelines) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -65,8 +78,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MultiplePipelineTrigger DeserializeMultiplePipelineTrigger(JsonElement element) + internal static MultiplePipelineTrigger DeserializeMultiplePipelineTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -81,6 +96,8 @@ internal static MultiplePipelineTrigger DeserializeMultiplePipelineTrigger(JsonE case "ScheduleTrigger": return DataFactoryScheduleTrigger.DeserializeDataFactoryScheduleTrigger(element); } } + + // Unknown type found so we will deserialize the base properties only Optional> pipelines = default; string type = "MultiplePipelineTrigger"; Optional description = default; @@ -149,5 +166,53 @@ internal static MultiplePipelineTrigger DeserializeMultiplePipelineTrigger(JsonE additionalProperties = additionalPropertiesDictionary; return new MultiplePipelineTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, Optional.ToList(pipelines)); } + + MultiplePipelineTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMultiplePipelineTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MultiplePipelineTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMultiplePipelineTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MultiplePipelineTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MultiplePipelineTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMultiplePipelineTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.cs index be0a60928e1a..15a172ecff9e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MultiplePipelineTrigger.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class MultiplePipelineTrigger : DataFactoryTriggerProperties { - /// Initializes a new instance of MultiplePipelineTrigger. + /// Initializes a new instance of . public MultiplePipelineTrigger() { Pipelines = new ChangeTrackingList(); TriggerType = "MultiplePipelineTrigger"; } - /// Initializes a new instance of MultiplePipelineTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.Serialization.cs index 6731a45d61a1..786f6af1ba51 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MySqlLinkedService : IUtf8JsonSerializable + public partial class MySqlLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MySqlLinkedService DeserializeMySqlLinkedService(JsonElement element) + internal static MySqlLinkedService DeserializeMySqlLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -195,5 +217,53 @@ internal static MySqlLinkedService DeserializeMySqlLinkedService(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new MySqlLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, encryptedCredential.Value); } + + MySqlLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMySqlLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MySqlLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMySqlLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MySqlLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MySqlLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMySqlLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.cs index 4ac44469c175..d3fd616a8932 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for MySQL data source. public partial class MySqlLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of MySqlLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public MySqlLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public MySqlLinkedService(DataFactoryElement connectionString) LinkedServiceType = "MySql"; } - /// Initializes a new instance of MySqlLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal MySqlLinkedService(string linkedServiceType, IntegrationRuntimeReferenc LinkedServiceType = linkedServiceType ?? "MySql"; } + /// Initializes a new instance of for deserialization. + internal MySqlLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.Serialization.cs index 13f8511b5133..18b4f673356b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MySqlSource : IUtf8JsonSerializable + public partial class MySqlSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MySqlSource DeserializeMySqlSource(JsonElement element) + internal static MySqlSource DeserializeMySqlSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static MySqlSource DeserializeMySqlSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new MySqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + MySqlSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMySqlSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MySqlSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMySqlSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MySqlSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MySqlSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMySqlSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.cs index e994cbb4c9a2..3ccd3ebc4cf6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for MySQL databases. public partial class MySqlSource : TabularSource { - /// Initializes a new instance of MySqlSource. + /// Initializes a new instance of . public MySqlSource() { CopySourceType = "MySqlSource"; } - /// Initializes a new instance of MySqlSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.Serialization.cs index 81e5567c45dc..84d9159934bb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class MySqlTableDataset : IUtf8JsonSerializable + public partial class MySqlTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MySqlTableDataset DeserializeMySqlTableDataset(JsonElement element) + internal static MySqlTableDataset DeserializeMySqlTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static MySqlTableDataset DeserializeMySqlTableDataset(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new MySqlTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + MySqlTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeMySqlTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + MySqlTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeMySqlTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(MySqlTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator MySqlTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeMySqlTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.cs index 605c31ea99ab..7aae675f0d5d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/MySqlTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The MySQL table dataset. public partial class MySqlTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of MySqlTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public MySqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public MySqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "MySqlTable"; } - /// Initializes a new instance of MySqlTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal MySqlTableDataset(string datasetType, string description, DataFactoryEl DatasetType = datasetType ?? "MySqlTable"; } + /// Initializes a new instance of for deserialization. + internal MySqlTableDataset() + { + } + /// The MySQL table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.Serialization.cs index 532d3ebd5b84..b073b1a9bcc6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class NetezzaLinkedService : IUtf8JsonSerializable + public partial class NetezzaLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static NetezzaLinkedService DeserializeNetezzaLinkedService(JsonElement element) + internal static NetezzaLinkedService DeserializeNetezzaLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -202,5 +224,53 @@ internal static NetezzaLinkedService DeserializeNetezzaLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new NetezzaLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, password, encryptedCredential.Value); } + + NetezzaLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetezzaLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetezzaLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetezzaLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetezzaLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetezzaLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetezzaLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.cs index c63b4bd7c104..6bfc8ef8681f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Netezza linked service. public partial class NetezzaLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of NetezzaLinkedService. + /// Initializes a new instance of . public NetezzaLinkedService() { LinkedServiceType = "Netezza"; } - /// Initializes a new instance of NetezzaLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.Serialization.cs index 8e0e4ed11543..784de3671b39 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class NetezzaPartitionSettings : IUtf8JsonSerializable + public partial class NetezzaPartitionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PartitionColumnName)) { @@ -31,11 +39,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("partitionLowerBound"u8); JsonSerializer.Serialize(writer, PartitionLowerBound); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NetezzaPartitionSettings DeserializeNetezzaPartitionSettings(JsonElement element) + internal static NetezzaPartitionSettings DeserializeNetezzaPartitionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +65,7 @@ internal static NetezzaPartitionSettings DeserializeNetezzaPartitionSettings(Jso Optional> partitionColumnName = default; Optional> partitionUpperBound = default; Optional> partitionLowerBound = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionColumnName"u8)) @@ -72,8 +95,61 @@ internal static NetezzaPartitionSettings DeserializeNetezzaPartitionSettings(Jso partitionLowerBound = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NetezzaPartitionSettings(partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value, serializedAdditionalRawData); + } + + NetezzaPartitionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetezzaPartitionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetezzaPartitionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetezzaPartitionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetezzaPartitionSettings model) + { + if (model is null) + { + return null; } - return new NetezzaPartitionSettings(partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetezzaPartitionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetezzaPartitionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.cs index c2443d37cfeb..103f5ba9395f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaPartitionSettings.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,20 +14,25 @@ namespace Azure.ResourceManager.DataFactory.Models /// The settings that will be leveraged for Netezza source partitioning. public partial class NetezzaPartitionSettings { - /// Initializes a new instance of NetezzaPartitionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NetezzaPartitionSettings() { } - /// Initializes a new instance of NetezzaPartitionSettings. + /// Initializes a new instance of . /// The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). - internal NetezzaPartitionSettings(DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound) + /// Keeps track of any properties unknown to the library. + internal NetezzaPartitionSettings(DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound, Dictionary serializedAdditionalRawData) { PartitionColumnName = partitionColumnName; PartitionUpperBound = partitionUpperBound; PartitionLowerBound = partitionLowerBound; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.Serialization.cs index 306f01d6e601..b1b75c593141 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class NetezzaSource : IUtf8JsonSerializable + public partial class NetezzaSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -35,7 +41,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryTimeout)) { @@ -85,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static NetezzaSource DeserializeNetezzaSource(JsonElement element) + internal static NetezzaSource DeserializeNetezzaSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -196,5 +211,53 @@ internal static NetezzaSource DeserializeNetezzaSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new NetezzaSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, partitionOption.Value, partitionSettings.Value); } + + NetezzaSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetezzaSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetezzaSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetezzaSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetezzaSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetezzaSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetezzaSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.cs index 457ba7a5b405..321b534c94c1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Netezza source. public partial class NetezzaSource : TabularSource { - /// Initializes a new instance of NetezzaSource. + /// Initializes a new instance of . public NetezzaSource() { CopySourceType = "NetezzaSource"; } - /// Initializes a new instance of NetezzaSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.Serialization.cs index a2bedb24b7da..e908767523ef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class NetezzaTableDataset : IUtf8JsonSerializable + public partial class NetezzaTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static NetezzaTableDataset DeserializeNetezzaTableDataset(JsonElement element) + internal static NetezzaTableDataset DeserializeNetezzaTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static NetezzaTableDataset DeserializeNetezzaTableDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new NetezzaTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + NetezzaTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNetezzaTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NetezzaTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNetezzaTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NetezzaTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NetezzaTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNetezzaTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.cs index 72d041966b48..3ed452f59246 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NetezzaTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Netezza dataset. public partial class NetezzaTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of NetezzaTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public NetezzaTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public NetezzaTableDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "NetezzaTable"; } - /// Initializes a new instance of NetezzaTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal NetezzaTableDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "NetezzaTable"; } + /// Initializes a new instance of for deserialization. + internal NetezzaTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.Serialization.cs index 433ea40e43a1..fa0749d4400e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class NotebookParameter : IUtf8JsonSerializable + public partial class NotebookParameter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Value)) { @@ -33,17 +41,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"u8); writer.WriteStringValue(ParameterType.Value.ToString()); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static NotebookParameter DeserializeNotebookParameter(JsonElement element) + internal static NotebookParameter DeserializeNotebookParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> value = default; Optional type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -65,8 +88,61 @@ internal static NotebookParameter DeserializeNotebookParameter(JsonElement eleme type = new NotebookParameterType(property.Value.GetString()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new NotebookParameter(value.Value, Optional.ToNullable(type), serializedAdditionalRawData); + } + + NotebookParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeNotebookParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + NotebookParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeNotebookParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(NotebookParameter model) + { + if (model is null) + { + return null; } - return new NotebookParameter(value.Value, Optional.ToNullable(type)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator NotebookParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeNotebookParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.cs index e59f0f95abce..a390394f9a9d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/NotebookParameter.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Notebook parameter. public partial class NotebookParameter { - /// Initializes a new instance of NotebookParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public NotebookParameter() { } - /// Initializes a new instance of NotebookParameter. + /// Initializes a new instance of . /// Notebook parameter value. Type: string (or Expression with resultType string). /// Notebook parameter type. - internal NotebookParameter(DataFactoryElement value, NotebookParameterType? parameterType) + /// Keeps track of any properties unknown to the library. + internal NotebookParameter(DataFactoryElement value, NotebookParameterType? parameterType, Dictionary serializedAdditionalRawData) { Value = value; ParameterType = parameterType; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Notebook parameter value. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.Serialization.cs index a86252883505..f01b37b4d5c1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ODataLinkedService : IUtf8JsonSerializable + public partial class ODataLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -142,8 +162,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ODataLinkedService DeserializeODataLinkedService(JsonElement element) + internal static ODataLinkedService DeserializeODataLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -360,5 +382,53 @@ internal static ODataLinkedService DeserializeODataLinkedService(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new ODataLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, Optional.ToNullable(authenticationType), userName.Value, password, authHeaders.Value, tenant.Value, servicePrincipalId.Value, azureCloudType.Value, aadResourceId.Value, Optional.ToNullable(aadServicePrincipalCredentialType), servicePrincipalKey, servicePrincipalEmbeddedCert, servicePrincipalEmbeddedCertPassword, encryptedCredential.Value); } + + ODataLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeODataLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ODataLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeODataLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ODataLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ODataLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeODataLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.cs index 382420526fd3..1d87ab941cd1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Open Data Protocol (OData) linked service. public partial class ODataLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of ODataLinkedService. + /// Initializes a new instance of . /// The URL of the OData service endpoint. Type: string (or Expression with resultType string). /// is null. public ODataLinkedService(DataFactoryElement uri) @@ -26,7 +26,7 @@ public ODataLinkedService(DataFactoryElement uri) LinkedServiceType = "OData"; } - /// Initializes a new instance of ODataLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -66,6 +66,11 @@ internal ODataLinkedService(string linkedServiceType, IntegrationRuntimeReferenc LinkedServiceType = linkedServiceType ?? "OData"; } + /// Initializes a new instance of for deserialization. + internal ODataLinkedService() + { + } + /// The URL of the OData service endpoint. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// Type of authentication used to connect to the OData service. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.Serialization.cs index 80510afe44e6..3c0b5cc2e12e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ODataResourceDataset : IUtf8JsonSerializable + public partial class ODataResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ODataResourceDataset DeserializeODataResourceDataset(JsonElement element) + internal static ODataResourceDataset DeserializeODataResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static ODataResourceDataset DeserializeODataResourceDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new ODataResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, path.Value); } + + ODataResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeODataResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ODataResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeODataResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ODataResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ODataResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeODataResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.cs index b3523b71c65b..aeca68fee1c0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Open Data Protocol (OData) resource dataset. public partial class ODataResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ODataResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ODataResourceDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ODataResourceDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "ODataResource"; } - /// Initializes a new instance of ODataResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal ODataResourceDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "ODataResource"; } + /// Initializes a new instance of for deserialization. + internal ODataResourceDataset() + { + } + /// The OData resource path. Type: string (or Expression with resultType string). public DataFactoryElement Path { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.Serialization.cs index 3fb155a5633d..a2d66321ae94 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ODataSource : IUtf8JsonSerializable + public partial class ODataSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ODataSource DeserializeODataSource(JsonElement element) + internal static ODataSource DeserializeODataSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static ODataSource DeserializeODataSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ODataSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, httpRequestTimeout.Value, additionalColumns.Value); } + + ODataSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeODataSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ODataSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeODataSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ODataSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ODataSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeODataSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.cs index c44829e9cb25..89314215fad2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ODataSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for OData source. public partial class ODataSource : CopyActivitySource { - /// Initializes a new instance of ODataSource. + /// Initializes a new instance of . public ODataSource() { CopySourceType = "ODataSource"; } - /// Initializes a new instance of ODataSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.Serialization.cs index 5a96f02df921..6208bb0f7c03 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OdbcLinkedService : IUtf8JsonSerializable + public partial class OdbcLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -102,8 +122,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OdbcLinkedService DeserializeOdbcLinkedService(JsonElement element) + internal static OdbcLinkedService DeserializeOdbcLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -240,5 +262,53 @@ internal static OdbcLinkedService DeserializeOdbcLinkedService(JsonElement eleme additionalProperties = additionalPropertiesDictionary; return new OdbcLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, authenticationType.Value, credential, userName.Value, password, encryptedCredential.Value); } + + OdbcLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOdbcLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OdbcLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOdbcLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OdbcLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OdbcLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOdbcLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.cs index c81c7071bd56..d68ecdb0ef92 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Open Database Connectivity (ODBC) linked service. public partial class OdbcLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of OdbcLinkedService. + /// Initializes a new instance of . /// The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. /// is null. public OdbcLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public OdbcLinkedService(DataFactoryElement connectionString) LinkedServiceType = "Odbc"; } - /// Initializes a new instance of OdbcLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -50,6 +50,11 @@ internal OdbcLinkedService(string linkedServiceType, IntegrationRuntimeReference LinkedServiceType = linkedServiceType ?? "Odbc"; } + /// Initializes a new instance of for deserialization. + internal OdbcLinkedService() + { + } + /// The non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. public DataFactoryElement ConnectionString { get; set; } /// Type of authentication used to connect to the ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.Serialization.cs index 8ae485e518ca..32b608822e9e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OdbcSink : IUtf8JsonSerializable + public partial class OdbcSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OdbcSink DeserializeOdbcSink(JsonElement element) + internal static OdbcSink DeserializeOdbcSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static OdbcSink DeserializeOdbcSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OdbcSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value); } + + OdbcSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOdbcSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OdbcSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOdbcSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OdbcSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OdbcSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOdbcSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.cs index fc92e296b0ac..ac34c64eb36a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity ODBC sink. public partial class OdbcSink : CopySink { - /// Initializes a new instance of OdbcSink. + /// Initializes a new instance of . public OdbcSink() { CopySinkType = "OdbcSink"; } - /// Initializes a new instance of OdbcSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.Serialization.cs index 77cf99b15afa..671e2b2a346c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OdbcSource : IUtf8JsonSerializable + public partial class OdbcSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OdbcSource DeserializeOdbcSource(JsonElement element) + internal static OdbcSource DeserializeOdbcSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static OdbcSource DeserializeOdbcSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OdbcSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + OdbcSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOdbcSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OdbcSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOdbcSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OdbcSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OdbcSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOdbcSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.cs index 013984e06b98..0ccd97cfa75c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for ODBC databases. public partial class OdbcSource : TabularSource { - /// Initializes a new instance of OdbcSource. + /// Initializes a new instance of . public OdbcSource() { CopySourceType = "OdbcSource"; } - /// Initializes a new instance of OdbcSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.Serialization.cs index c11e8456ce39..127028be89c1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OdbcTableDataset : IUtf8JsonSerializable + public partial class OdbcTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OdbcTableDataset DeserializeOdbcTableDataset(JsonElement element) + internal static OdbcTableDataset DeserializeOdbcTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static OdbcTableDataset DeserializeOdbcTableDataset(JsonElement element additionalProperties = additionalPropertiesDictionary; return new OdbcTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + OdbcTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOdbcTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OdbcTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOdbcTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OdbcTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OdbcTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOdbcTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.cs index fca668321e4d..78596e5593de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OdbcTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The ODBC table dataset. public partial class OdbcTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of OdbcTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public OdbcTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public OdbcTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : b DatasetType = "OdbcTable"; } - /// Initializes a new instance of OdbcTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal OdbcTableDataset(string datasetType, string description, DataFactoryEle DatasetType = datasetType ?? "OdbcTable"; } + /// Initializes a new instance of for deserialization. + internal OdbcTableDataset() + { + } + /// The ODBC table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.Serialization.cs index 833ce874bfd0..67b787d9e507 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class Office365Dataset : IUtf8JsonSerializable + public partial class Office365Dataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -93,8 +113,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static Office365Dataset DeserializeOffice365Dataset(JsonElement element) + internal static Office365Dataset DeserializeOffice365Dataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -221,5 +243,53 @@ internal static Office365Dataset DeserializeOffice365Dataset(JsonElement element additionalProperties = additionalPropertiesDictionary; return new Office365Dataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName, predicate.Value); } + + Office365Dataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOffice365Dataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Office365Dataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOffice365Dataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Office365Dataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Office365Dataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOffice365Dataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.cs index 4fcdc14e8db5..fd5a6386df4c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Dataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Office365 account. public partial class Office365Dataset : DataFactoryDatasetProperties { - /// Initializes a new instance of Office365Dataset. + /// Initializes a new instance of . /// Linked service reference. /// Name of the dataset to extract from Office 365. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public Office365Dataset(DataFactoryLinkedServiceReference linkedServiceName, Dat DatasetType = "Office365Table"; } - /// Initializes a new instance of Office365Dataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -47,6 +47,11 @@ internal Office365Dataset(string datasetType, string description, DataFactoryEle DatasetType = datasetType ?? "Office365Table"; } + /// Initializes a new instance of for deserialization. + internal Office365Dataset() + { + } + /// Name of the dataset to extract from Office 365. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } /// A predicate expression that can be used to filter the specific rows to extract from Office 365. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.Serialization.cs index 4b741c5c42b4..bb8e3d98e6f5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class Office365LinkedService : IUtf8JsonSerializable + public partial class Office365LinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static Office365LinkedService DeserializeOffice365LinkedService(JsonElement element) + internal static Office365LinkedService DeserializeOffice365LinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -203,5 +225,53 @@ internal static Office365LinkedService DeserializeOffice365LinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new Office365LinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, office365TenantId, servicePrincipalTenantId, servicePrincipalId, servicePrincipalKey, encryptedCredential.Value); } + + Office365LinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOffice365LinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Office365LinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOffice365LinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Office365LinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Office365LinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOffice365LinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.cs index ade5848f10aa..b6ab43e4211a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365LinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Office365 linked service. public partial class Office365LinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of Office365LinkedService. + /// Initializes a new instance of . /// Azure tenant ID to which the Office 365 account belongs. Type: string (or Expression with resultType string). /// Specify the tenant information under which your Azure AD web application resides. Type: string (or Expression with resultType string). /// Specify the application's client ID. Type: string (or Expression with resultType string). @@ -35,7 +35,7 @@ public Office365LinkedService(DataFactoryElement office365TenantId, Data LinkedServiceType = "Office365"; } - /// Initializes a new instance of Office365LinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -57,6 +57,11 @@ internal Office365LinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "Office365"; } + /// Initializes a new instance of for deserialization. + internal Office365LinkedService() + { + } + /// Azure tenant ID to which the Office 365 account belongs. Type: string (or Expression with resultType string). public DataFactoryElement Office365TenantId { get; set; } /// Specify the tenant information under which your Azure AD web application resides. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.Serialization.cs index 91c166995d48..e93bf40b6cc2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class Office365Source : IUtf8JsonSerializable + public partial class Office365Source : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(AllowedGroups)) { @@ -82,8 +88,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static Office365Source DeserializeOffice365Source(JsonElement element) + internal static Office365Source DeserializeOffice365Source(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -203,5 +211,53 @@ internal static Office365Source DeserializeOffice365Source(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new Office365Source(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, allowedGroups.Value, userScopeFilterUri.Value, dateFilterColumn.Value, startTime.Value, endTime.Value, outputColumns.Value); } + + Office365Source IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOffice365Source(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Office365Source IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOffice365Source(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Office365Source model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Office365Source(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOffice365Source(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.cs index 3e08f2e92046..38333e0a0758 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365Source.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for an Office 365 service. public partial class Office365Source : CopyActivitySource { - /// Initializes a new instance of Office365Source. + /// Initializes a new instance of . public Office365Source() { CopySourceType = "Office365Source"; } - /// Initializes a new instance of Office365Source. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.Serialization.cs index 28685066fad6..17968dccf6b4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.Serialization.cs @@ -6,33 +6,55 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { [JsonConverter(typeof(Office365TableOutputColumnConverter))] - public partial class Office365TableOutputColumn : IUtf8JsonSerializable + public partial class Office365TableOutputColumn : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static Office365TableOutputColumn DeserializeOffice365TableOutputColumn(JsonElement element) + internal static Office365TableOutputColumn DeserializeOffice365TableOutputColumn(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -40,8 +62,61 @@ internal static Office365TableOutputColumn DeserializeOffice365TableOutputColumn name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new Office365TableOutputColumn(name.Value, serializedAdditionalRawData); + } + + Office365TableOutputColumn IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOffice365TableOutputColumn(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + Office365TableOutputColumn IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOffice365TableOutputColumn(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(Office365TableOutputColumn model) + { + if (model is null) + { + return null; } - return new Office365TableOutputColumn(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator Office365TableOutputColumn(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOffice365TableOutputColumn(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } internal partial class Office365TableOutputColumnConverter : JsonConverter diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.cs index 7be5bedccac9..d9bc6e1844df 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/Office365TableOutputColumn.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The columns to be read out from the Office 365 table. public partial class Office365TableOutputColumn { - /// Initializes a new instance of Office365TableOutputColumn. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public Office365TableOutputColumn() { } - /// Initializes a new instance of Office365TableOutputColumn. + /// Initializes a new instance of . /// Name of the table column. Type: string. - internal Office365TableOutputColumn(string name) + /// Keeps track of any properties unknown to the library. + internal Office365TableOutputColumn(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the table column. Type: string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.Serialization.cs index 82e2aa372452..8d9fffb669fc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleCloudStorageLinkedService : IUtf8JsonSerializable + public partial class OracleCloudStorageLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -95,8 +115,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleCloudStorageLinkedService DeserializeOracleCloudStorageLinkedService(JsonElement element) + internal static OracleCloudStorageLinkedService DeserializeOracleCloudStorageLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -217,5 +239,53 @@ internal static OracleCloudStorageLinkedService DeserializeOracleCloudStorageLin additionalProperties = additionalPropertiesDictionary; return new OracleCloudStorageLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, accessKeyId.Value, secretAccessKey, serviceUrl.Value, encryptedCredential.Value); } + + OracleCloudStorageLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleCloudStorageLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleCloudStorageLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleCloudStorageLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleCloudStorageLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleCloudStorageLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleCloudStorageLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.cs index b07bfedf2fe6..4db41f22ca4c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Oracle Cloud Storage. public partial class OracleCloudStorageLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of OracleCloudStorageLinkedService. + /// Initializes a new instance of . public OracleCloudStorageLinkedService() { LinkedServiceType = "OracleCloudStorage"; } - /// Initializes a new instance of OracleCloudStorageLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.Serialization.cs index 4383f01c500c..7b0e873d0081 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleCloudStorageLocation : IUtf8JsonSerializable + public partial class OracleCloudStorageLocation : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(BucketName)) { @@ -52,8 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleCloudStorageLocation DeserializeOracleCloudStorageLocation(JsonElement element) + internal static OracleCloudStorageLocation DeserializeOracleCloudStorageLocation(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,5 +121,53 @@ internal static OracleCloudStorageLocation DeserializeOracleCloudStorageLocation additionalProperties = additionalPropertiesDictionary; return new OracleCloudStorageLocation(type, folderPath.Value, fileName.Value, additionalProperties, bucketName.Value, version.Value); } + + OracleCloudStorageLocation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleCloudStorageLocation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleCloudStorageLocation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleCloudStorageLocation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleCloudStorageLocation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleCloudStorageLocation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleCloudStorageLocation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.cs index 3999418f858d..0bd71cb79a69 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageLocation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The location of Oracle Cloud Storage dataset. public partial class OracleCloudStorageLocation : DatasetLocation { - /// Initializes a new instance of OracleCloudStorageLocation. + /// Initializes a new instance of . public OracleCloudStorageLocation() { DatasetLocationType = "OracleCloudStorageLocation"; } - /// Initializes a new instance of OracleCloudStorageLocation. + /// Initializes a new instance of . /// Type of dataset storage location. /// Specify the folder path of dataset. Type: string (or Expression with resultType string). /// Specify the file name of dataset. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.Serialization.cs index 2e6d60bafe10..4b70c2e60db2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleCloudStorageReadSettings : IUtf8JsonSerializable + public partial class OracleCloudStorageReadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Recursive)) { @@ -92,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleCloudStorageReadSettings DeserializeOracleCloudStorageReadSettings(JsonElement element) + internal static OracleCloudStorageReadSettings DeserializeOracleCloudStorageReadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -233,5 +241,53 @@ internal static OracleCloudStorageReadSettings DeserializeOracleCloudStorageRead additionalProperties = additionalPropertiesDictionary; return new OracleCloudStorageReadSettings(type, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } + + OracleCloudStorageReadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleCloudStorageReadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleCloudStorageReadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleCloudStorageReadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleCloudStorageReadSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleCloudStorageReadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleCloudStorageReadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.cs index 9728aa993cd5..3cf30b61d6e9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleCloudStorageReadSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Oracle Cloud Storage read settings. public partial class OracleCloudStorageReadSettings : StoreReadSettings { - /// Initializes a new instance of OracleCloudStorageReadSettings. + /// Initializes a new instance of . public OracleCloudStorageReadSettings() { StoreReadSettingsType = "OracleCloudStorageReadSettings"; } - /// Initializes a new instance of OracleCloudStorageReadSettings. + /// Initializes a new instance of . /// The read setting type. /// The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). /// If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.Serialization.cs index 2d7cdefcd902..9295cbac86f5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleLinkedService : IUtf8JsonSerializable + public partial class OracleLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleLinkedService DeserializeOracleLinkedService(JsonElement element) + internal static OracleLinkedService DeserializeOracleLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -195,5 +217,53 @@ internal static OracleLinkedService DeserializeOracleLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new OracleLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, encryptedCredential.Value); } + + OracleLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.cs index 3bbbd53feec0..df4aa9c0920d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Oracle database. public partial class OracleLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of OracleLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public OracleLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public OracleLinkedService(DataFactoryElement connectionString) LinkedServiceType = "Oracle"; } - /// Initializes a new instance of OracleLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal OracleLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "Oracle"; } + /// Initializes a new instance of for deserialization. + internal OracleLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.Serialization.cs index c6e678a8ca39..8c28cb6a2824 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.Serialization.cs @@ -6,16 +6,23 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OraclePartitionSettings : IUtf8JsonSerializable + public partial class OraclePartitionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PartitionNames)) { @@ -41,11 +48,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("partitionLowerBound"u8); JsonSerializer.Serialize(writer, PartitionLowerBound); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static OraclePartitionSettings DeserializeOraclePartitionSettings(JsonElement element) + internal static OraclePartitionSettings DeserializeOraclePartitionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -54,6 +75,7 @@ internal static OraclePartitionSettings DeserializeOraclePartitionSettings(JsonE Optional> partitionColumnName = default; Optional> partitionUpperBound = default; Optional> partitionLowerBound = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionNames"u8)) @@ -92,8 +114,61 @@ internal static OraclePartitionSettings DeserializeOraclePartitionSettings(JsonE partitionLowerBound = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new OraclePartitionSettings(partitionNames.Value, partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value); + return new OraclePartitionSettings(partitionNames.Value, partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value, serializedAdditionalRawData); + } + + OraclePartitionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOraclePartitionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OraclePartitionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOraclePartitionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OraclePartitionSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OraclePartitionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOraclePartitionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.cs index 0b6e41337674..6609d3043221 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OraclePartitionSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -13,22 +14,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// The settings that will be leveraged for Oracle source partitioning. public partial class OraclePartitionSettings { - /// Initializes a new instance of OraclePartitionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public OraclePartitionSettings() { } - /// Initializes a new instance of OraclePartitionSettings. + /// Initializes a new instance of . /// Names of the physical partitions of Oracle table. /// The name of the column in integer type that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). - internal OraclePartitionSettings(BinaryData partitionNames, DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound) + /// Keeps track of any properties unknown to the library. + internal OraclePartitionSettings(BinaryData partitionNames, DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound, Dictionary serializedAdditionalRawData) { PartitionNames = partitionNames; PartitionColumnName = partitionColumnName; PartitionUpperBound = partitionUpperBound; PartitionLowerBound = partitionLowerBound; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.Serialization.cs index 45977f1b4bf1..c927cfa3918a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleServiceCloudLinkedService : IUtf8JsonSerializable + public partial class OracleServiceCloudLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -108,8 +128,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleServiceCloudLinkedService DeserializeOracleServiceCloudLinkedService(JsonElement element) + internal static OracleServiceCloudLinkedService DeserializeOracleServiceCloudLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -248,5 +270,53 @@ internal static OracleServiceCloudLinkedService DeserializeOracleServiceCloudLin additionalProperties = additionalPropertiesDictionary; return new OracleServiceCloudLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, username, password, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + OracleServiceCloudLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleServiceCloudLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleServiceCloudLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleServiceCloudLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleServiceCloudLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleServiceCloudLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleServiceCloudLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.cs index cf80340b8864..a0626131a864 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Oracle Service Cloud linked service. public partial class OracleServiceCloudLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of OracleServiceCloudLinkedService. + /// Initializes a new instance of . /// The URL of the Oracle Service Cloud instance. /// The user name that you use to access Oracle Service Cloud server. /// The password corresponding to the user name that you provided in the username key. @@ -32,7 +32,7 @@ public OracleServiceCloudLinkedService(BinaryData host, BinaryData username, Dat LinkedServiceType = "OracleServiceCloud"; } - /// Initializes a new instance of OracleServiceCloudLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -58,6 +58,11 @@ internal OracleServiceCloudLinkedService(string linkedServiceType, IntegrationRu LinkedServiceType = linkedServiceType ?? "OracleServiceCloud"; } + /// Initializes a new instance of for deserialization. + internal OracleServiceCloudLinkedService() + { + } + /// /// The URL of the Oracle Service Cloud instance. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.Serialization.cs index b486d17b89bc..76bf23ccb031 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleServiceCloudObjectDataset : IUtf8JsonSerializable + public partial class OracleServiceCloudObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleServiceCloudObjectDataset DeserializeOracleServiceCloudObjectDataset(JsonElement element) + internal static OracleServiceCloudObjectDataset DeserializeOracleServiceCloudObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static OracleServiceCloudObjectDataset DeserializeOracleServiceCloudObj additionalProperties = additionalPropertiesDictionary; return new OracleServiceCloudObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + OracleServiceCloudObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleServiceCloudObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleServiceCloudObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleServiceCloudObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleServiceCloudObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleServiceCloudObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleServiceCloudObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.cs index 39990a1fbaa5..c8f626a159cd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Oracle Service Cloud dataset. public partial class OracleServiceCloudObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of OracleServiceCloudObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public OracleServiceCloudObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public OracleServiceCloudObjectDataset(DataFactoryLinkedServiceReference linkedS DatasetType = "OracleServiceCloudObject"; } - /// Initializes a new instance of OracleServiceCloudObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal OracleServiceCloudObjectDataset(string datasetType, string description, DatasetType = datasetType ?? "OracleServiceCloudObject"; } + /// Initializes a new instance of for deserialization. + internal OracleServiceCloudObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.Serialization.cs index 9ad02d933abb..c2fae65151bd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleServiceCloudSource : IUtf8JsonSerializable + public partial class OracleServiceCloudSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleServiceCloudSource DeserializeOracleServiceCloudSource(JsonElement element) + internal static OracleServiceCloudSource DeserializeOracleServiceCloudSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static OracleServiceCloudSource DeserializeOracleServiceCloudSource(Jso additionalProperties = additionalPropertiesDictionary; return new OracleServiceCloudSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + OracleServiceCloudSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleServiceCloudSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleServiceCloudSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleServiceCloudSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleServiceCloudSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleServiceCloudSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleServiceCloudSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.cs index 0e8a32bd66b0..b6bd56c51a27 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleServiceCloudSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Oracle Service Cloud source. public partial class OracleServiceCloudSource : TabularSource { - /// Initializes a new instance of OracleServiceCloudSource. + /// Initializes a new instance of . public OracleServiceCloudSource() { CopySourceType = "OracleServiceCloudSource"; } - /// Initializes a new instance of OracleServiceCloudSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.Serialization.cs index 45bb70cd891c..84188800c0db 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleSink : IUtf8JsonSerializable + public partial class OracleSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PreCopyScript)) { @@ -67,8 +73,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleSink DeserializeOracleSink(JsonElement element) + internal static OracleSink DeserializeOracleSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -158,5 +166,53 @@ internal static OracleSink DeserializeOracleSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OracleSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, preCopyScript.Value); } + + OracleSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.cs index 39ef20d200ed..9f83d909c324 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Oracle sink. public partial class OracleSink : CopySink { - /// Initializes a new instance of OracleSink. + /// Initializes a new instance of . public OracleSink() { CopySinkType = "OracleSink"; } - /// Initializes a new instance of OracleSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.Serialization.cs index aa47b5768666..6f9f401468de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleSource : IUtf8JsonSerializable + public partial class OracleSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(OracleReaderQuery)) { @@ -40,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -85,8 +98,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleSource DeserializeOracleSource(JsonElement element) + internal static OracleSource DeserializeOracleSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -196,5 +211,53 @@ internal static OracleSource DeserializeOracleSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OracleSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, oracleReaderQuery.Value, queryTimeout.Value, partitionOption.Value, partitionSettings.Value, additionalColumns.Value); } + + OracleSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.cs index 340f71a64ff6..32133a94a170 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Oracle source. public partial class OracleSource : CopyActivitySource { - /// Initializes a new instance of OracleSource. + /// Initializes a new instance of . public OracleSource() { CopySourceType = "OracleSource"; } - /// Initializes a new instance of OracleSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.Serialization.cs index 5dd810608c78..1a57fdd63fa5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OracleTableDataset : IUtf8JsonSerializable + public partial class OracleTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OracleTableDataset DeserializeOracleTableDataset(JsonElement element) + internal static OracleTableDataset DeserializeOracleTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static OracleTableDataset DeserializeOracleTableDataset(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new OracleTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, schema0.Value, table.Value); } + + OracleTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOracleTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OracleTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOracleTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OracleTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OracleTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOracleTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.cs index 38fc2775d52d..25258fb36cf2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OracleTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The on-premises Oracle database dataset. public partial class OracleTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of OracleTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public OracleTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public OracleTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : DatasetType = "OracleTable"; } - /// Initializes a new instance of OracleTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal OracleTableDataset(string datasetType, string description, DataFactoryE DatasetType = datasetType ?? "OracleTable"; } + /// Initializes a new instance of for deserialization. + internal OracleTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.Serialization.cs index 4be62053e0d4..831a9b671e4b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OrcDataset : IUtf8JsonSerializable + public partial class OrcDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,14 +82,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(OrcCompressionCodec)) { @@ -96,8 +123,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OrcDataset DeserializeOrcDataset(JsonElement element) + internal static OrcDataset DeserializeOrcDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +257,53 @@ internal static OrcDataset DeserializeOrcDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OrcDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, orcCompressionCodec.Value); } + + OrcDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrcDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrcDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrcDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrcDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrcDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrcDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.cs index 6020f1bc41b7..2a1b9c254419 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// ORC dataset. public partial class OrcDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of OrcDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public OrcDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public OrcDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(li DatasetType = "Orc"; } - /// Initializes a new instance of OrcDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -48,6 +48,11 @@ internal OrcDataset(string datasetType, string description, DataFactoryElement Initializes a new instance of for deserialization. + internal OrcDataset() + { + } + /// /// The location of the ORC data storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.Serialization.cs index a6526cfc4b39..8dffc649c6a1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OrcSink : IUtf8JsonSerializable + public partial class OrcSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -72,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OrcSink DeserializeOrcSink(JsonElement element) + internal static OrcSink DeserializeOrcSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +195,53 @@ internal static OrcSink DeserializeOrcSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OrcSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value); } + + OrcSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrcSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrcSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrcSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrcSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrcSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrcSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.cs index f370c51e281a..2a9445d16f44 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity ORC sink. public partial class OrcSink : CopySink { - /// Initializes a new instance of OrcSink. + /// Initializes a new instance of . public OrcSink() { CopySinkType = "OrcSink"; } - /// Initializes a new instance of OrcSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.Serialization.cs index 388bf85b8ca2..6945c188dcfb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OrcSource : IUtf8JsonSerializable + public partial class OrcSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -66,8 +79,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OrcSource DeserializeOrcSource(JsonElement element) + internal static OrcSource DeserializeOrcSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +162,53 @@ internal static OrcSource DeserializeOrcSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new OrcSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, additionalColumns.Value); } + + OrcSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrcSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrcSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrcSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrcSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrcSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrcSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.cs index 49d73331d443..91ab9d4b4cef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity ORC source. public partial class OrcSource : CopyActivitySource { - /// Initializes a new instance of OrcSource. + /// Initializes a new instance of . public OrcSource() { CopySourceType = "OrcSource"; } - /// Initializes a new instance of OrcSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.Serialization.cs index 7f4f1dc30abe..e65ad840a750 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class OrcWriteSettings : IUtf8JsonSerializable + public partial class OrcWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaxRowsPerFile)) { @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static OrcWriteSettings DeserializeOrcWriteSettings(JsonElement element) + internal static OrcWriteSettings DeserializeOrcWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static OrcWriteSettings DeserializeOrcWriteSettings(JsonElement element additionalProperties = additionalPropertiesDictionary; return new OrcWriteSettings(type, additionalProperties, maxRowsPerFile.Value, fileNamePrefix.Value); } + + OrcWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeOrcWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + OrcWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeOrcWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(OrcWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator OrcWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeOrcWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.cs index 778eaadb5ccb..57c3fe883e17 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/OrcWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Orc write settings. public partial class OrcWriteSettings : FormatWriteSettings { - /// Initializes a new instance of OrcWriteSettings. + /// Initializes a new instance of . public OrcWriteSettings() { FormatWriteSettingsType = "OrcWriteSettings"; } - /// Initializes a new instance of OrcWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// Additional Properties. /// Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.Serialization.cs index ca39b3896f86..ef05bdb1a543 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ParquetDataset : IUtf8JsonSerializable + public partial class ParquetDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,14 +82,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); if (Optional.IsDefined(DataLocation)) { writer.WritePropertyName("location"u8); - writer.WriteObjectValue(DataLocation); + if (DataLocation is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)DataLocation).Serialize(writer, options); + } } if (Optional.IsDefined(CompressionCodec)) { @@ -96,8 +123,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ParquetDataset DeserializeParquetDataset(JsonElement element) + internal static ParquetDataset DeserializeParquetDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +257,53 @@ internal static ParquetDataset DeserializeParquetDataset(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ParquetDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, location.Value, compressionCodec.Value); } + + ParquetDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParquetDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParquetDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParquetDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParquetDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParquetDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParquetDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.cs index b9e81e9ea716..004dc04aa910 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Parquet dataset. public partial class ParquetDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ParquetDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ParquetDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ParquetDataset(DataFactoryLinkedServiceReference linkedServiceName) : bas DatasetType = "Parquet"; } - /// Initializes a new instance of ParquetDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -48,6 +48,11 @@ internal ParquetDataset(string datasetType, string description, DataFactoryEleme DatasetType = datasetType ?? "Parquet"; } + /// Initializes a new instance of for deserialization. + internal ParquetDataset() + { + } + /// /// The location of the parquet storage. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.Serialization.cs index 45e9fe183b30..defb9c9228a8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.Serialization.cs @@ -8,25 +8,45 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ParquetSink : IUtf8JsonSerializable + public partial class ParquetSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(FormatSettings)) { writer.WritePropertyName("formatSettings"u8); - writer.WriteObjectValue(FormatSettings); + if (FormatSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)FormatSettings).Serialize(writer, options); + } } writer.WritePropertyName("type"u8); writer.WriteStringValue(CopySinkType); @@ -72,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ParquetSink DeserializeParquetSink(JsonElement element) + internal static ParquetSink DeserializeParquetSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +195,53 @@ internal static ParquetSink DeserializeParquetSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ParquetSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, formatSettings.Value); } + + ParquetSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParquetSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParquetSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParquetSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParquetSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParquetSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParquetSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.cs index 63b4337f345e..ae8167cdf4fd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Parquet sink. public partial class ParquetSink : CopySink { - /// Initializes a new instance of ParquetSink. + /// Initializes a new instance of . public ParquetSink() { CopySinkType = "ParquetSink"; } - /// Initializes a new instance of ParquetSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.Serialization.cs index 163492107be3..968444615250 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ParquetSource : IUtf8JsonSerializable + public partial class ParquetSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(StoreSettings)) { writer.WritePropertyName("storeSettings"u8); - writer.WriteObjectValue(StoreSettings); + if (StoreSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)StoreSettings).Serialize(writer, options); + } } if (Optional.IsDefined(AdditionalColumns)) { @@ -66,8 +79,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ParquetSource DeserializeParquetSource(JsonElement element) + internal static ParquetSource DeserializeParquetSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +162,53 @@ internal static ParquetSource DeserializeParquetSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ParquetSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, storeSettings.Value, additionalColumns.Value); } + + ParquetSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParquetSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParquetSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParquetSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParquetSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParquetSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParquetSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.cs index bd9a05f8cdfb..bea8b5c27a6d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Parquet source. public partial class ParquetSource : CopyActivitySource { - /// Initializes a new instance of ParquetSource. + /// Initializes a new instance of . public ParquetSource() { CopySourceType = "ParquetSource"; } - /// Initializes a new instance of ParquetSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.Serialization.cs index e4a2af445227..45146ebec884 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ParquetWriteSettings : IUtf8JsonSerializable + public partial class ParquetWriteSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(MaxRowsPerFile)) { @@ -42,8 +48,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ParquetWriteSettings DeserializeParquetWriteSettings(JsonElement element) + internal static ParquetWriteSettings DeserializeParquetWriteSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,5 +91,53 @@ internal static ParquetWriteSettings DeserializeParquetWriteSettings(JsonElement additionalProperties = additionalPropertiesDictionary; return new ParquetWriteSettings(type, additionalProperties, maxRowsPerFile.Value, fileNamePrefix.Value); } + + ParquetWriteSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeParquetWriteSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ParquetWriteSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeParquetWriteSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ParquetWriteSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ParquetWriteSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeParquetWriteSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.cs index 777f8fda367a..a723a9479df4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ParquetWriteSettings.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Parquet write settings. public partial class ParquetWriteSettings : FormatWriteSettings { - /// Initializes a new instance of ParquetWriteSettings. + /// Initializes a new instance of . public ParquetWriteSettings() { FormatWriteSettingsType = "ParquetWriteSettings"; } - /// Initializes a new instance of ParquetWriteSettings. + /// Initializes a new instance of . /// The write setting type. /// Additional Properties. /// Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.Serialization.cs index 6e02e740f2bf..0e5ba638f7df 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PaypalLinkedService : IUtf8JsonSerializable + public partial class PaypalLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -104,8 +124,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PaypalLinkedService DeserializePaypalLinkedService(JsonElement element) + internal static PaypalLinkedService DeserializePaypalLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -248,5 +270,53 @@ internal static PaypalLinkedService DeserializePaypalLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new PaypalLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, clientId, clientSecret, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + PaypalLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaypalLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaypalLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaypalLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaypalLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaypalLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaypalLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.cs index dbdce253de71..9560062b6597 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Paypal Service linked service. public partial class PaypalLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of PaypalLinkedService. + /// Initializes a new instance of . /// The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). /// The client ID associated with your PayPal application. /// or is null. @@ -29,7 +29,7 @@ public PaypalLinkedService(DataFactoryElement host, DataFactoryElement Initializes a new instance of PaypalLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -55,6 +55,11 @@ internal PaypalLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "Paypal"; } + /// Initializes a new instance of for deserialization. + internal PaypalLinkedService() + { + } + /// The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). public DataFactoryElement Host { get; set; } /// The client ID associated with your PayPal application. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.Serialization.cs index b1cfdc4a1f0e..e728f2023664 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PaypalObjectDataset : IUtf8JsonSerializable + public partial class PaypalObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PaypalObjectDataset DeserializePaypalObjectDataset(JsonElement element) + internal static PaypalObjectDataset DeserializePaypalObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static PaypalObjectDataset DeserializePaypalObjectDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new PaypalObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + PaypalObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaypalObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaypalObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaypalObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaypalObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaypalObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaypalObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.cs index 9d4a9c8ac96b..b12214965ab8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Paypal Service dataset. public partial class PaypalObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of PaypalObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public PaypalObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public PaypalObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "PaypalObject"; } - /// Initializes a new instance of PaypalObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal PaypalObjectDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "PaypalObject"; } + /// Initializes a new instance of for deserialization. + internal PaypalObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.Serialization.cs index ffc382f0b69b..7d14110a3891 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PaypalSource : IUtf8JsonSerializable + public partial class PaypalSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PaypalSource DeserializePaypalSource(JsonElement element) + internal static PaypalSource DeserializePaypalSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static PaypalSource DeserializePaypalSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new PaypalSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + PaypalSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePaypalSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PaypalSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePaypalSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PaypalSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PaypalSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePaypalSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.cs index 371574ffd75f..50c6ec6f41d2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PaypalSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Paypal Service source. public partial class PaypalSource : TabularSource { - /// Initializes a new instance of PaypalSource. + /// Initializes a new instance of . public PaypalSource() { CopySourceType = "PaypalSource"; } - /// Initializes a new instance of PaypalSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.Serialization.cs index c2967e0874d9..74710b46ecbc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PhoenixLinkedService : IUtf8JsonSerializable + public partial class PhoenixLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -129,8 +149,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PhoenixLinkedService DeserializePhoenixLinkedService(JsonElement element) + internal static PhoenixLinkedService DeserializePhoenixLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -323,5 +345,53 @@ internal static PhoenixLinkedService DeserializePhoenixLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new PhoenixLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, port.Value, httpPath.Value, authenticationType, username.Value, password, enableSsl.Value, trustedCertPath.Value, useSystemTrustStore.Value, allowHostNameCNMismatch.Value, allowSelfSignedServerCert.Value, encryptedCredential.Value); } + + PhoenixLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoenixLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoenixLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoenixLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoenixLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoenixLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoenixLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.cs index d40749f649ae..7cdfeea2a45c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Phoenix server linked service. public partial class PhoenixLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of PhoenixLinkedService. + /// Initializes a new instance of . /// The IP address or host name of the Phoenix server. (i.e. 192.168.222.160). /// The authentication mechanism used to connect to the Phoenix server. /// is null. @@ -28,7 +28,7 @@ public PhoenixLinkedService(DataFactoryElement host, PhoenixAuthenticati LinkedServiceType = "Phoenix"; } - /// Initializes a new instance of PhoenixLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -64,6 +64,11 @@ internal PhoenixLinkedService(string linkedServiceType, IntegrationRuntimeRefere LinkedServiceType = linkedServiceType ?? "Phoenix"; } + /// Initializes a new instance of for deserialization. + internal PhoenixLinkedService() + { + } + /// The IP address or host name of the Phoenix server. (i.e. 192.168.222.160). public DataFactoryElement Host { get; set; } /// The TCP port that the Phoenix server uses to listen for client connections. The default value is 8765. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.Serialization.cs index c684ad9e10fc..b1b640c8bd9a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PhoenixObjectDataset : IUtf8JsonSerializable + public partial class PhoenixObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PhoenixObjectDataset DeserializePhoenixObjectDataset(JsonElement element) + internal static PhoenixObjectDataset DeserializePhoenixObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static PhoenixObjectDataset DeserializePhoenixObjectDataset(JsonElement additionalProperties = additionalPropertiesDictionary; return new PhoenixObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + PhoenixObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoenixObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoenixObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoenixObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoenixObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoenixObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoenixObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.cs index 52684cb640b9..9e1ac7380741 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Phoenix server dataset. public partial class PhoenixObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of PhoenixObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public PhoenixObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public PhoenixObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "PhoenixObject"; } - /// Initializes a new instance of PhoenixObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal PhoenixObjectDataset(string datasetType, string description, DataFactor DatasetType = datasetType ?? "PhoenixObject"; } + /// Initializes a new instance of for deserialization. + internal PhoenixObjectDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.Serialization.cs index 58d1e730aacf..a68c801e2ae9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PhoenixSource : IUtf8JsonSerializable + public partial class PhoenixSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PhoenixSource DeserializePhoenixSource(JsonElement element) + internal static PhoenixSource DeserializePhoenixSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static PhoenixSource DeserializePhoenixSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new PhoenixSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + PhoenixSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePhoenixSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PhoenixSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePhoenixSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PhoenixSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PhoenixSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePhoenixSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.cs index 3a775482790e..9d598e3c22c2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PhoenixSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Phoenix server source. public partial class PhoenixSource : TabularSource { - /// Initializes a new instance of PhoenixSource. + /// Initializes a new instance of . public PhoenixSource() { CopySourceType = "PhoenixSource"; } - /// Initializes a new instance of PhoenixSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.Serialization.cs index a389b930958d..9659c32bce0d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineActivity : IUtf8JsonSerializable + public partial class PipelineActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -40,7 +48,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -50,7 +65,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -66,8 +88,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PipelineActivity DeserializePipelineActivity(JsonElement element) + internal static PipelineActivity DeserializePipelineActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -119,7 +143,132 @@ internal static PipelineActivity DeserializePipelineActivity(JsonElement element case "WebHook": return WebHookActivity.DeserializeWebHookActivity(element); } } - return UnknownActivity.DeserializeUnknownActivity(element); + + // Unknown type found so we will deserialize the base properties only + string name = default; + string type = default; + Optional description = default; + Optional state = default; + Optional onInactiveMarkAs = default; + Optional> dependsOn = default; + Optional> userProperties = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new PipelineActivityState(property.Value.GetString()); + continue; + } + if (property.NameEquals("onInactiveMarkAs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onInactiveMarkAs = new ActivityOnInactiveMarkAs(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PipelineActivityDependency.DeserializePipelineActivityDependency(item)); + } + dependsOn = array; + continue; + } + if (property.NameEquals("userProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PipelineActivityUserProperty.DeserializePipelineActivityUserProperty(item)); + } + userProperties = array; + continue; + } + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new UnknownActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties); + } + + PipelineActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineActivity IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineActivity(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineActivity model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineActivity(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineActivity(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.cs index 9de5fb5c6fec..f5c9663d96cb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivity.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// public partial class PipelineActivity { - /// Initializes a new instance of PipelineActivity. + /// Initializes a new instance of . /// Activity name. /// is null. public PipelineActivity(string name) @@ -31,7 +31,7 @@ public PipelineActivity(string name) AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PipelineActivity. + /// Initializes a new instance of . /// Activity name. /// Type of activity. /// Activity description. @@ -52,6 +52,11 @@ internal PipelineActivity(string name, string activityType, string description, AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal PipelineActivity() + { + } + /// Activity name. public string Name { get; set; } /// Type of activity. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.Serialization.cs index ffc3acfa04ca..668f435b6729 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineActivityDependency : IUtf8JsonSerializable + public partial class PipelineActivityDependency : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("activity"u8); writer.WriteStringValue(Activity); @@ -38,8 +44,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PipelineActivityDependency DeserializePipelineActivityDependency(JsonElement element) + internal static PipelineActivityDependency DeserializePipelineActivityDependency(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,5 +78,53 @@ internal static PipelineActivityDependency DeserializePipelineActivityDependency additionalProperties = additionalPropertiesDictionary; return new PipelineActivityDependency(activity, dependencyConditions, additionalProperties); } + + PipelineActivityDependency IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineActivityDependency(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineActivityDependency IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineActivityDependency(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineActivityDependency model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineActivityDependency(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineActivityDependency(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.cs index 2546d16de6f6..6879d5401e78 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityDependency.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Activity dependency information. public partial class PipelineActivityDependency { - /// Initializes a new instance of PipelineActivityDependency. + /// Initializes a new instance of . /// Activity name. /// Match-Condition for the dependency. /// or is null. @@ -29,7 +29,7 @@ public PipelineActivityDependency(string activity, IEnumerable(); } - /// Initializes a new instance of PipelineActivityDependency. + /// Initializes a new instance of . /// Activity name. /// Match-Condition for the dependency. /// Additional Properties. @@ -40,6 +40,11 @@ internal PipelineActivityDependency(string activity, IList AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal PipelineActivityDependency() + { + } + /// Activity name. public string Activity { get; set; } /// Match-Condition for the dependency. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.Serialization.cs index c7f7bbbb639c..734ea9abe7f9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineActivityPolicy : IUtf8JsonSerializable + public partial class PipelineActivityPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Timeout)) { @@ -55,8 +61,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PipelineActivityPolicy DeserializePipelineActivityPolicy(JsonElement element) + internal static PipelineActivityPolicy DeserializePipelineActivityPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -120,5 +128,53 @@ internal static PipelineActivityPolicy DeserializePipelineActivityPolicy(JsonEle additionalProperties = additionalPropertiesDictionary; return new PipelineActivityPolicy(timeout.Value, retry.Value, Optional.ToNullable(retryIntervalInSeconds), Optional.ToNullable(secureInput), Optional.ToNullable(secureOutput), additionalProperties); } + + PipelineActivityPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineActivityPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineActivityPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineActivityPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineActivityPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineActivityPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineActivityPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.cs index e8ec50e50e38..94e21bc36154 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityPolicy.cs @@ -15,13 +15,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execution policy for an activity. public partial class PipelineActivityPolicy { - /// Initializes a new instance of PipelineActivityPolicy. + /// Initializes a new instance of . public PipelineActivityPolicy() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PipelineActivityPolicy. + /// Initializes a new instance of . /// Specifies the timeout for the activity to run. The default timeout is 7 days. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). /// Maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. /// Interval between each retry attempt (in seconds). The default is 30 sec. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.Serialization.cs index 693d698459c6..5c53cfbbf16e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineActivityRunInformation + public partial class PipelineActivityRunInformation : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PipelineActivityRunInformation DeserializePipelineActivityRunInformation(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static PipelineActivityRunInformation DeserializePipelineActivityRunInformation(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -139,5 +162,53 @@ internal static PipelineActivityRunInformation DeserializePipelineActivityRunInf additionalProperties = additionalPropertiesDictionary; return new PipelineActivityRunInformation(pipelineName.Value, Optional.ToNullable(pipelineRunId), activityName.Value, activityType.Value, Optional.ToNullable(activityRunId), linkedServiceName.Value, status.Value, Optional.ToNullable(activityRunStart), Optional.ToNullable(activityRunEnd), Optional.ToNullable(durationInMs), input.Value, output.Value, error.Value, additionalProperties); } + + PipelineActivityRunInformation IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineActivityRunInformation(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineActivityRunInformation IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineActivityRunInformation(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineActivityRunInformation model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineActivityRunInformation(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineActivityRunInformation(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.cs index 9e31003a6006..e6921424e035 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunInformation.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Information about an activity run in a pipeline. public partial class PipelineActivityRunInformation { - /// Initializes a new instance of PipelineActivityRunInformation. + /// Initializes a new instance of . internal PipelineActivityRunInformation() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PipelineActivityRunInformation. + /// Initializes a new instance of . /// The name of the pipeline. /// The id of the pipeline run. /// The name of the activity. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.Serialization.cs index e9169375e35a..c8e017585d78 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.Serialization.cs @@ -5,22 +5,69 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class PipelineActivityRunsResult + internal partial class PipelineActivityRunsResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PipelineActivityRunsResult DeserializePipelineActivityRunsResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (Optional.IsDefined(ContinuationToken)) + { + writer.WritePropertyName("continuationToken"u8); + writer.WriteStringValue(ContinuationToken); + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PipelineActivityRunsResult DeserializePipelineActivityRunsResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; Optional continuationToken = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -38,8 +85,61 @@ internal static PipelineActivityRunsResult DeserializePipelineActivityRunsResult continuationToken = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PipelineActivityRunsResult(value, continuationToken.Value); + return new PipelineActivityRunsResult(value, continuationToken.Value, serializedAdditionalRawData); + } + + PipelineActivityRunsResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineActivityRunsResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineActivityRunsResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineActivityRunsResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineActivityRunsResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineActivityRunsResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineActivityRunsResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.cs index f1aec5a5801a..2817382825aa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityRunsResult.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// A list activity runs. internal partial class PipelineActivityRunsResult { - /// Initializes a new instance of PipelineActivityRunsResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// List of activity runs. /// is null. internal PipelineActivityRunsResult(IEnumerable value) @@ -25,13 +28,20 @@ internal PipelineActivityRunsResult(IEnumerable Value = value.ToList(); } - /// Initializes a new instance of PipelineActivityRunsResult. + /// Initializes a new instance of . /// List of activity runs. /// The continuation token for getting the next page of results, if any remaining results exist, null otherwise. - internal PipelineActivityRunsResult(IReadOnlyList value, string continuationToken) + /// Keeps track of any properties unknown to the library. + internal PipelineActivityRunsResult(IReadOnlyList value, string continuationToken, Dictionary serializedAdditionalRawData) { Value = value; ContinuationToken = continuationToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PipelineActivityRunsResult() + { } /// List of activity runs. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.Serialization.cs index a5353f354263..4e7789afa0bb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineActivityUserProperty : IUtf8JsonSerializable + public partial class PipelineActivityUserProperty : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("value"u8); JsonSerializer.Serialize(writer, Value); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PipelineActivityUserProperty DeserializePipelineActivityUserProperty(JsonElement element) + internal static PipelineActivityUserProperty DeserializePipelineActivityUserProperty(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; DataFactoryElement value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -43,8 +66,61 @@ internal static PipelineActivityUserProperty DeserializePipelineActivityUserProp value = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PipelineActivityUserProperty(name, value, serializedAdditionalRawData); + } + + PipelineActivityUserProperty IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineActivityUserProperty(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineActivityUserProperty IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineActivityUserProperty(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineActivityUserProperty model) + { + if (model is null) + { + return null; } - return new PipelineActivityUserProperty(name, value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineActivityUserProperty(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineActivityUserProperty(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.cs index ceac0b5e845a..9c9bb550816a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineActivityUserProperty.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// User property. public partial class PipelineActivityUserProperty { - /// Initializes a new instance of PipelineActivityUserProperty. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// User property name. /// User property value. Type: string (or Expression with resultType string). /// or is null. @@ -27,6 +31,22 @@ public PipelineActivityUserProperty(string name, DataFactoryElement valu Value = value; } + /// Initializes a new instance of . + /// User property name. + /// User property value. Type: string (or Expression with resultType string). + /// Keeps track of any properties unknown to the library. + internal PipelineActivityUserProperty(string name, DataFactoryElement value, Dictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PipelineActivityUserProperty() + { + } + /// User property name. public string Name { get; set; } /// User property value. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.Serialization.cs index 31587469d011..79ad50c4d33a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.Serialization.cs @@ -6,20 +6,50 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineCreateRunResult + public partial class PipelineCreateRunResult : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PipelineCreateRunResult DeserializePipelineCreateRunResult(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("runId"u8); + writer.WriteStringValue(RunId); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PipelineCreateRunResult DeserializePipelineCreateRunResult(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Guid runId = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("runId"u8)) @@ -27,8 +57,61 @@ internal static PipelineCreateRunResult DeserializePipelineCreateRunResult(JsonE runId = property.Value.GetGuid(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PipelineCreateRunResult(runId); + return new PipelineCreateRunResult(runId, serializedAdditionalRawData); + } + + PipelineCreateRunResult IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineCreateRunResult(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineCreateRunResult IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineCreateRunResult(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineCreateRunResult model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineCreateRunResult(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineCreateRunResult(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.cs index 7cfb7ea231f2..9f29682404b8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineCreateRunResult.cs @@ -6,19 +6,37 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Response body with a run identifier. public partial class PipelineCreateRunResult { - /// Initializes a new instance of PipelineCreateRunResult. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Identifier of a run. internal PipelineCreateRunResult(Guid runId) { RunId = runId; } + /// Initializes a new instance of . + /// Identifier of a run. + /// Keeps track of any properties unknown to the library. + internal PipelineCreateRunResult(Guid runId, Dictionary serializedAdditionalRawData) + { + RunId = runId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PipelineCreateRunResult() + { + } + /// Identifier of a run. public Guid RunId { get; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.Serialization.cs index 80b0035d294f..38b181e9d037 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class PipelineElapsedTimeMetricPolicy : IUtf8JsonSerializable + internal partial class PipelineElapsedTimeMetricPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Duration)) { @@ -25,16 +32,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(Duration.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PipelineElapsedTimeMetricPolicy DeserializePipelineElapsedTimeMetricPolicy(JsonElement element) + internal static PipelineElapsedTimeMetricPolicy DeserializePipelineElapsedTimeMetricPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional duration = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("duration"u8)) @@ -46,8 +68,61 @@ internal static PipelineElapsedTimeMetricPolicy DeserializePipelineElapsedTimeMe duration = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PipelineElapsedTimeMetricPolicy(duration.Value); + return new PipelineElapsedTimeMetricPolicy(duration.Value, serializedAdditionalRawData); + } + + PipelineElapsedTimeMetricPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineElapsedTimeMetricPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineElapsedTimeMetricPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineElapsedTimeMetricPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineElapsedTimeMetricPolicy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineElapsedTimeMetricPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineElapsedTimeMetricPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.cs index 5bf38a579ca9..25f1048d992f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineElapsedTimeMetricPolicy.cs @@ -6,22 +6,28 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Pipeline ElapsedTime Metric Policy. internal partial class PipelineElapsedTimeMetricPolicy { - /// Initializes a new instance of PipelineElapsedTimeMetricPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PipelineElapsedTimeMetricPolicy() { } - /// Initializes a new instance of PipelineElapsedTimeMetricPolicy. + /// Initializes a new instance of . /// TimeSpan value, after which an Azure Monitoring Metric is fired. - internal PipelineElapsedTimeMetricPolicy(BinaryData duration) + /// Keeps track of any properties unknown to the library. + internal PipelineElapsedTimeMetricPolicy(BinaryData duration, Dictionary serializedAdditionalRawData) { Duration = duration; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.Serialization.cs index edbc1b48e12c..1f3a52d9748b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineExternalComputeScaleProperties : IUtf8JsonSerializable + public partial class PipelineExternalComputeScaleProperties : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(TimeToLive)) { @@ -34,8 +40,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PipelineExternalComputeScaleProperties DeserializePipelineExternalComputeScaleProperties(JsonElement element) + internal static PipelineExternalComputeScaleProperties DeserializePipelineExternalComputeScaleProperties(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -59,5 +67,53 @@ internal static PipelineExternalComputeScaleProperties DeserializePipelineExtern additionalProperties = additionalPropertiesDictionary; return new PipelineExternalComputeScaleProperties(Optional.ToNullable(timeToLive), additionalProperties); } + + PipelineExternalComputeScaleProperties IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineExternalComputeScaleProperties(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineExternalComputeScaleProperties IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineExternalComputeScaleProperties(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineExternalComputeScaleProperties model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineExternalComputeScaleProperties(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineExternalComputeScaleProperties(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.cs index dffea819a619..1e43e7ea01b7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineExternalComputeScaleProperties.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// PipelineExternalComputeScale properties for managed integration runtime. public partial class PipelineExternalComputeScaleProperties { - /// Initializes a new instance of PipelineExternalComputeScaleProperties. + /// Initializes a new instance of . public PipelineExternalComputeScaleProperties() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PipelineExternalComputeScaleProperties. + /// Initializes a new instance of . /// Time to live (in minutes) setting of integration runtime which will execute pipeline and external activity. /// Additional Properties. internal PipelineExternalComputeScaleProperties(int? timeToLive, IDictionary additionalProperties) diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.Serialization.cs index 7bdb11881481..468d05211225 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class PipelineFolder : IUtf8JsonSerializable + internal partial class PipelineFolder : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PipelineFolder DeserializePipelineFolder(JsonElement element) + internal static PipelineFolder DeserializePipelineFolder(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional name = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +60,61 @@ internal static PipelineFolder DeserializePipelineFolder(JsonElement element) name = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PipelineFolder(name.Value, serializedAdditionalRawData); + } + + PipelineFolder IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineFolder(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineFolder IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineFolder(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineFolder model) + { + if (model is null) + { + return null; } - return new PipelineFolder(name.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineFolder(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineFolder(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.cs index 87de756ab366..039f42010fb1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineFolder.cs @@ -5,21 +5,29 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The folder that this Pipeline is in. If not specified, Pipeline will appear at the root level. internal partial class PipelineFolder { - /// Initializes a new instance of PipelineFolder. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PipelineFolder() { } - /// Initializes a new instance of PipelineFolder. + /// Initializes a new instance of . /// The name of the folder that this Pipeline is in. - internal PipelineFolder(string name) + /// Keeps track of any properties unknown to the library. + internal PipelineFolder(string name, Dictionary serializedAdditionalRawData) { Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the folder that this Pipeline is in. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.Serialization.cs index e82a966fb666..975ab14b8046 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.Serialization.cs @@ -6,15 +6,22 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PipelineVariableSpecification : IUtf8JsonSerializable + public partial class PipelineVariableSpecification : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(VariableType.ToString()); @@ -27,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) JsonSerializer.Serialize(writer, JsonDocument.Parse(DefaultValue.ToString()).RootElement); #endif } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PipelineVariableSpecification DeserializePipelineVariableSpecification(JsonElement element) + internal static PipelineVariableSpecification DeserializePipelineVariableSpecification(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } PipelineVariableType type = default; Optional defaultValue = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -54,8 +76,61 @@ internal static PipelineVariableSpecification DeserializePipelineVariableSpecifi defaultValue = BinaryData.FromString(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PipelineVariableSpecification(type, defaultValue.Value); + return new PipelineVariableSpecification(type, defaultValue.Value, serializedAdditionalRawData); + } + + PipelineVariableSpecification IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePipelineVariableSpecification(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PipelineVariableSpecification IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePipelineVariableSpecification(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PipelineVariableSpecification model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PipelineVariableSpecification(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePipelineVariableSpecification(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.cs index 674230c7b9f7..81aa4ac3e965 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PipelineVariableSpecification.cs @@ -6,26 +6,37 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.DataFactory.Models { /// Definition of a single variable for a Pipeline. public partial class PipelineVariableSpecification { - /// Initializes a new instance of PipelineVariableSpecification. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Variable type. public PipelineVariableSpecification(PipelineVariableType variableType) { VariableType = variableType; } - /// Initializes a new instance of PipelineVariableSpecification. + /// Initializes a new instance of . /// Variable type. /// Default value of variable. - internal PipelineVariableSpecification(PipelineVariableType variableType, BinaryData defaultValue) + /// Keeps track of any properties unknown to the library. + internal PipelineVariableSpecification(PipelineVariableType variableType, BinaryData defaultValue, Dictionary serializedAdditionalRawData) { VariableType = variableType; DefaultValue = defaultValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PipelineVariableSpecification() + { } /// Variable type. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.Serialization.cs index 35fd22b1d7a6..90e27b63d0f9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PolybaseSettings : IUtf8JsonSerializable + public partial class PolybaseSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RejectType)) { @@ -54,8 +60,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PolybaseSettings DeserializePolybaseSettings(JsonElement element) + internal static PolybaseSettings DeserializePolybaseSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,5 +117,53 @@ internal static PolybaseSettings DeserializePolybaseSettings(JsonElement element additionalProperties = additionalPropertiesDictionary; return new PolybaseSettings(Optional.ToNullable(rejectType), rejectValue.Value, rejectSampleValue.Value, useTypeDefault.Value, additionalProperties); } + + PolybaseSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePolybaseSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PolybaseSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePolybaseSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PolybaseSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PolybaseSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePolybaseSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.cs index 0e066a6fb6d1..1568d0828b05 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PolybaseSettings.cs @@ -15,13 +15,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// PolyBase settings. public partial class PolybaseSettings { - /// Initializes a new instance of PolybaseSettings. + /// Initializes a new instance of . public PolybaseSettings() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of PolybaseSettings. + /// Initializes a new instance of . /// Reject type. /// Specifies the value or the percentage of rows that can be rejected before the query fails. Type: number (or Expression with resultType number), minimum: 0. /// Determines the number of rows to attempt to retrieve before the PolyBase recalculates the percentage of rejected rows. Type: integer (or Expression with resultType integer), minimum: 0. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.Serialization.cs index 256656103ac6..630206b5d244 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PostgreSqlLinkedService : IUtf8JsonSerializable + public partial class PostgreSqlLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -87,8 +107,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PostgreSqlLinkedService DeserializePostgreSqlLinkedService(JsonElement element) + internal static PostgreSqlLinkedService DeserializePostgreSqlLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -195,5 +217,53 @@ internal static PostgreSqlLinkedService DeserializePostgreSqlLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new PostgreSqlLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString, password, encryptedCredential.Value); } + + PostgreSqlLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePostgreSqlLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PostgreSqlLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePostgreSqlLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PostgreSqlLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PostgreSqlLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePostgreSqlLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.cs index c81ff70680a5..5351d84f9a07 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for PostgreSQL data source. public partial class PostgreSqlLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of PostgreSqlLinkedService. + /// Initializes a new instance of . /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. /// is null. public PostgreSqlLinkedService(DataFactoryElement connectionString) @@ -26,7 +26,7 @@ public PostgreSqlLinkedService(DataFactoryElement connectionString) LinkedServiceType = "PostgreSql"; } - /// Initializes a new instance of PostgreSqlLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -44,6 +44,11 @@ internal PostgreSqlLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "PostgreSql"; } + /// Initializes a new instance of for deserialization. + internal PostgreSqlLinkedService() + { + } + /// The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. public DataFactoryElement ConnectionString { get; set; } /// The Azure key vault secret reference of password in connection string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.Serialization.cs index bb1b904ef60d..b0365dc59213 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PostgreSqlSource : IUtf8JsonSerializable + public partial class PostgreSqlSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PostgreSqlSource DeserializePostgreSqlSource(JsonElement element) + internal static PostgreSqlSource DeserializePostgreSqlSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static PostgreSqlSource DeserializePostgreSqlSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new PostgreSqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + PostgreSqlSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePostgreSqlSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PostgreSqlSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePostgreSqlSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PostgreSqlSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PostgreSqlSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePostgreSqlSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.cs index e30ebe487dfe..ef03231215d7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for PostgreSQL databases. public partial class PostgreSqlSource : TabularSource { - /// Initializes a new instance of PostgreSqlSource. + /// Initializes a new instance of . public PostgreSqlSource() { CopySourceType = "PostgreSqlSource"; } - /// Initializes a new instance of PostgreSqlSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.Serialization.cs index 87a9fc535096..c167b02bcfc5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PostgreSqlTableDataset : IUtf8JsonSerializable + public partial class PostgreSqlTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PostgreSqlTableDataset DeserializePostgreSqlTableDataset(JsonElement element) + internal static PostgreSqlTableDataset DeserializePostgreSqlTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static PostgreSqlTableDataset DeserializePostgreSqlTableDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new PostgreSqlTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + PostgreSqlTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePostgreSqlTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PostgreSqlTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePostgreSqlTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PostgreSqlTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PostgreSqlTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePostgreSqlTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.cs index 139ce4c17822..2eb7a52cec12 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PostgreSqlTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The PostgreSQL table dataset. public partial class PostgreSqlTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of PostgreSqlTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public PostgreSqlTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public PostgreSqlTableDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "PostgreSqlTable"; } - /// Initializes a new instance of PostgreSqlTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal PostgreSqlTableDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "PostgreSqlTable"; } + /// Initializes a new instance of for deserialization. + internal PostgreSqlTableDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.Serialization.cs index 14594b8ec650..7472562ff5b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PowerQuerySink : IUtf8JsonSerializable + public partial class PowerQuerySink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Script)) { @@ -41,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Dataset)) { writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } } if (Optional.IsDefined(LinkedService)) { @@ -51,13 +66,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Flowlet)) { writer.WritePropertyName("flowlet"u8); - writer.WriteObjectValue(Flowlet); + if (Flowlet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Flowlet).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PowerQuerySink DeserializePowerQuerySink(JsonElement element) + internal static PowerQuerySink DeserializePowerQuerySink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -70,6 +106,7 @@ internal static PowerQuerySink DeserializePowerQuerySink(JsonElement element) Optional dataset = default; Optional linkedService = default; Optional flowlet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("script"u8)) @@ -132,8 +169,61 @@ internal static PowerQuerySink DeserializePowerQuerySink(JsonElement element) flowlet = DataFlowReference.DeserializeDataFlowReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PowerQuerySink(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, rejectedDataLinkedService, script.Value, serializedAdditionalRawData); + } + + PowerQuerySink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePowerQuerySink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PowerQuerySink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePowerQuerySink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PowerQuerySink model) + { + if (model is null) + { + return null; } - return new PowerQuerySink(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, rejectedDataLinkedService, script.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PowerQuerySink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePowerQuerySink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.cs index 19beac1fe4d5..eb106cd4c444 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySink.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Power query sink. public partial class PowerQuerySink : DataFlowSink { - /// Initializes a new instance of PowerQuerySink. + /// Initializes a new instance of . /// Transformation name. /// is null. public PowerQuerySink(string name) : base(name) @@ -22,7 +23,7 @@ public PowerQuerySink(string name) : base(name) Argument.AssertNotNull(name, nameof(name)); } - /// Initializes a new instance of PowerQuerySink. + /// Initializes a new instance of . /// Transformation name. /// Transformation description. /// Dataset reference. @@ -31,11 +32,17 @@ public PowerQuerySink(string name) : base(name) /// Schema linked service reference. /// Rejected data linked service reference. /// sink script. - internal PowerQuerySink(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, DataFactoryLinkedServiceReference rejectedDataLinkedService, string script) : base(name, description, dataset, linkedService, flowlet, schemaLinkedService, rejectedDataLinkedService) + /// Keeps track of any properties unknown to the library. + internal PowerQuerySink(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, DataFactoryLinkedServiceReference rejectedDataLinkedService, string script, Dictionary serializedAdditionalRawData) : base(name, description, dataset, linkedService, flowlet, schemaLinkedService, rejectedDataLinkedService, serializedAdditionalRawData) { Script = script; } + /// Initializes a new instance of for deserialization. + internal PowerQuerySink() + { + } + /// sink script. public string Script { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.Serialization.cs index eaaa75d3ac35..38938a62ecd4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.Serialization.cs @@ -5,16 +5,23 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PowerQuerySinkMapping : IUtf8JsonSerializable + public partial class PowerQuerySinkMapping : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(QueryName)) { @@ -27,21 +34,43 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DataflowSinks) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PowerQuerySinkMapping DeserializePowerQuerySinkMapping(JsonElement element) + internal static PowerQuerySinkMapping DeserializePowerQuerySinkMapping(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional queryName = default; Optional> dataflowSinks = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queryName"u8)) @@ -63,8 +92,61 @@ internal static PowerQuerySinkMapping DeserializePowerQuerySinkMapping(JsonEleme dataflowSinks = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PowerQuerySinkMapping(queryName.Value, Optional.ToList(dataflowSinks), serializedAdditionalRawData); + } + + PowerQuerySinkMapping IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePowerQuerySinkMapping(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PowerQuerySinkMapping IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePowerQuerySinkMapping(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PowerQuerySinkMapping model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PowerQuerySinkMapping(Response response) + { + if (response is null) + { + return null; } - return new PowerQuerySinkMapping(queryName.Value, Optional.ToList(dataflowSinks)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePowerQuerySinkMapping(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.cs index ab7a5178494f..9f5295e6e9cb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySinkMapping.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -13,19 +14,24 @@ namespace Azure.ResourceManager.DataFactory.Models /// Map Power Query mashup query to sink dataset(s). public partial class PowerQuerySinkMapping { - /// Initializes a new instance of PowerQuerySinkMapping. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PowerQuerySinkMapping() { DataflowSinks = new ChangeTrackingList(); } - /// Initializes a new instance of PowerQuerySinkMapping. + /// Initializes a new instance of . /// Name of the query in Power Query mashup document. /// List of sinks mapped to Power Query mashup query. - internal PowerQuerySinkMapping(string queryName, IList dataflowSinks) + /// Keeps track of any properties unknown to the library. + internal PowerQuerySinkMapping(string queryName, IList dataflowSinks, Dictionary serializedAdditionalRawData) { QueryName = queryName; DataflowSinks = dataflowSinks; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Name of the query in Power Query mashup document. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.Serialization.cs index acb9ae6a365b..ef91fd68476a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PowerQuerySource : IUtf8JsonSerializable + public partial class PowerQuerySource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Script)) { @@ -36,7 +44,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Dataset)) { writer.WritePropertyName("dataset"u8); - writer.WriteObjectValue(Dataset); + if (Dataset is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Dataset).Serialize(writer, options); + } } if (Optional.IsDefined(LinkedService)) { @@ -46,13 +61,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Flowlet)) { writer.WritePropertyName("flowlet"u8); - writer.WriteObjectValue(Flowlet); + if (Flowlet is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Flowlet).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static PowerQuerySource DeserializePowerQuerySource(JsonElement element) + internal static PowerQuerySource DeserializePowerQuerySource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -64,6 +100,7 @@ internal static PowerQuerySource DeserializePowerQuerySource(JsonElement element Optional dataset = default; Optional linkedService = default; Optional flowlet = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("script"u8)) @@ -117,8 +154,61 @@ internal static PowerQuerySource DeserializePowerQuerySource(JsonElement element flowlet = DataFlowReference.DeserializeDataFlowReference(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PowerQuerySource(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, script.Value, serializedAdditionalRawData); + } + + PowerQuerySource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePowerQuerySource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PowerQuerySource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePowerQuerySource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PowerQuerySource model) + { + if (model is null) + { + return null; } - return new PowerQuerySource(name, description.Value, dataset.Value, linkedService, flowlet.Value, schemaLinkedService, script.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PowerQuerySource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePowerQuerySource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.cs index 1e375bbbc505..b28468eecc0b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PowerQuerySource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Power query source. public partial class PowerQuerySource : DataFlowSource { - /// Initializes a new instance of PowerQuerySource. + /// Initializes a new instance of . /// Transformation name. /// is null. public PowerQuerySource(string name) : base(name) @@ -22,7 +23,7 @@ public PowerQuerySource(string name) : base(name) Argument.AssertNotNull(name, nameof(name)); } - /// Initializes a new instance of PowerQuerySource. + /// Initializes a new instance of . /// Transformation name. /// Transformation description. /// Dataset reference. @@ -30,11 +31,17 @@ public PowerQuerySource(string name) : base(name) /// Flowlet Reference. /// Schema linked service reference. /// source script. - internal PowerQuerySource(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, string script) : base(name, description, dataset, linkedService, flowlet, schemaLinkedService) + /// Keeps track of any properties unknown to the library. + internal PowerQuerySource(string name, string description, DatasetReference dataset, DataFactoryLinkedServiceReference linkedService, DataFlowReference flowlet, DataFactoryLinkedServiceReference schemaLinkedService, string script, Dictionary serializedAdditionalRawData) : base(name, description, dataset, linkedService, flowlet, schemaLinkedService, serializedAdditionalRawData) { Script = script; } + /// Initializes a new instance of for deserialization. + internal PowerQuerySource() + { + } + /// source script. public string Script { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.Serialization.cs index df415bb17efd..fa08d87d96b6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PrestoLinkedService : IUtf8JsonSerializable + public partial class PrestoLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -133,8 +153,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PrestoLinkedService DeserializePrestoLinkedService(JsonElement element) + internal static PrestoLinkedService DeserializePrestoLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -339,5 +361,53 @@ internal static PrestoLinkedService DeserializePrestoLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new PrestoLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, host, serverVersion, catalog, port.Value, authenticationType, username.Value, password, enableSsl.Value, trustedCertPath.Value, useSystemTrustStore.Value, allowHostNameCNMismatch.Value, allowSelfSignedServerCert.Value, timeZoneId.Value, encryptedCredential.Value); } + + PrestoLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrestoLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrestoLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrestoLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrestoLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrestoLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrestoLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.cs index 6bf931bf0f9d..6b16ae46d6aa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Presto server linked service. public partial class PrestoLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of PrestoLinkedService. + /// Initializes a new instance of . /// The IP address or host name of the Presto server. (i.e. 192.168.222.160). /// The version of the Presto server. (i.e. 0.148-t). /// The catalog context for all request against the server. @@ -34,7 +34,7 @@ public PrestoLinkedService(DataFactoryElement host, DataFactoryElement Initializes a new instance of PrestoLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -74,6 +74,11 @@ internal PrestoLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "Presto"; } + /// Initializes a new instance of for deserialization. + internal PrestoLinkedService() + { + } + /// The IP address or host name of the Presto server. (i.e. 192.168.222.160). public DataFactoryElement Host { get; set; } /// The version of the Presto server. (i.e. 0.148-t). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.Serialization.cs index aa7d71ed1390..69d9967ce6a5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PrestoObjectDataset : IUtf8JsonSerializable + public partial class PrestoObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PrestoObjectDataset DeserializePrestoObjectDataset(JsonElement element) + internal static PrestoObjectDataset DeserializePrestoObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static PrestoObjectDataset DeserializePrestoObjectDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new PrestoObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value, table.Value, schema0.Value); } + + PrestoObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrestoObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrestoObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrestoObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrestoObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrestoObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrestoObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.cs index 0be34bd2cb74..08d2b9521558 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Presto server dataset. public partial class PrestoObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of PrestoObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public PrestoObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public PrestoObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "PrestoObject"; } - /// Initializes a new instance of PrestoObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -46,6 +46,11 @@ internal PrestoObjectDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "PrestoObject"; } + /// Initializes a new instance of for deserialization. + internal PrestoObjectDataset() + { + } + /// /// This property will be retired. Please consider using schema + table properties instead. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.Serialization.cs index dfe7be9dbcae..04d9ebf04499 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PrestoSource : IUtf8JsonSerializable + public partial class PrestoSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static PrestoSource DeserializePrestoSource(JsonElement element) + internal static PrestoSource DeserializePrestoSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static PrestoSource DeserializePrestoSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new PrestoSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + PrestoSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrestoSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrestoSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrestoSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrestoSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrestoSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrestoSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.cs index 8e6529b8fb96..6000d227dbb6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrestoSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Presto server source. public partial class PrestoSource : TabularSource { - /// Initializes a new instance of PrestoSource. + /// Initializes a new instance of . public PrestoSource() { CopySourceType = "PrestoSource"; } - /// Initializes a new instance of PrestoSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.Serialization.cs index d1b22b01b017..8393fb66e79e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.Serialization.cs @@ -5,38 +5,68 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PrivateLinkConnectionApprovalRequest : IUtf8JsonSerializable + public partial class PrivateLinkConnectionApprovalRequest : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState); + if (PrivateLinkServiceConnectionState is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PrivateLinkServiceConnectionState).Serialize(writer, options); + } } if (Optional.IsDefined(PrivateEndpoint)) { writer.WritePropertyName("privateEndpoint"u8); JsonSerializer.Serialize(writer, PrivateEndpoint); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PrivateLinkConnectionApprovalRequest DeserializePrivateLinkConnectionApprovalRequest(JsonElement element) + internal static PrivateLinkConnectionApprovalRequest DeserializePrivateLinkConnectionApprovalRequest(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional privateLinkServiceConnectionState = default; Optional privateEndpoint = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("privateLinkServiceConnectionState"u8)) @@ -57,8 +87,61 @@ internal static PrivateLinkConnectionApprovalRequest DeserializePrivateLinkConne privateEndpoint = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PrivateLinkConnectionApprovalRequest(privateLinkServiceConnectionState.Value, privateEndpoint, serializedAdditionalRawData); + } + + PrivateLinkConnectionApprovalRequest IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateLinkConnectionApprovalRequest(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateLinkConnectionApprovalRequest IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateLinkConnectionApprovalRequest(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateLinkConnectionApprovalRequest model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateLinkConnectionApprovalRequest(Response response) + { + if (response is null) + { + return null; } - return new PrivateLinkConnectionApprovalRequest(privateLinkServiceConnectionState.Value, privateEndpoint); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateLinkConnectionApprovalRequest(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs index bd4ec33811fd..e87bc54337da 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Resources.Models; @@ -13,18 +15,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// A request to approve or reject a private endpoint connection. public partial class PrivateLinkConnectionApprovalRequest { - /// Initializes a new instance of PrivateLinkConnectionApprovalRequest. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PrivateLinkConnectionApprovalRequest() { } - /// Initializes a new instance of PrivateLinkConnectionApprovalRequest. + /// Initializes a new instance of . /// The state of a private link connection. /// The resource of private endpoint. - internal PrivateLinkConnectionApprovalRequest(PrivateLinkConnectionState privateLinkServiceConnectionState, WritableSubResource privateEndpoint) + /// Keeps track of any properties unknown to the library. + internal PrivateLinkConnectionApprovalRequest(PrivateLinkConnectionState privateLinkServiceConnectionState, WritableSubResource privateEndpoint, Dictionary serializedAdditionalRawData) { PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; PrivateEndpoint = privateEndpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of a private link connection. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.Serialization.cs index 1038e9b34a54..bcafe330c561 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class PrivateLinkConnectionState : IUtf8JsonSerializable + public partial class PrivateLinkConnectionState : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Status)) { @@ -30,11 +38,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static PrivateLinkConnectionState DeserializePrivateLinkConnectionState(JsonElement element) + internal static PrivateLinkConnectionState DeserializePrivateLinkConnectionState(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -42,6 +64,7 @@ internal static PrivateLinkConnectionState DeserializePrivateLinkConnectionState Optional status = default; Optional description = default; Optional actionsRequired = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status"u8)) @@ -59,8 +82,61 @@ internal static PrivateLinkConnectionState DeserializePrivateLinkConnectionState actionsRequired = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new PrivateLinkConnectionState(status.Value, description.Value, actionsRequired.Value, serializedAdditionalRawData); + } + + PrivateLinkConnectionState IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateLinkConnectionState(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateLinkConnectionState IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateLinkConnectionState(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateLinkConnectionState model) + { + if (model is null) + { + return null; } - return new PrivateLinkConnectionState(status.Value, description.Value, actionsRequired.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateLinkConnectionState(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateLinkConnectionState(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs index 8fe7ebc9c99d..c54fe760b3dc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs @@ -5,25 +5,33 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// The state of a private link connection. public partial class PrivateLinkConnectionState { - /// Initializes a new instance of PrivateLinkConnectionState. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public PrivateLinkConnectionState() { } - /// Initializes a new instance of PrivateLinkConnectionState. + /// Initializes a new instance of . /// Status of a private link connection. /// Description of a private link connection. /// ActionsRequired for a private link connection. - internal PrivateLinkConnectionState(string status, string description, string actionsRequired) + /// Keeps track of any properties unknown to the library. + internal PrivateLinkConnectionState(string status, string description, string actionsRequired, Dictionary serializedAdditionalRawData) { Status = status; Description = description; ActionsRequired = actionsRequired; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of a private link connection. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.Serialization.cs index 883c10514bc3..dfa0f4ce71ae 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.Serialization.cs @@ -5,21 +5,63 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class PrivateLinkResourcesWrapper + internal partial class PrivateLinkResourcesWrapper : IUtf8JsonSerializable, IModelJsonSerializable { - internal static PrivateLinkResourcesWrapper DeserializePrivateLinkResourcesWrapper(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } + writer.WriteEndObject(); + } + + internal static PrivateLinkResourcesWrapper DeserializePrivateLinkResourcesWrapper(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList value = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -32,8 +74,61 @@ internal static PrivateLinkResourcesWrapper DeserializePrivateLinkResourcesWrapp value = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } } - return new PrivateLinkResourcesWrapper(value); + return new PrivateLinkResourcesWrapper(value, serializedAdditionalRawData); + } + + PrivateLinkResourcesWrapper IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializePrivateLinkResourcesWrapper(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + PrivateLinkResourcesWrapper IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializePrivateLinkResourcesWrapper(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(PrivateLinkResourcesWrapper model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator PrivateLinkResourcesWrapper(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializePrivateLinkResourcesWrapper(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs index 03c31d876fb7..e50e2f5cadb1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Wrapper for a collection of private link resources. internal partial class PrivateLinkResourcesWrapper { - /// Initializes a new instance of PrivateLinkResourcesWrapper. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// /// is null. internal PrivateLinkResourcesWrapper(IEnumerable value) @@ -25,11 +28,18 @@ internal PrivateLinkResourcesWrapper(IEnumerable Value = value.ToList(); } - /// Initializes a new instance of PrivateLinkResourcesWrapper. + /// Initializes a new instance of . /// - internal PrivateLinkResourcesWrapper(IReadOnlyList value) + /// Keeps track of any properties unknown to the library. + internal PrivateLinkResourcesWrapper(IReadOnlyList value, Dictionary serializedAdditionalRawData) { Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PrivateLinkResourcesWrapper() + { } /// Gets the value. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.Serialization.cs index 47603bdf0479..da2ba5a87726 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class QuickBooksLinkedService : IUtf8JsonSerializable + public partial class QuickBooksLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -124,8 +144,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static QuickBooksLinkedService DeserializeQuickBooksLinkedService(JsonElement element) + internal static QuickBooksLinkedService DeserializeQuickBooksLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -296,5 +318,53 @@ internal static QuickBooksLinkedService DeserializeQuickBooksLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new QuickBooksLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionProperties.Value, endpoint.Value, companyId.Value, consumerKey.Value, consumerSecret, accessToken, accessTokenSecret, useEncryptedEndpoints.Value, encryptedCredential.Value); } + + QuickBooksLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuickBooksLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuickBooksLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuickBooksLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuickBooksLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuickBooksLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuickBooksLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.cs index 20b73d23f363..1737e778c011 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// QuickBooks server linked service. public partial class QuickBooksLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of QuickBooksLinkedService. + /// Initializes a new instance of . public QuickBooksLinkedService() { LinkedServiceType = "QuickBooks"; } - /// Initializes a new instance of QuickBooksLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.Serialization.cs index 241bdd61d20c..855962905aad 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class QuickBooksObjectDataset : IUtf8JsonSerializable + public partial class QuickBooksObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static QuickBooksObjectDataset DeserializeQuickBooksObjectDataset(JsonElement element) + internal static QuickBooksObjectDataset DeserializeQuickBooksObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static QuickBooksObjectDataset DeserializeQuickBooksObjectDataset(JsonE additionalProperties = additionalPropertiesDictionary; return new QuickBooksObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + QuickBooksObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuickBooksObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuickBooksObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuickBooksObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuickBooksObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuickBooksObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuickBooksObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.cs index 8d8821fbad25..a40f30070581 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// QuickBooks server dataset. public partial class QuickBooksObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of QuickBooksObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public QuickBooksObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public QuickBooksObjectDataset(DataFactoryLinkedServiceReference linkedServiceNa DatasetType = "QuickBooksObject"; } - /// Initializes a new instance of QuickBooksObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal QuickBooksObjectDataset(string datasetType, string description, DataFac DatasetType = datasetType ?? "QuickBooksObject"; } + /// Initializes a new instance of for deserialization. + internal QuickBooksObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.Serialization.cs index 3b5ebfa754af..75c241362e21 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class QuickBooksSource : IUtf8JsonSerializable + public partial class QuickBooksSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static QuickBooksSource DeserializeQuickBooksSource(JsonElement element) + internal static QuickBooksSource DeserializeQuickBooksSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static QuickBooksSource DeserializeQuickBooksSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new QuickBooksSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + QuickBooksSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuickBooksSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuickBooksSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuickBooksSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuickBooksSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuickBooksSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuickBooksSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.cs index d1636557e2b2..fe4e807ef0be 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickBooksSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity QuickBooks server source. public partial class QuickBooksSource : TabularSource { - /// Initializes a new instance of QuickBooksSource. + /// Initializes a new instance of . public QuickBooksSource() { CopySourceType = "QuickBooksSource"; } - /// Initializes a new instance of QuickBooksSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.Serialization.cs index 567f5e9a69ef..0ddb147a132e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class QuickbaseLinkedService : IUtf8JsonSerializable + public partial class QuickbaseLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -83,8 +103,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static QuickbaseLinkedService DeserializeQuickbaseLinkedService(JsonElement element) + internal static QuickbaseLinkedService DeserializeQuickbaseLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -187,5 +209,53 @@ internal static QuickbaseLinkedService DeserializeQuickbaseLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new QuickbaseLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, userToken, encryptedCredential.Value); } + + QuickbaseLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeQuickbaseLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + QuickbaseLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeQuickbaseLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(QuickbaseLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator QuickbaseLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeQuickbaseLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.cs index 8bac7df0ede8..b452c9a8ae41 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/QuickbaseLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Quickbase. public partial class QuickbaseLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of QuickbaseLinkedService. + /// Initializes a new instance of . /// The url to connect Quickbase source. Type: string (or Expression with resultType string). /// The user token for the Quickbase source. /// or is null. @@ -29,7 +29,7 @@ public QuickbaseLinkedService(DataFactoryElement uri, DataFactorySecretB LinkedServiceType = "Quickbase"; } - /// Initializes a new instance of QuickbaseLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -47,6 +47,11 @@ internal QuickbaseLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "Quickbase"; } + /// Initializes a new instance of for deserialization. + internal QuickbaseLinkedService() + { + } + /// The url to connect Quickbase source. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// The user token for the Quickbase source. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.Serialization.cs index 9fc5fff69fb5..1d10848a375d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RedirectIncompatibleRowSettings : IUtf8JsonSerializable + public partial class RedirectIncompatibleRowSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("linkedServiceName"u8); JsonSerializer.Serialize(writer, LinkedServiceName); @@ -37,8 +43,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RedirectIncompatibleRowSettings DeserializeRedirectIncompatibleRowSettings(JsonElement element) + internal static RedirectIncompatibleRowSettings DeserializeRedirectIncompatibleRowSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -68,5 +76,53 @@ internal static RedirectIncompatibleRowSettings DeserializeRedirectIncompatibleR additionalProperties = additionalPropertiesDictionary; return new RedirectIncompatibleRowSettings(linkedServiceName, path.Value, additionalProperties); } + + RedirectIncompatibleRowSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRedirectIncompatibleRowSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RedirectIncompatibleRowSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRedirectIncompatibleRowSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RedirectIncompatibleRowSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RedirectIncompatibleRowSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRedirectIncompatibleRowSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.cs index d3bc4ab146f4..09604ba8d759 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedirectIncompatibleRowSettings.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Redirect incompatible row settings. public partial class RedirectIncompatibleRowSettings { - /// Initializes a new instance of RedirectIncompatibleRowSettings. + /// Initializes a new instance of . /// Name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked service used for redirecting incompatible row. Must be specified if redirectIncompatibleRowSettings is specified. Type: string (or Expression with resultType string). /// is null. public RedirectIncompatibleRowSettings(DataFactoryElement linkedServiceName) @@ -26,7 +26,7 @@ public RedirectIncompatibleRowSettings(DataFactoryElement linkedServiceN AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of RedirectIncompatibleRowSettings. + /// Initializes a new instance of . /// Name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked service used for redirecting incompatible row. Must be specified if redirectIncompatibleRowSettings is specified. Type: string (or Expression with resultType string). /// The path for storing the redirect incompatible row data. Type: string (or Expression with resultType string). /// Additional Properties. @@ -37,6 +37,11 @@ internal RedirectIncompatibleRowSettings(DataFactoryElement linkedServic AdditionalProperties = additionalProperties; } + /// Initializes a new instance of for deserialization. + internal RedirectIncompatibleRowSettings() + { + } + /// Name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked service used for redirecting incompatible row. Must be specified if redirectIncompatibleRowSettings is specified. Type: string (or Expression with resultType string). public DataFactoryElement LinkedServiceName { get; set; } /// The path for storing the redirect incompatible row data. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.Serialization.cs index 9ed94b4c18ef..f02a00c34396 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.Serialization.cs @@ -5,31 +5,54 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RedshiftUnloadSettings : IUtf8JsonSerializable + public partial class RedshiftUnloadSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("s3LinkedServiceName"u8); JsonSerializer.Serialize(writer, S3LinkedServiceName); writer.WritePropertyName("bucketName"u8); JsonSerializer.Serialize(writer, BucketName); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RedshiftUnloadSettings DeserializeRedshiftUnloadSettings(JsonElement element) + internal static RedshiftUnloadSettings DeserializeRedshiftUnloadSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } DataFactoryLinkedServiceReference s3LinkedServiceName = default; DataFactoryElement bucketName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("s3LinkedServiceName"u8)) @@ -42,8 +65,61 @@ internal static RedshiftUnloadSettings DeserializeRedshiftUnloadSettings(JsonEle bucketName = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RedshiftUnloadSettings(s3LinkedServiceName, bucketName, serializedAdditionalRawData); + } + + RedshiftUnloadSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRedshiftUnloadSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RedshiftUnloadSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRedshiftUnloadSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RedshiftUnloadSettings model) + { + if (model is null) + { + return null; } - return new RedshiftUnloadSettings(s3LinkedServiceName, bucketName); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RedshiftUnloadSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRedshiftUnloadSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.cs index 682e37ba352f..f17f148d4f8f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RedshiftUnloadSettings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -14,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Amazon S3 settings needed for the interim Amazon S3 when copying from Amazon Redshift with unload. With this, data from Amazon Redshift source will be unloaded into S3 first and then copied into the targeted sink from the interim S3. public partial class RedshiftUnloadSettings { - /// Initializes a new instance of RedshiftUnloadSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The name of the Amazon S3 linked service which will be used for the unload operation when copying from the Amazon Redshift source. /// The bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType string). /// or is null. @@ -27,6 +31,22 @@ public RedshiftUnloadSettings(DataFactoryLinkedServiceReference s3LinkedServiceN BucketName = bucketName; } + /// Initializes a new instance of . + /// The name of the Amazon S3 linked service which will be used for the unload operation when copying from the Amazon Redshift source. + /// The bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType string). + /// Keeps track of any properties unknown to the library. + internal RedshiftUnloadSettings(DataFactoryLinkedServiceReference s3LinkedServiceName, DataFactoryElement bucketName, Dictionary serializedAdditionalRawData) + { + S3LinkedServiceName = s3LinkedServiceName; + BucketName = bucketName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedshiftUnloadSettings() + { + } + /// The name of the Amazon S3 linked service which will be used for the unload operation when copying from the Amazon Redshift source. public DataFactoryLinkedServiceReference S3LinkedServiceName { get; set; } /// The bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.Serialization.cs index 45fd95972a1b..900e32e55ca8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RelationalSource : IUtf8JsonSerializable + public partial class RelationalSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -66,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RelationalSource DeserializeRelationalSource(JsonElement element) + internal static RelationalSource DeserializeRelationalSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -147,5 +155,53 @@ internal static RelationalSource DeserializeRelationalSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new RelationalSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, additionalColumns.Value); } + + RelationalSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationalSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationalSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationalSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationalSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationalSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationalSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.cs index dfee486cdae5..9ac81216740c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for various relational databases. public partial class RelationalSource : CopyActivitySource { - /// Initializes a new instance of RelationalSource. + /// Initializes a new instance of . public RelationalSource() { CopySourceType = "RelationalSource"; } - /// Initializes a new instance of RelationalSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.Serialization.cs index d93f6535d94c..e46fcff5d01d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RelationalTableDataset : IUtf8JsonSerializable + public partial class RelationalTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RelationalTableDataset DeserializeRelationalTableDataset(JsonElement element) + internal static RelationalTableDataset DeserializeRelationalTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static RelationalTableDataset DeserializeRelationalTableDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new RelationalTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + RelationalTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRelationalTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RelationalTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRelationalTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RelationalTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RelationalTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRelationalTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.cs index edef56d44c8f..d3fa9aa73044 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RelationalTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The relational table dataset. public partial class RelationalTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of RelationalTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public RelationalTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public RelationalTableDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "RelationalTable"; } - /// Initializes a new instance of RelationalTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal RelationalTableDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "RelationalTable"; } + /// Initializes a new instance of for deserialization. + internal RelationalTableDataset() + { + } + /// The relational table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.Serialization.cs index 35a97bcd2758..2a67a4253890 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RerunTumblingWindowTrigger : IUtf8JsonSerializable + public partial class RerunTumblingWindowTrigger : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(TriggerType); @@ -70,8 +76,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RerunTumblingWindowTrigger DeserializeRerunTumblingWindowTrigger(JsonElement element) + internal static RerunTumblingWindowTrigger DeserializeRerunTumblingWindowTrigger(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -165,5 +173,53 @@ internal static RerunTumblingWindowTrigger DeserializeRerunTumblingWindowTrigger additionalProperties = additionalPropertiesDictionary; return new RerunTumblingWindowTrigger(type, description.Value, Optional.ToNullable(runtimeState), Optional.ToList(annotations), additionalProperties, parentTrigger, requestedStartTime, requestedEndTime, rerunConcurrency); } + + RerunTumblingWindowTrigger IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRerunTumblingWindowTrigger(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RerunTumblingWindowTrigger IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRerunTumblingWindowTrigger(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RerunTumblingWindowTrigger model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RerunTumblingWindowTrigger(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRerunTumblingWindowTrigger(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.cs index 92a5cbbcea0a..25bc7c34bed7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RerunTumblingWindowTrigger.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Trigger that schedules pipeline reruns for all fixed time interval windows from a requested start time to requested end time. public partial class RerunTumblingWindowTrigger : DataFactoryTriggerProperties { - /// Initializes a new instance of RerunTumblingWindowTrigger. + /// Initializes a new instance of . /// The parent trigger reference. /// The start time for the time period for which restatement is initiated. Only UTC time is currently supported. /// The end time for the time period for which restatement is initiated. Only UTC time is currently supported. @@ -31,7 +31,7 @@ public RerunTumblingWindowTrigger(BinaryData parentTrigger, DateTimeOffset reque TriggerType = "RerunTumblingWindowTrigger"; } - /// Initializes a new instance of RerunTumblingWindowTrigger. + /// Initializes a new instance of . /// Trigger type. /// Trigger description. /// Indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. @@ -50,6 +50,11 @@ internal RerunTumblingWindowTrigger(string triggerType, string description, Data TriggerType = triggerType ?? "RerunTumblingWindowTrigger"; } + /// Initializes a new instance of for deserialization. + internal RerunTumblingWindowTrigger() + { + } + /// /// The parent trigger reference. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.Serialization.cs index 08ec69ed00de..3d0b771187c6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ResponsysLinkedService : IUtf8JsonSerializable + public partial class ResponsysLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -108,8 +128,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ResponsysLinkedService DeserializeResponsysLinkedService(JsonElement element) + internal static ResponsysLinkedService DeserializeResponsysLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -252,5 +274,53 @@ internal static ResponsysLinkedService DeserializeResponsysLinkedService(JsonEle additionalProperties = additionalPropertiesDictionary; return new ResponsysLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, clientId, clientSecret, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + ResponsysLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResponsysLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResponsysLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResponsysLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResponsysLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResponsysLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResponsysLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.cs index e9c43cf6d3e4..782b65706e8a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Responsys linked service. public partial class ResponsysLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of ResponsysLinkedService. + /// Initializes a new instance of . /// The endpoint of the Responsys server. /// The client ID associated with the Responsys application. Type: string (or Expression with resultType string). /// or is null. @@ -29,7 +29,7 @@ public ResponsysLinkedService(BinaryData endpoint, DataFactoryElement cl LinkedServiceType = "Responsys"; } - /// Initializes a new instance of ResponsysLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -55,6 +55,11 @@ internal ResponsysLinkedService(string linkedServiceType, IntegrationRuntimeRefe LinkedServiceType = linkedServiceType ?? "Responsys"; } + /// Initializes a new instance of for deserialization. + internal ResponsysLinkedService() + { + } + /// /// The endpoint of the Responsys server. /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.Serialization.cs index d347b24bed23..4202bd3a93ff 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ResponsysObjectDataset : IUtf8JsonSerializable + public partial class ResponsysObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ResponsysObjectDataset DeserializeResponsysObjectDataset(JsonElement element) + internal static ResponsysObjectDataset DeserializeResponsysObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static ResponsysObjectDataset DeserializeResponsysObjectDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new ResponsysObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + ResponsysObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResponsysObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResponsysObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResponsysObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResponsysObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResponsysObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResponsysObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.cs index be5957211b3f..7b4e58974b1f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Responsys dataset. public partial class ResponsysObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ResponsysObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ResponsysObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ResponsysObjectDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "ResponsysObject"; } - /// Initializes a new instance of ResponsysObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal ResponsysObjectDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "ResponsysObject"; } + /// Initializes a new instance of for deserialization. + internal ResponsysObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.Serialization.cs index b0b7459d1dc6..1a85c506de2c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ResponsysSource : IUtf8JsonSerializable + public partial class ResponsysSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ResponsysSource DeserializeResponsysSource(JsonElement element) + internal static ResponsysSource DeserializeResponsysSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static ResponsysSource DeserializeResponsysSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new ResponsysSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + ResponsysSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeResponsysSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ResponsysSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeResponsysSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ResponsysSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ResponsysSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeResponsysSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.cs index fb2aecfebc7b..acde5d5ad8f1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ResponsysSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Responsys source. public partial class ResponsysSource : TabularSource { - /// Initializes a new instance of ResponsysSource. + /// Initializes a new instance of . public ResponsysSource() { CopySourceType = "ResponsysSource"; } - /// Initializes a new instance of ResponsysSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.Serialization.cs index 3c1aeb87bfc1..77997be5e5b9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RestResourceDataset : IUtf8JsonSerializable + public partial class RestResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -141,8 +161,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RestResourceDataset DeserializeRestResourceDataset(JsonElement element) + internal static RestResourceDataset DeserializeRestResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -327,5 +349,53 @@ internal static RestResourceDataset DeserializeRestResourceDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new RestResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, relativeUrl.Value, requestMethod.Value, requestBody.Value, Optional.ToDictionary(additionalHeaders), Optional.ToDictionary(paginationRules)); } + + RestResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.cs index b225c698579b..4a4a2d5cf541 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// A Rest service dataset. public partial class RestResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of RestResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public RestResourceDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -27,7 +27,7 @@ public RestResourceDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "RestResource"; } - /// Initializes a new instance of RestResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -52,6 +52,11 @@ internal RestResourceDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "RestResource"; } + /// Initializes a new instance of for deserialization. + internal RestResourceDataset() + { + } + /// The relative URL to the resource that the RESTful API provides. Type: string (or Expression with resultType string). public DataFactoryElement RelativeUri { get; set; } /// The HTTP method used to call the RESTful API. The default is GET. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.Serialization.cs index 3e26afa932a2..2ad9d25743b9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RestServiceLinkedService : IUtf8JsonSerializable + public partial class RestServiceLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -119,7 +139,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Credential)) { writer.WritePropertyName("credential"u8); - writer.WriteObjectValue(Credential); + if (Credential is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Credential).Serialize(writer, options); + } } if (Optional.IsDefined(ClientId)) { @@ -159,8 +186,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RestServiceLinkedService DeserializeRestServiceLinkedService(JsonElement element) + internal static RestServiceLinkedService DeserializeRestServiceLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -413,5 +442,53 @@ internal static RestServiceLinkedService DeserializeRestServiceLinkedService(Jso additionalProperties = additionalPropertiesDictionary; return new RestServiceLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, enableServerCertificateValidation.Value, authenticationType, userName.Value, password, authHeaders.Value, servicePrincipalId.Value, servicePrincipalKey, tenant.Value, azureCloudType.Value, aadResourceId.Value, encryptedCredential.Value, credential.Value, clientId.Value, clientSecret, tokenEndpoint.Value, resource.Value, scope.Value); } + + RestServiceLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestServiceLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestServiceLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestServiceLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestServiceLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestServiceLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestServiceLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.cs index 48646e5678e5..e1cc6a57e013 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestServiceLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Rest Service linked service. public partial class RestServiceLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of RestServiceLinkedService. + /// Initializes a new instance of . /// The base URL of the REST service. Type: string (or Expression with resultType string). /// Type of authentication used to connect to the REST service. /// is null. @@ -28,7 +28,7 @@ public RestServiceLinkedService(DataFactoryElement uri, RestServiceAuthe LinkedServiceType = "RestService"; } - /// Initializes a new instance of RestServiceLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -76,6 +76,11 @@ internal RestServiceLinkedService(string linkedServiceType, IntegrationRuntimeRe LinkedServiceType = linkedServiceType ?? "RestService"; } + /// Initializes a new instance of for deserialization. + internal RestServiceLinkedService() + { + } + /// The base URL of the REST service. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// Whether to validate server side SSL certificate when connecting to the endpoint.The default value is true. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.Serialization.cs index 8e5fd53446cd..d53f9a2e3b5d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RestSink : IUtf8JsonSerializable + public partial class RestSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RequestMethod)) { @@ -95,8 +101,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RestSink DeserializeRestSink(JsonElement element) + internal static RestSink DeserializeRestSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -226,5 +234,53 @@ internal static RestSink DeserializeRestSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new RestSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, requestMethod.Value, additionalHeaders.Value, httpRequestTimeout.Value, requestInterval.Value, httpCompressionType.Value); } + + RestSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.cs index fa0d1bdf12c0..96b2d7da4a85 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Rest service Sink. public partial class RestSink : CopySink { - /// Initializes a new instance of RestSink. + /// Initializes a new instance of . public RestSink() { CopySinkType = "RestSink"; } - /// Initializes a new instance of RestSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.Serialization.cs index 0cdaf42ef970..0d8c299efe0a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RestSource : IUtf8JsonSerializable + public partial class RestSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RequestMethod)) { @@ -95,8 +101,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RestSource DeserializeRestSource(JsonElement element) + internal static RestSource DeserializeRestSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -226,5 +234,53 @@ internal static RestSource DeserializeRestSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new RestSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, requestMethod.Value, requestBody.Value, additionalHeaders.Value, paginationRules.Value, httpRequestTimeout.Value, requestInterval.Value, additionalColumns.Value); } + + RestSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRestSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RestSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRestSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RestSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RestSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRestSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.cs index 9052502c3037..395f176b4690 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RestSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Rest service source. public partial class RestSource : CopyActivitySource { - /// Initializes a new instance of RestSource. + /// Initializes a new instance of . public RestSource() { CopySourceType = "RestSource"; } - /// Initializes a new instance of RestSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.Serialization.cs index c170e3038798..064e20741cfc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RetryPolicy : IUtf8JsonSerializable + public partial class RetryPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Count)) { @@ -26,17 +34,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("intervalInSeconds"u8); writer.WriteNumberValue(IntervalInSeconds.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static RetryPolicy DeserializeRetryPolicy(JsonElement element) + internal static RetryPolicy DeserializeRetryPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> count = default; Optional intervalInSeconds = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("count"u8)) @@ -57,8 +80,61 @@ internal static RetryPolicy DeserializeRetryPolicy(JsonElement element) intervalInSeconds = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RetryPolicy(count.Value, Optional.ToNullable(intervalInSeconds), serializedAdditionalRawData); + } + + RetryPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRetryPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RetryPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRetryPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RetryPolicy model) + { + if (model is null) + { + return null; } - return new RetryPolicy(count.Value, Optional.ToNullable(intervalInSeconds)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RetryPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRetryPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.cs index 90501247475a..3a688852bc84 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RetryPolicy.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,18 +14,23 @@ namespace Azure.ResourceManager.DataFactory.Models /// Execution policy for an activity. public partial class RetryPolicy { - /// Initializes a new instance of RetryPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public RetryPolicy() { } - /// Initializes a new instance of RetryPolicy. + /// Initializes a new instance of . /// Maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. /// Interval between retries in seconds. Default is 30. - internal RetryPolicy(DataFactoryElement count, int? intervalInSeconds) + /// Keeps track of any properties unknown to the library. + internal RetryPolicy(DataFactoryElement count, int? intervalInSeconds, Dictionary serializedAdditionalRawData) { Count = count; IntervalInSeconds = intervalInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// Maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.Serialization.cs index d38a6b815d42..8cdfbf2eda87 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RunFilterContent : IUtf8JsonSerializable + public partial class RunFilterContent : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ContinuationToken)) { @@ -30,7 +38,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Filters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -40,11 +55,146 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in OrderBy) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RunFilterContent DeserializeRunFilterContent(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional continuationToken = default; + DateTimeOffset lastUpdatedAfter = default; + DateTimeOffset lastUpdatedBefore = default; + Optional> filters = default; + Optional> orderBy = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("continuationToken"u8)) + { + continuationToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastUpdatedAfter"u8)) + { + lastUpdatedAfter = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastUpdatedBefore"u8)) + { + lastUpdatedBefore = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunQueryFilter.DeserializeRunQueryFilter(item)); + } + filters = array; + continue; + } + if (property.NameEquals("orderBy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RunQueryOrderBy.DeserializeRunQueryOrderBy(item)); + } + orderBy = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunFilterContent(continuationToken.Value, lastUpdatedAfter, lastUpdatedBefore, Optional.ToList(filters), Optional.ToList(orderBy), serializedAdditionalRawData); + } + + RunFilterContent IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunFilterContent(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunFilterContent IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunFilterContent(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunFilterContent model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunFilterContent(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunFilterContent(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.cs index dcd57c1c740f..10c47a3b4ae3 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunFilterContent.cs @@ -14,7 +14,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Query parameters for listing runs. public partial class RunFilterContent { - /// Initializes a new instance of RunFilterContent. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The time at or after which the run event was updated in 'ISO 8601' format. /// The time at or before which the run event was updated in 'ISO 8601' format. public RunFilterContent(DateTimeOffset lastUpdatedAfter, DateTimeOffset lastUpdatedBefore) @@ -25,6 +28,28 @@ public RunFilterContent(DateTimeOffset lastUpdatedAfter, DateTimeOffset lastUpda OrderBy = new ChangeTrackingList(); } + /// Initializes a new instance of . + /// The continuation token for getting the next page of results. Null for first page. + /// The time at or after which the run event was updated in 'ISO 8601' format. + /// The time at or before which the run event was updated in 'ISO 8601' format. + /// List of filters. + /// List of OrderBy option. + /// Keeps track of any properties unknown to the library. + internal RunFilterContent(string continuationToken, DateTimeOffset lastUpdatedAfter, DateTimeOffset lastUpdatedBefore, IList filters, IList orderBy, Dictionary serializedAdditionalRawData) + { + ContinuationToken = continuationToken; + LastUpdatedAfter = lastUpdatedAfter; + LastUpdatedBefore = lastUpdatedBefore; + Filters = filters; + OrderBy = orderBy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunFilterContent() + { + } + /// The continuation token for getting the next page of results. Null for first page. public string ContinuationToken { get; set; } /// The time at or after which the run event was updated in 'ISO 8601' format. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.Serialization.cs index 80415520953f..a6c973560fdb 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RunQueryFilter : IUtf8JsonSerializable + public partial class RunQueryFilter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("operand"u8); writer.WriteStringValue(Operand.ToString()); @@ -26,7 +34,110 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(item); } writer.WriteEndArray(); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RunQueryFilter DeserializeRunQueryFilter(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunQueryFilterOperand operand = default; + RunQueryFilterOperator @operator = default; + IList values = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operand"u8)) + { + operand = new RunQueryFilterOperand(property.Value.GetString()); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = new RunQueryFilterOperator(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunQueryFilter(operand, @operator, values, serializedAdditionalRawData); + } + + RunQueryFilter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunQueryFilter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunQueryFilter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunQueryFilter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunQueryFilter model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunQueryFilter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunQueryFilter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.cs index 5dae55cc6d93..754706217288 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryFilter.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Query filter option for listing runs. public partial class RunQueryFilter { - /// Initializes a new instance of RunQueryFilter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Parameter name to be used for filter. The allowed operands to query pipeline runs are PipelineName, RunStart, RunEnd and Status; to query activity runs are ActivityName, ActivityRunStart, ActivityRunEnd, ActivityType and Status, and to query trigger runs are TriggerName, TriggerRunTimestamp and Status. /// Operator to be used for filter. /// List of filter values. @@ -29,6 +32,24 @@ public RunQueryFilter(RunQueryFilterOperand operand, RunQueryFilterOperator @ope Values = values.ToList(); } + /// Initializes a new instance of . + /// Parameter name to be used for filter. The allowed operands to query pipeline runs are PipelineName, RunStart, RunEnd and Status; to query activity runs are ActivityName, ActivityRunStart, ActivityRunEnd, ActivityType and Status, and to query trigger runs are TriggerName, TriggerRunTimestamp and Status. + /// Operator to be used for filter. + /// List of filter values. + /// Keeps track of any properties unknown to the library. + internal RunQueryFilter(RunQueryFilterOperand operand, RunQueryFilterOperator @operator, IList values, Dictionary serializedAdditionalRawData) + { + Operand = operand; + Operator = @operator; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunQueryFilter() + { + } + /// Parameter name to be used for filter. The allowed operands to query pipeline runs are PipelineName, RunStart, RunEnd and Status; to query activity runs are ActivityName, ActivityRunStart, ActivityRunEnd, ActivityType and Status, and to query trigger runs are TriggerName, TriggerRunTimestamp and Status. public RunQueryFilterOperand Operand { get; } /// Operator to be used for filter. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.Serialization.cs index ba34eaab7adf..4d56004af084 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.Serialization.cs @@ -5,21 +5,121 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class RunQueryOrderBy : IUtf8JsonSerializable + public partial class RunQueryOrderBy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("orderBy"u8); writer.WriteStringValue(OrderBy.ToString()); writer.WritePropertyName("order"u8); writer.WriteStringValue(Order.ToString()); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } + + internal static RunQueryOrderBy DeserializeRunQueryOrderBy(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RunQueryOrderByField orderBy = default; + RunQueryOrder order = default; + Dictionary serializedAdditionalRawData = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("orderBy"u8)) + { + orderBy = new RunQueryOrderByField(property.Value.GetString()); + continue; + } + if (property.NameEquals("order"u8)) + { + order = new RunQueryOrder(property.Value.GetString()); + continue; + } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new RunQueryOrderBy(orderBy, order, serializedAdditionalRawData); + } + + RunQueryOrderBy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeRunQueryOrderBy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + RunQueryOrderBy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeRunQueryOrderBy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(RunQueryOrderBy model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator RunQueryOrderBy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeRunQueryOrderBy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.cs index 721cce430323..7bd99125b6db 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/RunQueryOrderBy.cs @@ -5,12 +5,18 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// An object to provide order by options for listing runs. public partial class RunQueryOrderBy { - /// Initializes a new instance of RunQueryOrderBy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// Parameter name to be used for order by. The allowed parameters to order by for pipeline runs are PipelineName, RunStart, RunEnd and Status; for activity runs are ActivityName, ActivityRunStart, ActivityRunEnd and Status; for trigger runs are TriggerName, TriggerRunTimestamp and Status. /// Sorting order of the parameter. public RunQueryOrderBy(RunQueryOrderByField orderBy, RunQueryOrder order) @@ -19,6 +25,22 @@ public RunQueryOrderBy(RunQueryOrderByField orderBy, RunQueryOrder order) Order = order; } + /// Initializes a new instance of . + /// Parameter name to be used for order by. The allowed parameters to order by for pipeline runs are PipelineName, RunStart, RunEnd and Status; for activity runs are ActivityName, ActivityRunStart, ActivityRunEnd and Status; for trigger runs are TriggerName, TriggerRunTimestamp and Status. + /// Sorting order of the parameter. + /// Keeps track of any properties unknown to the library. + internal RunQueryOrderBy(RunQueryOrderByField orderBy, RunQueryOrder order, Dictionary serializedAdditionalRawData) + { + OrderBy = orderBy; + Order = order; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RunQueryOrderBy() + { + } + /// Parameter name to be used for order by. The allowed parameters to order by for pipeline runs are PipelineName, RunStart, RunEnd and Status; for activity runs are ActivityName, ActivityRunStart, ActivityRunEnd and Status; for trigger runs are TriggerName, TriggerRunTimestamp and Status. public RunQueryOrderByField OrderBy { get; } /// Sorting order of the parameter. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.Serialization.cs index 0974933b1dfe..f2eb50f896e9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceLinkedService : IUtf8JsonSerializable + public partial class SalesforceLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceLinkedService DeserializeSalesforceLinkedService(JsonElement element) + internal static SalesforceLinkedService DeserializeSalesforceLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static SalesforceLinkedService DeserializeSalesforceLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new SalesforceLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, environmentUrl.Value, username.Value, password, securityToken, apiVersion.Value, encryptedCredential.Value); } + + SalesforceLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.cs index e17082d58e8a..203448e68f27 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Salesforce. public partial class SalesforceLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SalesforceLinkedService. + /// Initializes a new instance of . public SalesforceLinkedService() { LinkedServiceType = "Salesforce"; } - /// Initializes a new instance of SalesforceLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.Serialization.cs index cb3da818c781..166ddd6a003c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceMarketingCloudLinkedService : IUtf8JsonSerializable + public partial class SalesforceMarketingCloudLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -114,8 +134,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceMarketingCloudLinkedService DeserializeSalesforceMarketingCloudLinkedService(JsonElement element) + internal static SalesforceMarketingCloudLinkedService DeserializeSalesforceMarketingCloudLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -266,5 +288,53 @@ internal static SalesforceMarketingCloudLinkedService DeserializeSalesforceMarke additionalProperties = additionalPropertiesDictionary; return new SalesforceMarketingCloudLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionProperties.Value, clientId.Value, clientSecret, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + SalesforceMarketingCloudLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceMarketingCloudLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceMarketingCloudLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceMarketingCloudLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceMarketingCloudLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceMarketingCloudLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceMarketingCloudLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.cs index 005dc976567c..f33e0767cf32 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Salesforce Marketing Cloud linked service. public partial class SalesforceMarketingCloudLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SalesforceMarketingCloudLinkedService. + /// Initializes a new instance of . public SalesforceMarketingCloudLinkedService() { LinkedServiceType = "SalesforceMarketingCloud"; } - /// Initializes a new instance of SalesforceMarketingCloudLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.Serialization.cs index 94f4b5b35d7d..ac2557edf553 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceMarketingCloudObjectDataset : IUtf8JsonSerializable + public partial class SalesforceMarketingCloudObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceMarketingCloudObjectDataset DeserializeSalesforceMarketingCloudObjectDataset(JsonElement element) + internal static SalesforceMarketingCloudObjectDataset DeserializeSalesforceMarketingCloudObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static SalesforceMarketingCloudObjectDataset DeserializeSalesforceMarke additionalProperties = additionalPropertiesDictionary; return new SalesforceMarketingCloudObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + SalesforceMarketingCloudObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceMarketingCloudObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceMarketingCloudObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceMarketingCloudObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceMarketingCloudObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceMarketingCloudObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceMarketingCloudObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.cs index 725932e3368c..5f21a79ab99d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Salesforce Marketing Cloud dataset. public partial class SalesforceMarketingCloudObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SalesforceMarketingCloudObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public SalesforceMarketingCloudObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public SalesforceMarketingCloudObjectDataset(DataFactoryLinkedServiceReference l DatasetType = "SalesforceMarketingCloudObject"; } - /// Initializes a new instance of SalesforceMarketingCloudObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal SalesforceMarketingCloudObjectDataset(string datasetType, string descri DatasetType = datasetType ?? "SalesforceMarketingCloudObject"; } + /// Initializes a new instance of for deserialization. + internal SalesforceMarketingCloudObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.Serialization.cs index 90aabc4b80bf..5e5168ad6319 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceMarketingCloudSource : IUtf8JsonSerializable + public partial class SalesforceMarketingCloudSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceMarketingCloudSource DeserializeSalesforceMarketingCloudSource(JsonElement element) + internal static SalesforceMarketingCloudSource DeserializeSalesforceMarketingCloudSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static SalesforceMarketingCloudSource DeserializeSalesforceMarketingClo additionalProperties = additionalPropertiesDictionary; return new SalesforceMarketingCloudSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + SalesforceMarketingCloudSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceMarketingCloudSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceMarketingCloudSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceMarketingCloudSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceMarketingCloudSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceMarketingCloudSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceMarketingCloudSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.cs index 9dd7fc1e554c..a0eba7e938b8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceMarketingCloudSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Salesforce Marketing Cloud source. public partial class SalesforceMarketingCloudSource : TabularSource { - /// Initializes a new instance of SalesforceMarketingCloudSource. + /// Initializes a new instance of . public SalesforceMarketingCloudSource() { CopySourceType = "SalesforceMarketingCloudSource"; } - /// Initializes a new instance of SalesforceMarketingCloudSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.Serialization.cs index 56119648fc4b..7cf3f221f4ff 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceObjectDataset : IUtf8JsonSerializable + public partial class SalesforceObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceObjectDataset DeserializeSalesforceObjectDataset(JsonElement element) + internal static SalesforceObjectDataset DeserializeSalesforceObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static SalesforceObjectDataset DeserializeSalesforceObjectDataset(JsonE additionalProperties = additionalPropertiesDictionary; return new SalesforceObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, objectApiName.Value); } + + SalesforceObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.cs index 24bc4689cdf7..f9810c63ab64 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Salesforce object dataset. public partial class SalesforceObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SalesforceObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public SalesforceObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public SalesforceObjectDataset(DataFactoryLinkedServiceReference linkedServiceNa DatasetType = "SalesforceObject"; } - /// Initializes a new instance of SalesforceObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal SalesforceObjectDataset(string datasetType, string description, DataFac DatasetType = datasetType ?? "SalesforceObject"; } + /// Initializes a new instance of for deserialization. + internal SalesforceObjectDataset() + { + } + /// The Salesforce object API name. Type: string (or Expression with resultType string). public DataFactoryElement ObjectApiName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.Serialization.cs index 994da8949334..a42b75a18372 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceServiceCloudLinkedService : IUtf8JsonSerializable + public partial class SalesforceServiceCloudLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -110,8 +130,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceServiceCloudLinkedService DeserializeSalesforceServiceCloudLinkedService(JsonElement element) + internal static SalesforceServiceCloudLinkedService DeserializeSalesforceServiceCloudLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -262,5 +284,53 @@ internal static SalesforceServiceCloudLinkedService DeserializeSalesforceService additionalProperties = additionalPropertiesDictionary; return new SalesforceServiceCloudLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, environmentUrl.Value, username.Value, password, securityToken, apiVersion.Value, extendedProperties.Value, encryptedCredential.Value); } + + SalesforceServiceCloudLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceServiceCloudLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceServiceCloudLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceServiceCloudLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceServiceCloudLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceServiceCloudLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceServiceCloudLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.cs index 91629844a39c..a4703e8fb3ef 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for Salesforce Service Cloud. public partial class SalesforceServiceCloudLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SalesforceServiceCloudLinkedService. + /// Initializes a new instance of . public SalesforceServiceCloudLinkedService() { LinkedServiceType = "SalesforceServiceCloud"; } - /// Initializes a new instance of SalesforceServiceCloudLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.Serialization.cs index b7ee9f95a3f1..8e65a1038b9a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceServiceCloudObjectDataset : IUtf8JsonSerializable + public partial class SalesforceServiceCloudObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceServiceCloudObjectDataset DeserializeSalesforceServiceCloudObjectDataset(JsonElement element) + internal static SalesforceServiceCloudObjectDataset DeserializeSalesforceServiceCloudObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static SalesforceServiceCloudObjectDataset DeserializeSalesforceService additionalProperties = additionalPropertiesDictionary; return new SalesforceServiceCloudObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, objectApiName.Value); } + + SalesforceServiceCloudObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceServiceCloudObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceServiceCloudObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceServiceCloudObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceServiceCloudObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceServiceCloudObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceServiceCloudObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.cs index bf1d412ae1eb..1b8d1f6ab4f7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The Salesforce Service Cloud object dataset. public partial class SalesforceServiceCloudObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SalesforceServiceCloudObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public SalesforceServiceCloudObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public SalesforceServiceCloudObjectDataset(DataFactoryLinkedServiceReference lin DatasetType = "SalesforceServiceCloudObject"; } - /// Initializes a new instance of SalesforceServiceCloudObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal SalesforceServiceCloudObjectDataset(string datasetType, string descript DatasetType = datasetType ?? "SalesforceServiceCloudObject"; } + /// Initializes a new instance of for deserialization. + internal SalesforceServiceCloudObjectDataset() + { + } + /// The Salesforce Service Cloud object API name. Type: string (or Expression with resultType string). public DataFactoryElement ObjectApiName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.Serialization.cs index a3c0bc598f2c..b80adabb0437 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceServiceCloudSink : IUtf8JsonSerializable + public partial class SalesforceServiceCloudSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -77,8 +83,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceServiceCloudSink DeserializeSalesforceServiceCloudSink(JsonElement element) + internal static SalesforceServiceCloudSink DeserializeSalesforceServiceCloudSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -188,5 +196,53 @@ internal static SalesforceServiceCloudSink DeserializeSalesforceServiceCloudSink additionalProperties = additionalPropertiesDictionary; return new SalesforceServiceCloudSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, Optional.ToNullable(writeBehavior), externalIdFieldName.Value, ignoreNullValues.Value); } + + SalesforceServiceCloudSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceServiceCloudSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceServiceCloudSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceServiceCloudSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceServiceCloudSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceServiceCloudSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceServiceCloudSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.cs index 26babdb89e44..097937926889 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Salesforce Service Cloud sink. public partial class SalesforceServiceCloudSink : CopySink { - /// Initializes a new instance of SalesforceServiceCloudSink. + /// Initializes a new instance of . public SalesforceServiceCloudSink() { CopySinkType = "SalesforceServiceCloudSink"; } - /// Initializes a new instance of SalesforceServiceCloudSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.Serialization.cs index 1bc9a2b04b85..4b16ff5766b7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceServiceCloudSource : IUtf8JsonSerializable + public partial class SalesforceServiceCloudSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceServiceCloudSource DeserializeSalesforceServiceCloudSource(JsonElement element) + internal static SalesforceServiceCloudSource DeserializeSalesforceServiceCloudSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static SalesforceServiceCloudSource DeserializeSalesforceServiceCloudSo additionalProperties = additionalPropertiesDictionary; return new SalesforceServiceCloudSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, query.Value, readBehavior.Value, additionalColumns.Value); } + + SalesforceServiceCloudSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceServiceCloudSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceServiceCloudSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceServiceCloudSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceServiceCloudSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceServiceCloudSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceServiceCloudSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.cs index 680952bbca2f..4e7e240983d1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceServiceCloudSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Salesforce Service Cloud source. public partial class SalesforceServiceCloudSource : CopyActivitySource { - /// Initializes a new instance of SalesforceServiceCloudSource. + /// Initializes a new instance of . public SalesforceServiceCloudSource() { CopySourceType = "SalesforceServiceCloudSource"; } - /// Initializes a new instance of SalesforceServiceCloudSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.Serialization.cs index 80c06b4db831..0fbb185fcf16 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceSink : IUtf8JsonSerializable + public partial class SalesforceSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -77,8 +83,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceSink DeserializeSalesforceSink(JsonElement element) + internal static SalesforceSink DeserializeSalesforceSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -188,5 +196,53 @@ internal static SalesforceSink DeserializeSalesforceSink(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new SalesforceSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, Optional.ToNullable(writeBehavior), externalIdFieldName.Value, ignoreNullValues.Value); } + + SalesforceSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.cs index 79601ec9c3f1..8026831d1089 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Salesforce sink. public partial class SalesforceSink : CopySink { - /// Initializes a new instance of SalesforceSink. + /// Initializes a new instance of . public SalesforceSink() { CopySinkType = "SalesforceSink"; } - /// Initializes a new instance of SalesforceSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.Serialization.cs index 519b61a4da2e..c3bee6cdbb8c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SalesforceSource : IUtf8JsonSerializable + public partial class SalesforceSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SalesforceSource DeserializeSalesforceSource(JsonElement element) + internal static SalesforceSource DeserializeSalesforceSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static SalesforceSource DeserializeSalesforceSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new SalesforceSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, readBehavior.Value); } + + SalesforceSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSalesforceSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SalesforceSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSalesforceSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SalesforceSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SalesforceSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSalesforceSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.cs index 83803c0fec68..629d731b35de 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SalesforceSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity Salesforce source. public partial class SalesforceSource : TabularSource { - /// Initializes a new instance of SalesforceSource. + /// Initializes a new instance of . public SalesforceSource() { CopySourceType = "SalesforceSource"; } - /// Initializes a new instance of SalesforceSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.Serialization.cs index aecded013d2a..2dbc4715caa6 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapBWCubeDataset : IUtf8JsonSerializable + public partial class SapBWCubeDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -83,8 +103,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapBWCubeDataset DeserializeSapBWCubeDataset(JsonElement element) + internal static SapBWCubeDataset DeserializeSapBWCubeDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -183,5 +205,53 @@ internal static SapBWCubeDataset DeserializeSapBWCubeDataset(JsonElement element additionalProperties = additionalPropertiesDictionary; return new SapBWCubeDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties); } + + SapBWCubeDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapBWCubeDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapBWCubeDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapBWCubeDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapBWCubeDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapBWCubeDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapBWCubeDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.cs index 32093578c2f0..ceb76df4c317 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWCubeDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The SAP BW cube dataset. public partial class SapBWCubeDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapBWCubeDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public SapBWCubeDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public SapBWCubeDataset(DataFactoryLinkedServiceReference linkedServiceName) : b DatasetType = "SapBwCube"; } - /// Initializes a new instance of SapBWCubeDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -39,5 +39,10 @@ internal SapBWCubeDataset(string datasetType, string description, DataFactoryEle { DatasetType = datasetType ?? "SapBwCube"; } + + /// Initializes a new instance of for deserialization. + internal SapBWCubeDataset() + { + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.Serialization.cs index 3ea14473deed..6d660fdfcd60 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapBWLinkedService : IUtf8JsonSerializable + public partial class SapBWLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapBWLinkedService DeserializeSapBWLinkedService(JsonElement element) + internal static SapBWLinkedService DeserializeSapBWLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -226,5 +248,53 @@ internal static SapBWLinkedService DeserializeSapBWLinkedService(JsonElement ele additionalProperties = additionalPropertiesDictionary; return new SapBWLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, server, systemNumber, clientId, userName.Value, password, encryptedCredential.Value); } + + SapBWLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapBWLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapBWLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapBWLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapBWLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapBWLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapBWLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.cs index 575491ee714d..b25003b42b91 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP Business Warehouse Linked Service. public partial class SapBWLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapBWLinkedService. + /// Initializes a new instance of . /// Host name of the SAP BW instance. Type: string (or Expression with resultType string). /// System number of the BW system. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string). /// Client ID of the client on the BW system. (Usually a three-digit decimal number represented as a string) Type: string (or Expression with resultType string). @@ -32,7 +32,7 @@ public SapBWLinkedService(DataFactoryElement server, DataFactoryElement< LinkedServiceType = "SapBW"; } - /// Initializes a new instance of SapBWLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -56,6 +56,11 @@ internal SapBWLinkedService(string linkedServiceType, IntegrationRuntimeReferenc LinkedServiceType = linkedServiceType ?? "SapBW"; } + /// Initializes a new instance of for deserialization. + internal SapBWLinkedService() + { + } + /// Host name of the SAP BW instance. Type: string (or Expression with resultType string). public DataFactoryElement Server { get; set; } /// System number of the BW system. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.Serialization.cs index 8140ef929139..546f9796a174 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapBWSource : IUtf8JsonSerializable + public partial class SapBWSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapBWSource DeserializeSapBWSource(JsonElement element) + internal static SapBWSource DeserializeSapBWSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static SapBWSource DeserializeSapBWSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new SapBWSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + SapBWSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapBWSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapBWSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapBWSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapBWSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapBWSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapBWSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.cs index 1c0fd640b4c2..2abf71738e1f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapBWSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SapBW server via MDX. public partial class SapBWSource : TabularSource { - /// Initializes a new instance of SapBWSource. + /// Initializes a new instance of . public SapBWSource() { CopySourceType = "SapBwSource"; } - /// Initializes a new instance of SapBWSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.Serialization.cs index 58b310b2f587..93d78ac4be98 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapCloudForCustomerLinkedService : IUtf8JsonSerializable + public partial class SapCloudForCustomerLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -92,8 +112,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapCloudForCustomerLinkedService DeserializeSapCloudForCustomerLinkedService(JsonElement element) + internal static SapCloudForCustomerLinkedService DeserializeSapCloudForCustomerLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -210,5 +232,53 @@ internal static SapCloudForCustomerLinkedService DeserializeSapCloudForCustomerL additionalProperties = additionalPropertiesDictionary; return new SapCloudForCustomerLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, username.Value, password, encryptedCredential.Value); } + + SapCloudForCustomerLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapCloudForCustomerLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapCloudForCustomerLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapCloudForCustomerLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapCloudForCustomerLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapCloudForCustomerLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapCloudForCustomerLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.cs index 8a8042cc1ee7..d23651916993 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for SAP Cloud for Customer. public partial class SapCloudForCustomerLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapCloudForCustomerLinkedService. + /// Initializes a new instance of . /// The URL of SAP Cloud for Customer OData API. For example, '[https://[tenantname].crm.ondemand.com/sap/c4c/odata/v1]'. Type: string (or Expression with resultType string). /// is null. public SapCloudForCustomerLinkedService(DataFactoryElement uri) @@ -26,7 +26,7 @@ public SapCloudForCustomerLinkedService(DataFactoryElement uri) LinkedServiceType = "SapCloudForCustomer"; } - /// Initializes a new instance of SapCloudForCustomerLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -46,6 +46,11 @@ internal SapCloudForCustomerLinkedService(string linkedServiceType, IntegrationR LinkedServiceType = linkedServiceType ?? "SapCloudForCustomer"; } + /// Initializes a new instance of for deserialization. + internal SapCloudForCustomerLinkedService() + { + } + /// The URL of SAP Cloud for Customer OData API. For example, '[https://[tenantname].crm.ondemand.com/sap/c4c/odata/v1]'. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// The username for Basic authentication. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.Serialization.cs index 0f10975e1dd9..1d405eb9f7c2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapCloudForCustomerResourceDataset : IUtf8JsonSerializable + public partial class SapCloudForCustomerResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapCloudForCustomerResourceDataset DeserializeSapCloudForCustomerResourceDataset(JsonElement element) + internal static SapCloudForCustomerResourceDataset DeserializeSapCloudForCustomerResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static SapCloudForCustomerResourceDataset DeserializeSapCloudForCustome additionalProperties = additionalPropertiesDictionary; return new SapCloudForCustomerResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, path); } + + SapCloudForCustomerResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapCloudForCustomerResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapCloudForCustomerResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapCloudForCustomerResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapCloudForCustomerResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapCloudForCustomerResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapCloudForCustomerResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.cs index bb1ade26d99e..83f6b1674f48 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The path of the SAP Cloud for Customer OData entity. public partial class SapCloudForCustomerResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapCloudForCustomerResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// The path of the SAP Cloud for Customer OData entity. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public SapCloudForCustomerResourceDataset(DataFactoryLinkedServiceReference link DatasetType = "SapCloudForCustomerResource"; } - /// Initializes a new instance of SapCloudForCustomerResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal SapCloudForCustomerResourceDataset(string datasetType, string descripti DatasetType = datasetType ?? "SapCloudForCustomerResource"; } + /// Initializes a new instance of for deserialization. + internal SapCloudForCustomerResourceDataset() + { + } + /// The path of the SAP Cloud for Customer OData entity. Type: string (or Expression with resultType string). public DataFactoryElement Path { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.Serialization.cs index 831bc2ad8324..bfcde0d126f8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapCloudForCustomerSink : IUtf8JsonSerializable + public partial class SapCloudForCustomerSink : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(WriteBehavior)) { @@ -72,8 +78,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapCloudForCustomerSink DeserializeSapCloudForCustomerSink(JsonElement element) + internal static SapCloudForCustomerSink DeserializeSapCloudForCustomerSink(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +181,53 @@ internal static SapCloudForCustomerSink DeserializeSapCloudForCustomerSink(JsonE additionalProperties = additionalPropertiesDictionary; return new SapCloudForCustomerSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, Optional.ToNullable(writeBehavior), httpRequestTimeout.Value); } + + SapCloudForCustomerSink IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapCloudForCustomerSink(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapCloudForCustomerSink IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapCloudForCustomerSink(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapCloudForCustomerSink model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapCloudForCustomerSink(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapCloudForCustomerSink(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.cs index a361e06bc4a0..1eeac1fb70f9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSink.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity SAP Cloud for Customer sink. public partial class SapCloudForCustomerSink : CopySink { - /// Initializes a new instance of SapCloudForCustomerSink. + /// Initializes a new instance of . public SapCloudForCustomerSink() { CopySinkType = "SapCloudForCustomerSink"; } - /// Initializes a new instance of SapCloudForCustomerSink. + /// Initializes a new instance of . /// Copy sink type. /// Write batch size. Type: integer (or Expression with resultType integer), minimum: 0. /// Write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.Serialization.cs index 3fbc5c319782..6b49e948e058 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapCloudForCustomerSource : IUtf8JsonSerializable + public partial class SapCloudForCustomerSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapCloudForCustomerSource DeserializeSapCloudForCustomerSource(JsonElement element) + internal static SapCloudForCustomerSource DeserializeSapCloudForCustomerSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static SapCloudForCustomerSource DeserializeSapCloudForCustomerSource(J additionalProperties = additionalPropertiesDictionary; return new SapCloudForCustomerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, httpRequestTimeout.Value); } + + SapCloudForCustomerSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapCloudForCustomerSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapCloudForCustomerSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapCloudForCustomerSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapCloudForCustomerSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapCloudForCustomerSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapCloudForCustomerSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.cs index ddf4d5402c29..9d89f785086d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapCloudForCustomerSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SAP Cloud for Customer source. public partial class SapCloudForCustomerSource : TabularSource { - /// Initializes a new instance of SapCloudForCustomerSource. + /// Initializes a new instance of . public SapCloudForCustomerSource() { CopySourceType = "SapCloudForCustomerSource"; } - /// Initializes a new instance of SapCloudForCustomerSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.Serialization.cs index f208a8083493..7f66cf482157 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapEccLinkedService : IUtf8JsonSerializable + public partial class SapEccLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -92,8 +112,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapEccLinkedService DeserializeSapEccLinkedService(JsonElement element) + internal static SapEccLinkedService DeserializeSapEccLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -210,5 +232,53 @@ internal static SapEccLinkedService DeserializeSapEccLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new SapEccLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, url, username.Value, password, encryptedCredential.Value); } + + SapEccLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapEccLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapEccLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapEccLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapEccLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapEccLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapEccLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.cs index 057629ff7c1a..14c0c191cee9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Linked service for SAP ERP Central Component(SAP ECC). public partial class SapEccLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapEccLinkedService. + /// Initializes a new instance of . /// The URL of SAP ECC OData API. For example, '[https://hostname:port/sap/opu/odata/sap/servicename/]'. Type: string (or Expression with resultType string). /// is null. public SapEccLinkedService(DataFactoryElement uri) @@ -26,7 +26,7 @@ public SapEccLinkedService(DataFactoryElement uri) LinkedServiceType = "SapEcc"; } - /// Initializes a new instance of SapEccLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -46,6 +46,11 @@ internal SapEccLinkedService(string linkedServiceType, IntegrationRuntimeReferen LinkedServiceType = linkedServiceType ?? "SapEcc"; } + /// Initializes a new instance of for deserialization. + internal SapEccLinkedService() + { + } + /// The URL of SAP ECC OData API. For example, '[https://hostname:port/sap/opu/odata/sap/servicename/]'. Type: string (or Expression with resultType string). public DataFactoryElement Uri { get; set; } /// The username for Basic authentication. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.Serialization.cs index 761131639649..e664aa6f2816 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapEccResourceDataset : IUtf8JsonSerializable + public partial class SapEccResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapEccResourceDataset DeserializeSapEccResourceDataset(JsonElement element) + internal static SapEccResourceDataset DeserializeSapEccResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static SapEccResourceDataset DeserializeSapEccResourceDataset(JsonEleme additionalProperties = additionalPropertiesDictionary; return new SapEccResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, path); } + + SapEccResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapEccResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapEccResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapEccResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapEccResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapEccResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapEccResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.cs index 0a20e9b1101e..f380fa8ea861 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// The path of the SAP ECC OData entity. public partial class SapEccResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapEccResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// The path of the SAP ECC OData entity. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public SapEccResourceDataset(DataFactoryLinkedServiceReference linkedServiceName DatasetType = "SapEccResource"; } - /// Initializes a new instance of SapEccResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal SapEccResourceDataset(string datasetType, string description, DataFacto DatasetType = datasetType ?? "SapEccResource"; } + /// Initializes a new instance of for deserialization. + internal SapEccResourceDataset() + { + } + /// The path of the SAP ECC OData entity. Type: string (or Expression with resultType string). public DataFactoryElement Path { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.Serialization.cs index c90c262b859c..45ab2443d31e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapEccSource : IUtf8JsonSerializable + public partial class SapEccSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -76,8 +82,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapEccSource DeserializeSapEccSource(JsonElement element) + internal static SapEccSource DeserializeSapEccSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -177,5 +185,53 @@ internal static SapEccSource DeserializeSapEccSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new SapEccSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, httpRequestTimeout.Value); } + + SapEccSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapEccSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapEccSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapEccSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapEccSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapEccSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapEccSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.cs index a8bc8c3b194c..9fd38db23992 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapEccSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SAP ECC source. public partial class SapEccSource : TabularSource { - /// Initializes a new instance of SapEccSource. + /// Initializes a new instance of . public SapEccSource() { CopySourceType = "SapEccSource"; } - /// Initializes a new instance of SapEccSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.Serialization.cs index 29d3eb91d2e7..60ed8f9ad037 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapHanaLinkedService : IUtf8JsonSerializable + public partial class SapHanaLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -105,8 +125,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapHanaLinkedService DeserializeSapHanaLinkedService(JsonElement element) + internal static SapHanaLinkedService DeserializeSapHanaLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -247,5 +269,53 @@ internal static SapHanaLinkedService DeserializeSapHanaLinkedService(JsonElement additionalProperties = additionalPropertiesDictionary; return new SapHanaLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, connectionString.Value, server.Value, Optional.ToNullable(authenticationType), userName.Value, password, encryptedCredential.Value); } + + SapHanaLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapHanaLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapHanaLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapHanaLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapHanaLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapHanaLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapHanaLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.cs index a3e57e4e28ed..29d4c37c34f4 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP HANA Linked Service. public partial class SapHanaLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapHanaLinkedService. + /// Initializes a new instance of . public SapHanaLinkedService() { LinkedServiceType = "SapHana"; } - /// Initializes a new instance of SapHanaLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.Serialization.cs index f4cde0314876..eb7df0b0b50e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.Serialization.cs @@ -5,32 +5,55 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - internal partial class SapHanaPartitionSettings : IUtf8JsonSerializable + internal partial class SapHanaPartitionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PartitionColumnName)) { writer.WritePropertyName("partitionColumnName"u8); JsonSerializer.Serialize(writer, PartitionColumnName); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SapHanaPartitionSettings DeserializeSapHanaPartitionSettings(JsonElement element) + internal static SapHanaPartitionSettings DeserializeSapHanaPartitionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional> partitionColumnName = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionColumnName"u8)) @@ -42,8 +65,61 @@ internal static SapHanaPartitionSettings DeserializeSapHanaPartitionSettings(Jso partitionColumnName = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SapHanaPartitionSettings(partitionColumnName.Value, serializedAdditionalRawData); + } + + SapHanaPartitionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapHanaPartitionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapHanaPartitionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapHanaPartitionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapHanaPartitionSettings model) + { + if (model is null) + { + return null; } - return new SapHanaPartitionSettings(partitionColumnName.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapHanaPartitionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapHanaPartitionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.cs index 14c0dcf79151..437a12be995f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaPartitionSettings.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,16 +14,21 @@ namespace Azure.ResourceManager.DataFactory.Models /// The settings that will be leveraged for SAP HANA source partitioning. internal partial class SapHanaPartitionSettings { - /// Initializes a new instance of SapHanaPartitionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SapHanaPartitionSettings() { } - /// Initializes a new instance of SapHanaPartitionSettings. + /// Initializes a new instance of . /// The name of the column that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). - internal SapHanaPartitionSettings(DataFactoryElement partitionColumnName) + /// Keeps track of any properties unknown to the library. + internal SapHanaPartitionSettings(DataFactoryElement partitionColumnName, Dictionary serializedAdditionalRawData) { PartitionColumnName = partitionColumnName; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the column that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.Serialization.cs index 3345b1f4c78a..a390652d565e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapHanaSource : IUtf8JsonSerializable + public partial class SapHanaSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -40,7 +46,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryTimeout)) { @@ -90,8 +103,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapHanaSource DeserializeSapHanaSource(JsonElement element) + internal static SapHanaSource DeserializeSapHanaSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -211,5 +226,53 @@ internal static SapHanaSource DeserializeSapHanaSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new SapHanaSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, packetSize.Value, partitionOption.Value, partitionSettings.Value); } + + SapHanaSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapHanaSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapHanaSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapHanaSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapHanaSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapHanaSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapHanaSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.cs index ebcd8171ea09..24fb6d93791d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SAP HANA source. public partial class SapHanaSource : TabularSource { - /// Initializes a new instance of SapHanaSource. + /// Initializes a new instance of . public SapHanaSource() { CopySourceType = "SapHanaSource"; } - /// Initializes a new instance of SapHanaSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.Serialization.cs index 12b8fca7ee4f..90e3eca1fd20 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapHanaTableDataset : IUtf8JsonSerializable + public partial class SapHanaTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -96,8 +116,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapHanaTableDataset DeserializeSapHanaTableDataset(JsonElement element) + internal static SapHanaTableDataset DeserializeSapHanaTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -228,5 +250,53 @@ internal static SapHanaTableDataset DeserializeSapHanaTableDataset(JsonElement e additionalProperties = additionalPropertiesDictionary; return new SapHanaTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, schema0.Value, table.Value); } + + SapHanaTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapHanaTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapHanaTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapHanaTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapHanaTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapHanaTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapHanaTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.cs index f4003d98f4f4..933bd140228a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapHanaTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP HANA Table properties. public partial class SapHanaTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapHanaTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public SapHanaTableDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public SapHanaTableDataset(DataFactoryLinkedServiceReference linkedServiceName) DatasetType = "SapHanaTable"; } - /// Initializes a new instance of SapHanaTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -44,6 +44,11 @@ internal SapHanaTableDataset(string datasetType, string description, DataFactory DatasetType = datasetType ?? "SapHanaTable"; } + /// Initializes a new instance of for deserialization. + internal SapHanaTableDataset() + { + } + /// The schema name of SAP HANA. Type: string (or Expression with resultType string). public DataFactoryElement SchemaTypePropertiesSchema { get; set; } /// The table name of SAP HANA. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.Serialization.cs index 2772260ff4db..52b16ec62923 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapOdpLinkedService : IUtf8JsonSerializable + public partial class SapOdpLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -165,8 +185,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapOdpLinkedService DeserializeSapOdpLinkedService(JsonElement element) + internal static SapOdpLinkedService DeserializeSapOdpLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -427,5 +449,53 @@ internal static SapOdpLinkedService DeserializeSapOdpLinkedService(JsonElement e additionalProperties = additionalPropertiesDictionary; return new SapOdpLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, server.Value, systemNumber.Value, clientId.Value, language.Value, systemId.Value, userName.Value, password, messageServer.Value, messageServerService.Value, sncMode.Value, sncMyName.Value, sncPartnerName.Value, sncLibraryPath.Value, sncQop.Value, x509CertificatePath.Value, logonGroup.Value, subscriberName.Value, encryptedCredential.Value); } + + SapOdpLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapOdpLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapOdpLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapOdpLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapOdpLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapOdpLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapOdpLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.cs index 119aa471c004..9dd9199e5e87 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP ODP Linked Service. public partial class SapOdpLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapOdpLinkedService. + /// Initializes a new instance of . public SapOdpLinkedService() { LinkedServiceType = "SapOdp"; } - /// Initializes a new instance of SapOdpLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.Serialization.cs index c8cdac44073d..bc3b1bf4077a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapOdpResourceDataset : IUtf8JsonSerializable + public partial class SapOdpResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -90,8 +110,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapOdpResourceDataset DeserializeSapOdpResourceDataset(JsonElement element) + internal static SapOdpResourceDataset DeserializeSapOdpResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -214,5 +236,53 @@ internal static SapOdpResourceDataset DeserializeSapOdpResourceDataset(JsonEleme additionalProperties = additionalPropertiesDictionary; return new SapOdpResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, context, objectName); } + + SapOdpResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapOdpResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapOdpResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapOdpResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapOdpResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapOdpResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapOdpResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.cs index 6b02c57e9864..0fa49f30846f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP ODP Resource properties. public partial class SapOdpResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapOdpResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// The context of the SAP ODP Object. Type: string (or Expression with resultType string). /// The name of the SAP ODP Object. Type: string (or Expression with resultType string). @@ -31,7 +31,7 @@ public SapOdpResourceDataset(DataFactoryLinkedServiceReference linkedServiceName DatasetType = "SapOdpResource"; } - /// Initializes a new instance of SapOdpResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -50,6 +50,11 @@ internal SapOdpResourceDataset(string datasetType, string description, DataFacto DatasetType = datasetType ?? "SapOdpResource"; } + /// Initializes a new instance of for deserialization. + internal SapOdpResourceDataset() + { + } + /// The context of the SAP ODP Object. Type: string (or Expression with resultType string). public DataFactoryElement Context { get; set; } /// The name of the SAP ODP Object. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.Serialization.cs index a68c122ce95a..89f268f75992 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapOdpSource : IUtf8JsonSerializable + public partial class SapOdpSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExtractionMode)) { @@ -94,8 +100,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapOdpSource DeserializeSapOdpSource(JsonElement element) + internal static SapOdpSource DeserializeSapOdpSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -215,5 +223,53 @@ internal static SapOdpSource DeserializeSapOdpSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new SapOdpSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, extractionMode.Value, subscriberProcess.Value, selection.Value, projection.Value); } + + SapOdpSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapOdpSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapOdpSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapOdpSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapOdpSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapOdpSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapOdpSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.cs index ef7c3a732e03..68ce01c87da9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOdpSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SAP ODP source. public partial class SapOdpSource : TabularSource { - /// Initializes a new instance of SapOdpSource. + /// Initializes a new instance of . public SapOdpSource() { CopySourceType = "SapOdpSource"; } - /// Initializes a new instance of SapOdpSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.Serialization.cs index e4cbfc9f3153..361f281636d0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapOpenHubLinkedService : IUtf8JsonSerializable + public partial class SapOpenHubLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -130,8 +150,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapOpenHubLinkedService DeserializeSapOpenHubLinkedService(JsonElement element) + internal static SapOpenHubLinkedService DeserializeSapOpenHubLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -322,5 +344,53 @@ internal static SapOpenHubLinkedService DeserializeSapOpenHubLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new SapOpenHubLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, server.Value, systemNumber.Value, clientId.Value, language.Value, systemId.Value, userName.Value, password, messageServer.Value, messageServerService.Value, logonGroup.Value, encryptedCredential.Value); } + + SapOpenHubLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapOpenHubLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapOpenHubLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapOpenHubLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapOpenHubLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapOpenHubLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapOpenHubLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.cs index e066a2458faa..ed24e76eee81 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP Business Warehouse Open Hub Destination Linked Service. public partial class SapOpenHubLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapOpenHubLinkedService. + /// Initializes a new instance of . public SapOpenHubLinkedService() { LinkedServiceType = "SapOpenHub"; } - /// Initializes a new instance of SapOpenHubLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.Serialization.cs index a9182a8555eb..11b081af5ad9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapOpenHubSource : IUtf8JsonSerializable + public partial class SapOpenHubSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(ExcludeLastRequest)) { @@ -86,8 +92,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapOpenHubSource DeserializeSapOpenHubSource(JsonElement element) + internal static SapOpenHubSource DeserializeSapOpenHubSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -207,5 +215,53 @@ internal static SapOpenHubSource DeserializeSapOpenHubSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new SapOpenHubSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, excludeLastRequest.Value, baseRequestId.Value, customRfcReadTableFunctionModule.Value, sapDataColumnDelimiter.Value); } + + SapOpenHubSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapOpenHubSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapOpenHubSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapOpenHubSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapOpenHubSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapOpenHubSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapOpenHubSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.cs index f2febfc32b4b..82e6f491520b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SAP Business Warehouse Open Hub Destination source. public partial class SapOpenHubSource : TabularSource { - /// Initializes a new instance of SapOpenHubSource. + /// Initializes a new instance of . public SapOpenHubSource() { CopySourceType = "SapOpenHubSource"; } - /// Initializes a new instance of SapOpenHubSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.Serialization.cs index a544e038108f..ef76290cf53e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapOpenHubTableDataset : IUtf8JsonSerializable + public partial class SapOpenHubTableDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -98,8 +118,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapOpenHubTableDataset DeserializeSapOpenHubTableDataset(JsonElement element) + internal static SapOpenHubTableDataset DeserializeSapOpenHubTableDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -236,5 +258,53 @@ internal static SapOpenHubTableDataset DeserializeSapOpenHubTableDataset(JsonEle additionalProperties = additionalPropertiesDictionary; return new SapOpenHubTableDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, openHubDestinationName, excludeLastRequest.Value, baseRequestId.Value); } + + SapOpenHubTableDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapOpenHubTableDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapOpenHubTableDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapOpenHubTableDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapOpenHubTableDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapOpenHubTableDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapOpenHubTableDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.cs index baf8587c3078..b8c0eb5d1fed 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapOpenHubTableDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Sap Business Warehouse Open Hub Destination Table properties. public partial class SapOpenHubTableDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapOpenHubTableDataset. + /// Initializes a new instance of . /// Linked service reference. /// The name of the Open Hub Destination with destination type as Database Table. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public SapOpenHubTableDataset(DataFactoryLinkedServiceReference linkedServiceNam DatasetType = "SapOpenHubTable"; } - /// Initializes a new instance of SapOpenHubTableDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -49,6 +49,11 @@ internal SapOpenHubTableDataset(string datasetType, string description, DataFact DatasetType = datasetType ?? "SapOpenHubTable"; } + /// Initializes a new instance of for deserialization. + internal SapOpenHubTableDataset() + { + } + /// The name of the Open Hub Destination with destination type as Database Table. Type: string (or Expression with resultType string). public DataFactoryElement OpenHubDestinationName { get; set; } /// Whether to exclude the records of the last request. The default value is true. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.Serialization.cs index 53e2e99209ae..ce2af22997b1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapTableLinkedService : IUtf8JsonSerializable + public partial class SapTableLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -155,8 +175,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapTableLinkedService DeserializeSapTableLinkedService(JsonElement element) + internal static SapTableLinkedService DeserializeSapTableLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -397,5 +419,53 @@ internal static SapTableLinkedService DeserializeSapTableLinkedService(JsonEleme additionalProperties = additionalPropertiesDictionary; return new SapTableLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, server.Value, systemNumber.Value, clientId.Value, language.Value, systemId.Value, userName.Value, password, messageServer.Value, messageServerService.Value, sncMode.Value, sncMyName.Value, sncPartnerName.Value, sncLibraryPath.Value, sncQop.Value, logonGroup.Value, encryptedCredential.Value); } + + SapTableLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapTableLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapTableLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapTableLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapTableLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapTableLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapTableLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.cs index f57fe2cd79ab..7895dcb2eb38 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableLinkedService.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP Table Linked Service. public partial class SapTableLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of SapTableLinkedService. + /// Initializes a new instance of . public SapTableLinkedService() { LinkedServiceType = "SapTable"; } - /// Initializes a new instance of SapTableLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.Serialization.cs index 2b96cbec1d25..9151bcb04984 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapTablePartitionSettings : IUtf8JsonSerializable + public partial class SapTablePartitionSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(PartitionColumnName)) { @@ -36,11 +44,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maxPartitionsNumber"u8); JsonSerializer.Serialize(writer, MaxPartitionsNumber); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SapTablePartitionSettings DeserializeSapTablePartitionSettings(JsonElement element) + internal static SapTablePartitionSettings DeserializeSapTablePartitionSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -49,6 +71,7 @@ internal static SapTablePartitionSettings DeserializeSapTablePartitionSettings(J Optional> partitionUpperBound = default; Optional> partitionLowerBound = default; Optional> maxPartitionsNumber = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("partitionColumnName"u8)) @@ -87,8 +110,61 @@ internal static SapTablePartitionSettings DeserializeSapTablePartitionSettings(J maxPartitionsNumber = JsonSerializer.Deserialize>(property.Value.GetRawText()); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SapTablePartitionSettings(partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value, maxPartitionsNumber.Value, serializedAdditionalRawData); + } + + SapTablePartitionSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapTablePartitionSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapTablePartitionSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapTablePartitionSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapTablePartitionSettings model) + { + if (model is null) + { + return null; } - return new SapTablePartitionSettings(partitionColumnName.Value, partitionUpperBound.Value, partitionLowerBound.Value, maxPartitionsNumber.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapTablePartitionSettings(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapTablePartitionSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.cs index 127c6ce2207e..abf66dc833d2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTablePartitionSettings.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,22 +14,27 @@ namespace Azure.ResourceManager.DataFactory.Models /// The settings that will be leveraged for SAP table source partitioning. public partial class SapTablePartitionSettings { - /// Initializes a new instance of SapTablePartitionSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SapTablePartitionSettings() { } - /// Initializes a new instance of SapTablePartitionSettings. + /// Initializes a new instance of . /// The name of the column that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The maximum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The minimum value of column specified in partitionColumnName that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). /// The maximum value of partitions the table will be split into. Type: integer (or Expression with resultType string). - internal SapTablePartitionSettings(DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound, DataFactoryElement maxPartitionsNumber) + /// Keeps track of any properties unknown to the library. + internal SapTablePartitionSettings(DataFactoryElement partitionColumnName, DataFactoryElement partitionUpperBound, DataFactoryElement partitionLowerBound, DataFactoryElement maxPartitionsNumber, Dictionary serializedAdditionalRawData) { PartitionColumnName = partitionColumnName; PartitionUpperBound = partitionUpperBound; PartitionLowerBound = partitionLowerBound; MaxPartitionsNumber = maxPartitionsNumber; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the column that will be used for proceeding range partitioning. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.Serialization.cs index 21885f7f6948..0a817528d07b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapTableResourceDataset : IUtf8JsonSerializable + public partial class SapTableResourceDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -88,8 +108,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapTableResourceDataset DeserializeSapTableResourceDataset(JsonElement element) + internal static SapTableResourceDataset DeserializeSapTableResourceDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -206,5 +228,53 @@ internal static SapTableResourceDataset DeserializeSapTableResourceDataset(JsonE additionalProperties = additionalPropertiesDictionary; return new SapTableResourceDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName); } + + SapTableResourceDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapTableResourceDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapTableResourceDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapTableResourceDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapTableResourceDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapTableResourceDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapTableResourceDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.cs index 3f1c735b2775..d77027dbed6b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableResourceDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// SAP Table Resource properties. public partial class SapTableResourceDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of SapTableResourceDataset. + /// Initializes a new instance of . /// Linked service reference. /// The name of the SAP Table. Type: string (or Expression with resultType string). /// or is null. @@ -28,7 +28,7 @@ public SapTableResourceDataset(DataFactoryLinkedServiceReference linkedServiceNa DatasetType = "SapTableResource"; } - /// Initializes a new instance of SapTableResourceDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -45,6 +45,11 @@ internal SapTableResourceDataset(string datasetType, string description, DataFac DatasetType = datasetType ?? "SapTableResource"; } + /// Initializes a new instance of for deserialization. + internal SapTableResourceDataset() + { + } + /// The name of the SAP Table. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.Serialization.cs index 9b5e6707886c..8cde423b86b8 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SapTableSource : IUtf8JsonSerializable + public partial class SapTableSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(RowCount)) { @@ -65,7 +71,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionSettings)) { writer.WritePropertyName("partitionSettings"u8); - writer.WriteObjectValue(PartitionSettings); + if (PartitionSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)PartitionSettings).Serialize(writer, options); + } } if (Optional.IsDefined(QueryTimeout)) { @@ -115,8 +128,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SapTableSource DeserializeSapTableSource(JsonElement element) + internal static SapTableSource DeserializeSapTableSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -286,5 +301,53 @@ internal static SapTableSource DeserializeSapTableSource(JsonElement element) additionalProperties = additionalPropertiesDictionary; return new SapTableSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, rowCount.Value, rowSkips.Value, rfcTableFields.Value, rfcTableOptions.Value, batchSize.Value, customRfcReadTableFunctionModule.Value, sapDataColumnDelimiter.Value, partitionOption.Value, partitionSettings.Value); } + + SapTableSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSapTableSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SapTableSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSapTableSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SapTableSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SapTableSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSapTableSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.cs index beb92893e7da..1dd20bb8616f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SapTableSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity source for SAP Table source. public partial class SapTableSource : TabularSource { - /// Initializes a new instance of SapTableSource. + /// Initializes a new instance of . public SapTableSource() { CopySourceType = "SapTableSource"; } - /// Initializes a new instance of SapTableSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.Serialization.cs index f637ef49efb0..3be1865a28fc 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ScheduleTriggerRecurrence : IUtf8JsonSerializable + public partial class ScheduleTriggerRecurrence : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Frequency)) { @@ -45,7 +51,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Schedule)) { writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule); + if (Schedule is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Schedule).Serialize(writer, options); + } } foreach (var item in AdditionalProperties) { @@ -59,8 +72,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ScheduleTriggerRecurrence DeserializeScheduleTriggerRecurrence(JsonElement element) + internal static ScheduleTriggerRecurrence DeserializeScheduleTriggerRecurrence(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -130,5 +145,53 @@ internal static ScheduleTriggerRecurrence DeserializeScheduleTriggerRecurrence(J additionalProperties = additionalPropertiesDictionary; return new ScheduleTriggerRecurrence(Optional.ToNullable(frequency), Optional.ToNullable(interval), Optional.ToNullable(startTime), Optional.ToNullable(endTime), timeZone.Value, schedule.Value, additionalProperties); } + + ScheduleTriggerRecurrence IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleTriggerRecurrence(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScheduleTriggerRecurrence IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScheduleTriggerRecurrence(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScheduleTriggerRecurrence model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScheduleTriggerRecurrence(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScheduleTriggerRecurrence(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.cs index 53282870ea55..aee819f24998 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScheduleTriggerRecurrence.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// The workflow trigger recurrence. public partial class ScheduleTriggerRecurrence { - /// Initializes a new instance of ScheduleTriggerRecurrence. + /// Initializes a new instance of . public ScheduleTriggerRecurrence() { AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of ScheduleTriggerRecurrence. + /// Initializes a new instance of . /// The frequency. /// The interval. /// The start time. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.Serialization.cs index 51c338043ef6..d0d640032e92 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.Serialization.cs @@ -5,16 +5,24 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ScriptActivityParameter : IUtf8JsonSerializable + public partial class ScriptActivityParameter : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Name)) { @@ -41,11 +49,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("size"u8); writer.WriteNumberValue(Size.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptActivityParameter DeserializeScriptActivityParameter(JsonElement element) + internal static ScriptActivityParameter DeserializeScriptActivityParameter(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -55,6 +77,7 @@ internal static ScriptActivityParameter DeserializeScriptActivityParameter(JsonE Optional> value = default; Optional direction = default; Optional size = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -102,8 +125,61 @@ internal static ScriptActivityParameter DeserializeScriptActivityParameter(JsonE size = property.Value.GetInt32(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptActivityParameter(name.Value, Optional.ToNullable(type), value.Value, Optional.ToNullable(direction), Optional.ToNullable(size), serializedAdditionalRawData); + } + + ScriptActivityParameter IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptActivityParameter(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptActivityParameter IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptActivityParameter(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptActivityParameter model) + { + if (model is null) + { + return null; } - return new ScriptActivityParameter(name.Value, Optional.ToNullable(type), value.Value, Optional.ToNullable(direction), Optional.ToNullable(size)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptActivityParameter(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptActivityParameter(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.cs index 2f39a41a52da..3c3158b6430f 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityParameter.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using Azure.Core.Expressions.DataFactory; namespace Azure.ResourceManager.DataFactory.Models @@ -12,24 +14,29 @@ namespace Azure.ResourceManager.DataFactory.Models /// Parameters of a script block. public partial class ScriptActivityParameter { - /// Initializes a new instance of ScriptActivityParameter. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public ScriptActivityParameter() { } - /// Initializes a new instance of ScriptActivityParameter. + /// Initializes a new instance of . /// The name of the parameter. Type: string (or Expression with resultType string). /// The type of the parameter. /// The value of the parameter. Type: string (or Expression with resultType string). /// The direction of the parameter. /// The size of the output direction parameter. - internal ScriptActivityParameter(DataFactoryElement name, ScriptActivityParameterType? parameterType, DataFactoryElement value, ScriptActivityParameterDirection? direction, int? size) + /// Keeps track of any properties unknown to the library. + internal ScriptActivityParameter(DataFactoryElement name, ScriptActivityParameterType? parameterType, DataFactoryElement value, ScriptActivityParameterDirection? direction, int? size, Dictionary serializedAdditionalRawData) { Name = name; ParameterType = parameterType; Value = value; Direction = direction; Size = size; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// The name of the parameter. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.Serialization.cs index 9efa242e19f9..b7f05084855c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.Serialization.cs @@ -5,17 +5,24 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ScriptActivityScriptBlock : IUtf8JsonSerializable + public partial class ScriptActivityScriptBlock : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("text"u8); JsonSerializer.Serialize(writer, Text); @@ -27,15 +34,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Parameters) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static ScriptActivityScriptBlock DeserializeScriptActivityScriptBlock(JsonElement element) + internal static ScriptActivityScriptBlock DeserializeScriptActivityScriptBlock(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -43,6 +71,7 @@ internal static ScriptActivityScriptBlock DeserializeScriptActivityScriptBlock(J DataFactoryElement text = default; DataFactoryScriptType type = default; Optional> parameters = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("text"u8)) @@ -69,8 +98,61 @@ internal static ScriptActivityScriptBlock DeserializeScriptActivityScriptBlock(J parameters = array; continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptActivityScriptBlock(text, type, Optional.ToList(parameters), serializedAdditionalRawData); + } + + ScriptActivityScriptBlock IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptActivityScriptBlock(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptActivityScriptBlock IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptActivityScriptBlock(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptActivityScriptBlock model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptActivityScriptBlock(Response response) + { + if (response is null) + { + return null; } - return new ScriptActivityScriptBlock(text, type, Optional.ToList(parameters)); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptActivityScriptBlock(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.cs index b0604829722f..550c0954a0f9 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityScriptBlock.cs @@ -15,7 +15,10 @@ namespace Azure.ResourceManager.DataFactory.Models /// Script block of scripts. public partial class ScriptActivityScriptBlock { - /// Initializes a new instance of ScriptActivityScriptBlock. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The query text. Type: string (or Expression with resultType string). /// The type of the query. Type: string. /// is null. @@ -28,15 +31,22 @@ public ScriptActivityScriptBlock(DataFactoryElement text, DataFactoryScr Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptActivityScriptBlock. + /// Initializes a new instance of . /// The query text. Type: string (or Expression with resultType string). /// The type of the query. Type: string. /// Array of script parameters. Type: array. - internal ScriptActivityScriptBlock(DataFactoryElement text, DataFactoryScriptType scriptType, IList parameters) + /// Keeps track of any properties unknown to the library. + internal ScriptActivityScriptBlock(DataFactoryElement text, DataFactoryScriptType scriptType, IList parameters, Dictionary serializedAdditionalRawData) { Text = text; ScriptType = scriptType; Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScriptActivityScriptBlock() + { } /// The query text. Type: string (or Expression with resultType string). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.Serialization.cs index 33f25a5a62d0..452bee13f1ba 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.Serialization.cs @@ -5,34 +5,64 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ScriptActivityTypeLogSettings : IUtf8JsonSerializable + public partial class ScriptActivityTypeLogSettings : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("logDestination"u8); writer.WriteStringValue(LogDestination.ToString()); if (Optional.IsDefined(LogLocationSettings)) { writer.WritePropertyName("logLocationSettings"u8); - writer.WriteObjectValue(LogLocationSettings); + if (LogLocationSettings is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LogLocationSettings).Serialize(writer, options); + } + } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } } writer.WriteEndObject(); } - internal static ScriptActivityTypeLogSettings DeserializeScriptActivityTypeLogSettings(JsonElement element) + internal static ScriptActivityTypeLogSettings DeserializeScriptActivityTypeLogSettings(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } ScriptActivityLogDestination logDestination = default; Optional logLocationSettings = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("logDestination"u8)) @@ -49,8 +79,61 @@ internal static ScriptActivityTypeLogSettings DeserializeScriptActivityTypeLogSe logLocationSettings = LogLocationSettings.DeserializeLogLocationSettings(property.Value); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new ScriptActivityTypeLogSettings(logDestination, logLocationSettings.Value, serializedAdditionalRawData); + } + + ScriptActivityTypeLogSettings IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeScriptActivityTypeLogSettings(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ScriptActivityTypeLogSettings IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeScriptActivityTypeLogSettings(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ScriptActivityTypeLogSettings model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ScriptActivityTypeLogSettings(Response response) + { + if (response is null) + { + return null; } - return new ScriptActivityTypeLogSettings(logDestination, logLocationSettings.Value); + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeScriptActivityTypeLogSettings(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.cs index 0c70f5d62d8f..9df8bed70a20 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ScriptActivityTypeLogSettings.cs @@ -5,25 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Log settings of script activity. public partial class ScriptActivityTypeLogSettings { - /// Initializes a new instance of ScriptActivityTypeLogSettings. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . /// The destination of logs. Type: string. public ScriptActivityTypeLogSettings(ScriptActivityLogDestination logDestination) { LogDestination = logDestination; } - /// Initializes a new instance of ScriptActivityTypeLogSettings. + /// Initializes a new instance of . /// The destination of logs. Type: string. /// Log location settings customer needs to provide when enabling log. - internal ScriptActivityTypeLogSettings(ScriptActivityLogDestination logDestination, LogLocationSettings logLocationSettings) + /// Keeps track of any properties unknown to the library. + internal ScriptActivityTypeLogSettings(ScriptActivityLogDestination logDestination, LogLocationSettings logLocationSettings, Dictionary serializedAdditionalRawData) { LogDestination = logDestination; LogLocationSettings = logLocationSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScriptActivityTypeLogSettings() + { } /// The destination of logs. Type: string. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.Serialization.cs index f3d8ecadd0c2..ba03ec01c383 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SecureInputOutputPolicy : IUtf8JsonSerializable + public partial class SecureInputOutputPolicy : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(IsSecureInputEnabled)) { @@ -25,17 +33,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secureOutput"u8); writer.WriteBooleanValue(IsSecureOutputEnabled.Value); } + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SecureInputOutputPolicy DeserializeSecureInputOutputPolicy(JsonElement element) + internal static SecureInputOutputPolicy DeserializeSecureInputOutputPolicy(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; } Optional secureInput = default; Optional secureOutput = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secureInput"u8)) @@ -56,8 +79,61 @@ internal static SecureInputOutputPolicy DeserializeSecureInputOutputPolicy(JsonE secureOutput = property.Value.GetBoolean(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SecureInputOutputPolicy(Optional.ToNullable(secureInput), Optional.ToNullable(secureOutput), serializedAdditionalRawData); + } + + SecureInputOutputPolicy IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSecureInputOutputPolicy(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SecureInputOutputPolicy IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSecureInputOutputPolicy(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SecureInputOutputPolicy model) + { + if (model is null) + { + return null; } - return new SecureInputOutputPolicy(Optional.ToNullable(secureInput), Optional.ToNullable(secureOutput)); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SecureInputOutputPolicy(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSecureInputOutputPolicy(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.cs index 70891116f011..cc9f420e2474 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SecureInputOutputPolicy.cs @@ -5,23 +5,31 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.ResourceManager.DataFactory.Models { /// Execution policy for an activity that supports secure input and output. public partial class SecureInputOutputPolicy { - /// Initializes a new instance of SecureInputOutputPolicy. + /// Keeps track of any properties unknown to the library. + private Dictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . public SecureInputOutputPolicy() { } - /// Initializes a new instance of SecureInputOutputPolicy. + /// Initializes a new instance of . /// When set to true, Input from activity is considered as secure and will not be logged to monitoring. /// When set to true, Output from activity is considered as secure and will not be logged to monitoring. - internal SecureInputOutputPolicy(bool? isSecureInputEnabled, bool? isSecureOutputEnabled) + /// Keeps track of any properties unknown to the library. + internal SecureInputOutputPolicy(bool? isSecureInputEnabled, bool? isSecureOutputEnabled, Dictionary serializedAdditionalRawData) { IsSecureInputEnabled = isSecureInputEnabled; IsSecureOutputEnabled = isSecureOutputEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; } /// When set to true, Input from activity is considered as secure and will not be logged to monitoring. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.Serialization.cs index b28e0c01892e..8636dd799f09 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.Serialization.cs @@ -5,15 +5,23 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SelfDependencyTumblingWindowTriggerReference : IUtf8JsonSerializable + public partial class SelfDependencyTumblingWindowTriggerReference : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("offset"u8); writer.WriteStringValue(Offset); @@ -24,11 +32,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("type"u8); writer.WriteStringValue(DependencyReferenceType); + if (_serializedAdditionalRawData is not null && options.Format == ModelSerializerFormat.Json) + { + foreach (var property in _serializedAdditionalRawData) + { + writer.WritePropertyName(property.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(property.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(property.Value.ToString()).RootElement); +#endif + } + } writer.WriteEndObject(); } - internal static SelfDependencyTumblingWindowTriggerReference DeserializeSelfDependencyTumblingWindowTriggerReference(JsonElement element) + internal static SelfDependencyTumblingWindowTriggerReference DeserializeSelfDependencyTumblingWindowTriggerReference(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -36,6 +58,7 @@ internal static SelfDependencyTumblingWindowTriggerReference DeserializeSelfDepe string offset = default; Optional size = default; string type = default; + Dictionary serializedAdditionalRawData = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("offset"u8)) @@ -53,8 +76,61 @@ internal static SelfDependencyTumblingWindowTriggerReference DeserializeSelfDepe type = property.Value.GetString(); continue; } + if (options.Format == ModelSerializerFormat.Json) + { + serializedAdditionalRawData.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + continue; + } + } + return new SelfDependencyTumblingWindowTriggerReference(type, offset, size.Value, serializedAdditionalRawData); + } + + SelfDependencyTumblingWindowTriggerReference IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSelfDependencyTumblingWindowTriggerReference(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SelfDependencyTumblingWindowTriggerReference IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSelfDependencyTumblingWindowTriggerReference(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SelfDependencyTumblingWindowTriggerReference model) + { + if (model is null) + { + return null; } - return new SelfDependencyTumblingWindowTriggerReference(type, offset, size.Value); + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SelfDependencyTumblingWindowTriggerReference(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSelfDependencyTumblingWindowTriggerReference(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.cs index 72fd9274cf19..93f4bc31b633 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfDependencyTumblingWindowTriggerReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.DataFactory.Models @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Self referenced tumbling window trigger dependency. public partial class SelfDependencyTumblingWindowTriggerReference : DependencyReference { - /// Initializes a new instance of SelfDependencyTumblingWindowTriggerReference. + /// Initializes a new instance of . /// Timespan applied to the start time of a tumbling window when evaluating dependency. /// is null. public SelfDependencyTumblingWindowTriggerReference(string offset) @@ -24,17 +25,23 @@ public SelfDependencyTumblingWindowTriggerReference(string offset) DependencyReferenceType = "SelfDependencyTumblingWindowTriggerReference"; } - /// Initializes a new instance of SelfDependencyTumblingWindowTriggerReference. + /// Initializes a new instance of . /// The type of dependency reference. /// Timespan applied to the start time of a tumbling window when evaluating dependency. /// The size of the window when evaluating the dependency. If undefined the frequency of the tumbling window will be used. - internal SelfDependencyTumblingWindowTriggerReference(string dependencyReferenceType, string offset, string size) : base(dependencyReferenceType) + /// Keeps track of any properties unknown to the library. + internal SelfDependencyTumblingWindowTriggerReference(string dependencyReferenceType, string offset, string size, Dictionary serializedAdditionalRawData) : base(dependencyReferenceType, serializedAdditionalRawData) { Offset = offset; Size = size; DependencyReferenceType = dependencyReferenceType ?? "SelfDependencyTumblingWindowTriggerReference"; } + /// Initializes a new instance of for deserialization. + internal SelfDependencyTumblingWindowTriggerReference() + { + } + /// Timespan applied to the start time of a tumbling window when evaluating dependency. public string Offset { get; set; } /// The size of the window when evaluating the dependency. If undefined the frequency of the tumbling window will be used. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.Serialization.cs index f6227f49d9ea..fb5efe6b6d3e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.Serialization.cs @@ -8,14 +8,20 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SelfHostedIntegrationRuntime : IUtf8JsonSerializable + public partial class SelfHostedIntegrationRuntime : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(IntegrationRuntimeType.ToString()); @@ -29,7 +35,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LinkedInfo)) { writer.WritePropertyName("linkedInfo"u8); - writer.WriteObjectValue(LinkedInfo); + if (LinkedInfo is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)LinkedInfo).Serialize(writer, options); + } } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -44,8 +57,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SelfHostedIntegrationRuntime DeserializeSelfHostedIntegrationRuntime(JsonElement element) + internal static SelfHostedIntegrationRuntime DeserializeSelfHostedIntegrationRuntime(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -93,5 +108,53 @@ internal static SelfHostedIntegrationRuntime DeserializeSelfHostedIntegrationRun additionalProperties = additionalPropertiesDictionary; return new SelfHostedIntegrationRuntime(type, description.Value, additionalProperties, linkedInfo.Value); } + + SelfHostedIntegrationRuntime IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSelfHostedIntegrationRuntime(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SelfHostedIntegrationRuntime IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSelfHostedIntegrationRuntime(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SelfHostedIntegrationRuntime model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SelfHostedIntegrationRuntime(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSelfHostedIntegrationRuntime(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.cs index fe0b6424d608..3b096f1fbf90 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntime.cs @@ -13,13 +13,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Self-hosted integration runtime. public partial class SelfHostedIntegrationRuntime : DataFactoryIntegrationRuntimeProperties { - /// Initializes a new instance of SelfHostedIntegrationRuntime. + /// Initializes a new instance of . public SelfHostedIntegrationRuntime() { IntegrationRuntimeType = IntegrationRuntimeType.SelfHosted; } - /// Initializes a new instance of SelfHostedIntegrationRuntime. + /// Initializes a new instance of . /// Type of integration runtime. /// Integration runtime description. /// Additional Properties. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.Serialization.cs index a3bdb172c994..d75d1f63131d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.Serialization.cs @@ -8,14 +8,37 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SelfHostedIntegrationRuntimeNode + public partial class SelfHostedIntegrationRuntimeNode : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SelfHostedIntegrationRuntimeNode DeserializeSelfHostedIntegrationRuntimeNode(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static SelfHostedIntegrationRuntimeNode DeserializeSelfHostedIntegrationRuntimeNode(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -198,5 +221,53 @@ internal static SelfHostedIntegrationRuntimeNode DeserializeSelfHostedIntegratio additionalProperties = additionalPropertiesDictionary; return new SelfHostedIntegrationRuntimeNode(nodeName.Value, machineName.Value, hostServiceUri.Value, Optional.ToNullable(status), Optional.ToDictionary(capabilities), versionStatus.Value, version.Value, Optional.ToNullable(registerTime), Optional.ToNullable(lastConnectTime), Optional.ToNullable(expiryTime), Optional.ToNullable(lastStartTime), Optional.ToNullable(lastStopTime), Optional.ToNullable(lastUpdateResult), Optional.ToNullable(lastStartUpdateTime), Optional.ToNullable(lastEndUpdateTime), Optional.ToNullable(isActiveDispatcher), Optional.ToNullable(concurrentJobsLimit), Optional.ToNullable(maxConcurrentJobs), additionalProperties); } + + SelfHostedIntegrationRuntimeNode IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSelfHostedIntegrationRuntimeNode(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SelfHostedIntegrationRuntimeNode IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSelfHostedIntegrationRuntimeNode(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SelfHostedIntegrationRuntimeNode model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SelfHostedIntegrationRuntimeNode(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSelfHostedIntegrationRuntimeNode(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.cs index ec5aec824fef..fec996ee3b50 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeNode.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.DataFactory.Models /// Properties of Self-hosted integration runtime node. public partial class SelfHostedIntegrationRuntimeNode { - /// Initializes a new instance of SelfHostedIntegrationRuntimeNode. + /// Initializes a new instance of . internal SelfHostedIntegrationRuntimeNode() { Capabilities = new ChangeTrackingDictionary(); AdditionalProperties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of SelfHostedIntegrationRuntimeNode. + /// Initializes a new instance of . /// Name of the integration runtime node. /// Machine name of the integration runtime node. /// URI for the host machine of the integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.Serialization.cs index 8f02a7619dc4..1a29c483b8cf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.Serialization.cs @@ -8,14 +8,76 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SelfHostedIntegrationRuntimeStatus + public partial class SelfHostedIntegrationRuntimeStatus : IUtf8JsonSerializable, IModelJsonSerializable { - internal static SelfHostedIntegrationRuntimeStatus DeserializeSelfHostedIntegrationRuntimeStatus(JsonElement element) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RuntimeType.ToString()); + writer.WritePropertyName("typeProperties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Nodes)) + { + writer.WritePropertyName("nodes"u8); + writer.WriteStartArray(); + foreach (var item in Nodes) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Links)) + { + writer.WritePropertyName("links"u8); + writer.WriteStartArray(); + foreach (var item in Links) + { + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static SelfHostedIntegrationRuntimeStatus DeserializeSelfHostedIntegrationRuntimeStatus(JsonElement element, ModelSerializerOptions options = default) + { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -227,5 +289,53 @@ internal static SelfHostedIntegrationRuntimeStatus DeserializeSelfHostedIntegrat additionalProperties = additionalPropertiesDictionary; return new SelfHostedIntegrationRuntimeStatus(type, dataFactoryName.Value, Optional.ToNullable(state), additionalProperties, Optional.ToNullable(createTime), Optional.ToNullable(taskQueueId), Optional.ToNullable(internalChannelEncryption), version.Value, Optional.ToList(nodes), Optional.ToNullable(scheduledUpdateDate), Optional.ToNullable(updateDelayOffset), Optional.ToNullable(localTimeZoneOffset), Optional.ToDictionary(capabilities), Optional.ToList(serviceUrls), Optional.ToNullable(autoUpdate), versionStatus.Value, Optional.ToList(links), pushedVersion.Value, latestVersion.Value, Optional.ToNullable(autoUpdateEta)); } + + SelfHostedIntegrationRuntimeStatus IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSelfHostedIntegrationRuntimeStatus(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + SelfHostedIntegrationRuntimeStatus IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeSelfHostedIntegrationRuntimeStatus(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(SelfHostedIntegrationRuntimeStatus model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator SelfHostedIntegrationRuntimeStatus(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeSelfHostedIntegrationRuntimeStatus(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.cs index f1af80f603cb..12da3ed9dae0 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SelfHostedIntegrationRuntimeStatus.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// Self-hosted integration runtime status. public partial class SelfHostedIntegrationRuntimeStatus : IntegrationRuntimeStatus { - /// Initializes a new instance of SelfHostedIntegrationRuntimeStatus. + /// Initializes a new instance of . internal SelfHostedIntegrationRuntimeStatus() { Nodes = new ChangeTrackingList(); @@ -24,7 +24,7 @@ internal SelfHostedIntegrationRuntimeStatus() RuntimeType = IntegrationRuntimeType.SelfHosted; } - /// Initializes a new instance of SelfHostedIntegrationRuntimeStatus. + /// Initializes a new instance of . /// Type of integration runtime. /// The data factory name which the integration runtime belong to. /// The state of integration runtime. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.Serialization.cs index 02412d8c8abf..f6eb378ad2d2 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.Serialization.cs @@ -8,22 +8,35 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ServiceNowLinkedService : IUtf8JsonSerializable + public partial class ServiceNowLinkedService : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(LinkedServiceType); if (Optional.IsDefined(ConnectVia)) { writer.WritePropertyName("connectVia"u8); - writer.WriteObjectValue(ConnectVia); + if (ConnectVia is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)ConnectVia).Serialize(writer, options); + } } if (Optional.IsDefined(Description)) { @@ -37,7 +50,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -123,8 +143,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ServiceNowLinkedService DeserializeServiceNowLinkedService(JsonElement element) + internal static ServiceNowLinkedService DeserializeServiceNowLinkedService(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -297,5 +319,53 @@ internal static ServiceNowLinkedService DeserializeServiceNowLinkedService(JsonE additionalProperties = additionalPropertiesDictionary; return new ServiceNowLinkedService(type, connectVia.Value, description.Value, Optional.ToDictionary(parameters), Optional.ToList(annotations), additionalProperties, endpoint, authenticationType, username.Value, password, clientId.Value, clientSecret, useEncryptedEndpoints.Value, useHostVerification.Value, usePeerVerification.Value, encryptedCredential.Value); } + + ServiceNowLinkedService IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceNowLinkedService(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceNowLinkedService IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceNowLinkedService(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceNowLinkedService model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceNowLinkedService(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceNowLinkedService(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.cs index 756b0b69ca37..5bc7ace6d797 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowLinkedService.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// ServiceNow server linked service. public partial class ServiceNowLinkedService : DataFactoryLinkedServiceProperties { - /// Initializes a new instance of ServiceNowLinkedService. + /// Initializes a new instance of . /// The endpoint of the ServiceNow server. (i.e. <instance>.service-now.com). /// The authentication type to use. /// is null. @@ -28,7 +28,7 @@ public ServiceNowLinkedService(BinaryData endpoint, ServiceNowAuthenticationType LinkedServiceType = "ServiceNow"; } - /// Initializes a new instance of ServiceNowLinkedService. + /// Initializes a new instance of . /// Type of linked service. /// The integration runtime reference. /// Linked service description. @@ -60,6 +60,11 @@ internal ServiceNowLinkedService(string linkedServiceType, IntegrationRuntimeRef LinkedServiceType = linkedServiceType ?? "ServiceNow"; } + /// Initializes a new instance of for deserialization. + internal ServiceNowLinkedService() + { + } + /// /// The endpoint of the ServiceNow server. (i.e. <instance>.service-now.com) /// diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.Serialization.cs index 79bcf1873a74..409db556421c 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ServiceNowObjectDataset : IUtf8JsonSerializable + public partial class ServiceNowObjectDataset : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(DatasetType); @@ -43,7 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) foreach (var item in Parameters) { writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + if (item.Value is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item.Value).Serialize(writer, options); + } } writer.WriteEndObject(); } @@ -69,7 +82,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Folder)) { writer.WritePropertyName("folder"u8); - writer.WriteObjectValue(Folder); + if (Folder is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Folder).Serialize(writer, options); + } } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); @@ -91,8 +111,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ServiceNowObjectDataset DeserializeServiceNowObjectDataset(JsonElement element) + internal static ServiceNowObjectDataset DeserializeServiceNowObjectDataset(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -213,5 +235,53 @@ internal static ServiceNowObjectDataset DeserializeServiceNowObjectDataset(JsonE additionalProperties = additionalPropertiesDictionary; return new ServiceNowObjectDataset(type, description.Value, structure.Value, schema.Value, linkedServiceName, Optional.ToDictionary(parameters), Optional.ToList(annotations), folder.Value, additionalProperties, tableName.Value); } + + ServiceNowObjectDataset IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceNowObjectDataset(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceNowObjectDataset IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceNowObjectDataset(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceNowObjectDataset model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceNowObjectDataset(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceNowObjectDataset(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.cs index 8ce1cc189533..8ecc28547fb7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowObjectDataset.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.DataFactory.Models /// ServiceNow server dataset. public partial class ServiceNowObjectDataset : DataFactoryDatasetProperties { - /// Initializes a new instance of ServiceNowObjectDataset. + /// Initializes a new instance of . /// Linked service reference. /// is null. public ServiceNowObjectDataset(DataFactoryLinkedServiceReference linkedServiceName) : base(linkedServiceName) @@ -25,7 +25,7 @@ public ServiceNowObjectDataset(DataFactoryLinkedServiceReference linkedServiceNa DatasetType = "ServiceNowObject"; } - /// Initializes a new instance of ServiceNowObjectDataset. + /// Initializes a new instance of . /// Type of dataset. /// Dataset description. /// Columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. @@ -42,6 +42,11 @@ internal ServiceNowObjectDataset(string datasetType, string description, DataFac DatasetType = datasetType ?? "ServiceNowObject"; } + /// Initializes a new instance of for deserialization. + internal ServiceNowObjectDataset() + { + } + /// The table name. Type: string (or Expression with resultType string). public DataFactoryElement TableName { get; set; } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.Serialization.cs index 069aff922eec..f974c6c7696e 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ServiceNowSource : IUtf8JsonSerializable + public partial class ServiceNowSource : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Query)) { @@ -71,8 +77,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ServiceNowSource DeserializeServiceNowSource(JsonElement element) + internal static ServiceNowSource DeserializeServiceNowSource(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -162,5 +170,53 @@ internal static ServiceNowSource DeserializeServiceNowSource(JsonElement element additionalProperties = additionalPropertiesDictionary; return new ServiceNowSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, disableMetricsCollection.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value); } + + ServiceNowSource IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServiceNowSource(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServiceNowSource IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServiceNowSource(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServiceNowSource model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServiceNowSource(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServiceNowSource(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.cs index 0e6fedff7a57..0b9ba926f337 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServiceNowSource.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// A copy activity ServiceNow server source. public partial class ServiceNowSource : TabularSource { - /// Initializes a new instance of ServiceNowSource. + /// Initializes a new instance of . public ServiceNowSource() { CopySourceType = "ServiceNowSource"; } - /// Initializes a new instance of ServiceNowSource. + /// Initializes a new instance of . /// Copy source type. /// Source retry count. Type: integer (or Expression with resultType integer). /// Source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.Serialization.cs index b59829cf2056..83d8cb0a36d1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.Serialization.cs @@ -8,15 +8,21 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class ServicePrincipalCredential : IUtf8JsonSerializable + public partial class ServicePrincipalCredential : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); writer.WritePropertyName("type"u8); writer.WriteStringValue(CredentialType); @@ -82,8 +88,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ServicePrincipalCredential DeserializeServicePrincipalCredential(JsonElement element) + internal static ServicePrincipalCredential DeserializeServicePrincipalCredential(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -173,5 +181,53 @@ internal static ServicePrincipalCredential DeserializeServicePrincipalCredential additionalProperties = additionalPropertiesDictionary; return new ServicePrincipalCredential(type, description.Value, Optional.ToList(annotations), additionalProperties, servicePrincipalId.Value, servicePrincipalKey, tenant.Value); } + + ServicePrincipalCredential IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeServicePrincipalCredential(doc.RootElement, options); + } + + BinaryData IModelSerializable.Serialize(ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + return ModelSerializer.SerializeCore(this, options); + } + + ServicePrincipalCredential IModelSerializable.Deserialize(BinaryData data, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.Parse(data); + return DeserializeServicePrincipalCredential(doc.RootElement, options); + } + + /// Converts a into a . + /// The to convert. + public static implicit operator RequestContent(ServicePrincipalCredential model) + { + if (model is null) + { + return null; + } + + return RequestContent.Create(model, ModelSerializerOptions.DefaultWireOptions); + } + + /// Converts a into a . + /// The to convert. + public static explicit operator ServicePrincipalCredential(Response response) + { + if (response is null) + { + return null; + } + + using JsonDocument doc = JsonDocument.Parse(response.ContentStream); + return DeserializeServicePrincipalCredential(doc.RootElement, ModelSerializerOptions.DefaultWireOptions); + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.cs index 8328061e6baf..cb8062dc39d5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/ServicePrincipalCredential.cs @@ -14,13 +14,13 @@ namespace Azure.ResourceManager.DataFactory.Models /// Service principal credential. public partial class ServicePrincipalCredential : DataFactoryCredential { - /// Initializes a new instance of ServicePrincipalCredential. + /// Initializes a new instance of . public ServicePrincipalCredential() { CredentialType = "ServicePrincipal"; } - /// Initializes a new instance of ServicePrincipalCredential. + /// Initializes a new instance of . /// Type of credential. /// Credential description. /// List of tags that can be used for describing the Credential. diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SetVariableActivity.Serialization.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SetVariableActivity.Serialization.cs index 306dd8906c3a..452f9710f72d 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SetVariableActivity.Serialization.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Models/SetVariableActivity.Serialization.cs @@ -8,20 +8,33 @@ using System; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; using Azure.Core.Expressions.DataFactory; +using Azure.Core.Serialization; namespace Azure.ResourceManager.DataFactory.Models { - public partial class SetVariableActivity : IUtf8JsonSerializable + public partial class SetVariableActivity : IUtf8JsonSerializable, IModelJsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IModelJsonSerializable)this).Serialize(writer, ModelSerializerOptions.DefaultWireOptions); + + void IModelJsonSerializable.Serialize(Utf8JsonWriter writer, ModelSerializerOptions options) { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + writer.WriteStartObject(); if (Optional.IsDefined(Policy)) { writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy); + if (Policy is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)Policy).Serialize(writer, options); + } } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); @@ -48,7 +61,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in DependsOn) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -58,7 +78,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UserProperties) { - writer.WriteObjectValue(item); + if (item is null) + { + writer.WriteNullValue(); + } + else + { + ((IModelJsonSerializable)item).Serialize(writer, options); + } } writer.WriteEndArray(); } @@ -92,8 +119,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SetVariableActivity DeserializeSetVariableActivity(JsonElement element) + internal static SetVariableActivity DeserializeSetVariableActivity(JsonElement element, ModelSerializerOptions options = default) { + options ??= ModelSerializerOptions.DefaultWireOptions; + if (element.ValueKind == JsonValueKind.Null) { return null; @@ -223,5 +252,53 @@ internal static SetVariableActivity DeserializeSetVariableActivity(JsonElement e additionalProperties = additionalPropertiesDictionary; return new SetVariableActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, policy.Value, variableName.Value, value.Value, Optional.ToNullable(setSystemVariable)); } + + SetVariableActivity IModelJsonSerializable.Deserialize(ref Utf8JsonReader reader, ModelSerializerOptions options) + { + Core.ModelSerializerHelper.ValidateFormat(this, options.Format); + + using var doc = JsonDocument.ParseValue(ref reader); + return DeserializeSetVariableActivity(doc.RootElement, options); + } + + BinaryData IModelSerializable.Se{"code":"deadline_exceeded","msg":"operation timed out"}